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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u440566786 | p02868 | python | s317034995 | s836321136 | 1,718 | 1,533 | 261,920 | 262,740 | Accepted | Accepted | 10.77 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
n, m = list(map(int, input().split()))
N = 1 << (n - 1).bit_length()
N2, N3 = N * 2, N * 3
E = [[] for _ in r... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def build():
for i in range(N - 1, 0, -1):
cl, cr = i << 1, i << 1 | 1
E[i].append((cl, 0))
E[i].append((cr, 0))... | 62 | 64 | 1,778 | 1,741 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
n, m = list(map(int, input().split()))
N = 1 << (n - 1).bit_length()
N2, N3 = N * 2, N * 3
E = [[] for _ in range(N3... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def build():
for i in range(N - 1, 0, -1):
cl, cr = i << 1, i << 1 | 1
E[i].append((cl, 0))
E[i].append((cr, 0))
... | false | 3.125 | [
"-def resolve():",
"- n, m = list(map(int, input().split()))",
"- N = 1 << (n - 1).bit_length()",
"- N2, N3 = N * 2, N * 3",
"- E = [[] for _ in range(N3)]",
"- ref = lambda v: v if v < 3 * N else v - N2",
"- # build range-edge graph",
"+def build():",
"- def add_range_edge(l0, ... | false | 0.046907 | 0.039566 | 1.18553 | [
"s317034995",
"s836321136"
] |
u969850098 | p03853 | python | s270985613 | s584677777 | 24 | 18 | 3,316 | 3,060 | Accepted | Accepted | 25 | H, W = list(map(int, input().split()))
original = [list(eval(input())) for i in range(H)]
converted = [[0 for j in range(W)] for i in range(2 * H)]
for i in range(2 * H):
for j in range(W):
converted[i][j] = original[i // 2][j]
for row in converted:
print((''.join(row))) | H, W = list(map(int, input().split()))
original = [list(eval(input())) for i in range(H)]
for i in range(2 * H):
print((''.join(original[i // 2][:]))) | 9 | 4 | 290 | 143 | H, W = list(map(int, input().split()))
original = [list(eval(input())) for i in range(H)]
converted = [[0 for j in range(W)] for i in range(2 * H)]
for i in range(2 * H):
for j in range(W):
converted[i][j] = original[i // 2][j]
for row in converted:
print(("".join(row)))
| H, W = list(map(int, input().split()))
original = [list(eval(input())) for i in range(H)]
for i in range(2 * H):
print(("".join(original[i // 2][:])))
| false | 55.555556 | [
"-converted = [[0 for j in range(W)] for i in range(2 * H)]",
"- for j in range(W):",
"- converted[i][j] = original[i // 2][j]",
"-for row in converted:",
"- print((\"\".join(row)))",
"+ print((\"\".join(original[i // 2][:])))"
] | false | 0.038259 | 0.042733 | 0.895293 | [
"s270985613",
"s584677777"
] |
u553987207 | p03031 | python | s523736691 | s940381524 | 33 | 27 | 3,064 | 3,064 | Accepted | Accepted | 18.18 | N, M = list(map(int, input().split()))
s = []
for _ in range(M):
kss = list(map(int, input().split()))
s.append(set([x - 1 for x in kss[1:]]))
p = list(map(int, input().split()))
ans = 0
for bit in range(1 << N):
on_counts = [0] * M
for i in range(N):
if bit & (1 << i):
... | N, M = list(map(int, input().split()))
B = [None] * M
for i in range(M):
ks = list(map(int, input().split()))
B[i] = [s - 1 for s in ks[1:]]
p = list(map(int, input().split()))
ans = 0
bit = 0
for bit in range(1 << N):
for i, b in enumerate(B):
if p[i] != (len([1 for s in b if bit & (1 <... | 18 | 16 | 473 | 386 | N, M = list(map(int, input().split()))
s = []
for _ in range(M):
kss = list(map(int, input().split()))
s.append(set([x - 1 for x in kss[1:]]))
p = list(map(int, input().split()))
ans = 0
for bit in range(1 << N):
on_counts = [0] * M
for i in range(N):
if bit & (1 << i):
for m in rang... | N, M = list(map(int, input().split()))
B = [None] * M
for i in range(M):
ks = list(map(int, input().split()))
B[i] = [s - 1 for s in ks[1:]]
p = list(map(int, input().split()))
ans = 0
bit = 0
for bit in range(1 << N):
for i, b in enumerate(B):
if p[i] != (len([1 for s in b if bit & (1 << s)]) % 2):... | false | 11.111111 | [
"-s = []",
"-for _ in range(M):",
"- kss = list(map(int, input().split()))",
"- s.append(set([x - 1 for x in kss[1:]]))",
"+B = [None] * M",
"+for i in range(M):",
"+ ks = list(map(int, input().split()))",
"+ B[i] = [s - 1 for s in ks[1:]]",
"+bit = 0",
"- on_counts = [0] * M",
"-... | false | 0.036777 | 0.035491 | 1.036238 | [
"s523736691",
"s940381524"
] |
u729133443 | p03037 | python | s994420014 | s086641808 | 297 | 68 | 82,800 | 25,076 | Accepted | Accepted | 77.1 | n,m,*t=list(map(int,open(0).read().split()));a,c=[0]*-~n,0
for l,r in zip(t[::2],t[1::2]):a[l-1]+=1;a[r]-=1
for i in range(n):a[i+1]+=a[i];c+=a[i]==m
print(c) | n,m,*t=list(map(int,open(0).read().split()));print((max(0,min(t[1::2])-max(t[::2])+1))) | 4 | 1 | 155 | 79 | n, m, *t = list(map(int, open(0).read().split()))
a, c = [0] * -~n, 0
for l, r in zip(t[::2], t[1::2]):
a[l - 1] += 1
a[r] -= 1
for i in range(n):
a[i + 1] += a[i]
c += a[i] == m
print(c)
| n, m, *t = list(map(int, open(0).read().split()))
print((max(0, min(t[1::2]) - max(t[::2]) + 1)))
| false | 75 | [
"-a, c = [0] * -~n, 0",
"-for l, r in zip(t[::2], t[1::2]):",
"- a[l - 1] += 1",
"- a[r] -= 1",
"-for i in range(n):",
"- a[i + 1] += a[i]",
"- c += a[i] == m",
"-print(c)",
"+print((max(0, min(t[1::2]) - max(t[::2]) + 1)))"
] | false | 0.209115 | 0.043919 | 4.761374 | [
"s994420014",
"s086641808"
] |
u852690916 | p02861 | python | s643729578 | s634633053 | 194 | 18 | 40,684 | 3,064 | Accepted | Accepted | 90.72 | N=int(eval(input()))
XY=[tuple(map(int, input().split())) for _ in range(N)]
from math import sqrt
def dist(a,b):
return sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)
from itertools import permutations
a=b=0
for p in permutations(list(range(N))):
b+=1
for i in range(N-1):
a+=dist(XY[p[i]], XY[p[... | import sys
def main():
input = sys.stdin.readline
N=int(eval(input()))
A=[tuple(map(int, input().split())) for _ in range(N)]
ans=0
for i in range(N):
for j in range(N):
if i==j: continue
ans+=((A[i][0]-A[j][0])**2 + (A[i][1]-A[j][1])**2) ** 0.5
print((a... | 13 | 14 | 326 | 360 | N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
from math import sqrt
def dist(a, b):
return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
from itertools import permutations
a = b = 0
for p in permutations(list(range(N))):
b += 1
for i in range(N - 1):
a += dist... | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(N):
if i == j:
continue
ans += ((A[i][0] - A[j][0]) ** 2 + (A[i][1] - A[j][1])... | false | 7.142857 | [
"-N = int(eval(input()))",
"-XY = [tuple(map(int, input().split())) for _ in range(N)]",
"-from math import sqrt",
"+import sys",
"-def dist(a, b):",
"- return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)",
"+def main():",
"+ input = sys.stdin.readline",
"+ N = int(eval(input()))",
"+ ... | false | 0.132842 | 0.089422 | 1.485552 | [
"s643729578",
"s634633053"
] |
u271934630 | p03076 | python | s742525392 | s138462159 | 166 | 17 | 38,384 | 3,064 | Accepted | Accepted | 89.76 | def round_up(i):
if i % 10 == 0:
return i
return 10 - i % 10 + i
minutes = [int(eval(input())) for i in range(5)]
m = [round_up(i) for i in minutes]
last = min((minutes[l] - 1) % 10 for l in range(5)) + 1
print((sum(m) + last - 10))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
arr = [i_i() for _ in range(5)]
arr.sort(key=lambda a: a%10)
flag = True
ans = 0
for x in arr:
if flag and x % 10 >= 1:... | 11 | 24 | 254 | 498 | def round_up(i):
if i % 10 == 0:
return i
return 10 - i % 10 + i
minutes = [int(eval(input())) for i in range(5)]
m = [round_up(i) for i in minutes]
last = min((minutes[l] - 1) % 10 for l in range(5)) + 1
print((sum(m) + last - 10))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
arr = [i_i() for _ in range(5)]
arr.sort(key=lambda a: a % 10)
flag = True
ans = 0
for x in arr:
if flag and x % 10 >= 1:
ans += ... | false | 54.166667 | [
"-def round_up(i):",
"- if i % 10 == 0:",
"- return i",
"- return 10 - i % 10 + i",
"+import sys",
"-",
"-minutes = [int(eval(input())) for i in range(5)]",
"-m = [round_up(i) for i in minutes]",
"-last = min((minutes[l] - 1) % 10 for l in range(5)) + 1",
"-print((sum(m) + last - 10))... | false | 0.137245 | 0.043687 | 3.141576 | [
"s742525392",
"s138462159"
] |
u877415670 | p02947 | python | s255609025 | s671594339 | 534 | 357 | 17,804 | 20,592 | Accepted | Accepted | 33.15 | N = int(eval(input()))
dic = {}
for i in range(N):
s = eval(input())
s = ''.join(sorted(s))
if s in dic:
dic[s] += int((-1+(1+8*(dic[s]))**0.5)/2)+1
else:
dic[s] = 0
print((sum(dic.values())))
| import collections
n=int(eval(input()))
s = [",".join(sorted(eval(input()))) for i in range(n)]
c = collections.Counter(s)
ans=0
for i in list(c.values()):
ans+=i*(i-1)//2
print(ans) | 12 | 12 | 200 | 180 | N = int(eval(input()))
dic = {}
for i in range(N):
s = eval(input())
s = "".join(sorted(s))
if s in dic:
dic[s] += int((-1 + (1 + 8 * (dic[s])) ** 0.5) / 2) + 1
else:
dic[s] = 0
print((sum(dic.values())))
| import collections
n = int(eval(input()))
s = [",".join(sorted(eval(input()))) for i in range(n)]
c = collections.Counter(s)
ans = 0
for i in list(c.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 0 | [
"-N = int(eval(input()))",
"-dic = {}",
"-for i in range(N):",
"- s = eval(input())",
"- s = \"\".join(sorted(s))",
"- if s in dic:",
"- dic[s] += int((-1 + (1 + 8 * (dic[s])) ** 0.5) / 2) + 1",
"- else:",
"- dic[s] = 0",
"-print((sum(dic.values())))",
"+import collecti... | false | 0.134151 | 0.04767 | 2.814173 | [
"s255609025",
"s671594339"
] |
u347640436 | p03201 | python | s833627135 | s350899577 | 590 | 371 | 44,560 | 44,592 | Accepted | Accepted | 37.12 | from bisect import bisect_right
n = int(eval(input()))
d = {}
amax = 0
for a in map(int, input().split()):
if a in d:
d[a] += 1
else:
d[a] = 1
amax = max(d.keys())
t = 1
valids = []
while t < 2 * amax:
t *= 2
valids.append(t)
result = 0
while True:
prev = result
keys = list(sorted(... | from bisect import bisect_right
n = int(eval(input()))
d = {}
for a in map(int, input().split()):
if a in d:
d[a] += 1
else:
d[a] = 1
amax = max(d.keys())
t = 1
valids = []
while t < 2 * amax:
t *= 2
valids.append(t)
result = 0
keys = list(sorted(list(d.keys()), reverse = True))
for a in... | 42 | 37 | 786 | 672 | from bisect import bisect_right
n = int(eval(input()))
d = {}
amax = 0
for a in map(int, input().split()):
if a in d:
d[a] += 1
else:
d[a] = 1
amax = max(d.keys())
t = 1
valids = []
while t < 2 * amax:
t *= 2
valids.append(t)
result = 0
while True:
prev = result
keys = list(sort... | from bisect import bisect_right
n = int(eval(input()))
d = {}
for a in map(int, input().split()):
if a in d:
d[a] += 1
else:
d[a] = 1
amax = max(d.keys())
t = 1
valids = []
while t < 2 * amax:
t *= 2
valids.append(t)
result = 0
keys = list(sorted(list(d.keys()), reverse=True))
for a in ... | false | 11.904762 | [
"-amax = 0",
"-while True:",
"- prev = result",
"- keys = list(sorted(list(d.keys()), reverse=True))",
"- for x in keys:",
"- if x not in d:",
"- continue",
"- t = valids[bisect_right(valids, x)] - x",
"- while True:",
"- if t not in d:",
"- ... | false | 0.032807 | 0.037128 | 0.883637 | [
"s833627135",
"s350899577"
] |
u066855390 | p03107 | python | s685466088 | s449351479 | 47 | 31 | 4,648 | 3,956 | Accepted | Accepted | 34.04 | S = list(eval(input()))
last = S.pop(0)
stack = [last]
can_pop = True
cnt = 0
for s in S:
if last != s and can_pop:
stack.pop()
if len(stack) == 0:
can_pop = False
# stack.append(s) 読み捨て
cnt += 2
else:
stack.append(s)
last = s
... | S = list(eval(input()))
one = 0
zero = 0
for s in S:
if s == "1":
one += 1
else:
zero += 1
print((min(one, zero) * 2)) | 19 | 10 | 343 | 144 | S = list(eval(input()))
last = S.pop(0)
stack = [last]
can_pop = True
cnt = 0
for s in S:
if last != s and can_pop:
stack.pop()
if len(stack) == 0:
can_pop = False
# stack.append(s) 読み捨て
cnt += 2
else:
stack.append(s)
last = s
can_pop = True
pr... | S = list(eval(input()))
one = 0
zero = 0
for s in S:
if s == "1":
one += 1
else:
zero += 1
print((min(one, zero) * 2))
| false | 47.368421 | [
"-last = S.pop(0)",
"-stack = [last]",
"-can_pop = True",
"-cnt = 0",
"+one = 0",
"+zero = 0",
"- if last != s and can_pop:",
"- stack.pop()",
"- if len(stack) == 0:",
"- can_pop = False",
"- # stack.append(s) 読み捨て",
"- cnt += 2",
"+ if s == \"1\"... | false | 0.033883 | 0.037423 | 0.905401 | [
"s685466088",
"s449351479"
] |
u686230543 | p02796 | python | s152058997 | s204135423 | 513 | 449 | 16,660 | 17,364 | Accepted | Accepted | 12.48 | from heapq import heappop, heappush
n = int(eval(input()))
robots = []
for _ in range(n):
x, l = list(map(int, input().split()))
heappush(robots, (x+l, x-l))
robot = heappop(robots)
hand = robot[0]
count = 1
while robots:
robot = heappop(robots)
if hand <= robot[1]:
hand = robot[0]
coun... | n = int(eval(input()))
robots = []
for _ in range(n):
x, l = list(map(int, input().split()))
robots.append((x+l, x-l))
robots.sort()
hand = robots[0][0]
count = 1
for robot in robots[1:]:
if hand <= robot[1]:
hand = robot[0]
count += 1
print(count) | 17 | 14 | 328 | 264 | from heapq import heappop, heappush
n = int(eval(input()))
robots = []
for _ in range(n):
x, l = list(map(int, input().split()))
heappush(robots, (x + l, x - l))
robot = heappop(robots)
hand = robot[0]
count = 1
while robots:
robot = heappop(robots)
if hand <= robot[1]:
hand = robot[0]
... | n = int(eval(input()))
robots = []
for _ in range(n):
x, l = list(map(int, input().split()))
robots.append((x + l, x - l))
robots.sort()
hand = robots[0][0]
count = 1
for robot in robots[1:]:
if hand <= robot[1]:
hand = robot[0]
count += 1
print(count)
| false | 17.647059 | [
"-from heapq import heappop, heappush",
"-",
"- heappush(robots, (x + l, x - l))",
"-robot = heappop(robots)",
"-hand = robot[0]",
"+ robots.append((x + l, x - l))",
"+robots.sort()",
"+hand = robots[0][0]",
"-while robots:",
"- robot = heappop(robots)",
"+for robot in robots[1:]:"
] | false | 0.098804 | 0.041473 | 2.382391 | [
"s152058997",
"s204135423"
] |
u330661451 | p02757 | python | s085629257 | s942709318 | 163 | 121 | 3,500 | 3,500 | Accepted | Accepted | 25.77 | n,p = list(map(int,input().split()))
s = eval(input())
l = [0 for i in range(p)]
l[0] = 1
ten = 1
cnt = 0
ans = 0
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i+1
else:
for i in range(n):
cnt = (cnt + int(s[-i-1]) * ten) % p
l[cnt] += ... | def main():
n,p = list(map(int,input().split()))
s = eval(input())
l = [0 for i in range(p)]
l[0] = 1
ten = 1
cnt = 0
ans = 0
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i+1
else:
for i in range(n):
... | 22 | 26 | 426 | 561 | n, p = list(map(int, input().split()))
s = eval(input())
l = [0 for i in range(p)]
l[0] = 1
ten = 1
cnt = 0
ans = 0
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
else:
for i in range(n):
cnt = (cnt + int(s[-i - 1]) * ten) % p
l[cnt] += 1
... | def main():
n, p = list(map(int, input().split()))
s = eval(input())
l = [0 for i in range(p)]
l[0] = 1
ten = 1
cnt = 0
ans = 0
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
else:
for i in range(n):
... | false | 15.384615 | [
"-n, p = list(map(int, input().split()))",
"-s = eval(input())",
"-l = [0 for i in range(p)]",
"-l[0] = 1",
"-ten = 1",
"-cnt = 0",
"-ans = 0",
"-if p == 2 or p == 5:",
"- for i in range(n):",
"- if int(s[i]) % p == 0:",
"- ans += i + 1",
"-else:",
"- for i in range(n... | false | 0.03608 | 0.036605 | 0.985668 | [
"s085629257",
"s942709318"
] |
u821624310 | p02388 | python | s411743317 | s262785623 | 30 | 20 | 7,608 | 7,612 | Accepted | Accepted | 33.33 | x = int(eval(input()))
print((x**3)) | N = int(eval(input()))
print((N ** 3)) | 2 | 2 | 29 | 31 | x = int(eval(input()))
print((x**3))
| N = int(eval(input()))
print((N**3))
| false | 0 | [
"-x = int(eval(input()))",
"-print((x**3))",
"+N = int(eval(input()))",
"+print((N**3))"
] | false | 0.040165 | 0.040073 | 1.002293 | [
"s411743317",
"s262785623"
] |
u734529045 | p02713 | python | s328595367 | s657964667 | 1,927 | 1,003 | 9,156 | 80,244 | Accepted | Accepted | 47.95 | from math import gcd
K = int(eval(input()))
res = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
res += gcd(gcd(i, j), k)
print(res) | import time
def gcd(a, b):
return a if b == 0 else gcd(b, a%b)
K = int(eval(input()))
res = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
res += gcd(gcd(i, j), k)
print(res) | 8 | 11 | 184 | 234 | from math import gcd
K = int(eval(input()))
res = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
res += gcd(gcd(i, j), k)
print(res)
| import time
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
K = int(eval(input()))
res = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
res += gcd(gcd(i, j), k)
print(res)
| false | 27.272727 | [
"-from math import gcd",
"+import time",
"+",
"+",
"+def gcd(a, b):",
"+ return a if b == 0 else gcd(b, a % b)",
"+"
] | false | 0.052494 | 0.04061 | 1.292646 | [
"s328595367",
"s657964667"
] |
u633068244 | p00613 | python | s631867100 | s666067454 | 40 | 30 | 4,300 | 4,304 | Accepted | Accepted | 25 | while 1:
k = int(input())
if not k: break
print(sum(map(int, input().split()))/(k-1)) | while 1:
k = eval(input())
if not k: break
print(sum(map(int, input().split()))/(k-1)) | 4 | 4 | 98 | 89 | while 1:
k = int(input())
if not k:
break
print(sum(map(int, input().split())) / (k - 1))
| while 1:
k = eval(input())
if not k:
break
print(sum(map(int, input().split())) / (k - 1))
| false | 0 | [
"- k = int(input())",
"+ k = eval(input())"
] | false | 0.037008 | 0.038609 | 0.958527 | [
"s631867100",
"s666067454"
] |
u588341295 | p02788 | python | s270156520 | s412309802 | 1,459 | 1,090 | 122,876 | 104,256 | Accepted | Accepted | 25.29 | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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):... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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):... | 118 | 82 | 3,342 | 2,096 | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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, ... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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, ... | false | 30.508475 | [
"- return int(eval(input()))",
"+ return int(input())",
"- return list(map(int, input().split()))",
"+ return map(int, input().split())",
"-class StarrySkyTree:",
"- \"\"\"Starry Sky Tree(区間加算・区間最小(大)値取得)\"\"\"",
"+class BIT2:",
"+ \"\"\"区間加算BIT(区間加算・区間合計取得)\"\"\"",
"- def __ini... | false | 0.048023 | 0.045685 | 1.051182 | [
"s270156520",
"s412309802"
] |
u221301671 | p03163 | python | s895919208 | s076789740 | 1,275 | 421 | 159,060 | 17,952 | Accepted | Accepted | 66.98 | n, w = [int(i) for i in input().split()]
sv = {}
for i in range(n):
ww, vv = list(map(int, input().split()))
if ww > w:
continue
added = {}
for k, v in list(sv.items()):
if (ww+k) <= w:
added[ww+k] = vv+v
for k, v in list(added.items()):
sv[k] = max(v... | import numpy as np
n, ww = list(map(int, input().split()))
s = np.zeros(ww+1, dtype=np.int64)
for i in range(n):
w, v = list(map(int, input().split()))
s[w:] = np.maximum(s[w:], s[:-w] + v)
print((s[ww])) | 17 | 10 | 383 | 210 | n, w = [int(i) for i in input().split()]
sv = {}
for i in range(n):
ww, vv = list(map(int, input().split()))
if ww > w:
continue
added = {}
for k, v in list(sv.items()):
if (ww + k) <= w:
added[ww + k] = vv + v
for k, v in list(added.items()):
sv[k] = max(v, sv.ge... | import numpy as np
n, ww = list(map(int, input().split()))
s = np.zeros(ww + 1, dtype=np.int64)
for i in range(n):
w, v = list(map(int, input().split()))
s[w:] = np.maximum(s[w:], s[:-w] + v)
print((s[ww]))
| false | 41.176471 | [
"-n, w = [int(i) for i in input().split()]",
"-sv = {}",
"+import numpy as np",
"+",
"+n, ww = list(map(int, input().split()))",
"+s = np.zeros(ww + 1, dtype=np.int64)",
"- ww, vv = list(map(int, input().split()))",
"- if ww > w:",
"- continue",
"- added = {}",
"- for k, v in ... | false | 0.039995 | 0.182437 | 0.219225 | [
"s895919208",
"s076789740"
] |
u815878613 | p03127 | python | s826568839 | s986086714 | 165 | 143 | 14,252 | 12,496 | Accepted | Accepted | 13.33 | def vs(A):
A = sorted(A)
pA = list([x % A[0] for x in A])
pA[0] = A[0]
return list([x for x in pA if x != 0])
N = int(eval(input()))
A = list(map(int, input().split()))
spA = -1
sA = -2
while spA != sA:
sA = sum(A)
pA = vs(A)
spA = sum(pA)
A = pA
print((sum(A)))
| import sys
readline = sys.stdin.buffer.readline
def sss(A, N):
A.sort()
while A[0] == 0:
A.remove(0)
for i in range(1, len(A)):
A[i] = A[i] % A[0]
if A[0] == sum(A):
print((sum(A)))
else:
return sss(A, N)
def main():
N = int(readline())
... | 20 | 25 | 319 | 387 | def vs(A):
A = sorted(A)
pA = list([x % A[0] for x in A])
pA[0] = A[0]
return list([x for x in pA if x != 0])
N = int(eval(input()))
A = list(map(int, input().split()))
spA = -1
sA = -2
while spA != sA:
sA = sum(A)
pA = vs(A)
spA = sum(pA)
A = pA
print((sum(A)))
| import sys
readline = sys.stdin.buffer.readline
def sss(A, N):
A.sort()
while A[0] == 0:
A.remove(0)
for i in range(1, len(A)):
A[i] = A[i] % A[0]
if A[0] == sum(A):
print((sum(A)))
else:
return sss(A, N)
def main():
N = int(readline())
A = list(map(int, ... | false | 20 | [
"-def vs(A):",
"- A = sorted(A)",
"- pA = list([x % A[0] for x in A])",
"- pA[0] = A[0]",
"- return list([x for x in pA if x != 0])",
"+import sys",
"+",
"+readline = sys.stdin.buffer.readline",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-spA = -1",
"-sA = ... | false | 0.036346 | 0.034825 | 1.043694 | [
"s826568839",
"s986086714"
] |
u156815136 | p03150 | python | s878570326 | s393937624 | 52 | 21 | 5,724 | 3,316 | Accepted | Accepted | 59.62 | 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 # (string,3) 3回
#from collections import deque
from collections import defaultdict
#import bisect
#
# d = m - k... | 36 | 35 | 821 | 837 | 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 # (string,3) 3回
# from collections import deque
from collections import defaultdict
# import bisect
#
# d = m - k[... | false | 2.777778 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from fractions import gcd",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"+# from fractions import gcd",
"+# from itertools import combinations # (string,3) 3回",
"+# from collect... | false | 0.046962 | 0.094221 | 0.498421 | [
"s878570326",
"s393937624"
] |
u706414019 | p03472 | python | s290216832 | s488967531 | 322 | 269 | 35,136 | 33,116 | Accepted | Accepted | 16.46 | import sys,math
import numpy as np
input = sys.stdin.readline
b_max=0
a_max=0
a = []
b = []
N,H = list(map(int,input().split()))
for i in range(N):
an,bn = list(map(int,input().split()))
a.append(an)
b.append(bn)
a_max = max(a_max,an)
b_max = max(b_max,bn)
a = np.array(a)
b = np.arr... | import sys,math
import numpy as np
input = sys.stdin.readline
a_max=0
a = []
b = []
N,H = list(map(int,input().split()))
for i in range(N):
an,bn = list(map(int,input().split()))
b.append(bn)
a_max = max(a_max,an)
b = np.array(b)
b = sorted(list(b[b>=a_max]))
cnt = 0
for i in range(len(b... | 29 | 26 | 517 | 436 | import sys, math
import numpy as np
input = sys.stdin.readline
b_max = 0
a_max = 0
a = []
b = []
N, H = list(map(int, input().split()))
for i in range(N):
an, bn = list(map(int, input().split()))
a.append(an)
b.append(bn)
a_max = max(a_max, an)
b_max = max(b_max, bn)
a = np.array(a)
b = np.array(b)... | import sys, math
import numpy as np
input = sys.stdin.readline
a_max = 0
a = []
b = []
N, H = list(map(int, input().split()))
for i in range(N):
an, bn = list(map(int, input().split()))
b.append(bn)
a_max = max(a_max, an)
b = np.array(b)
b = sorted(list(b[b >= a_max]))
cnt = 0
for i in range(len(b)):
H... | false | 10.344828 | [
"-b_max = 0",
"- a.append(an)",
"- b_max = max(b_max, bn)",
"-a = np.array(a)"
] | false | 0.308737 | 0.396853 | 0.777963 | [
"s290216832",
"s488967531"
] |
u674052742 | p02923 | python | s318839361 | s518046503 | 90 | 78 | 14,252 | 15,020 | Accepted | Accepted | 13.33 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 10:13:10 2020
@author: Kanaru Sato
"""
N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for i in range(0,N-1):
if H[i] >= H[i+1]:
count += 1
ans = max(ans,count)
else:
count = 0
print(ans... | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 10:13:10 2020
@author: Kanaru Sato
"""
N = int(eval(input()))
H = list(map(int, input().split()))
record = 0
count = 0
for i in range(0,N-1):
if H[i] >= H[i+1]:
count += 1
else:
record = max(count,record)
count = 0
... | 20 | 22 | 315 | 351 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 10:13:10 2020
@author: Kanaru Sato
"""
N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for i in range(0, N - 1):
if H[i] >= H[i + 1]:
count += 1
ans = max(ans, count)
else:
count = 0
print(ans)
| # -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 10:13:10 2020
@author: Kanaru Sato
"""
N = int(eval(input()))
H = list(map(int, input().split()))
record = 0
count = 0
for i in range(0, N - 1):
if H[i] >= H[i + 1]:
count += 1
else:
record = max(count, record)
count = 0
ans = max(record,... | false | 9.090909 | [
"-ans = 0",
"+record = 0",
"- ans = max(ans, count)",
"+ record = max(count, record)",
"+ans = max(record, count)"
] | false | 0.195976 | 0.162442 | 1.20644 | [
"s318839361",
"s518046503"
] |
u353797797 | p03170 | python | s348693159 | s365373544 | 522 | 126 | 3,828 | 3,828 | Accepted | Accepted | 75.86 | def judge(i):
for a in a_s:
di = i - a
if di < 0:
return "Second"
if dp[di] == "Second":
return "First"
return "Second"
n, k = list(map(int, input().split()))
a_s = list(map(int, input().split()))
dp = [""] * (k + 1)
dp[0] = "Second"
for i in range... | n, k = list(map(int, input().split()))
a_s = list(map(int, input().split()))
dp = ["Second"] * (k + 1)
for i in range(k + 1):
if dp[i] == "Second":
for a in a_s:
ii = i + a
if ii <= k:
dp[ii] = "First"
print((dp[-1]))
| 17 | 10 | 363 | 271 | def judge(i):
for a in a_s:
di = i - a
if di < 0:
return "Second"
if dp[di] == "Second":
return "First"
return "Second"
n, k = list(map(int, input().split()))
a_s = list(map(int, input().split()))
dp = [""] * (k + 1)
dp[0] = "Second"
for i in range(1, k + 1):
... | n, k = list(map(int, input().split()))
a_s = list(map(int, input().split()))
dp = ["Second"] * (k + 1)
for i in range(k + 1):
if dp[i] == "Second":
for a in a_s:
ii = i + a
if ii <= k:
dp[ii] = "First"
print((dp[-1]))
| false | 41.176471 | [
"-def judge(i):",
"- for a in a_s:",
"- di = i - a",
"- if di < 0:",
"- return \"Second\"",
"- if dp[di] == \"Second\":",
"- return \"First\"",
"- return \"Second\"",
"-",
"-",
"-dp = [\"\"] * (k + 1)",
"-dp[0] = \"Second\"",
"-for i in range(... | false | 0.07219 | 0.03952 | 1.826665 | [
"s348693159",
"s365373544"
] |
u223133214 | p02844 | python | s699314650 | s894454601 | 1,148 | 875 | 59,868 | 50,300 | Accepted | Accepted | 23.78 | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(0, 1000):
k = str(i).zfill(3)
dic = {0: False, 1: False, 2: False}
for t in str(S):
if dic[0] is False:
if t == k[0]:
dic[0] = True
else:
... | import sys
input = sys.stdin.buffer.readline
def canMakeNumber(k, s):
k = str(k).zfill(3)
dic = {0: False, 1: False, 2: False}
for t in s:
if dic[0] is False:
if t == k[0]:
dic[0] = True
else:
if dic[1] is False:
if t == ... | 28 | 32 | 693 | 736 | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(0, 1000):
k = str(i).zfill(3)
dic = {0: False, 1: False, 2: False}
for t in str(S):
if dic[0] is False:
if t == k[0]:
dic[0] = True
else:
if d... | import sys
input = sys.stdin.buffer.readline
def canMakeNumber(k, s):
k = str(k).zfill(3)
dic = {0: False, 1: False, 2: False}
for t in s:
if dic[0] is False:
if t == k[0]:
dic[0] = True
else:
if dic[1] is False:
if t == k[1]:
... | false | 12.5 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-ans = 0",
"-for i in range(0, 1000):",
"- k = str(i).zfill(3)",
"+",
"+",
"+def canMakeNumber(k, s):",
"+ k = str(k).zfill(3)",
"- for t in str(S):",
"+ for t in s:",
"- ans += 1",
"- ... | false | 0.096629 | 0.045596 | 2.119249 | [
"s699314650",
"s894454601"
] |
u814781830 | p03111 | python | s715820752 | s386584774 | 392 | 300 | 56,412 | 46,812 | Accepted | Accepted | 23.47 | from itertools import product
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10 ** 9
t1 = set([0,1,2,3])
t2= set([1,2,3])
def calc(t):
t3 = set(t)
if not (t3 == t1 or t3 == t2): return INF
a, b, c = 0, 0, 0
cnt = 0
for i, v in enumerate(t):
... | from itertools import product
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10 ** 9
ans = INF
def calc(a, b, c):
la, lb, lc = len(a), len(b), len(c)
if la + lb + lc < 3 or 0 in (la, lb, lc): return INF
sa, sb, sc = sum(a), sum(b), sum(c)
t = 0
... | 26 | 25 | 634 | 631 | from itertools import product
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10**9
t1 = set([0, 1, 2, 3])
t2 = set([1, 2, 3])
def calc(t):
t3 = set(t)
if not (t3 == t1 or t3 == t2):
return INF
a, b, c = 0, 0, 0
cnt = 0
for i, v in enumerate(t... | from itertools import product
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10**9
ans = INF
def calc(a, b, c):
la, lb, lc = len(a), len(b), len(c)
if la + lb + lc < 3 or 0 in (la, lb, lc):
return INF
sa, sb, sc = sum(a), sum(b), sum(c)
t = 0
... | false | 3.846154 | [
"-t1 = set([0, 1, 2, 3])",
"-t2 = set([1, 2, 3])",
"+ans = INF",
"-def calc(t):",
"- t3 = set(t)",
"- if not (t3 == t1 or t3 == t2):",
"+def calc(a, b, c):",
"+ la, lb, lc = len(a), len(b), len(c)",
"+ if la + lb + lc < 3 or 0 in (la, lb, lc):",
"- a, b, c = 0, 0, 0",
"- cnt = ... | false | 0.118982 | 0.195473 | 0.608686 | [
"s715820752",
"s386584774"
] |
u574922408 | p03014 | python | s760477867 | s124415159 | 1,998 | 1,705 | 493,736 | 430,120 | Accepted | Accepted | 14.66 | #!/usr/bin/env python3
import sys
import collections as cl
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
H, W = MI()
room = [["" for j in range(W)] for i i... | #!/usr/bin/env python3
import sys
import collections as cl
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
H, W = MI()
room = [["" for j in range(W)] for i i... | 54 | 48 | 1,401 | 1,197 | #!/usr/bin/env python3
import sys
import collections as cl
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map(int, sys.stdin.readline().split()))
def main():
H, W = MI()
room = [["" for j in range(W)] for i in ra... | #!/usr/bin/env python3
import sys
import collections as cl
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map(int, sys.stdin.readline().split()))
def main():
H, W = MI()
room = [["" for j in range(W)] for i in ra... | false | 11.111111 | [
"- num_tate = [[0 for j in range(W)] for i in range(H)]",
"- num_sum = [[0 for j in range(W)] for i in range(H)]",
"+ num_tate = 0 if target[i] == \"#\" else splited[tmp]",
"+ ans = max(ans, num_tate + num_yoko[i][j] - 1)",
"- num_tate[i][j] == 0",
"- ... | false | 0.198536 | 0.036738 | 5.404097 | [
"s760477867",
"s124415159"
] |
u930705402 | p02834 | python | s417567523 | s317550144 | 1,032 | 928 | 98,348 | 97,840 | Accepted | Accepted | 10.08 | import sys
sys.setrecursionlimit(10**7)
def dfs(v,p,d):
dist[v]=d
for nv in G[v]:
if nv==p:
continue
dfs(nv,v,d+1)
def getSP(v):
p=v
if dist[v]==lim:
return p
for nv in G[v]:
if dist[nv]<dist[v]:
p=getSP(nv)
return p
def d... | import sys
sys.setrecursionlimit(10**7)
def dfs(v,p,d):
dist[v]=d
for nv in G[v]:
if nv==p:
continue
dfs(nv,v,d+1)
def getSP(v):
p=v
if dist[v]==lim:
return p
for nv in G[v]:
if dist[nv]<dist[v]:
p=getSP(nv)
retur... | 43 | 45 | 838 | 799 | import sys
sys.setrecursionlimit(10**7)
def dfs(v, p, d):
dist[v] = d
for nv in G[v]:
if nv == p:
continue
dfs(nv, v, d + 1)
def getSP(v):
p = v
if dist[v] == lim:
return p
for nv in G[v]:
if dist[nv] < dist[v]:
p = getSP(nv)
return p
... | import sys
sys.setrecursionlimit(10**7)
def dfs(v, p, d):
dist[v] = d
for nv in G[v]:
if nv == p:
continue
dfs(nv, v, d + 1)
def getSP(v):
p = v
if dist[v] == lim:
return p
for nv in G[v]:
if dist[nv] < dist[v]:
p = getSP(nv)
return p
... | false | 4.444444 | [
"- sdist[v] = d",
"+ global maxd",
"+ maxd = max(maxd, dist[v])",
"-sdist = [-1] * N",
"+maxd = -1",
"-D, tmp = -1, -1",
"-for i in range(N):",
"- if sdist[i] > tmp:",
"- D = i",
"- tmp = sdist[i]",
"-print((dist[D] - 1))",
"+print((maxd - 1))"
] | false | 0.036626 | 0.037761 | 0.969948 | [
"s417567523",
"s317550144"
] |
u146816547 | p02389 | python | s810333827 | s657581452 | 20 | 10 | 4,184 | 6,412 | Accepted | Accepted | 50 | a, b=list(map(int,input().split()))
print(a*b, 2*a+2*b) | a, b = list(map(int, input().split()))
print(a*b, 2*(a+b)) | 2 | 2 | 53 | 56 | a, b = list(map(int, input().split()))
print(a * b, 2 * a + 2 * b)
| a, b = list(map(int, input().split()))
print(a * b, 2 * (a + b))
| false | 0 | [
"-print(a * b, 2 * a + 2 * b)",
"+print(a * b, 2 * (a + b))"
] | false | 0.044542 | 0.047749 | 0.932832 | [
"s810333827",
"s657581452"
] |
u119982001 | p02725 | python | s884768218 | s621792295 | 166 | 134 | 26,444 | 26,420 | Accepted | Accepted | 19.28 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
maxi = 0
for i in range(1, len(A)):
ans += abs(A[i]-A[i-1])
if maxi < abs(A[i]-A[i-1]): maxi = abs(A[i]-A[i-1])
if A[0]==0:
if maxi < N-A[-1]: maxi = N-A[-1]
ans += N-A[-1]
else :
if maxi < N-A[-1... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.append(A[0]+N)
l = 0
for i in range(1, K+1):
l = max(l,A[i]-A[i-1])
print((N-l)) | 18 | 9 | 390 | 163 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
maxi = 0
for i in range(1, len(A)):
ans += abs(A[i] - A[i - 1])
if maxi < abs(A[i] - A[i - 1]):
maxi = abs(A[i] - A[i - 1])
if A[0] == 0:
if maxi < N - A[-1]:
maxi = N - A[-1]
ans += N - A[-1]
else:
if... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.append(A[0] + N)
l = 0
for i in range(1, K + 1):
l = max(l, A[i] - A[i - 1])
print((N - l))
| false | 50 | [
"-ans = 0",
"-maxi = 0",
"-for i in range(1, len(A)):",
"- ans += abs(A[i] - A[i - 1])",
"- if maxi < abs(A[i] - A[i - 1]):",
"- maxi = abs(A[i] - A[i - 1])",
"-if A[0] == 0:",
"- if maxi < N - A[-1]:",
"- maxi = N - A[-1]",
"- ans += N - A[-1]",
"-else:",
"- if ma... | false | 0.05302 | 0.038232 | 1.386771 | [
"s884768218",
"s621792295"
] |
u562935282 | p02937 | python | s225772524 | s909301724 | 154 | 106 | 7,668 | 7,628 | Accepted | Accepted | 31.17 | from bisect import bisect_left
import sys
input = sys.stdin.readline
s = input().strip()
n = len(s)
t = input().strip()
d = [[] for _ in range(26)]
base = ord('a')
for i, c in enumerate(s):
idx = ord(c) - base
d[idx].append(i)
string_count = 0
cur = -1
for tt in t:
cur += 1
idx = ... | def main():
from bisect import bisect_left
S = eval(input())
T = eval(input())
L = len(S)
pos = tuple(list() for _ in range(26))
orda = ord('a')
for i, c in enumerate(S):
j = ord(c) - orda
pos[j].append(i)
rep = 0
curr = 0
for c in T:
... | 36 | 34 | 710 | 658 | from bisect import bisect_left
import sys
input = sys.stdin.readline
s = input().strip()
n = len(s)
t = input().strip()
d = [[] for _ in range(26)]
base = ord("a")
for i, c in enumerate(s):
idx = ord(c) - base
d[idx].append(i)
string_count = 0
cur = -1
for tt in t:
cur += 1
idx = ord(tt) - base
pos... | def main():
from bisect import bisect_left
S = eval(input())
T = eval(input())
L = len(S)
pos = tuple(list() for _ in range(26))
orda = ord("a")
for i, c in enumerate(S):
j = ord(c) - orda
pos[j].append(i)
rep = 0
curr = 0
for c in T:
j = ord(c) - orda
... | false | 5.555556 | [
"-from bisect import bisect_left",
"-import sys",
"+def main():",
"+ from bisect import bisect_left",
"-input = sys.stdin.readline",
"-s = input().strip()",
"-n = len(s)",
"-t = input().strip()",
"-d = [[] for _ in range(26)]",
"-base = ord(\"a\")",
"-for i, c in enumerate(s):",
"- idx =... | false | 0.038521 | 0.03892 | 0.989738 | [
"s225772524",
"s909301724"
] |
u126478680 | p02343 | python | s741267130 | s390190303 | 6,570 | 920 | 9,684 | 6,048 | Accepted | Accepted | 86 | #! python3
# disjoint_set_union_find_tree.py
n, q = [int(x) for x in input().split(' ')]
sets = [set([i]) for i in range(n)]
def unite(Sx, Sy):
return Sx | Sy
def search(x):
global sets
flag = False
for i in range(len(sets)):
if x in sets[i]:
flag = True
... | #! python3
# disjoint_set_union_find_tree.py
class UnionFindTree():
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
... | 45 | 41 | 955 | 1,027 | #! python3
# disjoint_set_union_find_tree.py
n, q = [int(x) for x in input().split(" ")]
sets = [set([i]) for i in range(n)]
def unite(Sx, Sy):
return Sx | Sy
def search(x):
global sets
flag = False
for i in range(len(sets)):
if x in sets[i]:
flag = True
break
if ... | #! python3
# disjoint_set_union_find_tree.py
class UnionFindTree:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
... | false | 8.888889 | [
"-n, q = [int(x) for x in input().split(\" \")]",
"-sets = [set([i]) for i in range(n)]",
"+class UnionFindTree:",
"+ def __init__(self, n):",
"+ self.par = [i for i in range(n + 1)]",
"+ self.rank = [0] * (n + 1)",
"+",
"+ def find(self, x):",
"+ if self.par[x] == x:",
... | false | 0.036259 | 0.04208 | 0.861666 | [
"s741267130",
"s390190303"
] |
u241159583 | p03087 | python | s775504253 | s173046640 | 863 | 596 | 6,132 | 30,340 | Accepted | Accepted | 30.94 | N, Q = list(map(int, input().split()))
S = eval(input())
ans = [0] * N
for i in range(N-1):
if S[i] == "A" and S[i+1] == "C":
ans[i+1] += (ans[i] + 1)
else:
ans[i+1] = ans[i]
for _ in range(Q):
l, r = list(map(int, input().split()))
print((ans[r-1] - ans[l-1])) | from bisect import bisect_left, bisect_right
n,q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
numbers = []
for i in range(n-1):
if s[i]+s[i+1] == "AC":
numbers.append(i+1)
for l,r in lr:
x,y = bisect_left(numbers, l), bisect_righ... | 13 | 14 | 287 | 409 | N, Q = list(map(int, input().split()))
S = eval(input())
ans = [0] * N
for i in range(N - 1):
if S[i] == "A" and S[i + 1] == "C":
ans[i + 1] += ans[i] + 1
else:
ans[i + 1] = ans[i]
for _ in range(Q):
l, r = list(map(int, input().split()))
print((ans[r - 1] - ans[l - 1]))
| from bisect import bisect_left, bisect_right
n, q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
numbers = []
for i in range(n - 1):
if s[i] + s[i + 1] == "AC":
numbers.append(i + 1)
for l, r in lr:
x, y = bisect_left(numbers, l), bisect_rig... | false | 7.142857 | [
"-N, Q = list(map(int, input().split()))",
"-S = eval(input())",
"-ans = [0] * N",
"-for i in range(N - 1):",
"- if S[i] == \"A\" and S[i + 1] == \"C\":",
"- ans[i + 1] += ans[i] + 1",
"+from bisect import bisect_left, bisect_right",
"+",
"+n, q = list(map(int, input().split()))",
"+s = ... | false | 0.036962 | 0.039117 | 0.944911 | [
"s775504253",
"s173046640"
] |
u609061751 | p03033 | python | s460026560 | s254876951 | 1,805 | 1,499 | 111,836 | 129,784 | Accepted | Accepted | 16.95 | def main():
import sys
input = lambda : sys.stdin.readline().rstrip()
n, q = list(map(int, input().split()))
stx = []
for _ in range(n):
s, t, x = list(map(int, input().split()))
stx.append([x, s - x, t - x])
stx.sort(reverse=True)
d = [int(eval(input())) for _ in ... | import sys
input = lambda : sys.stdin.readline().rstrip()
def segfun(x, y):
return min(x, y)
ide_ele = float("inf")
class SegmentTree:
def __init__(self, n, ele, segfun):
self.ide_ele = ele
self.segfun = segfun
self.n = n
self.N0 = 1 << n.bit_length()
sel... | 57 | 63 | 1,293 | 1,472 | def main():
import sys
input = lambda: sys.stdin.readline().rstrip()
n, q = list(map(int, input().split()))
stx = []
for _ in range(n):
s, t, x = list(map(int, input().split()))
stx.append([x, s - x, t - x])
stx.sort(reverse=True)
d = [int(eval(input())) for _ in range(q)]
... | import sys
input = lambda: sys.stdin.readline().rstrip()
def segfun(x, y):
return min(x, y)
ide_ele = float("inf")
class SegmentTree:
def __init__(self, n, ele, segfun):
self.ide_ele = ele
self.segfun = segfun
self.n = n
self.N0 = 1 << n.bit_length()
self.data = [s... | false | 9.52381 | [
"-def main():",
"- import sys",
"+import sys",
"- input = lambda: sys.stdin.readline().rstrip()",
"- n, q = list(map(int, input().split()))",
"- stx = []",
"- for _ in range(n):",
"- s, t, x = list(map(int, input().split()))",
"- stx.append([x, s - x, t - x])",
"- s... | false | 0.039972 | 0.050664 | 0.788951 | [
"s460026560",
"s254876951"
] |
u391731808 | p03816 | python | s744857256 | s763532626 | 99 | 76 | 18,272 | 17,396 | Accepted | Accepted | 23.23 | N=int(eval(input()))
*A,=list(map(int,input().split()))
cnt = {}
for a in A:
cnt[a] = cnt.get(a,0)+1
keys = sorted(cnt.keys())
i = 0
j = len(keys)-1
while i <= j:
ki,kj = keys[i],keys[j]
if cnt[ki]<=1:
i+=1
continue
if cnt[kj]<=1:
j-=1
continue
cnt[ki]... | N = int(eval(input()))
*A, = list(map(int,input().split()))
c = {}
for a in A:c[a] = c.get(a,0)+1
print((len(c) - sum(v-1 for v in list(c.values()))%2)) | 19 | 5 | 357 | 136 | N = int(eval(input()))
(*A,) = list(map(int, input().split()))
cnt = {}
for a in A:
cnt[a] = cnt.get(a, 0) + 1
keys = sorted(cnt.keys())
i = 0
j = len(keys) - 1
while i <= j:
ki, kj = keys[i], keys[j]
if cnt[ki] <= 1:
i += 1
continue
if cnt[kj] <= 1:
j -= 1
continue
c... | N = int(eval(input()))
(*A,) = list(map(int, input().split()))
c = {}
for a in A:
c[a] = c.get(a, 0) + 1
print((len(c) - sum(v - 1 for v in list(c.values())) % 2))
| false | 73.684211 | [
"-cnt = {}",
"+c = {}",
"- cnt[a] = cnt.get(a, 0) + 1",
"-keys = sorted(cnt.keys())",
"-i = 0",
"-j = len(keys) - 1",
"-while i <= j:",
"- ki, kj = keys[i], keys[j]",
"- if cnt[ki] <= 1:",
"- i += 1",
"- continue",
"- if cnt[kj] <= 1:",
"- j -= 1",
"- ... | false | 0.081741 | 0.079513 | 1.028015 | [
"s744857256",
"s763532626"
] |
u695079172 | p02699 | python | s766096074 | s623962291 | 24 | 21 | 9,152 | 9,136 | Accepted | Accepted | 12.5 |
def main():
s,w = list(map(int,input().split()))
if s <= w:
print("unsafe")
else:
print("safe")
if __name__ == '__main__':
main()
| def main():
s,w = list(map(int,input().split()))
answer = "unsafe" if w >= s else "safe"
print(answer)
if __name__ == '__main__':
main()
| 10 | 6 | 167 | 152 | def main():
s, w = list(map(int, input().split()))
if s <= w:
print("unsafe")
else:
print("safe")
if __name__ == "__main__":
main()
| def main():
s, w = list(map(int, input().split()))
answer = "unsafe" if w >= s else "safe"
print(answer)
if __name__ == "__main__":
main()
| false | 40 | [
"- if s <= w:",
"- print(\"unsafe\")",
"- else:",
"- print(\"safe\")",
"+ answer = \"unsafe\" if w >= s else \"safe\"",
"+ print(answer)"
] | false | 0.15191 | 0.046091 | 3.295879 | [
"s766096074",
"s623962291"
] |
u716530146 | p02833 | python | s170882464 | s506275319 | 21 | 17 | 3,440 | 2,940 | Accepted | Accepted | 19.05 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
minans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(eval(input()))
if n%2==1:
print((0))
exit()
k=10
for i in range(1,100):
... | count=0
k=5
n=int(eval(input()))
if n%2==1:
print((0))
else:
n//=2
for i in range(1,100):
count+=int(n//(k))
k*=5
print(count)
| 17 | 11 | 353 | 161 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
minans = inf
ans = 0
count = 0
pro = 1
n = int(eval(input()))
if n % 2 == 1:
print((0))
exit()
k = 10
for i in range(1, 100):
count... | count = 0
k = 5
n = int(eval(input()))
if n % 2 == 1:
print((0))
else:
n //= 2
for i in range(1, 100):
count += int(n // (k))
k *= 5
print(count)
| false | 35.294118 | [
"-#!/usr/bin/env python3",
"-import sys, math, itertools, collections, bisect",
"-",
"-input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"-inf = float(\"inf\")",
"-mod = 10**9 + 7",
"-minans = inf",
"-ans = 0",
"-pro = 1",
"+k = 5",
"- exit()",
"-k = 10",
"-for i in... | false | 0.040439 | 0.040228 | 1.005245 | [
"s170882464",
"s506275319"
] |
u653807637 | p02995 | python | s374884391 | s409008636 | 38 | 35 | 5,048 | 5,048 | Accepted | Accepted | 7.89 | from fractions import gcd
from decimal import *
a, b, c, d = list(map(Decimal, input().split()))
e = c * d / gcd(c, d)
print((int(b - a + 1 - ((b // c + b // d - b // e) - ((a - 1) // c + (a - 1) // d - (a - 1) // e))))) | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
e = c * d // gcd(c, d)
print((int(b - a + 1 - ((b // c + b // d - b // e) - ((a - 1) // c + (a - 1) // d - (a - 1) // e))))) | 6 | 4 | 224 | 196 | from fractions import gcd
from decimal import *
a, b, c, d = list(map(Decimal, input().split()))
e = c * d / gcd(c, d)
print(
(
int(
b
- a
+ 1
- (
(b // c + b // d - b // e)
- ((a - 1) // c + (a - 1) // d - (a - 1) // e)
... | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
e = c * d // gcd(c, d)
print(
(
int(
b
- a
+ 1
- (
(b // c + b // d - b // e)
- ((a - 1) // c + (a - 1) // d - (a - 1) // e)
)
)
)
)... | false | 33.333333 | [
"-from decimal import *",
"-a, b, c, d = list(map(Decimal, input().split()))",
"-e = c * d / gcd(c, d)",
"+a, b, c, d = list(map(int, input().split()))",
"+e = c * d // gcd(c, d)"
] | false | 0.131695 | 0.047952 | 2.74637 | [
"s374884391",
"s409008636"
] |
u450339194 | p03064 | python | s796422989 | s675296992 | 2,032 | 1,012 | 224,024 | 223,224 | Accepted | Accepted | 50.2 | import numpy as np
mod = 998244353
N = int(eval(input()))
a = np.array([int(eval(input())) for i in range(N)])
sum_a = np.sum(a)
dp = np.zeros((N+1, sum_a+1))
dp[0,0] = 1
for i in range(1, N+1):
a_i = a[i-1]
dp[i,a_i:] += dp[i-1,:-a_i]
dp[i,:] += dp[i-1,:] * 2
dp[i,:] %= mod
exc = np.s... | import numpy as np
mod = 998244353
N = int(eval(input()))
a = np.array([int(eval(input())) for i in range(N)])
sum_a = np.sum(a)
dp = np.zeros((N+1, sum_a+1), dtype=np.int64)
dp[0,0] = 1
for i in range(1, N+1):
a_i = a[i-1]
dp[i,a_i:] += dp[i-1,:-a_i]
dp[i,:] += dp[i-1,:] * 2
dp[i,:] %= m... | 29 | 29 | 639 | 666 | import numpy as np
mod = 998244353
N = int(eval(input()))
a = np.array([int(eval(input())) for i in range(N)])
sum_a = np.sum(a)
dp = np.zeros((N + 1, sum_a + 1))
dp[0, 0] = 1
for i in range(1, N + 1):
a_i = a[i - 1]
dp[i, a_i:] += dp[i - 1, :-a_i]
dp[i, :] += dp[i - 1, :] * 2
dp[i, :] %= mod
exc = np.... | import numpy as np
mod = 998244353
N = int(eval(input()))
a = np.array([int(eval(input())) for i in range(N)])
sum_a = np.sum(a)
dp = np.zeros((N + 1, sum_a + 1), dtype=np.int64)
dp[0, 0] = 1
for i in range(1, N + 1):
a_i = a[i - 1]
dp[i, a_i:] += dp[i - 1, :-a_i]
dp[i, :] += dp[i - 1, :] * 2
dp[i, :] ... | false | 0 | [
"-dp = np.zeros((N + 1, sum_a + 1))",
"+dp = np.zeros((N + 1, sum_a + 1), dtype=np.int64)",
"- dp = np.zeros((N + 1, sum_a + 1))",
"+ dp = np.zeros((N + 1, sum_a + 1), dtype=np.int64)",
"-print((int(res % mod)))",
"+print((res % mod))"
] | false | 0.399687 | 0.257472 | 1.552351 | [
"s796422989",
"s675296992"
] |
u410118019 | p02959 | python | s553682249 | s743019636 | 128 | 102 | 18,624 | 18,476 | Accepted | Accepted | 20.31 | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(n):
if a[i] >= b[i]:
c += b[i]
else:
d = b[i] -a[i]
if a[i+1] <= d:
c += a[i] + a[i+1]
a[i+1] = 0
else:
a[i+1] -= d
c += b[i]
print(c) | def main():
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(n):
if a[i] >= b[i]:
c += b[i]
else:
d = b[i] -a[i]
if a[i+1] <= d:
c += a[i] + a[i+1]
a[i+1] = 0
else:
a[i+1] -= ... | 16 | 20 | 301 | 386 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(n):
if a[i] >= b[i]:
c += b[i]
else:
d = b[i] - a[i]
if a[i + 1] <= d:
c += a[i] + a[i + 1]
a[i + 1] = 0
else:
a[i + 1] -= d
... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(n):
if a[i] >= b[i]:
c += b[i]
else:
d = b[i] - a[i]
if a[i + 1] <= d:
c += a[i] + a[i + 1]
... | false | 20 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-c = 0",
"-for i in range(n):",
"- if a[i] >= b[i]:",
"- c += b[i]",
"- else:",
"- d = b[i] - a[i]",
"- if a[i + 1] <= d:",
"- c += a[i] + a[i + 1]",
... | false | 0.045439 | 0.045186 | 1.005591 | [
"s553682249",
"s743019636"
] |
u941644149 | p02773 | python | s157113708 | s442792926 | 659 | 594 | 32,988 | 35,944 | Accepted | Accepted | 9.86 | N = int(eval(input()))
Dic = {}
for n in range(N):
S = eval(input())
if S in list(Dic.keys()):
Dic[S] = Dic[S] + 1
else:
Dic[S] = 1
max_val = max(Dic.values())
max_k_list = [kv[0] for kv in list(Dic.items()) if kv[1] == max_val]
max_k_list = sorted(max_k_list)
for t in max_k_lis... | from collections import Counter
N = int(input())
#L = [input() for _ in range(N)]
L = []
for n in range(N):
S = input()
L.append(S)
Dic = Counter(L)
max_value = max(Dic.values())
max_k_list = [i for i, j in Dic.items() if j == max_value]
max_k_list = sorted(max_k_list)
print(*max_k_list , sep="\n")... | 14 | 13 | 312 | 320 | N = int(eval(input()))
Dic = {}
for n in range(N):
S = eval(input())
if S in list(Dic.keys()):
Dic[S] = Dic[S] + 1
else:
Dic[S] = 1
max_val = max(Dic.values())
max_k_list = [kv[0] for kv in list(Dic.items()) if kv[1] == max_val]
max_k_list = sorted(max_k_list)
for t in max_k_list:
print(... | from collections import Counter
N = int(input())
# L = [input() for _ in range(N)]
L = []
for n in range(N):
S = input()
L.append(S)
Dic = Counter(L)
max_value = max(Dic.values())
max_k_list = [i for i, j in Dic.items() if j == max_value]
max_k_list = sorted(max_k_list)
print(*max_k_list, sep="\n")
| false | 7.142857 | [
"-N = int(eval(input()))",
"-Dic = {}",
"+from collections import Counter",
"+",
"+N = int(input())",
"+# L = [input() for _ in range(N)]",
"+L = []",
"- S = eval(input())",
"- if S in list(Dic.keys()):",
"- Dic[S] = Dic[S] + 1",
"- else:",
"- Dic[S] = 1",
"-max_val = ... | false | 0.047743 | 0.04837 | 0.987039 | [
"s157113708",
"s442792926"
] |
u802627598 | p03030 | python | s776749782 | s803927140 | 24 | 22 | 3,444 | 3,444 | Accepted | Accepted | 8.33 | import copy
n = int(eval(input()))
l = [input().split() for i in range(n)]
index = copy.deepcopy(l)
for i in range(n):
l[i][1] = int(l[i][1])
index[i][1] = int(index[i][1])
l.sort(key=lambda x: x[1], reverse=True)
l.sort(key=lambda x: x[0], reverse=False)
for i in range(n):
for j in range(... | import copy
res_list = []
n = int(eval(input()))
for i in range(n):
name, score = input().split()
score = int(score)
res_list.append([name,score,i+1])
res_list.sort(key=lambda x: x[1],reverse=True)
res_list.sort(key=lambda x: x[0],reverse=False)
for i in res_list:
print((i[2]))
| 18 | 16 | 391 | 307 | import copy
n = int(eval(input()))
l = [input().split() for i in range(n)]
index = copy.deepcopy(l)
for i in range(n):
l[i][1] = int(l[i][1])
index[i][1] = int(index[i][1])
l.sort(key=lambda x: x[1], reverse=True)
l.sort(key=lambda x: x[0], reverse=False)
for i in range(n):
for j in range(n):
if l[... | import copy
res_list = []
n = int(eval(input()))
for i in range(n):
name, score = input().split()
score = int(score)
res_list.append([name, score, i + 1])
res_list.sort(key=lambda x: x[1], reverse=True)
res_list.sort(key=lambda x: x[0], reverse=False)
for i in res_list:
print((i[2]))
| false | 11.111111 | [
"+res_list = []",
"-l = [input().split() for i in range(n)]",
"-index = copy.deepcopy(l)",
"- l[i][1] = int(l[i][1])",
"- index[i][1] = int(index[i][1])",
"-l.sort(key=lambda x: x[1], reverse=True)",
"-l.sort(key=lambda x: x[0], reverse=False)",
"-for i in range(n):",
"- for j in range(n):"... | false | 0.060369 | 0.03743 | 1.612861 | [
"s776749782",
"s803927140"
] |
u562935282 | p04000 | python | s782434608 | s559646211 | 1,965 | 1,162 | 166,548 | 104,816 | Accepted | Accepted | 40.87 | h, w, n = list(map(int, input().split()))
c = dict()
for _ in range(n):
a, b = list(map(int, input().split()))
for da in -1, 0, 1:
for db in -1, 0, 1:
if (2 <= a + da <= h - 1) and (2 <= b + db <= w - 1):
c[(a + da, b + db)] = c.get((a + da, b + db), 0) + 1
#print... | def main():
from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
g = defaultdict(int)
for _ in range(N):
a, b = (int(x) - 1 for x in input().split())
for i in range(3):
if a - i < 0: continue
... | 19 | 31 | 536 | 781 | h, w, n = list(map(int, input().split()))
c = dict()
for _ in range(n):
a, b = list(map(int, input().split()))
for da in -1, 0, 1:
for db in -1, 0, 1:
if (2 <= a + da <= h - 1) and (2 <= b + db <= w - 1):
c[(a + da, b + db)] = c.get((a + da, b + db), 0) + 1
# print(c)
ans_cnt... | def main():
from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
g = defaultdict(int)
for _ in range(N):
a, b = (int(x) - 1 for x in input().split())
for i in range(3):
if a - i < 0:
continue
... | false | 38.709677 | [
"-h, w, n = list(map(int, input().split()))",
"-c = dict()",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- for da in -1, 0, 1:",
"- for db in -1, 0, 1:",
"- if (2 <= a + da <= h - 1) and (2 <= b + db <= w - 1):",
"- c[(a + da, b + db)] = c... | false | 0.043677 | 0.040362 | 1.082127 | [
"s782434608",
"s559646211"
] |
u968166680 | p03476 | python | s544628735 | s713011955 | 148 | 122 | 29,000 | 29,000 | Accepted | Accepted | 17.57 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [1] * m
for i in range(1, int((n ** 0.5 ... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [1] * m
for i in range(1, int((n ** 0.5 ... | 39 | 39 | 915 | 925 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [1] * m
for i in range(1, int((n**0.5 - 1) / 2) + 1):
... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [1] * m
for i in range(1, int((n**0.5 - 1) / 2) + 1):
... | false | 0 | [
"- Q, *LR = map(int, open(0).read().split())",
"+ Q, *LR = list(map(int, open(0).read().split()))",
"- print(*ans, sep=\"\\n\")",
"+ print((\"\\n\".join(map(str, ans))))"
] | false | 0.062424 | 0.066847 | 0.933839 | [
"s544628735",
"s713011955"
] |
u103539599 | p03545 | python | s885705234 | s470335726 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | S=eval(input())
T=[0]*4
for i in range(4):
T[i]=int(S[i])
if T[0]+T[1]+T[2]+T[3]==7: print((S[0]+"+"+S[1]+"+"+S[2]+"+"+S[3]+"=7"))
elif T[0]+T[1]+T[2]-T[3]==7: print((S[0]+"+"+S[1]+"+"+S[2]+"-"+S[3]+"=7"))
elif T[0]+T[1]-T[2]-T[3]==7: print((S[0]+"+"+S[1]+"-"+S[2]+"-"+S[3]+"=7"))
elif T[0]+T[1]-T[2]+T[3]==... | S = eval(input())
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
if A+B+C+D == 7: print(("{0}+{1}+{2}+{3}=7".format(A,B,C,D)))
elif A-B+C+D == 7: print(("{0}-{1}+{2}+{3}=7".format(A,B,C,D)))
elif A-B-C+D == 7: print(("{0}-{1}-{2}+{3}=7".format(A,B,C,D)))
elif A-B-C-D == 7: print(("{0}-{1}-{2}-{3}=7".... | 13 | 14 | 651 | 575 | S = eval(input())
T = [0] * 4
for i in range(4):
T[i] = int(S[i])
if T[0] + T[1] + T[2] + T[3] == 7:
print((S[0] + "+" + S[1] + "+" + S[2] + "+" + S[3] + "=7"))
elif T[0] + T[1] + T[2] - T[3] == 7:
print((S[0] + "+" + S[1] + "+" + S[2] + "-" + S[3] + "=7"))
elif T[0] + T[1] - T[2] - T[3] == 7:
print((S[... | S = eval(input())
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
if A + B + C + D == 7:
print(("{0}+{1}+{2}+{3}=7".format(A, B, C, D)))
elif A - B + C + D == 7:
print(("{0}-{1}+{2}+{3}=7".format(A, B, C, D)))
elif A - B - C + D == 7:
print(("{0}-{1}-{2}+{3}=7".format(A, B, C, D)))
elif A - B - C - ... | false | 7.142857 | [
"-T = [0] * 4",
"-for i in range(4):",
"- T[i] = int(S[i])",
"-if T[0] + T[1] + T[2] + T[3] == 7:",
"- print((S[0] + \"+\" + S[1] + \"+\" + S[2] + \"+\" + S[3] + \"=7\"))",
"-elif T[0] + T[1] + T[2] - T[3] == 7:",
"- print((S[0] + \"+\" + S[1] + \"+\" + S[2] + \"-\" + S[3] + \"=7\"))",
"-elif... | false | 0.057458 | 0.06871 | 0.836234 | [
"s885705234",
"s470335726"
] |
u451017206 | p03078 | python | s252116596 | s057598169 | 773 | 45 | 4,324 | 6,000 | Accepted | Accepted | 94.18 | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
h = []
heapq.heappush(h, (-(A[0] + B[0] + C[0]), (0, 0, 0)))
ans = []
... | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
h = []
heapq.heappush(h, (-(A[0] + B[0] + C[0]), (0, 0, 0)))
ans = []
... | 23 | 27 | 905 | 1,083 | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
h = []
heapq.heappush(h, (-(A[0] + B[0] + C[0]), (0, 0, 0)))
ans = []
for _ in ra... | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
h = []
heapq.heappush(h, (-(A[0] + B[0] + C[0]), (0, 0, 0)))
ans = []
e = set()
f... | false | 14.814815 | [
"+e = set()",
"- and not (-(A[i + 1] + B[j] + C[k]), (i + 1, j, k)) in h",
"+ and not (-(A[i + 1] + B[j] + C[k]), (i + 1, j, k)) in e",
"+ e.add((-(A[i + 1] + B[j] + C[k]), (i + 1, j, k)))",
"- and not (-(A[i] + B[j + 1] + C[k]), (i, j + 1, k)) in h",
"+ and not (-(A[i] ... | false | 0.065128 | 0.037381 | 1.742288 | [
"s252116596",
"s057598169"
] |
u462329577 | p02765 | python | s069229840 | s821565636 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | #!/usr/bin/env python3
k,n = list(map(int,input().split()))
if k >= 10:
print(n)
else:
print((n+100*(10-k))) | #!/usr/bin/env python3
n,r = list(map(int,input().split()))
print((r+100*max(0,10-n))) | 6 | 3 | 113 | 80 | #!/usr/bin/env python3
k, n = list(map(int, input().split()))
if k >= 10:
print(n)
else:
print((n + 100 * (10 - k)))
| #!/usr/bin/env python3
n, r = list(map(int, input().split()))
print((r + 100 * max(0, 10 - n)))
| false | 50 | [
"-k, n = list(map(int, input().split()))",
"-if k >= 10:",
"- print(n)",
"-else:",
"- print((n + 100 * (10 - k)))",
"+n, r = list(map(int, input().split()))",
"+print((r + 100 * max(0, 10 - n)))"
] | false | 0.120371 | 0.03659 | 3.289739 | [
"s069229840",
"s821565636"
] |
u829859091 | p02888 | python | s218510131 | s432477187 | 1,701 | 1,309 | 3,188 | 3,316 | Accepted | Accepted | 23.05 | from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
res = 0
for i in range(N):
for j in range(i+1, N):
idx = bisect_left(L, L[i]+L[j])
res += max(0,idx-(j+1))
print(res) | from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
res = 0
for i in range(N-2):
for j in range(i+1, N-1):
idx = bisect_left(L, L[i]+L[j])
res += idx-(j+1)
print(res) | 10 | 13 | 239 | 242 | from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
res = 0
for i in range(N):
for j in range(i + 1, N):
idx = bisect_left(L, L[i] + L[j])
res += max(0, idx - (j + 1))
print(res)
| from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
res = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
idx = bisect_left(L, L[i] + L[j])
res += idx - (j + 1)
print(res)
| false | 23.076923 | [
"-for i in range(N):",
"- for j in range(i + 1, N):",
"+for i in range(N - 2):",
"+ for j in range(i + 1, N - 1):",
"- res += max(0, idx - (j + 1))",
"+ res += idx - (j + 1)"
] | false | 0.044639 | 0.085521 | 0.52196 | [
"s218510131",
"s432477187"
] |
u718436793 | p02899 | python | s794597148 | s369188702 | 174 | 126 | 20,704 | 25,068 | Accepted | Accepted | 27.59 | [print(i,end=' ')for i in{m:i+1for i,m in zip(range(int(input())),list(map(int,input().split())))}.values()]
| print((*[i for i inlist({m:i+1for i,m in zip(list(range(int(eval(input())))),list(map(int,input().split())))}.values())])) | 1 | 1 | 108 | 96 | [
print(i, end=" ")
for i in {
m: i + 1 for i, m in zip(range(int(input())), list(map(int, input().split())))
}.values()
]
| print((*[i for i inlist({m:i+1for i,m in zip(list(range(int(eval(input())))),list(map(int,input().split())))}.values())])) | false | 0 | [
"-[",
"- print(i, end=\" \")",
"- for i in {",
"- m: i + 1 for i, m in zip(range(int(input())), list(map(int, input().split())))",
"- }.values()",
"-]",
"+print((*[i for i inlist({m:i+1for i,m in zip(list(range(int(eval(input())))),list(map(int,input().split())))}.values())]))"
] | false | 0.037662 | 0.036046 | 1.04484 | [
"s794597148",
"s369188702"
] |
u133936772 | p03721 | python | s449065360 | s573523078 | 468 | 188 | 28,124 | 25,116 | Accepted | Accepted | 59.83 | f=lambda:list(map(int,input().split()));n,k=f();c=0
for a,b in sorted(list(f())for _ in[0]*n):
c+=b
if c>=k:print(a);break | n,k,*l=list(map(int,open(0).read().split()));c=0
for a,b in sorted(zip(l[::2],l[1::2])):
c+=b
if c>=k:print(a);break | 4 | 4 | 123 | 117 | f = lambda: list(map(int, input().split()))
n, k = f()
c = 0
for a, b in sorted(list(f()) for _ in [0] * n):
c += b
if c >= k:
print(a)
break
| n, k, *l = list(map(int, open(0).read().split()))
c = 0
for a, b in sorted(zip(l[::2], l[1::2])):
c += b
if c >= k:
print(a)
break
| false | 0 | [
"-f = lambda: list(map(int, input().split()))",
"-n, k = f()",
"+n, k, *l = list(map(int, open(0).read().split()))",
"-for a, b in sorted(list(f()) for _ in [0] * n):",
"+for a, b in sorted(zip(l[::2], l[1::2])):"
] | false | 0.036503 | 0.072876 | 0.500901 | [
"s449065360",
"s573523078"
] |
u887207211 | p03487 | python | s921672335 | s936320231 | 97 | 83 | 17,780 | 17,784 | Accepted | Accepted | 14.43 | N = int(eval(input()))
A = list(map(int,input().split()))
d = {}
for i in range(N):
if(A[i] not in d):
d[A[i]] = 1
else:
d[A[i]] += 1
cnt = 0
for k, v in list(d.items()):
if(k != v):
if(k > v):
cnt += v
else:
cnt += v - k
print(cnt) | N = int(eval(input()))
A = list(map(int,input().split()))
d = {}
for a in A:
if(a in d):
d[a] += 1
else:
d[a] = 1
cnt = 0
for k, v in list(d.items()):
if(k > v):
cnt += v
elif(k < v):
cnt += v - k
print(cnt) | 17 | 16 | 271 | 235 | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for i in range(N):
if A[i] not in d:
d[A[i]] = 1
else:
d[A[i]] += 1
cnt = 0
for k, v in list(d.items()):
if k != v:
if k > v:
cnt += v
else:
cnt += v - k
print(cnt)
| N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
cnt = 0
for k, v in list(d.items()):
if k > v:
cnt += v
elif k < v:
cnt += v - k
print(cnt)
| false | 5.882353 | [
"-for i in range(N):",
"- if A[i] not in d:",
"- d[A[i]] = 1",
"+for a in A:",
"+ if a in d:",
"+ d[a] += 1",
"- d[A[i]] += 1",
"+ d[a] = 1",
"- if k != v:",
"- if k > v:",
"- cnt += v",
"- else:",
"- cnt += v - k",
"... | false | 0.040581 | 0.037565 | 1.080288 | [
"s921672335",
"s936320231"
] |
u392319141 | p02837 | python | s188855189 | s615352465 | 198 | 116 | 3,064 | 3,064 | Accepted | Accepted | 41.41 | N = int(eval(input()))
S = []
for _ in range(N):
A = int(eval(input()))
S.append([tuple(map(int, input().split())) for _ in range(A)])
def sol(state):
for i, A in enumerate(S):
if (state & (1 << i)) == 0:
continue
for j, s in A:
if ((state & (1 << (j - 1... | N = int(eval(input()))
A = []
for _ in range(N):
A.append([tuple(map(int, input().split())) for _ in range(int(eval(input())))])
def exists(state):
ret = 0
for i in range(N):
if ((1 << i) & state) == 0:
continue
ret += 1
for x, y in A[i]:
if ((s... | 20 | 21 | 483 | 477 | N = int(eval(input()))
S = []
for _ in range(N):
A = int(eval(input()))
S.append([tuple(map(int, input().split())) for _ in range(A)])
def sol(state):
for i, A in enumerate(S):
if (state & (1 << i)) == 0:
continue
for j, s in A:
if ((state & (1 << (j - 1))) != 0) !=... | N = int(eval(input()))
A = []
for _ in range(N):
A.append([tuple(map(int, input().split())) for _ in range(int(eval(input())))])
def exists(state):
ret = 0
for i in range(N):
if ((1 << i) & state) == 0:
continue
ret += 1
for x, y in A[i]:
if ((state & (1 << ... | false | 4.761905 | [
"-S = []",
"+A = []",
"- A = int(eval(input()))",
"- S.append([tuple(map(int, input().split())) for _ in range(A)])",
"+ A.append([tuple(map(int, input().split())) for _ in range(int(eval(input())))])",
"-def sol(state):",
"- for i, A in enumerate(S):",
"- if (state & (1 << i)) == 0... | false | 0.043704 | 0.064122 | 0.681586 | [
"s188855189",
"s615352465"
] |
u948524308 | p03062 | python | s476288348 | s099963556 | 126 | 97 | 14,284 | 20,000 | Accepted | Accepted | 23.02 | N=int(eval(input()))
A=list(map(int,input().split()))
cnt=0
S=0
mi=10000000000
C0=False
for i in range(N):
mi=min(mi,abs(A[i]))
if A[i]>0:
S+=A[i]
elif A[i]==0:
C0==True
elif A[i]<0:
cnt+=1
S+=(-A[i])
if cnt%2==0 or C0==True:
print(S)
else:
... | N=int(eval(input()))
A=list(map(int,input().split()))
mi=10**9+1
S=0
cnt=0
for i in range(N):
if A[i]<0:
cnt+=1
a=abs(A[i])
S+=a
mi=min(mi,a)
if cnt%2==0:
ans=S
else:
ans=S-2*mi
print(ans) | 22 | 18 | 329 | 233 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
S = 0
mi = 10000000000
C0 = False
for i in range(N):
mi = min(mi, abs(A[i]))
if A[i] > 0:
S += A[i]
elif A[i] == 0:
C0 == True
elif A[i] < 0:
cnt += 1
S += -A[i]
if cnt % 2 == 0 or C0 == True:
print(S)... | N = int(eval(input()))
A = list(map(int, input().split()))
mi = 10**9 + 1
S = 0
cnt = 0
for i in range(N):
if A[i] < 0:
cnt += 1
a = abs(A[i])
S += a
mi = min(mi, a)
if cnt % 2 == 0:
ans = S
else:
ans = S - 2 * mi
print(ans)
| false | 18.181818 | [
"+mi = 10**9 + 1",
"+S = 0",
"-S = 0",
"-mi = 10000000000",
"-C0 = False",
"- mi = min(mi, abs(A[i]))",
"- if A[i] > 0:",
"- S += A[i]",
"- elif A[i] == 0:",
"- C0 == True",
"- elif A[i] < 0:",
"+ if A[i] < 0:",
"- S += -A[i]",
"-if cnt % 2 == 0 or C0 ==... | false | 0.073849 | 0.037439 | 1.972492 | [
"s476288348",
"s099963556"
] |
u144540235 | p02686 | python | s493587877 | s398311799 | 1,965 | 1,426 | 106,912 | 42,432 | Accepted | Accepted | 27.43 |
def process(tab, first, end):
#print(tab)
#print(first, end)
total = first
for i in tab:
if (i[1] > total):
return ("No")
total += i[0]
if (total < 0):
return ("No")
if (total == end):
return ("Yes")
return... |
def process(tab, first, end):
#print(tab)
#print(first, end)
total = first
for i in tab:
if (i[1] > total):
return ("No")
total += i[0]
if (total < 0):
return ("No")
if (total == end):
return ("Yes")
return... | 71 | 71 | 1,311 | 1,280 | def process(tab, first, end):
# print(tab)
# print(first, end)
total = first
for i in tab:
if i[1] > total:
return "No"
total += i[0]
if total < 0:
return "No"
if total == end:
return "Yes"
return "No"
N = int(eval(input()))
first = -1
la... | def process(tab, first, end):
# print(tab)
# print(first, end)
total = first
for i in tab:
if i[1] > total:
return "No"
total += i[0]
if total < 0:
return "No"
if total == end:
return "Yes"
return "No"
N = int(eval(input()))
first = 0
las... | false | 0 | [
"-first = -1",
"-last = -1",
"+first = 0",
"+last = 0",
"- if avant == 0 and apres > 0 and first == -1:",
"- first = apres",
"- elif apres == 0 and avant > 0 and last == -1:",
"- last = avant",
"+ if avant == 0 and apres > 0:",
"+ first += apres",
"+ elif apres =... | false | 0.037169 | 0.036929 | 1.00648 | [
"s493587877",
"s398311799"
] |
u759412327 | p03494 | python | s186785642 | s081586578 | 166 | 150 | 13,328 | 12,396 | Accepted | Accepted | 9.64 | import numpy as np
eval(input())
x = np.array(input().split(),dtype=np.int32)
answer = 0
while (x%2==0).all():
x //= 2
answer += 1
print(answer)
| import numpy as np
N = int(eval(input()))
a = np.array(input().split(),dtype=np.int32)
z = 0
while (a%2==0).all():
a//=2
z+=1
print(z)
| 9 | 10 | 152 | 144 | import numpy as np
eval(input())
x = np.array(input().split(), dtype=np.int32)
answer = 0
while (x % 2 == 0).all():
x //= 2
answer += 1
print(answer)
| import numpy as np
N = int(eval(input()))
a = np.array(input().split(), dtype=np.int32)
z = 0
while (a % 2 == 0).all():
a //= 2
z += 1
print(z)
| false | 10 | [
"-eval(input())",
"-x = np.array(input().split(), dtype=np.int32)",
"-answer = 0",
"-while (x % 2 == 0).all():",
"- x //= 2",
"- answer += 1",
"-print(answer)",
"+N = int(eval(input()))",
"+a = np.array(input().split(), dtype=np.int32)",
"+z = 0",
"+while (a % 2 == 0).all():",
"+ a //... | false | 0.319219 | 0.848741 | 0.376108 | [
"s186785642",
"s081586578"
] |
u762420987 | p03137 | python | s100074263 | s955706715 | 226 | 108 | 57,640 | 13,960 | Accepted | Accepted | 52.21 | N, M = list(map(int, input().split()))
Xlist = sorted(list(map(int, input().split())))
sbn = [abs(Xlist[i] - Xlist[i + 1]) for i in range(M - 1)]
sbn.sort(reverse=True)
print((sum(sbn[N - 1:]))) | N, M = list(map(int, input().split()))
Xlist = sorted(list(map(int, input().split())))[::-1]
sbn = sorted([abs(Xlist[i] - Xlist[i+1]) for i in range(M-1)])[::-1]
if N >= M:
print((0))
else:
print((sum(sbn[N-1:]))) | 5 | 7 | 190 | 217 | N, M = list(map(int, input().split()))
Xlist = sorted(list(map(int, input().split())))
sbn = [abs(Xlist[i] - Xlist[i + 1]) for i in range(M - 1)]
sbn.sort(reverse=True)
print((sum(sbn[N - 1 :])))
| N, M = list(map(int, input().split()))
Xlist = sorted(list(map(int, input().split())))[::-1]
sbn = sorted([abs(Xlist[i] - Xlist[i + 1]) for i in range(M - 1)])[::-1]
if N >= M:
print((0))
else:
print((sum(sbn[N - 1 :])))
| false | 28.571429 | [
"-Xlist = sorted(list(map(int, input().split())))",
"-sbn = [abs(Xlist[i] - Xlist[i + 1]) for i in range(M - 1)]",
"-sbn.sort(reverse=True)",
"-print((sum(sbn[N - 1 :])))",
"+Xlist = sorted(list(map(int, input().split())))[::-1]",
"+sbn = sorted([abs(Xlist[i] - Xlist[i + 1]) for i in range(M - 1)])[::-1]"... | false | 0.0861 | 0.085971 | 1.001509 | [
"s100074263",
"s955706715"
] |
u535907456 | p03078 | python | s999403423 | s900807138 | 1,779 | 37 | 3,700 | 5,232 | Accepted | Accepted | 97.92 | X,Y,Z,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ABlist = []
ABClist = []
for x in A:
for y in B:
sumple = x + y
ABlist.append(sumple)
ABlist.sort(reverse=True)
ABlist = ABlist[:K]
... | import heapq
X,Y,Z,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = []
item = (0,(0,0,0))
max_score = A[0] + B[0] + C[0]
xyzset = set(item[1])
... | 23 | 36 | 495 | 959 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ABlist = []
ABClist = []
for x in A:
for y in B:
sumple = x + y
ABlist.append(sumple)
ABlist.sort(reverse=True)
ABlist = ABlist[:K]
for x i... | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = []
item = (0, (0, 0, 0))
max_score = A[0] + B[0] + C[0]
xyzset = set(item[1])
answe... | false | 36.111111 | [
"+import heapq",
"+",
"-ABlist = []",
"-ABClist = []",
"-for x in A:",
"- for y in B:",
"- sumple = x + y",
"- ABlist.append(sumple)",
"- ABlist.sort(reverse=True)",
"- ABlist = ABlist[:K]",
"-for x in ABlist:",
"- for z in C:",
"- test = x + z",
"- ... | false | 0.083489 | 0.043798 | 1.906208 | [
"s999403423",
"s900807138"
] |
u678167152 | p02768 | python | s084827027 | s316536800 | 1,212 | 606 | 9,132 | 9,188 | Accepted | Accepted | 50 | def comb_mod(n,r):
mod = 10**9+7
ans = 1
for i in range(r):
ans *= n-i
ans %= mod
for i in range(1,r+1):
ans *= pow(i,mod-2,mod)
ans %= mod
return ans
def solve():
n, a, b = list(map(int, input().split()))
mod = 10**9+7
ans = pow(2,n,mod)-co... | def comb_mod(n,r):
mod = 10**9+7
ans = 1
for i in range(r):
ans *= n-i
ans %= mod
for i in range(1,r+1):
ans *= pow(i,-1,mod)
ans %= mod
return ans
def solve():
n, a, b = list(map(int, input().split()))
mod = 10**9+7
ans = pow(2,n,mod)-comb_... | 18 | 18 | 390 | 386 | def comb_mod(n, r):
mod = 10**9 + 7
ans = 1
for i in range(r):
ans *= n - i
ans %= mod
for i in range(1, r + 1):
ans *= pow(i, mod - 2, mod)
ans %= mod
return ans
def solve():
n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
ans = pow(2, n, mod)... | def comb_mod(n, r):
mod = 10**9 + 7
ans = 1
for i in range(r):
ans *= n - i
ans %= mod
for i in range(1, r + 1):
ans *= pow(i, -1, mod)
ans %= mod
return ans
def solve():
n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
ans = pow(2, n, mod) - co... | false | 0 | [
"- ans *= pow(i, mod - 2, mod)",
"+ ans *= pow(i, -1, mod)"
] | false | 1.250467 | 0.717198 | 1.743545 | [
"s084827027",
"s316536800"
] |
u894258749 | p02863 | python | s451652460 | s438468736 | 486 | 398 | 48,464 | 48,216 | Accepted | Accepted | 18.11 | import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, T = inpl()
A = [None]*N
B = [None]*N
for i in range(N):
A[i], B[i] = inpl()
dp_intime = [0]*T
dp_total = [0]*T
for n in range(N):
dp_intime_prev, dp_intime = dp_intime, [0]*T
dp_total_prev... | inpl = lambda: list(map(int,input().split()))
N, T = inpl()
AB = sorted([inpl() for _ in range(N)])
ans = 0
dp_intime = [0]*T
for n in range(N):
dp_intime_prev = dp_intime
dp_intime = [0]*T
a, b = AB[n]
for t in range(T):
if t < a:
dp_intime[t] = dp_intime_prev[t]
... | 24 | 17 | 792 | 456 | import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N, T = inpl()
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = inpl()
dp_intime = [0] * T
dp_total = [0] * T
for n in range(N):
dp_intime_prev, dp_intime = dp_intime, [0] * T
dp_total_prev, ... | inpl = lambda: list(map(int, input().split()))
N, T = inpl()
AB = sorted([inpl() for _ in range(N)])
ans = 0
dp_intime = [0] * T
for n in range(N):
dp_intime_prev = dp_intime
dp_intime = [0] * T
a, b = AB[n]
for t in range(T):
if t < a:
dp_intime[t] = dp_intime_prev[t]
else:
... | false | 29.166667 | [
"-import sys",
"-",
"-input = lambda: sys.stdin.readline().rstrip()",
"-A = [None] * N",
"-B = [None] * N",
"-for i in range(N):",
"- A[i], B[i] = inpl()",
"+AB = sorted([inpl() for _ in range(N)])",
"+ans = 0",
"-dp_total = [0] * T",
"- dp_intime_prev, dp_intime = dp_intime, [0] * T",
"... | false | 0.036494 | 0.041934 | 0.870287 | [
"s451652460",
"s438468736"
] |
u609061751 | p03086 | python | s733941577 | s603359544 | 167 | 63 | 38,532 | 61,988 | Accepted | Accepted | 62.28 | S = input().rstrip()
N = len(S)
ans = 0
from collections import Counter
for i in range(N):
for j in range(i + 1, N + 1):
flag = 1
s = S[i:j]
c = Counter(s)
for k in list(c.keys()):
if k != "A" and k != "C" and k != "G" and k != "T":
flag = 0
... | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
s = eval(input())
n = len(s)
ans = 0
acgt = set(['A', 'C', 'G', 'T'])
for i in range(n):
for j in range(i + 1, n + 1):
t = s[i:j]
flag = 1
for k in t:
if k not in acgt:
flag = 0
... | 17 | 19 | 408 | 411 | S = input().rstrip()
N = len(S)
ans = 0
from collections import Counter
for i in range(N):
for j in range(i + 1, N + 1):
flag = 1
s = S[i:j]
c = Counter(s)
for k in list(c.keys()):
if k != "A" and k != "C" and k != "G" and k != "T":
flag = 0
... | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
s = eval(input())
n = len(s)
ans = 0
acgt = set(["A", "C", "G", "T"])
for i in range(n):
for j in range(i + 1, n + 1):
t = s[i:j]
flag = 1
for k in t:
if k not in acgt:
flag = 0
break
... | false | 10.526316 | [
"-S = input().rstrip()",
"-N = len(S)",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")",
"+s = eval(input())",
"+n = len(s)",
"-from collections import Counter",
"-",
"-for i in range(N):",
"- for j in range(i + 1, N + 1):",
"+acgt = set([\"A\", \"C\", \"G\", ... | false | 0.034525 | 0.03578 | 0.964922 | [
"s733941577",
"s603359544"
] |
u731807761 | p02660 | python | s215389508 | s589396541 | 1,677 | 214 | 27,140 | 27,168 | Accepted | Accepted | 87.24 | import numpy as np
import sys
#import copy
def xnxn(n=0):
"""
args:
int n: a number of lows to read
example:
input 1
retrun 1
input 1 2 3
return [1,2,3]
input 1 2 3
4
return [[1,2,3],
[4]]
... | import numpy as np
import sys
#import copy
def xnxn(n=0):
"""
args:
int n: a number of lows to read
example:
input 1
retrun 1
input 1 2 3
return [1,2,3]
input 1 2 3
4
return [[1,2,3],
[4]]
... | 142 | 159 | 2,804 | 3,171 | import numpy as np
import sys
# import copy
def xnxn(n=0):
"""
args:
int n: a number of lows to read
example:
input 1
retrun 1
input 1 2 3
return [1,2,3]
input 1 2 3
4
return [[1,2,3],
[4]]
"""
if n == ... | import numpy as np
import sys
# import copy
def xnxn(n=0):
"""
args:
int n: a number of lows to read
example:
input 1
retrun 1
input 1 2 3
return [1,2,3]
input 1 2 3
4
return [[1,2,3],
[4]]
"""
if n == ... | false | 10.691824 | [
"+def p_num_edit(n):",
"+ tmp = n",
"+ ans = []",
"+ for i in range(2, int(np.sqrt(n)) + 1):",
"+ cnt = 0",
"+ while tmp % i == 0:",
"+ cnt += 1",
"+ tmp = int(tmp / i)",
"+ if cnt > 0:",
"+ ans.append([i, cnt])",
"+ if tmp != 1:"... | false | 0.449966 | 0.007544 | 59.642242 | [
"s215389508",
"s589396541"
] |
u036340997 | p02879 | python | s145293910 | s795121893 | 161 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.44 | a, b = list(map(int, input().split()))
if a < 10 and b < 10:
print((a*b))
else:
print((-1)) | a, b = list(map(int, input().split()))
if a <= 9 and b <= 9:
print((a*b))
else:
print((-1)) | 5 | 5 | 89 | 89 | a, b = list(map(int, input().split()))
if a < 10 and b < 10:
print((a * b))
else:
print((-1))
| a, b = list(map(int, input().split()))
if a <= 9 and b <= 9:
print((a * b))
else:
print((-1))
| false | 0 | [
"-if a < 10 and b < 10:",
"+if a <= 9 and b <= 9:"
] | false | 0.047948 | 0.043119 | 1.111998 | [
"s145293910",
"s795121893"
] |
u547167033 | p03740 | python | s742441796 | s347952307 | 161 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.44 | x,y=list(map(int,input().split()))
if abs(x-y)<=1:
print('Brown')
else:
print('Alice') | x,y=list(map(int,input().split()))
print(('Brown' if abs(x-y)<=1 else 'Alice')) | 5 | 2 | 88 | 72 | x, y = list(map(int, input().split()))
if abs(x - y) <= 1:
print("Brown")
else:
print("Alice")
| x, y = list(map(int, input().split()))
print(("Brown" if abs(x - y) <= 1 else "Alice"))
| false | 60 | [
"-if abs(x - y) <= 1:",
"- print(\"Brown\")",
"-else:",
"- print(\"Alice\")",
"+print((\"Brown\" if abs(x - y) <= 1 else \"Alice\"))"
] | false | 0.043249 | 0.041025 | 1.054194 | [
"s742441796",
"s347952307"
] |
u310678820 | p02913 | python | s815359414 | s410538150 | 1,104 | 220 | 3,060 | 44,496 | Accepted | Accepted | 80.07 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
if N-i<ans:
break
if S[i+1:].find(S[i-ans:i+1])>=0:
ans += 1
print(ans) | from collections import defaultdict
N = int(eval(input()))
S = list(map(ord, list(eval(input()))))
mod = 10**9+7
base = 1234
power = [1]*(N+1)
for i in range(1, N+1):
power[i] = power[i-1]*base%mod
def check(m):
if N-m<m:
return False
res = 0
for i in range(m):
res+=S[i]*pow... | 9 | 38 | 159 | 828 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
if N - i < ans:
break
if S[i + 1 :].find(S[i - ans : i + 1]) >= 0:
ans += 1
print(ans)
| from collections import defaultdict
N = int(eval(input()))
S = list(map(ord, list(eval(input()))))
mod = 10**9 + 7
base = 1234
power = [1] * (N + 1)
for i in range(1, N + 1):
power[i] = power[i - 1] * base % mod
def check(m):
if N - m < m:
return False
res = 0
for i in range(m):
res +... | false | 76.315789 | [
"+from collections import defaultdict",
"+",
"-S = eval(input())",
"-ans = 0",
"-for i in range(N):",
"- if N - i < ans:",
"- break",
"- if S[i + 1 :].find(S[i - ans : i + 1]) >= 0:",
"- ans += 1",
"-print(ans)",
"+S = list(map(ord, list(eval(input()))))",
"+mod = 10**9 + 7... | false | 0.037804 | 0.045736 | 0.826553 | [
"s815359414",
"s410538150"
] |
u072053884 | p02268 | python | s908029947 | s597131514 | 480 | 340 | 18,976 | 19,100 | Accepted | Accepted | 29.17 | n = int(eval(input()))
S = tuple(map(int, input().split(' ')))
q = eval(input())
T = tuple(map(int, input().split(' ')))
cnt = 0
for i in T:
left = 0
right = n
while left < right:
mid = (left + right) // 2
if S[mid] == i:
cnt += 1
break
elif... | def binarySearch(A, key, n):
left = 0
right = n
while left < right:
mid = (left + right) // 2
if S[mid] == i:
return True
elif i < S[mid]:
right = mid
else:
left = mid + 1
return False
n = int(eval(input()))
S = tuple(map... | 22 | 26 | 402 | 485 | n = int(eval(input()))
S = tuple(map(int, input().split(" ")))
q = eval(input())
T = tuple(map(int, input().split(" ")))
cnt = 0
for i in T:
left = 0
right = n
while left < right:
mid = (left + right) // 2
if S[mid] == i:
cnt += 1
break
elif i < S[mid]:
... | def binarySearch(A, key, n):
left = 0
right = n
while left < right:
mid = (left + right) // 2
if S[mid] == i:
return True
elif i < S[mid]:
right = mid
else:
left = mid + 1
return False
n = int(eval(input()))
S = tuple(map(int, input()... | false | 15.384615 | [
"+def binarySearch(A, key, n):",
"+ left = 0",
"+ right = n",
"+ while left < right:",
"+ mid = (left + right) // 2",
"+ if S[mid] == i:",
"+ return True",
"+ elif i < S[mid]:",
"+ right = mid",
"+ else:",
"+ left = mid + 1",
... | false | 0.172599 | 0.035824 | 4.818012 | [
"s908029947",
"s597131514"
] |
u413165887 | p02948 | python | s301230941 | s526329499 | 622 | 542 | 23,880 | 23,880 | Accepted | Accepted | 12.86 | import heapq
n, m = list(map(int, input().split(' ')))
df = []
for _ in range(n):
x, y = list(map(int, input().split(' ')))
df.append([x, y])
df.sort()
h = []
result = 0
counter = 0
for i in range(1, m+1):
while counter < len(df) and df[counter][0] <= i:
heapq.heappush(h, (-1)*df[counter... | def main():
import heapq
n, m = list(map(int, input().split(' ')))
df = []
for _ in range(n):
x, y = list(map(int, input().split(' ')))
df.append([x, y])
df.sort()
h = []
result = 0
counter = 0
for i in range(1, m+1):
while counter < len(df) and df... | 19 | 22 | 436 | 565 | import heapq
n, m = list(map(int, input().split(" ")))
df = []
for _ in range(n):
x, y = list(map(int, input().split(" ")))
df.append([x, y])
df.sort()
h = []
result = 0
counter = 0
for i in range(1, m + 1):
while counter < len(df) and df[counter][0] <= i:
heapq.heappush(h, (-1) * df[counter][1])
... | def main():
import heapq
n, m = list(map(int, input().split(" ")))
df = []
for _ in range(n):
x, y = list(map(int, input().split(" ")))
df.append([x, y])
df.sort()
h = []
result = 0
counter = 0
for i in range(1, m + 1):
while counter < len(df) and df[counter]... | false | 13.636364 | [
"-import heapq",
"+def main():",
"+ import heapq",
"-n, m = list(map(int, input().split(\" \")))",
"-df = []",
"-for _ in range(n):",
"- x, y = list(map(int, input().split(\" \")))",
"- df.append([x, y])",
"-df.sort()",
"-h = []",
"-result = 0",
"-counter = 0",
"-for i in range(1, m... | false | 0.037472 | 0.037539 | 0.998214 | [
"s301230941",
"s526329499"
] |
u654470292 | p03634 | python | s475278228 | s776551639 | 894 | 341 | 125,784 | 131,160 | Accepted | Accepted | 61.86 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
mod=10**9+7
n=int(eval(input()))
abc=[list(map(int,input().split())) for i in range(n-1)... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 39 | 38 | 976 | 968 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
n = int(eval(input()))
abc = [list(map(int, input().split())) for i in range(n... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 2.564103 | [
"-import sys",
"+import bisect, copy, heapq, math, sys",
"-import heapq",
"-import math",
"-import bisect",
"-from itertools import permutations, accumulate, combinations, product",
"-from fractions import gcd",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, pe... | false | 0.077973 | 0.031596 | 2.467828 | [
"s475278228",
"s776551639"
] |
u196579381 | p03946 | python | s963966503 | s453084883 | 505 | 251 | 77,548 | 72,084 | Accepted | Accepted | 50.3 | N, T = list(map(int, input().split()))
A = [int(i) for i in input().split()]
ml = [(A[-1], 1)]
for a in A[-2:0:-1]:
n = ml[-1]
if n[0] == a:
ml.append((a, n[1] + 1))
elif n[0] < a:
ml.append((a, 1))
else:
ml.append(n)
ml.reverse()
c = [(ml[i][0] - A[i], ml[i][0], ... | from collections import Counter
N, T = list(map(int, input().split()))
A = [int(i) for i in input().split()]
m = A[0]
B = []
for a in A[1:]:
B.append(a - m)
m = min(m, a)
c = Counter(B)
print((c[max(c.keys())])) | 30 | 10 | 605 | 220 | N, T = list(map(int, input().split()))
A = [int(i) for i in input().split()]
ml = [(A[-1], 1)]
for a in A[-2:0:-1]:
n = ml[-1]
if n[0] == a:
ml.append((a, n[1] + 1))
elif n[0] < a:
ml.append((a, 1))
else:
ml.append(n)
ml.reverse()
c = [(ml[i][0] - A[i], ml[i][0], ml[i][1]) for i ... | from collections import Counter
N, T = list(map(int, input().split()))
A = [int(i) for i in input().split()]
m = A[0]
B = []
for a in A[1:]:
B.append(a - m)
m = min(m, a)
c = Counter(B)
print((c[max(c.keys())]))
| false | 66.666667 | [
"+from collections import Counter",
"+",
"-ml = [(A[-1], 1)]",
"-for a in A[-2:0:-1]:",
"- n = ml[-1]",
"- if n[0] == a:",
"- ml.append((a, n[1] + 1))",
"- elif n[0] < a:",
"- ml.append((a, 1))",
"- else:",
"- ml.append(n)",
"-ml.reverse()",
"-c = [(ml[i][0] ... | false | 0.059782 | 0.19796 | 0.30199 | [
"s963966503",
"s453084883"
] |
u150984829 | p02256 | python | s051031063 | s546624742 | 20 | 10 | 5,604 | 5,664 | Accepted | Accepted | 50 | def g(n):
x,y=n
r=x%y
if r>0:g((y,r))
else:print(y)
g(sorted(list(map(int,input().split())))) | import math
a,b=list(map(int,input().split()))
print((math.gcd(a,b)))
'''
# 09.98 sec 13492 KB 4 lines 99 bytes
# Time Limit Exceeded
n=int(input())
r=[int(input())for _ in range(n)]
print(max([max(r[i+1:])-r[i]for i in range(n-1)]))
''' | 6 | 11 | 102 | 250 | def g(n):
x, y = n
r = x % y
if r > 0:
g((y, r))
else:
print(y)
g(sorted(list(map(int, input().split()))))
| import math
a, b = list(map(int, input().split()))
print((math.gcd(a, b)))
"""
# 09.98 sec 13492 KB 4 lines 99 bytes
# Time Limit Exceeded
n=int(input())
r=[int(input())for _ in range(n)]
print(max([max(r[i+1:])-r[i]for i in range(n-1)]))
"""
| false | 45.454545 | [
"-def g(n):",
"- x, y = n",
"- r = x % y",
"- if r > 0:",
"- g((y, r))",
"- else:",
"- print(y)",
"+import math",
"-",
"-g(sorted(list(map(int, input().split()))))",
"+a, b = list(map(int, input().split()))",
"+print((math.gcd(a, b)))",
"+\"\"\"",
"+# 09.98 sec ... | false | 0.077534 | 0.03555 | 2.181013 | [
"s051031063",
"s546624742"
] |
u839624727 | p02838 | python | s374949052 | s059187617 | 297 | 223 | 53,560 | 29,148 | Accepted | Accepted | 24.92 | import numpy as np
def solve(string):
n, *a = list(map(int, string.split()))
# a = ["{:060b}".format(_a) for _a in a]
a = np.asarray(a, dtype=np.int64)
m = 10**9 + 7
ans = 0
for i in range(60):
s = int((a & 1).sum())
a >>= 1
# ans += s * (n - s) * pow(2, 5... | import numpy as np
import math
n = int(eval(input()))
A = np.fromstring(eval(input()),dtype=np.int64,sep=" ")
#rng = int(math.log2(np.max(A)))+1
sum = 0
d = 10**9+7
for bit in range(64):
c = int((A & 1).sum())
sum += c *(n-c)*(1<<bit)%d
A = A>>1
print((sum %(d))) | 21 | 13 | 503 | 274 | import numpy as np
def solve(string):
n, *a = list(map(int, string.split()))
# a = ["{:060b}".format(_a) for _a in a]
a = np.asarray(a, dtype=np.int64)
m = 10**9 + 7
ans = 0
for i in range(60):
s = int((a & 1).sum())
a >>= 1
# ans += s * (n - s) * pow(2, 59 - i, m)
... | import numpy as np
import math
n = int(eval(input()))
A = np.fromstring(eval(input()), dtype=np.int64, sep=" ")
# rng = int(math.log2(np.max(A)))+1
sum = 0
d = 10**9 + 7
for bit in range(64):
c = int((A & 1).sum())
sum += c * (n - c) * (1 << bit) % d
A = A >> 1
print((sum % (d)))
| false | 38.095238 | [
"+import math",
"-",
"-def solve(string):",
"- n, *a = list(map(int, string.split()))",
"- # a = [\"{:060b}\".format(_a) for _a in a]",
"- a = np.asarray(a, dtype=np.int64)",
"- m = 10**9 + 7",
"- ans = 0",
"- for i in range(60):",
"- s = int((a & 1).sum())",
"- a... | false | 0.587444 | 0.269284 | 2.181501 | [
"s374949052",
"s059187617"
] |
u608088992 | p03379 | python | s611479832 | s007483489 | 457 | 272 | 27,156 | 25,572 | Accepted | Accepted | 40.48 | import copy
N = int(eval(input()))
X = [int(i) for i in input().split()]
Y = copy.deepcopy(X)
Y.sort()
ML, MH = Y[N//2 - 1], Y[N//2]
for i in range(N):
if X[i] >= MH:
print(ML)
else:
print(MH) | import sys
def solve():
input = sys.stdin.readline
N = int(input())
X = [int(x) for x in input().split()]
Xsub = sorted(X)
midl, midr = Xsub[(N - 1) // 2], Xsub[N // 2]
ans = [0] * N
for i, x in enumerate(X):
if x <= midl: ans[i] = midr
else: ans[i] = midl
pr... | 12 | 18 | 222 | 398 | import copy
N = int(eval(input()))
X = [int(i) for i in input().split()]
Y = copy.deepcopy(X)
Y.sort()
ML, MH = Y[N // 2 - 1], Y[N // 2]
for i in range(N):
if X[i] >= MH:
print(ML)
else:
print(MH)
| import sys
def solve():
input = sys.stdin.readline
N = int(input())
X = [int(x) for x in input().split()]
Xsub = sorted(X)
midl, midr = Xsub[(N - 1) // 2], Xsub[N // 2]
ans = [0] * N
for i, x in enumerate(X):
if x <= midl:
ans[i] = midr
else:
ans[i] ... | false | 33.333333 | [
"-import copy",
"+import sys",
"-N = int(eval(input()))",
"-X = [int(i) for i in input().split()]",
"-Y = copy.deepcopy(X)",
"-Y.sort()",
"-ML, MH = Y[N // 2 - 1], Y[N // 2]",
"-for i in range(N):",
"- if X[i] >= MH:",
"- print(ML)",
"- else:",
"- print(MH)",
"+",
"+def... | false | 0.044065 | 0.040653 | 1.083909 | [
"s611479832",
"s007483489"
] |
u454022848 | p02397 | python | s042898086 | s417838490 | 60 | 20 | 6,724 | 6,268 | Accepted | Accepted | 66.67 | while True:
ia=[int(i) for i in input().split(" ")]
if ia[0]==ia[1]==0:
break
print((" ".join([str(i) for i in sorted(ia)]))) | # encoding:utf-8
while True:
input = list(map(int, input().split()))
x, y = input
if x == y == 0:
break
input.sort()
print((" ".join(map(str, input)))) | 5 | 8 | 132 | 162 | while True:
ia = [int(i) for i in input().split(" ")]
if ia[0] == ia[1] == 0:
break
print((" ".join([str(i) for i in sorted(ia)])))
| # encoding:utf-8
while True:
input = list(map(int, input().split()))
x, y = input
if x == y == 0:
break
input.sort()
print((" ".join(map(str, input))))
| false | 37.5 | [
"+# encoding:utf-8",
"- ia = [int(i) for i in input().split(\" \")]",
"- if ia[0] == ia[1] == 0:",
"+ input = list(map(int, input().split()))",
"+ x, y = input",
"+ if x == y == 0:",
"- print((\" \".join([str(i) for i in sorted(ia)])))",
"+ input.sort()",
"+ print((\" \".join... | false | 0.034331 | 0.035564 | 0.96532 | [
"s042898086",
"s417838490"
] |
u707124227 | p02715 | python | s318451772 | s137079401 | 121 | 103 | 80,832 | 68,924 | Accepted | Accepted | 14.88 | n,k=list(map(int,input().split()))
# 1以上k以下の整数がn個
mod=int(1e+9 + 7)
d=[0]*(k+1)
ans=0
for i in range(k,0,-1):
m=k//i
d[i]=pow(m,n, mod)
d[i]-=sum([d[j*i]for j in range(2,m+1)])
ans+=(d[i]*i)%mod
print(((ans)%mod))
#print(d)
| n,k=list(map(int,input().split()))
mod=pow(10,9)+7
ans=[0]*(k+1)
# gcdがkiとなる数列。すべてがkiの倍数でかつ少なくとも一つkiを含む
for ki in range(k,0,-1):
a=k//ki
ans[ki]=pow(a,n,mod)
i=2
while i*ki<=k:
ans[ki]-=ans[i*ki]
i+=1
b=0
for ki in range(1,k+1):
b+=(ans[ki]*ki)%mod
b%=mod
print(b)
| 13 | 16 | 254 | 314 | n, k = list(map(int, input().split()))
# 1以上k以下の整数がn個
mod = int(1e9 + 7)
d = [0] * (k + 1)
ans = 0
for i in range(k, 0, -1):
m = k // i
d[i] = pow(m, n, mod)
d[i] -= sum([d[j * i] for j in range(2, m + 1)])
ans += (d[i] * i) % mod
print(((ans) % mod))
# print(d)
| n, k = list(map(int, input().split()))
mod = pow(10, 9) + 7
ans = [0] * (k + 1)
# gcdがkiとなる数列。すべてがkiの倍数でかつ少なくとも一つkiを含む
for ki in range(k, 0, -1):
a = k // ki
ans[ki] = pow(a, n, mod)
i = 2
while i * ki <= k:
ans[ki] -= ans[i * ki]
i += 1
b = 0
for ki in range(1, k + 1):
b += (ans[ki]... | false | 18.75 | [
"-# 1以上k以下の整数がn個",
"-mod = int(1e9 + 7)",
"-d = [0] * (k + 1)",
"-ans = 0",
"-for i in range(k, 0, -1):",
"- m = k // i",
"- d[i] = pow(m, n, mod)",
"- d[i] -= sum([d[j * i] for j in range(2, m + 1)])",
"- ans += (d[i] * i) % mod",
"-print(((ans) % mod))",
"-# print(d)",
"+mod = po... | false | 0.466281 | 0.262404 | 1.776957 | [
"s318451772",
"s137079401"
] |
u846150137 | p03426 | python | s084470300 | s596155603 | 1,080 | 951 | 74,708 | 26,012 | Accepted | Accepted | 11.94 | I=lambda:list(map(int,input().split()))
h,w,d=I()
H={}
W={}
for i in range(1,h+1):
for j,k in enumerate(I(),1):
H[k],W[k]=i,j
x=1+h*w
s=[0 for _ in range(x)]
for i in range(d+1,x):
s[i]=s[i-d]+abs(H[i]-H[i-d])+abs(W[i]-W[i-d])
for _ in range(int(eval(input()))):
a,b=I()
print((s[b]-s[a])) | I=lambda:list(map(int,input().split()))
h,w,d=I()
H={}
W={}
for i in range(1,h+1):
for j,k in enumerate(I(),1):
H[k],W[k]=i,j
x=1+h*w
s=[0 for _ in [0]*x]
for i in range(d+1,x):
s[i]=s[i-d]+abs(H[i]-H[i-d])+abs(W[i]-W[i-d])
for _ in [0]*int(eval(input())):
a,b=I()
print((s[b]-s[a])) | 15 | 15 | 302 | 296 | I = lambda: list(map(int, input().split()))
h, w, d = I()
H = {}
W = {}
for i in range(1, h + 1):
for j, k in enumerate(I(), 1):
H[k], W[k] = i, j
x = 1 + h * w
s = [0 for _ in range(x)]
for i in range(d + 1, x):
s[i] = s[i - d] + abs(H[i] - H[i - d]) + abs(W[i] - W[i - d])
for _ in range(int(eval(input... | I = lambda: list(map(int, input().split()))
h, w, d = I()
H = {}
W = {}
for i in range(1, h + 1):
for j, k in enumerate(I(), 1):
H[k], W[k] = i, j
x = 1 + h * w
s = [0 for _ in [0] * x]
for i in range(d + 1, x):
s[i] = s[i - d] + abs(H[i] - H[i - d]) + abs(W[i] - W[i - d])
for _ in [0] * int(eval(input(... | false | 0 | [
"-s = [0 for _ in range(x)]",
"+s = [0 for _ in [0] * x]",
"-for _ in range(int(eval(input()))):",
"+for _ in [0] * int(eval(input())):"
] | false | 0.090342 | 0.040881 | 2.20985 | [
"s084470300",
"s596155603"
] |
u028973125 | p03476 | python | s520393714 | s008885689 | 1,403 | 192 | 8,380 | 18,700 | Accepted | Accepted | 86.32 | import sys
import math
def eratosthenes(limit):
A = [i for i in range(2, limit+1)]
P = []
time = 0
while True:
prime = min(A)
if prime > math.sqrt(limit):
break
P.append(prime)
i = 0
while i < len(A):
if A[i] % prime ... | import sys
input = sys.stdin.readline
Q = int(eval(input()))
primes = set()
not_p = set()
for i in range(2, 10**5 + 1):
# for i in range(2, 10 + 1):
if i not in not_p:
primes.add(i)
for j in range(i+i, 10**5+1, i):
# for j in range(i+i, 10+1, i):
not_p.add(j)
# ... | 45 | 30 | 921 | 684 | import sys
import math
def eratosthenes(limit):
A = [i for i in range(2, limit + 1)]
P = []
time = 0
while True:
prime = min(A)
if prime > math.sqrt(limit):
break
P.append(prime)
i = 0
while i < len(A):
if A[i] % prime == 0:
... | import sys
input = sys.stdin.readline
Q = int(eval(input()))
primes = set()
not_p = set()
for i in range(2, 10**5 + 1):
# for i in range(2, 10 + 1):
if i not in not_p:
primes.add(i)
for j in range(i + i, 10**5 + 1, i):
# for j in range(i+i, 10+1, i):
not_p.add(j)
# print... | false | 33.333333 | [
"-import math",
"-",
"-def eratosthenes(limit):",
"- A = [i for i in range(2, limit + 1)]",
"- P = []",
"- time = 0",
"- while True:",
"- prime = min(A)",
"- if prime > math.sqrt(limit):",
"- break",
"- P.append(prime)",
"- i = 0",
"- ... | false | 1.367667 | 0.120211 | 11.377241 | [
"s520393714",
"s008885689"
] |
u757030836 | p03814 | python | s015106448 | s958122528 | 101 | 41 | 3,512 | 3,516 | Accepted | Accepted | 59.41 | s = eval(input())
id_a = len(s)
id_z = 0
for i in range(len(s)):
if s[i] == 'A':
id_a = min(id_a, i)
if s[i] == 'Z':
id_z = max(id_z, i)
print((id_z - id_a + 1))
| s =eval(input())
A=0
Z=0
for i in range(len(s)):
if s[i] =="A":
A +=(i+1)
break
for j in range(len(s)):
if s[-(j+1)] =="Z":
Z +=len(s)-j
break
print((Z-A+1)) | 11 | 16 | 182 | 196 | s = eval(input())
id_a = len(s)
id_z = 0
for i in range(len(s)):
if s[i] == "A":
id_a = min(id_a, i)
if s[i] == "Z":
id_z = max(id_z, i)
print((id_z - id_a + 1))
| s = eval(input())
A = 0
Z = 0
for i in range(len(s)):
if s[i] == "A":
A += i + 1
break
for j in range(len(s)):
if s[-(j + 1)] == "Z":
Z += len(s) - j
break
print((Z - A + 1))
| false | 31.25 | [
"-id_a = len(s)",
"-id_z = 0",
"+A = 0",
"+Z = 0",
"- id_a = min(id_a, i)",
"- if s[i] == \"Z\":",
"- id_z = max(id_z, i)",
"-print((id_z - id_a + 1))",
"+ A += i + 1",
"+ break",
"+for j in range(len(s)):",
"+ if s[-(j + 1)] == \"Z\":",
"+ Z += len(s... | false | 0.035847 | 0.035823 | 1.000673 | [
"s015106448",
"s958122528"
] |
u142415823 | p03435 | python | s620915881 | s267167388 | 1,688 | 18 | 3,064 | 3,064 | Accepted | Accepted | 98.93 | def confirm(a, b, c):
for i in range(3):
for j in range(3):
if a[i] + b[j] != c[i][j]:
return False
return True
def main():
c = [list(map(int, input().split())) for i in range(3)]
for a1 in range(101):
for a2 in range(101):
for a3 i... | def main():
c = [list(map(int, input().split())) for i in range(3)]
for x in range(101):
b = (c[0][0] - x, c[0][1] - x, c[0][2] - x)
a = (x, c[1][0] - b[0], c[2][0] - b[0])
flag = True
for i in (1, 2):
for j in (1, 2):
if a[i] + b[j] != c[i][j]... | 24 | 17 | 587 | 470 | def confirm(a, b, c):
for i in range(3):
for j in range(3):
if a[i] + b[j] != c[i][j]:
return False
return True
def main():
c = [list(map(int, input().split())) for i in range(3)]
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
... | def main():
c = [list(map(int, input().split())) for i in range(3)]
for x in range(101):
b = (c[0][0] - x, c[0][1] - x, c[0][2] - x)
a = (x, c[1][0] - b[0], c[2][0] - b[0])
flag = True
for i in (1, 2):
for j in (1, 2):
if a[i] + b[j] != c[i][j]:
... | false | 29.166667 | [
"-def confirm(a, b, c):",
"- for i in range(3):",
"- for j in range(3):",
"- if a[i] + b[j] != c[i][j]:",
"- return False",
"- return True",
"-",
"-",
"- for a1 in range(101):",
"- for a2 in range(101):",
"- for a3 in range(101):",
"-... | false | 0.005982 | 0.048508 | 0.123318 | [
"s620915881",
"s267167388"
] |
u270681687 | p03370 | python | s553373994 | s582554251 | 36 | 19 | 3,060 | 3,060 | Accepted | Accepted | 47.22 | n, x = list(map(int, input().split()))
m = []
for i in range(n):
m.append(int(eval(input())))
count = 0
a = min(m)
s = sum(m)
x -= s
count += n
while x >= a:
x -= a
count += 1
print(count) | n, x = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(n)]
x -= sum(m)
count = n
mincost = 10**5
for i in range(n):
mincost = min(mincost, m[i])
count += x // mincost
print(count) | 16 | 12 | 206 | 208 | n, x = list(map(int, input().split()))
m = []
for i in range(n):
m.append(int(eval(input())))
count = 0
a = min(m)
s = sum(m)
x -= s
count += n
while x >= a:
x -= a
count += 1
print(count)
| n, x = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(n)]
x -= sum(m)
count = n
mincost = 10**5
for i in range(n):
mincost = min(mincost, m[i])
count += x // mincost
print(count)
| false | 25 | [
"-m = []",
"+m = [int(eval(input())) for _ in range(n)]",
"+x -= sum(m)",
"+count = n",
"+mincost = 10**5",
"- m.append(int(eval(input())))",
"-count = 0",
"-a = min(m)",
"-s = sum(m)",
"-x -= s",
"-count += n",
"-while x >= a:",
"- x -= a",
"- count += 1",
"+ mincost = min(m... | false | 0.037397 | 0.055465 | 0.67425 | [
"s553373994",
"s582554251"
] |
u227082700 | p02616 | python | s517077528 | s689779685 | 490 | 163 | 109,500 | 31,732 | Accepted | Accepted | 66.73 | mod=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))
if max(a)<0:
if k%2:a.sort(reverse=1)
else:a.sort()
ans=1
for i in a[:k]:ans=(ans*i)%mod
exit(print(ans))
if n==k:
ans=1
for i in a:ans=(ans*i)%mod
exit(print(ans))
p=[(0,0)]
m=[(0,0)]
for i in a:
if i<0:m.append... | from itertools import combinations
mod=10**9+7
def solve(n,k,a):
if min(a)>0:
ans=1
a.sort(reverse=1)
for i in a[:k]:
ans*=i
ans%=mod
return ans
if max(a)<0:
if k%2==0:
a.sort()
ans=1
for i in a[:k]:
ans*=i
ans%=mod
return ans
... | 43 | 100 | 842 | 1,845 | mod = 10**9 + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
if max(a) < 0:
if k % 2:
a.sort(reverse=1)
else:
a.sort()
ans = 1
for i in a[:k]:
ans = (ans * i) % mod
exit(print(ans))
if n == k:
ans = 1
for i in a:
ans = (ans * i) % mod
... | from itertools import combinations
mod = 10**9 + 7
def solve(n, k, a):
if min(a) > 0:
ans = 1
a.sort(reverse=1)
for i in a[:k]:
ans *= i
ans %= mod
return ans
if max(a) < 0:
if k % 2 == 0:
a.sort()
ans = 1
for... | false | 57 | [
"+from itertools import combinations",
"+",
"-n, k = map(int, input().split())",
"+",
"+",
"+def solve(n, k, a):",
"+ if min(a) > 0:",
"+ ans = 1",
"+ a.sort(reverse=1)",
"+ for i in a[:k]:",
"+ ans *= i",
"+ ans %= mod",
"+ return ans",
... | false | 0.159617 | 0.045711 | 3.491837 | [
"s517077528",
"s689779685"
] |
u143509139 | p03196 | python | s560154617 | s170337298 | 324 | 94 | 3,316 | 3,316 | Accepted | Accepted | 70.99 | n, p = list(map(int, input().split()))
if n == 3 and p == 24:
print((2))
exit()
for i in range(int((p ** (1 / n)) // 1) + 1, 1, -1):
if i == 2 and n ** 3 > p:
print((1))
break
if p % (i ** n) == 0:
print(i)
break
else:
print((1))
| from collections import Counter
def factorize(n):
a = 2
fct = []
while a * a <= n:
while n % a == 0:
n //= a
fct.append(a)
a += 1
if n > 1:
fct.append(n)
return fct
N, P = list(map(int, input().split()))
f = factorize(P)
c = Count... | 13 | 23 | 282 | 390 | n, p = list(map(int, input().split()))
if n == 3 and p == 24:
print((2))
exit()
for i in range(int((p ** (1 / n)) // 1) + 1, 1, -1):
if i == 2 and n**3 > p:
print((1))
break
if p % (i**n) == 0:
print(i)
break
else:
print((1))
| from collections import Counter
def factorize(n):
a = 2
fct = []
while a * a <= n:
while n % a == 0:
n //= a
fct.append(a)
a += 1
if n > 1:
fct.append(n)
return fct
N, P = list(map(int, input().split()))
f = factorize(P)
c = Counter(f)
ans = 1
for ... | false | 43.478261 | [
"-n, p = list(map(int, input().split()))",
"-if n == 3 and p == 24:",
"- print((2))",
"- exit()",
"-for i in range(int((p ** (1 / n)) // 1) + 1, 1, -1):",
"- if i == 2 and n**3 > p:",
"- print((1))",
"- break",
"- if p % (i**n) == 0:",
"- print(i)",
"- bre... | false | 0.039542 | 0.044167 | 0.895299 | [
"s560154617",
"s170337298"
] |
u595289165 | p02831 | python | s910167598 | s767058696 | 37 | 18 | 5,088 | 2,940 | Accepted | Accepted | 51.35 | import fractions
a, b = list(map(int, input().split()))
def lcm(x, y):
return x*y//fractions.gcd(x, y)
print((lcm(a, b))) | def gcd(x, y):
if x == 0:
return y
else:
return gcd(y % x, x)
def lcm(x, y):
return x * y // gcd(x, y)
a, b = list(map(int, input().split()))
print((lcm(a, b)))
| 9 | 15 | 129 | 201 | import fractions
a, b = list(map(int, input().split()))
def lcm(x, y):
return x * y // fractions.gcd(x, y)
print((lcm(a, b)))
| def gcd(x, y):
if x == 0:
return y
else:
return gcd(y % x, x)
def lcm(x, y):
return x * y // gcd(x, y)
a, b = list(map(int, input().split()))
print((lcm(a, b)))
| false | 40 | [
"-import fractions",
"-",
"-a, b = list(map(int, input().split()))",
"+def gcd(x, y):",
"+ if x == 0:",
"+ return y",
"+ else:",
"+ return gcd(y % x, x)",
"- return x * y // fractions.gcd(x, y)",
"+ return x * y // gcd(x, y)",
"+a, b = list(map(int, input().split()))"
] | false | 0.18801 | 0.040093 | 4.689388 | [
"s910167598",
"s767058696"
] |
u332385682 | p03806 | python | s952826853 | s531653404 | 183 | 108 | 5,752 | 3,188 | Accepted | Accepted | 40.98 |
def solve():
N, Ma, Mb = list(map(int, input().split()))
a, b, c = [], [], []
for i in range(N):
ai, bi, ci = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
nvals = 99 * N * 2 + 1
inf = 40 * 100 + 1
dp = [[inf] * nvals for i... |
def solve():
N, Ma, Mb = list(map(int, input().split()))
a, b, c = [], [], []
for i in range(N):
ai, bi, ci = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
nvals = 99 * N * 2 + 1
inf = 40 * 100 + 1
dp = [inf] * nvals
... | 37 | 40 | 800 | 857 | def solve():
N, Ma, Mb = list(map(int, input().split()))
a, b, c = [], [], []
for i in range(N):
ai, bi, ci = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
nvals = 99 * N * 2 + 1
inf = 40 * 100 + 1
dp = [[inf] * nvals for i in range(N)]
... | def solve():
N, Ma, Mb = list(map(int, input().split()))
a, b, c = [], [], []
for i in range(N):
ai, bi, ci = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
nvals = 99 * N * 2 + 1
inf = 40 * 100 + 1
dp = [inf] * nvals
for i in range(N):... | false | 7.5 | [
"- dp = [[inf] * nvals for i in range(N)]",
"+ dp = [inf] * nvals",
"- dp[i][v] = c[i]",
"+ dp[v] = c[i]",
"- for j in range(-99 * N, 99 * N + 1):",
"- if -99 * N <= j - v <= 99 * N:",
"- dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v] + c[i])",... | false | 0.04935 | 0.048743 | 1.012466 | [
"s952826853",
"s531653404"
] |
u488127128 | p03574 | python | s463068554 | s604395464 | 28 | 24 | 3,064 | 3,444 | Accepted | Accepted | 14.29 | h,w = list(map(int, input().split()))
S = [eval(input()) for _ in range(h)]
for r in range(h):
l = ''
for c in range(w):
if S[r][c] == '#':
l += '#'
else:
l += str(sum([x[max(0,c-1):min(c+2,w)].count('#') for x in S[max(0,r-1):min(r+2,h)]]))
print(l) | h,w = map(int, input().split())
S = ['.' + input() + '.' for _ in range(h)]
S.insert(0,'.'*(w+2))
S.append('.'*(w+2))
for r in range(1, h+1):
for c in range(1, w+1):
if S[r][c] == '#':
print('#', end='')
continue
else:
count = 0
count += S... | 10 | 17 | 299 | 488 | h, w = list(map(int, input().split()))
S = [eval(input()) for _ in range(h)]
for r in range(h):
l = ""
for c in range(w):
if S[r][c] == "#":
l += "#"
else:
l += str(
sum(
[
x[max(0, c - 1) : min(c + 2, w)].count(... | h, w = map(int, input().split())
S = ["." + input() + "." for _ in range(h)]
S.insert(0, "." * (w + 2))
S.append("." * (w + 2))
for r in range(1, h + 1):
for c in range(1, w + 1):
if S[r][c] == "#":
print("#", end="")
continue
else:
count = 0
count += ... | false | 41.176471 | [
"-h, w = list(map(int, input().split()))",
"-S = [eval(input()) for _ in range(h)]",
"-for r in range(h):",
"- l = \"\"",
"- for c in range(w):",
"+h, w = map(int, input().split())",
"+S = [\".\" + input() + \".\" for _ in range(h)]",
"+S.insert(0, \".\" * (w + 2))",
"+S.append(\".\" * (w + 2)... | false | 0.048272 | 0.084593 | 0.570636 | [
"s463068554",
"s604395464"
] |
u504469481 | p03999 | python | s103930863 | s879347696 | 174 | 21 | 39,024 | 4,136 | Accepted | Accepted | 87.93 | def dfs(i, f):
if i == n - 1:
return sum(list(map(int, f.split("+"))))
return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])
s = eval(input())
n = len(s)
print((dfs(0, s[0]))) | # -*- coding: utf-8 -*-
S = eval(input())
n = len(S)
def dfs(i, f):
# 文末?の最後まで行ったらreturn
if i == n - 1:
return f
# +を入れるか入れないか
return dfs(i + 1, f + S[i + 1]) + "+" + dfs(i + 1, f + "+" + S[i + 1])
def main():
print((eval(dfs(0,S[0]))))
if __name__ == '__main__':
main... | 9 | 17 | 204 | 314 | def dfs(i, f):
if i == n - 1:
return sum(list(map(int, f.split("+"))))
return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])
s = eval(input())
n = len(s)
print((dfs(0, s[0])))
| # -*- coding: utf-8 -*-
S = eval(input())
n = len(S)
def dfs(i, f):
# 文末?の最後まで行ったらreturn
if i == n - 1:
return f
# +を入れるか入れないか
return dfs(i + 1, f + S[i + 1]) + "+" + dfs(i + 1, f + "+" + S[i + 1])
def main():
print((eval(dfs(0, S[0]))))
if __name__ == "__main__":
main()
| false | 47.058824 | [
"-def dfs(i, f):",
"- if i == n - 1:",
"- return sum(list(map(int, f.split(\"+\"))))",
"- return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + \"+\" + s[i + 1])",
"+# -*- coding: utf-8 -*-",
"+S = eval(input())",
"+n = len(S)",
"-s = eval(input())",
"-n = len(s)",
"-print((dfs(0, s[0])))"... | false | 0.042929 | 0.043075 | 0.9966 | [
"s103930863",
"s879347696"
] |
u652656291 | p03455 | python | s791354667 | s011103213 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a,b = list(map(int,input().split()))
if (a*b) % 2 == 0:
print('Even')
else:
print('Odd') | a,b = list(map(int,input().split()))
if a*b%2==0:
print('Even')
else:
print('Odd')
| 5 | 5 | 90 | 85 | a, b = list(map(int, input().split()))
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd")
| a, b = list(map(int, input().split()))
if a * b % 2 == 0:
print("Even")
else:
print("Odd")
| false | 0 | [
"-if (a * b) % 2 == 0:",
"+if a * b % 2 == 0:"
] | false | 0.052598 | 0.051885 | 1.013747 | [
"s791354667",
"s011103213"
] |
u867848444 | p02726 | python | s007894689 | s075385466 | 1,645 | 1,187 | 3,444 | 9,296 | Accepted | Accepted | 27.84 | n, x, y = map(int,input().split())
dis = [0] * (n - 1)
for i in range(n - 1):
for j in range(i + 1, n):
d = min(abs(x - i - 1) + abs(y - j - 1) + 1, j - i)
dis[d - 1] += 1
print(*dis, sep = '\n')
| n, x, y = map(int,input().split())
cnt = [0] * (n - 1)
for i in range(1, n):
for j in range(i + 1, n + 1):
temp1 = j - i
temp2 = abs(i - x) + abs(j - y) + 1
dis = min(temp1, temp2)
cnt[dis - 1] += 1
print(*cnt, sep='\n')
| 8 | 11 | 223 | 268 | n, x, y = map(int, input().split())
dis = [0] * (n - 1)
for i in range(n - 1):
for j in range(i + 1, n):
d = min(abs(x - i - 1) + abs(y - j - 1) + 1, j - i)
dis[d - 1] += 1
print(*dis, sep="\n")
| n, x, y = map(int, input().split())
cnt = [0] * (n - 1)
for i in range(1, n):
for j in range(i + 1, n + 1):
temp1 = j - i
temp2 = abs(i - x) + abs(j - y) + 1
dis = min(temp1, temp2)
cnt[dis - 1] += 1
print(*cnt, sep="\n")
| false | 27.272727 | [
"-dis = [0] * (n - 1)",
"-for i in range(n - 1):",
"- for j in range(i + 1, n):",
"- d = min(abs(x - i - 1) + abs(y - j - 1) + 1, j - i)",
"- dis[d - 1] += 1",
"-print(*dis, sep=\"\\n\")",
"+cnt = [0] * (n - 1)",
"+for i in range(1, n):",
"+ for j in range(i + 1, n + 1):",
"+ ... | false | 0.034645 | 0.035008 | 0.989638 | [
"s007894689",
"s075385466"
] |
u588341295 | p03651 | python | s848808222 | s728422605 | 96 | 88 | 16,336 | 16,844 | Accepted | Accepted | 8.33 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect i... | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect i... | 45 | 44 | 1,359 | 1,361 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect im... | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect im... | false | 2.222222 | [
"- return reduce(lcm, nums, initial=1)",
"+ return reduce(lcm, nums, 1)",
"+",
"+",
"+def gcd_list(nums):",
"+ return reduce(gcd, nums, nums[0])",
"-base = aN[0]",
"-for i in range(1, N):",
"- base = gcd(base, aN[i])",
"+base = gcd_list(aN)"
] | false | 0.032262 | 0.037498 | 0.860377 | [
"s848808222",
"s728422605"
] |
u906501980 | p03359 | python | s765983003 | s309025306 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | a, b = list(map(int, input().split()))
out = a if a<=b else a-1
print(out) | def main():
a, b = list(map(int, input().split()))
print((a-(a>b)))
if __name__ == "__main__":
main() | 3 | 6 | 70 | 115 | a, b = list(map(int, input().split()))
out = a if a <= b else a - 1
print(out)
| def main():
a, b = list(map(int, input().split()))
print((a - (a > b)))
if __name__ == "__main__":
main()
| false | 50 | [
"-a, b = list(map(int, input().split()))",
"-out = a if a <= b else a - 1",
"-print(out)",
"+def main():",
"+ a, b = list(map(int, input().split()))",
"+ print((a - (a > b)))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.045147 | 0.152566 | 0.295918 | [
"s765983003",
"s309025306"
] |
u753803401 | p04020 | python | s427687527 | s323756320 | 240 | 204 | 44,636 | 43,724 | Accepted | Accepted | 15 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
a = [int(input().rstrip('\n')) for _ in range(n)]
cnt = 0
t = 0
for v in a:
if v == 0:
cnt += (t // 2)
t = 0
else:
t += v
cnt += (t // 2)
... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = [int(readline()) for _ in range(n)]
c = ac = 0
for v in a:
c += v
if v == 0:
ac += c // 2
c = 0
print((ac + c // 2))
if __name__... | 19 | 19 | 377 | 347 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
a = [int(input().rstrip("\n")) for _ in range(n)]
cnt = 0
t = 0
for v in a:
if v == 0:
cnt += t // 2
t = 0
else:
t += v
cnt += t // 2
print(cnt)
if ... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = [int(readline()) for _ in range(n)]
c = ac = 0
for v in a:
c += v
if v == 0:
ac += c // 2
c = 0
print((ac + c // 2))
if __name__ == "__main__":
... | false | 0 | [
"-def slove():",
"- import sys",
"+import sys",
"- input = sys.stdin.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = [int(input().rstrip(\"\\n\")) for _ in range(n)]",
"- cnt = 0",
"- t = 0",
"+",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+ mod... | false | 0.041224 | 0.039167 | 1.052515 | [
"s427687527",
"s323756320"
] |
u281610856 | p03575 | python | s751805156 | s712142608 | 343 | 21 | 19,896 | 3,064 | Accepted | Accepted | 93.88 | from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def bfs(... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def dfs(start, a, b, visited, n, graph):
for node in graph[start]:
if node not in visited:
if (start, node) == (a, b) or (start, node) == (b, a):
continue # (... | 53 | 39 | 1,185 | 968 | from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def bfs(s, n, g):
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def dfs(start, a, b, visited, n, graph):
for node in graph[start]:
if node not in visited:
if (start, node) == (a, b) or (start, node) == (b, a):
continue # (start, node)... | false | 26.415094 | [
"-from heapq import heappush, heappop",
"-from itertools import permutations, accumulate, combinations",
"-import math",
"-import bisect",
"-import numpy as np",
"-from collections import defaultdict, deque",
"-# sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(10**6)",
"-def bfs(s, n, g):",... | false | 0.068164 | 0.036658 | 1.859461 | [
"s751805156",
"s712142608"
] |
u753803401 | p03076 | python | s655895292 | s891516237 | 21 | 18 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | a = []
for i in range(5):
b = int(eval(input()))
c = b % 10 if b % 10 != 0 else 9
d = (b + 10 - 1) // 10 * 10
a.append([b, c, d])
a = sorted(a, key=lambda x: x[1], reverse=True)
total = 0
for i in range(len(a)):
total += a[i][2]
print((total - a[i][2] + a[i][0]))
| import itertools
a = [int(eval(input())) for _ in range(5)]
mi = 10 ** 10
for i in itertools.permutations(a, 5):
t = 0
for j, v in enumerate(i):
if j == 4:
t += v
else:
t += ((v + 9) // 10 * 10)
mi = min(t, mi)
print(mi)
| 11 | 12 | 286 | 278 | a = []
for i in range(5):
b = int(eval(input()))
c = b % 10 if b % 10 != 0 else 9
d = (b + 10 - 1) // 10 * 10
a.append([b, c, d])
a = sorted(a, key=lambda x: x[1], reverse=True)
total = 0
for i in range(len(a)):
total += a[i][2]
print((total - a[i][2] + a[i][0]))
| import itertools
a = [int(eval(input())) for _ in range(5)]
mi = 10**10
for i in itertools.permutations(a, 5):
t = 0
for j, v in enumerate(i):
if j == 4:
t += v
else:
t += (v + 9) // 10 * 10
mi = min(t, mi)
print(mi)
| false | 8.333333 | [
"-a = []",
"-for i in range(5):",
"- b = int(eval(input()))",
"- c = b % 10 if b % 10 != 0 else 9",
"- d = (b + 10 - 1) // 10 * 10",
"- a.append([b, c, d])",
"-a = sorted(a, key=lambda x: x[1], reverse=True)",
"-total = 0",
"-for i in range(len(a)):",
"- total += a[i][2]",
"-print... | false | 0.138698 | 0.048624 | 2.852463 | [
"s655895292",
"s891516237"
] |
u068750695 | p02755 | python | s077934556 | s692978695 | 877 | 257 | 40,172 | 40,172 | Accepted | Accepted | 70.7 | import math
a,b=list(map(int,input().split()))
flag=True
for i in range(10**7):
if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
print(i)
flag=False
exit()
if flag:
print((-1)) | import math
a,b=list(map(int,input().split()))
flag=True
for i in range(10**6):
if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
print(i)
flag=False
exit()
if flag:
print((-1)) | 10 | 10 | 211 | 211 | import math
a, b = list(map(int, input().split()))
flag = True
for i in range(10**7):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
flag = False
exit()
if flag:
print((-1))
| import math
a, b = list(map(int, input().split()))
flag = True
for i in range(10**6):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
flag = False
exit()
if flag:
print((-1))
| false | 0 | [
"-for i in range(10**7):",
"+for i in range(10**6):"
] | false | 0.708808 | 0.49857 | 1.421682 | [
"s077934556",
"s692978695"
] |
u863442865 | p02936 | python | s109556839 | s115032259 | 998 | 892 | 80,672 | 55,824 | Accepted | Accepted | 10.62 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
N, Q = list(map(int, input().split()))
G = [set() for _ in range(N)]
cnt = [0]*N
visited = [0]*N
for _ in range(N-1):
a, b = list(map(int, input().split()))
a -= 1
b -... | def main():
import sys
sys.setrecursionlimit(500000)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
G = [[] for _ in range(N)]
cnt = [0]*N
visited = [0]*N
for _ in range(N-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
... | 38 | 36 | 768 | 709 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
N, Q = list(map(int, input().split()))
G = [set() for _ in range(N)]
cnt = [0] * N
visited = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
... | def main():
import sys
sys.setrecursionlimit(500000)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
G = [[] for _ in range(N)]
cnt = [0] * N
visited = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G... | false | 5.263158 | [
"+ sys.setrecursionlimit(500000)",
"- sys.setrecursionlimit(10000000)",
"- G = [set() for _ in range(N)]",
"+ G = [[] for _ in range(N)]",
"- G[a].add(b)",
"- G[b].add(a)",
"- for _ in range(Q):",
"+ G[a].append(b)",
"+ G[b].append(a)",
"+ for i in ran... | false | 0.037811 | 0.046751 | 0.808788 | [
"s109556839",
"s115032259"
] |
u844646164 | p03475 | python | s598751526 | s925661236 | 105 | 94 | 3,188 | 74,088 | Accepted | Accepted | 10.48 | N = int(eval(input()))
train = [list(map(int, input().split())) for _ in range(N-1)]
for i in range(N-1):
t = train[i][0] + train[i][1]
for j in range(i+1, N-1):
if train[j][1] >= t:
t = train[j][1] + train[j][0]
elif t % train[j][2] == 0:
t += train[j][0]
... | N = int(eval(input()))
csf = [list(map(int, input().split())) for _ in range(N-1)]
for i in range(N-1):
t = csf[i][1]
t += csf[i][0]
for j in range(i+1, N-1):
st = csf[j][1]
f = csf[j][2]
t = max(st, ((t-1)//f+1)*f)
t += csf[j][0]
print(t)
print((0))
| 16 | 16 | 472 | 310 | N = int(eval(input()))
train = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N - 1):
t = train[i][0] + train[i][1]
for j in range(i + 1, N - 1):
if train[j][1] >= t:
t = train[j][1] + train[j][0]
elif t % train[j][2] == 0:
t += train[j][0]
... | N = int(eval(input()))
csf = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N - 1):
t = csf[i][1]
t += csf[i][0]
for j in range(i + 1, N - 1):
st = csf[j][1]
f = csf[j][2]
t = max(st, ((t - 1) // f + 1) * f)
t += csf[j][0]
print(t)
print((0))
| false | 0 | [
"-train = [list(map(int, input().split())) for _ in range(N - 1)]",
"+csf = [list(map(int, input().split())) for _ in range(N - 1)]",
"- t = train[i][0] + train[i][1]",
"+ t = csf[i][1]",
"+ t += csf[i][0]",
"- if train[j][1] >= t:",
"- t = train[j][1] + train[j][0]",
"- ... | false | 0.078139 | 0.066935 | 1.167388 | [
"s598751526",
"s925661236"
] |
u621935300 | p03480 | python | s720651027 | s617686058 | 45 | 28 | 5,892 | 4,228 | Accepted | Accepted | 37.78 | S=input()
N=len(S)
TS=N
for k in range(N-1):
if S[k]!=S[k+1]:
TS=min(TS, max(k+1, N-k-1))
print(TS) | S=input()
N=len(S)
c=len(S)/2
if N%2==1:
cnt=c+1
for i in range(1,c+1):
if S[c-i]==S[c+i]==S[c]:
cnt+=1
pass
else:
break
else:
cnt=c
if S[c]!=S[c-1]:
print(cnt)
quit()
cnt+=1
for i in range(1,c):
if S[c+i]==S[c-i-1]==S[c]:
cnt+=1
else:
break
print(cnt)
| 8 | 26 | 113 | 316 | S = input()
N = len(S)
TS = N
for k in range(N - 1):
if S[k] != S[k + 1]:
TS = min(TS, max(k + 1, N - k - 1))
print(TS)
| S = input()
N = len(S)
c = len(S) / 2
if N % 2 == 1:
cnt = c + 1
for i in range(1, c + 1):
if S[c - i] == S[c + i] == S[c]:
cnt += 1
pass
else:
break
else:
cnt = c
if S[c] != S[c - 1]:
print(cnt)
quit()
cnt += 1
for i in range(1... | false | 69.230769 | [
"-TS = N",
"-for k in range(N - 1):",
"- if S[k] != S[k + 1]:",
"- TS = min(TS, max(k + 1, N - k - 1))",
"-print(TS)",
"+c = len(S) / 2",
"+if N % 2 == 1:",
"+ cnt = c + 1",
"+ for i in range(1, c + 1):",
"+ if S[c - i] == S[c + i] == S[c]:",
"+ cnt += 1",
"+ ... | false | 0.070272 | 0.043735 | 1.60676 | [
"s720651027",
"s617686058"
] |
u842964692 | p04045 | python | s365591903 | s833896221 | 81 | 51 | 5,692 | 2,940 | Accepted | Accepted | 37.04 | from collections import deque
N,K=list(map(int,input().split()))
D=list(map(int,input().split()))
like=list(range(1,10))
dislike0=False
for s in D:
if s==0:
dislike0=True
else:
like.remove(s)
like.sort()
q=deque(like)
if dislike0==False:
like.insert(0,0)
while q:
... | N,K=list(map(int,input().split()))
D=list(input().split())
while True:
for s in str(N):
if s in D:
N+=1
break
else:
print(N)
exit() | 27 | 11 | 464 | 192 | from collections import deque
N, K = list(map(int, input().split()))
D = list(map(int, input().split()))
like = list(range(1, 10))
dislike0 = False
for s in D:
if s == 0:
dislike0 = True
else:
like.remove(s)
like.sort()
q = deque(like)
if dislike0 == False:
like.insert(0, 0)
while q:
nu... | N, K = list(map(int, input().split()))
D = list(input().split())
while True:
for s in str(N):
if s in D:
N += 1
break
else:
print(N)
exit()
| false | 59.259259 | [
"-from collections import deque",
"-",
"-D = list(map(int, input().split()))",
"-like = list(range(1, 10))",
"-dislike0 = False",
"-for s in D:",
"- if s == 0:",
"- dislike0 = True",
"+D = list(input().split())",
"+while True:",
"+ for s in str(N):",
"+ if s in D:",
"+ ... | false | 0.039639 | 0.045687 | 0.867607 | [
"s365591903",
"s833896221"
] |
u287132915 | p02837 | python | s240002654 | s206588453 | 259 | 229 | 44,380 | 42,480 | Accepted | Accepted | 11.58 | n = int(eval(input()))
lst = [[-1 for _ in range(n)] for __ in range(n)]
for i in range(n):
ai = int(eval(input()))
for j in range(ai):
hito, which = list(map(int, input().split()))
lst[i][hito-1] = which
ans = 0
muri = 0
for i in range(2**n):
kumi = list(format(i, '0'+str(n)+'b'... | import itertools
n = int(eval(input()))
lst = []
for i in range(n):
ai = int(eval(input()))
lsti = []
for j in range(ai):
xj, yj = list(map(int, input().split()))
xj -= 1
lsti.append([xj, yj])
lst.append(lsti)
ans = 0
for v in itertools.product([0, 1], repeat=n):
... | 28 | 28 | 730 | 587 | n = int(eval(input()))
lst = [[-1 for _ in range(n)] for __ in range(n)]
for i in range(n):
ai = int(eval(input()))
for j in range(ai):
hito, which = list(map(int, input().split()))
lst[i][hito - 1] = which
ans = 0
muri = 0
for i in range(2**n):
kumi = list(format(i, "0" + str(n) + "b"))
... | import itertools
n = int(eval(input()))
lst = []
for i in range(n):
ai = int(eval(input()))
lsti = []
for j in range(ai):
xj, yj = list(map(int, input().split()))
xj -= 1
lsti.append([xj, yj])
lst.append(lsti)
ans = 0
for v in itertools.product([0, 1], repeat=n):
ok = 1
... | false | 0 | [
"+import itertools",
"+",
"-lst = [[-1 for _ in range(n)] for __ in range(n)]",
"+lst = []",
"+ lsti = []",
"- hito, which = list(map(int, input().split()))",
"- lst[i][hito - 1] = which",
"+ xj, yj = list(map(int, input().split()))",
"+ xj -= 1",
"+ lsti.appe... | false | 0.037255 | 0.035061 | 1.062588 | [
"s240002654",
"s206588453"
] |
u784022244 | p03472 | python | s882280912 | s790161910 | 379 | 203 | 12,176 | 79,000 | Accepted | Accepted | 46.44 | import bisect
from math import ceil
N,H=list(map(int, input().split()))
A=[]
B=[]
for i in range(N):
a,b=list(map(int, input().split()))
A.append(a)
B.append(b)
A=sorted(A)
B=sorted(B)
idx=bisect.bisect_right(B,A[-1])
throw=sum(B[idx:])
if throw<=H:
ans=N-idx
res=H-throw
an... | from math import ceil
N,H=list(map(int, input().split()))
A=[0]*N
B=[0]*N
for i in range(N):
a,b=list(map(int, input().split()))
A[i]=a
B[i]=b
A=sorted(A)
B=sorted(B, reverse=True)
amax=max(A)
ans=0
for i in range(N):
b=B[i]
if b>amax:
H-=b
ans+=1
if ... | 30 | 28 | 501 | 403 | import bisect
from math import ceil
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A = sorted(A)
B = sorted(B)
idx = bisect.bisect_right(B, A[-1])
throw = sum(B[idx:])
if throw <= H:
ans = N - idx
res = H - thro... | from math import ceil
N, H = list(map(int, input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
A = sorted(A)
B = sorted(B, reverse=True)
amax = max(A)
ans = 0
for i in range(N):
b = B[i]
if b > amax:
H -= b
ans += 1
... | false | 6.666667 | [
"-import bisect",
"-A = []",
"-B = []",
"+A = [0] * N",
"+B = [0] * N",
"- A.append(a)",
"- B.append(b)",
"+ A[i] = a",
"+ B[i] = b",
"-B = sorted(B)",
"-idx = bisect.bisect_right(B, A[-1])",
"-throw = sum(B[idx:])",
"-if throw <= H:",
"- ans = N - idx",
"- res = H - th... | false | 0.035218 | 0.035188 | 1.000847 | [
"s882280912",
"s790161910"
] |
u607884285 | p03165 | python | s808065138 | s899435572 | 671 | 429 | 175,112 | 112,476 | Accepted | Accepted | 36.07 | s,t=eval(input()),eval(input())
m,n=len(s),len(t)
c=[[0]*(n+1) for _ in range(m+1)]
fro=[['']*(n+1) for _ in range(m+1)]
for i in range(1,m+1):
for j in range(1,n+1):
if s[i-1]==t[j-1]:
c[i][j]=c[i-1][j-1]+1
fro[i][j]='upper_left'
elif c[i-1][j]>=c[i][j-1]:
... | s,t=eval(input()),eval(input())
S,T=len(s),len(t)
dp=[[0]*(T+1) for _ in range(S+1)]
for i in range(1,S+1):
for j in range(1,T+1):
if s[i-1]==t[j-1]:
dp[i][j]=dp[i-1][j-1]+1
else:
dp[i][j]=max(dp[i-1][j],dp[i][j-1])
i,j=S,T
ans=''
while min(i,j)>0:
if dp... | 26 | 21 | 627 | 482 | s, t = eval(input()), eval(input())
m, n = len(s), len(t)
c = [[0] * (n + 1) for _ in range(m + 1)]
fro = [[""] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if s[i - 1] == t[j - 1]:
c[i][j] = c[i - 1][j - 1] + 1
fro[i][j] = "upper_left"
... | s, t = eval(input()), eval(input())
S, T = len(s), len(t)
dp = [[0] * (T + 1) for _ in range(S + 1)]
for i in range(1, S + 1):
for j in range(1, T + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
i, j = S, T
ans =... | false | 19.230769 | [
"-m, n = len(s), len(t)",
"-c = [[0] * (n + 1) for _ in range(m + 1)]",
"-fro = [[\"\"] * (n + 1) for _ in range(m + 1)]",
"-for i in range(1, m + 1):",
"- for j in range(1, n + 1):",
"+S, T = len(s), len(t)",
"+dp = [[0] * (T + 1) for _ in range(S + 1)]",
"+for i in range(1, S + 1):",
"+ for ... | false | 0.036458 | 0.036748 | 0.992123 | [
"s808065138",
"s899435572"
] |
u361826811 | p02959 | python | s462883834 | s310559192 | 179 | 127 | 23,432 | 23,432 | Accepted | Accepted | 29.05 | import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *AB = list(map(int, read().split()))
A = AB[:N + 1]
B = AB[N + 1:]
ans = 0
cnt = 0
for i, j in zip(A, B):
# print(f'A:{i} B:{j} cnt:{cnt}')... | import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *AB = list(map(int, read().split()))
A = AB[:N + 1]
B = AB[N + 1:]
B.append(0)
ans = 0
rest = 0
for i, j in zip(A, B):
x = min(rest, i)
... | 25 | 27 | 454 | 452 | import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *AB = list(map(int, read().split()))
A = AB[: N + 1]
B = AB[N + 1 :]
ans = 0
cnt = 0
for i, j in zip(A, B):
# print(f'A:{i} B:{j} cnt:{cnt}')
ans += min(i... | import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *AB = list(map(int, read().split()))
A = AB[: N + 1]
B = AB[N + 1 :]
B.append(0)
ans = 0
rest = 0
for i, j in zip(A, B):
x = min(rest, i)
ans += x
i -... | false | 7.407407 | [
"+B.append(0)",
"-cnt = 0",
"+rest = 0",
"- # print(f'A:{i} B:{j} cnt:{cnt}')",
"- ans += min(i, cnt)",
"- m = min(i - cnt, j)",
"- m = max(m, 0)",
"- ans += m",
"- cnt = max(j - m, 0)",
"-ans += min(A[-1], cnt)",
"+ x = min(rest, i)",
"+ ans += x",
"+ i -= x",
"... | false | 0.036983 | 0.038047 | 0.972035 | [
"s462883834",
"s310559192"
] |
u597374218 | p02712 | python | s277094980 | s890901111 | 103 | 92 | 9,168 | 9,160 | Accepted | Accepted | 10.68 | print((sum(i for i in range(int(eval(input()))+1) if i%3!=0 and i%5!=0))) | print((sum(i for i in range(int(eval(input()))+1) if i%3 and i%5))) | 1 | 1 | 65 | 59 | print((sum(i for i in range(int(eval(input())) + 1) if i % 3 != 0 and i % 5 != 0)))
| print((sum(i for i in range(int(eval(input())) + 1) if i % 3 and i % 5)))
| false | 0 | [
"-print((sum(i for i in range(int(eval(input())) + 1) if i % 3 != 0 and i % 5 != 0)))",
"+print((sum(i for i in range(int(eval(input())) + 1) if i % 3 and i % 5)))"
] | false | 0.099116 | 0.247749 | 0.400066 | [
"s277094980",
"s890901111"
] |
u347600233 | p03611 | python | s828361404 | s074872528 | 95 | 85 | 13,964 | 13,964 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a = [int(i) for i in input().split()]
cnt_x = [0] * (10**5 + 2)
for i in range(n):
cnt_x[a[i] - 1] += 1
cnt_x[a[i]] += 1
cnt_x[a[i] + 1] += 1
print((max(cnt_x))) | n = int(eval(input()))
A = [int(i) for i in input().split()]
cnt_x = [0] * (10**5 + 2)
for a in A:
cnt_x[a - 1] += 1
cnt_x[a] += 1
cnt_x[a + 1] += 1
print((max(cnt_x))) | 8 | 8 | 195 | 179 | n = int(eval(input()))
a = [int(i) for i in input().split()]
cnt_x = [0] * (10**5 + 2)
for i in range(n):
cnt_x[a[i] - 1] += 1
cnt_x[a[i]] += 1
cnt_x[a[i] + 1] += 1
print((max(cnt_x)))
| n = int(eval(input()))
A = [int(i) for i in input().split()]
cnt_x = [0] * (10**5 + 2)
for a in A:
cnt_x[a - 1] += 1
cnt_x[a] += 1
cnt_x[a + 1] += 1
print((max(cnt_x)))
| false | 0 | [
"-a = [int(i) for i in input().split()]",
"+A = [int(i) for i in input().split()]",
"-for i in range(n):",
"- cnt_x[a[i] - 1] += 1",
"- cnt_x[a[i]] += 1",
"- cnt_x[a[i] + 1] += 1",
"+for a in A:",
"+ cnt_x[a - 1] += 1",
"+ cnt_x[a] += 1",
"+ cnt_x[a + 1] += 1"
] | false | 0.010119 | 0.050452 | 0.20057 | [
"s828361404",
"s074872528"
] |
u397384480 | p03137 | python | s452095193 | s140635615 | 252 | 227 | 56,872 | 57,384 | Accepted | Accepted | 9.92 | N,M = list(map(int,(input().split())))
X = list(map(int,(input().split())))
if N >= M:
print((0))
else:
X.sort()
gap = []
for i in range(1,M):
gap.append(X[i]-X[i-1])
s = X[M-1] - X[0]
gap.sort(reverse=True)
d = 0
for i in range(N-1):
d += gap[i]
print((... | N,M = list(map(int,(input().split())))
X = list(map(int,(input().split())))
if N >= M:
print((0))
else:
X.sort()
gap = []
for i in range(1,M):
gap.append(X[i]-X[i-1])
s = X[M-1] - X[0]
gap.sort(reverse=True)
print((s-sum(gap[0:N-1]))) | 15 | 12 | 315 | 271 | N, M = list(map(int, (input().split())))
X = list(map(int, (input().split())))
if N >= M:
print((0))
else:
X.sort()
gap = []
for i in range(1, M):
gap.append(X[i] - X[i - 1])
s = X[M - 1] - X[0]
gap.sort(reverse=True)
d = 0
for i in range(N - 1):
d += gap[i]
print((s ... | N, M = list(map(int, (input().split())))
X = list(map(int, (input().split())))
if N >= M:
print((0))
else:
X.sort()
gap = []
for i in range(1, M):
gap.append(X[i] - X[i - 1])
s = X[M - 1] - X[0]
gap.sort(reverse=True)
print((s - sum(gap[0 : N - 1])))
| false | 20 | [
"- d = 0",
"- for i in range(N - 1):",
"- d += gap[i]",
"- print((s - d))",
"+ print((s - sum(gap[0 : N - 1])))"
] | false | 0.047949 | 0.04555 | 1.052665 | [
"s452095193",
"s140635615"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.