submission_id
int32
10
42.5k
func_code
stringlengths
22
782
assignment_id
stringlengths
4
23
func_name
stringlengths
4
23
description
stringlengths
26
128
test
stringlengths
45
1.22k
correct
bool
2 classes
user
stringlengths
36
36
academic_year
int32
2.02k
2.02k
25,053
def circumference(r): return 2 * pi * r
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
1,190
def area(r): return pi * r * r
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
41,120
def circumference(r): return 2 * pi * r
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
2,358
def reverse(a): i = 0 while i < len(a) / 2: a[i] = a[-i - 1] i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
1,988
def reverse(a): i = 0 while i < len(a) / 2: a[i] = a[len(a) - i - 1] i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
31,189
def reverse(a): i = 0 while i < len(a) / 2: tmp = a[i] a[i] = a[-i - 1] a[-i - 1] = tmp i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
13,511
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 while i < len(a) / 2: swap(i, -i - 1) i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
31,733
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 while i < len(a) / 2: swap(a, i, -i - 1) i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
6,993
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 while i < len(a) / 2: swap(a, i, -i - 1) i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
17,914
def selection_sort(a): i = 0 while i < len(a): p = i j += 1 while j < len(a): if a[j] < a[p]: p = j j += 1 tmp = a[p] a[p] = a[i] a[i] = tmp i += 1
selection_sort
selection_sort
Sort a list by repeatedly move minimimum of remaining sublist to front.
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
6,720
def selection_sort(a): i = 0 while i < len(a): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j += 1 tmp = a[p] a[p] = a[i] a[i] = tmp i += 1
selection_sort
selection_sort
Sort a list by repeatedly move minimimum of remaining sublist to front.
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
27,665
def selection_sort(a): i = 0 while i < len(a): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j += 1 tmp = a[p] a[p] = a[i] a[i] = tmp i += 1
selection_sort
selection_sort
Sort a list by repeatedly move minimimum of remaining sublist to front.
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
13,468
def selection_sort(a): i = 0 while i < len(a): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j += 1 tmp = a[p] a[p] = a[i] a[i] = tmp i += 1
selection_sort
selection_sort
Sort a list by repeatedly move minimimum of remaining sublist to front.
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
21,588
def selection_sort(a): i = 0 while i < len(a): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j += 1 tmp = a[p] a[p] = a[i] a[i] = tmp i += 1
selection_sort
selection_sort
Sort a list by repeatedly move minimimum of remaining sublist to front.
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
false
3a3b6ee9-ae37-4d43-b10a-27ade2385dcd
2,016
7,272
def reverse(a): i = 0 while i < len(a): b.append(a[len(a) - 1 - i]) i = i + 1 a = b return a
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
334b0f61-5fa3-43cf-8691-29f975dd7270
2,016
21,895
def reverse(a): i = 0 while i < len(a): b.append(a[len(a) - 1 - i]) i = i + 1 a = b return a
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
334b0f61-5fa3-43cf-8691-29f975dd7270
2,016
2,873
def reverse(a): i = 0 while i < len(a): b.append(a[len(a) - 1 - i]) i = i + 1 a = b return a
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
334b0f61-5fa3-43cf-8691-29f975dd7270
2,016
29,776
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def find_position_of_smallest(a, i): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j = j + 1 return p def sort(a): i = 0 while i < len(a): p = find_position_of_smallest(a, i) swap(a, p, i) i = i + 1
sort
sort
Sort a list by repeatedly moving the minimimum of the remaining sublist to the front.
assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None
true
b8415cb6-c612-4985-9211-908831b3834e
2,016
30,323
def reverse(a): a = a[::-1] return a
reverse_iter
reverse
Iteratively reverse a list of elements.
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
true
b8415cb6-c612-4985-9211-908831b3834e
2,016
30,760
def reverse(a): a = a[::-1] return a
reverse_iter
reverse
Iteratively reverse a list of elements.
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
true
b8415cb6-c612-4985-9211-908831b3834e
2,016
34,171
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def find_position_of_smallest(a, i): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j = j + 1 return p def sort(a): i = 0 while i < len(a): p = find_position_of_smallest(a, i) swap(a, p, i) i = i + 1
sort
sort
Sort a list by repeatedly moving the minimimum of the remaining sublist to the front.
assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None
true
b8415cb6-c612-4985-9211-908831b3834e
2,016
5,782
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def find_position_of_smallest(a, i): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j = j + 1 return p def sort(a): i = 0 while i < len(a): p = find_position_of_smallest(a, i) swap(a, p, i) i = i + 1
sort
sort
Sort a list by repeatedly moving the minimimum of the remaining sublist to the front.
assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None
true
b8415cb6-c612-4985-9211-908831b3834e
2,016
1,099
def find_position_of_smallest(a, i): j = i while i < len(a): if a[i] < a[j]: j = i i = i + 1 return j def sort(a): i = 0 while i < len(a): k = find_position_of_smallest(a, i) swap(a, i, k) i = i + 1
sort
sort
Sort a list by repeatedly moving the minimimum of the remaining sublist to the front.
assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None
false
6618fe7e-6fd3-499b-a742-8d68ec712ad3
2,016
2,852
def find_position_of_smallest(a, i): j = i while i < len(a): if a[i] < a[j]: j = i i = i + 1 return j def sort(a): i = 0 while i < len(a): k = find_position_of_smallest(a, i) swap(a, i, k) i = i + 1
sort
sort
Sort a list by repeatedly moving the minimimum of the remaining sublist to the front.
assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None
false
6618fe7e-6fd3-499b-a742-8d68ec712ad3
2,016
18,108
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 while i < len(a) / 2: swap(a, i, len(a) - 1 - i) i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
0d8d49aa-e213-4ab4-bcc1-440a0397585c
2,016
34,408
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 while i < len(a) / 2: swap(a, i, len(a) - 1 - i) i += 1
reverse_by_swap
reverse
Reverse a list of elements by swapping its elements.
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
false
0d8d49aa-e213-4ab4-bcc1-440a0397585c
2,016
35,039
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + (high - low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
2,016
11,405
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + (high - low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
2,016
2,841
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + (high - low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
2,016
10,005
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + (high - low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
2,016
22,764
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + (high - low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
2,016
19,465
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + (high - low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
2,016
29,736
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
6bdfefac-1fa3-44c6-b066-9e1536e0210e
2,016
36,725
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7d992268-b79a-4106-8fbb-4f53742d117d
2,016
23,239
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7d992268-b79a-4106-8fbb-4f53742d117d
2,016
21,374
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7d992268-b79a-4106-8fbb-4f53742d117d
2,016
42,357
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7d992268-b79a-4106-8fbb-4f53742d117d
2,016
16,900
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7d992268-b79a-4106-8fbb-4f53742d117d
2,016
4,064
def bsearch(a, q): lo = 0 hi = len(a) while lo < hi: mid = (lo + hi) / 2 if a[mid] < q: lo = mid + 1 else: hi = mid return lo
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
a8d7ba55-2066-48ff-a791-991413f703dc
2,016
6,481
def bsearch(a, q): lo = 0 hi = len(a) while lo < hi: mid = (lo + hi) / 2 if a[mid] < q: lo = mid + 1 else: hi = mid return lo
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
a8d7ba55-2066-48ff-a791-991413f703dc
2,016
1,141
def bsearch(a, q): low = 0 high = len(a) while high != low: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid print(low)
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
bda058db-eb82-407a-b3b2-8f24355f1fa5
2,016
7,626
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
8d21baf9-a7ac-4132-92e0-a1002f0c04a9
2,016
15,850
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
8d21baf9-a7ac-4132-92e0-a1002f0c04a9
2,016
12,032
def bsearch(a, q): low = 0 high = len(a) while high != low: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
bda058db-eb82-407a-b3b2-8f24355f1fa5
2,016
25,273
def bsearch(a, q): low = 0 high = len(a) while high != low: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
bda058db-eb82-407a-b3b2-8f24355f1fa5
2,016
38,519
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
9f673df6-fcfd-4d07-b0dd-1f553c38f25b
2,016
40,618
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (high + low) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
9f673df6-fcfd-4d07-b0dd-1f553c38f25b
2,016
3,355
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
dcc424e7-96ab-4451-ad16-597d84c13c2e
2,016
16,050
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 assert low == 0 or a[low - 1] < q else: high = mid assert high == len(a) or q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
dcc424e7-96ab-4451-ad16-597d84c13c2e
2,016
26,626
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if a[mid] < q: low = mid + 1 assert low == 0 or a[low - 1] < q else: high = mid assert high == len(a) or q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
dcc424e7-96ab-4451-ad16-597d84c13c2e
2,016
3,120
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if a[mid] < q: low = mid + 1 assert low == 0 or a[low - 1] < q else: high = mid assert high == len(a) or q <= a[high] return mid
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
dcc424e7-96ab-4451-ad16-597d84c13c2e
2,016
41,772
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
dcc424e7-96ab-4451-ad16-597d84c13c2e
2,016
11,204
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
dcc424e7-96ab-4451-ad16-597d84c13c2e
2,016
4,681
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7c3b55b1-74b7-4570-8484-5a4354d497aa
2,016
35,087
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7c3b55b1-74b7-4570-8484-5a4354d497aa
2,016
9,413
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + high / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
104b03f1-1241-495d-996a-ba8f4a26b8bc
2,016
37,078
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
6bdfefac-1fa3-44c6-b066-9e1536e0210e
2,016
17,943
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = low + high / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
104b03f1-1241-495d-996a-ba8f4a26b8bc
2,016
25,012
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
104b03f1-1241-495d-996a-ba8f4a26b8bc
2,016
41,857
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
104b03f1-1241-495d-996a-ba8f4a26b8bc
2,016
38,654
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if q > a[mid]: assert a[low - 1] < q low = mid + 1 else: high = mid assert q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
f4380e0a-3bfd-44c6-b455-fe1018a45321
2,016
24,873
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
6bdfefac-1fa3-44c6-b066-9e1536e0210e
2,016
9,179
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
6bdfefac-1fa3-44c6-b066-9e1536e0210e
2,016
28,008
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
a998fa29-b3b1-437f-9555-da670b1ae43b
2,016
23,371
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
a998fa29-b3b1-437f-9555-da670b1ae43b
2,016
18,062
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if q > a[mid]: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
f4380e0a-3bfd-44c6-b455-fe1018a45321
2,016
34,200
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if q > a[mid]: assert a[low - 1] < q low = mid + 1 else: high = mid assert q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
f4380e0a-3bfd-44c6-b455-fe1018a45321
2,016
38,838
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
156114dd-8a1c-4e95-a7b3-fb54488e2dcf
2,016
25,482
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
156114dd-8a1c-4e95-a7b3-fb54488e2dcf
2,016
24,344
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
539a3d07-c706-42ed-bbbe-db66980d170f
2,016
18,810
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
539a3d07-c706-42ed-bbbe-db66980d170f
2,016
8,812
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7eb02a08-e561-4e33-a415-6df6cc4ff4a9
2,016
5,026
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
7eb02a08-e561-4e33-a415-6df6cc4ff4a9
2,016
512
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
9dea5530-0f82-4127-b25f-20c784224a03
2,016
26,955
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
9dea5530-0f82-4127-b25f-20c784224a03
2,016
12,236
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if q > a[mid]: low = mid + 1 assert a[low - 1] < q else: high = mid assert q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
f4380e0a-3bfd-44c6-b455-fe1018a45321
2,016
19,057
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if q > a[mid]: low = mid + 1 assert a[low - 1] < q else: high = mid assert q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
f4380e0a-3bfd-44c6-b455-fe1018a45321
2,016
27,557
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
85db1d22-a87d-4132-bd9a-e07bf9282015
2,016
38,976
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
85db1d22-a87d-4132-bd9a-e07bf9282015
2,016
25,192
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
75fca52d-a61c-4d91-946c-d376c5569767
2,016
10,998
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
75fca52d-a61c-4d91-946c-d376c5569767
2,016
7,580
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
0412928d-97c6-46f2-980b-7d98214b9765
2,016
22,311
def bsearch(a, q): low = 0 high = len(a) while low != high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid print(low)
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
bb523aa9-260c-45a0-8676-45ed3ab261ee
2,016
13,072
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
0412928d-97c6-46f2-980b-7d98214b9765
2,016
36,596
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
0412928d-97c6-46f2-980b-7d98214b9765
2,016
31,274
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
1e76a94c-89e1-4ef2-b3bb-9e98e7be1a2c
2,016
26,187
def bsearch(a, q): high = len(a) low = 0 while low < high: mid = (low + high) / 2 if a[mid] < p: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
b799d072-e18e-40e6-96cb-77c78c9e2a0f
2,016
13,349
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
1e76a94c-89e1-4ef2-b3bb-9e98e7be1a2c
2,016
7,465
def bsearch(a, q): high = len(a) low = 0 while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
b799d072-e18e-40e6-96cb-77c78c9e2a0f
2,016
41,495
def bsearch(a, q): low = 0 high = len(a) while low != high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid assert low == 0 or a[low - 1] < q assert high == len(a) or q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
bb62ca90-d7ec-42bb-b255-0f55492691ea
2,016
9,008
def bsearch(a, q): low = 0 high = len(a) while low != high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid assert low == 0 or a[low - 1] < q assert high == len(a) or q <= a[high] return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
bb62ca90-d7ec-42bb-b255-0f55492691ea
2,016
6,355
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
60b76a41-ddf8-4d27-a286-8da8c4e298cd
2,016
996
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
60b76a41-ddf8-4d27-a286-8da8c4e298cd
2,016
7,016
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
142cacda-ba1b-469c-9b25-8603a78324c9
2,016
20,369
def bsearch(a, q): low = 0 high = len(a) assert low == 0 or a[low - 1] < q assert high == len(a) or q <= a[high] while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
1e76a94c-89e1-4ef2-b3bb-9e98e7be1a2c
2,016
22,267
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
d86203fa-9e1b-4fc0-a3a6-b40a78065d80
2,016
1,459
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid and mid < high if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
d86203fa-9e1b-4fc0-a3a6-b40a78065d80
2,016
276
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
1e76a94c-89e1-4ef2-b3bb-9e98e7be1a2c
2,016
8,492
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
1e76a94c-89e1-4ef2-b3bb-9e98e7be1a2c
2,016
7,457
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid + 1 else: high = mid return low
bsearch
bsearch
Search for element q in the sorted array a.
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
false
3f0a2ff2-f068-43e9-9a21-42850d31b8d3
2,016