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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u912237403 | p00076 | python | s523626125 | s096294964 | 20 | 10 | 4,440 | 4,440 | Accepted | Accepted | 50 | A=[[]]*1001
x=1.0
y=0.0
for i in range(1,1001):
A[i]=[x,y]
tmp=i**.5
x,y=x-y/tmp,y+x/tmp
while 1:
n = eval(input())
if n==-1:break
print(A[n][0])
print(A[n][1]) | N=1001
A=[[]]*N
x=1.0
y=0.0
for i in range(1,N):
A[i]=[x,y]
tmp=i**.5
x,y=x-y/tmp,y+x/tmp
while 1:
n = eval(input())
if n==-1:break
a,b=A[n]
print(a,b) | 13 | 14 | 194 | 187 | A = [[]] * 1001
x = 1.0
y = 0.0
for i in range(1, 1001):
A[i] = [x, y]
tmp = i**0.5
x, y = x - y / tmp, y + x / tmp
while 1:
n = eval(input())
if n == -1:
break
print(A[n][0])
print(A[n][1])
| N = 1001
A = [[]] * N
x = 1.0
y = 0.0
for i in range(1, N):
A[i] = [x, y]
tmp = i**0.5
x, y = x - y / tmp, y + x / tmp
while 1:
n = eval(input())
if n == -1:
break
a, b = A[n]
print(a, b)
| false | 7.142857 | [
"-A = [[]] * 1001",
"+N = 1001",
"+A = [[]] * N",
"-for i in range(1, 1001):",
"+for i in range(1, N):",
"- print(A[n][0])",
"- print(A[n][1])",
"+ a, b = A[n]",
"+ print(a, b)"
] | false | 0.036927 | 0.043583 | 0.847284 | [
"s523626125",
"s096294964"
] |
u777283665 | p03578 | python | s980813511 | s843994608 | 291 | 224 | 67,412 | 46,432 | Accepted | Accepted | 23.02 | n = int(eval(input()))
x = dict()
for i in input().split():
x[i] = x.get(i, 0) + 1
m = int(eval(input()))
y = dict()
for i in input().split():
y[i] = y.get(i, 0) + 1
for i, j in list(y.items()):
if x.get(i, 0) < j:
print("NO")
exit()
print("YES") | n = int(eval(input()))
x = dict()
for i in input().split():
x[i] = x.get(i, 0) + 1
m = int(eval(input()))
for i in input().split():
if i not in x or x[i] == 0:
print("NO")
exit()
else:
x[i] -= 1
print("YES") | 17 | 15 | 276 | 248 | n = int(eval(input()))
x = dict()
for i in input().split():
x[i] = x.get(i, 0) + 1
m = int(eval(input()))
y = dict()
for i in input().split():
y[i] = y.get(i, 0) + 1
for i, j in list(y.items()):
if x.get(i, 0) < j:
print("NO")
exit()
print("YES")
| n = int(eval(input()))
x = dict()
for i in input().split():
x[i] = x.get(i, 0) + 1
m = int(eval(input()))
for i in input().split():
if i not in x or x[i] == 0:
print("NO")
exit()
else:
x[i] -= 1
print("YES")
| false | 11.764706 | [
"-y = dict()",
"- y[i] = y.get(i, 0) + 1",
"-for i, j in list(y.items()):",
"- if x.get(i, 0) < j:",
"+ if i not in x or x[i] == 0:",
"+ else:",
"+ x[i] -= 1"
] | false | 0.043429 | 0.007744 | 5.607808 | [
"s980813511",
"s843994608"
] |
u211160392 | p03142 | python | s304797889 | s877063471 | 782 | 542 | 82,096 | 23,840 | Accepted | Accepted | 30.69 | from collections import deque
N, M = list(map(int,input().split()))
count = [0]*N
side = [[]for i in range(N)]
rside = [[]for i in range(N)]
for i in range(N+M-1):
a,b = list(map(int,input().split()))
side[a-1].append(b-1)
rside[b-1].append(a-1)
count[b-1] += 1
root = count.index(0)
queue... | from collections import deque
N,M = list(map(int,input().split()))
side = [[]for _ in range(N)]
counts = [0]*N
ans = [0]*N
for i in range(N+M-1):
a,b = list(map(int,input().split()))
side[a-1].append(b-1)
counts[b-1]+=1
queue = deque([counts.index(0)])
while queue:
q = queue.popleft()
... | 32 | 22 | 693 | 465 | from collections import deque
N, M = list(map(int, input().split()))
count = [0] * N
side = [[] for i in range(N)]
rside = [[] for i in range(N)]
for i in range(N + M - 1):
a, b = list(map(int, input().split()))
side[a - 1].append(b - 1)
rside[b - 1].append(a - 1)
count[b - 1] += 1
root = count.index(0... | from collections import deque
N, M = list(map(int, input().split()))
side = [[] for _ in range(N)]
counts = [0] * N
ans = [0] * N
for i in range(N + M - 1):
a, b = list(map(int, input().split()))
side[a - 1].append(b - 1)
counts[b - 1] += 1
queue = deque([counts.index(0)])
while queue:
q = queue.poplef... | false | 31.25 | [
"-count = [0] * N",
"-side = [[] for i in range(N)]",
"-rside = [[] for i in range(N)]",
"+side = [[] for _ in range(N)]",
"+counts = [0] * N",
"+ans = [0] * N",
"- rside[b - 1].append(a - 1)",
"- count[b - 1] += 1",
"-root = count.index(0)",
"-queue = deque([root])",
"-top = [0] * N",
"... | false | 0.129709 | 0.035856 | 3.617546 | [
"s304797889",
"s877063471"
] |
u077291787 | p03331 | python | s917753748 | s300424462 | 141 | 17 | 3,060 | 2,940 | Accepted | Accepted | 87.94 | # AGC025A - Digits Sum
def main():
n = int(eval(input()))
ans = float("inf")
for i in range(1, n // 2 + 1):
j = n - i
ds = sum(map(int, str(i))) + sum(map(int, str(j))) # digits sum
ans = min(ans, ds)
print(ans)
if __name__ == "__main__":
main() | # AGC025A - Digits Sum
# Better ver.
def main():
n = int(eval(input()))
ans = sum(map(int, str(n))) # ds: digit sum
print((ans if ans != 1 else 10))
if __name__ == "__main__":
main() | 13 | 10 | 298 | 202 | # AGC025A - Digits Sum
def main():
n = int(eval(input()))
ans = float("inf")
for i in range(1, n // 2 + 1):
j = n - i
ds = sum(map(int, str(i))) + sum(map(int, str(j))) # digits sum
ans = min(ans, ds)
print(ans)
if __name__ == "__main__":
main()
| # AGC025A - Digits Sum
# Better ver.
def main():
n = int(eval(input()))
ans = sum(map(int, str(n))) # ds: digit sum
print((ans if ans != 1 else 10))
if __name__ == "__main__":
main()
| false | 23.076923 | [
"+# Better ver.",
"- ans = float(\"inf\")",
"- for i in range(1, n // 2 + 1):",
"- j = n - i",
"- ds = sum(map(int, str(i))) + sum(map(int, str(j))) # digits sum",
"- ans = min(ans, ds)",
"- print(ans)",
"+ ans = sum(map(int, str(n))) # ds: digit sum",
"+ print(... | false | 0.187603 | 0.100737 | 1.862301 | [
"s917753748",
"s300424462"
] |
u006880673 | p02579 | python | s076779132 | s938866924 | 1,413 | 734 | 124,884 | 159,840 | Accepted | Accepted | 48.05 | import heapq
INF = 1e7
def main():
H,W=list(map(int, input().split()))
sx, sy = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
sx -= 1
sy -= 1
S = [eval(input()) for _ in range(H)]
def dijkstra(sx, sy):
D = [[INF]*(W) for _ in range(H)] #始点からの距離(重み... | from itertools import product
from collections import deque
INF = 1e7
def main():
H, W = list(map(int, input().split()))
ch, cw = [int(x)+1 for x in input().split()]
dh, dw = [int(x)+1 for x in input().split()]
S = [["#"]*(W+4) for _ in range(H+4)]
whites = [] # 道であるindex
for i in range... | 37 | 79 | 1,383 | 2,518 | import heapq
INF = 1e7
def main():
H, W = list(map(int, input().split()))
sx, sy = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
sx -= 1
sy -= 1
S = [eval(input()) for _ in range(H)]
def dijkstra(sx, sy):
D = [[INF] * (W) for _ in range(H)] # 始点からの距離(重... | from itertools import product
from collections import deque
INF = 1e7
def main():
H, W = list(map(int, input().split()))
ch, cw = [int(x) + 1 for x in input().split()]
dh, dw = [int(x) + 1 for x in input().split()]
S = [["#"] * (W + 4) for _ in range(H + 4)]
whites = [] # 道であるindex
for i in... | false | 53.164557 | [
"-import heapq",
"+from itertools import product",
"+from collections import deque",
"- sx, sy = list(map(int, input().split()))",
"- dh, dw = list(map(int, input().split()))",
"- sx -= 1",
"- sy -= 1",
"- S = [eval(input()) for _ in range(H)]",
"+ ch, cw = [int(x) + 1 for x in inp... | false | 0.223185 | 0.060668 | 3.678776 | [
"s076779132",
"s938866924"
] |
u561083515 | p02947 | python | s969015861 | s825123918 | 1,588 | 587 | 41,012 | 22,372 | Accepted | Accepted | 63.04 | from collections import Counter,defaultdict
import sys
input = sys.stdin.readline
N = int(eval(input()))
s = [None] + [list(eval(input())) for _ in range(N)]
count = defaultdict(int)
answer = 0
for i in range(1,N+1):
c = Counter(s[i])
c = sorted(list(c.items()), key=lambda x:x[0])
# O(len(c)... | from collections import defaultdict
N = int(eval(input()))
cnt = defaultdict(int)
ans = 0
for _ in range(N):
s = list(eval(input()))
s.sort()
s = str(s)
ans += cnt[s]
cnt[s] += 1
print(ans) | 21 | 15 | 438 | 215 | from collections import Counter, defaultdict
import sys
input = sys.stdin.readline
N = int(eval(input()))
s = [None] + [list(eval(input())) for _ in range(N)]
count = defaultdict(int)
answer = 0
for i in range(1, N + 1):
c = Counter(s[i])
c = sorted(list(c.items()), key=lambda x: x[0])
# O(len(c))
str_... | from collections import defaultdict
N = int(eval(input()))
cnt = defaultdict(int)
ans = 0
for _ in range(N):
s = list(eval(input()))
s.sort()
s = str(s)
ans += cnt[s]
cnt[s] += 1
print(ans)
| false | 28.571429 | [
"-from collections import Counter, defaultdict",
"-import sys",
"+from collections import defaultdict",
"-input = sys.stdin.readline",
"-s = [None] + [list(eval(input())) for _ in range(N)]",
"-count = defaultdict(int)",
"-answer = 0",
"-for i in range(1, N + 1):",
"- c = Counter(s[i])",
"- ... | false | 0.035901 | 0.033789 | 1.062492 | [
"s969015861",
"s825123918"
] |
u462329577 | p03427 | python | s507263522 | s819475787 | 166 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.16 | #!/usr/bin/env python3
s = eval(input())
digit = len(s)
if s[1:] == "9"*(digit-1):
print((int(s[0])+9*(digit-1)))
else:
print((int(s[0])+9*(digit-1)-1)) | s = eval(input())
if len(s) == 1: print((int(s[0])))
elif s[1:] == "9"*(len(s)-1):
print((int(s[0])+9*len(s)-9))
else:
print((int(s[0])+9*len(s)-10))
| 7 | 6 | 156 | 184 | #!/usr/bin/env python3
s = eval(input())
digit = len(s)
if s[1:] == "9" * (digit - 1):
print((int(s[0]) + 9 * (digit - 1)))
else:
print((int(s[0]) + 9 * (digit - 1) - 1))
| s = eval(input())
if len(s) == 1:
print((int(s[0])))
elif s[1:] == "9" * (len(s) - 1):
print((int(s[0]) + 9 * len(s) - 9))
else:
print((int(s[0]) + 9 * len(s) - 10))
| false | 14.285714 | [
"-#!/usr/bin/env python3",
"-digit = len(s)",
"-if s[1:] == \"9\" * (digit - 1):",
"- print((int(s[0]) + 9 * (digit - 1)))",
"+if len(s) == 1:",
"+ print((int(s[0])))",
"+elif s[1:] == \"9\" * (len(s) - 1):",
"+ print((int(s[0]) + 9 * len(s) - 9))",
"- print((int(s[0]) + 9 * (digit - 1) ... | false | 0.121369 | 0.042435 | 2.860109 | [
"s507263522",
"s819475787"
] |
u815763296 | p02713 | python | s491146072 | s265019893 | 1,284 | 511 | 9,052 | 68,880 | Accepted | Accepted | 60.2 | import math
K = int(eval(input()))
total = 0
for x in range(1, K+1):
for y in range(1, K+1):
a=math.gcd(x, y)
for z in range(1, K+1):
total = total+math.gcd(z, a)
print(total)
| import math
K = int(eval(input()))
total = 0
for x in range(1, K+1):
for y in range(1, K+1):
for z in range(1, K+1):
total = total+math.gcd(x, math.gcd(y, z))
print(total)
| 9 | 8 | 210 | 197 | import math
K = int(eval(input()))
total = 0
for x in range(1, K + 1):
for y in range(1, K + 1):
a = math.gcd(x, y)
for z in range(1, K + 1):
total = total + math.gcd(z, a)
print(total)
| import math
K = int(eval(input()))
total = 0
for x in range(1, K + 1):
for y in range(1, K + 1):
for z in range(1, K + 1):
total = total + math.gcd(x, math.gcd(y, z))
print(total)
| false | 11.111111 | [
"- a = math.gcd(x, y)",
"- total = total + math.gcd(z, a)",
"+ total = total + math.gcd(x, math.gcd(y, z))"
] | false | 0.165575 | 0.149852 | 1.104926 | [
"s491146072",
"s265019893"
] |
u699089116 | p02945 | python | s117911733 | s097600926 | 169 | 132 | 38,384 | 61,600 | Accepted | Accepted | 21.89 | a, b = list(map(int, input().split()))
print((max(a+b, a-b, a*b))) | a, b = list(map(int, input().split()))
print((max([a+b, a-b, a*b]))) | 3 | 3 | 61 | 63 | a, b = list(map(int, input().split()))
print((max(a + b, a - b, a * b)))
| a, b = list(map(int, input().split()))
print((max([a + b, a - b, a * b])))
| false | 0 | [
"-print((max(a + b, a - b, a * b)))",
"+print((max([a + b, a - b, a * b])))"
] | false | 0.036984 | 0.170292 | 0.217179 | [
"s117911733",
"s097600926"
] |
u144913062 | p02955 | python | s700446557 | s689547908 | 410 | 260 | 53,980 | 41,820 | Accepted | Accepted | 36.59 | from heapq import heapify, heappush, heappop
def divisor(n):
divisors = []
i = 1
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i != n / i:
divisors.append(n // i)
i += 1
divisors.sort()
return divisors
N, K = list(map... | def divisor(n):
divisors = []
i = 1
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i * i < n:
divisors.append(n // i)
i += 1
divisors.sort()
return divisors
N, K = list(map(int, input().split()))
A = list(map(int, input(... | 39 | 23 | 875 | 522 | from heapq import heapify, heappush, heappop
def divisor(n):
divisors = []
i = 1
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i != n / i:
divisors.append(n // i)
i += 1
divisors.sort()
return divisors
N, K = list(map(int, input().... | def divisor(n):
divisors = []
i = 1
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i * i < n:
divisors.append(n // i)
i += 1
divisors.sort()
return divisors
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
di... | false | 41.025641 | [
"-from heapq import heapify, heappush, heappop",
"-",
"-",
"- if i != n / i:",
"+ if i * i < n:",
"- heap = []",
"- s = 0",
"- for a in A:",
"- x = a // d * d - a",
"- heap.append(x)",
"- s += -x",
"- heapify(heap)",
"- n = 0",
"- ... | false | 0.042064 | 0.038327 | 1.097492 | [
"s700446557",
"s689547908"
] |
u262869085 | p03147 | python | s919617603 | s274267733 | 47 | 37 | 3,060 | 3,060 | Accepted | Accepted | 21.28 | N =int(eval(input()))
l =[int(i)for i in input().split()]
min = []
max = []
ans =0
while l !=[0]*N:
ans += 1
s =False
for i,j in enumerate(l):
if s:
if j == 0:
break
if j !=0:
s =True
l[i]-=1
print(ans)
| def f(l):
sta = True
for i,j in enumerate(l):
if sta:
if j!=0:
sta=False
l[i]-=1
else:
if j==0:
break
else:
l[i]-=1
return l
N =int(eval(input()))
h =[int(i) for i in input... | 17 | 23 | 294 | 386 | N = int(eval(input()))
l = [int(i) for i in input().split()]
min = []
max = []
ans = 0
while l != [0] * N:
ans += 1
s = False
for i, j in enumerate(l):
if s:
if j == 0:
break
if j != 0:
s = True
l[i] -= 1
print(ans)
| def f(l):
sta = True
for i, j in enumerate(l):
if sta:
if j != 0:
sta = False
l[i] -= 1
else:
if j == 0:
break
else:
l[i] -= 1
return l
N = int(eval(input()))
h = [int(i) for i in input().sp... | false | 26.086957 | [
"-N = int(eval(input()))",
"-l = [int(i) for i in input().split()]",
"-min = []",
"-max = []",
"-ans = 0",
"-while l != [0] * N:",
"- ans += 1",
"- s = False",
"+def f(l):",
"+ sta = True",
"- if s:",
"+ if sta:",
"+ if j != 0:",
"+ sta = Fa... | false | 0.045351 | 0.126677 | 0.358004 | [
"s919617603",
"s274267733"
] |
u077291787 | p03593 | python | s635792707 | s696319772 | 22 | 18 | 3,316 | 3,064 | Accepted | Accepted | 18.18 | # code-festival-2017-qualaC - Palindromic Matrix
from collections import defaultdict
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), defaultdict(int)
for i in "".join(A):
C[i] += 1
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 els... | # code-festival-2017-qualaC - Palindromic Matrix
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), {}
for i in "".join(A):
if i not in C:
C[i] = 0
C[i] += 1
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
... | 18 | 17 | 530 | 521 | # code-festival-2017-qualaC - Palindromic Matrix
from collections import defaultdict
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), defaultdict(int)
for i in "".join(A):
C[i] += 1
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
C... | # code-festival-2017-qualaC - Palindromic Matrix
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), {}
for i in "".join(A):
if i not in C:
C[i] = 0
C[i] += 1
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
C_mod4 = ... | false | 5.555556 | [
"-from collections import defaultdict",
"-",
"-",
"- H, W, C = int(H), int(W), defaultdict(int)",
"+ H, W, C = int(H), int(W), {}",
"+ if i not in C:",
"+ C[i] = 0"
] | false | 0.035749 | 0.035703 | 1.001291 | [
"s635792707",
"s696319772"
] |
u968846084 | p02679 | python | s063816635 | s586860272 | 1,085 | 763 | 169,444 | 180,044 | Accepted | Accepted | 29.68 | import collections
n=int(eval(input()))
A=[]
AA=[]
B=[]
C=[]
X=[]
mod=10**9+7
p=137053438808121949
for i in range(n):
a,b=list(map(int,input().split()))
if a<0:
a=a*-1
b=b*-1
if a*b>0:
A.append(b*pow(a,p-2,p)%p)
elif a*b<0:
AA.append(a*pow((-b),p-2,p)%p)
else:
if a==0 an... | from math import gcd
from collections import defaultdict
n=int(eval(input()))
A=defaultdict(int)
AA=defaultdict(int)
B=[]
C=[]
X=[]
mod=10**9+7
for i in range(n):
a,b=list(map(int,input().split()))
if a<0:
a=a*-1
b=b*-1
if a*b>0:
l=a*b//gcd(a,b)
A[str(l//b)+":"+str(l//a)]+=1
eli... | 33 | 33 | 590 | 647 | import collections
n = int(eval(input()))
A = []
AA = []
B = []
C = []
X = []
mod = 10**9 + 7
p = 137053438808121949
for i in range(n):
a, b = list(map(int, input().split()))
if a < 0:
a = a * -1
b = b * -1
if a * b > 0:
A.append(b * pow(a, p - 2, p) % p)
elif a * b < 0:
... | from math import gcd
from collections import defaultdict
n = int(eval(input()))
A = defaultdict(int)
AA = defaultdict(int)
B = []
C = []
X = []
mod = 10**9 + 7
for i in range(n):
a, b = list(map(int, input().split()))
if a < 0:
a = a * -1
b = b * -1
if a * b > 0:
l = a * b // gcd(a,... | false | 0 | [
"-import collections",
"+from math import gcd",
"+from collections import defaultdict",
"-A = []",
"-AA = []",
"+A = defaultdict(int)",
"+AA = defaultdict(int)",
"-p = 137053438808121949",
"- A.append(b * pow(a, p - 2, p) % p)",
"+ l = a * b // gcd(a, b)",
"+ A[str(l // b) +... | false | 0.044877 | 0.045022 | 0.99678 | [
"s063816635",
"s586860272"
] |
u102461423 | p02604 | python | s797913798 | s955543275 | 1,901 | 1,308 | 36,416 | 111,880 | Accepted | Accepted | 31.19 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(XYP):
X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
N = len(X)
dp_X = np.empty((1 << N, N), np.int64) # 建設、人 -> Xコスト
dp_X[0] = np.abs(X) * P
for n... | import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:], i8[:]), cache=True)
def f(X, P):
INF = 10**18
ind = np.argsort(X)
X, P = X[ind], P[ind]
... | 60 | 73 | 1,587 | 2,114 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(XYP):
X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
N = len(X)
dp_X = np.empty((1 << N, N), np.int64) # 建設、人 -> Xコスト
dp_X[0] = np.abs(X) * P
for n in range(N... | import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:], i8[:]), cache=True)
def f(X, P):
INF = 10**18
ind = np.argsort(X)
X, P = X[ind], P[ind]
N = len(X)
... | false | 17.808219 | [
"+import numba",
"+from numba import njit",
"+i8 = numba.int64",
"+@njit((i8[:], i8[:]), cache=True)",
"+def f(X, P):",
"+ INF = 10**18",
"+ ind = np.argsort(X)",
"+ X, P = X[ind], P[ind]",
"+ N = len(X)",
"+ if N == 0:",
"+ return np.array([0], np.int64)",
"+ # [0, i)... | false | 0.498015 | 0.242792 | 2.0512 | [
"s797913798",
"s955543275"
] |
u678167152 | p03244 | python | s818984659 | s944128181 | 95 | 83 | 16,100 | 25,256 | Accepted | Accepted | 12.63 | n = int(eval(input()))
v = list(map(int, input().split()))
from collections import Counter
def minus(lis):
if len(set(lis))==1:
return lis[0], 0, 10**9
c = Counter(lis)
f_key = max(c, key=c.get)
second,first = sorted(c.values())[-2:]
return f_key,len(lis)-first,len(lis)-second
... | from collections import Counter
def solve():
ans = 0
N = int(eval(input()))
V = list(map(int, input().split()))
V1 = [V[i] for i in range(0,N,2)]
V2 = [V[i] for i in range(1,N,2)]
v1 = Counter(V1)
v2 = Counter(V2)
v1 = sorted(list(v1.items()),key=lambda x:-x[1])
v2 = sorted(list(v2.items()),... | 26 | 23 | 731 | 628 | n = int(eval(input()))
v = list(map(int, input().split()))
from collections import Counter
def minus(lis):
if len(set(lis)) == 1:
return lis[0], 0, 10**9
c = Counter(lis)
f_key = max(c, key=c.get)
second, first = sorted(c.values())[-2:]
return f_key, len(lis) - first, len(lis) - second
d... | from collections import Counter
def solve():
ans = 0
N = int(eval(input()))
V = list(map(int, input().split()))
V1 = [V[i] for i in range(0, N, 2)]
V2 = [V[i] for i in range(1, N, 2)]
v1 = Counter(V1)
v2 = Counter(V2)
v1 = sorted(list(v1.items()), key=lambda x: -x[1])
v2 = sorted(l... | false | 11.538462 | [
"-n = int(eval(input()))",
"-v = list(map(int, input().split()))",
"-def minus(lis):",
"- if len(set(lis)) == 1:",
"- return lis[0], 0, 10**9",
"- c = Counter(lis)",
"- f_key = max(c, key=c.get)",
"- second, first = sorted(c.values())[-2:]",
"- return f_key, len(lis) - first, l... | false | 0.048864 | 0.142556 | 0.342772 | [
"s818984659",
"s944128181"
] |
u893063840 | p03722 | python | s522420651 | s938098895 | 1,410 | 1,235 | 3,572 | 3,572 | Accepted | Accepted | 12.41 | n, m = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
def bellman_ford(s, g):
dist = [float("inf")] * n
dist[s] = 0
negative = [False] * n
for i in range(2 * n):
for a, b, c in abc:
a -= 1
b -= 1
c = -c
if dist[b] > dist[a] + c:
dist[b] ... | n, m = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
def bellman_ford(s, g):
# loop 0 - (n-1) : bellman ford
# loop n - (2n-1): check g can be updated
dist = [float("inf")] * n
dist[s] = 0
for i in range(2 * n):
for a, b, c in abc:
a -= 1
b -= 1
... | 30 | 31 | 493 | 564 | n, m = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
def bellman_ford(s, g):
dist = [float("inf")] * n
dist[s] = 0
negative = [False] * n
for i in range(2 * n):
for a, b, c in abc:
a -= 1
b -= 1
c = -c
... | n, m = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
def bellman_ford(s, g):
# loop 0 - (n-1) : bellman ford
# loop n - (2n-1): check g can be updated
dist = [float("inf")] * n
dist[s] = 0
for i in range(2 * n):
for a, b, c in abc:
a ... | false | 3.225806 | [
"+ # loop 0 - (n-1) : bellman ford",
"+ # loop n - (2n-1): check g can be updated",
"- negative = [False] * n",
"- negative[b] = True",
"- if negative[g]:",
"+ dist[b] = -float(\"inf\")",
"+ if dist[g] == -float(\"inf\"):"
] | false | 0.142724 | 0.046366 | 3.078184 | [
"s522420651",
"s938098895"
] |
u682672120 | p03044 | python | s595146867 | s642724710 | 544 | 368 | 97,632 | 95,776 | Accepted | Accepted | 32.35 | import queue
n = int(eval(input()))
node = [[] for _ in range(n)]
color = [-1] * n
color[0] = 0
for _ in range(n-1):
u, v, w = list(map(int, input().split()))
node[u-1].append((v-1, w))
node[v-1].append((u-1, w))
q = queue.Queue()
q.put(0)
while not q.empty():
i = q.get()
c = co... | from collections import deque
n = int(eval(input()))
tree = [[] for _ in range(n)]
for _ in range(n-1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
tree[u].append((v, w % 2))
tree[v].append((u, w % 2))
q = deque()
q.append(0)
color = [-1] * n
color[0] = 0
while q:
v... | 26 | 25 | 484 | 497 | import queue
n = int(eval(input()))
node = [[] for _ in range(n)]
color = [-1] * n
color[0] = 0
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
node[u - 1].append((v - 1, w))
node[v - 1].append((u - 1, w))
q = queue.Queue()
q.put(0)
while not q.empty():
i = q.get()
c = color[i]
... | from collections import deque
n = int(eval(input()))
tree = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
tree[u].append((v, w % 2))
tree[v].append((u, w % 2))
q = deque()
q.append(0)
color = [-1] * n
color[0] = 0
while q:
v = q.popleft()
... | false | 3.846154 | [
"-import queue",
"+from collections import deque",
"-node = [[] for _ in range(n)]",
"+tree = [[] for _ in range(n)]",
"+for _ in range(n - 1):",
"+ u, v, w = list(map(int, input().split()))",
"+ u -= 1",
"+ v -= 1",
"+ tree[u].append((v, w % 2))",
"+ tree[v].append((u, w % 2))",
... | false | 0.07 | 0.03512 | 1.993182 | [
"s595146867",
"s642724710"
] |
u784022244 | p02845 | python | s921174431 | s591372648 | 130 | 87 | 20,708 | 85,324 | Accepted | Accepted | 33.08 | N=int(eval(input()))
A=list(map(int, input().split()))
mod=10**9+7
if A[0]!=0:
print((0))
exit()
L=[1,0,0]
ans=3
for i in range(1,N):
a=A[i]
count=0
add=True
for j,l in enumerate(L):
if a==l:
count+=1
if add:
L[j]+=1
... | N=int(eval(input()))
A=list(map(int, input().split()))
p=10**9+7
if A[0]!=0:
print((0))
exit()
dp=[0]*N
dp[0]=3
counts=[0]*N #前が何人か(自分が*人目)
counts[0]=1
for i in range(1,N):
a=A[i]
if a==0:
dp[i]=(dp[i-1]*(3 - counts[a]))%p
else:
dp[i]=(dp[i-1]*(counts[a-1] - counts... | 23 | 24 | 379 | 373 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
if A[0] != 0:
print((0))
exit()
L = [1, 0, 0]
ans = 3
for i in range(1, N):
a = A[i]
count = 0
add = True
for j, l in enumerate(L):
if a == l:
count += 1
if add:
L[j] += 1
... | N = int(eval(input()))
A = list(map(int, input().split()))
p = 10**9 + 7
if A[0] != 0:
print((0))
exit()
dp = [0] * N
dp[0] = 3
counts = [0] * N # 前が何人か(自分が*人目)
counts[0] = 1
for i in range(1, N):
a = A[i]
if a == 0:
dp[i] = (dp[i - 1] * (3 - counts[a])) % p
else:
dp[i] = (dp[i - 1]... | false | 4.166667 | [
"-mod = 10**9 + 7",
"+p = 10**9 + 7",
"-L = [1, 0, 0]",
"-ans = 3",
"+dp = [0] * N",
"+dp[0] = 3",
"+counts = [0] * N # 前が何人か(自分が*人目)",
"+counts[0] = 1",
"- count = 0",
"- add = True",
"- for j, l in enumerate(L):",
"- if a == l:",
"- count += 1",
"- ... | false | 0.106731 | 0.042559 | 2.507847 | [
"s921174431",
"s591372648"
] |
u810356688 | p03196 | python | s028430971 | s109404439 | 230 | 179 | 13,188 | 38,512 | Accepted | Accepted | 22.17 | import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def prime_fact(m):
pf={}
for i in range(2,int(m**0.5)+1):
while m%i==0:
pf[i]=pf.get(i,0)+1
m//=i
if m>1:pf[m]=1
return pf
def main():
n,p=list(map(int,input().split()))
p... | import sys
def input(): return sys.stdin.readline().rstrip()
def prime_fact(m):
pf={}
for i in range(2,int(m**0.5)+1):
while m%i==0:
pf[i]=pf.get(i,0)+1
m//=i
if m>1:pf[m]=1
return pf
def main():
n,p=list(map(int,input().split()))
p_dict=prime_fact(p)
... | 22 | 21 | 465 | 445 | import sys
def input():
return sys.stdin.readline().rstrip()
import numpy as np
def prime_fact(m):
pf = {}
for i in range(2, int(m**0.5) + 1):
while m % i == 0:
pf[i] = pf.get(i, 0) + 1
m //= i
if m > 1:
pf[m] = 1
return pf
def main():
n, p = list(... | import sys
def input():
return sys.stdin.readline().rstrip()
def prime_fact(m):
pf = {}
for i in range(2, int(m**0.5) + 1):
while m % i == 0:
pf[i] = pf.get(i, 0) + 1
m //= i
if m > 1:
pf[m] = 1
return pf
def main():
n, p = list(map(int, input().spli... | false | 4.545455 | [
"-",
"-",
"-import numpy as np"
] | false | 0.032737 | 0.033333 | 0.98211 | [
"s028430971",
"s109404439"
] |
u977389981 | p03000 | python | s924289848 | s192334612 | 189 | 17 | 38,384 | 2,940 | Accepted | Accepted | 91.01 | import bisect
N, X = list(map(int, input().split()))
L = [int(i) for i in input().split()]
D = [0] * (N + 1)
for i in range(N):
D[i + 1] = D[i] + L[i]
print((bisect.bisect_right(D, X))) | n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = 1
d = 0
for l in L:
d = d + l
if d <= x:
ans += 1
else:
break
print(ans) | 11 | 13 | 199 | 197 | import bisect
N, X = list(map(int, input().split()))
L = [int(i) for i in input().split()]
D = [0] * (N + 1)
for i in range(N):
D[i + 1] = D[i] + L[i]
print((bisect.bisect_right(D, X)))
| n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = 1
d = 0
for l in L:
d = d + l
if d <= x:
ans += 1
else:
break
print(ans)
| false | 15.384615 | [
"-import bisect",
"-",
"-N, X = list(map(int, input().split()))",
"-L = [int(i) for i in input().split()]",
"-D = [0] * (N + 1)",
"-for i in range(N):",
"- D[i + 1] = D[i] + L[i]",
"-print((bisect.bisect_right(D, X)))",
"+n, x = list(map(int, input().split()))",
"+L = list(map(int, input().spli... | false | 0.03506 | 0.035103 | 0.998782 | [
"s924289848",
"s192334612"
] |
u691501673 | p03164 | python | s667875187 | s355126286 | 795 | 582 | 326,784 | 235,540 | Accepted | Accepted | 26.79 | import sys
# input処理を高速化する
input = sys.stdin.readline
# 入力
N, W = list(map(int, input().split()))
array = [list(map(int, input().split())) for _ in range(N)] # [重さ、価値]
# sum_vの取りうる上限値
# MAX_V = (10**3 + 1) * N
MAX_V = 0
for line in array:
MAX_V += line[1]
MAX_V += 1
# 最小値を求めるので無限大の値
f_inf = float('inf... | # N個、重さW
N, W = list(map(int, input().split()))
# 重さ, 価値
array = [list(map(int, input().split())) for _ in range(N)]
# 価値の最大値
sum = 1
for i in range(N):
sum += array[i][1]
weights = [[float('inf')] * (sum + 1) for _ in range(N + 1)]
# 初期値
weights[0][0] = 0
# 価値ごとの重さの最小値を出す
for n in range(N):
... | 48 | 29 | 1,170 | 699 | import sys
# input処理を高速化する
input = sys.stdin.readline
# 入力
N, W = list(map(int, input().split()))
array = [list(map(int, input().split())) for _ in range(N)] # [重さ、価値]
# sum_vの取りうる上限値
# MAX_V = (10**3 + 1) * N
MAX_V = 0
for line in array:
MAX_V += line[1]
MAX_V += 1
# 最小値を求めるので無限大の値
f_inf = float("inf")
def chm... | # N個、重さW
N, W = list(map(int, input().split()))
# 重さ, 価値
array = [list(map(int, input().split())) for _ in range(N)]
# 価値の最大値
sum = 1
for i in range(N):
sum += array[i][1]
weights = [[float("inf")] * (sum + 1) for _ in range(N + 1)]
# 初期値
weights[0][0] = 0
# 価値ごとの重さの最小値を出す
for n in range(N):
# 価値が0..1000までのそれぞれ... | false | 39.583333 | [
"-import sys",
"-",
"-# input処理を高速化する",
"-input = sys.stdin.readline",
"-# 入力",
"+# N個、重さW",
"-array = [list(map(int, input().split())) for _ in range(N)] # [重さ、価値]",
"-# sum_vの取りうる上限値",
"-# MAX_V = (10**3 + 1) * N",
"-MAX_V = 0",
"-for line in array:",
"- MAX_V += line[1]",
"-MAX_V += 1... | false | 0.033947 | 0.036691 | 0.925212 | [
"s667875187",
"s355126286"
] |
u970308980 | p03329 | python | s317414863 | s591365442 | 1,435 | 1,314 | 3,828 | 3,864 | Accepted | Accepted | 8.43 | N = int(eval(input()))
INF = float('inf')
dp = [INF] * (N+1)
dp[0] = 0
for n in range(N + 1):
power = 0
while pow(6, power) <= n:
dp[n] = min(dp[n], dp[n - pow(6, power)] + 1)
power += 1
power = 0
while pow(9, power) <= n:
dp[n] = min(dp[n], dp[n - pow(9, power)] +... | N = int(eval(input()))
INF = float('inf')
dp = [INF for _ in range(N+1)]
dp[0] = 0
for n in range(N + 1):
power = 0
while pow(6, power) <= n:
dp[n] = min(dp[n], dp[n - pow(6, power)] + 1)
power += 1
power = 0
while pow(9, power) <= n:
dp[n] = min(dp[n], dp[n - pow(... | 17 | 17 | 354 | 366 | N = int(eval(input()))
INF = float("inf")
dp = [INF] * (N + 1)
dp[0] = 0
for n in range(N + 1):
power = 0
while pow(6, power) <= n:
dp[n] = min(dp[n], dp[n - pow(6, power)] + 1)
power += 1
power = 0
while pow(9, power) <= n:
dp[n] = min(dp[n], dp[n - pow(9, power)] + 1)
p... | N = int(eval(input()))
INF = float("inf")
dp = [INF for _ in range(N + 1)]
dp[0] = 0
for n in range(N + 1):
power = 0
while pow(6, power) <= n:
dp[n] = min(dp[n], dp[n - pow(6, power)] + 1)
power += 1
power = 0
while pow(9, power) <= n:
dp[n] = min(dp[n], dp[n - pow(9, power)] + ... | false | 0 | [
"-dp = [INF] * (N + 1)",
"+dp = [INF for _ in range(N + 1)]"
] | false | 0.836414 | 0.849288 | 0.984842 | [
"s317414863",
"s591365442"
] |
u281303342 | p03721 | python | s394478507 | s698319728 | 410 | 220 | 16,940 | 30,124 | Accepted | Accepted | 46.34 | N,K = list(map(int,input().split()))
AB = []
for i in range(N):
a,b = list(map(int,input().split()))
AB.append((a,b))
AB.sort()
cnt = 0
for ab in AB:
a,b = ab
cnt += b
if cnt >= K:
print(a)
break
| # atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7
# main
N,K = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
Cnt = [0]*(10**5+1)
for a,b in AB:
Cnt[a] += b
i = 1
for ci in range(len(Cnt)):
if i... | 15 | 21 | 236 | 404 | N, K = list(map(int, input().split()))
AB = []
for i in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
cnt = 0
for ab in AB:
a, b = ab
cnt += b
if cnt >= K:
print(a)
break
| # atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9 + 7
# main
N, K = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
Cnt = [0] * (10**5 + 1)
for a, b in AB:
Cnt[a] += b
i = 1
for ci in range(len(Cnt)):
if i <= K < ... | false | 28.571429 | [
"+# atcoder : python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**6)",
"+mod = 10**9 + 7",
"+# main",
"-AB = []",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- AB.append((a, b))",
"-AB.sort()",
"-cnt = 0",
"-for ab ... | false | 0.035569 | 0.033185 | 1.071849 | [
"s394478507",
"s698319728"
] |
u134302690 | p03220 | python | s314451788 | s260522012 | 184 | 18 | 38,384 | 3,060 | Accepted | Accepted | 90.22 | n = int(eval(input()))
t,a = list(map(int,input().split()))
h = list(map(int,input().split()))
for i,ave in enumerate(h):
h[i] = abs(a-(t-h[i]*0.006))
ans = h.index(min(h))+1
print(ans)
| N = int(eval(input()))
T,A = list(map(int,input().split()))
H = list(map(int,input().split()))
count = 10**9
ans = 0
for i in range(N):
aveT = abs(A- (T - 0.006 * H[i]))
if count >= aveT:
count = aveT
ans = i+1
print(ans) | 7 | 11 | 184 | 243 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
for i, ave in enumerate(h):
h[i] = abs(a - (t - h[i] * 0.006))
ans = h.index(min(h)) + 1
print(ans)
| N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
count = 10**9
ans = 0
for i in range(N):
aveT = abs(A - (T - 0.006 * H[i]))
if count >= aveT:
count = aveT
ans = i + 1
print(ans)
| false | 36.363636 | [
"-n = int(eval(input()))",
"-t, a = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-for i, ave in enumerate(h):",
"- h[i] = abs(a - (t - h[i] * 0.006))",
"-ans = h.index(min(h)) + 1",
"+N = int(eval(input()))",
"+T, A = list(map(int, input().split()))",
"+H = list(map(... | false | 0.117676 | 0.043598 | 2.699139 | [
"s314451788",
"s260522012"
] |
u514401521 | p02708 | python | s276379772 | s594901212 | 116 | 95 | 9,184 | 9,192 | Accepted | Accepted | 18.1 | N, K = list(map(int, input().split()))
M = 10**9 + 7
ans = 0
for i in range(K, N+2):
_min = (i-1)*i//2
_max = (N + N-i+1) * i //2
ans += (_max - _min + 1)
print((ans % M)) | N, K = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(K, N+2):
min = i*(i-1)/2
max = (2*N-i+1)*i/2
ans += max - min + 1
print((int(ans%mod))) | 8 | 9 | 186 | 176 | N, K = list(map(int, input().split()))
M = 10**9 + 7
ans = 0
for i in range(K, N + 2):
_min = (i - 1) * i // 2
_max = (N + N - i + 1) * i // 2
ans += _max - _min + 1
print((ans % M))
| N, K = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(K, N + 2):
min = i * (i - 1) / 2
max = (2 * N - i + 1) * i / 2
ans += max - min + 1
print((int(ans % mod)))
| false | 11.111111 | [
"-M = 10**9 + 7",
"+mod = 10**9 + 7",
"- _min = (i - 1) * i // 2",
"- _max = (N + N - i + 1) * i // 2",
"- ans += _max - _min + 1",
"-print((ans % M))",
"+ min = i * (i - 1) / 2",
"+ max = (2 * N - i + 1) * i / 2",
"+ ans += max - min + 1",
"+print((int(ans % mod)))"
] | false | 0.049543 | 0.064984 | 0.762383 | [
"s276379772",
"s594901212"
] |
u323680411 | p03478 | python | s147770781 | s874234405 | 34 | 24 | 3,060 | 3,064 | Accepted | Accepted | 29.41 | def judge(n):
result = 0
j = n
for i in range(1, len(str(n)) + 1):
result += j % 10
j = int(j / 10)
return result
def main():
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if A <= judge(i) <= B:
ans += i
... | from sys import stdin
def main() -> None:
n, a, b = [int(next_str()) for _ in range(3)]
ans = 0
for i in range(1, n + 1):
sum_of_digits_i = sum_of_digits(i)
if a <= sum_of_digits_i <= b:
ans += i
print(ans)
def sum_of_digits(a: int) -> int:
result = ... | 20 | 36 | 337 | 661 | def judge(n):
result = 0
j = n
for i in range(1, len(str(n)) + 1):
result += j % 10
j = int(j / 10)
return result
def main():
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if A <= judge(i) <= B:
ans += i
print(ans)
mai... | from sys import stdin
def main() -> None:
n, a, b = [int(next_str()) for _ in range(3)]
ans = 0
for i in range(1, n + 1):
sum_of_digits_i = sum_of_digits(i)
if a <= sum_of_digits_i <= b:
ans += i
print(ans)
def sum_of_digits(a: int) -> int:
result = 0
while a != 0... | false | 44.444444 | [
"-def judge(n):",
"- result = 0",
"- j = n",
"- for i in range(1, len(str(n)) + 1):",
"- result += j % 10",
"- j = int(j / 10)",
"- return result",
"+from sys import stdin",
"-def main():",
"- N, A, B = list(map(int, input().split()))",
"+def main() -> None:",
"+ ... | false | 0.094559 | 0.037195 | 2.542261 | [
"s147770781",
"s874234405"
] |
u545368057 | p03111 | python | s751357639 | s758244351 | 1,968 | 68 | 14,512 | 3,064 | Accepted | Accepted | 96.54 | import numpy as np
N, A, B, C = list(map(int,input().split()))
goals = [A,B,C]
ls = []
for i in range(N):
ls.append(int(eval(input())))
# goals = [1000,800,100]
# ls = [300,333,400,444,500,555,600,666]
# goals = [100, 90, 80]
# ls = [98, 40,30,21,80]
def count(x,ls):
try:
x.index(0)
... | """
l1,l2,...,lN
N は max8本
A,B,Cの3本の竹にしたい
延長 : 1MP +1
短縮 : 1MP -1
合成 : 10MP li + lj
A, B, Cを達成するための最小MP
"""
N,A,B,C = list(map(int, input().split()))
ls = [int(eval(input())) for i in range(N)]
import sys
sys.setrecursionlimit(100000)
"""
Gを作りながら探索するパターン
"""
minMP = 10**9 + 7
def dfs(i,MP,a... | 47 | 39 | 1,035 | 717 | import numpy as np
N, A, B, C = list(map(int, input().split()))
goals = [A, B, C]
ls = []
for i in range(N):
ls.append(int(eval(input())))
# goals = [1000,800,100]
# ls = [300,333,400,444,500,555,600,666]
# goals = [100, 90, 80]
# ls = [98, 40,30,21,80]
def count(x, ls):
try:
x.index(0)
x.index... | """
l1,l2,...,lN
N は max8本
A,B,Cの3本の竹にしたい
延長 : 1MP +1
短縮 : 1MP -1
合成 : 10MP li + lj
A, B, Cを達成するための最小MP
"""
N, A, B, C = list(map(int, input().split()))
ls = [int(eval(input())) for i in range(N)]
import sys
sys.setrecursionlimit(100000)
"""
Gを作りながら探索するパターン
"""
minMP = 10**9 + 7
def dfs(i, MP, a, b, c):
global... | false | 17.021277 | [
"-import numpy as np",
"+\"\"\"",
"+l1,l2,...,lN",
"+N は max8本",
"+A,B,Cの3本の竹にしたい",
"+延長 : 1MP +1",
"+短縮 : 1MP -1",
"+合成 : 10MP li + lj",
"+A, B, Cを達成するための最小MP",
"+\"\"\"",
"+N, A, B, C = list(map(int, input().split()))",
"+ls = [int(eval(input())) for i in range(N)]",
"+import sys",
"-N... | false | 2.386943 | 0.060449 | 39.48716 | [
"s751357639",
"s758244351"
] |
u998733244 | p03160 | python | s947350926 | s853485927 | 255 | 136 | 52,600 | 20,708 | Accepted | Accepted | 46.67 | #!/usr/bin/env python3
N = int(eval(input()))
H = list(map(int, input().split()))
dp = [float('inf') for i in range(N+1)]
dp[1] = 0
dp[2] = abs(H[1]-H[0])
for i in range(3, N+1):
dp[i] = min(dp[i-1]+abs(H[i-1]-H[i-2]), dp[i-2]+abs(H[i-1]-H[i-3]))
print((dp[N]))
| #!/usr/bin/env python3
N = int(eval(input()))
H = list(map(int, input().split()))
dp = [float('inf') for _ in range(N+1)]
dp[1] = 0
dp[2] = abs(H[0]-H[1])
for i in range(3, N+1):
dp[i] = min(dp[i-2] + abs(H[i-3]-H[i-1]), dp[i-1] + abs(H[i-2]-H[i-1]))
print((dp[N]))
| 15 | 13 | 278 | 278 | #!/usr/bin/env python3
N = int(eval(input()))
H = list(map(int, input().split()))
dp = [float("inf") for i in range(N + 1)]
dp[1] = 0
dp[2] = abs(H[1] - H[0])
for i in range(3, N + 1):
dp[i] = min(
dp[i - 1] + abs(H[i - 1] - H[i - 2]), dp[i - 2] + abs(H[i - 1] - H[i - 3])
)
print((dp[N]))
| #!/usr/bin/env python3
N = int(eval(input()))
H = list(map(int, input().split()))
dp = [float("inf") for _ in range(N + 1)]
dp[1] = 0
dp[2] = abs(H[0] - H[1])
for i in range(3, N + 1):
dp[i] = min(
dp[i - 2] + abs(H[i - 3] - H[i - 1]), dp[i - 1] + abs(H[i - 2] - H[i - 1])
)
print((dp[N]))
| false | 13.333333 | [
"-dp = [float(\"inf\") for i in range(N + 1)]",
"+dp = [float(\"inf\") for _ in range(N + 1)]",
"-dp[2] = abs(H[1] - H[0])",
"+dp[2] = abs(H[0] - H[1])",
"- dp[i - 1] + abs(H[i - 1] - H[i - 2]), dp[i - 2] + abs(H[i - 1] - H[i - 3])",
"+ dp[i - 2] + abs(H[i - 3] - H[i - 1]), dp[i - 1] + abs(H... | false | 0.038181 | 0.042268 | 0.903302 | [
"s947350926",
"s853485927"
] |
u321605735 | p02675 | python | s844282779 | s774002498 | 31 | 25 | 9,132 | 9,080 | Accepted | Accepted | 19.35 | N=int(eval(input()))
ans=int(N%10)
if ans==3:
print("bon")
elif ans==0:
print("pon")
elif ans==1:
print("pon")
elif ans==6:
print("pon")
elif ans==8:
print("pon")
else:
print("hon") | N=int(eval(input()))
if int(N%10)==3:
print("bon")
elif int(N%10)<=1:
print("pon")
elif int(N%10)==6 or int(N%10)==8:
print("pon")
else:
print("hon") | 14 | 9 | 200 | 167 | N = int(eval(input()))
ans = int(N % 10)
if ans == 3:
print("bon")
elif ans == 0:
print("pon")
elif ans == 1:
print("pon")
elif ans == 6:
print("pon")
elif ans == 8:
print("pon")
else:
print("hon")
| N = int(eval(input()))
if int(N % 10) == 3:
print("bon")
elif int(N % 10) <= 1:
print("pon")
elif int(N % 10) == 6 or int(N % 10) == 8:
print("pon")
else:
print("hon")
| false | 35.714286 | [
"-ans = int(N % 10)",
"-if ans == 3:",
"+if int(N % 10) == 3:",
"-elif ans == 0:",
"+elif int(N % 10) <= 1:",
"-elif ans == 1:",
"- print(\"pon\")",
"-elif ans == 6:",
"- print(\"pon\")",
"-elif ans == 8:",
"+elif int(N % 10) == 6 or int(N % 10) == 8:"
] | false | 0.039124 | 0.068138 | 0.574195 | [
"s844282779",
"s774002498"
] |
u864013199 | p02973 | python | s945758059 | s288368926 | 236 | 124 | 11,036 | 11,032 | Accepted | Accepted | 47.46 | #ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= -1
i = bisect(dp,a) #既存に-aを挿入した時のindex
if i < len(dp): #挿入位置が長さより小さい時(要はabsが一番小さくない時
dp[i] = a #-aにする
... | #ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= -1
i = bisect(dp,a) #既存に-aを挿入した時のindex
if i < len(dp): #挿入位置が長さより小さい時(要はabsが一番小さ... | 16 | 18 | 371 | 411 | # ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= -1
i = bisect(dp, a) # 既存に-aを挿入した時のindex
if i < len(dp): # 挿入位置が長さより小さい時(要はabsが一番小さくない時
dp[i] = a # -aにする
else:
... | # ttps://atcoder.jp/contests/abc134/submissions/6459172
from bisect import bisect
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
dp = [1]
for a in A:
a *= -1
i = bisect(dp, a) # 既存に-aを挿入した時のindex
if i < len(dp): # 挿入位置が長さより小さい時(要はabsが一番小さくない時
... | false | 11.111111 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.043151 | 0.042975 | 1.004091 | [
"s945758059",
"s288368926"
] |
u848647227 | p03856 | python | s696319474 | s213770916 | 48 | 42 | 3,956 | 3,956 | Accepted | Accepted | 12.5 | ar = list(eval(input()))
while True:
a = len(ar)
if a == 0:
print("YES")
break
if "".join(ar[a-5:a]) == "dream" or "".join(ar[a-5:a]) == "erase":
del ar[a-5:a]
elif "".join(ar[a-6:a]) == "eraser":
del ar[a-6:a]
elif "".join(ar[a-7:a]) == "dreamer":
... | ar = list(eval(input()))
l = len(ar)
if l < 5:
print('NO')
else:
while True:
if l == 0:
print("YES")
exit()
if "".join(ar[l-5:l]) == 'dream' or "".join(ar[l-5:l]) == 'erase':
l -= 5
elif "".join(ar[l-6:l]) == 'eraser':
l -= 6
... | 15 | 18 | 374 | 439 | ar = list(eval(input()))
while True:
a = len(ar)
if a == 0:
print("YES")
break
if "".join(ar[a - 5 : a]) == "dream" or "".join(ar[a - 5 : a]) == "erase":
del ar[a - 5 : a]
elif "".join(ar[a - 6 : a]) == "eraser":
del ar[a - 6 : a]
elif "".join(ar[a - 7 : a]) == "dream... | ar = list(eval(input()))
l = len(ar)
if l < 5:
print("NO")
else:
while True:
if l == 0:
print("YES")
exit()
if "".join(ar[l - 5 : l]) == "dream" or "".join(ar[l - 5 : l]) == "erase":
l -= 5
elif "".join(ar[l - 6 : l]) == "eraser":
l -= 6
... | false | 16.666667 | [
"-while True:",
"- a = len(ar)",
"- if a == 0:",
"- print(\"YES\")",
"- break",
"- if \"\".join(ar[a - 5 : a]) == \"dream\" or \"\".join(ar[a - 5 : a]) == \"erase\":",
"- del ar[a - 5 : a]",
"- elif \"\".join(ar[a - 6 : a]) == \"eraser\":",
"- del ar[a - 6 : a... | false | 0.046525 | 0.047457 | 0.980361 | [
"s696319474",
"s213770916"
] |
u281303342 | p03128 | python | s091509915 | s149048267 | 95 | 85 | 3,420 | 3,348 | Accepted | Accepted | 10.53 | N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort(reverse=True)
# 各数字に必要なマッチの本数
num = [0,2,5,5,4,5,6,3,7,6]
# dp : i本のマッチで実現できる最大の桁数
dp = [-1*float("inf")]*(N+1)
# dp初期化 (0本では0桁, 各数字を1つ作る場合は1桁)
dp[0] = 0
for a in A:
if num[a] <= N:
dp[num[a]] = 1
for i in rang... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 29 | 45 | 612 | 985 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
# 各数字に必要なマッチの本数
num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
# dp : i本のマッチで実現できる最大の桁数
dp = [-1 * float("inf")] * (N + 1)
# dp初期化 (0本では0桁, 各数字を1つ作る場合は1桁)
dp[0] = 0
for a in A:
if num[a] <= N:
dp[num[a]] = 1
for i in range... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 35.555556 | [
"+# Python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# function",
"+# main",
"-A.sort(reverse=True)",
"-# dp : i本のマッチで実現できる最大の桁数",
"-dp = [-1 * float(\"inf\")] * (N + 1)",
"-# dp初期化 (0本では0桁, 各数字を1つ作る場合は1桁)",
"+# dp : i本のマッチで作ることが可能な最大の桁数",
"+dp = [-float(\"inf\")] * (N + ... | false | 0.050502 | 0.06757 | 0.747396 | [
"s091509915",
"s149048267"
] |
u021548497 | p03488 | python | s934241711 | s811813059 | 440 | 70 | 75,780 | 71,480 | Accepted | Accepted | 84.09 | def main():
s = eval(input())
n = len(s)
x, y = list(map(int, input().split()))
dpx = [[False, False] for _ in range(n+2)]
dpy = [[False, False] for _ in range(n+2)]
dpx[0][0] = True
dpy[0][0] = True
x_turn = False
y_turn = False
judge = True
turn = False
xcount = 0
count = 0
... | import sys
def main():
s = eval(input())
n = len(s)
x, y = list(map(int, input().split()))
move = [0]
for i in range(n):
if s[i] == "F":
move[-1] += 1
else:
move.append(0)
move_x = move[2::2]
move_y = move[1::2]
move_a = move[0]
for start, lis in zip([x-... | 68 | 36 | 1,471 | 671 | def main():
s = eval(input())
n = len(s)
x, y = list(map(int, input().split()))
dpx = [[False, False] for _ in range(n + 2)]
dpy = [[False, False] for _ in range(n + 2)]
dpx[0][0] = True
dpy[0][0] = True
x_turn = False
y_turn = False
judge = True
turn = False
xcount = 0
... | import sys
def main():
s = eval(input())
n = len(s)
x, y = list(map(int, input().split()))
move = [0]
for i in range(n):
if s[i] == "F":
move[-1] += 1
else:
move.append(0)
move_x = move[2::2]
move_y = move[1::2]
move_a = move[0]
for start, li... | false | 47.058824 | [
"+import sys",
"+",
"+",
"- dpx = [[False, False] for _ in range(n + 2)]",
"- dpy = [[False, False] for _ in range(n + 2)]",
"- dpx[0][0] = True",
"- dpy[0][0] = True",
"- x_turn = False",
"- y_turn = False",
"- judge = True",
"- turn = False",
"- xcount = 0",
"- ... | false | 0.040944 | 0.039593 | 1.034125 | [
"s934241711",
"s811813059"
] |
u888092736 | p02647 | python | s059593454 | s101469915 | 1,390 | 1,090 | 132,532 | 137,048 | Accepted | Accepted | 21.58 | import numpy as np
from numba import njit
@njit
def solve(N, K, A):
for _ in range(K):
B = np.zeros(N + 1, dtype=np.int64)
for i in range(N):
a = A[i]
B[max(0, i - a)] += 1
B[min(N, i + a + 1)] -= 1
A = np.cumsum(B)[:-1]
if np.all(A ... | import numpy as np
from numba import njit
@njit('i8[:](i8,i8,i8[:])')
def solve(N, K, A):
for _ in range(K):
B = np.zeros(N + 1, dtype=np.int64)
for i in range(N):
a = A[i]
B[max(0, i - a)] += 1
B[min(N, i + a + 1)] -= 1
A = np.cumsum(B)[:-1]... | 21 | 21 | 485 | 507 | import numpy as np
from numba import njit
@njit
def solve(N, K, A):
for _ in range(K):
B = np.zeros(N + 1, dtype=np.int64)
for i in range(N):
a = A[i]
B[max(0, i - a)] += 1
B[min(N, i + a + 1)] -= 1
A = np.cumsum(B)[:-1]
if np.all(A == N):
... | import numpy as np
from numba import njit
@njit("i8[:](i8,i8,i8[:])")
def solve(N, K, A):
for _ in range(K):
B = np.zeros(N + 1, dtype=np.int64)
for i in range(N):
a = A[i]
B[max(0, i - a)] += 1
B[min(N, i + a + 1)] -= 1
A = np.cumsum(B)[:-1]
if ... | false | 0 | [
"-@njit",
"+@njit(\"i8[:](i8,i8,i8[:])\")"
] | false | 0.27046 | 0.556954 | 0.485605 | [
"s059593454",
"s101469915"
] |
u941047297 | p03963 | python | s588602142 | s398917211 | 165 | 20 | 38,256 | 3,060 | Accepted | Accepted | 87.88 | N, K = list(map(int, input().split()))
ans = K * ((K - 1) ** (N - 1))
print(ans) | n, k = list(map(int, input().split()))
print((k * ((k - 1) ** (n - 1)))) | 3 | 2 | 82 | 71 | N, K = list(map(int, input().split()))
ans = K * ((K - 1) ** (N - 1))
print(ans)
| n, k = list(map(int, input().split()))
print((k * ((k - 1) ** (n - 1))))
| false | 33.333333 | [
"-N, K = list(map(int, input().split()))",
"-ans = K * ((K - 1) ** (N - 1))",
"-print(ans)",
"+n, k = list(map(int, input().split()))",
"+print((k * ((k - 1) ** (n - 1))))"
] | false | 0.036614 | 0.045181 | 0.810393 | [
"s588602142",
"s398917211"
] |
u609061751 | p02835 | python | s775000831 | s748128092 | 148 | 17 | 12,492 | 2,940 | Accepted | Accepted | 88.51 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
A = [int(x) for x in readline().rstrip().split()]
if sum(A) >= 22:
print("bust")
else:
print("win") | A = [int(x) for x in input().split()]
total = sum(A)
if total <= 21:
print("win")
else:
print("bust") | 11 | 6 | 253 | 114 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
A = [int(x) for x in readline().rstrip().split()]
if sum(A) >= 22:
print("bust")
else:
print("win")
| A = [int(x) for x in input().split()]
total = sum(A)
if total <= 21:
print("win")
else:
print("bust")
| false | 45.454545 | [
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-import numpy as np",
"-",
"-A = [int(x) for x in readline().rstrip().split()]",
"-if sum(A) >= 22:",
"+A = [int(x) for x in input().split()]",
"+total = sum(... | false | 0.060746 | 0.036971 | 1.643068 | [
"s775000831",
"s748128092"
] |
u877415670 | p02832 | python | s400898053 | s323901217 | 155 | 110 | 26,148 | 26,268 | Accepted | Accepted | 29.03 | import sys
n=int(eval(input()))
a = list(map(int, input().split()))
ans = 0
_find = 1
before = 0
if not 1 in set(a):
print((-1))
sys.exit()
for i in range(n):
if a[i]==_find:
ans += i-before
_find += 1
before = i+1
print((ans+n-before)) | n=int(eval(input()))
a=list(map(int,input().split()))
ans = 0
block = 1
no_block = False
for i in range(n):
if a[i]!=block:
ans+=1
else:
no_block = True
block+=1
if no_block is False:
print((-1))
else:
print(ans) | 20 | 18 | 286 | 267 | import sys
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
_find = 1
before = 0
if not 1 in set(a):
print((-1))
sys.exit()
for i in range(n):
if a[i] == _find:
ans += i - before
_find += 1
before = i + 1
print((ans + n - before))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
block = 1
no_block = False
for i in range(n):
if a[i] != block:
ans += 1
else:
no_block = True
block += 1
if no_block is False:
print((-1))
else:
print(ans)
| false | 10 | [
"-import sys",
"-",
"-_find = 1",
"-before = 0",
"-if not 1 in set(a):",
"+block = 1",
"+no_block = False",
"+for i in range(n):",
"+ if a[i] != block:",
"+ ans += 1",
"+ else:",
"+ no_block = True",
"+ block += 1",
"+if no_block is False:",
"- sys.exit()",
... | false | 0.041416 | 0.036425 | 1.137034 | [
"s400898053",
"s323901217"
] |
u959981943 | p03285 | python | s782978456 | s913611266 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from sys import stdin
N = int(stdin.readline().rstrip())
if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
print('No')
else:
print('Yes')
| N = int(eval(input()))
if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
print('No')
else:
print('Yes')
| 8 | 6 | 145 | 102 | from sys import stdin
N = int(stdin.readline().rstrip())
if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
print("No")
else:
print("Yes")
| N = int(eval(input()))
if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
print("No")
else:
print("Yes")
| false | 25 | [
"-from sys import stdin",
"-",
"-N = int(stdin.readline().rstrip())",
"+N = int(eval(input()))"
] | false | 0.047713 | 0.051688 | 0.923099 | [
"s782978456",
"s913611266"
] |
u729133443 | p03773 | python | s607639209 | s942561485 | 161 | 28 | 38,256 | 8,900 | Accepted | Accepted | 82.61 | a,b=list(map(int,input().split()));print(((a+b)%24)) | print((eval(input().replace(*' +'))%24)) | 1 | 1 | 44 | 38 | a, b = list(map(int, input().split()))
print(((a + b) % 24))
| print((eval(input().replace(*" +")) % 24))
| false | 0 | [
"-a, b = list(map(int, input().split()))",
"-print(((a + b) % 24))",
"+print((eval(input().replace(*\" +\")) % 24))"
] | false | 0.033718 | 0.032695 | 1.031291 | [
"s607639209",
"s942561485"
] |
u519123891 | p02707 | python | s599189804 | s935864815 | 221 | 167 | 54,432 | 33,608 | Accepted | Accepted | 24.43 | # input
n = int(eval(input()))
inp_ls = input().split(" ")
a_ls = [int(e) for e in inp_ls[:n-1]]
# calc
w_ls = {i+1: 0 for i in range(n)}
for a in a_ls:
w_ls[a] += 1
# result
for i in range(n):
print((w_ls[i+1])) | # input
n = int(eval(input()))
inp_ls = input().split(" ")
a_ls = [int(e) for e in inp_ls[:n-1]]
# calc
w_ls = [0 for i in range(n)]
for a in a_ls:
w_ls[a-1] += 1
# result
for w in w_ls:
print(w) | 13 | 13 | 220 | 205 | # input
n = int(eval(input()))
inp_ls = input().split(" ")
a_ls = [int(e) for e in inp_ls[: n - 1]]
# calc
w_ls = {i + 1: 0 for i in range(n)}
for a in a_ls:
w_ls[a] += 1
# result
for i in range(n):
print((w_ls[i + 1]))
| # input
n = int(eval(input()))
inp_ls = input().split(" ")
a_ls = [int(e) for e in inp_ls[: n - 1]]
# calc
w_ls = [0 for i in range(n)]
for a in a_ls:
w_ls[a - 1] += 1
# result
for w in w_ls:
print(w)
| false | 0 | [
"-w_ls = {i + 1: 0 for i in range(n)}",
"+w_ls = [0 for i in range(n)]",
"- w_ls[a] += 1",
"+ w_ls[a - 1] += 1",
"-for i in range(n):",
"- print((w_ls[i + 1]))",
"+for w in w_ls:",
"+ print(w)"
] | false | 0.047213 | 0.047828 | 0.987139 | [
"s599189804",
"s935864815"
] |
u293198424 | p03324 | python | s173718495 | s154977842 | 183 | 163 | 38,384 | 38,256 | Accepted | Accepted | 10.93 | d,n = list(map(int,input().split()))
if n==100 and d==0:
ans = 100**d*n+1
elif n==100 and d==1:
ans = 100**d*n + 100
elif n==100 and d==2:
ans = 100**d*n + 10000
else:
ans = 100**d*n
print(ans)
| d,n = list(map(int,input().split()))
if n==100:
ans = 100**d*(n+1)
else:
ans = 100**d*n
print(ans) | 11 | 6 | 218 | 105 | d, n = list(map(int, input().split()))
if n == 100 and d == 0:
ans = 100**d * n + 1
elif n == 100 and d == 1:
ans = 100**d * n + 100
elif n == 100 and d == 2:
ans = 100**d * n + 10000
else:
ans = 100**d * n
print(ans)
| d, n = list(map(int, input().split()))
if n == 100:
ans = 100**d * (n + 1)
else:
ans = 100**d * n
print(ans)
| false | 45.454545 | [
"-if n == 100 and d == 0:",
"- ans = 100**d * n + 1",
"-elif n == 100 and d == 1:",
"- ans = 100**d * n + 100",
"-elif n == 100 and d == 2:",
"- ans = 100**d * n + 10000",
"+if n == 100:",
"+ ans = 100**d * (n + 1)"
] | false | 0.10246 | 0.094193 | 1.087771 | [
"s173718495",
"s154977842"
] |
u462831976 | p00040 | python | s353019359 | s596222047 | 210 | 60 | 7,796 | 7,820 | Accepted | Accepted | 71.43 | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def encode(s, alpha, beta):
t = []
for c in s:
if c == ' ':
t.append(c)
else:
gamma = ord(c) - 97
v = (alpha * gamma + ... | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def encode(s, alpha, beta):
t = []
for c in s:
if c == ' ':
t.append(c)
else:
gamma = ord(c) - 97
v = (alpha * gamma + be... | 31 | 34 | 633 | 864 | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
alphabet = "abcdefghijklmnopqrstuvwxyz"
def encode(s, alpha, beta):
t = []
for c in s:
if c == " ":
t.append(c)
else:
gamma = ord(c) - 97
v = (alpha * gamma + beta) % 26
... | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
alphabet = "abcdefghijklmnopqrstuvwxyz"
def encode(s, alpha, beta):
t = []
for c in s:
if c == " ":
t.append(c)
else:
gamma = ord(c) - 97
v = (alpha * gamma + beta) % 26
... | false | 8.823529 | [
"- for a in range(26):",
"- for b in range(26):",
"- encoded = encode(s, a, b)",
"- if \"that\" in encoded or \"this\" in encoded:",
"- print(encoded)",
"+ for a in range(0, 26):",
"+ for b in range(0, 26):",
"+ encoded_this = encode(... | false | 0.045789 | 0.037579 | 1.218479 | [
"s353019359",
"s596222047"
] |
u970197315 | p03425 | python | s870806585 | s769654772 | 196 | 165 | 10,032 | 3,064 | Accepted | Accepted | 15.82 | # ABC089 C - March
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
x = [0,0,0,0,0,0,1,1,1,2]
y = [1,1,1,2,2,3,2,2,3,3]
z = [2,3,4,3,4,4,3,4,4,4]
m = 0
a = 0
r = 0
c = 0
h = 0
for s in S:
if s[0:1] == 'M':
m += 1
if s[0:1] == 'A':
a += 1
if s[0:1] == 'R':
... | n=int(eval(input()))
m=0
a=0
r=0
c=0
h=0
for i in range(n):
s=eval(input())
if s[0]=='M':
m+=1
elif s[0]=='A':
a+=1
elif s[0]=='R':
r+=1
elif s[0]=='C':
c+=1
elif s[0]=='H':
h+=1
ans=0
ans+=m*a*r
ans+=m*a*c
ans+=m*a*h
ans+=m*r*c
an... | 38 | 34 | 557 | 394 | # ABC089 C - March
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
x = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]
y = [1, 1, 1, 2, 2, 3, 2, 2, 3, 3]
z = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4]
m = 0
a = 0
r = 0
c = 0
h = 0
for s in S:
if s[0:1] == "M":
m += 1
if s[0:1] == "A":
a += 1
if s[0:1] == "R... | n = int(eval(input()))
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(n):
s = eval(input())
if s[0] == "M":
m += 1
elif s[0] == "A":
a += 1
elif s[0] == "R":
r += 1
elif s[0] == "C":
c += 1
elif s[0] == "H":
h += 1
ans = 0
ans += m * a * r
ans += m * a * c
a... | false | 10.526316 | [
"-# ABC089 C - March",
"-N = int(eval(input()))",
"-S = [eval(input()) for i in range(N)]",
"-x = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]",
"-y = [1, 1, 1, 2, 2, 3, 2, 2, 3, 3]",
"-z = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4]",
"+n = int(eval(input()))",
"-for s in S:",
"- if s[0:1] == \"M\":",
"+for i in range(n... | false | 0.045555 | 0.048627 | 0.936819 | [
"s870806585",
"s769654772"
] |
u243312682 | p02659 | python | s214758205 | s127271551 | 29 | 23 | 10,008 | 9,164 | Accepted | Accepted | 20.69 | from decimal import *
def main():
a, b = list(map(str, input().split()))
res = int(a) * Decimal(b)
print((int(res)))
if __name__ == '__main__':
main() | def main():
a, b = list(map(str, input().split()))
res = int(a) * round((float(b)) * 100) // 100
print(res)
if __name__ == '__main__':
main() | 8 | 8 | 166 | 163 | from decimal import *
def main():
a, b = list(map(str, input().split()))
res = int(a) * Decimal(b)
print((int(res)))
if __name__ == "__main__":
main()
| def main():
a, b = list(map(str, input().split()))
res = int(a) * round((float(b)) * 100) // 100
print(res)
if __name__ == "__main__":
main()
| false | 0 | [
"-from decimal import *",
"-",
"-",
"- res = int(a) * Decimal(b)",
"- print((int(res)))",
"+ res = int(a) * round((float(b)) * 100) // 100",
"+ print(res)"
] | false | 0.039441 | 0.038599 | 1.021807 | [
"s214758205",
"s127271551"
] |
u645250356 | p03564 | python | s595107266 | s219643145 | 176 | 39 | 38,384 | 5,120 | Accepted | Accepted | 77.84 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.st... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | 15 | 16 | 448 | 452 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpln(n):
r... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | false | 6.25 | [
"-import sys, bisect, math, itertools",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-res = 1",
"+now = 1",
"- res = mi... | false | 0.054991 | 0.077128 | 0.712982 | [
"s595107266",
"s219643145"
] |
u320325426 | p03555 | python | s078452076 | s877674552 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | print(("YES" if eval(input()) == input()[::-1] else "NO")) | print((["NO", "YES"][eval(input()) == input()[::-1]])) | 1 | 1 | 50 | 46 | print(("YES" if eval(input()) == input()[::-1] else "NO"))
| print((["NO", "YES"][eval(input()) == input()[::-1]]))
| false | 0 | [
"-print((\"YES\" if eval(input()) == input()[::-1] else \"NO\"))",
"+print(([\"NO\", \"YES\"][eval(input()) == input()[::-1]]))"
] | false | 0.045499 | 0.047741 | 0.953051 | [
"s078452076",
"s877674552"
] |
u424209323 | p02273 | python | s702766270 | s391341518 | 30 | 20 | 6,656 | 6,652 | Accepted | Accepted | 33.33 | import math
def koch(n, x1, y1, x2, y2):
if n == 0:
return
theta60 = math.radians(60)
sx = ( 2 * x1 + x2 ) /3
sy = ( 2 * y1 + y2 ) /3
tx = ( 2 * x2 + x1 ) /3
ty = ( 2 * y2 + y1 ) /3
ux = ( tx - sx ) * math.cos( theta60 ) - ( ty - sy ) * math.sin( theta60 ) + sx... | import math
def kock(n, x1, y1, x2, y2):
if n == 0:
return
angle = math.radians(60)
sx = (2*x1 + x2)/3
sy = (2*y1 + y2)/3
tx = (2*x2 + x1)/3
ty = (2*y2 + y1)/3
ux = (tx - sx)*math.cos(angle) - (ty - sy)*math.sin(angle) + sx
uy = (tx - sx)*math.sin(angle) + (ty - s... | 33 | 33 | 760 | 673 | import math
def koch(n, x1, y1, x2, y2):
if n == 0:
return
theta60 = math.radians(60)
sx = (2 * x1 + x2) / 3
sy = (2 * y1 + y2) / 3
tx = (2 * x2 + x1) / 3
ty = (2 * y2 + y1) / 3
ux = (tx - sx) * math.cos(theta60) - (ty - sy) * math.sin(theta60) + sx
uy = (tx - sx) * math.sin(th... | import math
def kock(n, x1, y1, x2, y2):
if n == 0:
return
angle = math.radians(60)
sx = (2 * x1 + x2) / 3
sy = (2 * y1 + y2) / 3
tx = (2 * x2 + x1) / 3
ty = (2 * y2 + y1) / 3
ux = (tx - sx) * math.cos(angle) - (ty - sy) * math.sin(angle) + sx
uy = (tx - sx) * math.sin(angle) +... | false | 0 | [
"-def koch(n, x1, y1, x2, y2):",
"+def kock(n, x1, y1, x2, y2):",
"- theta60 = math.radians(60)",
"+ angle = math.radians(60)",
"- ux = (tx - sx) * math.cos(theta60) - (ty - sy) * math.sin(theta60) + sx",
"- uy = (tx - sx) * math.sin(theta60) + (ty - sy) * math.cos(theta60) + sy",
"- koch... | false | 0.047184 | 0.038339 | 1.230699 | [
"s702766270",
"s391341518"
] |
u673361376 | p03546 | python | s707654030 | s807867656 | 193 | 33 | 40,300 | 3,976 | Accepted | Accepted | 82.9 | H,W = list(map(int,input().split()))
C = [list(map(int,input().split())) for _ in range(10)]
cntA = {}
for _ in range(H):
for a in map(int,input().split()):
if a not in cntA:
cntA[a] = 1
else:
cntA[a] += 1
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j... | import copy
from collections import Counter
def make_table():
dp = copy.deepcopy(C)
for k in range(N):
for i in range(N):
for j in range(N):
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
return dp
N = 10
H, W = list(map(int, input().split()))
C = [list(... | 20 | 26 | 458 | 554 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
cntA = {}
for _ in range(H):
for a in map(int, input().split()):
if a not in cntA:
cntA[a] = 1
else:
cntA[a] += 1
for k in range(10):
for i in range(10):
for j in range... | import copy
from collections import Counter
def make_table():
dp = copy.deepcopy(C)
for k in range(N):
for i in range(N):
for j in range(N):
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
return dp
N = 10
H, W = list(map(int, input().split()))
C = [list(map(int, input(... | false | 23.076923 | [
"+import copy",
"+from collections import Counter",
"+",
"+",
"+def make_table():",
"+ dp = copy.deepcopy(C)",
"+ for k in range(N):",
"+ for i in range(N):",
"+ for j in range(N):",
"+ dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])",
"+ return dp",
"+"... | false | 0.069843 | 0.058987 | 1.184044 | [
"s707654030",
"s807867656"
] |
u564589929 | p02936 | python | s916913238 | s192427765 | 1,712 | 948 | 67,208 | 67,284 | Accepted | Accepted | 44.63 | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): retur... | import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return ... | 49 | 49 | 1,178 | 1,176 | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def... | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LI1... | false | 0 | [
"-# input = sys.stdin.readline ####",
"+input = sys.stdin.readline ####"
] | false | 0.036851 | 0.04201 | 0.877201 | [
"s916913238",
"s192427765"
] |
u094191970 | p02579 | python | s823891467 | s100307624 | 791 | 718 | 135,012 | 133,424 | Accepted | Accepted | 9.23 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
h,w=nii()
ch,cw=nii()
dh,dw=nii()
s=[list(eval(input())) for i in range(h)]
ch-=1
cw-=1
dh-=1
dw-=1
dist=[[-1]*w for i in range(h)]
dist[ch][cw]=0... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
h,w=nii()
ch,cw=nii()
dh,dw=nii()
s=[list(eval(input())) for i in range(h)]
ch-=1
cw-=1
dh-=1
dw-=1
ans=[[-1]*w for i in range(h)]
ans[ch][cw]=0
... | 48 | 45 | 932 | 865 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
h, w = nii()
ch, cw = nii()
dh, dw = nii()
s = [list(eval(input())) for i in range(h)]
ch -= 1
cw -= 1
dh -= 1
dw -= 1
dist = [[-1] * w for i in range(h)]
... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
h, w = nii()
ch, cw = nii()
dh, dw = nii()
s = [list(eval(input())) for i in range(h)]
ch -= 1
cw -= 1
dh -= 1
dw -= 1
ans = [[-1] * w for i in range(h)]
a... | false | 6.25 | [
"-dist = [[-1] * w for i in range(h)]",
"-dist[ch][cw] = 0",
"+ans = [[-1] * w for i in range(h)]",
"+ans[ch][cw] = 0",
"-",
"-",
"-def BFS():",
"- while que:",
"- y, x = que.popleft()",
"- if y == dh and x == dw:",
"- print((dist[y][x]))",
"- exit()",
... | false | 0.046976 | 0.045595 | 1.03027 | [
"s823891467",
"s100307624"
] |
u211160392 | p03048 | python | s704842094 | s474748933 | 1,471 | 297 | 3,060 | 40,812 | Accepted | Accepted | 79.81 | import math
R,G,B,N = list(map(int,input().split()))
ans = 0
r,g,b = 0,0,0
for i in range(math.floor(N/R)+1):
for j in range(math.floor((N-i*R)/G)+1):
if (N-R*i-G*j)%B == 0:
ans += 1
print(ans) | R, G, B, N = list(map(int,input().split()))
ans = 0
for r in range(N+1):
for g in range(N+1):
b = N - r*R - g*G
if 0 <= b and b%B == 0:
ans += 1
print(ans) | 9 | 8 | 219 | 188 | import math
R, G, B, N = list(map(int, input().split()))
ans = 0
r, g, b = 0, 0, 0
for i in range(math.floor(N / R) + 1):
for j in range(math.floor((N - i * R) / G) + 1):
if (N - R * i - G * j) % B == 0:
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N + 1):
for g in range(N + 1):
b = N - r * R - g * G
if 0 <= b and b % B == 0:
ans += 1
print(ans)
| false | 11.111111 | [
"-import math",
"-",
"-r, g, b = 0, 0, 0",
"-for i in range(math.floor(N / R) + 1):",
"- for j in range(math.floor((N - i * R) / G) + 1):",
"- if (N - R * i - G * j) % B == 0:",
"+for r in range(N + 1):",
"+ for g in range(N + 1):",
"+ b = N - r * R - g * G",
"+ if 0 <= ... | false | 0.075772 | 1.554283 | 0.04875 | [
"s704842094",
"s474748933"
] |
u903005414 | p02947 | python | s769120997 | s520602695 | 375 | 346 | 19,824 | 19,764 | Accepted | Accepted | 7.73 | from collections import Counter
N = int(eval(input()))
S = []
for _ in range(N):
s = list(eval(input()))
s.sort()
s = ''.join(s)
S.append(s)
counter = Counter(S)
ans = 0
for v in list(counter.values()):
ans += v * (v - 1) // 2
print(ans)
| from collections import Counter
N = int(eval(input()))
S = [''.join(sorted(eval(input()))) for _ in range(N)]
counter = Counter(S)
ans = 0
for v in list(counter.values()):
ans += v * (v - 1) // 2
print(ans)
| 16 | 10 | 258 | 204 | from collections import Counter
N = int(eval(input()))
S = []
for _ in range(N):
s = list(eval(input()))
s.sort()
s = "".join(s)
S.append(s)
counter = Counter(S)
ans = 0
for v in list(counter.values()):
ans += v * (v - 1) // 2
print(ans)
| from collections import Counter
N = int(eval(input()))
S = ["".join(sorted(eval(input()))) for _ in range(N)]
counter = Counter(S)
ans = 0
for v in list(counter.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 37.5 | [
"-S = []",
"-for _ in range(N):",
"- s = list(eval(input()))",
"- s.sort()",
"- s = \"\".join(s)",
"- S.append(s)",
"+S = [\"\".join(sorted(eval(input()))) for _ in range(N)]"
] | false | 0.037686 | 0.036841 | 1.022941 | [
"s769120997",
"s520602695"
] |
u401452016 | p02861 | python | s080420745 | s840229710 | 383 | 348 | 7,972 | 8,052 | Accepted | Accepted | 9.14 | import sys
import itertools
import math
n = int(sys.stdin.readline())
pos = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
a = list(itertools.permutations(pos, n))
#print(pos)
ans = 0
for ele in a:
#print(ele)
for i in range(n-1):
ans += math.sqrt((ele[i][0] - ele[i+1][0])... | #ABC145C
def main():
import sys, math
import itertools as ite
N = int(sys.stdin.readline())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
#print(L)
A = list(ite.permutations([i for i in range(N)]))
#print(A)
ans = 0
for a in A:
for i in... | 14 | 23 | 374 | 510 | import sys
import itertools
import math
n = int(sys.stdin.readline())
pos = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
a = list(itertools.permutations(pos, n))
# print(pos)
ans = 0
for ele in a:
# print(ele)
for i in range(n - 1):
ans += math.sqrt(
(ele[i][0] - ele[i +... | # ABC145C
def main():
import sys, math
import itertools as ite
N = int(sys.stdin.readline())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
# print(L)
A = list(ite.permutations([i for i in range(N)]))
# print(A)
ans = 0
for a in A:
for i in range(N - 1)... | false | 39.130435 | [
"-import sys",
"-import itertools",
"-import math",
"+# ABC145C",
"+def main():",
"+ import sys, math",
"+ import itertools as ite",
"-n = int(sys.stdin.readline())",
"-pos = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]",
"-a = list(itertools.permutations(pos, n))",
"-#... | false | 0.047383 | 0.047933 | 0.98852 | [
"s080420745",
"s840229710"
] |
u504836877 | p03775 | python | s473491823 | s069388857 | 82 | 70 | 3,060 | 3,060 | Accepted | Accepted | 14.63 | N = int(eval(input()))
def F(a, b):
return max(len(str(a)), len(str(b)))
ans = 100
i = 1
while i <= N**0.5:
if N%i == 0:
ans = min(ans, F(i, N//i))
i += 1
print(ans) | N = int(eval(input()))
def f(a, b):
return max(len(str(a)), len(str(b)))
ans = N
i = 1
while i <= N**0.5:
if N%i == 0:
ans = min(ans, f(i, N//i))
i += 1
print(ans) | 13 | 13 | 198 | 192 | N = int(eval(input()))
def F(a, b):
return max(len(str(a)), len(str(b)))
ans = 100
i = 1
while i <= N**0.5:
if N % i == 0:
ans = min(ans, F(i, N // i))
i += 1
print(ans)
| N = int(eval(input()))
def f(a, b):
return max(len(str(a)), len(str(b)))
ans = N
i = 1
while i <= N**0.5:
if N % i == 0:
ans = min(ans, f(i, N // i))
i += 1
print(ans)
| false | 0 | [
"-def F(a, b):",
"+def f(a, b):",
"-ans = 100",
"+ans = N",
"- ans = min(ans, F(i, N // i))",
"+ ans = min(ans, f(i, N // i))"
] | false | 0.326413 | 0.007378 | 44.241901 | [
"s473491823",
"s069388857"
] |
u502314533 | p03231 | python | s143061295 | s572143746 | 46 | 36 | 5,432 | 5,432 | Accepted | Accepted | 21.74 | from fractions import *
def lcm(a,b):
return int(abs(a * b) / gcd(a,b) if a and b else 0)
def getDivisors(a,b):
divisors = []
for i in range(2,min(a,b)+1):
if a % i == 0 and b % i == 0:
divisors.append(i)
return divisors
N,M = list(map(int,input().split()))
a = eval(... | from fractions import gcd
def lcm(a,b):
return int(abs(a * b) / gcd(a,b) if a and b else 0)
N,M = list(map(int,input().split()))
S = eval(input())
T = eval(input())
g = gcd(N,M)
n = N // g
m = M // g
for k in range(g):
if S[k * n] != T[k * m]:
print((-1))
quit()
print((lcm(... | 38 | 18 | 753 | 304 | from fractions import *
def lcm(a, b):
return int(abs(a * b) / gcd(a, b) if a and b else 0)
def getDivisors(a, b):
divisors = []
for i in range(2, min(a, b) + 1):
if a % i == 0 and b % i == 0:
divisors.append(i)
return divisors
N, M = list(map(int, input().split()))
a = eval(in... | from fractions import gcd
def lcm(a, b):
return int(abs(a * b) / gcd(a, b) if a and b else 0)
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = gcd(N, M)
n = N // g
m = M // g
for k in range(g):
if S[k * n] != T[k * m]:
print((-1))
quit()
print((lcm(N, M)))
| false | 52.631579 | [
"-from fractions import *",
"+from fractions import gcd",
"-def getDivisors(a, b):",
"- divisors = []",
"- for i in range(2, min(a, b) + 1):",
"- if a % i == 0 and b % i == 0:",
"- divisors.append(i)",
"- return divisors",
"-",
"-",
"-a = eval(input())",
"-b = eval(i... | false | 0.051437 | 0.059624 | 0.862688 | [
"s143061295",
"s572143746"
] |
u777923818 | p03475 | python | s202745695 | s458540721 | 92 | 77 | 3,188 | 3,188 | Accepted | Accepted | 16.3 | # -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
stations = []
for _ in range(N-1):
stations.append(inpl())
P = []
for i in range(N-1):
C, S, F = stations[i]
P = [C + max(S, F*(p//F + int(p%F!=0))) for p in P]
P.append(S+C)
for p in P... | # -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
stations = [inpl() for _ in range(N-1)]
for i in range(N):
now = 0
for C, S, F in stations[i:]:
if now <= S:
now = S
now = S + -(-(now - S)//F)*F + C
print(no... | 18 | 14 | 339 | 317 | # -*- coding: utf-8 -*-
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
stations = []
for _ in range(N - 1):
stations.append(inpl())
P = []
for i in range(N - 1):
C, S, F = stations[i]
P = [C + max(S, F * (p // F + int(p % F != 0))) for p in P]
P.append(S + C)
for p in P:... | # -*- coding: utf-8 -*-
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
stations = [inpl() for _ in range(N - 1)]
for i in range(N):
now = 0
for C, S, F in stations[i:]:
if now <= S:
now = S
now = S + -(-(now - S) // F) * F + C
print(now)
| false | 22.222222 | [
"-stations = []",
"-for _ in range(N - 1):",
"- stations.append(inpl())",
"-P = []",
"-for i in range(N - 1):",
"- C, S, F = stations[i]",
"- P = [C + max(S, F * (p // F + int(p % F != 0))) for p in P]",
"- P.append(S + C)",
"-for p in P:",
"- print(p)",
"-print((0))",
"+station... | false | 0.041174 | 0.040927 | 1.006036 | [
"s202745695",
"s458540721"
] |
u111365362 | p03074 | python | s240180598 | s556057568 | 392 | 76 | 24,500 | 10,492 | Accepted | Accepted | 80.61 | N,K = list(map(int,input().split()))
S = eval(input())
if S[0] == '0':
divide = []
else:
divide = [0]
tmp = 1
for i in range(1,N):
if S[i] == S[i-1]:
tmp += 1
else:
divide += [tmp]
tmp = 1
divide += [tmp]
le = len(divide)
zero = [0]*2*le + divide + [0]*2*le
su = [0]
for i in range(0... | #20:03
n,k = list(map(int,input().split()))
s = eval(input())
if s[0] == '1':
can01 = [0]
can10 = []
else:
can01 = [0]
can10 = [0]
for i in range(1,n):
if s[i-1] == '0' and s[i] == '1':
can01.append(i)
elif s[i-1] == '1' and s[i] == '0':
can10.append(i)
if s[n-1] == '1':
can10.appen... | 30 | 27 | 533 | 540 | N, K = list(map(int, input().split()))
S = eval(input())
if S[0] == "0":
divide = []
else:
divide = [0]
tmp = 1
for i in range(1, N):
if S[i] == S[i - 1]:
tmp += 1
else:
divide += [tmp]
tmp = 1
divide += [tmp]
le = len(divide)
zero = [0] * 2 * le + divide + [0] * 2 * le
su = [0]
... | # 20:03
n, k = list(map(int, input().split()))
s = eval(input())
if s[0] == "1":
can01 = [0]
can10 = []
else:
can01 = [0]
can10 = [0]
for i in range(1, n):
if s[i - 1] == "0" and s[i] == "1":
can01.append(i)
elif s[i - 1] == "1" and s[i] == "0":
can10.append(i)
if s[n - 1] == "1"... | false | 10 | [
"-N, K = list(map(int, input().split()))",
"-S = eval(input())",
"-if S[0] == \"0\":",
"- divide = []",
"+# 20:03",
"+n, k = list(map(int, input().split()))",
"+s = eval(input())",
"+if s[0] == \"1\":",
"+ can01 = [0]",
"+ can10 = []",
"- divide = [0]",
"-tmp = 1",
"-for i in ran... | false | 0.097616 | 0.038409 | 2.541506 | [
"s240180598",
"s556057568"
] |
u269969976 | p03329 | python | s868915125 | s453213328 | 935 | 326 | 3,864 | 6,124 | Accepted | Accepted | 65.13 | # coding:utf-8
n = int(input().rstrip())
dic = [None for i in range(n + 1)]
def get_ans(amount:int):
if dic[amount] is not None:
return dic[amount]
if amount <= 0:
return 0
ans = amount
for i in reversed(list(range(6))):
num = pow(9, i)
if num > amoun... | # coding: utf-8
def get_pow(target: int, base: int):
ans = 0
current = base
for i in range(1, target + 1):
if current > target:
break
ans = i
current *= base
return ans
dic = {}
def get_ans(remain: int):
if remain in dic:
return dic[... | 32 | 39 | 649 | 794 | # coding:utf-8
n = int(input().rstrip())
dic = [None for i in range(n + 1)]
def get_ans(amount: int):
if dic[amount] is not None:
return dic[amount]
if amount <= 0:
return 0
ans = amount
for i in reversed(list(range(6))):
num = pow(9, i)
if num > amount:
con... | # coding: utf-8
def get_pow(target: int, base: int):
ans = 0
current = base
for i in range(1, target + 1):
if current > target:
break
ans = i
current *= base
return ans
dic = {}
def get_ans(remain: int):
if remain in dic:
return dic[remain]
if rema... | false | 17.948718 | [
"-# coding:utf-8",
"-n = int(input().rstrip())",
"-dic = [None for i in range(n + 1)]",
"-",
"-",
"-def get_ans(amount: int):",
"- if dic[amount] is not None:",
"- return dic[amount]",
"- if amount <= 0:",
"- return 0",
"- ans = amount",
"- for i in reversed(list(rang... | false | 0.149582 | 0.068722 | 2.176633 | [
"s868915125",
"s453213328"
] |
u698919163 | p02959 | python | s270773010 | s622314067 | 245 | 110 | 19,004 | 97,280 | Accepted | Accepted | 55.1 | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
start = [0]*(N+1)
attack = 0
enemy = 0
for i in range(N+1):
start[i] = A[i]
for i in range(N):
attack = min(A[i],B[i])
A[i] = A[i] - attack
B[i] = B[i] - attack
attack = min(A[i+1],B[i])
... | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
tmp = 0
if A[i] >= B[i]:
A[i] -= B[i]
ans += B[i]
else:
ans += A[i]
tmp = B[i] - A[i]
A[i] = 0
if A[i+1] >= tmp:
... | 22 | 23 | 450 | 451 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
start = [0] * (N + 1)
attack = 0
enemy = 0
for i in range(N + 1):
start[i] = A[i]
for i in range(N):
attack = min(A[i], B[i])
A[i] = A[i] - attack
B[i] = B[i] - attack
attack = min(A[i + 1], B[i])
A[i ... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
tmp = 0
if A[i] >= B[i]:
A[i] -= B[i]
ans += B[i]
else:
ans += A[i]
tmp = B[i] - A[i]
A[i] = 0
if A[i + 1] >= tmp:
A[i + 1] -=... | false | 4.347826 | [
"-start = [0] * (N + 1)",
"-attack = 0",
"-enemy = 0",
"-for i in range(N + 1):",
"- start[i] = A[i]",
"+ans = 0",
"- attack = min(A[i], B[i])",
"- A[i] = A[i] - attack",
"- B[i] = B[i] - attack",
"- attack = min(A[i + 1], B[i])",
"- A[i + 1] = A[i + 1] - attack",
"- B[i] ... | false | 0.048443 | 0.047153 | 1.027364 | [
"s270773010",
"s622314067"
] |
u327466606 | p03334 | python | s693386159 | s723521343 | 928 | 591 | 19,284 | 21,424 | Accepted | Accepted | 36.31 | from math import sqrt
from itertools import product
import numpy as np
def helper(N,D):
if D%2 == 1:
grid = np.zeros((N,N),dtype=bool)
grid[::2,:] = True
grid[:,1::2] = ~grid[:,1::2]
elif D%4 == 2:
grid = np.zeros((N,N),dtype=bool)
grid[::2,:] = True
else:
M = (N-1)//2+1
... | from math import sqrt
from itertools import product
import numpy as np
def judge(D):
n = 1
while D%4==0:
n *= 2
D //= 4
def h1(x,y):
return ~(x//n+y//n)%2
def h2(x,y):
return ~(x//n)%2
return h1 if D%2==1 else h2
N,D1,D2 = list(map(int,input().split()))
j1,j2 = judge(D1... | 35 | 27 | 702 | 467 | from math import sqrt
from itertools import product
import numpy as np
def helper(N, D):
if D % 2 == 1:
grid = np.zeros((N, N), dtype=bool)
grid[::2, :] = True
grid[:, 1::2] = ~grid[:, 1::2]
elif D % 4 == 2:
grid = np.zeros((N, N), dtype=bool)
grid[::2, :] = True
el... | from math import sqrt
from itertools import product
import numpy as np
def judge(D):
n = 1
while D % 4 == 0:
n *= 2
D //= 4
def h1(x, y):
return ~(x // n + y // n) % 2
def h2(x, y):
return ~(x // n) % 2
return h1 if D % 2 == 1 else h2
N, D1, D2 = list(map(int, ... | false | 22.857143 | [
"-def helper(N, D):",
"- if D % 2 == 1:",
"- grid = np.zeros((N, N), dtype=bool)",
"- grid[::2, :] = True",
"- grid[:, 1::2] = ~grid[:, 1::2]",
"- elif D % 4 == 2:",
"- grid = np.zeros((N, N), dtype=bool)",
"- grid[::2, :] = True",
"- else:",
"- M... | false | 0.302797 | 0.03839 | 7.8873 | [
"s693386159",
"s723521343"
] |
u569960318 | p02417 | python | s758849235 | s228781169 | 30 | 20 | 7,532 | 7,400 | Accepted | Accepted | 33.33 | import sys
cnts = {}
for line in sys.stdin:
alpha_line = [x.lower() for x in list([c for c in list(line) if c.isalpha()])]
for c in alpha_line:
cnts[c] = cnts.get(c,0) + 1
for c in range(ord('a'),ord('z')+1): print((chr(c),':',cnts.get(chr(c),0))) | import sys
cnts = {}
for line in sys.stdin:
for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1
for c in range(ord('a'),ord('z')+1): print((chr(c),':',cnts.get(chr(c),0))) | 8 | 6 | 274 | 185 | import sys
cnts = {}
for line in sys.stdin:
alpha_line = [x.lower() for x in list([c for c in list(line) if c.isalpha()])]
for c in alpha_line:
cnts[c] = cnts.get(c, 0) + 1
for c in range(ord("a"), ord("z") + 1):
print((chr(c), ":", cnts.get(chr(c), 0)))
| import sys
cnts = {}
for line in sys.stdin:
for c in list(line.lower()):
cnts[c] = cnts.get(c, 0) + 1
for c in range(ord("a"), ord("z") + 1):
print((chr(c), ":", cnts.get(chr(c), 0)))
| false | 25 | [
"- alpha_line = [x.lower() for x in list([c for c in list(line) if c.isalpha()])]",
"- for c in alpha_line:",
"+ for c in list(line.lower()):"
] | false | 0.049729 | 0.050602 | 0.982747 | [
"s758849235",
"s228781169"
] |
u218843509 | p02633 | python | s426589294 | s817661596 | 73 | 26 | 61,680 | 9,096 | Accepted | Accepted | 64.38 | from math import gcd
print((360 //gcd(360, int(eval(input())))))
| import math
print((360//math.gcd(360,int(eval(input()))))) | 2 | 2 | 58 | 51 | from math import gcd
print((360 // gcd(360, int(eval(input())))))
| import math
print((360 // math.gcd(360, int(eval(input())))))
| false | 0 | [
"-from math import gcd",
"+import math",
"-print((360 // gcd(360, int(eval(input())))))",
"+print((360 // math.gcd(360, int(eval(input())))))"
] | false | 0.077732 | 0.096462 | 0.805836 | [
"s426589294",
"s817661596"
] |
u606045429 | p03937 | python | s626275338 | s293292172 | 27 | 17 | 3,064 | 2,940 | Accepted | Accepted | 37.04 | H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
def dfs(h, w, count):
if (h, w) == (H - 1, W - 1):
return count
ans = 0
for nh, nw in [(h + 1, w), (h, w + 1)]:
if 0 <= nh < H and 0 <= nw < W and A[nh][nw] == "#":
ans += dfs(nh, nw,... | H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
if H + W - 1 == sum(a.count("#") for a in A):
print("Possible")
else:
print("Impossible")
| 17 | 7 | 449 | 184 | H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
def dfs(h, w, count):
if (h, w) == (H - 1, W - 1):
return count
ans = 0
for nh, nw in [(h + 1, w), (h, w + 1)]:
if 0 <= nh < H and 0 <= nw < W and A[nh][nw] == "#":
ans += dfs(nh, nw, count + 1... | H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
if H + W - 1 == sum(a.count("#") for a in A):
print("Possible")
else:
print("Impossible")
| false | 58.823529 | [
"-",
"-",
"-def dfs(h, w, count):",
"- if (h, w) == (H - 1, W - 1):",
"- return count",
"- ans = 0",
"- for nh, nw in [(h + 1, w), (h, w + 1)]:",
"- if 0 <= nh < H and 0 <= nw < W and A[nh][nw] == \"#\":",
"- ans += dfs(nh, nw, count + 1)",
"- return ans",
"-... | false | 0.046591 | 0.044141 | 1.055504 | [
"s626275338",
"s293292172"
] |
u546285759 | p00007 | python | s364550872 | s138523455 | 30 | 20 | 7,536 | 7,708 | Accepted | Accepted | 33.33 | from math import ceil
debt = 100000
n = int(eval(input()))
for _ in range(n):
tmp = ceil(debt*1.05)
debt = ceil((tmp/1000))*1000
print(debt) | import math
debt = 100000
n = int(eval(input()))
for i in range(n):
interest = 0.05 * debt
debt += (math.ceil(interest / 1000) * 1000)
print(debt) | 7 | 7 | 148 | 154 | from math import ceil
debt = 100000
n = int(eval(input()))
for _ in range(n):
tmp = ceil(debt * 1.05)
debt = ceil((tmp / 1000)) * 1000
print(debt)
| import math
debt = 100000
n = int(eval(input()))
for i in range(n):
interest = 0.05 * debt
debt += math.ceil(interest / 1000) * 1000
print(debt)
| false | 0 | [
"-from math import ceil",
"+import math",
"-for _ in range(n):",
"- tmp = ceil(debt * 1.05)",
"- debt = ceil((tmp / 1000)) * 1000",
"+for i in range(n):",
"+ interest = 0.05 * debt",
"+ debt += math.ceil(interest / 1000) * 1000"
] | false | 0.054467 | 0.059939 | 0.908702 | [
"s364550872",
"s138523455"
] |
u673361376 | p03418 | python | s685043281 | s397817212 | 186 | 102 | 39,152 | 3,060 | Accepted | Accepted | 45.16 | N,K = list(map(int,input().split()))
if K == 0:
print((N**2))
exit()
ans = 0
for b in range(1,N+1):
if b <= K: continue
else: ans += N//b*(b-K) + max(0,(N-(N//b)*b)-K+1)
print(ans) | N, K = list(map(int, input().split()))
if K == 0:
print((N ** 2))
exit()
ans = 0
for b in range(K + 1, N + 1):
val1 = N // b * (b - K)
if N % b == 0:
val2 = 0
else:
val2 = max(0, N - (N // b) * b - K + 1)
ans += val1 + val2
print(ans)
| 12 | 15 | 194 | 283 | N, K = list(map(int, input().split()))
if K == 0:
print((N**2))
exit()
ans = 0
for b in range(1, N + 1):
if b <= K:
continue
else:
ans += N // b * (b - K) + max(0, (N - (N // b) * b) - K + 1)
print(ans)
| N, K = list(map(int, input().split()))
if K == 0:
print((N**2))
exit()
ans = 0
for b in range(K + 1, N + 1):
val1 = N // b * (b - K)
if N % b == 0:
val2 = 0
else:
val2 = max(0, N - (N // b) * b - K + 1)
ans += val1 + val2
print(ans)
| false | 20 | [
"-for b in range(1, N + 1):",
"- if b <= K:",
"- continue",
"+for b in range(K + 1, N + 1):",
"+ val1 = N // b * (b - K)",
"+ if N % b == 0:",
"+ val2 = 0",
"- ans += N // b * (b - K) + max(0, (N - (N // b) * b) - K + 1)",
"+ val2 = max(0, N - (N // b) * b - K + ... | false | 0.040172 | 0.054727 | 0.734037 | [
"s685043281",
"s397817212"
] |
u692453235 | p02813 | python | s680508476 | s388563852 | 50 | 37 | 8,052 | 8,052 | Accepted | Accepted | 26 | import itertools
N = int(eval(input()))
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
L = [i for i in range(1, N+1)]
a = 0
b = 0
#順列作成
L_list = list(itertools.permutations(L))
for i in range(len(L_list)):
if list(L_list[i]) == P:
a = i+1
if list(L_list[i]) == Q:
... | #パクリ
import itertools
N = int(eval(input()))
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
lis=list(itertools.permutations(P))
lis.sort()
#indexで要素の何番目か取得
print((abs(lis.index(P)-lis.index(Q))))
| 20 | 12 | 340 | 227 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = [i for i in range(1, N + 1)]
a = 0
b = 0
# 順列作成
L_list = list(itertools.permutations(L))
for i in range(len(L_list)):
if list(L_list[i]) == P:
a = i + 1
if list(L_list[i]) == Q:
b... | # パクリ
import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
lis = list(itertools.permutations(P))
lis.sort()
# indexで要素の何番目か取得
print((abs(lis.index(P) - lis.index(Q))))
| false | 40 | [
"+# パクリ",
"-P = list(map(int, input().split()))",
"-Q = list(map(int, input().split()))",
"-L = [i for i in range(1, N + 1)]",
"-a = 0",
"-b = 0",
"-# 順列作成",
"-L_list = list(itertools.permutations(L))",
"-for i in range(len(L_list)):",
"- if list(L_list[i]) == P:",
"- a = i + 1",
"- ... | false | 0.100188 | 0.041019 | 2.442486 | [
"s680508476",
"s388563852"
] |
u046187684 | p02982 | python | s592823508 | s569584163 | 196 | 171 | 38,384 | 38,384 | Accepted | Accepted | 12.76 | import math
from itertools import combinations
N,D = list(map(int,input().split()))
X = [list(map(float, input().split())) for i in range(N)]
counter = 0
for x0,x1 in combinations(X, 2):
if math.sqrt(sum([(a-b)**2 for a, b in zip(x0,x1)])).is_integer():
counter+=1
print(counter)
| import math
from itertools import combinations
N,D = list(map(int,input().split()))
X = [list(map(float, input().split())) for i in range(N)]
counter = [(sum([(a-b)**2 for a, b in zip(x0,x1)])**0.5).is_integer() for x0,x1 in combinations(X, 2)]
print((sum(counter)))
| 9 | 6 | 294 | 264 | import math
from itertools import combinations
N, D = list(map(int, input().split()))
X = [list(map(float, input().split())) for i in range(N)]
counter = 0
for x0, x1 in combinations(X, 2):
if math.sqrt(sum([(a - b) ** 2 for a, b in zip(x0, x1)])).is_integer():
counter += 1
print(counter)
| import math
from itertools import combinations
N, D = list(map(int, input().split()))
X = [list(map(float, input().split())) for i in range(N)]
counter = [
(sum([(a - b) ** 2 for a, b in zip(x0, x1)]) ** 0.5).is_integer()
for x0, x1 in combinations(X, 2)
]
print((sum(counter)))
| false | 33.333333 | [
"-counter = 0",
"-for x0, x1 in combinations(X, 2):",
"- if math.sqrt(sum([(a - b) ** 2 for a, b in zip(x0, x1)])).is_integer():",
"- counter += 1",
"-print(counter)",
"+counter = [",
"+ (sum([(a - b) ** 2 for a, b in zip(x0, x1)]) ** 0.5).is_integer()",
"+ for x0, x1 in combinations(X... | false | 0.037708 | 0.037516 | 1.005108 | [
"s592823508",
"s569584163"
] |
u816488327 | p02863 | python | s448802687 | s021416498 | 1,970 | 310 | 357,500 | 83,176 | Accepted | Accepted | 84.26 | def solve():
from sys import stdin
f_i = stdin
N, T = list(map(int, f_i.readline().split()))
AB = [tuple(map(int, f_i.readline().split())) for i in range(N)]
AB.sort()
dp = [[0] * T for i in range(N + 1)]
for i, AB_i in enumerate(AB, start=1):
A_i, B_i = AB_... | def solve():
import numpy as np
from sys import stdin
f_i = stdin
N, T = list(map(int, f_i.readline().split()))
AB = [tuple(map(int, f_i.readline().split())) for i in range(N)]
AB.sort()
max_Ai = AB[-1][0]
dp = [[0] * T for i in range(N + 1)]
dp = np.zeros(max_Ai... | 26 | 20 | 690 | 469 | def solve():
from sys import stdin
f_i = stdin
N, T = list(map(int, f_i.readline().split()))
AB = [tuple(map(int, f_i.readline().split())) for i in range(N)]
AB.sort()
dp = [[0] * T for i in range(N + 1)]
for i, AB_i in enumerate(AB, start=1):
A_i, B_i = AB_i
dp_i = dp[i]
... | def solve():
import numpy as np
from sys import stdin
f_i = stdin
N, T = list(map(int, f_i.readline().split()))
AB = [tuple(map(int, f_i.readline().split())) for i in range(N)]
AB.sort()
max_Ai = AB[-1][0]
dp = [[0] * T for i in range(N + 1)]
dp = np.zeros(max_Ai + T, dtype=int)
... | false | 23.076923 | [
"+ import numpy as np",
"+ max_Ai = AB[-1][0]",
"- for i, AB_i in enumerate(AB, start=1):",
"- A_i, B_i = AB_i",
"- dp_i = dp[i]",
"- dp_pre = dp[i - 1]",
"- dp_i[:A_i] = dp_pre[:A_i]",
"- for j, t in enumerate(zip(dp_pre[A_i:], dp_pre), start=A_i):",
"- ... | false | 0.076634 | 0.232885 | 0.329063 | [
"s448802687",
"s021416498"
] |
u531436689 | p03815 | python | s405877318 | s565850402 | 63 | 41 | 6,224 | 5,460 | Accepted | Accepted | 34.92 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): r... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): r... | 47 | 36 | 1,137 | 880 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def ... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def ... | false | 23.404255 | [
"- if res > 0 and rot % 2 == 0:",
"- if res <= 6:",
"- ans += 1",
"- else:",
"- ans += 2",
"- elif res > 0 and rot % 2 == 1:",
"- if res <= 5:",
"- ans += 1",
"- else:",
"- ans += 2",
"- else:",
"- pass",
... | false | 0.036688 | 0.068376 | 0.536567 | [
"s405877318",
"s565850402"
] |
u847467233 | p00616 | python | s640250379 | s874795469 | 170 | 130 | 10,276 | 10,136 | Accepted | Accepted | 23.53 | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
# n <= 500, 2^9 = 512
while True:
n, h = list(map(int, input().split()))
if n == 0: break
ans = []
for i in range(h):
c, a, b = input().split()
a, b = int(a)-1, int(b)-1
if c == "x... | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
# n <= 500, 2^9 = 512
while True:
n, h = list(map(int, input().split()))
if n == 0: break
ans = []
for i in range(h):
s = eval(input())
c = s[:2]
a, b = s[3:].split()
a, b = int... | 22 | 27 | 518 | 571 | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
# n <= 500, 2^9 = 512
while True:
n, h = list(map(int, input().split()))
if n == 0:
break
ans = []
for i in range(h):
c, a, b = input().split()
a, b = int(a) - 1, int... | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
# n <= 500, 2^9 = 512
while True:
n, h = list(map(int, input().split()))
if n == 0:
break
ans = []
for i in range(h):
s = eval(input())
c = s[:2]
a, b = s[3:]... | false | 18.518519 | [
"- c, a, b = input().split()",
"+ s = eval(input())",
"+ c = s[:2]",
"+ a, b = s[3:].split()",
"- ans += [a + (b << 9) + (z << 18) for z in range(n)]",
"+ k = a + (b << 9)",
"+ ans += [k + (z << 18) for z in range(n)]",
"- ans += ... | false | 0.045048 | 0.04186 | 1.076175 | [
"s640250379",
"s874795469"
] |
u353919145 | p02789 | python | s051660675 | s735349100 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | r = input ().split ()
print(("Yes" if r[0] == r[1] else "No")) | l = list(input().split())
N = int(l[0])
M = int(l[1])
if (N == M) :
print ("Yes")
else :
print ("No") | 2 | 7 | 62 | 115 | r = input().split()
print(("Yes" if r[0] == r[1] else "No"))
| l = list(input().split())
N = int(l[0])
M = int(l[1])
if N == M:
print("Yes")
else:
print("No")
| false | 71.428571 | [
"-r = input().split()",
"-print((\"Yes\" if r[0] == r[1] else \"No\"))",
"+l = list(input().split())",
"+N = int(l[0])",
"+M = int(l[1])",
"+if N == M:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.041843 | 0.044262 | 0.945344 | [
"s051660675",
"s735349100"
] |
u605879293 | p02389 | python | s602110536 | s296171528 | 30 | 20 | 7,580 | 7,644 | Accepted | Accepted | 33.33 | x = eval(input())
a, b = tuple(x.split())
a = int(a)
b = int(b)
print((a * b, 2 * a + 2 * b)) | x, y = input().split()
x, y = int(x), int(y)
print((x * y, 2 * (x + y))) | 5 | 3 | 89 | 72 | x = eval(input())
a, b = tuple(x.split())
a = int(a)
b = int(b)
print((a * b, 2 * a + 2 * b))
| x, y = input().split()
x, y = int(x), int(y)
print((x * y, 2 * (x + y)))
| false | 40 | [
"-x = eval(input())",
"-a, b = tuple(x.split())",
"-a = int(a)",
"-b = int(b)",
"-print((a * b, 2 * a + 2 * b))",
"+x, y = input().split()",
"+x, y = int(x), int(y)",
"+print((x * y, 2 * (x + y)))"
] | false | 0.03628 | 0.045174 | 0.803105 | [
"s602110536",
"s296171528"
] |
u830054172 | p03722 | python | s512657373 | s058120719 | 1,704 | 1,041 | 3,440 | 3,444 | Accepted | Accepted | 38.91 | #負の経路の検出
def find_negative_loop(n, es, d):
#始点はどこでもよい
check = [0 for _ in range(n)]
for _ in range(n):
for p, q, r in es:
#e: 辺iについて
if d[p] != float("inf") and d[q] > d[p] + r:
d[q] = d[p] + r
check[q] = True
if check[p]:... | n, m = list(map(int, input().split()))
edge = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
edge.append([a-1, b-1, -c])
d = [float("inf") for _ in range(n)]
d[0] = 0
check = [0 for _ in range(n)]
for i in range(n):
for now, next, weight in edge:
if d[next] > d[now... | 61 | 26 | 1,378 | 561 | # 負の経路の検出
def find_negative_loop(n, es, d):
# 始点はどこでもよい
check = [0 for _ in range(n)]
for _ in range(n):
for p, q, r in es:
# e: 辺iについて
if d[p] != float("inf") and d[q] > d[p] + r:
d[q] = d[p] + r
check[q] = True
if check[p]:
... | n, m = list(map(int, input().split()))
edge = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
edge.append([a - 1, b - 1, -c])
d = [float("inf") for _ in range(n)]
d[0] = 0
check = [0 for _ in range(n)]
for i in range(n):
for now, next, weight in edge:
if d[next] > d[now] + weight:
... | false | 57.377049 | [
"-# 負の経路の検出",
"-def find_negative_loop(n, es, d):",
"- # 始点はどこでもよい",
"- check = [0 for _ in range(n)]",
"- for _ in range(n):",
"- for p, q, r in es:",
"- # e: 辺iについて",
"- if d[p] != float(\"inf\") and d[q] > d[p] + r:",
"- d[q] = d[p] + r",
"- ... | false | 0.072832 | 0.041596 | 1.750935 | [
"s512657373",
"s058120719"
] |
u841568901 | p03262 | python | s906425514 | s244427932 | 81 | 66 | 20,440 | 20,416 | Accepted | Accepted | 18.52 | import math
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
L = ([abs(x-A) for x in X])
S = L[0]
for i in range(1, N):
S = math.gcd(S,L[i])
print(S) | import math
from functools import reduce
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
L = ([abs(x-A) for x in X])
print((reduce(math.gcd, L))) | 8 | 6 | 178 | 169 | import math
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
L = [abs(x - A) for x in X]
S = L[0]
for i in range(1, N):
S = math.gcd(S, L[i])
print(S)
| import math
from functools import reduce
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
L = [abs(x - A) for x in X]
print((reduce(math.gcd, L)))
| false | 25 | [
"+from functools import reduce",
"-S = L[0]",
"-for i in range(1, N):",
"- S = math.gcd(S, L[i])",
"-print(S)",
"+print((reduce(math.gcd, L)))"
] | false | 0.047589 | 0.047698 | 0.997704 | [
"s906425514",
"s244427932"
] |
u163783894 | p02925 | python | s832371499 | s352835949 | 1,698 | 1,359 | 35,436 | 38,056 | Accepted | Accepted | 19.96 | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
def solve():
N = int(eval(input()))
A = [[] for _ in range(N)]
for i in range(N):
A[i] = list([int(x) - 1 for x in input().split()])
# print(A)
days = 0
ta = [i for i in range(N)]
... | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
def solve():
N = int(eval(input()))
A = [deque for _ in range(N)]
for i in range(N):
A[i] = deque(list([int(x) - 1 for x in input().split()]))
days = 0
ta = [i for i in range(N)]
while ... | 48 | 46 | 1,036 | 1,031 | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
def solve():
N = int(eval(input()))
A = [[] for _ in range(N)]
for i in range(N):
A[i] = list([int(x) - 1 for x in input().split()])
# print(A)
days = 0
ta = [i for i in range(N)]
while True:
... | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
def solve():
N = int(eval(input()))
A = [deque for _ in range(N)]
for i in range(N):
A[i] = deque(list([int(x) - 1 for x in input().split()]))
days = 0
ta = [i for i in range(N)]
while True:
... | false | 4.166667 | [
"- A = [[] for _ in range(N)]",
"+ A = [deque for _ in range(N)]",
"- A[i] = list([int(x) - 1 for x in input().split()])",
"- # print(A)",
"+ A[i] = deque(list([int(x) - 1 for x in input().split()]))",
"- A[t].pop(0)",
"+ A[t].popleft()"
] | false | 0.048482 | 0.048412 | 1.001446 | [
"s832371499",
"s352835949"
] |
u698919163 | p02688 | python | s680455089 | s903932752 | 24 | 22 | 9,204 | 9,184 | Accepted | Accepted | 8.33 | N,K = list(map(int,input().split()))
list_A = [0]*N
ans = 0
d = []
A = []
for i in range(K):
d.append(int(eval(input())))
A.append(list(map(int,input().split())))
list_A = [0]*N
for i in range(len(A)):
for j in A[i]:
list_A[j-1] += 1
for i in range(N):
if list_A[i]... | N,K = list(map(int,input().split()))
tmp_A = [0]*N
ans = 0
for i in range(K):
d = int(eval(input()))
A = list(map(int,input().split()))
for j in range(d):
tmp_A[A[j]-1] += 1
for i in range(N):
if tmp_A[i] == 0:
ans += 1
print(ans) | 22 | 15 | 354 | 283 | N, K = list(map(int, input().split()))
list_A = [0] * N
ans = 0
d = []
A = []
for i in range(K):
d.append(int(eval(input())))
A.append(list(map(int, input().split())))
list_A = [0] * N
for i in range(len(A)):
for j in A[i]:
list_A[j - 1] += 1
for i in range(N):
if list_A[i] == 0:
ans += ... | N, K = list(map(int, input().split()))
tmp_A = [0] * N
ans = 0
for i in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for j in range(d):
tmp_A[A[j] - 1] += 1
for i in range(N):
if tmp_A[i] == 0:
ans += 1
print(ans)
| false | 31.818182 | [
"-list_A = [0] * N",
"+tmp_A = [0] * N",
"-d = []",
"-A = []",
"- d.append(int(eval(input())))",
"- A.append(list(map(int, input().split())))",
"-list_A = [0] * N",
"-for i in range(len(A)):",
"- for j in A[i]:",
"- list_A[j - 1] += 1",
"+ d = int(eval(input()))",
"+ A = ... | false | 0.03828 | 0.046228 | 0.828064 | [
"s680455089",
"s903932752"
] |
u210827208 | p03786 | python | s784058828 | s898011850 | 131 | 111 | 14,320 | 14,320 | Accepted | Accepted | 15.27 | n=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
S=[]
s=0
for i in range(n):
s+=A[i]
S.append(s)
ans=1
for i in reversed(list(range(n-1))):
if S[i]*2>=A[i+1]:
ans+=1
else:
break
print(ans) | n=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
ans=1
s=0
for i in range(n):
if 2*s>=A[i]:
ans+=1
else:
ans=1
s+=A[i]
print(ans) | 15 | 12 | 236 | 176 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
S = []
s = 0
for i in range(n):
s += A[i]
S.append(s)
ans = 1
for i in reversed(list(range(n - 1))):
if S[i] * 2 >= A[i + 1]:
ans += 1
else:
break
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 1
s = 0
for i in range(n):
if 2 * s >= A[i]:
ans += 1
else:
ans = 1
s += A[i]
print(ans)
| false | 20 | [
"-S = []",
"+ans = 1",
"- s += A[i]",
"- S.append(s)",
"-ans = 1",
"-for i in reversed(list(range(n - 1))):",
"- if S[i] * 2 >= A[i + 1]:",
"+ if 2 * s >= A[i]:",
"- break",
"+ ans = 1",
"+ s += A[i]"
] | false | 0.063897 | 0.048108 | 1.328199 | [
"s784058828",
"s898011850"
] |
u737758066 | p02859 | python | s269109583 | s700859656 | 195 | 178 | 38,516 | 38,256 | Accepted | Accepted | 8.72 | r = int(eval(input()))
print((r*r))
| r = int(eval(input()))
print((r**2))
| 2 | 2 | 29 | 30 | r = int(eval(input()))
print((r * r))
| r = int(eval(input()))
print((r**2))
| false | 0 | [
"-print((r * r))",
"+print((r**2))"
] | false | 0.037344 | 0.097921 | 0.381368 | [
"s269109583",
"s700859656"
] |
u764956288 | p02695 | python | s251439610 | s505659344 | 711 | 606 | 9,204 | 9,200 | Accepted | Accepted | 14.77 | # import numpy as np
# import queue
# import heapq
from itertools import combinations_with_replacement
def main():
N, M, Q = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(Q)]
As = combinations_with_replacement(list(range(1, M+1)), N)
max_tota... | from itertools import combinations_with_replacement
def main():
n_ints, max_int, n_queries = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(n_queries)]
possible_sequences = combinations_with_replacement(list(range(1, max_int+1)), n_ints)
max_scor... | 28 | 26 | 585 | 638 | # import numpy as np
# import queue
# import heapq
from itertools import combinations_with_replacement
def main():
N, M, Q = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(Q)]
As = combinations_with_replacement(list(range(1, M + 1)), N)
max_total = 0
for ... | from itertools import combinations_with_replacement
def main():
n_ints, max_int, n_queries = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(n_queries)]
possible_sequences = combinations_with_replacement(
list(range(1, max_int + 1)), n_ints
)
max_s... | false | 7.142857 | [
"-# import numpy as np",
"-# import queue",
"-# import heapq",
"- N, M, Q = list(map(int, input().split()))",
"- queries = [list(map(int, input().split())) for _ in range(Q)]",
"- As = combinations_with_replacement(list(range(1, M + 1)), N)",
"- max_total = 0",
"- for A in As:",
"- ... | false | 0.050582 | 0.049974 | 1.012182 | [
"s251439610",
"s505659344"
] |
u991567869 | p03495 | python | s745737705 | s549217825 | 200 | 110 | 39,348 | 35,996 | Accepted | Accepted | 45 | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
d = Counter(a)
d = d.most_common()
ans = 0
for i in range(len(d) - k):
ans += d[-i - 1][1]
print(ans) | from collections import Counter
n, k = list(map(int, input().split()))
a = input().split()
d = sorted(Counter(a).values())
ans = 0
for i in range(len(d) - k):
ans += d[i]
print(ans) | 12 | 11 | 220 | 192 | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
d = Counter(a)
d = d.most_common()
ans = 0
for i in range(len(d) - k):
ans += d[-i - 1][1]
print(ans)
| from collections import Counter
n, k = list(map(int, input().split()))
a = input().split()
d = sorted(Counter(a).values())
ans = 0
for i in range(len(d) - k):
ans += d[i]
print(ans)
| false | 8.333333 | [
"-a = list(map(int, input().split()))",
"-d = Counter(a)",
"-d = d.most_common()",
"+a = input().split()",
"+d = sorted(Counter(a).values())",
"- ans += d[-i - 1][1]",
"+ ans += d[i]"
] | false | 0.073949 | 0.077636 | 0.952512 | [
"s745737705",
"s549217825"
] |
u411203878 | p03474 | python | s905823058 | s958930223 | 166 | 72 | 38,384 | 61,780 | Accepted | Accepted | 56.63 | a,b = list(map(int,input().split()))
s=eval(input())
for i in range(a+b+1):
if i < a and '-' != s[i]:
continue
elif a < i and i < a+b+1 and '-' != s[i]:
continue
elif i == a and '-' == s[i]:
continue
else:
print('No')
exit()
print('Yes') | A,B = list(map(int,input().split()))
S = list(eval(input()))
check = [str(i) for i in range(10)]
okFlag = True
for key,val in enumerate(S):
if key == A:
if S[key] != '-':
okFlag = False
else:
continue
elif S[key] not in check:
okFlag = False
if okF... | 14 | 18 | 296 | 354 | a, b = list(map(int, input().split()))
s = eval(input())
for i in range(a + b + 1):
if i < a and "-" != s[i]:
continue
elif a < i and i < a + b + 1 and "-" != s[i]:
continue
elif i == a and "-" == s[i]:
continue
else:
print("No")
exit()
print("Yes")
| A, B = list(map(int, input().split()))
S = list(eval(input()))
check = [str(i) for i in range(10)]
okFlag = True
for key, val in enumerate(S):
if key == A:
if S[key] != "-":
okFlag = False
else:
continue
elif S[key] not in check:
okFlag = False
if okFlag:
prin... | false | 22.222222 | [
"-a, b = list(map(int, input().split()))",
"-s = eval(input())",
"-for i in range(a + b + 1):",
"- if i < a and \"-\" != s[i]:",
"- continue",
"- elif a < i and i < a + b + 1 and \"-\" != s[i]:",
"- continue",
"- elif i == a and \"-\" == s[i]:",
"- continue",
"- el... | false | 0.127195 | 0.036353 | 3.498894 | [
"s905823058",
"s958930223"
] |
u556589653 | p03048 | python | s859534512 | s828448918 | 1,965 | 379 | 2,940 | 40,684 | Accepted | Accepted | 80.71 | R,G,B,N = list(map(int,input().split()))
ans = 0
for i in range(0,N//R+1):
for j in range(0,(N-i*R)//G+1):
k = N - i*R -j*G
if k%B == 0 and k>= 0:
ans += 1
print(ans) | R,G,B,N = list(map(int,input().split()))
ans = 0
for i in range(0,N//R+1):
for j in range(0,N//G+1):
k = N - i*R -j*G
if k%B == 0 and k>= 0:
ans += 1
print(ans)
| 8 | 8 | 183 | 178 | R, G, B, N = list(map(int, input().split()))
ans = 0
for i in range(0, N // R + 1):
for j in range(0, (N - i * R) // G + 1):
k = N - i * R - j * G
if k % B == 0 and k >= 0:
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for i in range(0, N // R + 1):
for j in range(0, N // G + 1):
k = N - i * R - j * G
if k % B == 0 and k >= 0:
ans += 1
print(ans)
| false | 0 | [
"- for j in range(0, (N - i * R) // G + 1):",
"+ for j in range(0, N // G + 1):"
] | false | 0.06327 | 0.136399 | 0.463857 | [
"s859534512",
"s828448918"
] |
u780962115 | p02727 | python | s190336573 | s231937092 | 492 | 410 | 22,504 | 106,708 | Accepted | Accepted | 16.67 | import sys
input=sys.stdin.readline
x,y,a,b,c=list(map(int,input().split()))
a_list=list(map(int,input().split()))
a_list=sorted(a_list)
b_list=list(map(int,input().split()))
b_list=sorted(b_list)
a_list=a_list[-x:]
b_list=b_list[-y:]
c_list=list(map(int,input().split()))
for i in range(c):
c_list[i]=-... | x,y,a,b,c=list(map(int,input().split()))
a_list=list(map(int,input().split()))
a_list=sorted(a_list)
b_list=list(map(int,input().split()))
b_list=sorted(b_list)
a_list=a_list[-x:]
b_list=b_list[-y:]
c_list=list(map(int,input().split()))
for i in range(c):
c_list[i]=-c_list[i]
import heapq
heapq.heapify... | 45 | 45 | 1,037 | 1,000 | import sys
input = sys.stdin.readline
x, y, a, b, c = list(map(int, input().split()))
a_list = list(map(int, input().split()))
a_list = sorted(a_list)
b_list = list(map(int, input().split()))
b_list = sorted(b_list)
a_list = a_list[-x:]
b_list = b_list[-y:]
c_list = list(map(int, input().split()))
for i in range(c):
... | x, y, a, b, c = list(map(int, input().split()))
a_list = list(map(int, input().split()))
a_list = sorted(a_list)
b_list = list(map(int, input().split()))
b_list = sorted(b_list)
a_list = a_list[-x:]
b_list = b_list[-y:]
c_list = list(map(int, input().split()))
for i in range(c):
c_list[i] = -c_list[i]
import heapq
... | false | 0 | [
"-import sys",
"-",
"-input = sys.stdin.readline"
] | false | 0.036912 | 0.078952 | 0.467522 | [
"s190336573",
"s231937092"
] |
u493520238 | p02596 | python | s991669975 | s247685292 | 76 | 64 | 71,116 | 63,196 | Accepted | Accepted | 15.79 | k = int(eval(input()))
rem = 7%k
alreadys = [False]*k
alreadys[rem] = True
ans = 1
while True:
if rem == 0:
print(ans)
exit()
ans += 1
rem = (rem*10+7)%k
if alreadys[rem]:
print((-1))
exit()
alreadys[rem] = True | k = int(eval(input()))
rem = 7%k
for i in range(10**6+1):
if rem == 0:
print((i+1))
break
rem = (rem*10+7)%k
else:
print((-1)) | 16 | 9 | 271 | 152 | k = int(eval(input()))
rem = 7 % k
alreadys = [False] * k
alreadys[rem] = True
ans = 1
while True:
if rem == 0:
print(ans)
exit()
ans += 1
rem = (rem * 10 + 7) % k
if alreadys[rem]:
print((-1))
exit()
alreadys[rem] = True
| k = int(eval(input()))
rem = 7 % k
for i in range(10**6 + 1):
if rem == 0:
print((i + 1))
break
rem = (rem * 10 + 7) % k
else:
print((-1))
| false | 43.75 | [
"-alreadys = [False] * k",
"-alreadys[rem] = True",
"-ans = 1",
"-while True:",
"+for i in range(10**6 + 1):",
"- print(ans)",
"- exit()",
"- ans += 1",
"+ print((i + 1))",
"+ break",
"- if alreadys[rem]:",
"- print((-1))",
"- exit()",
"- ... | false | 0.426638 | 0.14795 | 2.883667 | [
"s991669975",
"s247685292"
] |
u248670337 | p02630 | python | s242248500 | s485601984 | 595 | 384 | 23,336 | 67,672 | Accepted | Accepted | 35.46 | from collections import*
eval(input());s=sum(A:=list(map(int,input().split())));A=Counter(A)
for i in range(int(eval(input()))):b,c=list(map(int,input().split()));s+=(c-b)*A[b];A[c]+=A[b];A[b]=0;print(s) | from collections import*
_,A,_,*Q=[list(map(int,l.split()))for l in open(0)];A=[a for a in A];s=sum(A);C=Counter(A)
for b,c in Q:s+=(c-b)*C[b];C[c]+=C[b];C[b]=0;print(s) | 3 | 3 | 187 | 165 | from collections import *
eval(input())
s = sum(A := list(map(int, input().split())))
A = Counter(A)
for i in range(int(eval(input()))):
b, c = list(map(int, input().split()))
s += (c - b) * A[b]
A[c] += A[b]
A[b] = 0
print(s)
| from collections import *
_, A, _, *Q = [list(map(int, l.split())) for l in open(0)]
A = [a for a in A]
s = sum(A)
C = Counter(A)
for b, c in Q:
s += (c - b) * C[b]
C[c] += C[b]
C[b] = 0
print(s)
| false | 0 | [
"-eval(input())",
"-s = sum(A := list(map(int, input().split())))",
"-A = Counter(A)",
"-for i in range(int(eval(input()))):",
"- b, c = list(map(int, input().split()))",
"- s += (c - b) * A[b]",
"- A[c] += A[b]",
"- A[b] = 0",
"+_, A, _, *Q = [list(map(int, l.split())) for l in open(0)]... | false | 0.03622 | 0.072522 | 0.499433 | [
"s242248500",
"s485601984"
] |
u425177436 | p03480 | python | s233508052 | s252735303 | 60 | 44 | 3,316 | 5,204 | Accepted | Accepted | 26.67 | S=eval(input())
N=K=len(S)
for i in range(1,N):
if S[i-1]!=S[i]:
K=min(K,max(i,N-i))
print(K) | S=eval(input())
N=len(S)
print((min([max(i,N-i) for i in range(1,N) if S[i-1]!=S[i]],default=N))) | 6 | 3 | 104 | 91 | S = eval(input())
N = K = len(S)
for i in range(1, N):
if S[i - 1] != S[i]:
K = min(K, max(i, N - i))
print(K)
| S = eval(input())
N = len(S)
print((min([max(i, N - i) for i in range(1, N) if S[i - 1] != S[i]], default=N)))
| false | 50 | [
"-N = K = len(S)",
"-for i in range(1, N):",
"- if S[i - 1] != S[i]:",
"- K = min(K, max(i, N - i))",
"-print(K)",
"+N = len(S)",
"+print((min([max(i, N - i) for i in range(1, N) if S[i - 1] != S[i]], default=N)))"
] | false | 0.036455 | 0.034238 | 1.06474 | [
"s233508052",
"s252735303"
] |
u303650160 | p02642 | python | s769660085 | s730069672 | 767 | 242 | 201,000 | 219,096 | Accepted | Accepted | 68.45 | import sys
def Not_Divisible(n,p):
maxp = max(p)
dp = [[True,0] for _ in range(maxp+1)]
for a in p:
dp[a][1]+=1
t =2
while a*t <= maxp:
if dp[a*t][0] == True :
dp[a*t][0] = False
t+=1
k=0
for d in p:
if dp[d][1] =... | import sys
def Not_Divisible(n,p):
maxp = max(p)
dp = [True for _ in range(maxp+1)]
count =[0 for _ in range(maxp+1)]
for a in p:
count[a]+=1
t =2
while a*t <= maxp:
if dp[a*t] == True :
dp[a*t] = False
t+=1
k=0
for d... | 32 | 33 | 635 | 661 | import sys
def Not_Divisible(n, p):
maxp = max(p)
dp = [[True, 0] for _ in range(maxp + 1)]
for a in p:
dp[a][1] += 1
t = 2
while a * t <= maxp:
if dp[a * t][0] == True:
dp[a * t][0] = False
t += 1
k = 0
for d in p:
if dp[d][1... | import sys
def Not_Divisible(n, p):
maxp = max(p)
dp = [True for _ in range(maxp + 1)]
count = [0 for _ in range(maxp + 1)]
for a in p:
count[a] += 1
t = 2
while a * t <= maxp:
if dp[a * t] == True:
dp[a * t] = False
t += 1
k = 0
... | false | 3.030303 | [
"- dp = [[True, 0] for _ in range(maxp + 1)]",
"+ dp = [True for _ in range(maxp + 1)]",
"+ count = [0 for _ in range(maxp + 1)]",
"- dp[a][1] += 1",
"+ count[a] += 1",
"- if dp[a * t][0] == True:",
"- dp[a * t][0] = False",
"+ if dp[a * t] =... | false | 0.110771 | 0.038682 | 2.863656 | [
"s769660085",
"s730069672"
] |
u802963389 | p03612 | python | s000849918 | s147543392 | 129 | 77 | 19,364 | 14,256 | Accepted | Accepted | 40.31 | from itertools import groupby
n = eval(input())
li = list(map(int, input().split()))
lii = [val == (itr + 1) for itr, val in enumerate(li)]
gbli = [[key, len(list(group))] for key, group in groupby(lii)]
ans = 0
for key, val in gbli:
if key:
ans += (val - 1) // 2 + 1
print(ans)
| from itertools import groupby
n = int(eval(input()))
P = list(map(int, input().split()))
T = [val == (itr + 1) for itr, val in enumerate(P)]
ans = 0
for k, v in groupby(T):
if k == True:
ans += (sum(v) - 1) // 2 + 1
print(ans) | 13 | 11 | 299 | 242 | from itertools import groupby
n = eval(input())
li = list(map(int, input().split()))
lii = [val == (itr + 1) for itr, val in enumerate(li)]
gbli = [[key, len(list(group))] for key, group in groupby(lii)]
ans = 0
for key, val in gbli:
if key:
ans += (val - 1) // 2 + 1
print(ans)
| from itertools import groupby
n = int(eval(input()))
P = list(map(int, input().split()))
T = [val == (itr + 1) for itr, val in enumerate(P)]
ans = 0
for k, v in groupby(T):
if k == True:
ans += (sum(v) - 1) // 2 + 1
print(ans)
| false | 15.384615 | [
"-n = eval(input())",
"-li = list(map(int, input().split()))",
"-lii = [val == (itr + 1) for itr, val in enumerate(li)]",
"-gbli = [[key, len(list(group))] for key, group in groupby(lii)]",
"+n = int(eval(input()))",
"+P = list(map(int, input().split()))",
"+T = [val == (itr + 1) for itr, val in enumera... | false | 0.045366 | 0.036808 | 1.23252 | [
"s000849918",
"s147543392"
] |
u546285759 | p00027 | python | s918940612 | s352816851 | 30 | 20 | 7,980 | 7,980 | Accepted | Accepted | 33.33 | from datetime import date
while True:
m, d = list(map(int, input().split()))
if m == 0:
break
result = date(2004, m, d).isoweekday()
print(("Monday"*(result==1)+"Tuesday"*(result==2)+"Wednesday"*(result==3)+"Thursday"*(result==4)+"Friday"*(result==5)+"Saturday"*(result==6)+"Sunday"*(result... | from datetime import date
while True:
m, d = list(map(int, input().split()))
if m == 0:
break
result = date(2004, m, d).isoweekday()
print(("Mon"*(result==1)+"Tues"*(result==2)+"Wednes"*(result==3)+"Thurs"*(result==4)+"Fri"*(result==5)+"Satur"*(result==6)+"Sun"*(result==7)+"day")) | 7 | 7 | 318 | 303 | from datetime import date
while True:
m, d = list(map(int, input().split()))
if m == 0:
break
result = date(2004, m, d).isoweekday()
print(
(
"Monday" * (result == 1)
+ "Tuesday" * (result == 2)
+ "Wednesday" * (result == 3)
+ "Thursday" *... | from datetime import date
while True:
m, d = list(map(int, input().split()))
if m == 0:
break
result = date(2004, m, d).isoweekday()
print(
(
"Mon" * (result == 1)
+ "Tues" * (result == 2)
+ "Wednes" * (result == 3)
+ "Thurs" * (result == ... | false | 0 | [
"- \"Monday\" * (result == 1)",
"- + \"Tuesday\" * (result == 2)",
"- + \"Wednesday\" * (result == 3)",
"- + \"Thursday\" * (result == 4)",
"- + \"Friday\" * (result == 5)",
"- + \"Saturday\" * (result == 6)",
"- + \"Sunday\" *... | false | 0.085144 | 0.05495 | 1.549495 | [
"s918940612",
"s352816851"
] |
u141610915 | p02913 | python | s563195415 | s750868308 | 807 | 724 | 247,304 | 231,048 | Accepted | Accepted | 10.29 | N = int(eval(input()))
S = list(eval(input()))
#LCSRe i番目とj番目でそれぞれ終わるような共通文字列の長さ
#i < j であるi文字目とj文字目が等しいならLCSRe[i + 1][j + 1] = LCSRe[i][j] + 1
#res_lengthよりLCSReの更新した値が大なら、その時のindexをiへ、res_lengthも更新
def longestRepeatedSubstring(s):
n = len(s)
LCSRe = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
... | N = int(eval(input()))
S = list(eval(input())) + ["!"]
dp = [[0] * N for _ in range(N)]
for j in range(1, N):
if S[0] == S[j]:
dp[0][j] = 1
res = 0
for i in range(N):
for j in range(i, N):
res = max(dp[i][j], res)
if i == N - 1 or j == N - 1:
continue
if S[i + 1] == S[j + 1] and j ... | 27 | 17 | 859 | 413 | N = int(eval(input()))
S = list(eval(input()))
# LCSRe i番目とj番目でそれぞれ終わるような共通文字列の長さ
# i < j であるi文字目とj文字目が等しいならLCSRe[i + 1][j + 1] = LCSRe[i][j] + 1
# res_lengthよりLCSReの更新した値が大なら、その時のindexをiへ、res_lengthも更新
def longestRepeatedSubstring(s):
n = len(s)
LCSRe = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
res... | N = int(eval(input()))
S = list(eval(input())) + ["!"]
dp = [[0] * N for _ in range(N)]
for j in range(1, N):
if S[0] == S[j]:
dp[0][j] = 1
res = 0
for i in range(N):
for j in range(i, N):
res = max(dp[i][j], res)
if i == N - 1 or j == N - 1:
continue
if S[i + 1] == S... | false | 37.037037 | [
"-S = list(eval(input()))",
"-# LCSRe i番目とj番目でそれぞれ終わるような共通文字列の長さ",
"-# i < j であるi文字目とj文字目が等しいならLCSRe[i + 1][j + 1] = LCSRe[i][j] + 1",
"-# res_lengthよりLCSReの更新した値が大なら、その時のindexをiへ、res_lengthも更新",
"-def longestRepeatedSubstring(s):",
"- n = len(s)",
"- LCSRe = [[0 for _ in range(n + 1)] for _ in ra... | false | 0.037604 | 0.040323 | 0.932579 | [
"s563195415",
"s750868308"
] |
u367130284 | p03608 | python | s448617630 | s057719451 | 670 | 608 | 21,284 | 17,388 | Accepted | Accepted | 9.25 | from itertools import*
from scipy.sparse.csgraph import floyd_warshall
n,m,r=list(map(int,input().split()))
*R,=list(map(int,input().split()))
table=[[0]*n for i in range(n)]
for i in range(m):
a,b,c=list(map(int,input().split()))
table[a-1][b-1]=c
table[b-1][a-1]=c
d,p=floyd_warshall(csgraph=tab... | #from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_lef... | 13 | 34 | 446 | 1,081 | from itertools import *
from scipy.sparse.csgraph import floyd_warshall
n, m, r = list(map(int, input().split()))
(*R,) = list(map(int, input().split()))
table = [[0] * n for i in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
table[a - 1][b - 1] = c
table[b - 1][a - 1] = c
d, p = f... | # from numpy import*
# from scipy import*
from collections import * # defaultdict Counter deque appendleft
from fractions import gcd
from functools import * # reduce
from itertools import * # permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import * # bis... | false | 61.764706 | [
"-from itertools import *",
"+# from numpy import*",
"+# from scipy import*",
"+from collections import * # defaultdict Counter deque appendleft",
"+from fractions import gcd",
"+from functools import * # reduce",
"+from itertools import * # permutations(\"AB\",repeat=2) combinations(\"AB\",2) produc... | false | 0.452229 | 0.494109 | 0.915242 | [
"s448617630",
"s057719451"
] |
u777923818 | p03286 | python | s769865141 | s148451258 | 447 | 18 | 8,344 | 3,064 | Accepted | Accepted | 95.97 | # -*- coding: utf-8 -*-
from bisect import bisect_left
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = []
B = []
for i in range(2**16):
A.append(int(("0{}"*16).format(*list(bin(i)[2:].zfill(16))), 2))
for i in range(2**16):
B.append(-int(("{}0"*16).format(*list(bin(i)[2:... | from bisect import bisect_left
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
U = [0]*32
L = [0]*32
U[0] = 1
for i in range(1, 32):
if i%2:
U[i] = U[i-1]*1
L[i] = L[i-1] + 2**i
else:
U[i] = U[i-1] + 2**i
L[i] = L[i-1] * 1
searched = [0]... | 23 | 28 | 628 | 651 | # -*- coding: utf-8 -*-
from bisect import bisect_left
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = []
B = []
for i in range(2**16):
A.append(int(("0{}" * 16).format(*list(bin(i)[2:].zfill(16))), 2))
for i in range(2**16):
B.append(-int(("{}0" * 16).format(*list(bin(i)[2... | from bisect import bisect_left
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
U = [0] * 32
L = [0] * 32
U[0] = 1
for i in range(1, 32):
if i % 2:
U[i] = U[i - 1] * 1
L[i] = L[i - 1] + 2**i
else:
U[i] = U[i - 1] + 2**i
L[i] = L[i - 1] * 1
searche... | false | 17.857143 | [
"-# -*- coding: utf-8 -*-",
"-A = []",
"-B = []",
"-for i in range(2**16):",
"- A.append(int((\"0{}\" * 16).format(*list(bin(i)[2:].zfill(16))), 2))",
"-for i in range(2**16):",
"- B.append(-int((\"{}0\" * 16).format(*list(bin(i)[2:].zfill(16))), 2))",
"-for j, b in enumerate(B):",
"- i = b... | false | 0.580522 | 0.037546 | 15.461688 | [
"s769865141",
"s148451258"
] |
u679759899 | p03078 | python | s197848552 | s109079857 | 977 | 370 | 155,448 | 58,204 | Accepted | Accepted | 62.13 | 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()))
xy = []
for aa in a:
for bb in b:
xy.append(aa + bb)
xy.sort(reverse=True)
t =[]
for d in xy[:k]:
for cc in c:
t.append(d+cc)
t.... | from heapq import *
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
a.append(-float('inf'))
b.append(-float('inf'))
c.append(-float('inf')... | 17 | 29 | 365 | 951 | 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()))
xy = []
for aa in a:
for bb in b:
xy.append(aa + bb)
xy.sort(reverse=True)
t = []
for d in xy[:k]:
for cc in c:
t.append(d + cc)
t.sort(reverse... | from heapq import *
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
a.append(-float("inf"))
b.append(-float("inf"))
c.append(-float("inf"))
done = {... | false | 41.37931 | [
"+from heapq import *",
"+",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-c = list(map(int, input().split()))",
"-xy = []",
"-for aa in a:",
"- for bb in b:",
"- xy.append(aa + bb)",
"-xy.sort(reverse=True)",
"-t = []",
"-for d in xy[:k]:",
"- ... | false | 0.145933 | 0.041831 | 3.488655 | [
"s197848552",
"s109079857"
] |
u279493135 | p02933 | python | s781797400 | s333743568 | 57 | 43 | 6,096 | 5,588 | Accepted | Accepted | 24.56 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | 24 | 22 | 690 | 690 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
fro... | false | 8.333333 | [
"-from itertools import permutations, combinations, product, accumulate",
"+from itertools import permutations, combinations, product",
"+from bisect import bisect",
"-if a >= 3200:",
"- print(s)",
"-else:",
"- print(\"red\")",
"+print((\"red\" if a < 3200 else s))"
] | false | 0.047202 | 0.046909 | 1.006248 | [
"s781797400",
"s333743568"
] |
u633548583 | p03250 | python | s749925163 | s914147758 | 26 | 17 | 2,940 | 2,940 | Accepted | Accepted | 34.62 | a,b,c=sorted(map(int,input().split()))
print((10*c+b+a)) | a,b,c=sorted(list(map(int,input().split())))
print((c*10+b+a)) | 2 | 2 | 55 | 61 | a, b, c = sorted(map(int, input().split()))
print((10 * c + b + a))
| a, b, c = sorted(list(map(int, input().split())))
print((c * 10 + b + a))
| false | 0 | [
"-a, b, c = sorted(map(int, input().split()))",
"-print((10 * c + b + a))",
"+a, b, c = sorted(list(map(int, input().split())))",
"+print((c * 10 + b + a))"
] | false | 0.046072 | 0.038189 | 1.206417 | [
"s749925163",
"s914147758"
] |
u066692421 | p03221 | python | s468181352 | s790821611 | 916 | 818 | 43,404 | 36,020 | Accepted | Accepted | 10.7 | list1 = input().split()
n = int(list1[0])
m = int(list1[1])
pre = [[] for i in range(n)]
for j in range(m):
data = input().split()
p = int(data[0])
y = int(data[1])
pre[p - 1].append((j, y))
inums = []
for k in range(n):
if len(pre[k]) == 0:
pass
else:
sorted_y ... | list1 = input().split()
n = int(list1[0])
m = int(list1[1])
pre = [[] for i in range(n)]
for j in range(m):
data = input().split()
p = int(data[0])
y = int(data[1])
pre[p - 1].append((j, y))
inums = [0 for z in range(m)]
for k in range(n):
if len(pre[k]) == 0:
pass
else:... | 25 | 24 | 612 | 580 | list1 = input().split()
n = int(list1[0])
m = int(list1[1])
pre = [[] for i in range(n)]
for j in range(m):
data = input().split()
p = int(data[0])
y = int(data[1])
pre[p - 1].append((j, y))
inums = []
for k in range(n):
if len(pre[k]) == 0:
pass
else:
sorted_y = sorted(pre[k], k... | list1 = input().split()
n = int(list1[0])
m = int(list1[1])
pre = [[] for i in range(n)]
for j in range(m):
data = input().split()
p = int(data[0])
y = int(data[1])
pre[p - 1].append((j, y))
inums = [0 for z in range(m)]
for k in range(n):
if len(pre[k]) == 0:
pass
else:
sorted_y... | false | 4 | [
"-inums = []",
"+inums = [0 for z in range(m)]",
"- inums.append((sorted_y[l][0], s1 + s2))",
"-ans = sorted(inums, key=lambda x: x[0])",
"+ inums[sorted_y[l][0]] = s1 + s2",
"- print((ans[h][1]))",
"+ print((inums[h]))"
] | false | 0.047293 | 0.037816 | 1.250589 | [
"s468181352",
"s790821611"
] |
u893478938 | p03173 | python | s258297710 | s370338698 | 596 | 244 | 48,016 | 47,344 | Accepted | Accepted | 59.06 | def resolve():
N = int(eval(input()))
a = list(map(int,input().split()))
DP = [[2 ** 63 -1 for _ in range(N+1)] for _ in range(N)]
SUM = [[0 for _ in range(N+1)] for _ in range(N+1)]
SUM[0][0] = 0
for i in range(N):
for j in range(i,N):
SUM[i][j+1] = SUM[i][j] + a[... | def resolve():
N = int(eval(input()))
a = list(map(int,input().split()))
DP = [[2 ** 63 -1 for _ in range(N+1)] for _ in range(N)]
SUM = [[0 for _ in range(N+1)] for _ in range(N+1)]
RANGE = [[0 for _ in range(N+1)] for _ in range(N+1)]
SUM[0][0] = 0
for i in range(N):
for... | 24 | 29 | 673 | 867 | def resolve():
N = int(eval(input()))
a = list(map(int, input().split()))
DP = [[2**63 - 1 for _ in range(N + 1)] for _ in range(N)]
SUM = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
SUM[0][0] = 0
for i in range(N):
for j in range(i, N):
SUM[i][j + 1] = SUM[i][j] + a[j]... | def resolve():
N = int(eval(input()))
a = list(map(int, input().split()))
DP = [[2**63 - 1 for _ in range(N + 1)] for _ in range(N)]
SUM = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
RANGE = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
SUM[0][0] = 0
for i in range(N):
for ... | false | 17.241379 | [
"+ RANGE = [[0 for _ in range(N + 1)] for _ in range(N + 1)]",
"+ RANGE[i][j] = i",
"- for k in range(i, j):",
"- DP[i][j] = min(DP[i][k] + DP[k][j] + SUM[i][j], DP[i][j])",
"+ for k in range(RANGE[i][j - 1], RANGE[i + 1][j] + 1):",
"+ s = DP[i... | false | 0.040562 | 0.041046 | 0.98821 | [
"s258297710",
"s370338698"
] |
u608088992 | p03457 | python | s145297307 | s090077746 | 401 | 308 | 21,108 | 3,064 | Accepted | Accepted | 23.19 | N = int(eval(input()))
I = [[int(i) for i in input().split()] for j in range(N)]
current, time = (0, 0), 0
for i in range(N):
dist = abs(current[0] - I[i][1]) + abs(current[1] - I[i][2])
if dist > I[i][0] - time or (I[i][0]- time - dist) % 2 == 1:
print("No")
break
current, time = ... | import sys
def solve():
N = int(eval(input()))
cx, cy = 0, 0
nt = 0
for _ in range(N):
t, x, y = list(map(int, input().split()))
rem = t - nt - abs(x - cx) - abs(y - cy)
if rem < 0 or rem % 2 > 0:
print("No")
break
cx, cy = x, y
... | 12 | 20 | 366 | 408 | N = int(eval(input()))
I = [[int(i) for i in input().split()] for j in range(N)]
current, time = (0, 0), 0
for i in range(N):
dist = abs(current[0] - I[i][1]) + abs(current[1] - I[i][2])
if dist > I[i][0] - time or (I[i][0] - time - dist) % 2 == 1:
print("No")
break
current, time = (I[i][1],... | import sys
def solve():
N = int(eval(input()))
cx, cy = 0, 0
nt = 0
for _ in range(N):
t, x, y = list(map(int, input().split()))
rem = t - nt - abs(x - cx) - abs(y - cy)
if rem < 0 or rem % 2 > 0:
print("No")
break
cx, cy = x, y
nt = t
... | false | 40 | [
"-N = int(eval(input()))",
"-I = [[int(i) for i in input().split()] for j in range(N)]",
"-current, time = (0, 0), 0",
"-for i in range(N):",
"- dist = abs(current[0] - I[i][1]) + abs(current[1] - I[i][2])",
"- if dist > I[i][0] - time or (I[i][0] - time - dist) % 2 == 1:",
"- print(\"No\")... | false | 0.041955 | 0.041349 | 1.014663 | [
"s145297307",
"s090077746"
] |
u127499732 | p02911 | python | s667749296 | s385040514 | 123 | 105 | 13,164 | 14,412 | Accepted | Accepted | 14.63 | def main():
import sys
import collections
n,k,q=list(map(int,input().split()))
a=[int(e) for e in sys.stdin]
point=[k-q]*n
for person,getPoint in list(collections.Counter(a).items()):
point[person-1]+=getPoint
for res in point:
print(("Yes" if res>0 else "No"))
if __nam... | def main():
import collections
n, k, q, *a = list(map(int, open(0).read().split()))
point=[k-q]*n
for person,getPoint in list(collections.Counter(a).items()):
point[person-1]+=getPoint
for res in point:
print(("Yes" if res>0 else "No"))
if __name__=="__main__":
main() | 16 | 13 | 332 | 297 | def main():
import sys
import collections
n, k, q = list(map(int, input().split()))
a = [int(e) for e in sys.stdin]
point = [k - q] * n
for person, getPoint in list(collections.Counter(a).items()):
point[person - 1] += getPoint
for res in point:
print(("Yes" if res > 0 else ... | def main():
import collections
n, k, q, *a = list(map(int, open(0).read().split()))
point = [k - q] * n
for person, getPoint in list(collections.Counter(a).items()):
point[person - 1] += getPoint
for res in point:
print(("Yes" if res > 0 else "No"))
if __name__ == "__main__":
... | false | 18.75 | [
"- import sys",
"- n, k, q = list(map(int, input().split()))",
"- a = [int(e) for e in sys.stdin]",
"+ n, k, q, *a = list(map(int, open(0).read().split()))"
] | false | 0.079589 | 0.042606 | 1.86804 | [
"s667749296",
"s385040514"
] |
u255673886 | p02787 | python | s106901311 | s275556396 | 541 | 370 | 43,756 | 233,308 | Accepted | Accepted | 31.61 | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions ... | from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
#... | 76 | 121 | 1,868 | 2,877 | from collections import deque
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import permutations, combinations
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions... | from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import product, permutations, combinations, combinations_with_replacement
from bisect import bisect_left, bisect_right
from math import sqrt, gcd, ceil, floor, fac... | false | 37.190083 | [
"-from collections import deque",
"+from collections import deque, defaultdict, Counter",
"-from itertools import permutations, combinations",
"-from collections import defaultdict, Counter",
"+from itertools import product, permutations, combinations, combinations_with_replacement",
"+from math import sq... | false | 0.0868 | 0.124106 | 0.699402 | [
"s106901311",
"s275556396"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.