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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u104282757 | p02923 | python | s002304022 | s162116879 | 76 | 57 | 14,228 | 14,252 | Accepted | Accepted | 25 | N = int(eval(input()))
H_list = list(map(int, input().split()))
r = 0
res = 0
for i in range(N - 1):
if H_list[i] >= H_list[i + 1]:
r += 1
if r > res:
res = r
else:
r = 0
if __name__ == "__main__":
print(res)
| def main():
n = int(eval(input()))
h_list = list(map(int, input().split()))
r = 0
res = 0
for i in range(n - 1):
if h_list[i] >= h_list[i + 1]:
r += 1
if r > res:
res = r
else:
r = 0
print(res)
if __name__ == ... | 15 | 18 | 267 | 338 | N = int(eval(input()))
H_list = list(map(int, input().split()))
r = 0
res = 0
for i in range(N - 1):
if H_list[i] >= H_list[i + 1]:
r += 1
if r > res:
res = r
else:
r = 0
if __name__ == "__main__":
print(res)
| def main():
n = int(eval(input()))
h_list = list(map(int, input().split()))
r = 0
res = 0
for i in range(n - 1):
if h_list[i] >= h_list[i + 1]:
r += 1
if r > res:
res = r
else:
r = 0
print(res)
if __name__ == "__main__":
m... | false | 16.666667 | [
"-N = int(eval(input()))",
"-H_list = list(map(int, input().split()))",
"-r = 0",
"-res = 0",
"-for i in range(N - 1):",
"- if H_list[i] >= H_list[i + 1]:",
"- r += 1",
"- if r > res:",
"- res = r",
"- else:",
"- r = 0",
"+def main():",
"+ n = int(eva... | false | 0.039811 | 0.040181 | 0.990799 | [
"s002304022",
"s162116879"
] |
u597374218 | p02612 | python | s832972335 | s333837275 | 36 | 29 | 9,140 | 9,112 | Accepted | Accepted | 19.44 | N=int(eval(input()))
print((0 if N%1000==0 else 1000-N%1000)) | N=int(eval(input()))
print(((1000-N%1000)%1000)) | 2 | 2 | 54 | 41 | N = int(eval(input()))
print((0 if N % 1000 == 0 else 1000 - N % 1000))
| N = int(eval(input()))
print(((1000 - N % 1000) % 1000))
| false | 0 | [
"-print((0 if N % 1000 == 0 else 1000 - N % 1000))",
"+print(((1000 - N % 1000) % 1000))"
] | false | 0.044546 | 0.03851 | 1.156724 | [
"s832972335",
"s333837275"
] |
u034782764 | p03457 | python | s992551098 | s606570703 | 371 | 331 | 3,060 | 3,060 | Accepted | Accepted | 10.78 | n=int(eval(input()))
T,X,Y=0,0,0
a='Yes'
for i in range(n):
t,x,y=list(map(int,input().split()))
if abs(x-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
a='No'
break
T,X,Y=t,x,y
print(('{}'.format(a))) | N = int(eval(input()))
for _ in range(N):
t, x, y = list(map(int, input().split()))
if x + y > t or (t + x + y)%2 != 0:
print("No")
exit()
print("Yes") | 11 | 7 | 212 | 169 | n = int(eval(input()))
T, X, Y = 0, 0, 0
a = "Yes"
for i in range(n):
t, x, y = list(map(int, input().split()))
if abs(x - X) + abs(y - Y) > t - T or t % 2 != (x + y) % 2:
a = "No"
break
T, X, Y = t, x, y
print(("{}".format(a)))
| N = int(eval(input()))
for _ in range(N):
t, x, y = list(map(int, input().split()))
if x + y > t or (t + x + y) % 2 != 0:
print("No")
exit()
print("Yes")
| false | 36.363636 | [
"-n = int(eval(input()))",
"-T, X, Y = 0, 0, 0",
"-a = \"Yes\"",
"-for i in range(n):",
"+N = int(eval(input()))",
"+for _ in range(N):",
"- if abs(x - X) + abs(y - Y) > t - T or t % 2 != (x + y) % 2:",
"- a = \"No\"",
"- break",
"- T, X, Y = t, x, y",
"-print((\"{}\".format(... | false | 0.036276 | 0.045888 | 0.79054 | [
"s992551098",
"s606570703"
] |
u094191970 | p02834 | python | s570084360 | s579320799 | 614 | 323 | 29,500 | 33,732 | Accepted | Accepted | 47.39 | from collections import deque
n,u,v=list(map(int,input().split()))
tree=[[] for i in range(n)]
for i in range(n-1):
i,j=list(map(int,input().split()))
tree[i-1].append(j-1)
tree[j-1].append(i-1)
def BFS(s):
dist=[-1 for i in range(n)]
dist[s]=0
que=deque()
que.append(s)
while que:
x=que... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
n,u,v=nii()
u-=1
v-=1
tree=[[] for i in range(n)]
for i in range(n-1):
a,b=nii()
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
dist_a=[... | 35 | 45 | 540 | 742 | from collections import deque
n, u, v = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(n - 1):
i, j = list(map(int, input().split()))
tree[i - 1].append(j - 1)
tree[j - 1].append(i - 1)
def BFS(s):
dist = [-1 for i in range(n)]
dist[s] = 0
que = deque()
que.a... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
n, u, v = nii()
u -= 1
v -= 1
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b = nii()
a -= 1
b -= 1
tree[a].append(b)
tree[b]... | false | 22.222222 | [
"+from sys import stdin",
"+",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"-n, u, v = list(map(int, input().split()))",
"+n, u, v = nii()",
"+u -= 1",
"+v -= 1",
"- i, j = list(map(int, input().split()))",
"- tree[i ... | false | 0.063481 | 0.078844 | 0.805147 | [
"s570084360",
"s579320799"
] |
u889914341 | p03162 | python | s602560035 | s887610032 | 521 | 379 | 30,580 | 30,576 | Accepted | Accepted | 27.26 | n = int(eval(input()))
dp = list(list(map(int, input().split())) for _ in range(n))
for i in range(1, n):
dp[i][0] += max(dp[i - 1][1], dp[i - 1][2]);
dp[i][1] += max(dp[i - 1][2], dp[i - 1][0]);
dp[i][2] += max(dp[i - 1][0], dp[i - 1][1]);
print((max(dp[n - 1])))
| import sys
readline = sys.stdin.readline
n = int(eval(input()))
dp = list(list(map(int, readline().split())) for _ in range(n))
for i in range(1, n):
dp[i][0] += max(dp[i - 1][1], dp[i - 1][2]);
dp[i][1] += max(dp[i - 1][2], dp[i - 1][0]);
dp[i][2] += max(dp[i - 1][0], dp[i - 1][1]);
print((max(dp[n... | 7 | 9 | 275 | 321 | n = int(eval(input()))
dp = list(list(map(int, input().split())) for _ in range(n))
for i in range(1, n):
dp[i][0] += max(dp[i - 1][1], dp[i - 1][2])
dp[i][1] += max(dp[i - 1][2], dp[i - 1][0])
dp[i][2] += max(dp[i - 1][0], dp[i - 1][1])
print((max(dp[n - 1])))
| import sys
readline = sys.stdin.readline
n = int(eval(input()))
dp = list(list(map(int, readline().split())) for _ in range(n))
for i in range(1, n):
dp[i][0] += max(dp[i - 1][1], dp[i - 1][2])
dp[i][1] += max(dp[i - 1][2], dp[i - 1][0])
dp[i][2] += max(dp[i - 1][0], dp[i - 1][1])
print((max(dp[n - 1])))
| false | 22.222222 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-dp = list(list(map(int, input().split())) for _ in range(n))",
"+dp = list(list(map(int, readline().split())) for _ in range(n))"
] | false | 0.0365 | 0.074907 | 0.487272 | [
"s602560035",
"s887610032"
] |
u191874006 | p02695 | python | s195773611 | s280804228 | 279 | 244 | 74,144 | 77,600 | Accepted | Accepted | 12.54 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 41 | 40 | 988 | 958 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 2.439024 | [
"-def check(num):",
"- res = 0",
"+def calc(lst):",
"+ ret = 0",
"- if num[b - 1] - num[a - 1] == c:",
"- res += d",
"- return res",
"+ if lst[b - 1] - lst[a - 1] == c:",
"+ ret += d",
"+ return ret",
"-def dfs(x, y, z, res):",
"- if y == n:",... | false | 0.249253 | 0.082137 | 3.034608 | [
"s195773611",
"s280804228"
] |
u622011073 | p03993 | python | s789677955 | s523892368 | 87 | 64 | 13,880 | 14,008 | Accepted | Accepted | 26.44 | s=0;n=int(eval(input()));*a,=list(map(int,input().split()))
for i in range(~-n):s+=(-~i<a[i])*(a[~-a[i]]==-~i)
print(s) | n=int(eval(input()));*a,=list(map(int,input().split()))
print((sum([a[~-a[i]]==-~i for i in range(n)])>>1)) | 3 | 2 | 109 | 94 | s = 0
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
for i in range(~-n):
s += (-~i < a[i]) * (a[~-a[i]] == -~i)
print(s)
| n = int(eval(input()))
(*a,) = list(map(int, input().split()))
print((sum([a[~-a[i]] == -~i for i in range(n)]) >> 1))
| false | 33.333333 | [
"-s = 0",
"-for i in range(~-n):",
"- s += (-~i < a[i]) * (a[~-a[i]] == -~i)",
"-print(s)",
"+print((sum([a[~-a[i]] == -~i for i in range(n)]) >> 1))"
] | false | 0.062766 | 0.034965 | 1.795099 | [
"s789677955",
"s523892368"
] |
u872538555 | p02689 | python | s875268706 | s764648364 | 1,232 | 375 | 90,796 | 22,912 | Accepted | Accepted | 69.56 | n, m = list(map(int, input().split()))
h = [int(i) for i in input().split()]
observatorys = [[] for i in range(n)]
for i in range(m):
a, b = [int(x) - 1 for x in input().split()]
if a in observatorys[b]:
continue
if b in observatorys[a]:
continue
observatorys[a].ap... | n, m = list(map(int, input().split()))
h = [int(x) for x in input().split()]
observary = [[] for _ in range(n)]
for i in range(m):
a, b = [int(x) - 1 for x in input().split()]
observary[a].append(h[b])
observary[b].append(h[a])
ans = 0
for i in range(n):
if len(observary[i]) == 0:
... | 28 | 16 | 576 | 397 | n, m = list(map(int, input().split()))
h = [int(i) for i in input().split()]
observatorys = [[] for i in range(n)]
for i in range(m):
a, b = [int(x) - 1 for x in input().split()]
if a in observatorys[b]:
continue
if b in observatorys[a]:
continue
observatorys[a].append(b)
observatory... | n, m = list(map(int, input().split()))
h = [int(x) for x in input().split()]
observary = [[] for _ in range(n)]
for i in range(m):
a, b = [int(x) - 1 for x in input().split()]
observary[a].append(h[b])
observary[b].append(h[a])
ans = 0
for i in range(n):
if len(observary[i]) == 0:
ans += 1
e... | false | 42.857143 | [
"-h = [int(i) for i in input().split()]",
"-observatorys = [[] for i in range(n)]",
"+h = [int(x) for x in input().split()]",
"+observary = [[] for _ in range(n)]",
"- if a in observatorys[b]:",
"- continue",
"- if b in observatorys[a]:",
"- continue",
"- observatorys[a].appen... | false | 0.059539 | 0.060783 | 0.979542 | [
"s875268706",
"s764648364"
] |
u046187684 | p03388 | python | s387351964 | s540754754 | 21 | 18 | 3,188 | 3,064 | Accepted | Accepted | 14.29 | from math import sqrt
q = int(eval(input()))
for _ in range(q):
a, b = list(map(int, input().split(" ")))
c = a * b
d = int(sqrt(c))
answer = 2 * d - 2
if d**2 == c:
answer -= 1
if d * (d + 1) < c:
answer += 1
if a == b:
answer += 1
print(answer) | from math import sqrt
q = int(eval(input()))
for _ in range(q):
a, b = list(map(int, input().split(" ")))
c = a * b
d = int(sqrt(c))
answer = 2 * d - 2
if d * d == c:
answer -= 1
if d * (d + 1) < c:
answer += 1
if a == b:
answer += 1
print(answer) | 14 | 14 | 303 | 304 | from math import sqrt
q = int(eval(input()))
for _ in range(q):
a, b = list(map(int, input().split(" ")))
c = a * b
d = int(sqrt(c))
answer = 2 * d - 2
if d**2 == c:
answer -= 1
if d * (d + 1) < c:
answer += 1
if a == b:
answer += 1
print(answer)
| from math import sqrt
q = int(eval(input()))
for _ in range(q):
a, b = list(map(int, input().split(" ")))
c = a * b
d = int(sqrt(c))
answer = 2 * d - 2
if d * d == c:
answer -= 1
if d * (d + 1) < c:
answer += 1
if a == b:
answer += 1
print(answer)
| false | 0 | [
"- if d**2 == c:",
"+ if d * d == c:"
] | false | 0.036596 | 0.037354 | 0.979706 | [
"s387351964",
"s540754754"
] |
u222668979 | p02712 | python | s366033354 | s480102626 | 243 | 150 | 48,536 | 9,164 | Accepted | Accepted | 38.27 | n = int(eval(input()))
num = [i for i in range(1, n + 1)]
for i in range(n):
if (num[i] % 3 == 0) or (num[i] % 5 == 0):
num[i] = 0
print((sum(num)))
| n = int(eval(input()))
cnt = 0
for i in range(n+1):
if (i % 3 == 0) or (i % 5 == 0):
continue
cnt += i
print(cnt)
| 8 | 9 | 162 | 134 | n = int(eval(input()))
num = [i for i in range(1, n + 1)]
for i in range(n):
if (num[i] % 3 == 0) or (num[i] % 5 == 0):
num[i] = 0
print((sum(num)))
| n = int(eval(input()))
cnt = 0
for i in range(n + 1):
if (i % 3 == 0) or (i % 5 == 0):
continue
cnt += i
print(cnt)
| false | 11.111111 | [
"-num = [i for i in range(1, n + 1)]",
"-for i in range(n):",
"- if (num[i] % 3 == 0) or (num[i] % 5 == 0):",
"- num[i] = 0",
"-print((sum(num)))",
"+cnt = 0",
"+for i in range(n + 1):",
"+ if (i % 3 == 0) or (i % 5 == 0):",
"+ continue",
"+ cnt += i",
"+print(cnt)"
] | false | 0.159411 | 0.11142 | 1.430716 | [
"s366033354",
"s480102626"
] |
u648913791 | p02583 | python | s574914623 | s510580020 | 216 | 186 | 25,692 | 25,360 | Accepted | Accepted | 13.89 | N = int(eval(input()))
bar = list(map(int, input().split()))
triangles = []
for i in range(N-2):
for j in range(i + 1, N - 1):
for k in range(j + 1, N):
if (bar[i] + bar[j] > bar[k]) and (bar[j] + bar[k] > bar[i]) and (bar[i] + bar[k] > bar[j]) and (len(set([bar[i], bar[j], bar[k]])) == 3)... | N = int(eval(input()))
bar = list(map(int, input().split()))
triangles = []
for i in range(N-2):
for j in range(i + 1, N - 1):
if bar[i] == bar[j]:
continue
for k in range(j + 1, N):
if bar[j] == bar[k] or bar[i] == bar[k]:
continue
if (b... | 9 | 13 | 399 | 533 | N = int(eval(input()))
bar = list(map(int, input().split()))
triangles = []
for i in range(N - 2):
for j in range(i + 1, N - 1):
for k in range(j + 1, N):
if (
(bar[i] + bar[j] > bar[k])
and (bar[j] + bar[k] > bar[i])
and (bar[i] + bar[k] > bar[j])... | N = int(eval(input()))
bar = list(map(int, input().split()))
triangles = []
for i in range(N - 2):
for j in range(i + 1, N - 1):
if bar[i] == bar[j]:
continue
for k in range(j + 1, N):
if bar[j] == bar[k] or bar[i] == bar[k]:
continue
if (
... | false | 30.769231 | [
"+ if bar[i] == bar[j]:",
"+ continue",
"+ if bar[j] == bar[k] or bar[i] == bar[k]:",
"+ continue",
"- and (len(set([bar[i], bar[j], bar[k]])) == 3)",
"- ):",
"+ ): # and (len(set([bar[i], bar[j], bar[k]])) == 3):"
] | false | 0.037354 | 0.060907 | 0.613299 | [
"s574914623",
"s510580020"
] |
u134712256 | p03943 | python | s318695209 | s271341653 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | s = list(map(int,input().split()))
flag = False
if s[0]+s[1] == s[2]:
flag = True
elif s[0]+s[2]==s[1]:
flag = True
elif s[0] == s[1]+s[2]:
flag = True
if flag:
print("Yes")
else:
print("No")
| s = list(map(int,input().split()))
s.sort()
print(("Yes" if s[0]+s[1]==s[2] else "No")) | 14 | 3 | 227 | 87 | s = list(map(int, input().split()))
flag = False
if s[0] + s[1] == s[2]:
flag = True
elif s[0] + s[2] == s[1]:
flag = True
elif s[0] == s[1] + s[2]:
flag = True
if flag:
print("Yes")
else:
print("No")
| s = list(map(int, input().split()))
s.sort()
print(("Yes" if s[0] + s[1] == s[2] else "No"))
| false | 78.571429 | [
"-flag = False",
"-if s[0] + s[1] == s[2]:",
"- flag = True",
"-elif s[0] + s[2] == s[1]:",
"- flag = True",
"-elif s[0] == s[1] + s[2]:",
"- flag = True",
"-if flag:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+s.sort()",
"+print((\"Yes\" if s[0] + s[1] == s[2] else \... | false | 0.051912 | 0.051439 | 1.009203 | [
"s318695209",
"s271341653"
] |
u562935282 | p03103 | python | s228673189 | s250076280 | 426 | 211 | 16,984 | 18,132 | Accepted | Accepted | 50.47 | n, m = list(map(int, input().split()))
e = [tuple(map(int, input().split())) for _ in range(n)]
e.sort() # 金額昇順
ans = 0
rest = m
for a, b in e:
use = min(rest, b)
ans += use * a
rest -= use
if rest == 0:
break
print(ans)
| def main():
from operator import itemgetter
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ds = []
for _ in range(N):
a, b = list(map(int, input().split()))
ds.append((a, b))
ds.sort(key=itemgetter(0))
rest = M
mi = 0
... | 12 | 37 | 251 | 644 | n, m = list(map(int, input().split()))
e = [tuple(map(int, input().split())) for _ in range(n)]
e.sort() # 金額昇順
ans = 0
rest = m
for a, b in e:
use = min(rest, b)
ans += use * a
rest -= use
if rest == 0:
break
print(ans)
| def main():
from operator import itemgetter
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ds = []
for _ in range(N):
a, b = list(map(int, input().split()))
ds.append((a, b))
ds.sort(key=itemgetter(0))
rest = M
mi = 0
for a, b in ds:... | false | 67.567568 | [
"-n, m = list(map(int, input().split()))",
"-e = [tuple(map(int, input().split())) for _ in range(n)]",
"-e.sort() # 金額昇順",
"-ans = 0",
"-rest = m",
"-for a, b in e:",
"- use = min(rest, b)",
"- ans += use * a",
"- rest -= use",
"- if rest == 0:",
"- break",
"-print(ans)",
... | false | 0.037151 | 0.036311 | 1.023127 | [
"s228673189",
"s250076280"
] |
u484229314 | p03626 | python | s595437561 | s795021254 | 191 | 172 | 38,384 | 38,384 | Accepted | Accepted | 9.95 | N = int(eval(input()))
S1 = eval(input())
S2 = eval(input())
MOD = 1000000007
if S1[0] == S2[0]:
ans = 3
pre = 1
else:
ans = 6
pre = 2
for i in range(1, N):
if S1[i] == S1[i - 1]: continue
if S1[i] == S2[i]:
if pre == 1:
ans *= 2
pre = 1
else:
... | MOD=10**9+7
N = int(eval(input()))
s1 = list(eval(input()))
s2 = list(eval(input()))
pre = s1[0] == s2[0]
if s1[0] == s2[0]:
ans = 3
idx = 1
else:
ans = 6
idx = 2
while idx < N:
if pre:
ans *= 2
else:
if s1[idx] != s2[idx]:
ans *= 3
pre=s1[idx... | 26 | 26 | 428 | 408 | N = int(eval(input()))
S1 = eval(input())
S2 = eval(input())
MOD = 1000000007
if S1[0] == S2[0]:
ans = 3
pre = 1
else:
ans = 6
pre = 2
for i in range(1, N):
if S1[i] == S1[i - 1]:
continue
if S1[i] == S2[i]:
if pre == 1:
ans *= 2
pre = 1
else:
if p... | MOD = 10**9 + 7
N = int(eval(input()))
s1 = list(eval(input()))
s2 = list(eval(input()))
pre = s1[0] == s2[0]
if s1[0] == s2[0]:
ans = 3
idx = 1
else:
ans = 6
idx = 2
while idx < N:
if pre:
ans *= 2
else:
if s1[idx] != s2[idx]:
ans *= 3
pre = s1[idx] == s2[idx]
... | false | 0 | [
"+MOD = 10**9 + 7",
"-S1 = eval(input())",
"-S2 = eval(input())",
"-MOD = 1000000007",
"-if S1[0] == S2[0]:",
"+s1 = list(eval(input()))",
"+s2 = list(eval(input()))",
"+pre = s1[0] == s2[0]",
"+if s1[0] == s2[0]:",
"- pre = 1",
"+ idx = 1",
"- pre = 2",
"-for i in range(1, N):",
... | false | 0.039498 | 0.042706 | 0.924868 | [
"s595437561",
"s795021254"
] |
u701644092 | p03160 | python | s158251440 | s896551085 | 158 | 145 | 20,460 | 20,444 | Accepted | Accepted | 8.23 | N = int(eval(input()))
h = list(map(int,input().split()))
INF = 10 ** 9 + 1
dp = [INF] * N
dp[0] = 0
for i in range(len(dp) - 1):
dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i + 1])
if i + 2 < len(dp):
dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 2])
print((dp[N - 1]))
| N = int(eval(input()))
blank = 2
h = list(map(int,input().split())) + [0] * blank
INF = 10 ** 9 + 1
dp = [INF] * (N + blank)
dp[0] = 0
for i in range(N):
dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i + 1])
dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 2])
print((dp[N - 1]))
| 12 | 12 | 298 | 298 | N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10**9 + 1
dp = [INF] * N
dp[0] = 0
for i in range(len(dp) - 1):
dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i + 1])
if i + 2 < len(dp):
dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 2])
print((dp[N - 1]))
| N = int(eval(input()))
blank = 2
h = list(map(int, input().split())) + [0] * blank
INF = 10**9 + 1
dp = [INF] * (N + blank)
dp[0] = 0
for i in range(N):
dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i + 1])
dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 2])
print((dp[N - 1]))
| false | 0 | [
"-h = list(map(int, input().split()))",
"+blank = 2",
"+h = list(map(int, input().split())) + [0] * blank",
"-dp = [INF] * N",
"+dp = [INF] * (N + blank)",
"-for i in range(len(dp) - 1):",
"+for i in range(N):",
"- if i + 2 < len(dp):",
"- dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i... | false | 0.035395 | 0.036226 | 0.977062 | [
"s158251440",
"s896551085"
] |
u367701763 | p02936 | python | s997902291 | s153987510 | 474 | 421 | 166,644 | 128,208 | Accepted | Accepted | 11.18 | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
import marshal
class Graph:
def __init__(self, n, dictated=False, decrement=True, destroy=False, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.dest... | import sys
input = sys.stdin.readline
N,Q = list(map(int,input().split()))
adj = [list() for _ in range(N)]
for _ in range(N-1):
a,b = list(map(int,input().split()))
adj[a-1].append(b-1)
adj[b-1].append(a-1)
memo = [0]*N
for _ in range(Q):
p,x = list(map(int,input().split()))
memo[p... | 105 | 25 | 3,036 | 493 | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
import marshal
class Graph:
def __init__(self, n, dictated=False, decrement=True, destroy=False, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.destroy = destro... | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
adj = [list() for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
memo = [0] * N
for _ in range(Q):
p, x = list(map(int, input().split()))
memo... | false | 76.190476 | [
"-# https://atcoder.jp/contests/abc138/tasks/abc138_d",
"-import marshal",
"-",
"-",
"-class Graph:",
"- def __init__(self, n, dictated=False, decrement=True, destroy=False, edge=[]):",
"- self.n = n",
"- self.dictated = dictated",
"- self.decrement = decrement",
"- ... | false | 0.111147 | 0.042172 | 2.635583 | [
"s997902291",
"s153987510"
] |
u677267454 | p03044 | python | s936626339 | s990433630 | 921 | 824 | 82,256 | 45,012 | Accepted | Accepted | 10.53 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(20000000)
n = int(eval(input()))
g = [[] for i in range(n)]
c = [-1 for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
w = w % 2
g[u].append([v, w])
g[v].append([u, w])
de... | # -*- coding: utf-8 -*-
n = int(eval(input()))
g = [[] for i in range(n)]
c = [-1 for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
g[u].append([v, w])
g[v].append([u, w])
q = [0]
while (len(q) > 0):
v = q.pop()
for u, w in g... | 28 | 24 | 472 | 440 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(20000000)
n = int(eval(input()))
g = [[] for i in range(n)]
c = [-1 for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
w = w % 2
g[u].append([v, w])
g[v].append([u, w])
def dfs(p, d):
i... | # -*- coding: utf-8 -*-
n = int(eval(input()))
g = [[] for i in range(n)]
c = [-1 for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
g[u].append([v, w])
g[v].append([u, w])
q = [0]
while len(q) > 0:
v = q.pop()
for u, w in g[v]:
if c[u] ... | false | 14.285714 | [
"-import sys",
"-",
"-sys.setrecursionlimit(20000000)",
"- w = w % 2",
"-",
"-",
"-def dfs(p, d):",
"- if c[p] == -1:",
"- c[p] = d",
"- for x, w in g[p]:",
"- dfs(x, d ^ w)",
"-",
"-",
"-dfs(0, 0)",
"-for i in range(len(c)):",
"- print((c[i]))",
"+q... | false | 0.042739 | 0.042449 | 1.006828 | [
"s936626339",
"s990433630"
] |
u363610900 | p03556 | python | s720107568 | s412638226 | 52 | 17 | 2,940 | 2,940 | Accepted | Accepted | 67.31 | N = int(eval(input()))
nums = 0
for i in range(1, 100000):
if i**2 <= N:
nums = i
print((nums**2)) | N = int(eval(input()))
print((int(N**(1/2))**2)) | 6 | 2 | 107 | 41 | N = int(eval(input()))
nums = 0
for i in range(1, 100000):
if i**2 <= N:
nums = i
print((nums**2))
| N = int(eval(input()))
print((int(N ** (1 / 2)) ** 2))
| false | 66.666667 | [
"-nums = 0",
"-for i in range(1, 100000):",
"- if i**2 <= N:",
"- nums = i",
"-print((nums**2))",
"+print((int(N ** (1 / 2)) ** 2))"
] | false | 0.092516 | 0.040478 | 2.285608 | [
"s720107568",
"s412638226"
] |
u729133443 | p02585 | python | s605896305 | s713142855 | 1,626 | 1,391 | 114,368 | 115,364 | Accepted | Accepted | 14.45 | (n,k),p,c=[[*list(map(int,t.split()))]for t in open(0)]
a=-9e9
for i in range(n):
s=f=0;x,j,*l=i,k
while~f:x=p[x]-1;s+=c[x];l+=s,;f-=x==i
for t in l[:k]:j-=1;a=max(a,t+j//len(l)*s*(s>0))
print(a) | (n,k),p,c=[[*list(map(int,t.split()))]for t in open(0)]
a=-9e9
while n:
n-=1;s,x,*l=0,n;f=j=k
while f:x=p[x]-1;s+=c[x];l+=s,;f=x!=n
for t in l[:k]:j-=1;a=max(a,t+j//len(l)*s*(s>0))
print(a) | 7 | 7 | 198 | 192 | (n, k), p, c = [[*list(map(int, t.split()))] for t in open(0)]
a = -9e9
for i in range(n):
s = f = 0
x, j, *l = i, k
while ~f:
x = p[x] - 1
s += c[x]
l += (s,)
f -= x == i
for t in l[:k]:
j -= 1
a = max(a, t + j // len(l) * s * (s > 0))
print(a)
| (n, k), p, c = [[*list(map(int, t.split()))] for t in open(0)]
a = -9e9
while n:
n -= 1
s, x, *l = 0, n
f = j = k
while f:
x = p[x] - 1
s += c[x]
l += (s,)
f = x != n
for t in l[:k]:
j -= 1
a = max(a, t + j // len(l) * s * (s > 0))
print(a)
| false | 0 | [
"-for i in range(n):",
"- s = f = 0",
"- x, j, *l = i, k",
"- while ~f:",
"+while n:",
"+ n -= 1",
"+ s, x, *l = 0, n",
"+ f = j = k",
"+ while f:",
"- f -= x == i",
"+ f = x != n"
] | false | 0.047657 | 0.047645 | 1.000259 | [
"s605896305",
"s713142855"
] |
u960312159 | p00111 | python | s480338421 | s860466334 | 130 | 70 | 7,428 | 7,492 | Accepted | Accepted | 46.15 | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx,'b').zfill(5))
decode = {"101" : " ", "0101" : "C", "0110" : "K", "00110" : "S",
"000000" : "'", "0001" : "D", "00100" : "L", "00111" : "T",
"000011" ... | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx,'b').zfill(5))
decode = {"101" : " ", "0101" : "C", "0110" : "K", "00110" : "S",
"000000" : "'", "0001" : "D", "00100" : "L", "00111" : "T",
"000011" ... | 32 | 31 | 1,201 | 1,120 | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx, "b").zfill(5))
decode = {
"101": " ",
"0101": "C",
"0110": "K",
"00110": "S",
"000000": "'",
"0001": "D",
"00100": "L",
"00111": "T",
"000011": ",",
"110": "E",
"1... | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx, "b").zfill(5))
decode = {
"101": " ",
"0101": "C",
"0110": "K",
"00110": "S",
"000000": "'",
"0001": "D",
"00100": "L",
"00111": "T",
"000011": ",",
"110": "E",
"1... | false | 3.125 | [
"- while len(s) > 5 or s.count(\"1\"):",
"- for key in decode:",
"- n = len(key)",
"- if s[0:n] == key:",
"- ans += decode[key]",
"- s = s[n:]",
"- break",
"+ tmp = \"\"",
"+ for c in s:",
"+ tmp += c",
"+ ... | false | 0.095246 | 0.075351 | 1.264032 | [
"s480338421",
"s860466334"
] |
u271934630 | p02831 | python | s682023249 | s797623242 | 51 | 17 | 5,560 | 3,060 | Accepted | Accepted | 66.67 | import sys
import fractions
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
A, B = list(map(int, input().split()))
print((int(A * B / fractions.gcd(A, B))))
| 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()
def gcd(a,b):
while b:
a, b = b, a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
A, B = i_l()
pri... | 7 | 19 | 166 | 333 | import sys
import fractions
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
A, B = list(map(int, input().split()))
print((int(A * B / fractions.gcd(A, B))))
| 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()
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
A, B = i_l()
print((lcm(A... | false | 63.157895 | [
"-import fractions",
"-input = sys.stdin.readline",
"+stdin = sys.stdin",
"-A, B = list(map(int, input().split()))",
"-print((int(A * B / fractions.gcd(A, B))))",
"+i_i = lambda: int(i_s())",
"+i_l = lambda: list(map(int, stdin.readline().split()))",
"+i_s = lambda: stdin.readline().rstrip()",
"+",
... | false | 0.045806 | 0.063006 | 0.727018 | [
"s682023249",
"s797623242"
] |
u340781749 | p02972 | python | s094440323 | s964565207 | 706 | 182 | 12,720 | 12,716 | Accepted | Accepted | 74.22 | n = int(eval(input()))
aaa = list(map(int, input().split()))
aaa = [0] + aaa
for i in range(n // 2, 0, -1):
b = 0
j = i * 2
while n >= j:
b ^= aaa[j]
j += i
aaa[i] ^= b
ans = [i for i, b in enumerate(aaa) if b]
print((len(ans)))
print((*ans))
| n = int(eval(input()))
a = [0] + list(map(int, input().split()))
for i in range(n // 2, 0, -1):
a[i] = sum(a[i::i]) % 2
s = [i for i, b in enumerate(a) if b]
print((len(s)))
print((*s))
| 14 | 8 | 279 | 188 | n = int(eval(input()))
aaa = list(map(int, input().split()))
aaa = [0] + aaa
for i in range(n // 2, 0, -1):
b = 0
j = i * 2
while n >= j:
b ^= aaa[j]
j += i
aaa[i] ^= b
ans = [i for i, b in enumerate(aaa) if b]
print((len(ans)))
print((*ans))
| n = int(eval(input()))
a = [0] + list(map(int, input().split()))
for i in range(n // 2, 0, -1):
a[i] = sum(a[i::i]) % 2
s = [i for i, b in enumerate(a) if b]
print((len(s)))
print((*s))
| false | 42.857143 | [
"-aaa = list(map(int, input().split()))",
"-aaa = [0] + aaa",
"+a = [0] + list(map(int, input().split()))",
"- b = 0",
"- j = i * 2",
"- while n >= j:",
"- b ^= aaa[j]",
"- j += i",
"- aaa[i] ^= b",
"-ans = [i for i, b in enumerate(aaa) if b]",
"-print((len(ans)))",
"... | false | 0.07542 | 0.03958 | 1.905503 | [
"s094440323",
"s964565207"
] |
u368796742 | p03163 | python | s766569848 | s252623031 | 452 | 226 | 118,512 | 92,548 | Accepted | Accepted | 50 | def main():
import sys
input = sys.stdin.readline
n,w = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(n)]
dp = [[0]*(w+1) for i in range(n+1)]
for i in range(1,n+1):
for j in range(w+1):
if j-l[i-1][0] >= 0:
dp[i]... | def main():
import numpy as np
import sys
input = sys.stdin.readline
n,w = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(n)]
dp = np.zeros((n+1,w+1),dtype="int64")
for i in range(n):
dp[i+1][:l[i][0]] = dp[i][:l[i][0]]
dp[i+1][... | 16 | 16 | 485 | 441 | def main():
import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
dp = [[0] * (w + 1) for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(w + 1):
if j - l[i - 1][0] >= 0:
... | def main():
import numpy as np
import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
dp = np.zeros((n + 1, w + 1), dtype="int64")
for i in range(n):
dp[i + 1][: l[i][0]] = dp[i][: l[i][0]]
dp[i + ... | false | 0 | [
"+ import numpy as np",
"- dp = [[0] * (w + 1) for i in range(n + 1)]",
"- for i in range(1, n + 1):",
"- for j in range(w + 1):",
"- if j - l[i - 1][0] >= 0:",
"- dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - l[i - 1][0]] + l[i - 1][1])",
"- else:",
"... | false | 0.041748 | 0.194847 | 0.214261 | [
"s766569848",
"s252623031"
] |
u197615397 | p02364 | python | s321502879 | s009853935 | 430 | 350 | 24,008 | 24,056 | Accepted | Accepted | 18.6 | import sys
def kruskal(v_count: int, edges: list) -> int:
tree = [-1]*v_count
def get_root(x):
if tree[x] < 0:
return x
tree[x] = get_root(tree[x])
return tree[x]
def unite(x, y):
x, y = get_root(x), get_root(y)
if x != y:
big,... | import sys
from itertools import islice
def kruskal(v_count: int, edges: list) -> int:
tree = [-1]*v_count
def get_root(x):
if tree[x] < 0:
return x
tree[x] = get_root(tree[x])
return tree[x]
def unite(a):
x, y = get_root(a[1]), get_root(a[2])
... | 28 | 28 | 781 | 756 | import sys
def kruskal(v_count: int, edges: list) -> int:
tree = [-1] * v_count
def get_root(x):
if tree[x] < 0:
return x
tree[x] = get_root(tree[x])
return tree[x]
def unite(x, y):
x, y = get_root(x), get_root(y)
if x != y:
big, small = (x... | import sys
from itertools import islice
def kruskal(v_count: int, edges: list) -> int:
tree = [-1] * v_count
def get_root(x):
if tree[x] < 0:
return x
tree[x] = get_root(tree[x])
return tree[x]
def unite(a):
x, y = get_root(a[1]), get_root(a[2])
if x !... | false | 0 | [
"+from itertools import islice",
"- def unite(x, y):",
"- x, y = get_root(x), get_root(y)",
"+ def unite(a):",
"+ x, y = get_root(a[1]), get_root(a[2])",
"- for (w, _s, _t), _ in zip(",
"- [p for p in sorted(edges) if unite(*p[1:])], list(range(v_count - 1))",
"- ):",
... | false | 0.036645 | 0.036934 | 0.992181 | [
"s321502879",
"s009853935"
] |
u183406542 | p02836 | python | s391997768 | s853284265 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S = eval(input())
l = len(S)
i = 0
cnt = 0
while i < l/2 :
if S[i] != S[l-1-i]:
cnt += 1
i += 1
print(cnt)
| S = eval(input())
l = len(S)
i = 0
hug = 0
while l/2 > i:
if S[i] != S[l-1-i]:
hug += 1
i += 1
print(hug) | 9 | 9 | 125 | 123 | S = eval(input())
l = len(S)
i = 0
cnt = 0
while i < l / 2:
if S[i] != S[l - 1 - i]:
cnt += 1
i += 1
print(cnt)
| S = eval(input())
l = len(S)
i = 0
hug = 0
while l / 2 > i:
if S[i] != S[l - 1 - i]:
hug += 1
i += 1
print(hug)
| false | 0 | [
"-cnt = 0",
"-while i < l / 2:",
"+hug = 0",
"+while l / 2 > i:",
"- cnt += 1",
"+ hug += 1",
"-print(cnt)",
"+print(hug)"
] | false | 0.038747 | 0.041045 | 0.944009 | [
"s391997768",
"s853284265"
] |
u207707177 | p03074 | python | s720725291 | s525328075 | 124 | 95 | 4,212 | 7,112 | Accepted | Accepted | 23.39 | n,k = [int(i) for i in input().split()]
s = eval(input())
if s[0] == "1":
retu = "whiteblack"
else:
retu = "blackwhite"
count = 0
pre_person = s[0]
groups = []
for i in range(n):
person = s[i]
if person != pre_person:
groups.append(count)
count = 0
pre_perso... | n,k=list(map(int, input().split()))
s=eval(input())
ruiwa = [0]
for i in range(1,len(s)):
if s[i] != s[i-1]:
ruiwa.append(i)
ruiwa.append(n)
if s[0] == "1":
ans = ruiwa[1]
if ((len(ruiwa) - 1) // 2) <= k:
ans = n
else:
for i in range(((len(ruiwa)-1)//2)-k+1):
... | 70 | 26 | 1,986 | 650 | n, k = [int(i) for i in input().split()]
s = eval(input())
if s[0] == "1":
retu = "whiteblack"
else:
retu = "blackwhite"
count = 0
pre_person = s[0]
groups = []
for i in range(n):
person = s[i]
if person != pre_person:
groups.append(count)
count = 0
pre_person = person
count ... | n, k = list(map(int, input().split()))
s = eval(input())
ruiwa = [0]
for i in range(1, len(s)):
if s[i] != s[i - 1]:
ruiwa.append(i)
ruiwa.append(n)
if s[0] == "1":
ans = ruiwa[1]
if ((len(ruiwa) - 1) // 2) <= k:
ans = n
else:
for i in range(((len(ruiwa) - 1) // 2) - k + 1):
... | false | 62.857143 | [
"-n, k = [int(i) for i in input().split()]",
"+n, k = list(map(int, input().split()))",
"+ruiwa = [0]",
"+for i in range(1, len(s)):",
"+ if s[i] != s[i - 1]:",
"+ ruiwa.append(i)",
"+ruiwa.append(n)",
"- retu = \"whiteblack\"",
"+ ans = ruiwa[1]",
"+ if ((len(ruiwa) - 1) // 2) ... | false | 0.037865 | 0.037838 | 1.000704 | [
"s720725291",
"s525328075"
] |
u197300260 | p03455 | python | s768735289 | s237263873 | 173 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.17 | # Problem
# Python 1st Try
a,b = list(map(int,input().split(' ')))
mods = (a*b)%2
answer = ''
if mods == 0:
answer = "Even"
else:
answer = "Odd"
print(answer) | # Problem https://atcoder.jp/contests/abc086/tasks/abc086_a
# Python 2nd try
yes = "Odd"
no = "Even"
if __name__ == "__main__":
a,b = list(map(int,input().split(' ')))
answer = ""
check = (a*b)%2
if check == 1:
answer = yes
else:
answer = no
print(answer) | 10 | 13 | 170 | 302 | # Problem
# Python 1st Try
a, b = list(map(int, input().split(" ")))
mods = (a * b) % 2
answer = ""
if mods == 0:
answer = "Even"
else:
answer = "Odd"
print(answer)
| # Problem https://atcoder.jp/contests/abc086/tasks/abc086_a
# Python 2nd try
yes = "Odd"
no = "Even"
if __name__ == "__main__":
a, b = list(map(int, input().split(" ")))
answer = ""
check = (a * b) % 2
if check == 1:
answer = yes
else:
answer = no
print(answer)
| false | 23.076923 | [
"-# Problem",
"-# Python 1st Try",
"-a, b = list(map(int, input().split(\" \")))",
"-mods = (a * b) % 2",
"-answer = \"\"",
"-if mods == 0:",
"- answer = \"Even\"",
"-else:",
"- answer = \"Odd\"",
"-print(answer)",
"+# Problem https://atcoder.jp/contests/abc086/tasks/abc086_a",
"+# Pytho... | false | 0.04243 | 0.035608 | 1.191576 | [
"s768735289",
"s237263873"
] |
u077291787 | p02959 | python | s918976226 | s452771818 | 146 | 116 | 19,116 | 19,244 | Accepted | Accepted | 20.55 | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = list(map(int, input().rstrip().split()))
B = tuple(map(int, input().rstrip().split()))
ans = 0
for i in range(n):
cur1 = min(A[i], B[i])
cur2 = min(A[i + 1], B[i] - cur1)
A[i] -= cur1
... | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
B = tuple(map(int, input().rstrip().split()))
ans, a1 = 0, A[0]
for a2, b in zip(A[1:], B):
cnt1 = min(a1, b)
cnt2 = min(a2, b - cnt1)
ans += ... | 18 | 17 | 427 | 439 | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = list(map(int, input().rstrip().split()))
B = tuple(map(int, input().rstrip().split()))
ans = 0
for i in range(n):
cur1 = min(A[i], B[i])
cur2 = min(A[i + 1], B[i] - cur1)
A[i] -= cur1
A[... | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
B = tuple(map(int, input().rstrip().split()))
ans, a1 = 0, A[0]
for a2, b in zip(A[1:], B):
cnt1 = min(a1, b)
cnt2 = min(a2, b - cnt1)
ans += cnt1 + cnt... | false | 5.555556 | [
"- A = list(map(int, input().rstrip().split()))",
"+ A = tuple(map(int, input().rstrip().split()))",
"- ans = 0",
"- for i in range(n):",
"- cur1 = min(A[i], B[i])",
"- cur2 = min(A[i + 1], B[i] - cur1)",
"- A[i] -= cur1",
"- A[i + 1] -= cur2",
"- ans +... | false | 0.097837 | 0.076976 | 1.271005 | [
"s918976226",
"s452771818"
] |
u991567869 | p02899 | python | s573135411 | s752153961 | 351 | 114 | 24,288 | 14,776 | Accepted | Accepted | 67.52 | n = int(input())
l = [[0]*2 for _ in range(n)]
a = list(map(int, input().split()))
for i in range(n):
l[i][0] = a[i]
l[i][1] = i
l.sort()
for i in range(n):
print(l[i][1] + 1, end=" ")
| n = int(eval(input()))
l = [0]*n
a = list(map(int, input().split()))
for i, j in enumerate(a):
l[j - 1] = i + 1
print((*l)) | 13 | 9 | 212 | 130 | n = int(input())
l = [[0] * 2 for _ in range(n)]
a = list(map(int, input().split()))
for i in range(n):
l[i][0] = a[i]
l[i][1] = i
l.sort()
for i in range(n):
print(l[i][1] + 1, end=" ")
| n = int(eval(input()))
l = [0] * n
a = list(map(int, input().split()))
for i, j in enumerate(a):
l[j - 1] = i + 1
print((*l))
| false | 30.769231 | [
"-n = int(input())",
"-l = [[0] * 2 for _ in range(n)]",
"+n = int(eval(input()))",
"+l = [0] * n",
"-for i in range(n):",
"- l[i][0] = a[i]",
"- l[i][1] = i",
"-l.sort()",
"-for i in range(n):",
"- print(l[i][1] + 1, end=\" \")",
"+for i, j in enumerate(a):",
"+ l[j - 1] = i + 1",... | false | 0.040209 | 0.042536 | 0.945292 | [
"s573135411",
"s752153961"
] |
u788137651 | p03696 | python | s843774259 | s373756900 | 170 | 89 | 38,256 | 7,812 | Accepted | Accepted | 47.65 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float, input().split()))... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | 52 | 84 | 1,283 | 2,221 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input = sys.stdin.readline
inf = float("inf")
mod = 10**9 + 7
def INT_(n):
return int(n) - 1
def MI():
return list(map(int, input().split()))
def MF():
return list(map(float, input().split... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | false | 38.095238 | [
"+sys.setrecursionlimit(10**6)",
"+from math import floor, sqrt, factorial, hypot, log # log2ないyp",
"+from heapq import heappop, heappush, heappushpop",
"+from collections import Counter, defaultdict, deque",
"+from itertools import (",
"+ accumulate,",
"+ permutations,",
"+ combinations,",
... | false | 0.037215 | 0.058643 | 0.63461 | [
"s843774259",
"s373756900"
] |
u896741788 | p03673 | python | s677685905 | s326438812 | 218 | 200 | 26,180 | 25,412 | Accepted | Accepted | 8.26 | n=int(eval(input()))
l=list(map(int,input().split()))
from collections import deque
dq=deque([])
#pop/append/(append,pop)_left/in/len/count/[]/index/rotate()(右へnずらす)
for i in range(n):
if i%2:
dq.append(l[i])
else:dq.appendleft(l[i])
print((*list(dq)[::-(-1)**(n%2)])) | from collections import deque
dq=deque([])
#pop/append/(append,pop)_left/in/len/count/[]/index/rotate()(右へnずらす)
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
if i%2:
dq.append(a[i])
else:
dq.appendleft(a[i])
print(*list(dq)[::(-1)**(n%2+1)],sep= " ")
| 10 | 11 | 285 | 305 | n = int(eval(input()))
l = list(map(int, input().split()))
from collections import deque
dq = deque([])
# pop/append/(append,pop)_left/in/len/count/[]/index/rotate()(右へnずらす)
for i in range(n):
if i % 2:
dq.append(l[i])
else:
dq.appendleft(l[i])
print((*list(dq)[:: -((-1) ** (n % 2))]))
| from collections import deque
dq = deque([])
# pop/append/(append,pop)_left/in/len/count/[]/index/rotate()(右へnずらす)
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
if i % 2:
dq.append(a[i])
else:
dq.appendleft(a[i])
print(*list(dq)[:: (-1) ** (n % 2 + 1)], sep=" ")
| false | 9.090909 | [
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"+n = int(input())",
"+a = list(map(int, input().split()))",
"- dq.append(l[i])",
"+ dq.append(a[i])",
"- dq.appendleft(l[i])",
"-print((*list(dq)[:: -((-1) ** (n % 2))]))",
"+ dq.appendleft(a[i])",
"+pr... | false | 0.169512 | 0.049589 | 3.418323 | [
"s677685905",
"s326438812"
] |
u580236524 | p02848 | python | s657397383 | s841391167 | 26 | 24 | 3,060 | 3,060 | Accepted | Accepted | 7.69 | alps = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = int(eval(input()))
s = eval(input())
ans = ''
for i in range(len(s)):
idx = alps.index(s[i])
idx += n
if 25 < idx:
idx = idx - 26
x = alps[idx]
ans += x
print(ans)
| alps = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = int(eval(input()))
s = eval(input())
ans = ''
for i in range(len(s)):
idx = (alps.index(s[i]) + n)%26
ans += alps[idx]
print(ans) | 14 | 9 | 242 | 180 | alps = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
n = int(eval(input()))
s = eval(input())
ans = ""
for i in range(len(s)):
idx = alps.index(s[i])
idx += n
if 25 < idx:
idx = idx - 26
x = alps[idx]
ans += x
print(ans)
| alps = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
n = int(eval(input()))
s = eval(input())
ans = ""
for i in range(len(s)):
idx = (alps.index(s[i]) + n) % 26
ans += alps[idx]
print(ans)
| false | 35.714286 | [
"- idx = alps.index(s[i])",
"- idx += n",
"- if 25 < idx:",
"- idx = idx - 26",
"- x = alps[idx]",
"- ans += x",
"+ idx = (alps.index(s[i]) + n) % 26",
"+ ans += alps[idx]"
] | false | 0.046958 | 0.03737 | 1.256567 | [
"s657397383",
"s841391167"
] |
u952708174 | p03038 | python | s767818024 | s976221107 | 880 | 512 | 27,884 | 40,512 | Accepted | Accepted | 41.82 | def d_integer_cards(N, M, A, Operation_info):
from bisect import bisect_left
from collections import deque
a = deque(sorted(A))
Operation_info.sort(key=lambda x: x[1], reverse=True)
tmp = []
for b, c in Operation_info:
index = bisect_left(a, c)
if index > 0:
... | def d_integer_cards(N, M, A, Operation_info):
# Aの要素は1回選ぶことができるとみなす
# 値C_iはB_i回選ぶことができるとみなす
selected_num = [[1, a] for a in A] + Operation_info
selected_num.sort(key=lambda x: x[1], reverse=True)
# 値yをx回選ぶことを、選んだ値の個数がNになるまで繰り返す
select = 0
ans = 0
for x, y in selected_num:
... | 20 | 21 | 649 | 658 | def d_integer_cards(N, M, A, Operation_info):
from bisect import bisect_left
from collections import deque
a = deque(sorted(A))
Operation_info.sort(key=lambda x: x[1], reverse=True)
tmp = []
for b, c in Operation_info:
index = bisect_left(a, c)
if index > 0:
for j in... | def d_integer_cards(N, M, A, Operation_info):
# Aの要素は1回選ぶことができるとみなす
# 値C_iはB_i回選ぶことができるとみなす
selected_num = [[1, a] for a in A] + Operation_info
selected_num.sort(key=lambda x: x[1], reverse=True)
# 値yをx回選ぶことを、選んだ値の個数がNになるまで繰り返す
select = 0
ans = 0
for x, y in selected_num:
select ... | false | 4.761905 | [
"- from bisect import bisect_left",
"- from collections import deque",
"-",
"- a = deque(sorted(A))",
"- Operation_info.sort(key=lambda x: x[1], reverse=True)",
"- tmp = []",
"- for b, c in Operation_info:",
"- index = bisect_left(a, c)",
"- if index > 0:",
"- ... | false | 0.038097 | 0.036722 | 1.03744 | [
"s767818024",
"s976221107"
] |
u391731808 | p03829 | python | s091364189 | s758926429 | 96 | 87 | 14,224 | 14,480 | Accepted | Accepted | 9.38 | N,A,B=list(map(int,input().split()))
*X,=list(map(int,input().split()))
ans = 0
for i in range(N-1):
ans += min(B,A*(X[i+1]-X[i]))
print(ans) | m=lambda:list(map(int,input().split()))
N,A,B=m();*X,=m()
print((sum(min(B,A*(X[i+1]-X[i]))for i in range(N-1)))) | 6 | 3 | 138 | 107 | N, A, B = list(map(int, input().split()))
(*X,) = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
ans += min(B, A * (X[i + 1] - X[i]))
print(ans)
| m = lambda: list(map(int, input().split()))
N, A, B = m()
(*X,) = m()
print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1))))
| false | 50 | [
"-N, A, B = list(map(int, input().split()))",
"-(*X,) = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(N - 1):",
"- ans += min(B, A * (X[i + 1] - X[i]))",
"-print(ans)",
"+m = lambda: list(map(int, input().split()))",
"+N, A, B = m()",
"+(*X,) = m()",
"+print((sum(min(B, A * (X[... | false | 0.037936 | 0.036803 | 1.030803 | [
"s091364189",
"s758926429"
] |
u352394527 | p00502 | python | s550188389 | s483952130 | 670 | 590 | 6,168 | 6,176 | Accepted | Accepted | 11.94 | INF = 10 ** 20
def main():
d, n = list(map(int,input().split()))
temp = [int(eval(input())) for i in range(d)]
temp.insert(0,0)
alst = []
blst = []
clst = []
for i in range(n):
a,b,c = list(map(int,input().split()))
alst.append(a)
blst.append(b)
clst.append(c)
dp = [[0] ... | INF = 10 ** 20
def main():
d, n = list(map(int,input().split()))
temp = [int(eval(input())) for i in range(d)]
temp.insert(0,0)
alst = []
blst = []
clst = []
for i in range(n):
a,b,c = list(map(int,input().split()))
alst.append(a)
blst.append(b)
clst.append(c)
... | 32 | 45 | 725 | 885 | INF = 10**20
def main():
d, n = list(map(int, input().split()))
temp = [int(eval(input())) for i in range(d)]
temp.insert(0, 0)
alst = []
blst = []
clst = []
for i in range(n):
a, b, c = list(map(int, input().split()))
alst.append(a)
blst.append(b)
clst.appe... | INF = 10**20
def main():
d, n = list(map(int, input().split()))
temp = [int(eval(input())) for i in range(d)]
temp.insert(0, 0)
alst = []
blst = []
clst = []
for i in range(n):
a, b, c = list(map(int, input().split()))
alst.append(a)
blst.append(b)
clst.appe... | false | 28.888889 | [
"- dp[i][j] = max(",
"- predp[x] + (cj - clst[x] if cj >= clst[x] else clst[x] - cj)",
"- for x in range(n)",
"- )",
"+ save = 0",
"+ for x in range(n):",
"+ cx = clst[x]",
"+ ... | false | 0.039151 | 0.045245 | 0.86531 | [
"s550188389",
"s483952130"
] |
u994988729 | p02804 | python | s740131285 | s263287303 | 339 | 184 | 14,416 | 15,568 | Accepted | Accepted | 45.72 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
mod = 10**9+7
fac = [i for i in range(N + 1)]
for i in range(2, N + 1):
fac[i] *= fac[i - 1]
fac[i] %= mod
fac[0] = 1
fk = pow(fac[K - 1], mod-2, mod)
ans = 0
for i in range(N - K + 1):
f = a[-(i + 1)] - a[... | class Combination:
"""
SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
使い方:
comb = Combination(SIZE, MOD)
comb(10, 3) => 120
"""
def __init__(self, N, MOD=10 ** 9 + 7):
self.MOD = MOD
self.fact, self.inv = self._make_factorial_list(N)
def __call__(self, n, k):
if... | 21 | 46 | 436 | 1,215 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
mod = 10**9 + 7
fac = [i for i in range(N + 1)]
for i in range(2, N + 1):
fac[i] *= fac[i - 1]
fac[i] %= mod
fac[0] = 1
fk = pow(fac[K - 1], mod - 2, mod)
ans = 0
for i in range(N - K + 1):
f = a[-(i + 1)] - a[i]
nCr = f... | class Combination:
"""
SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
使い方:
comb = Combination(SIZE, MOD)
comb(10, 3) => 120
"""
def __init__(self, N, MOD=10**9 + 7):
self.MOD = MOD
self.fact, self.inv = self._make_factorial_list(N)
def __call__(self, n, k):
if k < 0 or k > n... | false | 54.347826 | [
"-N, K = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-a.sort()",
"-mod = 10**9 + 7",
"-fac = [i for i in range(N + 1)]",
"-for i in range(2, N + 1):",
"- fac[i] *= fac[i - 1]",
"- fac[i] %= mod",
"-fac[0] = 1",
"-fk = pow(fac[K - 1], mod - 2, mod)",
"-ans = 0... | false | 0.040145 | 0.056158 | 0.714872 | [
"s740131285",
"s263287303"
] |
u727148417 | p02695 | python | s511065907 | s338195573 | 1,500 | 1,000 | 9,204 | 9,176 | Accepted | Accepted | 33.33 | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
ABCD = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for x in combinations_with_replacement(list(range(M)), N):
temp = 0
for i in range(Q):
if x[ABCD[i][1]-1]+1 == x[ABCD[i][0]-1]+1 + A... | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
ABCD = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for A in combinations_with_replacement(list(range(M)), N):
temp = 0
for abcd in ABCD:
if A[abcd[1]-1]+1 == A[abcd[0]-1]+1 + abcd[2]:... | 14 | 14 | 402 | 389 | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
ABCD = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for x in combinations_with_replacement(list(range(M)), N):
temp = 0
for i in range(Q):
if x[ABCD[i][1] - 1] + 1 == x[ABCD[i][0] - 1] + 1 + ABC... | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
ABCD = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for A in combinations_with_replacement(list(range(M)), N):
temp = 0
for abcd in ABCD:
if A[abcd[1] - 1] + 1 == A[abcd[0] - 1] + 1 + abcd[2]:
... | false | 0 | [
"-for x in combinations_with_replacement(list(range(M)), N):",
"+for A in combinations_with_replacement(list(range(M)), N):",
"- for i in range(Q):",
"- if x[ABCD[i][1] - 1] + 1 == x[ABCD[i][0] - 1] + 1 + ABCD[i][2]:",
"- temp += ABCD[i][3]",
"+ for abcd in ABCD:",
"+ if A... | false | 0.099009 | 0.085096 | 1.163502 | [
"s511065907",
"s338195573"
] |
u668503853 | p03592 | python | s087180938 | s840950001 | 339 | 17 | 3,060 | 2,940 | Accepted | Accepted | 94.99 | N,M,K=list(map(int,input().split()))
for n in range(0,N+1):
for m in range(0,M+1):
if n*M+m*N-2*n*m==K:
print("Yes")
exit(0)
print("No") | N,M,K=list(map(int,input().split()))
ans="No"
for x in range(N+1):
a=K-x*M
b=N-2*x
if b!=0 and a%b==0 and 0<=a//b<M:
print("Yes")
exit()
print("No") | 7 | 9 | 154 | 164 | N, M, K = list(map(int, input().split()))
for n in range(0, N + 1):
for m in range(0, M + 1):
if n * M + m * N - 2 * n * m == K:
print("Yes")
exit(0)
print("No")
| N, M, K = list(map(int, input().split()))
ans = "No"
for x in range(N + 1):
a = K - x * M
b = N - 2 * x
if b != 0 and a % b == 0 and 0 <= a // b < M:
print("Yes")
exit()
print("No")
| false | 22.222222 | [
"-for n in range(0, N + 1):",
"- for m in range(0, M + 1):",
"- if n * M + m * N - 2 * n * m == K:",
"- print(\"Yes\")",
"- exit(0)",
"+ans = \"No\"",
"+for x in range(N + 1):",
"+ a = K - x * M",
"+ b = N - 2 * x",
"+ if b != 0 and a % b == 0 and 0 <= a //... | false | 0.130563 | 0.031884 | 4.094941 | [
"s087180938",
"s840950001"
] |
u113971909 | p02795 | python | s076715128 | s793601178 | 22 | 17 | 3,064 | 2,940 | Accepted | Accepted | 22.73 | H = int(eval(input()))
W = int(eval(input()))
N = int(eval(input()))
HW =H*W
ans =H+W
for h in range(0,H+1):
for w in range(0,W+1):
cntB = HW - (H-h)*(W-w)
if cntB>=N:
ans = min(ans, h+w)
print(ans) | h,w,n=int(eval(input())),int(eval(input())),int(eval(input()))
a=max(h,w)
print(((n+a-1)//a))
| 11 | 4 | 222 | 78 | H = int(eval(input()))
W = int(eval(input()))
N = int(eval(input()))
HW = H * W
ans = H + W
for h in range(0, H + 1):
for w in range(0, W + 1):
cntB = HW - (H - h) * (W - w)
if cntB >= N:
ans = min(ans, h + w)
print(ans)
| h, w, n = int(eval(input())), int(eval(input())), int(eval(input()))
a = max(h, w)
print(((n + a - 1) // a))
| false | 63.636364 | [
"-H = int(eval(input()))",
"-W = int(eval(input()))",
"-N = int(eval(input()))",
"-HW = H * W",
"-ans = H + W",
"-for h in range(0, H + 1):",
"- for w in range(0, W + 1):",
"- cntB = HW - (H - h) * (W - w)",
"- if cntB >= N:",
"- ans = min(ans, h + w)",
"-print(ans)",... | false | 0.077263 | 0.035099 | 2.201282 | [
"s076715128",
"s793601178"
] |
u886633618 | p03003 | python | s174539709 | s626101085 | 1,621 | 329 | 119,644 | 42,332 | Accepted | Accepted | 79.7 | import copy
N, M = list(map(int, input().split()))
S_array = list(map(int, input().split()))
T_array = list(map(int, input().split()))
mod = 10**9 + 7
add_num_array = [0] * N
ans_array = [0] * (N + 1)
ans_old = [1] * (N + 1)
for t in T_array:
ans_array[0] = 1
for i, s in enumerate(S_array):
... | N, M = list(map(int, input().split()))
S_array = list(map(int, input().split()))
T_array = list(map(int, input().split()))
mod = 10**9 + 7
add_num_array = [0] * N
ans_array = [0] * (N + 1)
ans_old = [1] * (N + 1)
for t in T_array:
ans_array = [1] * (N+1)
for i, s in enumerate(S_array):
i... | 20 | 19 | 553 | 510 | import copy
N, M = list(map(int, input().split()))
S_array = list(map(int, input().split()))
T_array = list(map(int, input().split()))
mod = 10**9 + 7
add_num_array = [0] * N
ans_array = [0] * (N + 1)
ans_old = [1] * (N + 1)
for t in T_array:
ans_array[0] = 1
for i, s in enumerate(S_array):
if s == t:
... | N, M = list(map(int, input().split()))
S_array = list(map(int, input().split()))
T_array = list(map(int, input().split()))
mod = 10**9 + 7
add_num_array = [0] * N
ans_array = [0] * (N + 1)
ans_old = [1] * (N + 1)
for t in T_array:
ans_array = [1] * (N + 1)
for i, s in enumerate(S_array):
if s == t:
... | false | 5 | [
"-import copy",
"-",
"- ans_array[0] = 1",
"+ ans_array = [1] * (N + 1)",
"- ans_old = copy.deepcopy(ans_array)",
"- # print(ans_array)",
"+ ans_old = ans_array"
] | false | 0.093161 | 0.037148 | 2.507791 | [
"s174539709",
"s626101085"
] |
u189487046 | p02659 | python | s930534934 | s695179546 | 26 | 24 | 10,080 | 10,004 | Accepted | Accepted | 7.69 | import math
from decimal import Decimal, getcontext
getcontext().prec = 100
A, B = input().split()
a = int(A)
b = Decimal(B)
print((math.floor(a*b)))
| import math
from decimal import Decimal, getcontext
A, B = input().split()
a = int(A)
b = Decimal(B)
print((math.floor(a*b)))
| 8 | 7 | 157 | 132 | import math
from decimal import Decimal, getcontext
getcontext().prec = 100
A, B = input().split()
a = int(A)
b = Decimal(B)
print((math.floor(a * b)))
| import math
from decimal import Decimal, getcontext
A, B = input().split()
a = int(A)
b = Decimal(B)
print((math.floor(a * b)))
| false | 12.5 | [
"-getcontext().prec = 100"
] | false | 0.040841 | 0.046733 | 0.873913 | [
"s930534934",
"s695179546"
] |
u738898077 | p02609 | python | s706351695 | s726297215 | 1,466 | 1,267 | 109,976 | 112,716 | Accepted | Accepted | 13.57 | n = int(eval(input()))
x = int(eval(input()),2)
# b = int(2**(n-1))
pc = 0
d = []
c = x
for i in range(n):
d.append(c&1)
if c&1 == 1:
pc += 1
c=c>>1
mp = x%(pc+1)
if pc == 1:
mm = -1
else:
mm = x%(pc-1)
# print(x,pc,mp,mm)
for i in range(n):
if d[-i-1]==0:
m... | n = int(eval(input()))
x = int(eval(input()),2)
pc = 0
d = []
c = x
for i in range(n):
d.append(c&1)
if c&1 == 1:
pc += 1
c=c>>1
mp = x%(pc+1)
if pc == 1:
mm = -1
else:
mm = x%(pc-1)
for i in range(n):
if d[-i-1]==0:
temp = (mp+pow(2,n-i-1,pc+1)) % (pc+1)
... | 63 | 38 | 1,326 | 741 | n = int(eval(input()))
x = int(eval(input()), 2)
# b = int(2**(n-1))
pc = 0
d = []
c = x
for i in range(n):
d.append(c & 1)
if c & 1 == 1:
pc += 1
c = c >> 1
mp = x % (pc + 1)
if pc == 1:
mm = -1
else:
mm = x % (pc - 1)
# print(x,pc,mp,mm)
for i in range(n):
if d[-i - 1] == 0:
m ... | n = int(eval(input()))
x = int(eval(input()), 2)
pc = 0
d = []
c = x
for i in range(n):
d.append(c & 1)
if c & 1 == 1:
pc += 1
c = c >> 1
mp = x % (pc + 1)
if pc == 1:
mm = -1
else:
mm = x % (pc - 1)
for i in range(n):
if d[-i - 1] == 0:
temp = (mp + pow(2, n - i - 1, pc + 1)) % ... | false | 39.68254 | [
"-# b = int(2**(n-1))",
"-# print(x,pc,mp,mm)",
"- m = 1",
"- m = -1",
"- # temppc = pc+m",
"- # temp = x^b",
"- # ans = 1",
"- # print(temp)",
"- # print(temp,mm,pc,pow(2,n-i,pc+1),(mm-pow(2,n-i-1,pc+1)) % (pc-1))",
"- # print(temp)",
"- # print(i,... | false | 0.044786 | 0.040292 | 1.111548 | [
"s706351695",
"s726297215"
] |
u952656646 | p03160 | python | s538821483 | s273074701 | 181 | 147 | 13,980 | 13,928 | Accepted | Accepted | 18.78 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')]*len(h)
dp[0] = 0
for i in range(N-1):
if i<N-2:
dp[i+2] = min(dp[i]+abs(h[i]-h[i+2]), dp[i+2])
dp[i+1] = min(dp[i]+abs(h[i]-h[i+1]), dp[i+1])
print((dp[-1])) | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf') for _ in range(N)]
dp[0] = 0
dp[1] = dp[0]+abs(h[0]-h[1])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 9 | 8 | 252 | 240 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * len(h)
dp[0] = 0
for i in range(N - 1):
if i < N - 2:
dp[i + 2] = min(dp[i] + abs(h[i] - h[i + 2]), dp[i + 2])
dp[i + 1] = min(dp[i] + abs(h[i] - h[i + 1]), dp[i + 1])
print((dp[-1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
dp[1] = dp[0] + abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 11.111111 | [
"-dp = [float(\"inf\")] * len(h)",
"+dp = [float(\"inf\") for _ in range(N)]",
"-for i in range(N - 1):",
"- if i < N - 2:",
"- dp[i + 2] = min(dp[i] + abs(h[i] - h[i + 2]), dp[i + 2])",
"- dp[i + 1] = min(dp[i] + abs(h[i] - h[i + 1]), dp[i + 1])",
"+dp[1] = dp[0] + abs(h[0] - h[1])",
"+f... | false | 0.041412 | 0.115574 | 0.358319 | [
"s538821483",
"s273074701"
] |
u145231176 | p02690 | python | s887147837 | s943644519 | 71 | 63 | 65,848 | 65,460 | Accepted | Accepted | 11.27 | import math
x = int(eval(input()))
def f(a, b):
return (a ** 5) - (b ** 5)
sele = math.floor(x ** (1/4))
for j in range(-sele, sele + 1):
for k in range(-sele, sele + 1):
if f(j, k) == x:
print((j, k))
exit() | import math
x = int(eval(input()))
def f(a, b):
return a ** 5 - b ** 5
def make_divisors(n):
divisors = []
for i in range(1, int(math.sqrt(n)) + 1):
if n % i == 0:
divisors.append(i)
# √nで無い数についてもう一個プラス
if i != n // i:
divisors.append(... | 13 | 26 | 255 | 622 | import math
x = int(eval(input()))
def f(a, b):
return (a**5) - (b**5)
sele = math.floor(x ** (1 / 4))
for j in range(-sele, sele + 1):
for k in range(-sele, sele + 1):
if f(j, k) == x:
print((j, k))
exit()
| import math
x = int(eval(input()))
def f(a, b):
return a**5 - b**5
def make_divisors(n):
divisors = []
for i in range(1, int(math.sqrt(n)) + 1):
if n % i == 0:
divisors.append(i)
# √nで無い数についてもう一個プラス
if i != n // i:
divisors.append(n // i)
... | false | 50 | [
"- return (a**5) - (b**5)",
"+ return a**5 - b**5",
"+def make_divisors(n):",
"+ divisors = []",
"+ for i in range(1, int(math.sqrt(n)) + 1):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"+ # √nで無い数についてもう一個プラス",
"+ if i != n // i:",
"+ ... | false | 0.048228 | 0.04836 | 0.997286 | [
"s887147837",
"s943644519"
] |
u840579553 | p04045 | python | s916767224 | s121556806 | 254 | 220 | 14,176 | 15,704 | Accepted | Accepted | 13.39 | import sys
import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bise... | import sys
import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bise... | 66 | 62 | 2,150 | 2,129 | import sys
import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect impor... | import sys
import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect impor... | false | 6.060606 | [
"- n, k = input().split()",
"+ n, m = list(map(str, input().split()))",
"- if i in d:",
"- continue",
"- else:",
"- use.append(i)",
"- flag = False",
"- for i in range(int(n), 10 * int(n) + 1):",
"- number = str(i)",
"- for j in range(l... | false | 0.042202 | 0.041641 | 1.013478 | [
"s916767224",
"s121556806"
] |
u644907318 | p03611 | python | s359595420 | s037598815 | 117 | 104 | 92,724 | 98,352 | Accepted | Accepted | 11.11 | N = int(eval(input()))
A = list(map(int,input().split()))
C = {}
for i in range(N):
if A[i] not in C:
C[A[i]] = 0
C[A[i]] += 1
cmax = 0
for a in A:
cnt = C[a]
if a-1 in C:
cnt += C[a-1]
if a+1 in C:
cnt += C[a+1]
cmax = max(cmax,cnt)
print(cmax) | N = int(eval(input()))
A = list(map(int,input().split()))
C = {i:0 for i in range(0,10**5)}
for i in range(N):
C[A[i]] += 1
cmax = 0
for x in range(1,10**5-1):
cnt = C[x]+C[x-1]+C[x+1]
cmax = max(cmax,cnt)
print(cmax) | 16 | 10 | 302 | 232 | N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
for i in range(N):
if A[i] not in C:
C[A[i]] = 0
C[A[i]] += 1
cmax = 0
for a in A:
cnt = C[a]
if a - 1 in C:
cnt += C[a - 1]
if a + 1 in C:
cnt += C[a + 1]
cmax = max(cmax, cnt)
print(cmax)
| N = int(eval(input()))
A = list(map(int, input().split()))
C = {i: 0 for i in range(0, 10**5)}
for i in range(N):
C[A[i]] += 1
cmax = 0
for x in range(1, 10**5 - 1):
cnt = C[x] + C[x - 1] + C[x + 1]
cmax = max(cmax, cnt)
print(cmax)
| false | 37.5 | [
"-C = {}",
"+C = {i: 0 for i in range(0, 10**5)}",
"- if A[i] not in C:",
"- C[A[i]] = 0",
"-for a in A:",
"- cnt = C[a]",
"- if a - 1 in C:",
"- cnt += C[a - 1]",
"- if a + 1 in C:",
"- cnt += C[a + 1]",
"+for x in range(1, 10**5 - 1):",
"+ cnt = C[x] + C[x... | false | 0.039359 | 0.186694 | 0.21082 | [
"s359595420",
"s037598815"
] |
u952708174 | p02708 | python | s148480803 | s320505496 | 68 | 20 | 9,184 | 9,172 | Accepted | Accepted | 70.59 | def d_sum_of_large_numbers(MOD=10**9 + 7):
N, K = [int(i) for i in input().split()]
ans = 0
for k in range(K, N + 2):
tmp = 1 - k * (k - 1)
ans += k * N + tmp
ans %= MOD
return ans
print((d_sum_of_large_numbers())) | def d_sum_of_large_numbers(MOD=10**9 + 7):
N, K = [int(i) for i in input().split()]
return (N + 2 - K) * (N**2 + (K + 1) * N - 2 * K**2 + 2 * K + 6) // 6 % MOD
print((d_sum_of_large_numbers())) | 11 | 5 | 264 | 204 | def d_sum_of_large_numbers(MOD=10**9 + 7):
N, K = [int(i) for i in input().split()]
ans = 0
for k in range(K, N + 2):
tmp = 1 - k * (k - 1)
ans += k * N + tmp
ans %= MOD
return ans
print((d_sum_of_large_numbers()))
| def d_sum_of_large_numbers(MOD=10**9 + 7):
N, K = [int(i) for i in input().split()]
return (N + 2 - K) * (N**2 + (K + 1) * N - 2 * K**2 + 2 * K + 6) // 6 % MOD
print((d_sum_of_large_numbers()))
| false | 54.545455 | [
"- ans = 0",
"- for k in range(K, N + 2):",
"- tmp = 1 - k * (k - 1)",
"- ans += k * N + tmp",
"- ans %= MOD",
"- return ans",
"+ return (N + 2 - K) * (N**2 + (K + 1) * N - 2 * K**2 + 2 * K + 6) // 6 % MOD"
] | false | 0.059109 | 0.006667 | 8.866373 | [
"s148480803",
"s320505496"
] |
u766684188 | p02847 | python | s730913087 | s332453493 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | d={'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
print((d[input().strip()])) | d={'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
print((d[eval(input())])) | 2 | 2 | 86 | 78 | d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
print((d[input().strip()]))
| d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
print((d[eval(input())]))
| false | 0 | [
"-print((d[input().strip()]))",
"+print((d[eval(input())]))"
] | false | 0.049287 | 0.079193 | 0.62236 | [
"s730913087",
"s332453493"
] |
u562935282 | p03330 | python | s682498147 | s773129332 | 969 | 186 | 7,540 | 5,876 | Accepted | Accepted | 80.8 | n, c = list(map(int, input().split()))
arrD = list(list(map(int, input().split())) for i in range(c))
arrC = list(list(map(int, input().split())) for i in range(n))
##剰余r=0,1,2で、
##色の出現数を確認する -> いずれかの色に統一する
##どの色に統一するか全パターンを実施して、違和感を算出
##和を取る
## arrCCnt[r][c]: 剰余rグループにおける初期色cのマス数
arrCCnt = []
... | #次のコードを改変した
#https://abc099.contest.atcoder.jp/submissions/2657877
#リストの内包表記を自分でも分かる書き方に直した
from itertools import product
from collections import Counter
n, c = list(map(int, input().split()))
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ ... | 32 | 28 | 1,015 | 1,046 | n, c = list(map(int, input().split()))
arrD = list(list(map(int, input().split())) for i in range(c))
arrC = list(list(map(int, input().split())) for i in range(n))
##剰余r=0,1,2で、
##色の出現数を確認する -> いずれかの色に統一する
##どの色に統一するか全パターンを実施して、違和感を算出
##和を取る
## arrCCnt[r][c]: 剰余rグループにおける初期色cのマス数
arrCCnt = []
for r in range(3):
arr... | # 次のコードを改変した
# https://abc099.contest.atcoder.jp/submissions/2657877
# リストの内包表記を自分でも分かる書き方に直した
from itertools import product
from collections import Counter
n, c = list(map(int, input().split()))
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ in range(... | false | 12.5 | [
"+# 次のコードを改変した",
"+# https://abc099.contest.atcoder.jp/submissions/2657877",
"+# リストの内包表記を自分でも分かる書き方に直した",
"+from itertools import product",
"+from collections import Counter",
"+",
"-arrD = list(list(map(int, input().split())) for i in range(c))",
"-arrC = list(list(map(int, input().split())) for i i... | false | 0.147699 | 0.061527 | 2.400574 | [
"s682498147",
"s773129332"
] |
u693048766 | p02571 | python | s650028091 | s682032507 | 45 | 41 | 9,144 | 9,024 | Accepted | Accepted | 8.89 | s=eval(input())
t=eval(input())
s=list(s)
t=list(t)
size = len(t)
ms = []
for i in range(len(s)-size+1):
# print(s[i:i+size])
m = sum([a==b for a,b in zip(s[i:i+size], t)])
ms.append(m)
print((size - max(ms))) |
... | 13 | 16 | 221 | 2,307 | s = eval(input())
t = eval(input())
s = list(s)
t = list(t)
size = len(t)
ms = []
for i in range(len(s) - size + 1):
# print(s[i:i+size])
m = sum([a == b for a, b in zip(s[i : i + size], t)])
ms.append(m)
print((size - max(ms)))
| S = list(eval(input()))
T = list(eval(input()))
T_size = len(T)
def match_num(x):
return T_size - sum([1 for a, t in zip(x, T) if a == t])
b = []
for i in range(len(S) - T_size + 1):
b.append(match_num(S[i : i + T_size]))
print((min(b)))
| false | 18.75 | [
"-s = eval(input())",
"-t = eval(input())",
"-s = list(s)",
"-t = list(t)",
"-size = len(t)",
"-ms = []",
"-for i in range(len(s) - size + 1):",
"- # print(s[i:i+size])",
"- m = sum([a == b for a, b in zip(s[i : i + size], t)])",
"- ms.append(m)",
"-print((size - max(ms)))",
"+S = lis... | false | 0.040908 | 0.077858 | 0.525414 | [
"s650028091",
"s682032507"
] |
u638456847 | p02713 | python | s650361975 | s664038553 | 1,313 | 507 | 9,184 | 67,836 | Accepted | Accepted | 61.39 | from math import gcd
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
K = int(readline())
ans = 0
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
ans += gcd(gcd(i, j), k)
... | from math import gcd
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
K = int(readline())
ans = 0
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
ans += gcd(gcd(i, j), k)
print(ans) | 20 | 15 | 375 | 277 | from math import gcd
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
K = int(readline())
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(... | from math import gcd
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
K = int(readline())
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(ans)
| false | 25 | [
"-",
"-",
"-def main():",
"- K = int(readline())",
"- ans = 0",
"- for i in range(1, K + 1):",
"- for j in range(1, K + 1):",
"- for k in range(1, K + 1):",
"- ans += gcd(gcd(i, j), k)",
"- print(ans)",
"-",
"-",
"-if __name__ == \"__main__\":",
... | false | 0.006748 | 0.175176 | 0.038523 | [
"s650361975",
"s664038553"
] |
u811967730 | p02787 | python | s882509900 | s039616623 | 1,686 | 732 | 3,672 | 42,588 | Accepted | Accepted | 56.58 | import sys
input = sys.stdin.readline
H, N = list(map(int, input().split()))
magic = [list(map(int, input().split())) for _ in range(N)]
max_damage = max(damage for damage, cost in magic)
dp = [0] * (H + max_damage)
for x in range(1, H + max_damage):
dp[x] = min(dp[x - damage] + cost for damage, cost i... | import sys
input = sys.stdin.readline
H, N = list(map(int, input().split()))
magic = [list(map(int, input().split())) for _ in range(N)]
dp = [0] * (H + 1)
for i in range(1, H + 1):
dp[i] = min(dp[max(i - damage, 0)] + cost for damage, cost in magic)
ans = dp[H]
print(ans)
| 15 | 14 | 358 | 290 | import sys
input = sys.stdin.readline
H, N = list(map(int, input().split()))
magic = [list(map(int, input().split())) for _ in range(N)]
max_damage = max(damage for damage, cost in magic)
dp = [0] * (H + max_damage)
for x in range(1, H + max_damage):
dp[x] = min(dp[x - damage] + cost for damage, cost in magic)
ans... | import sys
input = sys.stdin.readline
H, N = list(map(int, input().split()))
magic = [list(map(int, input().split())) for _ in range(N)]
dp = [0] * (H + 1)
for i in range(1, H + 1):
dp[i] = min(dp[max(i - damage, 0)] + cost for damage, cost in magic)
ans = dp[H]
print(ans)
| false | 6.666667 | [
"-max_damage = max(damage for damage, cost in magic)",
"-dp = [0] * (H + max_damage)",
"-for x in range(1, H + max_damage):",
"- dp[x] = min(dp[x - damage] + cost for damage, cost in magic)",
"-ans = min(dp[H:])",
"+dp = [0] * (H + 1)",
"+for i in range(1, H + 1):",
"+ dp[i] = min(dp[max(i - dam... | false | 0.079426 | 0.05782 | 1.373672 | [
"s882509900",
"s039616623"
] |
u238940874 | p02773 | python | s415241718 | s561433587 | 657 | 556 | 35,852 | 37,612 | Accepted | Accepted | 15.37 | from collections import Counter
n=int(input())
s=tuple(input() for i in range(n))
count=Counter(s)
max=max(count.values())
ans=[key for key in count if count[key]==max]
ans.sort()
print(*ans,sep='\n')
| from collections import Counter
n=int(eval(input()))
s=[]
for i in range(n):
s.append(eval(input()))
c=Counter(s)
max=max(c.values())
ans=[]
for i,j in list(c.items()):
if j == max:
ans.append(i)
ans=sorted(ans)
print(('\n'.join(ans))) | 11 | 15 | 213 | 247 | from collections import Counter
n = int(input())
s = tuple(input() for i in range(n))
count = Counter(s)
max = max(count.values())
ans = [key for key in count if count[key] == max]
ans.sort()
print(*ans, sep="\n")
| from collections import Counter
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
c = Counter(s)
max = max(c.values())
ans = []
for i, j in list(c.items()):
if j == max:
ans.append(i)
ans = sorted(ans)
print(("\n".join(ans)))
| false | 26.666667 | [
"-n = int(input())",
"-s = tuple(input() for i in range(n))",
"-count = Counter(s)",
"-max = max(count.values())",
"-ans = [key for key in count if count[key] == max]",
"-ans.sort()",
"-print(*ans, sep=\"\\n\")",
"+n = int(eval(input()))",
"+s = []",
"+for i in range(n):",
"+ s.append(eval(in... | false | 0.044936 | 0.15113 | 0.297337 | [
"s415241718",
"s561433587"
] |
u163529815 | p02787 | python | s814619585 | s850181788 | 492 | 351 | 53,212 | 43,228 | Accepted | Accepted | 28.66 | H, N= list(map(int,input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
a = A[i]
b = B[i]
for j in range(1, H + ma):
dp[j] = min(dp[j - a] + b, dp[j])
print((... | H, N= list(map(int,input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
ma = max(A)
dp = [0] * (H + ma)
dp[0] = 0
for i in range(N):
a = A[i]
b = B[i]
for j in range(1, H + ma):
if dp[j] == 0:
dp[j] = dp[j - a] + b
... | 15 | 17 | 322 | 387 | H, N = list(map(int, input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
a = A[i]
b = B[i]
for j in range(1, H + ma):
dp[j] = min(dp[j - a] + b, dp[j])
print((min(dp[H:])... | H, N = list(map(int, input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
ma = max(A)
dp = [0] * (H + ma)
dp[0] = 0
for i in range(N):
a = A[i]
b = B[i]
for j in range(1, H + ma):
if dp[j] == 0:
dp[j] = dp[j - a] + b
else:
... | false | 11.764706 | [
"-dp = [float(\"inf\")] * (H + ma)",
"+dp = [0] * (H + ma)",
"- dp[j] = min(dp[j - a] + b, dp[j])",
"+ if dp[j] == 0:",
"+ dp[j] = dp[j - a] + b",
"+ else:",
"+ dp[j] = min(dp[j - a] + b, dp[j])"
] | false | 0.118922 | 0.122755 | 0.968777 | [
"s814619585",
"s850181788"
] |
u983918956 | p03166 | python | s603462758 | s899762927 | 410 | 379 | 59,016 | 67,200 | Accepted | Accepted | 7.56 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N,M = list(map(int,input().split()))
ad = [[] for i in range(N)]
for _ in range(M):
x,y = list(map(int,input().split()))
x -= 1; y -= 1
ad[x].append(y)
dp = [-1]*N
def rec(nodes):
if dp[nodes] != -1:
return dp[n... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N,M = list(map(int,input().split()))
ad = [[] for i in range(N)]
for _ in range(M):
x,y = list(map(int,input().split()))
x -= 1; y -= 1
ad[x].append(y)
dp = [-1]*N
def ... | 30 | 33 | 574 | 705 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, M = list(map(int, input().split()))
ad = [[] for i in range(N)]
for _ in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
ad[x].append(y)
dp = [-1] * N
def rec(nodes):
if dp[nodes] != -1:
return dp[nodes]
... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, M = list(map(int, input().split()))
ad = [[] for i in range(N)]
for _ in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
ad[x].append(y)
dp = [-1] * N
def re... | false | 9.090909 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**6)",
"-N, M = list(map(int, input().split()))",
"-ad = [[] for i in range(N)]",
"-for _ in range(M):",
"- x, y = list(map(int, input().split()))",
"- x -= 1",
"- y -= 1",
"- ... | false | 0.04386 | 0.118826 | 0.369113 | [
"s603462758",
"s899762927"
] |
u060938295 | p03107 | python | s591189902 | s759458473 | 95 | 18 | 4,212 | 3,188 | Accepted | Accepted | 81.05 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 3 19:52:53 2019
@author: Yamazaki Kenichi
"""
from collections import deque
S = eval(input())
ans = 0
q=deque([' '])
for c in S:
tmp = q.pop()
s = tmp+c
if s.count('0') >= 1 and s.count('1') >= 1:
ans += 2
else:
q.appen... | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 3 19:52:53 2019
@author: Yamazaki Kenichi
"""
S = eval(input())
print((2*min(S.count('0'),S.count('1')))) | 21 | 8 | 353 | 153 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 3 19:52:53 2019
@author: Yamazaki Kenichi
"""
from collections import deque
S = eval(input())
ans = 0
q = deque([" "])
for c in S:
tmp = q.pop()
s = tmp + c
if s.count("0") >= 1 and s.count("1") >= 1:
ans += 2
else:
q.append(tmp)
q... | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 3 19:52:53 2019
@author: Yamazaki Kenichi
"""
S = eval(input())
print((2 * min(S.count("0"), S.count("1"))))
| false | 61.904762 | [
"-from collections import deque",
"-",
"-ans = 0",
"-q = deque([\" \"])",
"-for c in S:",
"- tmp = q.pop()",
"- s = tmp + c",
"- if s.count(\"0\") >= 1 and s.count(\"1\") >= 1:",
"- ans += 2",
"- else:",
"- q.append(tmp)",
"- q.append(c)",
"-print(ans)",
"+... | false | 0.038661 | 0.067902 | 0.569367 | [
"s591189902",
"s759458473"
] |
u970899068 | p03050 | python | s137388346 | s559471705 | 379 | 202 | 3,060 | 40,684 | Accepted | Accepted | 46.7 | import math
n=int(eval(input()))
x=n**0.5
if x-x//1!=0:
x=int(x//1)
else:
x=int(x//1)-1
y=0
for i in range(1,x+1):
if (n-i)/i-(n-i)//i==0:
if int((n-i)//i)!=i:
y+=int((n-i)//i)
print(y)
| n=int(eval(input()))
ans=0
if n==1 or n==2:
print((0))
exit()
for i in range(n):
if i**2>=n:
x=i
break
for i in range(1,x):
if n%i==0:
if n//i>i+1:
ans+=n//i-1
print(ans) | 26 | 17 | 276 | 233 | import math
n = int(eval(input()))
x = n**0.5
if x - x // 1 != 0:
x = int(x // 1)
else:
x = int(x // 1) - 1
y = 0
for i in range(1, x + 1):
if (n - i) / i - (n - i) // i == 0:
if int((n - i) // i) != i:
y += int((n - i) // i)
print(y)
| n = int(eval(input()))
ans = 0
if n == 1 or n == 2:
print((0))
exit()
for i in range(n):
if i**2 >= n:
x = i
break
for i in range(1, x):
if n % i == 0:
if n // i > i + 1:
ans += n // i - 1
print(ans)
| false | 34.615385 | [
"-import math",
"-",
"-x = n**0.5",
"-if x - x // 1 != 0:",
"- x = int(x // 1)",
"-else:",
"- x = int(x // 1) - 1",
"-y = 0",
"-for i in range(1, x + 1):",
"- if (n - i) / i - (n - i) // i == 0:",
"- if int((n - i) // i) != i:",
"- y += int((n - i) // i)",
"-print(... | false | 1.464059 | 0.84964 | 1.723153 | [
"s137388346",
"s559471705"
] |
u480138356 | p03221 | python | s407014884 | s701447568 | 814 | 750 | 33,612 | 32,520 | Accepted | Accepted | 7.86 | N, M = list(map(int, input().split()))
city = [[] for i in range(M)]
city_id = ["" for i in range(M)]
count = [0] * N
for i in range(M):
city[i] = list(map(int, input().split())) + [i]
city = sorted(city, key=lambda x:(x[0], x[1]))
for i in range(M):
ken, year, num = city[i]
count[ken-1] ... | N, M = list(map(int, input().split()))
py = sorted([list(map(int, input().split()))+[i] for i in range(M)], key=lambda x:x[1])
count = [1] * N
ans = [None] * M
for i in range(M):
p, y, num = py[i]
ans[num] = "{:0>6}{:0>6}".format(p, count[p-1])
count[p-1] += 1
for i in range(M):
print((ans[i])) | 18 | 12 | 426 | 308 | N, M = list(map(int, input().split()))
city = [[] for i in range(M)]
city_id = ["" for i in range(M)]
count = [0] * N
for i in range(M):
city[i] = list(map(int, input().split())) + [i]
city = sorted(city, key=lambda x: (x[0], x[1]))
for i in range(M):
ken, year, num = city[i]
count[ken - 1] += 1
city_id... | N, M = list(map(int, input().split()))
py = sorted(
[list(map(int, input().split())) + [i] for i in range(M)], key=lambda x: x[1]
)
count = [1] * N
ans = [None] * M
for i in range(M):
p, y, num = py[i]
ans[num] = "{:0>6}{:0>6}".format(p, count[p - 1])
count[p - 1] += 1
for i in range(M):
print((ans[... | false | 33.333333 | [
"-city = [[] for i in range(M)]",
"-city_id = [\"\" for i in range(M)]",
"-count = [0] * N",
"+py = sorted(",
"+ [list(map(int, input().split())) + [i] for i in range(M)], key=lambda x: x[1]",
"+)",
"+count = [1] * N",
"+ans = [None] * M",
"- city[i] = list(map(int, input().split())) + [i]",
... | false | 0.046996 | 0.062569 | 0.751104 | [
"s407014884",
"s701447568"
] |
u644907318 | p03640 | python | s968932958 | s305733601 | 124 | 80 | 74,520 | 74,660 | Accepted | Accepted | 35.48 | H,W = list(map(int,input().split()))
N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
B = [[0 for _ in range(W)] for _ in range(H)]
col = 1
cnt = 0
y = 0
x = 0
d = "R"
while y<H:
if cnt<A[col]:
B[y][x] = col
cnt += 1
else:
col += 1
cnt = 0
... | H,W = list(map(int,input().split()))
N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
B = [[0 for _ in range(W)] for _ in range(H)]
col = 1
cnt = 0
i = 0
j = 0
d = 1
while True:
if cnt<A[col]:
B[i][j] = col
cnt += 1
else:
col += 1
cnt = 0
... | 31 | 33 | 591 | 602 | H, W = list(map(int, input().split()))
N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
B = [[0 for _ in range(W)] for _ in range(H)]
col = 1
cnt = 0
y = 0
x = 0
d = "R"
while y < H:
if cnt < A[col]:
B[y][x] = col
cnt += 1
else:
col += 1
cnt = 0
B... | H, W = list(map(int, input().split()))
N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
B = [[0 for _ in range(W)] for _ in range(H)]
col = 1
cnt = 0
i = 0
j = 0
d = 1
while True:
if cnt < A[col]:
B[i][j] = col
cnt += 1
else:
col += 1
cnt = 0
B[i]... | false | 6.060606 | [
"-y = 0",
"-x = 0",
"-d = \"R\"",
"-while y < H:",
"+i = 0",
"+j = 0",
"+d = 1",
"+while True:",
"- B[y][x] = col",
"+ B[i][j] = col",
"- B[y][x] = col",
"+ B[i][j] = col",
"- if x < W - 1 and d == \"R\":",
"- x += 1",
"- elif x == W - 1 and d == ... | false | 0.055347 | 0.033193 | 1.667437 | [
"s968932958",
"s305733601"
] |
u214404619 | p02407 | python | s770339480 | s520357463 | 50 | 20 | 7,768 | 5,612 | Accepted | Accepted | 60 | import sys
n = int(eval(input()))
a = [int(i) for i in input().split()]
for i in range(len(a) - 1, -1, -1):
if i > 0:
sys.stdout.write(str(a[i]))
sys.stdout.write(' ')
else:
print((a[i])); | n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
b = []
for i in range(n):
b.append(a[n - 1 - i])
for i in range(n):
if i < n - 1:
print(b[i], end=' ')
else:
print(b[i])
| 10 | 14 | 222 | 241 | import sys
n = int(eval(input()))
a = [int(i) for i in input().split()]
for i in range(len(a) - 1, -1, -1):
if i > 0:
sys.stdout.write(str(a[i]))
sys.stdout.write(" ")
else:
print((a[i]))
| n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
b = []
for i in range(n):
b.append(a[n - 1 - i])
for i in range(n):
if i < n - 1:
print(b[i], end=" ")
else:
print(b[i])
| false | 28.571429 | [
"-import sys",
"-",
"-n = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-for i in range(len(a) - 1, -1, -1):",
"- if i > 0:",
"- sys.stdout.write(str(a[i]))",
"- sys.stdout.write(\" \")",
"+n = int(input())",
"+a = input().split()",
"+for i in range(n):",
"+ ... | false | 0.047181 | 0.045144 | 1.045111 | [
"s770339480",
"s520357463"
] |
u644907318 | p03774 | python | s019565068 | s774074548 | 192 | 67 | 39,664 | 67,712 | Accepted | Accepted | 65.1 | def dist(x,y):
return abs(x[0]-y[0])+abs(x[1]-y[1])
N,M = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(N)]
Y = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
dmin = 10**9
for j in range(M-1,-1,-1):
d = dist(X[i],Y[j])
if d<... | def dist(x,y):
return abs(x[0]-y[0])+abs(x[1]-y[1])
N,M = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(N)]
Y = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
x,y = X[i]
ind = M+1
dmin = 10**9
for j in range(M):
c,d = Y[j]
... | 13 | 16 | 381 | 425 | def dist(x, y):
return abs(x[0] - y[0]) + abs(x[1] - y[1])
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
Y = [list(map(int, input().split())) for _ in range(M)]
for i in range(N):
dmin = 10**9
for j in range(M - 1, -1, -1):
d = dist(X[i], Y[j])
... | def dist(x, y):
return abs(x[0] - y[0]) + abs(x[1] - y[1])
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
Y = [list(map(int, input().split())) for _ in range(M)]
for i in range(N):
x, y = X[i]
ind = M + 1
dmin = 10**9
for j in range(M):
c, d ... | false | 18.75 | [
"+ x, y = X[i]",
"+ ind = M + 1",
"- for j in range(M - 1, -1, -1):",
"- d = dist(X[i], Y[j])",
"- if d <= dmin:",
"+ for j in range(M):",
"+ c, d = Y[j]",
"+ d = dist((x, y), (c, d))",
"+ if d < dmin:",
"+ ind = j + 1",
"- ind... | false | 0.042723 | 0.076815 | 0.55618 | [
"s019565068",
"s774074548"
] |
u566529875 | p03167 | python | s689026617 | s722184334 | 640 | 273 | 157,528 | 54,108 | Accepted | Accepted | 57.34 | h,w=list(map(int,input().split()))
a=[eval(input()) for _ in range(h)]
dp = [[0]*w for _ in range(h)]
dp[0][0]=1
for i in range(w):
if a[0][i] == "#":
break
dp[0][i] = 1
for j in range(h):
if a[j][0] == "#":
break
dp[j][0] = 1
for i in range(1,h):
for j in range(1,w)... | h,w=list(map(int,input().split()))
a = [eval(input()) for _ in range(h)]
dp = [[0 for _ in range(w)]for __ in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
if i == 0 and j == 0: continue
if a[i][j] == '#':continue
if i == 0:
dp[i][j] = dp[i][j-1]
... | 20 | 16 | 434 | 475 | h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
for i in range(w):
if a[0][i] == "#":
break
dp[0][i] = 1
for j in range(h):
if a[j][0] == "#":
break
dp[j][0] = 1
for i in range(1, h):
for j in range(1, w):
... | h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
dp = [[0 for _ in range(w)] for __ in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
if i == 0 and j == 0:
continue
if a[i][j] == "#":
continue
if i == 0:
dp[i][j] =... | false | 20 | [
"-dp = [[0] * w for _ in range(h)]",
"+dp = [[0 for _ in range(w)] for __ in range(h)]",
"-for i in range(w):",
"- if a[0][i] == \"#\":",
"- break",
"- dp[0][i] = 1",
"-for j in range(h):",
"- if a[j][0] == \"#\":",
"- break",
"- dp[j][0] = 1",
"-for i in range(1, h):",... | false | 0.036186 | 0.035459 | 1.020501 | [
"s689026617",
"s722184334"
] |
u805403870 | p03835 | python | s945604753 | s864380071 | 1,786 | 1,519 | 3,064 | 3,064 | Accepted | Accepted | 14.95 | # 蟻本1-6-1例題相当
# 続いて、x、yを確定した際、zは一意に決まるか値が存在しないかのいずれかであることに着目する。
# よって2重のfor文で回してみる
# 最大で2500^2≒600万となる
# また、条件分岐による打ち切りもしない(x+y<s-kなら、zの値に関係なく不成立だが、それを考慮しない)
count = 0
k, s = list(map(int,input().split()))
for x in range(k+1):
for y in range(k+1):
if 0 <= s-x-y and s-x-y <= k:
count += 1
prin... | # 蟻本1-6-1例題相当
# 今回も、x、yを確定した際、zは一意に決まるか値が存在しないかのいずれかであることに着目する。
# よって2重のfor文で回してみる
# 最大で2500^2≒600万となる
# 最後に、x,yの取りうる範囲を考慮する
k, s = list(map(int,input().split()))
xmin = (s - 2 * k) if (s - 2 * k) > 0 else 0
xmax = k if k < s else s
count = 0
for x in range(xmin, xmax+1):
ymin = (s - k - x) if (s - k - x)... | 13 | 17 | 322 | 463 | # 蟻本1-6-1例題相当
# 続いて、x、yを確定した際、zは一意に決まるか値が存在しないかのいずれかであることに着目する。
# よって2重のfor文で回してみる
# 最大で2500^2≒600万となる
# また、条件分岐による打ち切りもしない(x+y<s-kなら、zの値に関係なく不成立だが、それを考慮しない)
count = 0
k, s = list(map(int, input().split()))
for x in range(k + 1):
for y in range(k + 1):
if 0 <= s - x - y and s - x - y <= k:
count... | # 蟻本1-6-1例題相当
# 今回も、x、yを確定した際、zは一意に決まるか値が存在しないかのいずれかであることに着目する。
# よって2重のfor文で回してみる
# 最大で2500^2≒600万となる
# 最後に、x,yの取りうる範囲を考慮する
k, s = list(map(int, input().split()))
xmin = (s - 2 * k) if (s - 2 * k) > 0 else 0
xmax = k if k < s else s
count = 0
for x in range(xmin, xmax + 1):
ymin = (s - k - x) if (s - k - x) > 0 el... | false | 23.529412 | [
"-# 続いて、x、yを確定した際、zは一意に決まるか値が存在しないかのいずれかであることに着目する。",
"+# 今回も、x、yを確定した際、zは一意に決まるか値が存在しないかのいずれかであることに着目する。",
"-# また、条件分岐による打ち切りもしない(x+y<s-kなら、zの値に関係なく不成立だが、それを考慮しない)",
"+# 最後に、x,yの取りうる範囲を考慮する",
"+k, s = list(map(int, input().split()))",
"+xmin = (s - 2 * k) if (s - 2 * k) > 0 else 0",
"+xmax = k if k < s... | false | 0.077462 | 0.047292 | 1.63795 | [
"s945604753",
"s864380071"
] |
u970197315 | p02947 | python | s211526711 | s517698555 | 600 | 406 | 19,836 | 19,728 | Accepted | Accepted | 32.33 | from collections import defaultdict
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
snm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
n=ni()
l=[]
d=defaultdict(int)
for i in range(n):
s=list(si())
s.sor... | from collections import defaultdict as dd
n=int(eval(input()))
s=[]
for i in range(n):
tmp=list(eval(input()))
tmp.sort()
tmp=''.join(tmp)
s.append(tmp)
d=dd(int)
for ss in s:
d[ss]+=1
ans=0
for k,v in list(d.items()):
if v>=2:
ans+=v*(v-1)//2
print(ans)
| 27 | 18 | 482 | 288 | from collections import defaultdict
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
snm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
n = ni()
l = []
d = defaultdict(int)
for i in range(n):
s = list(si())
s.sort()
... | from collections import defaultdict as dd
n = int(eval(input()))
s = []
for i in range(n):
tmp = list(eval(input()))
tmp.sort()
tmp = "".join(tmp)
s.append(tmp)
d = dd(int)
for ss in s:
d[ss] += 1
ans = 0
for k, v in list(d.items()):
if v >= 2:
ans += v * (v - 1) // 2
print(ans)
| false | 33.333333 | [
"-from collections import defaultdict",
"+from collections import defaultdict as dd",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-snm = lambda: list(map(str, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"... | false | 0.037965 | 0.037658 | 1.008136 | [
"s211526711",
"s517698555"
] |
u591295155 | p02866 | python | s386270147 | s615350605 | 84 | 60 | 18,932 | 14,260 | Accepted | Accepted | 28.57 | import sys
read = lambda: sys.stdin.readline().rstrip()
def counting_tree(N, D):
import collections
tot = 1
cnt = collections.Counter(D)
"""
cnt = [0]*N
for i in D:
cnt[i]+=1
"""
for i in D[1:]:
tot = tot * cnt[i-1]%998244353
return tot if D[0]==0... | import sys
read = lambda: sys.stdin.readline().rstrip()
class Solution(object):
def counting_tree(self, N, D):
#import collections
tot = 1
#cnt = collections.Counter(D)
cnt = [0]*N
for i in D:
cnt[i]+=1
for i in D[1:]:
tot = ... | 30 | 30 | 507 | 575 | import sys
read = lambda: sys.stdin.readline().rstrip()
def counting_tree(N, D):
import collections
tot = 1
cnt = collections.Counter(D)
"""
cnt = [0]*N
for i in D:
cnt[i]+=1
"""
for i in D[1:]:
tot = tot * cnt[i - 1] % 998244353
return tot if D[0] == 0 else 0
d... | import sys
read = lambda: sys.stdin.readline().rstrip()
class Solution(object):
def counting_tree(self, N, D):
# import collections
tot = 1
# cnt = collections.Counter(D)
cnt = [0] * N
for i in D:
cnt[i] += 1
for i in D[1:]:
tot = tot * cnt[... | false | 0 | [
"-def counting_tree(N, D):",
"- import collections",
"-",
"- tot = 1",
"- cnt = collections.Counter(D)",
"- \"\"\"",
"- cnt = [0]*N",
"- for i in D:",
"- cnt[i]+=1",
"- \"\"\"",
"- for i in D[1:]:",
"- tot = tot * cnt[i - 1] % 998244353",
"- return to... | false | 0.04146 | 0.058199 | 0.712383 | [
"s386270147",
"s615350605"
] |
u186838327 | p02883 | python | s241685168 | s137221216 | 581 | 381 | 120,780 | 113,844 | Accepted | Accepted | 34.42 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
def is_ok(x):
c = 0
for i in range(n):
a = A[i]
f = F[i]
if a >= x//f:
c += a-x//f
if c <= k:
return True
... | n,k = list(map(int, input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
def is_ok(x):
c = 0
for a, f in zip(A, F):
c += max(0, a-x//f)
if c <= k:
return True
else:
return False
ng = -1
ok = 10... | 32 | 26 | 513 | 429 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
def is_ok(x):
c = 0
for i in range(n):
a = A[i]
f = F[i]
if a >= x // f:
c += a - x // f
if c <= k:
return True
else:... | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
def is_ok(x):
c = 0
for a, f in zip(A, F):
c += max(0, a - x // f)
if c <= k:
return True
else:
return False
ng = -1
ok = 10**18
while ... | false | 18.75 | [
"- for i in range(n):",
"- a = A[i]",
"- f = F[i]",
"- if a >= x // f:",
"- c += a - x // f",
"+ for a, f in zip(A, F):",
"+ c += max(0, a - x // f)",
"-if is_ok(0):",
"- print((0))",
"- exit()",
"-l = 0",
"-r = 10**18",
"-while l + 1 < r:",... | false | 0.04104 | 0.041748 | 0.983043 | [
"s241685168",
"s137221216"
] |
u071970578 | p03574 | python | s243471654 | s531637535 | 140 | 27 | 4,684 | 3,444 | Accepted | Accepted | 80.71 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
# 2次元配列を作る
grid = []
for _n in range(H):
grid.append(list(input()))
def is_bomb(h, w):
"""指定されたマスが爆弾か調べる"""
try:
# マイナス位置は全部0扱い
if h < 0 or w < 0:
return 0
if grid[h][w] == "... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
# 2次元配列を作る
grid = []
for _n in range(H):
grid.append(list(input()))
def is_bomb(h, w):
"""指定されたマスが爆弾か調べる"""
try:
# マイナス位置は全部0扱い
if h < 0 or w < 0:
return 0
if grid[h][w] == "... | 55 | 49 | 1,193 | 1,026 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
# 2次元配列を作る
grid = []
for _n in range(H):
grid.append(list(input()))
def is_bomb(h, w):
"""指定されたマスが爆弾か調べる"""
try:
# マイナス位置は全部0扱い
if h < 0 or w < 0:
return 0
if grid[h][w] == "#":
r... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
# 2次元配列を作る
grid = []
for _n in range(H):
grid.append(list(input()))
def is_bomb(h, w):
"""指定されたマスが爆弾か調べる"""
try:
# マイナス位置は全部0扱い
if h < 0 or w < 0:
return 0
if grid[h][w] == "#":
r... | false | 10.909091 | [
"- from logging import getLogger, DEBUG, basicConfig",
"-",
"- logger = getLogger(__name__)",
"- logger.setLevel(DEBUG)",
"- basicConfig()",
"- logger.info(bomb_count)"
] | false | 0.314811 | 0.045284 | 6.951895 | [
"s243471654",
"s531637535"
] |
u537976628 | p03448 | python | s606758421 | s041080593 | 58 | 53 | 9,184 | 8,976 | Accepted | Accepted | 8.62 | X = [int(eval(input())) for _ in range(4)]
ans = 0
for i in range(X[0] + 1):
for j in range(X[1] + 1):
for k in range(X[2] + 1):
if 500 * i + 100 * j + 50 * k == X[3]:
ans += 1
print(ans) | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if i * 500 + j * 100 + k * 50 == x:
ans += 1
print(ans) | 8 | 11 | 228 | 250 | X = [int(eval(input())) for _ in range(4)]
ans = 0
for i in range(X[0] + 1):
for j in range(X[1] + 1):
for k in range(X[2] + 1):
if 500 * i + 100 * j + 50 * k == X[3]:
ans += 1
print(ans)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if i * 500 + j * 100 + k * 50 == x:
ans += 1
print(ans)
| false | 27.272727 | [
"-X = [int(eval(input())) for _ in range(4)]",
"+a = int(eval(input()))",
"+b = int(eval(input()))",
"+c = int(eval(input()))",
"+x = int(eval(input()))",
"-for i in range(X[0] + 1):",
"- for j in range(X[1] + 1):",
"- for k in range(X[2] + 1):",
"- if 500 * i + 100 * j + 50 * k... | false | 0.234248 | 0.183426 | 1.27707 | [
"s606758421",
"s041080593"
] |
u757117214 | p02753 | python | s586714894 | s667768931 | 31 | 17 | 2,940 | 2,940 | Accepted | Accepted | 45.16 | S=set(eval(input()))
print(("Yes" if len(S)==2 else "No")) | S = [c for c in eval(input())]
print(("Yes" if len(set(S))==2 else "No")) | 2 | 2 | 51 | 66 | S = set(eval(input()))
print(("Yes" if len(S) == 2 else "No"))
| S = [c for c in eval(input())]
print(("Yes" if len(set(S)) == 2 else "No"))
| false | 0 | [
"-S = set(eval(input()))",
"-print((\"Yes\" if len(S) == 2 else \"No\"))",
"+S = [c for c in eval(input())]",
"+print((\"Yes\" if len(set(S)) == 2 else \"No\"))"
] | false | 0.039097 | 0.039613 | 0.986991 | [
"s586714894",
"s667768931"
] |
u920103253 | p03276 | python | s409972890 | s730621434 | 226 | 103 | 62,576 | 14,252 | Accepted | Accepted | 54.42 |
def s0():return eval(input())
def s1():return input().split()
def s2(n):return [eval(input()) for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):r... |
def s0():return eval(input())
def s1():return input().split()
def s2(n):return [eval(input()) for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):r... | 47 | 33 | 1,272 | 1,046 | def s0():
return eval(input())
def s1():
return input().split()
def s2(n):
return [eval(input()) for x in range(n)]
def s3(n):
return [input().split() for _ in range(n)]
def s4(n):
return [[x for x in s] for s in s2(n)]
def n0():
return int(eval(input()))
def n1():
return [int(x)... | def s0():
return eval(input())
def s1():
return input().split()
def s2(n):
return [eval(input()) for x in range(n)]
def s3(n):
return [input().split() for _ in range(n)]
def s4(n):
return [[x for x in s] for s in s2(n)]
def n0():
return int(eval(input()))
def n1():
return [int(x)... | false | 29.787234 | [
"-x0 = bisect_left(X, 0)",
"-if x0 < n and X[x0] == 0:",
"- k = k - 1",
"- P = X[x0 + 1 :]",
"- M = X[:x0]",
"-else:",
"- P = X[x0:]",
"- M = X[:x0]",
"-if k == 0:",
"- print((0))",
"-else:",
"- ans1 = ans2 = ans3 = float(\"inf\")",
"- if len(P) >= k:",
"- an... | false | 0.044268 | 0.049655 | 0.89151 | [
"s409972890",
"s730621434"
] |
u562935282 | p03229 | python | s233737930 | s075677101 | 271 | 219 | 8,788 | 8,284 | Accepted | Accepted | 19.19 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a = sorted(a)
l = len(a)
if n % 2 == 0:
# 谷max, 山, 谷, ..., 山, 谷, 山min
tani = sorted(a[:l // 2], reverse=True)
yama = a[l // 2 + 1:] + [a[l // 2]]
ans = 0
for i in range(l //2):
ans += yama[i] - tani[i]
for ... | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a = sorted(a)
la = len(a)
if n % 2 == 0:
p = la // 2
ans = (sum(a[p:]) - sum(a[:p])) * 2 + a[p - 1] - a[p]
else:
p = la // 2
ans = (sum(a[p:]) - sum(a[:p])) * 2 - a[p] - a[p + 1]
p = la // 2 + 1
t = (sum(a[p:]) - su... | 41 | 18 | 997 | 382 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a = sorted(a)
l = len(a)
if n % 2 == 0:
# 谷max, 山, 谷, ..., 山, 谷, 山min
tani = sorted(a[: l // 2], reverse=True)
yama = a[l // 2 + 1 :] + [a[l // 2]]
ans = 0
for i in range(l // 2):
ans += yama[i] - tani[i]
for i in range(l ... | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a = sorted(a)
la = len(a)
if n % 2 == 0:
p = la // 2
ans = (sum(a[p:]) - sum(a[:p])) * 2 + a[p - 1] - a[p]
else:
p = la // 2
ans = (sum(a[p:]) - sum(a[:p])) * 2 - a[p] - a[p + 1]
p = la // 2 + 1
t = (sum(a[p:]) - sum(a[:p])) * 2 +... | false | 56.097561 | [
"-l = len(a)",
"+la = len(a)",
"- # 谷max, 山, 谷, ..., 山, 谷, 山min",
"- tani = sorted(a[: l // 2], reverse=True)",
"- yama = a[l // 2 + 1 :] + [a[l // 2]]",
"- ans = 0",
"- for i in range(l // 2):",
"- ans += yama[i] - tani[i]",
"- for i in range(l // 2 - 1):",
"- ans ... | false | 0.046612 | 0.038066 | 1.224504 | [
"s233737930",
"s075677101"
] |
u218834617 | p02760 | python | s307450449 | s770709966 | 72 | 63 | 61,672 | 62,100 | Accepted | Accepted | 12.5 | A=[]
for _ in range(3):
A+=list(map(int,input().split()))
N=int(eval(input()))
for _ in range(N):
b=int(eval(input()))
if b in A:
A[A.index(b)]=0
p=[
(0,1,2),(3,4,5),(6,7,8),
(0,3,6),(1,4,7),(2,5,8),
(0,4,8),(2,4,6),
]
for i,j,k in p:
if A[i]==A[j]==A[k]==0:
pr... | A=[]
for _ in range(3):
A+=list(map(int,input().split()))
N=int(eval(input()))
for _ in range(N):
b=int(eval(input()))
if b in A:
A[A.index(b)]=0
p=[
(0,1,2),(3,4,5),(6,7,8),
(0,3,6),(1,4,7),(2,5,8),
(0,4,8),(2,4,6),
]
for i,j,k in p:
if A[i]==A[j]==A[k]:
print... | 22 | 22 | 352 | 349 | A = []
for _ in range(3):
A += list(map(int, input().split()))
N = int(eval(input()))
for _ in range(N):
b = int(eval(input()))
if b in A:
A[A.index(b)] = 0
p = [
(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(0, 3, 6),
(1, 4, 7),
(2, 5, 8),
(0, 4, 8),
(2, 4, 6),
]
for i, j, k in ... | A = []
for _ in range(3):
A += list(map(int, input().split()))
N = int(eval(input()))
for _ in range(N):
b = int(eval(input()))
if b in A:
A[A.index(b)] = 0
p = [
(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(0, 3, 6),
(1, 4, 7),
(2, 5, 8),
(0, 4, 8),
(2, 4, 6),
]
for i, j, k in ... | false | 0 | [
"- if A[i] == A[j] == A[k] == 0:",
"+ if A[i] == A[j] == A[k]:"
] | false | 0.042522 | 0.038084 | 1.116544 | [
"s307450449",
"s770709966"
] |
u842170774 | p02658 | python | s047722828 | s435970424 | 101 | 75 | 20,496 | 19,480 | Accepted | Accepted | 25.74 | a,b=open(0);c=1;
for i in sorted(b.split()):c=[-1,d:=int(i)*c][-1<d<=10**18]
print(c) | a,b=open(0);c=1;
for i in b.split():c=[-1,d:=int(i)*c][-1<d<=10**18]
print(c) | 3 | 3 | 87 | 79 | a, b = open(0)
c = 1
for i in sorted(b.split()):
c = [-1, d := int(i) * c][-1 < d <= 10**18]
print(c)
| a, b = open(0)
c = 1
for i in b.split():
c = [-1, d := int(i) * c][-1 < d <= 10**18]
print(c)
| false | 0 | [
"-for i in sorted(b.split()):",
"+for i in b.split():"
] | false | 0.040342 | 0.032939 | 1.224758 | [
"s047722828",
"s435970424"
] |
u882370611 | p03073 | python | s895671535 | s176296206 | 102 | 19 | 3,188 | 3,444 | Accepted | Accepted | 81.37 | s = eval(input())
n = len(s)
cnt_1 = 0
cnt_2 = 0
#左端のタイルの色が黒
for i in range(n):
if i % 2 != int(s[i]):
cnt_1 += 1
#左端のタイルの色が白
for i in range(n):
if i % 2 == int(s[i]):
cnt_2 += 1
print((min(cnt_1, cnt_2))) | s = eval(input())
n = len(s)
a = "10" * (n // 2) + "1" * (n % 2)
b = "01" * (n // 2) + "0" * (n % 2)
print((min(bin(int(s, 2) ^ int(a, 2)).count("1"), bin(int(s, 2) ^ int(b, 2)).count("1"))))
| 17 | 7 | 239 | 192 | s = eval(input())
n = len(s)
cnt_1 = 0
cnt_2 = 0
# 左端のタイルの色が黒
for i in range(n):
if i % 2 != int(s[i]):
cnt_1 += 1
# 左端のタイルの色が白
for i in range(n):
if i % 2 == int(s[i]):
cnt_2 += 1
print((min(cnt_1, cnt_2)))
| s = eval(input())
n = len(s)
a = "10" * (n // 2) + "1" * (n % 2)
b = "01" * (n // 2) + "0" * (n % 2)
print(
(min(bin(int(s, 2) ^ int(a, 2)).count("1"), bin(int(s, 2) ^ int(b, 2)).count("1")))
)
| false | 58.823529 | [
"-cnt_1 = 0",
"-cnt_2 = 0",
"-# 左端のタイルの色が黒",
"-for i in range(n):",
"- if i % 2 != int(s[i]):",
"- cnt_1 += 1",
"-# 左端のタイルの色が白",
"-for i in range(n):",
"- if i % 2 == int(s[i]):",
"- cnt_2 += 1",
"-print((min(cnt_1, cnt_2)))",
"+a = \"10\" * (n // 2) + \"1\" * (n % 2)",
"... | false | 0.040568 | 0.036928 | 1.098582 | [
"s895671535",
"s176296206"
] |
u256678932 | p02260 | python | s087318472 | s102959020 | 30 | 20 | 7,752 | 5,608 | Accepted | Accepted | 33.33 | def main():
N = int(eval(input()))
A = list(map(int, input().split(' ')))
A, count = selectionSort(A, N)
print((' '.join([str(a) for a in A])))
print(count)
def selectionSort(A, N):
count = 0
for i in range(0, N-1):
minj = i
for j in range(i, N):
... | def selection_sort(nums, n):
c = 0
for i in range(n):
minj = i
for j in range(i, n):
if nums[j] < nums[minj]:
minj = j
if i != minj:
nums[i], nums[minj] = nums[minj], nums[i]
c += 1
return (c, nums)
def main():
... | 27 | 28 | 517 | 534 | def main():
N = int(eval(input()))
A = list(map(int, input().split(" ")))
A, count = selectionSort(A, N)
print((" ".join([str(a) for a in A])))
print(count)
def selectionSort(A, N):
count = 0
for i in range(0, N - 1):
minj = i
for j in range(i, N):
if A[j] < A[m... | def selection_sort(nums, n):
c = 0
for i in range(n):
minj = i
for j in range(i, n):
if nums[j] < nums[minj]:
minj = j
if i != minj:
nums[i], nums[minj] = nums[minj], nums[i]
c += 1
return (c, nums)
def main():
n = int(eval(in... | false | 3.571429 | [
"-def main():",
"- N = int(eval(input()))",
"- A = list(map(int, input().split(\" \")))",
"- A, count = selectionSort(A, N)",
"- print((\" \".join([str(a) for a in A])))",
"- print(count)",
"+def selection_sort(nums, n):",
"+ c = 0",
"+ for i in range(n):",
"+ minj = i"... | false | 0.06542 | 0.067195 | 0.973587 | [
"s087318472",
"s102959020"
] |
u729133443 | p02735 | python | s514060663 | s197890196 | 24 | 22 | 3,188 | 3,188 | Accepted | Accepted | 8.33 | def main():
import sys
b=sys.stdin.buffer
h,w=list(map(int,b.readline().split()))
x=w+1
s=[c>>3for c in b.read()]
dp=[10001]*h*x
dp[0]=5-s[0]
for i in range(1,w):
dp[i]=dp[i-1]+(s[i-1]^s[i])
for i in range(x,h*x,x):
dp[i]=dp[i-x]+(s[i-x]^s[i])
for j in range(1,w):
k=i+j
... | def main():
import sys
b=sys.stdin.buffer
h,w=list(map(int,b.readline().split()))
x=w+1
s=[c>>3for c in b.read()]
dp=[10000]*h*x
dp[0]=5-s[0]
for i in range(1,w):
dp[i]=dp[i-1]+(s[i-1]^s[i])
for i in range(x,h*x,x):
l=i-x
dp[i]=dp[l]+(s[l]^s[i])
for j in range(1,w):
... | 20 | 23 | 438 | 463 | def main():
import sys
b = sys.stdin.buffer
h, w = list(map(int, b.readline().split()))
x = w + 1
s = [c >> 3 for c in b.read()]
dp = [10001] * h * x
dp[0] = 5 - s[0]
for i in range(1, w):
dp[i] = dp[i - 1] + (s[i - 1] ^ s[i])
for i in range(x, h * x, x):
dp[i] = dp[... | def main():
import sys
b = sys.stdin.buffer
h, w = list(map(int, b.readline().split()))
x = w + 1
s = [c >> 3 for c in b.read()]
dp = [10000] * h * x
dp[0] = 5 - s[0]
for i in range(1, w):
dp[i] = dp[i - 1] + (s[i - 1] ^ s[i])
for i in range(x, h * x, x):
l = i - x
... | false | 13.043478 | [
"- dp = [10001] * h * x",
"+ dp = [10000] * h * x",
"- dp[i] = dp[i - x] + (s[i - x] ^ s[i])",
"+ l = i - x",
"+ dp[i] = dp[l] + (s[l] ^ s[i])",
"- t = dp[k - 1] + (s[k - 1] ^ s[k])",
"- u = dp[k - x] + (s[k - x] ^ s[k])",
"+ l = k - 1",
"+... | false | 0.041114 | 0.041414 | 0.992761 | [
"s514060663",
"s197890196"
] |
u560867850 | p02785 | python | s709028554 | s484422318 | 239 | 148 | 25,872 | 25,884 | Accepted | Accepted | 38.08 | import sys
import heapq
input = sys.stdin.readline
N, K = list(map(int, input().split()))
Hs = [-int(c) for c in input().split()]
heapq.heapify(Hs)
for _ in range(min(K, len(Hs))):
heapq.heappop(Hs)
print((-sum(Hs)))
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
Hs = sorted(map(int, input().split()))
print((sum(Hs[:-K if K > 0 else len(Hs)]))) | 13 | 9 | 229 | 163 | import sys
import heapq
input = sys.stdin.readline
N, K = list(map(int, input().split()))
Hs = [-int(c) for c in input().split()]
heapq.heapify(Hs)
for _ in range(min(K, len(Hs))):
heapq.heappop(Hs)
print((-sum(Hs)))
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
Hs = sorted(map(int, input().split()))
print((sum(Hs[: -K if K > 0 else len(Hs)])))
| false | 30.769231 | [
"-import heapq",
"-Hs = [-int(c) for c in input().split()]",
"-heapq.heapify(Hs)",
"-for _ in range(min(K, len(Hs))):",
"- heapq.heappop(Hs)",
"-print((-sum(Hs)))",
"+Hs = sorted(map(int, input().split()))",
"+print((sum(Hs[: -K if K > 0 else len(Hs)])))"
] | false | 0.047188 | 0.046237 | 1.020565 | [
"s709028554",
"s484422318"
] |
u831873131 | p04011 | python | s690314229 | s903393571 | 21 | 19 | 2,940 | 2,940 | Accepted | Accepted | 9.52 | n = int(eval(input()))
k = int(eval(input()))
x = int(eval(input()))
y = int(eval(input()))
price = 0
for i in range(1, n + 1):
price += x if i <= k else y
print(price)
| N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
val = 0
for i in range(N):
val += X if i < K else Y
print(val) | 9 | 9 | 159 | 141 | n = int(eval(input()))
k = int(eval(input()))
x = int(eval(input()))
y = int(eval(input()))
price = 0
for i in range(1, n + 1):
price += x if i <= k else y
print(price)
| N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
val = 0
for i in range(N):
val += X if i < K else Y
print(val)
| false | 0 | [
"-n = int(eval(input()))",
"-k = int(eval(input()))",
"-x = int(eval(input()))",
"-y = int(eval(input()))",
"-price = 0",
"-for i in range(1, n + 1):",
"- price += x if i <= k else y",
"-print(price)",
"+N = int(eval(input()))",
"+K = int(eval(input()))",
"+X = int(eval(input()))",
"+Y = in... | false | 0.077108 | 0.108452 | 0.71099 | [
"s690314229",
"s903393571"
] |
u970197315 | p03450 | python | s419771453 | s230349926 | 1,702 | 1,190 | 77,308 | 40,816 | Accepted | Accepted | 30.08 | n,m=list(map(int,input().split()))
G=[[] for i in range(n)]
for i in range(m):
l,r,d=list(map(int,input().split()))
G[l-1].append([r-1,d])
G[r-1].append([l-1,-d])
dist=[None]*n
from collections import deque
for i in range(n):
q=deque()
if dist[i]==None:
dist[i]=0
q.append(i)
while q:
... | n,m=list(map(int,input().split()))
lrd=[tuple(map(int,input().split())) for i in range(m)]
class WeightedUnionFind:
def __init__(self,n):
self.parent = [i for i in range(n)]
self.rank = [0] * n
self.count = 0
self.weight = [0] * n
def root(self,a):
if self.parent[a] == a:
retur... | 25 | 44 | 527 | 1,195 | n, m = list(map(int, input().split()))
G = [[] for i in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
G[l - 1].append([r - 1, d])
G[r - 1].append([l - 1, -d])
dist = [None] * n
from collections import deque
for i in range(n):
q = deque()
if dist[i] == None:
dist[i] ... | n, m = list(map(int, input().split()))
lrd = [tuple(map(int, input().split())) for i in range(m)]
class WeightedUnionFind:
def __init__(self, n):
self.parent = [i for i in range(n)]
self.rank = [0] * n
self.count = 0
self.weight = [0] * n
def root(self, a):
if self.par... | false | 43.181818 | [
"-G = [[] for i in range(n)]",
"-for i in range(m):",
"- l, r, d = list(map(int, input().split()))",
"- G[l - 1].append([r - 1, d])",
"- G[r - 1].append([l - 1, -d])",
"-dist = [None] * n",
"-from collections import deque",
"+lrd = [tuple(map(int, input().split())) for i in range(m)]",
"-fo... | false | 0.04136 | 0.158339 | 0.261214 | [
"s419771453",
"s230349926"
] |
u094155508 | p02844 | python | s021332397 | s803234633 | 25 | 20 | 3,060 | 3,064 | Accepted | Accepted | 20 | n = int(eval(input()))
s = eval(input())
pins = [str(i).zfill(3) for i in range(1000)]
ans = 0
for pin in pins:
index = -1;
for c in pin:
index = s.find(c, index+1);
if (index < 0):
break;
if (index > 0):
ans += 1;
print(ans)
| n = int(eval(input()))
s = eval(input())
pins = [str(i).zfill(3) for i in range(1000)]
ans = 0
for pin in pins:
index = -1;
for c in pin:
index = s.find(c, index+1);
if (index < 0):
break;
else:
ans += 1;
print(ans)
| 16 | 16 | 276 | 266 | n = int(eval(input()))
s = eval(input())
pins = [str(i).zfill(3) for i in range(1000)]
ans = 0
for pin in pins:
index = -1
for c in pin:
index = s.find(c, index + 1)
if index < 0:
break
if index > 0:
ans += 1
print(ans)
| n = int(eval(input()))
s = eval(input())
pins = [str(i).zfill(3) for i in range(1000)]
ans = 0
for pin in pins:
index = -1
for c in pin:
index = s.find(c, index + 1)
if index < 0:
break
else:
ans += 1
print(ans)
| false | 0 | [
"- if index > 0:",
"+ else:"
] | false | 0.100034 | 0.09852 | 1.015367 | [
"s021332397",
"s803234633"
] |
u941407962 | p03016 | python | s404059967 | s729394014 | 856 | 672 | 110,556 | 95,936 | Accepted | Accepted | 21.5 | import sys
L, A, B, M = list(map(int, input().split()))
mod = M
sys.setrecursionlimit(pow(10, 8))
def power(x, y):
if y == 0 : return 1
elif y == 1 : return x % mod
elif y % 2 == 0 : return power(x, y//2)**2 % mod
else : return power(x, (y-1)//2)**2 * x % mod
def mul(a, b... | import sys
L, A, B, M = list(map(int, input().split()))
mod = M
sys.setrecursionlimit(pow(10, 8))
def power(x, y):
if y == 0 : return 1
elif y == 1 : return x % mod
elif y % 2 == 0 : return power(x, y//2)**2 % mod
else : return power(x, (y-1)//2)**2 * x % mod
def mul(a, b... | 85 | 62 | 1,953 | 1,565 | import sys
L, A, B, M = list(map(int, input().split()))
mod = M
sys.setrecursionlimit(pow(10, 8))
def power(x, y):
if y == 0:
return 1
elif y == 1:
return x % mod
elif y % 2 == 0:
return power(x, y // 2) ** 2 % mod
else:
return power(x, (y - 1) // 2) ** 2 * x % mod
d... | import sys
L, A, B, M = list(map(int, input().split()))
mod = M
sys.setrecursionlimit(pow(10, 8))
def power(x, y):
if y == 0:
return 1
elif y == 1:
return x % mod
elif y % 2 == 0:
return power(x, y // 2) ** 2 % mod
else:
return power(x, (y - 1) // 2) ** 2 * x % mod
d... | false | 27.058824 | [
"-def modinv(a):",
"- b, u, v = mod, 1, 0",
"- while b:",
"- t = a // b",
"- a, u = a - t * b, u - t * v",
"- a, b, u, v = b, a, v, u",
"- u %= mod",
"- return u",
"-",
"-",
"-def div(a, b):",
"- return a * modinv(b) % mod",
"-",
"-",
"+ # G = 1 + R... | false | 0.037672 | 0.034272 | 1.099208 | [
"s404059967",
"s729394014"
] |
u197615397 | p02318 | python | s618751193 | s314947501 | 1,520 | 640 | 44,684 | 7,548 | Accepted | Accepted | 57.89 | s1 = eval(input())
s2 = eval(input())
s1_len = len(s1)
s2_len = len(s2)
dp = [[i if j == 0 else j if i == 0 else None for j in range(s2_len+1)] for i in range(s1_len+1)]
for i in range(1, s1_len+1):
for j in range(1, s2_len+1):
n1 = dp[i-1][j-1] if s1[i-1] == s2[j-1] else dp[i-1][j-1]+1
n2... | s1 = eval(input())
s2 = eval(input())
def levenshtein(s1, s2):
s1_len = len(s1)
prev = list(range(s1_len+1))
current = None
for i, c1 in enumerate(s2, start=1):
current = [i] * (s1_len+1)
for j, c2 in enumerate(s1, start=1):
n1 = prev[j-1] if c1 == c2 else prev... | 14 | 21 | 415 | 492 | s1 = eval(input())
s2 = eval(input())
s1_len = len(s1)
s2_len = len(s2)
dp = [
[i if j == 0 else j if i == 0 else None for j in range(s2_len + 1)]
for i in range(s1_len + 1)
]
for i in range(1, s1_len + 1):
for j in range(1, s2_len + 1):
n1 = dp[i - 1][j - 1] if s1[i - 1] == s2[j - 1] else dp[i - 1]... | s1 = eval(input())
s2 = eval(input())
def levenshtein(s1, s2):
s1_len = len(s1)
prev = list(range(s1_len + 1))
current = None
for i, c1 in enumerate(s2, start=1):
current = [i] * (s1_len + 1)
for j, c2 in enumerate(s1, start=1):
n1 = prev[j - 1] if c1 == c2 else prev[j - 1]... | false | 33.333333 | [
"-s1_len = len(s1)",
"-s2_len = len(s2)",
"-dp = [",
"- [i if j == 0 else j if i == 0 else None for j in range(s2_len + 1)]",
"- for i in range(s1_len + 1)",
"-]",
"-for i in range(1, s1_len + 1):",
"- for j in range(1, s2_len + 1):",
"- n1 = dp[i - 1][j - 1] if s1[i - 1] == s2[j - 1... | false | 0.049067 | 0.048618 | 1.009224 | [
"s618751193",
"s314947501"
] |
u642874916 | p02708 | python | s905231772 | s098782117 | 184 | 79 | 96,036 | 68,536 | Accepted | Accepted | 57.07 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time
def I(): return int(input())
def S(): return input()
... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time
def I(): return int(input())
def S(): return input()
... | 93 | 78 | 1,905 | 1,533 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time
def I():
return int(input())
def S():
return input()
def MI... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time
def I():
return int(input())
def S():
return input()
def MI... | false | 16.129032 | [
"- l = [i for i in range(N + 1)]",
"- acc = list(accumulate(l))",
"- ans1 = 0",
"- # a = cmb(N+1, i, MOD)",
"- # ans += a",
"- # ans %= MOD",
"- if i == N + 1:",
"- mx = acc[N]",
"- else:",
"- mx = acc[N] - acc[N - i]",
"- ... | false | 0.059842 | 0.053341 | 1.12186 | [
"s905231772",
"s098782117"
] |
u102461423 | p03179 | python | s834958873 | s898339720 | 344 | 235 | 21,528 | 12,504 | Accepted | Accepted | 31.69 | import sys
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
N = int(eval(input()))
S = input().rstrip()
dp = np.ones(N,dtype=np.int64) # 下側で余っているものの個数
for s in S:
incr = dp.cumsum()[:-1] % MOD
if s == '<':
dp = incr
continue
decr... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = read().rstrip().decode('utf-8')
MOD = 10**9 + 7
"""
・最後に使った数に対して、下側に残っている個数 -> 数え上げ
"""
dp = np.ones(N,np.int64) # 左端
for s in S:
pr... | 21 | 30 | 388 | 547 | import sys
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
N = int(eval(input()))
S = input().rstrip()
dp = np.ones(N, dtype=np.int64) # 下側で余っているものの個数
for s in S:
incr = dp.cumsum()[:-1] % MOD
if s == "<":
dp = incr
continue
decr = (dp.sum() - inc... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = read().rstrip().decode("utf-8")
MOD = 10**9 + 7
"""
・最後に使った数に対して、下側に残っている個数 -> 数え上げ
"""
dp = np.ones(N, np.int64) # 左端
for s in S:
prev = dp
if s == "... | false | 30 | [
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"+N = int(readline())",
"+S = read().rstrip().decode(\"utf-8\")",
"-N = int(eval(input()))",
"-S = input().rstri... | false | 0.243077 | 0.28862 | 0.842202 | [
"s834958873",
"s898339720"
] |
u875291233 | p03044 | python | s921386489 | s771982032 | 990 | 915 | 10,220 | 10,204 | Accepted | Accepted | 7.58 | # coding: utf-8
class PotUnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)]#非負なら親ノード,負ならグループの要素数
self.diff_p = [0 for i in range(size)]#親ノードを基準としたポテンシャル
def root(self, x): #root(x): xの根ノードを返す
if self.parent[x] < 0:
return x
else:
... | # coding: utf-8
class PotUnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)]#非負なら親ノード,負ならグループの要素数
self.diff_p = [0 for i in range(size)]#親ノードを基準としたポテンシャル
def root(self, x): #root(x): xの根ノードを返す
if self.parent[x] < 0:
return x
else:
... | 54 | 51 | 1,742 | 1,682 | # coding: utf-8
class PotUnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)] # 非負なら親ノード,負ならグループの要素数
self.diff_p = [0 for i in range(size)] # 親ノードを基準としたポテンシャル
def root(self, x): # root(x): xの根ノードを返す
if self.parent[x] < 0:
return x
else:
... | # coding: utf-8
class PotUnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)] # 非負なら親ノード,負ならグループの要素数
self.diff_p = [0 for i in range(size)] # 親ノードを基準としたポテンシャル
def root(self, x): # root(x): xの根ノードを返す
if self.parent[x] < 0:
return x
else:
... | false | 5.555556 | [
"- def weight(self, x):",
"- self.root(x)",
"- return self.diff_p[x]",
"-",
"- dxy += self.weight(x) - self.weight(y) # dxyをdiff(rx,ry)で置き換え",
"- x = self.root(x) # rxを新たにxと名づける",
"- y = self.root(y) # ryを新たにyと名づける",
"+ rx = self.root(x) # rxを新たにxと名づける"... | false | 0.039942 | 0.045871 | 0.870728 | [
"s921386489",
"s771982032"
] |
u054825571 | p02996 | python | s710188386 | s342837507 | 1,212 | 574 | 90,100 | 47,008 | Accepted | Accepted | 52.64 | N=int(eval(input()))
L=[list(map(int,input().split())) for _ in range(N)]
s=0
p=True
L=sorted(L,key=lambda x: x[1])
for l in L:
s+=l[0]
if l[1]>=s:
continue
else:
p=False
break
print(("Yes" if p else "No"))
| N=int(eval(input()))
L=[list(map(int,input().split())) for _ in range(N)]
L.sort(key=lambda x:x[1])
t=0
p=True
for l in L:
t+=l[0]
if t > l[1]:
p=False
break
print(("Yes" if p else "No")) | 13 | 11 | 247 | 201 | N = int(eval(input()))
L = [list(map(int, input().split())) for _ in range(N)]
s = 0
p = True
L = sorted(L, key=lambda x: x[1])
for l in L:
s += l[0]
if l[1] >= s:
continue
else:
p = False
break
print(("Yes" if p else "No"))
| N = int(eval(input()))
L = [list(map(int, input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
t = 0
p = True
for l in L:
t += l[0]
if t > l[1]:
p = False
break
print(("Yes" if p else "No"))
| false | 15.384615 | [
"-s = 0",
"+L.sort(key=lambda x: x[1])",
"+t = 0",
"-L = sorted(L, key=lambda x: x[1])",
"- s += l[0]",
"- if l[1] >= s:",
"- continue",
"- else:",
"+ t += l[0]",
"+ if t > l[1]:"
] | false | 0.086453 | 0.053228 | 1.624186 | [
"s710188386",
"s342837507"
] |
u298297089 | p03252 | python | s882837231 | s774786045 | 221 | 106 | 26,660 | 7,984 | Accepted | Accepted | 52.04 | S = [c for c in eval(input())]
T = [c for c in eval(input())]
ST = [[s,t] for s,t in zip(S,T)]
S_dict = {}
T_dict = {}
for s,t in ST:
if s not in S_dict:
S_dict[s] = [t]
elif t not in S_dict[s]:
S_dict[s].append(t)
if t not in T_dict:
T_dict[t] = [s]
elif s not in T_d... | s = eval(input())
t = eval(input())
ans = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'}
res = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'}
cnt = 0
for a,b in zip(s,t):
ans[b].append(a)
res[a].append(b)
# elif ans[a] != a and ans[ans[a]] != ans[b]:
# print(a, b, '0', a, b, ans[a], ans[b], ... | 21 | 23 | 551 | 564 | S = [c for c in eval(input())]
T = [c for c in eval(input())]
ST = [[s, t] for s, t in zip(S, T)]
S_dict = {}
T_dict = {}
for s, t in ST:
if s not in S_dict:
S_dict[s] = [t]
elif t not in S_dict[s]:
S_dict[s].append(t)
if t not in T_dict:
T_dict[t] = [s]
elif s not in T_dict[t]:
... | s = eval(input())
t = eval(input())
ans = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"}
res = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"}
cnt = 0
for a, b in zip(s, t):
ans[b].append(a)
res[a].append(b)
# elif ans[a] != a and ans[ans[a]] != ans[b]:
# print(a, b, '0', a, b, ans[a], ans[b], cnt)
... | false | 8.695652 | [
"-S = [c for c in eval(input())]",
"-T = [c for c in eval(input())]",
"-ST = [[s, t] for s, t in zip(S, T)]",
"-S_dict = {}",
"-T_dict = {}",
"-for s, t in ST:",
"- if s not in S_dict:",
"- S_dict[s] = [t]",
"- elif t not in S_dict[s]:",
"- S_dict[s].append(t)",
"- if t no... | false | 0.043027 | 0.047488 | 0.906068 | [
"s882837231",
"s774786045"
] |
u646336881 | p02692 | python | s974383107 | s415328144 | 117 | 108 | 89,608 | 89,560 | Accepted | Accepted | 7.69 | #!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, s: "List[int]"):
v = [A, B, C]
ans = []
if sum(v) == 0:
return None
if sum(v) == 1:
... | #!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, s: "List[int]"):
v = [A, B, C]
ans = []
if sum(v) == 0:
return None
if sum(v) == 1:
... | 77 | 77 | 2,059 | 2,040 | #!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, s: "List[int]"):
v = [A, B, C]
ans = []
if sum(v) == 0:
return None
if sum(v) == 1:
for l, r ... | #!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, s: "List[int]"):
v = [A, B, C]
ans = []
if sum(v) == 0:
return None
if sum(v) == 1:
for l, r ... | false | 0 | [
"- if v[r] == 1 and v[l] == 1 and i != N - 1 and s[i] != s[i + 1]:",
"+ if v[r] == 1 and v[l] == 1 and i != N - 1:"
] | false | 0.040321 | 0.07292 | 0.552947 | [
"s974383107",
"s415328144"
] |
u594803920 | p02708 | python | s247644064 | s180668677 | 148 | 117 | 9,188 | 33,200 | Accepted | Accepted | 20.95 | N, K = list(map(int, input().split()))
S1 = 0
S2 = 0
for k in range(1, N+1):
S1 += k*N - k*(k-1) +1
S1 %= 10**9 + 7
for k in range(1, K):
S2 += k*N - k*(k-1) +1
S2 %= 10**9 + 7
S = S1 - S2 + 1
S %= 10**9 +7
print(S) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7
N, K = list(map(int, read().split()))
k = np.arange(K, N + 2, dtype=np.int64)
low = (k - 1) * k // 2
high = N * k - low
cnt = high - low + 1
print((cnt.... | 14 | 14 | 244 | 326 | N, K = list(map(int, input().split()))
S1 = 0
S2 = 0
for k in range(1, N + 1):
S1 += k * N - k * (k - 1) + 1
S1 %= 10**9 + 7
for k in range(1, K):
S2 += k * N - k * (k - 1) + 1
S2 %= 10**9 + 7
S = S1 - S2 + 1
S %= 10**9 + 7
print(S)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10**9 + 7
N, K = list(map(int, read().split()))
k = np.arange(K, N + 2, dtype=np.int64)
low = (k - 1) * k // 2
high = N * k - low
cnt = high - low + 1
print((cnt.sum() % MOD))
| false | 0 | [
"-N, K = list(map(int, input().split()))",
"-S1 = 0",
"-S2 = 0",
"-for k in range(1, N + 1):",
"- S1 += k * N - k * (k - 1) + 1",
"- S1 %= 10**9 + 7",
"-for k in range(1, K):",
"- S2 += k * N - k * (k - 1) + 1",
"- S2 %= 10**9 + 7",
"-S = S1 - S2 + 1",
"-S %= 10**9 + 7",
"-print(S)... | false | 0.359523 | 0.554633 | 0.648218 | [
"s247644064",
"s180668677"
] |
u209620426 | p03289 | python | s724413093 | s563383362 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
if s.find("A") == 0 and s[2:-1].count("C") == 1:
s1 = s.replace("A","a", 1)
s2 = s[2:-1].replace("C","c")
s = s1[:2] + s2 + s1[-1]
if s.islower() == True:
print("AC")
else:
print("WA")
else:
print("WA") | s = eval(input())
part_of_s = s[2:-1]
sub_s = s.replace('A','')
sub_s = sub_s.replace('C','')
if s[0] != 'A' or part_of_s.count('C') != 1 or sub_s != sub_s.lower():
print('WA')
exit()
print('AC') | 11 | 10 | 264 | 208 | s = eval(input())
if s.find("A") == 0 and s[2:-1].count("C") == 1:
s1 = s.replace("A", "a", 1)
s2 = s[2:-1].replace("C", "c")
s = s1[:2] + s2 + s1[-1]
if s.islower() == True:
print("AC")
else:
print("WA")
else:
print("WA")
| s = eval(input())
part_of_s = s[2:-1]
sub_s = s.replace("A", "")
sub_s = sub_s.replace("C", "")
if s[0] != "A" or part_of_s.count("C") != 1 or sub_s != sub_s.lower():
print("WA")
exit()
print("AC")
| false | 9.090909 | [
"-if s.find(\"A\") == 0 and s[2:-1].count(\"C\") == 1:",
"- s1 = s.replace(\"A\", \"a\", 1)",
"- s2 = s[2:-1].replace(\"C\", \"c\")",
"- s = s1[:2] + s2 + s1[-1]",
"- if s.islower() == True:",
"- print(\"AC\")",
"- else:",
"- print(\"WA\")",
"-else:",
"+part_of_s = s[2... | false | 0.069794 | 0.058533 | 1.192379 | [
"s724413093",
"s563383362"
] |
u171022470 | p02576 | python | s834707477 | s853716145 | 33 | 27 | 9,172 | 9,164 | Accepted | Accepted | 18.18 | i = list(map(int, input().split()))
ws = i[0]
cs1 = i[1]
cs2 = i[1]
t = i[2]
n = 1
while ws > cs1:
n += 1
cs1 += cs2
tt = n * t
print(tt)
| i = list(map(int, input().split())) #s_1 s_2を分割して取得し、sに値を入れる
ws = i[0]
cs1 = i[1]
cs2 = i[1]
t = i[2]
n = 1
while ws > cs1:
n += 1
cs1 += cs2
tt = n * t
print(tt)
| 12 | 12 | 158 | 183 | i = list(map(int, input().split()))
ws = i[0]
cs1 = i[1]
cs2 = i[1]
t = i[2]
n = 1
while ws > cs1:
n += 1
cs1 += cs2
tt = n * t
print(tt)
| i = list(map(int, input().split())) # s_1 s_2を分割して取得し、sに値を入れる
ws = i[0]
cs1 = i[1]
cs2 = i[1]
t = i[2]
n = 1
while ws > cs1:
n += 1
cs1 += cs2
tt = n * t
print(tt)
| false | 0 | [
"-i = list(map(int, input().split()))",
"+i = list(map(int, input().split())) # s_1 s_2を分割して取得し、sに値を入れる"
] | false | 0.035188 | 0.035992 | 0.977648 | [
"s834707477",
"s853716145"
] |
u556589653 | p02572 | python | s866933181 | s601841353 | 193 | 172 | 31,668 | 31,628 | Accepted | Accepted | 10.88 | N = int(eval(input()))
A = list(map(int,input().split()))
cum = [0] * (N-1)
now = 0
for i in range(N-1):
now += A[-(i+1)]
cum[i] = now
ans = 0
for i in range(N-1):
ans += A[i] * cum[-(i+1)]
ans %= (10**9+7)
print((ans % (10**9+7))) | N = int(eval(input()))
A = list(map(int,input().split()))
SUMA = sum(A)
MOD = 10**9 + 7
C = [0] * (N-1)
for i in range(N-1):
SUMA -= A[i]
C[i] = SUMA
ans = 0
for i in range(N-1):
ans += A[i]*C[i]
ans %= MOD
print(ans) | 12 | 13 | 250 | 231 | N = int(eval(input()))
A = list(map(int, input().split()))
cum = [0] * (N - 1)
now = 0
for i in range(N - 1):
now += A[-(i + 1)]
cum[i] = now
ans = 0
for i in range(N - 1):
ans += A[i] * cum[-(i + 1)]
ans %= 10**9 + 7
print((ans % (10**9 + 7)))
| N = int(eval(input()))
A = list(map(int, input().split()))
SUMA = sum(A)
MOD = 10**9 + 7
C = [0] * (N - 1)
for i in range(N - 1):
SUMA -= A[i]
C[i] = SUMA
ans = 0
for i in range(N - 1):
ans += A[i] * C[i]
ans %= MOD
print(ans)
| false | 7.692308 | [
"-cum = [0] * (N - 1)",
"-now = 0",
"+SUMA = sum(A)",
"+MOD = 10**9 + 7",
"+C = [0] * (N - 1)",
"- now += A[-(i + 1)]",
"- cum[i] = now",
"+ SUMA -= A[i]",
"+ C[i] = SUMA",
"- ans += A[i] * cum[-(i + 1)]",
"- ans %= 10**9 + 7",
"-print((ans % (10**9 + 7)))",
"+ ans += A[... | false | 0.092288 | 0.092975 | 0.992605 | [
"s866933181",
"s601841353"
] |
u089032001 | p03967 | python | s695958876 | s831059484 | 41 | 19 | 3,316 | 3,188 | Accepted | Accepted | 53.66 |
def inpl():
return list(map(int, input().split()))
S = eval(input())
ans = 0
g = 0
p = 0
for s in S:
if g == p:
g += 1
if s == "g":
pass
elif s == "p":
ans -= 1
else:
p += 1
if s == "g":
ans += 1
eli... | def inpl():
return list(map(int, input().split()))
S = eval(input())
print((len(S) // 2 - S.count('p')))
| 24 | 7 | 356 | 110 | def inpl():
return list(map(int, input().split()))
S = eval(input())
ans = 0
g = 0
p = 0
for s in S:
if g == p:
g += 1
if s == "g":
pass
elif s == "p":
ans -= 1
else:
p += 1
if s == "g":
ans += 1
elif s == "p":
... | def inpl():
return list(map(int, input().split()))
S = eval(input())
print((len(S) // 2 - S.count("p")))
| false | 70.833333 | [
"-ans = 0",
"-g = 0",
"-p = 0",
"-for s in S:",
"- if g == p:",
"- g += 1",
"- if s == \"g\":",
"- pass",
"- elif s == \"p\":",
"- ans -= 1",
"- else:",
"- p += 1",
"- if s == \"g\":",
"- ans += 1",
"- elif ... | false | 0.042396 | 0.109479 | 0.387253 | [
"s695958876",
"s831059484"
] |
u392319141 | p03703 | python | s149065722 | s077751548 | 1,857 | 1,313 | 96,484 | 54,576 | Accepted | Accepted | 29.29 | from bisect import bisect_right
import sys
input = sys.stdin.buffer.readline
class BIT:
def __init__(self, size, values):
self.size = size
self.tree = [0] * (size + 1)
self.values = values
self.values.sort()
self.vToI = {v: i for i, v in enumerate(self.values, st... | from bisect import bisect_right
import sys
input = sys.stdin.buffer.readline
class BIT:
def __init__(self, size):
self.size = size
self.tree = [0] * (size + 1)
def add(self, index):
while index <= self.size:
self.tree[index] += 1
index += index & (-i... | 58 | 47 | 1,529 | 1,170 | from bisect import bisect_right
import sys
input = sys.stdin.buffer.readline
class BIT:
def __init__(self, size, values):
self.size = size
self.tree = [0] * (size + 1)
self.values = values
self.values.sort()
self.vToI = {v: i for i, v in enumerate(self.values, start=1)}
... | from bisect import bisect_right
import sys
input = sys.stdin.buffer.readline
class BIT:
def __init__(self, size):
self.size = size
self.tree = [0] * (size + 1)
def add(self, index):
while index <= self.size:
self.tree[index] += 1
index += index & (-index)
... | false | 18.965517 | [
"- def __init__(self, size, values):",
"+ def __init__(self, size):",
"- self.values = values",
"- self.values.sort()",
"- self.vToI = {v: i for i, v in enumerate(self.values, start=1)}",
"-",
"- def lowerValueIndex(self, v):",
"- return self.vToI[self.values[bisec... | false | 0.033711 | 0.039859 | 0.84575 | [
"s149065722",
"s077751548"
] |
u997158994 | p02414 | python | s972563915 | s176672693 | 370 | 310 | 39,536 | 39,512 | Accepted | Accepted | 16.22 | if __name__ == '__main__':
n,m,l=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(n)]
b=list(zip(*[list(map(int,input().split())) for _ in range(m)]))
sums=[i[k]*j[k] for i in a for j in b for k in range(m)]
c=[sum(sums[i:i+m]) for i in [j for j in range(len(sums)) if j%m==0]]
... | if __name__ == '__main__':
n,m,l=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in [0]*n]
b=list(zip(*[list(map(int,input().split())) for _ in [0]*m]))
sums=[i[k]*j[k] for i in a for j in b for k in range(m)]
c=[sum(sums[i:i+m]) for i in [j for j in range(len(sums)) if j%m==0]]
for i... | 9 | 9 | 387 | 379 | if __name__ == "__main__":
n, m, l = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
b = list(zip(*[list(map(int, input().split())) for _ in range(m)]))
sums = [i[k] * j[k] for i in a for j in b for k in range(m)]
c = [sum(sums[i : i + m]) for i in [j for j in... | if __name__ == "__main__":
n, m, l = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in [0] * n]
b = list(zip(*[list(map(int, input().split())) for _ in [0] * m]))
sums = [i[k] * j[k] for i in a for j in b for k in range(m)]
c = [sum(sums[i : i + m]) for i in [j for j in r... | false | 0 | [
"- a = [list(map(int, input().split())) for _ in range(n)]",
"- b = list(zip(*[list(map(int, input().split())) for _ in range(m)]))",
"+ a = [list(map(int, input().split())) for _ in [0] * n]",
"+ b = list(zip(*[list(map(int, input().split())) for _ in [0] * m]))"
] | false | 0.08583 | 0.04881 | 1.75847 | [
"s972563915",
"s176672693"
] |
u759412327 | p02780 | python | s932035481 | s940750595 | 270 | 132 | 50,428 | 32,104 | Accepted | Accepted | 51.11 | from numpy import *
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
Q = (N-K+1)*[0]
R = sum(P[0:K])
Q[0] = R
for n in range(1,N-K+1):
R+=P[n-1+K]-P[n-1]
Q[n] = R
S = argmax(Q)
print((0.5*(sum(P[S:S+K])+K))) | N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
Q = sum(P[:K])
R = Q
for n in range(N-K):
Q = Q-P[n]+P[n+K]
R = max(Q,R)
print(((R+K)/2)) | 13 | 10 | 240 | 168 | from numpy import *
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = (N - K + 1) * [0]
R = sum(P[0:K])
Q[0] = R
for n in range(1, N - K + 1):
R += P[n - 1 + K] - P[n - 1]
Q[n] = R
S = argmax(Q)
print((0.5 * (sum(P[S : S + K]) + K)))
| N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = sum(P[:K])
R = Q
for n in range(N - K):
Q = Q - P[n] + P[n + K]
R = max(Q, R)
print(((R + K) / 2))
| false | 23.076923 | [
"-from numpy import *",
"-",
"-Q = (N - K + 1) * [0]",
"-R = sum(P[0:K])",
"-Q[0] = R",
"-for n in range(1, N - K + 1):",
"- R += P[n - 1 + K] - P[n - 1]",
"- Q[n] = R",
"-S = argmax(Q)",
"-print((0.5 * (sum(P[S : S + K]) + K)))",
"+Q = sum(P[:K])",
"+R = Q",
"+for n in range(N - K):",... | false | 0.28714 | 0.041948 | 6.845141 | [
"s932035481",
"s940750595"
] |
u761320129 | p02995 | python | s140671326 | s565408256 | 38 | 32 | 5,048 | 9,048 | Accepted | Accepted | 15.79 | from fractions import gcd
A,B,C,D = list(map(int,input().split()))
def f(n):
x = n//C
y = n//D
z = n//(C*D//gcd(C,D))
return n - x - y + z
print((f(B) - f(A-1))) | a,b,c,d = list(map(int,input().split()))
from math import gcd
def cnt(n):
lcm = c//gcd(c,d)*d
return n - n//c - n//d + n//lcm
print((cnt(b)-cnt(a-1))) | 9 | 7 | 178 | 157 | from fractions import gcd
A, B, C, D = list(map(int, input().split()))
def f(n):
x = n // C
y = n // D
z = n // (C * D // gcd(C, D))
return n - x - y + z
print((f(B) - f(A - 1)))
| a, b, c, d = list(map(int, input().split()))
from math import gcd
def cnt(n):
lcm = c // gcd(c, d) * d
return n - n // c - n // d + n // lcm
print((cnt(b) - cnt(a - 1)))
| false | 22.222222 | [
"-from fractions import gcd",
"-",
"-A, B, C, D = list(map(int, input().split()))",
"+a, b, c, d = list(map(int, input().split()))",
"+from math import gcd",
"-def f(n):",
"- x = n // C",
"- y = n // D",
"- z = n // (C * D // gcd(C, D))",
"- return n - x - y + z",
"+def cnt(n):",
"... | false | 0.044367 | 0.042512 | 1.043628 | [
"s140671326",
"s565408256"
] |
u553987207 | p03295 | python | s847913451 | s760963962 | 392 | 224 | 18,244 | 18,204 | Accepted | Accepted | 42.86 | N, M = list(map(int, input().split()))
bs = [tuple(map(int, input().split())) for _ in range(M)]
bs.sort(key=lambda x: x[1])
rbs = []
for a, b in bs:
if not rbs or a > rbs[-1]:
rbs.append(b - 1)
ans = len(rbs)
print(ans) | import sys
sin = sys.stdin.readline
N, M = list(map(int, sin().split()))
bs = [tuple(map(int, sin().split())) for _ in range(M)]
bs.sort(key=lambda x: x[1])
rbs = []
for a, b in bs:
if not rbs or a > rbs[-1]:
rbs.append(b - 1)
ans = len(rbs)
print(ans) | 10 | 12 | 236 | 270 | N, M = list(map(int, input().split()))
bs = [tuple(map(int, input().split())) for _ in range(M)]
bs.sort(key=lambda x: x[1])
rbs = []
for a, b in bs:
if not rbs or a > rbs[-1]:
rbs.append(b - 1)
ans = len(rbs)
print(ans)
| import sys
sin = sys.stdin.readline
N, M = list(map(int, sin().split()))
bs = [tuple(map(int, sin().split())) for _ in range(M)]
bs.sort(key=lambda x: x[1])
rbs = []
for a, b in bs:
if not rbs or a > rbs[-1]:
rbs.append(b - 1)
ans = len(rbs)
print(ans)
| false | 16.666667 | [
"-N, M = list(map(int, input().split()))",
"-bs = [tuple(map(int, input().split())) for _ in range(M)]",
"+import sys",
"+",
"+sin = sys.stdin.readline",
"+N, M = list(map(int, sin().split()))",
"+bs = [tuple(map(int, sin().split())) for _ in range(M)]"
] | false | 0.041671 | 0.036794 | 1.132541 | [
"s847913451",
"s760963962"
] |
u309716323 | p03178 | python | s560186547 | s741986602 | 1,192 | 896 | 129,756 | 43,500 | Accepted | Accepted | 24.83 |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
"""
_ _
dp[i][j][one_of_previous_number_is_lower] = count of remainder j up to i-th digit, 0 <= j < D
dp[i][(j+digit)%D][True] += dp[i-1][j][True] ... |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
"""
_ _
dp[i][j][one_of_previous_number_is_lower] = count of remainder j up to i-th digit, 0 <= j < D
dp[i][(j+digit)%D][True] += dp[i-1][j][True] ... | 40 | 41 | 1,185 | 1,187 | def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(" ")))
def solve():
"""
_ _
dp[i][j][one_of_previous_number_is_lower] = count of remainder j up to i-th digit, 0 <= j < D
dp[i][(j+digit)%D][True] += dp[i-1][j][True] + dp[i-1][j][False] d... | def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(" ")))
def solve():
"""
_ _
dp[i][j][one_of_previous_number_is_lower] = count of remainder j up to i-th digit, 0 <= j < D
dp[i][(j+digit)%D][True] += dp[i-1][j][True] + dp[i-1][j][False] d... | false | 2.439024 | [
"- dp = [[[0, 0] for _ in range(D)] for _ in range(len(K) + 1)]",
"- dp[0][0][0] = 1",
"+ dp = [[0, 0] for _ in range(D)]",
"+ dp[0][0] = 1",
"+ new_dp = [[0, 0] for _ in range(D)]",
"- dp[i + 1][(j + digit) % D][True] += dp[i][j][True]",
"+ new_dp[(j + d... | false | 0.046441 | 0.091005 | 0.510313 | [
"s560186547",
"s741986602"
] |
u254634413 | p02713 | python | s703599164 | s336022889 | 1,619 | 1,174 | 9,168 | 9,416 | Accepted | Accepted | 27.49 | import math
K = int(eval(input()))
def computeGCD(x, y):
while (y):
x, y = y, x % y
return x
sum = 0
for a in range(1, K+1):
for b in range(1, K+1):
intermediate = computeGCD(a, b)
for c in range(1, K+1):
sum += computeGCD(c, intermediate)
print(sum) | import math
K = int(eval(input()))
def computeGCD(x, y):
while (y):
x, y = y, x % y
return x
result = list()
sum = 0
for a in range(1, K+1):
intermediate_result = list()
for b in range(1, K+1):
intermediate_result.append(computeGCD(a, b))
result.append(intermediate_... | 17 | 24 | 312 | 513 | import math
K = int(eval(input()))
def computeGCD(x, y):
while y:
x, y = y, x % y
return x
sum = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
intermediate = computeGCD(a, b)
for c in range(1, K + 1):
sum += computeGCD(c, intermediate)
print(sum)
| import math
K = int(eval(input()))
def computeGCD(x, y):
while y:
x, y = y, x % y
return x
result = list()
sum = 0
for a in range(1, K + 1):
intermediate_result = list()
for b in range(1, K + 1):
intermediate_result.append(computeGCD(a, b))
result.append(intermediate_result)
for... | false | 29.166667 | [
"+result = list()",
"+ intermediate_result = list()",
"- intermediate = computeGCD(a, b)",
"+ intermediate_result.append(computeGCD(a, b))",
"+ result.append(intermediate_result)",
"+for a in range(1, K + 1):",
"+ for b in range(1, K + 1):",
"+ intermediate = result[a - 1... | false | 0.043899 | 0.22053 | 0.199063 | [
"s703599164",
"s336022889"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.