start
stringlengths 5
368
| code
stringlengths 5
143
| end
stringlengths 5
527
|
---|---|---|
x = 2; z = {4} | z.add(x // 2) | x = 2; z = {1, 4} |
b = [1, 8, 28, 56, 70, 56, 28]; d = [1, 7, 21, 35, 35, 21, 7, 1]; i = 7 | b += [(d[i - 1] + d[i]) % 10 ** 9] | b = [1, 8, 28, 56, 70, 56, 28, 8]; d = [1, 7, 21, 35, 35, 21, 7, 1]; i = 7 |
l = '4'; n = [[2, 3], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]; x = 1 | n[x][0] = int(l) | l = '4'; n = [[2, 3], [4, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]; x = 1 |
c = '12'; m = 3 | c += str(m) | c = '123'; m = 3 |
i = 0; s = 'aabbcd'; y = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | y[ord(s[i]) - ord('a')] += 1 | i = 0; s = 'aabbcd'; y = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
z = 1 | z = float(z) | z = 1.0 |
w = 'a' | v[w] = 0 | v = {'a': 0}; w = 'a' |
l = 'Y'; t = 30; y = {'X': 3, 'Y': 4}; z = 1 | t += z * y[l] | l = 'Y'; t = 34; y = {'X': 3, 'Y': 4}; z = 1 |
j = [0, 0, 0, 0] | j.append(0) | j = [0, 0, 0, 0, 0] |
c = 'hae and vi'; s = 'haveaniceday'; w = 10 | c += s[w] | c = 'hae and via'; s = 'haveaniceday'; w = 10 |
b = ['3', '3'] | p = int(b[1]) | b = ['3', '3']; p = 3 |
i = 0; n = [2, 2]; u = [1] | n.append(u[i]) | i = 0; n = [2, 2, 1]; u = [1] |
f = 4; v = 5 | j = v - f | f = 4; j = 1; v = 5 |
i = 1; r = [1, 2, 3]; x = 1; y = 2 | x, y = r[i:i + 2] | i = 1; r = [1, 2, 3]; x = 2; y = 3 |
e = ['{', '{', '[', '[', '(']; l = '(' | e.append(l) | e = ['{', '{', '[', '[', '(', '(']; l = '(' |
p = ['e', 'd', 'e', 'd', 'd', 'e', 'e', 'd', 'e', 'd', 'e']; t = ['d', 'e', 'd', 'e', 'e', 'd', 'd', 'e', 'd', 'e', 'e'] | t = p.copy() | p = ['e', 'd', 'e', 'd', 'd', 'e', 'e', 'd', 'e', 'd', 'e']; t = ['e', 'd', 'e', 'd', 'd', 'e', 'e', 'd', 'e', 'd', 'e'] |
j = 2; p = 0; q = [1, 1, 3, 5, 4] | q[p + 1] = j | j = 2; p = 0; q = [1, 2, 3, 5, 4] |
i = 1, 1001; r = 2, 1000 | i = r | i = (2, 1000); r = (2, 1000) |
k = 3; p = 2 | p = p - k | k = 3; p = -1 |
h = [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; i = 2; v = [2, 3, 4, 2, 3, 6, 8, 4, 5] | h[v[i]] += 1 | h = [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; i = 2; v = [2, 3, 4, 2, 3, 6, 8, 4, 5] |
u = 'g'; y = {'e': 2, 'g': 2} | y[u] += 1 | u = 'g'; y = {'e': 2, 'g': 3} |
i = 1; k = 2; n = 6; v = 113 | d = v >> n + k - 2 - i & 1 | d = 1; i = 1; k = 2; n = 6; v = 113 |
b = []; e = 1 | b.append(e) | b = [1]; e = 1 |
g = ['A', 'B', 'A']; q = 'B' | g.append(q) | g = ['A', 'B', 'A', 'B']; q = 'B' |
n = 5; s = [4, 3]; t = [1, 1, 2, 2, 3, 2, 2, 0] | t[7] = min(n - s[0], s[1] - 1) | n = 5; s = [4, 3]; t = [1, 1, 2, 2, 3, 2, 2, 1] |
a = 2; i = 3; l = [1, 1, 1] | l.insert(i, a) | a = 2; i = 3; l = [1, 1, 1, 2] |
s = [5, 2, 1, 8] | s.sort() | s = [1, 2, 5, 8] |
a = [1, 2, 3, 4]; e = -2; i = 2; j = 2; k = 2; n = 4; p = [[0, inf, inf, inf, inf], [-2, -2, inf, inf, inf], [-6, -2, -6, inf, inf], [-12, -2, -2, inf, inf], [inf, inf, inf, inf, inf]] | e = p[i][j] + a[i] * (i - j - (n - k - (i - j))) | a = [1, 2, 3, 4]; e = -12; i = 2; j = 2; k = 2; n = 4; p = [[0, inf, inf, inf, inf], [-2, -2, inf, inf, inf], [-6, -2, -6, inf, inf], [-12, -2, -2, inf, inf], [inf, inf, inf, inf, inf]] |
p = 3; t = 3 | p = t | p = 3; t = 3 |
n = 12 | d = [str(x) for x in range(1, int(n / 2) + 1) if n % x == 0] | d = []; n = False |
h = 'middle-Outz'; i = 0 | a = ord(h[i]) | a = 109; h = 'middle-Outz'; i = 0 |
g = ['sort']; x = [5, 10, 9, 1] | getattr(x, g[0])() | g = ['sort']; x = [1, 5, 9, 10] |
n = 6; r = 5 | c = n - r | c = 1; n = 6; r = 5 |
z = [1, 42] | t = int(z[0]) | t = 1; z = [1, 42] |
a = 'b'; v = ['a', 'ab', 'abb', 'aabb', 'b', 'bb', 'abb'] | v.append(a) | a = 'b'; v = ['a', 'ab', 'abb', 'aabb', 'b', 'bb', 'abb', 'b'] |
m = 2; z = 2 | m = z * 2 | m = 4; z = 2 |
o = 2; x = -1 | o = max(x, o + x) | o = 1; x = -1 |
a = 3; l = 4 | a = l | a = 4; l = 4 |
i = 'Q'; x = {'D': 2, 'F': 1} | x.update({i: 1}) | i = 'Q'; x = {'D': 2, 'F': 1, 'Q': 1} |
j = 5; k = [1, 3, 4, 5, 6, 2] | k[j] = k[j - 1] | j = 5; k = [1, 3, 4, 5, 6, 6] |
d = 'hACKERrANK.COM PRES'; x = 'e' | d = d + x.upper() | d = 'hACKERrANK.COM PRESE'; x = 'e' |
g = 2; p = 2 | p = preprev + g | g = 2; m = 86; p = 88 |
c = [3, 2, 3, 1]; j = 3 | c[j] += 1 | c = [3, 2, 3, 2]; j = 3 |
i = 2; j = 1; r = [['T', 's', 'i'], ['h', '%', 'x'], ['i', ' ', '#'], ['$', 'a', ' '], [ '#', 't', '%'], ['i', 'r', '!']]; x = 'This$#is%' | x += r[i][j] | i = 2; j = 1; r = [['T', 's', 'i'], ['h', '%', 'x'], ['i', ' ', '#'], ['$', 'a', ' '], ['#', 't', '%'], ['i', 'r', '!']]; x = 'This$#is% ' |
j = 4; l = '\naeiouuoiea'; q = {'\n': 0, 'a': 1, 'e': 2, 'i': 2, 'o': 1, 'u': 0} | q[l[j]] += 1 | j = 4; l = '\naeiouuoiea'; q = {'\n': 0, 'a': 1, 'e': 2, 'i': 2, 'o': 2, 'u': 0} |
i = [2, 1]; j = 1 | i[j] = i[j] + 1 | i = [2, 2]; j = 1 |
i = 2 | e = i | e = 2; i = 2 |
r = '100' | a = len(r) | a = 3; r = '100' |
a = ['0', '0', '0', '0', '1', '0', '1', '1']; i = 6 | a[i] = '0' | a = ['0', '0', '0', '0', '1', '0', '0', '1']; i = 6 |
r = 1000000007; t = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | t.append((t[-1] + t[-2]) % r) | r = 1000000007; t = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144] |
i = 2; n = [0, 1, 1, 2, 5] | n.append(n[i + 2]) | i = 2; n = [0, 1, 1, 2, 5, 5] |
m = [3, 4, 21, 36, 10, 28, 35, 5, 24, 42] | s = m[0] | m = [3, 4, 21, 36, 10, 28, 35, 5, 24, 42]; s = 3 |
a = 1; p = 7 | p = a + (p - a) % 5 | a = 1; p = 2 |
d = [20, 7, 8, 2, 5]; f = 7; i = 2 | f = int(d[i]) | d = [20, 7, 8, 2, 5]; f = 8; i = 2 |
i = 4; k = ''; s = '999100010001' | k = s[i + 1:] | i = 4; k = '0010001'; s = '999100010001' |
a = 4; p = 1000; s = '99910001001'; x = 3; z = 4 | p = int(s[x + z:x + z + a]) | a = 4; p = 1001; s = '99910001001'; x = 3; z = 4 |
a = 6; x = 14 | a = x % 8 | a = 6; x = 14 |
i = 2; r = [[1, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] | r[0][i] = 1 | i = 2; r = [[1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] |
d = 4; x = [1, 2, 3, 21, '7', '12', '14', '21'] | x[d] = int(x[d]) | d = 4; x = [1, 2, 3, 21, 7, '12', '14', '21'] |
i = 'c'; j = {'c': 2, 'd': 1} | c += j[i] - 1 | c = -47; i = 'c'; j = {'c': 2, 'd': 1} |
n = 'fi'; s = ['a', 'f'] | n = ''.join(s) | n = 'af'; s = ['a', 'f'] |
j = 4; l = 2; m = '992299' | l = int(m[j]) | j = 4; l = 9; m = '992299' |
a = {'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1, 'h': 2}; c = 'g' | a[c] += 1 | a = {'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 2, 'h': 2}; c = 'g' |
p = 2 | p -= 1 | p = 1 |
c = 1.7763568394002505e-14 | c /= 2 | c = 8.881784197001252e-15 |
g = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 2, 2], [0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; i = 3; j = 4 | g[i][j] = max(g[i - 1][j], g[i][j - 1]) | g = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 2, 2], [0, 1, 1, 0, 2, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; i = 3; j = 4 |
d = {'a': 0, 'b': 0}; i = 'c' | d[i] = 0 | d = {'a': 0, 'b': 0, 'c': 0}; i = 'c' |
d = 2.0971520000000002e-15; e = 5; w = 1.0485760000000001e-14 | w -= e * d | d = 2.0971520000000002e-15; e = 5; w = 0.0 |
c = [1]; n = 1 | c.append(n % 2) | c = [1, 1]; n = 1 |
p = ['a', 'b', 'c']; t = 'd' | p.append(t) | p = ['a', 'b', 'c', 'd']; t = 'd' |
f = '[A-Z]'; p = '[A-Z]' | f = p | f = '[A-Z]'; p = '[A-Z]' |
n = [2, 3] | s = n | n = [2, 3]; s = [2, 3] |
a = [[1, 3, 4], [2, 2, 3], [1, 2, 4]]; d = 6; i = 2; j = 2 | d += 2 * min(a[i][j - 1], a[i][j]) | a = [[1, 3, 4], [2, 2, 3], [1, 2, 4]]; d = 10; i = 2; j = 2 |
c = 'okffn'; l = 'g' | c += l | c = 'okffng'; l = 'g' |
f = 3; n = 10 | y = n % f | f = 3; n = 10; y = 1 |
k = '549043809916080'; y = ['400453592126560', '114213133098692', '474386082879648', '075975207693780', '511799789562806', '404007454272504'] | y.append(k) | k = '549043809916080'; y = ['400453592126560', '114213133098692', '474386082879648', '075975207693780', '511799789562806', '404007454272504', '549043809916080'] |
y = Counter({(2): 5, (1): 4}) | j = max(y.keys()) | j = 2; y = Counter({2: 5, 1: 4}) |
q = [5, 3, 2] | u = q.index(max(q)) | q = [5, 3, 2]; u = 0 |
s = 4; x = [True, True, True, True, False, False] | x[s] = True | s = 4; x = [True, True, True, True, True, False] |
s = 'aaabbbbcccddd' | v = ord(s[index]) - 96 | b = 6; s = 'aaabbbbcccddd'; v = 2 |
f = 0; u = 3.333333333333333 | f += u | f = 3.333333333333333; u = 3.333333333333333 |
f = ['a', 'b', 'b', 'a']; i = 2; j = 0; s = 'abba' | f.append(''.join(sorted(s[j:j + i]))) | f = ['a', 'b', 'b', 'a', 'ab']; i = 2; j = 0; s = 'abba' |
d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | d = d + [0] | d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
h = [(0, '-'), (6, '-'), (0, '-'), (6, '-'), (4, '-'), (2, 'not'), (4, 'is' ), (2, 'to'), (4, 'the')]; i = 2; s = [[(0, '-')], [], [], [], [], [], [(1, '-')], [], [], [], [], [], [], [], [], [], [], [], [], []] | s[h[i][0]].append((i, h[i][1])) | h = [(0, '-'), (6, '-'), (0, '-'), (6, '-'), (4, '-'), (2, 'not'), (4, 'is'), (2, 'to'), (4, 'the')]; i = 2; s = [[(0, '-'), (2, '-')], [], [], [], [], [], [(1, '-')], [], [], [], [], [], [], [], [], [], [], [], [], []] |
n = [-1.0, -2.0, 3.0]; w = [1.0, 3.0, 1.0] | x = [w[1] * n[2] - w[2] * n[1], w[2] * n[0] - w[0] * n[2], w[0] * n[1] - w[ 1] * n[0]] | n = [-1.0, -2.0, 3.0]; w = [1.0, 3.0, 1.0]; x = [11.0, -4.0, 1.0] |
s = 'aba' | k = len(s) | k = 3; s = 'aba' |
b = [2, 3, 5, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 16, 17, 18]; i = 19 | b.append(i) | b = [2, 3, 5, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 16, 17, 18, 19]; i = 19 |
b = [4, 3, 3, 4]; i = 0; p = 3; x = 3 | b[i + x] = p | b = [4, 3, 3, 3]; i = 0; p = 3; x = 3 |
b = [16, 32, 96] | d = sorted(b) | b = [16, 32, 96]; d = [16, 32, 96] |
c = [1, 2, 2]; j = 0; o = [1, 1] | o += c[j:] | c = [1, 2, 2]; j = 0; o = [1, 1, 1, 2, 2] |
h = 6; l = 3; x = [0, 1, 2, 3, 4, 5, 6] | h = x[l] | h = 3; l = 3; x = [0, 1, 2, 3, 4, 5, 6] |
c = 5; i = 5; n = 5 | c = c * (n + 1 - i) // i | c = 1; i = 5; n = 5 |
a = [3, 4, 1]; i = 3; z = [(55.0, 3), (59.0, 4), (81.0, 1), (89.0, 5), (99.0, 2)] | a.append(z[i][1]) | a = [3, 4, 1, 5]; i = 3; z = [(55.0, 3), (59.0, 4), (81.0, 1), (89.0, 5), (99.0, 2)] |
x = '1111110111100000' | x += '1' | x = '11111101111000001' |
y = 5 | y -= 1 | y = 4 |
e = [[100, 1]]; x = 200; y = 2 | e.append([x, y]) | e = [[100, 1], [200, 2]]; x = 200; y = 2 |
o = [1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2]; x = 1; y = 2 | o.append(abs(x - y)) | o = [1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1]; x = 1; y = 2 |
i = 53; w = 2 | i += w | i = 55; w = 2 |
a = 74; j = 10 | a += j ** 2 | a = 174; j = 10 |
i = 0; j = 0; x = '17' | j = len(x) - i - 1 | i = 0; j = 1; x = '17' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.