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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u789282627 | p02726 | python | s355222593 | s617093371 | 312 | 281 | 48,348 | 46,556 | Accepted | Accepted | 9.94 | N,X,Y = list(map(int,input().split()))
dist = [i*0 for i in range(N)]
for i in range(1,N+1):
for j in range(i,N+1):
if(i==j):
continue
a = abs(i-j)
b = abs(X-i)+1+abs(Y-j)
c = abs(X-j)+1+abs(Y-i)
dist[min(a,b,c)]+=1
for i in range(1,N):
print((dist[i]))
| N,X,Y = list(map(int,input().split()))
dist = [i*0 for i in range(N)]
for i in range(1,N+1):
for j in range(i,N+1):
if(i==j):
continue
a = abs(i-j)
b = abs(X-i)+1+abs(Y-j)
#c = abs(X-j)+1+abs(Y-i)
#print(str(min(a,b,c))+' when ('+str(i)+','+str(j)+')')
dist[min(a,b)... | 19 | 39 | 305 | 743 | N, X, Y = list(map(int, input().split()))
dist = [i * 0 for i in range(N)]
for i in range(1, N + 1):
for j in range(i, N + 1):
if i == j:
continue
a = abs(i - j)
b = abs(X - i) + 1 + abs(Y - j)
c = abs(X - j) + 1 + abs(Y - i)
dist[min(a, b, c)] += 1
for i in range... | N, X, Y = list(map(int, input().split()))
dist = [i * 0 for i in range(N)]
for i in range(1, N + 1):
for j in range(i, N + 1):
if i == j:
continue
a = abs(i - j)
b = abs(X - i) + 1 + abs(Y - j)
# c = abs(X-j)+1+abs(Y-i)
# print(str(min(a,b,c))+' when ('+str(i)+','... | false | 51.282051 | [
"- c = abs(X - j) + 1 + abs(Y - i)",
"- dist[min(a, b, c)] += 1",
"+ # c = abs(X-j)+1+abs(Y-i)",
"+ # print(str(min(a,b,c))+' when ('+str(i)+','+str(j)+')')",
"+ dist[min(a, b)] += 1",
"+ # if(j>X):",
"+ # if(j<X+((Y-X)/2)):",
"+ # dist[N-(Y-... | false | 0.040495 | 0.041125 | 0.984684 | [
"s355222593",
"s617093371"
] |
u964299793 | p03309 | python | s459845618 | s357286837 | 246 | 224 | 26,020 | 25,200 | Accepted | Accepted | 8.94 | n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
a[i]-=(i+1)
median=-1
a.sort()
if n%2==0:
median=(a[n//2]+a[n//2-1])//2
else:
median=a[n//2]
def comp(x):
su=0
for i in a:
su+=abs(i-x)
return su
print((min(comp(median-1),comp(median),comp(median+1))... | n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
a[i]-=(i+1)
median=-1
a.sort()
if n%2==0:
median=(a[n//2]+a[n//2-1])//2
else:
median=a[n//2]
def comp(x):
su=0
for i in a:
su+=abs(i-x)
return su
print((min(comp(median),comp(median+1))))
| 19 | 19 | 321 | 306 | n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
a[i] -= i + 1
median = -1
a.sort()
if n % 2 == 0:
median = (a[n // 2] + a[n // 2 - 1]) // 2
else:
median = a[n // 2]
def comp(x):
su = 0
for i in a:
su += abs(i - x)
return su
print((min(comp(median - 1), c... | n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
a[i] -= i + 1
median = -1
a.sort()
if n % 2 == 0:
median = (a[n // 2] + a[n // 2 - 1]) // 2
else:
median = a[n // 2]
def comp(x):
su = 0
for i in a:
su += abs(i - x)
return su
print((min(comp(median), comp(... | false | 0 | [
"-print((min(comp(median - 1), comp(median), comp(median + 1))))",
"+print((min(comp(median), comp(median + 1))))"
] | false | 0.064585 | 0.042951 | 1.503694 | [
"s459845618",
"s357286837"
] |
u084320347 | p03086 | python | s063238241 | s168503198 | 162 | 18 | 38,444 | 2,940 | Accepted | Accepted | 88.89 | s = eval(input())
a_s = ["A","C","G","T"]
l=[]
for i in range(len(s)):
if s[i] in a_s:
l.append(1)
else:
l.append(0)
cnt = 0
ans = 0
for i in range(len(s)):
if l[i] == 1:
cnt += 1
else:
ans = max(cnt,ans)
cnt = 0
ans = max(cnt,ans)
print(ans)
| s = eval(input())+"_"
cnt = 0
ans = 0
for i in range(len(s)):
if s[i] == "A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
cnt+=1
else:
ans = max(ans, cnt)
cnt = 0
print(ans)
| 20 | 12 | 314 | 215 | s = eval(input())
a_s = ["A", "C", "G", "T"]
l = []
for i in range(len(s)):
if s[i] in a_s:
l.append(1)
else:
l.append(0)
cnt = 0
ans = 0
for i in range(len(s)):
if l[i] == 1:
cnt += 1
else:
ans = max(cnt, ans)
cnt = 0
ans = max(cnt, ans)
print(ans)
| s = eval(input()) + "_"
cnt = 0
ans = 0
for i in range(len(s)):
if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
print(ans)
| false | 40 | [
"-s = eval(input())",
"-a_s = [\"A\", \"C\", \"G\", \"T\"]",
"-l = []",
"-for i in range(len(s)):",
"- if s[i] in a_s:",
"- l.append(1)",
"- else:",
"- l.append(0)",
"+s = eval(input()) + \"_\"",
"- if l[i] == 1:",
"+ if s[i] == \"A\" or s[i] == \"C\" or s[i] == \"G\" o... | false | 0.044653 | 0.037237 | 1.199165 | [
"s063238241",
"s168503198"
] |
u608088992 | p02947 | python | s396582007 | s341707116 | 1,889 | 367 | 25,960 | 24,652 | Accepted | Accepted | 80.57 | N = int(eval(input()))
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
alphanum = dict()
for i in range(26): alphanum[alphabet[i]] = i
fact = [0] * (N + 1)
for i in range(1, N + 1): fact[i] = fact[i-1] + i
wordtype =... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
S = [list(input().strip("\n")) for _ in range(N)]
for i in range(N): S[i].sort()
S.sort()
S.append(["E", "N", "D"])
ans = 0
current = "".join(S[0])
same = 0
for i in range(1, N+1):
t... | 26 | 27 | 701 | 572 | N = int(eval(input()))
alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
alphanum = dict()
for i in range(26):
alphan... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
S = [list(input().strip("\n")) for _ in range(N)]
for i in range(N):
S[i].sort()
S.sort()
S.append(["E", "N", "D"])
ans = 0
current = "".join(S[0])
same = 0
for i in range(1, N + 1):
tempS... | false | 3.703704 | [
"-N = int(eval(input()))",
"-alphabet = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
"- \"n\",",
"- \"o\",",
"- \"p\","... | false | 0.036419 | 0.034433 | 1.057673 | [
"s396582007",
"s341707116"
] |
u707808519 | p02629 | python | s528585456 | s948149642 | 34 | 29 | 9,212 | 9,188 | Accepted | Accepted | 14.71 | alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
y = int(eval(input()))
ans = []
while y > 26:
res = y%26
if res == 0:
ans.append(25)
y = y//26 - 1
else:
ans.append(y%26 - 1)
y = y // 26
ans.append(... | N = int(eval(input()))
alp = [chr(i) for i in range(ord('a'), ord('z')+1)]
ans = []
while N > 0:
res = N % 26
ans.append(alp[res - 1])
N //= 26
if res == 0:
N -= 1
ans = ans[::-1]
print((''.join(ans))) | 19 | 13 | 404 | 231 | alp = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
y = int(eval(input()))
ans = []
while y > 26:
res = y % 26
if res ==... | N = int(eval(input()))
alp = [chr(i) for i in range(ord("a"), ord("z") + 1)]
ans = []
while N > 0:
res = N % 26
ans.append(alp[res - 1])
N //= 26
if res == 0:
N -= 1
ans = ans[::-1]
print(("".join(ans)))
| false | 31.578947 | [
"-alp = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
"- \"n\",",
"- \"o\",",
"- \"p\",",
"- \"q\",",
"- \"r\","... | false | 0.186537 | 0.007909 | 23.584223 | [
"s528585456",
"s948149642"
] |
u080364835 | p03817 | python | s103628475 | s021357592 | 29 | 25 | 9,156 | 9,132 | Accepted | Accepted | 13.79 | import math
x = int(eval(input()))
if 1 <= x%11 <= 6:
print((math.ceil(x/11)*2 - 1))
else:
print((math.ceil(x/11)*2)) | n = int(eval(input()))
ans = n//11*2
if 0 < n%11 <= 6:
ans += 1
elif 6 < n%11 <= 10:
ans += 2
print(ans) | 7 | 8 | 122 | 114 | import math
x = int(eval(input()))
if 1 <= x % 11 <= 6:
print((math.ceil(x / 11) * 2 - 1))
else:
print((math.ceil(x / 11) * 2))
| n = int(eval(input()))
ans = n // 11 * 2
if 0 < n % 11 <= 6:
ans += 1
elif 6 < n % 11 <= 10:
ans += 2
print(ans)
| false | 12.5 | [
"-import math",
"-",
"-x = int(eval(input()))",
"-if 1 <= x % 11 <= 6:",
"- print((math.ceil(x / 11) * 2 - 1))",
"-else:",
"- print((math.ceil(x / 11) * 2))",
"+n = int(eval(input()))",
"+ans = n // 11 * 2",
"+if 0 < n % 11 <= 6:",
"+ ans += 1",
"+elif 6 < n % 11 <= 10:",
"+ ans ... | false | 0.073764 | 0.118519 | 0.622384 | [
"s103628475",
"s021357592"
] |
u357751375 | p02860 | python | s985187570 | s148520493 | 33 | 26 | 9,120 | 9,148 | Accepted | Accepted | 21.21 | n = int(eval(input()))
s = eval(input())
if n % 2 == 1:
print('No')
exit(0)
n = n // 2
a = s[:n]
if s.count(a) == 2:
print('Yes')
else:
print('No') | n = int(eval(input()))
s = eval(input())
a = s[:n//2]
b = s[n//2:]
if a == b:
print('Yes')
else:
print('No') | 13 | 8 | 165 | 111 | n = int(eval(input()))
s = eval(input())
if n % 2 == 1:
print("No")
exit(0)
n = n // 2
a = s[:n]
if s.count(a) == 2:
print("Yes")
else:
print("No")
| n = int(eval(input()))
s = eval(input())
a = s[: n // 2]
b = s[n // 2 :]
if a == b:
print("Yes")
else:
print("No")
| false | 38.461538 | [
"-if n % 2 == 1:",
"- print(\"No\")",
"- exit(0)",
"-n = n // 2",
"-a = s[:n]",
"-if s.count(a) == 2:",
"+a = s[: n // 2]",
"+b = s[n // 2 :]",
"+if a == b:"
] | false | 0.045268 | 0.070292 | 0.644005 | [
"s985187570",
"s148520493"
] |
u197300773 | p03141 | python | s033683451 | s533464584 | 511 | 360 | 23,260 | 7,388 | Accepted | Accepted | 29.55 | n=int(eval(input()))
x=[]
for _ in range(n):
a,b=list(map(int,input().split()))
x.append([a+b,a,b])
x.sort(reverse=True)
ans=0
for i in range(n):
if i%2==0: ans+=x[i][1]
else: ans-=x[i][2]
print(ans) | n=int(eval(input()))
x=[]
ans=0
for _ in range(n):
a,b=list(map(int,input().split()))
x.append(a+b)
ans-=b
x.sort(reverse=True)
ans+=sum(x[i] for i in range(n) if i%2==0)
print(ans) | 11 | 10 | 213 | 190 | n = int(eval(input()))
x = []
for _ in range(n):
a, b = list(map(int, input().split()))
x.append([a + b, a, b])
x.sort(reverse=True)
ans = 0
for i in range(n):
if i % 2 == 0:
ans += x[i][1]
else:
ans -= x[i][2]
print(ans)
| n = int(eval(input()))
x = []
ans = 0
for _ in range(n):
a, b = list(map(int, input().split()))
x.append(a + b)
ans -= b
x.sort(reverse=True)
ans += sum(x[i] for i in range(n) if i % 2 == 0)
print(ans)
| false | 9.090909 | [
"+ans = 0",
"- x.append([a + b, a, b])",
"+ x.append(a + b)",
"+ ans -= b",
"-ans = 0",
"-for i in range(n):",
"- if i % 2 == 0:",
"- ans += x[i][1]",
"- else:",
"- ans -= x[i][2]",
"+ans += sum(x[i] for i in range(n) if i % 2 == 0)"
] | false | 0.036248 | 0.035278 | 1.027481 | [
"s033683451",
"s533464584"
] |
u899975427 | p03087 | python | s290268145 | s058396875 | 1,570 | 1,305 | 6,212 | 6,104 | Accepted | Accepted | 16.88 | N,Q = (int(i) for i in input().split())
S = eval(input())
acl = [0] * N
cnt = 0
for j in range(1,N):
if S[j-1] == 'A' and S[j] == 'C':
cnt += 1
acl[j] = cnt
for k in range(Q):
x,y = (int(i)-1 for i in input().split())
print((acl[y]-acl[x])) | N,Q = (int(i) for i in input().split())
S = eval(input())
acl = [0 for i in range(N)]
cnt = 0
for j in range(1,N):
if S[j-1] == 'A' and S[j] == 'C':
cnt += 1
acl[j] = cnt
for k in range(Q):
x,y = list(map(int, input().split()))
print((acl[y-1]-acl[x-1])) | 13 | 12 | 264 | 270 | N, Q = (int(i) for i in input().split())
S = eval(input())
acl = [0] * N
cnt = 0
for j in range(1, N):
if S[j - 1] == "A" and S[j] == "C":
cnt += 1
acl[j] = cnt
for k in range(Q):
x, y = (int(i) - 1 for i in input().split())
print((acl[y] - acl[x]))
| N, Q = (int(i) for i in input().split())
S = eval(input())
acl = [0 for i in range(N)]
cnt = 0
for j in range(1, N):
if S[j - 1] == "A" and S[j] == "C":
cnt += 1
acl[j] = cnt
for k in range(Q):
x, y = list(map(int, input().split()))
print((acl[y - 1] - acl[x - 1]))
| false | 7.692308 | [
"-acl = [0] * N",
"+acl = [0 for i in range(N)]",
"- x, y = (int(i) - 1 for i in input().split())",
"- print((acl[y] - acl[x]))",
"+ x, y = list(map(int, input().split()))",
"+ print((acl[y - 1] - acl[x - 1]))"
] | false | 0.036322 | 0.035671 | 1.018273 | [
"s290268145",
"s058396875"
] |
u782685137 | p03157 | python | s747905835 | s263189010 | 462 | 425 | 18,404 | 18,020 | Accepted | Accepted | 8.01 | import collections
H,W=list(map(int,input().split()))
S=[eval(input()) for i in [0]*H]
M=[[-1]*W for _ in [0]*H]
k=0
for y in range(H):
for x in range(W):
if M[y][x]!=-1:continue #visited
M[y][x]=k
Q=collections.deque()
Q.append((y,x))
while len(Q)>0:
... | H,W=list(map(int,input().split()))
h=list(range(H))
S=[eval(input()) for _ in h]
M=[[-1]*W for _ in h]
k=0
for y in h:
for x in range(W):
if M[y][x]!=-1:continue
M[y][x]=k;Q=[(y,x)]
while len(Q)>0:
i,j=Q.pop();s=S[i][j];p=i+1;q=i-1;r=j+1;t=j-1
if p<H and M[... | 39 | 24 | 1,102 | 779 | import collections
H, W = list(map(int, input().split()))
S = [eval(input()) for i in [0] * H]
M = [[-1] * W for _ in [0] * H]
k = 0
for y in range(H):
for x in range(W):
if M[y][x] != -1:
continue # visited
M[y][x] = k
Q = collections.deque()
Q.append((y, x))
w... | H, W = list(map(int, input().split()))
h = list(range(H))
S = [eval(input()) for _ in h]
M = [[-1] * W for _ in h]
k = 0
for y in h:
for x in range(W):
if M[y][x] != -1:
continue
M[y][x] = k
Q = [(y, x)]
while len(Q) > 0:
i, j = Q.pop()
s = S[i][j]... | false | 38.461538 | [
"-import collections",
"-",
"-S = [eval(input()) for i in [0] * H]",
"-M = [[-1] * W for _ in [0] * H]",
"+h = list(range(H))",
"+S = [eval(input()) for _ in h]",
"+M = [[-1] * W for _ in h]",
"-for y in range(H):",
"+for y in h:",
"- continue # visited",
"+ continue",
"... | false | 0.037192 | 0.044109 | 0.843185 | [
"s747905835",
"s263189010"
] |
u489959379 | p02918 | python | s521376972 | s479067785 | 42 | 31 | 3,316 | 3,316 | Accepted | Accepted | 26.19 | n, k = list(map(int, input().split()))
s = eval(input())
score = 0
ans = 0
for i in range(n-1):
if s[i] == s[i+1]:
score += 1
ans = min(score + 2 * k, n-1)
print(ans)
| import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, k = list(map(int, input().split()))
S = input().strip()
cnt = 0
for i in range(1, n):
if S[i - 1] == S[i]:
cnt += 1
res = min(cnt + ... | 10 | 23 | 177 | 391 | n, k = list(map(int, input().split()))
s = eval(input())
score = 0
ans = 0
for i in range(n - 1):
if s[i] == s[i + 1]:
score += 1
ans = min(score + 2 * k, n - 1)
print(ans)
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, k = list(map(int, input().split()))
S = input().strip()
cnt = 0
for i in range(1, n):
if S[i - 1] == S[i]:
cnt += 1
res = min(cnt + k * 2, n - 1)
print... | false | 56.521739 | [
"-n, k = list(map(int, input().split()))",
"-s = eval(input())",
"-score = 0",
"-ans = 0",
"-for i in range(n - 1):",
"- if s[i] == s[i + 1]:",
"- score += 1",
"-ans = min(score + 2 * k, n - 1)",
"-print(ans)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+input = sys.stdi... | false | 0.169231 | 0.041552 | 4.072713 | [
"s521376972",
"s479067785"
] |
u353797797 | p03062 | python | s814487217 | s978195652 | 180 | 53 | 23,304 | 15,180 | Accepted | Accepted | 70.56 | import numpy as np
n = int(eval(input()))
a = np.array(list(map(int, input().split())),dtype="i8")
cm = np.sum(a < 0)
a = np.abs(a)
s = np.sum(a)
if cm % 2:
s -= np.min(a) * 2
print(s)
| import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def main():
n=in... | 10 | 35 | 193 | 831 | import numpy as np
n = int(eval(input()))
a = np.array(list(map(int, input().split())), dtype="i8")
cm = np.sum(a < 0)
a = np.abs(a)
s = np.sum(a)
if cm % 2:
s -= np.min(a) * 2
print(s)
| import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in range(rows_number)]
def main():
... | false | 71.428571 | [
"-import numpy as np",
"+import sys",
"-n = int(eval(input()))",
"-a = np.array(list(map(int, input().split())), dtype=\"i8\")",
"-cm = np.sum(a < 0)",
"-a = np.abs(a)",
"-s = np.sum(a)",
"-if cm % 2:",
"- s -= np.min(a) * 2",
"-print(s)",
"+sys.setrecursionlimit(10**6)",
"+int1 = lambda x:... | false | 0.455854 | 0.122365 | 3.725356 | [
"s814487217",
"s978195652"
] |
u631277801 | p04034 | python | s291636337 | s830791154 | 275 | 247 | 18,180 | 4,596 | Accepted | Accepted | 10.18 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**8)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 39 | 42 | 956 | 920 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**8)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 7.142857 | [
"-sys.setrecursionlimit(10**5)",
"+sys.setrecursionlimit(10**8)",
"-def operation(box: list, frm: int, to: int):",
"- box[frm] -= 1",
"- box[to] += 1",
"-",
"-",
"-box = [1 for _ in range(n)]",
"-cand = [False for _ in range(n)]",
"-cand[0] = True",
"-ope = []",
"+ball = [1] * n",
"+in... | false | 0.091073 | 0.088302 | 1.03139 | [
"s291636337",
"s830791154"
] |
u197457087 | p03151 | python | s349509234 | s501957888 | 152 | 113 | 18,292 | 24,040 | Accepted | Accepted | 25.66 | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
if sum(B) > sum(A):
print("-1")
exit()
D = []
for i in range(N):
D.append(A[i]-B[i])
D.sort()
#print(D)
num = 0
s = 0; t = -1
yoyu = 0
while D[s] < 0:
if yoyu+D[s] <0:
num += 1 #ここで一番余裕があるのを取り出す。
... | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
if sum(B)>sum(A):
print((-1))
exit()
amari = []
fusoku = []
for i in range(N):
if A[i] < B[i]:
fusoku.append(B[i]-A[i])
elif A[i] > B[i]:
amari.append(A[i]-B[i])
amari.sort(reverse=True)
ans = ... | 23 | 30 | 409 | 458 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(B) > sum(A):
print("-1")
exit()
D = []
for i in range(N):
D.append(A[i] - B[i])
D.sort()
# print(D)
num = 0
s = 0
t = -1
yoyu = 0
while D[s] < 0:
if yoyu + D[s] < 0:
num += 1 # ここで一番余裕があるのを取り出す... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(B) > sum(A):
print((-1))
exit()
amari = []
fusoku = []
for i in range(N):
if A[i] < B[i]:
fusoku.append(B[i] - A[i])
elif A[i] > B[i]:
amari.append(A[i] - B[i])
amari.sort(reverse=True)
... | false | 23.333333 | [
"- print(\"-1\")",
"+ print((-1))",
"-D = []",
"+amari = []",
"+fusoku = []",
"- D.append(A[i] - B[i])",
"-D.sort()",
"-# print(D)",
"-num = 0",
"-s = 0",
"-t = -1",
"-yoyu = 0",
"-while D[s] < 0:",
"- if yoyu + D[s] < 0:",
"- num += 1 # ここで一番余裕があるのを取り出す。",
"- ... | false | 0.041423 | 0.048862 | 0.847757 | [
"s349509234",
"s501957888"
] |
u124498235 | p03795 | python | s400056386 | s025415900 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | n = int(eval(input()))
ans = n * 800 - n//15 * 200
print (ans) | n = int(eval(input()))
x = 800*n
y = int(n/15)
print((x-200*y)) | 3 | 4 | 58 | 59 | n = int(eval(input()))
ans = n * 800 - n // 15 * 200
print(ans)
| n = int(eval(input()))
x = 800 * n
y = int(n / 15)
print((x - 200 * y))
| false | 25 | [
"-ans = n * 800 - n // 15 * 200",
"-print(ans)",
"+x = 800 * n",
"+y = int(n / 15)",
"+print((x - 200 * y))"
] | false | 0.042397 | 0.038805 | 1.092569 | [
"s400056386",
"s025415900"
] |
u731726888 | p03863 | python | s315516595 | s161562720 | 29 | 17 | 3,316 | 3,316 | Accepted | Accepted | 41.38 | s = eval(input())
a, b = (s[0], s[1])
N = len(s)
l = s[N-1]
for c in s:
if c not in (a, b):
if a == l:
if N%2 == 0:
print("First")
else:
print("Second")
else:
if N%2 == 0:
print("Second")
el... | s = eval(input())
N = len(s)
f, l = (s[0], s[N-1])
if f == l:
if N%2 == 0:
print("First")
else:
print("Second")
else:
if N%2 == 0:
print("Second")
else:
print("First") | 19 | 13 | 395 | 221 | s = eval(input())
a, b = (s[0], s[1])
N = len(s)
l = s[N - 1]
for c in s:
if c not in (a, b):
if a == l:
if N % 2 == 0:
print("First")
else:
print("Second")
else:
if N % 2 == 0:
print("Second")
else:
... | s = eval(input())
N = len(s)
f, l = (s[0], s[N - 1])
if f == l:
if N % 2 == 0:
print("First")
else:
print("Second")
else:
if N % 2 == 0:
print("Second")
else:
print("First")
| false | 31.578947 | [
"-a, b = (s[0], s[1])",
"-l = s[N - 1]",
"-for c in s:",
"- if c not in (a, b):",
"- if a == l:",
"- if N % 2 == 0:",
"- print(\"First\")",
"- else:",
"- print(\"Second\")",
"- else:",
"- if N % 2 == 0:",
"- ... | false | 0.044747 | 0.044415 | 1.007482 | [
"s315516595",
"s161562720"
] |
u809819902 | p03059 | python | s104547340 | s815623259 | 29 | 26 | 9,104 | 9,152 | Accepted | Accepted | 10.34 | a,b,t = list(map(int,input().split()))
s = t + 0.5
print((int((s // a) * b))) | a,b,t=list(map(int,input().split()))
t+=0.5
print((int(b*(t//a)))) | 3 | 3 | 71 | 60 | a, b, t = list(map(int, input().split()))
s = t + 0.5
print((int((s // a) * b)))
| a, b, t = list(map(int, input().split()))
t += 0.5
print((int(b * (t // a))))
| false | 0 | [
"-s = t + 0.5",
"-print((int((s // a) * b)))",
"+t += 0.5",
"+print((int(b * (t // a))))"
] | false | 0.041969 | 0.048468 | 0.865913 | [
"s104547340",
"s815623259"
] |
u887207211 | p03307 | python | s249618205 | s184852002 | 21 | 19 | 3,316 | 3,064 | Accepted | Accepted | 9.52 | N = int(eval(input()))
if(N%2 == 0):
print(N)
else:
print((N*2)) | N = int(eval(input()))
def gcd(m, n):
while n:
m, n = n, m%n
return m
def lcm(m, n):
return int((m * n) / gcd(m, n))
print((lcm(N,2))) | 5 | 11 | 64 | 149 | N = int(eval(input()))
if N % 2 == 0:
print(N)
else:
print((N * 2))
| N = int(eval(input()))
def gcd(m, n):
while n:
m, n = n, m % n
return m
def lcm(m, n):
return int((m * n) / gcd(m, n))
print((lcm(N, 2)))
| false | 54.545455 | [
"-if N % 2 == 0:",
"- print(N)",
"-else:",
"- print((N * 2))",
"+",
"+",
"+def gcd(m, n):",
"+ while n:",
"+ m, n = n, m % n",
"+ return m",
"+",
"+",
"+def lcm(m, n):",
"+ return int((m * n) / gcd(m, n))",
"+",
"+",
"+print((lcm(N, 2)))"
] | false | 0.039457 | 0.051334 | 0.768622 | [
"s249618205",
"s184852002"
] |
u463655976 | p03265 | python | s631319004 | s961380002 | 149 | 17 | 12,504 | 3,060 | Accepted | Accepted | 88.59 | import numpy as np
p = list(map(int, input().split()))
s, d = list(map(lambda x, y: np.array([x, y]), p[::2], p[1::2]))
ans = ""
for _ in range(2):
v = d - s
s = d
d = s + v.dot([[0,1], [-1,0]])
ans += " " + " ".join(map(str, d))
print((ans[1:]))
| p = list(map(int, input().split()))
s, d = list(map(lambda x, y: x + y * 1j, p[::2], p[1::2]))
ans = ""
for _ in range(2):
v = d - s
s = d
d = s + v * 1j
ans += " {:.0f} {:.0f}".format(d.real, d.imag)
print((ans[1:]))
| 11 | 10 | 264 | 234 | import numpy as np
p = list(map(int, input().split()))
s, d = list(map(lambda x, y: np.array([x, y]), p[::2], p[1::2]))
ans = ""
for _ in range(2):
v = d - s
s = d
d = s + v.dot([[0, 1], [-1, 0]])
ans += " " + " ".join(map(str, d))
print((ans[1:]))
| p = list(map(int, input().split()))
s, d = list(map(lambda x, y: x + y * 1j, p[::2], p[1::2]))
ans = ""
for _ in range(2):
v = d - s
s = d
d = s + v * 1j
ans += " {:.0f} {:.0f}".format(d.real, d.imag)
print((ans[1:]))
| false | 9.090909 | [
"-import numpy as np",
"-",
"-s, d = list(map(lambda x, y: np.array([x, y]), p[::2], p[1::2]))",
"+s, d = list(map(lambda x, y: x + y * 1j, p[::2], p[1::2]))",
"- d = s + v.dot([[0, 1], [-1, 0]])",
"- ans += \" \" + \" \".join(map(str, d))",
"+ d = s + v * 1j",
"+ ans += \" {:.0f} {:.0f}\"... | false | 0.241077 | 0.037837 | 6.371483 | [
"s631319004",
"s961380002"
] |
u046187684 | p02838 | python | s995742851 | s470982049 | 911 | 303 | 72,412 | 53,464 | Accepted | Accepted | 66.74 | def solve(string):
n, *a = list(map(int, string.split()))
a = ("{:060b}".format(_a) for _a in a)
m, ans = 10**9 + 7, 0
for c in zip(*a):
s = c.count("1")
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __name__ == '__main__':
import sys
... | """
def solve(string):
n, *a = map(int, string.split())
a = ("{:060b}".format(_a) for _a in a)
m, ans = 10**9 + 7, 0
for s in map(lambda x: x.count("1"), zip(*a)):
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __name__ == '__main__':
import sys
... | 15 | 36 | 355 | 854 | def solve(string):
n, *a = list(map(int, string.split()))
a = ("{:060b}".format(_a) for _a in a)
m, ans = 10**9 + 7, 0
for c in zip(*a):
s = c.count("1")
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __name__ == "__main__":
import sys
print((solv... | """
def solve(string):
n, *a = map(int, string.split())
a = ("{:060b}".format(_a) for _a in a)
m, ans = 10**9 + 7, 0
for s in map(lambda x: x.count("1"), zip(*a)):
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __name__ == '__main__':
import sys
print(solve(... | false | 58.333333 | [
"+\"\"\"",
"- n, *a = list(map(int, string.split()))",
"+ n, *a = map(int, string.split())",
"- for c in zip(*a):",
"- s = c.count(\"1\")",
"+ for s in map(lambda x: x.count(\"1\"), zip(*a)):",
"+ return str(ans)",
"+if __name__ == '__main__':",
"+ import sys",
"+ print... | false | 0.036788 | 0.452061 | 0.081378 | [
"s995742851",
"s470982049"
] |
u204842730 | p02947 | python | s979558777 | s734189260 | 556 | 514 | 30,580 | 30,580 | Accepted | Accepted | 7.55 | import collections
n = int(eval(input()))
s = [[0 for j in range(10)] for i in range(n)]
for i in range(n):
t = eval(input())
s[i] = "".join(sorted(t))
s.sort()
ans = 0
c = collections.Counter(s)
for i in set(s):
n = c[i]
ans += n * (n-1) // 2
print(ans) | import collections
n = int(eval(input()))
s = [[0 for j in range(10)] for i in range(n)]
for i in range(n):
t = eval(input())
s[i] = "".join(sorted(t))
ans = 0
c = collections.Counter(s)
for i in set(s):
n = c[i]
ans += n * (n-1) // 2
print(ans) | 14 | 13 | 272 | 262 | import collections
n = int(eval(input()))
s = [[0 for j in range(10)] for i in range(n)]
for i in range(n):
t = eval(input())
s[i] = "".join(sorted(t))
s.sort()
ans = 0
c = collections.Counter(s)
for i in set(s):
n = c[i]
ans += n * (n - 1) // 2
print(ans)
| import collections
n = int(eval(input()))
s = [[0 for j in range(10)] for i in range(n)]
for i in range(n):
t = eval(input())
s[i] = "".join(sorted(t))
ans = 0
c = collections.Counter(s)
for i in set(s):
n = c[i]
ans += n * (n - 1) // 2
print(ans)
| false | 7.142857 | [
"-s.sort()"
] | false | 0.039651 | 0.040268 | 0.984672 | [
"s979558777",
"s734189260"
] |
u600402037 | p03017 | python | s668413046 | s172876929 | 72 | 58 | 3,572 | 3,572 | Accepted | Accepted | 19.44 | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
if d > c:
for i in range(a, d-1):
if s[i-1] == s[i] == "#":
print("No")
break
else:
print("Yes")
else:
for i in range(a, c):
if s[i-1] == s[i] == "#":
print("No")
... | N ,A ,B ,C ,D = list(map(int,input().split()))
S = eval(input())
def judgeArrive(S, x, y):
flag = "Yes"
for i in range(x-1 ,y-2):
if S[i] == S[i+1] == "#":
flag = "No"
return flag
def judgeJumpOver(S, x , y):
flag = "No"
for i in range(x-1 ,y):
if S[i-1] == S[i] == S[i+1] ==... | 21 | 27 | 511 | 561 | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
if d > c:
for i in range(a, d - 1):
if s[i - 1] == s[i] == "#":
print("No")
break
else:
print("Yes")
else:
for i in range(a, c):
if s[i - 1] == s[i] == "#":
print("No")
b... | N, A, B, C, D = list(map(int, input().split()))
S = eval(input())
def judgeArrive(S, x, y):
flag = "Yes"
for i in range(x - 1, y - 2):
if S[i] == S[i + 1] == "#":
flag = "No"
return flag
def judgeJumpOver(S, x, y):
flag = "No"
for i in range(x - 1, y):
if S[i - 1] == ... | false | 22.222222 | [
"-n, a, b, c, d = list(map(int, input().split()))",
"-s = eval(input())",
"-if d > c:",
"- for i in range(a, d - 1):",
"- if s[i - 1] == s[i] == \"#\":",
"- print(\"No\")",
"+N, A, B, C, D = list(map(int, input().split()))",
"+S = eval(input())",
"+",
"+",
"+def judgeArrive(... | false | 0.083935 | 0.03763 | 2.230538 | [
"s668413046",
"s172876929"
] |
u644516473 | p02787 | python | s601360481 | s477393725 | 785 | 640 | 78,172 | 65,500 | Accepted | Accepted | 18.47 | import sys
def resolve():
H, N = list(map(int, sys.stdin.readline().split()))
m = list(map(int, sys.stdin.read().split()))
AB = list(zip(m, m))
INF = 10**20
dp = [INF]*(H+10**4)
dp[0] = 0
for a, b in AB:
for j in range(H+10**4):
dp[j] = min(dp[j], dp[j-a] + ... | import sys
H, N = list(map(int, sys.stdin.readline().split()))
m = list(map(int, sys.stdin.read().split()))
AB = list(zip(m, m))
INF = 10**20
dp = [INF]*(H+10**4)
dp[0] = 0
for a, b in AB:
for j in range(H+10**4):
dp[j] = min(dp[j], dp[j-a] + b if j-a >= 0 else INF)
print((min(dp[H:])))
| 18 | 11 | 404 | 290 | import sys
def resolve():
H, N = list(map(int, sys.stdin.readline().split()))
m = list(map(int, sys.stdin.read().split()))
AB = list(zip(m, m))
INF = 10**20
dp = [INF] * (H + 10**4)
dp[0] = 0
for a, b in AB:
for j in range(H + 10**4):
dp[j] = min(dp[j], dp[j - a] + b if... | import sys
H, N = list(map(int, sys.stdin.readline().split()))
m = list(map(int, sys.stdin.read().split()))
AB = list(zip(m, m))
INF = 10**20
dp = [INF] * (H + 10**4)
dp[0] = 0
for a, b in AB:
for j in range(H + 10**4):
dp[j] = min(dp[j], dp[j - a] + b if j - a >= 0 else INF)
print((min(dp[H:])))
| false | 38.888889 | [
"-",
"-def resolve():",
"- H, N = list(map(int, sys.stdin.readline().split()))",
"- m = list(map(int, sys.stdin.read().split()))",
"- AB = list(zip(m, m))",
"- INF = 10**20",
"- dp = [INF] * (H + 10**4)",
"- dp[0] = 0",
"- for a, b in AB:",
"- for j in range(H + 10**4):... | false | 0.219042 | 0.456134 | 0.480213 | [
"s601360481",
"s477393725"
] |
u670180528 | p04015 | python | s280078835 | s608088283 | 28 | 25 | 3,188 | 3,188 | Accepted | Accepted | 10.71 | n,a,*X=list(map(int,open(0).read().split()))
y=[a-x for x in X]
dp={0:1}
for i in y:
for k,v in set(dp.items()):
dp[i+k]=dp.get(i+k,0)+v
print((dp[0]-1)) | n,a=list(map(int,input().split()))
y=[a-int(x) for x in input().split()]
dp={0:1}
for i in y:
for k,v in list(dp.items()):
dp[i+k]=dp.get(i+k,0)+v
print((dp[0]-1)) | 7 | 7 | 154 | 164 | n, a, *X = list(map(int, open(0).read().split()))
y = [a - x for x in X]
dp = {0: 1}
for i in y:
for k, v in set(dp.items()):
dp[i + k] = dp.get(i + k, 0) + v
print((dp[0] - 1))
| n, a = list(map(int, input().split()))
y = [a - int(x) for x in input().split()]
dp = {0: 1}
for i in y:
for k, v in list(dp.items()):
dp[i + k] = dp.get(i + k, 0) + v
print((dp[0] - 1))
| false | 0 | [
"-n, a, *X = list(map(int, open(0).read().split()))",
"-y = [a - x for x in X]",
"+n, a = list(map(int, input().split()))",
"+y = [a - int(x) for x in input().split()]",
"- for k, v in set(dp.items()):",
"+ for k, v in list(dp.items()):"
] | false | 0.119501 | 0.046151 | 2.589322 | [
"s280078835",
"s608088283"
] |
u599114793 | p03107 | python | s209413610 | s480642761 | 42 | 37 | 3,188 | 3,956 | Accepted | Accepted | 11.9 | s = eval(input())
ans = 0
for i in range(len(s)):
if s[i] == "0":
ans -= 1
else:
ans += 1
print((len(s) - abs(ans)))
| s = list(eval(input()))
cnt = 0
for i in range(len(s)):
if s[i] == "0":
cnt += 1
print((min(cnt, len(s)-cnt)*2))
| 8 | 6 | 140 | 122 | s = eval(input())
ans = 0
for i in range(len(s)):
if s[i] == "0":
ans -= 1
else:
ans += 1
print((len(s) - abs(ans)))
| s = list(eval(input()))
cnt = 0
for i in range(len(s)):
if s[i] == "0":
cnt += 1
print((min(cnt, len(s) - cnt) * 2))
| false | 25 | [
"-s = eval(input())",
"-ans = 0",
"+s = list(eval(input()))",
"+cnt = 0",
"- ans -= 1",
"- else:",
"- ans += 1",
"-print((len(s) - abs(ans)))",
"+ cnt += 1",
"+print((min(cnt, len(s) - cnt) * 2))"
] | false | 0.046615 | 0.038091 | 1.223772 | [
"s209413610",
"s480642761"
] |
u525065967 | p02642 | python | s164794170 | s756038144 | 471 | 392 | 32,248 | 32,240 | Accepted | Accepted | 16.77 | n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0]*(mx+1)
for a in A:
for i in range(a, mx+1, a): c[i] += 1
ans = 0
for a in A:
if c[a] == 1: ans += 1
print(ans)
| n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0]*(mx+1)
for a in A:
if c[a]: c[a] = 2; continue
for i in range(a, mx+1, a): c[i] += 1
ans = 0
for a in A:
if c[a] == 1: ans += 1
print(ans)
| 10 | 11 | 198 | 231 | n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0] * (mx + 1)
for a in A:
for i in range(a, mx + 1, a):
c[i] += 1
ans = 0
for a in A:
if c[a] == 1:
ans += 1
print(ans)
| n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0] * (mx + 1)
for a in A:
if c[a]:
c[a] = 2
continue
for i in range(a, mx + 1, a):
c[i] += 1
ans = 0
for a in A:
if c[a] == 1:
ans += 1
print(ans)
| false | 9.090909 | [
"+ if c[a]:",
"+ c[a] = 2",
"+ continue"
] | false | 0.073524 | 0.033904 | 2.168582 | [
"s164794170",
"s756038144"
] |
u014333473 | p03317 | python | s939460286 | s296899672 | 49 | 24 | 20,520 | 10,080 | Accepted | Accepted | 51.02 | import math
n,k=list(map(int,input().split()));a=list(map(int,input().split()))
print(([math.ceil((n-k)/(k-1))+1,1][n==k])) | import math
n,k=list(map(int,input().split()));eval(input());print(([math.ceil((n-k)/(k-1))+1,1][n==k])) | 3 | 2 | 117 | 91 | import math
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
print(([math.ceil((n - k) / (k - 1)) + 1, 1][n == k]))
| import math
n, k = list(map(int, input().split()))
eval(input())
print(([math.ceil((n - k) / (k - 1)) + 1, 1][n == k]))
| false | 33.333333 | [
"-a = list(map(int, input().split()))",
"+eval(input())"
] | false | 0.039249 | 0.035568 | 1.1035 | [
"s939460286",
"s296899672"
] |
u673361376 | p03309 | python | s651003685 | s206588530 | 271 | 213 | 27,248 | 26,180 | Accepted | Accepted | 21.4 | import statistics
N = int(eval(input()))
A = [int(a)-(i+1) for i, a in enumerate(input().split())]
ans = float('inf')
medi = int(statistics.median(A))
for b in range(medi-1, medi+2):
ans = min(ans, sum([abs(A[i]-b) for i in range(N)]))
print(ans)
| def calc_sadness(b):
ans = 0
for a in A:
ans += abs(a - b)
return ans
N = int(eval(input()))
A = []
for idx, a in enumerate(map(int, input().split())):
A.append(a - idx - 1)
A.sort()
if N % 2 == 0:
b = [A[N // 2]]
else:
b = [A[N // 2 - 1], A[N // 2]]
print((min(list... | 8 | 19 | 250 | 332 | import statistics
N = int(eval(input()))
A = [int(a) - (i + 1) for i, a in enumerate(input().split())]
ans = float("inf")
medi = int(statistics.median(A))
for b in range(medi - 1, medi + 2):
ans = min(ans, sum([abs(A[i] - b) for i in range(N)]))
print(ans)
| def calc_sadness(b):
ans = 0
for a in A:
ans += abs(a - b)
return ans
N = int(eval(input()))
A = []
for idx, a in enumerate(map(int, input().split())):
A.append(a - idx - 1)
A.sort()
if N % 2 == 0:
b = [A[N // 2]]
else:
b = [A[N // 2 - 1], A[N // 2]]
print((min(list(map(calc_sadness, b... | false | 57.894737 | [
"-import statistics",
"+def calc_sadness(b):",
"+ ans = 0",
"+ for a in A:",
"+ ans += abs(a - b)",
"+ return ans",
"+",
"-A = [int(a) - (i + 1) for i, a in enumerate(input().split())]",
"-ans = float(\"inf\")",
"-medi = int(statistics.median(A))",
"-for b in range(medi - 1, medi... | false | 0.119078 | 0.037368 | 3.186649 | [
"s651003685",
"s206588530"
] |
u697386253 | p02702 | python | s078084008 | s666970096 | 117 | 106 | 9,356 | 9,196 | Accepted | Accepted | 9.4 | s=eval(input())
s=s[::-1]
n=len(s)
count=[0]*2019
count[0]=1
num,d=0,1
for i in s:
num+=int(i)*d
num%=2019
d*=10
d%=2019
count[num]+=1
ans=0
for i in count:
ans+=i*(i-1)//2
print(ans)
| s = eval(input())
s = s[::-1]
n = len(s)
num = [0]*2019
num[0] = 1
number = 0
d = 1
for i in s:
number += int(i)*d
num[number%2019] += 1
d *= 10
d %= 2019
ans = 0
for i in num:
ans += i*(i-1)//2
print(ans) | 20 | 21 | 215 | 244 | s = eval(input())
s = s[::-1]
n = len(s)
count = [0] * 2019
count[0] = 1
num, d = 0, 1
for i in s:
num += int(i) * d
num %= 2019
d *= 10
d %= 2019
count[num] += 1
ans = 0
for i in count:
ans += i * (i - 1) // 2
print(ans)
| s = eval(input())
s = s[::-1]
n = len(s)
num = [0] * 2019
num[0] = 1
number = 0
d = 1
for i in s:
number += int(i) * d
num[number % 2019] += 1
d *= 10
d %= 2019
ans = 0
for i in num:
ans += i * (i - 1) // 2
print(ans)
| false | 4.761905 | [
"-count = [0] * 2019",
"-count[0] = 1",
"-num, d = 0, 1",
"+num = [0] * 2019",
"+num[0] = 1",
"+number = 0",
"+d = 1",
"- num += int(i) * d",
"- num %= 2019",
"+ number += int(i) * d",
"+ num[number % 2019] += 1",
"- count[num] += 1",
"-for i in count:",
"+for i in num:"
] | false | 0.038914 | 0.101527 | 0.383289 | [
"s078084008",
"s666970096"
] |
u535803878 | p03364 | python | s184735046 | s796288382 | 633 | 580 | 69,024 | 74,128 | Accepted | Accepted | 8.37 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
s = [None]*n
for i in range(n):
s[i] = eval(input())
def sub(i):
# res = True
# for j in range(n):
# if not all(s[(... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
s = [None]*n
for i in range(n):
s[i] = eval(input())
ans = n * sum(all(all(s[(i+j)%n][(j+k)%n]==s[(i+j+k)%n][j] for k in range(n)) for... | 24 | 13 | 594 | 354 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
s = [None] * n
for i in range(n):
s[i] = eval(input())
def sub(i):
# res = True
# for j in range(n):
# if not all(s[(i+j... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
s = [None] * n
for i in range(n):
s[i] = eval(input())
ans = n * sum(
all(
all(s[(i + j) % n][(j + k) % n] == s[(i + j + k) % n][j] for k ... | false | 45.833333 | [
"-",
"-",
"-def sub(i):",
"- # res = True",
"- # for j in range(n):",
"- # if not all(s[(i+j)%n][(j+k)%n]==s[(i+j+k)%n][j] for k in range(n)):",
"- # res = False",
"- # break",
"- res = all(",
"+ans = n * sum(",
"+ all(",
"- retur... | false | 0.039926 | 0.040563 | 0.984284 | [
"s184735046",
"s796288382"
] |
u014333473 | p03208 | python | s982905907 | s200190901 | 228 | 172 | 7,384 | 16,908 | Accepted | Accepted | 24.56 | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
diff = max(h)
for i in range(0, len(h)-K+1):
if diff > h[i+K-1]-h[i]:
diff = h[i+K-1]-h[i]
print(diff) | n,k=list(map(int,input().split()));h=sorted([int(eval(input())) for _ in range(n)])
print((min([h[i+k-1]-h[i] for i in range(n-k+1)]))) | 8 | 2 | 194 | 122 | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
diff = max(h)
for i in range(0, len(h) - K + 1):
if diff > h[i + K - 1] - h[i]:
diff = h[i + K - 1] - h[i]
print(diff)
| n, k = list(map(int, input().split()))
h = sorted([int(eval(input())) for _ in range(n)])
print((min([h[i + k - 1] - h[i] for i in range(n - k + 1)])))
| false | 75 | [
"-N, K = list(map(int, input().split()))",
"-h = [int(eval(input())) for _ in range(N)]",
"-h.sort()",
"-diff = max(h)",
"-for i in range(0, len(h) - K + 1):",
"- if diff > h[i + K - 1] - h[i]:",
"- diff = h[i + K - 1] - h[i]",
"-print(diff)",
"+n, k = list(map(int, input().split()))",
"... | false | 0.042597 | 0.038264 | 1.113237 | [
"s982905907",
"s200190901"
] |
u654470292 | p02574 | python | s944850275 | s670789305 | 1,302 | 851 | 250,344 | 241,208 | Accepted | Accepted | 34.64 | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 48 | 53 | 959 | 1,036 | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 9.433962 | [
"-dic = defaultdict(int)",
"+dic = {}",
"- dic[a[i]] += 1",
"+ if a[i] in dic:",
"+ dic[a[i]] += 1",
"+ else:",
"+ dic[a[i]] = 1",
"- cnt += dic[now]",
"+ if now in dic:",
"+ cnt += dic[now]"
] | false | 0.063118 | 0.038116 | 1.65597 | [
"s944850275",
"s670789305"
] |
u190405389 | p03760 | python | s381816469 | s454513942 | 23 | 18 | 2,940 | 2,940 | Accepted | Accepted | 21.74 | o = eval(input())
e = eval(input())
ans = ''
for i in range(len(o) - 1):
ans += o[i] + e[i]
ans += o[-1]
if len(o) == len(e):
ans += e[-1]
print(ans)
| o = list(eval(input()))
e = eval(input())
for i in range(len(e)):
o.insert(i*2+1, e[i])
print((''.join(o)))
| 14 | 7 | 164 | 106 | o = eval(input())
e = eval(input())
ans = ""
for i in range(len(o) - 1):
ans += o[i] + e[i]
ans += o[-1]
if len(o) == len(e):
ans += e[-1]
print(ans)
| o = list(eval(input()))
e = eval(input())
for i in range(len(e)):
o.insert(i * 2 + 1, e[i])
print(("".join(o)))
| false | 50 | [
"-o = eval(input())",
"+o = list(eval(input()))",
"-ans = \"\"",
"-for i in range(len(o) - 1):",
"- ans += o[i] + e[i]",
"-ans += o[-1]",
"-if len(o) == len(e):",
"- ans += e[-1]",
"-print(ans)",
"+for i in range(len(e)):",
"+ o.insert(i * 2 + 1, e[i])",
"+print((\"\".join(o)))"
] | false | 0.042314 | 0.09943 | 0.425567 | [
"s381816469",
"s454513942"
] |
u886766186 | p01751 | python | s418861952 | s591702772 | 50 | 30 | 7,732 | 7,660 | Accepted | Accepted | 40 | def solve(a, b, c):
l = 0; r = a;
t = 0
for i in range(80):
t = l // 60
p = 60*t + c
if l <= p <= r:
print(p)
exit()
l = r + b
r = l + a
print((-1))
a, b, c = list(map(int, input().split()))
solve(a,b,c) | a, b, c = list(map(int, input().split()))
l = 0; r = a;
for i in range(80):
t = l // 60
p = 60*t + c
if l <= p <= r:
print(p)
exit()
l = r + b
r = l + a
print((-1)) | 17 | 14 | 294 | 208 | def solve(a, b, c):
l = 0
r = a
t = 0
for i in range(80):
t = l // 60
p = 60 * t + c
if l <= p <= r:
print(p)
exit()
l = r + b
r = l + a
print((-1))
a, b, c = list(map(int, input().split()))
solve(a, b, c)
| a, b, c = list(map(int, input().split()))
l = 0
r = a
for i in range(80):
t = l // 60
p = 60 * t + c
if l <= p <= r:
print(p)
exit()
l = r + b
r = l + a
print((-1))
| false | 17.647059 | [
"-def solve(a, b, c):",
"- l = 0",
"- r = a",
"- t = 0",
"- for i in range(80):",
"- t = l // 60",
"- p = 60 * t + c",
"- if l <= p <= r:",
"- print(p)",
"- exit()",
"- l = r + b",
"- r = l + a",
"- print((-1))",
"-",
... | false | 0.041335 | 0.041275 | 1.001458 | [
"s418861952",
"s591702772"
] |
u316386814 | p03091 | python | s217209749 | s410369822 | 400 | 324 | 40,804 | 28,380 | Accepted | Accepted | 19 | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | 53 | 53 | 1,398 | 1,374 | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | false | 0 | [
"-from collections import defaultdict, deque",
"+from collections import defaultdict",
"- edges = defaultdict(set)",
"+ edges = defaultdict(list)",
"- edges[a].add(b)",
"- edges[b].add(a)",
"- quads = set()",
"- sixes = 0",
"+ edges[a].append(b)",
"+ edges[b... | false | 0.041784 | 0.041436 | 1.008401 | [
"s217209749",
"s410369822"
] |
u755585099 | p03160 | python | s723031508 | s760325090 | 106 | 76 | 13,928 | 14,184 | Accepted | Accepted | 28.3 | n = int(eval(input()))
hs = list(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i-2])
d2 = b + abs(hs[i] - hs[i-1])
a, b = b, d1 if d1 <= d2 else d2
print(b) | def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i-2])
d2 = b + abs(hs[i] - hs[i-1])
a, b = b, d1 if d1 <= d2 else d2
print(b)
if __name__ == "__main__":
main() | 11 | 15 | 225 | 295 | n = int(eval(input()))
hs = list(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i - 2])
d2 = b + abs(hs[i] - hs[i - 1])
a, b = b, d1 if d1 <= d2 else d2
print(b)
| def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i - 2])
d2 = b + abs(hs[i] - hs[i - 1])
a, b = b, d1 if d1 <= d2 else d2
print(b)
if __name__ == "__main__":
main()
| false | 26.666667 | [
"-n = int(eval(input()))",
"-hs = list(map(int, input().split()))",
"-a, b = 0, abs(hs[1] - hs[0])",
"-for i in range(2, n):",
"- d1 = a + abs(hs[i] - hs[i - 2])",
"- d2 = b + abs(hs[i] - hs[i - 1])",
"- a, b = b, d1 if d1 <= d2 else d2",
"-print(b)",
"+def main():",
"+ n = int(eval(in... | false | 0.082162 | 0.048432 | 1.69643 | [
"s723031508",
"s760325090"
] |
u836737505 | p02720 | python | s205415392 | s872084434 | 588 | 378 | 11,424 | 10,916 | Accepted | Accepted | 35.71 | z = int(eval(input()))
l = []
for i in range(1,10):
l.append(i)
for j in range(max(0,i-1),min(10,i+2)):
l.append(int(str(i)+str(j)))
for k in range(max(j-1,0),min(10,j+2)):
l.append(int(str(i)+str(j)+str(k)))
for m in range(max(k-1,0),min(10,k+2)):
... | from collections import deque
k = int(eval(input()))
s = deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
c = s.popleft()
d = int(str(c)[-1])
for j in range(max(0,d-1),min(10,d+2)):
s.append(int(str(c)+str(j)))
print(c) | 25 | 9 | 1,378 | 238 | z = int(eval(input()))
l = []
for i in range(1, 10):
l.append(i)
for j in range(max(0, i - 1), min(10, i + 2)):
l.append(int(str(i) + str(j)))
for k in range(max(j - 1, 0), min(10, j + 2)):
l.append(int(str(i) + str(j) + str(k)))
for m in range(max(k - 1, 0), min(10, k + ... | from collections import deque
k = int(eval(input()))
s = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(k):
c = s.popleft()
d = int(str(c)[-1])
for j in range(max(0, d - 1), min(10, d + 2)):
s.append(int(str(c) + str(j)))
print(c)
| false | 64 | [
"-z = int(eval(input()))",
"-l = []",
"-for i in range(1, 10):",
"- l.append(i)",
"- for j in range(max(0, i - 1), min(10, i + 2)):",
"- l.append(int(str(i) + str(j)))",
"- for k in range(max(j - 1, 0), min(10, j + 2)):",
"- l.append(int(str(i) + str(j) + str(k)))",
"-... | false | 1.3134 | 0.107964 | 12.165144 | [
"s205415392",
"s872084434"
] |
u589886885 | p02267 | python | s936448444 | s358598627 | 50 | 30 | 8,468 | 7,880 | Accepted | Accepted | 40 | import sys
n = int(sys.stdin.readline())
s = [int(x) for x in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
t = [int(x) for x in sys.stdin.readline().split()]
cnt = 0
for i in t:
if i in s:
cnt += 1
print(cnt) | import sys
n = sys.stdin.readline()
s = sys.stdin.readline().split()
q = sys.stdin.readline()
t = sys.stdin.readline().split()
cnt = 0
for i in t:
if i in s:
cnt += 1
print(cnt) | 13 | 13 | 250 | 204 | import sys
n = int(sys.stdin.readline())
s = [int(x) for x in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
t = [int(x) for x in sys.stdin.readline().split()]
cnt = 0
for i in t:
if i in s:
cnt += 1
print(cnt)
| import sys
n = sys.stdin.readline()
s = sys.stdin.readline().split()
q = sys.stdin.readline()
t = sys.stdin.readline().split()
cnt = 0
for i in t:
if i in s:
cnt += 1
print(cnt)
| false | 0 | [
"-n = int(sys.stdin.readline())",
"-s = [int(x) for x in sys.stdin.readline().split()]",
"-q = int(sys.stdin.readline())",
"-t = [int(x) for x in sys.stdin.readline().split()]",
"+n = sys.stdin.readline()",
"+s = sys.stdin.readline().split()",
"+q = sys.stdin.readline()",
"+t = sys.stdin.readline().sp... | false | 0.04071 | 0.037796 | 1.077117 | [
"s936448444",
"s358598627"
] |
u347600233 | p03011 | python | s597119974 | s813506375 | 31 | 27 | 9,084 | 9,096 | Accepted | Accepted | 12.9 | t = list(map(int, input().split()))
print((sum(t) - max(t))) | p, q, r = list(map(int, input().split()))
print((p + q + r - max(p, q, r))) | 2 | 2 | 59 | 68 | t = list(map(int, input().split()))
print((sum(t) - max(t)))
| p, q, r = list(map(int, input().split()))
print((p + q + r - max(p, q, r)))
| false | 0 | [
"-t = list(map(int, input().split()))",
"-print((sum(t) - max(t)))",
"+p, q, r = list(map(int, input().split()))",
"+print((p + q + r - max(p, q, r)))"
] | false | 0.07268 | 0.083663 | 0.868723 | [
"s597119974",
"s813506375"
] |
u241159583 | p02755 | python | s689346291 | s308308997 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | a,b = list(map(int, input().split()))
ans = -1
for i in range(1, 10000):
if int(i*0.08)==a and int(i*0.1)==b:
ans = i
break
print(ans) | a,b = list(map(int, input().split()))
for i in range(1, 1001):
if int(i * 0.08) == a and int(i * 0.1) == b:
print(i)
exit()
print((-1)) | 8 | 7 | 146 | 144 | a, b = list(map(int, input().split()))
ans = -1
for i in range(1, 10000):
if int(i * 0.08) == a and int(i * 0.1) == b:
ans = i
break
print(ans)
| a, b = list(map(int, input().split()))
for i in range(1, 1001):
if int(i * 0.08) == a and int(i * 0.1) == b:
print(i)
exit()
print((-1))
| false | 12.5 | [
"-ans = -1",
"-for i in range(1, 10000):",
"+for i in range(1, 1001):",
"- ans = i",
"- break",
"-print(ans)",
"+ print(i)",
"+ exit()",
"+print((-1))"
] | false | 0.046878 | 0.04523 | 1.036423 | [
"s689346291",
"s308308997"
] |
u982896977 | p03162 | python | s189184251 | s714866349 | 697 | 560 | 80,344 | 34,672 | Accepted | Accepted | 19.66 | n = int(eval(input()))
A = []
B = []
C = []
for i in range(n):
a,b,c = list(map(int,input().split()))
A.append(a)
B.append(b)
C.append(c)
dp = [[0 for i in range(3)] for j in range(n)]
dp[0][0] = A[0]
dp[0][1] = B[0]
dp[0][2] = C[0]
for i in range(1,n):
dp[i][0] = max(dp[i-1]... | n = int(eval(input()))
A = []
B = []
C = []
for _ in range(n):
a,b,c = list(map(int,input().split()))
A.append(a)
B.append(b)
C.append(c)
dp = [[0]*3 for i in range(n)]
dp[0][0] = A[0]
dp[0][1] = B[0]
dp[0][2] = C[0]
for i in range(1,n):
dp[i][0] = max(dp[i-1][1]+A[i],dp[i-1][2]+A[i])
... | 22 | 18 | 472 | 433 | n = int(eval(input()))
A = []
B = []
C = []
for i in range(n):
a, b, c = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
dp = [[0 for i in range(3)] for j in range(n)]
dp[0][0] = A[0]
dp[0][1] = B[0]
dp[0][2] = C[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2])... | n = int(eval(input()))
A = []
B = []
C = []
for _ in range(n):
a, b, c = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
dp = [[0] * 3 for i in range(n)]
dp[0][0] = A[0]
dp[0][1] = B[0]
dp[0][2] = C[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][1] + A[i], dp[i - 1][2] + A[i])... | false | 18.181818 | [
"-for i in range(n):",
"+for _ in range(n):",
"-dp = [[0 for i in range(3)] for j in range(n)]",
"+dp = [[0] * 3 for i in range(n)]",
"- dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + A[i]",
"- dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + B[i]",
"- dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + C[i... | false | 0.036982 | 0.040092 | 0.922438 | [
"s189184251",
"s714866349"
] |
u734876600 | p02911 | python | s315427494 | s606616402 | 1,919 | 182 | 27,492 | 11,532 | Accepted | Accepted | 90.52 | import numpy as np
n,k,q = list(map(int, input().split()))
p = np.full(n, k, dtype=np.int)
first = 0
for i in range(q):
a = int(eval(input()))
p -= 1
p[a-1] += 1
for i in p:
if i <= 0:
print("No")
else:
print("Yes") | n,k,q = list(map(int, input().split()))
p = [k-q]*n
first = 0
for i in range(q):
a = int(eval(input()))
p[a-1]+=1
for i in p:
if i <= 0:
print("No")
else:
print("Yes") | 13 | 11 | 251 | 197 | import numpy as np
n, k, q = list(map(int, input().split()))
p = np.full(n, k, dtype=np.int)
first = 0
for i in range(q):
a = int(eval(input()))
p -= 1
p[a - 1] += 1
for i in p:
if i <= 0:
print("No")
else:
print("Yes")
| n, k, q = list(map(int, input().split()))
p = [k - q] * n
first = 0
for i in range(q):
a = int(eval(input()))
p[a - 1] += 1
for i in p:
if i <= 0:
print("No")
else:
print("Yes")
| false | 15.384615 | [
"-import numpy as np",
"-",
"-p = np.full(n, k, dtype=np.int)",
"+p = [k - q] * n",
"- p -= 1"
] | false | 0.649766 | 0.062599 | 10.379887 | [
"s315427494",
"s606616402"
] |
u498487134 | p02925 | python | s472334772 | s455447579 | 1,080 | 454 | 62,044 | 87,904 | Accepted | Accepted | 57.96 | N=int(eval(input()))
A=[[] for _ in range(N)]
for i in range(N):
A[i]=list(map(int,input().split()))
NE=[0]*N#i番目の人が,次何番目の試合をするかのリスト
F=[0]*N#i番目の人が,該当する日に試合をしたか記憶しておく
#i+1日目の試合をする人はi日目に試合をした人なので,それを2つのqueueに記憶.
Q=[[],[]]
#初日
for i in range(N):
opp=A[i][0]-1
if A[opp][0]-1==i:
NE[... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=[]
inf=10**6
for _ in range(N):
a=LI()+[inf]
for j in range(N-1):... | 49 | 67 | 1,012 | 1,435 | N = int(eval(input()))
A = [[] for _ in range(N)]
for i in range(N):
A[i] = list(map(int, input().split()))
NE = [0] * N # i番目の人が,次何番目の試合をするかのリスト
F = [0] * N # i番目の人が,該当する日に試合をしたか記憶しておく
# i+1日目の試合をする人はi日目に試合をした人なので,それを2つのqueueに記憶.
Q = [[], []]
# 初日
for i in range(N):
opp = A[i][0] - 1
if A[opp][0] - 1 == ... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
A = []
inf = 10**6
for _ in range(N):
a = LI() + [inf]
f... | false | 26.865672 | [
"-N = int(eval(input()))",
"-A = [[] for _ in range(N)]",
"-for i in range(N):",
"- A[i] = list(map(int, input().split()))",
"-NE = [0] * N # i番目の人が,次何番目の試合をするかのリスト",
"-F = [0] * N # i番目の人が,該当する日に試合をしたか記憶しておく",
"-# i+1日目の試合をする人はi日目に試合をした人なので,それを2つのqueueに記憶.",
"-Q = [[], []]",
"-# 初日",
"-for i... | false | 0.035836 | 0.035706 | 1.003649 | [
"s472334772",
"s455447579"
] |
u729133443 | p03970 | python | s227614734 | s079203660 | 163 | 18 | 38,384 | 2,940 | Accepted | Accepted | 88.96 | t=list(eval(input()));print((sum([1for i in range(16)if'CODEFESTIVAL2016'[i]!=t[i]]))) | print((sum(a!=b for a,b in zip('CODEFESTIVAL2016',eval(input()))))) | 1 | 1 | 78 | 59 | t = list(eval(input()))
print((sum([1 for i in range(16) if "CODEFESTIVAL2016"[i] != t[i]])))
| print((sum(a != b for a, b in zip("CODEFESTIVAL2016", eval(input())))))
| false | 0 | [
"-t = list(eval(input()))",
"-print((sum([1 for i in range(16) if \"CODEFESTIVAL2016\"[i] != t[i]])))",
"+print((sum(a != b for a, b in zip(\"CODEFESTIVAL2016\", eval(input())))))"
] | false | 0.035767 | 0.077167 | 0.463508 | [
"s227614734",
"s079203660"
] |
u561231954 | p02888 | python | s594969032 | s626325972 | 1,397 | 794 | 3,188 | 43,500 | Accepted | Accepted | 43.16 | from bisect import bisect_right
n=int(eval(input()))
L=[int(i) for i in input().split()]
L.sort()
ans=0
for i in range(n-2):
for j in range(i+1,n-1):
c=L[i]+L[j]-1
ans+=bisect_right(L,c)-j-1
print(ans) | n=int(eval(input()))
L=[int(i) for i in input().split()]
L.sort(reverse=True)
def binary(a,b,mid):
if L[mid]+L[j]>L[i]:
return True
else:
return False
ans=0
for i in range(n-2):
for j in range(i+1,n-1):
l=j
r=n
while r-l>1:
mid=(r+l)//2
if binary(i,j,mid):
... | 13 | 24 | 224 | 388 | from bisect import bisect_right
n = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
c = L[i] + L[j] - 1
ans += bisect_right(L, c) - j - 1
print(ans)
| n = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort(reverse=True)
def binary(a, b, mid):
if L[mid] + L[j] > L[i]:
return True
else:
return False
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
l = j
r = n
while r - l > 1:
m... | false | 45.833333 | [
"-from bisect import bisect_right",
"-",
"-L.sort()",
"+L.sort(reverse=True)",
"+",
"+",
"+def binary(a, b, mid):",
"+ if L[mid] + L[j] > L[i]:",
"+ return True",
"+ else:",
"+ return False",
"+",
"+",
"- c = L[i] + L[j] - 1",
"- ans += bisect_right(L, c... | false | 0.07713 | 0.083147 | 0.927636 | [
"s594969032",
"s626325972"
] |
u600402037 | p02749 | python | s903875963 | s909485074 | 1,697 | 737 | 88,340 | 113,100 | Accepted | Accepted | 56.57 | import sys
import numpy as np
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 1 mod 3のグループを先に決めてあとは順番に
N = ir()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(N-1):
a, b = lr()
graph[a].ap... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 1(mod 3)のグループと2(mod 3)を先に決める
N = ir()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(N-1):
a, b = lr()
graph[a].append(b)
graph[b].append(a)
root = 1
rank =... | 97 | 92 | 2,219 | 2,133 | import sys
import numpy as np
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 1 mod 3のグループを先に決めてあとは順番に
N = ir()
graph = [[] for _ in range(N + 1)] # 1-indexed
for _ in range(N - 1):
a, b = lr()
graph[a].append(b)
... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 1(mod 3)のグループと2(mod 3)を先に決める
N = ir()
graph = [[] for _ in range(N + 1)] # 1-indexed
for _ in range(N - 1):
a, b = lr()
graph[a].append(b)
graph[b].append(a)
root = 1
rank = [0] * (N + ... | false | 5.154639 | [
"-import numpy as np",
"-from collections import Counter",
"-# 1 mod 3のグループを先に決めてあとは順番に",
"+# 1(mod 3)のグループと2(mod 3)を先に決める",
"-order = []",
"- order.append(cur)"
] | false | 0.208729 | 0.071979 | 2.89986 | [
"s903875963",
"s909485074"
] |
u973840923 | p03087 | python | s273476267 | s217035303 | 876 | 470 | 7,748 | 30,664 | Accepted | Accepted | 46.35 | N,Q = list(map(int,input().split()))
S = eval(input())
cumu = [0]*(N+1)
for i in range(N):
cumu[i+1] = cumu[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
l,r = list(map(int,input().split()))
print((cumu[r-1]-cumu[l-1])) | N,Q = list(map(int,input().split()))
S = eval(input())
list = [list(map(int,input().split())) for i in range(Q)]
comu = [0]*(N+1)
for i in range(N):
if S[i:i+2] == 'AC':
comu[i+1] = comu[i] + 1
else:
comu[i+1] = comu[i]
for l,r in list:
print((comu[r-1]-comu[l-1])) | 11 | 14 | 233 | 295 | N, Q = list(map(int, input().split()))
S = eval(input())
cumu = [0] * (N + 1)
for i in range(N):
cumu[i + 1] = cumu[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((cumu[r - 1] - cumu[l - 1]))
| N, Q = list(map(int, input().split()))
S = eval(input())
list = [list(map(int, input().split())) for i in range(Q)]
comu = [0] * (N + 1)
for i in range(N):
if S[i : i + 2] == "AC":
comu[i + 1] = comu[i] + 1
else:
comu[i + 1] = comu[i]
for l, r in list:
print((comu[r - 1] - comu[l - 1]))
| false | 21.428571 | [
"-cumu = [0] * (N + 1)",
"+list = [list(map(int, input().split())) for i in range(Q)]",
"+comu = [0] * (N + 1)",
"- cumu[i + 1] = cumu[i] + (1 if S[i : i + 2] == \"AC\" else 0)",
"-for i in range(Q):",
"- l, r = list(map(int, input().split()))",
"- print((cumu[r - 1] - cumu[l - 1]))",
"+ i... | false | 0.045672 | 0.054296 | 0.841178 | [
"s273476267",
"s217035303"
] |
u057109575 | p02972 | python | s914599697 | s282929662 | 165 | 151 | 102,488 | 101,732 | Accepted | Accepted | 8.48 | N, *A = list(map(int, open(0).read().split()))
x = [0] * (N + 1)
ans = []
for i in reversed(list(range(1, N + 1))):
tmp = 0
for j in range(i, N + 1, i):
tmp += x[j]
if tmp % 2 != A[i - 1]:
x[i] += 1
ans.append(i)
print((len(ans)))
if ans:
print((*ans))
| N, *A = list(map(int, open(0).read().split()))
x = [0] * (N + 1)
ans = []
for i in reversed(list(range(1, N + 1))):
if sum(x[i::i]) % 2 != A[i - 1]:
x[i] += 1
ans.append(i)
print((len(ans)))
if ans:
print((*ans))
| 17 | 13 | 297 | 236 | N, *A = list(map(int, open(0).read().split()))
x = [0] * (N + 1)
ans = []
for i in reversed(list(range(1, N + 1))):
tmp = 0
for j in range(i, N + 1, i):
tmp += x[j]
if tmp % 2 != A[i - 1]:
x[i] += 1
ans.append(i)
print((len(ans)))
if ans:
print((*ans))
| N, *A = list(map(int, open(0).read().split()))
x = [0] * (N + 1)
ans = []
for i in reversed(list(range(1, N + 1))):
if sum(x[i::i]) % 2 != A[i - 1]:
x[i] += 1
ans.append(i)
print((len(ans)))
if ans:
print((*ans))
| false | 23.529412 | [
"- tmp = 0",
"- for j in range(i, N + 1, i):",
"- tmp += x[j]",
"- if tmp % 2 != A[i - 1]:",
"+ if sum(x[i::i]) % 2 != A[i - 1]:"
] | false | 0.083098 | 0.037194 | 2.234182 | [
"s914599697",
"s282929662"
] |
u583507988 | p03103 | python | s942750384 | s800914096 | 397 | 349 | 27,360 | 24,044 | Accepted | Accepted | 12.09 | from operator import itemgetter
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
#print(ab)
i = 0
ans = 0
while m >0:
if ab[i][1]<=m:
m -= ab[i][1]
ans += ab[i][0]*ab[i][1]
else:
ans += ab[i][0]*m
m = 0
i+=1
print(ans) | n,m=list(map(int,input().split()))
ab=[]
for i in range(n):
a,b=list(map(int,input().split()))
ab.append([a,b])
ab.sort()
ans=0
t=m
for i in range(n):
if ab[i][1]<t:
ans+=ab[i][0]*ab[i][1]
t-=ab[i][1]
else:
ans+=ab[i][0]*t
print(ans)
exit() | 17 | 16 | 308 | 271 | from operator import itemgetter
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
# print(ab)
i = 0
ans = 0
while m > 0:
if ab[i][1] <= m:
m -= ab[i][1]
ans += ab[i][0] * ab[i][1]
else:
ans += ab[i][0] * m
m = 0
i += 1
... | n, m = list(map(int, input().split()))
ab = []
for i in range(n):
a, b = list(map(int, input().split()))
ab.append([a, b])
ab.sort()
ans = 0
t = m
for i in range(n):
if ab[i][1] < t:
ans += ab[i][0] * ab[i][1]
t -= ab[i][1]
else:
ans += ab[i][0] * t
print(ans)
exi... | false | 5.882353 | [
"-from operator import itemgetter",
"-",
"-ab = [list(map(int, input().split())) for i in range(n)]",
"+ab = []",
"+for i in range(n):",
"+ a, b = list(map(int, input().split()))",
"+ ab.append([a, b])",
"-# print(ab)",
"-i = 0",
"-while m > 0:",
"- if ab[i][1] <= m:",
"- m -= ... | false | 0.040009 | 0.038583 | 1.036942 | [
"s942750384",
"s800914096"
] |
u079022693 | p02996 | python | s644026062 | s585195859 | 906 | 610 | 53,620 | 53,656 | Accepted | Accepted | 32.67 | def main():
N=int(eval(input()))
AB=[0]*N
for i in range(N):
ab=list(map(int,input().split()))
AB[i]=ab
AB.sort(key=lambda x:x[1])
t=0
flag=True
for i in range(N):
t+=AB[i][0]
if t>AB[i][1]:
print("No")
flag=False
... | from sys import stdin
def main():
#入力
readline=stdin.readline
N=int(readline())
li=[]
for i in range(N):
ab=list(map(int,readline().split()))
li.append(ab)
li.sort(key=lambda x:x[1])
t=0
for i in range(N):
task=li[i]
t+=task[0]
... | 19 | 22 | 397 | 448 | def main():
N = int(eval(input()))
AB = [0] * N
for i in range(N):
ab = list(map(int, input().split()))
AB[i] = ab
AB.sort(key=lambda x: x[1])
t = 0
flag = True
for i in range(N):
t += AB[i][0]
if t > AB[i][1]:
print("No")
flag = False
... | from sys import stdin
def main():
# 入力
readline = stdin.readline
N = int(readline())
li = []
for i in range(N):
ab = list(map(int, readline().split()))
li.append(ab)
li.sort(key=lambda x: x[1])
t = 0
for i in range(N):
task = li[i]
t += task[0]
i... | false | 13.636364 | [
"+from sys import stdin",
"+",
"+",
"- N = int(eval(input()))",
"- AB = [0] * N",
"+ # 入力",
"+ readline = stdin.readline",
"+ N = int(readline())",
"+ li = []",
"- ab = list(map(int, input().split()))",
"- AB[i] = ab",
"- AB.sort(key=lambda x: x[1])",
"+ ... | false | 0.042104 | 0.033453 | 1.258616 | [
"s644026062",
"s585195859"
] |
u116038906 | p03032 | python | s477431564 | s848184593 | 104 | 31 | 10,712 | 9,256 | Accepted | Accepted | 70.19 | # 初期入力
import bisect
import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
V = list(map(int, input().split()))
V_sorted =sorted(V)
#取る個数take_num、返す個数reverse(t +r <=K)個全て決める
ans =[]
take_V =[] #最後に持っている宝石の価値
#Vが全てマイナスなら取らない
if V_sorted[-1] <=0:
ans =0
else:
take_num =min... | # 初期入力
import bisect
import heapq
import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
V = list(map(int, input().split()))
V_sorted =sorted(V)
#取る個数take_num、返す個数reverse(t +r <=K)個全て決める
ans =[]
take_V =[] #最後に持っている宝石の価値
#Vが全てマイナスなら取らない
if V_sorted[-1] <=0:
ans =0
else:
... | 31 | 34 | 836 | 948 | # 初期入力
import bisect
import sys
input = sys.stdin.readline
N, K = (int(i) for i in input().split())
V = list(map(int, input().split()))
V_sorted = sorted(V)
# 取る個数take_num、返す個数reverse(t +r <=K)個全て決める
ans = []
take_V = [] # 最後に持っている宝石の価値
# Vが全てマイナスなら取らない
if V_sorted[-1] <= 0:
ans = 0
else:
take_num = min(K, N)... | # 初期入力
import bisect
import heapq
import sys
input = sys.stdin.readline
N, K = (int(i) for i in input().split())
V = list(map(int, input().split()))
V_sorted = sorted(V)
# 取る個数take_num、返す個数reverse(t +r <=K)個全て決める
ans = []
take_V = [] # 最後に持っている宝石の価値
# Vが全てマイナスなら取らない
if V_sorted[-1] <= 0:
ans = 0
else:
take_nu... | false | 8.823529 | [
"+import heapq",
"- reverse = min(K - tak, tak) # 返す数はtake_numではなく、Kから引く",
"- for rev in range(reverse + 1):",
"- take = [] # 取った宝石",
"- rig = N - (tak - lef) # lef:左側の取る数 rig:右側の取る数",
"- take.extend(V[:lef])",
"- take.exte... | false | 0.138238 | 0.039204 | 3.526162 | [
"s477431564",
"s848184593"
] |
u092104621 | p02595 | python | s614175612 | s152632404 | 520 | 421 | 9,184 | 9,068 | Accepted | Accepted | 19.04 | n,d = list(map(int, input().split()))
c=0
for i in range(n):
x,y = list(map(int, input().split()))
if x ** 2 + y ** 2<= d ** 2:
c += 1
print(c) | n,d = list(map(int, input().split()))
c=0
for i in range(n):
x,y = list(map(int, input().split()))
if x * x + y * y <= d * d:
c += 1
print(c) | 7 | 7 | 157 | 155 | n, d = list(map(int, input().split()))
c = 0
for i in range(n):
x, y = list(map(int, input().split()))
if x**2 + y**2 <= d**2:
c += 1
print(c)
| n, d = list(map(int, input().split()))
c = 0
for i in range(n):
x, y = list(map(int, input().split()))
if x * x + y * y <= d * d:
c += 1
print(c)
| false | 0 | [
"- if x**2 + y**2 <= d**2:",
"+ if x * x + y * y <= d * d:"
] | false | 0.043565 | 0.04188 | 1.040223 | [
"s614175612",
"s152632404"
] |
u869919400 | p02924 | python | s407437142 | s144712013 | 1,477 | 61 | 38,384 | 61,680 | Accepted | Accepted | 95.87 | n = int(eval(input()))
print((sum(range(n)))) | N = int(eval(input()))
print(((N-1)*N//2))
| 2 | 2 | 38 | 36 | n = int(eval(input()))
print((sum(range(n))))
| N = int(eval(input()))
print(((N - 1) * N // 2))
| false | 0 | [
"-n = int(eval(input()))",
"-print((sum(range(n))))",
"+N = int(eval(input()))",
"+print(((N - 1) * N // 2))"
] | false | 0.09607 | 0.03874 | 2.479871 | [
"s407437142",
"s144712013"
] |
u285891772 | p02791 | python | s721580749 | s775547371 | 170 | 144 | 27,196 | 27,192 | Accepted | Accepted | 15.29 | 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
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | 32 | 31 | 919 | 908 | 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
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | false | 3.125 | [
"-cnt = 1",
"-MIN = P[0]",
"+tmp = P[0]",
"+ans = 1",
"- MIN = min(MIN, P[i])",
"- if P[i] == MIN:",
"- cnt += 1",
"-print(cnt)",
"+ if P[i] <= tmp:",
"+ ans += 1",
"+ tmp = P[i]",
"+print(ans)"
] | false | 0.048668 | 0.045976 | 1.058555 | [
"s721580749",
"s775547371"
] |
u852690916 | p02642 | python | s453960241 | s350616289 | 210 | 151 | 108,980 | 106,676 | Accepted | Accepted | 28.1 | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
*A, = list(map(int, input().split()))
w = [0] * (10 ** 6 + 1)
for a in A:
w[a] += 1
f = [False] * (10 ** 6 + 1)
for a in A:
if f[a]:
w[a] = 0
continue
for b i... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
C = [0] * (10**6 + 1)
for a in A:
if C[a] == 1:
C[a] = -1
continue
if C[a] == -1:
continue
C[a] = 1
for b in range(a + a, 10 ** 6 + 1, a):
C[b] = ... | 20 | 24 | 444 | 551 | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
w = [0] * (10**6 + 1)
for a in A:
w[a] += 1
f = [False] * (10**6 + 1)
for a in A:
if f[a]:
w[a] = 0
continue
for b in range(a * 2... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
C = [0] * (10**6 + 1)
for a in A:
if C[a] == 1:
C[a] = -1
continue
if C[a] == -1:
continue
C[a] = 1
for b in range(a + a, 10**6 + 1, a):
C[b] = -1
ans =... | false | 16.666667 | [
"+# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)",
"-def main():",
"+def main(N, A):",
"+ C = [0] * (10**6 + 1)",
"+ for a in A:",
"+ if C[a] == 1:",
"+ C[a] = -1",
"+ continue",
"+ if C[a] == -1:",
"+ continue",
"+ C[a] = 1",
"+ ... | false | 0.108769 | 0.155279 | 0.70047 | [
"s453960241",
"s350616289"
] |
u188827677 | p03699 | python | s095529433 | s650173336 | 29 | 26 | 9,076 | 9,152 | Accepted | Accepted | 10.34 | n = int(eval(input()))
s = sorted([int(eval(input())) for _ in range(n)])
sumNum = sum(s)
if sumNum % 10 != 0:
print(sumNum)
exit()
else:
ans = 0
for i in s:
if (sumNum - i) % 10 != 0:
ans = max(ans, sumNum - i)
print(ans) | from itertools import combinations
n = int(eval(input()))
s = sorted([int(eval(input())) for _ in range(n)])
ans = sum(s)
if ans % 10 != 0: print(ans)
elif all(i%10 == 0 for i in s): print((0))
else:
for i in range(1,n):
for j in combinations(s,i):
t = sum(j)
if (ans-t)%10 != 0:
p... | 13 | 14 | 243 | 333 | n = int(eval(input()))
s = sorted([int(eval(input())) for _ in range(n)])
sumNum = sum(s)
if sumNum % 10 != 0:
print(sumNum)
exit()
else:
ans = 0
for i in s:
if (sumNum - i) % 10 != 0:
ans = max(ans, sumNum - i)
print(ans)
| from itertools import combinations
n = int(eval(input()))
s = sorted([int(eval(input())) for _ in range(n)])
ans = sum(s)
if ans % 10 != 0:
print(ans)
elif all(i % 10 == 0 for i in s):
print((0))
else:
for i in range(1, n):
for j in combinations(s, i):
t = sum(j)
if (ans - t... | false | 7.142857 | [
"+from itertools import combinations",
"+",
"-sumNum = sum(s)",
"-if sumNum % 10 != 0:",
"- print(sumNum)",
"- exit()",
"+ans = sum(s)",
"+if ans % 10 != 0:",
"+ print(ans)",
"+elif all(i % 10 == 0 for i in s):",
"+ print((0))",
"- ans = 0",
"- for i in s:",
"- if ... | false | 0.086664 | 0.033885 | 2.557585 | [
"s095529433",
"s650173336"
] |
u416758623 | p03448 | python | s027541006 | s644705787 | 55 | 49 | 2,940 | 3,060 | Accepted | Accepted | 10.91 | A,B,C,X = [int(eval(input())) for x in range(4)]
cnt = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if X == 500*i + 100*j + 50*k:
cnt+=1
print(cnt) | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500 * i + 100 * j + 50 * k == x:
ans += 1
print(ans) | 8 | 12 | 208 | 246 | A, B, C, X = [int(eval(input())) for x in range(4)]
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if X == 500 * i + 100 * j + 50 * k:
cnt += 1
print(cnt)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
ans += 1
print(ans)
| false | 33.333333 | [
"-A, B, C, X = [int(eval(input())) for x in range(4)]",
"-cnt = 0",
"-for i in range(A + 1):",
"- for j in range(B + 1):",
"- for k in range(C + 1):",
"- if X == 500 * i + 100 * j + 50 * k:",
"- cnt += 1",
"-print(cnt)",
"+a = int(eval(input()))",
"+b = int(eval... | false | 0.126355 | 0.276228 | 0.457428 | [
"s027541006",
"s644705787"
] |
u323680411 | p03327 | python | s373544918 | s636368546 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
print((["ABC", "ABD"][N >= 10 ** 3])) | N = int(eval(input()))
if N <= 999:
print("ABC")
else:
print("ABD") | 3 | 6 | 55 | 75 | N = int(eval(input()))
print((["ABC", "ABD"][N >= 10**3]))
| N = int(eval(input()))
if N <= 999:
print("ABC")
else:
print("ABD")
| false | 50 | [
"-print(([\"ABC\", \"ABD\"][N >= 10**3]))",
"+if N <= 999:",
"+ print(\"ABC\")",
"+else:",
"+ print(\"ABD\")"
] | false | 0.03922 | 0.042222 | 0.928906 | [
"s373544918",
"s636368546"
] |
u852690916 | p02762 | python | s520591758 | s071015977 | 796 | 333 | 118,748 | 107,104 | Accepted | Accepted | 58.17 | import sys
def main():
input = sys.stdin.readline
N, M, K = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(M)]
CD = [tuple(map(int, input().split())) for _ in range(K)]
uf = UnionFindTree(N)
friend_or_block = [set() for _ in range(N)]
for a, b... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from typing import Iterable
import sys
def main(N, M, K, AB, CD):
friend_chain = UnionFindTree(N)
friend_count = [0] * N
block_count = [0] * N
for a, b in AB:
a, b = a - 1, b - 1
friend_chain.union(a, b)
friend_count[a] += ... | 42 | 51 | 1,229 | 1,646 | import sys
def main():
input = sys.stdin.readline
N, M, K = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(M)]
CD = [tuple(map(int, input().split())) for _ in range(K)]
uf = UnionFindTree(N)
friend_or_block = [set() for _ in range(N)]
for a, b in AB:
... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from typing import Iterable
import sys
def main(N, M, K, AB, CD):
friend_chain = UnionFindTree(N)
friend_count = [0] * N
block_count = [0] * N
for a, b in AB:
a, b = a - 1, b - 1
friend_chain.union(a, b)
friend_count[a] += 1
... | false | 17.647059 | [
"+# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)",
"+from typing import Iterable",
"-def main():",
"- input = sys.stdin.readline",
"- N, M, K = list(map(int, input().split()))",
"- AB = [tuple(map(int, input().split())) for _ in range(M)]",
"- CD = [tuple(map(int, input().split())) for _ in ... | false | 0.053562 | 0.090644 | 0.590901 | [
"s520591758",
"s071015977"
] |
u795405022 | p00009 | python | s914965684 | s180167819 | 1,670 | 1,430 | 44,464 | 20,832 | Accepted | Accepted | 14.37 | max = 1000000
candidates = [True for x in range(0, max + 1)]
candidates[0] = False
candidates[1] = False
for i in range(2, max / 2):
if not candidates[i]:
continue
j = i + i
while True:
if max < j:
break
candidates[j] = False
j += i
while True:
... | import math
max = 1000000
candidates = [True for x in range(0, max + 1)]
candidates[0] = False
candidates[1] = False
for i in range(2, int(math.sqrt(max))):
if not candidates[i]:
continue
j = i + i
while True:
if max < j:
break
candidates[j] = False
... | 22 | 24 | 453 | 482 | max = 1000000
candidates = [True for x in range(0, max + 1)]
candidates[0] = False
candidates[1] = False
for i in range(2, max / 2):
if not candidates[i]:
continue
j = i + i
while True:
if max < j:
break
candidates[j] = False
j += i
while True:
try:
n ... | import math
max = 1000000
candidates = [True for x in range(0, max + 1)]
candidates[0] = False
candidates[1] = False
for i in range(2, int(math.sqrt(max))):
if not candidates[i]:
continue
j = i + i
while True:
if max < j:
break
candidates[j] = False
j += i
while ... | false | 8.333333 | [
"+import math",
"+",
"-for i in range(2, max / 2):",
"+for i in range(2, int(math.sqrt(max))):"
] | false | 0.126579 | 1.238615 | 0.102194 | [
"s914965684",
"s180167819"
] |
u525065967 | p02572 | python | s332387411 | s962096115 | 133 | 110 | 25,052 | 24,924 | Accepted | Accepted | 17.29 | _ = eval(input())
MOD = 10**9 + 7
ans = b = 0
for a in map(int, input().split()):
ans += a * b
ans %= MOD
b += a
print(ans)
| _ = eval(input())
ans = b = 0
for a in map(int, input().split()):
ans += a * b
b += a
print((ans % (10**9 + 7)))
| 8 | 6 | 137 | 118 | _ = eval(input())
MOD = 10**9 + 7
ans = b = 0
for a in map(int, input().split()):
ans += a * b
ans %= MOD
b += a
print(ans)
| _ = eval(input())
ans = b = 0
for a in map(int, input().split()):
ans += a * b
b += a
print((ans % (10**9 + 7)))
| false | 25 | [
"-MOD = 10**9 + 7",
"- ans %= MOD",
"-print(ans)",
"+print((ans % (10**9 + 7)))"
] | false | 0.044237 | 0.074561 | 0.593304 | [
"s332387411",
"s962096115"
] |
u811733736 | p00449 | python | s587294420 | s558764556 | 4,210 | 2,800 | 9,016 | 8,668 | Accepted | Accepted | 33.49 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0526
TLE
"""
import sys
from sys import stdin
from heapq import heappush, heappop
from collections import namedtuple
input = stdin.readline
def warshall_floyd(d, V):
for k in range(V):
for i in range(V):
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0526
TLE
"""
import sys
from sys import stdin
from heapq import heappush, heappop
input = stdin.readline
def dijkstra(s, G):
pq = []
d = [float('inf')] * len(G)
d[s] = 0
heappush(pq, (0, s))
whil... | 102 | 63 | 3,040 | 1,956 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0526
TLE
"""
import sys
from sys import stdin
from heapq import heappush, heappop
from collections import namedtuple
input = stdin.readline
def warshall_floyd(d, V):
for k in range(V):
for i in range(V):
for ... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0526
TLE
"""
import sys
from sys import stdin
from heapq import heappush, heappop
input = stdin.readline
def dijkstra(s, G):
pq = []
d = [float("inf")] * len(G)
d[s] = 0
heappush(pq, (0, s))
while pq:
c, ... | false | 38.235294 | [
"-from collections import namedtuple",
"-",
"-",
"-def warshall_floyd(d, V):",
"- for k in range(V):",
"- for i in range(V):",
"- for j in range(V):",
"- new_cost = d[i][k] + d[k][j]",
"- if new_cost < d[i][j]:",
"- d[i][j] = ne... | false | 0.100964 | 0.046107 | 2.18976 | [
"s587294420",
"s558764556"
] |
u299856014 | p02813 | python | s262893737 | s657214201 | 156 | 31 | 3,064 | 8,052 | Accepted | Accepted | 80.13 | import itertools
n = int(eval(input()))
p = input().replace(' ', '')
q = input().replace(' ', '')
for i, num in enumerate(itertools.permutations(list(range(1,n+1)))):
num = ''.join(map(str, list(num)))
if num == p:
break
for j, num in enumerate(itertools.permutations(list(range(1,n+1)))):
... | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
N = list(itertools.permutations(list(range(1, n+1))))
def f(val):
for i, x in enumerate(N):
if x == val:
return i+1
print((abs(f(p) - f(q))))
| 15 | 14 | 389 | 283 | import itertools
n = int(eval(input()))
p = input().replace(" ", "")
q = input().replace(" ", "")
for i, num in enumerate(itertools.permutations(list(range(1, n + 1)))):
num = "".join(map(str, list(num)))
if num == p:
break
for j, num in enumerate(itertools.permutations(list(range(1, n + 1)))):
num... | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
N = list(itertools.permutations(list(range(1, n + 1))))
def f(val):
for i, x in enumerate(N):
if x == val:
return i + 1
print((abs(f(p) - f(q))))
| false | 6.666667 | [
"-p = input().replace(\" \", \"\")",
"-q = input().replace(\" \", \"\")",
"-for i, num in enumerate(itertools.permutations(list(range(1, n + 1)))):",
"- num = \"\".join(map(str, list(num)))",
"- if num == p:",
"- break",
"-for j, num in enumerate(itertools.permutations(list(range(1, n + 1))... | false | 0.161067 | 0.03735 | 4.31237 | [
"s262893737",
"s657214201"
] |
u221679506 | p00276 | python | s463856597 | s185596137 | 40 | 20 | 7,632 | 7,652 | Accepted | Accepted | 50 | for i in range(int(eval(input()))):
c,a,n = list(map(int,input().split()))
cnt = 0
while True:
if c<1 or a<1 or n<1:
break
c -= 1
a -= 1
n -= 1
cnt += 1
while True:
if c<2 or a<1:
break
c -= 2
a -= 1
cnt += 1
while True:
if c<3:
break
c -= 3
cnt += 1
print(cnt... | for i in range(int(eval(input()))):
c,a,n = list(map(int,input().split()))
cnt1 = min(c,a,n)
c -= cnt1
a -= cnt1
cnt2 = min(c//2,a)
c -= cnt2*2
cnt3 = c//3
print((cnt1+cnt2+cnt3)) | 22 | 9 | 309 | 181 | for i in range(int(eval(input()))):
c, a, n = list(map(int, input().split()))
cnt = 0
while True:
if c < 1 or a < 1 or n < 1:
break
c -= 1
a -= 1
n -= 1
cnt += 1
while True:
if c < 2 or a < 1:
break
c -= 2
a -= 1
... | for i in range(int(eval(input()))):
c, a, n = list(map(int, input().split()))
cnt1 = min(c, a, n)
c -= cnt1
a -= cnt1
cnt2 = min(c // 2, a)
c -= cnt2 * 2
cnt3 = c // 3
print((cnt1 + cnt2 + cnt3))
| false | 59.090909 | [
"- cnt = 0",
"- while True:",
"- if c < 1 or a < 1 or n < 1:",
"- break",
"- c -= 1",
"- a -= 1",
"- n -= 1",
"- cnt += 1",
"- while True:",
"- if c < 2 or a < 1:",
"- break",
"- c -= 2",
"- a -= 1",
"- ... | false | 0.046147 | 0.047006 | 0.981726 | [
"s463856597",
"s185596137"
] |
u753803401 | p02936 | python | s156672881 | s981170803 | 1,677 | 1,066 | 128,488 | 123,864 | Accepted | Accepted | 36.43 | def slove():
import sys
import collections
input = sys.stdin.readline
n, q = list(map(int, input().rstrip('\n').split()))
d = collections.defaultdict(list)
for i in range(n-1):
a, b = list(map(int, input().rstrip('\n').split()))
d[a] += [b]
d[b] += [a]
sco... | import sys
import collections
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, q = list(map(int, input().rstrip('\n').split()))
d = collections.defaultdict(list)
for i in range(n-1):
a, b = list(map(int, input().rstrip('\n').split()))
d[a-1] += [b-1]
... | 35 | 35 | 928 | 884 | def slove():
import sys
import collections
input = sys.stdin.readline
n, q = list(map(int, input().rstrip("\n").split()))
d = collections.defaultdict(list)
for i in range(n - 1):
a, b = list(map(int, input().rstrip("\n").split()))
d[a] += [b]
d[b] += [a]
score = coll... | import sys
import collections
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, q = list(map(int, input().rstrip("\n").split()))
d = collections.defaultdict(list)
for i in range(n - 1):
a, b = list(map(int, input().rstrip("\n").split()))
d[a - 1] += [b - 1]
d[b - 1... | false | 0 | [
"-def slove():",
"- import sys",
"- import collections",
"+import sys",
"+import collections",
"+",
"+def solve():",
"+ mod = 10**9 + 7",
"- d[a] += [b]",
"- d[b] += [a]",
"- score = collections.defaultdict(int)",
"+ d[a - 1] += [b - 1]",
"+ d[b - 1] +... | false | 0.044542 | 0.007532 | 5.914105 | [
"s156672881",
"s981170803"
] |
u150984829 | p00445 | python | s165846191 | s240848874 | 30 | 20 | 5,604 | 6,096 | Accepted | Accepted | 33.33 | import sys
for e in sys.stdin:
s=sum((e[i:i+3]=='JOI')+1j*(e[i:i+3]=='IOI')for i in range(len(e)-3))
print((int(s.real)))
print((int(s.imag)))
| import sys
for e in sys.stdin:
s=[e[i:i+3]for i in range(len(e)-3)]
for w in['JOI','IOI']:print((s.count(w)))
| 5 | 4 | 146 | 113 | import sys
for e in sys.stdin:
s = sum(
(e[i : i + 3] == "JOI") + 1j * (e[i : i + 3] == "IOI")
for i in range(len(e) - 3)
)
print((int(s.real)))
print((int(s.imag)))
| import sys
for e in sys.stdin:
s = [e[i : i + 3] for i in range(len(e) - 3)]
for w in ["JOI", "IOI"]:
print((s.count(w)))
| false | 20 | [
"- s = sum(",
"- (e[i : i + 3] == \"JOI\") + 1j * (e[i : i + 3] == \"IOI\")",
"- for i in range(len(e) - 3)",
"- )",
"- print((int(s.real)))",
"- print((int(s.imag)))",
"+ s = [e[i : i + 3] for i in range(len(e) - 3)]",
"+ for w in [\"JOI\", \"IOI\"]:",
"+ prin... | false | 0.04803 | 0.047686 | 1.007217 | [
"s165846191",
"s240848874"
] |
u644907318 | p03304 | python | s499090660 | s252796787 | 169 | 77 | 38,256 | 61,868 | Accepted | Accepted | 54.44 | n,m,d = list(map(int,input().split()))
if d==0:
print(((m-1)/n))
else:
print((2*(n-d)*(m-1)/n**2)) | n,m,d = list(map(int,input().split()))
if d==0:
print(((1*n-2*d)*(m-1)/n**2))
elif n>=2*d:
print(((2*n-2*d)*(m-1)/n**2))
else:
print((2*d*(m-1)/n**2)) | 5 | 7 | 100 | 156 | n, m, d = list(map(int, input().split()))
if d == 0:
print(((m - 1) / n))
else:
print((2 * (n - d) * (m - 1) / n**2))
| n, m, d = list(map(int, input().split()))
if d == 0:
print(((1 * n - 2 * d) * (m - 1) / n**2))
elif n >= 2 * d:
print(((2 * n - 2 * d) * (m - 1) / n**2))
else:
print((2 * d * (m - 1) / n**2))
| false | 28.571429 | [
"- print(((m - 1) / n))",
"+ print(((1 * n - 2 * d) * (m - 1) / n**2))",
"+elif n >= 2 * d:",
"+ print(((2 * n - 2 * d) * (m - 1) / n**2))",
"- print((2 * (n - d) * (m - 1) / n**2))",
"+ print((2 * d * (m - 1) / n**2))"
] | false | 0.085899 | 0.045743 | 1.87787 | [
"s499090660",
"s252796787"
] |
u595905528 | p02762 | python | s879315587 | s143782782 | 1,793 | 1,598 | 55,104 | 62,528 | Accepted | Accepted | 10.88 | import sys
sys.setrecursionlimit(10**5+10)
N, M, K = list(map(int,input().split()))
class UnionFind:
def __init__(self, N):
self.par = [-1 for i in range(N+1)]
self.rank = [1]*(N+1)
def find(self, x):
if self.par[x] < 0:
return x
else:
sel... | def main():
import sys
sys.setrecursionlimit(10**5+10)
N, M, K = list(map(int,input().split()))
class UnionFind:
def __init__(self, N):
self.par = [-1 for i in range(N+1)]
self.rank = [1]*(N+1)
def find(self, x):
if self.par[x] < 0:
return x
... | 53 | 57 | 1,451 | 1,575 | import sys
sys.setrecursionlimit(10**5 + 10)
N, M, K = list(map(int, input().split()))
class UnionFind:
def __init__(self, N):
self.par = [-1 for i in range(N + 1)]
self.rank = [1] * (N + 1)
def find(self, x):
if self.par[x] < 0:
return x
else:
self.pa... | def main():
import sys
sys.setrecursionlimit(10**5 + 10)
N, M, K = list(map(int, input().split()))
class UnionFind:
def __init__(self, N):
self.par = [-1 for i in range(N + 1)]
self.rank = [1] * (N + 1)
def find(self, x):
if self.par[x] < 0:
... | false | 7.017544 | [
"-import sys",
"+def main():",
"+ import sys",
"-sys.setrecursionlimit(10**5 + 10)",
"-N, M, K = list(map(int, input().split()))",
"+ sys.setrecursionlimit(10**5 + 10)",
"+ N, M, K = list(map(int, input().split()))",
"+",
"+ class UnionFind:",
"+ def __init__(self, N):",
"+ ... | false | 0.039176 | 0.047651 | 0.822138 | [
"s879315587",
"s143782782"
] |
u254871849 | p03608 | python | s391354311 | s282336208 | 367 | 337 | 26,820 | 27,720 | Accepted | Accepted | 8.17 | import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, m, R = I[:3]
r = I[3:3+R] - 1
a, b, c = I[3+R:].reshape(-1, 3).T
a -= 1; b -= 1
graph = csr_matrix((... | import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, m, R = I[:3]
r = I[3:3+R] - 1
a, b, c = I[3+R:].reshape(-1, 3).T
graph = csr_matrix((c, (a-1, b-1)), ... | 24 | 23 | 652 | 631 | import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, m, R = I[:3]
r = I[3 : 3 + R] - 1
a, b, c = I[3 + R :].reshape(-1, 3).T
a -= 1
b -= 1
graph = csr_matrix((c, (a,... | import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, m, R = I[:3]
r = I[3 : 3 + R] - 1
a, b, c = I[3 + R :].reshape(-1, 3).T
graph = csr_matrix((c, (a - 1, b - 1)), ... | false | 4.166667 | [
"-a -= 1",
"-b -= 1",
"-graph = csr_matrix((c, (a, b)), shape=(n, n))",
"+graph = csr_matrix((c, (a - 1, b - 1)), shape=(n, n))",
"- (*perms,) = permutations(r)",
"- perms = np.array(perms)",
"+ perms = np.array(list(permutations(r)))"
] | false | 0.27651 | 0.385003 | 0.718203 | [
"s391354311",
"s282336208"
] |
u094191970 | p03608 | python | s220785932 | s342108288 | 713 | 596 | 23,420 | 15,376 | Accepted | Accepted | 16.41 | import itertools
from scipy.sparse.csgraph import floyd_warshall
n,m,r=list(map(int,input().split()))
r_l=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
d=[[float('inf')]*n for i in range(n)]
for i in range(n):
d[i][i]=0
for i in l:
d[i[0]-1][i[1]-1]=i[2]
d... | from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
n,m,r=nii()
r=list(nii())
s=[[float('inf')]*n for i in range(n)]
for i in range(n):
for j in range(n):
s[i][j]=0
for i in range(m):
a,b,c=nii... | 22 | 28 | 529 | 534 | import itertools
from scipy.sparse.csgraph import floyd_warshall
n, m, r = list(map(int, input().split()))
r_l = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
d = [[float("inf")] * n for i in range(n)]
for i in range(n):
d[i][i] = 0
for i in l:
d[i[0] - 1][i[1] - 1] = ... | from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
n, m, r = nii()
r = list(nii())
s = [[float("inf")] * n for i in range(n)]
for i in range(n):
for j in range(n):
s[i][j] = 0
for i in range(m):
... | false | 21.428571 | [
"-import itertools",
"+from itertools import permutations",
"+from sys import stdin",
"-n, m, r = list(map(int, input().split()))",
"-r_l = list(map(int, input().split()))",
"-l = [list(map(int, input().split())) for i in range(m)]",
"-d = [[float(\"inf\")] * n for i in range(n)]",
"+nii = lambda: lis... | false | 0.264673 | 0.315044 | 0.840115 | [
"s220785932",
"s342108288"
] |
u260216890 | p03061 | python | s179673879 | s556184124 | 1,952 | 394 | 14,672 | 98,280 | Accepted | Accepted | 79.82 | n=int(eval(input()))
A=list(map(int,input().split()))
#####単位元######
ide_ele = 0
#num:n以上の最小の2のべき乗
num=2**(n-1).bit_length()
seg=[ide_ele]*2*num
from fractions import gcd
def segfunc(x,y):
return gcd(x,y)
def init(init_val):
#set_val
for i in range(n):
seg[i+num-1]=init_val[i... | n=int(eval(input()))
a=list(map(int,input().split()))
from fractions import gcd
L=[0]
R=[]
l=a[0]
r=a[-1]
for i in range(n-1):
l=gcd(a[i], l)
L.append(l)
r=gcd(a[-i-1], r)
R.append(r)
R=R[::-1]
R.append(0)
M=[]
#print(L,R)
for i in range(n):
m=gcd(L[i],R[i])
M.append(m)
print(... | 55 | 20 | 1,093 | 321 | n = int(eval(input()))
A = list(map(int, input().split()))
#####単位元######
ide_ele = 0
# num:n以上の最小の2のべき乗
num = 2 ** (n - 1).bit_length()
seg = [ide_ele] * 2 * num
from fractions import gcd
def segfunc(x, y):
return gcd(x, y)
def init(init_val):
# set_val
for i in range(n):
seg[i + num - 1] = ini... | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
L = [0]
R = []
l = a[0]
r = a[-1]
for i in range(n - 1):
l = gcd(a[i], l)
L.append(l)
r = gcd(a[-i - 1], r)
R.append(r)
R = R[::-1]
R.append(0)
M = []
# print(L,R)
for i in range(n):
m = gcd(L[i], R[i])
M.appen... | false | 63.636364 | [
"-A = list(map(int, input().split()))",
"-#####単位元######",
"-ide_ele = 0",
"-# num:n以上の最小の2のべき乗",
"-num = 2 ** (n - 1).bit_length()",
"-seg = [ide_ele] * 2 * num",
"+a = list(map(int, input().split()))",
"-",
"-def segfunc(x, y):",
"- return gcd(x, y)",
"-",
"-",
"-def init(init_val):",
... | false | 0.052213 | 0.052755 | 0.989724 | [
"s179673879",
"s556184124"
] |
u116002573 | p02952 | python | s625736210 | s041993592 | 61 | 51 | 2,940 | 2,940 | Accepted | Accepted | 16.39 | N = int(eval(input()))
count = 0
for i in range(1, N+1):
s = str(i)
if len(s) % 2 == 1:
count += 1
print(count) | def main():
N = int(eval(input()))
ans = 0
for i in range(1, N+1):
s = str(i)
if(len(s) % 2 == 1): ans +=1
return ans
if __name__ == '__main__':
print((main())) | 8 | 12 | 129 | 202 | N = int(eval(input()))
count = 0
for i in range(1, N + 1):
s = str(i)
if len(s) % 2 == 1:
count += 1
print(count)
| def main():
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
s = str(i)
if len(s) % 2 == 1:
ans += 1
return ans
if __name__ == "__main__":
print((main()))
| false | 33.333333 | [
"-N = int(eval(input()))",
"-count = 0",
"-for i in range(1, N + 1):",
"- s = str(i)",
"- if len(s) % 2 == 1:",
"- count += 1",
"-print(count)",
"+def main():",
"+ N = int(eval(input()))",
"+ ans = 0",
"+ for i in range(1, N + 1):",
"+ s = str(i)",
"+ if l... | false | 0.053884 | 0.173166 | 0.311172 | [
"s625736210",
"s041993592"
] |
u990900604 | p02264 | python | s361164309 | s124770049 | 750 | 430 | 25,152 | 28,292 | Accepted | Accepted | 42.67 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
class Queue:
def __init__(self):
self.l = []
def enqueue(self, x):
self.l.append(x)
def dequeue(self):
x = self.l[0]
del self.l[0]
return x
def is_empty(self):
return len(self.l) == 0
... |
class Queue:
def __init__(self, n):
self.A = [0 for i in range(n)]
self.head = 0
self.tail = 0
self.len = n
def is_empty(self):
return self.head == self.tail
def is_full(self):
return (self.tail + 1) % self.len == self.head
def enqueue(se... | 44 | 56 | 882 | 1,275 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Queue:
def __init__(self):
self.l = []
def enqueue(self, x):
self.l.append(x)
def dequeue(self):
x = self.l[0]
del self.l[0]
return x
def is_empty(self):
return len(self.l) == 0
class Process:
de... | class Queue:
def __init__(self, n):
self.A = [0 for i in range(n)]
self.head = 0
self.tail = 0
self.len = n
def is_empty(self):
return self.head == self.tail
def is_full(self):
return (self.tail + 1) % self.len == self.head
def enqueue(self, x):
... | false | 21.428571 | [
"-#!/usr/bin/env python",
"-# -*- coding: utf-8 -*-",
"- def __init__(self):",
"- self.l = []",
"+ def __init__(self, n):",
"+ self.A = [0 for i in range(n)]",
"+ self.head = 0",
"+ self.tail = 0",
"+ self.len = n",
"+",
"+ def is_empty(self):",
"+ ... | false | 0.093164 | 0.077838 | 1.196902 | [
"s361164309",
"s124770049"
] |
u413165887 | p02852 | python | s834805896 | s881326438 | 240 | 141 | 51,676 | 10,560 | Accepted | Accepted | 41.25 | n, m = list(map(int, input().split()))
s = eval(input())
dp = [-1 for _i in range(n+1)]
dp[0] = 0
f = 0
from collections import deque
q = deque([0])
c = 0
for i in range(1, n+1):
if s[i]=="0":
c = 0
while i-f > m:
f = q.popleft()
dp[i] = f
q.append(i)
e... | n, m = list(map(int, input().split()))
s = eval(input())
dp = [-1 for _i in range(n+1)]
dp[0] = 0
f = 0
from collections import deque
q = deque([0])
c = 0
for i in range(1, n+1):
if s[i]=="0":
c = 0
while i-f > m:
f = q.popleft()
dp[i] = f
q.append(i)
e... | 30 | 30 | 532 | 527 | n, m = list(map(int, input().split()))
s = eval(input())
dp = [-1 for _i in range(n + 1)]
dp[0] = 0
f = 0
from collections import deque
q = deque([0])
c = 0
for i in range(1, n + 1):
if s[i] == "0":
c = 0
while i - f > m:
f = q.popleft()
dp[i] = f
q.append(i)
else:
... | n, m = list(map(int, input().split()))
s = eval(input())
dp = [-1 for _i in range(n + 1)]
dp[0] = 0
f = 0
from collections import deque
q = deque([0])
c = 0
for i in range(1, n + 1):
if s[i] == "0":
c = 0
while i - f > m:
f = q.popleft()
dp[i] = f
q.append(i)
elif c ... | false | 0 | [
"+ elif c < m - 1:",
"+ c += 1",
"- c += 1",
"- if c >= m:",
"- break",
"+ break"
] | false | 0.0436 | 0.121393 | 0.359167 | [
"s834805896",
"s881326438"
] |
u254871849 | p03488 | python | s558434588 | s998471373 | 1,197 | 656 | 3,444 | 3,188 | Accepted | Accepted | 45.2 | import sys
s = sys.stdin.readline().rstrip()
x, y = list(map(int, sys.stdin.readline().split()))
def reachable(deltas, goal):
if not deltas:
if goal == 0:
return True
else:
return False
s = sum(deltas)
if goal < -s or s < goal:
return Fals... | import sys
s = sys.stdin.readline().rstrip()
x, y = list(map(int, sys.stdin.readline().split()))
def reachable(deltas, goal):
if not deltas:
if goal == 0:
return True
else:
return False
s = sum(deltas)
if goal < -s or s < goal:
return Fa... | 62 | 63 | 1,307 | 1,305 | import sys
s = sys.stdin.readline().rstrip()
x, y = list(map(int, sys.stdin.readline().split()))
def reachable(deltas, goal):
if not deltas:
if goal == 0:
return True
else:
return False
s = sum(deltas)
if goal < -s or s < goal:
return False
res = [False... | import sys
s = sys.stdin.readline().rstrip()
x, y = list(map(int, sys.stdin.readline().split()))
def reachable(deltas, goal):
if not deltas:
if goal == 0:
return True
else:
return False
s = sum(deltas)
if goal < -s or s < goal:
return False
if (s - goal... | false | 1.587302 | [
"- res = [False] * (s * 2 + 1)",
"- res[s] = True",
"+ if (s - goal) & 1:",
"+ return False",
"+ a = (s - goal) // 2",
"+ res = [False] * (a + 1)",
"+ res[0] = True",
"- prev = res.copy()",
"- res = [False] * (s * 2 + 1)",
"- for i in range(s * 2 + 1):... | false | 0.039172 | 0.046853 | 0.836063 | [
"s558434588",
"s998471373"
] |
u620084012 | p03986 | python | s245399741 | s542048062 | 186 | 70 | 46,944 | 67,016 | Accepted | Accepted | 62.37 | from collections import deque
X = eval(input())
L = deque([])
for e in X:
if e == "T" and len(L) > 0 and L[-1] == "S":
L.pop()
else:
L.append(e)
print((len(L)))
| X = eval(input())
N = len(X)
c = 0
s, t = 0, 0
for k in range(N):
if X[k] == "S":
s += 1
else:
t += 1
if s > 0 and t > 0:
s -= 1
t -= 1
c += 2
print((N-c))
| 10 | 14 | 187 | 229 | from collections import deque
X = eval(input())
L = deque([])
for e in X:
if e == "T" and len(L) > 0 and L[-1] == "S":
L.pop()
else:
L.append(e)
print((len(L)))
| X = eval(input())
N = len(X)
c = 0
s, t = 0, 0
for k in range(N):
if X[k] == "S":
s += 1
else:
t += 1
if s > 0 and t > 0:
s -= 1
t -= 1
c += 2
print((N - c))
| false | 28.571429 | [
"-from collections import deque",
"-",
"-L = deque([])",
"-for e in X:",
"- if e == \"T\" and len(L) > 0 and L[-1] == \"S\":",
"- L.pop()",
"+N = len(X)",
"+c = 0",
"+s, t = 0, 0",
"+for k in range(N):",
"+ if X[k] == \"S\":",
"+ s += 1",
"- L.append(e)",
"-print... | false | 0.046199 | 0.045633 | 1.012391 | [
"s245399741",
"s542048062"
] |
u840579553 | p02720 | python | s895825291 | s544279875 | 509 | 187 | 100,316 | 40,688 | Accepted | Accepted | 63.26 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools impo... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools impo... | 127 | 127 | 2,421 | 2,508 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations... | false | 0 | [
"-from collections import defaultdict",
"+from collections import deque",
"- def dfs(x):",
"- lunlun.append(x)",
"+ K = int(eval(input()))",
"+ q = deque()",
"+ for i in range(1, 10):",
"+ q.append(i)",
"+ cnt = 9",
"+ if cnt >= K:",
"+ print((q[K - 1]))",
... | false | 1.078314 | 0.052762 | 20.437318 | [
"s895825291",
"s544279875"
] |
u047393579 | p03435 | python | s602434350 | s020104416 | 636 | 227 | 3,064 | 3,064 | Accepted | Accepted | 64.31 | lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
lis1.append(int(num))
for num in input().split():
lis2.append(int(num))
for num in input().split():
lis3.append(int(num))
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
count = 0
... | lis1 = []
lis2 = []
lis3 = []
count = 0
flag = 0
for num in input().split():
lis1.append(int(num))
for num in input().split():
lis2.append(int(num))
for num in input().split():
lis3.append(int(num))
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if li... | 29 | 26 | 794 | 701 | lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
lis1.append(int(num))
for num in input().split():
lis2.append(int(num))
for num in input().split():
lis3.append(int(num))
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
count = 0
if lis... | lis1 = []
lis2 = []
lis3 = []
count = 0
flag = 0
for num in input().split():
lis1.append(int(num))
for num in input().split():
lis2.append(int(num))
for num in input().split():
lis3.append(int(num))
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if lis1[0] - a1 == ... | false | 10.344828 | [
"+flag = 0",
"- count = 0",
"- count += 1",
"- if lis1[1] - a1 == lis2[1] - a2 == lis3[1] - a3:",
"- count += 1",
"- if lis1[2] - a1 == lis2[2] - a2 == lis3[2] - a3:",
"- count += 1",
"- if count == 3:",
"- ... | false | 0.607794 | 0.713528 | 0.851815 | [
"s602434350",
"s020104416"
] |
u014333473 | p03474 | python | s735810517 | s185416449 | 38 | 34 | 9,900 | 9,864 | Accepted | Accepted | 10.53 | import re
n,m=input().split();print(('YNeos'[re.match(r'[0-9]{'+n+'}-[0-9]{'+m+'}',eval(input())) is None::2])) | import re
n,m=input().split();print(('YNeos'[not re.match(r'[0-9]{'+n+'}-[0-9]{'+m+'}',eval(input()))::2])) | 2 | 2 | 104 | 100 | import re
n, m = input().split()
print(
(
"YNeos"[
re.match(r"[0-9]{" + n + "}-[0-9]{" + m + "}", eval(input())) is None :: 2
]
)
)
| import re
n, m = input().split()
print(("YNeos"[not re.match(r"[0-9]{" + n + "}-[0-9]{" + m + "}", eval(input())) :: 2]))
| false | 0 | [
"-print(",
"- (",
"- \"YNeos\"[",
"- re.match(r\"[0-9]{\" + n + \"}-[0-9]{\" + m + \"}\", eval(input())) is None :: 2",
"- ]",
"- )",
"-)",
"+print((\"YNeos\"[not re.match(r\"[0-9]{\" + n + \"}-[0-9]{\" + m + \"}\", eval(input())) :: 2]))"
] | false | 0.082229 | 0.083198 | 0.988351 | [
"s735810517",
"s185416449"
] |
u280552586 | p03475 | python | s996917228 | s353355890 | 110 | 91 | 3,188 | 3,188 | Accepted | Accepted | 17.27 | n = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(n-1)]
for i in range(n-1):
t = 0
for j in range(i, n-1):
if t <= CSF[j][1]:
t = CSF[j][1]
elif t % CSF[j][2] == 0:
pass
else:
t += CSF[j][2] - t % CSF[j][2]
... | n = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(n-1)]
for i in range(n-1):
t = 0
for j in range(i, n-1):
c, s, f = CSF[j]
if t <= s:
t = s
elif t % f == 0:
pass
else:
t += f - t % f
t += c
... | 16 | 17 | 359 | 337 | n = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(n - 1)]
for i in range(n - 1):
t = 0
for j in range(i, n - 1):
if t <= CSF[j][1]:
t = CSF[j][1]
elif t % CSF[j][2] == 0:
pass
else:
t += CSF[j][2] - t % CSF[j][2]
t +... | n = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(n - 1)]
for i in range(n - 1):
t = 0
for j in range(i, n - 1):
c, s, f = CSF[j]
if t <= s:
t = s
elif t % f == 0:
pass
else:
t += f - t % f
t += c
print(t... | false | 5.882353 | [
"- if t <= CSF[j][1]:",
"- t = CSF[j][1]",
"- elif t % CSF[j][2] == 0:",
"+ c, s, f = CSF[j]",
"+ if t <= s:",
"+ t = s",
"+ elif t % f == 0:",
"- t += CSF[j][2] - t % CSF[j][2]",
"- t += CSF[j][0]",
"+ t += f - ... | false | 0.07102 | 0.043549 | 1.630793 | [
"s996917228",
"s353355890"
] |
u969848070 | p02773 | python | s535800219 | s887150249 | 770 | 517 | 35,220 | 35,952 | Accepted | Accepted | 32.86 | N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
T = {}
for i in range(N):
if S[i] in T:
T[S[i]] += 1
else:
T.setdefault(S[i],1)
A = max(T.values())
keys = [k for k, v in list(T.items()) if v == A]
U =sorted(keys)
for i in range(len(U)):
print((U[i])) | from collections import Counter
n = int(eval(input()))
a = [eval(input()) for x in range(n)]
b = Counter(a)
c = max(b.values())
s = [s for s, g in list(b.items()) if g == c]
s.sort()
print(('\n'.join(s))) | 17 | 9 | 291 | 193 | N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
T = {}
for i in range(N):
if S[i] in T:
T[S[i]] += 1
else:
T.setdefault(S[i], 1)
A = max(T.values())
keys = [k for k, v in list(T.items()) if v == A]
U = sorted(keys)
for i in range(len(U)):
print((U[i]))
| from collections import Counter
n = int(eval(input()))
a = [eval(input()) for x in range(n)]
b = Counter(a)
c = max(b.values())
s = [s for s, g in list(b.items()) if g == c]
s.sort()
print(("\n".join(s)))
| false | 47.058824 | [
"-N = int(eval(input()))",
"-S = []",
"-for i in range(N):",
"- S.append(eval(input()))",
"-T = {}",
"-for i in range(N):",
"- if S[i] in T:",
"- T[S[i]] += 1",
"- else:",
"- T.setdefault(S[i], 1)",
"-A = max(T.values())",
"-keys = [k for k, v in list(T.items()) if v == ... | false | 0.094287 | 0.040079 | 2.352546 | [
"s535800219",
"s887150249"
] |
u380524497 | p03624 | python | s895682061 | s490982562 | 39 | 19 | 3,188 | 3,188 | Accepted | Accepted | 51.28 | text = eval(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for s in text:
alphabet = alphabet.replace(s, '')
if alphabet is '':
print('None')
else:
print((alphabet[0])) | alpha = [chr(ord('a') + i) for i in range(26)]
S = set(eval(input()))
if len(set(alpha)) == len(S):
print('None')
else:
for s in alpha:
if s not in S:
print(s)
exit() | 10 | 11 | 185 | 212 | text = eval(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"
for s in text:
alphabet = alphabet.replace(s, "")
if alphabet is "":
print("None")
else:
print((alphabet[0]))
| alpha = [chr(ord("a") + i) for i in range(26)]
S = set(eval(input()))
if len(set(alpha)) == len(S):
print("None")
else:
for s in alpha:
if s not in S:
print(s)
exit()
| false | 9.090909 | [
"-text = eval(input())",
"-alphabet = \"abcdefghijklmnopqrstuvwxyz\"",
"-for s in text:",
"- alphabet = alphabet.replace(s, \"\")",
"-if alphabet is \"\":",
"+alpha = [chr(ord(\"a\") + i) for i in range(26)]",
"+S = set(eval(input()))",
"+if len(set(alpha)) == len(S):",
"- print((alphabet[0]))... | false | 0.049534 | 0.036886 | 1.342883 | [
"s895682061",
"s490982562"
] |
u519939795 | p02836 | python | s173334372 | s267080126 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s=eval(input())
ans=0
for i in range(len(s)//2):
if s[i]!=s[-i-1]:
ans+=1
print(ans) | s = eval(input())
ans = 0
for f, b in zip(s, s[::-1]):
if f!=b:
ans+=1
print((ans//2)) | 6 | 6 | 95 | 95 | s = eval(input())
ans = 0
for i in range(len(s) // 2):
if s[i] != s[-i - 1]:
ans += 1
print(ans)
| s = eval(input())
ans = 0
for f, b in zip(s, s[::-1]):
if f != b:
ans += 1
print((ans // 2))
| false | 0 | [
"-for i in range(len(s) // 2):",
"- if s[i] != s[-i - 1]:",
"+for f, b in zip(s, s[::-1]):",
"+ if f != b:",
"-print(ans)",
"+print((ans // 2))"
] | false | 0.06333 | 0.063423 | 0.998519 | [
"s173334372",
"s267080126"
] |
u678167152 | p02845 | python | s201920991 | s943474950 | 233 | 106 | 52,952 | 99,260 | Accepted | Accepted | 54.51 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
color = [0]*3
ans = 1
for i in range(N):
if A[i] not in color:
ans = 0
break
ind = color.index(A[i])
ans *= len([c for c in color if c == A[i]])
ans %= mod
color[ind] += 1
#ans = rec(color,0)
print(ans) | from collections import defaultdict
def solve():
d = defaultdict(lambda: 0)
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
d[0] = 3
ans = 1
for i in range(N):
if d[A[i]]==0:
return 0
ans *= d[A[i]]
ans %= mod
d[A[i]] -= 1
d[A[i]+1] += 1
... | 16 | 17 | 303 | 340 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
color = [0] * 3
ans = 1
for i in range(N):
if A[i] not in color:
ans = 0
break
ind = color.index(A[i])
ans *= len([c for c in color if c == A[i]])
ans %= mod
color[ind] += 1
# ans = rec(color,0)
print(ans)
| from collections import defaultdict
def solve():
d = defaultdict(lambda: 0)
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
d[0] = 3
ans = 1
for i in range(N):
if d[A[i]] == 0:
return 0
ans *= d[A[i]]
ans %= mod
d[A[i]]... | false | 5.882353 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"-color = [0] * 3",
"-ans = 1",
"-for i in range(N):",
"- if A[i] not in color:",
"- ans = 0",
"- break",
"- ind = color.index(A[i])",
"- ans *= len([c for c in color if c == A[i]])",
... | false | 0.042816 | 0.084623 | 0.505959 | [
"s201920991",
"s943474950"
] |
u187205913 | p03560 | python | s255252617 | s545456118 | 1,451 | 172 | 20,736 | 19,724 | Accepted | Accepted | 88.15 | k = int(eval(input()))
from collections import deque
dic = {1:1}
queue = deque([[1,1]])
while queue:
v,cost = queue.popleft()
v_ = (v+1)%k
if not v_ in dic or cost+1<dic[v_]:
dic[v_] = cost+1
queue.appendleft([v_,cost+1])
v_ = v*10%k
if not v_ in dic or cost<dic[v_]:
... | from collections import deque
K = int(eval(input()))
d={1:1}
q = deque()
q.append([1,1])
while q:
a,c = q.popleft()
a_ = (a*10)%K
if(a_ not in d or c < d[a_]):
d[a_]=c
q.appendleft([a_,c])
b_ = (a+1)%K
if(b_ not in d or c < d[b_]):
d[b_] = c+1
q.append... | 16 | 19 | 382 | 346 | k = int(eval(input()))
from collections import deque
dic = {1: 1}
queue = deque([[1, 1]])
while queue:
v, cost = queue.popleft()
v_ = (v + 1) % k
if not v_ in dic or cost + 1 < dic[v_]:
dic[v_] = cost + 1
queue.appendleft([v_, cost + 1])
v_ = v * 10 % k
if not v_ in dic or cost < di... | from collections import deque
K = int(eval(input()))
d = {1: 1}
q = deque()
q.append([1, 1])
while q:
a, c = q.popleft()
a_ = (a * 10) % K
if a_ not in d or c < d[a_]:
d[a_] = c
q.appendleft([a_, c])
b_ = (a + 1) % K
if b_ not in d or c < d[b_]:
d[b_] = c + 1
q.appen... | false | 15.789474 | [
"-k = int(eval(input()))",
"-dic = {1: 1}",
"-queue = deque([[1, 1]])",
"-while queue:",
"- v, cost = queue.popleft()",
"- v_ = (v + 1) % k",
"- if not v_ in dic or cost + 1 < dic[v_]:",
"- dic[v_] = cost + 1",
"- queue.appendleft([v_, cost + 1])",
"- v_ = v * 10 % k",
... | false | 0.112064 | 0.041755 | 2.683825 | [
"s255252617",
"s545456118"
] |
u754022296 | p04006 | python | s324209185 | s108558398 | 1,695 | 184 | 3,188 | 12,508 | Accepted | Accepted | 89.14 | n, x = list(map(int, input().split()))
A = list(map(int, input().split()))[::-1]*2
B = A[:n]
ans = float("inf")
for k in range(n):
t = x*k + sum(B)
ans = min(ans, t)
for j in range(n):
B[j] = min(B[j], A[j+k+1])
print(ans) | import numpy as np
n, x = list(map(int, input().split()))
A = np.array(input().split()[::-1]*2, dtype=np.int64)
B = A.copy()[:n]
ans = float("inf")
for k in range(n):
t = x*k + B.sum()
ans = min(ans, t)
np.minimum(B, A[k+1:k+n+1], out=B)
print(ans) | 10 | 10 | 235 | 257 | n, x = list(map(int, input().split()))
A = list(map(int, input().split()))[::-1] * 2
B = A[:n]
ans = float("inf")
for k in range(n):
t = x * k + sum(B)
ans = min(ans, t)
for j in range(n):
B[j] = min(B[j], A[j + k + 1])
print(ans)
| import numpy as np
n, x = list(map(int, input().split()))
A = np.array(input().split()[::-1] * 2, dtype=np.int64)
B = A.copy()[:n]
ans = float("inf")
for k in range(n):
t = x * k + B.sum()
ans = min(ans, t)
np.minimum(B, A[k + 1 : k + n + 1], out=B)
print(ans)
| false | 0 | [
"+import numpy as np",
"+",
"-A = list(map(int, input().split()))[::-1] * 2",
"-B = A[:n]",
"+A = np.array(input().split()[::-1] * 2, dtype=np.int64)",
"+B = A.copy()[:n]",
"- t = x * k + sum(B)",
"+ t = x * k + B.sum()",
"- for j in range(n):",
"- B[j] = min(B[j], A[j + k + 1])",
... | false | 0.048019 | 0.216496 | 0.221799 | [
"s324209185",
"s108558398"
] |
u496821919 | p02628 | python | s960466930 | s518882761 | 40 | 31 | 9,236 | 9,160 | Accepted | Accepted | 22.5 | n,k = list(map(int,input().split()))
P = list(map(int,input().split()))
ans = 0
for i in range(k):
m = min(P)
ans += m
P.remove(m)
print(ans) | import heapq
n,k = list(map(int,input().split()))
P = list(map(int,input().split()))
ans = 0
heapq.heapify(P)
for i in range(k):
ans += heapq.heappop(P)
print(ans) | 8 | 8 | 154 | 168 | n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
ans = 0
for i in range(k):
m = min(P)
ans += m
P.remove(m)
print(ans)
| import heapq
n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
ans = 0
heapq.heapify(P)
for i in range(k):
ans += heapq.heappop(P)
print(ans)
| false | 0 | [
"+import heapq",
"+",
"+heapq.heapify(P)",
"- m = min(P)",
"- ans += m",
"- P.remove(m)",
"+ ans += heapq.heappop(P)"
] | false | 0.03912 | 0.038872 | 1.006385 | [
"s960466930",
"s518882761"
] |
u133936772 | p03043 | python | s000120130 | s871636505 | 77 | 62 | 9,072 | 9,024 | Accepted | Accepted | 19.48 | n,k=list(map(int,input().split()))
p=0
for i in range(1,n+1): p+=[1,4/2**len(bin(~-k//i))][i<k]
print((p/n)) | n,k=list(map(int,input().split()))
print((sum([1,4/2**len(bin(~-k//i))][i<k] for i in range(1,n+1))/n)) | 4 | 2 | 103 | 96 | n, k = list(map(int, input().split()))
p = 0
for i in range(1, n + 1):
p += [1, 4 / 2 ** len(bin(~-k // i))][i < k]
print((p / n))
| n, k = list(map(int, input().split()))
print((sum([1, 4 / 2 ** len(bin(~-k // i))][i < k] for i in range(1, n + 1)) / n))
| false | 50 | [
"-p = 0",
"-for i in range(1, n + 1):",
"- p += [1, 4 / 2 ** len(bin(~-k // i))][i < k]",
"-print((p / n))",
"+print((sum([1, 4 / 2 ** len(bin(~-k // i))][i < k] for i in range(1, n + 1)) / n))"
] | false | 0.204717 | 0.103287 | 1.982028 | [
"s000120130",
"s871636505"
] |
u416011173 | p02595 | python | s537959307 | s274684693 | 534 | 417 | 24,992 | 25,008 | Accepted | Accepted | 21.91 | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
# 標準入力を取得
N, D = list(map(int, input().split()))
X, Y = [], []
for n in range(N):
X_n, Y_n = list(map(int, input().split()))
X.append(X_n)
Y.append(Y_n)
# 求解処理
def get_distance(p: int, q: int) -> float:
return math.sqrt(math.pow(p, 2)... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N, D = list(map(int, input().split()))
X, Y = [], []
for n in range(N):
X_n, Y_n = list(map(int, input().split()))
X.append(X_n)
Y.append(Y_n)
re... | 27 | 47 | 476 | 827 | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
# 標準入力を取得
N, D = list(map(int, input().split()))
X, Y = [], []
for n in range(N):
X_n, Y_n = list(map(int, input().split()))
X.append(X_n)
Y.append(Y_n)
# 求解処理
def get_distance(p: int, q: int) -> float:
return math.sqrt(math.pow(p, 2) + math.pow(q, 2))
... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N, D = list(map(int, input().split()))
X, Y = [], []
for n in range(N):
X_n, Y_n = list(map(int, input().split()))
X.append(X_n)
Y.append(Y_n)
return N, D, X, Y
d... | false | 42.553191 | [
"-# モジュールのインポート",
"-import math",
"-",
"-# 標準入力を取得",
"-N, D = list(map(int, input().split()))",
"-X, Y = [], []",
"-for n in range(N):",
"- X_n, Y_n = list(map(int, input().split()))",
"- X.append(X_n)",
"- Y.append(Y_n)",
"-# 求解処理",
"-def get_distance(p: int, q: int) -> float:",
"-... | false | 0.039726 | 0.038636 | 1.028216 | [
"s537959307",
"s274684693"
] |
u357751375 | p04005 | python | s932756536 | s576302269 | 29 | 25 | 9,168 | 9,040 | Accepted | Accepted | 13.79 | a = list(map(int,input().split()))
a.sort(reverse = True)
if a[0] % 2 == 0 or a[1] % 2 == 0 or a[2] % 2 == 0:
print((0))
exit(0)
block = a[0] * a[1] * a[2]
a[0] = a[0] // 2
x = a[0] * a[1] * a[2]
y = block - x
print((abs(x - y))) | a = list(map(int,input().split()))
if a[0] % 2 == 0 or a[1] % 2 == 0 or a[2] % 2 == 0:
print((0))
else:
print((min(a[0]*a[1],a[1]*a[2],a[0]*a[2]))) | 10 | 5 | 242 | 155 | a = list(map(int, input().split()))
a.sort(reverse=True)
if a[0] % 2 == 0 or a[1] % 2 == 0 or a[2] % 2 == 0:
print((0))
exit(0)
block = a[0] * a[1] * a[2]
a[0] = a[0] // 2
x = a[0] * a[1] * a[2]
y = block - x
print((abs(x - y)))
| a = list(map(int, input().split()))
if a[0] % 2 == 0 or a[1] % 2 == 0 or a[2] % 2 == 0:
print((0))
else:
print((min(a[0] * a[1], a[1] * a[2], a[0] * a[2])))
| false | 50 | [
"-a.sort(reverse=True)",
"- exit(0)",
"-block = a[0] * a[1] * a[2]",
"-a[0] = a[0] // 2",
"-x = a[0] * a[1] * a[2]",
"-y = block - x",
"-print((abs(x - y)))",
"+else:",
"+ print((min(a[0] * a[1], a[1] * a[2], a[0] * a[2])))"
] | false | 0.074603 | 0.09625 | 0.775093 | [
"s932756536",
"s576302269"
] |
u761529120 | p03330 | python | s384825547 | s601700070 | 422 | 174 | 43,228 | 75,176 | Accepted | Accepted | 58.77 | from itertools import permutations
def main():
N, C = list(map(int, input().split()))
D = list(list(map(int, input().split())) for _ in range(C))
c = list(list(map(int, input().split())) for _ in range(N))
cost = [[0] * (C + 5) for _ in range(3)]
for k in range(C):
for i in range(... | from itertools import permutations
def main():
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
score = [[0] * 3 for _ in range(C)]
for i in range(N):
for j in range(N):
... | 32 | 26 | 652 | 637 | from itertools import permutations
def main():
N, C = list(map(int, input().split()))
D = list(list(map(int, input().split())) for _ in range(C))
c = list(list(map(int, input().split())) for _ in range(N))
cost = [[0] * (C + 5) for _ in range(3)]
for k in range(C):
for i in range(N):
... | from itertools import permutations
def main():
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
score = [[0] * 3 for _ in range(C)]
for i in range(N):
for j in range(N):
for k ... | false | 18.75 | [
"- D = list(list(map(int, input().split())) for _ in range(C))",
"- c = list(list(map(int, input().split())) for _ in range(N))",
"- cost = [[0] * (C + 5) for _ in range(3)]",
"- for k in range(C):",
"- for i in range(N):",
"- for j in range(N):",
"- cost[(i ... | false | 0.038364 | 0.078137 | 0.490985 | [
"s384825547",
"s601700070"
] |
u815878613 | p02630 | python | s040806945 | s178639204 | 287 | 245 | 40,280 | 34,688 | Accepted | Accepted | 14.63 | from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
... | import sys
from collections import Counter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
BC = list(map(int, read().split()))
d = Counter(A)
sub_s = sum(A)
for b... | 22 | 22 | 370 | 415 | from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
d[c] += d[b]
d[b]... | import sys
from collections import Counter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
BC = list(map(int, read().split()))
d = Counter(A)
sub_s = sum(A)
for b, c in zip(BC, BC):
... | false | 0 | [
"+import sys",
"-import sys",
"+read = sys.stdin.buffer.read",
"+readlines = sys.stdin.buffer.readlines",
"-BC = [list(map(int, readline().split())) for _ in range(Q)]",
"+BC = list(map(int, read().split()))",
"-for b, c in BC:",
"+for b, c in zip(BC, BC):"
] | false | 0.049344 | 0.049649 | 0.993872 | [
"s040806945",
"s178639204"
] |
u729133443 | p02586 | python | s143356978 | s988324368 | 2,009 | 767 | 424,916 | 413,348 | Accepted | Accepted | 61.82 | c=[[0]*3001for _ in range(3001)]
dp=[[[0]*3001for _ in range(3001)]for _ in range(4)]
h,w,k=list(map(int,input().split()))
for i in range(k):
y,x,v=list(map(int,input().split()))
c[y][x]=v
for i in range(1,h+1):
for j in range(1,w+1):
x=max(dp[0][i-1][j],dp[1][i-1][j],dp[2][i-1][j],dp[3][i-1... | import sys
from numpy import*
def main(h,w,k,t):
c=zeros((3001,3001),int_)
dp=zeros((4,3001,3001),int_)
for i in range(k):
y,x,v=t[i]
c[y,x]=v
for i in range(1,h+1):
for j in range(1,w+1):
x=max(dp[:,i-1,j])
for k in range(4):
i... | 14 | 25 | 574 | 759 | c = [[0] * 3001 for _ in range(3001)]
dp = [[[0] * 3001 for _ in range(3001)] for _ in range(4)]
h, w, k = list(map(int, input().split()))
for i in range(k):
y, x, v = list(map(int, input().split()))
c[y][x] = v
for i in range(1, h + 1):
for j in range(1, w + 1):
x = max(dp[0][i - 1][j], dp[1][i - 1... | import sys
from numpy import *
def main(h, w, k, t):
c = zeros((3001, 3001), int_)
dp = zeros((4, 3001, 3001), int_)
for i in range(k):
y, x, v = t[i]
c[y, x] = v
for i in range(1, h + 1):
for j in range(1, w + 1):
x = max(dp[:, i - 1, j])
for k in range... | false | 44 | [
"-c = [[0] * 3001 for _ in range(3001)]",
"-dp = [[[0] * 3001 for _ in range(3001)] for _ in range(4)]",
"-h, w, k = list(map(int, input().split()))",
"-for i in range(k):",
"- y, x, v = list(map(int, input().split()))",
"- c[y][x] = v",
"-for i in range(1, h + 1):",
"- for j in range(1, w + ... | false | 0.987812 | 0.205416 | 4.808844 | [
"s143356978",
"s988324368"
] |
u936985471 | p03032 | python | s873116309 | s733945753 | 29 | 22 | 3,064 | 3,064 | Accepted | Accepted | 24.14 | N,K=list(map(int,input().split()))
V=list(map(int,input().split()))
Vrev=V[::-1]
# 左からA個取る
# 右からB個取る
# A+B<=min(N,K)
# K-(A+B)個詰め直す。負の数で絶対値の大きいものから順に。
# A,Bを、0からA+B=min(N,K)まで全探索
MAX=min(N,K)
ans=0
for a in range(MAX+1):
for b in range(MAX-a+1):
jewels=V[:a]+Vrev[:b]
jewels=sorted(jewels)
... | # 左から取り出すパターンは最大50通り
# 右から取り出すパターンは最大50通り
# その組み合わせは2500通り
# その全通りに対して、マイナスの石を引けるだけ引くパターンを試すと50
# 125000
# すべて試す
import sys
readline = sys.stdin.readline
N,K = list(map(int,readline().split()))
V = [0] + list(map(int,readline().split())) + [0]
N += 2
K += 2
leftsum = 0
leftminus = []
ans = -(10 ** 9... | 26 | 36 | 527 | 846 | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
Vrev = V[::-1]
# 左からA個取る
# 右からB個取る
# A+B<=min(N,K)
# K-(A+B)個詰め直す。負の数で絶対値の大きいものから順に。
# A,Bを、0からA+B=min(N,K)まで全探索
MAX = min(N, K)
ans = 0
for a in range(MAX + 1):
for b in range(MAX - a + 1):
jewels = V[:a] + Vrev[:b]
jewels =... | # 左から取り出すパターンは最大50通り
# 右から取り出すパターンは最大50通り
# その組み合わせは2500通り
# その全通りに対して、マイナスの石を引けるだけ引くパターンを試すと50
# 125000
# すべて試す
import sys
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
V = [0] + list(map(int, readline().split())) + [0]
N += 2
K += 2
leftsum = 0
leftminus = []
ans = -(10**9)
for left in rang... | false | 27.777778 | [
"-N, K = list(map(int, input().split()))",
"-V = list(map(int, input().split()))",
"-Vrev = V[::-1]",
"-# 左からA個取る",
"-# 右からB個取る",
"-# A+B<=min(N,K)",
"-# K-(A+B)個詰め直す。負の数で絶対値の大きいものから順に。",
"-# A,Bを、0からA+B=min(N,K)まで全探索",
"-MAX = min(N, K)",
"-ans = 0",
"-for a in range(MAX + 1):",
"- for b i... | false | 0.065885 | 0.040331 | 1.633606 | [
"s873116309",
"s733945753"
] |
u777923818 | p03102 | python | s666721114 | s879589432 | 309 | 122 | 20,644 | 27,272 | Accepted | Accepted | 60.52 | # -*- coding: utf-8 -*-
import numpy as np
def inpl(): return list(map(int, input().split()))
N, M, C = inpl()
B = np.array(inpl(), dtype=np.int64).reshape(1, -1)
A = np.zeros((N, M), dtype=np.int64)
for i in range(N):
A[i] = inpl()
print((((A*B).sum(axis=1) + C >0).sum())) | # -*- coding: utf-8 -*-
import numpy as np
def inpl(): return list(map(int, input().split()))
N, M, C = inpl()
B = np.array(inpl(), dtype=np.int64)
ans = 0
for _ in range(N):
A = np.array(inpl(), dtype=np.int64)
ans += np.sum(A*B)+C > 0
print(ans)
| 12 | 10 | 290 | 265 | # -*- coding: utf-8 -*-
import numpy as np
def inpl():
return list(map(int, input().split()))
N, M, C = inpl()
B = np.array(inpl(), dtype=np.int64).reshape(1, -1)
A = np.zeros((N, M), dtype=np.int64)
for i in range(N):
A[i] = inpl()
print((((A * B).sum(axis=1) + C > 0).sum()))
| # -*- coding: utf-8 -*-
import numpy as np
def inpl():
return list(map(int, input().split()))
N, M, C = inpl()
B = np.array(inpl(), dtype=np.int64)
ans = 0
for _ in range(N):
A = np.array(inpl(), dtype=np.int64)
ans += np.sum(A * B) + C > 0
print(ans)
| false | 16.666667 | [
"-B = np.array(inpl(), dtype=np.int64).reshape(1, -1)",
"-A = np.zeros((N, M), dtype=np.int64)",
"-for i in range(N):",
"- A[i] = inpl()",
"-print((((A * B).sum(axis=1) + C > 0).sum()))",
"+B = np.array(inpl(), dtype=np.int64)",
"+ans = 0",
"+for _ in range(N):",
"+ A = np.array(inpl(), dtype=... | false | 0.775398 | 0.458265 | 1.692029 | [
"s666721114",
"s879589432"
] |
u089376182 | p03805 | python | s102974158 | s618459782 | 56 | 43 | 3,572 | 3,064 | Accepted | Accepted | 23.21 | import itertools
n, m = list(map(int, input().split()))
ab_list = [tuple(map(int, input().split())) for _ in range(m)]
path_list = sorted(iter for iter in itertools.permutations(list(range(2, n+1)), n-1))
counter = 0
for path_i in path_list:
path = (1, )+path_i
result_list = [True for s_e in zip(pa... | import itertools
n,m = list(map(int, input().split()))
edge_set = {tuple(map(int, input().split())) for _ in range(m)}
counter = 0
for i in itertools.permutations(list(range(2, n+1)), n-1):
path = [1] + list(i)
path_set = {tuple(sorted(edge)) for edge in zip(path, path[1:])}
if path_set <= edge_set... | 16 | 15 | 433 | 350 | import itertools
n, m = list(map(int, input().split()))
ab_list = [tuple(map(int, input().split())) for _ in range(m)]
path_list = sorted(
iter for iter in itertools.permutations(list(range(2, n + 1)), n - 1)
)
counter = 0
for path_i in path_list:
path = (1,) + path_i
result_list = [True for s_e in zip(pat... | import itertools
n, m = list(map(int, input().split()))
edge_set = {tuple(map(int, input().split())) for _ in range(m)}
counter = 0
for i in itertools.permutations(list(range(2, n + 1)), n - 1):
path = [1] + list(i)
path_set = {tuple(sorted(edge)) for edge in zip(path, path[1:])}
if path_set <= edge_set:
... | false | 6.25 | [
"-ab_list = [tuple(map(int, input().split())) for _ in range(m)]",
"-path_list = sorted(",
"- iter for iter in itertools.permutations(list(range(2, n + 1)), n - 1)",
"-)",
"+edge_set = {tuple(map(int, input().split())) for _ in range(m)}",
"-for path_i in path_list:",
"- path = (1,) + path_i",
"... | false | 0.082668 | 0.053132 | 1.555888 | [
"s102974158",
"s618459782"
] |
u352394527 | p00483 | python | s041170486 | s803228121 | 2,820 | 2,420 | 195,744 | 200,052 | Accepted | Accepted | 14.18 | def solve():
m, n = list(map(int,input().split()))
k = int(eval(input()))
mp = [eval(input()) for i in range(m)]
dp = [[[0] * 3 for j in range(n + 1)] for i in range(m + 1)]
dic = {"J":0, "O":1, "I":2}
for i in range(1, m + 1):
dpi = dp[i]
dpi_1 = dp[i - 1]
for j in range(1, n + 1):... | def solve():
m, n = list(map(int,input().split()))
k = int(eval(input()))
mp = [eval(input()) for i in range(m)]
dp = [[[0] * 3 for j in range(n + 1)] for i in range(m + 1)]
dic = {"J":0, "O":1, "I":2}
for i in range(1, m + 1):
dpi = dp[i]
dpi_1 = dp[i - 1]
for j in range(1, n + 1):... | 36 | 40 | 1,279 | 1,365 | def solve():
m, n = list(map(int, input().split()))
k = int(eval(input()))
mp = [eval(input()) for i in range(m)]
dp = [[[0] * 3 for j in range(n + 1)] for i in range(m + 1)]
dic = {"J": 0, "O": 1, "I": 2}
for i in range(1, m + 1):
dpi = dp[i]
dpi_1 = dp[i - 1]
for j in r... | def solve():
m, n = list(map(int, input().split()))
k = int(eval(input()))
mp = [eval(input()) for i in range(m)]
dp = [[[0] * 3 for j in range(n + 1)] for i in range(m + 1)]
dic = {"J": 0, "O": 1, "I": 2}
for i in range(1, m + 1):
dpi = dp[i]
dpi_1 = dp[i - 1]
for j in r... | false | 10 | [
"+ ans = \"\"",
"- print(",
"- (",
"- dpx2y2[0] - dpx1y2[0] - dpx2y1[0] + dpx1y1[0],",
"- dpx2y2[1] - dpx1y2[1] - dpx2y1[1] + dpx1y1[1],",
"- dpx2y2[2] - dpx1y2[2] - dpx2y1[2] + dpx1y1[2],",
"- )",
"+ ans += (",
"+ ... | false | 0.057902 | 0.057868 | 1.000577 | [
"s041170486",
"s803228121"
] |
u072717685 | p03607 | python | s853838073 | s580236298 | 176 | 69 | 19,708 | 23,536 | Accepted | Accepted | 60.8 | from collections import Counter
def main():
n = int(eval(input()))
l1 = []
for _ in range(n):
l1.append(eval(input()))
l1c = Counter(l1)
l1c2 = [c for c in l1c if l1c[c]%2 != 0]
print((len(l1c2)))
if __name__ == '__main__':
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import Counter
def main():
n = eval(input())
a = tuple(map(int, readlines()))
ac = Counter(a)
ac2 = [c % 2 for c in list(ac.values())]
r = sum(ac2)
print(r)
if __name__ == '__main__':
main()
| 12 | 13 | 265 | 301 | from collections import Counter
def main():
n = int(eval(input()))
l1 = []
for _ in range(n):
l1.append(eval(input()))
l1c = Counter(l1)
l1c2 = [c for c in l1c if l1c[c] % 2 != 0]
print((len(l1c2)))
if __name__ == "__main__":
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import Counter
def main():
n = eval(input())
a = tuple(map(int, readlines()))
ac = Counter(a)
ac2 = [c % 2 for c in list(ac.values())]
r = sum(ac2)
print(r)
if __name__ == "__main__":
main()
| false | 7.692308 | [
"+import sys",
"+",
"+read = sys.stdin.read",
"+readlines = sys.stdin.readlines",
"- n = int(eval(input()))",
"- l1 = []",
"- for _ in range(n):",
"- l1.append(eval(input()))",
"- l1c = Counter(l1)",
"- l1c2 = [c for c in l1c if l1c[c] % 2 != 0]",
"- print((len(l1c2)))",... | false | 0.061344 | 0.037297 | 1.644755 | [
"s853838073",
"s580236298"
] |
u678167152 | p03775 | python | s463990376 | s745026007 | 34 | 27 | 3,060 | 3,060 | Accepted | Accepted | 20.59 | N = int(eval(input()))
def divisor(n):
cd = []
i = 1
while i*i <= n:
if n%i==0:
cd.append(i)
if i != n//i:
cd.append(n//i)
i+=1
return cd
cd = divisor(N)
ans = len(str(cd[-1]))
print(ans)
| def solve():
N = int(eval(input()))
n = int(N**0.5)+1
for i in range(n,0,-1):
if N%i==0:
ans = len(str(N//i))
break
return ans
print((solve()))
| 18 | 9 | 275 | 192 | N = int(eval(input()))
def divisor(n):
cd = []
i = 1
while i * i <= n:
if n % i == 0:
cd.append(i)
if i != n // i:
cd.append(n // i)
i += 1
return cd
cd = divisor(N)
ans = len(str(cd[-1]))
print(ans)
| def solve():
N = int(eval(input()))
n = int(N**0.5) + 1
for i in range(n, 0, -1):
if N % i == 0:
ans = len(str(N // i))
break
return ans
print((solve()))
| false | 50 | [
"-N = int(eval(input()))",
"+def solve():",
"+ N = int(eval(input()))",
"+ n = int(N**0.5) + 1",
"+ for i in range(n, 0, -1):",
"+ if N % i == 0:",
"+ ans = len(str(N // i))",
"+ break",
"+ return ans",
"-def divisor(n):",
"- cd = []",
"- i = 1",
... | false | 0.044121 | 0.036254 | 1.216991 | [
"s463990376",
"s745026007"
] |
u600402037 | p03038 | python | s053594989 | s878747399 | 424 | 372 | 24,760 | 36,324 | Accepted | Accepted | 12.26 | from bisect import bisect_left
from operator import itemgetter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = []
X = []
for _ in range(M):
b, c = list(map(int, input().split()))
X.append((b, c))
X = sorted(X, key=itemgetter(1), reverse=True)
for b, c in X:
B... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
A = lr()
BC = [lr() for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
D = []
count = 0
for b, c in BC:
x = [c] * b
D.extend(x)
count... | 22 | 24 | 434 | 432 | from bisect import bisect_left
from operator import itemgetter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = []
X = []
for _ in range(M):
b, c = list(map(int, input().split()))
X.append((b, c))
X = sorted(X, key=itemgetter(1), reverse=True)
for b, c in X:
BC.extend([c] * b... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
A = lr()
BC = [lr() for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
D = []
count = 0
for b, c in BC:
x = [c] * b
D.extend(x)
count += b
if coun... | false | 8.333333 | [
"-from bisect import bisect_left",
"-from operator import itemgetter",
"+# coding: utf-8",
"+import sys",
"-N, M = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-BC = []",
"-X = []",
"-for _ in range(M):",
"- b, c = list(map(int, input().split()))",
"- X.append... | false | 0.040943 | 0.04567 | 0.896489 | [
"s053594989",
"s878747399"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.