-
Notifications
You must be signed in to change notification settings - Fork 2
/
HinglishEval.json
1150 lines (1150 loc) · 220 KB
/
HinglishEval.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[
{
"task_id": "HumanEval/0",
"prompt": "from typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\"\n Diye gaye numbers ki list mein, kya koi do numbers ek dusre se diye gaye threshold se zyada close hain.\n >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n False\n >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n True\n \"\"\"",
"entry_point": "has_close_elements",
"canonical_solution": " for idx, elem in enumerate(numbers):\n for idx2, elem2 in enumerate(numbers):\n if idx != idx2:\n distance = abs(elem - elem2)\n if distance < threshold:\n return True\n\n return False\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) == False\n assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) == True\n assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) == True\n assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) == False\n\n"
},
{
"task_id": "HumanEval/1",
"prompt": "from typing import List\n\n\ndef separate_paren_groups(paren_string: str) -> List[str]:\n \"\"\"\n Is function ka input ek string hota hai jisme multiple groups hote hain nested parentheses ke. Aapka goal hai\n un groups ko alag alag strings me separate karna aur unki list return karni hai.\n Separate groups balanced hote hain (har open brace sahi se close hota hai) aur ek dusre ke andar nested nahi hote\n Input string me koi bhi spaces ko ignore karo.\n >>> separate_paren_groups('( ) (( )) (( )( ))')\n ['()', '(())', '(()())']\n \"\"\"",
"entry_point": "separate_paren_groups",
"canonical_solution": " result = []\n current_string = []\n current_depth = 0\n\n for c in paren_string:\n if c == '(':\n current_depth += 1\n current_string.append(c)\n elif c == ')':\n current_depth -= 1\n current_string.append(c)\n\n if current_depth == 0:\n result.append(''.join(current_string))\n current_string.clear()\n\n return result\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('(()()) ((())) () ((())()())') == [\n '(()())', '((()))', '()', '((())()())'\n ]\n assert candidate('() (()) ((())) (((())))') == [\n '()', '(())', '((()))', '(((())))'\n ]\n assert candidate('(()(())((())))') == [\n '(()(())((())))'\n ]\n assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']\n"
},
{
"task_id": "HumanEval/2",
"prompt": "\n\ndef truncate_number(number: float) -> float:\n \"\"\"\n Diye gaye positive floating point number ko hum integer part (diye gaye number se chota sabse bada integer) aur decimals \n (hamesha 1 se chota bacha hua part) mein decompose kar sakte hain.\n\n Number ka decimal part return karo.\n >>> truncate_number(3.5)\n 0.5\n \"\"\"",
"entry_point": "truncate_number",
"canonical_solution": " return number % 1.0\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate(3.5) == 0.5\n assert abs(candidate(1.33) - 0.33) < 1e-6\n assert abs(candidate(123.456) - 0.456) < 1e-6\n"
},
{
"task_id": "HumanEval/3",
"prompt": "from typing import List\n\n\ndef below_zero(operations: List[int]) -> bool:\n \"\"\"\n Aapko ek list di gayi hai jisme bank account ke deposit aur withdrawal operations hain, jiska shuruat zero balance se hota hai. Aapka task hai detect karna ki kya kisi bhi point pe account ka balance zero se kam ho jata hai, aur us point pe function ko True return karna chahiye. Varna ise False return karna chahiye.\n >>> below_zero([1, 2, 3])\n False\n >>> below_zero([1, 2, -4, 5])\n True\n \"\"\"",
"entry_point": "below_zero",
"canonical_solution": " balance = 0\n\n for op in operations:\n balance += op\n if balance < 0:\n return True\n\n return False\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == False\n assert candidate([1, 2, -3, 1, 2, -3]) == False\n assert candidate([1, 2, -4, 5, 6]) == True\n assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False\n assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True\n assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True\n"
},
{
"task_id": "HumanEval/4",
"prompt": "from typing import List\n\n\ndef mean_absolute_deviation(numbers: List[float]) -> float:\n \"\"\"\n Diye gaye input numbers ki list ke liye, dataset ka Mean Absolute Deviation calculate karo.\n Mean Absolute Deviation woh average absolute difference hota hai jo har element aur ek centerpoint (is case mein mean) ke beech hota hai:\n MAD = average | x - x_mean |\n >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\n 1.0\n \"\"\"",
"entry_point": "mean_absolute_deviation",
"canonical_solution": " mean = sum(numbers) / len(numbers)\n return sum(abs(x - mean) for x in numbers) / len(numbers)\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert abs(candidate([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6\n assert abs(candidate([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6\n assert abs(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5.0) < 1e-6\n\n"
},
{
"task_id": "HumanEval/5",
"prompt": "from typing import List\n\n\ndef intersperse(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\"\n Input list `numbers' ke har do consecutive elements ke beech mein ek number 'delimeter' insert karo.\n >>> intersperse([], 4)\n []\n >>> intersperse([1, 2, 3], 4)\n [1, 4, 2, 4, 3]\n \"\"\"",
"entry_point": "intersperse",
"canonical_solution": " if not numbers:\n return []\n\n result = []\n\n for n in numbers[:-1]:\n result.append(n)\n result.append(delimeter)\n\n result.append(numbers[-1])\n\n return result\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([], 7) == []\n assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2]\n assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]\n"
},
{
"task_id": "HumanEval/6",
"prompt": "from typing import List\n\n\ndef parse_nested_parens(paren_string: str) -> List[int]:\n \"\"\"\n Is function ka input ek string hota hai jisme multiple groups hote hain jo nested parentheses se alag kiye gaye hote hain spaces ke dwara.\n Har group ke liye, sabse gehri level ki nesting of parentheses ka output do.\n Jaise ki, (()()) ka maximum do levels ki nesting hoti hai jabki ((())) ki teen hoti hai.\n\n >>> parse_nested_parens('(()()) ((())) () ((())()())')\n [2, 3, 1, 3]\n \"\"\"",
"entry_point": "parse_nested_parens",
"canonical_solution": " def parse_paren_group(s):\n depth = 0\n max_depth = 0\n for c in s:\n if c == '(':\n depth += 1\n max_depth = max(depth, max_depth)\n else:\n depth -= 1\n\n return max_depth\n\n return [parse_paren_group(x) for x in paren_string.split(' ') if x]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3]\n assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4]\n assert candidate('(()(())((())))') == [4]\n"
},
{
"task_id": "HumanEval/7",
"prompt": "from typing import List\n\n\ndef filter_by_substring(strings: List[str], substring: str) -> List[str]:\n \"\"\"\n Diye gaye input list ko sirf un strings ke liye filter karo jo diye gaye substring ko contain karti hain\n >>> filter_by_substring([], 'a')\n []\n >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')\n ['abc', 'bacd', 'array']\n \"\"\"",
"entry_point": "filter_by_substring",
"canonical_solution": " return [x for x in strings if substring in x]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([], 'john') == []\n assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']\n assert candidate(['xxx', 'asd', 'aaaxxy', 'john doe', 'xxxAAA', 'xxx'], 'xx') == ['xxx', 'aaaxxy', 'xxxAAA', 'xxx']\n assert candidate(['grunt', 'trumpet', 'prune', 'gruesome'], 'run') == ['grunt', 'prune']\n"
},
{
"task_id": "HumanEval/8",
"prompt": "from typing import List, Tuple\n\n\ndef sum_product(numbers: List[int]) -> Tuple[int, int]:\n \"\"\"\n Diye gaye integer list ke liye, ek tuple return karo jismei list ke saare integers ka sum aur product ho.\n Empty list ke sum ko 0 aur product ko 1 ke barabar hona chahiye.\n >>> sum_product([])\n (0, 1)\n >>> sum_product([1, 2, 3, 4])\n (10, 24)\n \"\"\"",
"entry_point": "sum_product",
"canonical_solution": " sum_value = 0\n prod_value = 1\n\n for n in numbers:\n sum_value += n\n prod_value *= n\n return sum_value, prod_value\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == (0, 1)\n assert candidate([1, 1, 1]) == (3, 1)\n assert candidate([100, 0]) == (100, 0)\n assert candidate([3, 5, 7]) == (3 + 5 + 7, 3 * 5 * 7)\n assert candidate([10]) == (10, 10)\n"
},
{
"task_id": "HumanEval/9",
"prompt": "from typing import List, Tuple\n\n\ndef rolling_max(numbers: List[int]) -> List[int]:\n \"\"\"\n Diye gaye integers ki list mei se, sequence me diye gaye har moment tak paye gaye rolling maximum element ki list generate karo.\n >>> rolling_max([1, 2, 3, 2, 3, 4, 2])\n [1, 2, 3, 3, 3, 4, 4]\n \"\"\"",
"entry_point": "rolling_max",
"canonical_solution": " running_max = None\n result = []\n\n for n in numbers:\n if running_max is None:\n running_max = n\n else:\n running_max = max(running_max, n)\n\n result.append(running_max)\n\n return result\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == []\n assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4]\n assert candidate([4, 3, 2, 1]) == [4, 4, 4, 4]\n assert candidate([3, 2, 3, 100, 3]) == [3, 3, 3, 100, 100]\n"
},
{
"task_id": "HumanEval/10",
"prompt": "\n\ndef is_palindrome(string: str) -> bool:\n \"\"\" Test karo ki kya diya gaya string palindrome hai ki nahi \"\"\"\n return string == string[::-1]\n\n\ndef make_palindrome(string: str) -> str:\n \"\"\"\n Diye gaye string ko check karo ki woh palindrome hai ya nahi.\n \"\"\"",
"entry_point": "make_palindrome",
"canonical_solution": " if not string:\n return ''\n\n beginning_of_suffix = 0\n\n while not is_palindrome(string[beginning_of_suffix:]):\n beginning_of_suffix += 1\n\n return string + string[:beginning_of_suffix][::-1]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == ''\n assert candidate('x') == 'x'\n assert candidate('xyz') == 'xyzyx'\n assert candidate('xyx') == 'xyx'\n assert candidate('jerry') == 'jerryrrej'\n"
},
{
"task_id": "HumanEval/11",
"prompt": "from typing import List\n\n\ndef string_xor(a: str, b: str) -> str:\n \"\"\"\n Input do strings a aur b honge jo sirf 1s aur 0s se bane honge.\n In inputs par binary XOR perform karo aur result ko bhi ek string ke roop mein return karo.\n >>> string_xor('010', '110')\n '100'\n \"\"\"",
"entry_point": "string_xor",
"canonical_solution": " def xor(i, j):\n if i == j:\n return '0'\n else:\n return '1'\n\n return ''.join(xor(x, y) for x, y in zip(a, b))\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('111000', '101010') == '010010'\n assert candidate('1', '1') == '0'\n assert candidate('0101', '0000') == '0101'\n"
},
{
"task_id": "HumanEval/12",
"prompt": "from typing import List, Optional\n\n\ndef longest(strings: List[str]) -> Optional[str]:\n \"\"\"\n String ki list se, sabse lamba string return karo. Agar same length ke multiple strings ho to pehla string return karo. Agar input list khali ho to None return karo.\n >>> longest([])\n\n >>> longest(['a', 'b', 'c'])\n 'a'\n >>> longest(['a', 'bb', 'ccc'])\n 'ccc'\n \"\"\"",
"entry_point": "longest",
"canonical_solution": " if not strings:\n return None\n\n maxlen = max(len(x) for x in strings)\n for s in strings:\n if len(s) == maxlen:\n return s\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == None\n assert candidate(['x', 'y', 'z']) == 'x'\n assert candidate(['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']) == 'zzzz'\n"
},
{
"task_id": "HumanEval/13",
"prompt": "\n\ndef greatest_common_divisor(a: int, b: int) -> int:\n \"\"\"\n Do integers a aur b ke greatest common divisor ko return karo\n >>> greatest_common_divisor(3, 5)\n 1\n >>> greatest_common_divisor(25, 15)\n 5\n \"\"\"",
"entry_point": "greatest_common_divisor",
"canonical_solution": " while b:\n a, b = b, a % b\n return a\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate(3, 7) == 1\n assert candidate(10, 15) == 5\n assert candidate(49, 14) == 7\n assert candidate(144, 60) == 12\n"
},
{
"task_id": "HumanEval/14",
"prompt": "from typing import List\n\n\ndef all_prefixes(string: str) -> List[str]:\n \"\"\"\n Input string ke sabhi prefixes ko shortest se longest tak, list mei return karo\n >>> all_prefixes('abc')\n ['a', 'ab', 'abc']\n \"\"\"",
"entry_point": "all_prefixes",
"canonical_solution": " result = []\n\n for i in range(len(string)):\n result.append(string[:i+1])\n return result\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == []\n assert candidate('asdfgh') == ['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']\n assert candidate('WWW') == ['W', 'WW', 'WWW']\n"
},
{
"task_id": "HumanEval/15",
"prompt": "\n\ndef string_sequence(n: int) -> str:\n \"\"\"\n Ek string return karo jisme 0 se lekar n tak ke numbers space-delimited honge.\n >>> string_sequence(0)\n '0'\n >>> string_sequence(5)\n '0 1 2 3 4 5'\n \"\"\"",
"entry_point": "string_sequence",
"canonical_solution": " return ' '.join([str(x) for x in range(n + 1)])\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate(0) == '0'\n assert candidate(3) == '0 1 2 3'\n assert candidate(10) == '0 1 2 3 4 5 6 7 8 9 10'\n"
},
{
"task_id": "HumanEval/16",
"prompt": "\n\ndef count_distinct_characters(string: str) -> int:\n \"\"\"\n Ek string di gayi hai, pata karo ki usme kitne alag-alag characters (case ki parwah kiye bina) hain\n >>> count_distinct_characters('xyzXYZ')\n 3\n >>> count_distinct_characters('Jerry')\n 4\n \"\"\"",
"entry_point": "count_distinct_characters",
"canonical_solution": " return len(set(string.lower()))\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == 0\n assert candidate('abcde') == 5\n assert candidate('abcde' + 'cade' + 'CADE') == 5\n assert candidate('aaaaAAAAaaaa') == 1\n assert candidate('Jerry jERRY JeRRRY') == 5\n"
},
{
"task_id": "HumanEval/17",
"prompt": "from typing import List\n\n\ndef parse_music(music_string: str) -> List[int]:\n \"\"\"\n Is function ka input ek string hai jo musical notes ko ek special ASCII format mein represent karta hai.\n Aapka kaam hai is string ko parse karna aur ek integers ki list return karna jo correspond karti hai ki har note kitne beats tak chalta hai.\n\n Yaha ek legend hai:\n 'o' - whole note, jo four beats tak chalta hai\n 'o|' - half note, jo two beats tak chalta hai\n '.|' - quater note, jo one beat tak chalta hai\n\n >>> parse_music('o o| .| o| o| .| .| .| .| o o')\n [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]\n \"\"\"",
"entry_point": "parse_music",
"canonical_solution": " note_map = {'o': 4, 'o|': 2, '.|': 1}\n return [note_map[x] for x in music_string.split(' ') if x]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == []\n assert candidate('o o o o') == [4, 4, 4, 4]\n assert candidate('.| .| .| .|') == [1, 1, 1, 1]\n assert candidate('o| o| .| .| o o o o') == [2, 2, 1, 1, 4, 4, 4, 4]\n assert candidate('o| .| o| .| o o| o o|') == [2, 1, 2, 1, 4, 2, 4, 2]\n"
},
{
"task_id": "HumanEval/18",
"prompt": "\n\ndef how_many_times(string: str, substring: str) -> int:\n \"\"\"\n Mool string mein diye gaye substring ko kitni baar mila ja sakta hai, yeh find karo. Overlapping cases ko bhi count karo.\n >>> how_many_times('', 'a')\n 0\n >>> how_many_times('aaa', 'a')\n 3\n >>> how_many_times('aaaa', 'aa')\n 3\n \"\"\"",
"entry_point": "how_many_times",
"canonical_solution": " times = 0\n\n for i in range(len(string) - len(substring) + 1):\n if string[i:i+len(substring)] == substring:\n times += 1\n\n return times\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('', 'x') == 0\n assert candidate('xyxyxyx', 'x') == 4\n assert candidate('cacacacac', 'cac') == 4\n assert candidate('john doe', 'john') == 1\n"
},
{
"task_id": "HumanEval/19",
"prompt": "from typing import List\n\n\ndef sort_numbers(numbers: str) -> str:\n \"\"\"\n Input ek space-delimited string hai jisme 'zero' se 'nine' tak ke numerals hain.\n Valid choices 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' aur 'nine' hain.\n Return karo string ko jisme numbers smallest se largest tak sorted honge\n >>> sort_numbers('three one five')\n 'one three five'\n \"\"\"",
"entry_point": "sort_numbers",
"canonical_solution": " value_map = {\n 'zero': 0,\n 'one': 1,\n 'two': 2,\n 'three': 3,\n 'four': 4,\n 'five': 5,\n 'six': 6,\n 'seven': 7,\n 'eight': 8,\n 'nine': 9\n }\n return ' '.join(sorted([x for x in numbers.split(' ') if x], key=lambda x: value_map[x]))\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == ''\n assert candidate('three') == 'three'\n assert candidate('three five nine') == 'three five nine'\n assert candidate('five zero four seven nine eight') == 'zero four five seven eight nine'\n assert candidate('six five four three two one zero') == 'zero one two three four five six'\n"
},
{
"task_id": "HumanEval/20",
"prompt": "from typing import List, Tuple\n\n\ndef find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n \"\"\"\n Diye gaye numbers ki list se (jo ki kam se kam do numbers ki honi chahiye) do aise numbers chun ke return karo jo ek dusre ke sabse kareeb ho aur unhe order mein return karo (chota number, bada number).\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n (2.0, 2.2)\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n (2.0, 2.0)\n \"\"\"",
"entry_point": "find_closest_elements",
"canonical_solution": " closest_pair = None\n distance = None\n\n for idx, elem in enumerate(numbers):\n for idx2, elem2 in enumerate(numbers):\n if idx != idx2:\n if distance is None:\n distance = abs(elem - elem2)\n closest_pair = tuple(sorted([elem, elem2]))\n else:\n new_distance = abs(elem - elem2)\n if new_distance < distance:\n distance = new_distance\n closest_pair = tuple(sorted([elem, elem2]))\n\n return closest_pair\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)\n assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)\n assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)\n assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)\n\n"
},
{
"task_id": "HumanEval/21",
"prompt": "from typing import List\n\n\ndef rescale_to_unit(numbers: List[float]) -> List[float]:\n \"\"\"\n Diye gaye numbers ki list (kam se kam do elements ki) par ek linear transform apply karo,\n aisa ki sabse chota number 0 ban jaye aur sabse bada number 1 ban jaye\n >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])\n [0.0, 0.25, 0.5, 0.75, 1.0]\n \"\"\"",
"entry_point": "rescale_to_unit",
"canonical_solution": " min_number = min(numbers)\n max_number = max(numbers)\n return [(x - min_number) / (max_number - min_number) for x in numbers]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([2.0, 49.9]) == [0.0, 1.0]\n assert candidate([100.0, 49.9]) == [1.0, 0.0]\n assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]\n assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]\n assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]\n"
},
{
"task_id": "HumanEval/22",
"prompt": "from typing import List, Any\n\n\ndef filter_integers(values: List[Any]) -> List[int]:\n \"\"\"\n Diye gaye python values ki list ko sirf integers ke liye filter karo\n >>> filter_integers(['a', 3.14, 5])\n [5]\n >>> filter_integers([1, 2, 3, 'abc', {}, []])\n [1, 2, 3]\n \"\"\"",
"entry_point": "filter_integers",
"canonical_solution": " return [x for x in values if isinstance(x, int)]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == []\n assert candidate([4, {}, [], 23.2, 9, 'adasd']) == [4, 9]\n assert candidate([3, 'c', 3, 3, 'a', 'b']) == [3, 3, 3]\n"
},
{
"task_id": "HumanEval/23",
"prompt": "\n\ndef strlen(string: str) -> int:\n \"\"\"\n Diye gaye string ki length return karo\n >>> strlen('')\n 0\n >>> strlen('abc')\n 3\n \"\"\"",
"entry_point": "strlen",
"canonical_solution": " return len(string)\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == 0\n assert candidate('x') == 1\n assert candidate('asdasnakj') == 9\n"
},
{
"task_id": "HumanEval/24",
"prompt": "\n\ndef largest_divisor(n: int) -> int:\n \"\"\"\n Diye gaye number n ke liye, sabse bada number dhundo jo n ko evenly divide karta ho, jo ki n se chota ho.\n >>> largest_divisor(15)\n 5\n \"\"\"",
"entry_point": "largest_divisor",
"canonical_solution": " for i in reversed(range(n)):\n if n % i == 0:\n return i\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate(3) == 1\n assert candidate(7) == 1\n assert candidate(10) == 5\n assert candidate(100) == 50\n assert candidate(49) == 7\n"
},
{
"task_id": "HumanEval/25",
"prompt": "from typing import List\n\n\ndef factorize(n: int) -> List[int]:\n \"\"\"\n Diye gaye integer ke prime factors ki list return karo, order chhote se bade tak hona chahiye.\n Har ek factor ko utni baar list mein hona chahiye jitni baar wo factorization mein aata hai.\n Input number sabhi factors ka product hona chahiye\n >>> factorize(8)\n [2, 2, 2]\n >>> factorize(25)\n [5, 5]\n >>> factorize(70)\n [2, 5, 7]\n \"\"\"",
"entry_point": "factorize",
"canonical_solution": " import math\n fact = []\n i = 2\n while i <= int(math.sqrt(n) + 1):\n if n % i == 0:\n fact.append(i)\n n //= i\n else:\n i += 1\n\n if n > 1:\n fact.append(n)\n return fact\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate(2) == [2]\n assert candidate(4) == [2, 2]\n assert candidate(8) == [2, 2, 2]\n assert candidate(3 * 19) == [3, 19]\n assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]\n assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]\n assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]\n assert candidate(3 * 2 * 3) == [2, 3, 3]\n"
},
{
"task_id": "HumanEval/26",
"prompt": "from typing import List\n\n\ndef remove_duplicates(numbers: List[int]) -> List[int]:\n \"\"\"\n Ek integers ki list se, saare elements hata do jo ek se zyada baar occur karte hain.\n Bache hue elements ka order input ke jaisa hi rakho.\n >>> remove_duplicates([1, 2, 3, 2, 4])\n [1, 3, 4]\n \"\"\"",
"entry_point": "remove_duplicates",
"canonical_solution": " import collections\n c = collections.Counter(numbers)\n return [n for n in numbers if c[n] <= 1]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == []\n assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4]\n assert candidate([1, 2, 3, 2, 4, 3, 5]) == [1, 4, 5]\n"
},
{
"task_id": "HumanEval/27",
"prompt": "\n\ndef flip_case(string: str) -> str:\n \"\"\"\n Diye gaye string ke liye, lowercase characters ko uppercase me aur uppercase characters ko lowercase me flip karo.\n >>> flip_case('Hello')\n 'hELLO'\n \"\"\"",
"entry_point": "flip_case",
"canonical_solution": " return string.swapcase()\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate('') == ''\n assert candidate('Hello!') == 'hELLO!'\n assert candidate('These violent delights have violent ends') == 'tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS'\n"
},
{
"task_id": "HumanEval/28",
"prompt": "from typing import List\n\n\ndef concatenate(strings: List[str]) -> str:\n \"\"\"\n Strings ki list ko ek single string mein jodo\n >>> concatenate([])\n ''\n >>> concatenate(['a', 'b', 'c'])\n 'abc'\n \"\"\"",
"entry_point": "concatenate",
"canonical_solution": " return ''.join(strings)\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([]) == ''\n assert candidate(['x', 'y', 'z']) == 'xyz'\n assert candidate(['x', 'y', 'z', 'w', 'k']) == 'xyzwk'\n"
},
{
"task_id": "HumanEval/29",
"prompt": "from typing import List\n\n\ndef filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n \"\"\"\n Diye gaye prefix se shuru hone wale strings ke liye input list ko filter karo.\n >>> filter_by_prefix([], 'a')\n []\n >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')\n ['abc', 'array']\n \"\"\"",
"entry_point": "filter_by_prefix",
"canonical_solution": " return [x for x in strings if x.startswith(prefix)]\n",
"test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([], 'john') == []\n assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']\n"
},
{
"task_id": "HumanEval/30",
"prompt": "\n\ndef get_positive(l: list):\n \"\"\"\n List mein se sirf positive numbers return karo.\n >>> get_positive([-1, 2, -4, 5, 6])\n [2, 5, 6]\n >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n [5, 3, 2, 3, 9, 123, 1]\n \"\"\"",
"entry_point": "get_positive",
"canonical_solution": " return [e for e in l if e > 0]\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([-1, -2, 4, 5, 6]) == [4, 5, 6]\n assert candidate([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 3, 9, 123, 1]\n assert candidate([-1, -2]) == []\n assert candidate([]) == []\n\n"
},
{
"task_id": "HumanEval/31",
"prompt": "\n\ndef is_prime(n):\n \"\"\"\n Agar diya gaya number prime hai to true return karo, aur anyatha false.\n >>> is_prime(6)\n False\n >>> is_prime(101)\n True\n >>> is_prime(11)\n True\n >>> is_prime(13441)\n True\n >>> is_prime(61)\n True\n >>> is_prime(4)\n False\n >>> is_prime(1)\n False\n \"\"\"",
"entry_point": "is_prime",
"canonical_solution": " if n < 2:\n return False\n for k in range(2, n - 1):\n if n % k == 0:\n return False\n return True\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(6) == False\n assert candidate(101) == True\n assert candidate(11) == True\n assert candidate(13441) == True\n assert candidate(61) == True\n assert candidate(4) == False\n assert candidate(1) == False\n assert candidate(5) == True\n assert candidate(11) == True\n assert candidate(17) == True\n assert candidate(5 * 17) == False\n assert candidate(11 * 7) == False\n assert candidate(13441 * 19) == False\n\n"
},
{
"task_id": "HumanEval/32",
"prompt": "import math\n\n\ndef poly(xs: list, x: float):\n \"\"\"\n xs coefficients wale polynomial ko point x par evaluate karo.\n return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n\n \"\"\"\n return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])\n\n\ndef find_zero(xs: list):\n \"\"\"\n Polynomial ko evaluate karta hai coefficients xs ke saath point x par.\n return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n\n \"\"\"",
"entry_point": "find_zero",
"canonical_solution": " begin, end = -1., 1.\n while poly(xs, begin) * poly(xs, end) > 0:\n begin *= 2.0\n end *= 2.0\n while end - begin > 1e-10:\n center = (begin + end) / 2.0\n if poly(xs, center) * poly(xs, begin) > 0:\n begin = center\n else:\n end = center\n return begin\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n import math\n import random\n rng = random.Random(42)\n import copy\n for _ in range(100):\n ncoeff = 2 * rng.randint(1, 4)\n coeffs = []\n for _ in range(ncoeff):\n coeff = rng.randint(-10, 10)\n if coeff == 0:\n coeff = 1\n coeffs.append(coeff)\n solution = candidate(copy.deepcopy(coeffs))\n assert math.fabs(poly(coeffs, solution)) < 1e-4\n\n"
},
{
"task_id": "HumanEval/33",
"prompt": "\n\ndef sort_third(l: list):\n \"\"\"\n Yeh function ek list l leta hai aur ek list l' return karta hai aisa ki\n l' wahi hai jaisa l hai un indices par jo three se divisible nahi hote, jabki uske values un indices par jo three se divisible hote hain, wahi hoti hain\n jaisi corresponding indices ki values l ki hoti hain, lekin sorted.\n >>> sort_third([1, 2, 3])\n [1, 2, 3]\n >>> sort_third([5, 6, 3, 4, 8, 9, 2])\n [2, 6, 3, 4, 8, 9, 5]\n \"\"\"",
"entry_point": "sort_third",
"canonical_solution": " l = list(l)\n l[::3] = sorted(l[::3])\n return l\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert tuple(candidate([1, 2, 3])) == tuple(sort_third([1, 2, 3]))\n assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple(sort_third([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]))\n assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple(sort_third([5, 8, -12, 4, 23, 2, 3, 11, 12, -10]))\n assert tuple(candidate([5, 6, 3, 4, 8, 9, 2])) == tuple([2, 6, 3, 4, 8, 9, 5])\n assert tuple(candidate([5, 8, 3, 4, 6, 9, 2])) == tuple([2, 8, 3, 4, 6, 9, 5])\n assert tuple(candidate([5, 6, 9, 4, 8, 3, 2])) == tuple([2, 6, 9, 4, 8, 3, 5])\n assert tuple(candidate([5, 6, 3, 4, 8, 9, 2, 1])) == tuple([2, 6, 3, 4, 8, 9, 5, 1])\n\n"
},
{
"task_id": "HumanEval/34",
"prompt": "\n\ndef unique(l: list):\n \"\"\"\n Ek list mein sorted unique elements return karo\n >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [0, 2, 3, 5, 9, 123]\n \"\"\"",
"entry_point": "unique",
"canonical_solution": " return sorted(list(set(l)))\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]\n\n"
},
{
"task_id": "HumanEval/35",
"prompt": "\n\ndef max_element(l: list):\n \"\"\"\n List mein se maximum element return karo.\n >>> max_element([1, 2, 3])\n 3\n >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n 123\n \"\"\"",
"entry_point": "max_element",
"canonical_solution": " m = l[0]\n for e in l:\n if e > m:\n m = e\n return m\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([1, 2, 3]) == 3\n assert candidate([5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10]) == 124\n"
},
{
"task_id": "HumanEval/36",
"prompt": "\n\ndef fizz_buzz(n: int):\n \"\"\"\n n se kam integers mein, jo 11 ya 13 se divisible hain, usme digit 7 kitni baar aata hai, uska count return karo.\n >>> fizz_buzz(50)\n 0\n >>> fizz_buzz(78)\n 2\n >>> fizz_buzz(79)\n 3\n \"\"\"",
"entry_point": "fizz_buzz",
"canonical_solution": " ns = []\n for i in range(n):\n if i % 11 == 0 or i % 13 == 0:\n ns.append(i)\n s = ''.join(list(map(str, ns)))\n ans = 0\n for c in s:\n ans += (c == '7')\n return ans\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(50) == 0\n assert candidate(78) == 2\n assert candidate(79) == 3\n assert candidate(100) == 3\n assert candidate(200) == 6\n assert candidate(4000) == 192\n assert candidate(10000) == 639\n assert candidate(100000) == 8026\n\n"
},
{
"task_id": "HumanEval/37",
"prompt": "\n\ndef sort_even(l: list):\n \"\"\"\n Yeh function ek list l leta hai aur ek list l' return karta hai aisa ki\n l' l ke odd indices ke saath identical hota hai, jabki uske even indices ke values\n l ke even indices ke values ke barabar hoti hai, lekin sorted.\n >>> sort_even([1, 2, 3])\n [1, 2, 3]\n >>> sort_even([5, 6, 3, 4])\n [3, 6, 5, 4]\n \"\"\"",
"entry_point": "sort_even",
"canonical_solution": " evens = l[::2]\n odds = l[1::2]\n evens.sort()\n ans = []\n for e, o in zip(evens, odds):\n ans.extend([e, o])\n if len(evens) > len(odds):\n ans.append(evens[-1])\n return ans\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3])\n assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123])\n assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])\n\n"
},
{
"task_id": "HumanEval/38",
"prompt": "\n\ndef encode_cyclic(s: str):\n \"\"\"\n Teen characters ke groups ko cycle karke encoded string return karo.\n \"\"\"\n # Strings ko groups mein split karo. Sabki length 3.\n groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)]\n # Har group ke elements ko cycle karo. Jabtak group mei elements 3 se kam na ho.\n groups = [(group[1:] + group[0]) if len(group) == 3 else group for group in groups]\n return \"\".join(groups)\n\n\ndef decode_cyclic(s: str):\n \"\"\"\n teen characters ke groups ko cycle karke encoded string return karta hai.\n \"\"\"",
"entry_point": "decode_cyclic",
"canonical_solution": " return encode_cyclic(encode_cyclic(s))\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n from random import randint, choice\n import string\n\n letters = string.ascii_lowercase\n for _ in range(100):\n str = ''.join(choice(letters) for i in range(randint(10, 20)))\n encoded_str = encode_cyclic(str)\n assert candidate(encoded_str) == str\n\n"
},
{
"task_id": "HumanEval/39",
"prompt": "\n\ndef prime_fib(n: int):\n \"\"\"\n prime_fib woh n-th number return karta hai jo ek Fibonacci number bhi hai aur prime number bhi.\n >>> prime_fib(1)\n 2\n >>> prime_fib(2)\n 3\n >>> prime_fib(3)\n 5\n >>> prime_fib(4)\n 13\n >>> prime_fib(5)\n 89\n \"\"\"",
"entry_point": "prime_fib",
"canonical_solution": " import math\n\n def is_prime(p):\n if p < 2:\n return False\n for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):\n if p % k == 0:\n return False\n return True\n f = [0, 1]\n while True:\n f.append(f[-1] + f[-2])\n if is_prime(f[-1]):\n n -= 1\n if n == 0:\n return f[-1]\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(1) == 2\n assert candidate(2) == 3\n assert candidate(3) == 5\n assert candidate(4) == 13\n assert candidate(5) == 89\n assert candidate(6) == 233\n assert candidate(7) == 1597\n assert candidate(8) == 28657\n assert candidate(9) == 514229\n assert candidate(10) == 433494437\n\n"
},
{
"task_id": "HumanEval/40",
"prompt": "\n\ndef triples_sum_to_zero(l: list):\n \"\"\"\n triples_sum_to_zero ek integers ki list ko input ke roop mein leta hai.\n Yeh True return karta hai agar list mein teen distinct elements hain jo\n zero ke barabar sum karte hain, aur anyatha False.\n\n >>> triples_sum_to_zero([1, 3, 5, 0])\n False\n >>> triples_sum_to_zero([1, 3, -2, 1])\n True\n >>> triples_sum_to_zero([1, 2, 3, 7])\n False\n >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])\n True\n >>> triples_sum_to_zero([1])\n False\n \"\"\"",
"entry_point": "triples_sum_to_zero",
"canonical_solution": " for i in range(len(l)):\n for j in range(i + 1, len(l)):\n for k in range(j + 1, len(l)):\n if l[i] + l[j] + l[k] == 0:\n return True\n return False\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([1, 3, 5, 0]) == False\n assert candidate([1, 3, 5, -1]) == False\n assert candidate([1, 3, -2, 1]) == True\n assert candidate([1, 2, 3, 7]) == False\n assert candidate([1, 2, 5, 7]) == False\n assert candidate([2, 4, -5, 3, 9, 7]) == True\n assert candidate([1]) == False\n assert candidate([1, 3, 5, -100]) == False\n assert candidate([100, 3, 5, -100]) == False\n\n"
},
{
"task_id": "HumanEval/41",
"prompt": "\n\ndef car_race_collision(n: int):\n \"\"\"\n Socho ek road ko jo ek perfectly straight aur infinitely long line hai.\n n cars left se right ki taraf ja rahi hain; saath hi, ek alag set of n cars\n right se left ki taraf ja rahi hain. Dono set of cars shuruat mein ek dusre se bahut door hoti hain.\n Saari cars same speed mein move karti hain. Do cars tab takraati hain jab\n ek car jo left se right ja rahi hoti hai, right se left ja rahi car se takraati hai.\n Lekin, cars infinitely sturdy aur strong hoti hain; isliye, unka movement\n unke trajectory mein continue hota hai jaise ki unka collision hua hi nahi.\n\n Ye function aise collisions ki sankhya output karta hai.\n \"\"\"",
"entry_point": "car_race_collision",
"canonical_solution": " return n**2\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(2) == 4\n assert candidate(3) == 9\n assert candidate(4) == 16\n assert candidate(8) == 64\n assert candidate(10) == 100\n\n"
},
{
"task_id": "HumanEval/42",
"prompt": "\n\ndef incr_list(l: list):\n \"\"\"\n Elements ko 1 se badhakar wala list return karo.\n >>> incr_list([1, 2, 3])\n [2, 3, 4]\n >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [6, 4, 6, 3, 4, 4, 10, 1, 124]\n \"\"\"",
"entry_point": "incr_list",
"canonical_solution": " return [(e + 1) for e in l]\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([]) == []\n assert candidate([3, 2, 1]) == [4, 3, 2]\n assert candidate([5, 2, 5, 2, 3, 3, 9, 0, 123]) == [6, 3, 6, 3, 4, 4, 10, 1, 124]\n\n"
},
{
"task_id": "HumanEval/43",
"prompt": "\n\ndef pairs_sum_to_zero(l):\n \"\"\"\n pairs_sum_to_zero ek integers ki list ko input ke roop mein leta hai.\n Yeh True return karta hai agar list mein do alag elements hote hain jo\n zero ke barabar sum karte hain, aur anyatha False.\n >>> pairs_sum_to_zero([1, 3, 5, 0])\n False\n >>> pairs_sum_to_zero([1, 3, -2, 1])\n False\n >>> pairs_sum_to_zero([1, 2, 3, 7])\n False\n >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])\n True\n >>> pairs_sum_to_zero([1])\n False\n \"\"\"",
"entry_point": "pairs_sum_to_zero",
"canonical_solution": " for i, l1 in enumerate(l):\n for j in range(i + 1, len(l)):\n if l1 + l[j] == 0:\n return True\n return False\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([1, 3, 5, 0]) == False\n assert candidate([1, 3, -2, 1]) == False\n assert candidate([1, 2, 3, 7]) == False\n assert candidate([2, 4, -5, 3, 5, 7]) == True\n assert candidate([1]) == False\n\n assert candidate([-3, 9, -1, 3, 2, 30]) == True\n assert candidate([-3, 9, -1, 3, 2, 31]) == True\n assert candidate([-3, 9, -1, 4, 2, 30]) == False\n assert candidate([-3, 9, -1, 4, 2, 31]) == False\n\n"
},
{
"task_id": "HumanEval/44",
"prompt": "\n\ndef change_base(x: int, base: int):\n \"\"\"\n Input number x ka numerical base, base me badal do.\n Conversion ke baad string representation return karo.\n Base numbers 10 se kam hote hain.\n >>> change_base(8, 3)\n '22'\n >>> change_base(8, 2)\n '1000'\n >>> change_base(7, 2)\n '111'\n \"\"\"",
"entry_point": "change_base",
"canonical_solution": " ret = \"\"\n while x > 0:\n ret = str(x % base) + ret\n x //= base\n return ret\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(8, 3) == \"22\"\n assert candidate(9, 3) == \"100\"\n assert candidate(234, 2) == \"11101010\"\n assert candidate(16, 2) == \"10000\"\n assert candidate(8, 2) == \"1000\"\n assert candidate(7, 2) == \"111\"\n for x in range(2, 8):\n assert candidate(x, x + 1) == str(x)\n\n"
},
{
"task_id": "HumanEval/45",
"prompt": "\n\ndef triangle_area(a, h):\n \"\"\"\n Ek side ki length aur height di gayi ho to, triangle ka area return karo.\n >>> triangle_area(5, 3)\n 7.5\n \"\"\"",
"entry_point": "triangle_area",
"canonical_solution": " return a * h / 2.0\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(5, 3) == 7.5\n assert candidate(2, 2) == 2.0\n assert candidate(10, 8) == 40.0\n\n"
},
{
"task_id": "HumanEval/46",
"prompt": "\n\ndef fib4(n: int):\n \"\"\"\n Fib4 number sequence ek sequence hai jo Fibbonacci sequence ke saman hai, jo is prakar se define kiya gaya hai:\n fib4(0) -> 0\n fib4(1) -> 0\n fib4(2) -> 2\n fib4(3) -> 0\n fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).\n Kripya ek function likhe jo efficiently fib4 number sequence ka n-th element compute kare. Recursion ka use na kare.\n >>> fib4(5)\n 4\n >>> fib4(6)\n 8\n >>> fib4(7)\n 14\n \"\"\"",
"entry_point": "fib4",
"canonical_solution": " results = [0, 0, 2, 0]\n if n < 4:\n return results[n]\n\n for _ in range(4, n + 1):\n results.append(results[-1] + results[-2] + results[-3] + results[-4])\n results.pop(0)\n\n return results[-1]\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(5) == 4\n assert candidate(8) == 28\n assert candidate(10) == 104\n assert candidate(12) == 386\n\n"
},
{
"task_id": "HumanEval/47",
"prompt": "\n\ndef median(l: list):\n \"\"\"\n List l ke elements ka median return karo.\n >>> median([3, 1, 2, 4, 5])\n 3\n >>> median([-10, 4, 6, 1000, 10, 20])\n 15.0\n \"\"\"",
"entry_point": "median",
"canonical_solution": " l = sorted(l)\n if len(l) % 2 == 1:\n return l[len(l) // 2]\n else:\n return (l[len(l) // 2 - 1] + l[len(l) // 2]) / 2.0\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([3, 1, 2, 4, 5]) == 3\n assert candidate([-10, 4, 6, 1000, 10, 20]) == 8.0\n assert candidate([5]) == 5\n assert candidate([6, 5]) == 5.5\n assert candidate([8, 1, 3, 9, 9, 2, 7]) == 7 \n\n"
},
{
"task_id": "HumanEval/48",
"prompt": "\n\ndef is_palindrome(text: str):\n \"\"\"\n Diye gaye string ko check karta hai ki kya yeh palindrome hai\n >>> is_palindrome('')\n True\n >>> is_palindrome('aba')\n True\n >>> is_palindrome('aaaaa')\n True\n >>> is_palindrome('zbcd')\n False\n \"\"\"",
"entry_point": "is_palindrome",
"canonical_solution": " for i in range(len(text)):\n if text[i] != text[len(text) - 1 - i]:\n return False\n return True\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate('') == True\n assert candidate('aba') == True\n assert candidate('aaaaa') == True\n assert candidate('zbcd') == False\n assert candidate('xywyx') == True\n assert candidate('xywyz') == False\n assert candidate('xywzx') == False\n\n"
},
{
"task_id": "HumanEval/49",
"prompt": "\n\ndef modp(n: int, p: int):\n \"\"\"\n 2^n modulo p return karo (numerics ka dhyan rakho).\n >>> modp(3, 5)\n 3\n >>> modp(1101, 101)\n 2\n >>> modp(0, 101)\n 1\n >>> modp(3, 11)\n 8\n >>> modp(100, 101)\n 1\n \"\"\"",
"entry_point": "modp",
"canonical_solution": " ret = 1\n for i in range(n):\n ret = (2 * ret) % p\n return ret\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(3, 5) == 3\n assert candidate(1101, 101) == 2\n assert candidate(0, 101) == 1\n assert candidate(3, 11) == 8\n assert candidate(100, 101) == 1\n assert candidate(30, 5) == 4\n assert candidate(31, 5) == 3\n\n"
},
{
"task_id": "HumanEval/50",
"prompt": "\n\ndef encode_shift(s: str):\n \"\"\"\n Har character ko alphabet mein 5 se shift karke encoded string return karo.\n \"\"\"\n return \"\".join([chr(((ord(ch) + 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])\n\n\ndef decode_shift(s: str):\n \"\"\"\n Har character ko alphabet mein 5 shifts karke encoded string return karta hai.\n \"\"\"",
"entry_point": "decode_shift",
"canonical_solution": " return \"\".join([chr(((ord(ch) - 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n from random import randint, choice\n import copy\n import string\n\n letters = string.ascii_lowercase\n for _ in range(100):\n str = ''.join(choice(letters) for i in range(randint(10, 20)))\n encoded_str = encode_shift(str)\n assert candidate(copy.deepcopy(encoded_str)) == str\n\n"
},
{
"task_id": "HumanEval/51",
"prompt": "\n\ndef remove_vowels(text):\n \"\"\"\n remove_vowels ek function hai jo string leta hai aur vowels ke bina string return karta hai.\n >>> remove_vowels('')\n ''\n >>> remove_vowels(\"abcdef\\nghijklm\")\n 'bcdf\\nghjklm'\n >>> remove_vowels('abcdef')\n 'bcdf'\n >>> remove_vowels('aaaaa')\n ''\n >>> remove_vowels('aaBAA')\n 'B'\n >>> remove_vowels('zbcd')\n 'zbcd'\n \"\"\"",
"entry_point": "remove_vowels",
"canonical_solution": " return \"\".join([s for s in text if s.lower() not in [\"a\", \"e\", \"i\", \"o\", \"u\"]])\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate('') == ''\n assert candidate(\"abcdef\\nghijklm\") == 'bcdf\\nghjklm'\n assert candidate('fedcba') == 'fdcb'\n assert candidate('eeeee') == ''\n assert candidate('acBAA') == 'cB'\n assert candidate('EcBOO') == 'cB'\n assert candidate('ybcd') == 'ybcd'\n\n"
},
{
"task_id": "HumanEval/52",
"prompt": "\n\ndef below_threshold(l: list, t: int):\n \"\"\"\n Agar list l mein saare numbers threshold t se kam hai to True return karo.\n >>> below_threshold([1, 2, 4, 10], 100)\n True\n >>> below_threshold([1, 20, 4, 10], 5)\n False\n \"\"\"",
"entry_point": "below_threshold",
"canonical_solution": " for e in l:\n if e >= t:\n return False\n return True\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([1, 2, 4, 10], 100)\n assert not candidate([1, 20, 4, 10], 5)\n assert candidate([1, 20, 4, 10], 21)\n assert candidate([1, 20, 4, 10], 22)\n assert candidate([1, 8, 4, 10], 11)\n assert not candidate([1, 8, 4, 10], 10)\n\n"
},
{
"task_id": "HumanEval/53",
"prompt": "\n\ndef add(x: int, y: int):\n \"\"\"\n Do numbers x aur y ko jodo\n >>> add(2, 3)\n 5\n >>> add(5, 7)\n 12\n \"\"\"",
"entry_point": "add",
"canonical_solution": " return x + y\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n import random\n\n assert candidate(0, 1) == 1\n assert candidate(1, 0) == 1\n assert candidate(2, 3) == 5\n assert candidate(5, 7) == 12\n assert candidate(7, 5) == 12\n\n for i in range(100):\n x, y = random.randint(0, 1000), random.randint(0, 1000)\n assert candidate(x, y) == x + y\n\n"
},
{
"task_id": "HumanEval/54",
"prompt": "\n\ndef same_chars(s0: str, s1: str):\n \"\"\"\n Dekho ki do shabd me same characters hai ya nahi.\n >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')\n True\n >>> same_chars('abcd', 'dddddddabc')\n True\n >>> same_chars('dddddddabc', 'abcd')\n True\n >>> same_chars('eabcd', 'dddddddabc')\n False\n >>> same_chars('abcd', 'dddddddabce')\n False\n >>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')\n False\n \"\"\"",
"entry_point": "same_chars",
"canonical_solution": " return set(s0) == set(s1)\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate('eabcdzzzz', 'dddzzzzzzzddeddabc') == True\n assert candidate('abcd', 'dddddddabc') == True\n assert candidate('dddddddabc', 'abcd') == True\n assert candidate('eabcd', 'dddddddabc') == False\n assert candidate('abcd', 'dddddddabcf') == False\n assert candidate('eabcdzzzz', 'dddzzzzzzzddddabc') == False\n assert candidate('aabb', 'aaccc') == False\n\n"
},
{
"task_id": "HumanEval/55",
"prompt": "\n\ndef fib(n: int):\n \"\"\"\n n-th Fibonacci number return karo.\n >>> fib(10)\n 55\n >>> fib(1)\n 1\n >>> fib(8)\n 21\n \"\"\"",
"entry_point": "fib",
"canonical_solution": " if n == 0:\n return 0\n if n == 1:\n return 1\n return fib(n - 1) + fib(n - 2)\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(10) == 55\n assert candidate(1) == 1\n assert candidate(8) == 21\n assert candidate(11) == 89\n assert candidate(12) == 144\n\n"
},
{
"task_id": "HumanEval/56",
"prompt": "\n\ndef correct_bracketing(brackets: str):\n \"\"\"\n brackets ek string hai \"<\" aur \">\" ka.\n return True agar har opening bracket ka ek corresponding closing bracket ho.\n\n >>> correct_bracketing(\"<\")\n False\n >>> correct_bracketing(\"<>\")\n True\n >>> correct_bracketing(\"<<><>>\")\n True\n >>> correct_bracketing(\"><<>\")\n False\n \"\"\"",
"entry_point": "correct_bracketing",
"canonical_solution": " depth = 0\n for b in brackets:\n if b == \"<\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(\"<>\")\n assert candidate(\"<<><>>\")\n assert candidate(\"<><><<><>><>\")\n assert candidate(\"<><><<<><><>><>><<><><<>>>\")\n assert not candidate(\"<<<><>>>>\")\n assert not candidate(\"><<>\")\n assert not candidate(\"<\")\n assert not candidate(\"<<<<\")\n assert not candidate(\">\")\n assert not candidate(\"<<>\")\n assert not candidate(\"<><><<><>><>><<>\")\n assert not candidate(\"<><><<><>><>>><>\")\n\n"
},
{
"task_id": "HumanEval/57",
"prompt": "\n\ndef monotonic(l: list):\n \"\"\"\n True return karo agar list ke elements monotonically badh rahe ho ya ghat rahe ho.\n >>> monotonic([1, 2, 4, 20])\n True\n >>> monotonic([1, 20, 4, 10])\n False\n >>> monotonic([4, 1, 0, -10])\n True\n \"\"\"",
"entry_point": "monotonic",
"canonical_solution": " if l == sorted(l) or l == sorted(l, reverse=True):\n return True\n return False\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([1, 2, 4, 10]) == True\n assert candidate([1, 2, 4, 20]) == True\n assert candidate([1, 20, 4, 10]) == False\n assert candidate([4, 1, 0, -10]) == True\n assert candidate([4, 1, 1, 0]) == True\n assert candidate([1, 2, 3, 2, 5, 60]) == False\n assert candidate([1, 2, 3, 4, 5, 60]) == True\n assert candidate([9, 9, 9, 9]) == True\n\n"
},
{
"task_id": "HumanEval/58",
"prompt": "\n\ndef common(l1: list, l2: list):\n \"\"\"\n Do lists ke liye sorted unique common elements return karo.\n >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])\n [1, 5, 653]\n >>> common([5, 3, 2, 8], [3, 2])\n [2, 3]\n \"\"\"",
"entry_point": "common",
"canonical_solution": " ret = set()\n for e1 in l1:\n for e2 in l2:\n if e1 == e2:\n ret.add(e1)\n return sorted(list(ret))\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]\n assert candidate([5, 3, 2, 8], [3, 2]) == [2, 3]\n assert candidate([4, 3, 2, 8], [3, 2, 4]) == [2, 3, 4]\n assert candidate([4, 3, 2, 8], []) == []\n\n"
},
{
"task_id": "HumanEval/59",
"prompt": "\n\ndef largest_prime_factor(n: int):\n \"\"\"\n n ka sabse bada prime factor return karo. Maan lo ki n > 1 hai aur yeh prime nahi hai.\n >>> largest_prime_factor(13195)\n 29\n >>> largest_prime_factor(2048)\n 2\n \"\"\"",
"entry_point": "largest_prime_factor",
"canonical_solution": " def is_prime(k):\n if k < 2:\n return False\n for i in range(2, k - 1):\n if k % i == 0:\n return False\n return True\n largest = 1\n for j in range(2, n + 1):\n if n % j == 0 and is_prime(j):\n largest = max(largest, j)\n return largest\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(15) == 5\n assert candidate(27) == 3\n assert candidate(63) == 7\n assert candidate(330) == 11\n assert candidate(13195) == 29\n\n"
},
{
"task_id": "HumanEval/60",
"prompt": "\n\ndef sum_to_n(n: int):\n \"\"\"\n sum_to_n ek function hai jo 1 se lekar n tak ke numbers ka sum karta hai.\n >>> sum_to_n(30)\n 465\n >>> sum_to_n(100)\n 5050\n >>> sum_to_n(5)\n 15\n >>> sum_to_n(10)\n 55\n >>> sum_to_n(1)\n 1\n \"\"\"",
"entry_point": "sum_to_n",
"canonical_solution": " return sum(range(n + 1))\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(1) == 1\n assert candidate(6) == 21\n assert candidate(11) == 66\n assert candidate(30) == 465\n assert candidate(100) == 5050\n\n"
},
{
"task_id": "HumanEval/61",
"prompt": "\n\ndef correct_bracketing(brackets: str):\n \"\"\"\n brackets ek string hai \"(\" aur \")\" ka.\n return True agar har opening bracket ka ek corresponding closing bracket ho.\n\n >>> correct_bracketing(\"(\")\n False\n >>> correct_bracketing(\"()\")\n True\n >>> correct_bracketing(\"(()())\")\n True\n >>> correct_bracketing(\")(()\")\n False\n \"\"\"",
"entry_point": "correct_bracketing",
"canonical_solution": " depth = 0\n for b in brackets:\n if b == \"(\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(\"()\")\n assert candidate(\"(()())\")\n assert candidate(\"()()(()())()\")\n assert candidate(\"()()((()()())())(()()(()))\")\n assert not candidate(\"((()())))\")\n assert not candidate(\")(()\")\n assert not candidate(\"(\")\n assert not candidate(\"((((\")\n assert not candidate(\")\")\n assert not candidate(\"(()\")\n assert not candidate(\"()()(()())())(()\")\n assert not candidate(\"()()(()())()))()\")\n\n"
},
{
"task_id": "HumanEval/62",
"prompt": "\n\ndef derivative(xs: list):\n \"\"\"\n xs ek polynomial ke coefficients ko represent karte hain.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Is polynomial ka derivative same form mein return karo.\n >>> derivative([3, 1, 2, 4, 5])\n [1, 4, 12, 20]\n >>> derivative([1, 2, 3])\n [2, 6]\n \"\"\"",
"entry_point": "derivative",
"canonical_solution": " return [(i * x) for i, x in enumerate(xs)][1:]\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate([3, 1, 2, 4, 5]) == [1, 4, 12, 20]\n assert candidate([1, 2, 3]) == [2, 6]\n assert candidate([3, 2, 1]) == [2, 2]\n assert candidate([3, 2, 1, 0, 4]) == [2, 2, 0, 16]\n assert candidate([1]) == []\n\n"
},
{
"task_id": "HumanEval/63",
"prompt": "\n\ndef fibfib(n: int):\n \"\"\"\n FibFib number sequence ek sequence hai jo Fibbonacci sequence ke saman hai aur iska definition is prakar hai:\n fibfib(0) == 0\n fibfib(1) == 0\n fibfib(2) == 1\n fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).\n Kripya ek function likhe jo efficiently fibfib number sequence ka n-th element compute kare.\n >>> fibfib(1)\n 0\n >>> fibfib(5)\n 4\n >>> fibfib(8)\n 24\n \"\"\"",
"entry_point": "fibfib",
"canonical_solution": " if n == 0:\n return 0\n if n == 1:\n return 0\n if n == 2:\n return 1\n return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)\n",
"test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n assert candidate(2) == 1\n assert candidate(1) == 0\n assert candidate(5) == 4\n assert candidate(8) == 24\n assert candidate(10) == 81\n assert candidate(12) == 274\n assert candidate(14) == 927\n\n"
},
{
"task_id": "HumanEval/64",
"prompt": "\nFIX = \"\"\"\nAdd more test cases.\n\"\"\"\n\ndef vowels_count(s):\n \"\"\"\n Aur test cases jodo.\n \"\"\"",
"entry_point": "vowels_count",
"canonical_solution": " vowels = \"aeiouAEIOU\"\n n_vowels = sum(c in vowels for c in s)\n if s[-1] == 'y' or s[-1] == 'Y':\n n_vowels += 1\n return n_vowels\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"abcde\") == 2, \"Test 1\"\n assert candidate(\"Alone\") == 3, \"Test 2\"\n assert candidate(\"key\") == 2, \"Test 3\"\n assert candidate(\"bye\") == 1, \"Test 4\"\n assert candidate(\"keY\") == 2, \"Test 5\"\n assert candidate(\"bYe\") == 1, \"Test 6\"\n assert candidate(\"ACEDY\") == 3, \"Test 7\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/65",
"prompt": "\ndef circular_shift(x, shift):\n \"\"\"\n Integer x ke digits ko circular shift karo, digits ko right mein shift karo by shift\n aur result ko string ke roop mein return karo.\n Agar shift > digits ki number ho, toh reversed digits return karo.\n >>> circular_shift(12, 1)\n \"21\"\n >>> circular_shift(12, 2)\n \"12\"\n \"\"\"",
"entry_point": "circular_shift",
"canonical_solution": " s = str(x)\n if shift > len(s):\n return s[::-1]\n else:\n return s[len(s) - shift:] + s[:len(s) - shift]\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(100, 2) == \"001\"\n assert candidate(12, 2) == \"12\"\n assert candidate(97, 8) == \"79\"\n assert candidate(12, 1) == \"21\", \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(11, 101) == \"11\", \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/66",
"prompt": "\ndef digitSum(s):\n \"\"\"\n Task\n Ek function likho jo ek string ko input ke roop mein leta hai aur sirf upper characters'\n ASCII codes ka sum return karta hai.\n\n Udaharan:\n digitSum(\"\") => 0\n digitSum(\"abAB\") => 131\n digitSum(\"abcCd\") => 67\n digitSum(\"helloE\") => 69\n digitSum(\"woArBld\") => 131\n digitSum(\"aAaaaXa\") => 153\n \"\"\"",
"entry_point": "digitSum",
"canonical_solution": " if s == \"\": return 0\n return sum(ord(char) if char.isupper() else 0 for char in s)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(\"\") == 0, \"Error\"\n assert candidate(\"abAB\") == 131, \"Error\"\n assert candidate(\"abcCd\") == 67, \"Error\"\n assert candidate(\"helloE\") == 69, \"Error\"\n assert candidate(\"woArBld\") == 131, \"Error\"\n assert candidate(\"aAaaaXa\") == 153, \"Error\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate(\" How are yOu?\") == 151, \"Error\"\n assert candidate(\"You arE Very Smart\") == 327, \"Error\"\n\n"
},
{
"task_id": "HumanEval/67",
"prompt": "\ndef fruit_distribution(s,n):\n \"\"\"\n Is task mein, aapko ek string di jayegi jo ek fruit basket mein distribute kiye gaye apples aur oranges ki sankhya ko darshati hai. Ye basket mein apples, oranges, aur mango fruits hote hain. Diye gaye string se jo total number of oranges aur apples ko darshati hai aur ek integer jo basket mein total fruits ki sankhya ko darshati hai, use use karke basket mein mango fruits ki sankhya return karo.\n Jaise ki:\n fruit_distribution(\"5 apples and 6 oranges\", 19) ->19 - 5 - 6 = 8\n fruit_distribution(\"0 apples and 1 oranges\",3) -> 3 - 0 - 1 = 2\n fruit_distribution(\"2 apples and 3 oranges\", 100) -> 100 - 2 - 3 = 95\n fruit_distribution(\"100 apples and 1 oranges\",120) -> 120 - 100 - 1 = 19\n \"\"\"",
"entry_point": "fruit_distribution",
"canonical_solution": " lis = list()\n for i in s.split(' '):\n if i.isdigit():\n lis.append(int(i))\n return n - sum(lis)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"5 apples and 6 oranges\",19) == 8\n assert candidate(\"5 apples and 6 oranges\",21) == 10\n assert candidate(\"0 apples and 1 oranges\",3) == 2\n assert candidate(\"1 apples and 0 oranges\",3) == 2\n assert candidate(\"2 apples and 3 oranges\",100) == 95\n assert candidate(\"2 apples and 3 oranges\",5) == 0\n assert candidate(\"1 apples and 100 oranges\",120) == 19\n"
},
{
"task_id": "HumanEval/68",
"prompt": "\ndef pluck(arr):\n \"\"\"\n \"Ek array diya gaya hai jo ek tree ki branch ko represent karta hai jisme non-negative integer nodes hote hain\n aapka task hai ek node ko pluck karke return karna.\n Plucked node woh hona chahiye jiska sabse chhota even value ho.\n Agar multiple nodes milte hain jinka same sabse chhota even value ho toh woh node return karo jiska sabse chhota index ho.\n\n Plucked node ko ek list me return karna chahiye, [ sabse_chhota_value, uska index ],\n Agar koi bhi even values na ho ya diya gaya array khali ho, toh [] return karo.\n\n Example 1:\n Input: [4,2,3]\n Output: [2, 1]\n Explanation: 2 ka sabse chhota even value hai, aur 2 ka sabse chhota index hai.\n\n Example 2:\n Input: [1,2,3]\n Output: [2, 1]\n Explanation: 2 ka sabse chhota even value hai, aur 2 ka sabse chhota index hai. \n\n Example 3:\n Input: []\n Output: []\n \n Example 4:\n Input: [5, 0, 3, 0, 4, 2]\n Output: [0, 1]\n Explanation: 0 sabse chhota value hai, lekin yahan do zeros hain,\n isliye hum pehla zero choose karenge, jiska sabse chhota index hai.\n\n Constraints:\n * 1 <= nodes.length <= 10000\n * 0 <= node.value\n \"\"\"",
"entry_point": "pluck",
"canonical_solution": " if(len(arr) == 0): return []\n evens = list(filter(lambda x: x%2 == 0, arr))\n if(evens == []): return []\n return [min(evens), arr.index(min(evens))]\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([4,2,3]) == [2, 1], \"Error\"\n assert candidate([1,2,3]) == [2, 1], \"Error\"\n assert candidate([]) == [], \"Error\"\n assert candidate([5, 0, 3, 0, 4, 2]) == [0, 1], \"Error\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([1, 2, 3, 0, 5, 3]) == [0, 3], \"Error\"\n assert candidate([5, 4, 8, 4 ,8]) == [4, 1], \"Error\"\n assert candidate([7, 6, 7, 1]) == [6, 1], \"Error\"\n assert candidate([7, 9, 7, 1]) == [], \"Error\"\n\n"
},
{
"task_id": "HumanEval/69",
"prompt": "\ndef search(lst):\n \"\"\"\n Aapko ek non-empty list di gayi hai positive integers ki. Return karo sabse bada integer jo zero se bada ho, \n aur uska frequency us integer ke value ke barabar ya usse zyada ho. \n Ek integer ka frequency uski list mein kitni baar aane ki sankhya hoti hai.\n Agar aisa koi value nahi hai, to -1 return karo.\n Udaharan:\n search([4, 1, 2, 2, 3, 1]) == 2\n search([1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3\n search([5, 5, 4, 4, 4]) == -1\n \"\"\"",
"entry_point": "search",
"canonical_solution": " frq = [0] * (max(lst) + 1)\n for i in lst:\n frq[i] += 1;\n\n ans = -1\n for i in range(1, len(frq)):\n if frq[i] >= i:\n ans = i\n \n return ans\n",
"test": "def check(candidate):\n\n # manually generated tests\n assert candidate([5, 5, 5, 5, 1]) == 1\n assert candidate([4, 1, 4, 1, 4, 4]) == 4\n assert candidate([3, 3]) == -1\n assert candidate([8, 8, 8, 8, 8, 8, 8, 8]) == 8\n assert candidate([2, 3, 3, 2, 2]) == 2\n\n # automatically generated tests\n assert candidate([2, 7, 8, 8, 4, 8, 7, 3, 9, 6, 5, 10, 4, 3, 6, 7, 1, 7, 4, 10, 8, 1]) == 1\n assert candidate([3, 2, 8, 2]) == 2\n assert candidate([6, 7, 1, 8, 8, 10, 5, 8, 5, 3, 10]) == 1\n assert candidate([8, 8, 3, 6, 5, 6, 4]) == -1\n assert candidate([6, 9, 6, 7, 1, 4, 7, 1, 8, 8, 9, 8, 10, 10, 8, 4, 10, 4, 10, 1, 2, 9, 5, 7, 9]) == 1\n assert candidate([1, 9, 10, 1, 3]) == 1\n assert candidate([6, 9, 7, 5, 8, 7, 5, 3, 7, 5, 10, 10, 3, 6, 10, 2, 8, 6, 5, 4, 9, 5, 3, 10]) == 5\n assert candidate([1]) == 1\n assert candidate([8, 8, 10, 6, 4, 3, 5, 8, 2, 4, 2, 8, 4, 6, 10, 4, 2, 1, 10, 2, 1, 1, 5]) == 4\n assert candidate([2, 10, 4, 8, 2, 10, 5, 1, 2, 9, 5, 5, 6, 3, 8, 6, 4, 10]) == 2\n assert candidate([1, 6, 10, 1, 6, 9, 10, 8, 6, 8, 7, 3]) == 1\n assert candidate([9, 2, 4, 1, 5, 1, 5, 2, 5, 7, 7, 7, 3, 10, 1, 5, 4, 2, 8, 4, 1, 9, 10, 7, 10, 2, 8, 10, 9, 4]) == 4\n assert candidate([2, 6, 4, 2, 8, 7, 5, 6, 4, 10, 4, 6, 3, 7, 8, 8, 3, 1, 4, 2, 2, 10, 7]) == 4\n assert candidate([9, 8, 6, 10, 2, 6, 10, 2, 7, 8, 10, 3, 8, 2, 6, 2, 3, 1]) == 2\n assert candidate([5, 5, 3, 9, 5, 6, 3, 2, 8, 5, 6, 10, 10, 6, 8, 4, 10, 7, 7, 10, 8]) == -1\n assert candidate([10]) == -1\n assert candidate([9, 7, 7, 2, 4, 7, 2, 10, 9, 7, 5, 7, 2]) == 2\n assert candidate([5, 4, 10, 2, 1, 1, 10, 3, 6, 1, 8]) == 1\n assert candidate([7, 9, 9, 9, 3, 4, 1, 5, 9, 1, 2, 1, 1, 10, 7, 5, 6, 7, 6, 7, 7, 6]) == 1\n assert candidate([3, 10, 10, 9, 2]) == -1\n\n"
},
{
"task_id": "HumanEval/70",
"prompt": "\ndef strange_sort_list(lst):\n \"\"\"\n Diye gaye integers ki list ko, strange order mein return karo.\n Strange sorting, tab hoti hai jab aap minimum value se start karte ho,\n phir remaining integers ki maximum value, phir minimum aur aise hi aage badhte ho.\n\n Udaharan:\n strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3]\n strange_sort_list([5, 5, 5, 5]) == [5, 5, 5, 5]\n strange_sort_list([]) == []\n \"\"\"",
"entry_point": "strange_sort_list",
"canonical_solution": " res, switch = [], True\n while lst:\n res.append(min(lst) if switch else max(lst))\n lst.remove(res[-1])\n switch = not switch\n return res\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1, 2, 3, 4]) == [1, 4, 2, 3]\n assert candidate([5, 6, 7, 8, 9]) == [5, 9, 6, 8, 7]\n assert candidate([1, 2, 3, 4, 5]) == [1, 5, 2, 4, 3]\n assert candidate([5, 6, 7, 8, 9, 1]) == [1, 9, 5, 8, 6, 7]\n assert candidate([5, 5, 5, 5]) == [5, 5, 5, 5]\n assert candidate([]) == []\n assert candidate([1,2,3,4,5,6,7,8]) == [1, 8, 2, 7, 3, 6, 4, 5]\n assert candidate([0,2,2,2,5,5,-5,-5]) == [-5, 5, -5, 5, 0, 2, 2, 2]\n assert candidate([111111]) == [111111]\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/71",
"prompt": "\ndef triangle_area(a, b, c):\n \"\"\"\n Trikon ke teeno sides ke lengths diye gaye hain. Agar teeno sides ek valid trikon banate hain to trikon ka area 2 decimal points tak round off karke return karo.\n Anyatha -1 return karo.\n Teen sides tabhi ek valid trikon banati hain jab kisi bhi do sides ka yog teesri side se adhik hota hai.\n Udaharan:\n triangle_area(3, 4, 5) == 6.00\n triangle_area(1, 2, 10) == -1\n \"\"\"",
"entry_point": "triangle_area",
"canonical_solution": " if a + b <= c or a + c <= b or b + c <= a:\n return -1 \n s = (a + b + c)/2 \n area = (s * (s - a) * (s - b) * (s - c)) ** 0.5\n area = round(area, 2)\n return area\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(3, 4, 5) == 6.00, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(1, 2, 10) == -1\n assert candidate(4, 8, 5) == 8.18\n assert candidate(2, 2, 2) == 1.73\n assert candidate(1, 2, 3) == -1\n assert candidate(10, 5, 7) == 16.25\n assert candidate(2, 6, 3) == -1\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(1, 1, 1) == 0.43, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate(2, 2, 10) == -1\n\n"
},
{
"task_id": "HumanEval/72",
"prompt": "\ndef will_it_fly(q,w):\n \"\"\"\n Ek function likho jo True return kare agar object q udega, aur False otherwise.\n Object q tabhi udega jab vo balanced ho (yani ki ek palindromic list ho) aur uske elements ka sum maximum possible weight w se kam ya barabar ho.\n\n Udaharan:\n will_it_fly([1, 2], 5) ➞ False \n # 1+2 maximum possible weight se kam hai, lekin ye balanced nahi hai.\n\n will_it_fly([3, 2, 3], 1) ➞ False\n # ye balanced hai, lekin 3+2+3 maximum possible weight se jyada hai.\n\n will_it_fly([3, 2, 3], 9) ➞ True\n # 3+2+3 maximum possible weight se kam hai, aur ye balanced hai.\n\n will_it_fly([3], 5) ➞ True\n # 3 maximum possible weight se kam hai, aur ye balanced hai.\n \"\"\"",
"entry_point": "will_it_fly",
"canonical_solution": " if sum(q) > w:\n return False\n\n i, j = 0, len(q)-1\n while i<j:\n if q[i] != q[j]:\n return False\n i+=1\n j-=1\n return True\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([3, 2, 3], 9) is True\n assert candidate([1, 2], 5) is False\n assert candidate([3], 5) is True\n assert candidate([3, 2, 3], 1) is False\n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([1, 2, 3], 6) is False\n assert candidate([5], 5) is True\n\n"
},
{
"task_id": "HumanEval/73",
"prompt": "\ndef smallest_change(arr):\n \"\"\"\n Ek array arr diya gaya hai integers ka, usme se minimum kitne elements ko change karna padega \n taaki array palindromic ban jaye. Ek palindromic array woh hota hai jo aage se bhi aur peeche se bhi \n same padhta hai. Ek change me, aap ek element ko kisi bhi dusre element se replace kar sakte ho.\n\n Jaise ki:\n smallest_change([1,2,3,5,4,7,9,6]) == 4\n smallest_change([1, 2, 3, 4, 3, 2, 2]) == 1\n smallest_change([1, 2, 3, 2, 1]) == 0\n \"\"\"",
"entry_point": "smallest_change",
"canonical_solution": " ans = 0\n for i in range(len(arr) // 2):\n if arr[i] != arr[len(arr) - i - 1]:\n ans += 1\n return ans\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1,2,3,5,4,7,9,6]) == 4\n assert candidate([1, 2, 3, 4, 3, 2, 2]) == 1\n assert candidate([1, 4, 2]) == 1\n assert candidate([1, 4, 4, 2]) == 1\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([1, 2, 3, 2, 1]) == 0\n assert candidate([3, 1, 1, 3]) == 0\n assert candidate([1]) == 0\n assert candidate([0, 1]) == 1\n\n"
},
{
"task_id": "HumanEval/74",
"prompt": "\ndef total_match(lst1, lst2):\n \"\"\"\n Ek function likho jo do string ki lists ko accept kare aur woh list return kare jisme \n total number of chars saare strings me dusre list se kam ho.\n\n Agar dono lists me same number of chars ho, toh pehli list return karo.\n\n Udaharan\n total_match([], []) ➞ []\n total_match(['hi', 'admin'], ['hI', 'Hi']) ➞ ['hI', 'Hi']\n total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) ➞ ['hi', 'admin']\n total_match(['hi', 'admin'], ['hI', 'hi', 'hi']) ➞ ['hI', 'hi', 'hi']\n total_match(['4'], ['1', '2', '3', '4', '5']) ➞ ['4']\n \"\"\"",
"entry_point": "total_match",
"canonical_solution": " l1 = 0\n for st in lst1:\n l1 += len(st)\n \n l2 = 0\n for st in lst2:\n l2 += len(st)\n \n if l1 <= l2:\n return lst1\n else:\n return lst2\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([], []) == []\n assert candidate(['hi', 'admin'], ['hi', 'hi']) == ['hi', 'hi']\n assert candidate(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) == ['hi', 'admin']\n assert candidate(['4'], ['1', '2', '3', '4', '5']) == ['4']\n assert candidate(['hi', 'admin'], ['hI', 'Hi']) == ['hI', 'Hi']\n assert candidate(['hi', 'admin'], ['hI', 'hi', 'hi']) == ['hI', 'hi', 'hi']\n assert candidate(['hi', 'admin'], ['hI', 'hi', 'hii']) == ['hi', 'admin']\n\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([], ['this']) == []\n assert candidate(['this'], []) == []\n\n"
},
{
"task_id": "HumanEval/75",
"prompt": "\ndef is_multiply_prime(a):\n \"\"\"\n Ek function likho jo true return kare agar diya gaya number 3 prime numbers ka multiplication hai\n aur false agar aisa nahi hai.\n Jahan (a) 100 se kam hai. \n Udaharan:\n is_multiply_prime(30) == True\n 30 = 2 * 3 * 5\n \"\"\"",
"entry_point": "is_multiply_prime",
"canonical_solution": " def is_prime(n):\n for j in range(2,n):\n if n%j == 0:\n return False\n return True\n\n for i in range(2,101):\n if not is_prime(i): continue\n for j in range(2,101):\n if not is_prime(j): continue\n for k in range(2,101):\n if not is_prime(k): continue\n if i*j*k == a: return True\n return False\n",
"test": "def check(candidate):\n\n assert candidate(5) == False\n assert candidate(30) == True\n assert candidate(8) == True\n assert candidate(10) == False\n assert candidate(125) == True\n assert candidate(3 * 5 * 7) == True\n assert candidate(3 * 6 * 7) == False\n assert candidate(9 * 9 * 9) == False\n assert candidate(11 * 9 * 9) == False\n assert candidate(11 * 13 * 7) == True\n\n"
},
{
"task_id": "HumanEval/76",
"prompt": "\ndef is_simple_power(x, n):\n \"\"\"\n Aapka task hai ek function likhna jo true return kare agar number x, n ka simple\n power hai aur false return kare anya cases mein.\n x n ka simple power hai agar n**int=x\n Jaise ki:\n is_simple_power(1, 4) => true\n is_simple_power(2, 2) => true\n is_simple_power(8, 2) => true\n is_simple_power(3, 2) => false\n is_simple_power(3, 1) => false\n is_simple_power(5, 3) => false\n \"\"\"",
"entry_point": "is_simple_power",
"canonical_solution": " if (n == 1): \n return (x == 1) \n power = 1\n while (power < x): \n power = power * n \n return (power == x) \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(16, 2)== True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(143214, 16)== False, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(4, 2)==True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(9, 3)==True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(16, 4)==True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(24, 2)==False, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(128, 4)==False, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(12, 6)==False, \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(1, 1)==True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate(1, 12)==True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/77",
"prompt": "\ndef iscube(a):\n \"\"\"\n Ek function likho jo ek integer a leta hai aur True return karta hai \n agar yeh integer kisi integer number ka cube hai.\n Dhyan de: aap maan sakte ho ki input hamesha valid hoga.\n Udaharan:\n iscube(1) ==> True\n iscube(2) ==> False\n iscube(-1) ==> True\n iscube(64) ==> True\n iscube(0) ==> True\n iscube(180) ==> False\n \"\"\"",
"entry_point": "iscube",
"canonical_solution": " a = abs(a)\n return int(round(a ** (1. / 3))) ** 3 == a\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(1) == True, \"First test error: \" + str(candidate(1))\n assert candidate(2) == False, \"Second test error: \" + str(candidate(2))\n assert candidate(-1) == True, \"Third test error: \" + str(candidate(-1))\n assert candidate(64) == True, \"Fourth test error: \" + str(candidate(64))\n assert candidate(180) == False, \"Fifth test error: \" + str(candidate(180))\n assert candidate(1000) == True, \"Sixth test error: \" + str(candidate(1000))\n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(0) == True, \"1st edge test error: \" + str(candidate(0))\n assert candidate(1729) == False, \"2nd edge test error: \" + str(candidate(1728))\n\n"
},
{
"task_id": "HumanEval/78",
"prompt": "\ndef hex_key(num):\n \"\"\"\n Aapko ek function likhna hai jo ek hexadecimal number ko string ke roop mein leta hai aur ginata hai ki kitne hexadecimal digits prime hain (prime number, ya prime, ek natural number hota hai jo 1 se bada hota hai aur do chote natural numbers ka product nahi hota).\n Hexadecimal digits hote hain 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.\n Prime numbers hote hain 2, 3, 5, 7, 11, 13, 17,...\n To aapko ye determine karna hai ki nimn digits ki sankhya kitni hai: 2, 3, 5, 7, B (=decimal 11), D (=decimal 13).\n Note: aap maan sakte hain ki input hamesha sahi ya empty string hoga, aur symbols A,B,C,D,E,F hamesha uppercase mein honge.\n Examples:\n Agar num = \"AB\" hai to output 1 hona chahiye.\n Agar num = \"1077E\" hai to output 2 hona chahiye.\n Agar num = \"ABED1A33\" hai to output 4 hona chahiye.\n Agar num = \"123456789ABCDEF0\" hai to output 6 hona chahiye.\n Agar num = \"2020\" hai to output 2 hona chahiye.\n \"\"\"",
"entry_point": "hex_key",
"canonical_solution": " primes = ('2', '3', '5', '7', 'B', 'D')\n total = 0\n for i in range(0, len(num)):\n if num[i] in primes:\n total += 1\n return total\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"AB\") == 1, \"First test error: \" + str(candidate(\"AB\")) \n assert candidate(\"1077E\") == 2, \"Second test error: \" + str(candidate(\"1077E\")) \n assert candidate(\"ABED1A33\") == 4, \"Third test error: \" + str(candidate(\"ABED1A33\")) \n assert candidate(\"2020\") == 2, \"Fourth test error: \" + str(candidate(\"2020\")) \n assert candidate(\"123456789ABCDEF0\") == 6, \"Fifth test error: \" + str(candidate(\"123456789ABCDEF0\")) \n assert candidate(\"112233445566778899AABBCCDDEEFF00\") == 12, \"Sixth test error: \" + str(candidate(\"112233445566778899AABBCCDDEEFF00\")) \n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([]) == 0\n\n"
},
{
"task_id": "HumanEval/79",
"prompt": "\ndef decimal_to_binary(decimal):\n \"\"\"\n Aapko ek number decimal form mein diya jayega aur aapka task hai use\n binary format mein convert karna. Function ek string return karega, jisme har character ek binary\n number ko represent karega. String mein har character '0' ya '1' hoga.\n\n String ke shuru aur ant mein 'db' naam ke kuch extra characters honge.\n Ye extra characters format ke liye diye gaye hain.\n\n Udaharan:\n decimal_to_binary(15) # returns \"db1111db\"\n decimal_to_binary(32) # returns \"db100000db\"\n \"\"\"",
"entry_point": "decimal_to_binary",
"canonical_solution": " return \"db\" + bin(decimal)[2:] + \"db\"\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(0) == \"db0db\"\n assert candidate(32) == \"db100000db\"\n assert candidate(103) == \"db1100111db\"\n assert candidate(15) == \"db1111db\", \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/80",
"prompt": "\ndef is_happy(s):\n \"\"\"\n Aapko ek string s di gayi hai.\n Aapka task hai check karna ki string happy hai ya nahi.\n Ek string tabhi happy hogi jab uski length kam se kam 3 ho aur har 3 consecutive letters distinct ho.\n Jaise ki:\n is_happy(a) => False\n is_happy(aa) => False\n is_happy(abcd) => True\n is_happy(aabb) => False\n is_happy(adb) => True\n is_happy(xyy) => False\n \"\"\"",
"entry_point": "is_happy",
"canonical_solution": " if len(s) < 3:\n return False\n\n for i in range(len(s) - 2):\n \n if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]:\n return False\n return True\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"a\") == False , \"a\"\n assert candidate(\"aa\") == False , \"aa\"\n assert candidate(\"abcd\") == True , \"abcd\"\n assert candidate(\"aabb\") == False , \"aabb\"\n assert candidate(\"adb\") == True , \"adb\"\n assert candidate(\"xyy\") == False , \"xyy\"\n assert candidate(\"iopaxpoi\") == True , \"iopaxpoi\"\n assert candidate(\"iopaxioi\") == False , \"iopaxioi\"\n"
},
{
"task_id": "HumanEval/81",
"prompt": "\ndef numerical_letter_grade(grades):\n \"\"\"\n Yeh semester ka aakhri week hai aur teacher ko students ko grades dena hai.\n Teacher ne apna khud ka algorithm banaya hai grading ke liye.\n Sirf ek problem hai, unhone jo code use kiya tha grading ke liye, woh kho gaya hai.\n Unhone aapko kuch students ke GPAs ki list di hai aur aapko ek function likhna hai \n jo letter grades ki list output kar sake, neeche diye gaye table ke hisaab se:\n GPA | Letter grade\n 4.0 A+\n > 3.7 A \n > 3.3 A- \n > 3.0 B+\n > 2.7 B \n > 2.3 B-\n > 2.0 C+\n > 1.7 C\n > 1.3 C-\n > 1.0 D+ \n > 0.7 D \n > 0.0 D-\n 0.0 E\n \n\n Example:\n grade_equation([4.0, 3, 1.7, 2, 3.5]) ==> ['A+', 'B', 'C-', 'C', 'A-']\n \"\"\"",
"entry_point": "numerical_letter_grade",
"canonical_solution": "\n \n letter_grade = []\n for gpa in grades:\n if gpa == 4.0:\n letter_grade.append(\"A+\")\n elif gpa > 3.7:\n letter_grade.append(\"A\")\n elif gpa > 3.3:\n letter_grade.append(\"A-\")\n elif gpa > 3.0:\n letter_grade.append(\"B+\")\n elif gpa > 2.7:\n letter_grade.append(\"B\")\n elif gpa > 2.3:\n letter_grade.append(\"B-\")\n elif gpa > 2.0:\n letter_grade.append(\"C+\")\n elif gpa > 1.7:\n letter_grade.append(\"C\")\n elif gpa > 1.3:\n letter_grade.append(\"C-\")\n elif gpa > 1.0:\n letter_grade.append(\"D+\")\n elif gpa > 0.7:\n letter_grade.append(\"D\")\n elif gpa > 0.0:\n letter_grade.append(\"D-\")\n else:\n letter_grade.append(\"E\")\n return letter_grade\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([4.0, 3, 1.7, 2, 3.5]) == ['A+', 'B', 'C-', 'C', 'A-']\n assert candidate([1.2]) == ['D+']\n assert candidate([0.5]) == ['D-']\n assert candidate([0.0]) == ['E']\n assert candidate([1, 0.3, 1.5, 2.8, 3.3]) == ['D', 'D-', 'C-', 'B', 'B+']\n assert candidate([0, 0.7]) == ['E', 'D-']\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/82",
"prompt": "\ndef prime_length(string):\n \"\"\"\n Ek function likho jo ek string leta hai aur return karta hai True agar string \n ki length ek prime number hai ya False otherwise\n Udaharan\n prime_length('Hello') == True\n prime_length('abcdcba') == True\n prime_length('kittens') == True\n prime_length('orange') == False\n \"\"\"",
"entry_point": "prime_length",
"canonical_solution": " l = len(string)\n if l == 0 or l == 1:\n return False\n for i in range(2, l):\n if l % i == 0:\n return False\n return True\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('Hello') == True\n assert candidate('abcdcba') == True\n assert candidate('kittens') == True\n assert candidate('orange') == False\n assert candidate('wow') == True\n assert candidate('world') == True\n assert candidate('MadaM') == True\n assert candidate('Wow') == True\n assert candidate('') == False\n assert candidate('HI') == True\n assert candidate('go') == True\n assert candidate('gogo') == False\n assert candidate('aaaaaaaaaaaaaaa') == False\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate('Madam') == True\n assert candidate('M') == False\n assert candidate('0') == False\n\n"
},
{
"task_id": "HumanEval/83",
"prompt": "\ndef starts_one_ends(n):\n \"\"\"\n Diye gaye positive integer n ke liye, n-digit wale positive integers ki ginti return karo jo 1 se start hote hain ya 1 pe end hote hain.\n \"\"\"",
"entry_point": "starts_one_ends",
"canonical_solution": " if n == 1: return 1\n return 18 * (10 ** (n - 2))\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(1) == 1\n assert candidate(2) == 18\n assert candidate(3) == 180\n assert candidate(4) == 1800\n assert candidate(5) == 18000\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/84",
"prompt": "\ndef solve(N):\n \"\"\"\n Diye gaye positive integer N ka, uske digits ka total sum binary mein return karo.\n \n Udaharan\n Agar N = 1000 hai, to digits ka sum hoga 1 aur output honi chahiye \"1\".\n Agar N = 150 hai, to digits ka sum hoga 6 aur output honi chahiye \"110\".\n Agar N = 147 hai, to digits ka sum hoga 12 aur output honi chahiye \"1100\".\n \n Variables:\n @N integer\n Constraints: 0 ≤ N ≤ 10000.\n Output:\n binary number ka ek string\n \"\"\"",
"entry_point": "solve",
"canonical_solution": " return bin(sum(int(i) for i in str(N)))[2:]\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(1000) == \"1\", \"Error\"\n assert candidate(150) == \"110\", \"Error\"\n assert candidate(147) == \"1100\", \"Error\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate(333) == \"1001\", \"Error\"\n assert candidate(963) == \"10010\", \"Error\"\n\n"
},
{
"task_id": "HumanEval/85",
"prompt": "\ndef add(lst):\n \"\"\"\n Ek non-empty list di gayi hai integers ki lst. Add karo even elements ko jo odd indices pe hai.\n\n Udaharan:\n add([4, 2, 6, 7]) ==> 2\n \"\"\"",
"entry_point": "add",
"canonical_solution": " return sum([lst[i] for i in range(1, len(lst), 2) if lst[i]%2 == 0])\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([4, 88]) == 88\n assert candidate([4, 5, 6, 7, 2, 122]) == 122\n assert candidate([4, 0, 6, 7]) == 0\n assert candidate([4, 4, 6, 8]) == 12\n\n # Check some edge cases that are easy to work out by hand.\n \n"
},
{
"task_id": "HumanEval/86",
"prompt": "\ndef anti_shuffle(s):\n \"\"\"\n Ek function likho jo ek string leta hai aur uska ordered version return karta hai.\n Ordered version of string, woh string hoti hai jahan saare words (space se separated)\n ko ek naye word se replace kiya jata hai jahan saare characters ko \n unke ascii value ke basis pe ascending order mein arrange kiya jata hai.\n Dhyan do: Aapko words aur blank spaces ki order sentence mein maintain karni chahiye.\n\n Jaise ki:\n anti_shuffle('Hi') returns 'Hi'\n anti_shuffle('hello') returns 'ehllo'\n anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor'\n \"\"\"",
"entry_point": "anti_shuffle",
"canonical_solution": " return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('Hi') == 'Hi'\n assert candidate('hello') == 'ehllo'\n assert candidate('number') == 'bemnru'\n assert candidate('abcd') == 'abcd'\n assert candidate('Hello World!!!') == 'Hello !!!Wdlor'\n assert candidate('') == ''\n assert candidate('Hi. My name is Mister Robot. How are you?') == '.Hi My aemn is Meirst .Rboot How aer ?ouy'\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/87",
"prompt": "\ndef get_row(lst, x):\n \"\"\"\n Aapko ek 2 dimensional data diya gaya hai, ek nested lists ke roop mein,\n jo matrix ke saman hai, lekin, matrices ke unlike,\n har row mein alag number of columns ho sakte hain.\n Diye gaye lst, aur integer x, list mein integers x ko dhundho,\n aur tuples ki list return karo, [(x1, y1), (x2, y2) ...] aisa ki\n har tuple ek coordinate ho - (row, columns), shuru karte hue 0 se.\n Coordinates ko pehle rows ke hisaab se ascending order mein sort karo.\n Saath hi, row ke coordinates ko columns ke hisaab se descending order mein sort karo.\n \n Examples:\n get_row([\n [1,2,3,4,5,6],\n [1,2,3,4,1,6],\n [1,2,3,4,5,1]\n ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]\n get_row([], 1) == []\n get_row([[], [1], [1, 2, 3]], 3) == [(2, 2)]\n \"\"\"",
"entry_point": "get_row",
"canonical_solution": " coords = [(i, j) for i in range(len(lst)) for j in range(len(lst[i])) if lst[i][j] == x]\n return sorted(sorted(coords, key=lambda x: x[1], reverse=True), key=lambda x: x[0])\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([\n [1,2,3,4,5,6],\n [1,2,3,4,1,6],\n [1,2,3,4,5,1]\n ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]\n assert candidate([\n [1,2,3,4,5,6],\n [1,2,3,4,5,6],\n [1,2,3,4,5,6],\n [1,2,3,4,5,6],\n [1,2,3,4,5,6],\n [1,2,3,4,5,6]\n ], 2) == [(0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1)]\n assert candidate([\n [1,2,3,4,5,6],\n [1,2,3,4,5,6],\n [1,1,3,4,5,6],\n [1,2,1,4,5,6],\n [1,2,3,1,5,6],\n [1,2,3,4,1,6],\n [1,2,3,4,5,1]\n ], 1) == [(0, 0), (1, 0), (2, 1), (2, 0), (3, 2), (3, 0), (4, 3), (4, 0), (5, 4), (5, 0), (6, 5), (6, 0)]\n assert candidate([], 1) == []\n assert candidate([[1]], 2) == []\n assert candidate([[], [1], [1, 2, 3]], 3) == [(2, 2)]\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/88",
"prompt": "\ndef sort_array(array):\n \"\"\"\n Non-negative integers ki ek array di gayi hai, return karo us array ka copy sort karne ke baad,\n aapko di gayi array ko ascending order mein sort karna hai agar sum( pehle index ki value, last index ki value) odd hai,\n ya fir descending order mein sort karna hai agar sum( pehle index ki value, last index ki value) even hai.\n\n Dhyan do:\n * di gayi array ko change mat karo.\n\n Examples:\n * sort_array([]) => []\n * sort_array([5]) => [5]\n * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5]\n * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0]\n \"\"\"",
"entry_point": "sort_array",
"canonical_solution": " return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0) \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([]) == [], \"Error\"\n assert candidate([5]) == [5], \"Error\"\n assert candidate([2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5], \"Error\"\n assert candidate([2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0], \"Error\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([2, 1]) == [1, 2], \"Error\"\n assert candidate([15, 42, 87, 32 ,11, 0]) == [0, 11, 15, 32, 42, 87], \"Error\"\n assert candidate([21, 14, 23, 11]) == [23, 21, 14, 11], \"Error\"\n\n"
},
{
"task_id": "HumanEval/89",
"prompt": "\ndef encrypt(s):\n \"\"\"\n Ek function banaiye encrypt jo ek string ko argument ke roop mein leta hai aur\n ek encrypted string return karta hai jisme alphabet ko rotate kiya gaya ho.\n Alphabet ko aise rotate karna chahiye ki letters \n do se multiply kiye gaye do places ke neeche shift ho jaye.\n Jaise ki:\n encrypt('hi') returns 'lm'\n encrypt('asdfghjkl') returns 'ewhjklnop'\n encrypt('gf') returns 'kj'\n encrypt('et') returns 'ix'\n \"\"\"",
"entry_point": "encrypt",
"canonical_solution": " d = 'abcdefghijklmnopqrstuvwxyz'\n out = ''\n for c in s:\n if c in d:\n out += d[(d.index(c)+2*2) % 26]\n else:\n out += c\n return out\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('hi') == 'lm', \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('asdfghjkl') == 'ewhjklnop', \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('gf') == 'kj', \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('et') == 'ix', \"This prints if this assert fails 1 (good for debugging!)\"\n\n assert candidate('faewfawefaewg')=='jeiajeaijeiak', \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('hellomyfriend')=='lippsqcjvmirh', \"This prints if this assert fails 2 (good for debugging!)\"\n assert candidate('dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh')=='hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl', \"This prints if this assert fails 3 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate('a')=='e', \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/90",
"prompt": "\ndef next_smallest(lst):\n \"\"\"\n Aapko ek list di gayi hai integers ki.\n Ek function likho next_smallest() jo list ka 2nd sabse chhota element return kare.\n Agar aisa koi element nahi hai to None return kare.\n \n next_smallest([1, 2, 3, 4, 5]) == 2\n next_smallest([5, 1, 4, 3, 2]) == 2\n next_smallest([]) == None\n next_smallest([1, 1]) == None\n \"\"\"",
"entry_point": "next_smallest",
"canonical_solution": " lst = sorted(set(lst))\n return None if len(lst) < 2 else lst[1]\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1, 2, 3, 4, 5]) == 2\n assert candidate([5, 1, 4, 3, 2]) == 2\n assert candidate([]) == None\n assert candidate([1, 1]) == None\n assert candidate([1,1,1,1,0]) == 1\n assert candidate([1, 0**0]) == None\n assert candidate([-35, 34, 12, -45]) == -35\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/91",
"prompt": "\ndef is_bored(S):\n \"\"\"\n Aapko ek string di jayegi jisme words honge, aur aapka task hai ginna ki kitne boredoms hai. Ek boredom woh sentence hota hai jo \"I\" word se start hota hai.\n Sentences ko '.' , '?' ya '!' se alag kiya jata hai.\n \n Udaharan ke liye:\n >>> is_bored(\"Hello world\")\n 0\n >>> is_bored(\"The sky is blue. The sun is shining. I love this weather\")\n 1\n \"\"\"",
"entry_point": "is_bored",
"canonical_solution": " import re\n sentences = re.split(r'[.?!]\\s*', S)\n return sum(sentence[0:2] == 'I ' for sentence in sentences)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"Hello world\") == 0, \"Test 1\"\n assert candidate(\"Is the sky blue?\") == 0, \"Test 2\"\n assert candidate(\"I love It !\") == 1, \"Test 3\"\n assert candidate(\"bIt\") == 0, \"Test 4\"\n assert candidate(\"I feel good today. I will be productive. will kill It\") == 2, \"Test 5\"\n assert candidate(\"You and I are going for a walk\") == 0, \"Test 6\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/92",
"prompt": "\ndef any_int(x, y, z):\n \"\"\"\n Ek function banao jo 3 numbers leta hai.\n Agar koi ek number doosre do numbers ka sum ho, aur saare numbers integers ho, toh true return kare.\n Kisi bhi aur case mein false return kare.\n \n Udaharan\n any_int(5, 2, 7) ➞ True\n \n any_int(3, 2, 2) ➞ False\n\n any_int(3, -2, 1) ➞ True\n \n any_int(3.6, -2.2, 2) ➞ False\n \"\"\"",
"entry_point": "any_int",
"canonical_solution": " \n if isinstance(x,int) and isinstance(y,int) and isinstance(z,int):\n if (x+y==z) or (x+z==y) or (y+z==x):\n return True\n return False\n return False\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(2, 3, 1)==True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(2.5, 2, 3)==False, \"This prints if this assert fails 2 (good for debugging!)\"\n assert candidate(1.5, 5, 3.5)==False, \"This prints if this assert fails 3 (good for debugging!)\"\n assert candidate(2, 6, 2)==False, \"This prints if this assert fails 4 (good for debugging!)\"\n assert candidate(4, 2, 2)==True, \"This prints if this assert fails 5 (good for debugging!)\"\n assert candidate(2.2, 2.2, 2.2)==False, \"This prints if this assert fails 6 (good for debugging!)\"\n assert candidate(-4, 6, 2)==True, \"This prints if this assert fails 7 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(2,1,1)==True, \"This prints if this assert fails 8 (also good for debugging!)\"\n assert candidate(3,4,7)==True, \"This prints if this assert fails 9 (also good for debugging!)\"\n assert candidate(3.0,4,7)==False, \"This prints if this assert fails 10 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/93",
"prompt": "\ndef encode(message):\n \"\"\"\n Ek function likho jo ek message leta hai, aur usko aise encode karta hai \n ki wo saare letters ki case ko swap kar deta hai, saare vowels ko \n unke aage wale 2nd letter se replace kar deta hai english alphabet mein. \n Sirf letters maan lo. \n \n Udaharan:\n >>> encode('test')\n 'TGST'\n >>> encode('This is a message')\n 'tHKS KS C MGSSCGG'\n \"\"\"",
"entry_point": "encode",
"canonical_solution": " vowels = \"aeiouAEIOU\"\n vowels_replace = dict([(i, chr(ord(i) + 2)) for i in vowels])\n message = message.swapcase()\n return ''.join([vowels_replace[i] if i in vowels else i for i in message])\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('TEST') == 'tgst', \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('Mudasir') == 'mWDCSKR', \"This prints if this assert fails 2 (good for debugging!)\"\n assert candidate('YES') == 'ygs', \"This prints if this assert fails 3 (good for debugging!)\"\n \n # Check some edge cases that are easy to work out by hand.\n assert candidate('This is a message') == 'tHKS KS C MGSSCGG', \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate(\"I DoNt KnOw WhAt tO WrItE\") == 'k dQnT kNqW wHcT Tq wRkTg', \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/94",
"prompt": "\n\ndef skjkasdkd(lst):\n \"\"\"\n Aapko ek list di gayi hai integers ki.\n Aapko sabse bada prime value dhundna hai aur uske digits ka sum return karna hai.\n\n Udaharan:\n Agar lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] hai to output hona chahiye 10\n Agar lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] hai to output hona chahiye 25\n Agar lst = [1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3] hai to output hona chahiye 13\n Agar lst = [0,724,32,71,99,32,6,0,5,91,83,0,5,6] hai to output hona chahiye 11\n Agar lst = [0,81,12,3,1,21] hai to output hona chahiye 3\n Agar lst = [0,8,1,2,1,7] hai to output hona chahiye 7\n \"\"\"",
"entry_point": "skjkasdkd",
"canonical_solution": " def isPrime(n):\n for i in range(2,int(n**0.5)+1):\n if n%i==0:\n return False\n\n return True\n maxx = 0\n i = 0\n while i < len(lst):\n if(lst[i] > maxx and isPrime(lst[i])):\n maxx = lst[i]\n i+=1\n result = sum(int(digit) for digit in str(maxx))\n return result\n\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3]) == 10, \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1]) == 25, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3]) == 13, \"This prints if this assert fails 3 (also good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([0,724,32,71,99,32,6,0,5,91,83,0,5,6]) == 11, \"This prints if this assert fails 4 (also good for debugging!)\"\n \n # Check some edge cases that are easy to work out by hand.\n assert candidate([0,81,12,3,1,21]) == 3, \"This prints if this assert fails 5 (also good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([0,8,1,2,1,7]) == 7, \"This prints if this assert fails 6 (also good for debugging!)\"\n\n assert candidate([8191]) == 19, \"This prints if this assert fails 7 (also good for debugging!)\"\n assert candidate([8191, 123456, 127, 7]) == 19, \"This prints if this assert fails 8 (also good for debugging!)\"\n assert candidate([127, 97, 8192]) == 10, \"This prints if this assert fails 9 (also good for debugging!)\"\n"
},
{
"task_id": "HumanEval/95",
"prompt": "\ndef check_dict_case(dict):\n \"\"\"\n Ek dictionary di gayi hai, return karo True agar saare keys lower case strings hai ya saare keys upper case strings hai, nahi to return karo False.\n Agar di gayi dictionary khali hai to function False return karega.\n Udaharan:\n check_dict_case({\"a\":\"apple\", \"b\":\"banana\"}) ka return hona chahiye True.\n check_dict_case({\"a\":\"apple\", \"A\":\"banana\", \"B\":\"banana\"}) ka return hona chahiye False.\n check_dict_case({\"a\":\"apple\", 8:\"banana\", \"a\":\"apple\"}) ka return hona chahiye False.\n check_dict_case({\"Name\":\"John\", \"Age\":\"36\", \"City\":\"Houston\"}) ka return hona chahiye False.\n check_dict_case({\"STATE\":\"NC\", \"ZIP\":\"12345\" }) ka return hona chahiye True.\n \"\"\"",
"entry_point": "check_dict_case",
"canonical_solution": " if len(dict.keys()) == 0:\n return False\n else:\n state = \"start\"\n for key in dict.keys():\n\n if isinstance(key, str) == False:\n state = \"mixed\"\n break\n if state == \"start\":\n if key.isupper():\n state = \"upper\"\n elif key.islower():\n state = \"lower\"\n else:\n break\n elif (state == \"upper\" and not key.isupper()) or (state == \"lower\" and not key.islower()):\n state = \"mixed\"\n break\n else:\n break\n return state == \"upper\" or state == \"lower\" \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate({\"p\":\"pineapple\", \"b\":\"banana\"}) == True, \"First test error: \" + str(candidate({\"p\":\"pineapple\", \"b\":\"banana\"}))\n assert candidate({\"p\":\"pineapple\", \"A\":\"banana\", \"B\":\"banana\"}) == False, \"Second test error: \" + str(candidate({\"p\":\"pineapple\", \"A\":\"banana\", \"B\":\"banana\"}))\n assert candidate({\"p\":\"pineapple\", 5:\"banana\", \"a\":\"apple\"}) == False, \"Third test error: \" + str(candidate({\"p\":\"pineapple\", 5:\"banana\", \"a\":\"apple\"}))\n assert candidate({\"Name\":\"John\", \"Age\":\"36\", \"City\":\"Houston\"}) == False, \"Fourth test error: \" + str(candidate({\"Name\":\"John\", \"Age\":\"36\", \"City\":\"Houston\"}))\n assert candidate({\"STATE\":\"NC\", \"ZIP\":\"12345\" }) == True, \"Fifth test error: \" + str(candidate({\"STATE\":\"NC\", \"ZIP\":\"12345\" })) \n assert candidate({\"fruit\":\"Orange\", \"taste\":\"Sweet\" }) == True, \"Fourth test error: \" + str(candidate({\"fruit\":\"Orange\", \"taste\":\"Sweet\" })) \n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate({}) == False, \"1st edge test error: \" + str(candidate({}))\n\n"
},
{
"task_id": "HumanEval/96",
"prompt": "\ndef count_up_to(n):\n \"\"\"\n Ek function implement karo jo ek non-negative integer leta hai aur return karta hai ek array jisme pehle n \n integers hote hai jo prime numbers hai aur n se kam hai.\n Jaise ki:\n count_up_to(5) => [2,3]\n count_up_to(11) => [2,3,5,7]\n count_up_to(0) => []\n count_up_to(20) => [2,3,5,7,11,13,17,19]\n count_up_to(1) => []\n count_up_to(18) => [2,3,5,7,11,13,17]\n \"\"\"",
"entry_point": "count_up_to",
"canonical_solution": " primes = []\n for i in range(2, n):\n is_prime = True\n for j in range(2, i):\n if i % j == 0:\n is_prime = False\n break\n if is_prime:\n primes.append(i)\n return primes\n\n",
"test": "def check(candidate):\n\n assert candidate(5) == [2,3]\n assert candidate(6) == [2,3,5]\n assert candidate(7) == [2,3,5]\n assert candidate(10) == [2,3,5,7]\n assert candidate(0) == []\n assert candidate(22) == [2,3,5,7,11,13,17,19]\n assert candidate(1) == []\n assert candidate(18) == [2,3,5,7,11,13,17]\n assert candidate(47) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]\n assert candidate(101) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n\n"
},
{
"task_id": "HumanEval/97",
"prompt": "\ndef multiply(a, b):\n \"\"\"\n Do integers ka input lekar unke unit digits ka product return karega ye function.\n Maan lo ki input hamesha valid hoga.\n Udaharan:\n multiply(148, 412) ka return hoga 16.\n multiply(19, 28) ka return hoga 72.\n multiply(2020, 1851) ka return hoga 0.\n multiply(14,-15) ka return hoga 20.\n \"\"\"",
"entry_point": "multiply",
"canonical_solution": " return abs(a % 10) * abs(b % 10)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(148, 412) == 16, \"First test error: \" + str(candidate(148, 412)) \n assert candidate(19, 28) == 72, \"Second test error: \" + str(candidate(19, 28)) \n assert candidate(2020, 1851) == 0, \"Third test error: \" + str(candidate(2020, 1851))\n assert candidate(14,-15) == 20, \"Fourth test error: \" + str(candidate(14,-15)) \n assert candidate(76, 67) == 42, \"Fifth test error: \" + str(candidate(76, 67)) \n assert candidate(17, 27) == 49, \"Sixth test error: \" + str(candidate(17, 27)) \n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(0, 1) == 0, \"1st edge test error: \" + str(candidate(0, 1))\n assert candidate(0, 0) == 0, \"2nd edge test error: \" + str(candidate(0, 0))\n\n"
},
{
"task_id": "HumanEval/98",
"prompt": "\ndef count_upper(s):\n \"\"\"\n Diye gaye string s mein, even indices par kitne uppercase vowels hai, unhe count karo.\n\nJaise ki:\ncount_upper('aBCdEf') returns 1\ncount_upper('abcdefg') returns 0\ncount_upper('dBBE') returns 0\n \"\"\"",
"entry_point": "count_upper",
"canonical_solution": " count = 0\n for i in range(0,len(s),2):\n if s[i] in \"AEIOU\":\n count += 1\n return count\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('aBCdEf') == 1\n assert candidate('abcdefg') == 0\n assert candidate('dBBE') == 0\n assert candidate('B') == 0\n assert candidate('U') == 1\n assert candidate('') == 0\n assert candidate('EEEE') == 2\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/99",
"prompt": "\ndef closest_integer(value):\n \"\"\"\n Ek function banaiye jo ek value (string) leta hai jo ek number represent karta hai\n aur uska sabse close integer return karta hai. Agar number do integers ke beech \n samanantar hai, toh use zero se door round karo.\n\n Udaharan\n >>> closest_integer(\"10\")\n 10\n >>> closest_integer(\"15.3\")\n 15\n\n Dhyan Dijiye:\n Zero se door round karne ka matlab hai ki agar diya gaya number do integers ke beech \n samanantar hai, toh aapko woh integer return karna chahiye jo zero se sabse door hai. \n Jaise ki closest_integer(\"14.5\") ko 15 return karna chahiye aur closest_integer(\"-14.5\") \n ko -15 return karna chahiye.\n \"\"\"",
"entry_point": "closest_integer",
"canonical_solution": " from math import floor, ceil\n\n if value.count('.') == 1:\n # remove trailing zeros\n while (value[-1] == '0'):\n value = value[:-1]\n\n num = float(value)\n if value[-2:] == '.5':\n if num > 0:\n res = ceil(num)\n else:\n res = floor(num)\n elif len(value) > 0:\n res = int(round(num))\n else:\n res = 0\n\n return res\n\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"10\") == 10, \"Test 1\"\n assert candidate(\"14.5\") == 15, \"Test 2\"\n assert candidate(\"-15.5\") == -16, \"Test 3\"\n assert candidate(\"15.3\") == 15, \"Test 3\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(\"0\") == 0, \"Test 0\"\n\n"
},
{
"task_id": "HumanEval/100",
"prompt": "\ndef make_a_pile(n):\n \"\"\"\n Ek positive integer n diya gaya hai, aapko n levels ki ek pile of stones banani hai.\n Pehle level me n stones honge.\n Agla level stones ka number hoga:\n - agla odd number agar n odd hai.\n - agla even number agar n even hai.\n Har level me stones ki sankhya ko ek list me return karo, jaha index\n i ki element level (i+1) me stones ki sankhya ko darshata hai.\n\n Udaharan:\n >>> make_a_pile(3)\n [3, 5, 7]\n \"\"\"",
"entry_point": "make_a_pile",
"canonical_solution": " return [n + 2*i for i in range(n)]\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(3) == [3, 5, 7], \"Test 3\"\n assert candidate(4) == [4,6,8,10], \"Test 4\"\n assert candidate(5) == [5, 7, 9, 11, 13]\n assert candidate(6) == [6, 8, 10, 12, 14, 16]\n assert candidate(8) == [8, 10, 12, 14, 16, 18, 20, 22]\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/101",
"prompt": "\ndef words_string(s):\n \"\"\"\n Aapko ek string di jayegi jisme words commas ya spaces se separated honge. Aapka task hai\n string ko words mein split karna aur words ki array return karna.\n \n Jaise ki:\n words_string(\"Hi, my name is John\") == [\"Hi\", \"my\", \"name\", \"is\", \"John\"]\n words_string(\"One, two, three, four, five, six\") == [\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]\n \"\"\"",
"entry_point": "words_string",
"canonical_solution": " if not s:\n return []\n\n s_list = []\n\n for letter in s:\n if letter == ',':\n s_list.append(' ')\n else:\n s_list.append(letter)\n\n s_list = \"\".join(s_list)\n return s_list.split()\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(\"Hi, my name is John\") == [\"Hi\", \"my\", \"name\", \"is\", \"John\"]\n assert candidate(\"One, two, three, four, five, six\") == [\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]\n assert candidate(\"Hi, my name\") == [\"Hi\", \"my\", \"name\"]\n assert candidate(\"One,, two, three, four, five, six,\") == [\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate(\"\") == []\n assert candidate(\"ahmed , gamal\") == [\"ahmed\", \"gamal\"]\n\n"
},
{
"task_id": "HumanEval/102",
"prompt": "\ndef choose_num(x, y):\n \"\"\"\n Yeh function do positive numbers x aur y leta hai aur return karta hai\n sabse bada even integer jo range [x, y] mein inclusive hai. Agar \n aisa koi number nahi hai, toh function ko -1 return karna chahiye.\n\n Jaise ki:\n choose_num(12, 15) = 14\n choose_num(13, 12) = -1\n \"\"\"",
"entry_point": "choose_num",
"canonical_solution": " if x > y:\n return -1\n if y % 2 == 0:\n return y\n if x == y:\n return -1\n return y - 1\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(12, 15) == 14\n assert candidate(13, 12) == -1\n assert candidate(33, 12354) == 12354\n assert candidate(5234, 5233) == -1\n assert candidate(6, 29) == 28\n assert candidate(27, 10) == -1\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(7, 7) == -1\n assert candidate(546, 546) == 546\n\n"
},
{
"task_id": "HumanEval/103",
"prompt": "\ndef rounded_avg(n, m):\n \"\"\"\n Aapko do positive integers n aur m diye gaye hain, aur aapka task hai n se lekar m tak ke integers ka\n average compute karna (n aur m ko bhi include karte hue). \n Answer ko nearest integer tak round karo aur usko binary mein convert karo.\n Agar n m se bada hai, to -1 return karo.\n Udaharan:\n rounded_avg(1, 5) => \"0b11\"\n rounded_avg(7, 5) => -1\n rounded_avg(10, 20) => \"0b1111\"\n rounded_avg(20, 33) => \"0b11010\"\n \"\"\"",
"entry_point": "rounded_avg",
"canonical_solution": " if m < n:\n return -1\n summation = 0\n for i in range(n, m+1):\n summation += i\n return bin(round(summation/(m - n + 1)))\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(1, 5) == \"0b11\"\n assert candidate(7, 13) == \"0b1010\"\n assert candidate(964,977) == \"0b1111001010\"\n assert candidate(996,997) == \"0b1111100100\"\n assert candidate(560,851) == \"0b1011000010\"\n assert candidate(185,546) == \"0b101101110\"\n assert candidate(362,496) == \"0b110101101\"\n assert candidate(350,902) == \"0b1001110010\"\n assert candidate(197,233) == \"0b11010111\"\n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(7, 5) == -1\n assert candidate(5, 1) == -1\n assert candidate(5, 5) == \"0b101\"\n\n"
},
{
"task_id": "HumanEval/104",
"prompt": "\ndef unique_digits(x):\n \"\"\"\n Diye gaye positive integers ki list x me Woh saare elements ki sorted list return karo jisme koi bhi even digit nahi hai.\n\n Dhyan de: Return ki gayi list ko increasing order me sort kiya jana chahiye.\n \n Jaise ki:\n >>> unique_digits([15, 33, 1422, 1])\n [1, 15, 33]\n >>> unique_digits([152, 323, 1422, 10])\n []\n \"\"\"",
"entry_point": "unique_digits",
"canonical_solution": " odd_digit_elements = []\n for i in x:\n if all (int(c) % 2 == 1 for c in str(i)):\n odd_digit_elements.append(i)\n return sorted(odd_digit_elements)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([15, 33, 1422, 1]) == [1, 15, 33]\n assert candidate([152, 323, 1422, 10]) == []\n assert candidate([12345, 2033, 111, 151]) == [111, 151]\n assert candidate([135, 103, 31]) == [31, 135]\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/105",
"prompt": "\ndef by_length(arr):\n \"\"\"\n Ek array diya gaya hai integers ka, integers ko sort karo jo 1 se 9 ke beech mein hai,\n resulting array ko reverse karo, aur phir har digit ko uske corresponding name se replace karo \n \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\".\n\n Jaise ki:\n arr = [2, 1, 1, 4, 5, 8, 2, 3] \n -> arr ko sort karo -> [1, 1, 2, 2, 3, 4, 5, 8] \n -> arr ko reverse karo -> [8, 5, 4, 3, 2, 2, 1, 1]\n return [\"Eight\", \"Five\", \"Four\", \"Three\", \"Two\", \"Two\", \"One\", \"One\"]\n \n Agar array khali hai, toh ek khali array return karo:\n arr = []\n return []\n \n Agar array mein koi ajeeb number hai toh use ignore karo:\n arr = [1, -1 , 55] \n -> arr ko sort karo -> [-1, 1, 55]\n -> arr ko reverse karo -> [55, 1, -1]\n return = ['One']\n \"\"\"",
"entry_point": "by_length",
"canonical_solution": " dic = {\n 1: \"One\",\n 2: \"Two\",\n 3: \"Three\",\n 4: \"Four\",\n 5: \"Five\",\n 6: \"Six\",\n 7: \"Seven\",\n 8: \"Eight\",\n 9: \"Nine\",\n }\n sorted_arr = sorted(arr, reverse=True)\n new_arr = []\n for var in sorted_arr:\n try:\n new_arr.append(dic[var])\n except:\n pass\n return new_arr\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([2, 1, 1, 4, 5, 8, 2, 3]) == [\"Eight\", \"Five\", \"Four\", \"Three\", \"Two\", \"Two\", \"One\", \"One\"], \"Error\"\n assert candidate([]) == [], \"Error\"\n assert candidate([1, -1 , 55]) == ['One'], \"Error\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([1, -1, 3, 2]) == [\"Three\", \"Two\", \"One\"]\n assert candidate([9, 4, 8]) == [\"Nine\", \"Eight\", \"Four\"]\n\n"
},
{
"task_id": "HumanEval/106",
"prompt": "\ndef f(n):\n \"\"\"\n Function f ko implement karo jo n ko parameter ke roop mein leta hai,\n aur ek list return karta hai jiska size n hota hai, aisa ki index i par element ka value i ka factorial hota hai agar i even hai\n ya fir 1 se lekar i tak ke numbers ka sum hota hai otherwise.\n i ka start 1 se hota hai.\n i ka factorial 1 se lekar i tak ke numbers ka multiplication hota hai (1 * 2 * ... * i).\n Udaharan:\n f(5) == [1, 2, 6, 24, 15]\n \"\"\"",
"entry_point": "f",
"canonical_solution": " ret = []\n for i in range(1,n+1):\n if i%2 == 0:\n x = 1\n for j in range(1,i+1): x *= j\n ret += [x]\n else:\n x = 0\n for j in range(1,i+1): x += j\n ret += [x]\n return ret\n",
"test": "def check(candidate):\n\n assert candidate(5) == [1, 2, 6, 24, 15]\n assert candidate(7) == [1, 2, 6, 24, 15, 720, 28]\n assert candidate(1) == [1]\n assert candidate(3) == [1, 2, 6]\n"
},
{
"task_id": "HumanEval/107",
"prompt": "\ndef even_odd_palindrome(n):\n \"\"\"\n Ek positive integer n diya gaya hai, return karo ek tuple jisme even aur odd integer palindromes ki sankhya ho jo range(1, n) ke andar aate hain, inclusive.\n\n Udaharan 1:\n\n Input: 3\n Output: (1, 2)\n Explanation:\n Integer palindrome hain 1, 2, 3. Inme se ek even hai, aur do odd hain.\n\n Udaharan 2:\n\n Input: 12\n Output: (4, 6)\n Explanation:\n Integer palindrome hain 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. Inme se chaar even hain, aur 6 odd hain.\n\n Dhyan de:\n 1. 1 <= n <= 10^3\n 2. returned tuple me even aur odd integer palindromes ki sankhya kramashah hoti hai.\n \"\"\"",
"entry_point": "even_odd_palindrome",
"canonical_solution": " def is_palindrome(n):\n return str(n) == str(n)[::-1]\n\n even_palindrome_count = 0\n odd_palindrome_count = 0\n\n for i in range(1, n+1):\n if i%2 == 1 and is_palindrome(i):\n odd_palindrome_count += 1\n elif i%2 == 0 and is_palindrome(i):\n even_palindrome_count += 1\n return (even_palindrome_count, odd_palindrome_count)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(123) == (8, 13)\n assert candidate(12) == (4, 6)\n assert candidate(3) == (1, 2)\n assert candidate(63) == (6, 8)\n assert candidate(25) == (5, 6)\n assert candidate(19) == (4, 6)\n assert candidate(9) == (4, 5), \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(1) == (0, 1), \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/108",
"prompt": "\ndef count_nums(arr):\n \"\"\"\n Ek function likho count_nums jo ek array of integers leta hai aur return karta hai\n un elements ki sankhya jinka digits ka sum > 0 hota hai.\n Agar koi number negative hai, to uska pehla signed digit negative hoga:\n jaise ki -123 ke signed digits hote hai -1, 2, aur 3.\n >>> count_nums([]) == 0\n >>> count_nums([-1, 11, -11]) == 1\n >>> count_nums([1, 1, 2]) == 3\n \"\"\"",
"entry_point": "count_nums",
"canonical_solution": " def digits_sum(n):\n neg = 1\n if n < 0: n, neg = -1 * n, -1 \n n = [int(i) for i in str(n)]\n n[0] = n[0] * neg\n return sum(n)\n return len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([]) == 0\n assert candidate([-1, -2, 0]) == 0\n assert candidate([1, 1, 2, -2, 3, 4, 5]) == 6\n assert candidate([1, 6, 9, -6, 0, 1, 5]) == 5\n assert candidate([1, 100, 98, -7, 1, -1]) == 4\n assert candidate([12, 23, 34, -45, -56, 0]) == 5\n assert candidate([-0, 1**0]) == 1\n assert candidate([1]) == 1\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/109",
"prompt": "\ndef move_one_ball(arr):\n \"\"\"\n Humare paas ek array 'arr' hai N integers arr[1], arr[2], ..., arr[N] ka. Array mein numbers randomly order mein honge. Aapka task hai yeh determine karna ki kya hume non-decreasing order mein sorted array mil sakta hai, diye gaye array par niche diye gaye operation ko perform karke:\n Aapko right shift operation ko kitni bhi baar perform karne ki anumati hai.\n \n Ek right shift operation ka matlab hai array ke saare elements ko ek position right direction mein shift karna. Array ka last element array ke starting position yaani 0th index par move ho jayega. \n\n Agar upar diye gaye operation ko perform karke sorted array mil sakta hai to True return karo, nahi to False return karo.\n Agar diya gaya array khali hai to True return karo.\n\n Note: Diye gaye list mein unique elements honge.\n\n Udaharan ke liye:\n \n move_one_ball([3, 4, 5, 1, 2])==>True\n Explanation: 2 right shift operations perform karke, diye gaye array ke liye non-decreasing order prapt kiya ja sakta hai.\n move_one_ball([3, 5, 4, 1, 2])==>False\n Explanation: Kisi bhi number of right shift operations perform karke diye gaye array ke liye non-decreasing order prapt karna sambhav nahi hai.\n \"\"\"",
"entry_point": "move_one_ball",
"canonical_solution": " if len(arr)==0:\n return True\n sorted_array=sorted(arr)\n my_arr=[]\n \n min_value=min(arr)\n min_index=arr.index(min_value)\n my_arr=arr[min_index:]+arr[0:min_index]\n for i in range(len(arr)):\n if my_arr[i]!=sorted_array[i]:\n return False\n return True\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([3, 4, 5, 1, 2])==True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([3, 5, 10, 1, 2])==True\n assert candidate([4, 3, 1, 2])==False\n # Check some edge cases that are easy to work out by hand.\n assert candidate([3, 5, 4, 1, 2])==False, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([])==True\n"
},
{
"task_id": "HumanEval/110",
"prompt": "\ndef exchange(lst1, lst2):\n \"\"\"\n Is problem mein, aapko ek function implement karna hai jo do list of numbers leta hai,\n aur yeh determine karta hai ki kya inke beech elements ka exchange karke\n lst1 ko sirf even numbers ki list banaya ja sakta hai.\n lst1 aur lst2 ke beech exchanged elements ki sankhya par koi limit nahi hai.\n Agar lst1 aur lst2 ke beech elements exchange karke\n lst1 ke saare elements ko even banaya ja sakta hai, to \"YES\" return karo.\n Varna, \"NO\" return karo.\n Jaise ki:\n exchange([1, 2, 3, 4], [1, 2, 3, 4]) => \"YES\"\n exchange([1, 2, 3, 4], [1, 5, 3, 4]) => \"NO\"\n Maan liya jata hai ki input lists khali nahi hogi.\n \"\"\"",
"entry_point": "exchange",
"canonical_solution": " odd = 0\n even = 0\n for i in lst1:\n if i%2 == 1:\n odd += 1\n for i in lst2:\n if i%2 == 0:\n even += 1\n if even >= odd:\n return \"YES\"\n return \"NO\"\n \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4]) == \"YES\"\n assert candidate([1, 2, 3, 4], [1, 5, 3, 4]) == \"NO\"\n assert candidate([1, 2, 3, 4], [2, 1, 4, 3]) == \"YES\" \n assert candidate([5, 7, 3], [2, 6, 4]) == \"YES\"\n assert candidate([5, 7, 3], [2, 6, 3]) == \"NO\" \n assert candidate([3, 2, 6, 1, 8, 9], [3, 5, 5, 1, 1, 1]) == \"NO\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([100, 200], [200, 200]) == \"YES\"\n\n"
},
{
"task_id": "HumanEval/111",
"prompt": "\ndef histogram(test):\n \"\"\"\n Ek string di gayi hai jo space separated lowercase letters ko represent karti hai, return karo ek dictionary\n jisme sabse zyada repeat hone wale letter aur unke corresponding count ho.\n Agar kai letters ka occurrence same hai, to un sabhi ko return karo.\n \n Udaharan:\n histogram('a b c') == {'a': 1, 'b': 1, 'c': 1}\n histogram('a b b a') == {'a': 2, 'b': 2}\n histogram('a b c a b') == {'a': 2, 'b': 2}\n histogram('b b b b a') == {'b': 4}\n histogram('') == {}\n \"\"\"",
"entry_point": "histogram",
"canonical_solution": " dict1={}\n list1=test.split(\" \")\n t=0\n\n for i in list1:\n if(list1.count(i)>t) and i!='':\n t=list1.count(i)\n if t>0:\n for i in list1:\n if(list1.count(i)==t):\n \n dict1[i]=t\n return dict1\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('a b b a') == {'a':2,'b': 2}, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('a b c a b') == {'a': 2, 'b': 2}, \"This prints if this assert fails 2 (good for debugging!)\"\n assert candidate('a b c d g') == {'a': 1, 'b': 1, 'c': 1, 'd': 1, 'g': 1}, \"This prints if this assert fails 3 (good for debugging!)\"\n assert candidate('r t g') == {'r': 1,'t': 1,'g': 1}, \"This prints if this assert fails 4 (good for debugging!)\"\n assert candidate('b b b b a') == {'b': 4}, \"This prints if this assert fails 5 (good for debugging!)\"\n assert candidate('r t g') == {'r': 1,'t': 1,'g': 1}, \"This prints if this assert fails 6 (good for debugging!)\"\n \n \n # Check some edge cases that are easy to work out by hand.\n assert candidate('') == {}, \"This prints if this assert fails 7 (also good for debugging!)\"\n assert candidate('a') == {'a': 1}, \"This prints if this assert fails 8 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/112",
"prompt": "\ndef reverse_delete(s,c):\n \"\"\"\n Task\n Humare paas do strings s aur c di gayi hain, aapko s mein se un sabhi characters ko delete karna hai jo c ke kisi bhi character ke barabar hain\n phir check karo ki resultant string palindrome hai ya nahi.\n Ek string ko palindrome tabhi kaha jata hai jab woh backward aur forward dono taraf se same padhti ho.\n Aapko ek tuple return karna hai jisme resultant string aur True/False check ke liye hoga.\n Udaharan\n Agar s = \"abcde\", c = \"ae\", toh result ('bcd',False) hona chahiye\n Agar s = \"abcdef\", c = \"b\" toh result ('acdef',False) hona chahiye\n Agar s = \"abcdedcba\", c = \"ab\", toh result ('cdedc',True) hona chahiye\n \"\"\"",
"entry_point": "reverse_delete",
"canonical_solution": " s = ''.join([char for char in s if char not in c])\n return (s,s[::-1] == s)\n",
"test": "def check(candidate):\n\n assert candidate(\"abcde\",\"ae\") == ('bcd',False)\n assert candidate(\"abcdef\", \"b\") == ('acdef',False)\n assert candidate(\"abcdedcba\",\"ab\") == ('cdedc',True)\n assert candidate(\"dwik\",\"w\") == ('dik',False)\n assert candidate(\"a\",\"a\") == ('',True)\n assert candidate(\"abcdedcba\",\"\") == ('abcdedcba',True)\n assert candidate(\"abcdedcba\",\"v\") == ('abcdedcba',True)\n assert candidate(\"vabba\",\"v\") == ('abba',True)\n assert candidate(\"mamma\", \"mia\") == (\"\", True)\n"
},
{
"task_id": "HumanEval/113",
"prompt": "\ndef odd_count(lst):\n \"\"\"\n Ek strings ki list di gayi hai, jahan har string sirf digits se bani hoti hai, ek list return karo.\n Output ki har element i ko \"input ki string i mein odd elements ki sankhya.\" ke roop mein hona chahiye, jahan saari i's ko input ki i'th string mein odd digits ki sankhya se replace kar dena chahiye.\n\n >>> odd_count(['1234567'])\n [\"input ki string 4 mein odd elements ki sankhya 4.\"]\n >>> odd_count(['3',\"11111111\"])\n [\"input ki string 1 mein odd elements ki sankhya 1.\",\n \"input ki string 8 mein odd elements ki sankhya 8.\"]\n \"\"\"",
"entry_point": "odd_count",
"canonical_solution": " res = []\n for arr in lst:\n n = sum(int(d)%2==1 for d in arr)\n res.append(\"the number of odd elements \" + str(n) + \"n the str\"+ str(n) +\"ng \"+ str(n) +\" of the \"+ str(n) +\"nput.\")\n return res\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(['1234567']) == [\"the number of odd elements 4n the str4ng 4 of the 4nput.\"], \"Test 1\"\n assert candidate(['3',\"11111111\"]) == [\"the number of odd elements 1n the str1ng 1 of the 1nput.\", \"the number of odd elements 8n the str8ng 8 of the 8nput.\"], \"Test 2\"\n assert candidate(['271', '137', '314']) == [\n 'the number of odd elements 2n the str2ng 2 of the 2nput.',\n 'the number of odd elements 3n the str3ng 3 of the 3nput.',\n 'the number of odd elements 2n the str2ng 2 of the 2nput.'\n ]\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/114",
"prompt": "\ndef minSubArraySum(nums):\n \"\"\"\n Ek integer array nums diya gaya hai, usme se kisi bhi non-empty sub-array ka minimum sum dhundho.\n Udaharan\n minSubArraySum([2, 3, 4, 1, 2, 4]) == 1\n minSubArraySum([-1, -2, -3]) == -6\n \"\"\"",
"entry_point": "minSubArraySum",
"canonical_solution": " max_sum = 0\n s = 0\n for num in nums:\n s += -num\n if (s < 0):\n s = 0\n max_sum = max(s, max_sum)\n if max_sum == 0:\n max_sum = max(-i for i in nums)\n min_sum = -max_sum\n return min_sum\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([2, 3, 4, 1, 2, 4]) == 1, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([-1, -2, -3]) == -6\n assert candidate([-1, -2, -3, 2, -10]) == -14\n assert candidate([-9999999999999999]) == -9999999999999999\n assert candidate([0, 10, 20, 1000000]) == 0\n assert candidate([-1, -2, -3, 10, -5]) == -6\n assert candidate([100, -1, -2, -3, 10, -5]) == -6\n assert candidate([10, 11, 13, 8, 3, 4]) == 3\n assert candidate([100, -33, 32, -1, 0, -2]) == -33\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([-10]) == -10, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([7]) == 7\n assert candidate([1, -1]) == -1\n"
},
{
"task_id": "HumanEval/115",
"prompt": "\ndef max_fill(grid, capacity):\n import math\n \"\"\"\n Aapko ek rectangular grid di gayi hai jisme wells hain. Har row ek well ko represent karti hai,\n aur row me har 1 ek unit water ko represent karta hai.\n Har well ke paas ek corresponding bucket hoti hai jiska use usme se water extract karne ke liye kiya ja sakta hai, \n aur saare buckets ka capacity same hota hai.\n Aapka task hai buckets ka use karke wells ko empty karna.\n Output me aapko ye batana hai ki kitni baar aapko buckets ko lower karna padega.\n\n Example 1:\n Input: \n grid : [[0,0,1,0], [0,1,0,0], [1,1,1,1]]\n bucket_capacity : 1\n Output: 6\n\n Example 2:\n Input: \n grid : [[0,0,1,1], [0,0,0,0], [1,1,1,1], [0,1,1,1]]\n bucket_capacity : 2\n Output: 5\n \n Example 3:\n Input: \n grid : [[0,0,0], [0,0,0]]\n bucket_capacity : 5\n Output: 0\n\n Constraints:\n * saare wells ka length same hota hai\n * 1 <= grid.length <= 10^2\n * 1 <= grid[:,1].length <= 10^2\n * grid[i][j] -> 0 | 1\n * 1 <= capacity <= 10\n \"\"\"",
"entry_point": "max_fill",
"canonical_solution": " return sum([math.ceil(sum(arr)/capacity) for arr in grid])\n",
"test": "def check(candidate):\n\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([[0,0,1,0], [0,1,0,0], [1,1,1,1]], 1) == 6, \"Error\"\n assert candidate([[0,0,1,1], [0,0,0,0], [1,1,1,1], [0,1,1,1]], 2) == 5, \"Error\"\n assert candidate([[0,0,0], [0,0,0]], 5) == 0, \"Error\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([[1,1,1,1], [1,1,1,1]], 2) == 4, \"Error\"\n assert candidate([[1,1,1,1], [1,1,1,1]], 9) == 2, \"Error\"\n\n"
},
{
"task_id": "HumanEval/116",
"prompt": "\ndef sort_array(arr):\n \"\"\"\n Is Kata mein, aapko ek array ko sort karna hai jo non-negative integers ka hoga, \n binary representation mein ones ki sankhya ke hisaab se ascending order mein.\n Agar ones ki sankhya same ho, toh decimal value ke basis par sort karo.\n\n Isko aise implement karna hai:\n >>> sort_array([1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]\n >>> sort_array([-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]\n >>> sort_array([1, 0, 2, 3, 4]) [0, 1, 2, 3, 4]\n \"\"\"",
"entry_point": "sort_array",
"canonical_solution": " return sorted(sorted(arr), key=lambda x: bin(x)[2:].count('1'))\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([1,5,2,3,4]) == [1, 2, 4, 3, 5]\n assert candidate([-2,-3,-4,-5,-6]) == [-4, -2, -6, -5, -3]\n assert candidate([1,0,2,3,4]) == [0, 1, 2, 4, 3]\n assert candidate([]) == []\n assert candidate([2,5,77,4,5,3,5,7,2,3,4]) == [2, 2, 4, 4, 3, 3, 5, 5, 5, 7, 77]\n assert candidate([3,6,44,12,32,5]) == [32, 3, 5, 6, 12, 44]\n assert candidate([2,4,8,16,32]) == [2, 4, 8, 16, 32]\n assert candidate([2,4,8,16,32]) == [2, 4, 8, 16, 32]\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/117",
"prompt": "\ndef select_words(s, n):\n \"\"\"\n Ek string s aur ek natural number n diya gaya hai, aapko ek function implement karna hai jo \n string s se exactly n consonants wale saare words ko ek list mein return kare, jis order mein ye words string s mein appear hote hain.\n Agar string s khali hai to function ko ek khali list return karni chahiye.\n Note: Aap maan sakte ho ki input string mein sirf letters aur spaces honge.\n Examples:\n select_words(\"Mary had a little lamb\", 4) ==> [\"little\"]\n select_words(\"Mary had a little lamb\", 3) ==> [\"Mary\", \"lamb\"]\n select_words(\"simple white space\", 2) ==> []\n select_words(\"Hello world\", 4) ==> [\"world\"]\n select_words(\"Uncle sam\", 3) ==> [\"Uncle\"]\n \"\"\"",
"entry_point": "select_words",
"canonical_solution": " result = []\n for word in s.split():\n n_consonants = 0\n for i in range(0, len(word)):\n if word[i].lower() not in [\"a\",\"e\",\"i\",\"o\",\"u\"]:\n n_consonants += 1 \n if n_consonants == n:\n result.append(word)\n return result\n\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"Mary had a little lamb\", 4) == [\"little\"], \"First test error: \" + str(candidate(\"Mary had a little lamb\", 4)) \n assert candidate(\"Mary had a little lamb\", 3) == [\"Mary\", \"lamb\"], \"Second test error: \" + str(candidate(\"Mary had a little lamb\", 3)) \n assert candidate(\"simple white space\", 2) == [], \"Third test error: \" + str(candidate(\"simple white space\", 2)) \n assert candidate(\"Hello world\", 4) == [\"world\"], \"Fourth test error: \" + str(candidate(\"Hello world\", 4)) \n assert candidate(\"Uncle sam\", 3) == [\"Uncle\"], \"Fifth test error: \" + str(candidate(\"Uncle sam\", 3))\n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(\"\", 4) == [], \"1st edge test error: \" + str(candidate(\"\", 4))\n assert candidate(\"a b c d e f\", 1) == [\"b\", \"c\", \"d\", \"f\"], \"2nd edge test error: \" + str(candidate(\"a b c d e f\", 1))\n\n"
},
{
"task_id": "HumanEval/118",
"prompt": "\ndef get_closest_vowel(word):\n \"\"\"\n Aapko ek word diya gaya hai. Aapka task hai right side se dekhte hue us vowel ko dhundna hai jo \n do consonants ke beech mein hai (case sensitive).\n \n Shuruat aur ending mein jo vowels hain unka count nahi hoga. Agar aapko koi bhi vowel upar diye gaye \n condition ke hisaab se nahi mila toh khali string return karo. \n\n Aap maan sakte ho ki diya gaya string sirf English letters se bana hua hai.\n\n Udaharan:\n get_closest_vowel(\"yogurt\") ==> \"u\"\n get_closest_vowel(\"FULL\") ==> \"U\"\n get_closest_vowel(\"quick\") ==> \"\"\n get_closest_vowel(\"ab\") ==> \"\"\n \"\"\"",
"entry_point": "get_closest_vowel",
"canonical_solution": " if len(word) < 3:\n return \"\"\n\n vowels = {\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", 'O', 'U', 'I'}\n for i in range(len(word)-2, 0, -1):\n if word[i] in vowels:\n if (word[i+1] not in vowels) and (word[i-1] not in vowels):\n return word[i]\n return \"\"\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"yogurt\") == \"u\"\n assert candidate(\"full\") == \"u\"\n assert candidate(\"easy\") == \"\"\n assert candidate(\"eAsy\") == \"\"\n assert candidate(\"ali\") == \"\"\n assert candidate(\"bad\") == \"a\"\n assert candidate(\"most\") == \"o\"\n assert candidate(\"ab\") == \"\"\n assert candidate(\"ba\") == \"\"\n assert candidate(\"quick\") == \"\"\n assert candidate(\"anime\") == \"i\"\n assert candidate(\"Asia\") == \"\"\n assert candidate(\"Above\") == \"o\"\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/119",
"prompt": "\ndef match_parens(lst):\n \"\"\"\n Aapko do strings ki ek list di gayi hai, dono strings me sirf open\n parentheses '(' ya close parentheses ')' hi hote hain.\n Aapka kaam ye check karna hai ki kya in dono strings ko kisi order me concatenate karne se\n resulting string acchi banegi.\n Ek string S tabhi acchi maani jayegi jab usme saare parentheses balanced ho. Jaise ki: string '(())()' acchi hai, jabki string\n '())' acchi nahi hai.\n Agar acchi string banane ka koi tarika ho to 'Yes' return karo, aur anyatha 'No' return karo.\n\n Udaharan:\n match_parens(['()(', ')']) == 'Yes'\n match_parens([')', ')']) == 'No'\n \"\"\"",
"entry_point": "match_parens",
"canonical_solution": " def check(s):\n val = 0\n for i in s:\n if i == '(':\n val = val + 1\n else:\n val = val - 1\n if val < 0:\n return False\n return True if val == 0 else False\n\n S1 = lst[0] + lst[1]\n S2 = lst[1] + lst[0]\n return 'Yes' if check(S1) or check(S2) else 'No'\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(['()(', ')']) == 'Yes'\n assert candidate([')', ')']) == 'No'\n assert candidate(['(()(())', '())())']) == 'No'\n assert candidate([')())', '(()()(']) == 'Yes'\n assert candidate(['(())))', '(()())((']) == 'Yes'\n assert candidate(['()', '())']) == 'No'\n assert candidate(['(()(', '()))()']) == 'Yes'\n assert candidate(['((((', '((())']) == 'No'\n assert candidate([')(()', '(()(']) == 'No'\n assert candidate([')(', ')(']) == 'No'\n \n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(['(', ')']) == 'Yes'\n assert candidate([')', '(']) == 'Yes' \n\n"
},
{
"task_id": "HumanEval/120",
"prompt": "\ndef maximum(arr, k):\n \"\"\"\n Ek array arr diya gaya hai integers ka aur ek positive integer k, return karo ek sorted list \n lambai k ki maximum k numbers ke saath arr mein.\n\n Example 1:\n\n Input: arr = [-3, -4, 5], k = 3\n Output: [-4, -3, 5]\n\n Example 2:\n\n Input: arr = [4, -4, 4], k = 2\n Output: [4, 4]\n\n Example 3:\n\n Input: arr = [-3, 2, 1, 2, -1, -2, 1], k = 1\n Output: [2]\n\n Note:\n 1. Array ki lambai range mein hogi [1, 1000].\n 2. Array ke elements range mein honge [-1000, 1000].\n 3. 0 <= k <= len(arr)\n \"\"\"",
"entry_point": "maximum",
"canonical_solution": " if k == 0:\n return []\n arr.sort()\n ans = arr[-k:]\n return ans\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([-3, -4, 5], 3) == [-4, -3, 5]\n assert candidate([4, -4, 4], 2) == [4, 4]\n assert candidate([-3, 2, 1, 2, -1, -2, 1], 1) == [2]\n assert candidate([123, -123, 20, 0 , 1, 2, -3], 3) == [2, 20, 123]\n assert candidate([-123, 20, 0 , 1, 2, -3], 4) == [0, 1, 2, 20]\n assert candidate([5, 15, 0, 3, -13, -8, 0], 7) == [-13, -8, 0, 0, 3, 5, 15]\n assert candidate([-1, 0, 2, 5, 3, -10], 2) == [3, 5]\n assert candidate([1, 0, 5, -7], 1) == [5]\n assert candidate([4, -4], 2) == [-4, 4]\n assert candidate([-10, 10], 2) == [-10, 10]\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([1, 2, 3, -23, 243, -400, 0], 0) == []\n\n"
},
{
"task_id": "HumanEval/121",
"prompt": "\ndef solution(lst):\n \"\"\"\n Ek non-empty list di gayi hai integers ki, return karo sum of all odd elements jo even positions pe hain.\n \n Udaharan\n solution([5, 8, 7, 1]) ==> 12\n solution([3, 3, 3, 3, 3]) ==> 9\n solution([30, 13, 24, 321]) ==>0\n \"\"\"",
"entry_point": "solution",
"canonical_solution": " return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([5, 8, 7, 1]) == 12\n assert candidate([3, 3, 3, 3, 3]) == 9\n assert candidate([30, 13, 24, 321]) == 0\n assert candidate([5, 9]) == 5\n assert candidate([2, 4, 8]) == 0\n assert candidate([30, 13, 23, 32]) == 23\n assert candidate([3, 13, 2, 9]) == 3\n\n # Check some edge cases that are easy to work out by hand.\n\n"
},
{
"task_id": "HumanEval/122",
"prompt": "\ndef add_elements(arr, k):\n \"\"\"\n Ek non-empty array of integers arr aur ek integer k diya gaya hai, pehle k elements mein se jinme maximum do digits hai unka sum return karo.\n\n Udaharan:\n\n Input: arr = [111,21,3,4000,5,6,7,8,9], k = 4\n Output: 24 # sum of 21 + 3\n\n Constraints:\n 1. 1 <= len(arr) <= 100\n 2. 1 <= k <= len(arr)\n \"\"\"",
"entry_point": "add_elements",
"canonical_solution": " return sum(elem for elem in arr[:k] if len(str(elem)) <= 2)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1,-2,-3,41,57,76,87,88,99], 3) == -4\n assert candidate([111,121,3,4000,5,6], 2) == 0\n assert candidate([11,21,3,90,5,6,7,8,9], 4) == 125\n assert candidate([111,21,3,4000,5,6,7,8,9], 4) == 24, \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([1], 1) == 1, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/123",
"prompt": "\ndef get_odd_collatz(n):\n \"\"\"\n Diye gaye positive integer n ke liye, ek sorted list return karo jo collatz sequence mein odd numbers ko contain karti ho.\n\n Collatz conjecture ek mathematics ka conjecture hai jo ek sequence ke baare mein baat karta hai\n jise is prakar se define kiya gaya hai: kisi bhi positive integer n se shuru karo. Phir har term ko \n previous term se is prakar se prapt kiya jata hai: agar previous term even hai, toh next term \n previous term ka aadha hota hai. Agar previous term odd hai, toh next term 3 guna previous\n term plus 1 hota hai. Conjecture yeh hai ki chahe n ki value kuch bhi ho, sequence hamesha 1 tak pahunchegi.\n\n Note: \n 1. Collatz(1) is [1].\n 2. returned list badhat kram mein sorted hoti hai.\n\n Jaise ki:\n get_odd_collatz(5) returns [1, 5] # 5 ke liye collatz sequence [5, 16, 8, 4, 2, 1] hai, toh odd numbers sirf 1, aur 5 hai.\n \"\"\"",
"entry_point": "get_odd_collatz",
"canonical_solution": " if n%2==0:\n odd_collatz = [] \n else:\n odd_collatz = [n]\n while n > 1:\n if n % 2 == 0:\n n = n/2\n else:\n n = n*3 + 1\n \n if n%2 == 1:\n odd_collatz.append(int(n))\n\n return sorted(odd_collatz)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(14) == [1, 5, 7, 11, 13, 17]\n assert candidate(5) == [1, 5]\n assert candidate(12) == [1, 3, 5], \"This prints if this assert fails 1 (good for debugging!)\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(1) == [1], \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/124",
"prompt": "\ndef valid_date(date):\n \"\"\"\n Aapko ek function likhna hai jo diye gaye date string ko validate karta hai aur\n agar date valid hai to True return karta hai, nahi to False.\n Date tabhi valid hogi jab niche diye gaye saare rules satisfy ho:\n 1. Date string khali nahi honi chahiye.\n 2. Dinon ki sankhya 1 se kam ya 31 se adhik na ho mahino 1,3,5,7,8,10,12 ke liye. Aur dinon ki sankhya 1 se kam ya 30 se adhik na ho mahino 4,6,9,11 ke liye. Aur, dinon ki sankhya 1 se kam ya 29 se adhik na ho mahine 2 ke liye.\n 3. Mahine ki sankhya 1 se kam ya 12 se adhik na ho.\n 4. Date ka format aisa hona chahiye: mm-dd-yyyy\n\n jaise ki: \n valid_date('03-11-2000') => True\n\n valid_date('15-01-2012') => False\n\n valid_date('04-0-2040') => False\n\n valid_date('06-04-2020') => True\n\n valid_date('06/04/2020') => False\n \"\"\"",
"entry_point": "valid_date",
"canonical_solution": " try:\n date = date.strip()\n month, day, year = date.split('-')\n month, day, year = int(month), int(day), int(year)\n if month < 1 or month > 12:\n return False\n if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:\n return False\n if month in [4,6,9,11] and day < 1 or day > 30:\n return False\n if month == 2 and day < 1 or day > 29:\n return False\n except:\n return False\n\n return True\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('03-11-2000') == True\n\n assert candidate('15-01-2012') == False\n\n assert candidate('04-0-2040') == False\n\n assert candidate('06-04-2020') == True\n\n assert candidate('01-01-2007') == True\n\n assert candidate('03-32-2011') == False\n\n assert candidate('') == False\n\n assert candidate('04-31-3000') == False\n\n assert candidate('06-06-2005') == True\n\n assert candidate('21-31-2000') == False\n\n assert candidate('04-12-2003') == True\n\n assert candidate('04122003') == False\n\n assert candidate('20030412') == False\n\n assert candidate('2003-04') == False\n\n assert candidate('2003-04-12') == False\n\n assert candidate('04-2003') == False\n"
},
{
"task_id": "HumanEval/125",
"prompt": "\ndef split_words(txt):\n \"\"\"\n Ek string di gayi hai jisme words hain, aapko ek list return karni hai jisme words whitespace par split ho. Agar text me koi whitespace nahi hai toh aapko commas ',' par split karna hai. Agar koi comma bhi nahi hai toh aapko alphabet me odd order wale lower-case letters ki count return karni hai, jaise ki ord('a') = 0, ord('b') = 1, ... ord('z') = 25\n Udaharan\n split_words(\"Hello world!\") ➞ [\"Hello\", \"world!\"]\n split_words(\"Hello,world!\") ➞ [\"Hello\", \"world!\"]\n split_words(\"abcdef\") == 3\n \"\"\"",
"entry_point": "split_words",
"canonical_solution": " if \" \" in txt:\n return txt.split()\n elif \",\" in txt:\n return txt.replace(',',' ').split()\n else:\n return len([i for i in txt if i.islower() and ord(i)%2 == 0])\n",
"test": "def check(candidate):\n\n assert candidate(\"Hello world!\") == [\"Hello\",\"world!\"]\n assert candidate(\"Hello,world!\") == [\"Hello\",\"world!\"]\n assert candidate(\"Hello world,!\") == [\"Hello\",\"world,!\"]\n assert candidate(\"Hello,Hello,world !\") == [\"Hello,Hello,world\",\"!\"]\n assert candidate(\"abcdef\") == 3\n assert candidate(\"aaabb\") == 2\n assert candidate(\"aaaBb\") == 1\n assert candidate(\"\") == 0\n"
},
{
"task_id": "HumanEval/126",
"prompt": "\ndef is_sorted(lst):\n \"\"\"\n Ek numbers ki list di gayi hai, return karo ki kya ye ascending order mein sorted hai ya nahi. Agar list mein ek se jyada same number ke duplicate hain, to False return karo. Maan lo ki koi negative number nahi hai aur sirf integers hain.\n\nUdaharan\nis_sorted([5]) ➞ True\nis_sorted([1, 2, 3, 4, 5]) ➞ True\nis_sorted([1, 3, 2, 4, 5]) ➞ False\nis_sorted([1, 2, 3, 4, 5, 6]) ➞ True\nis_sorted([1, 2, 3, 4, 5, 6, 7]) ➞ True\nis_sorted([1, 3, 2, 4, 5, 6, 7]) ➞ False\nis_sorted([1, 2, 2, 3, 3, 4]) ➞ True\nis_sorted([1, 2, 2, 2, 3, 4]) ➞ False\n \"\"\"",
"entry_point": "is_sorted",
"canonical_solution": " count_digit = dict([(i, 0) for i in lst])\n for i in lst:\n count_digit[i]+=1 \n if any(count_digit[i] > 2 for i in lst):\n return False\n if all(lst[i-1] <= lst[i] for i in range(1, len(lst))):\n return True\n else:\n return False\n \n \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([5]) == True\n assert candidate([1, 2, 3, 4, 5]) == True\n assert candidate([1, 3, 2, 4, 5]) == False\n assert candidate([1, 2, 3, 4, 5, 6]) == True\n assert candidate([1, 2, 3, 4, 5, 6, 7]) == True\n assert candidate([1, 3, 2, 4, 5, 6, 7]) == False, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([]) == True, \"This prints if this assert fails 2 (good for debugging!)\"\n assert candidate([1]) == True, \"This prints if this assert fails 3 (good for debugging!)\"\n assert candidate([3, 2, 1]) == False, \"This prints if this assert fails 4 (good for debugging!)\"\n \n # Check some edge cases that are easy to work out by hand.\n assert candidate([1, 2, 2, 2, 3, 4]) == False, \"This prints if this assert fails 5 (good for debugging!)\"\n assert candidate([1, 2, 3, 3, 3, 4]) == False, \"This prints if this assert fails 6 (good for debugging!)\"\n assert candidate([1, 2, 2, 3, 3, 4]) == True, \"This prints if this assert fails 7 (good for debugging!)\"\n assert candidate([1, 2, 3, 4]) == True, \"This prints if this assert fails 8 (good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/127",
"prompt": "\ndef intersection(interval1, interval2):\n \"\"\"\n Aapko do intervals diye gaye hain,\n jahan har interval ek integers ki jodi hoti hai. Jaise ki, interval = (start, end) = (1, 2).\n Diye gaye intervals closed hote hain matlab ki interval (start, end)\n dono start aur end ko include karta hai.\n Har diye gaye interval ke liye, maan liya jata hai ki uska start uske end se kam ya barabar hota hai.\n Aapka task hai yeh determine karna ki in dono \n intervals ke intersection ka length ek prime number hai ya nahi.\n Udaharan, intervals (1, 3), (2, 4) ka intersection (2, 3) hota hai\n jiska length 1 hota hai, jo ki ek prime number nahi hai.\n Agar intersection ka length ek prime number hai, to \"YES\" return karo,\n nahi to, \"NO\" return karo.\n Agar do intervals intersect nahi karte, to \"NO\" return karo.\n\n\n [input/output] samples:\n intersection((1, 2), (2, 3)) ==> \"NO\"\n intersection((-1, 1), (0, 4)) ==> \"NO\"\n intersection((-3, -1), (-5, 5)) ==> \"YES\"\n \"\"\"",
"entry_point": "intersection",
"canonical_solution": " def is_prime(num):\n if num == 1 or num == 0:\n return False\n if num == 2:\n return True\n for i in range(2, num):\n if num%i == 0:\n return False\n return True\n\n l = max(interval1[0], interval2[0])\n r = min(interval1[1], interval2[1])\n length = r - l\n if length > 0 and is_prime(length):\n return \"YES\"\n return \"NO\"\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate((1, 2), (2, 3)) == \"NO\"\n assert candidate((-1, 1), (0, 4)) == \"NO\"\n assert candidate((-3, -1), (-5, 5)) == \"YES\"\n assert candidate((-2, 2), (-4, 0)) == \"YES\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate((-11, 2), (-1, -1)) == \"NO\"\n assert candidate((1, 2), (3, 5)) == \"NO\"\n assert candidate((1, 2), (1, 2)) == \"NO\"\n assert candidate((-2, -2), (-3, -2)) == \"NO\"\n\n"
},
{
"task_id": "HumanEval/128",
"prompt": "\ndef prod_signs(arr):\n \"\"\"\n Aapko ek array arr diya gaya hai integers ka aur aapko return karna hai \n integers ke magnitudes ka sum jo multiplied hoga har number ke signs ka product se\n jo array me diye gaye hain, jo ki 1, -1 ya 0 se represent kiya gaya hai.\n Note: Agar arr khali hai to None return karo.\n\n Udaharan:\n >>> prod_signs([1, 2, 2, -4]) == -9\n >>> prod_signs([0, 1]) == 0\n >>> prod_signs([]) == None\n \"\"\"",
"entry_point": "prod_signs",
"canonical_solution": " if not arr: return None\n prod = 0 if 0 in arr else (-1) ** len(list(filter(lambda x: x < 0, arr)))\n return prod * sum([abs(i) for i in arr])\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([1, 2, 2, -4]) == -9\n assert candidate([0, 1]) == 0\n assert candidate([1, 1, 1, 2, 3, -1, 1]) == -10\n assert candidate([]) == None\n assert candidate([2, 4,1, 2, -1, -1, 9]) == 20\n assert candidate([-1, 1, -1, 1]) == 4\n assert candidate([-1, 1, 1, 1]) == -4\n assert candidate([-1, 1, 1, 0]) == 0\n\n # Check some edge cases that are easy to work out by hand.\n assert True, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/129",
"prompt": "\ndef minPath(grid, k):\n \"\"\"\n Ek grid di gayi hai N rows aur N columns ke saath (N >= 2) aur ek positive integer k,\n grid ke har cell me ek value hai. Har integer range [1, N * N]\n inclusive grid ke cells par exactly ek baar appear hota hai.\n\n Aapko grid me length k ki minimum path find karni hai. Aap kisi bhi cell se start\n kar sakte ho, aur har step me aap kisi bhi neighbor cell me move kar sakte ho,\n dusre shabdo me, aap un cells me ja sakte ho jo aapke current\n cell se edge share karte hain.\n Dhyan dijiye ki length k ki path ka matlab hai exactly k cells visit karna (not\n necessarily distinct).\n Aap grid ke bahar nahi ja sakte.\n Ek path A (length k ki) ko path B (length k ki) se kam maana jata hai agar\n cells par jin values ko A aur B go through karte hain unki ordered lists banane ke baad (unhe hum lst_A aur lst_B kehte hain), lst_A lst_B se lexicographically kam hota hai, dusre shabdo me, ek integer index i exist karta hai (1 <= i <= k)\n jahan lst_A[i] < lst_B[i] aur kisi bhi j (1 <= j < i) ke liye hum\n lst_A[j] = lst_B[j] rakhte hain.\n Yeh guarantee ki gayi hai ki answer unique hoga.\n Return karo ek ordered list of the values jin cells se minimum path go through karti hai.\n\n Examples:\n\n Input: grid = [ [1,2,3], [4,5,6], [7,8,9]], k = 3\n Output: [1, 2, 1]\n\n Input: grid = [ [5,9,3], [4,1,6], [7,8,2]], k = 1\n Output: [1]\n \"\"\"",
"entry_point": "minPath",
"canonical_solution": " n = len(grid)\n val = n * n + 1\n for i in range(n):\n for j in range(n):\n if grid[i][j] == 1:\n temp = []\n if i != 0:\n temp.append(grid[i - 1][j])\n\n if j != 0:\n temp.append(grid[i][j - 1])\n\n if i != n - 1:\n temp.append(grid[i + 1][j])\n\n if j != n - 1:\n temp.append(grid[i][j + 1])\n\n val = min(temp)\n\n ans = []\n for i in range(k):\n if i % 2 == 0:\n ans.append(1)\n else:\n ans.append(val)\n return ans\n",
"test": "def check(candidate):\n\n # Check some simple cases\n print\n assert candidate([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3) == [1, 2, 1]\n assert candidate([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1) == [1]\n assert candidate([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]], 4) == [1, 2, 1, 2]\n assert candidate([[6, 4, 13, 10], [5, 7, 12, 1], [3, 16, 11, 15], [8, 14, 9, 2]], 7) == [1, 10, 1, 10, 1, 10, 1]\n assert candidate([[8, 14, 9, 2], [6, 4, 13, 15], [5, 7, 1, 12], [3, 10, 11, 16]], 5) == [1, 7, 1, 7, 1]\n assert candidate([[11, 8, 7, 2], [5, 16, 14, 4], [9, 3, 15, 6], [12, 13, 10, 1]], 9) == [1, 6, 1, 6, 1, 6, 1, 6, 1]\n assert candidate([[12, 13, 10, 1], [9, 3, 15, 6], [5, 16, 14, 4], [11, 8, 7, 2]], 12) == [1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6]\n assert candidate([[2, 7, 4], [3, 1, 5], [6, 8, 9]], 8) == [1, 3, 1, 3, 1, 3, 1, 3]\n assert candidate([[6, 1, 5], [3, 8, 9], [2, 7, 4]], 8) == [1, 5, 1, 5, 1, 5, 1, 5]\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([[1, 2], [3, 4]], 10) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]\n assert candidate([[1, 3], [3, 2]], 10) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3]\n\n"
},
{
"task_id": "HumanEval/130",
"prompt": "\ndef tri(n):\n \"\"\"\n Sabhi ko Fibonacci sequence ke baare mein pata hai, yeh mathematicians\nne pichle kuch sadiyon mein gahrai se adhyayan kiya. Lekin, jo log nahi jaante\nwoh hai Tribonacci sequence.\n Tribonacci sequence ko define kiya gaya hai recurrence ke dwara:\n tri(1) = 3\n tri(n) = 1 + n / 2, agar n even hai.\n tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), agar n odd hai.\n Jaise ki:\n tri(2) = 1 + (2 / 2) = 2\n tri(4) = 3\n tri(3) = tri(2) + tri(1) + tri(4)\n = 2 + 3 + 3 = 8 \n Aapko ek non-negative integer number n diya jayega, aapko Tribonacci sequence ke pehle n + 1 numbers ka ek list return karna hai.\n Examples:\n tri(3) = [1, 3, 2, 8]\n \"\"\"",
"entry_point": "tri",
"canonical_solution": " if n == 0:\n return [1]\n my_tri = [1, 3]\n for i in range(2, n + 1):\n if i % 2 == 0:\n my_tri.append(i / 2 + 1)\n else:\n my_tri.append(my_tri[i - 1] + my_tri[i - 2] + (i + 3) / 2)\n return my_tri\n",
"test": "def check(candidate):\n\n # Check some simple cases\n \n assert candidate(3) == [1, 3, 2.0, 8.0]\n assert candidate(4) == [1, 3, 2.0, 8.0, 3.0]\n assert candidate(5) == [1, 3, 2.0, 8.0, 3.0, 15.0]\n assert candidate(6) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0]\n assert candidate(7) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0]\n assert candidate(8) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0]\n assert candidate(9) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0, 35.0]\n assert candidate(20) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0, 35.0, 6.0, 48.0, 7.0, 63.0, 8.0, 80.0, 9.0, 99.0, 10.0, 120.0, 11.0]\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(0) == [1]\n assert candidate(1) == [1, 3]\n"
},
{
"task_id": "HumanEval/131",
"prompt": "\ndef digits(n):\n \"\"\"\n Ek positive integer n diya gaya hai, odd digits ka product return karo.\n Agar saare digits even hain to 0 return karo.\n Udaharan ke liye:\n digits(1) == 1\n digits(4) == 0\n digits(235) == 15\n \"\"\"",
"entry_point": "digits",
"canonical_solution": " product = 1\n odd_count = 0\n for digit in str(n):\n int_digit = int(digit)\n if int_digit%2 == 1:\n product= product*int_digit\n odd_count+=1\n if odd_count ==0:\n return 0\n else:\n return product\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(5) == 5\n assert candidate(54) == 5\n assert candidate(120) ==1\n assert candidate(5014) == 5\n assert candidate(98765) == 315\n assert candidate(5576543) == 2625\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(2468) == 0\n\n"
},
{
"task_id": "HumanEval/132",
"prompt": "\ndef is_nested(string):\n \"\"\"\n Ek function banao jo sirf square brackets wala string input ke roop mein leta hai.\n Function tabhi True return karega jab valid subsequence of brackets ho \n jisme kam se kam ek bracket nested ho.\n\n is_nested('[[]]') ➞ True\n is_nested('[]]]]]]][[[[[]') ➞ False\n is_nested('[][]') ➞ False\n is_nested('[]') ➞ False\n is_nested('[[][]]') ➞ True\n is_nested('[[]][[') ➞ True\n \"\"\"",
"entry_point": "is_nested",
"canonical_solution": " opening_bracket_index = []\n closing_bracket_index = []\n for i in range(len(string)):\n if string[i] == '[':\n opening_bracket_index.append(i)\n else:\n closing_bracket_index.append(i)\n closing_bracket_index.reverse()\n cnt = 0\n i = 0\n l = len(closing_bracket_index)\n for idx in opening_bracket_index:\n if i < l and idx < closing_bracket_index[i]:\n cnt += 1\n i += 1\n return cnt >= 2\n\n \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate('[[]]') == True, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate('[]]]]]]][[[[[]') == False\n assert candidate('[][]') == False\n assert candidate(('[]')) == False\n assert candidate('[[[[]]]]') == True\n assert candidate('[]]]]]]]]]]') == False\n assert candidate('[][][[]]') == True\n assert candidate('[[]') == False\n assert candidate('[]]') == False\n assert candidate('[[]][[') == True\n assert candidate('[[][]]') == True\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate('') == False, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate('[[[[[[[[') == False\n assert candidate(']]]]]]]]') == False\n\n"
},
{
"task_id": "HumanEval/133",
"prompt": "\n\ndef sum_squares(lst):\n \"\"\"\n Aapko ek numbers ki list di gayi hai.\n Aapko di gayi list ke squared numbers ka sum return karna hai,\n pehle har element ko list mein upper int(Ceiling) par round karo.\n Udaharan:\n Agar lst = [1,2,3] hai to output hona chahiye 14\n Agar lst = [1,4,9] hai to output hona chahiye 98\n Agar lst = [1,3,5,7] hai to output hona chahiye 84\n Agar lst = [1.4,4.2,0] hai to output hona chahiye 29\n Agar lst = [-2.4,1,1] hai to output hona chahiye 6\n \"\"\"",
"entry_point": "sum_squares",
"canonical_solution": " import math\n squared = 0\n for i in lst:\n squared += math.ceil(i)**2\n return squared\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1,2,3])==14, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([1.0,2,3])==14, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([1,3,5,7])==84, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([1.4,4.2,0])==29, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([-2.4,1,1])==6, \"This prints if this assert fails 1 (good for debugging!)\"\n\n assert candidate([100,1,15,2])==10230, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([10000,10000])==200000000, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([-1.4,4.6,6.3])==75, \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate([-1.4,17.9,18.9,19.9])==1086, \"This prints if this assert fails 1 (good for debugging!)\"\n\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([0])==0, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([-1])==1, \"This prints if this assert fails 2 (also good for debugging!)\"\n assert candidate([-1,1,0])==2, \"This prints if this assert fails 2 (also good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/134",
"prompt": "\ndef check_if_last_char_is_a_letter(txt):\n \"\"\"\n Ek function banaiye jo True return kare agar diye gaye string ka last character ek alphabetical character ho aur wo kisi word ka hissa na ho, anyatha False return kare.\n Dhyan de: \"word\" ek characters ka group hota hai jo space se alag na ho.\n\n Udaharan:\n check_if_last_char_is_a_letter(\"apple pie\") ➞ False\n check_if_last_char_is_a_letter(\"apple pi e\") ➞ True\n check_if_last_char_is_a_letter(\"\") ➞ False\n \"\"\"",
"entry_point": "check_if_last_char_is_a_letter",
"canonical_solution": " \n check = txt.split(' ')[-1]\n return True if len(check) == 1 and (97 <= ord(check.lower()) <= 122) else False\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"apple\") == False\n assert candidate(\"apple pi e\") == True\n assert candidate(\"eeeee\") == False\n assert candidate(\"A\") == True\n assert candidate(\"Pumpkin pie \") == False\n assert candidate(\"Pumpkin pie 1\") == False\n assert candidate(\"\") == False\n assert candidate(\"eeeee e \") == False\n assert candidate(\"apple pie\") == False\n assert candidate(\"apple pi e \") == False\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/135",
"prompt": "\ndef can_arrange(arr):\n \"\"\"\n Ek function banaiye jo ek element ka sabse bada index return kare jo\n usse turant pichle element se bada ya barabar nahi ho. Agar\n aisa koi element nahi hai, to -1 return kare. Diye gaye array me\n duplicate values nahi hogi.\n\n Udaharan:\n can_arrange([1,2,4,3,5]) = 3\n can_arrange([1,2,3]) = -1\n \"\"\"",
"entry_point": "can_arrange",
"canonical_solution": " ind=-1\n i=1\n while i<len(arr):\n if arr[i]<arr[i-1]:\n ind=i\n i+=1\n return ind\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([1,2,4,3,5])==3\n assert candidate([1,2,4,5])==-1\n assert candidate([1,4,2,5,6,7,8,9,10])==2\n assert candidate([4,8,5,7,3])==4\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate([])==-1\n\n"
},
{
"task_id": "HumanEval/136",
"prompt": "\ndef largest_smallest_integers(lst):\n \"\"\"\n Ek function banao jo ek tuple (a, b) return kare, jahan 'a' negative integers ka sabse bada hai, aur 'b' positive integers ka sabse chota hai ek list mein.\n Agar koi negative ya positive integers nahi hai, to unhe None ke roop mein return karo.\n\n Udaharan:\n largest_smallest_integers([2, 4, 1, 3, 5, 7]) == (None, 1)\n largest_smallest_integers([]) == (None, None)\n largest_smallest_integers([0]) == (None, None)\n \"\"\"",
"entry_point": "largest_smallest_integers",
"canonical_solution": " smallest = list(filter(lambda x: x < 0, lst))\n largest = list(filter(lambda x: x > 0, lst))\n return (max(smallest) if smallest else None, min(largest) if largest else None)\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate([2, 4, 1, 3, 5, 7]) == (None, 1)\n assert candidate([2, 4, 1, 3, 5, 7, 0]) == (None, 1)\n assert candidate([1, 3, 2, 4, 5, 6, -2]) == (-2, 1)\n assert candidate([4, 5, 3, 6, 2, 7, -7]) == (-7, 2)\n assert candidate([7, 3, 8, 4, 9, 2, 5, -9]) == (-9, 2)\n assert candidate([]) == (None, None)\n assert candidate([0]) == (None, None)\n assert candidate([-1, -3, -5, -6]) == (-1, None)\n assert candidate([-1, -3, -5, -6, 0]) == (-1, None)\n assert candidate([-6, -4, -4, -3, 1]) == (-3, 1)\n assert candidate([-6, -4, -4, -3, -100, 1]) == (-3, 1)\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n"
},
{
"task_id": "HumanEval/137",
"prompt": "\ndef compare_one(a, b):\n \"\"\"\n Ek function banao jo integers, floats, ya strings jo real numbers ko represent karte hain, leta hai aur usme se bada variable uske diye gaye variable type mein return karta hai.\n Agar values equal hain to None return karo.\n Dhyan do: Agar ek real number ko string ke roop mein represent kiya gaya hai, to floating point . ya , ho sakta hai.\n\n compare_one(1, 2.5) ➞ 2.5\n compare_one(1, \"2,3\") ➞ \"2,3\"\n compare_one(\"5,1\", \"6\") ➞ \"6\"\n compare_one(\"1\", 1) ➞ None\n \"\"\"",
"entry_point": "compare_one",
"canonical_solution": " temp_a, temp_b = a, b\n if isinstance(temp_a, str): temp_a = temp_a.replace(',','.')\n if isinstance(temp_b, str): temp_b = temp_b.replace(',','.')\n if float(temp_a) == float(temp_b): return None\n return a if float(temp_a) > float(temp_b) else b \n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(1, 2) == 2\n assert candidate(1, 2.5) == 2.5\n assert candidate(2, 3) == 3\n assert candidate(5, 6) == 6\n assert candidate(1, \"2,3\") == \"2,3\"\n assert candidate(\"5,1\", \"6\") == \"6\"\n assert candidate(\"1\", \"2\") == \"2\"\n assert candidate(\"1\", 1) == None\n\n # Check some edge cases that are easy to work out by hand.\n assert True\n\n"
},
{
"task_id": "HumanEval/138",
"prompt": "\ndef is_equal_to_sum_even(n):\n \"\"\"\n Evaluate karo ki diya gaya number n kya exactly 4 positive even numbers ka sum ho sakta hai\n Udaharan\n is_equal_to_sum_even(4) == False\n is_equal_to_sum_even(6) == False\n is_equal_to_sum_even(8) == True\n \"\"\"",
"entry_point": "is_equal_to_sum_even",
"canonical_solution": " return n%2 == 0 and n >= 8\n",
"test": "def check(candidate):\n assert candidate(4) == False\n assert candidate(6) == False\n assert candidate(8) == True\n assert candidate(10) == True\n assert candidate(11) == False\n assert candidate(12) == True\n assert candidate(13) == False\n assert candidate(16) == True\n"
},
{
"task_id": "HumanEval/139",
"prompt": "\ndef special_factorial(n):\n \"\"\"\n Brazilian factorial is defined as:\n brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!\n jaha n > 0\n\n Jaise ki:\n >>> special_factorial(4)\n 288\n\n Ye function ek integer input ke roop me lega aur is integer ka special\n factorial return karega.\n \"\"\"",
"entry_point": "special_factorial",
"canonical_solution": " fact_i = 1\n special_fact = 1\n for i in range(1, n+1):\n fact_i *= i\n special_fact *= fact_i\n return special_fact\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(4) == 288, \"Test 4\"\n assert candidate(5) == 34560, \"Test 5\"\n assert candidate(7) == 125411328000, \"Test 7\"\n\n # Check some edge cases that are easy to work out by hand.\n assert candidate(1) == 1, \"Test 1\"\n\n"
},
{
"task_id": "HumanEval/140",
"prompt": "\ndef fix_spaces(text):\n \"\"\"\n Diye gaye string text mein, saare spaces ko underscores se replace karo,\n aur agar ek string mein 2 se zyada consecutive spaces ho,\n toh saare consecutive spaces ko - se replace karo.\n \n fix_spaces(\"Example\") == \"Example\"\n fix_spaces(\"Example 1\") == \"Example_1\"\n fix_spaces(\" Example 2\") == \"_Example_2\"\n fix_spaces(\" Example 3\") == \"_Example-3\"\n \"\"\"",
"entry_point": "fix_spaces",
"canonical_solution": " new_text = \"\"\n i = 0\n start, end = 0, 0\n while i < len(text):\n if text[i] == \" \":\n end += 1\n else:\n if end - start > 2:\n new_text += \"-\"+text[i]\n elif end - start > 0:\n new_text += \"_\"*(end - start)+text[i]\n else:\n new_text += text[i]\n start, end = i+1, i+1\n i+=1\n if end - start > 2:\n new_text += \"-\"\n elif end - start > 0:\n new_text += \"_\"\n return new_text\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"Example\") == \"Example\", \"This prints if this assert fails 1 (good for debugging!)\"\n assert candidate(\"Mudasir Hanif \") == \"Mudasir_Hanif_\", \"This prints if this assert fails 2 (good for debugging!)\"\n assert candidate(\"Yellow Yellow Dirty Fellow\") == \"Yellow_Yellow__Dirty__Fellow\", \"This prints if this assert fails 3 (good for debugging!)\"\n \n # Check some edge cases that are easy to work out by hand.\n assert candidate(\"Exa mple\") == \"Exa-mple\", \"This prints if this assert fails 4 (good for debugging!)\"\n assert candidate(\" Exa 1 2 2 mple\") == \"-Exa_1_2_2_mple\", \"This prints if this assert fails 4 (good for debugging!)\"\n\n"
},
{
"task_id": "HumanEval/141",
"prompt": "\ndef file_name_check(file_name):\n \"\"\"\n Ek function banao jo ek string leta hai jisme file ka naam hota hai, aur return karta hai\n 'Yes' agar file ka naam valid hai, aur 'No' agar nahi.\n Ek file ka naam tabhi maana jayega jab saare neeche diye gaye conditions meet ho:\n - File ke naam me teen se zyada digits ('0'-'9') nahi hone chahiye.\n - File ke naam me sirf ek dot '.' hona chahiye.\n - Dot se pehle ka substring khali nahi hona chahiye, aur uska shuruat latin alphabet ('a'-'z' aur 'A'-'Z') se hona chahiye.\n - Dot ke baad ka substring inme se ek hona chahiye: ['txt', 'exe', 'dll']\n Examples:\n file_name_check(\"example.txt\") # => 'Yes'\n file_name_check(\"1example.dll\") # => 'No' (naam latin alphabet letter se shuru hona chahiye)\n \"\"\"",
"entry_point": "file_name_check",
"canonical_solution": " suf = ['txt', 'exe', 'dll']\n lst = file_name.split(sep='.')\n if len(lst) != 2:\n return 'No'\n if not lst[1] in suf:\n return 'No'\n if len(lst[0]) == 0:\n return 'No'\n if not lst[0][0].isalpha():\n return 'No'\n t = len([x for x in lst[0] if x.isdigit()])\n if t > 3:\n return 'No'\n return 'Yes'\n",
"test": "def check(candidate):\n\n # Check some simple cases\n assert candidate(\"example.txt\") == 'Yes'\n assert candidate(\"1example.dll\") == 'No'\n assert candidate('s1sdf3.asd') == 'No'\n assert candidate('K.dll') == 'Yes'\n assert candidate('MY16FILE3.exe') == 'Yes'\n assert candidate('His12FILE94.exe') == 'No'\n assert candidate('_Y.txt') == 'No'\n assert candidate('?aREYA.exe') == 'No'\n assert candidate('/this_is_valid.dll') == 'No'\n assert candidate('this_is_valid.wow') == 'No'\n assert candidate('this_is_valid.txt') == 'Yes'\n assert candidate('this_is_valid.txtexe') == 'No'\n assert candidate('#this2_i4s_5valid.ten') == 'No'\n assert candidate('@this1_is6_valid.exe') == 'No'\n assert candidate('this_is_12valid.6exe4.txt') == 'No'\n assert candidate('all.exe.txt') == 'No'\n assert candidate('I563_No.exe') == 'Yes'\n assert candidate('Is3youfault.txt') == 'Yes'\n assert candidate('no_one#knows.dll') == 'Yes'\n assert candidate('1I563_Yes3.exe') == 'No'\n assert candidate('I563_Yes3.txtt') == 'No'\n assert candidate('final..txt') == 'No'\n assert candidate('final132') == 'No'\n assert candidate('_f4indsartal132.') == 'No'\n \n \n\n # Check some edge cases that are easy to work out by hand.\n assert candidate('.txt') == 'No'\n assert candidate('s.') == 'No'\n\n"
},
{
"task_id": "HumanEval/142",
"prompt": "\n\n\ndef sum_squares(lst):\n \"\"\"\n \"\n Ye function ek integers ki list lega. List ke saare entries ke liye, function integer entry ko square karega agar uska index 3 ka \n multiple hai aur cube karega agar uska index 4 ka multiple hai aur 3 ka multiple nahi hai. Function un entries ko change nahi \n karega jinki indexes 3 ya 4 ka multiple nahi hai. Phir function saare entries ka sum return karega. \n \n Examples:\n Agar lst = [1,2,3] hai to output 6 hona chahiye\n Agar lst = [] hai to output 0 hona chahiye\n Agar lst = [-1,-5,2,-1,-5] hai to output -126 hona chahiye\n \"\"\"",
"entry_point": "sum_squares",
"canonical_solution": " result =[]\n for i in range(len(lst)):\n if i %3 == 0:\n result.append(lst[i]**2)\n elif i % 4 == 0 and i%3 != 0:\n result.append(lst[i]**3)\n else:\n result.append(lst[i])\n return sum(result)\n",