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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u133936772 | p03038 | python | s560863961 | s227577799 | 489 | 372 | 36,856 | 36,856 | Accepted | Accepted | 23.93 | import sys
f=lambda:list(map(int,sys.stdin.readline().split()))
n,m=f()
la=sorted(f())
ll=sorted([list(f()) for _ in range(m)],key=lambda k:-k[1])
ls=[]
t=a=0
for b,c in ll:
if t+b>n: ls+=[c]*(n-t); t=n; break
ls+=[c]*b; t+=b
for i in range(n):
if i<t: a+=max(la[i],ls[i])
else: a+=la[i]
print(a) | import sys
f=lambda:list(map(int,sys.stdin.readline().split()))
n,m=f();l=f();t=n
for b,c in sorted([f() for _ in range(m)],key=lambda k:-k[1]):
l+=[c]*b;t+=b
if t>n*2:break
l.sort()
print((sum(l[-n:]))) | 14 | 8 | 311 | 213 | import sys
f = lambda: list(map(int, sys.stdin.readline().split()))
n, m = f()
la = sorted(f())
ll = sorted([list(f()) for _ in range(m)], key=lambda k: -k[1])
ls = []
t = a = 0
for b, c in ll:
if t + b > n:
ls += [c] * (n - t)
t = n
break
ls += [c] * b
t += b
for i in range(n):
... | import sys
f = lambda: list(map(int, sys.stdin.readline().split()))
n, m = f()
l = f()
t = n
for b, c in sorted([f() for _ in range(m)], key=lambda k: -k[1]):
l += [c] * b
t += b
if t > n * 2:
break
l.sort()
print((sum(l[-n:])))
| false | 42.857143 | [
"-la = sorted(f())",
"-ll = sorted([list(f()) for _ in range(m)], key=lambda k: -k[1])",
"-ls = []",
"-t = a = 0",
"-for b, c in ll:",
"- if t + b > n:",
"- ls += [c] * (n - t)",
"- t = n",
"+l = f()",
"+t = n",
"+for b, c in sorted([f() for _ in range(m)], key=lambda k: -k[1]):... | false | 0.068054 | 0.033468 | 2.03341 | [
"s560863961",
"s227577799"
] |
u984276646 | p02984 | python | s325370751 | s507594104 | 243 | 129 | 14,156 | 20,536 | Accepted | Accepted | 46.91 | N = int(input())
A = list(map(int, input().split()))
D = 0
for i in range(N):
D += A[i] * ((-1) ** i)
two_x1 = D
for i in range(N - 1):
print(two_x1, end = ' ')
two_x1 = -two_x1 + 2 * A[i]
print(two_x1)
| N = int(input())
A = list(map(int, input().split()))
S = 0
sign = 1
for i in range(N):
S += sign * A[i]
sign *= -1
for i in range(N):
print(S, end = ' '*(i<N-1))
S *= -1
S += 2*A[i]
print()
| 10 | 12 | 217 | 210 | N = int(input())
A = list(map(int, input().split()))
D = 0
for i in range(N):
D += A[i] * ((-1) ** i)
two_x1 = D
for i in range(N - 1):
print(two_x1, end=" ")
two_x1 = -two_x1 + 2 * A[i]
print(two_x1)
| N = int(input())
A = list(map(int, input().split()))
S = 0
sign = 1
for i in range(N):
S += sign * A[i]
sign *= -1
for i in range(N):
print(S, end=" " * (i < N - 1))
S *= -1
S += 2 * A[i]
print()
| false | 16.666667 | [
"-D = 0",
"+S = 0",
"+sign = 1",
"- D += A[i] * ((-1) ** i)",
"-two_x1 = D",
"-for i in range(N - 1):",
"- print(two_x1, end=\" \")",
"- two_x1 = -two_x1 + 2 * A[i]",
"-print(two_x1)",
"+ S += sign * A[i]",
"+ sign *= -1",
"+for i in range(N):",
"+ print(S, end=\" \" * (i <... | false | 0.033494 | 0.035159 | 0.952659 | [
"s325370751",
"s507594104"
] |
u657818166 | p03354 | python | s652021905 | s862946315 | 778 | 579 | 14,580 | 15,220 | Accepted | Accepted | 25.58 | class unionFind():
def __init__(self,n):
self.tree=[-1]*n
def find(self,x):
if self.tree[x]<0:
return x
else:
return self.find(self.tree[x])
def union(self,x,y):
xr=self.find(x)
yr=self.find(y)
if xr!=yr:
if self.tree[xr]<self.tree[yr]:
self.tree[yr]=xr
elif self.tree[xr]>se... | class unionFind():
def __init__(self,n):
self.tree=[-1]*n
def find(self,x):
if self.tree[x]<0:
return x
else:
self.tree[x]=self.find(self.tree[x])
return self.tree[x]
def union(self,x,y):
xr=self.find(x)
yr=self.find(y)
if xr!=yr:
if self.tree[xr]<self.tree[yr]:
self.tree[yr... | 34 | 35 | 722 | 751 | class unionFind:
def __init__(self, n):
self.tree = [-1] * n
def find(self, x):
if self.tree[x] < 0:
return x
else:
return self.find(self.tree[x])
def union(self, x, y):
xr = self.find(x)
yr = self.find(y)
if xr != yr:
if ... | class unionFind:
def __init__(self, n):
self.tree = [-1] * n
def find(self, x):
if self.tree[x] < 0:
return x
else:
self.tree[x] = self.find(self.tree[x])
return self.tree[x]
def union(self, x, y):
xr = self.find(x)
yr = self.find... | false | 2.857143 | [
"- return self.find(self.tree[x])",
"+ self.tree[x] = self.find(self.tree[x])",
"+ return self.tree[x]"
] | false | 0.045322 | 0.08697 | 0.521125 | [
"s652021905",
"s862946315"
] |
u153665391 | p02264 | python | s800691541 | s148948765 | 750 | 460 | 15,932 | 13,276 | Accepted | Accepted | 38.67 | N, Q = list(map(int, input().strip().split()))
A = []
D = {}
for l in range(N):
n, t = input().strip().split()
A.append([n, int(t)])
T = 0
while A:
l = A.pop(0)
if l[1] > Q:
l[1] -= Q
T += Q
A.append(l)
else:
T += l[1]
print((l[0], T)) | from collections import deque
n,p=list(map(int ,input().split()))
que=deque([])
for i in range(n):
name,time=input().split()
time=int(time)
que.append([name,time])
t=0
while len(que)>0:
atop=que.popleft()
spend=min(atop[1],p)
atop[1]-=spend
t+=spend
if(atop[1]==0):
... | 18 | 20 | 306 | 377 | N, Q = list(map(int, input().strip().split()))
A = []
D = {}
for l in range(N):
n, t = input().strip().split()
A.append([n, int(t)])
T = 0
while A:
l = A.pop(0)
if l[1] > Q:
l[1] -= Q
T += Q
A.append(l)
else:
T += l[1]
print((l[0], T))
| from collections import deque
n, p = list(map(int, input().split()))
que = deque([])
for i in range(n):
name, time = input().split()
time = int(time)
que.append([name, time])
t = 0
while len(que) > 0:
atop = que.popleft()
spend = min(atop[1], p)
atop[1] -= spend
t += spend
if atop[1] ==... | false | 10 | [
"-N, Q = list(map(int, input().strip().split()))",
"-A = []",
"-D = {}",
"-for l in range(N):",
"- n, t = input().strip().split()",
"- A.append([n, int(t)])",
"-T = 0",
"-while A:",
"- l = A.pop(0)",
"- if l[1] > Q:",
"- l[1] -= Q",
"- T += Q",
"- A.append(l)... | false | 0.03698 | 0.036378 | 1.016546 | [
"s800691541",
"s148948765"
] |
u138083942 | p02627 | python | s181119287 | s496782556 | 80 | 27 | 61,592 | 9,028 | Accepted | Accepted | 66.25 |
def resolve():
import sys
input = sys.stdin.readline
n = str(input().rstrip())
if n.isupper():
print("A")
else:
print("a")
# a_set = set()
# duplicate = set()
# for a in input().rstrip().split():
# a = int(a)
# if a in a_set:
# ... |
def resolve():
import sys
input = sys.stdin.readline
n = input().rstrip()
if n.islower():
print("a")
else:
print("A")
if __name__ == "__main__":
resolve()
| 43 | 15 | 871 | 214 | def resolve():
import sys
input = sys.stdin.readline
n = str(input().rstrip())
if n.isupper():
print("A")
else:
print("a")
# a_set = set()
# duplicate = set()
# for a in input().rstrip().split():
# a = int(a)
# if a in a_set:
# duplicate.add(a... | def resolve():
import sys
input = sys.stdin.readline
n = input().rstrip()
if n.islower():
print("a")
else:
print("A")
if __name__ == "__main__":
resolve()
| false | 65.116279 | [
"- n = str(input().rstrip())",
"- if n.isupper():",
"+ n = input().rstrip()",
"+ if n.islower():",
"+ print(\"a\")",
"+ else:",
"- else:",
"- print(\"a\")",
"- # a_set = set()",
"- # duplicate = set()",
"- # for a in input().rstrip().split():",
"- # ... | false | 0.043068 | 0.044254 | 0.973183 | [
"s181119287",
"s496782556"
] |
u654470292 | p03775 | python | s420364089 | s427240799 | 174 | 81 | 39,152 | 74,912 | Accepted | Accepted | 53.45 | n=int(eval(input()))
a,b=0,0
for i in range(1,n+1):
if n%i==0:
a=i
b=n//i
if i>n//i:
break
alog,blog=1,1
i=0
while 1:
a=a//10
if a==0:
break
alog+=1
while 1:
b=b//10
if b==0:
break
blog+=1
print((max(alog,blog))) | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 24 | 33 | 302 | 847 | n = int(eval(input()))
a, b = 0, 0
for i in range(1, n + 1):
if n % i == 0:
a = i
b = n // i
if i > n // i:
break
alog, blog = 1, 1
i = 0
while 1:
a = a // 10
if a == 0:
break
alog += 1
while 1:
b = b // 10
if b == 0:
break
blog += 1
print((max(alo... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 27.272727 | [
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+def ruiseki(lst):",
"+ return... | false | 0.060144 | 0.051994 | 1.156741 | [
"s420364089",
"s427240799"
] |
u173148629 | p02632 | python | s851615691 | s602456466 | 1,875 | 921 | 107,572 | 117,360 | Accepted | Accepted | 50.88 | K=int(eval(input()))
S=eval(input())
N=len(S)
mod=10**9+7
fact=[0]*(K+N)
fact[0]=fact[1]=1
for i in range(2,K+N):
fact[i]=fact[i-1]*i%mod
def comb(n,r):
ret=fact[n]*pow(fact[r],mod-2,mod)*pow(fact[n-r],mod-2,mod)%mod
return ret
ans=0
for i in range(K+1):
ans+=pow(26,i,mod)*pow(25,K-i,... | K=int(eval(input()))
S=eval(input())
N=len(S)
mod=10**9+7
fact=[1]*(K+N)
for i in range(2,K+N):
fact[i]=fact[i-1]*i%mod
inv=[1]*(K+N)
inv[K+N-1]=pow(fact[K+N-1],mod-2,mod)
for i in range(K+N-2,0,-1):
inv[i]=inv[i+1]*(i+1)%mod
def comb(n,r):
ret=fact[n]*inv[r]*inv[n-r]%mod
return r... | 20 | 24 | 358 | 427 | K = int(eval(input()))
S = eval(input())
N = len(S)
mod = 10**9 + 7
fact = [0] * (K + N)
fact[0] = fact[1] = 1
for i in range(2, K + N):
fact[i] = fact[i - 1] * i % mod
def comb(n, r):
ret = fact[n] * pow(fact[r], mod - 2, mod) * pow(fact[n - r], mod - 2, mod) % mod
return ret
ans = 0
for i in range(K +... | K = int(eval(input()))
S = eval(input())
N = len(S)
mod = 10**9 + 7
fact = [1] * (K + N)
for i in range(2, K + N):
fact[i] = fact[i - 1] * i % mod
inv = [1] * (K + N)
inv[K + N - 1] = pow(fact[K + N - 1], mod - 2, mod)
for i in range(K + N - 2, 0, -1):
inv[i] = inv[i + 1] * (i + 1) % mod
def comb(n, r):
r... | false | 16.666667 | [
"-fact = [0] * (K + N)",
"-fact[0] = fact[1] = 1",
"+fact = [1] * (K + N)",
"+inv = [1] * (K + N)",
"+inv[K + N - 1] = pow(fact[K + N - 1], mod - 2, mod)",
"+for i in range(K + N - 2, 0, -1):",
"+ inv[i] = inv[i + 1] * (i + 1) % mod",
"- ret = fact[n] * pow(fact[r], mod - 2, mod) * pow(fact[n - ... | false | 0.036984 | 0.036378 | 1.016678 | [
"s851615691",
"s602456466"
] |
u695811449 | p03078 | python | s786667493 | s877739811 | 1,060 | 404 | 151,768 | 56,668 | Accepted | Accepted | 61.89 | import sys
input = sys.stdin.readline
X,Y,Z,K=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
AB=[]
for a in A:
for b in B:
AB.append(a+b)
AB.sort(reverse=True)
AB=AB[:K]
ALL=[]
for ab in AB:
for c ... | import sys
import heapq
input = sys.stdin.readline
X,Y,Z,K=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ALL=[0]*K
for a in A:
for b in B:
for... | 26 | 27 | 412 | 556 | import sys
input = sys.stdin.readline
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = []
for a in A:
for b in B:
AB.append(a + b)
AB.sort(reverse=True)
AB = AB[:K]
ALL = []
for ab in AB:
for c ... | import sys
import heapq
input = sys.stdin.readline
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ALL = [0] * K
for a in A:
for b in B:
fo... | false | 3.703704 | [
"+import heapq",
"-AB = []",
"+A.sort(reverse=True)",
"+B.sort(reverse=True)",
"+C.sort(reverse=True)",
"+ALL = [0] * K",
"- AB.append(a + b)",
"-AB.sort(reverse=True)",
"-AB = AB[:K]",
"-ALL = []",
"-for ab in AB:",
"- for c in C:",
"- ALL.append(ab + c)",
"+ for c... | false | 0.036246 | 0.044817 | 0.808757 | [
"s786667493",
"s877739811"
] |
u780962115 | p03295 | python | s202193657 | s818519030 | 589 | 318 | 25,372 | 91,184 | Accepted | Accepted | 46.01 | # islands war
n,m=list(map(int,input().split()))
lists=[]
for i in range(m):
a,b=list(map(int,input().split()))
lists.append((a,b))
lists=sorted(lists,key=lambda x:(x[0],x[1]))
Uselist=[0 for i in range(n)]
for j in lists:
if not Uselist[j[0]]:
Uselist[j[0]]=j
else:
continu... | # atcoder -take a rest-(easy)
def main():
N, M = list(map(int, input().split()))
conflict = [tuple(map(int, input().split())) for i in range(M)]
newest_destroyed = -1
conflict.sort(key=lambda x: x[1])
res = 0
for l, r in conflict:
if not (l <= newest_destroyed < r):
... | 33 | 20 | 663 | 437 | # islands war
n, m = list(map(int, input().split()))
lists = []
for i in range(m):
a, b = list(map(int, input().split()))
lists.append((a, b))
lists = sorted(lists, key=lambda x: (x[0], x[1]))
Uselist = [0 for i in range(n)]
for j in lists:
if not Uselist[j[0]]:
Uselist[j[0]] = j
else:
c... | # atcoder -take a rest-(easy)
def main():
N, M = list(map(int, input().split()))
conflict = [tuple(map(int, input().split())) for i in range(M)]
newest_destroyed = -1
conflict.sort(key=lambda x: x[1])
res = 0
for l, r in conflict:
if not (l <= newest_destroyed < r):
res += 1
... | false | 39.393939 | [
"-# islands war",
"-n, m = list(map(int, input().split()))",
"-lists = []",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- lists.append((a, b))",
"-lists = sorted(lists, key=lambda x: (x[0], x[1]))",
"-Uselist = [0 for i in range(n)]",
"-for j in lists:",
"- if not ... | false | 0.038789 | 0.037782 | 1.026674 | [
"s202193657",
"s818519030"
] |
u761529120 | p03111 | python | s322736136 | s918065718 | 576 | 121 | 62,044 | 74,288 | Accepted | Accepted | 78.99 | def dfs(depth):
if depth == N:
ans.append(cal(v))
return
for i in range(4):
v[depth] = i
dfs(depth+1)
def cal(v):
tmp = [0] * 3
for i in range(N):
if v[i] == 0:
tmp[0] += l[i]
elif v[i] == 1:
tmp[1] += l[i]
... | from itertools import product
def main():
N, A, B, C = list(map(int, input().split()))
L = list(int(eval(input())) for _ in range(N))
ans = 0
# A => 0
# B => 1
# C => 2
ans = float('inf')
for item in product(list(range(4)), repeat=N):
length_A = 0
cnt_A = 0
... | 44 | 40 | 887 | 1,096 | def dfs(depth):
if depth == N:
ans.append(cal(v))
return
for i in range(4):
v[depth] = i
dfs(depth + 1)
def cal(v):
tmp = [0] * 3
for i in range(N):
if v[i] == 0:
tmp[0] += l[i]
elif v[i] == 1:
tmp[1] += l[i]
elif v[i] == ... | from itertools import product
def main():
N, A, B, C = list(map(int, input().split()))
L = list(int(eval(input())) for _ in range(N))
ans = 0
# A => 0
# B => 1
# C => 2
ans = float("inf")
for item in product(list(range(4)), repeat=N):
length_A = 0
cnt_A = 0
scor... | false | 9.090909 | [
"-def dfs(depth):",
"- if depth == N:",
"- ans.append(cal(v))",
"- return",
"- for i in range(4):",
"- v[depth] = i",
"- dfs(depth + 1)",
"+from itertools import product",
"-def cal(v):",
"- tmp = [0] * 3",
"- for i in range(N):",
"- if v[i] == 0:... | false | 0.167611 | 0.150646 | 1.112614 | [
"s322736136",
"s918065718"
] |
u860829879 | p03108 | python | s716023632 | s748702621 | 1,074 | 414 | 111,192 | 100,460 | Accepted | Accepted | 61.45 | N,M=list(map(int,input().split()))
edge=[list(map(int,input().split())) for _ in range(M)]
current=N*(N-1)//2
ret=[0]*M
par=list(range(N+1))
cnt=[1]*(N+1)
rank=[0]*(N+1)
def find(x):
if x==par[x]:
return x
else:
par[x]=find(par[x])
return par[x]
def same(x,y):
r... | n,m=list(map(int,input().split()))
edge=[list(map(int,input().split())) for _ in range(m)]
ans=[]
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.par... | 50 | 67 | 815 | 1,554 | N, M = list(map(int, input().split()))
edge = [list(map(int, input().split())) for _ in range(M)]
current = N * (N - 1) // 2
ret = [0] * M
par = list(range(N + 1))
cnt = [1] * (N + 1)
rank = [0] * (N + 1)
def find(x):
if x == par[x]:
return x
else:
par[x] = find(par[x])
return par[x]
... | n, m = list(map(int, input().split()))
edge = [list(map(int, input().split())) for _ in range(m)]
ans = []
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[... | false | 25.373134 | [
"-N, M = list(map(int, input().split()))",
"-edge = [list(map(int, input().split())) for _ in range(M)]",
"-current = N * (N - 1) // 2",
"-ret = [0] * M",
"-par = list(range(N + 1))",
"-cnt = [1] * (N + 1)",
"-rank = [0] * (N + 1)",
"+n, m = list(map(int, input().split()))",
"+edge = [list(map(int, ... | false | 0.043638 | 0.043881 | 0.994444 | [
"s716023632",
"s748702621"
] |
u075012704 | p03798 | python | s542285034 | s999960901 | 382 | 156 | 8,932 | 14,736 | Accepted | Accepted | 59.16 | N = int(eval(input()))
S = eval(input())
# 0: S, 1: Wとする
X = ['S', 'W']
for P in [[0, 0], [0, 1], [1, 0], [1, 1]]:
for i, s in enumerate(S[1:], start=1):
if s == 'o' and P[i] == 0:
P.append(P[i - 1])
if s == 'o' and P[i] == 1:
P.append(P[i - 1] ^ 1)
if... | N = int(eval(input()))
S = list(map(int, input().replace('o', '0').replace('x', '1')))
for p in [[0, 0], [0, 1], [1, 0], [1, 1]]:
for s in S[1:]:
if p[-1] ^ p[-2] ^ s == 1:
p.append(1)
else:
p.append(0)
if (p[0] == p[-1]) and (p[-2] ^ p[-3] ^ p[0] ^ S[-1] == 0... | 40 | 15 | 981 | 470 | N = int(eval(input()))
S = eval(input())
# 0: S, 1: Wとする
X = ["S", "W"]
for P in [[0, 0], [0, 1], [1, 0], [1, 1]]:
for i, s in enumerate(S[1:], start=1):
if s == "o" and P[i] == 0:
P.append(P[i - 1])
if s == "o" and P[i] == 1:
P.append(P[i - 1] ^ 1)
if s == "x" and P[... | N = int(eval(input()))
S = list(map(int, input().replace("o", "0").replace("x", "1")))
for p in [[0, 0], [0, 1], [1, 0], [1, 1]]:
for s in S[1:]:
if p[-1] ^ p[-2] ^ s == 1:
p.append(1)
else:
p.append(0)
if (
(p[0] == p[-1])
and (p[-2] ^ p[-3] ^ p[0] ^ S[-1... | false | 62.5 | [
"-S = eval(input())",
"-# 0: S, 1: Wとする",
"-X = [\"S\", \"W\"]",
"-for P in [[0, 0], [0, 1], [1, 0], [1, 1]]:",
"- for i, s in enumerate(S[1:], start=1):",
"- if s == \"o\" and P[i] == 0:",
"- P.append(P[i - 1])",
"- if s == \"o\" and P[i] == 1:",
"- P.append(P... | false | 0.089616 | 0.112004 | 0.800111 | [
"s542285034",
"s999960901"
] |
u380524497 | p04011 | python | s001310706 | s599430053 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n, k, x, y = [int(eval(input())) for i in range(4)]
sum = 0
for t in range(1, n+1):
if t <= k:
sum += x
else:
sum += y
print(sum)
| n = int(eval(input()))
k = int(eval(input()))
x = int(eval(input()))
y = int(eval(input()))
if n <= k:
ans = n * x
else:
ans = k * x + (n-k) * y
print(ans) | 10 | 11 | 159 | 151 | n, k, x, y = [int(eval(input())) for i in range(4)]
sum = 0
for t in range(1, n + 1):
if t <= k:
sum += x
else:
sum += y
print(sum)
| n = int(eval(input()))
k = int(eval(input()))
x = int(eval(input()))
y = int(eval(input()))
if n <= k:
ans = n * x
else:
ans = k * x + (n - k) * y
print(ans)
| false | 9.090909 | [
"-n, k, x, y = [int(eval(input())) for i in range(4)]",
"-sum = 0",
"-for t in range(1, n + 1):",
"- if t <= k:",
"- sum += x",
"- else:",
"- sum += y",
"-print(sum)",
"+n = int(eval(input()))",
"+k = int(eval(input()))",
"+x = int(eval(input()))",
"+y = int(eval(input()))"... | false | 0.041441 | 0.040107 | 1.033246 | [
"s001310706",
"s599430053"
] |
u350093546 | p03835 | python | s138765924 | s274634390 | 260 | 86 | 40,940 | 67,228 | Accepted | Accepted | 66.92 | cnt=0
k,s=list(map(int,input().split()))
for i in range(k+1):
for j in range(k+1):
if 0<=s-i-j<=k:
cnt+=1
print(cnt)
| k,s=list(map(int,input().split()))
ans=0
for i in range(k+1):
for j in range(k+1):
if 0<=s-i-j<=k:
ans+=1
print(ans)
| 7 | 9 | 145 | 144 | cnt = 0
k, s = list(map(int, input().split()))
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - i - j <= k:
cnt += 1
print(cnt)
| k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - i - j <= k:
ans += 1
print(ans)
| false | 22.222222 | [
"-cnt = 0",
"+ans = 0",
"- cnt += 1",
"-print(cnt)",
"+ ans += 1",
"+print(ans)"
] | false | 0.036731 | 0.043911 | 0.836507 | [
"s138765924",
"s274634390"
] |
u115838990 | p02612 | python | s512597754 | s871035369 | 31 | 25 | 9,136 | 9,080 | Accepted | Accepted | 19.35 | n = int(eval(input()))
r = n % 1000
x = 0 if r == 0 else 1000-r
print(x) | print((-int(eval(input()))%1000)) | 4 | 1 | 69 | 25 | n = int(eval(input()))
r = n % 1000
x = 0 if r == 0 else 1000 - r
print(x)
| print((-int(eval(input())) % 1000))
| false | 75 | [
"-n = int(eval(input()))",
"-r = n % 1000",
"-x = 0 if r == 0 else 1000 - r",
"-print(x)",
"+print((-int(eval(input())) % 1000))"
] | false | 0.042998 | 0.1043 | 0.412252 | [
"s512597754",
"s871035369"
] |
u999854911 | p01719 | python | s906223149 | s278407269 | 440 | 360 | 12,352 | 9,072 | Accepted | Accepted | 18.18 | import sys
def calc(x, n, p1, p2):
dp = []
for i in range(n):
dp.append( [0] * (x + 1) )
pocket = x
for i in range(n):
for j in range(x + 1):
dp[i][j] = dp[i - 1][j]
if j - p1[i] >= 0:
dp[i][j] = max(dp[i][j], dp[i][j - p1[i]] + p2[i]... | import sys
def main():
n,d,x = list(map(int, sys.stdin.readline().split()))
pp = []
for i in range(d):
pp.append( list(map(int,sys.stdin.readline().split())) )
dp = [0] * 100001
curr_x = x
for k in range(d - 1):
next_x = curr_x
for i in range(curr_x + 1):
... | 32 | 26 | 729 | 665 | import sys
def calc(x, n, p1, p2):
dp = []
for i in range(n):
dp.append([0] * (x + 1))
pocket = x
for i in range(n):
for j in range(x + 1):
dp[i][j] = dp[i - 1][j]
if j - p1[i] >= 0:
dp[i][j] = max(dp[i][j], dp[i][j - p1[i]] + p2[i])
... | import sys
def main():
n, d, x = list(map(int, sys.stdin.readline().split()))
pp = []
for i in range(d):
pp.append(list(map(int, sys.stdin.readline().split())))
dp = [0] * 100001
curr_x = x
for k in range(d - 1):
next_x = curr_x
for i in range(curr_x + 1):
d... | false | 18.75 | [
"-",
"-",
"-def calc(x, n, p1, p2):",
"- dp = []",
"- for i in range(n):",
"- dp.append([0] * (x + 1))",
"- pocket = x",
"- for i in range(n):",
"- for j in range(x + 1):",
"- dp[i][j] = dp[i - 1][j]",
"- if j - p1[i] >= 0:",
"- dp... | false | 0.037006 | 0.036638 | 1.010031 | [
"s906223149",
"s278407269"
] |
u919633157 | p03821 | python | s310055234 | s263412002 | 359 | 192 | 16,720 | 16,596 | Accepted | Accepted | 46.52 | # https://atcoder.jp/contests/agc009/tasks/agc009_a
n=int(eval(input()))
ab=[tuple(map(int,input().split())) for _ in range(n)]
ans=0
for a,b in reversed(ab):
a+=ans
res=a%b
if res:
ans+=b-res
print(ans) | # https://atcoder.jp/contests/agc009/tasks/agc009_a
import sys
input=sys.stdin.readline
n=int(eval(input()))
ab=[tuple(map(int,input().split())) for _ in range(n)]
ans=0
for a,b in reversed(ab):
a+=ans
res=a%b
if res:
ans+=b-res
print(ans) | 12 | 15 | 230 | 270 | # https://atcoder.jp/contests/agc009/tasks/agc009_a
n = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ans = 0
for a, b in reversed(ab):
a += ans
res = a % b
if res:
ans += b - res
print(ans)
| # https://atcoder.jp/contests/agc009/tasks/agc009_a
import sys
input = sys.stdin.readline
n = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ans = 0
for a, b in reversed(ab):
a += ans
res = a % b
if res:
ans += b - res
print(ans)
| false | 20 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.07334 | 0.037663 | 1.94727 | [
"s310055234",
"s263412002"
] |
u796942881 | p03739 | python | s725466788 | s384165740 | 95 | 79 | 14,084 | 14,084 | Accepted | Accepted | 16.84 | def f(flg, an):
accum = 0
ret = 0
for i, ai in enumerate(an):
accum += ai
if i % 2:
if flg and 0 <= accum:
ret += accum + 1
accum = -1
elif not flg and accum <= 0:
ret += -accum + 1
accum = 1
... | def f(flg, an):
accum = 0
ret = 0
for i, ai in enumerate(an):
accum += ai
if flg:
flg = False
if accum <= 0:
ret += -accum + 1
accum = 1
else:
flg = True
if 0 <= accum:
ret +=... | 30 | 25 | 678 | 506 | def f(flg, an):
accum = 0
ret = 0
for i, ai in enumerate(an):
accum += ai
if i % 2:
if flg and 0 <= accum:
ret += accum + 1
accum = -1
elif not flg and accum <= 0:
ret += -accum + 1
accum = 1
else... | def f(flg, an):
accum = 0
ret = 0
for i, ai in enumerate(an):
accum += ai
if flg:
flg = False
if accum <= 0:
ret += -accum + 1
accum = 1
else:
flg = True
if 0 <= accum:
ret += accum + 1
... | false | 16.666667 | [
"- if i % 2:",
"- if flg and 0 <= accum:",
"- ret += accum + 1",
"- accum = -1",
"- elif not flg and accum <= 0:",
"+ if flg:",
"+ flg = False",
"+ if accum <= 0:",
"- if flg and accum <= 0:",
"- ... | false | 0.063283 | 0.036629 | 1.727661 | [
"s725466788",
"s384165740"
] |
u968166680 | p03816 | python | s718999395 | s156684938 | 65 | 54 | 22,264 | 20,548 | Accepted | Accepted | 16.92 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
counter = Counter(A)
odd = even = 0
for v ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
K = len(set(A))
if K % 2 == 1:
ans = K
else:
ans = K - 1
... | 34 | 25 | 585 | 386 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
counter = Counter(A)
odd = even = 0
for v in list(counter.value... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
K = len(set(A))
if K % 2 == 1:
ans = K
else:
ans = K - 1
print(ans)
ret... | false | 26.470588 | [
"-from collections import Counter",
"- counter = Counter(A)",
"- odd = even = 0",
"- for v in list(counter.values()):",
"- if v % 2 == 0:",
"- even += 1",
"- else:",
"- odd += 1",
"- if even % 2 == 0:",
"- ans = odd + even",
"+ K = len(se... | false | 0.06036 | 0.058501 | 1.031787 | [
"s718999395",
"s156684938"
] |
u815763296 | p02754 | python | s603455700 | s645777572 | 34 | 27 | 9,060 | 9,064 | Accepted | Accepted | 20.59 | import math
N, A, B = list(map(int, input().split()))
x = math.floor(N/(A+B))
ans = x*A
N = N-(A+B)*x
if N > A:
ans = ans+A
else:
ans = ans+N
print(ans)
| def LI():
return list(map(int, input().split()))
N, A, B = LI()
x = N//(A+B)
y = N-A*x-B*x
if y >= A:
ans = (x+1)*A
else:
ans = x*A+y
print(ans)
| 10 | 12 | 164 | 170 | import math
N, A, B = list(map(int, input().split()))
x = math.floor(N / (A + B))
ans = x * A
N = N - (A + B) * x
if N > A:
ans = ans + A
else:
ans = ans + N
print(ans)
| def LI():
return list(map(int, input().split()))
N, A, B = LI()
x = N // (A + B)
y = N - A * x - B * x
if y >= A:
ans = (x + 1) * A
else:
ans = x * A + y
print(ans)
| false | 16.666667 | [
"-import math",
"+def LI():",
"+ return list(map(int, input().split()))",
"-N, A, B = list(map(int, input().split()))",
"-x = math.floor(N / (A + B))",
"-ans = x * A",
"-N = N - (A + B) * x",
"-if N > A:",
"- ans = ans + A",
"+",
"+N, A, B = LI()",
"+x = N // (A + B)",
"+y = N - A * x ... | false | 0.041013 | 0.04504 | 0.910592 | [
"s603455700",
"s645777572"
] |
u119148115 | p03043 | python | s345670987 | s809946013 | 84 | 64 | 65,260 | 65,248 | Accepted | Accepted | 23.81 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = MI()
ans = 0
for i in range(1,N+1):
r = 0
while i <= K-1:
i *= 2
r += 1
ans += 1/(N*2**r)
print(ans)
| 25 | 14 | 691 | 226 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, K = MI()
ans = 0
for i in range(1, N + 1):
r = 0
while i <= K - 1:
i *= 2
r += 1
ans += 1 / (N * 2**r)
print(ans)
| false | 44 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし"... | false | 0.065366 | 0.147537 | 0.443046 | [
"s345670987",
"s809946013"
] |
u046187684 | p02814 | python | s701945041 | s903116645 | 159 | 142 | 17,132 | 15,612 | Accepted | Accepted | 10.69 | from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def solve(string):
n, m, *a = list(map(int, string.split()))
c = 2**len(bin(a[0]).split("1")[-1])
l = a[0]
for _a in a:
if _a % c or not _a // c % 2:
return "0"
l = lcm(l, _a)
return... | from functools import reduce
def lcm(a, b):
ab = a * b
while b != 0:
a, b = b, a % b
return ab // a
def solve(string):
n, m, *a = list(map(int, string.split()))
c = 2**len(bin(a[0]).split("1")[-1])
l = reduce(lcm, (2 * m + 2 if _a % c or not _a // c % 2 else _a for _a in... | 21 | 20 | 442 | 458 | from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def solve(string):
n, m, *a = list(map(int, string.split()))
c = 2 ** len(bin(a[0]).split("1")[-1])
l = a[0]
for _a in a:
if _a % c or not _a // c % 2:
return "0"
l = lcm(l, _a)
return str(max((m -... | from functools import reduce
def lcm(a, b):
ab = a * b
while b != 0:
a, b = b, a % b
return ab // a
def solve(string):
n, m, *a = list(map(int, string.split()))
c = 2 ** len(bin(a[0]).split("1")[-1])
l = reduce(lcm, (2 * m + 2 if _a % c or not _a // c % 2 else _a for _a in a))
re... | false | 4.761905 | [
"-from fractions import gcd",
"+from functools import reduce",
"- return a * b // gcd(a, b)",
"+ ab = a * b",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return ab // a",
"- l = a[0]",
"- for _a in a:",
"- if _a % c or not _a // c % 2:",
"- return \"0\""... | false | 0.107997 | 0.037203 | 2.902882 | [
"s701945041",
"s903116645"
] |
u758815106 | p03168 | python | s759770561 | s935474530 | 1,698 | 218 | 222,552 | 204,152 | Accepted | Accepted | 87.16 | import sys
input = sys.stdin.readline
#import math
#import numpy as np
N = int(eval(input()))
#= input()
#= map(int, input().split())
p = list(map(float, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]
#= {i:[] for i in range(N)}
dp = [[0.0] * (N + 1) for _ in... | #!/usr/bin/env python3
#import
#import math
#import numpy as np
N = int(eval(input()))
P = list(map(float, input().split()))
# dp[i][j] : i枚投げてj枚表が出る確率
dp = [[0] * (N + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, p in enumerate(P, 1):
for j in range(i + 1):
if j == 0:
dp[i][j] ... | 35 | 26 | 718 | 575 | import sys
input = sys.stdin.readline
# import math
# import numpy as np
N = int(eval(input()))
# = input()
# = map(int, input().split())
p = list(map(float, input().split()))
# = [input(), input()]
# = [list(map(int, input().split())) for _ in range(N)]
# = {i:[] for i in range(N)}
dp = [[0.0] * (N + 1) for _ in rang... | #!/usr/bin/env python3
# import
# import math
# import numpy as np
N = int(eval(input()))
P = list(map(float, input().split()))
# dp[i][j] : i枚投げてj枚表が出る確率
dp = [[0] * (N + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, p in enumerate(P, 1):
for j in range(i + 1):
if j == 0:
dp[i][j] = dp[i - 1][j... | false | 25.714286 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"+#!/usr/bin/env python3",
"+# import",
"-# = input()",
"-# = map(int, input().split())",
"-p = list(map(float, input().split()))",
"-# = [input(), input()]",
"-# = [list(map(int, input().split())) for _ in range(N)]",
"-# = {i:[] for i in range... | false | 0.149657 | 0.031758 | 4.712401 | [
"s759770561",
"s935474530"
] |
u952708174 | p02768 | python | s146276566 | s893137392 | 639 | 156 | 28,328 | 3,572 | Accepted | Accepted | 75.59 | def d_bouquet(MOD=10**9 + 7):
N, A, B = [int(i) for i in input().split()]
from operator import mul
from functools import reduce
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
... | from functools import reduce
def d_bouquet(MOD=10**9 + 7):
from functools import reduce
N, A, B = [int(i) for i in input().split()]
def comb(m, r):
numerator = reduce(lambda x, y: x * y % MOD, list(range(m, m - r, -1)))
denominator = reduce(lambda x, y: x * y % MOD, list(range(1, r + ... | 36 | 12 | 961 | 441 | def d_bouquet(MOD=10**9 + 7):
N, A, B = [int(i) for i in input().split()]
from operator import mul
from functools import reduce
def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 f... | from functools import reduce
def d_bouquet(MOD=10**9 + 7):
from functools import reduce
N, A, B = [int(i) for i in input().split()]
def comb(m, r):
numerator = reduce(lambda x, y: x * y % MOD, list(range(m, m - r, -1)))
denominator = reduce(lambda x, y: x * y % MOD, list(range(1, r + 1))... | false | 66.666667 | [
"+from functools import reduce",
"+",
"+",
"- N, A, B = [int(i) for i in input().split()]",
"- from operator import mul",
"- def cmb(n, r):",
"- if n - r < r:",
"- r = n - r",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return... | false | 0.314505 | 0.091867 | 3.423472 | [
"s146276566",
"s893137392"
] |
u254871849 | p03076 | python | s891740442 | s383141751 | 149 | 17 | 12,548 | 3,060 | Accepted | Accepted | 88.59 | import sys
import math
import numpy as np
def main():
dish = np.array(sys.stdin.read().split())
minute = [int(dish[i][-1]) for i in range(5)]
m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10
res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m
print((int... | import sys
*T, = list(map(int ,sys.stdin.read().split()))
def main():
res = 0
e = 10
for t in T:
res += 10 * ((t + 10 - 1) // 10)
e = min(e, (t - 1) % 10 + 1)
res -= (10 - e)
return res
if __name__ == '__main__':
ans = main()
print(ans) | 16 | 17 | 368 | 294 | import sys
import math
import numpy as np
def main():
dish = np.array(sys.stdin.read().split())
minute = [int(dish[i][-1]) for i in range(5)]
m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10
res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m
print((int(res)))
if _... | import sys
(*T,) = list(map(int, sys.stdin.read().split()))
def main():
res = 0
e = 10
for t in T:
res += 10 * ((t + 10 - 1) // 10)
e = min(e, (t - 1) % 10 + 1)
res -= 10 - e
return res
if __name__ == "__main__":
ans = main()
print(ans)
| false | 5.882353 | [
"-import math",
"-import numpy as np",
"+",
"+(*T,) = list(map(int, sys.stdin.read().split()))",
"- dish = np.array(sys.stdin.read().split())",
"- minute = [int(dish[i][-1]) for i in range(5)]",
"- m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10",
"- res = (np.ceil(dish... | false | 0.1995 | 0.03545 | 5.6277 | [
"s891740442",
"s383141751"
] |
u241159583 | p03633 | python | s261799473 | s386157259 | 37 | 30 | 5,076 | 9,196 | Accepted | Accepted | 18.92 | from fractions import gcd
from functools import reduce
n = int(eval(input()))
t = list(int(eval(input())) for _ in range(n))
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print((lcm_list(t))) | import math
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
if n == 1:
print((t[0]))
exit()
a = t[0]*t[1]//math.gcd(t[0],t[1])
for i in range(2, n):
a = t[i]*a//math.gcd(t[i],a)
print(a) | 13 | 10 | 262 | 211 | from fractions import gcd
from functools import reduce
n = int(eval(input()))
t = list(int(eval(input())) for _ in range(n))
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print((lcm_list(t)))
| import math
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
if n == 1:
print((t[0]))
exit()
a = t[0] * t[1] // math.gcd(t[0], t[1])
for i in range(2, n):
a = t[i] * a // math.gcd(t[i], a)
print(a)
| false | 23.076923 | [
"-from fractions import gcd",
"-from functools import reduce",
"+import math",
"-t = list(int(eval(input())) for _ in range(n))",
"-",
"-",
"-def lcm_base(x, y):",
"- return (x * y) // gcd(x, y)",
"-",
"-",
"-def lcm_list(numbers):",
"- return reduce(lcm_base, numbers, 1)",
"-",
"-",... | false | 0.048427 | 0.040295 | 1.201813 | [
"s261799473",
"s386157259"
] |
u038408819 | p03436 | python | s615331342 | s405234783 | 38 | 25 | 3,316 | 3,316 | Accepted | Accepted | 34.21 | from collections import deque
def bfs():
flag = False
d = [[float('inf')] * W for i in range(H)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
que = deque([])
que.append((0, 0))
d[0][0] = 0
while que:
p = que.popleft()
if p[0]==H-1 and p[1]==W-1:
fla... | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(h)]
from collections import deque
def bfs(maze, sy, sx, gy, gx):
d = [[-1] * w for _ in range(h)]
que = deque([[sy, sx]])
#print(que)
d[sy][sx] = 0
while que:
y, x = que.popleft()
if y == gy a... | 49 | 32 | 1,056 | 968 | from collections import deque
def bfs():
flag = False
d = [[float("inf")] * W for i in range(H)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
que = deque([])
que.append((0, 0))
d[0][0] = 0
while que:
p = que.popleft()
if p[0] == H - 1 and p[1] == W - 1:
flag = True... | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(h)]
from collections import deque
def bfs(maze, sy, sx, gy, gx):
d = [[-1] * w for _ in range(h)]
que = deque([[sy, sx]])
# print(que)
d[sy][sx] = 0
while que:
y, x = que.popleft()
if y == gy and x ==... | false | 34.693878 | [
"+h, w = list(map(int, input().split()))",
"+maze = [list(eval(input())) for _ in range(h)]",
"-def bfs():",
"- flag = False",
"- d = [[float(\"inf\")] * W for i in range(H)]",
"- dx = [1, 0, -1, 0]",
"- dy = [0, 1, 0, -1]",
"- que = deque([])",
"- que.append((0, 0))",
"- d[0]... | false | 0.040276 | 0.038645 | 1.042205 | [
"s615331342",
"s405234783"
] |
u079022693 | p03078 | python | s728399262 | s315834914 | 998 | 37 | 136,812 | 4,968 | Accepted | Accepted | 96.29 | from sys import stdin
def main():
#入力
readline=stdin.readline
x,y,z,k=list(map(int,readline().split()))
a=list(map(int,readline().split()))
b=list(map(int,readline().split()))
c=list(map(int,readline().split()))
d=list()
for i in range(x):
for j in range(y):
... | from sys import stdin
import heapq
def main():
#入力
readline=stdin.readline
x,y,z,k=list(map(int,readline().split()))
a=list(map(int,readline().split()))
a.sort(reverse=True)
b=list(map(int,readline().split()))
b.sort(reverse=True)
c=list(map(int,readline().split()))
c.sort... | 29 | 48 | 617 | 1,282 | from sys import stdin
def main():
# 入力
readline = stdin.readline
x, y, z, k = list(map(int, readline().split()))
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))
c = list(map(int, readline().split()))
d = list()
for i in range(x):
for j in range(y):... | from sys import stdin
import heapq
def main():
# 入力
readline = stdin.readline
x, y, z, k = list(map(int, readline().split()))
a = list(map(int, readline().split()))
a.sort(reverse=True)
b = list(map(int, readline().split()))
b.sort(reverse=True)
c = list(map(int, readline().split()))
... | false | 39.583333 | [
"+import heapq",
"+ a.sort(reverse=True)",
"+ b.sort(reverse=True)",
"- d = list()",
"- for i in range(x):",
"- for j in range(y):",
"- d.append(a[i] + b[j])",
"- d.sort(reverse=True)",
"- if x * y >= k:",
"- d = d[:k]",
"- e = list()",
"- for i... | false | 0.06754 | 0.03238 | 2.08584 | [
"s728399262",
"s315834914"
] |
u183422236 | p02621 | python | s786278320 | s070241343 | 84 | 22 | 61,412 | 9,144 | Accepted | Accepted | 73.81 | a = int(eval(input()))
print((a + a ** 2 + a ** 3)) | #!/usr/bin/env pypy3
def main():
a = int(eval(input()))
print((a + a ** 2 + a ** 3))
if __name__ == '__main__':
main()
| 3 | 10 | 46 | 136 | a = int(eval(input()))
print((a + a**2 + a**3))
| #!/usr/bin/env pypy3
def main():
a = int(eval(input()))
print((a + a**2 + a**3))
if __name__ == "__main__":
main()
| false | 70 | [
"-a = int(eval(input()))",
"-print((a + a**2 + a**3))",
"+#!/usr/bin/env pypy3",
"+def main():",
"+ a = int(eval(input()))",
"+ print((a + a**2 + a**3))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.040632 | 0.035721 | 1.137483 | [
"s786278320",
"s070241343"
] |
u504836877 | p03167 | python | s953069366 | s997631343 | 964 | 265 | 239,092 | 51,952 | Accepted | Accepted | 72.51 | from collections import deque
H,W = list(map(int, input().split()))
L = [eval(input()) for _ in range(H)]
dp = [[0]*W for _ in range(H)]
dp[0][0] = 1
used = [[0]*W for _ in range(H)]
q = deque()
q.append((0, 0))
while q:
t = q.popleft()
i = t[0]
j = t[1]
used[i][j] = 2
if i != H-1 a... | H,W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
mod = 10**9+7
dp = [[0]*W for _ in range(H)]
dp[0][0] = 1
for i in range(H):
for j in range(W):
if A[i][j] == "#":
continue
if i > 0:
dp[i][j] += dp[i-1][j]
if j > 0:
... | 27 | 18 | 699 | 381 | from collections import deque
H, W = list(map(int, input().split()))
L = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
used = [[0] * W for _ in range(H)]
q = deque()
q.append((0, 0))
while q:
t = q.popleft()
i = t[0]
j = t[1]
used[i][j] = 2
if i != H - 1 and L[i + ... | H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
mod = 10**9 + 7
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for i in range(H):
for j in range(W):
if A[i][j] == "#":
continue
if i > 0:
dp[i][j] += dp[i - 1][j]
if j > 0:
dp[i][... | false | 33.333333 | [
"-from collections import deque",
"-",
"-L = [eval(input()) for _ in range(H)]",
"+A = [eval(input()) for _ in range(H)]",
"+mod = 10**9 + 7",
"-used = [[0] * W for _ in range(H)]",
"-q = deque()",
"-q.append((0, 0))",
"-while q:",
"- t = q.popleft()",
"- i = t[0]",
"- j = t[1]",
"-... | false | 0.046504 | 0.042541 | 1.09316 | [
"s953069366",
"s997631343"
] |
u531631168 | p03721 | python | s994680850 | s591564568 | 247 | 221 | 16,236 | 11,692 | Accepted | Accepted | 10.53 | n, k = list(map(int, input().split()))
ab = {}
for _ in range(n):
a, b = list(map(int, input().split()))
ab.setdefault(a, 0)
ab[a] += b
keys = list(ab.keys())
keys.sort()
i = 0
for key in keys:
i += ab[key]
if i >= k:
print(key)
break | n, k = list(map(int, input().split()))
A_MAX = 10**5
bkt = [0 for _ in range(A_MAX+1)]
for _ in range(n):
a, b = list(map(int, input().split()))
bkt[a] += b
sum_count = 0
for i, cnt in enumerate(bkt):
sum_count += cnt
if sum_count >= k:
print(i)
break | 14 | 12 | 271 | 282 | n, k = list(map(int, input().split()))
ab = {}
for _ in range(n):
a, b = list(map(int, input().split()))
ab.setdefault(a, 0)
ab[a] += b
keys = list(ab.keys())
keys.sort()
i = 0
for key in keys:
i += ab[key]
if i >= k:
print(key)
break
| n, k = list(map(int, input().split()))
A_MAX = 10**5
bkt = [0 for _ in range(A_MAX + 1)]
for _ in range(n):
a, b = list(map(int, input().split()))
bkt[a] += b
sum_count = 0
for i, cnt in enumerate(bkt):
sum_count += cnt
if sum_count >= k:
print(i)
break
| false | 14.285714 | [
"-ab = {}",
"+A_MAX = 10**5",
"+bkt = [0 for _ in range(A_MAX + 1)]",
"- ab.setdefault(a, 0)",
"- ab[a] += b",
"-keys = list(ab.keys())",
"-keys.sort()",
"-i = 0",
"-for key in keys:",
"- i += ab[key]",
"- if i >= k:",
"- print(key)",
"+ bkt[a] += b",
"+sum_count = 0"... | false | 0.068936 | 0.086587 | 0.796154 | [
"s994680850",
"s591564568"
] |
u778700306 | p03599 | python | s372509476 | s075393970 | 1,618 | 180 | 12,464 | 12,440 | Accepted | Accepted | 88.88 |
a,b,c,d,e,f = list(map(int, input().split()))
waters = []
for i in range(f // (100 * a) + 1):
for j in range(f // (100 * b) + 1):
amount = 100 * (i * a + j * b)
if amount <= f:
waters.append(amount)
sugers = []
for i in range(f // c + 1):
for j in range(f // d + 1):
... |
a,b,c,d,e,f = list(map(int, input().split()))
waters = []
for i in range(f // (100 * a) + 1):
for j in range(f // (100 * b) + 1):
amount = 100 * (i * a + j * b)
if amount <= f:
waters.append(amount)
sugers = []
for i in range(f // c + 1):
for j in range(f // d + 1):
... | 34 | 37 | 750 | 796 | a, b, c, d, e, f = list(map(int, input().split()))
waters = []
for i in range(f // (100 * a) + 1):
for j in range(f // (100 * b) + 1):
amount = 100 * (i * a + j * b)
if amount <= f:
waters.append(amount)
sugers = []
for i in range(f // c + 1):
for j in range(f // d + 1):
amou... | a, b, c, d, e, f = list(map(int, input().split()))
waters = []
for i in range(f // (100 * a) + 1):
for j in range(f // (100 * b) + 1):
amount = 100 * (i * a + j * b)
if amount <= f:
waters.append(amount)
sugers = []
for i in range(f // c + 1):
for j in range(f // d + 1):
amou... | false | 8.108108 | [
"+waters = set(waters)",
"+sugers = set(sugers)"
] | false | 0.425462 | 0.065647 | 6.481105 | [
"s372509476",
"s075393970"
] |
u835283937 | p03231 | python | s310432678 | s602250876 | 72 | 31 | 19,572 | 9,400 | Accepted | Accepted | 56.94 | import math
def main4():
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
L = (N * M) // math.gcd(N, M)
pair = dict()
for i in range(1, N + 1):
idx = (i - 1) * (L // N) + 1
pair[idx] = S[i - 1]
for i in range(1, M + 1):
idx... | import math
def main5():
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
G = math.gcd(N, M)
L = (N * M) // G
for i in range(G):
if S[i * N // G] != T[i * M // G]:
print((-1))
exit()
print(L)
if __name__ == "__main... | 26 | 18 | 510 | 317 | import math
def main4():
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
L = (N * M) // math.gcd(N, M)
pair = dict()
for i in range(1, N + 1):
idx = (i - 1) * (L // N) + 1
pair[idx] = S[i - 1]
for i in range(1, M + 1):
idx = (i - 1) * (L /... | import math
def main5():
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
G = math.gcd(N, M)
L = (N * M) // G
for i in range(G):
if S[i * N // G] != T[i * M // G]:
print((-1))
exit()
print(L)
if __name__ == "__main__":
main5()... | false | 30.769231 | [
"-def main4():",
"+def main5():",
"- L = (N * M) // math.gcd(N, M)",
"- pair = dict()",
"- for i in range(1, N + 1):",
"- idx = (i - 1) * (L // N) + 1",
"- pair[idx] = S[i - 1]",
"- for i in range(1, M + 1):",
"- idx = (i - 1) * (L // M) + 1",
"- if idx in l... | false | 0.134059 | 0.041598 | 3.222758 | [
"s310432678",
"s602250876"
] |
u747602774 | p02918 | python | s683768054 | s238086931 | 93 | 42 | 4,084 | 3,316 | Accepted | Accepted | 54.84 | N,K = list(map(int,input().split()))
S = list(eval(input()))
ch = 0
ans = 0
if N != 1:
for i in range(N):
if i == 0:
if S[i] != S[i+1]:
ch += 1
if S[i] == S[i+1] == 'R':
ans += 1
elif i == N-1:
if S[i] == S[i-1] == '... | n,k = list(map(int,input().split()))
s = eval(input())
same = 0
for i in range(n-1):
if s[i] == s[i+1]:
same += 1
diff = n-1-same
print((same + min(2*k,diff)))
| 23 | 12 | 526 | 173 | N, K = list(map(int, input().split()))
S = list(eval(input()))
ch = 0
ans = 0
if N != 1:
for i in range(N):
if i == 0:
if S[i] != S[i + 1]:
ch += 1
if S[i] == S[i + 1] == "R":
ans += 1
elif i == N - 1:
if S[i] == S[i - 1] == "L":
... | n, k = list(map(int, input().split()))
s = eval(input())
same = 0
for i in range(n - 1):
if s[i] == s[i + 1]:
same += 1
diff = n - 1 - same
print((same + min(2 * k, diff)))
| false | 47.826087 | [
"-N, K = list(map(int, input().split()))",
"-S = list(eval(input()))",
"-ch = 0",
"-ans = 0",
"-if N != 1:",
"- for i in range(N):",
"- if i == 0:",
"- if S[i] != S[i + 1]:",
"- ch += 1",
"- if S[i] == S[i + 1] == \"R\":",
"- ans += 1... | false | 0.04662 | 0.107692 | 0.432906 | [
"s683768054",
"s238086931"
] |
u057964173 | p03385 | python | s864289769 | s890086686 | 177 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.4 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
s=eval(input())
if s.count('a')==s.count('b')==s.count('c')==1:
print('Yes')
else:
print('No')
resolve() | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
s=eval(input())
if s in ['abc','acb','bca','bac','cab','cba']:
print('Yes')
else:
print('No')
resolve() | 10 | 10 | 211 | 210 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
s = eval(input())
if s.count("a") == s.count("b") == s.count("c") == 1:
print("Yes")
else:
print("No")
resolve()
| import sys
def input():
return sys.stdin.readline().strip()
def resolve():
s = eval(input())
if s in ["abc", "acb", "bca", "bac", "cab", "cba"]:
print("Yes")
else:
print("No")
resolve()
| false | 0 | [
"- if s.count(\"a\") == s.count(\"b\") == s.count(\"c\") == 1:",
"+ if s in [\"abc\", \"acb\", \"bca\", \"bac\", \"cab\", \"cba\"]:"
] | false | 0.041871 | 0.041985 | 0.997274 | [
"s864289769",
"s890086686"
] |
u229156891 | p03341 | python | s895986478 | s433182275 | 214 | 150 | 3,700 | 11,556 | Accepted | Accepted | 29.91 | N = int(eval(input()))
S = eval(input())
w_left = 0
e_right = S[1:].count("E")
ans = float('inf')
for i in range(N):
if i != 0:
if S[i] == "E":
e_right -= 1
if S[i-1] == "W":
w_left += 1
ans = min(ans, w_left + e_right)
print(ans)
| N = int(eval(input()))
S = list(eval(input()))
e_cnt = S.count('E')
w_cnt = 0
ans = float('inf')
for i in range(N):
if S[i] == 'E':
e_cnt -= 1
w = w_cnt
else:
w_cnt += 1
w = w_cnt - 1
ans = min(ans, e_cnt+w)
print(ans) | 14 | 17 | 281 | 273 | N = int(eval(input()))
S = eval(input())
w_left = 0
e_right = S[1:].count("E")
ans = float("inf")
for i in range(N):
if i != 0:
if S[i] == "E":
e_right -= 1
if S[i - 1] == "W":
w_left += 1
ans = min(ans, w_left + e_right)
print(ans)
| N = int(eval(input()))
S = list(eval(input()))
e_cnt = S.count("E")
w_cnt = 0
ans = float("inf")
for i in range(N):
if S[i] == "E":
e_cnt -= 1
w = w_cnt
else:
w_cnt += 1
w = w_cnt - 1
ans = min(ans, e_cnt + w)
print(ans)
| false | 17.647059 | [
"-S = eval(input())",
"-w_left = 0",
"-e_right = S[1:].count(\"E\")",
"+S = list(eval(input()))",
"+e_cnt = S.count(\"E\")",
"+w_cnt = 0",
"- if i != 0:",
"- if S[i] == \"E\":",
"- e_right -= 1",
"- if S[i - 1] == \"W\":",
"- w_left += 1",
"- ans = min... | false | 0.038706 | 0.118322 | 0.327124 | [
"s895986478",
"s433182275"
] |
u827885761 | p03030 | python | s297008037 | s635188896 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | n = int(eval(input()))
l = [0] * n
for i in range(n):
l[i] = input().split()
#l.sort(key=lambda x: x[0]
s = sorted(list(set([l[i][0] for i in range(n)])))
for q in s:
p = sorted([int(l[i][1]) for i in range(n) if l[i][0] == q], reverse=1)
for pp in p:
ans = l.index([q,str(pp)]) + 1
... | n = int(eval(input()))
l = []
for i in range(n):
s, p = input().split()
l.append((s,-int(p),i))
print(('\n'.join([str(t[2]+1) for t in sorted(l)])))
| 11 | 7 | 326 | 156 | n = int(eval(input()))
l = [0] * n
for i in range(n):
l[i] = input().split()
# l.sort(key=lambda x: x[0]
s = sorted(list(set([l[i][0] for i in range(n)])))
for q in s:
p = sorted([int(l[i][1]) for i in range(n) if l[i][0] == q], reverse=1)
for pp in p:
ans = l.index([q, str(pp)]) + 1
print(a... | n = int(eval(input()))
l = []
for i in range(n):
s, p = input().split()
l.append((s, -int(p), i))
print(("\n".join([str(t[2] + 1) for t in sorted(l)])))
| false | 36.363636 | [
"-l = [0] * n",
"+l = []",
"- l[i] = input().split()",
"-# l.sort(key=lambda x: x[0]",
"-s = sorted(list(set([l[i][0] for i in range(n)])))",
"-for q in s:",
"- p = sorted([int(l[i][1]) for i in range(n) if l[i][0] == q], reverse=1)",
"- for pp in p:",
"- ans = l.index([q, str(pp)]) ... | false | 0.049745 | 0.065786 | 0.756168 | [
"s297008037",
"s635188896"
] |
u978178314 | p03469 | python | s849365100 | s789170472 | 12 | 11 | 2,692 | 2,568 | Accepted | Accepted | 8.33 | import re
S = list(input())
S[3] = "8"
out = ""
for s in S:
out += s
print(out)
| S = input()
print("2018"+S[4:])
| 8 | 2 | 93 | 36 | import re
S = list(input())
S[3] = "8"
out = ""
for s in S:
out += s
print(out)
| S = input()
print("2018" + S[4:])
| false | 75 | [
"-import re",
"-",
"-S = list(input())",
"-S[3] = \"8\"",
"-out = \"\"",
"-for s in S:",
"- out += s",
"-print(out)",
"+S = input()",
"+print(\"2018\" + S[4:])"
] | false | 0.040746 | 0.049157 | 0.82888 | [
"s849365100",
"s789170472"
] |
u075012704 | p03612 | python | s112483342 | s002150790 | 89 | 64 | 14,004 | 14,008 | Accepted | Accepted | 28.09 | N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
if P[-1] == N:
tmp = P[-1]
P[-1] = P[-2]
P[-2] = tmp
ans += 1
for i in range(N-1):
if P[i] == i+1:
tmp = P[i]
P[i] = P[i+1]
P[i+1] = tmp
ans += 1
for i in range(N):
if P[i] =... | N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
i = 0
while i < N:
if P[i] == i + 1:
ans += 1
i += 1
i += 1
print(ans)
| 23 | 12 | 352 | 169 | N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
if P[-1] == N:
tmp = P[-1]
P[-1] = P[-2]
P[-2] = tmp
ans += 1
for i in range(N - 1):
if P[i] == i + 1:
tmp = P[i]
P[i] = P[i + 1]
P[i + 1] = tmp
ans += 1
for i in range(N):
if P[i] == i + 1:
... | N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
i = 0
while i < N:
if P[i] == i + 1:
ans += 1
i += 1
i += 1
print(ans)
| false | 47.826087 | [
"-if P[-1] == N:",
"- tmp = P[-1]",
"- P[-1] = P[-2]",
"- P[-2] = tmp",
"- ans += 1",
"-for i in range(N - 1):",
"- if P[i] == i + 1:",
"- tmp = P[i]",
"- P[i] = P[i + 1]",
"- P[i + 1] = tmp",
"- ans += 1",
"-for i in range(N):",
"+i = 0",
"+while... | false | 0.043436 | 0.043033 | 1.009364 | [
"s112483342",
"s002150790"
] |
u167647458 | p02713 | python | s549611821 | s164658189 | 992 | 503 | 69,796 | 68,312 | Accepted | Accepted | 49.29 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
k = int(eval(input()))
ans = 0
for a in range(1, k+1):
for b in range(1, k+1):
for c in range(1, k+1):
ans += gcd(a, b, c)
print(ans)
| import math
def gcd(*numbers):
return math.gcd( math.gcd(a, b), c)
k = int(eval(input()))
ans = 0
for a in range(1, k+1):
for b in range(1, k+1):
for c in range(1, k+1):
ans += gcd(a, b, c)
print(ans)
| 16 | 15 | 280 | 253 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += gcd(a, b, c)
print(ans)
| import math
def gcd(*numbers):
return math.gcd(math.gcd(a, b), c)
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += gcd(a, b, c)
print(ans)
| false | 6.25 | [
"-from functools import reduce",
"- return reduce(math.gcd, numbers)",
"+ return math.gcd(math.gcd(a, b), c)"
] | false | 0.007158 | 0.20904 | 0.034243 | [
"s549611821",
"s164658189"
] |
u692336506 | p02623 | python | s438555939 | s237231870 | 343 | 303 | 47,348 | 47,672 | Accepted | Accepted | 11.66 | from bisect import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA = [0] * (N + 1)
SB = [0] * (M + 1)
for i in range(N):
SA[i+1] = SA[i] + A[i]
for i in range(M):
SB[i+1] = SB[i] + B[i]
result = 0
for x in range(N+1):
if... | from bisect import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA = [0] * (N + 1)
SB = [0] * (M + 1)
for i in range(N):
SA[i+1] = SA[i] + A[i]
for i in range(M):
SB[i+1] = SB[i] + B[i]
result = 0
y = M
for x in range(N+1)... | 17 | 20 | 423 | 454 | from bisect import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA = [0] * (N + 1)
SB = [0] * (M + 1)
for i in range(N):
SA[i + 1] = SA[i] + A[i]
for i in range(M):
SB[i + 1] = SB[i] + B[i]
result = 0
for x in range(N + 1):
if SA[x... | from bisect import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SA = [0] * (N + 1)
SB = [0] * (M + 1)
for i in range(N):
SA[i + 1] = SA[i] + A[i]
for i in range(M):
SB[i + 1] = SB[i] + B[i]
result = 0
y = M
for x in range(N + 1):
i... | false | 15 | [
"+y = M",
"- y = bisect(SB, K - SA[x]) - 1",
"+ while y >= 0 and SA[x] + SB[y] > K:",
"+ y -= 1"
] | false | 0.09056 | 0.039539 | 2.290407 | [
"s438555939",
"s237231870"
] |
u148551245 | p03455 | python | s158052784 | s482914534 | 162 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.51 | (a, b) = list(map(int, input().split()))
if a % 2 == 1 and b % 2 == 1:
print("Odd")
else:
print("Even") | a, b = list(map(int, input().split()))
if a % 2 == 1 and b % 2 == 1:
print("Odd")
else:
print("Even") | 5 | 5 | 109 | 107 | (a, b) = list(map(int, input().split()))
if a % 2 == 1 and b % 2 == 1:
print("Odd")
else:
print("Even")
| a, b = list(map(int, input().split()))
if a % 2 == 1 and b % 2 == 1:
print("Odd")
else:
print("Even")
| false | 0 | [
"-(a, b) = list(map(int, input().split()))",
"+a, b = list(map(int, input().split()))"
] | false | 0.150199 | 0.041773 | 3.595591 | [
"s158052784",
"s482914534"
] |
u309120194 | p02801 | python | s823636358 | s779571918 | 27 | 24 | 9,084 | 8,896 | Accepted | Accepted | 11.11 | C = eval(input())
# 文字列と数値の変換
# ord('文字') / chr(数値) で変換できる
ord_s = ord(C)
chr_s = chr(ord_s + 1)
print(chr_s) | C = eval(input())
l = list('abcdefghijklmnopqrstuvwxyz')
print((l[l.index(C)+1])) | 8 | 4 | 112 | 77 | C = eval(input())
# 文字列と数値の変換
# ord('文字') / chr(数値) で変換できる
ord_s = ord(C)
chr_s = chr(ord_s + 1)
print(chr_s)
| C = eval(input())
l = list("abcdefghijklmnopqrstuvwxyz")
print((l[l.index(C) + 1]))
| false | 50 | [
"-# 文字列と数値の変換",
"-# ord('文字') / chr(数値) で変換できる",
"-ord_s = ord(C)",
"-chr_s = chr(ord_s + 1)",
"-print(chr_s)",
"+l = list(\"abcdefghijklmnopqrstuvwxyz\")",
"+print((l[l.index(C) + 1]))"
] | false | 0.159542 | 0.159553 | 0.999932 | [
"s823636358",
"s779571918"
] |
u545368057 | p02954 | python | s893987843 | s603527258 | 145 | 102 | 9,128 | 87,356 | Accepted | Accepted | 29.66 | S = eval(input())
# S = "RL"
rs = []
ls = []
inds = []
s_inv = S[::-1]
rcnt = 0
#Rを数える
for i,s in enumerate(S):
if s == "R":
rcnt += 1
else:
if rcnt > 0:
#記録
rs.append(rcnt)
inds.append(i-1)
rcnt = 0
#Lを数える
# print(s_inv)
lcnt = 0
... | S = eval(input())
prev = ""
cut = [0]
inds = []
rs = []
r = 0
for i in range(len(S)):
if prev == "L" and S[i] == "R":
cut.append(i)
if prev == "R" and S[i] == "L":
inds.append(i)
rs.append(r)
r = 0
if S[i] == "R":
r += 1
prev = S[i]
cut.append(len(... | 46 | 30 | 841 | 630 | S = eval(input())
# S = "RL"
rs = []
ls = []
inds = []
s_inv = S[::-1]
rcnt = 0
# Rを数える
for i, s in enumerate(S):
if s == "R":
rcnt += 1
else:
if rcnt > 0:
# 記録
rs.append(rcnt)
inds.append(i - 1)
rcnt = 0
# Lを数える
# print(s_inv)
lcnt = 0
for i, s in enu... | S = eval(input())
prev = ""
cut = [0]
inds = []
rs = []
r = 0
for i in range(len(S)):
if prev == "L" and S[i] == "R":
cut.append(i)
if prev == "R" and S[i] == "L":
inds.append(i)
rs.append(r)
r = 0
if S[i] == "R":
r += 1
prev = S[i]
cut.append(len(S))
diff = [cut[... | false | 34.782609 | [
"-# S = \"RL\"",
"+prev = \"\"",
"+cut = [0]",
"+inds = []",
"-ls = []",
"-inds = []",
"-s_inv = S[::-1]",
"-rcnt = 0",
"-# Rを数える",
"-for i, s in enumerate(S):",
"- if s == \"R\":",
"- rcnt += 1",
"- else:",
"- if rcnt > 0:",
"- # 記録",
"- rs.ap... | false | 0.046365 | 0.069308 | 0.668964 | [
"s893987843",
"s603527258"
] |
u604774382 | p02408 | python | s242643087 | s489276879 | 40 | 20 | 6,720 | 4,220 | Accepted | Accepted | 50 | import sys
n = int( sys.stdin.readline() )
cards = { 'S': [ False ] * 13, 'H': [ False ] * 13, 'C': [ False ] * 13, 'D': [ False ] * 13 }
for i in range( n ):
pattern, num = sys.stdin.readline().split( " " )
cards[ pattern ][ int( num )-1 ] = True
for pattern in ( 'S', 'H', 'C', 'D' ):
for i in range( 13 ... | import sys
n = int( sys.stdin.readline() )
cards = { pattern:[False]*13 for pattern in ( 'S', 'H', 'C', 'D' ) }
for i in range( n ):
pattern, num = sys.stdin.readline().split( " " )
cards[ pattern ][ int( num )-1 ] = True
for pattern in ( 'S', 'H', 'C', 'D' ):
for i in range( 13 ):
if not cards[ patter... | 12 | 12 | 403 | 377 | import sys
n = int(sys.stdin.readline())
cards = {"S": [False] * 13, "H": [False] * 13, "C": [False] * 13, "D": [False] * 13}
for i in range(n):
pattern, num = sys.stdin.readline().split(" ")
cards[pattern][int(num) - 1] = True
for pattern in ("S", "H", "C", "D"):
for i in range(13):
if not cards[p... | import sys
n = int(sys.stdin.readline())
cards = {pattern: [False] * 13 for pattern in ("S", "H", "C", "D")}
for i in range(n):
pattern, num = sys.stdin.readline().split(" ")
cards[pattern][int(num) - 1] = True
for pattern in ("S", "H", "C", "D"):
for i in range(13):
if not cards[pattern][i]:
... | false | 0 | [
"-cards = {\"S\": [False] * 13, \"H\": [False] * 13, \"C\": [False] * 13, \"D\": [False] * 13}",
"+cards = {pattern: [False] * 13 for pattern in (\"S\", \"H\", \"C\", \"D\")}"
] | false | 0.038423 | 0.084281 | 0.455891 | [
"s242643087",
"s489276879"
] |
u756595712 | p02255 | python | s740733116 | s638047194 | 30 | 20 | 7,684 | 8,084 | Accepted | Accepted | 33.33 | def insertionSort(_list, _length):
for i in range(1, _length):
ll = [str(_l) for _l in _list]
print((' '.join(ll)))
val = _list[i]
j = i - 1
while j >= 0 and _list[j] > val:
_list[j+1] = _list[j]
j -= 1
_list[j+1] = val
ll = [str(... | length = int(eval(input()))
eles = [int(i) for i in input().split()]
for i in range(length):
val = eles[i]
j = i - 1
while j >= 0 and eles[j] > val:
eles[j+1] = eles[j]
j -= 1
eles[j+1] = val
print((*eles)) | 18 | 11 | 461 | 245 | def insertionSort(_list, _length):
for i in range(1, _length):
ll = [str(_l) for _l in _list]
print((" ".join(ll)))
val = _list[i]
j = i - 1
while j >= 0 and _list[j] > val:
_list[j + 1] = _list[j]
j -= 1
_list[j + 1] = val
ll = [str(_l) fo... | length = int(eval(input()))
eles = [int(i) for i in input().split()]
for i in range(length):
val = eles[i]
j = i - 1
while j >= 0 and eles[j] > val:
eles[j + 1] = eles[j]
j -= 1
eles[j + 1] = val
print((*eles))
| false | 38.888889 | [
"-def insertionSort(_list, _length):",
"- for i in range(1, _length):",
"- ll = [str(_l) for _l in _list]",
"- print((\" \".join(ll)))",
"- val = _list[i]",
"- j = i - 1",
"- while j >= 0 and _list[j] > val:",
"- _list[j + 1] = _list[j]",
"- ... | false | 0.064126 | 0.050971 | 1.258098 | [
"s740733116",
"s638047194"
] |
u316386814 | p03013 | python | s967684394 | s710347144 | 75 | 68 | 7,796 | 7,796 | Accepted | Accepted | 9.33 | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | 27 | 28 | 726 | 765 | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | false | 3.571429 | [
"- for i in range(1, N + 1):",
"+ dp[1] = dp[0] if A[1] == 0 else 0",
"+ for i in range(2, N + 1):"
] | false | 0.042523 | 0.050359 | 0.844399 | [
"s967684394",
"s710347144"
] |
u810356688 | p02861 | python | s738824716 | s689751044 | 257 | 18 | 8,052 | 3,064 | Accepted | Accepted | 93 | import sys
from math import sqrt
from itertools import permutations
def input(): return sys.stdin.readline().rstrip()
def main():
n=int(eval(input()))
A =[[int(_) for _ in input().split()] for i in range(n)]
a_list=list(permutations(A))
a_len=len(a_list)
ans_all=0
for i in range(a_len)... | import sys
from math import sqrt
def input(): return sys.stdin.readline().rstrip()
def main():
n=int(eval(input()))
A =[[int(_) for _ in input().split()] for i in range(n)]
ans=0
for i in range(n-1):
for j in range(i+1,n):
ans+=sqrt((A[i][0]-A[j][0])**2+(A[i][1]-A[j][1])**2)... | 21 | 13 | 570 | 372 | import sys
from math import sqrt
from itertools import permutations
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
A = [[int(_) for _ in input().split()] for i in range(n)]
a_list = list(permutations(A))
a_len = len(a_list)
ans_all = 0
for i in range... | import sys
from math import sqrt
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
A = [[int(_) for _ in input().split()] for i in range(n)]
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
ans += sqrt((A[i][0] - A[j][0]) ** 2 + (A[i... | false | 38.095238 | [
"-from itertools import permutations",
"- a_list = list(permutations(A))",
"- a_len = len(a_list)",
"- ans_all = 0",
"- for i in range(a_len):",
"- keiro = a_list[i]",
"- ans = 0",
"- x0 = keiro[0][0]",
"- y0 = keiro[0][1]",
"- for x1, y1 in keiro[1:]... | false | 0.042293 | 0.044779 | 0.944476 | [
"s738824716",
"s689751044"
] |
u186838327 | p03680 | python | s521774227 | s485744241 | 521 | 233 | 49,644 | 95,536 | Accepted | Accepted | 55.28 | n = int(eval(input()))
l = [int(eval(input()))-1 for i in range(n)]
a = l[0]
for i in range(n):
if a == 1:
print((i+1))
exit()
a = l[a]
else:
print((-1)) | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
g = [[] for _ in range(n)]
for i, a in enumerate(A):
g[a-1].append(i)
from collections import deque
q = deque([1])
visit = [-1]*n
visit[1] = 0
while q:
v = q.popleft()
for u in g[v]:
if visit[u] == -1:
vis... | 11 | 21 | 162 | 415 | n = int(eval(input()))
l = [int(eval(input())) - 1 for i in range(n)]
a = l[0]
for i in range(n):
if a == 1:
print((i + 1))
exit()
a = l[a]
else:
print((-1))
| n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
g = [[] for _ in range(n)]
for i, a in enumerate(A):
g[a - 1].append(i)
from collections import deque
q = deque([1])
visit = [-1] * n
visit[1] = 0
while q:
v = q.popleft()
for u in g[v]:
if visit[u] == -1:
visit[u] = visi... | false | 47.619048 | [
"-l = [int(eval(input())) - 1 for i in range(n)]",
"-a = l[0]",
"-for i in range(n):",
"- if a == 1:",
"- print((i + 1))",
"- exit()",
"- a = l[a]",
"+A = [int(eval(input())) for _ in range(n)]",
"+g = [[] for _ in range(n)]",
"+for i, a in enumerate(A):",
"+ g[a - 1].appe... | false | 0.042062 | 0.122654 | 0.342929 | [
"s521774227",
"s485744241"
] |
u063052907 | p03474 | python | s050839605 | s263623223 | 20 | 18 | 3,188 | 2,940 | Accepted | Accepted | 10 | # coding: utf-8
import re
A, B = list(map(int, input().split()))
S = eval(input())
if S[A] != "-":
print("No")
else:
if "-" in S[0:A] or "-" in S[A+1:]:
print("No")
else:
print("Yes") | # coding: utf-8
A, B = list(map(int, input().split()))
S = eval(input())
if S[A] != "-":
print("No")
else:
if "-" in S[0:A] or "-" in S[A+1:]:
print("No")
else:
print("Yes") | 12 | 11 | 211 | 201 | # coding: utf-8
import re
A, B = list(map(int, input().split()))
S = eval(input())
if S[A] != "-":
print("No")
else:
if "-" in S[0:A] or "-" in S[A + 1 :]:
print("No")
else:
print("Yes")
| # coding: utf-8
A, B = list(map(int, input().split()))
S = eval(input())
if S[A] != "-":
print("No")
else:
if "-" in S[0:A] or "-" in S[A + 1 :]:
print("No")
else:
print("Yes")
| false | 8.333333 | [
"-import re",
"-"
] | false | 0.048237 | 0.047867 | 1.007743 | [
"s050839605",
"s263623223"
] |
u024782094 | p02622 | python | s399455921 | s568189590 | 106 | 66 | 78,368 | 9,468 | Accepted | Accepted | 37.74 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return list(map(int,input().split()))
def lmp(): return list(map(int,inp... | s=eval(input())
t=eval(input())
ans=0
for i in range(len(s)):
if s[i]!=t[i]:
ans+=1
print(ans) | 20 | 7 | 432 | 100 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input():
return sys.stdin.readline().strip()
def mp():
return list(map(int, input().split()))
def lmp():
return list(map... | s = eval(input())
t = eval(input())
ans = 0
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans)
| false | 65 | [
"-import sys",
"-import heapq",
"-import math",
"-import fractions",
"-import bisect",
"-import itertools",
"-from collections import Counter",
"-from collections import deque",
"-from operator import itemgetter",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().strip()",
"-",
... | false | 0.036028 | 0.035717 | 1.008684 | [
"s399455921",
"s568189590"
] |
u102461423 | p03014 | python | s176775626 | s710001066 | 1,049 | 927 | 188,708 | 217,728 | Accepted | Accepted | 11.63 | import numpy as np
H,W = list(map(int,input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H+2,W+2),dtype=np.int32)
map[1:-1,1:-1][temp == '.'] = 1
# x軸正方向の集計
def F(transpose,reverse):
x = map.copy()
if transpose:
x = x.T
x = np.ravel(x)
if ... | import numpy as np
H,W = list(map(int,input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化、壁をTrueで持つ
map = np.ones((H+2,W+2),dtype=np.bool)
map[1:-1,1:-1] = (temp == '#')
# x軸正方向の集計
def F(transpose):
x = map.copy()
if transpose:
x = x.T
x = np.ravel(x) # to 1D... | 34 | 33 | 731 | 765 | import numpy as np
H, W = list(map(int, input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H + 2, W + 2), dtype=np.int32)
map[1:-1, 1:-1][temp == "."] = 1
# x軸正方向の集計
def F(transpose, reverse):
x = map.copy()
if transpose:
x = x.T
x = np.ravel(x)
... | import numpy as np
H, W = list(map(int, input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化、壁をTrueで持つ
map = np.ones((H + 2, W + 2), dtype=np.bool)
map[1:-1, 1:-1] = temp == "#"
# x軸正方向の集計
def F(transpose):
x = map.copy()
if transpose:
x = x.T
x = np.ravel(x) # t... | false | 2.941176 | [
"-# 周りに壁を、0,1化",
"-map = np.zeros((H + 2, W + 2), dtype=np.int32)",
"-map[1:-1, 1:-1][temp == \".\"] = 1",
"+# 周りに壁を、0,1化、壁をTrueで持つ",
"+map = np.ones((H + 2, W + 2), dtype=np.bool)",
"+map[1:-1, 1:-1] = temp == \"#\"",
"-def F(transpose, reverse):",
"+def F(transpose):",
"- x = np.ravel(x)",
"-... | false | 0.181329 | 0.212835 | 0.851969 | [
"s176775626",
"s710001066"
] |
u123600620 | p02777 | python | s684450794 | s051262541 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | # -*- coding: utf-8 -*-
str_1,str_2 = input().split()
str_1_count,str_2_count = input().split()
del_str = eval(input())
if del_str == str_1:
str_1_count = int(str_1_count) - 1
else:
str_2_count = int(str_2_count) - 1
print((str(str_1_count) +" " + str(str_2_count))) | ball_1,ball_2 = input().split()
ball_1_count,ball_2_count = list(map(int , input().split()))
getted_str = eval(input())
if getted_str == ball_1:
ball_1_count -= 1
else:
ball_2_count -= 1
print((str(ball_1_count) + " " + str(ball_2_count))) | 11 | 8 | 278 | 240 | # -*- coding: utf-8 -*-
str_1, str_2 = input().split()
str_1_count, str_2_count = input().split()
del_str = eval(input())
if del_str == str_1:
str_1_count = int(str_1_count) - 1
else:
str_2_count = int(str_2_count) - 1
print((str(str_1_count) + " " + str(str_2_count)))
| ball_1, ball_2 = input().split()
ball_1_count, ball_2_count = list(map(int, input().split()))
getted_str = eval(input())
if getted_str == ball_1:
ball_1_count -= 1
else:
ball_2_count -= 1
print((str(ball_1_count) + " " + str(ball_2_count)))
| false | 27.272727 | [
"-# -*- coding: utf-8 -*-",
"-str_1, str_2 = input().split()",
"-str_1_count, str_2_count = input().split()",
"-del_str = eval(input())",
"-if del_str == str_1:",
"- str_1_count = int(str_1_count) - 1",
"+ball_1, ball_2 = input().split()",
"+ball_1_count, ball_2_count = list(map(int, input().split(... | false | 0.046843 | 0.049388 | 0.948477 | [
"s684450794",
"s051262541"
] |
u249218427 | p02632 | python | s775043871 | s895257974 | 663 | 481 | 205,420 | 193,812 | Accepted | Accepted | 27.45 | # -*- coding: utf-8 -*-
K = int(eval(input()))
S = len(eval(input()))
mod = 10**9+7
answer = 0
tmp = 0
# 組み合わせの数の計算は以下URLからコピーしてきた:
# https://qiita.com/derodero24/items/91b6468e66923a87f39f
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-... | # -*- coding: utf-8 -*-
K = int(eval(input()))
S = len(eval(input()))
mod = 10**9+7
N = K+S
# mod上の逆元の計算
inverse = [0, 1]
for i in range(2, N+1):
inverse.append((-inverse[mod%i]*(mod//i))%mod)
# 階乗とその逆元の計算
factorial = [1, 1]
factorial_inv = [1, 1]
for i in range(2, N+1):
factorial.append((f... | 36 | 29 | 737 | 606 | # -*- coding: utf-8 -*-
K = int(eval(input()))
S = len(eval(input()))
mod = 10**9 + 7
answer = 0
tmp = 0
# 組み合わせの数の計算は以下URLからコピーしてきた:
# https://qiita.com/derodero24/items/91b6468e66923a87f39f
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
N... | # -*- coding: utf-8 -*-
K = int(eval(input()))
S = len(eval(input()))
mod = 10**9 + 7
N = K + S
# mod上の逆元の計算
inverse = [0, 1]
for i in range(2, N + 1):
inverse.append((-inverse[mod % i] * (mod // i)) % mod)
# 階乗とその逆元の計算
factorial = [1, 1]
factorial_inv = [1, 1]
for i in range(2, N + 1):
factorial.append((factor... | false | 19.444444 | [
"+N = K + S",
"+# mod上の逆元の計算",
"+inverse = [0, 1]",
"+for i in range(2, N + 1):",
"+ inverse.append((-inverse[mod % i] * (mod // i)) % mod)",
"+# 階乗とその逆元の計算",
"+factorial = [1, 1]",
"+factorial_inv = [1, 1]",
"+for i in range(2, N + 1):",
"+ factorial.append((factorial[-1] * i) % mod)",
"+... | false | 0.037542 | 0.066503 | 0.564521 | [
"s775043871",
"s895257974"
] |
u102461423 | p03653 | python | s045529798 | s556606486 | 510 | 395 | 39,276 | 37,200 | Accepted | Accepted | 22.55 | import sys
input = sys.stdin.readline
from heapq import heappush, heappushpop
"""
銅貨の集合を固定すると、金-銀でソートして貪欲に金をとることになる
逆に金-銀でソートしておくと、金が埋まるまでは金or銅の2択
最後にとる金の番号X+nをfix → 手前は金-銅で貪欲 → queueで管理できる
"""
X,Y,Z = list(map(int,input().split()))
ABC = [[int(x) for x in input().split()] for _ in range(X+Y+Z)]
ABC... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush, heappushpop
X,Y,Z = list(map(int,readline().split()))
m = list(map(int,read().split()))
ABC = sorted(zip(m,m,m), key = lambda x: x[1] - x[0])
# 手前は A or ... | 56 | 42 | 1,130 | 910 | import sys
input = sys.stdin.readline
from heapq import heappush, heappushpop
"""
銅貨の集合を固定すると、金-銀でソートして貪欲に金をとることになる
逆に金-銀でソートしておくと、金が埋まるまでは金or銅の2択
最後にとる金の番号X+nをfix → 手前は金-銅で貪欲 → queueで管理できる
"""
X, Y, Z = list(map(int, input().split()))
ABC = [[int(x) for x in input().split()] for _ in range(X + Y + Z)]
ABC.sort(key=l... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush, heappushpop
X, Y, Z = list(map(int, readline().split()))
m = list(map(int, read().split()))
ABC = sorted(zip(m, m, m), key=lambda x: x[1] - x[0])
# 手前は A or C, 後半はB ... | false | 25 | [
"-input = sys.stdin.readline",
"-from heapq import heappush, heappushpop",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+from heapq import heappop, heappush, heappushpop",
"-\"\"\"",
"-銅貨の集合を固定すると、金-銀でソートして貪欲に金をとることになる",
"-逆に金-... | false | 0.034427 | 0.042547 | 0.809155 | [
"s045529798",
"s556606486"
] |
u723792785 | p02577 | python | s731867868 | s645678204 | 356 | 204 | 81,396 | 9,192 | Accepted | Accepted | 42.7 | n = eval(input())
ans = 0
for j in n:
ans += int(j)
if ans % 9 == 0:
print("Yes")
else:
print("No") | n = int(eval(input()))
if n % 9 == 0:
print("Yes")
else:
print("No") | 8 | 5 | 103 | 70 | n = eval(input())
ans = 0
for j in n:
ans += int(j)
if ans % 9 == 0:
print("Yes")
else:
print("No")
| n = int(eval(input()))
if n % 9 == 0:
print("Yes")
else:
print("No")
| false | 37.5 | [
"-n = eval(input())",
"-ans = 0",
"-for j in n:",
"- ans += int(j)",
"-if ans % 9 == 0:",
"+n = int(eval(input()))",
"+if n % 9 == 0:"
] | false | 0.108671 | 0.093331 | 1.164351 | [
"s731867868",
"s645678204"
] |
u149260203 | p03363 | python | s673866124 | s934507407 | 256 | 226 | 25,720 | 39,508 | Accepted | Accepted | 11.72 | N = int(eval(input()))
A = [int(i) for i in input().split()]
ca = [A[0]] + [0]*(N-1)
for i in range(1,N):
ca[i] = ca[i-1] + A[i]
count = 1
number = 0
number += ca.count(0)
sca = sorted(ca) + ['hoge']
for i in range(1,N+1):
if sca[i] == sca[i-1]:
count += 1
else:
number += co... | N = int(eval(input()))
A = [int(i) for i in input().split()]
dic = {}
S = 0
dic[0] = 1
for i in range(N):
S += A[i]
if S in dic:
dic[S] += 1
else:
dic[S] = 1
number = 0
for i in dic:
N = dic[i]
number += N * (N - 1) / 2
print((int(number)))
| 20 | 21 | 374 | 294 | N = int(eval(input()))
A = [int(i) for i in input().split()]
ca = [A[0]] + [0] * (N - 1)
for i in range(1, N):
ca[i] = ca[i - 1] + A[i]
count = 1
number = 0
number += ca.count(0)
sca = sorted(ca) + ["hoge"]
for i in range(1, N + 1):
if sca[i] == sca[i - 1]:
count += 1
else:
number += count *... | N = int(eval(input()))
A = [int(i) for i in input().split()]
dic = {}
S = 0
dic[0] = 1
for i in range(N):
S += A[i]
if S in dic:
dic[S] += 1
else:
dic[S] = 1
number = 0
for i in dic:
N = dic[i]
number += N * (N - 1) / 2
print((int(number)))
| false | 4.761905 | [
"-ca = [A[0]] + [0] * (N - 1)",
"-for i in range(1, N):",
"- ca[i] = ca[i - 1] + A[i]",
"-count = 1",
"+dic = {}",
"+S = 0",
"+dic[0] = 1",
"+for i in range(N):",
"+ S += A[i]",
"+ if S in dic:",
"+ dic[S] += 1",
"+ else:",
"+ dic[S] = 1",
"-number += ca.count(0)"... | false | 0.045552 | 0.048832 | 0.932831 | [
"s673866124",
"s934507407"
] |
u332906195 | p02755 | python | s651798002 | s310851820 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int, input().split()))
for i in range(10101):
if i * 8 // 100 == A and i * 10 // 100 == B:
print(i)
exit()
print((-1))
| A, B = list(map(int, input().split()))
for i in range(1011):
if i * 8 // 100 == A and i * 10 // 100 == B:
print(i)
exit()
print((-1))
| 6 | 6 | 152 | 151 | A, B = list(map(int, input().split()))
for i in range(10101):
if i * 8 // 100 == A and i * 10 // 100 == B:
print(i)
exit()
print((-1))
| A, B = list(map(int, input().split()))
for i in range(1011):
if i * 8 // 100 == A and i * 10 // 100 == B:
print(i)
exit()
print((-1))
| false | 0 | [
"-for i in range(10101):",
"+for i in range(1011):"
] | false | 0.04914 | 0.048654 | 1.009982 | [
"s651798002",
"s310851820"
] |
u581187895 | p02953 | python | s497251406 | s671431923 | 88 | 61 | 14,396 | 15,020 | Accepted | Accepted | 30.68 | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(N-2, 0, -1):
if H[i] > H[i+1]+1:
print("No")
exit()
elif H[i] == H[i+1]+1:
H[i] -= 1
print("Yes")
| N = int(eval(input()))
H = list(map(int, input().split()))
prev = -1
flag = True
for x in H:
if x < prev:
flag = False
break
if x == prev:
continue
prev = x - 1
print(("Yes" if flag else "No")) | 12 | 14 | 208 | 222 | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(N - 2, 0, -1):
if H[i] > H[i + 1] + 1:
print("No")
exit()
elif H[i] == H[i + 1] + 1:
H[i] -= 1
print("Yes")
| N = int(eval(input()))
H = list(map(int, input().split()))
prev = -1
flag = True
for x in H:
if x < prev:
flag = False
break
if x == prev:
continue
prev = x - 1
print(("Yes" if flag else "No"))
| false | 14.285714 | [
"-for i in range(N - 2, 0, -1):",
"- if H[i] > H[i + 1] + 1:",
"- print(\"No\")",
"- exit()",
"- elif H[i] == H[i + 1] + 1:",
"- H[i] -= 1",
"-print(\"Yes\")",
"+prev = -1",
"+flag = True",
"+for x in H:",
"+ if x < prev:",
"+ flag = False",
"+ bre... | false | 0.081057 | 0.033581 | 2.413819 | [
"s497251406",
"s671431923"
] |
u784022244 | p03108 | python | s739528589 | s231964713 | 839 | 433 | 23,660 | 94,100 | Accepted | Accepted | 48.39 | N,M=list(map(int, input().split()))
B=[]
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1]*(n+1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk = [0]*(n+1)
# ノードxのrootノードを... | N,M=list(map(int, input().split()))
L=[]
for i in range(M):
a,b=list(map(int, input().split()))
L.append((a-1,b-1))
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
... | 73 | 76 | 1,572 | 1,809 | N, M = list(map(int, input().split()))
B = []
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1] * (n + 1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk = [0] ... | N, M = list(map(int, input().split()))
L = []
for i in range(M):
a, b = list(map(int, input().split()))
L.append((a - 1, b - 1))
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
... | false | 3.947368 | [
"-B = []",
"+L = []",
"+for i in range(M):",
"+ a, b = list(map(int, input().split()))",
"+ L.append((a - 1, b - 1))",
"- # ノードxのrootノードを見つける",
"+ # ノードxのrootノードを見つける",
"- return self.root[x]",
"- # 木の併合、入力は併合したい各ノード",
"+ return self.root[x]",
"+ # 木の併... | false | 0.036682 | 0.036226 | 1.012592 | [
"s739528589",
"s231964713"
] |
u806976856 | p02579 | python | s712584901 | s597550335 | 959 | 876 | 143,104 | 142,728 | Accepted | Accepted | 8.65 | from _collections import deque
h,w=list(map(int,input().split()))
cx,cy=list(map(int,input().split()))
dx,dy=list(map(int,input().split()))
s=[[] for _ in range(h+2)]
for i in range(h):
x=list(eval(input()))
x.insert(0,"#")
x.append("#")
s[i+1]=x
s[0]=s[-1]=["#"]*(w+2)
dep=[[10**10]*(w+2)... | from _collections import deque
h,w=list(map(int,input().split()))
cx,cy=list(map(int,input().split()))
dx,dy=list(map(int,input().split()))
s=[[] for _ in range(h+2)]
for i in range(h):
x=list(eval(input()))
x.insert(0,"#")
x.append("#")
s[i+1]=x
s[0]=s[-1]=["#"]*(w+2)
dep=[[10**1... | 50 | 48 | 1,423 | 1,295 | from _collections import deque
h, w = list(map(int, input().split()))
cx, cy = list(map(int, input().split()))
dx, dy = list(map(int, input().split()))
s = [[] for _ in range(h + 2)]
for i in range(h):
x = list(eval(input()))
x.insert(0, "#")
x.append("#")
s[i + 1] = x
s[0] = s[-1] = ["#"] * (w + 2)
de... | from _collections import deque
h, w = list(map(int, input().split()))
cx, cy = list(map(int, input().split()))
dx, dy = list(map(int, input().split()))
s = [[] for _ in range(h + 2)]
for i in range(h):
x = list(eval(input()))
x.insert(0, "#")
x.append("#")
s[i + 1] = x
s[0] = s[-1] = ["#"] * (w + 2)
de... | false | 4 | [
"-data = deque([[cx, cy]])",
"-data2 = deque([])",
"+data = deque([[cx, cy, 0]])",
"- while len(data) > 0:",
"- xy = data.popleft()",
"- x, y = xy[0], xy[1]",
"- data2.append([x, y])",
"+ xy = data.popleft()",
"+ x, y = xy[0], xy[1]",
"+ if xy[2] == dep[x][y]:",
... | false | 0.048793 | 0.045216 | 1.079118 | [
"s712584901",
"s597550335"
] |
u796942881 | p02953 | python | s876988491 | s886996167 | 57 | 47 | 11,200 | 11,200 | Accepted | Accepted | 17.54 | def main():
H = list(map(int, open(0).read().split()[:1:-1]))
pre = None
for h in H:
if pre is None:
pre = h
if pre + 1 < h:
print("No")
return
if pre + 1 == h:
pre = h - 1
else:
pre = h
print("Yes... | def main():
H = list(map(int, open(0).read().split()[:1:-1]))
pre = None
for h in H:
if pre is None:
pre = h
elif h <= pre:
pre = h
elif pre + 1 == h:
continue
else:
# pre + 1 < h
print("No")
... | 19 | 20 | 341 | 366 | def main():
H = list(map(int, open(0).read().split()[:1:-1]))
pre = None
for h in H:
if pre is None:
pre = h
if pre + 1 < h:
print("No")
return
if pre + 1 == h:
pre = h - 1
else:
pre = h
print("Yes")
return
... | def main():
H = list(map(int, open(0).read().split()[:1:-1]))
pre = None
for h in H:
if pre is None:
pre = h
elif h <= pre:
pre = h
elif pre + 1 == h:
continue
else:
# pre + 1 < h
print("No")
return
p... | false | 5 | [
"- if pre + 1 < h:",
"+ elif h <= pre:",
"+ pre = h",
"+ elif pre + 1 == h:",
"+ continue",
"+ else:",
"+ # pre + 1 < h",
"- if pre + 1 == h:",
"- pre = h - 1",
"- else:",
"- pre = h"
] | false | 0.047164 | 0.119393 | 0.395029 | [
"s876988491",
"s886996167"
] |
u426534722 | p02234 | python | s385446306 | s407250712 | 220 | 200 | 5,672 | 5,672 | Accepted | Accepted | 9.09 | import sys
INF = float("inf")
n = int(eval(input()))
A = [0]
for i, a in enumerate(sys.stdin):
a = list(map(int, a.split()))
if i == 0:
A.extend(a)
else:
A.append(a[1])
C = [[INF] * (n + 1) for _ in range(n + 1)]
for i in range(n + 1):
C[i][i] = 0
for j in range(1, n):
... | INF = float("inf")
MAX = 101
n = int(eval(input()))
z = []
m = [[0] * MAX for _ in range(MAX)]
for i in range(1, n + 1):
a, b = list(map(int, input().split()))
z.append(a)
z.append(b)
for l in range(2, n + 1):
for i in range(1, n - l + 2):
j = i + l - 1
m[i][j] = INF
for... | 21 | 17 | 552 | 429 | import sys
INF = float("inf")
n = int(eval(input()))
A = [0]
for i, a in enumerate(sys.stdin):
a = list(map(int, a.split()))
if i == 0:
A.extend(a)
else:
A.append(a[1])
C = [[INF] * (n + 1) for _ in range(n + 1)]
for i in range(n + 1):
C[i][i] = 0
for j in range(1, n):
for i in rang... | INF = float("inf")
MAX = 101
n = int(eval(input()))
z = []
m = [[0] * MAX for _ in range(MAX)]
for i in range(1, n + 1):
a, b = list(map(int, input().split()))
z.append(a)
z.append(b)
for l in range(2, n + 1):
for i in range(1, n - l + 2):
j = i + l - 1
m[i][j] = INF
for k in range(i... | false | 19.047619 | [
"-import sys",
"-",
"+MAX = 101",
"-A = [0]",
"-for i, a in enumerate(sys.stdin):",
"- a = list(map(int, a.split()))",
"- if i == 0:",
"- A.extend(a)",
"- else:",
"- A.append(a[1])",
"-C = [[INF] * (n + 1) for _ in range(n + 1)]",
"-for i in range(n + 1):",
"- C[i][... | false | 0.040059 | 0.03798 | 1.05474 | [
"s385446306",
"s407250712"
] |
u035907840 | p03182 | python | s799809740 | s545621358 | 1,950 | 1,725 | 123,944 | 123,396 | Accepted | Accepted | 11.54 | N, M = list(map(int,input().split()))
interval=[[] for i in range(N)]
for i in range(M):
l, r, a = list(map(int,input().split()))
interval[l-1].append((r-1, a))
# N: 処理する区間の長さ
INF = 10**30-1
LV = (N-1).bit_length()
N0 = 2**LV
data = [0]*(2*N0)
lazy = [0]*(2*N0)
def gindex(l, r):
L = (l + N... | N, M = list(map(int,input().split()))
interval=[[] for i in range(N)]
for i in range(M):
l, r, a = list(map(int,input().split()))
interval[r-1].append((l-1, a))
# N: 処理する区間の長さ
INF = 10**30-1
LV = (N-1).bit_length()
N0 = 2**LV
data = [0]*(2*N0)
lazy = [0]*(2*N0)
def gindex(l, r):
L = (l + N... | 79 | 78 | 1,764 | 1,913 | N, M = list(map(int, input().split()))
interval = [[] for i in range(N)]
for i in range(M):
l, r, a = list(map(int, input().split()))
interval[l - 1].append((r - 1, a))
# N: 処理する区間の長さ
INF = 10**30 - 1
LV = (N - 1).bit_length()
N0 = 2**LV
data = [0] * (2 * N0)
lazy = [0] * (2 * N0)
def gindex(l, r):
L = (l... | N, M = list(map(int, input().split()))
interval = [[] for i in range(N)]
for i in range(M):
l, r, a = list(map(int, input().split()))
interval[r - 1].append((l - 1, a))
# N: 処理する区間の長さ
INF = 10**30 - 1
LV = (N - 1).bit_length()
N0 = 2**LV
data = [0] * (2 * N0)
lazy = [0] * (2 * N0)
def gindex(l, r):
L = (l... | false | 1.265823 | [
"- interval[l - 1].append((r - 1, a))",
"+ interval[r - 1].append((l - 1, a))",
"-dp = [0] * N",
"-for i in range(N - 1, -1, -1):",
"+dp = [0] * N # dp[i] = max upto i. SegTree maintans max s.t. rightmost 1 is at i",
"+for i in range(N):",
"- r, a = interval[i][j]",
"- update(i, r... | false | 0.047108 | 0.042076 | 1.119594 | [
"s799809740",
"s545621358"
] |
u164727245 | p02603 | python | s293149293 | s839212084 | 33 | 28 | 8,892 | 9,208 | Accepted | Accepted | 15.15 | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
budget = 1000
stock = 0
temp = 0
for i in range(n-1):
if A[i] < A[i+1] and A[i] <= temp+budget:
budget += temp
temp = 0
stock = budget//... | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
budget = 1000
stock = 0
for i in range(n-1):
if A[i] < A[i+1] and A[i] <= budget:
stock, budget = divmod(budget, A[i])
elif A[i+1] < A[i]:
budget... | 25 | 21 | 559 | 478 | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
budget = 1000
stock = 0
temp = 0
for i in range(n - 1):
if A[i] < A[i + 1] and A[i] <= temp + budget:
budget += temp
temp = 0
stock = budget // A[i]
... | # coding: utf-8
def solve(*args: str) -> str:
n = int(args[0])
A = list(map(int, args[1].split()))
budget = 1000
stock = 0
for i in range(n - 1):
if A[i] < A[i + 1] and A[i] <= budget:
stock, budget = divmod(budget, A[i])
elif A[i + 1] < A[i]:
budget += A[i] *... | false | 16 | [
"- temp = 0",
"- if A[i] < A[i + 1] and A[i] <= temp + budget:",
"- budget += temp",
"- temp = 0",
"- stock = budget // A[i]",
"- budget %= A[i]",
"+ if A[i] < A[i + 1] and A[i] <= budget:",
"+ stock, budget = divmod(budget, A[i])... | false | 0.03544 | 0.035335 | 1.002977 | [
"s293149293",
"s839212084"
] |
u028973125 | p03032 | python | s841646483 | s320049227 | 213 | 83 | 43,496 | 68,672 | Accepted | Accepted | 61.03 | import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
V = list(map(int, sys.stdin.readline().strip().split()))
ans=0
act = min(N, K)
for i in range(act + 1): # 左
for j in range(N - act + i, N+1): # 右
count = V[0:i] + V[j:N]
count.sort()
ans = max(ans, sum(count)... | import sys
N, K = list(map(int, sys.stdin.readline().split()))
V = list(map(int, sys.stdin.readline().split()))
ans = 0
for i in range(N+1):
if K < i:
continue
score = sum(V[0:i])
# print("i", i, "l score", score)
ans = max(ans, score)
for j in range(N+1):
if N < i +... | 16 | 39 | 475 | 947 | import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
V = list(map(int, sys.stdin.readline().strip().split()))
ans = 0
act = min(N, K)
for i in range(act + 1): # 左
for j in range(N - act + i, N + 1): # 右
count = V[0:i] + V[j:N]
count.sort()
ans = max(ans, sum(count))
... | import sys
N, K = list(map(int, sys.stdin.readline().split()))
V = list(map(int, sys.stdin.readline().split()))
ans = 0
for i in range(N + 1):
if K < i:
continue
score = sum(V[0:i])
# print("i", i, "l score", score)
ans = max(ans, score)
for j in range(N + 1):
if N < i + j or K < i ... | false | 58.974359 | [
"-N, K = list(map(int, sys.stdin.readline().strip().split()))",
"-V = list(map(int, sys.stdin.readline().strip().split()))",
"+N, K = list(map(int, sys.stdin.readline().split()))",
"+V = list(map(int, sys.stdin.readline().split()))",
"-act = min(N, K)",
"-for i in range(act + 1): # 左",
"- for j in r... | false | 0.062647 | 0.082763 | 0.756943 | [
"s841646483",
"s320049227"
] |
u987164499 | p02792 | python | s497987870 | s776481699 | 254 | 212 | 3,064 | 3,316 | Accepted | Accepted | 16.54 | from sys import stdin
n = int(stdin.readline().rstrip())
li = [[0 for i in range(10)]for j in range(10)]
for k in range(1,n+1):
atama = int(str(k)[0])
ushiro = int(str(k)[-1])
li[atama][ushiro] += 1
point = 0
for l in range(1,10):
for m in range(1,10):
point += li[l][m]*li[m]... | from collections import defaultdict
n = int(eval(input()))
dic = defaultdict(int)
for i in range(1,n+1):
s = str(i)
dic[int(s[0]),int(s[-1])] += 1
point = 0
for i in range(1,10):
for j in range(1,10):
point += dic[i,j]*dic[j,i]
print(point) | 17 | 16 | 337 | 274 | from sys import stdin
n = int(stdin.readline().rstrip())
li = [[0 for i in range(10)] for j in range(10)]
for k in range(1, n + 1):
atama = int(str(k)[0])
ushiro = int(str(k)[-1])
li[atama][ushiro] += 1
point = 0
for l in range(1, 10):
for m in range(1, 10):
point += li[l][m] * li[m][l]
print(p... | from collections import defaultdict
n = int(eval(input()))
dic = defaultdict(int)
for i in range(1, n + 1):
s = str(i)
dic[int(s[0]), int(s[-1])] += 1
point = 0
for i in range(1, 10):
for j in range(1, 10):
point += dic[i, j] * dic[j, i]
print(point)
| false | 5.882353 | [
"-from sys import stdin",
"+from collections import defaultdict",
"-n = int(stdin.readline().rstrip())",
"-li = [[0 for i in range(10)] for j in range(10)]",
"-for k in range(1, n + 1):",
"- atama = int(str(k)[0])",
"- ushiro = int(str(k)[-1])",
"- li[atama][ushiro] += 1",
"+n = int(eval(in... | false | 0.169593 | 0.051954 | 3.264284 | [
"s497987870",
"s776481699"
] |
u644907318 | p02603 | python | s426810474 | s750324258 | 71 | 28 | 61,760 | 9,244 | Accepted | Accepted | 60.56 | N = int(eval(input()))
A = list(map(int,input().split()))
m = 1000
s = 0
flag = 0
a = A[0]
for i in range(N):
if A[i]>a and flag==0:
n = m//a
s += n
m -= n*a
flag = 1
elif A[i]<a and flag==1:
m += s*a
s = 0
flag = 0
a = A[i]
if flag==1... | N = int(eval(input()))
A = list(map(int,input().split()))
x = 1000
cnt = 0
flag = 0
for i in range(1,N):
if flag==0 and A[i]-A[i-1]>0:
cnt += x//A[i-1]
x = x%A[i-1]
flag = 1
elif flag==0 and A[i]-A[i-1]<0:
x += cnt*A[i-1]
cnt = 0
flag = -1
elif f... | 20 | 26 | 343 | 561 | N = int(eval(input()))
A = list(map(int, input().split()))
m = 1000
s = 0
flag = 0
a = A[0]
for i in range(N):
if A[i] > a and flag == 0:
n = m // a
s += n
m -= n * a
flag = 1
elif A[i] < a and flag == 1:
m += s * a
s = 0
flag = 0
a = A[i]
if flag == 1... | N = int(eval(input()))
A = list(map(int, input().split()))
x = 1000
cnt = 0
flag = 0
for i in range(1, N):
if flag == 0 and A[i] - A[i - 1] > 0:
cnt += x // A[i - 1]
x = x % A[i - 1]
flag = 1
elif flag == 0 and A[i] - A[i - 1] < 0:
x += cnt * A[i - 1]
cnt = 0
flag... | false | 23.076923 | [
"-m = 1000",
"-s = 0",
"+x = 1000",
"+cnt = 0",
"-a = A[0]",
"-for i in range(N):",
"- if A[i] > a and flag == 0:",
"- n = m // a",
"- s += n",
"- m -= n * a",
"+for i in range(1, N):",
"+ if flag == 0 and A[i] - A[i - 1] > 0:",
"+ cnt += x // A[i - 1]",
"... | false | 0.037802 | 0.10033 | 0.376772 | [
"s426810474",
"s750324258"
] |
u344030307 | p02982 | python | s649684574 | s477783199 | 31 | 26 | 9,188 | 9,184 | Accepted | Accepted | 16.13 | import math
n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(0, n):
for j in range(i+1, n):
D = []
for k in range(d):
D.append((x[i][k] - x[j][k])**2)
D = math.sqrt(sum(D))
if isinstance(D, int) == True or D.i... | import math
n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(0, n):
for j in range(i+1, n):
D = math.sqrt(sum((x[i][k] - x[j][k])**2 for k in range(d)))
if D.is_integer() == True:
cnt += 1
print(cnt) | 17 | 15 | 364 | 301 | import math
n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(0, n):
for j in range(i + 1, n):
D = []
for k in range(d):
D.append((x[i][k] - x[j][k]) ** 2)
D = math.sqrt(sum(D))
if isinstance(D, int) == ... | import math
n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(0, n):
for j in range(i + 1, n):
D = math.sqrt(sum((x[i][k] - x[j][k]) ** 2 for k in range(d)))
if D.is_integer() == True:
cnt += 1
print(cnt)
| false | 11.764706 | [
"- D = []",
"- for k in range(d):",
"- D.append((x[i][k] - x[j][k]) ** 2)",
"- D = math.sqrt(sum(D))",
"- if isinstance(D, int) == True or D.is_integer() == True:",
"+ D = math.sqrt(sum((x[i][k] - x[j][k]) ** 2 for k in range(d)))",
"+ if D.is_integer... | false | 0.037257 | 0.036593 | 1.018136 | [
"s649684574",
"s477783199"
] |
u476604182 | p02919 | python | s071838868 | s400341294 | 463 | 426 | 62,956 | 58,860 | Accepted | Accepted | 7.99 | class BIT:
def __init__(self, n):
self.N = n
self.tree = [0]*(n+1)
def BIT_add(self, i):
while i <= self.N:
self.tree[i] += 1
i += i&(-i)
def BIT_sum(self, i):
s = 0
while i:
s += self.tree[i]
i -= i&(-i)
return s
def BIT_search(self, x):... | class BIT:
def __init__(self, N):
self.n = N
self.tree = [0]*(self.n+1)
def bsum(self, i):
s = 0
while i:
s += self.tree[i]
i -= i&(-i)
return s
def badd(self, i, x):
while i<=self.n:
self.tree[i] += x
i += i&(-i)
def bsearch(self, ... | 55 | 57 | 1,109 | 1,053 | class BIT:
def __init__(self, n):
self.N = n
self.tree = [0] * (n + 1)
def BIT_add(self, i):
while i <= self.N:
self.tree[i] += 1
i += i & (-i)
def BIT_sum(self, i):
s = 0
while i:
s += self.tree[i]
i -= i & (-i)
... | class BIT:
def __init__(self, N):
self.n = N
self.tree = [0] * (self.n + 1)
def bsum(self, i):
s = 0
while i:
s += self.tree[i]
i -= i & (-i)
return s
def badd(self, i, x):
while i <= self.n:
self.tree[i] += x
... | false | 3.508772 | [
"- def __init__(self, n):",
"- self.N = n",
"- self.tree = [0] * (n + 1)",
"+ def __init__(self, N):",
"+ self.n = N",
"+ self.tree = [0] * (self.n + 1)",
"- def BIT_add(self, i):",
"- while i <= self.N:",
"- self.tree[i] += 1",
"- ... | false | 0.039142 | 0.038731 | 1.010625 | [
"s071838868",
"s400341294"
] |
u729133443 | p03047 | python | s072792273 | s167485044 | 161 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.44 | print((eval(input().replace(' ','+1-')))) | print((eval(input().replace(' ','-~-')))) | 1 | 1 | 39 | 39 | print((eval(input().replace(" ", "+1-"))))
| print((eval(input().replace(" ", "-~-"))))
| false | 0 | [
"-print((eval(input().replace(\" \", \"+1-\"))))",
"+print((eval(input().replace(\" \", \"-~-\"))))"
] | false | 0.0365 | 0.036232 | 1.007387 | [
"s072792273",
"s167485044"
] |
u102461423 | p03014 | python | s757591686 | s176775626 | 1,665 | 1,049 | 141,856 | 188,708 | Accepted | Accepted | 37 | import numpy as np
H,W = list(map(int,input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H+2,W+2),dtype=np.int32)
map[1:-1,1:-1][temp == '.'] = 1
# x軸正方向の集計
def F():
x = map.copy()
for row in range(1,H+1):
zero_idx = np.nonzero(x[row]==0)[0]
... | import numpy as np
H,W = list(map(int,input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H+2,W+2),dtype=np.int32)
map[1:-1,1:-1][temp == '.'] = 1
# x軸正方向の集計
def F(transpose,reverse):
x = map.copy()
if transpose:
x = x.T
x = np.ravel(x)
if ... | 42 | 34 | 862 | 731 | import numpy as np
H, W = list(map(int, input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H + 2, W + 2), dtype=np.int32)
map[1:-1, 1:-1][temp == "."] = 1
# x軸正方向の集計
def F():
x = map.copy()
for row in range(1, H + 1):
zero_idx = np.nonzero(x[row] == ... | import numpy as np
H, W = list(map(int, input().split()))
temp = np.array([list(eval(input())) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H + 2, W + 2), dtype=np.int32)
map[1:-1, 1:-1][temp == "."] = 1
# x軸正方向の集計
def F(transpose, reverse):
x = map.copy()
if transpose:
x = x.T
x = np.ravel(x)
... | false | 19.047619 | [
"-def F():",
"+def F(transpose, reverse):",
"- for row in range(1, H + 1):",
"- zero_idx = np.nonzero(x[row] == 0)[0]",
"- x[row, zero_idx[1:]] = 1 - np.diff(zero_idx) # cumsumで求められるように変形",
"- x = x.cumsum(axis=1)",
"+ if transpose:",
"+ x = x.T",
"+ x = np.ravel(x)... | false | 0.179584 | 0.181329 | 0.99038 | [
"s757591686",
"s176775626"
] |
u062484507 | p03494 | python | s236059700 | s137445814 | 167 | 20 | 38,768 | 3,060 | Accepted | Accepted | 88.02 | n = int(eval(input()))
a = [int(i) for i in input().split()]
count = 0
while all(i % 2 == 0 for i in a):
a = [i/2 for i in a]
count += 1
print(count) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
a = [int(x) for x in readline().split()]
ans = float('inf')
for x in a:
ans = min(ans, len(bin(x)) - bin(x).rfind('1') - 1)
print(ans) | 7 | 11 | 157 | 285 | n = int(eval(input()))
a = [int(i) for i in input().split()]
count = 0
while all(i % 2 == 0 for i in a):
a = [i / 2 for i in a]
count += 1
print(count)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
a = [int(x) for x in readline().split()]
ans = float("inf")
for x in a:
ans = min(ans, len(bin(x)) - bin(x).rfind("1") - 1)
print(ans)
| false | 36.363636 | [
"-n = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-count = 0",
"-while all(i % 2 == 0 for i in a):",
"- a = [i / 2 for i in a]",
"- count += 1",
"-print(count)",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines ... | false | 0.038202 | 0.11359 | 0.336312 | [
"s236059700",
"s137445814"
] |
u089142196 | p03487 | python | s333933980 | s174948758 | 146 | 98 | 18,676 | 18,676 | Accepted | Accepted | 32.88 | import collections
N=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
cnt=0
c=collections.Counter(a)
#print(c)
for item in c:
t=c[item]
if t>item:
cnt+=t-item
elif t==item:
pass
else:
cnt+=t
#while len(a)>0:
# item=a[0]
# t=(item)
# #print(item,t,a)
# if ... | import collections
N=int(eval(input()))
a=list(map(int,input().split()))
c=collections.Counter(a)
cnt=0
for item in c:
t=c[item]
if t>item:
cnt+=t-item
elif t==item:
pass
else:
cnt+=t
print(cnt) | 34 | 18 | 444 | 231 | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
cnt = 0
c = collections.Counter(a)
# print(c)
for item in c:
t = c[item]
if t > item:
cnt += t - item
elif t == item:
pass
else:
cnt += t
# while len(a)>0:
# item=a[0]
# t=(item)
# #print(i... | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
cnt = 0
for item in c:
t = c[item]
if t > item:
cnt += t - item
elif t == item:
pass
else:
cnt += t
print(cnt)
| false | 47.058824 | [
"-a.sort()",
"+c = collections.Counter(a)",
"-c = collections.Counter(a)",
"-# print(c)",
"-# while len(a)>0:",
"-# item=a[0]",
"-# t=(item)",
"-# #print(item,t,a)",
"-# if t>item:",
"-# cnt+=t-item",
"-# elif t==item:",
"-# pass",
"-# else:",
"-# cnt+=t",
"-# del a[0:t]"... | false | 0.039635 | 0.044381 | 0.893055 | [
"s333933980",
"s174948758"
] |
u798818115 | p02918 | python | s938069253 | s594280077 | 88 | 76 | 4,772 | 4,776 | Accepted | Accepted | 13.64 | # coding: utf-8
# Your code here!
N,K=list(map(int,input().split()))
S=list(eval(input()))
l=[]
count=1
for i in range(N-1):
if S[i]!=S[i+1]:
l.append(count)
count=1
else:
count+=1
l.append(count)
flag=False
ans=0
idx=0
time=0
while idx<len(l):
if time<K:
... | # coding: utf-8
# Your code here!
N,K=list(map(int,input().split()))
S=list(eval(input()))
clu=[]
temp=0
for i in range(1,len(S)):
if S[i]==S[i-1]:
temp+=1
else:
clu.append(temp)
temp=0
clu.append(temp)
ans=sum(clu)
base=S[0]
zone=False
for i in range(1,len(S))... | 36 | 38 | 532 | 574 | # coding: utf-8
# Your code here!
N, K = list(map(int, input().split()))
S = list(eval(input()))
l = []
count = 1
for i in range(N - 1):
if S[i] != S[i + 1]:
l.append(count)
count = 1
else:
count += 1
l.append(count)
flag = False
ans = 0
idx = 0
time = 0
while idx < len(l):
if time <... | # coding: utf-8
# Your code here!
N, K = list(map(int, input().split()))
S = list(eval(input()))
clu = []
temp = 0
for i in range(1, len(S)):
if S[i] == S[i - 1]:
temp += 1
else:
clu.append(temp)
temp = 0
clu.append(temp)
ans = sum(clu)
base = S[0]
zone = False
for i in range(1, len(S)):... | false | 5.263158 | [
"-l = []",
"-count = 1",
"-for i in range(N - 1):",
"- if S[i] != S[i + 1]:",
"- l.append(count)",
"- count = 1",
"+clu = []",
"+temp = 0",
"+for i in range(1, len(S)):",
"+ if S[i] == S[i - 1]:",
"+ temp += 1",
"- count += 1",
"-l.append(count)",
"-flag =... | false | 0.050356 | 0.036953 | 1.362696 | [
"s938069253",
"s594280077"
] |
u577170763 | p03161 | python | s514883028 | s211538174 | 537 | 363 | 53,216 | 53,728 | Accepted | Accepted | 32.4 | # import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(eval(input()))
def main():
N, K = geta(int)
h = geta(int)
INF = 1 << 60
dp = [INF]*N
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i i... | # import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(eval(input()))
def main():
N, K = geta(int)
h = geta(int)
INF = 10 << 60
dp = [INF]*N
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i ... | 22 | 25 | 485 | 562 | # import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(eval(input()))
def main():
N, K = geta(int)
h = geta(int)
INF = 1 << 60
dp = [INF] * N
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i in range(2, N)... | # import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(eval(input()))
def main():
N, K = geta(int)
h = geta(int)
INF = 10 << 60
dp = [INF] * N
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i in range(2, N... | false | 12 | [
"- INF = 1 << 60",
"+ INF = 10 << 60",
"- dp[i] = min((dp[j] + abs(h[i] - h[j]) for j in range(lb, i)))",
"+ tmp, hi = INF, h[i]",
"+ for dpj, hj in zip(dp[lb:i], h[lb:i]):",
"+ tmp = min(tmp, dpj + abs(hi - hj))",
"+ dp[i] = tmp"
] | false | 0.034184 | 0.035104 | 0.973788 | [
"s514883028",
"s211538174"
] |
u392319141 | p03252 | python | s804565641 | s681991204 | 87 | 53 | 3,632 | 3,632 | Accepted | Accepted | 39.08 | S = eval(input())
T = eval(input())
tToS = {}
sToT = {}
for s, t in zip(S, T):
if not t in tToS:
tToS[t] = s
if not s in sToT:
sToT[s] = t
if tToS[t] != s or sToT[s] != t:
print('No')
exit()
print('Yes')
| S = eval(input())
T = eval(input())
def isOk():
sToT = {}
tToS = {}
for s, t in zip(S, T):
if not s in sToT:
sToT[s] = t
elif sToT[s] != t:
return False
if not t in tToS:
tToS[t] = s
elif tToS[t] != s:
return Fals... | 16 | 18 | 254 | 363 | S = eval(input())
T = eval(input())
tToS = {}
sToT = {}
for s, t in zip(S, T):
if not t in tToS:
tToS[t] = s
if not s in sToT:
sToT[s] = t
if tToS[t] != s or sToT[s] != t:
print("No")
exit()
print("Yes")
| S = eval(input())
T = eval(input())
def isOk():
sToT = {}
tToS = {}
for s, t in zip(S, T):
if not s in sToT:
sToT[s] = t
elif sToT[s] != t:
return False
if not t in tToS:
tToS[t] = s
elif tToS[t] != s:
return False
return ... | false | 11.111111 | [
"-tToS = {}",
"-sToT = {}",
"-for s, t in zip(S, T):",
"- if not t in tToS:",
"- tToS[t] = s",
"- if not s in sToT:",
"- sToT[s] = t",
"- if tToS[t] != s or sToT[s] != t:",
"- print(\"No\")",
"- exit()",
"-print(\"Yes\")",
"+",
"+",
"+def isOk():",
"+... | false | 0.110705 | 0.035525 | 3.11622 | [
"s804565641",
"s681991204"
] |
u753803401 | p02883 | python | s229821814 | s837890746 | 1,982 | 504 | 126,448 | 113,364 | Accepted | Accepted | 74.57 | import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, k = list(map(int, input().rstrip('\n').sp... | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, k = list(map(int, input().rstrip('\n').split()))
a = list(map(int, input().rstrip('\n').split()))
a.sort()
f = list(map(int, input().rstrip('\n').split()))
f.sort(reverse=True)
cor_v = 10 ** 13
inc_... | 40 | 31 | 943 | 756 | import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, k = list(map(int, input().rstrip("\n").split()))
a = l... | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, k = list(map(int, input().rstrip("\n").split()))
a = list(map(int, input().rstrip("\n").split()))
a.sort()
f = list(map(int, input().rstrip("\n").split()))
f.sort(reverse=True)
cor_v = 10**13
inc_v = -1
while... | false | 22.5 | [
"-import bisect",
"-import itertools",
"-import collections",
"-import fractions",
"-import heapq",
"-import math",
"-from operator import mul",
"-from functools import reduce",
"-from functools import lru_cache",
"- cor_v = 10**20",
"+ cor_v = 10**13"
] | false | 0.034144 | 0.047469 | 0.719296 | [
"s229821814",
"s837890746"
] |
u263830634 | p03835 | python | s301522141 | s128618854 | 1,665 | 1,287 | 2,940 | 2,940 | Accepted | Accepted | 22.7 | 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) | K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
if 0 <= S - i - j <= K:
ans += 1
print (ans) | 10 | 9 | 186 | 165 | 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)
| K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
if 0 <= S - i - j <= K:
ans += 1
print(ans)
| false | 10 | [
"-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)",
"+ans = 0",
"+for i in range(K + 1):",
"+ for j in range(K + 1):",
"+ if 0 <= S - i - j <= K:",
"+ ans ... | false | 0.06247 | 0.044896 | 1.391435 | [
"s301522141",
"s128618854"
] |
u614181788 | p02862 | python | s524244980 | s729898884 | 1,282 | 1,028 | 3,064 | 9,148 | Accepted | Accepted | 19.81 | def comb_mod(n,r,m):
ans = 1
for i in range(1,r+1):
ans *= (n-i+1) % m
ans *= pow(i,m-2,m) % m
ans = ans % m
return ans
x,y = list(map(int,input().split()))
m = 10**9+7
n = (x+y)//3
c = 0
if x*0.5 <= y <= 2*x and (x+y)%3 == 0:
r = x - n
c = comb_mod(n,r,m)
else:... | def comb_mod(n,r,m):
ans = 1
for i in range(1,r+1):
ans *= (n-i+1) % m
ans *= pow(i,m-2,m) % m
ans = ans % m
return ans
x,y = list(map(int,input().split()))
m = 10**9+7
if x > 2*y or 2*x < y or (x+y)%3 != 0:
ans = 0
else:
n = (x+y)//3
r = x-n
ans = com... | 17 | 17 | 338 | 338 | def comb_mod(n, r, m):
ans = 1
for i in range(1, r + 1):
ans *= (n - i + 1) % m
ans *= pow(i, m - 2, m) % m
ans = ans % m
return ans
x, y = list(map(int, input().split()))
m = 10**9 + 7
n = (x + y) // 3
c = 0
if x * 0.5 <= y <= 2 * x and (x + y) % 3 == 0:
r = x - n
c = comb... | def comb_mod(n, r, m):
ans = 1
for i in range(1, r + 1):
ans *= (n - i + 1) % m
ans *= pow(i, m - 2, m) % m
ans = ans % m
return ans
x, y = list(map(int, input().split()))
m = 10**9 + 7
if x > 2 * y or 2 * x < y or (x + y) % 3 != 0:
ans = 0
else:
n = (x + y) // 3
r = x ... | false | 0 | [
"-n = (x + y) // 3",
"-c = 0",
"-if x * 0.5 <= y <= 2 * x and (x + y) % 3 == 0:",
"+if x > 2 * y or 2 * x < y or (x + y) % 3 != 0:",
"+ ans = 0",
"+else:",
"+ n = (x + y) // 3",
"- c = comb_mod(n, r, m)",
"-else:",
"- ans = 0",
"-print(c)",
"+ ans = comb_mod(n, r, m)",
"+print... | false | 0.749565 | 0.766883 | 0.977417 | [
"s524244980",
"s729898884"
] |
u390727364 | p02689 | python | s072325312 | s481381268 | 418 | 314 | 45,432 | 106,656 | Accepted | Accepted | 24.88 | def main():
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = []
for _ in range(n):
g.append([])
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].app... | def main():
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
ans = 0
... | 26 | 24 | 566 | 540 | def main():
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = []
for _ in range(n):
g.append([])
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
... | def main():
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
ans = 0
for i in... | false | 7.692308 | [
"- g = []",
"- for _ in range(n):",
"- g.append([])",
"+ g = [[] for _ in range(n)]"
] | false | 0.067407 | 0.046965 | 1.435251 | [
"s072325312",
"s481381268"
] |
u111652094 | p02708 | python | s318076804 | s514452754 | 101 | 24 | 9,164 | 9,132 | Accepted | Accepted | 76.24 | N,K=list(map(int,input().split()))
ans=0
for i in range(K,N+2):
mini=i*(i-1)//2
maxi=i*N-mini
ans=ans+(maxi-mini+1)
print((ans%(10**9+7)))
| N,K=list(map(int,input().split()))
M=N+1
A=-M*(M+1)*(2*M+1)//6+(N+1)*M*(M+1)//2+M
M=K-1
B=-M*(M+1)*(2*M+1)//6+(N+1)*M*(M+1)//2+M
print(((A-B)%(10**9+7))) | 9 | 12 | 153 | 162 | N, K = list(map(int, input().split()))
ans = 0
for i in range(K, N + 2):
mini = i * (i - 1) // 2
maxi = i * N - mini
ans = ans + (maxi - mini + 1)
print((ans % (10**9 + 7)))
| N, K = list(map(int, input().split()))
M = N + 1
A = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M
M = K - 1
B = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M
print(((A - B) % (10**9 + 7)))
| false | 25 | [
"-ans = 0",
"-for i in range(K, N + 2):",
"- mini = i * (i - 1) // 2",
"- maxi = i * N - mini",
"- ans = ans + (maxi - mini + 1)",
"-print((ans % (10**9 + 7)))",
"+M = N + 1",
"+A = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M",
"+M = K - 1",
"+B = -M * (M + 1) * (2 * ... | false | 0.055281 | 0.061941 | 0.892481 | [
"s318076804",
"s514452754"
] |
u997648604 | p02579 | python | s881688829 | s241649230 | 1,192 | 1,036 | 123,540 | 108,812 | Accepted | Accepted | 13.09 | import numpy as np
from collections import defaultdict
import heapq
import sys
sys.setrecursionlimit(10**9)
def mi(): return list(map(int,input().split()))
def ii(): return int(eval(input()))
def isp(): return input().split()
def deb(text): print(("-------\n{}\n-------".format(text)))
INF=1<<18
from num... | from numba import njit
import numpy as np
import heapq
import sys
sys.setrecursionlimit(10**9)
def mi(): return list(map(int,input().split()))
def ii(): return int(eval(input()))
def isp(): return input().split()
def deb(text): print(("-------\n{}\n-------".format(text)))
INF=1<<18
@njit(cache=True)
de... | 78 | 94 | 1,909 | 2,142 | import numpy as np
from collections import defaultdict
import heapq
import sys
sys.setrecursionlimit(10**9)
def mi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def isp():
return input().split()
def deb(text):
print(("-------\n{}\n-------".format(text)))
INF = ... | from numba import njit
import numpy as np
import heapq
import sys
sys.setrecursionlimit(10**9)
def mi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def isp():
return input().split()
def deb(text):
print(("-------\n{}\n-------".format(text)))
INF = 1 << 18
@nj... | false | 17.021277 | [
"+from numba import njit",
"-from collections import defaultdict",
"-from numba import njit, b1, i4, i8, f8",
"-@njit((i8, i8, i8), cache=True)",
"-# @njit(cache=True)",
"+@njit(cache=True)",
"-@njit((i8, i8, i8, i8, i8, i8, b1[:]), cache=True)",
"-def main(H, W, Ch, Cw, Dh, Dw, G):",
"+def solve(H,... | false | 0.195415 | 0.037253 | 5.245567 | [
"s881688829",
"s241649230"
] |
u002459665 | p02711 | python | s408953352 | s893481598 | 23 | 21 | 9,108 | 9,008 | Accepted | Accepted | 8.7 | N = int(eval(input()))
ans = False
for _ in range(3):
s = N % 10
# print(s)
if s == 7:
ans = True
N //= 10
if ans:
print('Yes')
else:
print('No') | N = eval(input())
ans = False
for i in range(3):
if N[i] == '7':
ans = True
if ans:
print('Yes')
else:
print('No') | 14 | 11 | 186 | 140 | N = int(eval(input()))
ans = False
for _ in range(3):
s = N % 10
# print(s)
if s == 7:
ans = True
N //= 10
if ans:
print("Yes")
else:
print("No")
| N = eval(input())
ans = False
for i in range(3):
if N[i] == "7":
ans = True
if ans:
print("Yes")
else:
print("No")
| false | 21.428571 | [
"-N = int(eval(input()))",
"+N = eval(input())",
"-for _ in range(3):",
"- s = N % 10",
"- # print(s)",
"- if s == 7:",
"+for i in range(3):",
"+ if N[i] == \"7\":",
"- N //= 10"
] | false | 0.038597 | 0.039256 | 0.983228 | [
"s408953352",
"s893481598"
] |
u489959379 | p02861 | python | s742999080 | s594676339 | 605 | 467 | 10,020 | 3,064 | Accepted | Accepted | 22.81 | import itertools
import math
n = int(eval(input()))
x_y = list(input().split() for i in range(n))
all = list(itertools.permutations(x_y))
l = 0
for i in all:
for j in range(n-1):
tmp = math.sqrt(math.pow(int(i[j][0])-int(i[j+1][0]), 2) + math.pow(int(i[j][1])-int(i[j+1][1]), 2))
l += tmp
... | from itertools import permutations
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
dist = 0
cnt = 0
for pattern in permutations(xy):
cnt += 1
for i in range(n - 1):
x1, y1 = pattern[i]
x2, y2 = pattern[i + 1]
dist += pow(pow(x1 - x2, 2) + pow... | 13 | 15 | 334 | 364 | import itertools
import math
n = int(eval(input()))
x_y = list(input().split() for i in range(n))
all = list(itertools.permutations(x_y))
l = 0
for i in all:
for j in range(n - 1):
tmp = math.sqrt(
math.pow(int(i[j][0]) - int(i[j + 1][0]), 2)
+ math.pow(int(i[j][1]) - int(i[j + 1][1... | from itertools import permutations
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
dist = 0
cnt = 0
for pattern in permutations(xy):
cnt += 1
for i in range(n - 1):
x1, y1 = pattern[i]
x2, y2 = pattern[i + 1]
dist += pow(pow(x1 - x2, 2) + pow(y1 - y2, 2),... | false | 13.333333 | [
"-import itertools",
"-import math",
"+from itertools import permutations",
"-x_y = list(input().split() for i in range(n))",
"-all = list(itertools.permutations(x_y))",
"-l = 0",
"-for i in all:",
"- for j in range(n - 1):",
"- tmp = math.sqrt(",
"- math.pow(int(i[j][0]) - in... | false | 0.104086 | 0.07661 | 1.358644 | [
"s742999080",
"s594676339"
] |
u600402037 | p02948 | python | s894097235 | s723318778 | 475 | 370 | 27,740 | 23,752 | Accepted | Accepted | 22.11 | # D - Summer Vacation
from heapq import *
from collections import defaultdict
n, m = list(map(int, input().split()))
jobs = defaultdict(list)
for _ in range(n):
a, b = list(map(int, input().split()))
jobs[a].append(-b)
result = 0
pool = []
for i in range(1, m+1):
for j in jobs[i]:
he... | import sys
from heapq import heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
works = [[] for _ in range(M+1)]
# M-1日後から選んでいく,
for _ in range(N):
a, b = lr()
if a > M:
continue
works[a].append(-b... | 19 | 28 | 397 | 530 | # D - Summer Vacation
from heapq import *
from collections import defaultdict
n, m = list(map(int, input().split()))
jobs = defaultdict(list)
for _ in range(n):
a, b = list(map(int, input().split()))
jobs[a].append(-b)
result = 0
pool = []
for i in range(1, m + 1):
for j in jobs[i]:
heappush(pool, ... | import sys
from heapq import heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
works = [[] for _ in range(M + 1)]
# M-1日後から選んでいく,
for _ in range(N):
a, b = lr()
if a > M:
continue
works[a].append(-b)
heap = []
a... | false | 32.142857 | [
"-# D - Summer Vacation",
"-from heapq import *",
"-from collections import defaultdict",
"+import sys",
"+from heapq import heappop, heappush",
"-n, m = list(map(int, input().split()))",
"-jobs = defaultdict(list)",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- jobs[... | false | 0.107641 | 0.101328 | 1.062305 | [
"s894097235",
"s723318778"
] |
u821588465 | p02608 | python | s712548763 | s587912298 | 950 | 486 | 50,640 | 9,152 | Accepted | Accepted | 48.84 | import collections
import sys
input = sys.stdin.readline
n= int(eval(input()))
# ans = [0]*n
tmp = []
for x in range(1, int(n**0.5)+1):
for y in range(1, int(n**0.5)+1):
for z in range(1, int(n**0.5)+1):
tmp.append(x**2+y**2+z**2+x*y+y*z+z*x)
cnt = collections.Counter(tmp)
for ... | n = int(eval(input()))
cnt = [0]*11000
for x in range(1,101):
for y in range(1, 101):
for z in range(1, 101):
value = x*x + y*y + z*z + x*y + y*z + z*x
if value <= n:
cnt[value] += 1
for i in range(1, n+1):
print((cnt[i]))
| 16 | 13 | 352 | 289 | import collections
import sys
input = sys.stdin.readline
n = int(eval(input()))
# ans = [0]*n
tmp = []
for x in range(1, int(n**0.5) + 1):
for y in range(1, int(n**0.5) + 1):
for z in range(1, int(n**0.5) + 1):
tmp.append(x**2 + y**2 + z**2 + x * y + y * z + z * x)
cnt = collections.Counter(tmp... | n = int(eval(input()))
cnt = [0] * 11000
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
value = x * x + y * y + z * z + x * y + y * z + z * x
if value <= n:
cnt[value] += 1
for i in range(1, n + 1):
print((cnt[i]))
| false | 18.75 | [
"-import collections",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-# ans = [0]*n",
"-tmp = []",
"-for x in range(1, int(n**0.5) + 1):",
"- for y in range(1, int(n**0.5) + 1):",
"- for z in range(1, int(n**0.5) + 1):",
"- tmp.append(x**2 + y**2 + z**2 + x * y + y * z +... | false | 0.067597 | 1.310818 | 0.051568 | [
"s712548763",
"s587912298"
] |
u644907318 | p02744 | python | s972942550 | s492426423 | 536 | 184 | 73,304 | 110,300 | Accepted | Accepted | 65.67 | from itertools import combinations
def g(i):
return chr(i+96)
def f(n,i):
global Ind
if n==0:
B.append("".join(A))
return
if n==1:
j = Ind.pop()
A[j] = g(i)
B.append("".join(A))
A[j]=0
Ind.append(j)
Ind = sorted(Ind)
... | from collections import deque
D1 = {i:chr(i+96) for i in range(1,27)}
D2 = {val:key for key,val in list(D1.items())}
N = int(eval(input()))
heap = deque([(D1[1],1)])
A = []
while heap:
a,n = heap.popleft()
if n<N:
imax = 0
for i in range(len(a)):
imax = max(imax,D2[a[i]]... | 43 | 20 | 945 | 497 | from itertools import combinations
def g(i):
return chr(i + 96)
def f(n, i):
global Ind
if n == 0:
B.append("".join(A))
return
if n == 1:
j = Ind.pop()
A[j] = g(i)
B.append("".join(A))
A[j] = 0
Ind.append(j)
Ind = sorted(Ind)
re... | from collections import deque
D1 = {i: chr(i + 96) for i in range(1, 27)}
D2 = {val: key for key, val in list(D1.items())}
N = int(eval(input()))
heap = deque([(D1[1], 1)])
A = []
while heap:
a, n = heap.popleft()
if n < N:
imax = 0
for i in range(len(a)):
imax = max(imax, D2[a[i]])... | false | 53.488372 | [
"-from itertools import combinations",
"+from collections import deque",
"-",
"-def g(i):",
"- return chr(i + 96)",
"-",
"-",
"-def f(n, i):",
"- global Ind",
"- if n == 0:",
"- B.append(\"\".join(A))",
"- return",
"- if n == 1:",
"- j = Ind.pop()",
"- ... | false | 0.082019 | 0.043395 | 1.890052 | [
"s972942550",
"s492426423"
] |
u620945921 | p03607 | python | s360939581 | s763741938 | 212 | 170 | 15,068 | 17,884 | Accepted | Accepted | 19.81 | n=int(eval(input()))
mydict={}
for i in range(n):
a=int(eval(input()))
if a in mydict:
if mydict[a]==1:
mydict[a]=0
else:
mydict[a]=1
else:
mydict[a]=1
#print(mydict)
mylist=list(mydict.values())
print((sum(mylist)))
| mydict={}
n=int(eval(input()))
#print(n,a)
for i in range(n):
a=eval(input())
if a in mydict:
del mydict[a]
else:
mydict[a]=1
print((len(mydict)))
| 17 | 12 | 250 | 164 | n = int(eval(input()))
mydict = {}
for i in range(n):
a = int(eval(input()))
if a in mydict:
if mydict[a] == 1:
mydict[a] = 0
else:
mydict[a] = 1
else:
mydict[a] = 1
# print(mydict)
mylist = list(mydict.values())
print((sum(mylist)))
| mydict = {}
n = int(eval(input()))
# print(n,a)
for i in range(n):
a = eval(input())
if a in mydict:
del mydict[a]
else:
mydict[a] = 1
print((len(mydict)))
| false | 29.411765 | [
"+mydict = {}",
"-mydict = {}",
"+# print(n,a)",
"- a = int(eval(input()))",
"+ a = eval(input())",
"- if mydict[a] == 1:",
"- mydict[a] = 0",
"- else:",
"- mydict[a] = 1",
"+ del mydict[a]",
"-# print(mydict)",
"-mylist = list(mydict.values())"... | false | 0.036333 | 0.036183 | 1.004128 | [
"s360939581",
"s763741938"
] |
u543954314 | p02624 | python | s845856091 | s996994173 | 1,220 | 31 | 9,084 | 9,348 | Accepted | Accepted | 97.46 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
ans = 0
... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
m = int((n+1)... | 20 | 26 | 440 | 620 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n = ni()
ans = 0
for i in ran... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n = ni()
m = int((n + 1) ** 0.5)
... | false | 23.076923 | [
"+ m = int((n + 1) ** 0.5)",
"+ u = n // (m + 1)",
"- for i in range(1, n + 1):",
"+ for i in range(1, u + 1):",
"+ for i in range(m, 0, -1):",
"+ v = n // i",
"+ ans += (v * (v + 1) - u * (u + 1)) // 2 * i * (i + 1) // 2",
"+ u = v"
] | false | 0.821259 | 0.037619 | 21.831185 | [
"s845856091",
"s996994173"
] |
u941438707 | p03659 | python | s488507713 | s311515669 | 167 | 149 | 30,424 | 30,372 | Accepted | Accepted | 10.78 | n,*a=list(map(int,open(0).read().split()))
ans=10**100
b=sum(a)
c=0
for i in a[:-1]:
c+=i
b-=i
ans=min(ans,abs(b-c))
print(ans) | n,*a=list(map(int,open(0).read().split()))
b=sum(a)
c=a[0]
ans=abs(2*c-b)
for i in a[1:-1]:
c+=i
ans=min(ans,abs(2*c-b))
print(ans) | 9 | 8 | 138 | 140 | n, *a = list(map(int, open(0).read().split()))
ans = 10**100
b = sum(a)
c = 0
for i in a[:-1]:
c += i
b -= i
ans = min(ans, abs(b - c))
print(ans)
| n, *a = list(map(int, open(0).read().split()))
b = sum(a)
c = a[0]
ans = abs(2 * c - b)
for i in a[1:-1]:
c += i
ans = min(ans, abs(2 * c - b))
print(ans)
| false | 11.111111 | [
"-ans = 10**100",
"-c = 0",
"-for i in a[:-1]:",
"+c = a[0]",
"+ans = abs(2 * c - b)",
"+for i in a[1:-1]:",
"- b -= i",
"- ans = min(ans, abs(b - c))",
"+ ans = min(ans, abs(2 * c - b))"
] | false | 0.044797 | 0.038214 | 1.172264 | [
"s488507713",
"s311515669"
] |
u493520238 | p03112 | python | s284546020 | s926817120 | 1,659 | 921 | 94,936 | 73,308 | Accepted | Accepted | 44.48 | import bisect
def main():
a,b,q = list(map(int, input().split()))
sl = [int(eval(input())) for _ in range(a)]
tl = [int(eval(input())) for _ in range(b)]
xl = [int(eval(input())) for _ in range(q)]
for x in xl:
ans = 10**11
curr_dist = 0
ind_s = bisect.bisect... | import bisect
import sys
input = sys.stdin.readline
def main():
a,b,q = list(map(int, input().split()))
sl = [int(eval(input())) for _ in range(a)]
tl = [int(eval(input())) for _ in range(b)]
xl = [int(eval(input())) for _ in range(q)]
for x in xl:
ans = 10**11
curr... | 48 | 50 | 1,557 | 1,597 | import bisect
def main():
a, b, q = list(map(int, input().split()))
sl = [int(eval(input())) for _ in range(a)]
tl = [int(eval(input())) for _ in range(b)]
xl = [int(eval(input())) for _ in range(q)]
for x in xl:
ans = 10**11
curr_dist = 0
ind_s = bisect.bisect_left(sl, x)
... | import bisect
import sys
input = sys.stdin.readline
def main():
a, b, q = list(map(int, input().split()))
sl = [int(eval(input())) for _ in range(a)]
tl = [int(eval(input())) for _ in range(b)]
xl = [int(eval(input())) for _ in range(q)]
for x in xl:
ans = 10**11
curr_dist = 0
... | false | 4 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.079177 | 0.112736 | 0.702317 | [
"s284546020",
"s926817120"
] |
u218843509 | p03027 | python | s285564490 | s467346541 | 1,781 | 1,240 | 44,820 | 45,060 | Accepted | Accepted | 30.38 | MOD = 1000003
q = int(eval(input()))
cumprod = [1]
for i in range(1, MOD):
cumprod.append((cumprod[-1] * i) % MOD)
def calc(l, r):
return (cumprod[r] * pow(cumprod[l-1], MOD-2, MOD)) % MOD
def solve(x, d, n):
if x == 0:
return 0
elif d == 0:
return pow(x, n, MOD)
else:
l = (x * pow(d, MOD-2,... | import sys
def input():
return sys.stdin.readline()[:-1]
MOD = 1000003
q = int(eval(input()))
cumprod = [1]
for i in range(1, MOD):
cumprod.append((cumprod[-1] * i) % MOD)
def calc(l, r):
return (cumprod[r] * pow(cumprod[l-1], MOD-2, MOD)) % MOD
def solve(x, d, n):
if x == 0:
return 0
elif d =... | 24 | 28 | 503 | 566 | MOD = 1000003
q = int(eval(input()))
cumprod = [1]
for i in range(1, MOD):
cumprod.append((cumprod[-1] * i) % MOD)
def calc(l, r):
return (cumprod[r] * pow(cumprod[l - 1], MOD - 2, MOD)) % MOD
def solve(x, d, n):
if x == 0:
return 0
elif d == 0:
return pow(x, n, MOD)
else:
... | import sys
def input():
return sys.stdin.readline()[:-1]
MOD = 1000003
q = int(eval(input()))
cumprod = [1]
for i in range(1, MOD):
cumprod.append((cumprod[-1] * i) % MOD)
def calc(l, r):
return (cumprod[r] * pow(cumprod[l - 1], MOD - 2, MOD)) % MOD
def solve(x, d, n):
if x == 0:
return ... | false | 14.285714 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+"
] | false | 0.544071 | 0.496539 | 1.095727 | [
"s285564490",
"s467346541"
] |
u908984540 | p02262 | python | s285181700 | s747433840 | 21,520 | 18,130 | 47,616 | 45,512 | Accepted | Accepted | 15.75 | # -*- coding:utf-8 -*-
import math
def insertion_sort(num_list, length, interval):
cnt = 0
for i in range(interval, length):
v = num_list[i]
j = i - interval
while j >= 0 and num_list[j] > v:
num_list[j+interval] = num_list[j]
j = j - interval
... | def insertion_sort(A, g):
cnt = 0
for i in range(g, len(A)):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j -= g
cnt += 1
A[j+g] = v
return cnt
def shell_sort(A):
cnt = 0
h = 1
G = []
while h ... | 36 | 37 | 927 | 724 | # -*- coding:utf-8 -*-
import math
def insertion_sort(num_list, length, interval):
cnt = 0
for i in range(interval, length):
v = num_list[i]
j = i - interval
while j >= 0 and num_list[j] > v:
num_list[j + interval] = num_list[j]
j = j - interval
cnt ... | def insertion_sort(A, g):
cnt = 0
for i in range(g, len(A)):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j + g] = A[j]
j -= g
cnt += 1
A[j + g] = v
return cnt
def shell_sort(A):
cnt = 0
h = 1
G = []
while h <= len(A) /... | false | 2.702703 | [
"-# -*- coding:utf-8 -*-",
"-import math",
"-",
"-",
"-def insertion_sort(num_list, length, interval):",
"+def insertion_sort(A, g):",
"- for i in range(interval, length):",
"- v = num_list[i]",
"- j = i - interval",
"- while j >= 0 and num_list[j] > v:",
"- nu... | false | 0.036091 | 0.057107 | 0.631979 | [
"s285181700",
"s747433840"
] |
u936985471 | p02883 | python | s043278129 | s506336357 | 1,829 | 454 | 122,700 | 37,220 | Accepted | Accepted | 75.18 | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a=sorted(a)[::-1]
f=sorted(f)
ok=10**18
ng=-1
import math
def isOK(val,arr,farr,k):
s=0
for i in range(len(arr)):
s+=max(math.ceil(a[i]-val/f[i]),0)
return s<=k
while abs(ok-ng)>1:
mi... | import numpy as np
n,k=list(map(int,input().split()))
a=np.array(input().split(),dtype=int)
f=np.array(input().split(),dtype=int)
a=np.sort(a)[::-1]
f=np.sort(f)
ok=10**18
ng=-1
import math
def isOK(val,arr,farr,k):
return arr.sum()-np.minimum(arr,val//farr).sum()<=k
while abs(ok-ng)>1:
mid=... | 25 | 24 | 403 | 401 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a = sorted(a)[::-1]
f = sorted(f)
ok = 10**18
ng = -1
import math
def isOK(val, arr, farr, k):
s = 0
for i in range(len(arr)):
s += max(math.ceil(a[i] - val / f[i]), 0)
return s <= k
wh... | import numpy as np
n, k = list(map(int, input().split()))
a = np.array(input().split(), dtype=int)
f = np.array(input().split(), dtype=int)
a = np.sort(a)[::-1]
f = np.sort(f)
ok = 10**18
ng = -1
import math
def isOK(val, arr, farr, k):
return arr.sum() - np.minimum(arr, val // farr).sum() <= k
while abs(ok - ... | false | 4 | [
"+import numpy as np",
"+",
"-a = list(map(int, input().split()))",
"-f = list(map(int, input().split()))",
"-a = sorted(a)[::-1]",
"-f = sorted(f)",
"+a = np.array(input().split(), dtype=int)",
"+f = np.array(input().split(), dtype=int)",
"+a = np.sort(a)[::-1]",
"+f = np.sort(f)",
"- s = 0"... | false | 0.085661 | 0.248671 | 0.344475 | [
"s043278129",
"s506336357"
] |
u796942881 | p02899 | python | s973809209 | s503840293 | 159 | 74 | 29,772 | 17,736 | Accepted | Accepted | 53.46 | from operator import itemgetter
def main():
A = {k + 1: v for k, v in enumerate(map(int, open(0).read().split()[1:]))}
# value `昇順
print((" ".join([str(i[0]) for i in sorted(list(A.items()), key=itemgetter(1))])))
return
main()
| def main():
N, *A = list(map(int, open(0).read().split()))
ans = [0] * N
for k, v in enumerate(A, 1):
ans[v - 1] = k
print((" ".join([str(a) for a in ans])))
return
main()
| 11 | 10 | 250 | 203 | from operator import itemgetter
def main():
A = {k + 1: v for k, v in enumerate(map(int, open(0).read().split()[1:]))}
# value `昇順
print((" ".join([str(i[0]) for i in sorted(list(A.items()), key=itemgetter(1))])))
return
main()
| def main():
N, *A = list(map(int, open(0).read().split()))
ans = [0] * N
for k, v in enumerate(A, 1):
ans[v - 1] = k
print((" ".join([str(a) for a in ans])))
return
main()
| false | 9.090909 | [
"-from operator import itemgetter",
"-",
"-",
"- A = {k + 1: v for k, v in enumerate(map(int, open(0).read().split()[1:]))}",
"- # value `昇順",
"- print((\" \".join([str(i[0]) for i in sorted(list(A.items()), key=itemgetter(1))])))",
"+ N, *A = list(map(int, open(0).read().split()))",
"+ ... | false | 0.035593 | 0.036896 | 0.964693 | [
"s973809209",
"s503840293"
] |
u698771758 | p02971 | python | s735092523 | s774738517 | 648 | 546 | 18,872 | 14,112 | Accepted | Accepted | 15.74 | N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
LM=[0,A[0]]
a=A[::-1]
RM=[a[0]]
for i in range(1,N-1):
LM.append(max(LM[-1],A[i]))
RM.append(max(RM[-1],a[i]))
RM=RM[::-1]+[0]
for i in range(N):
print((max(LM[i],RM[i]))) | N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
M=A[::-1]
M.sort()
for i in A:
if i==M[-1]:print((M[-2]))
else:print((M[-1])) | 11 | 7 | 241 | 137 | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
LM = [0, A[0]]
a = A[::-1]
RM = [a[0]]
for i in range(1, N - 1):
LM.append(max(LM[-1], A[i]))
RM.append(max(RM[-1], a[i]))
RM = RM[::-1] + [0]
for i in range(N):
print((max(LM[i], RM[i])))
| N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
M = A[::-1]
M.sort()
for i in A:
if i == M[-1]:
print((M[-2]))
else:
print((M[-1]))
| false | 36.363636 | [
"-LM = [0, A[0]]",
"-a = A[::-1]",
"-RM = [a[0]]",
"-for i in range(1, N - 1):",
"- LM.append(max(LM[-1], A[i]))",
"- RM.append(max(RM[-1], a[i]))",
"-RM = RM[::-1] + [0]",
"-for i in range(N):",
"- print((max(LM[i], RM[i])))",
"+M = A[::-1]",
"+M.sort()",
"+for i in A:",
"+ if i... | false | 0.087947 | 0.074393 | 1.182191 | [
"s735092523",
"s774738517"
] |
u744920373 | p02972 | python | s263505049 | s637940693 | 1,473 | 1,035 | 10,704 | 8,600 | Accepted | Accepted | 29.74 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | 39 | 29 | 1,009 | 859 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | false | 25.641026 | [
"-A_f = A[: N // 2]",
"-A_l = A[N // 2 :]",
"-table = [0] * (N // 2)",
"-for i in reversed(list(range(N // 2))):",
"- ind = i + 1",
"+for i in reversed(list(range(N))):",
"+ # for i in reversed(range(N//2)):",
"+ ind = 2 * (i + 1)",
"- if ind - 1 < N // 2 and ind != i + 1:",
"- ... | false | 0.081014 | 0.03718 | 2.178947 | [
"s263505049",
"s637940693"
] |
u225388820 | p02806 | python | s324271590 | s300483007 | 170 | 17 | 38,256 | 3,060 | Accepted | Accepted | 90 | n=int(eval(input()))
s=[0]*n
t=[0]*n
for i in range(n):
a,b=input().split()
b=int(b)
s[i]=a
t[i]=b
x=eval(input())
ans=sum(t)
for i in range(n):
if s[i]==x:
print((ans-t[i]))
exit()
else:
ans-=t[i] | n=int(eval(input()))
s=[0]*n
t=[0]*n
for i in range(n):
s[i],t[i]=input().split()
t[i]=int(t[i])
print((sum(t[s.index(eval(input()))+1:]))) | 16 | 7 | 246 | 139 | n = int(eval(input()))
s = [0] * n
t = [0] * n
for i in range(n):
a, b = input().split()
b = int(b)
s[i] = a
t[i] = b
x = eval(input())
ans = sum(t)
for i in range(n):
if s[i] == x:
print((ans - t[i]))
exit()
else:
ans -= t[i]
| n = int(eval(input()))
s = [0] * n
t = [0] * n
for i in range(n):
s[i], t[i] = input().split()
t[i] = int(t[i])
print((sum(t[s.index(eval(input())) + 1 :])))
| false | 56.25 | [
"- a, b = input().split()",
"- b = int(b)",
"- s[i] = a",
"- t[i] = b",
"-x = eval(input())",
"-ans = sum(t)",
"-for i in range(n):",
"- if s[i] == x:",
"- print((ans - t[i]))",
"- exit()",
"- else:",
"- ans -= t[i]",
"+ s[i], t[i] = input().split()"... | false | 0.036856 | 0.034505 | 1.068139 | [
"s324271590",
"s300483007"
] |
u952708174 | p02732 | python | s523589415 | s261631239 | 888 | 205 | 39,480 | 39,300 | Accepted | Accepted | 76.91 | from functools import reduce
def d_banned_k():
from collections import Counter
from functools import reduce
N = int(eval(input()))
A = [int(i) for i in input().split()]
def comb(n, r):
numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1)))
denominator = reduce(lam... | def d_banned_k():
from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
count = Counter(A)
total = sum(c * (c - 1) // 2 for c in list(count.values()))
ans = [total - (count[a] - 1) for a in A]
return ' '.join(map(str, ans))
print((d_banned... | 21 | 12 | 603 | 312 | from functools import reduce
def d_banned_k():
from collections import Counter
from functools import reduce
N = int(eval(input()))
A = [int(i) for i in input().split()]
def comb(n, r):
numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1)))
denominator = reduce(lambda x... | def d_banned_k():
from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
count = Counter(A)
total = sum(c * (c - 1) // 2 for c in list(count.values()))
ans = [total - (count[a] - 1) for a in A]
return " ".join(map(str, ans))
print((d_banned_k()))
| false | 42.857143 | [
"-from functools import reduce",
"-",
"-",
"- from functools import reduce",
"-",
"- def comb(n, r):",
"- numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1)))",
"- denominator = reduce(lambda x, y: x * y, list(range(1, r + 1)))",
"- return numerator // denomin... | false | 0.039855 | 0.040098 | 0.993952 | [
"s523589415",
"s261631239"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.