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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u077291787 | p03497 | python | s384534260 | s723190677 | 200 | 95 | 33,696 | 32,572 | Accepted | Accepted | 52.5 | # ARC086C - Not so Diverse (ABC081C)
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
if i not in dic:
dic[i] = 1
else:
dic[i] += 1
cnt = sorted([i for i in list(dic.values())], reverse=True)
print((sum(cnt[... | from collections import Counter
n, k = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
cnt = sorted(list(Counter(lst).values()), reverse=True)
print((sum(cnt[k:]))) | 12 | 6 | 318 | 202 | # ARC086C - Not so Diverse (ABC081C)
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
if i not in dic:
dic[i] = 1
else:
dic[i] += 1
cnt = sorted([i for i in list(dic.values())], reverse=True)
print((sum(cnt[k:])))
| from collections import Counter
n, k = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
cnt = sorted(list(Counter(lst).values()), reverse=True)
print((sum(cnt[k:])))
| false | 50 | [
"-# ARC086C - Not so Diverse (ABC081C)",
"+from collections import Counter",
"+",
"-lst = sorted(list(map(int, input().rstrip().split())))",
"-dic = {}",
"-for i in lst:",
"- if i not in dic:",
"- dic[i] = 1",
"- else:",
"- dic[i] += 1",
"-cnt = sorted([i for i in list(dic.va... | false | 0.042404 | 0.102434 | 0.41396 | [
"s384534260",
"s723190677"
] |
u392319141 | p03912 | python | s473837892 | s521566700 | 342 | 306 | 35,160 | 35,932 | Accepted | Accepted | 10.53 | from collections import Counter
N, M = list(map(int, input().split()))
cntX = Counter(list(map(int, input().split())))
cntMod = Counter()
cntDup = Counter()
for x, c in list(cntX.items()):
cntMod[x % M] += c
cntDup[x % M] += c // 2
ans = 0
for n in range(M // 2 + 1):
m = (M - n) % M
if m ... | from collections import Counter
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
dupCnt = Counter()
modCnt = Counter()
for x, c in list(Counter(X).items()):
x %= M
dupCnt[x] += c // 2
modCnt[x] += c
ans = 0
for i in range(M):
j = M - i
if i > j:
... | 24 | 29 | 546 | 559 | from collections import Counter
N, M = list(map(int, input().split()))
cntX = Counter(list(map(int, input().split())))
cntMod = Counter()
cntDup = Counter()
for x, c in list(cntX.items()):
cntMod[x % M] += c
cntDup[x % M] += c // 2
ans = 0
for n in range(M // 2 + 1):
m = (M - n) % M
if m == n:
... | from collections import Counter
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
dupCnt = Counter()
modCnt = Counter()
for x, c in list(Counter(X).items()):
x %= M
dupCnt[x] += c // 2
modCnt[x] += c
ans = 0
for i in range(M):
j = M - i
if i > j:
break
if i == j... | false | 17.241379 | [
"-cntX = Counter(list(map(int, input().split())))",
"-cntMod = Counter()",
"-cntDup = Counter()",
"-for x, c in list(cntX.items()):",
"- cntMod[x % M] += c",
"- cntDup[x % M] += c // 2",
"+X = list(map(int, input().split()))",
"+dupCnt = Counter()",
"+modCnt = Counter()",
"+for x, c in list(... | false | 0.048604 | 0.049099 | 0.98993 | [
"s473837892",
"s521566700"
] |
u120691615 | p02831 | python | s785993745 | s789895647 | 55 | 17 | 2,940 | 2,940 | Accepted | Accepted | 69.09 | A,B = list(map(int,input().split()))
a,b = A,B
while True:
if a > b:
b += B
elif a < b:
a += A
if a == b:
print(a)
break | A,B = list(map(int,input().split()))
def gcd(a, b):
if a % b == 0:
return b
else:
return gcd(b, a % b)
def lcm(a, b):
return a / gcd(a, b) * b
print((int(lcm(A,B)))) | 10 | 12 | 167 | 199 | A, B = list(map(int, input().split()))
a, b = A, B
while True:
if a > b:
b += B
elif a < b:
a += A
if a == b:
print(a)
break
| A, B = list(map(int, input().split()))
def gcd(a, b):
if a % b == 0:
return b
else:
return gcd(b, a % b)
def lcm(a, b):
return a / gcd(a, b) * b
print((int(lcm(A, B))))
| false | 16.666667 | [
"-a, b = A, B",
"-while True:",
"- if a > b:",
"- b += B",
"- elif a < b:",
"- a += A",
"- if a == b:",
"- print(a)",
"- break",
"+",
"+",
"+def gcd(a, b):",
"+ if a % b == 0:",
"+ return b",
"+ else:",
"+ return gcd(b, a % b)",
... | false | 0.102311 | 0.107063 | 0.955614 | [
"s785993745",
"s789895647"
] |
u863442865 | p03625 | python | s889793287 | s748910323 | 117 | 101 | 14,764 | 14,756 | Accepted | Accepted | 13.68 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect import bisect_left... | def main():
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect import bisect_lef... | 39 | 37 | 1,006 | 964 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations
# from itertools import accumulate, product
from bisect import bisect_left, b... | def main():
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations
# from itertools import accumulate, product
from bisect import bisect_left,... | false | 5.128205 | [
"- input = sys.stdin.readline",
"+ # input = sys.stdin.readline",
"- if len(res2) == 0:",
"- print((0))",
"- elif len(res2) == 1:",
"+ if len(res2) < 2:"
] | false | 0.039281 | 0.007461 | 5.264583 | [
"s889793287",
"s748910323"
] |
u766684188 | p02901 | python | s865846228 | s976274194 | 548 | 476 | 145,756 | 141,020 | Accepted | Accepted | 13.14 | #E
import sys
input=sys.stdin.readline
def main():
n,m=list(map(int,input().split()))
Cost=[0]*m
Key=[0]*m
for i in range(m):
a,b=list(map(int,input().split()))
C=tuple(map(int,input().split()))
Cost[i]=a
for c in C:
Key[i]+=1<<(c-1)
#print(... | import sys
input=sys.stdin.readline
def main():
n,m=list(map(int,input().split()))
Cost=[0]*m
Key=[0]*m
for i in range(m):
a,b=list(map(int,input().split()))
C=tuple(map(int,input().split()))
Cost[i]=a
for c in C:
Key[i]+=1<<(c-1)
DP=[[float(... | 26 | 23 | 718 | 639 | # E
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
Cost = [0] * m
Key = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
C = tuple(map(int, input().split()))
Cost[i] = a
for c in C:
Key[i] += 1 << (... | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
Cost = [0] * m
Key = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
C = tuple(map(int, input().split()))
Cost[i] = a
for c in C:
Key[i] += 1 << (c - ... | false | 11.538462 | [
"-# E",
"- # print(Cost,Key)",
"+ DP[0][0] = 0",
"- DP[i + 1][k] = min(DP[i][k], c)",
"- for j in range(1, 1 << n):",
"+ for j in range(1 << n):",
"- DP[i + 1][j | k] = min(DP[i + 1][j | k], DP[i][j | k], DP[i][j] + c)",
"- # print(DP)",
"+ DP[... | false | 0.039662 | 0.087423 | 0.453676 | [
"s865846228",
"s976274194"
] |
u474561976 | p02683 | python | s403980861 | s406465201 | 53 | 30 | 11,544 | 9,220 | Accepted | Accepted | 43.4 | def main():
from sys import stdin
import itertools
n,m,x = list(map(int,stdin.readline().rstrip().split()))
mat = []
for _ in range(n):
temp = list(map(int,stdin.readline().rstrip().split()))
mat.append(temp)
sum = []
for i in range(n+1):
for l in iter... | import math
def solve(C,A,x,k,s,U):
if k == 0:
if min(U) >= x:
return s
else:
return math.inf
else:
s_use = s+C[k-1]
U_use = [u+a for u,a in zip(U,A[k-1])]
return min(solve(C,A,x,k-1,s,U),solve(C,A,x,k-1,s_use,U_use))
... | 33 | 31 | 796 | 693 | def main():
from sys import stdin
import itertools
n, m, x = list(map(int, stdin.readline().rstrip().split()))
mat = []
for _ in range(n):
temp = list(map(int, stdin.readline().rstrip().split()))
mat.append(temp)
sum = []
for i in range(n + 1):
for l in itertools.com... | import math
def solve(C, A, x, k, s, U):
if k == 0:
if min(U) >= x:
return s
else:
return math.inf
else:
s_use = s + C[k - 1]
U_use = [u + a for u, a in zip(U, A[k - 1])]
return min(solve(C, A, x, k - 1, s, U), solve(C, A, x, k - 1, s_use, U_use)... | false | 6.060606 | [
"+import math",
"+",
"+",
"+def solve(C, A, x, k, s, U):",
"+ if k == 0:",
"+ if min(U) >= x:",
"+ return s",
"+ else:",
"+ return math.inf",
"+ else:",
"+ s_use = s + C[k - 1]",
"+ U_use = [u + a for u, a in zip(U, A[k - 1])]",
"+ ... | false | 0.075795 | 0.093864 | 0.807497 | [
"s403980861",
"s406465201"
] |
u482789362 | p02710 | python | s982910726 | s320144791 | 1,791 | 1,560 | 461,932 | 446,452 | Accepted | Accepted | 12.9 | import sys
from collections import defaultdict
sys.setrecursionlimit(2 * 10 ** 5)
(N,) = [int(x) for x in input().split()]
colors = [int(x) for x in input().split()]
edges = [[int(x) for x in input().split()] for i in range(N - 1)]
graph = defaultdict(list)
for u, v in edges:
graph[u].append(v)
gra... | import sys
sys.setrecursionlimit(2 * 10 ** 5)
N = int(eval(input()))
colors = [int(x) for x in input().split()]
edges = [[int(x) for x in input().split()] for i in range(N - 1)]
graph = [[] for i in range(N + 1)]
for u, v in edges:
graph[u].append(v)
graph[v].append(u)
parent = {1: None}
children ... | 54 | 66 | 1,319 | 2,222 | import sys
from collections import defaultdict
sys.setrecursionlimit(2 * 10**5)
(N,) = [int(x) for x in input().split()]
colors = [int(x) for x in input().split()]
edges = [[int(x) for x in input().split()] for i in range(N - 1)]
graph = defaultdict(list)
for u, v in edges:
graph[u].append(v)
graph[v].append(u... | import sys
sys.setrecursionlimit(2 * 10**5)
N = int(eval(input()))
colors = [int(x) for x in input().split()]
edges = [[int(x) for x in input().split()] for i in range(N - 1)]
graph = [[] for i in range(N + 1)]
for u, v in edges:
graph[u].append(v)
graph[v].append(u)
parent = {1: None}
children = {}
def root... | false | 18.181818 | [
"-from collections import defaultdict",
"-(N,) = [int(x) for x in input().split()]",
"+N = int(eval(input()))",
"-graph = defaultdict(list)",
"+graph = [[] for i in range(N + 1)]",
"-children = defaultdict(list)",
"+children = {}",
"+ children[node] = []",
"+# Count the paths that don't contain a... | false | 0.033272 | 0.035229 | 0.944458 | [
"s982910726",
"s320144791"
] |
u079411907 | p02803 | python | s100718478 | s276211968 | 850 | 650 | 90,712 | 46,360 | Accepted | Accepted | 23.53 | '''input
3 3
.#.
#..
.#.
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
from collections import deque
def mp(arr):
arr = list(map(str, arr))
return ' '.join(arr)
def bfs(source):
myq = deque()
myq.append(source)
visited = dict()
visite... | '''input
3 3
.#.
#..
.#.
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
from collections import deque
def mp(arr):
arr = list(map(str, arr))
return ' '.join(arr)
def bfs(source):
myq = deque()
myq.append(source)
visited = dict()
visite... | 79 | 75 | 1,652 | 1,632 | """input
3 3
.#.
#..
.#.
"""
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
from collections import deque
def mp(arr):
arr = list(map(str, arr))
return " ".join(arr)
def bfs(source):
myq = deque()
myq.append(source)
visited = dict()
visited[mp... | """input
3 3
.#.
#..
.#.
"""
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
from collections import deque
def mp(arr):
arr = list(map(str, arr))
return " ".join(arr)
def bfs(source):
myq = deque()
myq.append(source)
visited = dict()
visited[mp... | false | 5.063291 | [
"- if x - 1 >= 0:",
"- if maze[x - 1][y] != \"#\" and mp([x - 1, y]) not in visited:",
"- visited[mp([x - 1, y])] = True",
"- temp.append([x - 1, y])",
"- if x + 1 < n:",
"- if maze[x + 1][y] != \"#\" and mp([x + 1, ... | false | 0.037072 | 0.037955 | 0.976747 | [
"s100718478",
"s276211968"
] |
u150984829 | p02397 | python | s037337671 | s074842659 | 50 | 40 | 5,612 | 5,980 | Accepted | Accepted | 20 | while 1:
n=input()
if n=='0 0':break
x,y=map(int,n.split())
print(y,x) if x>y else print(n)
| a=[]
while 1:
n=input()
if n=='0 0':break
a.append(n)
for s in a:
x,y=map(int,s.split())
print(y,x) if x>y else print(s)
| 5 | 8 | 99 | 132 | while 1:
n = input()
if n == "0 0":
break
x, y = map(int, n.split())
print(y, x) if x > y else print(n)
| a = []
while 1:
n = input()
if n == "0 0":
break
a.append(n)
for s in a:
x, y = map(int, s.split())
print(y, x) if x > y else print(s)
| false | 37.5 | [
"+a = []",
"- x, y = map(int, n.split())",
"- print(y, x) if x > y else print(n)",
"+ a.append(n)",
"+for s in a:",
"+ x, y = map(int, s.split())",
"+ print(y, x) if x > y else print(s)"
] | false | 0.034473 | 0.034793 | 0.990817 | [
"s037337671",
"s074842659"
] |
u936985471 | p03163 | python | s509474462 | s684540561 | 658 | 328 | 171,912 | 21,700 | Accepted | Accepted | 50.15 | N,W=list(map(int,input().split()))
weight=[0]*N
values=[0]*N
for i in range(N):
weight[i],values[i]=list(map(int,input().split()))
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
for w in range(W+1):
if w>=weight[i]:
dp[i+1][w]=max(dp[i][w],dp[i][w-weight[i]]+values[i])
... | n,W=list(map(int,input().split()))
stones=[None]*n
for i in range(n):
w,v=list(map(int,input().split()))
stones[i]=[w,v]
import numpy as np
dp=np.zeros(W+1,dtype=int)
for i in range(len(stones)):
w=stones[i][0]
v=stones[i][1]
np.maximum(dp[:-w]+v,dp[w:],dp[w:])
print((dp.max())) | 16 | 15 | 369 | 292 | N, W = list(map(int, input().split()))
weight = [0] * N
values = [0] * N
for i in range(N):
weight[i], values[i] = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for i in range(N):
for w in range(W + 1):
if w >= weight[i]:
dp[i + 1][w] = max(dp[i][w], ... | n, W = list(map(int, input().split()))
stones = [None] * n
for i in range(n):
w, v = list(map(int, input().split()))
stones[i] = [w, v]
import numpy as np
dp = np.zeros(W + 1, dtype=int)
for i in range(len(stones)):
w = stones[i][0]
v = stones[i][1]
np.maximum(dp[:-w] + v, dp[w:], dp[w:])
print((dp... | false | 6.25 | [
"-N, W = list(map(int, input().split()))",
"-weight = [0] * N",
"-values = [0] * N",
"-for i in range(N):",
"- weight[i], values[i] = list(map(int, input().split()))",
"-dp = [[0 for i in range(W + 1)] for j in range(N + 1)]",
"-for i in range(N):",
"- for w in range(W + 1):",
"- if w >... | false | 0.044828 | 0.379138 | 0.118237 | [
"s509474462",
"s684540561"
] |
u729133443 | p03470 | python | s688664100 | s113273036 | 180 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.56 | print((len(set(open(0).readlines()[1:])))) | _,*s=open(0);print((len(set(s)))) | 1 | 1 | 40 | 31 | print((len(set(open(0).readlines()[1:]))))
| _, *s = open(0)
print((len(set(s))))
| false | 0 | [
"-print((len(set(open(0).readlines()[1:]))))",
"+_, *s = open(0)",
"+print((len(set(s))))"
] | false | 0.119626 | 0.043886 | 2.725808 | [
"s688664100",
"s113273036"
] |
u038408819 | p02726 | python | s485493356 | s428646008 | 1,552 | 649 | 205,832 | 136,200 | Accepted | Accepted | 58.18 | N, X, Y = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(N):
u = i
v = i + 1
if v < N:
g[u].append(v)
g[v].append(u)
g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)
from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = ... | N, X, Y = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(N):
u = i
v = i + 1
if v < N:
g[u].append(v)
g[v].append(u)
g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)
from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = ... | 44 | 44 | 943 | 946 | N, X, Y = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(N):
u = i
v = i + 1
if v < N:
g[u].append(v)
g[v].append(u)
g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)
from collections import deque
dis = [[float("Inf")] * N for _ in range(N)]
count = [0] * (N - 1)
de... | N, X, Y = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(N):
u = i
v = i + 1
if v < N:
g[u].append(v)
g[v].append(u)
g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)
from collections import deque
dis = [[float("Inf")] * N for _ in range(N)]
count = [0] * (N - 1)
de... | false | 0 | [
"- pre = i",
"+ # pre = i",
"- dis[k][i] = dis[i][p] + 1",
"+ # dis[k][i] = dis[i][p] + 1",
"- pre = p",
"+ # pre = p"
] | false | 0.037848 | 0.038218 | 0.990315 | [
"s485493356",
"s428646008"
] |
u629540524 | p02952 | python | s211952983 | s494931596 | 74 | 68 | 73,416 | 68,396 | Accepted | Accepted | 8.11 | n = int(eval(input()))
count= 0
for i in range(1,n+1):
if len(str(i)) == 1 or len(str(i)) == 3 or len(str(i)) == 5:
count+=1
print(count) | n = int(eval(input()))
count= 0
for i in range(1,n+1):
if len(str(i))%2 == 1:
count+=1
print(count) | 6 | 6 | 148 | 110 | n = int(eval(input()))
count = 0
for i in range(1, n + 1):
if len(str(i)) == 1 or len(str(i)) == 3 or len(str(i)) == 5:
count += 1
print(count)
| n = int(eval(input()))
count = 0
for i in range(1, n + 1):
if len(str(i)) % 2 == 1:
count += 1
print(count)
| false | 0 | [
"- if len(str(i)) == 1 or len(str(i)) == 3 or len(str(i)) == 5:",
"+ if len(str(i)) % 2 == 1:"
] | false | 0.052549 | 0.087671 | 0.599397 | [
"s211952983",
"s494931596"
] |
u252883287 | p03855 | python | s931802016 | s858947403 | 1,750 | 1,508 | 43,812 | 46,424 | Accepted | Accepted | 13.83 | class UnionFind(object):
def __init__(self, n):
# 親のnodeを表す
self.par = [i for i in range(n)]
def root(self, x):
if self.par[x] == x:
return x
else:
# 経路圧縮
self.par[x] = self.root(self.par[x])
return self.par[x]
... | class UnionFind(object):
def __init__(self, n):
# 親のnodeを表す
self.par = [i for i in range(n)]
def root(self, x):
if self.par[x] == x:
return x
else:
# 経路圧縮
self.par[x] = self.root(self.par[x])
return self.par[x]
... | 77 | 80 | 1,694 | 1,734 | class UnionFind(object):
def __init__(self, n):
# 親のnodeを表す
self.par = [i for i in range(n)]
def root(self, x):
if self.par[x] == x:
return x
else:
# 経路圧縮
self.par[x] = self.root(self.par[x])
return self.par[x]
def same(self, ... | class UnionFind(object):
def __init__(self, n):
# 親のnodeを表す
self.par = [i for i in range(n)]
def root(self, x):
if self.par[x] == x:
return x
else:
# 経路圧縮
self.par[x] = self.root(self.par[x])
return self.par[x]
def same(self, ... | false | 3.75 | [
"+ ids = []",
"- d[_id(ur.root(i), ut.root(i))] += 1",
"+ __id = _id(ur.root(i), ut.root(i))",
"+ d[__id] += 1",
"+ ids.append(__id)",
"- print(d[_id(ur.root(i), ut.root(i))], end=\" \")",
"+ print(d[ids[i]], end=\" \")"
] | false | 0.040695 | 0.040009 | 1.017135 | [
"s931802016",
"s858947403"
] |
u260980560 | p00437 | python | s442369537 | s051943785 | 30 | 20 | 4,296 | 4,284 | Accepted | Accepted | 33.33 | while 1:
a, b, c = list(map(int, input().split()))
if not a:
break
n = eval(input())
I = []; J = []; K = []
res = [2]*(a+b+c)
for p in range(n):
i, j, k, r = list(map(int, input().split()))
i -= 1; j -= 1; k -= 1
if r:
res[i] = res[j] = re... | while 1:
a, b, c = list(map(int, input().split()))
if not a:
break
I = []
res = [2]*(a+b+c)
for p in range(int(input())):
i, j, k, r = list(map(int, input().split()))
i -= 1; j -= 1; k -= 1
if r:
res[i] = res[j] = res[k] = 1
else:
... | 27 | 25 | 732 | 653 | while 1:
a, b, c = list(map(int, input().split()))
if not a:
break
n = eval(input())
I = []
J = []
K = []
res = [2] * (a + b + c)
for p in range(n):
i, j, k, r = list(map(int, input().split()))
i -= 1
j -= 1
k -= 1
if r:
res[i] ... | while 1:
a, b, c = list(map(int, input().split()))
if not a:
break
I = []
res = [2] * (a + b + c)
for p in range(int(input())):
i, j, k, r = list(map(int, input().split()))
i -= 1
j -= 1
k -= 1
if r:
res[i] = res[j] = res[k] = 1
els... | false | 7.407407 | [
"- n = eval(input())",
"- J = []",
"- K = []",
"- for p in range(n):",
"+ for p in range(int(input())):",
"- I.append(i)",
"- J.append(j)",
"- K.append(k)",
"- for p in range(len(I)):",
"- i, j, k = I[p], J[p], K[p]",
"- if res[i] ... | false | 0.069128 | 0.067546 | 1.02342 | [
"s442369537",
"s051943785"
] |
u600402037 | p03044 | python | s259897066 | s598148719 | 688 | 563 | 76,464 | 41,796 | Accepted | Accepted | 18.17 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
edges = [[] for _ in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
if w&1:
edges[u-1].append((v-1, -1))
edges[v-1].append((u-1, -1))
else:
edges[u-1].append((v-1, 1))
edge... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(N-1):
a, b, w = lr()
graph[a].append((b, w%2))
graph[b].append((a, w%2))
color = [None]... | 26 | 32 | 549 | 732 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
edges = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
if w & 1:
edges[u - 1].append((v - 1, -1))
edges[v - 1].append((u - 1, -1))
else:
edges[u - 1].append((v - 1, 1))
ed... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
graph = [[] for _ in range(N + 1)] # 1-indexed
for _ in range(N - 1):
a, b, w = lr()
graph[a].append((b, w % 2))
graph[b].append((a, w % 2))
color = [None] * (N +... | false | 18.75 | [
"+# coding: utf-8",
"-sys.setrecursionlimit(10**6)",
"-N = int(eval(input()))",
"-edges = [[] for _ in range(N)]",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir = lambda: int(sr())",
"+lr = lambda: list(map(int, sr().split()))",
"+N = ir()",
"+graph = [[] for _ in range(N + 1)] # 1-indexed",
... | false | 0.036081 | 0.036306 | 0.99378 | [
"s259897066",
"s598148719"
] |
u588341295 | p02787 | python | s229878786 | s398888350 | 918 | 624 | 191,512 | 41,452 | Accepted | Accepted | 32.03 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 35 | 34 | 1,062 | 956 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 2.857143 | [
"-AB = [()]",
"+AB = []",
"-dp = list2d(N + 1, 20007, INF)",
"-dp[0][0] = 0",
"-for i in range(1, N + 1):",
"- a, b = AB[i]",
"- for j in range(20007):",
"- dp[i][j] = min(dp[i][j], dp[i - 1][j])",
"- if j - a >= 0:",
"- dp[i][j] = min(dp[i][j], dp[i][j - a] + b, dp[... | false | 0.37418 | 0.135577 | 2.759914 | [
"s229878786",
"s398888350"
] |
u977661421 | p02761 | python | s122839724 | s286750994 | 20 | 18 | 3,064 | 3,060 | Accepted | Accepted | 10 | # -*- coding: utf-8 -*-
n, m = list(map(int,input().split()))
sc = []
for i in range(m):
sc.append([int(i) for i in input().split()])
if n == 1:
if m == 1:
print((sc[0][1]))
if m == 0:
print((0))
if m >= 2:
print((-1))
if n == 2:
count = 0
for i in range... | # -*- coding: utf-8 -*-
n, m = list(map(int,input().split()))
sc = []
for i in range(m):
sc.append([int(i) for i in input().split()])
for i in range(0, 1000):
i = str(i)
if len(i) != n:
continue
flag = True
for j in range(m):
#print(i, i[sc[j][0] - 1], sc[j][1])
... | 52 | 19 | 1,328 | 437 | # -*- coding: utf-8 -*-
n, m = list(map(int, input().split()))
sc = []
for i in range(m):
sc.append([int(i) for i in input().split()])
if n == 1:
if m == 1:
print((sc[0][1]))
if m == 0:
print((0))
if m >= 2:
print((-1))
if n == 2:
count = 0
for i in range(10, 100):
... | # -*- coding: utf-8 -*-
n, m = list(map(int, input().split()))
sc = []
for i in range(m):
sc.append([int(i) for i in input().split()])
for i in range(0, 1000):
i = str(i)
if len(i) != n:
continue
flag = True
for j in range(m):
# print(i, i[sc[j][0] - 1], sc[j][1])
if i[sc[j][... | false | 63.461538 | [
"-if n == 1:",
"- if m == 1:",
"- print((sc[0][1]))",
"- if m == 0:",
"- print((0))",
"- if m >= 2:",
"- print((-1))",
"-if n == 2:",
"- count = 0",
"- for i in range(10, 100):",
"- tmp1 = i // 10",
"- tmp2 = i - (tmp1 * 10)",
"- flag ... | false | 0.007467 | 0.039377 | 0.189621 | [
"s122839724",
"s286750994"
] |
u608088992 | p03805 | python | s817266348 | s998277399 | 69 | 27 | 3,064 | 9,200 | Accepted | Accepted | 60.87 | import sys
from itertools import permutations
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
Edge[a-1].append(b-1)
Edge[b-1].append(a-1)
count... | import sys
from itertools import permutations
def solve():
N, M = list(map(int, input().split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
Edge[a-1].append(b-1)
Edge[b-1].append(a-1)
count = 0
for order in permutation... | 29 | 22 | 740 | 545 | import sys
from itertools import permutations
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
Edge[a - 1].append(b - 1)
Edge[b - 1].append(a - 1)
count = 0... | import sys
from itertools import permutations
def solve():
N, M = list(map(int, input().split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
Edge[a - 1].append(b - 1)
Edge[b - 1].append(a - 1)
count = 0
for order in permutations(... | false | 24.137931 | [
"- input = sys.stdin.readline",
"- for s in permutations(list(range(N)), N):",
"- Visited = [False for _ in range(N)]",
"- for i, n in enumerate(s):",
"- if i == 0:",
"- if n != 0:",
"- break",
"- else:",
"- ... | false | 0.042956 | 0.168213 | 0.255367 | [
"s817266348",
"s998277399"
] |
u644907318 | p02720 | python | s725776477 | s872057730 | 430 | 110 | 60,400 | 88,684 | Accepted | Accepted | 74.42 | def f(N): # N is string
k = len(N)
dp = [[[[0 for _ in range(10)] for _ in range(2)] for _ in range(2)] for _ in range(k+1)]
for j in range(10):
dp[1][0][0][j]=(j==int(N[0]))
dp[1][0][1][j]=0
dp[1][1][0][j]=(j<int(N[0]))
dp[1][1][1][j]=0
for i in range(2,k+1):
... | from collections import deque
K = int(eval(input()))
A = deque([str(i) for i in range(1,10)])
cnt = 0
while cnt<K:
a = A.popleft()
cnt += 1
if a[-1]=="0":
a0 = a+"0"
a1 = a+"1"
A.append(a0)
A.append(a1)
elif a[-1]=="9":
a0 = a+"8"
a1 = a+"9"
... | 33 | 26 | 1,136 | 541 | def f(N): # N is string
k = len(N)
dp = [
[[[0 for _ in range(10)] for _ in range(2)] for _ in range(2)]
for _ in range(k + 1)
]
for j in range(10):
dp[1][0][0][j] = j == int(N[0])
dp[1][0][1][j] = 0
dp[1][1][0][j] = j < int(N[0])
dp[1][1][1][j] = 0
f... | from collections import deque
K = int(eval(input()))
A = deque([str(i) for i in range(1, 10)])
cnt = 0
while cnt < K:
a = A.popleft()
cnt += 1
if a[-1] == "0":
a0 = a + "0"
a1 = a + "1"
A.append(a0)
A.append(a1)
elif a[-1] == "9":
a0 = a + "8"
a1 = a + "9... | false | 21.212121 | [
"-def f(N): # N is string",
"- k = len(N)",
"- dp = [",
"- [[[0 for _ in range(10)] for _ in range(2)] for _ in range(2)]",
"- for _ in range(k + 1)",
"- ]",
"- for j in range(10):",
"- dp[1][0][0][j] = j == int(N[0])",
"- dp[1][0][1][j] = 0",
"- dp[... | false | 0.06787 | 0.056915 | 1.192471 | [
"s725776477",
"s872057730"
] |
u103902792 | p03835 | python | s587707771 | s128434482 | 1,857 | 1,459 | 2,940 | 2,940 | Accepted | Accepted | 21.43 | k,s = list(map(int,input().split()))
x=y=z=0
count = 0
for i in range(min(k,s)+1):
for j in range(min(k,s)+1):
z = s-x-y
if 0 <= z <= k:
count += 1
y += 1
y = 0
x +=1
print(count)
| k,s = list(map(int,input().split()))
count = 0
for x in range(k+1):
for y in range(k+1):
z = s-x-y
if 0 <= z <= k:
count += 1
print(count) | 12 | 9 | 209 | 157 | k, s = list(map(int, input().split()))
x = y = z = 0
count = 0
for i in range(min(k, s) + 1):
for j in range(min(k, s) + 1):
z = s - x - y
if 0 <= z <= k:
count += 1
y += 1
y = 0
x += 1
print(count)
| k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z <= k:
count += 1
print(count)
| false | 25 | [
"-x = y = z = 0",
"-for i in range(min(k, s) + 1):",
"- for j in range(min(k, s) + 1):",
"+for x in range(k + 1):",
"+ for y in range(k + 1):",
"- y += 1",
"- y = 0",
"- x += 1"
] | false | 0.040503 | 0.040452 | 1.00126 | [
"s587707771",
"s128434482"
] |
u159994501 | p03448 | python | s612742755 | s492249832 | 66 | 49 | 3,064 | 3,060 | Accepted | Accepted | 25.76 | A=int(eval(input()))
B=int(eval(input()))
C=int(eval(input()))
X=int(eval(input()))
a=0
b=0
c=0
count = 0
while a*500<=X and a<=A:
while a*500+b*100<=X and b<=B:
while a*500+b*100+c * 50 <=X and c<=C:
if a*500+b*100+c*50==X:
#print(a,b,c)
count+=1
... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500 * i + 100 * j + 50 * k == X:
ans += 1
print(ans)
| 26 | 12 | 499 | 253 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
a = 0
b = 0
c = 0
count = 0
while a * 500 <= X and a <= A:
while a * 500 + b * 100 <= X and b <= B:
while a * 500 + b * 100 + c * 50 <= X and c <= C:
if a * 500 + b * 100 + c * 50 == X:
# ... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500 * i + 100 * j + 50 * k == X:
ans += 1
print(ans)
| false | 53.846154 | [
"-a = 0",
"-b = 0",
"-c = 0",
"-count = 0",
"-while a * 500 <= X and a <= A:",
"- while a * 500 + b * 100 <= X and b <= B:",
"- while a * 500 + b * 100 + c * 50 <= X and c <= C:",
"- if a * 500 + b * 100 + c * 50 == X:",
"- # print(a,b,c)",
"- cou... | false | 0.102413 | 0.382979 | 0.267412 | [
"s612742755",
"s492249832"
] |
u983918956 | p03569 | python | s160416561 | s406041928 | 106 | 65 | 4,212 | 3,316 | Accepted | Accepted | 38.68 | from collections import deque
s = deque(eval(input()))
ans = 0
while len(s) >= 2:
if s[0] == s[-1]:
s.popleft()
s.pop()
elif s[0] == "x":
s.append("x")
ans += 1
elif s[-1] == "x":
s.appendleft("x")
ans += 1
else:
ans = -1
... | s = eval(input())
l = 0
r = len(s)-1
ans = 0
while r-l >= 1:
if s[l] == s[r]:
l += 1
r -= 1
elif s[l] == "x":
l += 1
ans += 1
elif s[r] == "x":
r -= 1
ans += 1
else:
ans = -1
break
print(ans) | 21 | 21 | 336 | 288 | from collections import deque
s = deque(eval(input()))
ans = 0
while len(s) >= 2:
if s[0] == s[-1]:
s.popleft()
s.pop()
elif s[0] == "x":
s.append("x")
ans += 1
elif s[-1] == "x":
s.appendleft("x")
ans += 1
else:
ans = -1
break
print(ans)
| s = eval(input())
l = 0
r = len(s) - 1
ans = 0
while r - l >= 1:
if s[l] == s[r]:
l += 1
r -= 1
elif s[l] == "x":
l += 1
ans += 1
elif s[r] == "x":
r -= 1
ans += 1
else:
ans = -1
break
print(ans)
| false | 0 | [
"-from collections import deque",
"-",
"-s = deque(eval(input()))",
"+s = eval(input())",
"+l = 0",
"+r = len(s) - 1",
"-while len(s) >= 2:",
"- if s[0] == s[-1]:",
"- s.popleft()",
"- s.pop()",
"- elif s[0] == \"x\":",
"- s.append(\"x\")",
"+while r - l >= 1:",
... | false | 0.089898 | 0.035144 | 2.558036 | [
"s160416561",
"s406041928"
] |
u073852194 | p02973 | python | s548704148 | s722432116 | 601 | 115 | 53,592 | 85,372 | Accepted | Accepted | 80.87 | import bisect
from collections import deque
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
LDS = deque()
LDS.append(A[0])
for i in range(1,N):
if LDS[0] >= A[i]:
LDS.appendleft(A[i])
else:
LDS[bisect.bisect_left(LDS,A[i])-1] = A[i]
print((len(LDS))) | from bisect import bisect_left, bisect_right
def LIS(arr): #bisect.bisect_left
n = len(arr)
lis = [arr[0]]
for a in arr:
if a > lis[-1]:
lis.append(a)
else:
lis[bisect_left(lis, a)] = a
return len(lis)
import sys
input = sys.stdin.readline
N = i... | 16 | 22 | 297 | 413 | import bisect
from collections import deque
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
LDS = deque()
LDS.append(A[0])
for i in range(1, N):
if LDS[0] >= A[i]:
LDS.appendleft(A[i])
else:
LDS[bisect.bisect_left(LDS, A[i]) - 1] = A[i]
print((len(LDS)))
| from bisect import bisect_left, bisect_right
def LIS(arr): # bisect.bisect_left
n = len(arr)
lis = [arr[0]]
for a in arr:
if a > lis[-1]:
lis.append(a)
else:
lis[bisect_left(lis, a)] = a
return len(lis)
import sys
input = sys.stdin.readline
N = int(eval(inpu... | false | 27.272727 | [
"-import bisect",
"-from collections import deque",
"+from bisect import bisect_left, bisect_right",
"+",
"+def LIS(arr): # bisect.bisect_left",
"+ n = len(arr)",
"+ lis = [arr[0]]",
"+ for a in arr:",
"+ if a > lis[-1]:",
"+ lis.append(a)",
"+ else:",
"+ ... | false | 0.053927 | 0.036855 | 1.463209 | [
"s548704148",
"s722432116"
] |
u721407235 | p02683 | python | s605002163 | s261614178 | 157 | 85 | 30,836 | 9,216 | Accepted | Accepted | 45.86 | import numpy as np
import itertools
N,M,X=list(map(int,input().split()))
CA=[]
D=[]
for n in range(N):
arr=list(map(int,input().split()))
CA.append(arr)
CA=np.array(CA)
v=list(itertools.product([0,1], repeat=N))
for v_ in v:
SUM=np.zeros(M+1)
for n in range(N):
if v_[n]==1:
SUM = S... | N,M,X=list(map(int,input().split()))
arr=[list(map(int,input().split())) for _ in range(N)]
ans=9999999999
for i in range(2**N):
cost=0
C=[0]*M
for n in range(N):
#右にずらして一桁目が1かどうかを判定
if (i>>n) &1:
cost += arr[n][0]
for j in range(1,M+1):
C[j-1] += arr[n][j]
if min(C... | 38 | 21 | 624 | 407 | import numpy as np
import itertools
N, M, X = list(map(int, input().split()))
CA = []
D = []
for n in range(N):
arr = list(map(int, input().split()))
CA.append(arr)
CA = np.array(CA)
v = list(itertools.product([0, 1], repeat=N))
for v_ in v:
SUM = np.zeros(M + 1)
for n in range(N):
if v_[n] == ... | N, M, X = list(map(int, input().split()))
arr = [list(map(int, input().split())) for _ in range(N)]
ans = 9999999999
for i in range(2**N):
cost = 0
C = [0] * M
for n in range(N):
# 右にずらして一桁目が1かどうかを判定
if (i >> n) & 1:
cost += arr[n][0]
for j in range(1, M + 1):
... | false | 44.736842 | [
"-import numpy as np",
"-import itertools",
"-",
"-CA = []",
"-D = []",
"-for n in range(N):",
"- arr = list(map(int, input().split()))",
"- CA.append(arr)",
"-CA = np.array(CA)",
"-v = list(itertools.product([0, 1], repeat=N))",
"-for v_ in v:",
"- SUM = np.zeros(M + 1)",
"+arr = [... | false | 0.185466 | 0.036079 | 5.14052 | [
"s605002163",
"s261614178"
] |
u971811058 | p03495 | python | s690290607 | s860087138 | 192 | 139 | 35,156 | 35,300 | Accepted | Accepted | 27.6 | from collections import Counter, deque, defaultdict
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
t = defaultdict(int)
for x in A:
t[x]+=1
B = []
for x in list(t.values()):
B.append(x)
B.sort()
if(len(B)<=k):
print((0))
exit()
ans = 0
for i in range(0, le... | from collections import Counter, deque, defaultdict
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
t = defaultdict(int)
for x in A:
t[x]+=1
B = list(t.values())
B.sort()
if(len(B)<=k):
print((0))
exit()
ans = sum(B[:len(B)-k])
print(ans)
| 20 | 14 | 382 | 284 | from collections import Counter, deque, defaultdict
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
t = defaultdict(int)
for x in A:
t[x] += 1
B = []
for x in list(t.values()):
B.append(x)
B.sort()
if len(B) <= k:
print((0))
exit()
ans = 0
for i in range(0, len(B)):
ans +... | from collections import Counter, deque, defaultdict
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
t = defaultdict(int)
for x in A:
t[x] += 1
B = list(t.values())
B.sort()
if len(B) <= k:
print((0))
exit()
ans = sum(B[: len(B) - k])
print(ans)
| false | 30 | [
"-B = []",
"-for x in list(t.values()):",
"- B.append(x)",
"+B = list(t.values())",
"-ans = 0",
"-for i in range(0, len(B)):",
"- ans += B[i]",
"- if len(B) - (i + 1) <= k:",
"- break",
"+ans = sum(B[: len(B) - k])"
] | false | 0.077356 | 0.042084 | 1.838129 | [
"s690290607",
"s860087138"
] |
u600402037 | p02839 | python | s025818905 | s742731879 | 518 | 436 | 173,488 | 173,488 | Accepted | Accepted | 15.83 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
A = np.array([lr() for _ in range(H)])
B = np.array([lr() for _ in range(H)])
diff = np.abs(A - B)
X = (H+W) * 80
L = X + X + 1 #真ん中を0とする、最後に-X
dp = [[No... | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
A = np.array([lr() for _ in range(H)])
B = np.array([lr() for _ in range(H)])
diff = np.abs(A - B).tolist()
X = (H+W) * 80
L = X + X + 1 #真ん中を0とする、最後に-X
... | 36 | 36 | 925 | 934 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
A = np.array([lr() for _ in range(H)])
B = np.array([lr() for _ in range(H)])
diff = np.abs(A - B)
X = (H + W) * 80
L = X + X + 1 # 真ん中を0とする、最後に-X
dp = [[None] * W for ... | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
A = np.array([lr() for _ in range(H)])
B = np.array([lr() for _ in range(H)])
diff = np.abs(A - B).tolist()
X = (H + W) * 80
L = X + X + 1 # 真ん中を0とする、最後に-X
dp = [[None]... | false | 0 | [
"-diff = np.abs(A - B)",
"+diff = np.abs(A - B).tolist()"
] | false | 0.69146 | 0.172282 | 4.013542 | [
"s025818905",
"s742731879"
] |
u227082700 | p02558 | python | s540297911 | s808372747 | 452 | 385 | 13,436 | 79,248 | Accepted | Accepted | 14.82 | import sys
input = lambda: sys.stdin.readline().rstrip()
# UnionFind
class UnionFind:
def __init__(self,n):
self.n=n
self.a=[-1]*n
self.r=[0]*n
self.siz=n
def root_find(self,x):
if self.a[x]<0:
return x
else:
self.a[x]=self.root_find(self.a[x])
return self.a... | import sys
input = lambda: sys.stdin.readline().rstrip()
# UnionFind
class UnionFind:
def __init__(self,n):
self.n=n
self.a=[-1]*n
self.siz=n
def root_find(self,x):
if self.a[x]<0:
return x
else:
self.a[x]=self.root_find(self.a[x])
... | 44 | 38 | 942 | 926 | import sys
input = lambda: sys.stdin.readline().rstrip()
# UnionFind
class UnionFind:
def __init__(self, n):
self.n = n
self.a = [-1] * n
self.r = [0] * n
self.siz = n
def root_find(self, x):
if self.a[x] < 0:
return x
else:
self.a[x] = s... | import sys
input = lambda: sys.stdin.readline().rstrip()
# UnionFind
class UnionFind:
def __init__(self, n):
self.n = n
self.a = [-1] * n
self.siz = n
def root_find(self, x):
if self.a[x] < 0:
return x
else:
self.a[x] = self.root_find(self.a[x])
... | false | 13.636364 | [
"- self.r = [0] * n",
"- if self.r[x] == self.r[y]:",
"- self.r[x] += 1",
"- self.a[x] += self.a[y]",
"- self.a[y] = x",
"- elif self.r[x] > self.r[y]:",
"+ elif self.a[x] < self.a[y]:"
] | false | 0.044386 | 0.042605 | 1.041807 | [
"s540297911",
"s808372747"
] |
u562935282 | p03659 | python | s196185740 | s408201900 | 211 | 172 | 24,832 | 24,832 | Accepted | Accepted | 18.48 | def inpl(): return input().split()
n = int(eval(input()))
a = list(map(int, inpl()))
sa = sum(a)
b = [a[0]]
for i in range(1, n - 1):
b.append(a[i] + b[i - 1])
ans = float('inf')
for x in b:
ans = min(ans, abs(sa - 2 * x))
print(ans) | n = int(eval(input()))
*a, = list(map(int, input().split()))
ret = 10 ** 15
s = 0
t = sum(a)
a.pop() # 最後の要素は取れない
for x in a:
s += x
t -= x
ret = min(ret, abs(s - t))
print(ret)
| 13 | 14 | 249 | 195 | def inpl():
return input().split()
n = int(eval(input()))
a = list(map(int, inpl()))
sa = sum(a)
b = [a[0]]
for i in range(1, n - 1):
b.append(a[i] + b[i - 1])
ans = float("inf")
for x in b:
ans = min(ans, abs(sa - 2 * x))
print(ans)
| n = int(eval(input()))
(*a,) = list(map(int, input().split()))
ret = 10**15
s = 0
t = sum(a)
a.pop() # 最後の要素は取れない
for x in a:
s += x
t -= x
ret = min(ret, abs(s - t))
print(ret)
| false | 7.142857 | [
"-def inpl():",
"- return input().split()",
"-",
"-",
"-a = list(map(int, inpl()))",
"-sa = sum(a)",
"-b = [a[0]]",
"-for i in range(1, n - 1):",
"- b.append(a[i] + b[i - 1])",
"-ans = float(\"inf\")",
"-for x in b:",
"- ans = min(ans, abs(sa - 2 * x))",
"-print(ans)",
"+(*a,) = l... | false | 0.036391 | 0.0395 | 0.921288 | [
"s196185740",
"s408201900"
] |
u391331433 | p03253 | python | s038156569 | s663489824 | 337 | 44 | 74,380 | 10,036 | Accepted | Accepted | 86.94 | import sys
from collections import deque
import copy
def power_func(a,b,p):
if b==0: return 1
if b%2==0:
d=power_func(a,b//2,p)
return d*d %p
if b%2==1:
return (a*power_func(a,b-1,p ))%p
class comb_calclator():
def __init__(self, N, p):
self.N = N
self.p = p
... | import sys
from collections import deque
import copy
def power_func(a,b,p):
if b==0: return 1
if b%2==0:
d=power_func(a,b//2,p)
return d*d %p
if b%2==1:
return (a*power_func(a,b-1,p ))%p
class comb_calclator():
def __init__(self, N, p):
self.N = N
self.p = p
... | 85 | 89 | 1,976 | 2,065 | import sys
from collections import deque
import copy
def power_func(a, b, p):
if b == 0:
return 1
if b % 2 == 0:
d = power_func(a, b // 2, p)
return d * d % p
if b % 2 == 1:
return (a * power_func(a, b - 1, p)) % p
class comb_calclator:
def __init__(self, N, p):
... | import sys
from collections import deque
import copy
def power_func(a, b, p):
if b == 0:
return 1
if b % 2 == 0:
d = power_func(a, b // 2, p)
return d * d % p
if b % 2 == 1:
return (a * power_func(a, b - 1, p)) % p
class comb_calclator:
def __init__(self, N, p):
... | false | 4.494382 | [
"- cmb = comb_calclator(10 * N, int(1e9) + 7)",
"+ max_num = 0",
"+ for p in primes:",
"+ max_num = max(max_num, primes[p])",
"+ cmb = comb_calclator(max_num + N, int(1e9) + 7)"
] | false | 0.043037 | 0.044043 | 0.977159 | [
"s038156569",
"s663489824"
] |
u770199020 | p03262 | python | s442810718 | s279373950 | 157 | 101 | 14,100 | 14,224 | Accepted | Accepted | 35.67 |
def gcd(p, q):
a, b = (p, q) if p >= q else (q, p)
c = a % b
while c != 0:
a, b = (b, c) if b >= c else (c, b)
c = a % b
return b
N, X = [int(x) for x in input().split()]
xn = sorted([int(x) for x in input().split()])
diffs = []
if X < xn[0]:
diffs.append(xn[0] -X)
for n in range(... |
def gcd(x, y):
#assert x >= y
return gcd(y, x%y) if y else x
N, X = [int(i) for i in input().split()]
Xn = [int(i) for i in input().split()]
dx =[abs(x-X) for x in Xn]
gcd_num = dx[0]
for x in dx:
a, b = (gcd_num, x) if gcd_num > x else (x, gcd_num)
gcd_num = gcd(a, b)
print(gcd_num)
... | 32 | 21 | 642 | 324 | def gcd(p, q):
a, b = (p, q) if p >= q else (q, p)
c = a % b
while c != 0:
a, b = (b, c) if b >= c else (c, b)
c = a % b
return b
N, X = [int(x) for x in input().split()]
xn = sorted([int(x) for x in input().split()])
diffs = []
if X < xn[0]:
diffs.append(xn[0] - X)
for n in range(... | def gcd(x, y):
# assert x >= y
return gcd(y, x % y) if y else x
N, X = [int(i) for i in input().split()]
Xn = [int(i) for i in input().split()]
dx = [abs(x - X) for x in Xn]
gcd_num = dx[0]
for x in dx:
a, b = (gcd_num, x) if gcd_num > x else (x, gcd_num)
gcd_num = gcd(a, b)
print(gcd_num)
| false | 34.375 | [
"-def gcd(p, q):",
"- a, b = (p, q) if p >= q else (q, p)",
"- c = a % b",
"- while c != 0:",
"- a, b = (b, c) if b >= c else (c, b)",
"- c = a % b",
"- return b",
"+def gcd(x, y):",
"+ # assert x >= y",
"+ return gcd(y, x % y) if y else x",
"-N, X = [int(x) for x... | false | 0.03672 | 0.142891 | 0.256977 | [
"s442810718",
"s279373950"
] |
u077291787 | p03354 | python | s049900920 | s166264147 | 529 | 480 | 90,168 | 25,184 | Accepted | Accepted | 9.26 | # ARC097D - Equals
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
def dfs(v: int, color: int) -> None:
group[v] = color # make vertex v searched
for u in G[v]: # search vertices available from v recursively
if not group[u]: # skip if already searched
df... | # ABC097D - Equals (ARC097D)
import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, N): # construct a Union-Find tree (1-idx)
self.parent = [i for i in range(N + 1)]
self.rank = [0] * (N + 1)
def find(self, x): # find the group (root) of a vertex
if sel... | 36 | 46 | 1,025 | 1,472 | # ARC097D - Equals
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def dfs(v: int, color: int) -> None:
group[v] = color # make vertex v searched
for u in G[v]: # search vertices available from v recursively
if not group[u]: # skip if already searched
dfs(u, color)
... | # ABC097D - Equals (ARC097D)
import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, N): # construct a Union-Find tree (1-idx)
self.parent = [i for i in range(N + 1)]
self.rank = [0] * (N + 1)
def find(self, x): # find the group (root) of a vertex
if self.parent[x... | false | 21.73913 | [
"-# ARC097D - Equals",
"+# ABC097D - Equals (ARC097D)",
"-sys.setrecursionlimit(10**9)",
"-def dfs(v: int, color: int) -> None:",
"- group[v] = color # make vertex v searched",
"- for u in G[v]: # search vertices available from v recursively",
"- if not group[u]: # skip if already search... | false | 0.041191 | 0.037626 | 1.094736 | [
"s049900920",
"s166264147"
] |
u860657719 | p02623 | python | s099477498 | s733223009 | 306 | 184 | 110,968 | 132,948 | Accepted | Accepted | 39.87 | n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
s = 0
b_count = 0
for i in range(m):
if s + b[i] <= k:
s += b[i]
ans += 1
b_count = i+1
else:
break
a_count = 0
while True:
if a_count < n ... | n, m, k = list(map(int,input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sa = [0]
for i in range(n):
sa.append(sa[-1] + a[i])
inf = 1001001001
sb = [-inf, 0]
for i in range(m):
sb.append(sb[-1] + b[i])
sb.append(inf)
ans = 0
for i in range(n+1):
s = sa[i]... | 34 | 27 | 716 | 558 | n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
s = 0
b_count = 0
for i in range(m):
if s + b[i] <= k:
s += b[i]
ans += 1
b_count = i + 1
else:
break
a_count = 0
while True:
if a_count < n and s + a[a_c... | n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sa = [0]
for i in range(n):
sa.append(sa[-1] + a[i])
inf = 1001001001
sb = [-inf, 0]
for i in range(m):
sb.append(sb[-1] + b[i])
sb.append(inf)
ans = 0
for i in range(n + 1):
s = sa[i]
l = 0... | false | 20.588235 | [
"+sa = [0]",
"+for i in range(n):",
"+ sa.append(sa[-1] + a[i])",
"+inf = 1001001001",
"+sb = [-inf, 0]",
"+for i in range(m):",
"+ sb.append(sb[-1] + b[i])",
"+sb.append(inf)",
"-s = 0",
"-b_count = 0",
"-for i in range(m):",
"- if s + b[i] <= k:",
"- s += b[i]",
"- ... | false | 0.039658 | 0.124578 | 0.318343 | [
"s099477498",
"s733223009"
] |
u879870653 | p03160 | python | s994213689 | s652244818 | 206 | 125 | 13,980 | 13,980 | Accepted | Accepted | 39.32 | N = int(eval(input()))
H = list(map(int,input().split()))
dp = [float("inf") for i in range(N)]
dp[0] = 0
for i in range(N-1) :
dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
if i <= N-3 :
dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
ans = dp[N-1]
print(ans) | n = int(eval(input()))
h = list(map(int,input().split()))
dp = [0]*(n)
dp[1] = abs(h[0]-h[1])
for i in range(2, len(dp)) :
a = dp[i-2] + abs(h[i-2]-h[i])
b = dp[i-1] + abs(h[i-1]-h[i])
dp[i] = min(a, b)
print((dp[n-1]))
| 14 | 10 | 295 | 234 | N = int(eval(input()))
H = list(map(int, input().split()))
dp = [float("inf") for i in range(N)]
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i] - H[i + 1]))
if i <= N - 3:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i] - H[i + 2]))
ans = dp[N - 1]
print(ans)
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * (n)
dp[1] = abs(h[0] - h[1])
for i in range(2, len(dp)):
a = dp[i - 2] + abs(h[i - 2] - h[i])
b = dp[i - 1] + abs(h[i - 1] - h[i])
dp[i] = min(a, b)
print((dp[n - 1]))
| false | 28.571429 | [
"-N = int(eval(input()))",
"-H = list(map(int, input().split()))",
"-dp = [float(\"inf\") for i in range(N)]",
"-dp[0] = 0",
"-for i in range(N - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i] - H[i + 1]))",
"- if i <= N - 3:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i] - H[i + ... | false | 0.041551 | 0.04182 | 0.993561 | [
"s994213689",
"s652244818"
] |
u844005364 | p03854 | python | s830778514 | s238769498 | 70 | 19 | 3,188 | 3,188 | Accepted | Accepted | 72.86 | s = eval(input())
while s:
if s[:6] == "eraser":
s = s[6:]
elif s[:5] == "erase":
s = s[5:]
elif s[:5] == "dream":
if s[5:8] == "era":
s = s[5:]
elif s[5:7] == "er":
s = s[7:]
else:
s = s[5:]
else:
print(... | s = eval(input())
if s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","") == "":
print("YES")
else:
print("NO") | 18 | 6 | 350 | 151 | s = eval(input())
while s:
if s[:6] == "eraser":
s = s[6:]
elif s[:5] == "erase":
s = s[5:]
elif s[:5] == "dream":
if s[5:8] == "era":
s = s[5:]
elif s[5:7] == "er":
s = s[7:]
else:
s = s[5:]
else:
print("NO")
ex... | s = eval(input())
if (
s.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
== ""
):
print("YES")
else:
print("NO")
| false | 66.666667 | [
"-while s:",
"- if s[:6] == \"eraser\":",
"- s = s[6:]",
"- elif s[:5] == \"erase\":",
"- s = s[5:]",
"- elif s[:5] == \"dream\":",
"- if s[5:8] == \"era\":",
"- s = s[5:]",
"- elif s[5:7] == \"er\":",
"- s = s[7:]",
"- else:",
... | false | 0.04073 | 0.150788 | 0.270112 | [
"s830778514",
"s238769498"
] |
u257162238 | p02609 | python | s615311107 | s745991108 | 436 | 347 | 25,300 | 25,376 | Accepted | Accepted | 20.41 | import sys
input = sys.stdin.readline
import math
def read():
N = int(input().strip())
X = input().strip()
return N, X
def bitdiv(N:int, X:str, d:int):
q = 0
for i in range(N):
q <<= 1
q |= int(X[i])
p, q = divmod(q, d)
return q
def solve(N, X):
... | import sys
input = sys.stdin.readline
import math
def read():
N = int(input().strip())
X = input().strip()
return N, X
def bitdiv(N:int, X:str, d:int):
q = 0
for i in range(N):
q <<= 1
q |= int(X[i])
p, q = divmod(q, d)
return q
def solve(N, X):
... | 65 | 65 | 1,380 | 1,390 | import sys
input = sys.stdin.readline
import math
def read():
N = int(input().strip())
X = input().strip()
return N, X
def bitdiv(N: int, X: str, d: int):
q = 0
for i in range(N):
q <<= 1
q |= int(X[i])
p, q = divmod(q, d)
return q
def solve(N, X):
BP = [0 for ... | import sys
input = sys.stdin.readline
import math
def read():
N = int(input().strip())
X = input().strip()
return N, X
def bitdiv(N: int, X: str, d: int):
q = 0
for i in range(N):
q <<= 1
q |= int(X[i])
p, q = divmod(q, d)
return q
def solve(N, X):
BP = [0 for ... | false | 0 | [
"- qp = bitdiv(N, X, c + 1)",
"+ qp = int(X, base=2) % (c + 1)",
"- qm = bitdiv(N, X, c - 1)",
"+ qm = int(X, base=2) % (c - 1)"
] | false | 0.046482 | 0.062144 | 0.747979 | [
"s615311107",
"s745991108"
] |
u796942881 | p03286 | python | s617823802 | s954981057 | 24 | 19 | 3,316 | 2,940 | Accepted | Accepted | 20.83 | from collections import deque
S = deque()
def main():
N = int(eval(input()))
while N:
if (abs(N % -2) == 1):
S.appendleft('1')
N -= 1
else:
S.appendleft('0')
N //= -2
if not S:
S.append('0')
print((''.join(list(... | def main():
N = int(eval(input()))
S = ""
if N == 0:
print((0))
else:
while N:
if N % 2 != 0:
S = '1' + S
N -= 1
else:
S = '0' + S
N //= -2
print(S)
return
main(... | 24 | 24 | 342 | 314 | from collections import deque
S = deque()
def main():
N = int(eval(input()))
while N:
if abs(N % -2) == 1:
S.appendleft("1")
N -= 1
else:
S.appendleft("0")
N //= -2
if not S:
S.append("0")
print(("".join(list(S))))
return
main(... | def main():
N = int(eval(input()))
S = ""
if N == 0:
print((0))
else:
while N:
if N % 2 != 0:
S = "1" + S
N -= 1
else:
S = "0" + S
N //= -2
print(S)
return
main()
| false | 0 | [
"-from collections import deque",
"-",
"-S = deque()",
"-",
"-",
"- while N:",
"- if abs(N % -2) == 1:",
"- S.appendleft(\"1\")",
"- N -= 1",
"- else:",
"- S.appendleft(\"0\")",
"- N //= -2",
"- if not S:",
"- S.append(\"0\... | false | 0.040967 | 0.03823 | 1.071581 | [
"s617823802",
"s954981057"
] |
u533039576 | p02642 | python | s719635460 | s088281058 | 130 | 113 | 92,732 | 103,228 | Accepted | Accepted | 13.08 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
cnt = [0] * (a[-1] + 1)
for i in range(n):
cnt[a[i]] += 1
ans = 0
for i in range(1, a[-1] + 1):
if cnt[i] > 0:
if cnt[i] == 1:
ans += 1
for j in range(2, a[-1] + 1):
na = i * j
... | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (max(a) + 1)
# b[i] = (aの要素がiであるような数)
for i in range(n):
b[a[i]] += 1
ans = 0
for i in range(1, len(b)):
if b[i] > 0:
if b[i] == 1:
ans += 1
# print(i, ans)
for j in range(len(b)):
... | 21 | 20 | 417 | 400 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
cnt = [0] * (a[-1] + 1)
for i in range(n):
cnt[a[i]] += 1
ans = 0
for i in range(1, a[-1] + 1):
if cnt[i] > 0:
if cnt[i] == 1:
ans += 1
for j in range(2, a[-1] + 1):
na = i * j
if na <= a[-1]:... | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (max(a) + 1)
# b[i] = (aの要素がiであるような数)
for i in range(n):
b[a[i]] += 1
ans = 0
for i in range(1, len(b)):
if b[i] > 0:
if b[i] == 1:
ans += 1
# print(i, ans)
for j in range(len(b)):
if i * j >= le... | false | 4.761905 | [
"-a.sort()",
"-cnt = [0] * (a[-1] + 1)",
"+b = [0] * (max(a) + 1)",
"+# b[i] = (aの要素がiであるような数)",
"- cnt[a[i]] += 1",
"+ b[a[i]] += 1",
"-for i in range(1, a[-1] + 1):",
"- if cnt[i] > 0:",
"- if cnt[i] == 1:",
"+for i in range(1, len(b)):",
"+ if b[i] > 0:",
"+ if b[i... | false | 0.047355 | 0.046476 | 1.018911 | [
"s719635460",
"s088281058"
] |
u832152513 | p02642 | python | s950342999 | s718053062 | 149 | 132 | 132,764 | 132,828 | Accepted | Accepted | 11.41 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
x = max(a)
dp = [0] * (x+1)
for ai in a:
i = 1
if dp[ai] <= 2:
while i * ai <= x:
dp[i * ai] += 1
i += 1
ans = 0
for ai in a:
if dp[ai] <= 1:
ans += 1
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
x = max(a)
dp = [0] * (x+1)
for ai in a:
i = 1
if dp[ai] <= 2:
while i * ai <= x:
dp[i * ai] += 1
i += 1
ans = 0
for ai in a:
if dp[ai] <= 1:
ans += 1
print(ans) | 18 | 18 | 294 | 286 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
x = max(a)
dp = [0] * (x + 1)
for ai in a:
i = 1
if dp[ai] <= 2:
while i * ai <= x:
dp[i * ai] += 1
i += 1
ans = 0
for ai in a:
if dp[ai] <= 1:
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
x = max(a)
dp = [0] * (x + 1)
for ai in a:
i = 1
if dp[ai] <= 2:
while i * ai <= x:
dp[i * ai] += 1
i += 1
ans = 0
for ai in a:
if dp[ai] <= 1:
ans += 1
print(ans)
| false | 0 | [
"-a = sorted(list(map(int, input().split())))",
"+a = list(map(int, input().split()))"
] | false | 0.070764 | 0.043338 | 1.632834 | [
"s950342999",
"s718053062"
] |
u902040736 | p03448 | python | s472677632 | s819963217 | 62 | 43 | 3,064 | 3,060 | Accepted | Accepted | 30.65 | def check_money(a, b, c, total, results):
if a * 500 + b * 100 + c * 50 == total:
check = str(a) + ',' + str(b) + ',' + str(c)
for result in results:
if check in result:
break
else:
results.append(check)
return results
else:
... | def main():
coin_a = int(eval(input()))
coin_b = int(eval(input()))
coin_c = int(eval(input()))
total_money = int(eval(input()))
result_count = 0
for i in range(coin_a+1):
for j in range(coin_b+1):
for k in range(coin_c+1):
if i * 500 + j * 100 + k ... | 33 | 18 | 961 | 427 | def check_money(a, b, c, total, results):
if a * 500 + b * 100 + c * 50 == total:
check = str(a) + "," + str(b) + "," + str(c)
for result in results:
if check in result:
break
else:
results.append(check)
return results
else:
return ... | def main():
coin_a = int(eval(input()))
coin_b = int(eval(input()))
coin_c = int(eval(input()))
total_money = int(eval(input()))
result_count = 0
for i in range(coin_a + 1):
for j in range(coin_b + 1):
for k in range(coin_c + 1):
if i * 500 + j * 100 + k * 50 ... | false | 45.454545 | [
"-def check_money(a, b, c, total, results):",
"- if a * 500 + b * 100 + c * 50 == total:",
"- check = str(a) + \",\" + str(b) + \",\" + str(c)",
"- for result in results:",
"- if check in result:",
"- break",
"- else:",
"- results.append(che... | false | 0.100806 | 0.07326 | 1.375999 | [
"s472677632",
"s819963217"
] |
u077291787 | p03487 | python | s046122903 | s461461389 | 73 | 67 | 17,780 | 18,728 | Accepted | Accepted | 8.22 | # ABC082C - Good Sequence (ARC087C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = {}
for i in lst:
if i not in cnt:
cnt[i] = 0
cnt[i] += 1
ans = 0
for i, j in list(cnt.items(... | # ABC082C - Good Sequence (ARC087C)
from collections import Counter
def main():
N, *A = list(map(int, open(0).read().split()))
C = Counter(A)
ans = sum(j if i > j else j - i for i, j in list(C.items()))
print(ans)
if __name__ == "__main__":
main() | 23 | 13 | 459 | 271 | # ABC082C - Good Sequence (ARC087C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = {}
for i in lst:
if i not in cnt:
cnt[i] = 0
cnt[i] += 1
ans = 0
for i, j in list(cnt.items()):
... | # ABC082C - Good Sequence (ARC087C)
from collections import Counter
def main():
N, *A = list(map(int, open(0).read().split()))
C = Counter(A)
ans = sum(j if i > j else j - i for i, j in list(C.items()))
print(ans)
if __name__ == "__main__":
main()
| false | 43.478261 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"+from collections import Counter",
"- n = int(eval(input()))",
"- lst = list(map(int, input().rstrip().split()))",
"- cnt = {}",
"- for i in lst:",
"- if i not in cnt:",
"- cnt[i] = 0",
"- cnt[i] += 1",
"-... | false | 0.168588 | 0.126166 | 1.336235 | [
"s046122903",
"s461461389"
] |
u712429027 | p03319 | python | s660908952 | s876730979 | 107 | 51 | 20,712 | 20,600 | Accepted | Accepted | 52.34 | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b
n, k = inm()
a = inl()
start = a.i... | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b
n, k = inm()
a = inl()
print(ceil(... | 16 | 12 | 460 | 330 | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print("\n".join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b
n, k = inm()
a = inl()
start = a.index(1)
ans... | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print("\n".join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b
n, k = inm()
a = inl()
print(ceil(n - 1, k - ... | false | 25 | [
"-start = a.index(1)",
"-ans = 10**9",
"-for i in range(max(0, start - k + 1), min(n - 1, start + k)):",
"- ans = min(ans, ceil(i, k - 1) + ceil(n - i - 1, k - 1))",
"-print(ans)",
"+print(ceil(n - 1, k - 1))"
] | false | 0.12135 | 0.114856 | 1.056548 | [
"s660908952",
"s876730979"
] |
u391819434 | p02796 | python | s216224312 | s490421269 | 783 | 387 | 89,468 | 42,716 | Accepted | Accepted | 50.57 | N=int(eval(input()))
xl=[list(map(int,input().split()))for _ in range(N)]
arms={}
for x,l in xl:
arms[x-l]=0
arms[x+l]=0
for x,l in xl:
arms[x-l]+=1
arms[x+l]-=1
point={}
for x,l in xl:
point[x-l]=[]
point[x+l]=[]
for x,l in xl:
point[x-l].append(x+l)
ans=N
K=sorted(arms.ke... | N=int(eval(input()))
xl=[list(map(int,input().split()))for _ in range(N)]
rl=[[x+l,x-l]for x,l in xl]
rl.sort()
now=-10**9
ans=0
for r,l in rl:
if l>=now:
ans+=1
now=r
print(ans) | 35 | 11 | 655 | 202 | N = int(eval(input()))
xl = [list(map(int, input().split())) for _ in range(N)]
arms = {}
for x, l in xl:
arms[x - l] = 0
arms[x + l] = 0
for x, l in xl:
arms[x - l] += 1
arms[x + l] -= 1
point = {}
for x, l in xl:
point[x - l] = []
point[x + l] = []
for x, l in xl:
point[x - l].append(x + l... | N = int(eval(input()))
xl = [list(map(int, input().split())) for _ in range(N)]
rl = [[x + l, x - l] for x, l in xl]
rl.sort()
now = -(10**9)
ans = 0
for r, l in rl:
if l >= now:
ans += 1
now = r
print(ans)
| false | 68.571429 | [
"-arms = {}",
"-for x, l in xl:",
"- arms[x - l] = 0",
"- arms[x + l] = 0",
"-for x, l in xl:",
"- arms[x - l] += 1",
"- arms[x + l] -= 1",
"-point = {}",
"-for x, l in xl:",
"- point[x - l] = []",
"- point[x + l] = []",
"-for x, l in xl:",
"- point[x - l].append(x + l)"... | false | 0.133142 | 0.085644 | 1.554599 | [
"s216224312",
"s490421269"
] |
u597374218 | p03807 | python | s902872149 | s375993126 | 56 | 40 | 14,108 | 11,104 | Accepted | Accepted | 28.57 | N=int(eval(input()))
A=list(map(int,input().split()))
odd=0
for a in A:
if a%2==1:
odd+=1
print(("YES" if odd%2==0 else "NO")) | N=int(eval(input()))
print(("YES" if sum(map(int,input().split()))%2==0 else "NO")) | 7 | 2 | 136 | 76 | N = int(eval(input()))
A = list(map(int, input().split()))
odd = 0
for a in A:
if a % 2 == 1:
odd += 1
print(("YES" if odd % 2 == 0 else "NO"))
| N = int(eval(input()))
print(("YES" if sum(map(int, input().split())) % 2 == 0 else "NO"))
| false | 71.428571 | [
"-A = list(map(int, input().split()))",
"-odd = 0",
"-for a in A:",
"- if a % 2 == 1:",
"- odd += 1",
"-print((\"YES\" if odd % 2 == 0 else \"NO\"))",
"+print((\"YES\" if sum(map(int, input().split())) % 2 == 0 else \"NO\"))"
] | false | 0.076829 | 0.081082 | 0.947555 | [
"s902872149",
"s375993126"
] |
u133936772 | p02603 | python | s454622815 | s107619094 | 35 | 29 | 9,196 | 9,036 | Accepted | Accepted | 17.14 | n,*l=list(map(int,open(0).read().split()))
a,c=1000,0
for i in range(n-1):
s,t=l[i:i+2]
if s>t: a+=c*s; c=0
if s<t: c+=a//s; a-=a//s*s
print((a+c*t)) | n,*l=list(map(int,open(0).read().split()))
a=1000
for i in range(n-1):
s,t=l[i:i+2]
a+=a//s*max(t-s,0)
print(a) | 7 | 6 | 153 | 114 | n, *l = list(map(int, open(0).read().split()))
a, c = 1000, 0
for i in range(n - 1):
s, t = l[i : i + 2]
if s > t:
a += c * s
c = 0
if s < t:
c += a // s
a -= a // s * s
print((a + c * t))
| n, *l = list(map(int, open(0).read().split()))
a = 1000
for i in range(n - 1):
s, t = l[i : i + 2]
a += a // s * max(t - s, 0)
print(a)
| false | 14.285714 | [
"-a, c = 1000, 0",
"+a = 1000",
"- if s > t:",
"- a += c * s",
"- c = 0",
"- if s < t:",
"- c += a // s",
"- a -= a // s * s",
"-print((a + c * t))",
"+ a += a // s * max(t - s, 0)",
"+print(a)"
] | false | 0.136648 | 0.106569 | 1.282247 | [
"s454622815",
"s107619094"
] |
u075012704 | p03504 | python | s482770429 | s938436448 | 866 | 741 | 93,528 | 120,664 | Accepted | Accepted | 14.43 | N, C = list(map(int, input().split()))
TV = [[0]*(2*10**5) for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
TV[c-1][2*s-2] += 1
TV[c-1][2*t-1] -= 1
for i in range(C):
for j in range(1, 2*10**5):
TV[i][j] = TV[i][j]+TV[i][j-1]
for i in range(C):
... | from itertools import accumulate
N, C = list(map(int, input().split()))
G = [[0] * (10 ** 5 + 1) for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
c = c - 1
G[c][s - 1] += 1
G[c][t] -= 1
for i in range(C):
G[i] = list(accumulate(G[i]))
ans = 0
for i in ra... | 23 | 20 | 509 | 434 | N, C = list(map(int, input().split()))
TV = [[0] * (2 * 10**5) for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
TV[c - 1][2 * s - 2] += 1
TV[c - 1][2 * t - 1] -= 1
for i in range(C):
for j in range(1, 2 * 10**5):
TV[i][j] = TV[i][j] + TV[i][j - 1]
for i in range(C)... | from itertools import accumulate
N, C = list(map(int, input().split()))
G = [[0] * (10**5 + 1) for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
c = c - 1
G[c][s - 1] += 1
G[c][t] -= 1
for i in range(C):
G[i] = list(accumulate(G[i]))
ans = 0
for i in range(10**5 + 1):
... | false | 13.043478 | [
"+from itertools import accumulate",
"+",
"-TV = [[0] * (2 * 10**5) for i in range(C)]",
"+G = [[0] * (10**5 + 1) for i in range(C)]",
"- TV[c - 1][2 * s - 2] += 1",
"- TV[c - 1][2 * t - 1] -= 1",
"+ c = c - 1",
"+ G[c][s - 1] += 1",
"+ G[c][t] -= 1",
"- for j in range(1, 2 * 10*... | false | 1.030905 | 1.450826 | 0.710565 | [
"s482770429",
"s938436448"
] |
u175034939 | p02900 | python | s044227422 | s727556205 | 400 | 178 | 3,064 | 3,064 | Accepted | Accepted | 55.5 | import math
a, b = list(map(int, input().split()))
def is_prime(num):
if num == 2:
return True
elif num < 3 or num % 2 == 0:
return False
for i in range(3, int(math.sqrt(num)) + 1, 2):
if num % i == 0:
return False
return True
if b > a:
a, b = b, ... | import math
a, b = list(map(int, input().split()))
def is_prime(num):
if num == 2:
return True
elif num < 3 or num % 2 == 0:
return False
for i in range(3, int(math.sqrt(num)) + 1, 2):
if num % i == 0:
return False
return True
if b > a:
a, b = b, ... | 25 | 26 | 549 | 582 | import math
a, b = list(map(int, input().split()))
def is_prime(num):
if num == 2:
return True
elif num < 3 or num % 2 == 0:
return False
for i in range(3, int(math.sqrt(num)) + 1, 2):
if num % i == 0:
return False
return True
if b > a:
a, b = b, a
c = []
for... | import math
a, b = list(map(int, input().split()))
def is_prime(num):
if num == 2:
return True
elif num < 3 or num % 2 == 0:
return False
for i in range(3, int(math.sqrt(num)) + 1, 2):
if num % i == 0:
return False
return True
if b > a:
a, b = b, a
c = []
for... | false | 3.846154 | [
"- if a % i == 0 and b % i == 0:",
"- if is_prime(i):",
"- c.append(i)",
"- k = b // i",
"- if a % k == 0:",
"- if is_prime(k):",
"- c.append(k)",
"+ if b % i == 0:",
"+ k = b // i",
"+ if a % k == 0:",
"+ if is_prime(k):",... | false | 0.045993 | 0.204506 | 0.224897 | [
"s044227422",
"s727556205"
] |
u556589653 | p03160 | python | s146286124 | s888716912 | 142 | 131 | 14,692 | 13,976 | Accepted | Accepted | 7.75 | dp = [0]*(110000)
A = int(eval(input()))
h = list(map(int,input().split()))
for i in range(1,A):
if i == 1:
dp[i] = dp[i-1]+abs(h[i]-h[i-1])
else:
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[A-1])) | N = int(eval(input()))
h = list(map(int,input().split()))
dp = [0] * 110000
for i in range(1,N):
if i == 1:
dp[i] = dp[i-1]+abs(h[i-1]-h[i])
else:
dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
print((dp[N-1])) | 9 | 9 | 250 | 238 | dp = [0] * (110000)
A = int(eval(input()))
h = list(map(int, input().split()))
for i in range(1, A):
if i == 1:
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
else:
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[A - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * 110000
for i in range(1, N):
if i == 1:
dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])
else:
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((dp[N - 1]))
| false | 0 | [
"-dp = [0] * (110000)",
"-A = int(eval(input()))",
"+N = int(eval(input()))",
"-for i in range(1, A):",
"+dp = [0] * 110000",
"+for i in range(1, N):",
"- dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])",
"+ dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])",
"- dp[i] = min(dp[i - 1] + abs(h[i]... | false | 0.097991 | 0.08312 | 1.178918 | [
"s146286124",
"s888716912"
] |
u657361950 | p02266 | python | s569778337 | s797441089 | 70 | 30 | 6,128 | 6,120 | Accepted | Accepted | 57.14 | s = eval(input())
st1=[]
st2=[]
st3=[]
n=len(s)
lv = 0
for i in range(n):
c=s[i]
if c=='\\':
lv-=1
st1.append(i)
elif c=='/':
lv+=1
if len(st1) > 0:
a = i - st1.pop()
if len(st2)==0 or st2[len(st2)-1]>=lv:
st3.append(a)
else:
t=0
while len(st2)>0 and st2[len(st2)-1]<l... | s = eval(input())
st1=[]
st2=[]
st3=[]
n=len(s)
lv = 0
for i in range(n):
c=s[i]
if c=='\\':
lv-=1
st1.append(i)
elif c=='/':
lv+=1
if len(st1) > 0:
a = i - st1.pop()
t=0
while len(st2)>0 and st2[-1]<lv:
st2.pop()
t+=st3.pop()
st3.append(a+t)
st2.append(lv)
el... | 39 | 36 | 594 | 509 | s = eval(input())
st1 = []
st2 = []
st3 = []
n = len(s)
lv = 0
for i in range(n):
c = s[i]
if c == "\\":
lv -= 1
st1.append(i)
elif c == "/":
lv += 1
if len(st1) > 0:
a = i - st1.pop()
if len(st2) == 0 or st2[len(st2) - 1] >= lv:
st3.ap... | s = eval(input())
st1 = []
st2 = []
st3 = []
n = len(s)
lv = 0
for i in range(n):
c = s[i]
if c == "\\":
lv -= 1
st1.append(i)
elif c == "/":
lv += 1
if len(st1) > 0:
a = i - st1.pop()
t = 0
while len(st2) > 0 and st2[-1] < lv:
... | false | 7.692308 | [
"- if len(st2) == 0 or st2[len(st2) - 1] >= lv:",
"- st3.append(a)",
"- else:",
"- t = 0",
"- while len(st2) > 0 and st2[len(st2) - 1] < lv:",
"- st2.pop()",
"- t += st3.pop()",
"- s... | false | 0.036803 | 0.080684 | 0.456133 | [
"s569778337",
"s797441089"
] |
u325282913 | p02866 | python | s359479255 | s055133669 | 170 | 89 | 16,252 | 84,688 | Accepted | Accepted | 47.65 | N = int(eval(input()))
array = list(map(int, input().split()))
if array[0] != 0:
print((0))
exit()
array.sort()
if 1 in array and len(set(array[1:])) == 1:
print((1))
exit()
if not (2 in array):
print((0))
exit()
if 0 in array[1:]:
print((0))
exit()
index = array.index(2)
... | MOD = 998244353
N = int(eval(input()))
D = list(map(int, input().split()))
if D[0] != 0:
print((0))
exit()
D_2 = [0]*(max(D)+1)
for i in D:
D_2[i] += 1
if D_2[0] != 1:
print((0))
exit()
ans = 1
for i in range(1,max(D)+1):
ans *= D_2[i-1]**D_2[i]
ans %= MOD
print(ans)
| 35 | 17 | 726 | 302 | N = int(eval(input()))
array = list(map(int, input().split()))
if array[0] != 0:
print((0))
exit()
array.sort()
if 1 in array and len(set(array[1:])) == 1:
print((1))
exit()
if not (2 in array):
print((0))
exit()
if 0 in array[1:]:
print((0))
exit()
index = array.index(2)
count = 1
count... | MOD = 998244353
N = int(eval(input()))
D = list(map(int, input().split()))
if D[0] != 0:
print((0))
exit()
D_2 = [0] * (max(D) + 1)
for i in D:
D_2[i] += 1
if D_2[0] != 1:
print((0))
exit()
ans = 1
for i in range(1, max(D) + 1):
ans *= D_2[i - 1] ** D_2[i]
ans %= MOD
print(ans)
| false | 51.428571 | [
"+MOD = 998244353",
"-array = list(map(int, input().split()))",
"-if array[0] != 0:",
"+D = list(map(int, input().split()))",
"+if D[0] != 0:",
"-array.sort()",
"-if 1 in array and len(set(array[1:])) == 1:",
"- print((1))",
"- exit()",
"-if not (2 in array):",
"+D_2 = [0] * (max(D) + 1)",... | false | 0.046218 | 0.046279 | 0.998674 | [
"s359479255",
"s055133669"
] |
u359358631 | p03861 | python | s898599036 | s326515003 | 34 | 29 | 9,160 | 9,152 | Accepted | Accepted | 14.71 | def main():
a, b, x = list(map(int, input().split()))
ans = b // x - a // x
if a % x == 0:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| def main():
a, b, x = list(map(int, input().split()))
ans = b // x - (a - 1) // x
print(ans)
if __name__ == "__main__":
main()
| 11 | 10 | 180 | 150 | def main():
a, b, x = list(map(int, input().split()))
ans = b // x - a // x
if a % x == 0:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| def main():
a, b, x = list(map(int, input().split()))
ans = b // x - (a - 1) // x
print(ans)
if __name__ == "__main__":
main()
| false | 9.090909 | [
"- ans = b // x - a // x",
"- if a % x == 0:",
"- ans += 1",
"+ ans = b // x - (a - 1) // x"
] | false | 0.086065 | 0.049663 | 1.732977 | [
"s898599036",
"s326515003"
] |
u223646582 | p03608 | python | s160492589 | s715113627 | 643 | 397 | 19,340 | 39,468 | Accepted | Accepted | 38.26 | import itertools
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M, R = list(map(int, input().split()))
r = [int(i) for i in input().split()]
G = [[10**8]*(N+1) for _ in range(N+1)] # 1-indexed
for _ in range(M):
A, B, C = list(map(int, input().split()))
# 無向グラフ
G[A][B] ... | import itertools
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M, R = list(map(int, input().split()))
r = [int(i) for i in input().split()]
G = [[10**8]*(N+1) for _ in range(N+1)]
for _ in range(M):
A, B, C = list(map(int, input().split()))
G[A][B] = C
G[B][A] = C
DG = ... | 27 | 21 | 595 | 552 | import itertools
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M, R = list(map(int, input().split()))
r = [int(i) for i in input().split()]
G = [[10**8] * (N + 1) for _ in range(N + 1)] # 1-indexed
for _ in range(M):
A, B, C = list(map(int, input().split()))
# 無向グラフ
G[A][B] = C
... | import itertools
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M, R = list(map(int, input().split()))
r = [int(i) for i in input().split()]
G = [[10**8] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
A, B, C = list(map(int, input().split()))
G[A][B] = C
G[B][A] = C
DG = csgrap... | false | 22.222222 | [
"-G = [[10**8] * (N + 1) for _ in range(N + 1)] # 1-indexed",
"+G = [[10**8] * (N + 1) for _ in range(N + 1)]",
"- # 無向グラフ",
"- # 有向グラフ",
"- # G[A][B]=C",
"-dg = csgraph_from_dense(G, null_value=10**8)",
"-d = floyd_warshall(dg)",
"-ans = 10**12",
"-for Q in itertools.permutations(r):",
... | false | 0.25324 | 0.242628 | 1.043739 | [
"s160492589",
"s715113627"
] |
u077291787 | p04040 | python | s717701890 | s479117460 | 215 | 179 | 18,804 | 18,804 | Accepted | Accepted | 16.74 | # ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
# compute a toble of factorials (1-idx)
fact = [1] * (lim + 1)
x = 1
for i in range(1, lim + 1):
x = (x * i) % MOD
fact[i] = x
return fact
def get_inv(lim):
# compute a toble of inverse factorials ... | # ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
# compute a toble of factorials (1-idx)
fact = [1] * (lim + 1)
x = 1
for i in range(1, lim + 1):
x = (x * i) % MOD
fact[i] = x
return fact
def get_inv(lim):
# compute a toble of inverse factorials ... | 40 | 41 | 1,002 | 1,011 | # ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
# compute a toble of factorials (1-idx)
fact = [1] * (lim + 1)
x = 1
for i in range(1, lim + 1):
x = (x * i) % MOD
fact[i] = x
return fact
def get_inv(lim):
# compute a toble of inverse factorials (1-idx)
... | # ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
# compute a toble of factorials (1-idx)
fact = [1] * (lim + 1)
x = 1
for i in range(1, lim + 1):
x = (x * i) % MOD
fact[i] = x
return fact
def get_inv(lim):
# compute a toble of inverse factorials (1-idx)
... | false | 2.439024 | [
"+ x, y = H - A - 1, W + A - 2",
"- ans += comb(i + H - A - 1, i) * comb(W - i - 1 + A - 1, A - 1)",
"- ans %= MOD",
"+ ans += comb(x + i, i) * comb(y - i, A - 1)",
"+ ans %= MOD"
] | false | 0.200572 | 0.126467 | 1.585961 | [
"s717701890",
"s479117460"
] |
u063052907 | p04045 | python | s554188017 | s584895563 | 50 | 45 | 3,316 | 3,316 | Accepted | Accepted | 10 | def judge(lst_D, number):
str_number = str(number)
for d in lst_D:
if d in str_number:
return False
return True
def main():
N, K = list(map(int, input().split()))
lst_D = list(input().split())
cost = N
while True:
if judge(lst_D, cost):
... | def main():
N, K = list(map(int, input().split()))
lst_D = list(input().split())
cost = N
while True:
for c in str(cost):
if c in lst_D:
break
else: # break しなかったときのみ実行される
print(cost)
break
cost += 1
if __nam... | 22 | 17 | 410 | 344 | def judge(lst_D, number):
str_number = str(number)
for d in lst_D:
if d in str_number:
return False
return True
def main():
N, K = list(map(int, input().split()))
lst_D = list(input().split())
cost = N
while True:
if judge(lst_D, cost):
print(cost)
... | def main():
N, K = list(map(int, input().split()))
lst_D = list(input().split())
cost = N
while True:
for c in str(cost):
if c in lst_D:
break
else: # break しなかったときのみ実行される
print(cost)
break
cost += 1
if __name__ == "__main__"... | false | 22.727273 | [
"-def judge(lst_D, number):",
"- str_number = str(number)",
"- for d in lst_D:",
"- if d in str_number:",
"- return False",
"- return True",
"-",
"-",
"- if judge(lst_D, cost):",
"+ for c in str(cost):",
"+ if c in lst_D:",
"+ ... | false | 0.115257 | 0.043018 | 2.679245 | [
"s554188017",
"s584895563"
] |
u566529875 | p03222 | python | s995024611 | s512896579 | 92 | 19 | 3,192 | 3,064 | Accepted | Accepted | 79.35 | h,w,kk = list(map(int,input().split()))
dp = [[[] for j in range(w)] for i in range(h+1)]
# dp[i][j]
# 高さiにおいて点jに行き得る通り数
for i in range(h+1):
for j in range(w):
dp[i][j] = 0
dp[0][0]=1
mod = 1000000007
for i in range(1,h+1):
for j in range(1<<(w-1)):
yoko = [... | mod = 10**9+7
h,w,k = list(map(int,input().split()))
dp =[[0]*w for _ in range(h+1)]
dp[0][0]=1
fibo=[1]*10
for i in range(2,10):
fibo[i] = fibo[i-2]+fibo[i-1]
for i in range(1,h+1):
for j in range(w):
dp[i][j] = dp[i-1][j]*fibo[j]*fibo[w-j-1]%mod
if(j>0):
... | 49 | 17 | 1,909 | 585 | h, w, kk = list(map(int, input().split()))
dp = [[[] for j in range(w)] for i in range(h + 1)]
# dp[i][j]
# 高さiにおいて点jに行き得る通り数
for i in range(h + 1):
for j in range(w):
dp[i][j] = 0
dp[0][0] = 1
mod = 1000000007
for i in range(1, h + 1):
for j in range(1 << (w - 1)):
yoko = [False for loo in rang... | mod = 10**9 + 7
h, w, k = list(map(int, input().split()))
dp = [[0] * w for _ in range(h + 1)]
dp[0][0] = 1
fibo = [1] * 10
for i in range(2, 10):
fibo[i] = fibo[i - 2] + fibo[i - 1]
for i in range(1, h + 1):
for j in range(w):
dp[i][j] = dp[i - 1][j] * fibo[j] * fibo[w - j - 1] % mod
if j > 0:
... | false | 65.306122 | [
"-h, w, kk = list(map(int, input().split()))",
"-dp = [[[] for j in range(w)] for i in range(h + 1)]",
"-# dp[i][j]",
"-# 高さiにおいて点jに行き得る通り数",
"-for i in range(h + 1):",
"+mod = 10**9 + 7",
"+h, w, k = list(map(int, input().split()))",
"+dp = [[0] * w for _ in range(h + 1)]",
"+dp[0][0] = 1",
"+fib... | false | 0.006981 | 0.039802 | 0.175394 | [
"s995024611",
"s512896579"
] |
u325282913 | p03266 | python | s091114694 | s313422372 | 101 | 52 | 4,596 | 4,596 | Accepted | Accepted | 48.51 | N, K = list(map(int,input().split()))
arr = [0]*K
ans = 0
for i in range(1,N+1):
arr[i%K] += 1
for a in range(K):
b = (K-a) % K
c = (K-a) % K
if (b+c) % K == 0:
ans += arr[a] * arr[b] * arr[c]
print(ans) | N, K = list(map(int, input().split()))
arr = [0]*K
for i in range(1,N+1):
arr[i%K] += 1
print((arr[0]**3 if K%2!=0 else arr[0]**3+arr[K//2]**3)) | 11 | 5 | 231 | 144 | N, K = list(map(int, input().split()))
arr = [0] * K
ans = 0
for i in range(1, N + 1):
arr[i % K] += 1
for a in range(K):
b = (K - a) % K
c = (K - a) % K
if (b + c) % K == 0:
ans += arr[a] * arr[b] * arr[c]
print(ans)
| N, K = list(map(int, input().split()))
arr = [0] * K
for i in range(1, N + 1):
arr[i % K] += 1
print((arr[0] ** 3 if K % 2 != 0 else arr[0] ** 3 + arr[K // 2] ** 3))
| false | 54.545455 | [
"-ans = 0",
"-for a in range(K):",
"- b = (K - a) % K",
"- c = (K - a) % K",
"- if (b + c) % K == 0:",
"- ans += arr[a] * arr[b] * arr[c]",
"-print(ans)",
"+print((arr[0] ** 3 if K % 2 != 0 else arr[0] ** 3 + arr[K // 2] ** 3))"
] | false | 0.045413 | 0.204116 | 0.222489 | [
"s091114694",
"s313422372"
] |
u323045245 | p03835 | python | s987532949 | s189982865 | 1,710 | 1,275 | 2,940 | 2,940 | Accepted | Accepted | 25.44 | K, S = list(map(int, input().split(' ')))
count = 0
for i in range(K+1):
for j in range(K+1):
if S - i - j <= K and S - i - j >= 0:
count += 1
print(count)
| k, s = list(map(int, input().split()))
count = 0
for x in range(k+1):
for y in range(k+1):
if (k>=s-x-y>=0):
count += 1
print(count)
| 8 | 7 | 172 | 157 | K, S = list(map(int, input().split(" ")))
count = 0
for i in range(K + 1):
for j in range(K + 1):
if S - i - j <= K and S - i - j >= 0:
count += 1
print(count)
| k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
if k >= s - x - y >= 0:
count += 1
print(count)
| false | 12.5 | [
"-K, S = list(map(int, input().split(\" \")))",
"+k, s = list(map(int, input().split()))",
"-for i in range(K + 1):",
"- for j in range(K + 1):",
"- if S - i - j <= K and S - i - j >= 0:",
"+for x in range(k + 1):",
"+ for y in range(k + 1):",
"+ if k >= s - x - y >= 0:"
] | false | 0.045644 | 0.044475 | 1.026284 | [
"s987532949",
"s189982865"
] |
u593567568 | p02911 | python | s893229140 | s312298095 | 260 | 213 | 8,632 | 9,760 | Accepted | Accepted | 18.08 | N,K,Q = list(map(int,input().split()))
ANS = [0] * N
A = [int(eval(input())) for _ in range(Q)]
for a in A:
ANS[a-1] += 1
for i in range(N):
p = K - Q + ANS[i]
if p <= 0:
print('No')
else:
print('Yes')
exit()
| N,K,Q = list(map(int,input().split()))
ANS = [0] * N
A = [int(eval(input())) for _ in range(Q)]
for a in A:
ANS[a-1] += 1
R = []
for i in range(N):
p = K - Q + ANS[i]
if p <= 0:
R.append('No')
else:
R.append('Yes')
print(('\n'.join(R)))
| 14 | 15 | 234 | 261 | N, K, Q = list(map(int, input().split()))
ANS = [0] * N
A = [int(eval(input())) for _ in range(Q)]
for a in A:
ANS[a - 1] += 1
for i in range(N):
p = K - Q + ANS[i]
if p <= 0:
print("No")
else:
print("Yes")
exit()
| N, K, Q = list(map(int, input().split()))
ANS = [0] * N
A = [int(eval(input())) for _ in range(Q)]
for a in A:
ANS[a - 1] += 1
R = []
for i in range(N):
p = K - Q + ANS[i]
if p <= 0:
R.append("No")
else:
R.append("Yes")
print(("\n".join(R)))
| false | 6.666667 | [
"+R = []",
"- print(\"No\")",
"+ R.append(\"No\")",
"- print(\"Yes\")",
"-exit()",
"+ R.append(\"Yes\")",
"+print((\"\\n\".join(R)))"
] | false | 0.047116 | 0.08409 | 0.560305 | [
"s893229140",
"s312298095"
] |
u761320129 | p02713 | python | s102698609 | s316588316 | 1,173 | 198 | 9,176 | 68,412 | Accepted | Accepted | 83.12 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1,K+1):
for b in range(1,K+1):
g = gcd(a,b)
for c in range(1,K+1):
ans += gcd(g,c)
print(ans) | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1,K+1):
for j in range(1,K+1):
g = gcd(i,j)
for k in range(1,K+1):
ans += gcd(g,k)
print(ans) | 10 | 9 | 196 | 194 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
g = gcd(a, b)
for c in range(1, K + 1):
ans += gcd(g, c)
print(ans)
| from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
g = gcd(i, j)
for k in range(1, K + 1):
ans += gcd(g, k)
print(ans)
| false | 10 | [
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- g = gcd(a, b)",
"- for c in range(1, K + 1):",
"- ans += gcd(g, c)",
"+for i in range(1, K + 1):",
"+ for j in range(1, K + 1):",
"+ g = gcd(i, j)",
"+ for k in range(1, K + 1):",
"+ ... | false | 0.150053 | 0.233321 | 0.643117 | [
"s102698609",
"s316588316"
] |
u790012205 | p03449 | python | s085328542 | s345528890 | 167 | 17 | 38,512 | 3,060 | Accepted | Accepted | 89.82 | N = int(eval(input()))
A1 = list((list(map(int, input().split()))))
A2 = list((list(map(int, input().split()))))
Cmax = 0
for i in range(N):
C = sum(A1[:i + 1]) + sum(A2[i:])
Cmax = max(Cmax, C)
print(Cmax) | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
C = 0
c = 0
for i in range(N):
c = sum(A1[:i + 1]) + sum(A2[i:])
C = max(C, c)
print(C) | 8 | 9 | 203 | 198 | N = int(eval(input()))
A1 = list((list(map(int, input().split()))))
A2 = list((list(map(int, input().split()))))
Cmax = 0
for i in range(N):
C = sum(A1[: i + 1]) + sum(A2[i:])
Cmax = max(Cmax, C)
print(Cmax)
| N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
C = 0
c = 0
for i in range(N):
c = sum(A1[: i + 1]) + sum(A2[i:])
C = max(C, c)
print(C)
| false | 11.111111 | [
"-A1 = list((list(map(int, input().split()))))",
"-A2 = list((list(map(int, input().split()))))",
"-Cmax = 0",
"+A1 = list(map(int, input().split()))",
"+A2 = list(map(int, input().split()))",
"+C = 0",
"+c = 0",
"- C = sum(A1[: i + 1]) + sum(A2[i:])",
"- Cmax = max(Cmax, C)",
"-print(Cmax)"... | false | 0.133279 | 0.0359 | 3.712522 | [
"s085328542",
"s345528890"
] |
u273262677 | p02773 | python | s749683455 | s694922283 | 624 | 354 | 37,136 | 38,476 | Accepted | Accepted | 43.27 | l =[]
r=[]
n = int(input())
for i in range(n):
l.append(input())
d={}
for i in l:
if i in d:
d[i]+=1
else:
d[i]=1
print()
m = max(d.values())
for key,value in d.items():
if value==m:
r.append(key)
sorted_r = sorted(r)
print(*sorted_r,sep='\n')
| from collections import Counter
import sys
n = int(sys.stdin.readline())
sn = sys.stdin.read().split()
c = Counter(sn)
num = max(c.values())
ans = [i for i, j in list(c.items()) if j == num]
ans.sort()
print(('\n'.join(ans))) | 18 | 9 | 300 | 225 | l = []
r = []
n = int(input())
for i in range(n):
l.append(input())
d = {}
for i in l:
if i in d:
d[i] += 1
else:
d[i] = 1
print()
m = max(d.values())
for key, value in d.items():
if value == m:
r.append(key)
sorted_r = sorted(r)
print(*sorted_r, sep="\n")
| from collections import Counter
import sys
n = int(sys.stdin.readline())
sn = sys.stdin.read().split()
c = Counter(sn)
num = max(c.values())
ans = [i for i, j in list(c.items()) if j == num]
ans.sort()
print(("\n".join(ans)))
| false | 50 | [
"-l = []",
"-r = []",
"-n = int(input())",
"-for i in range(n):",
"- l.append(input())",
"-d = {}",
"-for i in l:",
"- if i in d:",
"- d[i] += 1",
"- else:",
"- d[i] = 1",
"-print()",
"-m = max(d.values())",
"-for key, value in d.items():",
"- if value == m:",
... | false | 0.036701 | 0.035822 | 1.024524 | [
"s749683455",
"s694922283"
] |
u333945892 | p03878 | python | s707000576 | s780310893 | 847 | 605 | 31,940 | 32,928 | Accepted | Accepted | 28.57 | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
N = int(eval(input()))
points = []
fo... | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return li... | 36 | 33 | 771 | 698 | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inpl():
return list(map(int, input().split()))
def inpls():
return list(input().split())
N = int(eval(input()))
p... | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inp... | false | 8.333333 | [
"-import sys, heapq, bisect, math, itertools, string, queue, datetime",
"+import sys, heapq, bisect, math, itertools, string, queue, copy, time",
"-def inpl():",
"- return list(map(int, input().split()))",
"+def inp():",
"+ return int(sys.stdin.readline())",
"-def inpls():",
"- return list(in... | false | 0.089031 | 0.100562 | 0.885339 | [
"s707000576",
"s780310893"
] |
u977661421 | p03107 | python | s433612596 | s366996161 | 22 | 18 | 3,956 | 3,188 | Accepted | Accepted | 18.18 | # -*- coding: utf-8 -*-
s = list(eval(input()))
ans = min(s.count('0'), s.count('1'))
print((ans * 2))
| # -*- coding: utf-8 -*-
s = eval(input())
ans = 2 * (min(s.count('0'), s.count('1')))
print(ans)
| 5 | 5 | 100 | 96 | # -*- coding: utf-8 -*-
s = list(eval(input()))
ans = min(s.count("0"), s.count("1"))
print((ans * 2))
| # -*- coding: utf-8 -*-
s = eval(input())
ans = 2 * (min(s.count("0"), s.count("1")))
print(ans)
| false | 0 | [
"-s = list(eval(input()))",
"-ans = min(s.count(\"0\"), s.count(\"1\"))",
"-print((ans * 2))",
"+s = eval(input())",
"+ans = 2 * (min(s.count(\"0\"), s.count(\"1\")))",
"+print(ans)"
] | false | 0.042872 | 0.170394 | 0.251607 | [
"s433612596",
"s366996161"
] |
u948524308 | p03495 | python | s945522875 | s190838986 | 185 | 111 | 45,332 | 25,644 | Accepted | Accepted | 40 | N,K = list(map(int,input().split()))
A =list(map(int,input().split()))
num = [0]*2000001
for i in range(N):
num[A[i]] +=1
V = 2000001 - num.count(0)
if V <=K:
print((0))
else:
num.sort()
num.reverse()
print((sum(num[K:]))) | N,K = list(map(int,input().split()))
A =list(map(int,input().split()))
num = [0]*(N+1)
for i in range(N):
num[A[i]] +=1
V = N+1 - num.count(0)
if V <=K:
print((0))
else:
num.sort()
num.reverse()
print((sum(num[K:]))) | 16 | 16 | 251 | 245 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
num = [0] * 2000001
for i in range(N):
num[A[i]] += 1
V = 2000001 - num.count(0)
if V <= K:
print((0))
else:
num.sort()
num.reverse()
print((sum(num[K:])))
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
num = [0] * (N + 1)
for i in range(N):
num[A[i]] += 1
V = N + 1 - num.count(0)
if V <= K:
print((0))
else:
num.sort()
num.reverse()
print((sum(num[K:])))
| false | 0 | [
"-num = [0] * 2000001",
"+num = [0] * (N + 1)",
"-V = 2000001 - num.count(0)",
"+V = N + 1 - num.count(0)"
] | false | 0.116132 | 0.035723 | 3.250906 | [
"s945522875",
"s190838986"
] |
u408071652 | p02924 | python | s168983938 | s854833960 | 109 | 69 | 64,280 | 64,696 | Accepted | Accepted | 36.7 | import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)
# map(int, sys.stdin.read().split())
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
print((int(N*(N-1)//2)))
if __name__ =... | import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)
# map(int, sys.stdin.read().split())
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
print((N*(N-1)//2))
if __name__ == "__... | 22 | 22 | 338 | 333 | import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10**9)
# map(int, sys.stdin.read().split())
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
print((int(N * (N - 1) // 2)))
if __name__ == "__main__":
ma... | import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10**9)
# map(int, sys.stdin.read().split())
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
print((N * (N - 1) // 2))
if __name__ == "__main__":
main()
| false | 0 | [
"- print((int(N * (N - 1) // 2)))",
"+ print((N * (N - 1) // 2))"
] | false | 0.106198 | 0.08135 | 1.305446 | [
"s168983938",
"s854833960"
] |
u513081876 | p03557 | python | s358628911 | s693006190 | 331 | 259 | 23,244 | 29,416 | Accepted | Accepted | 21.75 | import bisect
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
ans = 0
for i in B:
ans += (bisect.bisect_left(A, i)) * (N-bisect.bisect_right(C, i))
print(ans) | import bisect
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
ans = 0
for i in B:
num_A = bisect.bisect_left(A, i)
num_B = bisect.bisect_right(C, i)
ans += num_A * (N - num_B)
... | 12 | 17 | 283 | 327 | import bisect
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
ans = 0
for i in B:
ans += (bisect.bisect_left(A, i)) * (N - bisect.bisect_right(C, i))
print(ans)
| import bisect
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
ans = 0
for i in B:
num_A = bisect.bisect_left(A, i)
num_B = bisect.bisect_right(C, i)
ans += num_A * (N - num_B)
print(ans)
| false | 29.411765 | [
"-A = sorted([int(i) for i in input().split()])",
"-B = sorted([int(i) for i in input().split()])",
"-C = sorted([int(i) for i in input().split()])",
"+A = [int(i) for i in input().split()]",
"+B = [int(i) for i in input().split()]",
"+C = [int(i) for i in input().split()]",
"+A.sort()",
"+B.sort()",
... | false | 0.041581 | 0.042032 | 0.98927 | [
"s358628911",
"s693006190"
] |
u186838327 | p02580 | python | s467584811 | s015836802 | 295 | 213 | 89,748 | 104,100 | Accepted | Accepted | 27.8 | import sys
input = sys.stdin.buffer.readline
def main():
H, W, M = list(map(int, input().split()))
#HW = [0]*m
HC = [0]*H
WC = [0]*W
A = [0]*M
for i in range(M):
h, w = list(map(int, input().split()))
h, w = h-1, w-1
#HW[i] = (h, w)
HC[h] += ... | import sys
import io, os
#input = sys.stdin.buffer.readline
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
h, w, m = list(map(int, input().split()))
R = [0]*h
C = [0]*w
YX = []
for i in range(m):
y, x = list(map(int, input().split()))
y, x = y-1, x-1
R[y] +=1
C[x] +=1
YX.... | 46 | 34 | 921 | 645 | import sys
input = sys.stdin.buffer.readline
def main():
H, W, M = list(map(int, input().split()))
# HW = [0]*m
HC = [0] * H
WC = [0] * W
A = [0] * M
for i in range(M):
h, w = list(map(int, input().split()))
h, w = h - 1, w - 1
# HW[i] = (h, w)
HC[h] += 1
... | import sys
import io, os
# input = sys.stdin.buffer.readline
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
h, w, m = list(map(int, input().split()))
R = [0] * h
C = [0] * w
YX = []
for i in range(m):
y, x = list(map(int, input().split()))
y, x = y - 1, x - 1
R[y] += 1
C[x] += 1
YX.ap... | false | 26.086957 | [
"+import io, os",
"-input = sys.stdin.buffer.readline",
"-",
"-",
"-def main():",
"- H, W, M = list(map(int, input().split()))",
"- # HW = [0]*m",
"- HC = [0] * H",
"- WC = [0] * W",
"- A = [0] * M",
"- for i in range(M):",
"- h, w = list(map(int, input().split()))",
... | false | 0.035066 | 0.048983 | 0.715885 | [
"s467584811",
"s015836802"
] |
u517152997 | p02928 | python | s282764194 | s232904515 | 779 | 43 | 3,188 | 3,316 | Accepted | Accepted | 94.48 | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
DIV_NUM = 1000000000 + 7
N,K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
if N==1:
print((0))
exit()
answer = 0
for i in range(len(A)):
for j in range(len(A)-1,i,-1):
if A[j]<A[j-1]:
... | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
# import numpy as np
DIV_NUM = 1000000000 + 7
INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])
A = [int(x) for x in input().split()]
#AA = np.array(A , dtype='int64')
if N==1:
print((0))
... | 37 | 70 | 633 | 1,177 | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
DIV_NUM = 1000000000 + 7
N, K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
if N == 1:
print((0))
exit()
answer = 0
for i in range(len(A)):
for j in range(len(A) - 1, i, -1):
if A[j] < A[j - 1]:
... | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
# import numpy as np
DIV_NUM = 1000000000 + 7
INPUT_NUMS = list(map(int, input().split()))
N = int(INPUT_NUMS[0])
K = int(INPUT_NUMS[1])
A = [int(x) for x in input().split()]
# AA = np.array(A , dtype='int64')
if N == 1:
print((0))
exit()
nn = i... | false | 47.142857 | [
"+# import numpy as np",
"-N, K = list(map(int, input().split()))",
"+INPUT_NUMS = list(map(int, input().split()))",
"+N = int(INPUT_NUMS[0])",
"+K = int(INPUT_NUMS[1])",
"+# AA = np.array(A , dtype='int64')",
"-answer = 0",
"-for i in range(len(A)):",
"- for j in range(len(A) - 1, i, -1):",
"-... | false | 0.039558 | 0.038947 | 1.015678 | [
"s282764194",
"s232904515"
] |
u397384480 | p02949 | python | s775444571 | s471142258 | 1,910 | 1,710 | 75,868 | 75,880 | Accepted | Accepted | 10.47 | import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7
N,M,P = list(map(int,(input().split())))
line = []
for i in range(M):
a,b,c = list(map(int,(inp... | import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7
N,M,P = list(map(int,(input().split())))
line = []
for i in range(M):
a,b,c = list(map(int,(inp... | 81 | 60 | 2,427 | 1,735 | import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9 + 7
N, M, P = list(map(int, (input().split())))
line = []
for i in range(M):
a, b, c = list(map(int, (input().sp... | import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9 + 7
N, M, P = list(map(int, (input().split())))
line = []
for i in range(M):
a, b, c = list(map(int, (input().sp... | false | 25.925926 | [
"-# negative = [False]*N",
"-\"\"\"",
"-def Bellman_Ford(S,V,E,distance,negative):",
"- negative = [False]*N",
"- count = 1",
"- while count < V:",
"- count += 1",
"- for s,g,d in distance: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る",
"- if min_distance[s] != fl... | false | 0.101065 | 0.100834 | 1.002291 | [
"s775444571",
"s471142258"
] |
u075012704 | p03295 | python | s683682521 | s879492823 | 582 | 432 | 20,072 | 21,336 | Accepted | Accepted | 25.77 | N, M = list(map(int, input().split()))
E = []
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
E.append([a, b])
E.sort()
l, r = 0, float('inf')
ans = 0
for a, b in E:
if b <= l or a >= r:
ans += 1
l, r = a, b
else:
l = max(a, l)
... | N, M = list(map(int, input().split()))
E = []
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
E.append([a, b])
E.sort(key=lambda x: x[1])
r = 0
ans = 0
for a, b in E:
if a >= r:
ans += 1
r = b
print(ans)
| 19 | 17 | 343 | 273 | N, M = list(map(int, input().split()))
E = []
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
E.append([a, b])
E.sort()
l, r = 0, float("inf")
ans = 0
for a, b in E:
if b <= l or a >= r:
ans += 1
l, r = a, b
else:
l = max(a, l)
r = min(b,... | N, M = list(map(int, input().split()))
E = []
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
E.append([a, b])
E.sort(key=lambda x: x[1])
r = 0
ans = 0
for a, b in E:
if a >= r:
ans += 1
r = b
print(ans)
| false | 10.526316 | [
"-E.sort()",
"-l, r = 0, float(\"inf\")",
"+E.sort(key=lambda x: x[1])",
"+r = 0",
"- if b <= l or a >= r:",
"+ if a >= r:",
"- l, r = a, b",
"- else:",
"- l = max(a, l)",
"- r = min(b, r)",
"-print((ans + 1))",
"+ r = b",
"+print(ans)"
] | false | 0.139094 | 0.040395 | 3.443355 | [
"s683682521",
"s879492823"
] |
u623819879 | p02947 | python | s504598157 | s472418790 | 680 | 378 | 62,552 | 68,440 | Accepted | Accepted | 44.41 | from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int,input().split()))
def I():
... | from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
return int(input())
def MI():
return map(int,input().s... | 38 | 77 | 724 | 1,671 | from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int, input().split()))
def I():
re... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
# import random
def I():
return int(input())
def MI():
return map(int, input().spli... | false | 50.649351 | [
"-from heapq import heappush, heappop",
"+from heapq import heappush, heappop, heapify",
"-from itertools import permutations",
"+from itertools import permutations, combinations",
"+import math",
"+import time",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def SI():",
"- return input().split... | false | 0.006407 | 0.101019 | 0.063425 | [
"s504598157",
"s472418790"
] |
u360515075 | p03474 | python | s905769914 | s817706924 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int, input().split()))
S = eval(input())
if any([S.count("-") != 1, S[0] == "-", S[-1] == "-"]):
print ("No")
else:
a, b = S.split("-")
if len(a) == A and len(b) == B:
print ("Yes")
else:
print ("No") | A, B = list(map(int, input().split()))
S = eval(input())
print(("Yes" if S[A] == "-" and S.count("-") == 1 else "No")) | 11 | 4 | 231 | 109 | A, B = list(map(int, input().split()))
S = eval(input())
if any([S.count("-") != 1, S[0] == "-", S[-1] == "-"]):
print("No")
else:
a, b = S.split("-")
if len(a) == A and len(b) == B:
print("Yes")
else:
print("No")
| A, B = list(map(int, input().split()))
S = eval(input())
print(("Yes" if S[A] == "-" and S.count("-") == 1 else "No"))
| false | 63.636364 | [
"-if any([S.count(\"-\") != 1, S[0] == \"-\", S[-1] == \"-\"]):",
"- print(\"No\")",
"-else:",
"- a, b = S.split(\"-\")",
"- if len(a) == A and len(b) == B:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+print((\"Yes\" if S[A] == \"-\" and S.count(\"-\") == 1 else \"... | false | 0.053727 | 0.056427 | 0.952153 | [
"s905769914",
"s817706924"
] |
u572012241 | p02696 | python | s142961368 | s785728096 | 23 | 19 | 9,192 | 9,092 | Accepted | Accepted | 17.39 | a, b, n = list(map(int, input().split()))
if b>n:
print((a*n//b - a*((n)//b)))
else:
print((a*((n//b)*b-1)//b - a*(((n//b)*b-1)//b)))
| a,b,n=list(map(int,input().split()))
print((a*min(b-1,n)//b)) | 7 | 2 | 141 | 54 | a, b, n = list(map(int, input().split()))
if b > n:
print((a * n // b - a * ((n) // b)))
else:
print((a * ((n // b) * b - 1) // b - a * (((n // b) * b - 1) // b)))
| a, b, n = list(map(int, input().split()))
print((a * min(b - 1, n) // b))
| false | 71.428571 | [
"-if b > n:",
"- print((a * n // b - a * ((n) // b)))",
"-else:",
"- print((a * ((n // b) * b - 1) // b - a * (((n // b) * b - 1) // b)))",
"+print((a * min(b - 1, n) // b))"
] | false | 0.110241 | 0.044862 | 2.457322 | [
"s142961368",
"s785728096"
] |
u038024401 | p02713 | python | s410796421 | s729188764 | 1,961 | 535 | 9,168 | 9,176 | Accepted | Accepted | 72.72 | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(ans)
| from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = gcd(i, j)
if tmp == 1:
ans += K
else:
for k in range(1, K + 1):
ans += gcd(tmp, k)
print(ans)
| 10 | 14 | 195 | 281 | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(ans)
| from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = gcd(i, j)
if tmp == 1:
ans += K
else:
for k in range(1, K + 1):
ans += gcd(tmp, k)
print(ans)
| false | 28.571429 | [
"- for k in range(1, K + 1):",
"- ans += gcd(gcd(i, j), k)",
"+ tmp = gcd(i, j)",
"+ if tmp == 1:",
"+ ans += K",
"+ else:",
"+ for k in range(1, K + 1):",
"+ ans += gcd(tmp, k)"
] | false | 0.238182 | 0.062027 | 3.839965 | [
"s410796421",
"s729188764"
] |
u941753895 | p03160 | python | s116540491 | s962393844 | 226 | 127 | 28,180 | 16,708 | Accepted | Accepted | 43.81 | class struct:
def __init__(self,a,b):
self.a=a
self.b=b
n=int(eval(input()))
l=list(map(int,input().split()))
l2=[struct(0,0) for _ in range(n)]
l2[0].a=l[0]
l2[1].a=l[1]
l2[1].b=abs(l[0]-l[1])
i=2
for x in l[2:]:
l2[i].a=x
l2[i].b=min(abs(l2[i-2].a-x)+l2[i-2].b,
abs(l2[i-1].a-x)+l... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n=I(... | 21 | 25 | 350 | 501 | class struct:
def __init__(self, a, b):
self.a = a
self.b = b
n = int(eval(input()))
l = list(map(int, input().split()))
l2 = [struct(0, 0) for _ in range(n)]
l2[0].a = l[0]
l2[1].a = l[1]
l2[1].b = abs(l[0] - l[1])
i = 2
for x in l[2:]:
l2[i].a = x
l2[i].b = min(
abs(l2[i - 2].a -... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 16 | [
"-class struct:",
"- def __init__(self, a, b):",
"- self.a = a",
"- self.b = b",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"+",
"+sys.setrecursionlimit(10**7)",
"+inf = 10**20",
"+mod = 10**9 + 7",
"-n = int(eval(input(... | false | 0.036191 | 0.041404 | 0.874099 | [
"s116540491",
"s962393844"
] |
u644907318 | p02743 | python | s597831945 | s578500414 | 173 | 61 | 38,256 | 61,840 | Accepted | Accepted | 64.74 | a,b,c = list(map(int,input().split()))
if c>a+b and c**2-2*c*(a+b)+(a-b)**2>0:
print("Yes")
else:
print("No") | a,b,c = list(map(int,input().split()))
if c>a+b and (c-a-b)**2>4*a*b:
print("Yes")
else:
print("No") | 5 | 5 | 115 | 106 | a, b, c = list(map(int, input().split()))
if c > a + b and c**2 - 2 * c * (a + b) + (a - b) ** 2 > 0:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if c > a + b and (c - a - b) ** 2 > 4 * a * b:
print("Yes")
else:
print("No")
| false | 0 | [
"-if c > a + b and c**2 - 2 * c * (a + b) + (a - b) ** 2 > 0:",
"+if c > a + b and (c - a - b) ** 2 > 4 * a * b:"
] | false | 0.08482 | 0.042468 | 1.997285 | [
"s597831945",
"s578500414"
] |
u948524308 | p02954 | python | s014402752 | s855981209 | 176 | 109 | 4,864 | 6,400 | Accepted | Accepted | 38.07 | S=input()
N=len(S)
ans=[0]*N
cnt_o=1
cnt_e=0
idx=0
f=True #True=R
for i in range(1,N):
if f==True:
if S[i]=="R":
temp=cnt_e
cnt_e=cnt_o
cnt_o =temp+1
else:
ans[i-1]+=cnt_o
ans[i]=cnt_e
cnt_o=1
cn... | S=eval(input())
N=len(S)
ans=[0]*N
cnt=1
idx=0
f=True #True=R
for i in range(1,N):
if f==True:
if S[i]=="R":
cnt+=1
else:
ans[i-1]+=(cnt+1)//2
ans[i]=cnt//2
cnt=1
f=False
idx=i
else:
if S[i]=="L"... | 40 | 31 | 708 | 517 | S = input()
N = len(S)
ans = [0] * N
cnt_o = 1
cnt_e = 0
idx = 0
f = True # True=R
for i in range(1, N):
if f == True:
if S[i] == "R":
temp = cnt_e
cnt_e = cnt_o
cnt_o = temp + 1
else:
ans[i - 1] += cnt_o
ans[i] = cnt_e
cnt_o =... | S = eval(input())
N = len(S)
ans = [0] * N
cnt = 1
idx = 0
f = True # True=R
for i in range(1, N):
if f == True:
if S[i] == "R":
cnt += 1
else:
ans[i - 1] += (cnt + 1) // 2
ans[i] = cnt // 2
cnt = 1
f = False
idx = i
else:
... | false | 22.5 | [
"-S = input()",
"+S = eval(input())",
"-cnt_o = 1",
"-cnt_e = 0",
"+cnt = 1",
"- temp = cnt_e",
"- cnt_e = cnt_o",
"- cnt_o = temp + 1",
"+ cnt += 1",
"- ans[i - 1] += cnt_o",
"- ans[i] = cnt_e",
"- cnt_o = 1",
"- ... | false | 0.038297 | 0.097312 | 0.393549 | [
"s014402752",
"s855981209"
] |
u763881112 | p03610 | python | s554875810 | s616643075 | 218 | 151 | 13,788 | 12,756 | Accepted | Accepted | 30.73 |
import numpy as np
s=input()
for i in range(len(s)):
if(i%2==0):
print(s[i],end="")
print()
|
import numpy as np
print((input()[::2]))
| 10 | 6 | 117 | 48 | import numpy as np
s = input()
for i in range(len(s)):
if i % 2 == 0:
print(s[i], end="")
print()
| import numpy as np
print((input()[::2]))
| false | 40 | [
"-s = input()",
"-for i in range(len(s)):",
"- if i % 2 == 0:",
"- print(s[i], end=\"\")",
"-print()",
"+print((input()[::2]))"
] | false | 0.111303 | 0.119643 | 0.930291 | [
"s554875810",
"s616643075"
] |
u912237403 | p00043 | python | s294805589 | s393343090 | 30 | 10 | 4,276 | 4,284 | Accepted | Accepted | 66.67 | def check(x,j=1):
if sum(x)==0: return True
for i in range(j,10):
y = x[:]
if y[i]>=3:
y[i] -= 3
if check(y,i): return True
y = x[:]
if i<8 and y[i]>0 and y[i+1]>0 and y[i+2]>0:
y[i] -= 1
y[i+1] -= 1
y[i+2] -=... | def check(x,j=1):
if sum(x)==0: return True
for i in range(j,10):
if x[i]>0:break
y = x[:]
if y[i]>=3:
y[i] -= 3
if check(y,i): return True
y = x[:]
if i<8 and y[i]>0 and y[i+1]>0 and y[i+2]>0:
y[i] -= 1
y[i+1] -= 1
y[i+2] -= 1
... | 38 | 39 | 889 | 874 | def check(x, j=1):
if sum(x) == 0:
return True
for i in range(j, 10):
y = x[:]
if y[i] >= 3:
y[i] -= 3
if check(y, i):
return True
y = x[:]
if i < 8 and y[i] > 0 and y[i + 1] > 0 and y[i + 2] > 0:
y[i] -= 1
y... | def check(x, j=1):
if sum(x) == 0:
return True
for i in range(j, 10):
if x[i] > 0:
break
y = x[:]
if y[i] >= 3:
y[i] -= 3
if check(y, i):
return True
y = x[:]
if i < 8 and y[i] > 0 and y[i + 1] > 0 and y[i + 2] > 0:
y[i] -= 1
... | false | 2.564103 | [
"- y = x[:]",
"- if y[i] >= 3:",
"- y[i] -= 3",
"- if check(y, i):",
"- return True",
"- y = x[:]",
"- if i < 8 and y[i] > 0 and y[i + 1] > 0 and y[i + 2] > 0:",
"- y[i] -= 1",
"- y[i + 1] -= 1",
"- y... | false | 0.189396 | 0.076887 | 2.463291 | [
"s294805589",
"s393343090"
] |
u352394527 | p02371 | python | s447098491 | s669194531 | 990 | 860 | 43,244 | 46,316 | Accepted | Accepted | 13.13 | from heapq import heappop, heappush
INF = 10 ** 20
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
s, t, w = list(map(int, input().split()))
edges[s].append((w, t))
edges[t].append((w, s))
cost = [INF] * n
que = [(0, 0)]
cost[0] = 0
while que:
acc, num = heappop(... | from heapq import heappop, heappush
INF = 10 ** 20
def main():
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
s, t, w = list(map(int, input().split()))
edges[s].append((w, t))
edges[t].append((w, s))
def func(start):
cost = [INF] * n
que = [(0... | 34 | 31 | 742 | 681 | from heapq import heappop, heappush
INF = 10**20
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
s, t, w = list(map(int, input().split()))
edges[s].append((w, t))
edges[t].append((w, s))
cost = [INF] * n
que = [(0, 0)]
cost[0] = 0
while que:
acc, num = heappop(que)
for ... | from heapq import heappop, heappush
INF = 10**20
def main():
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
s, t, w = list(map(int, input().split()))
edges[s].append((w, t))
edges[t].append((w, s))
def func(start):
cost = [INF] * n
... | false | 8.823529 | [
"-n = int(eval(input()))",
"-edges = [[] for _ in range(n)]",
"-for _ in range(n - 1):",
"- s, t, w = list(map(int, input().split()))",
"- edges[s].append((w, t))",
"- edges[t].append((w, s))",
"-cost = [INF] * n",
"-que = [(0, 0)]",
"-cost[0] = 0",
"-while que:",
"- acc, num = heapp... | false | 0.038123 | 0.036789 | 1.036251 | [
"s447098491",
"s669194531"
] |
u186838327 | p02763 | python | s952468416 | s881277797 | 1,755 | 1,552 | 477,816 | 476,372 | Accepted | Accepted | 11.57 | n = int(eval(input()))
s = list(str(eval(input())))
s = [{ord(c)-ord('a')} for c in s]
def segfunc(x, y):
return x | y
def init(init_val):
# set_val
for i in range(n):
seg[i+num-1] = init_val[i]
# built
for i in range(num-2, -1, -1):
seg[i] = segfunc(seg[2*i+1], seg[2*... | import sys
input = sys.stdin.readline
n = int(eval(input()))
s = list(str(eval(input())))
s = [{ord(c)-ord('a')} for c in s]
def segfunc(x, y):
return x | y
def init(init_val):
# set_val
for i in range(n):
seg[i+num-1] = init_val[i]
# built
for i in range(num-2, -1, -1):
... | 62 | 65 | 1,292 | 1,335 | n = int(eval(input()))
s = list(str(eval(input())))
s = [{ord(c) - ord("a")} for c in s]
def segfunc(x, y):
return x | y
def init(init_val):
# set_val
for i in range(n):
seg[i + num - 1] = init_val[i]
# built
for i in range(num - 2, -1, -1):
seg[i] = segfunc(seg[2 * i + 1], seg[2... | import sys
input = sys.stdin.readline
n = int(eval(input()))
s = list(str(eval(input())))
s = [{ord(c) - ord("a")} for c in s]
def segfunc(x, y):
return x | y
def init(init_val):
# set_val
for i in range(n):
seg[i + num - 1] = init_val[i]
# built
for i in range(num - 2, -1, -1):
... | false | 4.615385 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.042016 | 0.060342 | 0.696287 | [
"s952468416",
"s881277797"
] |
u497046426 | p02735 | python | s100749103 | s491633230 | 80 | 72 | 7,028 | 7,284 | Accepted | Accepted | 10 | from itertools import product
from heapq import heappush, heappop
class Dijkstra:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
self.E[init].append((end, weight))
if undirected: s... | from itertools import product
from collections import deque
class ZeroOneBFS:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
assert weight in [0, 1]
self.E[init].append((en... | 61 | 65 | 2,043 | 2,137 | from itertools import product
from heapq import heappush, heappop
class Dijkstra:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
self.E[init].append((end, weight))
if undirected:
... | from itertools import product
from collections import deque
class ZeroOneBFS:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
assert weight in [0, 1]
self.E[init].append((end, weight))
... | false | 6.153846 | [
"-from heapq import heappush, heappop",
"+from collections import deque",
"-class Dijkstra:",
"+class ZeroOneBFS:",
"+ assert weight in [0, 1]",
"- self.dist = [INF] * self.N # the distance of each vertex from s",
"- self.prev = [",
"- -1",
"- ] * self.N # th... | false | 0.041133 | 0.040065 | 1.02667 | [
"s100749103",
"s491633230"
] |
u644907318 | p03994 | python | s658732070 | s359046490 | 111 | 78 | 3,572 | 77,176 | Accepted | Accepted | 29.73 | s = input().strip()
K = int(eval(input()))
if K>len(s)*26:
d = (K-len(s)*26)//26
K = K-26*d
x = ""
for i in range(len(s)):
if i<len(s)-1 and (26-(ord(s[i])-ord("a")))%26 <= K:
x += "a"
K -= (26-(ord(s[i])-ord("a")))%26
elif i<len(s)-1:
x += s[i]
elif i==len(s)-1:
... | A = {i-97:chr(i) for i in range(97,123)}
B = {v:k for k,v in list(A.items())}
s = list(input().strip())
K = int(eval(input()))
for i in range(len(s)-1):
if s[i]!="a" and K>=26-B[s[i]]:
K -= (26-B[s[i]])
s[i]="a"
k = K%26
ind = (B[s[-1]]+k)%26
s[-1] = A[ind]
print(("".join(s))) | 19 | 12 | 439 | 294 | s = input().strip()
K = int(eval(input()))
if K > len(s) * 26:
d = (K - len(s) * 26) // 26
K = K - 26 * d
x = ""
for i in range(len(s)):
if i < len(s) - 1 and (26 - (ord(s[i]) - ord("a"))) % 26 <= K:
x += "a"
K -= (26 - (ord(s[i]) - ord("a"))) % 26
elif i < len(s) - 1:
x += s[i]
... | A = {i - 97: chr(i) for i in range(97, 123)}
B = {v: k for k, v in list(A.items())}
s = list(input().strip())
K = int(eval(input()))
for i in range(len(s) - 1):
if s[i] != "a" and K >= 26 - B[s[i]]:
K -= 26 - B[s[i]]
s[i] = "a"
k = K % 26
ind = (B[s[-1]] + k) % 26
s[-1] = A[ind]
print(("".join(s)))
| false | 36.842105 | [
"-s = input().strip()",
"+A = {i - 97: chr(i) for i in range(97, 123)}",
"+B = {v: k for k, v in list(A.items())}",
"+s = list(input().strip())",
"-if K > len(s) * 26:",
"- d = (K - len(s) * 26) // 26",
"- K = K - 26 * d",
"-x = \"\"",
"-for i in range(len(s)):",
"- if i < len(s) - 1 and ... | false | 0.06994 | 0.069683 | 1.003691 | [
"s658732070",
"s359046490"
] |
u316386814 | p03967 | python | s722370381 | s950940484 | 49 | 18 | 3,188 | 3,188 | Accepted | Accepted | 63.27 | s = eval(input())
ans = 0
for i, x in enumerate(s):
if i % 2 == 0 and x == 'p':
ans -= 1
elif i % 2 == 1 and x == 'g':
ans += 1
print(ans) | s = eval(input())
ans = len(s) // 2 - s.count('p')
print(ans) | 10 | 5 | 167 | 61 | s = eval(input())
ans = 0
for i, x in enumerate(s):
if i % 2 == 0 and x == "p":
ans -= 1
elif i % 2 == 1 and x == "g":
ans += 1
print(ans)
| s = eval(input())
ans = len(s) // 2 - s.count("p")
print(ans)
| false | 50 | [
"-ans = 0",
"-for i, x in enumerate(s):",
"- if i % 2 == 0 and x == \"p\":",
"- ans -= 1",
"- elif i % 2 == 1 and x == \"g\":",
"- ans += 1",
"+ans = len(s) // 2 - s.count(\"p\")"
] | false | 0.036839 | 0.037985 | 0.969839 | [
"s722370381",
"s950940484"
] |
u912237403 | p00084 | python | s963638891 | s378902102 | 20 | 10 | 4,192 | 4,192 | Accepted | Accepted | 50 | s=input()
s=s.replace(","," ")
s=s.replace("."," ")
for w in s.split():
if 3<=len(w)<=6:print(w, end=' ')
print() | s=input().replace(","," ").replace("."," ").split()
s=" ".join([w for w in s if 2<len(w)<7])
print(s) | 6 | 3 | 113 | 106 | s = input()
s = s.replace(",", " ")
s = s.replace(".", " ")
for w in s.split():
if 3 <= len(w) <= 6:
print(w, end=" ")
print()
| s = input().replace(",", " ").replace(".", " ").split()
s = " ".join([w for w in s if 2 < len(w) < 7])
print(s)
| false | 50 | [
"-s = input()",
"-s = s.replace(\",\", \" \")",
"-s = s.replace(\".\", \" \")",
"-for w in s.split():",
"- if 3 <= len(w) <= 6:",
"- print(w, end=\" \")",
"-print()",
"+s = input().replace(\",\", \" \").replace(\".\", \" \").split()",
"+s = \" \".join([w for w in s if 2 < len(w) < 7])",
... | false | 0.034896 | 0.034219 | 1.019772 | [
"s963638891",
"s378902102"
] |
u543152022 | p02911 | python | s669987930 | s637181206 | 298 | 170 | 9,052 | 9,056 | Accepted | Accepted | 42.95 | n, k, q = list(map(int, input().split()))
def judge():
val = {}
for _ in range(q):
a = int(eval(input()))
val[a-1] = val.get(a-1,0) + 1
#print(val)
for i in range(n):
if val.get(i,k-q) + (k - q) > 0:
print('Yes')
else:
print('No')
if k ... | import sys
input = sys.stdin.readline
n, k, q = list(map(int, input().split()))
def judge():
val = {}
for _ in range(q):
a = int(eval(input()))
val[a-1] = val.get(a-1,0) + 1
#print(val)
for i in range(n):
if val.get(i,k-q) + (k - q) > 0:
print('Yes')
... | 16 | 18 | 378 | 418 | n, k, q = list(map(int, input().split()))
def judge():
val = {}
for _ in range(q):
a = int(eval(input()))
val[a - 1] = val.get(a - 1, 0) + 1
# print(val)
for i in range(n):
if val.get(i, k - q) + (k - q) > 0:
print("Yes")
else:
print("No")
if k... | import sys
input = sys.stdin.readline
n, k, q = list(map(int, input().split()))
def judge():
val = {}
for _ in range(q):
a = int(eval(input()))
val[a - 1] = val.get(a - 1, 0) + 1
# print(val)
for i in range(n):
if val.get(i, k - q) + (k - q) > 0:
print("Yes")
... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.083337 | 0.04458 | 1.869381 | [
"s669987930",
"s637181206"
] |
u645250356 | p03186 | python | s930885446 | s782410593 | 188 | 39 | 38,640 | 10,484 | Accepted | Accepted | 79.26 | from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return ... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.std... | 16 | 18 | 511 | 458 | from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush
import sys, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def ... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 11.111111 | [
"-from heapq import heapify, heappop, heappush",
"-import sys, bisect, math, itertools, string, queue",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys... | false | 0.034321 | 0.054686 | 0.627601 | [
"s930885446",
"s782410593"
] |
u077898957 | p02885 | python | s637620710 | s979362115 | 1,816 | 17 | 22,028 | 2,940 | Accepted | Accepted | 99.06 | import numpy as np
import sys
a,b = list(map(int,input().split()))
c = b*2
print((a-c if a-c>=0 else 0))
| a,b=list(map(int,input().split()))
print((max(0,a-2*b)))
| 5 | 2 | 101 | 50 | import numpy as np
import sys
a, b = list(map(int, input().split()))
c = b * 2
print((a - c if a - c >= 0 else 0))
| a, b = list(map(int, input().split()))
print((max(0, a - 2 * b)))
| false | 60 | [
"-import numpy as np",
"-import sys",
"-",
"-c = b * 2",
"-print((a - c if a - c >= 0 else 0))",
"+print((max(0, a - 2 * b)))"
] | false | 0.047067 | 0.045846 | 1.026644 | [
"s637620710",
"s979362115"
] |
u535803878 | p02781 | python | s717347009 | s802176410 | 184 | 86 | 38,384 | 62,612 | Accepted | Accepted | 53.26 | ## ABC154E
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
M = 10**9+7 # 出力の制限
N = 100 # 必要なテーブルサイズ
def cmb(n, r, M):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return (g1[n] * g2[r] * g2... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = eval(input())
k = int(eval(input()))
l = len(n)
dp1 = [[0]*(k+1) for _ in range(l+1)]
dp0 = [[0]*(k+1) for _ in range(l+1)]
dp1[0][0] = 1
dp0[0][0] = 0
for i in... | 59 | 27 | 1,494 | 749 | ## ABC154E
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
M = 10**9 + 7 # 出力の制限
N = 100 # 必要なテーブルサイズ
def cmb(n, r, M):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return (g1[n] * g2[r] * g2[n - r]) ... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = eval(input())
k = int(eval(input()))
l = len(n)
dp1 = [[0] * (k + 1) for _ in range(l + 1)]
dp0 = [[0] * (k + 1) for _ in range(l + 1)]
dp1[0][0] = 1
dp0[0][0] = 0
for i in ... | false | 54.237288 | [
"-## ABC154E",
"-M = 10**9 + 7 # 出力の制限",
"-N = 100 # 必要なテーブルサイズ",
"-",
"-",
"-def cmb(n, r, M):",
"- if r < 0 or r > n:",
"- return 0",
"- r = min(r, n - r)",
"- return (g1[n] * g2[r] * g2[n - r]) % M",
"-",
"-",
"-g1 = [None] * (N + 1) # 元テーブル",
"-g2 = [None] * (N + 1) ... | false | 0.034331 | 0.04043 | 0.849125 | [
"s717347009",
"s802176410"
] |
u029169777 | p03250 | python | s398967129 | s063723750 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | A,B,C=list(map(int,input().split()))
print((max(A,B,C)*9+A+B+C)) | A,B,C=list(map(int,input().split()))
maxa=max(A,B,C)
print((maxa*9+A+B+C)) | 3 | 5 | 59 | 72 | A, B, C = list(map(int, input().split()))
print((max(A, B, C) * 9 + A + B + C))
| A, B, C = list(map(int, input().split()))
maxa = max(A, B, C)
print((maxa * 9 + A + B + C))
| false | 40 | [
"-print((max(A, B, C) * 9 + A + B + C))",
"+maxa = max(A, B, C)",
"+print((maxa * 9 + A + B + C))"
] | false | 0.089445 | 0.073463 | 1.217561 | [
"s398967129",
"s063723750"
] |
u647766105 | p00111 | python | s535080739 | s997610401 | 30 | 20 | 4,348 | 4,348 | Accepted | Accepted | 33.33 | tableA,tableB = {},{}
def main():
make_table()
while True:
try:
s = "".join([tableA[c] for c in input()])
except:
break
tmp,ans = "",""
for c in s:
tmp += c
if tmp in tableB:
ans += tableB[tmp]
... | def main():
tableA,tableB = make_table()
while True:
try:
s = "".join([tableA[c] for c in input()])
except:
break
tmp,ans = "",""
for c in s:
tmp += c
if tmp in tableB:
ans += tableB[tmp]
... | 87 | 86 | 1,925 | 1,918 | tableA, tableB = {}, {}
def main():
make_table()
while True:
try:
s = "".join([tableA[c] for c in input()])
except:
break
tmp, ans = "", ""
for c in s:
tmp += c
if tmp in tableB:
ans += tableB[tmp]
... | def main():
tableA, tableB = make_table()
while True:
try:
s = "".join([tableA[c] for c in input()])
except:
break
tmp, ans = "", ""
for c in s:
tmp += c
if tmp in tableB:
ans += tableB[tmp]
tmp = ""
... | false | 1.149425 | [
"-tableA, tableB = {}, {}",
"-",
"-",
"- make_table()",
"+ tableA, tableB = make_table()",
"- global tableA, tableB",
"+ return tableA, tableB"
] | false | 0.03957 | 0.039613 | 0.998904 | [
"s535080739",
"s997610401"
] |
u024612773 | p03848 | python | s123343052 | s340249041 | 1,875 | 217 | 54,540 | 52,588 | Accepted | Accepted | 88.43 | n=int(eval(input()))
a=list(map(int,input().split()))
def valid():
b = list(range((n+1)&1, n+1, 2))
for i in range(len(b)-1, -1, -1):
b.insert(i, b[i])
if b[0] == 0:
b = b[1:]
return list(sorted(a)) == b
ans,mod = 1,10**9+7
for i in range(n//2):
ans = (ans * 2) % mod
prin... | n=int(eval(input()))
a=list(sorted(map(int,input().split())))
def valid():
cur=(n+1)&1
for i in range(n):
if n&1==0 and i&1==0 and i>0:
cur+=2
if n&1==1 and i&1==1:
cur+=2
if a[i] != cur: return False
return True
print((2**(n//2)%(10**9+7) if valid(... | 13 | 12 | 332 | 322 | n = int(eval(input()))
a = list(map(int, input().split()))
def valid():
b = list(range((n + 1) & 1, n + 1, 2))
for i in range(len(b) - 1, -1, -1):
b.insert(i, b[i])
if b[0] == 0:
b = b[1:]
return list(sorted(a)) == b
ans, mod = 1, 10**9 + 7
for i in range(n // 2):
ans = (ans * 2)... | n = int(eval(input()))
a = list(sorted(map(int, input().split())))
def valid():
cur = (n + 1) & 1
for i in range(n):
if n & 1 == 0 and i & 1 == 0 and i > 0:
cur += 2
if n & 1 == 1 and i & 1 == 1:
cur += 2
if a[i] != cur:
return False
return True
... | false | 7.692308 | [
"-a = list(map(int, input().split()))",
"+a = list(sorted(map(int, input().split())))",
"- b = list(range((n + 1) & 1, n + 1, 2))",
"- for i in range(len(b) - 1, -1, -1):",
"- b.insert(i, b[i])",
"- if b[0] == 0:",
"- b = b[1:]",
"- return list(sorted(a)) == b",
"+ cur =... | false | 0.039759 | 0.086353 | 0.460428 | [
"s123343052",
"s340249041"
] |
u537722973 | p02681 | python | s145417407 | s236567639 | 68 | 62 | 61,688 | 61,832 | Accepted | Accepted | 8.82 | s = eval(input())
t = eval(input())
print(((t == s+t[-1])*'Yes' + (t != s+t[-1])*'No')) | s = input()
t = input()
print('Yes') if t == s+t[-1] else print('No')
| 3 | 3 | 75 | 71 | s = eval(input())
t = eval(input())
print(((t == s + t[-1]) * "Yes" + (t != s + t[-1]) * "No"))
| s = input()
t = input()
print("Yes") if t == s + t[-1] else print("No")
| false | 0 | [
"-s = eval(input())",
"-t = eval(input())",
"-print(((t == s + t[-1]) * \"Yes\" + (t != s + t[-1]) * \"No\"))",
"+s = input()",
"+t = input()",
"+print(\"Yes\") if t == s + t[-1] else print(\"No\")"
] | false | 0.04234 | 0.04085 | 1.036467 | [
"s145417407",
"s236567639"
] |
u729133443 | p02955 | python | s274230418 | s912231883 | 264 | 162 | 42,716 | 3,064 | Accepted | Accepted | 38.64 | n,k,*a=list(map(int,open(0).read().split()))
s,m=sum(a),1
for i in sum([[s//i,i]for i in range(1,int(s**.5)+1)if s%i<1],[]):
p=[0]+sorted(j%i for j in a)
for j in range(n):p[j+1]+=p[j]
f=t=0
for j in range(n):
f|=t==p[~j]<=k
t+=i-p[~j]+p[-j-2]
m=max(m,i*f)
print(m) | n,k,*a=list(map(int,open(0).read().split()))
s=sum(a)
b=[]
for i in range(1,int(s**.5)+1):b+=[s//i,i]*(s%i<1)
m=1
for i in b:c=sorted(j%i for j in a);m=max(m,i*(sum(c[:-sum(c)//i])<=k))
print(m) | 11 | 7 | 287 | 194 | n, k, *a = list(map(int, open(0).read().split()))
s, m = sum(a), 1
for i in sum([[s // i, i] for i in range(1, int(s**0.5) + 1) if s % i < 1], []):
p = [0] + sorted(j % i for j in a)
for j in range(n):
p[j + 1] += p[j]
f = t = 0
for j in range(n):
f |= t == p[~j] <= k
t += i - p[... | n, k, *a = list(map(int, open(0).read().split()))
s = sum(a)
b = []
for i in range(1, int(s**0.5) + 1):
b += [s // i, i] * (s % i < 1)
m = 1
for i in b:
c = sorted(j % i for j in a)
m = max(m, i * (sum(c[: -sum(c) // i]) <= k))
print(m)
| false | 36.363636 | [
"-s, m = sum(a), 1",
"-for i in sum([[s // i, i] for i in range(1, int(s**0.5) + 1) if s % i < 1], []):",
"- p = [0] + sorted(j % i for j in a)",
"- for j in range(n):",
"- p[j + 1] += p[j]",
"- f = t = 0",
"- for j in range(n):",
"- f |= t == p[~j] <= k",
"- t += i ... | false | 0.095394 | 0.046111 | 2.06878 | [
"s274230418",
"s912231883"
] |
u909643606 | p03837 | python | s497343196 | s350140900 | 355 | 297 | 25,508 | 15,896 | Accepted | Accepted | 16.34 | #import sys
#import numpy as np
from scipy.sparse import csr_matrix, coo_matrix
from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10000)
N, M = [int(i) for i in input().split()]
rows = []
cols = []
weights = []
for _ in range(M):
# u v 間のコスト
u, v, a = [int(i) for i in input().s... | #import sys
#import numpy as np
from scipy.sparse import csr_matrix, coo_matrix
from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10000)
N, M = [int(i) for i in input().split()]
rows = []
cols = []
weights = []
for _ in range(M):
# u v 間のコスト
u, v, a = [int(i) for i in input().s... | 35 | 36 | 871 | 855 | # import sys
# import numpy as np
from scipy.sparse import csr_matrix, coo_matrix
from scipy.sparse.csgraph import dijkstra
# sys.setrecursionlimit(10000)
N, M = [int(i) for i in input().split()]
rows = []
cols = []
weights = []
for _ in range(M):
# u v 間のコスト
u, v, a = [int(i) for i in input().split()]
row... | # import sys
# import numpy as np
from scipy.sparse import csr_matrix, coo_matrix
from scipy.sparse.csgraph import dijkstra
# sys.setrecursionlimit(10000)
N, M = [int(i) for i in input().split()]
rows = []
cols = []
weights = []
for _ in range(M):
# u v 間のコスト
u, v, a = [int(i) for i in input().split()]
row... | false | 2.777778 | [
"-path = []",
"+path = [[0] * N for j in range(N)]",
"- path.append([j, pre[i][j]])",
"+ path[j][pre[i][j]] = 1",
"- path.append([pre[i][j], j])",
"-path = list(map(list, set(map(tuple, path))))",
"-print((M - len(path)))",
"+ path[pre[i][j]]... | false | 0.249497 | 0.256234 | 0.973708 | [
"s497343196",
"s350140900"
] |
u440566786 | p02890 | python | s156802001 | s405415353 | 551 | 477 | 120,732 | 105,512 | Accepted | Accepted | 13.43 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
from collections import Counter
n=int(eval(input()))
A=list(Counter(list(map(int,input().split()))).values())
A.sort()
m=len(A)
S=[0]*(m+1) # cumulative... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bin_sort(A,n_min=None,n_max=None):
if(n_min is None): n_min=min(A)
if(n_max is None): n_max=max(A)
bin=[0]*(n_max-n_min+1)
for a in A: bin[a-n_min]+=1
B=[]
for i i... | 27 | 32 | 726 | 813 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
from collections import Counter
n = int(eval(input()))
A = list(Counter(list(map(int, input().split()))).values())
A.sort()
m = len(A)
S = [0] * (m + 1... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def bin_sort(A, n_min=None, n_max=None):
if n_min is None:
n_min = min(A)
if n_max is None:
n_max = max(A)
bin = [0] * (n_max - n_min + 1)
for a in A:
... | false | 15.625 | [
"+def bin_sort(A, n_min=None, n_max=None):",
"+ if n_min is None:",
"+ n_min = min(A)",
"+ if n_max is None:",
"+ n_max = max(A)",
"+ bin = [0] * (n_max - n_min + 1)",
"+ for a in A:",
"+ bin[a - n_min] += 1",
"+ B = []",
"+ for i in range(n_min, n_max + 1):"... | false | 0.040284 | 0.06576 | 0.612585 | [
"s156802001",
"s405415353"
] |
u474423089 | p03846 | python | s093721012 | s702148472 | 64 | 59 | 14,812 | 14,820 | Accepted | Accepted | 7.81 | from collections import Counter
def main():
mod = 10**9+7
n = int(eval(input()))
a = list(map(int,input().split(' ')))
c = Counter(a)
ans = 1
if n%2 != 0:
for key,i in list(c.items()):
if key%2 != 0 or (key==0 and i != 1) or (key != 0 and i != 2):
an... | from collections import Counter
def main():
mod = 10**9+7
n = int(eval(input()))
a = list(map(int,input().split(' ')))
c = Counter(a)
ans = (2**(n//2))%mod
if n%2 != 0:
for key,i in list(c.items()):
if key%2 != 0 or (key==0 and i != 1) or (key != 0 and i != 2):
... | 26 | 21 | 676 | 536 | from collections import Counter
def main():
mod = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split(" ")))
c = Counter(a)
ans = 1
if n % 2 != 0:
for key, i in list(c.items()):
if key % 2 != 0 or (key == 0 and i != 1) or (key != 0 and i != 2):
... | from collections import Counter
def main():
mod = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split(" ")))
c = Counter(a)
ans = (2 ** (n // 2)) % mod
if n % 2 != 0:
for key, i in list(c.items()):
if key % 2 != 0 or (key == 0 and i != 1) or (key != 0 and i != ... | false | 19.230769 | [
"- ans = 1",
"+ ans = (2 ** (n // 2)) % mod",
"- elif i == 2:",
"- ans *= 2",
"- ans %= mod",
"- elif i == 2:",
"- ans *= 2",
"- ans %= mod"
] | false | 0.03866 | 0.039832 | 0.97057 | [
"s093721012",
"s702148472"
] |
u030726788 | p02934 | python | s320144859 | s727430503 | 147 | 27 | 12,420 | 9,152 | Accepted | Accepted | 81.63 | import numpy as np
n = int(eval(input()))
a = np.array(list(map(int,input().split())))
print((1.0/sum(1.0/a))) | n = int(eval(input()))
a = list(map(int,input().split()))
v = 0.0
for i in a:
v += 1.0 / i
print((1.0 / v)) | 4 | 6 | 105 | 108 | import numpy as np
n = int(eval(input()))
a = np.array(list(map(int, input().split())))
print((1.0 / sum(1.0 / a)))
| n = int(eval(input()))
a = list(map(int, input().split()))
v = 0.0
for i in a:
v += 1.0 / i
print((1.0 / v))
| false | 33.333333 | [
"-import numpy as np",
"-",
"-a = np.array(list(map(int, input().split())))",
"-print((1.0 / sum(1.0 / a)))",
"+a = list(map(int, input().split()))",
"+v = 0.0",
"+for i in a:",
"+ v += 1.0 / i",
"+print((1.0 / v))"
] | false | 1.3733 | 0.102547 | 13.391939 | [
"s320144859",
"s727430503"
] |
u319245933 | p02663 | python | s004328963 | s229898898 | 60 | 33 | 61,668 | 9,076 | Accepted | Accepted | 45 | import sys
H1,M1,H2,M2,K = list(map(int, sys.stdin.readline().split()))
print(((H2 - H1) * 60 + M2 - M1 - K))
| H1, M1, H2, M2, K = list(map(int, input().split()))
print(((H2*60 + M2 - K) - (H1*60 + M1))) | 5 | 2 | 108 | 85 | import sys
H1, M1, H2, M2, K = list(map(int, sys.stdin.readline().split()))
print(((H2 - H1) * 60 + M2 - M1 - K))
| H1, M1, H2, M2, K = list(map(int, input().split()))
print(((H2 * 60 + M2 - K) - (H1 * 60 + M1)))
| false | 60 | [
"-import sys",
"-",
"-H1, M1, H2, M2, K = list(map(int, sys.stdin.readline().split()))",
"-print(((H2 - H1) * 60 + M2 - M1 - K))",
"+H1, M1, H2, M2, K = list(map(int, input().split()))",
"+print(((H2 * 60 + M2 - K) - (H1 * 60 + M1)))"
] | false | 0.036143 | 0.102732 | 0.351818 | [
"s004328963",
"s229898898"
] |
u628335443 | p02773 | python | s694643398 | s675901830 | 611 | 536 | 35,572 | 35,984 | Accepted | Accepted | 12.27 | from collections import Counter
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
cnt = Counter(s)
max_count = max(cnt.values())
ans = [k for k, count in list(cnt.items()) if count == max_count]
for a in sorted(ans):
print(a)
| from collections import Counter
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
cnt = Counter(s)
max_count = max(cnt.values())
ans = [k for k, count in list(cnt.items()) if count == max_count]
print(("\n".join(sorted(ans))))
| 13 | 12 | 254 | 248 | from collections import Counter
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
cnt = Counter(s)
max_count = max(cnt.values())
ans = [k for k, count in list(cnt.items()) if count == max_count]
for a in sorted(ans):
print(a)
| from collections import Counter
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
cnt = Counter(s)
max_count = max(cnt.values())
ans = [k for k, count in list(cnt.items()) if count == max_count]
print(("\n".join(sorted(ans))))
| false | 7.692308 | [
"-for a in sorted(ans):",
"- print(a)",
"+print((\"\\n\".join(sorted(ans))))"
] | false | 0.078317 | 0.040411 | 1.937992 | [
"s694643398",
"s675901830"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.