user_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 1
value | submission_id_v0 stringlengths 10 10 | submission_id_v1 stringlengths 10 10 | cpu_time_v0 int64 10 38.3k | cpu_time_v1 int64 0 24.7k | memory_v0 int64 2.57k 1.02M | memory_v1 int64 2.57k 869k | status_v0 stringclasses 1
value | status_v1 stringclasses 1
value | improvement_frac float64 7.51 100 | input stringlengths 20 4.55k | target stringlengths 17 3.34k | code_v0_loc int64 1 148 | code_v1_loc int64 1 184 | code_v0_num_chars int64 13 4.55k | code_v1_num_chars int64 14 3.34k | code_v0_no_empty_lines stringlengths 21 6.88k | code_v1_no_empty_lines stringlengths 20 4.93k | code_same bool 1
class | relative_loc_diff_percent float64 0 79.8 | diff list | diff_only_import_comment bool 1
class | measured_runtime_v0 float64 0.01 4.45 | measured_runtime_v1 float64 0.01 4.31 | runtime_lift float64 0 359 | key list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u517910772 | p03805 | python | s423210976 | s993156111 | 68 | 28 | 4,328 | 3,064 | Accepted | Accepted | 58.82 | def abc054_c_one_stroke_paths():
import copy
N, M = list(map(int, input().split()))
# create graph G
G = {}
for m in range(M):
a, z = list(map(int, input().split()))
G[a] = G.get(a, [])
G[a].append(z)
G[z] = G.get(z, [])
G[z].append(a)
# pri... | def abc054_c_one_stroke_paths():
N, M = list(map(int, input().split()))
# create graph G
G = {}
for m in range(M):
a, z = list(map(int, input().split()))
G[a] = G.get(a, [])
G[a].append(z)
G[z] = G.get(z, [])
G[z].append(a)
# print(G)
# fi... | 41 | 38 | 823 | 746 | def abc054_c_one_stroke_paths():
import copy
N, M = list(map(int, input().split()))
# create graph G
G = {}
for m in range(M):
a, z = list(map(int, input().split()))
G[a] = G.get(a, [])
G[a].append(z)
G[z] = G.get(z, [])
G[z].append(a)
# print(G)
# fi... | def abc054_c_one_stroke_paths():
N, M = list(map(int, input().split()))
# create graph G
G = {}
for m in range(M):
a, z = list(map(int, input().split()))
G[a] = G.get(a, [])
G[a].append(z)
G[z] = G.get(z, [])
G[z].append(a)
# print(G)
# find all paths
... | false | 7.317073 | [
"- import copy",
"-",
"- paths = []",
"- def solve(a, path):",
"+ def dfs(a, path):",
"- paths.append(path)",
"- return",
"+ return 1",
"+ paths = 0",
"- p = copy.copy(path)",
"- if z in p:",
"+ if z in path:"... | false | 0.075865 | 0.039852 | 1.903654 | [
"s423210976",
"s993156111"
] |
u744034042 | p03370 | python | s121758588 | s022217063 | 36 | 17 | 2,940 | 2,940 | Accepted | Accepted | 52.78 | n, x = list(map(int, input().split()))
m = [int(a) for a in [eval(input()) for i in range(n)]]
x = x - sum(m)
y = min(m)
while x >= y:
x -= y
n += 1
print(n) | n,x = list(map(int,input().split()))
m = [int(a) for a in [eval(input()) for i in range(n)]]
print((n + (x - sum(m))//min(m))) | 8 | 3 | 156 | 114 | n, x = list(map(int, input().split()))
m = [int(a) for a in [eval(input()) for i in range(n)]]
x = x - sum(m)
y = min(m)
while x >= y:
x -= y
n += 1
print(n)
| n, x = list(map(int, input().split()))
m = [int(a) for a in [eval(input()) for i in range(n)]]
print((n + (x - sum(m)) // min(m)))
| false | 62.5 | [
"-x = x - sum(m)",
"-y = min(m)",
"-while x >= y:",
"- x -= y",
"- n += 1",
"-print(n)",
"+print((n + (x - sum(m)) // min(m)))"
] | false | 0.093803 | 0.117953 | 0.795263 | [
"s121758588",
"s022217063"
] |
u047796752 | p02773 | python | s359779881 | s465932471 | 1,090 | 470 | 102,736 | 154,868 | Accepted | Accepted | 56.88 | from collections import Counter
N = int(eval(input()))
l = [eval(input()) for _ in range(N)]
cnt = Counter(l)
M = max(list(cnt.values()))
ans = []
for k in list(cnt.keys()):
if cnt[k]==M:
ans.append(k)
ans.sort()
for ans_i in ans:
print(ans_i) | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
cnt = Counter(S)
M = max(list(cnt.values()))
ans = []
for k, v in list(cnt.items()):
if v==M:
ans.append(k)
ans.sort()
for ans_i in ans:
print(ans_i) | 16 | 16 | 260 | 259 | from collections import Counter
N = int(eval(input()))
l = [eval(input()) for _ in range(N)]
cnt = Counter(l)
M = max(list(cnt.values()))
ans = []
for k in list(cnt.keys()):
if cnt[k] == M:
ans.append(k)
ans.sort()
for ans_i in ans:
print(ans_i)
| from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
cnt = Counter(S)
M = max(list(cnt.values()))
ans = []
for k, v in list(cnt.items()):
if v == M:
ans.append(k)
ans.sort()
for ans_i in ans:
print(ans_i)
| false | 0 | [
"-l = [eval(input()) for _ in range(N)]",
"-cnt = Counter(l)",
"+S = [eval(input()) for _ in range(N)]",
"+cnt = Counter(S)",
"-for k in list(cnt.keys()):",
"- if cnt[k] == M:",
"+for k, v in list(cnt.items()):",
"+ if v == M:"
] | false | 0.045995 | 0.088422 | 0.520172 | [
"s359779881",
"s465932471"
] |
u197955752 | p03147 | python | s478984195 | s657292871 | 28 | 20 | 3,064 | 3,060 | Accepted | Accepted | 28.57 | N = int(eval(input()))
h = [int(x) for x in input().split()]
ans = 0
sum_height = sum(h)
while sum_height > 0:
i = 0
while i < N:
while i < N and h[i] == 0:
i += 1
if i < N:
ans += 1
while i < N and h[i] > 0:
h[i] -= 1
sum_he... | N = int(eval(input()))
h = [int(x) for x in input().split()]
ans = 0
sum_height = sum(h)
while sum_height > 0:
for i in range(N):
if h[i] == 0:
pos = False
continue
elif (i == 0 and h[i] > 0) or (i > 0 and not pos):
ans += 1
h[i] -= 1
... | 18 | 17 | 357 | 365 | N = int(eval(input()))
h = [int(x) for x in input().split()]
ans = 0
sum_height = sum(h)
while sum_height > 0:
i = 0
while i < N:
while i < N and h[i] == 0:
i += 1
if i < N:
ans += 1
while i < N and h[i] > 0:
h[i] -= 1
sum_height -= 1
... | N = int(eval(input()))
h = [int(x) for x in input().split()]
ans = 0
sum_height = sum(h)
while sum_height > 0:
for i in range(N):
if h[i] == 0:
pos = False
continue
elif (i == 0 and h[i] > 0) or (i > 0 and not pos):
ans += 1
h[i] -= 1
sum_height -=... | false | 5.555556 | [
"- i = 0",
"- while i < N:",
"- while i < N and h[i] == 0:",
"- i += 1",
"- if i < N:",
"+ for i in range(N):",
"+ if h[i] == 0:",
"+ pos = False",
"+ continue",
"+ elif (i == 0 and h[i] > 0) or (i > 0 and not pos):",
"- ... | false | 0.144073 | 0.084976 | 1.695467 | [
"s478984195",
"s657292871"
] |
u341926204 | p03162 | python | s775914703 | s559323854 | 1,194 | 669 | 21,552 | 74,712 | Accepted | Accepted | 43.97 | import numpy as np
N = int(eval(input()))
ABC = np.zeros([N, 3])
for i in range(N):
ABC[i] = list(map(int, input().split()))
dp = np.zeros([N, 3])
dp[0] = ABC[0]
for i in range(N-1):
dp[i+1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i+1, 0]
dp[i+1, 1] = max(dp[i, 0], dp[i, 2]) + ABC[i+1, 1]
dp[i+1,... | N = int(eval(input()))
ABC = []
for i in range(N):
ABC.append(list(map(int, input().split())))
dp = [[0]*3 for _ in range(N)]
dp[0] = ABC[0]
for i in range(N-1):
dp[i+1][0] = max(dp[i][1], dp[i][2]) + ABC[i+1][0]
dp[i+1][1] = max(dp[i][0], dp[i][2]) + ABC[i+1][1]
dp[i+1][2] = max(dp[i][0], dp... | 14 | 13 | 385 | 358 | import numpy as np
N = int(eval(input()))
ABC = np.zeros([N, 3])
for i in range(N):
ABC[i] = list(map(int, input().split()))
dp = np.zeros([N, 3])
dp[0] = ABC[0]
for i in range(N - 1):
dp[i + 1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i + 1, 0]
dp[i + 1, 1] = max(dp[i, 0], dp[i, 2]) + ABC[i + 1, 1]
dp[i + 1... | N = int(eval(input()))
ABC = []
for i in range(N):
ABC.append(list(map(int, input().split())))
dp = [[0] * 3 for _ in range(N)]
dp[0] = ABC[0]
for i in range(N - 1):
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + ABC[i + 1][0]
dp[i + 1][1] = max(dp[i][0], dp[i][2]) + ABC[i + 1][1]
dp[i + 1][2] = max(dp[i][0],... | false | 7.142857 | [
"-import numpy as np",
"-",
"-ABC = np.zeros([N, 3])",
"+ABC = []",
"- ABC[i] = list(map(int, input().split()))",
"-dp = np.zeros([N, 3])",
"+ ABC.append(list(map(int, input().split())))",
"+dp = [[0] * 3 for _ in range(N)]",
"- dp[i + 1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i + 1, 0]",
"- ... | false | 0.503057 | 0.033963 | 14.81174 | [
"s775914703",
"s559323854"
] |
u600402037 | p02971 | python | s151900644 | s280873228 | 418 | 292 | 50,852 | 50,844 | Accepted | Accepted | 30.14 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.zeros(N+2, np.int32)
A[1:-1] = np.array([ir() for _ in range(N)])
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[:... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
A = np.zeros(N+2,np.int32)
A[1:-1] = np.array(read().split(),np.int32)
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[... | 15 | 15 | 409 | 417 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.zeros(N + 2, np.int32)
A[1:-1] = np.array([ir() for _ in range(N)])
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[::-1][2:]
ans... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
A = np.zeros(N + 2, np.int32)
A[1:-1] = np.array(read().split(), np.int32)
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[::-1... | false | 0 | [
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-sr = lambda: sys.stdin.readline().rstrip()",
"-ir = lambda: int(sr())",
"-lr = lambda: list(map(int, sr().split()))",
"-N = ir()",
"+N = int(readline())",
"-A[1:-1] = np.arra... | false | 0.49001 | 0.208008 | 2.355726 | [
"s151900644",
"s280873228"
] |
u006326793 | p02393 | python | s380570319 | s492823572 | 50 | 20 | 7,608 | 5,588 | Accepted | Accepted | 60 | # -*- coding utf-8 -*-
l = list(map(int,input().split()))
l.sort()
desc = "{0} {1} {2}".format(l[0],l[1],l[2])
print(desc) | # -*- coding: utf-8 -*-
l = list(map(int, input().split()))
l.sort()
l = list(map(str,l))
l = ' '.join(l)
print(l)
| 5 | 8 | 126 | 118 | # -*- coding utf-8 -*-
l = list(map(int, input().split()))
l.sort()
desc = "{0} {1} {2}".format(l[0], l[1], l[2])
print(desc)
| # -*- coding: utf-8 -*-
l = list(map(int, input().split()))
l.sort()
l = list(map(str, l))
l = " ".join(l)
print(l)
| false | 37.5 | [
"-# -*- coding utf-8 -*-",
"+# -*- coding: utf-8 -*-",
"-desc = \"{0} {1} {2}\".format(l[0], l[1], l[2])",
"-print(desc)",
"+l = list(map(str, l))",
"+l = \" \".join(l)",
"+print(l)"
] | false | 0.038561 | 0.03909 | 0.986468 | [
"s380570319",
"s492823572"
] |
u316584871 | p02379 | python | s000224252 | s074742193 | 30 | 20 | 5,652 | 5,648 | Accepted | Accepted | 33.33 | from math import sqrt
x1, y1, x2, y2 = list(map(float, input().split()))
r = sqrt((x1 - x2)**2 + (y1 - y2)**2 )
print(('{0:.5f}'.format(r)))
| from math import sqrt
x1, y1, x2, y2 = list(map(float, input().split()))
r = sqrt((x1 - x2)**2 + (y1 - y2)**2 )
print(r)
| 4 | 4 | 136 | 118 | from math import sqrt
x1, y1, x2, y2 = list(map(float, input().split()))
r = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(("{0:.5f}".format(r)))
| from math import sqrt
x1, y1, x2, y2 = list(map(float, input().split()))
r = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(r)
| false | 0 | [
"-print((\"{0:.5f}\".format(r)))",
"+print(r)"
] | false | 0.035601 | 0.032454 | 1.096945 | [
"s000224252",
"s074742193"
] |
u423002653 | p02814 | python | s133135292 | s278040891 | 635 | 186 | 13,136 | 45,720 | Accepted | Accepted | 70.71 | from fractions import gcd
def lcm(arr, n):
ans = arr[0]
for i in range(1, n):
ans = ((arr[i] * ans) // gcd(arr[i], ans))
return int(ans)
n, m = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
v = []
for x in arr:
y = x
cnt = 0
while y % 2 == 0:
... | from fractions import gcd
def lcm(arr, n):
ans = arr[0]
for i in range(1, n):
ans = ((arr[i] * ans) // gcd(arr[i], ans))
return ans
n, m = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
v = []
for x in arr:
y = x
cnt = 0
while y % 2 == 0:
... | 27 | 27 | 579 | 556 | from fractions import gcd
def lcm(arr, n):
ans = arr[0]
for i in range(1, n):
ans = (arr[i] * ans) // gcd(arr[i], ans)
return int(ans)
n, m = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
v = []
for x in arr:
y = x
cnt = 0
while y % 2 == 0:
y = y /... | from fractions import gcd
def lcm(arr, n):
ans = arr[0]
for i in range(1, n):
ans = (arr[i] * ans) // gcd(arr[i], ans)
return ans
n, m = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
v = []
for x in arr:
y = x
cnt = 0
while y % 2 == 0:
y = y // 2
... | false | 0 | [
"- return int(ans)",
"+ return ans",
"- print((0))",
"+ print(0)",
"- print((0))",
"+ print(0)",
"- print((int(1 + int((m - strt)) // int((2 * strt)))))",
"+ print(1 + (m - strt) // (2 * strt))"
] | false | 0.198383 | 0.055422 | 3.579515 | [
"s133135292",
"s278040891"
] |
u585482323 | p02901 | python | s688666937 | s945734108 | 725 | 255 | 135,948 | 42,584 | Accepted | Accepted | 64.83 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 121 | 56 | 2,387 | 1,303 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 53.719008 | [
"+from itertools import permutations, accumulate",
"-import random",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"-# A",
"-def... | false | 0.07068 | 0.042642 | 1.657523 | [
"s688666937",
"s945734108"
] |
u606045429 | p03569 | python | s048564178 | s901120376 | 84 | 70 | 4,212 | 4,212 | Accepted | Accepted | 16.67 | from collections import deque
S = eval(input())
ans = 0
Q = deque(S)
while len(Q) >= 2:
left = Q.popleft()
right = Q.pop()
if left != right:
if left == 'x':
Q.append(right)
ans += 1
elif right == 'x':
Q.appendleft(left)
ans += ... | from collections import deque
S = eval(input())
ans = 0
Q = deque(S)
while len(Q) >= 2:
left, right = Q[0], Q[-1]
if left == right:
Q.popleft()
Q.pop()
elif left == 'x':
Q.popleft()
ans += 1
elif right == 'x':
Q.pop()
ans += 1
else... | 20 | 23 | 385 | 364 | from collections import deque
S = eval(input())
ans = 0
Q = deque(S)
while len(Q) >= 2:
left = Q.popleft()
right = Q.pop()
if left != right:
if left == "x":
Q.append(right)
ans += 1
elif right == "x":
Q.appendleft(left)
ans += 1
else:
... | from collections import deque
S = eval(input())
ans = 0
Q = deque(S)
while len(Q) >= 2:
left, right = Q[0], Q[-1]
if left == right:
Q.popleft()
Q.pop()
elif left == "x":
Q.popleft()
ans += 1
elif right == "x":
Q.pop()
ans += 1
else:
print((-1)... | false | 13.043478 | [
"- left = Q.popleft()",
"- right = Q.pop()",
"- if left != right:",
"- if left == \"x\":",
"- Q.append(right)",
"- ans += 1",
"- elif right == \"x\":",
"- Q.appendleft(left)",
"- ans += 1",
"- else:",
"- print((... | false | 0.041465 | 0.037078 | 1.118319 | [
"s048564178",
"s901120376"
] |
u380524497 | p03944 | python | s704696488 | s117406721 | 235 | 17 | 16,020 | 3,064 | Accepted | Accepted | 92.77 | import numpy as np
w, h, n = list(map(int, input().split()))
rectangle = np.ones((w, h))
for j in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
rectangle[:x, :] = 0
elif a == 2:
rectangle[x:, :] = 0
elif a == 3:
rectangle[:, :y] = 0
elif ... | w, h, n = list(map(int, input().split()))
min_x = 0
max_x = w
min_y = 0
max_y = h
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1 and min_x < x:
min_x = x
if a == 2 and x < max_x:
max_x = x
if a == 3 and min_y < y:
min_y = y
if a == 4 a... | 20 | 23 | 379 | 444 | import numpy as np
w, h, n = list(map(int, input().split()))
rectangle = np.ones((w, h))
for j in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
rectangle[:x, :] = 0
elif a == 2:
rectangle[x:, :] = 0
elif a == 3:
rectangle[:, :y] = 0
elif a == 4:
rect... | w, h, n = list(map(int, input().split()))
min_x = 0
max_x = w
min_y = 0
max_y = h
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1 and min_x < x:
min_x = x
if a == 2 and x < max_x:
max_x = x
if a == 3 and min_y < y:
min_y = y
if a == 4 and y < max_y:
... | false | 13.043478 | [
"-import numpy as np",
"-",
"-rectangle = np.ones((w, h))",
"-for j in range(n):",
"+min_x = 0",
"+max_x = w",
"+min_y = 0",
"+max_y = h",
"+for i in range(n):",
"- if a == 1:",
"- rectangle[:x, :] = 0",
"- elif a == 2:",
"- rectangle[x:, :] = 0",
"- elif a == 3:",
... | false | 0.443121 | 0.037212 | 11.907947 | [
"s704696488",
"s117406721"
] |
u597455618 | p02560 | python | s822400853 | s532584932 | 847 | 632 | 9,264 | 106,380 | Accepted | Accepted | 25.38 | import sys
def floor_sum(n, m, a, b):
ans = n*(b//m)
b %= m
while True:
ans += (n-1)*n*(a//m)//2
a %= m
if a*n+b < m:
return ans
y_max = (a*n + b)//m
b -= y_max*m # now we have x_max = -(b//a)
ans += (n + b//a)*y_max
n = y_... | import sys
from numba import njit, i8
@njit((i8, i8, i8, i8), cache=True)
def floor_sum(n, m, a, b):
ans = n*(b//m)
b %= m
while True:
ans += (n-1)*n*(a//m)//2
a %= m
if a*n+b < m:
return ans
y_max = (a*n + b)//m
b -= y_max*m # now we have... | 24 | 25 | 516 | 572 | import sys
def floor_sum(n, m, a, b):
ans = n * (b // m)
b %= m
while True:
ans += (n - 1) * n * (a // m) // 2
a %= m
if a * n + b < m:
return ans
y_max = (a * n + b) // m
b -= y_max * m # now we have x_max = -(b//a)
ans += (n + b // a) * y_max
... | import sys
from numba import njit, i8
@njit((i8, i8, i8, i8), cache=True)
def floor_sum(n, m, a, b):
ans = n * (b // m)
b %= m
while True:
ans += (n - 1) * n * (a // m) // 2
a %= m
if a * n + b < m:
return ans
y_max = (a * n + b) // m
b -= y_max * m # n... | false | 4 | [
"+from numba import njit, i8",
"+@njit((i8, i8, i8, i8), cache=True)",
"- n = y_max",
"- m, a = a, m",
"+ m, a, n = a, m, y_max"
] | false | 0.096233 | 0.103117 | 0.933236 | [
"s822400853",
"s532584932"
] |
u089142196 | p02713 | python | s642196245 | s375907151 | 490 | 191 | 67,768 | 67,724 | Accepted | Accepted | 61.02 | from math import gcd
K=int(eval(input()))
sum=0
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
tmp= gcd(i,j)
sum += gcd(tmp,k)
print(sum)
| from math import gcd
K=int(eval(input()))
sum=0
for i in range(1,K+1):
for j in range(1,K+1):
tmp= gcd(i,j)
for k in range(1,K+1):
sum += gcd(tmp,k)
print(sum)
| 12 | 12 | 192 | 196 | from math import gcd
K = int(eval(input()))
sum = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
tmp = gcd(i, j)
sum += gcd(tmp, k)
print(sum)
| from math import gcd
K = int(eval(input()))
sum = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = gcd(i, j)
for k in range(1, K + 1):
sum += gcd(tmp, k)
print(sum)
| false | 0 | [
"+ tmp = gcd(i, j)",
"- tmp = gcd(i, j)"
] | false | 0.038397 | 0.215076 | 0.178526 | [
"s642196245",
"s375907151"
] |
u389910364 | p03128 | python | s990159996 | s014244150 | 305 | 105 | 5,396 | 5,600 | Accepted | Accepted | 65.57 | n, _ = list(map(int, input().split()))
numbers = list(map(int, input().split()))
reqs = {
1: 2,
2: 5,
3: 5,
4: 4,
5: 5,
6: 6,
7: 3,
8: 7,
9: 6,
}
memo = {}
def max_counts(a, b):
"""
a と b 大きい方を返す
:param a: solve() の返り値
:param b: solve() の返り値
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, M = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))
req... | 61 | 32 | 1,292 | 779 | n, _ = list(map(int, input().split()))
numbers = list(map(int, input().split()))
reqs = {
1: 2,
2: 5,
3: 5,
4: 4,
5: 5,
6: 6,
7: 3,
8: 7,
9: 6,
}
memo = {}
def max_counts(a, b):
"""
a と b 大きい方を返す
:param a: solve() の返り値
:param b: solve() の返り値
:return:
"""
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, M = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))
requires = [0, 2, 5, 5, 4, ... | false | 47.540984 | [
"-n, _ = list(map(int, input().split()))",
"-numbers = list(map(int, input().split()))",
"-reqs = {",
"- 1: 2,",
"- 2: 5,",
"- 3: 5,",
"- 4: 4,",
"- 5: 5,",
"- 6: 6,",
"- 7: 3,",
"- 8: 7,",
"- 9: 6,",
"-}",
"-memo = {}",
"+import os",
"+import sys",
"-",
... | false | 0.036698 | 0.041752 | 0.878942 | [
"s990159996",
"s014244150"
] |
u745223262 | p03612 | python | s607706688 | s014074955 | 85 | 78 | 14,008 | 14,008 | Accepted | Accepted | 8.24 | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
if p[i] == i + 1:
if i == 0:
p[i], p[i + 1] = p[i + 1], p[i]
elif i == n-1:
p[i], p[i - 1] = p[i - 1], p[i]
else:
if p[i - 1] == i + 1:
p[i],... | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
if p[i] == i + 1:
if i == 0:
p[i], p[i + 1] = p[i + 1], p[i]
elif i == n-1:
p[i], p[i - 1] = p[i - 1], p[i]
else:
p[i], p[i + 1] = p[i + 1], p[... | 18 | 16 | 440 | 348 | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
if p[i] == i + 1:
if i == 0:
p[i], p[i + 1] = p[i + 1], p[i]
elif i == n - 1:
p[i], p[i - 1] = p[i - 1], p[i]
else:
if p[i - 1] == i + 1:
p[i], p[i - 1] =... | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
if p[i] == i + 1:
if i == 0:
p[i], p[i + 1] = p[i + 1], p[i]
elif i == n - 1:
p[i], p[i - 1] = p[i - 1], p[i]
else:
p[i], p[i + 1] = p[i + 1], p[i]
cnt += 1
print... | false | 11.111111 | [
"- if p[i - 1] == i + 1:",
"- p[i], p[i - 1] = p[i - 1], p[i]",
"- else:",
"- p[i], p[i + 1] = p[i + 1], p[i]",
"+ p[i], p[i + 1] = p[i + 1], p[i]"
] | false | 0.034638 | 0.036543 | 0.947869 | [
"s607706688",
"s014074955"
] |
u020604402 | p02761 | python | s009371142 | s400943102 | 170 | 18 | 38,384 | 3,064 | Accepted | Accepted | 89.41 | N , M = list(map(int,input().split()))
L = []
for _ in range(M):
m = tuple(map(int,input().split()))
L.append(m)
if N == 1:
for ans in range(0,10):
ans = str(ans)
for x in L:
if ans[x[0] - 1] != str(x[1]):
break
else:
print(ans)
... | N, M = list(map(int,input().split()))
L = []
for _ in range(M):
m = tuple(map(int,input().split()))
L.append(m)
if(N == 1): lower = 0
else: lower = 10 ** (N - 1)
for ans in range(lower, 10 ** N ):
ans = str(ans)
for x in L:
if ans[x[0] - 1] != str(x[1]):
break
... | 28 | 20 | 612 | 402 | N, M = list(map(int, input().split()))
L = []
for _ in range(M):
m = tuple(map(int, input().split()))
L.append(m)
if N == 1:
for ans in range(0, 10):
ans = str(ans)
for x in L:
if ans[x[0] - 1] != str(x[1]):
break
else:
print(ans)
e... | N, M = list(map(int, input().split()))
L = []
for _ in range(M):
m = tuple(map(int, input().split()))
L.append(m)
if N == 1:
lower = 0
else:
lower = 10 ** (N - 1)
for ans in range(lower, 10**N):
ans = str(ans)
for x in L:
if ans[x[0] - 1] != str(x[1]):
break
else: # 一度もb... | false | 28.571429 | [
"- for ans in range(0, 10):",
"- ans = str(ans)",
"- for x in L:",
"- if ans[x[0] - 1] != str(x[1]):",
"- break",
"- else:",
"- print(ans)",
"- exit()",
"- print((-1))",
"- exit()",
"+ lower = 0",
"- for ans in... | false | 0.176931 | 0.044129 | 4.009433 | [
"s009371142",
"s400943102"
] |
u853728588 | p02628 | python | s112334883 | s638372349 | 29 | 23 | 9,248 | 9,104 | Accepted | Accepted | 20.69 | n, k = list(map(int,input().split()))
p = list(map(int,input().split()))
p.sort()
print((sum(p[0:k])))
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
total = 0
for i in range(k):
total += p[i]
print(total) | 5 | 7 | 100 | 141 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print((sum(p[0:k])))
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
total = 0
for i in range(k):
total += p[i]
print(total)
| false | 28.571429 | [
"-print((sum(p[0:k])))",
"+total = 0",
"+for i in range(k):",
"+ total += p[i]",
"+print(total)"
] | false | 0.040548 | 0.107888 | 0.37583 | [
"s112334883",
"s638372349"
] |
u989345508 | p03488 | python | s432883967 | s633342491 | 200 | 183 | 41,200 | 41,072 | Accepted | Accepted | 8.5 | from sys import exit
s=eval(input())
x,y=list(map(int,input().split()))
def groupby(a):
a2=[[a[0],1]]
for i in range(1,len(a)):
if a2[-1][0]==a[i]:
a2[-1][1]+=1
else:
a2.append([a[i],1])
return a2
s=groupby(s)
a,b=[],[]
turn=True
if s[0][0]=="F":
... | from sys import exit
s=eval(input())
x,y=list(map(int,input().split()))
def groupby(a):
a2=[[a[0],1]]
for i in range(1,len(a)):
if a2[-1][0]==a[i]:
a2[-1][1]+=1
else:
a2.append([a[i],1])
return a2
s=groupby(s)
a,b=[],[]
turn=True
#初めまっすぐの場合
if s[0][0]... | 43 | 40 | 748 | 713 | from sys import exit
s = eval(input())
x, y = list(map(int, input().split()))
def groupby(a):
a2 = [[a[0], 1]]
for i in range(1, len(a)):
if a2[-1][0] == a[i]:
a2[-1][1] += 1
else:
a2.append([a[i], 1])
return a2
s = groupby(s)
a, b = [], []
turn = True
if s[0][0]... | from sys import exit
s = eval(input())
x, y = list(map(int, input().split()))
def groupby(a):
a2 = [[a[0], 1]]
for i in range(1, len(a)):
if a2[-1][0] == a[i]:
a2[-1][1] += 1
else:
a2.append([a[i], 1])
return a2
s = groupby(s)
a, b = [], []
turn = True
# 初めまっすぐの場... | false | 6.976744 | [
"+# 初めまっすぐの場合",
"- else:",
"- if i[1] % 2 == 1:",
"- turn = not turn",
"+ elif i[1] % 2 == 1:",
"+ turn = not turn",
"- if x > 0:",
"- x -= i",
"- else:",
"- x += i",
"+ x = abs(x) - abs(i)",
"+if x != 0:",
"+ print(\"No\")",
"+ e... | false | 0.048768 | 0.006899 | 7.069056 | [
"s432883967",
"s633342491"
] |
u735008991 | p02861 | python | s139686547 | s762687791 | 368 | 202 | 4,528 | 42,588 | Accepted | Accepted | 45.11 | import math
import itertools
def dist(a, b):
return math.sqrt((a[0]-b[0])**2 + (a[1] - b[1])**2)
def length(P, p):
total = 0
for i in range(len(p)-1):
total += dist(P[p[i]], P[p[i+1]])
return total
N = int(eval(input()))
P = [list(map(int, input().split())) for _ in range(N... | import itertools
import math
def dist(a, b):
return math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)
N = int(eval(input()))
C = [tuple(map(int, input().split())) for _ in range(N)]
s = 0
for per in itertools.permutations(C):
for i in range(N-1):
s += dist(per[i], per[i+1])
print((s /... | 20 | 17 | 421 | 352 | import math
import itertools
def dist(a, b):
return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
def length(P, p):
total = 0
for i in range(len(p) - 1):
total += dist(P[p[i]], P[p[i + 1]])
return total
N = int(eval(input()))
P = [list(map(int, input().split())) for _ in range(N)]
pri... | import itertools
import math
def dist(a, b):
return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
N = int(eval(input()))
C = [tuple(map(int, input().split())) for _ in range(N)]
s = 0
for per in itertools.permutations(C):
for i in range(N - 1):
s += dist(per[i], per[i + 1])
print((s / len(list(... | false | 15 | [
"+import itertools",
"-import itertools",
"-def length(P, p):",
"- total = 0",
"- for i in range(len(p) - 1):",
"- total += dist(P[p[i]], P[p[i + 1]])",
"- return total",
"-",
"-",
"-P = [list(map(int, input().split())) for _ in range(N)]",
"-print(",
"- (",
"- sum(... | false | 0.038927 | 0.039865 | 0.976461 | [
"s139686547",
"s762687791"
] |
u844646164 | p03575 | python | s898579996 | s213652356 | 188 | 36 | 76,076 | 9,264 | Accepted | Accepted | 80.85 | import heapq
N, M = list(map(int, input().split()))
ab = [list([int(x)-1 for x in input().split()]) for _ in range(M)]
ans = 0
def dijkstra(s, graph, n):
dist = [float('inf')]*n
dist[s] = 0
num = [0]*n
num[s] = 1
q = [[0, s]]
heapq.heapify(q)
while q:
c, u = heapq.heappop(q)
if dist... | import sys
sys.setrecursionlimit(1000000000)
N, M = list(map(int, input().split()))
graph = [[0]*N for _ in range(N)]
visited = [0]*N
ab = []
ans = 0
def dfs(u):
visited[u] = 1
for v in range(N):
if graph[u][v] == 1 and visited[v] == 0:
dfs(v)
for _ in range(M):
a, b = [int(x)-1 for x i... | 39 | 37 | 903 | 627 | import heapq
N, M = list(map(int, input().split()))
ab = [list([int(x) - 1 for x in input().split()]) for _ in range(M)]
ans = 0
def dijkstra(s, graph, n):
dist = [float("inf")] * n
dist[s] = 0
num = [0] * n
num[s] = 1
q = [[0, s]]
heapq.heapify(q)
while q:
c, u = heapq.heappop(q)... | import sys
sys.setrecursionlimit(1000000000)
N, M = list(map(int, input().split()))
graph = [[0] * N for _ in range(N)]
visited = [0] * N
ab = []
ans = 0
def dfs(u):
visited[u] = 1
for v in range(N):
if graph[u][v] == 1 and visited[v] == 0:
dfs(v)
for _ in range(M):
a, b = [int(x) -... | false | 5.128205 | [
"-import heapq",
"+import sys",
"+sys.setrecursionlimit(1000000000)",
"-ab = [list([int(x) - 1 for x in input().split()]) for _ in range(M)]",
"+graph = [[0] * N for _ in range(N)]",
"+visited = [0] * N",
"+ab = []",
"-def dijkstra(s, graph, n):",
"- dist = [float(\"inf\")] * n",
"- dist[s] ... | false | 0.075812 | 0.036441 | 2.080392 | [
"s898579996",
"s213652356"
] |
u952708174 | p03250 | python | s184758088 | s681382484 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | I = [int(i) for i in input().split()]
I.sort(reverse=True)
a, b, c = list(map(str, I))
ans = int(a + b) + int(c)
print(ans) | a, b, c = sorted([i for i in input().split()], reverse=True)
print((int(a + b) + int(c))) | 5 | 2 | 121 | 88 | I = [int(i) for i in input().split()]
I.sort(reverse=True)
a, b, c = list(map(str, I))
ans = int(a + b) + int(c)
print(ans)
| a, b, c = sorted([i for i in input().split()], reverse=True)
print((int(a + b) + int(c)))
| false | 60 | [
"-I = [int(i) for i in input().split()]",
"-I.sort(reverse=True)",
"-a, b, c = list(map(str, I))",
"-ans = int(a + b) + int(c)",
"-print(ans)",
"+a, b, c = sorted([i for i in input().split()], reverse=True)",
"+print((int(a + b) + int(c)))"
] | false | 0.044006 | 0.043956 | 1.001143 | [
"s184758088",
"s681382484"
] |
u954153335 | p02731 | python | s458617197 | s936628918 | 34 | 17 | 5,076 | 2,940 | Accepted | Accepted | 50 | from decimal import*
l=Decimal(eval(input()))
ans=(l/3)**3
print(ans)
| l=float(eval(input()))
ans=(l/3)**3
print(ans)
| 4 | 3 | 67 | 43 | from decimal import *
l = Decimal(eval(input()))
ans = (l / 3) ** 3
print(ans)
| l = float(eval(input()))
ans = (l / 3) ** 3
print(ans)
| false | 25 | [
"-from decimal import *",
"-",
"-l = Decimal(eval(input()))",
"+l = float(eval(input()))"
] | false | 0.037621 | 0.036875 | 1.020212 | [
"s458617197",
"s936628918"
] |
u102242691 | p03827 | python | s275489170 | s934564768 | 25 | 18 | 3,316 | 2,940 | Accepted | Accepted | 28 |
n = int(eval(input()))
s = list(eval(input()))
ans = 0
l = [0]
for i in range(n):
if s[i] == "I":
ans += 1
l.append(ans)
elif s[i] == "D":
ans -= 1
l.append(ans)
print((max(l)))
|
n = int(eval(input()))
s = list(eval(input()))
max = 0
count = 0
for i in range(n):
if s[i] == "I":
count += 1
if max < count:
max = count
elif s[i] == "D":
count -= 1
print(max)
| 16 | 14 | 223 | 226 | n = int(eval(input()))
s = list(eval(input()))
ans = 0
l = [0]
for i in range(n):
if s[i] == "I":
ans += 1
l.append(ans)
elif s[i] == "D":
ans -= 1
l.append(ans)
print((max(l)))
| n = int(eval(input()))
s = list(eval(input()))
max = 0
count = 0
for i in range(n):
if s[i] == "I":
count += 1
if max < count:
max = count
elif s[i] == "D":
count -= 1
print(max)
| false | 12.5 | [
"-ans = 0",
"-l = [0]",
"+max = 0",
"+count = 0",
"- ans += 1",
"- l.append(ans)",
"+ count += 1",
"+ if max < count:",
"+ max = count",
"- ans -= 1",
"- l.append(ans)",
"-print((max(l)))",
"+ count -= 1",
"+print(max)"
] | false | 0.072891 | 0.039211 | 1.858963 | [
"s275489170",
"s934564768"
] |
u325282913 | p02695 | python | s298846218 | s815543762 | 986 | 298 | 9,604 | 83,728 | Accepted | Accepted | 69.78 | import sys
sys.setrecursionlimit(10**7)
N, M, Q = list(map(int, input().split()))
arr = [list(map(int, input().split())) for _ in range(Q)]
ans = set()
def generate_arr(target):
if len(target) == N:
tmp = 0
for item in arr:
if target[item[1]-1] - target[item[0]-1] == item[2]... | target = []
def dfs(A):
if len(A) == N:
tmp = 0
for a, b, c, d in arr:
if A[b-1] - A[a-1] == c:
tmp += d
target.append(tmp)
return
start = 1
if len(A) != 0:
start = A[-1]
for v in range(start,M+1):
A.append(v)
... | 22 | 20 | 593 | 472 | import sys
sys.setrecursionlimit(10**7)
N, M, Q = list(map(int, input().split()))
arr = [list(map(int, input().split())) for _ in range(Q)]
ans = set()
def generate_arr(target):
if len(target) == N:
tmp = 0
for item in arr:
if target[item[1] - 1] - target[item[0] - 1] == item[2]:
... | target = []
def dfs(A):
if len(A) == N:
tmp = 0
for a, b, c, d in arr:
if A[b - 1] - A[a - 1] == c:
tmp += d
target.append(tmp)
return
start = 1
if len(A) != 0:
start = A[-1]
for v in range(start, M + 1):
A.append(v)
d... | false | 9.090909 | [
"-import sys",
"+target = []",
"-sys.setrecursionlimit(10**7)",
"+",
"+def dfs(A):",
"+ if len(A) == N:",
"+ tmp = 0",
"+ for a, b, c, d in arr:",
"+ if A[b - 1] - A[a - 1] == c:",
"+ tmp += d",
"+ target.append(tmp)",
"+ return",
"+ ... | false | 0.052067 | 0.087652 | 0.594019 | [
"s298846218",
"s815543762"
] |
u366959492 | p03045 | python | s006198250 | s106000578 | 984 | 641 | 78,552 | 75,864 | Accepted | Accepted | 34.86 | n,m=list(map(int,input().split()))
class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*(n+1)
self.rnk=[0]*(n+1)
def Find_Root(self,x):
if self.root[x]<0:
return x
else:
self.root[x]=self.Find_Root(self.root[x])
... | n,m=list(map(int,input().split()))
import sys
input=sys.stdin.readline
class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*(n+1)
self.rnk=[0]*(n+1)
def Find_Root(self,x):
if self.root[x]<0:
return x
else:
self.root[x]=s... | 42 | 48 | 1,058 | 1,116 | n, m = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])... | n, m = list(map(int, input().split()))
import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self... | false | 12.5 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+ x -= 1",
"+ y -= 1",
"-ans = set()",
"-for i in range(1, n + 1):",
"- ans.add(uf.Find_Root(i))",
"-print((len(ans)))",
"+r = [0] * n",
"+for i in range(n):",
"+ r[i] = uf.Find_Root(i)",
"+s = set(r)",
"+print((len(s)))"
] | false | 0.043764 | 0.042352 | 1.033351 | [
"s006198250",
"s106000578"
] |
u970197315 | p03208 | python | s923580277 | s453417578 | 386 | 243 | 16,724 | 7,384 | Accepted | Accepted | 37.05 | # ABC115 C - Christmas Eve
import numpy as np
N,K = list(map(int,input().split()))
H = [int(eval(input())) for _ in range(N)]
ans = 10**10
H.sort()
for i in range(N-K+1):
t = H[i+K-1] - H[i]
ans = min(ans,t)
print(ans) | n,k=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]
h.sort()
ans=10**12
for i in range(n-k+1):
min_h=h[i+k-1]-h[i]
ans=min(ans,min_h)
print(ans)
| 12 | 11 | 227 | 178 | # ABC115 C - Christmas Eve
import numpy as np
N, K = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
ans = 10**10
H.sort()
for i in range(N - K + 1):
t = H[i + K - 1] - H[i]
ans = min(ans, t)
print(ans)
| n, k = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
h.sort()
ans = 10**12
for i in range(n - k + 1):
min_h = h[i + k - 1] - h[i]
ans = min(ans, min_h)
print(ans)
| false | 8.333333 | [
"-# ABC115 C - Christmas Eve",
"-import numpy as np",
"-",
"-N, K = list(map(int, input().split()))",
"-H = [int(eval(input())) for _ in range(N)]",
"-ans = 10**10",
"-H.sort()",
"-for i in range(N - K + 1):",
"- t = H[i + K - 1] - H[i]",
"- ans = min(ans, t)",
"+n, k = list(map(int, input... | false | 0.035734 | 0.036879 | 0.968931 | [
"s923580277",
"s453417578"
] |
u674052742 | p02813 | python | s050013302 | s713692300 | 225 | 29 | 42,352 | 3,064 | Accepted | Accepted | 87.11 | # -*- coding: utf-8 -*-
"""
Created on Thu May 7 03:09:14 2020
@author: Kanaru Sato
"""
import itertools as it
n = int(eval(input()))
l = []
for i in range(1,n+1):
l.append(i)
p = list(map(int, input().split()))
q = list(map(int, input().split()))
count = 0
for sequence in it.permutations(l,n):
... | # -*- coding: utf-8 -*-
"""
Created on Sun May 17 19:16:09 2020
@author: Kanaru Sato
"""
import itertools
n = int(eval(input()))
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
nums = [i+1 for i in range(n)]
count = 0
for perm in itertools.permutations(nums):
count += 1
... | 24 | 23 | 456 | 427 | # -*- coding: utf-8 -*-
"""
Created on Thu May 7 03:09:14 2020
@author: Kanaru Sato
"""
import itertools as it
n = int(eval(input()))
l = []
for i in range(1, n + 1):
l.append(i)
p = list(map(int, input().split()))
q = list(map(int, input().split()))
count = 0
for sequence in it.permutations(l, n):
if list(se... | # -*- coding: utf-8 -*-
"""
Created on Sun May 17 19:16:09 2020
@author: Kanaru Sato
"""
import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
nums = [i + 1 for i in range(n)]
count = 0
for perm in itertools.permutations(nums):
count += 1
if p == perm... | false | 4.166667 | [
"-Created on Thu May 7 03:09:14 2020",
"+Created on Sun May 17 19:16:09 2020",
"-import itertools as it",
"+import itertools",
"-l = []",
"-for i in range(1, n + 1):",
"- l.append(i)",
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"+p = tuple(map(int, input().... | false | 0.044101 | 0.039824 | 1.107403 | [
"s050013302",
"s713692300"
] |
u798803522 | p00189 | python | s534121910 | s911437819 | 40 | 30 | 7,784 | 7,796 | Accepted | Accepted | 25 | import sys
from sys import stdin
input = stdin.readline
road = int(eval(input()))
while road > 0:
answer = [[float("inf") if n != m else 0 for n in range(10)] for m in range(10)]
city = 0
for _ in range(road):
c1, c2, w = (int(n) for n in input().split(" "))
answer[c1][c2] = w
... | road = int(eval(input()))
while road > 0:
answer = [[float("inf") if n != m else 0 for n in range(10)] for m in range(10)]
city = 0
for _ in range(road):
c1, c2, w = (int(n) for n in input().split(" "))
answer[c1][c2] = w
answer[c2][c1] = w
city = max(city, c1, c2)
... | 24 | 20 | 765 | 704 | import sys
from sys import stdin
input = stdin.readline
road = int(eval(input()))
while road > 0:
answer = [[float("inf") if n != m else 0 for n in range(10)] for m in range(10)]
city = 0
for _ in range(road):
c1, c2, w = (int(n) for n in input().split(" "))
answer[c1][c2] = w
answe... | road = int(eval(input()))
while road > 0:
answer = [[float("inf") if n != m else 0 for n in range(10)] for m in range(10)]
city = 0
for _ in range(road):
c1, c2, w = (int(n) for n in input().split(" "))
answer[c1][c2] = w
answer[c2][c1] = w
city = max(city, c1, c2)
city +... | false | 16.666667 | [
"-import sys",
"-from sys import stdin",
"-",
"-input = stdin.readline"
] | false | 0.0432 | 0.034643 | 1.247015 | [
"s534121910",
"s911437819"
] |
u941407962 | p03212 | python | s430192348 | s515255015 | 344 | 287 | 9,424 | 7,752 | Accepted | Accepted | 16.57 | N=int(eval(input()))
f=lambda c:sum([list([z+y for z in f(c-1)]) for y in '357'],[]) if c!=0 else ['']
print((sum([len(list([y for y in list([len(set(sorted(x))) for x in [z for z in f(e+1) if int(z)<=N]]) if y==3])) for e in range(10)])))
| N=int(eval(input()))
r=filter
f=lambda c:sum([[z+y for z in f(c-1)]for y in'357'],[]) if c!=0 else ['']
print((sum([len(r(lambda y:y==3,[len(set(sorted(x))) for x in r(lambda z:int(z)<=N,f(e+1))]))for e in range(10)])))
| 3 | 4 | 242 | 221 | N = int(eval(input()))
f = (
lambda c: sum([list([z + y for z in f(c - 1)]) for y in "357"], [])
if c != 0
else [""]
)
print(
(
sum(
[
len(
list(
[
y
for y in list(
... | N = int(eval(input()))
r = filter
f = lambda c: sum([[z + y for z in f(c - 1)] for y in "357"], []) if c != 0 else [""]
print(
(
sum(
[
len(
r(
lambda y: y == 3,
[
len(set(sorted(x)))
... | false | 25 | [
"-f = (",
"- lambda c: sum([list([z + y for z in f(c - 1)]) for y in \"357\"], [])",
"- if c != 0",
"- else [\"\"]",
"-)",
"+r = filter",
"+f = lambda c: sum([[z + y for z in f(c - 1)] for y in \"357\"], []) if c != 0 else [\"\"]",
"- list(",
"+ r(",
... | false | 0.491272 | 0.048717 | 10.084283 | [
"s430192348",
"s515255015"
] |
u261103969 | p02629 | python | s136946058 | s096003247 | 73 | 27 | 61,880 | 9,192 | Accepted | Accepted | 63.01 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n = int(readline())
chars = "abcdefghijklmnopqrstuvwxyz"
res = ""
for i in range(1, 100):
x = n % 26
if x == 0:
x = 26
res += ... | n = int(eval(input()))
chars = "Xabcdefghijklmnopqrstuvwxyz" # x番目がほしいときにchars[x-1]としたくないので、chars[0]は使わないことにします
res = ""
n_rem = n
while True:
x = n_rem % 26
# 余りが0、zの場合は、26にします
if x == 0:
x = 26
res += chars[x]
# xを引いて、26で割ります
n_rem -= x
n_rem //= 26
# 0なら終... | 27 | 23 | 472 | 407 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
n = int(readline())
chars = "abcdefghijklmnopqrstuvwxyz"
res = ""
for i in range(1, 100):
x = n % 26
if x == 0:
x = 26
res += chars[x - 1]
n... | n = int(eval(input()))
chars = (
"Xabcdefghijklmnopqrstuvwxyz" # x番目がほしいときにchars[x-1]としたくないので、chars[0]は使わないことにします
)
res = ""
n_rem = n
while True:
x = n_rem % 26
# 余りが0、zの場合は、26にします
if x == 0:
x = 26
res += chars[x]
# xを引いて、26で割ります
n_rem -= x
n_rem //= 26
# 0なら終了します
if n... | false | 14.814815 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- n = int(readline())",
"- chars = \"abcdefghijklmnopqrstuvwxyz\"",
"- res = \"\"",
"- for i in range(1, 100):",
"- ... | false | 0.0354 | 0.03526 | 1.00395 | [
"s136946058",
"s096003247"
] |
u596536048 | p03555 | python | s507074742 | s826534806 | 26 | 24 | 9,052 | 8,732 | Accepted | Accepted | 7.69 | word1, word2 = [eval(input()) for i in range(2)]
if word1[0] == word2[2] and word1[1] == word2[1] and word1[2] == word2[0]:
print('YES')
else:
print('NO') | C1, C2 = [eval(input()) for i in range(2)]
print(('YES' if C1 == C2[::-1] else 'NO')) | 5 | 2 | 160 | 78 | word1, word2 = [eval(input()) for i in range(2)]
if word1[0] == word2[2] and word1[1] == word2[1] and word1[2] == word2[0]:
print("YES")
else:
print("NO")
| C1, C2 = [eval(input()) for i in range(2)]
print(("YES" if C1 == C2[::-1] else "NO"))
| false | 60 | [
"-word1, word2 = [eval(input()) for i in range(2)]",
"-if word1[0] == word2[2] and word1[1] == word2[1] and word1[2] == word2[0]:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+C1, C2 = [eval(input()) for i in range(2)]",
"+print((\"YES\" if C1 == C2[::-1] else \"NO\"))"
] | false | 0.091225 | 0.045155 | 2.020264 | [
"s507074742",
"s826534806"
] |
u624696727 | p03166 | python | s191766885 | s951288516 | 421 | 346 | 59,056 | 23,036 | Accepted | Accepted | 17.81 | import sys
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline
N,M = list(map(int, input().split()))
lst_edge = [[] for _ in range(N)]
for _ in range(M):
x,y = list(map(int, input().split()))
lst_edge[x-1].append(y-1)
dp = [-1] * N
def rec(v):
if dp[v] != -1:
return dp[v]
ans = 0
lst_... | import sys
import collections
input = sys.stdin.readline
def chmax(a,b):
if a>b :
return a
return b
N,M = list(map(int, input().split()))
lst_edge = [[] for _ in range(N)]
deg = [0]*N
for _ in range(M):
x,y = list(map(int, input().split()))
lst_edge[x-1].append(y-1)
deg[y-1] += 1
que = col... | 27 | 33 | 469 | 560 | import sys
sys.setrecursionlimit(10**5 + 10)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
lst_edge = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int, input().split()))
lst_edge[x - 1].append(y - 1)
dp = [-1] * N
def rec(v):
if dp[v] != -1:
return dp[v]
ans =... | import sys
import collections
input = sys.stdin.readline
def chmax(a, b):
if a > b:
return a
return b
N, M = list(map(int, input().split()))
lst_edge = [[] for _ in range(N)]
deg = [0] * N
for _ in range(M):
x, y = list(map(int, input().split()))
lst_edge[x - 1].append(y - 1)
deg[y - 1]... | false | 18.181818 | [
"+import collections",
"-sys.setrecursionlimit(10**5 + 10)",
"+",
"+",
"+def chmax(a, b):",
"+ if a > b:",
"+ return a",
"+ return b",
"+",
"+",
"+deg = [0] * N",
"-dp = [-1] * N",
"-",
"-",
"-def rec(v):",
"- if dp[v] != -1:",
"- return dp[v]",
"- ans = 0... | false | 0.047315 | 0.047389 | 0.998427 | [
"s191766885",
"s951288516"
] |
u597374218 | p02622 | python | s546446962 | s484465793 | 68 | 58 | 9,404 | 9,548 | Accepted | Accepted | 14.71 | S=eval(input())
T=eval(input())
count=0
for i in range(len(S)):
if S[i]!=T[i]:
count+=1
print(count) | S = eval(input())
T = eval(input())
count = 0
for s, t in zip(S, T):
if s != t:
count += 1
print(count) | 7 | 7 | 106 | 109 | S = eval(input())
T = eval(input())
count = 0
for i in range(len(S)):
if S[i] != T[i]:
count += 1
print(count)
| S = eval(input())
T = eval(input())
count = 0
for s, t in zip(S, T):
if s != t:
count += 1
print(count)
| false | 0 | [
"-for i in range(len(S)):",
"- if S[i] != T[i]:",
"+for s, t in zip(S, T):",
"+ if s != t:"
] | false | 0.047271 | 0.048135 | 0.982047 | [
"s546446962",
"s484465793"
] |
u673361376 | p02995 | python | s259213174 | s402971355 | 286 | 37 | 64,364 | 5,088 | Accepted | Accepted | 87.06 | from fractions import gcd
def get_num(div):
num = (B)//div - (A-1)//div
return num
A,B,C,D = list(map(int,input().split()))
print((B-A+1-get_num(C)-get_num(D)+get_num(C*D//gcd(C,D)))) | from fractions import gcd
A, B, C, D = list(map(int,input().split()))
total = B - A + 1
divC = B//C - (A-1)//C
divD = B//D - (A-1)//D
lcm = int(C * D / gcd(C, D))
divCD = B//lcm - (A-1)//lcm
print((total - divC - divD + divCD))
| 8 | 8 | 188 | 227 | from fractions import gcd
def get_num(div):
num = (B) // div - (A - 1) // div
return num
A, B, C, D = list(map(int, input().split()))
print((B - A + 1 - get_num(C) - get_num(D) + get_num(C * D // gcd(C, D))))
| from fractions import gcd
A, B, C, D = list(map(int, input().split()))
total = B - A + 1
divC = B // C - (A - 1) // C
divD = B // D - (A - 1) // D
lcm = int(C * D / gcd(C, D))
divCD = B // lcm - (A - 1) // lcm
print((total - divC - divD + divCD))
| false | 0 | [
"-",
"-def get_num(div):",
"- num = (B) // div - (A - 1) // div",
"- return num",
"-",
"-",
"-print((B - A + 1 - get_num(C) - get_num(D) + get_num(C * D // gcd(C, D))))",
"+total = B - A + 1",
"+divC = B // C - (A - 1) // C",
"+divD = B // D - (A - 1) // D",
"+lcm = int(C * D / gcd(C, D))"... | false | 0.115907 | 0.135292 | 0.856717 | [
"s259213174",
"s402971355"
] |
u644907318 | p02861 | python | s438669038 | s501967271 | 98 | 89 | 74,508 | 74,328 | Accepted | Accepted | 9.18 | from itertools import permutations
def dist(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for z in permutations(list(range(N)),N):
for i in range(1,N):
cnt += dist(X[z[i]],X[z[i-1]])
k = 1
for i in range(... | from itertools import permutations
import math
def dist(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
A = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(N):
A[i][j] = dist(X[i],X[j])... | 13 | 18 | 342 | 476 | from itertools import permutations
def dist(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
for z in permutations(list(range(N)), N):
for i in range(1, N):
cnt += dist(X[z[i]], X[z[i - 1]])
k = 1
fo... | from itertools import permutations
import math
def dist(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
A = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(N):
A[i][j] = dist(X[i... | false | 27.777778 | [
"+import math",
"-cnt = 0",
"-for z in permutations(list(range(N)), N):",
"+A = [[0 for _ in range(N)] for _ in range(N)]",
"+for i in range(N):",
"+ for j in range(N):",
"+ A[i][j] = dist(X[i], X[j])",
"+tot = 0",
"+for x in permutations(list(range(N)), N):",
"+ cnt = 0",
"- ... | false | 0.040338 | 0.040895 | 0.986393 | [
"s438669038",
"s501967271"
] |
u588341295 | p03703 | python | s741704313 | s381430182 | 1,579 | 515 | 53,168 | 111,616 | Accepted | Accepted | 67.38 | # -*- coding: utf-8 -*-
import sys
from itertools import accumulate
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in rang... | # -*- coding: utf-8 -*-
import sys
from itertools import accumulate
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in rang... | 74 | 81 | 1,832 | 1,972 | # -*- coding: utf-8 -*-
import sys
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d... | # -*- coding: utf-8 -*-
import sys
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d... | false | 8.641975 | [
"+def compress(A):",
"+ \"\"\"座標圧縮\"\"\"",
"+ zipped, unzipped = {}, {}",
"+ for i, a in enumerate(sorted(set(A))):",
"+ zipped[a] = i",
"+ unzipped[i] = a",
"+ return zipped, unzipped",
"+",
"+",
"-zip_acc = {}",
"-for i, a in enumerate(sorted(set(acc))):",
"- zip... | false | 0.043617 | 0.050313 | 0.866914 | [
"s741704313",
"s381430182"
] |
u058781705 | p03293 | python | s011995681 | s175388023 | 71 | 64 | 61,876 | 62,112 | Accepted | Accepted | 9.86 | def rolling(str, n):
return str[n:len(str)] + str[:n]
S = eval(input())
T = eval(input())
for i in range(len(S)):
if rolling(S, i) == T:
print("Yes")
exit()
print("No")
| S = list(eval(input()))
T = list(eval(input()))
def rolling(str, n):
return str[n:len(str)] + str[:n]
for i in range(len(S)):
if S == rolling(T, i):
print("Yes")
exit()
print("No")
| 12 | 14 | 195 | 211 | def rolling(str, n):
return str[n : len(str)] + str[:n]
S = eval(input())
T = eval(input())
for i in range(len(S)):
if rolling(S, i) == T:
print("Yes")
exit()
print("No")
| S = list(eval(input()))
T = list(eval(input()))
def rolling(str, n):
return str[n : len(str)] + str[:n]
for i in range(len(S)):
if S == rolling(T, i):
print("Yes")
exit()
print("No")
| false | 14.285714 | [
"+S = list(eval(input()))",
"+T = list(eval(input()))",
"+",
"+",
"-S = eval(input())",
"-T = eval(input())",
"- if rolling(S, i) == T:",
"+ if S == rolling(T, i):"
] | false | 0.054035 | 0.081334 | 0.664363 | [
"s011995681",
"s175388023"
] |
u606045429 | p02773 | python | s769969169 | s093346969 | 453 | 413 | 45,300 | 38,392 | Accepted | Accepted | 8.83 | from collections import Counter
N, *S = open(0).read().split()
C = Counter(S).most_common()
ma = C[0][1]
ans = sorted(k for k, v in C if v == ma)
for a in ans:
print(a) | from collections import Counter
N, *S = open(0).read().split()
C = Counter(S)
ma = max(C.values())
ans = sorted(k for k, v in list(C.items()) if v == ma)
for a in ans:
print(a) | 11 | 11 | 186 | 188 | from collections import Counter
N, *S = open(0).read().split()
C = Counter(S).most_common()
ma = C[0][1]
ans = sorted(k for k, v in C if v == ma)
for a in ans:
print(a)
| from collections import Counter
N, *S = open(0).read().split()
C = Counter(S)
ma = max(C.values())
ans = sorted(k for k, v in list(C.items()) if v == ma)
for a in ans:
print(a)
| false | 0 | [
"-C = Counter(S).most_common()",
"-ma = C[0][1]",
"-ans = sorted(k for k, v in C if v == ma)",
"+C = Counter(S)",
"+ma = max(C.values())",
"+ans = sorted(k for k, v in list(C.items()) if v == ma)"
] | false | 0.087883 | 0.035841 | 2.45205 | [
"s769969169",
"s093346969"
] |
u156815136 | p03240 | python | s539147230 | s226437936 | 57 | 50 | 5,148 | 10,364 | Accepted | Accepted | 12.28 | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | 54 | 53 | 1,360 | 1,360 | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | false | 1.851852 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"-from collections import defaultdict",
"-import bisect",
"+from itertools import combinations, permutations, accumulate # (string,3) 3回... | false | 0.075444 | 0.07055 | 1.069366 | [
"s539147230",
"s226437936"
] |
u562935282 | p02623 | python | s542193091 | s136854902 | 214 | 186 | 40,564 | 50,672 | Accepted | Accepted | 13.08 | def main():
N, M, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
*B, = list(map(int, input().split()))
s = 0
j = 0
while j < len(B) and s + B[j] <= K:
s += B[j]
j += 1
ans = cnt = j
j -= 1
for x in A:
while j >= 0 a... | # 解説
def main():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
def accumulate(a):
s = 0
yield s
for x in a:
s += x
yield s
*A, = accumulate(A)
*B, = accumulate(B)... | 30 | 30 | 563 | 516 | def main():
N, M, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
(*B,) = list(map(int, input().split()))
s = 0
j = 0
while j < len(B) and s + B[j] <= K:
s += B[j]
j += 1
ans = cnt = j
j -= 1
for x in A:
while j >= 0 and s + x > K:
... | # 解説
def main():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
def accumulate(a):
s = 0
yield s
for x in a:
s += x
yield s
(*A,) = accumulate(A)
(*B,) = accumulate(B)
ans = 0... | false | 0 | [
"+# 解説",
"- (*A,) = list(map(int, input().split()))",
"- (*B,) = list(map(int, input().split()))",
"- s = 0",
"- j = 0",
"- while j < len(B) and s + B[j] <= K:",
"- s += B[j]",
"- j += 1",
"- ans = cnt = j",
"- j -= 1",
"- for x in A:",
"- while j >... | false | 0.043877 | 0.070454 | 0.622776 | [
"s542193091",
"s136854902"
] |
u945359338 | p02658 | python | s767020893 | s835958845 | 94 | 76 | 21,528 | 21,700 | Accepted | Accepted | 19.15 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
l = 0;
flag = 0
for i in range(N):
if A[i]== 0:
print((0))
exit(0)
l+=(len(str(A[i])) -1)
if l>18:
flag=1
continue
ans*=A[i]
if ans > 1000000000000000000:
flag = 1
... | N=int(eval(input()))
A=list(map(int, input().split()))
A=sorted(A)
if A[0] == 0:
print((0))
exit(0)
ans = 1
for i in range(N):
ans*=A[i]
if(ans>1000000000000000000):
print((-1))
exit(0)
print(ans) | 25 | 14 | 365 | 216 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
l = 0
flag = 0
for i in range(N):
if A[i] == 0:
print((0))
exit(0)
l += len(str(A[i])) - 1
if l > 18:
flag = 1
continue
ans *= A[i]
if ans > 1000000000000000000:
flag = 1
if flag == 0:
prin... | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
if A[0] == 0:
print((0))
exit(0)
ans = 1
for i in range(N):
ans *= A[i]
if ans > 1000000000000000000:
print((-1))
exit(0)
print(ans)
| false | 44 | [
"+A = sorted(A)",
"+if A[0] == 0:",
"+ print((0))",
"+ exit(0)",
"-l = 0",
"-flag = 0",
"- if A[i] == 0:",
"- print((0))",
"- exit(0)",
"- l += len(str(A[i])) - 1",
"- if l > 18:",
"- flag = 1",
"- continue",
"- flag = 1",
"-if flag == 0:... | false | 0.040941 | 0.0914 | 0.447931 | [
"s767020893",
"s835958845"
] |
u977389981 | p03012 | python | s055712013 | s525267912 | 167 | 18 | 38,512 | 3,060 | Accepted | Accepted | 89.22 | N = int(eval(input()))
W = [int(i) for i in input().split()]
A = sum(W)
ans = float('inf')
for i in range(N):
tmp = abs(sum(W[: i]) - (A - sum(W[: i])))
ans = min(ans, tmp)
print(ans) | n = int(eval(input()))
W = list(map(int, input().split()))
diff = float('inf')
for i in range(1, n):
x = abs(sum(W[: i]) - sum(W[i :]))
if x < diff:
diff = x
print(diff) | 10 | 10 | 200 | 198 | N = int(eval(input()))
W = [int(i) for i in input().split()]
A = sum(W)
ans = float("inf")
for i in range(N):
tmp = abs(sum(W[:i]) - (A - sum(W[:i])))
ans = min(ans, tmp)
print(ans)
| n = int(eval(input()))
W = list(map(int, input().split()))
diff = float("inf")
for i in range(1, n):
x = abs(sum(W[:i]) - sum(W[i:]))
if x < diff:
diff = x
print(diff)
| false | 0 | [
"-N = int(eval(input()))",
"-W = [int(i) for i in input().split()]",
"-A = sum(W)",
"-ans = float(\"inf\")",
"-for i in range(N):",
"- tmp = abs(sum(W[:i]) - (A - sum(W[:i])))",
"- ans = min(ans, tmp)",
"-print(ans)",
"+n = int(eval(input()))",
"+W = list(map(int, input().split()))",
"+dif... | false | 0.047329 | 0.04111 | 1.151297 | [
"s055712013",
"s525267912"
] |
u940139461 | p03699 | python | s520654678 | s918478565 | 169 | 72 | 38,456 | 62,436 | Accepted | Accepted | 57.4 | n = int(eval(input()))
nums = []
for _ in range(n):
nums.append(int(eval(input())))
nums.sort()
ans = sum(nums)
if ans % 10 != 0:
print(ans)
else:
for num in nums:
t = ans - num
if t % 10 != 0:
print(t)
break
else:
print((0)) | import sys
n = int(eval(input()))
nums = []
for _ in range(n):
nums.append(int(eval(input())))
s = sum(nums)
if s % 10 != 0:
print(s)
else:
nums.sort()
for num in nums:
t = s - num
if t % 10 != 0:
print(t)
break
else:
print((0)) | 16 | 18 | 290 | 300 | n = int(eval(input()))
nums = []
for _ in range(n):
nums.append(int(eval(input())))
nums.sort()
ans = sum(nums)
if ans % 10 != 0:
print(ans)
else:
for num in nums:
t = ans - num
if t % 10 != 0:
print(t)
break
else:
print((0))
| import sys
n = int(eval(input()))
nums = []
for _ in range(n):
nums.append(int(eval(input())))
s = sum(nums)
if s % 10 != 0:
print(s)
else:
nums.sort()
for num in nums:
t = s - num
if t % 10 != 0:
print(t)
break
else:
print((0))
| false | 11.111111 | [
"+import sys",
"+",
"-nums.sort()",
"-ans = sum(nums)",
"-if ans % 10 != 0:",
"- print(ans)",
"+s = sum(nums)",
"+if s % 10 != 0:",
"+ print(s)",
"+ nums.sort()",
"- t = ans - num",
"+ t = s - num"
] | false | 0.088423 | 0.037555 | 2.354487 | [
"s520654678",
"s918478565"
] |
u707808519 | p02601 | python | s041230857 | s249940177 | 37 | 29 | 9,108 | 9,144 | Accepted | Accepted | 21.62 | a, b, c = list(map(int, input().split()))
K = int(eval(input()))
while K > 0:
if a >= b:
b *= 2
elif b >= c:
c *= 2
K -= 1
if a < b < c:
print('Yes')
else:
print('No') | A, B, C = list(map(int, input().split()))
K = int(eval(input()))
ans = 0
while B <= A:
B *= 2
ans += 1
while C <= B:
C *= 2
ans += 1
if ans <= K:
print('Yes')
else:
print('No') | 14 | 14 | 207 | 202 | a, b, c = list(map(int, input().split()))
K = int(eval(input()))
while K > 0:
if a >= b:
b *= 2
elif b >= c:
c *= 2
K -= 1
if a < b < c:
print("Yes")
else:
print("No")
| A, B, C = list(map(int, input().split()))
K = int(eval(input()))
ans = 0
while B <= A:
B *= 2
ans += 1
while C <= B:
C *= 2
ans += 1
if ans <= K:
print("Yes")
else:
print("No")
| false | 0 | [
"-a, b, c = list(map(int, input().split()))",
"+A, B, C = list(map(int, input().split()))",
"-while K > 0:",
"- if a >= b:",
"- b *= 2",
"- elif b >= c:",
"- c *= 2",
"- K -= 1",
"-if a < b < c:",
"+ans = 0",
"+while B <= A:",
"+ B *= 2",
"+ ans += 1",
"+while ... | false | 0.058368 | 0.088308 | 0.660962 | [
"s041230857",
"s249940177"
] |
u604774382 | p02407 | python | s876044985 | s030178445 | 30 | 20 | 6,728 | 4,192 | Accepted | Accepted | 33.33 | import sys
n = int( sys.stdin.readline() )
nums = sys.stdin.readline().rstrip().split( " " )
nums.reverse()
output = []
for i in range( n ):
output.append( nums[i] )
if i < (n-1):
output.append( " " )
print(( "".join( output ) )) | import sys
n = int( sys.stdin.readline() )
nums = sys.stdin.readline().rstrip().split( " " )
nums.reverse()
print(( " ".join( nums ) )) | 11 | 6 | 242 | 139 | import sys
n = int(sys.stdin.readline())
nums = sys.stdin.readline().rstrip().split(" ")
nums.reverse()
output = []
for i in range(n):
output.append(nums[i])
if i < (n - 1):
output.append(" ")
print(("".join(output)))
| import sys
n = int(sys.stdin.readline())
nums = sys.stdin.readline().rstrip().split(" ")
nums.reverse()
print((" ".join(nums)))
| false | 45.454545 | [
"-output = []",
"-for i in range(n):",
"- output.append(nums[i])",
"- if i < (n - 1):",
"- output.append(\" \")",
"-print((\"\".join(output)))",
"+print((\" \".join(nums)))"
] | false | 0.033374 | 0.035595 | 0.937604 | [
"s876044985",
"s030178445"
] |
u707614029 | p02812 | python | s579984542 | s574369008 | 27 | 23 | 9,048 | 8,960 | Accepted | Accepted | 14.81 | n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(n-2):
if s[i:i+3] == 'ABC':
cnt += 1
print(cnt)
| _ = eval(input())
print((input().count('ABC')))
| 7 | 2 | 118 | 41 | n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(n - 2):
if s[i : i + 3] == "ABC":
cnt += 1
print(cnt)
| _ = eval(input())
print((input().count("ABC")))
| false | 71.428571 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-cnt = 0",
"-for i in range(n - 2):",
"- if s[i : i + 3] == \"ABC\":",
"- cnt += 1",
"-print(cnt)",
"+_ = eval(input())",
"+print((input().count(\"ABC\")))"
] | false | 0.066876 | 0.066994 | 0.99824 | [
"s579984542",
"s574369008"
] |
u678167152 | p02788 | python | s625853956 | s715671080 | 1,603 | 1,256 | 75,992 | 109,500 | Accepted | Accepted | 21.65 | N, D, A = list(map(int, input().split()))
Monster = [0]*N
for i in range(N):
Monster[i] = list(map(int, input().split()))
Monster.sort(key=lambda x:x[0])
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from collections import deque
d = deque()
damage = 0
an... | from bisect import *
def solve():
ans = 0
N, D, A = list(map(int, input().split()))
B = [list(map(int, input().split())) for _ in range(N)]
B.sort()
lasts = [0]*(N+1)
now = 0
for i,((x,h),l) in enumerate(zip(B,lasts)):
now -= l
atack = max(0,-(-(h-now)//A))
ans += atack
damage ... | 31 | 19 | 723 | 454 | N, D, A = list(map(int, input().split()))
Monster = [0] * N
for i in range(N):
Monster[i] = list(map(int, input().split()))
Monster.sort(key=lambda x: x[0])
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from collections import deque
d = deque()
damage = 0
ans = 0
for i in ... | from bisect import *
def solve():
ans = 0
N, D, A = list(map(int, input().split()))
B = [list(map(int, input().split())) for _ in range(N)]
B.sort()
lasts = [0] * (N + 1)
now = 0
for i, ((x, h), l) in enumerate(zip(B, lasts)):
now -= l
atack = max(0, -(-(h - now) // A))
... | false | 38.709677 | [
"-N, D, A = list(map(int, input().split()))",
"-Monster = [0] * N",
"-for i in range(N):",
"- Monster[i] = list(map(int, input().split()))",
"-Monster.sort(key=lambda x: x[0])",
"-from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort",
"-from collections import deque... | false | 0.107768 | 0.044577 | 2.417577 | [
"s625853956",
"s715671080"
] |
u554198876 | p02412 | python | s663255493 | s799019147 | 800 | 50 | 7,744 | 7,712 | Accepted | Accepted | 93.75 | from itertools import combinations
while True:
n, x = [int(i) for i in input().split()]
if n == x == 0: break
count = 0
array = set(range(1, n+1))
for ele in combinations(array, 3):
if sum(ele) == x:
count += 1
print(count) | while True:
n,x = [int(i) for i in input().split()]
if n == 0 and x == 0: break
count = 0
# 3????????°?????????????°????x//3?????????x//3 * 3 == x ?????????????°????x//3??\?????§?????????????????????
for a in range(1, x//3):
# 3????????°?????????????????????x//2?????????x//2 * 2 == x ?... | 10 | 12 | 277 | 512 | from itertools import combinations
while True:
n, x = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
array = set(range(1, n + 1))
for ele in combinations(array, 3):
if sum(ele) == x:
count += 1
print(count)
| while True:
n, x = [int(i) for i in input().split()]
if n == 0 and x == 0:
break
count = 0
# 3????????°?????????????°????x//3?????????x//3 * 3 == x ?????????????°????x//3??\?????§?????????????????????
for a in range(1, x // 3):
# 3????????°?????????????????????x//2?????????x//2 * 2 =... | false | 16.666667 | [
"-from itertools import combinations",
"-",
"- if n == x == 0:",
"+ if n == 0 and x == 0:",
"- array = set(range(1, n + 1))",
"- for ele in combinations(array, 3):",
"- if sum(ele) == x:",
"- count += 1",
"+ # 3????????°?????????????°????x//3?????????x//3 * 3 == x ??... | false | 0.040961 | 0.036946 | 1.10867 | [
"s663255493",
"s799019147"
] |
u940102677 | p02898 | python | s772167013 | s332138822 | 485 | 52 | 20,988 | 11,916 | Accepted | Accepted | 89.28 | import numpy as np
n,k = list(map(int,input().split()))
h = np.array(list(map(int,input().split())))
print((sum(h >= k))) | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
c = 0
for x in h:
c += (x >= k)
print(c) | 4 | 6 | 116 | 113 | import numpy as np
n, k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())))
print((sum(h >= k)))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
c = 0
for x in h:
c += x >= k
print(c)
| false | 33.333333 | [
"-import numpy as np",
"-",
"-h = np.array(list(map(int, input().split())))",
"-print((sum(h >= k)))",
"+h = list(map(int, input().split()))",
"+c = 0",
"+for x in h:",
"+ c += x >= k",
"+print(c)"
] | false | 0.700624 | 0.045101 | 15.534615 | [
"s772167013",
"s332138822"
] |
u509392332 | p02753 | python | s778364791 | s936516831 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S = list(i for i in eval(input()))
if 'A' in S and 'B' in S:
print('Yes')
else:
print('No') | S = eval(input())
S_list = [i for i in S]
S_set = set(S_list)
if len(S_set) == 2:
print('Yes')
else:
print('No') | 6 | 9 | 95 | 120 | S = list(i for i in eval(input()))
if "A" in S and "B" in S:
print("Yes")
else:
print("No")
| S = eval(input())
S_list = [i for i in S]
S_set = set(S_list)
if len(S_set) == 2:
print("Yes")
else:
print("No")
| false | 33.333333 | [
"-S = list(i for i in eval(input()))",
"-if \"A\" in S and \"B\" in S:",
"+S = eval(input())",
"+S_list = [i for i in S]",
"+S_set = set(S_list)",
"+if len(S_set) == 2:"
] | false | 0.042676 | 0.04364 | 0.977908 | [
"s778364791",
"s936516831"
] |
u729133443 | p02790 | python | s687644352 | s954955187 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | a,b=input().split()
print((min(a*int(b),b*int(a)))) | _,a,b=sorted(eval(input()));print((a*int(b))) | 2 | 1 | 50 | 37 | a, b = input().split()
print((min(a * int(b), b * int(a))))
| _, a, b = sorted(eval(input()))
print((a * int(b)))
| false | 50 | [
"-a, b = input().split()",
"-print((min(a * int(b), b * int(a))))",
"+_, a, b = sorted(eval(input()))",
"+print((a * int(b)))"
] | false | 0.071228 | 0.038296 | 1.859943 | [
"s687644352",
"s954955187"
] |
u953237709 | p03061 | python | s879185532 | s222313784 | 258 | 211 | 63,856 | 14,076 | Accepted | Accepted | 18.22 | def gcd(x, y):
while (y):
x, y = y, x % y
return x
n = int(eval(input()))
a = list(map(int, input().split()))
fromLeft = [0] * n
fromLeft[0] = a[0]
fromRight = [0] * n
fromRight[0] = a[n - 1]
for i in range(1, n):
fromLeft[i] = gcd(fromLeft[i - 1], a[i])
fromRight[i] = gcd(fromRigh... | n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
fromLeft = [a[0]] + [None] * (n - 1)
for i in range(1, n):
fromLeft[i] = gcd(fromLeft[i - 1], a[i])
fromRight = [None] * (n - 1) + [a[-1]]
for i in range(n - 2, -1, -1):
fro... | 24 | 24 | 599 | 619 | def gcd(x, y):
while y:
x, y = y, x % y
return x
n = int(eval(input()))
a = list(map(int, input().split()))
fromLeft = [0] * n
fromLeft[0] = a[0]
fromRight = [0] * n
fromRight[0] = a[n - 1]
for i in range(1, n):
fromLeft[i] = gcd(fromLeft[i - 1], a[i])
fromRight[i] = gcd(fromRight[i - 1], a[n ... | n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
fromLeft = [a[0]] + [None] * (n - 1)
for i in range(1, n):
fromLeft[i] = gcd(fromLeft[i - 1], a[i])
fromRight = [None] * (n - 1) + [a[-1]]
for i in range(n - 2, -1, -1):
fromRight[i] =... | false | 0 | [
"-def gcd(x, y):",
"- while y:",
"- x, y = y, x % y",
"- return x",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-fromLeft = [0] * n",
"-fromLeft[0] = a[0]",
"-fromRight = [0] * n",
"-fromRig... | false | 0.135425 | 0.105349 | 1.285494 | [
"s879185532",
"s222313784"
] |
u917382715 | p03478 | python | s809945585 | s134150711 | 37 | 30 | 3,060 | 3,060 | Accepted | Accepted | 18.92 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n+1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
sum = 0
for i in range(n + 1):
sum2 = 0
j = i
while j != 0:
sum2 += j % 10
j = j // 10
if sum2 >= a and sum2 <= b:
sum += i
print(sum) | 6 | 13 | 150 | 224 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
sum = 0
for i in range(n + 1):
sum2 = 0
j = i
while j != 0:
sum2 += j % 10
j = j // 10
if sum2 >= a and sum2 <= b:
sum += i
print(sum)
| false | 53.846154 | [
"-ans = 0",
"+sum = 0",
"- if a <= sum(list(map(int, list(str(i))))) <= b:",
"- ans += i",
"-print(ans)",
"+ sum2 = 0",
"+ j = i",
"+ while j != 0:",
"+ sum2 += j % 10",
"+ j = j // 10",
"+ if sum2 >= a and sum2 <= b:",
"+ sum += i",
"+print(sum)"
] | false | 0.059622 | 0.055715 | 1.070113 | [
"s809945585",
"s134150711"
] |
u912237403 | p02397 | python | s890819444 | s350862140 | 30 | 20 | 4,236 | 4,204 | Accepted | Accepted | 33.33 | import sys
for line in sys.stdin:
a,b = line.split()
a,b = int(a),int(b)
if a == 0 and b == 0: break
if b<a: a,b = b,a
print('%d %d' %(a, b)) | while True:
a, b = sorted(map(int, input().split()))
if (a, b) == (0, 0): break
print(a, b) | 7 | 4 | 166 | 109 | import sys
for line in sys.stdin:
a, b = line.split()
a, b = int(a), int(b)
if a == 0 and b == 0:
break
if b < a:
a, b = b, a
print("%d %d" % (a, b))
| while True:
a, b = sorted(map(int, input().split()))
if (a, b) == (0, 0):
break
print(a, b)
| false | 42.857143 | [
"-import sys",
"-",
"-for line in sys.stdin:",
"- a, b = line.split()",
"- a, b = int(a), int(b)",
"- if a == 0 and b == 0:",
"+while True:",
"+ a, b = sorted(map(int, input().split()))",
"+ if (a, b) == (0, 0):",
"- if b < a:",
"- a, b = b, a",
"- print(\"%d %d\" %... | false | 0.050849 | 0.066341 | 0.766476 | [
"s890819444",
"s350862140"
] |
u934442292 | p03048 | python | s186320530 | s314686202 | 881 | 18 | 2,940 | 3,060 | Accepted | Accepted | 97.96 | import sys
input = sys.stdin.readline
def main():
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
gGbB = N - r * R
for g in range(gGbB // G + 1):
bB = gGbB - g * G
if bB % B == 0:
ans += 1
p... | import sys
input = sys.stdin.readline
def main():
R, G, B, N = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for c in [R, G, B]:
for i in range(N - c + 1):
dp[i + c] += dp[i]
ans = dp[N]
print(ans)
if __name__ == "__main__":
main()... | 21 | 20 | 368 | 315 | import sys
input = sys.stdin.readline
def main():
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
gGbB = N - r * R
for g in range(gGbB // G + 1):
bB = gGbB - g * G
if bB % B == 0:
ans += 1
print(ans)
if __name_... | import sys
input = sys.stdin.readline
def main():
R, G, B, N = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for c in [R, G, B]:
for i in range(N - c + 1):
dp[i + c] += dp[i]
ans = dp[N]
print(ans)
if __name__ == "__main__":
main()
| false | 4.761905 | [
"- ans = 0",
"- for r in range(N // R + 1):",
"- gGbB = N - r * R",
"- for g in range(gGbB // G + 1):",
"- bB = gGbB - g * G",
"- if bB % B == 0:",
"- ans += 1",
"+ dp = [0] * (N + 1)",
"+ dp[0] = 1",
"+ for c in [R, G, B]:",
"+ ... | false | 0.15004 | 0.042162 | 3.558658 | [
"s186320530",
"s314686202"
] |
u506858457 | p03162 | python | s111036507 | s021944283 | 1,226 | 1,056 | 47,636 | 47,344 | Accepted | Accepted | 13.87 | N=int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
dp=[[0 for j in range(3)] for i in range(N)]
ans=0
for i in range(N):
for P in range(3):
for PY in range(3):
if P==PY:
continue
elif i==0:
dp[i][P]=L[i][P]
ans=max(ans,dp[i][P])
else:... | N=int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
dp=[[0 for j in range(3)] for i in range(N)]
for i in range(N):
for P in range(3):
for PY in range(3):
if P==PY:
continue
elif i==0:
dp[i][P]=L[i][P]
else:
dp[i][P]=max(dp[i][P],dp[i... | 21 | 17 | 470 | 396 | N = int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
dp = [[0 for j in range(3)] for i in range(N)]
ans = 0
for i in range(N):
for P in range(3):
for PY in range(3):
if P == PY:
continue
elif i == 0:
dp[i][P] = L[i][P]
... | N = int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
dp = [[0 for j in range(3)] for i in range(N)]
for i in range(N):
for P in range(3):
for PY in range(3):
if P == PY:
continue
elif i == 0:
dp[i][P] = L[i][P]
els... | false | 19.047619 | [
"-ans = 0",
"- ans = max(ans, dp[i][P])",
"- ans = max(ans, dp[i][P])",
"-\"\"\"",
"+ans = 0",
"- ans=max(ans,dp[N-1][i])",
"-\"\"\"",
"+ ans = max(ans, dp[N - 1][i])"
] | false | 0.033166 | 0.042301 | 0.784064 | [
"s111036507",
"s021944283"
] |
u640319601 | p03240 | python | s737036875 | s818759352 | 405 | 33 | 3,064 | 3,064 | Accepted | Accepted | 91.85 | N = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(N)]
for x, y, h in l:
if h == 0:
continue
for Cx in range(0, 101):
for Cy in range(0, 101):
H = abs(Cx-x) + abs(Cy-y) + h
if all([hh == max(H - abs(Cx-xx) - abs(Cy-yy), 0) for xx, yy, hh ... | N = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(N)]
for x, y, h in l:
if h == 0:
continue
for Cx in range(0, 101):
for Cy in range(0, 101):
H = abs(Cx-x) + abs(Cy-y) + h
if all(hh == max(H - abs(Cx-xx) - abs(Cy-yy), 0) for xx, yy, hh i... | 12 | 13 | 379 | 395 | N = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(N)]
for x, y, h in l:
if h == 0:
continue
for Cx in range(0, 101):
for Cy in range(0, 101):
H = abs(Cx - x) + abs(Cy - y) + h
if all([hh == max(H - abs(Cx - xx) - abs(Cy - yy), 0) for xx, yy, hh in... | N = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(N)]
for x, y, h in l:
if h == 0:
continue
for Cx in range(0, 101):
for Cy in range(0, 101):
H = abs(Cx - x) + abs(Cy - y) + h
if all(hh == max(H - abs(Cx - xx) - abs(Cy - yy), 0) for xx, yy, hh in ... | false | 7.692308 | [
"- if all([hh == max(H - abs(Cx - xx) - abs(Cy - yy), 0) for xx, yy, hh in l]):",
"+ if all(hh == max(H - abs(Cx - xx) - abs(Cy - yy), 0) for xx, yy, hh in l):"
] | false | 0.048721 | 0.038682 | 1.259532 | [
"s737036875",
"s818759352"
] |
u392319141 | p03557 | python | s881859193 | s161453214 | 439 | 350 | 40,876 | 22,968 | Accepted | Accepted | 20.27 | from bisect import bisect_left
from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
AB = defaultdict(int)
for b in B:
AB[b] = bisect_left(A, b)
sumAB = defaultdict... | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')
def sol():
N = int(eval(input()))
A = list(map(int, i... | 30 | 28 | 496 | 592 | from bisect import bisect_left
from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
AB = defaultdict(int)
for b in B:
AB[b] = bisect_left(A, b)
sumAB = defaultdict(int)
sumAB[0] = 0
s... | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf")
def sol():
N = int(eval(input()))
A = list(map(int, input().split... | false | 6.666667 | [
"-from bisect import bisect_left",
"-from collections import defaultdict",
"+import sys",
"+import heapq",
"+from operator import itemgetter",
"+from collections import deque, defaultdict, Counter",
"+from bisect import bisect_left, bisect_right",
"-N = int(eval(input()))",
"-A = list(map(int, input... | false | 0.045244 | 0.126761 | 0.35692 | [
"s881859193",
"s161453214"
] |
u022407960 | p02366 | python | s229192755 | s805095937 | 180 | 160 | 23,568 | 23,608 | Accepted | Accepted | 11.11 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 4
0 1
1 2
2 3
3 4
output:
1
2
3
"""
import sys
sys.setrecursionlimit(int(3e6))
UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2
def generate_adj_table(_v_info):
for v_detail in _v_info:
v_from, v_to = map(int, v_det... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 4
0 1
1 2
2 3
3 4
output:
1
2
3
"""
import sys
sys.setrecursionlimit(int(3e6))
UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2
def generate_adj_table(_v_info):
for v_detail in _v_info:
v_from, v_to = map(int, v_det... | 90 | 88 | 1,963 | 1,934 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 4
0 1
1 2
2 3
3 4
output:
1
2
3
"""
import sys
sys.setrecursionlimit(int(3e6))
UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2
def generate_adj_table(_v_info):
for v_detail in _v_info:
v_from, v_to = map(int, v_detail)
init_adj_table[v_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 4
0 1
1 2
2 3
3 4
output:
1
2
3
"""
import sys
sys.setrecursionlimit(int(3e6))
UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2
def generate_adj_table(_v_info):
for v_detail in _v_info:
v_from, v_to = map(int, v_detail)
init_adj_table[v_... | false | 2.222222 | [
"- timer = 1",
"+ timer = 0",
"- if not res:",
"- pass",
"- else:",
"+ if res:"
] | false | 0.046888 | 0.049632 | 0.944722 | [
"s229192755",
"s805095937"
] |
u102461423 | p03375 | python | s442383407 | s220053232 | 1,312 | 975 | 223,556 | 293,928 | Accepted | Accepted | 25.69 | import sys
input = sys.stdin.readline
import numpy as np
N,MOD = list(map(int,input().split()))
"""
余事象を調べる。包除の原理を使う。
A[n] = (1,2,...,n)が1杯以下、他は何でも良い
B[n,l] : (1,2,...,n) をlグループに分ける方法の個数
A[n]
・0杯のグループあり
・なし
"""
B = np.zeros((N+1,N+1), dtype=np.int64)
B[0,0] = 1
for n in range(1,N+1):
# 1番を単独で使う... | import sys
input = sys.stdin.readline
import numpy as np
N,MOD = list(map(int,input().split()))
"""
余事象を調べる。包除の原理を使う。
A[n] = (1,2,...,n)が1杯以下、他は何でも良い
B[n,l] : (1,2,...,n) をlグループに分ける方法の個数
A[n]
・0杯のグループあり
・なし
"""
B = np.zeros((N+1,N+1), dtype=np.int64)
B[0,0] = 1
for n in range(1,N+1):
# 1番を単独で使う... | 47 | 59 | 1,075 | 1,358 | import sys
input = sys.stdin.readline
import numpy as np
N, MOD = list(map(int, input().split()))
"""
余事象を調べる。包除の原理を使う。
A[n] = (1,2,...,n)が1杯以下、他は何でも良い
B[n,l] : (1,2,...,n) をlグループに分ける方法の個数
A[n]
・0杯のグループあり
・なし
"""
B = np.zeros((N + 1, N + 1), dtype=np.int64)
B[0, 0] = 1
for n in range(1, N + 1):
# 1番を単独で使う
B[n... | import sys
input = sys.stdin.readline
import numpy as np
N, MOD = list(map(int, input().split()))
"""
余事象を調べる。包除の原理を使う。
A[n] = (1,2,...,n)が1杯以下、他は何でも良い
B[n,l] : (1,2,...,n) をlグループに分ける方法の個数
A[n]
・0杯のグループあり
・なし
"""
B = np.zeros((N + 1, N + 1), dtype=np.int64)
B[0, 0] = 1
for n in range(1, N + 1):
# 1番を単独で使う
B[n... | false | 20.338983 | [
"-A = np.zeros(N + 1, dtype=np.int64)",
"-for n in range(N + 1):",
"- A[n] = (",
"- pow(2, pow(2, N - n, MOD - 1), MOD)",
"- * B[n, 1:]",
"- % MOD",
"- * (pow_2[N - n, 1:] + pow_2[N - n, :-1] * np.arange(1, N + 1) % MOD)",
"- % MOD",
"- ).sum() % MOD",
"-co... | false | 0.578291 | 0.229408 | 2.520798 | [
"s442383407",
"s220053232"
] |
u488401358 | p03032 | python | s885246709 | s114697961 | 302 | 164 | 50,268 | 83,572 | Accepted | Accepted | 45.7 | import copy,heapq
N,K=list(map(int,input().split()))
V=list(map(int,input().split()))
ans=0
left=copy.copy(V)
for i in range(1,N):
left[i]+=left[i-1]
right=copy.copy(V)
for i in range(1,N):
right[-i-1]+=right[-i]
for i in range(0,N+1):
for j in range(0,N-i+1):
dispose=K-i-j
... | import random
N,K=list(map(int,input().split()))
V=list(map(int,input().split()))
if K==0:
print((0))
exit()
if 0:
V=[random.randint(-10**7,10**7) for i in range(N)]
ans=-float("inf")
for i in range(N+1):
for j in range(N-i+1):
if i+j>K:
continue
tmp=[V... | 37 | 34 | 768 | 686 | import copy, heapq
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
left = copy.copy(V)
for i in range(1, N):
left[i] += left[i - 1]
right = copy.copy(V)
for i in range(1, N):
right[-i - 1] += right[-i]
for i in range(0, N + 1):
for j in range(0, N - i + 1):
dispos... | import random
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
if K == 0:
print((0))
exit()
if 0:
V = [random.randint(-(10**7), 10**7) for i in range(N)]
ans = -float("inf")
for i in range(N + 1):
for j in range(N - i + 1):
if i + j > K:
continue
tm... | false | 8.108108 | [
"-import copy, heapq",
"+import random",
"-ans = 0",
"-left = copy.copy(V)",
"-for i in range(1, N):",
"- left[i] += left[i - 1]",
"-right = copy.copy(V)",
"-for i in range(1, N):",
"- right[-i - 1] += right[-i]",
"-for i in range(0, N + 1):",
"- for j in range(0, N - i + 1):",
"- ... | false | 0.038326 | 0.122409 | 0.313094 | [
"s885246709",
"s114697961"
] |
u659159398 | p02714 | python | s848276797 | s407539702 | 875 | 164 | 72,644 | 68,972 | Accepted | Accepted | 81.26 | n = int(eval(input()))
s = eval(input())
rinds, ginds, binds = [], [], []
for i in range(n):
if s[i] == 'R': rinds.append(i)
elif s[i] == 'G': ginds.append(i)
else: binds.append(i)
rlen, glen, blen = len(rinds), len(ginds), len(binds)
def binsearch_same(binds, blen, dist, i):
lo, hi =... | n = int(eval(input()))
s = eval(input())
rinds, ginds, binds = [], [], set()
for i in range(n):
if s[i] == 'R': rinds.append(i)
elif s[i] == 'G': ginds.append(i)
else: binds.add(i)
rlen, glen, blen = len(rinds), len(ginds), len(binds)
ans = 0
for i in rinds:
for j in ginds:
... | 50 | 79 | 1,031 | 1,415 | n = int(eval(input()))
s = eval(input())
rinds, ginds, binds = [], [], []
for i in range(n):
if s[i] == "R":
rinds.append(i)
elif s[i] == "G":
ginds.append(i)
else:
binds.append(i)
rlen, glen, blen = len(rinds), len(ginds), len(binds)
def binsearch_same(binds, blen, dist, i):
l... | n = int(eval(input()))
s = eval(input())
rinds, ginds, binds = [], [], set()
for i in range(n):
if s[i] == "R":
rinds.append(i)
elif s[i] == "G":
ginds.append(i)
else:
binds.add(i)
rlen, glen, blen = len(rinds), len(ginds), len(binds)
ans = 0
for i in rinds:
for j in ginds:
... | false | 36.708861 | [
"-rinds, ginds, binds = [], [], []",
"+rinds, ginds, binds = [], [], set()",
"- binds.append(i)",
"+ binds.add(i)",
"-",
"-",
"-def binsearch_same(binds, blen, dist, i):",
"- lo, hi = 0, blen - 1",
"- while lo <= hi:",
"- mid = lo + (hi - lo) // 2",
"- d = binds... | false | 0.040743 | 0.036433 | 1.1183 | [
"s848276797",
"s407539702"
] |
u883048396 | p03946 | python | s126990505 | s085913789 | 118 | 81 | 15,060 | 14,252 | Accepted | Accepted | 31.36 |
iN,iT = [int(_) for _ in input().split()]
aA = [int(_) for _ in input().split()]
iL = len(aA)
aMaxD = [0]
iMin = aA[0]
iV = 0
def checkMax(aMaxD,iMaxD):
if aMaxD[0] < iMaxD:
aMaxD = [iMaxD]
elif aMaxD[0] == iMaxD:
aMaxD.append(iMaxD)
return aMaxD
for i in range(1,iL):
... | def 解():
iN,iT = [int(_) for _ in input().split()]
aA = [int(_) for _ in input().split()]
iL = len(aA)
aMaxD = [0]
iMin = aA[0]
iV = 0
def checkMax(aMaxD,iMaxD):
if aMaxD[0] < iMaxD:
aMaxD = [iMaxD]
elif aMaxD[0] == iMaxD:
aMaxD.append(i... | 29 | 30 | 608 | 708 | iN, iT = [int(_) for _ in input().split()]
aA = [int(_) for _ in input().split()]
iL = len(aA)
aMaxD = [0]
iMin = aA[0]
iV = 0
def checkMax(aMaxD, iMaxD):
if aMaxD[0] < iMaxD:
aMaxD = [iMaxD]
elif aMaxD[0] == iMaxD:
aMaxD.append(iMaxD)
return aMaxD
for i in range(1, iL):
iB = aA[i - ... | def 解():
iN, iT = [int(_) for _ in input().split()]
aA = [int(_) for _ in input().split()]
iL = len(aA)
aMaxD = [0]
iMin = aA[0]
iV = 0
def checkMax(aMaxD, iMaxD):
if aMaxD[0] < iMaxD:
aMaxD = [iMaxD]
elif aMaxD[0] == iMaxD:
aMaxD.append(iMaxD)
... | false | 3.333333 | [
"-iN, iT = [int(_) for _ in input().split()]",
"-aA = [int(_) for _ in input().split()]",
"-iL = len(aA)",
"-aMaxD = [0]",
"-iMin = aA[0]",
"-iV = 0",
"+def 解():",
"+ iN, iT = [int(_) for _ in input().split()]",
"+ aA = [int(_) for _ in input().split()]",
"+ iL = len(aA)",
"+ aMaxD =... | false | 0.039996 | 0.109827 | 0.364169 | [
"s126990505",
"s085913789"
] |
u188138642 | p02886 | python | s416765897 | s106643360 | 34 | 27 | 9,012 | 9,060 | Accepted | Accepted | 20.59 | from itertools import combinations
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
d = combinations(d, 2)
for i, j in d:
ans += i*j
print(ans)
| from itertools import combinations
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
sum = sum(d)
for i in d:
sum -= i
ans += i*sum
print(ans) | 9 | 10 | 169 | 171 | from itertools import combinations
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
d = combinations(d, 2)
for i, j in d:
ans += i * j
print(ans)
| from itertools import combinations
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
sum = sum(d)
for i in d:
sum -= i
ans += i * sum
print(ans)
| false | 10 | [
"-d = combinations(d, 2)",
"-for i, j in d:",
"- ans += i * j",
"+sum = sum(d)",
"+for i in d:",
"+ sum -= i",
"+ ans += i * sum"
] | false | 0.041936 | 0.046202 | 0.907662 | [
"s416765897",
"s106643360"
] |
u099300051 | p02646 | python | s604764746 | s411827729 | 23 | 20 | 9,056 | 9,060 | Accepted | Accepted | 13.04 | a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
print(('YES' if abs(b-a) <= (v-w) * t else 'NO'))
| A,V=list(map(int,input().split()))
B,W=list(map(int,input().split()))
T=int(eval(input()))
v=V-W
l=abs(A-B)
if l<=v*T:
print("YES")
else:
print("NO")
| 5 | 9 | 136 | 144 | a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
print(("YES" if abs(b - a) <= (v - w) * t else "NO"))
| A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))
v = V - W
l = abs(A - B)
if l <= v * T:
print("YES")
else:
print("NO")
| false | 44.444444 | [
"-a, v = list(map(int, input().split()))",
"-b, w = list(map(int, input().split()))",
"-t = int(eval(input()))",
"-print((\"YES\" if abs(b - a) <= (v - w) * t else \"NO\"))",
"+A, V = list(map(int, input().split()))",
"+B, W = list(map(int, input().split()))",
"+T = int(eval(input()))",
"+v = V - W",
... | false | 0.035109 | 0.037502 | 0.936201 | [
"s604764746",
"s411827729"
] |
u882359130 | p03252 | python | s474477131 | s288529486 | 496 | 148 | 22,744 | 3,760 | Accepted | Accepted | 70.16 | S = eval(input())
T = eval(input())
SS = [s for s in S]
SS_set = list(set(SS))
CS = []
for c in SS_set:
C_idx_in_S = [i for i, x in enumerate(SS) if x==c]
if len(C_idx_in_S) > 1:
CS.append(C_idx_in_S)
TT = [t for t in T]
TT_set = list(set(TT))
CT = []
for c in TT_set:
C_idx_in_T = [i for i, x... | #解説
S = eval(input())
T = eval(input())
start = [-1]*26
goal = [-1]*26
for i in range(len(S)):
a = ord(S[i]) - ord("a")
b = ord(T[i]) - ord("a")
if start[a] != -1 or goal[b] != -1:
if start[a] != b or goal[b] != a:
print("No")
break
else:
start[a] = b
goal[b] = a
e... | 30 | 20 | 555 | 328 | S = eval(input())
T = eval(input())
SS = [s for s in S]
SS_set = list(set(SS))
CS = []
for c in SS_set:
C_idx_in_S = [i for i, x in enumerate(SS) if x == c]
if len(C_idx_in_S) > 1:
CS.append(C_idx_in_S)
TT = [t for t in T]
TT_set = list(set(TT))
CT = []
for c in TT_set:
C_idx_in_T = [i for i, x in e... | # 解説
S = eval(input())
T = eval(input())
start = [-1] * 26
goal = [-1] * 26
for i in range(len(S)):
a = ord(S[i]) - ord("a")
b = ord(T[i]) - ord("a")
if start[a] != -1 or goal[b] != -1:
if start[a] != b or goal[b] != a:
print("No")
break
else:
start[a] = b
... | false | 33.333333 | [
"+# 解説",
"-SS = [s for s in S]",
"-SS_set = list(set(SS))",
"-CS = []",
"-for c in SS_set:",
"- C_idx_in_S = [i for i, x in enumerate(SS) if x == c]",
"- if len(C_idx_in_S) > 1:",
"- CS.append(C_idx_in_S)",
"-TT = [t for t in T]",
"-TT_set = list(set(TT))",
"-CT = []",
"-for c in ... | false | 0.047834 | 0.047661 | 1.003631 | [
"s474477131",
"s288529486"
] |
u111365362 | p02990 | python | s025083912 | s803621561 | 23 | 21 | 3,316 | 3,316 | Accepted | Accepted | 8.7 | n,k = list(map(int,input().split()))
m = 10**9+7
a = 1
b = n-k+1
print((a*b%m))
for i in range(2,k+1):
a *= k+1-i
a //= i-1
at = a%m
b *= n-k+2-i
b //= i
bt = b%m
print((at*bt%m)) | n,k = list(map(int,input().split()))
m = 10**9+7
b = 1
r = n-k+1
print((b*r%m))
for i in range(2,k+1):
b *= k-i+1
b //= i-1
r *= n-k-i+2
r //= i
print((b*r%m)) | 13 | 11 | 201 | 169 | n, k = list(map(int, input().split()))
m = 10**9 + 7
a = 1
b = n - k + 1
print((a * b % m))
for i in range(2, k + 1):
a *= k + 1 - i
a //= i - 1
at = a % m
b *= n - k + 2 - i
b //= i
bt = b % m
print((at * bt % m))
| n, k = list(map(int, input().split()))
m = 10**9 + 7
b = 1
r = n - k + 1
print((b * r % m))
for i in range(2, k + 1):
b *= k - i + 1
b //= i - 1
r *= n - k - i + 2
r //= i
print((b * r % m))
| false | 15.384615 | [
"-a = 1",
"-b = n - k + 1",
"-print((a * b % m))",
"+b = 1",
"+r = n - k + 1",
"+print((b * r % m))",
"- a *= k + 1 - i",
"- a //= i - 1",
"- at = a % m",
"- b *= n - k + 2 - i",
"- b //= i",
"- bt = b % m",
"- print((at * bt % m))",
"+ b *= k - i + 1",
"+ b //... | false | 0.04264 | 0.042074 | 1.013462 | [
"s025083912",
"s803621561"
] |
u298297089 | p02995 | python | s600777215 | s339212347 | 40 | 35 | 5,048 | 5,076 | Accepted | Accepted | 12.5 | import fractions
A, B, C, D = list(map(int, input().split()))
total = B - A + 1
Cdiv = B // C - (A-1) // C
Ddiv = B // D - (A-1) // D
cddiv = (C*D)//fractions.gcd(C,D)
CDdiv = B // (cddiv) - (A-1) // (cddiv)
print((total - Cdiv - Ddiv + CDdiv))
| from fractions import gcd
A,B,C,D = list(map(int, input().split()))
E = (C*D) // gcd(C,D)
x = (A-1) // C
y = (A-1) // D
z = (A-1) // E
xx = B // C
yy = B // D
zz = B // E
Cdiv = xx-x
Ddiv = yy-y
Ediv = zz-z
tmp = xx-x + yy-y - (zz-z)
total = B-A+1
print((int(total - Cdiv - Ddiv + Ediv)))
| 9 | 18 | 247 | 301 | import fractions
A, B, C, D = list(map(int, input().split()))
total = B - A + 1
Cdiv = B // C - (A - 1) // C
Ddiv = B // D - (A - 1) // D
cddiv = (C * D) // fractions.gcd(C, D)
CDdiv = B // (cddiv) - (A - 1) // (cddiv)
print((total - Cdiv - Ddiv + CDdiv))
| from fractions import gcd
A, B, C, D = list(map(int, input().split()))
E = (C * D) // gcd(C, D)
x = (A - 1) // C
y = (A - 1) // D
z = (A - 1) // E
xx = B // C
yy = B // D
zz = B // E
Cdiv = xx - x
Ddiv = yy - y
Ediv = zz - z
tmp = xx - x + yy - y - (zz - z)
total = B - A + 1
print((int(total - Cdiv - Ddiv + Ediv)))
| false | 50 | [
"-import fractions",
"+from fractions import gcd",
"+E = (C * D) // gcd(C, D)",
"+x = (A - 1) // C",
"+y = (A - 1) // D",
"+z = (A - 1) // E",
"+xx = B // C",
"+yy = B // D",
"+zz = B // E",
"+Cdiv = xx - x",
"+Ddiv = yy - y",
"+Ediv = zz - z",
"+tmp = xx - x + yy - y - (zz - z)",
"-Cdiv =... | false | 0.053354 | 0.053956 | 0.988837 | [
"s600777215",
"s339212347"
] |
u075304271 | p02603 | python | s797441671 | s796331000 | 122 | 42 | 77,456 | 10,448 | Accepted | Accepted | 65.57 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def divis(l):
seq = []
beg, end = 0, 0
le = len(l)
for i in range(1,le):
end = i
if l[i] < l[i-1]:
seq.append(l[beg:end])
beg = i
... | import math
import collections
import fractions
import itertools
import functools
import operator
def divis(l):
seq = []
beg, end = 0, 0
le = len(l)
for i in range(1,le):
end = i
if l[i] < l[i-1]:
seq.append(l[beg:end])
beg = i
seq.append(l[be... | 32 | 31 | 620 | 597 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def divis(l):
seq = []
beg, end = 0, 0
le = len(l)
for i in range(1, le):
end = i
if l[i] < l[i - 1]:
seq.append(l[beg:end])
beg = i
seq.append(l[... | import math
import collections
import fractions
import itertools
import functools
import operator
def divis(l):
seq = []
beg, end = 0, 0
le = len(l)
for i in range(1, le):
end = i
if l[i] < l[i - 1]:
seq.append(l[beg:end])
beg = i
seq.append(l[beg : end + 1]... | false | 3.125 | [
"-import bisect",
"- divia = divis(a)",
"- saihu = 1000",
"- for i in divia:",
"- saihu += (i[-1] - i[0]) * (saihu // i[0])",
"- print(saihu)",
"+ a = divis(a)",
"+ yosan = 1000",
"+ for i in a:",
"+ yosan += (i[-1] - i[0]) * (yosan // i[0])",
"+ print(yosan... | false | 0.03499 | 0.034739 | 1.007227 | [
"s797441671",
"s796331000"
] |
u488127128 | p03796 | python | s539397344 | s735468002 | 38 | 34 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
a = 1
for n in range(2,N+1):
a = a*n % (10**9+7)
print(a) | import math
N = int(eval(input()))
a = 1
for n in range(2,N+1):
a = a*n % (10**9+7)
print(a) | 5 | 6 | 82 | 95 | N = int(eval(input()))
a = 1
for n in range(2, N + 1):
a = a * n % (10**9 + 7)
print(a)
| import math
N = int(eval(input()))
a = 1
for n in range(2, N + 1):
a = a * n % (10**9 + 7)
print(a)
| false | 16.666667 | [
"+import math",
"+"
] | false | 0.061577 | 0.081583 | 0.754776 | [
"s539397344",
"s735468002"
] |
u130900604 | p02707 | python | s770685545 | s335884551 | 196 | 170 | 34,096 | 36,364 | Accepted | Accepted | 13.27 | from collections import Counter
def LI():return list(map(int,input().split()))
n=int(eval(input()))
a=LI()
c=Counter(a)
for i in range(1,n+1):
ans=c[i]
print(ans)
| from collections import*
n,*a=list(map(int,open(0).read().split()));c=Counter(a)
for i in range(n):print((c[i+1])) | 12 | 3 | 180 | 108 | from collections import Counter
def LI():
return list(map(int, input().split()))
n = int(eval(input()))
a = LI()
c = Counter(a)
for i in range(1, n + 1):
ans = c[i]
print(ans)
| from collections import *
n, *a = list(map(int, open(0).read().split()))
c = Counter(a)
for i in range(n):
print((c[i + 1]))
| false | 75 | [
"-from collections import Counter",
"+from collections import *",
"-",
"-def LI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-n = int(eval(input()))",
"-a = LI()",
"+n, *a = list(map(int, open(0).read().split()))",
"-for i in range(1, n + 1):",
"- ans = c[i]",
"- prin... | false | 0.034806 | 0.041793 | 0.832817 | [
"s770685545",
"s335884551"
] |
u891635666 | p03241 | python | s575573951 | s764660547 | 29 | 21 | 3,664 | 3,060 | Accepted | Accepted | 27.59 | import collections
import itertools
import math
def eratosthenes(n):
sieve = [True for _ in range(n + 1)]
sieve[0] = False
sieve[1] = False
def _update(p):
if sieve[p]:
for i in range(p * 2, n + 1, p):
sieve[i] = False
_update(2)
p = 3
... | import math
n, m = list(map(int, input().split()))
mm = m // n
res = []
for k in range(int(math.sqrt(m)), 0, -1):
if m % k == 0:
if k > mm:
continue
if m // k <= mm:
k = m // k
res.append(k)
print((max(res))) | 46 | 13 | 928 | 265 | import collections
import itertools
import math
def eratosthenes(n):
sieve = [True for _ in range(n + 1)]
sieve[0] = False
sieve[1] = False
def _update(p):
if sieve[p]:
for i in range(p * 2, n + 1, p):
sieve[i] = False
_update(2)
p = 3
while p * p <= n... | import math
n, m = list(map(int, input().split()))
mm = m // n
res = []
for k in range(int(math.sqrt(m)), 0, -1):
if m % k == 0:
if k > mm:
continue
if m // k <= mm:
k = m // k
res.append(k)
print((max(res)))
| false | 71.73913 | [
"-import collections",
"-import itertools",
"-",
"-def eratosthenes(n):",
"- sieve = [True for _ in range(n + 1)]",
"- sieve[0] = False",
"- sieve[1] = False",
"-",
"- def _update(p):",
"- if sieve[p]:",
"- for i in range(p * 2, n + 1, p):",
"- siev... | false | 0.1481 | 0.190594 | 0.777044 | [
"s575573951",
"s764660547"
] |
u094191970 | p03031 | python | s150979160 | s789449983 | 48 | 44 | 3,064 | 3,064 | Accepted | Accepted | 8.33 | n,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
num=0
#ある電球
for j in range(m):
cnt=0
#ある電球に接続されている各スイッチ
for k in range(1,l[j][0]+1):
if (i>>l[j][k]-1) & 1:
cnt+=1
if cn... | n,m=list(map(int,input().split()))
k=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
cnt=0
for i in range(2**n):
l=[0 for j in range(n)]
for j in range(n):
if (i>>j)&1:
l[j]=1
t_cnt=0
for j in range(m):
on_l=0
for x in k[j][1:]:
x-=1
... | 20 | 25 | 378 | 430 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
num = 0
# ある電球
for j in range(m):
cnt = 0
# ある電球に接続されている各スイッチ
for k in range(1, l[j][0] + 1):
if (i >> l[j][k] ... | n, m = list(map(int, input().split()))
k = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
cnt = 0
for i in range(2**n):
l = [0 for j in range(n)]
for j in range(n):
if (i >> j) & 1:
l[j] = 1
t_cnt = 0
for j in range(m):
on_l = 0
... | false | 20 | [
"-l = [list(map(int, input().split())) for i in range(m)]",
"+k = [list(map(int, input().split())) for i in range(m)]",
"-ans = 0",
"+cnt = 0",
"- num = 0",
"- # ある電球",
"+ l = [0 for j in range(n)]",
"+ for j in range(n):",
"+ if (i >> j) & 1:",
"+ l[j] = 1",
"+ ... | false | 0.075877 | 0.044873 | 1.690933 | [
"s150979160",
"s789449983"
] |
u344065503 | p03557 | python | s567597465 | s513149574 | 455 | 231 | 107,108 | 29,396 | Accepted | Accepted | 49.23 | import bisect
n=eval(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for B in b:
ans+=(bisect.bisect_left(a,B))*(len(c)-(bisect.bisect_right(c,B)))
print(ans) | import bisect
n=int(eval(input()))
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
A=bisect.bisect_left(a,i)
C=bisect.bisect(c,i)
ans+=A*(n-C)
print(ans)
| 9 | 11 | 252 | 258 | import bisect
n = eval(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans = 0
for B in b:
ans += (bisect.bisect_left(a, B)) * (len(c) - (bisect.bisect_right(c, B)))
print(ans)
| import bisect
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans = 0
for i in b:
A = bisect.bisect_left(a, i)
C = bisect.bisect(c, i)
ans += A * (n - C)
print(ans)
| false | 18.181818 | [
"-n = eval(input())",
"+n = int(eval(input()))",
"-for B in b:",
"- ans += (bisect.bisect_left(a, B)) * (len(c) - (bisect.bisect_right(c, B)))",
"+for i in b:",
"+ A = bisect.bisect_left(a, i)",
"+ C = bisect.bisect(c, i)",
"+ ans += A * (n - C)"
] | false | 0.04843 | 0.12745 | 0.379995 | [
"s567597465",
"s513149574"
] |
u888092736 | p04034 | python | s640671142 | s274365973 | 178 | 109 | 41,712 | 31,724 | Accepted | Accepted | 38.76 | N, M, *xy = list(map(int, open(0).read().split()))
boxes = [{"count": 1, "red": False} for _ in range(N)]
boxes[0]["red"] = True
for x, y in zip(*[iter(xy)] * 2):
x -= 1
y -= 1
if boxes[x]["red"]:
boxes[y]["red"] = True
if boxes[x]["count"] == 1:
boxes[x]["red"] = Fals... | N, M, *xy = list(map(int, open(0).read().split()))
boxes = [1] * N
is_red = [0] * N
is_red[0] = 1
for x, y in zip(*[iter(xy)] * 2):
x -= 1
y -= 1
boxes[x] -= 1
boxes[y] += 1
if is_red[x]:
if boxes[x] == 0:
is_red[x] = 0
is_red[y] = 1
print((sum(is_red)))
| 14 | 15 | 409 | 310 | N, M, *xy = list(map(int, open(0).read().split()))
boxes = [{"count": 1, "red": False} for _ in range(N)]
boxes[0]["red"] = True
for x, y in zip(*[iter(xy)] * 2):
x -= 1
y -= 1
if boxes[x]["red"]:
boxes[y]["red"] = True
if boxes[x]["count"] == 1:
boxes[x]["red"] = False
boxes... | N, M, *xy = list(map(int, open(0).read().split()))
boxes = [1] * N
is_red = [0] * N
is_red[0] = 1
for x, y in zip(*[iter(xy)] * 2):
x -= 1
y -= 1
boxes[x] -= 1
boxes[y] += 1
if is_red[x]:
if boxes[x] == 0:
is_red[x] = 0
is_red[y] = 1
print((sum(is_red)))
| false | 6.666667 | [
"-boxes = [{\"count\": 1, \"red\": False} for _ in range(N)]",
"-boxes[0][\"red\"] = True",
"+boxes = [1] * N",
"+is_red = [0] * N",
"+is_red[0] = 1",
"- if boxes[x][\"red\"]:",
"- boxes[y][\"red\"] = True",
"- if boxes[x][\"count\"] == 1:",
"- boxes[x][\"red\"] = False",... | false | 0.03863 | 0.120108 | 0.321629 | [
"s640671142",
"s274365973"
] |
u620708171 | p03171 | python | s316358277 | s789088253 | 283 | 238 | 42,076 | 39,920 | Accepted | Accepted | 15.9 | def deque(a):
n = len(a)
cur = [(x, 0) for x in a]
nxt = [(0, 0)] * n
for l in range(2, n + 1):
for i in range(n - l + 1):
j = i + l - 1
x, y = cur[i]
z, t = cur[i + 1]
if a[i] + t - z > a[j] + y - x:
nxt[i] = (a[i] + t, z... | def deque(a):
n = len(a)
cur = a[:]
nxt = [0] * (n - 1)
for l in range(2, n + 1):
for i in range(n - l + 1):
j = i + l - 1
nxt[i] = max(a[i] - cur[i + 1], a[j] - cur[i])
cur, nxt = nxt, cur
return cur[0]
def main():
eval(input()) # n
a... | 24 | 19 | 562 | 391 | def deque(a):
n = len(a)
cur = [(x, 0) for x in a]
nxt = [(0, 0)] * n
for l in range(2, n + 1):
for i in range(n - l + 1):
j = i + l - 1
x, y = cur[i]
z, t = cur[i + 1]
if a[i] + t - z > a[j] + y - x:
nxt[i] = (a[i] + t, z)
... | def deque(a):
n = len(a)
cur = a[:]
nxt = [0] * (n - 1)
for l in range(2, n + 1):
for i in range(n - l + 1):
j = i + l - 1
nxt[i] = max(a[i] - cur[i + 1], a[j] - cur[i])
cur, nxt = nxt, cur
return cur[0]
def main():
eval(input()) # n
a = [int(x) for... | false | 20.833333 | [
"- cur = [(x, 0) for x in a]",
"- nxt = [(0, 0)] * n",
"+ cur = a[:]",
"+ nxt = [0] * (n - 1)",
"- x, y = cur[i]",
"- z, t = cur[i + 1]",
"- if a[i] + t - z > a[j] + y - x:",
"- nxt[i] = (a[i] + t, z)",
"- else:",
"- ... | false | 0.13721 | 0.094942 | 1.445186 | [
"s316358277",
"s789088253"
] |
u363768711 | p03611 | python | s162714952 | s854132273 | 140 | 90 | 20,036 | 14,336 | Accepted | Accepted | 35.71 | from collections import defaultdict
n = int(eval(input()))
a_lis = list(map(int,input().split()))
A_dict = defaultdict(int)
for i in a_lis:
A_dict[i] += 1
max_cnt = 0
for j in range(1, 10**5):
tmp = A_dict[j-1]+A_dict[j]+A_dict[j+1]
max_cnt = max(max_cnt, tmp)
print(max_cnt) | from collections import defaultdict
n = int(eval(input()))
ans = 0
a_lis = list(map(int,input().split()))
A_dict = [0]*(10**5+1)
for i in a_lis:
A_dict[i] += 1
for j in range(1,10**5):
tmp = A_dict[j-1]+A_dict[j]+A_dict[j+1]
if tmp > ans:
ans = tmp
print(ans) | 16 | 16 | 297 | 282 | from collections import defaultdict
n = int(eval(input()))
a_lis = list(map(int, input().split()))
A_dict = defaultdict(int)
for i in a_lis:
A_dict[i] += 1
max_cnt = 0
for j in range(1, 10**5):
tmp = A_dict[j - 1] + A_dict[j] + A_dict[j + 1]
max_cnt = max(max_cnt, tmp)
print(max_cnt)
| from collections import defaultdict
n = int(eval(input()))
ans = 0
a_lis = list(map(int, input().split()))
A_dict = [0] * (10**5 + 1)
for i in a_lis:
A_dict[i] += 1
for j in range(1, 10**5):
tmp = A_dict[j - 1] + A_dict[j] + A_dict[j + 1]
if tmp > ans:
ans = tmp
print(ans)
| false | 0 | [
"+ans = 0",
"-A_dict = defaultdict(int)",
"+A_dict = [0] * (10**5 + 1)",
"-max_cnt = 0",
"- max_cnt = max(max_cnt, tmp)",
"-print(max_cnt)",
"+ if tmp > ans:",
"+ ans = tmp",
"+print(ans)"
] | false | 0.127937 | 0.108903 | 1.174778 | [
"s162714952",
"s854132273"
] |
u634046173 | p02983 | python | s206998526 | s559850676 | 200 | 70 | 65,796 | 65,428 | Accepted | Accepted | 65 | L, R = list(map(int, input().split()))
target = R+1
if R - L > 10000:
target = L + 10000
mi = 2019
for i in range(L,target):
for j in range(i+1,target):
mi = min(mi,(i*j)%2019)
print(mi) | L, R = list(map(int, input().split()))
target = R+1
if R - L > 2019:
target = L + 2019
mi = 2019
for i in range(L,target):
for j in range(i+1,target):
mi = min(mi,(i*j)%2019)
print(mi)
| 9 | 9 | 204 | 203 | L, R = list(map(int, input().split()))
target = R + 1
if R - L > 10000:
target = L + 10000
mi = 2019
for i in range(L, target):
for j in range(i + 1, target):
mi = min(mi, (i * j) % 2019)
print(mi)
| L, R = list(map(int, input().split()))
target = R + 1
if R - L > 2019:
target = L + 2019
mi = 2019
for i in range(L, target):
for j in range(i + 1, target):
mi = min(mi, (i * j) % 2019)
print(mi)
| false | 0 | [
"-if R - L > 10000:",
"- target = L + 10000",
"+if R - L > 2019:",
"+ target = L + 2019"
] | false | 0.111527 | 0.075128 | 1.484487 | [
"s206998526",
"s559850676"
] |
u821262411 | p03607 | python | s352712114 | s249904612 | 225 | 203 | 11,488 | 11,884 | Accepted | Accepted | 9.78 | n=int(eval(input()))
buff=[]
ans=1
for i in range(n):
buff.append(eval(input()))
a=sorted(buff)
for i in range(1,n):
if a[i] == a[i-1]:
a[i-1]= -1
a[i]= -1
if ans>0:
ans -= 1
else:
ans += 1
print(ans)
| n=int(eval(input()))
buff=set()
for i in range(n):
a=int(eval(input()))
if a in buff:
buff.remove(a)
else:
buff.add(a)
print((len(buff))) | 18 | 10 | 265 | 161 | n = int(eval(input()))
buff = []
ans = 1
for i in range(n):
buff.append(eval(input()))
a = sorted(buff)
for i in range(1, n):
if a[i] == a[i - 1]:
a[i - 1] = -1
a[i] = -1
if ans > 0:
ans -= 1
else:
ans += 1
print(ans)
| n = int(eval(input()))
buff = set()
for i in range(n):
a = int(eval(input()))
if a in buff:
buff.remove(a)
else:
buff.add(a)
print((len(buff)))
| false | 44.444444 | [
"-buff = []",
"-ans = 1",
"+buff = set()",
"- buff.append(eval(input()))",
"-a = sorted(buff)",
"-for i in range(1, n):",
"- if a[i] == a[i - 1]:",
"- a[i - 1] = -1",
"- a[i] = -1",
"- if ans > 0:",
"- ans -= 1",
"+ a = int(eval(input()))",
"+ if a... | false | 0.088768 | 0.08561 | 1.036877 | [
"s352712114",
"s249904612"
] |
u818349438 | p02837 | python | s491539867 | s929539525 | 1,441 | 116 | 52,444 | 3,188 | Accepted | Accepted | 91.95 | n = int(eval(input()))
a = [0]*n
x = [[0] *n for i in range(n)]
y = [[0] *n for i in range(n)]
ans = 0
for i in range(n):
a[i] = int(eval(input()))
for j in range(a[i]):
x[i][j],y[i][j] = list(map(int,input().split()))
x[i][j]-=1
def honest(i,j):
return (i>>j)%2 ==1
def check(m):... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
people = []
shogens = [[]for i in range(n)]
def check():
for i in range(n):
if i not in people:continue
for shogen in shogens[i]:
person = shogen[0]
honest = shogen[1]
if honest and person n... | 35 | 39 | 818 | 929 | n = int(eval(input()))
a = [0] * n
x = [[0] * n for i in range(n)]
y = [[0] * n for i in range(n)]
ans = 0
for i in range(n):
a[i] = int(eval(input()))
for j in range(a[i]):
x[i][j], y[i][j] = list(map(int, input().split()))
x[i][j] -= 1
def honest(i, j):
return (i >> j) % 2 == 1
def che... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
people = []
shogens = [[] for i in range(n)]
def check():
for i in range(n):
if i not in people:
continue
for shogen in shogens[i]:
person = shogen[0]
honest = shogen[1]
if honest and pe... | false | 10.25641 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"-a = [0] * n",
"-x = [[0] * n for i in range(n)]",
"-y = [[0] * n for i in range(n)]",
"-ans = 0",
"-for i in range(n):",
"- a[i] = int(eval(input()))",
"- for j in range(a[i]):",
"- x[i][j], y[i][j] = list(map(int, input().split... | false | 0.08244 | 0.034171 | 2.412598 | [
"s491539867",
"s929539525"
] |
u272075541 | p02819 | python | s723641518 | s273338363 | 233 | 172 | 3,304 | 9,556 | Accepted | Accepted | 26.18 | # -*- coding: utf-8 -*-
################ DANGER ################
test = ""
test = \
"""
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
def input2():
return test.pop()
else:
def input2():
return input()
####################... | # -*- coding: utf-8 -*-
# Next Prime
import sys
TEST_INPUT = \
"""
100000
"""
TEST_OUTPUT = \
"""
100003
"""
def primes(n):
if n == 0 or n == 1: return []
ps = [2]
for odd in range(3, n + 1, 2):
for p in ps:
if odd % p == 0:
brea... | 53 | 62 | 974 | 900 | # -*- coding: utf-8 -*-
################ DANGER ################
test = ""
test = """
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
def input2():
return test.pop()
else:
def input2():
return input()
###################################... | # -*- coding: utf-8 -*-
# Next Prime
import sys
TEST_INPUT = """
100000
"""
TEST_OUTPUT = """
100003
"""
def primes(n):
if n == 0 or n == 1:
return []
ps = [2]
for odd in range(3, n + 1, 2):
for p in ps:
if odd % p == 0:
break
if p**2 > odd:
... | false | 14.516129 | [
"-################ DANGER ################",
"-test = \"\"",
"-test = \"\"\"",
"+# Next Prime",
"+import sys",
"+",
"+TEST_INPUT = \"\"\"",
"+100000",
"-########################################",
"-test = list(reversed(test.strip().splitlines()))",
"-if test:",
"-",
"- def input2():",
"... | false | 0.034248 | 0.036338 | 0.942467 | [
"s723641518",
"s273338363"
] |
u066253157 | p03624 | python | s329954765 | s015584234 | 67 | 49 | 5,312 | 4,920 | Accepted | Accepted | 26.87 | S = eval(input())
import string
S = list(sorted(S))
T = string.ascii_lowercase
for t in T:
if t not in S:
print(t)
break
else:
print("None") | S = eval(input())
import string
letters = string.ascii_lowercase
S = set(sorted(S))
for l in letters:
if l not in S:
print(l)
break
else:
print("None") | 14 | 14 | 183 | 186 | S = eval(input())
import string
S = list(sorted(S))
T = string.ascii_lowercase
for t in T:
if t not in S:
print(t)
break
else:
print("None")
| S = eval(input())
import string
letters = string.ascii_lowercase
S = set(sorted(S))
for l in letters:
if l not in S:
print(l)
break
else:
print("None")
| false | 0 | [
"-S = list(sorted(S))",
"-T = string.ascii_lowercase",
"-for t in T:",
"- if t not in S:",
"- print(t)",
"+letters = string.ascii_lowercase",
"+S = set(sorted(S))",
"+for l in letters:",
"+ if l not in S:",
"+ print(l)"
] | false | 0.037571 | 0.075108 | 0.500232 | [
"s329954765",
"s015584234"
] |
u674588203 | p03617 | python | s502695862 | s891290508 | 30 | 27 | 9,296 | 9,152 | Accepted | Accepted | 10 | # AtCoder Grand Contest 019
# A - Ice Tea Store
def f(Q,H,S,D,N,M):
QQ=Q
QH=H/2
QS=S/4
QD=D/8
if N==0:
return M
if N==1:
if QQ==min(QQ,QH,QS):
return M+(4*Q)
if QH==min(QQ,QH,QS):
return M+(2*H)
if QS==min(QQ... | Q,H,S,D=list(map(int,input().split()))
N=int(eval(input()))
one=min (4*Q,2*H,S)
if N==1:
print(one)
else :
if 2*one<=D:
print((N*one))
else:
if N%2==0:
print(((N//2)*D))
else:
print(((N//2)*D+one)) | 44 | 14 | 826 | 253 | # AtCoder Grand Contest 019
# A - Ice Tea Store
def f(Q, H, S, D, N, M):
QQ = Q
QH = H / 2
QS = S / 4
QD = D / 8
if N == 0:
return M
if N == 1:
if QQ == min(QQ, QH, QS):
return M + (4 * Q)
if QH == min(QQ, QH, QS):
return M + (2 * H)
if QS ... | Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
one = min(4 * Q, 2 * H, S)
if N == 1:
print(one)
else:
if 2 * one <= D:
print((N * one))
else:
if N % 2 == 0:
print(((N // 2) * D))
else:
print(((N // 2) * D + one))
| false | 68.181818 | [
"-# AtCoder Grand Contest 019",
"-# A - Ice Tea Store",
"-def f(Q, H, S, D, N, M):",
"- QQ = Q",
"- QH = H / 2",
"- QS = S / 4",
"- QD = D / 8",
"- if N == 0:",
"- return M",
"- if N == 1:",
"- if QQ == min(QQ, QH, QS):",
"- return M + (4 * Q)",
"- ... | false | 0.03662 | 0.034503 | 1.061355 | [
"s502695862",
"s891290508"
] |
u131406572 | p03160 | python | s608425216 | s662909549 | 241 | 146 | 52,208 | 13,928 | Accepted | Accepted | 39.42 | n=int(eval(input()))
h=list(map(int,input().split()))
min_cost=[0]*n
min_cost[0]=0
min_cost[1]=abs(h[1]-h[0])
for i in range(2,n):
min_cost[i]=min(min_cost[i-1]+abs(h[i]-h[i-1]),min_cost[i-2]+abs(h[i]-h[i-2]))
print((min_cost[-1])) | #dp-a
n=int(eval(input()))
h=list(map(int,input().split()))
dp=[0]*n
for i in range(n):
if i==0:dp[0]=0
elif i==1:dp[1]=abs(h[0]-h[1])
else:
dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))
print((dp[n-1])) | 8 | 10 | 234 | 239 | n = int(eval(input()))
h = list(map(int, input().split()))
min_cost = [0] * n
min_cost[0] = 0
min_cost[1] = abs(h[1] - h[0])
for i in range(2, n):
min_cost[i] = min(
min_cost[i - 1] + abs(h[i] - h[i - 1]), min_cost[i - 2] + abs(h[i] - h[i - 2])
)
print((min_cost[-1]))
| # dp-a
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
for i in range(n):
if i == 0:
dp[0] = 0
elif i == 1:
dp[1] = abs(h[0] - h[1])
else:
dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))
print((dp[n - 1]))
| false | 20 | [
"+# dp-a",
"-min_cost = [0] * n",
"-min_cost[0] = 0",
"-min_cost[1] = abs(h[1] - h[0])",
"-for i in range(2, n):",
"- min_cost[i] = min(",
"- min_cost[i - 1] + abs(h[i] - h[i - 1]), min_cost[i - 2] + abs(h[i] - h[i - 2])",
"- )",
"-print((min_cost[-1]))",
"+dp = [0] * n",
"+for i in... | false | 0.038183 | 0.03795 | 1.006122 | [
"s608425216",
"s662909549"
] |
u280552586 | p03363 | python | s090822216 | s015827582 | 230 | 211 | 43,208 | 43,336 | Accepted | Accepted | 8.26 | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
cum_sum = [0] * (n+1)
for i in range(n):
cum_sum[i+1] = cum_sum[i] + A[i]
C = Counter(cum_sum[1:])
ans = 0
for k, v in list(C.items()):
if k == 0:
ans += v + (v*(v-1)//2)
else:
ans += (v*... | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
cum_sum = [0] * (n+1)
for i in range(n):
cum_sum[i+1] = cum_sum[i] + A[i]
C = Counter(cum_sum[1:])
ans = C[0]
for k, v in list(C.items()):
ans += (v*(v-1)//2)
print(ans)
| 15 | 12 | 330 | 269 | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
cum_sum = [0] * (n + 1)
for i in range(n):
cum_sum[i + 1] = cum_sum[i] + A[i]
C = Counter(cum_sum[1:])
ans = 0
for k, v in list(C.items()):
if k == 0:
ans += v + (v * (v - 1) // 2)
else:
ans += v * (v... | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
cum_sum = [0] * (n + 1)
for i in range(n):
cum_sum[i + 1] = cum_sum[i] + A[i]
C = Counter(cum_sum[1:])
ans = C[0]
for k, v in list(C.items()):
ans += v * (v - 1) // 2
print(ans)
| false | 20 | [
"-ans = 0",
"+ans = C[0]",
"- if k == 0:",
"- ans += v + (v * (v - 1) // 2)",
"- else:",
"- ans += v * (v - 1) // 2",
"+ ans += v * (v - 1) // 2"
] | false | 0.107009 | 0.118583 | 0.902399 | [
"s090822216",
"s015827582"
] |
u177411511 | p03835 | python | s313352116 | s789147695 | 1,519 | 258 | 3,896 | 42,108 | Accepted | Accepted | 83.02 | import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readlin... | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
k, s = na()
ct = 0
for x in range(k+1):
for y in range(k+1):
z = s - x - y
if 0 <= z <= k:
ct += 1
print(ct)
| 34 | 24 | 534 | 311 | import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))... | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
k, s = na()
ct = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z <= k:
ct += 1
print(ct)
| false | 29.411765 | [
"-import copy",
"-import string",
"-from _bisect import *",
"-from collections import *",
"-from operator import itemgetter",
"-from math import factorial",
"-\"\"\"",
"-from fractions import gcd",
"-def lcm(x, y):",
"- return (x * y) // gcd(x, y)",
"-\"\"\""
] | false | 0.083941 | 0.04465 | 1.87998 | [
"s313352116",
"s789147695"
] |
u499381410 | p03822 | python | s872704239 | s755005567 | 682 | 388 | 240,304 | 65,848 | Accepted | Accepted | 43.11 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import... | 43 | 64 | 1,422 | 1,772 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factori... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factori... | false | 32.8125 | [
"-A = IR(n - 1)",
"+A = [-1]",
"- win_against[A[i] - 1] += [i + 1]",
"-",
"-",
"-def f(x):",
"+ a = I()",
"+ A += [a - 1]",
"+ win_against[a - 1] += [i + 1]",
"+in_degree = [len(i) for i in win_against]",
"+dp = [0] * n",
"+dq = deque()",
"+for i in range(n):",
"+ if not in_... | false | 0.107822 | 0.044348 | 2.431261 | [
"s872704239",
"s755005567"
] |
u802963389 | p03645 | python | s083441253 | s351316264 | 1,076 | 754 | 91,736 | 58,884 | Accepted | Accepted | 29.93 | N, M = list(map(int, input().split()))
ab = [sorted(list(map(int, input().split()))) for _ in range(M)]
fst = []
scnd = {}
for i in ab:
if i[0]==1:
fst.append(i[1])
if N in i:
idx = i.index(N)
scnd[i[1-idx]] = 0
#print(scnd,fst)
for j in fst:
if j in scnd:
print("POSSIBLE"... | n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
cont_1 = set()
cont_n = set()
for ab in AB:
a, b = ab
if 1 in ab:
cont_1.add(a)
cont_1.add(b)
if n in ab:
cont_n.add(a)
cont_n.add(b)
if cont_1 & cont_n:
print("POSSIBLE")
else:
... | 21 | 19 | 352 | 334 | N, M = list(map(int, input().split()))
ab = [sorted(list(map(int, input().split()))) for _ in range(M)]
fst = []
scnd = {}
for i in ab:
if i[0] == 1:
fst.append(i[1])
if N in i:
idx = i.index(N)
scnd[i[1 - idx]] = 0
# print(scnd,fst)
for j in fst:
if j in scnd:
print("POSSIBL... | n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
cont_1 = set()
cont_n = set()
for ab in AB:
a, b = ab
if 1 in ab:
cont_1.add(a)
cont_1.add(b)
if n in ab:
cont_n.add(a)
cont_n.add(b)
if cont_1 & cont_n:
print("POSSIBLE")
else... | false | 9.52381 | [
"-N, M = list(map(int, input().split()))",
"-ab = [sorted(list(map(int, input().split()))) for _ in range(M)]",
"-fst = []",
"-scnd = {}",
"-for i in ab:",
"- if i[0] == 1:",
"- fst.append(i[1])",
"- if N in i:",
"- idx = i.index(N)",
"- scnd[i[1 - idx]] = 0",
"-# prin... | false | 0.054764 | 0.050981 | 1.074204 | [
"s083441253",
"s351316264"
] |
u932465688 | p03127 | python | s492956813 | s984030433 | 258 | 112 | 14,224 | 15,020 | Accepted | Accepted | 56.59 | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
def gcd(x,y):
while y != 0:
k = x
x = y
y = k%y
return x
G = gcd(L[0],L[1])
for i in range(1,N-1):
if G >= gcd(L[i],L[i+1]):
G = gcd(L[i],L[i+1])
print(G) | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
def gcd(x,y):
while y != 0:
k = x
x = y
y = k%y
return x
cur = L[0]
for i in range(N):
cur = gcd(cur,L[i])
print(cur) | 14 | 13 | 250 | 209 | N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
def gcd(x, y):
while y != 0:
k = x
x = y
y = k % y
return x
G = gcd(L[0], L[1])
for i in range(1, N - 1):
if G >= gcd(L[i], L[i + 1]):
G = gcd(L[i], L[i + 1])
print(G)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
def gcd(x, y):
while y != 0:
k = x
x = y
y = k % y
return x
cur = L[0]
for i in range(N):
cur = gcd(cur, L[i])
print(cur)
| false | 7.142857 | [
"-G = gcd(L[0], L[1])",
"-for i in range(1, N - 1):",
"- if G >= gcd(L[i], L[i + 1]):",
"- G = gcd(L[i], L[i + 1])",
"-print(G)",
"+cur = L[0]",
"+for i in range(N):",
"+ cur = gcd(cur, L[i])",
"+print(cur)"
] | false | 0.037788 | 0.037774 | 1.000389 | [
"s492956813",
"s984030433"
] |
u811817592 | p02756 | python | s768822522 | s113286058 | 1,929 | 731 | 4,600 | 4,596 | Accepted | Accepted | 62.1 | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = list(map(str, input().split()))
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[1] == "1" else -1
h_or_t_flag *= r... | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = list(map(str, input().split()))
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[1] == "1" else -1
h_or_t_flag *= r... | 22 | 22 | 525 | 521 | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = list(map(str, input().split()))
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[1] == "1" else -1
h_or_t_flag *= rev_flag
... | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = list(map(str, input().split()))
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[1] == "1" else -1
h_or_t_flag *= rev_flag
... | false | 0 | [
"- head_str = query[2] + head_str",
"+ head_str += query[2]",
"-ans = head_str + S + tail_str",
"+ans = head_str[::-1] + S + tail_str"
] | false | 0.075483 | 0.046315 | 1.629758 | [
"s768822522",
"s113286058"
] |
u906501980 | p03354 | python | s191827523 | s008450991 | 579 | 514 | 28,900 | 28,900 | Accepted | Accepted | 11.23 | N, M = list(map(int, input().split()))
p = [int(i) for i in input().split()]
graph = [[] for _ in range(N+1)]
group = [0]*(N+1)
ans = 0
for _ in range(M):
x, y = (int(i) for i in input().split())
graph[x].append(y)
graph[y].append(x)
for i, num in enumerate(p, 1):
space = [i]
for point in... | N, M = list(map(int, input().split()))
p = [int(i) for i in input().split()]
graph = [[] for _ in range(N+1)]
group = [0]*(N+1)
ans = 0
for _ in range(M):
x, y = list(map(int, input().split()))
graph[x].append(y)
graph[y].append(x)
for i, num in enumerate(p, 1):
space = [i]
for point in s... | 18 | 17 | 480 | 462 | N, M = list(map(int, input().split()))
p = [int(i) for i in input().split()]
graph = [[] for _ in range(N + 1)]
group = [0] * (N + 1)
ans = 0
for _ in range(M):
x, y = (int(i) for i in input().split())
graph[x].append(y)
graph[y].append(x)
for i, num in enumerate(p, 1):
space = [i]
for point in spac... | N, M = list(map(int, input().split()))
p = [int(i) for i in input().split()]
graph = [[] for _ in range(N + 1)]
group = [0] * (N + 1)
ans = 0
for _ in range(M):
x, y = list(map(int, input().split()))
graph[x].append(y)
graph[y].append(x)
for i, num in enumerate(p, 1):
space = [i]
for point in space:... | false | 5.555556 | [
"- x, y = (int(i) for i in input().split())",
"+ x, y = list(map(int, input().split()))",
"- if group[point]:",
"- continue",
"- group[point] = i",
"- space.extend(graph[point])",
"+ if not group[point]:",
"+ group[point] = i",
"+ sp... | false | 0.075565 | 0.038442 | 1.96569 | [
"s191827523",
"s008450991"
] |
u888092736 | p02819 | python | s754108946 | s003761573 | 105 | 17 | 7,496 | 2,940 | Accepted | Accepted | 83.81 | from bisect import bisect_left
def get_primes(n):
prime = []
limit = n ** 0.5
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
X = int(eval(... | X = int(eval(input()))
while any(X % i == 0 for i in range(2, int(X ** 0.5) + 1)):
X += 1
print(X) | 18 | 4 | 397 | 99 | from bisect import bisect_left
def get_primes(n):
prime = []
limit = n**0.5
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
X = int(eval(input()))
primes ... | X = int(eval(input()))
while any(X % i == 0 for i in range(2, int(X**0.5) + 1)):
X += 1
print(X)
| false | 77.777778 | [
"-from bisect import bisect_left",
"-",
"-",
"-def get_primes(n):",
"- prime = []",
"- limit = n**0.5",
"- data = [i + 1 for i in range(1, n)]",
"- while True:",
"- p = data[0]",
"- if limit <= p:",
"- return prime + data",
"- prime.append(p)",
"- ... | false | 0.106464 | 0.036961 | 2.880407 | [
"s754108946",
"s003761573"
] |
u367701763 | p02813 | python | s004757451 | s106985709 | 192 | 84 | 42,864 | 82,188 | Accepted | Accepted | 56.25 | from itertools import permutations
from collections import defaultdict
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
res = 0
loop = 0
d = defaultdict(int)
for perm in permutations(list(range(1,N+1))):
d[perm] = loop
loop += 1
res = abs(d[P]... | from itertools import *
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
dic = dict()
i = 0
for a in permutations(list(range(1,N+1)),N):
dic[a] = i
i += 1
print((abs(dic[P]-dic[Q]))) | 19 | 10 | 330 | 233 | from itertools import permutations
from collections import defaultdict
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
res = 0
loop = 0
d = defaultdict(int)
for perm in permutations(list(range(1, N + 1))):
d[perm] = loop
loop += 1
res = abs(d[P] - d[Q])
print(re... | from itertools import *
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
dic = dict()
i = 0
for a in permutations(list(range(1, N + 1)), N):
dic[a] = i
i += 1
print((abs(dic[P] - dic[Q])))
| false | 47.368421 | [
"-from itertools import permutations",
"-from collections import defaultdict",
"+from itertools import *",
"-res = 0",
"-loop = 0",
"-d = defaultdict(int)",
"-for perm in permutations(list(range(1, N + 1))):",
"- d[perm] = loop",
"- loop += 1",
"-res = abs(d[P] - d[Q])",
"-print(res)",
"... | false | 0.077302 | 0.171527 | 0.450672 | [
"s004757451",
"s106985709"
] |
u320567105 | p03146 | python | s538581688 | s360080936 | 64 | 17 | 11,160 | 3,060 | Accepted | Accepted | 73.44 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
def f(n):
if n%2 == 0:
return n/2
else:
return 3*n+1
s = ri()
t = [0 for _ in range(1000000)]
ans = 0
a = s
for i in range(1,1000000):
if t[int(a)] == 1:
ans = i
break
else:... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
def f(n):
if n%2==0:
return n//2
else:
return 3*n+1
s = ri()
used = set()
ans = 1
while True:
if s in used:
break
used.add(s)
ans += 1
s = f(s)
print(ans) | 24 | 20 | 365 | 294 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
def f(n):
if n % 2 == 0:
return n / 2
else:
return 3 * n + 1
s = ri()
t = [0 for _ in range(1000000)]
ans = 0
a = s
for i in range(1, 1000000):
if t[int(a)] == 1:
ans = i
break
else:
... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
def f(n):
if n % 2 == 0:
return n // 2
else:
return 3 * n + 1
s = ri()
used = set()
ans = 1
while True:
if s in used:
break
used.add(s)
ans += 1
s = f(s)
print(ans)
| false | 16.666667 | [
"- return n / 2",
"+ return n // 2",
"-t = [0 for _ in range(1000000)]",
"-ans = 0",
"-a = s",
"-for i in range(1, 1000000):",
"- if t[int(a)] == 1:",
"- ans = i",
"+used = set()",
"+ans = 1",
"+while True:",
"+ if s in used:",
"- else:",
"- t[int(a)] =... | false | 0.092532 | 0.041193 | 2.246286 | [
"s538581688",
"s360080936"
] |
u933341648 | p03262 | python | s971008453 | s142914748 | 82 | 61 | 11,096 | 11,180 | Accepted | Accepted | 25.61 | def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x-y) for y in town)
res = next(distance)
for d in distance:
res = gcd(res, d)
print(res)
| def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x-y) for y in town)
res = next(distance)
for d in distance:
if d % res != 0:
res = gcd(res, d... | 16 | 17 | 298 | 324 | def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x - y) for y in town)
res = next(distance)
for d in distance:
res = gcd(res, d)
print(res)
| def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x - y) for y in town)
res = next(distance)
for d in distance:
if d % res != 0:
res = gcd(res, d)
print(res)... | false | 5.882353 | [
"- res = gcd(res, d)",
"+ if d % res != 0:",
"+ res = gcd(res, d)"
] | false | 0.040472 | 0.037669 | 1.074399 | [
"s971008453",
"s142914748"
] |
u488127128 | p03107 | python | s380266743 | s239660328 | 45 | 18 | 3,956 | 3,188 | Accepted | Accepted | 60 | S = eval(input())
a = []
for s in S:
if not a:
a.append(s)
continue
if s != a[-1]:
a.pop()
else:
a.append(s)
print((len(S)-len(a))) | s = eval(input())
a = s.count('0')
b = len(s) - a
print((min(a,b)*2)) | 11 | 4 | 177 | 64 | S = eval(input())
a = []
for s in S:
if not a:
a.append(s)
continue
if s != a[-1]:
a.pop()
else:
a.append(s)
print((len(S) - len(a)))
| s = eval(input())
a = s.count("0")
b = len(s) - a
print((min(a, b) * 2))
| false | 63.636364 | [
"-S = eval(input())",
"-a = []",
"-for s in S:",
"- if not a:",
"- a.append(s)",
"- continue",
"- if s != a[-1]:",
"- a.pop()",
"- else:",
"- a.append(s)",
"-print((len(S) - len(a)))",
"+s = eval(input())",
"+a = s.count(\"0\")",
"+b = len(s) - a",
"+... | false | 0.035617 | 0.035747 | 0.996359 | [
"s380266743",
"s239660328"
] |
u645250356 | p02781 | python | s309318458 | s178491794 | 301 | 141 | 66,156 | 77,224 | Accepted | Accepted | 53.16 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.std... | 33 | 35 | 914 | 1,058 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, pprint, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 5.714286 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, pprint, fractions",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"-n = inp()",
"+s = eval(input())",
"+n = len(s)",
"-s = lis... | false | 0.068365 | 0.033037 | 2.069345 | [
"s309318458",
"s178491794"
] |
u124498235 | p03231 | python | s009752150 | s641192478 | 106 | 29 | 22,068 | 9,224 | Accepted | Accepted | 72.64 | from collections import defaultdict
import math
n,m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
ans = int((n*m)/math.gcd(n,m))
d = defaultdict(int)
if n > m:
for i in range(n):
if i == 0:
d[1] = s[i]
else:
d[i*int(ans/n)+1] = s[i]
ng = 0
for i in range... | import math
n,m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
ans = int((n*m)/math.gcd(n,m))
g = math.gcd(n,m)
for i in range(g):
if s[i*(n//g)] != t[i*(m//g)]:
print((-1))
exit()
print (ans) | 40 | 12 | 791 | 218 | from collections import defaultdict
import math
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
ans = int((n * m) / math.gcd(n, m))
d = defaultdict(int)
if n > m:
for i in range(n):
if i == 0:
d[1] = s[i]
else:
d[i * int(ans / n) + 1] = s[i]
ng... | import math
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
ans = int((n * m) / math.gcd(n, m))
g = math.gcd(n, m)
for i in range(g):
if s[i * (n // g)] != t[i * (m // g)]:
print((-1))
exit()
print(ans)
| false | 70 | [
"-from collections import defaultdict",
"-d = defaultdict(int)",
"-if n > m:",
"- for i in range(n):",
"- if i == 0:",
"- d[1] = s[i]",
"- else:",
"- d[i * int(ans / n) + 1] = s[i]",
"- ng = 0",
"- for i in range(m):",
"- if i == 0:",
"- ... | false | 0.038076 | 0.036664 | 1.038513 | [
"s009752150",
"s641192478"
] |
u223904637 | p03510 | python | s792764582 | s881183214 | 1,278 | 984 | 98,516 | 91,732 | Accepted | Accepted | 23 |
#####segfunc######
def segfunc(x,y):
return max(x,y)
def init(init_val):
#set_val
for i in range(n):
seg[i+num-1]=init_val[i]
#built ... | n=int(eval(input()))
x=[]
s=[]
for i in range(n):
p,q=list(map(int,input().split()))
x.append(p)
s.append(q)
r=[0]
for i in range(n):
r.append(r[-1]+s[i])
b=[]
for i in range(n):
b.append(r[i+1]-x[i])
a=[-10**30]*n
a[-1]=b[-1]
for i in range(n-1):
a[n-i-2]=max(a[n-i-1],b[n-i-2]... | 61 | 23 | 1,372 | 385 | #####segfunc######
def segfunc(x, y):
return max(x, y)
def init(init_val):
# set_val
for i in range(n):
seg[i + num - 1] = init_val[i]
# built
for i in range(num - 2, -1, -1):
seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])
def update(k, x):
k += num - 1
seg[k] = x
w... | n = int(eval(input()))
x = []
s = []
for i in range(n):
p, q = list(map(int, input().split()))
x.append(p)
s.append(q)
r = [0]
for i in range(n):
r.append(r[-1] + s[i])
b = []
for i in range(n):
b.append(r[i + 1] - x[i])
a = [-(10**30)] * n
a[-1] = b[-1]
for i in range(n - 1):
a[n - i - 2] = max... | false | 62.295082 | [
"-#####segfunc######",
"-def segfunc(x, y):",
"- return max(x, y)",
"-",
"-",
"-def init(init_val):",
"- # set_val",
"- for i in range(n):",
"- seg[i + num - 1] = init_val[i]",
"- # built",
"- for i in range(num - 2, -1, -1):",
"- seg[i] = segfunc(seg[2 * i + 1], s... | false | 0.047348 | 0.04782 | 0.990142 | [
"s792764582",
"s881183214"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.