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
3,776
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
29,198
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
1,877
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
836
def reverse(a): i = 0 while i < len(a): print(len(a) - i)
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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
28,000
def reverse(a): i = 0 while i < len(a): print(len(a) - 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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
24,882
def reverse(a): i = 0 while i < len(a): print(len(a) - 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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
10,894
def reverse(a): i = 1 while i < len(a): print(len(a) - 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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
32,589
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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
11,802
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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
20,110
def selection_sort(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 return a
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
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
22,304
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 return a
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]
true
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
16,723
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 return a
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]
true
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
26,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 = j + 1 tmp = a[p] a[p] = a[i] a[i] = tmp i = i + 1 return a
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]
true
6a72520c-4c39-4c03-b7cf-5550dbde3147
2,016
12,105
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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
26,158
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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
37,958
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
4a1f2726-b713-40f0-b544-9de55d617a12
2,016
21,305
def double(n): n = a * 2 return n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
false
c0d569cd-4374-4e65-8e98-e814031fb3ca
2,016
13,134
def double(n): a = n * 2 return a
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
c0d569cd-4374-4e65-8e98-e814031fb3ca
2,016
21,986
def double(n): a = n * 2 return a
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
c0d569cd-4374-4e65-8e98-e814031fb3ca
2,016
32,210
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp 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
c0d569cd-4374-4e65-8e98-e814031fb3ca
2,016
40,322
def swap(a, i, j): tmp = a[j] a[j] = a[i] a[i] = tmp 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
c0d569cd-4374-4e65-8e98-e814031fb3ca
2,016
10,962
def double(n): print(2 * n)
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
false
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
39,957
def double(n): return 2 * n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
20,797
def double(n): return 2 * n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
15,666
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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
24,254
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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
8,145
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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
26,632
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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
6,085
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 j = len(a) - 1 while i < len(a) / 2: swap(a, i, j) 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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
10,214
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def reverse(a): i = 0 j = len(a) - 1 while i < len(a) / 2: swap(a, i, j) 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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
568
def double(n): n = n * 2 return n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
22,387
def circumference(r): a = 2 * 3.141 * r return a
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
10,497
def area(r): r = r ** 2 a = 2 * 3.141 * r return a
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
14,113
def circumference(r): r = 2 * 3.141 * r return r
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
7,839
def area(r): r = r ** 2 r = 3.141 * r return r
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
9,784
def circumference(r): a = 2 * pi * r return a
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
25,376
def circumference(r): a = 2 * pi * r return a
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
32,189
def area(r): r = r ** 2 a = pi * r return a
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
10,796
def area(r): r = r ** 2 a = pi * r return a
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
1,775
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
36,280
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
30,825
def reverse(a, i): p = i j = i + 1 while j < len(a): if int(a[j]) > int(a[p]): p = j j = j + 1 return p
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
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
12,963
def reverse(a): p = i j = i + 1 while j < len(a): if int(a[j]) > int(a[p]): p = j j = j + 1 return p
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
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
1,496
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
13,703
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
3,411
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp 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 swap(a, i, p) 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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
21,366
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp 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 swap(a, i, p) 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
e0141b22-9477-459d-8e1c-18f5d5ef6624
2,016
5,494
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 = 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
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
15,253
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 = 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
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
10,942
def double(n): y = n * 2 return y
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
21,969
def double(n): y = n * 2 return y
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
29,703
def circumference(r): y = 2 * pi * r return y
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
9,698
def area(r): x = (pi * r) ** 2 return x
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
18,555
def area(r): x = pi * r ** 2 return x
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
18,763
def area(r): x = pi * r ** 2 return x
area
area
Return the area of a circle with the given coordinates.
assert area(0)==0.0 and area(-14329)==644910876.981
false
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
6,078
def circumference(r): y = 2 * pi * r return y
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
22,581
def circumference(r): y = 2 * pi * r return y
circumference
circumference
Return the circumference of a circle.
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
false
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
31,016
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) - i - 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
1,859
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) - i - 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
26,045
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: j = len(a) - i - 1 swap(a, i, j) 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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
3,930
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: j = len(a) - i - 1 swap(a, i, j) 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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
39,687
def selection_sort(a): i = 0 j = i + 1 while i < len(a): if a[j] < a[i]: tmp = a[j] a[j] = a[i] a[i] = tmp j = j + 1 i = i + 1 return a
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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
170
def selection_sort(a): i = 0 j = i + 1 while i < len(a): j = i + 1 while j < len(a): if a[j] < a[i]: tmp = a[j] a[j] = a[i] a[i] = tmp j = j + 1 i = i + 1 return a
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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
2,231
def selection_sort(a): i = 0 j = i + 1 while i < len(a): j = i + 1 while j < len(a): if a[j] < a[i]: tmp = a[j] a[j] = a[i] a[i] = tmp j = j + 1 i = i + 1 return a
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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
27,033
def selection_sort(a): i = 0 while i < len(a): j = i + 1 while j < len(a): if a[j] < a[i]: tmp = a[j] a[j] = a[i] a[i] = tmp j = j + 1 i = i + 1 return a
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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
25,534
def selection_sort(a): i = 0 while i < len(a): j = i + 1 while j < len(a): if a[j] < a[i]: tmp = a[j] a[j] = a[i] a[i] = tmp j = j + 1 i = i + 1 return a
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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
5,354
def selection_sort(a): i = 0 while i < len(a): j = i + 1 while j < len(a): if a[j] < a[i]: tmp = a[j] a[j] = a[i] a[i] = tmp j = j + 1 i = i + 1 return a
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
24b328b2-2b24-43bc-9468-d9ba1d7df521
2,016
10,282
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def selection_sort(a): i = 0 while i < len(a): p = i j = i + 1 while j < len(a): if a[p] < a[j]: j = p j = j + 1 i = i + 1 swap(a, i, p)
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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
7,068
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[p] < a[j]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): smallest_element(a, i) swap(a, i, j) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
29,981
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[p] < a[j]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): smallest_element(a, i) swap(a, i, j) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
174
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[p] < a[j]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): p = smallest_element(a, i) swap(a, i, j) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
41,676
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[p] < a[j]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): p = smallest_element(a, i) swap(a, i, j) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
32,771
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[p] < a[j]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): p = smallest_element(a, i) swap(a, i, p) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
39,126
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[p] < a[j]: j = p j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): p = smallest_element(a, i) swap(a, i, p) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
6,352
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): p = smallest_element(a, i) swap(a, i, p) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
35,226
def swap(a, i, j): tmp = a[i] a[i] = a[j] a[j] = tmp def smallest_element(a, i): p = i j = i + 1 while j < len(a): if a[j] < a[p]: p = j j = j + 1 return p def selection_sort(a): i = 0 while i < len(a): p = smallest_element(a, i) swap(a, i, p) 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
da1464fe-2ccb-4c4e-b174-962f2177debd
2,016
17,457
def double(n): n = n * 2 return n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
31,713
def double(n): n = n * 2 return n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
16,573
def double(n): n = n * 2 return n
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
e4dcdad8-3da9-41c5-bbd1-3df3433e270d
2,016
39,902
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
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016
13,369
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
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016
38,337
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
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016
11,771
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
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016
19,678
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016
305
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016
20,886
def double(n): return n * 2
double
double
Double a number or a string.
assert double(0)==0 and double(-7601)==-15202
true
8fca450a-2117-453b-8f1b-f55a98c9bdb9
2,016