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
22,596
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 if a[mid] < q: low = mid assert low == 0 or a[low - 1] < q else: high = mid assert high == len(a) or q <= a[high] return 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
d0bbdcdf-7e56-44f5-b27d-7b9822c0a1d6
2,016
37,755
def bsearch(a, q): low = 0 high = len(a) while low < high: middle = (low + high) / 2 if a[middle] < q: low = middle + 1 assert low == 0 or a[low - 1] < q else: high = middle 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
54e7d279-e8ef-49c1-8aea-de3ac0b230cf
2,016
31,027
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: low = mid + 1 assert a[low - 1] < q or low == 0 else: high = mid assert q <= a[high] or high == len(a) 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
1d4a4b3b-be4e-49dc-96cc-fceb60ad22a1
2,016
22,475
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: low = mid + 1 assert a[low - 1] < q or low == 0 else: high = mid assert q <= a[high] or high == len(a) 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
1d4a4b3b-be4e-49dc-96cc-fceb60ad22a1
2,016
8,964
def bsearch(a, q): low = 0 high = len(a) while low < high: middle = (low + high) / 2 if a[middle] < q: low = middle + 1 else: high = middle 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
54e7d279-e8ef-49c1-8aea-de3ac0b230cf
2,016
28,110
def bsearch(a, q): low = 0 high = len(a) while low < high: middle = (low + high) / 2 if a[middle] < q: low = middle + 1 else: high = middle 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
54e7d279-e8ef-49c1-8aea-de3ac0b230cf
2,016
33,602
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 a[low - 1] < q elif a[mid] == q: return mid 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
05bc0114-9d34-4210-bb9b-07af403e11ed
2,016
36,233
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 a[low - 1] < q elif a[mid] == q: return mid 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
05bc0114-9d34-4210-bb9b-07af403e11ed
2,016
20,665
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
20,563
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
26,777
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 a[low - 1] < q elif a[mid] == q: return mid else: high = mid assert q <= a[high] 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
05bc0114-9d34-4210-bb9b-07af403e11ed
2,016
31,409
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 a[low - 1] < q else: high = mid assert q <= a[high] 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
05bc0114-9d34-4210-bb9b-07af403e11ed
2,016
12,314
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 a[low - 1] < q else: high = mid assert q <= a[high] 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
05bc0114-9d34-4210-bb9b-07af403e11ed
2,016
35,170
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
d0bbdcdf-7e56-44f5-b27d-7b9822c0a1d6
2,016
13,364
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
d0bbdcdf-7e56-44f5-b27d-7b9822c0a1d6
2,016
20,744
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
40,065
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 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
03ce4b42-26f0-456c-9d48-18c0d16bec55
2,016
31,440
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 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
03ce4b42-26f0-456c-9d48-18c0d16bec55
2,016
6,683
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= 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
587649dc-83bf-4c24-bb43-de304405f3b9
2,016
41,360
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= 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
587649dc-83bf-4c24-bb43-de304405f3b9
2,016
32,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
50aef720-52de-4735-8874-78f5a311b939
2,016
41,391
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
50aef720-52de-4735-8874-78f5a311b939
2,016
31,512
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
7,046
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
37,933
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
f15a871d-61c5-494f-8886-91e213b59201
2,016
3,893
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
f15a871d-61c5-494f-8886-91e213b59201
2,016
901
def bsearch(a, q): low = 0 high = len(a) while high != low: search = (high + low) / 2 if a[search] == q: return True elif a[search] > q: high = search else: low = search if low == search: low += 1 return False
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
dd2b828e-e813-417d-b910-df48d2f89ccc
2,016
32,045
def bsearch(a, q): low = 0 high = len(a) while high != low: search = (high + low) / 2 if a[search] == q: return search elif a[search] > q: high = search else: low = search if low == search: low += 1 return search
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
dd2b828e-e813-417d-b910-df48d2f89ccc
2,016
18,329
def bsearch(a, q): low = 0 high = len(a) search = (high + low) / 2 while high != low and a[search] != q: search = (high + low) / 2 if a[search] > q: high = search else: low = search if low == search: low += 1 return search
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
dd2b828e-e813-417d-b910-df48d2f89ccc
2,016
18,328
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
0964a543-93db-460b-a0c5-d0c94fea250f
2,016
26,881
def bsearch(a, q): low = 0 high = len(a) while high != low: search = (high + low) / 2 if a[search] == q and a[search - 1] != q: return search elif a[search] > q: high = search else: low = search if low == search: low += 1 return search
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
dd2b828e-e813-417d-b910-df48d2f89ccc
2,016
22,449
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
05bf8435-64be-48cb-be81-139956827989
2,016
10,810
def bsearch(a, q): low = 0 high = len(a) while low < high: search = (high + low) / 2 assert low <= search < high if a[search] < q: low = search + 1 assert a[low - 1] < q else: high = search 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
dd2b828e-e813-417d-b910-df48d2f89ccc
2,016
10,331
def bsearch(a, q): low = 0 high = len(a) while low < high: search = (high + low) / 2 assert low <= search < high if a[search] < q: low = search + 1 assert a[low - 1] < q else: high = search 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
dd2b828e-e813-417d-b910-df48d2f89ccc
2,016
32,890
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
05bf8435-64be-48cb-be81-139956827989
2,016
6,963
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
05bf8435-64be-48cb-be81-139956827989
2,016
18,419
def intersection(a, b): seen = {} appended = {} c = [] i = 0 while i < len(a): seen[a[i]] = True i = i + 1 i = 0 while i < len(b): if b[i] in seen and b[i] not in appended: c.append(b[i]) appended[b[i]] = True i = i + 1 return c
intersection
intersection
Return the intersection between two lists.
assert intersection([],[])==[] and intersection([20052, 20052, -9991],[102, 20052, -9991])==[20052, -9991] and intersection([38908273694008580353068229963801163341, 59, 38908273694008580353068229963801163341, -38, 28239, -2723, 24559, -5794],[38908273694008580353068229963801163341, 59, 38908273694008580353068229963801163341, -38, 28239, -2723, 24559, -5794])==[38908273694008580353068229963801163341, 59, -38, 28239, -2723, 24559, -5794]
true
b588e248-0a0b-40c1-ad90-f9fc1d050dd0
2,016
4,021
def union(a, b): a = a + b seen = {} c = [] i = 0 while i < len(a): if a[i] not in seen: c.append(a[i]) seen[a[i]] = True i = i + 1 return c
union
union
Merge two lists into a single one.
assert union([],[])==[] and union([25785],[25785])==[25785] and union([-90, 21135, 29310, -8059, 7114, -90, -5808, 1333, -18691, 7, -19450, 67745575129021321678860432754396203799, -9288, -161403197171354040520992237328119268342, 49, 120528818203287557, 133011337445419463191476642795673848676, 11952, 11996],[5, -9316, 7379237229304681733])==[-90, 21135, 29310, -8059, 7114, -5808, 1333, -18691, 7, -19450, 67745575129021321678860432754396203799, -9288, -161403197171354040520992237328119268342, 49, 120528818203287557, 133011337445419463191476642795673848676, 11952, 11996, 5, -9316, 7379237229304681733]
true
b588e248-0a0b-40c1-ad90-f9fc1d050dd0
2,016
34,098
def union(a, b): a = a + b seen = {} c = [] i = 0 while i < len(a): if a[i] not in seen: c.append(a[i]) seen[a[i]] = True i = i + 1 return c
union
union
Merge two lists into a single one.
assert union([],[])==[] and union([25785],[25785])==[25785] and union([-90, 21135, 29310, -8059, 7114, -90, -5808, 1333, -18691, 7, -19450, 67745575129021321678860432754396203799, -9288, -161403197171354040520992237328119268342, 49, 120528818203287557, 133011337445419463191476642795673848676, 11952, 11996],[5, -9316, 7379237229304681733])==[-90, 21135, 29310, -8059, 7114, -5808, 1333, -18691, 7, -19450, 67745575129021321678860432754396203799, -9288, -161403197171354040520992237328119268342, 49, 120528818203287557, 133011337445419463191476642795673848676, 11952, 11996, 5, -9316, 7379237229304681733]
true
b588e248-0a0b-40c1-ad90-f9fc1d050dd0
2,016
19,594
def intersection(a, b): seen = {} appended = {} c = [] i = 0 while i < len(a): seen[a[i]] = True i = i + 1 i = 0 while i < len(b): if b[i] in seen and b[i] not in appended: c.append(b[i]) appended[b[i]] = True i = i + 1 return c
intersection
intersection
Return the intersection between two lists.
assert intersection([],[])==[] and intersection([20052, 20052, -9991],[102, 20052, -9991])==[20052, -9991] and intersection([38908273694008580353068229963801163341, 59, 38908273694008580353068229963801163341, -38, 28239, -2723, 24559, -5794],[38908273694008580353068229963801163341, 59, 38908273694008580353068229963801163341, -38, 28239, -2723, 24559, -5794])==[38908273694008580353068229963801163341, 59, -38, 28239, -2723, 24559, -5794]
true
b588e248-0a0b-40c1-ad90-f9fc1d050dd0
2,016
39,368
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
334b0f61-5fa3-43cf-8691-29f975dd7270
2,016
14,097
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
334b0f61-5fa3-43cf-8691-29f975dd7270
2,016
40,653
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
0964a543-93db-460b-a0c5-d0c94fea250f
2,016
14,829
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
0964a543-93db-460b-a0c5-d0c94fea250f
2,016
3,393
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
0964a543-93db-460b-a0c5-d0c94fea250f
2,016
10,375
def walkback(a, q, i): while i > 1 and a[i - 1] == q: i -= 1 return i def bsearch(a, q): low = 0 high = len(a) while low < high: guess = low + (high - low) / 2 if a[guess] == q: return walkback(a, q, guess) elif a[guess] < q: low = guess + 1 else: high = guess - 1 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
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
23,915
def walkback(a, q, i): while i > 1 and a[i - 1] == q: i -= 1 return i def bsearch(a, q): low = 0 high = len(a) while low < high: guess = low + (high - low) // 2 if a[guess] == q: return walkback(a, q, guess) elif a[guess] < q: low = guess + 1 else: high = guess 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
true
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
41,336
def walkback(a, q, i): while i > 0 and a[i - 1] == q: i -= 1 return i def bsearch(a, q): low = 0 high = len(a) while low < high: guess = low + (high - low) // 2 if a[guess] == q: return walkback(a, q, guess) elif a[guess] < q: low = guess + 1 else: high = guess 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
true
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
26,553
def walkback(a, q, i): while i > 0 and a[i - 1] == q: i -= 1 return i def bsearch(a, q): low = 0 high = len(a) while low < high: guess = low + (high - low) // 2 if a[guess] == q: return walkback(a, q, guess) elif a[guess] < q: low = guess + 1 else: high = guess 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
true
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
253
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: low = mid + 1 assert a[low - 1] < a 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
0d8d49aa-e213-4ab4-bcc1-440a0397585c
2,016
6,317
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: low = mid + 1 assert a[low - 1] < a 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
0d8d49aa-e213-4ab4-bcc1-440a0397585c
2,016
20,434
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
f278f0d6-3389-497b-a30b-f0d8ecebb7e1
2,016
3,824
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
f278f0d6-3389-497b-a30b-f0d8ecebb7e1
2,016
35,842
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
f278f0d6-3389-497b-a30b-f0d8ecebb7e1
2,016
26,776
def double(n): n = n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
false
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
4,877
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
1,903
def circumference(r): return 2 * 3.141 * r
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
true
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
18,137
def area(r): return 3.141 * r ** 2
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
true
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
7,441
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
37,125
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
23,898
def area(r): return pi * r ** 2
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
28,307
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
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
26,901
def area(r): return pi * r ** 2
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
15,080
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
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
540
def reverse(a): i = 0 j = len(a) - 1 while i < len(a) / 2: tmp = a[i] a[i] = a[j] a[j] = tmp i = i + 1 j = j - 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
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
11,347
def reverse(a): i = 0 j = len(a) - 1 while i < len(a) / 2: tmp = a[i] a[i] = a[j] a[j] = tmp i = i + 1 j = j - 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
87fe2a11-c843-4db7-a092-fa2c47cf613f
2,016
35,750
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
86f3bfd9-abca-4a94-ac95-d257d354e3e5
2,016
4,193
def bsearch(a, q): low = 0 high = len(a) while low < high: mid = (low + high) / 2 assert low <= mid < high if a[mid] < q: 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
86f3bfd9-abca-4a94-ac95-d257d354e3e5
2,016
29,289
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
48db4273-a21e-41be-bca6-9b6444a15cbf
2,016
10,588
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
32a14d12-9054-46cd-aa7e-4bf97d33fa10
2,016
38,791
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
32a14d12-9054-46cd-aa7e-4bf97d33fa10
2,016
21,960
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
48db4273-a21e-41be-bca6-9b6444a15cbf
2,016
3,861
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
48db4273-a21e-41be-bca6-9b6444a15cbf
2,016
13,031
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
48db4273-a21e-41be-bca6-9b6444a15cbf
2,016
36,210
def reverse(a): a = a[::-1] 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]]
true
fc726678-a7a5-405b-bc49-844b42ef4a2b
2,016
24,632
def reverse(a): a = a[::-1] 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]]
true
fc726678-a7a5-405b-bc49-844b42ef4a2b
2,016
22,252
def double(n): return 2 * n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
23,534
def double(n): return 2 * n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
8,622
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 = j + 1 tmp = a[p] a[p] = a[i] a[i] = tmp i = 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
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
25,507
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 = j + 1 tmp = a[p] a[p] = a[i] a[i] = tmp i = 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
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
23,208
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return def reverse(a): return swap(a, 2, 3)
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
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
35,358
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return def reverse(a): return swap(a, 2, 3)
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
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
22,809
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return def reverse(a): return swap(a, 2, 3)
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
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
34,060
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return def reverse(a): return swap(a, 2, 3)
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
68f143f9-a076-4b95-afe1-e3828c2d0f4e
2,016
22,204
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return def reverse(a): i = 0 while i < len(a) / 2: swap(a, i, len(a) - 1 - i) 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
35d18426-1565-4cbc-afa0-82ff8cbc8cbd
2,016
8,809
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return def reverse(a): i = 0 while i < len(a) / 2: swap(a, i, len(a) - 1 - i) 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
35d18426-1565-4cbc-afa0-82ff8cbc8cbd
2,016
9,095
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp return a def reverse(a): i = 0 while i < len(a) / 2: swap(a, a[i], a[len(a) - i - 1]) 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
213d8254-d887-4b88-8234-2f2edbe536aa
2,016
5,185
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return a def reverse(a): i = 0 while i < len(a) / 2: swap(a, a[i], a[len(a) - i - 1]) 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
213d8254-d887-4b88-8234-2f2edbe536aa
2,016
25,428
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return a def reverse(a): i = 0 while i < len(a) / 2: j = len(a) - i - 1 swap(a, i, j) i = i + 1 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]]
true
213d8254-d887-4b88-8234-2f2edbe536aa
2,016
41,125
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp return a def reverse(a): i = 0 while i < len(a) / 2: j = len(a) - i - 1 swap(a, i, j) i = i + 1 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]]
true
213d8254-d887-4b88-8234-2f2edbe536aa
2,016
8,942
def selection_sort(a): i = 0 while i < len(a): j = i + 1 min_ind = i while j < len(a): if a[j] < a[min_ind]: min_ind = j j += 1 tmp = a[i] a[i] = a[min_ind] a[min_ind] = 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
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
35,216
def selection_sort(a): i = 0 while i < len(a): j = i + 1 min_ind = i while j < len(a): if a[j] < a[min_ind]: min_ind = j j += 1 tmp = a[i] a[i] = a[min_ind] a[min_ind] = 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
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
41,868
def selection_sort(a): i = 0 while i < len(a): j = i + 1 min_ind = i while j < len(a): if a[j] < a[min_ind]: min_ind = j j += 1 tmp = a[i] a[i] = a[min_ind] a[min_ind] = 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
733076ff-a42d-4d8b-82c9-5fbbffc0c400
2,016
10,551
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 = j + 1 tmp = a[p] a[p] = a[i] a[i] = tmp i = 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
35d18426-1565-4cbc-afa0-82ff8cbc8cbd
2,016
3,167
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 = j + 1 tmp = a[p] a[p] = a[i] a[i] = tmp i = 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
35d18426-1565-4cbc-afa0-82ff8cbc8cbd
2,016
11,533
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 = j + 1 tmp = a[p] a[p] = a[i] a[i] = tmp i = 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
35d18426-1565-4cbc-afa0-82ff8cbc8cbd
2,016
41,396
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
8,770
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
13,651
def area(r): return pi * r ** 2
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
12,337
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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016