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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u477651929 | p03401 | python | s314266910 | s364228839 | 196 | 155 | 14,048 | 13,920 | Accepted | Accepted | 20.92 | n = int(eval(input()))
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
costs = []
for i in range(n + 1):
costs.append(abs(a[i + 1] - a[i]))
s = sum(costs)
for i in range(n):
ans = s - costs[i] - costs[i + 1] + abs(a[i] - a[i + 2])
print(ans) | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
costs = []
for i in range(n + 1):
costs.append(abs(a[i + 1] - a[i]))
s = sum(costs)
for i in range(n):
print((s - costs[i] - costs[i + 1] + abs(a[i] - a[i + 2... | 13 | 16 | 276 | 326 | n = int(eval(input()))
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
costs = []
for i in range(n + 1):
costs.append(abs(a[i + 1] - a[i]))
s = sum(costs)
for i in range(n):
ans = s - costs[i] - costs[i + 1] + abs(a[i] - a[i + 2])
print(ans)
| def main():
n = int(eval(input()))
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
costs = []
for i in range(n + 1):
costs.append(abs(a[i + 1] - a[i]))
s = sum(costs)
for i in range(n):
print((s - costs[i] - costs[i + 1] + abs(a[i] - a[i + 2])))
main()
| false | 18.75 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-a.append(0)",
"-a.insert(0, 0)",
"-costs = []",
"-for i in range(n + 1):",
"- costs.append(abs(a[i + 1] - a[i]))",
"-s = sum(costs)",
"-for i in range(n):",
"- ans = s - costs[i] - costs[i + 1] + abs(a[i] - a[i + 2])",
"-... | false | 0.046637 | 0.047161 | 0.988899 | [
"s314266910",
"s364228839"
] |
u074220993 | p03828 | python | s758751156 | s768406490 | 78 | 69 | 9,452 | 9,372 | Accepted | Accepted | 11.54 | N = int(eval(input()))
mod = 1000000007
from collections import defaultdict as dd
Y = dd(lambda:1)
for i in range(2, N+1):
M = i
for j in range(2,i+1):
while M % j == 0:
Y[j] += 1
M //= j
def product(X):
res = 1
for x in X:
res *= x
res %= ... | N = int(eval(input()))
mod = 1000000007
from collections import Counter
Y = Counter()
for i in range(2, N+1):
M = i
for j in range(2,i+1):
while M % j == 0:
Y[j] += 1
M //= j
def product(X):
res = 1
for x in X:
res *= x + 1
res %= mod
... | 20 | 20 | 379 | 369 | N = int(eval(input()))
mod = 1000000007
from collections import defaultdict as dd
Y = dd(lambda: 1)
for i in range(2, N + 1):
M = i
for j in range(2, i + 1):
while M % j == 0:
Y[j] += 1
M //= j
def product(X):
res = 1
for x in X:
res *= x
res %= mod
... | N = int(eval(input()))
mod = 1000000007
from collections import Counter
Y = Counter()
for i in range(2, N + 1):
M = i
for j in range(2, i + 1):
while M % j == 0:
Y[j] += 1
M //= j
def product(X):
res = 1
for x in X:
res *= x + 1
res %= mod
return re... | false | 0 | [
"-from collections import defaultdict as dd",
"+from collections import Counter",
"-Y = dd(lambda: 1)",
"+Y = Counter()",
"- res *= x",
"+ res *= x + 1"
] | false | 0.046421 | 0.051012 | 0.909997 | [
"s758751156",
"s768406490"
] |
u957084285 | p03644 | python | s316263015 | s568377447 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | n = int(eval(input()))
ans = 1
while ans*2 <= n:
ans *= 2
print(ans) | N = int(eval(input()))
ans = 1
max_count = 0
n = 2
while (n <= N):
k = n
count = 0
while k%2 == 0:
k /= 2
count += 1
if count > max_count:
ans = n
max_count = count
n += 1
print(ans)
| 5 | 15 | 68 | 217 | n = int(eval(input()))
ans = 1
while ans * 2 <= n:
ans *= 2
print(ans)
| N = int(eval(input()))
ans = 1
max_count = 0
n = 2
while n <= N:
k = n
count = 0
while k % 2 == 0:
k /= 2
count += 1
if count > max_count:
ans = n
max_count = count
n += 1
print(ans)
| false | 66.666667 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-while ans * 2 <= n:",
"- ans *= 2",
"+max_count = 0",
"+n = 2",
"+while n <= N:",
"+ k = n",
"+ count = 0",
"+ while k % 2 == 0:",
"+ k /= 2",
"+ count += 1",
"+ if count > max_count:",
"+ ans = n",... | false | 0.048898 | 0.050918 | 0.960319 | [
"s316263015",
"s568377447"
] |
u476604182 | p02821 | python | s361238590 | s826265725 | 1,999 | 1,482 | 14,620 | 14,696 | Accepted | Accepted | 25.86 | from bisect import bisect_left
from itertools import accumulate
N,M,*A = list(map(int, open(0).read().split()))
A.sort()
B = list(accumulate(A[::-1]))
l = -1
r = 10**9
while l+1<r:
s = (l+r)//2
cnt = 0
for c in A:
i = bisect_left(A,s-c)
cnt += N-i
if cnt>=M:
l = s
else:
r = s
... | from bisect import bisect_left
from itertools import accumulate
N,M,*A = list(map(int, open(0).read().split()))
A.sort()
B = list(accumulate(A[::-1]))
l = -1
r = 10**6
while l+1<r:
s = (l+r)//2
cnt = 0
for c in A:
i = bisect_left(A,s-c)
cnt += N-i
if cnt>=M:
l = s
else:
r = s
... | 25 | 25 | 436 | 437 | from bisect import bisect_left
from itertools import accumulate
N, M, *A = list(map(int, open(0).read().split()))
A.sort()
B = list(accumulate(A[::-1]))
l = -1
r = 10**9
while l + 1 < r:
s = (l + r) // 2
cnt = 0
for c in A:
i = bisect_left(A, s - c)
cnt += N - i
if cnt >= M:
l =... | from bisect import bisect_left
from itertools import accumulate
N, M, *A = list(map(int, open(0).read().split()))
A.sort()
B = list(accumulate(A[::-1]))
l = -1
r = 10**6
while l + 1 < r:
s = (l + r) // 2
cnt = 0
for c in A:
i = bisect_left(A, s - c)
cnt += N - i
if cnt >= M:
l =... | false | 0 | [
"-r = 10**9",
"+r = 10**6"
] | false | 0.037023 | 0.04602 | 0.804503 | [
"s361238590",
"s826265725"
] |
u011062360 | p02755 | python | s603562949 | s199241058 | 46 | 31 | 3,064 | 9,080 | Accepted | Accepted | 32.61 | a, b = list(map(int, input().split()))
ans = -1
for i in range(100000):
if int(i*0.08) == a and int(i*0.1) ==b:
ans = i
break
print(ans) | a, b = list(map(int, input().split()))
ans = -1
for money in range(pow(10, 4)):
if int(money*0.08) == a and int(money*0.1) == b:
ans = money
break
print(ans) | 7 | 9 | 156 | 181 | a, b = list(map(int, input().split()))
ans = -1
for i in range(100000):
if int(i * 0.08) == a and int(i * 0.1) == b:
ans = i
break
print(ans)
| a, b = list(map(int, input().split()))
ans = -1
for money in range(pow(10, 4)):
if int(money * 0.08) == a and int(money * 0.1) == b:
ans = money
break
print(ans)
| false | 22.222222 | [
"-for i in range(100000):",
"- if int(i * 0.08) == a and int(i * 0.1) == b:",
"- ans = i",
"+for money in range(pow(10, 4)):",
"+ if int(money * 0.08) == a and int(money * 0.1) == b:",
"+ ans = money"
] | false | 0.121091 | 0.03519 | 3.441095 | [
"s603562949",
"s199241058"
] |
u077291787 | p02948 | python | s907774694 | s290973286 | 238 | 203 | 19,284 | 24,024 | Accepted | Accepted | 14.71 | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
available_jobs = [[] for _ in range(M + ... | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
read = sys.stdin.buffer.read
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M, *all_jobs = list(map(int, read().split()))
available_jobs = [[] for _ in range(M + 1... | 28 | 27 | 759 | 734 | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
available_jobs = [[] for _ in range(M + 1)]
for... | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
read = sys.stdin.buffer.read
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M, *all_jobs = list(map(int, read().split()))
available_jobs = [[] for _ in range(M + 1)]
for ... | false | 3.571429 | [
"-readline = sys.stdin.buffer.readline",
"+read = sys.stdin.buffer.read",
"- N, M = list(map(int, readline().split()))",
"+ N, M, *all_jobs = list(map(int, read().split()))",
"- for _ in range(N):",
"- waiting_days, reward = list(map(int, readline().split()))",
"+ for waiting_days, re... | false | 0.048348 | 0.038774 | 1.246911 | [
"s907774694",
"s290973286"
] |
u494058663 | p03127 | python | s410665685 | s637372626 | 1,655 | 146 | 14,252 | 38,084 | Accepted | Accepted | 91.18 | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
count =0
while(len(A)!=1):
tmp_min_A = min(A)
for i in range(1,len(A)):
A[i] = A[i] % tmp_min_A
if A[i] == 0:
count +=1
A.sort()
for i in range(count):
A.remove(0)
count = 0
... | import numpy as np
def main():
n = int(eval(input()))
a = [int(i) for i in input().split()]
print((np.gcd.reduce(a)))
main() | 17 | 6 | 326 | 133 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
count = 0
while len(A) != 1:
tmp_min_A = min(A)
for i in range(1, len(A)):
A[i] = A[i] % tmp_min_A
if A[i] == 0:
count += 1
A.sort()
for i in range(count):
A.remove(0)
count = 0
print((A[0]))
| import numpy as np
def main():
n = int(eval(input()))
a = [int(i) for i in input().split()]
print((np.gcd.reduce(a)))
main()
| false | 64.705882 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-count = 0",
"-while len(A) != 1:",
"- tmp_min_A = min(A)",
"- for i in range(1, len(A)):",
"- A[i] = A[i] % tmp_min_A",
"- if A[i] == 0:",
"- count += 1",
"- A.sort()",
"- for... | false | 0.087371 | 0.200455 | 0.435863 | [
"s410665685",
"s637372626"
] |
u189056821 | p02556 | python | s415425879 | s213230552 | 655 | 577 | 82,060 | 66,144 | Accepted | Accepted | 11.91 | N = int(eval(input()))
X = []
Y = []
for _ in range(N):
x, y = list(map(int, input().split()))
X.append(x)
Y.append(y)
points = []
for i, (x, y) in enumerate(zip(X, Y)):
points.append((
x + y,
x + y,
x - y,
x - y
))
print((max(max(dim) - min(dim) ... | N = int(eval(input()))
X = []
Y = []
for _ in range(N):
x, y = list(map(int, input().split()))
X.append(x)
Y.append(y)
points = []
for x, y in zip(X, Y):
points.append((
x + y,
x - y
))
print((max(max(dim) - min(dim) for dim in zip(*points)))) | 17 | 15 | 338 | 290 | N = int(eval(input()))
X = []
Y = []
for _ in range(N):
x, y = list(map(int, input().split()))
X.append(x)
Y.append(y)
points = []
for i, (x, y) in enumerate(zip(X, Y)):
points.append((x + y, x + y, x - y, x - y))
print((max(max(dim) - min(dim) for dim in zip(*points))))
| N = int(eval(input()))
X = []
Y = []
for _ in range(N):
x, y = list(map(int, input().split()))
X.append(x)
Y.append(y)
points = []
for x, y in zip(X, Y):
points.append((x + y, x - y))
print((max(max(dim) - min(dim) for dim in zip(*points))))
| false | 11.764706 | [
"-for i, (x, y) in enumerate(zip(X, Y)):",
"- points.append((x + y, x + y, x - y, x - y))",
"+for x, y in zip(X, Y):",
"+ points.append((x + y, x - y))"
] | false | 0.048226 | 0.048036 | 1.003956 | [
"s415425879",
"s213230552"
] |
u374802266 | p03971 | python | s475023551 | s664361682 | 121 | 73 | 4,016 | 9,236 | Accepted | Accepted | 39.67 | n,a,b=list(map(int,input().split()))
s=eval(input())
c,d=0,0
for i in range(n):
f=0
if s[i]=="a":
if c<a+b:
f=1
c+=1
if s[i]=="b":
if c<a+b and d<b:
f=1
c+=1
d+=1
print(("Yes" if f==1 else "No")) | n,a,b=list(map(int,input().split()))
c,d=0,0
s=eval(input())
for i in s:
f=0
if i=='a':
if c<a+b:
c+=1
print('Yes')
f=1
elif i=='b':
if c<a+b and d<b:
c+=1
d+=1
print('Yes')
f=1
if f==0:
... | 15 | 18 | 241 | 327 | n, a, b = list(map(int, input().split()))
s = eval(input())
c, d = 0, 0
for i in range(n):
f = 0
if s[i] == "a":
if c < a + b:
f = 1
c += 1
if s[i] == "b":
if c < a + b and d < b:
f = 1
c += 1
d += 1
print(("Yes" if f == 1 else ... | n, a, b = list(map(int, input().split()))
c, d = 0, 0
s = eval(input())
for i in s:
f = 0
if i == "a":
if c < a + b:
c += 1
print("Yes")
f = 1
elif i == "b":
if c < a + b and d < b:
c += 1
d += 1
print("Yes")
... | false | 16.666667 | [
"+c, d = 0, 0",
"-c, d = 0, 0",
"-for i in range(n):",
"+for i in s:",
"- if s[i] == \"a\":",
"+ if i == \"a\":",
"+ c += 1",
"+ print(\"Yes\")",
"- c += 1",
"- if s[i] == \"b\":",
"+ elif i == \"b\":",
"- f = 1",
"- print((\"Yes\" i... | false | 0.04079 | 0.044762 | 0.911259 | [
"s475023551",
"s664361682"
] |
u654470292 | p02854 | python | s445102578 | s084210154 | 286 | 200 | 82,212 | 113,476 | Accepted | Accepted | 30.07 | import sys
def input():
return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(eval(input()))
a=list(map(int,input().split()))
suma=sum(a)
cnt=0
i=0
while(cnt<suma/2):
cnt+=a[i]
i+=1
cnt2=cnt-a[i-1]
half=float(suma)/2
# print(half)
nerai=min(abs(suma-cnt-half),abs(cnt-half),abs(cnt2-half),ab... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecurs... | 17 | 32 | 353 | 791 | import sys
def input():
return sys.stdin.readline()[:-1]
inf = float("inf")
n = int(eval(input()))
a = list(map(int, input().split()))
suma = sum(a)
cnt = 0
i = 0
while cnt < suma / 2:
cnt += a[i]
i += 1
cnt2 = cnt - a[i - 1]
half = float(suma) / 2
# print(half)
nerai = min(
abs(suma - cnt - half), ... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionl... | false | 46.875 | [
"+import bisect",
"+import copy",
"+import heapq",
"+import math",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"-inf = float(\"inf\")",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
... | false | 0.038025 | 0.039266 | 0.968381 | [
"s445102578",
"s084210154"
] |
u569742427 | p02885 | python | s949940370 | s114058528 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A,B=input().split()
ans=int(A)-int(B)*2
if ans > 0:
print(ans)
else:
print((0))
| A,B=list(map(int,input().split()))
print((max(0,A-2*B))) | 7 | 2 | 90 | 49 | A, B = input().split()
ans = int(A) - int(B) * 2
if ans > 0:
print(ans)
else:
print((0))
| A, B = list(map(int, input().split()))
print((max(0, A - 2 * B)))
| false | 71.428571 | [
"-A, B = input().split()",
"-ans = int(A) - int(B) * 2",
"-if ans > 0:",
"- print(ans)",
"-else:",
"- print((0))",
"+A, B = list(map(int, input().split()))",
"+print((max(0, A - 2 * B)))"
] | false | 0.038764 | 0.04072 | 0.951964 | [
"s949940370",
"s114058528"
] |
u077291787 | p03426 | python | s730999985 | s691774380 | 219 | 193 | 41,976 | 36,424 | Accepted | Accepted | 11.87 | # ABC089D - Practical Skill Test
def main():
H, W, D, *X = list(map(int, open(0).read().split()))
memo = {} # memo[i] := coordinate of i
for i, a in enumerate(zip(*[iter(X[: H * W])] * W), 1):
for j, x in enumerate(a, 1):
memo[x] = (i, j)
dist = [0] * (H * W + 1) # dist[i] :... | # ABC089D - Practical Skill Test
def main():
H, W, D, *X = list(map(int, open(0).read().split()))
memo = [None] * (H * W + 1) # memo[i] := coordinate of i
for i, a in enumerate(zip(*[iter(X[: H * W])] * W), 1):
for j, x in enumerate(a, 1):
memo[x] = (i, j)
dist = [0] * (H * W... | 21 | 21 | 692 | 710 | # ABC089D - Practical Skill Test
def main():
H, W, D, *X = list(map(int, open(0).read().split()))
memo = {} # memo[i] := coordinate of i
for i, a in enumerate(zip(*[iter(X[: H * W])] * W), 1):
for j, x in enumerate(a, 1):
memo[x] = (i, j)
dist = [0] * (H * W + 1) # dist[i] := dista... | # ABC089D - Practical Skill Test
def main():
H, W, D, *X = list(map(int, open(0).read().split()))
memo = [None] * (H * W + 1) # memo[i] := coordinate of i
for i, a in enumerate(zip(*[iter(X[: H * W])] * W), 1):
for j, x in enumerate(a, 1):
memo[x] = (i, j)
dist = [0] * (H * W + 1) ... | false | 0 | [
"- memo = {} # memo[i] := coordinate of i",
"+ memo = [None] * (H * W + 1) # memo[i] := coordinate of i"
] | false | 0.047311 | 0.042453 | 1.114413 | [
"s730999985",
"s691774380"
] |
u647569169 | p03095 | python | s397984034 | s657121778 | 38 | 35 | 3,188 | 3,188 | Accepted | Accepted | 7.89 | #AGC031 A Colorful Subsequence
# Answer
N = int(eval(input()))
S = eval(input())
alpha = [0]*26
mod = 10**9+7
for n in S:
num = ord(n)-97
alpha[num] += 1
ans = 1
for i in range(26):
ans *= (alpha[i]+1)
# ans %= mod
print(((ans-1)%mod)) | N = int(eval(input()))
S = eval(input())
alpha = [0]*123
mod = 10**9+7
for n in S:
num = ord(n)
alpha[num] += 1
ans = 1
for i in range(97,123):
ans *= (alpha[i]+1)%mod
ans -= 1
ans %= mod
print(ans)
| 17 | 17 | 256 | 223 | # AGC031 A Colorful Subsequence
# Answer
N = int(eval(input()))
S = eval(input())
alpha = [0] * 26
mod = 10**9 + 7
for n in S:
num = ord(n) - 97
alpha[num] += 1
ans = 1
for i in range(26):
ans *= alpha[i] + 1
# ans %= mod
print(((ans - 1) % mod))
| N = int(eval(input()))
S = eval(input())
alpha = [0] * 123
mod = 10**9 + 7
for n in S:
num = ord(n)
alpha[num] += 1
ans = 1
for i in range(97, 123):
ans *= (alpha[i] + 1) % mod
ans -= 1
ans %= mod
print(ans)
| false | 0 | [
"-# AGC031 A Colorful Subsequence",
"-# Answer",
"-alpha = [0] * 26",
"+alpha = [0] * 123",
"- num = ord(n) - 97",
"+ num = ord(n)",
"-for i in range(26):",
"- ans *= alpha[i] + 1",
"-# ans %= mod",
"-print(((ans - 1) % mod))",
"+for i in range(97, 123):",
"+ ans *= (alpha[i] + 1) ... | false | 0.040106 | 0.039602 | 1.012719 | [
"s397984034",
"s657121778"
] |
u813450984 | p03503 | python | s554234111 | s364669128 | 297 | 246 | 3,316 | 3,188 | Accepted | Accepted | 17.17 | n = int(eval(input()))
shops = [list(input().split()) for i in range(n)]
profits = [list(input().split()) for i in range(n)]
l = []
ans = -10000000000000000000000000000
def f(now, i):
if i >= 10:
l.append(list(now))
return
f(now+"1", i+1)
f(now+"0", i+1)
f("", 0)
for i in range(len(l)-... | import itertools
n = int(eval(input()))
F = [list(map(int, input().split())) for i in range(n)]
P = [list(map(int, input().split())) for i in range(n)]
combos = sorted(list(itertools.product([0, 1], repeat=10)))
ans = -float('inf')
for combo in combos[1:]:
total = 0
for i in range(len(F)):
count = ... | 27 | 20 | 553 | 474 | n = int(eval(input()))
shops = [list(input().split()) for i in range(n)]
profits = [list(input().split()) for i in range(n)]
l = []
ans = -10000000000000000000000000000
def f(now, i):
if i >= 10:
l.append(list(now))
return
f(now + "1", i + 1)
f(now + "0", i + 1)
f("", 0)
for i in range(l... | import itertools
n = int(eval(input()))
F = [list(map(int, input().split())) for i in range(n)]
P = [list(map(int, input().split())) for i in range(n)]
combos = sorted(list(itertools.product([0, 1], repeat=10)))
ans = -float("inf")
for combo in combos[1:]:
total = 0
for i in range(len(F)):
count = 0
... | false | 25.925926 | [
"+import itertools",
"+",
"-shops = [list(input().split()) for i in range(n)]",
"-profits = [list(input().split()) for i in range(n)]",
"-l = []",
"-ans = -10000000000000000000000000000",
"-",
"-",
"-def f(now, i):",
"- if i >= 10:",
"- l.append(list(now))",
"- return",
"- ... | false | 0.162738 | 0.110114 | 1.477908 | [
"s554234111",
"s364669128"
] |
u440161695 | p03001 | python | s536809387 | s420252464 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | H,W,x,y=map(int,input().split())
print(H*W/2,end=" ")
if x*y*4==H*W:
print(1)
else:
print(0)
| H,W,x,y=list(map(int,input().split()))
print((H*W/2,int(x==H/2 and y==W/2))) | 6 | 2 | 101 | 69 | H, W, x, y = map(int, input().split())
print(H * W / 2, end=" ")
if x * y * 4 == H * W:
print(1)
else:
print(0)
| H, W, x, y = list(map(int, input().split()))
print((H * W / 2, int(x == H / 2 and y == W / 2)))
| false | 66.666667 | [
"-H, W, x, y = map(int, input().split())",
"-print(H * W / 2, end=\" \")",
"-if x * y * 4 == H * W:",
"- print(1)",
"-else:",
"- print(0)",
"+H, W, x, y = list(map(int, input().split()))",
"+print((H * W / 2, int(x == H / 2 and y == W / 2)))"
] | false | 0.058412 | 0.044684 | 1.307224 | [
"s536809387",
"s420252464"
] |
u677121387 | p03013 | python | s383573791 | s443104559 | 189 | 164 | 7,824 | 84,084 | Accepted | Accepted | 13.23 | n,m = list(map(int,input().split()))
a = [int(eval(input())) for _ in range(m)]
a.append(-1)
idx = 0
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
if a[idx] == 1: idx += 1
else: dp[1] = 1
for i in range(2,n+1):
if i == a[idx]: idx += 1
else: dp[i] = (dp[i-1] + dp[i-2])%mod
print((dp[n])) | import sys
sys.setrecursionlimit(10**9)
n,m = list(map(int,input().split()))
a = [int(eval(input())) for _ in range(m)]
mod = 10**9+7
memo = [-1]*(n+1)
def rec(x):
if memo[x] != -1: pass
elif x == 0: memo[x] = 1
elif a and x == a[-1]:
memo[x] = 0
a.pop()
elif x == 1: memo[x] ... | 16 | 16 | 293 | 389 | n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
a.append(-1)
idx = 0
mod = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
if a[idx] == 1:
idx += 1
else:
dp[1] = 1
for i in range(2, n + 1):
if i == a[idx]:
idx += 1
else:
dp[i] = (dp[i - 1] + dp[i - 2]) % mod
prin... | import sys
sys.setrecursionlimit(10**9)
n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
mod = 10**9 + 7
memo = [-1] * (n + 1)
def rec(x):
if memo[x] != -1:
pass
elif x == 0:
memo[x] = 1
elif a and x == a[-1]:
memo[x] = 0
a.pop()
elif x... | false | 0 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**9)",
"-a.append(-1)",
"-idx = 0",
"-dp = [0] * (n + 1)",
"-dp[0] = 1",
"-if a[idx] == 1:",
"- idx += 1",
"-else:",
"- dp[1] = 1",
"-for i in range(2, n + 1):",
"- if i == a[idx]:",
"- idx += 1",
"+memo = [-1] * (n + 1)",
"... | false | 0.043623 | 0.146343 | 0.298086 | [
"s383573791",
"s443104559"
] |
u994988729 | p03197 | python | s339288954 | s491224052 | 181 | 67 | 3,060 | 7,072 | Accepted | Accepted | 62.98 | def main():
n=int(eval(input()))
for _ in range(n):
a=int(eval(input()))
if a&1:
return "first"
return "second"
ans=main()
print(ans) | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
odd = sum(a % 2 == 1 for a in A)
if odd == 0:
ans = "second"
else:
ans = "first"
print(ans)
| 10 | 13 | 151 | 207 | def main():
n = int(eval(input()))
for _ in range(n):
a = int(eval(input()))
if a & 1:
return "first"
return "second"
ans = main()
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
odd = sum(a % 2 == 1 for a in A)
if odd == 0:
ans = "second"
else:
ans = "first"
print(ans)
| false | 23.076923 | [
"-def main():",
"- n = int(eval(input()))",
"- for _ in range(n):",
"- a = int(eval(input()))",
"- if a & 1:",
"- return \"first\"",
"- return \"second\"",
"+import sys",
"-",
"-ans = main()",
"+input = sys.stdin.readline",
"+N = int(eval(input()))",
"+A = [... | false | 0.082292 | 0.037205 | 2.211869 | [
"s339288954",
"s491224052"
] |
u164727245 | p02665 | python | s191973135 | s514441496 | 753 | 70 | 675,316 | 21,032 | Accepted | Accepted | 90.7 | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
if 0 < A[0]:
return '1' if n == 0 and A[0] == 1 else '-1'
R = [0]*(n+1)
R[0] = 1
for i in range(1, n+1):
R[i] = 2*(R[i-1]-A[i-1])
prev = 0
ret = 0
... | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
rem = sum(A)
cur = 1
ret = 0
for a in A:
cur = min(rem, cur)
rem -= a
ret += cur
cur = 2*(cur-a)
if cur < 0:
ret = -1
... | 30 | 24 | 578 | 436 | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
if 0 < A[0]:
return "1" if n == 0 and A[0] == 1 else "-1"
R = [0] * (n + 1)
R[0] = 1
for i in range(1, n + 1):
R[i] = 2 * (R[i - 1] - A[i - 1])
prev = 0
ret = 0
for i in... | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
rem = sum(A)
cur = 1
ret = 0
for a in A:
cur = min(rem, cur)
rem -= a
ret += cur
cur = 2 * (cur - a)
if cur < 0:
ret = -1
break
r... | false | 20 | [
"- if 0 < A[0]:",
"- return \"1\" if n == 0 and A[0] == 1 else \"-1\"",
"- R = [0] * (n + 1)",
"- R[0] = 1",
"- for i in range(1, n + 1):",
"- R[i] = 2 * (R[i - 1] - A[i - 1])",
"- prev = 0",
"+ rem = sum(A)",
"+ cur = 1",
"- for i in range(n, -1, -1):",
"- ... | false | 0.041649 | 0.034231 | 1.216687 | [
"s191973135",
"s514441496"
] |
u426534722 | p02264 | python | s673494484 | s952854436 | 310 | 200 | 13,392 | 13,392 | Accepted | Accepted | 35.48 | from collections import deque
n, q = map(int, input().split())
f = lambda a, b: (a, int(b))
dq = deque(f(*input().split()) for _ in range(n))
cnt = 0
ans = []
while dq:
s, t = dq.popleft()
if t <= q:
cnt += t
ans.append(f"{s} {cnt}")
else:
cnt += q
dq.append((s, ... | import sys
from collections import deque
readline = sys.stdin.readline
n, q = map(int, input().split())
f = lambda a, b: (a, int(b))
dq = deque(f(*readline().split()) for _ in range(n))
cnt = 0
ans = []
while dq:
s, t = dq.popleft()
if t <= q:
cnt += t
ans.append(f"{s} {cnt}")
e... | 16 | 18 | 353 | 399 | from collections import deque
n, q = map(int, input().split())
f = lambda a, b: (a, int(b))
dq = deque(f(*input().split()) for _ in range(n))
cnt = 0
ans = []
while dq:
s, t = dq.popleft()
if t <= q:
cnt += t
ans.append(f"{s} {cnt}")
else:
cnt += q
dq.append((s, t - q))
prin... | import sys
from collections import deque
readline = sys.stdin.readline
n, q = map(int, input().split())
f = lambda a, b: (a, int(b))
dq = deque(f(*readline().split()) for _ in range(n))
cnt = 0
ans = []
while dq:
s, t = dq.popleft()
if t <= q:
cnt += t
ans.append(f"{s} {cnt}")
else:
... | false | 11.111111 | [
"+import sys",
"+readline = sys.stdin.readline",
"-dq = deque(f(*input().split()) for _ in range(n))",
"+dq = deque(f(*readline().split()) for _ in range(n))"
] | false | 0.038599 | 0.007027 | 5.492796 | [
"s673494484",
"s952854436"
] |
u997641430 | p02549 | python | s403504597 | s843760099 | 964 | 666 | 16,820 | 24,604 | Accepted | Accepted | 30.91 | p = 998244353
n, k = list(map(int, input().split()))
LRs = []
for j in range(k):
lj, rj = list(map(int, input().split()))
LRs.append((lj, rj))
A = [0] * (n + 1)
i0 = min(lj for lj, rj in LRs)
A[0] = 1
A[i0] = 1
for i in range(i0 + 1, n):
A[i] = A[i - 1]
for j in range(k):
lj, rj = L... | p = 998244353
n, k = list(map(int, input().split()))
LRs = [tuple(map(int, input().split())) for _ in range(k)]
A = [0] * (2 * n + 1)
for lj, rj in LRs:
A[lj] += 1
A[rj + 1] -= 1
s = 0
for i in range(1, n):
s = (s + A[i]) % p
for lj, rj in LRs:
A[i + lj] += s
A[i + rj + 1] -=... | 20 | 14 | 470 | 327 | p = 998244353
n, k = list(map(int, input().split()))
LRs = []
for j in range(k):
lj, rj = list(map(int, input().split()))
LRs.append((lj, rj))
A = [0] * (n + 1)
i0 = min(lj for lj, rj in LRs)
A[0] = 1
A[i0] = 1
for i in range(i0 + 1, n):
A[i] = A[i - 1]
for j in range(k):
lj, rj = LRs[j]
... | p = 998244353
n, k = list(map(int, input().split()))
LRs = [tuple(map(int, input().split())) for _ in range(k)]
A = [0] * (2 * n + 1)
for lj, rj in LRs:
A[lj] += 1
A[rj + 1] -= 1
s = 0
for i in range(1, n):
s = (s + A[i]) % p
for lj, rj in LRs:
A[i + lj] += s
A[i + rj + 1] -= s
print(s)
| false | 30 | [
"-LRs = []",
"-for j in range(k):",
"- lj, rj = list(map(int, input().split()))",
"- LRs.append((lj, rj))",
"-A = [0] * (n + 1)",
"-i0 = min(lj for lj, rj in LRs)",
"-A[0] = 1",
"-A[i0] = 1",
"-for i in range(i0 + 1, n):",
"- A[i] = A[i - 1]",
"- for j in range(k):",
"- lj, ... | false | 0.039304 | 0.03848 | 1.021396 | [
"s403504597",
"s843760099"
] |
u926412290 | p02678 | python | s763722418 | s964642128 | 716 | 644 | 35,500 | 35,668 | Accepted | Accepted | 10.06 | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for i in range(M):
A, B = list(map(int, input().split()))
to[A-1].append(B-1)
to[B-1].append(A-1)
route = deque([0])
dist = [False]*N
prev = [-1]*N
dist[0] = 0
while route:
v = route.po... | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for i in range(M):
A, B = list(map(int, input().split()))
to[A-1].append(B-1)
to[B-1].append(A-1)
route = deque([0])
dist = [0]*N
prev = [-1]*N
dist[0] = 0
while route:
v = route.poplef... | 27 | 27 | 497 | 493 | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for i in range(M):
A, B = list(map(int, input().split()))
to[A - 1].append(B - 1)
to[B - 1].append(A - 1)
route = deque([0])
dist = [False] * N
prev = [-1] * N
dist[0] = 0
while route:
v = route.popleft()
... | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for i in range(M):
A, B = list(map(int, input().split()))
to[A - 1].append(B - 1)
to[B - 1].append(A - 1)
route = deque([0])
dist = [0] * N
prev = [-1] * N
dist[0] = 0
while route:
v = route.popleft()
f... | false | 0 | [
"-dist = [False] * N",
"+dist = [0] * N"
] | false | 0.038253 | 0.038999 | 0.980878 | [
"s763722418",
"s964642128"
] |
u135346354 | p02759 | python | s126506723 | s302228552 | 175 | 17 | 38,580 | 2,940 | Accepted | Accepted | 90.29 | n = int(eval(input()))
if n%2 == 0:
a = n//2
else:
a = n//2 + 1
print((int(a))) | N = int(eval(input()))
print((max(N//2, (N+1)//2))) | 7 | 2 | 86 | 44 | n = int(eval(input()))
if n % 2 == 0:
a = n // 2
else:
a = n // 2 + 1
print((int(a)))
| N = int(eval(input()))
print((max(N // 2, (N + 1) // 2)))
| false | 71.428571 | [
"-n = int(eval(input()))",
"-if n % 2 == 0:",
"- a = n // 2",
"-else:",
"- a = n // 2 + 1",
"-print((int(a)))",
"+N = int(eval(input()))",
"+print((max(N // 2, (N + 1) // 2)))"
] | false | 0.114037 | 0.046565 | 2.448997 | [
"s126506723",
"s302228552"
] |
u119714109 | p03634 | python | s784641080 | s716002092 | 1,437 | 809 | 50,116 | 142,156 | Accepted | Accepted | 43.7 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
g = []
for i in range(n+1): g.append([])
for i in range(n-1):
a, b, c = na()
g[a].append((b,c))
g[b].append((a,c))
q,k = na()
def dfs(cur,... | import sys
sys.setrecursionlimit(1000001)
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
g = []
for i in range(n+1): g.append([])
for i in range(n-1):
a, b, c = na()
g[a].append((b,c))
g[b].append((a,c))... | 48 | 34 | 869 | 641 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
g = []
for i in range(n + 1):
g.append([])
for i in range(n - 1):
a, b, c = na()
g[a].append((b, c))
g[b].append((a, c))
q, k = na()
def dfs(cur, pre, g, pa... | import sys
sys.setrecursionlimit(1000001)
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
g = []
for i in range(n + 1):
g.append([])
for i in range(n - 1):
a, b, c = na()
g[a].append((b, c))
g[b].append((a, c))
q, k =... | false | 29.166667 | [
"+sys.setrecursionlimit(1000001)",
"-from queue import Queue",
"-",
"-qs = Queue()",
"-qs.put(k)",
"-dw[k] = 0",
"-while not qs.empty():",
"- cur = qs.get()",
"- for e in g[cur]:",
"- if e[0] != par[cur]:",
"- par[e[0]] = cur",
"- dw[e[0]] = dw[cur] + e[1]",
... | false | 0.04086 | 0.038871 | 1.051176 | [
"s784641080",
"s716002092"
] |
u934442292 | p03546 | python | s401831074 | s920074958 | 916 | 32 | 3,444 | 3,444 | Accepted | Accepted | 96.51 | import sys
input = sys.stdin.readline
INF = float("inf")
def f(c, pos, unused, sum_c):
if pos == 1:
return sum_c
ret = INF
l = unused[:]
l.remove(pos)
for next_n in l:
res = f(c, next_n, l, sum_c + c[pos][next_n])
if res < ret:
ret = res
ret... | import sys
input = sys.stdin.readline
INF = float("inf")
def warshall_floyd(n, d):
for k in range(n):
for i in range(n):
d_ik = d[i][k]
if d_ik == INF:
continue
for j in range(n):
if d[i][j] > d_ik + d[k][j]:
... | 42 | 38 | 863 | 817 | import sys
input = sys.stdin.readline
INF = float("inf")
def f(c, pos, unused, sum_c):
if pos == 1:
return sum_c
ret = INF
l = unused[:]
l.remove(pos)
for next_n in l:
res = f(c, next_n, l, sum_c + c[pos][next_n])
if res < ret:
ret = res
return ret
def ma... | import sys
input = sys.stdin.readline
INF = float("inf")
def warshall_floyd(n, d):
for k in range(n):
for i in range(n):
d_ik = d[i][k]
if d_ik == INF:
continue
for j in range(n):
if d[i][j] > d_ik + d[k][j]:
d[i][j] ... | false | 9.52381 | [
"-def f(c, pos, unused, sum_c):",
"- if pos == 1:",
"- return sum_c",
"- ret = INF",
"- l = unused[:]",
"- l.remove(pos)",
"- for next_n in l:",
"- res = f(c, next_n, l, sum_c + c[pos][next_n])",
"- if res < ret:",
"- ret = res",
"- return ret",
... | false | 2.138455 | 0.036007 | 59.39038 | [
"s401831074",
"s920074958"
] |
u186838327 | p02984 | python | s552872597 | s147746851 | 317 | 274 | 63,984 | 64,484 | Accepted | Accepted | 13.56 | n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(n):
x += (-1)**i*a[i]
for i in range(n):
if i == 0:
print(x)
else:
x = 2*(a[i-1]-x//2)
print(x)
| n = int(eval(input()))
A = list(map(int, input().split()))
x = 0
for i in range(n):
if i%2 == 0:
x += A[i]
else:
x -= A[i]
ans = [0]*n
ans[0] = x
for i in range(1, n):
ans[i] = 2*A[i-1]-ans[i-1]
print((*ans)) | 14 | 15 | 206 | 244 | n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(n):
x += (-1) ** i * a[i]
for i in range(n):
if i == 0:
print(x)
else:
x = 2 * (a[i - 1] - x // 2)
print(x)
| n = int(eval(input()))
A = list(map(int, input().split()))
x = 0
for i in range(n):
if i % 2 == 0:
x += A[i]
else:
x -= A[i]
ans = [0] * n
ans[0] = x
for i in range(1, n):
ans[i] = 2 * A[i - 1] - ans[i - 1]
print((*ans))
| false | 6.666667 | [
"-a = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"- x += (-1) ** i * a[i]",
"-for i in range(n):",
"- if i == 0:",
"- print(x)",
"+ if i % 2 == 0:",
"+ x += A[i]",
"- x = 2 * (a[i - 1] - x // 2)",
"- print(x)",
"+ x -= A[... | false | 0.035 | 0.037642 | 0.929809 | [
"s552872597",
"s147746851"
] |
u968404618 | p03146 | python | s204758378 | s629482993 | 27 | 23 | 9,076 | 9,132 | Accepted | Accepted | 14.81 | s = int(eval(input()))
a = [s]
idx = 1
n = s
while True:
if n % 2 == 0:
n = n // 2
else:
n = (3*n) + 1
idx += 1
if n in a: break
a.append(n)
print(idx) | s = int(eval(input()))
ans = [s]
idx = 1
tmp = s
while True:
if tmp % 2 == 0:
tmp = tmp//2
else:
tmp = (3*tmp) + 1
idx +=1
if tmp in ans:
print(idx)
exit()
else:
ans.append(tmp) | 16 | 17 | 207 | 249 | s = int(eval(input()))
a = [s]
idx = 1
n = s
while True:
if n % 2 == 0:
n = n // 2
else:
n = (3 * n) + 1
idx += 1
if n in a:
break
a.append(n)
print(idx)
| s = int(eval(input()))
ans = [s]
idx = 1
tmp = s
while True:
if tmp % 2 == 0:
tmp = tmp // 2
else:
tmp = (3 * tmp) + 1
idx += 1
if tmp in ans:
print(idx)
exit()
else:
ans.append(tmp)
| false | 5.882353 | [
"-a = [s]",
"+ans = [s]",
"-n = s",
"+tmp = s",
"- if n % 2 == 0:",
"- n = n // 2",
"+ if tmp % 2 == 0:",
"+ tmp = tmp // 2",
"- n = (3 * n) + 1",
"+ tmp = (3 * tmp) + 1",
"- if n in a:",
"- break",
"- a.append(n)",
"-print(idx)",
"+ if t... | false | 0.133014 | 0.059782 | 2.224979 | [
"s204758378",
"s629482993"
] |
u044632922 | p03329 | python | s712941089 | s508451607 | 522 | 339 | 4,212 | 3,064 | Accepted | Accepted | 35.06 | n = int(eval(input()))
#引き出せる金額の列挙
Withdr = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1,6)]
INF = 100010
dp = [INF]*159050
dp[0] = 0
#全てを順に計算
for j in range(n + 1):
#あるnに対し複数の計算方法があるため、それらの中で一番少ないものをdpに格納する
for WithdrOrder in Withdr:
#dp[j + WithdrOrder]は今までに計算した最小値とdp[j]から1... | N=int(eval(input()))
ans=N
for i in range(N+1):
element_cnt=0
t=i
'''Nを6の累乗で処理する部分(i)と9の累乗で処理する部分(j)に分ける
ある数(i)を6で割った余りは6のゼロ乗の要素がいくつ含まれるかを示す
ある数の6の商をさらに6で割った余りは、ある数に6の1乗がいくつ含まれるかを示す
ある数の6の商の6の商をさらに6で割った余りは、ある数に6の2乗がいくつ含まれるかを示す
したがって、ある数を6で割って余りと商を順に処理すれば6の累乗の要素がどれだけあるかがわかる。
最終的... | 15 | 21 | 417 | 506 | n = int(eval(input()))
# 引き出せる金額の列挙
Withdr = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]
INF = 100010
dp = [INF] * 159050
dp[0] = 0
# 全てを順に計算
for j in range(n + 1):
# あるnに対し複数の計算方法があるため、それらの中で一番少ないものをdpに格納する
for WithdrOrder in Withdr:
# dp[j + WithdrOrder]は今までに計算した最小値とdp[j]から1回で引き出せる... | N = int(eval(input()))
ans = N
for i in range(N + 1):
element_cnt = 0
t = i
"""Nを6の累乗で処理する部分(i)と9の累乗で処理する部分(j)に分ける
ある数(i)を6で割った余りは6のゼロ乗の要素がいくつ含まれるかを示す
ある数の6の商をさらに6で割った余りは、ある数に6の1乗がいくつ含まれるかを示す
ある数の6の商の6の商をさらに6で割った余りは、ある数に6の2乗がいくつ含まれるかを示す
したがって、ある数を6で割って余りと商を順に処理すれば6の累乗の要素がどれだけあるかがわかる。
最終的... | false | 28.571429 | [
"-n = int(eval(input()))",
"-# 引き出せる金額の列挙",
"-Withdr = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]",
"-INF = 100010",
"-dp = [INF] * 159050",
"-dp[0] = 0",
"-# 全てを順に計算",
"-for j in range(n + 1):",
"- # あるnに対し複数の計算方法があるため、それらの中で一番少ないものをdpに格納する",
"- for WithdrOrder in Withd... | false | 0.100217 | 0.062171 | 1.611942 | [
"s712941089",
"s508451607"
] |
u970449052 | p02659 | python | s950145212 | s583536400 | 26 | 22 | 9,932 | 9,164 | Accepted | Accepted | 15.38 | from decimal import *
A,B=list(map(Decimal,input().split()))
ans=A*B
print((ans.quantize(Decimal('1'),rounding=ROUND_FLOOR))) | A,B=input().split()
B1,B2=B.split('.')
print((int(A)*(int(B1)*100+int(B2))//100)) | 4 | 3 | 120 | 81 | from decimal import *
A, B = list(map(Decimal, input().split()))
ans = A * B
print((ans.quantize(Decimal("1"), rounding=ROUND_FLOOR)))
| A, B = input().split()
B1, B2 = B.split(".")
print((int(A) * (int(B1) * 100 + int(B2)) // 100))
| false | 25 | [
"-from decimal import *",
"-",
"-A, B = list(map(Decimal, input().split()))",
"-ans = A * B",
"-print((ans.quantize(Decimal(\"1\"), rounding=ROUND_FLOOR)))",
"+A, B = input().split()",
"+B1, B2 = B.split(\".\")",
"+print((int(A) * (int(B1) * 100 + int(B2)) // 100))"
] | false | 0.04362 | 0.04072 | 1.071211 | [
"s950145212",
"s583536400"
] |
u620868411 | p03295 | python | s676550924 | s944350558 | 525 | 453 | 35,440 | 29,152 | Accepted | Accepted | 13.71 | # -*- coding: utf-8 -*-
from operator import itemgetter
n,m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort(key=itemgetter(1,0))
cnt = 0
cb = -1
for (a,b) in ab:
if cb == -1:
cb = b - 1
cnt += 1
elif a<=cb:
continue
... | # -*- coding: utf-8 -*-
from operator import itemgetter
n,m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
res = 0
ab.sort(key=itemgetter(1))
i = 0
while i<m:
a,b = ab[i]
for j in range(i+1,m):
if ab[j][0]<b<=ab[j][1]:
i += 1
... | 20 | 20 | 372 | 381 | # -*- coding: utf-8 -*-
from operator import itemgetter
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort(key=itemgetter(1, 0))
cnt = 0
cb = -1
for (a, b) in ab:
if cb == -1:
cb = b - 1
cnt += 1
elif a <= cb:
continue
else:
... | # -*- coding: utf-8 -*-
from operator import itemgetter
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
res = 0
ab.sort(key=itemgetter(1))
i = 0
while i < m:
a, b = ab[i]
for j in range(i + 1, m):
if ab[j][0] < b <= ab[j][1]:
i += 1
el... | false | 0 | [
"-ab.sort(key=itemgetter(1, 0))",
"-cnt = 0",
"-cb = -1",
"-for (a, b) in ab:",
"- if cb == -1:",
"- cb = b - 1",
"- cnt += 1",
"- elif a <= cb:",
"- continue",
"- else:",
"- cb = b - 1",
"- cnt += 1",
"-print(cnt)",
"+res = 0",
"+ab.sort(key=i... | false | 0.043313 | 0.074118 | 0.584373 | [
"s676550924",
"s944350558"
] |
u517797706 | p02597 | python | s052165592 | s954709140 | 73 | 55 | 12,708 | 12,724 | Accepted | Accepted | 24.66 | if __name__ == '__main__':
n = int(eval(input()))
A = list(eval(input()))
white = A.count("W")
red = A.count("R")
#最終形を作る
B = sorted(A)
#現在の形と最終形との比較をする
a = b = 0
for w,r in zip(A,B):
if w != r:
if w == "W":
a += 1
... | if __name__ == '__main__':
n = int(eval(input()))
s = list(eval(input()))
#完成品の並びにする
ss = sorted(s)
cnt = 0
#切り替わりの地点まで=Wが見つかる部分まで
if "W" in s:
sind = ss.index("W")
#sindまでに含まれるWの数?
cnt = 0
for i in range(sind):
if s[i] ==... | 26 | 19 | 447 | 358 | if __name__ == "__main__":
n = int(eval(input()))
A = list(eval(input()))
white = A.count("W")
red = A.count("R")
# 最終形を作る
B = sorted(A)
# 現在の形と最終形との比較をする
a = b = 0
for w, r in zip(A, B):
if w != r:
if w == "W":
a += 1
else:
... | if __name__ == "__main__":
n = int(eval(input()))
s = list(eval(input()))
# 完成品の並びにする
ss = sorted(s)
cnt = 0
# 切り替わりの地点まで=Wが見つかる部分まで
if "W" in s:
sind = ss.index("W")
# sindまでに含まれるWの数?
cnt = 0
for i in range(sind):
if s[i] == "W":
c... | false | 26.923077 | [
"- A = list(eval(input()))",
"- white = A.count(\"W\")",
"- red = A.count(\"R\")",
"- # 最終形を作る",
"- B = sorted(A)",
"- # 現在の形と最終形との比較をする",
"- a = b = 0",
"- for w, r in zip(A, B):",
"- if w != r:",
"- if w == \"W\":",
"- a += 1",
"- ... | false | 0.048771 | 0.044071 | 1.106654 | [
"s052165592",
"s954709140"
] |
u094191970 | p03326 | python | s110314002 | s943262419 | 39 | 35 | 9,168 | 9,216 | Accepted | Accepted | 10.26 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
l=[lnii() for i in range(n)]
ans=0
for i in range(2**3):
t_l=[]
for j in l:
t_num=0
for k in range(3):
if (i>>k)&1:
t_num+=j[k]
else:
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
l=[lnii() for i in range(n)]
ans=0
for i in [1,-1]:
for j in [1,-1]:
for k in [1,-1]:
t_num=0
t_l=[]
for x,y,z in l:
t_num=x*i+y*j+z*k
... | 23 | 20 | 426 | 415 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n, m = nii()
l = [lnii() for i in range(n)]
ans = 0
for i in range(2**3):
t_l = []
for j in l:
t_num = 0
for k in range(3):
if (i >> k) & 1:
... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n, m = nii()
l = [lnii() for i in range(n)]
ans = 0
for i in [1, -1]:
for j in [1, -1]:
for k in [1, -1]:
t_num = 0
t_l = []
for x, y, z i... | false | 13.043478 | [
"-for i in range(2**3):",
"- t_l = []",
"- for j in l:",
"- t_num = 0",
"- for k in range(3):",
"- if (i >> k) & 1:",
"- t_num += j[k]",
"- else:",
"- t_num -= j[k]",
"- t_l.append(t_num)",
"- t_l.sort(reverse=True... | false | 0.036271 | 0.037366 | 0.970687 | [
"s110314002",
"s943262419"
] |
u513081876 | p03401 | python | s945543810 | s172165469 | 243 | 213 | 14,048 | 14,172 | Accepted | Accepted | 12.35 | N = int(eval(input()))
A = [int(i) for i in input().split()]
dif = abs(A[0]) + abs(A[N-1])
for i in range(N-1):
dif += abs(A[i]-A[i+1])
ans = [dif] * N
for i in range(1, N-1):
ans[i] += - abs(A[i-1] - A[i]) -abs(A[i] - A[i+1]) + abs(A[i-1] - A[i+1])
ans[0] = ans[0] - abs(A[0]) + abs(A[1]) -abs(A... | n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = [0] * n
summ = sum([abs(a[i]-a[i+1]) for i in range(n-1)])
summ += abs(a[0]) + abs(a[-1])
for i in range(1, n-1):
ans[i] = summ -abs(a[i-1]-a[i])-abs(a[i+1]-a[i])+abs(a[i-1]-a[i+1])
ans[0] = summ - abs(a[0]) -abs(a[0]-a[1]) + abs(a[1])
ans[-1]... | 15 | 11 | 427 | 390 | N = int(eval(input()))
A = [int(i) for i in input().split()]
dif = abs(A[0]) + abs(A[N - 1])
for i in range(N - 1):
dif += abs(A[i] - A[i + 1])
ans = [dif] * N
for i in range(1, N - 1):
ans[i] += -abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1])
ans[0] = ans[0] - abs(A[0]) + abs(A[1]) - ab... | n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = [0] * n
summ = sum([abs(a[i] - a[i + 1]) for i in range(n - 1)])
summ += abs(a[0]) + abs(a[-1])
for i in range(1, n - 1):
ans[i] = (
summ - abs(a[i - 1] - a[i]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1])
)
ans[0] = summ - abs(a[0]... | false | 26.666667 | [
"-N = int(eval(input()))",
"-A = [int(i) for i in input().split()]",
"-dif = abs(A[0]) + abs(A[N - 1])",
"-for i in range(N - 1):",
"- dif += abs(A[i] - A[i + 1])",
"-ans = [dif] * N",
"-for i in range(1, N - 1):",
"- ans[i] += -abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + ... | false | 0.041094 | 0.043846 | 0.937216 | [
"s945543810",
"s172165469"
] |
u021019433 | p02773 | python | s207244507 | s900725821 | 732 | 610 | 32,496 | 32,480 | Accepted | Accepted | 16.67 | from itertools import groupby
from operator import itemgetter
a = sorted(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-len(tuple(g)), s) for s, g in groupby(a))
for _, s in next(groupby(a, itemgetter(0)))[1]:
print(s) | from collections import Counter
c = Counter(eval(input()) for _ in range(int(eval(input()))))
m = max(c.values())
for s in sorted(s for s, k in list(c.items()) if k == m):
print(s)
| 7 | 6 | 232 | 172 | from itertools import groupby
from operator import itemgetter
a = sorted(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-len(tuple(g)), s) for s, g in groupby(a))
for _, s in next(groupby(a, itemgetter(0)))[1]:
print(s)
| from collections import Counter
c = Counter(eval(input()) for _ in range(int(eval(input()))))
m = max(c.values())
for s in sorted(s for s, k in list(c.items()) if k == m):
print(s)
| false | 14.285714 | [
"-from itertools import groupby",
"-from operator import itemgetter",
"+from collections import Counter",
"-a = sorted(eval(input()) for _ in range(int(eval(input()))))",
"-a = sorted((-len(tuple(g)), s) for s, g in groupby(a))",
"-for _, s in next(groupby(a, itemgetter(0)))[1]:",
"+c = Counter(eval(inp... | false | 0.041086 | 0.043037 | 0.954668 | [
"s207244507",
"s900725821"
] |
u680851063 | p03329 | python | s073236032 | s941738018 | 980 | 568 | 3,992 | 4,596 | Accepted | Accepted | 42.04 | l_6 = []
_ = 1
while 6**_ < 100000:
l_6.append(6**_)
_ += 1
l_6.sort(reverse = 1)
l_9= []
_ = 1
while 9**_ < 100000:
l_9.append(9**_)
_ += 1
l_9.sort(reverse = 1)
n = int(eval(input()))
w = 0
z = []
for i in range(n+1):
x = i
for j in range(len(l_6)):
while l_6[j]... | n = int(eval(input()))
dp = [0] + [100000]*n
ptn = [1]
_ = 1
while 6**_ < 100000:
ptn.append(6**_)
_ += 1
_ = 1
while 9**_ < 100000:
ptn.append(9**_)
_ += 1
for i in range(1,n+1):
for j in ptn:
if i-j >= 0:
dp[i] = min(dp[i], dp[i-j]+1)
print((dp[-1])) | 39 | 20 | 590 | 307 | l_6 = []
_ = 1
while 6**_ < 100000:
l_6.append(6**_)
_ += 1
l_6.sort(reverse=1)
l_9 = []
_ = 1
while 9**_ < 100000:
l_9.append(9**_)
_ += 1
l_9.sort(reverse=1)
n = int(eval(input()))
w = 0
z = []
for i in range(n + 1):
x = i
for j in range(len(l_6)):
while l_6[j] <= x:
x -= l... | n = int(eval(input()))
dp = [0] + [100000] * n
ptn = [1]
_ = 1
while 6**_ < 100000:
ptn.append(6**_)
_ += 1
_ = 1
while 9**_ < 100000:
ptn.append(9**_)
_ += 1
for i in range(1, n + 1):
for j in ptn:
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j] + 1)
print((dp[-1]))
| false | 48.717949 | [
"-l_6 = []",
"+n = int(eval(input()))",
"+dp = [0] + [100000] * n",
"+ptn = [1]",
"- l_6.append(6**_)",
"+ ptn.append(6**_)",
"-l_6.sort(reverse=1)",
"-l_9 = []",
"- l_9.append(9**_)",
"+ ptn.append(9**_)",
"-l_9.sort(reverse=1)",
"-n = int(eval(input()))",
"-w = 0",
"-z = []",... | false | 0.174738 | 0.102875 | 1.69854 | [
"s073236032",
"s941738018"
] |
u057079894 | p02829 | python | s519119376 | s686872526 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | n = int(eval(input()))
m = int(eval(input()))
print(((5 - n -m)%3 + 1)) | print((int(eval(input()))^int(eval(input()))))
| 3 | 1 | 59 | 33 | n = int(eval(input()))
m = int(eval(input()))
print(((5 - n - m) % 3 + 1))
| print((int(eval(input())) ^ int(eval(input()))))
| false | 66.666667 | [
"-n = int(eval(input()))",
"-m = int(eval(input()))",
"-print(((5 - n - m) % 3 + 1))",
"+print((int(eval(input())) ^ int(eval(input()))))"
] | false | 0.046248 | 0.045084 | 1.025807 | [
"s519119376",
"s686872526"
] |
u691018832 | p03425 | python | s209683471 | s889638688 | 139 | 89 | 4,220 | 4,524 | Accepted | Accepted | 35.97 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import Counter
import itertools
n = int(readline())
s = [input()[0] for i in range(n)]
counter = Counter(s)
ans = 0
for i, j, k in itertools.... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import Counter
from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
... | 16 | 38 | 407 | 859 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter
import itertools
n = int(readline())
s = [input()[0] for i in range(n)]
counter = Counter(s)
ans = 0
for i, j, k in itertools.combinations("M... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter
from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
over = reduce... | false | 57.894737 | [
"-import itertools",
"+from operator import mul",
"+from functools import reduce",
"+",
"+",
"+def cmb(n, r):",
"+ r = min(n - r, r)",
"+ if r == 0:",
"+ return 1",
"+ over = reduce(mul, list(range(n, n - r, -1)))",
"+ under = reduce(mul, list(range(1, r + 1)))",
"+ retur... | false | 0.041945 | 0.046789 | 0.896482 | [
"s209683471",
"s889638688"
] |
u562935282 | p03682 | python | s336706509 | s350798804 | 1,564 | 1,022 | 125,528 | 51,348 | Accepted | Accepted | 34.65 | # 解説
def solve() -> None:
from collections import namedtuple
from heapq import heappush, heappop
from operator import attrgetter
pt = namedtuple('pt', 'x y idx')
n = int(eval(input()))
cities = []
for idx in range(n):
x, y = list(map(int, input().split()))
citie... | def solve_abc065d():
from collections import namedtuple
from operator import attrgetter
from itertools import tee
import sys
input = sys.stdin.readline
City = namedtuple('City', 'x y idx')
Edge = namedtuple('Edge', 'cost a b')
N = int(eval(input()))
cities = []
fo... | 52 | 80 | 1,174 | 1,822 | # 解説
def solve() -> None:
from collections import namedtuple
from heapq import heappush, heappop
from operator import attrgetter
pt = namedtuple("pt", "x y idx")
n = int(eval(input()))
cities = []
for idx in range(n):
x, y = list(map(int, input().split()))
cities.append(pt(x... | def solve_abc065d():
from collections import namedtuple
from operator import attrgetter
from itertools import tee
import sys
input = sys.stdin.readline
City = namedtuple("City", "x y idx")
Edge = namedtuple("Edge", "cost a b")
N = int(eval(input()))
cities = []
for city_idx in r... | false | 35 | [
"-# 解説",
"-def solve() -> None:",
"+def solve_abc065d():",
"- from heapq import heappush, heappop",
"+ from itertools import tee",
"+ import sys",
"- pt = namedtuple(\"pt\", \"x y idx\")",
"- n = int(eval(input()))",
"+ input = sys.stdin.readline",
"+ City = namedtuple(\"City\... | false | 0.081958 | 0.057748 | 1.419231 | [
"s336706509",
"s350798804"
] |
u966207392 | p02578 | python | s373067378 | s801496950 | 163 | 149 | 32,056 | 32,364 | Accepted | Accepted | 8.59 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
if A[i+1] < A[i]:
cnt += A[i]-A[i+1]
A[i+1] = A[i]
else:
pass
print(cnt) | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
if A[i+1] < A[i]:
cnt += A[i] - A[i+1]
A[i+1] = A[i]
print(cnt) | 10 | 8 | 195 | 172 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for i in range(N - 1):
if A[i + 1] < A[i]:
cnt += A[i] - A[i + 1]
A[i + 1] = A[i]
else:
pass
print(cnt)
| N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for i in range(N - 1):
if A[i + 1] < A[i]:
cnt += A[i] - A[i + 1]
A[i + 1] = A[i]
print(cnt)
| false | 20 | [
"- else:",
"- pass"
] | false | 0.035715 | 0.035189 | 1.014935 | [
"s373067378",
"s801496950"
] |
u261103969 | p02779 | python | s283882780 | s465199865 | 189 | 126 | 25,168 | 123,144 | Accepted | Accepted | 33.33 | n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
for i in range(n-1):
if a[i] == a[i+1]:
print('NO')
break
else:
print('YES') | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
A = list(map(int, readline().split()))
S = set(A)
if len(S) == N:
print("YES")
else:
print("NO")
if __name__ == '__mai... | 11 | 21 | 176 | 338 | n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
for i in range(n - 1):
if a[i] == a[i + 1]:
print("NO")
break
else:
print("YES")
| import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
A = list(map(int, readline().split()))
S = set(A)
if len(S) == N:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| false | 47.619048 | [
"-n = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-a.sort()",
"-for i in range(n - 1):",
"- if a[i] == a[i + 1]:",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+MOD = 10**9 + 7",
"+INF = float(\"INF\")",
"+sys.setrecursionlimit(10**5)",
"+",
"+",
"+def main... | false | 0.049587 | 0.048962 | 1.012761 | [
"s283882780",
"s465199865"
] |
u788703383 | p02812 | python | s601729076 | s609027711 | 27 | 17 | 3,060 | 2,940 | Accepted | Accepted | 37.04 | n = int(eval(input()))
s = eval(input())
count = 0
c = "ABC"
for i in range(n-2):
if s[i:i+3] == c:
count += 1
print(count)
| n = int(eval(input()))
s = eval(input())
count = 0
c = "ABC"
for i in range(n-2):
if s[i:i+3] == c:
count += 1
i += 3
print(count)
| 8 | 9 | 122 | 132 | n = int(eval(input()))
s = eval(input())
count = 0
c = "ABC"
for i in range(n - 2):
if s[i : i + 3] == c:
count += 1
print(count)
| n = int(eval(input()))
s = eval(input())
count = 0
c = "ABC"
for i in range(n - 2):
if s[i : i + 3] == c:
count += 1
i += 3
print(count)
| false | 11.111111 | [
"+ i += 3"
] | false | 0.037605 | 0.041679 | 0.902258 | [
"s601729076",
"s609027711"
] |
u506910932 | p03127 | python | s510684110 | s721192624 | 339 | 113 | 14,224 | 16,284 | Accepted | Accepted | 66.67 | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1001001001
for i in range(n-1):
ans = min(ans,gcd(a[i],a[i+1]))
print(ans)
| # def gcd(a, b):
# if b == 0:
# return a
# return gcd(b, a % b)
from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1001001001
g = a[0]
for i in range(1,n):
g = gcd(a[i], g)
ans = min(ans, g)
print(ans)
| 12 | 16 | 223 | 278 | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1001001001
for i in range(n - 1):
ans = min(ans, gcd(a[i], a[i + 1]))
print(ans)
| # def gcd(a, b):
# if b == 0:
# return a
# return gcd(b, a % b)
from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1001001001
g = a[0]
for i in range(1, n):
g = gcd(a[i], g)
ans = min(ans, g)
print(ans)
| false | 25 | [
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- return gcd(b, a % b)",
"-",
"+# def gcd(a, b):",
"+# if b == 0:",
"+# return a",
"+# return gcd(b, a % b)",
"+from fractions import gcd",
"-for i in range(n - 1):",
"- ans = min(ans, gcd(a[i], a[i + 1]))",
"+... | false | 0.044963 | 0.04797 | 0.937327 | [
"s510684110",
"s721192624"
] |
u285443936 | p03137 | python | s817133459 | s102530510 | 129 | 118 | 13,968 | 13,832 | Accepted | Accepted | 8.53 | N, M = list(map(int, input().split()))
#if N >= M:
# print(0)
# exit()
X = list(map(int,input().split()))
X.sort()
diff = []
for i in range(1,M):
diff.append(X[i]-X[i - 1])
diff.sort()
for i in range(N - 1):
if len(diff) != 0:
diff.pop()
print((sum(diff))) | N, M = list(map(int, input().split()))
X = [int(i) for i in input().split()]
if N >= M:
print((0))
exit()
X.sort()
dist = []
for i in range(M-1):
dist.append(X[i+1]-X[i])
dist.sort()
ans = 0
for i in range(M-N):
ans += dist[i]
print(ans)
| 20 | 16 | 285 | 255 | N, M = list(map(int, input().split()))
# if N >= M:
# print(0)
# exit()
X = list(map(int, input().split()))
X.sort()
diff = []
for i in range(1, M):
diff.append(X[i] - X[i - 1])
diff.sort()
for i in range(N - 1):
if len(diff) != 0:
diff.pop()
print((sum(diff)))
| N, M = list(map(int, input().split()))
X = [int(i) for i in input().split()]
if N >= M:
print((0))
exit()
X.sort()
dist = []
for i in range(M - 1):
dist.append(X[i + 1] - X[i])
dist.sort()
ans = 0
for i in range(M - N):
ans += dist[i]
print(ans)
| false | 20 | [
"-# if N >= M:",
"-# print(0)",
"-# exit()",
"-X = list(map(int, input().split()))",
"+X = [int(i) for i in input().split()]",
"+if N >= M:",
"+ print((0))",
"+ exit()",
"-diff = []",
"-for i in range(1, M):",
"- diff.append(X[i] - X[i - 1])",
"-diff.sort()",
"-for i in range(N - ... | false | 0.033645 | 0.035154 | 0.957081 | [
"s817133459",
"s102530510"
] |
u941047297 | p04001 | python | s036538589 | s096122018 | 195 | 36 | 39,152 | 9,096 | Accepted | Accepted | 81.54 | S = eval(input())
n = len(S)
ans = 0
for i in range(2 ** (n - 1)):
p = [''] * (n - 1)
for j in range(n - 1):
if i >> j & 1:
p[j] = '+'
s = [None] * (2 * n - 1)
s[::2] = list(S)
s[1::2] = p
s = ''.join(s)
ans += eval(s)
print(ans) | def main():
S = eval(input())
ans = 0
for i in range(1 << (n := len(S) - 1)):
T = ''
for j in range(n):
if i >> j & 1:
T += S[j] + '+'
else:
T += S[j]
T += S[n]
ans += eval(T)
print(ans)
if __name__ ==... | 14 | 16 | 284 | 339 | S = eval(input())
n = len(S)
ans = 0
for i in range(2 ** (n - 1)):
p = [""] * (n - 1)
for j in range(n - 1):
if i >> j & 1:
p[j] = "+"
s = [None] * (2 * n - 1)
s[::2] = list(S)
s[1::2] = p
s = "".join(s)
ans += eval(s)
print(ans)
| def main():
S = eval(input())
ans = 0
for i in range(1 << (n := len(S) - 1)):
T = ""
for j in range(n):
if i >> j & 1:
T += S[j] + "+"
else:
T += S[j]
T += S[n]
ans += eval(T)
print(ans)
if __name__ == "__main__":
... | false | 12.5 | [
"-S = eval(input())",
"-n = len(S)",
"-ans = 0",
"-for i in range(2 ** (n - 1)):",
"- p = [\"\"] * (n - 1)",
"- for j in range(n - 1):",
"- if i >> j & 1:",
"- p[j] = \"+\"",
"- s = [None] * (2 * n - 1)",
"- s[::2] = list(S)",
"- s[1::2] = p",
"- s = \"\".jo... | false | 0.078797 | 0.087524 | 0.900286 | [
"s036538589",
"s096122018"
] |
u777923818 | p03482 | python | s672049177 | s255710289 | 73 | 39 | 5,836 | 3,188 | Accepted | Accepted | 46.58 | # -*- coding: utf-8 -*-
S = eval(input())
n = len(S)
L = list(map(int, list(S)))
D = []
res = 0
for k in range(n-1):
if L[k] != L[k+1]:
D.append(max(k+1, n-k-1))
if len(D):
print((min(D)))
else:
print(n) | # -*- coding: utf-8 -*-
S = eval(input())
for k in range((len(S)+1)//2-1, len(S)-1):
if S[k] != S[k+1] or S[-k-1] != S[-k-2]:
print((k+1))
break
else:
print((len(S))) | 14 | 8 | 229 | 187 | # -*- coding: utf-8 -*-
S = eval(input())
n = len(S)
L = list(map(int, list(S)))
D = []
res = 0
for k in range(n - 1):
if L[k] != L[k + 1]:
D.append(max(k + 1, n - k - 1))
if len(D):
print((min(D)))
else:
print(n)
| # -*- coding: utf-8 -*-
S = eval(input())
for k in range((len(S) + 1) // 2 - 1, len(S) - 1):
if S[k] != S[k + 1] or S[-k - 1] != S[-k - 2]:
print((k + 1))
break
else:
print((len(S)))
| false | 42.857143 | [
"-n = len(S)",
"-L = list(map(int, list(S)))",
"-D = []",
"-res = 0",
"-for k in range(n - 1):",
"- if L[k] != L[k + 1]:",
"- D.append(max(k + 1, n - k - 1))",
"-if len(D):",
"- print((min(D)))",
"+for k in range((len(S) + 1) // 2 - 1, len(S) - 1):",
"+ if S[k] != S[k + 1] or S[-... | false | 0.038179 | 0.040582 | 0.940797 | [
"s672049177",
"s255710289"
] |
u644907318 | p03775 | python | s996092730 | s964137231 | 170 | 69 | 39,024 | 64,924 | Accepted | Accepted | 59.41 | def F(x,y):
return max(len(str(x)),len(str(y)))
N = int(eval(input()))
dmin = 100
for i in range(1,int(N**0.5)+1):
if N%i==0:
n = N//i
dmin = min(dmin,F(i,n))
print(dmin) | N = int(eval(input()))
cmin = 1000
for i in range(1,int(N**0.5)+1):
if N%i==0:
a = str(i)
b = str(N//i)
cmin = min(cmin,max(len(a),len(b)))
print(cmin) | 9 | 8 | 196 | 180 | def F(x, y):
return max(len(str(x)), len(str(y)))
N = int(eval(input()))
dmin = 100
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
n = N // i
dmin = min(dmin, F(i, n))
print(dmin)
| N = int(eval(input()))
cmin = 1000
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
a = str(i)
b = str(N // i)
cmin = min(cmin, max(len(a), len(b)))
print(cmin)
| false | 11.111111 | [
"-def F(x, y):",
"- return max(len(str(x)), len(str(y)))",
"-",
"-",
"-dmin = 100",
"+cmin = 1000",
"- n = N // i",
"- dmin = min(dmin, F(i, n))",
"-print(dmin)",
"+ a = str(i)",
"+ b = str(N // i)",
"+ cmin = min(cmin, max(len(a), len(b)))",
"+print(cmi... | false | 0.040575 | 0.040517 | 1.001439 | [
"s996092730",
"s964137231"
] |
u235376569 | p02953 | python | s930646179 | s573550756 | 233 | 115 | 63,984 | 14,704 | Accepted | Accepted | 50.64 | import sys
N=int(eval(input()))
H=[int(x) for x in input().rstrip().split()]
flag=0
mi=-1
for i in range(N-1):
if H[i]<=H[i+1] and mi<=H[i]:
mi=max(mi,H[i]-1)
continue
elif H[i+1]<H[i]:
H[i]=H[i]-1
mi=max(mi,H[i])
if H[i+1]<H[i] or H[i]<mi:
flag=1
print("No")
... | import sys
N=int(eval(input()))
H=[int(x) for x in input().rstrip().split()]
flag=0
mi=-1
for i in range(N-1):
if H[i]<=H[i+1] and mi<=H[i]:
mi=max(mi,H[i]-1)
continue
elif H[i+1]<H[i]:
H[i]=H[i]-1
mi=max(mi,H[i])
if H[i+1]<H[i] or H[i]<mi:
flag=1
print("No")
sys.exi... | 22 | 22 | 359 | 351 | import sys
N = int(eval(input()))
H = [int(x) for x in input().rstrip().split()]
flag = 0
mi = -1
for i in range(N - 1):
if H[i] <= H[i + 1] and mi <= H[i]:
mi = max(mi, H[i] - 1)
continue
elif H[i + 1] < H[i]:
H[i] = H[i] - 1
mi = max(mi, H[i])
if H[i + 1] < H[i] or H[i... | import sys
N = int(eval(input()))
H = [int(x) for x in input().rstrip().split()]
flag = 0
mi = -1
for i in range(N - 1):
if H[i] <= H[i + 1] and mi <= H[i]:
mi = max(mi, H[i] - 1)
continue
elif H[i + 1] < H[i]:
H[i] = H[i] - 1
mi = max(mi, H[i])
if H[i + 1] < H[i] or H[i] < ... | false | 0 | [
"- if H[i + 1] < H[i] or H[i] < mi:",
"- flag = 1",
"- print(\"No\")",
"- sys.exit()",
"+ if H[i + 1] < H[i] or H[i] < mi:",
"+ flag = 1",
"+ print(\"No\")",
"+ sys.exit()"
] | false | 0.074497 | 0.035997 | 2.069528 | [
"s930646179",
"s573550756"
] |
u657329920 | p02627 | python | s519914601 | s326243854 | 69 | 62 | 61,708 | 61,780 | Accepted | Accepted | 10.14 | alpha = eval(input())
if str.upper(alpha) == alpha:
sol = "A"
else:
sol = "a"
print(sol) | a = eval(input())
print(("a" if a.islower() else "A")) | 6 | 2 | 91 | 47 | alpha = eval(input())
if str.upper(alpha) == alpha:
sol = "A"
else:
sol = "a"
print(sol)
| a = eval(input())
print(("a" if a.islower() else "A"))
| false | 66.666667 | [
"-alpha = eval(input())",
"-if str.upper(alpha) == alpha:",
"- sol = \"A\"",
"-else:",
"- sol = \"a\"",
"-print(sol)",
"+a = eval(input())",
"+print((\"a\" if a.islower() else \"A\"))"
] | false | 0.048645 | 0.040976 | 1.187162 | [
"s519914601",
"s326243854"
] |
u112364985 | p03378 | python | s603805105 | s084886209 | 30 | 26 | 9,136 | 9,160 | Accepted | Accepted | 13.33 | n,m,x=list(map(int,input().split()))
gate=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(1,x):
if i in gate:
cnt1+=1
for j in range(x+1,n):
if j in gate:
cnt2+=1
print((min(cnt1,cnt2))) | n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(0,x+1):
if i in a:
cnt1+=1
for j in range(x,n+1):
if j in a:
cnt2+=1
print((min(cnt1,cnt2))) | 11 | 11 | 224 | 217 | n, m, x = list(map(int, input().split()))
gate = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
for i in range(1, x):
if i in gate:
cnt1 += 1
for j in range(x + 1, n):
if j in gate:
cnt2 += 1
print((min(cnt1, cnt2)))
| n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
for i in range(0, x + 1):
if i in a:
cnt1 += 1
for j in range(x, n + 1):
if j in a:
cnt2 += 1
print((min(cnt1, cnt2)))
| false | 0 | [
"-gate = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"-for i in range(1, x):",
"- if i in gate:",
"+for i in range(0, x + 1):",
"+ if i in a:",
"-for j in range(x + 1, n):",
"- if j in gate:",
"+for j in range(x, n + 1):",
"+ if j in a:"
] | false | 0.070303 | 0.031197 | 2.253524 | [
"s603805105",
"s084886209"
] |
u249218427 | p02678 | python | s830348498 | s754033551 | 762 | 535 | 41,976 | 48,124 | Accepted | Accepted | 29.79 | # -*- coding: utf-8 -*-
N,M = list(map(int, input().split()))
dict_path = {i+1: [] for i in range(N)}
for _ in range(M):
A,B = list(map(int, input().split()))
dict_path[A].append(B)
dict_path[B].append(A)
list_bfs = [1]
list_flg = [0 for _ in range(N+1)]
list_flg[1] = 1
while len(list_bfs)>0:
... | # -*- coding: utf-8 -*-
import sys
N, M, *AB = list(map(int, sys.stdin.buffer.read().split()))
dict_path = {i+1: [] for i in range(N)}
for i in range(M):
A,B = AB[2*i:2*i+2]
dict_path[A].append(B)
dict_path[B].append(A)
list_bfs = [1]
list_flg = [0 for _ in range(N+1)]
list_flg[1] = 1
while l... | 26 | 28 | 526 | 550 | # -*- coding: utf-8 -*-
N, M = list(map(int, input().split()))
dict_path = {i + 1: [] for i in range(N)}
for _ in range(M):
A, B = list(map(int, input().split()))
dict_path[A].append(B)
dict_path[B].append(A)
list_bfs = [1]
list_flg = [0 for _ in range(N + 1)]
list_flg[1] = 1
while len(list_bfs) > 0:
li... | # -*- coding: utf-8 -*-
import sys
N, M, *AB = list(map(int, sys.stdin.buffer.read().split()))
dict_path = {i + 1: [] for i in range(N)}
for i in range(M):
A, B = AB[2 * i : 2 * i + 2]
dict_path[A].append(B)
dict_path[B].append(A)
list_bfs = [1]
list_flg = [0 for _ in range(N + 1)]
list_flg[1] = 1
while le... | false | 7.142857 | [
"-N, M = list(map(int, input().split()))",
"+import sys",
"+",
"+N, M, *AB = list(map(int, sys.stdin.buffer.read().split()))",
"-for _ in range(M):",
"- A, B = list(map(int, input().split()))",
"+for i in range(M):",
"+ A, B = AB[2 * i : 2 * i + 2]"
] | false | 0.06386 | 0.062127 | 1.027882 | [
"s830348498",
"s754033551"
] |
u914802579 | p02548 | python | s212715147 | s418491101 | 1,114 | 154 | 19,348 | 9,056 | Accepted | Accepted | 86.18 | n=int(eval(input()))
ar=3
sv=[0]*(10**6+2)
for i in range(2,len(sv)):
if not sv[i]:
sv[i]=i
for j in range(2*i,len(sv),i):
sv[j]=i
def di(x):
an=1
if sv[x]==x:
return 2
while x>1:
ct=0;cr=sv[x]
while x%cr==0:
ct+=1;x//=cr
an*=(ct+1)
return an
for i in range(4,n+1)... | n=int(eval(input()))
ar=0
for i in range(1,n+1):
ar+=(n-1)//i
print(ar)
| 23 | 5 | 362 | 72 | n = int(eval(input()))
ar = 3
sv = [0] * (10**6 + 2)
for i in range(2, len(sv)):
if not sv[i]:
sv[i] = i
for j in range(2 * i, len(sv), i):
sv[j] = i
def di(x):
an = 1
if sv[x] == x:
return 2
while x > 1:
ct = 0
cr = sv[x]
while x % cr == 0:
... | n = int(eval(input()))
ar = 0
for i in range(1, n + 1):
ar += (n - 1) // i
print(ar)
| false | 78.26087 | [
"-ar = 3",
"-sv = [0] * (10**6 + 2)",
"-for i in range(2, len(sv)):",
"- if not sv[i]:",
"- sv[i] = i",
"- for j in range(2 * i, len(sv), i):",
"- sv[j] = i",
"-",
"-",
"-def di(x):",
"- an = 1",
"- if sv[x] == x:",
"- return 2",
"- while x > 1:"... | false | 1.141061 | 0.074327 | 15.351953 | [
"s212715147",
"s418491101"
] |
u131273629 | p03854 | python | s871205273 | s126868617 | 35 | 29 | 3,188 | 3,316 | Accepted | Accepted | 17.14 | s = eval(input()) + "ZZZZZZZZZZZZZ"
i = 0
ans = "NO"
while(True):
if s[i:i+5]=="dream":
if s[i+5]=="d" or s[i+5]=="Z" or s[i+5:i+8]=="era":
i += 5
elif s[i+5:i+8]=="erd" or s[i+5:i+8]=="ere" or s[i+5:i+8]=="erZ":
i += 7
else:
break
elif s[i:i+5]=="erase":
if s[i+5]=="d" or s[i+5]... | s = eval(input())
revs = s[::-1] + "Z"
i = 0
while(True):
if revs[i:i+5]=="maerd": i+=5
elif revs[i:i+7]=="remaerd": i+=7
elif revs[i:i+5]=="esare": i+=5
elif revs[i:i+6]=="resare": i+=6
elif revs[i]=="Z":
print("YES")
break
else:
print("NO")
break | 31 | 15 | 474 | 271 | s = eval(input()) + "ZZZZZZZZZZZZZ"
i = 0
ans = "NO"
while True:
if s[i : i + 5] == "dream":
if s[i + 5] == "d" or s[i + 5] == "Z" or s[i + 5 : i + 8] == "era":
i += 5
elif (
s[i + 5 : i + 8] == "erd"
or s[i + 5 : i + 8] == "ere"
or s[i + 5 : i + 8] ==... | s = eval(input())
revs = s[::-1] + "Z"
i = 0
while True:
if revs[i : i + 5] == "maerd":
i += 5
elif revs[i : i + 7] == "remaerd":
i += 7
elif revs[i : i + 5] == "esare":
i += 5
elif revs[i : i + 6] == "resare":
i += 6
elif revs[i] == "Z":
print("YES")
... | false | 51.612903 | [
"-s = eval(input()) + \"ZZZZZZZZZZZZZ\"",
"+s = eval(input())",
"+revs = s[::-1] + \"Z\"",
"-ans = \"NO\"",
"- if s[i : i + 5] == \"dream\":",
"- if s[i + 5] == \"d\" or s[i + 5] == \"Z\" or s[i + 5 : i + 8] == \"era\":",
"- i += 5",
"- elif (",
"- s[i + 5 : i ... | false | 0.03571 | 0.043807 | 0.815166 | [
"s871205273",
"s126868617"
] |
u787562674 | p03109 | python | s171864215 | s211529596 | 42 | 17 | 4,576 | 2,940 | Accepted | Accepted | 59.52 | import datetime
a = (datetime.datetime.strptime('2019/04/30', '%Y/%m/%d') - datetime.datetime.strptime(eval(input()), '%Y/%m/%d')).days
print(('Heisei' if a >= 0 else 'TBD'))
| yy, mm, dd = input().split('/')
last_yy, last_mm, last_dd = '2019/04/30'.split('/')
if last_yy < yy:
ans = 'TBD'
else:
if last_mm < mm:
ans = 'TBD'
else:
if last_dd < dd:
ans = 'TBD'
else:
ans = 'Heisei'
print(ans)
| 5 | 15 | 174 | 291 | import datetime
a = (
datetime.datetime.strptime("2019/04/30", "%Y/%m/%d")
- datetime.datetime.strptime(eval(input()), "%Y/%m/%d")
).days
print(("Heisei" if a >= 0 else "TBD"))
| yy, mm, dd = input().split("/")
last_yy, last_mm, last_dd = "2019/04/30".split("/")
if last_yy < yy:
ans = "TBD"
else:
if last_mm < mm:
ans = "TBD"
else:
if last_dd < dd:
ans = "TBD"
else:
ans = "Heisei"
print(ans)
| false | 66.666667 | [
"-import datetime",
"-",
"-a = (",
"- datetime.datetime.strptime(\"2019/04/30\", \"%Y/%m/%d\")",
"- - datetime.datetime.strptime(eval(input()), \"%Y/%m/%d\")",
"-).days",
"-print((\"Heisei\" if a >= 0 else \"TBD\"))",
"+yy, mm, dd = input().split(\"/\")",
"+last_yy, last_mm, last_dd = \"2019/0... | false | 0.04935 | 0.042698 | 1.155784 | [
"s171864215",
"s211529596"
] |
u170201762 | p03660 | python | s687339927 | s567618949 | 1,986 | 1,259 | 51,808 | 66,272 | Accepted | Accepted | 36.61 | from collections import defaultdict
import queue
N = int(eval(input()))
edge = defaultdict(list)
for i in range(N-1):
a,b = list(map(int,input().split()))
edge[a].append(b)
edge[b].append(a)
def bfs(s):
dist = defaultdict(lambda:float('inf'))
dist[s] = 0
que = queue.Queue()
que... | from collections import defaultdict
from heapq import heappop, heappush
from math import ceil
class Graph(object):
def __init__(self):
self.graph = defaultdict(list)
def __len__(self):
return len(self.graph)
def add_edge(self, From, To, cost=1):
self.graph[From].appe... | 33 | 76 | 692 | 1,913 | from collections import defaultdict
import queue
N = int(eval(input()))
edge = defaultdict(list)
for i in range(N - 1):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
def bfs(s):
dist = defaultdict(lambda: float("inf"))
dist[s] = 0
que = queue.Queue()
que.put(s... | from collections import defaultdict
from heapq import heappop, heappush
from math import ceil
class Graph(object):
def __init__(self):
self.graph = defaultdict(list)
def __len__(self):
return len(self.graph)
def add_edge(self, From, To, cost=1):
self.graph[From].append((To, cost)... | false | 56.578947 | [
"-import queue",
"+from heapq import heappop, heappush",
"+from math import ceil",
"+",
"+",
"+class Graph(object):",
"+ def __init__(self):",
"+ self.graph = defaultdict(list)",
"+",
"+ def __len__(self):",
"+ return len(self.graph)",
"+",
"+ def add_edge(self, From, ... | false | 0.043437 | 0.082656 | 0.525512 | [
"s687339927",
"s567618949"
] |
u544637026 | p02820 | python | s116961911 | s715274656 | 176 | 162 | 13,044 | 13,044 | Accepted | Accepted | 7.95 | n,k = list(map(int,input().split()))
ro, sc ,pa = list(map(int,input().split()))
a = eval(input())
dict = {'r':'p', 's':'r', 'p': 's'}
scores = {'r':ro,'s':sc,'p':pa}
can_lelect = 'rsp'
select = ['' for _ in range(n)]
cant = [[] for _ in range(n)]
left = 0
cur = k
for i in range(k):
need = dict[a[i]]
... | n,k = list(map(int,input().split()))
ro, sc ,pa = list(map(int,input().split()))
a = eval(input())
dict = {'r':'p', 's':'r', 'p': 's'}
scores = {'r':ro,'s':sc,'p':pa}
can_lelect = 'rsp'
select = ['' for _ in range(n)]
cant = [[] for _ in range(n)]
left = 0
cur = k
for i in range(k):
need = dict[a[i]]
... | 46 | 42 | 1,272 | 1,127 | n, k = list(map(int, input().split()))
ro, sc, pa = list(map(int, input().split()))
a = eval(input())
dict = {"r": "p", "s": "r", "p": "s"}
scores = {"r": ro, "s": sc, "p": pa}
can_lelect = "rsp"
select = ["" for _ in range(n)]
cant = [[] for _ in range(n)]
left = 0
cur = k
for i in range(k):
need = dict[a[i]]
... | n, k = list(map(int, input().split()))
ro, sc, pa = list(map(int, input().split()))
a = eval(input())
dict = {"r": "p", "s": "r", "p": "s"}
scores = {"r": ro, "s": sc, "p": pa}
can_lelect = "rsp"
select = ["" for _ in range(n)]
cant = [[] for _ in range(n)]
left = 0
cur = k
for i in range(k):
need = dict[a[i]]
... | false | 8.695652 | [
"- right = cur + k",
"- if right < n:",
"- need_right = dict[a[right]]",
"- cant[cur].append(need_right)"
] | false | 0.047145 | 0.040357 | 1.168205 | [
"s116961911",
"s715274656"
] |
u811733736 | p00047 | python | s306444566 | s506785609 | 30 | 20 | 7,368 | 7,348 | Accepted | Accepted | 33.33 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0047
Cup Game
"""
import sys
def main(args):
ball_position = 'A'
for line in sys.stdin:
exchanged_cups = line.strip().split(',')
if ball_position in exchanged_cups:
exchanged_cups.remo... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0047
Cup Game
"""
import sys
def main(args):
ball_position = 'A' # ?????¨??????????????\??£???????????????????????????
for line in sys.stdin:
exchanged_cups = line.strip().split(',')
if ball_posit... | 20 | 20 | 466 | 859 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0047
Cup Game
"""
import sys
def main(args):
ball_position = "A"
for line in sys.stdin:
exchanged_cups = line.strip().split(",")
if ball_position in exchanged_cups:
exchanged_cups.remove(ball_posit... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0047
Cup Game
"""
import sys
def main(args):
ball_position = "A" # ?????¨??????????????\??£???????????????????????????
for line in sys.stdin:
exchanged_cups = line.strip().split(",")
if (
ball_pos... | false | 0 | [
"- ball_position = \"A\"",
"+ ball_position = \"A\" # ?????¨??????????????\\??£???????????????????????????",
"- if ball_position in exchanged_cups:",
"- exchanged_cups.remove(ball_position)",
"- ball_position = exchanged_cups[0]",
"- print(ball_position)",
"+ ... | false | 0.088866 | 0.085976 | 1.033611 | [
"s306444566",
"s506785609"
] |
u027685417 | p02887 | python | s727556058 | s886884369 | 1,505 | 50 | 3,956 | 3,316 | Accepted | Accepted | 96.68 | N = int(eval(input()))
S = list(eval(input()))
index = 0
for i in range(N - 1):
if S[index] == S[index + 1]:
del S[index]
else:
index += 1
print((len(S)))
| n = int(eval(input()))
s = eval(input())
ans = 1
for i in range(n - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
| 11 | 9 | 177 | 123 | N = int(eval(input()))
S = list(eval(input()))
index = 0
for i in range(N - 1):
if S[index] == S[index + 1]:
del S[index]
else:
index += 1
print((len(S)))
| n = int(eval(input()))
s = eval(input())
ans = 1
for i in range(n - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
| false | 18.181818 | [
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-index = 0",
"-for i in range(N - 1):",
"- if S[index] == S[index + 1]:",
"- del S[index]",
"- else:",
"- index += 1",
"-print((len(S)))",
"+n = int(eval(input()))",
"+s = eval(input())",
"+ans = 1",
"+for i in range... | false | 0.079219 | 0.038548 | 2.055056 | [
"s727556058",
"s886884369"
] |
u891635666 | p02913 | python | s601603569 | s974718011 | 260 | 233 | 50,524 | 47,964 | Accepted | Accepted | 10.38 | import collections
class RollingHash:
def __init__(self, s, base, mod):
self.base = base
self.mod = mod
self.hash = [0]
self.power = [1]
for c in s:
self.hash.append((self.hash[-1] * base + ord(c)) % mod)
self.power.append(self.power[-1]... | import collections
class RollingHash:
def __init__(self, s, base, mod):
self.base = base
self.mod = mod
self.hash = [0]
self.power = [1]
for c in s:
self.hash.append((self.hash[-1] * base + ord(c)) % mod)
self.power.append(self.power[-1]... | 44 | 44 | 987 | 994 | import collections
class RollingHash:
def __init__(self, s, base, mod):
self.base = base
self.mod = mod
self.hash = [0]
self.power = [1]
for c in s:
self.hash.append((self.hash[-1] * base + ord(c)) % mod)
self.power.append(self.power[-1] * base % mod... | import collections
class RollingHash:
def __init__(self, s, base, mod):
self.base = base
self.mod = mod
self.hash = [0]
self.power = [1]
for c in s:
self.hash.append((self.hash[-1] * base + ord(c)) % mod)
self.power.append(self.power[-1] * base % mod... | false | 0 | [
"-rh = RollingHash(s, base=26, mod=2**50 + 1)",
"+rh = RollingHash(s, base=10**4 + 7, mod=10**9 + 7)"
] | false | 0.036756 | 0.037383 | 0.983231 | [
"s601603569",
"s974718011"
] |
u540761833 | p03283 | python | s157768456 | s012153985 | 1,245 | 904 | 75,540 | 75,604 | Accepted | Accepted | 27.39 | N,M,Q = map(int,input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
num[l-1][r-1] += 1
for j in range(N):
for i in range(N-1,0,-1):
num[i-1][j] += num[i][j]
for i in range(N):
for j in range(N-1):
... | import sys
def input(): return sys.stdin.readline().strip()
N,M,Q = map(int,input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
num[l-1][r-1] += 1
for j in range(N):
for i in range(N-1,0,-1):
num[i-1][j] += nu... | 17 | 19 | 481 | 543 | N, M, Q = map(int, input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int, input().split())) for i in range(M)]
for l, r in lr:
num[l - 1][r - 1] += 1
for j in range(N):
for i in range(N - 1, 0, -1):
num[i - 1][j] += num[i][j]
for i in range(N):
for j in range(N - 1):
... | import sys
def input():
return sys.stdin.readline().strip()
N, M, Q = map(int, input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int, input().split())) for i in range(M)]
for l, r in lr:
num[l - 1][r - 1] += 1
for j in range(N):
for i in range(N - 1, 0, -1):
num[i -... | false | 10.526316 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+"
] | false | 0.036143 | 0.03735 | 0.967688 | [
"s157768456",
"s012153985"
] |
u869790980 | p03000 | python | s236062376 | s022260484 | 38 | 35 | 27,884 | 27,884 | Accepted | Accepted | 7.89 | n,x = list(map(int, input().split(' ')))
ais = list(map(int, input().split(' ')))
count,cur,i = 0,0, 0
res = [cur]
while(i < len(ais)):
cur += ais[i]
res.append(cur)
i +=1
print(len([e for e in res if e <= x])) | n,x = list(map(int, input().split(' ')))
ais = list(map(int, input().split(' ')))
count,cur,i = 1,0, 0
res = []
while(i < len(ais)):
cur += ais[i]
if cur <= x:
count+=1
else:
break
i +=1
print(count)
#print len([e for e in res if e <= x]) | 10 | 14 | 218 | 255 | n, x = list(map(int, input().split(" ")))
ais = list(map(int, input().split(" ")))
count, cur, i = 0, 0, 0
res = [cur]
while i < len(ais):
cur += ais[i]
res.append(cur)
i += 1
print(len([e for e in res if e <= x]))
| n, x = list(map(int, input().split(" ")))
ais = list(map(int, input().split(" ")))
count, cur, i = 1, 0, 0
res = []
while i < len(ais):
cur += ais[i]
if cur <= x:
count += 1
else:
break
i += 1
print(count)
# print len([e for e in res if e <= x])
| false | 28.571429 | [
"-count, cur, i = 0, 0, 0",
"-res = [cur]",
"+count, cur, i = 1, 0, 0",
"+res = []",
"- res.append(cur)",
"+ if cur <= x:",
"+ count += 1",
"+ else:",
"+ break",
"-print(len([e for e in res if e <= x]))",
"+print(count)",
"+# print len([e for e in res if e <= x])"
] | false | 0.044792 | 0.045174 | 0.991541 | [
"s236062376",
"s022260484"
] |
u708255304 | p02691 | python | s676386615 | s152705940 | 266 | 175 | 61,544 | 132,984 | Accepted | Accepted | 34.21 | # N人の参加者, 参加者iの身長はAi, 背番号の差の絶対値が身長の和に等しい組
from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
memo = defaultdict(int)
ans = 0
for i, x in enumerate(A, 1):
ans += memo[i-A[i-1]]
memo[i+A[i-1]] += 1
print(ans)
| from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
count = defaultdict(int)
ans = 0
for i in range(N):
ans += count[i-A[i]]
count[A[i]+i] += 1
print(ans)
| 10 | 9 | 262 | 208 | # N人の参加者, 参加者iの身長はAi, 背番号の差の絶対値が身長の和に等しい組
from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
memo = defaultdict(int)
ans = 0
for i, x in enumerate(A, 1):
ans += memo[i - A[i - 1]]
memo[i + A[i - 1]] += 1
print(ans)
| from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
count = defaultdict(int)
ans = 0
for i in range(N):
ans += count[i - A[i]]
count[A[i] + i] += 1
print(ans)
| false | 10 | [
"-# N人の参加者, 参加者iの身長はAi, 背番号の差の絶対値が身長の和に等しい組",
"-memo = defaultdict(int)",
"+count = defaultdict(int)",
"-for i, x in enumerate(A, 1):",
"- ans += memo[i - A[i - 1]]",
"- memo[i + A[i - 1]] += 1",
"+for i in range(N):",
"+ ans += count[i - A[i]]",
"+ count[A[i] + i] += 1"
] | false | 0.037301 | 0.036687 | 1.016753 | [
"s676386615",
"s152705940"
] |
u564589929 | p02983 | python | s991048759 | s936538545 | 375 | 83 | 40,556 | 3,064 | Accepted | Accepted | 77.87 | l, r = list(map(int, input().split()))
mod = 2019
r = min(r, l+4038)
ans = 2018
for i in range(l, r+1):
for j in range(i+1, r+1):
x = i * j % mod
ans = min(ans, x)
print(ans) | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): retur... | 10 | 29 | 199 | 740 | l, r = list(map(int, input().split()))
mod = 2019
r = min(r, l + 4038)
ans = 2018
for i in range(l, r + 1):
for j in range(i + 1, r + 1):
x = i * j % mod
ans = min(ans, x)
print(ans)
| import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def... | false | 65.517241 | [
"-l, r = list(map(int, input().split()))",
"-mod = 2019",
"-r = min(r, l + 4038)",
"-ans = 2018",
"-for i in range(l, r + 1):",
"- for j in range(i + 1, r + 1):",
"- x = i * j % mod",
"- ans = min(ans, x)",
"-print(ans)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
... | false | 0.007367 | 0.078919 | 0.093348 | [
"s991048759",
"s936538545"
] |
u434630332 | p02700 | python | s857278453 | s775962171 | 28 | 25 | 8,928 | 9,160 | Accepted | Accepted | 10.71 | A, B, C, D = list(map(int,input().split()))
while C or A >= 0:
C -= B
A -= D
if C <= 0:
print('Yes')
break
if A <= 0:
print('No')
break | a, b, c, d = list(map(int, input().split()))
while c or a >= 0:
c -= b
a -= d
if c <= 0:
print("Yes")
break
if a <= 0:
print("No")
break | 11 | 11 | 190 | 189 | A, B, C, D = list(map(int, input().split()))
while C or A >= 0:
C -= B
A -= D
if C <= 0:
print("Yes")
break
if A <= 0:
print("No")
break
| a, b, c, d = list(map(int, input().split()))
while c or a >= 0:
c -= b
a -= d
if c <= 0:
print("Yes")
break
if a <= 0:
print("No")
break
| false | 0 | [
"-A, B, C, D = list(map(int, input().split()))",
"-while C or A >= 0:",
"- C -= B",
"- A -= D",
"- if C <= 0:",
"+a, b, c, d = list(map(int, input().split()))",
"+while c or a >= 0:",
"+ c -= b",
"+ a -= d",
"+ if c <= 0:",
"- if A <= 0:",
"+ if a <= 0:"
] | false | 0.079298 | 0.077913 | 1.017781 | [
"s857278453",
"s775962171"
] |
u190405389 | p02890 | python | s366947886 | s234290288 | 711 | 641 | 128,360 | 126,208 | Accepted | Accepted | 9.85 | from collections import Counter
from itertools import accumulate
import bisect
printRows = lambda x:print('\n'.join(map(str,x)))
n = int(input())
a = list(map(int, input().split()))
b = sorted(Counter(a).values())
exist = len(b)
b = [0]*(n-exist)+b
c = list(accumulate([0]+b))
ans = [n]
for k in range(2... | from collections import Counter
from itertools import accumulate
import bisect
printRows = lambda x:print('\n'.join(map(str,x)))
n = int(input())
a = list(map(int, input().split()))
b = sorted(Counter(a).values())
exist = len(b)
b = [0]*(n-exist)+b
c = list(accumulate([0]+b))
ans = [n]
for k in range(2... | 27 | 27 | 551 | 569 | from collections import Counter
from itertools import accumulate
import bisect
printRows = lambda x: print("\n".join(map(str, x)))
n = int(input())
a = list(map(int, input().split()))
b = sorted(Counter(a).values())
exist = len(b)
b = [0] * (n - exist) + b
c = list(accumulate([0] + b))
ans = [n]
for k in range(2, n + ... | from collections import Counter
from itertools import accumulate
import bisect
printRows = lambda x: print("\n".join(map(str, x)))
n = int(input())
a = list(map(int, input().split()))
b = sorted(Counter(a).values())
exist = len(b)
b = [0] * (n - exist) + b
c = list(accumulate([0] + b))
ans = [n]
for k in range(2, exis... | false | 0 | [
"-for k in range(2, n + 1):",
"+for k in range(2, exist + 1):",
"-printRows(ans)",
"+printRows(ans + [0] * (n - exist))"
] | false | 0.037736 | 0.037581 | 1.004128 | [
"s366947886",
"s234290288"
] |
u644516473 | p02936 | python | s147879723 | s741731859 | 1,829 | 1,476 | 254,352 | 79,072 | Accepted | Accepted | 19.3 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n, q = list(map(int, readline().split()))
G = defaultdict(list)
for _ in range(n-1):
a, b = list(map(int, readline().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
count = [0] * n
for _ in... | import sys
from collections import defaultdict, deque
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n, q = list(map(int, readline().split()))
G = defaultdict(list)
for _ in range(n-1):
a, b = list(map(int, readline().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
count = [0] * n
f... | 27 | 36 | 561 | 754 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n, q = list(map(int, readline().split()))
G = defaultdict(list)
for _ in range(n - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
count = [0] * n
for _ in r... | import sys
from collections import defaultdict, deque
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n, q = list(map(int, readline().split()))
G = defaultdict(list)
for _ in range(n - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
count = [0] * n
for... | false | 25 | [
"-from collections import defaultdict",
"+from collections import defaultdict, deque",
"-dfs(0, 0)",
"+ans[0] = count[0]",
"+q = deque([0])",
"+while q:",
"+ root = q.pop()",
"+ for i in G[root]:",
"+ if ans[i] == -1:",
"+ q.append(i)",
"+ ans[i] = ans[root] + ... | false | 0.040302 | 0.073711 | 0.54676 | [
"s147879723",
"s741731859"
] |
u340781749 | p03504 | python | s530280077 | s483752909 | 651 | 565 | 25,956 | 25,632 | Accepted | Accepted | 13.21 | from heapq import heapreplace, heappush
n, v = list(map(int, input().split()))
programs = [tuple(map(int, input().split())) for _ in range(n)]
programs.sort()
tmp = [None] * v
combined = []
for s, t, c in programs:
c -= 1
prev = tmp[c]
if prev is not None:
ps, pt, pc = prev
if p... | from collections import defaultdict
from heapq import heapreplace, heappush
n, v = list(map(int, input().split()))
programs = defaultdict(list)
for _ in range(n):
s, t, c = list(map(int, input().split()))
programs[c].append((s, t))
combined = []
for c, p in list(programs.items()):
p.sort()
... | 32 | 30 | 807 | 748 | from heapq import heapreplace, heappush
n, v = list(map(int, input().split()))
programs = [tuple(map(int, input().split())) for _ in range(n)]
programs.sort()
tmp = [None] * v
combined = []
for s, t, c in programs:
c -= 1
prev = tmp[c]
if prev is not None:
ps, pt, pc = prev
if pt == s:
... | from collections import defaultdict
from heapq import heapreplace, heappush
n, v = list(map(int, input().split()))
programs = defaultdict(list)
for _ in range(n):
s, t, c = list(map(int, input().split()))
programs[c].append((s, t))
combined = []
for c, p in list(programs.items()):
p.sort()
ps, pt = p[0... | false | 6.25 | [
"+from collections import defaultdict",
"-programs = [tuple(map(int, input().split())) for _ in range(n)]",
"-programs.sort()",
"-tmp = [None] * v",
"+programs = defaultdict(list)",
"+for _ in range(n):",
"+ s, t, c = list(map(int, input().split()))",
"+ programs[c].append((s, t))",
"-for s, t... | false | 0.038632 | 0.043664 | 0.884763 | [
"s530280077",
"s483752909"
] |
u729133443 | p03377 | python | s688646299 | s320610752 | 162 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.51 | a,b,x=list(map(int,input().split()));print(('YNEOS'[a>x or x>a+b::2])) | a,b,x=list(map(int,input().split()));print(('NYOE S'[~b<a-x<1::2])) | 1 | 1 | 62 | 59 | a, b, x = list(map(int, input().split()))
print(("YNEOS"[a > x or x > a + b :: 2]))
| a, b, x = list(map(int, input().split()))
print(("NYOE S"[~b < a - x < 1 :: 2]))
| false | 0 | [
"-print((\"YNEOS\"[a > x or x > a + b :: 2]))",
"+print((\"NYOE S\"[~b < a - x < 1 :: 2]))"
] | false | 0.035457 | 0.035036 | 1.01203 | [
"s688646299",
"s320610752"
] |
u631277801 | p03111 | python | s445529895 | s689827193 | 827 | 364 | 63,228 | 3,188 | Accepted | Accepted | 55.99 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**2)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 58 | 37 | 1,709 | 930 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**2)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 36.206897 | [
"-sys.setrecursionlimit(10**5)",
"+sys.setrecursionlimit(10**2)",
"-def choose3(bamboos: list, a: int, b: int, c: int):",
"- bamboos.sort(reverse=True)",
"- l = len(bamboos)",
"- minmp = float(\"inf\")",
"- for idx in range(l):",
"- for jdx in range(idx + 1, l):",
"- fo... | false | 1.554152 | 0.263452 | 5.89918 | [
"s445529895",
"s689827193"
] |
u738898077 | p03160 | python | s048766611 | s221263922 | 235 | 127 | 52,208 | 13,928 | Accepted | Accepted | 45.96 | n = int(eval(input()))
ls_h = list(map(int,input().split()))
ls_cos = [0]*n
ls_cos[1] = abs(ls_h[1]-ls_h[0])
for i in range(2,n):
ls_cos[i] = min(ls_cos[i-2]+abs(ls_h[i]-ls_h[i-2]) , ls_cos[i-1]+abs(ls_h[i]-ls_h[i-1]))
print((ls_cos[-1]))
| n = int(eval(input()))
h = list(map(int,input().split()))
ans = [0,abs(h[1]-h[0])]+[0]*(n-2)
for i in range(2,n):
ans[i] = min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]))
print((ans[-1])) | 9 | 6 | 245 | 197 | n = int(eval(input()))
ls_h = list(map(int, input().split()))
ls_cos = [0] * n
ls_cos[1] = abs(ls_h[1] - ls_h[0])
for i in range(2, n):
ls_cos[i] = min(
ls_cos[i - 2] + abs(ls_h[i] - ls_h[i - 2]),
ls_cos[i - 1] + abs(ls_h[i] - ls_h[i - 1]),
)
print((ls_cos[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = [0, abs(h[1] - h[0])] + [0] * (n - 2)
for i in range(2, n):
ans[i] = min(ans[i - 1] + abs(h[i] - h[i - 1]), ans[i - 2] + abs(h[i] - h[i - 2]))
print((ans[-1]))
| false | 33.333333 | [
"-ls_h = list(map(int, input().split()))",
"-ls_cos = [0] * n",
"-ls_cos[1] = abs(ls_h[1] - ls_h[0])",
"+h = list(map(int, input().split()))",
"+ans = [0, abs(h[1] - h[0])] + [0] * (n - 2)",
"- ls_cos[i] = min(",
"- ls_cos[i - 2] + abs(ls_h[i] - ls_h[i - 2]),",
"- ls_cos[i - 1] + abs(... | false | 0.047018 | 0.038082 | 1.234657 | [
"s048766611",
"s221263922"
] |
u133936772 | p03074 | python | s181846253 | s960419910 | 107 | 87 | 7,832 | 12,396 | Accepted | Accepted | 18.69 | n,k=list(map(int,input().split()))
s=eval(input())
t=1
l=[0]
for i in s:
i=int(i)
if i==t: l[-1]+=1
else: l+=[1]; t=i
if t<1: l+=[0]
s=[0]
for i in l: s+=[s[-1]+i]
a=0
for i in range(0,len(l),2):
if i<2*k: a=max(a,s[i+1])
else: a=max(a,s[i+1]-s[i-k*2])
print(a) | n,k=list(map(int,input().split()))
s=[int(i) for i in eval(input())]
l1,l0=[],[]
b,c=1,0
for i in s:
if b==i: c+=1
else:
if b: l1+=[c]
else: l0+=[c]
c=1
b=i
if b:
l1+=[c]
l0+=[0]
else:
l0+=[c]
S=[0]
for i,j in zip(l1,l0):
S+=[S[-1]+i+j]
l1+=[0]
l0+=[0]
m=len(S)
if m<=k: p... | 16 | 28 | 274 | 397 | n, k = list(map(int, input().split()))
s = eval(input())
t = 1
l = [0]
for i in s:
i = int(i)
if i == t:
l[-1] += 1
else:
l += [1]
t = i
if t < 1:
l += [0]
s = [0]
for i in l:
s += [s[-1] + i]
a = 0
for i in range(0, len(l), 2):
if i < 2 * k:
a = max(a, s[i + 1])
... | n, k = list(map(int, input().split()))
s = [int(i) for i in eval(input())]
l1, l0 = [], []
b, c = 1, 0
for i in s:
if b == i:
c += 1
else:
if b:
l1 += [c]
else:
l0 += [c]
c = 1
b = i
if b:
l1 += [c]
l0 += [0]
else:
l0 += [c]
S = [0]
for i, ... | false | 42.857143 | [
"-s = eval(input())",
"-t = 1",
"-l = [0]",
"+s = [int(i) for i in eval(input())]",
"+l1, l0 = [], []",
"+b, c = 1, 0",
"- i = int(i)",
"- if i == t:",
"- l[-1] += 1",
"+ if b == i:",
"+ c += 1",
"- l += [1]",
"- t = i",
"-if t < 1:",
"- l += [0]",... | false | 0.036171 | 0.035654 | 1.014488 | [
"s181846253",
"s960419910"
] |
u803617136 | p03000 | python | s727593403 | s954804122 | 173 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.17 | N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
cnt = 1
di = 0
for li in L:
di += li
if di > X:
break
cnt += 1
print(cnt) | n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
point = 0
ans = 1
for l in L:
point += l
if point > x:
break
ans += 1
print(ans)
| 12 | 13 | 175 | 185 | N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
cnt = 1
di = 0
for li in L:
di += li
if di > X:
break
cnt += 1
print(cnt)
| n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
point = 0
ans = 1
for l in L:
point += l
if point > x:
break
ans += 1
print(ans)
| false | 7.692308 | [
"-N, X = list(map(int, input().split()))",
"+n, x = list(map(int, input().split()))",
"-cnt = 1",
"-di = 0",
"-for li in L:",
"- di += li",
"- if di > X:",
"+point = 0",
"+ans = 1",
"+for l in L:",
"+ point += l",
"+ if point > x:",
"- cnt += 1",
"-print(cnt)",
"+ ans +... | false | 0.046981 | 0.035066 | 1.339815 | [
"s727593403",
"s954804122"
] |
u107077660 | p04044 | python | s631094562 | s655073483 | 39 | 24 | 3,064 | 3,064 | Accepted | Accepted | 38.46 | N, L = list(map(int, input().split()))
a = [eval(input()) for i in range(N)]
a.sort()
b = ""
for i in range(N):
b += a[i]
print(b)
| N, L = list(map(int, input().split()))
S = []
for i in range(N):
S.append(eval(input()))
S.sort()
S.reverse()
ans = ""
for i in range(N):
ans += S.pop()
print(ans) | 7 | 10 | 126 | 162 | N, L = list(map(int, input().split()))
a = [eval(input()) for i in range(N)]
a.sort()
b = ""
for i in range(N):
b += a[i]
print(b)
| N, L = list(map(int, input().split()))
S = []
for i in range(N):
S.append(eval(input()))
S.sort()
S.reverse()
ans = ""
for i in range(N):
ans += S.pop()
print(ans)
| false | 30 | [
"-a = [eval(input()) for i in range(N)]",
"-a.sort()",
"-b = \"\"",
"+S = []",
"- b += a[i]",
"-print(b)",
"+ S.append(eval(input()))",
"+S.sort()",
"+S.reverse()",
"+ans = \"\"",
"+for i in range(N):",
"+ ans += S.pop()",
"+print(ans)"
] | false | 0.034387 | 0.036404 | 0.944576 | [
"s631094562",
"s655073483"
] |
u094191970 | p02744 | python | s777385997 | s722246095 | 97 | 81 | 17,312 | 9,036 | Accepted | Accepted | 16.49 | n=int(eval(input()))
abc='abcdefghijklmnopqrstuvwxyz'
def dfs(keta,s):
if keta==n:
global ans
ans.append(s)
return
st_l=len(set(s))
for i in range(st_l+1):
dfs(keta+1,s+abc[i])
ans=[]
dfs(1,'a')
for i in ans:
print(i) | n=int(eval(input()))
abc='abcdefghij'
def dfs(s):
if len(s)==n:
print(s)
return
st_l=len(set(s))
for i in range(st_l+1):
dfs(s+abc[i])
dfs('a') | 19 | 14 | 258 | 172 | n = int(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
def dfs(keta, s):
if keta == n:
global ans
ans.append(s)
return
st_l = len(set(s))
for i in range(st_l + 1):
dfs(keta + 1, s + abc[i])
ans = []
dfs(1, "a")
for i in ans:
print(i)
| n = int(eval(input()))
abc = "abcdefghij"
def dfs(s):
if len(s) == n:
print(s)
return
st_l = len(set(s))
for i in range(st_l + 1):
dfs(s + abc[i])
dfs("a")
| false | 26.315789 | [
"-abc = \"abcdefghijklmnopqrstuvwxyz\"",
"+abc = \"abcdefghij\"",
"-def dfs(keta, s):",
"- if keta == n:",
"- global ans",
"- ans.append(s)",
"+def dfs(s):",
"+ if len(s) == n:",
"+ print(s)",
"- dfs(keta + 1, s + abc[i])",
"+ dfs(s + abc[i])",
"-ans = ... | false | 0.045906 | 0.047321 | 0.970104 | [
"s777385997",
"s722246095"
] |
u334712262 | p02816 | python | s152478031 | s582758658 | 655 | 544 | 125,712 | 126,352 | Accepted | Accepted | 16.95 | # -*- coding: utf-8 -*-
import sys
from collections import Counter, defaultdict
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
class RollingHash():
"""
... | # -*- coding: utf-8 -*-
import sys
from collections import Counter, defaultdict
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
class RollingHash():
"""
... | 106 | 106 | 2,585 | 2,599 | # -*- coding: utf-8 -*-
import sys
from collections import Counter, defaultdict
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
class RollingHash:
"""
Original code... | # -*- coding: utf-8 -*-
import sys
from collections import Counter, defaultdict
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
class RollingHash:
"""
Original code... | false | 0 | [
"- ah = RollingHash(a)",
"- bh = RollingHash(b)",
"+ ah = RollingHash(a, num=1)",
"+ bh = RollingHash(b, num=1)"
] | false | 0.044915 | 0.18919 | 0.237407 | [
"s152478031",
"s582758658"
] |
u233588813 | p02936 | python | s324539752 | s433096145 | 1,187 | 1,016 | 75,000 | 75,056 | Accepted | Accepted | 14.41 | from collections import deque
import sys
input=sys.stdin.readline
a,b=list(map(int,input().split()))
e=[[]for i in range(a)]
for i in range(a-1):
c1,c2=list(map(int,input().split()))
e[c1-1].append(c2-1)
e[c2-1].append(c1-1)
g=[[]for i in range(a)]
f=deque([(0,-1)])
ans=[0 for _ in range(a)]
for i... | from collections import deque
import sys
input=sys.stdin.readline
def main():
a,b=list(map(int,input().split()))
e=[[]for i in range(a)]
for i in range(a-1):
c1,c2=list(map(int,input().split()))
e[c1-1].append(c2-1)
e[c2-1].append(c1-1)
g=[[]for i in range(a)]
f=deque([(0,-1)])
a... | 33 | 35 | 553 | 648 | from collections import deque
import sys
input = sys.stdin.readline
a, b = list(map(int, input().split()))
e = [[] for i in range(a)]
for i in range(a - 1):
c1, c2 = list(map(int, input().split()))
e[c1 - 1].append(c2 - 1)
e[c2 - 1].append(c1 - 1)
g = [[] for i in range(a)]
f = deque([(0, -1)])
ans = [0 fo... | from collections import deque
import sys
input = sys.stdin.readline
def main():
a, b = list(map(int, input().split()))
e = [[] for i in range(a)]
for i in range(a - 1):
c1, c2 = list(map(int, input().split()))
e[c1 - 1].append(c2 - 1)
e[c2 - 1].append(c1 - 1)
g = [[] for i in ... | false | 5.714286 | [
"-a, b = list(map(int, input().split()))",
"-e = [[] for i in range(a)]",
"-for i in range(a - 1):",
"- c1, c2 = list(map(int, input().split()))",
"- e[c1 - 1].append(c2 - 1)",
"- e[c2 - 1].append(c1 - 1)",
"-g = [[] for i in range(a)]",
"-f = deque([(0, -1)])",
"-ans = [0 for _ in range(a)... | false | 0.035377 | 0.036688 | 0.964273 | [
"s324539752",
"s433096145"
] |
u761320129 | p03835 | python | s211392282 | s591443116 | 1,394 | 277 | 2,692 | 41,948 | Accepted | Accepted | 80.13 | K,S = list(map(int, input().split()))
count = 0
for x in range(K+1):
for y in range(K+1):
z = S-x-y
if 0 <= z <= K:
count += 1
print(count) | K,S = list(map(int,input().split()))
ans = 0
for x in range(K+1):
rem = S - x
if rem < 0: break
if rem > 2*K: continue
for y in range(K+1):
z = rem - y
if z < 0: break
if z > K: continue
ans += 1
print(ans)
| 8 | 13 | 159 | 262 | K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
rem = S - x
if rem < 0:
break
if rem > 2 * K:
continue
for y in range(K + 1):
z = rem - y
if z < 0:
break
if z > K:
continue
ans += 1
print(ans)
| false | 38.461538 | [
"-count = 0",
"+ans = 0",
"+ rem = S - x",
"+ if rem < 0:",
"+ break",
"+ if rem > 2 * K:",
"+ continue",
"- z = S - x - y",
"- if 0 <= z <= K:",
"- count += 1",
"-print(count)",
"+ z = rem - y",
"+ if z < 0:",
"+ bre... | false | 0.08809 | 0.035881 | 2.455069 | [
"s211392282",
"s591443116"
] |
u359358631 | p02971 | python | s330512679 | s079189251 | 697 | 312 | 96,024 | 90,472 | Accepted | Accepted | 55.24 | def main():
n = int(eval(input()))
a_lst = [(int(eval(input())), i + 1) for i in range(n)]
a_lst_descend = sorted(a_lst, reverse=True)
max_value = a_lst_descend[0][0]
max_index = a_lst_descend[0][1]
second_value = a_lst_descend[1][0]
for i in range(1, n + 1):
if i == max_... | def main():
n = int(eval(input()))
a_lst = [int(eval(input())) for i in range(n)]
a_lst_descend = sorted(a_lst, reverse=True)
max_value = a_lst_descend[0]
second_value = a_lst_descend[1]
for a in a_lst:
if a == max_value:
print(second_value)
else:
... | 18 | 17 | 437 | 375 | def main():
n = int(eval(input()))
a_lst = [(int(eval(input())), i + 1) for i in range(n)]
a_lst_descend = sorted(a_lst, reverse=True)
max_value = a_lst_descend[0][0]
max_index = a_lst_descend[0][1]
second_value = a_lst_descend[1][0]
for i in range(1, n + 1):
if i == max_index:
... | def main():
n = int(eval(input()))
a_lst = [int(eval(input())) for i in range(n)]
a_lst_descend = sorted(a_lst, reverse=True)
max_value = a_lst_descend[0]
second_value = a_lst_descend[1]
for a in a_lst:
if a == max_value:
print(second_value)
else:
print(ma... | false | 5.555556 | [
"- a_lst = [(int(eval(input())), i + 1) for i in range(n)]",
"+ a_lst = [int(eval(input())) for i in range(n)]",
"- max_value = a_lst_descend[0][0]",
"- max_index = a_lst_descend[0][1]",
"- second_value = a_lst_descend[1][0]",
"- for i in range(1, n + 1):",
"- if i == max_index:... | false | 0.037964 | 0.038363 | 0.98959 | [
"s330512679",
"s079189251"
] |
u263830634 | p03666 | python | s571260402 | s127273149 | 224 | 17 | 3,060 | 2,940 | Accepted | Accepted | 92.41 | N, A, B, C, D = list(map(int, input().split()))
#右端がでかくしても一般性を失わない
if A > B:
A, B = B, A
for k in range(N):
if k * C - (N - 1 - k) * D <= B - A <= k * D - (N - 1 - k) * C:
print ('YES')
exit()
print ('NO') | N, A, B, C, D = list(map(int, input().split()))
#右端がでかくしても一般性を失わない
# if A > B:
# A, B = B, A
k = (B - A + (N - 1) * D) // (C + D)
# print (k)
if k >= (B - A + (N - 1) * C) / (C + D) and N - 1 >= k >= 0:
print ('YES')
else:
print ('NO')
| 11 | 12 | 235 | 255 | N, A, B, C, D = list(map(int, input().split()))
# 右端がでかくしても一般性を失わない
if A > B:
A, B = B, A
for k in range(N):
if k * C - (N - 1 - k) * D <= B - A <= k * D - (N - 1 - k) * C:
print("YES")
exit()
print("NO")
| N, A, B, C, D = list(map(int, input().split()))
# 右端がでかくしても一般性を失わない
# if A > B:
# A, B = B, A
k = (B - A + (N - 1) * D) // (C + D)
# print (k)
if k >= (B - A + (N - 1) * C) / (C + D) and N - 1 >= k >= 0:
print("YES")
else:
print("NO")
| false | 8.333333 | [
"-if A > B:",
"- A, B = B, A",
"-for k in range(N):",
"- if k * C - (N - 1 - k) * D <= B - A <= k * D - (N - 1 - k) * C:",
"- print(\"YES\")",
"- exit()",
"-print(\"NO\")",
"+# if A > B:",
"+# A, B = B, A",
"+k = (B - A + (N - 1) * D) // (C + D)",
"+# print (k)",
"+if k... | false | 0.184528 | 0.036671 | 5.03193 | [
"s571260402",
"s127273149"
] |
u736729525 | p03700 | python | s656783728 | s496567901 | 1,165 | 1,028 | 7,028 | 7,028 | Accepted | Accepted | 11.76 | from bisect import bisect
def solve(N, A, B, H, total):
class Solver:
def __init__(self, N, A, B, H, total):
self.N = N
self.B = B
self.BA = A-B
self.H = H
self.len = idiv(total, B)
def __getitem__(self, k):
Bk = s... | from bisect import bisect
def solve(N, A, B, H, total, M):
class Solver:
def __init__(self, N, A, B, H, total):
self.N = N
self.B = B
self.BA = A-B
self.H = H
self.len = idiv(total, B)
def __getitem__(self, k):
Bk ... | 52 | 54 | 1,186 | 1,238 | from bisect import bisect
def solve(N, A, B, H, total):
class Solver:
def __init__(self, N, A, B, H, total):
self.N = N
self.B = B
self.BA = A - B
self.H = H
self.len = idiv(total, B)
def __getitem__(self, k):
Bk = self.B * k... | from bisect import bisect
def solve(N, A, B, H, total, M):
class Solver:
def __init__(self, N, A, B, H, total):
self.N = N
self.B = B
self.BA = A - B
self.H = H
self.len = idiv(total, B)
def __getitem__(self, k):
Bk = self.B ... | false | 3.703704 | [
"-def solve(N, A, B, H, total):",
"+def solve(N, A, B, H, total, M):",
"- k = bisect(s, 0, k0)",
"+ k = bisect(s, 0, k0, idiv(M, B))",
"+ M = 0",
"+ M = max(M, h)",
"- solve(N, A, B, H, total)",
"+ solve(N, A, B, H, total, M)"
] | false | 0.047272 | 0.041296 | 1.144724 | [
"s656783728",
"s496567901"
] |
u191874006 | p02868 | python | s066592106 | s606193404 | 638 | 355 | 93,148 | 96,132 | Accepted | Accepted | 44.36 | #!/usr/bin/env python3
#第二回全国統一プログラミング王決定戦予選 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collection... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 46 | 47 | 1,151 | 1,131 | #!/usr/bin/env python3
# 第二回全国統一プログラミング王決定戦予選 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import ... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 2.12766 | [
"-# 第二回全国統一プログラミング王決定戦予選 D",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-lrc = [LI() for _ in range(m)]",
"-edge = [[] for _ in range(n)]",
"-for l, r, c in lrc:",
"- edge[l - 1].append((r - 1, c))",
"-for i in range(n - 1):",
"- edge[i + 1].append((i, 0))",
"-... | false | 0.087689 | 0.124408 | 0.704847 | [
"s066592106",
"s606193404"
] |
u063052907 | p03294 | python | s897642147 | s494376211 | 177 | 18 | 5,340 | 3,188 | Accepted | Accepted | 89.83 | from functools import reduce
from fractions import gcd
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(lst):
return reduce(lcm_base, lst, 1)
n = int(eval(input()))
lst_a = list(map(int, input().split()))
l = lcm_list(lst_a)
ans = sum((l-1) % a for a in lst_a)
print(ans) | n = int(eval(input()))
sum_a = sum(map(int, input().split()))
ans = sum_a - n
print(ans) | 19 | 4 | 311 | 85 | from functools import reduce
from fractions import gcd
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(lst):
return reduce(lcm_base, lst, 1)
n = int(eval(input()))
lst_a = list(map(int, input().split()))
l = lcm_list(lst_a)
ans = sum((l - 1) % a for a in lst_a)
print(ans)
| n = int(eval(input()))
sum_a = sum(map(int, input().split()))
ans = sum_a - n
print(ans)
| false | 78.947368 | [
"-from functools import reduce",
"-from fractions import gcd",
"-",
"-",
"-def lcm_base(x, y):",
"- return (x * y) // gcd(x, y)",
"-",
"-",
"-def lcm_list(lst):",
"- return reduce(lcm_base, lst, 1)",
"-",
"-",
"-lst_a = list(map(int, input().split()))",
"-l = lcm_list(lst_a)",
"-an... | false | 0.055945 | 0.042442 | 1.318154 | [
"s897642147",
"s494376211"
] |
u588268040 | p02713 | python | s864498947 | s136678530 | 1,416 | 42 | 9,128 | 9,168 | Accepted | Accepted | 97.03 | import math
K=int(eval(input()))
tot=0
for i in range(1,K+1):
for j in range(1,K+1):
tmp=math.gcd(i,j)
for k in range(1,K+1):
tot+=math.gcd(tmp,k)
print(tot) | # https://atcoder.jp/contests/abc162/tasks/abc162_c
import math
K=int(eval(input()))
# K=200
tot=0
# for i in range(1,K+1):
# for j in range(1,K+1):
# tmp=math.gcd(i,j)
# for k in range(1,K+1):
# tot+=math.gcd(tmp,k)
ls=[0]*202
for i in range(1,K+1):
for j in range(1,K+1)... | 9 | 21 | 191 | 473 | import math
K = int(eval(input()))
tot = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = math.gcd(i, j)
for k in range(1, K + 1):
tot += math.gcd(tmp, k)
print(tot)
| # https://atcoder.jp/contests/abc162/tasks/abc162_c
import math
K = int(eval(input()))
# K=200
tot = 0
# for i in range(1,K+1):
# for j in range(1,K+1):
# tmp=math.gcd(i,j)
# for k in range(1,K+1):
# tot+=math.gcd(tmp,k)
ls = [0] * 202
for i in range(1, K + 1):
for j in range(1, K +... | false | 57.142857 | [
"+# https://atcoder.jp/contests/abc162/tasks/abc162_c",
"+# K=200",
"+# for i in range(1,K+1):",
"+# for j in range(1,K+1):",
"+# tmp=math.gcd(i,j)",
"+# for k in range(1,K+1):",
"+# tot+=math.gcd(tmp,k)",
"+ls = [0] * 202",
"- for k in range(1, K + 1):",
"- ... | false | 0.193999 | 0.042138 | 4.603886 | [
"s864498947",
"s136678530"
] |
u416011173 | p02602 | python | s904998122 | s299553078 | 145 | 129 | 31,564 | 31,016 | Accepted | Accepted | 11.03 | # -*- coding: utf-8 -*-
# 標準入力を取得
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
# 求解処理
for i in range(K, N):
if A[i] > A[i - K]:
print("Yes")
else:
print("No")
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
return N, K, A
def main(N: int, K: int, A: list) -> None:
"""
メイン処理.
Args:\n
... | 11 | 36 | 224 | 688 | # -*- coding: utf-8 -*-
# 標準入力を取得
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
# 求解処理
for i in range(K, N):
if A[i] > A[i - K]:
print("Yes")
else:
print("No")
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
return N, K, A
def main(N: int, K: int, A: list) -> None:
"""
メイン処理.
Args:\n
N (int): 学期数(2 <= ... | false | 69.444444 | [
"-# 標準入力を取得",
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-# 求解処理",
"-for i in range(K, N):",
"- if A[i] > A[i - K]:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+def get_input() -> tuple:",
"+ \"\"\"",
"+ 標準入力を取得する.",
... | false | 0.046501 | 0.045888 | 1.013368 | [
"s904998122",
"s299553078"
] |
u616169109 | p02623 | python | s979871075 | s278761167 | 289 | 251 | 47,388 | 50,680 | Accepted | Accepted | 13.15 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] >... | from itertools import accumulate
import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA = [0] + list(accumulate(A))
SB = [0] + list(accumulate(B))
max_count = 0
for i in range(N + 1):
a_count = i
b_count = bisect.bisect_... | 19 | 20 | 385 | 491 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] > K - a[i]:
... | from itertools import accumulate
import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA = [0] + list(accumulate(A))
SB = [0] + list(accumulate(B))
max_count = 0
for i in range(N + 1):
a_count = i
b_count = bisect.bisect_right(SB, K - S... | false | 5 | [
"+from itertools import accumulate",
"+import bisect",
"+",
"-a, b = [0], [0]",
"-for i in range(N):",
"- a.append(a[i] + A[i])",
"-for i in range(M):",
"- b.append(b[i] + B[i])",
"-ans, j = 0, M",
"+SA = [0] + list(accumulate(A))",
"+SB = [0] + list(accumulate(B))",
"+max_count = 0",
... | false | 0.046894 | 0.038493 | 1.218234 | [
"s979871075",
"s278761167"
] |
u687053495 | p03409 | python | s234115708 | s562305219 | 26 | 20 | 3,188 | 3,188 | Accepted | Accepted | 23.08 |
N = int(eval(input()))
X = []
Y = []
for i in range(N):
a, b = list(map(int, input().split()))
X.append((a, b))
for i in range(N):
c, d = list(map(int, input().split()))
Y.append((c, d))
X.sort(key=lambda x: -x[1])
Y.sort(key=lambda x: x[0])
B = []
result = 0
for x in range(N):
red... |
N = int(eval(input()))
RED = []
BLUE = []
for i in range(N):
a, b = list(map(int, input().split()))
RED.append((a, b))
for i in range(N):
a, b = list(map(int, input().split()))
BLUE.append((a, b))
BLUE.sort(key=lambda x: x[0])
RED.sort(key=lambda x: -x[1])
red_selected = set()
blue_s... | 33 | 31 | 531 | 561 | N = int(eval(input()))
X = []
Y = []
for i in range(N):
a, b = list(map(int, input().split()))
X.append((a, b))
for i in range(N):
c, d = list(map(int, input().split()))
Y.append((c, d))
X.sort(key=lambda x: -x[1])
Y.sort(key=lambda x: x[0])
B = []
result = 0
for x in range(N):
red = list(map(int, X... | N = int(eval(input()))
RED = []
BLUE = []
for i in range(N):
a, b = list(map(int, input().split()))
RED.append((a, b))
for i in range(N):
a, b = list(map(int, input().split()))
BLUE.append((a, b))
BLUE.sort(key=lambda x: x[0])
RED.sort(key=lambda x: -x[1])
red_selected = set()
blue_selected = set()
for ... | false | 6.060606 | [
"-X = []",
"-Y = []",
"+RED = []",
"+BLUE = []",
"- X.append((a, b))",
"+ RED.append((a, b))",
"- c, d = list(map(int, input().split()))",
"- Y.append((c, d))",
"-X.sort(key=lambda x: -x[1])",
"-Y.sort(key=lambda x: x[0])",
"-B = []",
"-result = 0",
"-for x in range(N):",
"- ... | false | 0.038139 | 0.042865 | 0.889744 | [
"s234115708",
"s562305219"
] |
u969850098 | p02727 | python | s434555260 | s669358489 | 1,772 | 241 | 23,456 | 23,456 | Accepted | Accepted | 86.4 | from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
... | from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
PQR = P[:X] + Q[:Y] + R
... | 27 | 17 | 589 | 419 | from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
PQ = P[:X]... | from heapq import heapify, heappush, heappop
def main():
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
PQR = P[:X] + Q[:Y] + R
PQR.sor... | false | 37.037037 | [
"- R.sort(reverse=True)",
"- PQ = P[:X] + Q[:Y]",
"- heapify(PQ)",
"- while R:",
"- mpq = heappop(PQ)",
"- mr = R.pop(0)",
"- if mpq >= mr:",
"- heappush(PQ, mpq)",
"- break",
"- heappush(PQ, mr)",
"- print((sum(PQ)))",
"+ PQR... | false | 0.036497 | 0.061971 | 0.588947 | [
"s434555260",
"s669358489"
] |
u222668979 | p02641 | python | s532777032 | s172900663 | 104 | 66 | 61,800 | 61,968 | Accepted | Accepted | 36.54 | x, n = list(map(int, input().split()))
p = set(map(int, input().split()))
ans = 1000
for i in range(102):
if i not in p:
ans = min(ans, abs(x - i))
print((x + ans if x - ans in p else x - ans))
| x, n = list(map(int, input().split()))
p = set(map(int, input().split()))
ans = 1000
ans = min(abs(x-i) for i in range(102) if i not in p)
print((x + ans if x - ans in p else x - ans))
| 8 | 6 | 206 | 183 | x, n = list(map(int, input().split()))
p = set(map(int, input().split()))
ans = 1000
for i in range(102):
if i not in p:
ans = min(ans, abs(x - i))
print((x + ans if x - ans in p else x - ans))
| x, n = list(map(int, input().split()))
p = set(map(int, input().split()))
ans = 1000
ans = min(abs(x - i) for i in range(102) if i not in p)
print((x + ans if x - ans in p else x - ans))
| false | 25 | [
"-for i in range(102):",
"- if i not in p:",
"- ans = min(ans, abs(x - i))",
"+ans = min(abs(x - i) for i in range(102) if i not in p)"
] | false | 0.03714 | 0.036985 | 1.004194 | [
"s532777032",
"s172900663"
] |
u189487046 | p03680 | python | s343721012 | s205208587 | 220 | 57 | 7,080 | 7,068 | Accepted | Accepted | 74.09 | n = int(eval(input()))
al = [0 for _ in range(n)]
for i in range(n):
al[i] = int(eval(input()))
ans = 1
i = 0
while True:
if al[i] == 2:
print(ans)
break
elif al[i] == -1:
print((-1))
break
tmp = i
i = al[i]-1
al[tmp] = -1
ans += 1
| import sys
input = sys.stdin.readline
buttons = list(map(int, sys.stdin))
light = buttons[1]
for i in range(buttons[0]):
if light == 2:
print((i+1))
break
light = buttons[light]
else:
print((-1))
| 19 | 12 | 298 | 232 | n = int(eval(input()))
al = [0 for _ in range(n)]
for i in range(n):
al[i] = int(eval(input()))
ans = 1
i = 0
while True:
if al[i] == 2:
print(ans)
break
elif al[i] == -1:
print((-1))
break
tmp = i
i = al[i] - 1
al[tmp] = -1
ans += 1
| import sys
input = sys.stdin.readline
buttons = list(map(int, sys.stdin))
light = buttons[1]
for i in range(buttons[0]):
if light == 2:
print((i + 1))
break
light = buttons[light]
else:
print((-1))
| false | 36.842105 | [
"-n = int(eval(input()))",
"-al = [0 for _ in range(n)]",
"-for i in range(n):",
"- al[i] = int(eval(input()))",
"-ans = 1",
"-i = 0",
"-while True:",
"- if al[i] == 2:",
"- print(ans)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+buttons = list(map(int, sys.stdin))",
... | false | 0.035819 | 0.037395 | 0.957876 | [
"s343721012",
"s205208587"
] |
u502389123 | p03088 | python | s382957458 | s015969857 | 58 | 53 | 3,700 | 3,700 | Accepted | Accepted | 8.62 | N = int(eval(input()))
dp = [[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N+1)]
dp[0][0][0][0] = 1
# Aを1、Gを2、Cを3、Tを4とする
# k は3つ前、jは2つ前、iは1つ前の情報
for n in range(N):
for i in range(5):
for j in range(5):
for k in range(5):
# tは今の情報
... | N = int(eval(input()))
dp = [[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N+1)]
dp[0][0][0][0] = 1
# Aを1、Gを2、Cを3、Tを4とする
# j は3つ前、kは2つ前、lは1つ前の情報
for i in range(N):
for j in range(5):
for k in range(5):
for l in range(5):
# tは今の情報
... | 39 | 33 | 1,161 | 1,003 | N = int(eval(input()))
dp = [
[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N + 1)
]
dp[0][0][0][0] = 1
# Aを1、Gを2、Cを3、Tを4とする
# k は3つ前、jは2つ前、iは1つ前の情報
for n in range(N):
for i in range(5):
for j in range(5):
for k in range(5):
# tは今の情報
... | N = int(eval(input()))
dp = [
[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N + 1)
]
dp[0][0][0][0] = 1
# Aを1、Gを2、Cを3、Tを4とする
# j は3つ前、kは2つ前、lは1つ前の情報
for i in range(N):
for j in range(5):
for k in range(5):
for l in range(5):
# tは今の情報
... | false | 15.384615 | [
"-# k は3つ前、jは2つ前、iは1つ前の情報",
"-for n in range(N):",
"- for i in range(5):",
"- for j in range(5):",
"- for k in range(5):",
"+# j は3つ前、kは2つ前、lは1つ前の情報",
"+for i in range(N):",
"+ for j in range(5):",
"+ for k in range(5):",
"+ for l in range(5):",
"- ... | false | 0.082348 | 0.130084 | 0.633039 | [
"s382957458",
"s015969857"
] |
u562935282 | p03329 | python | s783170231 | s434939225 | 672 | 407 | 3,828 | 3,828 | Accepted | Accepted | 39.43 | n = int(eval(input()))
dp = [float('inf')] * 100010
dp[0] = 0
for i in range(1, 100000 + 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... | def funcDP(n):
dp = [float('inf')] * (n + 10)
dp[0] = 0
for i in range(1, n + 1):
for base in [6, 9]:
powered = 1
while powered <= i:
dp[i] = min(dp[i], dp[i - powered] + 1)
powered *= base
return dp[n]
if __name__ == '__main__'... | 13 | 13 | 317 | 354 | n = int(eval(input()))
dp = [float("inf")] * 100010
dp[0] = 0
for i in range(1, 100000 + 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]))
| def funcDP(n):
dp = [float("inf")] * (n + 10)
dp[0] = 0
for i in range(1, n + 1):
for base in [6, 9]:
powered = 1
while powered <= i:
dp[i] = min(dp[i], dp[i - powered] + 1)
powered *= base
return dp[n]
if __name__ == "__main__":
prin... | false | 0 | [
"-n = int(eval(input()))",
"-dp = [float(\"inf\")] * 100010",
"-dp[0] = 0",
"-for i in range(1, 100000 + 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... | false | 3.741711 | 0.092045 | 40.651062 | [
"s783170231",
"s434939225"
] |
u173329233 | p03317 | python | s987284379 | s654372329 | 39 | 28 | 13,812 | 10,420 | Accepted | Accepted | 28.21 | N, K = list(map(int,input().split()))
A = list(map(int, input().split()))
if (N-1) % (K-1) == 0:
print(((N-1)//(K-1)))
else:
print(((N-1)//(K-1)+1)) |
nk = eval(input())
n, k = nk.split()
n = int(n)
k = int(k)
an = eval(input())
an_list = an.split()
min = min(an_list)
if (n-1)%(k-1)==0:
res = (n-1)//(k-1)
else:
res = (n-1)//(k-1) + 1
print(res)
| 6 | 20 | 147 | 219 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
if (N - 1) % (K - 1) == 0:
print(((N - 1) // (K - 1)))
else:
print(((N - 1) // (K - 1) + 1))
| nk = eval(input())
n, k = nk.split()
n = int(n)
k = int(k)
an = eval(input())
an_list = an.split()
min = min(an_list)
if (n - 1) % (k - 1) == 0:
res = (n - 1) // (k - 1)
else:
res = (n - 1) // (k - 1) + 1
print(res)
| false | 70 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-if (N - 1) % (K - 1) == 0:",
"- print(((N - 1) // (K - 1)))",
"+nk = eval(input())",
"+n, k = nk.split()",
"+n = int(n)",
"+k = int(k)",
"+an = eval(input())",
"+an_list = an.split()",
"+min = min(an_list)",
... | false | 0.037091 | 0.035441 | 1.046536 | [
"s987284379",
"s654372329"
] |
u037430802 | p02722 | python | s793920124 | s095211195 | 349 | 300 | 3,828 | 14,196 | Accepted | Accepted | 14.04 |
N = int(eval(input()))
def solve(num):
ret = set()
p = 1
while p * p <= num:
if num % p == 0:
ret.add(p)
ret.add(num // p)
p += 1
return ret
s1 = solve(N)
s2 = solve(N-1)
# 1は答えに入らないので抜いた
ans = len(s2) - 1
for n in s1:
if n =... |
N = int(eval(input()))
"""
愚直にやると、Kを2~Nの範囲で全部調べて数え上げる。N <= 10**12 なので間に合わない。
たとえば N=100だと、
[2, 3, 4, 9, 10, 11, 33, 99, 100]
が条件を満たす数字になる。
割り算を行わないとき、明らかに N % K = 1 になる
これは、「NをKで割ったら、1あまる」であるから、「N-1をKでわったら割り切れる」ともいえる。
なので、割り算が起こらないものは、N-1の約数。
割り算が起こるやつは、割れるだけ割った後、余りを調べればよい。
"""
def solv... | 35 | 50 | 454 | 725 | N = int(eval(input()))
def solve(num):
ret = set()
p = 1
while p * p <= num:
if num % p == 0:
ret.add(p)
ret.add(num // p)
p += 1
return ret
s1 = solve(N)
s2 = solve(N - 1)
# 1は答えに入らないので抜いた
ans = len(s2) - 1
for n in s1:
if n == 1:
continue
tmp... | N = int(eval(input()))
"""
愚直にやると、Kを2~Nの範囲で全部調べて数え上げる。N <= 10**12 なので間に合わない。
たとえば N=100だと、
[2, 3, 4, 9, 10, 11, 33, 99, 100]
が条件を満たす数字になる。
割り算を行わないとき、明らかに N % K = 1 になる
これは、「NをKで割ったら、1あまる」であるから、「N-1をKでわったら割り切れる」ともいえる。
なので、割り算が起こらないものは、N-1の約数。
割り算が起こるやつは、割れるだけ割った後、余りを調べればよい。
"""
def solve(n):
i = 1
ret = set()... | false | 30 | [
"+\"\"\"",
"+愚直にやると、Kを2~Nの範囲で全部調べて数え上げる。N <= 10**12 なので間に合わない。",
"+たとえば N=100だと、",
"+[2, 3, 4, 9, 10, 11, 33, 99, 100]",
"+が条件を満たす数字になる。",
"+割り算を行わないとき、明らかに N % K = 1 になる",
"+これは、「NをKで割ったら、1あまる」であるから、「N-1をKでわったら割り切れる」ともいえる。",
"+なので、割り算が起こらないものは、N-1の約数。",
"+割り算が起こるやつは、割れるだけ割った後、余りを調べればよい。",
"+\"\"\... | false | 0.068645 | 0.071103 | 0.965427 | [
"s793920124",
"s095211195"
] |
u261103969 | p02694 | python | s000785939 | s771436988 | 61 | 55 | 63,476 | 63,348 | Accepted | Accepted | 9.84 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
x = int(eval(input()))
year = 0
money = 100
while money < x:
money *= 1.01
money = int(money)
year += 1
print(year)
if __name... | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
x = int(eval(input()))
year = 0
money = 100
from math import floor
while money < x:
money *= 1.01
money = floor(money)
yea... | 24 | 26 | 344 | 384 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
x = int(eval(input()))
year = 0
money = 100
while money < x:
money *= 1.01
money = int(money)
year += 1
print(year)
if __name__ == "__main__":
main()
| import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
x = int(eval(input()))
year = 0
money = 100
from math import floor
while money < x:
money *= 1.01
money = floor(money)
year += 1
print(year)
if __nam... | false | 7.692308 | [
"+ from math import floor",
"+",
"- money = int(money)",
"+ money = floor(money)"
] | false | 0.105137 | 0.041831 | 2.513334 | [
"s000785939",
"s771436988"
] |
u533039576 | p03476 | python | s641965428 | s510509372 | 454 | 295 | 13,368 | 13,424 | Accepted | Accepted | 35.02 | import math
q = int(eval(input()))
l = []
r = []
for i in range(q):
li, ri = list(map(int, input().split()))
l.append(li)
r.append(ri)
r_max = max(r) + 10
is_prime = [True] * (r_max+1)
is_prime[0] = is_prime[1] = False
for i in range(2, r_max):
if is_prime[i]:
for j in range(2, r_... | import sys
import math
input = sys.stdin.readline
def eratosthenes(n):
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False
for i in range(2, n // 2 + 1):
if is_prime[i]:
for j in range(2, n // i + 1):
is_prime[i * j] = False
return is_prime
... | 27 | 34 | 571 | 711 | import math
q = int(eval(input()))
l = []
r = []
for i in range(q):
li, ri = list(map(int, input().split()))
l.append(li)
r.append(ri)
r_max = max(r) + 10
is_prime = [True] * (r_max + 1)
is_prime[0] = is_prime[1] = False
for i in range(2, r_max):
if is_prime[i]:
for j in range(2, r_max // i + 1... | import sys
import math
input = sys.stdin.readline
def eratosthenes(n):
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False
for i in range(2, n // 2 + 1):
if is_prime[i]:
for j in range(2, n // i + 1):
is_prime[i * j] = False
return is_prime
q = int(eval... | false | 20.588235 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def eratosthenes(n):",
"+ is_prime = [True] * (n + 1)",
"+ is_prime[0] = is_prime[1] = False",
"+ for i in range(2, n // 2 + 1):",
"+ if is_prime[i]:",
"+ for j in range(2, n // i + 1):",
"+ ... | false | 0.065747 | 0.036767 | 1.78819 | [
"s641965428",
"s510509372"
] |
u815878613 | p02630 | python | s840409438 | s520475925 | 398 | 316 | 40,236 | 40,428 | Accepted | Accepted | 20.6 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
Q = int(eval(input()))
BC = [list(map(int, input().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
d[c] += d[b]
d[b] = 0
print(sub_s)
| from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
... | 18 | 22 | 303 | 369 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
Q = int(eval(input()))
BC = [list(map(int, input().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
d[c] += d[b]
d[b] = 0
print(sub_s)
| from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
d[c] += d[b]
d[b] ... | false | 18.181818 | [
"+import sys",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-Q = int(eval(input()))",
"-BC = [list(map(int, input().split())) for _ in range(Q)]",
"+readline = sys.stdin.buffer.readline",
"+N = int(readline())",
"+A = list(map(int, readline().split()))",
"+Q = int(readline())"... | false | 0.038896 | 0.044748 | 0.869223 | [
"s840409438",
"s520475925"
] |
u956318161 | p02552 | python | s141913085 | s791442755 | 30 | 27 | 9,144 | 9,080 | Accepted | Accepted | 10 | x=int(eval(input()))
if x==0:
print("1")
else:
print("0") | x=int(eval(input()))
if x==1:
print("0")
else:
print("1") | 5 | 5 | 59 | 59 | x = int(eval(input()))
if x == 0:
print("1")
else:
print("0")
| x = int(eval(input()))
if x == 1:
print("0")
else:
print("1")
| false | 0 | [
"-if x == 0:",
"+if x == 1:",
"+ print(\"0\")",
"+else:",
"-else:",
"- print(\"0\")"
] | false | 0.047952 | 0.038875 | 1.233493 | [
"s141913085",
"s791442755"
] |
u278955646 | p02678 | python | s794273750 | s298757924 | 1,382 | 957 | 54,872 | 54,584 | Accepted | Accepted | 30.75 | from queue import Queue
class Node:
def __init__(self, data):
self.data = data
self.children = []
def main():
N, M = list(map(int, input().split()))
dic = {}
for i in range(1, N + 1):
dic[i] = Node(i)
for i in range(0, M):
A, B = list(map(int, input().s... | from collections import deque
class Node:
def __init__(self, data):
self.data = data
self.children = []
def main():
N, M = list(map(int, input().split()))
dic = {}
for i in range(1, N + 1):
dic[i] = Node(i)
for i in range(0, M):
A, B = list(map(int, inp... | 33 | 33 | 810 | 823 | from queue import Queue
class Node:
def __init__(self, data):
self.data = data
self.children = []
def main():
N, M = list(map(int, input().split()))
dic = {}
for i in range(1, N + 1):
dic[i] = Node(i)
for i in range(0, M):
A, B = list(map(int, input().split()))
... | from collections import deque
class Node:
def __init__(self, data):
self.data = data
self.children = []
def main():
N, M = list(map(int, input().split()))
dic = {}
for i in range(1, N + 1):
dic[i] = Node(i)
for i in range(0, M):
A, B = list(map(int, input().split(... | false | 0 | [
"-from queue import Queue",
"+from collections import deque",
"- q = Queue()",
"- q.put(dic[1])",
"- while not q.empty():",
"- current = q.get()",
"+ q = deque()",
"+ q.append(dic[1])",
"+ while len(q) > 0:",
"+ current = q.popleft()",
"- q.put(chil... | false | 0.040223 | 0.036652 | 1.097434 | [
"s794273750",
"s298757924"
] |
u086503932 | p02787 | python | s889453879 | s578947143 | 339 | 190 | 145,640 | 68,192 | Accepted | Accepted | 43.95 | #!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
def main():
H, N = list(map(int, input().split()))
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
INF... | #!/usr/bin/env python3
def main():
H, N = list(map(int, input().split()))
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
#1次元DPに書き換え
INF = 10**12
dp = [INF] * (H+1)
dp[0] = 0
for i in range(N):
for j in ra... | 23 | 20 | 631 | 445 | #!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
def main():
H, N = list(map(int, input().split()))
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
INF = 10**12
... | #!/usr/bin/env python3
def main():
H, N = list(map(int, input().split()))
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
# 1次元DPに書き換え
INF = 10**12
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
for j in range(H + 1):
... | false | 13.043478 | [
"-from collections import deque, Counter",
"-from heapq import heappop, heappush",
"-from bisect import bisect_right",
"-",
"-",
"+ # 1次元DPに書き換え",
"- dp = [[INF] * (H + 1) for _ in range(N + 1)]",
"- dp[0][0] = 0",
"+ dp = [INF] * (H + 1)",
"+ dp[0] = 0",
"- dp[i + 1][j... | false | 0.235164 | 0.333433 | 0.705282 | [
"s889453879",
"s578947143"
] |
u263830634 | p03762 | python | s846535286 | s487228914 | 212 | 165 | 18,556 | 18,576 | Accepted | Accepted | 22.17 | MOD = 10 ** 9 + 7
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
# 前計算
for i in range(n - 1):
x[i] = x[i + 1] - x[i]
for i in range(m - 1):
y[i] = y[i + 1] - y[i]
N = [n - 1]
for i in range(n - 3, 0, -2):
N.append(N[-1] + i)
... | MOD = 10 ** 9 + 7
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_sum = 0
for k, value in enumerate(x):
x_sum += (2 * (k + 1) - n - 1) * value
x_sum %= MOD
y_sum = 0
for k, value in enumerate(y):
y_sum += (2 * (k + 1) - m - 1) * ... | 57 | 19 | 1,008 | 377 | MOD = 10**9 + 7
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
# 前計算
for i in range(n - 1):
x[i] = x[i + 1] - x[i]
for i in range(m - 1):
y[i] = y[i + 1] - y[i]
N = [n - 1]
for i in range(n - 3, 0, -2):
N.append(N[-1] + i)
# N.append((N[i] ... | MOD = 10**9 + 7
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_sum = 0
for k, value in enumerate(x):
x_sum += (2 * (k + 1) - n - 1) * value
x_sum %= MOD
y_sum = 0
for k, value in enumerate(y):
y_sum += (2 * (k + 1) - m - 1) * value
y_sum ... | false | 66.666667 | [
"-# 前計算",
"-for i in range(n - 1):",
"- x[i] = x[i + 1] - x[i]",
"-for i in range(m - 1):",
"- y[i] = y[i + 1] - y[i]",
"-N = [n - 1]",
"-for i in range(n - 3, 0, -2):",
"- N.append(N[-1] + i)",
"- # N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD)",
"-M = [m - 1]",
"-for i in range(m ... | false | 0.035301 | 0.047672 | 0.740511 | [
"s846535286",
"s487228914"
] |
u588341295 | p03152 | python | s349659806 | s037810239 | 1,215 | 777 | 13,208 | 13,156 | Accepted | Accepted | 36.05 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/keyence2019/editorial.pdf
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from he... | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect i... | 75 | 78 | 2,250 | 2,307 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/keyence2019/editorial.pdf
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq i... | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect im... | false | 3.846154 | [
"-\"\"\"",
"-参考:https://img.atcoder.jp/keyence2019/editorial.pdf",
"-\"\"\"",
"-# 二分探索用にソートしておく",
"-# (どの行に何が来るかの具体的な位置は今回必要ないのでソートしていい)",
"-A = sorted(LIST())",
"-B = sorted(LIST())",
"+# あとで大きい値から数えたいので降順ソートしておく",
"+A = sorted(LIST(), reverse=True)",
"+B = sorted(LIST(), reverse=True)",
"+j = ... | false | 0.100977 | 0.044625 | 2.262761 | [
"s349659806",
"s037810239"
] |
u596276291 | p03827 | python | s844642645 | s071472039 | 24 | 22 | 3,444 | 3,316 | Accepted | Accepted | 8.33 | from collections import defaultdict
def main():
N = int(eval(input()))
S = str(eval(input()))
x = 0
ans = 0
for c in S:
x += {"I": 1, "D": -1}[c]
ans = max(ans, x)
print(ans)
if __name__ == '__main__':
main()
| from collections import defaultdict
def main():
N = int(eval(input()))
S = eval(input())
x = 0
ans = 0
for s in S:
if s == "I":
x += 1
else:
x -= 1
ans = max(ans, x)
print(ans)
if __name__ == '__main__':
main()
| 16 | 19 | 260 | 297 | from collections import defaultdict
def main():
N = int(eval(input()))
S = str(eval(input()))
x = 0
ans = 0
for c in S:
x += {"I": 1, "D": -1}[c]
ans = max(ans, x)
print(ans)
if __name__ == "__main__":
main()
| from collections import defaultdict
def main():
N = int(eval(input()))
S = eval(input())
x = 0
ans = 0
for s in S:
if s == "I":
x += 1
else:
x -= 1
ans = max(ans, x)
print(ans)
if __name__ == "__main__":
main()
| false | 15.789474 | [
"- S = str(eval(input()))",
"+ S = eval(input())",
"- for c in S:",
"- x += {\"I\": 1, \"D\": -1}[c]",
"+ for s in S:",
"+ if s == \"I\":",
"+ x += 1",
"+ else:",
"+ x -= 1"
] | false | 0.043011 | 0.040153 | 1.071174 | [
"s844642645",
"s071472039"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.