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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u567124995 | p03231 | python | s347091683 | s251095259 | 55 | 47 | 5,560 | 5,560 | Accepted | Accepted | 14.55 | import fractions
n, m = list(map(int,input().split()))
s = eval(input())
t = eval(input())
q = fractions.gcd(n, m)
l = n * m // q #lcm(n, m)
p = int(l/n * l/m / fractions.gcd(l/n, l/m)) #lcm(l/n, l/m)
for i in range(0, int(l/p)):
if s[i * p//(l//n)] != t[i * p//(l//m)]:
print('-1')
exit()
print(l) | import fractions
n, m = list(map(int,input().split()))
s = eval(input())
t = eval(input())
q = fractions.gcd(n, m)
l = n * m // q #lcm(n, m)
for i in range(0, q):
if s[i * n//q] != t[i * m//q]:
print('-1')
exit()
print(l) | 12 | 11 | 301 | 223 | import fractions
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
q = fractions.gcd(n, m)
l = n * m // q # lcm(n, m)
p = int(l / n * l / m / fractions.gcd(l / n, l / m)) # lcm(l/n, l/m)
for i in range(0, int(l / p)):
if s[i * p // (l // n)] != t[i * p // (l // m)]:
print("-1")
... | import fractions
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
q = fractions.gcd(n, m)
l = n * m // q # lcm(n, m)
for i in range(0, q):
if s[i * n // q] != t[i * m // q]:
print("-1")
exit()
print(l)
| false | 8.333333 | [
"-p = int(l / n * l / m / fractions.gcd(l / n, l / m)) # lcm(l/n, l/m)",
"-for i in range(0, int(l / p)):",
"- if s[i * p // (l // n)] != t[i * p // (l // m)]:",
"+for i in range(0, q):",
"+ if s[i * n // q] != t[i * m // q]:"
] | false | 0.050429 | 0.155621 | 0.324048 | [
"s347091683",
"s251095259"
] |
u318127926 | p03722 | python | s654563736 | s013303715 | 1,234 | 889 | 3,316 | 3,316 | Accepted | Accepted | 27.96 | n, m = list(map(int, input().split()))
NINF = -10**20
edge = []
dist = [NINF]*n
dist[0] = 0
for _ in range(m):
a, b, c = list(map(int, input().split()))
edge.append((a-1, b-1, c))
for i in range(2*n):
for a, b, c in edge:
if dist[a]!=NINF and dist[b] < dist[a] + c:
dist[b] = d... | n, m = list(map(int, input().split()))
NINF = -10**20
edge = []
dist = [NINF]*n
dist[0] = 0
for _ in range(m):
a, b, c = list(map(int, input().split()))
edge.append((a-1, b-1, c))
for i in range(n):
for a, b, c in edge:
if dist[a]!=NINF and dist[b] < dist[a] + c:
dist[b] = dis... | 16 | 16 | 424 | 422 | n, m = list(map(int, input().split()))
NINF = -(10**20)
edge = []
dist = [NINF] * n
dist[0] = 0
for _ in range(m):
a, b, c = list(map(int, input().split()))
edge.append((a - 1, b - 1, c))
for i in range(2 * n):
for a, b, c in edge:
if dist[a] != NINF and dist[b] < dist[a] + c:
dist[b] = ... | n, m = list(map(int, input().split()))
NINF = -(10**20)
edge = []
dist = [NINF] * n
dist[0] = 0
for _ in range(m):
a, b, c = list(map(int, input().split()))
edge.append((a - 1, b - 1, c))
for i in range(n):
for a, b, c in edge:
if dist[a] != NINF and dist[b] < dist[a] + c:
dist[b] = dist... | false | 0 | [
"-for i in range(2 * n):",
"+for i in range(n):",
"- if i >= n - 1 and b == n - 1:",
"+ if i == n - 1 and b == n - 1:"
] | false | 0.037631 | 0.042821 | 0.878815 | [
"s654563736",
"s013303715"
] |
u875361824 | p03273 | python | s547596531 | s624630287 | 30 | 22 | 4,596 | 4,596 | Accepted | Accepted | 26.67 | def main():
H, W = map(int, input().split())
a = [input() for _ in range(H)]
ans = f(H, W, a)
for x in ans:
print(*x, sep="")
def f(H, W, a):
b = []
for line in a:
if len(line) != line.count("."):
b.append(line)
if not b:
return [[]]
... | def main():
H, W = map(int, input().split())
a = [input() for _ in range(H)]
# ans = f(H, W, a)
ans = T(H, W, a)
for x in ans:
print(*x, sep="")
def T(H, W, a):
"""
転置
本番ではバグらせるのを恐れて愚直に実装した
"""
b = []
c = []
for line in a:
if len(line)... | 40 | 62 | 779 | 1,155 | def main():
H, W = map(int, input().split())
a = [input() for _ in range(H)]
ans = f(H, W, a)
for x in ans:
print(*x, sep="")
def f(H, W, a):
b = []
for line in a:
if len(line) != line.count("."):
b.append(line)
if not b:
return [[]]
idxes = []
f... | def main():
H, W = map(int, input().split())
a = [input() for _ in range(H)]
# ans = f(H, W, a)
ans = T(H, W, a)
for x in ans:
print(*x, sep="")
def T(H, W, a):
"""
転置
本番ではバグらせるのを恐れて愚直に実装した
"""
b = []
c = []
for line in a:
if len(line) != line.count(".")... | false | 35.483871 | [
"- ans = f(H, W, a)",
"+ # ans = f(H, W, a)",
"+ ans = T(H, W, a)",
"+",
"+",
"+def T(H, W, a):",
"+ \"\"\"",
"+ 転置",
"+ 本番ではバグらせるのを恐れて愚直に実装した",
"+ \"\"\"",
"+ b = []",
"+ c = []",
"+ for line in a:",
"+ if len(line) != line.count(\".\"):",
"+ ... | false | 0.042577 | 0.041332 | 1.030119 | [
"s547596531",
"s624630287"
] |
u633068244 | p00149 | python | s642904776 | s658669150 | 20 | 10 | 4,252 | 4,240 | Accepted | Accepted | 50 | rank = [[0,0] for i in range(4)]
while True:
try:
eye = list(map(float, input().split()))
for i in range(2):
if eye[i] >= 1.1: rank[0][i] += 1
elif eye[i] >= 0.6: rank[1][i] += 1
elif eye[i] >= 0.2: rank[2][i] += 1
else: ran... | c = [1.1,0.6,0.2,0.0]
r = [[0,0] for i in range(4)]
while True:
try:
e = list(map(float, input().split()))
for i in range(2):
for j in range(4):
if e[i] >= c[j]:
r[j][i] += 1
break
except:
break
for i in range(4):
... | 13 | 14 | 417 | 341 | rank = [[0, 0] for i in range(4)]
while True:
try:
eye = list(map(float, input().split()))
for i in range(2):
if eye[i] >= 1.1:
rank[0][i] += 1
elif eye[i] >= 0.6:
rank[1][i] += 1
elif eye[i] >= 0.2:
rank[2][i] += 1
... | c = [1.1, 0.6, 0.2, 0.0]
r = [[0, 0] for i in range(4)]
while True:
try:
e = list(map(float, input().split()))
for i in range(2):
for j in range(4):
if e[i] >= c[j]:
r[j][i] += 1
break
except:
break
for i in range(4):
... | false | 7.142857 | [
"-rank = [[0, 0] for i in range(4)]",
"+c = [1.1, 0.6, 0.2, 0.0]",
"+r = [[0, 0] for i in range(4)]",
"- eye = list(map(float, input().split()))",
"+ e = list(map(float, input().split()))",
"- if eye[i] >= 1.1:",
"- rank[0][i] += 1",
"- elif eye[i] >=... | false | 0.038576 | 0.047318 | 0.815257 | [
"s642904776",
"s658669150"
] |
u358957649 | p03030 | python | s221246350 | s215351551 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | def main(N, lst):
L = []
for i in range(len(lst)):
target = lst[i]
L.append({"id":i+1, "store":target[0], "point":int(target[1])})
L.sort(key = lambda x:x["point"], reverse = True)
L.sort(key = lambda x:x["store"])
for i in range(len(L)):
print((L[i]["id"]))
... | def main(N, lst):
L = []
for i in range(len(lst)):
target = lst[i]
L.append({"id":i+1, "store":target[0], "point":int(target[1])})
L.sort(key = lambda x:x["point"], reverse = True)
L.sort(key = lambda x:x["store"])
for i in range(len(L)):
print((L[i]["id"]))
N = in... | 13 | 13 | 413 | 405 | def main(N, lst):
L = []
for i in range(len(lst)):
target = lst[i]
L.append({"id": i + 1, "store": target[0], "point": int(target[1])})
L.sort(key=lambda x: x["point"], reverse=True)
L.sort(key=lambda x: x["store"])
for i in range(len(L)):
print((L[i]["id"]))
N = in... | def main(N, lst):
L = []
for i in range(len(lst)):
target = lst[i]
L.append({"id": i + 1, "store": target[0], "point": int(target[1])})
L.sort(key=lambda x: x["point"], reverse=True)
L.sort(key=lambda x: x["store"])
for i in range(len(L)):
print((L[i]["id"]))
N = int(eval(i... | false | 0 | [
"- L.sort(key=lambda x: x[\"point\"], reverse=True)",
"- L.sort(key=lambda x: x[\"store\"])",
"+ L.sort(key=lambda x: x[\"point\"], reverse=True)",
"+ L.sort(key=lambda x: x[\"store\"])"
] | false | 0.036929 | 0.037992 | 0.972007 | [
"s221246350",
"s215351551"
] |
u738898077 | p02586 | python | s384188635 | s216626398 | 1,457 | 1,082 | 427,464 | 359,796 | Accepted | Accepted | 25.74 | R,C,k = list(map(int,input().split()))
dp0 = [[0]*(C+1) for i in range(R+1)]
dp1 = [[0]*(C+1) for i in range(R+1)]
dp2 = [[0]*(C+1) for i in range(R+1)]
dp3 = [[0]*(C+1) for i in range(R+1)]
item = [[0]*(C+1) for i in range(R+1)]
for i in range(k):
r,c,v = list(map(int,input().split()))
# item[r][c] = v... | R,C,k = list(map(int,input().split()))
dp1 = [[0]*(C+1) for i in range(R+1)]
dp2 = [[0]*(C+1) for i in range(R+1)]
dp3 = [[0]*(C+1) for i in range(R+1)]
item = [[0]*(C+1) for i in range(R+1)]
for i in range(k):
r,c,v = list(map(int,input().split()))
dp1[r][c] = v
for i in range(1,R+1):
for j in r... | 30 | 17 | 1,155 | 574 | R, C, k = list(map(int, input().split()))
dp0 = [[0] * (C + 1) for i in range(R + 1)]
dp1 = [[0] * (C + 1) for i in range(R + 1)]
dp2 = [[0] * (C + 1) for i in range(R + 1)]
dp3 = [[0] * (C + 1) for i in range(R + 1)]
item = [[0] * (C + 1) for i in range(R + 1)]
for i in range(k):
r, c, v = list(map(int, input().sp... | R, C, k = list(map(int, input().split()))
dp1 = [[0] * (C + 1) for i in range(R + 1)]
dp2 = [[0] * (C + 1) for i in range(R + 1)]
dp3 = [[0] * (C + 1) for i in range(R + 1)]
item = [[0] * (C + 1) for i in range(R + 1)]
for i in range(k):
r, c, v = list(map(int, input().split()))
dp1[r][c] = v
for i in range(1, ... | false | 43.333333 | [
"-dp0 = [[0] * (C + 1) for i in range(R + 1)]",
"- # item[r][c] = v",
"-# for i in range(R+1):",
"-# print(item[i])",
"- # a = item[i][j]",
"- # dp0[i][j] = max(dp0[i-1][j],dp1[i-1][j],dp2[i-1][j],dp3[i-1][j],dp0[i][j-1])",
"- # dp1[i][j] = max(dp0[i][j-1]+a,dp1[i][j-1])",
"- ... | false | 0.0378 | 0.035632 | 1.060854 | [
"s384188635",
"s216626398"
] |
u539367121 | p02955 | python | s284123084 | s382842559 | 169 | 99 | 9,516 | 9,364 | Accepted | Accepted | 41.42 | n,k=list(map(int,input().split()))
a=[int(x) for x in input().split()]
s=sum(a)
candidates=set()
for i in range(1,int(s**0.5)+1):
if s%i==0:
candidates.add(i)
candidates.add(s//i)
ans=0
for cdd in candidates:
div_cdd=[0]*n
for i in range(n):
div_cdd[i]=a[i]%cdd
div_cdd=sorted(div_cd... | n,k=list(map(int,input().split()))
a=[int(x) for x in input().split()]
s=sum(a)
candidates=set()
for i in range(1,int(s**0.5)+1):
if s%i==0:
candidates.add(i)
candidates.add(s//i)
ans=0
for cdd in candidates:
f=sorted([x%cdd for x in a])
# calc need
ans=max(ans,cdd) if sum(f[:-sum(f)//cd... | 24 | 17 | 472 | 350 | n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
s = sum(a)
candidates = set()
for i in range(1, int(s**0.5) + 1):
if s % i == 0:
candidates.add(i)
candidates.add(s // i)
ans = 0
for cdd in candidates:
div_cdd = [0] * n
for i in range(n):
div_cdd[i] = a[i]... | n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
s = sum(a)
candidates = set()
for i in range(1, int(s**0.5) + 1):
if s % i == 0:
candidates.add(i)
candidates.add(s // i)
ans = 0
for cdd in candidates:
f = sorted([x % cdd for x in a])
# calc need
ans = max(ans... | false | 29.166667 | [
"- div_cdd = [0] * n",
"- for i in range(n):",
"- div_cdd[i] = a[i] % cdd",
"- div_cdd = sorted(div_cdd)",
"+ f = sorted([x % cdd for x in a])",
"- idx = n - sum(div_cdd) // cdd",
"- need = 0",
"- for i in range(idx):",
"- need += div_cdd[i]",
"- ans = max(ans... | false | 0.037634 | 0.059456 | 0.632973 | [
"s284123084",
"s382842559"
] |
u078276601 | p03338 | python | s946206904 | s808511105 | 33 | 27 | 9,168 | 9,116 | Accepted | Accepted | 18.18 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N-1):
l1 = [0]*26
l2 = [0]*26
for j in S[:i+1]:
if l1[(ord(j)-ord("a"))]==0:
l1[(ord(j)-ord("a"))]=1
for k in S[i+1:]:
if l2[(ord(k)-ord("a"))]==0:
l2[(ord(k)-ord("a"))]=1
cnt = 0
... | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N-1):
set1 = set(S[:i+1])
set2 = set(S[i+1:])
ans = max(ans, len(set1&set2))
print(ans) | 21 | 12 | 423 | 174 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N - 1):
l1 = [0] * 26
l2 = [0] * 26
for j in S[: i + 1]:
if l1[(ord(j) - ord("a"))] == 0:
l1[(ord(j) - ord("a"))] = 1
for k in S[i + 1 :]:
if l2[(ord(k) - ord("a"))] == 0:
l2[(ord(k) - ord("a"))] = 1
... | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N - 1):
set1 = set(S[: i + 1])
set2 = set(S[i + 1 :])
ans = max(ans, len(set1 & set2))
print(ans)
| false | 42.857143 | [
"- l1 = [0] * 26",
"- l2 = [0] * 26",
"- for j in S[: i + 1]:",
"- if l1[(ord(j) - ord(\"a\"))] == 0:",
"- l1[(ord(j) - ord(\"a\"))] = 1",
"- for k in S[i + 1 :]:",
"- if l2[(ord(k) - ord(\"a\"))] == 0:",
"- l2[(ord(k) - ord(\"a\"))] = 1",
"- cnt = ... | false | 0.048215 | 0.048011 | 1.004254 | [
"s946206904",
"s808511105"
] |
u697615293 | p03999 | python | s516384934 | s097047815 | 33 | 29 | 9,212 | 9,096 | Accepted | Accepted | 12.12 | s = eval(input())
l = len(s)
ans = 0
for i in range(2 ** (l -1)):
ans_sub = 0
subst = s[0]
for j in range(l-1):
if(i>>j)&1:
ans_sub += int(subst)
subst = s[j+1]
else:
subst += s[j+1]
if j ==l-2:
ans_sub += int(subst)
... | def dfs(i,f):
if i == s-1:
return sum(map(int,f.split("+")))
return dfs(i+1,f + n[i+1]) + dfs(i+1 , f+ "+" + n[i+1])
n = eval(input())
s = len(n)
print((dfs(0,n[0]))) | 20 | 8 | 383 | 183 | s = eval(input())
l = len(s)
ans = 0
for i in range(2 ** (l - 1)):
ans_sub = 0
subst = s[0]
for j in range(l - 1):
if (i >> j) & 1:
ans_sub += int(subst)
subst = s[j + 1]
else:
subst += s[j + 1]
if j == l - 2:
ans_sub += int(subst)
... | def dfs(i, f):
if i == s - 1:
return sum(map(int, f.split("+")))
return dfs(i + 1, f + n[i + 1]) + dfs(i + 1, f + "+" + n[i + 1])
n = eval(input())
s = len(n)
print((dfs(0, n[0])))
| false | 60 | [
"-s = eval(input())",
"-l = len(s)",
"-ans = 0",
"-for i in range(2 ** (l - 1)):",
"- ans_sub = 0",
"- subst = s[0]",
"- for j in range(l - 1):",
"- if (i >> j) & 1:",
"- ans_sub += int(subst)",
"- subst = s[j + 1]",
"- else:",
"- subst +... | false | 0.039269 | 0.039256 | 1.000336 | [
"s516384934",
"s097047815"
] |
u645250356 | p03831 | python | s836578799 | s289180129 | 120 | 103 | 16,440 | 21,196 | Accepted | Accepted | 14.17 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,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(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,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, ... | 19 | 17 | 525 | 476 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, 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 ... | false | 10.526316 | [
"-from heapq import heappop, heappush, heapify",
"+from heapq import heappop, heappush",
"-n, A, B = inpl()",
"-a = inpl()",
"+n, a, b = inpl()",
"+x = inpl()",
"- tmp = B",
"- if (a[i + 1] - a[i]) * A <= B:",
"- tmp = (a[i + 1] - a[i]) * A",
"- res += tmp",
"+ dist = x[i + 1]... | false | 0.046019 | 0.079293 | 0.580363 | [
"s836578799",
"s289180129"
] |
u753803401 | p02838 | python | s770016162 | s194908009 | 449 | 354 | 124,568 | 89,712 | Accepted | Accepted | 21.16 | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input().rstrip('\n'))
a = list(map(int, input().rstrip('\n').split()))
ls = [0] * 60
t = 0
for i in range(60):
for av in a:
ls[i] += av >> i & 1
t += 2 ** i * ls[i] * (n - ... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
dp = [0] * 61
for i in range(60, -1, -1):
for v in a:
dp[i] += v >> i & 1
t = 0
for i in range(61):
t += d... | 20 | 21 | 404 | 428 | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input().rstrip("\n"))
a = list(map(int, input().rstrip("\n").split()))
ls = [0] * 60
t = 0
for i in range(60):
for av in a:
ls[i] += av >> i & 1
t += 2**i * ls[i] * (n - ls[i])
t ... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = list(map(int, readline().split()))
dp = [0] * 61
for i in range(60, -1, -1):
for v in a:
dp[i] += v >> i & 1
t = 0
for i in range(61):
t += dp[i] * (n - dp[i... | false | 4.761905 | [
"- input = sys.stdin.readline",
"+ readline = sys.stdin.buffer.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = list(map(int, input().rstrip(\"\\n\").split()))",
"- ls = [0] * 60",
"+ n = int(readline())",
"+ a = list(map(int, readline().split()))",
"+ dp = [0] * 61",
... | false | 0.038685 | 0.039544 | 0.978288 | [
"s770016162",
"s194908009"
] |
u634046173 | p02572 | python | s998081107 | s891817249 | 129 | 113 | 94,208 | 94,404 | Accepted | Accepted | 12.4 | N = int(eval(input()))
A = list(map(int,input().split()))
sumA = sum(A)
c = 0
for i in range(N-1):
c+= A[i]* (sumA-A[i])
sumA-= A[i]
print((c%(10**9+7))) | N = int(eval(input()))
A = list(map(int,input().split()))
sumA = sum(A)
c = 0
for a in A:
c += a**2
print((((sumA**2 - c)//2) % (10**9+7))) | 9 | 7 | 162 | 139 | N = int(eval(input()))
A = list(map(int, input().split()))
sumA = sum(A)
c = 0
for i in range(N - 1):
c += A[i] * (sumA - A[i])
sumA -= A[i]
print((c % (10**9 + 7)))
| N = int(eval(input()))
A = list(map(int, input().split()))
sumA = sum(A)
c = 0
for a in A:
c += a**2
print((((sumA**2 - c) // 2) % (10**9 + 7)))
| false | 22.222222 | [
"-for i in range(N - 1):",
"- c += A[i] * (sumA - A[i])",
"- sumA -= A[i]",
"-print((c % (10**9 + 7)))",
"+for a in A:",
"+ c += a**2",
"+print((((sumA**2 - c) // 2) % (10**9 + 7)))"
] | false | 0.037171 | 0.037824 | 0.982725 | [
"s998081107",
"s891817249"
] |
u361826811 | p03076 | python | s908070365 | s201316299 | 148 | 18 | 12,408 | 3,064 | Accepted | Accepted | 87.84 | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
DISH = list(map(int, read().split()))
temp = 10
im = 0
for num, i in enumerate(DISH)... | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
DISH = list(map(int, read().split()))
temp = 10
im = 0
for num, i in enumerate(DISH):
if i % 10 < t... | 30 | 29 | 542 | 522 | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
import numpy as np
DISH = list(map(int, read().split()))
temp = 10
im = 0
for num, i in enumerate(DISH):
if i % 10 < temp ... | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
DISH = list(map(int, read().split()))
temp = 10
im = 0
for num, i in enumerate(DISH):
if i % 10 < temp and i % 10 != 0:
... | false | 3.333333 | [
"-import numpy as np",
"-"
] | false | 0.044679 | 0.045056 | 0.991643 | [
"s908070365",
"s201316299"
] |
u586080208 | p02577 | python | s084074601 | s165508445 | 207 | 65 | 9,208 | 9,140 | Accepted | Accepted | 68.6 | N = int(eval(input()))
if N % 9 == 0:
print("Yes")
else :
print("No") | N = eval(input())
SUM = 0
for i in N:
SUM += int(i)
if SUM % 9 == 0:
print('Yes')
else :
print('No') | 6 | 8 | 75 | 107 | N = int(eval(input()))
if N % 9 == 0:
print("Yes")
else:
print("No")
| N = eval(input())
SUM = 0
for i in N:
SUM += int(i)
if SUM % 9 == 0:
print("Yes")
else:
print("No")
| false | 25 | [
"-N = int(eval(input()))",
"-if N % 9 == 0:",
"+N = eval(input())",
"+SUM = 0",
"+for i in N:",
"+ SUM += int(i)",
"+if SUM % 9 == 0:"
] | false | 0.039574 | 0.08921 | 0.443607 | [
"s084074601",
"s165508445"
] |
u952164537 | p02887 | python | s533363801 | s452780617 | 72 | 53 | 5,416 | 4,648 | Accepted | Accepted | 26.39 | length = int(eval(input()))
li = list(eval(input()))
li2 = []
i = -1
for str in li[:]:
i = 1 + i
if i + 1 == len(li):
li2.append(li[i])
print((len(li2)))
break
if li[i] != li[i + 1]:
li2.append(li[i])
continue | length = int(eval(input()))
li = list(eval(input()))
li2 = []
for i, str in enumerate(li):
if i + 1 == length:
li2.append(str)
print((len(li2)))
break
if str != li[i + 1]:
li2.append(str)
continue | 13 | 11 | 259 | 240 | length = int(eval(input()))
li = list(eval(input()))
li2 = []
i = -1
for str in li[:]:
i = 1 + i
if i + 1 == len(li):
li2.append(li[i])
print((len(li2)))
break
if li[i] != li[i + 1]:
li2.append(li[i])
continue
| length = int(eval(input()))
li = list(eval(input()))
li2 = []
for i, str in enumerate(li):
if i + 1 == length:
li2.append(str)
print((len(li2)))
break
if str != li[i + 1]:
li2.append(str)
continue
| false | 15.384615 | [
"-i = -1",
"-for str in li[:]:",
"- i = 1 + i",
"- if i + 1 == len(li):",
"- li2.append(li[i])",
"+for i, str in enumerate(li):",
"+ if i + 1 == length:",
"+ li2.append(str)",
"- if li[i] != li[i + 1]:",
"- li2.append(li[i])",
"+ if str != li[i + 1]:",
"+ ... | false | 0.036714 | 0.03512 | 1.045384 | [
"s533363801",
"s452780617"
] |
u616382321 | p02987 | python | s246080846 | s189821496 | 31 | 25 | 9,252 | 9,084 | Accepted | Accepted | 19.35 | from collections import Counter
S = list(eval(input()))
counter = dict(Counter(S))
cnt_v = list(counter.values())
if len(cnt_v) == 2 and cnt_v[0] == 2:
print('Yes')
else:
print('No')
| S = sorted(list(eval(input())))
bl = (S[0]==S[1] and S[1]!=S[2] and S[2]==S[3])
print(('Yes' if bl == 1 else 'No'))
| 11 | 4 | 198 | 112 | from collections import Counter
S = list(eval(input()))
counter = dict(Counter(S))
cnt_v = list(counter.values())
if len(cnt_v) == 2 and cnt_v[0] == 2:
print("Yes")
else:
print("No")
| S = sorted(list(eval(input())))
bl = S[0] == S[1] and S[1] != S[2] and S[2] == S[3]
print(("Yes" if bl == 1 else "No"))
| false | 63.636364 | [
"-from collections import Counter",
"-",
"-S = list(eval(input()))",
"-counter = dict(Counter(S))",
"-cnt_v = list(counter.values())",
"-if len(cnt_v) == 2 and cnt_v[0] == 2:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+S = sorted(list(eval(input())))",
"+bl = S[0] == S[1] and S[1]... | false | 0.038784 | 0.047683 | 0.813364 | [
"s246080846",
"s189821496"
] |
u645250356 | p03013 | python | s085315161 | s012079235 | 453 | 109 | 460,020 | 15,348 | Accepted | Accepted | 75.94 | n,m = list(map(int,input().split()))
a = [int(eval(input())) for i in range(m)]
a = set(a)
mod = 10**9+7
dp = [0] * (n+1)
dp[0] = 1
if not 1 in a:
dp[1] = 1
for i in range(2,n+1):
if i in a:
continue
dp[i] = dp[i-1] + dp[i-2]
print((dp[n] % mod))
| from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sy... | 15 | 24 | 269 | 634 | n, m = list(map(int, input().split()))
a = [int(eval(input())) for i in range(m)]
a = set(a)
mod = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
if not 1 in a:
dp[1] = 1
for i in range(2, n + 1):
if i in a:
continue
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[n] % mod))
| from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 37.5 | [
"-n, m = list(map(int, input().split()))",
"-a = [int(eval(input())) for i in range(m)]",
"-a = set(a)",
"+from collections import Counter, defaultdict, deque",
"+from heapq import heappop, heappush, heapify",
"+import sys, bisect, math, itertools, fractions, pprint",
"+from decimal import Decimal",
"... | false | 0.036453 | 0.041471 | 0.878983 | [
"s085315161",
"s012079235"
] |
u620480037 | p03323 | python | s767160599 | s706804428 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | AB=eval(input())
AB=AB.rstrip().split(" ")
A=int(AB[0])
B=int(AB[1])
if A<=8 and B<=8:
print("Yay!")
else:
print(":(") | A,B=list(map(int,input().split()))
if A<=8 and B<=8:
print("Yay!")
else:
print(":(") | 9 | 5 | 129 | 90 | AB = eval(input())
AB = AB.rstrip().split(" ")
A = int(AB[0])
B = int(AB[1])
if A <= 8 and B <= 8:
print("Yay!")
else:
print(":(")
| A, B = list(map(int, input().split()))
if A <= 8 and B <= 8:
print("Yay!")
else:
print(":(")
| false | 44.444444 | [
"-AB = eval(input())",
"-AB = AB.rstrip().split(\" \")",
"-A = int(AB[0])",
"-B = int(AB[1])",
"+A, B = list(map(int, input().split()))"
] | false | 0.067877 | 0.068769 | 0.987026 | [
"s767160599",
"s706804428"
] |
u057964173 | p04012 | python | s999252687 | s826181583 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
from collections import Counter
s=eval(input())
s=Counter(s)
if all (n%2==0 for n in list(s.values())):
print('Yes')
else:
print('No')
resolve() | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
def main():
w=list(eval(input()))
w.sort()
if len(w)%2!=0:
return 'No'
else:
for i in range(0,len(w)-1,2):
if w[i]!=w[i+1]:
return 'No'
... | 12 | 16 | 255 | 369 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
from collections import Counter
s = eval(input())
s = Counter(s)
if all(n % 2 == 0 for n in list(s.values())):
print("Yes")
else:
print("No")
resolve()
| import sys
def input():
return sys.stdin.readline().strip()
def resolve():
def main():
w = list(eval(input()))
w.sort()
if len(w) % 2 != 0:
return "No"
else:
for i in range(0, len(w) - 1, 2):
if w[i] != w[i + 1]:
ret... | false | 25 | [
"- from collections import Counter",
"+ def main():",
"+ w = list(eval(input()))",
"+ w.sort()",
"+ if len(w) % 2 != 0:",
"+ return \"No\"",
"+ else:",
"+ for i in range(0, len(w) - 1, 2):",
"+ if w[i] != w[i + 1]:",
"+ ... | false | 0.041012 | 0.039683 | 1.033495 | [
"s999252687",
"s826181583"
] |
u588341295 | p03993 | python | s977984260 | s458613076 | 174 | 74 | 32,192 | 13,812 | Accepted | Accepted | 57.47 | # -*- 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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): r... | # -*- 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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): r... | 31 | 27 | 768 | 670 | # -*- 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 ceil(x, y=1):
return int(-(-x // y))
def INT():
return int(eval(inp... | # -*- 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 ceil(x, y=1):
return int(-(-x // y))
def INT():
return int(eval(inp... | false | 12.903226 | [
"-like = [set() for i in range(N)]",
"- if i + 1 < A[i]:",
"- like[A[i] - 1].add(i + 1)",
"- else:",
"- if A[i] in like[i]:",
"- cnt += 1",
"-print(cnt)",
"+ if A[A[i] - 1] == i + 1:",
"+ cnt += 1",
"+print((cnt // 2))"
] | false | 0.05166 | 0.036635 | 1.410138 | [
"s977984260",
"s458613076"
] |
u347640436 | p03846 | python | s161414011 | s966198786 | 92 | 80 | 13,880 | 20,456 | Accepted | Accepted | 13.04 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 0:
B = list(range(1, N, 2)) * 2
else:
B = [0] + list(range(2, N, 2)) * 2
B.sort()
if A != B:
print((0))
else:
result = 1
for i in range(N // 2):
result *= 2
result %= 1000000007
pri... | N = int(eval(input()))
A = list(map(int, input().split()))
m = 1000000007
A.sort()
if N % 2 == 0:
B = list(range(1, N, 2)) * 2
else:
B = [0] + list(range(2, N, 2)) * 2
B.sort()
if A != B:
print((0))
else:
result = 1
for i in range(N // 2):
result *= 2
result %= m... | 18 | 20 | 322 | 332 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 0:
B = list(range(1, N, 2)) * 2
else:
B = [0] + list(range(2, N, 2)) * 2
B.sort()
if A != B:
print((0))
else:
result = 1
for i in range(N // 2):
result *= 2
result %= 1000000007
print(result)
| N = int(eval(input()))
A = list(map(int, input().split()))
m = 1000000007
A.sort()
if N % 2 == 0:
B = list(range(1, N, 2)) * 2
else:
B = [0] + list(range(2, N, 2)) * 2
B.sort()
if A != B:
print((0))
else:
result = 1
for i in range(N // 2):
result *= 2
result %= m
print(result)
| false | 10 | [
"+m = 1000000007",
"- result %= 1000000007",
"+ result %= m"
] | false | 0.070343 | 0.042868 | 1.640905 | [
"s161414011",
"s966198786"
] |
u046187684 | p02792 | python | s506187192 | s012959183 | 174 | 91 | 3,060 | 3,064 | Accepted | Accepted | 47.7 | from itertools import product
def solve(string):
n = int(string)
t = [[0] * 10 for _ in range(10)]
for i in range(n + 1):
i = str(i)
t[int(i[0])][int(i[-1])] += 1
return str(sum(t[i][j] * t[j][i] for i, j in product(list(range(1, 10)), repeat=2)))
if __name__ == '__main__... | from itertools import product
"""
def solve(string):
n = int(string)
t = [[0] * 10 for _ in range(10)]
for i in range(n + 1):
i = str(i)
t[int(i[0])][int(i[-1])] += 1
# print(t)
# return str(sum(t[i][j] * t[j][i] for i, j in product(range(1, 10), repeat=2)))
"""
de... | 15 | 32 | 377 | 829 | from itertools import product
def solve(string):
n = int(string)
t = [[0] * 10 for _ in range(10)]
for i in range(n + 1):
i = str(i)
t[int(i[0])][int(i[-1])] += 1
return str(sum(t[i][j] * t[j][i] for i, j in product(list(range(1, 10)), repeat=2)))
if __name__ == "__main__":
impor... | from itertools import product
"""
def solve(string):
n = int(string)
t = [[0] * 10 for _ in range(10)]
for i in range(n + 1):
i = str(i)
t[int(i[0])][int(i[-1])] += 1
# print(t)
# return str(sum(t[i][j] * t[j][i] for i, j in product(range(1, 10), repeat=2)))
"""
def solve(string):... | false | 53.125 | [
"-",
"+\"\"\"",
"+ i = str(i)",
"+ t[int(i[0])][int(i[-1])] += 1",
"+ # print(t)",
"+ # return str(sum(t[i][j] * t[j][i] for i, j in product(range(1, 10), repeat=2)))",
"+\"\"\"",
"+",
"+",
"+def solve(string):",
"+ l = len(string)",
"+ n = int(string)",
"+ c = [... | false | 0.060228 | 0.040237 | 1.496831 | [
"s506187192",
"s012959183"
] |
u809816772 | p03835 | python | s051268423 | s601394041 | 1,881 | 19 | 3,060 | 2,940 | Accepted | Accepted | 98.99 | import itertools
K, S =list(map(int, input().split()))
ans = 0
for i in range(K+1):
for j in range(K+1):
Z = S - i - j
if 0 <= Z & Z <= K:
ans += 1
print(ans) | K, S = list(map(int, input().split()))
res = 0
for x in range(K+1):
y_z = S - x
if y_z < 0:
continue
y_min = max(y_z-K,0)
y_max = min(y_z,K)
res += max(y_max-y_min+1,0)
print(res) | 10 | 12 | 194 | 218 | import itertools
K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
Z = S - i - j
if 0 <= Z & Z <= K:
ans += 1
print(ans)
| K, S = list(map(int, input().split()))
res = 0
for x in range(K + 1):
y_z = S - x
if y_z < 0:
continue
y_min = max(y_z - K, 0)
y_max = min(y_z, K)
res += max(y_max - y_min + 1, 0)
print(res)
| false | 16.666667 | [
"-import itertools",
"-",
"-ans = 0",
"-for i in range(K + 1):",
"- for j in range(K + 1):",
"- Z = S - i - j",
"- if 0 <= Z & Z <= K:",
"- ans += 1",
"-print(ans)",
"+res = 0",
"+for x in range(K + 1):",
"+ y_z = S - x",
"+ if y_z < 0:",
"+ continu... | false | 0.052146 | 0.051055 | 1.021368 | [
"s051268423",
"s601394041"
] |
u818318325 | p02659 | python | s326253598 | s202040819 | 26 | 23 | 10,084 | 9,160 | Accepted | Accepted | 11.54 | import math
from decimal import *
getcontext().prec = 28
a,b=list(map(str, input().split()))
a_ = Decimal(a)
b_ = Decimal(b)
#b = b*100
#print(round(Decimal(Decimal(a)*Decimal(b))))
print((math.floor(a_*b_)))
#print(math.floor(Decimal(a)*Decimal(b)/Decimal(100.0))) | s,t =input().split()
a = int(s)
b = int(float(t)*1000)
ans = a*b
print((ans//1000))
| 10 | 5 | 266 | 86 | import math
from decimal import *
getcontext().prec = 28
a, b = list(map(str, input().split()))
a_ = Decimal(a)
b_ = Decimal(b)
# b = b*100
# print(round(Decimal(Decimal(a)*Decimal(b))))
print((math.floor(a_ * b_)))
# print(math.floor(Decimal(a)*Decimal(b)/Decimal(100.0)))
| s, t = input().split()
a = int(s)
b = int(float(t) * 1000)
ans = a * b
print((ans // 1000))
| false | 50 | [
"-import math",
"-from decimal import *",
"-",
"-getcontext().prec = 28",
"-a, b = list(map(str, input().split()))",
"-a_ = Decimal(a)",
"-b_ = Decimal(b)",
"-# b = b*100",
"-# print(round(Decimal(Decimal(a)*Decimal(b))))",
"-print((math.floor(a_ * b_)))",
"-# print(math.floor(Decimal(a)*Decimal... | false | 0.045914 | 0.072191 | 0.636011 | [
"s326253598",
"s202040819"
] |
u136090046 | p03574 | python | s421560730 | s796173643 | 29 | 22 | 3,064 | 3,188 | Accepted | Accepted | 24.14 | def calc(array, i, j, H, W):
move = [[1, -1], [1, 0], [1, 1], [0, -1], [0, 1], [-1, 0], [-1, -1], [-1, 1]]
num_mine = 0
for k in range(8):
x = i+move[k][0]
y = j+move[k][1]
if x >= H or x < 0 or y >= W or y < 0:
pass
else:
num_mine += 1 if arr... | num = [int(x) for x in input().split()]
array = []
for i in range(num[0]):
array.append(list(eval(input())))
for j in range(num[0]):
for k in range(num[1]):
cnt = 0
if array[j][k] != "#":
try:
if array[j-1][k] == "#" and j-1 != -1:
cn... | 36 | 54 | 860 | 1,539 | def calc(array, i, j, H, W):
move = [[1, -1], [1, 0], [1, 1], [0, -1], [0, 1], [-1, 0], [-1, -1], [-1, 1]]
num_mine = 0
for k in range(8):
x = i + move[k][0]
y = j + move[k][1]
if x >= H or x < 0 or y >= W or y < 0:
pass
else:
num_mine += 1 if array[x]... | num = [int(x) for x in input().split()]
array = []
for i in range(num[0]):
array.append(list(eval(input())))
for j in range(num[0]):
for k in range(num[1]):
cnt = 0
if array[j][k] != "#":
try:
if array[j - 1][k] == "#" and j - 1 != -1:
cnt += 1
... | false | 33.333333 | [
"-def calc(array, i, j, H, W):",
"- move = [[1, -1], [1, 0], [1, 1], [0, -1], [0, 1], [-1, 0], [-1, -1], [-1, 1]]",
"- num_mine = 0",
"- for k in range(8):",
"- x = i + move[k][0]",
"- y = j + move[k][1]",
"- if x >= H or x < 0 or y >= W or y < 0:",
"- pass",
... | false | 0.038058 | 0.090185 | 0.422002 | [
"s421560730",
"s796173643"
] |
u450956662 | p03828 | python | s905313266 | s210850746 | 35 | 28 | 9,432 | 9,344 | Accepted | Accepted | 20 | MOD = 10 ** 9 + 7
def sieve(n):
srn = int(n ** 0.5) + 1
f = [False] * (srn + 1)
res = []
for i in range(2, srn + 1):
if f[i]:
continue
res.append(i)
for j in range(2 * i, srn + 1, i):
f[j] = True
return res
def trial_division(n):
r... | MOD = 10 ** 9 + 7
def sieve(n):
srn = int(n ** 0.5) + 1
f = [False] * (srn + 1)
res = []
for i in range(2, srn + 1):
if f[i]:
continue
res.append(i)
for j in range(2 * i, srn + 1, i):
f[j] = True
return res
def trial_division(n):
r... | 34 | 36 | 719 | 758 | MOD = 10**9 + 7
def sieve(n):
srn = int(n**0.5) + 1
f = [False] * (srn + 1)
res = []
for i in range(2, srn + 1):
if f[i]:
continue
res.append(i)
for j in range(2 * i, srn + 1, i):
f[j] = True
return res
def trial_division(n):
res = dict()
f... | MOD = 10**9 + 7
def sieve(n):
srn = int(n**0.5) + 1
f = [False] * (srn + 1)
res = []
for i in range(2, srn + 1):
if f[i]:
continue
res.append(i)
for j in range(2 * i, srn + 1, i):
f[j] = True
return res
def trial_division(n):
res = dict()
f... | false | 5.555556 | [
"- pn = sieve(m)",
"+ if m == 1:",
"+ break",
"+pn = sieve(N)"
] | false | 0.048135 | 0.046456 | 1.036147 | [
"s905313266",
"s210850746"
] |
u186838327 | p03450 | python | s757323510 | s910092911 | 873 | 498 | 116,128 | 76,208 | Accepted | Accepted | 42.96 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
edge = [{} for _ in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
l, r = l-1, r-1
g[r].append(l)
g[l].append(r)
edge[l][r] = d
edge[r][l] = -d
s =... | import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline
n, m =list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
l, r = l-1, r-1
g[l].append((d, r))
g[r].append((-d, l))
s = []
visit = [-1]*n
dist = [Fa... | 35 | 33 | 762 | 810 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
edge = [{} for _ in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
l, r = l - 1, r - 1
g[r].append(l)
g[l].append(r)
edge[l][r] = d
edge[r][l] = -d
s = []
visit = [10*... | import sys
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
l, r = l - 1, r - 1
g[l].append((d, r))
g[r].append((-d, l))
s = []
visit = [-1] * n
dist = [False] * ... | false | 5.714286 | [
"-input = sys.stdin.readline",
"+# input = sys.stdin.readline",
"+input = sys.stdin.buffer.readline",
"-edge = [{} for _ in range(n)]",
"- g[r].append(l)",
"- g[l].append(r)",
"- edge[l][r] = d",
"- edge[r][l] = -d",
"+ g[l].append((d, r))",
"+ g[r].append((-d, l))",
"-visit = ... | false | 0.041953 | 0.042597 | 0.984869 | [
"s757323510",
"s910092911"
] |
u871980676 | p03862 | python | s945819081 | s969164818 | 111 | 90 | 14,060 | 14,152 | Accepted | Accepted | 18.92 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
res = 0
if a[0] > x:
res += a[0]-x
a[0] = x
for i in range(1,N):
if a[i-1]+a[i] > x:
tmp = a[i]+a[i-1]-x
a[i] -= tmp
res += tmp
print(res)
| N,x = list(map(int,input().split()))
a = list(map(int,input().split()))
res = 0
if a[0]>x:
res = a[0]-x
a[0] = x
for i in range(1,N):
tmp = a[i]+a[i-1]-x
if tmp > 0:
a[i] -= tmp
res += tmp
print(res)
| 14 | 15 | 259 | 243 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
res = 0
if a[0] > x:
res += a[0] - x
a[0] = x
for i in range(1, N):
if a[i - 1] + a[i] > x:
tmp = a[i] + a[i - 1] - x
a[i] -= tmp
res += tmp
print(res)
| N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
res = 0
if a[0] > x:
res = a[0] - x
a[0] = x
for i in range(1, N):
tmp = a[i] + a[i - 1] - x
if tmp > 0:
a[i] -= tmp
res += tmp
print(res)
| false | 6.666667 | [
"- res += a[0] - x",
"+ res = a[0] - x",
"- if a[i - 1] + a[i] > x:",
"- tmp = a[i] + a[i - 1] - x",
"+ tmp = a[i] + a[i - 1] - x",
"+ if tmp > 0:"
] | false | 0.042441 | 0.040924 | 1.037052 | [
"s945819081",
"s969164818"
] |
u347600233 | p02572 | python | s427962021 | s636001029 | 182 | 168 | 31,420 | 31,580 | Accepted | Accepted | 7.69 | MOD = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
rs = [0]
for i in range(n):
rs.append(rs[-1] + a[n - 1 - i])
ans = 0
for i in range(n - 1):
ans += a[i] * rs[n - 1 - i] % MOD
print((ans % MOD)) | MOD = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
ans, rem = 0, 0
for i in range(n - 1):
rem += a[n - 1 - i] % MOD
ans += a[n - 2 - i] * rem % MOD
print((ans % MOD)) | 11 | 8 | 230 | 197 | MOD = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
rs = [0]
for i in range(n):
rs.append(rs[-1] + a[n - 1 - i])
ans = 0
for i in range(n - 1):
ans += a[i] * rs[n - 1 - i] % MOD
print((ans % MOD))
| MOD = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
ans, rem = 0, 0
for i in range(n - 1):
rem += a[n - 1 - i] % MOD
ans += a[n - 2 - i] * rem % MOD
print((ans % MOD))
| false | 27.272727 | [
"-rs = [0]",
"-for i in range(n):",
"- rs.append(rs[-1] + a[n - 1 - i])",
"-ans = 0",
"+ans, rem = 0, 0",
"- ans += a[i] * rs[n - 1 - i] % MOD",
"+ rem += a[n - 1 - i] % MOD",
"+ ans += a[n - 2 - i] * rem % MOD"
] | false | 0.072781 | 0.046716 | 1.557931 | [
"s427962021",
"s636001029"
] |
u853728588 | p02694 | python | s332855645 | s180878058 | 32 | 28 | 9,176 | 9,160 | Accepted | Accepted | 12.5 | x = int(eval(input()))
total = 100
year = 0
while x > total:
year += 1
total += total//100
print(year)
| import math
x = int(eval(input()))
initial = 100
count = 0
while initial < x:
initial += initial//100
count += 1
print(count) | 8 | 8 | 109 | 132 | x = int(eval(input()))
total = 100
year = 0
while x > total:
year += 1
total += total // 100
print(year)
| import math
x = int(eval(input()))
initial = 100
count = 0
while initial < x:
initial += initial // 100
count += 1
print(count)
| false | 0 | [
"+import math",
"+",
"-total = 100",
"-year = 0",
"-while x > total:",
"- year += 1",
"- total += total // 100",
"-print(year)",
"+initial = 100",
"+count = 0",
"+while initial < x:",
"+ initial += initial // 100",
"+ count += 1",
"+print(count)"
] | false | 0.04333 | 0.046223 | 0.937418 | [
"s332855645",
"s180878058"
] |
u970348538 | p02883 | python | s031709198 | s819377433 | 1,669 | 567 | 108,348 | 108,860 | Accepted | Accepted | 66.03 | import math
(n,k),a,f = [list(map(int, s.split())) for s in open(0)]
a.sort()
f.sort(reverse=True)
low = 0
high = 0
for x, y in zip(a,f):
high = max(high, x*y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a,f):
tmp += max(0, x - math.floor(test / y))... | (n,k),a,f = [list(map(int, s.split())) for s in open(0)]
a.sort(reverse=True)
f.sort()
low = 0
high = 0
for x, y in zip(a,f):
high = max(high, x*y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a,f):
tmp += max(0, x - int(test / y))
if tmp > k... | 22 | 21 | 433 | 413 | import math
(n, k), a, f = [list(map(int, s.split())) for s in open(0)]
a.sort()
f.sort(reverse=True)
low = 0
high = 0
for x, y in zip(a, f):
high = max(high, x * y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a, f):
tmp += max(0, x - math.floor(test / y))
i... | (n, k), a, f = [list(map(int, s.split())) for s in open(0)]
a.sort(reverse=True)
f.sort()
low = 0
high = 0
for x, y in zip(a, f):
high = max(high, x * y)
while high != low:
test = int((high + low) // 2)
tmp = 0
for x, y in zip(a, f):
tmp += max(0, x - int(test / y))
if tmp > k:
... | false | 4.545455 | [
"-import math",
"-",
"-a.sort()",
"-f.sort(reverse=True)",
"+a.sort(reverse=True)",
"+f.sort()",
"- tmp += max(0, x - math.floor(test / y))",
"+ tmp += max(0, x - int(test / y))"
] | false | 0.042994 | 0.037884 | 1.134871 | [
"s031709198",
"s819377433"
] |
u861141787 | p02768 | python | s869193395 | s084687386 | 173 | 150 | 38,512 | 3,064 | Accepted | Accepted | 13.29 | mod = 10 ** 9 + 7
def cmb(n, r, mod):
r = min(r, n -r)
if r == 0: return 1
over, under = 1, 1
for i in range(1, r+1):
over = over * (n-i+1) % mod
under = under * i % mod
inv = pow(under, mod-2, mod)
return over * inv % mod
n, a, b = list(map(int, input().split()))
... | def choose(n, a):
x = 1; y = 1
for i in range(a):
x = x * (n-i) % mod
y = y * (i+1) % mod
return x * pow(y, mod-2, mod) % mod
mod = 10 ** 9 + 7
n, a, b = list(map(int, input().split()))
ans = pow(2, n, mod)
ans -= 1
ans -= choose(n, a)
ans -= choose(n, b)
print((ans % m... | 16 | 18 | 393 | 317 | mod = 10**9 + 7
def cmb(n, r, mod):
r = min(r, n - r)
if r == 0:
return 1
over, under = 1, 1
for i in range(1, r + 1):
over = over * (n - i + 1) % mod
under = under * i % mod
inv = pow(under, mod - 2, mod)
return over * inv % mod
n, a, b = list(map(int, input().split(... | def choose(n, a):
x = 1
y = 1
for i in range(a):
x = x * (n - i) % mod
y = y * (i + 1) % mod
return x * pow(y, mod - 2, mod) % mod
mod = 10**9 + 7
n, a, b = list(map(int, input().split()))
ans = pow(2, n, mod)
ans -= 1
ans -= choose(n, a)
ans -= choose(n, b)
print((ans % mod))
| false | 11.111111 | [
"-mod = 10**9 + 7",
"+def choose(n, a):",
"+ x = 1",
"+ y = 1",
"+ for i in range(a):",
"+ x = x * (n - i) % mod",
"+ y = y * (i + 1) % mod",
"+ return x * pow(y, mod - 2, mod) % mod",
"-def cmb(n, r, mod):",
"- r = min(r, n - r)",
"- if r == 0:",
"- retu... | false | 0.099767 | 0.104468 | 0.954999 | [
"s869193395",
"s084687386"
] |
u179169725 | p02802 | python | s482273826 | s476804187 | 280 | 244 | 4,852 | 42,204 | Accepted | Accepted | 12.86 | # 誤読したか?
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
'''
H is number of rows
'''
return [list(map(int, read().split())) for _ in range(H)]
def read_map(H):
... |
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
'''
H is number of rows
'''
ret = []
for _ in range(H):
... | 67 | 76 | 1,164 | 1,625 | # 誤読したか?
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
"""
H is number of rows
"""
return [list(map(int, read().split())) for _ in range(H)]
def read_map(H):
"""
H is number of... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
"""
H is number of rows
"""
ret = []
for _ in range(H):
ret.append(tupl... | false | 11.842105 | [
"-# 誤読したか?",
"+sys.setrecursionlimit(1 << 25)",
"+ra = range",
"+enu = enumerate",
"+def read_tuple(H):",
"+ \"\"\"",
"+ H is number of rows",
"+ \"\"\"",
"+ ret = []",
"+ for _ in range(H):",
"+ ret.append(tuple(map(int, read().split())))",
"+ return ret",
"+",
"+... | false | 0.043827 | 0.037689 | 1.162863 | [
"s482273826",
"s476804187"
] |
u461993794 | p03575 | python | s997227748 | s873891557 | 172 | 71 | 70,320 | 68,120 | Accepted | Accepted | 58.72 | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl... | n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = [1]
seen = {1}
... | 32 | 29 | 667 | 622 | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = deque()... | n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = [1]
seen = {1}
while len(q) > ... | false | 9.375 | [
"-from collections import deque",
"-",
"- q = deque()",
"- q.append(1)",
"+ q = [1]",
"- while q:",
"+ while len(q) > 0:"
] | false | 0.035615 | 0.040485 | 0.879704 | [
"s997227748",
"s873891557"
] |
u080364835 | p02743 | python | s326224503 | s894978452 | 34 | 17 | 5,076 | 2,940 | Accepted | Accepted | 50 | a, b, c = list(map(float, input().split()))
from decimal import *
getcontext().prec = 50
A = Decimal(a).sqrt()
B = Decimal(b).sqrt()
C = Decimal(c).sqrt()
print(('Yes' if A+B<C else 'No')) | a, b, c = list(map(int, input().split()))
if c - a - b <= 0:
print('No')
else:
if 4*a*b < (c - a - b)**2:
print('Yes')
else:
print('No') | 9 | 9 | 190 | 167 | a, b, c = list(map(float, input().split()))
from decimal import *
getcontext().prec = 50
A = Decimal(a).sqrt()
B = Decimal(b).sqrt()
C = Decimal(c).sqrt()
print(("Yes" if A + B < C else "No"))
| a, b, c = list(map(int, input().split()))
if c - a - b <= 0:
print("No")
else:
if 4 * a * b < (c - a - b) ** 2:
print("Yes")
else:
print("No")
| false | 0 | [
"-a, b, c = list(map(float, input().split()))",
"-from decimal import *",
"-",
"-getcontext().prec = 50",
"-A = Decimal(a).sqrt()",
"-B = Decimal(b).sqrt()",
"-C = Decimal(c).sqrt()",
"-print((\"Yes\" if A + B < C else \"No\"))",
"+a, b, c = list(map(int, input().split()))",
"+if c - a - b <= 0:",... | false | 0.037756 | 0.037463 | 1.00782 | [
"s326224503",
"s894978452"
] |
u546285759 | p00184 | python | s268399287 | s947835923 | 3,260 | 2,240 | 19,532 | 15,984 | Accepted | Accepted | 31.29 | while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
for i in range(0, 60, 10):
print((len(list([x for x in a if i <= x < i+10]))))
print((len(list([x for x in a if 60 <= x <=120])))) | from collections import Counter
while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
cnt = Counter(i for i in range(7))
for v in a:
if v < 10:
cnt[0] += 1
elif v < 20:
cnt[1] += 1
elif v <... | 8 | 25 | 258 | 567 | while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
for i in range(0, 60, 10):
print((len(list([x for x in a if i <= x < i + 10]))))
print((len(list([x for x in a if 60 <= x <= 120]))))
| from collections import Counter
while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
cnt = Counter(i for i in range(7))
for v in a:
if v < 10:
cnt[0] += 1
elif v < 20:
cnt[1] += 1
elif v < 30:
... | false | 68 | [
"+from collections import Counter",
"+",
"- for i in range(0, 60, 10):",
"- print((len(list([x for x in a if i <= x < i + 10]))))",
"- print((len(list([x for x in a if 60 <= x <= 120]))))",
"+ cnt = Counter(i for i in range(7))",
"+ for v in a:",
"+ if v < 10:",
"+ ... | false | 0.058311 | 0.102839 | 0.567008 | [
"s268399287",
"s947835923"
] |
u499381410 | p02956 | python | s813635616 | s305505962 | 1,013 | 927 | 119,948 | 120,460 | Accepted | Accepted | 8.49 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 87 | 85 | 2,190 | 2,212 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | false | 2.298851 | [
"-Y = [Y[i] for i in sorted(list(range(n)), key=lambda j: X[j])]",
"+Y = [Y[i] for i in sorted(range(n), key=lambda j: X[j])]",
"- ans = ans + (pow2[ld] - 1) * (pow2[ru] - 1) * pow2[lu] % mod * pow2[rd] % mod",
"- ans = ans + (pow2[lu] - 1) * (pow2[rd] - 1) * pow2[ld] * pow2[ru] % mod",
"- ans = an... | false | 0.038016 | 0.034143 | 1.113432 | [
"s813635616",
"s305505962"
] |
u413165887 | p02598 | python | s863565663 | s340568933 | 674 | 392 | 31,244 | 30,944 | Accepted | Accepted | 41.84 | n, k = list(map(int, input().split()))
a = [i-1 for i in map(int, input().split())]
left, right = 1, 10**9
while left < right:
middle = (left + right)//2
count = 0
for i in a:
count += i//middle
if count <= k:
right = middle
else:
left = middle + 1
pri... | n, k = list(map(int, input().split()))
a = [i-1 for i in map(int, input().split())]
left, right = 1, 10**9
while left < right:
middle = (left + right)//2
count = sum(i//middle for i in a)
if count <= k:
right = middle
else:
left = middle + 1
print(left) | 17 | 11 | 322 | 289 | n, k = list(map(int, input().split()))
a = [i - 1 for i in map(int, input().split())]
left, right = 1, 10**9
while left < right:
middle = (left + right) // 2
count = 0
for i in a:
count += i // middle
if count <= k:
right = middle
else:
left = middle + 1
print(left)
| n, k = list(map(int, input().split()))
a = [i - 1 for i in map(int, input().split())]
left, right = 1, 10**9
while left < right:
middle = (left + right) // 2
count = sum(i // middle for i in a)
if count <= k:
right = middle
else:
left = middle + 1
print(left)
| false | 35.294118 | [
"- count = 0",
"- for i in a:",
"- count += i // middle",
"+ count = sum(i // middle for i in a)"
] | false | 0.056011 | 0.036008 | 1.555505 | [
"s863565663",
"s340568933"
] |
u492447501 | p02887 | python | s398556816 | s527742058 | 53 | 45 | 4,084 | 4,024 | Accepted | Accepted | 15.09 | N = int(eval(input()))
S = list(eval(input()))
i = 0
count = 0
while i < N-1:
if S[i]==S[i+1]:
i = (i+1)
continue
else:
count = count + 1
i = i + 1
print((count+1)) | N = int(eval(input()))
S = list(eval(input()))
sum = 0
for index in range(0, len(S)-1, 1):
if S[index]!=S[index+1]:
sum = sum + 1
continue
print((sum+1)) | 15 | 9 | 203 | 168 | N = int(eval(input()))
S = list(eval(input()))
i = 0
count = 0
while i < N - 1:
if S[i] == S[i + 1]:
i = i + 1
continue
else:
count = count + 1
i = i + 1
print((count + 1))
| N = int(eval(input()))
S = list(eval(input()))
sum = 0
for index in range(0, len(S) - 1, 1):
if S[index] != S[index + 1]:
sum = sum + 1
continue
print((sum + 1))
| false | 40 | [
"-i = 0",
"-count = 0",
"-while i < N - 1:",
"- if S[i] == S[i + 1]:",
"- i = i + 1",
"+sum = 0",
"+for index in range(0, len(S) - 1, 1):",
"+ if S[index] != S[index + 1]:",
"+ sum = sum + 1",
"- else:",
"- count = count + 1",
"- i = i + 1",
"-print((count + ... | false | 0.101671 | 0.037584 | 2.705127 | [
"s398556816",
"s527742058"
] |
u476604182 | p03148 | python | s834175193 | s831701142 | 472 | 255 | 41,596 | 25,940 | Accepted | Accepted | 45.97 | from collections import defaultdict
from heapq import heappush, heappop
N,K,*L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
ls = []
for i,(t,d) in enumerate(zip(*[iter(L)]*2)):
dic[t].append(d)
heappush(ls,(-d,t))
S = set()
pre = []
ans = 0
num = 0
for i in range(K):
d,t = heappop... | N,K,*L = list(map(int, open(0).read().split()))
ls = []
for i,(t,d) in enumerate(zip(*[iter(L)]*2)):
ls.append((d,t))
ls.sort()
S = set()
pre = []
ans = 0
num = 0
for i in range(K):
d,t = ls.pop()
ans += d
if t not in S:
num += 1
S.add(t)
else:
pre.append(d)
pre.sort(reverse=True)... | 38 | 35 | 664 | 561 | from collections import defaultdict
from heapq import heappush, heappop
N, K, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
ls = []
for i, (t, d) in enumerate(zip(*[iter(L)] * 2)):
dic[t].append(d)
heappush(ls, (-d, t))
S = set()
pre = []
ans = 0
num = 0
for i in range(K):
d, t = heap... | N, K, *L = list(map(int, open(0).read().split()))
ls = []
for i, (t, d) in enumerate(zip(*[iter(L)] * 2)):
ls.append((d, t))
ls.sort()
S = set()
pre = []
ans = 0
num = 0
for i in range(K):
d, t = ls.pop()
ans += d
if t not in S:
num += 1
S.add(t)
else:
pre.append(d)
pre.sort(... | false | 7.894737 | [
"-from collections import defaultdict",
"-from heapq import heappush, heappop",
"-",
"-dic = defaultdict(list)",
"- dic[t].append(d)",
"- heappush(ls, (-d, t))",
"+ ls.append((d, t))",
"+ls.sort()",
"- d, t = heappop(ls)",
"- ans -= d",
"+ d, t = ls.pop()",
"+ ans += d",
... | false | 0.085962 | 0.039273 | 2.188853 | [
"s834175193",
"s831701142"
] |
u941407962 | p03312 | python | s048872943 | s038176387 | 1,749 | 827 | 140,964 | 105,464 | Accepted | Accepted | 52.72 | import random
from itertools import accumulate
N = int(eval(input()))
As = [int(i) for i in input().split(' ')]
#N = pow(10, 4)
#As = [random.randint(0,1000) for r in range(N)]
As = list(accumulate(As))
def bsearch(L, l, r, ls, rs):
if r - l == 0:
l_temp = L[l-1] if l!=0 else 0
lsum... |
def bsearch(mn, mx, func):
#func(i)=False を満たす最大のi
idx = (mx + mn)//2
while mx-mn>1:
if func(idx):
idx, mx = (idx + mn)//2, idx
continue
idx, mn = (idx + mx)//2, idx
return idx
N, = list(map(int, input().split()))
A = list(map(int, input().split()))
X... | 31 | 38 | 861 | 1,147 | import random
from itertools import accumulate
N = int(eval(input()))
As = [int(i) for i in input().split(" ")]
# N = pow(10, 4)
# As = [random.randint(0,1000) for r in range(N)]
As = list(accumulate(As))
def bsearch(L, l, r, ls, rs):
if r - l == 0:
l_temp = L[l - 1] if l != 0 else 0
lsum = l_tem... | def bsearch(mn, mx, func):
# func(i)=False を満たす最大のi
idx = (mx + mn) // 2
while mx - mn > 1:
if func(idx):
idx, mx = (idx + mn) // 2, idx
continue
idx, mn = (idx + mx) // 2, idx
return idx
(N,) = list(map(int, input().split()))
A = list(map(int, input().split()))... | false | 18.421053 | [
"-import random",
"-from itertools import accumulate",
"-",
"-N = int(eval(input()))",
"-As = [int(i) for i in input().split(\" \")]",
"-# N = pow(10, 4)",
"-# As = [random.randint(0,1000) for r in range(N)]",
"-As = list(accumulate(As))",
"+def bsearch(mn, mx, func):",
"+ # func(i)=False を満たす最... | false | 0.047045 | 0.089818 | 0.523783 | [
"s048872943",
"s038176387"
] |
u970197315 | p03161 | python | s728174839 | s988195731 | 1,902 | 427 | 23,052 | 55,264 | Accepted | Accepted | 77.55 | import sys
import numpy as np
input = sys.stdin.readline
n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
dp = np.zeros(n, dtype=int)
h = np.array(h)
for i in range(1, n):
s = max(0, i-k)
dp[i] = min(dp[s: i] + np.abs(h[i] - h[s: i]))
print((dp[n-1])) | # B - Frog 2
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
dp=[float("inf")]*n
dp[0]=0
for i in range(n-1):
for j in range(1,k+1):
if i+j<n:
dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print((dp[n-1])) | 17 | 10 | 301 | 248 | import sys
import numpy as np
input = sys.stdin.readline
n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
dp = np.zeros(n, dtype=int)
h = np.array(h)
for i in range(1, n):
s = max(0, i - k)
dp[i] = min(dp[s:i] + np.abs(h[i] - h[s:i]))
print((dp[n - 1]))
| # B - Frog 2
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n - 1):
for j in range(1, k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print((dp[n - 1]))
| false | 41.176471 | [
"-import sys",
"-import numpy as np",
"-",
"-input = sys.stdin.readline",
"+# B - Frog 2",
"-h = [int(i) for i in input().split()]",
"-dp = np.zeros(n, dtype=int)",
"-h = np.array(h)",
"-for i in range(1, n):",
"- s = max(0, i - k)",
"- dp[i] = min(dp[s:i] + np.abs(h[i] - h[s:i]))",
"+h ... | false | 0.222746 | 0.038299 | 5.815937 | [
"s728174839",
"s988195731"
] |
u268793453 | p03379 | python | s243432471 | s973342280 | 370 | 291 | 26,528 | 25,220 | Accepted | Accepted | 21.35 | import copy
n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = copy.copy(x)
sortedx.sort()
m = sortedx[int((n+1)/2)]
for i in x:
if i < m:
print((sortedx[int(n/2)]))
else:
print((sortedx[int(n/2-1)])) | n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = sorted(x)
r = sortedx[n//2]
l = sortedx[n//2-1]
for i in x:
if i < r:
print(r)
else:
print(l) | 14 | 11 | 250 | 193 | import copy
n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = copy.copy(x)
sortedx.sort()
m = sortedx[int((n + 1) / 2)]
for i in x:
if i < m:
print((sortedx[int(n / 2)]))
else:
print((sortedx[int(n / 2 - 1)]))
| n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = sorted(x)
r = sortedx[n // 2]
l = sortedx[n // 2 - 1]
for i in x:
if i < r:
print(r)
else:
print(l)
| false | 21.428571 | [
"-import copy",
"-",
"-sortedx = copy.copy(x)",
"-sortedx.sort()",
"-m = sortedx[int((n + 1) / 2)]",
"+sortedx = sorted(x)",
"+r = sortedx[n // 2]",
"+l = sortedx[n // 2 - 1]",
"- if i < m:",
"- print((sortedx[int(n / 2)]))",
"+ if i < r:",
"+ print(r)",
"- print((... | false | 0.051529 | 0.046909 | 1.098498 | [
"s243432471",
"s973342280"
] |
u723792785 | p03457 | python | s190995917 | s815311978 | 368 | 235 | 3,060 | 9,144 | Accepted | Accepted | 36.14 | n=int(eval(input()))
nowx, nowy, nowt = 0, 0, 0
for i in range(n):
t,x,y = list(map(int,input().split()))
k = t-nowt-abs(nowx-x)-abs(nowy-y)
if k >= 0 and k % 2 == 0:
nowx, nowy, nowt = x, y, t
else:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
t = 0
x = 0
y = 0
for _ in range(n):
nt, nx, ny = list(map(int,input().split()))
sa = nt-t
t = nt
kyori = abs(nx-x) + abs(ny-y)
x = nx
y = ny
if kyori > sa or (sa-kyori) % 2 == 1:
print("No")
exit()
print("Yes") | 11 | 15 | 240 | 247 | n = int(eval(input()))
nowx, nowy, nowt = 0, 0, 0
for i in range(n):
t, x, y = list(map(int, input().split()))
k = t - nowt - abs(nowx - x) - abs(nowy - y)
if k >= 0 and k % 2 == 0:
nowx, nowy, nowt = x, y, t
else:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
t = 0
x = 0
y = 0
for _ in range(n):
nt, nx, ny = list(map(int, input().split()))
sa = nt - t
t = nt
kyori = abs(nx - x) + abs(ny - y)
x = nx
y = ny
if kyori > sa or (sa - kyori) % 2 == 1:
print("No")
exit()
print("Yes")
| false | 26.666667 | [
"-nowx, nowy, nowt = 0, 0, 0",
"-for i in range(n):",
"- t, x, y = list(map(int, input().split()))",
"- k = t - nowt - abs(nowx - x) - abs(nowy - y)",
"- if k >= 0 and k % 2 == 0:",
"- nowx, nowy, nowt = x, y, t",
"- else:",
"+t = 0",
"+x = 0",
"+y = 0",
"+for _ in range(n):",... | false | 0.065022 | 0.036731 | 1.770204 | [
"s190995917",
"s815311978"
] |
u821432765 | p02688 | python | s048486798 | s692401261 | 23 | 19 | 9,188 | 9,176 | Accepted | Accepted | 17.39 | N, K = list(map(int, input().split()))
has_snack = [False]*N
# has_snack: 1つ以上のお菓子を持っているかどうか
# has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている
for i in range(K):
d = int(eval(input())) # d を読む (使わないけど)
A = list(map(int, input().split())) # A を読む
for v in A: # A の各要素 v について、
has_snack[v-1]... | N, K = list(map(int, input().split()))
# setについての詳細:
# https://docs.python.org/ja/3/library/stdtypes.html#set-types-set-frozenset
has_snack = set() # 1つ以上のお菓子を持っているすぬけ君を入れておくset
for i in range(K):
d = int(eval(input())) # d を読む(使わないけど)
A = set(map(int, input().split())) # A を set として読む
has_sna... | 15 | 13 | 480 | 426 | N, K = list(map(int, input().split()))
has_snack = [False] * N
# has_snack: 1つ以上のお菓子を持っているかどうか
# has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている
for i in range(K):
d = int(eval(input())) # d を読む (使わないけど)
A = list(map(int, input().split())) # A を読む
for v in A: # A の各要素 v について、
has_snack[v - 1] = Tru... | N, K = list(map(int, input().split()))
# setについての詳細:
# https://docs.python.org/ja/3/library/stdtypes.html#set-types-set-frozenset
has_snack = set() # 1つ以上のお菓子を持っているすぬけ君を入れておくset
for i in range(K):
d = int(eval(input())) # d を読む(使わないけど)
A = set(map(int, input().split())) # A を set として読む
has_snack |= A # ... | false | 13.333333 | [
"-has_snack = [False] * N",
"-# has_snack: 1つ以上のお菓子を持っているかどうか",
"-# has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている",
"+# setについての詳細:",
"+# https://docs.python.org/ja/3/library/stdtypes.html#set-types-set-frozenset",
"+has_snack = set() # 1つ以上のお菓子を持っているすぬけ君を入れておくset",
"- d = int(eval(input())) # d を読... | false | 0.037642 | 0.036349 | 1.035579 | [
"s048486798",
"s692401261"
] |
u022979415 | p03048 | python | s682928884 | s334765522 | 1,237 | 1,104 | 2,940 | 2,940 | Accepted | Accepted | 10.75 | def main():
red_box, green_box, blue_box, target = list(map(int, input().split()))
answer = 0
for i in range(target // red_box + 1):
for j in range(target // green_box + 1):
now_balls = red_box * i + green_box * j
if (target - now_balls) % blue_box == 0 and target >= no... | from math import ceil
def main():
r, g, b, n = list(map(int, input().split()))
answer = 0
for i in range(n + 1):
for j in range(n + 1 - i * r):
left = n - i * r - j * g
if left >= 0 and left % b == 0:
answer += 1
print(answer)
if __name__... | 16 | 17 | 478 | 344 | def main():
red_box, green_box, blue_box, target = list(map(int, input().split()))
answer = 0
for i in range(target // red_box + 1):
for j in range(target // green_box + 1):
now_balls = red_box * i + green_box * j
if (target - now_balls) % blue_box == 0 and target >= now_ball... | from math import ceil
def main():
r, g, b, n = list(map(int, input().split()))
answer = 0
for i in range(n + 1):
for j in range(n + 1 - i * r):
left = n - i * r - j * g
if left >= 0 and left % b == 0:
answer += 1
print(answer)
if __name__ == "__main__"... | false | 5.882353 | [
"+from math import ceil",
"+",
"+",
"- red_box, green_box, blue_box, target = list(map(int, input().split()))",
"+ r, g, b, n = list(map(int, input().split()))",
"- for i in range(target // red_box + 1):",
"- for j in range(target // green_box + 1):",
"- now_balls = red_box ... | false | 0.05061 | 0.078638 | 0.643577 | [
"s682928884",
"s334765522"
] |
u018679195 | p04043 | python | s601042033 | s462662960 | 167 | 17 | 38,384 | 3,060 | Accepted | Accepted | 89.82 | a = sorted(list(map(int,input().split())))
if a[0]==5 and a[1]==5 and a[2]==7:
print("YES")
else:
print("NO") | arr = [int(x) for x in input().split()]
arr1 = [0,0,0,0,0,0,0,0,0,0,0]
arr1[arr[0]]+=1
arr1[arr[1]]+=1
arr1[arr[2]]+=1
if(arr1[5]==2 and arr1[7]==1):
print("YES")
else:
print("NO") | 5 | 9 | 115 | 196 | a = sorted(list(map(int, input().split())))
if a[0] == 5 and a[1] == 5 and a[2] == 7:
print("YES")
else:
print("NO")
| arr = [int(x) for x in input().split()]
arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
arr1[arr[0]] += 1
arr1[arr[1]] += 1
arr1[arr[2]] += 1
if arr1[5] == 2 and arr1[7] == 1:
print("YES")
else:
print("NO")
| false | 44.444444 | [
"-a = sorted(list(map(int, input().split())))",
"-if a[0] == 5 and a[1] == 5 and a[2] == 7:",
"+arr = [int(x) for x in input().split()]",
"+arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"+arr1[arr[0]] += 1",
"+arr1[arr[1]] += 1",
"+arr1[arr[2]] += 1",
"+if arr1[5] == 2 and arr1[7] == 1:"
] | false | 0.141453 | 0.044733 | 3.16217 | [
"s601042033",
"s462662960"
] |
u184817817 | p02837 | python | s643053418 | s689549235 | 948 | 384 | 49,756 | 3,064 | Accepted | Accepted | 59.49 | n = int(eval(input()))
a = [0]*n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
a[i] = int(eval(input()))
for j in range(a[i]):
tmp1,tmp2 = list(map(int,input().split()))
x[i].append(tmp1-1)
y[i].append(tmp2)
ans = 0
honest = [0]*n
for i in range(2... | n = int(eval(input()))
a = [0]*n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
a[i] = int(eval(input()))
for j in range(a[i]):
tmp1,tmp2 = list(map(int,input().split()))
x[i].append(tmp1-1)
y[i].append(tmp2)
ans = 0
honest = [0]*n
cnt=0
for i in ... | 30 | 35 | 727 | 751 | n = int(eval(input()))
a = [0] * n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
a[i] = int(eval(input()))
for j in range(a[i]):
tmp1, tmp2 = list(map(int, input().split()))
x[i].append(tmp1 - 1)
y[i].append(tmp2)
ans = 0
honest = [0] * n
for i in range(2**n): ... | n = int(eval(input()))
a = [0] * n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
a[i] = int(eval(input()))
for j in range(a[i]):
tmp1, tmp2 = list(map(int, input().split()))
x[i].append(tmp1 - 1)
y[i].append(tmp2)
ans = 0
honest = [0] * n
cnt = 0
for i in range... | false | 14.285714 | [
"+cnt = 0",
"+ cnt += 1",
"- f = True",
"- for k in range(n):",
"- for l in range(a[k]):",
"- if honest[k] == 1 and y[k][l] != honest[x[k][l]]:",
"- f = False",
"- break",
"- if f:",
"- ans =... | false | 0.036632 | 0.036375 | 1.007055 | [
"s643053418",
"s689549235"
] |
u577170763 | p03167 | python | s904500920 | s005732126 | 248 | 229 | 52,844 | 52,716 | Accepted | Accepted | 7.66 | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
mod = 10**9 + 7
... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
mod = 10**9 + 7
... | 40 | 43 | 937 | 899 | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
mod = 10**9 + 7
H, W = geta(in... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
mod = 10**9 + 7
H, W = geta(in... | false | 6.976744 | [
"- for i, gi in enumerate(g):",
"- if i == 0:",
"- w = gi.index(\"#\") if \"#\" in gi else W",
"- dp[0] = [1 if j < w else 0 for j in range(W)]",
"- else:",
"- for j, gij in enumerate(gi):",
"- if gij == \"#\":",
"- dp... | false | 0.112901 | 0.046652 | 2.420097 | [
"s904500920",
"s005732126"
] |
u619458041 | p03732 | python | s010158695 | s654040190 | 98 | 31 | 3,844 | 3,064 | Accepted | Accepted | 68.37 | import sys
from collections import defaultdict, deque
def main():
input = sys.stdin.readline
N, W = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(N)]
d = defaultdict(lambda: 0)
q = deque()
for a in A:
while len(q) > 0:
w0, ... | # Editorial
import sys
from itertools import accumulate
def main():
input = sys.stdin.readline
N, W = list(map(int, input().split()))
V = [[] for _ in range(4)]
w0, v0 = list(map(int, input().split()))
V[0].append(v0)
for _ in range(N-1):
w, v = list(map(int, input().spli... | 37 | 33 | 755 | 866 | import sys
from collections import defaultdict, deque
def main():
input = sys.stdin.readline
N, W = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(N)]
d = defaultdict(lambda: 0)
q = deque()
for a in A:
while len(q) > 0:
w0, v0 = q.pople... | # Editorial
import sys
from itertools import accumulate
def main():
input = sys.stdin.readline
N, W = list(map(int, input().split()))
V = [[] for _ in range(4)]
w0, v0 = list(map(int, input().split()))
V[0].append(v0)
for _ in range(N - 1):
w, v = list(map(int, input().split()))
... | false | 10.810811 | [
"+# Editorial",
"-from collections import defaultdict, deque",
"+from itertools import accumulate",
"- A = [tuple(map(int, input().split())) for _ in range(N)]",
"- d = defaultdict(lambda: 0)",
"- q = deque()",
"- for a in A:",
"- while len(q) > 0:",
"- w0, v0 = q.pople... | false | 0.046641 | 0.044441 | 1.049509 | [
"s010158695",
"s654040190"
] |
u375616706 | p03675 | python | s092958814 | s369085332 | 122 | 61 | 31,172 | 27,204 | Accepted | Accepted | 50 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
l1 = A[0::2]
l2 = A[1::2]
if N % 2 == 0:
l2 = l2[::-1]
ans = l2+l1
else:
l1 = l1[::-1]
ans = l1+l2
print((" ".join(list(map(str, ans)))))
| N = int(eval(input()))
A = list(input().split())
ans = []
l1 = A[0::2]
l2 = A[1::2]
if N % 2 == 0:
l2 = l2[::-1]
ans = l2+l1
else:
l1 = l1[::-1]
ans = l1+l2
print((" ".join(ans)))
| 15 | 15 | 231 | 205 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
l1 = A[0::2]
l2 = A[1::2]
if N % 2 == 0:
l2 = l2[::-1]
ans = l2 + l1
else:
l1 = l1[::-1]
ans = l1 + l2
print((" ".join(list(map(str, ans)))))
| N = int(eval(input()))
A = list(input().split())
ans = []
l1 = A[0::2]
l2 = A[1::2]
if N % 2 == 0:
l2 = l2[::-1]
ans = l2 + l1
else:
l1 = l1[::-1]
ans = l1 + l2
print((" ".join(ans)))
| false | 0 | [
"-A = list(map(int, input().split()))",
"+A = list(input().split())",
"-print((\" \".join(list(map(str, ans)))))",
"+print((\" \".join(ans)))"
] | false | 0.036398 | 0.049425 | 0.736434 | [
"s092958814",
"s369085332"
] |
u548545174 | p03308 | python | s147363146 | s649664583 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
from itertools import combinations
for i, j in combinations(A, 2):
ans = max(ans, abs(i - j))
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
print((A[-1] - A[0])) | 10 | 5 | 181 | 91 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
from itertools import combinations
for i, j in combinations(A, 2):
ans = max(ans, abs(i - j))
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
print((A[-1] - A[0]))
| false | 50 | [
"-ans = 0",
"-from itertools import combinations",
"-",
"-for i, j in combinations(A, 2):",
"- ans = max(ans, abs(i - j))",
"-print(ans)",
"+A = sorted(A)",
"+print((A[-1] - A[0]))"
] | false | 0.03945 | 0.042172 | 0.935457 | [
"s147363146",
"s649664583"
] |
u119148115 | p02873 | python | s595186251 | s156935768 | 342 | 101 | 23,336 | 93,496 | Accepted | Accepted | 70.47 | S = eval(input())
s = len(S)
A = [0]*(s+1)
for i in range(s):
if S[i] == '<':
A[i+1] = A[i]+1
for j in range(s-1,-1,-1):
if S[j] == '>':
A[j] = max(A[j],A[j+1]+1)
print((sum(A)))
| import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | 14 | 25 | 209 | 714 | S = eval(input())
s = len(S)
A = [0] * (s + 1)
for i in range(s):
if S[i] == "<":
A[i + 1] = A[i] + 1
for j in range(s - 1, -1, -1):
if S[j] == ">":
A[j] = max(A[j], A[j + 1] + 1)
print((sum(A)))
| import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | false | 44 | [
"-S = eval(input())",
"-s = len(S)",
"-A = [0] * (s + 1)",
"-for i in range(s):",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+",
"+",
"+def I():",
"+ return int(sys.stdin.readline().rstrip())",
"+",
"+",
"+def MI():",
"+ return list(map(int, sys.stdin.readline().rstrip()... | false | 0.058923 | 0.058215 | 1.012157 | [
"s595186251",
"s156935768"
] |
u089230684 | p03160 | python | s911960845 | s888284186 | 232 | 195 | 52,208 | 106,784 | Accepted | Accepted | 15.95 | def main():
n = int(eval(input()))
arr = [int(e) for e in input().split()]
t = [float('inf')] * (n + 1)
t[0] = 0
t[1] = 0
t[2] = abs(arr[1] - arr[0])
for i in range(3, n + 1):
l1 = t[i - 1] + abs(arr[i - 2] - arr[i - 1])
l2 = t[i - 2] + abs(arr[i - 3] - arr[i - 1])
... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
sys.setrecursionlimit(1000000)
# do magic here
n = int(eval(input()))
heights = [int(x) for x in input().split()]
MAX = 10000000
dp = {}
def solve(x):
if x==0:
return 0
if x < 0:
return MAX
if x... | 17 | 26 | 416 | 511 | def main():
n = int(eval(input()))
arr = [int(e) for e in input().split()]
t = [float("inf")] * (n + 1)
t[0] = 0
t[1] = 0
t[2] = abs(arr[1] - arr[0])
for i in range(3, n + 1):
l1 = t[i - 1] + abs(arr[i - 2] - arr[i - 1])
l2 = t[i - 2] + abs(arr[i - 3] - arr[i - 1])
t[... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
sys.setrecursionlimit(1000000)
# do magic here
n = int(eval(input()))
heights = [int(x) for x in input().split()]
MAX = 10000000
dp = {}
def solve(x):
if x == 0:
return 0
if x < 0:
return MAX
if x in dp:
r... | false | 34.615385 | [
"-def main():",
"- n = int(eval(input()))",
"- arr = [int(e) for e in input().split()]",
"- t = [float(\"inf\")] * (n + 1)",
"- t[0] = 0",
"- t[1] = 0",
"- t[2] = abs(arr[1] - arr[0])",
"- for i in range(3, n + 1):",
"- l1 = t[i - 1] + abs(arr[i - 2] - arr[i - 1])",
"- ... | false | 0.071821 | 0.118403 | 0.606582 | [
"s911960845",
"s888284186"
] |
u145035045 | p04013 | python | s884443487 | s547416976 | 975 | 685 | 4,596 | 4,596 | Accepted | Accepted | 29.74 | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
#xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
"""
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1)... | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
"""
xlst.insert(0, 0)
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):... | 51 | 52 | 1,187 | 1,202 | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
# xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
"""
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
... | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
"""
xlst.insert(0, 0)
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
dp[... | false | 1.923077 | [
"- # xlst.insert(0, 0)",
"+ xlst.insert(0, 0)",
"- ans = 0",
"+ dpj = dp[j]",
"+ dpj1 = dp[j - 1]",
"- dp[j][k] += dp[j - 1][k - x]",
"- for j in range(1, n + 1):",
"- ans += dp[j][j * a]",
"- print(ans)",
"+ dpj[k] += dpj1[k ... | false | 0.042038 | 0.040366 | 1.041409 | [
"s884443487",
"s547416976"
] |
u995062424 | p03162 | python | s950066153 | s133445376 | 799 | 694 | 42,572 | 50,036 | Accepted | Accepted | 13.14 | def main():
N = int(eval(input()))
a = [[0]*3 for _ in range(N)]
for i in range(N):
a[i][0], a[i][1], a[i][2] = list(map(int, input().split()))
DP = [[0]*3 for _ in range(N+1)]
for i in range(N):
for j in range(3):
for k in range(3):
i... | N = int(eval(input()))
vac = []
for i in range(N):
vac.append(list(map(int, input().split())))
DP = [[0 for _ in range(3)] for _ in range(N+1)]
for i in range(N):
for j in range(3):
for k in range(3):
if(j == k):
continue
DP[i+1][k] = max(DP[i+... | 22 | 18 | 537 | 401 | def main():
N = int(eval(input()))
a = [[0] * 3 for _ in range(N)]
for i in range(N):
a[i][0], a[i][1], a[i][2] = list(map(int, input().split()))
DP = [[0] * 3 for _ in range(N + 1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j == k:
... | N = int(eval(input()))
vac = []
for i in range(N):
vac.append(list(map(int, input().split())))
DP = [[0 for _ in range(3)] for _ in range(N + 1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j == k:
continue
DP[i + 1][k] = max(DP[i + 1][k], DP[i][j]... | false | 18.181818 | [
"-def main():",
"- N = int(eval(input()))",
"- a = [[0] * 3 for _ in range(N)]",
"- for i in range(N):",
"- a[i][0], a[i][1], a[i][2] = list(map(int, input().split()))",
"- DP = [[0] * 3 for _ in range(N + 1)]",
"- for i in range(N):",
"- for j in range(3):",
"- ... | false | 0.089197 | 0.038064 | 2.343305 | [
"s950066153",
"s133445376"
] |
u117980998 | p02998 | python | s226898056 | s088353849 | 1,080 | 585 | 97,112 | 85,040 | Accepted | Accepted | 45.83 | class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
... | import sys
sys.setrecursionlimit(10**5)
m = 100005
visited = [False]*(m*2)
cnt = [0,0]
def dfs(i):
visited[i] = True
cnt[i//m] = cnt[i//m]+1
for j in to[i]:
if not visited[j]:
dfs(j)
input = sys.stdin.readline
n = int(eval(input()))
to = [[] for _ in range(m*2)]
for _ in... | 52 | 29 | 1,269 | 560 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def... | import sys
sys.setrecursionlimit(10**5)
m = 100005
visited = [False] * (m * 2)
cnt = [0, 0]
def dfs(i):
visited[i] = True
cnt[i // m] = cnt[i // m] + 1
for j in to[i]:
if not visited[j]:
dfs(j)
input = sys.stdin.readline
n = int(eval(input()))
to = [[] for _ in range(m * 2)]
for _ i... | false | 44.230769 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.root = [-1] * (n + 1)",
"- self.rnk = [0] * (n + 1)",
"+import sys",
"- def Find_Root(self, x):",
"- if self.root[x] < 0:",
"- return x",
"- else:",
"- self.roo... | false | 0.664851 | 0.434374 | 1.530596 | [
"s226898056",
"s088353849"
] |
u119148115 | p02577 | python | s633327911 | s380449493 | 91 | 83 | 76,164 | 75,740 | Accepted | Accepted | 8.79 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
print(('Yes' if sum(LI2()) % 9 == 0 else 'No'))
| 13 | 4 | 543 | 131 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def LI2():
return list(map(int, sys.stdin.readline().rstrip())) # 空白なし
print(("Yes" if sum(LI2()) % 9 == 0 else "No"))
| false | 69.230769 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-",
"-",
"-def MI():",
"- return list(map(int, sys.stdin.readline().rstrip().split()))",
"-",
"-",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split... | false | 0.042092 | 0.038166 | 1.102868 | [
"s633327911",
"s380449493"
] |
u440566786 | p03558 | python | s106353030 | s727904628 | 131 | 83 | 79,416 | 79,792 | Accepted | Accepted | 36.64 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from collections import deque
def resolve():
k = int(eval(input()))
dist = [INF] * k
dist[1] = 1
queue = deque([1])
while queue:
v = queue.pop()
... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
k = int(eval(input()))
dist = [INF] * k
dist[1] = 1
queue = [1]
for v in queue:
tmp = [v]
for v in tmp:
if dis... | 23 | 23 | 596 | 596 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
def resolve():
k = int(eval(input()))
dist = [INF] * k
dist[1] = 1
queue = deque([1])
while queue:
v = queue.pop()
if... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
k = int(eval(input()))
dist = [INF] * k
dist[1] = 1
queue = [1]
for v in queue:
tmp = [v]
for v in tmp:
if dist[10 * v %... | false | 0 | [
"-from collections import deque",
"- queue = deque([1])",
"- while queue:",
"- v = queue.pop()",
"- if dist[10 * v % k] > dist[v]:",
"- dist[10 * v % k] = dist[v]",
"- queue.appendleft(10 * v % k)",
"- if dist[(v + 1) % k] > dist[v] + 1:",
"- ... | false | 0.050208 | 0.045165 | 1.111657 | [
"s106353030",
"s727904628"
] |
u150984829 | p02274 | python | s869972525 | s745046734 | 1,370 | 1,260 | 27,484 | 27,484 | Accepted | Accepted | 8.03 | def g(A,l,m,r):
global c
L,R=A[l:m]+[1e9],A[m:r]+[1e9]
i=j=0
for k in range(l,r):
if L[i]<R[j]:A[k]=L[i];i+=1
else:A[k]=R[j];j+=1;c+=m-l-i
return c
def s(A,l,r):
if l+1<r:
m=(l+r)//2
return s(A,l,m)+s(A,m,r)+g(A,l,m,r)
else:return 0
c=0
n=int(eval(input()))
A=list(map(int,input().split()))... | def g(A,l,m,r):
global c
L,R=A[l:m]+[1e9],A[m:r]+[1e9]
i=j=0
for k in range(l,r):
if L[i]<R[j]:A[k]=L[i];i+=1;c+=j
else:A[k]=R[j];j+=1
def s(A,l,r):
if l+1<r:m=(l+r)//2;s(A,l,m);s(A,m,r);g(A,l,m,r)
c=0
n=int(eval(input()))
A=list(map(int,input().split()))
s(A,0,n)
print(c)
| 18 | 14 | 335 | 290 | def g(A, l, m, r):
global c
L, R = A[l:m] + [1e9], A[m:r] + [1e9]
i = j = 0
for k in range(l, r):
if L[i] < R[j]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
j += 1
c += m - l - i
return c
def s(A, l, r):
if l + 1 < r:
... | def g(A, l, m, r):
global c
L, R = A[l:m] + [1e9], A[m:r] + [1e9]
i = j = 0
for k in range(l, r):
if L[i] < R[j]:
A[k] = L[i]
i += 1
c += j
else:
A[k] = R[j]
j += 1
def s(A, l, r):
if l + 1 < r:
m = (l + r) // 2
... | false | 22.222222 | [
"+ c += j",
"- c += m - l - i",
"- return c",
"- return s(A, l, m) + s(A, m, r) + g(A, l, m, r)",
"- else:",
"- return 0",
"+ s(A, l, m)",
"+ s(A, m, r)",
"+ g(A, l, m, r)"
] | false | 0.039671 | 0.057164 | 0.693993 | [
"s869972525",
"s745046734"
] |
u588341295 | p03786 | python | s013163306 | s859859937 | 363 | 220 | 14,480 | 14,768 | Accepted | Accepted | 39.39 | # -*- 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
from bisect import bisect_right
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... | 59 | 62 | 1,455 | 1,541 | # -*- 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
from bisect import bisect_right
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d ... | false | 4.83871 | [
"+from bisect import bisect_right",
"- # まず自分以下は全部取り込める",
"+ # まず自分以下は全部取り込む",
"+ # 自分の2倍まではいける",
"+ idx = bisect_right(A, a * 2)",
"+ a += sum(A[m + 1 : idx])",
"- for i in range(m + 1, N):",
"+ for i in range(idx, N):",
"- # 自分の2倍まではいける"
] | false | 0.037801 | 0.087454 | 0.432242 | [
"s013163306",
"s859859937"
] |
u606045429 | p02834 | python | s071885652 | s450682464 | 311 | 247 | 31,732 | 31,732 | Accepted | Accepted | 20.58 | from collections import deque
N, u, v, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def solve(s):
D = [-1] * (N + 1)
D[s] = 0
Q = deque([s])
while Q:
a = Q.popleft()
... | from collections import deque
def main():
N, u, v, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def solve(s):
D = [-1] * (N + 1)
D[s] = 0
Q = deque([s]... | 28 | 31 | 540 | 643 | from collections import deque
N, u, v, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def solve(s):
D = [-1] * (N + 1)
D[s] = 0
Q = deque([s])
while Q:
a = Q.popleft()
for b in E[a]:
... | from collections import deque
def main():
N, u, v, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def solve(s):
D = [-1] * (N + 1)
D[s] = 0
Q = deque([s])
while... | false | 9.677419 | [
"-N, u, v, *AB = list(map(int, open(0).read().split()))",
"-E = [[] for _ in range(N + 1)]",
"-for a, b in zip(*[iter(AB)] * 2):",
"- E[a].append(b)",
"- E[b].append(a)",
"+",
"+def main():",
"+ N, u, v, *AB = list(map(int, open(0).read().split()))",
"+ E = [[] for _ in range(N + 1)]",
... | false | 0.036505 | 0.035813 | 1.019317 | [
"s071885652",
"s450682464"
] |
u922487073 | p03805 | python | s489913011 | s948682883 | 289 | 86 | 18,596 | 3,064 | Accepted | Accepted | 70.24 | import numpy as np
N,M = list(map(int,input().split()))
arr = [[] for i in range(N)]
for i in range(M):
a,b = list(map(int,input().split()))
arr[a-1].append(b-1)
arr[b-1].append(a-1)
for i in range(len(arr)):
arr[i].sort
def dfs(array,point,cnt):
if(array[point]==[]):
... | N, M = list(map(int, input().split(" ")))
path = [tuple(map(int,input().split(" "))) for _ in range(M)]
path += [(item[1], item[0]) for item in path]
visited = [False for _ in range(N)]
visited[0] = True
def dfs(v_, visited):
if not (False in visited):
return 1
ret = 0
v = v_ + 1
fo... | 33 | 23 | 597 | 600 | import numpy as np
N, M = list(map(int, input().split()))
arr = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
arr[a - 1].append(b - 1)
arr[b - 1].append(a - 1)
for i in range(len(arr)):
arr[i].sort
def dfs(array, point, cnt):
if array[point] == []:
retur... | N, M = list(map(int, input().split(" ")))
path = [tuple(map(int, input().split(" "))) for _ in range(M)]
path += [(item[1], item[0]) for item in path]
visited = [False for _ in range(N)]
visited[0] = True
def dfs(v_, visited):
if not (False in visited):
return 1
ret = 0
v = v_ + 1
for i_ in ra... | false | 30.30303 | [
"-import numpy as np",
"-",
"-N, M = list(map(int, input().split()))",
"-arr = [[] for i in range(N)]",
"-for i in range(M):",
"- a, b = list(map(int, input().split()))",
"- arr[a - 1].append(b - 1)",
"- arr[b - 1].append(a - 1)",
"-for i in range(len(arr)):",
"- arr[i].sort",
"+N, M... | false | 0.054722 | 0.041412 | 1.321403 | [
"s489913011",
"s948682883"
] |
u391731808 | p03722 | python | s127994236 | s767582309 | 585 | 457 | 52,696 | 50,648 | Accepted | Accepted | 21.88 | N,M = list(map(int,input().split()))
ABC = [list(map(int,input().split())) for _ in [0]*M]
E = [{} for _ in [0]*N]
for a,b,c in ABC:
E[a-1][b-1] = -c
INFTY = 10**18
d = [INFTY]*N
d[0] = 0
def update():
done = [False]*N
done[0] = True
q = [0]
qp = q.pop
qa = q.append
whi... | N,M = list(map(int,input().split()))
ABC = [list(map(int,input().split())) for _ in [0]*M]
E = [{} for _ in [0]*N]
Eb = [{} for _ in [0]*N]
for a,b,c in ABC:
E[a-1][b-1] = -c
Eb[b-1][a-1] = -c
#0 -> N-1 経路上にない頂点を除く
V1 = [False]*N
V1[0] = True
q = [0]
qp = q.pop
qa = q.append
while q:
i = q... | 34 | 61 | 645 | 1,134 | N, M = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for _ in [0] * M]
E = [{} for _ in [0] * N]
for a, b, c in ABC:
E[a - 1][b - 1] = -c
INFTY = 10**18
d = [INFTY] * N
d[0] = 0
def update():
done = [False] * N
done[0] = True
q = [0]
qp = q.pop
qa = q.append
while ... | N, M = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for _ in [0] * M]
E = [{} for _ in [0] * N]
Eb = [{} for _ in [0] * N]
for a, b, c in ABC:
E[a - 1][b - 1] = -c
Eb[b - 1][a - 1] = -c
# 0 -> N-1 経路上にない頂点を除く
V1 = [False] * N
V1[0] = True
q = [0]
qp = q.pop
qa = q.append
while q:
i... | false | 44.262295 | [
"+Eb = [{} for _ in [0] * N]",
"+ Eb[b - 1][a - 1] = -c",
"+# 0 -> N-1 経路上にない頂点を除く",
"+V1 = [False] * N",
"+V1[0] = True",
"+q = [0]",
"+qp = q.pop",
"+qa = q.append",
"+while q:",
"+ i = qp()",
"+ for j in E[i]:",
"+ if V1[j]:",
"+ continue",
"+ qa(j)",
... | false | 0.038832 | 0.064115 | 0.605653 | [
"s127994236",
"s767582309"
] |
u764956288 | p02687 | python | s572295117 | s983492424 | 22 | 20 | 9,024 | 9,016 | Accepted | Accepted | 9.09 | # import numpy as np
# from itertools import permutations
# from itertools import combinations
# from itertools import combinations_with_replacement
# import queue
# import heapq
def main():
# N, M = map(int, input().split())
# As = list(map(int, input().split()))
S = eval(input())
if ... | def main():
contest_last_week = eval(input())
abc, arc = ('ABC', 'ARC')
if contest_last_week == abc:
contest_this_week = arc
else:
contest_this_week = abc
print(contest_this_week)
if __name__ == "__main__":
main()
| 22 | 15 | 425 | 283 | # import numpy as np
# from itertools import permutations
# from itertools import combinations
# from itertools import combinations_with_replacement
# import queue
# import heapq
def main():
# N, M = map(int, input().split())
# As = list(map(int, input().split()))
S = eval(input())
if S == "ABC":
... | def main():
contest_last_week = eval(input())
abc, arc = ("ABC", "ARC")
if contest_last_week == abc:
contest_this_week = arc
else:
contest_this_week = abc
print(contest_this_week)
if __name__ == "__main__":
main()
| false | 31.818182 | [
"-# import numpy as np",
"-# from itertools import permutations",
"-# from itertools import combinations",
"-# from itertools import combinations_with_replacement",
"-# import queue",
"-# import heapq",
"- # N, M = map(int, input().split())",
"- # As = list(map(int, input().split()))",
"- S... | false | 0.042412 | 0.041263 | 1.027857 | [
"s572295117",
"s983492424"
] |
u329565519 | p02952 | python | s400684429 | s725719513 | 60 | 52 | 2,940 | 2,940 | Accepted | Accepted | 13.33 | N = int(eval(input()))
count = 0
for i in range(N):
if len(str(i + 1)) % 2 == 1:
count += 1
print(count) | N = int(eval(input()))
# count = 0
# for i in range(N):
# if len(str(i + 1)) % 2 == 1:
# count += 1
# print(count)
print((sum(1 for i in range(N) if len(str(i + 1)) % 2 == 1))) | 7 | 9 | 117 | 190 | N = int(eval(input()))
count = 0
for i in range(N):
if len(str(i + 1)) % 2 == 1:
count += 1
print(count)
| N = int(eval(input()))
# count = 0
# for i in range(N):
# if len(str(i + 1)) % 2 == 1:
# count += 1
# print(count)
print((sum(1 for i in range(N) if len(str(i + 1)) % 2 == 1)))
| false | 22.222222 | [
"-count = 0",
"-for i in range(N):",
"- if len(str(i + 1)) % 2 == 1:",
"- count += 1",
"-print(count)",
"+# count = 0",
"+# for i in range(N):",
"+# if len(str(i + 1)) % 2 == 1:",
"+# count += 1",
"+# print(count)",
"+print((sum(1 for i in range(N) if len(str(i + 1)) % 2 ==... | false | 0.144589 | 0.051187 | 2.824719 | [
"s400684429",
"s725719513"
] |
u806976856 | p02762 | python | s968328446 | s199429998 | 939 | 522 | 51,828 | 109,580 | Accepted | Accepted | 44.41 | n,m,k=list(map(int,input().split()))
import sys
sys.setrecursionlimit(10**9) #再帰の上限をあげる
root=[-1 for i in range(n+1)] #自分が親ならグループの人数のマイナス倍を、そうでないなら(元)親の番号を示す
def r(x): #親は誰?
if root[x]<0:
return x
else:
root[x]=r(root[x])
return root[x]
def unite(x,y):
x=r(x)
... | from _collections import deque
n,m,k=list(map(int,input().split()))
fre=[[] for _ in range(n+1)]
bro=[[] for _ in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
fre[a].append(b)
fre[b].append(a)
for i in range(k):
a, b = list(map(int, input().split()))
bro[a].appen... | 50 | 45 | 909 | 893 | n, m, k = list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**9) # 再帰の上限をあげる
root = [-1 for i in range(n + 1)] # 自分が親ならグループの人数のマイナス倍を、そうでないなら(元)親の番号を示す
def r(x): # 親は誰?
if root[x] < 0:
return x
else:
root[x] = r(root[x])
return root[x]
def unite(x, y):
x = r(... | from _collections import deque
n, m, k = list(map(int, input().split()))
fre = [[] for _ in range(n + 1)]
bro = [[] for _ in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
fre[a].append(b)
fre[b].append(a)
for i in range(k):
a, b = list(map(int, input().split()))
bro[a].app... | false | 10 | [
"+from _collections import deque",
"+",
"-import sys",
"-",
"-sys.setrecursionlimit(10**9) # 再帰の上限をあげる",
"-root = [-1 for i in range(n + 1)] # 自分が親ならグループの人数のマイナス倍を、そうでないなら(元)親の番号を示す",
"-",
"-",
"-def r(x): # 親は誰?",
"- if root[x] < 0:",
"- return x",
"- else:",
"- root[... | false | 0.17021 | 0.112447 | 1.513686 | [
"s968328446",
"s199429998"
] |
u588829932 | p03018 | python | s952714009 | s988543930 | 184 | 45 | 40,544 | 3,500 | Accepted | Accepted | 75.54 | s = eval(input())
total = 0
i = 0
inRange = False
range_start = 0
range_minus = 0
range_cnt = 0
while i < len(s)-1:
# BC=>0
if s[i] == 'B' and s[i+1] == 'C':
if inRange:
total += (range_cnt - range_minus)
range_cnt += 1
range_minus += 1
i += 1... | s = eval(input())
s = s.replace('BC', 'D')
total = 0
cnt = 0
for it in s:
if it == 'A':
cnt+=1
elif it=='D':
total += cnt
else:
cnt = 0
print(total) | 27 | 12 | 524 | 189 | s = eval(input())
total = 0
i = 0
inRange = False
range_start = 0
range_minus = 0
range_cnt = 0
while i < len(s) - 1:
# BC=>0
if s[i] == "B" and s[i + 1] == "C":
if inRange:
total += range_cnt - range_minus
range_cnt += 1
range_minus += 1
i += 1
elif s[i] ... | s = eval(input())
s = s.replace("BC", "D")
total = 0
cnt = 0
for it in s:
if it == "A":
cnt += 1
elif it == "D":
total += cnt
else:
cnt = 0
print(total)
| false | 55.555556 | [
"+s = s.replace(\"BC\", \"D\")",
"-i = 0",
"-inRange = False",
"-range_start = 0",
"-range_minus = 0",
"-range_cnt = 0",
"-while i < len(s) - 1:",
"- # BC=>0",
"- if s[i] == \"B\" and s[i + 1] == \"C\":",
"- if inRange:",
"- total += range_cnt - range_minus",
"- ... | false | 0.083526 | 0.036407 | 2.294245 | [
"s952714009",
"s988543930"
] |
u638282348 | p02717 | python | s838161196 | s101121869 | 148 | 17 | 12,428 | 2,940 | Accepted | Accepted | 88.51 | print((*__import__("numpy").array(input().split(), dtype="i8")[[2, 0, 1]]))
| print((*(lambda a, b, c: (c, a, b))(*input().split())))
| 1 | 1 | 74 | 54 | print((*__import__("numpy").array(input().split(), dtype="i8")[[2, 0, 1]]))
| print((*(lambda a, b, c: (c, a, b))(*input().split())))
| false | 0 | [
"-print((*__import__(\"numpy\").array(input().split(), dtype=\"i8\")[[2, 0, 1]]))",
"+print((*(lambda a, b, c: (c, a, b))(*input().split())))"
] | false | 0.722976 | 0.036402 | 19.860801 | [
"s838161196",
"s101121869"
] |
u823044869 | p02934 | python | s731604615 | s340422936 | 45 | 17 | 5,560 | 2,940 | Accepted | Accepted | 62.22 | from fractions import Fraction
n = int(eval(input()))
num_list = [Fraction(1,int(i)) for i in input().split()]
temp_list = 0
for fr in num_list:
temp_list += fr
print((float(Fraction(temp_list.denominator,temp_list.numerator)))) | n = int(eval(input()))
aList = list(map(int,input().split()))
calc = 0
for i in range(n):
calc += 1/aList[i]
print((1/calc))
| 11 | 8 | 238 | 128 | from fractions import Fraction
n = int(eval(input()))
num_list = [Fraction(1, int(i)) for i in input().split()]
temp_list = 0
for fr in num_list:
temp_list += fr
print((float(Fraction(temp_list.denominator, temp_list.numerator))))
| n = int(eval(input()))
aList = list(map(int, input().split()))
calc = 0
for i in range(n):
calc += 1 / aList[i]
print((1 / calc))
| false | 27.272727 | [
"-from fractions import Fraction",
"-",
"-num_list = [Fraction(1, int(i)) for i in input().split()]",
"-temp_list = 0",
"-for fr in num_list:",
"- temp_list += fr",
"-print((float(Fraction(temp_list.denominator, temp_list.numerator))))",
"+aList = list(map(int, input().split()))",
"+calc = 0",
... | false | 0.170482 | 0.055694 | 3.061056 | [
"s731604615",
"s340422936"
] |
u893063840 | p02973 | python | s660872210 | s456069800 | 506 | 230 | 8,160 | 7,836 | Accepted | Accepted | 54.55 | from collections import deque
from bisect import bisect_left
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dq = deque()
for e in a:
i = bisect_left(dq, e)
if i == 0:
dq.appendleft(e)
else:
dq[i-1] = e
ans = len(dq)
print(ans)
| from bisect import bisect_right
n = int(eval(input()))
a = [-int(eval(input())) for _ in range(n)]
li = list()
for e in a:
i = bisect_right(li, e)
if i == len(li):
li.append(e)
else:
li[i] = e
ans = len(li)
print(ans)
| 16 | 15 | 280 | 251 | from collections import deque
from bisect import bisect_left
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dq = deque()
for e in a:
i = bisect_left(dq, e)
if i == 0:
dq.appendleft(e)
else:
dq[i - 1] = e
ans = len(dq)
print(ans)
| from bisect import bisect_right
n = int(eval(input()))
a = [-int(eval(input())) for _ in range(n)]
li = list()
for e in a:
i = bisect_right(li, e)
if i == len(li):
li.append(e)
else:
li[i] = e
ans = len(li)
print(ans)
| false | 6.25 | [
"-from collections import deque",
"-from bisect import bisect_left",
"+from bisect import bisect_right",
"-a = [int(eval(input())) for _ in range(n)]",
"-dq = deque()",
"+a = [-int(eval(input())) for _ in range(n)]",
"+li = list()",
"- i = bisect_left(dq, e)",
"- if i == 0:",
"- dq.ap... | false | 0.040692 | 0.068672 | 0.59255 | [
"s660872210",
"s456069800"
] |
u745087332 | p03503 | python | s931282730 | s213946068 | 344 | 280 | 3,064 | 3,064 | Accepted | Accepted | 18.6 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
F = [inpl() for _ in range(N)]
P = [inpl() for _ in range(N)]
ans = -INF
for i in range(1, 1 << 10):
score = 0
for shop in range(N):
both_open = 0
for period i... | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return eval(i... | 29 | 35 | 492 | 733 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
F = [inpl() for _ in range(N)]
P = [inpl() for _ in range(N)]
ans = -INF
for i in range(1, 1 << 10):
score = 0
for shop in range(N):
both_open = 0
for period in range(10):
... | # coding:utf-8
import sys
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
... | false | 17.142857 | [
"+import sys",
"+",
"+MOD = 10**9 + 7",
"-def inpl():",
"- return list(map(int, input().split()))",
"+def LI():",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"-N = int(eval(input()))",
"-F = [inpl() for _ in range(N)]",
"-P = [inpl() for _ in range(N)]",
"+def LI_():",
"+ ... | false | 0.051741 | 0.007528 | 6.873343 | [
"s931282730",
"s213946068"
] |
u832039789 | p03457 | python | s652047301 | s657210884 | 426 | 363 | 27,380 | 3,060 | Accepted | Accepted | 14.79 | n = int(eval(input()))
txy = [[0,0,0] if i==0 else list(map(int,input().split())) for i in range(n+1)]
flag = True
for i in range(n):
dist = abs(txy[i][1]-txy[i+1][1]) + abs(txy[i][2]-txy[i+1][2])
time = txy[i+1][0] - txy[i][0]
dif = time - dist
if dif<0 or dif%2==1: # 到達不可能
flag = False
break
p... | n = int(eval(input()))
c = [0,0,0]
for i in range(n):
t,x,y = list(map(int,input().split()))
time = t-c[0]
coor = abs(c[1]-x)+abs(c[2]-y)
if not (time>=coor and coor%2==time%2):
print('No')
exit()
c = [t,x,y]
print('Yes')
| 13 | 11 | 344 | 256 | n = int(eval(input()))
txy = [[0, 0, 0] if i == 0 else list(map(int, input().split())) for i in range(n + 1)]
flag = True
for i in range(n):
dist = abs(txy[i][1] - txy[i + 1][1]) + abs(txy[i][2] - txy[i + 1][2])
time = txy[i + 1][0] - txy[i][0]
dif = time - dist
if dif < 0 or dif % 2 == 1: # 到達不可能
... | n = int(eval(input()))
c = [0, 0, 0]
for i in range(n):
t, x, y = list(map(int, input().split()))
time = t - c[0]
coor = abs(c[1] - x) + abs(c[2] - y)
if not (time >= coor and coor % 2 == time % 2):
print("No")
exit()
c = [t, x, y]
print("Yes")
| false | 15.384615 | [
"-txy = [[0, 0, 0] if i == 0 else list(map(int, input().split())) for i in range(n + 1)]",
"-flag = True",
"+c = [0, 0, 0]",
"- dist = abs(txy[i][1] - txy[i + 1][1]) + abs(txy[i][2] - txy[i + 1][2])",
"- time = txy[i + 1][0] - txy[i][0]",
"- dif = time - dist",
"- if dif < 0 or dif % 2 == 1:... | false | 0.047873 | 0.048141 | 0.994433 | [
"s652047301",
"s657210884"
] |
u457901067 | p03426 | python | s729706401 | s408448542 | 1,021 | 937 | 18,612 | 9,264 | Accepted | Accepted | 8.23 | H, W, D = list(map(int,input().split()))
arr = [[0 for i in range(2)] for j in range(H*W+1)]
for i in range(H):
tmp = list(map(int,input().split()))
for j in range(len(tmp)):
x = tmp[j]
arr[x][0], arr[x][1] = i, j
cumsum = [0] * (H*W+1)
for i in range(D+1,H*W+1):
cumsum[i] = cumsum[i-D] + abs... | #memoryが少ない例。下手に2次元とかでやるより良いってこと?
H, W, D = [int(i) for i in input().split()]
px = [0] * 90001
py = [0] * 90001
for i in range(H):
a = [int(i) for i in input().split()]
for j, v in enumerate(a):
px[v] = j
py[v] = i
d = [0] * 90001
for i in range(D + 1, 90001):
d[i] = d[i - D] ... | 17 | 21 | 488 | 489 | H, W, D = list(map(int, input().split()))
arr = [[0 for i in range(2)] for j in range(H * W + 1)]
for i in range(H):
tmp = list(map(int, input().split()))
for j in range(len(tmp)):
x = tmp[j]
arr[x][0], arr[x][1] = i, j
cumsum = [0] * (H * W + 1)
for i in range(D + 1, H * W + 1):
cumsum[i] =... | # memoryが少ない例。下手に2次元とかでやるより良いってこと?
H, W, D = [int(i) for i in input().split()]
px = [0] * 90001
py = [0] * 90001
for i in range(H):
a = [int(i) for i in input().split()]
for j, v in enumerate(a):
px[v] = j
py[v] = i
d = [0] * 90001
for i in range(D + 1, 90001):
d[i] = d[i - D] + abs(px[i] - ... | false | 19.047619 | [
"-H, W, D = list(map(int, input().split()))",
"-arr = [[0 for i in range(2)] for j in range(H * W + 1)]",
"+# memoryが少ない例。下手に2次元とかでやるより良いってこと?",
"+H, W, D = [int(i) for i in input().split()]",
"+px = [0] * 90001",
"+py = [0] * 90001",
"- tmp = list(map(int, input().split()))",
"- for j in range(... | false | 0.098308 | 0.216944 | 0.45315 | [
"s729706401",
"s408448542"
] |
u330661451 | p03061 | python | s176064188 | s468193112 | 224 | 191 | 16,152 | 16,124 | Accepted | Accepted | 14.73 | from fractions import gcd
n = int(eval(input()))
a = list(map(int,input().split()))
lg = [a[0]]
rg = [a[-1]]
for i in range(n-1):
lg.append(gcd(lg[-1],a[i+1]))
rg.append(gcd(rg[-1],a[-i-2]))
rg.reverse()
ans = 0
for i in range(n):
if i == 0:
ans = rg[i+1]
elif i == n-1:
ans... | from fractions import gcd
def main():
n = int(eval(input()))
a = list(map(int,input().split()))
lg = [a[0]]
rg = [a[-1]]
for i in range(n-1):
lg.append(gcd(lg[-1],a[i+1]))
rg.append(gcd(rg[-1],a[-i-2]))
rg.reverse()
ans = 0
for i in range(n):
if i == 0... | 19 | 23 | 403 | 526 | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
lg = [a[0]]
rg = [a[-1]]
for i in range(n - 1):
lg.append(gcd(lg[-1], a[i + 1]))
rg.append(gcd(rg[-1], a[-i - 2]))
rg.reverse()
ans = 0
for i in range(n):
if i == 0:
ans = rg[i + 1]
elif i == n - 1:
ans... | from fractions import gcd
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
lg = [a[0]]
rg = [a[-1]]
for i in range(n - 1):
lg.append(gcd(lg[-1], a[i + 1]))
rg.append(gcd(rg[-1], a[-i - 2]))
rg.reverse()
ans = 0
for i in range(n):
if i == 0:... | false | 17.391304 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-lg = [a[0]]",
"-rg = [a[-1]]",
"-for i in range(n - 1):",
"- lg.append(gcd(lg[-1], a[i + 1]))",
"- rg.append(gcd(rg[-1], a[-i - 2]))",
"-rg.reverse()",
"-ans = 0",
"-for i in range(n):",
"- if i == 0:",
"- ans... | false | 0.056841 | 0.057113 | 0.995223 | [
"s176064188",
"s468193112"
] |
u123756661 | p03775 | python | s373576782 | s547732399 | 188 | 67 | 39,920 | 64,484 | Accepted | Accepted | 64.36 | import math
n=int(eval(input()))
tmp=math.ceil(n**0.5)+1
ans=1000000
for i in range(1,tmp):
if n%i==0:
tmp=n//i
ans=min(ans,len(str(tmp)))
print(ans) | n=int(eval(input()))
ans=1000
for i in range(1,100001):
if n%i==0:
ans=min(ans,len(str(max(n//i,i))))
print(ans) | 10 | 6 | 173 | 123 | import math
n = int(eval(input()))
tmp = math.ceil(n**0.5) + 1
ans = 1000000
for i in range(1, tmp):
if n % i == 0:
tmp = n // i
ans = min(ans, len(str(tmp)))
print(ans)
| n = int(eval(input()))
ans = 1000
for i in range(1, 100001):
if n % i == 0:
ans = min(ans, len(str(max(n // i, i))))
print(ans)
| false | 40 | [
"-import math",
"-",
"-tmp = math.ceil(n**0.5) + 1",
"-ans = 1000000",
"-for i in range(1, tmp):",
"+ans = 1000",
"+for i in range(1, 100001):",
"- tmp = n // i",
"- ans = min(ans, len(str(tmp)))",
"+ ans = min(ans, len(str(max(n // i, i))))"
] | false | 0.043081 | 0.052097 | 0.826932 | [
"s373576782",
"s547732399"
] |
u215693191 | p03723 | python | s646003887 | s576611976 | 12 | 11 | 2,696 | 2,692 | Accepted | Accepted | 8.33 | def count(seq):
seq = sorted(seq)
arrived = {}
arrived[seq[0]] = {}
arrived[seq[0]][seq[1]] = True
foo = 0
s = sum(seq)
while True:
if (seq[0]&1==1) or (seq[1]&1==1) or (seq[2]&1==1):
break
seq = [(s-seq[i])>>1 for i in range(3)]
seq = sorted(se... | def count(seq):
seq = sorted(seq)
if (seq[0] & 1) == 1 or (seq[1] & 1) == 1 or (seq[2] & 1) == 1:
return 0
x , y = [seq[1] - seq[0], seq[2] - seq[0]]
if x == 0 and y == 0:
return -1
elif x == 0:
k = x & -x
elif y == 0:
k = y & -y
else:
k = ... | 28 | 25 | 720 | 565 | def count(seq):
seq = sorted(seq)
arrived = {}
arrived[seq[0]] = {}
arrived[seq[0]][seq[1]] = True
foo = 0
s = sum(seq)
while True:
if (seq[0] & 1 == 1) or (seq[1] & 1 == 1) or (seq[2] & 1 == 1):
break
seq = [(s - seq[i]) >> 1 for i in range(3)]
seq = sort... | def count(seq):
seq = sorted(seq)
if (seq[0] & 1) == 1 or (seq[1] & 1) == 1 or (seq[2] & 1) == 1:
return 0
x, y = [seq[1] - seq[0], seq[2] - seq[0]]
if x == 0 and y == 0:
return -1
elif x == 0:
k = x & -x
elif y == 0:
k = y & -y
else:
k = min(x & -x, y... | false | 10.714286 | [
"- arrived = {}",
"- arrived[seq[0]] = {}",
"- arrived[seq[0]][seq[1]] = True",
"+ if (seq[0] & 1) == 1 or (seq[1] & 1) == 1 or (seq[2] & 1) == 1:",
"+ return 0",
"+ x, y = [seq[1] - seq[0], seq[2] - seq[0]]",
"+ if x == 0 and y == 0:",
"+ return -1",
"+ elif x == ... | false | 0.037996 | 0.076746 | 0.495083 | [
"s646003887",
"s576611976"
] |
u089230684 | p03478 | python | s358527634 | s658216829 | 40 | 25 | 3,572 | 2,940 | Accepted | Accepted | 37.5 | lines = input().split(' ')
N = int(lines[0])
A = int(lines[1])
B = int(lines[2])
nums = [str(x) for x in range(1,N+1)]
total = 0
for i in range(N):
sum = 0
l = len(nums[i])
for j in range(l):
sum += int(nums[i][j])
if sum >= A and sum <= B:
total += int(nums[i])
print(total)
| n, A, B = list(map(int, input().split()))
def ok(a):
s = 0
while a > 0:
s += a % 10
a //= 10
return (A <= s and s <= B)
s = 0
for i in range(1, n+1):
if ok(i):
s += i
print(s) | 18 | 14 | 305 | 224 | lines = input().split(" ")
N = int(lines[0])
A = int(lines[1])
B = int(lines[2])
nums = [str(x) for x in range(1, N + 1)]
total = 0
for i in range(N):
sum = 0
l = len(nums[i])
for j in range(l):
sum += int(nums[i][j])
if sum >= A and sum <= B:
total += int(nums[i])
print(total)
| n, A, B = list(map(int, input().split()))
def ok(a):
s = 0
while a > 0:
s += a % 10
a //= 10
return A <= s and s <= B
s = 0
for i in range(1, n + 1):
if ok(i):
s += i
print(s)
| false | 22.222222 | [
"-lines = input().split(\" \")",
"-N = int(lines[0])",
"-A = int(lines[1])",
"-B = int(lines[2])",
"-nums = [str(x) for x in range(1, N + 1)]",
"-total = 0",
"-for i in range(N):",
"- sum = 0",
"- l = len(nums[i])",
"- for j in range(l):",
"- sum += int(nums[i][j])",
"- if s... | false | 0.046622 | 0.045969 | 1.014204 | [
"s358527634",
"s658216829"
] |
u561992253 | p03246 | python | s389479412 | s073555983 | 132 | 119 | 23,852 | 20,724 | Accepted | Accepted | 9.85 | n = int(eval(input()))
l = list(map(int, input().split()))
if n == 2:
if l[0] == l[1]:
print((1))
else:
print((0))
else:
a = []
b = []
for i in range(n):
if i % 2 == 0:
a.append(l[i])
else:
b.append(l[i])
da = {}
for... | n = int(eval(input()))
l = list(map(int, input().split()))
a = []
b = []
for i in range(n):
if i % 2 == 0:
a.append(l[i])
else:
b.append(l[i])
def createMyList(li):
d = {-1:(0,-1)}
for e in li:
if e not in d:
d[e] = (1,e)
else:
... | 46 | 31 | 911 | 611 | n = int(eval(input()))
l = list(map(int, input().split()))
if n == 2:
if l[0] == l[1]:
print((1))
else:
print((0))
else:
a = []
b = []
for i in range(n):
if i % 2 == 0:
a.append(l[i])
else:
b.append(l[i])
da = {}
for e in a:
if ... | n = int(eval(input()))
l = list(map(int, input().split()))
a = []
b = []
for i in range(n):
if i % 2 == 0:
a.append(l[i])
else:
b.append(l[i])
def createMyList(li):
d = {-1: (0, -1)}
for e in li:
if e not in d:
d[e] = (1, e)
else:
d[e] = (d[e][0]... | false | 32.608696 | [
"-if n == 2:",
"- if l[0] == l[1]:",
"- print((1))",
"+a = []",
"+b = []",
"+for i in range(n):",
"+ if i % 2 == 0:",
"+ a.append(l[i])",
"- print((0))",
"+ b.append(l[i])",
"+",
"+",
"+def createMyList(li):",
"+ d = {-1: (0, -1)}",
"+ for e in li:... | false | 0.081911 | 0.086565 | 0.946231 | [
"s389479412",
"s073555983"
] |
u923668099 | p00002 | python | s894568166 | s642327130 | 30 | 20 | 7,536 | 7,628 | Accepted | Accepted | 33.33 |
while 1:
try:
a, b = list(map(int, input().split()))
c = str(a + b)
print((len(c)))
except:
break | import sys
def solve():
while True:
try:
a, b = list(map(int, sys.stdin.readline().split()))
c = a + b
if c == 0:
print((1))
else:
ans = 0
while c > 0:
ans += 1
... | 9 | 24 | 139 | 439 | while 1:
try:
a, b = list(map(int, input().split()))
c = str(a + b)
print((len(c)))
except:
break
| import sys
def solve():
while True:
try:
a, b = list(map(int, sys.stdin.readline().split()))
c = a + b
if c == 0:
print((1))
else:
ans = 0
while c > 0:
ans += 1
c //= 10
... | false | 62.5 | [
"-while 1:",
"- try:",
"- a, b = list(map(int, input().split()))",
"- c = str(a + b)",
"- print((len(c)))",
"- except:",
"- break",
"+import sys",
"+",
"+",
"+def solve():",
"+ while True:",
"+ try:",
"+ a, b = list(map(int, sys.stdin.... | false | 0.04444 | 0.044313 | 1.002857 | [
"s894568166",
"s642327130"
] |
u867848444 | p02996 | python | s640274764 | s940329298 | 1,238 | 925 | 67,924 | 53,600 | Accepted | Accepted | 25.28 | from operator import itemgetter
n=int(eval(input()))
ab=[list(map(int,input().split())) for i in range(n)]
ab=sorted(ab, key=itemgetter(1,0))
#print(ab)
time=0
for todotime,deadline in ab:
time += todotime
if not (time <= deadline) :
print('No')
exit()
print('Yes') | n=int(eval(input()))
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(key=lambda x:x[1])
#print(ab)
time=0
for a,b in ab:
temp=time+a
if temp<=b:
time=temp
else:
print('No')
exit()
print('Yes') | 13 | 13 | 296 | 248 | from operator import itemgetter
n = int(eval(input()))
ab = [list(map(int, input().split())) for i in range(n)]
ab = sorted(ab, key=itemgetter(1, 0))
# print(ab)
time = 0
for todotime, deadline in ab:
time += todotime
if not (time <= deadline):
print("No")
exit()
print("Yes")
| n = int(eval(input()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[1])
# print(ab)
time = 0
for a, b in ab:
temp = time + a
if temp <= b:
time = temp
else:
print("No")
exit()
print("Yes")
| false | 0 | [
"-from operator import itemgetter",
"-",
"-ab = sorted(ab, key=itemgetter(1, 0))",
"+ab.sort(key=lambda x: x[1])",
"-for todotime, deadline in ab:",
"- time += todotime",
"- if not (time <= deadline):",
"+for a, b in ab:",
"+ temp = time + a",
"+ if temp <= b:",
"+ time = temp... | false | 0.043925 | 0.049294 | 0.891087 | [
"s640274764",
"s940329298"
] |
u794173881 | p03061 | python | s129645946 | s161710148 | 418 | 257 | 89,580 | 63,984 | Accepted | Accepted | 38.52 | import fractions
n = int(eval(input()))
a = list(map(int, input().split()))
new_ans = 0
li = [0]*n
li2 = [0]*n
li[0] = a[0]
li2[n-1] = a[n-1]
for i in range(1,n):
li[i] =fractions.gcd(li[i-1], a[i])
for i in range(1,n)[::-1]:
li2[i-1] =fractions.gcd(li2[i], a[i-1])
ans =0
for i in range(1,n... | def gcd(a: int, b: int) -> int:
"""a, bの最大公約数(greatest common divisor: GCD)を求める
計算量: O(log(min(a, b)))
"""
if b == 0:
return a
return gcd(b, a%b)
def ruiseki_lr(array):
"""左右からの畳み込みをそれぞれ計算する
left[p] := 区間[0, p)の畳み込み
right[p] := 区間[p, n)の畳み込み
"""
op = lambda... | 23 | 37 | 445 | 781 | import fractions
n = int(eval(input()))
a = list(map(int, input().split()))
new_ans = 0
li = [0] * n
li2 = [0] * n
li[0] = a[0]
li2[n - 1] = a[n - 1]
for i in range(1, n):
li[i] = fractions.gcd(li[i - 1], a[i])
for i in range(1, n)[::-1]:
li2[i - 1] = fractions.gcd(li2[i], a[i - 1])
ans = 0
for i in range(1, n... | def gcd(a: int, b: int) -> int:
"""a, bの最大公約数(greatest common divisor: GCD)を求める
計算量: O(log(min(a, b)))
"""
if b == 0:
return a
return gcd(b, a % b)
def ruiseki_lr(array):
"""左右からの畳み込みをそれぞれ計算する
left[p] := 区間[0, p)の畳み込み
right[p] := 区間[p, n)の畳み込み
"""
op = lambda a, b: gcd... | false | 37.837838 | [
"-import fractions",
"+def gcd(a: int, b: int) -> int:",
"+ \"\"\"a, bの最大公約数(greatest common divisor: GCD)を求める",
"+ 計算量: O(log(min(a, b)))",
"+ \"\"\"",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"+",
"+",
"+def ruiseki_lr(array):",
"+ \"\"\"左右からの畳み込みをそれぞれ... | false | 0.053051 | 0.040789 | 1.300632 | [
"s129645946",
"s161710148"
] |
u888092736 | p03411 | python | s173072394 | s381081955 | 481 | 377 | 56,416 | 56,580 | Accepted | Accepted | 21.62 | import networkx as nx
from networkx.algorithms.flow import dinitz
N = int(eval(input()))
reds = [tuple(map(int, input().split())) for _ in range(N)]
blues = [tuple(map(int, input().split())) for _ in range(N)]
G = nx.DiGraph()
for rx, ry in reds:
for bx, by in blues:
if rx < bx and ry < by:
... | import networkx as nx
N = int(eval(input()))
reds = [tuple(map(int, input().split())) for _ in range(N)]
blues = [tuple(map(int, input().split())) for _ in range(N)]
G = nx.DiGraph()
for rx, ry in reds:
for bx, by in blues:
if rx < bx and ry < by:
G.add_edge("S", (rx, ry), capacity=1)
... | 19 | 16 | 565 | 501 | import networkx as nx
from networkx.algorithms.flow import dinitz
N = int(eval(input()))
reds = [tuple(map(int, input().split())) for _ in range(N)]
blues = [tuple(map(int, input().split())) for _ in range(N)]
G = nx.DiGraph()
for rx, ry in reds:
for bx, by in blues:
if rx < bx and ry < by:
G.a... | import networkx as nx
N = int(eval(input()))
reds = [tuple(map(int, input().split())) for _ in range(N)]
blues = [tuple(map(int, input().split())) for _ in range(N)]
G = nx.DiGraph()
for rx, ry in reds:
for bx, by in blues:
if rx < bx and ry < by:
G.add_edge("S", (rx, ry), capacity=1)
... | false | 15.789474 | [
"-from networkx.algorithms.flow import dinitz",
"- R = dinitz(G, \"S\", \"T\")",
"- print((R.graph[\"flow_value\"]))",
"+ print((nx.maximum_flow_value(G, \"S\", \"T\")))"
] | false | 0.123946 | 0.048141 | 2.574637 | [
"s173072394",
"s381081955"
] |
u759412327 | p03436 | python | s510969848 | s481644424 | 36 | 33 | 9,484 | 9,468 | Accepted | Accepted | 8.33 | from collections import *
H,W = list(map(int,input().split()))
S = [eval(input()) for h in range(H)]
V = [W*[0] for h in range(H)]
V[0][0] = 1
Q = deque([(0,0)])
while Q:
x,y = Q.popleft()
for dx,dy in ((-1,0),(0,-1),(1,0),(0,1)):
if 0<=x+dx<H and 0<=y+dy<W and V[x+dx][y+dy]==0 and S[x+dx][y+dy]==".":
... | from collections import *
H,W = list(map(int,input().split()))
S = [(W+2)*["#"]]+list(["#"]+list(eval(input()))+["#"] for h in range(H))+[(W+2)*["#"]]
S[1][1] = 1
Q = deque([[1,1]])
D = [[1,0],[-1,0],[0,1],[0,-1]]
while Q:
x,y = Q.popleft()
for dx,dy in D:
if S[x+dx][y+dy]==".":
S[x+dx][y+dy] ... | 17 | 18 | 466 | 447 | from collections import *
H, W = list(map(int, input().split()))
S = [eval(input()) for h in range(H)]
V = [W * [0] for h in range(H)]
V[0][0] = 1
Q = deque([(0, 0)])
while Q:
x, y = Q.popleft()
for dx, dy in ((-1, 0), (0, -1), (1, 0), (0, 1)):
if (
0 <= x + dx < H
and 0 <= y + ... | from collections import *
H, W = list(map(int, input().split()))
S = (
[(W + 2) * ["#"]]
+ list(["#"] + list(eval(input())) + ["#"] for h in range(H))
+ [(W + 2) * ["#"]]
)
S[1][1] = 1
Q = deque([[1, 1]])
D = [[1, 0], [-1, 0], [0, 1], [0, -1]]
while Q:
x, y = Q.popleft()
for dx, dy in D:
if... | false | 5.555556 | [
"-S = [eval(input()) for h in range(H)]",
"-V = [W * [0] for h in range(H)]",
"-V[0][0] = 1",
"-Q = deque([(0, 0)])",
"+S = (",
"+ [(W + 2) * [\"#\"]]",
"+ + list([\"#\"] + list(eval(input())) + [\"#\"] for h in range(H))",
"+ + [(W + 2) * [\"#\"]]",
"+)",
"+S[1][1] = 1",
"+Q = deque([[... | false | 0.094763 | 0.043564 | 2.175258 | [
"s510969848",
"s481644424"
] |
u777923818 | p03103 | python | s065825336 | s381940590 | 564 | 463 | 29,748 | 33,016 | Accepted | Accepted | 17.91 | # -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N, M = inpl()
X = sorted([inpl() for _ in range(N)], key=lambda x: x[0])
ans = 0
for a, b in X:
cnt = min(M, b)
ans += a*cnt
M -= cnt
print(ans) | def inpl(): return list(map(int, input().split()))
N, M = inpl()
X = sorted([inpl() for _ in range(N)], key=lambda x: -x[0])
ans = 0
while M:
a, b = X.pop()
buy = min(M, b)
ans += a*buy
M -= buy
print(ans) | 13 | 10 | 246 | 230 | # -*- coding: utf-8 -*-
def inpl():
return list(map(int, input().split()))
N, M = inpl()
X = sorted([inpl() for _ in range(N)], key=lambda x: x[0])
ans = 0
for a, b in X:
cnt = min(M, b)
ans += a * cnt
M -= cnt
print(ans)
| def inpl():
return list(map(int, input().split()))
N, M = inpl()
X = sorted([inpl() for _ in range(N)], key=lambda x: -x[0])
ans = 0
while M:
a, b = X.pop()
buy = min(M, b)
ans += a * buy
M -= buy
print(ans)
| false | 23.076923 | [
"-# -*- coding: utf-8 -*-",
"-X = sorted([inpl() for _ in range(N)], key=lambda x: x[0])",
"+X = sorted([inpl() for _ in range(N)], key=lambda x: -x[0])",
"-for a, b in X:",
"- cnt = min(M, b)",
"- ans += a * cnt",
"- M -= cnt",
"+while M:",
"+ a, b = X.pop()",
"+ buy = min(M, b)",
... | false | 0.04986 | 0.045762 | 1.089551 | [
"s065825336",
"s381940590"
] |
u673173160 | p02603 | python | s796932929 | s242514557 | 70 | 64 | 65,500 | 61,532 | Accepted | Accepted | 8.57 | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;cnt = 0 ;pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
now = 1000
for i in range(n-1):
if A[i] < A[i+1]:
... | n = int(eval(input()))
A = list(map(int, input().split()))
now = 1000
for i in range(n-1):
if A[i] < A[i+1]:
stocks = now // A[i]
now += (A[i+1] - A[i])*stocks
print(now) | 13 | 8 | 387 | 191 | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
cnt = 0
pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
now = 1000
for i in range(n - 1):
if A[i] < A[i + 1]:
stocks... | n = int(eval(input()))
A = list(map(int, input().split()))
now = 1000
for i in range(n - 1):
if A[i] < A[i + 1]:
stocks = now // A[i]
now += (A[i + 1] - A[i]) * stocks
print(now)
| false | 38.461538 | [
"-import sys, math, itertools, collections, bisect",
"-",
"-input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"-inf = float(\"inf\")",
"-mod = 10**9 + 7",
"-mans = inf",
"-ans = 0",
"-cnt = 0",
"-pro = 1"
] | false | 0.055068 | 0.050363 | 1.09343 | [
"s796932929",
"s242514557"
] |
u838644735 | p03821 | python | s839032841 | s111681782 | 114 | 102 | 25,124 | 25,124 | Accepted | Accepted | 10.53 | def main():
N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
index = N - 1 - i
a = AB[index * 2 + 0] + ans
b = AB[index * 2 + 1]
remainder = a % b
ans += (b - remainder) % b
print(ans)
if __name__ == "__main__":
main()
| def main():
N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N - 1, -1, -1):
a = AB[i * 2 + 0]
b = AB[i * 2 + 1]
ans += (b - a - ans) % b
print(ans)
if __name__ == "__main__":
main()
| 13 | 11 | 312 | 254 | def main():
N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
index = N - 1 - i
a = AB[index * 2 + 0] + ans
b = AB[index * 2 + 1]
remainder = a % b
ans += (b - remainder) % b
print(ans)
if __name__ == "__main__":
main()
| def main():
N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N - 1, -1, -1):
a = AB[i * 2 + 0]
b = AB[i * 2 + 1]
ans += (b - a - ans) % b
print(ans)
if __name__ == "__main__":
main()
| false | 15.384615 | [
"- for i in range(N):",
"- index = N - 1 - i",
"- a = AB[index * 2 + 0] + ans",
"- b = AB[index * 2 + 1]",
"- remainder = a % b",
"- ans += (b - remainder) % b",
"+ for i in range(N - 1, -1, -1):",
"+ a = AB[i * 2 + 0]",
"+ b = AB[i * 2 + 1]",
... | false | 0.040326 | 0.045624 | 0.883863 | [
"s839032841",
"s111681782"
] |
u941753895 | p03339 | python | s902379673 | s482626347 | 674 | 311 | 104,264 | 32,000 | Accepted | Accepted | 53.86 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n=I(... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n=I(... | 64 | 38 | 1,110 | 660 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 40.625 | [
"- s = list(S())",
"- l1 = []",
"+ l = list(S())",
"+ l1 = [0] * n",
"+ for i in range(n):",
"+ if l[i] == \"E\":",
"+ l1[i] += 1",
"+ for i in range(1, n):",
"+ l1[i] += l1[i - 1]",
"- a = s[0]",
"- if a == \"W\":",
"- l1.append([1, 0])"... | false | 0.042874 | 0.080632 | 0.531724 | [
"s902379673",
"s482626347"
] |
u682755774 | p02388 | python | s127153516 | s625979384 | 20 | 10 | 4,184 | 6,380 | Accepted | Accepted | 50 | x = eval(input())
print(x**3) | x = eval(input())
x = int(x)
a = x**3
print(a) | 2 | 4 | 23 | 42 | x = eval(input())
print(x**3)
| x = eval(input())
x = int(x)
a = x**3
print(a)
| false | 50 | [
"-print(x**3)",
"+x = int(x)",
"+a = x**3",
"+print(a)"
] | false | 0.039587 | 0.041472 | 0.954544 | [
"s127153516",
"s625979384"
] |
u186838327 | p02959 | python | s294854283 | s044962511 | 295 | 269 | 82,148 | 82,148 | Accepted | Accepted | 8.81 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in reversed(list(range(n+1))):
if i == n:
temp = min(a[i], b[i-1])
ans += temp
b[i-1] -= temp
elif i == 0:
ans += min(a[i], b[i])
else:
temp1 = min(a[i], b[i])
ans ... | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in reversed(list(range(1, n+1))):
if A[i] <= B[i-1]:
ans += A[i]
B[i-1] -= A[i]
if A[i-1] >= B[i-1]:
ans += B[i-1]
A[i-1] -= B[i-1]
else:
... | 22 | 19 | 423 | 424 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in reversed(list(range(n + 1))):
if i == n:
temp = min(a[i], b[i - 1])
ans += temp
b[i - 1] -= temp
elif i == 0:
ans += min(a[i], b[i])
else:
temp1 = min(a[i],... | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in reversed(list(range(1, n + 1))):
if A[i] <= B[i - 1]:
ans += A[i]
B[i - 1] -= A[i]
if A[i - 1] >= B[i - 1]:
ans += B[i - 1]
A[i - 1] -= B[i - 1]
els... | false | 13.636364 | [
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"+B = list(map(int, input().split()))",
"-for i in reversed(list(range(n + 1))):",
"- if i == n:",
"- temp = min(a[i], b[i - 1])",
"- ans += temp",
"- b[i -... | false | 0.125865 | 0.048415 | 2.599722 | [
"s294854283",
"s044962511"
] |
u072717685 | p03160 | python | s625377808 | s007809228 | 132 | 99 | 13,928 | 13,980 | Accepted | Accepted | 25 | n = int(eval(input()))
h = list(map(int, input().split()))
dp=[0] * n
for i in range(1, n):
if i - 2 < 0:
dp[i] = dp[i-1] + abs(h[i] - h[i-1])
else:
dp[i] = min(dp[i-2]+abs(h[i] - h[i-2]) ,dp[i-1]+abs(h[i]-h[i-1]) )
print((dp[n-1])) | def main():
n = int(eval(input()))
h = list(map(int, input().split()))
cost_dp = [0] * n
cost_dp[1] = abs(h[0] - h[1])
for i in range(2,n):
cost_dp[i] = min(cost_dp[i-2]+abs(h[i]- h[i-2]),cost_dp[i-1]+abs(h[i]-h[i-1]))
print((cost_dp[n-1]))
if __name__ == '__main__':
mai... | 11 | 12 | 250 | 316 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
for i in range(1, n):
if i - 2 < 0:
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
else:
dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))
print((dp[n - 1]))
| def main():
n = int(eval(input()))
h = list(map(int, input().split()))
cost_dp = [0] * n
cost_dp[1] = abs(h[0] - h[1])
for i in range(2, n):
cost_dp[i] = min(
cost_dp[i - 2] + abs(h[i] - h[i - 2]), cost_dp[i - 1] + abs(h[i] - h[i - 1])
)
print((cost_dp[n - 1]))
if _... | false | 8.333333 | [
"-n = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-dp = [0] * n",
"-for i in range(1, n):",
"- if i - 2 < 0:",
"- dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])",
"- else:",
"- dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))",
"-print((... | false | 0.047298 | 0.047787 | 0.989767 | [
"s625377808",
"s007809228"
] |
u706929073 | p03206 | python | s212146828 | s110946708 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | num = 25 - int(eval(input()))
s = "Christmas"
for _ in range(num):
s = "{} {}".format(s, "Eve")
print(s) | d = int(eval(input()))
msg = 'Christmas'
for _ in range(25 - d):
msg += ' Eve'
print(msg) | 5 | 5 | 106 | 88 | num = 25 - int(eval(input()))
s = "Christmas"
for _ in range(num):
s = "{} {}".format(s, "Eve")
print(s)
| d = int(eval(input()))
msg = "Christmas"
for _ in range(25 - d):
msg += " Eve"
print(msg)
| false | 0 | [
"-num = 25 - int(eval(input()))",
"-s = \"Christmas\"",
"-for _ in range(num):",
"- s = \"{} {}\".format(s, \"Eve\")",
"-print(s)",
"+d = int(eval(input()))",
"+msg = \"Christmas\"",
"+for _ in range(25 - d):",
"+ msg += \" Eve\"",
"+print(msg)"
] | false | 0.050847 | 0.046883 | 1.084548 | [
"s212146828",
"s110946708"
] |
u559103167 | p03329 | python | s445760293 | s458470811 | 631 | 352 | 3,828 | 3,060 | Accepted | Accepted | 44.22 | N = int(eval(input()))
dp = [1e10]*(N+1)
dp[0] = 0
for i in range(1,N+1):
power = 1
while power <= i:
dp[i] = min(dp[i], dp[i-power]+1)
power *= 6
power = 1
while power<=i:
dp[i] = min(dp[i], dp[i-power]+1)
power *= 9
print((dp[N])) | N = int(eval(input()))
ans = N
for i in range(N+1):
cnt = 0
t = i
while t>0:
cnt+=t%6
t//=6
j=N-i
while j>0:
cnt+=j%9
j//=9
ans = min(ans,cnt)
print(ans) | 13 | 14 | 284 | 216 | N = int(eval(input()))
dp = [1e10] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
power = 1
while power <= i:
dp[i] = min(dp[i], dp[i - power] + 1)
power *= 6
power = 1
while power <= i:
dp[i] = min(dp[i], dp[i - power] + 1)
power *= 9
print((dp[N]))
| N = int(eval(input()))
ans = N
for i in range(N + 1):
cnt = 0
t = i
while t > 0:
cnt += t % 6
t //= 6
j = N - i
while j > 0:
cnt += j % 9
j //= 9
ans = min(ans, cnt)
print(ans)
| false | 7.142857 | [
"-dp = [1e10] * (N + 1)",
"-dp[0] = 0",
"-for i in range(1, N + 1):",
"- power = 1",
"- while power <= i:",
"- dp[i] = min(dp[i], dp[i - power] + 1)",
"- power *= 6",
"- power = 1",
"- while power <= i:",
"- dp[i] = min(dp[i], dp[i - power] + 1)",
"- power... | false | 0.123859 | 0.060236 | 2.056246 | [
"s445760293",
"s458470811"
] |
u052332717 | p03473 | python | s027246815 | s605660639 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | a = int(eval(input()))
print((48 - a)) | m = int(eval(input()))
print((48-m)) | 2 | 2 | 31 | 29 | a = int(eval(input()))
print((48 - a))
| m = int(eval(input()))
print((48 - m))
| false | 0 | [
"-a = int(eval(input()))",
"-print((48 - a))",
"+m = int(eval(input()))",
"+print((48 - m))"
] | false | 0.044047 | 0.045193 | 0.974624 | [
"s027246815",
"s605660639"
] |
u608088992 | p03062 | python | s618777779 | s949109811 | 212 | 154 | 25,580 | 31,012 | Accepted | Accepted | 27.36 | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(a) for a in input().split()]
DP = [[-10 ** 20] * 2 for _ in range(N)]
DP[0][0] = A[0]
DP[0][1] = -1 * A[0]
for i in range(1, N):
a = A[i]
DP[i][0] = max(max(DP[i-1][0] + a, DP[i-1][... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(a) for a in input().split()]
DP = [[-10 ** 20, -10 ** 20] for _ in range(N)] #[-1が偶数, -1が奇数]
DP[0] = [A[0], -1 * A[0]]
for i in range(1, N):
DP[i][0] = max(DP[i-1][0] + A[i], DP[i-1][1] - A[i])
... | 20 | 19 | 487 | 474 | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(a) for a in input().split()]
DP = [[-(10**20)] * 2 for _ in range(N)]
DP[0][0] = A[0]
DP[0][1] = -1 * A[0]
for i in range(1, N):
a = A[i]
DP[i][0] = max(max(DP[i - 1][0] + a, DP[i - 1][1] - a... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(a) for a in input().split()]
DP = [[-(10**20), -(10**20)] for _ in range(N)] # [-1が偶数, -1が奇数]
DP[0] = [A[0], -1 * A[0]]
for i in range(1, N):
DP[i][0] = max(DP[i - 1][0] + A[i], DP[i - 1][1] - A[i])
... | false | 5 | [
"- DP = [[-(10**20)] * 2 for _ in range(N)]",
"- DP[0][0] = A[0]",
"- DP[0][1] = -1 * A[0]",
"+ DP = [[-(10**20), -(10**20)] for _ in range(N)] # [-1が偶数, -1が奇数]",
"+ DP[0] = [A[0], -1 * A[0]]",
"- a = A[i]",
"- DP[i][0] = max(max(DP[i - 1][0] + a, DP[i - 1][1] - a), DP[i][0... | false | 0.036625 | 0.035785 | 1.023459 | [
"s618777779",
"s949109811"
] |
u177411511 | p03074 | python | s877219766 | s769134140 | 152 | 126 | 4,212 | 8,004 | Accepted | Accepted | 17.11 | n, k = list(map(int, input().split()))
s = eval(input())
now = 1
cnt = 0
Nums = []
for i in range(len(s)):
if s[i] == str(now):
cnt += 1
else:
Nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
Nums.append(cnt)
if len(Nums) % 2 == 0:
Nums.append(0)
ans ... | n, k = list(map(int, input().split()))
s = eval(input())
now = 1
cnt = 0
Nums = []
for i in range(len(s)):
if s[i] == str(now):
cnt += 1
else:
Nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
Nums.append(cnt)
if len(Nums) % 2 == 0:
Nums.append(0)
ans ... | 38 | 32 | 655 | 589 | n, k = list(map(int, input().split()))
s = eval(input())
now = 1
cnt = 0
Nums = []
for i in range(len(s)):
if s[i] == str(now):
cnt += 1
else:
Nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
Nums.append(cnt)
if len(Nums) % 2 == 0:
Nums.append(0)
ans = 0
Add = 2 * k + ... | n, k = list(map(int, input().split()))
s = eval(input())
now = 1
cnt = 0
Nums = []
for i in range(len(s)):
if s[i] == str(now):
cnt += 1
else:
Nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
Nums.append(cnt)
if len(Nums) % 2 == 0:
Nums.append(0)
ans = 0
Add = 2 * k + ... | false | 15.789474 | [
"-left = 0",
"-right = 0",
"-tmp = 0",
"+sum = [0] * (len(Nums) + 1)",
"+for i in range(len(Nums)):",
"+ sum[i + 1] = sum[i] + Nums[i]",
"- Nextleft = i",
"- Nextright = min(i + Add, len(Nums))",
"- while Nextleft > left:",
"- tmp -= Nums[left]",
"- left += 1",
"- ... | false | 0.036245 | 0.039234 | 0.923807 | [
"s877219766",
"s769134140"
] |
u148551245 | p03377 | python | s924119972 | s376788193 | 177 | 19 | 38,384 | 3,060 | Accepted | Accepted | 89.27 | (a, b, x) = list(map(int, input().split()))
if a <= x <= a + b:
print("YES")
else:
print("NO") | a, b, x= list(map(int, input().split()))
if (a <= x <= a+b):
print("YES")
else:
print("NO") | 5 | 5 | 100 | 97 | (a, b, x) = list(map(int, input().split()))
if a <= x <= a + b:
print("YES")
else:
print("NO")
| a, b, x = list(map(int, input().split()))
if a <= x <= a + b:
print("YES")
else:
print("NO")
| false | 0 | [
"-(a, b, x) = list(map(int, input().split()))",
"+a, b, x = list(map(int, input().split()))"
] | false | 0.04409 | 0.04515 | 0.976519 | [
"s924119972",
"s376788193"
] |
u470936782 | p03295 | python | s936366395 | s932969389 | 439 | 404 | 31,796 | 22,840 | Accepted | Accepted | 7.97 | N, M = [int(str) for str in input().strip().split()]
AB = [[int(str) for str in input().strip().split()] for _ in range(M)]
B_A = [[] for i in range(N + 1)]
for ab in AB:
B_A[ab[1]].append(ab[0])
for b_a in B_A:
b_a.sort()
right = 0
ans = 0
for i in range(N + 1):
if len(B_A[i]):
if ... | #!/usr/bin/env python3
N, M = [int(str) for str in input().strip().split()]
ab = [[int(str) for str in input().strip().split()] for _ in range(M)]
def solve():
ab.sort(key=lambda x: x[1])
ans = 0
broken = 0
for a, b in ab:
if a < broken:
continue
broken = b
... | 19 | 17 | 402 | 361 | N, M = [int(str) for str in input().strip().split()]
AB = [[int(str) for str in input().strip().split()] for _ in range(M)]
B_A = [[] for i in range(N + 1)]
for ab in AB:
B_A[ab[1]].append(ab[0])
for b_a in B_A:
b_a.sort()
right = 0
ans = 0
for i in range(N + 1):
if len(B_A[i]):
if B_A[i][-1] > righ... | #!/usr/bin/env python3
N, M = [int(str) for str in input().strip().split()]
ab = [[int(str) for str in input().strip().split()] for _ in range(M)]
def solve():
ab.sort(key=lambda x: x[1])
ans = 0
broken = 0
for a, b in ab:
if a < broken:
continue
broken = b
ans += 1... | false | 10.526316 | [
"+#!/usr/bin/env python3",
"-AB = [[int(str) for str in input().strip().split()] for _ in range(M)]",
"-B_A = [[] for i in range(N + 1)]",
"-for ab in AB:",
"- B_A[ab[1]].append(ab[0])",
"-for b_a in B_A:",
"- b_a.sort()",
"-right = 0",
"-ans = 0",
"-for i in range(N + 1):",
"- if len(B... | false | 0.037995 | 0.0647 | 0.587255 | [
"s936366395",
"s932969389"
] |
u389910364 | p03033 | python | s014080521 | s758544828 | 1,790 | 1,389 | 128,744 | 91,396 | Accepted | Accepted | 22.4 | import bisect
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
N, Q = list(map(int, next(sys.stdin).split()))
STX = [list(map(int, next(sys.stdin).split())) for _ in range(N)]
D = [int(next(sys.stdin)) for _ in range(Q)]
ans = [-1 for _ in range(Q)]
nexts = [-1 for _ in range(Q)]
for s, t, x ... | import bisect
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
N, Q = list(map(int, next(sys.stdin).split()))
STX = [list(map(int, next(sys.stdin).split())) for _ in range(N)]
D = [int(next(sys.stdin)) for _ in range(Q)]
ans = [-1] * Q
nexts = [-1] * Q
for s, t, x in sorted(STX, key=lambda st... | 31 | 31 | 789 | 761 | import bisect
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
N, Q = list(map(int, next(sys.stdin).split()))
STX = [list(map(int, next(sys.stdin).split())) for _ in range(N)]
D = [int(next(sys.stdin)) for _ in range(Q)]
ans = [-1 for _ in range(Q)]
nexts = [-1 for _ in range(Q)]
for s, t, x in sorted(STX, k... | import bisect
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
N, Q = list(map(int, next(sys.stdin).split()))
STX = [list(map(int, next(sys.stdin).split())) for _ in range(N)]
D = [int(next(sys.stdin)) for _ in range(Q)]
ans = [-1] * Q
nexts = [-1] * Q
for s, t, x in sorted(STX, key=lambda stx: (stx[2], stx[... | false | 0 | [
"-ans = [-1 for _ in range(Q)]",
"-nexts = [-1 for _ in range(Q)]",
"+ans = [-1] * Q",
"+nexts = [-1] * Q"
] | false | 0.041452 | 0.126006 | 0.328968 | [
"s014080521",
"s758544828"
] |
u196746947 | p02959 | python | s731373806 | s521052746 | 145 | 132 | 19,004 | 19,000 | Accepted | Accepted | 8.97 | n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
sum=0
for i in range(n-1):
if B[i]-A[i]>0:
if A[i+1]-(B[i]-A[i])<0:
# print(A[i]+A[i+1])
sum+=A[i]+A[i+1]
A[i+1]=0
else:
A[i+1]+=-(B[i]-A[i])... | n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
sum=0
for i in range(n-1):
x=B[i]-A[i]
if x>0:
if A[i+1]-(x)<0:
# print(A[i]+A[i+1])
sum+=A[i]+A[i+1]
A[i+1]=0
else:
A[i+1]+=-(x)
... | 26 | 27 | 545 | 538 | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum = 0
for i in range(n - 1):
if B[i] - A[i] > 0:
if A[i + 1] - (B[i] - A[i]) < 0:
# print(A[i]+A[i+1])
sum += A[i] + A[i + 1]
A[i + 1] = 0
else:
A[i + ... | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum = 0
for i in range(n - 1):
x = B[i] - A[i]
if x > 0:
if A[i + 1] - (x) < 0:
# print(A[i]+A[i+1])
sum += A[i] + A[i + 1]
A[i + 1] = 0
else:
A[i + ... | false | 3.703704 | [
"- if B[i] - A[i] > 0:",
"- if A[i + 1] - (B[i] - A[i]) < 0:",
"+ x = B[i] - A[i]",
"+ if x > 0:",
"+ if A[i + 1] - (x) < 0:",
"- A[i + 1] += -(B[i] - A[i])",
"+ A[i + 1] += -(x)"
] | false | 0.094479 | 0.102715 | 0.91982 | [
"s731373806",
"s521052746"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.