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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u477977638 | p03779 | python | s537017216 | s573493132 | 41 | 33 | 4,848 | 9,156 | Accepted | Accepted | 19.51 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')
#import numpy as np
#import operator
import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deq... | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | 35 | 29 | 960 | 624 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# import numpy as np
# import operator
import bisect
# from heapq import heapify,heappop,heappush
# from math import gcd
# from fractions import gcd
# from collections import deque
... | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | false | 17.142857 | [
"-read = sys.stdin.buffer.read",
"-inputs = sys.stdin.buffer.readlines",
"-# rstrip().decode('utf-8')",
"-# import numpy as np",
"-# import operator",
"-import bisect",
"+# sys.setrecursionlimit(10**9)",
"+# from functools import lru_cache",
"+def RD():",
"+ return input().rstrip().decode()",
... | false | 0.085423 | 0.038893 | 2.196372 | [
"s537017216",
"s573493132"
] |
u677121387 | p03031 | python | s390543784 | s489976282 | 32 | 29 | 3,064 | 3,064 | Accepted | Accepted | 9.38 | n,m = list(map(int,input().split()))
k = [list(map(int,input().split())) for i in range(m)]
p = list(map(int,input().split()))
ans = 0
switch_st = 0
cnt = 0
while switch_st != 2**n:
switch_on = { i+1 for i in range(n) if switch_st>>i & 1 == 1}
for i in range(m):
switch_cnt = len(switch_on & s... | N,M = list(map(int,input().split()))
S = [[int(i)-1 for i in input().split()] for _ in range(M)]
P = [int(i) for i in input().split()]
ans = 0
for i in range(1<<N):
for j in range(M):
cnt = 0
for s in S[j][1:]:
if i >> s & 1: cnt += 1
if cnt%2 != P[j]: break
else:... | 20 | 15 | 486 | 346 | n, m = list(map(int, input().split()))
k = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
switch_st = 0
cnt = 0
while switch_st != 2**n:
switch_on = {i + 1 for i in range(n) if switch_st >> i & 1 == 1}
for i in range(m):
switch_cnt = len(switch_on & set(k... | N, M = list(map(int, input().split()))
S = [[int(i) - 1 for i in input().split()] for _ in range(M)]
P = [int(i) for i in input().split()]
ans = 0
for i in range(1 << N):
for j in range(M):
cnt = 0
for s in S[j][1:]:
if i >> s & 1:
cnt += 1
if cnt % 2 != P[j]:
... | false | 25 | [
"-n, m = list(map(int, input().split()))",
"-k = [list(map(int, input().split())) for i in range(m)]",
"-p = list(map(int, input().split()))",
"+N, M = list(map(int, input().split()))",
"+S = [[int(i) - 1 for i in input().split()] for _ in range(M)]",
"+P = [int(i) for i in input().split()]",
"-switch_s... | false | 0.037285 | 0.03504 | 1.064075 | [
"s390543784",
"s489976282"
] |
u475503988 | p03786 | python | s699384729 | s139966331 | 135 | 115 | 14,304 | 14,224 | Accepted | Accepted | 14.81 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
cumA = [0]
for i in range(N):
cumA.append(cumA[-1] + A[i])
ans = 0
if A[0] * 2 >= A[1]:
ans += 1
for i in range(N-1):
if cumA[i+1] * 2 >= A[i+1]:
ans += 1
else:
ans = 1
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans, suma = 1, 0
for i in range(N-1):
suma += A[i]
ans += 1
if suma * 2 < A[i+1]:
ans = 1
print(ans) | 15 | 10 | 288 | 191 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
cumA = [0]
for i in range(N):
cumA.append(cumA[-1] + A[i])
ans = 0
if A[0] * 2 >= A[1]:
ans += 1
for i in range(N - 1):
if cumA[i + 1] * 2 >= A[i + 1]:
ans += 1
else:
ans = 1
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans, suma = 1, 0
for i in range(N - 1):
suma += A[i]
ans += 1
if suma * 2 < A[i + 1]:
ans = 1
print(ans)
| false | 33.333333 | [
"-cumA = [0]",
"-for i in range(N):",
"- cumA.append(cumA[-1] + A[i])",
"-ans = 0",
"-if A[0] * 2 >= A[1]:",
"+ans, suma = 1, 0",
"+for i in range(N - 1):",
"+ suma += A[i]",
"-for i in range(N - 1):",
"- if cumA[i + 1] * 2 >= A[i + 1]:",
"- ans += 1",
"- else:",
"+ if ... | false | 0.046301 | 0.049828 | 0.929228 | [
"s699384729",
"s139966331"
] |
u083960235 | p02777 | python | s770638654 | s151699023 | 57 | 26 | 5,704 | 3,944 | Accepted | Accepted | 54.39 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 35 | 30 | 959 | 891 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 14.285714 | [
"-from fractions import gcd",
"+from heapq import heapify, heappop, heappush",
"-s, t = S_MAP()",
"-a, b = MAP()",
"-u = eval(input())",
"-if s == u and t == u:",
"- # print(a + b - 2)",
"- a = a - 1",
"- b = b - 1",
"-elif s == u:",
"- # print(a + b - 1)",
"- a = a - 1",
"-el... | false | 0.08153 | 0.088798 | 0.918147 | [
"s770638654",
"s151699023"
] |
u785578220 | p03775 | python | s463273504 | s994550419 | 150 | 42 | 9,176 | 9,080 | Accepted | Accepted | 72 | n = int(eval(input()))
def cal(a):
return len(str(a))
m = 11
for j in range(1,10**6+1):
if n%j==0:
m = min(m,max(cal(j),cal(n//j)))
# print(m)
print(m) | n = int(eval(input()))
def cal(a):
return len(str(a))
m = 11
for j in range(1,10**5+1):
if n%j==0:
m = min(m,max(cal(j),cal(n//j)))
# print(m)
print(m) | 10 | 10 | 167 | 167 | n = int(eval(input()))
def cal(a):
return len(str(a))
m = 11
for j in range(1, 10**6 + 1):
if n % j == 0:
m = min(m, max(cal(j), cal(n // j)))
# print(m)
print(m)
| n = int(eval(input()))
def cal(a):
return len(str(a))
m = 11
for j in range(1, 10**5 + 1):
if n % j == 0:
m = min(m, max(cal(j), cal(n // j)))
# print(m)
print(m)
| false | 0 | [
"-for j in range(1, 10**6 + 1):",
"+for j in range(1, 10**5 + 1):"
] | false | 0.646758 | 0.067485 | 9.583683 | [
"s463273504",
"s994550419"
] |
u489959379 | p03069 | python | s628616301 | s469400715 | 560 | 106 | 17,640 | 20,232 | Accepted | Accepted | 81.07 | import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
S = eval(input())
White = np.zeros(n + 1)
Black = np.zeros(n + 1)
for i in range(n):
if S[i] == "#":
Black[i + 1] = Black[i]... | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
s = eval(input())
b = [0] * n
cnt = 0
for i in range(n):
if s[i] == "#":
cnt += 1
b[i] = cnt
w = [0] * n
cnt = 0
for... | 31 | 35 | 619 | 576 | import sys
import numpy as np
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
S = eval(input())
White = np.zeros(n + 1)
Black = np.zeros(n + 1)
for i in range(n):
if S[i] == "#":
Black[i + 1] = Black[i] + 1
else:
... | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
s = eval(input())
b = [0] * n
cnt = 0
for i in range(n):
if s[i] == "#":
cnt += 1
b[i] = cnt
w = [0] * n
cnt = 0
for i in reversed(list(range(... | false | 11.428571 | [
"-import numpy as np",
"- S = eval(input())",
"- White = np.zeros(n + 1)",
"- Black = np.zeros(n + 1)",
"+ s = eval(input())",
"+ b = [0] * n",
"+ cnt = 0",
"- if S[i] == \"#\":",
"- Black[i + 1] = Black[i] + 1",
"- else:",
"- Black[i + 1] = ... | false | 0.26092 | 0.053971 | 4.834481 | [
"s628616301",
"s469400715"
] |
u606045429 | p02888 | python | s774754723 | s865603227 | 1,491 | 753 | 3,188 | 3,188 | Accepted | Accepted | 49.5 | from itertools import accumulate, combinations
N, *L = list(map(int, open(0).read().split()))
A = [0] * (2 * 10 ** 3 + 7)
for l in L:
A[l] += 1
S = list(accumulate(A))
ans = 0
for b, c in combinations(L, 2):
l, r = abs(b - c), b + c
ans += S[r - 1] - S[l] - (l < b < r) - (l < c < r)
prin... | from itertools import accumulate, combinations
def main():
N, *L = list(map(int, open(0).read().split()))
A = [0] * (2 * 10 ** 3 + 7)
for l in L:
A[l] += 1
S = list(accumulate(A))
ans = 0
for b, c in combinations(L, 2):
l, r = c - b if c > b else b - c, b + c
... | 16 | 20 | 326 | 436 | from itertools import accumulate, combinations
N, *L = list(map(int, open(0).read().split()))
A = [0] * (2 * 10**3 + 7)
for l in L:
A[l] += 1
S = list(accumulate(A))
ans = 0
for b, c in combinations(L, 2):
l, r = abs(b - c), b + c
ans += S[r - 1] - S[l] - (l < b < r) - (l < c < r)
print((ans // 3))
| from itertools import accumulate, combinations
def main():
N, *L = list(map(int, open(0).read().split()))
A = [0] * (2 * 10**3 + 7)
for l in L:
A[l] += 1
S = list(accumulate(A))
ans = 0
for b, c in combinations(L, 2):
l, r = c - b if c > b else b - c, b + c
ans += S[r -... | false | 20 | [
"-N, *L = list(map(int, open(0).read().split()))",
"-A = [0] * (2 * 10**3 + 7)",
"-for l in L:",
"- A[l] += 1",
"-S = list(accumulate(A))",
"-ans = 0",
"-for b, c in combinations(L, 2):",
"- l, r = abs(b - c), b + c",
"- ans += S[r - 1] - S[l] - (l < b < r) - (l < c < r)",
"-print((ans //... | false | 0.073825 | 0.101071 | 0.730426 | [
"s774754723",
"s865603227"
] |
u368796742 | p02559 | python | s713620449 | s087185639 | 4,961 | 3,937 | 65,208 | 65,116 | Accepted | Accepted | 20.64 | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0]*(n+1)
def sum(self, i):
# [0, i) の要素の総和を返す
s = 0
while i>0:
s += self.tree[i]
i -= i & -i
return s
# 0 index を 1 index に変更 転倒数を求めるなら1を足していく
def add(self... | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0]*(n+1)
def make(self, list):
self.tree[1:] = list.copy()
for i in range(self.size+1):
j = i + (i & (-i))
if j < self.size+1:
self.tree[j] += self.tree[i]
... | 41 | 47 | 1,022 | 1,210 | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
# [0, i) の要素の総和を返す
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
# 0 index を 1 index に変更 転倒数を求めるなら1を足していく
def add(self, i, x)... | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def make(self, list):
self.tree[1:] = list.copy()
for i in range(self.size + 1):
j = i + (i & (-i))
if j < self.size + 1:
self.tree[j] += self.tree[i]
def sum(s... | false | 12.765957 | [
"+",
"+ def make(self, list):",
"+ self.tree[1:] = list.copy()",
"+ for i in range(self.size + 1):",
"+ j = i + (i & (-i))",
"+ if j < self.size + 1:",
"+ self.tree[j] += self.tree[i]",
"-for i, x in enumerate(a):",
"- bit.add(i, x)",
"+bit.... | false | 0.042032 | 0.037611 | 1.117547 | [
"s713620449",
"s087185639"
] |
u994521204 | p02803 | python | s532127604 | s342493494 | 698 | 273 | 12,152 | 9,484 | Accepted | Accepted | 60.89 | import numpy as np
from collections import deque
h,w=list(map(int,input().split()))
meiro = [list(eval(input())) for i in range(h)]
#meiro[y][x]
def bfs(a,b):#a縦b横
maxdist=0
da=[1,-1,0,0]
db=[0,0,1,-1]
dist=[[-1]*w for i in range(h)]
dist[a][b]=0
stack=deque([(a,b)])
while stack:... | from collections import deque
h, w = list(map(int, input().split()))
meiro = [list(eval(input())) for i in range(h)]
# meiro[y][x]
def bfs(a, b): # a縦b横
mx_dist = 0
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
dist = [[-1] * w for i in range(h)]
dist[a][b] = 0
que = deque([])
que.... | 34 | 37 | 983 | 939 | import numpy as np
from collections import deque
h, w = list(map(int, input().split()))
meiro = [list(eval(input())) for i in range(h)]
# meiro[y][x]
def bfs(a, b): # a縦b横
maxdist = 0
da = [1, -1, 0, 0]
db = [0, 0, 1, -1]
dist = [[-1] * w for i in range(h)]
dist[a][b] = 0
stack = deque([(a, b)... | from collections import deque
h, w = list(map(int, input().split()))
meiro = [list(eval(input())) for i in range(h)]
# meiro[y][x]
def bfs(a, b): # a縦b横
mx_dist = 0
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
dist = [[-1] * w for i in range(h)]
dist[a][b] = 0
que = deque([])
que.append((a, b))
... | false | 8.108108 | [
"-import numpy as np",
"- maxdist = 0",
"- da = [1, -1, 0, 0]",
"- db = [0, 0, 1, -1]",
"+ mx_dist = 0",
"+ dx = [1, 0, -1, 0]",
"+ dy = [0, 1, 0, -1]",
"- stack = deque([(a, b)])",
"- while stack:",
"- y, x = stack.popleft()",
"+ que = deque([])",
"+ que.a... | false | 0.246649 | 0.038169 | 6.462075 | [
"s532127604",
"s342493494"
] |
u753803401 | p03606 | python | s061316548 | s302718615 | 39 | 20 | 15,596 | 2,940 | Accepted | Accepted | 48.72 | import collections
n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]
d = {}
for i in range(len(l)):
for j in range(l[i][0], l[i][1] + 1):
d[j] = 1
print((len(d)))
| n = int(eval(input()))
t = 0
for i in range(n):
l, r = list(map(int, input().split()))
t += (r - l + 1)
print(t)
| 8 | 6 | 203 | 114 | import collections
n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]
d = {}
for i in range(len(l)):
for j in range(l[i][0], l[i][1] + 1):
d[j] = 1
print((len(d)))
| n = int(eval(input()))
t = 0
for i in range(n):
l, r = list(map(int, input().split()))
t += r - l + 1
print(t)
| false | 25 | [
"-import collections",
"-",
"-l = [list(map(int, input().split())) for _ in range(n)]",
"-d = {}",
"-for i in range(len(l)):",
"- for j in range(l[i][0], l[i][1] + 1):",
"- d[j] = 1",
"-print((len(d)))",
"+t = 0",
"+for i in range(n):",
"+ l, r = list(map(int, input().split()))",
... | false | 0.034002 | 0.034652 | 0.981252 | [
"s061316548",
"s302718615"
] |
u857759499 | p03212 | python | s640113337 | s573133321 | 67 | 42 | 10,108 | 3,060 | Accepted | Accepted | 37.31 | import copy
n = int(eval(input()))
ans = 0
for i in range(2,10):
list = ["3","5","7"]
for j in range(i):
dlist = []
for k in list:
for l in ("3","5","7"):
dlist.append(k+l)
list = copy.copy(dlist)
for m in list:
if "3" in m and "5" in m and "7" in m:
if int(m) <= n... | n = int(eval(input()))
ans = 0
def dfs(m):
global ans
if m > n:
return
sm = str(m)
if "3" in sm and "5" in sm and "7" in sm:
ans += 1
dfs(m*10+3)
dfs(m*10+5)
dfs(m*10+7)
dfs(0)
print(ans) | 18 | 14 | 381 | 216 | import copy
n = int(eval(input()))
ans = 0
for i in range(2, 10):
list = ["3", "5", "7"]
for j in range(i):
dlist = []
for k in list:
for l in ("3", "5", "7"):
dlist.append(k + l)
list = copy.copy(dlist)
for m in list:
if "3" in m and "5" in m and... | n = int(eval(input()))
ans = 0
def dfs(m):
global ans
if m > n:
return
sm = str(m)
if "3" in sm and "5" in sm and "7" in sm:
ans += 1
dfs(m * 10 + 3)
dfs(m * 10 + 5)
dfs(m * 10 + 7)
dfs(0)
print(ans)
| false | 22.222222 | [
"-import copy",
"-",
"-for i in range(2, 10):",
"- list = [\"3\", \"5\", \"7\"]",
"- for j in range(i):",
"- dlist = []",
"- for k in list:",
"- for l in (\"3\", \"5\", \"7\"):",
"- dlist.append(k + l)",
"- list = copy.copy(dlist)",
"- for ... | false | 0.11401 | 0.085723 | 1.329977 | [
"s640113337",
"s573133321"
] |
u875291233 | p04003 | python | s057243147 | s303648504 | 1,656 | 742 | 175,664 | 224,612 | Accepted | Accepted | 55.19 | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n,m,*pqc = list(map(int, read().split()))
g = {}
M = iter(pqc)
for p,q,c in zip(M,M,M):
pc = ((p-1)<<20)+c
qc = ((q-1)<<20)+c
pp = (p-1)<<20
qq = (q-1)<<20
if pc not in g: g[pc] ... | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n,m = list(map(int, readline().split()))
g = {}
for _ in range(m):
p,q,c = list(map(int, readline().split()))
pc = ((p-1)<<20)+c
qc = ((q-1)<<20)+c
pp = (p-1)<<20
qq = (q-1)<<20
... | 61 | 61 | 1,169 | 1,189 | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n, m, *pqc = list(map(int, read().split()))
g = {}
M = iter(pqc)
for p, q, c in zip(M, M, M):
pc = ((p - 1) << 20) + c
qc = ((q - 1) << 20) + c
pp = (p - 1) << 20
qq = (q - 1) << 20
if pc not in g:
... | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n, m = list(map(int, readline().split()))
g = {}
for _ in range(m):
p, q, c = list(map(int, readline().split()))
pc = ((p - 1) << 20) + c
qc = ((q - 1) << 20) + c
pp = (p - 1) << 20
qq = (q - 1) << 20
... | false | 0 | [
"-n, m, *pqc = list(map(int, read().split()))",
"+n, m = list(map(int, readline().split()))",
"-M = iter(pqc)",
"-for p, q, c in zip(M, M, M):",
"+for _ in range(m):",
"+ p, q, c = list(map(int, readline().split()))"
] | false | 0.043193 | 0.042447 | 1.017581 | [
"s057243147",
"s303648504"
] |
u764773675 | p03494 | python | s276176293 | s400015998 | 21 | 18 | 2,940 | 2,940 | Accepted | Accepted | 14.29 | # coding: utf-8
# Your code here!
num_len = int(eval(input()))
num_list = list(map(int, input().split(" ")))
#print(num_list)
count = 0
while all(i % 2 == 0 for i in num_list):
num_list =[j // 2 for j in num_list]
count += 1
print(count)
| # coding: utf-8
# Your code here!
num = int(eval(input()))
s = list(map(int,input().split()))
count = 0
while all (i % 2 == 0 for i in s):
s = [i // 2 for i in s]
count += 1
print(count)
| 13 | 14 | 262 | 214 | # coding: utf-8
# Your code here!
num_len = int(eval(input()))
num_list = list(map(int, input().split(" ")))
# print(num_list)
count = 0
while all(i % 2 == 0 for i in num_list):
num_list = [j // 2 for j in num_list]
count += 1
print(count)
| # coding: utf-8
# Your code here!
num = int(eval(input()))
s = list(map(int, input().split()))
count = 0
while all(i % 2 == 0 for i in s):
s = [i // 2 for i in s]
count += 1
print(count)
| false | 7.142857 | [
"-num_len = int(eval(input()))",
"-num_list = list(map(int, input().split(\" \")))",
"-# print(num_list)",
"+num = int(eval(input()))",
"+s = list(map(int, input().split()))",
"-while all(i % 2 == 0 for i in num_list):",
"- num_list = [j // 2 for j in num_list]",
"+while all(i % 2 == 0 for i in s):... | false | 0.038412 | 0.035361 | 1.086276 | [
"s276176293",
"s400015998"
] |
u263830634 | p02995 | python | s394092038 | s516408196 | 55 | 36 | 5,560 | 5,040 | Accepted | Accepted | 34.55 | import fractions
A, B, C, D = list(map(int, input().split()))
b = B//C + B//D - B//((C*D)//fractions.gcd(C, D))
A -= 1
a = A//C + A//D - A//((C*D)//fractions.gcd(C, D))
# print (a, b)
print(((B-b) - (A - a))) | import math,fractions
a=list(map(int,input().split()))
A=a[1]-a[0]+1 #もともとのAとBの間の数
B=(a[1]//a[2])-((a[0]-1)//a[2]) #Bの中のCの倍数-Aの中のCの倍数
C=(a[1]//a[3])-((a[0]-1)//a[3]) #Bの中のDの倍数-Aの中のDの倍数
d=a[2]*a[3]//fractions.gcd(a[2],a[3]) #CとDの最小公倍数
D=(a[1]//d)-((a[0]-1)//d) #Bの中の最小公倍数の倍数-Aの中の最小公倍数の倍数
print((A-B-C+D))
| 10 | 8 | 213 | 309 | import fractions
A, B, C, D = list(map(int, input().split()))
b = B // C + B // D - B // ((C * D) // fractions.gcd(C, D))
A -= 1
a = A // C + A // D - A // ((C * D) // fractions.gcd(C, D))
# print (a, b)
print(((B - b) - (A - a)))
| import math, fractions
a = list(map(int, input().split()))
A = a[1] - a[0] + 1 # もともとのAとBの間の数
B = (a[1] // a[2]) - ((a[0] - 1) // a[2]) # Bの中のCの倍数-Aの中のCの倍数
C = (a[1] // a[3]) - ((a[0] - 1) // a[3]) # Bの中のDの倍数-Aの中のDの倍数
d = a[2] * a[3] // fractions.gcd(a[2], a[3]) # CとDの最小公倍数
D = (a[1] // d) - ((a[0] - 1) // d) # B... | false | 20 | [
"-import fractions",
"+import math, fractions",
"-A, B, C, D = list(map(int, input().split()))",
"-b = B // C + B // D - B // ((C * D) // fractions.gcd(C, D))",
"-A -= 1",
"-a = A // C + A // D - A // ((C * D) // fractions.gcd(C, D))",
"-# print (a, b)",
"-print(((B - b) - (A - a)))",
"+a = list(map... | false | 0.057238 | 0.08891 | 0.64378 | [
"s394092038",
"s516408196"
] |
u729133443 | p03273 | python | s395872638 | s877844301 | 21 | 17 | 4,468 | 3,060 | Accepted | Accepted | 19.05 | f=lambda s:zip(*[t for t in s if'#'in t])
for r in f(f(open(0).readlines())):print(*r,sep='')
| f=lambda s:list(zip(*[t for t in s if'#'in t]));print((*list(map(''.join,f(f(open(0).readlines())))))) | 2 | 1 | 94 | 88 | f = lambda s: zip(*[t for t in s if "#" in t])
for r in f(f(open(0).readlines())):
print(*r, sep="")
| f = lambda s: list(zip(*[t for t in s if "#" in t]))
print((*list(map("".join, f(f(open(0).readlines()))))))
| false | 50 | [
"-f = lambda s: zip(*[t for t in s if \"#\" in t])",
"-for r in f(f(open(0).readlines())):",
"- print(*r, sep=\"\")",
"+f = lambda s: list(zip(*[t for t in s if \"#\" in t]))",
"+print((*list(map(\"\".join, f(f(open(0).readlines()))))))"
] | false | 0.057856 | 0.036618 | 1.58 | [
"s395872638",
"s877844301"
] |
u785989355 | p03546 | python | s999855035 | s131928701 | 51 | 38 | 4,208 | 3,444 | Accepted | Accepted | 25.49 |
import queue
from heapq import heappush, heappop
class Graph:
INF = float('inf')
def __init__(self,v_num,is_directed = False):
self.is_directed = is_directed
self.v_num = v_num
self.E = []
self.v_s_list = [[] for i in range(self.v_num)]
def appe... | H,W = list(map(int,input().split()))
e_list = [[] for i in range(10)]
for i in range(10):
c = list(map(int,input().split()))
for j in range(10):
if i!=j:
e_list[i].append([j,c[j]])
A = [list(map(int,input().split())) for i in range(H)]
#dijkstra
#you need to prepare e_list = [... | 126 | 43 | 4,042 | 1,015 | import queue
from heapq import heappush, heappop
class Graph:
INF = float("inf")
def __init__(self, v_num, is_directed=False):
self.is_directed = is_directed
self.v_num = v_num
self.E = []
self.v_s_list = [[] for i in range(self.v_num)]
def appendEdge(self, v1, v2, weight... | H, W = list(map(int, input().split()))
e_list = [[] for i in range(10)]
for i in range(10):
c = list(map(int, input().split()))
for j in range(10):
if i != j:
e_list[i].append([j, c[j]])
A = [list(map(int, input().split())) for i in range(H)]
# dijkstra
# you need to prepare e_list = [[orien... | false | 65.873016 | [
"-import queue",
"-from heapq import heappush, heappop",
"-",
"-",
"-class Graph:",
"- INF = float(\"inf\")",
"-",
"- def __init__(self, v_num, is_directed=False):",
"- self.is_directed = is_directed",
"- self.v_num = v_num",
"- self.E = []",
"- self.v_s_list ... | false | 0.043945 | 0.038299 | 1.14741 | [
"s999855035",
"s131928701"
] |
u562016607 | p02782 | python | s800935705 | s827621574 | 1,169 | 807 | 82,200 | 82,200 | Accepted | Accepted | 30.97 | #f(r,c)=(r+c)_C_r
r1,c1,r2,c2=list(map(int,input().split()))
mod=10**9+7
N=2*(10**6)+10
def inv(x):
return pow(x,mod-2,mod)
Fact=[0 for i in range(N+1)]
Fact[0]=1;
for i in range(N):
Fact[i+1]=(i+1)*Fact[i]
Fact[i+1]%=mod
def C(n,k):
res=Fact[n]*inv(Fact[n-k])
res%=mod
res*=inv(Fac... | r1,c1,r2,c2=list(map(int,input().split()));mod=10**9+7;N=2000010
def inv(x):return pow(x,mod-2,mod)
Fact=[0 for i in range(N+1)];Fact[0]=1
for i in range(N):Fact[i+1]=((i+1)*Fact[i])%mod
def f(r,c):return (Fact[r+c]*inv(Fact[r])*inv(Fact[c]))%mod
print(((f(r2+1,c2+1)-f(r2+1,c1)-f(r1,c2+1)+f(r1,c1))%mod)) | 26 | 6 | 610 | 302 | # f(r,c)=(r+c)_C_r
r1, c1, r2, c2 = list(map(int, input().split()))
mod = 10**9 + 7
N = 2 * (10**6) + 10
def inv(x):
return pow(x, mod - 2, mod)
Fact = [0 for i in range(N + 1)]
Fact[0] = 1
for i in range(N):
Fact[i + 1] = (i + 1) * Fact[i]
Fact[i + 1] %= mod
def C(n, k):
res = Fact[n] * inv(Fact[... | r1, c1, r2, c2 = list(map(int, input().split()))
mod = 10**9 + 7
N = 2000010
def inv(x):
return pow(x, mod - 2, mod)
Fact = [0 for i in range(N + 1)]
Fact[0] = 1
for i in range(N):
Fact[i + 1] = ((i + 1) * Fact[i]) % mod
def f(r, c):
return (Fact[r + c] * inv(Fact[r]) * inv(Fact[c])) % mod
print(((f... | false | 76.923077 | [
"-# f(r,c)=(r+c)_C_r",
"-N = 2 * (10**6) + 10",
"+N = 2000010",
"- Fact[i + 1] = (i + 1) * Fact[i]",
"- Fact[i + 1] %= mod",
"+ Fact[i + 1] = ((i + 1) * Fact[i]) % mod",
"-def C(n, k):",
"- res = Fact[n] * inv(Fact[n - k])",
"- res %= mod",
"- res *= inv(Fact[k])",
"- res %=... | false | 1.059252 | 3.434724 | 0.308395 | [
"s800935705",
"s827621574"
] |
u631277801 | p03829 | python | s915862367 | s265437103 | 135 | 99 | 14,628 | 14,340 | Accepted | Accepted | 26.67 | from collections import deque
N,A,B = list(map(int, input().split()))
X = list(map(int, input().split()))
INF = float("inf")
dist = deque(X)
next_x = +1
i = 0
ans = 0
while len(dist) != 1:
if A*abs(dist[i+next_x] - dist[i]) <= B:
ans += A*abs(dist[i+next_x] - dist[i])
if next_x ... | # 入力
import sys
stdin = sys.stdin
def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc... | 34 | 25 | 661 | 580 | from collections import deque
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
INF = float("inf")
dist = deque(X)
next_x = +1
i = 0
ans = 0
while len(dist) != 1:
if A * abs(dist[i + next_x] - dist[i]) <= B:
ans += A * abs(dist[i + next_x] - dist[i])
if next_x == 1:
... | # 入力
import sys
stdin = sys.stdin
def li():
return [int(x) for x in stdin.readline().split()]
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return [float(x) for x in stdin.readline().split()]
def ls():
return stdin.readline().split()
def ns():
return stdin.rea... | false | 26.470588 | [
"-from collections import deque",
"+# 入力",
"+import sys",
"-N, A, B = list(map(int, input().split()))",
"-X = list(map(int, input().split()))",
"-INF = float(\"inf\")",
"-dist = deque(X)",
"-next_x = +1",
"-i = 0",
"+stdin = sys.stdin",
"+",
"+",
"+def li():",
"+ return [int(x) for x in... | false | 0.037025 | 0.077253 | 0.479268 | [
"s915862367",
"s265437103"
] |
u347640436 | p03557 | python | s150404927 | s165019864 | 367 | 317 | 24,308 | 22,720 | Accepted | Accepted | 13.62 | # 累積和
from bisect import bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
for x in [A, B, C]:
x.sort()
t = [0] * (N + 1) # 中部のパーツのサイズが Bi 以上のときの B と C の組み合わせの数
j = 0
for i in range(N):
while j < N an... | # 二分探索
from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
for x in [A, B, C]:
x.sort()
result = 0
for b in B:
a = bisect_left(A, b)
c = N - bisect_right(C, b)
re... | 27 | 17 | 535 | 343 | # 累積和
from bisect import bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
for x in [A, B, C]:
x.sort()
t = [0] * (N + 1) # 中部のパーツのサイズが Bi 以上のときの B と C の組み合わせの数
j = 0
for i in range(N):
while j < N and C[j] <= B[i]:
... | # 二分探索
from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
for x in [A, B, C]:
x.sort()
result = 0
for b in B:
a = bisect_left(A, b)
c = N - bisect_right(C, b)
result += a * c
pri... | false | 37.037037 | [
"-# 累積和",
"-from bisect import bisect_right",
"+# 二分探索",
"+from bisect import bisect_left, bisect_right",
"-t = [0] * (N + 1) # 中部のパーツのサイズが Bi 以上のときの B と C の組み合わせの数",
"-j = 0",
"-for i in range(N):",
"- while j < N and C[j] <= B[i]:",
"- j += 1",
"- t[i] = N - j",
"-for i in range(... | false | 0.047659 | 0.045399 | 1.049784 | [
"s150404927",
"s165019864"
] |
u638456847 | p03546 | python | s600600566 | s371836761 | 35 | 29 | 3,828 | 3,316 | Accepted | Accepted | 17.14 | import copy
def main():
H,W = list(map(int, input().split()))
c = [[int(i) for i in input().split()] for i in range(10)]
a = [[int(i) for i in input().split()] for i in range(H)]
#d = copy.deepcopy(c)
# ワーシャルフロイド法
for k in range(10):
for i in range(10):
for j in ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
H,W = list(map(int, readline().split()))
C = [[int(i) for i in readline().split()] for _ in range(10)]
A = [[int(i) for i in readline().split()] for _ in range(H)]
# 頂点kを経由する場合としない場合を比較... | 25 | 27 | 572 | 648 | import copy
def main():
H, W = list(map(int, input().split()))
c = [[int(i) for i in input().split()] for i in range(10)]
a = [[int(i) for i in input().split()] for i in range(H)]
# d = copy.deepcopy(c)
# ワーシャルフロイド法
for k in range(10):
for i in range(10):
for j in range(10)... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
H, W = list(map(int, readline().split()))
C = [[int(i) for i in readline().split()] for _ in range(10)]
A = [[int(i) for i in readline().split()] for _ in range(H)]
# 頂点kを経由する場合としない場合を比較
for... | false | 7.407407 | [
"-import copy",
"+import sys",
"+",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"- H, W = list(map(int, input().split()))",
"- c = [[int(i) for i in input().split()] for i in range(10)]",
"- a = [[int(i) for i in input().split()] for i in ... | false | 0.035803 | 0.038792 | 0.922954 | [
"s600600566",
"s371836761"
] |
u190086340 | p03854 | python | s487524594 | s913426178 | 262 | 190 | 58,480 | 40,432 | Accepted | Accepted | 27.48 | import sys
sys.setrecursionlimit(10 ** 6)
def solve():
S = eval(input())
# print(S, len(S))
S = S[::-1]
words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])
def recur(i):
if i >= len(S):
return True
for word in words:
if S... | def solve():
S = eval(input())
# print(S, len(S))
S = S[::-1]
words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])
i = 0
while True:
can = False
for word in words:
if S[i:i + len(word)] == word:
i += len(word)
... | 31 | 28 | 596 | 557 | import sys
sys.setrecursionlimit(10**6)
def solve():
S = eval(input())
# print(S, len(S))
S = S[::-1]
words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])
def recur(i):
if i >= len(S):
return True
for word in words:
if S[i : i + len(word... | def solve():
S = eval(input())
# print(S, len(S))
S = S[::-1]
words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])
i = 0
while True:
can = False
for word in words:
if S[i : i + len(word)] == word:
i += len(word)
can =... | false | 9.677419 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-",
"- def recur(i):",
"- if i >= len(S):",
"- return True",
"+ i = 0",
"+ while True:",
"+ can = False",
"- if recur(i + len(word)):",
"- return True",
"- ... | false | 0.037765 | 0.057509 | 0.656688 | [
"s487524594",
"s913426178"
] |
u193264896 | p03998 | python | s884729593 | s219429911 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | import sys
from collections import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
SA = readline().decode('utf-8').strip()
SB = readline().decode('utf-8').strip()
SC = readline().decode('utf-8')
A = deque(SA)
B =... | import sys
from _collections import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
SA = readline().decode('utf-8').strip()
SB = readline().decode('utf-8').strip()
SC = readline().decode('utf-8').strip()
A = deque(S... | 36 | 38 | 817 | 887 | import sys
from collections import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
SA = readline().decode("utf-8").strip()
SB = readline().decode("utf-8").strip()
SC = readline().decode("utf-8")
A = deque(SA)
B = deque(SB)
... | import sys
from _collections import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
SA = readline().decode("utf-8").strip()
SB = readline().decode("utf-8").strip()
SC = readline().decode("utf-8").strip()
A = deque(SA)
B = dequ... | false | 5.263158 | [
"-from collections import deque",
"+from _collections import deque",
"- SC = readline().decode(\"utf-8\")",
"+ SC = readline().decode(\"utf-8\").strip()",
"- next = A.popleft()",
"+ now = A.popleft()",
"- if next == \"a\":",
"+ if now == \"a\":",
"- next = A.popl... | false | 0.044266 | 0.042549 | 1.040347 | [
"s884729593",
"s219429911"
] |
u579699847 | p02844 | python | s678872531 | s469434779 | 771 | 22 | 3,188 | 3,188 | Accepted | Accepted | 97.15 | def I(): return int(eval(input()))
def S(): return eval(input())
N = I()
S = S()
s1,s2,s3 = set(),set(),set()
for x in S:
for z in s2:
s3.add(z+x)
for y in s1:
s2.add(y+x)
s1.add(x)
print((len(s3)))
| def I(): return int(eval(input()))
def S(): return eval(input())
N = I()
S = S()
ans = 0
for i in range(1000):
z = str(i).zfill(3)
if S.find(z[0])==-1:
continue
S1 = S[S.find(z[0])+1:]
if S1.find(z[1])==-1:
continue
S2 = S1[S1.find(z[1])+1:]
if S2.find(z[2])==-1:
... | 12 | 17 | 224 | 348 | def I():
return int(eval(input()))
def S():
return eval(input())
N = I()
S = S()
s1, s2, s3 = set(), set(), set()
for x in S:
for z in s2:
s3.add(z + x)
for y in s1:
s2.add(y + x)
s1.add(x)
print((len(s3)))
| def I():
return int(eval(input()))
def S():
return eval(input())
N = I()
S = S()
ans = 0
for i in range(1000):
z = str(i).zfill(3)
if S.find(z[0]) == -1:
continue
S1 = S[S.find(z[0]) + 1 :]
if S1.find(z[1]) == -1:
continue
S2 = S1[S1.find(z[1]) + 1 :]
if S2.find(z[2])... | false | 29.411765 | [
"-s1, s2, s3 = set(), set(), set()",
"-for x in S:",
"- for z in s2:",
"- s3.add(z + x)",
"- for y in s1:",
"- s2.add(y + x)",
"- s1.add(x)",
"-print((len(s3)))",
"+ans = 0",
"+for i in range(1000):",
"+ z = str(i).zfill(3)",
"+ if S.find(z[0]) == -1:",
"+ ... | false | 0.093331 | 0.03393 | 2.750723 | [
"s678872531",
"s469434779"
] |
u186838327 | p03253 | python | s407648331 | s251357060 | 1,994 | 214 | 115,036 | 80,880 | Accepted | Accepted | 89.27 | import math
def div(m):
d = {}
temp = int(math.sqrt(m))+1
for i in range(2, temp):
while m%i== 0:
m //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[m] = 1
else:
if m in d:
d[m] += 1
elif m != 1:
d[m] =1
return d
n,... | import math
def factorize(n):
d = {}
temp = int(math.sqrt(n))+1
for i in range(2, temp):
while n%i== 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
... | 35 | 50 | 650 | 969 | import math
def div(m):
d = {}
temp = int(math.sqrt(m)) + 1
for i in range(2, temp):
while m % i == 0:
m //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[m] = 1
else:
if m in d:
d[m] += 1... | import math
def factorize(n):
d = {}
temp = int(math.sqrt(n)) + 1
for i in range(2, temp):
while n % i == 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
d[n... | false | 30 | [
"-def div(m):",
"+def factorize(n):",
"- temp = int(math.sqrt(m)) + 1",
"+ temp = int(math.sqrt(n)) + 1",
"- while m % i == 0:",
"- m //= i",
"+ while n % i == 0:",
"+ n //= i",
"- d[m] = 1",
"+ d[n] = 1",
"- if m in d:",
"- ... | false | 0.776834 | 1.864213 | 0.416709 | [
"s407648331",
"s251357060"
] |
u561083515 | p03449 | python | s724762902 | s134066315 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | N = int(eval(input()))
A = [[int(i) for i in input().split()] for _ in range(2)]
# dpj[i]: (i,j)でアメの最大値
dp1 = [0] * N
dp2 = [0] * N
# 初期条件
dp1[0] = A[0][0]
dp2[0] = A[0][0] + A[1][0]
# 貰うdp
for i in range(1,N):
dp1[i] = dp1[i-1] + A[0][i]
for i in range(1,N):
dp2[i] = max(dp1[i], dp2[i-1]) +... | N = int(eval(input()))
A = [[0] + [int(i) for i in input().split()] for _ in range(2)]
for i in range(N):
A[0][i+1] += A[0][i]
A[1][i+1] += A[1][i]
ans = 0
for i in range(1,N+1):
ans = max(ans, A[0][i] + (A[1][-1] -A[1][i-1]))
print(ans) | 19 | 12 | 340 | 257 | N = int(eval(input()))
A = [[int(i) for i in input().split()] for _ in range(2)]
# dpj[i]: (i,j)でアメの最大値
dp1 = [0] * N
dp2 = [0] * N
# 初期条件
dp1[0] = A[0][0]
dp2[0] = A[0][0] + A[1][0]
# 貰うdp
for i in range(1, N):
dp1[i] = dp1[i - 1] + A[0][i]
for i in range(1, N):
dp2[i] = max(dp1[i], dp2[i - 1]) + A[1][i]
print... | N = int(eval(input()))
A = [[0] + [int(i) for i in input().split()] for _ in range(2)]
for i in range(N):
A[0][i + 1] += A[0][i]
A[1][i + 1] += A[1][i]
ans = 0
for i in range(1, N + 1):
ans = max(ans, A[0][i] + (A[1][-1] - A[1][i - 1]))
print(ans)
| false | 36.842105 | [
"-A = [[int(i) for i in input().split()] for _ in range(2)]",
"-# dpj[i]: (i,j)でアメの最大値",
"-dp1 = [0] * N",
"-dp2 = [0] * N",
"-# 初期条件",
"-dp1[0] = A[0][0]",
"-dp2[0] = A[0][0] + A[1][0]",
"-# 貰うdp",
"-for i in range(1, N):",
"- dp1[i] = dp1[i - 1] + A[0][i]",
"-for i in range(1, N):",
"- ... | false | 0.051233 | 0.051272 | 0.999238 | [
"s724762902",
"s134066315"
] |
u498487134 | p02990 | python | s527132438 | s836182031 | 213 | 84 | 42,864 | 74,588 | Accepted | Accepted | 60.56 | N,K=list(map(int,input().split()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return (fact[n] * factinv[r] * factinv[n-r]) % p
p=10**9 + 7
fact=[1, 1]
factinv=[1, 1]
inv=[0, 1]
for i in range(2, N + 1):
fact.append((fact[-1] * i) % p)
inv.append((-... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,K=MI()
#0~Nまで逆元などを事前計算
def cmb(n, r, mod):
if (r < 0) or (n < r):
retu... | 21 | 35 | 460 | 788 | N, K = list(map(int, input().split()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return (fact[n] * factinv[r] * factinv[n - r]) % p
p = 10**9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
fact.append((fact[-1] * i) % p)
inv.append((-i... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, K = MI()
# 0~Nまで逆元などを事前計算
def cmb(n, r, mod):
if (r < 0) or (n < r):
... | false | 40 | [
"-N, K = list(map(int, input().split()))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-def cmb(n, r, p):",
"- if (r < 0) or (n < r):",
"- return 0",
"- r = min(r, n - r)",
"- return (fact[n] * factinv[r] * factinv[n - r]) % p",
"+def I():",
"+ return int(eval(input())... | false | 0.059824 | 0.089425 | 0.668989 | [
"s527132438",
"s836182031"
] |
u784022244 | p02735 | python | s872942145 | s083275900 | 89 | 80 | 74,348 | 74,592 | Accepted | Accepted | 10.11 | H,W=list(map(int, input().split()))
S=[]
for i in range(H):
s=list(eval(input()))
S.append(s)
nowblack=False
dp=[[float("INF")]*W for _ in range(H)]
if S[0][0]=="#":
dp[0][0]=1
else:
dp[0][0]=0
for h in range(H):
for w in range(W):
if 0<=h-1<H:
if S[h][w]==".":
... | H, W=list(map(int, input().split()))
S=[]
from math import ceil
for h in range(H):
s=list(eval(input()))
S.append(s)
dp = [[float("INF")]*W for _ in range(H)]
if S[0][0]=="#":
dp[0][0]=1
else:
dp[0][0]=0
for h in range(H):
for w in range(W):
if w==0 and h==0:
... | 35 | 42 | 884 | 999 | H, W = list(map(int, input().split()))
S = []
for i in range(H):
s = list(eval(input()))
S.append(s)
nowblack = False
dp = [[float("INF")] * W for _ in range(H)]
if S[0][0] == "#":
dp[0][0] = 1
else:
dp[0][0] = 0
for h in range(H):
for w in range(W):
if 0 <= h - 1 < H:
if S[h][w]... | H, W = list(map(int, input().split()))
S = []
from math import ceil
for h in range(H):
s = list(eval(input()))
S.append(s)
dp = [[float("INF")] * W for _ in range(H)]
if S[0][0] == "#":
dp[0][0] = 1
else:
dp[0][0] = 0
for h in range(H):
for w in range(W):
if w == 0 and h == 0:
c... | false | 16.666667 | [
"-for i in range(H):",
"+from math import ceil",
"+",
"+for h in range(H):",
"-nowblack = False",
"- if 0 <= h - 1 < H:",
"- if S[h][w] == \".\":",
"- dp[h][w] = min(dp[h][w], dp[h - 1][w])",
"+ if w == 0 and h == 0:",
"+ continue",
"+ if... | false | 0.079803 | 0.039383 | 2.026308 | [
"s872942145",
"s083275900"
] |
u179169725 | p02726 | python | s693304372 | s305745705 | 1,921 | 1,715 | 46,344 | 78,844 | Accepted | Accepted | 10.72 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
'''
H is number of rows
'''
ret = []
for _ in range(H):
ret.append(tuple(map(int... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
'''
H is number of rows
'''
ret = []
for _ in range(H):
ret.append(tuple(map(int... | 103 | 105 | 2,208 | 2,246 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
"""
H is number of rows
"""
ret = []
for _ in range(H):
ret.append(tuple(map(int, read().split()))... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
"""
H is number of rows
"""
ret = []
for _ in range(H):
ret.append(tuple(map(int, read().split()))... | false | 1.904762 | [
"-from scipy.sparse import (",
"- csr_matrix,",
"- lil_matrix,",
"-) # 自分で配列を作ってからcsrに入れよう(lilに打ち込んでいくのは非常に遅い)",
"+from scipy.sparse import csr_matrix # 自分で配列を作ってからcsrに入れよう(lilに打ち込んでいくのは非常に遅い)",
"-graph = lil_matrix((N, N))",
"+graph = [[0] * N for _ in range(N)]",
"- graph[i, i + 1] = 1",
... | false | 0.335219 | 0.328536 | 1.020341 | [
"s693304372",
"s305745705"
] |
u508732591 | p02314 | python | s981354430 | s667060909 | 550 | 380 | 7,640 | 7,512 | Accepted | Accepted | 30.91 | n = int(input().split()[0])
c = list(map(int,input().split()))
dp = [ i for i in range(n+1) ]
for i in range(2,n+1):
c2 = [n for n in c if n<=i]
for j in c2:
if j <= i and dp[i-j] + 1 < dp[i]:
dp[i] = dp[i-j] + 1
print((dp[n])) | n = int(input().split()[0])
c = list(map(int,input().split()))
dp = list(range(n+1))
for i in range(2,n+1):
for j in c:
if j <= i and dp[i-j] + 1 < dp[i]:
dp[i] = dp[i-j]+1
print((dp[n])) | 11 | 10 | 266 | 220 | n = int(input().split()[0])
c = list(map(int, input().split()))
dp = [i for i in range(n + 1)]
for i in range(2, n + 1):
c2 = [n for n in c if n <= i]
for j in c2:
if j <= i and dp[i - j] + 1 < dp[i]:
dp[i] = dp[i - j] + 1
print((dp[n]))
| n = int(input().split()[0])
c = list(map(int, input().split()))
dp = list(range(n + 1))
for i in range(2, n + 1):
for j in c:
if j <= i and dp[i - j] + 1 < dp[i]:
dp[i] = dp[i - j] + 1
print((dp[n]))
| false | 9.090909 | [
"-dp = [i for i in range(n + 1)]",
"+dp = list(range(n + 1))",
"- c2 = [n for n in c if n <= i]",
"- for j in c2:",
"+ for j in c:"
] | false | 0.057369 | 0.120395 | 0.47651 | [
"s981354430",
"s667060909"
] |
u644778646 | p04000 | python | s819637959 | s607633510 | 1,521 | 1,406 | 159,348 | 181,592 | Accepted | Accepted | 7.56 | H,W,N = list(map(int,input().split()))
from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)
for i in range(N):
a,b = list(map(int,input().split()))
t[(a-1,b-1)] = 1
for p in [-1,0,1]:
for q in [-1,0,1]:
if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
... | H,W,N = list(map(int,input().split()))
from collections import defaultdict
L = defaultdict(int)
for i in range(N):
a,b = list(map(int,input().split()))
for p in [-1,0,1]:
for q in [-1,0,1]:
if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
continue
L[(a+... | 21 | 20 | 496 | 467 | H, W, N = list(map(int, input().split()))
from collections import defaultdict
t = defaultdict(int)
L = defaultdict(int)
for i in range(N):
a, b = list(map(int, input().split()))
t[(a - 1, b - 1)] = 1
for p in [-1, 0, 1]:
for q in [-1, 0, 1]:
if a + p < 2 or b + q < 2 or a + p > H - 1 or... | H, W, N = list(map(int, input().split()))
from collections import defaultdict
L = defaultdict(int)
for i in range(N):
a, b = list(map(int, input().split()))
for p in [-1, 0, 1]:
for q in [-1, 0, 1]:
if a + p < 2 or b + q < 2 or a + p > H - 1 or b + q > W - 1:
continue
... | false | 4.761905 | [
"-t = defaultdict(int)",
"- t[(a - 1, b - 1)] = 1"
] | false | 0.049097 | 0.043633 | 1.12522 | [
"s819637959",
"s607633510"
] |
u143492911 | p03779 | python | s829344877 | s110437765 | 28 | 18 | 2,940 | 3,064 | Accepted | Accepted | 35.71 | n=int(eval(input()))
count,add=0,0
while True:
if n<=count:
break
add+=1
count+=add
print(add) | x=int(eval(input()))
import math
print((math.ceil((-1+math.sqrt(1+8*x))/2))) | 8 | 3 | 115 | 70 | n = int(eval(input()))
count, add = 0, 0
while True:
if n <= count:
break
add += 1
count += add
print(add)
| x = int(eval(input()))
import math
print((math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2)))
| false | 62.5 | [
"-n = int(eval(input()))",
"-count, add = 0, 0",
"-while True:",
"- if n <= count:",
"- break",
"- add += 1",
"- count += add",
"-print(add)",
"+x = int(eval(input()))",
"+import math",
"+",
"+print((math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2)))"
] | false | 0.03679 | 0.041774 | 0.880681 | [
"s829344877",
"s110437765"
] |
u340781749 | p03065 | python | s566777924 | s501064505 | 1,943 | 62 | 6,156 | 6,008 | Accepted | Accepted | 96.81 | import sys
from fractions import gcd
def eratosthenes_generator():
yield 2
n = 3
h = {}
while True:
m = n
if n in h:
b = h[n]
del h[n]
else:
b = n
yield n
m += b << 1
while m in h:
m +... | import sys
from fractions import gcd
def eratosthenes_generator():
yield 2
n = 3
h = {}
while True:
m = n
if n in h:
b = h[n]
del h[n]
else:
b = n
yield n
m += b << 1
while m in h:
m +... | 64 | 61 | 1,274 | 1,203 | import sys
from fractions import gcd
def eratosthenes_generator():
yield 2
n = 3
h = {}
while True:
m = n
if n in h:
b = h[n]
del h[n]
else:
b = n
yield n
m += b << 1
while m in h:
m += b << 1
h... | import sys
from fractions import gcd
def eratosthenes_generator():
yield 2
n = 3
h = {}
while True:
m = n
if n in h:
b = h[n]
del h[n]
else:
b = n
yield n
m += b << 1
while m in h:
m += b << 1
h... | false | 4.6875 | [
"- tmp = [0] * q",
"- for i, a in enumerate(aaa):",
"- tmp[i % q] += a",
"- if all(t % p == 0 for t in tmp):",
"+ if all(sum(aaa[i::q]) % p == 0 for i in range(q)):"
] | false | 0.105691 | 0.046748 | 2.26086 | [
"s566777924",
"s501064505"
] |
u919633157 | p03681 | python | s001358536 | s221266031 | 443 | 54 | 4,092 | 3,064 | Accepted | Accepted | 87.81 | # 2019/08/08
from math import factorial
n,m=list(map(int,input().split()))
diff=abs(n-m)
if diff>1:ans=0
elif diff==0:
res=factorial(n)
ans=2*res%(10**9+7)*res%(10**9+7)
else:
ans=factorial(n)%(10**9+7)*factorial(m)%(10**9+7)
print(ans) | # 2019/08/08
# 高速改良版
def mod(n):
return n%(10**9+7)
def fac(n):
res=1
for i in range(1,n+1):
res=mod(res*i)
return res
n,m=list(map(int,input().split()))
diff=abs(n-m)
if diff>1:ans=0
elif diff==0:
ans=mod(2*fac(n)*fac(m))
else:
ans=mod(fac(n)*fac(m))
print(ans) | 13 | 20 | 256 | 310 | # 2019/08/08
from math import factorial
n, m = list(map(int, input().split()))
diff = abs(n - m)
if diff > 1:
ans = 0
elif diff == 0:
res = factorial(n)
ans = 2 * res % (10**9 + 7) * res % (10**9 + 7)
else:
ans = factorial(n) % (10**9 + 7) * factorial(m) % (10**9 + 7)
print(ans)
| # 2019/08/08
# 高速改良版
def mod(n):
return n % (10**9 + 7)
def fac(n):
res = 1
for i in range(1, n + 1):
res = mod(res * i)
return res
n, m = list(map(int, input().split()))
diff = abs(n - m)
if diff > 1:
ans = 0
elif diff == 0:
ans = mod(2 * fac(n) * fac(m))
else:
ans = mod(fac(n) ... | false | 35 | [
"-from math import factorial",
"+# 高速改良版",
"+def mod(n):",
"+ return n % (10**9 + 7)",
"+",
"+",
"+def fac(n):",
"+ res = 1",
"+ for i in range(1, n + 1):",
"+ res = mod(res * i)",
"+ return res",
"+",
"- res = factorial(n)",
"- ans = 2 * res % (10**9 + 7) * res % ... | false | 0.039629 | 0.031661 | 1.251655 | [
"s001358536",
"s221266031"
] |
u150984829 | p02270 | python | s121334770 | s589455838 | 840 | 210 | 15,828 | 15,832 | Accepted | Accepted | 75 | import sys
n,k=list(map(int,input().split()))
w=list(map(int,sys.stdin.readlines()))
def f():
i=0
for _ in[0]*k:
s=0
while s+w[i]<=m:
s+=w[i];i+=1
if i==n:return n
return i
l,r=max(w),sum(w)
while l<r:
m=(l+r)//2
if f()>=n:r=m
else:l=m+1
print(r)
| import sys
def s():
n,k=list(map(int,input().split()))
w=list(map(int,sys.stdin.readlines()))
def f():
c=t=0
for j in w:
t+=j
if t>m:
t=j
c+=1
if c>=k:return 0
return 1
l,r=max(w),sum(w)
while l<r:
m=(l+r)//2
if f():r=m
else:l=m+1
print(r)
if'__main__'==__name__:s(... | 17 | 20 | 273 | 316 | import sys
n, k = list(map(int, input().split()))
w = list(map(int, sys.stdin.readlines()))
def f():
i = 0
for _ in [0] * k:
s = 0
while s + w[i] <= m:
s += w[i]
i += 1
if i == n:
return n
return i
l, r = max(w), sum(w)
while l < r:
... | import sys
def s():
n, k = list(map(int, input().split()))
w = list(map(int, sys.stdin.readlines()))
def f():
c = t = 0
for j in w:
t += j
if t > m:
t = j
c += 1
if c >= k:
return 0
return ... | false | 15 | [
"-n, k = list(map(int, input().split()))",
"-w = list(map(int, sys.stdin.readlines()))",
"+",
"+def s():",
"+ n, k = list(map(int, input().split()))",
"+ w = list(map(int, sys.stdin.readlines()))",
"+",
"+ def f():",
"+ c = t = 0",
"+ for j in w:",
"+ t += j",
... | false | 0.046967 | 0.164293 | 0.285874 | [
"s121334770",
"s589455838"
] |
u692453235 | p02720 | python | s086531446 | s435333376 | 60 | 30 | 13,132 | 9,320 | Accepted | Accepted | 50 | K = int(eval(input()))
L = [i for i in range(1, 10)]
cnt = 9
i = 0
while K > cnt:
x = L[i]
r = x % 10
if r != 0:
L.append(10*x + r - 1)
cnt += 1
L.append(10*x + r)
cnt += 1
if r != 9:
L.append(10*x + r + 1)
cnt += 1
i += 1
print((L[K-1])) | K = int(eval(input()))
C = [[0]*10 for _ in range(10)]
C[0] = [1]*10
D = {0: [0, 1], 1: [0, 1, 2], 2: [1, 2, 3], 3: [2, 3, 4], 4: [3, 4, 5], 5: [4, 5, 6], 6: [5, 6, 7], 7: [6, 7, 8], 8: [7, 8, 9], 9: [8, 9]}
for i in range(1, 10):
for j in range(10):
if j == 0:
C[i][j] = C[i-1][j] + C[i-1][j+1]
... | 19 | 47 | 280 | 958 | K = int(eval(input()))
L = [i for i in range(1, 10)]
cnt = 9
i = 0
while K > cnt:
x = L[i]
r = x % 10
if r != 0:
L.append(10 * x + r - 1)
cnt += 1
L.append(10 * x + r)
cnt += 1
if r != 9:
L.append(10 * x + r + 1)
cnt += 1
i += 1
print((L[K - 1]))
| K = int(eval(input()))
C = [[0] * 10 for _ in range(10)]
C[0] = [1] * 10
D = {
0: [0, 1],
1: [0, 1, 2],
2: [1, 2, 3],
3: [2, 3, 4],
4: [3, 4, 5],
5: [4, 5, 6],
6: [5, 6, 7],
7: [6, 7, 8],
8: [7, 8, 9],
9: [8, 9],
}
for i in range(1, 10):
for j in range(10):
if j == 0:... | false | 59.574468 | [
"-L = [i for i in range(1, 10)]",
"-cnt = 9",
"-i = 0",
"-while K > cnt:",
"- x = L[i]",
"- r = x % 10",
"- if r != 0:",
"- L.append(10 * x + r - 1)",
"- cnt += 1",
"- L.append(10 * x + r)",
"- cnt += 1",
"- if r != 9:",
"- L.append(10 * x + r + 1)",
... | false | 0.1927 | 0.119288 | 1.615419 | [
"s086531446",
"s435333376"
] |
u977389981 | p03418 | python | s554583953 | s458496813 | 91 | 84 | 2,940 | 3,060 | Accepted | Accepted | 7.69 | n, k = list(map(int, input().split()))
count = 0
if k == 0:
count += n * n
else:
for b in range(k + 1, n + 1):
q, r = n // b, n % b
count += q * (b - k) + max((r + 1 - k), 0)
print(count) | n, k = list(map(int, input().split()))
ans = 0
if k == 0:
ans = n ** 2
else:
for b in range(k + 1, n + 1):
q, r = n // b, n % b
ans += (b - k) * q + max(r + 1 - k, 0)
print(ans) | 12 | 11 | 227 | 211 | n, k = list(map(int, input().split()))
count = 0
if k == 0:
count += n * n
else:
for b in range(k + 1, n + 1):
q, r = n // b, n % b
count += q * (b - k) + max((r + 1 - k), 0)
print(count)
| n, k = list(map(int, input().split()))
ans = 0
if k == 0:
ans = n**2
else:
for b in range(k + 1, n + 1):
q, r = n // b, n % b
ans += (b - k) * q + max(r + 1 - k, 0)
print(ans)
| false | 8.333333 | [
"-count = 0",
"+ans = 0",
"- count += n * n",
"+ ans = n**2",
"- count += q * (b - k) + max((r + 1 - k), 0)",
"-print(count)",
"+ ans += (b - k) * q + max(r + 1 - k, 0)",
"+print(ans)"
] | false | 0.041874 | 0.041048 | 1.020126 | [
"s554583953",
"s458496813"
] |
u057109575 | p02935 | python | s976072665 | s362202814 | 188 | 65 | 38,512 | 61,548 | Accepted | Accepted | 65.43 | N, *V = list(map(int, open(0).read().split()))
V.sort()
a = [V[0]] + [V[i + 1] * 2 ** i for i in range(N - 1)]
print((sum(a) / (2 ** (N - 1))))
|
N = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
ans = X[0] + X[1]
for i in range(2, N):
ans += X[i] * 2 ** (i - 1)
print((ans / 2 ** (N - 1)))
| 6 | 10 | 143 | 171 | N, *V = list(map(int, open(0).read().split()))
V.sort()
a = [V[0]] + [V[i + 1] * 2**i for i in range(N - 1)]
print((sum(a) / (2 ** (N - 1))))
| N = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
ans = X[0] + X[1]
for i in range(2, N):
ans += X[i] * 2 ** (i - 1)
print((ans / 2 ** (N - 1)))
| false | 40 | [
"-N, *V = list(map(int, open(0).read().split()))",
"-V.sort()",
"-a = [V[0]] + [V[i + 1] * 2**i for i in range(N - 1)]",
"-print((sum(a) / (2 ** (N - 1))))",
"+N = int(eval(input()))",
"+X = list(map(int, input().split()))",
"+X.sort()",
"+ans = X[0] + X[1]",
"+for i in range(2, N):",
"+ ans +=... | false | 0.07965 | 0.039967 | 1.992885 | [
"s976072665",
"s362202814"
] |
u554781254 | p02988 | python | s370611107 | s825715594 | 25 | 23 | 3,568 | 3,568 | Accepted | Accepted | 8 | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
""" Input
S ... | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
N = int(eva... | 36 | 20 | 887 | 518 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float("inf")
NIL = -1
""" Input
S = input().rstrip... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float("inf")
NIL = -1
N = int(eval(input()))
P = l... | false | 44.444444 | [
"-\"\"\" Input",
"-S = input().rstrip()",
"-N, A, B = map(int, input().split())",
"-A = np.array(input().split(), dtype=np.float64)",
"-D = [int(input()) for _ in range(N)]",
"-AB = [[int(x) for x in input().split()] for _ in range(N)]",
"-PX = [[int(x) for x in input().split()] for _ in range(Q)]",
"... | false | 0.045355 | 0.086256 | 0.525822 | [
"s370611107",
"s825715594"
] |
u156815136 | p03212 | python | s366472542 | s675260526 | 91 | 75 | 6,132 | 6,132 | Accepted | Accepted | 17.58 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
mod = 10**9 + 7
def readInts():
return list(map(int,input().split()))
def main():
from collections import deque
d = deque()
lc = [3,5,7]
cnt... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
mod = 10**9 + 7
def readInts():
return list(map(int,input().split()))
def main():
n = int(eval(input()))
... | 37 | 42 | 905 | 953 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list
# from itertools import combinations # (string,3) 3回
mod = 10**9 + 7
def readInts():
return list(map(int, input().split()))
def main():
from collections import deque
d = deque()
lc = [3, 5, 7]
cnt ... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list
# from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
mod = 10**9 + 7
def readInts():
return list(map(int, input().split()))
def main():
n = int(eval(input()))
nl = l... | false | 11.904762 | [
"+#",
"+#",
"+# pythonで無理なときは、pypyでやると正解するかも!!",
"+#",
"+#",
"+ n = int(eval(input()))",
"+ nl = len(str(n))",
"- d = deque()",
"- lc = [3, 5, 7]",
"- cnt = 0",
"- # nya = 0",
"- d.append(0)",
"- LIST = []",
"- n = int(eval(input()))",
"- flag = False",
"-... | false | 0.066633 | 0.062024 | 1.074322 | [
"s366472542",
"s675260526"
] |
u370331385 | p03212 | python | s460883613 | s437208782 | 187 | 62 | 6,772 | 3,064 | Accepted | Accepted | 66.84 | import itertools
N_ = eval(input())
N = int(N_)
n = len(list(N_)) #Nの桁数
#(方針) N<=10**9 だと3,5,7のみを使ってできる数は多くても3**9=2*10**4通りなので全探索
A = ['3','5','7']
ans = 0
if(n >= 3): #桁数が3以上なら
for i in range(3,n+1):
Comb = list(itertools.product(A, repeat=i)) #重複組み合わせ
for j in range(len(Comb)):
tmp = list(... | import itertools
N = eval(input())
dig = len(N)
N = int(N)
# 全探索
# 3^9 <= 20000
A = ['3','5','7']
def count_num(A,n):
Comb = itertools.product(A, repeat=n)
cnt = 0
for X in Comb:
X = list(X)
X_num = int(''.join(X))
if(X_num <= N):
j3,j5,j7 = 0,0,0
for x in X:
... | 40 | 30 | 901 | 545 | import itertools
N_ = eval(input())
N = int(N_)
n = len(list(N_)) # Nの桁数
# (方針) N<=10**9 だと3,5,7のみを使ってできる数は多くても3**9=2*10**4通りなので全探索
A = ["3", "5", "7"]
ans = 0
if n >= 3: # 桁数が3以上なら
for i in range(3, n + 1):
Comb = list(itertools.product(A, repeat=i)) # 重複組み合わせ
for j in range(len(Comb)):
... | import itertools
N = eval(input())
dig = len(N)
N = int(N)
# 全探索
# 3^9 <= 20000
A = ["3", "5", "7"]
def count_num(A, n):
Comb = itertools.product(A, repeat=n)
cnt = 0
for X in Comb:
X = list(X)
X_num = int("".join(X))
if X_num <= N:
j3, j5, j7 = 0, 0, 0
for... | false | 25 | [
"-N_ = eval(input())",
"-N = int(N_)",
"-n = len(list(N_)) # Nの桁数",
"-# (方針) N<=10**9 だと3,5,7のみを使ってできる数は多くても3**9=2*10**4通りなので全探索",
"+N = eval(input())",
"+dig = len(N)",
"+N = int(N)",
"+# 全探索",
"+# 3^9 <= 20000",
"+",
"+",
"+def count_num(A, n):",
"+ Comb = itertools.product(A, repeat=n... | false | 0.04663 | 0.037514 | 1.243003 | [
"s460883613",
"s437208782"
] |
u829094246 | p03607 | python | s198297582 | s294470747 | 257 | 73 | 15,456 | 18,784 | Accepted | Accepted | 71.6 | from collections import defaultdict
N=int(eval(input()))
An=defaultdict(int)
for _ in range(N):
An[int(eval(input()))]+=1
print((len(list([v for v in list(An.values()) if v%2==1]))))
| from collections import Counter
N,*An=list(map(int, open(0).read().split()))
count=Counter(An)
print((len(list([v for v in list(count.values()) if v%2==1]))))
| 8 | 7 | 178 | 156 | from collections import defaultdict
N = int(eval(input()))
An = defaultdict(int)
for _ in range(N):
An[int(eval(input()))] += 1
print((len(list([v for v in list(An.values()) if v % 2 == 1]))))
| from collections import Counter
N, *An = list(map(int, open(0).read().split()))
count = Counter(An)
print((len(list([v for v in list(count.values()) if v % 2 == 1]))))
| false | 12.5 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-N = int(eval(input()))",
"-An = defaultdict(int)",
"-for _ in range(N):",
"- An[int(eval(input()))] += 1",
"-print((len(list([v for v in list(An.values()) if v % 2 == 1]))))",
"+N, *An = list(map(int, open(0).read().split... | false | 0.08054 | 0.078299 | 1.02862 | [
"s198297582",
"s294470747"
] |
u342456871 | p03308 | python | s130162597 | s248272446 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
list = list(map(int, input().split()))
max = 0
for i in range(n):
for j in range(i):
m = abs(list[j] - list[i])
if (max < m):
max = m
print(max) | n = int(eval(input()))
a = list(map(int, input().split()))
max = 0
for i in range(n):
if i > 0:
for j in range(i):
max1 = abs(a[i] - a[j])
if max1 > max:
max = max1
print(max) | 11 | 12 | 195 | 216 | n = int(eval(input()))
list = list(map(int, input().split()))
max = 0
for i in range(n):
for j in range(i):
m = abs(list[j] - list[i])
if max < m:
max = m
print(max)
| n = int(eval(input()))
a = list(map(int, input().split()))
max = 0
for i in range(n):
if i > 0:
for j in range(i):
max1 = abs(a[i] - a[j])
if max1 > max:
max = max1
print(max)
| false | 8.333333 | [
"-list = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"- for j in range(i):",
"- m = abs(list[j] - list[i])",
"- if max < m:",
"- max = m",
"+ if i > 0:",
"+ for j in range(i):",
"+ max1 = abs(a[i] - a[j])",
"+ ... | false | 0.038368 | 0.038435 | 0.998269 | [
"s130162597",
"s248272446"
] |
u723590269 | p03448 | python | s501744374 | s483993056 | 55 | 50 | 3,064 | 3,060 | Accepted | Accepted | 9.09 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
out_sum = 0
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
out_sum = i * 500 + j * 100 + k * 50
if out_sum == X : cnt += 1
... | a = int(eval(input())) #500
b = int(eval(input())) #100
c = int(eval(input())) #50
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 (i*500+j*100+k*50)==x:
cnt+=1
print(cnt) | 16 | 14 | 318 | 263 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
out_sum = 0
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
out_sum = i * 500 + j * 100 + k * 50
if out_sum == X:
cnt += 1
print(cnt)
| a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
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 (i * 500 + j * 100 + k * 50) == x:
cnt += 1
print(cnt)
| false | 12.5 | [
"-A = int(eval(input()))",
"-B = int(eval(input()))",
"-C = int(eval(input()))",
"-X = int(eval(input()))",
"-out_sum = 0",
"+a = int(eval(input())) # 500",
"+b = int(eval(input())) # 100",
"+c = int(eval(input())) # 50",
"+x = int(eval(input()))",
"-for i in range(A + 1):",
"- for j in ra... | false | 0.09903 | 0.129661 | 0.763764 | [
"s501744374",
"s483993056"
] |
u141574039 | p02659 | python | s124969412 | s484009336 | 25 | 20 | 9,124 | 9,044 | Accepted | Accepted | 20 | A,B=list(map(float,input().split()))
A=int(A)
B=int(B*100+0.9999999999)
print((A*B//100)) | A,B=list(map(float,input().split()))
A=int(A)
B=int(B*100+0.9999999999999)
print((A*B//100)) | 4 | 4 | 84 | 87 | A, B = list(map(float, input().split()))
A = int(A)
B = int(B * 100 + 0.9999999999)
print((A * B // 100))
| A, B = list(map(float, input().split()))
A = int(A)
B = int(B * 100 + 0.9999999999999)
print((A * B // 100))
| false | 0 | [
"-B = int(B * 100 + 0.9999999999)",
"+B = int(B * 100 + 0.9999999999999)"
] | false | 0.14383 | 0.093305 | 1.541496 | [
"s124969412",
"s484009336"
] |
u095021077 | p03210 | python | s209260757 | s191244120 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | X=int(eval(input()))
if X==3 or X==5 or X==7:
print('YES')
else:
print('NO') | n=int(eval(input()))
if n==3 or n==5 or n==7:
print('YES')
else:
print('NO') | 5 | 5 | 78 | 78 | X = int(eval(input()))
if X == 3 or X == 5 or X == 7:
print("YES")
else:
print("NO")
| n = int(eval(input()))
if n == 3 or n == 5 or n == 7:
print("YES")
else:
print("NO")
| false | 0 | [
"-X = int(eval(input()))",
"-if X == 3 or X == 5 or X == 7:",
"+n = int(eval(input()))",
"+if n == 3 or n == 5 or n == 7:"
] | false | 0.068839 | 0.069468 | 0.990933 | [
"s209260757",
"s191244120"
] |
u046187684 | p02792 | python | s877730851 | s665078245 | 87 | 18 | 3,064 | 3,188 | Accepted | Accepted | 79.31 | from itertools import product
def solve(string):
l = len(string)
*ns, = list(map(int, string))
n = int(string)
c = [0] + [10**i for i in range(6)]
t = sum(c[:l - 1])
t = [[t] * 10 for _ in range(10)]
if l > 1:
for i in range(10):
t[i][i] += 1
for i in r... | from itertools import product
def solve(string):
d = len(string)
if d == 1:
return string
s0, ss, sn = int(string[0]), int(string[1:-1] or 0), int(string[-1])
t = [[0] * 10] + [[int("1" * (d - 2) or 0)] * 10 for _ in range(9)]
for i in range(1, 10):
t[i][i] += 1
for ... | 25 | 23 | 679 | 684 | from itertools import product
def solve(string):
l = len(string)
(*ns,) = list(map(int, string))
n = int(string)
c = [0] + [10**i for i in range(6)]
t = sum(c[: l - 1])
t = [[t] * 10 for _ in range(10)]
if l > 1:
for i in range(10):
t[i][i] += 1
for i in range(1, ns... | from itertools import product
def solve(string):
d = len(string)
if d == 1:
return string
s0, ss, sn = int(string[0]), int(string[1:-1] or 0), int(string[-1])
t = [[0] * 10] + [[int("1" * (d - 2) or 0)] * 10 for _ in range(9)]
for i in range(1, 10):
t[i][i] += 1
for i, j in pro... | false | 8 | [
"- l = len(string)",
"- (*ns,) = list(map(int, string))",
"- n = int(string)",
"- c = [0] + [10**i for i in range(6)]",
"- t = sum(c[: l - 1])",
"- t = [[t] * 10 for _ in range(10)]",
"- if l > 1:",
"- for i in range(10):",
"- t[i][i] += 1",
"- for i in ra... | false | 0.03713 | 0.037859 | 0.980736 | [
"s877730851",
"s665078245"
] |
u680851063 | p03309 | python | s309388521 | s822671795 | 250 | 231 | 26,020 | 26,832 | Accepted | Accepted | 7.6 | n=int(eval(input()))
l=list(map(int,input().split()))
for i in range(n):
l[i]=l[i]-(i+1)
from statistics import mean, median,variance,stdev
z=int(median(l))
x=0
for j in range(n):
x+=abs(l[j]-z)
print(x) | n=int(eval(input()))
l=list(map(int,input().split()))
l=[l[i]-(i+1) for i in range(n)]
from statistics import median
z=int(median(l))
x=0
for j in range(n):
x+=abs(l[j]-z)
print(x) | 14 | 13 | 222 | 194 | n = int(eval(input()))
l = list(map(int, input().split()))
for i in range(n):
l[i] = l[i] - (i + 1)
from statistics import mean, median, variance, stdev
z = int(median(l))
x = 0
for j in range(n):
x += abs(l[j] - z)
print(x)
| n = int(eval(input()))
l = list(map(int, input().split()))
l = [l[i] - (i + 1) for i in range(n)]
from statistics import median
z = int(median(l))
x = 0
for j in range(n):
x += abs(l[j] - z)
print(x)
| false | 7.142857 | [
"-for i in range(n):",
"- l[i] = l[i] - (i + 1)",
"-from statistics import mean, median, variance, stdev",
"+l = [l[i] - (i + 1) for i in range(n)]",
"+from statistics import median"
] | false | 0.050834 | 0.056555 | 0.898843 | [
"s309388521",
"s822671795"
] |
u753803401 | p03108 | python | s970130677 | s906540513 | 803 | 740 | 107,356 | 104,156 | Accepted | Accepted | 7.85 | import sys
#https://note.nkmk.me/python-union-find/
class AlgUnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | import sys
#https://note.nkmk.me/python-union-find/
class AlgUnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | 72 | 78 | 1,793 | 1,934 | import sys
# https://note.nkmk.me/python-union-find/
class AlgUnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return s... | import sys
# https://note.nkmk.me/python-union-find/
class AlgUnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return s... | false | 7.692308 | [
"- input = sys.stdin.readline",
"+ readline = sys.stdin.buffer.readline",
"- n, m = list(map(int, input().rstrip(\"\\n\").split()))",
"- ab = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(m)]",
"- t = n * (n - 1) // 2",
"+ n, m = list(map(int, readline().split()))",
"... | false | 0.03749 | 0.036852 | 1.017307 | [
"s970130677",
"s906540513"
] |
u553987207 | p02995 | python | s571551113 | s948269657 | 38 | 29 | 5,344 | 9,192 | Accepted | Accepted | 23.68 | from fractions import gcd
A, B, C, D = list(map(int, input().split()))
ans = B - A + 1
ans -= (B // C - (A - 1) // C)
ans -= (B // D - (A - 1) // D)
x = C * D // gcd(C, D)
ans += (B // x - (A - 1) // x)
print(ans) | import math
A, B, C, D = list(map(int, input().split()))
cdiv = B // C - (A - 1) // C
ddiv = B // D - (A - 1) // D
lcm = (C * D) // math.gcd(C, D)
cddiv = B // lcm - (A - 1) // lcm
ans = (B - A + 1) - (cdiv + ddiv - cddiv)
print(ans) | 8 | 8 | 214 | 234 | from fractions import gcd
A, B, C, D = list(map(int, input().split()))
ans = B - A + 1
ans -= B // C - (A - 1) // C
ans -= B // D - (A - 1) // D
x = C * D // gcd(C, D)
ans += B // x - (A - 1) // x
print(ans)
| import math
A, B, C, D = list(map(int, input().split()))
cdiv = B // C - (A - 1) // C
ddiv = B // D - (A - 1) // D
lcm = (C * D) // math.gcd(C, D)
cddiv = B // lcm - (A - 1) // lcm
ans = (B - A + 1) - (cdiv + ddiv - cddiv)
print(ans)
| false | 0 | [
"-from fractions import gcd",
"+import math",
"-ans = B - A + 1",
"-ans -= B // C - (A - 1) // C",
"-ans -= B // D - (A - 1) // D",
"-x = C * D // gcd(C, D)",
"-ans += B // x - (A - 1) // x",
"+cdiv = B // C - (A - 1) // C",
"+ddiv = B // D - (A - 1) // D",
"+lcm = (C * D) // math.gcd(C, D)",
"+... | false | 0.047419 | 0.044312 | 1.070109 | [
"s571551113",
"s948269657"
] |
u083960235 | p03472 | python | s065749529 | s489790950 | 198 | 150 | 106,168 | 81,312 | Accepted | Accepted | 24.24 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 55 | 45 | 1,366 | 1,172 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 18.181818 | [
"-L = [LIST() for i in range(N)]",
"-A = []",
"-B = []",
"-for a, b in L:",
"- A.append(a)",
"- B.append(b)",
"-A.sort(reverse=True)",
"+A, B = [0] * N, [0] * N",
"+for i in range(N):",
"+ A[i], B[i] = MAP()",
"+max_a = max(A)",
"-big_B = []",
"-ma_A = max(A)",
"-for b in B:",
"... | false | 0.04833 | 0.039023 | 1.238508 | [
"s065749529",
"s489790950"
] |
u930705402 | p02763 | python | s873351993 | s377285459 | 1,146 | 812 | 103,000 | 92,888 | Accepted | Accepted | 29.14 | class SEGTree:
def __init__(self,n):
self.Unit=0
i=1
while(i<n):
i*=2
self.SEG=[self.Unit]*(2*i-1)
self.d=i
def update(self,i,x):
i+=self.d-1
self.SEG[i]=1<<x
while i>0:
i=(i-1)//2
self.SEG[i]=self.S... | import sys
read=sys.stdin.readline
class SEGTree:
def __init__(self,n):
self.Unit=0
i=1
while(i<n):
i*=2
self.SEG=[self.Unit]*(2*i-1)
self.d=i
def update(self,i,x):
i+=self.d-1
self.SEG[i]=1<<x
while i>0:
i=(i-... | 47 | 49 | 1,115 | 1,160 | class SEGTree:
def __init__(self, n):
self.Unit = 0
i = 1
while i < n:
i *= 2
self.SEG = [self.Unit] * (2 * i - 1)
self.d = i
def update(self, i, x):
i += self.d - 1
self.SEG[i] = 1 << x
while i > 0:
i = (i - 1) // 2
... | import sys
read = sys.stdin.readline
class SEGTree:
def __init__(self, n):
self.Unit = 0
i = 1
while i < n:
i *= 2
self.SEG = [self.Unit] * (2 * i - 1)
self.d = i
def update(self, i, x):
i += self.d - 1
self.SEG[i] = 1 << x
while i ... | false | 4.081633 | [
"+import sys",
"+",
"+read = sys.stdin.readline",
"+",
"+",
"- q, x, y = input().split()",
"+ q, x, y = read().rstrip().split()"
] | false | 0.044347 | 0.045209 | 0.980927 | [
"s873351993",
"s377285459"
] |
u729133443 | p03807 | python | s617362471 | s172234690 | 212 | 46 | 62,448 | 11,176 | Accepted | Accepted | 78.3 | eval(input());print(('YNEOS'[sum(map(int,input().split()))%2::2])) | n,a=open(0);print(('YNEOS'[sum(map(int,a.split()))%2::2])) | 1 | 1 | 58 | 56 | eval(input())
print(("YNEOS"[sum(map(int, input().split())) % 2 :: 2]))
| n, a = open(0)
print(("YNEOS"[sum(map(int, a.split())) % 2 :: 2]))
| false | 0 | [
"-eval(input())",
"-print((\"YNEOS\"[sum(map(int, input().split())) % 2 :: 2]))",
"+n, a = open(0)",
"+print((\"YNEOS\"[sum(map(int, a.split())) % 2 :: 2]))"
] | false | 0.083723 | 0.118826 | 0.704588 | [
"s617362471",
"s172234690"
] |
u857673087 | p02699 | python | s566941008 | s233609741 | 22 | 19 | 9,168 | 9,032 | Accepted | Accepted | 13.64 | S,W=(int(x) for x in input().split())
if S <= W:
print('unsafe')
else:
print('safe') | S,W = list(map(int,input().split()))
if S <= W:
print('unsafe')
else:
print('safe') | 6 | 6 | 95 | 87 | S, W = (int(x) for x in input().split())
if S <= W:
print("unsafe")
else:
print("safe")
| S, W = list(map(int, input().split()))
if S <= W:
print("unsafe")
else:
print("safe")
| false | 0 | [
"-S, W = (int(x) for x in input().split())",
"+S, W = list(map(int, input().split()))"
] | false | 0.047881 | 0.039498 | 1.212251 | [
"s566941008",
"s233609741"
] |
u508960292 | p02577 | python | s600114472 | s583566101 | 205 | 75 | 9,100 | 9,044 | Accepted | Accepted | 63.41 | #176-B
N = int(eval(input()))
mod = N % 9
if mod == 0:
print('Yes')
else:
print('No')
| #176-B
N = eval(input())
sum = 0
for i in range(1,len(N)+1):
sum += int(N[-i])
if int(sum) % 9 == 0:
print('Yes')
else:
print('No')
| 9 | 11 | 94 | 144 | # 176-B
N = int(eval(input()))
mod = N % 9
if mod == 0:
print("Yes")
else:
print("No")
| # 176-B
N = eval(input())
sum = 0
for i in range(1, len(N) + 1):
sum += int(N[-i])
if int(sum) % 9 == 0:
print("Yes")
else:
print("No")
| false | 18.181818 | [
"-N = int(eval(input()))",
"-mod = N % 9",
"-if mod == 0:",
"+N = eval(input())",
"+sum = 0",
"+for i in range(1, len(N) + 1):",
"+ sum += int(N[-i])",
"+if int(sum) % 9 == 0:"
] | false | 0.037759 | 0.041557 | 0.908607 | [
"s600114472",
"s583566101"
] |
u853728588 | p02639 | python | s143142324 | s434138422 | 26 | 24 | 9,112 | 9,096 | Accepted | Accepted | 7.69 | a, b, c, d, e = list(map(int,input().split()))
if a == 0:
print((1))
elif b == 0:
print((2))
elif c == 0:
print((3))
elif d == 0:
print((4))
elif e == 0:
print((5)) | x=list(map(int,input().split()))
for i in range(5):
if x[i]==0:
print((i+1)) | 12 | 5 | 170 | 92 | a, b, c, d, e = list(map(int, input().split()))
if a == 0:
print((1))
elif b == 0:
print((2))
elif c == 0:
print((3))
elif d == 0:
print((4))
elif e == 0:
print((5))
| x = list(map(int, input().split()))
for i in range(5):
if x[i] == 0:
print((i + 1))
| false | 58.333333 | [
"-a, b, c, d, e = list(map(int, input().split()))",
"-if a == 0:",
"- print((1))",
"-elif b == 0:",
"- print((2))",
"-elif c == 0:",
"- print((3))",
"-elif d == 0:",
"- print((4))",
"-elif e == 0:",
"- print((5))",
"+x = list(map(int, input().split()))",
"+for i in range(5):",... | false | 0.042059 | 0.038509 | 1.092199 | [
"s143142324",
"s434138422"
] |
u870164956 | p02900 | python | s127852485 | s530659790 | 191 | 171 | 79,472 | 39,888 | Accepted | Accepted | 10.47 | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を2と3以上の奇数で順次割っていくする(下から計算したら、素数判定は不要)
# 3. 2.の結果に含まれる数の種類の数+1が答え
def main():
a, b = list(map(int, input().split()))
while b != 0: a, b = b, a % b #最大公約数を求める
print((num_facto(a) + 1))
def num_facto(n):
ans = 0
max_n = int(n ** 0.5) + 1
if n == 1: return ... | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を2と3以上の奇数で順次割っていくする(下から計算したら、素数判定は不要)
# 3. 2.の結果に含まれる数の種類の数+1が答え
def main():
a, b = list(map(int, input().split()))
while b != 0: a, b = b, a % b #最大公約数を求める
print((num_facto(a) + 1))
def num_facto(n):
ans = 0
if n == 1: return ans
cursor = 2
while cu... | 23 | 23 | 595 | 554 | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を2と3以上の奇数で順次割っていくする(下から計算したら、素数判定は不要)
# 3. 2.の結果に含まれる数の種類の数+1が答え
def main():
a, b = list(map(int, input().split()))
while b != 0:
a, b = b, a % b # 最大公約数を求める
print((num_facto(a) + 1))
def num_facto(n):
ans = 0
max_n = int(n**0.5) + 1
if n == 1:
... | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を2と3以上の奇数で順次割っていくする(下から計算したら、素数判定は不要)
# 3. 2.の結果に含まれる数の種類の数+1が答え
def main():
a, b = list(map(int, input().split()))
while b != 0:
a, b = b, a % b # 最大公約数を求める
print((num_facto(a) + 1))
def num_facto(n):
ans = 0
if n == 1:
return ans
cursor =... | false | 0 | [
"- max_n = int(n**0.5) + 1",
"- two_and_odds = [2] + [x for x in range(3, max_n, 2) if x ** 2 <= n]",
"- for cursor in two_and_odds:",
"+ cursor = 2",
"+ while cursor**2 <= n:",
"+ cursor = 3 if cursor == 2 else (cursor + 2)"
] | false | 0.048293 | 0.038142 | 1.266149 | [
"s127852485",
"s530659790"
] |
u644907318 | p03346 | python | s550558195 | s073333854 | 820 | 265 | 85,412 | 86,936 | Accepted | Accepted | 67.68 | N = int(eval(input()))
P = [int(eval(input())) for _ in range(N)]
hist = [0 for _ in range(N+1)]
A = {i:0 for i in range(1,N+1)}
for i in range(N):
a = P[i]
if hist[a-1]==0:
A[a] = a
else:
A[a] = A[a-1]
hist[a] = 1
cmax = 0
for i in range(1,N+1):
cmax = max(cmax,i-A[i]+1... | N = int(eval(input()))
A = [0 for _ in range(N+1)]
for _ in range(N):
a = int(eval(input()))
if A[a-1]==0:
A[a] = 1
else:
A[a] = A[a-1]+1
n = max(A)
print((N-n)) | 15 | 10 | 324 | 184 | N = int(eval(input()))
P = [int(eval(input())) for _ in range(N)]
hist = [0 for _ in range(N + 1)]
A = {i: 0 for i in range(1, N + 1)}
for i in range(N):
a = P[i]
if hist[a - 1] == 0:
A[a] = a
else:
A[a] = A[a - 1]
hist[a] = 1
cmax = 0
for i in range(1, N + 1):
cmax = max(cmax, i - A... | N = int(eval(input()))
A = [0 for _ in range(N + 1)]
for _ in range(N):
a = int(eval(input()))
if A[a - 1] == 0:
A[a] = 1
else:
A[a] = A[a - 1] + 1
n = max(A)
print((N - n))
| false | 33.333333 | [
"-P = [int(eval(input())) for _ in range(N)]",
"-hist = [0 for _ in range(N + 1)]",
"-A = {i: 0 for i in range(1, N + 1)}",
"-for i in range(N):",
"- a = P[i]",
"- if hist[a - 1] == 0:",
"- A[a] = a",
"+A = [0 for _ in range(N + 1)]",
"+for _ in range(N):",
"+ a = int(eval(input())... | false | 0.080592 | 0.041436 | 1.944982 | [
"s550558195",
"s073333854"
] |
u651803486 | p03073 | python | s661495064 | s793411852 | 200 | 80 | 15,520 | 5,536 | Accepted | Accepted | 60 | import numpy as np
s = np.array(list(map(int, eval(input()))))
expected = []
for i in range(len(s)):
if (i % 2 == 0):
expected.append(0)
else:
expected.append(1)
expected = np.array(expected)
union = s + expected
union = union % 2
union = union.tolist()
cnt_0 = union.coun... | s = list(map(int, eval(input())))
expected = []
for i in range(len(s)):
if (i % 2 == 0):
expected.append(0)
else:
expected.append(1)
union = []
for i in range(len(s)):
union.append((s[i] + expected[i]) % 2)
cnt_0 = union.count(0)
cnt_1 = union.count(1)
print((min(cnt_... | 22 | 19 | 370 | 323 | import numpy as np
s = np.array(list(map(int, eval(input()))))
expected = []
for i in range(len(s)):
if i % 2 == 0:
expected.append(0)
else:
expected.append(1)
expected = np.array(expected)
union = s + expected
union = union % 2
union = union.tolist()
cnt_0 = union.count(0)
cnt_1 = union.count(... | s = list(map(int, eval(input())))
expected = []
for i in range(len(s)):
if i % 2 == 0:
expected.append(0)
else:
expected.append(1)
union = []
for i in range(len(s)):
union.append((s[i] + expected[i]) % 2)
cnt_0 = union.count(0)
cnt_1 = union.count(1)
print((min(cnt_0, cnt_1)))
| false | 13.636364 | [
"-import numpy as np",
"-",
"-s = np.array(list(map(int, eval(input()))))",
"+s = list(map(int, eval(input())))",
"-expected = np.array(expected)",
"-union = s + expected",
"-union = union % 2",
"-union = union.tolist()",
"+union = []",
"+for i in range(len(s)):",
"+ union.append((s[i] + expe... | false | 0.552506 | 0.038781 | 14.246883 | [
"s661495064",
"s793411852"
] |
u696684809 | p02657 | python | s134197593 | s612122304 | 123 | 29 | 31,132 | 9,184 | Accepted | Accepted | 76.42 | import numpy as np
import scipy as sp
import math
a, b = list(map(str, input().split()))
a = int(a)
b = int(float(b) * 100.001)
ans = int(a * b // 100)
print(ans) | a,b = list(map(int,input().split()))
print((a*b)) | 9 | 2 | 165 | 42 | import numpy as np
import scipy as sp
import math
a, b = list(map(str, input().split()))
a = int(a)
b = int(float(b) * 100.001)
ans = int(a * b // 100)
print(ans)
| a, b = list(map(int, input().split()))
print((a * b))
| false | 77.777778 | [
"-import numpy as np",
"-import scipy as sp",
"-import math",
"-",
"-a, b = list(map(str, input().split()))",
"-a = int(a)",
"-b = int(float(b) * 100.001)",
"-ans = int(a * b // 100)",
"-print(ans)",
"+a, b = list(map(int, input().split()))",
"+print((a * b))"
] | false | 0.077436 | 0.035642 | 2.17264 | [
"s134197593",
"s612122304"
] |
u773265208 | p02701 | python | s714276400 | s240651292 | 323 | 286 | 35,416 | 38,788 | Accepted | Accepted | 11.46 | n = int(eval(input()))
d = {}
ans = 0
for i in range(n):
s = eval(input())
if s not in list(d.keys()):
ans += 1
d[s] = 0
print(ans)
| import collections
n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
count = collections.Counter(s)
print((len(count)))
| 10 | 10 | 136 | 145 | n = int(eval(input()))
d = {}
ans = 0
for i in range(n):
s = eval(input())
if s not in list(d.keys()):
ans += 1
d[s] = 0
print(ans)
| import collections
n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
count = collections.Counter(s)
print((len(count)))
| false | 0 | [
"+import collections",
"+",
"-d = {}",
"-ans = 0",
"-for i in range(n):",
"- s = eval(input())",
"- if s not in list(d.keys()):",
"- ans += 1",
"- d[s] = 0",
"-print(ans)",
"+s = []",
"+for _ in range(n):",
"+ s.append(eval(input()))",
"+count = collections.Counter(s... | false | 0.007525 | 0.03141 | 0.239588 | [
"s714276400",
"s240651292"
] |
u044964932 | p03339 | python | s619964665 | s278444850 | 175 | 127 | 46,780 | 23,180 | Accepted | Accepted | 27.43 | def main():
n = int(eval(input()))
ss = list(eval(input()))
ans = float("inf")
ans = [0] * n
cum_sum_w = [0] * (n+1)
cum_sum_e = [0] * (n+1)
for i in range(n):
if ss[i] == 'W':
add = 1
else:
add = 0
cum_sum_w[i+1] = cum_sum_w[i] +... | def main():
n = int(eval(input()))
ss = list(eval(input()))
num_sum = [0]*n
west_sum = 0
east_sum = 0
for i in range(1, n):
if ss[i-1] == 'W':
west_sum += 1
num_sum[i] += west_sum
for i in range(n-2, -1, -1):
if ss[i+1] == 'E':
ea... | 27 | 21 | 619 | 436 | def main():
n = int(eval(input()))
ss = list(eval(input()))
ans = float("inf")
ans = [0] * n
cum_sum_w = [0] * (n + 1)
cum_sum_e = [0] * (n + 1)
for i in range(n):
if ss[i] == "W":
add = 1
else:
add = 0
cum_sum_w[i + 1] = cum_sum_w[i] + add
... | def main():
n = int(eval(input()))
ss = list(eval(input()))
num_sum = [0] * n
west_sum = 0
east_sum = 0
for i in range(1, n):
if ss[i - 1] == "W":
west_sum += 1
num_sum[i] += west_sum
for i in range(n - 2, -1, -1):
if ss[i + 1] == "E":
east_sum... | false | 22.222222 | [
"- ans = float(\"inf\")",
"- ans = [0] * n",
"- cum_sum_w = [0] * (n + 1)",
"- cum_sum_e = [0] * (n + 1)",
"- for i in range(n):",
"- if ss[i] == \"W\":",
"- add = 1",
"- else:",
"- add = 0",
"- cum_sum_w[i + 1] = cum_sum_w[i] + add",
"- ... | false | 0.046044 | 0.038043 | 1.210317 | [
"s619964665",
"s278444850"
] |
u411923565 | p03578 | python | s551542190 | s825381418 | 260 | 231 | 57,008 | 169,444 | Accepted | Accepted | 11.15 | #38 B - Problem Set
import collections
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
cntD = collections.Counter(D)
cntT = collections.Counter(T)
result = 'YES'
for t in list(cntT.keys()):
if not(t in cntD):
result = 'NO'
... | import collections
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
cntD = collections.Counter(D)
cntT = collections.Counter(T)
result = 'YES'
for t in list(cntT.keys()):
if cntT[t] > cntD[t]:
result = 'NO'
break
prin... | 19 | 15 | 394 | 311 | # 38 B - Problem Set
import collections
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
cntD = collections.Counter(D)
cntT = collections.Counter(T)
result = "YES"
for t in list(cntT.keys()):
if not (t in cntD):
result = "NO"
brea... | import collections
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
cntD = collections.Counter(D)
cntT = collections.Counter(T)
result = "YES"
for t in list(cntT.keys()):
if cntT[t] > cntD[t]:
result = "NO"
break
print(result)
| false | 21.052632 | [
"-# 38 B - Problem Set",
"- if not (t in cntD):",
"- result = \"NO\"",
"- break"
] | false | 0.182885 | 0.056708 | 3.225053 | [
"s551542190",
"s825381418"
] |
u277312083 | p02947 | python | s666713334 | s995196552 | 420 | 368 | 11,012 | 19,400 | Accepted | Accepted | 12.38 | import math
n = int(eval(input()))
l = ["".join(sorted(eval(input()))) for i in range(n)]
l.sort()
c = 0
b = l[0]
ans = 0
for s in l[1:]:
if s == b:
c += 1
else:
ans += c * (c + 1) * 0.5
c = 0
b = s
ans += c * (c + 1) * 0.5
print((int(ans))) | n = int(eval(input()))
s = ["".join(sorted(eval(input()))) for _ in range(n)]
dic = {}
for w in s:
if w in dic:
dic[w] += 1
else:
dic[w] = 1
ans = 0
for w in dic:
ans += dic[w] * (dic[w] - 1) // 2
print(ans)
| 16 | 15 | 282 | 241 | import math
n = int(eval(input()))
l = ["".join(sorted(eval(input()))) for i in range(n)]
l.sort()
c = 0
b = l[0]
ans = 0
for s in l[1:]:
if s == b:
c += 1
else:
ans += c * (c + 1) * 0.5
c = 0
b = s
ans += c * (c + 1) * 0.5
print((int(ans)))
| n = int(eval(input()))
s = ["".join(sorted(eval(input()))) for _ in range(n)]
dic = {}
for w in s:
if w in dic:
dic[w] += 1
else:
dic[w] = 1
ans = 0
for w in dic:
ans += dic[w] * (dic[w] - 1) // 2
print(ans)
| false | 6.25 | [
"-import math",
"-",
"-l = [\"\".join(sorted(eval(input()))) for i in range(n)]",
"-l.sort()",
"-c = 0",
"-b = l[0]",
"+s = [\"\".join(sorted(eval(input()))) for _ in range(n)]",
"+dic = {}",
"+for w in s:",
"+ if w in dic:",
"+ dic[w] += 1",
"+ else:",
"+ dic[w] = 1",
... | false | 0.046946 | 0.049217 | 0.953852 | [
"s666713334",
"s995196552"
] |
u186838327 | p03112 | python | s558014711 | s416371017 | 1,745 | 558 | 12,796 | 56,796 | Accepted | Accepted | 68.02 | a, b, q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(a)]
T = [int(eval(input())) for _ in range(b)]
S.sort()
T.sort()
INF = 10**18
S = [-INF] + S + [INF]
T = [-INF] + T + [INF]
import bisect
for _ in range(q):
x = int(eval(input()))
i = bisect.bisect_right(S, x)
j =... | import sys
input = sys.stdin.buffer.readline
a, b, q = list(map(int, input().split()))
S = [0]*a
T = [0]*b
for i in range(a):
s = int(eval(input()))
S[i] = s
for i in range(b):
t = int(eval(input()))
T[i] = t
S.sort()
T.sort()
S = [-10**18]+S+[10**18]
T = [-10**18]+T+[10**18]
import b... | 21 | 30 | 531 | 659 | a, b, q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(a)]
T = [int(eval(input())) for _ in range(b)]
S.sort()
T.sort()
INF = 10**18
S = [-INF] + S + [INF]
T = [-INF] + T + [INF]
import bisect
for _ in range(q):
x = int(eval(input()))
i = bisect.bisect_right(S, x)
j = bisect.bisec... | import sys
input = sys.stdin.buffer.readline
a, b, q = list(map(int, input().split()))
S = [0] * a
T = [0] * b
for i in range(a):
s = int(eval(input()))
S[i] = s
for i in range(b):
t = int(eval(input()))
T[i] = t
S.sort()
T.sort()
S = [-(10**18)] + S + [10**18]
T = [-(10**18)] + T + [10**18]
import bis... | false | 30 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"-S = [int(eval(input())) for _ in range(a)]",
"-T = [int(eval(input())) for _ in range(b)]",
"+S = [0] * a",
"+T = [0] * b",
"+for i in range(a):",
"+ s = int(eval(input()))",
"+ S[i] = s",
"+for i in range(b):",
"+ t = int(ev... | false | 0.124859 | 0.115863 | 1.077637 | [
"s558014711",
"s416371017"
] |
u072053884 | p02259 | python | s259425797 | s026201767 | 70 | 40 | 7,708 | 7,656 | Accepted | Accepted | 42.86 | n = int(eval(input()))
numbers = [int(i) for i in input().split(" ")]
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]
flag = 1
cnt += 1
num... | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]
flag = 1
cnt += 1
numbe... | 20 | 20 | 378 | 376 | n = int(eval(input()))
numbers = [int(i) for i in input().split(" ")]
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]
flag = 1
cnt += 1
numbers = list(map(str, ... | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]
flag = 1
cnt += 1
numbers = list(map(str, nu... | false | 0 | [
"-numbers = [int(i) for i in input().split(\" \")]",
"+numbers = list(map(int, input().split(\" \")))"
] | false | 0.05715 | 0.036437 | 1.56844 | [
"s259425797",
"s026201767"
] |
u968166680 | p03371 | python | s949628478 | s645704386 | 130 | 99 | 3,060 | 3,064 | Accepted | Accepted | 23.85 | A, B, C, X, Y = list(map(int, input().split()))
ans = float('inf')
for k in range(0, 2 * max(X, Y) + 1, 2):
i = max(X - k // 2, 0)
j = max(Y - k // 2, 0)
ans = min(ans, A * i + B * j + C * k)
print(ans)
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
A, B, C, X, Y = list(map(int, readline().split()))
ans = INF
for k in range(0, 2 * max(X, Y) + 1, 2):
i = max(0, X - k // 2)
... | 9 | 25 | 219 | 497 | A, B, C, X, Y = list(map(int, input().split()))
ans = float("inf")
for k in range(0, 2 * max(X, Y) + 1, 2):
i = max(X - k // 2, 0)
j = max(Y - k // 2, 0)
ans = min(ans, A * i + B * j + C * k)
print(ans)
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
A, B, C, X, Y = list(map(int, readline().split()))
ans = INF
for k in range(0, 2 * max(X, Y) + 1, 2):
i = max(0, X - k // 2)
j = max(0, Y -... | false | 64 | [
"-A, B, C, X, Y = list(map(int, input().split()))",
"-ans = float(\"inf\")",
"-for k in range(0, 2 * max(X, Y) + 1, 2):",
"- i = max(X - k // 2, 0)",
"- j = max(Y - k // 2, 0)",
"- ans = min(ans, A * i + B * j + C * k)",
"-print(ans)",
"+import sys",
"+",
"+read = sys.stdin.read",
"+rea... | false | 0.128071 | 0.048752 | 2.62696 | [
"s949628478",
"s645704386"
] |
u619379081 | p03273 | python | s728202550 | s314598684 | 1,601 | 151 | 21,492 | 12,536 | Accepted | Accepted | 90.57 | import numpy as np
def f(s):
s = s.replace('.', '0')
s = s.replace('#', '1')
lst = [int(n) for n in s]
return np.array(lst)
h, w = list(map(int, input().split()))
a = np.array([f(eval(input())) for i in range(h)])
b = a[:, ~np.all(a==0, axis=0)]
ans_ = b[~np.all(a==0, axis=1)]
ans = ans_.tolis... | import numpy as np
h, w = list(map(int, input().split()))
a = np.array([list(eval(input())) for i in range(h)])
a = a[:, ~np.all(a=='.', axis=0)]
a = a[~np.all(a=='.', axis=1)]
for i in range(len(a)):
print((''.join(a[i]))) | 17 | 7 | 494 | 225 | import numpy as np
def f(s):
s = s.replace(".", "0")
s = s.replace("#", "1")
lst = [int(n) for n in s]
return np.array(lst)
h, w = list(map(int, input().split()))
a = np.array([f(eval(input())) for i in range(h)])
b = a[:, ~np.all(a == 0, axis=0)]
ans_ = b[~np.all(a == 0, axis=1)]
ans = ans_.tolist(... | import numpy as np
h, w = list(map(int, input().split()))
a = np.array([list(eval(input())) for i in range(h)])
a = a[:, ~np.all(a == ".", axis=0)]
a = a[~np.all(a == ".", axis=1)]
for i in range(len(a)):
print(("".join(a[i])))
| false | 58.823529 | [
"-",
"-def f(s):",
"- s = s.replace(\".\", \"0\")",
"- s = s.replace(\"#\", \"1\")",
"- lst = [int(n) for n in s]",
"- return np.array(lst)",
"-",
"-",
"-a = np.array([f(eval(input())) for i in range(h)])",
"-b = a[:, ~np.all(a == 0, axis=0)]",
"-ans_ = b[~np.all(a == 0, axis=1)]",
... | false | 0.18203 | 0.179688 | 1.013031 | [
"s728202550",
"s314598684"
] |
u499381410 | p02991 | python | s918759162 | s049617430 | 546 | 442 | 95,536 | 60,976 | Accepted | Accepted | 19.05 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 51 | 55 | 1,428 | 1,506 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | false | 7.272727 | [
"-INF = float(\"inf\")",
"+sys.setrecursionlimit(2147483647)",
"+INF = 10**20",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return list(map(int, sys.stdin.buffer.readline().split()))",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"- ... | false | 0.037651 | 0.101271 | 0.371782 | [
"s918759162",
"s049617430"
] |
u638456847 | p03031 | python | s434675690 | s212294848 | 47 | 33 | 3,064 | 3,064 | Accepted | Accepted | 29.79 | N,M = list(map(int, input().split()))
s = [[int(i) for i in input().split()] for j in range(M)]
p = [int(i) for i in input().split()]
ans = 0
for i in range(2**N):
switch = [0]*N
for j in range(N):
if ((i >> j) & 1 ):
switch[j] += 1
on = 0
for k in range(M):
coun... | from itertools import product
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M = list(map(int, readline().split()))
S = [[int(i) for i in readline().split()] for _ in range(M)]
P = [int(i) for i in readline().split()]
ans = 0
... | 22 | 29 | 531 | 655 | N, M = list(map(int, input().split()))
s = [[int(i) for i in input().split()] for j in range(M)]
p = [int(i) for i in input().split()]
ans = 0
for i in range(2**N):
switch = [0] * N
for j in range(N):
if (i >> j) & 1:
switch[j] += 1
on = 0
for k in range(M):
count = 0
... | from itertools import product
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M = list(map(int, readline().split()))
S = [[int(i) for i in readline().split()] for _ in range(M)]
P = [int(i) for i in readline().split()]
ans = 0
A = [[0,... | false | 24.137931 | [
"-N, M = list(map(int, input().split()))",
"-s = [[int(i) for i in input().split()] for j in range(M)]",
"-p = [int(i) for i in input().split()]",
"-ans = 0",
"-for i in range(2**N):",
"- switch = [0] * N",
"- for j in range(N):",
"- if (i >> j) & 1:",
"- switch[j] += 1",
"... | false | 0.108469 | 0.045094 | 2.405401 | [
"s434675690",
"s212294848"
] |
u564589929 | p02832 | python | s735610507 | s223887921 | 102 | 89 | 25,372 | 24,744 | Accepted | Accepted | 12.75 | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
next_ = 1
cnt = 0
for i in A:
if i == next_:
next_ += 1
else:
cnt += 1
if cnt == n:
cnt = -1
print(cnt) | n = int(eval(input()))
A = list(map(int, input().split()))
next_ = 1
cnt = 0
for i in A:
if i == next_:
next_ += 1
else:
cnt += 1
if cnt == n:
cnt = -1
print(cnt) | 14 | 13 | 215 | 183 | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
next_ = 1
cnt = 0
for i in A:
if i == next_:
next_ += 1
else:
cnt += 1
if cnt == n:
cnt = -1
print(cnt)
| n = int(eval(input()))
A = list(map(int, input().split()))
next_ = 1
cnt = 0
for i in A:
if i == next_:
next_ += 1
else:
cnt += 1
if cnt == n:
cnt = -1
print(cnt)
| false | 7.142857 | [
"-from collections import deque",
"-",
"-A = deque(list(map(int, input().split())))",
"+A = list(map(int, input().split()))"
] | false | 0.097169 | 0.043707 | 2.223209 | [
"s735610507",
"s223887921"
] |
u279493135 | p03054 | python | s714845238 | s752715087 | 222 | 177 | 5,972 | 6,100 | Accepted | Accepted | 20.27 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | 66 | 54 | 1,440 | 1,268 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | false | 18.181818 | [
"-x = sc",
"-for s, t in zip(S, T): # 左を目指す",
"+l, r, u, d = 1, W, 1, H",
"+for s, t in zip(S[::-1], T[::-1]):",
"+ if t == \"L\":",
"+ r = min(r + 1, W)",
"+ elif t == \"R\":",
"+ l = max(l - 1, 1)",
"+ elif t == \"U\":",
"+ d = min(d + 1, H)",
"+ elif t == \"D... | false | 0.042186 | 0.043002 | 0.981017 | [
"s714845238",
"s752715087"
] |
u894258749 | p03096 | python | s460742635 | s241868890 | 838 | 624 | 62,356 | 33,132 | Accepted | Accepted | 25.54 | from collections import defaultdict
M = 10**9 + 7
N = int(eval(input()))
C = [0]*N
for i in range(N):
C[i] = int(eval(input()))
class increment:
def __init__(self, start=0):
self.index = start-1
def __call__(self):
self.index += 1
return self.index
ui = defaultdic... | from collections import defaultdict
M = 10**9 + 7
N = int(eval(input()))
C = [0]*N
for i in range(N):
C[i] = int(eval(input()))
P = [0]*N
Q = [0]*N
QS = defaultdict(int)
Q[0] = QS[C[0]] = 1
for i in range(1,N):
if C[i] == C[i-1]:
Q[i] = 0
else:
Q[i] = (P[i-1] + Q[i-1]) % M
... | 43 | 22 | 777 | 398 | from collections import defaultdict
M = 10**9 + 7
N = int(eval(input()))
C = [0] * N
for i in range(N):
C[i] = int(eval(input()))
class increment:
def __init__(self, start=0):
self.index = start - 1
def __call__(self):
self.index += 1
return self.index
ui = defaultdict(incremen... | from collections import defaultdict
M = 10**9 + 7
N = int(eval(input()))
C = [0] * N
for i in range(N):
C[i] = int(eval(input()))
P = [0] * N
Q = [0] * N
QS = defaultdict(int)
Q[0] = QS[C[0]] = 1
for i in range(1, N):
if C[i] == C[i - 1]:
Q[i] = 0
else:
Q[i] = (P[i - 1] + Q[i - 1]) % M
... | false | 48.837209 | [
"-",
"-",
"-class increment:",
"- def __init__(self, start=0):",
"- self.index = start - 1",
"-",
"- def __call__(self):",
"- self.index += 1",
"- return self.index",
"-",
"-",
"-ui = defaultdict(increment())",
"-clists = []",
"-Nc = 0",
"-for i in range(N):",
... | false | 0.038946 | 0.038097 | 1.022268 | [
"s460742635",
"s241868890"
] |
u303059352 | p03012 | python | s367609679 | s456117233 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n = int(eval(input()))
w = list(map(int, input().split()))
ans = 10000000000
for t in range(1, n):
left, right = 0, 0
for i in range(t):
left += w[i]
for i in range(t, n):
right += w[i]
ans = min(ans, abs(left - right))
print(ans)
| n = int(eval(input()))
w = list(map(int, input().split()))
ans = 10000000000
for t in range(1, n):
left = sum(w[:t])
right = sum(w[t:])
ans = min(ans, abs(left - right))
print(ans)
| 11 | 8 | 267 | 194 | n = int(eval(input()))
w = list(map(int, input().split()))
ans = 10000000000
for t in range(1, n):
left, right = 0, 0
for i in range(t):
left += w[i]
for i in range(t, n):
right += w[i]
ans = min(ans, abs(left - right))
print(ans)
| n = int(eval(input()))
w = list(map(int, input().split()))
ans = 10000000000
for t in range(1, n):
left = sum(w[:t])
right = sum(w[t:])
ans = min(ans, abs(left - right))
print(ans)
| false | 27.272727 | [
"- left, right = 0, 0",
"- for i in range(t):",
"- left += w[i]",
"- for i in range(t, n):",
"- right += w[i]",
"+ left = sum(w[:t])",
"+ right = sum(w[t:])"
] | false | 0.070366 | 0.069146 | 1.017642 | [
"s367609679",
"s456117233"
] |
u648212584 | p03208 | python | s703128517 | s113523305 | 302 | 123 | 14,928 | 7,384 | Accepted | Accepted | 59.27 | N,K = list(map(int,input().split()))
height = []
for i in range(N):
height.append(int(eval(input())))
height.sort()
dif = [0]*(N-1)
for i in range(N-1):
dif[i] = height[i+1]-height[i]
diflist = [dif[0]]*(N-1)
for i in range(1,N-1):
diflist[i] = diflist[i-1] + dif[i]
diflist.inse... | import sys
input = sys.stdin.readline
def main():
N,K = list(map(int,input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
ans = 10**10
for i in range(N-K+1):
ans = min(ans,h[K+i-1]-h[i])
print(ans)
if __name__ == "__main__":
main()
| 22 | 16 | 427 | 308 | N, K = list(map(int, input().split()))
height = []
for i in range(N):
height.append(int(eval(input())))
height.sort()
dif = [0] * (N - 1)
for i in range(N - 1):
dif[i] = height[i + 1] - height[i]
diflist = [dif[0]] * (N - 1)
for i in range(1, N - 1):
diflist[i] = diflist[i - 1] + dif[i]
diflist.insert(0, 0)... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
ans = 10**10
for i in range(N - K + 1):
ans = min(ans, h[K + i - 1] - h[i])
print(ans)
if __name__ == "__main__":
main()
| false | 27.272727 | [
"-N, K = list(map(int, input().split()))",
"-height = []",
"-for i in range(N):",
"- height.append(int(eval(input())))",
"-height.sort()",
"-dif = [0] * (N - 1)",
"-for i in range(N - 1):",
"- dif[i] = height[i + 1] - height[i]",
"-diflist = [dif[0]] * (N - 1)",
"-for i in range(1, N - 1):",... | false | 0.038354 | 0.038366 | 0.999675 | [
"s703128517",
"s113523305"
] |
u585482323 | p03061 | python | s670014373 | s915393713 | 1,734 | 1,588 | 68,332 | 123,996 | Accepted | Accepted | 8.42 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | import operator
class SegmentTree:
def __init__(self, size, default, op = operator.add):
self.size = 1
while self.size < size:
self.size *= 2
self.dat = [default]*(self.size*2-1)
self.op = op
def update(self, i, x):
i += self.size - 1
self.... | 102 | 60 | 2,049 | 1,532 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | import operator
class SegmentTree:
def __init__(self, size, default, op=operator.add):
self.size = 1
while self.size < size:
self.size *= 2
self.dat = [default] * (self.size * 2 - 1)
self.op = op
def update(self, i, x):
i += self.size - 1
self.dat[i... | false | 41.176471 | [
"-#!usr/bin/env python3",
"-from collections import defaultdict",
"-from collections import deque",
"-from heapq import heappush, heappop",
"-import sys",
"-import math",
"-import bisect",
"-import random",
"+import operator",
"-def LI():",
"- return list(map(int, sys.stdin.readline().split()... | false | 0.10167 | 0.11987 | 0.848163 | [
"s670014373",
"s915393713"
] |
u033606236 | p03309 | python | s359892732 | s390236218 | 303 | 213 | 98,516 | 26,020 | Accepted | Accepted | 29.7 | n = int(eval(input()))
ary = list(map(int,input().split()))
a = []
ans = 0
for i in range(n):
a += [ary[i] - (i+1)]
a.sort()
if n % 2 == 1:
b = a[-(-n // 2)-1]
for i in range(n):
ans += abs(a[i] - b)
else:
b = (a[n//2-1]+a[n//2])//2
for i in range(n):
ans += abs(a[i] - ... | n = int(eval(input()))
ary = sorted([j-(i+1) for i,j in enumerate(map(int,input().split()))])
if len(ary) % 2 == 0:
a = (ary[len(ary)//2]+ary[len(ary)//2-1])//2
ans = 0
for i in ary:
ans += abs(i - a)
else:
a = ary[len(ary)//2]
ans = 0
for i in ary:
ans += abs(i - a)
... | 16 | 13 | 328 | 324 | n = int(eval(input()))
ary = list(map(int, input().split()))
a = []
ans = 0
for i in range(n):
a += [ary[i] - (i + 1)]
a.sort()
if n % 2 == 1:
b = a[-(-n // 2) - 1]
for i in range(n):
ans += abs(a[i] - b)
else:
b = (a[n // 2 - 1] + a[n // 2]) // 2
for i in range(n):
ans += abs(a[i] -... | n = int(eval(input()))
ary = sorted([j - (i + 1) for i, j in enumerate(map(int, input().split()))])
if len(ary) % 2 == 0:
a = (ary[len(ary) // 2] + ary[len(ary) // 2 - 1]) // 2
ans = 0
for i in ary:
ans += abs(i - a)
else:
a = ary[len(ary) // 2]
ans = 0
for i in ary:
ans += abs(i... | false | 18.75 | [
"-ary = list(map(int, input().split()))",
"-a = []",
"-ans = 0",
"-for i in range(n):",
"- a += [ary[i] - (i + 1)]",
"-a.sort()",
"-if n % 2 == 1:",
"- b = a[-(-n // 2) - 1]",
"- for i in range(n):",
"- ans += abs(a[i] - b)",
"+ary = sorted([j - (i + 1) for i, j in enumerate(map(... | false | 0.036856 | 0.036004 | 1.023659 | [
"s359892732",
"s390236218"
] |
u763177133 | p02958 | python | s848497371 | s993179520 | 30 | 26 | 9,100 | 9,088 | Accepted | Accepted | 13.33 | n = eval(input())
p = list(map(int,input().split()))
ps = sorted(p)
d_p = []
d_ps = []
for i,q in enumerate(p):
if q != ps[i]:
d_p.append(q)
d_ps.append(ps[i])
if len(d_p) > 2:
print('NO')
elif len(d_p) == 2:
d_p.sort()
if d_p == d_ps:
print('YES')
else:
print('NO')
else:
... | n = eval(input())
p = list(map(int,input().split()))
ps = sorted(p)
count = 0
for q, qs in zip(p, ps):
if q != qs:
count += 1
print(('YES' if count <= 2 else 'NO')) | 21 | 11 | 329 | 179 | n = eval(input())
p = list(map(int, input().split()))
ps = sorted(p)
d_p = []
d_ps = []
for i, q in enumerate(p):
if q != ps[i]:
d_p.append(q)
d_ps.append(ps[i])
if len(d_p) > 2:
print("NO")
elif len(d_p) == 2:
d_p.sort()
if d_p == d_ps:
print("YES")
else:
print("NO")... | n = eval(input())
p = list(map(int, input().split()))
ps = sorted(p)
count = 0
for q, qs in zip(p, ps):
if q != qs:
count += 1
print(("YES" if count <= 2 else "NO"))
| false | 47.619048 | [
"-d_p = []",
"-d_ps = []",
"-for i, q in enumerate(p):",
"- if q != ps[i]:",
"- d_p.append(q)",
"- d_ps.append(ps[i])",
"-if len(d_p) > 2:",
"- print(\"NO\")",
"-elif len(d_p) == 2:",
"- d_p.sort()",
"- if d_p == d_ps:",
"- print(\"YES\")",
"- else:",
"-... | false | 0.057183 | 0.092265 | 0.619764 | [
"s848497371",
"s993179520"
] |
u648881683 | p02803 | python | s998692452 | s139684342 | 488 | 348 | 3,444 | 3,444 | Accepted | Accepted | 28.69 | from collections import deque
import itertools
import copy
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
def solve(s):
M = copy.deepcopy(S)
d = ((1, 0), (-1, 0), (0, -1), (0, 1))
queue = deque([s])
steps = [[-1 for _ in range(W)] for _ in range(H)]
... | from collections import deque
import itertools
import copy
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
def solve(s):
d = ((1, 0), (-1, 0), (0, -1), (0, 1))
queue = deque([s])
steps = [[-1 for _ in range(W)] for _ in range(H)]
steps[s[0]][s[1]] = 0
... | 36 | 33 | 1,019 | 913 | from collections import deque
import itertools
import copy
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
def solve(s):
M = copy.deepcopy(S)
d = ((1, 0), (-1, 0), (0, -1), (0, 1))
queue = deque([s])
steps = [[-1 for _ in range(W)] for _ in range(H)]
steps[s[0]]... | from collections import deque
import itertools
import copy
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
def solve(s):
d = ((1, 0), (-1, 0), (0, -1), (0, 1))
queue = deque([s])
steps = [[-1 for _ in range(W)] for _ in range(H)]
steps[s[0]][s[1]] = 0
while len(... | false | 8.333333 | [
"- M = copy.deepcopy(S)",
"- # M[cy][cx] = '#'",
"- # はみ出さないかつ通ってない",
"- if (0 <= ny < H and 0 <= nx < W) and M[ny][nx] == \".\" and steps[ny][nx] < 0:",
"- # if (0<=ny<H and 0<=nx<W) and M[ny][nx]!='#':",
"+ # はみ出さないかつ通路であるかつ通ってない",
"+ ... | false | 0.037479 | 0.037602 | 0.996743 | [
"s998692452",
"s139684342"
] |
u620084012 | p03127 | python | s573026529 | s860449207 | 87 | 76 | 15,020 | 14,480 | Accepted | Accepted | 12.64 | def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
N = int(eval(input()))
A = list(map(int,input().split()))
ans = A[0]
for k in range(1,N):
ans = gcd(ans,A[k])
print(ans) | import sys
def input():
return sys.stdin.readline()[:-1]
def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
def main():
N = int(eval(input()))
A = list(map(int,input().split()))
ans = A[0]
for e in A[1:]:
ans = gcd(ans,e)
print(ans)
if __name__ == '__main... | 10 | 17 | 195 | 331 | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for k in range(1, N):
ans = gcd(ans, A[k])
print(ans)
| import sys
def input():
return sys.stdin.readline()[:-1]
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for e in A[1:]:
ans = gcd(ans, e)
print(ans)
if __name__ == "__main__... | false | 41.176471 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-ans = A[0]",
"-for k in range(1, N):",
"- ans = gcd(ans, A[k])",
"-print(ans)",
"+def main():",
"+ N = int(eval(input())... | false | 0.039398 | 0.042953 | 0.917241 | [
"s573026529",
"s860449207"
] |
u607563136 | p02726 | python | s860166838 | s531983675 | 1,011 | 770 | 9,268 | 9,316 | Accepted | Accepted | 23.84 | n, x, y = list(map(int,input().split()))
cnt = 0
ans=[0]*n
for i in range(1,n+1):
for j in range(i+1,n+1):
d = min(j-i,abs(x-i)+abs(y-j)+1)
ans[d] += 1
for i in range(1,n):
print((ans[i])) | def main():
n, x, y = list(map(int,input().split()))
cnt = 0
ans=[0]*n
for i in range(1,n+1):
for j in range(i+1,n+1):
d = min(j-i,abs(x-i)+abs(y-j)+1)
ans[d] += 1
for i in range(1,n):
print((ans[i]))
if __name__ == "__main__":
ma... | 12 | 18 | 218 | 316 | n, x, y = list(map(int, input().split()))
cnt = 0
ans = [0] * n
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
d = min(j - i, abs(x - i) + abs(y - j) + 1)
ans[d] += 1
for i in range(1, n):
print((ans[i]))
| def main():
n, x, y = list(map(int, input().split()))
cnt = 0
ans = [0] * n
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
d = min(j - i, abs(x - i) + abs(y - j) + 1)
ans[d] += 1
for i in range(1, n):
print((ans[i]))
if __name__ == "__main__":
m... | false | 33.333333 | [
"-n, x, y = list(map(int, input().split()))",
"-cnt = 0",
"-ans = [0] * n",
"-for i in range(1, n + 1):",
"- for j in range(i + 1, n + 1):",
"- d = min(j - i, abs(x - i) + abs(y - j) + 1)",
"- ans[d] += 1",
"-for i in range(1, n):",
"- print((ans[i]))",
"+def main():",
"+ ... | false | 0.036674 | 0.041571 | 0.882183 | [
"s860166838",
"s531983675"
] |
u848535504 | p02658 | python | s221985053 | s290645834 | 62 | 57 | 21,688 | 21,576 | Accepted | Accepted | 8.06 | N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
for i in range(N):
ans *= A[i]
if ans > 10**18:
ans = -1
break
if 0 in A:
print((0))
else:
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
if 0 in A:
print((0))
exit(0)
ans = 1
for i in A:
ans *= i
if ans > 10**18:
print((-1))
exit(0)
print(ans) | 14 | 15 | 194 | 203 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
for i in range(N):
ans *= A[i]
if ans > 10**18:
ans = -1
break
if 0 in A:
print((0))
else:
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
if 0 in A:
print((0))
exit(0)
ans = 1
for i in A:
ans *= i
if ans > 10**18:
print((-1))
exit(0)
print(ans)
| false | 6.666667 | [
"-ans = 1",
"-for i in range(N):",
"- ans *= A[i]",
"- if ans > 10**18:",
"- ans = -1",
"- break",
"-else:",
"- print(ans)",
"+ exit(0)",
"+ans = 1",
"+for i in A:",
"+ ans *= i",
"+ if ans > 10**18:",
"+ print((-1))",
"+ exit(0)",
"+print(... | false | 0.041292 | 0.123566 | 0.334174 | [
"s221985053",
"s290645834"
] |
u948524308 | p04034 | python | s696445105 | s357586155 | 409 | 348 | 13,172 | 4,596 | Accepted | Accepted | 14.91 | N, M = list(map(int, input().split()))
B = [[1, 0] for i in range(N)]
B[0][1] = 1
for i in range(M):
x, y = list(map(int, input().split()))
if B[x - 1][1] == 1:
B[y - 1][1] = 1
B[x - 1][0] -= 1
B[y - 1][0] += 1
if B[x - 1][0] == 0:
B[x - 1][1] = 0
cnt = 0
for i in... | N, M = list(map(int, input().split()))
B = [1]*N
R=[0]*N
R[0]=1
for i in range(M):
x, y = list(map(int, input().split()))
x-=1
y-=1
if R[x] == 1:
R[y] = 1
B[x] -= 1
B[y] += 1
if B[x] == 0:
R[x] = 0
print((sum(R)))
| 21 | 19 | 373 | 266 | N, M = list(map(int, input().split()))
B = [[1, 0] for i in range(N)]
B[0][1] = 1
for i in range(M):
x, y = list(map(int, input().split()))
if B[x - 1][1] == 1:
B[y - 1][1] = 1
B[x - 1][0] -= 1
B[y - 1][0] += 1
if B[x - 1][0] == 0:
B[x - 1][1] = 0
cnt = 0
for i in range(N):
if B[... | N, M = list(map(int, input().split()))
B = [1] * N
R = [0] * N
R[0] = 1
for i in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if R[x] == 1:
R[y] = 1
B[x] -= 1
B[y] += 1
if B[x] == 0:
R[x] = 0
print((sum(R)))
| false | 9.52381 | [
"-B = [[1, 0] for i in range(N)]",
"-B[0][1] = 1",
"+B = [1] * N",
"+R = [0] * N",
"+R[0] = 1",
"- if B[x - 1][1] == 1:",
"- B[y - 1][1] = 1",
"- B[x - 1][0] -= 1",
"- B[y - 1][0] += 1",
"- if B[x - 1][0] == 0:",
"- B[x - 1][1] = 0",
"-cnt = 0",
"-for i in range(N):... | false | 0.06677 | 0.073355 | 0.910224 | [
"s696445105",
"s357586155"
] |
u707498674 | p03229 | python | s164136799 | s128860870 | 740 | 592 | 64,600 | 58,072 | Accepted | Accepted | 20 | from collections import deque
def main():
N = int(eval(input()))
A = deque(sorted((int(eval(input())) for i in range(N))))
dq = deque()
dq.append(A.popleft())
for _ in range(N-1):
a_first = A[0]
a_last = A[-1]
dq_first = dq[0]
dq_last = dq[-1]
f... | from collections import deque
def main():
N = int(eval(input()))
A = deque(sorted((int(eval(input())) for i in range(N))))
dq = deque()
dq.append(A.popleft())
ans = 0
for _ in range(N-1):
a_first = A[0]
a_last = A[-1]
dq_first = dq[0]
dq_last = dq[-1]... | 33 | 37 | 895 | 932 | from collections import deque
def main():
N = int(eval(input()))
A = deque(sorted((int(eval(input())) for i in range(N))))
dq = deque()
dq.append(A.popleft())
for _ in range(N - 1):
a_first = A[0]
a_last = A[-1]
dq_first = dq[0]
dq_last = dq[-1]
ff = abs(a_f... | from collections import deque
def main():
N = int(eval(input()))
A = deque(sorted((int(eval(input())) for i in range(N))))
dq = deque()
dq.append(A.popleft())
ans = 0
for _ in range(N - 1):
a_first = A[0]
a_last = A[-1]
dq_first = dq[0]
dq_last = dq[-1]
... | false | 10.810811 | [
"+ ans = 0",
"+ ans += ff",
"+ ans += fl",
"+ ans += lf",
"+ ans += ll",
"- abs_sum = sum([abs(dq[i] - dq[i - 1]) for i in range(1, N)])",
"- print(abs_sum)",
"+ print(ans)"
] | false | 0.108593 | 0.138561 | 0.78372 | [
"s164136799",
"s128860870"
] |
u013629972 | p03211 | python | s811002250 | s352577701 | 53 | 48 | 5,952 | 5,836 | Accepted | Accepted | 9.43 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)... | 34 | 33 | 1,003 | 944 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | false | 2.941176 | [
"- r = min(abs(753 - int(S[i : i + 3])), abs(int(S[i : i + 3]) - 753))",
"- if r < result:",
"- result = r",
"+ result = min(abs(753 - int(S[i : i + 3])), result)"
] | false | 0.008493 | 0.074687 | 0.11372 | [
"s811002250",
"s352577701"
] |
u033606236 | p03862 | python | s018512745 | s590906936 | 163 | 147 | 14,052 | 14,540 | Accepted | Accepted | 9.82 | n,x = list(map(int,input().split()))
a = list(map(int,input().split()))
count= 0
for i in range(n-1):
count += max(0,a[i]+a[i+1]-x)
if a[i]+a[i+1] > x :
if (a[i]+a[i+1]-x) > a[i+1]:
a[i+1] = 0
else:
a[i+1] -= (a[i]+a[i+1]-x)
print(count) | n,x = list(map(int,input().split()))
a = list(map(int,input().split()))
ans,count=0,0
for i in range(n-1):
count = max(0,a[i]+a[i+1]-x)
a[i+1] -= min(a[i+1],count)
ans += count
print(ans) | 11 | 8 | 289 | 200 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 0
for i in range(n - 1):
count += max(0, a[i] + a[i + 1] - x)
if a[i] + a[i + 1] > x:
if (a[i] + a[i + 1] - x) > a[i + 1]:
a[i + 1] = 0
else:
a[i + 1] -= a[i] + a[i + 1] - x
print(count)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans, count = 0, 0
for i in range(n - 1):
count = max(0, a[i] + a[i + 1] - x)
a[i + 1] -= min(a[i + 1], count)
ans += count
print(ans)
| false | 27.272727 | [
"-count = 0",
"+ans, count = 0, 0",
"- count += max(0, a[i] + a[i + 1] - x)",
"- if a[i] + a[i + 1] > x:",
"- if (a[i] + a[i + 1] - x) > a[i + 1]:",
"- a[i + 1] = 0",
"- else:",
"- a[i + 1] -= a[i] + a[i + 1] - x",
"-print(count)",
"+ count = max(0, a[i... | false | 0.043883 | 0.038329 | 1.144894 | [
"s018512745",
"s590906936"
] |
u893063840 | p03682 | python | s276106398 | s158706247 | 1,528 | 1,307 | 92,032 | 82,400 | Accepted | Accepted | 14.46 | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
from operator import itemgetter
n = int(eval(input()))
xy = [list(map(int, input().split())) + [i] for i in range(n)]
edge = set()
for key in (itemgetter(0), itemgetter(1)):
xy.sort(key=key)
for (x1, y1, i1), ... | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
from operator import itemgetter
n = int(eval(input()))
xy = [list(map(int, input().split())) + [i] for i in range(n)]
edge = set()
for key in (itemgetter(0), itemgetter(1)):
xy.sort(key=key)
for (x1, y1, i1), ... | 20 | 20 | 600 | 589 | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
from operator import itemgetter
n = int(eval(input()))
xy = [list(map(int, input().split())) + [i] for i in range(n)]
edge = set()
for key in (itemgetter(0), itemgetter(1)):
xy.sort(key=key)
for (x1, y1, i1), (x2, y2, i2... | from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
from operator import itemgetter
n = int(eval(input()))
xy = [list(map(int, input().split())) + [i] for i in range(n)]
edge = set()
for key in (itemgetter(0), itemgetter(1)):
xy.sort(key=key)
for (x1, y1, i1), (x2, y2, i2... | false | 0 | [
"-graph = csr_matrix((c, (u, v)), shape=(n, n), dtype=int)",
"+graph = csr_matrix((c, (u, v)), shape=(n, n))"
] | false | 0.501027 | 0.948106 | 0.528451 | [
"s276106398",
"s158706247"
] |
u969211566 | p03835 | python | s568641970 | s555602136 | 1,875 | 1,729 | 2,940 | 2,940 | Accepted | Accepted | 7.79 | k,s = list(map(int,input().split()))
count = 0
k = k+1
for x in range(k):
for y in range(k):
if s - (x + y) <= k - 1 and s - (x + y) >= 0:
count += 1
print(count) | k,s = list(map(int,input().split()))
cnt = 0
for x in range(k+1):
for y in range(k+1):
if s - x - y <= k and s - x - y >= 0:
cnt += 1
print(cnt)
| 9 | 8 | 197 | 159 | k, s = list(map(int, input().split()))
count = 0
k = k + 1
for x in range(k):
for y in range(k):
if s - (x + y) <= k - 1 and s - (x + y) >= 0:
count += 1
print(count)
| k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
for y in range(k + 1):
if s - x - y <= k and s - x - y >= 0:
cnt += 1
print(cnt)
| false | 11.111111 | [
"-count = 0",
"-k = k + 1",
"-for x in range(k):",
"- for y in range(k):",
"- if s - (x + y) <= k - 1 and s - (x + y) >= 0:",
"- count += 1",
"-print(count)",
"+cnt = 0",
"+for x in range(k + 1):",
"+ for y in range(k + 1):",
"+ if s - x - y <= k and s - x - y >= 0... | false | 0.048067 | 0.045076 | 1.066373 | [
"s568641970",
"s555602136"
] |
u947883560 | p02902 | python | s641192713 | s915749786 | 116 | 43 | 70,568 | 9,688 | Accepted | Accepted | 62.93 | import sys
from collections import deque
# https://atcoder.jp/contests/abc142/submissions/7764934
# ほぼまんま。
def main():
N, M = map(int, input().split())
E = [set() for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
E[a-1].add(b-1)
# スタート地点は全て試す
for... | import sys
from collections import deque
def solve():
N, M = map(int, input().split())
edges = [set() for _ in range(N+1)]
for a, b in (map(int, line.split()) for line in sys.stdin):
edges[a].add(b)
# 答えが見つかるまで、スタート地点は全て試します
for start in range(1, N+1):
visited = [0]*(N... | 44 | 43 | 1,220 | 1,217 | import sys
from collections import deque
# https://atcoder.jp/contests/abc142/submissions/7764934
# ほぼまんま。
def main():
N, M = map(int, input().split())
E = [set() for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
E[a - 1].add(b - 1)
# スタート地点は全て試す
for start in ra... | import sys
from collections import deque
def solve():
N, M = map(int, input().split())
edges = [set() for _ in range(N + 1)]
for a, b in (map(int, line.split()) for line in sys.stdin):
edges[a].add(b)
# 答えが見つかるまで、スタート地点は全て試します
for start in range(1, N + 1):
visited = [0] * (N + 1)
... | false | 2.272727 | [
"-# https://atcoder.jp/contests/abc142/submissions/7764934",
"-# ほぼまんま。",
"-def main():",
"+",
"+def solve():",
"- E = [set() for _ in range(N)]",
"- for _ in range(M):",
"- a, b = map(int, input().split())",
"- E[a - 1].add(b - 1)",
"- # スタート地点は全て試す",
"- for start in r... | false | 0.159251 | 0.076832 | 2.072722 | [
"s641192713",
"s915749786"
] |
u065446124 | p03078 | python | s130457919 | s321530886 | 1,971 | 1,209 | 134,248 | 99,816 | Accepted | Accepted | 38.66 | x,y,z,k=list(map(int, input().split()))
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))
ab=[]
for i in range(x):
for j in range(y):
ab+=[a[i]+b[j]]
ab.sort(key=lambda x: -x)
c.sort(key=lambda x: -x)
ans=[]
ct=[0]
ansc=[ab[0]+c[0]]
while (len... | x,y,z,k=list(map(int, input().split()))
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))
ab=[]
for i in range(x):
for j in range(y):
ab.append(a[i]+b[j])
ab.sort(key=lambda x: -x)
c.sort(key=lambda x: -x)
ans=[]
ct=[0]
ansc=[ab[0]+c[0]]
while... | 26 | 26 | 609 | 614 | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = []
for i in range(x):
for j in range(y):
ab += [a[i] + b[j]]
ab.sort(key=lambda x: -x)
c.sort(key=lambda x: -x)
ans = []
ct = [0]
ansc = [ab[0] + c[0]... | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = []
for i in range(x):
for j in range(y):
ab.append(a[i] + b[j])
ab.sort(key=lambda x: -x)
c.sort(key=lambda x: -x)
ans = []
ct = [0]
ansc = [ab[0] + c... | false | 0 | [
"- ab += [a[i] + b[j]]",
"+ ab.append(a[i] + b[j])"
] | false | 0.036188 | 0.055332 | 0.654008 | [
"s130457919",
"s321530886"
] |
u353797797 | p03275 | python | s220800021 | s225121000 | 1,228 | 607 | 15,012 | 14,612 | Accepted | Accepted | 50.57 | n = int(eval(input()))
a = list(map(int, input().split()))
x = list(sorted(set(a)))
n_sub = n * (n + 1) // 2
Li = 0
Ri = len(x)
while Ri > Li + 1:
i = (Li + Ri) // 2
xi = x[i]
UorD = [1 if ak >= xi else -1 for ak in a]
cnt_sum = [0] * (2 * n + 1)
cumsum = 0
cnt_sum[cumsum + n] = 1
... | def f(n, a):
x = list(sorted(set(a)))
n_sub_half = n * (n + 1) // 2 // 2
n_plus_minus = n * 2 + 1
Li = 0
Ri = len(x)
while Ri > Li + 1:
i = (Li + Ri) // 2
xi = x[i]
cnt_sum = [0] * n_plus_minus
cumsum = 0
cnt_sum[cumsum] = 1
judge = 0
... | 29 | 34 | 672 | 810 | n = int(eval(input()))
a = list(map(int, input().split()))
x = list(sorted(set(a)))
n_sub = n * (n + 1) // 2
Li = 0
Ri = len(x)
while Ri > Li + 1:
i = (Li + Ri) // 2
xi = x[i]
UorD = [1 if ak >= xi else -1 for ak in a]
cnt_sum = [0] * (2 * n + 1)
cumsum = 0
cnt_sum[cumsum + n] = 1
judge = 0
... | def f(n, a):
x = list(sorted(set(a)))
n_sub_half = n * (n + 1) // 2 // 2
n_plus_minus = n * 2 + 1
Li = 0
Ri = len(x)
while Ri > Li + 1:
i = (Li + Ri) // 2
xi = x[i]
cnt_sum = [0] * n_plus_minus
cumsum = 0
cnt_sum[cumsum] = 1
judge = 0
s = 0... | false | 14.705882 | [
"+def f(n, a):",
"+ x = list(sorted(set(a)))",
"+ n_sub_half = n * (n + 1) // 2 // 2",
"+ n_plus_minus = n * 2 + 1",
"+ Li = 0",
"+ Ri = len(x)",
"+ while Ri > Li + 1:",
"+ i = (Li + Ri) // 2",
"+ xi = x[i]",
"+ cnt_sum = [0] * n_plus_minus",
"+ cums... | false | 0.046536 | 0.039245 | 1.185779 | [
"s220800021",
"s225121000"
] |
u894258749 | p03206 | python | s237613487 | s604267530 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | D = int(eval(input()))
if D==25:
print("Christmas")
elif D==24:
print("Christmas Eve")
elif D==23:
print("Christmas Eve Eve")
else:
print("Christmas Eve Eve Eve") | D = int(input())
print('Christmas', end='')
for _ in range(25-D):
print(' Eve', end='')
print()
| 9 | 5 | 180 | 100 | D = int(eval(input()))
if D == 25:
print("Christmas")
elif D == 24:
print("Christmas Eve")
elif D == 23:
print("Christmas Eve Eve")
else:
print("Christmas Eve Eve Eve")
| D = int(input())
print("Christmas", end="")
for _ in range(25 - D):
print(" Eve", end="")
print()
| false | 44.444444 | [
"-D = int(eval(input()))",
"-if D == 25:",
"- print(\"Christmas\")",
"-elif D == 24:",
"- print(\"Christmas Eve\")",
"-elif D == 23:",
"- print(\"Christmas Eve Eve\")",
"-else:",
"- print(\"Christmas Eve Eve Eve\")",
"+D = int(input())",
"+print(\"Christmas\", end=\"\")",
"+for _ i... | false | 0.06884 | 0.064333 | 1.070062 | [
"s237613487",
"s604267530"
] |
u745087332 | p03665 | python | s456961201 | s095430805 | 47 | 17 | 3,064 | 3,064 | Accepted | Accepted | 63.83 | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return eval... | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return eval... | 33 | 32 | 763 | 606 | # coding:utf-8
import sys
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
... | # coding:utf-8
import sys
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
... | false | 3.030303 | [
"- sum_a = sum(A)",
"- # dp[i][j]: a_iまでを使ってjを作る組み合わせの総数(iは省略)",
"- dp = [0] * (sum_a + 1)",
"- dp[0] = 1",
"- for i in range(n):",
"- for j in range(sum_a + 1)[::-1]:",
"- if j - A[i] < 0:",
"- break",
"- if dp[j - A[i]]:",
"- ... | false | 0.054102 | 0.036791 | 1.470516 | [
"s456961201",
"s095430805"
] |
u107915058 | p03611 | python | s150704886 | s692682532 | 97 | 82 | 22,412 | 20,616 | Accepted | Accepted | 15.46 | N = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0]*(10**6)
for i in a:
cnt[i-1] += 1
cnt[i] += 1
cnt[i+1] += 1
print((max(cnt))) | N = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0]*(10**5+2)
for i in a:
cnt[i-1] += 1
cnt[i] += 1
cnt[i+1] += 1
print((max(cnt))) | 8 | 8 | 157 | 159 | N = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0] * (10**6)
for i in a:
cnt[i - 1] += 1
cnt[i] += 1
cnt[i + 1] += 1
print((max(cnt)))
| N = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0] * (10**5 + 2)
for i in a:
cnt[i - 1] += 1
cnt[i] += 1
cnt[i + 1] += 1
print((max(cnt)))
| false | 0 | [
"-cnt = [0] * (10**6)",
"+cnt = [0] * (10**5 + 2)"
] | false | 0.17796 | 0.053604 | 3.319873 | [
"s150704886",
"s692682532"
] |
u285891772 | p02720 | python | s283062453 | s102004289 | 282 | 102 | 100,780 | 19,892 | Accepted | Accepted | 63.83 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 51 | 38 | 1,453 | 1,129 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 25.490196 | [
"- return int(input())",
"+ return int(eval(input()))",
"- return map(int, input().split())",
"+ return list(map(int, input().split()))",
"- return zip(*(MAP() for _ in range(n)))",
"+ return list(zip(*(MAP() for _ in range(n))))",
"-n = [-1] * 11",
"-cnt = 0",
"-",
"-",
"-def ... | false | 0.069922 | 0.056412 | 1.239479 | [
"s283062453",
"s102004289"
] |
u312025627 | p02885 | python | s080366315 | s706812134 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | def main():
A, B = (int(i) for i in input().split())
print((max(0, A - 2*B)))
if __name__ == '__main__':
main()
| def main():
a, b = (int(i) for i in input().split())
print((max(a - 2*b, 0)))
if __name__ == '__main__':
main()
| 7 | 7 | 130 | 130 | def main():
A, B = (int(i) for i in input().split())
print((max(0, A - 2 * B)))
if __name__ == "__main__":
main()
| def main():
a, b = (int(i) for i in input().split())
print((max(a - 2 * b, 0)))
if __name__ == "__main__":
main()
| false | 0 | [
"- A, B = (int(i) for i in input().split())",
"- print((max(0, A - 2 * B)))",
"+ a, b = (int(i) for i in input().split())",
"+ print((max(a - 2 * b, 0)))"
] | false | 0.043105 | 0.007082 | 6.086724 | [
"s080366315",
"s706812134"
] |
u562935282 | p02988 | python | s502470652 | s476366818 | 172 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.12 | n = int(eval(input()))
p = tuple(map(int, input().split()))
cnt = 0
for i in range(1, n - 2 + 1):
if (p[i - 1] < p[i] < p[i + 1]) or (p[i - 1] > p[i] > p[i + 1]):
cnt += 1
print(cnt)
| n = int(eval(input()))
p = tuple(map(int, input().split()))
print((len(tuple(
[x for x in zip(p, p[1:], p[2:]) if (x[0] < x[1] < x[2]) or (x[0] > x[1] > x[2])]
))))
| 8 | 8 | 197 | 196 | n = int(eval(input()))
p = tuple(map(int, input().split()))
cnt = 0
for i in range(1, n - 2 + 1):
if (p[i - 1] < p[i] < p[i + 1]) or (p[i - 1] > p[i] > p[i + 1]):
cnt += 1
print(cnt)
| n = int(eval(input()))
p = tuple(map(int, input().split()))
print(
(
len(
tuple(
[
x
for x in zip(p, p[1:], p[2:])
if (x[0] < x[1] < x[2]) or (x[0] > x[1] > x[2])
]
)
)
)
)
| false | 0 | [
"-cnt = 0",
"-for i in range(1, n - 2 + 1):",
"- if (p[i - 1] < p[i] < p[i + 1]) or (p[i - 1] > p[i] > p[i + 1]):",
"- cnt += 1",
"-print(cnt)",
"+print(",
"+ (",
"+ len(",
"+ tuple(",
"+ [",
"+ x",
"+ for x in... | false | 0.036689 | 0.071228 | 0.515096 | [
"s502470652",
"s476366818"
] |
u351754662 | p02393 | python | s345797082 | s545677700 | 30 | 20 | 5,600 | 5,584 | Accepted | Accepted | 33.33 | s = input().rstrip().split(' ')
a = int(s[0])
b = int(s[1])
c = int(s[2])
if a > b:
a,b = b,a
if b > c:
b,c = c,b
if a > b:
a,b = b,a
print((str(a) + " " + str(b) + " " + str(c)))
| a = list(map(int, input().split()))
a.sort()
print((a[0], a[1], a[2]))
| 11 | 4 | 200 | 73 | s = input().rstrip().split(" ")
a = int(s[0])
b = int(s[1])
c = int(s[2])
if a > b:
a, b = b, a
if b > c:
b, c = c, b
if a > b:
a, b = b, a
print((str(a) + " " + str(b) + " " + str(c)))
| a = list(map(int, input().split()))
a.sort()
print((a[0], a[1], a[2]))
| false | 63.636364 | [
"-s = input().rstrip().split(\" \")",
"-a = int(s[0])",
"-b = int(s[1])",
"-c = int(s[2])",
"-if a > b:",
"- a, b = b, a",
"-if b > c:",
"- b, c = c, b",
"-if a > b:",
"- a, b = b, a",
"-print((str(a) + \" \" + str(b) + \" \" + str(c)))",
"+a = list(map(int, input().split()))",
"+a.... | false | 0.04583 | 0.045738 | 1.002028 | [
"s345797082",
"s545677700"
] |
u968404618 | p02899 | python | s381872240 | s297007639 | 112 | 88 | 24,084 | 20,412 | Accepted | Accepted | 21.43 | n = int(eval(input()))
A = list(map(int, input().split()))
dic = {}
for i in range(n):
dic[A[i]] = i+1
ans = [dic[i+1] for i in range(n)]
print((*ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0]*N
for idx, a in enumerate(A):
ans[a-1] = idx+1
print((*ans)) | 10 | 7 | 165 | 132 | n = int(eval(input()))
A = list(map(int, input().split()))
dic = {}
for i in range(n):
dic[A[i]] = i + 1
ans = [dic[i + 1] for i in range(n)]
print((*ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * N
for idx, a in enumerate(A):
ans[a - 1] = idx + 1
print((*ans))
| false | 30 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-dic = {}",
"-for i in range(n):",
"- dic[A[i]] = i + 1",
"-ans = [dic[i + 1] for i in range(n)]",
"+ans = [0] * N",
"+for idx, a in enumerate(A):",
"+ ans[a - 1] = idx + 1"
] | false | 0.033543 | 0.038248 | 0.876984 | [
"s381872240",
"s297007639"
] |
u869919400 | p03546 | python | s288032815 | s590672867 | 197 | 84 | 40,556 | 73,576 | Accepted | Accepted | 57.36 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(H):
... | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(H):
... | 16 | 16 | 409 | 410 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(H):
for j in ra... | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(H):
for j in ra... | false | 0 | [
"-C = [list(map(int, input().split())) for _ in range(10)]",
"-A = [list(map(int, input().split())) for _ in range(H)]",
"+C = [list(map(int, input().split())) for i in range(10)]",
"+A = [list(map(int, input().split())) for i in range(H)]"
] | false | 0.035909 | 0.042106 | 0.852823 | [
"s288032815",
"s590672867"
] |
u539367121 | p02689 | python | s850144848 | s621785417 | 426 | 372 | 39,680 | 39,744 | Accepted | Accepted | 12.68 | N, M = list(map(int, input().split()))
H = [int(h) for h in input().split()]
AB = []
AB = [[int(x) for x in input().split()] for m in range(M)]
Observatory=[[] for n in range(N+1)]
for a, b in AB:
Observatory[a].append(b)
Observatory[b].append(a)
#print(Observatory)
ans=0
for i, o in enumerate(Observato... | N, M = list(map(int, input().split()))
H = [0]+[int(h) for h in input().split()]
AB=[[] for n in range(N+1)]
for a, b in [[int(x) for x in input().split()] for m in range(M)]:
AB[a].append(b)
AB[b].append(a)
#print(AB)
ans=0
for i, ab in enumerate(AB):
# rule2
if not len(ab):
ans+=0
# ru... | 24 | 22 | 496 | 435 | N, M = list(map(int, input().split()))
H = [int(h) for h in input().split()]
AB = []
AB = [[int(x) for x in input().split()] for m in range(M)]
Observatory = [[] for n in range(N + 1)]
for a, b in AB:
Observatory[a].append(b)
Observatory[b].append(a)
# print(Observatory)
ans = 0
for i, o in enumerate(Observator... | N, M = list(map(int, input().split()))
H = [0] + [int(h) for h in input().split()]
AB = [[] for n in range(N + 1)]
for a, b in [[int(x) for x in input().split()] for m in range(M)]:
AB[a].append(b)
AB[b].append(a)
# print(AB)
ans = 0
for i, ab in enumerate(AB):
# rule2
if not len(ab):
ans += 0
... | false | 8.333333 | [
"-H = [int(h) for h in input().split()]",
"-AB = []",
"-AB = [[int(x) for x in input().split()] for m in range(M)]",
"-Observatory = [[] for n in range(N + 1)]",
"-for a, b in AB:",
"- Observatory[a].append(b)",
"- Observatory[b].append(a)",
"-# print(Observatory)",
"+H = [0] + [int(h) for h i... | false | 0.041584 | 0.041462 | 1.002923 | [
"s850144848",
"s621785417"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.