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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u463655976 | p03163 | python | s772181990 | s822888638 | 1,019 | 879 | 139,736 | 122,544 | Accepted | Accepted | 13.74 | # TODO:実装
N, W = list(map(int, input().split()))
DP = {0: 0}
for i in range(N):
wi, vi = list(map(int, input().split()))
DP_dst = DP.copy()
for j in DP:
if j+wi <= W:
DP_dst[j+wi] = max(DP.get(j+wi, 0), DP[j]+vi)
DP = DP_dst
print((max((DP[x] for x in DP))))
| N, W = list(map(int, input().split()))
DP = {0: 0}
for i in range(N):
wi, vi = list(map(int, input().split()))
p = {}
for j in DP:
if j+wi <= W and DP.get(j+wi, 0) < DP[j]+vi:
p[j+wi] = DP[j]+vi
for pi in p:
DP[pi] = p[pi]
print((max((DP[x] for x in DP))))
| 12 | 12 | 293 | 299 | # TODO:実装
N, W = list(map(int, input().split()))
DP = {0: 0}
for i in range(N):
wi, vi = list(map(int, input().split()))
DP_dst = DP.copy()
for j in DP:
if j + wi <= W:
DP_dst[j + wi] = max(DP.get(j + wi, 0), DP[j] + vi)
DP = DP_dst
print((max((DP[x] for x in DP))))
| N, W = list(map(int, input().split()))
DP = {0: 0}
for i in range(N):
wi, vi = list(map(int, input().split()))
p = {}
for j in DP:
if j + wi <= W and DP.get(j + wi, 0) < DP[j] + vi:
p[j + wi] = DP[j] + vi
for pi in p:
DP[pi] = p[pi]
print((max((DP[x] for x in DP))))
| false | 0 | [
"-# TODO:実装",
"- DP_dst = DP.copy()",
"+ p = {}",
"- if j + wi <= W:",
"- DP_dst[j + wi] = max(DP.get(j + wi, 0), DP[j] + vi)",
"- DP = DP_dst",
"+ if j + wi <= W and DP.get(j + wi, 0) < DP[j] + vi:",
"+ p[j + wi] = DP[j] + vi",
"+ for pi in p:",
"+ ... | false | 0.036902 | 0.106142 | 0.347671 | [
"s772181990",
"s822888638"
] |
u936985471 | p02853 | python | s850453469 | s337696740 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | X,Y=list(map(int,input().split()))
Xp=max((4-X),0)*100000
Yp=max((4-Y),0)*100000
print((Xp+Yp+((0,400000)[X*Y==1]))) | X,Y=list(map(int,input().split()));print(((max((4-X),0)+max((4-Y),0)+((0,4)[X*Y==1]))*10**5)) | 4 | 1 | 111 | 85 | X, Y = list(map(int, input().split()))
Xp = max((4 - X), 0) * 100000
Yp = max((4 - Y), 0) * 100000
print((Xp + Yp + ((0, 400000)[X * Y == 1])))
| X, Y = list(map(int, input().split()))
print(((max((4 - X), 0) + max((4 - Y), 0) + ((0, 4)[X * Y == 1])) * 10**5))
| false | 75 | [
"-Xp = max((4 - X), 0) * 100000",
"-Yp = max((4 - Y), 0) * 100000",
"-print((Xp + Yp + ((0, 400000)[X * Y == 1])))",
"+print(((max((4 - X), 0) + max((4 - Y), 0) + ((0, 4)[X * Y == 1])) * 10**5))"
] | false | 0.043998 | 0.045551 | 0.965909 | [
"s850453469",
"s337696740"
] |
u699296734 | p02743 | python | s744394277 | s315401259 | 35 | 20 | 5,332 | 3,316 | Accepted | Accepted | 42.86 | from decimal import Decimal
import math
a,b,c=list(map(int,input().split()))
if c-a-b>0 and 4*a*b<(c-a-b)**2:
print("Yes")
else:
print("No")
| a,b,c=list(map(int,input().split()))
if 4*a*b < (c-a-b)**2 and (c-a-b)>0:
print("Yes")
else:
print("No") | 7 | 5 | 145 | 106 | from decimal import Decimal
import math
a, b, c = list(map(int, input().split()))
if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if 4 * a * b < (c - a - b) ** 2 and (c - a - b) > 0:
print("Yes")
else:
print("No")
| false | 28.571429 | [
"-from decimal import Decimal",
"-import math",
"-",
"-if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2:",
"+if 4 * a * b < (c - a - b) ** 2 and (c - a - b) > 0:"
] | false | 0.074366 | 0.037333 | 1.991941 | [
"s744394277",
"s315401259"
] |
u077291787 | p03722 | python | s994342867 | s088305425 | 537 | 432 | 3,316 | 3,312 | Accepted | Accepted | 19.55 | # ABC061D - Score Attack
import sys
input = sys.stdin.readline
def bellman_ford(N: int, M: int, E: "Array[Array[int]]") -> int or None:
INF = float("inf")
dist = [INF] * (N + 1)
dist[1] = 0
# relax edges
for i in range(N):
for v, u, w in E: # w: positive -> -w
if v... | # ABC061D - Score Attack
import sys
input = sys.stdin.readline
def bellman_ford(N: int, M: int, E: "Array[Array[int]]") -> int or None:
INF = float("inf")
dist = [INF] * (N + 1)
dist[1] = 0
# relax edges
for i in range(N):
for v, u, w in E: # w: positive -> -w
if d... | 30 | 30 | 878 | 865 | # ABC061D - Score Attack
import sys
input = sys.stdin.readline
def bellman_ford(N: int, M: int, E: "Array[Array[int]]") -> int or None:
INF = float("inf")
dist = [INF] * (N + 1)
dist[1] = 0
# relax edges
for i in range(N):
for v, u, w in E: # w: positive -> -w
if v != INF and... | # ABC061D - Score Attack
import sys
input = sys.stdin.readline
def bellman_ford(N: int, M: int, E: "Array[Array[int]]") -> int or None:
INF = float("inf")
dist = [INF] * (N + 1)
dist[1] = 0
# relax edges
for i in range(N):
for v, u, w in E: # w: positive -> -w
if dist[v] - w ... | false | 0 | [
"- if v != INF and dist[v] - w < dist[u]:",
"+ if dist[v] - w < dist[u]:"
] | false | 0.047005 | 0.047592 | 0.987664 | [
"s994342867",
"s088305425"
] |
u585742242 | p03291 | python | s392863316 | s274306665 | 476 | 231 | 27,588 | 3,188 | Accepted | Accepted | 51.47 | # -*- coding: utf-8 -*-
S = eval(input())
mod = 10 ** 9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
dp[len(S)][3] = 1
for i in range(len(S) - 1, -1, -1):
dp[i][3] += dp[i + 1][3] * 3 if S[i] == '?' else dp[i + 1][3]
dp[i][3] %= mod
for j in range(2, -1, -1):
dp[i][j] += dp[i + 1][j] *... |
# AC (faster) ###############################################################
mod = 10**9 + 7
dp = [0, 0, 0, 1]
for s in input()[::-1]:
tmp = dp[:]
dp[3] = tmp[3] * 3 if s == '?' else tmp[3]
dp[3] %= mod
for j in range(2, -1, -1):
dp[j] = tmp[j] * 3 + tmp[j + 1] if s == '?' else \
... | 16 | 17 | 475 | 457 | # -*- coding: utf-8 -*-
S = eval(input())
mod = 10**9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
dp[len(S)][3] = 1
for i in range(len(S) - 1, -1, -1):
dp[i][3] += dp[i + 1][3] * 3 if S[i] == "?" else dp[i + 1][3]
dp[i][3] %= mod
for j in range(2, -1, -1):
dp[i][j] += dp[i + 1][j] * 3 if S[i] == "... | # AC (faster) ###############################################################
mod = 10**9 + 7
dp = [0, 0, 0, 1]
for s in input()[::-1]:
tmp = dp[:]
dp[3] = tmp[3] * 3 if s == "?" else tmp[3]
dp[3] %= mod
for j in range(2, -1, -1):
dp[j] = (
tmp[j] * 3 + tmp[j + 1]
if s ==... | false | 5.882353 | [
"-# -*- coding: utf-8 -*-",
"-S = eval(input())",
"+# AC (faster) ###############################################################",
"-dp = [[0] * 4 for i in range(len(S) + 1)]",
"-dp[len(S)][3] = 1",
"-for i in range(len(S) - 1, -1, -1):",
"- dp[i][3] += dp[i + 1][3] * 3 if S[i] == \"?\" else dp[i + ... | false | 0.036913 | 0.034464 | 1.071043 | [
"s392863316",
"s274306665"
] |
u795630164 | p03494 | python | s523578788 | s807603859 | 20 | 18 | 3,060 | 3,064 | Accepted | Accepted | 10 | N = eval(input())
x = list(map(int, input().split()))
end = True
count = 0
def div2(y):
return y / 2
while end:
for i in x:
if i % 2 == 1:
end = False
break
else:
count += 1
x = list(map(div2, x))
continue
break
print(count) | N = eval(input())
A = list(map(int, input().split()))
ans = 10 ** 9
for a in A:
x = 0
while a > 1:
if a % 2 != 0:
break
a //= 2
x += 1
ans = min(ans, x)
print(ans) | 19 | 14 | 310 | 214 | N = eval(input())
x = list(map(int, input().split()))
end = True
count = 0
def div2(y):
return y / 2
while end:
for i in x:
if i % 2 == 1:
end = False
break
else:
count += 1
x = list(map(div2, x))
continue
break
print(count)
| N = eval(input())
A = list(map(int, input().split()))
ans = 10**9
for a in A:
x = 0
while a > 1:
if a % 2 != 0:
break
a //= 2
x += 1
ans = min(ans, x)
print(ans)
| false | 26.315789 | [
"-x = list(map(int, input().split()))",
"-end = True",
"-count = 0",
"-",
"-",
"-def div2(y):",
"- return y / 2",
"-",
"-",
"-while end:",
"- for i in x:",
"- if i % 2 == 1:",
"- end = False",
"+A = list(map(int, input().split()))",
"+ans = 10**9",
"+for a in A:... | false | 0.037518 | 0.037363 | 1.004133 | [
"s523578788",
"s807603859"
] |
u540761833 | p02937 | python | s709277590 | s476835093 | 407 | 133 | 8,052 | 7,796 | Accepted | Accepted | 67.32 | from collections import defaultdict
import bisect
s = eval(input())
t = eval(input())
dicta = defaultdict(list)
for a,b in enumerate(s):
dicta[b] += [a]
snow = -1
count = 0
flag = True
for i in t:
if i not in s:
flag = False
break
nowt = dicta[i]
snowind = bisect.bisect_ri... | from collections import defaultdict
import bisect
s = eval(input())
t = eval(input())
dicta = defaultdict(list)
for a,b in enumerate(s):
dicta[b] += [a]
snow = -1
count = 0
flag = True
for i in t:
if not dicta[i]:
flag = False
break
nowt = dicta[i]
snowind = bisect.bisect_... | 26 | 26 | 512 | 514 | from collections import defaultdict
import bisect
s = eval(input())
t = eval(input())
dicta = defaultdict(list)
for a, b in enumerate(s):
dicta[b] += [a]
snow = -1
count = 0
flag = True
for i in t:
if i not in s:
flag = False
break
nowt = dicta[i]
snowind = bisect.bisect_right(nowt, sno... | from collections import defaultdict
import bisect
s = eval(input())
t = eval(input())
dicta = defaultdict(list)
for a, b in enumerate(s):
dicta[b] += [a]
snow = -1
count = 0
flag = True
for i in t:
if not dicta[i]:
flag = False
break
nowt = dicta[i]
snowind = bisect.bisect_right(nowt, s... | false | 0 | [
"- if i not in s:",
"+ if not dicta[i]:"
] | false | 0.039274 | 0.048501 | 0.809768 | [
"s709277590",
"s476835093"
] |
u450180547 | p03160 | python | s039585866 | s449544342 | 141 | 126 | 13,924 | 13,924 | Accepted | Accepted | 10.64 | N = int(eval(input()))
hs = list(map(int, input().split()))
INF = 10 ** 10
dp = [INF] * N
dp[0] = 0
dp[1] = abs(hs[1] - hs[0])
for i in range(1, N):
dp[i] = min(dp[i - 1] + (abs(hs[i] - hs[i - 1])),
dp[i - 2] + (abs(hs[i] - hs[i - 2])))
print((dp[N - 1])) | N = int(eval(input()))
hs = list(map(int, input().split()))
INF = 10 ** 10
dp = [INF] * N
dp[0] = 0
dp[1] = abs(hs[1] - hs[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + (abs(hs[i] - hs[i - 1])),
dp[i - 2] + (abs(hs[i] - hs[i - 2])))
print((dp[N - 1]))
| 14 | 14 | 284 | 285 | N = int(eval(input()))
hs = list(map(int, input().split()))
INF = 10**10
dp = [INF] * N
dp[0] = 0
dp[1] = abs(hs[1] - hs[0])
for i in range(1, N):
dp[i] = min(
dp[i - 1] + (abs(hs[i] - hs[i - 1])), dp[i - 2] + (abs(hs[i] - hs[i - 2]))
)
print((dp[N - 1]))
| N = int(eval(input()))
hs = list(map(int, input().split()))
INF = 10**10
dp = [INF] * N
dp[0] = 0
dp[1] = abs(hs[1] - hs[0])
for i in range(2, N):
dp[i] = min(
dp[i - 1] + (abs(hs[i] - hs[i - 1])), dp[i - 2] + (abs(hs[i] - hs[i - 2]))
)
print((dp[N - 1]))
| false | 0 | [
"-for i in range(1, N):",
"+for i in range(2, N):"
] | false | 0.059879 | 0.040151 | 1.491359 | [
"s039585866",
"s449544342"
] |
u499381410 | p02990 | python | s247338944 | s471389252 | 298 | 231 | 43,864 | 44,272 | Accepted | Accepted | 22.48 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_... | 44 | 65 | 1,262 | 1,739 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bise... | false | 32.307692 | [
"+from pprint import pprint",
"+from copy import deepcopy",
"+from operator import mul",
"+from pprint import pprint",
"-INF = float(\"inf\")",
"+sys.setrecursionlimit(2147483647)",
"+INF = 10**13",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return list(map(int, sys.stdin.buff... | false | 0.039787 | 0.040133 | 0.991365 | [
"s247338944",
"s471389252"
] |
u130860911 | p02838 | python | s323220441 | s648866319 | 1,991 | 313 | 42,156 | 48,824 | Accepted | Accepted | 84.28 | M = 10**9+7
N = int(eval(input()))
A = list(map(int,input().split()))
ans = 0
for k in range(61):
N1 = 0
N1 = sum([1 for a in A if ( (a >> k) & 1)])
ans += (((1<<k)) *(N-N1) *N1)
ans %= M
print(ans) | import numpy as np
M = 10**9+7
N = int(eval(input()))
A = np.array(list(map(int,input().split())),dtype='int64')
ans = 0
maxA = np.amax(A)
K = len(str(bin(maxA)))-2
for k in range(K):
N1 = 0
N1 = np.sum((A >> k) & 1)
N0 = N-N1
ans += (((1<<k)%M) *N0%M) *N1%M
ans %= M
print(ans) | 12 | 17 | 225 | 311 | M = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for k in range(61):
N1 = 0
N1 = sum([1 for a in A if ((a >> k) & 1)])
ans += ((1 << k)) * (N - N1) * N1
ans %= M
print(ans)
| import numpy as np
M = 10**9 + 7
N = int(eval(input()))
A = np.array(list(map(int, input().split())), dtype="int64")
ans = 0
maxA = np.amax(A)
K = len(str(bin(maxA))) - 2
for k in range(K):
N1 = 0
N1 = np.sum((A >> k) & 1)
N0 = N - N1
ans += (((1 << k) % M) * N0 % M) * N1 % M
ans %= M
print(ans)
| false | 29.411765 | [
"+import numpy as np",
"+",
"-A = list(map(int, input().split()))",
"+A = np.array(list(map(int, input().split())), dtype=\"int64\")",
"-for k in range(61):",
"+maxA = np.amax(A)",
"+K = len(str(bin(maxA))) - 2",
"+for k in range(K):",
"- N1 = sum([1 for a in A if ((a >> k) & 1)])",
"- ans +... | false | 0.052223 | 0.173259 | 0.301418 | [
"s323220441",
"s648866319"
] |
u279483260 | p02400 | python | s072070314 | s548653290 | 30 | 20 | 5,624 | 5,620 | Accepted | Accepted | 33.33 | from math import pi
r=float(eval(input()))
print(("{} {}".format(r*r*pi,2*pi*r)))
| from math import pi
r = float(eval(input()))
# 面積
circle_area = r * r * pi
# 円周
circumference = 2.0 * r * pi
print(("{} {}".format(circle_area, circumference)))
| 3 | 10 | 76 | 165 | from math import pi
r = float(eval(input()))
print(("{} {}".format(r * r * pi, 2 * pi * r)))
| from math import pi
r = float(eval(input()))
# 面積
circle_area = r * r * pi
# 円周
circumference = 2.0 * r * pi
print(("{} {}".format(circle_area, circumference)))
| false | 70 | [
"-print((\"{} {}\".format(r * r * pi, 2 * pi * r)))",
"+# 面積",
"+circle_area = r * r * pi",
"+# 円周",
"+circumference = 2.0 * r * pi",
"+print((\"{} {}\".format(circle_area, circumference)))"
] | false | 0.111101 | 0.040982 | 2.710982 | [
"s072070314",
"s548653290"
] |
u644907318 | p03817 | python | s165216795 | s883152383 | 182 | 68 | 38,256 | 61,764 | Accepted | Accepted | 62.64 | x = int(eval(input()))
n = x//11
k = x%11
if k==0:
print((2*n))
elif 0<k<=6:
print((2*n+1))
else:
print((2*n+2)) | x = int(eval(input()))
n = x//11
a = x%11
if a==0:
ans = 2*n
elif 1<=a<=6:
ans = 2*n+1
else:
ans = 2*n+2
print(ans) | 9 | 10 | 120 | 130 | x = int(eval(input()))
n = x // 11
k = x % 11
if k == 0:
print((2 * n))
elif 0 < k <= 6:
print((2 * n + 1))
else:
print((2 * n + 2))
| x = int(eval(input()))
n = x // 11
a = x % 11
if a == 0:
ans = 2 * n
elif 1 <= a <= 6:
ans = 2 * n + 1
else:
ans = 2 * n + 2
print(ans)
| false | 10 | [
"-k = x % 11",
"-if k == 0:",
"- print((2 * n))",
"-elif 0 < k <= 6:",
"- print((2 * n + 1))",
"+a = x % 11",
"+if a == 0:",
"+ ans = 2 * n",
"+elif 1 <= a <= 6:",
"+ ans = 2 * n + 1",
"- print((2 * n + 2))",
"+ ans = 2 * n + 2",
"+print(ans)"
] | false | 0.03895 | 0.041802 | 0.931782 | [
"s165216795",
"s883152383"
] |
u761320129 | p03287 | python | s841532593 | s321930609 | 128 | 89 | 14,920 | 16,556 | Accepted | Accepted | 30.47 | from collections import Counter
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
ctr = Counter()
ctr[0] = 1
cum = 0
for a in A:
cum = (cum + a) % M
ctr[cum] += 1
ans = 0
for v in list(ctr.values()):
ans += v*(v-1)//2
print(ans) | from collections import Counter
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
cums = [0]
for a in A:
cums.append((cums[-1] + a) % M)
ctr = Counter(cums)
ans = 0
for v in list(ctr.values()):
ans += v*(v-1)//2
print(ans) | 16 | 15 | 268 | 258 | from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ctr = Counter()
ctr[0] = 1
cum = 0
for a in A:
cum = (cum + a) % M
ctr[cum] += 1
ans = 0
for v in list(ctr.values()):
ans += v * (v - 1) // 2
print(ans)
| from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
cums = [0]
for a in A:
cums.append((cums[-1] + a) % M)
ctr = Counter(cums)
ans = 0
for v in list(ctr.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 6.25 | [
"-ctr = Counter()",
"-ctr[0] = 1",
"-cum = 0",
"+cums = [0]",
"- cum = (cum + a) % M",
"- ctr[cum] += 1",
"+ cums.append((cums[-1] + a) % M)",
"+ctr = Counter(cums)"
] | false | 0.042758 | 0.202974 | 0.210655 | [
"s841532593",
"s321930609"
] |
u556225812 | p03408 | python | s870594210 | s927486664 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | from collections import Counter
blue = []
red = []
N = int(eval(input()))
for i in range(N):
blue.append(eval(input()))
M = int(eval(input()))
for j in range(M):
red.append(eval(input()))
b = Counter(blue)
r = Counter(red)
print((max([0] + [b[x] - r[x] for x in b])))
| N = int(eval(input()))
dic = {}
for i in range(N):
s = eval(input())
if s not in dic:
dic[s] = 1
else:
dic[s] += 1
M = int(eval(input()))
for i in range(M):
s = eval(input())
if s not in dic:
dic[s] = -1
else:
dic[s] -= 1
lst = list(dic.values())
lst.append(0)
print((max(lst... | 13 | 18 | 265 | 297 | from collections import Counter
blue = []
red = []
N = int(eval(input()))
for i in range(N):
blue.append(eval(input()))
M = int(eval(input()))
for j in range(M):
red.append(eval(input()))
b = Counter(blue)
r = Counter(red)
print((max([0] + [b[x] - r[x] for x in b])))
| N = int(eval(input()))
dic = {}
for i in range(N):
s = eval(input())
if s not in dic:
dic[s] = 1
else:
dic[s] += 1
M = int(eval(input()))
for i in range(M):
s = eval(input())
if s not in dic:
dic[s] = -1
else:
dic[s] -= 1
lst = list(dic.values())
lst.append(0)
pri... | false | 27.777778 | [
"-from collections import Counter",
"-",
"-blue = []",
"-red = []",
"+dic = {}",
"- blue.append(eval(input()))",
"+ s = eval(input())",
"+ if s not in dic:",
"+ dic[s] = 1",
"+ else:",
"+ dic[s] += 1",
"-for j in range(M):",
"- red.append(eval(input()))",
"-b =... | false | 0.040458 | 0.039478 | 1.02484 | [
"s870594210",
"s927486664"
] |
u972658925 | p02843 | python | s981162359 | s631128512 | 236 | 218 | 9,524 | 9,408 | Accepted | Accepted | 7.63 | x = int(eval(input()))
dp = [0]*(x + 105 + 1)
dp[100] = 1
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1
for i in range(100,x-105+6):
for j in range(100,106):
dp[i+j] = max(dp[i] , dp[i+j])
print((dp[x])) | x = int(eval(input()))
dp = [0]*(x + 105 + 1)
dp[100] = 1
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1
for i in range(100,x+1):
for j in range(100,106):
dp[i+j] = max(dp[i] , dp[i+j])
print((dp[x])) | 14 | 14 | 237 | 233 | x = int(eval(input()))
dp = [0] * (x + 105 + 1)
dp[100] = 1
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1
for i in range(100, x - 105 + 6):
for j in range(100, 106):
dp[i + j] = max(dp[i], dp[i + j])
print((dp[x]))
| x = int(eval(input()))
dp = [0] * (x + 105 + 1)
dp[100] = 1
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1
for i in range(100, x + 1):
for j in range(100, 106):
dp[i + j] = max(dp[i], dp[i + j])
print((dp[x]))
| false | 0 | [
"-for i in range(100, x - 105 + 6):",
"+for i in range(100, x + 1):"
] | false | 0.065921 | 0.045847 | 1.437867 | [
"s981162359",
"s631128512"
] |
u489959379 | p03212 | python | s054242404 | s762740447 | 237 | 74 | 3,060 | 2,940 | Accepted | Accepted | 68.78 | from itertools import product
n = int(eval(input()))
res = 0
for pattern in product(["0", "3", "5", "7"], repeat=len(str(n))):
p = int("".join(pattern))
if "0" not in str(p):
if p <= n:
for i in ["3", "5", "7"]:
if i not in str(p):
break
... | n = int(eval(input()))
def dfs(s):
if int(s) > n:
return 0
for i in '753':
if s.count(i) == 0:
res = 0
break
else:
res = 1
for i in '753':
res += dfs(s + i)
return res
print((dfs('0')))
| 15 | 19 | 366 | 277 | from itertools import product
n = int(eval(input()))
res = 0
for pattern in product(["0", "3", "5", "7"], repeat=len(str(n))):
p = int("".join(pattern))
if "0" not in str(p):
if p <= n:
for i in ["3", "5", "7"]:
if i not in str(p):
break
else:... | n = int(eval(input()))
def dfs(s):
if int(s) > n:
return 0
for i in "753":
if s.count(i) == 0:
res = 0
break
else:
res = 1
for i in "753":
res += dfs(s + i)
return res
print((dfs("0")))
| false | 21.052632 | [
"-from itertools import product",
"+n = int(eval(input()))",
"-n = int(eval(input()))",
"-res = 0",
"-for pattern in product([\"0\", \"3\", \"5\", \"7\"], repeat=len(str(n))):",
"- p = int(\"\".join(pattern))",
"- if \"0\" not in str(p):",
"- if p <= n:",
"- for i in [\"3\", ... | false | 0.079698 | 0.044585 | 1.787569 | [
"s054242404",
"s762740447"
] |
u047796752 | p02846 | python | s577094229 | s929176894 | 169 | 72 | 38,384 | 61,948 | Accepted | Accepted | 57.4 | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
a = A1*T1-B1*T1
b = A2*T2-B2*T2
if a<0:
if b<0:
print((0))
elif b==0:
print((0))
elif b>0:
if a<-b:
print((0))
elif a==-b:
... | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
d1 = (A1-B1)*T1
d2 = (A2-B2)*T2
if d1*d2>0:
print((0))
exit()
if d1<0:
d1 *= -1
d2 *= -1
if d1+d2>0:
print((0))
exit()
if d1+d2==0:
print('infinit... | 51 | 28 | 1,046 | 391 | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
a = A1 * T1 - B1 * T1
b = A2 * T2 - B2 * T2
if a < 0:
if b < 0:
print((0))
elif b == 0:
print((0))
elif b > 0:
if a < -b:
print((0))
elif a =... | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
d1 = (A1 - B1) * T1
d2 = (A2 - B2) * T2
if d1 * d2 > 0:
print((0))
exit()
if d1 < 0:
d1 *= -1
d2 *= -1
if d1 + d2 > 0:
print((0))
exit()
if d1 + d2 == 0:
print("infinity... | false | 45.098039 | [
"-a = A1 * T1 - B1 * T1",
"-b = A2 * T2 - B2 * T2",
"-if a < 0:",
"- if b < 0:",
"- print((0))",
"- elif b == 0:",
"- print((0))",
"- elif b > 0:",
"- if a < -b:",
"- print((0))",
"- elif a == -b:",
"- print(\"infinity\")",
"- ... | false | 0.043046 | 0.03632 | 1.185171 | [
"s577094229",
"s929176894"
] |
u222668979 | p02733 | python | s846818730 | s985964121 | 393 | 310 | 76,668 | 76,576 | Accepted | Accepted | 21.12 | from itertools import product
def makelist(BIT):
LIST, tmp = [], s[0]
for si, bi in zip(s[1:], BIT):
if bi == 1:
LIST.append(tmp)
tmp = si
elif bi == 0:
tmp = [t + sij for t, sij in zip(tmp, si)]
else:
LIST.append(tmp)
return LIS... | from itertools import product
def makelist(BIT):
LIST, tmp = [], s[0]
for si, bi in zip(s[1:], BIT):
if bi == 1:
LIST.append(tmp)
tmp = si
elif bi == 0:
tmp = [t + sij for t, sij in zip(tmp, si)]
else:
LIST.append(tmp)
return LIS... | 38 | 38 | 933 | 936 | from itertools import product
def makelist(BIT):
LIST, tmp = [], s[0]
for si, bi in zip(s[1:], BIT):
if bi == 1:
LIST.append(tmp)
tmp = si
elif bi == 0:
tmp = [t + sij for t, sij in zip(tmp, si)]
else:
LIST.append(tmp)
return LIST
def solve... | from itertools import product
def makelist(BIT):
LIST, tmp = [], s[0]
for si, bi in zip(s[1:], BIT):
if bi == 1:
LIST.append(tmp)
tmp = si
elif bi == 0:
tmp = [t + sij for t, sij in zip(tmp, si)]
else:
LIST.append(tmp)
return LIST
def solve... | false | 0 | [
"- CNT, tmp = 0, [li[0] for li in LIST]",
"- if any(num > k for num in tmp):",
"+ COST, cnt = 0, [li[0] for li in LIST]",
"+ if any(num > k for num in cnt):",
"- cal = [t + li[j] for t, li in zip(tmp, LIST)]",
"- if any(num > k for num in cal):",
"- CNT += 1",
"- ... | false | 0.043223 | 0.044136 | 0.979332 | [
"s846818730",
"s985964121"
] |
u924691798 | p02678 | python | s484779665 | s114800271 | 977 | 819 | 114,468 | 39,936 | Accepted | Accepted | 16.17 | # Graph
import heapq
INF = 10**18
def dijkstra(start, G):
done = [False]*(len(G))
dist = [INF]*(len(G))
dist[start] = 0
fr = [0]*N
h = []
heapq.heappush(h, [0, start])
while h:
_, cur = heapq.heappop(h)
if done[cur]: continue
done[cur] = True
f... | from collections import deque
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = deque()
done = [-1]*N
def bfs(fr, now):
done[now] = fr
for to in G[now]:
... | 34 | 25 | 812 | 530 | # Graph
import heapq
INF = 10**18
def dijkstra(start, G):
done = [False] * (len(G))
dist = [INF] * (len(G))
dist[start] = 0
fr = [0] * N
h = []
heapq.heappush(h, [0, start])
while h:
_, cur = heapq.heappop(h)
if done[cur]:
continue
done[cur] = True
... | from collections import deque
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = deque()
done = [-1] * N
def bfs(fr, now):
done[now] = fr
for to in G[now]:
if d... | false | 26.470588 | [
"-# Graph",
"-import heapq",
"-",
"-INF = 10**18",
"-",
"-",
"-def dijkstra(start, G):",
"- done = [False] * (len(G))",
"- dist = [INF] * (len(G))",
"- dist[start] = 0",
"- fr = [0] * N",
"- h = []",
"- heapq.heappush(h, [0, start])",
"- while h:",
"- _, cur =... | false | 0.035649 | 0.038886 | 0.916756 | [
"s484779665",
"s114800271"
] |
u723444827 | p02898 | python | s964324204 | s738757608 | 120 | 104 | 12,000 | 13,568 | Accepted | Accepted | 13.33 | import heapq
N , K = list(map(int,input().split()))
h_list = list(map(int,input().split()))
ans = 0
heap = []
for i in range(N):
heapq.heappush(heap, h_list[i]*(-1))
for i in range(N):
if (heapq.heappop(heap)*(-1) < K):
break
else:
ans += 1
print(ans) | import heapq
def minus(x):
y = int(x)
return y*(-1)
N , K = list(map(int,input().split()))
h_list = list(map(minus,input().split()))
ans = 0
heapq.heapify(h_list)
for i in range(N):
if (heapq.heappop(h_list)*(-1) < K):
break
else:
ans += 1
print(ans) | 19 | 20 | 297 | 301 | import heapq
N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))
ans = 0
heap = []
for i in range(N):
heapq.heappush(heap, h_list[i] * (-1))
for i in range(N):
if heapq.heappop(heap) * (-1) < K:
break
else:
ans += 1
print(ans)
| import heapq
def minus(x):
y = int(x)
return y * (-1)
N, K = list(map(int, input().split()))
h_list = list(map(minus, input().split()))
ans = 0
heapq.heapify(h_list)
for i in range(N):
if heapq.heappop(h_list) * (-1) < K:
break
else:
ans += 1
print(ans)
| false | 5 | [
"+",
"+def minus(x):",
"+ y = int(x)",
"+ return y * (-1)",
"+",
"+",
"-h_list = list(map(int, input().split()))",
"+h_list = list(map(minus, input().split()))",
"-heap = []",
"+heapq.heapify(h_list)",
"- heapq.heappush(heap, h_list[i] * (-1))",
"-for i in range(N):",
"- if heapq... | false | 0.03924 | 0.044784 | 0.876223 | [
"s964324204",
"s738757608"
] |
u072053884 | p02266 | python | s661153221 | s840224075 | 80 | 60 | 8,368 | 8,472 | Accepted | Accepted | 25 | import collections
import sys
S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()
for i, j in enumerate(sys.stdin.readline()):
if j == '\\':
S1.append(i)
elif j == '/':
if S1:
left_edge = S1.pop()
new_puddle = i - left_edge
... | import collections
import sys
S1 = collections.deque()
S2 = collections.deque()
for i, j in enumerate(sys.stdin.readline()):
if j == '\\':
S1.append(i)
elif j == '/':
if S1:
left_edge = S1.pop()
new_puddle = i - left_edge
while S2 and (S2[-1][0]... | 26 | 24 | 568 | 555 | import collections
import sys
S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()
for i, j in enumerate(sys.stdin.readline()):
if j == "\\":
S1.append(i)
elif j == "/":
if S1:
left_edge = S1.pop()
new_puddle = i - left_edge
while S2 and... | import collections
import sys
S1 = collections.deque()
S2 = collections.deque()
for i, j in enumerate(sys.stdin.readline()):
if j == "\\":
S1.append(i)
elif j == "/":
if S1:
left_edge = S1.pop()
new_puddle = i - left_edge
while S2 and (S2[-1][0] > left_edge):... | false | 7.692308 | [
"-S3 = collections.deque()",
"- while S2 and (S2[-1] > left_edge):",
"+ while S2 and (S2[-1][0] > left_edge):",
"+ new_puddle += S2[-1][1]",
"- new_puddle += S3.pop()",
"- S2.append(left_edge)",
"- S3.append(new_puddle)",
"+ ... | false | 0.037376 | 0.036597 | 1.021301 | [
"s661153221",
"s840224075"
] |
u272525952 | p02572 | python | s632738810 | s768764399 | 129 | 110 | 94,136 | 105,224 | Accepted | Accepted | 14.73 | n=int(eval(input()))
l=list(map(int,input().split()))
suml=sum(l)
num=0
for i in range(n-1):
suml-=l[i]
num+=(l[i]*suml)%(10**9+7)
print((num%(10**9+7))) | n=int(eval(input()))
l=list(map(int,input().split()))
suml=sum(l)
num=0
for i in range(n):
num+=l[i]**2
print(((suml**2-num)//2%(10**9+7)))
| 8 | 7 | 160 | 142 | n = int(eval(input()))
l = list(map(int, input().split()))
suml = sum(l)
num = 0
for i in range(n - 1):
suml -= l[i]
num += (l[i] * suml) % (10**9 + 7)
print((num % (10**9 + 7)))
| n = int(eval(input()))
l = list(map(int, input().split()))
suml = sum(l)
num = 0
for i in range(n):
num += l[i] ** 2
print(((suml**2 - num) // 2 % (10**9 + 7)))
| false | 12.5 | [
"-for i in range(n - 1):",
"- suml -= l[i]",
"- num += (l[i] * suml) % (10**9 + 7)",
"-print((num % (10**9 + 7)))",
"+for i in range(n):",
"+ num += l[i] ** 2",
"+print(((suml**2 - num) // 2 % (10**9 + 7)))"
] | false | 0.041322 | 0.041735 | 0.990106 | [
"s632738810",
"s768764399"
] |
u952467214 | p03160 | python | s992648497 | s105517406 | 143 | 132 | 13,928 | 13,708 | Accepted | Accepted | 7.69 | N = int(eval(input()))
h = [int(i) for i in input().split()]
dp=[0 for i in range(N)]
dp[1] = abs(h[1] - h[0])
for i in range(N-2):
dp[i+2]=min(dp[i+1]+ abs(h[i+2]-h[i+1]), dp[i]+ abs(h[i+2]-h[i]))
print((dp[N-1]))
| N = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [0]*N
dp[1] = abs(h[1] - h[0])
for i in range(N-2):
dp[i+2]=min(dp[i+1]+ abs(h[i+2]-h[i+1]), dp[i]+ abs(h[i+2]-h[i]))
print((dp[N-1])) | 9 | 9 | 219 | 204 | N = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [0 for i in range(N)]
dp[1] = abs(h[1] - h[0])
for i in range(N - 2):
dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1]))
| N = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(N - 2):
dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1]))
| false | 0 | [
"-dp = [0 for i in range(N)]",
"+dp = [0] * N"
] | false | 0.039689 | 0.039278 | 1.010468 | [
"s992648497",
"s105517406"
] |
u567380442 | p02393 | python | s301626026 | s872739654 | 40 | 30 | 6,724 | 6,724 | Accepted | Accepted | 25 | list = [int(a) for a in input().split()]
list.sort()
print((*list)) | print((*sorted(map(int, input().split())))) | 3 | 1 | 67 | 41 | list = [int(a) for a in input().split()]
list.sort()
print((*list))
| print((*sorted(map(int, input().split()))))
| false | 66.666667 | [
"-list = [int(a) for a in input().split()]",
"-list.sort()",
"-print((*list))",
"+print((*sorted(map(int, input().split()))))"
] | false | 0.04757 | 0.126683 | 0.375503 | [
"s301626026",
"s872739654"
] |
u620480037 | p03371 | python | s019434257 | s972935471 | 120 | 66 | 3,064 | 65,836 | Accepted | Accepted | 45 | A,B,C,X,Y=list(map(int,input().split()))
ans=10**10
for i in range(max(X,Y)+1):
cnt=0
cnt+=C*2*i
x=X-i
y=Y-i
cnt+=max(0,x*A)
cnt+=max(0,y*B)
if ans>cnt:
ans=cnt
print(ans) | A,B,C,X,Y=list(map(int,input().split()))
ans=10**12
for i in range(max(X,Y)+1):
cnt=0
cnt+=i*C*2
cnt+=max(0,X-i)*A
cnt+=max(0,Y-i)*B
ans=min(ans,cnt)
print(ans) | 13 | 10 | 214 | 184 | A, B, C, X, Y = list(map(int, input().split()))
ans = 10**10
for i in range(max(X, Y) + 1):
cnt = 0
cnt += C * 2 * i
x = X - i
y = Y - i
cnt += max(0, x * A)
cnt += max(0, y * B)
if ans > cnt:
ans = cnt
print(ans)
| A, B, C, X, Y = list(map(int, input().split()))
ans = 10**12
for i in range(max(X, Y) + 1):
cnt = 0
cnt += i * C * 2
cnt += max(0, X - i) * A
cnt += max(0, Y - i) * B
ans = min(ans, cnt)
print(ans)
| false | 23.076923 | [
"-ans = 10**10",
"+ans = 10**12",
"- cnt += C * 2 * i",
"- x = X - i",
"- y = Y - i",
"- cnt += max(0, x * A)",
"- cnt += max(0, y * B)",
"- if ans > cnt:",
"- ans = cnt",
"+ cnt += i * C * 2",
"+ cnt += max(0, X - i) * A",
"+ cnt += max(0, Y - i) * B",
"+ ... | false | 0.055802 | 0.056666 | 0.984749 | [
"s019434257",
"s972935471"
] |
u809108154 | p02787 | python | s936734893 | s951657726 | 515 | 429 | 12,516 | 12,500 | Accepted | Accepted | 16.7 | import numpy as np
h, n = list(map(int, input().split()))
ab = np.array([tuple(map(int, input().split())) for _ in range(n)])
dp = np.zeros(h + 1, dtype="int")
for i in range(1, h+1):
dp[i] = np.min(dp[np.maximum(i - ab[:, 0], 0)] + ab[:, 1])
print((dp[-1])) | import numpy as np
h, n = list(map(int, input().split()))
a = []
b = []
for _ in range(n):
ai, bi = list(map(int, input().split()))
a.append(ai)
b.append(bi)
a = np.array(a)
b = np.array(b)
dp = np.zeros(h+1, dtype=np.int)
for c in range(1, h+1):
dp[c] = np.min(dp[np.maximum(0, c-a)] + b)
print(... | 7 | 15 | 264 | 315 | import numpy as np
h, n = list(map(int, input().split()))
ab = np.array([tuple(map(int, input().split())) for _ in range(n)])
dp = np.zeros(h + 1, dtype="int")
for i in range(1, h + 1):
dp[i] = np.min(dp[np.maximum(i - ab[:, 0], 0)] + ab[:, 1])
print((dp[-1]))
| import numpy as np
h, n = list(map(int, input().split()))
a = []
b = []
for _ in range(n):
ai, bi = list(map(int, input().split()))
a.append(ai)
b.append(bi)
a = np.array(a)
b = np.array(b)
dp = np.zeros(h + 1, dtype=np.int)
for c in range(1, h + 1):
dp[c] = np.min(dp[np.maximum(0, c - a)] + b)
print((... | false | 53.333333 | [
"-ab = np.array([tuple(map(int, input().split())) for _ in range(n)])",
"-dp = np.zeros(h + 1, dtype=\"int\")",
"-for i in range(1, h + 1):",
"- dp[i] = np.min(dp[np.maximum(i - ab[:, 0], 0)] + ab[:, 1])",
"+a = []",
"+b = []",
"+for _ in range(n):",
"+ ai, bi = list(map(int, input().split()))",... | false | 0.339967 | 0.47894 | 0.709833 | [
"s936734893",
"s951657726"
] |
u392319141 | p03088 | python | s549681948 | s430672223 | 593 | 87 | 11,244 | 5,568 | Accepted | Accepted | 85.33 | from functools import lru_cache
import sys
sys.setrecursionlimit(10 ** 7)
N = int(eval(input()))
MOD = 10**9 + 7
def isOk(T):
for i in range(4):
t = list(T)
if i >= 1:
t[i - 1], t[i] = t[i], t[i - 1]
if 'AGC' in ''.join(t):
return False
return True... | from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
MOD = 10**9 + 7
S = ['A', 'G', 'C', 'T']
M = set(['AGC', 'GAC', 'ACG'])
for s in S:
M.add(s + 'AGC')
M.add(s + 'GAC')
M.add(s + 'ACG')
M.add('A' + s + 'GC')
M.add('AG' + s + 'C')
@lru_ca... | 31 | 32 | 605 | 615 | from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
MOD = 10**9 + 7
def isOk(T):
for i in range(4):
t = list(T)
if i >= 1:
t[i - 1], t[i] = t[i], t[i - 1]
if "AGC" in "".join(t):
return False
return True
@lru_cache(m... | from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
MOD = 10**9 + 7
S = ["A", "G", "C", "T"]
M = set(["AGC", "GAC", "ACG"])
for s in S:
M.add(s + "AGC")
M.add(s + "GAC")
M.add(s + "ACG")
M.add("A" + s + "GC")
M.add("AG" + s + "C")
@lru_cache(maxsize=None... | false | 3.125 | [
"-",
"-",
"-def isOk(T):",
"- for i in range(4):",
"- t = list(T)",
"- if i >= 1:",
"- t[i - 1], t[i] = t[i], t[i - 1]",
"- if \"AGC\" in \"\".join(t):",
"- return False",
"- return True",
"+S = [\"A\", \"G\", \"C\", \"T\"]",
"+M = set([\"AGC\",... | false | 0.253089 | 0.055826 | 4.533564 | [
"s549681948",
"s430672223"
] |
u835924161 | p02700 | python | s315007329 | s235247015 | 24 | 21 | 9,168 | 9,172 | Accepted | Accepted | 12.5 | a,b,c,d=list(map(int,input().split()))
while True:
c-=b
if c<=0:
print("Yes")
exit()
a-=d
if a<=0:
print("No")
exit() | a,b,c,d=list(map(int,input().split()))
taka=int((c+b-1)/b)
aoki=int((a+d-1)/d)
if taka<=aoki:
print("Yes")
else:
print("No") | 10 | 8 | 168 | 134 | a, b, c, d = list(map(int, input().split()))
while True:
c -= b
if c <= 0:
print("Yes")
exit()
a -= d
if a <= 0:
print("No")
exit()
| a, b, c, d = list(map(int, input().split()))
taka = int((c + b - 1) / b)
aoki = int((a + d - 1) / d)
if taka <= aoki:
print("Yes")
else:
print("No")
| false | 20 | [
"-while True:",
"- c -= b",
"- if c <= 0:",
"- print(\"Yes\")",
"- exit()",
"- a -= d",
"- if a <= 0:",
"- print(\"No\")",
"- exit()",
"+taka = int((c + b - 1) / b)",
"+aoki = int((a + d - 1) / d)",
"+if taka <= aoki:",
"+ print(\"Yes\")",
"+else:... | false | 0.03767 | 0.036864 | 1.02187 | [
"s315007329",
"s235247015"
] |
u875291233 | p03558 | python | s341813665 | s199587096 | 420 | 276 | 38,272 | 38,508 | Accepted | Accepted | 34.29 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
k = int(eval(input()))
g = [[] for _ in range(k)]
for i in range(k):
g[i].append(((i+1)%k,1))
if i: g[i].append((10*i%k,0))
#print(g)
"""
from collections import deque
q = de... | # coding: utf-8
# Your code here!
"""
01-BFS
辺の重みが0 or 1 のとき、dequeを使ってdijkstraを高速化できる
"""
from collections import deque
def bfs01(g,start):
n = len(g)
res = [float("inf")]*n #startからの最短距離
res[start] = 0
pending = n-1 #未確定の点の個数
q = deque([(0,start)]) #(そこまでの距離、点)
while q and pendin... | 58 | 44 | 1,164 | 1,081 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
k = int(eval(input()))
g = [[] for _ in range(k)]
for i in range(k):
g[i].append(((i + 1) % k, 1))
if i:
g[i].append((10 * i % k, 0))
# print(g)
"""
from collections import deque
q = d... | # coding: utf-8
# Your code here!
"""
01-BFS
辺の重みが0 or 1 のとき、dequeを使ってdijkstraを高速化できる
"""
from collections import deque
def bfs01(g, start):
n = len(g)
res = [float("inf")] * n # startからの最短距離
res[start] = 0
pending = n - 1 # 未確定の点の個数
q = deque([(0, start)]) # (そこまでの距離、点)
while q and pending... | false | 24.137931 | [
"+\"\"\"",
"+01-BFS",
"+辺の重みが0 or 1 のとき、dequeを使ってdijkstraを高速化できる",
"+\"\"\"",
"+from collections import deque",
"+",
"+",
"+def bfs01(g, start):",
"+ n = len(g)",
"+ res = [float(\"inf\")] * n # startからの最短距離",
"+ res[start] = 0",
"+ pending = n - 1 # 未確定の点の個数",
"+ q = deque(... | false | 0.10814 | 0.083338 | 1.297605 | [
"s341813665",
"s199587096"
] |
u573754721 | p03037 | python | s618724454 | s195476146 | 385 | 313 | 27,332 | 3,060 | Accepted | Accepted | 18.7 | n,m=list(map(int,input().split()))
L=[list(map(int,input().split())) for _ in range(m)]
lm=0
rm=float('inf')
for i in range(m):
lm=max(L[i][0],lm)
rm=min(L[i][1],rm)
print((max(0,rm-lm+1))) | n,m=list(map(int,input().split()))
ml,mr=0,float('inf')
for i in range(m):
l,r=list(map(int,input().split()))
ml=max(l,ml)
mr=min(r,mr)
print((max(mr-ml+1,0))) | 9 | 7 | 203 | 169 | n, m = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(m)]
lm = 0
rm = float("inf")
for i in range(m):
lm = max(L[i][0], lm)
rm = min(L[i][1], rm)
print((max(0, rm - lm + 1)))
| n, m = list(map(int, input().split()))
ml, mr = 0, float("inf")
for i in range(m):
l, r = list(map(int, input().split()))
ml = max(l, ml)
mr = min(r, mr)
print((max(mr - ml + 1, 0)))
| false | 22.222222 | [
"-L = [list(map(int, input().split())) for _ in range(m)]",
"-lm = 0",
"-rm = float(\"inf\")",
"+ml, mr = 0, float(\"inf\")",
"- lm = max(L[i][0], lm)",
"- rm = min(L[i][1], rm)",
"-print((max(0, rm - lm + 1)))",
"+ l, r = list(map(int, input().split()))",
"+ ml = max(l, ml)",
"+ mr... | false | 0.041928 | 0.043304 | 0.968221 | [
"s618724454",
"s195476146"
] |
u367130284 | p03474 | python | s481779312 | s283005049 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | a=int(input()[0]);s=eval(input());print(("YNeos"[s.count("-")!=1or s[a]>"-"::2])) | a=int(input()[0]);s=eval(input());print(("YNeos"[s.count("-")!=1or"-"<s[a]::2])) | 1 | 1 | 73 | 72 | a = int(input()[0])
s = eval(input())
print(("YNeos"[s.count("-") != 1 or s[a] > "-" :: 2]))
| a = int(input()[0])
s = eval(input())
print(("YNeos"[s.count("-") != 1 or "-" < s[a] :: 2]))
| false | 0 | [
"-print((\"YNeos\"[s.count(\"-\") != 1 or s[a] > \"-\" :: 2]))",
"+print((\"YNeos\"[s.count(\"-\") != 1 or \"-\" < s[a] :: 2]))"
] | false | 0.043012 | 0.041528 | 1.035735 | [
"s481779312",
"s283005049"
] |
u280552586 | p02754 | python | s405654434 | s179557045 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | n, a, b = list(map(int, input().split()))
answer = n // (a+b) * a + min((n % (a+b)), a)
print(answer)
| n, a, b = list(map(int, input().split()))
ans = (n // (a+b))*a + min(a, (n % (a+b)))
print(ans)
| 4 | 3 | 100 | 92 | n, a, b = list(map(int, input().split()))
answer = n // (a + b) * a + min((n % (a + b)), a)
print(answer)
| n, a, b = list(map(int, input().split()))
ans = (n // (a + b)) * a + min(a, (n % (a + b)))
print(ans)
| false | 25 | [
"-answer = n // (a + b) * a + min((n % (a + b)), a)",
"-print(answer)",
"+ans = (n // (a + b)) * a + min(a, (n % (a + b)))",
"+print(ans)"
] | false | 0.064107 | 0.063676 | 1.006771 | [
"s405654434",
"s179557045"
] |
u325264482 | p03107 | python | s266827566 | s763314479 | 29 | 18 | 3,572 | 3,188 | Accepted | Accepted | 37.93 | import collections
S = eval(input())
N = len(S)
c = collections.Counter(S)
if len(c) == 1:
print((0))
else:
print((c.most_common()[-1][1]*2))
| S = eval(input())
num_0 = S.count('0')
num_1 = S.count('1')
print((min(num_0, num_1)*2))
| 12 | 6 | 155 | 88 | import collections
S = eval(input())
N = len(S)
c = collections.Counter(S)
if len(c) == 1:
print((0))
else:
print((c.most_common()[-1][1] * 2))
| S = eval(input())
num_0 = S.count("0")
num_1 = S.count("1")
print((min(num_0, num_1) * 2))
| false | 50 | [
"-import collections",
"-",
"-N = len(S)",
"-c = collections.Counter(S)",
"-if len(c) == 1:",
"- print((0))",
"-else:",
"- print((c.most_common()[-1][1] * 2))",
"+num_0 = S.count(\"0\")",
"+num_1 = S.count(\"1\")",
"+print((min(num_0, num_1) * 2))"
] | false | 0.033922 | 0.058947 | 0.575477 | [
"s266827566",
"s763314479"
] |
u514390882 | p02861 | python | s734321219 | s184013090 | 461 | 316 | 8,052 | 9,440 | Accepted | Accepted | 31.45 | import itertools
n = int(eval(input()))
xy = []
for i in range(n):
xy.append(list(map(int, input().split())))
per = list(itertools.permutations([i for i in range(n)]))
dist = 0
for i in per:
for j in range(len(i)-1):
xi = xy[i[j]][0]
yi = xy[i[j]][1]
xj = xy[i[j+1]][0]
... | import itertools
N = int(eval(input()))
x = []
y = []
for i in range(N):
xy = list(map(int, input().split()))
x.append(xy[0])
y.append(xy[1])
l = [i for i in range(N)]
ans = 0
cnt = 0
for i in itertools.permutations(l, N):
cnt += 1
for j in range(1, N):
x1 = x[i[j]]
... | 16 | 24 | 423 | 493 | import itertools
n = int(eval(input()))
xy = []
for i in range(n):
xy.append(list(map(int, input().split())))
per = list(itertools.permutations([i for i in range(n)]))
dist = 0
for i in per:
for j in range(len(i) - 1):
xi = xy[i[j]][0]
yi = xy[i[j]][1]
xj = xy[i[j + 1]][0]
yj = ... | import itertools
N = int(eval(input()))
x = []
y = []
for i in range(N):
xy = list(map(int, input().split()))
x.append(xy[0])
y.append(xy[1])
l = [i for i in range(N)]
ans = 0
cnt = 0
for i in itertools.permutations(l, N):
cnt += 1
for j in range(1, N):
x1 = x[i[j]]
x2 = x[i[j - 1]]... | false | 33.333333 | [
"-n = int(eval(input()))",
"-xy = []",
"-for i in range(n):",
"- xy.append(list(map(int, input().split())))",
"-per = list(itertools.permutations([i for i in range(n)]))",
"-dist = 0",
"-for i in per:",
"- for j in range(len(i) - 1):",
"- xi = xy[i[j]][0]",
"- yi = xy[i[j]][1]"... | false | 0.038432 | 0.080029 | 0.480228 | [
"s734321219",
"s184013090"
] |
u588341295 | p03472 | python | s444283239 | s326803177 | 350 | 287 | 12,532 | 11,312 | Accepted | Accepted | 18 | # -*- coding: utf-8 -*-
from bisect import bisect_left
N, H = list(map(int, input().split()))
A, B = [0]*N, [0]*N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
a_max = max(A)
B.sort()
# 一番強い振る刀より弱い投げる刀はいらない
B2 = list(reversed(B[bisect_left(B, a_max):]))
cnt = 0
# 投げるだけで倒せるか
if ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 31 | 40 | 593 | 989 | # -*- coding: utf-8 -*-
from bisect import bisect_left
N, H = list(map(int, input().split()))
A, B = [0] * N, [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
a_max = max(A)
B.sort()
# 一番強い振る刀より弱い投げる刀はいらない
B2 = list(reversed(B[bisect_left(B, a_max) :]))
cnt = 0
# 投げるだけで倒せるか
if H <= sum(B2):
... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 22.5 | [
"-from bisect import bisect_left",
"+import sys",
"-N, H = list(map(int, input().split()))",
"-A, B = [0] * N, [0] * N",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def list2d(a, b, c):",
"+ return [[c] * b for i in range(a)]",
"+",
"+",
"+def list3d(a,... | false | 0.037757 | 0.094608 | 0.399089 | [
"s444283239",
"s326803177"
] |
u677440371 | p03325 | python | s305614142 | s798123899 | 111 | 96 | 4,148 | 4,148 | Accepted | Accepted | 13.51 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in a:
while i % 2 == 0:
i /= 2
count += 1
print(count) | n = int(eval(input()))
a = [int(i) for i in input().split()]
a = sorted(list([x for x in a if (x % 2) == 0]), reverse=True)
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print((int(ans))) | 8 | 10 | 150 | 222 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in a:
while i % 2 == 0:
i /= 2
count += 1
print(count)
| n = int(eval(input()))
a = [int(i) for i in input().split()]
a = sorted(list([x for x in a if (x % 2) == 0]), reverse=True)
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print((int(ans)))
| false | 20 | [
"-a = list(map(int, input().split()))",
"-count = 0",
"+a = [int(i) for i in input().split()]",
"+a = sorted(list([x for x in a if (x % 2) == 0]), reverse=True)",
"+ans = 0",
"- i /= 2",
"- count += 1",
"-print(count)",
"+ i //= 2",
"+ ans += 1",
"+print((int(ans)))"
... | false | 0.034425 | 0.037143 | 0.926844 | [
"s305614142",
"s798123899"
] |
u691018832 | p02720 | python | s375804827 | s831681060 | 417 | 133 | 5,900 | 22,712 | Accepted | Accepted | 68.11 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
k = int(readline())
q = [(i + 1) for i in range(9)]
if k < 10:
print(k)
exit()
cnt = 9
while q:
x = q.pop(0)
y = int(str(x)[-1])
if y != ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import deque
k = int(readline())
q = deque(list(map(str, list(range(1, 10)))))
for i in range(k - 1):
x = q.popleft()
y = int(x[-1])
... | 32 | 19 | 698 | 457 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
k = int(readline())
q = [(i + 1) for i in range(9)]
if k < 10:
print(k)
exit()
cnt = 9
while q:
x = q.pop(0)
y = int(str(x)[-1])
if y != 0:
cnt +=... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import deque
k = int(readline())
q = deque(list(map(str, list(range(1, 10)))))
for i in range(k - 1):
x = q.popleft()
y = int(x[-1])
if y != 0:
... | false | 40.625 | [
"+from collections import deque",
"+",
"-q = [(i + 1) for i in range(9)]",
"-if k < 10:",
"- print(k)",
"- exit()",
"-cnt = 9",
"-while q:",
"- x = q.pop(0)",
"- y = int(str(x)[-1])",
"+q = deque(list(map(str, list(range(1, 10)))))",
"+for i in range(k - 1):",
"+ x = q.popleft... | false | 0.081944 | 0.074069 | 1.106313 | [
"s375804827",
"s831681060"
] |
u071211072 | p02578 | python | s798902199 | s883218108 | 149 | 108 | 32,004 | 32,132 | Accepted | Accepted | 27.52 | try:
k = int(eval(input()))
l = list(map(int,input().split(' ')))
c = 0
for i in range(len(l)-1):
x = l[i+1]-l[i]
if x<0:
l[i+1]+=abs(x)
c+=abs(x)
print(c)
except:
pass
| def sol(lis):
m = lis[0]
ans = []
for i in range(len(lis)):
if lis[i]<m:
ans.append(m-lis[i])
lis[i] = m
elif lis[i]!=m:
m = max(m,lis[i])
print((sum(ans)))
eval(input())
lis = list(map(int,input().split(' ')))
sol(lis)
| 12 | 13 | 226 | 293 | try:
k = int(eval(input()))
l = list(map(int, input().split(" ")))
c = 0
for i in range(len(l) - 1):
x = l[i + 1] - l[i]
if x < 0:
l[i + 1] += abs(x)
c += abs(x)
print(c)
except:
pass
| def sol(lis):
m = lis[0]
ans = []
for i in range(len(lis)):
if lis[i] < m:
ans.append(m - lis[i])
lis[i] = m
elif lis[i] != m:
m = max(m, lis[i])
print((sum(ans)))
eval(input())
lis = list(map(int, input().split(" ")))
sol(lis)
| false | 7.692308 | [
"-try:",
"- k = int(eval(input()))",
"- l = list(map(int, input().split(\" \")))",
"- c = 0",
"- for i in range(len(l) - 1):",
"- x = l[i + 1] - l[i]",
"- if x < 0:",
"- l[i + 1] += abs(x)",
"- c += abs(x)",
"- print(c)",
"-except:",
"- pas... | false | 0.096205 | 0.054042 | 1.7802 | [
"s798902199",
"s883218108"
] |
u017810624 | p03152 | python | s472514094 | s410608787 | 702 | 642 | 3,188 | 3,188 | Accepted | Accepted | 8.55 | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=set(a);B=set(b)
if len(A)!=len(a) or len(B)!=len(b):
print((0))
else:
c=1;cn=0;cm=0
for k in range(m*n,0,-1):
if k in A and k in B:
cn+=1;cm+=1
elif k in A:
c*=cm;cn+=1
elif ... | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=set(a);B=set(b)
if len(A)!=len(a) or len(B)!=len(b):
print((0))
else:
c=1;cn=0;cm=0
for k in range(m*n,0,-1):
if k in A and k in B:
cn+=1;cm+=1
elif k in A:
c*=cm;cn+=1
elif ... | 21 | 19 | 431 | 402 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A = set(a)
B = set(b)
if len(A) != len(a) or len(B) != len(b):
print((0))
else:
c = 1
cn = 0
cm = 0
for k in range(m * n, 0, -1):
if k in A and k in B:
cn += 1
... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A = set(a)
B = set(b)
if len(A) != len(a) or len(B) != len(b):
print((0))
else:
c = 1
cn = 0
cm = 0
for k in range(m * n, 0, -1):
if k in A and k in B:
cn += 1
... | false | 9.52381 | [
"- if c == 0:",
"- break"
] | false | 0.099136 | 0.17449 | 0.568149 | [
"s472514094",
"s410608787"
] |
u263830634 | p04000 | python | s275847960 | s568244583 | 2,448 | 2,165 | 128,036 | 127,988 | Accepted | Accepted | 11.56 | import sys
input = sys.stdin.readline
lst = []
lst_append = lst.append
H, W, N = map(int, input().split())
tmplst = [-1, 0, 1]
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in range(-1, 2):
for j in range(-1, 2):
if 1 <= a + i <= H - 2 and 1 <=... | import sys
input = sys.stdin.readline
lst = []
lst_append = lst.append
H, W, N = map(int, input().split())
tmplst = [-1, 0, 1]
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in tmplst:
if 1 <= a + i <= H - 2:
for j in tmplst:
if... | 34 | 35 | 667 | 676 | import sys
input = sys.stdin.readline
lst = []
lst_append = lst.append
H, W, N = map(int, input().split())
tmplst = [-1, 0, 1]
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in range(-1, 2):
for j in range(-1, 2):
if 1 <= a + i <= H - 2 and 1 <= b + j <= W -... | import sys
input = sys.stdin.readline
lst = []
lst_append = lst.append
H, W, N = map(int, input().split())
tmplst = [-1, 0, 1]
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in tmplst:
if 1 <= a + i <= H - 2:
for j in tmplst:
if 1 <= b + j <=... | false | 2.857143 | [
"- for i in range(-1, 2):",
"- for j in range(-1, 2):",
"- if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:",
"- lst_append((a + i, b + j))",
"+ for i in tmplst:",
"+ if 1 <= a + i <= H - 2:",
"+ for j in tmplst:",
"+ if 1 <= b + j... | false | 0.074639 | 0.043578 | 1.712784 | [
"s275847960",
"s568244583"
] |
u298297089 | p02909 | python | s776483549 | s407949798 | 166 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.76 | s = eval(input())
dic = {'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny' }
print((dic[s])) | s = eval(input())
if s == 'Sunny':
print('Cloudy')
elif s == 'Cloudy':
print('Rainy')
else :
print('Sunny') | 3 | 7 | 88 | 113 | s = eval(input())
dic = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print((dic[s]))
| s = eval(input())
if s == "Sunny":
print("Cloudy")
elif s == "Cloudy":
print("Rainy")
else:
print("Sunny")
| false | 57.142857 | [
"-dic = {\"Sunny\": \"Cloudy\", \"Cloudy\": \"Rainy\", \"Rainy\": \"Sunny\"}",
"-print((dic[s]))",
"+if s == \"Sunny\":",
"+ print(\"Cloudy\")",
"+elif s == \"Cloudy\":",
"+ print(\"Rainy\")",
"+else:",
"+ print(\"Sunny\")"
] | false | 0.044916 | 0.045678 | 0.983315 | [
"s776483549",
"s407949798"
] |
u562935282 | p02603 | python | s796274320 | s136090050 | 34 | 29 | 9,160 | 9,180 | Accepted | Accepted | 14.71 | def main():
N = int(eval(input()))
*A, = list(map(int, input().split()))
money = 1000
low = A[0]
high = -1
for x in A:
if high < x:
high = x
continue
if high > x:
money += (high - low) * (money // low)
low = high =... | def main():
N = int(eval(input()))
*A, = list(map(int, input().split()))
money = 1000
low = A[0]
p = A[0]
for x in A:
if p > x:
money += (p - low) * (money // low)
low = x
p = x
money += max(0, p - low) * (money // low)
print(mo... | 24 | 21 | 427 | 357 | def main():
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
money = 1000
low = A[0]
high = -1
for x in A:
if high < x:
high = x
continue
if high > x:
money += (high - low) * (money // low)
low = high = x
money += ... | def main():
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
money = 1000
low = A[0]
p = A[0]
for x in A:
if p > x:
money += (p - low) * (money // low)
low = x
p = x
money += max(0, p - low) * (money // low)
print(money)
if __name__... | false | 12.5 | [
"- high = -1",
"+ p = A[0]",
"- if high < x:",
"- high = x",
"- continue",
"- if high > x:",
"- money += (high - low) * (money // low)",
"- low = high = x",
"- money += max(0, high - low) * (money // low)",
"+ if p > x:",
... | false | 0.045682 | 0.043137 | 1.059016 | [
"s796274320",
"s136090050"
] |
u761320129 | p03476 | python | s675194173 | s649165499 | 457 | 417 | 21,012 | 25,840 | Accepted | Accepted | 8.75 | Q = int(eval(input()))
qs = [tuple(map(int,input().split())) for i in range(Q)]
MAXN = 10**5+10
sieve = [0,0] + [1]*MAXN
p = 2
while p*p <= MAXN:
if sieve[p]:
for q in range(2*p,MAXN+1,p):
sieve[q] = 0
p += 1
cums = [0]
for i in range(1,MAXN):
valid = sieve[i] and sieve[(... | Q = int(input())
LR = [tuple(map(int,input().split())) for i in range(Q)]
MAXN = 10**5+10
sieve = [0,0] + [1]*MAXN
p = 2
while p*p <= MAXN:
if sieve[p]:
for q in range(2*p,MAXN+1,p):
sieve[q] = 0
p += 1
likes = [0] * MAXN
for i in range(3,MAXN,2):
if sieve[i] and sieve[(i... | 20 | 24 | 427 | 489 | Q = int(eval(input()))
qs = [tuple(map(int, input().split())) for i in range(Q)]
MAXN = 10**5 + 10
sieve = [0, 0] + [1] * MAXN
p = 2
while p * p <= MAXN:
if sieve[p]:
for q in range(2 * p, MAXN + 1, p):
sieve[q] = 0
p += 1
cums = [0]
for i in range(1, MAXN):
valid = sieve[i] and sieve[(i... | Q = int(input())
LR = [tuple(map(int, input().split())) for i in range(Q)]
MAXN = 10**5 + 10
sieve = [0, 0] + [1] * MAXN
p = 2
while p * p <= MAXN:
if sieve[p]:
for q in range(2 * p, MAXN + 1, p):
sieve[q] = 0
p += 1
likes = [0] * MAXN
for i in range(3, MAXN, 2):
if sieve[i] and sieve[(i... | false | 16.666667 | [
"-Q = int(eval(input()))",
"-qs = [tuple(map(int, input().split())) for i in range(Q)]",
"+Q = int(input())",
"+LR = [tuple(map(int, input().split())) for i in range(Q)]",
"-cums = [0]",
"-for i in range(1, MAXN):",
"- valid = sieve[i] and sieve[(i + 1) // 2]",
"- cums.append(cums[-1] + int(vali... | false | 0.142317 | 0.109668 | 1.297711 | [
"s675194173",
"s649165499"
] |
u905203728 | p02609 | python | s184141437 | s110951518 | 345 | 303 | 87,888 | 81,860 | Accepted | Accepted | 12.17 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def popcnt(n):
return bin(n).count("1")
def mod(n, cnt):
if n == 0:
return cnt
n = n % popcnt(n)
cnt += 1
return mod(n, cnt)
n = int(readline())
x2 = l... | def popcount(x):
return bin(x).count("1")
n=int(eval(input()))
x=eval(input())
num=int(x,2)
cnt=popcount(num)
mod1=num%(cnt+1)
mod2=num%(cnt-1) if cnt-1!=0 else 0
for i in range(n):
if x[i]=="0":
ans=(mod1+pow(2,n-i-1,cnt+1))%(cnt+1)
else:
if cnt-1==0:
print(... | 36 | 26 | 745 | 496 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def popcnt(n):
return bin(n).count("1")
def mod(n, cnt):
if n == 0:
return cnt
n = n % popcnt(n)
cnt += 1
return mod(n, cnt)
n = int(readline())
x2 = list(readline().dec... | def popcount(x):
return bin(x).count("1")
n = int(eval(input()))
x = eval(input())
num = int(x, 2)
cnt = popcount(num)
mod1 = num % (cnt + 1)
mod2 = num % (cnt - 1) if cnt - 1 != 0 else 0
for i in range(n):
if x[i] == "0":
ans = (mod1 + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)
else:
if cnt ... | false | 27.777778 | [
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"+def popcount(x):",
"+ return bin(x).count(\"1\")",
"-def popcnt(n):",
"- return bin(n).count(\"1\")",
"-",
"-",
"-def mod(n, cnt):",
"- if n == ... | false | 0.045725 | 0.046142 | 0.99096 | [
"s184141437",
"s110951518"
] |
u540761833 | p03854 | python | s322935156 | s457661534 | 361 | 19 | 3,440 | 3,188 | Accepted | Accepted | 94.74 | S = eval(input())
sr = ''
for i in S:
sr = i + sr
lista = ['remaerd','resare','esare','maerd']
c = 0
while c == 0:
c = 1
for i in lista:
if sr[0:len(i)] == i:
sr = sr[len(i):]
c = 0
if sr == '':
print('YES')
else:
print('NO')
| s = eval(input())
s = s[-1::-1]
word = ['resare','esare','remaerd','maerd',]
for i in word:
s = s.replace(i,'')
if s:
print('NO')
else:
print('YES') | 18 | 9 | 299 | 162 | S = eval(input())
sr = ""
for i in S:
sr = i + sr
lista = ["remaerd", "resare", "esare", "maerd"]
c = 0
while c == 0:
c = 1
for i in lista:
if sr[0 : len(i)] == i:
sr = sr[len(i) :]
c = 0
if sr == "":
print("YES")
else:
print("NO")
| s = eval(input())
s = s[-1::-1]
word = [
"resare",
"esare",
"remaerd",
"maerd",
]
for i in word:
s = s.replace(i, "")
if s:
print("NO")
else:
print("YES")
| false | 50 | [
"-S = eval(input())",
"-sr = \"\"",
"-for i in S:",
"- sr = i + sr",
"-lista = [\"remaerd\", \"resare\", \"esare\", \"maerd\"]",
"-c = 0",
"-while c == 0:",
"- c = 1",
"- for i in lista:",
"- if sr[0 : len(i)] == i:",
"- sr = sr[len(i) :]",
"- c = 0",
"-... | false | 0.125994 | 0.033241 | 3.790333 | [
"s322935156",
"s457661534"
] |
u968166680 | p02973 | python | s900840516 | s685579840 | 160 | 126 | 8,844 | 11,764 | Accepted | Accepted | 21.25 | from sys import stdin, setrecursionlimit
from bisect import bisect_left
from collections import deque
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = tuple(int(eval(input())) for _ in range(N))
B =deque([A[0... | from sys import stdin, setrecursionlimit
from bisect import bisect_right
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = tuple(int(eval(input())) for _ in range(N))
B = [-A[0]]
for a in A[1:]:
... | 28 | 27 | 509 | 472 | from sys import stdin, setrecursionlimit
from bisect import bisect_left
from collections import deque
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = tuple(int(eval(input())) for _ in range(N))
B = deque([A[0]])
for a in... | from sys import stdin, setrecursionlimit
from bisect import bisect_right
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = tuple(int(eval(input())) for _ in range(N))
B = [-A[0]]
for a in A[1:]:
if a <= -B[-1]:
... | false | 3.571429 | [
"-from bisect import bisect_left",
"-from collections import deque",
"+from bisect import bisect_right",
"- B = deque([A[0]])",
"+ B = [-A[0]]",
"- if a <= B[0]:",
"- B.appendleft(a)",
"+ if a <= -B[-1]:",
"+ B.append(-a)",
"- B[bisect_left(B, a... | false | 0.046251 | 0.131975 | 0.350456 | [
"s900840516",
"s685579840"
] |
u672898046 | p03060 | python | s209562161 | s536587016 | 150 | 17 | 12,488 | 3,060 | Accepted | Accepted | 88.67 | import numpy as np
n = int(eval(input()))
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
ans = 0
for i,j in zip(v,c):
if i-j>=0:
ans+=(i-j)
print(ans) | n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i,j in zip(v,c):
if i-j>=0:
ans+=(i-j)
print(ans) | 9 | 8 | 203 | 163 | import numpy as np
n = int(eval(input()))
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
ans = 0
for i, j in zip(v, c):
if i - j >= 0:
ans += i - j
print(ans)
| n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i, j in zip(v, c):
if i - j >= 0:
ans += i - j
print(ans)
| false | 11.111111 | [
"-import numpy as np",
"-",
"-v = np.array(list(map(int, input().split())))",
"-c = np.array(list(map(int, input().split())))",
"+v = list(map(int, input().split()))",
"+c = list(map(int, input().split()))"
] | false | 0.44796 | 0.075018 | 5.971337 | [
"s209562161",
"s536587016"
] |
u647766105 | p02363 | python | s188545422 | s265328726 | 1,350 | 700 | 8,260 | 8,496 | Accepted | Accepted | 48.15 | def warshall_floyd(graph, edges):
N = len(graph)
inf = Infinity() # !_!
for i in range(N):
for j in range(N):
if i == j:
graph[i][j] = 0
else:
graph[i][j] = inf
for e in edges:
graph[e.source][e.destination] = e.weight
... | def warshall_floyd(graph, edges):
N = len(graph)
for i in range(N):
for j in range(N):
if i == j:
graph[i][j] = 0
else:
graph[i][j] = Infinity()
for e in edges:
graph[e.source][e.destination] = e.weight
for k in range(N):
... | 68 | 63 | 1,831 | 1,602 | def warshall_floyd(graph, edges):
N = len(graph)
inf = Infinity() # !_!
for i in range(N):
for j in range(N):
if i == j:
graph[i][j] = 0
else:
graph[i][j] = inf
for e in edges:
graph[e.source][e.destination] = e.weight
for k in... | def warshall_floyd(graph, edges):
N = len(graph)
for i in range(N):
for j in range(N):
if i == j:
graph[i][j] = 0
else:
graph[i][j] = Infinity()
for e in edges:
graph[e.source][e.destination] = e.weight
for k in range(N):
fo... | false | 7.352941 | [
"- inf = Infinity() # !_!",
"- graph[i][j] = inf",
"+ graph[i][j] = Infinity()",
"- for k in range(N):",
"- for i in range(N):",
"- for j in range(N):",
"- if inf in (graph[i][j], graph[i][k], graph[k][j]): # !_!",
"- ... | false | 0.043564 | 0.043516 | 1.001107 | [
"s188545422",
"s265328726"
] |
u561083515 | p02803 | python | s489990973 | s202462925 | 342 | 298 | 22,424 | 3,444 | Accepted | Accepted | 12.87 | H,W = list(map(int,input().split()))
S = [[True]*(W+2)]
S += [[True] + [x == '#' for x in input().rstrip()] + [True] for _ in range(H)]
S.append([True]*(W+2))
dx = [0,0,1,-1]
dy = [1,-1,0,0]
edge = []
for i in range(1,H+1):
for j in range(1,W+1):
if S[i][j]:
continue
for... | H,W = list(map(int, input().split()))
S = [["#"] * (W + 2)]
S += [["#"] + list(eval(input())) + ["#"] for _ in range(H)]
S.append(["#"] * (W + 2))
DX = [0,0,-1,1]
DY = [-1,1,0,0]
from collections import deque
def bfs(y,x):
dist = [[-1] * (W + 2) for _ in range(H + 2)]
que = deque([(y, x)])... | 37 | 38 | 900 | 918 | H, W = list(map(int, input().split()))
S = [[True] * (W + 2)]
S += [[True] + [x == "#" for x in input().rstrip()] + [True] for _ in range(H)]
S.append([True] * (W + 2))
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
edge = []
for i in range(1, H + 1):
for j in range(1, W + 1):
if S[i][j]:
continue
... | H, W = list(map(int, input().split()))
S = [["#"] * (W + 2)]
S += [["#"] + list(eval(input())) + ["#"] for _ in range(H)]
S.append(["#"] * (W + 2))
DX = [0, 0, -1, 1]
DY = [-1, 1, 0, 0]
from collections import deque
def bfs(y, x):
dist = [[-1] * (W + 2) for _ in range(H + 2)]
que = deque([(y, x)])
dist[y]... | false | 2.631579 | [
"-S = [[True] * (W + 2)]",
"-S += [[True] + [x == \"#\" for x in input().rstrip()] + [True] for _ in range(H)]",
"-S.append([True] * (W + 2))",
"-dx = [0, 0, 1, -1]",
"-dy = [1, -1, 0, 0]",
"-edge = []",
"+S = [[\"#\"] * (W + 2)]",
"+S += [[\"#\"] + list(eval(input())) + [\"#\"] for _ in range(H)]",
... | false | 0.362705 | 0.045048 | 8.051547 | [
"s489990973",
"s202462925"
] |
u941047297 | p03425 | python | s390807506 | s365403380 | 155 | 135 | 4,224 | 9,472 | Accepted | Accepted | 12.9 | from collections import Counter
from itertools import combinations
n = int(eval(input()))
S = [input()[0] for _ in range(n)]
C = Counter(S)
ans = 0
for i, j, k in combinations(['M', 'A', 'R', 'C', 'H'], 3):
ans += C[i] * C[j] * C[k]
print(ans)
| from collections import defaultdict
from itertools import combinations
def main():
n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
s = eval(input())
d[s[0]] += 1
ans = 0
for i, j, k in combinations('MARCH', 3):
ans += d[i] * d[j] * d[k]
print(ans... | 9 | 15 | 250 | 352 | from collections import Counter
from itertools import combinations
n = int(eval(input()))
S = [input()[0] for _ in range(n)]
C = Counter(S)
ans = 0
for i, j, k in combinations(["M", "A", "R", "C", "H"], 3):
ans += C[i] * C[j] * C[k]
print(ans)
| from collections import defaultdict
from itertools import combinations
def main():
n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
s = eval(input())
d[s[0]] += 1
ans = 0
for i, j, k in combinations("MARCH", 3):
ans += d[i] * d[j] * d[k]
print(ans)
if __... | false | 40 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-n = int(eval(input()))",
"-S = [input()[0] for _ in range(n)]",
"-C = Counter(S)",
"-ans = 0",
"-for i, j, k in combinations([\"M\", \"A\", \"R\", \"C\", \"H\"], 3):",
"- ans += C[i] * C[j] * C[k]",
"-print(ans)",
"+"... | false | 0.04511 | 0.044542 | 1.012758 | [
"s390807506",
"s365403380"
] |
u426534722 | p02243 | python | s480015958 | s004827551 | 910 | 440 | 49,928 | 40,508 | Accepted | Accepted | 51.65 | import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
n = int(eval(input()))
G = [[i, INF] for i in range(n)]
G[0][1] = 0
m = {}
for _ in range(n):
A = list(map(int, readline().split()))
m[A[0]] = {}
f... | import heapq
import sys
readline = sys.stdin.readline
def dijkstra(n):
inf = 10 ** 6 + 1
dist = [0] + [inf] * (n - 1)
q = [(0, 0)]
while q:
u = heapq.heappop(q)[1]
for (v, c) in edge[u]:
alt = dist[u] + c
if dist[v] > alt:
dist[v] = alt... | 24 | 22 | 669 | 589 | import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
n = int(eval(input()))
G = [[i, INF] for i in range(n)]
G[0][1] = 0
m = {}
for _ in range(n):
A = list(map(int, readline().split()))
m[A[0]] = {}
for i in ... | import heapq
import sys
readline = sys.stdin.readline
def dijkstra(n):
inf = 10**6 + 1
dist = [0] + [inf] * (n - 1)
q = [(0, 0)]
while q:
u = heapq.heappop(q)[1]
for (v, c) in edge[u]:
alt = dist[u] + c
if dist[v] > alt:
dist[v] = alt
... | false | 8.333333 | [
"+import heapq",
"-from heapq import heapify, heappush, heappop",
"-",
"-INF = float(\"inf\")",
"-def MAIN():",
"- n = int(eval(input()))",
"- G = [[i, INF] for i in range(n)]",
"- G[0][1] = 0",
"- m = {}",
"- for _ in range(n):",
"- A = list(map(int, readline().split()))",... | false | 0.035825 | 0.047152 | 0.75976 | [
"s480015958",
"s004827551"
] |
u633255271 | p02684 | python | s435031175 | s748687279 | 159 | 147 | 32,376 | 32,336 | Accepted | Accepted | 7.55 | N, K = list(map(int, input().split()))
A = list([int(x) - 1 for x in input().split()])
now = 0
seen = []
while True:
seen.append(now)
teleporter = A[now]
A[now] = 'used'
if teleporter == 'used':
break
else:
now = teleporter
loop_s = seen.index(seen[-1])
size = len(... | N, K = list(map(int, input().split()))
A = list([int(x) - 1 for x in input().split()])
now = 0
seen = []
while True:
seen.append(now)
teleporter = A[now]
A[now] = 'used'
if teleporter == 'used':
break
else:
now = teleporter
loop_s = seen.index(now)
size = len(seen)... | 21 | 21 | 443 | 438 | N, K = list(map(int, input().split()))
A = list([int(x) - 1 for x in input().split()])
now = 0
seen = []
while True:
seen.append(now)
teleporter = A[now]
A[now] = "used"
if teleporter == "used":
break
else:
now = teleporter
loop_s = seen.index(seen[-1])
size = len(seen) - loop_s - 1
... | N, K = list(map(int, input().split()))
A = list([int(x) - 1 for x in input().split()])
now = 0
seen = []
while True:
seen.append(now)
teleporter = A[now]
A[now] = "used"
if teleporter == "used":
break
else:
now = teleporter
loop_s = seen.index(now)
size = len(seen) - loop_s - 1
if K ... | false | 0 | [
"-loop_s = seen.index(seen[-1])",
"+loop_s = seen.index(now)"
] | false | 0.043248 | 0.099753 | 0.433549 | [
"s435031175",
"s748687279"
] |
u796942881 | p03252 | python | s212425844 | s747427960 | 129 | 114 | 3,632 | 3,632 | Accepted | Accepted | 11.63 | from sys import stdin
def main():
S = stdin.readline().strip()
T = stdin.readline().strip()
lst = [""] * (ord("z") - ord("a") + 1)
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if lst[ord(s) - ord("a")] and lst[ord(s) - ord("a")] != t:
flg = Fal... | def main():
S = eval(input())
T = eval(input())
lst = [""] * (ord("z") - ord("a") + 1)
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if lst[ord(s) - ord("a")] and lst[ord(s) - ord("a")] != t:
flg = False
break
lst[ord(s) - ord("... | 23 | 20 | 550 | 489 | from sys import stdin
def main():
S = stdin.readline().strip()
T = stdin.readline().strip()
lst = [""] * (ord("z") - ord("a") + 1)
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if lst[ord(s) - ord("a")] and lst[ord(s) - ord("a")] != t:
flg = False
... | def main():
S = eval(input())
T = eval(input())
lst = [""] * (ord("z") - ord("a") + 1)
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if lst[ord(s) - ord("a")] and lst[ord(s) - ord("a")] != t:
flg = False
break
lst[ord(s) - ord("a")] = t
... | false | 13.043478 | [
"-from sys import stdin",
"-",
"-",
"- S = stdin.readline().strip()",
"- T = stdin.readline().strip()",
"+ S = eval(input())",
"+ T = eval(input())"
] | false | 0.057991 | 0.035315 | 1.642082 | [
"s212425844",
"s747427960"
] |
u688587139 | p02725 | python | s091397614 | s569941307 | 162 | 119 | 26,436 | 26,444 | Accepted | Accepted | 26.54 | K, N = list(map(int, input().split()))
loc = list(map(int, input().split()))
distances = []
total = []
for i in range(N-1):
distances.append(loc[i+1] - loc[i])
distances.append(loc[0] + K - loc[N-1])
for i in range(N):
total.append(K - distances[i])
print((min(total)))
| K, N = list(map(int, input().split()))
loc = list(map(int, input().split()))
distances = []
total = []
for i in range(N-1):
distances.append(loc[i+1] - loc[i])
distances.append(loc[0] + K - loc[N-1])
max_dis = max(distances)
print((K - max_dis))
| 14 | 12 | 287 | 256 | K, N = list(map(int, input().split()))
loc = list(map(int, input().split()))
distances = []
total = []
for i in range(N - 1):
distances.append(loc[i + 1] - loc[i])
distances.append(loc[0] + K - loc[N - 1])
for i in range(N):
total.append(K - distances[i])
print((min(total)))
| K, N = list(map(int, input().split()))
loc = list(map(int, input().split()))
distances = []
total = []
for i in range(N - 1):
distances.append(loc[i + 1] - loc[i])
distances.append(loc[0] + K - loc[N - 1])
max_dis = max(distances)
print((K - max_dis))
| false | 14.285714 | [
"-for i in range(N):",
"- total.append(K - distances[i])",
"-print((min(total)))",
"+max_dis = max(distances)",
"+print((K - max_dis))"
] | false | 0.063836 | 0.082115 | 0.777398 | [
"s091397614",
"s569941307"
] |
u681444474 | p03311 | python | s946892933 | s374046835 | 254 | 140 | 32,312 | 107,844 | Accepted | Accepted | 44.88 | # coding: utf-8
import math
n = int(eval(input()))
#x, y = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
B= []
for i in range(n):
B.append(A[i]-(i+1))
B.sort()
if n==1:
m=B[0]
m2=B[0]
else:
m = B[n//2]
m2=B[n//2+1]
tmp1=0
tmp2=0
#print(m,m2)
for i in range(n... | # coding: utf-8
n = int(eval(input()))
A = list(map(int,input().split()))
L=[]
for i in range(n):
L.append(A[i]-(i+1))
L.sort()
#print(L)
if n==1:
b1=L[0]
b2=L[0]
elif n==2:
b1=L[0]
b2=L[1]
else:
b1=L[n//2]
b2=L[n//2-1]
ans=0
cnt1=0
cnt2=0
for i in range(n):
cnt1+=ab... | 23 | 24 | 403 | 371 | # coding: utf-8
import math
n = int(eval(input()))
# x, y = map(int,input().split())
A = list(map(int, input().split()))
ans = 0
B = []
for i in range(n):
B.append(A[i] - (i + 1))
B.sort()
if n == 1:
m = B[0]
m2 = B[0]
else:
m = B[n // 2]
m2 = B[n // 2 + 1]
tmp1 = 0
tmp2 = 0
# print(m,m2)
for i in ... | # coding: utf-8
n = int(eval(input()))
A = list(map(int, input().split()))
L = []
for i in range(n):
L.append(A[i] - (i + 1))
L.sort()
# print(L)
if n == 1:
b1 = L[0]
b2 = L[0]
elif n == 2:
b1 = L[0]
b2 = L[1]
else:
b1 = L[n // 2]
b2 = L[n // 2 - 1]
ans = 0
cnt1 = 0
cnt2 = 0
for i in range(n... | false | 4.166667 | [
"-import math",
"-",
"-# x, y = map(int,input().split())",
"+L = []",
"+for i in range(n):",
"+ L.append(A[i] - (i + 1))",
"+L.sort()",
"+# print(L)",
"+if n == 1:",
"+ b1 = L[0]",
"+ b2 = L[0]",
"+elif n == 2:",
"+ b1 = L[0]",
"+ b2 = L[1]",
"+else:",
"+ b1 = L[n // ... | false | 0.03752 | 0.055051 | 0.681549 | [
"s946892933",
"s374046835"
] |
u995102075 | p02936 | python | s144133149 | s195223437 | 1,865 | 1,234 | 100,976 | 66,528 | Accepted | Accepted | 33.83 | N, Q = list(map(int, input().split()))
tree = {}
for i in range(1, N + 1):
tree[i] = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
tree[a] += [b]
count = [0] * (N + 1)
for i in range(Q):
p, x = list(map(int, input().split()))
count[p] += x
stack = [1]
while stack... | import sys
def input():
return sys.stdin.readline()[:-1]
N, Q = list(map(int, input().split()))
tree = {}
for i in range(1, N + 1):
tree[i] = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
tree[a] += [b]
count = [0] * (N + 1)
for i in range(Q):
p, x = list(m... | 23 | 31 | 494 | 577 | N, Q = list(map(int, input().split()))
tree = {}
for i in range(1, N + 1):
tree[i] = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
tree[a] += [b]
count = [0] * (N + 1)
for i in range(Q):
p, x = list(map(int, input().split()))
count[p] += x
stack = [1]
while stack:
label = stac... | import sys
def input():
return sys.stdin.readline()[:-1]
N, Q = list(map(int, input().split()))
tree = {}
for i in range(1, N + 1):
tree[i] = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
tree[a] += [b]
count = [0] * (N + 1)
for i in range(Q):
p, x = list(map(int, input().spli... | false | 25.806452 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"-print((*count[1:]))",
"+ans = count[1:]",
"+print((*ans))"
] | false | 0.045439 | 0.144082 | 0.315367 | [
"s144133149",
"s195223437"
] |
u591589288 | p02861 | python | s741449154 | s313292744 | 268 | 219 | 43,612 | 41,580 | Accepted | Accepted | 18.28 | #!/usr/bin/env python
import sys
from math import sqrt
def _s(): return sys.stdin.readline().strip()
def _i(): return int(sys.stdin.readline().strip())
def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]
def g(a):
if len(a)==1:
yield a
else:
for i in range(... | #!/usr/bin/env python
import sys
from math import sqrt, factorial
from itertools import permutations
def _i(): return int(sys.stdin.readline().strip())
def _ia(): return [int(x) for x in sys.stdin.readline().strip().split()]
n = _i()
xy = [_ia() for _ in range(n)]
tot = 0
for s in permutations([i for i... | 35 | 24 | 717 | 552 | #!/usr/bin/env python
import sys
from math import sqrt
def _s():
return sys.stdin.readline().strip()
def _i():
return int(sys.stdin.readline().strip())
def _ia():
return [int(x) for x in sys.stdin.readline().strip().split()]
def g(a):
if len(a) == 1:
yield a
else:
for i in ra... | #!/usr/bin/env python
import sys
from math import sqrt, factorial
from itertools import permutations
def _i():
return int(sys.stdin.readline().strip())
def _ia():
return [int(x) for x in sys.stdin.readline().strip().split()]
n = _i()
xy = [_ia() for _ in range(n)]
tot = 0
for s in permutations([i for i in... | false | 31.428571 | [
"-from math import sqrt",
"-",
"-",
"-def _s():",
"- return sys.stdin.readline().strip()",
"+from math import sqrt, factorial",
"+from itertools import permutations",
"-def g(a):",
"- if len(a) == 1:",
"- yield a",
"- else:",
"- for i in range(len(a)):",
"- ... | false | 0.077538 | 0.1136 | 0.682555 | [
"s741449154",
"s313292744"
] |
u802963389 | p03244 | python | s127800585 | s269692414 | 119 | 74 | 23,776 | 23,004 | Accepted | Accepted | 37.82 | from collections import Counter
n = int(eval(input()))
s = list(map(int, input().split()))
evenL = []
oddL = []
for i, v in enumerate(s):
if i % 2 == 0:
evenL.append(v)
else:
oddL.append(v)
evenLc = Counter(evenL)
oddLc = Counter(oddL)
evenLcs = sorted(list(evenLc.items()), key=lambda x:... | from collections import Counter as C
n = int(eval(input()))
V = list(input().split())
V1 = C(V[::2]).most_common()
V2 = C(V[1::2]).most_common()
if V1[0][0] != V2[0][0]:
ans = n - (V1[0][1] + V2[0][1])
else:
l = V1[0][1] + V2[1][1] if len(V2) > 1 else V1[0][1]
r = V1[1][1] + V2[0][1] if len(V1) > 1 e... | 29 | 17 | 776 | 396 | from collections import Counter
n = int(eval(input()))
s = list(map(int, input().split()))
evenL = []
oddL = []
for i, v in enumerate(s):
if i % 2 == 0:
evenL.append(v)
else:
oddL.append(v)
evenLc = Counter(evenL)
oddLc = Counter(oddL)
evenLcs = sorted(list(evenLc.items()), key=lambda x: -x[1])... | from collections import Counter as C
n = int(eval(input()))
V = list(input().split())
V1 = C(V[::2]).most_common()
V2 = C(V[1::2]).most_common()
if V1[0][0] != V2[0][0]:
ans = n - (V1[0][1] + V2[0][1])
else:
l = V1[0][1] + V2[1][1] if len(V2) > 1 else V1[0][1]
r = V1[1][1] + V2[0][1] if len(V1) > 1 else V2... | false | 41.37931 | [
"-from collections import Counter",
"+from collections import Counter as C",
"-s = list(map(int, input().split()))",
"-evenL = []",
"-oddL = []",
"-for i, v in enumerate(s):",
"- if i % 2 == 0:",
"- evenL.append(v)",
"+V = list(input().split())",
"+V1 = C(V[::2]).most_common()",
"+V2 =... | false | 0.03765 | 0.038573 | 0.976054 | [
"s127800585",
"s269692414"
] |
u375616706 | p02703 | python | s164421145 | s059267684 | 1,183 | 550 | 175,132 | 135,644 | Accepted | Accepted | 53.51 | from collections import defaultdict
import heapq
N,M,S = list(map(int,input().split()))
Edges=[list(map(int,input().split())) for _ in range(M)]
Exchanges=[list(map(int,input().split())) for _ in range(N)]
max_money=max([a for _,_,a,_ in Edges])*N
Graph=defaultdict(lambda :[])
#nodeと状態は tupleで管理する。(node,... | from collections import defaultdict
import heapq
class Dijkstra:
"""
dijkstraの最短経路問題を解く
input:
S: start node
adj: adj[a]=[(b,dist)]//なんとなく
"""
def __init__(self, start, num_node, adj):
"""
adj: adj[a]=[(b,dist)]
num_node: num of nodes
... | 66 | 119 | 1,740 | 2,986 | from collections import defaultdict
import heapq
N, M, S = list(map(int, input().split()))
Edges = [list(map(int, input().split())) for _ in range(M)]
Exchanges = [list(map(int, input().split())) for _ in range(N)]
max_money = max([a for _, _, a, _ in Edges]) * N
Graph = defaultdict(lambda: [])
# nodeと状態は tupleで管理する。(... | from collections import defaultdict
import heapq
class Dijkstra:
"""
dijkstraの最短経路問題を解く
input:
S: start node
adj: adj[a]=[(b,dist)]//なんとなく
"""
def __init__(self, start, num_node, adj):
"""
adj: adj[a]=[(b,dist)]
num_node: num of nodes
dist: dist fro... | false | 44.537815 | [
"+",
"+class Dijkstra:",
"+ \"\"\"",
"+ dijkstraの最短経路問題を解く",
"+ input:",
"+ S: start node",
"+ adj: adj[a]=[(b,dist)]//なんとなく",
"+ \"\"\"",
"+",
"+ def __init__(self, start, num_node, adj):",
"+ \"\"\"",
"+ adj: adj[a]=[(b,dist)]",
"+ num_node... | false | 0.042122 | 0.126896 | 0.331943 | [
"s164421145",
"s059267684"
] |
u186838327 | p02785 | python | s952189566 | s527835458 | 312 | 142 | 88,908 | 105,208 | Accepted | Accepted | 54.49 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
if k >= len(l):
print((0))
else:
print((sum(l[k:])))
| n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
print((sum(H[k:])))
| 9 | 4 | 154 | 111 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
if k >= len(l):
print((0))
else:
print((sum(l[k:])))
| n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
print((sum(H[k:])))
| false | 55.555556 | [
"-l = list(map(int, input().split()))",
"-l.sort(reverse=True)",
"-if k >= len(l):",
"- print((0))",
"-else:",
"- print((sum(l[k:])))",
"+H = list(map(int, input().split()))",
"+H.sort(reverse=True)",
"+print((sum(H[k:])))"
] | false | 0.040088 | 0.11492 | 0.348835 | [
"s952189566",
"s527835458"
] |
u392319141 | p03240 | python | s200432834 | s142080923 | 613 | 34 | 46,300 | 3,316 | Accepted | Accepted | 94.45 | N = int(eval(input()))
axis = []
for i in range(N) :
x, y, h = list(map(int, input().split()))
axis.append((x, y, h))
def sol() :
for cx in range(0, 101) :
for cy in range(0, 101) :
axis.sort(key = lambda A : abs(A[0] - cx) + abs(A[1] - cy))
H = axis[0][2] + abs(... | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def sol():
N = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(N)]
... | 24 | 26 | 662 | 748 | N = int(eval(input()))
axis = []
for i in range(N):
x, y, h = list(map(int, input().split()))
axis.append((x, y, h))
def sol():
for cx in range(0, 101):
for cy in range(0, 101):
axis.sort(key=lambda A: abs(A[0] - cx) + abs(A[1] - cy))
H = axis[0][2] + abs(axis[0][0] - cx) +... | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def sol():
N = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(N)]
points.so... | false | 7.692308 | [
"-N = int(eval(input()))",
"-axis = []",
"-for i in range(N):",
"- x, y, h = list(map(int, input().split()))",
"- axis.append((x, y, h))",
"+import sys",
"+import heapq",
"+from operator import itemgetter",
"+from collections import deque, defaultdict",
"+from bisect import bisect_left, bise... | false | 0.039934 | 0.037348 | 1.06924 | [
"s200432834",
"s142080923"
] |
u777283665 | p03437 | python | s971801798 | s376516424 | 1,826 | 17 | 3,060 | 2,940 | Accepted | Accepted | 99.07 | x, y = list(map(int, input().split()))
if x == y:
print((-1))
exit()
if y == 1:
print((-1))
exit()
for i in range(1, y):
temp = x * i
if temp <= 10 ** 18 and temp % y != 0:
print((x*i))
exit()
print((-1)) | x, y = list(map(int, input().split()))
if x % y == 0:
print((-1))
else:
print(x) | 17 | 6 | 230 | 82 | x, y = list(map(int, input().split()))
if x == y:
print((-1))
exit()
if y == 1:
print((-1))
exit()
for i in range(1, y):
temp = x * i
if temp <= 10**18 and temp % y != 0:
print((x * i))
exit()
print((-1))
| x, y = list(map(int, input().split()))
if x % y == 0:
print((-1))
else:
print(x)
| false | 64.705882 | [
"-if x == y:",
"+if x % y == 0:",
"- exit()",
"-if y == 1:",
"- print((-1))",
"- exit()",
"-for i in range(1, y):",
"- temp = x * i",
"- if temp <= 10**18 and temp % y != 0:",
"- print((x * i))",
"- exit()",
"-print((-1))",
"+else:",
"+ print(x)"
] | false | 0.045899 | 0.047227 | 0.97187 | [
"s971801798",
"s376516424"
] |
u186838327 | p03674 | python | s497930564 | s670939456 | 1,538 | 193 | 142,552 | 101,468 | Accepted | Accepted | 87.45 | n = int(eval(input()))
A =list(map(int, input().split()))
mod = 10**9+7
d = {}
for i in range(n+1):
if A[i] not in d:
d[A[i]] = i
else:
l = d[A[i]]
r = i
break
#print(l, r)
def cmb1(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
re... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
from collections import Counter
C = Counter(A)
for k, v in list(C.items()):
if v == 2:
t = k
flag = False
for i in range(n+1):
if not flag:
if A[i] == t:
l = i
flag = True
else:... | 34 | 42 | 738 | 821 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
d = {}
for i in range(n + 1):
if A[i] not in d:
d[A[i]] = i
else:
l = d[A[i]]
r = i
break
# print(l, r)
def cmb1(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] *... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
from collections import Counter
C = Counter(A)
for k, v in list(C.items()):
if v == 2:
t = k
flag = False
for i in range(n + 1):
if not flag:
if A[i] == t:
l = i
flag = True
else:
if A... | false | 19.047619 | [
"-d = {}",
"+from collections import Counter",
"+",
"+C = Counter(A)",
"+for k, v in list(C.items()):",
"+ if v == 2:",
"+ t = k",
"+flag = False",
"- if A[i] not in d:",
"- d[A[i]] = i",
"+ if not flag:",
"+ if A[i] == t:",
"+ l = i",
"+ ... | false | 2.509397 | 0.170545 | 14.714 | [
"s497930564",
"s670939456"
] |
u930705402 | p02775 | python | s544962766 | s171232530 | 533 | 425 | 246,636 | 252,020 | Accepted | Accepted | 20.26 | INF=10**30
N=list(map(int,list(eval(input()))))[::-1]
l=len(N)
dp=[[INF,INF] for i in range(l+1)]
dp[0][0]=0
for i in range(l):
dp[i+1][0]=min([dp[i+1][0],dp[i][0]+N[i],dp[i][1]+N[i]+1])
dp[i+1][1]=min([dp[i+1][1],dp[i][0]+(10-N[i]),dp[i][1]+(9-N[i])])
ans=min(dp[l][0],dp[l][1]+1)
print(ans) | INF=10**30
N=list(map(int,list(eval(input()))))[::-1]
l=len(N)
dp=[[INF,INF] for i in range(l+1)]
dp[0][0]=0
for i in range(l):
dp[i+1][0]=min(dp[i][0]+N[i],dp[i][1]+N[i]+1)
dp[i+1][1]=min(dp[i][0]+(10-N[i]),dp[i][1]+(9-N[i]))
print((min(dp[l][0],dp[l][1]+1))) | 10 | 9 | 303 | 268 | INF = 10**30
N = list(map(int, list(eval(input()))))[::-1]
l = len(N)
dp = [[INF, INF] for i in range(l + 1)]
dp[0][0] = 0
for i in range(l):
dp[i + 1][0] = min([dp[i + 1][0], dp[i][0] + N[i], dp[i][1] + N[i] + 1])
dp[i + 1][1] = min([dp[i + 1][1], dp[i][0] + (10 - N[i]), dp[i][1] + (9 - N[i])])
ans = min(dp[l]... | INF = 10**30
N = list(map(int, list(eval(input()))))[::-1]
l = len(N)
dp = [[INF, INF] for i in range(l + 1)]
dp[0][0] = 0
for i in range(l):
dp[i + 1][0] = min(dp[i][0] + N[i], dp[i][1] + N[i] + 1)
dp[i + 1][1] = min(dp[i][0] + (10 - N[i]), dp[i][1] + (9 - N[i]))
print((min(dp[l][0], dp[l][1] + 1)))
| false | 10 | [
"- dp[i + 1][0] = min([dp[i + 1][0], dp[i][0] + N[i], dp[i][1] + N[i] + 1])",
"- dp[i + 1][1] = min([dp[i + 1][1], dp[i][0] + (10 - N[i]), dp[i][1] + (9 - N[i])])",
"-ans = min(dp[l][0], dp[l][1] + 1)",
"-print(ans)",
"+ dp[i + 1][0] = min(dp[i][0] + N[i], dp[i][1] + N[i] + 1)",
"+ dp[i + 1][1... | false | 0.070868 | 0.046512 | 1.523653 | [
"s544962766",
"s171232530"
] |
u357751375 | p03830 | python | s884409280 | s879622574 | 72 | 43 | 65,928 | 9,120 | Accepted | Accepted | 40.28 | from math import factorial
n = int(eval(input()))
m = factorial(n)
s = 2
ans = 1
while m != 1:
c = 1
while m % s == 0:
c += 1
m = m // s
ans *= c
s += 1
print((ans % (10**9+7))) | from math import factorial
n = int(eval(input()))
m = factorial(n)
s = 2
ans = 1
while m > 1:
c = 1
while m % s == 0:
c += 1
m = m // s
ans *= c
s += 1
print((ans % (10**9+7))) | 13 | 13 | 213 | 212 | from math import factorial
n = int(eval(input()))
m = factorial(n)
s = 2
ans = 1
while m != 1:
c = 1
while m % s == 0:
c += 1
m = m // s
ans *= c
s += 1
print((ans % (10**9 + 7)))
| from math import factorial
n = int(eval(input()))
m = factorial(n)
s = 2
ans = 1
while m > 1:
c = 1
while m % s == 0:
c += 1
m = m // s
ans *= c
s += 1
print((ans % (10**9 + 7)))
| false | 0 | [
"-while m != 1:",
"+while m > 1:"
] | false | 0.040113 | 0.038312 | 1.046987 | [
"s884409280",
"s879622574"
] |
u695811449 | p02562 | python | s290357147 | s338075324 | 1,942 | 1,135 | 82,008 | 74,572 | Accepted | Accepted | 41.56 | N,K=list(map(int,input().split()))
MAP=[list(map(int,input().split())) for i in range(N)]
start = 2*N+1
goal = 2*N+2
V=2*N+5
EDGE=[[[0,0] for j in range(V)] for i in range(V)]
# 0 ~ N : 縦
# N+1 ~ 2*N : 横
# 2*N+1 : start
# 2*N+2 : goal
for i in range(N):
EDGE[start][i]=[K,0]
EDGE[N+i][goa... | N,K=list(map(int,input().split()))
MAP=[list(map(int,input().split())) for i in range(N)]
start = 2*N+1
goal = 2*N+2
V=2*N+5
EDGE=[[[0,0] for j in range(V)] for i in range(V)]
# 0 ~ N : 縦
# N+1 ~ 2*N : 横
# 2*N+1 : start
# 2*N+2 : goal
for i in range(N):
EDGE[start][i]=[K,0]
EDGE[N+i][goal]=[... | 70 | 67 | 1,323 | 1,318 | N, K = list(map(int, input().split()))
MAP = [list(map(int, input().split())) for i in range(N)]
start = 2 * N + 1
goal = 2 * N + 2
V = 2 * N + 5
EDGE = [[[0, 0] for j in range(V)] for i in range(V)]
# 0 ~ N : 縦
# N+1 ~ 2*N : 横
# 2*N+1 : start
# 2*N+2 : goal
for i in range(N):
EDGE[start][i] = [K, 0]
EDGE[N + i... | N, K = list(map(int, input().split()))
MAP = [list(map(int, input().split())) for i in range(N)]
start = 2 * N + 1
goal = 2 * N + 2
V = 2 * N + 5
EDGE = [[[0, 0] for j in range(V)] for i in range(V)]
# 0 ~ N : 縦
# N+1 ~ 2*N : 横
# 2*N+1 : start
# 2*N+2 : goal
for i in range(N):
EDGE[start][i] = [K, 0]
EDGE[N + i... | false | 4.285714 | [
"- EDGE[i][N + j] = [1, -MAP[i][j]]",
"- EDGE[N + j][i] = [0, MAP[i][j]]",
"-EDGE[start][goal] = [float(\"inf\"), 0]",
"+ EDGE[i][N + j] = [1, 10**9 - MAP[i][j]]",
"+ EDGE[N + j][i] = [0, -(10**9 - MAP[i][j])]",
"+EDGE[start][goal] = [float(\"inf\"), 10**9]",
"+import heapq",... | false | 0.038449 | 0.043456 | 0.884776 | [
"s290357147",
"s338075324"
] |
u367701763 | p02936 | python | s976580782 | s997902291 | 865 | 474 | 264,992 | 166,644 | Accepted | Accepted | 45.2 | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
import marshal
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [set() for _... | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
import marshal
class Graph:
def __init__(self, n, dictated=False, decrement=True, destroy=False, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.dest... | 102 | 105 | 2,901 | 3,036 | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
import marshal
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [set() for _ in range(se... | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
import marshal
class Graph:
def __init__(self, n, dictated=False, decrement=True, destroy=False, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.destroy = destro... | false | 2.857143 | [
"- def __init__(self, n, dictated=False, decrement=True, edge=[]):",
"+ def __init__(self, n, dictated=False, decrement=True, destroy=False, edge=[]):",
"+ self.destroy = destroy",
"- edge2 = marshal.loads(marshal.dumps(self.edge))",
"+ if self.destroy:",
"+ edge2 = s... | false | 0.046925 | 0.111147 | 0.422188 | [
"s976580782",
"s997902291"
] |
u875361824 | p03317 | python | s948931280 | s188633799 | 81 | 40 | 13,812 | 13,940 | Accepted | Accepted | 50.62 | import sys
import math
def main():
"""
2 <= K <= N <= 10^5
1 <= ai <= N
1 <= i <= N
"""
N, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
ans = f_K(N, K, A)
#ans = editorial(N, K, A)
print(ans)
def test_examples():
nka_ans = ... | import sys
import math
def main():
"""
2 <= K <= N <= 10^5
1 <= ai <= N
1 <= i <= N
"""
N, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
#ans = f_K(N, K, A)
ans = editorial(N, K, A)
print(ans)
def test_examples():
nka_ans = ... | 63 | 79 | 1,338 | 1,684 | import sys
import math
def main():
"""
2 <= K <= N <= 10^5
1 <= ai <= N
1 <= i <= N
"""
N, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
ans = f_K(N, K, A)
# ans = editorial(N, K, A)
print(ans)
def test_examples():
nka_ans = [
(4, 3, ... | import sys
import math
def main():
"""
2 <= K <= N <= 10^5
1 <= ai <= N
1 <= i <= N
"""
N, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
# ans = f_K(N, K, A)
ans = editorial(N, K, A)
print(ans)
def test_examples():
nka_ans = [
(4, 3, ... | false | 20.253165 | [
"- ans = f_K(N, K, A)",
"- # ans = editorial(N, K, A)",
"+ # ans = f_K(N, K, A)",
"+ ans = editorial(N, K, A)",
"+def editorial(N, K, A):",
"+ \"\"\"",
"+ 端から端までカバーしていく",
"+ K + (K - 1) * N (N >= 0)",
"+ これは仮に1番左に1があったとき",
"+ 結果的には順番は気にしなくて良い",
"+ 上記でカバーしていく... | false | 0.055454 | 0.042278 | 1.311662 | [
"s948931280",
"s188633799"
] |
u678167152 | p03103 | python | s021124600 | s370158023 | 470 | 432 | 20,056 | 27,756 | Accepted | Accepted | 8.09 | N, M = list(map(int, input().split()))
A = [0]*N
for i in range(N):
A[i] = [0,0]
A[i][0],A[i][1] = list(map(int, input().split()))
A.sort()
sum = 0
for a in A:
if a[1]<M:
sum += a[0]*a[1]
M -= a[1]
else:
sum += a[0]*M
print(sum)
exit()
| def solve():
N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
A.sort()
ans = 0
cnt = 0
for a in A:
if cnt + a[1] <= M:
ans += a[1]*a[0]
cnt += a[1]
else:
ans += a[0]*(M-cnt)
... | 16 | 15 | 268 | 351 | N, M = list(map(int, input().split()))
A = [0] * N
for i in range(N):
A[i] = [0, 0]
A[i][0], A[i][1] = list(map(int, input().split()))
A.sort()
sum = 0
for a in A:
if a[1] < M:
sum += a[0] * a[1]
M -= a[1]
else:
sum += a[0] * M
print(sum)
exit()
| def solve():
N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
A.sort()
ans = 0
cnt = 0
for a in A:
if cnt + a[1] <= M:
ans += a[1] * a[0]
cnt += a[1]
else:
ans += a[0] * (M - cnt)
break
... | false | 6.25 | [
"-N, M = list(map(int, input().split()))",
"-A = [0] * N",
"-for i in range(N):",
"- A[i] = [0, 0]",
"- A[i][0], A[i][1] = list(map(int, input().split()))",
"-A.sort()",
"-sum = 0",
"-for a in A:",
"- if a[1] < M:",
"- sum += a[0] * a[1]",
"- M -= a[1]",
"- else:",
... | false | 0.038484 | 0.040945 | 0.93988 | [
"s021124600",
"s370158023"
] |
u150984829 | p02235 | python | s353011814 | s726297063 | 2,870 | 2,380 | 5,624 | 5,628 | Accepted | Accepted | 17.07 | e=input
a=[]
for _ in[0]*int(e()):
X,z=e(),[]
for y in e():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
a+=[len(z)]
print(*a,sep='\n')
| e=input
a=''
for _ in[0]*int(e()):
X,z=e(),[]
for y in e():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
a+=f'\n{len(z)}'
print((a[1:]))
| 16 | 16 | 237 | 236 | e = input
a = []
for _ in [0] * int(e()):
X, z = e(), []
for y in e():
s = i = 0
for k in z:
t = X.find(y, s) + 1
if t < 1:
break
if t < k:
z[i] = t
s = k
i += 1
else:
t = X.find(y, s)... | e = input
a = ""
for _ in [0] * int(e()):
X, z = e(), []
for y in e():
s = i = 0
for k in z:
t = X.find(y, s) + 1
if t < 1:
break
if t < k:
z[i] = t
s = k
i += 1
else:
t = X.find(y, s)... | false | 0 | [
"-a = []",
"+a = \"\"",
"- a += [len(z)]",
"-print(*a, sep=\"\\n\")",
"+ a += f\"\\n{len(z)}\"",
"+print((a[1:]))"
] | false | 0.041209 | 0.059701 | 0.690255 | [
"s353011814",
"s726297063"
] |
u257162238 | p02584 | python | s930097427 | s202455779 | 34 | 30 | 9,184 | 9,196 | Accepted | Accepted | 11.76 | import sys
input = sys.stdin.readline
import math
def read():
X, K, D = list(map(int, input().strip().split()))
return X, K, D
def solve(X, K, D):
m = (-X + K*D) / (2*D)
mc = min(max(0, math.ceil(m)), K)
mf = min(max(0, math.floor(m)), K)
ans = min(abs(X - K*D + 2 * mc * D), ab... | import sys
input = sys.stdin.readline
import math
def read():
X, K, D = list(map(int, input().strip().split()))
return X, K, D
def solve(X, K, D):
X = abs(X)
k = X // D
if K % 2 == 0:
if k % 2 == 0:
i = min(X // D, K)
else:
i = min(X // D... | 23 | 32 | 503 | 631 | import sys
input = sys.stdin.readline
import math
def read():
X, K, D = list(map(int, input().strip().split()))
return X, K, D
def solve(X, K, D):
m = (-X + K * D) / (2 * D)
mc = min(max(0, math.ceil(m)), K)
mf = min(max(0, math.floor(m)), K)
ans = min(abs(X - K * D + 2 * mc * D), abs(X - K... | import sys
input = sys.stdin.readline
import math
def read():
X, K, D = list(map(int, input().strip().split()))
return X, K, D
def solve(X, K, D):
X = abs(X)
k = X // D
if K % 2 == 0:
if k % 2 == 0:
i = min(X // D, K)
else:
i = min(X // D + 1, K)
else... | false | 28.125 | [
"- m = (-X + K * D) / (2 * D)",
"- mc = min(max(0, math.ceil(m)), K)",
"- mf = min(max(0, math.floor(m)), K)",
"- ans = min(abs(X - K * D + 2 * mc * D), abs(X - K * D + 2 * mf * D))",
"- return ans",
"+ X = abs(X)",
"+ k = X // D",
"+ if K % 2 == 0:",
"+ if k % 2 == 0:... | false | 0.047879 | 0.095398 | 0.501883 | [
"s930097427",
"s202455779"
] |
u794173881 | p02820 | python | s886393076 | s783413868 | 467 | 343 | 75,116 | 63,596 | Accepted | Accepted | 26.55 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
dp = [[0]*3 for i in range(n+1)]
# dp[i][今回の手]
for i in range(n):
if t[i] == "r":
dp[i+1][0] = max(dp[max(i+1-k, 0)][1] + p, dp[i+1][0])
dp[i+1][0] = max(dp[max(i+1-k, 0)][2] + p, dp[i+1][0... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
dp = [[0] * 3 for i in range(n + 1)]
for i in range(n):
if i + 1 - k < 0:
if t[i] == "r":
dp[i + 1][0] = p
if t[i] == "s":
dp[i + 1][1] = r
if t[i] == "p":
... | 28 | 30 | 1,006 | 1,109 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
dp = [[0] * 3 for i in range(n + 1)]
# dp[i][今回の手]
for i in range(n):
if t[i] == "r":
dp[i + 1][0] = max(dp[max(i + 1 - k, 0)][1] + p, dp[i + 1][0])
dp[i + 1][0] = max(dp[max(i + 1 - k, 0)][2] + p, dp[... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
dp = [[0] * 3 for i in range(n + 1)]
for i in range(n):
if i + 1 - k < 0:
if t[i] == "r":
dp[i + 1][0] = p
if t[i] == "s":
dp[i + 1][1] = r
if t[i] == "p":
d... | false | 6.666667 | [
"-# dp[i][今回の手]",
"- if t[i] == \"r\":",
"- dp[i + 1][0] = max(dp[max(i + 1 - k, 0)][1] + p, dp[i + 1][0])",
"- dp[i + 1][0] = max(dp[max(i + 1 - k, 0)][2] + p, dp[i + 1][0])",
"- if t[i] == \"s\":",
"- dp[i + 1][1] = max(dp[max(i + 1 - k, 0)][0] + r, dp[i + 1][1])",
"- ... | false | 0.045812 | 0.045711 | 1.002216 | [
"s886393076",
"s783413868"
] |
u987164499 | p03241 | python | s170139914 | s475083547 | 25 | 20 | 3,064 | 3,064 | Accepted | Accepted | 20 | from sys import stdin
n,m = list(map(int,stdin.readline().rstrip().split()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divi... | from sys import stdin
n,m = list(map(int,stdin.readline().rstrip().split()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divi... | 21 | 18 | 494 | 456 | from sys import stdin
n, m = list(map(int, stdin.readline().rstrip().split()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divis... | from sys import stdin
n, m = list(map(int, stdin.readline().rstrip().split()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divis... | false | 14.285714 | [
"-point = 1",
"-if n == 1:",
"- print(m)",
"- exit()",
"+point = m"
] | false | 0.050142 | 0.042567 | 1.177944 | [
"s170139914",
"s475083547"
] |
u694665829 | p03475 | python | s512197521 | s848087010 | 93 | 71 | 9,220 | 9,240 | Accepted | Accepted | 23.66 | n = int(eval(input()))
csf = [list(map(int,input().split())) for _ in range(n-1)]
for i in range(n):
time = 0
while True:
if i == n-1:
print(time)
break
if time < csf[i][1]:
time = csf[i][1] + csf[i][0]
else:
if time%csf[i][2] ... | def solve():
n = int(eval(input()))
csf = [list(map(int,input().split())) for _ in range(n-1)]
for i in range(n):
time = 0
while True:
if i == n-1:
print(time)
break
if time < csf[i][1]:
time = csf[i][1] ... | 17 | 21 | 455 | 579 | n = int(eval(input()))
csf = [list(map(int, input().split())) for _ in range(n - 1)]
for i in range(n):
time = 0
while True:
if i == n - 1:
print(time)
break
if time < csf[i][1]:
time = csf[i][1] + csf[i][0]
else:
if time % csf[i][2] == 0:
... | def solve():
n = int(eval(input()))
csf = [list(map(int, input().split())) for _ in range(n - 1)]
for i in range(n):
time = 0
while True:
if i == n - 1:
print(time)
break
if time < csf[i][1]:
time = csf[i][1] + csf[i][0]... | false | 19.047619 | [
"-n = int(eval(input()))",
"-csf = [list(map(int, input().split())) for _ in range(n - 1)]",
"-for i in range(n):",
"- time = 0",
"- while True:",
"- if i == n - 1:",
"- print(time)",
"- break",
"- if time < csf[i][1]:",
"- time = csf[i][1] + cs... | false | 0.093597 | 0.044713 | 2.093293 | [
"s512197521",
"s848087010"
] |
u212328220 | p02684 | python | s114155599 | s902978882 | 169 | 150 | 33,804 | 32,376 | Accepted | Accepted | 11.24 | from collections import defaultdict
def inpl():
return list(map(int, input().split()))
N, K = inpl()
aa = inpl()
s = 1
route = [s]
ed = set([s])
for i in range(1, K + 1):
s = aa[s - 1]
if s in ed:
Li = route.index(s)
Ri = len(route)
idx = Li + (K - Li) % (R... | N, K = list(map(int, input().split()))
al = list(map(int, input().split()))
visited= [1]
ed = set([1])
for i in range(K):
next_town = al[visited[i] - 1]
if next_town in ed:
loop_sta = visited.index((next_town)) # visited_townsにおけるループ開始のインデックス
loop_end = len(visited) #visited_townsにおける... | 29 | 23 | 464 | 633 | from collections import defaultdict
def inpl():
return list(map(int, input().split()))
N, K = inpl()
aa = inpl()
s = 1
route = [s]
ed = set([s])
for i in range(1, K + 1):
s = aa[s - 1]
if s in ed:
Li = route.index(s)
Ri = len(route)
idx = Li + (K - Li) % (Ri - Li)
print((... | N, K = list(map(int, input().split()))
al = list(map(int, input().split()))
visited = [1]
ed = set([1])
for i in range(K):
next_town = al[visited[i] - 1]
if next_town in ed:
loop_sta = visited.index((next_town)) # visited_townsにおけるループ開始のインデックス
loop_end = len(visited) # visited_townsにおけるループの終わ... | false | 20.689655 | [
"-from collections import defaultdict",
"-",
"-",
"-def inpl():",
"- return list(map(int, input().split()))",
"-",
"-",
"-N, K = inpl()",
"-aa = inpl()",
"-s = 1",
"-route = [s]",
"-ed = set([s])",
"-for i in range(1, K + 1):",
"- s = aa[s - 1]",
"- if s in ed:",
"- Li ... | false | 0.033972 | 0.094794 | 0.358383 | [
"s114155599",
"s902978882"
] |
u600402037 | p02714 | python | s405217831 | s146001793 | 202 | 165 | 68,896 | 68,840 | Accepted | Accepted | 18.32 | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 1の条件を満たすものを調べたのち、2の条件のものを引く
N = ir()
S = list(sr())
counter = Counter(S)
r = counter['R']
g = counter['G']
b = counter['B']
answer = r... | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
S = sr()
counter = Counter(S)
r = counter['R']; g = counter['G']; b = counter['B']
answer = r * g * b
for i in range(N):
for... | 25 | 26 | 558 | 581 | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 1の条件を満たすものを調べたのち、2の条件のものを引く
N = ir()
S = list(sr())
counter = Counter(S)
r = counter["R"]
g = counter["G"]
b = counter["B"]
answer = r * g * b
for i i... | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
S = sr()
counter = Counter(S)
r = counter["R"]
g = counter["G"]
b = counter["B"]
answer = r * g * b
for i in range(N):
for j in range(i + 1... | false | 3.846154 | [
"-# 1の条件を満たすものを調べたのち、2の条件のものを引く",
"-S = list(sr())",
"+S = sr()",
"-for i in range(N - 1):",
"+for i in range(N):",
"- if j + (j - i) >= N:",
"+ if S[i] == S[j]:",
"+ diff = j - i",
"+ if j + diff >= N:",
"+ break",
"- z = S[j + j - i]",
"- ... | false | 0.036608 | 0.035837 | 1.021523 | [
"s405217831",
"s146001793"
] |
u197615397 | p02270 | python | s854382865 | s044359958 | 1,000 | 370 | 12,352 | 9,580 | Accepted | Accepted | 63 | import math
n, k = list(map(int, input().split()))
a = [int(eval(input())) for _ in [None]*n]
lb = max(a)
ub = lb * n
while True:
mid = (ub+lb) // 2
remain = k - 1
cw = 0
for w in a:
cw += w
if cw > mid:
remain -= 1
cw = w
if remain < 0:
... | def solve():
import sys
n, k = list(map(int, input().split()))
ws = tuple(map(int, sys.stdin))
ok, ng = sum(ws), max(ws)-1
while ok-ng > 1:
mid = (ok+ng+1)//2
current = 0
count = 0
for w in ws:
if current + w > mid:
current =... | 28 | 27 | 525 | 538 | import math
n, k = list(map(int, input().split()))
a = [int(eval(input())) for _ in [None] * n]
lb = max(a)
ub = lb * n
while True:
mid = (ub + lb) // 2
remain = k - 1
cw = 0
for w in a:
cw += w
if cw > mid:
remain -= 1
cw = w
if remain < 0:
b... | def solve():
import sys
n, k = list(map(int, input().split()))
ws = tuple(map(int, sys.stdin))
ok, ng = sum(ws), max(ws) - 1
while ok - ng > 1:
mid = (ok + ng + 1) // 2
current = 0
count = 0
for w in ws:
if current + w > mid:
current = w
... | false | 3.571429 | [
"-import math",
"+def solve():",
"+ import sys",
"-n, k = list(map(int, input().split()))",
"-a = [int(eval(input())) for _ in [None] * n]",
"-lb = max(a)",
"-ub = lb * n",
"-while True:",
"- mid = (ub + lb) // 2",
"- remain = k - 1",
"- cw = 0",
"- for w in a:",
"- cw ... | false | 0.035215 | 0.03639 | 0.967724 | [
"s854382865",
"s044359958"
] |
u538276565 | p02888 | python | s432873783 | s838743901 | 1,536 | 727 | 3,188 | 3,188 | Accepted | Accepted | 52.67 | n = int(eval(input()))
d = list([int(x) for x in input().split()])
d.sort()
res = 0
for i in range(n-2):
k = i + 2
for j in range(i+1, n-1):
while k < n and d[i] + d[j] > d[k]:
k += 1
if k > j:
res += k - j - 1
print(res) | def find_triangle_count(d):
n = len(d)
d.sort()
res = 0
for i in range(n - 2):
k = i + 2
for j in range(i + 1, n - 1):
while k < n and d[i] + d[j] > d[k]:
k += 1
if k > j:
res += k - j - 1
return res
def solve():... | 15 | 22 | 285 | 485 | n = int(eval(input()))
d = list([int(x) for x in input().split()])
d.sort()
res = 0
for i in range(n - 2):
k = i + 2
for j in range(i + 1, n - 1):
while k < n and d[i] + d[j] > d[k]:
k += 1
if k > j:
res += k - j - 1
print(res)
| def find_triangle_count(d):
n = len(d)
d.sort()
res = 0
for i in range(n - 2):
k = i + 2
for j in range(i + 1, n - 1):
while k < n and d[i] + d[j] > d[k]:
k += 1
if k > j:
res += k - j - 1
return res
def solve():
eval(inpu... | false | 31.818182 | [
"-n = int(eval(input()))",
"-d = list([int(x) for x in input().split()])",
"-d.sort()",
"-res = 0",
"-for i in range(n - 2):",
"- k = i + 2",
"- for j in range(i + 1, n - 1):",
"- while k < n and d[i] + d[j] > d[k]:",
"- k += 1",
"- if k > j:",
"- res +=... | false | 0.111896 | 0.076683 | 1.459202 | [
"s432873783",
"s838743901"
] |
u694294905 | p04043 | python | s217793693 | s074386918 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | List=list(map(int,input().split()))
print(('YES' if List.count(7)==1 and List.count(5)==2 else 'NO')) | l=list(input().split())
print(('YES' if l.count('5')==2 and l.count('7')==1 else 'NO')) | 2 | 2 | 100 | 87 | List = list(map(int, input().split()))
print(("YES" if List.count(7) == 1 and List.count(5) == 2 else "NO"))
| l = list(input().split())
print(("YES" if l.count("5") == 2 and l.count("7") == 1 else "NO"))
| false | 0 | [
"-List = list(map(int, input().split()))",
"-print((\"YES\" if List.count(7) == 1 and List.count(5) == 2 else \"NO\"))",
"+l = list(input().split())",
"+print((\"YES\" if l.count(\"5\") == 2 and l.count(\"7\") == 1 else \"NO\"))"
] | false | 0.067224 | 0.068018 | 0.988338 | [
"s217793693",
"s074386918"
] |
u411203878 | p03131 | python | s894715271 | s930844882 | 181 | 73 | 38,392 | 61,920 | Accepted | Accepted | 59.67 | k,a,b = list(map(int,input().split()))
if b-a <= 1 or k <= a:
print((k+1))
else:
print((((k-(a+1))//2)*(b-a)+b+((k-(a+1))%2))) | K,A,B = list(map(int,input().split()))
if B-A < 3:
print((K+1))
else:
if A > K-1:
print((K+1))
else:
count = K-A+1
shou = count//2
if count%2 == 1:
print((A+(B-A)*shou+1))
else:
print((A+(B-A)*shou)) | 7 | 14 | 132 | 275 | k, a, b = list(map(int, input().split()))
if b - a <= 1 or k <= a:
print((k + 1))
else:
print((((k - (a + 1)) // 2) * (b - a) + b + ((k - (a + 1)) % 2)))
| K, A, B = list(map(int, input().split()))
if B - A < 3:
print((K + 1))
else:
if A > K - 1:
print((K + 1))
else:
count = K - A + 1
shou = count // 2
if count % 2 == 1:
print((A + (B - A) * shou + 1))
else:
print((A + (B - A) * shou))
| false | 50 | [
"-k, a, b = list(map(int, input().split()))",
"-if b - a <= 1 or k <= a:",
"- print((k + 1))",
"+K, A, B = list(map(int, input().split()))",
"+if B - A < 3:",
"+ print((K + 1))",
"- print((((k - (a + 1)) // 2) * (b - a) + b + ((k - (a + 1)) % 2)))",
"+ if A > K - 1:",
"+ print((K ... | false | 0.053699 | 0.036528 | 1.470079 | [
"s894715271",
"s930844882"
] |
u423585790 | p03295 | python | s314055595 | s203309357 | 398 | 341 | 55,900 | 55,772 | Accepted | Accepted | 14.32 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | 79 | 80 | 1,924 | 1,944 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():... | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():... | false | 1.25 | [
"- mi = max(mi, d[i])",
"+ if mi < d[i]:",
"+ mi = d[i]"
] | false | 0.046855 | 0.050417 | 0.929335 | [
"s314055595",
"s203309357"
] |
u645250356 | p03425 | python | s659288287 | s451541919 | 302 | 153 | 5,324 | 10,268 | Accepted | Accepted | 49.34 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.std... | 24 | 25 | 652 | 659 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 4 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions",
"-from decimal import Decimal",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"-s = [\"M\", \"A\", \"R\", \"C\", \"H\"... | false | 0.044756 | 0.034876 | 1.28332 | [
"s659288287",
"s451541919"
] |
u863442865 | p03031 | python | s071664121 | s826878249 | 40 | 35 | 3,316 | 3,188 | Accepted | Accepted | 12.5 | '''
https://atcoder.jp/contests/abc128/tasks/abc128_c
'''
def main():
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#mod = 1000000007
n, m = list(map(int, input().split()))
switch_list = [list(map(int, input().spli... | def main():
n, m = list(map(int, input().split()))
switch_list = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ret = 0
for j in range(2**n):
for i in range(m):
total = 0
flag = 1
for k in switch_list[i][1:... | 31 | 21 | 796 | 566 | """
https://atcoder.jp/contests/abc128/tasks/abc128_c
"""
def main():
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# mod = 1000000007
n, m = list(map(int, input().split()))
switch_list = [list(map(int, input().split())) fo... | def main():
n, m = list(map(int, input().split()))
switch_list = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ret = 0
for j in range(2**n):
for i in range(m):
total = 0
flag = 1
for k in switch_list[i][1:]:
... | false | 32.258065 | [
"-\"\"\"",
"-https://atcoder.jp/contests/abc128/tasks/abc128_c",
"-\"\"\"",
"-",
"-",
"- import sys",
"-",
"- # input = sys.stdin.readline",
"- sys.setrecursionlimit(10000000)",
"- from collections import Counter, deque",
"-",
"- # mod = 1000000007",
"- cnt = 0",
"+ ... | false | 0.039335 | 0.040909 | 0.961531 | [
"s071664121",
"s826878249"
] |
u906501980 | p02744 | python | s781107624 | s759513991 | 797 | 447 | 97,784 | 49,092 | Accepted | Accepted | 43.91 | n = int(eval(input()))
s = set(list("abcdefghijk"))
class Node:
def __init__(self, char, parents):
self.children = []
self.string = parents+char
self.charset = set(self.string)
def get_children(self):
parents = self.string
for c in sorted(list(self.charset|se... | n = int(eval(input()))
s = "abcdefghij"
class Node:
def __init__(self, string, index):
self.children = []
self.string = string
self.index = index
def get_children(self):
parent = self.string
for i, c in enumerate(s[:self.index+1]):
self.children.... | 23 | 23 | 649 | 630 | n = int(eval(input()))
s = set(list("abcdefghijk"))
class Node:
def __init__(self, char, parents):
self.children = []
self.string = parents + char
self.charset = set(self.string)
def get_children(self):
parents = self.string
for c in sorted(list(self.charset | set(min(... | n = int(eval(input()))
s = "abcdefghij"
class Node:
def __init__(self, string, index):
self.children = []
self.string = string
self.index = index
def get_children(self):
parent = self.string
for i, c in enumerate(s[: self.index + 1]):
self.children.append(
... | false | 0 | [
"-s = set(list(\"abcdefghijk\"))",
"+s = \"abcdefghij\"",
"- def __init__(self, char, parents):",
"+ def __init__(self, string, index):",
"- self.string = parents + char",
"- self.charset = set(self.string)",
"+ self.string = string",
"+ self.index = index",
"- ... | false | 0.039053 | 0.086444 | 0.451775 | [
"s781107624",
"s759513991"
] |
u340781749 | p02949 | python | s126171336 | s117681622 | 1,359 | 1,206 | 99,164 | 100,060 | Accepted | Accepted | 11.26 | import sys
from collections import defaultdict
def reverse_search(n, parents):
q = [n - 1]
visited = set()
while q:
v = q.pop()
if v in visited:
continue
visited.add(v)
q.extend(u for u in parents[v] if u not in visited)
return visited
n, m... | import sys
from collections import defaultdict
def reverse_search(n, parents):
q = [n - 1]
visited = set()
while q:
v = q.pop()
if v in visited:
continue
visited.add(v)
q.extend(u for u in parents[v] if u not in visited)
return visited
n, m... | 50 | 51 | 1,133 | 1,183 | import sys
from collections import defaultdict
def reverse_search(n, parents):
q = [n - 1]
visited = set()
while q:
v = q.pop()
if v in visited:
continue
visited.add(v)
q.extend(u for u in parents[v] if u not in visited)
return visited
n, m, p = list(map(i... | import sys
from collections import defaultdict
def reverse_search(n, parents):
q = [n - 1]
visited = set()
while q:
v = q.pop()
if v in visited:
continue
visited.add(v)
q.extend(u for u in parents[v] if u not in visited)
return visited
n, m, p = list(map(i... | false | 1.960784 | [
"+links = list(map(reachable.intersection, links))"
] | false | 0.043931 | 0.043396 | 1.012326 | [
"s126171336",
"s117681622"
] |
u636683284 | p02813 | python | s640607749 | s529445552 | 182 | 74 | 44,912 | 73,516 | Accepted | Accepted | 59.34 | import itertools
n = int(eval(input()))
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
l = [i+1 for i in range(n)]
r = list(itertools.permutations(l))
j = 0
flagp = True
flagq = True
while flagp:
if r[j] == p:
x = j+1
flagp = False
j += 1
j = 0
while flagq:
if r[j]... | from itertools import permutations
n = int(eval(input()))
p = tuple(input().split())
q = tuple(input().split())
# print(p)
# print(q)
l = [str(i+1) for i in range(n)]
cnt = 1
for v in permutations(l,n):
if p == v:
a = cnt
if q == v:
b = cnt
cnt += 1
print((abs(a-b))) | 21 | 18 | 379 | 307 | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
l = [i + 1 for i in range(n)]
r = list(itertools.permutations(l))
j = 0
flagp = True
flagq = True
while flagp:
if r[j] == p:
x = j + 1
flagp = False
j += 1
j = 0
while flagq:
if... | from itertools import permutations
n = int(eval(input()))
p = tuple(input().split())
q = tuple(input().split())
# print(p)
# print(q)
l = [str(i + 1) for i in range(n)]
cnt = 1
for v in permutations(l, n):
if p == v:
a = cnt
if q == v:
b = cnt
cnt += 1
print((abs(a - b)))
| false | 14.285714 | [
"-import itertools",
"+from itertools import permutations",
"-p = tuple(map(int, input().split()))",
"-q = tuple(map(int, input().split()))",
"-l = [i + 1 for i in range(n)]",
"-r = list(itertools.permutations(l))",
"-j = 0",
"-flagp = True",
"-flagq = True",
"-while flagp:",
"- if r[j] == p:... | false | 0.046722 | 0.045872 | 1.018522 | [
"s640607749",
"s529445552"
] |
u393253137 | p03611 | python | s893287210 | s258987296 | 113 | 67 | 14,008 | 13,964 | Accepted | Accepted | 40.71 | n = int(eval(input()))
A = sorted(map(int, input().split()))
D = [0]*(A[-1]+3)
for a in A:
D[a-1] += 1
D[a] += 1
D[a+1] += 1
print((max(D))) | n = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0] * 10**5
for a in A:
cnt[a] += 1
print((max(list(map(sum, list(zip(cnt, cnt[1:], cnt[2:]))))))) | 8 | 6 | 151 | 152 | n = int(eval(input()))
A = sorted(map(int, input().split()))
D = [0] * (A[-1] + 3)
for a in A:
D[a - 1] += 1
D[a] += 1
D[a + 1] += 1
print((max(D)))
| n = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0] * 10**5
for a in A:
cnt[a] += 1
print((max(list(map(sum, list(zip(cnt, cnt[1:], cnt[2:])))))))
| false | 25 | [
"-A = sorted(map(int, input().split()))",
"-D = [0] * (A[-1] + 3)",
"+A = list(map(int, input().split()))",
"+cnt = [0] * 10**5",
"- D[a - 1] += 1",
"- D[a] += 1",
"- D[a + 1] += 1",
"-print((max(D)))",
"+ cnt[a] += 1",
"+print((max(list(map(sum, list(zip(cnt, cnt[1:], cnt[2:])))))))"
... | false | 0.055422 | 0.077961 | 0.710896 | [
"s893287210",
"s258987296"
] |
u332906195 | p02629 | python | s123769253 | s343868563 | 34 | 31 | 9,072 | 8,964 | Accepted | Accepted | 8.82 | N, ans = int(eval(input())), []
while N > 0:
N = N - 1
ans.append(chr(N % 26 + ord('a')))
N = N // 26
print((''.join(ans[::-1])))
| N, ans = int(eval(input())), ''
while N > 0:
N = N - 1
ans += chr(N % 26 + ord('a'))
N //= 26
print((ans[::-1]))
| 6 | 6 | 139 | 122 | N, ans = int(eval(input())), []
while N > 0:
N = N - 1
ans.append(chr(N % 26 + ord("a")))
N = N // 26
print(("".join(ans[::-1])))
| N, ans = int(eval(input())), ""
while N > 0:
N = N - 1
ans += chr(N % 26 + ord("a"))
N //= 26
print((ans[::-1]))
| false | 0 | [
"-N, ans = int(eval(input())), []",
"+N, ans = int(eval(input())), \"\"",
"- ans.append(chr(N % 26 + ord(\"a\")))",
"- N = N // 26",
"-print((\"\".join(ans[::-1])))",
"+ ans += chr(N % 26 + ord(\"a\"))",
"+ N //= 26",
"+print((ans[::-1]))"
] | false | 0.04729 | 0.048689 | 0.971263 | [
"s123769253",
"s343868563"
] |
u678167152 | p03544 | python | s457229543 | s708046352 | 164 | 61 | 38,256 | 61,780 | Accepted | Accepted | 62.8 | N = int(eval(input()))
L = [0]*(N+1)
L[0],L[1]=2,1
for i in range(2,N+1):
L[i] = L[i-1]+L[i-2]
print((L[N])) | def solve():
ans = 0
N = int(eval(input()))
dp = [0]*(N+1)
dp[0]=2
dp[1]=1
for i in range(2,N+1):
dp[i] = dp[i-1]+dp[i-2]
return dp[-1]
print((solve())) | 6 | 10 | 107 | 189 | N = int(eval(input()))
L = [0] * (N + 1)
L[0], L[1] = 2, 1
for i in range(2, N + 1):
L[i] = L[i - 1] + L[i - 2]
print((L[N]))
| def solve():
ans = 0
N = int(eval(input()))
dp = [0] * (N + 1)
dp[0] = 2
dp[1] = 1
for i in range(2, N + 1):
dp[i] = dp[i - 1] + dp[i - 2]
return dp[-1]
print((solve()))
| false | 40 | [
"-N = int(eval(input()))",
"-L = [0] * (N + 1)",
"-L[0], L[1] = 2, 1",
"-for i in range(2, N + 1):",
"- L[i] = L[i - 1] + L[i - 2]",
"-print((L[N]))",
"+def solve():",
"+ ans = 0",
"+ N = int(eval(input()))",
"+ dp = [0] * (N + 1)",
"+ dp[0] = 2",
"+ dp[1] = 1",
"+ for i... | false | 0.11369 | 0.126212 | 0.900781 | [
"s457229543",
"s708046352"
] |
u285443936 | p03290 | python | s569374309 | s584038066 | 54 | 40 | 3,064 | 9,236 | Accepted | Accepted | 25.93 | D, G = list(map(int, input().split()))
table = []
for i in range(D):
p,c = list(map(int, input().split()))
table.append((i+1,p,c))
ans = 10**3
for i in range(1<<D):
count = 0
score = 0
remain = []
for j in range(D):
d,p,c = table[j]
if i & (1<<j):
score +... | D, G = list(map(int,input().split()))
table = []
ans = 0
for i in range(D):
p,c = list(map(int,input().split()))
ans += p
table.append((p,c))
for i in range(2**D):
score = 0
n = 0
solved = [0] * D
for j in range(D):
if i>>j & 1:
p,c = table[j]
... | 27 | 34 | 647 | 751 | D, G = list(map(int, input().split()))
table = []
for i in range(D):
p, c = list(map(int, input().split()))
table.append((i + 1, p, c))
ans = 10**3
for i in range(1 << D):
count = 0
score = 0
remain = []
for j in range(D):
d, p, c = table[j]
if i & (1 << j):
score += ... | D, G = list(map(int, input().split()))
table = []
ans = 0
for i in range(D):
p, c = list(map(int, input().split()))
ans += p
table.append((p, c))
for i in range(2**D):
score = 0
n = 0
solved = [0] * D
for j in range(D):
if i >> j & 1:
p, c = table[j]
solved[j]... | false | 20.588235 | [
"+ans = 0",
"- table.append((i + 1, p, c))",
"-ans = 10**3",
"-for i in range(1 << D):",
"- count = 0",
"+ ans += p",
"+ table.append((p, c))",
"+for i in range(2**D):",
"- remain = []",
"+ n = 0",
"+ solved = [0] * D",
"- d, p, c = table[j]",
"- if i & (1 ... | false | 0.043086 | 0.042505 | 1.013678 | [
"s569374309",
"s584038066"
] |
u328751895 | p03339 | python | s753133202 | s573950654 | 165 | 78 | 3,672 | 3,700 | Accepted | Accepted | 52.73 | N = int(eval(input()))
S = eval(input())
l = 0
r = S.count("E", 1, len(S))
ans = l + r
for i in range(1, len(S)):
if S[i] == "E":
r -= 1
if S[i - 1] == "W":
l += 1
ans = ans if ans <= l + r else l + r
print(ans) | eval(input())
S = eval(input())
ans = ans_cur = S.count("E")
for c in S:
if c == "E":
ans_cur -= 1
else:
ans_cur += 1
ans = ans if ans <= ans_cur else ans_cur
print(ans) | 15 | 11 | 244 | 196 | N = int(eval(input()))
S = eval(input())
l = 0
r = S.count("E", 1, len(S))
ans = l + r
for i in range(1, len(S)):
if S[i] == "E":
r -= 1
if S[i - 1] == "W":
l += 1
ans = ans if ans <= l + r else l + r
print(ans)
| eval(input())
S = eval(input())
ans = ans_cur = S.count("E")
for c in S:
if c == "E":
ans_cur -= 1
else:
ans_cur += 1
ans = ans if ans <= ans_cur else ans_cur
print(ans)
| false | 26.666667 | [
"-N = int(eval(input()))",
"+eval(input())",
"-l = 0",
"-r = S.count(\"E\", 1, len(S))",
"-ans = l + r",
"-for i in range(1, len(S)):",
"- if S[i] == \"E\":",
"- r -= 1",
"- if S[i - 1] == \"W\":",
"- l += 1",
"- ans = ans if ans <= l + r else l + r",
"+ans = ans_cur = S... | false | 0.045699 | 0.047148 | 0.969263 | [
"s753133202",
"s573950654"
] |
u352394527 | p00441 | python | s207111064 | s294427625 | 19,810 | 15,870 | 6,392 | 6,396 | Accepted | Accepted | 19.89 | def main():
#points = [[False for i in range(5001)] for j in range(5001)]
while True:
n = int(eval(input()))
if not n:
break
ps = []
dic = {}
for i in range(n):
x, y = list(map(int,input().split()))
dic[(x, y)] = 1;
#points[x][y] = True
ps.append((x,y)... | def main():
while True:
n = int(eval(input()))
if not n:
break
ps = []
dic = {}
for i in range(n):
x, y = list(map(int,input().split()))
dic[(x, y)] = 1;
ps.append((x,y))
ans = 0
for i in range(n):
for j in range(n):
p1 = ps[i]
... | 36 | 34 | 903 | 618 | def main():
# points = [[False for i in range(5001)] for j in range(5001)]
while True:
n = int(eval(input()))
if not n:
break
ps = []
dic = {}
for i in range(n):
x, y = list(map(int, input().split()))
dic[(x, y)] = 1
# point... | def main():
while True:
n = int(eval(input()))
if not n:
break
ps = []
dic = {}
for i in range(n):
x, y = list(map(int, input().split()))
dic[(x, y)] = 1
ps.append((x, y))
ans = 0
for i in range(n):
f... | false | 5.555556 | [
"- # points = [[False for i in range(5001)] for j in range(5001)]",
"- # points[x][y] = True",
"- vx = p2[0] - p1[0]",
"- vy = p2[1] - p1[1]",
"- # if 0 <= p1[0] + vy <= 5000 and 0 <= p1[1] - vx <= 5000 and 0 <= p2[0] + vy <= 5000 and 0 <= p2[1] - ... | false | 0.039836 | 0.040216 | 0.990555 | [
"s207111064",
"s294427625"
] |
u958693198 | p02850 | python | s664625712 | s690161642 | 420 | 383 | 30,860 | 27,732 | Accepted | Accepted | 8.81 | import sys
input = sys.stdin.readline
N = int(eval(input()))
X = [[] for _ in range(N)]
P = [-1] * N
for i in range(N-1):
a, b = list(map(int, input().split()))
X[a-1].append((i, b-1))
#print(X)
P[b-1] = a-1
Q = [(0, -1)]
ANS = [-1] * (N-1)
while Q:
x, c0 = Q.pop()
c = 1
for... | import sys
input = sys.stdin.readline
N = int(eval(input()))
X = [[] for _ in range(N)]
P = [-1] * N
for i in range(N-1):
a, b = list(map(int, input().split()))
X[a-1].append((i, b-1))
#print(X)
#P[b-1] = a-1
#print(X)
Q = [(0, -1)]
ANS = [-1] * (N-1)
maxc = 0
while Q:
x, c0 = Q.pop... | 25 | 28 | 464 | 508 | import sys
input = sys.stdin.readline
N = int(eval(input()))
X = [[] for _ in range(N)]
P = [-1] * N
for i in range(N - 1):
a, b = list(map(int, input().split()))
X[a - 1].append((i, b - 1))
# print(X)
P[b - 1] = a - 1
Q = [(0, -1)]
ANS = [-1] * (N - 1)
while Q:
x, c0 = Q.pop()
c = 1
for i,... | import sys
input = sys.stdin.readline
N = int(eval(input()))
X = [[] for _ in range(N)]
P = [-1] * N
for i in range(N - 1):
a, b = list(map(int, input().split()))
X[a - 1].append((i, b - 1))
# print(X)
# P[b-1] = a-1
# print(X)
Q = [(0, -1)]
ANS = [-1] * (N - 1)
maxc = 0
while Q:
x, c0 = Q.pop()
... | false | 10.714286 | [
"- P[b - 1] = a - 1",
"+ # P[b-1] = a-1",
"+# print(X)",
"+maxc = 0",
"+ if c > maxc:",
"+ maxc = c",
"-print((max(ANS)))",
"+print(maxc)"
] | false | 0.046567 | 0.046108 | 1.009964 | [
"s664625712",
"s690161642"
] |
u540762794 | p03435 | python | s751099650 | s010076954 | 119 | 28 | 27,120 | 9,100 | Accepted | Accepted | 76.47 | # -*- coding: utf-8 -*-
import numpy as np
# worst order: 101^6 => 10^8
c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
arr_c = np.array(c)
a_max = np.amax(arr_c, axis=1)
b_max = np.amax(arr_c, axis=0)
a = []
b = []
... | # -*- coding: utf-8 -*-
c = [list(map(int, input().split())) for _ in range(3)]
a = [0] * 3
b = [0] * 3
for j in range(3):
b[j] = c[0][j] - a[0]
for i in range(1,3,1):
a[i] = c[i][0] - b[0]
for i in range(3):
for j in range(3):
if c[i][j] != a[i] + b[j]:
print("No")
... | 50 | 20 | 1,318 | 356 | # -*- coding: utf-8 -*-
import numpy as np
# worst order: 101^6 => 10^8
c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
arr_c = np.array(c)
a_max = np.amax(arr_c, axis=1)
b_max = np.amax(arr_c, axis=0)
a = []
b = []
for i in range(3):... | # -*- coding: utf-8 -*-
c = [list(map(int, input().split())) for _ in range(3)]
a = [0] * 3
b = [0] * 3
for j in range(3):
b[j] = c[0][j] - a[0]
for i in range(1, 3, 1):
a[i] = c[i][0] - b[0]
for i in range(3):
for j in range(3):
if c[i][j] != a[i] + b[j]:
print("No")
exit()
... | false | 60 | [
"-import numpy as np",
"-",
"-# worst order: 101^6 => 10^8",
"-c = []",
"-c.append(list(map(int, input().split())))",
"-c.append(list(map(int, input().split())))",
"-c.append(list(map(int, input().split())))",
"-arr_c = np.array(c)",
"-a_max = np.amax(arr_c, axis=1)",
"-b_max = np.amax(arr_c, axis... | false | 0.223581 | 0.036499 | 6.125656 | [
"s751099650",
"s010076954"
] |
u124498235 | p02713 | python | s842176409 | s575113461 | 1,332 | 1,169 | 10,428 | 9,184 | Accepted | Accepted | 12.24 | n = int(eval(input()))
import math
from fractions import gcd
s = 0
for i in range(1,n+1):
for j in range(1,n+1):
x = math.gcd(i,j)
for k in range(1,n+1):
s += math.gcd(x,k)
print (s) | from math import gcd
n = int(eval(input()))
s = 0
for i in range(1,n+1):
for j in range(1,n+1):
x = gcd(i,j)
for k in range(1,n+1):
s += gcd(x,k)
print (s) | 10 | 9 | 193 | 165 | n = int(eval(input()))
import math
from fractions import gcd
s = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
x = math.gcd(i, j)
for k in range(1, n + 1):
s += math.gcd(x, k)
print(s)
| from math import gcd
n = int(eval(input()))
s = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
x = gcd(i, j)
for k in range(1, n + 1):
s += gcd(x, k)
print(s)
| false | 10 | [
"+from math import gcd",
"+",
"-import math",
"-from fractions import gcd",
"-",
"- x = math.gcd(i, j)",
"+ x = gcd(i, j)",
"- s += math.gcd(x, k)",
"+ s += gcd(x, k)"
] | false | 0.006772 | 0.141651 | 0.047806 | [
"s842176409",
"s575113461"
] |
u057109575 | p02726 | python | s182038508 | s460725783 | 368 | 142 | 49,628 | 75,076 | Accepted | Accepted | 61.41 | N, X, Y = list(map(int, input().split()))
from collections import defaultdict
ans = defaultdict(int)
for i in range(N):
for j in range(i + 1, N):
idx = min(j - i, abs(j + 1 - Y) + 1 + abs(X - i - 1))
ans[idx] += 1
for i in range(1, N):
print((ans[i]))
|
from collections import defaultdict
N, X, Y = list(map(int, input().split()))
ctr = defaultdict(int)
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
d = min(j - i, abs(i - X) + 1 + abs(j - Y))
ctr[d] += 1
for i in range(1, N):
print((ctr[i]))
| 11 | 14 | 288 | 285 | N, X, Y = list(map(int, input().split()))
from collections import defaultdict
ans = defaultdict(int)
for i in range(N):
for j in range(i + 1, N):
idx = min(j - i, abs(j + 1 - Y) + 1 + abs(X - i - 1))
ans[idx] += 1
for i in range(1, N):
print((ans[i]))
| from collections import defaultdict
N, X, Y = list(map(int, input().split()))
ctr = defaultdict(int)
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
d = min(j - i, abs(i - X) + 1 + abs(j - Y))
ctr[d] += 1
for i in range(1, N):
print((ctr[i]))
| false | 21.428571 | [
"-N, X, Y = list(map(int, input().split()))",
"-ans = defaultdict(int)",
"-for i in range(N):",
"- for j in range(i + 1, N):",
"- idx = min(j - i, abs(j + 1 - Y) + 1 + abs(X - i - 1))",
"- ans[idx] += 1",
"+N, X, Y = list(map(int, input().split()))",
"+ctr = defaultdict(int)",
"+for... | false | 0.034581 | 0.044003 | 0.785861 | [
"s182038508",
"s460725783"
] |
u102795616 | p02984 | python | s965181530 | s418042573 | 231 | 212 | 14,152 | 14,092 | Accepted | Accepted | 8.23 | N = int(input())
A = [int(i) for i in input().split()]
a = sum(A)
i = 1
while i < N:
a -= A[i] * 2
i += 2
print(str(a) + ' ', end='')
i = 1
while i < N:
a = A[i - 1] * 2 - a
print(str(a) + ' ', end='')
i += 1
| N = int(input())
A = [int(i) for i in input().split()]
a = sum(A)
i = 1
while i < N:
a -= A[i] * 2
i += 2
print(a, end=' ')
i = 1
while i < N:
a = A[i - 1] * 2 - a
print(a, end=' ')
i += 1
| 13 | 13 | 225 | 205 | N = int(input())
A = [int(i) for i in input().split()]
a = sum(A)
i = 1
while i < N:
a -= A[i] * 2
i += 2
print(str(a) + " ", end="")
i = 1
while i < N:
a = A[i - 1] * 2 - a
print(str(a) + " ", end="")
i += 1
| N = int(input())
A = [int(i) for i in input().split()]
a = sum(A)
i = 1
while i < N:
a -= A[i] * 2
i += 2
print(a, end=" ")
i = 1
while i < N:
a = A[i - 1] * 2 - a
print(a, end=" ")
i += 1
| false | 0 | [
"-print(str(a) + \" \", end=\"\")",
"+print(a, end=\" \")",
"- print(str(a) + \" \", end=\"\")",
"+ print(a, end=\" \")"
] | false | 0.100941 | 0.008677 | 11.633687 | [
"s965181530",
"s418042573"
] |
u747602774 | p03834 | python | s770892945 | s980851004 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | s=input().split(',')
print((s[0],s[1],s[2])) | S = input().split(',')
print((' '.join(S)))
| 2 | 2 | 43 | 43 | s = input().split(",")
print((s[0], s[1], s[2]))
| S = input().split(",")
print((" ".join(S)))
| false | 0 | [
"-s = input().split(\",\")",
"-print((s[0], s[1], s[2]))",
"+S = input().split(\",\")",
"+print((\" \".join(S)))"
] | false | 0.103177 | 0.046807 | 2.204306 | [
"s770892945",
"s980851004"
] |
u312025627 | p03860 | python | s743537138 | s200604170 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | a,b,c = (i for i in input().split())
print((a[0]+b[0]+c[0])) | def main():
a = [i for i in input().split()]
print(a[0][0], a[1][0], a[2][0], sep="")
if __name__ == '__main__':
main()
| 2 | 7 | 59 | 140 | a, b, c = (i for i in input().split())
print((a[0] + b[0] + c[0]))
| def main():
a = [i for i in input().split()]
print(a[0][0], a[1][0], a[2][0], sep="")
if __name__ == "__main__":
main()
| false | 71.428571 | [
"-a, b, c = (i for i in input().split())",
"-print((a[0] + b[0] + c[0]))",
"+def main():",
"+ a = [i for i in input().split()]",
"+ print(a[0][0], a[1][0], a[2][0], sep=\"\")",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.084992 | 0.03543 | 2.398864 | [
"s743537138",
"s200604170"
] |
u077291787 | p02928 | python | s023903277 | s533992587 | 46 | 40 | 10,284 | 9,364 | Accepted | Accepted | 13.04 | # B - Kleene Inversion
from typing import Optional, Sequence
class BinaryIndexedTree:
"""Binary Indexed Tree (Fenwick Tree)
Each operation runs in O(logN).
References:
http://hos.ac/slides/20140319_bit.pdf
"""
__slots__ = ["_size", "_tree", "is_zero_origin"]
def __init... | # jsc2019-qualB - Kleene Inversion
class BIT: # Binary Indexed Tree (Fenwick Tree)
def __init__(self, lim):
self.size = lim
self.tree = [0] * (lim + 1) # 1-idx
def add(self, i, x): # add x to tree[i], O(logN)
while i <= self.size:
self.tree[i] += x
i ... | 70 | 41 | 2,003 | 1,100 | # B - Kleene Inversion
from typing import Optional, Sequence
class BinaryIndexedTree:
"""Binary Indexed Tree (Fenwick Tree)
Each operation runs in O(logN).
References:
http://hos.ac/slides/20140319_bit.pdf
"""
__slots__ = ["_size", "_tree", "is_zero_origin"]
def __init__(
sel... | # jsc2019-qualB - Kleene Inversion
class BIT: # Binary Indexed Tree (Fenwick Tree)
def __init__(self, lim):
self.size = lim
self.tree = [0] * (lim + 1) # 1-idx
def add(self, i, x): # add x to tree[i], O(logN)
while i <= self.size:
self.tree[i] += x
i += i & -i... | false | 41.428571 | [
"-# B - Kleene Inversion",
"-from typing import Optional, Sequence",
"+# jsc2019-qualB - Kleene Inversion",
"+class BIT: # Binary Indexed Tree (Fenwick Tree)",
"+ def __init__(self, lim):",
"+ self.size = lim",
"+ self.tree = [0] * (lim + 1) # 1-idx",
"+ def add(self, i, x): # a... | false | 0.160741 | 0.086326 | 1.86201 | [
"s023903277",
"s533992587"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.