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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u136843617 | p03371 | python | s877709182 | s759106855 | 118 | 89 | 3,060 | 3,060 | Accepted | Accepted | 24.58 | A, B, C, X, Y = list(map(int, input().split()))
if A + B < 2 * C:
print((A * X + B * Y))
else: # ABピザを二枚ずつ増やしていく。最大は2(max(x,y))
ans = float('inf')
for i in range(0, max(X, Y) * 2 + 1, 2):
ans = min(ans, max(A * (X - i // 2), 0) + max(B * (Y - i // 2), 0) + C * i)
print(ans)
| def solve():
A,B,C,X,Y = list(map(int, input().split()))
ans = X*A + Y*B
for i in range(max(X,Y)+1):
aandb = A * max(0, X-i) + B * max(0, Y-i)
ab = 2*C*i
ans = min(ans, aandb + ab)
print(ans)
if __name__ == '__main__':
solve() | 9 | 11 | 301 | 275 | A, B, C, X, Y = list(map(int, input().split()))
if A + B < 2 * C:
print((A * X + B * Y))
else: # ABピザを二枚ずつ増やしていく。最大は2(max(x,y))
ans = float("inf")
for i in range(0, max(X, Y) * 2 + 1, 2):
ans = min(ans, max(A * (X - i // 2), 0) + max(B * (Y - i // 2), 0) + C * i)
print(ans)
| def solve():
A, B, C, X, Y = list(map(int, input().split()))
ans = X * A + Y * B
for i in range(max(X, Y) + 1):
aandb = A * max(0, X - i) + B * max(0, Y - i)
ab = 2 * C * i
ans = min(ans, aandb + ab)
print(ans)
if __name__ == "__main__":
solve()
| false | 18.181818 | [
"-A, B, C, X, Y = list(map(int, input().split()))",
"-if A + B < 2 * C:",
"- print((A * X + B * Y))",
"-else: # ABピザを二枚ずつ増やしていく。最大は2(max(x,y))",
"- ans = float(\"inf\")",
"- for i in range(0, max(X, Y) * 2 + 1, 2):",
"- ans = min(ans, max(A * (X - i // 2), 0) + max(B * (Y - i // 2), 0) ... | false | 0.06167 | 0.159998 | 0.38544 | [
"s877709182",
"s759106855"
] |
u628279257 | p02389 | python | s558448313 | s865616867 | 30 | 20 | 7,628 | 7,648 | Accepted | Accepted | 33.33 | s=input().split()
a=int(s[0])
b=int(s[1])
x=a*b
y=2*(a+b)
print((x,y)) | a,b=input().split()
a=int(a)
b=int(b)
print((a*b,2*a+2*b)) | 6 | 4 | 73 | 59 | s = input().split()
a = int(s[0])
b = int(s[1])
x = a * b
y = 2 * (a + b)
print((x, y))
| a, b = input().split()
a = int(a)
b = int(b)
print((a * b, 2 * a + 2 * b))
| false | 33.333333 | [
"-s = input().split()",
"-a = int(s[0])",
"-b = int(s[1])",
"-x = a * b",
"-y = 2 * (a + b)",
"-print((x, y))",
"+a, b = input().split()",
"+a = int(a)",
"+b = int(b)",
"+print((a * b, 2 * a + 2 * b))"
] | false | 0.042336 | 0.04105 | 1.031329 | [
"s558448313",
"s865616867"
] |
u954858867 | p02416 | python | s372662892 | s314344223 | 20 | 10 | 6,612 | 6,356 | Accepted | Accepted | 50 | xin = []
while True:
x = int(input())
if x == 0:
break
xin += [x]
for i in xin:
print(sum(map(int , list(str(i))))) | xin = []
while True:
x = input()
if x == '0':
break
xin += [x]
for i in xin:
print(sum(map(int , list(i)))) | 8 | 8 | 149 | 141 | xin = []
while True:
x = int(input())
if x == 0:
break
xin += [x]
for i in xin:
print(sum(map(int, list(str(i)))))
| xin = []
while True:
x = input()
if x == "0":
break
xin += [x]
for i in xin:
print(sum(map(int, list(i))))
| false | 0 | [
"- x = int(input())",
"- if x == 0:",
"+ x = input()",
"+ if x == \"0\":",
"- print(sum(map(int, list(str(i)))))",
"+ print(sum(map(int, list(i))))"
] | false | 0.035754 | 0.03315 | 1.078566 | [
"s372662892",
"s314344223"
] |
u164727245 | p02598 | python | s465192432 | s806564489 | 1,987 | 686 | 33,640 | 33,528 | Accepted | Accepted | 65.48 | # coding: utf-8
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = tuple(map(int, args[1].split()))
l, r = 1, max(A)
while 0.1 < r-l:
m = (l+r)/2
cnt = 0
for a in A:
cnt += -int(-a//m)-1
if k < cnt:
l = m
... | # coding: utf-8
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = tuple(map(int, args[1].split()))
l, r = 0, max(A)
while l+1 < r:
m = (l+r)//2
cnt = 0
for a in A:
cnt += -(-a//m)-1
if k < cnt:
l = m
... | 23 | 23 | 457 | 443 | # coding: utf-8
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = tuple(map(int, args[1].split()))
l, r = 1, max(A)
while 0.1 < r - l:
m = (l + r) / 2
cnt = 0
for a in A:
cnt += -int(-a // m) - 1
if k < cnt:
l = m
els... | # coding: utf-8
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = tuple(map(int, args[1].split()))
l, r = 0, max(A)
while l + 1 < r:
m = (l + r) // 2
cnt = 0
for a in A:
cnt += -(-a // m) - 1
if k < cnt:
l = m
else:
... | false | 0 | [
"- l, r = 1, max(A)",
"- while 0.1 < r - l:",
"- m = (l + r) / 2",
"+ l, r = 0, max(A)",
"+ while l + 1 < r:",
"+ m = (l + r) // 2",
"- cnt += -int(-a // m) - 1",
"+ cnt += -(-a // m) - 1",
"- return str(-int(-l // 1))",
"+ return str(r)"
] | false | 0.04252 | 0.04088 | 1.040128 | [
"s465192432",
"s806564489"
] |
u554781254 | p02714 | python | s609037341 | s165762647 | 1,791 | 1,344 | 91,724 | 9,552 | Accepted | Accepted | 24.96 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
from numba import njit
INF = float('inf')
NIL = - 1
N = int(eval(input()))
S = input().rstrip()
r_count = S.count('R')
g_count = S... | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
N = int(eval(input()))
S = input().rstrip()
r_count = S.count('R')
g_count = S.count('G')
b_count = S... | 31 | 40 | 619 | 821 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
from numba import njit
INF = float("inf")
NIL = -1
N = int(eval(input()))
S = input().rstrip()
r_count = S.count("R")
g_count = S.count("G")
b_count... | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
INF = float("inf")
NIL = -1
N = int(eval(input()))
S = input().rstrip()
r_count = S.count("R")
g_count = S.count("G")
b_count = S.count("B")
# ret =... | false | 22.5 | [
"-from numba import njit",
"+# ret = 0",
"+# for i in range(N):",
"+# for d in range(N):",
"+# j = i + d",
"+# k = j + d",
"+# if k >= N:",
"+# break",
"+# if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:",
"+# ret += 1",
"- for d ... | false | 0.042337 | 0.040805 | 1.037552 | [
"s609037341",
"s165762647"
] |
u704158845 | p03160 | python | s874849365 | s169579266 | 231 | 134 | 52,856 | 13,924 | Accepted | Accepted | 41.99 | n = int(eval(input()))
h = list(map(int,input().split()))
inf = 10000
dp = []
for i in range(100000):
dp.append(inf)
dp[0] = 0
for i in range(1,n):
if i>1:
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
else:
dp[i] = dp[i-1] + abs(h[i]-h[i-1])
print((dp[n-1]))
... | N = int(eval(input()))
h = list(map(int,input().split()))
dp = [100010]*N
dp[0] = 0
for i in range(1,N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[N-1])) | 14 | 7 | 314 | 186 | n = int(eval(input()))
h = list(map(int, input().split()))
inf = 10000
dp = []
for i in range(100000):
dp.append(inf)
dp[0] = 0
for i in range(1, n):
if i > 1:
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
else:
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
print... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [100010] * N
dp[0] = 0
for i in range(1, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| false | 50 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-inf = 10000",
"-dp = []",
"-for i in range(100000):",
"- dp.append(inf)",
"+dp = [100010] * N",
"-for i in range(1, n):",
"- if i > 1:",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))",
"- ... | false | 0.050029 | 0.037761 | 1.324885 | [
"s874849365",
"s169579266"
] |
u189487046 | p02813 | python | s153690507 | s711286925 | 44 | 39 | 10,868 | 10,868 | Accepted | Accepted | 11.36 | import itertools
n = int(eval(input()))
P = input().split()
numbers = list(itertools.permutations(P))
P = ''.join(P)
Q = eval(input())
Q = Q.replace(' ', '')
numbers_str = []
for num in numbers:
numbers_str.append(''.join(num))
numbers_str.sort()
print((abs(numbers_str.index(P)-numbers_str.index(Q)))... | import itertools
n = int(eval(input()))
P = input().split()
Q = input().split()
p = ''.join(P)
q = ''.join(Q)
P.sort()
numbers = list(itertools.permutations(P))
numbers_str = []
for num in numbers:
numbers_str.append(''.join(num))
print((abs(numbers_str.index(p)-numbers_str.index(q))))
| 14 | 15 | 308 | 300 | import itertools
n = int(eval(input()))
P = input().split()
numbers = list(itertools.permutations(P))
P = "".join(P)
Q = eval(input())
Q = Q.replace(" ", "")
numbers_str = []
for num in numbers:
numbers_str.append("".join(num))
numbers_str.sort()
print((abs(numbers_str.index(P) - numbers_str.index(Q))))
| import itertools
n = int(eval(input()))
P = input().split()
Q = input().split()
p = "".join(P)
q = "".join(Q)
P.sort()
numbers = list(itertools.permutations(P))
numbers_str = []
for num in numbers:
numbers_str.append("".join(num))
print((abs(numbers_str.index(p) - numbers_str.index(q))))
| false | 6.666667 | [
"+Q = input().split()",
"+p = \"\".join(P)",
"+q = \"\".join(Q)",
"+P.sort()",
"-P = \"\".join(P)",
"-Q = eval(input())",
"-Q = Q.replace(\" \", \"\")",
"-numbers_str.sort()",
"-print((abs(numbers_str.index(P) - numbers_str.index(Q))))",
"+print((abs(numbers_str.index(p) - numbers_str.index(q))))"... | false | 0.035458 | 0.038741 | 0.915252 | [
"s153690507",
"s711286925"
] |
u677121387 | p02684 | python | s545483311 | s022991292 | 210 | 151 | 32,200 | 32,324 | Accepted | Accepted | 28.1 | n,k = list(map(int,input().split()))
a = [int(i)-1 for i in input().split()]
loc = 0
lst = [False]*n
lst[0] = True
while True:
if lst[a[loc]]:
x = a[loc]
break
loc = a[loc]
lst[loc] = True
cnt = 0
loc = 0
if x != 0:
while True:
loc = a[loc]
cnt += 1
... | n,k = list(map(int,input().split()))
a = [int(i)-1 for i in input().split()]
seen = []
cnt = [-1]*n
now = 0
while cnt[now] == -1:
cnt[now] = len(seen)
seen.append(now)
now = a[now]
loop = len(seen)-cnt[now]
toloop = cnt[now]
if k <= toloop:
ans = seen[k] + 1
else:
k = (k-toloop)%loop
... | 36 | 17 | 617 | 354 | n, k = list(map(int, input().split()))
a = [int(i) - 1 for i in input().split()]
loc = 0
lst = [False] * n
lst[0] = True
while True:
if lst[a[loc]]:
x = a[loc]
break
loc = a[loc]
lst[loc] = True
cnt = 0
loc = 0
if x != 0:
while True:
loc = a[loc]
cnt += 1
if loc =... | n, k = list(map(int, input().split()))
a = [int(i) - 1 for i in input().split()]
seen = []
cnt = [-1] * n
now = 0
while cnt[now] == -1:
cnt[now] = len(seen)
seen.append(now)
now = a[now]
loop = len(seen) - cnt[now]
toloop = cnt[now]
if k <= toloop:
ans = seen[k] + 1
else:
k = (k - toloop) % loop
... | false | 52.777778 | [
"-loc = 0",
"-lst = [False] * n",
"-lst[0] = True",
"-while True:",
"- if lst[a[loc]]:",
"- x = a[loc]",
"- break",
"- loc = a[loc]",
"- lst[loc] = True",
"-cnt = 0",
"-loc = 0",
"-if x != 0:",
"- while True:",
"- loc = a[loc]",
"- cnt += 1",
"- ... | false | 0.135837 | 0.037754 | 3.597987 | [
"s545483311",
"s022991292"
] |
u564589929 | p02953 | python | s594739324 | s712570903 | 67 | 52 | 14,780 | 14,836 | Accepted | Accepted | 22.39 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | 44 | 31 | 843 | 651 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | false | 29.545455 | [
"-from collections import deque",
"-",
"-",
"- d = deque([])",
"+ pre = -999",
"- for i in range(0, n):",
"- hi = H[i]",
"- if i == 0:",
"- d.append(hi - 1)",
"- continue",
"- hp = d.popleft()",
"- if hp < hi:",
"- d.appen... | false | 0.091391 | 0.039676 | 2.30344 | [
"s594739324",
"s712570903"
] |
u270144704 | p02819 | python | s460473626 | s951764891 | 166 | 81 | 38,512 | 72,396 | Accepted | Accepted | 51.2 | def prime(a):
for i in range(2,a):
if a % i == 0:
return False
return True
x = int(eval(input()))
while prime(x) == False:
x += 1
print(x) | x = int(eval(input()))
n = 2*10**5
table = [2] * (n+1)
table[1] = 1
for i in range(2, n//2+1):
for j in range(2*i, n+1, i):
table[j] += 1
for i in range(x, n+1):
if table[i] == 2:
print(i)
exit()
| 10 | 13 | 174 | 221 | def prime(a):
for i in range(2, a):
if a % i == 0:
return False
return True
x = int(eval(input()))
while prime(x) == False:
x += 1
print(x)
| x = int(eval(input()))
n = 2 * 10**5
table = [2] * (n + 1)
table[1] = 1
for i in range(2, n // 2 + 1):
for j in range(2 * i, n + 1, i):
table[j] += 1
for i in range(x, n + 1):
if table[i] == 2:
print(i)
exit()
| false | 23.076923 | [
"-def prime(a):",
"- for i in range(2, a):",
"- if a % i == 0:",
"- return False",
"- return True",
"-",
"-",
"-while prime(x) == False:",
"- x += 1",
"-print(x)",
"+n = 2 * 10**5",
"+table = [2] * (n + 1)",
"+table[1] = 1",
"+for i in range(2, n // 2 + 1):",
"... | false | 0.050882 | 0.791554 | 0.064281 | [
"s460473626",
"s951764891"
] |
u626467464 | p03610 | python | s947130933 | s410447659 | 76 | 17 | 4,596 | 3,188 | Accepted | Accepted | 77.63 | line = input()
count = len(line)
if count % 2 == 0:
for i in range(0 ,count - 1 ,2):
print(line[i],end ="")
else:
for i in range(0 ,count ,2):
print(line[i],end ="")
| line = eval(input())
answer = line[::2]
print(answer) | 8 | 3 | 184 | 49 | line = input()
count = len(line)
if count % 2 == 0:
for i in range(0, count - 1, 2):
print(line[i], end="")
else:
for i in range(0, count, 2):
print(line[i], end="")
| line = eval(input())
answer = line[::2]
print(answer)
| false | 62.5 | [
"-line = input()",
"-count = len(line)",
"-if count % 2 == 0:",
"- for i in range(0, count - 1, 2):",
"- print(line[i], end=\"\")",
"-else:",
"- for i in range(0, count, 2):",
"- print(line[i], end=\"\")",
"+line = eval(input())",
"+answer = line[::2]",
"+print(answer)"
] | false | 0.046987 | 0.045661 | 1.029029 | [
"s947130933",
"s410447659"
] |
u150984829 | p02264 | python | s937018896 | s874655431 | 290 | 260 | 16,296 | 18,120 | Accepted | Accepted | 10.34 | import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
f=lambda x,y:(x,int(y))
d=deque(f(*e.split())for e in s[1:])
t=0
while d:
k,v=d.popleft()
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;print((k,t))
| import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
d=deque(list(e.split())for e in s[1:])
t=0
while d:
k,v=d.popleft();v=int(v)
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;print((k,t))
| 11 | 10 | 245 | 231 | import sys
from collections import deque
s = sys.stdin.readlines()
q = int(s[0].split()[1])
f = lambda x, y: (x, int(y))
d = deque(f(*e.split()) for e in s[1:])
t = 0
while d:
k, v = d.popleft()
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
print((k, t))
| import sys
from collections import deque
s = sys.stdin.readlines()
q = int(s[0].split()[1])
d = deque(list(e.split()) for e in s[1:])
t = 0
while d:
k, v = d.popleft()
v = int(v)
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
print((k, t))
| false | 9.090909 | [
"-f = lambda x, y: (x, int(y))",
"-d = deque(f(*e.split()) for e in s[1:])",
"+d = deque(list(e.split()) for e in s[1:])",
"+ v = int(v)"
] | false | 0.134761 | 0.084153 | 1.60138 | [
"s937018896",
"s874655431"
] |
u729133443 | p02892 | python | s762730085 | s933525557 | 401 | 191 | 64,320 | 15,512 | Accepted | Accepted | 52.37 | from subprocess import*
call(('python3','-c',"""
from numpy import*
from scipy.sparse import*
_,*s=open(0)
s=array([list(map(int,t[:-1]))for t in s])
g=csr_matrix(s)
m=csgraph.floyd_warshall(g)
d=m.max()
i=m[0]%2<1
j=i^True
print(all(s[i][:,i]==0)*all(s[j][:,j]==0)*int(d+1)or-1)
""")) | from numpy import*
from scipy.sparse import*
_,*s=open(0)
s=array([list(map(int,t[:-1]))for t in s])
g=csr_matrix(s)
m=csgraph.floyd_warshall(g)
i=m[0]%2<1
j=i^True
print((all(s[i][:,i]==0)*all(s[j][:,j]==0)*int(m.max()+1)or-1)) | 13 | 9 | 297 | 234 | from subprocess import *
call(
(
"python3",
"-c",
"""
from numpy import*
from scipy.sparse import*
_,*s=open(0)
s=array([list(map(int,t[:-1]))for t in s])
g=csr_matrix(s)
m=csgraph.floyd_warshall(g)
d=m.max()
i=m[0]%2<1
j=i^True
print(all(s[i][:,i]==0)*all(s[j][:,j]==0)*int(d+1)or-1)
""",
... | from numpy import *
from scipy.sparse import *
_, *s = open(0)
s = array([list(map(int, t[:-1])) for t in s])
g = csr_matrix(s)
m = csgraph.floyd_warshall(g)
i = m[0] % 2 < 1
j = i ^ True
print((all(s[i][:, i] == 0) * all(s[j][:, j] == 0) * int(m.max() + 1) or -1))
| false | 30.769231 | [
"-from subprocess import *",
"+from numpy import *",
"+from scipy.sparse import *",
"-call(",
"- (",
"- \"python3\",",
"- \"-c\",",
"- \"\"\"",
"-from numpy import*",
"-from scipy.sparse import*",
"-_,*s=open(0)",
"-s=array([list(map(int,t[:-1]))for t in s])",
"-g=csr... | false | 0.413903 | 0.643902 | 0.642804 | [
"s762730085",
"s933525557"
] |
u968166680 | p02839 | python | s921164572 | s660941091 | 1,797 | 1,509 | 545,984 | 546,308 | Accepted | Accepted | 16.03 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, rea... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, rea... | 43 | 44 | 1,090 | 1,064 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split()... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split()... | false | 2.272727 | [
"+ s = dp[i + 1][j + 1]",
"- dp[i + 1][j + 1].add(k + b)",
"- dp[i + 1][j + 1].add(abs(k - b))",
"+ s.add(k + b)",
"+ s.add(abs(k - b))",
"- dp[i + 1][j + 1].add(k + b)",
"- dp[i + 1][j + 1].add(abs(k - ... | false | 0.043222 | 0.044271 | 0.976315 | [
"s921164572",
"s660941091"
] |
u935184340 | p02257 | python | s539881392 | s167235684 | 80 | 70 | 7,780 | 7,688 | Accepted | Accepted | 12.5 | def composite(d,n,s):
for a in (2,3,5,7):
p = False
if pow(a,d,n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n-1:
p = True
break
if not p:
return True
return False
def is_prime(n):
... | def composite(d,n,s):
for a in (2,3,5,7):
p = False
if pow(a,d,n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n-1:
p = True
break
if not p:
return True
return False
def is_prime(n):... | 32 | 31 | 689 | 663 | def composite(d, n, s):
for a in (2, 3, 5, 7):
p = False
if pow(a, d, n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n - 1:
p = True
break
if not p:
return True
return False
def is_prime(n):
... | def composite(d, n, s):
for a in (2, 3, 5, 7):
p = False
if pow(a, d, n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n - 1:
p = True
break
if not p:
return True
return False
def is_prime(n):
... | false | 3.125 | [
"- if n not in r:",
"- r.append(n)",
"+ r.append(n)"
] | false | 0.04361 | 0.047973 | 0.909055 | [
"s539881392",
"s167235684"
] |
u041075929 | p03274 | python | s599647986 | s517049692 | 98 | 88 | 14,568 | 14,384 | Accepted | Accepted | 10.2 | import sys, os, bisect
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
n , k = f()
a = f()
ans = int(1e10)
for i in range(n):
if i+k-1<n:
cur_ans = 0
if a[i]* a[i+k-1]>=0:
... | import sys, os, bisect
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
n , k = f()
a = f()
ans = int(1e10)
for i in range(n):
if i+k-1<n:
ans = min(ans, abs(a[i]) + abs(a[i] - a[i+k-1]), abs(a... | 23 | 18 | 544 | 382 | import sys, os, bisect
f = lambda: list(map(int, input().split()))
if "local" in os.environ:
sys.stdin = open("./input.txt", "r")
def solve():
n, k = f()
a = f()
ans = int(1e10)
for i in range(n):
if i + k - 1 < n:
cur_ans = 0
if a[i] * a[i + k - 1] >= 0:
... | import sys, os, bisect
f = lambda: list(map(int, input().split()))
if "local" in os.environ:
sys.stdin = open("./input.txt", "r")
def solve():
n, k = f()
a = f()
ans = int(1e10)
for i in range(n):
if i + k - 1 < n:
ans = min(
ans,
abs(a[i]) + ab... | false | 21.73913 | [
"- cur_ans = 0",
"- if a[i] * a[i + k - 1] >= 0:",
"- cur_ans = max(abs(a[i + k - 1]), abs(a[i]))",
"- else:",
"- cur_ans = min(",
"- 2 * abs(a[i]) + abs(a[i + k - 1]), abs(a[i]) + 2 * abs(a[i + k - 1])",
"- ... | false | 0.045474 | 0.044194 | 1.028959 | [
"s599647986",
"s517049692"
] |
u671060652 | p02759 | python | s623588034 | s145771494 | 297 | 181 | 64,108 | 38,384 | Accepted | Accepted | 39.06 | import itertools
import math
import fractions
import functools
n = int(eval(input()))
if n % 2 == 1:
print((n//2+1))
else: print((n//2)) | n = int(eval(input()))
print(((n+1)//2)) | 8 | 2 | 137 | 33 | import itertools
import math
import fractions
import functools
n = int(eval(input()))
if n % 2 == 1:
print((n // 2 + 1))
else:
print((n // 2))
| n = int(eval(input()))
print(((n + 1) // 2))
| false | 75 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-",
"-if n % 2 == 1:",
"- print((n // 2 + 1))",
"-else:",
"- print((n // 2))",
"+print(((n + 1) // 2))"
] | false | 0.047679 | 0.048313 | 0.986885 | [
"s623588034",
"s145771494"
] |
u981931040 | p03290 | python | s761084632 | s504756863 | 144 | 45 | 3,064 | 3,316 | Accepted | Accepted | 68.75 | D , G = list(map(int,input().split()))
questions = []
for i in range(D):
p , c = list(map(int,input().split()))
questions.append([p,c])
ans = float("inf")
for bit in range(2 ** D):
tmp_ans = 0
tmp_sum = 0
for j in range(D):
if bit >> j & 1:
tmp_sum += questions[j][0]... | D , G = list(map(int,input().split()))
bonus = []
question_cnt = []
for i in range(D):
p , c = list(map(int,input().split()))
question_cnt.append(p)
bonus.append(c)
ans = float('inf')
for bit in range(2 ** D):
sum_val = 0
tmp_ans = 0
Flag = False
for j in range(D):
if bi... | 29 | 30 | 855 | 871 | D, G = list(map(int, input().split()))
questions = []
for i in range(D):
p, c = list(map(int, input().split()))
questions.append([p, c])
ans = float("inf")
for bit in range(2**D):
tmp_ans = 0
tmp_sum = 0
for j in range(D):
if bit >> j & 1:
tmp_sum += questions[j][0] * 100 * (j + ... | D, G = list(map(int, input().split()))
bonus = []
question_cnt = []
for i in range(D):
p, c = list(map(int, input().split()))
question_cnt.append(p)
bonus.append(c)
ans = float("inf")
for bit in range(2**D):
sum_val = 0
tmp_ans = 0
Flag = False
for j in range(D):
if bit >> j & 1:
... | false | 3.333333 | [
"-questions = []",
"+bonus = []",
"+question_cnt = []",
"- questions.append([p, c])",
"+ question_cnt.append(p)",
"+ bonus.append(c)",
"+ sum_val = 0",
"- tmp_sum = 0",
"+ Flag = False",
"- tmp_sum += questions[j][0] * 100 * (j + 1) + questions[j][1]",
"- ... | false | 0.034159 | 0.036152 | 0.944849 | [
"s761084632",
"s504756863"
] |
u499381410 | p02733 | python | s991634323 | s846971997 | 829 | 428 | 46,936 | 45,404 | Accepted | Accepted | 48.37 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_r... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_r... | 78 | 63 | 2,209 | 1,805 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_right
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_right
fro... | false | 19.230769 | [
"-s = []",
"-for _ in range(h):",
"- s += [[int(i) for i in list(S())]]",
"+s = SRL(h)",
"-for j in range(2 ** (h - 1)):",
"- L = []",
"- last = 0",
"- for m in range(h - 1):",
"- if j >> m & 1:",
"- L += [(last, m + 1)]",
"- last = m + 1",
"- L += [... | false | 0.046124 | 0.226819 | 0.203351 | [
"s991634323",
"s846971997"
] |
u020373088 | p03495 | python | s093004658 | s328361685 | 218 | 142 | 42,932 | 32,440 | Accepted | Accepted | 34.86 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
key = []
value = []
for i, j in sorted(list(c.items()), key=lambda x: x[1]):
key.append(i)
value.append(j)
print((sum(value[:(len(key)-k)]))) | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
cnts = []
for i, j in list(c.items()):
cnts.append(j)
print((sum(sorted(cnts)[:-k]))) | 12 | 10 | 266 | 206 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
key = []
value = []
for i, j in sorted(list(c.items()), key=lambda x: x[1]):
key.append(i)
value.append(j)
print((sum(value[: (len(key) - k)])))
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
cnts = []
for i, j in list(c.items()):
cnts.append(j)
print((sum(sorted(cnts)[:-k])))
| false | 16.666667 | [
"-key = []",
"-value = []",
"-for i, j in sorted(list(c.items()), key=lambda x: x[1]):",
"- key.append(i)",
"- value.append(j)",
"-print((sum(value[: (len(key) - k)])))",
"+cnts = []",
"+for i, j in list(c.items()):",
"+ cnts.append(j)",
"+print((sum(sorted(cnts)[:-k])))"
] | false | 0.043501 | 0.045294 | 0.960424 | [
"s093004658",
"s328361685"
] |
u644907318 | p03487 | python | s699345486 | s066497323 | 130 | 86 | 14,692 | 85,432 | Accepted | Accepted | 33.85 | N = int(eval(input()))
A = list(map(int,input().split()))
A = sorted(A)
cnt = 0
cur = 0
for i in range(1,N):
if A[i]!=A[i-1]:
a = A[i-1]
if i-cur>=a:
cnt += i-cur-a
else:
cnt += i-cur
cur = i
a = A[-1]
if N-cur>=a:
cnt += N-cur-a
else:
... | N = int(eval(input()))
A = list(map(int,input().split()))
C = {}
cnt = 0
for i in range(N):
a = A[i]
if a>N:
cnt += 1
else:
if a not in C:
C[a]=0
C[a] += 1
for a in C:
if a>C[a]:
cnt += C[a]
elif a<C[a]:
cnt += C[a]-a
print(cnt) | 19 | 18 | 339 | 311 | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
cnt = 0
cur = 0
for i in range(1, N):
if A[i] != A[i - 1]:
a = A[i - 1]
if i - cur >= a:
cnt += i - cur - a
else:
cnt += i - cur
cur = i
a = A[-1]
if N - cur >= a:
cnt += N - cur - a
... | N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
cnt = 0
for i in range(N):
a = A[i]
if a > N:
cnt += 1
else:
if a not in C:
C[a] = 0
C[a] += 1
for a in C:
if a > C[a]:
cnt += C[a]
elif a < C[a]:
cnt += C[a] - a
print(cnt)
| false | 5.263158 | [
"-A = sorted(A)",
"+C = {}",
"-cur = 0",
"-for i in range(1, N):",
"- if A[i] != A[i - 1]:",
"- a = A[i - 1]",
"- if i - cur >= a:",
"- cnt += i - cur - a",
"- else:",
"- cnt += i - cur",
"- cur = i",
"-a = A[-1]",
"-if N - cur >= a:",
"... | false | 0.039268 | 0.039089 | 1.004587 | [
"s699345486",
"s066497323"
] |
u392029857 | p03044 | python | s712192784 | s475339280 | 1,119 | 806 | 109,840 | 113,444 | Accepted | Accepted | 27.97 | import sys
sys.setrecursionlimit(4100000)
def Dfs(G, v, cur=0):
color[v] = cur % 2
for next_v in G[v]:
if color[next_v[0]] != -1:
continue
Dfs(G, next_v[0], cur+next_v[1])
n = int(eval(input()))
e = [[0, 0, 0]] + [list(map(int, input().split())) for i in range(n-1)]
g... | import sys
sys.setrecursionlimit(4100000)
input = sys.stdin.readline
def main():
def Dfs(G, v, cur=0):
color[v] = cur % 2
for next_v in G[v]:
if color[next_v[0]] != -1:
continue
Dfs(G, next_v[0], cur+next_v[1])
n = int(eval(input()))
e =... | 27 | 31 | 619 | 775 | import sys
sys.setrecursionlimit(4100000)
def Dfs(G, v, cur=0):
color[v] = cur % 2
for next_v in G[v]:
if color[next_v[0]] != -1:
continue
Dfs(G, next_v[0], cur + next_v[1])
n = int(eval(input()))
e = [[0, 0, 0]] + [list(map(int, input().split())) for i in range(n - 1)]
g = [[] ... | import sys
sys.setrecursionlimit(4100000)
input = sys.stdin.readline
def main():
def Dfs(G, v, cur=0):
color[v] = cur % 2
for next_v in G[v]:
if color[next_v[0]] != -1:
continue
Dfs(G, next_v[0], cur + next_v[1])
n = int(eval(input()))
e = [[0, 0, ... | false | 12.903226 | [
"+input = sys.stdin.readline",
"-def Dfs(G, v, cur=0):",
"- color[v] = cur % 2",
"- for next_v in G[v]:",
"- if color[next_v[0]] != -1:",
"+def main():",
"+ def Dfs(G, v, cur=0):",
"+ color[v] = cur % 2",
"+ for next_v in G[v]:",
"+ if color[next_v[0]] != -... | false | 0.039088 | 0.036929 | 1.058464 | [
"s712192784",
"s475339280"
] |
u994521204 | p02765 | python | s850067506 | s849450036 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | n,r=list(map(int,input().split()))
if n>=10:
print(r)
else:
ans=r+100*(10-n)
print(ans) | n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
print((r + 100 * (10 - n)))
| 6 | 6 | 98 | 100 | n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
ans = r + 100 * (10 - n)
print(ans)
| n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
print((r + 100 * (10 - n)))
| false | 0 | [
"- ans = r + 100 * (10 - n)",
"- print(ans)",
"+ print((r + 100 * (10 - n)))"
] | false | 0.043971 | 0.048635 | 0.904099 | [
"s850067506",
"s849450036"
] |
u543954314 | p03579 | python | s210139736 | s788841592 | 514 | 259 | 22,064 | 22,368 | Accepted | Accepted | 49.61 | n,m = list(map(int,input().split()))
g = [list() for _ in range(n+1)]
for _ in range(m):
a,b = list(map(int,input().split()))
g[a].append(b)
g[b].append(a)
bw = [-1]*(n+1)
bw[1] = 0
q = [1]
f = 0
while q:
v = q.pop()
for x in g[v]:
if bw[x] >= 0:
if bw[x] == bw[v]:
f = 1
... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
ni = lambda: int(readline().rstrip())
nm = lambda: list(map(int, readline().split()))
nl = lambda: list(map(int, readline().split()))
def solve():
mod = 10**9 + 7
n, m = nm()
G = [list() for _ in range(n)]
for ... | 27 | 40 | 471 | 870 | n, m = list(map(int, input().split()))
g = [list() for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, input().split()))
g[a].append(b)
g[b].append(a)
bw = [-1] * (n + 1)
bw[1] = 0
q = [1]
f = 0
while q:
v = q.pop()
for x in g[v]:
if bw[x] >= 0:
if bw[x] == bw[v]:
... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
ni = lambda: int(readline().rstrip())
nm = lambda: list(map(int, readline().split()))
nl = lambda: list(map(int, readline().split()))
def solve():
mod = 10**9 + 7
n, m = nm()
G = [list() for _ in range(n)]
for _ in range(m)... | false | 32.5 | [
"-n, m = list(map(int, input().split()))",
"-g = [list() for _ in range(n + 1)]",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- g[a].append(b)",
"- g[b].append(a)",
"-bw = [-1] * (n + 1)",
"-bw[1] = 0",
"-q = [1]",
"-f = 0",
"-while q:",
"- v = q.pop()",
"... | false | 0.035981 | 0.034609 | 1.039641 | [
"s210139736",
"s788841592"
] |
u131984977 | p02389 | python | s468497206 | s870553092 | 40 | 30 | 6,724 | 6,724 | Accepted | Accepted | 25 | x = input().split(' ')
a = int(x[0])
b = int(x[1])
print(((a * b), ((a + b) * 2 ))) | nums = input().split()
a = int(nums[0])
b = int(nums[1])
print((a * b, (a + b) * 2)) | 5 | 4 | 86 | 85 | x = input().split(" ")
a = int(x[0])
b = int(x[1])
print(((a * b), ((a + b) * 2)))
| nums = input().split()
a = int(nums[0])
b = int(nums[1])
print((a * b, (a + b) * 2))
| false | 20 | [
"-x = input().split(\" \")",
"-a = int(x[0])",
"-b = int(x[1])",
"-print(((a * b), ((a + b) * 2)))",
"+nums = input().split()",
"+a = int(nums[0])",
"+b = int(nums[1])",
"+print((a * b, (a + b) * 2))"
] | false | 0.087515 | 0.039855 | 2.195859 | [
"s468497206",
"s870553092"
] |
u131984977 | p02409 | python | s681096392 | s595198019 | 40 | 20 | 6,728 | 7,656 | Accepted | Accepted | 50 | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for _ in range(n):
(b, f, r, v) = [int(i) for i in input().split()]
data[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print('', data[b][f][r], end='')
... | data = [
[[0 for r in range(10)] for f in range(3)] for b in range(4)
]
# ??\??????????????????????????§????????????????????????????????????
count = int(input())
for c in range(count):
b, f, r, v = [int(i) for i in input().split()]
data[b-1][f-1][r-1] += v
for bi, b in enumerate(data):
for ... | 13 | 19 | 376 | 455 | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for _ in range(n):
(b, f, r, v) = [int(i) for i in input().split()]
data[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print("", data[b][f][r], end="")
pri... | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
# ??\??????????????????????????§????????????????????????????????????
count = int(input())
for c in range(count):
b, f, r, v = [int(i) for i in input().split()]
data[b - 1][f - 1][r - 1] += v
for bi, b in enumerate(data):
for f in b:
... | false | 31.578947 | [
"-n = int(input())",
"-for _ in range(n):",
"- (b, f, r, v) = [int(i) for i in input().split()]",
"+# ??\\??????????????????????????§????????????????????????????????????",
"+count = int(input())",
"+for c in range(count):",
"+ b, f, r, v = [int(i) for i in input().split()]",
"-for b in range(4):... | false | 0.070767 | 0.036509 | 1.938331 | [
"s681096392",
"s595198019"
] |
u653837719 | p02574 | python | s045643076 | s792849070 | 812 | 669 | 213,096 | 234,836 | Accepted | Accepted | 17.61 | from sys import exit
def eratosthenes(n):
'''
n以下の整数の素数判定/列挙 (n > 1)
O(NloglogN)
'''
for i in range(2, int(n**0.5) + 1):
if is_prime[i]:
for j in range(i*2, n+1, i):
is_prime[j] = False
return [i for i in range(n+1) if is_prime[i]]
def facto... | from sys import exit
from math import gcd
def eratosthenes(n):
'''
n以下の整数の素数判定/列挙 (n > 1)
O(NloglogN)
'''
is_prime = [True] * (n+1)
is_prime[0] = False
is_prime[1] = False
judge = [i for i in range(n+1)]
for i in range(2, int(n**0.5) + 1):
if is_prime[i]:
... | 84 | 50 | 1,621 | 934 | from sys import exit
def eratosthenes(n):
"""
n以下の整数の素数判定/列挙 (n > 1)
O(NloglogN)
"""
for i in range(2, int(n**0.5) + 1):
if is_prime[i]:
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in range(n + 1) if is_prime[i]]
def factorization(... | from sys import exit
from math import gcd
def eratosthenes(n):
"""
n以下の整数の素数判定/列挙 (n > 1)
O(NloglogN)
"""
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
judge = [i for i in range(n + 1)]
for i in range(2, int(n**0.5) + 1):
if is_prime[i]:
fo... | false | 40.47619 | [
"+from math import gcd",
"+ is_prime = [True] * (n + 1)",
"+ is_prime[0] = False",
"+ is_prime[1] = False",
"+ judge = [i for i in range(n + 1)]",
"- return [i for i in range(n + 1) if is_prime[i]]",
"-",
"-",
"-def factorization(n):",
"- \"\"\"",
"- 素因数分解",
"- O(√N)",
... | false | 0.469727 | 0.856463 | 0.54845 | [
"s045643076",
"s792849070"
] |
u644907318 | p02802 | python | s276076266 | s897096560 | 343 | 305 | 147,248 | 132,164 | Accepted | Accepted | 11.08 | N,M = list(map(int,input().split()))
A = [list(input().split()) for _ in range(M)]
C = {str(i):0 for i in range(1,N+1)}
D = {str(i):0 for i in range(1,N+1)}
for j in range(M):
p,s = A[j]
if s=="AC" and C[p]==0:
C[p] += 1
wa = 0
for j in range(M):
p,s = A[j]
if s=="WA":
if C[p... | N,M = list(map(int,input().split()))
A = [list(input().split()) for _ in range(M)]
C = {str(i):0 for i in range(1,N+1)}
for i in range(M):
p,s = A[i]
if s=="AC":
C[p] = 1
D = {str(i):0 for i in range(1,N+1)}
cnt = 0
for i in range(M):
p,s = A[i]
if s=="WA":
if C[p]==1 and D[p... | 21 | 21 | 474 | 456 | N, M = list(map(int, input().split()))
A = [list(input().split()) for _ in range(M)]
C = {str(i): 0 for i in range(1, N + 1)}
D = {str(i): 0 for i in range(1, N + 1)}
for j in range(M):
p, s = A[j]
if s == "AC" and C[p] == 0:
C[p] += 1
wa = 0
for j in range(M):
p, s = A[j]
if s == "WA":
... | N, M = list(map(int, input().split()))
A = [list(input().split()) for _ in range(M)]
C = {str(i): 0 for i in range(1, N + 1)}
for i in range(M):
p, s = A[i]
if s == "AC":
C[p] = 1
D = {str(i): 0 for i in range(1, N + 1)}
cnt = 0
for i in range(M):
p, s = A[i]
if s == "WA":
if C[p] == 1 a... | false | 0 | [
"+for i in range(M):",
"+ p, s = A[i]",
"+ if s == \"AC\":",
"+ C[p] = 1",
"-for j in range(M):",
"- p, s = A[j]",
"- if s == \"AC\" and C[p] == 0:",
"- C[p] += 1",
"-wa = 0",
"-for j in range(M):",
"- p, s = A[j]",
"+cnt = 0",
"+for i in range(M):",
"+ p, s... | false | 0.084803 | 0.083494 | 1.015675 | [
"s276076266",
"s897096560"
] |
u100813820 | p02402 | python | s259370443 | s620506081 | 80 | 70 | 8,420 | 8,348 | Accepted | Accepted | 12.5 | # 09-Computation-Min_Max_and_Sum.py
# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????
# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai... | # 09-Computation-Min_Max_and_Sum.py
# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????
# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai... | 41 | 39 | 954 | 930 | # 09-Computation-Min_Max_and_Sum.py
# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????
# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai ???????... | # 09-Computation-Min_Max_and_Sum.py
# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????
# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai ???????... | false | 4.878049 | [
"-for i in range(num):"
] | false | 0.046954 | 0.037739 | 1.244164 | [
"s259370443",
"s620506081"
] |
u316341119 | p02995 | python | s280184124 | s230413328 | 174 | 35 | 38,384 | 5,052 | Accepted | Accepted | 79.89 | A, B, C, D = list(map(int, input().split()))
# b = qa + r
b = C
a = D
r = C%D
while r != 0:
b = a
a = r
r = b%a
gcd = a
CDlcm = C*D//gcd
total = B-(A-1)
Cmuls = B//C - (A-1)//C
Dmuls = B//D - (A-1)//D
CDmuls = B//CDlcm - (A-1)//CDlcm
ans = total - Cmuls - Dmuls + CDmuls
print(ans)
| import fractions
A, B, C, D = list(map(int, input().split()))
## b = qa + r
#b = C
#a = D
#r = C%D
#while r != 0:
# b = a
# a = r
# r = b%a
#gcd = a
gcd = fractions.gcd(C, D)
CDlcm = C*D//gcd
total = B-(A-1)
Cmuls = B//C - (A-1)//C
Dmuls = B//D - (A-1)//D
CDmuls = B//CDlcm - (A-1)//CDlcm
a... | 19 | 21 | 308 | 362 | A, B, C, D = list(map(int, input().split()))
# b = qa + r
b = C
a = D
r = C % D
while r != 0:
b = a
a = r
r = b % a
gcd = a
CDlcm = C * D // gcd
total = B - (A - 1)
Cmuls = B // C - (A - 1) // C
Dmuls = B // D - (A - 1) // D
CDmuls = B // CDlcm - (A - 1) // CDlcm
ans = total - Cmuls - Dmuls + CDmuls
print(a... | import fractions
A, B, C, D = list(map(int, input().split()))
## b = qa + r
# b = C
# a = D
# r = C%D
# while r != 0:
# b = a
# a = r
# r = b%a
# gcd = a
gcd = fractions.gcd(C, D)
CDlcm = C * D // gcd
total = B - (A - 1)
Cmuls = B // C - (A - 1) // C
Dmuls = B // D - (A - 1) // D
CDmuls = B // CDlcm - (A - 1)... | false | 9.52381 | [
"+import fractions",
"+",
"-# b = qa + r",
"-b = C",
"-a = D",
"-r = C % D",
"-while r != 0:",
"- b = a",
"- a = r",
"- r = b % a",
"-gcd = a",
"+## b = qa + r",
"+# b = C",
"+# a = D",
"+# r = C%D",
"+# while r != 0:",
"+# b = a",
"+# a = r",
"+# r = b%a",
"+... | false | 0.041305 | 0.077705 | 0.531555 | [
"s280184124",
"s230413328"
] |
u347640436 | p03038 | python | s175259121 | s396479989 | 712 | 480 | 30,664 | 34,888 | Accepted | Accepted | 32.58 | from functools import cmp_to_key
n, m = list(map(int, input().split()))
a = [int(e) for e in input().split()]
bc = [[int(e) for e in input().split()] for _ in range(m)]
bc.sort(key = cmp_to_key(lambda x, y: y[1] - x[1]))
t = 0
for b, c in bc:
a.extend([c] * b)
t += b
if t > n:
break
a.sort(reverse ... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key = lambda x: x[1], reverse = True)
t = 0
for b, c in bc:
a.extend([c] * b)
t += b
if t > n:
break
a.sort(reverse = True)
print((sum(a[:n]))) | 13 | 12 | 341 | 296 | from functools import cmp_to_key
n, m = list(map(int, input().split()))
a = [int(e) for e in input().split()]
bc = [[int(e) for e in input().split()] for _ in range(m)]
bc.sort(key=cmp_to_key(lambda x, y: y[1] - x[1]))
t = 0
for b, c in bc:
a.extend([c] * b)
t += b
if t > n:
break
a.sort(reverse=Tr... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)
t = 0
for b, c in bc:
a.extend([c] * b)
t += b
if t > n:
break
a.sort(reverse=True)
print((sum(a[:n])))
| false | 7.692308 | [
"-from functools import cmp_to_key",
"-",
"-a = [int(e) for e in input().split()]",
"-bc = [[int(e) for e in input().split()] for _ in range(m)]",
"-bc.sort(key=cmp_to_key(lambda x, y: y[1] - x[1]))",
"+a = list(map(int, input().split()))",
"+bc = [list(map(int, input().split())) for _ in range(m)]",
... | false | 0.044893 | 0.037821 | 1.186965 | [
"s175259121",
"s396479989"
] |
u047034794 | p04006 | python | s167143295 | s578359196 | 1,467 | 1,348 | 3,316 | 3,188 | Accepted | Accepted | 8.11 | def mygets():
return [int(v) for v in input().strip().split(' ')]
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
for i in range(1, n):
b2 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]
ans = min(ans, sum(b2) + i * x)
b1 = b2
print(ans) | def mygets():
return [int(v) for v in input().split(' ')]
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
xt = 0
for i in range(1, n):
xt += x
b1 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]
bsum = sum(b1) + xt
if bsum < ans:
ans = bsum
else:
... | 16 | 20 | 289 | 341 | def mygets():
return [int(v) for v in input().strip().split(" ")]
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
for i in range(1, n):
b2 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]
ans = min(ans, sum(b2) + i * x)
b1 = b2
print(ans)
| def mygets():
return [int(v) for v in input().split(" ")]
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
xt = 0
for i in range(1, n):
xt += x
b1 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]
bsum = sum(b1) + xt
if bsum < ans:
ans = bsum
else:
break
print(ans)... | false | 20 | [
"- return [int(v) for v in input().strip().split(\" \")]",
"+ return [int(v) for v in input().split(\" \")]",
"+xt = 0",
"- b2 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]",
"- ans = min(ans, sum(b2) + i * x)",
"- b1 = b2",
"+ xt += x",
"+ b1 = [u if u < b1[k - 1... | false | 0.044765 | 0.031461 | 1.422865 | [
"s167143295",
"s578359196"
] |
u864197622 | p03219 | python | s115959327 | s801564191 | 22 | 17 | 3,316 | 2,940 | Accepted | Accepted | 22.73 | a, b = list(map(int, input().split()))
print((a+b//2)) | print((eval(input().replace(" ","+")+"//2"))) | 2 | 1 | 47 | 43 | a, b = list(map(int, input().split()))
print((a + b // 2))
| print((eval(input().replace(" ", "+") + "//2")))
| false | 50 | [
"-a, b = list(map(int, input().split()))",
"-print((a + b // 2))",
"+print((eval(input().replace(\" \", \"+\") + \"//2\")))"
] | false | 0.068628 | 0.040811 | 1.681608 | [
"s115959327",
"s801564191"
] |
u562935282 | p02669 | python | s269077564 | s488651346 | 190 | 138 | 12,056 | 10,796 | Accepted | Accepted | 27.37 | # https://atcoder.jp/contests/agc044/submissions/13542551
def main():
from heapq import heappush, heappop
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
h = [(0, N)] # cost,value
checked = set()
ans = N * D + 1
... | # https://atcoder.jp/contests/agc044/submissions/13542551
def main():
from heapq import heappush, heappop
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
h = [(0, N)] # cost,value
checked = set()
ans = N * D + 1
... | 38 | 38 | 1,032 | 1,046 | # https://atcoder.jp/contests/agc044/submissions/13542551
def main():
from heapq import heappush, heappop
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
h = [(0, N)] # cost,value
checked = set()
ans = N * D + 1
while h:
... | # https://atcoder.jp/contests/agc044/submissions/13542551
def main():
from heapq import heappush, heappop
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
h = [(0, N)] # cost,value
checked = set()
ans = N * D + 1
while h:
... | false | 0 | [
"- if (nx + 1) not in checked:",
"+ if (r > 0) and ((nx + 1) not in checked):"
] | false | 0.263217 | 0.130608 | 2.015312 | [
"s269077564",
"s488651346"
] |
u747184036 | p03045 | python | s485943063 | s027455214 | 607 | 334 | 20,512 | 6,900 | Accepted | Accepted | 44.98 | import sys
sys.setrecursionlimit(10 ** 5)
class UniteFind:
def __init__(self, N):
self.par = [i for i in range(N)]
def root(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.root(self.par[x])
return self.par[x]
def u... | import sys
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ans = list(range(N))
def root(a):
if a==ans[a]:
return a
else:
ans[a] = root(ans[a])
return ans[a]
for _ in range(M):
x, y, _ = [int(a)-1 for a in input().... | 43 | 27 | 877 | 477 | import sys
sys.setrecursionlimit(10**5)
class UniteFind:
def __init__(self, N):
self.par = [i for i in range(N)]
def root(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.root(self.par[x])
return self.par[x]
def unite(self, x, ... | import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ans = list(range(N))
def root(a):
if a == ans[a]:
return a
else:
ans[a] = root(ans[a])
return ans[a]
for _ in range(M):
x, y, _ = [int(a) - 1 for a in input().split()]
r... | false | 37.209302 | [
"+input = sys.stdin.readline",
"+N, M = list(map(int, input().split()))",
"+ans = list(range(N))",
"-class UniteFind:",
"- def __init__(self, N):",
"- self.par = [i for i in range(N)]",
"-",
"- def root(self, x):",
"- if self.par[x] == x:",
"- return x",
"- ... | false | 0.046507 | 0.048452 | 0.959839 | [
"s485943063",
"s027455214"
] |
u347640436 | p03599 | python | s328048959 | s484486065 | 205 | 146 | 3,064 | 3,188 | Accepted | Accepted | 28.78 | A, B, C, D, E, F = list(map(int, input().split()))
w = set()
for i in range(F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = (A * i + B * j) * 100
if a < F:
w.add(a)
w.remove(0)
best_concentration = -1
best_a = -1
best_b = -1
for a in w:
t = min(F - a, E *... | A, B, C, D, E, F = list(map(int, input().split()))
w = set()
for i in range(F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = (A * i + B * j) * 100
if a < F:
w.add(a)
w.remove(0)
s = set()
t = E * F // 100
for i in range(t // C + 1):
for j in range(t // D + ... | 28 | 33 | 778 | 787 | A, B, C, D, E, F = list(map(int, input().split()))
w = set()
for i in range(F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = (A * i + B * j) * 100
if a < F:
w.add(a)
w.remove(0)
best_concentration = -1
best_a = -1
best_b = -1
for a in w:
t = min(F - a, E * a // 100)
f... | A, B, C, D, E, F = list(map(int, input().split()))
w = set()
for i in range(F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = (A * i + B * j) * 100
if a < F:
w.add(a)
w.remove(0)
s = set()
t = E * F // 100
for i in range(t // C + 1):
for j in range(t // D + 1):
b =... | false | 15.151515 | [
"+s = set()",
"+t = E * F // 100",
"+for i in range(t // C + 1):",
"+ for j in range(t // D + 1):",
"+ b = C * i + D * j",
"+ if b < t:",
"+ s.add(b)",
"- t = min(F - a, E * a // 100)",
"- for i in range(t // C + 1):",
"- for j in range(t // D + 1):",
"- ... | false | 0.089325 | 0.078828 | 1.133161 | [
"s328048959",
"s484486065"
] |
u529012223 | p03111 | python | s142676155 | s765089276 | 80 | 68 | 3,188 | 3,064 | Accepted | Accepted | 15 | N,A,B,C=list(map(int,input().split()))
l=[int(eval(input())) for i in range(N)]
inf=10**9
def magic(cur, a, b, c):
if cur == N:
if min(a, b, c) > 0:
return abs(a - A) + abs(b - B) + abs (c - C) - 30
else:
return inf
ret0 = magic(cur+1, a, b, c)
ret1 = ... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
... | 17 | 14 | 501 | 470 | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
inf = 10**9
def magic(cur, a, b, c):
if cur == N:
if min(a, b, c) > 0:
return abs(a - A) + abs(b - B) + abs(c - C) - 30
else:
return inf
ret0 = magic(cur + 1, a, b, c)
ret1 = mag... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10**9
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
ret2 = d... | false | 17.647059 | [
"-inf = 10**9",
"+INF = 10**9",
"-def magic(cur, a, b, c):",
"+def dfs(cur, a, b, c):",
"- if min(a, b, c) > 0:",
"- return abs(a - A) + abs(b - B) + abs(c - C) - 30",
"- else:",
"- return inf",
"- ret0 = magic(cur + 1, a, b, c)",
"- ret1 = magic(cur + 1, ... | false | 0.08999 | 0.084124 | 1.069728 | [
"s142676155",
"s765089276"
] |
u539367121 | p02641 | python | s493903637 | s325214875 | 31 | 25 | 9,168 | 9,168 | Accepted | Accepted | 19.35 | X, N = list(map(int, input().split()))
if N==0:
print(X)
exit(0)
p = [int(i) for i in input().split()]
for i in range(101):
for s in [-1,1]:
a = X + i*s
if a not in p:
print(a)
exit(0)
| X, N = list(map(int, input().split()))
if N==0:
print(X)
exit(0)
p = [int(i) for i in input().split()]
for i in range(X+1):
for s in [-1,1]:
a = X + i*s
if a not in p:
print(a)
exit(0)
| 15 | 15 | 226 | 226 | X, N = list(map(int, input().split()))
if N == 0:
print(X)
exit(0)
p = [int(i) for i in input().split()]
for i in range(101):
for s in [-1, 1]:
a = X + i * s
if a not in p:
print(a)
exit(0)
| X, N = list(map(int, input().split()))
if N == 0:
print(X)
exit(0)
p = [int(i) for i in input().split()]
for i in range(X + 1):
for s in [-1, 1]:
a = X + i * s
if a not in p:
print(a)
exit(0)
| false | 0 | [
"-for i in range(101):",
"+for i in range(X + 1):"
] | false | 0.034736 | 0.044256 | 0.784888 | [
"s493903637",
"s325214875"
] |
u077291787 | p03244 | python | s126612936 | s593640911 | 73 | 64 | 15,460 | 16,116 | Accepted | Accepted | 12.33 | # ABC111C - /\/\/\/
from collections import Counter
def main():
N, *V = list(map(int, open(0).read().split()))
even, odd = Counter(V[::2]).most_common(2), Counter(V[1::2]).most_common(2)
if even[0][0] != odd[0][0]: # replace except the modes of both parities
ans = N - even[0][1] - odd[0][... | # ABC111C - /\/\/\/
from collections import Counter
def main():
N, *V = open(0).read().split()
N = int(N)
even, odd = Counter(V[::2]).most_common(2), Counter(V[1::2]).most_common(2)
if even[0][0] != odd[0][0]: # replace except the modes of both parities
ans = N - even[0][1] - odd[0][... | 19 | 20 | 643 | 649 | # ABC111C - /\/\/\/
from collections import Counter
def main():
N, *V = list(map(int, open(0).read().split()))
even, odd = Counter(V[::2]).most_common(2), Counter(V[1::2]).most_common(2)
if even[0][0] != odd[0][0]: # replace except the modes of both parities
ans = N - even[0][1] - odd[0][1]
e... | # ABC111C - /\/\/\/
from collections import Counter
def main():
N, *V = open(0).read().split()
N = int(N)
even, odd = Counter(V[::2]).most_common(2), Counter(V[1::2]).most_common(2)
if even[0][0] != odd[0][0]: # replace except the modes of both parities
ans = N - even[0][1] - odd[0][1]
el... | false | 5 | [
"- N, *V = list(map(int, open(0).read().split()))",
"+ N, *V = open(0).read().split()",
"+ N = int(N)"
] | false | 0.085025 | 0.078345 | 1.085254 | [
"s126612936",
"s593640911"
] |
u816872429 | p02995 | python | s270393960 | s954484223 | 177 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.4 | a, b, c, d = list(map(int, input().split()))
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def count(x, y):
return x // y
cd = c * d // gcd(c, d)
print((b - a + 1 - count(b, c) + count(a - 1, c) - count(b, d) + count(a - 1, d) + count(b, cd) - count(a - 1, cd)))
| a, b, c, d = list(map(int, input().split()))
def gcd(a, b):
return b if a == 0 else gcd(b % a, a)
def lcm(a, b):
return a // gcd(a, b) * b
def count(x):
return x - (x // c) - (x // d) + (x // lcm(c, d))
print((count(b) - count(a - 1))) | 9 | 8 | 293 | 246 | a, b, c, d = list(map(int, input().split()))
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def count(x, y):
return x // y
cd = c * d // gcd(c, d)
print(
(
b
- a
+ 1
- count(b, c)
+ count(a - 1, c)
- count(b, d)
+ count(a - 1... | a, b, c, d = list(map(int, input().split()))
def gcd(a, b):
return b if a == 0 else gcd(b % a, a)
def lcm(a, b):
return a // gcd(a, b) * b
def count(x):
return x - (x // c) - (x // d) + (x // lcm(c, d))
print((count(b) - count(a - 1)))
| false | 11.111111 | [
"- if a == 0:",
"- return b",
"- return gcd(b % a, a)",
"+ return b if a == 0 else gcd(b % a, a)",
"-def count(x, y):",
"- return x // y",
"+def lcm(a, b):",
"+ return a // gcd(a, b) * b",
"-cd = c * d // gcd(c, d)",
"-print(",
"- (",
"- b",
"- - a",
... | false | 0.068412 | 0.035779 | 1.912075 | [
"s270393960",
"s954484223"
] |
u223646582 | p03112 | python | s052938516 | s077903402 | 1,587 | 931 | 108,504 | 16,144 | Accepted | Accepted | 41.34 | import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
R = []
for x in X:
SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
i = bisect.bisect_left(S, x)
if i != 0:
SL = x-S[i-1]
i... | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
for x in X:
SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
i = bisect.bisect_left(S, x)
if i != 0:
SL =... | 25 | 23 | 607 | 575 | import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
R = []
for x in X:
SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
i = bisect.bisect_left(S, x)
if i != 0:
SL = x - S[i - 1]
if i != A... | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
for x in X:
SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
i = bisect.bisect_left(S, x)
if i != 0:
SL = x - S[i -... | false | 8 | [
"-A, B, Q = map(int, input().split())",
"-S = [int(input()) for _ in range(A)]",
"-T = [int(input()) for _ in range(B)]",
"-X = [int(input()) for _ in range(Q)]",
"-R = []",
"+A, B, Q = list(map(int, input().split()))",
"+S = [int(eval(input())) for _ in range(A)]",
"+T = [int(eval(input())) for _ in ... | false | 0.043379 | 0.037968 | 1.142498 | [
"s052938516",
"s077903402"
] |
u679520304 | p02726 | python | s209001219 | s843665736 | 487 | 267 | 52,572 | 77,136 | Accepted | Accepted | 45.17 | N,X,Y = list(map(int,input().split()))
g = [[] for _ in range(N+1)]
for i in range(1,N):
g[i].append(i+1)
g[i+1].append(i)
g[X].append(Y)
g[Y].append(X)
from collections import deque
def bfs(u):
queue = deque([u])
d = [None]*(N+1)
d[u]=0
while queue:
v = queue.popleft()
... | N,X,Y = list(map(int,input().split()))
g = [[] for _ in range(N+1)]
for i in range(1,N+1):
if i != 1:
g[i].append(i-1)
if i != N:
g[i].append(i+1)
g[X].append(Y)
g[Y].append(X)
from collections import deque
answer = [0]*(N+1)
for i in range(1,N+1):
q = deque([i])
d = [None]*... | 30 | 25 | 612 | 572 | N, X, Y = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
for i in range(1, N):
g[i].append(i + 1)
g[i + 1].append(i)
g[X].append(Y)
g[Y].append(X)
from collections import deque
def bfs(u):
queue = deque([u])
d = [None] * (N + 1)
d[u] = 0
while queue:
v = queue.popleft()... | N, X, Y = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
for i in range(1, N + 1):
if i != 1:
g[i].append(i - 1)
if i != N:
g[i].append(i + 1)
g[X].append(Y)
g[Y].append(X)
from collections import deque
answer = [0] * (N + 1)
for i in range(1, N + 1):
q = deque([i])
d = ... | false | 16.666667 | [
"-for i in range(1, N):",
"- g[i].append(i + 1)",
"- g[i + 1].append(i)",
"+for i in range(1, N + 1):",
"+ if i != 1:",
"+ g[i].append(i - 1)",
"+ if i != N:",
"+ g[i].append(i + 1)",
"-",
"-def bfs(u):",
"- queue = deque([u])",
"+answer = [0] * (N + 1)",
"+for i... | false | 0.040204 | 0.076264 | 0.527161 | [
"s209001219",
"s843665736"
] |
u941753895 | p03448 | python | s774516862 | s172110746 | 60 | 52 | 8,276 | 3,060 | Accepted | Accepted | 13.33 | a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
x=int(eval(input()))
l=[]
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
l.append(500*i+100*j+50*k)
print((l.count(x))) | # 入力
A=int(eval(input()))
B=int(eval(input()))
C=int(eval(input()))
X=int(eval(input()))
cnt=0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i+100*j+50*k==X:
cnt+=1
# 出力
print(cnt) | 10 | 15 | 187 | 216 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
l = []
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
l.append(500 * i + 100 * j + 50 * k)
print((l.count(x)))
| # 入力
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500 * i + 100 * j + 50 * k == X:
cnt += 1
# 出力
print(cnt)
| false | 33.333333 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-c = int(eval(input()))",
"-x = int(eval(input()))",
"-l = []",
"-for i in range(a + 1):",
"- for j in range(b + 1):",
"- for k in range(c + 1):",
"- l.append(500 * i + 100 * j + 50 * k)",
"-print((l.count(x)))",
"+# 入力"... | false | 0.008326 | 0.062537 | 0.133134 | [
"s774516862",
"s172110746"
] |
u968166680 | p03752 | python | s554765315 | s414624052 | 177 | 23 | 39,792 | 3,064 | Accepted | Accepted | 87.01 | import sys
from itertools import combinations
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, K, *A = list(map(int, read().split()))
ans = INF
for comb in combinations(list(range(1, N)), K - 1):... | import sys
from itertools import combinations
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, K, *A = list(map(int, read().split()))
ans = INF
for comb in combinations(list(range(1, N)), K - 1):... | 39 | 35 | 818 | 758 | import sys
from itertools import combinations
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, K, *A = list(map(int, read().split()))
ans = INF
for comb in combinations(list(range(1, N)), K - 1):
included... | import sys
from itertools import combinations
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, K, *A = list(map(int, read().split()))
ans = INF
for comb in combinations(list(range(1, N)), K - 1):
included... | false | 10.25641 | [
"- included = [False] * N",
"- for i in comb:",
"- included[i] = True",
"+ included = set(comb)",
"- if included[i]:",
"+ if i in included:"
] | false | 0.043732 | 0.036737 | 1.190412 | [
"s554765315",
"s414624052"
] |
u279955105 | p02397 | python | s498745997 | s005352316 | 90 | 60 | 7,508 | 7,668 | Accepted | Accepted | 33.33 | while True:
x, y = list(map(int, input().split()))
if (x == 0 and y == 0) :
break
if (x < y) :
print((str(x) + " " + str(y)))
else :
print((str(y) + " " + str(x))) | while True:
t = input().split()
a = int(t[0])
b = int(t[1])
if (a == 0) and (b == 0):
break
if (a < b):
print((str(a) + " " + str(b)))
else:
print((str(b) + " " + str(a))) | 8 | 10 | 176 | 189 | while True:
x, y = list(map(int, input().split()))
if x == 0 and y == 0:
break
if x < y:
print((str(x) + " " + str(y)))
else:
print((str(y) + " " + str(x)))
| while True:
t = input().split()
a = int(t[0])
b = int(t[1])
if (a == 0) and (b == 0):
break
if a < b:
print((str(a) + " " + str(b)))
else:
print((str(b) + " " + str(a)))
| false | 20 | [
"- x, y = list(map(int, input().split()))",
"- if x == 0 and y == 0:",
"+ t = input().split()",
"+ a = int(t[0])",
"+ b = int(t[1])",
"+ if (a == 0) and (b == 0):",
"- if x < y:",
"- print((str(x) + \" \" + str(y)))",
"+ if a < b:",
"+ print((str(a) + \" \" + ... | false | 0.042244 | 0.041407 | 1.020214 | [
"s498745997",
"s005352316"
] |
u008229752 | p02861 | python | s290131050 | s555834419 | 216 | 192 | 3,064 | 3,064 | Accepted | Accepted | 11.11 | from itertools import permutations
from math import hypot
n = int(eval(input()))
cnt = 0
dis = 0
li = []
for i in range(n):
x,y = list(map(int,input().split()))
li.append([x, y])
ptn = list(range(n))
for a in permutations(ptn):
cnt += 1
for i, j in zip(a,a[1:]):
x1, y1 = li[... | from itertools import permutations
from math import hypot
n = int(eval(input()))
cnt = 0
dis = 0
li = []
for i in range(n):
x,y = list(map(int,input().split()))
li.append([x, y])
for a in permutations(li):
cnt += 1
for (x1,y1),(x2,y2) in zip(a,a[1:]):
dis += hypot(x1-x2, y1-y2)... | 22 | 18 | 388 | 326 | from itertools import permutations
from math import hypot
n = int(eval(input()))
cnt = 0
dis = 0
li = []
for i in range(n):
x, y = list(map(int, input().split()))
li.append([x, y])
ptn = list(range(n))
for a in permutations(ptn):
cnt += 1
for i, j in zip(a, a[1:]):
x1, y1 = li[i]
x2, y2... | from itertools import permutations
from math import hypot
n = int(eval(input()))
cnt = 0
dis = 0
li = []
for i in range(n):
x, y = list(map(int, input().split()))
li.append([x, y])
for a in permutations(li):
cnt += 1
for (x1, y1), (x2, y2) in zip(a, a[1:]):
dis += hypot(x1 - x2, y1 - y2)
print(... | false | 18.181818 | [
"-ptn = list(range(n))",
"-for a in permutations(ptn):",
"+for a in permutations(li):",
"- for i, j in zip(a, a[1:]):",
"- x1, y1 = li[i]",
"- x2, y2 = li[j]",
"+ for (x1, y1), (x2, y2) in zip(a, a[1:]):"
] | false | 0.05758 | 0.164096 | 0.350889 | [
"s290131050",
"s555834419"
] |
u557792847 | p02601 | python | s631296193 | s239526048 | 119 | 28 | 27,168 | 8,956 | Accepted | Accepted | 76.47 | import sys
import numpy as np
import math
import collections
import copy
from collections import deque
from functools import reduce
from itertools import product
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
for p in product((1, 2, 3), repeat=K):
R, G, BL = A, B, C
for pi in p:... | A, B, C = list(map(int, input().split()))
K = int(eval(input()))
r, g, b = A, B, C
cnt = 0
while(r >= g):
cnt += 1
g *= 2
while(g >= b):
cnt += 1
b *= 2
if cnt <= K:
print("Yes")
else:
print("No")
| 49 | 15 | 562 | 231 | import sys
import numpy as np
import math
import collections
import copy
from collections import deque
from functools import reduce
from itertools import product
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
for p in product((1, 2, 3), repeat=K):
R, G, BL = A, B, C
for pi in p:
if pi... | A, B, C = list(map(int, input().split()))
K = int(eval(input()))
r, g, b = A, B, C
cnt = 0
while r >= g:
cnt += 1
g *= 2
while g >= b:
cnt += 1
b *= 2
if cnt <= K:
print("Yes")
else:
print("No")
| false | 69.387755 | [
"-import sys",
"-import numpy as np",
"-import math",
"-import collections",
"-import copy",
"-from collections import deque",
"-from functools import reduce",
"-from itertools import product",
"-",
"-for p in product((1, 2, 3), repeat=K):",
"- R, G, BL = A, B, C",
"- for pi in p:",
"-... | false | 0.049721 | 0.03496 | 1.422239 | [
"s631296193",
"s239526048"
] |
u738898077 | p03546 | python | s530969892 | s169932104 | 33 | 30 | 3,444 | 3,444 | Accepted | Accepted | 9.09 | h,w = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(10)]
a = [list(map(int,input().split())) for i in range(h)]
ans = 0
for rep in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
if l[i][j] > l[i][k]+l[k][j]:
... | h,w = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(10)]
a = [list(map(int,input().split())) for i in range(h)]
ans = 0
for k in range(10):
for i in range(10):
for j in range(10):
if l[i][j] > l[i][k]+l[k][j]:
l[i][j] = l[i][k]+l[k][j]
... | 15 | 14 | 452 | 409 | h, w = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(h)]
ans = 0
for rep in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
if l[i][j] > l[i][k] + l[k][j]:
... | h, w = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(h)]
ans = 0
for k in range(10):
for i in range(10):
for j in range(10):
if l[i][j] > l[i][k] + l[k][j]:
l[i][j] = l[i][k] + l[k][j]
... | false | 6.666667 | [
"-for rep in range(10):",
"+for k in range(10):",
"- for k in range(10):",
"- if l[i][j] > l[i][k] + l[k][j]:",
"- l[i][j] = l[i][k] + l[k][j]",
"+ if l[i][j] > l[i][k] + l[k][j]:",
"+ l[i][j] = l[i][k] + l[k][j]"
] | false | 0.050678 | 0.08813 | 0.575035 | [
"s530969892",
"s169932104"
] |
u322185540 | p03610 | python | s988721684 | s899482462 | 28 | 17 | 3,188 | 3,188 | Accepted | Accepted | 39.29 | s = eval(input())
ans = ''
for i in range(0,len(s),2):
ans += s[i]
print(ans) | s = eval(input())
print((s[0:len(s):2])) | 5 | 2 | 79 | 33 | s = eval(input())
ans = ""
for i in range(0, len(s), 2):
ans += s[i]
print(ans)
| s = eval(input())
print((s[0 : len(s) : 2]))
| false | 60 | [
"-ans = \"\"",
"-for i in range(0, len(s), 2):",
"- ans += s[i]",
"-print(ans)",
"+print((s[0 : len(s) : 2]))"
] | false | 0.03992 | 0.038658 | 1.032645 | [
"s988721684",
"s899482462"
] |
u102461423 | p03807 | python | s421618592 | s602346969 | 51 | 47 | 11,172 | 12,512 | Accepted | Accepted | 7.84 | import sys
input = sys.stdin.readline
N = int(eval(input()))
od = sum(int(x)&1 for x in input().split())
ev = N - od
x = od // 2
od -= 2*x
ev += 2*x
ev = min(ev,1)
rest = od + ev
answer = 'YES' if rest == 1 else 'NO'
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・ev,ev -> ev or od,od -> ev
・奇数の個数 mod 2 が不変量
・1回以上操作をすると偶数が1つ以上残る
・N >= 2なので偶数が残る。よってodが奇数個ならむり
・奇数が偶数個なら、奇数を固めたあとつぶしていけばできる
"""
N,*A = list(map(int,read().split()))
od = sum(x&1 fo... | 15 | 18 | 241 | 374 | import sys
input = sys.stdin.readline
N = int(eval(input()))
od = sum(int(x) & 1 for x in input().split())
ev = N - od
x = od // 2
od -= 2 * x
ev += 2 * x
ev = min(ev, 1)
rest = od + ev
answer = "YES" if rest == 1 else "NO"
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・ev,ev -> ev or od,od -> ev
・奇数の個数 mod 2 が不変量
・1回以上操作をすると偶数が1つ以上残る
・N >= 2なので偶数が残る。よってodが奇数個ならむり
・奇数が偶数個なら、奇数を固めたあとつぶしていけばできる
"""
N, *A = list(map(int, read().split()))
od = sum(x & 1 for x in A)
ans... | false | 16.666667 | [
"-input = sys.stdin.readline",
"-N = int(eval(input()))",
"-od = sum(int(x) & 1 for x in input().split())",
"-ev = N - od",
"-x = od // 2",
"-od -= 2 * x",
"-ev += 2 * x",
"-ev = min(ev, 1)",
"-rest = od + ev",
"-answer = \"YES\" if rest == 1 else \"NO\"",
"+read = sys.stdin.buffer.read",
"+re... | false | 0.040199 | 0.043089 | 0.93293 | [
"s421618592",
"s602346969"
] |
u539517139 | p03087 | python | s458260058 | s760530264 | 1,183 | 868 | 7,768 | 7,768 | Accepted | Accepted | 26.63 | n,q=list(map(int,input().split()))
s=eval(input())
a=[0]
for i in range(1,len(s)):
a.append(a[i-1]+s[i-1:i+1].count('AC'))
for i in range(q):
l,r=list(map(int,input().split()))
print((a[r-1]-a[l-1])) | n,q=list(map(int,input().split()))
s=eval(input())
a=[0]
for i in range(1,len(s)):
a.append(a[i-1]+(s[i-1:i+1]=='AC'))
for i in range(q):
l,r=list(map(int,input().split()))
print((a[r-1]-a[l-1])) | 8 | 8 | 192 | 188 | n, q = list(map(int, input().split()))
s = eval(input())
a = [0]
for i in range(1, len(s)):
a.append(a[i - 1] + s[i - 1 : i + 1].count("AC"))
for i in range(q):
l, r = list(map(int, input().split()))
print((a[r - 1] - a[l - 1]))
| n, q = list(map(int, input().split()))
s = eval(input())
a = [0]
for i in range(1, len(s)):
a.append(a[i - 1] + (s[i - 1 : i + 1] == "AC"))
for i in range(q):
l, r = list(map(int, input().split()))
print((a[r - 1] - a[l - 1]))
| false | 0 | [
"- a.append(a[i - 1] + s[i - 1 : i + 1].count(\"AC\"))",
"+ a.append(a[i - 1] + (s[i - 1 : i + 1] == \"AC\"))"
] | false | 0.215761 | 0.084105 | 2.565386 | [
"s458260058",
"s760530264"
] |
u260216890 | p02756 | python | s685344375 | s277206760 | 621 | 440 | 8,548 | 8,676 | Accepted | Accepted | 29.15 | from collections import deque
s=deque(list(eval(input())))
q=int(eval(input()))
direction=0 #0:順 1:逆
for i in range(q):
query=list(input().split())
i=int(query[0])
if i==1:
direction=direction^1
elif i==2:
f,c=int(query[1]),query[2]
if f==1 and direction==0:
... | from collections import deque
s=deque(list(eval(input())))
q=int(eval(input()))
direction=0 #0:順 1:逆
for i in range(q):
query=eval(input())
if query[0]=='1':
direction=direction^1
elif query[0]=='2':
i,f,c=query.split()
if f=='1' and direction==0:
s.appendlef... | 27 | 27 | 616 | 602 | from collections import deque
s = deque(list(eval(input())))
q = int(eval(input()))
direction = 0 # 0:順 1:逆
for i in range(q):
query = list(input().split())
i = int(query[0])
if i == 1:
direction = direction ^ 1
elif i == 2:
f, c = int(query[1]), query[2]
if f == 1 and directio... | from collections import deque
s = deque(list(eval(input())))
q = int(eval(input()))
direction = 0 # 0:順 1:逆
for i in range(q):
query = eval(input())
if query[0] == "1":
direction = direction ^ 1
elif query[0] == "2":
i, f, c = query.split()
if f == "1" and direction == 0:
... | false | 0 | [
"- query = list(input().split())",
"- i = int(query[0])",
"- if i == 1:",
"+ query = eval(input())",
"+ if query[0] == \"1\":",
"- elif i == 2:",
"- f, c = int(query[1]), query[2]",
"- if f == 1 and direction == 0:",
"+ elif query[0] == \"2\":",
"+ i, f, c... | false | 0.034076 | 0.035718 | 0.954045 | [
"s685344375",
"s277206760"
] |
u581187895 | p02788 | python | s554925231 | s616166404 | 1,713 | 1,124 | 135,696 | 132,712 | Accepted | Accepted | 34.38 |
import operator
class SegmentTree:
def __init__(self, size, fn=operator.add, default=None, initial_values=None):
"""
:param int size:
:param callable fn: 区間に適用する関数。引数を 2 つ取る。min, max, operator.xor など
:param default:
:param list initial_values:
"""
d... |
class LasySegmentTree:
def __init__(self, size: int, segfunc, lazy_ide_ele=0):
self.lazy_ide_ele = lazy_ide_ele
self.segfunc = segfunc
self.N0 = 1 << (size - 1).bit_length()
self.lazy = [self.lazy_ide_ele] * (2 * self.N0)
def gindex(self, left, right):
L = le... | 113 | 79 | 2,993 | 2,170 | import operator
class SegmentTree:
def __init__(self, size, fn=operator.add, default=None, initial_values=None):
"""
:param int size:
:param callable fn: 区間に適用する関数。引数を 2 つ取る。min, max, operator.xor など
:param default:
:param list initial_values:
"""
default = ... | class LasySegmentTree:
def __init__(self, size: int, segfunc, lazy_ide_ele=0):
self.lazy_ide_ele = lazy_ide_ele
self.segfunc = segfunc
self.N0 = 1 << (size - 1).bit_length()
self.lazy = [self.lazy_ide_ele] * (2 * self.N0)
def gindex(self, left, right):
L = left + self.N0... | false | 30.088496 | [
"-import operator",
"+class LasySegmentTree:",
"+ def __init__(self, size: int, segfunc, lazy_ide_ele=0):",
"+ self.lazy_ide_ele = lazy_ide_ele",
"+ self.segfunc = segfunc",
"+ self.N0 = 1 << (size - 1).bit_length()",
"+ self.lazy = [self.lazy_ide_ele] * (2 * self.N0)",
... | false | 0.040516 | 0.04624 | 0.876217 | [
"s554925231",
"s616166404"
] |
u957167787 | p02918 | python | s403218612 | s123559571 | 84 | 42 | 4,092 | 3,316 | Accepted | Accepted | 50 | N, K = list(map(int, input().split()))
S = eval(input())
Llist = []
Rlist = []
now = S[0]
cnt = 0
for i in range(1, N+1):
if i < N and now == S[i]:
cnt += 1
else:
if now == 'L':
Llist.append(cnt)
else:
Rlist.append(cnt)
if i < N:
... | N, K = list(map(int, input().split()))
S = eval(input())
score = 0
for i in range(N-1):
if S[i] == S[i+1]:
score += 1
ans = min(score + 2*K, N-1)
print(ans) | 36 | 10 | 734 | 167 | N, K = list(map(int, input().split()))
S = eval(input())
Llist = []
Rlist = []
now = S[0]
cnt = 0
for i in range(1, N + 1):
if i < N and now == S[i]:
cnt += 1
else:
if now == "L":
Llist.append(cnt)
else:
Rlist.append(cnt)
if i < N:
now = S[i]
... | N, K = list(map(int, input().split()))
S = eval(input())
score = 0
for i in range(N - 1):
if S[i] == S[i + 1]:
score += 1
ans = min(score + 2 * K, N - 1)
print(ans)
| false | 72.222222 | [
"-Llist = []",
"-Rlist = []",
"-now = S[0]",
"-cnt = 0",
"-for i in range(1, N + 1):",
"- if i < N and now == S[i]:",
"- cnt += 1",
"- else:",
"- if now == \"L\":",
"- Llist.append(cnt)",
"- else:",
"- Rlist.append(cnt)",
"- if i < N:",... | false | 0.049232 | 0.048935 | 1.006082 | [
"s403218612",
"s123559571"
] |
u580697892 | p03240 | python | s935560265 | s745957142 | 936 | 653 | 3,956 | 3,064 | Accepted | Accepted | 30.24 | #coding: utf-8
N = int(eval(input()))
l = []
for i in range(N):
a = list(map(int, input().split()))
if a[2] > 0:
l.append(a)
if len(l) >= 2:
for i in range(len(l)-1):
ans = []
for cx in range(101):
for cy in range(101):
if l[i][2] + abs(l[i][0] -... | # coding: utf-8
N = int(eval(input()))
info = []
for i in range(N):
info.append(list(map(int, input().split())))
# s = False
info.sort(key=lambda x: x[2], reverse=True)
for cx in range(101):
for cy in range(101):
flag = True
s = False
for i in range(N):
x, y, h = ... | 24 | 30 | 807 | 808 | # coding: utf-8
N = int(eval(input()))
l = []
for i in range(N):
a = list(map(int, input().split()))
if a[2] > 0:
l.append(a)
if len(l) >= 2:
for i in range(len(l) - 1):
ans = []
for cx in range(101):
for cy in range(101):
if l[i][2] + abs(l[i][0] - cx) + ... | # coding: utf-8
N = int(eval(input()))
info = []
for i in range(N):
info.append(list(map(int, input().split())))
# s = False
info.sort(key=lambda x: x[2], reverse=True)
for cx in range(101):
for cy in range(101):
flag = True
s = False
for i in range(N):
x, y, h = info[i]
... | false | 20 | [
"-l = []",
"+info = []",
"- a = list(map(int, input().split()))",
"- if a[2] > 0:",
"- l.append(a)",
"-if len(l) >= 2:",
"- for i in range(len(l) - 1):",
"- ans = []",
"- for cx in range(101):",
"- for cy in range(101):",
"- if l[i][2] + ab... | false | 0.253302 | 0.042236 | 5.997249 | [
"s935560265",
"s745957142"
] |
u883048396 | p03244 | python | s179534649 | s649773371 | 87 | 79 | 20,700 | 15,588 | Accepted | Accepted | 9.2 | from collections import Counter
iN = int(eval(input()))
aV = [int(_) for _ in input().split()]
oV0 = Counter(aV[0::2]).most_common()
oV1 = Counter(aV[1::2]).most_common()
oV0 += [(0,0)]
oV1 += [(0,0)]
if oV0[0][0] != oV1[0][0] :
print((iN - oV0[0][1] - oV1[0][1]))
else:
print((iN - max(oV0[0][1]... | from collections import Counter
iN = int(eval(input()))
aV = [int(_) for _ in input().split()]
oV0 = Counter(aV[0::2]).most_common(2)
oV1 = Counter(aV[1::2]).most_common(2)
oV0 += [(0,0)]
oV1 += [(0,0)]
if oV0[0][0] != oV1[0][0] :
print((iN - oV0[0][1] - oV1[0][1]))
else:
print((iN - max(oV0[0][... | 14 | 14 | 351 | 353 | from collections import Counter
iN = int(eval(input()))
aV = [int(_) for _ in input().split()]
oV0 = Counter(aV[0::2]).most_common()
oV1 = Counter(aV[1::2]).most_common()
oV0 += [(0, 0)]
oV1 += [(0, 0)]
if oV0[0][0] != oV1[0][0]:
print((iN - oV0[0][1] - oV1[0][1]))
else:
print((iN - max(oV0[0][1], oV1[0][1]) -... | from collections import Counter
iN = int(eval(input()))
aV = [int(_) for _ in input().split()]
oV0 = Counter(aV[0::2]).most_common(2)
oV1 = Counter(aV[1::2]).most_common(2)
oV0 += [(0, 0)]
oV1 += [(0, 0)]
if oV0[0][0] != oV1[0][0]:
print((iN - oV0[0][1] - oV1[0][1]))
else:
print((iN - max(oV0[0][1], oV1[0][1])... | false | 0 | [
"-oV0 = Counter(aV[0::2]).most_common()",
"-oV1 = Counter(aV[1::2]).most_common()",
"+oV0 = Counter(aV[0::2]).most_common(2)",
"+oV1 = Counter(aV[1::2]).most_common(2)"
] | false | 0.007017 | 0.034278 | 0.204695 | [
"s179534649",
"s649773371"
] |
u389910364 | p03765 | python | s792256922 | s699604037 | 991 | 613 | 49,300 | 87,872 | Accepted | Accepted | 38.14 | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator imp... | import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
S = list(sys.stdin.readline().rstrip())
T = list(sys.stdin.readline().rstrip())
Q = int(sys.stdin.readline())
A, ... | 51 | 37 | 1,168 | 873 | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter... | import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
S = list(sys.stdin.readline().rstrip())
T = list(sys.stdin.readline().rstrip())
Q = int(sys.stdin.readline())
A, B, C, D = list(zip(*[ma... | false | 27.45098 | [
"-import bisect",
"-import heapq",
"-import itertools",
"-import math",
"-import operator",
"-import re",
"-import string",
"-from collections import Counter, deque, defaultdict",
"-from copy import deepcopy",
"-from decimal import Decimal",
"-from fractions import gcd",
"-from functools impor... | false | 0.21314 | 0.214903 | 0.991796 | [
"s792256922",
"s699604037"
] |
u994988729 | p03013 | python | s901834111 | s545333999 | 198 | 99 | 7,664 | 7,836 | Accepted | Accepted | 50 | n,m=list(map(int,input().split()))
mod=10**9+7
NG=[0]*(n+1)
dp=[0]*(n+1)
dp[0]=1
for _ in range(m):
a=int(eval(input()))
NG[a]=1
for i in range(n):
if i==0: #一段目
dp[i+1]=dp[i] if NG[i+1]==0 else 0
continue
if NG[i+1]==1:
dp[i+1]=0
else:
... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7
N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
a.append(-1)
a = a[::-1]
dp = [0] * (N + 10)
dp[0] = 1
# 配る
for i in range(N):
if i == a[-1]:
a.pop()
... | 23 | 27 | 370 | 455 | n, m = list(map(int, input().split()))
mod = 10**9 + 7
NG = [0] * (n + 1)
dp = [0] * (n + 1)
dp[0] = 1
for _ in range(m):
a = int(eval(input()))
NG[a] = 1
for i in range(n):
if i == 0: # 一段目
dp[i + 1] = dp[i] if NG[i + 1] == 0 else 0
continue
if NG[i + 1] == 1:
dp[i + 1] = 0
... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
mod = 10**9 + 7
N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
a.append(-1)
a = a[::-1]
dp = [0] * (N + 10)
dp[0] = 1
# 配る
for i in range(N):
if i == a[-1]:
a.pop()
dp[i] = 0
continu... | false | 14.814815 | [
"-n, m = list(map(int, input().split()))",
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**7)",
"-NG = [0] * (n + 1)",
"-dp = [0] * (n + 1)",
"+N, M = list(map(int, input().split()))",
"+a = [int(eval(input())) for _ in range(M)]",
"+a.append(-1)",
"+a = a[:... | false | 0.037882 | 0.037858 | 1.000641 | [
"s901834111",
"s545333999"
] |
u808427016 | p03244 | python | s662055856 | s076130703 | 101 | 90 | 23,760 | 20,700 | Accepted | Accepted | 10.89 | import collections
N = int(eval(input()))
V = [int(_) for _ in input().split()]
def calc(vs):
r = dict(collections.Counter(vs))
r[0] = 0
ri = list(r.items())
return sorted(ri, key=lambda x:-x[1])
ve = calc(V[::2])
vo = calc(V[1::2])
result = 0
if ve[0][0] != vo[0][0]:
result = ... | import collections
N = int(eval(input()))
V = [int(_) for _ in input().split()]
def calc(vs):
cs = collections.Counter(vs)
cs[0] = 0
return cs.most_common()
ve = calc(V[::2])
vo = calc(V[1::2])
result = 0
if ve[0][0] != vo[0][0]:
result = N - ve[0][1] - vo[0][1]
else:
result =... | 23 | 22 | 426 | 384 | import collections
N = int(eval(input()))
V = [int(_) for _ in input().split()]
def calc(vs):
r = dict(collections.Counter(vs))
r[0] = 0
ri = list(r.items())
return sorted(ri, key=lambda x: -x[1])
ve = calc(V[::2])
vo = calc(V[1::2])
result = 0
if ve[0][0] != vo[0][0]:
result = N - ve[0][1] - v... | import collections
N = int(eval(input()))
V = [int(_) for _ in input().split()]
def calc(vs):
cs = collections.Counter(vs)
cs[0] = 0
return cs.most_common()
ve = calc(V[::2])
vo = calc(V[1::2])
result = 0
if ve[0][0] != vo[0][0]:
result = N - ve[0][1] - vo[0][1]
else:
result = N - max(ve[0][1] ... | false | 4.347826 | [
"- r = dict(collections.Counter(vs))",
"- r[0] = 0",
"- ri = list(r.items())",
"- return sorted(ri, key=lambda x: -x[1])",
"+ cs = collections.Counter(vs)",
"+ cs[0] = 0",
"+ return cs.most_common()",
"- result = min(N - ve[0][1] - vo[1][1], N - ve[1][1] - vo[0][1])",
"+ r... | false | 0.062897 | 0.104514 | 0.601801 | [
"s662055856",
"s076130703"
] |
u423966555 | p02953 | python | s584546839 | s921659932 | 83 | 76 | 20,476 | 20,740 | Accepted | Accepted | 8.43 | N = int(eval(input()))
H = list(map(int, input().split()))
flg = False
for i in range(1,N+1):
if flg:
tmp = H[-i]-1
else:
tmp = H[-i]
flg = False
if not i==N:
if tmp < H[-i-1]:
if tmp == H[-i-1]-1:
flg = True
else:
... | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(1,N+1):
tmp = H[-i]
if not i==N:
if tmp < H[-i-1]:
if tmp == H[-i-1]-1:
H[-i-1] -= 1
else:
print('No')
exit()
print('Yes')
| 18 | 13 | 370 | 292 | N = int(eval(input()))
H = list(map(int, input().split()))
flg = False
for i in range(1, N + 1):
if flg:
tmp = H[-i] - 1
else:
tmp = H[-i]
flg = False
if not i == N:
if tmp < H[-i - 1]:
if tmp == H[-i - 1] - 1:
flg = True
else:
... | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(1, N + 1):
tmp = H[-i]
if not i == N:
if tmp < H[-i - 1]:
if tmp == H[-i - 1] - 1:
H[-i - 1] -= 1
else:
print("No")
exit()
print("Yes")
| false | 27.777778 | [
"-flg = False",
"- if flg:",
"- tmp = H[-i] - 1",
"- else:",
"- tmp = H[-i]",
"- flg = False",
"+ tmp = H[-i]",
"- flg = True",
"+ H[-i - 1] -= 1"
] | false | 0.066964 | 0.068174 | 0.982254 | [
"s584546839",
"s921659932"
] |
u973108807 | p02983 | python | s643461619 | s552701158 | 1,711 | 18 | 3,060 | 3,060 | Accepted | Accepted | 98.95 | L, R = list(map(int, input().split()))
R -= (L // 2019) * 2019
L %= 2019
while R-4038 > L:
R -= 2019
ans = float('inf')
for i in range(L, R):
for j in range(i+1, R+1):
ans = min(ans, i*j%2019)
print(ans) | def abc133_c():
L,R = list(map(int,input().split()))
if R - L > 673: return 0
ans = 2019
for i in range(L, R):
for j in range(i+1, R+1):
ans = min(ans, i*j%2019)
if ans == 1: return 1
return ans
print((abc133_c())) | 13 | 11 | 220 | 243 | L, R = list(map(int, input().split()))
R -= (L // 2019) * 2019
L %= 2019
while R - 4038 > L:
R -= 2019
ans = float("inf")
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
print(ans)
| def abc133_c():
L, R = list(map(int, input().split()))
if R - L > 673:
return 0
ans = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
if ans == 1:
return 1
return ans
print((abc133_c()))
| false | 15.384615 | [
"-L, R = list(map(int, input().split()))",
"-R -= (L // 2019) * 2019",
"-L %= 2019",
"-while R - 4038 > L:",
"- R -= 2019",
"-ans = float(\"inf\")",
"-for i in range(L, R):",
"- for j in range(i + 1, R + 1):",
"- ans = min(ans, i * j % 2019)",
"-print(ans)",
"+def abc133_c():",
"+... | false | 0.073683 | 0.074071 | 0.994767 | [
"s643461619",
"s552701158"
] |
u450983668 | p02657 | python | s722793867 | s130300860 | 24 | 20 | 9,072 | 9,024 | Accepted | Accepted | 16.67 | A, B = list(map(int, input().split()))
print((A * B)) | print((eval(input().replace(" ","*")))) | 2 | 1 | 46 | 37 | A, B = list(map(int, input().split()))
print((A * B))
| print((eval(input().replace(" ", "*"))))
| false | 50 | [
"-A, B = list(map(int, input().split()))",
"-print((A * B))",
"+print((eval(input().replace(\" \", \"*\"))))"
] | false | 0.04629 | 0.045238 | 1.023268 | [
"s722793867",
"s130300860"
] |
u936985471 | p03569 | python | s942263694 | s901482957 | 76 | 64 | 3,444 | 3,316 | Accepted | Accepted | 15.79 | S=eval(input())
import collections
counter=collections.Counter(S)
# 後ろと前からxを無視して比較していく
# 同じ文字なら続行、indexで出逢えばOK
ans=0
indf=0
indl=len(S)-1
while indf<indl:
if S[indf]==S[indl]:
indf+=1
indl-=1
continue
if S[indf]=="x":
indf+=1
ans+=1
elif S[indl]=="x":
indl-=1
ans+... | S=eval(input())
ans=0
indf=0
indl=len(S)-1
while indf<indl:
if S[indf]==S[indl]:
indf+=1
indl-=1
continue
if S[indf]=="x":
indf+=1
ans+=1
elif S[indl]=="x":
indl-=1
ans+=1
else:
print((-1))
break
else:
print(ans) | 26 | 20 | 372 | 269 | S = eval(input())
import collections
counter = collections.Counter(S)
# 後ろと前からxを無視して比較していく
# 同じ文字なら続行、indexで出逢えばOK
ans = 0
indf = 0
indl = len(S) - 1
while indf < indl:
if S[indf] == S[indl]:
indf += 1
indl -= 1
continue
if S[indf] == "x":
indf += 1
ans += 1
elif S[i... | S = eval(input())
ans = 0
indf = 0
indl = len(S) - 1
while indf < indl:
if S[indf] == S[indl]:
indf += 1
indl -= 1
continue
if S[indf] == "x":
indf += 1
ans += 1
elif S[indl] == "x":
indl -= 1
ans += 1
else:
print((-1))
break
else:
... | false | 23.076923 | [
"-import collections",
"-",
"-counter = collections.Counter(S)",
"-# 後ろと前からxを無視して比較していく",
"-# 同じ文字なら続行、indexで出逢えばOK"
] | false | 0.037802 | 0.037771 | 1.000831 | [
"s942263694",
"s901482957"
] |
u260980560 | p00179 | python | s444022052 | s823552471 | 2,330 | 2,020 | 6,752 | 6,744 | Accepted | Accepted | 13.3 | import queue
dic = {
'rg':'b', 'gr':'b',
'gb':'r', 'bg':'r',
'br':'g', 'rb':'g',
}
while True:
s = input()
if s=='0':
break
que = queue.PriorityQueue()
l = len(s)
cost = {}
cost[s] = 0
que.put((0, s))
ans = -1
while not que.empt... | import queue
dic = {
'rg':'bb', 'gr':'bb',
'gb':'rr', 'bg':'rr',
'br':'gg', 'rb':'gg',
}
while True:
s = input()
if s=='0':
break
que = queue.PriorityQueue()
l = len(s)
cost = {s: 0}
que.put((0, s))
aa = ['r'*l, 'g'*l, 'b'*l]
ans = -... | 32 | 31 | 824 | 799 | import queue
dic = {
"rg": "b",
"gr": "b",
"gb": "r",
"bg": "r",
"br": "g",
"rb": "g",
}
while True:
s = input()
if s == "0":
break
que = queue.PriorityQueue()
l = len(s)
cost = {}
cost[s] = 0
que.put((0, s))
ans = -1
while not que.empty():
nn... | import queue
dic = {
"rg": "bb",
"gr": "bb",
"gb": "rr",
"bg": "rr",
"br": "gg",
"rb": "gg",
}
while True:
s = input()
if s == "0":
break
que = queue.PriorityQueue()
l = len(s)
cost = {s: 0}
que.put((0, s))
aa = ["r" * l, "g" * l, "b" * l]
ans = -1
wh... | false | 3.125 | [
"- \"rg\": \"b\",",
"- \"gr\": \"b\",",
"- \"gb\": \"r\",",
"- \"bg\": \"r\",",
"- \"br\": \"g\",",
"- \"rb\": \"g\",",
"+ \"rg\": \"bb\",",
"+ \"gr\": \"bb\",",
"+ \"gb\": \"rr\",",
"+ \"bg\": \"rr\",",
"+ \"br\": \"gg\",",
"+ \"rb\": \"gg\",",
"- cost... | false | 0.2936 | 0.373135 | 0.786848 | [
"s444022052",
"s823552471"
] |
u407361913 | p03910 | python | s982466038 | s528671323 | 22 | 19 | 3,572 | 3,444 | Accepted | Accepted | 13.64 | import sys
input = sys.stdin.readline
n = int(eval(input()))
cnt = 0
ans = []
for i in range(1, n + 1):
cnt += i
ans.append(i)
if cnt >= n:
if cnt > n:
ans.remove(cnt - n)
for j in range(len(ans)):
print((ans[j]))
exit()
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
ans = []
cnt = 0
for i in range(1, n + 2):
cnt += i
ans.append(i)
if cnt > n:
ans.remove(cnt - n)
break
print... | 15 | 16 | 288 | 347 | import sys
input = sys.stdin.readline
n = int(eval(input()))
cnt = 0
ans = []
for i in range(1, n + 1):
cnt += i
ans.append(i)
if cnt >= n:
if cnt > n:
ans.remove(cnt - n)
for j in range(len(ans)):
print((ans[j]))
exit()
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
ans = []
cnt = 0
for i in range(1, n + 2):
cnt += i
ans.append(i)
if cnt > n:
ans.remove(cnt - n)
break
print(("\n".join(map(s... | false | 6.25 | [
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7)",
"+n = int(readline())",
"+ans = []",
"-ans = []",
"-for i in range(1, n + 1):",
"+for i ... | false | 0.044753 | 0.04397 | 1.017803 | [
"s982466038",
"s528671323"
] |
u788068140 | p02678 | python | s390340153 | s807492864 | 1,074 | 850 | 149,564 | 74,132 | Accepted | Accepted | 20.86 | N, M = 6, 9
ARR = [
[3, 4],
[6, 1],
[2, 4],
[5, 3],
[4, 6],
[1, 5],
[6, 2],
[4, 5],
[5, 6],
]
N, M = 4, 4
ARR = [
[1, 2],
[2, 3],
[3, 4],
[4, 2],
]
N, M = list(map(int, input().split()))
ARR = []
for i in range(M):
ARR.append(list(map(i... | from collections import deque
N, M = list(map(int, input().split()))
ARR = []
for i in range(M):
ARR.append(list(map(int, input().split())))
def prepare(n, m, arr):
nodes = [[] for i in range(n)]
nodeStatus = [False for i in range(n)]
for i in range(m):
startNode = arr[i][0] - 1... | 68 | 57 | 1,402 | 1,284 | N, M = 6, 9
ARR = [
[3, 4],
[6, 1],
[2, 4],
[5, 3],
[4, 6],
[1, 5],
[6, 2],
[4, 5],
[5, 6],
]
N, M = 4, 4
ARR = [
[1, 2],
[2, 3],
[3, 4],
[4, 2],
]
N, M = list(map(int, input().split()))
ARR = []
for i in range(M):
ARR.append(list(map(int, input().split())))
from ... | from collections import deque
N, M = list(map(int, input().split()))
ARR = []
for i in range(M):
ARR.append(list(map(int, input().split())))
def prepare(n, m, arr):
nodes = [[] for i in range(n)]
nodeStatus = [False for i in range(n)]
for i in range(m):
startNode = arr[i][0] - 1
endNo... | false | 16.176471 | [
"-N, M = 6, 9",
"-ARR = [",
"- [3, 4],",
"- [6, 1],",
"- [2, 4],",
"- [5, 3],",
"- [4, 6],",
"- [1, 5],",
"- [6, 2],",
"- [4, 5],",
"- [5, 6],",
"-]",
"-N, M = 4, 4",
"-ARR = [",
"- [1, 2],",
"- [2, 3],",
"- [3, 4],",
"- [4, 2],",
"-]",
"+... | false | 0.037098 | 0.036876 | 1.005994 | [
"s390340153",
"s807492864"
] |
u141610915 | p02733 | python | s330017118 | s928922559 | 257 | 155 | 46,812 | 74,680 | Accepted | Accepted | 39.69 | import sys
from itertools import combinations as combi
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
S = [list(eval(input()))[: -1] for _ in range(H)]
cs = [[0] * (W + 1) for _ in range(H)]
for i in range(H):
for j in range(W): cs[i][j + 1] = cs[i][j] + int(S[i][j] == "1")
res = H * W
... | import sys
from itertools import combinations as combi
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
S = [list(map(int, list(eval(input()))[: -1])) for _ in range(H)]
res = H + W - 2
for t in range(H):
for c in combi([x for x in range(1, H)], t):
s = set(c)
table = [0] * (t + 1... | 40 | 36 | 959 | 846 | import sys
from itertools import combinations as combi
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
S = [list(eval(input()))[:-1] for _ in range(H)]
cs = [[0] * (W + 1) for _ in range(H)]
for i in range(H):
for j in range(W):
cs[i][j + 1] = cs[i][j] + int(S[i][j] == "1")
res = H * W... | import sys
from itertools import combinations as combi
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
S = [list(map(int, list(eval(input()))[:-1])) for _ in range(H)]
res = H + W - 2
for t in range(H):
for c in combi([x for x in range(1, H)], t):
s = set(c)
table = [0] * (t + ... | false | 10 | [
"-S = [list(eval(input()))[:-1] for _ in range(H)]",
"-cs = [[0] * (W + 1) for _ in range(H)]",
"-for i in range(H):",
"- for j in range(W):",
"- cs[i][j + 1] = cs[i][j] + int(S[i][j] == \"1\")",
"-res = H * W",
"-# print(cs)",
"+S = [list(map(int, list(eval(input()))[:-1])) for _ in range(H... | false | 0.084107 | 0.037447 | 2.246012 | [
"s330017118",
"s928922559"
] |
u719260857 | p02623 | python | s167789246 | s669311733 | 433 | 304 | 48,568 | 48,640 | Accepted | Accepted | 29.79 | n, m, k = list(map(int, input().split(' ')))
list_a = list(map(int, input().split(' ')))
list_b = list(map(int, input().split(' ')))
a_sum=[list_a[0]]
for i in range(1, n):
a_sum.append(list_a[i]+a_sum[i-1])
b_sum=[list_b[0]]
for i in range(1, m):
b_sum.append(list_b[i]+b_sum[i-1])
ans=0
if ... | n, m, k = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a_sum=[0]
for i in range(n):
a_sum.append(a[i]+a_sum[i])
b_sum=[0]
for i in range(m):
b_sum.append(b[i]+b_sum[i])
ans, j = 0, m
for i in range(n+1):
if a_sum[i]>k:
... | 29 | 21 | 643 | 434 | n, m, k = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))
list_b = list(map(int, input().split(" ")))
a_sum = [list_a[0]]
for i in range(1, n):
a_sum.append(list_a[i] + a_sum[i - 1])
b_sum = [list_b[0]]
for i in range(1, m):
b_sum.append(list_b[i] + b_sum[i - 1])
ans = 0
if (a_sum... | n, m, k = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
a_sum = [0]
for i in range(n):
a_sum.append(a[i] + a_sum[i])
b_sum = [0]
for i in range(m):
b_sum.append(b[i] + b_sum[i])
ans, j = 0, m
for i in range(n + 1):
if a_sum[i] > k:
b... | false | 27.586207 | [
"-list_a = list(map(int, input().split(\" \")))",
"-list_b = list(map(int, input().split(\" \")))",
"-a_sum = [list_a[0]]",
"-for i in range(1, n):",
"- a_sum.append(list_a[i] + a_sum[i - 1])",
"-b_sum = [list_b[0]]",
"-for i in range(1, m):",
"- b_sum.append(list_b[i] + b_sum[i - 1])",
"-ans ... | false | 0.048914 | 0.039091 | 1.251272 | [
"s167789246",
"s669311733"
] |
u729133443 | p03013 | python | s568635512 | s245065929 | 249 | 80 | 59,952 | 14,180 | Accepted | Accepted | 67.87 | n,_,*a=list(map(int,open(0).read().split()))
a=set(a)
c,d=1,0
for i in range(n):n=(c+d)%(10**9+7)*(not-~i in a);c,d=n,c
print(n) | n,b,*a=list(map(int,open(0).read().split()))
a=set(a)
d=i=0
c=1
while i<n:i+=1;b=(c+d)%(10**9+7)*(not i in a);c,d=b,c
print(b) | 5 | 6 | 126 | 125 | n, _, *a = list(map(int, open(0).read().split()))
a = set(a)
c, d = 1, 0
for i in range(n):
n = (c + d) % (10**9 + 7) * (not -~i in a)
c, d = n, c
print(n)
| n, b, *a = list(map(int, open(0).read().split()))
a = set(a)
d = i = 0
c = 1
while i < n:
i += 1
b = (c + d) % (10**9 + 7) * (not i in a)
c, d = b, c
print(b)
| false | 16.666667 | [
"-n, _, *a = list(map(int, open(0).read().split()))",
"+n, b, *a = list(map(int, open(0).read().split()))",
"-c, d = 1, 0",
"-for i in range(n):",
"- n = (c + d) % (10**9 + 7) * (not -~i in a)",
"- c, d = n, c",
"-print(n)",
"+d = i = 0",
"+c = 1",
"+while i < n:",
"+ i += 1",
"+ b... | false | 0.043945 | 0.037054 | 1.185963 | [
"s568635512",
"s245065929"
] |
u188827677 | p02583 | python | s643218838 | s521510101 | 134 | 108 | 9,144 | 9,100 | Accepted | Accepted | 19.4 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
for i in range(n-2):
for j in range(i+1, n-1):
for k in range(j+1, n):
if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
if l[i]+l[j] > l[k] and l[i]+l[k] > l[j] and l[j]+l[k] > l[i]: ans += 1
print(ans) | from itertools import combinations
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
for i,j,k in combinations(l,3):
if i == j or i == k or j == k: continue
if i >= j+k or j >= i+k or k >= i+j: continue
ans += 1
print(ans) | 10 | 10 | 295 | 249 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
for k in range(j + 1, n):
if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:
... | from itertools import combinations
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
for i, j, k in combinations(l, 3):
if i == j or i == k or j == k:
continue
if i >= j + k or j >= i + k or k >= i + j:
continue
ans += 1
print(ans)
| false | 0 | [
"+from itertools import combinations",
"+",
"-for i in range(n - 2):",
"- for j in range(i + 1, n - 1):",
"- for k in range(j + 1, n):",
"- if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:",
"- if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:",
... | false | 0.044846 | 0.036538 | 1.227385 | [
"s643218838",
"s521510101"
] |
u703214333 | p03147 | python | s666543427 | s811833960 | 83 | 59 | 3,060 | 3,064 | Accepted | Accepted | 28.92 | n=int(eval(input()))
h=list(map(int,input().split()))
a=[0]*n
ans=0
while True:
flag=0
for i in range(n):
if h[i]>a[i]:
a[i]+=1
flag=1
elif h[i]==a[i] and flag:
break
if flag:
ans+=1
else:
break
print(ans) | n = int(eval(input()))
h = list(map(int,input().split()))
ans = 0
while True:
f = 0
if all(x==0 for x in h):
break
for i in range(n):
if f and h[i] == 0:
break
if h[i]>0:
h[i] -= 1
f = 1
ans += 1
print(ans) | 17 | 16 | 299 | 296 | n = int(eval(input()))
h = list(map(int, input().split()))
a = [0] * n
ans = 0
while True:
flag = 0
for i in range(n):
if h[i] > a[i]:
a[i] += 1
flag = 1
elif h[i] == a[i] and flag:
break
if flag:
ans += 1
else:
break
print(ans)
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
while True:
f = 0
if all(x == 0 for x in h):
break
for i in range(n):
if f and h[i] == 0:
break
if h[i] > 0:
h[i] -= 1
f = 1
ans += 1
print(ans)
| false | 5.882353 | [
"-a = [0] * n",
"- flag = 0",
"+ f = 0",
"+ if all(x == 0 for x in h):",
"+ break",
"- if h[i] > a[i]:",
"- a[i] += 1",
"- flag = 1",
"- elif h[i] == a[i] and flag:",
"+ if f and h[i] == 0:",
"- if flag:",
"- ans += 1",
"- ... | false | 0.07967 | 0.097956 | 0.813323 | [
"s666543427",
"s811833960"
] |
u992465933 | p02983 | python | s495264996 | s055420759 | 49 | 17 | 2,940 | 3,060 | Accepted | Accepted | 65.31 | def main():
L,R = list(map(int,input().split()))
ans = float('inf')
if R-L >= 672:
ans = 0
print(ans)
return
for i in range(L,R):
for j in range(i+1,R+1):
ans = min(ans, i*j%2019)
print(ans)
if __name__ == '__main__':
main()
| def main():
L,R = list(map(int,input().split()))
ans = float('inf')
if R-L >= 672:
ans = 0
print(ans)
return
for i in range(L,R):
for j in range(i+1,R+1):
ans = min(ans, i*j%2019)
if ans == 1:
print(ans)
... | 16 | 19 | 311 | 389 | def main():
L, R = list(map(int, input().split()))
ans = float("inf")
if R - L >= 672:
ans = 0
print(ans)
return
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
print(ans)
if __name__ == "__main__":
main()
| def main():
L, R = list(map(int, input().split()))
ans = float("inf")
if R - L >= 672:
ans = 0
print(ans)
return
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
if ans == 1:
print(ans)
... | false | 15.789474 | [
"+ if ans == 1:",
"+ print(ans)",
"+ return"
] | false | 0.036269 | 0.068659 | 0.528248 | [
"s495264996",
"s055420759"
] |
u052347048 | p03711 | python | s985381915 | s161635867 | 148 | 17 | 12,228 | 2,940 | Accepted | Accepted | 88.51 | import numpy as np
lis = np.array([[1,3,5,7,8,10,12],[4,6,9,11],[2]]);a,b = list(map(int,input().split()))
for i in lis:
if a in i and b in i:print("Yes");exit()
print("No")
| lis = [[1,3,5,7,8,10,12],[4,6,9,11],[2]];a,b = list(map(int,input().split()))
for i in lis:
if a in i and b in i:print("Yes");exit()
print("No")
| 5 | 4 | 176 | 146 | import numpy as np
lis = np.array([[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]])
a, b = list(map(int, input().split()))
for i in lis:
if a in i and b in i:
print("Yes")
exit()
print("No")
| lis = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
a, b = list(map(int, input().split()))
for i in lis:
if a in i and b in i:
print("Yes")
exit()
print("No")
| false | 20 | [
"-import numpy as np",
"-",
"-lis = np.array([[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]])",
"+lis = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]"
] | false | 0.201123 | 0.074551 | 2.697779 | [
"s985381915",
"s161635867"
] |
u386819480 | p03045 | python | s636909436 | s427169740 | 557 | 353 | 14,984 | 15,016 | Accepted | Accepted | 36.62 | #!/usr/bin/env python3
import sys
class UnionFind:
def __init__(self, n):
# par = Parent Number or NoV
self.par = [-1 for i in range(n+1)]
# rank = Tree Height
self.rank = [0] * (n+1)
# 自分が所属する集合の数を返す
def size(self, x):
return -self.find(self.par[x])... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32
class UnionFind:
def __init__(self, n):
# par = Parent Number or NoV
self.par = [-1] * (n+1)
# rank = Tree Height
self.rank = [0] * (n+1)
# 自分が所属する集合の数を返す
def size(self, x):
... | 82 | 84 | 2,068 | 2,023 | #!/usr/bin/env python3
import sys
class UnionFind:
def __init__(self, n):
# par = Parent Number or NoV
self.par = [-1 for i in range(n + 1)]
# rank = Tree Height
self.rank = [0] * (n + 1)
# 自分が所属する集合の数を返す
def size(self, x):
return -self.find(self.par[x])
# 連結成... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1 << 32
class UnionFind:
def __init__(self, n):
# par = Parent Number or NoV
self.par = [-1] * (n + 1)
# rank = Tree Height
self.rank = [0] * (n + 1)
# 自分が所属する集合の数を返す
def size(self, x):
return... | false | 2.380952 | [
"+",
"+sys.setrecursionlimit(10000000)",
"+INF = 1 << 32",
"- self.par = [-1 for i in range(n + 1)]",
"+ self.par = [-1] * (n + 1)",
"- return -self.find(self.par[x])",
"+ return -1 * self.par[self.find(x)]",
"- # 連結成分",
"- def num_graph(self):",
"- return ... | false | 0.039168 | 0.059134 | 0.662354 | [
"s636909436",
"s427169740"
] |
u808427016 | p03682 | python | s201126488 | s787642409 | 1,760 | 1,488 | 125,400 | 124,888 | Accepted | Accepted | 15.45 | N = int(eval(input()))
xy = [[int(_) for _ in input().split()] for i in range(N)]
xsort_n = sorted(list(range(N)), key=lambda n:xy[n][0])
ysort_n = sorted(list(range(N)), key=lambda n:xy[n][1])
from collections import defaultdict
neighbors = defaultdict(list)
for i in range(N - 1):
x1 = xsort_n[i]
... | N = int(eval(input()))
xy = [[int(_) for _ in input().split()] for i in range(N)]
xsort_n = sorted(list(range(N)), key=lambda n:xy[n][0])
ysort_n = sorted(list(range(N)), key=lambda n:xy[n][1])
from collections import defaultdict
neighbors = defaultdict(list)
for i in range(N - 1):
x1 = xsort_n[i]
... | 42 | 43 | 869 | 890 | N = int(eval(input()))
xy = [[int(_) for _ in input().split()] for i in range(N)]
xsort_n = sorted(list(range(N)), key=lambda n: xy[n][0])
ysort_n = sorted(list(range(N)), key=lambda n: xy[n][1])
from collections import defaultdict
neighbors = defaultdict(list)
for i in range(N - 1):
x1 = xsort_n[i]
x2 = xsort... | N = int(eval(input()))
xy = [[int(_) for _ in input().split()] for i in range(N)]
xsort_n = sorted(list(range(N)), key=lambda n: xy[n][0])
ysort_n = sorted(list(range(N)), key=lambda n: xy[n][1])
from collections import defaultdict
neighbors = defaultdict(list)
for i in range(N - 1):
x1 = xsort_n[i]
x2 = xsort... | false | 2.325581 | [
"+ xd = xy[x2][0] - xy[x1][0]",
"- neighbors[x1].append(x2)",
"- neighbors[x2].append(x1)",
"- neighbors[y1].append(y2)",
"- neighbors[y2].append(y1)",
"+ yd = xy[y2][1] - xy[y1][1]",
"+ neighbors[x1].append((x2, xd))",
"+ neighbors[x2].append((x1, xd))",
"+ neighbors[y1].... | false | 0.04083 | 0.039982 | 1.021212 | [
"s201126488",
"s787642409"
] |
u869790980 | p02702 | python | s371813442 | s861409498 | 1,592 | 313 | 89,268 | 90,116 | Accepted | Accepted | 80.34 | s = list(map(int,input()))
dp = [0] * 2019
count = 0
for j in range(len(s)):
ndp = [0] * 2019
ndp[s[j]] += 1
for k in range(len(dp)):ndp[(10*k + s[j]) % 2019] += dp[k]
count += ndp[0]
dp = ndp
print(count)
| import collections
h = collections.Counter([0])
cumul,m,ans = 0,2019,0
pt = 1
for j,u in enumerate(map(int,list(input()))[::-1]):
cumul += u * pt
cumul %= m
pt *= 10
pt %= m
ans += h[cumul]
h[cumul]+=1
print(ans)
| 13 | 13 | 238 | 235 | s = list(map(int, input()))
dp = [0] * 2019
count = 0
for j in range(len(s)):
ndp = [0] * 2019
ndp[s[j]] += 1
for k in range(len(dp)):
ndp[(10 * k + s[j]) % 2019] += dp[k]
count += ndp[0]
dp = ndp
print(count)
| import collections
h = collections.Counter([0])
cumul, m, ans = 0, 2019, 0
pt = 1
for j, u in enumerate(map(int, list(input()))[::-1]):
cumul += u * pt
cumul %= m
pt *= 10
pt %= m
ans += h[cumul]
h[cumul] += 1
print(ans)
| false | 0 | [
"-s = list(map(int, input()))",
"-dp = [0] * 2019",
"-count = 0",
"-for j in range(len(s)):",
"- ndp = [0] * 2019",
"- ndp[s[j]] += 1",
"- for k in range(len(dp)):",
"- ndp[(10 * k + s[j]) % 2019] += dp[k]",
"- count += ndp[0]",
"- dp = ndp",
"-print(count)",
"+import col... | false | 0.159294 | 0.041089 | 3.876758 | [
"s371813442",
"s861409498"
] |
u038408819 | p02596 | python | s091789850 | s248139799 | 188 | 67 | 9,008 | 63,132 | Accepted | Accepted | 64.36 | k = int(eval(input()))
pre = 7 % k
for i in range(1, 10 ** 6):
if pre == 0:
print(i)
quit()
pre = (pre * 10 + 7) % k
print((-1)) | k = int(eval(input()))
num = 7 % k
for i in range(10 ** 6):
if num == 0:
print((i + 1))
quit()
num = (num * 10 + 7) % k
print((-1))
| 8 | 10 | 151 | 148 | k = int(eval(input()))
pre = 7 % k
for i in range(1, 10**6):
if pre == 0:
print(i)
quit()
pre = (pre * 10 + 7) % k
print((-1))
| k = int(eval(input()))
num = 7 % k
for i in range(10**6):
if num == 0:
print((i + 1))
quit()
num = (num * 10 + 7) % k
print((-1))
| false | 20 | [
"-pre = 7 % k",
"-for i in range(1, 10**6):",
"- if pre == 0:",
"- print(i)",
"+num = 7 % k",
"+for i in range(10**6):",
"+ if num == 0:",
"+ print((i + 1))",
"- pre = (pre * 10 + 7) % k",
"+ num = (num * 10 + 7) % k"
] | false | 0.094188 | 0.097505 | 0.965981 | [
"s091789850",
"s248139799"
] |
u821251381 | p02922 | python | s191447421 | s572153328 | 172 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.12 | A,B = list(map(int,input().split()))
plug = 1
cnt = 0
for i in range(100):
if plug < B:
plug += A-1
cnt +=1
#print(cnt)
else:
break
print(cnt) | import math
A,B =list(map(int,input().split()))
soc= 1
tap=0
while(soc<B):
soc-=1
soc+=A
tap+=1
print(tap)
#print(math.ceil((B-1)/(A-1))) | 12 | 10 | 168 | 146 | A, B = list(map(int, input().split()))
plug = 1
cnt = 0
for i in range(100):
if plug < B:
plug += A - 1
cnt += 1
# print(cnt)
else:
break
print(cnt)
| import math
A, B = list(map(int, input().split()))
soc = 1
tap = 0
while soc < B:
soc -= 1
soc += A
tap += 1
print(tap)
# print(math.ceil((B-1)/(A-1)))
| false | 16.666667 | [
"+import math",
"+",
"-plug = 1",
"-cnt = 0",
"-for i in range(100):",
"- if plug < B:",
"- plug += A - 1",
"- cnt += 1",
"- # print(cnt)",
"- else:",
"- break",
"-print(cnt)",
"+soc = 1",
"+tap = 0",
"+while soc < B:",
"+ soc -= 1",
"+ soc += ... | false | 0.046615 | 0.037357 | 1.247817 | [
"s191447421",
"s572153328"
] |
u499381410 | p02580 | python | s010311280 | s593193691 | 2,707 | 661 | 209,764 | 191,876 | Accepted | Accepted | 75.58 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = float('inf')
def L... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = float('inf')
def L... | 78 | 72 | 1,478 | 1,301 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = float("inf")
def LI():
retu... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = float("inf")
def LI():
retu... | false | 7.692308 | [
"-A = [[v, i] for i, v in list(D1.items())] + [[-INF, -INF]]",
"-B = [[v, i] for i, v in list(D2.items())] + [[-INF, -INF]]",
"-A.sort(reverse=True)",
"-B.sort(reverse=True)",
"-a_now = 0",
"-b_now = 0",
"-ans = -INF",
"-while True:",
"- av, ak = A[a_now]",
"- bv, bk = B[b_now]",
"- ans... | false | 0.04267 | 0.076105 | 0.56068 | [
"s010311280",
"s593193691"
] |
u706078123 | p03448 | python | s943952317 | s024483112 | 67 | 53 | 3,060 | 3,064 | Accepted | Accepted | 20.9 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
i1, i2, i3, p = 0, 0, 0, 0
while i1 <= a:
while i2 <= b:
while i3 <= c:
m = 500 * i1 + 100 * i2 + 50 * i3
if m == x:
p += 1
i3 += 1
i3 = 0
i2 += 1
i2 = 0
i1 += 1
print(... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
i1, i2, i3, p = 0, 0, 0, 0
while i1 <= a:
while i2 <= b:
while i3 <= c:
m = 500 * i1 + 100 * i2 + 50 * i3
if m > x:
break
elif m == x:
p += 1
i3 += 1
i3 = 0
i2... | 17 | 19 | 298 | 332 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
i1, i2, i3, p = 0, 0, 0, 0
while i1 <= a:
while i2 <= b:
while i3 <= c:
m = 500 * i1 + 100 * i2 + 50 * i3
if m == x:
p += 1
i3 += 1
i3 = 0
i2 += 1
... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
i1, i2, i3, p = 0, 0, 0, 0
while i1 <= a:
while i2 <= b:
while i3 <= c:
m = 500 * i1 + 100 * i2 + 50 * i3
if m > x:
break
elif m == x:
p += 1
... | false | 10.526316 | [
"- if m == x:",
"+ if m > x:",
"+ break",
"+ elif m == x:"
] | false | 0.140578 | 0.037984 | 3.700978 | [
"s943952317",
"s024483112"
] |
u037754315 | p02657 | python | s521238457 | s545213290 | 23 | 20 | 9,164 | 9,144 | Accepted | Accepted | 13.04 | s = list(map(int, input().split()))
print((s[0]*s[1])) | s = list(map(int, input().split()))
S = list(s)
print((S[0]*S[1])) | 2 | 3 | 53 | 61 | s = list(map(int, input().split()))
print((s[0] * s[1]))
| s = list(map(int, input().split()))
S = list(s)
print((S[0] * S[1]))
| false | 33.333333 | [
"-print((s[0] * s[1]))",
"+S = list(s)",
"+print((S[0] * S[1]))"
] | false | 0.048754 | 0.043536 | 1.119872 | [
"s521238457",
"s545213290"
] |
u171366497 | p02990 | python | s627266832 | s704057130 | 341 | 20 | 3,316 | 3,444 | Accepted | Accepted | 94.13 | from math import factorial as fc
N,K = list(map(int,input().split()))
MOD = (10 ** 9)+ 7
for i in range(1,K+1):
if N-K+1<i:
print((0))
continue
bunbo = fc(i)*fc(N-K+1-i)*fc(i-1)*fc(K-i)
bunsi = fc(N-K+1)*fc(K-1)
print(((bunsi//bunbo)%MOD)) | N,K=list(map(int,input().split()))
mod=10**9+7
kaijo=[1]*(N+1)
for i in range(1,N+1):
kaijo[i]=kaijo[i-1]*i%mod
gyaku=[0]*(N+1)
gyaku[N]=pow(kaijo[N],mod-2,mod)
for i in range(N,0,-1):
gyaku[i-1]=gyaku[i]*i%mod
for i in range(1,K+1):
if N-K+1<i:
print((0))
continue
bunbo=gya... | 12 | 16 | 274 | 425 | from math import factorial as fc
N, K = list(map(int, input().split()))
MOD = (10**9) + 7
for i in range(1, K + 1):
if N - K + 1 < i:
print((0))
continue
bunbo = fc(i) * fc(N - K + 1 - i) * fc(i - 1) * fc(K - i)
bunsi = fc(N - K + 1) * fc(K - 1)
print(((bunsi // bunbo) % MOD))
| N, K = list(map(int, input().split()))
mod = 10**9 + 7
kaijo = [1] * (N + 1)
for i in range(1, N + 1):
kaijo[i] = kaijo[i - 1] * i % mod
gyaku = [0] * (N + 1)
gyaku[N] = pow(kaijo[N], mod - 2, mod)
for i in range(N, 0, -1):
gyaku[i - 1] = gyaku[i] * i % mod
for i in range(1, K + 1):
if N - K + 1 < i:
... | false | 25 | [
"-from math import factorial as fc",
"-",
"-MOD = (10**9) + 7",
"+mod = 10**9 + 7",
"+kaijo = [1] * (N + 1)",
"+for i in range(1, N + 1):",
"+ kaijo[i] = kaijo[i - 1] * i % mod",
"+gyaku = [0] * (N + 1)",
"+gyaku[N] = pow(kaijo[N], mod - 2, mod)",
"+for i in range(N, 0, -1):",
"+ gyaku[i -... | false | 0.143024 | 0.037342 | 3.830075 | [
"s627266832",
"s704057130"
] |
u312025627 | p02695 | python | s622255346 | s149563723 | 358 | 174 | 74,816 | 73,668 | Accepted | Accepted | 51.4 | def main():
import sys
input = sys.stdin.buffer.readline
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
def dfs(A):
cur = 0
if len(A) == N:
for a, b, c, d in T:
if A[b-1] - A[a-1] == c:
... | def main():
from itertools import combinations_with_replacement
import sys
input = sys.stdin.buffer.readline
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
ans = 0
for C in combinations_with_replacement(list(range(1, M+1)), N):
... | 27 | 19 | 690 | 535 | def main():
import sys
input = sys.stdin.buffer.readline
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
def dfs(A):
cur = 0
if len(A) == N:
for a, b, c, d in T:
if A[b - 1] - A[a - 1] == c:
... | def main():
from itertools import combinations_with_replacement
import sys
input = sys.stdin.buffer.readline
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
ans = 0
for C in combinations_with_replacement(list(range(1, M + 1)), N):
... | false | 29.62963 | [
"+ from itertools import combinations_with_replacement",
"-",
"- def dfs(A):",
"+ ans = 0",
"+ for C in combinations_with_replacement(list(range(1, M + 1)), N):",
"+ A = sorted(C)",
"- if len(A) == N:",
"- for a, b, c, d in T:",
"- if A[b - 1] - A[... | false | 0.076643 | 0.164191 | 0.466789 | [
"s622255346",
"s149563723"
] |
u900139929 | p02912 | python | s619332118 | s940948226 | 171 | 154 | 14,180 | 14,180 | Accepted | Accepted | 9.94 | #!/usr/bin/env python3
from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [-1*item for item in a]
heapify(a)
for i in range(m):
max = -1* heappop(a)
heappush(a, int(-1*max/2)) # 要素の挿入
a = [-1*item for item in a]
ans = su... | #!/usr/bin/env python3
from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
a = list([int(x)*-1 for x in input().split()])
heapify(a)
for i in range(m):
min = heappop(a)
heappush(a, (-1)*(-1*min//2)) # 要素の挿入
ans = -sum(a)
print(ans)
| 17 | 16 | 339 | 292 | #!/usr/bin/env python3
from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [-1 * item for item in a]
heapify(a)
for i in range(m):
max = -1 * heappop(a)
heappush(a, int(-1 * max / 2)) # 要素の挿入
a = [-1 * item for item in a]
ans = sum(list(a... | #!/usr/bin/env python3
from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
a = list([int(x) * -1 for x in input().split()])
heapify(a)
for i in range(m):
min = heappop(a)
heappush(a, (-1) * (-1 * min // 2)) # 要素の挿入
ans = -sum(a)
print(ans)
| false | 5.882353 | [
"-a = list(map(int, input().split()))",
"-a = [-1 * item for item in a]",
"+a = list([int(x) * -1 for x in input().split()])",
"- max = -1 * heappop(a)",
"- heappush(a, int(-1 * max / 2)) # 要素の挿入",
"-a = [-1 * item for item in a]",
"-ans = sum(list(a))",
"+ min = heappop(a)",
"+ heappus... | false | 0.046019 | 0.26845 | 0.171425 | [
"s619332118",
"s940948226"
] |
u189023301 | p03333 | python | s441382414 | s541114187 | 301 | 219 | 38,812 | 86,808 | Accepted | Accepted | 27.24 | # ref https://atcoder.jp/contests/agc025/submissions/7307839
import numpy as np
def main():
n = int(eval(input()))
L, R = [], []
for i in range(n):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
ll = np.array(L); ll.sort(); ll = ll[::-1]
rr = np.ar... | # ref https://atcoder.jp/contests/agc025/submissions/2609185
def main():
n = int(eval(input()))
L, R = [0], [0]
for i in range(n):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
L.sort()
L.reverse()
R.sort()
res = 0
for i in range(n +... | 23 | 20 | 545 | 433 | # ref https://atcoder.jp/contests/agc025/submissions/7307839
import numpy as np
def main():
n = int(eval(input()))
L, R = [], []
for i in range(n):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
ll = np.array(L)
ll.sort()
ll = ll[::-1]
rr = np.array(... | # ref https://atcoder.jp/contests/agc025/submissions/2609185
def main():
n = int(eval(input()))
L, R = [0], [0]
for i in range(n):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
L.sort()
L.reverse()
R.sort()
res = 0
for i in range(n + 1):
i... | false | 13.043478 | [
"-# ref https://atcoder.jp/contests/agc025/submissions/7307839",
"-import numpy as np",
"-",
"-",
"+# ref https://atcoder.jp/contests/agc025/submissions/2609185",
"- L, R = [], []",
"+ L, R = [0], [0]",
"- ll = np.array(L)",
"- ll.sort()",
"- ll = ll[::-1]",
"- rr = np.array(R)... | false | 0.290569 | 0.043615 | 6.662198 | [
"s441382414",
"s541114187"
] |
u150984829 | p02386 | python | s607085777 | s484242802 | 110 | 90 | 5,992 | 5,608 | Accepted | Accepted | 18.18 | from itertools import*
n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
t=0
lst=list(combinations(a,2))
for d,e in lst:
for i in range(6):
m=('012345','152043','215304','302541','410352','514320')[i]
f=[d[int(k)]for k in m]
if f[0]... | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
t=0
for i in range(n-1):
d=a[i]
for j in range(i+1,n):
e=a[j]
for p in('012345','152043','215304','302541','410352','514320'):
f=[d[int(k)]for k in p]
if f[0]==e[0]and f[5]==e[5... | 16 | 16 | 430 | 411 | from itertools import *
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
t = 0
lst = list(combinations(a, 2))
for d, e in lst:
for i in range(6):
m = ("012345", "152043", "215304", "302541", "410352", "514320")[i]
... | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
t = 0
for i in range(n - 1):
d = a[i]
for j in range(i + 1, n):
e = a[j]
for p in ("012345", "152043", "215304", "302541", "410352", "514320"):
f... | false | 0 | [
"-from itertools import *",
"-",
"-lst = list(combinations(a, 2))",
"-for d, e in lst:",
"- for i in range(6):",
"- m = (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\")[i]",
"- f = [d[int(k)] for k in m]",
"- if f[0] == e[0] and f[5] == e[5]:",
"- ... | false | 0.037016 | 0.036072 | 1.026156 | [
"s607085777",
"s484242802"
] |
u297109012 | p03050 | python | s235428223 | s746826359 | 210 | 115 | 3,188 | 3,188 | Accepted | Accepted | 45.24 | def solve(N):
s = 1
e = int(pow(N, 0.5)) + 1
ds = []
for i in range(s, e):
if N % i == 0:
m = (N // i) - 1
if m and N // m == N % m:
ds.append(N // i)
# print(f"{N} = {m} * {N // m} + {N % m}")
return sum([i - 1 for i in ds]... | def solve(N):
s = 1
e = int(pow(N, 0.5)) + 1
ds = []
for i in range(s, e):
if N % i == 0:
m = (N // i) - 1
if m and N // m == N % m:
ds.append(N // i)
return sum([i - 1 for i in ds])
if __name__ == "__main__":
N = int(eval(input()))
... | 20 | 15 | 502 | 335 | def solve(N):
s = 1
e = int(pow(N, 0.5)) + 1
ds = []
for i in range(s, e):
if N % i == 0:
m = (N // i) - 1
if m and N // m == N % m:
ds.append(N // i)
# print(f"{N} = {m} * {N // m} + {N % m}")
return sum([i - 1 for i in ds])
assert s... | def solve(N):
s = 1
e = int(pow(N, 0.5)) + 1
ds = []
for i in range(s, e):
if N % i == 0:
m = (N // i) - 1
if m and N // m == N % m:
ds.append(N // i)
return sum([i - 1 for i in ds])
if __name__ == "__main__":
N = int(eval(input()))
print((so... | false | 25 | [
"- # print(f\"{N} = {m} * {N // m} + {N % m}\")",
"-assert solve(8) == 3 + 7",
"-assert solve(10) == 4 + 9",
"-assert solve(1000000000000) == 2499686339916"
] | false | 0.580393 | 0.458248 | 1.266547 | [
"s235428223",
"s746826359"
] |
u214617707 | p03574 | python | s000987594 | s785010757 | 32 | 28 | 3,444 | 3,064 | Accepted | Accepted | 12.5 | H,W = map(int,input().split())
S=[]
for i in range(H):
S.append(input())
for i in range(H):
for j in range(W):
if S[i][j] == "#":
print("#",end="")
else:
rec = 0
for d in [(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1),(1,-1)]:
nx,n... | H, W = list(map(int, input().split()))
S = []
for i in range(H):
S.append(eval(input()))
for i in range(H):
for j in range(W):
if S[i][j] == ".":
S[i] = S[i].replace(".", "0", 1)
rec = 0
for d in [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (... | 17 | 23 | 496 | 654 | H, W = map(int, input().split())
S = []
for i in range(H):
S.append(input())
for i in range(H):
for j in range(W):
if S[i][j] == "#":
print("#", end="")
else:
rec = 0
for d in [
(1, 0),
(1, 1),
(0, 1),
... | H, W = list(map(int, input().split()))
S = []
for i in range(H):
S.append(eval(input()))
for i in range(H):
for j in range(W):
if S[i][j] == ".":
S[i] = S[i].replace(".", "0", 1)
rec = 0
for d in [
(1, 0),
(1, 1),
(0, 1)... | false | 26.086957 | [
"-H, W = map(int, input().split())",
"+H, W = list(map(int, input().split()))",
"- S.append(input())",
"+ S.append(eval(input()))",
"- if S[i][j] == \"#\":",
"- print(\"#\", end=\"\")",
"- else:",
"+ if S[i][j] == \".\":",
"+ S[i] = S[i].replace(\".\"... | false | 0.038381 | 0.046103 | 0.832513 | [
"s000987594",
"s785010757"
] |
u562935282 | p02788 | python | s211130475 | s182808258 | 1,641 | 752 | 128,008 | 84,700 | Accepted | Accepted | 54.17 | def main():
from bisect import bisect_left
from operator import itemgetter
N, D, A = list(map(int, input().split()))
xh = []
xs = set()
for _ in range(N):
x, h = list(map(int, input().split()))
xh.append((x, h))
xs.add(x)
xs.add(x + D)
xs.ad... | def main():
from collections import namedtuple
from operator import attrgetter
import sys
readline = sys.stdin.readline
mon = namedtuple('mon', 'x h')
N, D, A = list(map(int, readline().split()))
mons = []
for _ in range(N):
x, h = list(map(int, readline().split()))
... | 48 | 35 | 1,003 | 794 | def main():
from bisect import bisect_left
from operator import itemgetter
N, D, A = list(map(int, input().split()))
xh = []
xs = set()
for _ in range(N):
x, h = list(map(int, input().split()))
xh.append((x, h))
xs.add(x)
xs.add(x + D)
xs.add(x + D * 2)
... | def main():
from collections import namedtuple
from operator import attrgetter
import sys
readline = sys.stdin.readline
mon = namedtuple("mon", "x h")
N, D, A = list(map(int, readline().split()))
mons = []
for _ in range(N):
x, h = list(map(int, readline().split()))
mons... | false | 27.083333 | [
"- from bisect import bisect_left",
"- from operator import itemgetter",
"+ from collections import namedtuple",
"+ from operator import attrgetter",
"+ import sys",
"- N, D, A = list(map(int, input().split()))",
"- xh = []",
"- xs = set()",
"+ readline = sys.stdin.readlin... | false | 0.037494 | 0.040652 | 0.922302 | [
"s211130475",
"s182808258"
] |
u279955105 | p02388 | python | s644099447 | s078918553 | 30 | 20 | 7,648 | 5,576 | Accepted | Accepted | 33.33 | t = int(eval(input()))
print((t**3)) | x = int(eval(input()))
print((x**3))
| 2 | 2 | 29 | 30 | t = int(eval(input()))
print((t**3))
| x = int(eval(input()))
print((x**3))
| false | 0 | [
"-t = int(eval(input()))",
"-print((t**3))",
"+x = int(eval(input()))",
"+print((x**3))"
] | false | 0.083033 | 0.080377 | 1.033047 | [
"s644099447",
"s078918553"
] |
u699296734 | p02596 | python | s951517732 | s270142711 | 228 | 208 | 200,680 | 156,932 | Accepted | Accepted | 8.77 | k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
memo = ((memo % k) * (10 % k)) % k
mod = (mod + 7 * memo) % k
if mod not in mod_map:
mod_map.add(mod)
else:
counter = -1
break
counter += 1
if mod == 0:... | k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
mod = ((mod * 10) % k + 7) % k
if mod not in mod_map:
mod_map.add(mod)
else:
counter = -1
break
counter += 1
if mod == 0:
break
print(counter)
| 18 | 17 | 346 | 310 | k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
memo = ((memo % k) * (10 % k)) % k
mod = (mod + 7 * memo) % k
if mod not in mod_map:
mod_map.add(mod)
else:
counter = -1
break
counter += 1
if mod == 0:
break
... | k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
mod = ((mod * 10) % k + 7) % k
if mod not in mod_map:
mod_map.add(mod)
else:
counter = -1
break
counter += 1
if mod == 0:
break
print(counter)
| false | 5.555556 | [
"- memo = ((memo % k) * (10 % k)) % k",
"- mod = (mod + 7 * memo) % k",
"+ mod = ((mod * 10) % k + 7) % k"
] | false | 0.22393 | 0.237361 | 0.943417 | [
"s951517732",
"s270142711"
] |
u796942881 | p04031 | python | s044565921 | s325720473 | 23 | 17 | 2,940 | 2,940 | Accepted | Accepted | 26.09 | INF = int(1e9 + 7)
def main():
N, *an = list(map(int, open(0).read().split()))
ans = INF
for i in range(min(an), max(an) + 1):
tmp = 0
for ai in an:
tmp += (ai - i) ** 2
ans = min(ans, tmp)
print(ans)
return
main()
| def main():
N, *an = list(map(int, open(0).read().split()))
print((min(sum((ai - (sum(an) // N)) ** 2 for ai in an),
sum((ai + (-sum(an) // N)) ** 2 for ai in an))))
return
main()
| 16 | 8 | 284 | 207 | INF = int(1e9 + 7)
def main():
N, *an = list(map(int, open(0).read().split()))
ans = INF
for i in range(min(an), max(an) + 1):
tmp = 0
for ai in an:
tmp += (ai - i) ** 2
ans = min(ans, tmp)
print(ans)
return
main()
| def main():
N, *an = list(map(int, open(0).read().split()))
print(
(
min(
sum((ai - (sum(an) // N)) ** 2 for ai in an),
sum((ai + (-sum(an) // N)) ** 2 for ai in an),
)
)
)
return
main()
| false | 50 | [
"-INF = int(1e9 + 7)",
"-",
"-",
"- ans = INF",
"- for i in range(min(an), max(an) + 1):",
"- tmp = 0",
"- for ai in an:",
"- tmp += (ai - i) ** 2",
"- ans = min(ans, tmp)",
"- print(ans)",
"+ print(",
"+ (",
"+ min(",
"+ ... | false | 0.041806 | 0.078766 | 0.530762 | [
"s044565921",
"s325720473"
] |
u991542950 | p02576 | python | s417031204 | s930185486 | 69 | 63 | 61,580 | 61,788 | Accepted | Accepted | 8.7 | N,X,T = list(map(int, input().split()))
if N % X == 0:
print(((N // X) * T))
else:
print(((N // X) * T + T))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, X, T = list(map(int, read().split()))
N = (N + X - 1) // X
print((N * T)) | 5 | 10 | 107 | 199 | N, X, T = list(map(int, input().split()))
if N % X == 0:
print(((N // X) * T))
else:
print(((N // X) * T + T))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, X, T = list(map(int, read().split()))
N = (N + X - 1) // X
print((N * T))
| false | 50 | [
"-N, X, T = list(map(int, input().split()))",
"-if N % X == 0:",
"- print(((N // X) * T))",
"-else:",
"- print(((N // X) * T + T))",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+N, X, T = list(map... | false | 0.079804 | 0.057209 | 1.394964 | [
"s417031204",
"s930185486"
] |
u171328579 | p03208 | python | s733624401 | s213033938 | 199 | 182 | 13,280 | 16,960 | Accepted | Accepted | 8.54 | N, K = list(map(int,input().split()))
H = []
for i in range(N):
H.append(int(eval(input())))
H.sort()
ans = 10**9
for i in range(N-K+1):
ans = min(ans, H[i+K-1]-H[i])
print(ans) | N,K = list(map(int,input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
P = []
for i in range(N-K+1):
P.append(T[i+K-1] - T[i])
print((min(P))) | 12 | 9 | 187 | 160 | N, K = list(map(int, input().split()))
H = []
for i in range(N):
H.append(int(eval(input())))
H.sort()
ans = 10**9
for i in range(N - K + 1):
ans = min(ans, H[i + K - 1] - H[i])
print(ans)
| N, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
P = []
for i in range(N - K + 1):
P.append(T[i + K - 1] - T[i])
print((min(P)))
| false | 25 | [
"-H = []",
"-for i in range(N):",
"- H.append(int(eval(input())))",
"-H.sort()",
"-ans = 10**9",
"+T = [int(eval(input())) for i in range(N)]",
"+T.sort()",
"+P = []",
"- ans = min(ans, H[i + K - 1] - H[i])",
"-print(ans)",
"+ P.append(T[i + K - 1] - T[i])",
"+print((min(P)))"
] | false | 0.035498 | 0.03517 | 1.009333 | [
"s733624401",
"s213033938"
] |
u619458041 | p03013 | python | s816222074 | s512802289 | 73 | 61 | 8,616 | 8,616 | Accepted | Accepted | 16.44 | import sys
def main():
input = sys.stdin.readline
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
is_safe = [True] * (N+1)
for a in A:
is_safe[a] = False
dp = [0] * (N+2)
dp[1] = 1
for i in range(N):
st... | import sys
def main():
input = sys.stdin.readline
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
is_safe = [True] * (N+2)
for a in A:
is_safe[a+1] = False
dp = [0] * (N+2)
dp[1] = 1
for i in range(2, N+2):
... | 26 | 25 | 534 | 504 | import sys
def main():
input = sys.stdin.readline
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
is_safe = [True] * (N + 1)
for a in A:
is_safe[a] = False
dp = [0] * (N + 2)
dp[1] = 1
for i in range(N):
step = i + 2... | import sys
def main():
input = sys.stdin.readline
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
is_safe = [True] * (N + 2)
for a in A:
is_safe[a + 1] = False
dp = [0] * (N + 2)
dp[1] = 1
for i in range(2, N + 2):
i... | false | 3.846154 | [
"- is_safe = [True] * (N + 1)",
"+ is_safe = [True] * (N + 2)",
"- is_safe[a] = False",
"+ is_safe[a + 1] = False",
"- for i in range(N):",
"- step = i + 2",
"- if is_safe[i + 1]:",
"- dp[step] = dp[step - 1] + dp[step - 2]",
"- dp[step] %= ... | false | 0.117354 | 0.035424 | 3.312862 | [
"s816222074",
"s512802289"
] |
u617515020 | p03013 | python | s711841193 | s560245024 | 168 | 141 | 128,784 | 19,120 | Accepted | Accepted | 16.07 | import sys
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD=10**9+7
n,m=list(map(int,input().split()))
a=set([int(eval(input())) for _ in range(m)])
if n==1:
print((1))
exit()
if 1 in a and 2 in a:
print((0))
exit()
elif 1 in a:
ans=[0,0,1]
elif 2 in a:
ans=[0,1,0]
else:
a... | MOD=10**9+7
n,m=list(map(int,input().split()))
a=set([int(eval(input())) for _ in range(m)])
if n==1:
print((1))
exit()
if 1 in a and 2 in a:
print((0))
exit()
elif 1 in a:
ans=[0,1]
elif 2 in a:
ans=[1,0]
else:
ans=[1,2]
for i in range(2,n):
if i+1 in a:
ans.append(0)
else:
... | 29 | 23 | 475 | 369 | import sys
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
n, m = list(map(int, input().split()))
a = set([int(eval(input())) for _ in range(m)])
if n == 1:
print((1))
exit()
if 1 in a and 2 in a:
print((0))
exit()
elif 1 in a:
ans = [0, 0, 1]
elif 2 in a:
ans = [0,... | MOD = 10**9 + 7
n, m = list(map(int, input().split()))
a = set([int(eval(input())) for _ in range(m)])
if n == 1:
print((1))
exit()
if 1 in a and 2 in a:
print((0))
exit()
elif 1 in a:
ans = [0, 1]
elif 2 in a:
ans = [1, 0]
else:
ans = [1, 2]
for i in range(2, n):
if i + 1 in a:
... | false | 20.689655 | [
"-import sys",
"-from functools import lru_cache",
"-",
"-sys.setrecursionlimit(10**9)",
"- ans = [0, 0, 1]",
"+ ans = [0, 1]",
"- ans = [0, 1, 0]",
"+ ans = [1, 0]",
"- ans = [0, 1, 2]",
"-",
"-",
"-@lru_cache(maxsize=None)",
"-def cnt(x):",
"- if x < 3:",
"- re... | false | 0.043894 | 0.044094 | 0.995461 | [
"s711841193",
"s560245024"
] |
u844789719 | p03634 | python | s491570799 | s943842333 | 1,467 | 1,193 | 87,040 | 82,192 | Accepted | Accepted | 18.68 | import heapq
V = int(eval(input()))
E = V - 1
G = {}
for i in range(V):
G[i] = {}
for _ in range(E):
s, t, c = [int(_) for _ in input().split()]
s -= 1 # 0-indexed
t -= 1 # 0-indexed
G[s][t] = c
G[t][s] = c
Q, K = [int(_) for _ in input().split()]
K -= 1 # 0-indexed
XY = [[i... | V = int(eval(input()))
E = V - 1
G = {}
for i in range(V):
G[i] = {}
for _ in range(E):
s, t, c = [int(_) for _ in input().split()]
s -= 1 # 0-indexed
t -= 1 # 0-indexed
G[s][t] = c
G[t][s] = c
Q, K = [int(_) for _ in input().split()]
K -= 1 # 0-indexed
XY = [[int(_) for _ in i... | 47 | 35 | 879 | 726 | import heapq
V = int(eval(input()))
E = V - 1
G = {}
for i in range(V):
G[i] = {}
for _ in range(E):
s, t, c = [int(_) for _ in input().split()]
s -= 1 # 0-indexed
t -= 1 # 0-indexed
G[s][t] = c
G[t][s] = c
Q, K = [int(_) for _ in input().split()]
K -= 1 # 0-indexed
XY = [[int(_) for _ in in... | V = int(eval(input()))
E = V - 1
G = {}
for i in range(V):
G[i] = {}
for _ in range(E):
s, t, c = [int(_) for _ in input().split()]
s -= 1 # 0-indexed
t -= 1 # 0-indexed
G[s][t] = c
G[t][s] = c
Q, K = [int(_) for _ in input().split()]
K -= 1 # 0-indexed
XY = [[int(_) for _ in input().split()]... | false | 25.531915 | [
"-import heapq",
"-",
"-que = []",
"-i = K",
"-d = 0",
"-D[i] = 0",
"-used = [False] * V",
"-used[i] = True",
"+D[K] = 0",
"+cand = []",
"+for j in list(G[K].keys()):",
"+ cand += [(K, j)]",
"- for j in list(G[i].keys()):",
"- heapq.heappush(que, (d + G[i][j], j))",
"- v ... | false | 0.038233 | 0.097351 | 0.39273 | [
"s491570799",
"s943842333"
] |
u970899068 | p03436 | python | s561456895 | s165234752 | 217 | 193 | 40,304 | 40,688 | Accepted | Accepted | 11.06 | # 迷路読み込み
h,w = list(map(int, input().split()))
maze=[list(eval(input())) for i in range(h)]
ans=0
for i in range(h):
ans+=maze[i].count('.')
for i in range(h):
maze[i]=['#']+maze[i]+['#']
maze=[['#' for i in range(w+2)]]+maze+[['#' for i in range(w+2)]]
# 迷路 BFS
import collections
from collection... | h,w= list(map(int, input().split()))
maze= [list(eval(input())) for i in range(h)]
# 白いマスの数
ans=0
for i in range(h):
for j in range(w):
if maze[i][j]=='.':
ans+=1
import collections
from collections import deque
def clear_maze(sx, sy, gx, gy):
INF=-10**9
distance = ... | 44 | 46 | 1,153 | 1,109 | # 迷路読み込み
h, w = list(map(int, input().split()))
maze = [list(eval(input())) for i in range(h)]
ans = 0
for i in range(h):
ans += maze[i].count(".")
for i in range(h):
maze[i] = ["#"] + maze[i] + ["#"]
maze = [["#" for i in range(w + 2)]] + maze + [["#" for i in range(w + 2)]]
# 迷路 BFS
import collections
from co... | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for i in range(h)]
# 白いマスの数
ans = 0
for i in range(h):
for j in range(w):
if maze[i][j] == ".":
ans += 1
import collections
from collections import deque
def clear_maze(sx, sy, gx, gy):
INF = -(10**9)
distance = [[INF f... | false | 4.347826 | [
"-# 迷路読み込み",
"+# 白いマスの数",
"- ans += maze[i].count(\".\")",
"-for i in range(h):",
"- maze[i] = [\"#\"] + maze[i] + [\"#\"]",
"-maze = [[\"#\" for i in range(w + 2)]] + maze + [[\"#\" for i in range(w + 2)]]",
"-# 迷路 BFS",
"+ for j in range(w):",
"+ if maze[i][j] == \".\":",
"+ ... | false | 0.036176 | 0.032725 | 1.10546 | [
"s561456895",
"s165234752"
] |
u021019433 | p02891 | python | s065631292 | s141200762 | 23 | 18 | 3,572 | 3,060 | Accepted | Accepted | 21.74 | from itertools import groupby
from functools import reduce
from operator import xor
s = eval(input())
k = int(eval(input()))
r = len(s) * k // 2
a = [reduce(xor, (1 for _ in g)) for _, g in groupby(s)]
if len(a) > 1:
r -= sum(a) * k // 2
if s[0] == s[-1] and a[0] & a[-1]:
r += k - 1
print(r)
| from itertools import groupby
s = eval(input())
k = int(eval(input()))
r = len(s) * k // 2
a = [len(''.join(g)) & 1 for _, g in groupby(s)]
if len(a) > 1:
r -= sum(a) * k // 2
if s[0] == s[-1] and a[0] & a[-1]:
r += k - 1
print(r)
| 13 | 11 | 302 | 238 | from itertools import groupby
from functools import reduce
from operator import xor
s = eval(input())
k = int(eval(input()))
r = len(s) * k // 2
a = [reduce(xor, (1 for _ in g)) for _, g in groupby(s)]
if len(a) > 1:
r -= sum(a) * k // 2
if s[0] == s[-1] and a[0] & a[-1]:
r += k - 1
print(r)
| from itertools import groupby
s = eval(input())
k = int(eval(input()))
r = len(s) * k // 2
a = [len("".join(g)) & 1 for _, g in groupby(s)]
if len(a) > 1:
r -= sum(a) * k // 2
if s[0] == s[-1] and a[0] & a[-1]:
r += k - 1
print(r)
| false | 15.384615 | [
"-from functools import reduce",
"-from operator import xor",
"-a = [reduce(xor, (1 for _ in g)) for _, g in groupby(s)]",
"+a = [len(\"\".join(g)) & 1 for _, g in groupby(s)]"
] | false | 0.125728 | 0.038648 | 3.253125 | [
"s065631292",
"s141200762"
] |
u930705402 | p02913 | python | s710273596 | s867113853 | 910 | 159 | 52,444 | 84,904 | Accepted | Accepted | 82.53 | def z_algorithm(S):
l=len(S)
A=[0]*n
i=1;j=0
while i<l:
while(i+j<l and S[j]==S[i+j]):
j+=1
A[i]=j
if j==0:
i+=1
continue
k=1
while i+k<l and k+A[k]<j:
A[i+k]=A[k]
k+=1
i+=k
... | class RollingHash:
def __init__(self,S,base,M):
self.N=len(S)
self.M=M
self.H=[0]*(self.N+1)
self.B=[0]*(self.N+1)
self.B[0]=1
for i in range(self.N):
self.B[i+1]=self.B[i]*base%M
self.H[i+1]=(self.H[i]*base+(ord(S[i])-96))%M
def ... | 27 | 47 | 516 | 1,048 | def z_algorithm(S):
l = len(S)
A = [0] * n
i = 1
j = 0
while i < l:
while i + j < l and S[j] == S[i + j]:
j += 1
A[i] = j
if j == 0:
i += 1
continue
k = 1
while i + k < l and k + A[k] < j:
A[i + k] = A[k]
... | class RollingHash:
def __init__(self, S, base, M):
self.N = len(S)
self.M = M
self.H = [0] * (self.N + 1)
self.B = [0] * (self.N + 1)
self.B[0] = 1
for i in range(self.N):
self.B[i + 1] = self.B[i] * base % M
self.H[i + 1] = (self.H[i] * base +... | false | 42.553191 | [
"-def z_algorithm(S):",
"- l = len(S)",
"- A = [0] * n",
"- i = 1",
"- j = 0",
"- while i < l:",
"- while i + j < l and S[j] == S[i + j]:",
"- j += 1",
"- A[i] = j",
"- if j == 0:",
"- i += 1",
"- continue",
"- k = 1... | false | 0.048385 | 0.129018 | 0.375024 | [
"s710273596",
"s867113853"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.