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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u815878613 | p03633 | python | s225588649 | s451953809 | 38 | 32 | 5,204 | 9,484 | Accepted | Accepted | 15.79 | import fractions
import sys
from functools import reduce
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, n... | import math
from functools import reduce
# 最小公倍数
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
p... | 27 | 20 | 445 | 344 | import fractions
import sys
from functools import reduce
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
def ... | import math
from functools import reduce
# 最小公倍数
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
print((lcm_list(T))... | false | 25.925926 | [
"-import fractions",
"-import sys",
"+import math",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-",
"-",
"+# 最小公倍数",
"- return (x * y) // fractions.gcd(x, y)",
"+ return (x * y) // math.gcd(x, y)",
"-def main():",
"- N = int(readline())",
"- T = lis... | false | 0.053319 | 0.036763 | 1.450351 | [
"s225588649",
"s451953809"
] |
u067299340 | p00009 | python | s868009470 | s417508198 | 430 | 270 | 24,796 | 26,424 | Accepted | Accepted | 37.21 | import sys
p=[1]*999999
p[0]=p[1]=0
p[4::2]=[0]*len(p[4::2])
for i in range(3,1000,2):p[i*i::i]=[0]*len(p[i*i::i])
for n in sys.stdin:print(p[0:int(n)+1].count(1)) | max_n = 999999
prime_list = [1] * (max_n + 1)
# 0, 1は素数ではない
prime_list[0:2] = [0, 0]
#
for i in range(2, int(max_n**0.5) + 1):
if prime_list[i] == 1:
prime_list[i**2::i] = [0] * len(prime_list[i**2::i])
while True:
try:
n = int(eval(input()))
print((sum(prime_list[:n + ... | 6 | 19 | 168 | 359 | import sys
p = [1] * 999999
p[0] = p[1] = 0
p[4::2] = [0] * len(p[4::2])
for i in range(3, 1000, 2):
p[i * i :: i] = [0] * len(p[i * i :: i])
for n in sys.stdin:
print(p[0 : int(n) + 1].count(1))
| max_n = 999999
prime_list = [1] * (max_n + 1)
# 0, 1は素数ではない
prime_list[0:2] = [0, 0]
#
for i in range(2, int(max_n**0.5) + 1):
if prime_list[i] == 1:
prime_list[i**2 :: i] = [0] * len(prime_list[i**2 :: i])
while True:
try:
n = int(eval(input()))
print((sum(prime_list[: n + 1])))
exc... | false | 68.421053 | [
"-import sys",
"-",
"-p = [1] * 999999",
"-p[0] = p[1] = 0",
"-p[4::2] = [0] * len(p[4::2])",
"-for i in range(3, 1000, 2):",
"- p[i * i :: i] = [0] * len(p[i * i :: i])",
"-for n in sys.stdin:",
"- print(p[0 : int(n) + 1].count(1))",
"+max_n = 999999",
"+prime_list = [1] * (max_n + 1)",
... | false | 0.572612 | 0.157458 | 3.6366 | [
"s868009470",
"s417508198"
] |
u975445930 | p02713 | python | s520315276 | s843211935 | 1,986 | 1,402 | 9,148 | 9,176 | Accepted | Accepted | 29.41 | from math import gcd
K = int(eval(input()))+1
ans = 0
for i in range(1,K):
for j in range(1,K):
for k in range(1,K):
ans += gcd(gcd(i, j),k)
print(ans) | from math import gcd
def solve():
K = int(eval(input()))+1
ans = 0
for i in range(1,K):
for j in range(1,K):
for k in range(1,K):
ans += gcd(gcd(i, j),k)
return ans
print((solve())) | 9 | 12 | 178 | 238 | from math import gcd
K = int(eval(input())) + 1
ans = 0
for i in range(1, K):
for j in range(1, K):
for k in range(1, K):
ans += gcd(gcd(i, j), k)
print(ans)
| from math import gcd
def solve():
K = int(eval(input())) + 1
ans = 0
for i in range(1, K):
for j in range(1, K):
for k in range(1, K):
ans += gcd(gcd(i, j), k)
return ans
print((solve()))
| false | 25 | [
"-K = int(eval(input())) + 1",
"-ans = 0",
"-for i in range(1, K):",
"- for j in range(1, K):",
"- for k in range(1, K):",
"- ans += gcd(gcd(i, j), k)",
"-print(ans)",
"+",
"+def solve():",
"+ K = int(eval(input())) + 1",
"+ ans = 0",
"+ for i in range(1, K):",
... | false | 0.164377 | 0.006989 | 23.517713 | [
"s520315276",
"s843211935"
] |
u022979415 | p02802 | python | s672214481 | s620811610 | 609 | 286 | 9,324 | 13,172 | Accepted | Accepted | 53.04 | def main():
N, M = list(map(int, input().split(" ")))
ac = 0
wa = 0
answer = ["C"] * N # C: 適当な初期値
for _ in range(M):
ps = input().split(" ")
p = int(ps[0]) - 1
if not answer[p][-1] == "A":
answer[p] = answer[p] + ps[1][0]
if M > 0:
for a i... | def main():
n, m = list(map(int, input().split()))
questions = [[0, False] for _ in range(n)]
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if not questions[p][1]:
if s == "WA":
questions[p][0] += 1
else:
qu... | 20 | 23 | 477 | 539 | def main():
N, M = list(map(int, input().split(" ")))
ac = 0
wa = 0
answer = ["C"] * N # C: 適当な初期値
for _ in range(M):
ps = input().split(" ")
p = int(ps[0]) - 1
if not answer[p][-1] == "A":
answer[p] = answer[p] + ps[1][0]
if M > 0:
for a in answer:
... | def main():
n, m = list(map(int, input().split()))
questions = [[0, False] for _ in range(n)]
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if not questions[p][1]:
if s == "WA":
questions[p][0] += 1
else:
questions[p]... | false | 13.043478 | [
"- N, M = list(map(int, input().split(\" \")))",
"+ n, m = list(map(int, input().split()))",
"+ questions = [[0, False] for _ in range(n)]",
"+ for _ in range(m):",
"+ p, s = input().split()",
"+ p = int(p) - 1",
"+ if not questions[p][1]:",
"+ if s == \"WA\... | false | 0.033982 | 0.038342 | 0.886277 | [
"s672214481",
"s620811610"
] |
u588341295 | p03846 | python | s809031068 | s335828838 | 86 | 78 | 14,008 | 14,812 | Accepted | Accepted | 9.3 | # -*- coding: utf-8 -*-
N = int(eval(input()))
AN = list(map(int, input().split()))
BN = [0] * (N//2+1)
# 偶奇で分けて集計
for i in range(N):
if N % 2 != 0:
BN[N//2 - AN[i]//2] += 1
else:
BN[N//2 - (AN[i]//2+1)] += 1
# 偶数の場合は真ん中を考慮
ans = 0
for i in range(len(BN)):
if BN[i] > 2 o... | # -*- coding: utf-8 -*-
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range... | 23 | 44 | 421 | 1,133 | # -*- coding: utf-8 -*-
N = int(eval(input()))
AN = list(map(int, input().split()))
BN = [0] * (N // 2 + 1)
# 偶奇で分けて集計
for i in range(N):
if N % 2 != 0:
BN[N // 2 - AN[i] // 2] += 1
else:
BN[N // 2 - (AN[i] // 2 + 1)] += 1
# 偶数の場合は真ん中を考慮
ans = 0
for i in range(len(BN)):
if BN[i] > 2 or N % 2... | # -*- coding: utf-8 -*-
import sys
from collections import Counter
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d ... | false | 47.727273 | [
"-N = int(eval(input()))",
"-AN = list(map(int, input().split()))",
"-BN = [0] * (N // 2 + 1)",
"-# 偶奇で分けて集計",
"-for i in range(N):",
"- if N % 2 != 0:",
"- BN[N // 2 - AN[i] // 2] += 1",
"- else:",
"- BN[N // 2 - (AN[i] // 2 + 1)] += 1",
"-# 偶数の場合は真ん中を考慮",
"-ans = 0",
"-fo... | false | 0.041693 | 0.038496 | 1.08304 | [
"s809031068",
"s335828838"
] |
u108617242 | p04043 | python | s109997610 | s124786648 | 38 | 21 | 3,064 | 3,316 | Accepted | Accepted | 44.74 | S = input().split()
tf7 = False
tf52 = False
count5 = 0
for x in S:
if x == "5":
count5 += 1
if count5 == 2:
tf52 = True
if x == "7":
tf7 = True
if tf7==True and tf52==True:
print("YES")
else :
print("NO")
| from collections import Counter
ABC = list(map(int,input().split()))
c = Counter(ABC)
print(("YES"if c[5] == 2 and c[7] == 1 else "NO"))
| 17 | 4 | 237 | 138 | S = input().split()
tf7 = False
tf52 = False
count5 = 0
for x in S:
if x == "5":
count5 += 1
if count5 == 2:
tf52 = True
if x == "7":
tf7 = True
if tf7 == True and tf52 == True:
print("YES")
else:
print("NO")
| from collections import Counter
ABC = list(map(int, input().split()))
c = Counter(ABC)
print(("YES" if c[5] == 2 and c[7] == 1 else "NO"))
| false | 76.470588 | [
"-S = input().split()",
"-tf7 = False",
"-tf52 = False",
"-count5 = 0",
"-for x in S:",
"- if x == \"5\":",
"- count5 += 1",
"- if count5 == 2:",
"- tf52 = True",
"- if x == \"7\":",
"- tf7 = True",
"-if tf7 == True and tf52 == True:",
"- print(\"YES\... | false | 0.037049 | 0.035645 | 1.03939 | [
"s109997610",
"s124786648"
] |
u567380442 | p02317 | python | s267591257 | s677055273 | 390 | 220 | 11,012 | 11,016 | Accepted | Accepted | 43.59 | from sys import stdin
from bisect import bisect_left, bisect_right
readline = stdin.readline
dp = [-float('inf')]
for ai in (int(readline()) for _ in range(int(readline()))):
if dp[-1] < ai:dp.append(ai)
for i in range(bisect_right(dp, ai), bisect_left(dp, ai) + 1):dp[i] = ai
print((len(dp) - 1)) | from sys import stdin
from bisect import bisect_left
readline = stdin.readline
dp = [-float('inf')]
n = int(readline())
a = (int(readline()) for _ in range(n))
for ai in a:
if dp[-1] < ai:
dp.append(ai)
else:
dp[bisect_left(dp, ai)] = ai
print((len(dp) - 1)) | 10 | 14 | 314 | 295 | from sys import stdin
from bisect import bisect_left, bisect_right
readline = stdin.readline
dp = [-float("inf")]
for ai in (int(readline()) for _ in range(int(readline()))):
if dp[-1] < ai:
dp.append(ai)
for i in range(bisect_right(dp, ai), bisect_left(dp, ai) + 1):
dp[i] = ai
print((len(dp) -... | from sys import stdin
from bisect import bisect_left
readline = stdin.readline
dp = [-float("inf")]
n = int(readline())
a = (int(readline()) for _ in range(n))
for ai in a:
if dp[-1] < ai:
dp.append(ai)
else:
dp[bisect_left(dp, ai)] = ai
print((len(dp) - 1))
| false | 28.571429 | [
"-from bisect import bisect_left, bisect_right",
"+from bisect import bisect_left",
"-for ai in (int(readline()) for _ in range(int(readline()))):",
"+n = int(readline())",
"+a = (int(readline()) for _ in range(n))",
"+for ai in a:",
"- for i in range(bisect_right(dp, ai), bisect_left(dp, ai) + 1):",... | false | 0.081461 | 0.085061 | 0.957676 | [
"s267591257",
"s677055273"
] |
u941438707 | p02866 | python | s745953013 | s945530487 | 145 | 92 | 20,956 | 13,956 | Accepted | Accepted | 36.55 | n,*a=list(map(int,open(0).read().split()))
mod=998244353
d={}
for i in a:
d[i]=d.get(i,0)+1
b=list(d.items())
b.sort()
ans=1
if a[0]!=0 or len(b)!=b[-1][0]+1 or b[0][1]!=1:
ans=0
for i in range(1,len(b)):
ans*=b[i-1][1]**b[i][1]
ans%=mod
print(ans) | n,*a=list(map(int,open(0).read().split()))
mod=998244353
b=[0]*n
for i in a:
b[i]+=1
ans=0
if a[0]==0 and 1==b[0]:
ans=1
for i,j in zip(b,b[1:]):
ans=ans*i**j%mod
print(ans) | 14 | 11 | 269 | 189 | n, *a = list(map(int, open(0).read().split()))
mod = 998244353
d = {}
for i in a:
d[i] = d.get(i, 0) + 1
b = list(d.items())
b.sort()
ans = 1
if a[0] != 0 or len(b) != b[-1][0] + 1 or b[0][1] != 1:
ans = 0
for i in range(1, len(b)):
ans *= b[i - 1][1] ** b[i][1]
ans %= mod
print(ans)
| n, *a = list(map(int, open(0).read().split()))
mod = 998244353
b = [0] * n
for i in a:
b[i] += 1
ans = 0
if a[0] == 0 and 1 == b[0]:
ans = 1
for i, j in zip(b, b[1:]):
ans = ans * i**j % mod
print(ans)
| false | 21.428571 | [
"-d = {}",
"+b = [0] * n",
"- d[i] = d.get(i, 0) + 1",
"-b = list(d.items())",
"-b.sort()",
"-ans = 1",
"-if a[0] != 0 or len(b) != b[-1][0] + 1 or b[0][1] != 1:",
"- ans = 0",
"-for i in range(1, len(b)):",
"- ans *= b[i - 1][1] ** b[i][1]",
"- ans %= mod",
"+ b[i] += 1",
"+a... | false | 0.047717 | 0.088697 | 0.537982 | [
"s745953013",
"s945530487"
] |
u380524497 | p02583 | python | s072232818 | s796881982 | 81 | 34 | 9,192 | 9,480 | Accepted | Accepted | 58.02 | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(n-2):
for j in range(i, n-1):
for k in range(j, n):
if L[k] < L[j] + L[i] and len({L[i], L[j], L[k]}) == 3:
... | from collections import Counter
from bisect import bisect_left
import sys
input = sys.stdin.readline
def main():
_ = int(eval(input()))
L = list(map(int, input().split()))
counter = Counter(L)
L = list(set(L))
L.sort()
n = len(L)
cumsum = []
total = 0
for l in ... | 19 | 35 | 403 | 724 | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(n - 2):
for j in range(i, n - 1):
for k in range(j, n):
if L[k] < L[j] + L[i] and len({L[i], L[j], L[k]}) == 3:
... | from collections import Counter
from bisect import bisect_left
import sys
input = sys.stdin.readline
def main():
_ = int(eval(input()))
L = list(map(int, input().split()))
counter = Counter(L)
L = list(set(L))
L.sort()
n = len(L)
cumsum = []
total = 0
for l in L:
total += ... | false | 45.714286 | [
"+from collections import Counter",
"+from bisect import bisect_left",
"- n = int(eval(input()))",
"+ _ = int(eval(input()))",
"+ counter = Counter(L)",
"+ L = list(set(L))",
"+ n = len(L)",
"+ cumsum = []",
"+ total = 0",
"+ for l in L:",
"+ total += counter[l]",
... | false | 0.034223 | 0.066431 | 0.515171 | [
"s072232818",
"s796881982"
] |
u896741788 | p03044 | python | s479629552 | s705824131 | 683 | 591 | 85,168 | 44,108 | Accepted | Accepted | 13.47 | import sys
input=sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n=int(input())
edges=[[] for i in range(n)]
for i in range(n-1):
a,s,w=map(int,input().split())
edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])
colors=[-1]*n
colors[0]=1
def dfs(now):
for to,cost in edges[now]:
... | n=int(input())
col=[-1]*n
e=[[[],[]]for i in range(n)]
for i in range(n-1):
u,v,w=map(int,input().split())
u-=1
v-=1
w%=2
e[u][w].append(v)
e[v][w].append(u)
col[0]=1
from collections import deque
dq=deque([])
#pop/append/(append,pop)_left/in/len/count/[]/index/rotate()(右へnずらす)
dq.... | 18 | 24 | 441 | 537 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n = int(input())
edges = [[] for i in range(n)]
for i in range(n - 1):
a, s, w = map(int, input().split())
edges[a - 1].append([s - 1, w])
edges[s - 1].append([a - 1, w])
colors = [-1] * n
colors[0] = 1
def dfs(now):
for to, co... | n = int(input())
col = [-1] * n
e = [[[], []] for i in range(n)]
for i in range(n - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
w %= 2
e[u][w].append(v)
e[v][w].append(u)
col[0] = 1
from collections import deque
dq = deque([])
# pop/append/(append,pop)_left/in/len/count/[]/index/rotat... | false | 25 | [
"-import sys",
"+n = int(input())",
"+col = [-1] * n",
"+e = [[[], []] for i in range(n)]",
"+for i in range(n - 1):",
"+ u, v, w = map(int, input().split())",
"+ u -= 1",
"+ v -= 1",
"+ w %= 2",
"+ e[u][w].append(v)",
"+ e[v][w].append(u)",
"+col[0] = 1",
"+from collection... | false | 0.114921 | 0.043308 | 2.653616 | [
"s479629552",
"s705824131"
] |
u881675205 | p02661 | python | s283972268 | s280160961 | 356 | 188 | 82,088 | 79,204 | Accepted | Accepted | 47.19 | n = int(eval(input()))
a= [0]*n
b= [0]*n
for i in range(n):
a[i], b[i] = list(map(int, input().split()))
if n%2 ==1:
a.sort()
b.sort()
xmin= a[int((n-1)/2)]
xmax= b[int((n - 1) / 2)]
print((int(xmax-xmin+1)))
if n%2 ==0:
a.sort()
b.sort()
xmin = a[int(n/2-1)]+a[... | import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
a= [0]*n
b= [0]*n
for i in range(n):
a[i], b[i] = list(map(int, input().split()))
if n%2 ==1:
a.sort()
b.sort()
xmin= a[int((n-1)/2)]
xmax= b[int((n - 1) / 2)]
print((int(xmax-xmin+1)))
if n%2 ... | 21 | 24 | 392 | 453 | n = int(eval(input()))
a = [0] * n
b = [0] * n
for i in range(n):
a[i], b[i] = list(map(int, input().split()))
if n % 2 == 1:
a.sort()
b.sort()
xmin = a[int((n - 1) / 2)]
xmax = b[int((n - 1) / 2)]
print((int(xmax - xmin + 1)))
if n % 2 == 0:
a.sort()
b.sort()
xmin = a[int(n / 2 - 1)... | import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
a = [0] * n
b = [0] * n
for i in range(n):
a[i], b[i] = list(map(int, input().split()))
if n % 2 == 1:
a.sort()
b.sort()
xmin = a[int((n - 1) / 2)]
xmax = b[int((n - 1) / 2)]
print((int(xmax - xmin + 1)))
if n % 2 =... | false | 12.5 | [
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.045888 | 0.107788 | 0.425722 | [
"s283972268",
"s280160961"
] |
u386170566 | p02994 | python | s734703474 | s034890029 | 20 | 17 | 3,064 | 3,060 | Accepted | Accepted | 15 | #ABCB - Bite Eating
N, L = list(map(int,input().split()))
all = 0
apple = []
for i in range(N):
apple.append(L + i)
a = min(apple)
b = max(apple)
if 0 in apple:
print((sum(apple)))
elif b < 0:
print((sum(apple)-b))
elif a > 0:
print((sum(apple)-a)) | #ABC131B - Bite Eating
N, L = list(map(int,input().split()))
a = L
b = L + N-1
taste = 0
for i in range(N):
taste += L + i
if b < 0:
print((taste - b))
elif a <= 0 and b >= 0:
print((taste - 0))
elif a > 0:
print((taste-a)) | 14 | 13 | 271 | 245 | # ABCB - Bite Eating
N, L = list(map(int, input().split()))
all = 0
apple = []
for i in range(N):
apple.append(L + i)
a = min(apple)
b = max(apple)
if 0 in apple:
print((sum(apple)))
elif b < 0:
print((sum(apple) - b))
elif a > 0:
print((sum(apple) - a))
| # ABC131B - Bite Eating
N, L = list(map(int, input().split()))
a = L
b = L + N - 1
taste = 0
for i in range(N):
taste += L + i
if b < 0:
print((taste - b))
elif a <= 0 and b >= 0:
print((taste - 0))
elif a > 0:
print((taste - a))
| false | 7.142857 | [
"-# ABCB - Bite Eating",
"+# ABC131B - Bite Eating",
"-all = 0",
"-apple = []",
"+a = L",
"+b = L + N - 1",
"+taste = 0",
"- apple.append(L + i)",
"-a = min(apple)",
"-b = max(apple)",
"-if 0 in apple:",
"- print((sum(apple)))",
"-elif b < 0:",
"- print((sum(apple) - b))",
"+ ... | false | 0.049439 | 0.04786 | 1.032979 | [
"s734703474",
"s034890029"
] |
u366369712 | p03371 | python | s391498520 | s453320145 | 183 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.71 | a,b,c,x,y = list(map(int,input().split()))
p = a*(x-min(x,y)) if x > y else b*(y-min(x,y))
print((min((a+b)*min(x,y)+p,c*min(x,y)*2+p,c*max(x,y)*2))) | a,b,c,x,y = list(map(int,input().split()))
if x >= y:
print((min(c*2*y+a*(x-y), a*x+b*y, c*2*x)))
else:
print((min(c*2*x+b*(y-x),a*x+b*y, c*2*y)))
| 4 | 6 | 145 | 151 | a, b, c, x, y = list(map(int, input().split()))
p = a * (x - min(x, y)) if x > y else b * (y - min(x, y))
print((min((a + b) * min(x, y) + p, c * min(x, y) * 2 + p, c * max(x, y) * 2)))
| a, b, c, x, y = list(map(int, input().split()))
if x >= y:
print((min(c * 2 * y + a * (x - y), a * x + b * y, c * 2 * x)))
else:
print((min(c * 2 * x + b * (y - x), a * x + b * y, c * 2 * y)))
| false | 33.333333 | [
"-p = a * (x - min(x, y)) if x > y else b * (y - min(x, y))",
"-print((min((a + b) * min(x, y) + p, c * min(x, y) * 2 + p, c * max(x, y) * 2)))",
"+if x >= y:",
"+ print((min(c * 2 * y + a * (x - y), a * x + b * y, c * 2 * x)))",
"+else:",
"+ print((min(c * 2 * x + b * (y - x), a * x + b * y, c * 2 ... | false | 0.095175 | 0.035602 | 2.673322 | [
"s391498520",
"s453320145"
] |
u040442732 | p02802 | python | s829001476 | s883838894 | 724 | 307 | 14,808 | 4,596 | Accepted | Accepted | 57.6 | import numpy as np
N, M = list(map(int, input().split()))
AC_or_not = np.array([0] * N)
n_penalty = np.array([0] * N)
for _ in range(M):
prob, wa_ac = input().split()
prob = int(prob) - 1
if wa_ac == 'AC':
AC_or_not[prob] = 1
else:
if not AC_or_not[prob]:
n_pen... | N, M = list(map(int, input().split()))
AC_or_not = [False] * N
n_penalty = [0] * N
cnt_ac = 0
cnt_pen = 0
for _ in range(M):
prob, wa_ac = input().split()
prob = int(prob) - 1
if wa_ac == 'AC':
if not AC_or_not[prob]:
cnt_pen += n_penalty[prob]
cnt_ac += 1
... | 16 | 18 | 382 | 414 | import numpy as np
N, M = list(map(int, input().split()))
AC_or_not = np.array([0] * N)
n_penalty = np.array([0] * N)
for _ in range(M):
prob, wa_ac = input().split()
prob = int(prob) - 1
if wa_ac == "AC":
AC_or_not[prob] = 1
else:
if not AC_or_not[prob]:
n_penalty[prob] += ... | N, M = list(map(int, input().split()))
AC_or_not = [False] * N
n_penalty = [0] * N
cnt_ac = 0
cnt_pen = 0
for _ in range(M):
prob, wa_ac = input().split()
prob = int(prob) - 1
if wa_ac == "AC":
if not AC_or_not[prob]:
cnt_pen += n_penalty[prob]
cnt_ac += 1
AC_or_n... | false | 11.111111 | [
"-import numpy as np",
"-",
"-AC_or_not = np.array([0] * N)",
"-n_penalty = np.array([0] * N)",
"+AC_or_not = [False] * N",
"+n_penalty = [0] * N",
"+cnt_ac = 0",
"+cnt_pen = 0",
"- AC_or_not[prob] = 1",
"+ if not AC_or_not[prob]:",
"+ cnt_pen += n_penalty[prob]",
"+ ... | false | 0.27242 | 0.035607 | 7.6507 | [
"s829001476",
"s883838894"
] |
u945181840 | p03786 | python | s867422318 | s972746483 | 109 | 95 | 14,428 | 14,428 | Accepted | Accepted | 12.84 | from itertools import accumulate
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
a = list(accumulate(A))
answer = N
for i in range(N - 1):
if a[i] * 2 < A[i + 1]:
answer = N - (i + 1)
print(answer) | from itertools import accumulate
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
a = list(accumulate(A))
answer = N
for i in range(N - 1):
if a[i] * 2 < A[i + 1]:
answer = N - (i + 1)
print(answer)
if __name__ == '_... | 14 | 20 | 240 | 335 | from itertools import accumulate
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
a = list(accumulate(A))
answer = N
for i in range(N - 1):
if a[i] * 2 < A[i + 1]:
answer = N - (i + 1)
print(answer)
| from itertools import accumulate
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
a = list(accumulate(A))
answer = N
for i in range(N - 1):
if a[i] * 2 < A[i + 1]:
answer = N - (i + 1)
print(answer)
if __name__ == "__main__":
main()
| false | 30 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-a = list(accumulate(A))",
"-answer = N",
"-for i in range(N - 1):",
"- if a[i] * 2 < A[i + 1]:",
"- answer = N - (i + 1)",
"-print(answer)",
"+",
"+def main():",
"+ N = int(eval(input()))",
"+ A... | false | 0.034681 | 0.071081 | 0.487913 | [
"s867422318",
"s972746483"
] |
u644907318 | p03785 | python | s409979104 | s679534706 | 560 | 208 | 52,568 | 82,048 | Accepted | Accepted | 62.86 | from bisect import bisect_right
N,C,K = list(map(int,input().split()))
T = sorted([int(eval(input())) for _ in range(N)])
cnt = 0
cur = 0
while cur<N:
i = min(cur+C,N)-1
if T[i]-T[cur]<=K:
cnt += 1
cur = i+1
else:
i = bisect_right(T,T[cur]+K)-1
cnt += 1
c... | from bisect import bisect_right
N,C,K = list(map(int,input().split()))
T = sorted([int(eval(input())) for _ in range(N)])
cur = 0
cnt = 0
while cur<N:
ind = bisect_right(T,T[cur]+K)
if ind-cur<=C:
cnt += 1
cur = ind
else:
cnt += 1
cur += C
print(cnt) | 15 | 14 | 328 | 295 | from bisect import bisect_right
N, C, K = list(map(int, input().split()))
T = sorted([int(eval(input())) for _ in range(N)])
cnt = 0
cur = 0
while cur < N:
i = min(cur + C, N) - 1
if T[i] - T[cur] <= K:
cnt += 1
cur = i + 1
else:
i = bisect_right(T, T[cur] + K) - 1
cnt += 1
... | from bisect import bisect_right
N, C, K = list(map(int, input().split()))
T = sorted([int(eval(input())) for _ in range(N)])
cur = 0
cnt = 0
while cur < N:
ind = bisect_right(T, T[cur] + K)
if ind - cur <= C:
cnt += 1
cur = ind
else:
cnt += 1
cur += C
print(cnt)
| false | 6.666667 | [
"+cur = 0",
"-cur = 0",
"- i = min(cur + C, N) - 1",
"- if T[i] - T[cur] <= K:",
"+ ind = bisect_right(T, T[cur] + K)",
"+ if ind - cur <= C:",
"- cur = i + 1",
"+ cur = ind",
"- i = bisect_right(T, T[cur] + K) - 1",
"- cur = i + 1",
"+ cur += C"
] | false | 0.039332 | 0.171456 | 0.229403 | [
"s409979104",
"s679534706"
] |
u141574039 | p03478 | python | s561335530 | s466017217 | 45 | 30 | 3,060 | 3,060 | Accepted | Accepted | 33.33 | N,A,B=list(map(int,input().split()))
ttl,a,b=0,0,0
L=[]
for i in range(1,N+1):
L=list(map(str,str(i)))
for j in L:
a=a+int(j)
if B>=a>=A:
ttl=ttl+i
a=0
L=[]
print(ttl) | N,A,B=list(map(int,input().split()))
sum,a,b=0,0,0
for i in range(1,N+1):
b=i
if b<10:
a=b
else:
while b>=10:
a=a+b%10
b=b//10
if b<10:
a=a+b
if B>=a>=A:
sum=sum+i
a=0
print(sum) | 12 | 16 | 190 | 235 | N, A, B = list(map(int, input().split()))
ttl, a, b = 0, 0, 0
L = []
for i in range(1, N + 1):
L = list(map(str, str(i)))
for j in L:
a = a + int(j)
if B >= a >= A:
ttl = ttl + i
a = 0
L = []
print(ttl)
| N, A, B = list(map(int, input().split()))
sum, a, b = 0, 0, 0
for i in range(1, N + 1):
b = i
if b < 10:
a = b
else:
while b >= 10:
a = a + b % 10
b = b // 10
if b < 10:
a = a + b
if B >= a >= A:
sum = sum + i
a = 0
print(su... | false | 25 | [
"-ttl, a, b = 0, 0, 0",
"-L = []",
"+sum, a, b = 0, 0, 0",
"- L = list(map(str, str(i)))",
"- for j in L:",
"- a = a + int(j)",
"+ b = i",
"+ if b < 10:",
"+ a = b",
"+ else:",
"+ while b >= 10:",
"+ a = a + b % 10",
"+ b = b // 10",
... | false | 0.107425 | 0.042802 | 2.509801 | [
"s561335530",
"s466017217"
] |
u353919145 | p03161 | python | s991582981 | s553060724 | 1,996 | 395 | 14,820 | 54,880 | Accepted | Accepted | 80.21 | def woo(x, y):
res = [0]*x
z = list(map(int, input().split()))
for i in range(1, x):
res[i] = min(abs(z[i] - z[j]) + res[j] for j in range(max(0, i - y), i))
return res
if __name__ == '__main__':
x, y = list(map(int, input().split()))
r = woo(x, y)
f = len(r)-1
print(... | def main():
n, k = tuple([int(e) for e in input().split()])
arr = [int(e) for e in input().split()]
t = [float('inf')] * (n + 1)
t[0] = 0
t[1] = 0
for i in range(2, n + 1):
for j in range(1, k + 1):
if i - j <= 0:
break
l1 = t[i - j] + a... | 13 | 18 | 322 | 460 | def woo(x, y):
res = [0] * x
z = list(map(int, input().split()))
for i in range(1, x):
res[i] = min(abs(z[i] - z[j]) + res[j] for j in range(max(0, i - y), i))
return res
if __name__ == "__main__":
x, y = list(map(int, input().split()))
r = woo(x, y)
f = len(r) - 1
print((r[f])... | def main():
n, k = tuple([int(e) for e in input().split()])
arr = [int(e) for e in input().split()]
t = [float("inf")] * (n + 1)
t[0] = 0
t[1] = 0
for i in range(2, n + 1):
for j in range(1, k + 1):
if i - j <= 0:
break
l1 = t[i - j] + abs(arr[i - ... | false | 27.777778 | [
"-def woo(x, y):",
"- res = [0] * x",
"- z = list(map(int, input().split()))",
"- for i in range(1, x):",
"- res[i] = min(abs(z[i] - z[j]) + res[j] for j in range(max(0, i - y), i))",
"- return res",
"+def main():",
"+ n, k = tuple([int(e) for e in input().split()])",
"+ arr... | false | 0.035968 | 0.035503 | 1.0131 | [
"s991582981",
"s553060724"
] |
u000513658 | p03644 | python | s753023184 | s820761288 | 30 | 27 | 9,088 | 9,144 | Accepted | Accepted | 10 | import bisect
two_squares = [1]
temp = 1
while temp <= 100:
temp *= 2
two_squares.append(temp)
N = int(eval(input()))
result = bisect.bisect_right(two_squares, N)
print((two_squares[result - 1])) | N = int(eval(input()))
result = 0
temp = 1
while temp <= 100:
if temp <= N:
result = temp
temp *= 2
print(result) | 14 | 10 | 213 | 134 | import bisect
two_squares = [1]
temp = 1
while temp <= 100:
temp *= 2
two_squares.append(temp)
N = int(eval(input()))
result = bisect.bisect_right(two_squares, N)
print((two_squares[result - 1]))
| N = int(eval(input()))
result = 0
temp = 1
while temp <= 100:
if temp <= N:
result = temp
temp *= 2
print(result)
| false | 28.571429 | [
"-import bisect",
"-",
"-two_squares = [1]",
"+N = int(eval(input()))",
"+result = 0",
"+ if temp <= N:",
"+ result = temp",
"- two_squares.append(temp)",
"-N = int(eval(input()))",
"-result = bisect.bisect_right(two_squares, N)",
"-print((two_squares[result - 1]))",
"+print(resul... | false | 0.045297 | 0.04537 | 0.998372 | [
"s753023184",
"s820761288"
] |
u426764965 | p03503 | python | s821644082 | s817794059 | 1,972 | 1,382 | 20,640 | 17,868 | Accepted | Accepted | 29.92 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N): F[i] = readline().split()
# 他店と... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c_np():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N): F[i] = readline().split()
# ... | 29 | 30 | 872 | 924 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N):
F[i] = readline().split()
# 他店と何... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c_np():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N):
F[i] = readline().split()
# 他... | false | 3.333333 | [
"-def abc080_c():",
"+def abc080_c_np():",
"+ mask_np = np.array(mask, np.int8)",
"- overlap = np.multiply(F[i, :], mask).sum()",
"+ overlap = np.multiply(F[i, :], mask_np).sum()",
"-abc080_c()",
"+abc080_c_np()"
] | false | 0.394459 | 0.223716 | 1.763217 | [
"s821644082",
"s817794059"
] |
u297574184 | p02900 | python | s275081621 | s573205294 | 220 | 117 | 3,060 | 3,064 | Accepted | Accepted | 46.82 | A, B = list(map(int, input().split()))
def getPrimeFactors(x):
ans = []
for d in range(2, int(x**0.5)+1):
while x%d == 0:
ans.append(d)
x //= d
if x != 1:
ans.append(x)
return ans
pfAs = [1] + getPrimeFactors(A)
pfBs = [1] + getPrimeFactors(B)
an... | A, B = list(map(int, input().split()))
def getPrimeFactors(x):
anss = []
while x%2 == 0:
anss.append(2)
x //= 2
for d in range(3, int(x**0.5)+1, 2):
while x%d == 0:
anss.append(d)
x //= d
if x != 1:
anss.append(x)
return anss
P... | 17 | 24 | 357 | 456 | A, B = list(map(int, input().split()))
def getPrimeFactors(x):
ans = []
for d in range(2, int(x**0.5) + 1):
while x % d == 0:
ans.append(d)
x //= d
if x != 1:
ans.append(x)
return ans
pfAs = [1] + getPrimeFactors(A)
pfBs = [1] + getPrimeFactors(B)
ans = len(se... | A, B = list(map(int, input().split()))
def getPrimeFactors(x):
anss = []
while x % 2 == 0:
anss.append(2)
x //= 2
for d in range(3, int(x**0.5) + 1, 2):
while x % d == 0:
anss.append(d)
x //= d
if x != 1:
anss.append(x)
return anss
PFAs = g... | false | 29.166667 | [
"- ans = []",
"- for d in range(2, int(x**0.5) + 1):",
"+ anss = []",
"+ while x % 2 == 0:",
"+ anss.append(2)",
"+ x //= 2",
"+ for d in range(3, int(x**0.5) + 1, 2):",
"- ans.append(d)",
"+ anss.append(d)",
"- ans.append(x)",
"- retu... | false | 0.031941 | 0.040547 | 0.787772 | [
"s275081621",
"s573205294"
] |
u761320129 | p03379 | python | s762285980 | s730219420 | 288 | 256 | 25,224 | 25,556 | Accepted | Accepted | 11.11 | N = int(eval(input()))
X = list(map(int,input().split()))
SX = sorted(X)
m1,m2 = SX[N//2-1],SX[N//2]
for a in X:
print((m2 if a <= m1 else m1)) | N = int(input())
X = list(map(int,input().split()))
sx = list(sorted(X))
m1 = sx[N//2 - 1]
m2 = sx[N//2]
ans = []
for a in X:
if a >= m2:
ans.append(m1)
else:
ans.append(m2)
print(*ans, sep='\n')
| 7 | 14 | 146 | 234 | N = int(eval(input()))
X = list(map(int, input().split()))
SX = sorted(X)
m1, m2 = SX[N // 2 - 1], SX[N // 2]
for a in X:
print((m2 if a <= m1 else m1))
| N = int(input())
X = list(map(int, input().split()))
sx = list(sorted(X))
m1 = sx[N // 2 - 1]
m2 = sx[N // 2]
ans = []
for a in X:
if a >= m2:
ans.append(m1)
else:
ans.append(m2)
print(*ans, sep="\n")
| false | 50 | [
"-N = int(eval(input()))",
"+N = int(input())",
"-SX = sorted(X)",
"-m1, m2 = SX[N // 2 - 1], SX[N // 2]",
"+sx = list(sorted(X))",
"+m1 = sx[N // 2 - 1]",
"+m2 = sx[N // 2]",
"+ans = []",
"- print((m2 if a <= m1 else m1))",
"+ if a >= m2:",
"+ ans.append(m1)",
"+ else:",
"+ ... | false | 0.040223 | 0.044792 | 0.897985 | [
"s762285980",
"s730219420"
] |
u407160848 | p03318 | python | s648505027 | s584532833 | 397 | 347 | 3,828 | 3,828 | Accepted | Accepted | 12.59 | import math
# import datetime
def s(n):
sum = 0
for c in str(n):
sum += int(c)
return sum
k = int(eval(input()))
found=0
def next_sunuke(n, s_n, s_n_div):
global found
if n == 1:
return
log_n = int(math.log(n,10))
m = n - 10 ** int(log_n // 1.25)
# m = n - 1
while m >= 1:
s... | import math
# import datetime
def s(n):
sum = 0
for c in str(n):
sum += int(c)
return sum
k = int(eval(input()))
found=0
def next_sunuke(n, s_n, s_n_div):
global found
if n == 1:
return
log_n = int(math.log(n,10))
m = n - 10 ** int(log_n // 1.25)
while m >= 1:
s_m = s(m)
s... | 85 | 59 | 1,656 | 1,137 | import math
# import datetime
def s(n):
sum = 0
for c in str(n):
sum += int(c)
return sum
k = int(eval(input()))
found = 0
def next_sunuke(n, s_n, s_n_div):
global found
if n == 1:
return
log_n = int(math.log(n, 10))
m = n - 10 ** int(log_n // 1.25)
# m = n - 1
w... | import math
# import datetime
def s(n):
sum = 0
for c in str(n):
sum += int(c)
return sum
k = int(eval(input()))
found = 0
def next_sunuke(n, s_n, s_n_div):
global found
if n == 1:
return
log_n = int(math.log(n, 10))
m = n - 10 ** int(log_n // 1.25)
while m >= 1:
... | false | 30.588235 | [
"- # m = n - 1",
"- # if (s_m < s_mplus1 or (s_n - s_m != 1 and s_n - s_m != -8)) and m > 9:",
"- if (s_m < s_mplus1) and m > 9:",
"+ if (",
"+ s_m < s_mplus1 or (s_n - s_m != 1 and s_n - s_m != -8 and s_n - s_m != -17)",
"+ ) and m > 9:",
"- # else:",
... | false | 0.79885 | 0.369786 | 2.160306 | [
"s648505027",
"s584532833"
] |
u394731058 | p02713 | python | s999537770 | s122061839 | 1,479 | 898 | 9,180 | 9,184 | Accepted | Accepted | 39.28 | import math
n = int(eval(input()))
sum = 0
for i in range(1,n+1):
for j in range(1,n+1):
g = math.gcd(i,j)
for k in range(1,n+1):
sum += math.gcd(g,k)
print(sum) | import math
def main():
n = int(eval(input()))
sum = 0
for i in range(1,n+1):
for j in range(1,n+1):
g = math.gcd(i,j)
for k in range(1,n+1):
sum += math.gcd(g,k)
print(sum)
if __name__ == "__main__":
main() | 9 | 13 | 179 | 248 | import math
n = int(eval(input()))
sum = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
g = math.gcd(i, j)
for k in range(1, n + 1):
sum += math.gcd(g, k)
print(sum)
| import math
def main():
n = int(eval(input()))
sum = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
g = math.gcd(i, j)
for k in range(1, n + 1):
sum += math.gcd(g, k)
print(sum)
if __name__ == "__main__":
main()
| false | 30.769231 | [
"-n = int(eval(input()))",
"-sum = 0",
"-for i in range(1, n + 1):",
"- for j in range(1, n + 1):",
"- g = math.gcd(i, j)",
"- for k in range(1, n + 1):",
"- sum += math.gcd(g, k)",
"-print(sum)",
"+",
"+def main():",
"+ n = int(eval(input()))",
"+ sum = 0",
... | false | 0.183861 | 0.109688 | 1.67622 | [
"s999537770",
"s122061839"
] |
u869919400 | p03575 | python | s156070280 | s783347560 | 205 | 79 | 42,220 | 73,884 | Accepted | Accepted | 61.46 | N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
def bfs(n, t, v):
for p in t[n]:
if p not in visited:
visited.add(p)
bfs(p, t, v)
ans = 0
for i in range(M):
t = {i:[] for i in range(1, N+1)}
visited = set()
fo... | N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
'''
要素xが属するグループの根を返す
'''
if self.parents[x] < 0:
... | 24 | 83 | 525 | 2,000 | N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
def bfs(n, t, v):
for p in t[n]:
if p not in visited:
visited.add(p)
bfs(p, t, v)
ans = 0
for i in range(M):
t = {i: [] for i in range(1, N + 1)}
visited = set()
for j in r... | N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
"""
要素xが属するグループの根を返す
"""
if self.parents[x] < 0:
return x
... | false | 71.084337 | [
"-def bfs(n, t, v):",
"- for p in t[n]:",
"- if p not in visited:",
"- visited.add(p)",
"- bfs(p, t, v)",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.parents = [-1] * n",
"+",
"+ def find(self, x):",
"+ \"\... | false | 0.042419 | 0.047871 | 0.886112 | [
"s156070280",
"s783347560"
] |
u201928947 | p02803 | python | s219537885 | s316310711 | 273 | 246 | 3,316 | 42,604 | Accepted | Accepted | 9.89 | from collections import deque
def farthest(yi,xi):
q = deque([])
q.append((yi,xi))
dis = [[-1]*(w+2) for i in range(h+2)]
dis[yi][xi] = 0
while q:
y,x = q.popleft()
for i in range(4):
nexty = y + dy[i]
nextx = x + dx[i]
if maze[nexty][ne... | from collections import deque
def max_dis_from(xi,yi):
d = deque([(xi,yi)])
dis = [[-1]*(w+2) for i in range(h+2)]
dis[yi][xi] = 0
while d:
x,y = d.popleft()
for i in range(4):
newy = y+dy[i]
newx = x+dx[i]
if maze[newy][newx] == "." and dis[... | 27 | 28 | 814 | 806 | from collections import deque
def farthest(yi, xi):
q = deque([])
q.append((yi, xi))
dis = [[-1] * (w + 2) for i in range(h + 2)]
dis[yi][xi] = 0
while q:
y, x = q.popleft()
for i in range(4):
nexty = y + dy[i]
nextx = x + dx[i]
if maze[nexty][ne... | from collections import deque
def max_dis_from(xi, yi):
d = deque([(xi, yi)])
dis = [[-1] * (w + 2) for i in range(h + 2)]
dis[yi][xi] = 0
while d:
x, y = d.popleft()
for i in range(4):
newy = y + dy[i]
newx = x + dx[i]
if maze[newy][newx] == "." and... | false | 3.571429 | [
"-def farthest(yi, xi):",
"- q = deque([])",
"- q.append((yi, xi))",
"+def max_dis_from(xi, yi):",
"+ d = deque([(xi, yi)])",
"- while q:",
"- y, x = q.popleft()",
"+ while d:",
"+ x, y = d.popleft()",
"- nexty = y + dy[i]",
"- nextx = x + dx[i]... | false | 0.092532 | 0.050017 | 1.850023 | [
"s219537885",
"s316310711"
] |
u131811591 | p02361 | python | s203487413 | s697269977 | 3,550 | 2,710 | 139,716 | 139,904 | Accepted | Accepted | 23.66 | import sys
import heapq as hp
class Edge:
def __init__(self, end, cost):
self.to = end
self.cost = cost
class Dijkstra:
def __init__(self, V):
self._node = V
self._graph = [[] for i in range(self._node)]
self._inf = sys.maxsize
self.dist = [self._... | import sys
from heapq import heappush, heappop
class Dijkstra:
class Edge:
def __init__(self, end, cost):
self.to = end
self.cost = cost
def __init__(self, V):
self._node = V
self._graph = [[] for i in range(self._node)]
self.inf = 10 ** ... | 45 | 47 | 1,257 | 1,357 | import sys
import heapq as hp
class Edge:
def __init__(self, end, cost):
self.to = end
self.cost = cost
class Dijkstra:
def __init__(self, V):
self._node = V
self._graph = [[] for i in range(self._node)]
self._inf = sys.maxsize
self.dist = [self._inf for i in ... | import sys
from heapq import heappush, heappop
class Dijkstra:
class Edge:
def __init__(self, end, cost):
self.to = end
self.cost = cost
def __init__(self, V):
self._node = V
self._graph = [[] for i in range(self._node)]
self.inf = 10**10
self.d... | false | 4.255319 | [
"-import heapq as hp",
"-",
"-",
"-class Edge:",
"- def __init__(self, end, cost):",
"- self.to = end",
"- self.cost = cost",
"+from heapq import heappush, heappop",
"+ class Edge:",
"+ def __init__(self, end, cost):",
"+ self.to = end",
"+ self... | false | 0.038779 | 0.041229 | 0.940574 | [
"s203487413",
"s697269977"
] |
u691874710 | p02690 | python | s815643907 | s109040531 | 552 | 142 | 9,164 | 9,168 | Accepted | Accepted | 74.28 | x=int(eval(input()))
A=0
B=0
for a in range(-500,500):
for b in range(-500,500):
if a**5-b**5==x:
A=a
B=b
break
print((A,B))
| x=int(eval(input()))
A=0
B=0
for a in range(-120,120):
for b in range(-500,500):
if a**5-b**5==x:
A=a
B=b
break
print((A,B)) | 10 | 10 | 174 | 173 | x = int(eval(input()))
A = 0
B = 0
for a in range(-500, 500):
for b in range(-500, 500):
if a**5 - b**5 == x:
A = a
B = b
break
print((A, B))
| x = int(eval(input()))
A = 0
B = 0
for a in range(-120, 120):
for b in range(-500, 500):
if a**5 - b**5 == x:
A = a
B = b
break
print((A, B))
| false | 0 | [
"-for a in range(-500, 500):",
"+for a in range(-120, 120):"
] | false | 1.337572 | 0.256002 | 5.224852 | [
"s815643907",
"s109040531"
] |
u701644092 | p02684 | python | s155514682 | s586549177 | 1,493 | 162 | 32,196 | 40,132 | Accepted | Accepted | 89.15 | N,K = list(map(int,input().split()))
A = [0] + list(map(int,input().split()))
now = 1
while K:
if K & 1:
now = A[now]
A = [A[A[i]] for i in range(len(A))]
K >>= 1
print(now) | N,K = list(map(int,input().split()))
A = [0] + list(map(int,input().split()))
now = 1
route = []
dic = {}
cnt = 0
entry = []
loop = []
while True:
cnt += 1
now = A[now]
route.append(now)
if now in dic:
entry = route[:dic[now]]
loop = route[dic[now]:]
break
dic[now] = cnt
if ... | 12 | 27 | 193 | 425 | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
now = 1
while K:
if K & 1:
now = A[now]
A = [A[A[i]] for i in range(len(A))]
K >>= 1
print(now)
| N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
now = 1
route = []
dic = {}
cnt = 0
entry = []
loop = []
while True:
cnt += 1
now = A[now]
route.append(now)
if now in dic:
entry = route[: dic[now]]
loop = route[dic[now] :]
break
dic[now] = cnt... | false | 55.555556 | [
"-while K:",
"- if K & 1:",
"- now = A[now]",
"- A = [A[A[i]] for i in range(len(A))]",
"- K >>= 1",
"-print(now)",
"+route = []",
"+dic = {}",
"+cnt = 0",
"+entry = []",
"+loop = []",
"+while True:",
"+ cnt += 1",
"+ now = A[now]",
"+ route.append(now)",
"+ ... | false | 0.041686 | 0.044319 | 0.940592 | [
"s155514682",
"s586549177"
] |
u426534722 | p02295 | python | s657162867 | s486317632 | 40 | 30 | 7,924 | 7,908 | Accepted | Accepted | 25 | import sys
from itertools import starmap
readline = sys.stdin.readline
EPS = 1e-9
ONLINE_FRONT = -2
CLOCKWISE = -1
ON_SEGMENT = 0
COUNTER_CLOCKWISE = 1
ONLINE_BACK = 2
class Segment(object):
__slots__ = ('fi', 'se')
def __init__(self, fi, se):
self.fi = fi
self.se = se
def cross(a,... | import sys
from itertools import starmap
readline = sys.stdin.readline
EPS = 1e-9
ONLINE_FRONT = -2
CLOCKWISE = -1
ON_SEGMENT = 0
COUNTER_CLOCKWISE = 1
ONLINE_BACK = 2
class Segment(object):
__slots__ = ('fi', 'se')
def __init__(self, fi, se):
self.fi = fi
self.se = se
def cross(a,... | 61 | 61 | 2,016 | 2,019 | import sys
from itertools import starmap
readline = sys.stdin.readline
EPS = 1e-9
ONLINE_FRONT = -2
CLOCKWISE = -1
ON_SEGMENT = 0
COUNTER_CLOCKWISE = 1
ONLINE_BACK = 2
class Segment(object):
__slots__ = ("fi", "se")
def __init__(self, fi, se):
self.fi = fi
self.se = se
def cross(a, b):
... | import sys
from itertools import starmap
readline = sys.stdin.readline
EPS = 1e-9
ONLINE_FRONT = -2
CLOCKWISE = -1
ON_SEGMENT = 0
COUNTER_CLOCKWISE = 1
ONLINE_BACK = 2
class Segment(object):
__slots__ = ("fi", "se")
def __init__(self, fi, se):
self.fi = fi
self.se = se
def cross(a, b):
... | false | 0 | [
"- p0, p1, p2, p3 = starmap(complex, list(zip(*[list(map(int, input().split()))] * 2)))",
"+ p0, p1, p2, p3 = starmap(",
"+ complex, list(zip(*[list(map(int, readline().split()))] * 2))",
"+ )"
] | false | 0.04936 | 0.098267 | 0.502307 | [
"s657162867",
"s486317632"
] |
u811841526 | p02379 | python | s671714493 | s563338646 | 30 | 20 | 7,540 | 5,648 | Accepted | Accepted | 33.33 | from math import sqrt
x1, y1, x2, y2 = list(map(float, input().split()))
r = sqrt((x2 - x1)**2 + (y2 - y1)**2)
print(r) | import math
x1, y1, x2, y2 = list(map(float, input().split()))
print((math.sqrt((x2 - x1)**2 + (y2 -y1)**2)))
| 4 | 4 | 116 | 106 | from math import sqrt
x1, y1, x2, y2 = list(map(float, input().split()))
r = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
print(r)
| import math
x1, y1, x2, y2 = list(map(float, input().split()))
print((math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)))
| false | 0 | [
"-from math import sqrt",
"+import math",
"-r = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)",
"-print(r)",
"+print((math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)))"
] | false | 0.042035 | 0.042066 | 0.99928 | [
"s671714493",
"s563338646"
] |
u077291787 | p02708 | python | s404061859 | s301562006 | 84 | 71 | 33,128 | 33,132 | Accepted | Accepted | 15.48 | # D - Sum of Large Numbers
from itertools import accumulate
def main():
N, K = list(map(int, input().split()))
cumsum_left = tuple(accumulate(list(range(N + 1))))
cumsum_right = tuple(accumulate(reversed(list(range(N + 1)))))
total = 0
MOD = 10 ** 9 + 7
for l, r in zip(cumsum_left[K ... | # D - Sum of Large Numbers
from itertools import accumulate
def main():
N, K = list(map(int, input().split()))
MOD = 10 ** 9 + 7
cumsum_left = tuple(accumulate(list(range(N + 1))))
cumsum_right = tuple(accumulate(reversed(list(range(N + 1)))))
total = sum(r - l + 1 for l, r in zip(cumsum_... | 18 | 16 | 446 | 421 | # D - Sum of Large Numbers
from itertools import accumulate
def main():
N, K = list(map(int, input().split()))
cumsum_left = tuple(accumulate(list(range(N + 1))))
cumsum_right = tuple(accumulate(reversed(list(range(N + 1)))))
total = 0
MOD = 10**9 + 7
for l, r in zip(cumsum_left[K - 1 :], cums... | # D - Sum of Large Numbers
from itertools import accumulate
def main():
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
cumsum_left = tuple(accumulate(list(range(N + 1))))
cumsum_right = tuple(accumulate(reversed(list(range(N + 1)))))
total = sum(r - l + 1 for l, r in zip(cumsum_left[K - 1 ... | false | 11.111111 | [
"+ MOD = 10**9 + 7",
"- total = 0",
"- MOD = 10**9 + 7",
"- for l, r in zip(cumsum_left[K - 1 :], cumsum_right[K - 1 :]):",
"- total += r - l + 1",
"- total %= MOD",
"+ total = sum(r - l + 1 for l, r in zip(cumsum_left[K - 1 :], cumsum_right[K - 1 :]))",
"+ total %= MOD... | false | 0.061869 | 0.059358 | 1.042294 | [
"s404061859",
"s301562006"
] |
u987164499 | p03786 | python | s826208909 | s634309721 | 115 | 93 | 14,428 | 20,504 | Accepted | Accepted | 19.13 | from sys import stdin
from itertools import accumulate
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
lin = list(accumulate(li))
point = 1
for i in range(n-1):
if lin[i]*2 >= li[i+1]:
point += 1
else:
point = 1
print(point) | from itertools import accumulate
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
b = list(accumulate(a))
point = 0
for i in range(n-1):
if b[i]*2 >= a[i+1]:
point += 1
else:
point = 0
print((point+1)) | 13 | 18 | 311 | 258 | from sys import stdin
from itertools import accumulate
n = int(stdin.readline().rstrip())
li = list(map(int, stdin.readline().rstrip().split()))
li.sort()
lin = list(accumulate(li))
point = 1
for i in range(n - 1):
if lin[i] * 2 >= li[i + 1]:
point += 1
else:
point = 1
print(point)
| from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
b = list(accumulate(a))
point = 0
for i in range(n - 1):
if b[i] * 2 >= a[i + 1]:
point += 1
else:
point = 0
print((point + 1))
| false | 27.777778 | [
"-from sys import stdin",
"-n = int(stdin.readline().rstrip())",
"-li = list(map(int, stdin.readline().rstrip().split()))",
"-li.sort()",
"-lin = list(accumulate(li))",
"-point = 1",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+a.sort()",
"+b = list(accumulate(a))",
"+poi... | false | 0.039218 | 0.038097 | 1.029424 | [
"s826208909",
"s634309721"
] |
u545368057 | p02879 | python | s489193478 | s547846124 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | a,b = list(map(int, input().split()))
if 1 <= a <= 9 and 1 <= b<=9:
print((a*b))
else:
print((-1)) | A,B = list(map(int, input().split()))
if A >= 10 or B >= 10:
print((-1))
else:
print((A*B)) | 5 | 5 | 100 | 93 | a, b = list(map(int, input().split()))
if 1 <= a <= 9 and 1 <= b <= 9:
print((a * b))
else:
print((-1))
| A, B = list(map(int, input().split()))
if A >= 10 or B >= 10:
print((-1))
else:
print((A * B))
| false | 0 | [
"-a, b = list(map(int, input().split()))",
"-if 1 <= a <= 9 and 1 <= b <= 9:",
"- print((a * b))",
"+A, B = list(map(int, input().split()))",
"+if A >= 10 or B >= 10:",
"+ print((-1))",
"- print((-1))",
"+ print((A * B))"
] | false | 0.040884 | 0.039103 | 1.045546 | [
"s489193478",
"s547846124"
] |
u423966555 | p02725 | python | s486461552 | s227175604 | 396 | 101 | 26,444 | 25,836 | Accepted | Accepted | 74.49 | K, N = list(map(int,input().split()))
#K: 湖1周の長さ, N:湖の周りにある家の数
A = list(map(int, input().split()))
ans = 10**10
for i in range(N):
for j in range(2):
if j == 0: #時計周り
if i == 0:
dif = A[0]+(K-A[-1])
else:
dif = A[i] - A[i-1]
... | K, N = list(map(int,input().split()))
#K: 湖1周の長さ, N:湖の周りにある家の数
A = list(map(int, input().split()))
A.sort()
dist = [A[0]+K-A[-1]] + [A[i]-A[i-1] for i in range(1, N)]
print((K-max(dist)))
| 22 | 7 | 526 | 187 | K, N = list(map(int, input().split()))
# K: 湖1周の長さ, N:湖の周りにある家の数
A = list(map(int, input().split()))
ans = 10**10
for i in range(N):
for j in range(2):
if j == 0: # 時計周り
if i == 0:
dif = A[0] + (K - A[-1])
else:
dif = A[i] - A[i - 1]
ans =... | K, N = list(map(int, input().split()))
# K: 湖1周の長さ, N:湖の周りにある家の数
A = list(map(int, input().split()))
A.sort()
dist = [A[0] + K - A[-1]] + [A[i] - A[i - 1] for i in range(1, N)]
print((K - max(dist)))
| false | 68.181818 | [
"-ans = 10**10",
"-for i in range(N):",
"- for j in range(2):",
"- if j == 0: # 時計周り",
"- if i == 0:",
"- dif = A[0] + (K - A[-1])",
"- else:",
"- dif = A[i] - A[i - 1]",
"- ans = min(ans, K - dif)",
"- else: # 半時計周り... | false | 0.036022 | 0.037323 | 0.965132 | [
"s486461552",
"s227175604"
] |
u387774811 | p02762 | python | s370968772 | s050135398 | 1,112 | 735 | 17,820 | 17,820 | Accepted | Accepted | 33.9 | 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 = self.find(x)
y = self.find(y)
if x == y:
... | 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 = self.find(x)
y = self.find(y)
if x == y:
... | 47 | 48 | 938 | 977 | 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:
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... | false | 2.083333 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038159 | 0.047407 | 0.804922 | [
"s370968772",
"s050135398"
] |
u167647458 | p03944 | python | s145595517 | s147787700 | 407 | 294 | 14,420 | 3,064 | Accepted | Accepted | 27.76 | import numpy as np
w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
field = [[1 for _ in range(w)] for _ in range(h)]
for x, y, a in xya:
for i in range(h):
for j in range(w):
if a == 1 and j < x:
... | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
field = [[1 for _ in range(w)] for _ in range(h)]
for x, y, a in xya:
for i in range(h):
for j in range(w):
if a == 1 and j < x:
field[i][j] = 0... | 19 | 21 | 621 | 624 | import numpy as np
w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
field = [[1 for _ in range(w)] for _ in range(h)]
for x, y, a in xya:
for i in range(h):
for j in range(w):
if a == 1 and j < x:
field[i][j] = 0
if ... | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
field = [[1 for _ in range(w)] for _ in range(h)]
for x, y, a in xya:
for i in range(h):
for j in range(w):
if a == 1 and j < x:
field[i][j] = 0
if a == 2 and j >= x:
... | false | 9.52381 | [
"-import numpy as np",
"-",
"-print((sum(sum(np.array(field)))))",
"+ans = 0",
"+for i in field:",
"+ ans += sum(i)",
"+print(ans)"
] | false | 1.034432 | 0.134035 | 7.717597 | [
"s145595517",
"s147787700"
] |
u646989285 | p03370 | python | s537621321 | s787348094 | 379 | 17 | 3,060 | 3,060 | Accepted | Accepted | 95.51 | N, X = [int(i) for i in input().split()]
donut_type = [int(eval(input())) for i in range(N)]
X = X - sum(donut_type)
result = N
while X >= sorted(donut_type)[0]:
X = X - sorted(donut_type)[0]
result += 1
print(result) | import math
N, X = [int(i) for i in input().split()]
donut_type = [int(eval(input())) for i in range(N)]
X = X - sum(donut_type)
result = N
result += math.floor(X / min(donut_type))
print(result) | 9 | 8 | 228 | 197 | N, X = [int(i) for i in input().split()]
donut_type = [int(eval(input())) for i in range(N)]
X = X - sum(donut_type)
result = N
while X >= sorted(donut_type)[0]:
X = X - sorted(donut_type)[0]
result += 1
print(result)
| import math
N, X = [int(i) for i in input().split()]
donut_type = [int(eval(input())) for i in range(N)]
X = X - sum(donut_type)
result = N
result += math.floor(X / min(donut_type))
print(result)
| false | 11.111111 | [
"+import math",
"+",
"-while X >= sorted(donut_type)[0]:",
"- X = X - sorted(donut_type)[0]",
"- result += 1",
"+result += math.floor(X / min(donut_type))"
] | false | 0.07356 | 0.036651 | 2.007044 | [
"s537621321",
"s787348094"
] |
u054514819 | p02848 | python | s021471060 | s350640651 | 70 | 64 | 65,844 | 66,208 | Accepted | Accepted | 8.57 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
S = list(str(eval(input())))
ans = []
for s in S:
i = ord(s)
if i+N>90:
i -= 26
ans.append(chr(i+N))
print((''.join(ans... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
S = list(eval(input()))
lis = []
for s in S:
idx = ord(s)
if idx+N>90:
idx -= 26
lis.append(chr(idx+N))
print((''.join(... | 15 | 15 | 303 | 306 | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
S = list(str(eval(input())))
ans = []
for s in S:
i = ord(s)
if i + N > 90:
i -= 26
ans.append(chr(i + N))
print(("".join... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
S = list(eval(input()))
lis = []
for s in S:
idx = ord(s)
if idx + N > 90:
idx -= 26
lis.append(chr(idx + N))
print(("".j... | false | 0 | [
"-S = list(str(eval(input())))",
"-ans = []",
"+S = list(eval(input()))",
"+lis = []",
"- i = ord(s)",
"- if i + N > 90:",
"- i -= 26",
"- ans.append(chr(i + N))",
"-print((\"\".join(ans)))",
"+ idx = ord(s)",
"+ if idx + N > 90:",
"+ idx -= 26",
"+ lis.append... | false | 0.053286 | 0.03575 | 1.490518 | [
"s021471060",
"s350640651"
] |
u886747123 | p03166 | python | s351815452 | s715498348 | 846 | 781 | 153,308 | 175,148 | Accepted | Accepted | 7.68 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000000)
int1 = lambda x: int(x) - 1
N, M = list(map(int, input().split()))
to_point = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int1, input().split()))
to_point[x].append(y)
dp_memo = [-1]*N
for x in range... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000000)
int1 = lambda x: int(x) - 1
N, M = list(map(int, input().split()))
not_start_point = set()
to_point = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int1, input().split()))
not_start_point.add(y)
to_p... | 33 | 38 | 619 | 740 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000000)
int1 = lambda x: int(x) - 1
N, M = list(map(int, input().split()))
to_point = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int1, input().split()))
to_point[x].append(y)
dp_memo = [-1] * N
for x in range(N):
if len(t... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000000)
int1 = lambda x: int(x) - 1
N, M = list(map(int, input().split()))
not_start_point = set()
to_point = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int1, input().split()))
not_start_point.add(y)
to_point[x].append(y)... | false | 13.157895 | [
"+not_start_point = set()",
"+ not_start_point.add(y)",
"+start_point = set(range(N)) - not_start_point",
"-for i in range(N):",
"- dp(i)",
"-print((max(dp_memo)))",
"+ans = 0",
"+for s in start_point:",
"+ ans = max(ans, dp(s))",
"+print(ans)"
] | false | 0.048749 | 0.048855 | 0.997817 | [
"s351815452",
"s715498348"
] |
u241159583 | p03127 | python | s708848614 | s680675469 | 161 | 107 | 14,252 | 19,952 | Accepted | Accepted | 33.54 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
while len(A) > 1:
a = [A[0]]
for i in range(1, len(A)):
if A[i]%A[0] == 0: continue
else: a.append(A[i]%A[0])
A = sorted(a)
print((A[0])) | n = int(eval(input()))
A = sorted(list(map(int, input().split())))
while len(A) > 1:
A = sorted([i%A[0] for i in A if i%A[0]!=0] + [A[0]])
print((A[0])) | 10 | 6 | 220 | 154 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
while len(A) > 1:
a = [A[0]]
for i in range(1, len(A)):
if A[i] % A[0] == 0:
continue
else:
a.append(A[i] % A[0])
A = sorted(a)
print((A[0]))
| n = int(eval(input()))
A = sorted(list(map(int, input().split())))
while len(A) > 1:
A = sorted([i % A[0] for i in A if i % A[0] != 0] + [A[0]])
print((A[0]))
| false | 40 | [
"-A = list(map(int, input().split()))",
"-A.sort()",
"+A = sorted(list(map(int, input().split())))",
"- a = [A[0]]",
"- for i in range(1, len(A)):",
"- if A[i] % A[0] == 0:",
"- continue",
"- else:",
"- a.append(A[i] % A[0])",
"- A = sorted(a)",
"+ ... | false | 0.121845 | 0.047188 | 2.582115 | [
"s708848614",
"s680675469"
] |
u729133443 | p02660 | python | s254179871 | s128531336 | 109 | 35 | 69,432 | 10,404 | Accepted | Accepted | 67.89 | from subprocess import*
p=run(('factor',eval(input())),stdout=PIPE).stdout.split()[1:]
print((sum(int((8*p.count(i)+1)**.5/2-.5)for i in set(p)))) | from subprocess import*
p=run(('factor',eval(input())),stdout=PIPE).stdout.split()
print((sum(int((8*p.count(i)+1)**.5/2-.5)for i in set(p))-1)) | 3 | 3 | 140 | 138 | from subprocess import *
p = run(("factor", eval(input())), stdout=PIPE).stdout.split()[1:]
print((sum(int((8 * p.count(i) + 1) ** 0.5 / 2 - 0.5) for i in set(p))))
| from subprocess import *
p = run(("factor", eval(input())), stdout=PIPE).stdout.split()
print((sum(int((8 * p.count(i) + 1) ** 0.5 / 2 - 0.5) for i in set(p)) - 1))
| false | 0 | [
"-p = run((\"factor\", eval(input())), stdout=PIPE).stdout.split()[1:]",
"-print((sum(int((8 * p.count(i) + 1) ** 0.5 / 2 - 0.5) for i in set(p))))",
"+p = run((\"factor\", eval(input())), stdout=PIPE).stdout.split()",
"+print((sum(int((8 * p.count(i) + 1) ** 0.5 / 2 - 0.5) for i in set(p)) - 1))"
] | false | 0.042341 | 0.05148 | 0.822475 | [
"s254179871",
"s128531336"
] |
u226108478 | p03487 | python | s398828153 | s388658769 | 101 | 67 | 18,168 | 18,676 | Accepted | Accepted | 33.66 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
from collections import Counter
counted_a = Counter(a)
for x in counted_a:
if counted_a[x] >= x:
c... | # -*- coding: utf-8 -*-
def main():
from collections import Counter
n = int(eval(input()))
a = Counter(list(map(int, input().split())))
ans = 0
for key, value in list(a.items()):
if key < value:
ans += value - key
elif key > value:
ans += val... | 20 | 21 | 409 | 373 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
from collections import Counter
counted_a = Counter(a)
for x in counted_a:
if counted_a[x] >= x:
count += counted_a[... | # -*- coding: utf-8 -*-
def main():
from collections import Counter
n = int(eval(input()))
a = Counter(list(map(int, input().split())))
ans = 0
for key, value in list(a.items()):
if key < value:
ans += value - key
elif key > value:
ans += value
print(ans)... | false | 4.761905 | [
"-# AtCoder Beginner Contest",
"-# Problem C",
"-if __name__ == \"__main__\":",
"- n = int(eval(input()))",
"- a = list(map(int, input().split()))",
"- count = 0",
"+def main():",
"- counted_a = Counter(a)",
"- for x in counted_a:",
"- if counted_a[x] >= x:",
"- ... | false | 0.045477 | 0.042438 | 1.071597 | [
"s398828153",
"s388658769"
] |
u456353530 | p03029 | python | s657144365 | s791625576 | 172 | 67 | 38,384 | 61,728 | Accepted | Accepted | 61.05 | A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2)) | A, P = list(map(int, input().split()))
P += A * 3
print((P // 2)) | 3 | 4 | 65 | 67 | A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2))
| A, P = list(map(int, input().split()))
P += A * 3
print((P // 2))
| false | 25 | [
"-print(((A * 3 + P) // 2))",
"+P += A * 3",
"+print((P // 2))"
] | false | 0.037231 | 0.097369 | 0.382369 | [
"s657144365",
"s791625576"
] |
u753803401 | p02868 | python | s216803543 | s874517335 | 1,136 | 984 | 97,244 | 88,028 | Accepted | Accepted | 13.38 | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [self.default_value] * (2 * self.size)
def build(self):
# raw_data は 0-indexed
... | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [self.default_value] * (2 * self.size)
def update(self, i, x):
i += self.size
s... | 69 | 60 | 1,947 | 1,612 | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [self.default_value] * (2 * self.size)
def build(self):
# raw_data は 0-indexed
for i, x in ... | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [self.default_value] * (2 * self.size)
def update(self, i, x):
i += self.size
self.data[i] ... | false | 13.043478 | [
"-",
"- def build(self):",
"- # raw_data は 0-indexed",
"- for i, x in enumerate([self.default_value] * (self.Nelem + 1)):",
"- self.data[self.size + i] = x",
"- for i in range(self.size - 1, 0, -1):",
"- x = self.data[i + i]",
"- y = self.data[i... | false | 0.064944 | 0.040577 | 1.600518 | [
"s216803543",
"s874517335"
] |
u453055089 | p03162 | python | s840903544 | s990123359 | 639 | 261 | 60,888 | 100,780 | Accepted | Accepted | 59.15 | n = int(eval(input()))
a =[0]*n
b = [0]*n
c = [0]*n
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
# dp[日にち][0:a 1:b 2:c]
dp = [[0]*3 for _i in range(n)]
dp[0] = [a[0], b[0], c[0]]
#print(dp)
for i in range(n-1):
dp[i+1][0] = max(dp[i][1], dp[i][2]) + a[i+1]
dp[i+1][1] =... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0]*3 for _ in range(n+1)]
#dp[i][a] := i日目にaするときの、i日目までの幸福度の最大値
for i in range(1, n+1):
dp[i][0] = max(dp[i-1][1] + abc[i-1][0],
dp[i-1][2] + abc[i-1][0])
dp[i][1] = max(dp[i-1][0] + abc[i-1][1],
... | 16 | 13 | 414 | 471 | n = int(eval(input()))
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
# dp[日にち][0:a 1:b 2:c]
dp = [[0] * 3 for _i in range(n)]
dp[0] = [a[0], b[0], c[0]]
# print(dp)
for i in range(n - 1):
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a[i + 1]
dp[i + 1][... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n + 1)]
# dp[i][a] := i日目にaするときの、i日目までの幸福度の最大値
for i in range(1, n + 1):
dp[i][0] = max(dp[i - 1][1] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][0])
dp[i][1] = max(dp[i - 1][0] + abc[i - 1][1], dp[i - 1]... | false | 18.75 | [
"-a = [0] * n",
"-b = [0] * n",
"-c = [0] * n",
"-for i in range(n):",
"- a[i], b[i], c[i] = list(map(int, input().split()))",
"-# dp[日にち][0:a 1:b 2:c]",
"-dp = [[0] * 3 for _i in range(n)]",
"-dp[0] = [a[0], b[0], c[0]]",
"-# print(dp)",
"-for i in range(n - 1):",
"- dp[i + 1][0] = max(dp... | false | 0.07804 | 0.039308 | 1.985351 | [
"s840903544",
"s990123359"
] |
u597047658 | p03352 | python | s610064972 | s961966827 | 604 | 18 | 2,940 | 2,940 | Accepted | Accepted | 97.02 | import sys
X = int(eval(input()))
res = 0
for b in range(1, -(-X//2)+1):
for p in range(2, -(-X//2)+2):
val = b**p
if (val <= X) and (val > res):
res = val
print(res)
| import math
X = int(eval(input()))
res = 0
for b in range(1, int(math.sqrt(X))+1):
for p in range(2, int(math.sqrt(X))+2):
val = b**p
if (val <= X) and (val > res):
res = val
print(res)
| 9 | 9 | 201 | 220 | import sys
X = int(eval(input()))
res = 0
for b in range(1, -(-X // 2) + 1):
for p in range(2, -(-X // 2) + 2):
val = b**p
if (val <= X) and (val > res):
res = val
print(res)
| import math
X = int(eval(input()))
res = 0
for b in range(1, int(math.sqrt(X)) + 1):
for p in range(2, int(math.sqrt(X)) + 2):
val = b**p
if (val <= X) and (val > res):
res = val
print(res)
| false | 0 | [
"-import sys",
"+import math",
"-for b in range(1, -(-X // 2) + 1):",
"- for p in range(2, -(-X // 2) + 2):",
"+for b in range(1, int(math.sqrt(X)) + 1):",
"+ for p in range(2, int(math.sqrt(X)) + 2):"
] | false | 0.220315 | 0.036344 | 6.061872 | [
"s610064972",
"s961966827"
] |
u134019875 | p02796 | python | s523918488 | s413123784 | 480 | 299 | 22,104 | 24,820 | Accepted | Accepted | 37.71 | n = int(eval(input()))
L = []
for _ in range(n):
x, l = list(map(int, input().split()))
L.append([x - l, x + l])
L = sorted(L, key=lambda x: x[1])
ans = 0
r = -float('inf')
for i in range(n):
if L[i][0] >= r:
ans += 1
r = L[i][1]
print(ans)
| n = int(eval(input()))
L = []
for _ in range(n):
x, l = list(map(int, input().split()))
left = x - l
right = x + l
L.append((left, right))
L = sorted(L, key=lambda x: x[1])
ans = 0
prev = -float('inf')
for r in L:
if r[0] >= prev:
ans += 1
prev = r[1]
print(ans)
| 13 | 15 | 269 | 301 | n = int(eval(input()))
L = []
for _ in range(n):
x, l = list(map(int, input().split()))
L.append([x - l, x + l])
L = sorted(L, key=lambda x: x[1])
ans = 0
r = -float("inf")
for i in range(n):
if L[i][0] >= r:
ans += 1
r = L[i][1]
print(ans)
| n = int(eval(input()))
L = []
for _ in range(n):
x, l = list(map(int, input().split()))
left = x - l
right = x + l
L.append((left, right))
L = sorted(L, key=lambda x: x[1])
ans = 0
prev = -float("inf")
for r in L:
if r[0] >= prev:
ans += 1
prev = r[1]
print(ans)
| false | 13.333333 | [
"- L.append([x - l, x + l])",
"+ left = x - l",
"+ right = x + l",
"+ L.append((left, right))",
"-r = -float(\"inf\")",
"-for i in range(n):",
"- if L[i][0] >= r:",
"+prev = -float(\"inf\")",
"+for r in L:",
"+ if r[0] >= prev:",
"- r = L[i][1]",
"+ prev = r[1]"... | false | 0.040977 | 0.041854 | 0.979056 | [
"s523918488",
"s413123784"
] |
u254871849 | p02918 | python | s878354036 | s401744223 | 155 | 31 | 14,656 | 3,316 | Accepted | Accepted | 80 | # 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import a... | # 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import a... | 36 | 29 | 1,030 | 736 | # 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# fro... | # 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# fro... | false | 19.444444 | [
"-import numpy as np",
"-",
"-",
"+# import numpy as np",
"- s = np.array(list(sys.stdin.readline().rstrip()), dtype=\"U1\")",
"- # dtype=U1 : Unicode, 1-char string.",
"- happy_count = np.count_nonzero(s[:-1] == s[1:])",
"- # s[:-1] と s[1:] の各要素を比較してTrue/False のndarray(n-dimensional array... | false | 0.283117 | 0.048529 | 5.83402 | [
"s878354036",
"s401744223"
] |
u890722286 | p02288 | python | s966096480 | s047868676 | 1,180 | 1,030 | 65,568 | 62,320 | Accepted | Accepted | 12.71 | import math
def parent(i):
return math.floor(i / 2)
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def get_largest(A, n, i):
l = left(i)
r = right(i)
largest = None
if l <= n and A[i] < A[l]:
largest = l
else:
largest = i
if r <= n and... | import math
def parent(i):
return math.floor(i / 2)
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def get_largest(A, n, i):
l = left(i)
r = right(i)
largest = None
if l <= n and A[i] < A[l]:
largest = l
else:
largest = i
if r <= n and... | 47 | 45 | 898 | 861 | import math
def parent(i):
return math.floor(i / 2)
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def get_largest(A, n, i):
l = left(i)
r = right(i)
largest = None
if l <= n and A[i] < A[l]:
largest = l
else:
largest = i
if r <= n and A[largest] < A... | import math
def parent(i):
return math.floor(i / 2)
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def get_largest(A, n, i):
l = left(i)
r = right(i)
largest = None
if l <= n and A[i] < A[l]:
largest = l
else:
largest = i
if r <= n and A[largest] < A... | false | 4.255319 | [
"-n = int(eval(input()))",
"+n = int(input())",
"-ans = \"\"",
"-for i in heap[1:]:",
"- ans += \" {}\".format(str(i))",
"-print(ans)",
"+print(\" \", end=\"\")",
"+print(*heap[1:])"
] | false | 0.036209 | 0.04401 | 0.822726 | [
"s966096480",
"s047868676"
] |
u633068244 | p02271 | python | s879608129 | s024765812 | 10,380 | 20 | 4,232 | 4,228 | Accepted | Accepted | 99.81 | def solve(Mi,i):
if Mi == 0: return True
if i < n and min(A[i:]) <= Mi <= sum(A[i:]):
r1 = solve(Mi-A[i],i+1)
r2 = solve(Mi,i+1)
if r1: return r1
if r2: return r2
n = eval(input())
A = list(map(int,input().split()))
q = eval(input())
M = list(map(int,input().split()))
for Mi in M:
print("yes" if ... | def solve(Mi,i):
if Mi == 0: return True
if i < n and min(A[i:]) <= Mi <= sum(A[i:]):
r1 = solve(Mi-A[i],i+1)
if r1: return r1
r2 = solve(Mi,i+1)
if r2: return r2
n = eval(input())
A = list(map(int,input().split()))
q = eval(input())
M = list(map(int,input().split()))
for Mi in M:
print("yes" if ... | 13 | 13 | 325 | 325 | def solve(Mi, i):
if Mi == 0:
return True
if i < n and min(A[i:]) <= Mi <= sum(A[i:]):
r1 = solve(Mi - A[i], i + 1)
r2 = solve(Mi, i + 1)
if r1:
return r1
if r2:
return r2
n = eval(input())
A = list(map(int, input().split()))
q = eval(input())
M ... | def solve(Mi, i):
if Mi == 0:
return True
if i < n and min(A[i:]) <= Mi <= sum(A[i:]):
r1 = solve(Mi - A[i], i + 1)
if r1:
return r1
r2 = solve(Mi, i + 1)
if r2:
return r2
n = eval(input())
A = list(map(int, input().split()))
q = eval(input())
M ... | false | 0 | [
"- r2 = solve(Mi, i + 1)",
"+ r2 = solve(Mi, i + 1)"
] | false | 0.049581 | 0.052516 | 0.944115 | [
"s879608129",
"s024765812"
] |
u882460931 | p03287 | python | s374051465 | s362784703 | 223 | 94 | 62,576 | 14,920 | Accepted | Accepted | 57.85 | n, m = list(map(int, input().split()))
*a, = list(map(int, input().split()))
b = 0
c = {0: 1}
cnt = 0
for a in a:
b = (b + a) % m
cnt += c.get(b, 0)
c[b] = c.get(b, 0) + 1
print(cnt) | from collections import defaultdict
n, m = list(map(int, input().split()))
*a, = list(map(int, input().split()))
b = 0
c = defaultdict(int)
c[0] = 1
cnt = 0
for a in a:
b = (b + a) % m
cnt += c[b]
c[b] = c[b] + 1
print(cnt) | 11 | 15 | 193 | 240 | n, m = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
b = 0
c = {0: 1}
cnt = 0
for a in a:
b = (b + a) % m
cnt += c.get(b, 0)
c[b] = c.get(b, 0) + 1
print(cnt)
| from collections import defaultdict
n, m = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
b = 0
c = defaultdict(int)
c[0] = 1
cnt = 0
for a in a:
b = (b + a) % m
cnt += c[b]
c[b] = c[b] + 1
print(cnt)
| false | 26.666667 | [
"+from collections import defaultdict",
"+",
"-c = {0: 1}",
"+c = defaultdict(int)",
"+c[0] = 1",
"- cnt += c.get(b, 0)",
"- c[b] = c.get(b, 0) + 1",
"+ cnt += c[b]",
"+ c[b] = c[b] + 1"
] | false | 0.080217 | 0.070278 | 1.141427 | [
"s374051465",
"s362784703"
] |
u644907318 | p03139 | python | s343115207 | s701328755 | 165 | 68 | 38,256 | 61,480 | Accepted | Accepted | 58.79 | N,A,B = list(map(int,input().split()))
print((min(A,B),max(A+B-N,0))) | N,A,B = list(map(int,input().split()))
print((min(A,B),max(0,A+B-N))) | 2 | 2 | 62 | 62 | N, A, B = list(map(int, input().split()))
print((min(A, B), max(A + B - N, 0)))
| N, A, B = list(map(int, input().split()))
print((min(A, B), max(0, A + B - N)))
| false | 0 | [
"-print((min(A, B), max(A + B - N, 0)))",
"+print((min(A, B), max(0, A + B - N)))"
] | false | 0.040708 | 0.037619 | 1.082109 | [
"s343115207",
"s701328755"
] |
u621935300 | p02586 | python | s804577924 | s440633061 | 671 | 608 | 148,156 | 152,068 | Accepted | Accepted | 9.39 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
R,C,K=list(map(int, sys.stdin.readline().split()))
value=defaultdict(lambda: 0)
value=[ [0 for _ in range(C+1)] for __ in range(R+1) ]
for _ in range(K):
r,c,v=list(map(int, sys.stdin.readline().split()))
value[r][c]=v
dp0=[0]*(... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
R,C,K=list(map(int, sys.stdin.readline().split()))
value=defaultdict(lambda: 0)
value=[ [0 for _ in range(C+1)] for __ in range(R+1) ]
for _ in range(K):
r,c,v=list(map(int, sys.stdin.readline().split()))
value[r][c]=v
dp0=[0]*(... | 43 | 45 | 1,212 | 1,297 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
R, C, K = list(map(int, sys.stdin.readline().split()))
value = defaultdict(lambda: 0)
value = [[0 for _ in range(C + 1)] for __ in range(R + 1)]
for _ in range(K):
r, c, v = list(map(int, sys.stdin.readline().split()))
value[r][c] = v
dp0 =... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
R, C, K = list(map(int, sys.stdin.readline().split()))
value = defaultdict(lambda: 0)
value = [[0 for _ in range(C + 1)] for __ in range(R + 1)]
for _ in range(K):
r, c, v = list(map(int, sys.stdin.readline().split()))
value[r][c] = v
dp0 =... | false | 4.444444 | [
"- dp1[c] = max(dp1[c - 1], dp0[c - 1] + value[r][c], dp0[c] + value[r][c])",
"- dp0[c] = max(dp0[c - 1], dp0[c])",
"+ # dp1[c]=max( dp1[c-1], dp0[c-1]+value[r][c], dp0[c]+value[r][c] )",
"+ dp1[c] = max(dp1[c - 1], dp0[c] + value[r][c])",
"+ # dp0[c]=m... | false | 0.049756 | 0.049219 | 1.010928 | [
"s804577924",
"s440633061"
] |
u785578220 | p02803 | python | s439176867 | s868710498 | 504 | 462 | 3,316 | 3,316 | Accepted | Accepted | 8.33 | from collections import deque
INF = float('inf')
MOD = 10 ** 9 + 7
dy = (0, -1, 0, 1)
dx = (1, 0, -1, 0)
H,W=list(map(int,input().split()))
M = []
Max_list = []
for i in range(H):
t = eval(input())
M.append(t)
dx = [0,0,-1,1]
dy = [1,-1,0,0]
dist = [[-1]*W for _ in range(H)]
q = deque()
f... | from collections import deque
'''
INF = float('inf')
MOD = 10 ** 9 + 7
'''
## ここは1つにまとめれる
# dy = (0, -1, 0, 1)
# dx = (1, 0, -1, 0)
d=[(1,0),(0,1),(-1,0),(0,-1)]
H,W=list(map(int,input().split()))
M = []
Max_list = []
for i in range(H):
t = eval(input())
M.append(t)
dist = [[-1]*W for _... | 40 | 43 | 1,043 | 1,174 | from collections import deque
INF = float("inf")
MOD = 10**9 + 7
dy = (0, -1, 0, 1)
dx = (1, 0, -1, 0)
H, W = list(map(int, input().split()))
M = []
Max_list = []
for i in range(H):
t = eval(input())
M.append(t)
dx = [0, 0, -1, 1]
dy = [1, -1, 0, 0]
dist = [[-1] * W for _ in range(H)]
q = deque()
for i in rang... | from collections import deque
"""
INF = float('inf')
MOD = 10 ** 9 + 7
"""
## ここは1つにまとめれる
# dy = (0, -1, 0, 1)
# dx = (1, 0, -1, 0)
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
H, W = list(map(int, input().split()))
M = []
Max_list = []
for i in range(H):
t = eval(input())
M.append(t)
dist = [[-1] * W for _ in rang... | false | 6.976744 | [
"-INF = float(\"inf\")",
"-MOD = 10**9 + 7",
"-dy = (0, -1, 0, 1)",
"-dx = (1, 0, -1, 0)",
"+\"\"\"",
"+INF = float('inf')",
"+MOD = 10 ** 9 + 7",
"+\"\"\"",
"+## ここは1つにまとめれる",
"+# dy = (0, -1, 0, 1)",
"+# dx = (1, 0, -1, 0)",
"+d = [(1, 0), (0, 1), (-1, 0), (0, -1)]",
"-dx = [0, 0, -1, 1]",... | false | 0.038594 | 0.043958 | 0.877969 | [
"s439176867",
"s868710498"
] |
u912237403 | p00102 | python | s289524397 | s820352455 | 20 | 10 | 4,228 | 4,228 | Accepted | Accepted | 50 | while 1:
n=eval(input())+1
if n==1: break
x=[]
y=[0]*n
for i in range(n-1):
a=list(map(int,input().split()))
a.append(sum(a))
x.append(a)
for i in range(n): y[i]+=a[i]
x.append(y)
for a in x: print("".join([str(x).rjust(5) for x in a])) | while 1:
n = eval(input())
if n==0: break
x = []
y = [0]*(n+1)
for i in range(n):
a=list(map(int, input().split()))
a.append(sum(a))
x.append(a)
for j in range(n+1): y[j] += a[j]
x.append(y)
for a in x: print("".join([str(e).rjust(5) for e in a])) | 12 | 12 | 271 | 279 | while 1:
n = eval(input()) + 1
if n == 1:
break
x = []
y = [0] * n
for i in range(n - 1):
a = list(map(int, input().split()))
a.append(sum(a))
x.append(a)
for i in range(n):
y[i] += a[i]
x.append(y)
for a in x:
print("".join([str(x)... | while 1:
n = eval(input())
if n == 0:
break
x = []
y = [0] * (n + 1)
for i in range(n):
a = list(map(int, input().split()))
a.append(sum(a))
x.append(a)
for j in range(n + 1):
y[j] += a[j]
x.append(y)
for a in x:
print("".join([str(... | false | 0 | [
"- n = eval(input()) + 1",
"- if n == 1:",
"+ n = eval(input())",
"+ if n == 0:",
"- y = [0] * n",
"- for i in range(n - 1):",
"+ y = [0] * (n + 1)",
"+ for i in range(n):",
"- for i in range(n):",
"- y[i] += a[i]",
"+ for j in range(n + 1):",
"... | false | 0.047455 | 0.007655 | 6.1991 | [
"s289524397",
"s820352455"
] |
u285891772 | p03053 | python | s173439737 | s341259749 | 393 | 257 | 186,248 | 120,316 | Accepted | Accepted | 34.61 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 47 | 48 | 1,508 | 1,480 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 2.083333 | [
"-check = [[-1] * W for _ in range(H)]",
"+cnt = [[-1] * W for _ in range(H)]",
"- check[y][x] = 0",
"- q.append((y, x, 0))",
"+ cnt[y][x] = 0",
"+ q.append((y, x))",
"- y, x, cnt = q.popleft()",
"+ y, x = q.popleft()",
"- if 0 <= ny < H and 0... | false | 0.038104 | 0.039429 | 0.966405 | [
"s173439737",
"s341259749"
] |
u309141201 | p03060 | python | s342057501 | s314779948 | 517 | 17 | 42,684 | 2,940 | Accepted | Accepted | 96.71 | n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(2**n):
# test = []
X, Y = 0, 0
for j in range(n):
if (i >> j) & 1 == 1:
X += v[j]
Y += c[j]
# test.append([v[j], c[j]])
if ans < X... | n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for vi, ci in zip(v, c):
if vi >= ci:
ans += vi - ci
print(ans) | 17 | 9 | 373 | 181 | n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(2**n):
# test = []
X, Y = 0, 0
for j in range(n):
if (i >> j) & 1 == 1:
X += v[j]
Y += c[j]
# test.append([v[j], c[j]])
if ans < X - Y:
... | n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for vi, ci in zip(v, c):
if vi >= ci:
ans += vi - ci
print(ans)
| false | 47.058824 | [
"-for i in range(2**n):",
"- # test = []",
"- X, Y = 0, 0",
"- for j in range(n):",
"- if (i >> j) & 1 == 1:",
"- X += v[j]",
"- Y += c[j]",
"- # test.append([v[j], c[j]])",
"- if ans < X - Y:",
"- ans = X - Y",
"- # print(test)",
"... | false | 0.101033 | 0.036456 | 2.771349 | [
"s342057501",
"s314779948"
] |
u864197622 | p02954 | python | s142502901 | s228529444 | 675 | 272 | 25,216 | 10,324 | Accepted | Accepted | 59.7 | S = eval(input())
N = len(S)
X = [[i-1 if S[i] == "L" else i+1 for i in range(N)] if j == 0 else [0]*N for j in range(20)]
for k in range(1, 20):
for i in range(N):
X[k][i] = X[k-1][X[k-1][i]]
A = [0]*N
for i in range(N):
A[X[-1][i]] += 1
print((*A)) | S = eval(input())
N = len(S)
X = [i-1 if S[i] == "L" else i+1 for i in range(N)]
for k in range(1, 20):
X = [X[X[i]] for i in range(N)]
A = [0]*N
for i in range(N):
A[X[i]] += 1
print((*A)) | 10 | 9 | 267 | 197 | S = eval(input())
N = len(S)
X = [
[i - 1 if S[i] == "L" else i + 1 for i in range(N)] if j == 0 else [0] * N
for j in range(20)
]
for k in range(1, 20):
for i in range(N):
X[k][i] = X[k - 1][X[k - 1][i]]
A = [0] * N
for i in range(N):
A[X[-1][i]] += 1
print((*A))
| S = eval(input())
N = len(S)
X = [i - 1 if S[i] == "L" else i + 1 for i in range(N)]
for k in range(1, 20):
X = [X[X[i]] for i in range(N)]
A = [0] * N
for i in range(N):
A[X[i]] += 1
print((*A))
| false | 10 | [
"-X = [",
"- [i - 1 if S[i] == \"L\" else i + 1 for i in range(N)] if j == 0 else [0] * N",
"- for j in range(20)",
"-]",
"+X = [i - 1 if S[i] == \"L\" else i + 1 for i in range(N)]",
"- for i in range(N):",
"- X[k][i] = X[k - 1][X[k - 1][i]]",
"+ X = [X[X[i]] for i in range(N)]",
... | false | 0.046799 | 0.041977 | 1.114876 | [
"s142502901",
"s228529444"
] |
u075012704 | p03999 | python | s202385645 | s718895199 | 953 | 25 | 3,316 | 3,188 | Accepted | Accepted | 97.38 | from itertools import combinations_with_replacement, permutations, zip_longest
S = eval(input())
cmb = list(combinations_with_replacement(["", "+"], (len(S)-1)))
prm = set()
for c in cmb:
for p in permutations(c):
prm.add(p)
formulas = []
for p in prm:
formulas.append("".join(x+y for x, y in ... | from itertools import product, zip_longest
S = eval(input())
cmb = list(product(["", "+"], repeat=(len(S) - 1)))
formulas = []
for c in cmb:
formulas.append("".join(x + y for x, y in zip_longest(S, c, fillvalue="")))
ans = 0
for f in formulas:
ans += eval(f)
print(ans) | 18 | 13 | 415 | 286 | from itertools import combinations_with_replacement, permutations, zip_longest
S = eval(input())
cmb = list(combinations_with_replacement(["", "+"], (len(S) - 1)))
prm = set()
for c in cmb:
for p in permutations(c):
prm.add(p)
formulas = []
for p in prm:
formulas.append("".join(x + y for x, y in zip_lo... | from itertools import product, zip_longest
S = eval(input())
cmb = list(product(["", "+"], repeat=(len(S) - 1)))
formulas = []
for c in cmb:
formulas.append("".join(x + y for x, y in zip_longest(S, c, fillvalue="")))
ans = 0
for f in formulas:
ans += eval(f)
print(ans)
| false | 27.777778 | [
"-from itertools import combinations_with_replacement, permutations, zip_longest",
"+from itertools import product, zip_longest",
"-cmb = list(combinations_with_replacement([\"\", \"+\"], (len(S) - 1)))",
"-prm = set()",
"+cmb = list(product([\"\", \"+\"], repeat=(len(S) - 1)))",
"+formulas = []",
"- ... | false | 0.04333 | 0.037933 | 1.142279 | [
"s202385645",
"s718895199"
] |
u118642796 | p02901 | python | s987333035 | s532585279 | 317 | 242 | 75,352 | 42,716 | Accepted | Accepted | 23.66 | import sys
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def LI_(): return([int(x)-1 for x in sys.stdin.readline().split()])
def main():
N,M = LI()
keys = []
for _ in range(M):
a,b = LI()
C = LI_()
key_bit = 0
for c in C:
key_bit ... | import sys
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def LI_(): return([int(x)-1 for x in sys.stdin.readline().split()])
def main():
N,M = LI()
keys = []
for _ in range(M):
a,b = LI()
C = LI_()
key_bit = 0
for c in C:
key_bit ... | 29 | 28 | 810 | 697 | import sys
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def main():
N, M = LI()
keys = []
for _ in range(M):
a, b = LI()
C = LI_()
key_bit = 0
for c in C:
key_bit... | import sys
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def main():
N, M = LI()
keys = []
for _ in range(M):
a, b = LI()
C = LI_()
key_bit = 0
for c in C:
key_bit... | false | 3.448276 | [
"- dp = [[10**10] * (1 << N) for _ in range(M + 1)]",
"- dp[0][0] = 0",
"+ dp = [10**10] * (1 << N)",
"+ dp[0] = 0",
"- dp[i + 1][key_bit] = min(dp[i][key_bit], dp[i + 1][key_bit])",
"- dp[i + 1][key_bit | keys[i][1]] = min(",
"- dp[i + 1][key_bit | keys[... | false | 0.007457 | 0.033257 | 0.224231 | [
"s987333035",
"s532585279"
] |
u542932305 | p03574 | python | s854979274 | s306207243 | 26 | 23 | 3,572 | 3,572 | Accepted | Accepted | 11.54 | H, W = map(int, input().split())
S = [[s if s == '#' else 0 for s in input().rstrip()] for _ in range(H)]
for i in range(H):
for j in range(W):
count = 0
if S[i][j] != '#':
if i-1 >= 0:
if S[i-1][j] == '#': # top
count += 1
... | H, W = map(int, input().split())
S = [[s if s == '#' else 0 for s in input().rstrip()] for _ in range(H)]
for i in S:
i.insert(0, 0)
i.append(0)
zero_ls = [i for i in range(W+2)]
S.insert(0, zero_ls)
S.append(zero_ls)
for i in range(1, H+1):
for j in range(1, W+1):
if S[i][j] == '#':... | 31 | 35 | 1,087 | 1,077 | H, W = map(int, input().split())
S = [[s if s == "#" else 0 for s in input().rstrip()] for _ in range(H)]
for i in range(H):
for j in range(W):
count = 0
if S[i][j] != "#":
if i - 1 >= 0:
if S[i - 1][j] == "#": # top
count += 1
if j - ... | H, W = map(int, input().split())
S = [[s if s == "#" else 0 for s in input().rstrip()] for _ in range(H)]
for i in S:
i.insert(0, 0)
i.append(0)
zero_ls = [i for i in range(W + 2)]
S.insert(0, zero_ls)
S.append(zero_ls)
for i in range(1, H + 1):
for j in range(1, W + 1):
if S[i][j] == "#":
... | false | 11.428571 | [
"-for i in range(H):",
"- for j in range(W):",
"- count = 0",
"- if S[i][j] != \"#\":",
"- if i - 1 >= 0:",
"- if S[i - 1][j] == \"#\": # top",
"- count += 1",
"- if j - 1 >= 0 and S[i - 1][j - 1] == \"#\": # top_left",
"... | false | 0.045306 | 0.045513 | 0.995458 | [
"s854979274",
"s306207243"
] |
u227082700 | p03018 | python | s875546504 | s774302594 | 241 | 63 | 8,100 | 3,500 | Accepted | Accepted | 73.86 | s=list(eval(input()))
n=len(s)
a=0
b=[]
i=0
def ac(b):
a=b[::-1]
t,c=0,0
for i in range(len(b)):
if a[i]==0:c+=i-t;t+=1
return c
while i<n:
f=True
if s[i]=="A":b.append(0);f=False
if i<n-1:
if s[i]+s[i+1]=="BC":b.append(1);f=False;i+=1
if f:
a+=ac(b)
b=[]
i+=1
print... | s=input().replace("BC","X").replace("B","Y").replace("C","Y")
a=False
ans=0
c=0
for i in "Y"+s+"Y":
if i=="A":
a=True
c+=1
if i=="X":
if a:
ans+=c
if i=="Y":
a=False
c=0
print(ans) | 21 | 15 | 323 | 210 | s = list(eval(input()))
n = len(s)
a = 0
b = []
i = 0
def ac(b):
a = b[::-1]
t, c = 0, 0
for i in range(len(b)):
if a[i] == 0:
c += i - t
t += 1
return c
while i < n:
f = True
if s[i] == "A":
b.append(0)
f = False
if i < n - 1:
if s... | s = input().replace("BC", "X").replace("B", "Y").replace("C", "Y")
a = False
ans = 0
c = 0
for i in "Y" + s + "Y":
if i == "A":
a = True
c += 1
if i == "X":
if a:
ans += c
if i == "Y":
a = False
c = 0
print(ans)
| false | 28.571429 | [
"-s = list(eval(input()))",
"-n = len(s)",
"-a = 0",
"-b = []",
"-i = 0",
"-",
"-",
"-def ac(b):",
"- a = b[::-1]",
"- t, c = 0, 0",
"- for i in range(len(b)):",
"- if a[i] == 0:",
"- c += i - t",
"- t += 1",
"- return c",
"-",
"-",
"-while ... | false | 0.047155 | 0.04672 | 1.009306 | [
"s875546504",
"s774302594"
] |
u375172966 | p03295 | python | s298444024 | s637592790 | 545 | 441 | 21,716 | 29,084 | Accepted | Accepted | 19.08 | n, m = list(map(int, input().split()))
info = []
for _ in range(m):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
info.append([a, b])
info.sort()
tmp = []
for i, j in enumerate(info):
if i == 0:
tmp.append(j[1])
elif j[0] > tmp[-1]-1:
tmp.append(j[1])
else:
... | n, m = list(map(int, input().split()))
line = [list(map(int, input().split())) for _ in range(m)]
line.sort(key=lambda x: x[1])
ans = 1
now = line[0][1]
for s, g in line[1:]:
if s >= now:
ans += 1
now = g
print(ans)
| 17 | 11 | 380 | 241 | n, m = list(map(int, input().split()))
info = []
for _ in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
info.append([a, b])
info.sort()
tmp = []
for i, j in enumerate(info):
if i == 0:
tmp.append(j[1])
elif j[0] > tmp[-1] - 1:
tmp.append(j[1])
else:
... | n, m = list(map(int, input().split()))
line = [list(map(int, input().split())) for _ in range(m)]
line.sort(key=lambda x: x[1])
ans = 1
now = line[0][1]
for s, g in line[1:]:
if s >= now:
ans += 1
now = g
print(ans)
| false | 35.294118 | [
"-info = []",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- a, b = a - 1, b - 1",
"- info.append([a, b])",
"-info.sort()",
"-tmp = []",
"-for i, j in enumerate(info):",
"- if i == 0:",
"- tmp.append(j[1])",
"- elif j[0] > tmp[-1] - 1:",
"- t... | false | 0.036647 | 0.039447 | 0.929001 | [
"s298444024",
"s637592790"
] |
u359358631 | p02550 | python | s603008271 | s302547469 | 85 | 66 | 78,760 | 68,780 | Accepted | Accepted | 22.35 | def f(x, m):
return (x ** 2) % m
def main():
n, x, m = list(map(int, input().split()))
lst = [[False, 0] for _ in range((m + 1))]
lst[x] = [True, 1]
res = [x]
loop = 0
for i in range(2, m + 1):
x = f(x, m)
if lst[x][0] == False:
lst[x][0] = True
... | def main():
n, x, m = list(map(int, input().split()))
idx = [-1] * (m + 1) # mで割った余り(0,1,...m-1)が何回目に出てきたか
res = [] # 数列A
for i in range(1, m + 3): # 余りはm+1種類なのでm+2回計算すれば絶対ループが発生する
if idx[x] == -1: # 初めて
idx[x] = i
res.append(x)
else: # 既出(ループ発見)
... | 32 | 27 | 749 | 808 | def f(x, m):
return (x**2) % m
def main():
n, x, m = list(map(int, input().split()))
lst = [[False, 0] for _ in range((m + 1))]
lst[x] = [True, 1]
res = [x]
loop = 0
for i in range(2, m + 1):
x = f(x, m)
if lst[x][0] == False:
lst[x][0] = True
lst[x]... | def main():
n, x, m = list(map(int, input().split()))
idx = [-1] * (m + 1) # mで割った余り(0,1,...m-1)が何回目に出てきたか
res = [] # 数列A
for i in range(1, m + 3): # 余りはm+1種類なのでm+2回計算すれば絶対ループが発生する
if idx[x] == -1: # 初めて
idx[x] = i
res.append(x)
else: # 既出(ループ発見)
... | false | 15.625 | [
"-def f(x, m):",
"- return (x**2) % m",
"-",
"-",
"- lst = [[False, 0] for _ in range((m + 1))]",
"- lst[x] = [True, 1]",
"- res = [x]",
"- loop = 0",
"- for i in range(2, m + 1):",
"- x = f(x, m)",
"- if lst[x][0] == False:",
"- lst[x][0] = True",
... | false | 0.047398 | 0.04207 | 1.126646 | [
"s603008271",
"s302547469"
] |
u539281377 | p02838 | python | s327578046 | s358615020 | 1,991 | 332 | 42,156 | 48,808 | Accepted | Accepted | 83.32 | N=int(eval(input()))
A=list(map(int,input().split()))
ans=0
mod=10**9+7
for i in range(61):
a=sum([1 for j in A if j>>i & 1])
ans=ans+a*(N-a)*(2**i)
ans=ans%mod
print(ans) | import numpy as np
N=int(eval(input()))
A=np.array(list(map(int,input().split())))
ans=0
mod=10**9+7
for i in range(61):
n=np.count_nonzero(A>>i & 1)
ans+=n*(N-n)<<i
print((ans%mod)) | 9 | 9 | 185 | 190 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(61):
a = sum([1 for j in A if j >> i & 1])
ans = ans + a * (N - a) * (2**i)
ans = ans % mod
print(ans)
| import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
ans = 0
mod = 10**9 + 7
for i in range(61):
n = np.count_nonzero(A >> i & 1)
ans += n * (N - n) << i
print((ans % mod))
| false | 0 | [
"+import numpy as np",
"+",
"-A = list(map(int, input().split()))",
"+A = np.array(list(map(int, input().split())))",
"- a = sum([1 for j in A if j >> i & 1])",
"- ans = ans + a * (N - a) * (2**i)",
"- ans = ans % mod",
"-print(ans)",
"+ n = np.count_nonzero(A >> i & 1)",
"+ ans += ... | false | 0.085493 | 0.162486 | 0.526158 | [
"s327578046",
"s358615020"
] |
u168578024 | p03061 | python | s032270227 | s113451485 | 740 | 680 | 81,340 | 81,568 | Accepted | Accepted | 8.11 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I]*(N*2)
def assign(self, k, x):
self.seg[k + self... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I]*(N*2)
def assign(self, k, x):
self.seg[k + self... | 54 | 54 | 1,331 | 1,321 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I] * (N * 2)
def assign(self, k, x):
self.seg[k + self.sz] = x... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I] * (N * 2)
def assign(self, k, x):
self.seg[k + self.sz] = x... | false | 0 | [
"- if a % 2 == 1:",
"+ if a & 1:",
"- if b % 2 == 1:",
"+ if b & 1:"
] | false | 0.049764 | 0.00783 | 6.355108 | [
"s032270227",
"s113451485"
] |
u753803401 | p02848 | python | s935823845 | s760660696 | 210 | 165 | 40,560 | 38,640 | Accepted | Accepted | 21.43 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
s = str(readline().rstrip().decode('utf-8'))
al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
ans = []
for i in range(len(s)):
for j in range(len(al)):
if s[i] == al[j]... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
s = str(readline().rstrip().decode('utf-8'))
ls = {i - 65: chr(i) for i in range(65, 91)}
ans = []
for i in range(len(s)):
ans.append(ls[(ord(s[i]) - 65 + n) % 26])
pr... | 20 | 17 | 459 | 387 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
s = str(readline().rstrip().decode("utf-8"))
al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
ans = []
for i in range(len(s)):
for j in range(len(al)):
if s[i] == al[j]:
... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
s = str(readline().rstrip().decode("utf-8"))
ls = {i - 65: chr(i) for i in range(65, 91)}
ans = []
for i in range(len(s)):
ans.append(ls[(ord(s[i]) - 65 + n) % 26])
print(("".join(a... | false | 15 | [
"- al = list(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")",
"+ ls = {i - 65: chr(i) for i in range(65, 91)}",
"- for j in range(len(al)):",
"- if s[i] == al[j]:",
"- ans.append(al[(j + n) % 26])",
"- break",
"+ ans.append(ls[(ord(s[i]) - 65 + n) % 26])"
] | false | 0.036598 | 0.037699 | 0.970799 | [
"s935823845",
"s760660696"
] |
u143509139 | p03000 | python | s934912579 | s955217443 | 170 | 18 | 38,384 | 3,060 | Accepted | Accepted | 89.41 | n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
d = 0
ans = 0
for i in range(n):
if x < d:
break
ans += 1
d += l[i]
if x >= d:
ans += 1
print(ans) | from bisect import bisect_right
n, x = list(map(int, input().split()))
l = [0] + list(map(int, input().split()))
for i in range(n):
l[i + 1] += l[i]
print((bisect_right(l, x)))
| 12 | 6 | 202 | 178 | n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
d = 0
ans = 0
for i in range(n):
if x < d:
break
ans += 1
d += l[i]
if x >= d:
ans += 1
print(ans)
| from bisect import bisect_right
n, x = list(map(int, input().split()))
l = [0] + list(map(int, input().split()))
for i in range(n):
l[i + 1] += l[i]
print((bisect_right(l, x)))
| false | 50 | [
"+from bisect import bisect_right",
"+",
"-l = list(map(int, input().split()))",
"-d = 0",
"-ans = 0",
"+l = [0] + list(map(int, input().split()))",
"- if x < d:",
"- break",
"- ans += 1",
"- d += l[i]",
"-if x >= d:",
"- ans += 1",
"-print(ans)",
"+ l[i + 1] += l[i]"... | false | 0.095745 | 0.045431 | 2.107462 | [
"s934912579",
"s955217443"
] |
u970308980 | p03244 | python | s078884586 | s470444485 | 272 | 150 | 65,384 | 22,492 | Accepted | Accepted | 44.85 | from collections import defaultdict
N = int(eval(input()))
V = list(map(int, input().split()))
# コーナーケースは先に終わらせる
# 全部同じ数の場合は、N/2が答え
if len(set(V)) == 1:
print((N//2))
exit()
# 2つしかない場合は1が答え
if N == 2:
print((1))
exit()
# 方針: 偶数番目と奇数番目は分けて考える
# 偶数番目、奇数番目はそれぞれの最頻値に合わせるのが低コスト
# 最頻値が同じ場合... | from collections import defaultdict
N = int(eval(input()))
L = list(map(int, input().split()))
if len(set(L)) == 1:
print((N//2))
exit()
if N == 2:
print((0))
exit()
d_even = defaultdict(int)
d_odd = defaultdict(int)
for i in range(N):
v = L[i]
if i % 2 == 0:
d_ev... | 38 | 33 | 853 | 690 | from collections import defaultdict
N = int(eval(input()))
V = list(map(int, input().split()))
# コーナーケースは先に終わらせる
# 全部同じ数の場合は、N/2が答え
if len(set(V)) == 1:
print((N // 2))
exit()
# 2つしかない場合は1が答え
if N == 2:
print((1))
exit()
# 方針: 偶数番目と奇数番目は分けて考える
# 偶数番目、奇数番目はそれぞれの最頻値に合わせるのが低コスト
# 最頻値が同じ場合は「数列に現れる数はちょうど2種類... | from collections import defaultdict
N = int(eval(input()))
L = list(map(int, input().split()))
if len(set(L)) == 1:
print((N // 2))
exit()
if N == 2:
print((0))
exit()
d_even = defaultdict(int)
d_odd = defaultdict(int)
for i in range(N):
v = L[i]
if i % 2 == 0:
d_even[v] += 1
else:
... | false | 13.157895 | [
"-V = list(map(int, input().split()))",
"-# コーナーケースは先に終わらせる",
"-# 全部同じ数の場合は、N/2が答え",
"-if len(set(V)) == 1:",
"+L = list(map(int, input().split()))",
"+if len(set(L)) == 1:",
"-# 2つしかない場合は1が答え",
"- print((1))",
"+ print((0))",
"-# 方針: 偶数番目と奇数番目は分けて考える",
"-# 偶数番目、奇数番目はそれぞれの最頻値に合わせるのが低コスト",
... | false | 0.060119 | 0.068957 | 0.871833 | [
"s078884586",
"s470444485"
] |
u464032595 | p02595 | python | s202254816 | s351881577 | 720 | 630 | 59,536 | 59,400 | Accepted | Accepted | 12.5 | n, d = list(map(int, input().split()))
x, y = list(zip(*[list(map(int, input().split())) for i in range(n)]))
ans = 0
for i in range(n):
if (x[i]**2 + y[i]**2)**0.5 <= d:
ans += 1
print(ans) | n, d = list(map(int, input().split()))
x, y = list(zip(*[list(map(int, input().split())) for i in range(n)]))
ans = 0
for i in range(n):
if x[i]**2 + y[i]**2 <= d**2:
ans += 1
print(ans) | 9 | 9 | 200 | 198 | n, d = list(map(int, input().split()))
x, y = list(zip(*[list(map(int, input().split())) for i in range(n)]))
ans = 0
for i in range(n):
if (x[i] ** 2 + y[i] ** 2) ** 0.5 <= d:
ans += 1
print(ans)
| n, d = list(map(int, input().split()))
x, y = list(zip(*[list(map(int, input().split())) for i in range(n)]))
ans = 0
for i in range(n):
if x[i] ** 2 + y[i] ** 2 <= d**2:
ans += 1
print(ans)
| false | 0 | [
"- if (x[i] ** 2 + y[i] ** 2) ** 0.5 <= d:",
"+ if x[i] ** 2 + y[i] ** 2 <= d**2:"
] | false | 0.045862 | 0.087074 | 0.5267 | [
"s202254816",
"s351881577"
] |
u179070318 | p02415 | python | s067330837 | s927716679 | 30 | 20 | 5,544 | 5,544 | Accepted | Accepted | 33.33 | word = eval(input())
print((word.swapcase()))
| inp = eval(input())
print((inp.swapcase()))
| 3 | 3 | 41 | 39 | word = eval(input())
print((word.swapcase()))
| inp = eval(input())
print((inp.swapcase()))
| false | 0 | [
"-word = eval(input())",
"-print((word.swapcase()))",
"+inp = eval(input())",
"+print((inp.swapcase()))"
] | false | 0.043222 | 0.039117 | 1.104922 | [
"s067330837",
"s927716679"
] |
u419686324 | p03504 | python | s802066363 | s211440093 | 1,607 | 787 | 46,376 | 32,692 | Accepted | Accepted | 51.03 | N, C = list(map(int, input().split()))
stc = [[int(x) for x in input().split()] for _ in range(N)]
im = [[0] * (10**5 + 1) for _ in range(C + 1)]
for x in stc:
s,t,c = x
im[c][s] += 1
im[c][t] -= 1
for c in range(1, C + 1):
v = 0
for i in range(1, 10**5 + 1):
n = im[c][i]
... | import operator
N, C = list(map(int, input().split()))
stc = [[int(x) for x in input().split()] for _ in range(N)]
united = []
pc,ps,pt = 0,0,0
for x in sorted(stc, key=operator.itemgetter(2,0,1)):
s, t, c = x
if c == pc and s == pt:
united[-1][1] = t
else:
united.append([s, t, c... | 18 | 19 | 440 | 463 | N, C = list(map(int, input().split()))
stc = [[int(x) for x in input().split()] for _ in range(N)]
im = [[0] * (10**5 + 1) for _ in range(C + 1)]
for x in stc:
s, t, c = x
im[c][s] += 1
im[c][t] -= 1
for c in range(1, C + 1):
v = 0
for i in range(1, 10**5 + 1):
n = im[c][i]
v += n
... | import operator
N, C = list(map(int, input().split()))
stc = [[int(x) for x in input().split()] for _ in range(N)]
united = []
pc, ps, pt = 0, 0, 0
for x in sorted(stc, key=operator.itemgetter(2, 0, 1)):
s, t, c = x
if c == pc and s == pt:
united[-1][1] = t
else:
united.append([s, t, c])
... | false | 5.263158 | [
"+import operator",
"+",
"-im = [[0] * (10**5 + 1) for _ in range(C + 1)]",
"-for x in stc:",
"+united = []",
"+pc, ps, pt = 0, 0, 0",
"+for x in sorted(stc, key=operator.itemgetter(2, 0, 1)):",
"- im[c][s] += 1",
"- im[c][t] -= 1",
"-for c in range(1, C + 1):",
"- v = 0",
"- for i... | false | 0.193811 | 0.041685 | 4.649456 | [
"s802066363",
"s211440093"
] |
u561083515 | p02954 | python | s607886414 | s451185308 | 153 | 131 | 9,836 | 8,616 | Accepted | Accepted | 14.38 | """
各人についての移動回数
偶数 -> 状態同じ
奇数 -> 一回移動
"""
S = [False if s == "L" else True for s in eval(input())]
N = len(S)
from collections import deque
F_idx = deque([idx for idx in range(N) if not S[idx]])
T_idx = deque([idx for idx in range(N) if S[idx]])
state = [0] * N
# ->
for i in range(N):
if S[i]:
... | S = list(input())
cnt = [0] * len(S)
R = []
for i,s in enumerate(S):
if s == "L":
for r in R:
if (i - r) % 2 == 0:
cnt[i] += 1
else:
cnt[i-1] += 1
R = []
else:
R.append(i)
L = []
for i in range(len(S)-1, -1, -1):... | 35 | 30 | 729 | 557 | """
各人についての移動回数
偶数 -> 状態同じ
奇数 -> 一回移動
"""
S = [False if s == "L" else True for s in eval(input())]
N = len(S)
from collections import deque
F_idx = deque([idx for idx in range(N) if not S[idx]])
T_idx = deque([idx for idx in range(N) if S[idx]])
state = [0] * N
# ->
for i in range(N):
if S[i]:
if (F_idx[0]... | S = list(input())
cnt = [0] * len(S)
R = []
for i, s in enumerate(S):
if s == "L":
for r in R:
if (i - r) % 2 == 0:
cnt[i] += 1
else:
cnt[i - 1] += 1
R = []
else:
R.append(i)
L = []
for i in range(len(S) - 1, -1, -1):
s = S[i]
... | false | 14.285714 | [
"-\"\"\"",
"-各人についての移動回数",
"-偶数 -> 状態同じ",
"-奇数 -> 一回移動",
"-\"\"\"",
"-S = [False if s == \"L\" else True for s in eval(input())]",
"-N = len(S)",
"-from collections import deque",
"-",
"-F_idx = deque([idx for idx in range(N) if not S[idx]])",
"-T_idx = deque([idx for idx in range(N) if S[idx]])... | false | 0.04817 | 0.040282 | 1.195809 | [
"s607886414",
"s451185308"
] |
u077291787 | p02911 | python | s384623986 | s943073544 | 91 | 62 | 14,324 | 13,940 | Accepted | Accepted | 31.87 | # ABC141
from collections import Counter
def main():
N, K, Q, *A = list(map(int, open(0).read().split()))
C = Counter(A)
ans = []
for i in range(1, N + 1):
x = "Yes" if K - Q + C[i] > 0 else "No"
ans.append(x)
print(("\n".join(ans)))
if __name__ == "__main__":
... | # ABC141C - Attack Survival (w/o Counter)
def main():
N, K, Q, *A = list(map(int, open(0).read().split()))
ans, C = [], [0] * (N + 1)
for i in A:
C[i] += 1
for i in C[1:]:
x = "Yes" if K - Q + i > 0 else "No"
ans.append(x)
print(("\n".join(ans)))
if __name__ ==... | 16 | 14 | 318 | 336 | # ABC141
from collections import Counter
def main():
N, K, Q, *A = list(map(int, open(0).read().split()))
C = Counter(A)
ans = []
for i in range(1, N + 1):
x = "Yes" if K - Q + C[i] > 0 else "No"
ans.append(x)
print(("\n".join(ans)))
if __name__ == "__main__":
main()
| # ABC141C - Attack Survival (w/o Counter)
def main():
N, K, Q, *A = list(map(int, open(0).read().split()))
ans, C = [], [0] * (N + 1)
for i in A:
C[i] += 1
for i in C[1:]:
x = "Yes" if K - Q + i > 0 else "No"
ans.append(x)
print(("\n".join(ans)))
if __name__ == "__main__":... | false | 12.5 | [
"-# ABC141",
"-from collections import Counter",
"-",
"-",
"+# ABC141C - Attack Survival (w/o Counter)",
"- C = Counter(A)",
"- ans = []",
"- for i in range(1, N + 1):",
"- x = \"Yes\" if K - Q + C[i] > 0 else \"No\"",
"+ ans, C = [], [0] * (N + 1)",
"+ for i in A:",
"+ ... | false | 0.037537 | 0.076646 | 0.489743 | [
"s384623986",
"s943073544"
] |
u633255271 | p02612 | python | s845543802 | s450197349 | 81 | 67 | 61,824 | 61,524 | Accepted | Accepted | 17.28 | from math import ceil
N = int(eval(input()))
print((ceil(N/1000)*1000 - N)) | N = int(eval(input()))
print(((10000-N)%1000)) | 4 | 2 | 71 | 39 | from math import ceil
N = int(eval(input()))
print((ceil(N / 1000) * 1000 - N))
| N = int(eval(input()))
print(((10000 - N) % 1000))
| false | 50 | [
"-from math import ceil",
"-",
"-print((ceil(N / 1000) * 1000 - N))",
"+print(((10000 - N) % 1000))"
] | false | 0.03599 | 0.046514 | 0.773738 | [
"s845543802",
"s450197349"
] |
u408071652 | p02608 | python | s411142464 | s105998313 | 86 | 51 | 68,940 | 9,304 | Accepted | Accepted | 40.7 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
dp = [0] * (N + 1)
rt = int(N ** 0.5) + 1
for i in range(1, rt):
ii = i ** 2
for j in range(1, i+1):
iji = ii + j **2 + i * j
if iji + 1 + i + j ... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
dp = [0] * (N + 1)
rt = int(N ** 0.5) + 1
for i in range(1, rt):
ii = i ** 2
for j in range(1, i + 1):
iji = ii + j ** 2 + i * j
if iji + 1 + i + j > N... | 37 | 33 | 783 | 794 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
dp = [0] * (N + 1)
rt = int(N**0.5) + 1
for i in range(1, rt):
ii = i**2
for j in range(1, i + 1):
iji = ii + j**2 + i * j
if iji + 1 + i + j > N:
bre... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
dp = [0] * (N + 1)
rt = int(N**0.5) + 1
for i in range(1, rt):
ii = i**2
for j in range(1, i + 1):
iji = ii + j**2 + i * j
if iji + 1 + i + j > N:
bre... | false | 10.810811 | [
"- case = iji + k**2 + i * k + j * k",
"- l = 6",
"- if i == j or j == k:",
"- l = 3",
"- if i == k:",
"- l = 1",
"- if case <= N:",
"- dp[case] += l",
"+ ... | false | 0.077299 | 0.113894 | 0.678691 | [
"s411142464",
"s105998313"
] |
u813387707 | p03062 | python | s422749660 | s112033724 | 109 | 94 | 14,260 | 20,040 | Accepted | Accepted | 13.76 | n = int(eval(input()))
a_list = [int(x) for x in input().split()]
count = 0
for i in range(n):
if a_list[i] < 0:
a_list[i] *= -1
count += 1
ans = sum(a_list)
if count % 2 == 1:
a_list.sort()
ans -= a_list[0] * 2
print(ans) | n = int(eval(input()))
a_list = [int(x) for x in input().split()]
count = 0
ans = 0
m = 10 ** 9
for i in range(n):
if a_list[i] < 0:
a_list[i] *= -1
count += 1
ans += a_list[i]
if a_list[i] < m:
m = a_list[i]
if count % 2 == 1:
ans -= m * 2
print(ans) | 14 | 15 | 259 | 299 | n = int(eval(input()))
a_list = [int(x) for x in input().split()]
count = 0
for i in range(n):
if a_list[i] < 0:
a_list[i] *= -1
count += 1
ans = sum(a_list)
if count % 2 == 1:
a_list.sort()
ans -= a_list[0] * 2
print(ans)
| n = int(eval(input()))
a_list = [int(x) for x in input().split()]
count = 0
ans = 0
m = 10**9
for i in range(n):
if a_list[i] < 0:
a_list[i] *= -1
count += 1
ans += a_list[i]
if a_list[i] < m:
m = a_list[i]
if count % 2 == 1:
ans -= m * 2
print(ans)
| false | 6.666667 | [
"+ans = 0",
"+m = 10**9",
"-ans = sum(a_list)",
"+ ans += a_list[i]",
"+ if a_list[i] < m:",
"+ m = a_list[i]",
"- a_list.sort()",
"- ans -= a_list[0] * 2",
"+ ans -= m * 2"
] | false | 0.04333 | 0.045221 | 0.958183 | [
"s422749660",
"s112033724"
] |
u254871849 | p03252 | python | s484992361 | s988917526 | 137 | 92 | 3,828 | 4,472 | Accepted | Accepted | 32.85 | import sys
def o(c): return ord(c) - ord('a')
s, t = sys.stdin.read().split()
def main():
g1 = [set() for _ in range(26)]
g2 = [set() for _ in range(26)]
for i in range(len(s)):
a = o(s[i]); b = o(t[i])
g1[a].add(b); g2[b].add(a)
for i in range(26):
if len(g1[i]... | import sys
from string import ascii_lowercase
o = dict(list(zip(ascii_lowercase, list(range(26)))))
s, t = sys.stdin.read().split()
def main():
g1 = [set() for _ in range(26)]
g2 = [set() for _ in range(26)]
for i in range(len(s)):
a = o[s[i]]; b = o[t[i]]
g1[a].add(b); g2[b].... | 21 | 22 | 452 | 495 | import sys
def o(c):
return ord(c) - ord("a")
s, t = sys.stdin.read().split()
def main():
g1 = [set() for _ in range(26)]
g2 = [set() for _ in range(26)]
for i in range(len(s)):
a = o(s[i])
b = o(t[i])
g1[a].add(b)
g2[b].add(a)
for i in range(26):
if len... | import sys
from string import ascii_lowercase
o = dict(list(zip(ascii_lowercase, list(range(26)))))
s, t = sys.stdin.read().split()
def main():
g1 = [set() for _ in range(26)]
g2 = [set() for _ in range(26)]
for i in range(len(s)):
a = o[s[i]]
b = o[t[i]]
g1[a].add(b)
g2[b... | false | 4.545455 | [
"+from string import ascii_lowercase",
"-",
"-def o(c):",
"- return ord(c) - ord(\"a\")",
"-",
"-",
"+o = dict(list(zip(ascii_lowercase, list(range(26)))))",
"- a = o(s[i])",
"- b = o(t[i])",
"+ a = o[s[i]]",
"+ b = o[t[i]]"
] | false | 0.043611 | 0.096821 | 0.450423 | [
"s484992361",
"s988917526"
] |
u077291787 | p03221 | python | s216321249 | s141120881 | 557 | 440 | 29,028 | 29,080 | Accepted | Accepted | 21.01 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ans = [""] * m
arr = []
cnt = 1
for i in range(m):
p, y = list(map(int, input().split()))
arr.append((p, y, i))
arr.sort()
ans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)
for i in range(1, m):
if arr[i - 1][0] ... | ## ABC113C - ID
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
ans = [""] * m
arr = []
cnt = 1
for i in range(m):
p, y = list(map(int, input().split()))
arr += [(p, y, i)]
arr = sorted(arr)
ans[arr[0][2]] = "{... | 22 | 28 | 456 | 623 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ans = [""] * m
arr = []
cnt = 1
for i in range(m):
p, y = list(map(int, input().split()))
arr.append((p, y, i))
arr.sort()
ans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)
for i in range(1, m):
if arr[i - 1][0] == arr[i][0]:
... | ## ABC113C - ID
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
ans = [""] * m
arr = []
cnt = 1
for i in range(m):
p, y = list(map(int, input().split()))
arr += [(p, y, i)]
arr = sorted(arr)
ans[arr[0][2]] = "{:06}{:06}".fo... | false | 21.428571 | [
"+## ABC113C - ID",
"-n, m = list(map(int, input().split()))",
"-ans = [\"\"] * m",
"-arr = []",
"-cnt = 1",
"-for i in range(m):",
"- p, y = list(map(int, input().split()))",
"- arr.append((p, y, i))",
"-arr.sort()",
"-ans[arr[0][2]] = \"{:06}{:06}\".format(arr[0][0], cnt)",
"-for i in ra... | false | 0.055311 | 0.036321 | 1.522848 | [
"s216321249",
"s141120881"
] |
u043639882 | p02397 | python | s540443353 | s585546627 | 50 | 40 | 7,868 | 7,768 | Accepted | Accepted | 20 | import sys
while True:
(x, y) = [int(i) for i in sys.stdin.readline().split()]
if x == 0 and y == 0:
break
if x > y:
z = x
x = y
y = z
print((x, y)) | import sys
ff = sys.stdin
while True :
a, b = list(map(int, ff.readline().split()))
if (a == 0) & (b == 0) :
break
if a < b : print((a, b))
else : print((b, a)) | 14 | 11 | 239 | 196 | import sys
while True:
(x, y) = [int(i) for i in sys.stdin.readline().split()]
if x == 0 and y == 0:
break
if x > y:
z = x
x = y
y = z
print((x, y))
| import sys
ff = sys.stdin
while True:
a, b = list(map(int, ff.readline().split()))
if (a == 0) & (b == 0):
break
if a < b:
print((a, b))
else:
print((b, a))
| false | 21.428571 | [
"+ff = sys.stdin",
"- (x, y) = [int(i) for i in sys.stdin.readline().split()]",
"- if x == 0 and y == 0:",
"+ a, b = list(map(int, ff.readline().split()))",
"+ if (a == 0) & (b == 0):",
"- if x > y:",
"- z = x",
"- x = y",
"- y = z",
"- print((x, y))",
"+ ... | false | 0.044224 | 0.037279 | 1.186307 | [
"s540443353",
"s585546627"
] |
u693378622 | p02971 | python | s437779453 | s085691732 | 537 | 444 | 14,112 | 15,592 | Accepted | Accepted | 17.32 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
m1 = b[-1]
m2 = b[-2]
for k in a:
if k == m1:
print(m2)
else:
print(m1)
| #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[int]"):
left = [A[0]] * N
right = [A[-1]] * N
for i in range(1,N):
left[i] = max(A[i], left[i-1])
for i in reversed(list(range(0,N-1))):
right[i] = max(A[i], right[i+1])
for i in range(N):
if i == ... | 11 | 38 | 175 | 821 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
m1 = b[-1]
m2 = b[-2]
for k in a:
if k == m1:
print(m2)
else:
print(m1)
| #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[int]"):
left = [A[0]] * N
right = [A[-1]] * N
for i in range(1, N):
left[i] = max(A[i], left[i - 1])
for i in reversed(list(range(0, N - 1))):
right[i] = max(A[i], right[i + 1])
for i in range(N):
if i == 0:
... | false | 71.052632 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-b = sorted(a)",
"-m1 = b[-1]",
"-m2 = b[-2]",
"-for k in a:",
"- if k == m1:",
"- print(m2)",
"- else:",
"- print(m1)",
"+#!/usr/bin/env python3",
"+import sys",
"+",
"+",
"+def solve(N: int, ... | false | 0.114035 | 0.040707 | 2.801355 | [
"s437779453",
"s085691732"
] |
u054825571 | p02817 | python | s313118217 | s760902856 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | S=list(input().split())
a=S[1]+S[0]
print(a) | S,T=input().split()
print((T+S)) | 3 | 2 | 46 | 31 | S = list(input().split())
a = S[1] + S[0]
print(a)
| S, T = input().split()
print((T + S))
| false | 33.333333 | [
"-S = list(input().split())",
"-a = S[1] + S[0]",
"-print(a)",
"+S, T = input().split()",
"+print((T + S))"
] | false | 0.116158 | 0.034288 | 3.387676 | [
"s313118217",
"s760902856"
] |
u349444371 | p02631 | python | s730214382 | s316214050 | 411 | 191 | 31,448 | 31,432 | Accepted | Accepted | 53.53 | n=int(eval(input()))
a=list(map(int,input().split()))
#print(bin(11^9^24))
B=bin(a[0])
for i in range(1,n):
B=bin(int(str(B)[2:],2)^a[i])
for j in range(n):
x=bin(int(str(B)[2:],2)^a[j])
print((int(str(x)[2:],2))) | n=int(eval(input()))
a=list(map(int,input().split()))
#print(bin(11^9^24))
B=a[0]
for i in range(1,n):
B=B^a[i]
ans=[]
for j in range(n):
x=B^a[j]
ans.append(x)
print((*ans)) | 9 | 11 | 225 | 188 | n = int(eval(input()))
a = list(map(int, input().split()))
# print(bin(11^9^24))
B = bin(a[0])
for i in range(1, n):
B = bin(int(str(B)[2:], 2) ^ a[i])
for j in range(n):
x = bin(int(str(B)[2:], 2) ^ a[j])
print((int(str(x)[2:], 2)))
| n = int(eval(input()))
a = list(map(int, input().split()))
# print(bin(11^9^24))
B = a[0]
for i in range(1, n):
B = B ^ a[i]
ans = []
for j in range(n):
x = B ^ a[j]
ans.append(x)
print((*ans))
| false | 18.181818 | [
"-B = bin(a[0])",
"+B = a[0]",
"- B = bin(int(str(B)[2:], 2) ^ a[i])",
"+ B = B ^ a[i]",
"+ans = []",
"- x = bin(int(str(B)[2:], 2) ^ a[j])",
"- print((int(str(x)[2:], 2)))",
"+ x = B ^ a[j]",
"+ ans.append(x)",
"+print((*ans))"
] | false | 0.036665 | 0.038348 | 0.956106 | [
"s730214382",
"s316214050"
] |
u952022797 | p03475 | python | s744353700 | s581213805 | 220 | 196 | 41,964 | 40,048 | Accepted | Accepted | 10.91 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,var... | # -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
##### リストの 二分木検索 #####
# bisect_le... | 51 | 98 | 1,232 | 2,677 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
# NO, PAY-PAY
# import numpy as np
# import statistics
# from statistics import mean, median,variance,stde... | # -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# ... | false | 47.959184 | [
"-import copy",
"-import collections",
"+import math",
"+import collections",
"+import copy",
"+import heapq",
"-import math",
"+import itertools",
"-# NO, PAY-PAY",
"-# import numpy as np",
"-# import statistics",
"-# from statistics import mean, median,variance,stdev",
"+input = sys.stdin.... | false | 0.03905 | 0.105687 | 0.36949 | [
"s744353700",
"s581213805"
] |
u133936772 | p02838 | python | s446225651 | s919112199 | 745 | 556 | 122,936 | 122,936 | Accepted | Accepted | 25.37 | M=10**9+7
n=int(eval(input()))
l=list(map(int,input().split()))
a=0
for i in range(60):
t=sum((l[j]>>i)%2 for j in range(n))
a+=(t*(n-t)<<i)%M
print((a%M)) | M=10**9+7
n=int(eval(input()))
l=list(map(int,input().split()))
a=0
for i in range(60):
t=sum(j>>i&1 for j in l)
a+=(t*(n-t)<<i)%M
print((a%M)) | 8 | 8 | 158 | 146 | M = 10**9 + 7
n = int(eval(input()))
l = list(map(int, input().split()))
a = 0
for i in range(60):
t = sum((l[j] >> i) % 2 for j in range(n))
a += (t * (n - t) << i) % M
print((a % M))
| M = 10**9 + 7
n = int(eval(input()))
l = list(map(int, input().split()))
a = 0
for i in range(60):
t = sum(j >> i & 1 for j in l)
a += (t * (n - t) << i) % M
print((a % M))
| false | 0 | [
"- t = sum((l[j] >> i) % 2 for j in range(n))",
"+ t = sum(j >> i & 1 for j in l)"
] | false | 0.077823 | 0.040505 | 1.9213 | [
"s446225651",
"s919112199"
] |
u614181788 | p03044 | python | s495247342 | s672398656 | 953 | 712 | 64,428 | 50,800 | Accepted | Accepted | 25.29 | n = int(eval(input()))
uvw = [0]*(n-1)
for i in range(n-1):
uvw[i] = list(map(int,input().split()))
V = [[] for i in range(n+1)]
for u,v,w in uvw:
V[u].append([v,w])
V[v].append([u,w])
from collections import deque
q = deque([])
now = 1
reach = [0]*(n+1)
reach[now] = 2
q.append(now)
while q:
... | from collections import deque
n = int(eval(input()))
V = [[] for i in range(n+1)]
for i in range(n-1):
u,v,w = list(map(int,input().split()))
V[u].append([v,w])
V[v].append([u,w])
q = deque([])
dis = [-1]*(n+1)
q.append(1)
dis[1] = 0
while q:
x = q.popleft()
for y,z in V[x]:
if... | 25 | 22 | 540 | 474 | n = int(eval(input()))
uvw = [0] * (n - 1)
for i in range(n - 1):
uvw[i] = list(map(int, input().split()))
V = [[] for i in range(n + 1)]
for u, v, w in uvw:
V[u].append([v, w])
V[v].append([u, w])
from collections import deque
q = deque([])
now = 1
reach = [0] * (n + 1)
reach[now] = 2
q.append(now)
while ... | from collections import deque
n = int(eval(input()))
V = [[] for i in range(n + 1)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
V[u].append([v, w])
V[v].append([u, w])
q = deque([])
dis = [-1] * (n + 1)
q.append(1)
dis[1] = 0
while q:
x = q.popleft()
for y, z in V[x]:
i... | false | 12 | [
"+from collections import deque",
"+",
"-uvw = [0] * (n - 1)",
"+V = [[] for i in range(n + 1)]",
"- uvw[i] = list(map(int, input().split()))",
"-V = [[] for i in range(n + 1)]",
"-for u, v, w in uvw:",
"+ u, v, w = list(map(int, input().split()))",
"-from collections import deque",
"-",
"... | false | 0.087096 | 0.077439 | 1.124706 | [
"s495247342",
"s672398656"
] |
u347600233 | p02989 | python | s541839844 | s299207916 | 80 | 70 | 14,396 | 20,636 | Accepted | Accepted | 12.5 | n = int(eval(input()))
d = [int(i) for i in input().split()]
d.sort()
k = d[n // 2] - d[(n // 2) - 1]
print(k) | n = int(eval(input()))
d = sorted([int(i) for i in input().split()])
print((d[n//2] - d[n//2 - 1])) | 5 | 3 | 108 | 93 | n = int(eval(input()))
d = [int(i) for i in input().split()]
d.sort()
k = d[n // 2] - d[(n // 2) - 1]
print(k)
| n = int(eval(input()))
d = sorted([int(i) for i in input().split()])
print((d[n // 2] - d[n // 2 - 1]))
| false | 40 | [
"-d = [int(i) for i in input().split()]",
"-d.sort()",
"-k = d[n // 2] - d[(n // 2) - 1]",
"-print(k)",
"+d = sorted([int(i) for i in input().split()])",
"+print((d[n // 2] - d[n // 2 - 1]))"
] | false | 0.094232 | 0.043034 | 2.189697 | [
"s541839844",
"s299207916"
] |
u046187684 | p02983 | python | s037359504 | s708386651 | 1,566 | 374 | 3,188 | 3,188 | Accepted | Accepted | 76.12 | import math
from itertools import product
L, R = list(map(int, input().split()))
if R-L >= 2018:
print((0))
else:
ans = 2018
for i, j in product(list(range(L, R)), list(range(L+1, R+1))):
ans = min(ans, i * j % 2019)
print(ans)
| def solve(string):
l, r = list(map(int, string.split()))
if r - l >= 2019:
return "0"
return str(min({i * j % 2019 for i in range(l, r + 1) for j in range(i+1, r + 1)}))
if __name__ == '__main__':
print((solve(eval(input()))))
| 11 | 9 | 243 | 247 | import math
from itertools import product
L, R = list(map(int, input().split()))
if R - L >= 2018:
print((0))
else:
ans = 2018
for i, j in product(list(range(L, R)), list(range(L + 1, R + 1))):
ans = min(ans, i * j % 2019)
print(ans)
| def solve(string):
l, r = list(map(int, string.split()))
if r - l >= 2019:
return "0"
return str(
min({i * j % 2019 for i in range(l, r + 1) for j in range(i + 1, r + 1)})
)
if __name__ == "__main__":
print((solve(eval(input()))))
| false | 18.181818 | [
"-import math",
"-from itertools import product",
"+def solve(string):",
"+ l, r = list(map(int, string.split()))",
"+ if r - l >= 2019:",
"+ return \"0\"",
"+ return str(",
"+ min({i * j % 2019 for i in range(l, r + 1) for j in range(i + 1, r + 1)})",
"+ )",
"-L, R = lis... | false | 0.046159 | 0.098079 | 0.470636 | [
"s037359504",
"s708386651"
] |
u924671994 | p03101 | python | s340986979 | s166717781 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | H,W = list(map(int,input().split()))
h,w = list(map(int,input().split()))
print(((H-h)*(W-w))) | H,W=list(map(int,input().split()))
h,w=list(map(int,input().split()))
s=(H-h)*(W-w)
print(s) | 5 | 6 | 86 | 87 | H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
print(((H - h) * (W - w)))
| H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
s = (H - h) * (W - w)
print(s)
| false | 16.666667 | [
"-print(((H - h) * (W - w)))",
"+s = (H - h) * (W - w)",
"+print(s)"
] | false | 0.040254 | 0.041271 | 0.975346 | [
"s340986979",
"s166717781"
] |
u810356688 | p02548 | python | s164875088 | s336009273 | 77 | 68 | 64,816 | 62,768 | Accepted | Accepted | 11.69 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
ans = 0
for a in range(1,n):
if a ** 2 >= n:
break
for b in range(a,n):
if a * b >= n:
break
if a == b:
ans += 1
... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
ans = 0
for a in range(1,n):
ans += -(-n//a) - 1
print(ans)
if __name__=='__main__':
main() | 20 | 12 | 421 | 230 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
ans = 0
for a in range(1, n):
if a**2 >= n:
break
for b in range(a, n):
if a * b >= n:
break
if a == b:
ans += 1
... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
ans = 0
for a in range(1, n):
ans += -(-n // a) - 1
print(ans)
if __name__ == "__main__":
main()
| false | 40 | [
"- if a**2 >= n:",
"- break",
"- for b in range(a, n):",
"- if a * b >= n:",
"- break",
"- if a == b:",
"- ans += 1",
"- else:",
"- ans += 2",
"+ ans += -(-n // a) - 1"
] | false | 0.329315 | 0.130323 | 2.526921 | [
"s164875088",
"s336009273"
] |
u207707177 | p03575 | python | s231248119 | s296389575 | 36 | 32 | 3,064 | 3,064 | Accepted | Accepted | 11.11 |
N,M = [int(i) for i in input().split()]
Nodes = []
Mlist = []
count = 0
for i in range(N):
Mlist.append(1)
for i in range(M):
Nodes.append(list(map(int, input().split())))
def search(x):
Mlist2[x-1] = 0
answer = 1
for i in range(len(Nodes2)):
if x in Nodes2[i]:
... |
N,M = [int(i) for i in input().split()]
Nodes = []
Mlist = []
count = 0
for i in range(N):
Mlist.append(1)
for i in range(M):
Nodes.append(list(map(int, input().split())))
def search(x):
Mlist2[x-1] = 0
for i in range(len(Nodes2)):
if x in Nodes2[i]:
if Nodes2[i].in... | 47 | 50 | 1,078 | 1,110 | N, M = [int(i) for i in input().split()]
Nodes = []
Mlist = []
count = 0
for i in range(N):
Mlist.append(1)
for i in range(M):
Nodes.append(list(map(int, input().split())))
def search(x):
Mlist2[x - 1] = 0
answer = 1
for i in range(len(Nodes2)):
if x in Nodes2[i]:
if Nodes2[i].... | N, M = [int(i) for i in input().split()]
Nodes = []
Mlist = []
count = 0
for i in range(N):
Mlist.append(1)
for i in range(M):
Nodes.append(list(map(int, input().split())))
def search(x):
Mlist2[x - 1] = 0
for i in range(len(Nodes2)):
if x in Nodes2[i]:
if Nodes2[i].index(x) == 0:
... | false | 6 | [
"- answer = 1",
"- for i in range(len(Mlist2)):",
"- if Mlist2[i] == 0:",
"+ return Mlist2",
"+",
"+",
"+def cout(x):",
"+ answer = 1",
"+ for i in range(len(x)):",
"+ if x[i] == 0:",
"- ans = search(1)",
"+ ans = cout(search(1))"
] | false | 0.050594 | 0.049021 | 1.032096 | [
"s231248119",
"s296389575"
] |
u644907318 | p02837 | python | s845184236 | s404074930 | 266 | 245 | 46,428 | 44,656 | Accepted | Accepted | 7.89 | from itertools import product
def trueCheck(i,x):
for j in range(1,N+1):
if B[i][j]==1:
if x[j-1]==0:
return 1
elif B[i][j]==0:
if x[j-1]==1:
return 1
return 0
N = int(eval(input()))
A = [0]
B = {i:[-1 for _ in range(N+1)] for i... | from itertools import product
N = int(eval(input()))
G = {i:[] for i in range(1,N+1)}
for i in range(1,N+1):
K = int(eval(input()))
for j in range(K):
G[i].append(list(map(int,input().split())))
cmax = 0
for z in product((0,1),repeat=N):
flag = 0
for i in range(N):
if z[i]==1:... | 28 | 23 | 733 | 593 | from itertools import product
def trueCheck(i, x):
for j in range(1, N + 1):
if B[i][j] == 1:
if x[j - 1] == 0:
return 1
elif B[i][j] == 0:
if x[j - 1] == 1:
return 1
return 0
N = int(eval(input()))
A = [0]
B = {i: [-1 for _ in range(N ... | from itertools import product
N = int(eval(input()))
G = {i: [] for i in range(1, N + 1)}
for i in range(1, N + 1):
K = int(eval(input()))
for j in range(K):
G[i].append(list(map(int, input().split())))
cmax = 0
for z in product((0, 1), repeat=N):
flag = 0
for i in range(N):
if z[i] == ... | false | 17.857143 | [
"-",
"-def trueCheck(i, x):",
"- for j in range(1, N + 1):",
"- if B[i][j] == 1:",
"- if x[j - 1] == 0:",
"- return 1",
"- elif B[i][j] == 0:",
"- if x[j - 1] == 1:",
"- return 1",
"- return 0",
"-",
"-",
"-A = [0]",
"... | false | 0.047139 | 0.036801 | 1.28092 | [
"s845184236",
"s404074930"
] |
u394721319 | p02899 | python | s604314165 | s482911951 | 307 | 238 | 25,972 | 25,204 | Accepted | Accepted | 22.48 | N = int(input())
A = [[int(zz),i+1] for i,zz in enumerate(input().split())]
A.sort()
[print(i[1],end=' ') for i in A]
| N = int(input())
A = [int(i) for i in input().split()]
ans = []
for i in range(N):
ans.append([A[i],i+1])
ans.sort()
for i in range(N-1):
print(ans[i][1],end=' ')
print(ans[-1][1])
| 5 | 11 | 123 | 201 | N = int(input())
A = [[int(zz), i + 1] for i, zz in enumerate(input().split())]
A.sort()
[print(i[1], end=" ") for i in A]
| N = int(input())
A = [int(i) for i in input().split()]
ans = []
for i in range(N):
ans.append([A[i], i + 1])
ans.sort()
for i in range(N - 1):
print(ans[i][1], end=" ")
print(ans[-1][1])
| false | 54.545455 | [
"-A = [[int(zz), i + 1] for i, zz in enumerate(input().split())]",
"-A.sort()",
"-[print(i[1], end=\" \") for i in A]",
"+A = [int(i) for i in input().split()]",
"+ans = []",
"+for i in range(N):",
"+ ans.append([A[i], i + 1])",
"+ans.sort()",
"+for i in range(N - 1):",
"+ print(ans[i][1], e... | false | 0.038438 | 0.0393 | 0.978049 | [
"s604314165",
"s482911951"
] |
u222668979 | p03945 | python | s916824638 | s753519415 | 48 | 43 | 9,112 | 9,088 | Accepted | Accepted | 10.42 | s = eval(input())
cnt = 1
for i in range(1,len(s)):
if s[i] != s[i - 1]:
cnt += 1
print((cnt - 1))
| s = eval(input())
print((sum(s[i] != s[i - 1] for i in range(1, len(s)))))
| 7 | 3 | 110 | 70 | s = eval(input())
cnt = 1
for i in range(1, len(s)):
if s[i] != s[i - 1]:
cnt += 1
print((cnt - 1))
| s = eval(input())
print((sum(s[i] != s[i - 1] for i in range(1, len(s)))))
| false | 57.142857 | [
"-cnt = 1",
"-for i in range(1, len(s)):",
"- if s[i] != s[i - 1]:",
"- cnt += 1",
"-print((cnt - 1))",
"+print((sum(s[i] != s[i - 1] for i in range(1, len(s)))))"
] | false | 0.060892 | 0.057124 | 1.06597 | [
"s916824638",
"s753519415"
] |
u204883389 | p02419 | python | s639799166 | s850435307 | 30 | 20 | 7,488 | 7,368 | Accepted | Accepted | 33.33 | count = 0
word = "".join([x.lower() for x in input().split()])
while True:
line = input().split()
if "END_OF_TEXT" in line:
break
for s in line:
if word == "".join([x.lower() for x in s]):
count += 1
print(count) | W = eval(input())
count = 0
while True:
line = eval(input())
if line == 'END_OF_TEXT':
break
for s in line.lower().split():
if s == W:
count += 1
print(count) | 10 | 13 | 261 | 201 | count = 0
word = "".join([x.lower() for x in input().split()])
while True:
line = input().split()
if "END_OF_TEXT" in line:
break
for s in line:
if word == "".join([x.lower() for x in s]):
count += 1
print(count)
| W = eval(input())
count = 0
while True:
line = eval(input())
if line == "END_OF_TEXT":
break
for s in line.lower().split():
if s == W:
count += 1
print(count)
| false | 23.076923 | [
"+W = eval(input())",
"-word = \"\".join([x.lower() for x in input().split()])",
"- line = input().split()",
"- if \"END_OF_TEXT\" in line:",
"+ line = eval(input())",
"+ if line == \"END_OF_TEXT\":",
"- for s in line:",
"- if word == \"\".join([x.lower() for x in s]):",
"+ ... | false | 0.042222 | 0.046201 | 0.913876 | [
"s639799166",
"s850435307"
] |
u138859672 | p02784 | python | s590029223 | s679359835 | 54 | 38 | 9,944 | 10,420 | Accepted | Accepted | 29.63 | _input = input().split()
hp = int(_input[0])
n = int(_input[1])
_input_attack = input().split()
check = 0
for i in range(n):
check += int(_input_attack[i])
if hp <= check:
print('Yes')
else:
print('No') | HP, N = list(map(int, input().split()))
S = sum(map(int, input().split()))
if S >= HP:
print('Yes')
else:
print('No') | 15 | 8 | 228 | 124 | _input = input().split()
hp = int(_input[0])
n = int(_input[1])
_input_attack = input().split()
check = 0
for i in range(n):
check += int(_input_attack[i])
if hp <= check:
print("Yes")
else:
print("No")
| HP, N = list(map(int, input().split()))
S = sum(map(int, input().split()))
if S >= HP:
print("Yes")
else:
print("No")
| false | 46.666667 | [
"-_input = input().split()",
"-hp = int(_input[0])",
"-n = int(_input[1])",
"-_input_attack = input().split()",
"-check = 0",
"-for i in range(n):",
"- check += int(_input_attack[i])",
"-if hp <= check:",
"+HP, N = list(map(int, input().split()))",
"+S = sum(map(int, input().split()))",
"+if ... | false | 0.036915 | 0.041821 | 0.882697 | [
"s590029223",
"s679359835"
] |
u843175622 | p03464 | python | s474114819 | s431689787 | 102 | 93 | 14,224 | 19,992 | Accepted | Accepted | 8.82 | n = int(eval(input()))
a = list(map(int, input().split()))
min = 2
max = 2
for i in reversed(a):
max = max // i * i + i - 1
min = (min + i - 1) // i * i
if min >= max:
print("-1")
else:
print((min, max))
| n, *a = list(map(int, open(0).read().split()))
unko = 2
unti = 2
for i in reversed(a):
unko = unko // i * i + i - 1
unti = (unti + i - 1) // i * i
if unti >= unko:
print((-1))
else:
print((unti, unko))
| 13 | 11 | 226 | 219 | n = int(eval(input()))
a = list(map(int, input().split()))
min = 2
max = 2
for i in reversed(a):
max = max // i * i + i - 1
min = (min + i - 1) // i * i
if min >= max:
print("-1")
else:
print((min, max))
| n, *a = list(map(int, open(0).read().split()))
unko = 2
unti = 2
for i in reversed(a):
unko = unko // i * i + i - 1
unti = (unti + i - 1) // i * i
if unti >= unko:
print((-1))
else:
print((unti, unko))
| false | 15.384615 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-min = 2",
"-max = 2",
"+n, *a = list(map(int, open(0).read().split()))",
"+unko = 2",
"+unti = 2",
"- max = max // i * i + i - 1",
"- min = (min + i - 1) // i * i",
"-if min >= max:",
"- print(\"-1\")",
"+ unko = ... | false | 0.070731 | 0.084171 | 0.840328 | [
"s474114819",
"s431689787"
] |
u191874006 | p03059 | python | s107432108 | s992299966 | 924 | 163 | 21,916 | 38,256 | Accepted | Accepted | 82.36 | #!/usr/bin/env python3
#A
import numpy as np
import math
import re
n = eval(input())
n = re.split(" ",n)
x = int(int(n[2])/int(n[0]))
print((x*int(n[1]))) | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 12 | 21 | 160 | 587 | #!/usr/bin/env python3
# A
import numpy as np
import math
import re
n = eval(input())
n = re.split(" ", n)
x = int(int(n[2]) / int(n[0]))
print((x * int(n[1])))
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 42.857143 | [
"-# A",
"-import numpy as np",
"+import sys",
"-import re",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-n = eval(input())",
"-n = re.split(\" \", n)",
"-x = int(int(n[2]) / int(n[0]))",
"-print((x * int(n[1])))",
"+sys.setrecursionlimit(2147483647)",
"+... | false | 0.093768 | 0.083789 | 1.119087 | [
"s107432108",
"s992299966"
] |
u150984829 | p02275 | python | s634939388 | s290319711 | 840 | 740 | 156,280 | 156,284 | Accepted | Accepted | 11.9 | eval(input())
C=[0]*10001
for a in map(int,input().split()):C[a]+=1
B=[];i=0
for k in C:B+=[str(i)]*k;i+=1
print((' '.join(B)))
| def s():
eval(input())
C=[0]*10001
for a in map(int,input().split()):C[a]+=1
B=[];i=0
for k in C:B+=[str(i)]*k;i+=1
print((' '.join(B)))
if'__main__'==__name__:s()
| 6 | 8 | 125 | 169 | eval(input())
C = [0] * 10001
for a in map(int, input().split()):
C[a] += 1
B = []
i = 0
for k in C:
B += [str(i)] * k
i += 1
print((" ".join(B)))
| def s():
eval(input())
C = [0] * 10001
for a in map(int, input().split()):
C[a] += 1
B = []
i = 0
for k in C:
B += [str(i)] * k
i += 1
print((" ".join(B)))
if "__main__" == __name__:
s()
| false | 25 | [
"-eval(input())",
"-C = [0] * 10001",
"-for a in map(int, input().split()):",
"- C[a] += 1",
"-B = []",
"-i = 0",
"-for k in C:",
"- B += [str(i)] * k",
"- i += 1",
"-print((\" \".join(B)))",
"+def s():",
"+ eval(input())",
"+ C = [0] * 10001",
"+ for a in map(int, input(... | false | 0.042732 | 0.041826 | 1.021654 | [
"s634939388",
"s290319711"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.