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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u350997995 | p04045 | python | s253173002 | s166478182 | 83 | 57 | 2,940 | 2,940 | Accepted | Accepted | 31.33 | N,K = list(map(int,input().split()))
D = set(input().split())
while 1:
E = set(str(N))
if not(D&E):
print(N)
break
N+=1 | N,K = list(map(int,input().split()))
D = list(input().split())
for i in range(N,100001):
n = str(i)
k = 1
for j in n:
if j in D:
k=0
break
if k:
print(n)
break | 8 | 12 | 148 | 228 | N, K = list(map(int, input().split()))
D = set(input().split())
while 1:
E = set(str(N))
if not (D & E):
print(N)
break
N += 1
| N, K = list(map(int, input().split()))
D = list(input().split())
for i in range(N, 100001):
n = str(i)
k = 1
for j in n:
if j in D:
k = 0
break
if k:
print(n)
break
| false | 33.333333 | [
"-D = set(input().split())",
"-while 1:",
"- E = set(str(N))",
"- if not (D & E):",
"- print(N)",
"+D = list(input().split())",
"+for i in range(N, 100001):",
"+ n = str(i)",
"+ k = 1",
"+ for j in n:",
"+ if j in D:",
"+ k = 0",
"+ break",
... | false | 0.047225 | 0.047021 | 1.004329 | [
"s253173002",
"s166478182"
] |
u022979415 | p02714 | python | s813682141 | s915472248 | 1,522 | 1,054 | 69,120 | 9,196 | Accepted | Accepted | 30.75 | from bisect import bisect_right, bisect_left
from itertools import permutations
def main():
n = int(eval(input()))
s = eval(input())
ind = [[] for _ in range(3)]
for i in range(n):
if s[i] == "R":
ind[0].append(i)
elif s[i] == "G":
ind[1].append(i)
... | def main():
n = int(eval(input()))
s = eval(input())
answer = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
for j in range(i + 1, n):
k = 2 * j - i
if n <= k:
continue
elif s[i] != s[j] and s[i] != s[k] and s[j] != s[k]... | 36 | 17 | 1,032 | 404 | from bisect import bisect_right, bisect_left
from itertools import permutations
def main():
n = int(eval(input()))
s = eval(input())
ind = [[] for _ in range(3)]
for i in range(n):
if s[i] == "R":
ind[0].append(i)
elif s[i] == "G":
ind[1].append(i)
else:... | def main():
n = int(eval(input()))
s = eval(input())
answer = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
for j in range(i + 1, n):
k = 2 * j - i
if n <= k:
continue
elif s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
... | false | 52.777778 | [
"-from bisect import bisect_right, bisect_left",
"-from itertools import permutations",
"-",
"-",
"- ind = [[] for _ in range(3)]",
"+ answer = s.count(\"R\") * s.count(\"G\") * s.count(\"B\")",
"- if s[i] == \"R\":",
"- ind[0].append(i)",
"- elif s[i] == \"G\":",
"-... | false | 0.035063 | 0.041376 | 0.847411 | [
"s813682141",
"s915472248"
] |
u600402037 | p02889 | python | s028090662 | s566436092 | 1,777 | 1,016 | 70,108 | 58,204 | Accepted | Accepted | 42.82 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M, L = lr()
INF = 10 ** 19
dis = [[INF for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
a, b, c = lr()
if c > L:
continue
dis[a][b] = c
dis[b][a] ... | import sys
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
INF = 10 ** 15
def warshall_floyd(dist, n):
for k in range(n):
for i in range(n):
for j in range(n):
dist[i][j] = ... | 45 | 38 | 1,076 | 953 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M, L = lr()
INF = 10**19
dis = [[INF for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
a, b, c = lr()
if c > L:
continue
dis[a][b] = c
dis[b][a] = c
for k in ... | import sys
sys.setrecursionlimit(10**9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
INF = 10**15
def warshall_floyd(dist, n):
for k in range(n):
for i in range(n):
for j in range(n):
dist[i][j] = min(dist[i][j], d... | false | 15.555556 | [
"+sys.setrecursionlimit(10**9)",
"+INF = 10**15",
"+",
"+",
"+def warshall_floyd(dist, n):",
"+ for k in range(n):",
"+ for i in range(n):",
"+ for j in range(n):",
"+ dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])",
"+ return dist",
"+",
"+",
"-... | false | 0.048144 | 0.043875 | 1.097297 | [
"s028090662",
"s566436092"
] |
u503263570 | p00002 | python | s227320755 | s186241391 | 20 | 10 | 7,516 | 7,676 | Accepted | Accepted | 50 | import sys
for a in sys.stdin:
b,c=list(map(int,a.split()))
d=len(str(b+c))
print(d) | import sys
a=[map(int,i.split())for i in sys.stdin]
[print(len(str(b+c)))for b,c in a]
| 5 | 3 | 94 | 88 | import sys
for a in sys.stdin:
b, c = list(map(int, a.split()))
d = len(str(b + c))
print(d)
| import sys
a = [map(int, i.split()) for i in sys.stdin]
[print(len(str(b + c))) for b, c in a]
| false | 40 | [
"-for a in sys.stdin:",
"- b, c = list(map(int, a.split()))",
"- d = len(str(b + c))",
"- print(d)",
"+a = [map(int, i.split()) for i in sys.stdin]",
"+[print(len(str(b + c))) for b, c in a]"
] | false | 0.036529 | 0.036468 | 1.001674 | [
"s227320755",
"s186241391"
] |
u506858457 | p02623 | python | s691420999 | s793181129 | 290 | 146 | 47,368 | 119,700 | Accepted | Accepted | 49.66 | N,M,K=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[0]
B=[0]
ans=0
j=M
for i in range(N):
A.append(A[i]+a[i])
for i in range(M):
B.append(B[i]+b[i])
for i in range(N+1):
if A[i]>K:
break
while A[i]+B[j]>K:
j-=1
ans=max(ans,i+j)
pri... | def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
n,m,k=MI()
a=[0]+LI()
b=[0]+LI()
for i in range(1,n+1):
a[i]+=a[i-1]
for i in range(1,m+1):
b[i]+=b[i-1]
ans=0
j=m
for i in range(n+1):
if a[i]>k:
continue
while a[i]+b[j]>k:
j-=1
ans=max(... | 18 | 18 | 322 | 334 | N, M, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A = [0]
B = [0]
ans = 0
j = M
for i in range(N):
A.append(A[i] + a[i])
for i in range(M):
B.append(B[i] + b[i])
for i in range(N + 1):
if A[i] > K:
break
while A[i] + B[j] > K:
... | def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
n, m, k = MI()
a = [0] + LI()
b = [0] + LI()
for i in range(1, n + 1):
a[i] += a[i - 1]
for i in range(1, m + 1):
b[i] += b[i - 1]
ans = 0
j = m
for i in range(n + 1):
if a[i] > k:
continue
... | false | 0 | [
"-N, M, K = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-A = [0]",
"-B = [0]",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def LI():",
"+ return list(map(int, input().split()))",
"+",
"+",
... | false | 0.09986 | 0.047047 | 2.122574 | [
"s691420999",
"s793181129"
] |
u657994700 | p03111 | python | s816332098 | s770664448 | 252 | 63 | 12,872 | 3,064 | Accepted | Accepted | 75 | import itertools
N, A, B, C = list(map(int, input().split()))
l = []
for i in range(N):
l.append(int(eval(input())))
prod = list(itertools.product(['A','B','C','X'], repeat=N))
mps = []
for prod_e in prod:
if prod_e.count('A') * prod_e.count('B') * prod_e.count('C') != 0:
mp = 0
... | N, A, B, C = list(map(int, input().split()))
l = []
for i in range(N):
l.append(int(eval(input())))
def dfs(syn, n, a, b, c):
if n == N:
if a*b*c != 0:
mp = abs(A-a) + abs(B-b) + abs(C-c)
mp += syn * 10 - 30
return mp
else:
retur... | 23 | 22 | 671 | 614 | import itertools
N, A, B, C = list(map(int, input().split()))
l = []
for i in range(N):
l.append(int(eval(input())))
prod = list(itertools.product(["A", "B", "C", "X"], repeat=N))
mps = []
for prod_e in prod:
if prod_e.count("A") * prod_e.count("B") * prod_e.count("C") != 0:
mp = 0
length = {"A... | N, A, B, C = list(map(int, input().split()))
l = []
for i in range(N):
l.append(int(eval(input())))
def dfs(syn, n, a, b, c):
if n == N:
if a * b * c != 0:
mp = abs(A - a) + abs(B - b) + abs(C - c)
mp += syn * 10 - 30
return mp
else:
return 10**9... | false | 4.347826 | [
"-import itertools",
"-",
"-prod = list(itertools.product([\"A\", \"B\", \"C\", \"X\"], repeat=N))",
"-mps = []",
"-for prod_e in prod:",
"- if prod_e.count(\"A\") * prod_e.count(\"B\") * prod_e.count(\"C\") != 0:",
"- mp = 0",
"- length = {\"A\": 0, \"B\": 0, \"C\": 0, \"X\": 0}",
... | false | 0.269558 | 0.094808 | 2.843199 | [
"s816332098",
"s770664448"
] |
u929569377 | p02768 | python | s345667679 | s848825058 | 149 | 108 | 3,064 | 3,064 | Accepted | Accepted | 27.52 | n, a, b = list(map(int, input().split()))
MOD = 1000000007
def comb(n, r):
x = 1
y = 1
for i in range(r):
x = x * (n - i) % MOD
y = y * (i + 1) % MOD
return x * pow(y, MOD - 2, MOD) % MOD
ans = pow(2, n, MOD)
ans -= 1
ans -= comb(n, a)
ans -= comb(n, b)
while ans < 0:
... | n, a, b = list(map(int, input().split()))
MOD = 1000000007
ans = pow(2, n, MOD)
ans -= 1
x = 1
y = 1
for i in range(b):
x = x * (n - i) % MOD
y = y * (i + 1) % MOD
if i == a - 1:
ans -= x * pow(y, MOD - 2, MOD) % MOD
ans -= x * pow(y, MOD - 2, MOD) % MOD
while ans < 0:
ans... | 19 | 20 | 341 | 334 | n, a, b = list(map(int, input().split()))
MOD = 1000000007
def comb(n, r):
x = 1
y = 1
for i in range(r):
x = x * (n - i) % MOD
y = y * (i + 1) % MOD
return x * pow(y, MOD - 2, MOD) % MOD
ans = pow(2, n, MOD)
ans -= 1
ans -= comb(n, a)
ans -= comb(n, b)
while ans < 0:
ans += MOD
... | n, a, b = list(map(int, input().split()))
MOD = 1000000007
ans = pow(2, n, MOD)
ans -= 1
x = 1
y = 1
for i in range(b):
x = x * (n - i) % MOD
y = y * (i + 1) % MOD
if i == a - 1:
ans -= x * pow(y, MOD - 2, MOD) % MOD
ans -= x * pow(y, MOD - 2, MOD) % MOD
while ans < 0:
ans += MOD
print(ans)
| false | 5 | [
"-",
"-",
"-def comb(n, r):",
"- x = 1",
"- y = 1",
"- for i in range(r):",
"- x = x * (n - i) % MOD",
"- y = y * (i + 1) % MOD",
"- return x * pow(y, MOD - 2, MOD) % MOD",
"-",
"-",
"-ans -= comb(n, a)",
"-ans -= comb(n, b)",
"+x = 1",
"+y = 1",
"+for i in ra... | false | 0.105536 | 0.102933 | 1.025284 | [
"s345667679",
"s848825058"
] |
u815878613 | p03061 | python | s164539282 | s050860039 | 582 | 207 | 39,332 | 84,484 | Accepted | Accepted | 64.43 | import numpy as np
# 約数列挙(nを含む)
def make_divisors(n):
divisors = set()
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
divisors.add(i)
if i != n // i:
divisors.add(n // i)
return divisors
N = int(eval(input()))
A = np.array(input().spli... | # 約数列挙(nを含む)
def make_divisors(n):
divisors = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
def solver(N, A):
# 答えはA[0]かA[1]の約数
p0 = make_divisors... | 34 | 37 | 600 | 678 | import numpy as np
# 約数列挙(nを含む)
def make_divisors(n):
divisors = set()
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.add(i)
if i != n // i:
divisors.add(n // i)
return divisors
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int6... | # 約数列挙(nを含む)
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
def solver(N, A):
# 答えはA[0]かA[1]の約数
p0 = make_divisors(A[0])
p1 = make_... | false | 8.108108 | [
"-import numpy as np",
"-",
"- divisors = set()",
"+ divisors = []",
"- divisors.add(i)",
"+ divisors.append(i)",
"- divisors.add(n // i)",
"+ divisors.append(n // i)",
"+def solver(N, A):",
"+ # 答えはA[0]かA[1]の約数",
"+ p0 = make_divis... | false | 0.259101 | 0.038527 | 6.725126 | [
"s164539282",
"s050860039"
] |
u571969099 | p03846 | python | s587715911 | s673338588 | 341 | 224 | 66,480 | 56,116 | Accepted | Accepted | 34.31 | i=input
n=int(i())
print(([0,pow(2,n//2,10**9+7)][sorted(i().split(),key=int)==[str((j+n%2)//2*2+1-n%2)for j in range(n)]])) | i=input
n=int(i())
print(([0,pow(2,n//2,10**9+7)][sorted(map(int,i().split()))==[(j+n%2)//2*2+1-n%2for j in range(n)]])) | 3 | 3 | 124 | 120 | i = input
n = int(i())
print(
(
[0, pow(2, n // 2, 10**9 + 7)][
sorted(i().split(), key=int)
== [str((j + n % 2) // 2 * 2 + 1 - n % 2) for j in range(n)]
]
)
)
| i = input
n = int(i())
print(
(
[0, pow(2, n // 2, 10**9 + 7)][
sorted(map(int, i().split()))
== [(j + n % 2) // 2 * 2 + 1 - n % 2 for j in range(n)]
]
)
)
| false | 0 | [
"- sorted(i().split(), key=int)",
"- == [str((j + n % 2) // 2 * 2 + 1 - n % 2) for j in range(n)]",
"+ sorted(map(int, i().split()))",
"+ == [(j + n % 2) // 2 * 2 + 1 - n % 2 for j in range(n)]"
] | false | 0.043696 | 0.043653 | 1.000978 | [
"s587715911",
"s673338588"
] |
u314050667 | p03575 | python | s676429997 | s327470064 | 325 | 156 | 12,504 | 12,436 | Accepted | Accepted | 52 | import numpy as np
import sys
N, M = list(map(int, input().split()))
AB = np.array(sys.stdin.read().split(), np.int64)
A = AB[::2]
B = AB[1::2]
E = np.zeros([N+1, N+1], np.int64)
np.add.at(E,(A,B),1)
np.add.at(E,(B,A),1)
def dfs(E):
flg = np.zeros(1+N)
flg[0] = 0
q = [1]
while q:
cp = q.pop... | import numpy as np
import sys
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
self.Maxroot = -1
def Find_Root(self, x):
if (self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Uni... | 46 | 63 | 672 | 1,273 | import numpy as np
import sys
N, M = list(map(int, input().split()))
AB = np.array(sys.stdin.read().split(), np.int64)
A = AB[::2]
B = AB[1::2]
E = np.zeros([N + 1, N + 1], np.int64)
np.add.at(E, (A, B), 1)
np.add.at(E, (B, A), 1)
def dfs(E):
flg = np.zeros(1 + N)
flg[0] = 0
q = [1]
while q:
... | import numpy as np
import sys
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
self.Maxroot = -1
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_R... | false | 26.984127 | [
"-N, M = list(map(int, input().split()))",
"+",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.root = [-1] * (n + 1)",
"+ self.rnk = [0] * (n + 1)",
"+ self.Maxroot = -1",
"+",
"+ def Find_Root(self, x):",
"+ if self.root[x] < 0:... | false | 0.35243 | 0.231987 | 1.519178 | [
"s676429997",
"s327470064"
] |
u160414758 | p03645 | python | s774631825 | s496011537 | 400 | 294 | 19,148 | 33,136 | Accepted | Accepted | 26.5 | import fileinput
input = fileinput.input().readline
N,M = list(map(int,(input().split())))
seta,setb = set(),set()
for m in range(M):
a,b = list(map(int,(input().split())))
if a == 1:
seta.add(b)
if b == N:
setb.add(a)
if seta & setb:
print("POSSIBLE")
else:... | import sys
lines = sys.stdin.readlines()
N,M = list(map(int,(lines[0].split())))
seta,setb = set(),set()
for m in range(1,M+1):
a,b = list(map(int,(lines[m].split())))
if a == 1:
seta.add(b)
if b == N:
setb.add(a)
if seta & setb:
print("POSSIBLE")
else:
print("IM... | 19 | 14 | 333 | 318 | import fileinput
input = fileinput.input().readline
N, M = list(map(int, (input().split())))
seta, setb = set(), set()
for m in range(M):
a, b = list(map(int, (input().split())))
if a == 1:
seta.add(b)
if b == N:
setb.add(a)
if seta & setb:
print("POSSIBLE")
else:
print("IMPOSSIBLE"... | import sys
lines = sys.stdin.readlines()
N, M = list(map(int, (lines[0].split())))
seta, setb = set(), set()
for m in range(1, M + 1):
a, b = list(map(int, (lines[m].split())))
if a == 1:
seta.add(b)
if b == N:
setb.add(a)
if seta & setb:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 26.315789 | [
"-import fileinput",
"+import sys",
"-input = fileinput.input().readline",
"-N, M = list(map(int, (input().split())))",
"+lines = sys.stdin.readlines()",
"+N, M = list(map(int, (lines[0].split())))",
"-for m in range(M):",
"- a, b = list(map(int, (input().split())))",
"+for m in range(1, M + 1):"... | false | 0.04316 | 0.081387 | 0.530307 | [
"s774631825",
"s496011537"
] |
u691896522 | p03329 | python | s267735932 | s681044762 | 729 | 208 | 3,828 | 45,040 | Accepted | Accepted | 71.47 | import bisect
n = int(eval(input()))
add_num = 1
draw_money = []
while add_num <= 10 ** 5:
draw_money.append(add_num)
add_num *= 6
add_num = 1
while add_num <= 10 ** 5:
draw_money.append(add_num)
add_num *= 9
#重複を削除
draw_money = list(set(draw_money))
ans = 0
draw_money.sort()
# dp... | n = int(eval(input()))
inf = 10**9
dp = [inf for i in range(n+1)]
dp[0] = 0
for i in range(n):
if dp[i] != inf:
#1円引き出す場合
dp[i+1] = min(dp[i] + 1, dp[i+1])
num = 6
while i + num <= n:
dp[i + num] = min(dp[i] + 1, dp[i+num])
num *= 6
num = 9... | 31 | 18 | 594 | 435 | import bisect
n = int(eval(input()))
add_num = 1
draw_money = []
while add_num <= 10**5:
draw_money.append(add_num)
add_num *= 6
add_num = 1
while add_num <= 10**5:
draw_money.append(add_num)
add_num *= 9
# 重複を削除
draw_money = list(set(draw_money))
ans = 0
draw_money.sort()
# dp[i] = i円引き出すのに必要な最小操作
dp ... | n = int(eval(input()))
inf = 10**9
dp = [inf for i in range(n + 1)]
dp[0] = 0
for i in range(n):
if dp[i] != inf:
# 1円引き出す場合
dp[i + 1] = min(dp[i] + 1, dp[i + 1])
num = 6
while i + num <= n:
dp[i + num] = min(dp[i] + 1, dp[i + num])
num *= 6
num = 9
... | false | 41.935484 | [
"-import bisect",
"-",
"-add_num = 1",
"-draw_money = []",
"-while add_num <= 10**5:",
"- draw_money.append(add_num)",
"- add_num *= 6",
"-add_num = 1",
"-while add_num <= 10**5:",
"- draw_money.append(add_num)",
"- add_num *= 9",
"-# 重複を削除",
"-draw_money = list(set(draw_money))"... | false | 0.156262 | 0.63466 | 0.246215 | [
"s267735932",
"s681044762"
] |
u588341295 | p03294 | python | s107664400 | s764601588 | 159 | 18 | 3,812 | 3,316 | Accepted | Accepted | 88.68 | # -*- coding: utf-8 -*-
from functools import reduce
N = int(eval(input()))
aN = list(map(int, input().split()))
def gcd(a, b):
while b > 0:
a, b = b, a%b
return a
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
def f... | # -*- coding: utf-8 -*-
N = int(eval(input()))
aN = list(map(int, input().split()))
print((sum(aN)-N)) | 25 | 6 | 482 | 101 | # -*- coding: utf-8 -*-
from functools import reduce
N = int(eval(input()))
aN = list(map(int, input().split()))
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
def f(num, aN)... | # -*- coding: utf-8 -*-
N = int(eval(input()))
aN = list(map(int, input().split()))
print((sum(aN) - N))
| false | 76 | [
"-from functools import reduce",
"-",
"-",
"-",
"-def gcd(a, b):",
"- while b > 0:",
"- a, b = b, a % b",
"- return a",
"-",
"-",
"-def lcm_base(x, y):",
"- return (x * y) // gcd(x, y)",
"-",
"-",
"-def lcm_list(numbers):",
"- return reduce(lcm_base, numbers, 1)",
... | false | 0.039206 | 0.096981 | 0.404262 | [
"s107664400",
"s764601588"
] |
u222668979 | p02936 | python | s326045197 | s490476162 | 1,647 | 925 | 230,892 | 230,808 | Accepted | Accepted | 43.84 | import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
n, q = list(map(int, input().split()))
edge = [[] for _ in range(n)]
for i in range(n-1):
a, b = list(map(int, input().split()))
edge[a-1].append(b)
edge[b-1].append(a)
cnt = [0 for _ in range(n)]
for i in range(q):
p, x =... | from collections import deque
def nearlist(N, LIST):
NEAR = [set() for _ in range(N)]
for a, b in LIST:
NEAR[a - 1].add(b - 1)
NEAR[b - 1].add(a - 1)
return NEAR
def bfs(NEAR): # 幅優先探索 # キュー
que, frag = deque([0]), set([0])
while que:
q = que.popleft()
... | 27 | 32 | 525 | 769 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
edge = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b)
edge[b - 1].append(a)
cnt = [0 for _ in range(n)]
for i in range(q):
p, x = list(ma... | from collections import deque
def nearlist(N, LIST):
NEAR = [set() for _ in range(N)]
for a, b in LIST:
NEAR[a - 1].add(b - 1)
NEAR[b - 1].add(a - 1)
return NEAR
def bfs(NEAR): # 幅優先探索 # キュー
que, frag = deque([0]), set([0])
while que:
q = que.popleft()
for i in ... | false | 15.625 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**7)",
"-input = sys.stdin.readline",
"-n, q = list(map(int, input().split()))",
"-edge = [[] for _ in range(n)]",
"-for i in range(n - 1):",
"- a, b = list(map(int, input().split()))",
"- edge[a - 1].append(b)",
"- edge[b - 1].append(a)",
"... | false | 0.071288 | 0.094232 | 0.756518 | [
"s326045197",
"s490476162"
] |
u747602774 | p02682 | python | s875291505 | s187498858 | 23 | 20 | 9,156 | 9,068 | Accepted | Accepted | 13.04 | A,B,C,K = list(map(int,input().split()))
ans = min(K,A)
K -= A
if K > 0:
K -= B
if K > 0:
ans -= K
print(ans)
| A,B,C,K = list(map(int,input().split()))
print((min(K,A) - max(0,K-A-B)))
| 9 | 3 | 121 | 69 | A, B, C, K = list(map(int, input().split()))
ans = min(K, A)
K -= A
if K > 0:
K -= B
if K > 0:
ans -= K
print(ans)
| A, B, C, K = list(map(int, input().split()))
print((min(K, A) - max(0, K - A - B)))
| false | 66.666667 | [
"-ans = min(K, A)",
"-K -= A",
"-if K > 0:",
"- K -= B",
"-if K > 0:",
"- ans -= K",
"-print(ans)",
"+print((min(K, A) - max(0, K - A - B)))"
] | false | 0.046978 | 0.039449 | 1.190849 | [
"s875291505",
"s187498858"
] |
u504562455 | p03241 | python | s206325909 | s999043000 | 261 | 74 | 63,004 | 64,224 | Accepted | Accepted | 71.65 | import math
N, M = [int(i) for i in input().split()]
for i in range(M//N, 0, -1):
if M % i == 0:
print(i)
break
| import math
N, M = [int(i) for i in input().split()]
# for i in range(min(math.floor(math.sqrt(M)), M//N), 0, -1):
# if M % i == 0:
# if M // i <= M//N:
# print(max(i, M // i))
# else:
# print(i)
# break
ans = 1
for i in range(1, math.floor(M**0.5)+1):
if M % i == 0:
if M//... | 6 | 19 | 127 | 419 | import math
N, M = [int(i) for i in input().split()]
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break
| import math
N, M = [int(i) for i in input().split()]
# for i in range(min(math.floor(math.sqrt(M)), M//N), 0, -1):
# if M % i == 0:
# if M // i <= M//N:
# print(max(i, M // i))
# else:
# print(i)
# break
ans = 1
for i in range(1, math.floor(M**0.5) + 1):
if M % i == 0:
if M // i <... | false | 68.421053 | [
"-for i in range(M // N, 0, -1):",
"+# for i in range(min(math.floor(math.sqrt(M)), M//N), 0, -1):",
"+# if M % i == 0:",
"+# if M // i <= M//N:",
"+# print(max(i, M // i))",
"+# else:",
"+# print(i)",
"+# break",
"+ans = 1",
"+for i in range(1, math.floor(M**0.5) + 1):",... | false | 0.061474 | 0.107632 | 0.571152 | [
"s206325909",
"s999043000"
] |
u691018832 | p03476 | python | s709262637 | s741417004 | 1,565 | 336 | 7,524 | 32,004 | Accepted | Accepted | 78.53 | import sys
import math
input = sys.stdin.readline
def eratosthenes(limit):
A = [i for i in range(2, limit + 1)]
P = []
for i in range(65):
prime = min(A)
if prime > math.sqrt(limit):
break
P.append(prime)
for j in range(limit):
if... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def makePrimeChecker(n):
isPrime = [True] * (n + 1)
isPrime[0] = False
isPrime[1] = False
for i in range(2, int(n ** 0.5) + 1):
if isPr... | 64 | 29 | 1,313 | 805 | import sys
import math
input = sys.stdin.readline
def eratosthenes(limit):
A = [i for i in range(2, limit + 1)]
P = []
for i in range(65):
prime = min(A)
if prime > math.sqrt(limit):
break
P.append(prime)
for j in range(limit):
if j >= len(A):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
def makePrimeChecker(n):
isPrime = [True] * (n + 1)
isPrime[0] = False
isPrime[1] = False
for i in range(2, int(n**0.5) + 1):
if isPrime[i]:
... | false | 54.6875 | [
"-import math",
"-input = sys.stdin.readline",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7)",
"-def eratosthenes(limit):",
"- A = [i for i in range(2, limit + 1)]",
"- P = []",
"- for i ... | false | 1.272722 | 0.097047 | 13.114467 | [
"s709262637",
"s741417004"
] |
u273010357 | p03854 | python | s267652825 | s952689892 | 71 | 65 | 3,188 | 3,244 | Accepted | Accepted | 8.45 | s = eval(input())
li = ['dream', 'dreamer', 'erase', 'eraser']
#print(s[-5:],s[-6:],s[-7:])
while True:
if s[-5:] in li:
s = s[0:-5]
elif s[-6:] in li:
s = s[0:-6]
elif s[-7:] in li:
s = s[0:-7]
else:
print('NO')
exit()
if s=='':
br... | S = eval(input())
str_list = ['dream','dreamer','erase','eraser']
fl = True
while fl:
if S[-5:] in str_list:
S = S[0:-5]
elif S[-6:] in str_list:
S = S[0:-6]
elif S[-7:] in str_list:
S = S[0:-7]
elif S=="":
fl = False
else:
print('NO')
ex... | 19 | 16 | 331 | 332 | s = eval(input())
li = ["dream", "dreamer", "erase", "eraser"]
# print(s[-5:],s[-6:],s[-7:])
while True:
if s[-5:] in li:
s = s[0:-5]
elif s[-6:] in li:
s = s[0:-6]
elif s[-7:] in li:
s = s[0:-7]
else:
print("NO")
exit()
if s == "":
break
print("YES")
| S = eval(input())
str_list = ["dream", "dreamer", "erase", "eraser"]
fl = True
while fl:
if S[-5:] in str_list:
S = S[0:-5]
elif S[-6:] in str_list:
S = S[0:-6]
elif S[-7:] in str_list:
S = S[0:-7]
elif S == "":
fl = False
else:
print("NO")
exit()
prin... | false | 15.789474 | [
"-s = eval(input())",
"-li = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]",
"-# print(s[-5:],s[-6:],s[-7:])",
"-while True:",
"- if s[-5:] in li:",
"- s = s[0:-5]",
"- elif s[-6:] in li:",
"- s = s[0:-6]",
"- elif s[-7:] in li:",
"- s = s[0:-7]",
"+S = eval(input... | false | 0.035577 | 0.0357 | 0.996544 | [
"s267652825",
"s952689892"
] |
u163320134 | p03700 | python | s216070151 | s541755616 | 1,827 | 1,280 | 7,096 | 7,196 | Accepted | Accepted | 29.94 | n,a,b=list(map(int,input().split()))
arr=[int(eval(input())) for _ in range(n)]
l=0
r=10**9+1
while r-l!=1:
tmp=0
m=(l+r)//2
for i in range(n):
if m*b>=arr[i]:
continue
else:
tmp+=(arr[i]-m*b+(a-b-1))//(a-b)
if tmp<=m:
r=m
else:
l=m
print(r) | def cond(arr,m):
tmp=0
for i in range(n):
if m*b>=arr[i]:
continue
else:
tmp+=(arr[i]-m*b+(a-b-1))//(a-b)
if tmp<=m:
return True
else:
return False
def bisect(l,r):
while r-l!=1:
m=(r+l)//2
if cond(arr,m)==True:
r=m
else:
... | 17 | 24 | 283 | 445 | n, a, b = list(map(int, input().split()))
arr = [int(eval(input())) for _ in range(n)]
l = 0
r = 10**9 + 1
while r - l != 1:
tmp = 0
m = (l + r) // 2
for i in range(n):
if m * b >= arr[i]:
continue
else:
tmp += (arr[i] - m * b + (a - b - 1)) // (a - b)
if tmp <= m... | def cond(arr, m):
tmp = 0
for i in range(n):
if m * b >= arr[i]:
continue
else:
tmp += (arr[i] - m * b + (a - b - 1)) // (a - b)
if tmp <= m:
return True
else:
return False
def bisect(l, r):
while r - l != 1:
m = (r + l) // 2
... | false | 29.166667 | [
"-n, a, b = list(map(int, input().split()))",
"-arr = [int(eval(input())) for _ in range(n)]",
"-l = 0",
"-r = 10**9 + 1",
"-while r - l != 1:",
"+def cond(arr, m):",
"- m = (l + r) // 2",
"- r = m",
"+ return True",
"- l = m",
"-print(r)",
"+ return False",
"+... | false | 0.036823 | 0.036661 | 1.00442 | [
"s216070151",
"s541755616"
] |
u179694829 | p00100 | python | s550759444 | s529099194 | 60 | 50 | 7,884 | 7,828 | Accepted | Accepted | 16.67 | l = int(eval(input()))
while l != 0:
k = 0
A = []
B = []
for l in range(0,l):
li = input().split()
if li[0] in A:
i = A.index(li[0])
B[i] = B[i] + (int(li[1]) * int(li[2]))
else:
A.append(li[0])
B.append(int(li[1]) * int(li[2]))
for j,b in enumerate(B):
if b >= 10**6:
print((A... | while True:
N= int(eval(input()))
if N == 0:
break
D = {}
di = []
for n in range(N):
e,p,q = input().split()
p = int(p)
q = int(q)
if e not in di:
di.append(e)
D[e] = p * q
else:
D[e] = D[e] + p * q
flag = 0
for dj in di:
if D[dj] >= 10**6:
print(dj)
flag = 1
if ... | 21 | 23 | 378 | 342 | l = int(eval(input()))
while l != 0:
k = 0
A = []
B = []
for l in range(0, l):
li = input().split()
if li[0] in A:
i = A.index(li[0])
B[i] = B[i] + (int(li[1]) * int(li[2]))
else:
A.append(li[0])
B.append(int(li[1]) * int(li[2]))
... | while True:
N = int(eval(input()))
if N == 0:
break
D = {}
di = []
for n in range(N):
e, p, q = input().split()
p = int(p)
q = int(q)
if e not in di:
di.append(e)
D[e] = p * q
else:
D[e] = D[e] + p * q
flag = 0
... | false | 8.695652 | [
"-l = int(eval(input()))",
"-while l != 0:",
"- k = 0",
"- A = []",
"- B = []",
"- for l in range(0, l):",
"- li = input().split()",
"- if li[0] in A:",
"- i = A.index(li[0])",
"- B[i] = B[i] + (int(li[1]) * int(li[2]))",
"+while True:",
"+ N ... | false | 0.041915 | 0.037543 | 1.116452 | [
"s550759444",
"s529099194"
] |
u729939940 | p03470 | python | s846044451 | s569743655 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | N = int(eval(input()))
a = []
for n in range(N):
a.append(eval(input()))
print((len(set(a)))) | N = int(eval(input()))
a = []
for _ in range(N):
a.append(eval(input()))
print((len(set(a)))) | 5 | 5 | 87 | 85 | N = int(eval(input()))
a = []
for n in range(N):
a.append(eval(input()))
print((len(set(a))))
| N = int(eval(input()))
a = []
for _ in range(N):
a.append(eval(input()))
print((len(set(a))))
| false | 0 | [
"-for n in range(N):",
"+for _ in range(N):"
] | false | 0.037244 | 0.041553 | 0.89631 | [
"s846044451",
"s569743655"
] |
u685983477 | p02947 | python | s185836078 | s687802436 | 412 | 238 | 45,984 | 22,464 | Accepted | Accepted | 42.23 | import collections
def main4():
n = int(eval(input()))
l = []
for i in range(n):
s = eval(input())
l.append((sorted(s)))
l.sort()
dd = collections.defaultdict(int)
k = []
for i in range(n):
k.append(''.join(l[i]))
res = 0
for i in range(n):
... | import collections
def main4():
dd = collections.defaultdict(int)
n = int(eval(input()))
res = 0
for i in range(n):
s = eval(input())
a = sorted(s)
dd[''.join(a)]+=1
for i in list(dd.values()):
res += (i*(i-1))//2
print(res)
if __name__ == '__main_... | 21 | 16 | 438 | 318 | import collections
def main4():
n = int(eval(input()))
l = []
for i in range(n):
s = eval(input())
l.append((sorted(s)))
l.sort()
dd = collections.defaultdict(int)
k = []
for i in range(n):
k.append("".join(l[i]))
res = 0
for i in range(n):
dd[k[i]] ... | import collections
def main4():
dd = collections.defaultdict(int)
n = int(eval(input()))
res = 0
for i in range(n):
s = eval(input())
a = sorted(s)
dd["".join(a)] += 1
for i in list(dd.values()):
res += (i * (i - 1)) // 2
print(res)
if __name__ == "__main__":
... | false | 23.809524 | [
"+ dd = collections.defaultdict(int)",
"- l = []",
"+ res = 0",
"- l.append((sorted(s)))",
"- l.sort()",
"- dd = collections.defaultdict(int)",
"- k = []",
"- for i in range(n):",
"- k.append(\"\".join(l[i]))",
"- res = 0",
"- for i in range(n):",
"- ... | false | 0.036618 | 0.041217 | 0.888418 | [
"s185836078",
"s687802436"
] |
u263933075 | p03957 | python | s735647596 | s207014575 | 17 | 13 | 2,940 | 2,692 | Accepted | Accepted | 23.53 | S = eval(input())
if S.count("C") == 0 or S.count("F") == 0:
print("No")
else:
S = S[S.index("C"):]
if S.count("F") > 0:
print("Yes")
else:
print("No") | import re
print(['No', 'Yes'][re.match('.*C.*F.*', input()) != None])
| 9 | 2 | 169 | 74 | S = eval(input())
if S.count("C") == 0 or S.count("F") == 0:
print("No")
else:
S = S[S.index("C") :]
if S.count("F") > 0:
print("Yes")
else:
print("No")
| import re
print(["No", "Yes"][re.match(".*C.*F.*", input()) != None])
| false | 77.777778 | [
"-S = eval(input())",
"-if S.count(\"C\") == 0 or S.count(\"F\") == 0:",
"- print(\"No\")",
"-else:",
"- S = S[S.index(\"C\") :]",
"- if S.count(\"F\") > 0:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+import re",
"+",
"+print([\"No\", \"Yes\"][re.match(\".*C... | false | 0.040604 | 0.040018 | 1.01465 | [
"s735647596",
"s207014575"
] |
u408260374 | p00825 | python | s284180981 | s941326357 | 640 | 510 | 8,616 | 7,604 | Accepted | Accepted | 20.31 | import heapq
class MinCostFlow:
class Edge:
def __init__(self, to, cap, rev, cost):
self.to, self.cap, self.rev, self.cost = to, cap, rev, cost
def __init__(self, V):
self.V = V
self.E = [[] for _ in range(V)]
def add_edge(self, fr, to, cap, cost):
... | import heapq
import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
class MinCostFlow:
class Edge:
def __init__(self, to, cap, rev, cost):
self.to, self.cap, self.rev, self.cost = to, cap, rev, cost
def __init__(self, V):
self.V = V
self.E =... | 65 | 68 | 2,134 | 2,211 | import heapq
class MinCostFlow:
class Edge:
def __init__(self, to, cap, rev, cost):
self.to, self.cap, self.rev, self.cost = to, cap, rev, cost
def __init__(self, V):
self.V = V
self.E = [[] for _ in range(V)]
def add_edge(self, fr, to, cap, cost):
self.E[fr].... | import heapq
import sys
if sys.version[0] == "2":
range, input = xrange, raw_input
class MinCostFlow:
class Edge:
def __init__(self, to, cap, rev, cost):
self.to, self.cap, self.rev, self.cost = to, cap, rev, cost
def __init__(self, V):
self.V = V
self.E = [[] for _ i... | false | 4.411765 | [
"+import sys",
"+",
"+if sys.version[0] == \"2\":",
"+ range, input = xrange, raw_input"
] | false | 0.063865 | 0.065711 | 0.971901 | [
"s284180981",
"s941326357"
] |
u861466636 | p03251 | python | s949292673 | s838507863 | 167 | 17 | 12,440 | 3,060 | Accepted | Accepted | 89.82 | import numpy as np
n, m, x, y = list(map(int, input().split()))
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
if x > y:
print("War")
else:
zl = np.arange(x+1, y+1)
for z in zl:
if (max(xl) < z) & (z <= min(yl)):
print("No War")
bre... | n, m, x, y = list(map(int, input().split()))
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
xl.append(x)
yl.append(y)
if max(xl) < min(yl):
print("No War")
else:
print("War") | 15 | 10 | 355 | 223 | import numpy as np
n, m, x, y = list(map(int, input().split()))
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
if x > y:
print("War")
else:
zl = np.arange(x + 1, y + 1)
for z in zl:
if (max(xl) < z) & (z <= min(yl)):
print("No War")
break
e... | n, m, x, y = list(map(int, input().split()))
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
xl.append(x)
yl.append(y)
if max(xl) < min(yl):
print("No War")
else:
print("War")
| false | 33.333333 | [
"-import numpy as np",
"-",
"-if x > y:",
"+xl.append(x)",
"+yl.append(y)",
"+if max(xl) < min(yl):",
"+ print(\"No War\")",
"+else:",
"-else:",
"- zl = np.arange(x + 1, y + 1)",
"- for z in zl:",
"- if (max(xl) < z) & (z <= min(yl)):",
"- print(\"No War\")",
"- ... | false | 0.396251 | 0.038945 | 10.17462 | [
"s949292673",
"s838507863"
] |
u839675792 | p03283 | python | s790344511 | s136853389 | 1,535 | 1,175 | 13,392 | 27,776 | Accepted | Accepted | 23.45 | a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
x = [[0] * n for _ in range(n)]
for _ in range(m):
a = input().split()
x[int(a[0]) - 1][int(a[1]) - 1] += 1
for i in range(n):
for j in range(1, n):
x[i][j] += x[i][j - 1]
for i in range(1, n):
for j in range(n):
... | a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
ll = list()
rr = list()
for _ in range(m):
a = input().split()
ll.append(int(a[0]))
rr.append(int(a[1]))
p = list()
q = list()
for _ in range(qq):
a = input().split()
p.append(int(a[0]))
q.append(int(a[1]))
c ... | 35 | 43 | 634 | 803 | a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
x = [[0] * n for _ in range(n)]
for _ in range(m):
a = input().split()
x[int(a[0]) - 1][int(a[1]) - 1] += 1
for i in range(n):
for j in range(1, n):
x[i][j] += x[i][j - 1]
for i in range(1, n):
for j in range(n):
x[i][j] += x... | a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
ll = list()
rr = list()
for _ in range(m):
a = input().split()
ll.append(int(a[0]))
rr.append(int(a[1]))
p = list()
q = list()
for _ in range(qq):
a = input().split()
p.append(int(a[0]))
q.append(int(a[1]))
c = [[0 for _ in range(n)]... | false | 18.604651 | [
"-x = [[0] * n for _ in range(n)]",
"+ll = list()",
"+rr = list()",
"- x[int(a[0]) - 1][int(a[1]) - 1] += 1",
"-for i in range(n):",
"- for j in range(1, n):",
"- x[i][j] += x[i][j - 1]",
"-for i in range(1, n):",
"- for j in range(n):",
"- x[i][j] += x[i - 1][j]",
"+ l... | false | 0.036631 | 0.037361 | 0.980482 | [
"s790344511",
"s136853389"
] |
u721316601 | p03472 | python | s973884731 | s996829043 | 398 | 190 | 11,372 | 11,316 | Accepted | Accepted | 52.26 | import math
count = 0
N, H = list(map(int, input().split()))
a, b = [], []
for i in range(N):
tmp = list(map(int, input().split()))
a.append(tmp[0])
b.append(tmp[1])
max_a = max(a)
b.sort(reverse=True)
for b_ in b:
if max_a <= b_:
H -= b_
count += 1
if H <= 0:... | import sys
from math import ceil
input = sys.stdin.readline
def main():
N, H = list(map(int, input().split()))
A, B = [], []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=Tr... | 25 | 31 | 397 | 544 | import math
count = 0
N, H = list(map(int, input().split()))
a, b = [], []
for i in range(N):
tmp = list(map(int, input().split()))
a.append(tmp[0])
b.append(tmp[1])
max_a = max(a)
b.sort(reverse=True)
for b_ in b:
if max_a <= b_:
H -= b_
count += 1
if H <= 0:
break
if H > 0... | import sys
from math import ceil
input = sys.stdin.readline
def main():
N, H = list(map(int, input().split()))
A, B = [], []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
a = A[0]
ans = 0... | false | 19.354839 | [
"-import math",
"+import sys",
"+from math import ceil",
"-count = 0",
"-N, H = list(map(int, input().split()))",
"-a, b = [], []",
"-for i in range(N):",
"- tmp = list(map(int, input().split()))",
"- a.append(tmp[0])",
"- b.append(tmp[1])",
"-max_a = max(a)",
"-b.sort(reverse=True)",... | false | 0.047089 | 0.047155 | 0.998607 | [
"s973884731",
"s996829043"
] |
u462329577 | p03523 | python | s088476667 | s251646096 | 30 | 25 | 9,124 | 9,140 | Accepted | Accepted | 16.67 | s = eval(input())
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
if t[i] == s[idx]:
idx += 1
elif t[i] != "A":
ng = 1
break
if idx == len(s):
if i < len(t) - 2:
ng = 1
break
if idx != len(s):
ng = 1
if ng:
print("NO")... | t = eval(input())
s = "AKIHABARA"
posA = [0, 4, 6, 8]
ok = 0
pos = [0, 3, 4, 5]
for i in range(2 ** 4):
tmp = ""
now = 0
for j in range(9):
if j == posA[now]:
if i >> now & 1:
tmp = tmp + s[j]
now += 1
else:
tmp = tmp + s[j]
... | 23 | 24 | 340 | 421 | s = eval(input())
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
if t[i] == s[idx]:
idx += 1
elif t[i] != "A":
ng = 1
break
if idx == len(s):
if i < len(t) - 2:
ng = 1
break
if idx != len(s):
ng = 1
if ng:
print("NO")
else:
print("YES")... | t = eval(input())
s = "AKIHABARA"
posA = [0, 4, 6, 8]
ok = 0
pos = [0, 3, 4, 5]
for i in range(2**4):
tmp = ""
now = 0
for j in range(9):
if j == posA[now]:
if i >> now & 1:
tmp = tmp + s[j]
now += 1
else:
tmp = tmp + s[j]
if t == tmp:
... | false | 4.166667 | [
"-s = eval(input())",
"-t = \"AKIHABARA\"",
"-idx = 0",
"-ng = 0",
"-for i in range(len(t)):",
"- if t[i] == s[idx]:",
"- idx += 1",
"- elif t[i] != \"A\":",
"- ng = 1",
"+t = eval(input())",
"+s = \"AKIHABARA\"",
"+posA = [0, 4, 6, 8]",
"+ok = 0",
"+pos = [0, 3, 4, 5]"... | false | 0.043266 | 0.047902 | 0.903228 | [
"s088476667",
"s251646096"
] |
u539692012 | p02873 | python | s816730301 | s962725590 | 236 | 175 | 20,252 | 20,252 | Accepted | Accepted | 25.85 | import re
print((sum(sum(i * (i - 1) // 2 for i in p) + max(p) for p in (tuple(map(len, m)) for m in re.findall(r"(<*)(>*)", eval(input())))))) | import re
a=0
for m in re.findall('(<*)(>*)',eval(input())):u,v=list(map(len,m));a+=(u*u-u+v*v-v)//2+max(u,v)
print(a) | 2 | 4 | 136 | 109 | import re
print(
(
sum(
sum(i * (i - 1) // 2 for i in p) + max(p)
for p in (
tuple(map(len, m)) for m in re.findall(r"(<*)(>*)", eval(input()))
)
)
)
)
| import re
a = 0
for m in re.findall("(<*)(>*)", eval(input())):
u, v = list(map(len, m))
a += (u * u - u + v * v - v) // 2 + max(u, v)
print(a)
| false | 50 | [
"-print(",
"- (",
"- sum(",
"- sum(i * (i - 1) // 2 for i in p) + max(p)",
"- for p in (",
"- tuple(map(len, m)) for m in re.findall(r\"(<*)(>*)\", eval(input()))",
"- )",
"- )",
"- )",
"-)",
"+a = 0",
"+for m in re.findall(\"... | false | 0.039569 | 0.038717 | 1.022015 | [
"s816730301",
"s962725590"
] |
u134302690 | p03433 | python | s411450038 | s628490188 | 160 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.38 | n = int(eval(input()))
a = int(eval(input()))
d500 = n%500
if a >= d500:
print("Yes")
else:
print("No") | N = int(eval(input()))
A = int(eval(input()))
if N%500 <= A:
print("Yes")
else:
print("No") | 7 | 6 | 105 | 92 | n = int(eval(input()))
a = int(eval(input()))
d500 = n % 500
if a >= d500:
print("Yes")
else:
print("No")
| N = int(eval(input()))
A = int(eval(input()))
if N % 500 <= A:
print("Yes")
else:
print("No")
| false | 14.285714 | [
"-n = int(eval(input()))",
"-a = int(eval(input()))",
"-d500 = n % 500",
"-if a >= d500:",
"+N = int(eval(input()))",
"+A = int(eval(input()))",
"+if N % 500 <= A:"
] | false | 0.04204 | 0.04362 | 0.96378 | [
"s411450038",
"s628490188"
] |
u816631826 | p03548 | python | s540428433 | s215588960 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 |
x=list(map(int,input().split()))
nu=(x[0]-x[2]) % (x[1]+x[2])
res=(x[0]-x[2]-nu) / (x[1]+x[2])
print((int(res)))
| x,y,z=list(map(int,input().split()))
x=x-z
y=y+z
print(x/y) | 8 | 6 | 130 | 63 | x = list(map(int, input().split()))
nu = (x[0] - x[2]) % (x[1] + x[2])
res = (x[0] - x[2] - nu) / (x[1] + x[2])
print((int(res)))
| x, y, z = list(map(int, input().split()))
x = x - z
y = y + z
print(x / y)
| false | 25 | [
"-x = list(map(int, input().split()))",
"-nu = (x[0] - x[2]) % (x[1] + x[2])",
"-res = (x[0] - x[2] - nu) / (x[1] + x[2])",
"-print((int(res)))",
"+x, y, z = list(map(int, input().split()))",
"+x = x - z",
"+y = y + z",
"+print(x / y)"
] | false | 0.037358 | 0.036656 | 1.019139 | [
"s540428433",
"s215588960"
] |
u145231176 | p03329 | python | s394016737 | s652006654 | 256 | 209 | 47,308 | 44,368 | Accepted | Accepted | 18.36 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
from collections import defaultdict, deque
from sys import exit
import heapq
i... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
from collections import defaultdict, deque
from sys import exit
import heapq
i... | 50 | 45 | 1,071 | 957 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
from collections import defaultdict, deque
from sys import exit
import heapq
import... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
from collections import defaultdict, deque
from sys import exit
import heapq
import... | false | 10 | [
"-",
"-",
"-def spliter(n):",
"- if dp[n] < 1000000:",
"- return dp[n]",
"- res = float(\"inf\")",
"- for split in splitlist:",
"- if n >= split:",
"- res = min(res, spliter(n - split) + 1)",
"- dp[n] = res",
"- return res",
"-",
"-",
"-spliter(N)",
... | false | 0.076313 | 0.085267 | 0.894982 | [
"s394016737",
"s652006654"
] |
u054514819 | p02644 | python | s667213769 | s149644674 | 1,329 | 354 | 136,844 | 135,856 | Accepted | Accepted | 73.36 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from collections import deque
inf = 10**18
H, W, K = mapint()
y1, x1, y2, x2 = mapint()
query = [list(str(eval(input()))) for _ in range(H)]
dirc = [(0, 1), (-1, 0), (... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from collections import deque
inf = 10**18
H, W, K = mapint()
y1, x1, y2, x2 = mapint()
query = [list(str(eval(input()))) for _ in range(H)]
dirc = [(0, 1), (-1, 0), (... | 36 | 36 | 1,071 | 1,073 | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from collections import deque
inf = 10**18
H, W, K = mapint()
y1, x1, y2, x2 = mapint()
query = [list(str(eval(input()))) for _ in range(H)]
dirc = [(0, 1), (-1, 0... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from collections import deque
inf = 10**18
H, W, K = mapint()
y1, x1, y2, x2 = mapint()
query = [list(str(eval(input()))) for _ in range(H)]
dirc = [(0, 1), (-1, 0... | false | 0 | [
"- while queue:",
"+ while len(queue):",
"- continue",
"+ break"
] | false | 0.035342 | 0.191935 | 0.184135 | [
"s667213769",
"s149644674"
] |
u172147273 | p02719 | python | s132315905 | s369464827 | 163 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.57 | N,K=list(map(int,input().split()))
N=N%K
while abs(N-K)<N:
N=abs(N-K)
print(N) | N,K=list(map(int,input().split()))
N=N%K
print((min(N,abs(N-K)))) | 5 | 3 | 80 | 59 | N, K = list(map(int, input().split()))
N = N % K
while abs(N - K) < N:
N = abs(N - K)
print(N)
| N, K = list(map(int, input().split()))
N = N % K
print((min(N, abs(N - K))))
| false | 40 | [
"-while abs(N - K) < N:",
"- N = abs(N - K)",
"-print(N)",
"+print((min(N, abs(N - K))))"
] | false | 0.038417 | 0.037549 | 1.023117 | [
"s132315905",
"s369464827"
] |
u133936772 | p02837 | python | s047860711 | s233915223 | 125 | 88 | 3,064 | 3,064 | Accepted | Accepted | 29.6 | import sys
input=sys.stdin.readline
n=int(eval(input()))
ll=[]
for i in range(n):
a=int(eval(input()))
for _ in range(a):
x,y=list(map(int,input().split()))
ll+=[(i,x-1,y)]
c=0
for p in range(2**n):
if all(p>>i&1<1 or p>>x&1==y for i,x,y in ll):
c=max(c,sum(p>>i&1 for i in range(n)))
prin... | import sys,itertools as it
f=sys.stdin.readline
n=int(f())
ll=[]
for i in range(n):
a=int(f())
for _ in range(a):
x,y=list(map(int,f().split()))
ll+=[(i,x-1,y)]
c=0
for p in it.product([0,1],repeat=n):
if all(p[i]<1 or p[x]==y for i,x,y in ll):
c=max(c,sum(p))
print(c) | 14 | 14 | 306 | 294 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ll = []
for i in range(n):
a = int(eval(input()))
for _ in range(a):
x, y = list(map(int, input().split()))
ll += [(i, x - 1, y)]
c = 0
for p in range(2**n):
if all(p >> i & 1 < 1 or p >> x & 1 == y for i, x, y in ll):
c =... | import sys, itertools as it
f = sys.stdin.readline
n = int(f())
ll = []
for i in range(n):
a = int(f())
for _ in range(a):
x, y = list(map(int, f().split()))
ll += [(i, x - 1, y)]
c = 0
for p in it.product([0, 1], repeat=n):
if all(p[i] < 1 or p[x] == y for i, x, y in ll):
c = max(c... | false | 0 | [
"-import sys",
"+import sys, itertools as it",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"+f = sys.stdin.readline",
"+n = int(f())",
"- a = int(eval(input()))",
"+ a = int(f())",
"- x, y = list(map(int, input().split()))",
"+ x, y = list(map(int, f().split()))",... | false | 0.058873 | 0.076991 | 0.764668 | [
"s047860711",
"s233915223"
] |
u934442292 | p03212 | python | s596888335 | s619975086 | 75 | 59 | 3,444 | 7,540 | Accepted | Accepted | 21.33 | import sys
from collections import deque
input = sys.stdin.readline
def dfs(N):
stack = deque(["3", "5", "7"])
num = 0
while stack:
n = stack.pop()
if int(n) > N:
continue
num += 1 if all(s in n for s in "357") else 0
stack.append("3" + n)
... | import sys
from collections import deque
input = sys.stdin.readline
def bfs(N):
res = 0
queue = deque(["3", "5", "7"])
while queue:
num = queue.popleft()
if int(num) > N:
break
if all(("3" in num, "5" in num, "7" in num)):
res += 1
qu... | 30 | 31 | 512 | 575 | import sys
from collections import deque
input = sys.stdin.readline
def dfs(N):
stack = deque(["3", "5", "7"])
num = 0
while stack:
n = stack.pop()
if int(n) > N:
continue
num += 1 if all(s in n for s in "357") else 0
stack.append("3" + n)
stack.append(... | import sys
from collections import deque
input = sys.stdin.readline
def bfs(N):
res = 0
queue = deque(["3", "5", "7"])
while queue:
num = queue.popleft()
if int(num) > N:
break
if all(("3" in num, "5" in num, "7" in num)):
res += 1
queue.append("".j... | false | 3.225806 | [
"-def dfs(N):",
"- stack = deque([\"3\", \"5\", \"7\"])",
"- num = 0",
"- while stack:",
"- n = stack.pop()",
"- if int(n) > N:",
"- continue",
"- num += 1 if all(s in n for s in \"357\") else 0",
"- stack.append(\"3\" + n)",
"- stack.append(\... | false | 0.056803 | 0.152943 | 0.371402 | [
"s596888335",
"s619975086"
] |
u708255304 | p03363 | python | s560136663 | s091048381 | 248 | 197 | 41,460 | 41,708 | Accepted | Accepted | 20.56 | N = int(eval(input()))
A = list(map(int, input().split()))
S = [0]
for i in range(len(A)):
S.append(S[-1] + A[i])
counter = {}
for i in range(len(S)):
counter.setdefault(S[i], 0)
counter[S[i]] += 1
ans = 0
for v in list(counter.values()):
ans += (v * (v-1)) // 2
print(ans)
| from collections import Counter
N = int(eval(input())) # 長さN
A = list(map(int, input().split())) # 整数列A
S = [0]
for i in range(len(A)):
S.append(S[-1] + A[i])
c = Counter(S)
ans = 0
for v in list(c.values()):
ans += v*(v-1)//2
print(ans)
| 20 | 15 | 304 | 254 | N = int(eval(input()))
A = list(map(int, input().split()))
S = [0]
for i in range(len(A)):
S.append(S[-1] + A[i])
counter = {}
for i in range(len(S)):
counter.setdefault(S[i], 0)
counter[S[i]] += 1
ans = 0
for v in list(counter.values()):
ans += (v * (v - 1)) // 2
print(ans)
| from collections import Counter
N = int(eval(input())) # 長さN
A = list(map(int, input().split())) # 整数列A
S = [0]
for i in range(len(A)):
S.append(S[-1] + A[i])
c = Counter(S)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 25 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"+from collections import Counter",
"+",
"+N = int(eval(input())) # 長さN",
"+A = list(map(int, input().split())) # 整数列A",
"-counter = {}",
"-for i in range(len(S)):",
"- counter.setdefault(S[i], 0)",
"- counter[S[i]] += 1",
... | false | 0.079034 | 0.063895 | 1.236936 | [
"s560136663",
"s091048381"
] |
u223646582 | p03329 | python | s548373361 | s515790418 | 638 | 361 | 26,612 | 3,060 | Accepted | Accepted | 43.42 | N=int(eval(input()))
dp=[10**7]*3000000
dp[0]=0
pow6=[6**j for j in range(10) if 6**j <= N]
pow9=[9**j for j in range(10) if 9**j <= N]
for i in range(N):
for p6 in pow6:
dp[i+p6]=min(dp[i+p6], dp[i]+1)
for p9 in pow9:
dp[i+p9]=min(dp[i+p9], dp[i]+1)
print((dp[N])) | N = int(eval(input()))
ans = 10**10
for i in range(N+1):
cc = 0
t = i
while t > 0:
cc += t % 6
t //= 6
t = N-i
while t > 0:
cc += t % 9
t //= 9
if ans > cc:
ans = cc
print(ans)
| 14 | 19 | 297 | 257 | N = int(eval(input()))
dp = [10**7] * 3000000
dp[0] = 0
pow6 = [6**j for j in range(10) if 6**j <= N]
pow9 = [9**j for j in range(10) if 9**j <= N]
for i in range(N):
for p6 in pow6:
dp[i + p6] = min(dp[i + p6], dp[i] + 1)
for p9 in pow9:
dp[i + p9] = min(dp[i + p9], dp[i] + 1)
print((dp[N]))
| N = int(eval(input()))
ans = 10**10
for i in range(N + 1):
cc = 0
t = i
while t > 0:
cc += t % 6
t //= 6
t = N - i
while t > 0:
cc += t % 9
t //= 9
if ans > cc:
ans = cc
print(ans)
| false | 26.315789 | [
"-dp = [10**7] * 3000000",
"-dp[0] = 0",
"-pow6 = [6**j for j in range(10) if 6**j <= N]",
"-pow9 = [9**j for j in range(10) if 9**j <= N]",
"-for i in range(N):",
"- for p6 in pow6:",
"- dp[i + p6] = min(dp[i + p6], dp[i] + 1)",
"- for p9 in pow9:",
"- dp[i + p9] = min(dp[i + p9... | false | 0.212503 | 0.067046 | 3.169499 | [
"s548373361",
"s515790418"
] |
u463655976 | p03111 | python | s258651239 | s108505112 | 410 | 229 | 3,064 | 3,064 | Accepted | Accepted | 44.15 | N, A, B, C= list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
K = 4
minmp = 1e8
for x in range(pow(4, N)):
v = x
c = [0] * K
s = [0] * K
i = 0
while v > 0:
m = v % K
c[m] += 1
s[m] += L[i]
i += 1
v //= K
if c[1... | N, *P = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
mp = sum(P) - 30
minmp = 1e10
Pcnt = [0] * 3
Ks = [-1] * N
while True:
i = N-1
while i >= 0:
pre = cur = Ks[i]
cur += 1
if cur >= 3:
cur = -1
Ks[i] = cur
... | 22 | 37 | 464 | 667 | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
K = 4
minmp = 1e8
for x in range(pow(4, N)):
v = x
c = [0] * K
s = [0] * K
i = 0
while v > 0:
m = v % K
c[m] += 1
s[m] += L[i]
i += 1
v //= K
if c[1] > 0 and c[2] > 0 a... | N, *P = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
mp = sum(P) - 30
minmp = 1e10
Pcnt = [0] * 3
Ks = [-1] * N
while True:
i = N - 1
while i >= 0:
pre = cur = Ks[i]
cur += 1
if cur >= 3:
cur = -1
Ks[i] = cur
for d, x in ((-1, pre... | false | 40.540541 | [
"-N, A, B, C = list(map(int, input().split()))",
"+N, *P = list(map(int, input().split()))",
"-K = 4",
"-minmp = 1e8",
"-for x in range(pow(4, N)):",
"- v = x",
"- c = [0] * K",
"- s = [0] * K",
"- i = 0",
"- while v > 0:",
"- m = v % K",
"- c[m] += 1",
"- ... | false | 0.603376 | 0.352909 | 1.709724 | [
"s258651239",
"s108505112"
] |
u017810624 | p03039 | python | s996923535 | s766472976 | 368 | 230 | 26,992 | 81,008 | Accepted | Accepted | 37.5 | def cmb(n,r,mod):
if r<0 or r>n:
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
N,M,k=list(map(int,input().split()))
m=10**9+7
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,N*M):
g1.append((g1[-1]*i)%m)
inverse.append((-inverse[m%i]*(m//i))%m)
g2.append((g2[-1]*inverse[-1]... | def cmb(n,r,mod):
if r<0 or r>n:
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
n,m,k=list(map(int,input().split()))
mod=10**9+7
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,n*m):
g1.append((g1[-1]*i)%mod)
inverse.append((-inverse[mod%i]*(mod//i))%mod)
g2.append((g2[-1]*i... | 27 | 27 | 473 | 497 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
N, M, k = list(map(int, input().split()))
m = 10**9 + 7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, N * M):
g1.append((g1[-1] * i) % m)
inverse.append((-inverse[m % i] * ... | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
n, m, k = list(map(int, input().split()))
mod = 10**9 + 7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n * m):
g1.append((g1[-1] * i) % mod)
inverse.append((-inverse[mod %... | false | 0 | [
"-N, M, k = list(map(int, input().split()))",
"-m = 10**9 + 7",
"+n, m, k = list(map(int, input().split()))",
"+mod = 10**9 + 7",
"-for i in range(2, N * M):",
"- g1.append((g1[-1] * i) % m)",
"- inverse.append((-inverse[m % i] * (m // i)) % m)",
"- g2.append((g2[-1] * inverse[-1]) % m)",
"... | false | 0.057344 | 0.05809 | 0.987152 | [
"s996923535",
"s766472976"
] |
u980205854 | p04033 | python | s331823895 | s980952594 | 150 | 64 | 12,504 | 61,848 | Accepted | Accepted | 57.33 | # A - Range Product
import numpy as np
ans = ['Positive', 'Negative']
a, b = list(map(int, input().split()))
if a<=0 & 0<=b:
print('Zero')
else:
sgn = max(-b,0) - max(-a-1,0)
print((ans[sgn%2])) | # A - Range Product
a,b = list(map(int,input().split()))
if a<=0 and b>=0:
print('Zero')
elif (max(-a,0)-max(-b-1,0))%2==0:
print('Positive')
else:
print('Negative') | 11 | 8 | 210 | 178 | # A - Range Product
import numpy as np
ans = ["Positive", "Negative"]
a, b = list(map(int, input().split()))
if a <= 0 & 0 <= b:
print("Zero")
else:
sgn = max(-b, 0) - max(-a - 1, 0)
print((ans[sgn % 2]))
| # A - Range Product
a, b = list(map(int, input().split()))
if a <= 0 and b >= 0:
print("Zero")
elif (max(-a, 0) - max(-b - 1, 0)) % 2 == 0:
print("Positive")
else:
print("Negative")
| false | 27.272727 | [
"-import numpy as np",
"-",
"-ans = [\"Positive\", \"Negative\"]",
"-if a <= 0 & 0 <= b:",
"+if a <= 0 and b >= 0:",
"+elif (max(-a, 0) - max(-b - 1, 0)) % 2 == 0:",
"+ print(\"Positive\")",
"- sgn = max(-b, 0) - max(-a - 1, 0)",
"- print((ans[sgn % 2]))",
"+ print(\"Negative\")"
] | false | 0.039036 | 0.084566 | 0.461597 | [
"s331823895",
"s980952594"
] |
u185802209 | p03194 | python | s146380323 | s491074420 | 335 | 167 | 3,060 | 3,060 | Accepted | Accepted | 50.15 | n, p = list(map(int, input().split()))
if n == 1 or p== 1:
print(p)
exit()
c2 = 0
while p%2 == 0:
c2 += 1
p//=2
c = 2**(c2//n)
i = int(p**(1/n))+1
if i%2 == 0:
i -= 1
while i > 1:
if p%(i**n) == 0:
print((c*i))
exit()
else:
i -= 1
print(c) | n, p = list(map(int, input().split()))
if n == 1 or p== 1:
print(p)
exit()
c2 = 0
while p%2 == 0:
c2 += 1
p//=2
c = 2**(c2//n)
i = int(p**(1/n))+1
if i%2 == 0:
i -= 1
while i > 1:
if p%(i**n) == 0:
print((c*i))
exit()
else:
i -= 2
print(c) | 19 | 19 | 301 | 301 | n, p = list(map(int, input().split()))
if n == 1 or p == 1:
print(p)
exit()
c2 = 0
while p % 2 == 0:
c2 += 1
p //= 2
c = 2 ** (c2 // n)
i = int(p ** (1 / n)) + 1
if i % 2 == 0:
i -= 1
while i > 1:
if p % (i**n) == 0:
print((c * i))
exit()
else:
i -= 1
print(c)
| n, p = list(map(int, input().split()))
if n == 1 or p == 1:
print(p)
exit()
c2 = 0
while p % 2 == 0:
c2 += 1
p //= 2
c = 2 ** (c2 // n)
i = int(p ** (1 / n)) + 1
if i % 2 == 0:
i -= 1
while i > 1:
if p % (i**n) == 0:
print((c * i))
exit()
else:
i -= 2
print(c)
| false | 0 | [
"- i -= 1",
"+ i -= 2"
] | false | 0.069387 | 0.036838 | 1.883555 | [
"s146380323",
"s491074420"
] |
u680851063 | p02642 | python | s224686786 | s626464513 | 531 | 475 | 47,448 | 47,556 | Accepted | Accepted | 10.55 | n = int(eval(input()))
l = list(map(int,input().split()))
num = max(l)+1
rcd = [0 for _ in range(num)]
for v in l:
rcd[v] += 1
unq = []
for w in range(num):
if rcd[w] == 1:
unq.append(w)
#print(unq)
rcd = [0 for _ in range(num)]
l = set(l)
for x in l:
for y in range(2*x, num, x... | # '重複する要素があると条件から逸脱する' と '他の要素が約数になると条件から逸脱する'
# 上記2つの問題を 前半と後半に分けて処理する、
n = int(eval(input()))
l = list(map(int,input().split()))
# 重複問題
num = max(l)+1
rcd = [0 for _ in range(num)] # indexを数列Aと読み替え可能な配列として初期化
for v in l: # 重複する配列を区別するため各要素数をカウントして...
rcd[v] += 1
unq = []
for w in range(num): # ... | 27 | 33 | 427 | 762 | n = int(eval(input()))
l = list(map(int, input().split()))
num = max(l) + 1
rcd = [0 for _ in range(num)]
for v in l:
rcd[v] += 1
unq = []
for w in range(num):
if rcd[w] == 1:
unq.append(w)
# print(unq)
rcd = [0 for _ in range(num)]
l = set(l)
for x in l:
for y in range(2 * x, num, x):
rcd[y... | # '重複する要素があると条件から逸脱する' と '他の要素が約数になると条件から逸脱する'
# 上記2つの問題を 前半と後半に分けて処理する、
n = int(eval(input()))
l = list(map(int, input().split()))
# 重複問題
num = max(l) + 1
rcd = [0 for _ in range(num)] # indexを数列Aと読み替え可能な配列として初期化
for v in l: # 重複する配列を区別するため各要素数をカウントして...
rcd[v] += 1
unq = []
for w in range(num): # 重複がない要素のみ'unq... | false | 18.181818 | [
"+# '重複する要素があると条件から逸脱する' と '他の要素が約数になると条件から逸脱する'",
"+# 上記2つの問題を 前半と後半に分けて処理する、",
"+# 重複問題",
"-rcd = [0 for _ in range(num)]",
"-for v in l:",
"+rcd = [0 for _ in range(num)] # indexを数列Aと読み替え可能な配列として初期化",
"+for v in l: # 重複する配列を区別するため各要素数をカウントして...",
"-for w in range(num):",
"- if rcd[w] == 1:",... | false | 0.069314 | 0.067444 | 1.027723 | [
"s224686786",
"s626464513"
] |
u021548497 | p02555 | python | s741995531 | s606632493 | 458 | 102 | 9,444 | 67,712 | Accepted | Accepted | 77.73 | import sys
input = sys.stdin.readline
mod = pow(10, 9)+7
memo = dict()
def dfs(n):
if n in memo:
return memo[n]
if n < 3:
return 0
ans = 0
for i in range(n-3, 2, -1):
ans += dfs(i)+1
ans %= mod
memo[n] = ans%mod
return ans
def main():
n = int... | memo = dict()
def dp(n):
if n == 0: return 1
if n in memo: return memo[n]
ans = 0
mod = pow(10, 9) + 7
for i in range(n-2):
ans = (ans + dp(i)) % mod
memo[n] = ans
return ans
s = int(eval(input()))
ans = dp(s)
print(ans) | 29 | 15 | 452 | 248 | import sys
input = sys.stdin.readline
mod = pow(10, 9) + 7
memo = dict()
def dfs(n):
if n in memo:
return memo[n]
if n < 3:
return 0
ans = 0
for i in range(n - 3, 2, -1):
ans += dfs(i) + 1
ans %= mod
memo[n] = ans % mod
return ans
def main():
n = int(eval... | memo = dict()
def dp(n):
if n == 0:
return 1
if n in memo:
return memo[n]
ans = 0
mod = pow(10, 9) + 7
for i in range(n - 2):
ans = (ans + dp(i)) % mod
memo[n] = ans
return ans
s = int(eval(input()))
ans = dp(s)
print(ans)
| false | 48.275862 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-mod = pow(10, 9) + 7",
"-def dfs(n):",
"+def dp(n):",
"+ if n == 0:",
"+ return 1",
"- if n < 3:",
"- return 0",
"- for i in range(n - 3, 2, -1):",
"- ans += dfs(i) + 1",
"- ans %= mod",
"- memo[n]... | false | 0.418009 | 0.244727 | 1.708065 | [
"s741995531",
"s606632493"
] |
u912237403 | p00114 | python | s335438990 | s703586504 | 1,070 | 360 | 4,320 | 5,552 | Accepted | Accepted | 66.36 | from functools import reduce
def f(a,b):
p,q=a,b
while q!=0: p,q=q,p%q
return a/p*b
while 1:
x=list(map(int,input().split()))
if any(x)==0: break
A=[]
for i in range(0,6,2):
c=1
while pow(x[i],c,x[i+1])!=1: c+=1
A.append(c)
x=reduce(lambda a,b: f(a,b), A)
print(x) | from functools import reduce
def f(a,b):
p,q=a,b
while q!=0: p,q=q,p%q
return a/p*b
while 1:
x=list(map(int,input().split()))
if any(x)==0: break
A=[]
for i in range(0,6,2):
a,b=x[i:i+2]
c=1
for j in range(1,b):
c*=a; c%=b
if c==1: break
A.append(j)
x=reduc... | 15 | 18 | 279 | 324 | from functools import reduce
def f(a, b):
p, q = a, b
while q != 0:
p, q = q, p % q
return a / p * b
while 1:
x = list(map(int, input().split()))
if any(x) == 0:
break
A = []
for i in range(0, 6, 2):
c = 1
while pow(x[i], c, x[i + 1]) != 1:
c +... | from functools import reduce
def f(a, b):
p, q = a, b
while q != 0:
p, q = q, p % q
return a / p * b
while 1:
x = list(map(int, input().split()))
if any(x) == 0:
break
A = []
for i in range(0, 6, 2):
a, b = x[i : i + 2]
c = 1
for j in range(1, b):
... | false | 16.666667 | [
"+ a, b = x[i : i + 2]",
"- while pow(x[i], c, x[i + 1]) != 1:",
"- c += 1",
"- A.append(c)",
"+ for j in range(1, b):",
"+ c *= a",
"+ c %= b",
"+ if c == 1:",
"+ break",
"+ A.append(j)"
] | false | 0.043722 | 0.061049 | 0.716177 | [
"s335438990",
"s703586504"
] |
u243714267 | p02685 | python | s833772996 | s380736357 | 1,667 | 766 | 33,084 | 33,156 | Accepted | Accepted | 54.05 | n, m, k = list(map(int, input().split()))
mod = 998244353
def powerDX(n, r, mod):
if r == 0: return 1
if r%2 == 0:
return powerDX(n*n % mod, r//2, mod) % mod
if r%2 == 1:
return n * powerDX(n, r-1, mod) % mod
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
... | n, m, k = list(map(int, input().split()))
mod = 998244353
def powerDX(n, r, mod):
if r == 0: return 1
if r%2 == 0:
return powerDX(n*n % mod, r//2, mod) % mod
if r%2 == 1:
return n * powerDX(n, r-1, mod) % mod
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
... | 30 | 30 | 695 | 691 | n, m, k = list(map(int, input().split()))
mod = 998244353
def powerDX(n, r, mod):
if r == 0:
return 1
if r % 2 == 0:
return powerDX(n * n % mod, r // 2, mod) % mod
if r % 2 == 1:
return n * powerDX(n, r - 1, mod) % mod
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
... | n, m, k = list(map(int, input().split()))
mod = 998244353
def powerDX(n, r, mod):
if r == 0:
return 1
if r % 2 == 0:
return powerDX(n * n % mod, r // 2, mod) % mod
if r % 2 == 1:
return n * powerDX(n, r - 1, mod) % mod
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
... | false | 0 | [
"- ans += m * cmb(n - 1, i, mod) * powerDX(m - 1, n - i - 1, mod)",
"+ ans += m * cmb(n - 1, i, mod) * pow(m - 1, n - i - 1, mod)"
] | false | 0.161112 | 0.128978 | 1.249142 | [
"s833772996",
"s380736357"
] |
u891635666 | p02863 | python | s736028400 | s212848623 | 564 | 428 | 115,804 | 44,012 | Accepted | Accepted | 24.11 | # Python3 TLE, PyPy3 AC
import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda ... | import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)... | 48 | 24 | 1,078 | 597 | # Python3 TLE, PyPy3 AC
import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for ... | import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = la... | false | 50 | [
"-# Python3 TLE, PyPy3 AC",
"-dp = [[0] * t for _ in range(n + 1)]",
"-for i in range(n + 1):",
"- for t0 in range(t):",
"- a, b = ls[i - 1]",
"- if i == 0 or t0 == 0:",
"- continue",
"- elif a <= t0:",
"- dp[i][t0] = max(dp[i - 1][t0], dp[i - 1][t0 - a]... | false | 0.0387 | 0.041627 | 0.92969 | [
"s736028400",
"s212848623"
] |
u723711163 | p02732 | python | s024985790 | s296254860 | 493 | 430 | 39,292 | 98,636 | Accepted | Accepted | 12.78 | from collections import defaultdict
N = int(eval(input()))
nums = list(map(int, input().split()))
counter = defaultdict(list)
for i in range(len(nums)):
counter[nums[i]].append(i)
total = 0
for _,v in list(counter.items()):
v = len(v)
total += (v * (v-1)) // 2
for k in range(len(nums)):
print... | from collections import defaultdict
N = int(eval(input()))
nums = list(map(int, input().split()))
counter = defaultdict(list)
for i in range(len(nums)):
counter[nums[i]].append(i)
total = 0
for _,v in list(counter.items()):
v = len(v)
total += (v * (v-1)) // 2
for k in range(len(nums)):
t = l... | 16 | 17 | 343 | 374 | from collections import defaultdict
N = int(eval(input()))
nums = list(map(int, input().split()))
counter = defaultdict(list)
for i in range(len(nums)):
counter[nums[i]].append(i)
total = 0
for _, v in list(counter.items()):
v = len(v)
total += (v * (v - 1)) // 2
for k in range(len(nums)):
print((total... | from collections import defaultdict
N = int(eval(input()))
nums = list(map(int, input().split()))
counter = defaultdict(list)
for i in range(len(nums)):
counter[nums[i]].append(i)
total = 0
for _, v in list(counter.items()):
v = len(v)
total += (v * (v - 1)) // 2
for k in range(len(nums)):
t = len(coun... | false | 5.882353 | [
"- print((total - (len(counter[nums[k]]) - 1)))",
"+ t = len(counter[nums[k]])",
"+ print((total - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2))"
] | false | 0.095248 | 0.10403 | 0.915583 | [
"s024985790",
"s296254860"
] |
u498487134 | p02953 | python | s027895515 | s357984831 | 213 | 90 | 63,856 | 84,604 | Accepted | Accepted | 57.75 | N=int(eval(input()))
H=list(map(int,input().split()))
ceil=0
ans="Yes"
for i in range(N):
if H[i]>ceil:
ceil=H[i]
if H[i]<ceil-1:
ans="No"
break
print(ans) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
H=LI()
now=0
for i in range(N):
if H[i]!=now:
H[i]-... | 12 | 34 | 193 | 563 | N = int(eval(input()))
H = list(map(int, input().split()))
ceil = 0
ans = "Yes"
for i in range(N):
if H[i] > ceil:
ceil = H[i]
if H[i] < ceil - 1:
ans = "No"
break
print(ans)
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
H = LI()
now = 0
for i in range(N):
if H[i] != now:
... | false | 64.705882 | [
"-N = int(eval(input()))",
"-H = list(map(int, input().split()))",
"-ceil = 0",
"-ans = \"Yes\"",
"-for i in range(N):",
"- if H[i] > ceil:",
"- ceil = H[i]",
"- if H[i] < ceil - 1:",
"- ans = \"No\"",
"- break",
"-print(ans)",
"+import sys",
"+",
"+input = sys.s... | false | 0.034071 | 0.034511 | 0.987237 | [
"s027895515",
"s357984831"
] |
u279266699 | p02554 | python | s686906058 | s277855336 | 405 | 29 | 10,824 | 9,132 | Accepted | Accepted | 92.84 | import sys
stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return list(map(int, stdin.readline().split()))
def nl(): return list(map(int, stdin.readline().split()))
def main():
n = ni()
mod = 10 ** 9 + 7
print(((pow(10, ... | import sys
stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return list(map(int, stdin.readline().split()))
def nl(): return list(map(int, stdin.readline().split()))
def main():
n = ni()
mod = 10 ** 9 + 7
print(((pow(10, ... | 18 | 18 | 416 | 413 | import sys
stdin = sys.stdin
def ns():
return stdin.readline().rstrip()
def ni():
return int(stdin.readline().rstrip())
def nm():
return list(map(int, stdin.readline().split()))
def nl():
return list(map(int, stdin.readline().split()))
def main():
n = ni()
mod = 10**9 + 7
print(((... | import sys
stdin = sys.stdin
def ns():
return stdin.readline().rstrip()
def ni():
return int(stdin.readline().rstrip())
def nm():
return list(map(int, stdin.readline().split()))
def nl():
return list(map(int, stdin.readline().split()))
def main():
n = ni()
mod = 10**9 + 7
print(((... | false | 0 | [
"- print(((pow(10, n) % mod - (2 * pow(9, n)) % mod + pow(8, n) % mod) % mod))",
"+ print(((pow(10, n, mod) - (2 * pow(9, n, mod)) + pow(8, n, mod)) % mod))"
] | false | 0.373205 | 0.039518 | 9.444019 | [
"s686906058",
"s277855336"
] |
u652656291 | p03574 | python | s078898198 | s978061867 | 32 | 28 | 3,444 | 3,060 | Accepted | Accepted | 12.5 | H,W = map(int,input().split())
S = [input() for _ in range(H)]
answer = [[0 if cell == '.' else '#' for cell in row] for row in S]
import itertools
for i in range(H):
for j in range(W):
if S[i][j] != '#':
continue
for dx,dy in itertools.product([-1,0,1],repeat=2):
x = i+dx
y = j+... | H,W=list(map(int,input().split()))
S=[eval(input()) for _ in range(H)]
for i in range(H):
T=''
for j in range(W):
if S[i][j] == '#':
T+='#'
else:
T+=str(sum([x[max(0,j-1):min(j+2,W)].count('#') for x in S[max(0,i-1):min(i+2,H)]]))
print(T)
| 23 | 11 | 534 | 272 | H, W = map(int, input().split())
S = [input() for _ in range(H)]
answer = [[0 if cell == "." else "#" for cell in row] for row in S]
import itertools
for i in range(H):
for j in range(W):
if S[i][j] != "#":
continue
for dx, dy in itertools.product([-1, 0, 1], repeat=2):
x = ... | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
for i in range(H):
T = ""
for j in range(W):
if S[i][j] == "#":
T += "#"
else:
T += str(
sum(
[
x[max(0, j - 1) : min(j + 2, W)].count(... | false | 52.173913 | [
"-H, W = map(int, input().split())",
"-S = [input() for _ in range(H)]",
"-answer = [[0 if cell == \".\" else \"#\" for cell in row] for row in S]",
"-import itertools",
"-",
"+H, W = list(map(int, input().split()))",
"+S = [eval(input()) for _ in range(H)]",
"+ T = \"\"",
"- if S[i][j] !=... | false | 0.078786 | 0.062474 | 1.261093 | [
"s078898198",
"s978061867"
] |
u519939795 | p03943 | python | s145119691 | s193731699 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b,c = list(map(int, input().split()))
if a + b == c or a + c == b or b + c == a:
print('Yes')
else:
print('No') | a,b,c=list(map(int,input().split()))
print(('Yes' if a+b==c or b+c==a or a+c==b else 'No')) | 7 | 2 | 123 | 84 | a, b, c = list(map(int, input().split()))
if a + b == c or a + c == b or b + c == a:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
print(("Yes" if a + b == c or b + c == a or a + c == b else "No"))
| false | 71.428571 | [
"-if a + b == c or a + c == b or b + c == a:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"Yes\" if a + b == c or b + c == a or a + c == b else \"No\"))"
] | false | 0.045182 | 0.045379 | 0.995673 | [
"s145119691",
"s193731699"
] |
u072717685 | p02629 | python | s121003584 | s797116114 | 342 | 63 | 82,504 | 62,008 | Accepted | Accepted | 81.58 | from collections import deque
def main():
n = int(eval(input()))
c = deque()
while n:
n -= 1
c.appendleft(n % 26)
n = n // 26
cs = []
for ce in c:
ce += 97
cec = chr(ce)
cs.append(cec)
print(("".join(cs)))
if __name__ == '__main__':... | def main():
n = int(eval(input()))
nl = 0
yokei = 0
yokei_pre = 0
while yokei < n:
nl += 1
yokei_pre = yokei
yokei += 26 ** nl
n -= yokei_pre
n -= 1
c = [0] * nl
for i1 in range(1, nl + 1):
r = n % 26
c[-i1] = r
n = n /... | 17 | 27 | 325 | 483 | from collections import deque
def main():
n = int(eval(input()))
c = deque()
while n:
n -= 1
c.appendleft(n % 26)
n = n // 26
cs = []
for ce in c:
ce += 97
cec = chr(ce)
cs.append(cec)
print(("".join(cs)))
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
nl = 0
yokei = 0
yokei_pre = 0
while yokei < n:
nl += 1
yokei_pre = yokei
yokei += 26**nl
n -= yokei_pre
n -= 1
c = [0] * nl
for i1 in range(1, nl + 1):
r = n % 26
c[-i1] = r
n = n // 26
cs = []
... | false | 37.037037 | [
"-from collections import deque",
"-",
"-",
"- c = deque()",
"- while n:",
"- n -= 1",
"- c.appendleft(n % 26)",
"+ nl = 0",
"+ yokei = 0",
"+ yokei_pre = 0",
"+ while yokei < n:",
"+ nl += 1",
"+ yokei_pre = yokei",
"+ yokei += 26**nl",... | false | 0.064241 | 0.036539 | 1.758155 | [
"s121003584",
"s797116114"
] |
u285891772 | p02743 | python | s087109355 | s501755645 | 59 | 42 | 5,780 | 5,392 | Accepted | Accepted | 28.81 | 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
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 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
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 27 | 27 | 1,034 | 1,039 | 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
from itertools import (
accumulate,
permutations,
combinations,
combi... | 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
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 0 | [
"-if Decimal(a) ** Decimal(0.5) + Decimal(b) ** Decimal(0.5) < Decimal(c) ** Decimal(0.5):",
"+if Decimal(a) ** Decimal(\"0.5\") + Decimal(b) ** Decimal(\"0.5\") < Decimal(c) ** Decimal(",
"+ \"0.5\"",
"+):"
] | false | 0.04046 | 0.039191 | 1.03237 | [
"s087109355",
"s501755645"
] |
u144304718 | p02707 | python | s353516501 | s697767184 | 121 | 109 | 25,868 | 25,844 | Accepted | Accepted | 9.92 | a = int(eval(input()))
b = [0] * a
for c in map(int, input().split()):
b[c-1] = b[c-1] + 1
print(('\n'.join(map(str, b))))
| 社員数 = int(eval(input()))
部下数 = [0] * 社員数
for 上司 in map(int, input().split()):
部下数[上司-1] += 1
print(('\n'.join(map(str, 部下数))))
| 7 | 7 | 127 | 131 | a = int(eval(input()))
b = [0] * a
for c in map(int, input().split()):
b[c - 1] = b[c - 1] + 1
print(("\n".join(map(str, b))))
| 社員数 = int(eval(input()))
部下数 = [0] * 社員数
for 上司 in map(int, input().split()):
部下数[上司 - 1] += 1
print(("\n".join(map(str, 部下数))))
| false | 0 | [
"-a = int(eval(input()))",
"-b = [0] * a",
"-for c in map(int, input().split()):",
"- b[c - 1] = b[c - 1] + 1",
"-print((\"\\n\".join(map(str, b))))",
"+社員数 = int(eval(input()))",
"+部下数 = [0] * 社員数",
"+for 上司 in map(int, input().split()):",
"+ 部下数[上司 - 1] += 1",
"+print((\"\\n\".join(map(str... | false | 0.044294 | 0.09311 | 0.475721 | [
"s353516501",
"s697767184"
] |
u414920281 | p02762 | python | s980780847 | s796462553 | 731 | 628 | 18,452 | 49,768 | Accepted | Accepted | 14.09 | class UnionFind:
def __init__(self,n):
self.n=n
self.parent=[i for i in range(n)]
self.rank=[1]*n#木の高さ
self.size=[1]*n#size[i]はiを根とするグループのサイズ
def find(self,x):#xの根(親)を返す
if self.parent[x]==x:
return x
else:
self.parent[x]=self.f... | import sys
sys.setrecursionlimit(10000000)
n,m,k=map(int,input().split())
stock=[[] for i in range(n)]
ter=[0]*n
ans=[0]*n
for i in range(m):
a,b=map(int,input().split())
stock[a-1].append(b-1)
stock[b-1].append(a-1)
ans[a-1]-=1
ans[b-1]-=1
def dfs(j,k):
size[k]+=1
for next_j i... | 49 | 37 | 1,358 | 786 | class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(n)]
self.rank = [1] * n # 木の高さ
self.size = [1] * n # size[i]はiを根とするグループのサイズ
def find(self, x): # xの根(親)を返す
if self.parent[x] == x:
return x
else:
self.pa... | import sys
sys.setrecursionlimit(10000000)
n, m, k = map(int, input().split())
stock = [[] for i in range(n)]
ter = [0] * n
ans = [0] * n
for i in range(m):
a, b = map(int, input().split())
stock[a - 1].append(b - 1)
stock[b - 1].append(a - 1)
ans[a - 1] -= 1
ans[b - 1] -= 1
def dfs(j, k):
si... | false | 24.489796 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.parent = [i for i in range(n)]",
"- self.rank = [1] * n # 木の高さ",
"- self.size = [1] * n # size[i]はiを根とするグループのサイズ",
"+import sys",
"- def find(self, x): # xの根(親)を返す",
"- if self.parent... | false | 0.071361 | 0.045573 | 1.565875 | [
"s980780847",
"s796462553"
] |
u332385682 | p03807 | python | s080367161 | s411822975 | 71 | 59 | 14,232 | 14,108 | Accepted | Accepted | 16.9 | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def solve():
N = int(input())
A = [int(i) for i in input().split()]
yes = 'YES'
no = 'NO'
num_od = ... | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def solve():
N = int(input())
A = [int(i) for i in input().split()]
yes = 'YES'
no = 'NO'
if sum(A)... | 27 | 21 | 509 | 423 | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print("DEBUG:{} -> {}".format(name, val), file=sys.stderr)
return None
def solve():
N = int(input())
A = [int(i) for i in input().split()]
yes = "YES"
no = "NO"
num_od = 0
for a i... | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print("DEBUG:{} -> {}".format(name, val), file=sys.stderr)
return None
def solve():
N = int(input())
A = [int(i) for i in input().split()]
yes = "YES"
no = "NO"
if sum(A) % 2 == 0:
... | false | 22.222222 | [
"- num_od = 0",
"- for a in A:",
"- if a % 2 == 1:",
"- num_od += 1",
"- if num_od % 2 == 1:",
"+ if sum(A) % 2 == 0:",
"+ print(yes)",
"+ else:",
"- else:",
"- print(yes)"
] | false | 0.074466 | 0.037882 | 1.965734 | [
"s080367161",
"s411822975"
] |
u889344512 | p02936 | python | s046739849 | s891083968 | 1,882 | 1,488 | 60,424 | 60,372 | Accepted | Accepted | 20.94 | from collections import deque
n, q = list(map(int,input().split()))
d = [[] for i in range(n)]
for i in range(n-1):
ai, bi = list(map(int,input().split()))
d[ai-1].append(bi-1)
d[bi-1].append(ai-1)
#point
px = [0 for i in range(n)]
for i in range(q):
pi,xi = list(map(int,input().split()))
... | import sys
from collections import deque
def input():
return sys.stdin.readline()[:-1]
n, q = list(map(int,input().split()))
d = [[] for i in range(n)]
for i in range(n-1):
ai, bi = list(map(int,input().split()))
d[ai-1].append(bi-1)
d[bi-1].append(ai-1)
#point
px = [0 for i in range(n)]
for... | 26 | 29 | 635 | 699 | from collections import deque
n, q = list(map(int, input().split()))
d = [[] for i in range(n)]
for i in range(n - 1):
ai, bi = list(map(int, input().split()))
d[ai - 1].append(bi - 1)
d[bi - 1].append(ai - 1)
# point
px = [0 for i in range(n)]
for i in range(q):
pi, xi = list(map(int, input().split())... | import sys
from collections import deque
def input():
return sys.stdin.readline()[:-1]
n, q = list(map(int, input().split()))
d = [[] for i in range(n)]
for i in range(n - 1):
ai, bi = list(map(int, input().split()))
d[ai - 1].append(bi - 1)
d[bi - 1].append(ai - 1)
# point
px = [0 for i in range(n)... | false | 10.344828 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+"
] | false | 0.055256 | 0.036536 | 1.512398 | [
"s046739849",
"s891083968"
] |
u150984829 | p00423 | python | s225655262 | s319281277 | 110 | 100 | 5,616 | 5,636 | Accepted | Accepted | 9.09 | while 1:
a=b=0;n=int(eval(input()))
if n==0:break
while n:
s,t=list(map(int,input().split()))
if s>t:a+=s+t
elif s<t:b+=s+t
else:a+=s;b+=t
n-=1
print((a,b))
| import sys
for e in sys.stdin:
a=b=0;n=int(e)
if n:
for i in[0]*n:
s,t=list(map(int,input().split()))
if s>t:a+=s+t
elif s<t:b+=s+t
else:a+=s;b+=t
print((a,b))
| 10 | 10 | 166 | 179 | while 1:
a = b = 0
n = int(eval(input()))
if n == 0:
break
while n:
s, t = list(map(int, input().split()))
if s > t:
a += s + t
elif s < t:
b += s + t
else:
a += s
b += t
n -= 1
print((a, b))
| import sys
for e in sys.stdin:
a = b = 0
n = int(e)
if n:
for i in [0] * n:
s, t = list(map(int, input().split()))
if s > t:
a += s + t
elif s < t:
b += s + t
else:
a += s
b += t
... | false | 0 | [
"-while 1:",
"+import sys",
"+",
"+for e in sys.stdin:",
"- n = int(eval(input()))",
"- if n == 0:",
"- break",
"- while n:",
"- s, t = list(map(int, input().split()))",
"- if s > t:",
"- a += s + t",
"- elif s < t:",
"- b += s + t",... | false | 0.047155 | 0.102091 | 0.461891 | [
"s225655262",
"s319281277"
] |
u968166680 | p02679 | python | s711165142 | s765984997 | 897 | 512 | 77,476 | 77,348 | Accepted | Accepted | 42.92 | from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
N, *AB = list(map(int, stdin.buffer.read().split()))
d = defaultdict(int)
zeros = 0
for a, b i... | from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
N, *AB = list(map(int, stdin.buffer.read().split()))
d = defaultdict(int)
zeros = 0
for a, b i... | 47 | 45 | 980 | 946 | from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
N, *AB = list(map(int, stdin.buffer.read().split()))
d = defaultdict(int)
zeros = 0
for a, b in zip(AB[::2], AB[... | from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
N, *AB = list(map(int, stdin.buffer.read().split()))
d = defaultdict(int)
zeros = 0
for a, b in zip(AB[::2], AB[... | false | 4.255319 | [
"-keys = sorted(d.keys())",
"-for a, b in keys:",
"- n = d[(a, b)]",
"+for (a, b), n in list(d.items()):"
] | false | 0.035625 | 0.035205 | 1.011934 | [
"s711165142",
"s765984997"
] |
u423966555 | p02773 | python | s096619437 | s573851737 | 768 | 522 | 48,888 | 35,952 | Accepted | Accepted | 32.03 | from collections import defaultdict
n = int(input())
d = defaultdict(int)
for _ in range(n):
key = input()
d[key] += 1
dict = sorted(d.items(), key=lambda x:x[1], reverse=True)
max_v = max(d.values())
dict_li = []
for a in dict:
if a[1]==max_v:
dict_li.append(a[0])
dict_li.sort()... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = Counter(s)
max_v = max(cnt.values())
ans = [s for s,c in list(cnt.items()) if c==max_v]
ans.sort()
print(('\n'.join(ans))) | 18 | 8 | 348 | 208 | from collections import defaultdict
n = int(input())
d = defaultdict(int)
for _ in range(n):
key = input()
d[key] += 1
dict = sorted(d.items(), key=lambda x: x[1], reverse=True)
max_v = max(d.values())
dict_li = []
for a in dict:
if a[1] == max_v:
dict_li.append(a[0])
dict_li.sort()
print(*dict_li,... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = Counter(s)
max_v = max(cnt.values())
ans = [s for s, c in list(cnt.items()) if c == max_v]
ans.sort()
print(("\n".join(ans)))
| false | 55.555556 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-n = int(input())",
"-d = defaultdict(int)",
"-for _ in range(n):",
"- key = input()",
"- d[key] += 1",
"-dict = sorted(d.items(), key=lambda x: x[1], reverse=True)",
"-max_v = max(d.values())",
"-dict_li = []",
"... | false | 0.046555 | 0.038137 | 1.220738 | [
"s096619437",
"s573851737"
] |
u944325914 | p02959 | python | s877027605 | s466941432 | 151 | 128 | 18,624 | 24,228 | Accepted | Accepted | 15.23 | N=int(eval(input()))
a=list(map(int,input().split()))
B=list(map(int,input().split()))
A=a.copy()
for i in reversed(list(range(N))):
if A[i+1]-B[i]<=0:
if A[i]+A[i+1]-B[i]>=0:
A[i]=A[i]+A[i+1]-B[i]
A[i+1]=0
else:
A[i]=0
A[i+1]=0
else:
A[i+1]=A[i+1]-B[i]
print((sum(a... | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
if a[i]>=b[i]:
a[i]=a[i]-b[i]
ans+=b[i]
elif a[i+1]-(b[i]-a[i])>=0:
a[i+1]=a[i+1]-(b[i]-a[i])
a[i]=0
ans+=b[i]
else:
ans+=a[i]+a[i+1]
... | 15 | 17 | 317 | 358 | N = int(eval(input()))
a = list(map(int, input().split()))
B = list(map(int, input().split()))
A = a.copy()
for i in reversed(list(range(N))):
if A[i + 1] - B[i] <= 0:
if A[i] + A[i + 1] - B[i] >= 0:
A[i] = A[i] + A[i + 1] - B[i]
A[i + 1] = 0
else:
A[i] = 0
... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] >= b[i]:
a[i] = a[i] - b[i]
ans += b[i]
elif a[i + 1] - (b[i] - a[i]) >= 0:
a[i + 1] = a[i + 1] - (b[i] - a[i])
a[i] = 0
ans += b[i]
else:... | false | 11.764706 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-B = list(map(int, input().split()))",
"-A = a.copy()",
"-for i in reversed(list(range(N))):",
"- if A[i + 1] - B[i] <= 0:",
"- if A[i] + A[i + 1] - B[i] >= 0:",
"- A[i] = A[i] + A[i + 1] - B[i]",
"- A[i + 1] = 0"... | false | 0.081487 | 0.177394 | 0.459356 | [
"s877027605",
"s466941432"
] |
u528470578 | p02659 | python | s855922686 | s825240544 | 25 | 22 | 9,944 | 9,172 | Accepted | Accepted | 12 | from decimal import *
from math import floor
A, B = list(map(float, input().split()))
temp = Decimal(str(A)) * Decimal(str(B))
print((floor(temp))) | A, B = input().split()
B = B.replace(".", "")
A, B = list(map(int, [A, B]))
print((int(A * B // 100))) | 5 | 4 | 143 | 97 | from decimal import *
from math import floor
A, B = list(map(float, input().split()))
temp = Decimal(str(A)) * Decimal(str(B))
print((floor(temp)))
| A, B = input().split()
B = B.replace(".", "")
A, B = list(map(int, [A, B]))
print((int(A * B // 100)))
| false | 20 | [
"-from decimal import *",
"-from math import floor",
"-",
"-A, B = list(map(float, input().split()))",
"-temp = Decimal(str(A)) * Decimal(str(B))",
"-print((floor(temp)))",
"+A, B = input().split()",
"+B = B.replace(\".\", \"\")",
"+A, B = list(map(int, [A, B]))",
"+print((int(A * B // 100)))"
] | false | 0.036245 | 0.035353 | 1.025233 | [
"s855922686",
"s825240544"
] |
u183754334 | p03478 | python | s805911867 | s668223164 | 39 | 34 | 3,292 | 3,292 | Accepted | Accepted | 12.82 |
N, A, B = list(map(int, input().rstrip().split(' ')))
LIST_RESULT = []
for i in range(1, N+1):
str_i = str(i)
l = len(str_i)
sum_tmp = 0
for x in range(l):
sum_tmp += int(str_i[x])
if A <= sum_tmp and sum_tmp <= B:
LIST_RESULT.append(i)
sum_result = sum(LIST_RESULT)... | # coding: utf-8
"""this is python work script"""
def solve(N, A, B):
LIST_RESULT = []
for i in range(1, N + 1):
str_i = str(i)
l = len(str_i)
sum_tmp = 0
for x in range(l):
sum_tmp += int(str_i[x])
if A <= sum_tmp and sum_tmp <= B:
LIS... | 16 | 23 | 340 | 561 | N, A, B = list(map(int, input().rstrip().split(" ")))
LIST_RESULT = []
for i in range(1, N + 1):
str_i = str(i)
l = len(str_i)
sum_tmp = 0
for x in range(l):
sum_tmp += int(str_i[x])
if A <= sum_tmp and sum_tmp <= B:
LIST_RESULT.append(i)
sum_result = sum(LIST_RESULT)
print(sum_resul... | # coding: utf-8
"""this is python work script"""
def solve(N, A, B):
LIST_RESULT = []
for i in range(1, N + 1):
str_i = str(i)
l = len(str_i)
sum_tmp = 0
for x in range(l):
sum_tmp += int(str_i[x])
if A <= sum_tmp and sum_tmp <= B:
LIST_RESULT.ap... | false | 30.434783 | [
"-N, A, B = list(map(int, input().rstrip().split(\" \")))",
"-LIST_RESULT = []",
"-for i in range(1, N + 1):",
"- str_i = str(i)",
"- l = len(str_i)",
"- sum_tmp = 0",
"- for x in range(l):",
"- sum_tmp += int(str_i[x])",
"- if A <= sum_tmp and sum_tmp <= B:",
"- LIST_... | false | 0.046645 | 0.045753 | 1.0195 | [
"s805911867",
"s668223164"
] |
u621935300 | p02763 | python | s834959397 | s243536709 | 716 | 536 | 169,352 | 169,352 | Accepted | Accepted | 25.14 | # -*- coding: utf-8 -*-
import sys
N=eval(input())
S=["None"]+list(input())
Q=eval(input())
query=[ sys.stdin.readline().split() for _ in range(Q) ]
#BIT
bit=[ [ 0 for _ in range(N+1) ] for _ in range(27) ] #中も外も1-indexed bit[1]:aのbit, bit[2]:bのbit ...
def add(idx,a,w):
while a<=N:
bit[idx]... | # -*- coding: utf-8 -*-
import sys
N=eval(input())
S=["None"]+list(input())
Q=eval(input())
query=[ sys.stdin.readline().split() for _ in range(Q) ]
#BIT
bit=[ [ 0 for _ in range(N+1) ] for _ in range(27) ] #1-indexed bit[1]:aのbit, bit[2]:bのbit ...
def add(idx,a,w):
while a<=N:
bit[idx][a]+... | 45 | 45 | 1,151 | 1,147 | # -*- coding: utf-8 -*-
import sys
N = eval(input())
S = ["None"] + list(input())
Q = eval(input())
query = [sys.stdin.readline().split() for _ in range(Q)]
# BIT
bit = [
[0 for _ in range(N + 1)] for _ in range(27)
] # 中も外も1-indexed bit[1]:aのbit, bit[2]:bのbit ...
def add(idx, a, w):
while a <= N:
b... | # -*- coding: utf-8 -*-
import sys
N = eval(input())
S = ["None"] + list(input())
Q = eval(input())
query = [sys.stdin.readline().split() for _ in range(Q)]
# BIT
bit = [
[0 for _ in range(N + 1)] for _ in range(27)
] # 1-indexed bit[1]:aのbit, bit[2]:bのbit ...
def add(idx, a, w):
while a <= N:
bit[i... | false | 0 | [
"-] # 中も外も1-indexed bit[1]:aのbit, bit[2]:bのbit ...",
"+] # 1-indexed bit[1]:aのbit, bit[2]:bのbit ..."
] | false | 0.04585 | 0.047288 | 0.9696 | [
"s834959397",
"s243536709"
] |
u021019433 | p02900 | python | s958788965 | s852242565 | 440 | 364 | 5,048 | 5,048 | Accepted | Accepted | 17.27 | from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
r += d % i == 0
while d % i == 0:
d //= i
i += 1
print((r + (d > 1))) | from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
c = 0
while d % i == 0:
c += 1
d //= i
r += c > 0
i += 1
print((r + (d > 1))) | 11 | 13 | 191 | 213 | from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
r += d % i == 0
while d % i == 0:
d //= i
i += 1
print((r + (d > 1)))
| from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
c = 0
while d % i == 0:
c += 1
d //= i
r += c > 0
i += 1
print((r + (d > 1)))
| false | 15.384615 | [
"- r += d % i == 0",
"+ c = 0",
"+ c += 1",
"+ r += c > 0"
] | false | 0.046316 | 0.071105 | 0.651377 | [
"s958788965",
"s852242565"
] |
u648212584 | p02925 | python | s627417140 | s678271288 | 1,603 | 996 | 209,024 | 125,056 | Accepted | Accepted | 37.87 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
def main():
N = int(eval(input()))
memo = []
base = 0
for i in range(N-1):
memo.append(base)
base += N-i-1
edge = [[] for _ in range((N*(N-1))//2)]
for i in range(N):
a = list(ma... | import sys
input = sys.stdin.buffer.readline
from collections import deque
def main():
N = int(eval(input()))
memo = []
base = 0
for i in range(N-1):
memo.append(base)
base += N-i-1
edge = [[] for _ in range((N*(N-1))//2)]
IN = [0]*((N*(N-1))//2)
for i in ... | 56 | 52 | 1,277 | 1,276 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
def main():
N = int(eval(input()))
memo = []
base = 0
for i in range(N - 1):
memo.append(base)
base += N - i - 1
edge = [[] for _ in range((N * (N - 1)) // 2)]
for i in range(N):
a = list(map(int... | import sys
input = sys.stdin.buffer.readline
from collections import deque
def main():
N = int(eval(input()))
memo = []
base = 0
for i in range(N - 1):
memo.append(base)
base += N - i - 1
edge = [[] for _ in range((N * (N - 1)) // 2)]
IN = [0] * ((N * (N - 1)) // 2)
for i ... | false | 7.142857 | [
"-sys.setrecursionlimit(10**7)",
"+from collections import deque",
"+ IN = [0] * ((N * (N - 1)) // 2)",
"- edge[b[i + 1]].append(b[i])",
"- go = [False] * ((N * (N - 1)) // 2)",
"- cul = [False] * ((N * (N - 1)) // 2)",
"- dp = [0] * ((N * (N - 1)) // 2)",
"+ edge[b[i... | false | 0.076677 | 0.041782 | 1.83516 | [
"s627417140",
"s678271288"
] |
u747602774 | p02984 | python | s719089206 | s004688138 | 147 | 123 | 14,028 | 19,096 | Accepted | Accepted | 16.33 | N = int(eval(input()))
A = list(map(int,input().split()))
s = 0
for i,a in enumerate(A):
if i%2:
s -= a
else:
s += a
ans = [-1 for i in range(N)]
ans[0] = s
for i in range(1,N):
ans[i] = (A[i-1]-ans[i-1]//2)*2
print((*ans))
| N = int(eval(input()))
A = list(map(int,input().split()))
s = 0
for i,a in enumerate(A):
if i%2:
s -= a
else:
s += a
ans = [-1 for i in range(N)]
ans[0] = s
for i in range(1,N):
ans[i] = (A[i-1]-ans[i-1]//2)*2
print((' '.join(map(str,ans))))
| 16 | 16 | 262 | 280 | N = int(eval(input()))
A = list(map(int, input().split()))
s = 0
for i, a in enumerate(A):
if i % 2:
s -= a
else:
s += a
ans = [-1 for i in range(N)]
ans[0] = s
for i in range(1, N):
ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2
print((*ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
s = 0
for i, a in enumerate(A):
if i % 2:
s -= a
else:
s += a
ans = [-1 for i in range(N)]
ans[0] = s
for i in range(1, N):
ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2
print((" ".join(map(str, ans))))
| false | 0 | [
"-print((*ans))",
"+print((\" \".join(map(str, ans))))"
] | false | 0.039853 | 0.048979 | 0.813667 | [
"s719089206",
"s004688138"
] |
u144913062 | p03949 | python | s642540747 | s028719055 | 914 | 808 | 233,768 | 211,664 | Accepted | Accepted | 11.6 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(input())
G = [[] for _ in range(N+1)]
for _ in range(N-1):
A, B = map(int, input().split())
G[A].append(B)
G[B].append(A)
K = int(input())
num = [-1] * (N+1)
for _ in range(K):
V, P = map(int, input().split())
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(input())
G = [[] for _ in range(N+1)]
for _ in range(N-1):
A, B = map(int, input().split())
G[A].append(B)
G[B].append(A)
K = int(input())
num = [-1] * (N+1)
for _ in range(K):
V, P = map(int, input().split())
... | 84 | 72 | 1,676 | 1,530 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(input())
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
A, B = map(int, input().split())
G[A].append(B)
G[B].append(A)
K = int(input())
num = [-1] * (N + 1)
for _ in range(K):
V, P = map(int, input().split())
num[V] =... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(input())
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
A, B = map(int, input().split())
G[A].append(B)
G[B].append(A)
K = int(input())
num = [-1] * (N + 1)
for _ in range(K):
V, P = map(int, input().split())
num[V] =... | false | 14.285714 | [
"+ if lb[v] > ub[v]:",
"+ print(\"No\")",
"+ exit()",
"- dfs2(c, v)",
"-",
"-",
"-dfs2(1, 0)",
"-for i in range(1, N + 1):",
"- if lb[i] > ub[i]:",
"- print(\"No\")",
"- exit()",
"-print(\"Yes\")",
"-",
"-",
"-def dfs3(v, p):",
"- for c in G[... | false | 0.111296 | 0.102695 | 1.083751 | [
"s642540747",
"s028719055"
] |
u802963389 | p03087 | python | s863128242 | s057581623 | 867 | 470 | 9,540 | 30,700 | Accepted | Accepted | 45.79 | N, Q = list(map(int, input().split()))
S = eval(input())
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((t[r-1] - t[l-1]))
| n, q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
li = [0] * n
# print(s[0:2])
for i in range(n - 1):
if s[i:i + 2] == "AC":
li[i+1] += li[i] + 1
else:
li[i+1] = li[i]
# print(li)
for j in lr:
print((li[j[1]-1] - li[j[0]-1])) | 8 | 14 | 223 | 303 | N, Q = list(map(int, input().split()))
S = eval(input())
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((t[r - 1] - t[l - 1]))
| n, q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
li = [0] * n
# print(s[0:2])
for i in range(n - 1):
if s[i : i + 2] == "AC":
li[i + 1] += li[i] + 1
else:
li[i + 1] = li[i]
# print(li)
for j in lr:
print((li[j[1] - 1] - li[j[0]... | false | 42.857143 | [
"-N, Q = list(map(int, input().split()))",
"-S = eval(input())",
"-t = [0] * (N + 1)",
"-for i in range(N):",
"- t[i + 1] = t[i] + (1 if S[i : i + 2] == \"AC\" else 0)",
"-for i in range(Q):",
"- l, r = list(map(int, input().split()))",
"- print((t[r - 1] - t[l - 1]))",
"+n, q = list(map(in... | false | 0.053788 | 0.042737 | 1.258573 | [
"s863128242",
"s057581623"
] |
u017810624 | p02845 | python | s355232530 | s662033798 | 452 | 231 | 92,940 | 52,952 | Accepted | Accepted | 48.89 | import sys
def cmb(n,r,mod):
if r<0 or r>n:
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**9+7
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,n*2):
g1.append((g1[-1]*i)%mod)
inverse.append((-inverse[mod%i]*(mod//i))%m... | n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**9+7
ct=[0,0,0]
ans=1
for i in range(n):
f=0
ct2=0
for j in range(3):
if a[i]==ct[j]:
if ct2==0:
ct[j]+=1
ct2+=1
ans*=ct2
ans%=mod
print((ans%mod)) | 31 | 17 | 534 | 251 | import sys
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n * 2):
g1.append((g1[-1] * i) % mod)
... | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ct = [0, 0, 0]
ans = 1
for i in range(n):
f = 0
ct2 = 0
for j in range(3):
if a[i] == ct[j]:
if ct2 == 0:
ct[j] += 1
ct2 += 1
ans *= ct2
ans %= mod
print((ans % mod))
| false | 45.16129 | [
"-import sys",
"-",
"-",
"-def cmb(n, r, mod):",
"- if r < 0 or r > n:",
"- return 0",
"- r = min(r, n - r)",
"- return g1[n] * g2[r] * g2[n - r] % mod",
"-",
"-",
"-g1 = [1, 1]",
"-g2 = [1, 1]",
"-inverse = [0, 1]",
"-for i in range(2, n * 2):",
"- g1.append((g1[-1] *... | false | 0.035648 | 0.085548 | 0.416706 | [
"s355232530",
"s662033798"
] |
u028973125 | p03830 | python | s386064557 | s512903324 | 210 | 30 | 41,708 | 9,152 | Accepted | Accepted | 85.71 | import sys
N = int(sys.stdin.readline().strip())
def factorization(n):
arr = []
temp = n
# sqrtまで
for i in range(2, int(-(-n**0.5 // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
ar... | import sys
N = int(sys.stdin.readline())
mod = 10**9 + 7
values = [i for i in range(N+1)]
factors = {}
exists = set()
for i in range(2, N+1):
if i not in factors:
factors[i] = 0
for j in range(i, N+1, i):
tmp = values[j]
while tmp % i == 0:
factors[i] += 1
... | 42 | 26 | 835 | 501 | import sys
N = int(sys.stdin.readline().strip())
def factorization(n):
arr = []
temp = n
# sqrtまで
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
arr.append([i... | import sys
N = int(sys.stdin.readline())
mod = 10**9 + 7
values = [i for i in range(N + 1)]
factors = {}
exists = set()
for i in range(2, N + 1):
if i not in factors:
factors[i] = 0
for j in range(i, N + 1, i):
tmp = values[j]
while tmp % i == 0:
factors[i] += 1
... | false | 38.095238 | [
"-N = int(sys.stdin.readline().strip())",
"-",
"-",
"-def factorization(n):",
"- arr = []",
"- temp = n",
"- # sqrtまで",
"- for i in range(2, int(-(-(n**0.5) // 1)) + 1):",
"- if temp % i == 0:",
"- cnt = 0",
"- while temp % i == 0:",
"- c... | false | 0.042974 | 0.122204 | 0.351654 | [
"s386064557",
"s512903324"
] |
u289288647 | p02658 | python | s069502260 | s959066761 | 83 | 56 | 21,664 | 19,380 | Accepted | Accepted | 32.53 | import sys
N = int(eval(input()))
b = 1
a = sorted(list(map(int, input().split())), reverse=True)
if a[-1] == 0:
print("0")
sys.exit()
for i in a:
b *= i
if b > pow(10, 18):
print("-1")
sys.exit()
print(b)
| import sys
N = int(eval(input()))
a = list(map(str, input().split()))
total = 1
if '0' in a:
print('0')
sys.exit()
for i in a:
total *= int(i)
if total > 10**18:
print('-1')
sys.exit()
print(total)
| 17 | 14 | 260 | 238 | import sys
N = int(eval(input()))
b = 1
a = sorted(list(map(int, input().split())), reverse=True)
if a[-1] == 0:
print("0")
sys.exit()
for i in a:
b *= i
if b > pow(10, 18):
print("-1")
sys.exit()
print(b)
| import sys
N = int(eval(input()))
a = list(map(str, input().split()))
total = 1
if "0" in a:
print("0")
sys.exit()
for i in a:
total *= int(i)
if total > 10**18:
print("-1")
sys.exit()
print(total)
| false | 17.647059 | [
"-b = 1",
"-a = sorted(list(map(int, input().split())), reverse=True)",
"-if a[-1] == 0:",
"+a = list(map(str, input().split()))",
"+total = 1",
"+if \"0\" in a:",
"- b *= i",
"- if b > pow(10, 18):",
"+ total *= int(i)",
"+ if total > 10**18:",
"-print(b)",
"+print(total)"
] | false | 0.042532 | 0.035634 | 1.193586 | [
"s069502260",
"s959066761"
] |
u072053884 | p02259 | python | s756029583 | s875035571 | 30 | 20 | 7,648 | 7,644 | Accepted | Accepted | 33.33 | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
tmp = numbers[j]
numbers[j] = numbers[j - 1]
numbers[j - 1] = tmp
# n... | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
cnt = 0
for i in range(n):
for j in range(n - 1, i, -1):
if numbers[j] < numbers[j - 1]:
tmp = numbers[j]
numbers[j] = numbers[j - 1]
numbers[j - 1] = tmp
cnt += 1
numbers = ... | 23 | 18 | 483 | 371 | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
tmp = numbers[j]
numbers[j] = numbers[j - 1]
numbers[j - 1] = tmp
# numbers[j], numbers[... | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
cnt = 0
for i in range(n):
for j in range(n - 1, i, -1):
if numbers[j] < numbers[j - 1]:
tmp = numbers[j]
numbers[j] = numbers[j - 1]
numbers[j - 1] = tmp
cnt += 1
numbers = list(map(str, numb... | false | 21.73913 | [
"-flag = 1",
"-while flag:",
"- flag = 0",
"- for j in range(n - 1, 0, -1):",
"+for i in range(n):",
"+ for j in range(n - 1, i, -1):",
"- # numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]",
"- flag = 1"
] | false | 0.036004 | 0.035627 | 1.010581 | [
"s756029583",
"s875035571"
] |
u022407960 | p02242 | python | s061698784 | s737523127 | 30 | 20 | 8,252 | 8,076 | Accepted | Accepted | 33.33 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
import heapq as hp
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(1e7 + 1)
def generate_adj_matrix(v_info):
fo... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(1e7 + 1)
def generate_adj_matrix(v_info):
for each in v_info:
... | 81 | 78 | 2,324 | 2,209 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
import heapq as hp
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(1e7 + 1)
def generate_adj_matrix(v_info):
for each in v_info:
v_ind... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(1e7 + 1)
def generate_adj_matrix(v_info):
for each in v_info:
v_index, v_adj_length, *... | false | 3.703704 | [
"-import heapq as hp",
"- # path search init",
"- path_list[init_vertex_index] = 0",
"- path_heap = []",
"- # heapq: rank by tuple[0], here ranked by d[u]",
"- hp.heappush(path_heap, (0, init_vertex_index))",
"- while len(path_heap) >= 1:",
"- current_vertex_index = hp.heappop... | false | 0.050897 | 0.045707 | 1.113546 | [
"s061698784",
"s737523127"
] |
u699296734 | p03325 | python | s229843110 | s584411093 | 113 | 67 | 10,024 | 10,052 | Accepted | Accepted | 40.71 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(29, 0, -1):
if a[i] % (2 ** j) == 0:
ans += j
break
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
def count_2(x):
if x % 2 != 0:
return 0
else:
return count_2(x // 2) + 1
ans = 0
for i in range(n):
ans += count_2(a[i])
print(ans)
| 9 | 16 | 202 | 233 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(29, 0, -1):
if a[i] % (2**j) == 0:
ans += j
break
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
def count_2(x):
if x % 2 != 0:
return 0
else:
return count_2(x // 2) + 1
ans = 0
for i in range(n):
ans += count_2(a[i])
print(ans)
| false | 43.75 | [
"+",
"+",
"+def count_2(x):",
"+ if x % 2 != 0:",
"+ return 0",
"+ else:",
"+ return count_2(x // 2) + 1",
"+",
"+",
"- for j in range(29, 0, -1):",
"- if a[i] % (2**j) == 0:",
"- ans += j",
"- break",
"+ ans += count_2(a[i])"
] | false | 0.042981 | 0.156432 | 0.274758 | [
"s229843110",
"s584411093"
] |
u250583425 | p02934 | python | s776871974 | s278163912 | 23 | 17 | 3,572 | 2,940 | Accepted | Accepted | 26.09 | import sys
from functools import reduce
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a_tuple = tuple(map(int, input().split()))
a_mul = reduce(lambda a, b: a*b, a_tuple)
print((a_mul / sum([a_mul / a for a in a_tuple])))
if __name__ == '__main__':
... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a_tuple = tuple(map(int, input().split()))
print((1 / sum([1 / a for a in a_tuple])))
if __name__ == '__main__':
main()
| 12 | 10 | 320 | 235 | import sys
from functools import reduce
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a_tuple = tuple(map(int, input().split()))
a_mul = reduce(lambda a, b: a * b, a_tuple)
print((a_mul / sum([a_mul / a for a in a_tuple])))
if __name__ == "__main__":
... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a_tuple = tuple(map(int, input().split()))
print((1 / sum([1 / a for a in a_tuple])))
if __name__ == "__main__":
main()
| false | 16.666667 | [
"-from functools import reduce",
"- a_mul = reduce(lambda a, b: a * b, a_tuple)",
"- print((a_mul / sum([a_mul / a for a in a_tuple])))",
"+ print((1 / sum([1 / a for a in a_tuple])))"
] | false | 0.037582 | 0.044553 | 0.843548 | [
"s776871974",
"s278163912"
] |
u528470578 | p03835 | python | s507792884 | s184644282 | 1,770 | 1,227 | 3,060 | 3,060 | Accepted | Accepted | 30.68 | K, S = list(map(int, input().split()))
count = 0
for i in range(K+1):
for j in range(K+1):
if 0 <= S - i - j and S - i - j <= K:
count += 1
print(count) | K, S = list(map(int, input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
if 0 <= S - x - y <= K:
ans += 1
print(ans) | 10 | 7 | 188 | 156 | K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
for j in range(K + 1):
if 0 <= S - i - j and S - i - j <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
if 0 <= S - x - y <= K:
ans += 1
print(ans)
| false | 30 | [
"-count = 0",
"-for i in range(K + 1):",
"- for j in range(K + 1):",
"- if 0 <= S - i - j and S - i - j <= K:",
"- count += 1",
"-print(count)",
"+ans = 0",
"+for x in range(K + 1):",
"+ for y in range(K + 1):",
"+ if 0 <= S - x - y <= K:",
"+ ans += 1",... | false | 0.034365 | 0.033702 | 1.019653 | [
"s507792884",
"s184644282"
] |
u136090046 | p03633 | python | s771660003 | s032756204 | 58 | 39 | 5,472 | 5,304 | Accepted | Accepted | 32.76 | from fractions import gcd
res = 0
n = int(eval(input()))
for i in range(n):
if i == 0:
res = int(eval(input()))
else:
tmp = int(eval(input()))
res = res*tmp//gcd(res, tmp)
print(res)
| from fractions import gcd
n = int(eval(input()))
t_array = [int(eval(input())) for x in range(n)]
ans = t_array[0]
for t in t_array[1:]:
ans = ans*t//gcd(ans, t)
print(ans)
| 11 | 8 | 208 | 173 | from fractions import gcd
res = 0
n = int(eval(input()))
for i in range(n):
if i == 0:
res = int(eval(input()))
else:
tmp = int(eval(input()))
res = res * tmp // gcd(res, tmp)
print(res)
| from fractions import gcd
n = int(eval(input()))
t_array = [int(eval(input())) for x in range(n)]
ans = t_array[0]
for t in t_array[1:]:
ans = ans * t // gcd(ans, t)
print(ans)
| false | 27.272727 | [
"-res = 0",
"-for i in range(n):",
"- if i == 0:",
"- res = int(eval(input()))",
"- else:",
"- tmp = int(eval(input()))",
"- res = res * tmp // gcd(res, tmp)",
"-print(res)",
"+t_array = [int(eval(input())) for x in range(n)]",
"+ans = t_array[0]",
"+for t in t_array[1... | false | 0.057915 | 0.048433 | 1.195775 | [
"s771660003",
"s032756204"
] |
u323680411 | p03909 | python | s836693629 | s383465509 | 37 | 17 | 3,060 | 2,940 | Accepted | Accepted | 54.05 | H, W = list(map(int, input().split()))
for i in range(H):
Si = input().split()
for j in range(W):
if Si[j] == "snuke":
ans = chr(ord('A') + j)
ans += str(i + 1)
print(ans) | H, W = list(map(int, input().split()))
key = "snuke"
for i in range(H):
Si = input().split()
if key in Si:
j = Si.index(key)
ans = chr(ord('A') + j)
ans += str(i + 1)
print(ans) | 10 | 11 | 216 | 215 | H, W = list(map(int, input().split()))
for i in range(H):
Si = input().split()
for j in range(W):
if Si[j] == "snuke":
ans = chr(ord("A") + j)
ans += str(i + 1)
print(ans)
| H, W = list(map(int, input().split()))
key = "snuke"
for i in range(H):
Si = input().split()
if key in Si:
j = Si.index(key)
ans = chr(ord("A") + j)
ans += str(i + 1)
print(ans)
| false | 9.090909 | [
"+key = \"snuke\"",
"- for j in range(W):",
"- if Si[j] == \"snuke\":",
"- ans = chr(ord(\"A\") + j)",
"- ans += str(i + 1)",
"+ if key in Si:",
"+ j = Si.index(key)",
"+ ans = chr(ord(\"A\") + j)",
"+ ans += str(i + 1)"
] | false | 0.200925 | 0.056839 | 3.534982 | [
"s836693629",
"s383465509"
] |
u102461423 | p03070 | python | s302891154 | s596923611 | 885 | 554 | 14,516 | 13,504 | Accepted | Accepted | 37.4 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 998244353
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
S = sum(A)
# 赤の和がS/2以上となるものを求めて3倍
# 和に対して何通りあるのか
dp = np.zeros(S+1, dtype=np.int64)
dp[0] = 1
for a in A:
prev = dp
dp =... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 998244353
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
S = sum(A)
# 赤青の和がS/2以下となるものを求めて3倍
dp = np.zeros(S//2+1, dtype=np.int64)
dp[0] = 1
for a in A:
prev = dp
dp = prev.copy()... | 33 | 31 | 642 | 594 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 998244353
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
S = sum(A)
# 赤の和がS/2以上となるものを求めて3倍
# 和に対して何通りあるのか
dp = np.zeros(S + 1, dtype=np.int64)
dp[0] = 1
for a in A:
prev = dp
dp = prev * 2 # 赤以外を採用
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 998244353
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
S = sum(A)
# 赤青の和がS/2以下となるものを求めて3倍
dp = np.zeros(S // 2 + 1, dtype=np.int64)
dp[0] = 1
for a in A:
prev = dp
dp = prev.copy()
dp[a:] += pr... | false | 6.060606 | [
"-# 赤の和がS/2以上となるものを求めて3倍",
"-# 和に対して何通りあるのか",
"-dp = np.zeros(S + 1, dtype=np.int64)",
"+# 赤青の和がS/2以下となるものを求めて3倍",
"+dp = np.zeros(S // 2 + 1, dtype=np.int64)",
"- dp = prev * 2 # 赤以外を採用",
"- dp[a:] += prev[:-a] # 赤",
"+ dp = prev.copy()",
"+ dp[a:] += prev[:-a] * 2",
"-answer = pow(... | false | 0.214305 | 0.216045 | 0.991945 | [
"s302891154",
"s596923611"
] |
u076917070 | p03779 | python | s815267614 | s328596352 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | import sys
input = sys.stdin.readline
def main():
X = int(eval(input()))
x = 0
for i in range(1, X+1):
x += i
if x >= X:
print(i)
return
if __name__ == '__main__':
main()
| import sys
import math
input = sys.stdin.readline
def main():
X = int(eval(input()))
print((math.ceil((-1 + math.sqrt(1+8*X))/2)))
if __name__ == '__main__':
main()
| 16 | 12 | 240 | 184 | import sys
input = sys.stdin.readline
def main():
X = int(eval(input()))
x = 0
for i in range(1, X + 1):
x += i
if x >= X:
print(i)
return
if __name__ == "__main__":
main()
| import sys
import math
input = sys.stdin.readline
def main():
X = int(eval(input()))
print((math.ceil((-1 + math.sqrt(1 + 8 * X)) / 2)))
if __name__ == "__main__":
main()
| false | 25 | [
"+import math",
"- x = 0",
"- for i in range(1, X + 1):",
"- x += i",
"- if x >= X:",
"- print(i)",
"- return",
"+ print((math.ceil((-1 + math.sqrt(1 + 8 * X)) / 2)))"
] | false | 0.042941 | 0.041503 | 1.034635 | [
"s815267614",
"s328596352"
] |
u373047809 | p02947 | python | s552238815 | s129681431 | 351 | 234 | 21,980 | 23,252 | Accepted | Accepted | 33.33 | d = {}
c = 0
for i in open(0):
i = str(sorted(i))
t = d.get(i, 0)
c += t
d[i] = t + 1
print(c) | from collections import*
print((sum(i * (i - 1) // 2 for i in list(Counter("".join(sorted(eval(input()))) for _ in [0] * int(eval(input()))).values())))) | 8 | 2 | 117 | 134 | d = {}
c = 0
for i in open(0):
i = str(sorted(i))
t = d.get(i, 0)
c += t
d[i] = t + 1
print(c)
| from collections import *
print(
(
sum(
i * (i - 1) // 2
for i in list(
Counter(
"".join(sorted(eval(input()))) for _ in [0] * int(eval(input()))
).values()
)
)
)
)
| false | 75 | [
"-d = {}",
"-c = 0",
"-for i in open(0):",
"- i = str(sorted(i))",
"- t = d.get(i, 0)",
"- c += t",
"- d[i] = t + 1",
"-print(c)",
"+from collections import *",
"+",
"+print(",
"+ (",
"+ sum(",
"+ i * (i - 1) // 2",
"+ for i in list(",
"+ ... | false | 0.042177 | 0.036177 | 1.165853 | [
"s552238815",
"s129681431"
] |
u353919145 | p03814 | python | s069992849 | s848963307 | 19 | 11 | 3,500 | 3,328 | Accepted | Accepted | 42.11 | s = eval(input())
start = s.find("A")
end = s.rfind("Z")
print((end - start + 1)) | s = input()
n=s.index("A")
s=s[::-1]
e=s.index("Z")
print(len(s) - n -e) | 6 | 5 | 80 | 79 | s = eval(input())
start = s.find("A")
end = s.rfind("Z")
print((end - start + 1))
| s = input()
n = s.index("A")
s = s[::-1]
e = s.index("Z")
print(len(s) - n - e)
| false | 16.666667 | [
"-s = eval(input())",
"-start = s.find(\"A\")",
"-end = s.rfind(\"Z\")",
"-print((end - start + 1))",
"+s = input()",
"+n = s.index(\"A\")",
"+s = s[::-1]",
"+e = s.index(\"Z\")",
"+print(len(s) - n - e)"
] | false | 0.081437 | 0.06944 | 1.172776 | [
"s069992849",
"s848963307"
] |
u922952729 | p03078 | python | s829220276 | s618167051 | 1,119 | 844 | 160,848 | 147,256 | Accepted | Accepted | 24.58 | import heapq
X,Y,Z,K=[int(i) for i in input().split(" ")]
A=[int(i) for i in input().split(" ")]
B=[int(i) for i in input().split(" ")]
C=[int(i) for i in input().split(" ")]
AB=[]
for a in A:
for b in B:
AB.append(a+b)
AB=heapq.nlargest(K,AB)
ABC=[]
for ab in AB:
for c in C:
AB... | X,Y,Z,K=[int(i) for i in input().split(" ")]
A=[int(i) for i in input().split(" ")]
B=[int(i) for i in input().split(" ")]
C=[int(i) for i in input().split(" ")]
AB=[]
A=sorted(A,reverse=True)[:K:]
B=sorted(B,reverse=True)[:K:]
C=sorted(C,reverse=True)[:K:]
for a in A:
for b in B:
AB.append(... | 19 | 26 | 390 | 506 | import heapq
X, Y, Z, K = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]
B = [int(i) for i in input().split(" ")]
C = [int(i) for i in input().split(" ")]
AB = []
for a in A:
for b in B:
AB.append(a + b)
AB = heapq.nlargest(K, AB)
ABC = []
for ab in AB:
for c in C:
... | X, Y, Z, K = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]
B = [int(i) for i in input().split(" ")]
C = [int(i) for i in input().split(" ")]
AB = []
A = sorted(A, reverse=True)[:K:]
B = sorted(B, reverse=True)[:K:]
C = sorted(C, reverse=True)[:K:]
for a in A:
for b in B:
AB.a... | false | 26.923077 | [
"-import heapq",
"-",
"+A = sorted(A, reverse=True)[:K:]",
"+B = sorted(B, reverse=True)[:K:]",
"+C = sorted(C, reverse=True)[:K:]",
"-AB = heapq.nlargest(K, AB)",
"+AB = sorted(AB, reverse=True)[:K:]",
"-for cake in heapq.nlargest(K, ABC):",
"- print(cake)",
"+ABC = sorted(ABC, reverse=True)[:... | false | 0.042238 | 0.042821 | 0.98638 | [
"s829220276",
"s618167051"
] |
u119148115 | p02574 | python | s596518880 | s942851257 | 427 | 378 | 197,752 | 197,888 | Accepted | Accepted | 11.48 | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
N = I()
A = LI()
from math import gcd
g = 0 # Aiたちの最大公約数
for i in range(N):
g = gcd(g,A[i])
if g != 1:
print('not coprime')
exit()
B = [0]*(... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
N = I()
A = LI()
from math import gcd
g = 0 # Aiたちの最大公約数
for i in range(N):
g = gcd(g,A[i])
if g != 1:
print('not coprime')
exit()
# osa_k法
... | 34 | 50 | 583 | 945 | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
N = I()
A = LI()
from math import gcd
g = 0 # Aiたちの最大公約数
for i in range(N):
g = gcd(g, A[i])
if g != 1:
print("not coprime")
exit()
B = [0] * (10**6 + ... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
N = I()
A = LI()
from math import gcd
g = 0 # Aiたちの最大公約数
for i in range(N):
g = gcd(g, A[i])
if g != 1:
print("not coprime")
exit()
# osa_k法
B = [0] * ... | false | 32 | [
"-B = [0] * (10**6 + 1)",
"+# osa_k法",
"+B = [0] * (10**6 + 1) # B[i] = iの最小の素因数",
"+for i in range(2, 10**3 + 1):",
"+ if B[i] == 0:",
"+ for j in range(i, 10**6 + 1, i):",
"+ if B[j] == 0:",
"+ B[j] = i",
"+for i in range(10**3 + 1, 10**6 + 1):",
"+ if B[i... | false | 1.323464 | 0.566538 | 2.336055 | [
"s596518880",
"s942851257"
] |
u279460955 | p03911 | python | s996180792 | s763313578 | 1,722 | 246 | 136,380 | 96,236 | Accepted | Accepted | 85.71 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind: # 0-index
def __init__(self, n):
self.n = n
self.parents = [-1] * n # 親の番号 要素が根の場合は-(そのグループの要素数)を格納
def find(self, x): # 要素xが属するグループの根を返す
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | 106 | 57 | 2,294 | 1,683 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind: # 0-index
def __init__(self, n):
self.n = n
self.parents = [-1] * n # 親の番号 要素が根の場合は-(そのグループの要素数)を格納
def find(self, x): # 要素xが属するグループの根を返す
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
r... | false | 46.226415 | [
"-class UnionFind:",
"+class UnionFind: # 0-index",
"- self.parents = [-1] * n",
"+ self.parents = [-1] * n # 親の番号 要素が根の場合は-(そのグループの要素数)を格納",
"- def find(self, x):",
"+ def find(self, x): # 要素xが属するグループの根を返す",
"- def union(self, x, y):",
"+ def union(self, x, y): # 要素xが属する... | false | 0.137129 | 0.12436 | 1.102679 | [
"s996180792",
"s763313578"
] |
u974100230 | p03478 | python | s659871590 | s403756153 | 43 | 33 | 3,060 | 3,060 | Accepted | Accepted | 23.26 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
if A <= sum(list(map(int, list(str(i))))) <= B:
list(map(int, list(str(i))))
ans += i
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
if A <= sum(map(int, list(str(i)))) <= B:
ans += i
print(ans) | 9 | 7 | 188 | 147 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
if A <= sum(list(map(int, list(str(i))))) <= B:
list(map(int, list(str(i))))
ans += i
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
if A <= sum(map(int, list(str(i)))) <= B:
ans += i
print(ans)
| false | 22.222222 | [
"- if A <= sum(list(map(int, list(str(i))))) <= B:",
"- list(map(int, list(str(i))))",
"+ if A <= sum(map(int, list(str(i)))) <= B:"
] | false | 0.03784 | 0.037407 | 1.011569 | [
"s659871590",
"s403756153"
] |
u619458041 | p02984 | python | s254145293 | s923872614 | 209 | 94 | 14,124 | 19,124 | Accepted | Accepted | 55.02 | import sys
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i, a in enumerate(A):
ans[0] += (-1)**i * a
for i in range(1, N):
ans[i] = A[i-1] * 2 - ans[i-1]
for a in ans:
print(a, end=' ')... | import sys
sys.setrecursionlimit(10**6)
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * N
sign = -1
for a in A:
sign *= -1
ans[0] += sign * a
for i in range(1, N):
ans[i] = A[i-1] * 2 - an... | 21 | 22 | 380 | 403 | import sys
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i, a in enumerate(A):
ans[0] += (-1) ** i * a
for i in range(1, N):
ans[i] = A[i - 1] * 2 - ans[i - 1]
for a in ans:
print(a, end=" ")
print(... | import sys
sys.setrecursionlimit(10**6)
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * N
sign = -1
for a in A:
sign *= -1
ans[0] += sign * a
for i in range(1, N):
ans[i] = A[i - 1] * 2 - ans[i - 1]
... | false | 4.545455 | [
"+",
"+sys.setrecursionlimit(10**6)",
"- N = int(input())",
"+ N = int(eval(input()))",
"- for i, a in enumerate(A):",
"- ans[0] += (-1) ** i * a",
"+ sign = -1",
"+ for a in A:",
"+ sign *= -1",
"+ ans[0] += sign * a",
"- for a in ans:",
"- print(... | false | 0.042591 | 0.042379 | 1.004999 | [
"s254145293",
"s923872614"
] |
u071680334 | p03488 | python | s158021790 | s964070166 | 948 | 352 | 5,088 | 168,596 | Accepted | Accepted | 62.87 | def main():
order = [len(el) for el in list(map(str, input().rstrip().split("T")))]
x_points = {order[0]}
y_points = {0}
for val in order[2::2]:
plus_val = {x + val for x in list(x_points)}
minus_val = {x - val for x in list(x_points)}
x_points = plus_val | minus_val
... | import numpy as np
def main():
order = [len(el) for el in list(map(str, input().rstrip().split("T")))]
x, y = list(map(int, input().split()))
order_x = order[2::2]
order_y = order[1::2]
L_x, L_y = len(order_x), len(order_y)
n = 10000
dp_x = [np.zeros(2*n, dtype=np.bool) for _ in rang... | 20 | 25 | 697 | 835 | def main():
order = [len(el) for el in list(map(str, input().rstrip().split("T")))]
x_points = {order[0]}
y_points = {0}
for val in order[2::2]:
plus_val = {x + val for x in list(x_points)}
minus_val = {x - val for x in list(x_points)}
x_points = plus_val | minus_val
for val ... | import numpy as np
def main():
order = [len(el) for el in list(map(str, input().rstrip().split("T")))]
x, y = list(map(int, input().split()))
order_x = order[2::2]
order_y = order[1::2]
L_x, L_y = len(order_x), len(order_y)
n = 10000
dp_x = [np.zeros(2 * n, dtype=np.bool) for _ in range(L_... | false | 20 | [
"+import numpy as np",
"+",
"+",
"- x_points = {order[0]}",
"- y_points = {0}",
"- for val in order[2::2]:",
"- plus_val = {x + val for x in list(x_points)}",
"- minus_val = {x - val for x in list(x_points)}",
"- x_points = plus_val | minus_val",
"- for val in orde... | false | 0.040459 | 0.628455 | 0.064379 | [
"s158021790",
"s964070166"
] |
u172748267 | p02584 | python | s877559347 | s632944098 | 34 | 28 | 9,200 | 9,032 | Accepted | Accepted | 17.65 | x,k,d=list(map(int,input().split()))
x=abs(x)
ans=0
if x>k*d:
ans=x-(k*d)
else:
if k%2==(x//d)%2:
ans=x%d
else:
ans=min(abs(x%d-d),abs(x%d+d))
print(ans) | x,k,d=list(map(int,input().split()))
x=abs(x)
ans=0
if x>k*d:
ans=x-(k*d)
else:
if k%2==(x//d)%2:
ans=x%d
else:
ans=abs(x%d-d)
print(ans) | 11 | 11 | 185 | 169 | x, k, d = list(map(int, input().split()))
x = abs(x)
ans = 0
if x > k * d:
ans = x - (k * d)
else:
if k % 2 == (x // d) % 2:
ans = x % d
else:
ans = min(abs(x % d - d), abs(x % d + d))
print(ans)
| x, k, d = list(map(int, input().split()))
x = abs(x)
ans = 0
if x > k * d:
ans = x - (k * d)
else:
if k % 2 == (x // d) % 2:
ans = x % d
else:
ans = abs(x % d - d)
print(ans)
| false | 0 | [
"- ans = min(abs(x % d - d), abs(x % d + d))",
"+ ans = abs(x % d - d)"
] | false | 0.041349 | 0.041965 | 0.985331 | [
"s877559347",
"s632944098"
] |
u864197622 | p02813 | python | s561775492 | s626002772 | 200 | 17 | 41,324 | 3,064 | Accepted | Accepted | 91.5 | import itertools
N = int(eval(input()))
P = [int(a)-1 for a in input().split()]
Q = [int(a)-1 for a in input().split()]
i = 0
ans = 0
for a in itertools.permutations(list(range(N)), N):
a = [b for b in a]
if a == P:
ans -= i
if a == Q:
ans += i
i += 1
print((abs(ans))) | fact = [1]
for i in range(20):
fact.append(fact[-1] * (i+1))
def calc(L):
n = len(L)
if n == 1: return 0
a = len([l for l in L if l < L[0]])
return a * fact[n-1] + calc(L[1:])
N = int(eval(input()))
P = [int(a)-1 for a in input().split()]
Q = [int(a)-1 for a in input().split()]
pri... | 15 | 15 | 302 | 340 | import itertools
N = int(eval(input()))
P = [int(a) - 1 for a in input().split()]
Q = [int(a) - 1 for a in input().split()]
i = 0
ans = 0
for a in itertools.permutations(list(range(N)), N):
a = [b for b in a]
if a == P:
ans -= i
if a == Q:
ans += i
i += 1
print((abs(ans)))
| fact = [1]
for i in range(20):
fact.append(fact[-1] * (i + 1))
def calc(L):
n = len(L)
if n == 1:
return 0
a = len([l for l in L if l < L[0]])
return a * fact[n - 1] + calc(L[1:])
N = int(eval(input()))
P = [int(a) - 1 for a in input().split()]
Q = [int(a) - 1 for a in input().split()]
p... | false | 0 | [
"-import itertools",
"+fact = [1]",
"+for i in range(20):",
"+ fact.append(fact[-1] * (i + 1))",
"+",
"+",
"+def calc(L):",
"+ n = len(L)",
"+ if n == 1:",
"+ return 0",
"+ a = len([l for l in L if l < L[0]])",
"+ return a * fact[n - 1] + calc(L[1:])",
"+",
"-i = 0",
... | false | 0.18175 | 0.042116 | 4.315504 | [
"s561775492",
"s626002772"
] |
u809819902 | p03469 | python | s661762728 | s814126134 | 30 | 27 | 8,952 | 9,012 | Accepted | Accepted | 10 | print((input().replace("2017","2018"))) | s=eval(input())
print(("2018"+s[4:])) | 1 | 2 | 37 | 30 | print((input().replace("2017", "2018")))
| s = eval(input())
print(("2018" + s[4:]))
| false | 50 | [
"-print((input().replace(\"2017\", \"2018\")))",
"+s = eval(input())",
"+print((\"2018\" + s[4:]))"
] | false | 0.044356 | 0.044618 | 0.994125 | [
"s661762728",
"s814126134"
] |
u186838327 | p03951 | python | s309472751 | s809673649 | 169 | 64 | 38,256 | 61,800 | Accepted | Accepted | 62.13 | n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
temp = 0
for i in range(n+1):
if t[0:i] == s[n-i:n]:
temp = i
ans = 2*n-temp
print(ans)
| n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
print(n)
exit()
for i in range(n):
#print(s[i:], t[:n-1-i+1])
if s[i:] == t[:n-1-i+1]:
break
else:
i = n
#pass
ans = i*2+(n-i)
print(ans)
| 11 | 17 | 163 | 250 | n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
temp = 0
for i in range(n + 1):
if t[0:i] == s[n - i : n]:
temp = i
ans = 2 * n - temp
print(ans)
| n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
print(n)
exit()
for i in range(n):
# print(s[i:], t[:n-1-i+1])
if s[i:] == t[: n - 1 - i + 1]:
break
else:
i = n
# pass
ans = i * 2 + (n - i)
print(ans)
| false | 35.294118 | [
"-temp = 0",
"-for i in range(n + 1):",
"- if t[0:i] == s[n - i : n]:",
"- temp = i",
"-ans = 2 * n - temp",
"+if s == t:",
"+ print(n)",
"+ exit()",
"+for i in range(n):",
"+ # print(s[i:], t[:n-1-i+1])",
"+ if s[i:] == t[: n - 1 - i + 1]:",
"+ break",
"+else:",... | false | 0.036473 | 0.073778 | 0.494364 | [
"s309472751",
"s809673649"
] |
u936985471 | p03426 | python | s767032984 | s643822798 | 1,019 | 360 | 18,636 | 14,536 | Accepted | Accepted | 64.67 | H,W,D=list(map(int,input().split()))
position=[None]*(H*W+1)
for i in range(H):
A=list(map(int,input().split()))
for j in range(len(A)):
position[A[j]]=[i,j]
dp=[0]*(H*W+1)
for i in range(1,len(dp)):
if i+D>=len(dp):
continue
dp[i]=abs(position[i+D][0]-position[i][0])+abs(position[i+D][1]-... | import sys
readline = sys.stdin.readline
H,W,D = list(map(int,readline().split()))
route = [0] * (H * W + 1)
for i in range(H):
line = list(map(int,readline().split()))
for j in range(len(line)):
route[line[j]] = (i,j)
# 1,2,3 ... の頂点番号を格納した配列を作る
# D個おきに距離を格納する
dist = [0] * (H * W + 1)
for i ... | 31 | 27 | 632 | 575 | H, W, D = list(map(int, input().split()))
position = [None] * (H * W + 1)
for i in range(H):
A = list(map(int, input().split()))
for j in range(len(A)):
position[A[j]] = [i, j]
dp = [0] * (H * W + 1)
for i in range(1, len(dp)):
if i + D >= len(dp):
continue
dp[i] = abs(position[i + D][0]... | import sys
readline = sys.stdin.readline
H, W, D = list(map(int, readline().split()))
route = [0] * (H * W + 1)
for i in range(H):
line = list(map(int, readline().split()))
for j in range(len(line)):
route[line[j]] = (i, j)
# 1,2,3 ... の頂点番号を格納した配列を作る
# D個おきに距離を格納する
dist = [0] * (H * W + 1)
for i in ra... | false | 12.903226 | [
"-H, W, D = list(map(int, input().split()))",
"-position = [None] * (H * W + 1)",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+H, W, D = list(map(int, readline().split()))",
"+route = [0] * (H * W + 1)",
"- A = list(map(int, input().split()))",
"- for j in range(len(A)):",
"- ... | false | 0.037271 | 0.036904 | 1.009945 | [
"s767032984",
"s643822798"
] |
u970899068 | p03305 | python | s845445247 | s296019998 | 1,341 | 995 | 128,600 | 123,100 | Accepted | Accepted | 25.8 | n,m,s,t= list(map(int, input().split()))
a= [list(map(int, input().split())) for i in range(m)]
b = [[] for i in range(n)] # 円のグラフ
c = [[] for i in range(n)] # スヌークのグラフ
for i in range(m):
b[a[i][0]-1].append((a[i][1]-1,a[i][2]))
b[a[i][1]-1].append((a[i][0]-1,a[i][2]))
for i in range(m):
c[a[i][... | import sys
input = sys.stdin.readline
n,m,s,t= list(map(int, input().split()))
a= [list(map(int, input().split())) for i in range(m)]
b = [[] for i in range(n)] # 円のグラフ
c = [[] for i in range(n)] # スヌークのグラフ
for i in range(m):
b[a[i][0]-1].append((a[i][1]-1,a[i][2]))
b[a[i][1]-1].append((a[i][0]-1,... | 46 | 51 | 1,211 | 1,268 | n, m, s, t = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]
b = [[] for i in range(n)] # 円のグラフ
c = [[] for i in range(n)] # スヌークのグラフ
for i in range(m):
b[a[i][0] - 1].append((a[i][1] - 1, a[i][2]))
b[a[i][1] - 1].append((a[i][0] - 1, a[i][2]))
for i in range(m):
c[... | import sys
input = sys.stdin.readline
n, m, s, t = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]
b = [[] for i in range(n)] # 円のグラフ
c = [[] for i in range(n)] # スヌークのグラフ
for i in range(m):
b[a[i][0] - 1].append((a[i][1] - 1, a[i][2]))
b[a[i][1] - 1].append((a[i][0] -... | false | 9.803922 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- distance = [float(\"inf\")] * size",
"+ INF = pow(10, 15)",
"+ distance = [INF] * size",
"-w = float(\"inf\")",
"+w = pow(10, 15)",
"- print((10**15 - ans[i]))",
"+ print((pow(10, 15) - ans[i]))"
] | false | 0.046681 | 0.180815 | 0.258173 | [
"s845445247",
"s296019998"
] |
u986478725 | p02388 | python | s575413271 | s093583216 | 30 | 20 | 7,668 | 5,576 | Accepted | Accepted | 33.33 | def main():
x = int(eval(input()))
print((x ** 3))
if __name__ == "__main__":
main() | def main():
a = int(eval(input()))
print((a ** 3))
if __name__ == "__main__":
main()
| 6 | 6 | 94 | 95 | def main():
x = int(eval(input()))
print((x**3))
if __name__ == "__main__":
main()
| def main():
a = int(eval(input()))
print((a**3))
if __name__ == "__main__":
main()
| false | 0 | [
"- x = int(eval(input()))",
"- print((x**3))",
"+ a = int(eval(input()))",
"+ print((a**3))"
] | false | 0.115835 | 0.112176 | 1.032622 | [
"s575413271",
"s093583216"
] |
u971091945 | p02755 | python | s816828632 | s290657465 | 343 | 18 | 2,940 | 3,060 | Accepted | Accepted | 94.75 | import math
a, b = list(map(int, input().split()))
for i in range(1000000):
if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
print(i)
exit(0)
print((-1)) | import math
a, b = list(map(int, input().split()))
for i in range(1001):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
exit(0)
print((-1)) | 9 | 10 | 181 | 184 | import math
a, b = list(map(int, input().split()))
for i in range(1000000):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
exit(0)
print((-1))
| import math
a, b = list(map(int, input().split()))
for i in range(1001):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
exit(0)
print((-1))
| false | 10 | [
"-for i in range(1000000):",
"+for i in range(1001):"
] | false | 0.296251 | 0.034899 | 8.488855 | [
"s816828632",
"s290657465"
] |
u359358631 | p02584 | python | s265799102 | s609130814 | 35 | 30 | 9,256 | 9,176 | Accepted | Accepted | 14.29 | def main():
X, K, D = list(map(int, input().split()))
if abs(X) > K * D:
print((abs(X) - K * D))
elif abs(X) <= K * D:
s = abs(X) // D
if abs(X) % D == 0:
if s % 2 == 0 and K % 2 == 0:
print((0))
elif s % 2 == 0 and K % 2 == 1:
print(D)
elif s % 2 == 1 and K % 2 == 0:
print(D... | def main():
X, K, D = list(map(int, input().split()))
ans = 0
if abs(X) >= K * D: # 0にたどり着かない or ちょうど0にたどり着く
ans = abs(X) - K * D
else: # 0を通り過ぎて往復する
s = abs(X) // D
if (K - s) % 2 == 0:
ans = abs(X) - s * D # abs(X) - s * D - 0
else:
ans = -abs(X) + (s + 1) * D # 0 - (abs(X) - (s + 1) *... | 30 | 19 | 687 | 376 | def main():
X, K, D = list(map(int, input().split()))
if abs(X) > K * D:
print((abs(X) - K * D))
elif abs(X) <= K * D:
s = abs(X) // D
if abs(X) % D == 0:
if s % 2 == 0 and K % 2 == 0:
print((0))
elif s % 2 == 0 and K % 2 == 1:
... | def main():
X, K, D = list(map(int, input().split()))
ans = 0
if abs(X) >= K * D: # 0にたどり着かない or ちょうど0にたどり着く
ans = abs(X) - K * D
else: # 0を通り過ぎて往復する
s = abs(X) // D
if (K - s) % 2 == 0:
ans = abs(X) - s * D # abs(X) - s * D - 0
else:
ans = -abs... | false | 36.666667 | [
"- if abs(X) > K * D:",
"- print((abs(X) - K * D))",
"- elif abs(X) <= K * D:",
"+ ans = 0",
"+ if abs(X) >= K * D: # 0にたどり着かない or ちょうど0にたどり着く",
"+ ans = abs(X) - K * D",
"+ else: # 0を通り過ぎて往復する",
"- if abs(X) % D == 0:",
"- if s % 2 == 0 and K % 2 == ... | false | 0.037069 | 0.035964 | 1.030731 | [
"s265799102",
"s609130814"
] |
u535171899 | p02678 | python | s153300258 | s868452937 | 1,336 | 692 | 35,144 | 35,444 | Accepted | Accepted | 48.2 | n,m = list(map(int,input().split()))
map_li = [[] for i in range(n)]
for i in range(m):
a,b = list(map(int,input().split()))
a,b = a-1,b-1
map_li[a].append(b)
map_li[b].append(a)
ans_li = [-1]*n
queue=[0]
visited = [False]*n
while queue:
x = queue.pop(0)
for g in map_li[x]:
... | from collections import deque
n,m = list(map(int,input().split()))
map_li = [[] for i in range(n)]
for i in range(m):
a,b = list(map(int,input().split()))
a,b = a-1,b-1
map_li[a].append(b)
map_li[b].append(a)
ans_li = [-1]*n
queue=deque()
queue.append(0)
visited = [False]*n
while queue... | 26 | 27 | 570 | 554 | n, m = list(map(int, input().split()))
map_li = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
map_li[a].append(b)
map_li[b].append(a)
ans_li = [-1] * n
queue = [0]
visited = [False] * n
while queue:
x = queue.pop(0)
for g in map_li[x]:
... | from collections import deque
n, m = list(map(int, input().split()))
map_li = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
map_li[a].append(b)
map_li[b].append(a)
ans_li = [-1] * n
queue = deque()
queue.append(0)
visited = [False] * n
while queue:... | false | 3.703704 | [
"+from collections import deque",
"+",
"-queue = [0]",
"+queue = deque()",
"+queue.append(0)",
"- x = queue.pop(0)",
"+ x = queue.popleft()",
"- if visited[g] == False:",
"+ if ans_li[g] == -1:",
"+ ans_li[g] = x",
"- if ans_li[g] == -1:",
"- ... | false | 0.036737 | 0.034122 | 1.076648 | [
"s153300258",
"s868452937"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.