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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u411203878 | p02627 | python | s040741984 | s873231083 | 73 | 63 | 61,772 | 61,876 | Accepted | Accepted | 13.7 | check_a = [chr(ord('a') + i) for i in range(26)]
s=eval(input())
if s in check_a:
print('a')
else:
print('A') | small = [chr(ord('a') + i) for i in range(26)]
s=eval(input())
if s in small:
print('a')
else:
print('A') | 8 | 8 | 120 | 116 | check_a = [chr(ord("a") + i) for i in range(26)]
s = eval(input())
if s in check_a:
print("a")
else:
print("A")
| small = [chr(ord("a") + i) for i in range(26)]
s = eval(input())
if s in small:
print("a")
else:
print("A")
| false | 0 | [
"-check_a = [chr(ord(\"a\") + i) for i in range(26)]",
"+small = [chr(ord(\"a\") + i) for i in range(26)]",
"-if s in check_a:",
"+if s in small:"
] | false | 0.044231 | 0.037607 | 1.176136 | [
"s040741984",
"s873231083"
] |
u535803878 | p02925 | python | s618529734 | s509270249 | 745 | 616 | 180,108 | 167,764 | Accepted | Accepted | 17.32 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
a = [list([int(x)-1 for x in input().split()]) for _ in range(n)]
N = n*(n-1)//2
index = [[0]*(n) for i in range(n)]
ind = 0
from collections i... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
a = [list([int(x)-1 for x in input().split()]) for _ in range(n)]
N = n*(n-1)//2
index = [[0]*(n) for i in range(n)]
ind = 0
from collections i... | 64 | 64 | 1,544 | 1,549 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
a = [list([int(x) - 1 for x in input().split()]) for _ in range(n)]
N = n * (n - 1) // 2
index = [[0] * (n) for i in range(n)]
ind = 0
from collections im... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
a = [list([int(x) - 1 for x in input().split()]) for _ in range(n)]
N = n * (n - 1) // 2
index = [[0] * (n) for i in range(n)]
ind = 0
from collections im... | false | 0 | [
"-ns = defaultdict(list)",
"+ns = [[] for _ in range(N)]"
] | false | 0.06892 | 0.043655 | 1.578739 | [
"s618529734",
"s509270249"
] |
u261103969 | p02613 | python | s445801412 | s187591695 | 170 | 146 | 69,840 | 16,508 | Accepted | Accepted | 14.12 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
from collections import Counter
n = int(readline())
cnt = Counter()
for i in range(n):
s = eval(input())
cnt[s] += 1
print(("AC x {}".format(cn... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
counter = Counter(s)
output = ['AC', 'WA', 'TLE', 'RE']
for key in output:
print(f'{key} x {counter[key]}')
| 24 | 9 | 489 | 203 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
from collections import Counter
n = int(readline())
cnt = Counter()
for i in range(n):
s = eval(input())
cnt[s] += 1
print(("AC x {}".format(cnt["AC"])))
print... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
counter = Counter(s)
output = ["AC", "WA", "TLE", "RE"]
for key in output:
print(f"{key} x {counter[key]}")
| false | 62.5 | [
"-import sys",
"+from collections import Counter",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- from collections import Counter",
"-",
"- n = int(readline())",
"- cnt = Counter()",
"- ... | false | 0.150331 | 0.121991 | 1.23231 | [
"s445801412",
"s187591695"
] |
u816631826 | p02766 | python | s775777070 | s620943417 | 25 | 17 | 3,772 | 3,064 | Accepted | Accepted | 32 | import string
d = string.digits + string.ascii_letters
def con(x, base):
if x < 0:
sign = -1
elif x == 0:
return d[0]
else:
sign = 1
x *= sign
digits = []
while x:
digits.append(d[int(x % base)])
x = int(x / base)
if sign < 0:
... | n,k = list(map(int,input().split()))
cnt = 1
while(n >= k):
cnt += 1
n //= k
print (cnt) | 26 | 6 | 466 | 101 | import string
d = string.digits + string.ascii_letters
def con(x, base):
if x < 0:
sign = -1
elif x == 0:
return d[0]
else:
sign = 1
x *= sign
digits = []
while x:
digits.append(d[int(x % base)])
x = int(x / base)
if sign < 0:
digits.append(... | n, k = list(map(int, input().split()))
cnt = 1
while n >= k:
cnt += 1
n //= k
print(cnt)
| false | 76.923077 | [
"-import string",
"-",
"-d = string.digits + string.ascii_letters",
"-",
"-",
"-def con(x, base):",
"- if x < 0:",
"- sign = -1",
"- elif x == 0:",
"- return d[0]",
"- else:",
"- sign = 1",
"- x *= sign",
"- digits = []",
"- while x:",
"- d... | false | 0.046287 | 0.10642 | 0.434943 | [
"s775777070",
"s620943417"
] |
u994988729 | p02852 | python | s963445758 | s104952681 | 227 | 204 | 51,056 | 13,668 | Accepted | Accepted | 10.13 | N, M = map(int, input().split())
S = input()
dp = [-1] * (N + M + 1)
dp[N] = 0
pos = N
while pos > 0:
dist = dp[pos]
tmp = pos
for i in range(1, M + 1):
if pos - i < 0:
break
if S[pos - i] == "0":
dp[pos - i] = dist + 1
tmp = pos - i
... | N, M = list(map(int, input().split()))
S = eval(input())
S = S[::-1]
dp = [-1] * (N+1)
dp[0] = 0
pos = 0
while pos < N:
p = pos
update = False
for i in range(1, M + 1):
if p + i > N:
break
if S[p + i] == "0":
update = True
pos = p + i... | 37 | 43 | 644 | 689 | N, M = map(int, input().split())
S = input()
dp = [-1] * (N + M + 1)
dp[N] = 0
pos = N
while pos > 0:
dist = dp[pos]
tmp = pos
for i in range(1, M + 1):
if pos - i < 0:
break
if S[pos - i] == "0":
dp[pos - i] = dist + 1
tmp = pos - i
if pos == tmp:
... | N, M = list(map(int, input().split()))
S = eval(input())
S = S[::-1]
dp = [-1] * (N + 1)
dp[0] = 0
pos = 0
while pos < N:
p = pos
update = False
for i in range(1, M + 1):
if p + i > N:
break
if S[p + i] == "0":
update = True
pos = p + i
dp[pos]... | false | 13.953488 | [
"-N, M = map(int, input().split())",
"-S = input()",
"-dp = [-1] * (N + M + 1)",
"-dp[N] = 0",
"-pos = N",
"-while pos > 0:",
"- dist = dp[pos]",
"- tmp = pos",
"+N, M = list(map(int, input().split()))",
"+S = eval(input())",
"+S = S[::-1]",
"+dp = [-1] * (N + 1)",
"+dp[0] = 0",
"+po... | false | 0.127162 | 0.16025 | 0.793523 | [
"s963445758",
"s104952681"
] |
u185802209 | p03221 | python | s327947265 | s420223874 | 833 | 690 | 57,928 | 30,472 | Accepted | Accepted | 17.17 | n,m=list(map(int,input().split()))
l=[{} for k in range(n)]
for i in range(m):
p,y=list(map(int,input().split()))
l[p-1][y]=i
for k in range(n):
l[k]=sorted(list(l[k].items()), key=lambda x:x[0])
s=[0]*m
for k in range(n):
for r, p in enumerate(l[k]):
s[p[1]]=[k,r]
for i in s:
pr... | n,m=list(map(int,input().split()))
l=[[] for i in range(n)]
for i in range(m):
p,y=input().split()
l[int(p)-1].append(y.zfill(10)+str(i).zfill(6))
for i in range(n):
l[i].sort()
s=[0]*m
for i in range(n):
for j in range(len(l[i])):
s[int(l[i][j][10:16])]=str(i+1).zfill(6)+str(j+1).zfil... | 13 | 13 | 341 | 346 | n, m = list(map(int, input().split()))
l = [{} for k in range(n)]
for i in range(m):
p, y = list(map(int, input().split()))
l[p - 1][y] = i
for k in range(n):
l[k] = sorted(list(l[k].items()), key=lambda x: x[0])
s = [0] * m
for k in range(n):
for r, p in enumerate(l[k]):
s[p[1]] = [k, r]
for i ... | n, m = list(map(int, input().split()))
l = [[] for i in range(n)]
for i in range(m):
p, y = input().split()
l[int(p) - 1].append(y.zfill(10) + str(i).zfill(6))
for i in range(n):
l[i].sort()
s = [0] * m
for i in range(n):
for j in range(len(l[i])):
s[int(l[i][j][10:16])] = str(i + 1).zfill(6) + ... | false | 0 | [
"-l = [{} for k in range(n)]",
"+l = [[] for i in range(n)]",
"- p, y = list(map(int, input().split()))",
"- l[p - 1][y] = i",
"-for k in range(n):",
"- l[k] = sorted(list(l[k].items()), key=lambda x: x[0])",
"+ p, y = input().split()",
"+ l[int(p) - 1].append(y.zfill(10) + str(i).zfill... | false | 0.042784 | 0.042788 | 0.9999 | [
"s327947265",
"s420223874"
] |
u733738237 | p03835 | python | s324565873 | s251137678 | 1,777 | 1,635 | 188,688 | 189,072 | Accepted | Accepted | 7.99 | k,s=list(map(int,input().split()))
print(([x+y+s-(x+y) for x in range(k+1) for y in range(k+1) if 0<= s-x-y <= k].count(s))) | k,s=[int(i) for i in input().split()]
print(([x+y+s-(x+y) for x in range(k+1) for y in range(k+1) if 0<= s-x-y <= k].count(s))) | 2 | 2 | 123 | 126 | k, s = list(map(int, input().split()))
print(
(
[
x + y + s - (x + y)
for x in range(k + 1)
for y in range(k + 1)
if 0 <= s - x - y <= k
].count(s)
)
)
| k, s = [int(i) for i in input().split()]
print(
(
[
x + y + s - (x + y)
for x in range(k + 1)
for y in range(k + 1)
if 0 <= s - x - y <= k
].count(s)
)
)
| false | 0 | [
"-k, s = list(map(int, input().split()))",
"+k, s = [int(i) for i in input().split()]"
] | false | 0.039539 | 0.042525 | 0.929788 | [
"s324565873",
"s251137678"
] |
u936985471 | p03280 | python | s195905516 | s964059059 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b=list(map(int,input().split()))
print((a*b-a-b+1)) | A,B=list(map(int,input().split()))
print((A*B-A-B+1)) | 2 | 2 | 46 | 46 | a, b = list(map(int, input().split()))
print((a * b - a - b + 1))
| A, B = list(map(int, input().split()))
print((A * B - A - B + 1))
| false | 0 | [
"-a, b = list(map(int, input().split()))",
"-print((a * b - a - b + 1))",
"+A, B = list(map(int, input().split()))",
"+print((A * B - A - B + 1))"
] | false | 0.043583 | 0.041482 | 1.050648 | [
"s195905516",
"s964059059"
] |
u143509139 | p03325 | python | s298322743 | s512340614 | 122 | 79 | 4,148 | 4,148 | Accepted | Accepted | 35.25 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while (1):
if i % 2 == 1:
break
i /= 2
ans += 1
print(ans) | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for x in a:
while(True):
if x & 1:
break
x >>= 1
ans += 1
print(ans) | 10 | 10 | 180 | 178 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while 1:
if i % 2 == 1:
break
i /= 2
ans += 1
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for x in a:
while True:
if x & 1:
break
x >>= 1
ans += 1
print(ans)
| false | 0 | [
"-for i in a:",
"- while 1:",
"- if i % 2 == 1:",
"+for x in a:",
"+ while True:",
"+ if x & 1:",
"- i /= 2",
"+ x >>= 1"
] | false | 0.07074 | 0.081895 | 0.863786 | [
"s298322743",
"s512340614"
] |
u138486156 | p03038 | python | s866864027 | s978445976 | 1,222 | 967 | 77,080 | 88,428 | Accepted | Accepted | 20.87 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
P = [(A[i], 1) for i in range(N)]
for j in range(M):
B, C = list(map(int, input().split()))
P.append((C, B))
P.sort(reverse=True)
ans, cnt = 0, N
for v, c in P:
use = min(c, cnt)
ans += use*v
cnt -= use
print(ans) | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
CB = [list(map(int, input().split()))[::-1] for _ in range(M)]
CB.sort()
C, B = list(map(list, list(zip(*CB))))
b = B.pop()
c = C.pop()
ans = []
for a in A:
if a < c:
ans.append(c)
b -= 1
else:
... | 13 | 23 | 308 | 461 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
P = [(A[i], 1) for i in range(N)]
for j in range(M):
B, C = list(map(int, input().split()))
P.append((C, B))
P.sort(reverse=True)
ans, cnt = 0, N
for v, c in P:
use = min(c, cnt)
ans += use * v
cnt -= use
print(ans)
| N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
CB = [list(map(int, input().split()))[::-1] for _ in range(M)]
CB.sort()
C, B = list(map(list, list(zip(*CB))))
b = B.pop()
c = C.pop()
ans = []
for a in A:
if a < c:
ans.append(c)
b -= 1
else:
ans.append... | false | 43.478261 | [
"-P = [(A[i], 1) for i in range(N)]",
"-for j in range(M):",
"- B, C = list(map(int, input().split()))",
"- P.append((C, B))",
"-P.sort(reverse=True)",
"-ans, cnt = 0, N",
"-for v, c in P:",
"- use = min(c, cnt)",
"- ans += use * v",
"- cnt -= use",
"-print(ans)",
"+A.sort()",
... | false | 0.05836 | 0.147384 | 0.395974 | [
"s866864027",
"s978445976"
] |
u906428167 | p02822 | python | s507826499 | s357290145 | 673 | 608 | 91,992 | 90,616 | Accepted | Accepted | 9.66 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
mod = 10**9+7
n = int(eval(input()))
g = [[] for _ in range(n)]
pow2 = [0 for _ in range(n+1)]
pow2[0] = 1
for i in range(n):
pow2[i+1] = pow2[i]*2 % mod
for _ in range(n-1):
a, b = list(map(int, input().split()))
g[a-1... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
mod = 10**9+7
n = int(eval(input()))
g = [[] for _ in range(n)]
pow2 = [0 for _ in range(n+1)]
pow2[0] = 1
for i in range(n):
pow2[i+1] = pow2[i]*2 % mod
for _ in range(n-1):
a, b = list(map(int, input().split()))
g[a-1... | 66 | 92 | 1,329 | 2,145 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
g = [[] for _ in range(n)]
pow2 = [0 for _ in range(n + 1)]
pow2[0] = 1
for i in range(n):
pow2[i + 1] = pow2[i] * 2 % mod
for _ in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
g = [[] for _ in range(n)]
pow2 = [0 for _ in range(n + 1)]
pow2[0] = 1
for i in range(n):
pow2[i + 1] = pow2[i] * 2 % mod
for _ in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(... | false | 28.26087 | [
"-par = [-1] * n",
"-depth = [-1] * n",
"-sizesub = [1 for _ in range(n)]",
"-black = [0 for _ in range(n)]",
"-root = 0",
"-stack = [root]",
"-while stack:",
"- v = stack.pop()",
"- if depth[v] == -1:",
"- if v == root:",
"- depth[v] = 0",
"- else:",
"- ... | false | 0.110865 | 0.047751 | 2.321754 | [
"s507826499",
"s357290145"
] |
u279546122 | p02362 | python | s519670530 | s439548656 | 1,710 | 700 | 8,696 | 8,172 | Accepted | Accepted | 59.06 | from sys import stdin
from collections import deque
V, E, R = [int(x) for x in stdin.readline().split()]
d = {}
tick = False
INF = float('inf')
for i in range(V):
d[i] = INF
d[R] = 0
weight = {}
st = deque([])
for i in range(1, V+1):
for j in range(E):
if i == 1:
s, t, w ... | from sys import stdin
def sp(G,R,V):
d = {}
INF = float('inf')
for i in range(V):
d[i] = INF
d[R] = 0
for i in range(1, V+1):
for (u, v) in list(G.keys()):
if d[v] > d[u] + G[u, v]:
d[v] = d[u] + G[u, v]
if i == V:
... | 36 | 29 | 828 | 675 | from sys import stdin
from collections import deque
V, E, R = [int(x) for x in stdin.readline().split()]
d = {}
tick = False
INF = float("inf")
for i in range(V):
d[i] = INF
d[R] = 0
weight = {}
st = deque([])
for i in range(1, V + 1):
for j in range(E):
if i == 1:
s, t, w = [int(x) for x i... | from sys import stdin
def sp(G, R, V):
d = {}
INF = float("inf")
for i in range(V):
d[i] = INF
d[R] = 0
for i in range(1, V + 1):
for (u, v) in list(G.keys()):
if d[v] > d[u] + G[u, v]:
d[v] = d[u] + G[u, v]
if i == V:
... | false | 19.444444 | [
"-from collections import deque",
"+",
"+",
"+def sp(G, R, V):",
"+ d = {}",
"+ INF = float(\"inf\")",
"+ for i in range(V):",
"+ d[i] = INF",
"+ d[R] = 0",
"+ for i in range(1, V + 1):",
"+ for (u, v) in list(G.keys()):",
"+ if d[v] > d[u] + G[u, v]:",
... | false | 0.006535 | 0.036798 | 0.177587 | [
"s519670530",
"s439548656"
] |
u431484963 | p02923 | python | s015906658 | s770897871 | 86 | 79 | 14,252 | 15,020 | Accepted | Accepted | 8.14 | n = int(eval(input()))
h = list(map(int,input().split()))
ans = 0
maxi = 0
for i in range(n-1):
if h[i] >= h[i+1]:
ans += 1
else:
maxi = max(ans,maxi)
ans = 0
print((max(maxi,ans))) | n = int(eval(input()))
h = list(map(int,input().split()))
ans = 0
maxi = 0
for i in range(1,n):
if h[i-1] >= h[i]:
ans += 1
else:
maxi = max(ans,maxi)
ans = 0
print((max(maxi,ans))) | 11 | 11 | 215 | 215 | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
maxi = 0
for i in range(n - 1):
if h[i] >= h[i + 1]:
ans += 1
else:
maxi = max(ans, maxi)
ans = 0
print((max(maxi, ans)))
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
maxi = 0
for i in range(1, n):
if h[i - 1] >= h[i]:
ans += 1
else:
maxi = max(ans, maxi)
ans = 0
print((max(maxi, ans)))
| false | 0 | [
"-for i in range(n - 1):",
"- if h[i] >= h[i + 1]:",
"+for i in range(1, n):",
"+ if h[i - 1] >= h[i]:"
] | false | 0.036035 | 0.067548 | 0.533472 | [
"s015906658",
"s770897871"
] |
u102461423 | p02948 | python | s601486269 | s391271405 | 236 | 203 | 18,628 | 27,064 | Accepted | Accepted | 13.98 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from heapq import heappush, heappushpop
N,M = list(map(int,input().split()))
tasks = [[] for _ in range(M+1)] # 価値、締切
for _ in range(N):
a,b = list(map(int,input().split()))
if a <= M:
tasks[M-a].append(b)
q = []
for d... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappop
N,M = list(map(int,readline().split()))
m = list(map(int,read().split()))
AB = [[] for _ in range(M+1)] # A に対する B
for a,b in zip(m,m):
if a <= M:
... | 23 | 27 | 485 | 502 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from heapq import heappush, heappushpop
N, M = list(map(int, input().split()))
tasks = [[] for _ in range(M + 1)] # 価値、締切
for _ in range(N):
a, b = list(map(int, input().split()))
if a <= M:
tasks[M - a].append(b)
q = []
for day in ra... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappop
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
AB = [[] for _ in range(M + 1)] # A に対する B
for a, b in zip(m, m):
if a <= M:
... | false | 14.814815 | [
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-from heapq import heappush, heappushpop",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+from heapq import heappush, heappop",
"-N, M = list(map(int, input().split(... | false | 0.056566 | 0.077247 | 0.73227 | [
"s601486269",
"s391271405"
] |
u631277801 | p03863 | python | s078077354 | s202712651 | 54 | 17 | 3,316 | 3,316 | Accepted | Accepted | 68.52 | def judge(S:str) -> str:
lenS = len(S)
# 1.両端が同じなら、残り文字3になるまで続く
if S[0] == S[-1]:
if (lenS-3)%2 == 1:
return "First"
else:
return "Second"
# 2.両端が違うなら、最初に交互になっている両端の文字が最終状態
else:
last = S[0]
flag = 1
for i in range... | S = eval(input())
# 最初の状態
if len(S)%2 == 1:
start = 1
else:
start = 0
# 最後の状態
if S[0] == S[-1]:
last = 1
else:
last = 0
if (start+last)%2 == 1:
print("First")
else:
print("Second") | 32 | 18 | 797 | 226 | def judge(S: str) -> str:
lenS = len(S)
# 1.両端が同じなら、残り文字3になるまで続く
if S[0] == S[-1]:
if (lenS - 3) % 2 == 1:
return "First"
else:
return "Second"
# 2.両端が違うなら、最初に交互になっている両端の文字が最終状態
else:
last = S[0]
flag = 1
for i in range(1, lenS):
... | S = eval(input())
# 最初の状態
if len(S) % 2 == 1:
start = 1
else:
start = 0
# 最後の状態
if S[0] == S[-1]:
last = 1
else:
last = 0
if (start + last) % 2 == 1:
print("First")
else:
print("Second")
| false | 43.75 | [
"-def judge(S: str) -> str:",
"- lenS = len(S)",
"- # 1.両端が同じなら、残り文字3になるまで続く",
"- if S[0] == S[-1]:",
"- if (lenS - 3) % 2 == 1:",
"- return \"First\"",
"- else:",
"- return \"Second\"",
"- # 2.両端が違うなら、最初に交互になっている両端の文字が最終状態",
"- else:",
"- ... | false | 0.036806 | 0.041094 | 0.89567 | [
"s078077354",
"s202712651"
] |
u590057656 | p02552 | python | s473324413 | s112430057 | 36 | 29 | 9,000 | 9,132 | Accepted | Accepted | 19.44 | print(('10'[int(eval(input()))])) | import sys
print(('10'[int(sys.stdin.buffer.readline())])) | 1 | 2 | 25 | 57 | print(("10"[int(eval(input()))]))
| import sys
print(("10"[int(sys.stdin.buffer.readline())]))
| false | 50 | [
"-print((\"10\"[int(eval(input()))]))",
"+import sys",
"+",
"+print((\"10\"[int(sys.stdin.buffer.readline())]))"
] | false | 0.039026 | 0.038349 | 1.017672 | [
"s473324413",
"s112430057"
] |
u912237403 | p00031 | python | s187300668 | s012526252 | 20 | 10 | 4,184 | 4,204 | Accepted | Accepted | 50 | while True:
try:
tmp = eval(input())
except:
break
i=1
while tmp>0:
if tmp%2 ==1: print(i, end=' ')
tmp/=2
i*=2
print() | W=[1,2,4,8,16,32,64,128,256,512]
import sys
for s in sys.stdin:
B=format(int(s),'b')[::-1]
i=0
for e in B:
if e=="1": print(W[i], end=' ')
i+=1
print() | 11 | 9 | 172 | 180 | while True:
try:
tmp = eval(input())
except:
break
i = 1
while tmp > 0:
if tmp % 2 == 1:
print(i, end=" ")
tmp /= 2
i *= 2
print()
| W = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
import sys
for s in sys.stdin:
B = format(int(s), "b")[::-1]
i = 0
for e in B:
if e == "1":
print(W[i], end=" ")
i += 1
print()
| false | 18.181818 | [
"-while True:",
"- try:",
"- tmp = eval(input())",
"- except:",
"- break",
"- i = 1",
"- while tmp > 0:",
"- if tmp % 2 == 1:",
"- print(i, end=\" \")",
"- tmp /= 2",
"- i *= 2",
"+W = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]",
"+impor... | false | 0.059084 | 0.037949 | 1.556917 | [
"s187300668",
"s012526252"
] |
u018679195 | p03162 | python | s500242565 | s488103419 | 645 | 269 | 74,348 | 105,980 | Accepted | Accepted | 58.29 | def main():
n = int(eval(input()))
matrix = []
tb = [[0] * 4 for _ in range(n + 1)]
for _ in range(n):
matrix.append([int(e) for e in input().split()])
for i in range(1, n + 1):
for j in range(1, 4):
for l in range(1, 4):
if j == l: continue... | def main():
n, factor = getInputs()
points = []
for i in range(n):
points.append([0] * 3)
# points[day][pile]
for pile in range(3):
points[0][pile] = factor[0][pile]
for day in range(1, n):
points[day][0] = max(points[day - 1][1], points[day - 1][2]) + fact... | 18 | 28 | 478 | 724 | def main():
n = int(eval(input()))
matrix = []
tb = [[0] * 4 for _ in range(n + 1)]
for _ in range(n):
matrix.append([int(e) for e in input().split()])
for i in range(1, n + 1):
for j in range(1, 4):
for l in range(1, 4):
if j == l:
con... | def main():
n, factor = getInputs()
points = []
for i in range(n):
points.append([0] * 3)
# points[day][pile]
for pile in range(3):
points[0][pile] = factor[0][pile]
for day in range(1, n):
points[day][0] = max(points[day - 1][1], points[day - 1][2]) + factor[day][0]
... | false | 35.714286 | [
"- n = int(eval(input()))",
"- matrix = []",
"- tb = [[0] * 4 for _ in range(n + 1)]",
"- for _ in range(n):",
"- matrix.append([int(e) for e in input().split()])",
"- for i in range(1, n + 1):",
"- for j in range(1, 4):",
"- for l in range(1, 4):",
"- ... | false | 0.035796 | 0.035296 | 1.014158 | [
"s500242565",
"s488103419"
] |
u230621983 | p03634 | python | s118673168 | s929822778 | 1,460 | 696 | 43,308 | 43,440 | Accepted | Accepted | 52.33 | n = int(eval(input()))
adj = [[] for _ in range(n)] # adjacence(隣接)の略
for (a,b,c) in (list(map(int, input().split())) for _ in range(n-1)):
adj[a-1].append((b-1, c))
adj[b-1].append((a-1, c))
q, k = list(map(int, input().split()))
k -= 1
dist = [-1]*n # 経由地から各頂点までのコスト
dist[k] = 0 # 経由地kをスタート地点とする... | import sys
input = sys.stdin.readline
n = int(eval(input()))
adj = [[] for _ in range(n)] # adjacence(隣接)の略
for (a,b,c) in (list(map(int, input().split())) for _ in range(n-1)):
adj[a-1].append((b-1, c))
adj[b-1].append((a-1, c))
q, k = list(map(int, input().split()))
k -= 1
dist = [-1]*n # 経由地... | 25 | 28 | 718 | 760 | n = int(eval(input()))
adj = [[] for _ in range(n)] # adjacence(隣接)の略
for (a, b, c) in (list(map(int, input().split())) for _ in range(n - 1)):
adj[a - 1].append((b - 1, c))
adj[b - 1].append((a - 1, c))
q, k = list(map(int, input().split()))
k -= 1
dist = [-1] * n # 経由地から各頂点までのコスト
dist[k] = 0 # 経由地kをスタート地点と... | import sys
input = sys.stdin.readline
n = int(eval(input()))
adj = [[] for _ in range(n)] # adjacence(隣接)の略
for (a, b, c) in (list(map(int, input().split())) for _ in range(n - 1)):
adj[a - 1].append((b - 1, c))
adj[b - 1].append((a - 1, c))
q, k = list(map(int, input().split()))
k -= 1
dist = [-1] * n # 経由地... | false | 10.714286 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.101923 | 0.183414 | 0.555697 | [
"s118673168",
"s929822778"
] |
u609407244 | p02385 | python | s235048990 | s627767766 | 40 | 30 | 6,764 | 6,740 | Accepted | Accepted | 25 | import itertools
def roll(dice, commands):
for command in commands:
if command == 'N':
dice[0], dice[1], dice[5], dice[4] = dice[1], dice[5], dice[4], dice[0]
elif command == 'S':
dice[0], dice[1], dice[5], dice[4] = dice[4], dice[0], dice[1], dice[5]
elif ... | import itertools
def roll(dice, commands):
for command in commands:
if command == 'N':
dice[0], dice[1], dice[5], dice[4] = dice[1], dice[5], dice[4], dice[0]
elif command == 'W':
dice[0], dice[3], dice[5], dice[2] = dice[2], dice[0], dice[3], dice[5]
def solve... | 25 | 26 | 868 | 741 | import itertools
def roll(dice, commands):
for command in commands:
if command == "N":
dice[0], dice[1], dice[5], dice[4] = dice[1], dice[5], dice[4], dice[0]
elif command == "S":
dice[0], dice[1], dice[5], dice[4] = dice[4], dice[0], dice[1], dice[5]
elif command =... | import itertools
def roll(dice, commands):
for command in commands:
if command == "N":
dice[0], dice[1], dice[5], dice[4] = dice[1], dice[5], dice[4], dice[0]
elif command == "W":
dice[0], dice[3], dice[5], dice[2] = dice[2], dice[0], dice[3], dice[5]
def solve():
A =... | false | 3.846154 | [
"- elif command == \"S\":",
"- dice[0], dice[1], dice[5], dice[4] = dice[4], dice[0], dice[1], dice[5]",
"- elif command == \"E\":",
"- dice[0], dice[3], dice[5], dice[2] = dice[3], dice[5], dice[2], dice[0]",
"-A = list(map(int, input().split()))",
"-B = list(map(int, ... | false | 0.103695 | 0.075057 | 1.381552 | [
"s235048990",
"s627767766"
] |
u197955752 | p02861 | python | s309948271 | s000182518 | 429 | 17 | 8,180 | 3,188 | Accepted | Accepted | 96.04 | from itertools import permutations
N = int(eval(input()))
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = [int(x) for x in input().split()]
listP = list(permutations(list(range(N)), N))
sum_d = 0
for p in listP:
for i in range(1, N):
sum_d += ((x[p[i]] - x[p[i - 1]]) ** 2 + (y[p[i]... | N = int(eval(input()))
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = [int(x) for x in input().split()]
sum_d = 0
for i in range(N):
for j in range(i + 1, N):
sum_d += ((x[j] - x[i]) ** 2 + (y[j] - y[i]) ** 2) ** 0.5
# (sum_d / NC2) * (N - 1)
print((2 * sum_d / N)) | 15 | 13 | 366 | 296 | from itertools import permutations
N = int(eval(input()))
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = [int(x) for x in input().split()]
listP = list(permutations(list(range(N)), N))
sum_d = 0
for p in listP:
for i in range(1, N):
sum_d += ((x[p[i]] - x[p[i - 1]]) ** 2 + (y[p[i]] - y[p[i - 1... | N = int(eval(input()))
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = [int(x) for x in input().split()]
sum_d = 0
for i in range(N):
for j in range(i + 1, N):
sum_d += ((x[j] - x[i]) ** 2 + (y[j] - y[i]) ** 2) ** 0.5
# (sum_d / NC2) * (N - 1)
print((2 * sum_d / N))
| false | 13.333333 | [
"-from itertools import permutations",
"-",
"-listP = list(permutations(list(range(N)), N))",
"-for p in listP:",
"- for i in range(1, N):",
"- sum_d += ((x[p[i]] - x[p[i - 1]]) ** 2 + (y[p[i]] - y[p[i - 1]]) ** 2) ** 0.5",
"-print((sum_d / len(listP)))",
"+for i in range(N):",
"+ for j... | false | 0.083608 | 0.00785 | 10.650871 | [
"s309948271",
"s000182518"
] |
u072053884 | p00430 | python | s581418379 | s894216464 | 140 | 110 | 6,360 | 6,520 | Accepted | Accepted | 21.43 | def solve():
ans = []
def square(n, rest, limit):
if rest == 0:
print((*ans))
else:
for i in range(rest, 0, -1):
if i > limit:
continue
ans.append(i)
square(n, rest - i, i)
ans.... | def solve():
answers = []
def square(ans, rest, limit):
if rest == 0:
answers.append(' '.join(map(str, ans)))
else:
for i in range(rest, 0, -1):
if i > limit:
continue
square(ans + [i], rest - i, i)
i... | 20 | 20 | 468 | 478 | def solve():
ans = []
def square(n, rest, limit):
if rest == 0:
print((*ans))
else:
for i in range(rest, 0, -1):
if i > limit:
continue
ans.append(i)
square(n, rest - i, i)
ans.pop()
... | def solve():
answers = []
def square(ans, rest, limit):
if rest == 0:
answers.append(" ".join(map(str, ans)))
else:
for i in range(rest, 0, -1):
if i > limit:
continue
square(ans + [i], rest - i, i)
import sys
... | false | 0 | [
"- ans = []",
"+ answers = []",
"- def square(n, rest, limit):",
"+ def square(ans, rest, limit):",
"- print((*ans))",
"+ answers.append(\" \".join(map(str, ans)))",
"- ans.append(i)",
"- square(n, rest - i, i)",
"- ans.p... | false | 0.114776 | 0.038836 | 2.955387 | [
"s581418379",
"s894216464"
] |
u893063840 | p02883 | python | s700704082 | s786348423 | 581 | 395 | 119,500 | 37,232 | Accepted | Accepted | 32.01 | import sys
sys.setrecursionlimit(10 ** 7)
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
l = -1
r = 10 ** 13
def test(x):
cnt = 0
for ae, fe in ... | import sys
sys.setrecursionlimit(10 ** 7)
import numpy as np
def main():
n, k = list(map(int, input().split()))
a = np.array(input().split(), np.int64)
f = np.array(input().split(), np.int64)
a.sort()
f.sort()
f = f[::-1]
l = -1
r = 10 ** 13
def test(x):
... | 35 | 35 | 592 | 580 | import sys
sys.setrecursionlimit(10**7)
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
l = -1
r = 10**13
def test(x):
cnt = 0
for ae, fe in zip(a, f):
... | import sys
sys.setrecursionlimit(10**7)
import numpy as np
def main():
n, k = list(map(int, input().split()))
a = np.array(input().split(), np.int64)
f = np.array(input().split(), np.int64)
a.sort()
f.sort()
f = f[::-1]
l = -1
r = 10**13
def test(x):
cnt = np.maximum(0, a... | false | 0 | [
"+import numpy as np",
"- a = list(map(int, input().split()))",
"- f = list(map(int, input().split()))",
"+ a = np.array(input().split(), np.int64)",
"+ f = np.array(input().split(), np.int64)",
"- f.sort(reverse=True)",
"+ f.sort()",
"+ f = f[::-1]",
"- cnt = 0",
"- ... | false | 0.129285 | 0.801577 | 0.161289 | [
"s700704082",
"s786348423"
] |
u744920373 | p02936 | python | s198365608 | s814201599 | 1,563 | 1,247 | 89,008 | 104,624 | Accepted | Accepted | 20.22 | import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
de... | import sys
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j... | 50 | 47 | 1,288 | 1,220 | import sys
def ii():
return int(sys.stdin.readline())
def mi():
return map(int, sys.stdin.readline().split())
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j):
return [[ini] ... | import sys
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j):
return [... | false | 6 | [
"- return map(int, sys.stdin.readline().split())",
"+ return list(map(int, sys.stdin.readline().split()))",
"- x[i][0] -= 1",
"- x[i][1] -= 1",
"- adj[x[i][0]].append(x[i][1])",
"- adj[x[i][1]].append(x[i][0])",
"+ adj[x[i][0] - 1].append(x[i][1] - 1)",
"+ ... | false | 0.060872 | 0.044619 | 1.364274 | [
"s198365608",
"s814201599"
] |
u223663729 | p03103 | python | s516660081 | s235773394 | 218 | 153 | 25,828 | 31,600 | Accepted | Accepted | 29.82 | N, M, *A = list(map(int, open(0).read().split()))
*A, = list(zip(*[iter(A)]*2))
A.sort()
ans = 0
for a, b in A:
ans += a*min(b, M)
M -= min(b, M)
if M == 0:
break
print(ans) | N, M, *A = list(map(int, open(0).read().split()))
*A, = list(zip(*[iter(A)]*2))
A.sort()
sun = 0
cost = 0
for a, b in A:
if sun + b <= M:
sun += b
cost += a*b
if sun == M:
print(cost)
break
else:
cost += (M-sun)*a
print(cost)
... | 12 | 18 | 194 | 322 | N, M, *A = list(map(int, open(0).read().split()))
(*A,) = list(zip(*[iter(A)] * 2))
A.sort()
ans = 0
for a, b in A:
ans += a * min(b, M)
M -= min(b, M)
if M == 0:
break
print(ans)
| N, M, *A = list(map(int, open(0).read().split()))
(*A,) = list(zip(*[iter(A)] * 2))
A.sort()
sun = 0
cost = 0
for a, b in A:
if sun + b <= M:
sun += b
cost += a * b
if sun == M:
print(cost)
break
else:
cost += (M - sun) * a
print(cost)
brea... | false | 33.333333 | [
"-ans = 0",
"+sun = 0",
"+cost = 0",
"- ans += a * min(b, M)",
"- M -= min(b, M)",
"- if M == 0:",
"+ if sun + b <= M:",
"+ sun += b",
"+ cost += a * b",
"+ if sun == M:",
"+ print(cost)",
"+ break",
"+ else:",
"+ cost += (M ... | false | 0.119306 | 0.085897 | 1.388933 | [
"s516660081",
"s235773394"
] |
u653837719 | p02599 | python | s142640066 | s690214962 | 1,858 | 1,686 | 230,620 | 232,476 | Accepted | Accepted | 9.26 | import sys
input = sys.stdin.readline
def query(i):
'''
a[0] + a[1] + … + a[i-1] を求める
O(logN)
'''
res = 0
while i > 0:
res += BIT[i]
i -= i & -i
return res
def update(i, x):
'''
a[i-1]にxを加算
O(logN)
'''
while i <= n:
... | import sys
input = sys.stdin.buffer.readline
def query(i):
'''
a[0] + a[1] + … + a[i-1] を求める
O(logN)
'''
res = 0
while i > 0:
res += BIT[i]
i -= i & -i
return res
def update(i, x):
'''
a[i-1]にxを加算
O(logN)
'''
while i <= n:
... | 49 | 49 | 847 | 854 | import sys
input = sys.stdin.readline
def query(i):
"""
a[0] + a[1] + … + a[i-1] を求める
O(logN)
"""
res = 0
while i > 0:
res += BIT[i]
i -= i & -i
return res
def update(i, x):
"""
a[i-1]にxを加算
O(logN)
"""
while i <= n:
BIT[i] += x
i += i ... | import sys
input = sys.stdin.buffer.readline
def query(i):
"""
a[0] + a[1] + … + a[i-1] を求める
O(logN)
"""
res = 0
while i > 0:
res += BIT[i]
i -= i & -i
return res
def update(i, x):
"""
a[i-1]にxを加算
O(logN)
"""
while i <= n:
BIT[i] += x
... | false | 0 | [
"-input = sys.stdin.readline",
"+input = sys.stdin.buffer.readline"
] | false | 0.128058 | 0.048075 | 2.663701 | [
"s142640066",
"s690214962"
] |
u891217808 | p02681 | python | s544554516 | s026969759 | 68 | 60 | 61,572 | 61,884 | Accepted | Accepted | 11.76 | s = eval(input())
t = eval(input())
if t[:-1] == s:
print('Yes')
else:
print('No') | s = eval(input())
t = eval(input())
if s == t[:-1]:
print('Yes')
else:
print('No') | 6 | 6 | 83 | 83 | s = eval(input())
t = eval(input())
if t[:-1] == s:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
if s == t[:-1]:
print("Yes")
else:
print("No")
| false | 0 | [
"-if t[:-1] == s:",
"+if s == t[:-1]:"
] | false | 0.095676 | 0.036319 | 2.63433 | [
"s544554516",
"s026969759"
] |
u983918956 | p03761 | python | s814772833 | s085473818 | 25 | 19 | 3,444 | 3,060 | Accepted | Accepted | 24 | from copy import deepcopy
n = int(eval(input()))
S = [eval(input()) for i in range(n)]
dict_count = {}
for i in range(26):
dict_count[97+i] = 0
def values_return(string):
copy = deepcopy(dict_count)
for e in string:
copy[ord(e)] += 1
return list(copy.values())
S_count = [values_return... | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
ans = ""
for i in range(97,123):
min_count = 51
for e in S:
if e.count(chr(i)) < min_count:
min_count = e.count(chr(i))
ans += chr(i) * min_count
print(ans) | 23 | 10 | 597 | 246 | from copy import deepcopy
n = int(eval(input()))
S = [eval(input()) for i in range(n)]
dict_count = {}
for i in range(26):
dict_count[97 + i] = 0
def values_return(string):
copy = deepcopy(dict_count)
for e in string:
copy[ord(e)] += 1
return list(copy.values())
S_count = [values_return(e) ... | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
ans = ""
for i in range(97, 123):
min_count = 51
for e in S:
if e.count(chr(i)) < min_count:
min_count = e.count(chr(i))
ans += chr(i) * min_count
print(ans)
| false | 56.521739 | [
"-from copy import deepcopy",
"-",
"-dict_count = {}",
"-for i in range(26):",
"- dict_count[97 + i] = 0",
"-",
"-",
"-def values_return(string):",
"- copy = deepcopy(dict_count)",
"- for e in string:",
"- copy[ord(e)] += 1",
"- return list(copy.values())",
"-",
"-",
"... | false | 0.06393 | 0.131841 | 0.4849 | [
"s814772833",
"s085473818"
] |
u499381410 | p03476 | python | s584750691 | s331864676 | 437 | 354 | 55,712 | 53,152 | Accepted | Accepted | 18.99 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 55 | 55 | 1,548 | 1,602 | 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, at... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | false | 0 | [
"-from math import factorial, ceil, floor, atan2, degrees",
"+from math import factorial, ceil, floor",
"-sys.setrecursionlimit(10**8)",
"-INF = float(\"inf\")",
"+sys.setrecursionlimit(2147483647)",
"+INF = 10**13",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return list(map(int... | false | 0.103636 | 0.08573 | 1.208862 | [
"s584750691",
"s331864676"
] |
u391540332 | p02713 | python | s078329007 | s888176072 | 407 | 21 | 19,236 | 9,156 | Accepted | Accepted | 94.84 | import itertools
import math
n = int(eval(input()))
c1 = list(range(1, n + 1))
c2 = itertools.combinations(list(range(1, n + 1)), 2)
c3 = itertools.combinations(list(range(1, n + 1)), 3)
t1 = sum(list(c1))
t2 = sum(list([math.gcd(x[0], x[1]) for x in c2])) * 6
t3 = sum(list([math.gcd(x[0], math.gcd(x[1], x[... | k, = (int(x) for x in input().split())
n = 3
c = {}
t = 0
for x in range(k, 0, -1):
c[x] = (k // x) ** n
c[x] = c[x] - sum(c[x * y] for y in range(2, k // x + 1))
s = c[x] * x
t += s
# t = t % 1000000007
print(t) | 13 | 13 | 358 | 249 | import itertools
import math
n = int(eval(input()))
c1 = list(range(1, n + 1))
c2 = itertools.combinations(list(range(1, n + 1)), 2)
c3 = itertools.combinations(list(range(1, n + 1)), 3)
t1 = sum(list(c1))
t2 = sum(list([math.gcd(x[0], x[1]) for x in c2])) * 6
t3 = sum(list([math.gcd(x[0], math.gcd(x[1], x[2])) for x ... | (k,) = (int(x) for x in input().split())
n = 3
c = {}
t = 0
for x in range(k, 0, -1):
c[x] = (k // x) ** n
c[x] = c[x] - sum(c[x * y] for y in range(2, k // x + 1))
s = c[x] * x
t += s
# t = t % 1000000007
print(t)
| false | 0 | [
"-import itertools",
"-import math",
"-",
"-n = int(eval(input()))",
"-c1 = list(range(1, n + 1))",
"-c2 = itertools.combinations(list(range(1, n + 1)), 2)",
"-c3 = itertools.combinations(list(range(1, n + 1)), 3)",
"-t1 = sum(list(c1))",
"-t2 = sum(list([math.gcd(x[0], x[1]) for x in c2])) * 6",
... | false | 0.142675 | 0.035277 | 4.044434 | [
"s078329007",
"s888176072"
] |
u112364985 | p02641 | python | s452220588 | s136184345 | 25 | 22 | 9,232 | 9,204 | Accepted | Accepted | 12 | x,n=list(map(int,input().split()))
if n==0:
print(x)
exit()
elif n==100:
if abs(-1-x)<=abs(101-x):
print((0))
else:
print((101))
exit()
List=list(map(int,input().split()))
num=list(range(0,102))
min_num=1000000000
for i in range(len(List)):
if num.count(List[i])>=1:... | x,n=list(map(int,input().split()))
if n==0:
print(x)
exit()
List=list(map(int,input().split()))
ans=list(range(0,102))
min_num=1000
for i in List:
ans.remove(i)
for i in ans:
if (abs(i-x)<abs(min_num-x)) or (abs(i-x)==abs(min_num-x) and i<min_num):
min_num=i
print(min_num) | 20 | 13 | 500 | 303 | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
elif n == 100:
if abs(-1 - x) <= abs(101 - x):
print((0))
else:
print((101))
exit()
List = list(map(int, input().split()))
num = list(range(0, 102))
min_num = 1000000000
for i in range(len(List)):
if num.count(List... | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
List = list(map(int, input().split()))
ans = list(range(0, 102))
min_num = 1000
for i in List:
ans.remove(i)
for i in ans:
if (abs(i - x) < abs(min_num - x)) or (
abs(i - x) == abs(min_num - x) and i < min_num
):
min_n... | false | 35 | [
"-elif n == 100:",
"- if abs(-1 - x) <= abs(101 - x):",
"- print((0))",
"- else:",
"- print((101))",
"- exit()",
"-num = list(range(0, 102))",
"-min_num = 1000000000",
"-for i in range(len(List)):",
"- if num.count(List[i]) >= 1:",
"- num.remove(List[i])",
"-fo... | false | 0.137604 | 0.130795 | 1.052055 | [
"s452220588",
"s136184345"
] |
u235655730 | p03274 | python | s087811648 | s781952757 | 106 | 78 | 14,384 | 14,384 | Accepted | Accepted | 26.42 | N, K = list(map(int, input().split()))
cans = list(map(int, input().split()))
d = []
for n in range(N-K+1):
l = abs(cans[n]) + abs(cans[n + (K-1)] - cans[n])
r = abs(cans[n + (K-1)]) + abs(cans[n + (K-1)] - cans[n])
d.append(min(l,r))
print((min(d))) | N, K = list(map(int, input().split()))
cans = list(map(int, input().split()))
print((min([min(abs(cans[n]), abs(cans[n + (K-1)])) + abs(cans[n + (K-1)] - cans[n]) for n in range(N-K+1)]))) | 10 | 4 | 262 | 187 | N, K = list(map(int, input().split()))
cans = list(map(int, input().split()))
d = []
for n in range(N - K + 1):
l = abs(cans[n]) + abs(cans[n + (K - 1)] - cans[n])
r = abs(cans[n + (K - 1)]) + abs(cans[n + (K - 1)] - cans[n])
d.append(min(l, r))
print((min(d)))
| N, K = list(map(int, input().split()))
cans = list(map(int, input().split()))
print(
(
min(
[
min(abs(cans[n]), abs(cans[n + (K - 1)]))
+ abs(cans[n + (K - 1)] - cans[n])
for n in range(N - K + 1)
]
)
)
)
| false | 60 | [
"-d = []",
"-for n in range(N - K + 1):",
"- l = abs(cans[n]) + abs(cans[n + (K - 1)] - cans[n])",
"- r = abs(cans[n + (K - 1)]) + abs(cans[n + (K - 1)] - cans[n])",
"- d.append(min(l, r))",
"-print((min(d)))",
"+print(",
"+ (",
"+ min(",
"+ [",
"+ mi... | false | 0.036763 | 0.036766 | 0.999922 | [
"s087811648",
"s781952757"
] |
u562935282 | p03107 | python | s298693498 | s146013915 | 25 | 18 | 3,444 | 3,188 | Accepted | Accepted | 28 | def main():
from collections import Counter
s = eval(input())
ctr = Counter(s)
ctr.update({'0': 0, '1': 0})
ans = min(ctr.values()) * 2
print(ans)
if __name__ == '__main__':
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rs... | def main():
s = eval(input())
mi = min(s.count(c) for c in '01')
ans = mi * 2
print(ans)
if __name__ == '__main__':
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
| 24 | 18 | 366 | 290 | def main():
from collections import Counter
s = eval(input())
ctr = Counter(s)
ctr.update({"0": 0, "1": 0})
ans = min(ctr.values()) * 2
print(ans)
if __name__ == "__main__":
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# m... | def main():
s = eval(input())
mi = min(s.count(c) for c in "01")
ans = mi * 2
print(ans)
if __name__ == "__main__":
main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
| false | 25 | [
"- from collections import Counter",
"-",
"- ctr = Counter(s)",
"- ctr.update({\"0\": 0, \"1\": 0})",
"- ans = min(ctr.values()) * 2",
"+ mi = min(s.count(c) for c in \"01\")",
"+ ans = mi * 2"
] | false | 0.047876 | 0.047654 | 1.004657 | [
"s298693498",
"s146013915"
] |
u141610915 | p04035 | python | s517465699 | s270221322 | 284 | 122 | 60,804 | 91,940 | Accepted | Accepted | 57.04 | import sys
input = sys.stdin.readline
N, L = list(map(int, input().split()))
a = list(map(int, input().split()))
s = -1
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
s = i
break
if s == -1:
print("Impossible")
exit(0)
res = [s]
for i in range(s - 1, -1, -1):
res.append(i)
for i in range... | import sys
input = sys.stdin.readline
N, L = list(map(int, input().split()))
a = list(map(int, input().split()))
res = []
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
res.append(i)
break
else:
print("Impossible")
exit(0)
for i in range(res[0] - 1, -1, -1): res.append(i)
for i in range(res[... | 20 | 17 | 408 | 405 | import sys
input = sys.stdin.readline
N, L = list(map(int, input().split()))
a = list(map(int, input().split()))
s = -1
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
s = i
break
if s == -1:
print("Impossible")
exit(0)
res = [s]
for i in range(s - 1, -1, -1):
res.append(i)
for i in ran... | import sys
input = sys.stdin.readline
N, L = list(map(int, input().split()))
a = list(map(int, input().split()))
res = []
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
res.append(i)
break
else:
print("Impossible")
exit(0)
for i in range(res[0] - 1, -1, -1):
res.append(i)
for i in rang... | false | 15 | [
"-s = -1",
"+res = []",
"- s = i",
"+ res.append(i)",
"-if s == -1:",
"+else:",
"-res = [s]",
"-for i in range(s - 1, -1, -1):",
"+for i in range(res[0] - 1, -1, -1):",
"-for i in range(s + 1, N - 1):",
"+for i in range(res[0] + 1, N - 1):"
] | false | 0.042891 | 0.037147 | 1.154613 | [
"s517465699",
"s270221322"
] |
u642120132 | p03680 | python | s518386829 | s402814111 | 209 | 191 | 17,892 | 7,084 | Accepted | Accepted | 8.61 | N = int(eval(input()))
a = {i: int(eval(input())) for i in range(1, N + 1)}
i = 1
cnt = 0
while True:
cnt += 1
if a[i] == 2:
print(cnt)
break
if cnt == N:
print((-1))
break
i = a[i] | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
c = 1
s = a[0]
while s != 2 and c <= n:
c = c + 1
s = a[s-1]
print((c if c <= n else -1)) | 13 | 8 | 227 | 156 | N = int(eval(input()))
a = {i: int(eval(input())) for i in range(1, N + 1)}
i = 1
cnt = 0
while True:
cnt += 1
if a[i] == 2:
print(cnt)
break
if cnt == N:
print((-1))
break
i = a[i]
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
c = 1
s = a[0]
while s != 2 and c <= n:
c = c + 1
s = a[s - 1]
print((c if c <= n else -1))
| false | 38.461538 | [
"-N = int(eval(input()))",
"-a = {i: int(eval(input())) for i in range(1, N + 1)}",
"-i = 1",
"-cnt = 0",
"-while True:",
"- cnt += 1",
"- if a[i] == 2:",
"- print(cnt)",
"- break",
"- if cnt == N:",
"- print((-1))",
"- break",
"- i = a[i]",
"+n = in... | false | 0.038652 | 0.040427 | 0.956095 | [
"s518386829",
"s402814111"
] |
u796942881 | p03739 | python | s352370517 | s478025669 | 79 | 71 | 14,084 | 14,156 | Accepted | Accepted | 10.13 | an = list(map(int, open(0).read().split()[1:]))
def f(flg):
accum = 0
ret = 0
for i, ai in enumerate(an):
accum += ai
if flg:
flg = False
if accum <= 0:
ret += -accum + 1
accum = 1
else:
flg = True
... | an = list(map(int, open(0).read().split()[1:]))
def f(flg):
accum = 0
ret = 0
for ai in an:
accum += ai
if flg:
flg = False
if accum <= 0:
ret += -accum + 1
accum = 1
else:
flg = True
if ... | 27 | 27 | 500 | 486 | an = list(map(int, open(0).read().split()[1:]))
def f(flg):
accum = 0
ret = 0
for i, ai in enumerate(an):
accum += ai
if flg:
flg = False
if accum <= 0:
ret += -accum + 1
accum = 1
else:
flg = True
if 0... | an = list(map(int, open(0).read().split()[1:]))
def f(flg):
accum = 0
ret = 0
for ai in an:
accum += ai
if flg:
flg = False
if accum <= 0:
ret += -accum + 1
accum = 1
else:
flg = True
if 0 <= accum:
... | false | 0 | [
"- for i, ai in enumerate(an):",
"+ for ai in an:"
] | false | 0.041762 | 0.035383 | 1.180302 | [
"s352370517",
"s478025669"
] |
u113971909 | p03329 | python | s738708895 | s320629213 | 526 | 199 | 3,828 | 3,828 | Accepted | Accepted | 62.17 | import math
N = int(eval(input()))
dp=[100000]*(100000+1)
dp[0]=0
dp[1:5]=list(range(1,6))
dp[6:9]=list(range(1,4))
for n in range(9,N+1):
k9=0
k6=0
while n//(9**k9)>=9:
k9+=1
while n//(6**k6)>=6:
k6+=1
dp[n]=min(dp[n],dp[n-6**k6]+1,dp[n-9**k9]+1,dp[n-1]+1)
print((dp[N])) | import math
N = int(eval(input()))
dp=[100000]*(100000+1)
dp[0]=0
dp[1:5]=list(range(1,6))
dp[6:9]=list(range(1,4))
k9=0
k6=0
for n in range(9,N+1):
while n//(9**k9)>=9:
k9+=1
while n//(6**k6)>=6:
k6+=1
dp[n]=min(dp[n],dp[n-6**k6]+1,dp[n-9**k9]+1,dp[n-1]+1)
print((dp[N]))
| 15 | 15 | 284 | 281 | import math
N = int(eval(input()))
dp = [100000] * (100000 + 1)
dp[0] = 0
dp[1:5] = list(range(1, 6))
dp[6:9] = list(range(1, 4))
for n in range(9, N + 1):
k9 = 0
k6 = 0
while n // (9**k9) >= 9:
k9 += 1
while n // (6**k6) >= 6:
k6 += 1
dp[n] = min(dp[n], dp[n - 6**k6] + 1, dp[n - 9*... | import math
N = int(eval(input()))
dp = [100000] * (100000 + 1)
dp[0] = 0
dp[1:5] = list(range(1, 6))
dp[6:9] = list(range(1, 4))
k9 = 0
k6 = 0
for n in range(9, N + 1):
while n // (9**k9) >= 9:
k9 += 1
while n // (6**k6) >= 6:
k6 += 1
dp[n] = min(dp[n], dp[n - 6**k6] + 1, dp[n - 9**k9] + 1... | false | 0 | [
"+k9 = 0",
"+k6 = 0",
"- k9 = 0",
"- k6 = 0"
] | false | 0.369992 | 0.058879 | 6.283929 | [
"s738708895",
"s320629213"
] |
u197300773 | p02736 | python | s506160434 | s957960358 | 1,427 | 1,180 | 27,764 | 29,792 | Accepted | Accepted | 17.31 | import sys
n=int(eval(input()))
s=eval(input())
frac=[0]*(n+1)
for i in range(1,n+1):
k=i
frac[i]=frac[i-1]
while k%2==0:
k//=2
frac[i]+=1
ans=0
for i in range(n):
if int(s[i])==2 and frac[n-1]-frac[i]-frac[n-1-i]==0:
ans^=1
if ans==1: print((1))
elif "2" in s:... | import sys
n=int(eval(input()))
s=eval(input())
frac=[0]*(n+1)
for i in range(1,n+1):
k=i
frac[i]=frac[i-1]
while k%2==0:
k//=2
frac[i]+=1
if "2" in s: p=2
else: p=3
ans=0
for i in range(n):
if int(s[i])==p and frac[n-1]-frac[i]-frac[n-1-i]==0:
ans^=1
print((a... | 24 | 19 | 459 | 329 | import sys
n = int(eval(input()))
s = eval(input())
frac = [0] * (n + 1)
for i in range(1, n + 1):
k = i
frac[i] = frac[i - 1]
while k % 2 == 0:
k //= 2
frac[i] += 1
ans = 0
for i in range(n):
if int(s[i]) == 2 and frac[n - 1] - frac[i] - frac[n - 1 - i] == 0:
ans ^= 1
if ans ==... | import sys
n = int(eval(input()))
s = eval(input())
frac = [0] * (n + 1)
for i in range(1, n + 1):
k = i
frac[i] = frac[i - 1]
while k % 2 == 0:
k //= 2
frac[i] += 1
if "2" in s:
p = 2
else:
p = 3
ans = 0
for i in range(n):
if int(s[i]) == p and frac[n - 1] - frac[i] - frac[n - ... | false | 20.833333 | [
"+if \"2\" in s:",
"+ p = 2",
"+else:",
"+ p = 3",
"- if int(s[i]) == 2 and frac[n - 1] - frac[i] - frac[n - 1 - i] == 0:",
"+ if int(s[i]) == p and frac[n - 1] - frac[i] - frac[n - 1 - i] == 0:",
"-if ans == 1:",
"- print((1))",
"-elif \"2\" in s:",
"- print((0))",
"-else:",
... | false | 0.037257 | 0.056357 | 0.661093 | [
"s506160434",
"s957960358"
] |
u644224332 | p02780 | python | s728026725 | s708887210 | 1,655 | 157 | 25,572 | 25,060 | Accepted | Accepted | 90.51 | from collections import deque
if __name__ == '__main__':
n, k = list(map(int, input().split(" ")))
p = list(map(int, input().split(" ")))
d = deque([0])
for i in range(n):
d.append(d[i] + p[i])
# print(d)
max_sum = 0
rangeN = n - k + 1
for i in range(rangeN):
... | if __name__ == '__main__':
n, k = list(map(int, input().split(" ")))
p = list(map(int, input().split(" ")))
# d = deque([0])
d = [0]
for i in range(n):
d.append(d[i] + p[i])
# print(d)
max_sum = 0
rangeN = n - k + 1
for i in range(rangeN):
sum_d = d... | 23 | 22 | 523 | 504 | from collections import deque
if __name__ == "__main__":
n, k = list(map(int, input().split(" ")))
p = list(map(int, input().split(" ")))
d = deque([0])
for i in range(n):
d.append(d[i] + p[i])
# print(d)
max_sum = 0
rangeN = n - k + 1
for i in range(rangeN):
sum_d = d[i... | if __name__ == "__main__":
n, k = list(map(int, input().split(" ")))
p = list(map(int, input().split(" ")))
# d = deque([0])
d = [0]
for i in range(n):
d.append(d[i] + p[i])
# print(d)
max_sum = 0
rangeN = n - k + 1
for i in range(rangeN):
sum_d = d[i + k] - d[i]
... | false | 4.347826 | [
"-from collections import deque",
"-",
"- d = deque([0])",
"+ # d = deque([0])",
"+ d = [0]"
] | false | 0.085394 | 0.08002 | 1.067167 | [
"s728026725",
"s708887210"
] |
u077291787 | p03495 | python | s735176728 | s666817596 | 93 | 82 | 33,556 | 35,988 | Accepted | Accepted | 11.83 | # ABC081C - Not so Diverse (ARC086C)
from collections import Counter
def main():
N, K, *A = list(map(int, open(0).read().split()))
C = list(Counter(A).values())
C.sort(reverse=1)
ans = sum(C[K:])
print(ans)
if __name__ == "__main__":
main() | # ABC081C - Not so Diverse (ARC086C)
from collections import Counter
def main():
N, K, *A = open(0).read().split()
C, K = list(Counter(A).values()), int(K)
C.sort(reverse=1)
ans = sum(C[K:])
print(ans)
if __name__ == "__main__":
main() | 14 | 14 | 275 | 276 | # ABC081C - Not so Diverse (ARC086C)
from collections import Counter
def main():
N, K, *A = list(map(int, open(0).read().split()))
C = list(Counter(A).values())
C.sort(reverse=1)
ans = sum(C[K:])
print(ans)
if __name__ == "__main__":
main()
| # ABC081C - Not so Diverse (ARC086C)
from collections import Counter
def main():
N, K, *A = open(0).read().split()
C, K = list(Counter(A).values()), int(K)
C.sort(reverse=1)
ans = sum(C[K:])
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- N, K, *A = list(map(int, open(0).read().split()))",
"- C = list(Counter(A).values())",
"+ N, K, *A = open(0).read().split()",
"+ C, K = list(Counter(A).values()), int(K)"
] | false | 0.073981 | 0.07033 | 1.051914 | [
"s735176728",
"s666817596"
] |
u961945062 | p02935 | python | s671196219 | s596992356 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import deque
N = int(eval(input()))
H = deque(list(map(int, input().split())))
h = deque(sorted(H))
ans = h.popleft()
for i in range(N-1):
ans = (ans + h.popleft())/2
print(ans) | N = int(eval(input()))
H = list(map(int, input().split()))
h = sorted(H, reverse=True)
ans = h.pop()
for i in range(N-1):
ans = (ans + h.pop())/2
print(ans) | 12 | 10 | 201 | 166 | from collections import deque
N = int(eval(input()))
H = deque(list(map(int, input().split())))
h = deque(sorted(H))
ans = h.popleft()
for i in range(N - 1):
ans = (ans + h.popleft()) / 2
print(ans)
| N = int(eval(input()))
H = list(map(int, input().split()))
h = sorted(H, reverse=True)
ans = h.pop()
for i in range(N - 1):
ans = (ans + h.pop()) / 2
print(ans)
| false | 16.666667 | [
"-from collections import deque",
"-",
"-H = deque(list(map(int, input().split())))",
"-h = deque(sorted(H))",
"-ans = h.popleft()",
"+H = list(map(int, input().split()))",
"+h = sorted(H, reverse=True)",
"+ans = h.pop()",
"- ans = (ans + h.popleft()) / 2",
"+ ans = (ans + h.pop()) / 2"
] | false | 0.044226 | 0.044287 | 0.998616 | [
"s671196219",
"s596992356"
] |
u021019433 | p02757 | python | s816185336 | s844754795 | 178 | 144 | 4,072 | 5,092 | Accepted | Accepted | 19.1 | I = lambda s:list(map(int, s))
p = int(input().split()[1])
s = eval(input())
if 10 % p == 0:
r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
d = {0 : 1}
t, y = 0, 1
for i, x in enumerate(I(reversed(s)), 1):
t = (t + x * y) % p
d[t] = d.get(t, 0) + 1
y = y * 10 % p;
r = ... | p = int(input().split()[1])
a = list(map(int, eval(input())))
if 10 % p == 0:
r = sum(i for i, x in enumerate(a, 1) if x % p == 0)
else:
d = [1] + [0] * (p - 1)
t, y = 0, 1
for i, x in enumerate(reversed(a), 1):
t = (t + x * y) % p
d[t] += 1
y = y * 10 % p;
r = sum(i * (i - 1) // 2 for ... | 15 | 13 | 360 | 332 | I = lambda s: list(map(int, s))
p = int(input().split()[1])
s = eval(input())
if 10 % p == 0:
r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
d = {0: 1}
t, y = 0, 1
for i, x in enumerate(I(reversed(s)), 1):
t = (t + x * y) % p
d[t] = d.get(t, 0) + 1
y = y * 10 % p
... | p = int(input().split()[1])
a = list(map(int, eval(input())))
if 10 % p == 0:
r = sum(i for i, x in enumerate(a, 1) if x % p == 0)
else:
d = [1] + [0] * (p - 1)
t, y = 0, 1
for i, x in enumerate(reversed(a), 1):
t = (t + x * y) % p
d[t] += 1
y = y * 10 % p
r = sum(i * (i - 1)... | false | 13.333333 | [
"-I = lambda s: list(map(int, s))",
"-s = eval(input())",
"+a = list(map(int, eval(input())))",
"- r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)",
"+ r = sum(i for i, x in enumerate(a, 1) if x % p == 0)",
"- d = {0: 1}",
"+ d = [1] + [0] * (p - 1)",
"- for i, x in enumerate(I(... | false | 0.045233 | 0.037951 | 1.19188 | [
"s816185336",
"s844754795"
] |
u994988729 | p03087 | python | s689543704 | s970601120 | 886 | 422 | 7,668 | 12,916 | Accepted | Accepted | 52.37 | n,q=list(map(int,input().split()))
S=eval(input())
cnt=[0]*n
for i in range(1, n):
s=S[i-1]+S[i]
if s=="AC":
cnt[i]+=1
for i in range(1, n):
cnt[i]+=cnt[i-1]
for _ in range(q):
l, r=list(map(int,input().split()))
ans=cnt[r-1]-cnt[l-1]
print(ans) | from itertools import accumulate
N, Q = map(int, input().split())
S = "?" + input()
query = (tuple(map(int, input().split())) for _ in range(Q))
cnt = [0] * (N+1)
for i in range(N):
if S[i] + S[i + 1] == "AC":
cnt[i + 1] += 1
cnt = tuple(accumulate(cnt))
ans = (cnt[r] - cnt[l] for l, r in que... | 16 | 14 | 277 | 347 | n, q = list(map(int, input().split()))
S = eval(input())
cnt = [0] * n
for i in range(1, n):
s = S[i - 1] + S[i]
if s == "AC":
cnt[i] += 1
for i in range(1, n):
cnt[i] += cnt[i - 1]
for _ in range(q):
l, r = list(map(int, input().split()))
ans = cnt[r - 1] - cnt[l - 1]
print(ans)
| from itertools import accumulate
N, Q = map(int, input().split())
S = "?" + input()
query = (tuple(map(int, input().split())) for _ in range(Q))
cnt = [0] * (N + 1)
for i in range(N):
if S[i] + S[i + 1] == "AC":
cnt[i + 1] += 1
cnt = tuple(accumulate(cnt))
ans = (cnt[r] - cnt[l] for l, r in query)
print(*a... | false | 12.5 | [
"-n, q = list(map(int, input().split()))",
"-S = eval(input())",
"-cnt = [0] * n",
"-for i in range(1, n):",
"- s = S[i - 1] + S[i]",
"- if s == \"AC\":",
"- cnt[i] += 1",
"-for i in range(1, n):",
"- cnt[i] += cnt[i - 1]",
"-for _ in range(q):",
"- l, r = list(map(int, input(... | false | 0.103041 | 0.058156 | 1.771802 | [
"s689543704",
"s970601120"
] |
u418149936 | p02641 | python | s742961440 | s005395443 | 29 | 26 | 8,980 | 9,020 | Accepted | Accepted | 10.34 | x, n = list(map(int, input().split(' ')))
diff = x
result = 0
if n != 0:
ls = list(map(int, input().split(' ')))
ls_remaind = []
for i in range(1, 102):
if i not in ls:
ls_remaind.append(i)
for j in ls_remaind:
if abs(x-j) == diff:
result = min(result... | X, N = list(map(int, input().split(' ')))
if N == 0:
print(X)
else:
P_ls = list(map(int, input().split(' ')))
P_ls.sort(reverse=True)
diff = -1
for i in range(101, -1, -1):
if i not in P_ls:
if diff == -1:
diff = abs(X - i)
rst = i
... | 20 | 17 | 442 | 456 | x, n = list(map(int, input().split(" ")))
diff = x
result = 0
if n != 0:
ls = list(map(int, input().split(" ")))
ls_remaind = []
for i in range(1, 102):
if i not in ls:
ls_remaind.append(i)
for j in ls_remaind:
if abs(x - j) == diff:
result = min(result, j)
... | X, N = list(map(int, input().split(" ")))
if N == 0:
print(X)
else:
P_ls = list(map(int, input().split(" ")))
P_ls.sort(reverse=True)
diff = -1
for i in range(101, -1, -1):
if i not in P_ls:
if diff == -1:
diff = abs(X - i)
rst = i
else... | false | 15 | [
"-x, n = list(map(int, input().split(\" \")))",
"-diff = x",
"-result = 0",
"-if n != 0:",
"- ls = list(map(int, input().split(\" \")))",
"- ls_remaind = []",
"- for i in range(1, 102):",
"- if i not in ls:",
"- ls_remaind.append(i)",
"- for j in ls_remaind:",
"- ... | false | 0.036051 | 0.048366 | 0.74537 | [
"s742961440",
"s005395443"
] |
u391731808 | p03911 | python | s348520085 | s498708107 | 632 | 563 | 106,928 | 63,748 | Accepted | Accepted | 10.92 | import heapq
N,M = list(map(int,input().split()))
KL = [list(map(int,input().split())) for _ in [0]*N]
E = [{} for _ in [0]*(N+M)]
for i,kl in enumerate(KL):
for l in kl[1:]:
E[i][N+l-1] = 1
E[N+l-1][i] = 1
def Dijkstra(N,E,start):
d = [-1]*N
q = [(0,start)]
while q:
... | #二部グラフで連結判定
N,M = list(map(int,input().split()))
KL = [list(map(int,input().split())) for _ in [0]*N]
E = [[] for _ in [0]*(N+M)] #E[0] - E[N-1]:人, E[N] - E[N+M-1]:言語
for i,kl in enumerate(KL):
for l in kl[1:]:
E[i].append(N+l-1)
E[N+l-1].append(i)
def connect_bfs(N,E,start):
connec... | 25 | 24 | 597 | 604 | import heapq
N, M = list(map(int, input().split()))
KL = [list(map(int, input().split())) for _ in [0] * N]
E = [{} for _ in [0] * (N + M)]
for i, kl in enumerate(KL):
for l in kl[1:]:
E[i][N + l - 1] = 1
E[N + l - 1][i] = 1
def Dijkstra(N, E, start):
d = [-1] * N
q = [(0, start)]
whi... | # 二部グラフで連結判定
N, M = list(map(int, input().split()))
KL = [list(map(int, input().split())) for _ in [0] * N]
E = [[] for _ in [0] * (N + M)] # E[0] - E[N-1]:人, E[N] - E[N+M-1]:言語
for i, kl in enumerate(KL):
for l in kl[1:]:
E[i].append(N + l - 1)
E[N + l - 1].append(i)
def connect_bfs(N, E, start)... | false | 4 | [
"-import heapq",
"-",
"+# 二部グラフで連結判定",
"-E = [{} for _ in [0] * (N + M)]",
"+E = [[] for _ in [0] * (N + M)] # E[0] - E[N-1]:人, E[N] - E[N+M-1]:言語",
"- E[i][N + l - 1] = 1",
"- E[N + l - 1][i] = 1",
"+ E[i].append(N + l - 1)",
"+ E[N + l - 1].append(i)",
"-def Dijkstra... | false | 0.051144 | 0.07904 | 0.647058 | [
"s348520085",
"s498708107"
] |
u764956288 | p02678 | python | s748288625 | s081140138 | 1,092 | 502 | 71,228 | 67,812 | Accepted | Accepted | 54.03 | import queue
import sys
readline = sys.stdin.readline
def main():
n_rooms, n_passages = list(map(int, input().split()))
passages = (list(map(int, readline().strip().split())) for _ in range(n_passages))
# n_rooms, n_passages, *passages = map(int, open(0).read().split())
connections = [s... | # import queue
from collections import deque
import sys
readline = sys.stdin.readline
def main():
n_rooms, n_passages = list(map(int, input().split()))
passages = (list(map(int, readline().strip().split())) for _ in range(n_passages))
connections = [set() for _ in range(n_rooms+1)] # type: l... | 40 | 40 | 935 | 891 | import queue
import sys
readline = sys.stdin.readline
def main():
n_rooms, n_passages = list(map(int, input().split()))
passages = (list(map(int, readline().strip().split())) for _ in range(n_passages))
# n_rooms, n_passages, *passages = map(int, open(0).read().split())
connections = [set() for _ in ... | # import queue
from collections import deque
import sys
readline = sys.stdin.readline
def main():
n_rooms, n_passages = list(map(int, input().split()))
passages = (list(map(int, readline().strip().split())) for _ in range(n_passages))
connections = [set() for _ in range(n_rooms + 1)] # type: list
fo... | false | 0 | [
"-import queue",
"+# import queue",
"+from collections import deque",
"- # n_rooms, n_passages, *passages = map(int, open(0).read().split())",
"- que = queue.Queue()",
"- que.put((0, 1)) # parent, current",
"+ que = deque()",
"+ que.append((0, 1)) # parent, current",
"- while not... | false | 0.087053 | 0.038545 | 2.258474 | [
"s748288625",
"s081140138"
] |
u073549161 | p03470 | python | s274852198 | s894717699 | 176 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.34 | a= set()
n = int(eval(input()))
for i in range(n):
a.add(int(eval(input())))
print((len(a))) | n = int(eval(input()))
dat = {}
for _ in range(n):
dat[int(eval(input()))] = True
print((len(list(dat.items())))) | 5 | 5 | 86 | 101 | a = set()
n = int(eval(input()))
for i in range(n):
a.add(int(eval(input())))
print((len(a)))
| n = int(eval(input()))
dat = {}
for _ in range(n):
dat[int(eval(input()))] = True
print((len(list(dat.items()))))
| false | 0 | [
"-a = set()",
"-for i in range(n):",
"- a.add(int(eval(input())))",
"-print((len(a)))",
"+dat = {}",
"+for _ in range(n):",
"+ dat[int(eval(input()))] = True",
"+print((len(list(dat.items()))))"
] | false | 0.046381 | 0.046125 | 1.005563 | [
"s274852198",
"s894717699"
] |
u804711544 | p02641 | python | s102867378 | s886181848 | 21 | 19 | 9,180 | 9,200 | Accepted | Accepted | 9.52 | x, n = list(map(int, input().split()))
p = [int(_) for _ in input().split()]
not_in_p = [i for i in range(0, 102) if i not in p]
nip_temp = list([abs(x - s) for s in not_in_p])
address = nip_temp.index(min(nip_temp))
print((not_in_p[address]))
| import sys
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
if n == 0:
print(x)
sys.exit()
not_in_p = []
for i in range(0, 102):
if i not in p:
not_in_p.append(abs(x-i))
else:
not_in_p.append(102)
address = not_in_p.index(min(not_in_p))
print(ad... | 8 | 16 | 250 | 320 | x, n = list(map(int, input().split()))
p = [int(_) for _ in input().split()]
not_in_p = [i for i in range(0, 102) if i not in p]
nip_temp = list([abs(x - s) for s in not_in_p])
address = nip_temp.index(min(nip_temp))
print((not_in_p[address]))
| import sys
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
if n == 0:
print(x)
sys.exit()
not_in_p = []
for i in range(0, 102):
if i not in p:
not_in_p.append(abs(x - i))
else:
not_in_p.append(102)
address = not_in_p.index(min(not_in_p))
print(address)
| false | 50 | [
"+import sys",
"+",
"-p = [int(_) for _ in input().split()]",
"-not_in_p = [i for i in range(0, 102) if i not in p]",
"-nip_temp = list([abs(x - s) for s in not_in_p])",
"-address = nip_temp.index(min(nip_temp))",
"-print((not_in_p[address]))",
"+p = list(map(int, input().split()))",
"+if n == 0:",
... | false | 0.098513 | 0.105639 | 0.932549 | [
"s102867378",
"s886181848"
] |
u163783894 | p02570 | python | s434379568 | s050890182 | 80 | 29 | 61,880 | 9,044 | Accepted | Accepted | 63.75 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 =... | D, T, S = list(map(int, input().split()))
if T * S >= D:
print("Yes")
else:
print("No")
| 27 | 6 | 678 | 96 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode("utf-8")
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: ... | D, T, S = list(map(int, input().split()))
if T * S >= D:
print("Yes")
else:
print("No")
| false | 77.777778 | [
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-in_n = lambda: int(readline())",
"-in_nn = lambda: list(map(int, readline().split()))",
"-in_s = lambda: readline().rstrip().decode(\"utf-8\")",
"-in_nl = lambda... | false | 0.042294 | 0.07612 | 0.555624 | [
"s434379568",
"s050890182"
] |
u622045059 | p03329 | python | s162483055 | s630016079 | 1,150 | 688 | 26,220 | 9,196 | Accepted | Accepted | 40.17 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b... | 69 | 67 | 2,319 | 2,241 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(... | false | 2.898551 | [
"-dp = [[INF for _ in range(N + 1)] for _ in range(lm + 1)]",
"-dp[0][0] = 0",
"+dp = [INF for _ in range(N + 1)]",
"+dp[0] = 0",
"- dp[i + 1][j] = dp[i][j]",
"- dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][j - money[i]] + 1)",
"-print(dp[lm][N])",
"+ dp[j] = min(dp[j], dp[j... | false | 0.800271 | 0.149257 | 5.361706 | [
"s162483055",
"s630016079"
] |
u964299793 | p03504 | python | s289913117 | s156453249 | 1,261 | 1,164 | 26,648 | 26,648 | Accepted | Accepted | 7.69 | import sys
input=sys.stdin.buffer.readline
n,c=list(map(int,input().split()))
a=[ [0 for _ in range(10**5+2)] for _ in range(c)]
for _ in range(n):
s,t,cc=list(map(int,input().split()))
cc-=1
# print(s-1,end=' s-1\n')
#a[cc][s-1]+=1
#a[cc][t]-=1
for i in range(s-1,t):
a[cc][i]=... | import sys
input=sys.stdin.buffer.readline
n,c=list(map(int,input().split()))
a=[ [0 for _ in range(10**5+2)] for _ in range(c)]
for _ in range(n):
s,t,cc=list(map(int,input().split()))
cc-=1
# print(s-1,end=' s-1\n')
#a[cc][s-1]+=1
#a[cc][t]-=1
for i in range(s-1,t):
a[cc][i]=... | 26 | 26 | 603 | 601 | import sys
input = sys.stdin.buffer.readline
n, c = list(map(int, input().split()))
a = [[0 for _ in range(10**5 + 2)] for _ in range(c)]
for _ in range(n):
s, t, cc = list(map(int, input().split()))
cc -= 1
# print(s-1,end=' s-1\n')
# a[cc][s-1]+=1
# a[cc][t]-=1
for i in range(s - 1, t):
... | import sys
input = sys.stdin.buffer.readline
n, c = list(map(int, input().split()))
a = [[0 for _ in range(10**5 + 2)] for _ in range(c)]
for _ in range(n):
s, t, cc = list(map(int, input().split()))
cc -= 1
# print(s-1,end=' s-1\n')
# a[cc][s-1]+=1
# a[cc][t]-=1
for i in range(s - 1, t):
... | false | 0 | [
"-for j in range(0, 10**5 + 1):",
"+for j in range(0, 10**5):"
] | false | 0.411305 | 0.329636 | 1.247754 | [
"s289913117",
"s156453249"
] |
u089230684 | p02613 | python | s655654410 | s718360318 | 361 | 150 | 84,920 | 16,208 | Accepted | Accepted | 58.45 | n = int(input())
t = ['AC', 'WA', 'TLE', 'RE']
d = {}
for _ in range(n):
s = input()
d[s] = d.get(s, 0) + 1
for k in t:
print('%s x %d' % (k, d.get(k, 0))) | verdict = eval(input())
list1 = []
list2 = ["AC", "WA", "TLE", "RE"]
for i in range(0, int(verdict)):
x = eval(input())
list1.append(x)
for x in list2:
print(f"{x} x {list1.count(x)}")
| 9 | 10 | 184 | 196 | n = int(input())
t = ["AC", "WA", "TLE", "RE"]
d = {}
for _ in range(n):
s = input()
d[s] = d.get(s, 0) + 1
for k in t:
print("%s x %d" % (k, d.get(k, 0)))
| verdict = eval(input())
list1 = []
list2 = ["AC", "WA", "TLE", "RE"]
for i in range(0, int(verdict)):
x = eval(input())
list1.append(x)
for x in list2:
print(f"{x} x {list1.count(x)}")
| false | 10 | [
"-n = int(input())",
"-t = [\"AC\", \"WA\", \"TLE\", \"RE\"]",
"-d = {}",
"-for _ in range(n):",
"- s = input()",
"- d[s] = d.get(s, 0) + 1",
"-for k in t:",
"- print(\"%s x %d\" % (k, d.get(k, 0)))",
"+verdict = eval(input())",
"+list1 = []",
"+list2 = [\"AC\", \"WA\", \"TLE\", \"RE\"]... | false | 0.188293 | 0.15432 | 1.220147 | [
"s655654410",
"s718360318"
] |
u729133443 | p03140 | python | s315898684 | s013579211 | 162 | 18 | 39,700 | 2,940 | Accepted | Accepted | 88.89 | n=int(eval(input()))
ans=0
for a,b,c in zip(eval(input()),eval(input()),eval(input())):ans+=len(set([a,b,c]))-1
print(ans) | I=input;I();print((sum(len(set(s))-1for s in zip(I(),I(),I())))) | 4 | 1 | 101 | 62 | n = int(eval(input()))
ans = 0
for a, b, c in zip(eval(input()), eval(input()), eval(input())):
ans += len(set([a, b, c])) - 1
print(ans)
| I = input
I()
print((sum(len(set(s)) - 1 for s in zip(I(), I(), I()))))
| false | 75 | [
"-n = int(eval(input()))",
"-ans = 0",
"-for a, b, c in zip(eval(input()), eval(input()), eval(input())):",
"- ans += len(set([a, b, c])) - 1",
"-print(ans)",
"+I = input",
"+I()",
"+print((sum(len(set(s)) - 1 for s in zip(I(), I(), I()))))"
] | false | 0.040131 | 0.036907 | 1.087371 | [
"s315898684",
"s013579211"
] |
u923279197 | p03408 | python | s166421911 | s610451875 | 186 | 172 | 38,384 | 38,256 | Accepted | Accepted | 7.53 | N = int(eval(input()))
S = []
number = []
for i in range(N):
s = eval(input())
if s in S:
number[S.index(s)] += 1
else:
number.append(1)
S.append(s)
M = int(eval(input()))
for i in range(M):
s = eval(input())
if s in S:
number[S.index(s)] -= 1
print((m... | n=int(eval(input()))
s=[]
t=[]
ans=0
for i in range(n):
s.append(eval(input()))
m=int(eval(input()))
for i in range(m):
t.append(eval(input()))
for i in range(n):
ans=max(ans,s.count(s[i])-t.count(s[i]))
print(ans)
| 17 | 12 | 313 | 214 | N = int(eval(input()))
S = []
number = []
for i in range(N):
s = eval(input())
if s in S:
number[S.index(s)] += 1
else:
number.append(1)
S.append(s)
M = int(eval(input()))
for i in range(M):
s = eval(input())
if s in S:
number[S.index(s)] -= 1
print((max(max(number), ... | n = int(eval(input()))
s = []
t = []
ans = 0
for i in range(n):
s.append(eval(input()))
m = int(eval(input()))
for i in range(m):
t.append(eval(input()))
for i in range(n):
ans = max(ans, s.count(s[i]) - t.count(s[i]))
print(ans)
| false | 29.411765 | [
"-N = int(eval(input()))",
"-S = []",
"-number = []",
"-for i in range(N):",
"- s = eval(input())",
"- if s in S:",
"- number[S.index(s)] += 1",
"- else:",
"- number.append(1)",
"- S.append(s)",
"-M = int(eval(input()))",
"-for i in range(M):",
"- s = eval(in... | false | 0.071984 | 0.061972 | 1.161563 | [
"s166421911",
"s610451875"
] |
u163320134 | p02665 | python | s138657023 | s151633468 | 835 | 680 | 668,572 | 650,836 | Accepted | Accepted | 18.56 | n=int(eval(input()))
arr=list(map(int,input().split()))
ans=sum(arr)
if n==0:
if arr[0]==1:
print((1))
else:
print((-1))
exit()
for i in range(n):
if i<=30 and arr[i]>=2**i:
print((-1))
exit()
if n<=30 and arr[n]>2**n:
print((-1))
exit()
maxs=[0]*(n+1)
maxs[0]=1
for i in ra... | n=int(eval(input()))
arr=list(map(int,input().split()))
if n==0:
if arr[0]==1:
print((1))
else:
print((-1))
exit()
acum=[arr[0]]
for i in range(1,n+1):
acum.append(acum[-1]+arr[i])
b=[0]*n
b[0]=1-arr[0]
b[0]=min(b[0],acum[n]-acum[0])
for i in range(1,n):
b[i]=2*b[i-1]-arr[i]
b[i]=min... | 33 | 26 | 607 | 491 | n = int(eval(input()))
arr = list(map(int, input().split()))
ans = sum(arr)
if n == 0:
if arr[0] == 1:
print((1))
else:
print((-1))
exit()
for i in range(n):
if i <= 30 and arr[i] >= 2**i:
print((-1))
exit()
if n <= 30 and arr[n] > 2**n:
print((-1))
exit()
maxs = ... | n = int(eval(input()))
arr = list(map(int, input().split()))
if n == 0:
if arr[0] == 1:
print((1))
else:
print((-1))
exit()
acum = [arr[0]]
for i in range(1, n + 1):
acum.append(acum[-1] + arr[i])
b = [0] * n
b[0] = 1 - arr[0]
b[0] = min(b[0], acum[n] - acum[0])
for i in range(1, n):
... | false | 21.212121 | [
"-ans = sum(arr)",
"+acum = [arr[0]]",
"+for i in range(1, n + 1):",
"+ acum.append(acum[-1] + arr[i])",
"+b = [0] * n",
"+b[0] = 1 - arr[0]",
"+b[0] = min(b[0], acum[n] - acum[0])",
"+for i in range(1, n):",
"+ b[i] = 2 * b[i - 1] - arr[i]",
"+ b[i] = min(b[i], acum[n] - acum[i])",
"- ... | false | 0.049048 | 0.049408 | 0.992713 | [
"s138657023",
"s151633468"
] |
u620084012 | p03775 | python | s351571748 | s177499964 | 174 | 32 | 39,152 | 3,060 | Accepted | Accepted | 81.61 | import math
N = int(eval(input()))
ans = 1000
for k in range(1,math.floor(math.sqrt(N))+1):
if N % k == 0:
ans = min(ans,max(len(str(k)),len(str(N//k))))
print(ans)
| import math
N = int(eval(input()))
ans = len(str(N))
for k in range(2,math.floor(math.sqrt(N))+1):
if N % k == 0:
ans = min(ans,max(len(str(k)),len(str(N//k))))
print(ans)
| 7 | 7 | 177 | 184 | import math
N = int(eval(input()))
ans = 1000
for k in range(1, math.floor(math.sqrt(N)) + 1):
if N % k == 0:
ans = min(ans, max(len(str(k)), len(str(N // k))))
print(ans)
| import math
N = int(eval(input()))
ans = len(str(N))
for k in range(2, math.floor(math.sqrt(N)) + 1):
if N % k == 0:
ans = min(ans, max(len(str(k)), len(str(N // k))))
print(ans)
| false | 0 | [
"-ans = 1000",
"-for k in range(1, math.floor(math.sqrt(N)) + 1):",
"+ans = len(str(N))",
"+for k in range(2, math.floor(math.sqrt(N)) + 1):"
] | false | 0.007748 | 0.035269 | 0.219686 | [
"s351571748",
"s177499964"
] |
u112364985 | p02681 | python | s133355611 | s965186210 | 21 | 19 | 9,104 | 9,024 | Accepted | Accepted | 9.52 | s=eval(input())
t=eval(input())
if len(t)==len(s)+1 and t[0:len(t)-1]==s:
print("Yes")
else:
print("No") | s=eval(input())
t=eval(input())
if len(t)==len(s)+1 and t[:-1]==s:
print("Yes")
else:
print("No") | 6 | 6 | 105 | 98 | s = eval(input())
t = eval(input())
if len(t) == len(s) + 1 and t[0 : len(t) - 1] == s:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
if len(t) == len(s) + 1 and t[:-1] == s:
print("Yes")
else:
print("No")
| false | 0 | [
"-if len(t) == len(s) + 1 and t[0 : len(t) - 1] == s:",
"+if len(t) == len(s) + 1 and t[:-1] == s:"
] | false | 0.049712 | 0.046981 | 1.058126 | [
"s133355611",
"s965186210"
] |
u076503518 | p03573 | python | s836034746 | s182542864 | 130 | 17 | 3,444 | 2,940 | Accepted | Accepted | 86.92 | from collections import Counter
cnt = Counter(list(map(int, input().split())))
print((cnt.most_common()[1][0])) | a, b, c = list(map(int, input().split()))
if a == b: print(c)
elif a == c: print(b)
elif b == c: print(a) | 3 | 4 | 111 | 102 | from collections import Counter
cnt = Counter(list(map(int, input().split())))
print((cnt.most_common()[1][0]))
| a, b, c = list(map(int, input().split()))
if a == b:
print(c)
elif a == c:
print(b)
elif b == c:
print(a)
| false | 25 | [
"-from collections import Counter",
"-",
"-cnt = Counter(list(map(int, input().split())))",
"-print((cnt.most_common()[1][0]))",
"+a, b, c = list(map(int, input().split()))",
"+if a == b:",
"+ print(c)",
"+elif a == c:",
"+ print(b)",
"+elif b == c:",
"+ print(a)"
] | false | 0.071672 | 0.03621 | 1.979347 | [
"s836034746",
"s182542864"
] |
u606045429 | p02874 | python | s169196602 | s163223930 | 289 | 254 | 25,564 | 23,332 | Accepted | Accepted | 12.11 | N, *LR = list(map(int, open(0).read().split()))
L, R = LR[::2], LR[1::2]
Lp = max(L)
Rq = min(R)
A = sorted(max(0, r - Lp + 1) for r in R)
B = sorted(-max(0, Rq - l + 1) for l in L)
mi = float("inf")
ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)
for a, b in zip(A[1:], B):
mi = min... | from sys import stdin
def main():
N, *LR = list(map(int, stdin.buffer.read().split()))
L, R = LR[::2], LR[1::2]
Lp = max(L)
Rq = min(R)
A = sorted(max(0, r - Lp + 1) for r in R)
B = sorted(-max(0, Rq - l + 1) for l in L)
mi = float("inf")
ma = max(r - l + 1 for l, r in z... | 17 | 22 | 362 | 463 | N, *LR = list(map(int, open(0).read().split()))
L, R = LR[::2], LR[1::2]
Lp = max(L)
Rq = min(R)
A = sorted(max(0, r - Lp + 1) for r in R)
B = sorted(-max(0, Rq - l + 1) for l in L)
mi = float("inf")
ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)
for a, b in zip(A[1:], B):
mi = min(mi, -b)
ma =... | from sys import stdin
def main():
N, *LR = list(map(int, stdin.buffer.read().split()))
L, R = LR[::2], LR[1::2]
Lp = max(L)
Rq = min(R)
A = sorted(max(0, r - Lp + 1) for r in R)
B = sorted(-max(0, Rq - l + 1) for l in L)
mi = float("inf")
ma = max(r - l + 1 for l, r in zip(L, R)) + max... | false | 22.727273 | [
"-N, *LR = list(map(int, open(0).read().split()))",
"-L, R = LR[::2], LR[1::2]",
"-Lp = max(L)",
"-Rq = min(R)",
"-A = sorted(max(0, r - Lp + 1) for r in R)",
"-B = sorted(-max(0, Rq - l + 1) for l in L)",
"-mi = float(\"inf\")",
"-ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)",
"-... | false | 0.044822 | 0.045604 | 0.982847 | [
"s169196602",
"s163223930"
] |
u430726059 | p02713 | python | s763640719 | s052859395 | 1,674 | 244 | 27,036 | 9,204 | Accepted | Accepted | 85.42 | import numpy as np
n=int(eval(input()))
ans=0
for a in range(1,n+1):
for b in range(1,n+1):
d=np.gcd(a,b)
if d==1:
ans+=n
continue
if d==2:
ans+=n//2*3+n%2
continue
if d==3:
ans+=n//3*5+n%3
continue
if d==5:
ans+=n//5*9+n%5
continu... | import math
n=int(eval(input()))
ans=0
for a in range(1,n+1):
for b in range(1,n+1):
d=math.gcd(a,b)
if d==1:
ans+=n
continue
if d==2:
ans+=n//2*3+n%2
continue
if d==3:
ans+=n//3*5+n%3
continue
if d==5:
ans+=n//5*9+n%5
continue
... | 23 | 23 | 383 | 380 | import numpy as np
n = int(eval(input()))
ans = 0
for a in range(1, n + 1):
for b in range(1, n + 1):
d = np.gcd(a, b)
if d == 1:
ans += n
continue
if d == 2:
ans += n // 2 * 3 + n % 2
continue
if d == 3:
ans += n // 3 * 5 ... | import math
n = int(eval(input()))
ans = 0
for a in range(1, n + 1):
for b in range(1, n + 1):
d = math.gcd(a, b)
if d == 1:
ans += n
continue
if d == 2:
ans += n // 2 * 3 + n % 2
continue
if d == 3:
ans += n // 3 * 5 + n %... | false | 0 | [
"-import numpy as np",
"+import math",
"- d = np.gcd(a, b)",
"+ d = math.gcd(a, b)",
"- ans += np.gcd(c, d)",
"+ ans += math.gcd(c, d)"
] | false | 0.363174 | 0.051263 | 7.084483 | [
"s763640719",
"s052859395"
] |
u813569174 | p03478 | python | s393054247 | s357607127 | 52 | 30 | 3,060 | 3,060 | Accepted | Accepted | 42.31 | s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
S = 0
p = str(i)
q = [str(c) for c in p]
q = list(map(int,q))
for j in range(len(q)):
S = S + q[j]
if A <= S <= B:
k = k + i
print(k)
| s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
S = 0
l = i
while l >= 1:
p = l%10
l = l//10
S = S + p
if A <= S <= B:
k = k + i
print(k) | 16 | 15 | 264 | 218 | s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1, N + 1):
S = 0
p = str(i)
q = [str(c) for c in p]
q = list(map(int, q))
for j in range(len(q)):
S = S + q[j]
if A <= S <= B:
k = k + i
print(k)
| s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1, N + 1):
S = 0
l = i
while l >= 1:
p = l % 10
l = l // 10
S = S + p
if A <= S <= B:
k = k + i
print(k)
| false | 6.25 | [
"- p = str(i)",
"- q = [str(c) for c in p]",
"- q = list(map(int, q))",
"- for j in range(len(q)):",
"- S = S + q[j]",
"+ l = i",
"+ while l >= 1:",
"+ p = l % 10",
"+ l = l // 10",
"+ S = S + p"
] | false | 0.062418 | 0.037868 | 1.6483 | [
"s393054247",
"s357607127"
] |
u371763408 | p03329 | python | s035513380 | s448079779 | 721 | 408 | 3,956 | 4,920 | Accepted | Accepted | 43.41 | n = int(eval(input()))
max_n = 100000
dp = [10000 for i in range(max_n+1)]
dp[0] = 0
for i in range(n+1):
k = 1
while i + k <= n:
dp[i+k] = min(dp[i+k],dp[i]+1)
k *=6
k = 1
while i + k <= n:
dp[i+k] = min(dp[i+k],dp[i]+1)
k*=9
print((dp[n])) | from collections import deque
n = int(eval(input()))
max_n = 100000
dp = [10000 for i in range(max_n+1)]
dp[0] = 0
que = deque()
que.append(0)
while len(que) > 0:
v = que.popleft()
k = 1
while v + k <= n:
if dp[v+k] == 10000:
dp[v+k]=dp[v]+1
que.append(v+k)
k *= 6
k = 1
w... | 16 | 23 | 274 | 428 | n = int(eval(input()))
max_n = 100000
dp = [10000 for i in range(max_n + 1)]
dp[0] = 0
for i in range(n + 1):
k = 1
while i + k <= n:
dp[i + k] = min(dp[i + k], dp[i] + 1)
k *= 6
k = 1
while i + k <= n:
dp[i + k] = min(dp[i + k], dp[i] + 1)
k *= 9
print((dp[n]))
| from collections import deque
n = int(eval(input()))
max_n = 100000
dp = [10000 for i in range(max_n + 1)]
dp[0] = 0
que = deque()
que.append(0)
while len(que) > 0:
v = que.popleft()
k = 1
while v + k <= n:
if dp[v + k] == 10000:
dp[v + k] = dp[v] + 1
que.append(v + k)
... | false | 30.434783 | [
"+from collections import deque",
"+",
"-for i in range(n + 1):",
"+que = deque()",
"+que.append(0)",
"+while len(que) > 0:",
"+ v = que.popleft()",
"- while i + k <= n:",
"- dp[i + k] = min(dp[i + k], dp[i] + 1)",
"+ while v + k <= n:",
"+ if dp[v + k] == 10000:",
"+ ... | false | 0.093039 | 0.127372 | 0.730452 | [
"s035513380",
"s448079779"
] |
u983918956 | p03450 | python | s820024628 | s431243182 | 1,232 | 1,110 | 57,164 | 8,944 | Accepted | Accepted | 9.9 | import sys
input = sys.stdin.readline
class WeightedUnionfind:
__slots__ = ['nodes','diff_weight']
def __init__(self, n):
self.nodes = [-1]*n
self.diff_weight = [0]*n
def root(self, x):
if self.nodes[x] < 0:
return x
else:
root_x = s... | import sys
input = sys.stdin.readline
class WeightedUnionfind:
__slots__ = ['nodes','diff_weight']
def __init__(self, n):
self.nodes = [-1]*n
self.diff_weight = [0]*n
def root(self, x):
if self.nodes[x] < 0:
return x
else:
root_x = s... | 59 | 58 | 1,507 | 1,472 | import sys
input = sys.stdin.readline
class WeightedUnionfind:
__slots__ = ["nodes", "diff_weight"]
def __init__(self, n):
self.nodes = [-1] * n
self.diff_weight = [0] * n
def root(self, x):
if self.nodes[x] < 0:
return x
else:
root_x = self.root(... | import sys
input = sys.stdin.readline
class WeightedUnionfind:
__slots__ = ["nodes", "diff_weight"]
def __init__(self, n):
self.nodes = [-1] * n
self.diff_weight = [0] * n
def root(self, x):
if self.nodes[x] < 0:
return x
else:
root_x = self.root(... | false | 1.694915 | [
"- rank_x = -self.nodes[x]",
"- rank_y = -self.nodes[y]",
"- if rank_x < rank_y:",
"+ size_x = -self.nodes[x]",
"+ size_y = -self.nodes[y]",
"+ if size_x < size_y:",
"- if rank_x == rank_y:",
"- self.nodes[x] -= 1",
"+ self.nodes[x] ... | false | 0.300588 | 0.311189 | 0.965933 | [
"s820024628",
"s431243182"
] |
u347600233 | p02831 | python | s800659767 | s330564451 | 35 | 28 | 5,048 | 9,172 | Accepted | Accepted | 20 | from fractions import gcd
a , b = list(map(int, input().split()))
print(((a * b) // gcd(a, b))) | from math import gcd
a, b = list(map(int, input().split()))
print((int(a*b / gcd(a, b)))) | 3 | 3 | 89 | 83 | from fractions import gcd
a, b = list(map(int, input().split()))
print(((a * b) // gcd(a, b)))
| from math import gcd
a, b = list(map(int, input().split()))
print((int(a * b / gcd(a, b))))
| false | 0 | [
"-from fractions import gcd",
"+from math import gcd",
"-print(((a * b) // gcd(a, b)))",
"+print((int(a * b / gcd(a, b))))"
] | false | 0.056879 | 0.038901 | 1.462154 | [
"s800659767",
"s330564451"
] |
u367701763 | p03163 | python | s796417454 | s694997745 | 265 | 242 | 147,148 | 152,564 | Accepted | Accepted | 8.68 | #####################################################################################################
##### ナップサック問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=ja
#####################################################################################################
import sys
input = s... | import sys
input = sys.stdin.readline
M, W = list(map(int, input().split())) # M: 品物の種類 W: 重量制限
single = True # True = 重複なし
price_list = [0]
weight_list = [0]
for _ in range(M):
weight, price = list(map(int, input().spli... | 42 | 44 | 2,074 | 1,775 | #####################################################################################################
##### ナップサック問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=ja
#####################################################################################################
import sys
input = sys.stdi... | import sys
input = sys.stdin.readline
M, W = list(map(int, input().split())) # M: 品物の種類 W: 重量制限
single = True # True = 重複なし
price_list = [0]
weight_list = [0]
for _ in range(M):
weight, price = list(map(int, input().split()))
price_list.append(price)
weight_list.append(weight)
###########################... | false | 4.545455 | [
"-#####################################################################################################",
"-##### ナップサック問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=ja",
"-#####################################################################################################",
"-dp_m... | false | 0.042199 | 0.040834 | 1.033426 | [
"s796417454",
"s694997745"
] |
u170201762 | p03370 | python | s270973104 | s166993504 | 22 | 17 | 3,064 | 3,060 | Accepted | Accepted | 22.73 | N,X = list(map(int, input().split()))
m = [int(eval(input())) for i in range(N)]
for x in m:
X -= x
m.sort()
n = int(X/m[0])
print((n + len(m))) | N,X = list(map(int,input().split()))
m = [int(eval(input())) for _ in range(N)]
ans = N
X -= sum(m)
m = min(m)
ans += X//m
print(ans) | 7 | 7 | 138 | 127 | N, X = list(map(int, input().split()))
m = [int(eval(input())) for i in range(N)]
for x in m:
X -= x
m.sort()
n = int(X / m[0])
print((n + len(m)))
| N, X = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(N)]
ans = N
X -= sum(m)
m = min(m)
ans += X // m
print(ans)
| false | 0 | [
"-m = [int(eval(input())) for i in range(N)]",
"-for x in m:",
"- X -= x",
"-m.sort()",
"-n = int(X / m[0])",
"-print((n + len(m)))",
"+m = [int(eval(input())) for _ in range(N)]",
"+ans = N",
"+X -= sum(m)",
"+m = min(m)",
"+ans += X // m",
"+print(ans)"
] | false | 0.097763 | 0.062429 | 1.565993 | [
"s270973104",
"s166993504"
] |
u300968187 | p03087 | python | s641791388 | s200856287 | 845 | 485 | 6,084 | 30,704 | Accepted | Accepted | 42.6 | n, q = list(map(int, input().split()))
s = ' ' + eval(input())
heap = [0] * (n + 1)
cnt = 0
for i in range(2, n + 1):
if s[i - 1] == 'A' and s[i] == 'C':
cnt += 1;
heap[i] = cnt
for i in range(q):
l, r = list(map(int, input().split()))
print((heap[r] - heap[l])) | n, q = list(map(int, input().split()))
s = eval(input())
q_list = [list(map(int, input().split()))for _ in range(q)]
cum_sum = [0] * n
for i in range(1, n):
cum_sum[i] = cum_sum[i - 1]
if s[i - 1: i + 1] == "AC":
cum_sum[i] += 1
for i in range(q):
print((cum_sum[q_list[i][1] - 1] - cum_... | 11 | 12 | 276 | 329 | n, q = list(map(int, input().split()))
s = " " + eval(input())
heap = [0] * (n + 1)
cnt = 0
for i in range(2, n + 1):
if s[i - 1] == "A" and s[i] == "C":
cnt += 1
heap[i] = cnt
for i in range(q):
l, r = list(map(int, input().split()))
print((heap[r] - heap[l]))
| n, q = list(map(int, input().split()))
s = eval(input())
q_list = [list(map(int, input().split())) for _ in range(q)]
cum_sum = [0] * n
for i in range(1, n):
cum_sum[i] = cum_sum[i - 1]
if s[i - 1 : i + 1] == "AC":
cum_sum[i] += 1
for i in range(q):
print((cum_sum[q_list[i][1] - 1] - cum_sum[q_list[... | false | 8.333333 | [
"-s = \" \" + eval(input())",
"-heap = [0] * (n + 1)",
"-cnt = 0",
"-for i in range(2, n + 1):",
"- if s[i - 1] == \"A\" and s[i] == \"C\":",
"- cnt += 1",
"- heap[i] = cnt",
"+s = eval(input())",
"+q_list = [list(map(int, input().split())) for _ in range(q)]",
"+cum_sum = [0] * n",
... | false | 0.10013 | 0.036064 | 2.776483 | [
"s641791388",
"s200856287"
] |
u543085532 | p02675 | python | s659902964 | s129213653 | 56 | 27 | 61,752 | 9,108 | Accepted | Accepted | 51.79 | number = eval(input())
if number[-1] == '3':
print('bon')
elif number[-1] in ['0', '6', '1', '8']:
print('pon')
else:
print('hon') | digitsStr = eval(input())
honlist = ["2","4","5","7","9"]
ponList = ["0","1","6","8"]
if digitsStr[-1] == '3':
print('bon')
elif digitsStr[-1] in honlist:
print('hon')
elif digitsStr[-1] in ponList:
print('pon') | 8 | 9 | 144 | 225 | number = eval(input())
if number[-1] == "3":
print("bon")
elif number[-1] in ["0", "6", "1", "8"]:
print("pon")
else:
print("hon")
| digitsStr = eval(input())
honlist = ["2", "4", "5", "7", "9"]
ponList = ["0", "1", "6", "8"]
if digitsStr[-1] == "3":
print("bon")
elif digitsStr[-1] in honlist:
print("hon")
elif digitsStr[-1] in ponList:
print("pon")
| false | 11.111111 | [
"-number = eval(input())",
"-if number[-1] == \"3\":",
"+digitsStr = eval(input())",
"+honlist = [\"2\", \"4\", \"5\", \"7\", \"9\"]",
"+ponList = [\"0\", \"1\", \"6\", \"8\"]",
"+if digitsStr[-1] == \"3\":",
"-elif number[-1] in [\"0\", \"6\", \"1\", \"8\"]:",
"+elif digitsStr[-1] in honlist:",
"+ ... | false | 0.037935 | 0.074066 | 0.512183 | [
"s659902964",
"s129213653"
] |
u802234211 | p02700 | python | s538485087 | s451980929 | 22 | 19 | 9,164 | 9,168 | Accepted | Accepted | 13.64 | a,b,c,d = list(map(int,input().split()))
while all:
c -= b
if(c <= 0):
print("Yes")
break
a -= d
if(a <= 0):
print("No")
break
| A,B,C,D = list(map(int,input().split()))
while all:
C -= B
if(C<=0):
print("Yes")
break
A -= D
if(A<=0):
print("No")
break
| 11 | 11 | 180 | 179 | a, b, c, d = list(map(int, input().split()))
while all:
c -= b
if c <= 0:
print("Yes")
break
a -= d
if a <= 0:
print("No")
break
| A, B, C, D = list(map(int, input().split()))
while all:
C -= B
if C <= 0:
print("Yes")
break
A -= D
if A <= 0:
print("No")
break
| false | 0 | [
"-a, b, c, d = list(map(int, input().split()))",
"+A, B, C, D = list(map(int, input().split()))",
"- c -= b",
"- if c <= 0:",
"+ C -= B",
"+ if C <= 0:",
"- a -= d",
"- if a <= 0:",
"+ A -= D",
"+ if A <= 0:"
] | false | 0.046787 | 0.046707 | 1.001707 | [
"s538485087",
"s451980929"
] |
u391331433 | p03241 | python | s893108857 | s103789222 | 245 | 51 | 17,584 | 30,956 | Accepted | Accepted | 79.18 | import sys
from collections import deque
import copy
import math
import numpy as np
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def divisor_sub(p, q):
a = []
for i in range(0, q + 1):
a.append(p ** i)
... | import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = None
read_func =... | 99 | 34 | 2,234 | 730 | import sys
from collections import deque
import copy
import math
import numpy as np
def get_read_func(fileobject):
if fileobject == None:
return raw_input
else:
return fileobject.readline
def divisor_sub(p, q):
a = []
for i in range(0, q + 1):
a.append(p**i)
return a
de... | import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
if fileobject == None:
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = None
read_func = get_read_fun... | false | 65.656566 | [
"-import numpy as np",
"-",
"-",
"-def divisor_sub(p, q):",
"- a = []",
"- for i in range(0, q + 1):",
"- a.append(p**i)",
"- return a",
"-",
"-",
"-def factorization(n):",
"- def factor_sub(n, m):",
"- c = 0",
"- while n % m == 0:",
"- c += 1"... | false | 0.096619 | 0.038259 | 2.525412 | [
"s893108857",
"s103789222"
] |
u781622789 | p00357 | python | s023514659 | s452481740 | 1,100 | 930 | 17,444 | 17,452 | Accepted | Accepted | 15.45 | n = int(eval(input()))
d = [int(eval(input())) for i in range(n)]
pos = 0
ans = "yes"
for i in range(n):
if pos>=i*10:
pos = max(pos,i*10+d[i])
else:
ans = "no"
break
if pos >= (n-1)*10:
break
pos = 0
for i in range(n):
if pos>=i*10:
... | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
ok = True
rg = list(range(n))
l = 0
for i,d in zip(rg,a):
if i*10 > l:
ok = False
break
if l >= (n-1)*10:
break
if i*10+d > l:
l = i*10+d
a.reverse()
l = 0
for i,d in zip(rg,a):
if i*10 ... | 22 | 30 | 464 | 472 | n = int(eval(input()))
d = [int(eval(input())) for i in range(n)]
pos = 0
ans = "yes"
for i in range(n):
if pos >= i * 10:
pos = max(pos, i * 10 + d[i])
else:
ans = "no"
break
if pos >= (n - 1) * 10:
break
pos = 0
for i in range(n):
if pos >= i * 10:
pos = max(pos... | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
ok = True
rg = list(range(n))
l = 0
for i, d in zip(rg, a):
if i * 10 > l:
ok = False
break
if l >= (n - 1) * 10:
break
if i * 10 + d > l:
l = i * 10 + d
a.reverse()
l = 0
for i, d in zip(rg, a):
if i * 10 ... | false | 26.666667 | [
"-d = [int(eval(input())) for i in range(n)]",
"-pos = 0",
"-ans = \"yes\"",
"-for i in range(n):",
"- if pos >= i * 10:",
"- pos = max(pos, i * 10 + d[i])",
"- else:",
"- ans = \"no\"",
"+a = [int(eval(input())) for i in range(n)]",
"+ok = True",
"+rg = list(range(n))",
"+... | false | 0.032497 | 0.034989 | 0.928771 | [
"s023514659",
"s452481740"
] |
u905203728 | p03244 | python | s222209141 | s502474117 | 135 | 117 | 20,692 | 20,700 | Accepted | Accepted | 13.33 | from collections import Counter
n=int(eval(input()))
V=list(map(int,input().split()))
V_1=[(0,0)]+sorted(list(Counter([V[i] for i in range(n) if i%2==0]).items()), key=lambda x:x[1])
V_2=[(0,0)]+sorted(list(Counter([V[j] for j in range(n) if j%2==1]).items()), key=lambda x:x[1])
a,b=V_1[-1][0],V_2[-1][0]
if... | from collections import Counter
n=int(eval(input()))
V=list(map(int,input().split()))
even=[(0,0)]+sorted(list(Counter(V[::2]).items()), key=lambda x:x[1])
odd=[(0,0)]+sorted(list(Counter(V[1::2]).items()), key=lambda x:x[1])
if even[-1][0]==odd[-1][0]:
if even[-2][1]>odd[-2][1]:even=even[-2][0];odd=odd[-... | 21 | 18 | 500 | 507 | from collections import Counter
n = int(eval(input()))
V = list(map(int, input().split()))
V_1 = [(0, 0)] + sorted(
list(Counter([V[i] for i in range(n) if i % 2 == 0]).items()), key=lambda x: x[1]
)
V_2 = [(0, 0)] + sorted(
list(Counter([V[j] for j in range(n) if j % 2 == 1]).items()), key=lambda x: x[1]
)
a,... | from collections import Counter
n = int(eval(input()))
V = list(map(int, input().split()))
even = [(0, 0)] + sorted(list(Counter(V[::2]).items()), key=lambda x: x[1])
odd = [(0, 0)] + sorted(list(Counter(V[1::2]).items()), key=lambda x: x[1])
if even[-1][0] == odd[-1][0]:
if even[-2][1] > odd[-2][1]:
even ... | false | 14.285714 | [
"-V_1 = [(0, 0)] + sorted(",
"- list(Counter([V[i] for i in range(n) if i % 2 == 0]).items()), key=lambda x: x[1]",
"-)",
"-V_2 = [(0, 0)] + sorted(",
"- list(Counter([V[j] for j in range(n) if j % 2 == 1]).items()), key=lambda x: x[1]",
"-)",
"-a, b = V_1[-1][0], V_2[-1][0]",
"-if a == b:",
"... | false | 0.115923 | 0.112161 | 1.033532 | [
"s222209141",
"s502474117"
] |
u186838327 | p03067 | python | s061773539 | s511450114 | 172 | 66 | 38,384 | 61,648 | Accepted | Accepted | 61.63 | a, b, c = list(map(int, input().split()))
if min(a, b) < c and c < max(a, b):
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
if a <= c <= b or b <= c <= a:
print('Yes')
else:
print('No')
| 5 | 5 | 110 | 110 | a, b, c = list(map(int, input().split()))
if min(a, b) < c and c < max(a, b):
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if a <= c <= b or b <= c <= a:
print("Yes")
else:
print("No")
| false | 0 | [
"-if min(a, b) < c and c < max(a, b):",
"+if a <= c <= b or b <= c <= a:"
] | false | 0.086426 | 0.133529 | 0.647248 | [
"s061773539",
"s511450114"
] |
u002459665 | p03400 | python | s012853976 | s001467300 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | def main():
n = int(eval(input()))
d, x = list(map(int, input().split()))
a_ = []
for _ in range(n):
a_.append(int(eval(input())))
l = []
for i in range(1, 101):
for a in a_:
r = (i - 1) * a + 1
if r <= d:
l.append(r)
pr... | def main():
n = int(eval(input()))
d, x = list(map(int, input().split()))
a_ = []
for _ in range(n):
a_.append(int(eval(input())))
cnt = 0
for a in a_:
i = 1 # スタート
while i <= d:
i += a
cnt += 1
print((cnt + x))
if __name__ ... | 19 | 18 | 362 | 327 | def main():
n = int(eval(input()))
d, x = list(map(int, input().split()))
a_ = []
for _ in range(n):
a_.append(int(eval(input())))
l = []
for i in range(1, 101):
for a in a_:
r = (i - 1) * a + 1
if r <= d:
l.append(r)
print((len(l) + x)... | def main():
n = int(eval(input()))
d, x = list(map(int, input().split()))
a_ = []
for _ in range(n):
a_.append(int(eval(input())))
cnt = 0
for a in a_:
i = 1 # スタート
while i <= d:
i += a
cnt += 1
print((cnt + x))
if __name__ == "__main__":
... | false | 5.263158 | [
"- l = []",
"- for i in range(1, 101):",
"- for a in a_:",
"- r = (i - 1) * a + 1",
"- if r <= d:",
"- l.append(r)",
"- print((len(l) + x))",
"+ cnt = 0",
"+ for a in a_:",
"+ i = 1 # スタート",
"+ while i <= d:",
"+ ... | false | 0.042632 | 0.043555 | 0.978815 | [
"s012853976",
"s001467300"
] |
u380524497 | p03448 | python | s017006809 | s466073903 | 49 | 18 | 3,064 | 3,064 | Accepted | Accepted | 63.27 | a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
x = int(eval(input()))
count = 0
for an in range(a+1):
if 500 * an == x:
count += 1
break
else:
for bn in range(b+1):
if 500 * an + 100 * bn == x:
count += 1
... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for count500 in range(a+1):
for count100 in range(b+1):
value = 500 * count500 + 100 * count100
delta = x - value
if delta < 0:
break
if delta % 50 == 0 and ... | 23 | 17 | 520 | 349 | a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
x = int(eval(input()))
count = 0
for an in range(a + 1):
if 500 * an == x:
count += 1
break
else:
for bn in range(b + 1):
if 500 * an + 100 * bn == x:
count += 1
... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for count500 in range(a + 1):
for count100 in range(b + 1):
value = 500 * count500 + 100 * count100
delta = x - value
if delta < 0:
break
if delta % 50 == 0 and delta // 50... | false | 26.086957 | [
"-a = int(eval(input())) # 500",
"-b = int(eval(input())) # 100",
"-c = int(eval(input())) # 50",
"+a = int(eval(input()))",
"+b = int(eval(input()))",
"+c = int(eval(input()))",
"-count = 0",
"-for an in range(a + 1):",
"- if 500 * an == x:",
"- count += 1",
"- break",
"- ... | false | 0.113842 | 0.036306 | 3.135603 | [
"s017006809",
"s466073903"
] |
u354053070 | p02386 | python | s215535487 | s839347767 | 120 | 90 | 7,808 | 7,832 | Accepted | Accepted | 25 | def roll(die, d):
if d == "E":
return [die[3], die[1], die[0], die[5], die[4], die[2]]
if d == "N":
return [die[1], die[5], die[2], die[3], die[0], die[4]]
if d == "S":
return [die[4], die[0], die[2], die[3], die[5], die[1]]
if d == "W":
return [die[2], die[1], di... | def roll(die, d):
if d == "E":
return [die[3], die[1], die[0], die[5], die[4], die[2]]
if d == "N":
return [die[1], die[5], die[2], die[3], die[0], die[4]]
if d == "S":
return [die[4], die[0], die[2], die[3], die[5], die[1]]
if d == "W":
return [die[2], die[1], di... | 33 | 36 | 961 | 1,016 | def roll(die, d):
if d == "E":
return [die[3], die[1], die[0], die[5], die[4], die[2]]
if d == "N":
return [die[1], die[5], die[2], die[3], die[0], die[4]]
if d == "S":
return [die[4], die[0], die[2], die[3], die[5], die[1]]
if d == "W":
return [die[2], die[1], die[5], di... | def roll(die, d):
if d == "E":
return [die[3], die[1], die[0], die[5], die[4], die[2]]
if d == "N":
return [die[1], die[5], die[2], die[3], die[0], die[4]]
if d == "S":
return [die[4], die[0], die[2], die[3], die[5], die[1]]
if d == "W":
return [die[2], die[1], die[5], di... | false | 8.333333 | [
"+ break",
"+ if msg == \"No\":",
"+ break"
] | false | 0.042692 | 0.044396 | 0.961628 | [
"s215535487",
"s839347767"
] |
u950708010 | p02971 | python | s688893044 | s150581799 | 497 | 366 | 4,540 | 51,804 | Accepted | Accepted | 26.36 |
def solve():
n = int(eval(input()))
maxi = -10
maxi2 = -10
place = -1
for i in range(n):
a = int(eval(input()))
if a>maxi:
maxi2 = maxi
maxi = a
place = i
else:
maxi2 = max(maxi2,a)
for j in range(n):
if place == j:
print(maxi2)
else:
... | import sys
input = sys.stdin.readline
def solve():
n = int(eval(input()))
maxi = -10
maxi2 = -10
place = -1
for i in range(n):
a = int(eval(input()))
if a>maxi:
maxi2 = maxi
maxi = a
place = i
else:
maxi2 = max(maxi2,a)
for j in range(n):
if place ... | 21 | 23 | 334 | 376 | def solve():
n = int(eval(input()))
maxi = -10
maxi2 = -10
place = -1
for i in range(n):
a = int(eval(input()))
if a > maxi:
maxi2 = maxi
maxi = a
place = i
else:
maxi2 = max(maxi2, a)
for j in range(n):
if place == ... | import sys
input = sys.stdin.readline
def solve():
n = int(eval(input()))
maxi = -10
maxi2 = -10
place = -1
for i in range(n):
a = int(eval(input()))
if a > maxi:
maxi2 = maxi
maxi = a
place = i
else:
maxi2 = max(maxi2, a)
... | false | 8.695652 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.034034 | 0.082096 | 0.414567 | [
"s688893044",
"s150581799"
] |
u074220993 | p03504 | python | s128119807 | s908550121 | 551 | 484 | 73,484 | 88,868 | Accepted | Accepted | 12.16 | import numpy as np
N, C = (int(x) for x in input().split())
R = [[0]*100000 for _ in range(C)] #R[c][t]:時刻t+1にチャンネルc+1を録画するのに必要な録画機の個数
R = np.array(R)
for _ in range(N):
s, t, c = list(map(int,input().split()))
R[c-1,s-1:t] = 1
ans = max(sum(R))
print(ans) | import numpy as np
def main():
with open(0) as f:
N, C = list(map(int, f.readline().split()))
Rec = [tuple(map(int, f.readline().split())) for _ in range(N)]
time_line_by_channel = np.array([[0] * (10**5+1) for _ in range(C+1)])
#チャンネルごとにタイムラインを作成
for s, t, c in Rec:
... | 9 | 17 | 266 | 486 | import numpy as np
N, C = (int(x) for x in input().split())
R = [[0] * 100000 for _ in range(C)] # R[c][t]:時刻t+1にチャンネルc+1を録画するのに必要な録画機の個数
R = np.array(R)
for _ in range(N):
s, t, c = list(map(int, input().split()))
R[c - 1, s - 1 : t] = 1
ans = max(sum(R))
print(ans)
| import numpy as np
def main():
with open(0) as f:
N, C = list(map(int, f.readline().split()))
Rec = [tuple(map(int, f.readline().split())) for _ in range(N)]
time_line_by_channel = np.array([[0] * (10**5 + 1) for _ in range(C + 1)])
# チャンネルごとにタイムラインを作成
for s, t, c in Rec:
time_... | false | 47.058824 | [
"-N, C = (int(x) for x in input().split())",
"-R = [[0] * 100000 for _ in range(C)] # R[c][t]:時刻t+1にチャンネルc+1を録画するのに必要な録画機の個数",
"-R = np.array(R)",
"-for _ in range(N):",
"- s, t, c = list(map(int, input().split()))",
"- R[c - 1, s - 1 : t] = 1",
"-ans = max(sum(R))",
"-print(ans)",
"+",
"+d... | false | 0.89065 | 0.722886 | 1.232074 | [
"s128119807",
"s908550121"
] |
u260980560 | p01314 | python | s173144387 | s423747608 | 20 | 10 | 4,352 | 4,200 | Accepted | Accepted | 50 | import math
while 1:
n = int(input())
if not n:
break
ans = 0
for p in range(1, int(math.sqrt(2*n))+1):
if 2*n % p ==0:
q = 2*n / p
if p>1 and (p+q)%2:
ans += 1
print(ans) | while 1:
n = int(input())
if not n:
break
ans = 0
p = 2
while p**2 <= 2*n:
if not 2*n % p:
if (p + 2*n/p) % 2:
ans += 1
p += 1
print(ans) | 12 | 12 | 262 | 227 | import math
while 1:
n = int(input())
if not n:
break
ans = 0
for p in range(1, int(math.sqrt(2 * n)) + 1):
if 2 * n % p == 0:
q = 2 * n / p
if p > 1 and (p + q) % 2:
ans += 1
print(ans)
| while 1:
n = int(input())
if not n:
break
ans = 0
p = 2
while p**2 <= 2 * n:
if not 2 * n % p:
if (p + 2 * n / p) % 2:
ans += 1
p += 1
print(ans)
| false | 0 | [
"-import math",
"-",
"- for p in range(1, int(math.sqrt(2 * n)) + 1):",
"- if 2 * n % p == 0:",
"- q = 2 * n / p",
"- if p > 1 and (p + q) % 2:",
"+ p = 2",
"+ while p**2 <= 2 * n:",
"+ if not 2 * n % p:",
"+ if (p + 2 * n / p) % 2:",
"+ ... | false | 0.104307 | 0.054088 | 1.928445 | [
"s173144387",
"s423747608"
] |
u185424824 | p03387 | python | s698566297 | s409440322 | 176 | 162 | 38,384 | 38,384 | Accepted | Accepted | 7.95 | N = list(map(int,input().split()))
N.sort()
A = N[0]
B = N[1]
C = N[2]
ans = 0
if max(N) == min(N):
print(ans)
exit()
if (B-A)%2 == 0:
ans += (B-A)//2 + C - B
else:
ans += 1
B += 1
C += 1
ans += (B-A)//2 + C - B
print(ans)
| L = list(map(int,input().split()))
L.sort()
ans = 0
if (L[1] - L[0]) % 2 == 0:
ans += (L[1] - L[0]) // 2
ans += L[2] - L[1]
else:
ans += 1
L[0] += 1
L[2] += 1
ans += (L[1] - L[0]) // 2
ans += L[2] - L[1]
print(ans)
| 19 | 14 | 260 | 257 | N = list(map(int, input().split()))
N.sort()
A = N[0]
B = N[1]
C = N[2]
ans = 0
if max(N) == min(N):
print(ans)
exit()
if (B - A) % 2 == 0:
ans += (B - A) // 2 + C - B
else:
ans += 1
B += 1
C += 1
ans += (B - A) // 2 + C - B
print(ans)
| L = list(map(int, input().split()))
L.sort()
ans = 0
if (L[1] - L[0]) % 2 == 0:
ans += (L[1] - L[0]) // 2
ans += L[2] - L[1]
else:
ans += 1
L[0] += 1
L[2] += 1
ans += (L[1] - L[0]) // 2
ans += L[2] - L[1]
print(ans)
| false | 26.315789 | [
"-N = list(map(int, input().split()))",
"-N.sort()",
"-A = N[0]",
"-B = N[1]",
"-C = N[2]",
"+L = list(map(int, input().split()))",
"+L.sort()",
"-if max(N) == min(N):",
"- print(ans)",
"- exit()",
"-if (B - A) % 2 == 0:",
"- ans += (B - A) // 2 + C - B",
"+if (L[1] - L[0]) % 2 == 0... | false | 0.042602 | 0.140366 | 0.303508 | [
"s698566297",
"s409440322"
] |
u659753499 | p03287 | python | s925961768 | s697865403 | 135 | 88 | 14,628 | 14,920 | Accepted | Accepted | 34.81 | from collections import Counter
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.insert(0,0)
cnt = Counter()
for i in range(N): A[i+1] += A[i]
for i in range(N+1): cnt[A[i]%M] += 1
print((sum(n*(n-1)//2 for n in list(cnt.values()))))
| from collections import Counter
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A[0] = A[0] % M
for i in range(1,N): A[i] = (A[i]+A[i-1])%M
cnt = Counter([0]+A)
print((sum(n*(n-1)//2 for n in list(cnt.values()))))
| 8 | 7 | 248 | 226 | from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.insert(0, 0)
cnt = Counter()
for i in range(N):
A[i + 1] += A[i]
for i in range(N + 1):
cnt[A[i] % M] += 1
print((sum(n * (n - 1) // 2 for n in list(cnt.values()))))
| from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A[0] = A[0] % M
for i in range(1, N):
A[i] = (A[i] + A[i - 1]) % M
cnt = Counter([0] + A)
print((sum(n * (n - 1) // 2 for n in list(cnt.values()))))
| false | 12.5 | [
"-A.insert(0, 0)",
"-cnt = Counter()",
"-for i in range(N):",
"- A[i + 1] += A[i]",
"-for i in range(N + 1):",
"- cnt[A[i] % M] += 1",
"+A[0] = A[0] % M",
"+for i in range(1, N):",
"+ A[i] = (A[i] + A[i - 1]) % M",
"+cnt = Counter([0] + A)"
] | false | 0.037175 | 0.037395 | 0.994122 | [
"s925961768",
"s697865403"
] |
u173148629 | p02838 | python | s456786078 | s599849788 | 1,976 | 634 | 42,156 | 122,936 | Accepted | Accepted | 67.91 | def main():
N=int(eval(input()))
A=list(map(int,input().split()))
mod=10**9+7
ans=0
for i in range(60):
a=0
for x in A:
if x>>i&1:
a+=1
ans+=a*(N-a)*pow(2,i,mod)
ans%=mod
print(ans)
if __name__ == '__main__':
main() | N=int(eval(input()))
A=list(map(int,input().split()))
mod=10**9+7
ans=0
for i in range(60):
a=0
for x in A:
if x>>i&1:
a+=1
ans+=a*(N-a)*pow(2,i,mod)
ans%=mod
print(ans)
| 17 | 16 | 291 | 223 | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(60):
a = 0
for x in A:
if x >> i & 1:
a += 1
ans += a * (N - a) * pow(2, i, mod)
ans %= mod
print(ans)
if __name__ == "__mai... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(60):
a = 0
for x in A:
if x >> i & 1:
a += 1
ans += a * (N - a) * pow(2, i, mod)
ans %= mod
print(ans)
| false | 5.882353 | [
"-def main():",
"- N = int(eval(input()))",
"- A = list(map(int, input().split()))",
"- mod = 10**9 + 7",
"- ans = 0",
"- for i in range(60):",
"- a = 0",
"- for x in A:",
"- if x >> i & 1:",
"- a += 1",
"- ans += a * (N - a) * pow(2,... | false | 0.042175 | 0.036432 | 1.157637 | [
"s456786078",
"s599849788"
] |
u393253137 | p03578 | python | s739388220 | s238018077 | 261 | 232 | 59,108 | 59,108 | Accepted | Accepted | 11.11 | def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
if dic.get(d):
dic[d] += 1
else:
dic[d] = 1
... | def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
if d in dic:
dic[d] += 1
else:
dic[d] = 1
... | 22 | 22 | 467 | 465 | def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
if dic.get(d):
dic[d] += 1
else:
dic[d] = 1
for t in T:
if t... | def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
if d in dic:
dic[d] += 1
else:
dic[d] = 1
for t in T:
if t n... | false | 0 | [
"- if dic.get(d):",
"+ if d in dic:"
] | false | 0.122327 | 0.045928 | 2.663452 | [
"s739388220",
"s238018077"
] |
u489959379 | p03038 | python | s577958920 | s097929558 | 263 | 206 | 39,652 | 36,528 | Accepted | Accepted | 21.67 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
query = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1],
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: -x[1])
C = [... | 52 | 25 | 1,143 | 526 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
query = sorted(
[list(map(int, input().split())) for _ in range(m)],
key=lambda x: x[1]... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = sorted(
[list(map(int, input().split())) for _ in range(m)], key=lambda x: -x[1]
)
C = []
... | false | 51.923077 | [
"- A = sorted(list(map(int, input().split())))",
"- query = sorted(",
"- [list(map(int, input().split())) for _ in range(m)],",
"- key=lambda x: x[1],",
"- reverse=True,",
"+ A = list(map(int, input().split()))",
"+ BC = sorted(",
"+ [list(map(int, input().split... | false | 0.111717 | 0.087008 | 1.283991 | [
"s577958920",
"s097929558"
] |
u282228874 | p02984 | python | s696372356 | s354721934 | 276 | 155 | 31,128 | 14,092 | Accepted | Accepted | 43.84 | n = int(eval(input()))
A = list(map(int,input().split()))
A += A
#print(A)
Aeven = []
for i in range(2*n):
if i%2 == 0:
Aeven.append(A[i])
else:
Aeven.append(-A[i])
Aodd = []
for i in range(2*n):
if i%2 == 0:
Aodd.append(-A[i])
else:
Aodd.append(A[i])
from... | n = int(eval(input()))
A = list(map(int,input().split()))
res = 0
for i in range(n):
if(i%2==0):res+=A[i]
else:res-=A[i]
print(res)
for i in range(1,n):
res = 2*A[i-1]-res
print(res)
| 25 | 10 | 536 | 202 | n = int(eval(input()))
A = list(map(int, input().split()))
A += A
# print(A)
Aeven = []
for i in range(2 * n):
if i % 2 == 0:
Aeven.append(A[i])
else:
Aeven.append(-A[i])
Aodd = []
for i in range(2 * n):
if i % 2 == 0:
Aodd.append(-A[i])
else:
Aodd.append(A[i])
from itert... | n = int(eval(input()))
A = list(map(int, input().split()))
res = 0
for i in range(n):
if i % 2 == 0:
res += A[i]
else:
res -= A[i]
print(res)
for i in range(1, n):
res = 2 * A[i - 1] - res
print(res)
| false | 60 | [
"-A += A",
"-# print(A)",
"-Aeven = []",
"-for i in range(2 * n):",
"- if i % 2 == 0:",
"- Aeven.append(A[i])",
"- else:",
"- Aeven.append(-A[i])",
"-Aodd = []",
"-for i in range(2 * n):",
"- if i % 2 == 0:",
"- Aodd.append(-A[i])",
"- else:",
"- Aod... | false | 0.038233 | 0.073828 | 0.517872 | [
"s696372356",
"s354721934"
] |
u761320129 | p03762 | python | s745691615 | s099118135 | 189 | 131 | 18,624 | 18,556 | Accepted | Accepted | 30.69 | N,M = list(map(int,input().split()))
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))
MOD = 10**9+7
total_w = total_h = 0
for n in range(1,N):
w = xs[n] - xs[n-1]
w = (w * n * (N-n)) % MOD
total_w = (total_w + w) % MOD
for n in range(1,M):
h = ys[n] - ys[n-1]
h = ... | N,M = list(map(int,input().split()))
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
MOD = 10**9+7
w_sum = 0
for i in range(N//2):
times = N-1 - i*2
w = X[-1-i] - X[i]
w_sum += (w*times)%MOD
w_sum %= MOD
h_sum = 0
for i in range(M//2):
times = M-1 - i*2
h =... | 16 | 20 | 416 | 407 | N, M = list(map(int, input().split()))
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
MOD = 10**9 + 7
total_w = total_h = 0
for n in range(1, N):
w = xs[n] - xs[n - 1]
w = (w * n * (N - n)) % MOD
total_w = (total_w + w) % MOD
for n in range(1, M):
h = ys[n] - ys[n - 1]
h =... | N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
MOD = 10**9 + 7
w_sum = 0
for i in range(N // 2):
times = N - 1 - i * 2
w = X[-1 - i] - X[i]
w_sum += (w * times) % MOD
w_sum %= MOD
h_sum = 0
for i in range(M // 2):
times = M - 1 - i * 2
... | false | 20 | [
"-xs = list(map(int, input().split()))",
"-ys = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"+Y = list(map(int, input().split()))",
"-total_w = total_h = 0",
"-for n in range(1, N):",
"- w = xs[n] - xs[n - 1]",
"- w = (w * n * (N - n)) % MOD",
"- total_w = (tot... | false | 0.031818 | 0.172615 | 0.184327 | [
"s745691615",
"s099118135"
] |
u047796752 | p03291 | python | s327241436 | s583947083 | 217 | 103 | 43,372 | 84,460 | Accepted | Accepted | 52.53 | S = eval(input())
N = len(S)
ans = 0
MOD = 10**9+7
dp = [[0]*4 for _ in range(2)]
dp[0][0] = 1
for i in range(N):
if S[i]=='A':
dp[(i+1)%2][0] = dp[i%2][0]
dp[(i+1)%2][1] = dp[i%2][0]+dp[i%2][1]
dp[(i+1)%2][2] = dp[i%2][2]
dp[(i+1)%2][3] = dp[i%2][3]
elif S[i]=='B':... | import sys
input = sys.stdin.readline
S = input()[:-1]
dp = [[0]*4 for _ in range(len(S)+1)]
dp[0][0] = 1
MOD = 10**9+7
for i in range(len(S)):
dp[i+1][0] = dp[i][0]*(3 if S[i]=='?' else 1)%MOD
dp[i+1][1] = (dp[i][1]*(3 if S[i]=='?' else 1)+(dp[i][0] if S[i] in ['A', '?'] else 0))%MOD
dp[i+1][2... | 33 | 15 | 931 | 523 | S = eval(input())
N = len(S)
ans = 0
MOD = 10**9 + 7
dp = [[0] * 4 for _ in range(2)]
dp[0][0] = 1
for i in range(N):
if S[i] == "A":
dp[(i + 1) % 2][0] = dp[i % 2][0]
dp[(i + 1) % 2][1] = dp[i % 2][0] + dp[i % 2][1]
dp[(i + 1) % 2][2] = dp[i % 2][2]
dp[(i + 1) % 2][3] = dp[i % 2][3]... | import sys
input = sys.stdin.readline
S = input()[:-1]
dp = [[0] * 4 for _ in range(len(S) + 1)]
dp[0][0] = 1
MOD = 10**9 + 7
for i in range(len(S)):
dp[i + 1][0] = dp[i][0] * (3 if S[i] == "?" else 1) % MOD
dp[i + 1][1] = (
dp[i][1] * (3 if S[i] == "?" else 1) + (dp[i][0] if S[i] in ["A", "?"] else 0)... | false | 54.545455 | [
"-S = eval(input())",
"-N = len(S)",
"-ans = 0",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+S = input()[:-1]",
"+dp = [[0] * 4 for _ in range(len(S) + 1)]",
"+dp[0][0] = 1",
"-dp = [[0] * 4 for _ in range(2)]",
"-dp[0][0] = 1",
"-for i in range(N):",
"- if S[i] == \"A\":",
"- ... | false | 0.045488 | 0.044823 | 1.014828 | [
"s327241436",
"s583947083"
] |
u627803856 | p02689 | python | s289831424 | s870270415 | 309 | 215 | 93,548 | 85,012 | Accepted | Accepted | 30.42 | n, m = list(map(int, input().split()))
H = [0] + list(map(int, input().split()))
G = [[] * (n + 1) for _ in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
G[a].append(b)
G[b].append(a)
# print(G)
cnt = 0
for i in range(1, n + 1):
path = G[i] # つながっている展望台の集合
if len(path) == 0... | n, m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
maxh = [0] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
maxh[a] = max(maxh[a], h[b])
maxh[b] = max(maxh[b], h[a])
cnt = 0
for i in range(1, n + 1):
if h[i] > maxh[i]:
cnt += 1
print(cnt) | 27 | 13 | 444 | 298 | n, m = list(map(int, input().split()))
H = [0] + list(map(int, input().split()))
G = [[] * (n + 1) for _ in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
G[a].append(b)
G[b].append(a)
# print(G)
cnt = 0
for i in range(1, n + 1):
path = G[i] # つながっている展望台の集合
if len(path) == ... | n, m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
maxh = [0] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
maxh[a] = max(maxh[a], h[b])
maxh[b] = max(maxh[b], h[a])
cnt = 0
for i in range(1, n + 1):
if h[i] > maxh[i]:
cnt += 1
print(cnt)
| false | 51.851852 | [
"-H = [0] + list(map(int, input().split()))",
"-G = [[] * (n + 1) for _ in range(n + 1)]",
"+h = [0] + list(map(int, input().split()))",
"+maxh = [0] * (n + 1)",
"- G[a].append(b)",
"- G[b].append(a)",
"-# print(G)",
"+ maxh[a] = max(maxh[a], h[b])",
"+ maxh[b] = max(maxh[b], h[a])",
"... | false | 0.097393 | 0.040781 | 2.388195 | [
"s289831424",
"s870270415"
] |
u368796742 | p02558 | python | s537781582 | s387360676 | 792 | 408 | 11,612 | 12,112 | Accepted | Accepted | 48.48 | class Unionfind:
def __init__(self,n):
self.uf = [-1]*n
def find(self,x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self,x,y):
return self.find(x) == self.find(y)
... | import sys
input = sys.stdin.readline
class Unionfind:
def __init__(self,n):
self.uf = [-1]*n
def find(self,x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self,x,y):
... | 38 | 40 | 857 | 897 | class Unionfind:
def __init__(self, n):
self.uf = [-1] * n
def find(self, x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self, x, y):
return self.find(x) == self.find(y)
def union(... | import sys
input = sys.stdin.readline
class Unionfind:
def __init__(self, n):
self.uf = [-1] * n
def find(self, x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self, x, y):
return sel... | false | 5 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.052696 | 0.050772 | 1.037893 | [
"s537781582",
"s387360676"
] |
u384793271 | p02819 | python | s462664040 | s319380375 | 27 | 17 | 2,940 | 2,940 | Accepted | Accepted | 37.04 | x = int(eval(input()))
def is_prime(n):
if n <= 1:
return False
for i in range(2, x):
if x%i == 0:
return False
return True
while is_prime(x) == False:
x += 1
print(x) | import math
x = int(eval(input()))
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(math.sqrt(x))):
if x%i == 0:
return False
return True
while is_prime(x) == False:
x += 1
print(x) | 14 | 16 | 221 | 252 | x = int(eval(input()))
def is_prime(n):
if n <= 1:
return False
for i in range(2, x):
if x % i == 0:
return False
return True
while is_prime(x) == False:
x += 1
print(x)
| import math
x = int(eval(input()))
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(math.sqrt(x))):
if x % i == 0:
return False
return True
while is_prime(x) == False:
x += 1
print(x)
| false | 12.5 | [
"+import math",
"+",
"- for i in range(2, x):",
"+ for i in range(2, int(math.sqrt(x))):"
] | false | 0.036151 | 0.048451 | 0.746132 | [
"s462664040",
"s319380375"
] |
u281796054 | p02780 | python | s302296772 | s117243072 | 159 | 120 | 23,524 | 25,060 | Accepted | Accepted | 24.53 | n,k=list(map(int,input().split()))
p = [(int(s)+1)/2 for s in input().split()]
l = [sum(p[:k])]
for i in range(n-k):
l.append(l[i]-p[i]+p[i+k])
print((max(l))) | n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
P1 = sum(p[:k])
ans = P1
for i in range(k,n):
P1 +=(p[i]-p[i-k])
if ans < P1:
ans = P1
print(((ans+k)/2)) | 6 | 9 | 158 | 193 | n, k = list(map(int, input().split()))
p = [(int(s) + 1) / 2 for s in input().split()]
l = [sum(p[:k])]
for i in range(n - k):
l.append(l[i] - p[i] + p[i + k])
print((max(l)))
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
P1 = sum(p[:k])
ans = P1
for i in range(k, n):
P1 += p[i] - p[i - k]
if ans < P1:
ans = P1
print(((ans + k) / 2))
| false | 33.333333 | [
"-p = [(int(s) + 1) / 2 for s in input().split()]",
"-l = [sum(p[:k])]",
"-for i in range(n - k):",
"- l.append(l[i] - p[i] + p[i + k])",
"-print((max(l)))",
"+p = list(map(int, input().split()))",
"+P1 = sum(p[:k])",
"+ans = P1",
"+for i in range(k, n):",
"+ P1 += p[i] - p[i - k]",
"+ ... | false | 0.064344 | 0.037637 | 1.709619 | [
"s302296772",
"s117243072"
] |
u367130284 | p03262 | python | s343751705 | s431225571 | 267 | 88 | 24,200 | 16,040 | Accepted | Accepted | 67.04 | from numpy import*
from functools import*
from fractions import*
n,X,*x=list(map(int,open(0).read().split()))
print((reduce(gcd,list(abs(array(x)-X))))) | from fractions import*
from functools import*
n,x,*a=list(map(int,open(0).read().split()))
print((reduce(gcd,[abs(x-i) for i in a]))) | 5 | 5 | 148 | 130 | from numpy import *
from functools import *
from fractions import *
n, X, *x = list(map(int, open(0).read().split()))
print((reduce(gcd, list(abs(array(x) - X)))))
| from fractions import *
from functools import *
n, x, *a = list(map(int, open(0).read().split()))
print((reduce(gcd, [abs(x - i) for i in a])))
| false | 0 | [
"-from numpy import *",
"+from fractions import *",
"-from fractions import *",
"-n, X, *x = list(map(int, open(0).read().split()))",
"-print((reduce(gcd, list(abs(array(x) - X)))))",
"+n, x, *a = list(map(int, open(0).read().split()))",
"+print((reduce(gcd, [abs(x - i) for i in a])))"
] | false | 0.563242 | 0.045666 | 12.333947 | [
"s343751705",
"s431225571"
] |
u077291787 | p03161 | python | s402663298 | s049243598 | 460 | 401 | 58,336 | 58,080 | Accepted | Accepted | 12.83 | # dpB - Frog 2
# 貰うDP
def main():
n, k = tuple(map(int, input().rstrip().split()))
A = tuple(map(int, input().rstrip().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
for j in range(1, k + 1):
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j]... | # dpB - Frog 2
# 配るDP
def main():
n, k = tuple(map(int, input().rstrip().split()))
A = tuple(map(int, input().rstrip().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n):
for j in range(1, k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i]... | 16 | 16 | 407 | 407 | # dpB - Frog 2
# 貰うDP
def main():
n, k = tuple(map(int, input().rstrip().split()))
A = tuple(map(int, input().rstrip().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
for j in range(1, k + 1):
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j] + abs(A[i... | # dpB - Frog 2
# 配るDP
def main():
n, k = tuple(map(int, input().rstrip().split()))
A = tuple(map(int, input().rstrip().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n):
for j in range(1, k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(A[i... | false | 0 | [
"-# 貰うDP",
"+# 配るDP",
"- for i in range(1, n):",
"+ for i in range(n):",
"- if i - j >= 0:",
"- dp[i] = min(dp[i], dp[i - j] + abs(A[i] - A[i - j]))",
"+ if i + j < n:",
"+ dp[i + j] = min(dp[i + j], dp[i] + abs(A[i] - A[i + j]))"
] | false | 0.090678 | 0.042676 | 2.124798 | [
"s402663298",
"s049243598"
] |
u864013199 | p02973 | python | s288368926 | s571581768 | 124 | 114 | 11,032 | 11,036 | Accepted | Accepted | 8.06 | #ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= -1
i = bisect(dp,a) #既存に-aを挿入した時のindex
if i < len(dp): #挿入位置が長さより小さい時(要はabsが一番小さ... |
import sys
input = sys.stdin.readline #文字列入力では注意!
def main():
#ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
... | 18 | 25 | 411 | 584 | # ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= -1
i = bisect(dp, a) # 既存に-aを挿入した時のindex
if i < len(dp): # 挿入位置が長さより小さい時(要はabsが一番小さくない時
... | import sys
input = sys.stdin.readline # 文字列入力では注意!
def main():
# ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= ... | false | 28 | [
"-# ttps://atcoder.jp/contests/abc134/submissions/6459172",
"-from bisect import bisect",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-A = [int(eval(input())) for _ in range(n)]",
"-dp = [1]",
"-for a in A:",
"- a *= -1",
"- i = bisect(dp, a) # 既存に-aを挿入した時のindex",
"- if i ... | false | 0.042975 | 0.066541 | 0.645844 | [
"s288368926",
"s571581768"
] |
u804800128 | p02580 | python | s073996489 | s199420601 | 1,073 | 987 | 84,096 | 83,424 | Accepted | Accepted | 8.01 | import queue
h,w,m = ( int(x) for x in input().split() )
h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
hi,wi = ( int(x)-1 for x in input().split() )
h_array[hi] += 1
w_array[wi] += 1
ps.add( (hi,wi) )
h_great = max(h_array)
w_great = max(w... | h,w,m = ( int(x) for x in input().split() )
h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
hi,wi = ( int(x)-1 for x in input().split() )
h_array[hi] += 1
w_array[wi] += 1
ps.add( (hi,wi) )
h_great = max(h_array)
w_great = max(w_array)
h_gre... | 38 | 32 | 845 | 701 | import queue
h, w, m = (int(x) for x in input().split())
h_array = [0 for i in range(h)]
w_array = [0 for i in range(w)]
ps = set()
for i in range(m):
hi, wi = (int(x) - 1 for x in input().split())
h_array[hi] += 1
w_array[wi] += 1
ps.add((hi, wi))
h_great = max(h_array)
w_great = max(w_array)
h_greats... | h, w, m = (int(x) for x in input().split())
h_array = [0 for i in range(h)]
w_array = [0 for i in range(w)]
ps = set()
for i in range(m):
hi, wi = (int(x) - 1 for x in input().split())
h_array[hi] += 1
w_array[wi] += 1
ps.add((hi, wi))
h_great = max(h_array)
w_great = max(w_array)
h_greats = list()
w_gr... | false | 15.789474 | [
"-import queue",
"-",
"-for i in range(h):",
"- if h_array[i] == h_great:",
"+for i, hi in enumerate(h_array):",
"+ if hi == h_great:",
"-for i in range(w):",
"- if w_array[i] == w_great:",
"+for i, wi in enumerate(w_array):",
"+ if wi == w_great:",
"-ans = h_great + w_great - 1",
... | false | 0.00779 | 0.038094 | 0.204504 | [
"s073996489",
"s199420601"
] |
u946517952 | p02678 | python | s022113450 | s035155787 | 686 | 632 | 34,920 | 34,908 | Accepted | Accepted | 7.87 | from collections import deque
n,m = list(map(int,input().split()))
rootlist = [[] for i in range(n)]
flag = [False for i in range(n)]
for i in range(m):
a,b= list(map(int,input().split()))
rootlist[a-1].append(b)
rootlist[b-1].append(a)
que = deque()
que.append(1)
while len(que) !=0:
now ... | from collections import deque
n,m = list(map(int,input().split()))
rootlist = [[] for i in range(n)]
flag = [False]*n
for i in range(m):
a,b= list(map(int,input().split()))
rootlist[a-1].append(b)
rootlist[b-1].append(a)
que = deque([1])
while que:
now = que.popleft()
for room in root... | 22 | 21 | 510 | 473 | from collections import deque
n, m = list(map(int, input().split()))
rootlist = [[] for i in range(n)]
flag = [False for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
rootlist[a - 1].append(b)
rootlist[b - 1].append(a)
que = deque()
que.append(1)
while len(que) != 0:
now = qu... | from collections import deque
n, m = list(map(int, input().split()))
rootlist = [[] for i in range(n)]
flag = [False] * n
for i in range(m):
a, b = list(map(int, input().split()))
rootlist[a - 1].append(b)
rootlist[b - 1].append(a)
que = deque([1])
while que:
now = que.popleft()
for room in rootlis... | false | 4.545455 | [
"-flag = [False for i in range(n)]",
"+flag = [False] * n",
"-que = deque()",
"-que.append(1)",
"-while len(que) != 0:",
"+que = deque([1])",
"+while que:"
] | false | 0.03812 | 0.110084 | 0.346283 | [
"s022113450",
"s035155787"
] |
u691896522 | p02990 | python | s898613880 | s540519888 | 338 | 37 | 12,740 | 9,272 | Accepted | Accepted | 89.05 | import numpy as np
import math
n , k = list(map(int, input().split()))
def combi(a,b):
return math.factorial(a) // (math.factorial(b) * math.factorial(a-b))
i = 2
mod = 10 ** 9 + 7
for i in range(1, k + 1):
if n - k + 1 >= i and k - 1 >= i - 1:
print((int(combi(n - k + 1,i) * combi(k - 1, i ... | n, k = list(map(int, input().split()))
mod = 10**9+7
def extgcd(a,b):
r = [1,0,a]
w = [0,1,b]
while w[2]!=1:
q = r[2]//w[2]
r2 = w
w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
r = r2
w = w2
#[x,y]
return [w[0],w[1]]
# aの逆元(mod m)を求める。(aとmは互いに素であるこ... | 13 | 31 | 360 | 803 | import numpy as np
import math
n, k = list(map(int, input().split()))
def combi(a, b):
return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
i = 2
mod = 10**9 + 7
for i in range(1, k + 1):
if n - k + 1 >= i and k - 1 >= i - 1:
print((int(combi(n - k + 1, i) * combi(k - 1, i - 1) %... | n, k = list(map(int, input().split()))
mod = 10**9 + 7
def extgcd(a, b):
r = [1, 0, a]
w = [0, 1, b]
while w[2] != 1:
q = r[2] // w[2]
r2 = w
w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
r = r2
w = w2
# [x,y]
return [w[0], w[1]]
# aの逆元(mod m)を求... | false | 58.064516 | [
"-import numpy as np",
"-import math",
"-",
"+mod = 10**9 + 7",
"-def combi(a, b):",
"- return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))",
"+def extgcd(a, b):",
"+ r = [1, 0, a]",
"+ w = [0, 1, b]",
"+ while w[2] != 1:",
"+ q = r[2] // w[2]",
"+ ... | false | 0.048491 | 0.041374 | 1.172014 | [
"s898613880",
"s540519888"
] |
u334712262 | p02960 | python | s931620116 | s570970587 | 1,128 | 681 | 65,512 | 64,728 | Accepted | Accepted | 39.63 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 107 | 109 | 2,176 | 2,174 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 1.834862 | [
"- M13 = Mod(13)",
"+ m = 1",
"- n = M13.mul(M13.pow(10, i), int(c))",
"+ n = (m * int(c)) % 13",
"- n = M13.mul(M13.pow(10, i), j)",
"+ n = (m * j) % 13",
"+ m *= 10",
"+ m %= 13"
] | false | 0.045118 | 0.044369 | 1.016867 | [
"s931620116",
"s570970587"
] |
u667084803 | p02768 | python | s311296595 | s934572765 | 197 | 114 | 39,280 | 3,684 | Accepted | Accepted | 42.13 | from functools import reduce
def comb(n, k, p):
a = reduce(lambda x,y: x*y%p, list(range(n,n-k,-1)))
b = reduce(lambda x,y: x*y%p, list(range(1,k+1)))
return (a*pow(b, p-2, p))%p
n, a, b = list(map(int, input().split()))
MOD = 10**9 + 7
print(((pow(2,n,MOD) - 1 - comb(n, a, MOD) - comb(n, ... | from functools import reduce
def perm(n, k, p):
ret = 1
for i in range(n, n-k, -1):
ret = (ret * i)%p
return ret
def comb(n, k, p):
"""power_funcを用いて(nCk) mod p を求める"""
a = perm(n, k, p)
b = perm(k, k, p)
return (a*pow(b, p-2, p))%p
n, a, b = list(map(int, input().split()))
MOD... | 11 | 20 | 314 | 397 | from functools import reduce
def comb(n, k, p):
a = reduce(lambda x, y: x * y % p, list(range(n, n - k, -1)))
b = reduce(lambda x, y: x * y % p, list(range(1, k + 1)))
return (a * pow(b, p - 2, p)) % p
n, a, b = list(map(int, input().split()))
MOD = 10**9 + 7
print(((pow(2, n, MOD) - 1 - comb(n, a, MOD)... | from functools import reduce
def perm(n, k, p):
ret = 1
for i in range(n, n - k, -1):
ret = (ret * i) % p
return ret
def comb(n, k, p):
"""power_funcを用いて(nCk) mod p を求める"""
a = perm(n, k, p)
b = perm(k, k, p)
return (a * pow(b, p - 2, p)) % p
n, a, b = list(map(int, input().spl... | false | 45 | [
"+def perm(n, k, p):",
"+ ret = 1",
"+ for i in range(n, n - k, -1):",
"+ ret = (ret * i) % p",
"+ return ret",
"+",
"+",
"- a = reduce(lambda x, y: x * y % p, list(range(n, n - k, -1)))",
"- b = reduce(lambda x, y: x * y % p, list(range(1, k + 1)))",
"+ \"\"\"power_funcを用... | false | 0.315515 | 0.290553 | 1.085911 | [
"s311296595",
"s934572765"
] |
u297574184 | p03298 | python | s422524914 | s474380887 | 2,816 | 1,063 | 150,096 | 111,924 | Accepted | Accepted | 62.25 | from itertools import product, compress
N = int(eval(input()))
Ss = eval(input())
Fss = [list(compress(Ss[:N], sels))[::-1] for sels in product([0, 1], repeat=N)]
ans = 0
for iFs in range(2 ** N):
Fs = Fss[iFs]
Gs = Fss[2 ** N - 1 - iFs]
lenF = len(Fs)
lenG = N - lenF
dp = [1] + [0... | from itertools import product, compress
from collections import Counter
N = int(eval(input()))
Ss = eval(input())
S1s = Ss[:N]
ptn1s = [''.join(compress(S1s, sels)) for sels in product(list(range(2)), repeat=N)]
cnt1 = Counter([(red, blue) for red, blue in zip(ptn1s, reversed(ptn1s))])
S2s = Ss[N:][::-1]
... | 28 | 18 | 671 | 543 | from itertools import product, compress
N = int(eval(input()))
Ss = eval(input())
Fss = [list(compress(Ss[:N], sels))[::-1] for sels in product([0, 1], repeat=N)]
ans = 0
for iFs in range(2**N):
Fs = Fss[iFs]
Gs = Fss[2**N - 1 - iFs]
lenF = len(Fs)
lenG = N - lenF
dp = [1] + [0] * lenF
for i, s... | from itertools import product, compress
from collections import Counter
N = int(eval(input()))
Ss = eval(input())
S1s = Ss[:N]
ptn1s = ["".join(compress(S1s, sels)) for sels in product(list(range(2)), repeat=N)]
cnt1 = Counter([(red, blue) for red, blue in zip(ptn1s, reversed(ptn1s))])
S2s = Ss[N:][::-1]
ptn2s = ["".j... | false | 35.714286 | [
"+from collections import Counter",
"-Fss = [list(compress(Ss[:N], sels))[::-1] for sels in product([0, 1], repeat=N)]",
"+S1s = Ss[:N]",
"+ptn1s = [\"\".join(compress(S1s, sels)) for sels in product(list(range(2)), repeat=N)]",
"+cnt1 = Counter([(red, blue) for red, blue in zip(ptn1s, reversed(ptn1s))])",
... | false | 0.03654 | 0.094181 | 0.387977 | [
"s422524914",
"s474380887"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.