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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u566872786 | p02409 | python | s245291591 | s141212864 | 50 | 20 | 7,788 | 7,784 | Accepted | Accepted | 60 | I=input
r=range
a=[[[0 for i in r(10)]for j in r(3)]for k in r(4)]
for i in r(int(I())):b,f,r,v=list(map(int,I().split()));a[b-1][f-1][r-1]+=v
f=0
for i in a:
if f:print(('#'*20))
else:f=1
for j in i:print(('',*j)) | I=input
r=range
a=[[['']+[0 for i in r(10)]for j in r(3)]for k in r(4)]
for i in r(int(I())):b,f,r,v=list(map(int,I().split()));a[b-1][f-1][r]+=v
f=0
for i in a:
if f:print(('#'*20))
else:f=1
for j in i:print((*j)) | 9 | 9 | 218 | 218 | I = input
r = range
a = [[[0 for i in r(10)] for j in r(3)] for k in r(4)]
for i in r(int(I())):
b, f, r, v = list(map(int, I().split()))
a[b - 1][f - 1][r - 1] += v
f = 0
for i in a:
if f:
print(("#" * 20))
else:
f = 1
for j in i:
print(("", *j))
| I = input
r = range
a = [[[""] + [0 for i in r(10)] for j in r(3)] for k in r(4)]
for i in r(int(I())):
b, f, r, v = list(map(int, I().split()))
a[b - 1][f - 1][r] += v
f = 0
for i in a:
if f:
print(("#" * 20))
else:
f = 1
for j in i:
print((*j))
| false | 0 | [
"-a = [[[0 for i in r(10)] for j in r(3)] for k in r(4)]",
"+a = [[[\"\"] + [0 for i in r(10)] for j in r(3)] for k in r(4)]",
"- a[b - 1][f - 1][r - 1] += v",
"+ a[b - 1][f - 1][r] += v",
"- print((\"\", *j))",
"+ print((*j))"
] | false | 0.061909 | 0.073591 | 0.841258 | [
"s245291591",
"s141212864"
] |
u882359130 | p03317 | python | s280919376 | s424953376 | 51 | 45 | 13,880 | 13,880 | Accepted | Accepted | 11.76 | N, K = [int(nk) for nk in input().split()]
A = [int(a) for a in input().split()]
N -= K
cnt = 1
while N > 0:
N -= K-1
cnt += 1
print(cnt) | N, K = [int(nk) for nk in input().split()]
A = [int(a) for a in input().split()]
if (N-1) % (K-1) == 0:
print(((N-1) // (K-1)))
else:
print((((N-1) // (K-1)) + 1)) | 8 | 6 | 148 | 168 | N, K = [int(nk) for nk in input().split()]
A = [int(a) for a in input().split()]
N -= K
cnt = 1
while N > 0:
N -= K - 1
cnt += 1
print(cnt)
| N, K = [int(nk) for nk in input().split()]
A = [int(a) for a in input().split()]
if (N - 1) % (K - 1) == 0:
print(((N - 1) // (K - 1)))
else:
print((((N - 1) // (K - 1)) + 1))
| false | 25 | [
"-N -= K",
"-cnt = 1",
"-while N > 0:",
"- N -= K - 1",
"- cnt += 1",
"-print(cnt)",
"+if (N - 1) % (K - 1) == 0:",
"+ print(((N - 1) // (K - 1)))",
"+else:",
"+ print((((N - 1) // (K - 1)) + 1))"
] | false | 0.034434 | 0.035318 | 0.97496 | [
"s280919376",
"s424953376"
] |
u948524308 | p03476 | python | s444500498 | s095474845 | 1,254 | 870 | 3,444 | 4,980 | Accepted | Accepted | 30.62 | import bisect
def PN(N):
for i in range(2,int(N**0.5)+1):
if N%i==0:
return False
return True
N=[3]
for i in range(5,100001,2):
if PN(i) and PN((i+1)//2):
N.append(i)
Q=int(eval(input()))
for i in range(Q):
l,r=list(map(int,input().split()))
ln1=bisec... | def PrimeNumber(N):
f=[1]*(N+1)
f[0]=0
f[1]=0
for i in range(2,N+1):
if f[i]==0:
continue
j = 2
temp = i
while temp * j <= N:
f[temp*j]=0
j += 1
return f
PN=PrimeNumber(100000)
C=[0]*100001
C[1]=0
for i in ... | 30 | 32 | 584 | 527 | import bisect
def PN(N):
for i in range(2, int(N**0.5) + 1):
if N % i == 0:
return False
return True
N = [3]
for i in range(5, 100001, 2):
if PN(i) and PN((i + 1) // 2):
N.append(i)
Q = int(eval(input()))
for i in range(Q):
l, r = list(map(int, input().split()))
ln1 =... | def PrimeNumber(N):
f = [1] * (N + 1)
f[0] = 0
f[1] = 0
for i in range(2, N + 1):
if f[i] == 0:
continue
j = 2
temp = i
while temp * j <= N:
f[temp * j] = 0
j += 1
return f
PN = PrimeNumber(100000)
C = [0] * 100001
C[1] = 0
for i ... | false | 6.25 | [
"-import bisect",
"+def PrimeNumber(N):",
"+ f = [1] * (N + 1)",
"+ f[0] = 0",
"+ f[1] = 0",
"+ for i in range(2, N + 1):",
"+ if f[i] == 0:",
"+ continue",
"+ j = 2",
"+ temp = i",
"+ while temp * j <= N:",
"+ f[temp * j] = 0",
"... | false | 0.344675 | 0.291394 | 1.182849 | [
"s444500498",
"s095474845"
] |
u729133443 | p02811 | python | s199982681 | s403650172 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | import re;print((re.search('.1',eval(input()))and'No'or'Yes')) | print(('YNeos'[input()[1:].find('1')>=0::2])) | 1 | 1 | 54 | 43 | import re
print((re.search(".1", eval(input())) and "No" or "Yes"))
| print(("YNeos"[input()[1:].find("1") >= 0 :: 2]))
| false | 0 | [
"-import re",
"-",
"-print((re.search(\".1\", eval(input())) and \"No\" or \"Yes\"))",
"+print((\"YNeos\"[input()[1:].find(\"1\") >= 0 :: 2]))"
] | false | 0.076222 | 0.069312 | 1.099692 | [
"s199982681",
"s403650172"
] |
u867826040 | p02779 | python | s206341950 | s190125429 | 101 | 82 | 27,968 | 26,808 | Accepted | Accepted | 18.81 | n = eval(input())
a = list(map(int,input().split()))
if len(set(a)) == len(a):
print("YES")
elif len(set(a)) != len(a):
print("NO") | n = eval(input())
a = list(map(int,input().split()))
if len(a)== len(set(a)):
print("YES")
else:
print("NO") | 6 | 6 | 134 | 111 | n = eval(input())
a = list(map(int, input().split()))
if len(set(a)) == len(a):
print("YES")
elif len(set(a)) != len(a):
print("NO")
| n = eval(input())
a = list(map(int, input().split()))
if len(a) == len(set(a)):
print("YES")
else:
print("NO")
| false | 0 | [
"-if len(set(a)) == len(a):",
"+if len(a) == len(set(a)):",
"-elif len(set(a)) != len(a):",
"+else:"
] | false | 0.036709 | 0.038355 | 0.957093 | [
"s206341950",
"s190125429"
] |
u759412327 | p03087 | python | s195035216 | s308686385 | 864 | 639 | 7,688 | 29,096 | Accepted | Accepted | 26.04 | N,Q = list(map(int,input().split()))
S = eval(input())
s = [0]
for i in range(N):
s.append(s[-1]+(1 if S[i:i+2]=='AC' else 0))
for i in range(Q):
l,r=list(map(int,input().split()))
print((s[r-1]-s[l-1])) | import numpy as np
N,Q = list(map(int,input().split()))
S = eval(input())
T = (N+1)*[0]
for n in range(N):
if S[n:n+2]=="AC":
T[n+1]+=1
T = np.cumsum(T)
for q in range(Q):
l,r = list(map(int,input().split()))
print((T[r-1]-T[l-1])) | 10 | 14 | 200 | 237 | N, Q = list(map(int, input().split()))
S = eval(input())
s = [0]
for i in range(N):
s.append(s[-1] + (1 if S[i : i + 2] == "AC" else 0))
for i in range(Q):
l, r = list(map(int, input().split()))
print((s[r - 1] - s[l - 1]))
| import numpy as np
N, Q = list(map(int, input().split()))
S = eval(input())
T = (N + 1) * [0]
for n in range(N):
if S[n : n + 2] == "AC":
T[n + 1] += 1
T = np.cumsum(T)
for q in range(Q):
l, r = list(map(int, input().split()))
print((T[r - 1] - T[l - 1]))
| false | 28.571429 | [
"+import numpy as np",
"+",
"-s = [0]",
"-for i in range(N):",
"- s.append(s[-1] + (1 if S[i : i + 2] == \"AC\" else 0))",
"-for i in range(Q):",
"+T = (N + 1) * [0]",
"+for n in range(N):",
"+ if S[n : n + 2] == \"AC\":",
"+ T[n + 1] += 1",
"+T = np.cumsum(T)",
"+for q in range(Q... | false | 0.047068 | 0.686846 | 0.068527 | [
"s195035216",
"s308686385"
] |
u633068244 | p00730 | python | s589970752 | s915590366 | 60 | 40 | 4,248 | 4,240 | Accepted | Accepted | 33.33 | while 1:
n,w,d = list(map(int,input().split()))
if w == 0: break
cake = [[w,d]]
for loop in range(n):
p,s = list(map(int,input().split()))
x,y = cake.pop(p-1)
s %= (x+y)
if s < x:
x1,x2 = sorted([s,x-s])
cake.append([x1,y])
c... | while 1:
n,w,d = list(map(int,input().split()))
if w == 0: break
cake = [[w,d]]
for loop in range(n):
p,s = list(map(int,input().split()))
x,y = cake.pop(p-1)
s %= (x+y)
if s < x:
x1,x2 = sorted([s,x-s])
cake += [[x1,y],[x2,y]]
e... | 18 | 16 | 533 | 475 | while 1:
n, w, d = list(map(int, input().split()))
if w == 0:
break
cake = [[w, d]]
for loop in range(n):
p, s = list(map(int, input().split()))
x, y = cake.pop(p - 1)
s %= x + y
if s < x:
x1, x2 = sorted([s, x - s])
cake.append([x1, y])
... | while 1:
n, w, d = list(map(int, input().split()))
if w == 0:
break
cake = [[w, d]]
for loop in range(n):
p, s = list(map(int, input().split()))
x, y = cake.pop(p - 1)
s %= x + y
if s < x:
x1, x2 = sorted([s, x - s])
cake += [[x1, y], [x2, ... | false | 11.111111 | [
"- cake.append([x1, y])",
"- cake.append([x2, y])",
"+ cake += [[x1, y], [x2, y]]",
"- cake.append([x, y1])",
"- cake.append([x, y2])",
"+ cake += [[x, y1], [x, y2]]"
] | false | 0.043352 | 0.043446 | 0.997843 | [
"s589970752",
"s915590366"
] |
u337626942 | p03043 | python | s747345258 | s452203700 | 186 | 44 | 38,896 | 9,364 | Accepted | Accepted | 76.34 | n, k=list(map(int, input().split()))
ans=0
for i in range(1, n+1):
cnt=0
p=i
while p<k:
p*=2
cnt+=1
ans+=(1/2)**cnt
print((ans*(1/n))) | n, k=list(map(int, input().split()))
ans=0
for i in range(1, n+1):
cnt=0
while i<=k-1:
i=2*i
cnt+=1
ans+=(1/2)**cnt
ans/=n
print(ans) | 13 | 14 | 177 | 180 | n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
cnt = 0
p = i
while p < k:
p *= 2
cnt += 1
ans += (1 / 2) ** cnt
print((ans * (1 / n)))
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
cnt = 0
while i <= k - 1:
i = 2 * i
cnt += 1
ans += (1 / 2) ** cnt
ans /= n
print(ans)
| false | 7.142857 | [
"- p = i",
"- while p < k:",
"- p *= 2",
"+ while i <= k - 1:",
"+ i = 2 * i",
"-print((ans * (1 / n)))",
"+ans /= n",
"+print(ans)"
] | false | 0.04564 | 0.047507 | 0.960693 | [
"s747345258",
"s452203700"
] |
u621935300 | p02913 | python | s668129331 | s482127468 | 1,432 | 473 | 108,316 | 229,532 | Accepted | Accepted | 66.97 | # -*- coding: utf-8 -*-
import sys
N=int(sys.stdin.readline().strip())
S=sys.stdin.readline().strip()
ans=0
for d in range(1,N):
cnt=0
for s,t in zip(S[d:N],S[:N-d]):
if s==t:
cnt+=1
else:
ans=max(ans,min(d,cnt)) #最大の文字列一致はd以下
cnt=0
else:
... | # -*- coding: utf-8 -*-
import sys
N=int(sys.stdin.readline().strip())
S=sys.stdin.readline().strip()
S=S[::-1]
dp=[ [ 0 for j in range(N+1) ] for i in range(N+1) ]
for i in range(1,N+1): #iは1-indexed
for j in range(1,i+1):
if S[i-1]==S[j-1]: #Sは0-indexedなので-1
dp[i][j]=max(dp[i][j... | 18 | 20 | 422 | 525 | # -*- coding: utf-8 -*-
import sys
N = int(sys.stdin.readline().strip())
S = sys.stdin.readline().strip()
ans = 0
for d in range(1, N):
cnt = 0
for s, t in zip(S[d:N], S[: N - d]):
if s == t:
cnt += 1
else:
ans = max(ans, min(d, cnt)) # 最大の文字列一致はd以下
cnt = 0
... | # -*- coding: utf-8 -*-
import sys
N = int(sys.stdin.readline().strip())
S = sys.stdin.readline().strip()
S = S[::-1]
dp = [[0 for j in range(N + 1)] for i in range(N + 1)]
for i in range(1, N + 1): # iは1-indexed
for j in range(1, i + 1):
if S[i - 1] == S[j - 1]: # Sは0-indexedなので-1
dp[i][j] =... | false | 10 | [
"+S = S[::-1]",
"+dp = [[0 for j in range(N + 1)] for i in range(N + 1)]",
"+for i in range(1, N + 1): # iは1-indexed",
"+ for j in range(1, i + 1):",
"+ if S[i - 1] == S[j - 1]: # Sは0-indexedなので-1",
"+ dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1)",
"+ else:",
"+ ... | false | 0.034916 | 0.055933 | 0.624242 | [
"s668129331",
"s482127468"
] |
u659753499 | p03379 | python | s769148031 | s682214693 | 322 | 200 | 26,772 | 29,204 | Accepted | Accepted | 37.89 | N = int(eval(input()))
xn = list(map(int,input().split()))
x0,x1 = sorted(xn)[N//2-1:N//2+1]
xm = (x0+x1)/2
for x in xn:
print((x1 if x < xm else x0))
| N = int(eval(input()))
xn = list(map(int,input().split()))
x0,x1 = sorted(xn)[N//2-1:N//2+1]
res = [x0 if x0 < x else x1 for x in xn]
print(('\n'.join(map(str,res))))
| 6 | 5 | 150 | 163 | N = int(eval(input()))
xn = list(map(int, input().split()))
x0, x1 = sorted(xn)[N // 2 - 1 : N // 2 + 1]
xm = (x0 + x1) / 2
for x in xn:
print((x1 if x < xm else x0))
| N = int(eval(input()))
xn = list(map(int, input().split()))
x0, x1 = sorted(xn)[N // 2 - 1 : N // 2 + 1]
res = [x0 if x0 < x else x1 for x in xn]
print(("\n".join(map(str, res))))
| false | 16.666667 | [
"-xm = (x0 + x1) / 2",
"-for x in xn:",
"- print((x1 if x < xm else x0))",
"+res = [x0 if x0 < x else x1 for x in xn]",
"+print((\"\\n\".join(map(str, res))))"
] | false | 0.070019 | 0.076019 | 0.92108 | [
"s769148031",
"s682214693"
] |
u936985471 | p02936 | python | s518903043 | s053934585 | 1,836 | 856 | 64,332 | 65,932 | Accepted | Accepted | 53.38 | N,Q=list(map(int,input().split()))
E=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
E[a-1].append(b-1)
E[b-1].append(a-1)
X=[0]*N
for i in range(Q):
p,x=list(map(int,input().split()))
X[p-1]+=x
stack=[]
stack.append([0,0,-1])
ans=[0]*N
while stack:
node=stac... | import sys
readline = sys.stdin.readline
N,Q = list(map(int,readline().split()))
G = [[] for i in range(N)]
for i in range(N - 1):
a,b = list(map(int,readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
P = [0 for i in range(N)]
for i in range(Q):
p,x = list(map(int,readline().split(... | 27 | 25 | 508 | 523 | N, Q = list(map(int, input().split()))
E = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
E[a - 1].append(b - 1)
E[b - 1].append(a - 1)
X = [0] * N
for i in range(Q):
p, x = list(map(int, input().split()))
X[p - 1] += x
stack = []
stack.append([0, 0, -1])
ans = ... | import sys
readline = sys.stdin.readline
N, Q = list(map(int, readline().split()))
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
P = [0 for i in range(N)]
for i in range(Q):
p, x = list(map(int, readline().split... | false | 7.407407 | [
"-N, Q = list(map(int, input().split()))",
"-E = [[] for i in range(N)]",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N, Q = list(map(int, readline().split()))",
"+G = [[] for i in range(N)]",
"- a, b = list(map(int, input().split()))",
"- E[a - 1].append(b - 1)",
"- E[b - 1].... | false | 0.047122 | 0.046424 | 1.01503 | [
"s518903043",
"s053934585"
] |
u970308980 | p02913 | python | s795015566 | s305362566 | 1,860 | 1,565 | 247,944 | 245,896 | Accepted | Accepted | 15.86 | N = int(eval(input()))
S = input().strip()
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in reversed(list(range(N))):
for j in reversed(list(range(N))):
if i >= j:
continue
if S[i] != S[j]:
dp[i][j] = 0
if S[i] == S[j]:
dp[i][j] = ... | N = int(eval(input()))
S = input().strip()
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in reversed(list(range(N))):
for j in reversed(list(range(i+1, N))):
if S[i] != S[j]:
dp[i][j] = 0
if S[i] == S[j]:
dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in... | 23 | 19 | 495 | 421 | N = int(eval(input()))
S = input().strip()
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for i in reversed(list(range(N))):
for j in reversed(list(range(N))):
if i >= j:
continue
if S[i] != S[j]:
dp[i][j] = 0
if S[i] == S[j]:
dp[i][j] = dp[i + 1][... | N = int(eval(input()))
S = input().strip()
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for i in reversed(list(range(N))):
for j in reversed(list(range(i + 1, N))):
if S[i] != S[j]:
dp[i][j] = 0
if S[i] == S[j]:
dp[i][j] = dp[i + 1][j + 1] + 1
ans = 0
for i in range... | false | 17.391304 | [
"- for j in reversed(list(range(N))):",
"- if i >= j:",
"- continue",
"+ for j in reversed(list(range(i + 1, N))):",
"- for j in range(N):",
"- if i >= j:",
"- continue",
"+ for j in range(i + 1, N):"
] | false | 0.082969 | 0.089075 | 0.931452 | [
"s795015566",
"s305362566"
] |
u348805958 | p02659 | python | s546973770 | s484050009 | 24 | 21 | 9,172 | 8,936 | Accepted | Accepted | 12.5 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
a, b = input().split()
a = int(a); b = int(b.replace(".", ""))
print((a*b//100))
if __name__ == "__main__":
resolve()
| #!python3
import sys
def resolve():
a, b = sys.stdin.read().split()
a = int(a); b = int(b.replace(".", ""))
print((a*b//100))
if __name__ == "__main__":
resolve()
| 12 | 12 | 221 | 192 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
print((a * b // 100))
if __name__ == "__main__":
resolve()
| #!python3
import sys
def resolve():
a, b = sys.stdin.read().split()
a = int(a)
b = int(b.replace(".", ""))
print((a * b // 100))
if __name__ == "__main__":
resolve()
| false | 0 | [
"-iim = lambda: list(map(int, input().rstrip().split()))",
"+import sys",
"- a, b = input().split()",
"+ a, b = sys.stdin.read().split()"
] | false | 0.043262 | 0.041625 | 1.039323 | [
"s546973770",
"s484050009"
] |
u868701750 | p03624 | python | s568412288 | s057992569 | 22 | 19 | 4,016 | 3,188 | Accepted | Accepted | 13.64 | s = eval(input())
_s = [a for a in s]
ss = set(_s)
_az = [chr(i) for i in range(ord('a'), ord('z')+1)]
az = set(_az)
diff = list(az - ss)
diff.sort()
if len(diff):
print((diff[0]))
else:
print('None') | all_c = 'abcdefghijklmnopqrstuvwxyz'
all_key = set(all_c)
S = set(eval(input()))
dif = all_key - S
_dif = list(dif)
_dif.sort()
if len(_dif):
print((_dif[0]))
else:
print('None')
| 14 | 14 | 216 | 196 | s = eval(input())
_s = [a for a in s]
ss = set(_s)
_az = [chr(i) for i in range(ord("a"), ord("z") + 1)]
az = set(_az)
diff = list(az - ss)
diff.sort()
if len(diff):
print((diff[0]))
else:
print("None")
| all_c = "abcdefghijklmnopqrstuvwxyz"
all_key = set(all_c)
S = set(eval(input()))
dif = all_key - S
_dif = list(dif)
_dif.sort()
if len(_dif):
print((_dif[0]))
else:
print("None")
| false | 0 | [
"-s = eval(input())",
"-_s = [a for a in s]",
"-ss = set(_s)",
"-_az = [chr(i) for i in range(ord(\"a\"), ord(\"z\") + 1)]",
"-az = set(_az)",
"-diff = list(az - ss)",
"-diff.sort()",
"-if len(diff):",
"- print((diff[0]))",
"+all_c = \"abcdefghijklmnopqrstuvwxyz\"",
"+all_key = set(all_c)",
... | false | 0.041363 | 0.040204 | 1.028827 | [
"s568412288",
"s057992569"
] |
u936985471 | p02844 | python | s581419069 | s231414652 | 212 | 42 | 73,632 | 10,404 | Accepted | Accepted | 80.19 | import sys
readline = sys.stdin.readline
N = int(readline())
S = readline().rstrip()
ans = 0
for i in range(1000):
target = str(i).zfill(3)
ind = 0
tar_ind = 0
while ind < N:
if S[ind] == target[tar_ind]:
tar_ind += 1
if tar_ind == 3:
ans += 1
break
ind += ... | import sys
readline = sys.stdin.readline
N = int(readline())
S = readline().rstrip()
ans = 0
numlist = [[] for i in range(10)]
for i in range(len(S)):
numlist[int(S[i])].append(i)
ans = 0
import bisect
for i in range(1000):
target = str(i).zfill(3)
now = 0
for j in range(len(target)):
... | 20 | 27 | 337 | 506 | import sys
readline = sys.stdin.readline
N = int(readline())
S = readline().rstrip()
ans = 0
for i in range(1000):
target = str(i).zfill(3)
ind = 0
tar_ind = 0
while ind < N:
if S[ind] == target[tar_ind]:
tar_ind += 1
if tar_ind == 3:
ans += 1
... | import sys
readline = sys.stdin.readline
N = int(readline())
S = readline().rstrip()
ans = 0
numlist = [[] for i in range(10)]
for i in range(len(S)):
numlist[int(S[i])].append(i)
ans = 0
import bisect
for i in range(1000):
target = str(i).zfill(3)
now = 0
for j in range(len(target)):
tar = in... | false | 25.925926 | [
"+numlist = [[] for i in range(10)]",
"+for i in range(len(S)):",
"+ numlist[int(S[i])].append(i)",
"+ans = 0",
"+import bisect",
"+",
"- ind = 0",
"- tar_ind = 0",
"- while ind < N:",
"- if S[ind] == target[tar_ind]:",
"- tar_ind += 1",
"- if tar_ind =... | false | 0.052381 | 0.04952 | 1.057776 | [
"s581419069",
"s231414652"
] |
u277312083 | p02861 | python | s070574319 | s536926018 | 374 | 166 | 3,188 | 3,188 | Accepted | Accepted | 55.61 | from itertools import permutations
from math import sqrt
n = int(eval(input()))
x = [0] * n
y = [0] * n
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
p = [i for i in range(n)]
c = 0
d = 0.0
for a in permutations(p):
c += 1
for i in range(n - 1):
d += sqrt((x[a[i]] - ... | from itertools import permutations
from math import sqrt
n = int(eval(input()))
x = [0] * n
y = [0] * n
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
p = [i for i in range(n)]
c = 0
d = 0.0
dp = [[0.0 for _ in range(n)] for _ in range(n)]
for a in permutations(p):
c += 1
for... | 16 | 19 | 389 | 531 | from itertools import permutations
from math import sqrt
n = int(eval(input()))
x = [0] * n
y = [0] * n
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
p = [i for i in range(n)]
c = 0
d = 0.0
for a in permutations(p):
c += 1
for i in range(n - 1):
d += sqrt((x[a[i]] - x[a[i + 1]]) *... | from itertools import permutations
from math import sqrt
n = int(eval(input()))
x = [0] * n
y = [0] * n
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
p = [i for i in range(n)]
c = 0
d = 0.0
dp = [[0.0 for _ in range(n)] for _ in range(n)]
for a in permutations(p):
c += 1
for i in range(n ... | false | 15.789474 | [
"+dp = [[0.0 for _ in range(n)] for _ in range(n)]",
"- d += sqrt((x[a[i]] - x[a[i + 1]]) ** 2 + (y[a[i]] - y[a[i + 1]]) ** 2)",
"+ if dp[a[i]][a[i + 1]] == 0.0:",
"+ dp[a[i]][a[i + 1]] = sqrt(",
"+ (x[a[i]] - x[a[i + 1]]) ** 2 + (y[a[i]] - y[a[i + 1]]) ** 2",
"+ ... | false | 0.052186 | 0.041322 | 1.262916 | [
"s070574319",
"s536926018"
] |
u678167152 | p03546 | python | s505888997 | s353303643 | 190 | 33 | 40,428 | 3,444 | Accepted | Accepted | 82.63 | import heapq
def dijkstra_heap(s,C):
#始点sから各頂点への最短距離
d = [float("inf")] * 10
used = [False] * 10
d[s] = 0
used[s] = True
edgelist = []
#edgelist : (sからの暫定(未確定)最短距離,頂点)のリスト
#edge[s] : sから出る枝の(重み,終点)の配列
for i,w in enumerate(C[s]):
heapq.heappush(edgelist,[w,i]) #sの隣の点は枝の重さがそのまま暫定最短距離となる
... | #Warshall Floyd
H, W = list(map(int, input().split()))
def solve():
d = []
for i in range(10): #ひとまず枝があるペアは枝の長さをセット
d.append(list(map(int, input().split())))
A=[0]*H
for i in range(H):
A[i] = list(map(int, input().split()))
#三重ループ
for k in range(10):
for ... | 41 | 25 | 996 | 586 | import heapq
def dijkstra_heap(s, C):
# 始点sから各頂点への最短距離
d = [float("inf")] * 10
used = [False] * 10
d[s] = 0
used[s] = True
edgelist = []
# edgelist : (sからの暫定(未確定)最短距離,頂点)のリスト
# edge[s] : sから出る枝の(重み,終点)の配列
for i, w in enumerate(C[s]):
heapq.heappush(edgelist, [w, i]) # sの隣の... | # Warshall Floyd
H, W = list(map(int, input().split()))
def solve():
d = []
for i in range(10): # ひとまず枝があるペアは枝の長さをセット
d.append(list(map(int, input().split())))
A = [0] * H
for i in range(H):
A[i] = list(map(int, input().split()))
# 三重ループ
for k in range(10):
for i in ra... | false | 39.02439 | [
"-import heapq",
"+# Warshall Floyd",
"+H, W = list(map(int, input().split()))",
"-def dijkstra_heap(s, C):",
"- # 始点sから各頂点への最短距離",
"- d = [float(\"inf\")] * 10",
"- used = [False] * 10",
"- d[s] = 0",
"- used[s] = True",
"- edgelist = []",
"- # edgelist : (sからの暫定(未確定)最短距離,頂... | false | 0.08239 | 0.044771 | 1.840258 | [
"s505888997",
"s353303643"
] |
u076917070 | p02837 | python | s441366499 | s473087505 | 233 | 173 | 3,064 | 3,064 | Accepted | Accepted | 25.75 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [[set(), set()] for _ in range(N)]
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
A[i][y].add(x)
ans = 0
for i in... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
H = [0]*N
U = [0]*N
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
x -= 1
if y:
H[i] += (1 << ... | 30 | 35 | 661 | 748 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [[set(), set()] for _ in range(N)]
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
A[i][y].add(x)
ans = 0
for i in range(1 << N)... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
H = [0] * N
U = [0] * N
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
x -= 1
if y:
H[i] += 1 << x
... | false | 14.285714 | [
"- A = [[set(), set()] for _ in range(N)]",
"+ H = [0] * N",
"+ U = [0] * N",
"- A[i][y].add(x)",
"+ x -= 1",
"+ if y:",
"+ H[i] += 1 << x",
"+ else:",
"+ U[i] += 1 << x",
"- h, u = set(), set()",
"+ ... | false | 0.045733 | 0.040609 | 1.126169 | [
"s441366499",
"s473087505"
] |
u844646164 | p03274 | python | s630777057 | s545640455 | 131 | 102 | 14,252 | 14,224 | Accepted | Accepted | 22.14 | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
left = []
right = []
cnt = 0
for i in range(N):
if x[i] < 0:
left += [-x[i]]
elif x[i] > 0:
right += [x[i]]
else:
cnt += 1
rest = K - cnt
left = left[::-1]
if rest != 0:
ans = float('inf')
... | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = float('inf')
for i in range(N-K+1):
ans = min(ans, abs(x[i]) + abs(x[i]-x[i+K-1]))
ans = min(ans, abs(x[i+K-1]) + abs(x[i]-x[i+K-1]))
print(ans) | 30 | 7 | 693 | 233 | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
left = []
right = []
cnt = 0
for i in range(N):
if x[i] < 0:
left += [-x[i]]
elif x[i] > 0:
right += [x[i]]
else:
cnt += 1
rest = K - cnt
left = left[::-1]
if rest != 0:
ans = float("inf")
else:
ans = ... | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = float("inf")
for i in range(N - K + 1):
ans = min(ans, abs(x[i]) + abs(x[i] - x[i + K - 1]))
ans = min(ans, abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1]))
print(ans)
| false | 76.666667 | [
"-left = []",
"-right = []",
"-cnt = 0",
"-for i in range(N):",
"- if x[i] < 0:",
"- left += [-x[i]]",
"- elif x[i] > 0:",
"- right += [x[i]]",
"- else:",
"- cnt += 1",
"-rest = K - cnt",
"-left = left[::-1]",
"-if rest != 0:",
"- ans = float(\"inf\")",
"... | false | 0.040376 | 0.079257 | 0.509428 | [
"s630777057",
"s545640455"
] |
u054514819 | p02713 | python | s430521194 | s897044186 | 730 | 513 | 9,180 | 68,824 | Accepted | Accepted | 29.73 | from math import gcd
def solve():
K = int(eval(input()))
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
a = gcd(i, j)
for k in range(1, K+1):
ans += gcd(a, k)
return ans
print((solve())) | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
K = int(eval(input()))
from math import gcd
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
ans += gcd(i, gcd(... | 13 | 13 | 263 | 326 | from math import gcd
def solve():
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
a = gcd(i, j)
for k in range(1, K + 1):
ans += gcd(a, k)
return ans
print((solve()))
| import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
K = int(eval(input()))
from math import gcd
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gc... | false | 0 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"+K = int(eval(input()))",
"-",
"-def solve():",
"- K = int(eval(input()))",
... | false | 0.103393 | 0.082975 | 1.246072 | [
"s430521194",
"s897044186"
] |
u075303794 | p03338 | python | s776009524 | s741349252 | 22 | 17 | 3,064 | 2,940 | Accepted | Accepted | 22.73 | n = int(eval(input()))
k = list(x for x in eval(input()))
ans = [0] * n
for i in range(n):
l = []
for j in range(0,i):
if l.count(k[j]) == 0:
l.append(k[j])
if k[i:n].count(k[j]) > 0:
ans[i] += 1
print((max(ans))) | n = int(eval(input()))
k = list(x for x in eval(input()))
print((max(len(set(k[:i])&set(k[i:])) for i in range(0, n)))) | 11 | 3 | 237 | 107 | n = int(eval(input()))
k = list(x for x in eval(input()))
ans = [0] * n
for i in range(n):
l = []
for j in range(0, i):
if l.count(k[j]) == 0:
l.append(k[j])
if k[i:n].count(k[j]) > 0:
ans[i] += 1
print((max(ans)))
| n = int(eval(input()))
k = list(x for x in eval(input()))
print((max(len(set(k[:i]) & set(k[i:])) for i in range(0, n))))
| false | 72.727273 | [
"-ans = [0] * n",
"-for i in range(n):",
"- l = []",
"- for j in range(0, i):",
"- if l.count(k[j]) == 0:",
"- l.append(k[j])",
"- if k[i:n].count(k[j]) > 0:",
"- ans[i] += 1",
"-print((max(ans)))",
"+print((max(len(set(k[:i]) & set(k[i:])) for i i... | false | 0.105973 | 0.044709 | 2.370285 | [
"s776009524",
"s741349252"
] |
u210827208 | p03625 | python | s916247386 | s944472853 | 205 | 85 | 22,436 | 14,252 | Accepted | Accepted | 58.54 | import collections
n=int(eval(input()))
A=list(map(int,input().split()))
X=collections.Counter(A)
ans=1
cnt_1=0
cnt_2=0
for k,v in sorted(list(X.items()),key=lambda x:x[0],reverse=True):
if v>=2:
cnt_1+=1
ans*=k
if cnt_1==2:
break
if v>=4:
... |
n=int(eval(input()))
A=list(map(int,input().split()))
A.sort(reverse=True)
X=[]
t=-1
for i in A:
if t==i:
t=-1
X.append(i)
if len(X)>1:
break
else:
t=i
if len(X)>1:
print((X[0]*X[1]))
else:
print((0)) | 27 | 24 | 474 | 296 | import collections
n = int(eval(input()))
A = list(map(int, input().split()))
X = collections.Counter(A)
ans = 1
cnt_1 = 0
cnt_2 = 0
for k, v in sorted(list(X.items()), key=lambda x: x[0], reverse=True):
if v >= 2:
cnt_1 += 1
ans *= k
if cnt_1 == 2:
break
if v >= 4:
... | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
X = []
t = -1
for i in A:
if t == i:
t = -1
X.append(i)
if len(X) > 1:
break
else:
t = i
if len(X) > 1:
print((X[0] * X[1]))
else:
print((0))
| false | 11.111111 | [
"-import collections",
"-",
"-X = collections.Counter(A)",
"-ans = 1",
"-cnt_1 = 0",
"-cnt_2 = 0",
"-for k, v in sorted(list(X.items()), key=lambda x: x[0], reverse=True):",
"- if v >= 2:",
"- cnt_1 += 1",
"- ans *= k",
"- if cnt_1 == 2:",
"- break",
"- ... | false | 0.033692 | 0.035076 | 0.960547 | [
"s916247386",
"s944472853"
] |
u948524308 | p03229 | python | s643001764 | s858718364 | 413 | 265 | 8,120 | 8,160 | Accepted | Accepted | 35.84 | import collections
N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
A.sort()
ans=[A[0],A[-1]]
ans=collections.deque(ans)
l=1
r=-2
n=[0]*4
ansn=abs(A[0]-A[-1])
for i in range(N-2):
n[0]=abs(A[l]-ans[0])
n[1]=abs(A[l]-ans[-1])
n[2]=abs(A[r]-ans[0])
n[3]=abs(A[r]-ans[-1])... | N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
A.sort()
k1=[]
if N%2==1:
k1.extend([1,1])
k1.extend([-2]*(N//2))
k1.extend([2]*(N-N//2-2))
k1.sort()
sum1=0
sum2=0
for i in range(N):
sum1+=A[i]*k1[i]
sum2+=(-1)*A[i]*k1[-1-i]
print((max(sum1... | 37 | 28 | 665 | 557 | import collections
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
ans = [A[0], A[-1]]
ans = collections.deque(ans)
l = 1
r = -2
n = [0] * 4
ansn = abs(A[0] - A[-1])
for i in range(N - 2):
n[0] = abs(A[l] - ans[0])
n[1] = abs(A[l] - ans[-1])
n[2] = abs(A[r] - ans[0])
n[3] = a... | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
k1 = []
if N % 2 == 1:
k1.extend([1, 1])
k1.extend([-2] * (N // 2))
k1.extend([2] * (N - N // 2 - 2))
k1.sort()
sum1 = 0
sum2 = 0
for i in range(N):
sum1 += A[i] * k1[i]
sum2 += (-1) * A[i] * k1[-1 - i... | false | 24.324324 | [
"-import collections",
"-",
"-ans = [A[0], A[-1]]",
"-ans = collections.deque(ans)",
"-l = 1",
"-r = -2",
"-n = [0] * 4",
"-ansn = abs(A[0] - A[-1])",
"-for i in range(N - 2):",
"- n[0] = abs(A[l] - ans[0])",
"- n[1] = abs(A[l] - ans[-1])",
"- n[2] = abs(A[r] - ans[0])",
"- n[3] ... | false | 0.042005 | 0.045476 | 0.923679 | [
"s643001764",
"s858718364"
] |
u572122511 | p02641 | python | s176302950 | s823728634 | 24 | 20 | 9,196 | 9,140 | Accepted | Accepted | 16.67 | X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
min_ = 0
while True:
front = X - min_
back = X + min_
if front in P and back in P:
min_ += 1
else:
break
front = X - min_
back = X + min_
if front not in P:
print(front)
else:
print(back... | X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
min_ = 100
for i in range(0, 102):
cur = i
if cur in P:
continue
diff = abs(X - cur)
if diff < min_:
min_ = diff
front = X - min_
back = X + min_
if front not in P:
print(front)
else:
p... | 18 | 18 | 321 | 330 | X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
min_ = 0
while True:
front = X - min_
back = X + min_
if front in P and back in P:
min_ += 1
else:
break
front = X - min_
back = X + min_
if front not in P:
print(front)
else:
print(back)
| X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
min_ = 100
for i in range(0, 102):
cur = i
if cur in P:
continue
diff = abs(X - cur)
if diff < min_:
min_ = diff
front = X - min_
back = X + min_
if front not in P:
print(front)
else:
print(back)
| false | 0 | [
"-min_ = 0",
"-while True:",
"- front = X - min_",
"- back = X + min_",
"- if front in P and back in P:",
"- min_ += 1",
"- else:",
"- break",
"+min_ = 100",
"+for i in range(0, 102):",
"+ cur = i",
"+ if cur in P:",
"+ continue",
"+ diff = abs(X -... | false | 0.036571 | 0.076295 | 0.479337 | [
"s176302950",
"s823728634"
] |
u633068244 | p00768 | python | s067775122 | s799594301 | 60 | 50 | 4,332 | 4,332 | Accepted | Accepted | 16.67 | while 1:
M,T,P,R = list(map(int,input().split()))
if M == 0: break
S = [[-1]*P for i in range(T)]
PN = [[0]*P for i in range(T)]
for i in range(R):
m,t,p,j = list(map(int,input().split()))
if j == 0:
S[t-1][p-1] = m + PN[t-1][p-1]
else:
PN[t-1][p-1] += 20
A = [[t+1,P-S[t].count(-1),sum(S[t]... | while 1:
M,T,P,R = list(map(int,input().split()))
if M == 0: break
S = [[-1]*P for i in range(T)]
PN = [[0]*P for i in range(T)]
for i in range(R):
m,t,p,j = list(map(int,input().split()))
if j == 0:
S[t-1][p-1] = m + PN[t-1][p-1]
else:
PN[t-1][p-1] += 20
A = [[t+1,P-S[t].count(-1),sum(S[t]... | 20 | 20 | 621 | 580 | while 1:
M, T, P, R = list(map(int, input().split()))
if M == 0:
break
S = [[-1] * P for i in range(T)]
PN = [[0] * P for i in range(T)]
for i in range(R):
m, t, p, j = list(map(int, input().split()))
if j == 0:
S[t - 1][p - 1] = m + PN[t - 1][p - 1]
else:... | while 1:
M, T, P, R = list(map(int, input().split()))
if M == 0:
break
S = [[-1] * P for i in range(T)]
PN = [[0] * P for i in range(T)]
for i in range(R):
m, t, p, j = list(map(int, input().split()))
if j == 0:
S[t - 1][p - 1] = m + PN[t - 1][p - 1]
else:... | false | 0 | [
"- A = sorted(",
"- sorted(sorted(A, reverse=True), key=lambda x: x[2]),",
"- key=lambda x: x[1],",
"- reverse=True,",
"- )",
"+ A = sorted(sorted(A[::-1], key=lambda x: x[2]), key=lambda x: x[1], reverse=True)",
"- if A[i - 1][1] == A[i][1] and A[i - 1][2] == A[i][2... | false | 0.036254 | 0.035189 | 1.030267 | [
"s067775122",
"s799594301"
] |
u600402037 | p03252 | python | s231211733 | s781679618 | 72 | 42 | 3,632 | 4,136 | Accepted | Accepted | 41.67 | S, T = eval(input()), eval(input())
convert = dict()
answer = 'Yes'
for s, t in zip(S, T):
if s in convert and convert[s] != t:
answer = 'No'
break
else:
convert[s] = t
after = list(convert.values())
if len(after) != len(set(after)):
answer = 'No'
print(answer) | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
T = sr()
cnt_S = Counter(S)
cnt_T = Counter(T)
num_S = sorted(list(cnt_S.values()))
num_T = sorted(list(cnt_T.values()))
bl = ... | 17 | 17 | 299 | 365 | S, T = eval(input()), eval(input())
convert = dict()
answer = "Yes"
for s, t in zip(S, T):
if s in convert and convert[s] != t:
answer = "No"
break
else:
convert[s] = t
after = list(convert.values())
if len(after) != len(set(after)):
answer = "No"
print(answer)
| # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
T = sr()
cnt_S = Counter(S)
cnt_T = Counter(T)
num_S = sorted(list(cnt_S.values()))
num_T = sorted(list(cnt_T.values()))
bl = num_S == num_T
pr... | false | 0 | [
"-S, T = eval(input()), eval(input())",
"-convert = dict()",
"-answer = \"Yes\"",
"-for s, t in zip(S, T):",
"- if s in convert and convert[s] != t:",
"- answer = \"No\"",
"- break",
"- else:",
"- convert[s] = t",
"-after = list(convert.values())",
"-if len(after) != l... | false | 0.047188 | 0.035292 | 1.337067 | [
"s231211733",
"s781679618"
] |
u580093517 | p03315 | python | s303633968 | s779241308 | 18 | 16 | 2,940 | 2,940 | Accepted | Accepted | 11.11 | s = str(eval(input()))
s = list(s)
cnt = 0
for i in s:
if i == "+":
cnt += 1
else:
cnt -= 1
print(cnt) | s = eval(input())
print((s.count("+")-s.count("-"))) | 9 | 2 | 128 | 45 | s = str(eval(input()))
s = list(s)
cnt = 0
for i in s:
if i == "+":
cnt += 1
else:
cnt -= 1
print(cnt)
| s = eval(input())
print((s.count("+") - s.count("-")))
| false | 77.777778 | [
"-s = str(eval(input()))",
"-s = list(s)",
"-cnt = 0",
"-for i in s:",
"- if i == \"+\":",
"- cnt += 1",
"- else:",
"- cnt -= 1",
"-print(cnt)",
"+s = eval(input())",
"+print((s.count(\"+\") - s.count(\"-\")))"
] | false | 0.038942 | 0.04203 | 0.926532 | [
"s303633968",
"s779241308"
] |
u368796742 | p02843 | python | s442848224 | s023937063 | 1,294 | 17 | 3,060 | 2,940 | Accepted | Accepted | 98.69 | x = int(eval(input()))
n = x//100 + 1
for i in range(n):
for j in range(n):
for k in range(n):
for l in range(n):
for m in range(n):
c = 100*i + 101*j + 102*k + 103*l + 104*m
if x >= c:
t = x-c
... | x = int(eval(input()))
n = x//100
if 100*n <= x and x <= 105*n:
print((1))
else:
print((0)) | 17 | 7 | 434 | 92 | x = int(eval(input()))
n = x // 100 + 1
for i in range(n):
for j in range(n):
for k in range(n):
for l in range(n):
for m in range(n):
c = 100 * i + 101 * j + 102 * k + 103 * l + 104 * m
if x >= c:
t = x - c
... | x = int(eval(input()))
n = x // 100
if 100 * n <= x and x <= 105 * n:
print((1))
else:
print((0))
| false | 58.823529 | [
"-n = x // 100 + 1",
"-for i in range(n):",
"- for j in range(n):",
"- for k in range(n):",
"- for l in range(n):",
"- for m in range(n):",
"- c = 100 * i + 101 * j + 102 * k + 103 * l + 104 * m",
"- if x >= c:",
"- ... | false | 0.042321 | 0.04154 | 1.018806 | [
"s442848224",
"s023937063"
] |
u021916304 | p02623 | python | s408420377 | s519200482 | 1,434 | 362 | 61,920 | 68,372 | Accepted | Accepted | 74.76 | def ii():return int(eval(input()))
def iim():return list(map(int,input().split()))
def iil():return list(map(int,input().split()))
import numpy as np
def binarySearch(lis,key):
ng = -1
ok = len(lis)
while abs(ok-ng) > 1:
mid = (ok+ng)//2
if isOk(lis,mid,key): ok = mid
e... | def ii():return int(eval(input()))
def iim():return list(map(int,input().split()))
def iil():return list(map(int,input().split()))
import numpy as np
n,m,k = iim()
a = iil()
cuma = [0]
for i in a:
cuma.append(cuma[-1]+i)
b = iil()
cumb = [0]
for i in b:
cumb.append(cumb[-1]+i)
best = m
ans =... | 35 | 26 | 701 | 464 | def ii():
return int(eval(input()))
def iim():
return list(map(int, input().split()))
def iil():
return list(map(int, input().split()))
import numpy as np
def binarySearch(lis, key):
ng = -1
ok = len(lis)
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if isOk(lis, mid, key)... | def ii():
return int(eval(input()))
def iim():
return list(map(int, input().split()))
def iil():
return list(map(int, input().split()))
import numpy as np
n, m, k = iim()
a = iil()
cuma = [0]
for i in a:
cuma.append(cuma[-1] + i)
b = iil()
cumb = [0]
for i in b:
cumb.append(cumb[-1] + i)
best... | false | 25.714286 | [
"-",
"-def binarySearch(lis, key):",
"- ng = -1",
"- ok = len(lis)",
"- while abs(ok - ng) > 1:",
"- mid = (ok + ng) // 2",
"- if isOk(lis, mid, key):",
"- ok = mid",
"- else:",
"- ng = mid",
"- return ok",
"-",
"-",
"-def isOk(lis, in... | false | 0.388635 | 0.047365 | 8.205073 | [
"s408420377",
"s519200482"
] |
u315078622 | p03064 | python | s870860785 | s139184064 | 1,185 | 692 | 43,772 | 43,100 | Accepted | Accepted | 41.6 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
sum_A = sum(A)
MOD = 998244353
dp1 = [0] * (sum_A + 1)
dp2 = [0] * (sum_A + 1)
dp1[0] = dp2[0] = 1
for a in A:
for i in reversed(list(range(sum_A + 1))):
if i - a >= 0:
# R に塗れる場合
dp1[i] = (dp1[i - a... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
sum_A = sum(A)
MOD = 998244353
dp1 = [0] * (sum_A + 1)
dp2 = [0] * (sum_A + 1)
dp1[0] = dp2[0] = 1
tmp_sum = 0
for a in A:
tmp_sum += a
for i in reversed(list(range(tmp_sum + 1))):
if i - a >= 0:
# R に塗れる場合
... | 29 | 30 | 663 | 694 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
sum_A = sum(A)
MOD = 998244353
dp1 = [0] * (sum_A + 1)
dp2 = [0] * (sum_A + 1)
dp1[0] = dp2[0] = 1
for a in A:
for i in reversed(list(range(sum_A + 1))):
if i - a >= 0:
# R に塗れる場合
dp1[i] = (dp1[i - a] + dp1[i] * 2) % M... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
sum_A = sum(A)
MOD = 998244353
dp1 = [0] * (sum_A + 1)
dp2 = [0] * (sum_A + 1)
dp1[0] = dp2[0] = 1
tmp_sum = 0
for a in A:
tmp_sum += a
for i in reversed(list(range(tmp_sum + 1))):
if i - a >= 0:
# R に塗れる場合
dp1[i] ... | false | 3.333333 | [
"+tmp_sum = 0",
"- for i in reversed(list(range(sum_A + 1))):",
"+ tmp_sum += a",
"+ for i in reversed(list(range(tmp_sum + 1))):"
] | false | 0.038365 | 0.044771 | 0.856914 | [
"s870860785",
"s139184064"
] |
u285891772 | p03640 | python | s929963680 | s582479461 | 117 | 52 | 27,380 | 10,632 | Accepted | Accepted | 55.56 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 41 | 49 | 1,187 | 1,302 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 16.326531 | [
"-import numpy as np",
"+# import numpy as np",
"-A = []",
"-for i in range(N):",
"- A += [i + 1] * a[i]",
"-ans = []",
"+cnt = 0",
"+ans = [[-1] * W for _ in range(H)]",
"+tmp = a.pop(0)",
"+color = 1",
"+flg = 0",
"- ans.append(A[i * W : (i + 1) * W])",
"-for i in range(H):",
"- ... | false | 0.036886 | 0.067928 | 0.543015 | [
"s929963680",
"s582479461"
] |
u680851063 | p03013 | python | s742934435 | s358824176 | 465 | 155 | 460,020 | 18,336 | Accepted | Accepted | 66.67 | n, m = list(map(int, input().split()))
a = set(map(int, [eval(input()) for _ in range(m)]))
dp = [0] * (n+1)
# 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り)
dp[:2] = 1, 1 if 1 not in a else 0
for i in range(2, n+1):
if i not in a:
dp[i] = (dp[i-1] + dp[i-2])
print((dp[-1] % (10**9+7))... | n, m = list(map(int, input().split()))
a = set(map(int, [eval(input()) for _ in range(m)]))
dp = [0] * (n+1)
# 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り)
dp[:2] = 1, 1 if 1 not in a else 0
for i in range(2, n+1):
if i not in a:
dp[i] = ((dp[i-1] + dp[i-2]) % (10**9+7))
print((dp[-1... | 12 | 12 | 308 | 310 | n, m = list(map(int, input().split()))
a = set(map(int, [eval(input()) for _ in range(m)]))
dp = [0] * (n + 1)
# 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り)
dp[:2] = 1, 1 if 1 not in a else 0
for i in range(2, n + 1):
if i not in a:
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[-1] % (10**9 + 7)))
| n, m = list(map(int, input().split()))
a = set(map(int, [eval(input()) for _ in range(m)]))
dp = [0] * (n + 1)
# 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り)
dp[:2] = 1, 1 if 1 not in a else 0
for i in range(2, n + 1):
if i not in a:
dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7)
print((dp[-1]))
| false | 0 | [
"- dp[i] = dp[i - 1] + dp[i - 2]",
"-print((dp[-1] % (10**9 + 7)))",
"+ dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7)",
"+print((dp[-1]))"
] | false | 0.043534 | 0.037903 | 1.148573 | [
"s742934435",
"s358824176"
] |
u935558307 | p03608 | python | s419950621 | s184675463 | 530 | 317 | 68,952 | 73,360 | Accepted | Accepted | 40.19 | N,M,r = list(map(int,input().split()))
R = list(map(int,input().split()))
#dp[i][j][k] -> 町iまで経由地点として使える。j,kの最短移動距離
dp = [[float("INF")]*(N+1) for _ in range(N+1)]
for _ in range(M):
a,b,c = list(map(int,input().split()))
dp[a][b] = c
dp[b][a] = c
for i in range(N+1):
dp[i][i] = 0
for i in... | N,M,R = list(map(int,input().split()))
R = list(map(int,input().split()))
dp = [[float("INF")]*(N+1) for _ in range(N+1)]
for i in range(N+1):
dp[i][i] = 0
for _ in range(M):
a,b,c = list(map(int,input().split()))
dp[a][b] = c
dp[b][a] = c
for i in range(1,N+1):
for j in range(1,N+1):
... | 25 | 31 | 650 | 706 | N, M, r = list(map(int, input().split()))
R = list(map(int, input().split()))
# dp[i][j][k] -> 町iまで経由地点として使える。j,kの最短移動距離
dp = [[float("INF")] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
dp[a][b] = c
dp[b][a] = c
for i in range(N + 1):
dp[i][i] = 0
for i ... | N, M, R = list(map(int, input().split()))
R = list(map(int, input().split()))
dp = [[float("INF")] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
dp[i][i] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
dp[a][b] = c
dp[b][a] = c
for i in range(1, N + 1):
for j in range(1, N... | false | 19.354839 | [
"-N, M, r = list(map(int, input().split()))",
"+N, M, R = list(map(int, input().split()))",
"-# dp[i][j][k] -> 町iまで経由地点として使える。j,kの最短移動距離",
"+for i in range(N + 1):",
"+ dp[i][i] = 0",
"-for i in range(N + 1):",
"- dp[i][i] = 0",
"- for k in range(N + 1):",
"+ for k in range(1, N ... | false | 0.054695 | 0.102337 | 0.534461 | [
"s419950621",
"s184675463"
] |
u540761833 | p02755 | python | s367468375 | s387819271 | 180 | 17 | 39,408 | 3,060 | Accepted | Accepted | 90.56 | A,B = list(map(int,input().split()))
ans = -1
for i in range(1,2000):
if int(0.08*i)==A and int(0.1*i) == B:
ans = i
break
print(ans) | import math
A,B = list(map(int,input().split()))
Xa = math.ceil(A/0.08)
xa = int((A+1)/0.08)
Xb = math.ceil(B/0.1)
xb = int((B+1)/0.1)
ans = -1
for i in range(Xa,xa):
if Xb <= i < xb:
ans = i
break
print(ans)
| 7 | 12 | 153 | 234 | A, B = list(map(int, input().split()))
ans = -1
for i in range(1, 2000):
if int(0.08 * i) == A and int(0.1 * i) == B:
ans = i
break
print(ans)
| import math
A, B = list(map(int, input().split()))
Xa = math.ceil(A / 0.08)
xa = int((A + 1) / 0.08)
Xb = math.ceil(B / 0.1)
xb = int((B + 1) / 0.1)
ans = -1
for i in range(Xa, xa):
if Xb <= i < xb:
ans = i
break
print(ans)
| false | 41.666667 | [
"+import math",
"+",
"+Xa = math.ceil(A / 0.08)",
"+xa = int((A + 1) / 0.08)",
"+Xb = math.ceil(B / 0.1)",
"+xb = int((B + 1) / 0.1)",
"-for i in range(1, 2000):",
"- if int(0.08 * i) == A and int(0.1 * i) == B:",
"+for i in range(Xa, xa):",
"+ if Xb <= i < xb:"
] | false | 0.048062 | 0.081471 | 0.589936 | [
"s367468375",
"s387819271"
] |
u556589653 | p04044 | python | s567036525 | s163210481 | 183 | 26 | 38,256 | 9,164 | Accepted | Accepted | 85.79 | N,L = list(map(int,input().split()))
ls = []
for i in range(N):
ls.append(eval(input()))
ls.sort()
ans = ""
for i in range(N):
ans += ls[i]
print(ans) | N,L = list(map(int,input().split()))
ls = []
for i in range(N):
ls.append(eval(input()))
ls.sort()
print(("".join(ls))) | 9 | 6 | 154 | 114 | N, L = list(map(int, input().split()))
ls = []
for i in range(N):
ls.append(eval(input()))
ls.sort()
ans = ""
for i in range(N):
ans += ls[i]
print(ans)
| N, L = list(map(int, input().split()))
ls = []
for i in range(N):
ls.append(eval(input()))
ls.sort()
print(("".join(ls)))
| false | 33.333333 | [
"-ans = \"\"",
"-for i in range(N):",
"- ans += ls[i]",
"-print(ans)",
"+print((\"\".join(ls)))"
] | false | 0.038149 | 0.042217 | 0.903657 | [
"s567036525",
"s163210481"
] |
u887207211 | p03251 | python | s737268736 | s861367228 | 22 | 20 | 3,316 | 3,060 | Accepted | Accepted | 9.09 | N, M, X, Y = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
max_x = max(x)
min_y = min(y)
for i in range(X+1, Y+1):
if(max_x < i <= min_y):
print("No War")
break
else:
print("War") | N, M, X, Y = list(map(int,input().split()))
x = sorted(list(map(int,input().split())))
y = sorted(list(map(int,input().split())))
for i in range(X+1, Y+1):
if(x[-1] < i <= y[0]):
print("No War")
break
else:
print("War") | 12 | 10 | 252 | 235 | N, M, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
min_y = min(y)
for i in range(X + 1, Y + 1):
if max_x < i <= min_y:
print("No War")
break
else:
print("War")
| N, M, X, Y = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))
for i in range(X + 1, Y + 1):
if x[-1] < i <= y[0]:
print("No War")
break
else:
print("War")
| false | 16.666667 | [
"-x = list(map(int, input().split()))",
"-y = list(map(int, input().split()))",
"-max_x = max(x)",
"-min_y = min(y)",
"+x = sorted(list(map(int, input().split())))",
"+y = sorted(list(map(int, input().split())))",
"- if max_x < i <= min_y:",
"+ if x[-1] < i <= y[0]:"
] | false | 0.046825 | 0.063531 | 0.737041 | [
"s737268736",
"s861367228"
] |
u729133443 | p02785 | python | s377920788 | s715657978 | 287 | 147 | 102,024 | 25,180 | Accepted | Accepted | 48.78 | n,k,*h=list(map(int,open(0).read().split()))
h=sorted(h)[::-1]
for i in range(min(k,n)):h[i]=0
print((sum(h))) | n,k,*h=list(map(int,open(0).read().split()))
print((sum(sorted(h)[:n-min(n,k)]))) | 4 | 2 | 105 | 74 | n, k, *h = list(map(int, open(0).read().split()))
h = sorted(h)[::-1]
for i in range(min(k, n)):
h[i] = 0
print((sum(h)))
| n, k, *h = list(map(int, open(0).read().split()))
print((sum(sorted(h)[: n - min(n, k)])))
| false | 50 | [
"-h = sorted(h)[::-1]",
"-for i in range(min(k, n)):",
"- h[i] = 0",
"-print((sum(h)))",
"+print((sum(sorted(h)[: n - min(n, k)])))"
] | false | 0.052854 | 0.045679 | 1.157058 | [
"s377920788",
"s715657978"
] |
u163783894 | p03078 | python | s669402486 | s655962522 | 89 | 31 | 9,532 | 4,772 | Accepted | Accepted | 65.17 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 10 + 7
def main():
X, Y, Z, K = list(map(int, readline().split()))
A = sorted(list(map(int, readline().split())), reverse=True)
B =... | import sys
import heapq
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 10 + 7
def main():
X, Y, Z, K = list(map(int, readline().split()))
A = sorted(list(map(int, readline().split())), reverse=Tr... | 60 | 87 | 1,366 | 2,210 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
INF = 10**10 + 7
def main():
X, Y, Z, K = list(map(int, readline().split()))
A = sorted(list(map(int, readline().split())), reverse=True)
B = sorted(list(map... | import sys
import heapq
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
INF = 10**10 + 7
def main():
X, Y, Z, K = list(map(int, readline().split()))
A = sorted(list(map(int, readline().split())), reverse=True)
B = so... | false | 31.034483 | [
"+import heapq",
"- ans = solve2(X, Y, Z, K, A, B, C)",
"+ ans = solve3(X, Y, Z, K, A, B, C)",
"+",
"+",
"+def solve3(X, Y, Z, K, A, B, C):",
"+ init_v = -(A[0] + B[0] + C[0])",
"+ q = [(init_v, 0, 0, 0)]",
"+ heapq.heapify(q)",
"+ search = set()",
"+ ans = []",
"+ for ... | false | 0.03606 | 0.163352 | 0.220749 | [
"s669402486",
"s655962522"
] |
u392319141 | p03831 | python | s051171109 | s774115918 | 91 | 76 | 14,224 | 14,224 | Accepted | Accepted | 16.48 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
if (X[i + 1] - X[i]) * A > B:
ans += B
else:
ans += (X[i + 1] - X[i]) * A
print(ans) | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
D = [r - l for l, r in zip(X, X[1:])]
ans = sum(min(A * d, B) for d in D)
print(ans)
| 11 | 6 | 223 | 163 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
if (X[i + 1] - X[i]) * A > B:
ans += B
else:
ans += (X[i + 1] - X[i]) * A
print(ans)
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
D = [r - l for l, r in zip(X, X[1:])]
ans = sum(min(A * d, B) for d in D)
print(ans)
| false | 45.454545 | [
"-ans = 0",
"-for i in range(N - 1):",
"- if (X[i + 1] - X[i]) * A > B:",
"- ans += B",
"- else:",
"- ans += (X[i + 1] - X[i]) * A",
"+D = [r - l for l, r in zip(X, X[1:])]",
"+ans = sum(min(A * d, B) for d in D)"
] | false | 0.0438 | 0.046349 | 0.944997 | [
"s051171109",
"s774115918"
] |
u573754721 | p02756 | python | s245492266 | s225335014 | 824 | 407 | 74,456 | 8,436 | Accepted | Accepted | 50.61 | from collections import deque
S=deque(eval(input()))
q=int(eval(input()))
rev=False
for _ in range(q):
inp=eval(input())
if inp=="1":
rev= not rev
else:
t,f,c=inp.split()
if (rev and f=="1") or (not rev and f=="2"):
S.append(c)
else:
S.appendleft(c)
if re... | from collections import deque
que=deque(eval(input()))
q=int(eval(input()))
rev=False
for i in range(q):
s=eval(input())
if s=="1":
rev= not rev
else:
t,f,c=s.split()
if (f=='1' and rev==False) or (f=='2' and rev):
que.appendleft(c)
else:
... | 17 | 18 | 339 | 367 | from collections import deque
S = deque(eval(input()))
q = int(eval(input()))
rev = False
for _ in range(q):
inp = eval(input())
if inp == "1":
rev = not rev
else:
t, f, c = inp.split()
if (rev and f == "1") or (not rev and f == "2"):
S.append(c)
else:
... | from collections import deque
que = deque(eval(input()))
q = int(eval(input()))
rev = False
for i in range(q):
s = eval(input())
if s == "1":
rev = not rev
else:
t, f, c = s.split()
if (f == "1" and rev == False) or (f == "2" and rev):
que.appendleft(c)
else:
... | false | 5.555556 | [
"-S = deque(eval(input()))",
"+que = deque(eval(input()))",
"-for _ in range(q):",
"- inp = eval(input())",
"- if inp == \"1\":",
"+for i in range(q):",
"+ s = eval(input())",
"+ if s == \"1\":",
"- t, f, c = inp.split()",
"- if (rev and f == \"1\") or (not rev and f == \... | false | 0.054892 | 0.036359 | 1.509693 | [
"s245492266",
"s225335014"
] |
u644907318 | p02724 | python | s110944942 | s549230300 | 184 | 64 | 38,384 | 61,696 | Accepted | Accepted | 65.22 | x = int(eval(input()))
n = x//500
x -= 500*n
m = x//5
print((1000*n+5*m)) | X = int(eval(input()))
n = X//500
m = X%500
n1 = m//5
print((n*1000+n1*5)) | 5 | 5 | 69 | 70 | x = int(eval(input()))
n = x // 500
x -= 500 * n
m = x // 5
print((1000 * n + 5 * m))
| X = int(eval(input()))
n = X // 500
m = X % 500
n1 = m // 5
print((n * 1000 + n1 * 5))
| false | 0 | [
"-x = int(eval(input()))",
"-n = x // 500",
"-x -= 500 * n",
"-m = x // 5",
"-print((1000 * n + 5 * m))",
"+X = int(eval(input()))",
"+n = X // 500",
"+m = X % 500",
"+n1 = m // 5",
"+print((n * 1000 + n1 * 5))"
] | false | 0.041513 | 0.046824 | 0.886588 | [
"s110944942",
"s549230300"
] |
u427344224 | p03231 | python | s067554148 | s674696434 | 38 | 19 | 5,304 | 3,444 | Accepted | Accepted | 50 | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
# def gcd(a, b):
# if a < b:
# return gcd(b, a)
# else:
# return a if b == 0 else gcd(b, a % b)
import fractions
def lcm(a, b):
return a * b // fractions.gcd(b, a % b)
L = lcm(N, M)
f = False
s_... | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(b, a % b)
L = lcm(N, M)
f = False
s_step = L // N
t_step = L // M
sL = lcm(s_step, t_step)
s = 0
t = 0
for i in range(0, ... | 49 | 46 | 818 | 726 | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
# def gcd(a, b):
# if a < b:
# return gcd(b, a)
# else:
# return a if b == 0 else gcd(b, a % b)
import fractions
def lcm(a, b):
return a * b // fractions.gcd(b, a % b)
L = lcm(N, M)
f = False
s_step = L // N
t_ste... | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(b, a % b)
L = lcm(N, M)
f = False
s_step = L // N
t_step = L // M
sL = lcm(s_step, t_step)
s = 0
t = 0
for i in range(0, L, sL):
if i == 0:... | false | 6.122449 | [
"-# def gcd(a, b):",
"-# if a < b:",
"-# return gcd(b, a)",
"-# else:",
"-# return a if b == 0 else gcd(b, a % b)",
"-import fractions",
"+",
"+",
"+def gcd(a, b):",
"+ return a if b == 0 else gcd(b, a % b)",
"- return a * b // fractions.gcd(b, a % b)",
"+ retu... | false | 0.035319 | 0.036527 | 0.966929 | [
"s067554148",
"s674696434"
] |
u417365712 | p02706 | python | s279063045 | s396334921 | 23 | 20 | 10,040 | 9,884 | Accepted | Accepted | 13.04 | n, m, *A = list(map(int, open(0).read().split()))
ans = n-sum(A)
print((ans if ans >= 0 else -1)) | n, m, *A = list(map(int, open(0).read().split()))
print((max(n-sum(A), -1))) | 3 | 2 | 91 | 69 | n, m, *A = list(map(int, open(0).read().split()))
ans = n - sum(A)
print((ans if ans >= 0 else -1))
| n, m, *A = list(map(int, open(0).read().split()))
print((max(n - sum(A), -1)))
| false | 33.333333 | [
"-ans = n - sum(A)",
"-print((ans if ans >= 0 else -1))",
"+print((max(n - sum(A), -1)))"
] | false | 0.036078 | 0.035402 | 1.019099 | [
"s279063045",
"s396334921"
] |
u297574184 | p03394 | python | s174550973 | s977419002 | 48 | 33 | 4,572 | 5,472 | Accepted | Accepted | 31.25 | N = int(eval(input()))
if N == 3:
print('2\n3\n25')
exit()
M = (N - 1) // 8
m2s = []
m3s = []
m6s = []
for i in range(1, (M + 1) * 12 + 1):
if i % 6 == 0:
m6s += [i]
elif i % 3 == 0:
m3s += [i]
elif i % 2 == 0:
m2s += [i]
im2 = 4 * M + [0, 2, 2, 2, 2, 4, ... | N = int(eval(input()))
if N == 3:
ans = {2, 3, 25}
elif N == 4:
ans = {2, 3, 4, 9}
elif N == 5:
ans = {2, 3, 4, 6, 9}
else:
ans = set()
sumAns = 0
num = 0
# 2の倍数もしくは3の倍数を、小さい順に追加する
for i in range(1, 30001):
if i % 2 == 0 or i % 3 == 0:
ans.add(i)
... | 24 | 33 | 500 | 743 | N = int(eval(input()))
if N == 3:
print("2\n3\n25")
exit()
M = (N - 1) // 8
m2s = []
m3s = []
m6s = []
for i in range(1, (M + 1) * 12 + 1):
if i % 6 == 0:
m6s += [i]
elif i % 3 == 0:
m3s += [i]
elif i % 2 == 0:
m2s += [i]
im2 = 4 * M + [0, 2, 2, 2, 2, 4, 4, 4][(N - 1) % 8]
im... | N = int(eval(input()))
if N == 3:
ans = {2, 3, 25}
elif N == 4:
ans = {2, 3, 4, 9}
elif N == 5:
ans = {2, 3, 4, 6, 9}
else:
ans = set()
sumAns = 0
num = 0
# 2の倍数もしくは3の倍数を、小さい順に追加する
for i in range(1, 30001):
if i % 2 == 0 or i % 3 == 0:
ans.add(i)
sumAns +=... | false | 27.272727 | [
"- print(\"2\\n3\\n25\")",
"- exit()",
"-M = (N - 1) // 8",
"-m2s = []",
"-m3s = []",
"-m6s = []",
"-for i in range(1, (M + 1) * 12 + 1):",
"- if i % 6 == 0:",
"- m6s += [i]",
"- elif i % 3 == 0:",
"- m3s += [i]",
"- elif i % 2 == 0:",
"- m2s += [i]",
"-... | false | 0.044602 | 0.034695 | 1.28554 | [
"s174550973",
"s977419002"
] |
u864197622 | p02734 | python | s011935837 | s214420160 | 614 | 245 | 3,640 | 3,512 | Accepted | Accepted | 60.1 | def setM():
k = K2 // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m, ~m, (1 << K2 + k) % P))
k //= 2
def modp(n):
for k, m, tm, a in M:
n = (n & tm) + ((n & m) >> K2 + k) * a
return n
K = 64
K2 = K // 2
P = 998244353
mm = ... | def setM():
k = K2 // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m, ~m, (1 << K2 + k) % P))
k //= 2
break
def modp(n):
for k, m, tm, a in M:
n = (n & tm) + ((n & m) >> K2 + k) * a
return n
K = 64
K2 = K // 2
P = 9... | 31 | 32 | 589 | 604 | def setM():
k = K2 // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m, ~m, (1 << K2 + k) % P))
k //= 2
def modp(n):
for k, m, tm, a in M:
n = (n & tm) + ((n & m) >> K2 + k) * a
return n
K = 64
K2 = K // 2
P = 998244353
mm = (1 << K * 300... | def setM():
k = K2 // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m, ~m, (1 << K2 + k) % P))
k //= 2
break
def modp(n):
for k, m, tm, a in M:
n = (n & tm) + ((n & m) >> K2 + k) * a
return n
K = 64
K2 = K // 2
P = 998244353
mm =... | false | 3.125 | [
"+ break"
] | false | 0.040658 | 0.037011 | 1.098547 | [
"s011935837",
"s214420160"
] |
u238987462 | p02791 | python | s566400959 | s208463913 | 113 | 98 | 24,872 | 17,940 | Accepted | Accepted | 13.27 | N = int(eval(input()))
P = tuple(map(int, input().split()))
pmin = P[0]
m = 1
for i in range(1, N, 1):
if P[i] < pmin:
pmin = P[i]
m += 1
print(m) | N = int(eval(input()))
M = 0
for P in map(int, input().split()):
if P <= N:
N = P
M += 1
print(M) | 13 | 7 | 176 | 117 | N = int(eval(input()))
P = tuple(map(int, input().split()))
pmin = P[0]
m = 1
for i in range(1, N, 1):
if P[i] < pmin:
pmin = P[i]
m += 1
print(m)
| N = int(eval(input()))
M = 0
for P in map(int, input().split()):
if P <= N:
N = P
M += 1
print(M)
| false | 46.153846 | [
"-P = tuple(map(int, input().split()))",
"-pmin = P[0]",
"-m = 1",
"-for i in range(1, N, 1):",
"- if P[i] < pmin:",
"- pmin = P[i]",
"- m += 1",
"-print(m)",
"+M = 0",
"+for P in map(int, input().split()):",
"+ if P <= N:",
"+ N = P",
"+ M += 1",
"+print(... | false | 0.035652 | 0.036868 | 0.967011 | [
"s566400959",
"s208463913"
] |
u941438707 | p03711 | python | s304240566 | s075673494 | 164 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.02 | a,b=input().split()
lis=(("1","3","5","7","8","10","12"),("4","6","9","11"),("2"))
for gn, row in enumerate(lis):
try:
A=(gn, row.index(a))
break
except ValueError:
pass
for gn, row in enumerate(lis):
try:
B=(gn, row.index(b))
break
except ValueError:
... | x,y = list(map(int,input().split(" ")))
a=(1,3,5,7,8,10,12)
b=(4,6,9,11)
if (x in a and y in a) or (x in b and y in b):
print("Yes")
else:
print("No") | 15 | 7 | 379 | 158 | a, b = input().split()
lis = (("1", "3", "5", "7", "8", "10", "12"), ("4", "6", "9", "11"), ("2"))
for gn, row in enumerate(lis):
try:
A = (gn, row.index(a))
break
except ValueError:
pass
for gn, row in enumerate(lis):
try:
B = (gn, row.index(b))
break
except Valu... | x, y = list(map(int, input().split(" ")))
a = (1, 3, 5, 7, 8, 10, 12)
b = (4, 6, 9, 11)
if (x in a and y in a) or (x in b and y in b):
print("Yes")
else:
print("No")
| false | 53.333333 | [
"-a, b = input().split()",
"-lis = ((\"1\", \"3\", \"5\", \"7\", \"8\", \"10\", \"12\"), (\"4\", \"6\", \"9\", \"11\"), (\"2\"))",
"-for gn, row in enumerate(lis):",
"- try:",
"- A = (gn, row.index(a))",
"- break",
"- except ValueError:",
"- pass",
"-for gn, row in enumera... | false | 0.052501 | 0.035732 | 1.469282 | [
"s304240566",
"s075673494"
] |
u404676457 | p03253 | python | s268305967 | s779843085 | 29 | 25 | 3,064 | 3,064 | Accepted | Accepted | 13.79 | import math
(n, m) =list(map(int, input().split()))
sqm = math.sqrt(m)
map = {}
i = 2
y = m
while m != 1 and sqm >= i:
if m % i == 0 :
m = m / i
if i in map:
map[i] += 1
else:
map[i] = 1
else:
i += 1
if m > 1:
map[m] = 1
sum = 1
fo... | import math
(n, m) =list(map(int, input().split()))
factor = []
for i in range(2 , int(math.sqrt(m)) + 1):
count = 0
while m % i == 0:
m = m / i
count += 1
if count != 0:
factor.append(count)
if m > 1:
factor.append(1)
sum = 1
for i in range(len(factor)):
tmpn ... | 31 | 21 | 543 | 486 | import math
(n, m) = list(map(int, input().split()))
sqm = math.sqrt(m)
map = {}
i = 2
y = m
while m != 1 and sqm >= i:
if m % i == 0:
m = m / i
if i in map:
map[i] += 1
else:
map[i] = 1
else:
i += 1
if m > 1:
map[m] = 1
sum = 1
for i in map:
tmpn... | import math
(n, m) = list(map(int, input().split()))
factor = []
for i in range(2, int(math.sqrt(m)) + 1):
count = 0
while m % i == 0:
m = m / i
count += 1
if count != 0:
factor.append(count)
if m > 1:
factor.append(1)
sum = 1
for i in range(len(factor)):
tmpn = n + factor[i... | false | 32.258065 | [
"-sqm = math.sqrt(m)",
"-map = {}",
"-i = 2",
"-y = m",
"-while m != 1 and sqm >= i:",
"- if m % i == 0:",
"+factor = []",
"+for i in range(2, int(math.sqrt(m)) + 1):",
"+ count = 0",
"+ while m % i == 0:",
"- if i in map:",
"- map[i] += 1",
"- else:",
"- ... | false | 0.04334 | 0.03581 | 1.210292 | [
"s268305967",
"s779843085"
] |
u416758623 | p03610 | python | s511530205 | s111076329 | 83 | 39 | 4,596 | 3,188 | Accepted | Accepted | 53.01 | s = input()
for i in range(len(s)):
if i % 2 == 0:
print(s[i],end="")
print()
| s = eval(input())
ans = ""
for i in range(len(s)):
if i % 2 == 0:
ans += s[i]
print(ans) | 5 | 6 | 93 | 99 | s = input()
for i in range(len(s)):
if i % 2 == 0:
print(s[i], end="")
print()
| s = eval(input())
ans = ""
for i in range(len(s)):
if i % 2 == 0:
ans += s[i]
print(ans)
| false | 16.666667 | [
"-s = input()",
"+s = eval(input())",
"+ans = \"\"",
"- print(s[i], end=\"\")",
"-print()",
"+ ans += s[i]",
"+print(ans)"
] | false | 0.124208 | 0.128987 | 0.96295 | [
"s511530205",
"s111076329"
] |
u750389519 | p03433 | python | s342834523 | s548150124 | 30 | 26 | 9,076 | 8,868 | Accepted | Accepted | 13.33 | N=int(eval(input()))
A=int(eval(input()))
if N%500<=A:
print("Yes")
else:
print("No") | N=int(eval(input()))
A=int(eval(input()))
print(("Yes" if N%500<=A else "No")) | 6 | 3 | 86 | 66 | N = int(eval(input()))
A = int(eval(input()))
if N % 500 <= A:
print("Yes")
else:
print("No")
| N = int(eval(input()))
A = int(eval(input()))
print(("Yes" if N % 500 <= A else "No"))
| false | 50 | [
"-if N % 500 <= A:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"Yes\" if N % 500 <= A else \"No\"))"
] | false | 0.045956 | 0.04491 | 1.02328 | [
"s342834523",
"s548150124"
] |
u869790980 | p02642 | python | s703594935 | s887066336 | 434 | 369 | 228,672 | 228,784 | Accepted | Accepted | 14.98 | import collections
n,cc = int(input()), collections.Counter(list(map(int,input().split())))
m,s = max(cc.keys()),{ai:True for ai in cc}
for a in cc:
c = a if cc[a] > 1 else 2 * a
while(c <= m):
if a in s: s[c] = False
c += a
count = 0
for a in s:
if s[a]: count +=1
print(count) | import collections
n,cc = int(input()), collections.Counter(list(map(int,input().split())))
m,s = max(cc.keys()),{ai:True for ai in cc}
for a in cc:
c = a if cc[a] > 1 else 2 * a
while(c <= m):
if a in s: s[c] = False
c += a
count = 0
for v in list(s.values()):
if v: count +=1
print(count) | 12 | 12 | 298 | 304 | import collections
n, cc = int(input()), collections.Counter(list(map(int, input().split())))
m, s = max(cc.keys()), {ai: True for ai in cc}
for a in cc:
c = a if cc[a] > 1 else 2 * a
while c <= m:
if a in s:
s[c] = False
c += a
count = 0
for a in s:
if s[a]:
count += 1
... | import collections
n, cc = int(input()), collections.Counter(list(map(int, input().split())))
m, s = max(cc.keys()), {ai: True for ai in cc}
for a in cc:
c = a if cc[a] > 1 else 2 * a
while c <= m:
if a in s:
s[c] = False
c += a
count = 0
for v in list(s.values()):
if v:
... | false | 0 | [
"-for a in s:",
"- if s[a]:",
"+for v in list(s.values()):",
"+ if v:"
] | false | 0.078759 | 0.05565 | 1.415259 | [
"s703594935",
"s887066336"
] |
u261103969 | p02623 | python | s827392583 | s950241001 | 242 | 178 | 50,592 | 135,496 | Accepted | Accepted | 26.45 | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a))
b_acc = [0] + list((accumulate(b)))
ans = 0
bn = m
for an in range(n + 1):
rem = k - a_acc[an]
if rem < 0:
... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a)) # aを0冊読む=1冊も読まない場合があるので
b_acc = [0] + list(accumulate(b)) # 今度は[0]が必要です
ans = 0
for an in range(n + 1):
rem = k - a_acc... | 23 | 33 | 488 | 764 | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a))
b_acc = [0] + list((accumulate(b)))
ans = 0
bn = m
for an in range(n + 1):
rem = k - a_acc[an]
if rem < 0:
break
# rem... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a)) # aを0冊読む=1冊も読まない場合があるので
b_acc = [0] + list(accumulate(b)) # 今度は[0]が必要です
ans = 0
for an in range(n + 1):
rem = k - a_acc[an]
if r... | false | 30.30303 | [
"-a_acc = [0] + list(accumulate(a))",
"-b_acc = [0] + list((accumulate(b)))",
"+a_acc = [0] + list(accumulate(a)) # aを0冊読む=1冊も読まない場合があるので",
"+b_acc = [0] + list(accumulate(b)) # 今度は[0]が必要です",
"-bn = m",
"- # rem >= 0 かつ、b_acc[0] = 0なので、bnはどんなに減っても0で必ず止まります。マイナスになってバグることはありません",
"- while b_acc[bn... | false | 0.063842 | 0.037073 | 1.722041 | [
"s827392583",
"s950241001"
] |
u124498235 | p03329 | python | s947832506 | s873395643 | 721 | 605 | 3,828 | 7,064 | Accepted | Accepted | 16.09 | n = int(eval(input()))
a = 6
b = [1]
b.append(a)
while a <= 100000:
a *= 6
b.append(a)
c = 9
b.append(c)
while c <= 100000:
c *= 9
b.append(c)
b.sort()
INF = 10**7
dp = [INF]*100001
dp[0] = 0
for i in range(100001):
for j in b:
if i + j > 100000:
continue
dp[i+j] = min(dp[i]+1, dp[i+j])
... | n = int(eval(input()))
ary = [1]
x = 1
for i in range(6):
x *= 6
ary.append(x)
x = 1
for i in range(5):
x *= 9
ary.append(x)
ary.sort()
dp = [i for i in range(n+1)]
for i in range(1,n+1):
for j in ary:
if j > i:
break
dp[i] = min(dp[i],dp[i-j]+1)
print((dp[n])) | 22 | 20 | 328 | 287 | n = int(eval(input()))
a = 6
b = [1]
b.append(a)
while a <= 100000:
a *= 6
b.append(a)
c = 9
b.append(c)
while c <= 100000:
c *= 9
b.append(c)
b.sort()
INF = 10**7
dp = [INF] * 100001
dp[0] = 0
for i in range(100001):
for j in b:
if i + j > 100000:
continue
dp[i + j] = mi... | n = int(eval(input()))
ary = [1]
x = 1
for i in range(6):
x *= 6
ary.append(x)
x = 1
for i in range(5):
x *= 9
ary.append(x)
ary.sort()
dp = [i for i in range(n + 1)]
for i in range(1, n + 1):
for j in ary:
if j > i:
break
dp[i] = min(dp[i], dp[i - j] + 1)
print((dp[n]))
| false | 9.090909 | [
"-a = 6",
"-b = [1]",
"-b.append(a)",
"-while a <= 100000:",
"- a *= 6",
"- b.append(a)",
"-c = 9",
"-b.append(c)",
"-while c <= 100000:",
"- c *= 9",
"- b.append(c)",
"-b.sort()",
"-INF = 10**7",
"-dp = [INF] * 100001",
"-dp[0] = 0",
"-for i in range(100001):",
"- for... | false | 1.523977 | 0.152508 | 9.992755 | [
"s947832506",
"s873395643"
] |
u022979415 | p03503 | python | s804840325 | s965123618 | 162 | 76 | 3,064 | 3,064 | Accepted | Accepted | 53.09 | def main():
SHOP_NUM = int(eval(input()))
open_info = [input().split() for _ in range(SHOP_NUM)]
profit = [list(map(int, input().split())) for _ in range(SHOP_NUM)]
answer = -float("inf")
for i in range(1, 1024):
open = str(format(i, '10b'))
now_profit = 0
for shop in... | def main():
n = int(eval(input()))
f = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
answer = -float("inf")
for i in range(1, pow(2, 10)):
now = 0
cnt = [0 for _ in range(n)]
for j in range(10):
... | 20 | 22 | 631 | 600 | def main():
SHOP_NUM = int(eval(input()))
open_info = [input().split() for _ in range(SHOP_NUM)]
profit = [list(map(int, input().split())) for _ in range(SHOP_NUM)]
answer = -float("inf")
for i in range(1, 1024):
open = str(format(i, "10b"))
now_profit = 0
for shop in range(S... | def main():
n = int(eval(input()))
f = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
answer = -float("inf")
for i in range(1, pow(2, 10)):
now = 0
cnt = [0 for _ in range(n)]
for j in range(10):
if (i >... | false | 9.090909 | [
"- SHOP_NUM = int(eval(input()))",
"- open_info = [input().split() for _ in range(SHOP_NUM)]",
"- profit = [list(map(int, input().split())) for _ in range(SHOP_NUM)]",
"+ n = int(eval(input()))",
"+ f = [list(map(int, input().split())) for _ in range(n)]",
"+ p = [list(map(int, input().s... | false | 0.091972 | 0.105734 | 0.869844 | [
"s804840325",
"s965123618"
] |
u785213188 | p02603 | python | s175642519 | s310306943 | 32 | 27 | 9,024 | 9,144 | Accepted | Accepted | 15.62 | N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
stack = 0
for i in range(N-1):
if A[i] < A[i+1]:
stack = money // A[i]
money += (A[i+1] - A[i]) * stack
stack = 0
print(money)
| N = int(eval(input()))
A = [0] + list(map(int, input().split()))
dp = [0] * (N+1)
dp[1] = 1000
for i in range(2, N+1):
dp[i] = dp[i-1]
for j in range(1, i):
stock = dp[j] // A[j]
momey = dp[j] + (A[i] - A[j]) * stock
dp[i] = max(dp[i], momey)
print((dp[N])) | 12 | 12 | 226 | 293 | N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
stack = 0
for i in range(N - 1):
if A[i] < A[i + 1]:
stack = money // A[i]
money += (A[i + 1] - A[i]) * stack
stack = 0
print(money)
| N = int(eval(input()))
A = [0] + list(map(int, input().split()))
dp = [0] * (N + 1)
dp[1] = 1000
for i in range(2, N + 1):
dp[i] = dp[i - 1]
for j in range(1, i):
stock = dp[j] // A[j]
momey = dp[j] + (A[i] - A[j]) * stock
dp[i] = max(dp[i], momey)
print((dp[N]))
| false | 0 | [
"-A = list(map(int, input().split()))",
"-money = 1000",
"-stack = 0",
"-for i in range(N - 1):",
"- if A[i] < A[i + 1]:",
"- stack = money // A[i]",
"- money += (A[i + 1] - A[i]) * stack",
"- stack = 0",
"-print(money)",
"+A = [0] + list(map(int, input().split()))",
"+dp = [0] *... | false | 0.042209 | 0.032331 | 1.305525 | [
"s175642519",
"s310306943"
] |
u371763408 | p03475 | python | s847437140 | s907247148 | 77 | 65 | 3,188 | 3,060 | Accepted | Accepted | 15.58 | n=int(eval(input()))
ls=[]
ans=[]
for i in range(n-1):
ls.append(list(map(int,input().split())))
def calculate(i):
time=ls[i][1]+ls[i][0]
for j in range(i+1,len(ls)):
if time<ls[j][1]:
time=ls[j][1]+ls[j][0]
elif time %ls[j][2]==0:
time+=ls[j][0]
else:
time+=ls[j][0]+l... | n=int(input())
ls=[]
for i in range(n-1):
c,s,f=map(int,input().split())
ls.append(s)
ls=list(map(lambda x:(x+c+(0 if x%f==0 else (f-x%f)) if s<=x else s+c),ls))
ls=ls+[0]
print(*ls,sep="\n")
| 22 | 8 | 448 | 204 | n = int(eval(input()))
ls = []
ans = []
for i in range(n - 1):
ls.append(list(map(int, input().split())))
def calculate(i):
time = ls[i][1] + ls[i][0]
for j in range(i + 1, len(ls)):
if time < ls[j][1]:
time = ls[j][1] + ls[j][0]
elif time % ls[j][2] == 0:
time += l... | n = int(input())
ls = []
for i in range(n - 1):
c, s, f = map(int, input().split())
ls.append(s)
ls = list(
map(
lambda x: (x + c + (0 if x % f == 0 else (f - x % f)) if s <= x else s + c),
ls,
)
)
ls = ls + [0]
print(*ls, sep="\n")
| false | 63.636364 | [
"-n = int(eval(input()))",
"+n = int(input())",
"-ans = []",
"- ls.append(list(map(int, input().split())))",
"-",
"-",
"-def calculate(i):",
"- time = ls[i][1] + ls[i][0]",
"- for j in range(i + 1, len(ls)):",
"- if time < ls[j][1]:",
"- time = ls[j][1] + ls[j][0]",
... | false | 0.035852 | 0.039534 | 0.906849 | [
"s847437140",
"s907247148"
] |
u893063840 | p03290 | python | s318810585 | s192620614 | 48 | 23 | 3,192 | 3,188 | Accepted | Accepted | 52.08 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
min_solved = 1000
for i in range(2 ** d):
i_str = "{:010b}".format(i)[::-1]
score = 0
solved = 0
for j in range(d):
if i_str[j] == "1":
score += 100 * (j + 1) * pc[j][0] + pc[j]... | from math import ceil
from itertools import product
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1000
for pat in product(["1", "0"], repeat=d):
score = 0
cnt = 0
not_complete = 0
for i, bl in enumerate(pat):
if bl == "1":
... | 26 | 28 | 680 | 667 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
min_solved = 1000
for i in range(2**d):
i_str = "{:010b}".format(i)[::-1]
score = 0
solved = 0
for j in range(d):
if i_str[j] == "1":
score += 100 * (j + 1) * pc[j][0] + pc[j][1]
... | from math import ceil
from itertools import product
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1000
for pat in product(["1", "0"], repeat=d):
score = 0
cnt = 0
not_complete = 0
for i, bl in enumerate(pat):
if bl == "1":
scor... | false | 7.142857 | [
"+from math import ceil",
"+from itertools import product",
"+",
"-min_solved = 1000",
"-for i in range(2**d):",
"- i_str = \"{:010b}\".format(i)[::-1]",
"+ans = 1000",
"+for pat in product([\"1\", \"0\"], repeat=d):",
"- solved = 0",
"- for j in range(d):",
"- if i_str[j] == \"1... | false | 0.085788 | 0.090475 | 0.948197 | [
"s318810585",
"s192620614"
] |
u814781830 | p02947 | python | s257600611 | s370080782 | 1,623 | 533 | 18,820 | 18,184 | Accepted | Accepted | 67.16 | from collections import Counter
N = int(eval(input()))
S = set()
cnt = 0
def createStr(counter):
ret = ""
keys = list(counter.keys())
keys.sort()
for key in keys:
ret += key
ret += str(counter[key])
return ret
ret = {}
for i in range(N):
s = Counter(eval(input()... | from collections import Counter
N = int(eval(input()))
S = set()
cnt = 0
def createStr(intput_str):
ret = ""
intput_str = sorted(intput_str)
for s in intput_str:
ret += s
return ret
ret = {}
for i in range(N):
s = createStr(eval(input()))
if s in list(ret.keys()):
... | 27 | 24 | 473 | 411 | from collections import Counter
N = int(eval(input()))
S = set()
cnt = 0
def createStr(counter):
ret = ""
keys = list(counter.keys())
keys.sort()
for key in keys:
ret += key
ret += str(counter[key])
return ret
ret = {}
for i in range(N):
s = Counter(eval(input()))
s = cr... | from collections import Counter
N = int(eval(input()))
S = set()
cnt = 0
def createStr(intput_str):
ret = ""
intput_str = sorted(intput_str)
for s in intput_str:
ret += s
return ret
ret = {}
for i in range(N):
s = createStr(eval(input()))
if s in list(ret.keys()):
ret[s] += ... | false | 11.111111 | [
"-def createStr(counter):",
"+def createStr(intput_str):",
"- keys = list(counter.keys())",
"- keys.sort()",
"- for key in keys:",
"- ret += key",
"- ret += str(counter[key])",
"+ intput_str = sorted(intput_str)",
"+ for s in intput_str:",
"+ ret += s",
"- ... | false | 0.036496 | 0.052571 | 0.694214 | [
"s257600611",
"s370080782"
] |
u912862653 | p02911 | python | s912023603 | s714228926 | 271 | 144 | 4,680 | 4,680 | Accepted | Accepted | 46.86 | N, K, Q = list(map(int, input().split()))
A = [0]*N
for _ in range(Q):
q = int(eval(input()))
A[q-1] += 1
for a in A:
if K-Q+a>0:
print('Yes')
else:
print('No') | import sys
input = sys.stdin.readline
def main():
N, K, Q = list(map(int, input().split()))
A = [0]*N
for _ in range(Q):
q = int(eval(input()))
A[q-1] += 1
for a in A:
if K-Q+a>0:
print('Yes')
else:
print('No')
if __name__ == '_... | 11 | 18 | 191 | 329 | N, K, Q = list(map(int, input().split()))
A = [0] * N
for _ in range(Q):
q = int(eval(input()))
A[q - 1] += 1
for a in A:
if K - Q + a > 0:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
def main():
N, K, Q = list(map(int, input().split()))
A = [0] * N
for _ in range(Q):
q = int(eval(input()))
A[q - 1] += 1
for a in A:
if K - Q + a > 0:
print("Yes")
else:
print("No")
if __name__ == "__main... | false | 38.888889 | [
"-N, K, Q = list(map(int, input().split()))",
"-A = [0] * N",
"-for _ in range(Q):",
"- q = int(eval(input()))",
"- A[q - 1] += 1",
"-for a in A:",
"- if K - Q + a > 0:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+import sys",
"+",
"+input = sys.stdin.readl... | false | 0.038134 | 0.079568 | 0.479261 | [
"s912023603",
"s714228926"
] |
u539281377 | p02767 | python | s959010463 | s872263342 | 21 | 17 | 3,064 | 2,940 | Accepted | Accepted | 19.05 | N=int(eval(input()))
X=list(map(int,input().split()))
ans=float('inf')
p=0
for i in range(1,100):
for k in range(N):
p+=((X[k]-i)**2)
ans=min(ans,p)
p=0
print(ans) | N=int(eval(input()))
X=list(map(int,input().split()))
P=round(sum(X)/N)
print((sum((x-P)**2 for x in X))) | 10 | 4 | 186 | 100 | N = int(eval(input()))
X = list(map(int, input().split()))
ans = float("inf")
p = 0
for i in range(1, 100):
for k in range(N):
p += (X[k] - i) ** 2
ans = min(ans, p)
p = 0
print(ans)
| N = int(eval(input()))
X = list(map(int, input().split()))
P = round(sum(X) / N)
print((sum((x - P) ** 2 for x in X)))
| false | 60 | [
"-ans = float(\"inf\")",
"-p = 0",
"-for i in range(1, 100):",
"- for k in range(N):",
"- p += (X[k] - i) ** 2",
"- ans = min(ans, p)",
"- p = 0",
"-print(ans)",
"+P = round(sum(X) / N)",
"+print((sum((x - P) ** 2 for x in X)))"
] | false | 0.042431 | 0.041791 | 1.015307 | [
"s959010463",
"s872263342"
] |
u046187684 | p02726 | python | s788031019 | s303032286 | 1,742 | 1,275 | 3,316 | 3,188 | Accepted | Accepted | 26.81 | def solve(string):
n, x, y = list(map(int, string.split()))
ans = [0] * (n - 1)
for s in range(1, n + 1):
d = [abs(i - s) for i in range(1, n + 1)]
if d[x - 1] < d[y - 1]:
p = y - 1
d[p] = min(d[p], d[x - 1] + 1)
else:
p = x - 1
... | def solve(string):
n, x, y = list(map(int, string.split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
ans[min(j - i, abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x))] += 1
return "\n".join(map(str, ans[1:]))
if __name__ == '__main__':
... | 23 | 12 | 696 | 369 | def solve(string):
n, x, y = list(map(int, string.split()))
ans = [0] * (n - 1)
for s in range(1, n + 1):
d = [abs(i - s) for i in range(1, n + 1)]
if d[x - 1] < d[y - 1]:
p = y - 1
d[p] = min(d[p], d[x - 1] + 1)
else:
p = x - 1
d[p] = ... | def solve(string):
n, x, y = list(map(int, string.split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
ans[
min(j - i, abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x))
] += 1
return "\n".join(map(str, ans[1:]))
if __name__... | false | 47.826087 | [
"- ans = [0] * (n - 1)",
"- for s in range(1, n + 1):",
"- d = [abs(i - s) for i in range(1, n + 1)]",
"- if d[x - 1] < d[y - 1]:",
"- p = y - 1",
"- d[p] = min(d[p], d[x - 1] + 1)",
"- else:",
"- p = x - 1",
"- d[p] = min(d[p], ... | false | 0.246559 | 0.144761 | 1.703217 | [
"s788031019",
"s303032286"
] |
u191874006 | p02971 | python | s479744515 | s438933809 | 875 | 436 | 70,488 | 60,496 | Accepted | Accepted | 50.17 | #!/usr/bin/env python3
#ABC134 C
import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7
n = int(eval(input(... | #!/usr/bin/env python3
#ABC134 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | 22 | 27 | 459 | 659 | #!/usr/bin/env python3
# ABC134 C
import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7
n = int(eval(input()))
a = [int(e... | #!/usr/bin/env python3
# ABC134 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | false | 18.518519 | [
"-from heapq import heappush, heappop",
"+",
"+sys.setrecursionlimit(1000000000)",
"+from heapq import heappush, heappop, heappushpop",
"+from itertools import permutations",
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"+inf = float(\"inf\")",
"+",
"+",
"+def I():",... | false | 0.084641 | 0.055334 | 1.52963 | [
"s479744515",
"s438933809"
] |
u994988729 | p03800 | python | s824688076 | s178328484 | 111 | 101 | 4,852 | 4,980 | Accepted | Accepted | 9.01 | from itertools import product
N = int(eval(input()))
S = eval(input())
S += S[0]
def isOK(x, y):
WS = [-1] * (N + 2)
WS[0] = x
WS[1] = y
for i in range(1, N + 1):
if S[i] == "o":
WS[i + 1] = WS[i - 1] if WS[i] else 1 - WS[i - 1]
else:
WS[i + 1] = 1... | def check(a, b, S):
animal = [a, b]
for s in S[1:]:
if s == "o" and animal[-1]:
animal.append(animal[-2])
elif s == "o" and not animal[-1]:
animal.append(animal[-2] ^ 1)
elif s == "x" and animal[-1]:
animal.append(animal[-2] ^ 1)
else:... | 37 | 34 | 712 | 781 | from itertools import product
N = int(eval(input()))
S = eval(input())
S += S[0]
def isOK(x, y):
WS = [-1] * (N + 2)
WS[0] = x
WS[1] = y
for i in range(1, N + 1):
if S[i] == "o":
WS[i + 1] = WS[i - 1] if WS[i] else 1 - WS[i - 1]
else:
WS[i + 1] = 1 - WS[i - 1] ... | def check(a, b, S):
animal = [a, b]
for s in S[1:]:
if s == "o" and animal[-1]:
animal.append(animal[-2])
elif s == "o" and not animal[-1]:
animal.append(animal[-2] ^ 1)
elif s == "x" and animal[-1]:
animal.append(animal[-2] ^ 1)
else:
... | false | 8.108108 | [
"-from itertools import product",
"-",
"-N = int(eval(input()))",
"-S = eval(input())",
"-S += S[0]",
"-",
"-",
"-def isOK(x, y):",
"- WS = [-1] * (N + 2)",
"- WS[0] = x",
"- WS[1] = y",
"- for i in range(1, N + 1):",
"- if S[i] == \"o\":",
"- WS[i + 1] = WS[i... | false | 0.046774 | 0.043921 | 1.064941 | [
"s824688076",
"s178328484"
] |
u631277801 | p03779 | python | s939535492 | s375224544 | 35 | 30 | 4,888 | 11,544 | Accepted | Accepted | 14.29 | N = int(eval(input()))
X = []
x = 1
i = 1
while x<10**9+1:
X.append(x)
i += 1
x += i
X.append(x)
for i,x in enumerate(X):
if x < N:
continue
else:
print((i+1))
break
| import sys
stdin = sys.stdin
def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): re... | 17 | 19 | 227 | 581 | N = int(eval(input()))
X = []
x = 1
i = 1
while x < 10**9 + 1:
X.append(x)
i += 1
x += i
X.append(x)
for i, x in enumerate(X):
if x < N:
continue
else:
print((i + 1))
break
| import sys
stdin = sys.stdin
def li():
return [int(x) for x in stdin.readline().split()]
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return [float(x) for x in stdin.readline().split()]
def ls():
return stdin.readline().split()
def ns():
return stdin.readline... | false | 10.526316 | [
"-N = int(eval(input()))",
"-X = []",
"-x = 1",
"-i = 1",
"-while x < 10**9 + 1:",
"- X.append(x)",
"- i += 1",
"- x += i",
"-X.append(x)",
"-for i, x in enumerate(X):",
"- if x < N:",
"- continue",
"- else:",
"- print((i + 1))",
"- break",
"+import ... | false | 0.067019 | 0.140974 | 0.475398 | [
"s939535492",
"s375224544"
] |
u970197315 | p03103 | python | s671370019 | s422044832 | 493 | 402 | 29,744 | 18,140 | Accepted | Accepted | 18.46 | from operator import itemgetter
n,m = list(map(int,input().split()))
AB = []
sAB = []
s = 0
c = 0
for i in range(n):
AB.append(list(map(int,input().split())))
sAB = sorted(AB,key=itemgetter(0))
for i,(a,b) in enumerate(sAB):
if c + b < m:
c += b
s += a*b
elif c + b >= m:... | 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(key=lambda x: x[0])
ans=0
t=10**10
for a,b in ab:
t=min(b,m)
if t<=0:break
m-=t
ans+=a*t
print(ans) | 26 | 14 | 467 | 232 | from operator import itemgetter
n, m = list(map(int, input().split()))
AB = []
sAB = []
s = 0
c = 0
for i in range(n):
AB.append(list(map(int, input().split())))
sAB = sorted(AB, key=itemgetter(0))
for i, (a, b) in enumerate(sAB):
if c + b < m:
c += b
s += a * b
elif c + b >= m:
for... | 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(key=lambda x: x[0])
ans = 0
t = 10**10
for a, b in ab:
t = min(b, m)
if t <= 0:
break
m -= t
ans += a * t
print(ans)
| false | 46.153846 | [
"-from operator import itemgetter",
"-",
"-AB = []",
"-sAB = []",
"-s = 0",
"-c = 0",
"+ab = []",
"- AB.append(list(map(int, input().split())))",
"-sAB = sorted(AB, key=itemgetter(0))",
"-for i, (a, b) in enumerate(sAB):",
"- if c + b < m:",
"- c += b",
"- s += a * b",
... | false | 0.054045 | 0.038931 | 1.388247 | [
"s671370019",
"s422044832"
] |
u051422473 | p03419 | python | s748012817 | s529799764 | 366 | 64 | 78,008 | 61,668 | Accepted | Accepted | 82.51 | n, m = [int(x) for x in input().split()]
print((abs(n - 2) * abs(m - 2))) | n, m = list(map(int, input().split()))
print((abs(n - 2) * abs(m - 2))) | 2 | 2 | 72 | 64 | n, m = [int(x) for x in input().split()]
print((abs(n - 2) * abs(m - 2)))
| n, m = list(map(int, input().split()))
print((abs(n - 2) * abs(m - 2)))
| false | 0 | [
"-n, m = [int(x) for x in input().split()]",
"+n, m = list(map(int, input().split()))"
] | false | 0.039365 | 0.041076 | 0.958352 | [
"s748012817",
"s529799764"
] |
u797016134 | p03037 | python | s464066613 | s279630839 | 370 | 318 | 35,256 | 3,060 | Accepted | Accepted | 14.05 | a,b= list(map(int,input().split()))
x, y= list(zip(*[list(map(int,input().split())) for i in range(b)]))
f= min(y) - max(x)
if f< 0 :
print((0))
else :
print((min(y) - max(x) +1))
| n, m = list(map(int, input().split()))
low = 0
high = n+1
for i in range(m):
l, r = list(map(int, input().split()))
low = max(low, l)
high = min(high, r)
print((high-low+1 if low <= high else 0)) | 7 | 10 | 176 | 204 | a, b = list(map(int, input().split()))
x, y = list(zip(*[list(map(int, input().split())) for i in range(b)]))
f = min(y) - max(x)
if f < 0:
print((0))
else:
print((min(y) - max(x) + 1))
| n, m = list(map(int, input().split()))
low = 0
high = n + 1
for i in range(m):
l, r = list(map(int, input().split()))
low = max(low, l)
high = min(high, r)
print((high - low + 1 if low <= high else 0))
| false | 30 | [
"-a, b = list(map(int, input().split()))",
"-x, y = list(zip(*[list(map(int, input().split())) for i in range(b)]))",
"-f = min(y) - max(x)",
"-if f < 0:",
"- print((0))",
"-else:",
"- print((min(y) - max(x) + 1))",
"+n, m = list(map(int, input().split()))",
"+low = 0",
"+high = n + 1",
"+... | false | 0.086345 | 0.036105 | 2.391512 | [
"s464066613",
"s279630839"
] |
u912237403 | p00068 | python | s648310373 | s956526003 | 20 | 10 | 4,276 | 4,276 | Accepted | Accepted | 50 | import sys
def side(p1,p2):
global D
y1,x1=p1
y2,x2=p2
dy=y2-y1
dx=x2-x1
for p3 in D[::-1]:
if p1==p3 or p2==p3:continue
y3,x3=p3
if (x3-x1)*dy-dx*(y3-y1)<0:return 0
else:return 1
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
... | import sys
def side(p1,p2):
global D
y1,x1=p1
y2,x2=p2
dy=y2-y1
dx=x2-x1
for p3 in D[::-1]:
if p1==p3 or p2==p3:continue
if (p3[1]-x1)*dy-dx*(p3[0]-y1)<0:return 0
else:return 1
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
p=p1=D[... | 26 | 25 | 469 | 461 | import sys
def side(p1, p2):
global D
y1, x1 = p1
y2, x2 = p2
dy = y2 - y1
dx = x2 - x1
for p3 in D[::-1]:
if p1 == p3 or p2 == p3:
continue
y3, x3 = p3
if (x3 - x1) * dy - dx * (y3 - y1) < 0:
return 0
else:
return 1
while 1:
n ... | import sys
def side(p1, p2):
global D
y1, x1 = p1
y2, x2 = p2
dy = y2 - y1
dx = x2 - x1
for p3 in D[::-1]:
if p1 == p3 or p2 == p3:
continue
if (p3[1] - x1) * dy - dx * (p3[0] - y1) < 0:
return 0
else:
return 1
while 1:
n = eval(input()... | false | 3.846154 | [
"- y3, x3 = p3",
"- if (x3 - x1) * dy - dx * (y3 - y1) < 0:",
"+ if (p3[1] - x1) * dy - dx * (p3[0] - y1) < 0:"
] | false | 0.063972 | 0.145784 | 0.438812 | [
"s648310373",
"s956526003"
] |
u222668979 | p02631 | python | s393557423 | s074871835 | 170 | 155 | 31,300 | 31,420 | Accepted | Accepted | 8.82 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in a:
cnt ^= i
for i in a:
print((cnt ^ i))
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in a:
cnt ^= i
for i in a:
print((cnt ^ i))
| 11 | 8 | 167 | 125 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in a:
cnt ^= i
for i in a:
print((cnt ^ i))
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in a:
cnt ^= i
for i in a:
print((cnt ^ i))
| false | 27.272727 | [
"-import sys",
"-",
"-input = sys.stdin.readline"
] | false | 0.037179 | 0.042557 | 0.87362 | [
"s393557423",
"s074871835"
] |
u296518383 | p02996 | python | s665659868 | s426151152 | 918 | 612 | 53,728 | 53,656 | Accepted | Accepted | 33.33 | N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
sum_a = 0
for a, b in AB:
sum_a += a
if sum_a > b:
print("No")
exit()
print("Yes") | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
sum_a = 0
for a, b in AB:
sum_a += a
if sum_a > b:
print("No")
exit()
print("Yes") | 12 | 15 | 211 | 260 | N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
sum_a = 0
for a, b in AB:
sum_a += a
if sum_a > b:
print("No")
exit()
print("Yes")
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
sum_a = 0
for a, b in AB:
sum_a += a
if sum_a > b:
print("No")
exit()
print("Yes")
| false | 20 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline"
] | false | 0.094655 | 0.035789 | 2.644792 | [
"s665659868",
"s426151152"
] |
u143509139 | p03147 | python | s517004067 | s273533057 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | eval(input())
flowers = list(map(int,input().split()))
def mizuyari(*f):
num = 0
if f == ():
return 0
f_min = min(f)
f_min_index = f.index(f_min)
num += f_min
f = [i-f_min for i in f]
num += mizuyari(*f[:f_min_index])
num += mizuyari(*f[f_min_index+1:])
return num
ans = mizuyari(0, ... | n = int(eval(input()))
a = list(map(int, input().split()))
s = [(0, n)]
ans = 0
while s:
l, r = s.pop()
if l == r:
continue
m = min(a[l:r])
ans += m
for i in range(l, r):
a[i] -= m
for i in range(l, r):
if a[i] == 0:
s.append((l, i))
... | 16 | 18 | 335 | 366 | eval(input())
flowers = list(map(int, input().split()))
def mizuyari(*f):
num = 0
if f == ():
return 0
f_min = min(f)
f_min_index = f.index(f_min)
num += f_min
f = [i - f_min for i in f]
num += mizuyari(*f[:f_min_index])
num += mizuyari(*f[f_min_index + 1 :])
return num
a... | n = int(eval(input()))
a = list(map(int, input().split()))
s = [(0, n)]
ans = 0
while s:
l, r = s.pop()
if l == r:
continue
m = min(a[l:r])
ans += m
for i in range(l, r):
a[i] -= m
for i in range(l, r):
if a[i] == 0:
s.append((l, i))
s.append((i + ... | false | 11.111111 | [
"-eval(input())",
"-flowers = list(map(int, input().split()))",
"-",
"-",
"-def mizuyari(*f):",
"- num = 0",
"- if f == ():",
"- return 0",
"- f_min = min(f)",
"- f_min_index = f.index(f_min)",
"- num += f_min",
"- f = [i - f_min for i in f]",
"- num += mizuyari(*... | false | 0.046347 | 0.046837 | 0.989541 | [
"s517004067",
"s273533057"
] |
u699944218 | p02640 | python | s331924866 | s520108093 | 26 | 23 | 9,004 | 9,120 | Accepted | Accepted | 11.54 | X, Y = list(map(int,input().split()))
for i in range(X+1):
for j in range(X+1):
if i + j == X and 2 * i + 4 * j == Y:
print('Yes')
exit()
print('No') | X, Y = list(map(int,input().split()))
for i in range(X + 1):
for j in range(X + 1):
if 2 * i + 4 * j == Y and i + j == X:
print('Yes')
exit()
print('No') | 7 | 9 | 173 | 190 | X, Y = list(map(int, input().split()))
for i in range(X + 1):
for j in range(X + 1):
if i + j == X and 2 * i + 4 * j == Y:
print("Yes")
exit()
print("No")
| X, Y = list(map(int, input().split()))
for i in range(X + 1):
for j in range(X + 1):
if 2 * i + 4 * j == Y and i + j == X:
print("Yes")
exit()
print("No")
| false | 22.222222 | [
"- if i + j == X and 2 * i + 4 * j == Y:",
"+ if 2 * i + 4 * j == Y and i + j == X:"
] | false | 0.032854 | 0.033595 | 0.977936 | [
"s331924866",
"s520108093"
] |
u924691798 | p02615 | python | s364773311 | s378035833 | 262 | 182 | 31,852 | 31,620 | Accepted | Accepted | 30.53 | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
h = [-A[0]]
ans = 0
for i in range(1,N):
ans -= heapq.heappop(h)
heapq.heappush(h, -A[i])
heapq.heappush(h, -A[i])
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
AA = []
for i in range(N):
if i == 0:
AA.append(A[i])
else:
AA.append(A[i])
AA.append(A[i])
AA.sort(reverse=True)
ans = 0
for i in range(N-1):
ans += AA[i]
print(ans)
| 12 | 15 | 237 | 291 | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
h = [-A[0]]
ans = 0
for i in range(1, N):
ans -= heapq.heappop(h)
heapq.heappush(h, -A[i])
heapq.heappush(h, -A[i])
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
AA = []
for i in range(N):
if i == 0:
AA.append(A[i])
else:
AA.append(A[i])
AA.append(A[i])
AA.sort(reverse=True)
ans = 0
for i in range(N - 1):
ans += AA[i]
print(ans)
| false | 20 | [
"-import heapq",
"-",
"-h = [-A[0]]",
"+AA = []",
"+for i in range(N):",
"+ if i == 0:",
"+ AA.append(A[i])",
"+ else:",
"+ AA.append(A[i])",
"+ AA.append(A[i])",
"+AA.sort(reverse=True)",
"-for i in range(1, N):",
"- ans -= heapq.heappop(h)",
"- heapq.heap... | false | 0.069958 | 0.04012 | 1.743742 | [
"s364773311",
"s378035833"
] |
u279605379 | p02295 | python | s748539596 | s911215516 | 40 | 30 | 7,752 | 7,760 | Accepted | Accepted | 25 | def cp(a,b,c,d,e,f,g,h):
A = a*d-b*c
B = e*h-f*g
C = d-b
D = e-g
E = c-a
F = f-h
det = C*D - E*F
x = A*D + B*E
y = A*F + B*C
return [x/det,y/det]
q = int(eval(input()))
for i in range(q):
a,b,c,d,e,f,g,h = [int(i) for i in input().split()]
P = cp(a,b,c,d,e... | def cp(a,b,c,d,e,f,g,h):
A = a*d-b*c
B = e*h-f*g
C = d-b
D = e-g
E = c-a
F = f-h
det = C*D - E*F
return [(A*D + B*E)/det,(A*F + B*C)/det]
q = int(eval(input()))
for i in range(q):
a,b,c,d,e,f,g,h = [int(i) for i in input().split()]
P = cp(a,b,c,d,e,f,g,h)
print... | 17 | 15 | 343 | 325 | def cp(a, b, c, d, e, f, g, h):
A = a * d - b * c
B = e * h - f * g
C = d - b
D = e - g
E = c - a
F = f - h
det = C * D - E * F
x = A * D + B * E
y = A * F + B * C
return [x / det, y / det]
q = int(eval(input()))
for i in range(q):
a, b, c, d, e, f, g, h = [int(i) for i in ... | def cp(a, b, c, d, e, f, g, h):
A = a * d - b * c
B = e * h - f * g
C = d - b
D = e - g
E = c - a
F = f - h
det = C * D - E * F
return [(A * D + B * E) / det, (A * F + B * C) / det]
q = int(eval(input()))
for i in range(q):
a, b, c, d, e, f, g, h = [int(i) for i in input().split()]... | false | 11.764706 | [
"- x = A * D + B * E",
"- y = A * F + B * C",
"- return [x / det, y / det]",
"+ return [(A * D + B * E) / det, (A * F + B * C) / det]"
] | false | 0.042875 | 0.045055 | 0.951609 | [
"s748539596",
"s911215516"
] |
u077291787 | p03170 | python | s718734115 | s594320384 | 209 | 76 | 40,048 | 3,828 | Accepted | Accepted | 63.64 | # K - Stones
def main():
N, K, *A = list(map(int, open(0).read().split()))
dp = [0] * (K + 1)
for i in range(1, K + 1):
for a in A:
if i - a >= 0:
dp[i] |= dp[i - a] ^ 1
if dp[i]:
break
print(("First" if dp[-1] else "Second"))
... | # K - Stones
def main():
N, K, *A = list(map(int, open(0).read().split()))
dp = [False] * (K + 1)
for i in range(K):
if dp[i]:
continue
for a in A:
if i + a > K:
break
dp[i + a] = True
print(("First" if dp[-1] else "Second"))... | 15 | 16 | 353 | 357 | # K - Stones
def main():
N, K, *A = list(map(int, open(0).read().split()))
dp = [0] * (K + 1)
for i in range(1, K + 1):
for a in A:
if i - a >= 0:
dp[i] |= dp[i - a] ^ 1
if dp[i]:
break
print(("First" if dp[-1] else "Second"))
if __name__... | # K - Stones
def main():
N, K, *A = list(map(int, open(0).read().split()))
dp = [False] * (K + 1)
for i in range(K):
if dp[i]:
continue
for a in A:
if i + a > K:
break
dp[i + a] = True
print(("First" if dp[-1] else "Second"))
if __nam... | false | 6.25 | [
"- dp = [0] * (K + 1)",
"- for i in range(1, K + 1):",
"+ dp = [False] * (K + 1)",
"+ for i in range(K):",
"+ if dp[i]:",
"+ continue",
"- if i - a >= 0:",
"- dp[i] |= dp[i - a] ^ 1",
"- if dp[i]:",
"+ if i + a > K:",
... | false | 0.099242 | 0.045325 | 2.189554 | [
"s718734115",
"s594320384"
] |
u855710796 | p02838 | python | s459258898 | s097612327 | 670 | 459 | 122,808 | 48,808 | Accepted | Accepted | 31.49 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for d in range(60):
n0, n1 = 0, 0
for i in range(N):
if (A[i] >> d) & 1:
n1 += 1
else:
n0 += 1
ans = (ans + (n0 * n1) * (1 << d))% mod
print(ans) | import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
mod = 10**9 + 7
ans = 0
for i in range(60):
c = len(A[A&1==1])
A >>= 1
ans = (ans + c*(N-c)*pow(2,i,mod))%mod
print(ans) | 16 | 14 | 296 | 231 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for d in range(60):
n0, n1 = 0, 0
for i in range(N):
if (A[i] >> d) & 1:
n1 += 1
else:
n0 += 1
ans = (ans + (n0 * n1) * (1 << d)) % mod
print(ans)
| import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
mod = 10**9 + 7
ans = 0
for i in range(60):
c = len(A[A & 1 == 1])
A >>= 1
ans = (ans + c * (N - c) * pow(2, i, mod)) % mod
print(ans)
| false | 12.5 | [
"+import numpy as np",
"+",
"-A = list(map(int, input().split()))",
"+A = np.array(list(map(int, input().split())))",
"-for d in range(60):",
"- n0, n1 = 0, 0",
"- for i in range(N):",
"- if (A[i] >> d) & 1:",
"- n1 += 1",
"- else:",
"- n0 += 1",
"- ... | false | 0.093755 | 0.379913 | 0.246779 | [
"s459258898",
"s097612327"
] |
u864197622 | p02763 | python | s894360331 | s857295724 | 830 | 678 | 79,768 | 80,280 | Accepted | Accepted | 18.31 | NN = 19
X = [0] * ((1<<NN+1)-1)
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x3f
def update(a, x):
i = (1<<NN) - 1 + a
X[i] = x
while True:
i =... | NN = 19
X = [0] * ((1<<NN+1)-1)
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x3f
def update(a, x):
i = (1<<NN) - 1 + a
X[i] = x
while True:
i =... | 50 | 52 | 1,029 | 1,101 | NN = 19
X = [0] * ((1 << NN + 1) - 1)
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0F0F0F0F
x += x >> 8
x += x >> 16
return x & 0x3F
def update(a, x):
i = (1 << NN) - 1 + a
X[i] = x
while True:
i = (i - ... | NN = 19
X = [0] * ((1 << NN + 1) - 1)
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0F0F0F0F
x += x >> 8
x += x >> 16
return x & 0x3F
def update(a, x):
i = (1 << NN) - 1 + a
X[i] = x
while True:
i = (i - ... | false | 3.846154 | [
"- update(i + 1, 1 << a)",
"+ X[(1 << NN) + i] = 1 << a",
"+for i in range((1 << NN) - 1)[::-1]:",
"+ X[i] = X[i * 2 + 1] | X[i * 2 + 2]"
] | false | 0.058924 | 0.070267 | 0.838568 | [
"s894360331",
"s857295724"
] |
u609061751 | p02700 | python | s505556287 | s864049033 | 57 | 23 | 61,744 | 9,120 | Accepted | Accepted | 59.65 | import sys
input = sys.stdin.readline
a, b, c, d = [int(x) for x in input().split()]
while True:
for i in range(2):
if i == 0:
c -= b
if c <= 0:
print("Yes")
sys.exit()
else:
a -= d
if a <= 0:
... | a, b, c, d = [int(x) for x in input().split()]
while True:
c -= b
if c <= 0:
print("Yes")
exit()
a -= d
if a <= 0:
print("No")
exit()
| 17 | 11 | 365 | 193 | import sys
input = sys.stdin.readline
a, b, c, d = [int(x) for x in input().split()]
while True:
for i in range(2):
if i == 0:
c -= b
if c <= 0:
print("Yes")
sys.exit()
else:
a -= d
if a <= 0:
print("No"... | a, b, c, d = [int(x) for x in input().split()]
while True:
c -= b
if c <= 0:
print("Yes")
exit()
a -= d
if a <= 0:
print("No")
exit()
| false | 35.294118 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"- for i in range(2):",
"- if i == 0:",
"- c -= b",
"- if c <= 0:",
"- print(\"Yes\")",
"- sys.exit()",
"- else:",
"- a -= d",
"- if a <= 0:",
"- ... | false | 0.044761 | 0.037211 | 1.202886 | [
"s505556287",
"s864049033"
] |
u738898077 | p02571 | python | s529411694 | s929138385 | 62 | 50 | 9,048 | 9,052 | Accepted | Accepted | 19.35 | s = eval(input())
t = eval(input())
ans = len(t)
for i in range(1+len(s)-len(t)):
cnt = 0
for j in range(len(t)):
if s[i+j] != t[j]:
cnt += 1
ans = min(cnt,ans)
print(ans) | s = eval(input())
t = eval(input())
def getCommonCharNum(x, y):
commonCharNum = 0
for i in range(len(x)):
if x[i] == y[i]:
commonCharNum += 1
return commonCharNum
maxCommonNum = 0
for i in range(len(s) - len(t) + 1):
tmpCommonCharNum = getCommonCharNum(s[i: len(t) + i], t... | 10 | 18 | 200 | 476 | s = eval(input())
t = eval(input())
ans = len(t)
for i in range(1 + len(s) - len(t)):
cnt = 0
for j in range(len(t)):
if s[i + j] != t[j]:
cnt += 1
ans = min(cnt, ans)
print(ans)
| s = eval(input())
t = eval(input())
def getCommonCharNum(x, y):
commonCharNum = 0
for i in range(len(x)):
if x[i] == y[i]:
commonCharNum += 1
return commonCharNum
maxCommonNum = 0
for i in range(len(s) - len(t) + 1):
tmpCommonCharNum = getCommonCharNum(
s[i : len(t) + i],... | false | 44.444444 | [
"-ans = len(t)",
"-for i in range(1 + len(s) - len(t)):",
"- cnt = 0",
"- for j in range(len(t)):",
"- if s[i + j] != t[j]:",
"- cnt += 1",
"- ans = min(cnt, ans)",
"-print(ans)",
"+",
"+",
"+def getCommonCharNum(x, y):",
"+ commonCharNum = 0",
"+ for i in ra... | false | 0.03667 | 0.044198 | 0.829666 | [
"s529411694",
"s929138385"
] |
u094191970 | p02596 | python | s024074586 | s749651281 | 222 | 191 | 9,176 | 9,164 | Accepted | Accepted | 13.96 | k=int(eval(input()))
if k%2==0 or k%5==0:
print((-1))
exit()
num=7
num%=k
ans=1
while num!=0:
num=10*num+7
num%=k
ans+=1
print(ans) | k=int(eval(input()))
if k%2==0 or k%5==0:
print((-1))
exit()
ans=1
num=7%k
while num!=0:
num=(10*num+7)%k
ans+=1
print(ans) | 16 | 14 | 152 | 140 | k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
exit()
num = 7
num %= k
ans = 1
while num != 0:
num = 10 * num + 7
num %= k
ans += 1
print(ans)
| k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
exit()
ans = 1
num = 7 % k
while num != 0:
num = (10 * num + 7) % k
ans += 1
print(ans)
| false | 12.5 | [
"-num = 7",
"-num %= k",
"+num = 7 % k",
"- num = 10 * num + 7",
"- num %= k",
"+ num = (10 * num + 7) % k"
] | false | 0.079151 | 0.075392 | 1.049857 | [
"s024074586",
"s749651281"
] |
u869265610 | p02641 | python | s808346713 | s491380149 | 70 | 28 | 62,040 | 9,108 | Accepted | Accepted | 60 | N,M=list(map(int,input().split()))
ans=[]
if M==0:
print(N)
exit()
c=N
L=list(map(int,input().split()))
while True:
if c not in L:
ans.append(c)
break
else:
c+=1
c=N
while True:
if c not in L:
ans.append(c)
break
else:
c-=1
if abs(ans[0]-N)>=abs(ans[1]-N):
prin... | N,M=list(map(int,input().split()))
L=list(map(int,input().split()))
if N not in L:
print(N)
exit()
c=N
d=N
while True:
if c not in L:
break
else:
c-=1
while True:
if d not in L:
break
else:
d+=1
if abs(d-N)>=abs(c-N):
print(c)
else:
print(d) | 25 | 21 | 387 | 293 | N, M = list(map(int, input().split()))
ans = []
if M == 0:
print(N)
exit()
c = N
L = list(map(int, input().split()))
while True:
if c not in L:
ans.append(c)
break
else:
c += 1
c = N
while True:
if c not in L:
ans.append(c)
break
else:
c -= 1
if ab... | N, M = list(map(int, input().split()))
L = list(map(int, input().split()))
if N not in L:
print(N)
exit()
c = N
d = N
while True:
if c not in L:
break
else:
c -= 1
while True:
if d not in L:
break
else:
d += 1
if abs(d - N) >= abs(c - N):
print(c)
else:
pr... | false | 16 | [
"-ans = []",
"-if M == 0:",
"+L = list(map(int, input().split()))",
"+if N not in L:",
"-L = list(map(int, input().split()))",
"+d = N",
"- ans.append(c)",
"- break",
"- else:",
"- c += 1",
"-c = N",
"-while True:",
"- if c not in L:",
"- ans.append(c)",
... | false | 0.05233 | 0.127818 | 0.409406 | [
"s808346713",
"s491380149"
] |
u255280439 | p03502 | python | s735941401 | s085782872 | 51 | 36 | 5,184 | 4,628 | Accepted | Accepted | 29.41 | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v):k for k,v in list(inspect.currentframe().f_back.f_locals.items())}
print((', '.join(names.get(id(arg),'?... | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {
id(v): k
for k, v in list(inspect.currentframe().f_back.f_locals.items())
}
print(('... | 43 | 45 | 794 | 750 | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v): k for k, v in list(inspect.currentframe().f_back.f_locals.items())}
print((", ".join(names.get(id(arg), "???") + " = ... | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v): k for k, v in list(inspect.currentframe().f_back.f_locals.items())}
print((", ".join(names.get(id(arg), "???") + " = ... | false | 4.444444 | [
"-# Set 2 dimension list",
"-def dim2input(N):",
"- li = []",
"- for _ in range(N):",
"- li.append(list(map(int, eval(input()))))",
"- return li",
"+def li_input():",
"+ return [int(_) for _ in input().split()]",
"- N = eval(input())",
"- fx = 0",
"- for n in N:",
"... | false | 0.083442 | 0.046884 | 1.779758 | [
"s735941401",
"s085782872"
] |
u086503932 | p03739 | python | s093617570 | s135709143 | 136 | 116 | 14,212 | 20,316 | Accepted | Accepted | 14.71 | #!/usr/bin/env python3
from itertools import accumulate
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
a = list(accumulate(a))
ans = 10**18
for j in range(2):# 偶数行が正か奇数行が正
ans2 = 0
diff = 0
for i in range(n):
p = a[i] + dif... | N = int(eval(input()))
A = list(map(int, input().split()))
# 方針:正負正...と負正負...の両方を試す
ans = 0
now = 0
for i in range(N):
if i % 2 == 0:# 正にする
if now+A[i] <= 0:
ans += 1 - (now+A[i])
now = 1
else:
now += A[i]
else:
if now+A[i] >= 0:
... | 28 | 36 | 674 | 752 | #!/usr/bin/env python3
from itertools import accumulate
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
a = list(accumulate(a))
ans = 10**18
for j in range(2): # 偶数行が正か奇数行が正
ans2 = 0
diff = 0
for i in range(n):
p = a[i] + diff
... | N = int(eval(input()))
A = list(map(int, input().split()))
# 方針:正負正...と負正負...の両方を試す
ans = 0
now = 0
for i in range(N):
if i % 2 == 0: # 正にする
if now + A[i] <= 0:
ans += 1 - (now + A[i])
now = 1
else:
now += A[i]
else:
if now + A[i] >= 0:
an... | false | 22.222222 | [
"-#!/usr/bin/env python3",
"-from itertools import accumulate",
"-",
"-",
"-def main():",
"- n = int(eval(input()))",
"- a = list(map(int, input().split()))",
"- a = list(accumulate(a))",
"- ans = 10**18",
"- for j in range(2): # 偶数行が正か奇数行が正",
"- ans2 = 0",
"- dif... | false | 0.040838 | 0.045819 | 0.891274 | [
"s093617570",
"s135709143"
] |
u888092736 | p03583 | python | s940430420 | s910625206 | 758 | 587 | 109,520 | 109,612 | Accepted | Accepted | 22.56 | from numba import njit
@njit
def solve(N):
for b in range(1, 3500 + 1):
for c in range(1, 3500 + 1):
num = N * b * c
den = 4 * b * c - N * b - N * c
if den > 0 and num % den == 0:
return num // den, b, c
N = int(eval(input()))
print((*sol... | from numba import njit
@njit("UniTuple(i8, 3)(i8)")
def solve(N):
for b in range(1, 3500 + 1):
for c in range(1, 3500 + 1):
num = N * b * c
den = 4 * b * c - N * b - N * c
if den > 0 and num % den == 0:
a = num // den
return a,... | 15 | 18 | 320 | 388 | from numba import njit
@njit
def solve(N):
for b in range(1, 3500 + 1):
for c in range(1, 3500 + 1):
num = N * b * c
den = 4 * b * c - N * b - N * c
if den > 0 and num % den == 0:
return num // den, b, c
N = int(eval(input()))
print((*solve(N)))
| from numba import njit
@njit("UniTuple(i8, 3)(i8)")
def solve(N):
for b in range(1, 3500 + 1):
for c in range(1, 3500 + 1):
num = N * b * c
den = 4 * b * c - N * b - N * c
if den > 0 and num % den == 0:
a = num // den
return a, b, c
r... | false | 16.666667 | [
"-@njit",
"+@njit(\"UniTuple(i8, 3)(i8)\")",
"- return num // den, b, c",
"+ a = num // den",
"+ return a, b, c",
"+ return 0, 0, 0"
] | false | 0.045337 | 0.089408 | 0.507084 | [
"s940430420",
"s910625206"
] |
u777283665 | p02845 | python | s988303045 | s731960478 | 324 | 109 | 13,964 | 14,092 | Accepted | Accepted | 66.36 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 1
cnt = [0, 0, 0]
for i in range(n):
ans *= cnt.count(a[i])
if a[i] not in cnt:
print((0))
exit()
ind = cnt.index(a[i])
cnt[ind] += 1
print((ans % mod)) | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 1
cnt = [0, 0, 0]
for i in a:
ans *= cnt.count(i)
ans %= mod
if i not in cnt:
print((0))
exit()
ind = cnt.index(i)
cnt[ind] += 1
print(ans) | 15 | 16 | 273 | 267 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1
cnt = [0, 0, 0]
for i in range(n):
ans *= cnt.count(a[i])
if a[i] not in cnt:
print((0))
exit()
ind = cnt.index(a[i])
cnt[ind] += 1
print((ans % mod))
| n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1
cnt = [0, 0, 0]
for i in a:
ans *= cnt.count(i)
ans %= mod
if i not in cnt:
print((0))
exit()
ind = cnt.index(i)
cnt[ind] += 1
print(ans)
| false | 6.25 | [
"-for i in range(n):",
"- ans *= cnt.count(a[i])",
"- if a[i] not in cnt:",
"+for i in a:",
"+ ans *= cnt.count(i)",
"+ ans %= mod",
"+ if i not in cnt:",
"- ind = cnt.index(a[i])",
"+ ind = cnt.index(i)",
"-print((ans % mod))",
"+print(ans)"
] | false | 0.034791 | 0.058861 | 0.591066 | [
"s988303045",
"s731960478"
] |
u576432509 | p03061 | python | s310150617 | s572776542 | 1,802 | 230 | 14,204 | 16,132 | Accepted | Accepted | 87.24 | def gcdf(a):
a.sort()
a0=a[0]
a=[int(x%a0) for x in a if x%a0 != 0]
if len(a)==0:
return a0
else:
a.append(a0)
a0=min(a)
return gcdf(a)
n=int(eval(input()))
a=list(map(int,input().split()))
if n==2:
print((max(a)))
elif n<2**8:
gcdv=0
... | # ==================== gcd 最大公約数
from fractions import gcd
#from math import gcd
n=int(eval(input()))
a=list(map(int,input().split()))
l=[0]*(n+1)
r=[0]*(n+1)
for i in range(n):
l[i+1]=gcd(l[i],a[i])
r[n-i-1]=gcd(r[n-i],a[n-i-1])
mimax=1
for i in range(n):
mi=gcd(l[i],r[i+1])
mima... | 58 | 20 | 1,218 | 348 | def gcdf(a):
a.sort()
a0 = a[0]
a = [int(x % a0) for x in a if x % a0 != 0]
if len(a) == 0:
return a0
else:
a.append(a0)
a0 = min(a)
return gcdf(a)
n = int(eval(input()))
a = list(map(int, input().split()))
if n == 2:
print((max(a)))
elif n < 2**8:
gcdv = 0
... | # ==================== gcd 最大公約数
from fractions import gcd
# from math import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * (n + 1)
r = [0] * (n + 1)
for i in range(n):
l[i + 1] = gcd(l[i], a[i])
r[n - i - 1] = gcd(r[n - i], a[n - i - 1])
mimax = 1
for i in range(n):
mi = gcd(l... | false | 65.517241 | [
"-def gcdf(a):",
"- a.sort()",
"- a0 = a[0]",
"- a = [int(x % a0) for x in a if x % a0 != 0]",
"- if len(a) == 0:",
"- return a0",
"- else:",
"- a.append(a0)",
"- a0 = min(a)",
"- return gcdf(a)",
"+# ==================== gcd 最大公約数",
"+from fraction... | false | 0.046111 | 0.04788 | 0.96306 | [
"s310150617",
"s572776542"
] |
u802963389 | p03434 | python | s689690855 | s263346065 | 180 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.56 | n = int(eval(input()))
c = list(map(int, input().split()))
c.sort(reverse=True)
a = sum([v for i, v in enumerate(c) if i % 2 == 0 ])
b = sum([v for i, v in enumerate(c) if i % 2 == 1 ])
print((a - b)) | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = sum(A[::2]) - sum(A[1::2])
print(ans) | 6 | 5 | 197 | 121 | n = int(eval(input()))
c = list(map(int, input().split()))
c.sort(reverse=True)
a = sum([v for i, v in enumerate(c) if i % 2 == 0])
b = sum([v for i, v in enumerate(c) if i % 2 == 1])
print((a - b))
| n = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = sum(A[::2]) - sum(A[1::2])
print(ans)
| false | 16.666667 | [
"-c = list(map(int, input().split()))",
"-c.sort(reverse=True)",
"-a = sum([v for i, v in enumerate(c) if i % 2 == 0])",
"-b = sum([v for i, v in enumerate(c) if i % 2 == 1])",
"-print((a - b))",
"+A = list(map(int, input().split()))",
"+A.sort(reverse=True)",
"+ans = sum(A[::2]) - sum(A[1::2])",
"+... | false | 0.039894 | 0.034405 | 1.15954 | [
"s689690855",
"s263346065"
] |
u488127128 | p03221 | python | s292310775 | s550141014 | 675 | 462 | 31,908 | 31,352 | Accepted | Accepted | 31.56 | n, m = list(map(int, input().split()))
A = []
B = [''] * m
for i in range(m):
p, y = list(map(int, input().split()))
A.append([p,y,i])
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
B[a[2]] = '{:06}{:06}'.format(a[0], x)
else:
i, x = a[0], 1
B[a[2]] = '{:0... | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
A = []
B = [''] * m
for i in range(m):
p, y = list(map(int, input().split()))
A.append([p,y,i])
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
... | 18 | 26 | 371 | 542 | n, m = list(map(int, input().split()))
A = []
B = [""] * m
for i in range(m):
p, y = list(map(int, input().split()))
A.append([p, y, i])
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
B[a[2]] = "{:06}{:06}".format(a[0], x)
else:
i, x = a[0], 1
B[a[2]] = "{:06}{:06}".for... | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
A = []
B = [""] * m
for i in range(m):
p, y = list(map(int, input().split()))
A.append([p, y, i])
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
B[a[2... | false | 30.769231 | [
"-n, m = list(map(int, input().split()))",
"-A = []",
"-B = [\"\"] * m",
"-for i in range(m):",
"- p, y = list(map(int, input().split()))",
"- A.append([p, y, i])",
"-A.sort()",
"-count = 0",
"-i, x = 1, 1",
"-for a in A:",
"- if a[0] == i:",
"- B[a[2]] = \"{:06}{:06}\".format(... | false | 0.05448 | 0.036699 | 1.484503 | [
"s292310775",
"s550141014"
] |
u827202523 | p02901 | python | s258144409 | s233068949 | 272 | 181 | 42,972 | 74,896 | Accepted | Accepted | 33.46 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
from bisect import bisect_left
INF = 10**10
n, m = getList()
dp = [INF for i in range(1<<n)]
dp[0] = 0
for i in range(m... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = ... | 36 | 57 | 729 | 1,076 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
from bisect import bisect_left
INF = 10**10
n, m = getList()
dp = [INF for i in range(1 << n)]
dp[0] = 0
for i in range(m):
a, b... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(i... | false | 36.842105 | [
"+from collections import defaultdict, deque, Counter",
"+import math",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"-sys.setrecursionlimit(100000)",
"+getS = lambda: input().strip()",
"+getN ... | false | 0.046314 | 0.068167 | 0.679418 | [
"s258144409",
"s233068949"
] |
u533039576 | p02788 | python | s264232250 | s795835685 | 1,414 | 866 | 94,808 | 89,692 | Accepted | Accepted | 38.76 | from operator import itemgetter
from bisect import bisect_right
n, d, a = list(map(int, input().split()))
monster = [tuple(map(int, input().split())) for _ in range(n)]
monster.sort(key=itemgetter(0))
xx = [xi for xi, hi in monster]
ans = 0
imos = [0] * (n + 1)
for i, (xi, hi) in enumerate(monster):
hi -... | from operator import itemgetter
from bisect import bisect_right
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
monster = [tuple(map(int, input().split())) for _ in range(n)]
monster.sort(key=itemgetter(0))
xx = [xi for xi, hi in monster]
ans = 0
imos = [0] * (n + 1)
for i,... | 22 | 25 | 550 | 592 | from operator import itemgetter
from bisect import bisect_right
n, d, a = list(map(int, input().split()))
monster = [tuple(map(int, input().split())) for _ in range(n)]
monster.sort(key=itemgetter(0))
xx = [xi for xi, hi in monster]
ans = 0
imos = [0] * (n + 1)
for i, (xi, hi) in enumerate(monster):
hi -= imos[i]
... | from operator import itemgetter
from bisect import bisect_right
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
monster = [tuple(map(int, input().split())) for _ in range(n)]
monster.sort(key=itemgetter(0))
xx = [xi for xi, hi in monster]
ans = 0
imos = [0] * (n + 1)
for i, (xi, hi) in ... | false | 12 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.181321 | 0.090454 | 2.004564 | [
"s264232250",
"s795835685"
] |
u910288980 | p03436 | python | s991954804 | s468480457 | 316 | 49 | 45,160 | 3,952 | Accepted | Accepted | 84.49 | import queue
def solve():
h, w = list(map(int, input().split()))
field = [eval(input()) for _ in range(h)]
dist = [[h*w*100 for i in range(w)] for j in range(h)]
dist[0][0] = 1
q = queue.Queue()
q.put((0,0))
dx = [-1,1,0,0]
dy = [0,0,1,-1]
while not q.empty() :
... | import queue
def solve():
h, w = list(map(int, input().split()))
field = [eval(input()) for _ in range(h)]
dist = [[h*w*100 for i in range(w)] for j in range(h)]
dist[0][0] = 1
q = queue.Queue()
q.put((0,0))
while not q.empty() :
(x,y) = q.get()
nd = dist[... | 43 | 36 | 977 | 835 | import queue
def solve():
h, w = list(map(int, input().split()))
field = [eval(input()) for _ in range(h)]
dist = [[h * w * 100 for i in range(w)] for j in range(h)]
dist[0][0] = 1
q = queue.Queue()
q.put((0, 0))
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
while not q.empty():
(x... | import queue
def solve():
h, w = list(map(int, input().split()))
field = [eval(input()) for _ in range(h)]
dist = [[h * w * 100 for i in range(w)] for j in range(h)]
dist[0][0] = 1
q = queue.Queue()
q.put((0, 0))
while not q.empty():
(x, y) = q.get()
nd = dist[x][y] + 1
... | false | 16.27907 | [
"- dx = [-1, 1, 0, 0]",
"- dy = [0, 0, 1, -1]",
"+ nd = dist[x][y] + 1",
"- if field[nx][ny] == \"#\":",
"- continue",
"- if dist[nx][ny] > dist[x][y] + 1:",
"- dist[nx][ny] = dist[x][y] + 1",
"+ if field[nx][ny] == \".\" and ... | false | 0.040944 | 0.065446 | 0.625606 | [
"s991954804",
"s468480457"
] |
u519939795 | p03308 | python | s951070044 | s092220492 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
a = list(map(int,input().split()))
p =[]
for i in range(N):
for j in range(N):
p.append(abs(a[i]-a[j]))
print((max(p))) | n=int(eval(input()))
a=sorted(map(int,input().split()))
print((a[-1]-a[0])) | 7 | 3 | 152 | 69 | N = int(eval(input()))
a = list(map(int, input().split()))
p = []
for i in range(N):
for j in range(N):
p.append(abs(a[i] - a[j]))
print((max(p)))
| n = int(eval(input()))
a = sorted(map(int, input().split()))
print((a[-1] - a[0]))
| false | 57.142857 | [
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-p = []",
"-for i in range(N):",
"- for j in range(N):",
"- p.append(abs(a[i] - a[j]))",
"-print((max(p)))",
"+n = int(eval(input()))",
"+a = sorted(map(int, input().split()))",
"+print((a[-1] - a[0]))"
] | false | 0.042771 | 0.04694 | 0.91119 | [
"s951070044",
"s092220492"
] |
u543954314 | p02615 | python | s485650907 | s910945979 | 122 | 107 | 31,208 | 31,416 | Accepted | Accepted | 12.3 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
a = sorted(nl... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
a = sorted(nl... | 28 | 17 | 580 | 408 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n = ni()
a = sorted(nl(), reverse... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n = ni()
a = sorted(nl(), reverse... | false | 39.285714 | [
"- c = a[0]",
"- n -= 2",
"- for x in a[1:]:",
"- if n == 0:",
"- break",
"- if n == 1:",
"- c += x",
"- n -= 1",
"- else:",
"- c += x * 2",
"- n -= 2",
"- print(c)",
"+ print(sum(a[: n // 2]) + sum(a[... | false | 0.037586 | 0.035645 | 1.054436 | [
"s485650907",
"s910945979"
] |
u225388820 | p03175 | python | s573219955 | s975186379 | 804 | 722 | 110,128 | 110,128 | Accepted | Accepted | 10.2 | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
mod=10**9+7
n=int(eval(input()))
es=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
es[a-1].append(b-1)
es[b-1].append(a-1)
dp=[[0,0] for i in range(n)]
def dfs(v,c,p):
if dp[v][c]:
r... | #dp[i][j]=(頂点iをjで塗った時,iを親とする部分木の塗り方の場合の数) j=0:黒 j=1:白
#dp[i][0]=(dp[k][0])の総乗(kはiの子)
#dp[i][1]=(dp[k][0]+dp[k][1])の総乗(kはiの子)
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
mod=10**9+7
n=int(eval(input()))
es=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split... | 29 | 27 | 670 | 694 | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
es = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
dp = [[0, 0] for i in range(n)]
def dfs(v, c, p):
if... | # dp[i][j]=(頂点iをjで塗った時,iを親とする部分木の塗り方の場合の数) j=0:黒 j=1:白
# dp[i][0]=(dp[k][0])の総乗(kはiの子)
# dp[i][1]=(dp[k][0]+dp[k][1])の総乗(kはiの子)
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
es = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, inpu... | false | 6.896552 | [
"+# dp[i][j]=(頂点iをjで塗った時,iを親とする部分木の塗り方の場合の数) j=0:黒 j=1:白",
"+# dp[i][0]=(dp[k][0])の総乗(kはiの子)",
"+# dp[i][1]=(dp[k][0]+dp[k][1])の総乗(kはiの子)",
"-def dfs(v, c, p):",
"- if dp[v][c]:",
"- return dp[v][c]",
"- ans = 1",
"- if c:",
"- for i in es[v]:",
"- if i - p:",
"... | false | 0.037672 | 0.041945 | 0.898132 | [
"s573219955",
"s975186379"
] |
u505830998 | p03294 | python | s570166163 | s381128610 | 85 | 12 | 2,820 | 3,008 | Accepted | Accepted | 85.88 | # -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
l = list(map(int, input().split()))
c = 1
for a in l:
c=c*a
ret= sum([(c-1)%a for a in l])
print(ret)
| # -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
l = list(map(int, input().split()))
ret= sum([(a-1) for a in l])
print(ret) | 12 | 8 | 182 | 149 | # -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
l = list(map(int, input().split()))
c = 1
for a in l:
c = c * a
ret = sum([(c - 1) % a for a in l])
print(ret)
| # -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
l = list(map(int, input().split()))
ret = sum([(a - 1) for a in l])
print(ret)
| false | 33.333333 | [
"-c = 1",
"-for a in l:",
"- c = c * a",
"-ret = sum([(c - 1) % a for a in l])",
"+ret = sum([(a - 1) for a in l])"
] | false | 0.037559 | 0.038399 | 0.978144 | [
"s570166163",
"s381128610"
] |
u038724782 | p02702 | python | s620236024 | s191358595 | 347 | 137 | 10,328 | 10,596 | Accepted | Accepted | 60.52 | s_l = list(eval(input()))
n = len(s_l)
# 公式解説参照
dp_dict = {0:1}
t = 0
for i in range(n):
a = int(s_l[-(i+1)])
t = (t + a*(pow(10,i,2019)))%2019
dp_dict[t] = dp_dict.get(t,0) + 1
ans = 0
for val in list(dp_dict.values()):
ans += val*(val-1)//2
print(ans)
| s_l = list(eval(input()))
n = len(s_l)
# 公式解説参照
dp_dict = {0:1}
t = 0
x = 1
for i in range(n):
a = int(s_l[-(i+1)])
t = (t + a*x)%2019
x = x*10 %2019
dp_dict[t] = dp_dict.get(t,0) + 1
ans = 0
for val in list(dp_dict.values()):
ans += val*(val-1)//2
print(ans)
| 16 | 18 | 276 | 288 | s_l = list(eval(input()))
n = len(s_l)
# 公式解説参照
dp_dict = {0: 1}
t = 0
for i in range(n):
a = int(s_l[-(i + 1)])
t = (t + a * (pow(10, i, 2019))) % 2019
dp_dict[t] = dp_dict.get(t, 0) + 1
ans = 0
for val in list(dp_dict.values()):
ans += val * (val - 1) // 2
print(ans)
| s_l = list(eval(input()))
n = len(s_l)
# 公式解説参照
dp_dict = {0: 1}
t = 0
x = 1
for i in range(n):
a = int(s_l[-(i + 1)])
t = (t + a * x) % 2019
x = x * 10 % 2019
dp_dict[t] = dp_dict.get(t, 0) + 1
ans = 0
for val in list(dp_dict.values()):
ans += val * (val - 1) // 2
print(ans)
| false | 11.111111 | [
"+x = 1",
"- t = (t + a * (pow(10, i, 2019))) % 2019",
"+ t = (t + a * x) % 2019",
"+ x = x * 10 % 2019"
] | false | 0.043462 | 0.040772 | 1.065984 | [
"s620236024",
"s191358595"
] |
u969850098 | p03105 | python | s988247636 | s358802000 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | A, B, C = list(map(int, input().split()))
retval = B // A
print((min(retval, C))) | A, B, C = list(map(int, input().split()))
print((min(C, B // A))) | 3 | 3 | 75 | 60 | A, B, C = list(map(int, input().split()))
retval = B // A
print((min(retval, C)))
| A, B, C = list(map(int, input().split()))
print((min(C, B // A)))
| false | 0 | [
"-retval = B // A",
"-print((min(retval, C)))",
"+print((min(C, B // A)))"
] | false | 0.044588 | 0.04425 | 1.00765 | [
"s988247636",
"s358802000"
] |
u318427318 | p02861 | python | s585208387 | s945924009 | 303 | 216 | 3,064 | 9,212 | Accepted | Accepted | 28.71 | import itertools
import math
def main():
lists = []
i=0
N= int(eval(input()))
while i < N:
a = [int(j) for j in input().split()]
lists.append(a)
i+=1
ans=0
length=0
for line in itertools.permutations(lists):
a = []
b = []
for d... | #-*-coding:utf-8-*-
import itertools
import math
def main():
lists = []
N= int(eval(input()))
lists=[list(map(int,input().split())) for _ in range(N)]
ans=0
length=0
#permutationsは順列を列挙
for line in itertools.permutations(lists):
a = []
b = []
for data i... | 29 | 28 | 650 | 667 | import itertools
import math
def main():
lists = []
i = 0
N = int(eval(input()))
while i < N:
a = [int(j) for j in input().split()]
lists.append(a)
i += 1
ans = 0
length = 0
for line in itertools.permutations(lists):
a = []
b = []
for data in... | # -*-coding:utf-8-*-
import itertools
import math
def main():
lists = []
N = int(eval(input()))
lists = [list(map(int, input().split())) for _ in range(N)]
ans = 0
length = 0
# permutationsは順列を列挙
for line in itertools.permutations(lists):
a = []
b = []
for data in l... | false | 3.448276 | [
"+# -*-coding:utf-8-*-",
"- i = 0",
"- while i < N:",
"- a = [int(j) for j in input().split()]",
"- lists.append(a)",
"- i += 1",
"+ lists = [list(map(int, input().split())) for _ in range(N)]",
"+ # permutationsは順列を列挙",
"+ # factorical=階上の値"
] | false | 0.076739 | 0.103671 | 0.740222 | [
"s585208387",
"s945924009"
] |
u790710233 | p02631 | python | s550300022 | s666568521 | 174 | 143 | 31,976 | 31,972 | Accepted | Accepted | 17.82 | from functools import reduce
from operator import xor
n = int(eval(input()))
A = list(map(int, input().split()))
total = []
it = iter(A)
for x, y in zip(it, it):
total.append(x ^ y)
total = reduce(xor, total)
ans = []
for a in A:
ans.append(total ^ a)
print((*ans))
| from operator import xor
from functools import reduce
n = int(eval(input()))
A = list(map(int, input().split()))
total = reduce(xor, A)
print((*[total ^ a for a in A]))
| 17 | 6 | 286 | 166 | from functools import reduce
from operator import xor
n = int(eval(input()))
A = list(map(int, input().split()))
total = []
it = iter(A)
for x, y in zip(it, it):
total.append(x ^ y)
total = reduce(xor, total)
ans = []
for a in A:
ans.append(total ^ a)
print((*ans))
| from operator import xor
from functools import reduce
n = int(eval(input()))
A = list(map(int, input().split()))
total = reduce(xor, A)
print((*[total ^ a for a in A]))
| false | 64.705882 | [
"+from operator import xor",
"-from operator import xor",
"-total = []",
"-it = iter(A)",
"-for x, y in zip(it, it):",
"- total.append(x ^ y)",
"-total = reduce(xor, total)",
"-ans = []",
"-for a in A:",
"- ans.append(total ^ a)",
"-print((*ans))",
"+total = reduce(xor, A)",
"+print((*... | false | 0.040938 | 0.039315 | 1.041276 | [
"s550300022",
"s666568521"
] |
u728992264 | p00935 | python | s342975036 | s552349706 | 30 | 20 | 7,620 | 7,624 | Accepted | Accepted | 33.33 | j=''.join
n=int(eval(input()))
d=j(j(input().split())for i in[0]*(n//19+(n%19!=0)))
i=0
while 1:
if d.find(str(i))<0:
print(i)
exit()
i+=1 | j=''.join
u=input
n=int(u())
d=j(j(u().split())for i in[0]*(n//19+(n%19!=0)))
i=0
while 1:
if d.find(str(i))<0:
print(i)
exit()
i+=1 | 9 | 10 | 147 | 148 | j = "".join
n = int(eval(input()))
d = j(j(input().split()) for i in [0] * (n // 19 + (n % 19 != 0)))
i = 0
while 1:
if d.find(str(i)) < 0:
print(i)
exit()
i += 1
| j = "".join
u = input
n = int(u())
d = j(j(u().split()) for i in [0] * (n // 19 + (n % 19 != 0)))
i = 0
while 1:
if d.find(str(i)) < 0:
print(i)
exit()
i += 1
| false | 10 | [
"-n = int(eval(input()))",
"-d = j(j(input().split()) for i in [0] * (n // 19 + (n % 19 != 0)))",
"+u = input",
"+n = int(u())",
"+d = j(j(u().split()) for i in [0] * (n // 19 + (n % 19 != 0)))"
] | false | 0.041695 | 0.041163 | 1.012935 | [
"s342975036",
"s552349706"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.