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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u359358631 | p03564 | python | s968025171 | s892181339 | 304 | 66 | 80,520 | 61,832 | Accepted | Accepted | 78.29 | def main():
n, k = int(eval(input())), int(eval(input()))
cnt = 0
x = 1
for _ in range(n):
x *= 2
cnt += 1
if x > k:
break
print((x + k * (n - cnt)))
if __name__ == "__main__":
main()
| def main():
n, k = int(eval(input())), int(eval(input()))
x = 1
for _ in range(n):
x = min(2 * x, x + k)
print(x)
if __name__ == "__main__":
main()
| 16 | 11 | 249 | 177 | def main():
n, k = int(eval(input())), int(eval(input()))
cnt = 0
x = 1
for _ in range(n):
x *= 2
cnt += 1
if x > k:
break
print((x + k * (n - cnt)))
if __name__ == "__main__":
main()
| def main():
n, k = int(eval(input())), int(eval(input()))
x = 1
for _ in range(n):
x = min(2 * x, x + k)
print(x)
if __name__ == "__main__":
main()
| false | 31.25 | [
"- cnt = 0",
"- x *= 2",
"- cnt += 1",
"- if x > k:",
"- break",
"- print((x + k * (n - cnt)))",
"+ x = min(2 * x, x + k)",
"+ print(x)"
] | false | 0.043369 | 0.038581 | 1.124103 | [
"s968025171",
"s892181339"
] |
u883048396 | p04031 | python | s656608462 | s140187364 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | iN = int(eval(input()))
aA = [int(x) for x in input().split()]
i2M = (min(aA) + max(aA)) // 2
iMM = sum(aA) // len(aA)
if i2M < iMM :
iLM = i2M
iUM = iMM + 1
else:
iLM = iMM
iUM = i2M + 1
aR = []
for iM in range(iLM,iUM+1):
aR.append(0)
for iA in aA:
aR[-1] += (iA - i... |
iN = int(eval(input()))
aA = [int(x) for x in input().split()]
#i2M = (min(aA) + max(aA)) // 2
iMM = sum(aA) // len(aA)
#if i2M < iMM :
# iLM = i2M
# iUM = iMM + 1
#else:
# iLM = iMM
# iUM = i2M + 1
iLM = iMM
iUM = iMM + 1
aR = []
for iM in range(iLM,iUM+1):
aR.append(0)
for iA ... | 19 | 23 | 338 | 371 | iN = int(eval(input()))
aA = [int(x) for x in input().split()]
i2M = (min(aA) + max(aA)) // 2
iMM = sum(aA) // len(aA)
if i2M < iMM:
iLM = i2M
iUM = iMM + 1
else:
iLM = iMM
iUM = i2M + 1
aR = []
for iM in range(iLM, iUM + 1):
aR.append(0)
for iA in aA:
aR[-1] += (iA - iM) ** 2
print((min... | iN = int(eval(input()))
aA = [int(x) for x in input().split()]
# i2M = (min(aA) + max(aA)) // 2
iMM = sum(aA) // len(aA)
# if i2M < iMM :
# iLM = i2M
# iUM = iMM + 1
# else:
# iLM = iMM
# iUM = i2M + 1
iLM = iMM
iUM = iMM + 1
aR = []
for iM in range(iLM, iUM + 1):
aR.append(0)
for iA in aA:
aR[-... | false | 17.391304 | [
"-i2M = (min(aA) + max(aA)) // 2",
"+# i2M = (min(aA) + max(aA)) // 2",
"-if i2M < iMM:",
"- iLM = i2M",
"- iUM = iMM + 1",
"-else:",
"- iLM = iMM",
"- iUM = i2M + 1",
"+# if i2M < iMM :",
"+# iLM = i2M",
"+# iUM = iMM + 1",
"+# else:",
"+# iLM = iMM",
"+# iUM = i2M + 1... | false | 0.045312 | 0.046001 | 0.985034 | [
"s656608462",
"s140187364"
] |
u156815136 | p02606 | python | s688471363 | s478059346 | 43 | 38 | 10,388 | 10,368 | Accepted | Accepted | 11.63 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 30 | 40 | 710 | 984 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 25 | [
"-from itertools import combinations, permutations, accumulate # (string,3) 3回",
"+from itertools import combinations, permutations, accumulate, product # (string,3) 3回",
"+import math",
"+import bisect",
"-# import bisect",
"-#",
"-# d = m - k[i] - k[j]",
"-# if kk[bisect.bisect_right(kk,d) -... | false | 0.03796 | 0.039699 | 0.956193 | [
"s688471363",
"s478059346"
] |
u293198424 | p03387 | python | s884416733 | s801527700 | 180 | 164 | 38,384 | 38,256 | Accepted | Accepted | 8.89 | a = list(map(int,input().split()))
evil = 0
odd = 0
ans = 0
for i in a:
if i%2==0:
evil += 1
else:
odd += 1
if evil==3 or odd==3:
a = [max(a)-i for i in a]
ans += sum(a)//2
else:
if evil==2:
ans += 1
for i in range(3):
if a[i]%2==0:
... | a = [int(i) for i in input().split()]
g = 0
k = 0
count = 0
for i in a:
if i%2==0:
g += 1
else:
k += 1
if g==1:
count += 1
for i in range(3):
if a[i]%2==1:
a[i] += 1
elif k==1:
count += 1
for i in range(3):
... | 26 | 24 | 516 | 433 | a = list(map(int, input().split()))
evil = 0
odd = 0
ans = 0
for i in a:
if i % 2 == 0:
evil += 1
else:
odd += 1
if evil == 3 or odd == 3:
a = [max(a) - i for i in a]
ans += sum(a) // 2
else:
if evil == 2:
ans += 1
for i in range(3):
if a[i] % 2 == 0:
... | a = [int(i) for i in input().split()]
g = 0
k = 0
count = 0
for i in a:
if i % 2 == 0:
g += 1
else:
k += 1
if g == 1:
count += 1
for i in range(3):
if a[i] % 2 == 1:
a[i] += 1
elif k == 1:
count += 1
for i in range(3):
if a[i] % 2 == 0:
a[i... | false | 7.692308 | [
"-a = list(map(int, input().split()))",
"-evil = 0",
"-odd = 0",
"-ans = 0",
"+a = [int(i) for i in input().split()]",
"+g = 0",
"+k = 0",
"+count = 0",
"- evil += 1",
"+ g += 1",
"- odd += 1",
"-if evil == 3 or odd == 3:",
"- a = [max(a) - i for i in a]",
"- ans... | false | 0.04228 | 0.045522 | 0.928768 | [
"s884416733",
"s801527700"
] |
u617515020 | p02936 | python | s010168948 | s254466923 | 1,742 | 1,380 | 56,080 | 223,540 | Accepted | Accepted | 20.78 | from collections import deque
n,q=list(map(int,input().split()))
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b=list(map(int,input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
s=[0]*n
for _ in range(q):
p,x=list(map(int,input().split()))
s[p-1]+=x
que=deque([0])
f=[0]*n
f[0]=1
while ... | import sys
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
root = [[] for i in range(N)]
ans = [0]*N
for i in range(N-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
root[a].append(b)
root[b].append(a)
for i in range(Q):
p, x = list(map(int, input().split()))
... | 27 | 28 | 442 | 489 | from collections import deque
n, q = list(map(int, input().split()))
g = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
s = [0] * n
for _ in range(q):
p, x = list(map(int, input().split()))
s[p - 1] += x
que = deque... | import sys
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
root = [[] for i in range(N)]
ans = [0] * N
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
root[a].append(b)
root[b].append(a)
for i in range(Q):
p, x = list(map(int, input().split()))
... | false | 3.571429 | [
"-from collections import deque",
"+import sys",
"-n, q = list(map(int, input().split()))",
"-g = [[] for _ in range(n)]",
"-for _ in range(n - 1):",
"+sys.setrecursionlimit(10**7)",
"+N, Q = list(map(int, input().split()))",
"+root = [[] for i in range(N)]",
"+ans = [0] * N",
"+for i in range(N -... | false | 0.035622 | 0.03678 | 0.968514 | [
"s010168948",
"s254466923"
] |
u970197315 | p02755 | python | s101780997 | s417932966 | 115 | 23 | 3,064 | 2,940 | Accepted | Accepted | 80 | # ABC158 C
a,b=list(map(int,input().split()))
# x=a*(100/8)
# y=b*(100/10)
# print(x,y)
# print(int(x),int(y))
# sx=x*((108-8)/100)
# sy=y*((110-10)/100)
# print(int(sx),int(sy))
for i in range(200000):
x,y=0.0,0.0
x=i*0.08
y=i*0.10
if a==int(x) and b==int(y):
print(i)
... | a,b=list(map(int,input().split()))
for i in range(1,10001):
tax_a=int(i*0.08)
tax_b=int(i*0.10)
if tax_a==a and tax_b==b:
print(i)
exit(0)
print((-1)) | 21 | 8 | 336 | 163 | # ABC158 C
a, b = list(map(int, input().split()))
# x=a*(100/8)
# y=b*(100/10)
# print(x,y)
# print(int(x),int(y))
# sx=x*((108-8)/100)
# sy=y*((110-10)/100)
# print(int(sx),int(sy))
for i in range(200000):
x, y = 0.0, 0.0
x = i * 0.08
y = i * 0.10
if a == int(x) and b == int(y):
print(i)
... | a, b = list(map(int, input().split()))
for i in range(1, 10001):
tax_a = int(i * 0.08)
tax_b = int(i * 0.10)
if tax_a == a and tax_b == b:
print(i)
exit(0)
print((-1))
| false | 61.904762 | [
"-# ABC158 C",
"-# x=a*(100/8)",
"-# y=b*(100/10)",
"-# print(x,y)",
"-# print(int(x),int(y))",
"-# sx=x*((108-8)/100)",
"-# sy=y*((110-10)/100)",
"-# print(int(sx),int(sy))",
"-for i in range(200000):",
"- x, y = 0.0, 0.0",
"- x = i * 0.08",
"- y = i * 0.10",
"- if a == int(x) a... | false | 0.082068 | 0.037602 | 2.182571 | [
"s101780997",
"s417932966"
] |
u287500079 | p02953 | python | s638243177 | s385187198 | 96 | 81 | 14,396 | 14,252 | Accepted | Accepted | 15.62 | #https://atcoder.jp/contests/abc136/tasks/abc136_c
n = int(eval(input()))
h = [int(i) for i in input().split()]
a = []
flag = 'Yes'
for i in reversed(list(range(n - 1))):
if h[i+1] - h[i] < 0 and h[i+1] - h[i] > -2:
h[i] -= 1
elif h[i+1] - h[i] < -1:
flag = 'No'
print(flag) | #https://atcoder.jp/contests/abc136/tasks/abc136_c
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = 'Yes'
for i in reversed(list(range(n - 1))):
if h[i+1] - h[i] < 0 and h[i+1] - h[i] > -2:
h[i] -= 1
elif h[i+1] - h[i] <= -2:
flag = 'No'
break
print(flag) | 13 | 13 | 300 | 308 | # https://atcoder.jp/contests/abc136/tasks/abc136_c
n = int(eval(input()))
h = [int(i) for i in input().split()]
a = []
flag = "Yes"
for i in reversed(list(range(n - 1))):
if h[i + 1] - h[i] < 0 and h[i + 1] - h[i] > -2:
h[i] -= 1
elif h[i + 1] - h[i] < -1:
flag = "No"
print(flag)
| # https://atcoder.jp/contests/abc136/tasks/abc136_c
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = "Yes"
for i in reversed(list(range(n - 1))):
if h[i + 1] - h[i] < 0 and h[i + 1] - h[i] > -2:
h[i] -= 1
elif h[i + 1] - h[i] <= -2:
flag = "No"
break
print(flag)
| false | 0 | [
"-a = []",
"- elif h[i + 1] - h[i] < -1:",
"+ elif h[i + 1] - h[i] <= -2:",
"+ break"
] | false | 0.043629 | 0.04442 | 0.982187 | [
"s638243177",
"s385187198"
] |
u888092736 | p02773 | python | s452908148 | s172773306 | 650 | 514 | 32,852 | 32,860 | Accepted | Accepted | 20.92 | from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
max_app = max(S.values())
ans = sorted(k for k, v in S.items() if v == max_app)
[print(string) for string in ans]
| from collections import Counter
N = int(eval(input()))
S = Counter(eval(input()) for _ in range(N))
max_app = max(S.values())
print(('\n'.join(sorted(k for k, v in list(S.items()) if v == max_app))))
| 8 | 7 | 211 | 188 | from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
max_app = max(S.values())
ans = sorted(k for k, v in S.items() if v == max_app)
[print(string) for string in ans]
| from collections import Counter
N = int(eval(input()))
S = Counter(eval(input()) for _ in range(N))
max_app = max(S.values())
print(("\n".join(sorted(k for k, v in list(S.items()) if v == max_app))))
| false | 12.5 | [
"-N = int(input())",
"-S = Counter(input() for _ in range(N))",
"+N = int(eval(input()))",
"+S = Counter(eval(input()) for _ in range(N))",
"-ans = sorted(k for k, v in S.items() if v == max_app)",
"-[print(string) for string in ans]",
"+print((\"\\n\".join(sorted(k for k, v in list(S.items()) if v == m... | false | 0.090759 | 0.047309 | 1.918449 | [
"s452908148",
"s172773306"
] |
u761320129 | p03283 | python | s982538437 | s720699904 | 1,195 | 732 | 44,328 | 49,948 | Accepted | Accepted | 38.74 | N,M,Q = list(map(int,input().split()))
src = [tuple(map(int,input().split())) for i in range(M)]
qs = [tuple(map(int,input().split())) for i in range(Q)]
imos = [[0]*(N+1) for i in range(N+1)]
for l,r in src:
imos[l][r] += 1
for i in range(N+1):
for j in range(N):
imos[i][j+1] += imos[i][j]
... | import sys
input = sys.stdin.readline
N,M,Q = map(int,input().split())
LR = [tuple(map(int,input().split())) for i in range(M)]
PQ = [tuple(map(int,input().split())) for i in range(Q)]
imos = [[0]*(N+1) for _ in range(N+1)]
for l,r in LR:
imos[l][r] += 1
for i in range(N+1):
for j in range(N):
... | 18 | 22 | 498 | 572 | N, M, Q = list(map(int, input().split()))
src = [tuple(map(int, input().split())) for i in range(M)]
qs = [tuple(map(int, input().split())) for i in range(Q)]
imos = [[0] * (N + 1) for i in range(N + 1)]
for l, r in src:
imos[l][r] += 1
for i in range(N + 1):
for j in range(N):
imos[i][j + 1] += imos[i]... | import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
LR = [tuple(map(int, input().split())) for i in range(M)]
PQ = [tuple(map(int, input().split())) for i in range(Q)]
imos = [[0] * (N + 1) for _ in range(N + 1)]
for l, r in LR:
imos[l][r] += 1
for i in range(N + 1):
for j in range(N):
... | false | 18.181818 | [
"-N, M, Q = list(map(int, input().split()))",
"-src = [tuple(map(int, input().split())) for i in range(M)]",
"-qs = [tuple(map(int, input().split())) for i in range(Q)]",
"-imos = [[0] * (N + 1) for i in range(N + 1)]",
"-for l, r in src:",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+N, M, ... | false | 0.041062 | 0.033643 | 1.220526 | [
"s982538437",
"s720699904"
] |
u411203878 | p03137 | python | s250074355 | s816183280 | 225 | 104 | 56,872 | 90,704 | Accepted | Accepted | 53.78 | n,m = list(map(int,input().split()))
t = list(map(int,input().split()))
t.sort()
memo = []
for i in range(m-1):
memo.append(t[i+1]-t[i])
memo.sort()
#print(memo)
ans = 0
for i in range(m-n):
#print(i)
ans += memo[i]
print(ans) | N,M = list(map(int,input().split()))
X = list(map(int,input().split()))
X.sort()
memo = []
for i in range(1,M):
memo.append(X[i]-X[i-1])
memo.sort()
#print(memo)
ans = 0
for i in range(M-N):
ans += memo[i]
print(ans) | 15 | 17 | 248 | 239 | n, m = list(map(int, input().split()))
t = list(map(int, input().split()))
t.sort()
memo = []
for i in range(m - 1):
memo.append(t[i + 1] - t[i])
memo.sort()
# print(memo)
ans = 0
for i in range(m - n):
# print(i)
ans += memo[i]
print(ans)
| N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
memo = []
for i in range(1, M):
memo.append(X[i] - X[i - 1])
memo.sort()
# print(memo)
ans = 0
for i in range(M - N):
ans += memo[i]
print(ans)
| false | 11.764706 | [
"-n, m = list(map(int, input().split()))",
"-t = list(map(int, input().split()))",
"-t.sort()",
"+N, M = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"+X.sort()",
"-for i in range(m - 1):",
"- memo.append(t[i + 1] - t[i])",
"+for i in range(1, M):",
"+ memo.appen... | false | 0.042789 | 0.113493 | 0.377021 | [
"s250074355",
"s816183280"
] |
u375616706 | p03967 | python | s071611269 | s894268160 | 38 | 29 | 3,316 | 3,188 | Accepted | Accepted | 23.68 | s = eval(input())
l = len(s)
point = 0
cnt = 0
for i in s:
if cnt > 0:
cnt -= 1
if i == 'g':
point += 1
else:
cnt += 1
if i == 'p':
point -= 1
print(point)
| s = eval(input())
l = len(s)
point = 0
for a, b in zip(s[0::2], s[1::2]):
if a == 'p':
point -= 1
if b == 'g':
point += 1
print(point)
| 16 | 11 | 231 | 165 | s = eval(input())
l = len(s)
point = 0
cnt = 0
for i in s:
if cnt > 0:
cnt -= 1
if i == "g":
point += 1
else:
cnt += 1
if i == "p":
point -= 1
print(point)
| s = eval(input())
l = len(s)
point = 0
for a, b in zip(s[0::2], s[1::2]):
if a == "p":
point -= 1
if b == "g":
point += 1
print(point)
| false | 31.25 | [
"-cnt = 0",
"-for i in s:",
"- if cnt > 0:",
"- cnt -= 1",
"- if i == \"g\":",
"- point += 1",
"- else:",
"- cnt += 1",
"- if i == \"p\":",
"- point -= 1",
"+for a, b in zip(s[0::2], s[1::2]):",
"+ if a == \"p\":",
"+ point -=... | false | 0.044083 | 0.119925 | 0.367591 | [
"s071611269",
"s894268160"
] |
u347640436 | p03317 | python | s559682667 | s626728912 | 40 | 17 | 13,940 | 2,940 | Accepted | Accepted | 57.5 | from sys import stdin
n, k, *a = list(map(int, stdin.read().split()))
print((((n - 1) + (k - 2)) // (k - 1)))
| n, k = list(map(int, input().split()))
print((((n - 1) + (k - 2)) // (k - 1)))
| 3 | 2 | 104 | 72 | from sys import stdin
n, k, *a = list(map(int, stdin.read().split()))
print((((n - 1) + (k - 2)) // (k - 1)))
| n, k = list(map(int, input().split()))
print((((n - 1) + (k - 2)) // (k - 1)))
| false | 33.333333 | [
"-from sys import stdin",
"-",
"-n, k, *a = list(map(int, stdin.read().split()))",
"+n, k = list(map(int, input().split()))"
] | false | 0.035612 | 0.100201 | 0.355407 | [
"s559682667",
"s626728912"
] |
u192154323 | p03062 | python | s709334898 | s995394054 | 105 | 80 | 15,020 | 20,064 | Accepted | Accepted | 23.81 | n = int(eval(input()))
a_ls = list(map(int, input().split()))
num_minus = 0
Min = float('inf')
Sum = 0
for i in range(n):
if a_ls[i] < 0:
num_minus += 1
Min = min(abs(a_ls[i]),Min)
Sum += abs(a_ls[i])
if num_minus % 2 == 0:
ans = Sum
else:
ans = Sum - 2 * Min
print(ans) | N = int(eval(input()))
a_ls = list(map(int, input().split()))
abs_ls = [0] * N
minus = 0
for i in range(N):
if a_ls[i] < 0:
minus += 1
abs_ls[i] = abs(a_ls[i])
if minus % 2 == 1:
ans = sum(abs_ls) - 2 * min(abs_ls)
else:
ans = sum(abs_ls)
print(ans) | 16 | 14 | 309 | 281 | n = int(eval(input()))
a_ls = list(map(int, input().split()))
num_minus = 0
Min = float("inf")
Sum = 0
for i in range(n):
if a_ls[i] < 0:
num_minus += 1
Min = min(abs(a_ls[i]), Min)
Sum += abs(a_ls[i])
if num_minus % 2 == 0:
ans = Sum
else:
ans = Sum - 2 * Min
print(ans)
| N = int(eval(input()))
a_ls = list(map(int, input().split()))
abs_ls = [0] * N
minus = 0
for i in range(N):
if a_ls[i] < 0:
minus += 1
abs_ls[i] = abs(a_ls[i])
if minus % 2 == 1:
ans = sum(abs_ls) - 2 * min(abs_ls)
else:
ans = sum(abs_ls)
print(ans)
| false | 12.5 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-num_minus = 0",
"-Min = float(\"inf\")",
"-Sum = 0",
"-for i in range(n):",
"+abs_ls = [0] * N",
"+minus = 0",
"+for i in range(N):",
"- num_minus += 1",
"- Min = min(abs(a_ls[i]), Min)",
"- Sum += abs(a_ls[i])",
"-if num_m... | false | 0.037343 | 0.075685 | 0.493403 | [
"s709334898",
"s995394054"
] |
u562935282 | p02743 | python | s275321556 | s735342599 | 42 | 19 | 5,460 | 2,940 | Accepted | Accepted | 54.76 | def main():
from decimal import Decimal
a, b, c = list(map(int, input().split()))
x = Decimal(a).sqrt()
y = Decimal(b).sqrt()
z = Decimal(c).sqrt()
print(('Yes' if x + y < z else 'No'))
if __name__ == '__main__':
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
... | def main():
a, b, c = list(map(int, input().split()))
if c - a - b < 0:
print('No')
return
res = 'Yes' if 4 * a * b < (c - a - b) * (c - a - b) else 'No'
print(res)
if __name__ == '__main__':
main()
| 22 | 12 | 399 | 243 | def main():
from decimal import Decimal
a, b, c = list(map(int, input().split()))
x = Decimal(a).sqrt()
y = Decimal(b).sqrt()
z = Decimal(c).sqrt()
print(("Yes" if x + y < z else "No"))
if __name__ == "__main__":
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin... | def main():
a, b, c = list(map(int, input().split()))
if c - a - b < 0:
print("No")
return
res = "Yes" if 4 * a * b < (c - a - b) * (c - a - b) else "No"
print(res)
if __name__ == "__main__":
main()
| false | 45.454545 | [
"- from decimal import Decimal",
"-",
"- x = Decimal(a).sqrt()",
"- y = Decimal(b).sqrt()",
"- z = Decimal(c).sqrt()",
"- print((\"Yes\" if x + y < z else \"No\"))",
"+ if c - a - b < 0:",
"+ print(\"No\")",
"+ return",
"+ res = \"Yes\" if 4 * a * b < (c - a - b)... | false | 0.084155 | 0.079781 | 1.054836 | [
"s275321556",
"s735342599"
] |
u987164499 | p03473 | python | s727225529 | s554256162 | 150 | 29 | 12,400 | 9,056 | Accepted | Accepted | 80.67 | from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
import math
n = int(stdin.readline().rstrip())
print((24-n+24)) | n = int(eval(input()))
print((24+24-n)) | 9 | 3 | 174 | 34 | from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
import math
n = int(stdin.readline().rstrip())
print((24 - n + 24))
| n = int(eval(input()))
print((24 + 24 - n))
| false | 66.666667 | [
"-from sys import stdin",
"-from itertools import combinations",
"-from math import factorial",
"-import numpy as np",
"-import math",
"-",
"-n = int(stdin.readline().rstrip())",
"-print((24 - n + 24))",
"+n = int(eval(input()))",
"+print((24 + 24 - n))"
] | false | 0.034237 | 0.03504 | 0.977102 | [
"s727225529",
"s554256162"
] |
u790710233 | p02912 | python | s342621855 | s002609526 | 216 | 169 | 14,380 | 14,252 | Accepted | Accepted | 21.76 | import sys
from math import floor
from heapq import heappush, heappop, heappushpop
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
# 10**5
n, m = list(map(int, input().split()))
# 10**9
a = sorted([-int(s) for s in input().split()])
for _ in range(m):
x = heappop(a)
heappush(a, x/2)
... | import heapq
n, m = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
for _ in range(m):
x = heapq.heappop(A)*(-1)
x //= 2
heapq.heappush(A, -x)
print((-sum(A)))
| 18 | 11 | 361 | 227 | import sys
from math import floor
from heapq import heappush, heappop, heappushpop
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
# 10**5
n, m = list(map(int, input().split()))
# 10**9
a = sorted([-int(s) for s in input().split()])
for _ in range(m):
x = heappop(a)
heappush(a, x / 2)
print((sum([floor... | import heapq
n, m = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
for _ in range(m):
x = heapq.heappop(A) * (-1)
x //= 2
heapq.heappush(A, -x)
print((-sum(A)))
| false | 38.888889 | [
"-import sys",
"-from math import floor",
"-from heapq import heappush, heappop, heappushpop",
"+import heapq",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-# 10**5",
"-# 10**9",
"-a = sorted([-int(s) for s in input().split()])",
"+A = list([-int(x) for x in input().split()])"... | false | 0.088908 | 0.145747 | 0.610016 | [
"s342621855",
"s002609526"
] |
u225388820 | p02582 | python | s105839870 | s497839180 | 78 | 26 | 61,648 | 8,964 | Accepted | Accepted | 66.67 | s = eval(input())
if s[0] == s[1] == s[2] == "R":
print((3))
elif s[0] == s[1] == "R" or s[1] == s[2] == "R":
print((2))
elif "R" in s:
print((1))
else:
print((0)) | s = eval(input())
if s == "RRR":
print((3))
elif "RR" in s:
print((2))
elif "R" in s:
print((1))
else:
print((0)) | 9 | 9 | 173 | 123 | s = eval(input())
if s[0] == s[1] == s[2] == "R":
print((3))
elif s[0] == s[1] == "R" or s[1] == s[2] == "R":
print((2))
elif "R" in s:
print((1))
else:
print((0))
| s = eval(input())
if s == "RRR":
print((3))
elif "RR" in s:
print((2))
elif "R" in s:
print((1))
else:
print((0))
| false | 0 | [
"-if s[0] == s[1] == s[2] == \"R\":",
"+if s == \"RRR\":",
"-elif s[0] == s[1] == \"R\" or s[1] == s[2] == \"R\":",
"+elif \"RR\" in s:"
] | false | 0.04176 | 0.057377 | 0.727817 | [
"s105839870",
"s497839180"
] |
u714300041 | p02936 | python | s846946984 | s284948312 | 1,998 | 1,678 | 264,112 | 93,552 | Accepted | Accepted | 16.02 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N, Q = list(map(int, input().split()))
class Node():
def __init__(self):
self.connected = []
self.count = 0
def add_count(v, p):
for c in G[v].connected:
if c == p:
continue
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N, Q = list(map(int, input().split()))
class Node():
def __init__(self):
self.connected = []
self.count = 0
def add_count(v, p):
for c in G[v].connected:
if c == p:
continue
... | 37 | 46 | 692 | 933 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
class Node:
def __init__(self):
self.connected = []
self.count = 0
def add_count(v, p):
for c in G[v].connected:
if c == p:
continue
G[c].count += G[v].count... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
class Node:
def __init__(self):
self.connected = []
self.count = 0
def add_count(v, p):
for c in G[v].connected:
if c == p:
continue
G[c].count += G[v].count... | false | 19.565217 | [
"+def add_count2():",
"+ s = [(0, -1)]",
"+ while s:",
"+ v, p = s.pop()",
"+ for c in G[v].connected:",
"+ if c == p:",
"+ continue",
"+ G[c].count += G[v].count",
"+ s.append((c, v))",
"+",
"+",
"-add_count(0, -1)",
"+# ad... | false | 0.036496 | 0.033952 | 1.074923 | [
"s846946984",
"s284948312"
] |
u133936772 | p02624 | python | s054889028 | s010166640 | 1,880 | 1,411 | 562,508 | 9,156 | Accepted | Accepted | 24.95 | n=int(eval(input()))
from itertools import *
s=[*accumulate(list(range(n+1)))]
print((sum(i*s[n//i] for i in range(1,n+1)))) | n=int(eval(input()))
print((sum(n//i*(n//i+1)*i//2 for i in range(1,n+1)))) | 4 | 2 | 113 | 68 | n = int(eval(input()))
from itertools import *
s = [*accumulate(list(range(n + 1)))]
print((sum(i * s[n // i] for i in range(1, n + 1))))
| n = int(eval(input()))
print((sum(n // i * (n // i + 1) * i // 2 for i in range(1, n + 1))))
| false | 50 | [
"-from itertools import *",
"-",
"-s = [*accumulate(list(range(n + 1)))]",
"-print((sum(i * s[n // i] for i in range(1, n + 1))))",
"+print((sum(n // i * (n // i + 1) * i // 2 for i in range(1, n + 1))))"
] | false | 0.526373 | 1.021886 | 0.515099 | [
"s054889028",
"s010166640"
] |
u847467233 | p00015 | python | s532685023 | s983096256 | 30 | 20 | 5,584 | 5,592 | Accepted | Accepted | 33.33 | # AOJ 0015 National Budget
# Python3 2018.6.9 bal4u
n = int(eval(input()))
for i in range(n):
a = str(eval(input()))
b = str(eval(input()))
if len(a) > 80 or len(b) > 80:
print('overflow')
else:
s = str(int(a)+int(b))
if len(s) <= 80:
print(s)
el... | # AOJ 0015 National Budget
# Python3 2018.6.9 bal4u
n = int(eval(input()))
for i in range(n):
s = int(eval(input())) + int(eval(input()))
if len(str(s)) <= 80:
print(s)
else:
print('overflow')
| 15 | 10 | 337 | 213 | # AOJ 0015 National Budget
# Python3 2018.6.9 bal4u
n = int(eval(input()))
for i in range(n):
a = str(eval(input()))
b = str(eval(input()))
if len(a) > 80 or len(b) > 80:
print("overflow")
else:
s = str(int(a) + int(b))
if len(s) <= 80:
print(s)
else:
... | # AOJ 0015 National Budget
# Python3 2018.6.9 bal4u
n = int(eval(input()))
for i in range(n):
s = int(eval(input())) + int(eval(input()))
if len(str(s)) <= 80:
print(s)
else:
print("overflow")
| false | 33.333333 | [
"- a = str(eval(input()))",
"- b = str(eval(input()))",
"- if len(a) > 80 or len(b) > 80:",
"+ s = int(eval(input())) + int(eval(input()))",
"+ if len(str(s)) <= 80:",
"+ print(s)",
"+ else:",
"- else:",
"- s = str(int(a) + int(b))",
"- if len(s) <= 80:",
... | false | 0.037627 | 0.07028 | 0.535381 | [
"s532685023",
"s983096256"
] |
u774160580 | p03107 | python | s953024275 | s645277198 | 185 | 77 | 44,892 | 3,956 | Accepted | Accepted | 58.38 | S = eval(input())
a = sum([int(S[i]) for i in range(len(S))])
b = len(S) - a
print((2*min(a, b))) | S = eval(input())
stack = []
stack.append(S[0])
for i in range(1, len(S)):
if len(stack) == 0:
stack.append(S[i])
continue
cube = stack.pop()
if cube != S[i]:
continue
stack.append(cube)
stack.append(S[i])
print((len(S) - len(stack)))
| 4 | 13 | 92 | 283 | S = eval(input())
a = sum([int(S[i]) for i in range(len(S))])
b = len(S) - a
print((2 * min(a, b)))
| S = eval(input())
stack = []
stack.append(S[0])
for i in range(1, len(S)):
if len(stack) == 0:
stack.append(S[i])
continue
cube = stack.pop()
if cube != S[i]:
continue
stack.append(cube)
stack.append(S[i])
print((len(S) - len(stack)))
| false | 69.230769 | [
"-a = sum([int(S[i]) for i in range(len(S))])",
"-b = len(S) - a",
"-print((2 * min(a, b)))",
"+stack = []",
"+stack.append(S[0])",
"+for i in range(1, len(S)):",
"+ if len(stack) == 0:",
"+ stack.append(S[i])",
"+ continue",
"+ cube = stack.pop()",
"+ if cube != S[i]:",
... | false | 0.036383 | 0.037859 | 0.961011 | [
"s953024275",
"s645277198"
] |
u847541068 | p03086 | python | s026806822 | s101331785 | 32 | 29 | 9,116 | 8,992 | Accepted | Accepted | 9.38 |
def main():
s = eval(input())
ans = 0
seq = 0
for c in s:
if c == 'A' or c == 'C' or c == 'T' or c == 'G':
seq+=1
else:
ans = max(ans,seq)
seq=0
else:
ans = max(ans,seq)
print(ans)
if __name__ == '__main__':
main() | if __name__ =='__main__':
s = eval(input())
ans = 0
seq = 0
for c in s:
if c=='A' or c=='T' or c=='G' or c=='C':
seq+=1
else:
ans = max(ans,seq)
seq=0
ans = max(ans,seq)
print(ans) | 17 | 12 | 314 | 261 | def main():
s = eval(input())
ans = 0
seq = 0
for c in s:
if c == "A" or c == "C" or c == "T" or c == "G":
seq += 1
else:
ans = max(ans, seq)
seq = 0
else:
ans = max(ans, seq)
print(ans)
if __name__ == "__main__":
main()
| if __name__ == "__main__":
s = eval(input())
ans = 0
seq = 0
for c in s:
if c == "A" or c == "T" or c == "G" or c == "C":
seq += 1
else:
ans = max(ans, seq)
seq = 0
ans = max(ans, seq)
print(ans)
| false | 29.411765 | [
"-def main():",
"+if __name__ == \"__main__\":",
"- if c == \"A\" or c == \"C\" or c == \"T\" or c == \"G\":",
"+ if c == \"A\" or c == \"T\" or c == \"G\" or c == \"C\":",
"- else:",
"- ans = max(ans, seq)",
"+ ans = max(ans, seq)",
"-",
"-",
"-if __name__ == \"__main__... | false | 0.042995 | 0.089599 | 0.479858 | [
"s026806822",
"s101331785"
] |
u077127204 | p03574 | python | s453433180 | s221537443 | 362 | 291 | 21,400 | 20,156 | Accepted | Accepted | 19.61 | import numpy as np
from collections import defaultdict
H, W = list(map(int, input().split()))
S = np.array([list(eval(input())) for _ in range(H)])
for i in range(H):
for j in range(W):
if S[i, j] == '.':
d = defaultdict(int)
S[i, j] = np.sum(S[max(i-1, 0):i+2, max(j-1, 0):j+2] == '#')
... | import numpy as np
H, W = list(map(int, input().split()))
S = np.array([list(eval(input())) for _ in range(H)])
for i in range(H):
for j in range(W):
if S[i, j] == '.':
S[i, j] = np.sum(S[max(i-1, 0):i+2, max(j-1, 0):j+2] == '#')
for s in S:
print((''.join(s)))
| 13 | 11 | 340 | 276 | import numpy as np
from collections import defaultdict
H, W = list(map(int, input().split()))
S = np.array([list(eval(input())) for _ in range(H)])
for i in range(H):
for j in range(W):
if S[i, j] == ".":
d = defaultdict(int)
S[i, j] = np.sum(S[max(i - 1, 0) : i + 2, max(j - 1, 0) :... | import numpy as np
H, W = list(map(int, input().split()))
S = np.array([list(eval(input())) for _ in range(H)])
for i in range(H):
for j in range(W):
if S[i, j] == ".":
S[i, j] = np.sum(S[max(i - 1, 0) : i + 2, max(j - 1, 0) : j + 2] == "#")
for s in S:
print(("".join(s)))
| false | 15.384615 | [
"-from collections import defaultdict",
"- d = defaultdict(int)"
] | false | 0.491516 | 0.423156 | 1.161548 | [
"s453433180",
"s221537443"
] |
u504562455 | p02719 | python | s332632370 | s131265419 | 169 | 19 | 38,256 | 9,100 | Accepted | Accepted | 88.76 | N, K = [int(_) for _ in input().split()]
N = N % K
if N * 2 > K:
print((K - N))
else:
print(N)
| # N = int(input())
N, K = [int(_) for _ in input().split()]
N = N % K
print((min(abs(N-K), N)))
| 6 | 4 | 106 | 97 | N, K = [int(_) for _ in input().split()]
N = N % K
if N * 2 > K:
print((K - N))
else:
print(N)
| # N = int(input())
N, K = [int(_) for _ in input().split()]
N = N % K
print((min(abs(N - K), N)))
| false | 33.333333 | [
"+# N = int(input())",
"-if N * 2 > K:",
"- print((K - N))",
"-else:",
"- print(N)",
"+print((min(abs(N - K), N)))"
] | false | 0.070501 | 0.035781 | 1.970337 | [
"s332632370",
"s131265419"
] |
u165133750 | p03310 | python | s928206897 | s808734353 | 1,566 | 1,087 | 25,672 | 24,136 | Accepted | Accepted | 30.59 | n = int(eval(input()))
A = list(map(int, input().split()))
F = [int()] * n
F[0] = A[0]
for b in range(1, n):
F[b] = F[b - 1] + A[b]
res = [0]*4
data = [10 ** 18] * 2
ex = [0]*4
ans = 10 ** 18
s = 0
t = 2
for i in range(1, n - 2):
bl = [True, True]
for j in range(s, i):
res[0] = F[... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
F = [int()] * n
F[0] = A[0]
for b in range(1, n):
F[b] = F[b - 1] + A[b]
res = [0]*4
data = [10 ** 18] * 2
ex = [0]*4
ans = 10 ** 18
s = 0
... | 43 | 50 | 1,004 | 1,262 | n = int(eval(input()))
A = list(map(int, input().split()))
F = [int()] * n
F[0] = A[0]
for b in range(1, n):
F[b] = F[b - 1] + A[b]
res = [0] * 4
data = [10**18] * 2
ex = [0] * 4
ans = 10**18
s = 0
t = 2
for i in range(1, n - 2):
bl = [True, True]
for j in range(s, i):
res[0] = F[j]
res[1] =... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
F = [int()] * n
F[0] = A[0]
for b in range(1, n):
F[b] = F[b - 1] + A[b]
res = [0] * 4
data = [10**18] * 2
ex = [0] * 4
ans = 10**18
s = 0
t = 2
for i i... | false | 14 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-F = [int()] * n",
"-F[0] = A[0]",
"-for b in range(1, n):",
"- F[b] = F[b - 1] + A[b]",
"-res = [0] * 4",
"-data = [10**18] * 2",
"-ex = [0] * 4",
"-ans = 10**18",
"-s = 0",
"-t = 2",
"-for i in range(1, n - 2):",
"- ... | false | 0.045271 | 0.04613 | 0.981384 | [
"s928206897",
"s808734353"
] |
u966000628 | p03160 | python | s984833862 | s509988271 | 217 | 181 | 13,928 | 13,924 | Accepted | Accepted | 16.59 | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [float('inf') for _ in range(n)]
cost[0] = 0
for x in range(n):
if x + 1 < n:
cost[x + 1] = min(cost[x + 1], cost[x] + abs(h[x + 1] - h[x]))
if x + 2 < n:
cost[x + 2] = min(cost[x + 2], cost[x] + abs(h[x + 2] - h... | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [9999999999] * n
cost[0] = 0
for x in range(n):
if x + 1 < n:
cost[x + 1] = min(cost[x + 1], cost[x] + abs(h[x + 1] - h[x]))
if x + 2 < n:
cost[x + 2] = min(cost[x + 2], cost[x] + abs(h[x + 2] - h[x]))
print((... | 14 | 14 | 342 | 326 | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [float("inf") for _ in range(n)]
cost[0] = 0
for x in range(n):
if x + 1 < n:
cost[x + 1] = min(cost[x + 1], cost[x] + abs(h[x + 1] - h[x]))
if x + 2 < n:
cost[x + 2] = min(cost[x + 2], cost[x] + abs(h[x + 2] - h[x]))
print((cost[... | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [9999999999] * n
cost[0] = 0
for x in range(n):
if x + 1 < n:
cost[x + 1] = min(cost[x + 1], cost[x] + abs(h[x + 1] - h[x]))
if x + 2 < n:
cost[x + 2] = min(cost[x + 2], cost[x] + abs(h[x + 2] - h[x]))
print((cost[n - 1]))
| false | 0 | [
"-cost = [float(\"inf\") for _ in range(n)]",
"+cost = [9999999999] * n"
] | false | 0.08165 | 0.095275 | 0.856993 | [
"s984833862",
"s509988271"
] |
u269778596 | p02707 | python | s856000679 | s544606284 | 191 | 132 | 116,424 | 116,692 | Accepted | Accepted | 30.89 | size = int(eval(input()))
li = list(map(int,input().split()))
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in list(c1.items()):
ans2[i-1] = j
for i in ans2:
print(i) | from sys import stdin,stdout
size = int(stdin.readline())
li = list(map(int,stdin.readline().split()))
"""ans = [0]*size
for i in li:
if i not in ans:
ans[i-1] = 1
else:
ans[i-1] += 1
for i in ans:
print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
... | 9 | 19 | 199 | 410 | size = int(eval(input()))
li = list(map(int, input().split()))
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i, j in list(c1.items()):
ans2[i - 1] = j
for i in ans2:
print(i)
| from sys import stdin, stdout
size = int(stdin.readline())
li = list(map(int, stdin.readline().split()))
"""ans = [0]*size
for i in li:
if i not in ans:
ans[i-1] = 1
else:
ans[i-1] += 1
for i in ans:
print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i, j i... | false | 52.631579 | [
"-size = int(eval(input()))",
"-li = list(map(int, input().split()))",
"+from sys import stdin, stdout",
"+",
"+size = int(stdin.readline())",
"+li = list(map(int, stdin.readline().split()))",
"+\"\"\"ans = [0]*size",
"+for i in li:",
"+ if i not in ans:",
"+ ans[i-1] = 1",
"+ else:... | false | 0.073984 | 0.00702 | 10.538778 | [
"s856000679",
"s544606284"
] |
u638709900 | p02988 | python | s146056403 | s945500883 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | n = int(eval(input()))
p = list(map(int, input().split()))
count = 0
for i in range(1,len(p)-1,1):
if p[i+1] > p[i] > p[i-1]:
count = count +1
elif p[i+1] < p[i] < p[i-1]:
count = count +1
else:
pass
print(count) | n = int(eval(input()))
p = list(map(int, input().split()))
count = 0
for i in range(1,n-1,1):
if p[i+1] > p[i] > p[i-1]:
count = count +1
elif p[i+1] < p[i] < p[i-1]:
count = count +1
else:
pass
print(count) | 13 | 13 | 256 | 251 | n = int(eval(input()))
p = list(map(int, input().split()))
count = 0
for i in range(1, len(p) - 1, 1):
if p[i + 1] > p[i] > p[i - 1]:
count = count + 1
elif p[i + 1] < p[i] < p[i - 1]:
count = count + 1
else:
pass
print(count)
| n = int(eval(input()))
p = list(map(int, input().split()))
count = 0
for i in range(1, n - 1, 1):
if p[i + 1] > p[i] > p[i - 1]:
count = count + 1
elif p[i + 1] < p[i] < p[i - 1]:
count = count + 1
else:
pass
print(count)
| false | 0 | [
"-for i in range(1, len(p) - 1, 1):",
"+for i in range(1, n - 1, 1):"
] | false | 0.045575 | 0.045989 | 0.991011 | [
"s146056403",
"s945500883"
] |
u170201762 | p03682 | python | s199629627 | s134605828 | 1,684 | 1,517 | 93,660 | 82,128 | Accepted | Accepted | 9.92 | N = int(eval(input()))
z = [tuple(map(int,input().split())) for i in range(N)]
z.sort()
y = [(z[i][1],i) for i in range(N)]
y.sort()
cost = [[] for i in range(N)]
for i in range(N-1):
j = y[i][1]
cost[i].append((i-1,min(abs(z[i][0]-z[i-1][0]),abs(z[i][1]-z[i-1][1]))))
j_ = y[i-1][1]
cost[j].ap... | import heapq
def prim(cost):
V = len(cost)
res = 0
mincost = [float('inf')]*V
used = [False]*V
hq = []
mincost[0] = 0
heapq.heappush(hq,(0,0))
while hq:
weight,u = heapq.heappop(hq)
if used[u]:
continue
used[u] = True
res += wei... | 44 | 47 | 1,246 | 1,018 | N = int(eval(input()))
z = [tuple(map(int, input().split())) for i in range(N)]
z.sort()
y = [(z[i][1], i) for i in range(N)]
y.sort()
cost = [[] for i in range(N)]
for i in range(N - 1):
j = y[i][1]
cost[i].append((i - 1, min(abs(z[i][0] - z[i - 1][0]), abs(z[i][1] - z[i - 1][1]))))
j_ = y[i - 1][1]
co... | import heapq
def prim(cost):
V = len(cost)
res = 0
mincost = [float("inf")] * V
used = [False] * V
hq = []
mincost[0] = 0
heapq.heappush(hq, (0, 0))
while hq:
weight, u = heapq.heappop(hq)
if used[u]:
continue
used[u] = True
res += weight
... | false | 6.382979 | [
"-N = int(eval(input()))",
"-z = [tuple(map(int, input().split())) for i in range(N)]",
"-z.sort()",
"-y = [(z[i][1], i) for i in range(N)]",
"-y.sort()",
"-cost = [[] for i in range(N)]",
"-for i in range(N - 1):",
"- j = y[i][1]",
"- cost[i].append((i - 1, min(abs(z[i][0] - z[i - 1][0]), abs... | false | 0.043147 | 0.040014 | 1.078274 | [
"s199629627",
"s134605828"
] |
u474423089 | p03013 | python | s408449291 | s441958376 | 447 | 49 | 460,020 | 11,884 | Accepted | Accepted | 89.04 | import sys
mod = 10**9+7
def main():
n,m=list(map(int,input().split(' ')))
if m > 0:
aaa = set(map(int,sys.stdin))
else:
aaa = set()
dp = [0] * (n+1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
for i in range(2,n+1):
if i in aaa:
continue
... | import sys
mod = 10**9+7
def main():
n,m=list(map(int,input().split(' ')))
if m > 0:
aaa = set(map(int,sys.stdin))
else:
aaa = set()
dp = [0] * (n+1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
for i in range(2,n+1):
if i in aaa:
continue
... | 20 | 20 | 377 | 379 | import sys
mod = 10**9 + 7
def main():
n, m = list(map(int, input().split(" ")))
if m > 0:
aaa = set(map(int, sys.stdin))
else:
aaa = set()
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
for i in range(2, n + 1):
if i in aaa:
continue
... | import sys
mod = 10**9 + 7
def main():
n, m = list(map(int, input().split(" ")))
if m > 0:
aaa = set(map(int, sys.stdin))
else:
aaa = set()
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
for i in range(2, n + 1):
if i in aaa:
continue
... | false | 0 | [
"- dp[i] = dp[i - 1] + dp[i - 2]",
"- print((dp[n] % mod))",
"+ dp[i] = (dp[i - 1] + dp[i - 2]) % mod",
"+ print((dp[n]))"
] | false | 0.058374 | 0.035044 | 1.665731 | [
"s408449291",
"s441958376"
] |
u230621983 | p03785 | python | s762693957 | s546787905 | 239 | 86 | 7,744 | 19,948 | Accepted | Accepted | 64.02 | import collections
n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for i in range(n)]
t.sort()
passenger = 0
departure_limit = t[0] + k
bus_cnt = 0
for T in t:
if passenger+1 > c or T > departure_limit:
departure_limit = T+k
passenger = 1
bus_cnt += 1
... | n, c, k, *t = list(map(int, open(0).read().split()))
t.sort()
tmp = 0
cnt = 0
limit = t[0] + k
for time in t:
if tmp == c or time > limit:
limit = time + k
tmp = 1
cnt += 1
else:
tmp += 1
print((cnt + 1)) | 20 | 13 | 357 | 248 | import collections
n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for i in range(n)]
t.sort()
passenger = 0
departure_limit = t[0] + k
bus_cnt = 0
for T in t:
if passenger + 1 > c or T > departure_limit:
departure_limit = T + k
passenger = 1
bus_cnt += 1
else:
... | n, c, k, *t = list(map(int, open(0).read().split()))
t.sort()
tmp = 0
cnt = 0
limit = t[0] + k
for time in t:
if tmp == c or time > limit:
limit = time + k
tmp = 1
cnt += 1
else:
tmp += 1
print((cnt + 1))
| false | 35 | [
"-import collections",
"-",
"-n, c, k = list(map(int, input().split()))",
"-t = [int(eval(input())) for i in range(n)]",
"+n, c, k, *t = list(map(int, open(0).read().split()))",
"-passenger = 0",
"-departure_limit = t[0] + k",
"-bus_cnt = 0",
"-for T in t:",
"- if passenger + 1 > c or T > depar... | false | 0.046278 | 0.127182 | 0.36387 | [
"s762693957",
"s546787905"
] |
u252828980 | p03681 | python | s835315910 | s266162842 | 704 | 55 | 5,192 | 3,064 | Accepted | Accepted | 92.19 | import math
n,m = list(map(int,input().split()))
if abs(n-m)>=2:
print((0))
if abs(n-m)==1:
print((math.factorial(m)*math.factorial(n)%1000000007))
if n==m:
print((math.factorial(m)*math.factorial(n)*2%1000000007)) | n,m = list(map(int,(input().split())))
mod = 10**9+7
sn,sm = 1,1
for i in range(1,n+1):
sn = sn*i%mod
for i in range(1,m+1):
sm = sm*i%mod
if abs(n-m)>=2:
print((0))
elif abs(n-m) == 1:
print((sn*sm%mod))
elif abs(n-m) == 0:
print((sn*sm*2%mod)) | 9 | 15 | 224 | 269 | import math
n, m = list(map(int, input().split()))
if abs(n - m) >= 2:
print((0))
if abs(n - m) == 1:
print((math.factorial(m) * math.factorial(n) % 1000000007))
if n == m:
print((math.factorial(m) * math.factorial(n) * 2 % 1000000007))
| n, m = list(map(int, (input().split())))
mod = 10**9 + 7
sn, sm = 1, 1
for i in range(1, n + 1):
sn = sn * i % mod
for i in range(1, m + 1):
sm = sm * i % mod
if abs(n - m) >= 2:
print((0))
elif abs(n - m) == 1:
print((sn * sm % mod))
elif abs(n - m) == 0:
print((sn * sm * 2 % mod))
| false | 40 | [
"-import math",
"-",
"-n, m = list(map(int, input().split()))",
"+n, m = list(map(int, (input().split())))",
"+mod = 10**9 + 7",
"+sn, sm = 1, 1",
"+for i in range(1, n + 1):",
"+ sn = sn * i % mod",
"+for i in range(1, m + 1):",
"+ sm = sm * i % mod",
"-if abs(n - m) == 1:",
"- print... | false | 0.132973 | 0.037971 | 3.501962 | [
"s835315910",
"s266162842"
] |
u627803856 | p03828 | python | s718436918 | s517879686 | 206 | 80 | 40,048 | 68,024 | Accepted | Accepted | 61.17 | n = int(eval(input()))
mod = 10**9 + 7
d = {}
for i in range(2,n+1):
x = i
for j in range(2,x+1):
while x % j == 0:
x = x // j
d[j] = d.get(j, 0) + 1
ret = 1
for v in list(d.values()):
ret *= v+1
print((ret % mod))
| MOD = 10 ** 9 + 7
n = int(eval(input()))
# 素数
primes = [True] * (n + 1)
p = 2
while p * p <= n:
if primes[p]:
for i in range(p * p, n + 1, p):
primes[i] = False
p += 1
primes[0], primes[1] = False, False
# counter
cnt = [0] * (n + 1)
for k in range(2, n + 1):
now = k
... | 17 | 32 | 232 | 583 | n = int(eval(input()))
mod = 10**9 + 7
d = {}
for i in range(2, n + 1):
x = i
for j in range(2, x + 1):
while x % j == 0:
x = x // j
d[j] = d.get(j, 0) + 1
ret = 1
for v in list(d.values()):
ret *= v + 1
print((ret % mod))
| MOD = 10**9 + 7
n = int(eval(input()))
# 素数
primes = [True] * (n + 1)
p = 2
while p * p <= n:
if primes[p]:
for i in range(p * p, n + 1, p):
primes[i] = False
p += 1
primes[0], primes[1] = False, False
# counter
cnt = [0] * (n + 1)
for k in range(2, n + 1):
now = k
# 素因数分解
for i ... | false | 46.875 | [
"+MOD = 10**9 + 7",
"-mod = 10**9 + 7",
"-d = {}",
"-for i in range(2, n + 1):",
"- x = i",
"- for j in range(2, x + 1):",
"- while x % j == 0:",
"- x = x // j",
"- d[j] = d.get(j, 0) + 1",
"-ret = 1",
"-for v in list(d.values()):",
"- ret *= v + 1",
"-p... | false | 0.045516 | 0.109212 | 0.416771 | [
"s718436918",
"s517879686"
] |
u089032001 | p02695 | python | s354864640 | s322788344 | 630 | 534 | 22,944 | 94,212 | Accepted | Accepted | 15.24 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)
def inpl():
return list(map(int, input().split()))
back = []
def backtrack(n, ml, mh, tmp=[]):
if n == 0:
back.append(tmp)
return
for i in range(ml, mh + 1):
backtrack(n - 1, i, mh, tmp + ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)
def inpl():
return list(map(int, input().split()))
def backtrack(n, ml, mh, tmp=[]):
if n == 0:
yield tmp
return
for i in range(ml, mh + 1):
yield from backtrack(n - 1, i, mh, tmp + [i])
d... | 42 | 28 | 797 | 586 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)
def inpl():
return list(map(int, input().split()))
back = []
def backtrack(n, ml, mh, tmp=[]):
if n == 0:
back.append(tmp)
return
for i in range(ml, mh + 1):
backtrack(n - 1, i, mh, tmp + [i])
def main():... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)
def inpl():
return list(map(int, input().split()))
def backtrack(n, ml, mh, tmp=[]):
if n == 0:
yield tmp
return
for i in range(ml, mh + 1):
yield from backtrack(n - 1, i, mh, tmp + [i])
def main():
def... | false | 33.333333 | [
"-back = []",
"-",
"-",
"- back.append(tmp)",
"+ yield tmp",
"- backtrack(n - 1, i, mh, tmp + [i])",
"+ yield from backtrack(n - 1, i, mh, tmp + [i])",
"- def count(carrer):",
"- ret = 0",
"- for a, b, c, d in abcd:",
"- if carrer[b - 1] - ... | false | 0.069618 | 0.139897 | 0.497636 | [
"s354864640",
"s322788344"
] |
u141786930 | p02898 | python | s279855437 | s925242551 | 67 | 50 | 10,636 | 11,892 | Accepted | Accepted | 25.37 | from collections import deque
n, k = list(map(int, input().split()))
h = deque(list(input().split()))
ans = 0
while len(h) > 0:
if int(h.pop()) >= k:
ans += 1
print(ans) | def main():
N, K = list(map(int, input().split()))
h = list(int(x) for x in input().split())
ans = 0
for i in h:
if i >= K:
ans += 1
print(ans)
if __name__ == '__main__':
main() | 11 | 13 | 196 | 234 | from collections import deque
n, k = list(map(int, input().split()))
h = deque(list(input().split()))
ans = 0
while len(h) > 0:
if int(h.pop()) >= k:
ans += 1
print(ans)
| def main():
N, K = list(map(int, input().split()))
h = list(int(x) for x in input().split())
ans = 0
for i in h:
if i >= K:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 15.384615 | [
"-from collections import deque",
"+def main():",
"+ N, K = list(map(int, input().split()))",
"+ h = list(int(x) for x in input().split())",
"+ ans = 0",
"+ for i in h:",
"+ if i >= K:",
"+ ans += 1",
"+ print(ans)",
"-n, k = list(map(int, input().split()))",
"-h... | false | 0.035663 | 0.035418 | 1.006912 | [
"s279855437",
"s925242551"
] |
u312025627 | p03945 | python | s738894993 | s923638397 | 172 | 39 | 39,280 | 3,188 | Accepted | Accepted | 77.33 | def main():
S = eval(input())
ans = 0
for i in range(len(S)-1):
if S[i] != S[i+1]:
ans += 1
print(ans)
if __name__ == '__main__':
main()
| def main():
S = eval(input())
N = len(S)
ans = 0
for i in range(1, N):
if S[i-1] != S[i]:
ans += 1
print(ans)
if __name__ == '__main__':
main()
| 11 | 12 | 183 | 195 | def main():
S = eval(input())
ans = 0
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| def main():
S = eval(input())
N = len(S)
ans = 0
for i in range(1, N):
if S[i - 1] != S[i]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 8.333333 | [
"+ N = len(S)",
"- for i in range(len(S) - 1):",
"- if S[i] != S[i + 1]:",
"+ for i in range(1, N):",
"+ if S[i - 1] != S[i]:"
] | false | 0.044623 | 0.035809 | 1.24613 | [
"s738894993",
"s923638397"
] |
u227082700 | p03855 | python | s254365208 | s496555384 | 1,275 | 1,130 | 47,332 | 44,388 | Accepted | Accepted | 11.37 | from collections import*
class u():
def __init__(self,n):self.n,self.r=[-1]*n,[0]*n
def f(self,x):
if self.n[x]<0:return x
else:self.n[x]=self.f(self.n[x]);return self.n[x]
def u(self,x,y):
x,y=self.f(x),self.f(y)
if x==y:return
elif self.r[x]>self.r[y]:self.n[x]+=self.n[y];self.n[y]=... | from collections import*
n,k,l=list(map(int,input().split()));d=[-1]*n;t=[-1]*n
def f(l,x):
if l[x]<0:return x
else:l[x]=f(l,l[x]);return l[x]
def u(l,x,y):
x,y=f(l,x),f(l,y)
if x!=y:l[y]=x
for _ in range(k):a,b=list(map(int,input().split()));u(d,a-1,b-1)
for _ in range(l):a,b=list(map(int,input().spli... | 15 | 11 | 650 | 406 | from collections import *
class u:
def __init__(self, n):
self.n, self.r = [-1] * n, [0] * n
def f(self, x):
if self.n[x] < 0:
return x
else:
self.n[x] = self.f(self.n[x])
return self.n[x]
def u(self, x, y):
x, y = self.f(x), self.f(y)
... | from collections import *
n, k, l = list(map(int, input().split()))
d = [-1] * n
t = [-1] * n
def f(l, x):
if l[x] < 0:
return x
else:
l[x] = f(l, l[x])
return l[x]
def u(l, x, y):
x, y = f(l, x), f(l, y)
if x != y:
l[y] = x
for _ in range(k):
a, b = list(map(i... | false | 26.666667 | [
"-",
"-class u:",
"- def __init__(self, n):",
"- self.n, self.r = [-1] * n, [0] * n",
"-",
"- def f(self, x):",
"- if self.n[x] < 0:",
"- return x",
"- else:",
"- self.n[x] = self.f(self.n[x])",
"- return self.n[x]",
"-",
"- def ... | false | 0.045551 | 0.125178 | 0.363894 | [
"s254365208",
"s496555384"
] |
u761320129 | p03599 | python | s023150660 | s545517105 | 128 | 76 | 3,188 | 9,256 | Accepted | Accepted | 40.62 | A,B,C,D,E,F = list(map(int,input().split()))
ws = set()
for a in range(F+1):
if a*100*A > F: break
for b in range(F+1):
if a*100*A + b*100*B > F: break
ws.add(a*100*A + b*100*B)
ss = set()
for c in range(F+1):
if c*C > F: break
for d in range(F+1):
if c*C + d*D > F... | A,B,C,D,E,F = list(map(int,input().split()))
ws = set()
for a in range(0,F+1,100*A):
for b in range(0,F+1,100*B):
if a+b > F: break
ws.add(a+b)
ws.remove(0)
ss = set()
for c in range(0,F+1,C):
for d in range(0,F+1,D):
if c+d > F: break
ss.add(c+d)
best_s = -1
b... | 26 | 25 | 569 | 549 | A, B, C, D, E, F = list(map(int, input().split()))
ws = set()
for a in range(F + 1):
if a * 100 * A > F:
break
for b in range(F + 1):
if a * 100 * A + b * 100 * B > F:
break
ws.add(a * 100 * A + b * 100 * B)
ss = set()
for c in range(F + 1):
if c * C > F:
break
... | A, B, C, D, E, F = list(map(int, input().split()))
ws = set()
for a in range(0, F + 1, 100 * A):
for b in range(0, F + 1, 100 * B):
if a + b > F:
break
ws.add(a + b)
ws.remove(0)
ss = set()
for c in range(0, F + 1, C):
for d in range(0, F + 1, D):
if c + d > F:
br... | false | 3.846154 | [
"-for a in range(F + 1):",
"- if a * 100 * A > F:",
"- break",
"- for b in range(F + 1):",
"- if a * 100 * A + b * 100 * B > F:",
"+for a in range(0, F + 1, 100 * A):",
"+ for b in range(0, F + 1, 100 * B):",
"+ if a + b > F:",
"- ws.add(a * 100 * A + b * 100 * B... | false | 0.056351 | 0.048227 | 1.168434 | [
"s023150660",
"s545517105"
] |
u989345508 | p03103 | python | s304808560 | s714384961 | 526 | 477 | 29,796 | 27,756 | Accepted | Accepted | 9.32 | n,m=list(map(int,input().split()))
x,y=[],[]
x=sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0])
#小さい方から買うけど、余ったら減らす
#print(x)
for i in range(n):
#print(m)
c=m-x[i][1]
if c<=0:
s=0
for j in range(i+1):
#print(x[i])
s+=x[j][0]*x[... | n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort()
ans=0
for i in range(n):
if m>ab[i][1]:
ans+=ab[i][0]*ab[i][1]
m-=ab[i][1]
else:
ans+=ab[i][0]*m
print(ans)
break
| 18 | 12 | 391 | 266 | n, m = list(map(int, input().split()))
x, y = [], []
x = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[0])
# 小さい方から買うけど、余ったら減らす
# print(x)
for i in range(n):
# print(m)
c = m - x[i][1]
if c <= 0:
s = 0
for j in range(i + 1):
# print(x[i])
... | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
ans = 0
for i in range(n):
if m > ab[i][1]:
ans += ab[i][0] * ab[i][1]
m -= ab[i][1]
else:
ans += ab[i][0] * m
print(ans)
break
| false | 33.333333 | [
"-x, y = [], []",
"-x = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[0])",
"-# 小さい方から買うけど、余ったら減らす",
"-# print(x)",
"+ab = [list(map(int, input().split())) for i in range(n)]",
"+ab.sort()",
"+ans = 0",
"- # print(m)",
"- c = m - x[i][1]",
"- if c <= 0:",
"... | false | 0.048699 | 0.050489 | 0.964533 | [
"s304808560",
"s714384961"
] |
u561083515 | p03734 | python | s614137467 | s028055314 | 575 | 379 | 3,444 | 3,188 | Accepted | Accepted | 34.09 | import sys
input = sys.stdin.readline
from itertools import accumulate
N,W = list(map(int,input().split()))
WV = [[int(i) for i in input().split()] for _ in range(N)]
MINW = WV[0][0]
# それぞれの重さについての価値のリスト
W0 = sorted([0] + [v for w,v in WV if w == MINW])
W1 = sorted([0] + [v for w,v in WV if w == MINW+1])
... | N,W = list(map(int, input().split()))
WV = [[int(i) for i in input().split()] for _ in range(N)]
MINW = WV[0][0]
W0,W1,W2,W3 = [],[],[],[]
for w,v in WV:
if w == MINW: W0.append(v)
elif w == MINW + 1: W1.append(v)
elif w == MINW + 2: W2.append(v)
elif w == MINW + 3: W3.append(v)
W0.sort(r... | 42 | 47 | 1,273 | 1,159 | import sys
input = sys.stdin.readline
from itertools import accumulate
N, W = list(map(int, input().split()))
WV = [[int(i) for i in input().split()] for _ in range(N)]
MINW = WV[0][0]
# それぞれの重さについての価値のリスト
W0 = sorted([0] + [v for w, v in WV if w == MINW])
W1 = sorted([0] + [v for w, v in WV if w == MINW + 1])
W2 = s... | N, W = list(map(int, input().split()))
WV = [[int(i) for i in input().split()] for _ in range(N)]
MINW = WV[0][0]
W0, W1, W2, W3 = [], [], [], []
for w, v in WV:
if w == MINW:
W0.append(v)
elif w == MINW + 1:
W1.append(v)
elif w == MINW + 2:
W2.append(v)
elif w == MINW + 3:
... | false | 10.638298 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from itertools import accumulate",
"-",
"-# それぞれの重さについての価値のリスト",
"-W0 = sorted([0] + [v for w, v in WV if w == MINW])",
"-W1 = sorted([0] + [v for w, v in WV if w == MINW + 1])",
"-W2 = sorted([0] + [v for w, v in WV if w == MINW + 2])",
"-W3 = ... | false | 0.086735 | 0.04476 | 1.937791 | [
"s614137467",
"s028055314"
] |
u920103253 | p02681 | python | s079367788 | s123670022 | 27 | 24 | 9,152 | 9,132 | Accepted | Accepted | 11.11 | 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 n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(eval(input())) for _ in range(n)]
def ... |
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) ... | 15 | 21 | 437 | 695 | 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 n0():
return int(eval(input()))
def n1():
return [int(x) for x in input().split()]
def n2(n):
return [in... | def s0():
return input()
def s1():
return input().split()
def s2(n):
return [input() for x in range(n)]
def s3(n):
return [[input().split()] for _ in range(n)]
def n0():
return int(input())
def n1():
return [int(x) for x in input().split()]
def n2(n):
return [int(input()) for _ i... | false | 28.571429 | [
"- return eval(input())",
"+ return input()",
"- return [eval(input()) for x in range(n)]",
"+ return [input() for x in range(n)]",
"- return int(eval(input()))",
"+ return int(input())",
"- return [int(eval(input())) for _ in range(n)]",
"+ return [int(input()) for _ in range(... | false | 0.091805 | 0.04055 | 2.264026 | [
"s079367788",
"s123670022"
] |
u667024514 | p03864 | python | s954132901 | s734369852 | 123 | 92 | 14,052 | 14,052 | Accepted | Accepted | 25.2 | n,x = list(map(int,input().split()))
lis = list(map(int,input().split()))
cou = 0
if lis[0] > x:
cou += (lis[0] - x)
lis[0] -= (lis[0] -x)
for i in range(n-1):
if lis[i+1] + lis[i] > x:
cou += (lis[i+1] + lis[i] -x)
lis[i+1] -= (lis[i+1] + lis[i] -x)
print(cou) | n,k = list(map(int,input().split()))
lis = list(map(int,input().split()))
cou = lis[0]
ans = 0
if cou > k:
ans += cou-k
cou = k
for i in range(1,n):
if cou + lis[i] > k:
num = cou+lis[i]-k
cou = lis[i]-num
ans += num
else:
cou = lis[i]
print(ans) | 11 | 15 | 279 | 302 | n, x = list(map(int, input().split()))
lis = list(map(int, input().split()))
cou = 0
if lis[0] > x:
cou += lis[0] - x
lis[0] -= lis[0] - x
for i in range(n - 1):
if lis[i + 1] + lis[i] > x:
cou += lis[i + 1] + lis[i] - x
lis[i + 1] -= lis[i + 1] + lis[i] - x
print(cou)
| n, k = list(map(int, input().split()))
lis = list(map(int, input().split()))
cou = lis[0]
ans = 0
if cou > k:
ans += cou - k
cou = k
for i in range(1, n):
if cou + lis[i] > k:
num = cou + lis[i] - k
cou = lis[i] - num
ans += num
else:
cou = lis[i]
print(ans)
| false | 26.666667 | [
"-n, x = list(map(int, input().split()))",
"+n, k = list(map(int, input().split()))",
"-cou = 0",
"-if lis[0] > x:",
"- cou += lis[0] - x",
"- lis[0] -= lis[0] - x",
"-for i in range(n - 1):",
"- if lis[i + 1] + lis[i] > x:",
"- cou += lis[i + 1] + lis[i] - x",
"- lis[i + 1]... | false | 0.047368 | 0.04646 | 1.019542 | [
"s954132901",
"s734369852"
] |
u926046014 | p02959 | python | s911167401 | s595415235 | 135 | 123 | 18,624 | 18,624 | Accepted | Accepted | 8.89 | n = int(eval(input()))
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
assist = 0
kill = 0
for i in range(n):
if assist+b[i] < a[i]:
kill += assist+b[i]
assist = 0
else:
if assist <= a[i]:
kill += a[i]
assist += b[i] - a... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
assist = 0
kill = 0
for i in range(n):
if assist+b[i] < a[i]:
kill += assist+b[i]
assist = 0
else:
if assist <= a[i]:
kill += a[i]
assist += b[i] - a[i]
... | 25 | 25 | 501 | 497 | n = int(eval(input()))
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
assist = 0
kill = 0
for i in range(n):
if assist + b[i] < a[i]:
kill += assist + b[i]
assist = 0
else:
if assist <= a[i]:
kill += a[i]
assist += b[i] - a[i]
... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
assist = 0
kill = 0
for i in range(n):
if assist + b[i] < a[i]:
kill += assist + b[i]
assist = 0
else:
if assist <= a[i]:
kill += a[i]
assist += b[i] - a[i]
else... | false | 0 | [
"-a = [int(x) for x in input().split()]",
"-b = [int(x) for x in input().split()]",
"+a = list(map(int, input().split()))",
"+b = list(map(int, input().split()))"
] | false | 0.040749 | 0.044215 | 0.921622 | [
"s911167401",
"s595415235"
] |
u165368960 | p02830 | python | s791136318 | s054706601 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
s, t =list(map(str, input().split()))
ans_list = [0] * n
for i in range(n):
ans_list[i] = s[i] + t[i]
print(("".join(ans_list))) | n = int(eval(input()))
s, t =list(map(str, input().split()))
ans = ""
for i in range(n):
ans += s[i]
ans += t[i]
print(ans) | 8 | 9 | 148 | 125 | n = int(eval(input()))
s, t = list(map(str, input().split()))
ans_list = [0] * n
for i in range(n):
ans_list[i] = s[i] + t[i]
print(("".join(ans_list)))
| n = int(eval(input()))
s, t = list(map(str, input().split()))
ans = ""
for i in range(n):
ans += s[i]
ans += t[i]
print(ans)
| false | 11.111111 | [
"-ans_list = [0] * n",
"+ans = \"\"",
"- ans_list[i] = s[i] + t[i]",
"-print((\"\".join(ans_list)))",
"+ ans += s[i]",
"+ ans += t[i]",
"+print(ans)"
] | false | 0.045376 | 0.045255 | 1.002662 | [
"s791136318",
"s054706601"
] |
u492605584 | p03164 | python | s667284909 | s292196170 | 1,021 | 446 | 308,296 | 119,916 | Accepted | Accepted | 56.32 | N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
V = 0
for i in range(N):
V += L[i][1]
dp = [[float('inf')] * (V + 1) for i in range(N+1)]
dp[0][0] = 0
for i in range(N):
for j in range(V+1):
if j - L[i][1] >= 0:
dp[i+1][j] = min(dp[i][j]... | N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
V = 0
for i in range(N):
V += L[i][1]
dp = [[10**9+1] * (V + 1) for i in range(N+1)]
dp[0][0] = 0
for i in range(N):
for j in range(V+1):
if j - L[i][1] >= 0:
dp[i+1][j] = min(dp[i][j], dp[... | 19 | 19 | 486 | 481 | N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
V = 0
for i in range(N):
V += L[i][1]
dp = [[float("inf")] * (V + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(V + 1):
if j - L[i][1] >= 0:
dp[i + 1][j] = min(dp[i][j], ... | N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
V = 0
for i in range(N):
V += L[i][1]
dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(V + 1):
if j - L[i][1] >= 0:
dp[i + 1][j] = min(dp[i][j], dp[... | false | 0 | [
"-dp = [[float(\"inf\")] * (V + 1) for i in range(N + 1)]",
"+dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]"
] | false | 0.060143 | 0.101214 | 0.594219 | [
"s667284909",
"s292196170"
] |
u886274153 | p03166 | python | s966126492 | s014695267 | 808 | 732 | 42,208 | 42,320 | Accepted | Accepted | 9.41 | import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])
lendc = collections.defaultdict(lambda: -1)
for k in range(m):
i, j = [int(n) for n in input().split()]
todc[j] += [i]
def maxlen(n):
if len(todc[n]) == 0:
lendc[n] = 0
re... | import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])
lendc = collections.defaultdict(lambda: -1)
for k in range(m):
i, j = [int(n) for n in input().split()]
todc[j] += [i]
def maxlen(n):
if len(todc[n]) == 0:
lendc[n] = 0
re... | 51 | 53 | 1,212 | 1,270 | import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])
lendc = collections.defaultdict(lambda: -1)
for k in range(m):
i, j = [int(n) for n in input().split()]
todc[j] += [i]
def maxlen(n):
if len(todc[n]) == 0:
lendc[n] = 0
return 0
else... | import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])
lendc = collections.defaultdict(lambda: -1)
for k in range(m):
i, j = [int(n) for n in input().split()]
todc[j] += [i]
def maxlen(n):
if len(todc[n]) == 0:
lendc[n] = 0
return 0
else... | false | 3.773585 | [
"+ if lendc[n] != -1:",
"+ continue"
] | false | 0.038986 | 0.08491 | 0.459142 | [
"s966126492",
"s014695267"
] |
u546285759 | p00353 | python | s840382106 | s306475046 | 60 | 20 | 7,700 | 7,708 | Accepted | Accepted | 66.67 | m, f, b = list(map(int, input().split()))
print(("NA" if m+f < b else max(0, b-m))) | m, f, b = list(map(int, input().split()))
print(("NA"*(m+f < b) + (m+f >= b)*str(max(0, b-m)))) | 2 | 2 | 76 | 88 | m, f, b = list(map(int, input().split()))
print(("NA" if m + f < b else max(0, b - m)))
| m, f, b = list(map(int, input().split()))
print(("NA" * (m + f < b) + (m + f >= b) * str(max(0, b - m))))
| false | 0 | [
"-print((\"NA\" if m + f < b else max(0, b - m)))",
"+print((\"NA\" * (m + f < b) + (m + f >= b) * str(max(0, b - m))))"
] | false | 0.044406 | 0.044042 | 1.008251 | [
"s840382106",
"s306475046"
] |
u020390084 | p03361 | python | s866692416 | s535611134 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | h,w = list(map(int,input().split()))
cambus = [list(eval(input())) for _ in range(h)]
import sys
for i in range(h):
for j in range(w):
if cambus[i][j]=="#":
b = []
if i != 0:
b.append(cambus[i-1][j] == "#")
if i != h-1:
b.append(cambus[i+1][j] == "#")
if j != 0:
... | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(H: int, W: int, s: "List[str]"):
s = ["."*(W+2)]+["."+ss+"." for ss in s]+["."*(W+2)]
direction = ((0,1),(1,0),(0,-1),(-1,0))
# 全ての黒マスの上下左右に一つでも黒マスがあればおk
for i in range(H+2):
for j in... | 22 | 41 | 503 | 991 | h, w = list(map(int, input().split()))
cambus = [list(eval(input())) for _ in range(h)]
import sys
for i in range(h):
for j in range(w):
if cambus[i][j] == "#":
b = []
if i != 0:
b.append(cambus[i - 1][j] == "#")
if i != h - 1:
b.append(ca... | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(H: int, W: int, s: "List[str]"):
s = ["." * (W + 2)] + ["." + ss + "." for ss in s] + ["." * (W + 2)]
direction = ((0, 1), (1, 0), (0, -1), (-1, 0))
# 全ての黒マスの上下左右に一つでも黒マスがあればおk
for i in range(H + 2):
f... | false | 46.341463 | [
"-h, w = list(map(int, input().split()))",
"-cambus = [list(eval(input())) for _ in range(h)]",
"+#!/usr/bin/env python3",
"-for i in range(h):",
"- for j in range(w):",
"- if cambus[i][j] == \"#\":",
"- b = []",
"- if i != 0:",
"- b.append(cambus[i - 1... | false | 0.0415 | 0.038041 | 1.090912 | [
"s866692416",
"s535611134"
] |
u285891772 | p03835 | python | s034691664 | s788960714 | 1,787 | 1,626 | 15,236 | 15,300 | Accepted | Accepted | 9.01 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | 31 | 32 | 946 | 942 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | false | 3.125 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2",
"+import numpy as np",
"-import numpy as np",
"-",
"-count = 0",
"-for X in range(0, K + 1):",
"- for Y in range(0, K + 1):",
"+ans = 0",
"+for... | false | 0.0404 | 0.039633 | 1.019355 | [
"s034691664",
"s788960714"
] |
u997648604 | p02693 | python | s333872511 | s596120383 | 106 | 92 | 27,208 | 61,644 | Accepted | Accepted | 13.21 | import itertools
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
import bisect
import sys
sys.setrecursionlimit(10**9)
def main():
K = int(eval(input()))
A,B = list(map(in... | import sys
sys.setrecursionlimit(10**9)
def mi(): return list(map(int,input().split()))
def ii(): return int(eval(input()))
def isp(): return input().split()
def deb(text): print(("-------\n{}\n-------".format(text)))
INF=10**20
def main():
K=ii()
A,B=mi()
for x in range(A,B+1):
if ... | 30 | 26 | 506 | 431 | import itertools
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
import bisect
import sys
sys.setrecursionlimit(10**9)
def main():
K = int(eval(input()))
A, B = list(map(int, input().... | import sys
sys.setrecursionlimit(10**9)
def mi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def isp():
return input().split()
def deb(text):
print(("-------\n{}\n-------".format(text)))
INF = 10**20
def main():
K = ii()
A, B = mi()
for x in range... | false | 13.333333 | [
"-import itertools",
"-import math",
"-import numpy as np",
"-import fractions",
"-from collections import deque",
"-from itertools import combinations",
"-from functools import reduce",
"-from functools import lru_cache",
"-import bisect",
"+def mi():",
"+ return list(map(int, input().split(... | false | 0.036354 | 0.035044 | 1.0374 | [
"s333872511",
"s596120383"
] |
u811967730 | p02759 | python | s282839227 | s741182558 | 179 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.5 | N = int(eval(input()))
ans = N // 2 + N % 2
print(ans)
| N = int(eval(input()))
ans = (N + 1) // 2
print(ans)
| 5 | 5 | 55 | 53 | N = int(eval(input()))
ans = N // 2 + N % 2
print(ans)
| N = int(eval(input()))
ans = (N + 1) // 2
print(ans)
| false | 0 | [
"-ans = N // 2 + N % 2",
"+ans = (N + 1) // 2"
] | false | 0.053672 | 0.052848 | 1.015603 | [
"s282839227",
"s741182558"
] |
u644907318 | p02755 | python | s235071804 | s411580513 | 196 | 178 | 39,024 | 38,384 | Accepted | Accepted | 9.18 | A,B = list(map(int,input().split()))
x = -1
for i in range(1,20000):
if int(i*1.08)-i==A and int(i*1.1)-i==B:
x = i
break
print(x) | A,B = list(map(int,input().split()))
a1 = A/0.08
if a1!=int(A/0.08):
a1 = int(A/0.08)+1
else:
a1 = int(A/0.08)
a2 = (A+1)/0.08
if a2!=int((A+1)/0.08):
a2 = int((A+1)/0.08)+1
else:
a2 = int((A+1)/0.08)
b1 = B/0.1
if b1!=int(B/0.1):
b1 = int(B/0.1)+1
else:
b1 = int(B/0.1)
b2 = (B+1... | 7 | 29 | 150 | 515 | A, B = list(map(int, input().split()))
x = -1
for i in range(1, 20000):
if int(i * 1.08) - i == A and int(i * 1.1) - i == B:
x = i
break
print(x)
| A, B = list(map(int, input().split()))
a1 = A / 0.08
if a1 != int(A / 0.08):
a1 = int(A / 0.08) + 1
else:
a1 = int(A / 0.08)
a2 = (A + 1) / 0.08
if a2 != int((A + 1) / 0.08):
a2 = int((A + 1) / 0.08) + 1
else:
a2 = int((A + 1) / 0.08)
b1 = B / 0.1
if b1 != int(B / 0.1):
b1 = int(B / 0.1) + 1
else:
... | false | 75.862069 | [
"+a1 = A / 0.08",
"+if a1 != int(A / 0.08):",
"+ a1 = int(A / 0.08) + 1",
"+else:",
"+ a1 = int(A / 0.08)",
"+a2 = (A + 1) / 0.08",
"+if a2 != int((A + 1) / 0.08):",
"+ a2 = int((A + 1) / 0.08) + 1",
"+else:",
"+ a2 = int((A + 1) / 0.08)",
"+b1 = B / 0.1",
"+if b1 != int(B / 0.1):"... | false | 0.053927 | 0.071661 | 0.752529 | [
"s235071804",
"s411580513"
] |
u556589653 | p03125 | python | s849206872 | s734612194 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int,input().split()))
if B % A == 0:
print((A + B))
else:
print((B - A)) | a,b=list(map(int,input().split()))
if b%a== 0:
print((a+b))
else:
print((b-a)) | 5 | 5 | 86 | 80 | A, B = list(map(int, input().split()))
if B % A == 0:
print((A + B))
else:
print((B - A))
| a, b = list(map(int, input().split()))
if b % a == 0:
print((a + b))
else:
print((b - a))
| false | 0 | [
"-A, B = list(map(int, input().split()))",
"-if B % A == 0:",
"- print((A + B))",
"+a, b = list(map(int, input().split()))",
"+if b % a == 0:",
"+ print((a + b))",
"- print((B - A))",
"+ print((b - a))"
] | false | 0.047894 | 0.045874 | 1.044048 | [
"s849206872",
"s734612194"
] |
u949115942 | p02837 | python | s216001739 | s340353046 | 1,959 | 262 | 3,064 | 3,064 | Accepted | Accepted | 86.63 | n = int(eval(input()))
XY = []
for i in range(n):
a = int(eval(input()))
xy = []
for j in range(a):
xy.append(list(map(int, input().split())))
XY.append(xy)
def check(i, xiyj, HoU):
# 矛盾したらFalse 正直者と仮定した証言より 正直&正直者と仮定されている / 不親切&不親切と仮定されている True
if ((i >> xiyj) &... | n = int(eval(input()))
XY = []
for i in range(n):
a = int(eval(input()))
xy = []
for j in range(a):
xy.append(list(map(int, input().split())))
XY.append(xy)
def check(i, xiyj, HoU):
# 矛盾したらFalse 正直者と仮定した証言より 正直&正直者と仮定されている / 不親切&不親切と仮定されている True
if ((i >> xiyj) & ... | 41 | 44 | 1,002 | 1,065 | n = int(eval(input()))
XY = []
for i in range(n):
a = int(eval(input()))
xy = []
for j in range(a):
xy.append(list(map(int, input().split())))
XY.append(xy)
def check(i, xiyj, HoU):
# 矛盾したらFalse 正直者と仮定した証言より 正直&正直者と仮定されている / 不親切&不親切と仮定されている True
if ((i >> xiyj) & 1) ^ HoU:
retu... | n = int(eval(input()))
XY = []
for i in range(n):
a = int(eval(input()))
xy = []
for j in range(a):
xy.append(list(map(int, input().split())))
XY.append(xy)
def check(i, xiyj, HoU):
# 矛盾したらFalse 正直者と仮定した証言より 正直&正直者と仮定されている / 不親切&不親切と仮定されている True
if ((i >> xiyj) & 1) ^ HoU:
retu... | false | 6.818182 | [
"- honest = [0] * len(XY)",
"+ break",
"+ if not is_contradiction:",
"+ break"
] | false | 0.043931 | 0.037989 | 1.156394 | [
"s216001739",
"s340353046"
] |
u150984829 | p02396 | python | s679213974 | s434993232 | 130 | 70 | 5,612 | 6,296 | Accepted | Accepted | 46.15 | i=1
while True:
n=eval(input())
if int(n)==0:break
print(f'Case {i}: {n}')
i+=1 | a=[]
b=a.append
while True:
n=eval(input())
if int(n)==0:break
b(n)
for i in range(len(a)):print(f'Case {i+1}: {a[i]}') | 6 | 7 | 82 | 122 | i = 1
while True:
n = eval(input())
if int(n) == 0:
break
print(f"Case {i}: {n}")
i += 1
| a = []
b = a.append
while True:
n = eval(input())
if int(n) == 0:
break
b(n)
for i in range(len(a)):
print(f"Case {i+1}: {a[i]}")
| false | 14.285714 | [
"-i = 1",
"+a = []",
"+b = a.append",
"- print(f\"Case {i}: {n}\")",
"- i += 1",
"+ b(n)",
"+for i in range(len(a)):",
"+ print(f\"Case {i+1}: {a[i]}\")"
] | false | 0.035368 | 0.041551 | 0.8512 | [
"s679213974",
"s434993232"
] |
u761320129 | p03329 | python | s397082614 | s927475540 | 209 | 125 | 21,488 | 3,064 | Accepted | Accepted | 40.19 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
wd = [1]
n = 1
while 6**n <= N:
wd.append(6**n)
n += 1
n = 1
while 9**n <= N:
wd.append(9**n)
n += 1
if N in wd:
print((1))
exit()
wd.sort()
INF = float('inf')
mem = [INF] * (N+1)
def dfs(n):
if mem[n] != I... | import itertools
N = int(eval(input()))
sixs = [6, 36, 216, 1296, 7776, 46656]
ans = N
for ptn in itertools.product(list(range(6)), repeat=6):
money = ope = 0
for s,p in zip(sixs,ptn):
money += s*p
ope += p
if money > N: continue
if ope > ans: continue
rem = N - money
... | 31 | 19 | 501 | 401 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
wd = [1]
n = 1
while 6**n <= N:
wd.append(6**n)
n += 1
n = 1
while 9**n <= N:
wd.append(9**n)
n += 1
if N in wd:
print((1))
exit()
wd.sort()
INF = float("inf")
mem = [INF] * (N + 1)
def dfs(n):
if mem[n] != INF:
return... | import itertools
N = int(eval(input()))
sixs = [6, 36, 216, 1296, 7776, 46656]
ans = N
for ptn in itertools.product(list(range(6)), repeat=6):
money = ope = 0
for s, p in zip(sixs, ptn):
money += s * p
ope += p
if money > N:
continue
if ope > ans:
continue
rem = N - ... | false | 38.709677 | [
"-import sys",
"+import itertools",
"-sys.setrecursionlimit(10**7)",
"-wd = [1]",
"-n = 1",
"-while 6**n <= N:",
"- wd.append(6**n)",
"- n += 1",
"-n = 1",
"-while 9**n <= N:",
"- wd.append(9**n)",
"- n += 1",
"-if N in wd:",
"- print((1))",
"- exit()",
"-wd.sort()",
... | false | 0.054178 | 0.158249 | 0.342358 | [
"s397082614",
"s927475540"
] |
u941438707 | p03637 | python | s423389648 | s202402697 | 83 | 64 | 14,252 | 14,252 | Accepted | Accepted | 22.89 | n=int(eval(input()))
a=list(map(int, input().split()))
i=0
odd=0
even=0
eveneven=0
while i<n:
if a[i]%4==0:
eveneven+=1
elif a[i]%2==0:
even+=1
else:
odd+=1
i+=1
if even==0 and eveneven>=(odd-1):
print("Yes")
elif even!=0 and eveneven>=odd:
print("Yes... | # whileだと実行時間83msだったけどforでは?
n=int(eval(input()))
a=list(map(int, input().split()))
i=0
odd=0
even=0
eveneven=0
for i in a:
if i%4==0:
eveneven+=1
elif i%2==0:
even+=1
else:
odd+=1
if even==0 and eveneven>=(odd-1):
print("Yes")
elif even!=0 and eveneven>=odd:
... | 20 | 20 | 340 | 353 | n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
odd = 0
even = 0
eveneven = 0
while i < n:
if a[i] % 4 == 0:
eveneven += 1
elif a[i] % 2 == 0:
even += 1
else:
odd += 1
i += 1
if even == 0 and eveneven >= (odd - 1):
print("Yes")
elif even != 0 and eveneven >= ... | # whileだと実行時間83msだったけどforでは?
n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
odd = 0
even = 0
eveneven = 0
for i in a:
if i % 4 == 0:
eveneven += 1
elif i % 2 == 0:
even += 1
else:
odd += 1
if even == 0 and eveneven >= (odd - 1):
print("Yes")
elif even != 0 and e... | false | 0 | [
"+# whileだと実行時間83msだったけどforでは?",
"-while i < n:",
"- if a[i] % 4 == 0:",
"+for i in a:",
"+ if i % 4 == 0:",
"- elif a[i] % 2 == 0:",
"+ elif i % 2 == 0:",
"- i += 1"
] | false | 0.036334 | 0.037806 | 0.961055 | [
"s423389648",
"s202402697"
] |
u077291787 | p03680 | python | s927698865 | s234281447 | 188 | 82 | 13,356 | 13,740 | Accepted | Accepted | 56.38 | # ABC065B - Trained?
n = int(eval(input()))
lst = list(map(int, [input().rstrip() for _ in range(n)]))
button = lst[0]
count = 0
for _ in range(n):
count += 1
if button == 2:
break
button = lst[button - 1]
else:
count = -1
print(count) | # ABC065B - Trained?
import sys
input = sys.stdin.readline
n = int(eval(input()))
lst = list(map(int, [input().rstrip() for _ in range(n)]))
button = lst[0]
count = 0
for _ in range(n):
count += 1
if button == 2:
break
button = lst[button - 1]
else:
count = -1
print(count) | 13 | 16 | 265 | 307 | # ABC065B - Trained?
n = int(eval(input()))
lst = list(map(int, [input().rstrip() for _ in range(n)]))
button = lst[0]
count = 0
for _ in range(n):
count += 1
if button == 2:
break
button = lst[button - 1]
else:
count = -1
print(count)
| # ABC065B - Trained?
import sys
input = sys.stdin.readline
n = int(eval(input()))
lst = list(map(int, [input().rstrip() for _ in range(n)]))
button = lst[0]
count = 0
for _ in range(n):
count += 1
if button == 2:
break
button = lst[button - 1]
else:
count = -1
print(count)
| false | 18.75 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.036455 | 0.035962 | 1.013715 | [
"s927698865",
"s234281447"
] |
u006657459 | p03944 | python | s374621412 | s630665016 | 70 | 17 | 3,064 | 3,064 | Accepted | Accepted | 75.71 | fn = lambda: list(map(int, input().split()))
W, H, N = fn()
A = [[1 for _ in range(W)] for _ in range(H)]
for _ in range(N):
x, y, a = fn()
if a == 1:
for i in range(H):
for j in range(x):
A[i][j] = 0
elif a == 2:
for i in range(H):
for j in... | fn = lambda: list(map(int, input().split()))
W, H, N = fn()
min_x, max_x = 0, W
min_y, max_y = 0, H
for i in range(N):
xi, yi, ai = fn()
if ai == 1:
min_x = max(xi, min_x)
elif ai == 2:
max_x = min(xi, max_x)
elif ai == 3:
min_y = max(yi, min_y)
elif ai == 4:
... | 25 | 18 | 656 | 442 | fn = lambda: list(map(int, input().split()))
W, H, N = fn()
A = [[1 for _ in range(W)] for _ in range(H)]
for _ in range(N):
x, y, a = fn()
if a == 1:
for i in range(H):
for j in range(x):
A[i][j] = 0
elif a == 2:
for i in range(H):
for j in range(x, W... | fn = lambda: list(map(int, input().split()))
W, H, N = fn()
min_x, max_x = 0, W
min_y, max_y = 0, H
for i in range(N):
xi, yi, ai = fn()
if ai == 1:
min_x = max(xi, min_x)
elif ai == 2:
max_x = min(xi, max_x)
elif ai == 3:
min_y = max(yi, min_y)
elif ai == 4:
max_y = ... | false | 28 | [
"-A = [[1 for _ in range(W)] for _ in range(H)]",
"-for _ in range(N):",
"- x, y, a = fn()",
"- if a == 1:",
"- for i in range(H):",
"- for j in range(x):",
"- A[i][j] = 0",
"- elif a == 2:",
"- for i in range(H):",
"- for j in range(x, W... | false | 0.037173 | 0.042032 | 0.884411 | [
"s374621412",
"s630665016"
] |
u863442865 | p03488 | python | s543497799 | s659985209 | 757 | 18 | 80,604 | 3,188 | Accepted | Accepted | 97.62 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | def main():
import sys
input = sys.stdin.readline
s = input().rstrip()
x,y = list(map(int, input().split()))
f = s.split('T')
dx_list = list(map(len, f[::2]))
dy_list = list(map(len, f[1::2]))
nx = dx_list.pop(0)
ny = 0
dx_list.sort(reverse=True)
dy_list.... | 58 | 34 | 1,631 | 669 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | def main():
import sys
input = sys.stdin.readline
s = input().rstrip()
x, y = list(map(int, input().split()))
f = s.split("T")
dx_list = list(map(len, f[::2]))
dy_list = list(map(len, f[1::2]))
nx = dx_list.pop(0)
ny = 0
dx_list.sort(reverse=True)
dy_list.sort(reverse=True)
... | false | 41.37931 | [
"- sys.setrecursionlimit(10**7)",
"- from collections import Counter, deque",
"-",
"- # from collections import defaultdict",
"- from itertools import combinations, permutations, accumulate, groupby",
"-",
"- # from itertools import product",
"- from bisect import bisect_left, bisect... | false | 0.140014 | 0.046935 | 2.983149 | [
"s543497799",
"s659985209"
] |
u761320129 | p03126 | python | s716117572 | s125504513 | 23 | 21 | 3,316 | 3,316 | Accepted | Accepted | 8.7 | from collections import Counter
N,M = list(map(int,input().split()))
src = [tuple(map(int,input().split())) for i in range(N)]
ctr = Counter()
for row in src:
ctr += Counter(row[1:])
ans = 0
for v in list(ctr.values()):
if v==N:
ans += 1
print(ans) | N,M = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
from collections import Counter
c = Counter()
for a in A:
c += Counter(a[1:])
ans = 0
for v in list(c.values()):
if v==N: ans += 1
print(ans) | 12 | 10 | 264 | 238 | from collections import Counter
N, M = list(map(int, input().split()))
src = [tuple(map(int, input().split())) for i in range(N)]
ctr = Counter()
for row in src:
ctr += Counter(row[1:])
ans = 0
for v in list(ctr.values()):
if v == N:
ans += 1
print(ans)
| N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
from collections import Counter
c = Counter()
for a in A:
c += Counter(a[1:])
ans = 0
for v in list(c.values()):
if v == N:
ans += 1
print(ans)
| false | 16.666667 | [
"+N, M = list(map(int, input().split()))",
"+A = [list(map(int, input().split())) for i in range(N)]",
"-N, M = list(map(int, input().split()))",
"-src = [tuple(map(int, input().split())) for i in range(N)]",
"-ctr = Counter()",
"-for row in src:",
"- ctr += Counter(row[1:])",
"+c = Counter()",
"... | false | 0.042275 | 0.042102 | 1.004112 | [
"s716117572",
"s125504513"
] |
u151785909 | p03557 | python | s543941122 | s633067202 | 1,082 | 960 | 67,380 | 23,328 | Accepted | Accepted | 11.28 | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
t = 0
ans = 0
u =[0]*n
d =[0]*n
a2 =[]
b2 =[]
c2 =[]
for i in range(n):
a2.append([2,a[i]])
for i in range(n):
b2.append([1,b[i]])
for i in range(n):
c2.append([0... | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
def n_smaller_a(num):
if num>a[n-1]:
return n
if num<=a[0]:
return 0
left=0
right=n-1
mid=(left+right)//2
... | 44 | 53 | 750 | 994 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
t = 0
ans = 0
u = [0] * n
d = [0] * n
a2 = []
b2 = []
c2 = []
for i in range(n):
a2.append([2, a[i]])
for i in range(n):
b2.append([1, b[i]])
for i in range(n):
c2.append([0, c[... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
def n_smaller_a(num):
if num > a[n - 1]:
return n
if num <= a[0]:
return 0
left = 0
right = n - 1
mid = (left + right) // 2
... | false | 16.981132 | [
"-t = 0",
"+a.sort()",
"+b.sort()",
"+c.sort()",
"+",
"+",
"+def n_smaller_a(num):",
"+ if num > a[n - 1]:",
"+ return n",
"+ if num <= a[0]:",
"+ return 0",
"+ left = 0",
"+ right = n - 1",
"+ mid = (left + right) // 2",
"+ while right - left > 1:",
"+ ... | false | 0.155506 | 0.039601 | 3.926817 | [
"s543941122",
"s633067202"
] |
u557168336 | p02886 | python | s488528930 | s799795990 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | import sys
input = sys.stdin.readline
N = int(eval(input()))
vD = list(map(int, input().split()))
res = 0
for x in range(0, N-1):
for y in range(x+1, N):
res += vD[x] * vD[y]
print(res)
| N = int(eval(input()))
vA = list(map(int, input().split()))
res = 0
cs = 0
for a in vA:
res += cs * a
cs += a
print(res)
| 12 | 9 | 197 | 128 | import sys
input = sys.stdin.readline
N = int(eval(input()))
vD = list(map(int, input().split()))
res = 0
for x in range(0, N - 1):
for y in range(x + 1, N):
res += vD[x] * vD[y]
print(res)
| N = int(eval(input()))
vA = list(map(int, input().split()))
res = 0
cs = 0
for a in vA:
res += cs * a
cs += a
print(res)
| false | 25 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-vD = list(map(int, input().split()))",
"+vA = list(map(int, input().split()))",
"-for x in range(0, N - 1):",
"- for y in range(x + 1, N):",
"- res += vD[x] * vD[y]",
"+cs = 0",
"+for a in vA:",
"+ res += cs * a",
"+ cs += a"... | false | 0.046728 | 0.008037 | 5.813733 | [
"s488528930",
"s799795990"
] |
u197300773 | p02659 | python | s408468873 | s999353065 | 65 | 60 | 61,952 | 62,000 | Accepted | Accepted | 7.69 | import math
a,b=[x for x in input().split()]
a=int(a)
b=round(float(b)*100)
print((int(a*b//100))) | import math
a,b=[x for x in input().split()]
a=int(a)
b=round(float(b)*100)
print((a*b//100)) | 5 | 5 | 103 | 98 | import math
a, b = [x for x in input().split()]
a = int(a)
b = round(float(b) * 100)
print((int(a * b // 100)))
| import math
a, b = [x for x in input().split()]
a = int(a)
b = round(float(b) * 100)
print((a * b // 100))
| false | 0 | [
"-print((int(a * b // 100)))",
"+print((a * b // 100))"
] | false | 0.042391 | 0.035116 | 1.20716 | [
"s408468873",
"s999353065"
] |
u312025627 | p03087 | python | s196820044 | s727559703 | 1,000 | 412 | 52,668 | 25,200 | Accepted | Accepted | 58.8 | def main():
N, Q = (int(i) for i in input().split())
S = eval(input())
C = [0] * (len(S) + 1)
for i in range(1, len(S)):
C[i+1] = C[i] + (1 if S[i] == "C" and S[i-1] == "A" else 0)
for q in range(Q):
le, ri = (int(i) for i in input().split())
print((C[ri] - C[le]))
... | def main():
N, Q = (int(i) for i in input().split())
S = eval(input())
LR = [[int(i) for i in input().split()] for j in range(Q)]
AC = [0]*N
for i, s in enumerate(S):
AC[i] = AC[i-1]
if i > 0 and S[i-1] == "A" and s == "C":
AC[i] += 1
S = list([0] + AC)
... | 14 | 16 | 356 | 406 | def main():
N, Q = (int(i) for i in input().split())
S = eval(input())
C = [0] * (len(S) + 1)
for i in range(1, len(S)):
C[i + 1] = C[i] + (1 if S[i] == "C" and S[i - 1] == "A" else 0)
for q in range(Q):
le, ri = (int(i) for i in input().split())
print((C[ri] - C[le]))
if _... | def main():
N, Q = (int(i) for i in input().split())
S = eval(input())
LR = [[int(i) for i in input().split()] for j in range(Q)]
AC = [0] * N
for i, s in enumerate(S):
AC[i] = AC[i - 1]
if i > 0 and S[i - 1] == "A" and s == "C":
AC[i] += 1
S = list([0] + AC)
for ... | false | 12.5 | [
"- C = [0] * (len(S) + 1)",
"- for i in range(1, len(S)):",
"- C[i + 1] = C[i] + (1 if S[i] == \"C\" and S[i - 1] == \"A\" else 0)",
"- for q in range(Q):",
"- le, ri = (int(i) for i in input().split())",
"- print((C[ri] - C[le]))",
"+ LR = [[int(i) for i in input().spli... | false | 0.065458 | 0.035046 | 1.867794 | [
"s196820044",
"s727559703"
] |
u261103969 | p02614 | python | s575584171 | s683933089 | 76 | 57 | 68,224 | 9,188 | Accepted | Accepted | 25 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
from itertools import product
h, w, k = list(map(int, readline().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for row_bit in product(list(ra... | from itertools import product
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for row_bit in product(list(range(2)), repeat=h):
for col_bit in product(list(range(2)), repeat=w):
cnt = 0
for row in range(h):
for col in range(w):
... | 31 | 18 | 696 | 459 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
from itertools import product
h, w, k = list(map(int, readline().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for row_bit in product(list(range(2)), repeat=h):
... | from itertools import product
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for row_bit in product(list(range(2)), repeat=h):
for col_bit in product(list(range(2)), repeat=w):
cnt = 0
for row in range(h):
for col in range(w):
... | false | 41.935484 | [
"-import sys",
"+from itertools import product",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- from itertools import product",
"-",
"- h, w, k = list(map(int, readline().split()))",
"- c =... | false | 0.047904 | 0.123684 | 0.387311 | [
"s575584171",
"s683933089"
] |
u695474809 | p02707 | python | s825517029 | s456930435 | 173 | 147 | 33,992 | 32,164 | Accepted | Accepted | 15.03 | import collections
N = int(eval(input()))
number = list(map(int,input().split()))
number = collections.Counter(number)
for i in range(1,N+1):
if i in number:
print((number[i]))
else:
print("0")
| N = int(eval(input()))
number = list(map(int,input().split()))
ans = [0]*N
for i in number:
ans[i-1] += 1
for i in ans:
print(i)
| 9 | 8 | 218 | 139 | import collections
N = int(eval(input()))
number = list(map(int, input().split()))
number = collections.Counter(number)
for i in range(1, N + 1):
if i in number:
print((number[i]))
else:
print("0")
| N = int(eval(input()))
number = list(map(int, input().split()))
ans = [0] * N
for i in number:
ans[i - 1] += 1
for i in ans:
print(i)
| false | 11.111111 | [
"-import collections",
"-",
"-number = collections.Counter(number)",
"-for i in range(1, N + 1):",
"- if i in number:",
"- print((number[i]))",
"- else:",
"- print(\"0\")",
"+ans = [0] * N",
"+for i in number:",
"+ ans[i - 1] += 1",
"+for i in ans:",
"+ print(i)"
] | false | 0.045493 | 0.04041 | 1.125787 | [
"s825517029",
"s456930435"
] |
u677121387 | p03127 | python | s628396073 | s768909354 | 96 | 60 | 14,252 | 14,252 | Accepted | Accepted | 37.5 | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
for i in range(1,n):
while a[i]%a[0] != 0:
a[0],a[i] = a[i]%a[0],a[0]
else:
ans = a[0]
print(ans) | n = int(eval(input()))
a = list(map(int,input().split()))
for i in range(1,n):
while a[i]%a[0] != 0:
a[0],a[i] = a[i]%a[0],a[0]
else:
ans = a[0]
print(ans)
| 11 | 10 | 186 | 177 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
for i in range(1, n):
while a[i] % a[0] != 0:
a[0], a[i] = a[i] % a[0], a[0]
else:
ans = a[0]
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(1, n):
while a[i] % a[0] != 0:
a[0], a[i] = a[i] % a[0], a[0]
else:
ans = a[0]
print(ans)
| false | 9.090909 | [
"-a.sort()"
] | false | 0.041932 | 0.042667 | 0.982789 | [
"s628396073",
"s768909354"
] |
u465699806 | p03401 | python | s841806058 | s967842394 | 820 | 385 | 118,800 | 65,696 | Accepted | Accepted | 53.05 | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def dump(*objects):
print(*objects, file=sys.stderr)
N = int(input())
A = [0] + list(map(int, input().split())) + [0]
dump(N, A)
B = cp.deepcop... | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
B[i] = B[i-1]... | 30 | 18 | 675 | 486 | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def dump(*objects):
print(*objects, file=sys.stderr)
N = int(input())
A = [0] + list(map(int, input().split())) + [0]
dump(N, A)
B = cp.deepcopy(A)
C = cp.dee... | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
B[i] = B[i - 1] + abs(A[i]... | false | 40 | [
"-",
"-",
"-def dump(*objects):",
"- print(*objects, file=sys.stderr)",
"-",
"-",
"-N = int(input())",
"+N = int(eval(input()))",
"-dump(N, A)",
"- dump(i)",
"- dump(i)",
"-dump(A, B, C)",
"- dump(i, B[i - 1] + B[N + 1] - B[i + 1] + abs(A[i - 1] - A[i + 1]))",
"- print(B[i -... | false | 0.039206 | 0.041205 | 0.951485 | [
"s841806058",
"s967842394"
] |
u836737505 | p03478 | python | s139212700 | s546854981 | 37 | 34 | 2,940 | 3,060 | Accepted | Accepted | 8.11 | n,a,b = list(map(int, input().split()))
c =0
for i in range(1,n+1):
d = sum(int(j) for j in list(str(i)))
if a<=d and d<=b:
c += i
print(c) | n,a,b = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
c = sum(list(map(int, str(i))))
if a <= c <= b:
ans += i
print(ans) | 7 | 7 | 155 | 154 | n, a, b = list(map(int, input().split()))
c = 0
for i in range(1, n + 1):
d = sum(int(j) for j in list(str(i)))
if a <= d and d <= b:
c += i
print(c)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
c = sum(list(map(int, str(i))))
if a <= c <= b:
ans += i
print(ans)
| false | 0 | [
"-c = 0",
"+ans = 0",
"- d = sum(int(j) for j in list(str(i)))",
"- if a <= d and d <= b:",
"- c += i",
"-print(c)",
"+ c = sum(list(map(int, str(i))))",
"+ if a <= c <= b:",
"+ ans += i",
"+print(ans)"
] | false | 0.045071 | 0.149358 | 0.301766 | [
"s139212700",
"s546854981"
] |
u377989038 | p02689 | python | s246757306 | s753274313 | 536 | 242 | 57,228 | 20,124 | Accepted | Accepted | 54.85 | n, m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
ab = [(list(map(int, input().split())))for _ in range(m)]
l = [set({}) for _ in range(n + 1)]
for a, b in ab:
l[a].add(b)
l[b].add(a)
cnt = -1
for i, v in enumerate(l):
if len(v) != 0:
if h[i] > max([h[j] ... | n, m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
bl = [True] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
if h[a] > h[b]:
bl[b] = False
elif h[a] < h[b]:
bl[a] = False
else:
bl[a], bl[b] = False, False
print((sum... | 17 | 13 | 390 | 317 | n, m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
ab = [(list(map(int, input().split()))) for _ in range(m)]
l = [set({}) for _ in range(n + 1)]
for a, b in ab:
l[a].add(b)
l[b].add(a)
cnt = -1
for i, v in enumerate(l):
if len(v) != 0:
if h[i] > max([h[j] for j in v]):... | n, m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
bl = [True] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
if h[a] > h[b]:
bl[b] = False
elif h[a] < h[b]:
bl[a] = False
else:
bl[a], bl[b] = False, False
print((sum(bl) - 1))
| false | 23.529412 | [
"-ab = [(list(map(int, input().split()))) for _ in range(m)]",
"-l = [set({}) for _ in range(n + 1)]",
"-for a, b in ab:",
"- l[a].add(b)",
"- l[b].add(a)",
"-cnt = -1",
"-for i, v in enumerate(l):",
"- if len(v) != 0:",
"- if h[i] > max([h[j] for j in v]):",
"- cnt += 1... | false | 0.096879 | 0.03847 | 2.518262 | [
"s246757306",
"s753274313"
] |
u480472958 | p03607 | python | s213081634 | s546145387 | 208 | 167 | 16,268 | 17,888 | Accepted | Accepted | 19.71 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
dic = {}
for i in range(n):
if a[i] in dic:
del dic[a[i]]
else:
dic[a[i]] = None
print((len(dic))) | n = int(eval(input()))
dic = {}
for i in range(n):
a = eval(input())
if a in dic:
del dic[a]
else:
dic[a] = None
print((len(dic))) | 9 | 9 | 182 | 152 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
dic = {}
for i in range(n):
if a[i] in dic:
del dic[a[i]]
else:
dic[a[i]] = None
print((len(dic)))
| n = int(eval(input()))
dic = {}
for i in range(n):
a = eval(input())
if a in dic:
del dic[a]
else:
dic[a] = None
print((len(dic)))
| false | 0 | [
"-a = [int(eval(input())) for i in range(n)]",
"- if a[i] in dic:",
"- del dic[a[i]]",
"+ a = eval(input())",
"+ if a in dic:",
"+ del dic[a]",
"- dic[a[i]] = None",
"+ dic[a] = None"
] | false | 0.041716 | 0.043731 | 0.953918 | [
"s213081634",
"s546145387"
] |
u021019433 | p02832 | python | s537696153 | s809000002 | 145 | 105 | 26,268 | 17,976 | Accepted | Accepted | 27.59 | n = int(eval(input()))
a = list(map(int, input().split()))
i = k = 0
try:
while True:
i = a.index(k + 1, i) + 1
k += 1
except ValueError:
print((n-(k or n+1)))
| n = int(eval(input()))
k = 0
for x in map(int, input().split()):
if x == k + 1:
k += 1
print((n - k if k else -1))
| 9 | 6 | 172 | 118 | n = int(eval(input()))
a = list(map(int, input().split()))
i = k = 0
try:
while True:
i = a.index(k + 1, i) + 1
k += 1
except ValueError:
print((n - (k or n + 1)))
| n = int(eval(input()))
k = 0
for x in map(int, input().split()):
if x == k + 1:
k += 1
print((n - k if k else -1))
| false | 33.333333 | [
"-a = list(map(int, input().split()))",
"-i = k = 0",
"-try:",
"- while True:",
"- i = a.index(k + 1, i) + 1",
"+k = 0",
"+for x in map(int, input().split()):",
"+ if x == k + 1:",
"-except ValueError:",
"- print((n - (k or n + 1)))",
"+print((n - k if k else -1))"
] | false | 0.037084 | 0.035177 | 1.054214 | [
"s537696153",
"s809000002"
] |
u692746605 | p03074 | python | s830066985 | s750014713 | 59 | 42 | 7,108 | 7,876 | Accepted | Accepted | 28.81 | n, k = list(map(int, input().split()))
s = eval(input())
l = [0,0] if (s[0] == '0') else [0]
for i in range(1, n):
if s[i-1] != s[i]:
l += [i];
l += [n] if (s[-1] == '1') else [n,n]
ll = len(l)
pl = 2 * k + 1
if ll <= pl:
print(n)
else:
print((max(l[pl+i]-l[i] for i in range(0, ll-pl+1,... | n, k = list(map(int, input().split()))
s = eval(input())
l = [0,0] if (s[0] == '0') else [0]
l += [i for i in range(1,n) if s[i-1] != s[i]]
l += [n] if (s[-1] == '1') else [n,n]
ll = len(l)
pl = 2 * k + 1
if (ll < pl):
print(n)
else:
print((max(l[pl+i]-l[i] for i in range(0, ll-pl+1, 2))))
| 13 | 12 | 313 | 296 | n, k = list(map(int, input().split()))
s = eval(input())
l = [0, 0] if (s[0] == "0") else [0]
for i in range(1, n):
if s[i - 1] != s[i]:
l += [i]
l += [n] if (s[-1] == "1") else [n, n]
ll = len(l)
pl = 2 * k + 1
if ll <= pl:
print(n)
else:
print((max(l[pl + i] - l[i] for i in range(0, ll - pl + 1, 2... | n, k = list(map(int, input().split()))
s = eval(input())
l = [0, 0] if (s[0] == "0") else [0]
l += [i for i in range(1, n) if s[i - 1] != s[i]]
l += [n] if (s[-1] == "1") else [n, n]
ll = len(l)
pl = 2 * k + 1
if ll < pl:
print(n)
else:
print((max(l[pl + i] - l[i] for i in range(0, ll - pl + 1, 2))))
| false | 7.692308 | [
"-for i in range(1, n):",
"- if s[i - 1] != s[i]:",
"- l += [i]",
"+l += [i for i in range(1, n) if s[i - 1] != s[i]]",
"-if ll <= pl:",
"+if ll < pl:"
] | false | 0.039636 | 0.070912 | 0.558953 | [
"s830066985",
"s750014713"
] |
u539969758 | p02726 | python | s347518389 | s771719766 | 1,980 | 1,792 | 3,444 | 3,444 | Accepted | Accepted | 9.49 | N, X, Y = list(map(int,input().split()))
k_list = [0]*N
for p in range(1, N):
for q in range(p, N+1):
p2X = abs(p - X)
p2Y = abs(p - Y)
q2X = abs(q - X)
q2Y = abs(q - Y)
distance = min(q-p, p2X+1+q2Y, p2Y+1+q2X)
k_list[distance] += 1
for k in r... | N, X, Y = list(map(int,input().split()))
k_list = [0]*N
for p in range(1, N):
for q in range(p, N+1):
p2X = abs(p - X)
p2Y = abs(p - Y)
q2X = abs(q - X)
q2Y = abs(q - Y)
distance = min(q-p, p2X+1+q2Y)
k_list[distance] += 1
for k in range(1, N):
pr... | 15 | 15 | 347 | 328 | N, X, Y = list(map(int, input().split()))
k_list = [0] * N
for p in range(1, N):
for q in range(p, N + 1):
p2X = abs(p - X)
p2Y = abs(p - Y)
q2X = abs(q - X)
q2Y = abs(q - Y)
distance = min(q - p, p2X + 1 + q2Y, p2Y + 1 + q2X)
k_list[distance] += 1
for k in range(1, N... | N, X, Y = list(map(int, input().split()))
k_list = [0] * N
for p in range(1, N):
for q in range(p, N + 1):
p2X = abs(p - X)
p2Y = abs(p - Y)
q2X = abs(q - X)
q2Y = abs(q - Y)
distance = min(q - p, p2X + 1 + q2Y)
k_list[distance] += 1
for k in range(1, N):
print((k... | false | 0 | [
"- distance = min(q - p, p2X + 1 + q2Y, p2Y + 1 + q2X)",
"+ distance = min(q - p, p2X + 1 + q2Y)"
] | false | 0.042442 | 0.046621 | 0.910365 | [
"s347518389",
"s771719766"
] |
u670180528 | p03818 | python | s379791457 | s079291282 | 51 | 36 | 19,480 | 16,160 | Accepted | Accepted | 29.41 | from collections import*;n,l=open(0);a=sum(v-1for v in list(Counter(l.split()).values()));print((int(n)-a-(a%2))) | _,a=open(0);a=len(set(a.split()));print((a-(a%2<1))) | 1 | 1 | 105 | 50 | from collections import *
n, l = open(0)
a = sum(v - 1 for v in list(Counter(l.split()).values()))
print((int(n) - a - (a % 2)))
| _, a = open(0)
a = len(set(a.split()))
print((a - (a % 2 < 1)))
| false | 0 | [
"-from collections import *",
"-",
"-n, l = open(0)",
"-a = sum(v - 1 for v in list(Counter(l.split()).values()))",
"-print((int(n) - a - (a % 2)))",
"+_, a = open(0)",
"+a = len(set(a.split()))",
"+print((a - (a % 2 < 1)))"
] | false | 0.037878 | 0.060495 | 0.626126 | [
"s379791457",
"s079291282"
] |
u811841526 | p02394 | python | s593789781 | s848701816 | 30 | 20 | 7,660 | 5,592 | Accepted | Accepted | 33.33 | w,h,x,y,r = list(map(int, input().split()))
if r <= x <= w-r and r <= y <= h-r:
print('Yes')
else:
print('No') | W, H, x, y, r = list(map(int, input().split()))
if r <= x <= W-r and r <= y <= H-r:
print("Yes")
else:
print("No")
| 5 | 7 | 112 | 125 | w, h, x, y, r = list(map(int, input().split()))
if r <= x <= w - r and r <= y <= h - r:
print("Yes")
else:
print("No")
| W, H, x, y, r = list(map(int, input().split()))
if r <= x <= W - r and r <= y <= H - r:
print("Yes")
else:
print("No")
| false | 28.571429 | [
"-w, h, x, y, r = list(map(int, input().split()))",
"-if r <= x <= w - r and r <= y <= h - r:",
"+W, H, x, y, r = list(map(int, input().split()))",
"+if r <= x <= W - r and r <= y <= H - r:"
] | false | 0.255661 | 0.044557 | 5.737816 | [
"s593789781",
"s848701816"
] |
u296518383 | p03329 | python | s405559050 | s181749108 | 1,016 | 644 | 3,828 | 3,828 | Accepted | Accepted | 36.61 | N=int(eval(input()))
M=[0]*(N+1)
M[1]=1
for i in range(2,N+1):
L=[M[i-1]+1]
j=0
while i-6**j>=0:
L.append(M[i-6**j]+1)
j+=1
j=0
while i-9**j>=0:
L.append(M[i-9**j]+1)
j+=1
M[i]=min(L)
#print(M)
print((M[N])) | N = int(eval(input()))
pattern = [1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049]
INF = 10**6
dp = [INF] * (N+1)
dp[0] = 0
for i in range(N+1):
for p in pattern:
if i + p <= N:
dp[i+p] = min(dp[i+p], dp[i]+1)
print((dp[N])) | 19 | 14 | 248 | 255 | N = int(eval(input()))
M = [0] * (N + 1)
M[1] = 1
for i in range(2, N + 1):
L = [M[i - 1] + 1]
j = 0
while i - 6**j >= 0:
L.append(M[i - 6**j] + 1)
j += 1
j = 0
while i - 9**j >= 0:
L.append(M[i - 9**j] + 1)
j += 1
M[i] = min(L)
# print(M)
print((M[N]))
| N = int(eval(input()))
pattern = [1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049]
INF = 10**6
dp = [INF] * (N + 1)
dp[0] = 0
for i in range(N + 1):
for p in pattern:
if i + p <= N:
dp[i + p] = min(dp[i + p], dp[i] + 1)
print((dp[N]))
| false | 26.315789 | [
"-M = [0] * (N + 1)",
"-M[1] = 1",
"-for i in range(2, N + 1):",
"- L = [M[i - 1] + 1]",
"- j = 0",
"- while i - 6**j >= 0:",
"- L.append(M[i - 6**j] + 1)",
"- j += 1",
"- j = 0",
"- while i - 9**j >= 0:",
"- L.append(M[i - 9**j] + 1)",
"- j += 1",
... | false | 0.235238 | 0.10865 | 2.165087 | [
"s405559050",
"s181749108"
] |
u760802228 | p02572 | python | s689408227 | s929368732 | 130 | 114 | 94,368 | 105,264 | Accepted | Accepted | 12.31 | N = int(eval(input()))
A = list(map(int, input().split()))
t = 0
S = sum(A)
c = 0
for i in range(len(A) - 1):
S -= A[i]
t = (t + (A[i] * S)) % 1000000007
print(t) | N = int(eval(input()))
A = list(map(int, input().split()))
t = 0
S = sum(A)
c = 0
for i in range(len(A) - 1):
S -= A[i]
t = (t + (A[i] * S))
print((t % 1000000007)) | 9 | 9 | 183 | 183 | N = int(eval(input()))
A = list(map(int, input().split()))
t = 0
S = sum(A)
c = 0
for i in range(len(A) - 1):
S -= A[i]
t = (t + (A[i] * S)) % 1000000007
print(t)
| N = int(eval(input()))
A = list(map(int, input().split()))
t = 0
S = sum(A)
c = 0
for i in range(len(A) - 1):
S -= A[i]
t = t + (A[i] * S)
print((t % 1000000007))
| false | 0 | [
"- t = (t + (A[i] * S)) % 1000000007",
"-print(t)",
"+ t = t + (A[i] * S)",
"+print((t % 1000000007))"
] | false | 0.040365 | 0.054886 | 0.73544 | [
"s689408227",
"s929368732"
] |
u909643606 | p03212 | python | s841498105 | s056319354 | 157 | 18 | 16,020 | 3,064 | Accepted | Accepted | 88.54 | s = ["3", "5", "7"]
s2 = ["357", "375", "537", "573", "735", "753"]
s3 = []
s4 = []
s5 = []
s6 = []
s7 = []
s8 = []
def PowerGorilla(s_t, s_i):
s_new = []
for j in range(len(s_t)):
for i in range(len(s_t[0])+1):
for k in range(3):
s_new.append(s_t[j][:i] + s_i[... | import itertools
n = eval(input())
dp = [[[[[0] * 2 for i in range(2)] for j in range(2)] for k in range(2)]for l in range(len(n))]
#dp[i桁目][nより小さいかどうか][3がある][5がある][7がある]
for i in range(len(n)):
dp[i][0][0][0][0] = 1
for j in range(10):
if int(n[0]) >= j:
dp[0][int(n[0]) == j][j == 3][j == 5... | 47 | 20 | 939 | 739 | s = ["3", "5", "7"]
s2 = ["357", "375", "537", "573", "735", "753"]
s3 = []
s4 = []
s5 = []
s6 = []
s7 = []
s8 = []
def PowerGorilla(s_t, s_i):
s_new = []
for j in range(len(s_t)):
for i in range(len(s_t[0]) + 1):
for k in range(3):
s_new.append(s_t[j][:i] + s_i[k] + s_t[j]... | import itertools
n = eval(input())
dp = [
[[[[0] * 2 for i in range(2)] for j in range(2)] for k in range(2)]
for l in range(len(n))
]
# dp[i桁目][nより小さいかどうか][3がある][5がある][7がある]
for i in range(len(n)):
dp[i][0][0][0][0] = 1
for j in range(10):
if int(n[0]) >= j:
dp[0][int(n[0]) == j][j == 3][j == ... | false | 57.446809 | [
"-s = [\"3\", \"5\", \"7\"]",
"-s2 = [\"357\", \"375\", \"537\", \"573\", \"735\", \"753\"]",
"-s3 = []",
"-s4 = []",
"-s5 = []",
"-s6 = []",
"-s7 = []",
"-s8 = []",
"+import itertools",
"-",
"-def PowerGorilla(s_t, s_i):",
"- s_new = []",
"- for j in range(len(s_t)):",
"- for... | false | 0.536866 | 0.041706 | 12.872628 | [
"s841498105",
"s056319354"
] |
u645250356 | p03578 | python | s764948698 | s098979046 | 438 | 248 | 118,728 | 58,060 | Accepted | Accepted | 43.38 | from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
de... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 21 | 22 | 584 | 542 | from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 4.545455 | [
"-import sys, heapq, bisect, math, itertools, string, queue",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys.stdin.readline().split())",
"-",
... | false | 0.046216 | 0.086969 | 0.531406 | [
"s764948698",
"s098979046"
] |
u536926054 | p02580 | python | s795460063 | s883196245 | 1,341 | 1,209 | 134,732 | 139,540 | Accepted | Accepted | 9.84 | import numpy as np
def pd(s):
# print(s)
pass
# input
H, W, M = list(map(int, input().split()))
ms = [
[int(i) for i in input().split()]
for m in range(M)
]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")
rows = [0]*(H+1)
cols = [0]*(W+1)
bombs = {}
for m in ms:
h = m[0]
w = m[1]
... | import numpy as np
import itertools
def pd(s):
#print(s)
pass
# input
H, W, M = list(map(int, input().split()))
ms = [
[int(i) for i in input().split()]
for m in range(M)
]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")
rows = [0]*(H+1)
cols = [0]*(W+1)
bombs = {}
for h,w in ms:
rows[... | 38 | 36 | 686 | 672 | import numpy as np
def pd(s):
# print(s)
pass
# input
H, W, M = list(map(int, input().split()))
ms = [[int(i) for i in input().split()] for m in range(M)]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")
rows = [0] * (H + 1)
cols = [0] * (W + 1)
bombs = {}
for m in ms:
h = m[0]
w = m[1]
rows[h] += 1
cols[... | import numpy as np
import itertools
def pd(s):
# print(s)
pass
# input
H, W, M = list(map(int, input().split()))
ms = [[int(i) for i in input().split()] for m in range(M)]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")
rows = [0] * (H + 1)
cols = [0] * (W + 1)
bombs = {}
for h, w in ms:
rows[h] += 1
cols[w] += ... | false | 5.263158 | [
"+import itertools",
"-for m in ms:",
"- h = m[0]",
"- w = m[1]",
"+for h, w in ms:",
"-for h in rmax_hs:",
"- for w in cmax_wh:",
"- if f\"{h},{w}\" not in bombs:",
"- print((rmax + cmax))",
"- exit()",
"+for h, w in itertools.product(rmax_hs, cmax_wh):",
... | false | 0.058478 | 0.057119 | 1.023803 | [
"s795460063",
"s883196245"
] |
u392319141 | p02695 | python | s363281140 | s860808548 | 621 | 351 | 109,924 | 9,184 | Accepted | Accepted | 43.48 | from functools import lru_cache
N, M, Q = list(map(int, input().split()))
BCD = [[] for _ in range(N)]
for _ in range(Q):
a, b, c, d = list(map(int, input().split()))
BCD[a - 1].append((b - a, c, d))
@lru_cache(maxsize=None)
def search(mi, A):
if len(A) > N:
return 0
ret = 0
... | N, M, Q = list(map(int, input().split()))
BCD = [[] for _ in range(N)]
for _ in range(Q):
a, b, c, d = list(map(int, input().split()))
BCD[a - 1].append((b - a, c, d))
def search(mi, A):
if len(A) > N:
return 0
ret = 0
for i in range(1, A[-1] + 1):
ret = max(ret, sear... | 28 | 25 | 599 | 538 | from functools import lru_cache
N, M, Q = list(map(int, input().split()))
BCD = [[] for _ in range(N)]
for _ in range(Q):
a, b, c, d = list(map(int, input().split()))
BCD[a - 1].append((b - a, c, d))
@lru_cache(maxsize=None)
def search(mi, A):
if len(A) > N:
return 0
ret = 0
for i in rang... | N, M, Q = list(map(int, input().split()))
BCD = [[] for _ in range(N)]
for _ in range(Q):
a, b, c, d = list(map(int, input().split()))
BCD[a - 1].append((b - a, c, d))
def search(mi, A):
if len(A) > N:
return 0
ret = 0
for i in range(1, A[-1] + 1):
ret = max(ret, search(i, A + (i,)... | false | 10.714286 | [
"-from functools import lru_cache",
"-",
"-@lru_cache(maxsize=None)"
] | false | 0.250247 | 0.099313 | 2.519783 | [
"s363281140",
"s860808548"
] |
u102461423 | p02642 | python | s450828372 | s482302336 | 573 | 155 | 125,100 | 46,496 | Accepted | Accepted | 72.95 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
U = 10**6 + 10
@njit('(i8[::1],i8[::1])', cache=True)
def solve(A, primes):
B = np.zeros(U + 1, np.int64)
for x in A:
B[x] += 1
... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
U = 10**6 + 10
def main(A, primes):
B = np.zeros(U + 1, np.int64)
for x in A:
B[x] += 1
for p in primes:
for i in range(U // p + 1):
... | 38 | 44 | 870 | 1,008 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
U = 10**6 + 10
@njit("(i8[::1],i8[::1])", cache=True)
def solve(A, primes):
B = np.zeros(U + 1, np.int64)
for x in A:
B[x] += 1
for p in pr... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
U = 10**6 + 10
def main(A, primes):
B = np.zeros(U + 1, np.int64)
for x in A:
B[x] += 1
for p in primes:
for i in range(U // p + 1):
B[p * i] ... | false | 13.636364 | [
"-from numba import njit",
"-@njit(\"(i8[::1],i8[::1])\", cache=True)",
"-def solve(A, primes):",
"+def main(A, primes):",
"+",
"+",
"+if sys.argv[-1] == \"ONLINE_JUDGE\":",
"+ from numba.pycc import CC",
"+",
"+ cc = CC(\"my_module\")",
"+ cc.export(\"main\", \"(i8[::1],i8[::1])\")(mai... | false | 0.188131 | 0.269839 | 0.697195 | [
"s450828372",
"s482302336"
] |
u600402037 | p02726 | python | s779433045 | s089264667 | 342 | 222 | 73,948 | 43,880 | Accepted | Accepted | 35.09 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, X, Y = lr()
dis = [[0] * (N+1) for _ in range(N+1)]
for i in range(1, N):
for j in range(i+1, N+1):
dis[i][j] = j - i
dis[j][i] = j - i
dis[X][Y]... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.buffer.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, X, Y = lr()
dist = []
for i in range(1, N+1):
z = np.arange(i+1, N+1)
d1 = z - i
d2 = np.abs(i - X) + np.abs(z - Y) + 1
d = ... | 27 | 20 | 622 | 467 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, X, Y = lr()
dis = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N):
for j in range(i + 1, N + 1):
dis[i][j] = j - i
dis[j][i] = j - i
dis[X][Y] = 1
dis... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.buffer.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, X, Y = lr()
dist = []
for i in range(1, N + 1):
z = np.arange(i + 1, N + 1)
d1 = z - i
d2 = np.abs(i - X) + np.abs(z - Y) + 1
d = np.minimu... | false | 25.925926 | [
"+import numpy as np",
"-sr = lambda: sys.stdin.readline().rstrip()",
"+sr = lambda: sys.stdin.buffer.readline().rstrip()",
"-dis = [[0] * (N + 1) for _ in range(N + 1)]",
"-for i in range(1, N):",
"- for j in range(i + 1, N + 1):",
"- dis[i][j] = j - i",
"- dis[j][i] = j - i",
"-di... | false | 0.037554 | 0.181158 | 0.207299 | [
"s779433045",
"s089264667"
] |
u803848678 | p04002 | python | s656102705 | s510072747 | 2,488 | 1,971 | 166,892 | 166,488 | Accepted | Accepted | 20.78 | from collections import Counter
h, w, n = list(map(int, input().split()))
d = Counter()
for _ in range(n):
a, b = list(map(int, input().split()))
for i in range(3):
for j in range(3):
if w > b+j-1 > 1 < a+i-1 < h:
d[(a+i,b+j)] += 1
ans = Counter()
for i in list(d.va... | i=lambda:map(int,input().split())
h,w,n=i()
r=[0,1,2]
d={}
while n:
a,b=i();n-=1
for j in r:
for k in r:
if w>=b+k>2<a+j<=h:d[(a+j,b+k)]=d.get((a+j,b+k),0)+1
c=[0]*10
for i in d:c[d[i]]+=1
c[0]=(h-2)*(w-2)-sum(c)
print(*c,sep="\n")
| 15 | 13 | 409 | 272 | from collections import Counter
h, w, n = list(map(int, input().split()))
d = Counter()
for _ in range(n):
a, b = list(map(int, input().split()))
for i in range(3):
for j in range(3):
if w > b + j - 1 > 1 < a + i - 1 < h:
d[(a + i, b + j)] += 1
ans = Counter()
for i in list(... | i = lambda: map(int, input().split())
h, w, n = i()
r = [0, 1, 2]
d = {}
while n:
a, b = i()
n -= 1
for j in r:
for k in r:
if w >= b + k > 2 < a + j <= h:
d[(a + j, b + k)] = d.get((a + j, b + k), 0) + 1
c = [0] * 10
for i in d:
c[d[i]] += 1
c[0] = (h - 2) * (w - 2) ... | false | 13.333333 | [
"-from collections import Counter",
"-",
"-h, w, n = list(map(int, input().split()))",
"-d = Counter()",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- for i in range(3):",
"- for j in range(3):",
"- if w > b + j - 1 > 1 < a + i - 1 < h:",
"- ... | false | 0.045648 | 0.048914 | 0.93323 | [
"s656102705",
"s510072747"
] |
u625963200 | p03160 | python | s962666156 | s402504682 | 199 | 182 | 13,928 | 13,980 | Accepted | Accepted | 8.54 | n=int(eval(input()))
K=list(map(int,input().split()))
dp=[float('inf') for _ in range(n)]
dp[0]=0
for i in range(len(K)-1):
dp[i+1]=min(dp[i+1],dp[i]+abs(K[i]-K[i+1]))
if i+2<len(K):
dp[i+2]=min(dp[i+2],dp[i]+abs(K[i]-K[i+2]))
print((dp[-1])) | n=int(eval(input()))
H=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(H[1]-H[0])
for i in range(2,n):
dp[i]=min(dp[i],dp[i-1]+abs(H[i]-H[i-1]))
dp[i]=min(dp[i],dp[i-2]+abs(H[i]-H[i-2]))
print((dp[-1])) | 10 | 10 | 252 | 229 | n = int(eval(input()))
K = list(map(int, input().split()))
dp = [float("inf") for _ in range(n)]
dp[0] = 0
for i in range(len(K) - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(K[i] - K[i + 1]))
if i + 2 < len(K):
dp[i + 2] = min(dp[i + 2], dp[i] + abs(K[i] - K[i + 2]))
print((dp[-1]))
| n = int(eval(input()))
H = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2, n):
dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))
dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))
print((dp[-1]))
| false | 0 | [
"-K = list(map(int, input().split()))",
"-dp = [float(\"inf\") for _ in range(n)]",
"+H = list(map(int, input().split()))",
"+dp = [float(\"inf\")] * n",
"-for i in range(len(K) - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(K[i] - K[i + 1]))",
"- if i + 2 < len(K):",
"- dp[i + 2] = mi... | false | 0.034713 | 0.033691 | 1.030332 | [
"s962666156",
"s402504682"
] |
u761529120 | p03806 | python | s684772999 | s233764344 | 1,766 | 1,500 | 60,012 | 59,500 | Accepted | Accepted | 15.06 | N , Ma, Mb = list(map(int, input().split()))
# 入力値の受け取り方を変える
arr=[list(map(int,input().split())) for _ in range(N)]
#a = [0] * N
#b = [0] * N
#c = [0] * N
#for i in range(N):
# a[i], b[i], c[i] = map(int, input().split())
# TLEになってしまうためinfを5000とかで設定する
INF = 5000
# さらに計算量を落とすため10 * N + 1などを定数で... | N , Ma, Mb = list(map(int, input().split()))
# 入力値の受け取り方を変える
arr=[list(map(int,input().split())) for _ in range(N)]
#a = [0] * N
#b = [0] * N
#c = [0] * N
#for i in range(N):
# a[i], b[i], c[i] = map(int, input().split())
# TLEになってしまうためinfを5000とかで設定する
INF = 5000
# さらに計算量を落とすため10 * N + 1などを定数で... | 59 | 59 | 1,289 | 1,277 | N, Ma, Mb = list(map(int, input().split()))
# 入力値の受け取り方を変える
arr = [list(map(int, input().split())) for _ in range(N)]
# a = [0] * N
# b = [0] * N
# c = [0] * N
# for i in range(N):
# a[i], b[i], c[i] = map(int, input().split())
# TLEになってしまうためinfを5000とかで設定する
INF = 5000
# さらに計算量を落とすため10 * N + 1などを定数で設定する → 関係なかったため戻す
... | N, Ma, Mb = list(map(int, input().split()))
# 入力値の受け取り方を変える
arr = [list(map(int, input().split())) for _ in range(N)]
# a = [0] * N
# b = [0] * N
# c = [0] * N
# for i in range(N):
# a[i], b[i], c[i] = map(int, input().split())
# TLEになってしまうためinfを5000とかで設定する
INF = 5000
# さらに計算量を落とすため10 * N + 1などを定数で設定する → 関係なかったため戻す
... | false | 0 | [
"-dp = [",
"- [[INF for _ in range(10 * N + 1)] for _ in range(10 * N + 1)] for _ in range(N + 1)",
"-]",
"+dp = [[[INF] * (10 * N + 1) for _ in range(10 * N + 1)] for _ in range(N + 1)]"
] | false | 0.007128 | 0.07124 | 0.100059 | [
"s684772999",
"s233764344"
] |
u312695001 | p02695 | python | s016781757 | s202125432 | 1,082 | 691 | 21,608 | 21,480 | Accepted | Accepted | 36.14 | import itertools
N, M, Q = list(map(int, input().split()))
a = []
b = []
c = []
d = []
for i in range(Q):
ai, bi, ci, di = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
d.append(di)
ans = 0
for A in list(itertools.combinations_with_replacement(list(range(1... | import itertools
def main():
N, M, Q = list(map(int, input().split()))
a = []
b = []
c = []
d = []
for i in range(Q):
ai, bi, ci, di = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
d.append(di)
ans = 0
f... | 27 | 30 | 703 | 733 | import itertools
N, M, Q = list(map(int, input().split()))
a = []
b = []
c = []
d = []
for i in range(Q):
ai, bi, ci, di = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
d.append(di)
ans = 0
for A in list(itertools.combinations_with_replacement(list(range(1, M + 1)), N)):
... | import itertools
def main():
N, M, Q = list(map(int, input().split()))
a = []
b = []
c = []
d = []
for i in range(Q):
ai, bi, ci, di = list(map(int, input().split()))
a.append(ai)
b.append(bi)
c.append(ci)
d.append(di)
ans = 0
for A in list(itert... | false | 10 | [
"-N, M, Q = list(map(int, input().split()))",
"-a = []",
"-b = []",
"-c = []",
"-d = []",
"-for i in range(Q):",
"- ai, bi, ci, di = list(map(int, input().split()))",
"- a.append(ai)",
"- b.append(bi)",
"- c.append(ci)",
"- d.append(di)",
"-ans = 0",
"-for A in list(itertools.... | false | 0.125815 | 0.128339 | 0.980335 | [
"s016781757",
"s202125432"
] |
u457901067 | p02632 | python | s175784106 | s279018299 | 1,915 | 748 | 11,060 | 76,288 | Accepted | Accepted | 60.94 | K = int(eval(input()))
S = eval(input())
N = len(S)
mod = int(1e9+7)
### 123
### a1bb2ccc3dddd 10文字インサート
# pow(25,6) * pow(26,4) * 8C2
# (3はfixで、それより前の8mojiから1/2を入れる場所を決める)
# これを3の位置でループする(1-indexで 3<=i<=N)
# 123dddddddddd
# pow(25,0) * pow(26,10) * 2C2(1)
# 12x3ddddddddd
# pow(25,1) * pow(26,9) * 3C2( ... | K = int(eval(input()))
S = eval(input())
N = len(S)
mod = int(1e9+7)
### 123
### a1bb2ccc3dddd 10文字インサート
# pow(25,6) * pow(26,4) * 8C2
# (3はfixで、それより前の8mojiから1/2を入れる場所を決める)
# これを3の位置でループする(1-indexで 3<=i<=N)
# 123dddddddddd
# pow(25,0) * pow(26,10) * 2C2(1)
# 12x3ddddddddd
# pow(25,1) * pow(26,9) * 3C2( ... | 33 | 46 | 696 | 910 | K = int(eval(input()))
S = eval(input())
N = len(S)
mod = int(1e9 + 7)
### 123
### a1bb2ccc3dddd 10文字インサート
# pow(25,6) * pow(26,4) * 8C2
# (3はfixで、それより前の8mojiから1/2を入れる場所を決める)
# これを3の位置でループする(1-indexで 3<=i<=N)
# 123dddddddddd
# pow(25,0) * pow(26,10) * 2C2(1)
# 12x3ddddddddd
# pow(25,1) * pow(26,9) * 3C2( = 2C2 * 3 / 1)... | K = int(eval(input()))
S = eval(input())
N = len(S)
mod = int(1e9 + 7)
### 123
### a1bb2ccc3dddd 10文字インサート
# pow(25,6) * pow(26,4) * 8C2
# (3はfixで、それより前の8mojiから1/2を入れる場所を決める)
# これを3の位置でループする(1-indexで 3<=i<=N)
# 123dddddddddd
# pow(25,0) * pow(26,10) * 2C2(1)
# 12x3ddddddddd
# pow(25,1) * pow(26,9) * 3C2( = 2C2 * 3 / 1)... | false | 28.26087 | [
"+def powinv(x, mod):",
"+ return pow1(x, mod - 2, mod)",
"+",
"+",
"+def pow1(x, n, mod):",
"+ ans = 1",
"+ while n > 0:",
"+ if n % 2:",
"+ ans *= x",
"+ ans %= mod",
"+ x *= x",
"+ x %= mod",
"+ n = n // 2 # n >>= 1",
"+ ret... | false | 0.063502 | 0.060148 | 1.055764 | [
"s175784106",
"s279018299"
] |
u670180528 | p03734 | python | s656035287 | s771766873 | 288 | 254 | 3,064 | 3,064 | Accepted | Accepted | 11.81 | from itertools import accumulate
n,W,*L=list(map(int,open(0).read().split()))
l=[[] for _ in range(4)]
lim=[1]*4
m=min(L[::2])
for w,v in zip(*[iter(L)]*2):
l[w-m].append(v)
lim[w-m]+=1
ll=[]
for x in l:
ll.append([0]+list(accumulate(sorted(x)[::-1])))
ans=0
for i in range(lim[0]):
for j in range(lim[1... | from itertools import accumulate
n,W,*L=list(map(int,open(0).read().split()))
l=[[] for _ in range(4)]
lim=[1]*4
m=min(L[::2])
for w,v in zip(*[iter(L)]*2):
l[w-m].append(v)
lim[w-m]+=1
ll=[]
for x in l:
ll.append([0]+list(accumulate(sorted(x)[::-1])))
ans=0
for i in range(lim[0]):
if m*i>W:
continu... | 20 | 26 | 492 | 594 | from itertools import accumulate
n, W, *L = list(map(int, open(0).read().split()))
l = [[] for _ in range(4)]
lim = [1] * 4
m = min(L[::2])
for w, v in zip(*[iter(L)] * 2):
l[w - m].append(v)
lim[w - m] += 1
ll = []
for x in l:
ll.append([0] + list(accumulate(sorted(x)[::-1])))
ans = 0
for i in range(lim[0... | from itertools import accumulate
n, W, *L = list(map(int, open(0).read().split()))
l = [[] for _ in range(4)]
lim = [1] * 4
m = min(L[::2])
for w, v in zip(*[iter(L)] * 2):
l[w - m].append(v)
lim[w - m] += 1
ll = []
for x in l:
ll.append([0] + list(accumulate(sorted(x)[::-1])))
ans = 0
for i in range(lim[0... | false | 23.076923 | [
"+ if m * i > W:",
"+ continue",
"+ if m * i + (m + 1) * j > W:",
"+ continue",
"+ if m * i + (m + 1) * j + (m + 2) * k > W:",
"+ continue"
] | false | 0.033449 | 0.055684 | 0.600698 | [
"s656035287",
"s771766873"
] |
u651803486 | p02994 | python | s130884181 | s962959738 | 29 | 17 | 3,444 | 2,940 | Accepted | Accepted | 41.38 | import copy
N, L = list(map(int, input().split()))
apple_taste = [L+i for i in range(N)]
pie_taste = sum(apple_taste)
min_diff = 100000
for i in range(N):
ap = copy.deepcopy(apple_taste)
ap[i] = 0
pie_taste2 = sum(ap)
diff = abs(pie_taste - pie_taste2)
if diff < min_diff:
... | N, L = list(map(int, input().split()))
pie = 0
min_abs = 10000
min_abs_apple = None
for i in range(N):
if min_abs > abs(i + L):
min_abs = abs(i + L)
min_abs_apple = i + L
pie += i + L
print((pie - min_abs_apple)) | 24 | 12 | 415 | 241 | import copy
N, L = list(map(int, input().split()))
apple_taste = [L + i for i in range(N)]
pie_taste = sum(apple_taste)
min_diff = 100000
for i in range(N):
ap = copy.deepcopy(apple_taste)
ap[i] = 0
pie_taste2 = sum(ap)
diff = abs(pie_taste - pie_taste2)
if diff < min_diff:
min_diff = diff
... | N, L = list(map(int, input().split()))
pie = 0
min_abs = 10000
min_abs_apple = None
for i in range(N):
if min_abs > abs(i + L):
min_abs = abs(i + L)
min_abs_apple = i + L
pie += i + L
print((pie - min_abs_apple))
| false | 50 | [
"-import copy",
"-",
"-apple_taste = [L + i for i in range(N)]",
"-pie_taste = sum(apple_taste)",
"-min_diff = 100000",
"+pie = 0",
"+min_abs = 10000",
"+min_abs_apple = None",
"- ap = copy.deepcopy(apple_taste)",
"- ap[i] = 0",
"- pie_taste2 = sum(ap)",
"- diff = abs(pie_taste - p... | false | 0.038862 | 0.036706 | 1.058743 | [
"s130884181",
"s962959738"
] |
u150984829 | p02279 | python | s179543714 | s055111824 | 1,080 | 860 | 55,844 | 55,920 | Accepted | Accepted | 20.37 | def q(a,h):
d[a]=str(h)
for b in t[a]:q(b,h+1)
t,p,d={},{},{}
for _ in[0]*int(eval(input())):
e=input().split()
t[e[0]]=e[2:]
for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
for i in sorted(map(int,t)):i=str(i);print(('node',i+':','parent =',p[i]+',','depth =',d[i]+',','root,'if'-1'==p... | def q(a,h):
d[a]=str(h)
for b in t[a]:q(b,h+1)
t,p,d={},{},{}
for _ in[0]*int(eval(input())):
e=input().split()
t[e[0]]=e[2:]
for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
for i in sorted(map(int,t)):
i=str(i)
f='root'if'-1'==p[i]else'internal node'if t[i]else'leaf'
print(f'nod... | 12 | 15 | 376 | 383 | def q(a, h):
d[a] = str(h)
for b in t[a]:
q(b, h + 1)
t, p, d = {}, {}, {}
for _ in [0] * int(eval(input())):
e = input().split()
t[e[0]] = e[2:]
for i in e[2:]:
p[i] = e[0]
r = (set(t) - set(p)).pop()
p[r] = "-1"
q(r, 0)
for i in sorted(map(int, t)):
i = str(i)
print(
... | def q(a, h):
d[a] = str(h)
for b in t[a]:
q(b, h + 1)
t, p, d = {}, {}, {}
for _ in [0] * int(eval(input())):
e = input().split()
t[e[0]] = e[2:]
for i in e[2:]:
p[i] = e[0]
r = (set(t) - set(p)).pop()
p[r] = "-1"
q(r, 0)
for i in sorted(map(int, t)):
i = str(i)
f = "root" ... | false | 20 | [
"- print(",
"- (",
"- \"node\",",
"- i + \":\",",
"- \"parent =\",",
"- p[i] + \",\",",
"- \"depth =\",",
"- d[i] + \",\",",
"- \"root,\" if \"-1\" == p[i] else \"internal node,\" if t[i] else \"leaf,\",",
"- ... | false | 0.037081 | 0.047038 | 0.788332 | [
"s179543714",
"s055111824"
] |
u670180528 | p03608 | python | s207184837 | s159432829 | 593 | 504 | 72,408 | 22,224 | Accepted | Accepted | 15.01 | from itertools import*
n,m,o=list(map(int,input().split()))
*R,=list(map(int,input().split()))
INF=float("inf")
d=[[INF]*n for _ in range(n)]
r=range
for i in r(n):
d[i][i]=0
for _ in r(m):
a,b,c=list(map(int,input().split()))
d[a-1][b-1]=d[b-1][a-1]=c
for k in r(n):
for i in r(n):
for j in r(n):
... | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
n,m,r,*L=list(map(int,open(0).read().split()))
f=floyd_warshall(csr_matrix((L[r+2::3],(L[r::3],L[r+1::3])),(n+1,n+1)),0)
print((int(min(sum(f[s,t]for s,t in zip(o,o[1:]))for o in permutations(L[:r... | 29 | 6 | 548 | 318 | from itertools import *
n, m, o = list(map(int, input().split()))
(*R,) = list(map(int, input().split()))
INF = float("inf")
d = [[INF] * n for _ in range(n)]
r = range
for i in r(n):
d[i][i] = 0
for _ in r(m):
a, b, c = list(map(int, input().split()))
d[a - 1][b - 1] = d[b - 1][a - 1] = c
for k in r(n):
... | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
n, m, r, *L = list(map(int, open(0).read().split()))
f = floyd_warshall(
csr_matrix((L[r + 2 :: 3], (L[r::3], L[r + 1 :: 3])), (n + 1, n + 1)), 0
)
print((int(min(sum(f[s, t] for s, t in zip(o, o[... | false | 79.310345 | [
"-from itertools import *",
"+from scipy.sparse import csr_matrix",
"+from scipy.sparse.csgraph import floyd_warshall",
"+from itertools import permutations",
"-n, m, o = list(map(int, input().split()))",
"-(*R,) = list(map(int, input().split()))",
"-INF = float(\"inf\")",
"-d = [[INF] * n for _ in ra... | false | 0.135332 | 0.326328 | 0.41471 | [
"s207184837",
"s159432829"
] |
u761989513 | p03831 | python | s850253038 | s865581352 | 94 | 83 | 14,252 | 14,252 | Accepted | Accepted | 11.7 | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
ans += min((x[i + 1] - x[i]) * a, b)
print(ans) | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 0
last = x[0]
for i in x:
ans += min((i - last) * a, b)
last = i
print(ans) | 6 | 10 | 159 | 172 | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
ans += min((x[i + 1] - x[i]) * a, b)
print(ans)
| n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 0
last = x[0]
for i in x:
ans += min((i - last) * a, b)
last = i
print(ans)
| false | 40 | [
"-for i in range(n - 1):",
"- ans += min((x[i + 1] - x[i]) * a, b)",
"+last = x[0]",
"+for i in x:",
"+ ans += min((i - last) * a, b)",
"+ last = i"
] | false | 0.071925 | 0.04169 | 1.72525 | [
"s850253038",
"s865581352"
] |
u926412290 | p02598 | python | s375190410 | s054602060 | 1,600 | 791 | 30,984 | 30,848 | Accepted | Accepted | 50.56 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
l = 0
r = max(A)
for _ in range(30):
mid = (r + l + 1) // 2
count = 0
for log in A:
if log > mid:
count += (log + mid - 1) // mid - 1
if count <= K:
r = mid
else:
l = mid
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
l = 1
r = max(A)
while l != r:
mid = (r + l) // 2
count = 0
for log in A:
count += (log - 1) // mid
if count <= K:
r = mid
else:
l = mid + 1
print(r)
| 17 | 16 | 323 | 280 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
l = 0
r = max(A)
for _ in range(30):
mid = (r + l + 1) // 2
count = 0
for log in A:
if log > mid:
count += (log + mid - 1) // mid - 1
if count <= K:
r = mid
else:
l = mid
print(r)
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
l = 1
r = max(A)
while l != r:
mid = (r + l) // 2
count = 0
for log in A:
count += (log - 1) // mid
if count <= K:
r = mid
else:
l = mid + 1
print(r)
| false | 5.882353 | [
"-l = 0",
"+l = 1",
"-for _ in range(30):",
"- mid = (r + l + 1) // 2",
"+while l != r:",
"+ mid = (r + l) // 2",
"- if log > mid:",
"- count += (log + mid - 1) // mid - 1",
"+ count += (log - 1) // mid",
"- l = mid",
"+ l = mid + 1"
] | false | 0.040389 | 0.008103 | 4.98434 | [
"s375190410",
"s054602060"
] |
u189479417 | p02612 | python | s241275681 | s815772085 | 32 | 29 | 9,148 | 9,128 | Accepted | Accepted | 9.38 | N = int(eval(input()))
ans = (1000 - N % 1000) % 1000
print(ans) | N = int(eval(input()))
k = 0
while k * 1000 < N:
k += 1
ans = k * 1000 - N
print(ans) | 3 | 8 | 60 | 92 | N = int(eval(input()))
ans = (1000 - N % 1000) % 1000
print(ans)
| N = int(eval(input()))
k = 0
while k * 1000 < N:
k += 1
ans = k * 1000 - N
print(ans)
| false | 62.5 | [
"-ans = (1000 - N % 1000) % 1000",
"+k = 0",
"+while k * 1000 < N:",
"+ k += 1",
"+ans = k * 1000 - N"
] | false | 0.103784 | 0.037641 | 2.757186 | [
"s241275681",
"s815772085"
] |
u790710233 | p03715 | python | s796259182 | s173644707 | 30 | 27 | 9,196 | 9,220 | Accepted | Accepted | 10 | h, w = list(map(int, input().split()))
# =パターン
x, y = divmod(h, 3)
if y == 0:
x1, x2, x3 = x, x, x
elif y == 1:
x1, x2, x3 = x+1, x, x
else:
x1, x2, x3 = x+1, x+1, x
s1, s2, s3 = [x*w for x in (x1, x2, x3)]
ans = s1-s3
# llパターン
x, y = divmod(w, 3)
if y == 0:
x1, x2, x3 = x, x, x
eli... | h, w = list(map(int, input().split()))
def solve_ll(a, b):
x, y = divmod(a, 3)
X = [x]*3
for i in range(y):
X[i] += 1
s1, s2, s3 = [x*b for x in X]
return s1-s3
def solve_T(a, b):
INF = 10**18
res = INF
for x in (b//3, -(-b//3)):
s1 = x*a
y = ... | 62 | 27 | 1,038 | 558 | h, w = list(map(int, input().split()))
# =パターン
x, y = divmod(h, 3)
if y == 0:
x1, x2, x3 = x, x, x
elif y == 1:
x1, x2, x3 = x + 1, x, x
else:
x1, x2, x3 = x + 1, x + 1, x
s1, s2, s3 = [x * w for x in (x1, x2, x3)]
ans = s1 - s3
# llパターン
x, y = divmod(w, 3)
if y == 0:
x1, x2, x3 = x, x, x
elif y == 1:
... | h, w = list(map(int, input().split()))
def solve_ll(a, b):
x, y = divmod(a, 3)
X = [x] * 3
for i in range(y):
X[i] += 1
s1, s2, s3 = [x * b for x in X]
return s1 - s3
def solve_T(a, b):
INF = 10**18
res = INF
for x in (b // 3, -(-b // 3)):
s1 = x * a
y = b - x... | false | 56.451613 | [
"-# =パターン",
"-x, y = divmod(h, 3)",
"-if y == 0:",
"- x1, x2, x3 = x, x, x",
"-elif y == 1:",
"- x1, x2, x3 = x + 1, x, x",
"-else:",
"- x1, x2, x3 = x + 1, x + 1, x",
"-s1, s2, s3 = [x * w for x in (x1, x2, x3)]",
"-ans = s1 - s3",
"-# llパターン",
"-x, y = divmod(w, 3)",
"-if y == 0:"... | false | 0.045945 | 0.047569 | 0.965866 | [
"s796259182",
"s173644707"
] |
u094999522 | p02780 | python | s905514413 | s703981089 | 144 | 131 | 32,464 | 118,652 | Accepted | Accepted | 9.03 | #!/usr/bin/env python3
n, k, *P = list(map(int, open(0).read().split()))
p = [(i + 1) / 2 for i in P]
c = sum(p[:k])
ans = c
for i in range(n - k):
c = c + p[i + k] - p[i]
ans = max(c, ans)
print(ans)
| #!/usr/bin/env python3
n, k, *P = list(map(int, open(0).read().split()))
p = [(i + 1) / 2 for i in P]
s = [float()]
for i in range(n):
s.append(s[i] + p[i])
print((max(s[i + k] - s[i] for i in range(n - k + 1))))
| 9 | 7 | 211 | 215 | #!/usr/bin/env python3
n, k, *P = list(map(int, open(0).read().split()))
p = [(i + 1) / 2 for i in P]
c = sum(p[:k])
ans = c
for i in range(n - k):
c = c + p[i + k] - p[i]
ans = max(c, ans)
print(ans)
| #!/usr/bin/env python3
n, k, *P = list(map(int, open(0).read().split()))
p = [(i + 1) / 2 for i in P]
s = [float()]
for i in range(n):
s.append(s[i] + p[i])
print((max(s[i + k] - s[i] for i in range(n - k + 1))))
| false | 22.222222 | [
"-c = sum(p[:k])",
"-ans = c",
"-for i in range(n - k):",
"- c = c + p[i + k] - p[i]",
"- ans = max(c, ans)",
"-print(ans)",
"+s = [float()]",
"+for i in range(n):",
"+ s.append(s[i] + p[i])",
"+print((max(s[i + k] - s[i] for i in range(n - k + 1))))"
] | false | 0.047792 | 0.07036 | 0.679254 | [
"s905514413",
"s703981089"
] |
u661435580 | p02389 | python | s853649286 | s723494233 | 20 | 0 | 5,580 | 4,616 | Accepted | Accepted | 100 | a,b = list(map(int,input().split()))
print((a*b,2*(a+b)))
| a, b = list(map(int, input().split()))
print(a*b , 2*(a+b))
| 2 | 2 | 51 | 58 | a, b = list(map(int, input().split()))
print((a * b, 2 * (a + b)))
| a, b = list(map(int, input().split()))
print(a * b, 2 * (a + b))
| false | 0 | [
"-print((a * b, 2 * (a + b)))",
"+print(a * b, 2 * (a + b))"
] | false | 0.048521 | 0.049227 | 0.985651 | [
"s853649286",
"s723494233"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.