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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u949315872 | p03636 | python | s720115628 | s057331967 | 31 | 24 | 9,080 | 8,952 | Accepted | Accepted | 22.58 | S = eval(input())
#-------------
print((S[0]+str(len(S)-2)+S[-1])) | S = eval(input())
#-------------
S = list(S)
n = len(S)
print((S[0] + str(n-2) + S[n-1])) | 3 | 5 | 60 | 85 | S = eval(input())
# -------------
print((S[0] + str(len(S) - 2) + S[-1]))
| S = eval(input())
# -------------
S = list(S)
n = len(S)
print((S[0] + str(n - 2) + S[n - 1]))
| false | 40 | [
"-print((S[0] + str(len(S) - 2) + S[-1]))",
"+S = list(S)",
"+n = len(S)",
"+print((S[0] + str(n - 2) + S[n - 1]))"
] | false | 0.052835 | 0.042073 | 1.255793 | [
"s720115628",
"s057331967"
] |
u423585790 | p03305 | python | s054491337 | s108746917 | 1,561 | 1,061 | 122,200 | 131,976 | Accepted | Accepted | 32.03 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(... | from heapq import*
def dijkstra(s,e):
g=10**6;d=[10**18]*n;f=[1]*n;d[s]=f[s]=0;q=[]
for a,b in e[s]:heappush(q,a*g+b)
while q:
m=heappop(q)
if f[m%g]<1:continue
v=m%g
x=d[v]=m//g
f[v]=0
for y,w in e[v]:
if f[w]:heappush(q,(x+y)*g+w)
return d
(n,m,s,t),*z=[list(map(int,... | 75 | 28 | 2,131 | 598 | #!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI():
return list(map(int, input().split()))
def LF... | from heapq import *
def dijkstra(s, e):
g = 10**6
d = [10**18] * n
f = [1] * n
d[s] = f[s] = 0
q = []
for a, b in e[s]:
heappush(q, a * g + b)
while q:
m = heappop(q)
if f[m % g] < 1:
continue
v = m % g
x = d[v] = m // g
f[v] = 0
... | false | 62.666667 | [
"-#!/usr/bin/env python3",
"-from collections import defaultdict, deque",
"-from heapq import heappush, heappop",
"-from bisect import bisect_left, bisect_right",
"-import sys, random, itertools, math",
"-",
"-sys.setrecursionlimit(10**5)",
"-input = sys.stdin.readline",
"-sqrt = math.sqrt",
"+fro... | false | 0.201267 | 0.04179 | 4.816184 | [
"s054491337",
"s108746917"
] |
u992910889 | p04034 | python | s753191274 | s259460188 | 315 | 279 | 42,740 | 45,916 | Accepted | Accepted | 11.43 | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
N, M = list(map(int, input().split()))
quantity = [1] * N
red = [True] + [False] * (N - 1)
for i in range(M):
x, y = list(map(int, input().split()))
quantit... | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
N,M=list(map(int,input().split()))
X, Y = [0] * M, [0] * M
for i in range(M):
X[i], Y[i] = list(map(int, input().split()))
red=[True]+[False]*(N-1)
cnt=[1]*N
f... | 26 | 26 | 525 | 534 | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
N, M = list(map(int, input().split()))
quantity = [1] * N
red = [True] + [False] * (N - 1)
for i in range(M):
x, y = list(map(int, input().split()))
quantity[x - 1] -= 1
... | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
N, M = list(map(int, input().split()))
X, Y = [0] * M, [0] * M
for i in range(M):
X[i], Y[i] = list(map(int, input().split()))
red = [True] + [False] * (N - 1)
cnt = [1] * N
... | false | 0 | [
"- quantity = [1] * N",
"+ X, Y = [0] * M, [0] * M",
"+ for i in range(M):",
"+ X[i], Y[i] = list(map(int, input().split()))",
"+ cnt = [1] * N",
"- x, y = list(map(int, input().split()))",
"- quantity[x - 1] -= 1",
"- quantity[y - 1] += 1",
"- if red[x... | false | 0.034683 | 0.044119 | 0.786127 | [
"s753191274",
"s259460188"
] |
u887207211 | p03212 | python | s808036754 | s401916479 | 67 | 40 | 3,060 | 3,060 | Accepted | Accepted | 40.3 | from itertools import product
def ans():
N = int(eval(input()))
cnt = 0
for i in range(3, 11):
for p in product(["3", "5", "7"], repeat = i):
if("3" in p and "5" in p and "7" in p):
p = int("".join(p))
if(p <= N):
cnt += 1
print(cnt)
ans() | from itertools import product
N = int(eval(input()))
cnt = 0
for i in range(3,len(str(N))+1):
for p in product(["3", "5", "7"], repeat = i):
if("3" in p and "5" in p and "7" in p):
if(int("".join(p)) <= N):
cnt += 1
print(cnt) | 13 | 10 | 290 | 250 | from itertools import product
def ans():
N = int(eval(input()))
cnt = 0
for i in range(3, 11):
for p in product(["3", "5", "7"], repeat=i):
if "3" in p and "5" in p and "7" in p:
p = int("".join(p))
if p <= N:
cnt += 1
print(cnt)
... | from itertools import product
N = int(eval(input()))
cnt = 0
for i in range(3, len(str(N)) + 1):
for p in product(["3", "5", "7"], repeat=i):
if "3" in p and "5" in p and "7" in p:
if int("".join(p)) <= N:
cnt += 1
print(cnt)
| false | 23.076923 | [
"-",
"-def ans():",
"- N = int(eval(input()))",
"- cnt = 0",
"- for i in range(3, 11):",
"- for p in product([\"3\", \"5\", \"7\"], repeat=i):",
"- if \"3\" in p and \"5\" in p and \"7\" in p:",
"- p = int(\"\".join(p))",
"- if p <= N:",
"- ... | false | 0.295091 | 0.094483 | 3.123228 | [
"s808036754",
"s401916479"
] |
u102242691 | p03610 | python | s094856835 | s612665267 | 36 | 28 | 3,188 | 4,268 | Accepted | Accepted | 22.22 |
s = eval(input())
n = len(s)
ans = ""
for i in range(n):
if i % 2 == 0:
ans += s[i]
print(ans)
|
s = list(eval(input()))
t = []
for i in range(0,len(s),2):
t.append(s[i])
print(("".join(t))) | 11 | 8 | 123 | 99 | s = eval(input())
n = len(s)
ans = ""
for i in range(n):
if i % 2 == 0:
ans += s[i]
print(ans)
| s = list(eval(input()))
t = []
for i in range(0, len(s), 2):
t.append(s[i])
print(("".join(t)))
| false | 27.272727 | [
"-s = eval(input())",
"-n = len(s)",
"-ans = \"\"",
"-for i in range(n):",
"- if i % 2 == 0:",
"- ans += s[i]",
"-print(ans)",
"+s = list(eval(input()))",
"+t = []",
"+for i in range(0, len(s), 2):",
"+ t.append(s[i])",
"+print((\"\".join(t)))"
] | false | 0.038923 | 0.042282 | 0.920549 | [
"s094856835",
"s612665267"
] |
u752233836 | p02573 | python | s439794487 | s263152469 | 672 | 505 | 109,688 | 109,444 | Accepted | Accepted | 24.85 | n, m = list(map(int, input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.parent = [int(x) for x in range(n)]
self.tree_size = [1 for _ in range(n)]
def unite(self, x, y):
x_root = self.find(x)
y_root = self.find(y)
if self.... | n, m = list(map(int, input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.parent = [int(x) for x in range(n)]
self.tree_size = [1 for _ in range(n)]
def unite(self, x, y):
x_root = self.find(x)
y_root = self.find(y)
if self.... | 46 | 48 | 1,153 | 1,235 | n, m = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [int(x) for x in range(n)]
self.tree_size = [1 for _ in range(n)]
def unite(self, x, y):
x_root = self.find(x)
y_root = self.find(y)
if self.same(x_root, y_r... | n, m = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [int(x) for x in range(n)]
self.tree_size = [1 for _ in range(n)]
def unite(self, x, y):
x_root = self.find(x)
y_root = self.find(y)
if self.same(x_root, y_r... | false | 4.166667 | [
"- return self.find(self.parent[x])",
"+ next = self.find(self.parent[x])",
"+ self.parent[x] = next",
"+ return next",
"- if x == y:",
"+ if self.find(x) == self.find(y):"
] | false | 0.03927 | 0.038709 | 1.014496 | [
"s439794487",
"s263152469"
] |
u774539708 | p03111 | python | s983223584 | s682430462 | 400 | 312 | 51,804 | 47,120 | Accepted | Accepted | 22 | import sys
input=sys.stdin.readline
n,a,b,c=list(map(int,input().split()))
L=[]
A=[a,b,c]
for i in range(n):
L.append(int(eval(input())))
L.sort()
Ans=10**9
for i in range(4**n):
F=[[] for i in range(3)] #竹格納:[A,B,C]
now=i
for j in range(n):
r=now%(4**(j+1))
chk=r//(4**... | import sys
input=sys.stdin.readline
n,a,b,c=list(map(int,input().split()))
L=[]
A=[a,b,c]
for i in range(n):
L.append(int(eval(input())))
L.sort()
ans=10**9
for i in range(4**n):
F=[[] for i in range(3)] #竹格納:[A,B,C]
now=i
for j in range(n):
r=now%(4**(j+1))
chk=r//(4**... | 37 | 27 | 880 | 583 | import sys
input = sys.stdin.readline
n, a, b, c = list(map(int, input().split()))
L = []
A = [a, b, c]
for i in range(n):
L.append(int(eval(input())))
L.sort()
Ans = 10**9
for i in range(4**n):
F = [[] for i in range(3)] # 竹格納:[A,B,C]
now = i
for j in range(n):
r = now % (4 ** (j + 1))
... | import sys
input = sys.stdin.readline
n, a, b, c = list(map(int, input().split()))
L = []
A = [a, b, c]
for i in range(n):
L.append(int(eval(input())))
L.sort()
ans = 10**9
for i in range(4**n):
F = [[] for i in range(3)] # 竹格納:[A,B,C]
now = i
for j in range(n):
r = now % (4 ** (j + 1))
... | false | 27.027027 | [
"-Ans = 10**9",
"+ans = 10**9",
"- ans = 0",
"+ mp = 0",
"- f = F[k] # 竹一覧",
"- Len = len(f)",
"- mp = 10**9",
"- for l in range(1, 2**Len):",
"- t = 0",
"- cnt = 0",
"- for q in range(Len):",... | false | 0.978711 | 0.47318 | 2.068368 | [
"s983223584",
"s682430462"
] |
u962985517 | p04030 | python | s992131144 | s910067779 | 31 | 27 | 9,112 | 9,036 | Accepted | Accepted | 12.9 | li = list(eval(input()))
ans = []
for i in range(len(li)):
if (li[i] == '0') or (li[i] == '1'):
ans.append(li[i])
elif len(ans) > 0:
ans.pop()
else:
pass
print((''.join(ans))) | s =eval(input())
ans = []
for i in range(len(s)):
if (s[i] == '0') or (s[i] == '1'):
ans.append(s[i])
elif ans ==[]:
continue
else:
ans.pop()
print((''.join(ans))) | 11 | 11 | 214 | 202 | li = list(eval(input()))
ans = []
for i in range(len(li)):
if (li[i] == "0") or (li[i] == "1"):
ans.append(li[i])
elif len(ans) > 0:
ans.pop()
else:
pass
print(("".join(ans)))
| s = eval(input())
ans = []
for i in range(len(s)):
if (s[i] == "0") or (s[i] == "1"):
ans.append(s[i])
elif ans == []:
continue
else:
ans.pop()
print(("".join(ans)))
| false | 0 | [
"-li = list(eval(input()))",
"+s = eval(input())",
"-for i in range(len(li)):",
"- if (li[i] == \"0\") or (li[i] == \"1\"):",
"- ans.append(li[i])",
"- elif len(ans) > 0:",
"+for i in range(len(s)):",
"+ if (s[i] == \"0\") or (s[i] == \"1\"):",
"+ ans.append(s[i])",
"+ el... | false | 0.045869 | 0.044122 | 1.039591 | [
"s992131144",
"s910067779"
] |
u826929627 | p03164 | python | s998271925 | s611005541 | 375 | 217 | 21,648 | 14,904 | Accepted | Accepted | 42.13 | N,W = list(map(int, input().split()))
import numpy as np
dp = np.full(N*1000+1, W+1, dtype=int)
dp[0] = 0
for _ in range(N):
w,v = list(map(int, input().split()))
dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print((np.max(np.where(dp<=W)))) | import numpy as np
N,W = list(map(int, input().split()))
dp = np.full(N*1000+1, W+1, dtype=int)
dp[0] = 0
for _ in range(N):
w,v = list(map(int, input().split()))
dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print((np.max(np.where(dp<=W)))) | 12 | 11 | 239 | 239 | N, W = list(map(int, input().split()))
import numpy as np
dp = np.full(N * 1000 + 1, W + 1, dtype=int)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
print((np.max(np.where(dp <= W))))
| import numpy as np
N, W = list(map(int, input().split()))
dp = np.full(N * 1000 + 1, W + 1, dtype=int)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
print((np.max(np.where(dp <= W))))
| false | 8.333333 | [
"-N, W = list(map(int, input().split()))",
"+N, W = list(map(int, input().split()))"
] | false | 0.253338 | 0.221609 | 1.143177 | [
"s998271925",
"s611005541"
] |
u056599756 | p03834 | python | s085158482 | s930620634 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b,c=input().split(",")
print((a,b,c)) | s=eval(input())
ss=s.replace(",", " ")
print(ss) | 2 | 3 | 38 | 44 | a, b, c = input().split(",")
print((a, b, c))
| s = eval(input())
ss = s.replace(",", " ")
print(ss)
| false | 33.333333 | [
"-a, b, c = input().split(\",\")",
"-print((a, b, c))",
"+s = eval(input())",
"+ss = s.replace(\",\", \" \")",
"+print(ss)"
] | false | 0.066578 | 0.067007 | 0.993599 | [
"s085158482",
"s930620634"
] |
u131464432 | p03456 | python | s281317500 | s272275564 | 30 | 27 | 9,128 | 9,048 | Accepted | Accepted | 10 | a,b = input().split()
c = a+b
c = int(c)
for i in range (1000):
if i**2 == c:
print("Yes")
exit()
print("No") | a,b = input().split()
c = a+b
c = int(c)
import math
if int(math.sqrt(c)) ** 2 == c:
print("Yes")
else:
print("No") | 8 | 8 | 126 | 126 | a, b = input().split()
c = a + b
c = int(c)
for i in range(1000):
if i**2 == c:
print("Yes")
exit()
print("No")
| a, b = input().split()
c = a + b
c = int(c)
import math
if int(math.sqrt(c)) ** 2 == c:
print("Yes")
else:
print("No")
| false | 0 | [
"-for i in range(1000):",
"- if i**2 == c:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+import math",
"+",
"+if int(math.sqrt(c)) ** 2 == c:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.00781 | 0.039337 | 0.198531 | [
"s281317500",
"s272275564"
] |
u621935300 | p02930 | python | s379233838 | s611483812 | 109 | 86 | 41,372 | 37,532 | Accepted | Accepted | 21.1 | N=eval(input())
E=[ [ "" for j in range(N+1) ] for i in range(N+1) ]
for K in range(10):
if N<=2**K:
break
for i in range(1,N+1):
for j in range(i+1,N+1):
for k in range(K):
if (i>>k)&1!=(j>>k)&1:
E[i][j]=k+1
break
for i in range(1,N):
s=""
for j in range(i+1,N+1):
s+=s... | N=eval(input())
E=[ [ "" for j in range(N+1) ] for i in range(N+1) ]
for K in range(10):
if N<=2**K:
break
for i in range(1,N+1):
for j in range(i+1,N+1):
for k in range(K):
if (i>>k)&1!=(j>>k)&1:
E[i][j]=str(k+1)
break
for i in range(1,N):
print(" ".join(E[i][i+1:])) | 20 | 17 | 339 | 307 | N = eval(input())
E = [["" for j in range(N + 1)] for i in range(N + 1)]
for K in range(10):
if N <= 2**K:
break
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
for k in range(K):
if (i >> k) & 1 != (j >> k) & 1:
E[i][j] = k + 1
break
for i in ... | N = eval(input())
E = [["" for j in range(N + 1)] for i in range(N + 1)]
for K in range(10):
if N <= 2**K:
break
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
for k in range(K):
if (i >> k) & 1 != (j >> k) & 1:
E[i][j] = str(k + 1)
break
for ... | false | 15 | [
"- E[i][j] = k + 1",
"+ E[i][j] = str(k + 1)",
"- s = \"\"",
"- for j in range(i + 1, N + 1):",
"- s += str(E[i][j]) + \" \"",
"- print(s)",
"+ print(\" \".join(E[i][i + 1 :]))"
] | false | 0.057608 | 0.052715 | 1.092837 | [
"s379233838",
"s611483812"
] |
u088553842 | p03573 | python | s812429948 | s757883388 | 31 | 27 | 9,308 | 8,972 | Accepted | Accepted | 12.9 | from collections import Counter
print((Counter(input().split()).most_common()[-1][0])) | l=input().split();print((min(l,key=lambda x:l.count(x)))) | 2 | 1 | 85 | 55 | from collections import Counter
print((Counter(input().split()).most_common()[-1][0]))
| l = input().split()
print((min(l, key=lambda x: l.count(x))))
| false | 50 | [
"-from collections import Counter",
"-",
"-print((Counter(input().split()).most_common()[-1][0]))",
"+l = input().split()",
"+print((min(l, key=lambda x: l.count(x))))"
] | false | 0.034835 | 0.034719 | 1.003346 | [
"s812429948",
"s757883388"
] |
u049182844 | p03328 | python | s113162778 | s850860450 | 31 | 25 | 9,100 | 9,004 | Accepted | Accepted | 19.35 | def main():
a, b = list(map(int, input().split()))
distance = b - a
high_a = sum(list(range(1, distance)))
print((high_a - a))
if __name__ == '__main__':
main()
| def main():
a, b = list(map(int, input().split()))
print((sum(list(range(1, b - a))) - a))
if __name__ == '__main__':
main()
| 9 | 7 | 183 | 137 | def main():
a, b = list(map(int, input().split()))
distance = b - a
high_a = sum(list(range(1, distance)))
print((high_a - a))
if __name__ == "__main__":
main()
| def main():
a, b = list(map(int, input().split()))
print((sum(list(range(1, b - a))) - a))
if __name__ == "__main__":
main()
| false | 22.222222 | [
"- distance = b - a",
"- high_a = sum(list(range(1, distance)))",
"- print((high_a - a))",
"+ print((sum(list(range(1, b - a))) - a))"
] | false | 0.042487 | 0.043268 | 0.981944 | [
"s113162778",
"s850860450"
] |
u622045059 | p02735 | python | s058524035 | s345542853 | 73 | 59 | 5,288 | 5,420 | Accepted | Accepted | 19.18 | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大... | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大... | 78 | 64 | 2,566 | 2,354 | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最... | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最... | false | 17.948718 | [
"-d = [[INF for _ in range(W)] for _ in range(H)]",
"-d[0][0] = 0",
"+dp = [[INF for _ in range(W)] for _ in range(H)]",
"+dp[0][0] = 0",
"- d[0][0] = 1",
"-xd = [1, 0]",
"-yd = [0, 1]",
"-que = deque([(0, 0)])",
"-cnt = 0",
"-while len(que) > 0:",
"- cnt += 1",
"- point = que.popleft... | false | 0.044823 | 0.081651 | 0.548957 | [
"s058524035",
"s345542853"
] |
u796942881 | p03610 | python | s334388998 | s443082833 | 81 | 18 | 4,596 | 3,188 | Accepted | Accepted | 77.78 | s = input()
for i in range(len(s)):
if i % 2 == 0:
print(s[i], end='')
print()
| s = eval(input())
print((s[::2])) | 7 | 2 | 99 | 26 | s = input()
for i in range(len(s)):
if i % 2 == 0:
print(s[i], end="")
print()
| s = eval(input())
print((s[::2]))
| false | 71.428571 | [
"-s = input()",
"-for i in range(len(s)):",
"- if i % 2 == 0:",
"- print(s[i], end=\"\")",
"-print()",
"+s = eval(input())",
"+print((s[::2]))"
] | false | 0.04026 | 0.040746 | 0.988069 | [
"s334388998",
"s443082833"
] |
u285443936 | p02936 | python | s339544936 | s532269132 | 1,798 | 1,284 | 58,880 | 58,836 | Accepted | Accepted | 28.59 | from collections import deque
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N-1):
a,b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for i in range(Q):
p,x = list(map(int, in... | from collections import deque
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N-1):
a,b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for ... | 30 | 32 | 561 | 601 | from collections import deque
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0] * N
point = [-1] * N
point[0] = 0
for i in range(Q):
p, x = list(map(i... | from collections import deque
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0] * N
point = [-1] * N
point[0] = 0
fo... | false | 6.25 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.144975 | 0.082294 | 1.761675 | [
"s339544936",
"s532269132"
] |
u973840923 | p03262 | python | s126033633 | s015687754 | 114 | 79 | 14,252 | 14,252 | Accepted | Accepted | 30.7 | N,X = list(map(int,input().split()))
list = list(map(int,input().split()))
diff = [abs(x - X) for x in list]
diff.sort()
def gcd(a,b):
while b:
a,b = b,a%b
return a
#差の最大公約数を取得
gcd_val = diff[0]
for i in diff[1:]:
gcd_val = gcd(i,gcd_val)
print(gcd_val)
| N,X = list(map(int,input().split()))
list = list(map(int,input().split()))
diff = [abs(x-X) for x in list]
def gcd(a,b):
while b:
a,b = b,a%b
return a
if len(diff) >= 2:
gcd_val = diff[0]
for i in diff[1:]:
gcd_val = gcd(gcd_val,i)
print(gcd_val)
else:
print((dif... | 16 | 16 | 286 | 318 | N, X = list(map(int, input().split()))
list = list(map(int, input().split()))
diff = [abs(x - X) for x in list]
diff.sort()
def gcd(a, b):
while b:
a, b = b, a % b
return a
# 差の最大公約数を取得
gcd_val = diff[0]
for i in diff[1:]:
gcd_val = gcd(i, gcd_val)
print(gcd_val)
| N, X = list(map(int, input().split()))
list = list(map(int, input().split()))
diff = [abs(x - X) for x in list]
def gcd(a, b):
while b:
a, b = b, a % b
return a
if len(diff) >= 2:
gcd_val = diff[0]
for i in diff[1:]:
gcd_val = gcd(gcd_val, i)
print(gcd_val)
else:
print((diff[... | false | 0 | [
"-diff.sort()",
"-# 差の最大公約数を取得",
"-gcd_val = diff[0]",
"-for i in diff[1:]:",
"- gcd_val = gcd(i, gcd_val)",
"-print(gcd_val)",
"+if len(diff) >= 2:",
"+ gcd_val = diff[0]",
"+ for i in diff[1:]:",
"+ gcd_val = gcd(gcd_val, i)",
"+ print(gcd_val)",
"+else:",
"+ print((d... | false | 0.112264 | 0.040526 | 2.770192 | [
"s126033633",
"s015687754"
] |
u905895868 | p03264 | python | s022070854 | s188718206 | 28 | 20 | 9,064 | 9,024 | Accepted | Accepted | 28.57 | num = int(eval(input()))
even_count = num // 2
if num % 2 == 0:
odd_count = even_count
else:
odd_count = even_count + 1
print((odd_count * even_count))
| k = int(eval(input()))
if k % 2 == 0:
print(((k // 2) ** 2))
else:
print(((k // 2 + 1) * (k // 2)))
| 10 | 6 | 164 | 104 | num = int(eval(input()))
even_count = num // 2
if num % 2 == 0:
odd_count = even_count
else:
odd_count = even_count + 1
print((odd_count * even_count))
| k = int(eval(input()))
if k % 2 == 0:
print(((k // 2) ** 2))
else:
print(((k // 2 + 1) * (k // 2)))
| false | 40 | [
"-num = int(eval(input()))",
"-even_count = num // 2",
"-if num % 2 == 0:",
"- odd_count = even_count",
"+k = int(eval(input()))",
"+if k % 2 == 0:",
"+ print(((k // 2) ** 2))",
"- odd_count = even_count + 1",
"-print((odd_count * even_count))",
"+ print(((k // 2 + 1) * (k // 2)))"
] | false | 0.050737 | 0.053232 | 0.95313 | [
"s022070854",
"s188718206"
] |
u905582793 | p03972 | python | s092155175 | s353122750 | 862 | 338 | 64,088 | 49,756 | Accepted | Accepted | 60.79 | w,h = list(map(int,input().split()))
a = [10**18]+[int(eval(input())) for i in range(w)]
b = [10**18]+[int(eval(input())) for i in range(h)]
a.sort(reverse=True)
b.sort(reverse=True)
ans = 0
while len(a)>1 or len(b)>1:
if a[-1]<b[-1]:
ans += a[-1]*len(b)
a.pop()
else:
ans += b[-1]*len(a)
... | import sys
input = sys.stdin.readline
w,h = list(map(int,input().split()))
a = [10**18]+[int(eval(input())) for i in range(w)]
b = [10**18]+[int(eval(input())) for i in range(h)]
a.sort(reverse=True)
b.sort(reverse=True)
ans = 0
while len(a)>1 or len(b)>1:
if a[-1]<b[-1]:
ans += a[-1]*len(b)
a.pop(... | 14 | 16 | 322 | 362 | w, h = list(map(int, input().split()))
a = [10**18] + [int(eval(input())) for i in range(w)]
b = [10**18] + [int(eval(input())) for i in range(h)]
a.sort(reverse=True)
b.sort(reverse=True)
ans = 0
while len(a) > 1 or len(b) > 1:
if a[-1] < b[-1]:
ans += a[-1] * len(b)
a.pop()
else:
ans +... | import sys
input = sys.stdin.readline
w, h = list(map(int, input().split()))
a = [10**18] + [int(eval(input())) for i in range(w)]
b = [10**18] + [int(eval(input())) for i in range(h)]
a.sort(reverse=True)
b.sort(reverse=True)
ans = 0
while len(a) > 1 or len(b) > 1:
if a[-1] < b[-1]:
ans += a[-1] * len(b)
... | false | 12.5 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.036516 | 0.037008 | 0.986703 | [
"s092155175",
"s353122750"
] |
u692632484 | p03363 | python | s873625466 | s358921673 | 250 | 211 | 26,716 | 37,260 | Accepted | Accepted | 15.6 | N=int(eval(input()))
A=[int(i) for i in input().split()]
S=[0]
for num in A:
S.append(S[-1]+num)
S.sort()
def combination(n):
if n<2:
return 0
else:
return int(n*(n-1)/2)
ans=0
cnt=1
for i in range(N):
if S[i]==S[i+1]:
cnt+=1
else:
ans+=combin... | N=int(eval(input()))
A=[int(i) for i in input().split()]
mp = {0:1}
for i in range(N-1):
A[i+1]+=A[i]
for a in A:
if a in mp:
mp[a]+=1
else:
mp[a]=1
res = 0
for v in list(mp.values()):
res += v*(v-1)//2
print(res)
| 23 | 15 | 375 | 249 | N = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0]
for num in A:
S.append(S[-1] + num)
S.sort()
def combination(n):
if n < 2:
return 0
else:
return int(n * (n - 1) / 2)
ans = 0
cnt = 1
for i in range(N):
if S[i] == S[i + 1]:
cnt += 1
else:
ans +=... | N = int(eval(input()))
A = [int(i) for i in input().split()]
mp = {0: 1}
for i in range(N - 1):
A[i + 1] += A[i]
for a in A:
if a in mp:
mp[a] += 1
else:
mp[a] = 1
res = 0
for v in list(mp.values()):
res += v * (v - 1) // 2
print(res)
| false | 34.782609 | [
"-S = [0]",
"-for num in A:",
"- S.append(S[-1] + num)",
"-S.sort()",
"-",
"-",
"-def combination(n):",
"- if n < 2:",
"- return 0",
"+mp = {0: 1}",
"+for i in range(N - 1):",
"+ A[i + 1] += A[i]",
"+for a in A:",
"+ if a in mp:",
"+ mp[a] += 1",
"- ret... | false | 0.039463 | 0.034923 | 1.129986 | [
"s873625466",
"s358921673"
] |
u489959379 | p02972 | python | s152389458 | s999303933 | 1,832 | 293 | 19,336 | 17,700 | Accepted | Accepted | 84.01 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (n + 1)
res = []
for i in reversed(list(range(1, n + 1))):
if B[i] % 2 != A[i]:
res.append... | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (n + 1)
res = []
for i in reversed(list(range(1, n + 1))):
if B[i] % 2 != A[i]:
res.append... | 29 | 46 | 626 | 1,014 | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (n + 1)
res = []
for i in reversed(list(range(1, n + 1))):
if B[i] % 2 != A[i]:
res.append(i)
for ... | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (n + 1)
res = []
for i in reversed(list(range(1, n + 1))):
if B[i] % 2 != A[i]:
res.append(i)
for ... | false | 36.956522 | [
"+def resolve2():",
"+ n = int(eval(input()))",
"+ A = [0] + list(map(int, input().split()))",
"+ B = [0] * (n + 1)",
"+ for i in reversed(list(range(1, n + 1))):",
"+ cnt = 0",
"+ for j in range(i, n + 1, i):",
"+ cnt += B[j]",
"+ if cnt % 2 != A[i]:",
... | false | 0.074086 | 0.036045 | 2.055353 | [
"s152389458",
"s999303933"
] |
u323680411 | p03472 | python | s054316396 | s904412294 | 933 | 845 | 72,408 | 19,272 | Accepted | Accepted | 9.43 | from collections import namedtuple
sword = namedtuple('sw', ('wield', 'throw'))
def main() -> None:
n, h = list(map(int, input().split()))
cnt = 0
swords = []
for i in range(n):
a, b = list(map(int, input().split()))
swords.append(sword(wield=a, throw=b))
swords.so... | import sys
from collections import namedtuple
def next_str() -> str:
result = ""
while True:
tmp = sys.stdin.read(1)
if tmp.strip() != "":
result += tmp
elif tmp != '\r':
break
return result
def next_int() -> int:
return int(next_str())... | 35 | 46 | 858 | 1,077 | from collections import namedtuple
sword = namedtuple("sw", ("wield", "throw"))
def main() -> None:
n, h = list(map(int, input().split()))
cnt = 0
swords = []
for i in range(n):
a, b = list(map(int, input().split()))
swords.append(sword(wield=a, throw=b))
swords.sort(key=lambda x:... | import sys
from collections import namedtuple
def next_str() -> str:
result = ""
while True:
tmp = sys.stdin.read(1)
if tmp.strip() != "":
result += tmp
elif tmp != "\r":
break
return result
def next_int() -> int:
return int(next_str())
def main() ->... | false | 23.913043 | [
"+import sys",
"-sword = namedtuple(\"sw\", (\"wield\", \"throw\"))",
"+",
"+def next_str() -> str:",
"+ result = \"\"",
"+ while True:",
"+ tmp = sys.stdin.read(1)",
"+ if tmp.strip() != \"\":",
"+ result += tmp",
"+ elif tmp != \"\\r\":",
"+ bre... | false | 0.045864 | 0.04924 | 0.93144 | [
"s054316396",
"s904412294"
] |
u888092736 | p04034 | python | s046029578 | s640671142 | 338 | 178 | 50,404 | 41,712 | Accepted | Accepted | 47.34 | (N, M), *AB = [list(map(int, s.split())) for s in open(0)]
cnt = [1] * N
possibly_red = [False] * N
possibly_red[0] = True
for a, b in AB:
a -= 1
b -= 1
cnt[a] -= 1
cnt[b] += 1
if possibly_red[a]:
possibly_red[b] = True
if cnt[a] == 0:
possibly_red[a] = False
... | N, M, *xy = list(map(int, open(0).read().split()))
boxes = [{"count": 1, "red": False} for _ in range(N)]
boxes[0]["red"] = True
for x, y in zip(*[iter(xy)] * 2):
x -= 1
y -= 1
if boxes[x]["red"]:
boxes[y]["red"] = True
if boxes[x]["count"] == 1:
boxes[x]["red"] = Fals... | 14 | 14 | 340 | 409 | (N, M), *AB = [list(map(int, s.split())) for s in open(0)]
cnt = [1] * N
possibly_red = [False] * N
possibly_red[0] = True
for a, b in AB:
a -= 1
b -= 1
cnt[a] -= 1
cnt[b] += 1
if possibly_red[a]:
possibly_red[b] = True
if cnt[a] == 0:
possibly_red[a] = False
print((sum(p... | N, M, *xy = list(map(int, open(0).read().split()))
boxes = [{"count": 1, "red": False} for _ in range(N)]
boxes[0]["red"] = True
for x, y in zip(*[iter(xy)] * 2):
x -= 1
y -= 1
if boxes[x]["red"]:
boxes[y]["red"] = True
if boxes[x]["count"] == 1:
boxes[x]["red"] = False
boxes... | false | 0 | [
"-(N, M), *AB = [list(map(int, s.split())) for s in open(0)]",
"-cnt = [1] * N",
"-possibly_red = [False] * N",
"-possibly_red[0] = True",
"-for a, b in AB:",
"- a -= 1",
"- b -= 1",
"- cnt[a] -= 1",
"- cnt[b] += 1",
"- if possibly_red[a]:",
"- possibly_red[b] = True",
"-... | false | 0.040194 | 0.03863 | 1.040477 | [
"s046029578",
"s640671142"
] |
u413165887 | p03345 | python | s303818532 | s179144917 | 167 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.82 | a, b, c, k = list(map(int, input().split()))
if k%2==0:
if b-a < 10**18:
print((a-b))
else:
print("Unfair")
else:
if a-b < 10**18:
print((b-a))
else:
print("Unfair") | a,b,_c,k=list(map(int,input().split()))
if k%2==0:print((a-b))
else:print((b-a)) | 11 | 3 | 213 | 72 | a, b, c, k = list(map(int, input().split()))
if k % 2 == 0:
if b - a < 10**18:
print((a - b))
else:
print("Unfair")
else:
if a - b < 10**18:
print((b - a))
else:
print("Unfair")
| a, b, _c, k = list(map(int, input().split()))
if k % 2 == 0:
print((a - b))
else:
print((b - a))
| false | 72.727273 | [
"-a, b, c, k = list(map(int, input().split()))",
"+a, b, _c, k = list(map(int, input().split()))",
"- if b - a < 10**18:",
"- print((a - b))",
"- else:",
"- print(\"Unfair\")",
"+ print((a - b))",
"- if a - b < 10**18:",
"- print((b - a))",
"- else:",
"- ... | false | 0.143512 | 0.041834 | 3.430553 | [
"s303818532",
"s179144917"
] |
u747602774 | p02900 | python | s080763477 | s645098870 | 133 | 118 | 3,188 | 3,060 | Accepted | Accepted | 11.28 | a,b = list(map(int,input().split()))
def fctr1(n):
f = []
c = 0
for i in range(2,int(n**0.5)+2):
while n%i == 0:
c += 1
n = n//i
if c !=0:
f.append([i,c])
c = 0
if n != 1:
f.append([n,1])
return f
dlist = fctr... | #nの素因数分解(O(n**0.5)
def prime_factor(n):
ass = []
for i in range(2,int(n**0.5)+1):
while n%i == 0:
ass.append(i)
n = n//i
if n != 1:
ass.append(n)
return ass
#a,bの最大公約数
def gcd(a,b):
while b:
a,b = b,a%b
return a
a,b = list(map(in... | 24 | 20 | 432 | 379 | a, b = list(map(int, input().split()))
def fctr1(n):
f = []
c = 0
for i in range(2, int(n**0.5) + 2):
while n % i == 0:
c += 1
n = n // i
if c != 0:
f.append([i, c])
c = 0
if n != 1:
f.append([n, 1])
return f
dlist = fctr1(a... | # nの素因数分解(O(n**0.5)
def prime_factor(n):
ass = []
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
ass.append(i)
n = n // i
if n != 1:
ass.append(n)
return ass
# a,bの最大公約数
def gcd(a, b):
while b:
a, b = b, a % b
return a
a, b = list(map(in... | false | 16.666667 | [
"-a, b = list(map(int, input().split()))",
"+# nの素因数分解(O(n**0.5)",
"+def prime_factor(n):",
"+ ass = []",
"+ for i in range(2, int(n**0.5) + 1):",
"+ while n % i == 0:",
"+ ass.append(i)",
"+ n = n // i",
"+ if n != 1:",
"+ ass.append(n)",
"+ retur... | false | 0.047454 | 0.047302 | 1.003226 | [
"s080763477",
"s645098870"
] |
u827202523 | p02898 | python | s200781720 | s704675619 | 221 | 86 | 49,904 | 83,936 | Accepted | Accepted | 61.09 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
from bisect import bisect_left
n, k = getList()
nums = getList()
ans = 0
for num in nums:
if num >= k:
ans... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = l... | 22 | 40 | 335 | 770 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
from bisect import bisect_left
n, k = getList()
nums = getList()
ans = 0
for num in nums:
if num >= k:
ans += 1
print(an... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(i... | false | 45 | [
"+from collections import defaultdict, deque, Counter",
"+import math",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"-sys.setrecursionlimit(100000)",
"+getS = lambda: input().strip()",
"+getN ... | false | 0.078327 | 0.046235 | 1.694119 | [
"s200781720",
"s704675619"
] |
u195054737 | p03162 | python | s686003707 | s968950633 | 1,955 | 447 | 42,788 | 30,580 | Accepted | Accepted | 77.14 | import sys
import itertools
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数
from math import ceil, floor, sqrt, isinf #小数点切り上げ、切り捨て、平方根
from copy import deepcopy #参照で影響されないコピー
from collections import Counter, deque #要素ごとの出現回数、双方向アクセス可能データ型
import heapq
import numpy as np
from f... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
a, b, c = 0, 0, 0
for x, y, z in abc:
a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z
print((max(a, b, c))) | 38 | 8 | 908 | 199 | import sys
import itertools
from operator import itemgetter # sortedの対象を決めたい
from fractions import gcd # 最大公約数
from math import ceil, floor, sqrt, isinf # 小数点切り上げ、切り捨て、平方根
from copy import deepcopy # 参照で影響されないコピー
from collections import Counter, deque # 要素ごとの出現回数、双方向アクセス可能データ型
import heapq
import numpy as np
from ... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
a, b, c = 0, 0, 0
for x, y, z in abc:
a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z
print((max(a, b, c)))
| false | 78.947368 | [
"-import sys",
"-import itertools",
"-from operator import itemgetter # sortedの対象を決めたい",
"-from fractions import gcd # 最大公約数",
"-from math import ceil, floor, sqrt, isinf # 小数点切り上げ、切り捨て、平方根",
"-from copy import deepcopy # 参照で影響されないコピー",
"-from collections import Counter, deque # 要素ごとの出現回数、双方向アクセス可能... | false | 0.300883 | 0.04422 | 6.80427 | [
"s686003707",
"s968950633"
] |
u216392490 | p02572 | python | s639788956 | s554416103 | 172 | 142 | 31,612 | 31,596 | Accepted | Accepted | 17.44 | n = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
ans = 0
for i in range(n-1):
s -= A[i]
ans = (ans + A[i] * s) % int(1e9 + 7)
print(ans)
| n = int(eval(input()))
mod = int(1e9+7)
ans, t = 0, 0
for a in list(map(int, input().split())):
ans = (ans+a*t) % mod
t = (t + a) % mod
print(ans)
| 10 | 8 | 171 | 157 | n = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
ans = 0
for i in range(n - 1):
s -= A[i]
ans = (ans + A[i] * s) % int(1e9 + 7)
print(ans)
| n = int(eval(input()))
mod = int(1e9 + 7)
ans, t = 0, 0
for a in list(map(int, input().split())):
ans = (ans + a * t) % mod
t = (t + a) % mod
print(ans)
| false | 20 | [
"-A = list(map(int, input().split()))",
"-s = sum(A)",
"-ans = 0",
"-for i in range(n - 1):",
"- s -= A[i]",
"- ans = (ans + A[i] * s) % int(1e9 + 7)",
"+mod = int(1e9 + 7)",
"+ans, t = 0, 0",
"+for a in list(map(int, input().split())):",
"+ ans = (ans + a * t) % mod",
"+ t = (t + a)... | false | 0.044599 | 0.043958 | 1.01458 | [
"s639788956",
"s554416103"
] |
u226108478 | p03731 | python | s911043408 | s411453041 | 176 | 152 | 26,708 | 26,832 | Accepted | Accepted | 13.64 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
n, intervel = list(map(int, input().split()))
ts = list(map(int, input().split()))
ts += [ts[-1] + intervel]
total_t = 0
previous_t = ts[0]
for i in range(1, n + 1):
current_t = ts... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
n, intervel = list(map(int, input().split()))
ts = list(map(int, input().split()))
ts += [ts[-1] + intervel]
total_t = 0
previous_t = ts[0]
# See:
# https://atcoder.jp/img/arc073/edito... | 24 | 21 | 534 | 499 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
n, intervel = list(map(int, input().split()))
ts = list(map(int, input().split()))
ts += [ts[-1] + intervel]
total_t = 0
previous_t = ts[0]
for i in range(1, n + 1):
current_t = ts[i]
if (pr... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
n, intervel = list(map(int, input().split()))
ts = list(map(int, input().split()))
ts += [ts[-1] + intervel]
total_t = 0
previous_t = ts[0]
# See:
# https://atcoder.jp/img/arc073/editorial.pdf
for i... | false | 12.5 | [
"+ # See:",
"+ # https://atcoder.jp/img/arc073/editorial.pdf",
"- if (previous_t + intervel) > current_t:",
"- total_t += max(0, current_t - previous_t)",
"- else:",
"- total_t += intervel",
"+ total_t += min(current_t - previous_t, intervel)"
] | false | 0.045652 | 0.048726 | 0.936908 | [
"s911043408",
"s411453041"
] |
u729133443 | p03792 | python | s067600903 | s317267705 | 62 | 57 | 3,316 | 3,316 | Accepted | Accepted | 8.06 | s='#';n,*a=open(0).readlines();n=int(n);f,e=[sum(i==t.count(s)for t in zip(*a))for i in(n,0)];r=list(range(n));print((-(e>n)or min(n*2-f-a[i].count(s)+all(s<a[j][i]for j in r)for i in r))) | n,*a=open(0).readlines();n=int(n);f,e=[sum(n==t.count(c)for t in zip(*a))for c in'#.'];r=list(range(n));print((-(e==n)or min(n*2-f-a[i].count('#')+all('#'<a[j][i]for j in r)for i in r))) | 1 | 1 | 180 | 178 | s = "#"
n, *a = open(0).readlines()
n = int(n)
f, e = [sum(i == t.count(s) for t in zip(*a)) for i in (n, 0)]
r = list(range(n))
print(
(
-(e > n)
or min(n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in r) for i in r)
)
)
| n, *a = open(0).readlines()
n = int(n)
f, e = [sum(n == t.count(c) for t in zip(*a)) for c in "#."]
r = list(range(n))
print(
(
-(e == n)
or min(n * 2 - f - a[i].count("#") + all("#" < a[j][i] for j in r) for i in r)
)
)
| false | 0 | [
"-s = \"#\"",
"-f, e = [sum(i == t.count(s) for t in zip(*a)) for i in (n, 0)]",
"+f, e = [sum(n == t.count(c) for t in zip(*a)) for c in \"#.\"]",
"- -(e > n)",
"- or min(n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in r) for i in r)",
"+ -(e == n)",
"+ or min(n * 2 - f... | false | 0.037849 | 0.038409 | 0.985429 | [
"s067600903",
"s317267705"
] |
u893063840 | p03805 | python | s416810036 | s377680375 | 31 | 27 | 3,064 | 3,064 | Accepted | Accepted | 12.9 | class Graph:
def __init__(self):
n, m = list(map(int, input().split()))
self.adj = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
self.adj[a].append(b)
self.adj[b].append(a)... | from itertools import permutations
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
g = [[0] * n for _ in range(n)]
for a, b in ab:
a -= 1
b -= 1
g[a][b] = 1
g[b][a] = 1
ans = 0
for pat in permutations(list(range(1, n)), n - 1):
is_path... | 38 | 25 | 833 | 467 | class Graph:
def __init__(self):
n, m = list(map(int, input().split()))
self.adj = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
self.adj[a].append(b)
self.adj[b].append(a)
se... | from itertools import permutations
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
g = [[0] * n for _ in range(n)]
for a, b in ab:
a -= 1
b -= 1
g[a][b] = 1
g[b][a] = 1
ans = 0
for pat in permutations(list(range(1, n)), n - 1):
is_path = True
u = ... | false | 34.210526 | [
"-class Graph:",
"- def __init__(self):",
"- n, m = list(map(int, input().split()))",
"- self.adj = [[] for _ in range(n)]",
"- for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- a -= 1",
"- b -= 1",
"- self.adj[a].... | false | 0.083785 | 0.053045 | 1.579514 | [
"s416810036",
"s377680375"
] |
u677267454 | p03062 | python | s630708790 | s640051117 | 87 | 78 | 14,332 | 14,412 | Accepted | Accepted | 10.34 | # -*- coding: utf-8 -*-
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
count = 0
for i in range(n):
if a[i] < 0:
a[i] = -a[i]
count += 1
ans += a[i]
if count % 2 == 0:
print(ans)
else:
print((ans - min(a) * 2))
| # -*- coding: utf-8 -*-
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in range(n):
if a[i] < 0:
a[i] = -a[i]
count += 1
ans = sum(a)
if count % 2 == 0:
print(ans)
else:
print((ans - min(a) * 2))
| 16 | 15 | 272 | 260 | # -*- coding: utf-8 -*-
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
count = 0
for i in range(n):
if a[i] < 0:
a[i] = -a[i]
count += 1
ans += a[i]
if count % 2 == 0:
print(ans)
else:
print((ans - min(a) * 2))
| # -*- coding: utf-8 -*-
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in range(n):
if a[i] < 0:
a[i] = -a[i]
count += 1
ans = sum(a)
if count % 2 == 0:
print(ans)
else:
print((ans - min(a) * 2))
| false | 6.25 | [
"-ans = 0",
"- ans += a[i]",
"+ans = sum(a)"
] | false | 0.039246 | 0.038931 | 1.008085 | [
"s630708790",
"s640051117"
] |
u465900169 | p02755 | python | s457270517 | s368223173 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | import sys
A, B = [int(x) for x in input().split()]
for x in range(A*8//100,(B+1)*10):
if A == x*8//100 and B == x//10:
print(x)
sys.exit()
print((-1)) | import sys
A, B = [int(x) for x in input().split()]
for x in range(A*100//8,(B+1)*10):
if A == x*8//100 and B == x//10:
print(x)
sys.exit()
print((-1))
| 7 | 7 | 165 | 166 | import sys
A, B = [int(x) for x in input().split()]
for x in range(A * 8 // 100, (B + 1) * 10):
if A == x * 8 // 100 and B == x // 10:
print(x)
sys.exit()
print((-1))
| import sys
A, B = [int(x) for x in input().split()]
for x in range(A * 100 // 8, (B + 1) * 10):
if A == x * 8 // 100 and B == x // 10:
print(x)
sys.exit()
print((-1))
| false | 0 | [
"-for x in range(A * 8 // 100, (B + 1) * 10):",
"+for x in range(A * 100 // 8, (B + 1) * 10):"
] | false | 0.046633 | 0.047655 | 0.97855 | [
"s457270517",
"s368223173"
] |
u761529120 | p03593 | python | s965447903 | s387048647 | 182 | 75 | 40,176 | 68,944 | Accepted | Accepted | 58.79 | from collections import defaultdict
def main():
H, W = list(map(int, input().split()))
A = list(list(eval(input())) for _ in range(H) )
d = defaultdict(int)
for h in range(H):
for w in range(W):
d[A[h][w]] += 1
odd = 0
even = 0
if H % 2 and W % 2:
o... | from collections import defaultdict
def main():
H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
d = defaultdict(int)
for h in range(H):
for w in range(W):
d[A[h][w]] += 1
d[A[h][w]] %= 4
e = defaultdict(int)
for a... | 38 | 47 | 756 | 1,046 | from collections import defaultdict
def main():
H, W = list(map(int, input().split()))
A = list(list(eval(input())) for _ in range(H))
d = defaultdict(int)
for h in range(H):
for w in range(W):
d[A[h][w]] += 1
odd = 0
even = 0
if H % 2 and W % 2:
odd += 1
if... | from collections import defaultdict
def main():
H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
d = defaultdict(int)
for h in range(H):
for w in range(W):
d[A[h][w]] += 1
d[A[h][w]] %= 4
e = defaultdict(int)
for a in list(d.val... | false | 19.148936 | [
"- A = list(list(eval(input())) for _ in range(H))",
"+ A = [list(eval(input())) for _ in range(H)]",
"- odd = 0",
"- even = 0",
"- if H % 2 and W % 2:",
"- odd += 1",
"- if H % 2:",
"- even += W // 2",
"- if W % 2:",
"- even += H // 2",
"- for key, v... | false | 0.044997 | 0.034003 | 1.323299 | [
"s965447903",
"s387048647"
] |
u039360403 | p03329 | python | s406751995 | s028747457 | 517 | 405 | 7,064 | 7,064 | Accepted | Accepted | 21.66 | n=int(eval(input()))
ll=[6,9,36,81,216,729,1296,6561,7776,46656,59049]
dp=[i for i in range(100010)]
for l in ll:
for x in range(l,n+1):
dp[x]=min(dp[x],dp[x-l]+1)
print((dp[n]))
| n=int(eval(input()))
l9=list(9**i for i in range(1,6))
l6=list(6**j for j in range(1,8))
l=sorted(l9+l6)
dp=[_ for _ in range(100010)]
for k in l:
for m in range(k,n+1):
dp[m]=min(dp[m-k]+1,dp[m])
print((dp[n])) | 12 | 9 | 207 | 223 | n = int(eval(input()))
ll = [6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
dp = [i for i in range(100010)]
for l in ll:
for x in range(l, n + 1):
dp[x] = min(dp[x], dp[x - l] + 1)
print((dp[n]))
| n = int(eval(input()))
l9 = list(9**i for i in range(1, 6))
l6 = list(6**j for j in range(1, 8))
l = sorted(l9 + l6)
dp = [_ for _ in range(100010)]
for k in l:
for m in range(k, n + 1):
dp[m] = min(dp[m - k] + 1, dp[m])
print((dp[n]))
| false | 25 | [
"-ll = [6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]",
"-dp = [i for i in range(100010)]",
"-for l in ll:",
"- for x in range(l, n + 1):",
"- dp[x] = min(dp[x], dp[x - l] + 1)",
"+l9 = list(9**i for i in range(1, 6))",
"+l6 = list(6**j for j in range(1, 8))",
"+l = sorted(l9 + l6)... | false | 0.124978 | 0.243992 | 0.512223 | [
"s406751995",
"s028747457"
] |
u389910364 | p03221 | python | s421546766 | s674252287 | 871 | 738 | 77,252 | 39,100 | Accepted | Accepted | 15.27 | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as np
if o... | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
fro... | 37 | 43 | 840 | 943 | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as np
if os.getenv("LOCAL")... | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator impo... | false | 13.953488 | [
"+import cmath",
"+import operator",
"+from copy import deepcopy",
"-from operator import itemgetter",
"+from operator import itemgetter, mul, add, xor",
"-sys.setrecursionlimit(2147483647)",
"+sys.setrecursionlimit(10**9)",
"-N, M = list(map(int, sys.stdin.readline().split()))",
"-P, Y = list(zip(*... | false | 0.0359 | 0.291662 | 0.123086 | [
"s421546766",
"s674252287"
] |
u753803401 | p02785 | python | s502106068 | s173818806 | 291 | 257 | 80,232 | 75,888 | Accepted | Accepted | 11.68 | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, k = list(map(int, input().rstrip('\n').split()))
h = list(map(int, input().rstrip('\n').split()))
h.sort()
t = 0
for i in range(n - k):
t += h[i]
print(t)
if __name__ == '__main__':
so... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, k = list(map(int, readline().split()))
h = list(map(int, readline().split()))
h.sort(reverse=True)
print((sum(h[k:n])))
if __name__ == '__main__':
solve()
| 17 | 14 | 326 | 280 | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, k = list(map(int, input().rstrip("\n").split()))
h = list(map(int, input().rstrip("\n").split()))
h.sort()
t = 0
for i in range(n - k):
t += h[i]
print(t)
if __name__ == "__main__":
solve()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n, k = list(map(int, readline().split()))
h = list(map(int, readline().split()))
h.sort(reverse=True)
print((sum(h[k:n])))
if __name__ == "__main__":
solve()
| false | 17.647059 | [
"- input = sys.stdin.readline",
"+ readline = sys.stdin.buffer.readline",
"- n, k = list(map(int, input().rstrip(\"\\n\").split()))",
"- h = list(map(int, input().rstrip(\"\\n\").split()))",
"- h.sort()",
"- t = 0",
"- for i in range(n - k):",
"- t += h[i]",
"- print(t... | false | 0.047554 | 0.045591 | 1.043048 | [
"s502106068",
"s173818806"
] |
u635277286 | p03763 | python | s117176636 | s433501322 | 22 | 20 | 3,316 | 3,064 | Accepted | Accepted | 9.09 | N = int(eval(input()))
S = [[] for i in range(N)]
for i in range(N):
S[i] += list(eval(input()))
res=""
for i in range(97,97+26):
c = chr(i)
curr = 50
for j in range(N):
curr = min(curr,S[j].count(c))
res += c*curr
print(res) | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
MAX_LEN = 50
res = ""
for i in range(ord('a'), ord('a')+26):
c = chr(i)
curr = MAX_LEN
for j in range(N):
curr = min(curr,S[j].count(c))
res += c * curr
print(res) | 14 | 13 | 236 | 232 | N = int(eval(input()))
S = [[] for i in range(N)]
for i in range(N):
S[i] += list(eval(input()))
res = ""
for i in range(97, 97 + 26):
c = chr(i)
curr = 50
for j in range(N):
curr = min(curr, S[j].count(c))
res += c * curr
print(res)
| N = int(eval(input()))
S = [eval(input()) for i in range(N)]
MAX_LEN = 50
res = ""
for i in range(ord("a"), ord("a") + 26):
c = chr(i)
curr = MAX_LEN
for j in range(N):
curr = min(curr, S[j].count(c))
res += c * curr
print(res)
| false | 7.142857 | [
"-S = [[] for i in range(N)]",
"-for i in range(N):",
"- S[i] += list(eval(input()))",
"+S = [eval(input()) for i in range(N)]",
"+MAX_LEN = 50",
"-for i in range(97, 97 + 26):",
"+for i in range(ord(\"a\"), ord(\"a\") + 26):",
"- curr = 50",
"+ curr = MAX_LEN"
] | false | 0.047187 | 0.093782 | 0.50316 | [
"s117176636",
"s433501322"
] |
u671446913 | p02684 | python | s712362171 | s875489305 | 176 | 112 | 33,724 | 97,236 | Accepted | Accepted | 36.36 | #!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
# = input()
# = int(input())
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
ord_ = [-1] * (n + 1) # 何回目に訪れたか... | #!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
# = input()
# = int(input())
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
ord_ = [-1] * n # 何回目に訪れたか
homo... | 32 | 32 | 700 | 694 | #!/usr/bin/env python3
import collections
import itertools as it
import math
# import numpy as np
# = input()
# = int(input())
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
ord_ = [-1] * (n + 1) # 何回目に訪れたか
homon = [] #... | #!/usr/bin/env python3
import collections
import itertools as it
import math
# import numpy as np
# = input()
# = int(input())
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
ord_ = [-1] * n # 何回目に訪れたか
homon = [] # 訪問した順... | false | 0 | [
"-ord_ = [-1] * (n + 1) # 何回目に訪れたか",
"+ord_ = [-1] * n # 何回目に訪れたか"
] | false | 0.043359 | 0.045809 | 0.946501 | [
"s712362171",
"s875489305"
] |
u279460955 | p02873 | python | s477267783 | s626204336 | 307 | 207 | 85,192 | 46,792 | Accepted | Accepted | 32.57 | from itertools import groupby
s = eval(input())
A = [(key, sum(1 for _ in group)) for key, group in groupby(s)]
tmp = 0
ans = 0
for key, count in A:
if key == '<':
ans += count*(count+1)//2
tmp = count
else:
if tmp < count:
ans -= tmp
ans += count
... | s = eval(input())
n = len(s)+1
A = [0]*n
for i in range(n-1):
if s[i] == '<':
A[i+1] = A[i] + 1
for i in reversed(list(range(n-1))):
if s[i] == '>':
A[i] = max(A[i], A[i+1] + 1)
print((sum(A)))
| 17 | 13 | 376 | 219 | from itertools import groupby
s = eval(input())
A = [(key, sum(1 for _ in group)) for key, group in groupby(s)]
tmp = 0
ans = 0
for key, count in A:
if key == "<":
ans += count * (count + 1) // 2
tmp = count
else:
if tmp < count:
ans -= tmp
ans += count
a... | s = eval(input())
n = len(s) + 1
A = [0] * n
for i in range(n - 1):
if s[i] == "<":
A[i + 1] = A[i] + 1
for i in reversed(list(range(n - 1))):
if s[i] == ">":
A[i] = max(A[i], A[i + 1] + 1)
print((sum(A)))
| false | 23.529412 | [
"-from itertools import groupby",
"-",
"-A = [(key, sum(1 for _ in group)) for key, group in groupby(s)]",
"-tmp = 0",
"-ans = 0",
"-for key, count in A:",
"- if key == \"<\":",
"- ans += count * (count + 1) // 2",
"- tmp = count",
"- else:",
"- if tmp < count:",
"- ... | false | 0.037866 | 0.087132 | 0.434576 | [
"s477267783",
"s626204336"
] |
u884982181 | p03043 | python | s633572173 | s939510322 | 212 | 46 | 39,408 | 2,940 | Accepted | Accepted | 78.3 | import sys
sys.setrecursionlimit(20000000)
#input = sys.stdin.readline
n,k = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
a = i + 0
b = 1
while a < k:
b /= 2
a*=2
ans += (1/n)*b
print(ans) | n,k = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
tmp = i+0
x = 1/n
while i<k:
i*=2
x/=2
ans+=x
print(ans) | 13 | 10 | 243 | 159 | import sys
sys.setrecursionlimit(20000000)
# input = sys.stdin.readline
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
a = i + 0
b = 1
while a < k:
b /= 2
a *= 2
ans += (1 / n) * b
print(ans)
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = i + 0
x = 1 / n
while i < k:
i *= 2
x /= 2
ans += x
print(ans)
| false | 23.076923 | [
"-import sys",
"-",
"-sys.setrecursionlimit(20000000)",
"-# input = sys.stdin.readline",
"- a = i + 0",
"- b = 1",
"- while a < k:",
"- b /= 2",
"- a *= 2",
"- ans += (1 / n) * b",
"+ tmp = i + 0",
"+ x = 1 / n",
"+ while i < k:",
"+ i *= 2",
"+ ... | false | 0.074319 | 0.110598 | 0.671971 | [
"s633572173",
"s939510322"
] |
u360116509 | p02862 | python | s127757705 | s358464478 | 252 | 150 | 39,796 | 3,064 | Accepted | Accepted | 40.48 | P = 10**9 + 7
X, Y = list(map(int, input().split()))
if (X + Y) % 3 > 0:
print((0))
exit()
n = (X + Y) // 3
x = X - n
y = Y - n
if 0 > x or 0 > y:
print((0))
exit()
fact = [0] * (x + y + 1)
inv = [0] * (x + y + 1)
fact_inv = [0] * (x + y + 1)
fact[0], fact[1] = 1, 1
inv[0], inv[1] = 0, 1
... | def fact(n, k, mod):
res = 1
for i in range(k):
res = res * (n - i) % mod
return res
def c(x, y, mod):
y = min(x, x - y)
return (fact(x, y, mod) * pow(fact(y, y, mod), mod - 2 , mod)) % mod
P = 10**9 + 7
X, Y = list(map(int, input().split()))
if (X + Y) % 3 > 0:
print((0))... | 20 | 22 | 487 | 433 | P = 10**9 + 7
X, Y = list(map(int, input().split()))
if (X + Y) % 3 > 0:
print((0))
exit()
n = (X + Y) // 3
x = X - n
y = Y - n
if 0 > x or 0 > y:
print((0))
exit()
fact = [0] * (x + y + 1)
inv = [0] * (x + y + 1)
fact_inv = [0] * (x + y + 1)
fact[0], fact[1] = 1, 1
inv[0], inv[1] = 0, 1
fact_inv[0], fa... | def fact(n, k, mod):
res = 1
for i in range(k):
res = res * (n - i) % mod
return res
def c(x, y, mod):
y = min(x, x - y)
return (fact(x, y, mod) * pow(fact(y, y, mod), mod - 2, mod)) % mod
P = 10**9 + 7
X, Y = list(map(int, input().split()))
if (X + Y) % 3 > 0:
print((0))
exit()
... | false | 9.090909 | [
"+def fact(n, k, mod):",
"+ res = 1",
"+ for i in range(k):",
"+ res = res * (n - i) % mod",
"+ return res",
"+",
"+",
"+def c(x, y, mod):",
"+ y = min(x, x - y)",
"+ return (fact(x, y, mod) * pow(fact(y, y, mod), mod - 2, mod)) % mod",
"+",
"+",
"-fact = [0] * (x + y +... | false | 0.148862 | 0.152189 | 0.978138 | [
"s127757705",
"s358464478"
] |
u925364229 | p03220 | python | s757720436 | s119954476 | 285 | 254 | 20,380 | 17,184 | Accepted | Accepted | 10.88 | import numpy as np
N = int(eval(input()))
T,A = list(map(int,input().split(" ")))
H = list(map(int,input().split(" ")))
H = list([abs((T - x*0.006)-A) for x in H])
print((np.argmin(H)+1))
| import numpy as np
N = int(eval(input()))
T,A = list(map(int,input().split(" ")))
H = list([abs(T - float(x)*0.006 - A) for x in input().split(" ")])
print((np.argmin(H)+1))
| 7 | 5 | 186 | 168 | import numpy as np
N = int(eval(input()))
T, A = list(map(int, input().split(" ")))
H = list(map(int, input().split(" ")))
H = list([abs((T - x * 0.006) - A) for x in H])
print((np.argmin(H) + 1))
| import numpy as np
N = int(eval(input()))
T, A = list(map(int, input().split(" ")))
H = list([abs(T - float(x) * 0.006 - A) for x in input().split(" ")])
print((np.argmin(H) + 1))
| false | 28.571429 | [
"-H = list(map(int, input().split(\" \")))",
"-H = list([abs((T - x * 0.006) - A) for x in H])",
"+H = list([abs(T - float(x) * 0.006 - A) for x in input().split(\" \")])"
] | false | 0.632746 | 0.229043 | 2.76256 | [
"s757720436",
"s119954476"
] |
u886747123 | p03488 | python | s939468049 | s121032464 | 1,505 | 858 | 4,612 | 4,084 | Accepted | Accepted | 42.99 | # D - FT Robot
import copy
s = eval(input())
x, y = list(map(int, input().split()))
f = [len(x) for x in s.split("T")]
x -= f[0]
fx = f[2::2]
fy = f[1::2]
x_possible_set = set([0])
for dx in fx:
tmp = set()
for current_x in x_possible_set:
tmp.add(current_x + dx)
tmp.add(cur... | # D - FT Robot
s = eval(input())
x, y = list(map(int, input().split()))
f = [len(x) for x in s.split("T")]
x -= f[0]
fx = f[2::2]
fy = f[1::2]
x_possible_set = set([0])
for dx in fx:
x_possible_set = set([xi + dx for xi in x_possible_set] + [xi - dx for xi in x_possible_set])
y_possible_set = set(... | 29 | 19 | 624 | 499 | # D - FT Robot
import copy
s = eval(input())
x, y = list(map(int, input().split()))
f = [len(x) for x in s.split("T")]
x -= f[0]
fx = f[2::2]
fy = f[1::2]
x_possible_set = set([0])
for dx in fx:
tmp = set()
for current_x in x_possible_set:
tmp.add(current_x + dx)
tmp.add(current_x - dx)
x_p... | # D - FT Robot
s = eval(input())
x, y = list(map(int, input().split()))
f = [len(x) for x in s.split("T")]
x -= f[0]
fx = f[2::2]
fy = f[1::2]
x_possible_set = set([0])
for dx in fx:
x_possible_set = set(
[xi + dx for xi in x_possible_set] + [xi - dx for xi in x_possible_set]
)
y_possible_set = set([0])... | false | 34.482759 | [
"-import copy",
"-",
"- tmp = set()",
"- for current_x in x_possible_set:",
"- tmp.add(current_x + dx)",
"- tmp.add(current_x - dx)",
"- x_possible_set = tmp.copy()",
"+ x_possible_set = set(",
"+ [xi + dx for xi in x_possible_set] + [xi - dx for xi in x_possible_set... | false | 0.08335 | 0.08666 | 0.961801 | [
"s939468049",
"s121032464"
] |
u710201258 | p03341 | python | s082606529 | s431512536 | 49 | 45 | 3,676 | 3,676 | Accepted | Accepted | 8.16 | def foo (s):
ans = 0
count = 0
for i in s:
if (not count) and (i == 'E'):pass
elif not count: count += 1
elif i == 'E': count -= 1; ans += 1
else: count += 1
return ans
n = eval(input())
s = eval(input())
print((foo(s))) | def foo (s):
ans = 0
count = 0
for i in s:
if i == 'W':
count += 1
elif count :
count -= 1
ans += 1
else:
pass
return ans
n = eval(input())
s = eval(input())
print((foo(s))) | 14 | 17 | 235 | 266 | def foo(s):
ans = 0
count = 0
for i in s:
if (not count) and (i == "E"):
pass
elif not count:
count += 1
elif i == "E":
count -= 1
ans += 1
else:
count += 1
return ans
n = eval(input())
s = eval(input())
print(... | def foo(s):
ans = 0
count = 0
for i in s:
if i == "W":
count += 1
elif count:
count -= 1
ans += 1
else:
pass
return ans
n = eval(input())
s = eval(input())
print((foo(s)))
| false | 17.647059 | [
"- if (not count) and (i == \"E\"):",
"- pass",
"- elif not count:",
"+ if i == \"W\":",
"- elif i == \"E\":",
"+ elif count:",
"- count += 1",
"+ pass"
] | false | 0.038285 | 0.036865 | 1.038524 | [
"s082606529",
"s431512536"
] |
u011062360 | p02832 | python | s236861307 | s575175792 | 126 | 101 | 26,012 | 24,744 | Accepted | Accepted | 19.84 | n = int(eval(input()))
list_a = list(map(int, input().split()))
list_a_complete = []
k = 1
ans = -2
for i in range(n):
if list_a[i] == k:
list_a_complete.append(k)
k += 1
if len(list_a_complete) == 0:
ans = -1
else:
ans = len(list_a) - len(list_a_complete)
print(ans) | n = int(eval(input()))
list_score = list(map(int, input().split()))
cnt = 1
for i in range(n):
if list_score[i] == cnt:
cnt += 1
ans = 0
cnt -= 1
if cnt == 0:
ans = -1
else:
ans = len(list_score) - cnt
print(ans) | 18 | 13 | 310 | 238 | n = int(eval(input()))
list_a = list(map(int, input().split()))
list_a_complete = []
k = 1
ans = -2
for i in range(n):
if list_a[i] == k:
list_a_complete.append(k)
k += 1
if len(list_a_complete) == 0:
ans = -1
else:
ans = len(list_a) - len(list_a_complete)
print(ans)
| n = int(eval(input()))
list_score = list(map(int, input().split()))
cnt = 1
for i in range(n):
if list_score[i] == cnt:
cnt += 1
ans = 0
cnt -= 1
if cnt == 0:
ans = -1
else:
ans = len(list_score) - cnt
print(ans)
| false | 27.777778 | [
"-list_a = list(map(int, input().split()))",
"-list_a_complete = []",
"-k = 1",
"-ans = -2",
"+list_score = list(map(int, input().split()))",
"+cnt = 1",
"- if list_a[i] == k:",
"- list_a_complete.append(k)",
"- k += 1",
"-if len(list_a_complete) == 0:",
"+ if list_score[i] =... | false | 0.114289 | 0.080714 | 1.415984 | [
"s236861307",
"s575175792"
] |
u426534722 | p02258 | python | s839178916 | s166450325 | 320 | 170 | 5,632 | 5,628 | Accepted | Accepted | 46.88 | import sys
readline = sys.stdin.readline
n = int(eval(input()))
min_r = int(eval(input()))
max_r = -1e10
for _ in range(n - 1):
r = int(readline())
max_r = max(max_r, r - min_r)
min_r = min(min_r, r)
print(max_r)
| import sys
readline = sys.stdin.readline
n = int(eval(input()))
min_r = int(eval(input()))
max_r = -1e10
for _ in range(n - 1):
r = int(readline())
if max_r < r - min_r:
max_r = r - min_r
if min_r > r:
min_r = r
print(max_r)
| 11 | 13 | 224 | 254 | import sys
readline = sys.stdin.readline
n = int(eval(input()))
min_r = int(eval(input()))
max_r = -1e10
for _ in range(n - 1):
r = int(readline())
max_r = max(max_r, r - min_r)
min_r = min(min_r, r)
print(max_r)
| import sys
readline = sys.stdin.readline
n = int(eval(input()))
min_r = int(eval(input()))
max_r = -1e10
for _ in range(n - 1):
r = int(readline())
if max_r < r - min_r:
max_r = r - min_r
if min_r > r:
min_r = r
print(max_r)
| false | 15.384615 | [
"- max_r = max(max_r, r - min_r)",
"- min_r = min(min_r, r)",
"+ if max_r < r - min_r:",
"+ max_r = r - min_r",
"+ if min_r > r:",
"+ min_r = r"
] | false | 0.07737 | 0.036319 | 2.130251 | [
"s839178916",
"s166450325"
] |
u699296734 | p02756 | python | s057199485 | s665074385 | 1,394 | 160 | 4,552 | 4,596 | Accepted | Accepted | 88.52 | moji=eval(input())
cycle=int(eval(input()))
flont_or_back=0
flont=""
back=""
for i in range(cycle):
line=eval(input())
if line[0]=="1":
flont_or_back+=1
else:
fi=line[2]
ci=line[4]
if flont_or_back%2==0:
if fi=="1":
flont=ci+flont
... | import sys
input = lambda: sys.stdin.readline().rstrip()
def main():
moji=eval(input())
cycle=int(eval(input()))
flont_or_back=0
flont=""
back=""
for i in range(cycle):
line=eval(input())
if line[0]=="1":
flont_or_back+=1
else:
fi=lin... | 27 | 36 | 553 | 801 | moji = eval(input())
cycle = int(eval(input()))
flont_or_back = 0
flont = ""
back = ""
for i in range(cycle):
line = eval(input())
if line[0] == "1":
flont_or_back += 1
else:
fi = line[2]
ci = line[4]
if flont_or_back % 2 == 0:
if fi == "1":
flont ... | import sys
input = lambda: sys.stdin.readline().rstrip()
def main():
moji = eval(input())
cycle = int(eval(input()))
flont_or_back = 0
flont = ""
back = ""
for i in range(cycle):
line = eval(input())
if line[0] == "1":
flont_or_back += 1
else:
f... | false | 25 | [
"-moji = eval(input())",
"-cycle = int(eval(input()))",
"-flont_or_back = 0",
"-flont = \"\"",
"-back = \"\"",
"-for i in range(cycle):",
"- line = eval(input())",
"- if line[0] == \"1\":",
"- flont_or_back += 1",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()... | false | 0.043035 | 0.042471 | 1.013283 | [
"s057199485",
"s665074385"
] |
u864197622 | p02782 | python | s188078083 | s523764483 | 1,203 | 279 | 177,196 | 107,144 | Accepted | Accepted | 76.81 | nn = 2002002
P = 10**9+7
fa = [1]
for i in range(1, nn): fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P-2, P)]
for i in range(1, nn)[::-1]: fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]
f = lambda a, b: fa[a+b+2] * fainv[a+1] * fainv[b+1] % P - 1
r1, c1, r2, c2 = list(map(int, input().split()))
print((... | nn = 2002002
P = 10**9+7
fa = [1]
for i in range(1, nn): fa.append(fa[-1] * i % P)
f = lambda a, b: fa[a+b+2] * pow(fa[a+1] * fa[b+1], P-2, P) % P - 1
r1, c1, r2, c2 = list(map(int, input().split()))
print(((f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)) % P)) | 10 | 7 | 373 | 266 | nn = 2002002
P = 10**9 + 7
fa = [1]
for i in range(1, nn):
fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P - 2, P)]
for i in range(1, nn)[::-1]:
fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]
f = lambda a, b: fa[a + b + 2] * fainv[a + 1] * fainv[b + 1] % P - 1
r1, c1, r2, c2 = list(map(int, input().split(... | nn = 2002002
P = 10**9 + 7
fa = [1]
for i in range(1, nn):
fa.append(fa[-1] * i % P)
f = lambda a, b: fa[a + b + 2] * pow(fa[a + 1] * fa[b + 1], P - 2, P) % P - 1
r1, c1, r2, c2 = list(map(int, input().split()))
print(((f(r2, c2) - f(r2, c1 - 1) - f(r1 - 1, c2) + f(r1 - 1, c1 - 1)) % P))
| false | 30 | [
"-fainv = [pow(fa[-1], P - 2, P)]",
"-for i in range(1, nn)[::-1]:",
"- fainv.append(fainv[-1] * i % P)",
"-fainv = fainv[::-1]",
"-f = lambda a, b: fa[a + b + 2] * fainv[a + 1] * fainv[b + 1] % P - 1",
"+f = lambda a, b: fa[a + b + 2] * pow(fa[a + 1] * fa[b + 1], P - 2, P) % P - 1"
] | false | 2.666955 | 0.975987 | 2.732571 | [
"s188078083",
"s523764483"
] |
u293579463 | p03331 | python | s901270008 | s799962214 | 283 | 182 | 2,940 | 3,864 | Accepted | Accepted | 35.69 | N = int(eval(input()))
def digitSum(X):
ds = 0
for x in str(X):
ds += int(x)
return ds
ans = N
for i in range(1, N):
dgtSum = digitSum(i) + digitSum(N - i)
if ans > dgtSum:
ans = dgtSum
print(ans)
| def sumDigit(x):
total = 0
while x > 0:
total += x % 10
x = x // 10
return total
N = int(eval(input()))
ans = []
for a in range(1, N):
sum_A = sumDigit(a)
sum_B = sumDigit(N - a)
ans.append(sum_A + sum_B)
print((min(ans))) | 17 | 17 | 248 | 244 | N = int(eval(input()))
def digitSum(X):
ds = 0
for x in str(X):
ds += int(x)
return ds
ans = N
for i in range(1, N):
dgtSum = digitSum(i) + digitSum(N - i)
if ans > dgtSum:
ans = dgtSum
print(ans)
| def sumDigit(x):
total = 0
while x > 0:
total += x % 10
x = x // 10
return total
N = int(eval(input()))
ans = []
for a in range(1, N):
sum_A = sumDigit(a)
sum_B = sumDigit(N - a)
ans.append(sum_A + sum_B)
print((min(ans)))
| false | 0 | [
"-N = int(eval(input()))",
"+def sumDigit(x):",
"+ total = 0",
"+ while x > 0:",
"+ total += x % 10",
"+ x = x // 10",
"+ return total",
"-def digitSum(X):",
"- ds = 0",
"- for x in str(X):",
"- ds += int(x)",
"- return ds",
"-",
"-",
"-ans = N",
... | false | 0.187566 | 0.249545 | 0.751633 | [
"s901270008",
"s799962214"
] |
u903948194 | p03250 | python | s220684971 | s721589033 | 23 | 18 | 3,440 | 2,940 | Accepted | Accepted | 21.74 | import itertools, copy
n = input().split()
ans = 0
for p0, p1 in itertools.permutations(n, 2):
n_ = copy.copy(n)
n_.remove(p0)
n_.remove(p1)
total = int(''.join([p0, p1])) + int(n_[0])
ans = max(ans, total)
print(ans) | n = list(map(int, input().split()))
nmax = max(n)
n.remove(nmax)
ans = nmax * 10 + sum(n)
print(ans) | 14 | 6 | 258 | 107 | import itertools, copy
n = input().split()
ans = 0
for p0, p1 in itertools.permutations(n, 2):
n_ = copy.copy(n)
n_.remove(p0)
n_.remove(p1)
total = int("".join([p0, p1])) + int(n_[0])
ans = max(ans, total)
print(ans)
| n = list(map(int, input().split()))
nmax = max(n)
n.remove(nmax)
ans = nmax * 10 + sum(n)
print(ans)
| false | 57.142857 | [
"-import itertools, copy",
"-",
"-n = input().split()",
"-ans = 0",
"-for p0, p1 in itertools.permutations(n, 2):",
"- n_ = copy.copy(n)",
"- n_.remove(p0)",
"- n_.remove(p1)",
"- total = int(\"\".join([p0, p1])) + int(n_[0])",
"- ans = max(ans, total)",
"+n = list(map(int, input(... | false | 0.073226 | 0.039516 | 1.853072 | [
"s220684971",
"s721589033"
] |
u631429391 | p02718 | python | s976129785 | s214362752 | 19 | 17 | 3,188 | 3,060 | Accepted | Accepted | 10.53 | n,m = list(map(int,input().split()))
a = list(map(int, input().split()))
ord = []
summ = sum(a)
isSmallThan = True
for j in range(m):
ord.append(max(a))
a.remove(max(a))
for k in range(m):
if ord[k]/summ >= 1/(4*m):
isSmallThan = True
else:
isSmallThan = False
break
print(('Yes' if isS... | n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=True)
sumVote = sum(a)
ans = 0
for i in range(m):
if a[i] < sumVote/(4*m):
ans += 1
print(('Yes' if ans == 0 else 'No')) | 15 | 9 | 333 | 219 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
ord = []
summ = sum(a)
isSmallThan = True
for j in range(m):
ord.append(max(a))
a.remove(max(a))
for k in range(m):
if ord[k] / summ >= 1 / (4 * m):
isSmallThan = True
else:
isSmallThan = False
break
print... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
sumVote = sum(a)
ans = 0
for i in range(m):
if a[i] < sumVote / (4 * m):
ans += 1
print(("Yes" if ans == 0 else "No"))
| false | 40 | [
"-ord = []",
"-summ = sum(a)",
"-isSmallThan = True",
"-for j in range(m):",
"- ord.append(max(a))",
"- a.remove(max(a))",
"-for k in range(m):",
"- if ord[k] / summ >= 1 / (4 * m):",
"- isSmallThan = True",
"- else:",
"- isSmallThan = False",
"- break",
"-pr... | false | 0.058656 | 0.058652 | 1.000058 | [
"s976129785",
"s214362752"
] |
u254871849 | p03610 | python | s466842630 | s371432485 | 28 | 17 | 3,572 | 3,188 | Accepted | Accepted | 39.29 | import sys
s = sys.stdin.readline().rstrip()
print((''.join([s[i] for i in range(len(s)) if i % 2 == 0])))
| import sys
def main():
s = sys.stdin.readline().rstrip()
res = s[::2]
print(res)
if __name__ == '__main__':
main() | 5 | 9 | 111 | 140 | import sys
s = sys.stdin.readline().rstrip()
print(("".join([s[i] for i in range(len(s)) if i % 2 == 0])))
| import sys
def main():
s = sys.stdin.readline().rstrip()
res = s[::2]
print(res)
if __name__ == "__main__":
main()
| false | 44.444444 | [
"-s = sys.stdin.readline().rstrip()",
"-print((\"\".join([s[i] for i in range(len(s)) if i % 2 == 0])))",
"+",
"+def main():",
"+ s = sys.stdin.readline().rstrip()",
"+ res = s[::2]",
"+ print(res)",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.052301 | 0.038343 | 1.364051 | [
"s466842630",
"s371432485"
] |
u436587708 | p02264 | python | s467568772 | s614033492 | 850 | 370 | 15,868 | 16,184 | Accepted | Accepted | 56.47 | n, q = list(map(int, input().split()))
que = []
for _ in range(n):
name, time = input().split()
que.append([name, int(time)])
elapsed_time = 0
while que:
name, time = que.pop(0)
dt = min(q, time)
time -= dt
elapsed_time += dt
if time > 0:
que.append([name, time])
... | from collections import deque
n, q = list(map(int, input().split()))
que = deque([])
for _ in range(n):
name, time = input().split()
que.append([name, int(time)])
elapsed_time = 0
while que:
name, time = que.popleft()
dt = min(q, time)
time -= dt
elapsed_time += dt
if tim... | 16 | 18 | 364 | 407 | n, q = list(map(int, input().split()))
que = []
for _ in range(n):
name, time = input().split()
que.append([name, int(time)])
elapsed_time = 0
while que:
name, time = que.pop(0)
dt = min(q, time)
time -= dt
elapsed_time += dt
if time > 0:
que.append([name, time])
else:
pr... | from collections import deque
n, q = list(map(int, input().split()))
que = deque([])
for _ in range(n):
name, time = input().split()
que.append([name, int(time)])
elapsed_time = 0
while que:
name, time = que.popleft()
dt = min(q, time)
time -= dt
elapsed_time += dt
if time > 0:
que.... | false | 11.111111 | [
"+from collections import deque",
"+",
"-que = []",
"+que = deque([])",
"- name, time = que.pop(0)",
"+ name, time = que.popleft()"
] | false | 0.047062 | 0.04732 | 0.994561 | [
"s467568772",
"s614033492"
] |
u807028974 | p02628 | python | s268516908 | s688349195 | 66 | 30 | 62,448 | 8,920 | Accepted | Accepted | 54.55 | # import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
# combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operato... | n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(k):
ans += p[i]
print(ans) | 34 | 7 | 718 | 134 | # import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
# combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import it... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k):
ans += p[i]
print(ans)
| false | 79.411765 | [
"-# import sys",
"-# import math #sqrt,gcd,pi",
"-# import decimal",
"-# import queue # queue",
"-# import bisect",
"-# import heapq # priolity-queue",
"-# import time",
"-# from itertools import product,permutations,\\",
"-# combinations,combinations_with_replacement",
"-# 重複あり順列、順列、組み合わせ、重複あ... | false | 0.037115 | 0.036784 | 1.008998 | [
"s268516908",
"s688349195"
] |
u150984829 | p00447 | python | s537141275 | s725148039 | 960 | 100 | 5,632 | 6,048 | Accepted | Accepted | 89.58 | def f(e):
a=[list(map(int,input().split()))for _ in[0]*int(e)]
b=[list(map(int,input().split()))for _ in[0]*int(input())]
for s,t in b:
u,v=a[0]
x,y=s-u,t-v
for u,v in a:
if[u+x,v+y]not in b:break
else:return print(x,y)
for e in iter(input,'0'):f(e)
| while True:
m = int(eval(input()))
if m == 0: break
star = list({tuple(map(int, input().split())) for i in range(m)})
sx, sy = star[0]
n = int(eval(input()))
starset = {tuple(map(int, input().split())) for i in range(n)}
for x, y in starset:
flag = True
for j i... | 10 | 22 | 273 | 594 | def f(e):
a = [list(map(int, input().split())) for _ in [0] * int(e)]
b = [list(map(int, input().split())) for _ in [0] * int(input())]
for s, t in b:
u, v = a[0]
x, y = s - u, t - v
for u, v in a:
if [u + x, v + y] not in b:
break
else:
... | while True:
m = int(eval(input()))
if m == 0:
break
star = list({tuple(map(int, input().split())) for i in range(m)})
sx, sy = star[0]
n = int(eval(input()))
starset = {tuple(map(int, input().split())) for i in range(n)}
for x, y in starset:
flag = True
for j in range... | false | 54.545455 | [
"-def f(e):",
"- a = [list(map(int, input().split())) for _ in [0] * int(e)]",
"- b = [list(map(int, input().split())) for _ in [0] * int(input())]",
"- for s, t in b:",
"- u, v = a[0]",
"- x, y = s - u, t - v",
"- for u, v in a:",
"- if [u + x, v + y] not in b... | false | 0.040155 | 0.101111 | 0.397136 | [
"s537141275",
"s725148039"
] |
u347640436 | p02936 | python | s740541683 | s458937733 | 1,911 | 1,361 | 268,008 | 33,412 | Accepted | Accepted | 28.78 | import sys
sys.setrecursionlimit(1000000)
def main():
_map = map
_input = input
_int = int
def calc_results(results, pvalue, i):
results[i] = pvalue + values[i]
for j in childrens[i]:
calc_results(results, results[i], j)
n, q = _map(_int, _input().split())
values = [0] * (n + 1)
... | n, q = list(map(int, input().split()))
values = [0] * (n + 1)
parents = [0] * (n + 1)
results = [0] * (n + 1)
for i in range(n - 1):
a, b = list(map(int, input().split()))
parents[b] = a
for _ in range(q):
p, x = list(map(int, input().split()))
values[p] += x
for i in range(1, n + 1):
results[i] = ... | 23 | 15 | 652 | 421 | import sys
sys.setrecursionlimit(1000000)
def main():
_map = map
_input = input
_int = int
def calc_results(results, pvalue, i):
results[i] = pvalue + values[i]
for j in childrens[i]:
calc_results(results, results[i], j)
n, q = _map(_int, _input().split())
values... | n, q = list(map(int, input().split()))
values = [0] * (n + 1)
parents = [0] * (n + 1)
results = [0] * (n + 1)
for i in range(n - 1):
a, b = list(map(int, input().split()))
parents[b] = a
for _ in range(q):
p, x = list(map(int, input().split()))
values[p] += x
for i in range(1, n + 1):
results[i] = v... | false | 34.782609 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000)",
"-",
"-",
"-def main():",
"- _map = map",
"- _input = input",
"- _int = int",
"-",
"- def calc_results(results, pvalue, i):",
"- results[i] = pvalue + values[i]",
"- for j in childrens[i]:",
"- calc... | false | 0.049205 | 0.047738 | 1.03072 | [
"s740541683",
"s458937733"
] |
u197300773 | p02844 | python | s096041371 | s996075096 | 114 | 55 | 10,340 | 14,376 | Accepted | Accepted | 51.75 | def main():
N=int(eval(input()))
s=eval(input())
ind=[[0 for j in range(10)] for i in range(N)]
first=[-1 for i in range(10)]
last=[-1 for i in range(10)]
k=int(s[0])
first[k]=0
last[k]=0
ind[0][k]=1
for i in range(1,len(s)):
k=int(s[i])
if first[k... | def main():
from itertools import accumulate as acc
N=int(eval(input()))
s=eval(input())
ind=[[0 for j in range(N)] for i in range(10)]
first=[-1 for i in range(10)]
last=[-1 for i in range(10)]
for i in range(len(s)):
k=int(s[i])
if first[k]==-1: first[k]=i
... | 33 | 32 | 748 | 734 | def main():
N = int(eval(input()))
s = eval(input())
ind = [[0 for j in range(10)] for i in range(N)]
first = [-1 for i in range(10)]
last = [-1 for i in range(10)]
k = int(s[0])
first[k] = 0
last[k] = 0
ind[0][k] = 1
for i in range(1, len(s)):
k = int(s[i])
if fi... | def main():
from itertools import accumulate as acc
N = int(eval(input()))
s = eval(input())
ind = [[0 for j in range(N)] for i in range(10)]
first = [-1 for i in range(10)]
last = [-1 for i in range(10)]
for i in range(len(s)):
k = int(s[i])
if first[k] == -1:
f... | false | 3.030303 | [
"+ from itertools import accumulate as acc",
"+",
"- ind = [[0 for j in range(10)] for i in range(N)]",
"+ ind = [[0 for j in range(N)] for i in range(10)]",
"- k = int(s[0])",
"- first[k] = 0",
"- last[k] = 0",
"- ind[0][k] = 1",
"- for i in range(1, len(s)):",
"+ for i... | false | 0.036988 | 0.046148 | 0.801501 | [
"s096041371",
"s996075096"
] |
u380524497 | p02701 | python | s993442586 | s600706074 | 274 | 98 | 31,284 | 30,992 | Accepted | Accepted | 64.23 | n = int(eval(input()))
results = {eval(input()) for _ in range(n)}
print((len(results))) | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
items = {input().rstrip() for _ in range(n)}
print((len(items)))
if __name__ == "__main__":
main() | 3 | 12 | 76 | 194 | n = int(eval(input()))
results = {eval(input()) for _ in range(n)}
print((len(results)))
| import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
items = {input().rstrip() for _ in range(n)}
print((len(items)))
if __name__ == "__main__":
main()
| false | 75 | [
"-n = int(eval(input()))",
"-results = {eval(input()) for _ in range(n)}",
"-print((len(results)))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ n = int(eval(input()))",
"+ items = {input().rstrip() for _ in range(n)}",
"+ print((len(items)))",
"+... | false | 0.034262 | 0.035169 | 0.974222 | [
"s993442586",
"s600706074"
] |
u729133443 | p03700 | python | s145778709 | s058010248 | 1,429 | 628 | 14,092 | 26,668 | Accepted | Accepted | 56.05 | n,a,b,*h=list(map(int,open(0).read().split()))
i,j=0,2**30
while~i+j:
k=c=(j+i)//2
for t in h:c+=min(0,(b*k-t)//(a-b))
if c<0:i=k
else:j=k
print(j) | from numpy import*
t,*h=open(0)
_,a,b=int32(t.split())
i,j=0,2**30
while~i+j:
k=(j+i)//2;t=(b*k-int32(h))//(a-b)
if-k>sum(t[t<0]):i=k
else:j=k
print(j) | 8 | 9 | 152 | 162 | n, a, b, *h = list(map(int, open(0).read().split()))
i, j = 0, 2**30
while ~i + j:
k = c = (j + i) // 2
for t in h:
c += min(0, (b * k - t) // (a - b))
if c < 0:
i = k
else:
j = k
print(j)
| from numpy import *
t, *h = open(0)
_, a, b = int32(t.split())
i, j = 0, 2**30
while ~i + j:
k = (j + i) // 2
t = (b * k - int32(h)) // (a - b)
if -k > sum(t[t < 0]):
i = k
else:
j = k
print(j)
| false | 11.111111 | [
"-n, a, b, *h = list(map(int, open(0).read().split()))",
"+from numpy import *",
"+",
"+t, *h = open(0)",
"+_, a, b = int32(t.split())",
"- k = c = (j + i) // 2",
"- for t in h:",
"- c += min(0, (b * k - t) // (a - b))",
"- if c < 0:",
"+ k = (j + i) // 2",
"+ t = (b * k - ... | false | 0.037068 | 0.200057 | 0.185286 | [
"s145778709",
"s058010248"
] |
u888092736 | p02629 | python | s643452584 | s164297611 | 32 | 27 | 9,080 | 9,184 | Accepted | Accepted | 15.62 | def encode(x):
return chr(x + 97)
N = int(eval(input())) - 1
ans = []
while True:
q, r = divmod(N, 26)
ans.append(r)
if q == 0:
break
N //= 26
N -= 1
print(("".join(map(encode, ans[::-1]))))
| def encode(x):
return chr(x + 97)
def solve(N):
N -= 1
ans = []
while True:
q, r = divmod(N, 26)
ans.append(r)
if q == 0:
break
N //= 26
N -= 1
return "".join(map(encode, ans[::-1]))
print((solve(int(eval(input())))))
| 14 | 18 | 230 | 303 | def encode(x):
return chr(x + 97)
N = int(eval(input())) - 1
ans = []
while True:
q, r = divmod(N, 26)
ans.append(r)
if q == 0:
break
N //= 26
N -= 1
print(("".join(map(encode, ans[::-1]))))
| def encode(x):
return chr(x + 97)
def solve(N):
N -= 1
ans = []
while True:
q, r = divmod(N, 26)
ans.append(r)
if q == 0:
break
N //= 26
N -= 1
return "".join(map(encode, ans[::-1]))
print((solve(int(eval(input())))))
| false | 22.222222 | [
"-N = int(eval(input())) - 1",
"-ans = []",
"-while True:",
"- q, r = divmod(N, 26)",
"- ans.append(r)",
"- if q == 0:",
"- break",
"- N //= 26",
"+def solve(N):",
"-print((\"\".join(map(encode, ans[::-1]))))",
"+ ans = []",
"+ while True:",
"+ q, r = divmod(N... | false | 0.037454 | 0.037562 | 0.99714 | [
"s643452584",
"s164297611"
] |
u790710233 | p03945 | python | s604387539 | s546427941 | 35 | 18 | 3,188 | 3,188 | Accepted | Accepted | 48.57 | s = eval(input())
prev = ans = -1
for c in s:
if prev != c:
prev = c
ans += 1
print(ans) | s = eval(input())
print((s.count('BW') + s.count("WB"))) | 7 | 2 | 108 | 49 | s = eval(input())
prev = ans = -1
for c in s:
if prev != c:
prev = c
ans += 1
print(ans)
| s = eval(input())
print((s.count("BW") + s.count("WB")))
| false | 71.428571 | [
"-prev = ans = -1",
"-for c in s:",
"- if prev != c:",
"- prev = c",
"- ans += 1",
"-print(ans)",
"+print((s.count(\"BW\") + s.count(\"WB\")))"
] | false | 0.038399 | 0.096186 | 0.399218 | [
"s604387539",
"s546427941"
] |
u580697892 | p02832 | python | s306605136 | s487782429 | 120 | 107 | 26,268 | 24,744 | Accepted | Accepted | 10.83 | # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
l = [0]
ans = 0
for i in range(N):
if l[-1] + 1 != A[i]:
ans += 1
else:
l.append(A[i])
if l[-1] == 0:
print((-1))
else:
print(ans) | # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
now = 1
for i in range(N):
if now == A[i]:
now += 1
else:
ans += 1
if now == 1 and N != 1:
print((-1))
else:
print(ans) | 14 | 14 | 242 | 239 | # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
l = [0]
ans = 0
for i in range(N):
if l[-1] + 1 != A[i]:
ans += 1
else:
l.append(A[i])
if l[-1] == 0:
print((-1))
else:
print(ans)
| # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
now = 1
for i in range(N):
if now == A[i]:
now += 1
else:
ans += 1
if now == 1 and N != 1:
print((-1))
else:
print(ans)
| false | 0 | [
"-l = [0]",
"+now = 1",
"- if l[-1] + 1 != A[i]:",
"+ if now == A[i]:",
"+ now += 1",
"+ else:",
"- else:",
"- l.append(A[i])",
"-if l[-1] == 0:",
"+if now == 1 and N != 1:"
] | false | 0.041682 | 0.037325 | 1.116737 | [
"s306605136",
"s487782429"
] |
u193806284 | p03425 | python | s056844289 | s491703926 | 183 | 154 | 9,808 | 10,112 | Accepted | Accepted | 15.85 |
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
ch = "MARCH"
xs = [0] * 5
for s in S:
if s[0] in ch:
i = ch.index(s[0])
xs[i] += 1
from itertools import combinations
def calc(xs):
r = 0
for ys in combinations([0, 1, 2, 3, 4], 3):
r += xs[ys[0]] * xs... | from collections import defaultdict
from itertools import combinations
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
CHARS = "MARCH"
xs = defaultdict(int)
for s in S:
xs[s[0]] += 1
def calc(xs):
return sum(xs[a] * xs[b] * xs[c] for a, b, c in combinations(CHARS, 3))
print((c... | 22 | 17 | 363 | 316 | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
ch = "MARCH"
xs = [0] * 5
for s in S:
if s[0] in ch:
i = ch.index(s[0])
xs[i] += 1
from itertools import combinations
def calc(xs):
r = 0
for ys in combinations([0, 1, 2, 3, 4], 3):
r += xs[ys[0]] * xs[ys[1]] * xs[ys[2]]
... | from collections import defaultdict
from itertools import combinations
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
CHARS = "MARCH"
xs = defaultdict(int)
for s in S:
xs[s[0]] += 1
def calc(xs):
return sum(xs[a] * xs[b] * xs[c] for a, b, c in combinations(CHARS, 3))
print((calc(xs)))
| false | 22.727273 | [
"+from collections import defaultdict",
"+from itertools import combinations",
"+",
"-ch = \"MARCH\"",
"-xs = [0] * 5",
"+CHARS = \"MARCH\"",
"+xs = defaultdict(int)",
"- if s[0] in ch:",
"- i = ch.index(s[0])",
"- xs[i] += 1",
"-from itertools import combinations",
"+ xs[s... | false | 0.077143 | 0.035429 | 2.177404 | [
"s056844289",
"s491703926"
] |
u761320129 | p02763 | python | s596226142 | s168832162 | 910 | 721 | 171,508 | 176,500 | Accepted | Accepted | 20.77 | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord('a')
class BinaryIndexedTree:
def __init__(self,size):
self.N = size
self.bit = [0]*(size+1)
def add(self,x,w... | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord('a')
class BinaryIndexedTree:
def __init__(self,size):
self.N = size
self.bit = [0]*(size+1)
def add(self,x,w... | 47 | 49 | 1,071 | 1,125 | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord("a")
class BinaryIndexedTree:
def __init__(self, size):
self.N = size
self.bit = [0] * (size + 1)
def add(self, x, w):
... | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord("a")
class BinaryIndexedTree:
def __init__(self, size):
self.N = size
self.bit = [0] * (size + 1)
def add(self, x, w):
... | false | 4.081633 | [
"- def sum(self, x):",
"+ def _sum(self, x):",
"+",
"+ def sum(self, l, r):",
"+ return self._sum(r - 1) - self._sum(l - 1)",
"- b, c = int(b) - 1, int(c) - 1",
"+ b, c = int(b) - 1, int(c)",
"- if bits[i].sum(c) - bits[i].sum(b - 1) > 0:",
"+ if b... | false | 0.09168 | 0.044579 | 2.056581 | [
"s596226142",
"s168832162"
] |
u133936772 | p02911 | python | s059466593 | s558812471 | 267 | 148 | 6,584 | 6,584 | Accepted | Accepted | 44.57 | n, k, q = list(map(int, input().split()))
l = [k-q]*n
for _ in range(q):
a = int(eval(input()))-1
l[a] += 1
for i in l:
print(('Yes' if i>0 else 'No')) | import sys
input = sys.stdin.readline
n, k, q = list(map(int, input().split()))
l = [k-q]*n
for _ in range(q):
a = int(eval(input()))-1
l[a] += 1
for i in l:
print(('Yes' if i>0 else 'No')) | 8 | 11 | 151 | 193 | n, k, q = list(map(int, input().split()))
l = [k - q] * n
for _ in range(q):
a = int(eval(input())) - 1
l[a] += 1
for i in l:
print(("Yes" if i > 0 else "No"))
| import sys
input = sys.stdin.readline
n, k, q = list(map(int, input().split()))
l = [k - q] * n
for _ in range(q):
a = int(eval(input())) - 1
l[a] += 1
for i in l:
print(("Yes" if i > 0 else "No"))
| false | 27.272727 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.045392 | 0.037839 | 1.199595 | [
"s059466593",
"s558812471"
] |
u661290476 | p00009 | python | s865844259 | s753935851 | 1,160 | 850 | 24,092 | 54,456 | Accepted | Accepted | 26.72 |
prime=[False]*1000000
for i in range(2,1001):
for j in range(i*2,1000000,i):
prime[j]=True
while True:
try:
n=int(eval(input()))
except:
break
print((prime[2:n+1].count(False))) | prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000000):
if prime[i]:
for j in range(i*2,1000000,i):
prime[j]=False
np[i]=np[i-1]+prime[i]
while True:
try:
n=int(eval(input()))
except:
break
print((np[n])) | 12 | 14 | 222 | 273 | prime = [False] * 1000000
for i in range(2, 1001):
for j in range(i * 2, 1000000, i):
prime[j] = True
while True:
try:
n = int(eval(input()))
except:
break
print((prime[2 : n + 1].count(False)))
| prime = [True] * 1000000
np = [0] * 1000000
for i in range(2, 1000000):
if prime[i]:
for j in range(i * 2, 1000000, i):
prime[j] = False
np[i] = np[i - 1] + prime[i]
while True:
try:
n = int(eval(input()))
except:
break
print((np[n]))
| false | 14.285714 | [
"-prime = [False] * 1000000",
"-for i in range(2, 1001):",
"- for j in range(i * 2, 1000000, i):",
"- prime[j] = True",
"+prime = [True] * 1000000",
"+np = [0] * 1000000",
"+for i in range(2, 1000000):",
"+ if prime[i]:",
"+ for j in range(i * 2, 1000000, i):",
"+ pr... | false | 1.768683 | 1.561773 | 1.132484 | [
"s865844259",
"s753935851"
] |
u969850098 | p02954 | python | s587074043 | s159891852 | 224 | 125 | 7,196 | 11,672 | Accepted | Accepted | 44.2 | S = list(input())
N = len(S)
# Rについて、左から右に順に数えていく
r_counter = [0]*N
start = 0
even, odd = 0, 0
for i, s in enumerate(S):
if s == 'R':
if (i-start) % 2 == 0:
even += 1
else:
odd += 1
else:
if even > 0 or odd > 0:
if (i-start) % 2 == 0:
... | S = list(eval(input()))
N = len(S)
counter = [0]*N
# Rについて、左から右に順に数えていく
start = 0
even, odd = 0, 0
for i, s in enumerate(S):
if s == 'R':
if (i-start) % 2 == 0:
even += 1
else:
odd += 1
else:
if even > 0 or odd > 0:
if (i-start) % 2 == ... | 47 | 45 | 1,130 | 1,072 | S = list(input())
N = len(S)
# Rについて、左から右に順に数えていく
r_counter = [0] * N
start = 0
even, odd = 0, 0
for i, s in enumerate(S):
if s == "R":
if (i - start) % 2 == 0:
even += 1
else:
odd += 1
else:
if even > 0 or odd > 0:
if (i - start) % 2 == 0:
... | S = list(eval(input()))
N = len(S)
counter = [0] * N
# Rについて、左から右に順に数えていく
start = 0
even, odd = 0, 0
for i, s in enumerate(S):
if s == "R":
if (i - start) % 2 == 0:
even += 1
else:
odd += 1
else:
if even > 0 or odd > 0:
if (i - start) % 2 == 0:
... | false | 4.255319 | [
"-S = list(input())",
"+S = list(eval(input()))",
"+counter = [0] * N",
"-r_counter = [0] * N",
"- r_counter[i] += even",
"- r_counter[i - 1] += odd",
"+ counter[i] += even",
"+ counter[i - 1] += odd",
"- r_counter[i] += odd"... | false | 0.036888 | 0.036558 | 1.009026 | [
"s587074043",
"s159891852"
] |
u634079249 | p03252 | python | s363399856 | s837761966 | 71 | 42 | 7,080 | 3,864 | Accepted | Accepted | 40.85 | import sys
import os
import math
import string
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]... | import sys
import os
import math
import bisect
import collections
import itertools
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.r... | 46 | 37 | 1,194 | 979 | import sys
import os
import math
import string
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = l... | import sys
import os
import math
import bisect
import collections
import itertools
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().... | false | 19.565217 | [
"-import string",
"+import bisect",
"+import collections",
"+import itertools",
"- S = list(iss())",
"- T = list(iss())",
"- StoT = {}",
"- TtoS = {}",
"- for n in range(ord(\"a\"), ord(\"z\") + 1):",
"- StoT[chr(n)] = 0",
"- TtoS[chr(n)] = 0",
"- for st in zip(... | false | 0.047699 | 0.039297 | 1.213808 | [
"s363399856",
"s837761966"
] |
u929217794 | p02628 | python | s822322986 | s515290321 | 26 | 24 | 9,132 | 9,256 | Accepted | Accepted | 7.69 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k):
ans += p.pop(0)
print(ans) | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = sum(p[:k])
print(ans) | 10 | 8 | 147 | 117 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k):
ans += p.pop(0)
print(ans)
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = sum(p[:k])
print(ans)
| false | 20 | [
"-ans = 0",
"-for i in range(k):",
"- ans += p.pop(0)",
"+ans = sum(p[:k])"
] | false | 0.033708 | 0.130735 | 0.257832 | [
"s822322986",
"s515290321"
] |
u780475861 | p02796 | python | s731207780 | s530158606 | 235 | 216 | 35,096 | 35,200 | Accepted | Accepted | 8.09 | import sys
readline=sys.stdin.readline
read=sys.stdin.read
n=int(readline())
m=list(map(int,read().split()))
robots=list(zip(m,m))
lr=[[i-j,i+j] for i,j in robots]
lr.sort(key=lambda x:x[1])
prep=lr[0][1]
res=1
for l,r in lr[1:]:
if l>=prep:
res+=1
prep=r
print(res)
| import sys
readline=sys.stdin.readline
read=sys.stdin.read
from operator import itemgetter
n=int(readline())
m=list(map(int,read().split()))
robots=list(zip(m,m))
lr=[[i-j,i+j] for i,j in robots]
lr.sort(key=itemgetter(1))
prep=lr[0][1]
res=1
for l,r in lr[1:]:
if l>=prep:
res+=1
prep=r
pri... | 16 | 18 | 287 | 322 | import sys
readline = sys.stdin.readline
read = sys.stdin.read
n = int(readline())
m = list(map(int, read().split()))
robots = list(zip(m, m))
lr = [[i - j, i + j] for i, j in robots]
lr.sort(key=lambda x: x[1])
prep = lr[0][1]
res = 1
for l, r in lr[1:]:
if l >= prep:
res += 1
prep = r
print(res)
| import sys
readline = sys.stdin.readline
read = sys.stdin.read
from operator import itemgetter
n = int(readline())
m = list(map(int, read().split()))
robots = list(zip(m, m))
lr = [[i - j, i + j] for i, j in robots]
lr.sort(key=itemgetter(1))
prep = lr[0][1]
res = 1
for l, r in lr[1:]:
if l >= prep:
res +... | false | 11.111111 | [
"+from operator import itemgetter",
"+",
"-lr.sort(key=lambda x: x[1])",
"+lr.sort(key=itemgetter(1))"
] | false | 0.12751 | 0.084812 | 1.503438 | [
"s731207780",
"s530158606"
] |
u063052907 | p03013 | python | s436918174 | s434324867 | 198 | 60 | 13,212 | 11,884 | Accepted | Accepted | 69.7 | N, M = list(map(int, input().split()))
set_a = set([int(eval(input())) for _ in range(M)])
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N+1):
dp[i] = 0 if i in set_a else dp[i-1] + dp[i-2]
dp[i] %= MOD
ans = dp[N] % MOD
print(ans) | import sys
N, M = list(map(int, input().split()))
# set_a = set([int(input()) for _ in range(M)])
if M > 0:
set_a = set(map(int, sys.stdin))
else:
set_a = set()
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N+1):
dp[i] = 0 if i in set_a else (d... | 13 | 17 | 289 | 362 | N, M = list(map(int, input().split()))
set_a = set([int(eval(input())) for _ in range(M)])
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N + 1):
dp[i] = 0 if i in set_a else dp[i - 1] + dp[i - 2]
dp[i] %= MOD
ans = dp[N] % MOD
print(ans)
| import sys
N, M = list(map(int, input().split()))
# set_a = set([int(input()) for _ in range(M)])
if M > 0:
set_a = set(map(int, sys.stdin))
else:
set_a = set()
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N + 1):
dp[i] = 0 if i in set_a else (dp[i - 1] + dp... | false | 23.529412 | [
"+import sys",
"+",
"-set_a = set([int(eval(input())) for _ in range(M)])",
"+# set_a = set([int(input()) for _ in range(M)])",
"+if M > 0:",
"+ set_a = set(map(int, sys.stdin))",
"+else:",
"+ set_a = set()",
"- dp[i] = 0 if i in set_a else dp[i - 1] + dp[i - 2]",
"- dp[i] %= MOD",
"... | false | 0.036909 | 0.041906 | 0.880769 | [
"s436918174",
"s434324867"
] |
u588341295 | p03652 | python | s128769942 | s789600796 | 491 | 351 | 46,172 | 42,972 | Accepted | Accepted | 28.51 | # -*- coding: utf-8 -*-
import sys
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(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
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(c)] for j in range(b)] for i in ... | 49 | 47 | 1,328 | 1,276 | # -*- coding: utf-8 -*-
import sys
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(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
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(c)] for j in rang... | false | 4.081633 | [
"-A = list2d(N, M, 0)",
"+A = [None] * N",
"- for j, a in enumerate(LIST()):",
"- # データの持ち方を変える",
"- A[i][a - 1] = j",
"+ A[i] = [a - 1 for a in LIST()]",
"- if valid[j] and A[i][j] < mn:",
"- mn = A[i][j]",
"- idx = j",
"- # 一番順位... | false | 0.109211 | 0.094168 | 1.159748 | [
"s128769942",
"s789600796"
] |
u347640436 | p03164 | python | s692662448 | s426409635 | 889 | 203 | 5,452 | 44,784 | Accepted | Accepted | 77.17 | def main():
n, w = [int(e) for e in input().split()]
maxv = 10 ** 3 * n + 1
t = [-1 for i in range(maxv)]
t[0] = w
for _ in range(n):
nw, nv = [int(e) for e in input().split()]
for i in range(maxv - 1, -1, -1):
if t[i] == -1:
continue
if t[i + nv] < t[i] - nw:
t[... | def main():
n, w = [int(e) for e in input().split()]
maxv = 10 ** 3 * n + 1
t = [-1 for i in range(maxv)]
t[0] = w
cmaxv = 0
for _ in range(n):
nw, nv = [int(e) for e in input().split()]
for i in range(cmaxv, -1, -1):
if t[i] == -1:
continue
if t[i + nv] < t[i] - nw:
... | 18 | 17 | 444 | 427 | def main():
n, w = [int(e) for e in input().split()]
maxv = 10**3 * n + 1
t = [-1 for i in range(maxv)]
t[0] = w
for _ in range(n):
nw, nv = [int(e) for e in input().split()]
for i in range(maxv - 1, -1, -1):
if t[i] == -1:
continue
if t[i + nv... | def main():
n, w = [int(e) for e in input().split()]
maxv = 10**3 * n + 1
t = [-1 for i in range(maxv)]
t[0] = w
cmaxv = 0
for _ in range(n):
nw, nv = [int(e) for e in input().split()]
for i in range(cmaxv, -1, -1):
if t[i] == -1:
continue
... | false | 5.555556 | [
"+ cmaxv = 0",
"- for i in range(maxv - 1, -1, -1):",
"+ for i in range(cmaxv, -1, -1):",
"- for i in range(maxv - 1, 0, -1):",
"- if t[i] == -1:",
"- continue",
"- print(i)",
"- break",
"+ if cmaxv < i + nv:",
"+ ... | false | 0.047359 | 0.084087 | 0.563213 | [
"s692662448",
"s426409635"
] |
u724687935 | p02850 | python | s500713057 | s269339831 | 526 | 472 | 75,112 | 44,648 | Accepted | Accepted | 10.27 | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(v, c):
nc = 0
k = 0
for nv, idx in edge[v]:
if status[nv] == 0:
nc = nc + 1 + ((nc + 1) == c)
color[idx] = nc
status[nv] = 1
k = max(k, dfs(nv, nc))
return max(nc, k)
N = int(eva... | import sys
from collections import deque
N = int(input())
edge = [[] for _ in range(N)]
for i, s in enumerate(sys.stdin.readlines()):
a, b = map(int, s.split())
a -= 1; b -= 1
edge[a].append((b, i))
edge[b].append((a, i))
path = [None] * (N - 1)
q = deque()
q.append((0, 0))
while q... | 31 | 29 | 637 | 575 | import sys
sys.setrecursionlimit(10**6)
def dfs(v, c):
nc = 0
k = 0
for nv, idx in edge[v]:
if status[nv] == 0:
nc = nc + 1 + ((nc + 1) == c)
color[idx] = nc
status[nv] = 1
k = max(k, dfs(nv, nc))
return max(nc, k)
N = int(eval(input()))
edge ... | import sys
from collections import deque
N = int(input())
edge = [[] for _ in range(N)]
for i, s in enumerate(sys.stdin.readlines()):
a, b = map(int, s.split())
a -= 1
b -= 1
edge[a].append((b, i))
edge[b].append((a, i))
path = [None] * (N - 1)
q = deque()
q.append((0, 0))
while q:
v, pc = q.po... | false | 6.451613 | [
"+from collections import deque",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def dfs(v, c):",
"- nc = 0",
"- k = 0",
"- for nv, idx in edge[v]:",
"- if status[nv] == 0:",
"- nc = nc + 1 + ((nc + 1) == c)",
"- color[idx] = nc",
"- status[nv] = ... | false | 0.064177 | 0.035223 | 1.822006 | [
"s500713057",
"s269339831"
] |
u647999897 | p02660 | python | s853239966 | s234685697 | 450 | 95 | 69,140 | 68,320 | Accepted | Accepted | 78.89 | import math
def solve():
N = int(eval(input()))
divisors = calc_divisors(N)
divisors.sort()
now = N
i = 1
ans = 0
while i != len(divisors):
if isPrime(divisors[i]) and now % divisors[i] == 0:
now /= divisors[i]
ans += 1
else:
... | import math
from collections import Counter
def solve():
N = int(eval(input()))
primeFac = prime_factorize(N)
counter = Counter(primeFac)
divisors = []
for key, val in list(counter.items()):
for i in range(1,val+1):
divisors.append(pow(key,i))
divisors.sort()
... | 76 | 36 | 1,674 | 796 | import math
def solve():
N = int(eval(input()))
divisors = calc_divisors(N)
divisors.sort()
now = N
i = 1
ans = 0
while i != len(divisors):
if isPrime(divisors[i]) and now % divisors[i] == 0:
now /= divisors[i]
ans += 1
else:
if len(set(p... | import math
from collections import Counter
def solve():
N = int(eval(input()))
primeFac = prime_factorize(N)
counter = Counter(primeFac)
divisors = []
for key, val in list(counter.items()):
for i in range(1, val + 1):
divisors.append(pow(key, i))
divisors.sort()
now = ... | false | 52.631579 | [
"+from collections import Counter",
"- divisors = calc_divisors(N)",
"+ primeFac = prime_factorize(N)",
"+ counter = Counter(primeFac)",
"+ divisors = []",
"+ for key, val in list(counter.items()):",
"+ for i in range(1, val + 1):",
"+ divisors.append(pow(key, i))",
... | false | 0.270078 | 0.068405 | 3.948195 | [
"s853239966",
"s234685697"
] |
u057109575 | p02838 | python | s735530015 | s457931152 | 517 | 246 | 156,044 | 136,428 | Accepted | Accepted | 52.42 | N, *A = list(map(int, open(0).read().split()))
MOD = 10 ** 9 + 7
ans = 0
for bit in range(60):
ctr = [0, 0]
for i in range(N):
ctr[A[i] >> bit & 1] += 1
ans += (1 << bit) * (ctr[0] * ctr[1])
ans %= MOD
print(ans)
| N, *A = list(map(int, open(0).read().split()))
mod = 10 ** 9 + 7
ans = 0
for bit in range(60):
ctr = [0, 0]
for i in range(N):
ctr[A[i] >> bit & 1] += 1
ans += (1 << bit) * (ctr[0] * ctr[1])
ans %=mod
print(ans)
| 12 | 11 | 248 | 241 | N, *A = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
ans = 0
for bit in range(60):
ctr = [0, 0]
for i in range(N):
ctr[A[i] >> bit & 1] += 1
ans += (1 << bit) * (ctr[0] * ctr[1])
ans %= MOD
print(ans)
| N, *A = list(map(int, open(0).read().split()))
mod = 10**9 + 7
ans = 0
for bit in range(60):
ctr = [0, 0]
for i in range(N):
ctr[A[i] >> bit & 1] += 1
ans += (1 << bit) * (ctr[0] * ctr[1])
ans %= mod
print(ans)
| false | 8.333333 | [
"-MOD = 10**9 + 7",
"+mod = 10**9 + 7",
"- ans %= MOD",
"+ ans %= mod"
] | false | 0.0457 | 0.04555 | 1.003299 | [
"s735530015",
"s457931152"
] |
u255555420 | p03730 | python | s808832638 | s594132179 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b,c =list(map(int,input().split()))
D=[]
for n in range(1, 10000):
if((a * n) % b) == c:
D.append("Y")
if len(D)>0:
print("YES")
else:
print("NO")
| A, B, C = list(map(int,input().split()))
for i in range(100):
if A*i%B==C:
print("YES")
break
else:
print("NO") | 15 | 9 | 198 | 147 | a, b, c = list(map(int, input().split()))
D = []
for n in range(1, 10000):
if ((a * n) % b) == c:
D.append("Y")
if len(D) > 0:
print("YES")
else:
print("NO")
| A, B, C = list(map(int, input().split()))
for i in range(100):
if A * i % B == C:
print("YES")
break
else:
print("NO")
| false | 40 | [
"-a, b, c = list(map(int, input().split()))",
"-D = []",
"-for n in range(1, 10000):",
"- if ((a * n) % b) == c:",
"- D.append(\"Y\")",
"-if len(D) > 0:",
"- print(\"YES\")",
"+A, B, C = list(map(int, input().split()))",
"+for i in range(100):",
"+ if A * i % B == C:",
"+ ... | false | 0.060559 | 0.042295 | 1.43182 | [
"s808832638",
"s594132179"
] |
u562935282 | p03043 | python | s361724768 | s992791745 | 40 | 30 | 2,940 | 2,940 | Accepted | Accepted | 25 | n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
p = 1 / n
while i < k:
p /= 2
i *= 2
ans += p
print(ans)
| def main():
N, K = list(map(int, input().split()))
np = 0
for x in range(1, N + 1):
p = 1
while x < K:
p *= 1 / 2
x *= 2
np += p
ans = np / N
print(ans)
if __name__ == '__main__':
main()
# import sys
# input = sys.stdin.re... | 10 | 35 | 162 | 626 | n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
p = 1 / n
while i < k:
p /= 2
i *= 2
ans += p
print(ans)
| def main():
N, K = list(map(int, input().split()))
np = 0
for x in range(1, N + 1):
p = 1
while x < K:
p *= 1 / 2
x *= 2
np += p
ans = np / N
print(ans)
if __name__ == "__main__":
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecurs... | false | 71.428571 | [
"-n, k = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(1, n + 1):",
"- p = 1 / n",
"- while i < k:",
"- p /= 2",
"- i *= 2",
"- ans += p",
"-print(ans)",
"+def main():",
"+ N, K = list(map(int, input().split()))",
"+ np = 0",
"+ for x in range... | false | 0.052108 | 0.055685 | 0.935771 | [
"s361724768",
"s992791745"
] |
u765325669 | p03244 | python | s031302605 | s690732646 | 192 | 144 | 14,612 | 14,648 | Accepted | Accepted | 25 | n = int(eval(input()))
lst = str(eval(input())).split(' ')
p1 = [0]*(max([int(i) for i in lst])+1)
p2 = [0]*(max([int(i) for i in lst])+1)
for idx in range(n):
if idx%2 == 0:
p1[int(lst[idx])] += 1
else:
p2[int(lst[idx])] += 1
pp1 = p1.index(max(p1))
pp2 = p2.index(max(p2))
if pp1 == pp2:
if max(... | n = int(eval(input()))
lst = str(eval(input())).split(' ')
p1 = [0]*(max([int(i) for i in lst])+1)
p2 = [0]*(max([int(i) for i in lst])+1)
for idx in range(n):
if idx%2 == 0:
p1[int(lst[idx])] += 1
else:
p2[int(lst[idx])] += 1
if p1.index(max(p1)) == p2.index(max(p2)):
print((min(n-max(p1)-sorted(... | 30 | 39 | 612 | 850 | n = int(eval(input()))
lst = str(eval(input())).split(" ")
p1 = [0] * (max([int(i) for i in lst]) + 1)
p2 = [0] * (max([int(i) for i in lst]) + 1)
for idx in range(n):
if idx % 2 == 0:
p1[int(lst[idx])] += 1
else:
p2[int(lst[idx])] += 1
pp1 = p1.index(max(p1))
pp2 = p2.index(max(p2))
if pp1 == p... | n = int(eval(input()))
lst = str(eval(input())).split(" ")
p1 = [0] * (max([int(i) for i in lst]) + 1)
p2 = [0] * (max([int(i) for i in lst]) + 1)
for idx in range(n):
if idx % 2 == 0:
p1[int(lst[idx])] += 1
else:
p2[int(lst[idx])] += 1
if p1.index(max(p1)) == p2.index(max(p2)):
print((min(n... | false | 23.076923 | [
"+if p1.index(max(p1)) == p2.index(max(p2)):",
"+ print((min(n - max(p1) - sorted(p2)[-2], n - sorted(p1)[-2] - max(p2))))",
"+else:",
"+ print((n - max(p1) - max(p2)))",
"+\"\"\"",
"- if max(p1) + sorted(p2)[-2] >= sorted(p1)[-2] + max(p2):",
"- pp2 = p2.index(sorted(p2)[-2])",
"- ... | false | 0.008188 | 0.117382 | 0.069752 | [
"s031302605",
"s690732646"
] |
u440566786 | p02916 | python | s327481193 | s438856869 | 181 | 160 | 38,256 | 38,384 | Accepted | Accepted | 11.6 | def resolve():
n=int(eval(input()))
A=list([int(x)-1 for x in input().split()])
ans=sum(map(int,input().split()))
C=list(map(int,input().split()))
for i in range(n-1):
if A[i+1]-A[i]==1: ans+=C[A[i]]
print(ans)
resolve() | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=sum(B)
for i in range(n-1):
... | 11 | 17 | 261 | 398 | def resolve():
n = int(eval(input()))
A = list([int(x) - 1 for x in input().split()])
ans = sum(map(int, input().split()))
C = list(map(int, input().split()))
for i in range(n - 1):
if A[i + 1] - A[i] == 1:
ans += C[A[i]]
print(ans)
resolve()
| import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum(B)
for i in... | false | 35.294118 | [
"+import sys",
"+",
"+sys.setrecursionlimit(2147483647)",
"+INF = float(\"inf\")",
"+MOD = 10**9 + 7",
"+input = lambda: sys.stdin.readline().rstrip()",
"+",
"+",
"- A = list([int(x) - 1 for x in input().split()])",
"- ans = sum(map(int, input().split()))",
"+ A = list(map(int, input().... | false | 0.043681 | 0.045225 | 0.965855 | [
"s327481193",
"s438856869"
] |
u888933875 | p02547 | python | s965530577 | s488978104 | 34 | 30 | 9,088 | 9,228 | Accepted | Accepted | 11.76 | n=int(eval(input()))
l = [list(map(int,input().split())) for i in range(n)]
ans='No'
for i in range(n-2):
if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
ans='Yes'
break
print(ans) | n=int(eval(input()))
l = [list(map(int,input().split())) for i in range(n)]
ans='No'
for i in range(n-2):
if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
ans='Yes'
print(ans) | 11 | 10 | 238 | 223 | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
ans = "No"
for i in range(n - 2):
if l[i][0] == l[i][1] and l[i + 1][0] == l[i + 1][1] and l[i + 2][0] == l[i + 2][1]:
ans = "Yes"
break
print(ans)
| n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
ans = "No"
for i in range(n - 2):
if l[i][0] == l[i][1] and l[i + 1][0] == l[i + 1][1] and l[i + 2][0] == l[i + 2][1]:
ans = "Yes"
print(ans)
| false | 9.090909 | [
"- break"
] | false | 0.036088 | 0.054884 | 0.657533 | [
"s965530577",
"s488978104"
] |
u054514819 | p03329 | python | s039502214 | s177375477 | 1,182 | 102 | 3,828 | 69,020 | Accepted | Accepted | 91.37 | N = int(eval(input()))
from math import log
max6 = int(log(N, 6))
max9 = int(log(N, 9))
dp = [10**18]*(N+1)
dp[0] = 0
for i in range(1, N+1):
dp[i] = dp[i-1]+1
for j in range(max6+2):
if 6**j>i:
break
dp[i] = min(dp[i-6**j]+1, dp[i])
for k in range(max9+2):
... | N = int(eval(input()))
dp = [0]*(10**5+1)
for i in range(1, 10**5+1):
dp[i] = dp[i-1]+1
cnt = 0
while 6**cnt<=i:
dp[i] = min(dp[i], dp[i-6**cnt]+1)
cnt += 1
cnt = 0
while 9**cnt<=i:
dp[i] = min(dp[i], dp[i-9**cnt]+1)
cnt += 1
print((dp[N])) | 19 | 14 | 403 | 259 | N = int(eval(input()))
from math import log
max6 = int(log(N, 6))
max9 = int(log(N, 9))
dp = [10**18] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
dp[i] = dp[i - 1] + 1
for j in range(max6 + 2):
if 6**j > i:
break
dp[i] = min(dp[i - 6**j] + 1, dp[i])
for k in range(max9 + 2):
... | N = int(eval(input()))
dp = [0] * (10**5 + 1)
for i in range(1, 10**5 + 1):
dp[i] = dp[i - 1] + 1
cnt = 0
while 6**cnt <= i:
dp[i] = min(dp[i], dp[i - 6**cnt] + 1)
cnt += 1
cnt = 0
while 9**cnt <= i:
dp[i] = min(dp[i], dp[i - 9**cnt] + 1)
cnt += 1
print((dp[N]))
| false | 26.315789 | [
"-from math import log",
"-",
"-max6 = int(log(N, 6))",
"-max9 = int(log(N, 9))",
"-dp = [10**18] * (N + 1)",
"-dp[0] = 0",
"-for i in range(1, N + 1):",
"+dp = [0] * (10**5 + 1)",
"+for i in range(1, 10**5 + 1):",
"- for j in range(max6 + 2):",
"- if 6**j > i:",
"- break"... | false | 0.508106 | 2.058133 | 0.246877 | [
"s039502214",
"s177375477"
] |
u340781749 | p02590 | python | s614298540 | s612597077 | 761 | 425 | 76,888 | 76,740 | Accepted | Accepted | 44.15 | import sys
import numpy as np
n, *aaa = list(map(int, sys.stdin.buffer.read().split()))
aaa = [a for a in aaa if a != 0]
n = len(aaa)
fft_len = 1 << 19
P = 200003
PR = 2
convert = [0] * P
rev_con = [0] * P
rev_con[0] = 1
tmp = 1
for i in range(1, P):
tmp = tmp * PR % P
convert[tmp] = i
... | import sys
import numpy as np
n, *aaa = list(map(int, sys.stdin.buffer.read().split()))
aaa = [a for a in aaa if a != 0]
fft_len = 1 << 19
P = 200003
PR = 2
convert = [0] * P
rev_con = [0] * P
rev_con[0] = 1
tmp = 1
for i in range(1, P):
tmp = tmp * PR % P
convert[tmp] = i
rev_con[i] = t... | 34 | 36 | 623 | 740 | import sys
import numpy as np
n, *aaa = list(map(int, sys.stdin.buffer.read().split()))
aaa = [a for a in aaa if a != 0]
n = len(aaa)
fft_len = 1 << 19
P = 200003
PR = 2
convert = [0] * P
rev_con = [0] * P
rev_con[0] = 1
tmp = 1
for i in range(1, P):
tmp = tmp * PR % P
convert[tmp] = i
rev_con[i] = tmp
ans... | import sys
import numpy as np
n, *aaa = list(map(int, sys.stdin.buffer.read().split()))
aaa = [a for a in aaa if a != 0]
fft_len = 1 << 19
P = 200003
PR = 2
convert = [0] * P
rev_con = [0] * P
rev_con[0] = 1
tmp = 1
for i in range(1, P):
tmp = tmp * PR % P
convert[tmp] = i
rev_con[i] = tmp
self_pair_produc... | false | 5.555556 | [
"-n = len(aaa)",
"-ans = 0",
"+self_pair_products = 0",
"- ans -= a * a % P",
"+ self_pair_products += a * a % P",
"-for i, c in enumerate(g):",
"- if c != 0:",
"- ans += rev_con[i % (P - 1)] * int(c + 1e-6)",
"+g[: P - 1] += g[P - 1 : 2 * (P - 1)]",
"+g[: fft_len - 2 * (P - 1)] +=... | false | 0.843681 | 0.502881 | 1.677693 | [
"s614298540",
"s612597077"
] |
u460737328 | p03102 | python | s835282410 | s334770782 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]
res = 0
for i in range(N):
sum = 0
for j in range(M):
sum += alist[i][j] * blist[j]
if sum + C > 0:
res += 1
print(res) | N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]
print((sum([1 if sum(t[0]*t[1] for t in zip(alist[i], blist)) + C > 0 else 0 for i in range(N)]))) | 12 | 5 | 295 | 237 | N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]
res = 0
for i in range(N):
sum = 0
for j in range(M):
sum += alist[i][j] * blist[j]
if sum + C > 0:
res += 1
print(res)
| N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]
print(
(
sum(
[
1 if sum(t[0] * t[1] for t in zip(alist[i], blist)) + C > 0 else 0
for i in range(N)
]
... | false | 58.333333 | [
"-res = 0",
"-for i in range(N):",
"- sum = 0",
"- for j in range(M):",
"- sum += alist[i][j] * blist[j]",
"- if sum + C > 0:",
"- res += 1",
"-print(res)",
"+print(",
"+ (",
"+ sum(",
"+ [",
"+ 1 if sum(t[0] * t[1] for t in zip(alis... | false | 0.055661 | 0.058169 | 0.956885 | [
"s835282410",
"s334770782"
] |
u645250356 | p03324 | python | s139623464 | s928828661 | 210 | 38 | 38,636 | 5,196 | Accepted | Accepted | 81.9 | from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sy... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 16 | 14 | 486 | 400 | from collections import Counter, defaultdict, deque
import sys, bisect, math, itertools, string, queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str(... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 12.5 | [
"-import sys, bisect, math, itertools, string, queue",
"-from heapq import heappop, heappush",
"+from heapq import heappop, heappush, heapify",
"+import sys, bisect, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys.stdin.readline().split())",
"-",... | false | 0.065849 | 0.037207 | 1.769797 | [
"s139623464",
"s928828661"
] |
u094999522 | p03050 | python | s350163227 | s469124831 | 146 | 120 | 9,296 | 9,260 | Accepted | Accepted | 17.81 | n = int(eval(input()))
ans = 0
for i in range(1, int((n + 1)**0.5)):
if n % i == 0:
ans += n // i - 1
print(ans)
| n=int(eval(input()))
print((sum(n//i-1 for i in range(1,int((n+1)**0.5)) if n%i<1)))
| 6 | 2 | 124 | 78 | n = int(eval(input()))
ans = 0
for i in range(1, int((n + 1) ** 0.5)):
if n % i == 0:
ans += n // i - 1
print(ans)
| n = int(eval(input()))
print((sum(n // i - 1 for i in range(1, int((n + 1) ** 0.5)) if n % i < 1)))
| false | 66.666667 | [
"-ans = 0",
"-for i in range(1, int((n + 1) ** 0.5)):",
"- if n % i == 0:",
"- ans += n // i - 1",
"-print(ans)",
"+print((sum(n // i - 1 for i in range(1, int((n + 1) ** 0.5)) if n % i < 1)))"
] | false | 0.351496 | 0.295459 | 1.189658 | [
"s350163227",
"s469124831"
] |
u592248346 | p03109 | python | s658194478 | s212717731 | 23 | 17 | 3,316 | 2,940 | Accepted | Accepted | 26.09 | y,m,d = input().split('/')
if int(y)<=2019 and (int(m)<=4 and int(d)<=30):
print("Heisei")
else:
print("TBD") | y,m,d = input().split('/')
if int(y)<=2019 and int(m)<=4 and int(d)<=30: print("Heisei")
else: print("TBD") | 5 | 3 | 121 | 109 | y, m, d = input().split("/")
if int(y) <= 2019 and (int(m) <= 4 and int(d) <= 30):
print("Heisei")
else:
print("TBD")
| y, m, d = input().split("/")
if int(y) <= 2019 and int(m) <= 4 and int(d) <= 30:
print("Heisei")
else:
print("TBD")
| false | 40 | [
"-if int(y) <= 2019 and (int(m) <= 4 and int(d) <= 30):",
"+if int(y) <= 2019 and int(m) <= 4 and int(d) <= 30:"
] | false | 0.047091 | 0.046281 | 1.017495 | [
"s658194478",
"s212717731"
] |
u047796752 | p02804 | python | s823205606 | s470753629 | 352 | 263 | 64,808 | 62,064 | Accepted | Accepted | 25.28 | def inv(x):
return pow(x, MOD-2, MOD)
def C(n, r):
if r>n:
return 0
return fact[n]*inv_table[r]*inv_table[n-r]
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
ans = 0
MOD = 10**9+7
fact = [1]
for i in range(1, N+1):
fact.append(fact[-1]*i%... | import sys
input = sys.stdin.readline
MAX = 10**5+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i-1]*i%MOD
inv[i] = MOD-inv[MOD%i]*(M... | 29 | 36 | 500 | 686 | def inv(x):
return pow(x, MOD - 2, MOD)
def C(n, r):
if r > n:
return 0
return fact[n] * inv_table[r] * inv_table[n - r]
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
ans = 0
MOD = 10**9 + 7
fact = [1]
for i in range(1, N + 1):
fact.append(fact[-1] * i %... | import sys
input = sys.stdin.readline
MAX = 10**5 + 100
MOD = 10**9 + 7
fact = [0] * MAX # fact[i]: i!
inv = [0] * MAX # inv[i]: iの逆元
finv = [0] * MAX # finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % ... | false | 19.444444 | [
"-def inv(x):",
"- return pow(x, MOD - 2, MOD)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+MAX = 10**5 + 100",
"+MOD = 10**9 + 7",
"+fact = [0] * MAX # fact[i]: i!",
"+inv = [0] * MAX # inv[i]: iの逆元",
"+finv = [0] * MAX # finv[i]: i!の逆元",
"+fact[0] = 1",
"+fact[1] = 1",
"+fi... | false | 0.081412 | 0.668486 | 0.121785 | [
"s823205606",
"s470753629"
] |
u327532412 | p02641 | python | s300711968 | s839724073 | 22 | 20 | 9,176 | 9,220 | Accepted | Accepted | 9.09 | X, N = list(map(int, input().split()))
*P, = list(map(int, input().split()))
l = set([i for i in range(-200, 200)]) - set(P)
m = 100000000
ans = 0
for i in l:
if abs(i-X) < m:
ans = i
m =abs(i - X)
print(ans) | X, N = list(map(int, input().split()))
*P, = list(map(int, input().split()))
l = set(range(-200, 200)) - set(P)
m = 10 ** 7
ans = 0
for i in l:
if abs(i - X) < m:
ans = i
m = abs(i - X)
print(ans)
| 10 | 10 | 225 | 214 | X, N = list(map(int, input().split()))
(*P,) = list(map(int, input().split()))
l = set([i for i in range(-200, 200)]) - set(P)
m = 100000000
ans = 0
for i in l:
if abs(i - X) < m:
ans = i
m = abs(i - X)
print(ans)
| X, N = list(map(int, input().split()))
(*P,) = list(map(int, input().split()))
l = set(range(-200, 200)) - set(P)
m = 10**7
ans = 0
for i in l:
if abs(i - X) < m:
ans = i
m = abs(i - X)
print(ans)
| false | 0 | [
"-l = set([i for i in range(-200, 200)]) - set(P)",
"-m = 100000000",
"+l = set(range(-200, 200)) - set(P)",
"+m = 10**7"
] | false | 0.049139 | 0.071951 | 0.682957 | [
"s300711968",
"s839724073"
] |
u508732591 | p02269 | python | s818774461 | s997852585 | 4,380 | 2,400 | 33,124 | 47,776 | Accepted | Accepted | 45.21 | n = int(eval(input()))
s = set()
for i in range(n):
c, m = input().split()
if c[0] == 'i':
s.add(m)
elif c[0] == 'f':
if m in s:
print('yes')
else:
print('no') | n = int(input())
l = []
s = {}
for i in range(n):
c, m = input().split()
if c[0] == 'i':
s[m] = 0
elif c[0] == 'f':
if m in s:
l.append('yes')
else:
l.append('no')
print(*l,sep='\n')
| 12 | 14 | 227 | 258 | n = int(eval(input()))
s = set()
for i in range(n):
c, m = input().split()
if c[0] == "i":
s.add(m)
elif c[0] == "f":
if m in s:
print("yes")
else:
print("no")
| n = int(input())
l = []
s = {}
for i in range(n):
c, m = input().split()
if c[0] == "i":
s[m] = 0
elif c[0] == "f":
if m in s:
l.append("yes")
else:
l.append("no")
print(*l, sep="\n")
| false | 14.285714 | [
"-n = int(eval(input()))",
"-s = set()",
"+n = int(input())",
"+l = []",
"+s = {}",
"- s.add(m)",
"+ s[m] = 0",
"- print(\"yes\")",
"+ l.append(\"yes\")",
"- print(\"no\")",
"+ l.append(\"no\")",
"+print(*l, sep=\"\\n\")"
] | false | 0.034448 | 0.035083 | 0.981918 | [
"s818774461",
"s997852585"
] |
u952708174 | p03380 | python | s587771952 | s863615890 | 1,209 | 65 | 26,924 | 14,060 | Accepted | Accepted | 94.62 | def d_binomial_coefficients(N, A):
if N == 2:
return '{} {}'.format(max(A), min(A))
import numpy
max_a = max(A)
tmp = max_a / 2
idx = numpy.abs(numpy.asarray(A) - tmp).argmin()
ans = '{} {}'.format(max_a, A[idx])
return ans
N = int(eval(input()))
A = [int(i) for i in inpu... | def d_binomial_coefficients(N, A):
max_a = max(A) # comb(n,r)のnをこの値以外にする理由はない
half = max_a / 2 # この値に最も近い整数をcomb(n,r)のrとする
r = -1
tmp = float('inf') # halfとの差の絶対値
for e in A:
if e == max_a:
continue # nと同じものを選んではいけない
diff = abs(e - half)
if diff < tmp... | 13 | 17 | 364 | 537 | def d_binomial_coefficients(N, A):
if N == 2:
return "{} {}".format(max(A), min(A))
import numpy
max_a = max(A)
tmp = max_a / 2
idx = numpy.abs(numpy.asarray(A) - tmp).argmin()
ans = "{} {}".format(max_a, A[idx])
return ans
N = int(eval(input()))
A = [int(i) for i in input().split... | def d_binomial_coefficients(N, A):
max_a = max(A) # comb(n,r)のnをこの値以外にする理由はない
half = max_a / 2 # この値に最も近い整数をcomb(n,r)のrとする
r = -1
tmp = float("inf") # halfとの差の絶対値
for e in A:
if e == max_a:
continue # nと同じものを選んではいけない
diff = abs(e - half)
if diff < tmp: # n/2に... | false | 23.529412 | [
"- if N == 2:",
"- return \"{} {}\".format(max(A), min(A))",
"- import numpy",
"-",
"- max_a = max(A)",
"- tmp = max_a / 2",
"- idx = numpy.abs(numpy.asarray(A) - tmp).argmin()",
"- ans = \"{} {}\".format(max_a, A[idx])",
"+ max_a = max(A) # comb(n,r)のnをこの値以外にする理由はない",
... | false | 0.305621 | 0.035248 | 8.670615 | [
"s587771952",
"s863615890"
] |
u241159583 | p02658 | python | s239530381 | s095632299 | 91 | 82 | 21,568 | 21,552 | Accepted | Accepted | 9.89 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = A[0]
for a in A[1:]:
ans *= a
if ans > 10 ** 18:
print((-1))
exit()
print(ans) | n = int(eval(input()))
A = sorted(list(map(int, input().split())))[::-1]
if 0 in A:
print((0))
exit()
ans = 1
for a in A:
ans *= a
if ans > 10 **18:
print((-1))
exit()
print(ans) | 11 | 13 | 167 | 213 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = A[0]
for a in A[1:]:
ans *= a
if ans > 10**18:
print((-1))
exit()
print(ans)
| n = int(eval(input()))
A = sorted(list(map(int, input().split())))[::-1]
if 0 in A:
print((0))
exit()
ans = 1
for a in A:
ans *= a
if ans > 10**18:
print((-1))
exit()
print(ans)
| false | 15.384615 | [
"-A = list(map(int, input().split()))",
"-A.sort()",
"-ans = A[0]",
"-for a in A[1:]:",
"+A = sorted(list(map(int, input().split())))[::-1]",
"+if 0 in A:",
"+ print((0))",
"+ exit()",
"+ans = 1",
"+for a in A:"
] | false | 0.042352 | 0.042056 | 1.007029 | [
"s239530381",
"s095632299"
] |
u057109575 | p02802 | python | s809746884 | s538926299 | 561 | 228 | 67,416 | 103,796 | Accepted | Accepted | 59.36 | N, M = list(map(int, input().split()))
X = [list(input().split()) for _ in range(M)]
acs = [False] * (N + 1)
was = [0] * (N + 1)
for p, s in X:
if s == "AC":
acs[int(p)] = True
elif not acs[int(p)]:
was[int(p)] += 1
was_cnt = 0
for a, w in zip(acs, was):
if a:
was_c... | N, M = list(map(int, input().split()))
X = []
for _ in range(M):
p, s = input().split()
X.append((int(p), s))
cnt = [[0, 0] for _ in range(N + 1)]
for p, s in X:
if s == "AC":
cnt[p][0] = 1
elif cnt[p][0] == 0:
cnt[p][1] += 1
ac = sum(v for v, _ in cnt)
wa = 0
for i in r... | 18 | 19 | 350 | 391 | N, M = list(map(int, input().split()))
X = [list(input().split()) for _ in range(M)]
acs = [False] * (N + 1)
was = [0] * (N + 1)
for p, s in X:
if s == "AC":
acs[int(p)] = True
elif not acs[int(p)]:
was[int(p)] += 1
was_cnt = 0
for a, w in zip(acs, was):
if a:
was_cnt += w
print((sum... | N, M = list(map(int, input().split()))
X = []
for _ in range(M):
p, s = input().split()
X.append((int(p), s))
cnt = [[0, 0] for _ in range(N + 1)]
for p, s in X:
if s == "AC":
cnt[p][0] = 1
elif cnt[p][0] == 0:
cnt[p][1] += 1
ac = sum(v for v, _ in cnt)
wa = 0
for i in range(N + 1):
... | false | 5.263158 | [
"-X = [list(input().split()) for _ in range(M)]",
"-acs = [False] * (N + 1)",
"-was = [0] * (N + 1)",
"+X = []",
"+for _ in range(M):",
"+ p, s = input().split()",
"+ X.append((int(p), s))",
"+cnt = [[0, 0] for _ in range(N + 1)]",
"- acs[int(p)] = True",
"- elif not acs[int(p)]:",... | false | 0.038562 | 0.039552 | 0.974958 | [
"s809746884",
"s538926299"
] |
u598229387 | p03087 | python | s163490248 | s244235392 | 858 | 574 | 6,104 | 24,088 | Accepted | Accepted | 33.1 | n,q=list(map(int,input().split()))
s=eval(input())
ac_count=[]
ac=0
for i in range(n-1):
if s[i:i+2]=='AC':
ac+=1
ac_count.append(ac)
for i in range(q):
l,r=list(map(int,input().split()))
if l==1:
print((ac_count[r-2]))
else:
print((ac_count[r-2]-ac_cou... | import bisect
n,q=list(map(int,input().split()))
s=eval(input())
lr=[[int(i) for i in input().split()] for j in range(q)]
li=[]
for i in range(n-1):
if s[i]+s[i+1]=='AC':
li+=[i]
ans=0
for l,r in lr:
left=bisect.bisect_left(li,l-1)
right=bisect.bisect_right(li,r-2)
print((right-lef... | 17 | 15 | 307 | 316 | n, q = list(map(int, input().split()))
s = eval(input())
ac_count = []
ac = 0
for i in range(n - 1):
if s[i : i + 2] == "AC":
ac += 1
ac_count.append(ac)
for i in range(q):
l, r = list(map(int, input().split()))
if l == 1:
print((ac_count[r - 2]))
else:
print((ac_count[r - 2]... | import bisect
n, q = list(map(int, input().split()))
s = eval(input())
lr = [[int(i) for i in input().split()] for j in range(q)]
li = []
for i in range(n - 1):
if s[i] + s[i + 1] == "AC":
li += [i]
ans = 0
for l, r in lr:
left = bisect.bisect_left(li, l - 1)
right = bisect.bisect_right(li, r - 2)
... | false | 11.764706 | [
"+import bisect",
"+",
"-ac_count = []",
"-ac = 0",
"+lr = [[int(i) for i in input().split()] for j in range(q)]",
"+li = []",
"- if s[i : i + 2] == \"AC\":",
"- ac += 1",
"- ac_count.append(ac)",
"-for i in range(q):",
"- l, r = list(map(int, input().split()))",
"- if l == ... | false | 0.038603 | 0.12676 | 0.304537 | [
"s163490248",
"s244235392"
] |
u492511953 | p02887 | python | s520590901 | s286370473 | 52 | 43 | 3,316 | 3,316 | Accepted | Accepted | 17.31 | n = int(eval(input()))
s = eval(input())
f = 1
while f == 1:
ns = ""
pre_c = s[0]
f = 0
for c in s[1:]:
if c != pre_c:
ns += pre_c
else:
f = 1
pre_c = c
ns += s[-1]
s = ns
print((len(s)))
| n = int(eval(input()))
s = eval(input())
ns = ""
pre_c = s[0]
for c in s[1:]:
if c != pre_c:
ns += pre_c
pre_c = c
ns += s[-1]
s = ns
print((len(s)))
| 18 | 13 | 234 | 163 | n = int(eval(input()))
s = eval(input())
f = 1
while f == 1:
ns = ""
pre_c = s[0]
f = 0
for c in s[1:]:
if c != pre_c:
ns += pre_c
else:
f = 1
pre_c = c
ns += s[-1]
s = ns
print((len(s)))
| n = int(eval(input()))
s = eval(input())
ns = ""
pre_c = s[0]
for c in s[1:]:
if c != pre_c:
ns += pre_c
pre_c = c
ns += s[-1]
s = ns
print((len(s)))
| false | 27.777778 | [
"-f = 1",
"-while f == 1:",
"- ns = \"\"",
"- pre_c = s[0]",
"- f = 0",
"- for c in s[1:]:",
"- if c != pre_c:",
"- ns += pre_c",
"- else:",
"- f = 1",
"- pre_c = c",
"- ns += s[-1]",
"- s = ns",
"+ns = \"\"",
"+pre_c = s[0]",
... | false | 0.11771 | 0.043404 | 2.711981 | [
"s520590901",
"s286370473"
] |
u729133443 | p02883 | python | s489960555 | s369791574 | 648 | 385 | 124,648 | 37,292 | Accepted | Accepted | 40.59 | (_,k),*t=[list(map(int,t.split()))for t in open(0)]
A,F=list(map(sorted,t))
o=10**12
g=-1
while o-g>1:
m,l=o+g>>1,k
for a,f in zip(A,F[::-1]):l-=max(0,a-m//f)
if l<0:g=m
else:o=m
print(o) | from numpy import*
(_,k),*t=[int64(t.split())for t in open(0)]
A,F=list(map(sort,t))
s=sum(A)
l=-1
r=10**12
while r-l>1:
m=l+r>>1
if s-sum(minimum(A,m//F[::-1]))>k:l=m
else:r=m
print(r) | 10 | 11 | 188 | 192 | (_, k), *t = [list(map(int, t.split())) for t in open(0)]
A, F = list(map(sorted, t))
o = 10**12
g = -1
while o - g > 1:
m, l = o + g >> 1, k
for a, f in zip(A, F[::-1]):
l -= max(0, a - m // f)
if l < 0:
g = m
else:
o = m
print(o)
| from numpy import *
(_, k), *t = [int64(t.split()) for t in open(0)]
A, F = list(map(sort, t))
s = sum(A)
l = -1
r = 10**12
while r - l > 1:
m = l + r >> 1
if s - sum(minimum(A, m // F[::-1])) > k:
l = m
else:
r = m
print(r)
| false | 9.090909 | [
"-(_, k), *t = [list(map(int, t.split())) for t in open(0)]",
"-A, F = list(map(sorted, t))",
"-o = 10**12",
"-g = -1",
"-while o - g > 1:",
"- m, l = o + g >> 1, k",
"- for a, f in zip(A, F[::-1]):",
"- l -= max(0, a - m // f)",
"- if l < 0:",
"- g = m",
"+from numpy impo... | false | 0.03722 | 0.189897 | 0.195999 | [
"s489960555",
"s369791574"
] |
u498487134 | p02995 | python | s861178347 | s734414108 | 269 | 65 | 64,876 | 62,216 | Accepted | Accepted | 75.84 | import fractions
A,B,C,D = list(map(int,input().split()))
def div(a,c,d):
ac=a//c
ad=a//d
cd=c*d//fractions.gcd(c,d)
acd=a//cd
return ac+ad-acd
ans=B-(A-1)-(div(B,C,D)-div(A-1,C,D))
print(ans) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
a,b,c,d=MI()
cc=b//c - (a-1)//c
dd=b//d - (a-1)//d
import math
g=(c*d)//math.gcd... | 13 | 20 | 221 | 382 | import fractions
A, B, C, D = list(map(int, input().split()))
def div(a, c, d):
ac = a // c
ad = a // d
cd = c * d // fractions.gcd(c, d)
acd = a // cd
return ac + ad - acd
ans = B - (A - 1) - (div(B, C, D) - div(A - 1, C, D))
print(ans)
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
a, b, c, d = MI()
cc = b // c - (a - 1) // c
dd = b // d - (a - 1) // d
import m... | false | 35 | [
"-import fractions",
"+import sys",
"-A, B, C, D = list(map(int, input().split()))",
"+input = sys.stdin.readline",
"-def div(a, c, d):",
"- ac = a // c",
"- ad = a // d",
"- cd = c * d // fractions.gcd(c, d)",
"- acd = a // cd",
"- return ac + ad - acd",
"+def I():",
"+ retu... | false | 0.048206 | 0.038333 | 1.25758 | [
"s861178347",
"s734414108"
] |
u586759271 | p03062 | python | s934097344 | s273539746 | 537 | 257 | 23,296 | 64,880 | Accepted | Accepted | 52.14 | import numpy as np
n=int(eval(input()))
a=np.array([int(i) for i in input().split()])
if sum(a<0)%2==0: print((sum(abs(a))))
else: print((sum(abs(a))-2*abs(a[(np.argmin(abs(a)))]))) | n=int(eval(input()))
a=list(map(int,input().split()))
n_nega = sum(aa<0 for aa in a)
sumabs = sum(abs(aa) for aa in a)
if n_nega%2==0:
print(sumabs)
else:
mi=min( abs(aa) for aa in a)
print((sumabs-mi*2)) | 6 | 10 | 177 | 218 | import numpy as np
n = int(eval(input()))
a = np.array([int(i) for i in input().split()])
if sum(a < 0) % 2 == 0:
print((sum(abs(a))))
else:
print((sum(abs(a)) - 2 * abs(a[(np.argmin(abs(a)))])))
| n = int(eval(input()))
a = list(map(int, input().split()))
n_nega = sum(aa < 0 for aa in a)
sumabs = sum(abs(aa) for aa in a)
if n_nega % 2 == 0:
print(sumabs)
else:
mi = min(abs(aa) for aa in a)
print((sumabs - mi * 2))
| false | 40 | [
"-import numpy as np",
"-",
"-a = np.array([int(i) for i in input().split()])",
"-if sum(a < 0) % 2 == 0:",
"- print((sum(abs(a))))",
"+a = list(map(int, input().split()))",
"+n_nega = sum(aa < 0 for aa in a)",
"+sumabs = sum(abs(aa) for aa in a)",
"+if n_nega % 2 == 0:",
"+ print(sumabs)",
... | false | 0.169062 | 0.084273 | 2.006112 | [
"s934097344",
"s273539746"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.