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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u344655022 | p02613 | python | s868842285 | s125921863 | 196 | 177 | 79,564 | 78,800 | Accepted | Accepted | 9.69 | N = int(eval(input()))
S = [eval(input()) for x in range(N)]
dic = {
"AC":0,
"WA":0,
"TLE":0,
"RE":0
}
ac = sum(1 for x in S if x == "AC")
wa = sum(1 for x in S if x == "WA")
tl = sum(1 for x in S if x == "TLE")
re = sum(1 for x in S if x == "RE")
print(("AC x " + str(ac)))
print(("WA... | import collections
N = int(eval(input()))
S = [eval(input()) for x in range(N)]
C = collections.Counter(S)
keys = ["AC","WA","TLE","RE"]
for key in keys:
print((key + " x " + str(C[key]))) | 19 | 9 | 373 | 188 | N = int(eval(input()))
S = [eval(input()) for x in range(N)]
dic = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
ac = sum(1 for x in S if x == "AC")
wa = sum(1 for x in S if x == "WA")
tl = sum(1 for x in S if x == "TLE")
re = sum(1 for x in S if x == "RE")
print(("AC x " + str(ac)))
print(("WA x " + str(wa)))
print(("TLE x " ... | import collections
N = int(eval(input()))
S = [eval(input()) for x in range(N)]
C = collections.Counter(S)
keys = ["AC", "WA", "TLE", "RE"]
for key in keys:
print((key + " x " + str(C[key])))
| false | 52.631579 | [
"+import collections",
"+",
"-dic = {\"AC\": 0, \"WA\": 0, \"TLE\": 0, \"RE\": 0}",
"-ac = sum(1 for x in S if x == \"AC\")",
"-wa = sum(1 for x in S if x == \"WA\")",
"-tl = sum(1 for x in S if x == \"TLE\")",
"-re = sum(1 for x in S if x == \"RE\")",
"-print((\"AC x \" + str(ac)))",
"-print((\"WA ... | false | 0.040499 | 0.10747 | 0.376837 | [
"s868842285",
"s125921863"
] |
u422272120 | p02773 | python | s074793485 | s964872307 | 723 | 637 | 32,988 | 32,988 | Accepted | Accepted | 11.89 | n = int(eval(input()))
d = {}
for _ in range(n):
s = eval(input())
if not s in d:
d[s] = 1
else:
d[s] += 1
d_max = max(d.values())
ans = [k for k, v in list(d.items()) if v == d_max]
for a in sorted(ans):
print (a)
| n = int(eval(input()))
d = {}
for _ in range(n):
s = eval(input())
if s in d:
d[s] += 1
else:
d[s] = 1
d_max = max(d.values())
ans = [k for k, v in list(d.items()) if v == d_max]
for a in sorted(ans):
print (a) | 12 | 12 | 240 | 235 | n = int(eval(input()))
d = {}
for _ in range(n):
s = eval(input())
if not s in d:
d[s] = 1
else:
d[s] += 1
d_max = max(d.values())
ans = [k for k, v in list(d.items()) if v == d_max]
for a in sorted(ans):
print(a)
| n = int(eval(input()))
d = {}
for _ in range(n):
s = eval(input())
if s in d:
d[s] += 1
else:
d[s] = 1
d_max = max(d.values())
ans = [k for k, v in list(d.items()) if v == d_max]
for a in sorted(ans):
print(a)
| false | 0 | [
"- if not s in d:",
"+ if s in d:",
"+ d[s] += 1",
"+ else:",
"- else:",
"- d[s] += 1"
] | false | 0.036887 | 0.036463 | 1.011632 | [
"s074793485",
"s964872307"
] |
u946517952 | p02619 | python | s933754793 | s957644874 | 39 | 31 | 9,508 | 9,416 | Accepted | Accepted | 20.51 | days = int(eval(input()))
clast = list(map(int,input().split()))
allpref = [] #allpref[day][contest]
for i in range(days):
allpref.append(list(map(int,input().split())))
donelist = [0]*26
resultlist = []
result = 0
for i in range(days):
held = int(eval(input()))
donelist[held-1] = i+1
zan... | class Heruistics:
allpref = [] #allpref[day][contest]
donelist = [0]*26
resultlist = []
contestlist = []
def __init__(self,days):
self.days = days
self.clast = list(map(int,input().split()))
for i in range(days):
self.allpref.append(list(map(int,input()... | 20 | 30 | 484 | 888 | days = int(eval(input()))
clast = list(map(int, input().split()))
allpref = [] # allpref[day][contest]
for i in range(days):
allpref.append(list(map(int, input().split())))
donelist = [0] * 26
resultlist = []
result = 0
for i in range(days):
held = int(eval(input()))
donelist[held - 1] = i + 1
zanen = ... | class Heruistics:
allpref = [] # allpref[day][contest]
donelist = [0] * 26
resultlist = []
contestlist = []
def __init__(self, days):
self.days = days
self.clast = list(map(int, input().split()))
for i in range(days):
self.allpref.append(list(map(int, input().sp... | false | 33.333333 | [
"-days = int(eval(input()))",
"-clast = list(map(int, input().split()))",
"-allpref = [] # allpref[day][contest]",
"-for i in range(days):",
"- allpref.append(list(map(int, input().split())))",
"-donelist = [0] * 26",
"-resultlist = []",
"-result = 0",
"-for i in range(days):",
"- held = in... | false | 0.035355 | 0.045138 | 0.783265 | [
"s933754793",
"s957644874"
] |
u074220993 | p03837 | python | s474681641 | s926787655 | 507 | 180 | 9,252 | 38,836 | Accepted | Accepted | 64.5 | N, M = (int(x) for x in input().split())
graph = [[1000] * N for _ in range(N)]
before = []
for _ in range(M):
a,b,c = (int(x) for x in input().split())
before.append((a-1,b-1,c))
graph[a-1][b-1] = c
graph[b-1][a-1] = c
for i in range(N):
graph[i][i] = 0
for k in range(N):
for i i... | N, M = list(map(int, input().split()))
Edge = [tuple(map(int, input().split())) for _ in range(M)]
import numpy as np
Graph = np.array([[0 if i == j else np.inf for i in range(N)] for j in range(N)])
for a,b,c in Edge:
Graph[a-1,b-1] = c
from scipy.sparse.csgraph import dijkstra
Graph = dijkstra(Graph,dir... | 22 | 14 | 536 | 414 | N, M = (int(x) for x in input().split())
graph = [[1000] * N for _ in range(N)]
before = []
for _ in range(M):
a, b, c = (int(x) for x in input().split())
before.append((a - 1, b - 1, c))
graph[a - 1][b - 1] = c
graph[b - 1][a - 1] = c
for i in range(N):
graph[i][i] = 0
for k in range(N):
for i ... | N, M = list(map(int, input().split()))
Edge = [tuple(map(int, input().split())) for _ in range(M)]
import numpy as np
Graph = np.array([[0 if i == j else np.inf for i in range(N)] for j in range(N)])
for a, b, c in Edge:
Graph[a - 1, b - 1] = c
from scipy.sparse.csgraph import dijkstra
Graph = dijkstra(Graph, dir... | false | 36.363636 | [
"-N, M = (int(x) for x in input().split())",
"-graph = [[1000] * N for _ in range(N)]",
"-before = []",
"-for _ in range(M):",
"- a, b, c = (int(x) for x in input().split())",
"- before.append((a - 1, b - 1, c))",
"- graph[a - 1][b - 1] = c",
"- graph[b - 1][a - 1] = c",
"-for i in range... | false | 0.037076 | 0.672177 | 0.055158 | [
"s474681641",
"s926787655"
] |
u170913092 | p02572 | python | s710099591 | s681735303 | 285 | 203 | 31,592 | 31,440 | Accepted | Accepted | 28.77 | import copy
N = int(eval(input()))
A = list(map(int,input().split()))
mod = 10**9+7
partial_sum = copy.deepcopy(A)
sum_now = A[N-1]
for j in range(N-2,-1,-1):
sum_now = int((sum_now+A[j])%mod)
partial_sum[j] = sum_now
res = 0
for i in range(N-1):
res = (res + (A[i]*partial_sum[i+1])%mod) %mod... | N = int(eval(input()))
#A = [int(x) for x in input().split()]
A = list(map(int, input().split()))
mod = 10**9+7
partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
sum_now = int((sum_now+A[j])%mod)
partial_sum[j] = sum_now
res = 0
for i in range(N-1):
res = (res + (A[i]*partial_s... | 15 | 14 | 332 | 350 | import copy
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
partial_sum = copy.deepcopy(A)
sum_now = A[N - 1]
for j in range(N - 2, -1, -1):
sum_now = int((sum_now + A[j]) % mod)
partial_sum[j] = sum_now
res = 0
for i in range(N - 1):
res = (res + (A[i] * partial_sum[i + 1]) % mo... | N = int(eval(input()))
# A = [int(x) for x in input().split()]
A = list(map(int, input().split()))
mod = 10**9 + 7
partial_sum = A.copy()
sum_now = A[N - 1]
for j in range(N - 2, -1, -1):
sum_now = int((sum_now + A[j]) % mod)
partial_sum[j] = sum_now
res = 0
for i in range(N - 1):
res = (res + (A[i] * parti... | false | 6.666667 | [
"-import copy",
"-",
"+# A = [int(x) for x in input().split()]",
"-partial_sum = copy.deepcopy(A)",
"+partial_sum = A.copy()"
] | false | 0.041164 | 0.043035 | 0.956529 | [
"s710099591",
"s681735303"
] |
u247976584 | p02276 | python | s558801342 | s764800124 | 130 | 80 | 18,744 | 18,344 | Accepted | Accepted | 38.46 | class Partition:
def partion(self, a, p, r):
x = a[-1]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
# a[i + 1], a[-1] = a[-1], a[i + 1]
return((a, i))
if __name__ == '__main__':
n = ... | class Partition:
def partion(self, a, p, r):
x = a[r]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
a[i + 1], a[r] = a[r], a[i + 1]
return(i+1)
if __name__ == '__main__':
n = int(inpu... | 23 | 19 | 632 | 524 | class Partition:
def partion(self, a, p, r):
x = a[-1]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
# a[i + 1], a[-1] = a[-1], a[i + 1]
return (a, i)
if __name__ == "__main__":
n = int(input().r... | class Partition:
def partion(self, a, p, r):
x = a[r]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
a[i + 1], a[r] = a[r], a[i + 1]
return i + 1
if __name__ == "__main__":
n = int(input().rstrip(... | false | 17.391304 | [
"- x = a[-1]",
"+ x = a[r]",
"- # a[i + 1], a[-1] = a[-1], a[i + 1]",
"- return (a, i)",
"+ a[i + 1], a[r] = a[r], a[i + 1]",
"+ return i + 1",
"- a, i = x.partion(a, 0, n)",
"- res = []",
"- for j in range(len(a)):",
"- if j == i:",
"- ... | false | 0.037042 | 0.035461 | 1.044582 | [
"s558801342",
"s764800124"
] |
u644907318 | p03831 | python | s733776079 | s911741663 | 223 | 92 | 62,704 | 85,380 | Accepted | Accepted | 58.74 | N,A,B = list(map(int,input().split()))
X = list(map(int,input().split()))
tot = 0
for i in range(1,N):
if A*(X[i]-X[i-1])<=B:
tot += A*(X[i]-X[i-1])
else:
tot += B
print(tot) | N,A,B = list(map(int,input().split()))
X = list(map(int,input().split()))
tot = 0
for i in range(1,N):
if (X[i]-X[i-1])*A<=B:
tot += (X[i]-X[i-1])*A
else:
tot += B
print(tot) | 9 | 9 | 200 | 200 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
tot = 0
for i in range(1, N):
if A * (X[i] - X[i - 1]) <= B:
tot += A * (X[i] - X[i - 1])
else:
tot += B
print(tot)
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
tot = 0
for i in range(1, N):
if (X[i] - X[i - 1]) * A <= B:
tot += (X[i] - X[i - 1]) * A
else:
tot += B
print(tot)
| false | 0 | [
"- if A * (X[i] - X[i - 1]) <= B:",
"- tot += A * (X[i] - X[i - 1])",
"+ if (X[i] - X[i - 1]) * A <= B:",
"+ tot += (X[i] - X[i - 1]) * A"
] | false | 0.087078 | 0.006662 | 13.071565 | [
"s733776079",
"s911741663"
] |
u021548497 | p03295 | python | s433994878 | s187009287 | 485 | 346 | 21,644 | 24,396 | Accepted | Accepted | 28.66 | n, m = list(map(int, input().split()))
ab=[0]*m
for i in range(m):
ab[i] = [int(x) for x in input().split()]
ab.sort()
ans = 1
key = ab[0][1]
for i in range(m):
if ab[i][0] >= key:
ans += 1
key = ab[i][1]
elif ab[i][1] < key:
key = ab[i][1]
print(ans) | n, m = list(map(int, input().split()))
bridge = [None]*m
for i in range(m):
a, b = list(map(int, input().split()))
bridge[i] = [b, a]
ans = 0
bridge.sort()
sub = -1
ans = 0
for v in bridge:
b, a = v[0], v[1]
if a >= sub:
sub = b
ans += 1
print(ans) | 14 | 19 | 294 | 274 | n, m = list(map(int, input().split()))
ab = [0] * m
for i in range(m):
ab[i] = [int(x) for x in input().split()]
ab.sort()
ans = 1
key = ab[0][1]
for i in range(m):
if ab[i][0] >= key:
ans += 1
key = ab[i][1]
elif ab[i][1] < key:
key = ab[i][1]
print(ans)
| n, m = list(map(int, input().split()))
bridge = [None] * m
for i in range(m):
a, b = list(map(int, input().split()))
bridge[i] = [b, a]
ans = 0
bridge.sort()
sub = -1
ans = 0
for v in bridge:
b, a = v[0], v[1]
if a >= sub:
sub = b
ans += 1
print(ans)
| false | 26.315789 | [
"-ab = [0] * m",
"+bridge = [None] * m",
"- ab[i] = [int(x) for x in input().split()]",
"-ab.sort()",
"-ans = 1",
"-key = ab[0][1]",
"-for i in range(m):",
"- if ab[i][0] >= key:",
"+ a, b = list(map(int, input().split()))",
"+ bridge[i] = [b, a]",
"+ans = 0",
"+bridge.sort()",
"... | false | 0.039989 | 0.039682 | 1.007733 | [
"s433994878",
"s187009287"
] |
u638456847 | p02623 | python | s337140165 | s549010197 | 360 | 241 | 47,420 | 49,200 | Accepted | Accepted | 33.06 | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M,K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
... | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M,K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
... | 44 | 33 | 1,008 | 754 | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M, K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
ac... | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M, K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
ac... | false | 25 | [
"- acc_A = list(accumulate(A))",
"- acc_B = list(accumulate(B))",
"+ acc_A = [0] + list(accumulate(A))",
"+ acc_B = [0] + list(accumulate(B))",
"- tmp = i + 1",
"+ tmp = i",
"- ans = max(ans, bisect_right(acc_B, K))",
"+ ans = max(ans, bisect_right(acc_B... | false | 0.046726 | 0.044107 | 1.059357 | [
"s337140165",
"s549010197"
] |
u984592063 | p02684 | python | s646056724 | s657775699 | 163 | 122 | 32,380 | 32,380 | Accepted | Accepted | 25.15 | n, k = list(map(int, input().split()))
a = [0] + list(map(int, input().split()))
a1 = [0] * (n+1)
step = 1
start = 0
while(True):
start += 1
a1[step] += 1
step = a[step]
if a1[step] == 1:
break
c = step
gap = 0
while(True):
gap += 1
step = a[step]
if step == c:
... | n, k = list(map(int, input().split()))
a = [0] + list(map(int, input().split()))
repeat = [0] * (n+1)
circle = [1]
point = 1
flag = 0
for _ in range(k):
circle.append(a[point])
repeat[point] = 1
point = a[point]
if(repeat[point] == 1):
flag = 1
break
if flag == 0:
p... | 28 | 22 | 456 | 469 | n, k = list(map(int, input().split()))
a = [0] + list(map(int, input().split()))
a1 = [0] * (n + 1)
step = 1
start = 0
while True:
start += 1
a1[step] += 1
step = a[step]
if a1[step] == 1:
break
c = step
gap = 0
while True:
gap += 1
step = a[step]
if step == c:
break
result =... | n, k = list(map(int, input().split()))
a = [0] + list(map(int, input().split()))
repeat = [0] * (n + 1)
circle = [1]
point = 1
flag = 0
for _ in range(k):
circle.append(a[point])
repeat[point] = 1
point = a[point]
if repeat[point] == 1:
flag = 1
break
if flag == 0:
print((circle[-1])... | false | 21.428571 | [
"-a1 = [0] * (n + 1)",
"-step = 1",
"-start = 0",
"-while True:",
"- start += 1",
"- a1[step] += 1",
"- step = a[step]",
"- if a1[step] == 1:",
"+repeat = [0] * (n + 1)",
"+circle = [1]",
"+point = 1",
"+flag = 0",
"+for _ in range(k):",
"+ circle.append(a[point])",
"+ ... | false | 0.044178 | 0.043435 | 1.017113 | [
"s646056724",
"s657775699"
] |
u785578220 | p03716 | python | s040424765 | s988446135 | 550 | 434 | 37,212 | 38,292 | Accepted | Accepted | 21.09 | import heapq
n = int(eval(input()))
a = list(map(int,input().split()))
FN = []
SN = []
for i in range(n):
FN.append(a[i])
for i in range(2*n,3*n):
SN.append(-a[i])
heapq.heapify(FN)
heapq.heapify(SN)
sumFN = [0]*(n+1)
sumSN = [0]*(n+1)
sumFN[0] = sum(FN)
sumSN[n] = -sum(SN)
for i in range... | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
n1 = A[:N]
s1 = [sum(n1)]
heapq.heapify(n1)
for i in range(N):
heapq.heappush(n1,A[N+i])
p = heapq.heappop(n1)
s1.append(s1[-1]-p+A[N+i])
s3 = [-(sum(A[-N:]))]
n3 = [-a for a in A[-N:]]
heapq.heapify(n3)
for i in range(... | 37 | 26 | 690 | 520 | import heapq
n = int(eval(input()))
a = list(map(int, input().split()))
FN = []
SN = []
for i in range(n):
FN.append(a[i])
for i in range(2 * n, 3 * n):
SN.append(-a[i])
heapq.heapify(FN)
heapq.heapify(SN)
sumFN = [0] * (n + 1)
sumSN = [0] * (n + 1)
sumFN[0] = sum(FN)
sumSN[n] = -sum(SN)
for i in range(1, n + ... | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
n1 = A[:N]
s1 = [sum(n1)]
heapq.heapify(n1)
for i in range(N):
heapq.heappush(n1, A[N + i])
p = heapq.heappop(n1)
s1.append(s1[-1] - p + A[N + i])
s3 = [-(sum(A[-N:]))]
n3 = [-a for a in A[-N:]]
heapq.heapify(n3)
for i in range(N):
... | false | 29.72973 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-FN = []",
"-SN = []",
"-for i in range(n):",
"- FN.append(a[i])",
"-for i in range(2 * n, 3 * n):",
"- SN.append(-a[i])",
"-heapq.heapify(FN)",
"-heapq.heapify(SN)",
"-sumFN = [0] * (n + 1)",
"-sumSN = [0] * (n + 1)",
... | false | 0.046336 | 0.045951 | 1.008374 | [
"s040424765",
"s988446135"
] |
u192154323 | p02683 | python | s939702535 | s890618084 | 157 | 84 | 27,072 | 9,236 | Accepted | Accepted | 46.5 | from itertools import combinations
import numpy as np
n,m,x = list(map(int,input().split()))
money_ls = [0] * n
ex_ls = [0] * n
for i in range(n):
in_ = list(map(int, input().split()))
money_ls[i] = in_[0]
ex_ls[i] = in_[1:]
min_money = float('inf')
book_ls = [i for i in range(n)]
for num i... | n_book, n_algo, target = list(map(int,input().split()))
cost_ls = [0] * n_book
up_ls = [0] * n_book
for i in range(n_book):
ls = list(map(int, input().split()))
cost_ls[i] = ls[0]
up_ls[i] = ls[1:]
n_pattern = 2 ** n_book
min_cost = float('inf')
for pattern in range(n_pattern):
cost = 0
... | 31 | 30 | 798 | 810 | from itertools import combinations
import numpy as np
n, m, x = list(map(int, input().split()))
money_ls = [0] * n
ex_ls = [0] * n
for i in range(n):
in_ = list(map(int, input().split()))
money_ls[i] = in_[0]
ex_ls[i] = in_[1:]
min_money = float("inf")
book_ls = [i for i in range(n)]
for num in range(1, n ... | n_book, n_algo, target = list(map(int, input().split()))
cost_ls = [0] * n_book
up_ls = [0] * n_book
for i in range(n_book):
ls = list(map(int, input().split()))
cost_ls[i] = ls[0]
up_ls[i] = ls[1:]
n_pattern = 2**n_book
min_cost = float("inf")
for pattern in range(n_pattern):
cost = 0
score_ls = [0... | false | 3.225806 | [
"-from itertools import combinations",
"-import numpy as np",
"-",
"-n, m, x = list(map(int, input().split()))",
"-money_ls = [0] * n",
"-ex_ls = [0] * n",
"-for i in range(n):",
"- in_ = list(map(int, input().split()))",
"- money_ls[i] = in_[0]",
"- ex_ls[i] = in_[1:]",
"-min_money = f... | false | 0.039238 | 0.036005 | 1.089796 | [
"s939702535",
"s890618084"
] |
u426534722 | p02240 | python | s416982580 | s554222414 | 580 | 290 | 9,664 | 10,032 | Accepted | Accepted | 50 | def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
return
f2(li[a], b)
li[a] ... | import sys
readline = sys.stdin.readline
def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
r... | 29 | 31 | 686 | 735 | def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
return
f2(li[a], b)
li[a] = b
de... | import sys
readline = sys.stdin.readline
def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
return
... | false | 6.451613 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+",
"+",
"- x, y = list(map(int, input().split()))",
"+ x, y = list(map(int, readline().split()))",
"- x, y = list(map(int, input().split()))",
"+ x, y = list(map(int, readline().split()))"
] | false | 0.041143 | 0.041298 | 0.996257 | [
"s416982580",
"s554222414"
] |
u911516631 | p02622 | python | s991836908 | s539949648 | 65 | 58 | 9,480 | 9,552 | Accepted | Accepted | 10.77 | S = eval(input())
T = eval(input())
count = 0
for i in range(len(S)):
if S[i] != T[i]:
count += 1
print(count) | S, T = [eval(input()) for _ in range(2)]
count = 0
for i, j in zip(S, T):
count += i != j
print(count)
| 7 | 5 | 110 | 105 | S = eval(input())
T = eval(input())
count = 0
for i in range(len(S)):
if S[i] != T[i]:
count += 1
print(count)
| S, T = [eval(input()) for _ in range(2)]
count = 0
for i, j in zip(S, T):
count += i != j
print(count)
| false | 28.571429 | [
"-S = eval(input())",
"-T = eval(input())",
"+S, T = [eval(input()) for _ in range(2)]",
"-for i in range(len(S)):",
"- if S[i] != T[i]:",
"- count += 1",
"+for i, j in zip(S, T):",
"+ count += i != j"
] | false | 0.007461 | 0.042727 | 0.174624 | [
"s991836908",
"s539949648"
] |
u729133443 | p03962 | python | s619581379 | s770949446 | 163 | 25 | 38,256 | 9,088 | Accepted | Accepted | 84.66 | print((len(set(input().split())))) | print((len({*input().split()}))) | 1 | 1 | 32 | 30 | print((len(set(input().split()))))
| print((len({*input().split()})))
| false | 0 | [
"-print((len(set(input().split()))))",
"+print((len({*input().split()})))"
] | false | 0.072496 | 0.061026 | 1.187938 | [
"s619581379",
"s770949446"
] |
u367130284 | p03107 | python | s855466982 | s283615442 | 55 | 18 | 3,956 | 3,188 | Accepted | Accepted | 67.27 | ans=0
stack=[]
for s in eval(input()):
if len(stack)>0 and stack[-1]!=s:
del stack[-1]
ans+=2
else:
stack.append(s)
print(ans) | s=eval(input())
t=s.count("0")
e=s.count("1")
print((len(s)-(max(t,e)-min(t,e)))) | 9 | 4 | 160 | 76 | ans = 0
stack = []
for s in eval(input()):
if len(stack) > 0 and stack[-1] != s:
del stack[-1]
ans += 2
else:
stack.append(s)
print(ans)
| s = eval(input())
t = s.count("0")
e = s.count("1")
print((len(s) - (max(t, e) - min(t, e))))
| false | 55.555556 | [
"-ans = 0",
"-stack = []",
"-for s in eval(input()):",
"- if len(stack) > 0 and stack[-1] != s:",
"- del stack[-1]",
"- ans += 2",
"- else:",
"- stack.append(s)",
"-print(ans)",
"+s = eval(input())",
"+t = s.count(\"0\")",
"+e = s.count(\"1\")",
"+print((len(s) - (... | false | 0.045208 | 0.046578 | 0.970591 | [
"s855466982",
"s283615442"
] |
u631277801 | p03607 | python | s506295816 | s673227940 | 359 | 237 | 13,204 | 7,388 | Accepted | Accepted | 33.98 |
from bisect import bisect_left,bisect_right
N = int(eval(input()))
A_list = []
for i in range(N):
A_list.append(int(eval(input())))
A_unique = list(set(A_list))
A_list.sort()
ans = 0
for a in A_unique:
if (bisect_right(A_list,a)-bisect_left(A_list,a))%2 == 1:
ans += 1
pr... | N = int(eval(input()))
A_list = []
for i in range(N):
A_list.append(int(eval(input())))
A_list.sort()
res = 0
cnt = 0
ans = 0
for a in A_list:
if res == a:
cnt += 1
else:
ans += cnt%2
res = a
cnt = 1
ans += cnt%2
print(ans) | 19 | 21 | 316 | 291 | from bisect import bisect_left, bisect_right
N = int(eval(input()))
A_list = []
for i in range(N):
A_list.append(int(eval(input())))
A_unique = list(set(A_list))
A_list.sort()
ans = 0
for a in A_unique:
if (bisect_right(A_list, a) - bisect_left(A_list, a)) % 2 == 1:
ans += 1
print(ans)
| N = int(eval(input()))
A_list = []
for i in range(N):
A_list.append(int(eval(input())))
A_list.sort()
res = 0
cnt = 0
ans = 0
for a in A_list:
if res == a:
cnt += 1
else:
ans += cnt % 2
res = a
cnt = 1
ans += cnt % 2
print(ans)
| false | 9.52381 | [
"-from bisect import bisect_left, bisect_right",
"-",
"-A_unique = list(set(A_list))",
"+res = 0",
"+cnt = 0",
"-for a in A_unique:",
"- if (bisect_right(A_list, a) - bisect_left(A_list, a)) % 2 == 1:",
"- ans += 1",
"+for a in A_list:",
"+ if res == a:",
"+ cnt += 1",
"+ ... | false | 0.036527 | 0.036194 | 1.009197 | [
"s506295816",
"s673227940"
] |
u552176911 | p02954 | python | s975109052 | s867695822 | 516 | 107 | 6,400 | 10,856 | Accepted | Accepted | 79.26 | import math
s = eval(input())
li = [0 for _ in range(len(s))]
for i in range(len(s)):
if s[i] == "R":
t = s[i:].index("L")
if t % 2 != 0:
li[i + t - 1] += 1
else:
li[i + t] += 1
else:
t = s[:i].rfind("R")
if (i - t) % 2 != 0:
... | import math
s = eval(input())
li = [0 for _ in range(len(s))]
rCnt = 0
for i in range(len(s)):
if s[i] == "R":
rCnt += 1
else:
li[i] += rCnt // 2
li[i - 1] += math.ceil(rCnt / 2)
rCnt = 0
lCnt = 0
for i in reversed(list(range(len(s)))):
if s[i] == "L":
... | 20 | 23 | 388 | 433 | import math
s = eval(input())
li = [0 for _ in range(len(s))]
for i in range(len(s)):
if s[i] == "R":
t = s[i:].index("L")
if t % 2 != 0:
li[i + t - 1] += 1
else:
li[i + t] += 1
else:
t = s[:i].rfind("R")
if (i - t) % 2 != 0:
li[t + 1]... | import math
s = eval(input())
li = [0 for _ in range(len(s))]
rCnt = 0
for i in range(len(s)):
if s[i] == "R":
rCnt += 1
else:
li[i] += rCnt // 2
li[i - 1] += math.ceil(rCnt / 2)
rCnt = 0
lCnt = 0
for i in reversed(list(range(len(s)))):
if s[i] == "L":
lCnt += 1
... | false | 13.043478 | [
"+rCnt = 0",
"- t = s[i:].index(\"L\")",
"- if t % 2 != 0:",
"- li[i + t - 1] += 1",
"- else:",
"- li[i + t] += 1",
"+ rCnt += 1",
"- t = s[:i].rfind(\"R\")",
"- if (i - t) % 2 != 0:",
"- li[t + 1] += 1",
"- else:"... | false | 0.034833 | 0.036065 | 0.965852 | [
"s975109052",
"s867695822"
] |
u285891772 | p03353 | python | s616662408 | s564860261 | 56 | 51 | 5,200 | 6,612 | Accepted | Accepted | 8.93 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 44 | 35 | 1,263 | 1,170 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 20.454545 | [
"-s = eval(input())",
"-K = INT()",
"-substr = []",
"-for l in range(len(s)):",
"- r = l + 1",
"- while r < len(s) + 1:",
"- # print(l, r, substr)",
"- if bisect(substr, s[l:r]) == 5:",
"- break",
"- elif s[l:r] in substr:",
"- r += 1",
"- ... | false | 0.059568 | 0.055937 | 1.064929 | [
"s616662408",
"s564860261"
] |
u130900604 | p03635 | python | s233166219 | s980866510 | 170 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90 | n,m=list(map(int,input().split()))
print(((n-1)*(m-1))) | n,m=list(map(int,input().split()))
ans=(n-1)*(m-1)
print(ans) | 2 | 3 | 48 | 57 | n, m = list(map(int, input().split()))
print(((n - 1) * (m - 1)))
| n, m = list(map(int, input().split()))
ans = (n - 1) * (m - 1)
print(ans)
| false | 33.333333 | [
"-print(((n - 1) * (m - 1)))",
"+ans = (n - 1) * (m - 1)",
"+print(ans)"
] | false | 0.043573 | 0.047217 | 0.922836 | [
"s233166219",
"s980866510"
] |
u046187684 | p03014 | python | s371166743 | s926540292 | 1,769 | 916 | 232,560 | 140,228 | Accepted | Accepted | 48.22 | from itertools import accumulate
def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
t = [[1 if __s == "#" else 0 for __s in _s] for _s in s]
hi = [list(accumulate(_t)) for _t in t]
vi = [list(accumulate(_t)) for _t in zip(*t)]
hg = [list(map(len, _s.split("#"))... | def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
ht = [[0] * w for _ in range(h)]
vt = [[0] * h for _ in range(w)]
for i in range(h):
st = 0
c = 0
for j in range(w):
if s[i][j] == "#":
ht[i][st:j] = [c] * (j - st... | 21 | 38 | 707 | 1,041 | from itertools import accumulate
def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
t = [[1 if __s == "#" else 0 for __s in _s] for _s in s]
hi = [list(accumulate(_t)) for _t in t]
vi = [list(accumulate(_t)) for _t in zip(*t)]
hg = [list(map(len, _s.split("#"))) for _s ... | def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
ht = [[0] * w for _ in range(h)]
vt = [[0] * h for _ in range(w)]
for i in range(h):
st = 0
c = 0
for j in range(w):
if s[i][j] == "#":
ht[i][st:j] = [c] * (j - st)
... | false | 44.736842 | [
"-from itertools import accumulate",
"-",
"-",
"- t = [[1 if __s == \"#\" else 0 for __s in _s] for _s in s]",
"- hi = [list(accumulate(_t)) for _t in t]",
"- vi = [list(accumulate(_t)) for _t in zip(*t)]",
"- hg = [list(map(len, _s.split(\"#\"))) for _s in s]",
"- vg = [list(map(len, \... | false | 0.038951 | 0.03812 | 1.021795 | [
"s371166743",
"s926540292"
] |
u074220993 | p03731 | python | s502596873 | s168031650 | 111 | 91 | 30,852 | 31,756 | Accepted | Accepted | 18.02 | N, T = list(map(int, input().split()))
t_List = [int(x) for x in input().split()]
pre = 0
ans = T
for t in t_List:
if t - pre <= T:
ans += t - pre
else:
ans += T
pre = t
print(ans) | N, T, *t = list(map(int, open(0).read().split()))
ans = sum(y-x if y-x < T else T for x,y in zip(t[:N-1],t[1:])) + T
print(ans) | 11 | 3 | 212 | 123 | N, T = list(map(int, input().split()))
t_List = [int(x) for x in input().split()]
pre = 0
ans = T
for t in t_List:
if t - pre <= T:
ans += t - pre
else:
ans += T
pre = t
print(ans)
| N, T, *t = list(map(int, open(0).read().split()))
ans = sum(y - x if y - x < T else T for x, y in zip(t[: N - 1], t[1:])) + T
print(ans)
| false | 72.727273 | [
"-N, T = list(map(int, input().split()))",
"-t_List = [int(x) for x in input().split()]",
"-pre = 0",
"-ans = T",
"-for t in t_List:",
"- if t - pre <= T:",
"- ans += t - pre",
"- else:",
"- ans += T",
"- pre = t",
"+N, T, *t = list(map(int, open(0).read().split()))",
"+... | false | 0.120715 | 0.051409 | 2.348115 | [
"s502596873",
"s168031650"
] |
u440566786 | p02717 | python | s482499604 | s592008955 | 182 | 60 | 38,384 | 61,784 | Accepted | Accepted | 67.03 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
x,y,z = list(map(int,input().split()))
print((z,x,y))
resolve() | a, b, c = list(map(int, input().split()))
print((c, a, b)) | 9 | 2 | 215 | 51 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
def resolve():
x, y, z = list(map(int, input().split()))
print((z, x, y))
resolve()
| a, b, c = list(map(int, input().split()))
print((c, a, b))
| false | 77.777778 | [
"-import sys",
"-",
"-sys.setrecursionlimit(2147483647)",
"-INF = float(\"inf\")",
"-MOD = 10**9 + 7 # 998244353",
"-input = lambda: sys.stdin.readline().rstrip()",
"-",
"-",
"-def resolve():",
"- x, y, z = list(map(int, input().split()))",
"- print((z, x, y))",
"-",
"-",
"-resolve(... | false | 0.098235 | 0.040989 | 2.39663 | [
"s482499604",
"s592008955"
] |
u644907318 | p02608 | python | s581972134 | s383351386 | 278 | 120 | 82,360 | 74,716 | Accepted | Accepted | 56.83 | N = int(eval(input()))
C = {}
for x in range(1,142):
for y in range(1,142):
for z in range(1,142):
a = (x+y)**2+(y+z)**2+(z+x)**2
if a%2==0:
if a//2 not in C:
C[a//2]=0
C[a//2] += 1
for i in range(1,N+1):
if i in C:
... | N = int(eval(input()))
C = {i:0 for i in range(1,N+1)}
for x in range(1,142):
for y in range(1,142):
for z in range(1,142):
a = (x+y)**2+(y+z)**2+(z+x)**2
if a%2==0 and a//2<=N:
C[a//2] += 1
for i in range(1,N+1):
print((C[i])) | 15 | 10 | 362 | 284 | N = int(eval(input()))
C = {}
for x in range(1, 142):
for y in range(1, 142):
for z in range(1, 142):
a = (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2
if a % 2 == 0:
if a // 2 not in C:
C[a // 2] = 0
C[a // 2] += 1
for i in range(1, N... | N = int(eval(input()))
C = {i: 0 for i in range(1, N + 1)}
for x in range(1, 142):
for y in range(1, 142):
for z in range(1, 142):
a = (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2
if a % 2 == 0 and a // 2 <= N:
C[a // 2] += 1
for i in range(1, N + 1):
print((C[i]))
| false | 33.333333 | [
"-C = {}",
"+C = {i: 0 for i in range(1, N + 1)}",
"- if a % 2 == 0:",
"- if a // 2 not in C:",
"- C[a // 2] = 0",
"+ if a % 2 == 0 and a // 2 <= N:",
"- if i in C:",
"- print((C[i]))",
"- else:",
"- print((0))",
"+ p... | false | 4.445381 | 3.294916 | 1.349164 | [
"s581972134",
"s383351386"
] |
u375616706 | p02863 | python | s614009229 | s431227213 | 1,034 | 857 | 183,768 | 120,920 | Accepted | Accepted | 17.12 | N,T = list(map(int,input().split()))
item=[list(map(int,input().split())) for _ in range(N)]
item = sorted(item,key=lambda x:x[0])
dp=[[0]*(T+3000) for _ in range(N+1)]
for i,(a,b) in enumerate(item,1):
for t in reversed(list(range(T))):
dist=t+a
dp[i][dist] = max(dp[i-1][t]+b,dp[i][di... | N,T = list(map(int,input().split()))
item=[list(map(int,input().split())) for _ in range(N)]
item = sorted(item,key=lambda x:x[0])
dp=[[0]*(T+1) for _ in range(N+1)]
for i,(a,b) in enumerate(item,1):
for t in reversed(list(range(T))):
dist=min(T,t+a)
dp[i][dist] = max(dp[i-1][t]+b,dp[i... | 16 | 16 | 416 | 420 | N, T = list(map(int, input().split()))
item = [list(map(int, input().split())) for _ in range(N)]
item = sorted(item, key=lambda x: x[0])
dp = [[0] * (T + 3000) for _ in range(N + 1)]
for i, (a, b) in enumerate(item, 1):
for t in reversed(list(range(T))):
dist = t + a
dp[i][dist] = max(dp[i - 1][t] ... | N, T = list(map(int, input().split()))
item = [list(map(int, input().split())) for _ in range(N)]
item = sorted(item, key=lambda x: x[0])
dp = [[0] * (T + 1) for _ in range(N + 1)]
for i, (a, b) in enumerate(item, 1):
for t in reversed(list(range(T))):
dist = min(T, t + a)
dp[i][dist] = max(dp[i - 1... | false | 0 | [
"-dp = [[0] * (T + 3000) for _ in range(N + 1)]",
"+dp = [[0] * (T + 1) for _ in range(N + 1)]",
"- dist = t + a",
"+ dist = min(T, t + a)"
] | false | 0.036613 | 0.173244 | 0.211337 | [
"s614009229",
"s431227213"
] |
u639444166 | p03546 | python | s079333523 | s157857441 | 1,966 | 333 | 19,308 | 19,436 | Accepted | Accepted | 83.06 | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
hw = input()
hw = hw.split()
h,w = list(map(int,hw))
c = np.zeros([10,10],int)
for i in range(10):
line = input()
line = line.split()
c[i] = list(map(int,line))
#a = np.zeros([h,w],dtype=int)
#for i in range(h):
# line = ra... | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
hw = input()
hw = hw.split()
h,w = list(map(int,hw))
c = np.zeros([10,10],int)
for i in range(10):
line = input()
line = line.split()
c[i] = list(map(int,line))
#a = np.zeros([h,w],dtype=int)
#for i in range(h):
# line = ra... | 51 | 51 | 1,021 | 1,023 | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
hw = input()
hw = hw.split()
h, w = list(map(int, hw))
c = np.zeros([10, 10], int)
for i in range(10):
line = input()
line = line.split()
c[i] = list(map(int, line))
# a = np.zeros([h,w],dtype=int)
# for i in range(h):
# line = raw_input()
# ... | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
hw = input()
hw = hw.split()
h, w = list(map(int, hw))
c = np.zeros([10, 10], int)
for i in range(10):
line = input()
line = line.split()
c[i] = list(map(int, line))
# a = np.zeros([h,w],dtype=int)
# for i in range(h):
# line = raw_input()
# ... | false | 0 | [
"-while i < max(maryoku):",
"+while i < max(maryoku) - 1:"
] | false | 0.171304 | 0.325385 | 0.526466 | [
"s079333523",
"s157857441"
] |
u893063840 | p02574 | python | s689908429 | s010163215 | 1,647 | 1,417 | 208,832 | 207,160 | Accepted | Accepted | 13.96 | from math import gcd
import numpy as np
from numba import njit
n = int(eval(input()))
a = list(map(int, input().split()))
MAX = 10 ** 6
g = a[0]
for e in a:
g = gcd(g, e)
if g != 1:
print("not coprime")
exit()
nums = np.zeros(MAX + 1, np.int64)
for e in a:
nums[e] += 1
@njit
... | import numpy as np
from numba import njit
n = int(eval(input()))
a = list(map(int, input().split()))
MAX = 10 ** 6
nums = np.zeros(MAX + 1, np.int64)
for e in a:
nums[e] += 1
@njit
def solve(nums):
mx = 0
for i in range(2, MAX + 1):
cnt = nums[i::i].sum()
mx = max(mx, cn... | 37 | 34 | 537 | 541 | from math import gcd
import numpy as np
from numba import njit
n = int(eval(input()))
a = list(map(int, input().split()))
MAX = 10**6
g = a[0]
for e in a:
g = gcd(g, e)
if g != 1:
print("not coprime")
exit()
nums = np.zeros(MAX + 1, np.int64)
for e in a:
nums[e] += 1
@njit
def f(nums):
for i in r... | import numpy as np
from numba import njit
n = int(eval(input()))
a = list(map(int, input().split()))
MAX = 10**6
nums = np.zeros(MAX + 1, np.int64)
for e in a:
nums[e] += 1
@njit
def solve(nums):
mx = 0
for i in range(2, MAX + 1):
cnt = nums[i::i].sum()
mx = max(mx, cnt)
return mx
m... | false | 8.108108 | [
"-from math import gcd",
"-g = a[0]",
"-for e in a:",
"- g = gcd(g, e)",
"-if g != 1:",
"- print(\"not coprime\")",
"- exit()",
"-def f(nums):",
"+def solve(nums):",
"+ mx = 0",
"- if nums[i::i].sum() > 1:",
"- return False",
"- return True",
"+ cnt ... | false | 0.438297 | 0.007601 | 57.66535 | [
"s689908429",
"s010163215"
] |
u241159583 | p03043 | python | s272875878 | s578220063 | 44 | 37 | 2,940 | 2,940 | Accepted | Accepted | 15.91 | N, K = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
c = 0
while(i < K):
i *= 2
c += 1
ans += 1 / 2 ** c
print((1/N * ans)) | n, k = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
cnt = 0
while i < k:
i *= 2
cnt += 1
ans += (1/2) ** cnt
ans /= n
print(ans) | 9 | 11 | 168 | 180 | N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
c = 0
while i < K:
i *= 2
c += 1
ans += 1 / 2**c
print((1 / N * ans))
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
cnt = 0
while i < k:
i *= 2
cnt += 1
ans += (1 / 2) ** cnt
ans /= n
print(ans)
| false | 18.181818 | [
"-N, K = list(map(int, input().split()))",
"+n, k = list(map(int, input().split()))",
"-for i in range(1, N + 1):",
"- c = 0",
"- while i < K:",
"+for i in range(1, n + 1):",
"+ cnt = 0",
"+ while i < k:",
"- c += 1",
"- ans += 1 / 2**c",
"-print((1 / N * ans))",
"+ ... | false | 0.073188 | 0.166909 | 0.438492 | [
"s272875878",
"s578220063"
] |
u318127926 | p02614 | python | s709677594 | s052420034 | 78 | 65 | 74,088 | 9,196 | Accepted | Accepted | 16.67 | h, w, k = list(map(int, input().split()))
c = []
for _ in range(h):
c.append(list(eval(input())))
ans = 0
for x in range(2**(h+w)):
cnt = 0
for i in range(h):
for j in range(w):
if x>>i&1 or x>>(h+j)&1 or c[i][j]=='.':
continue
cnt += 1
if cnt=... | h, w, k = list(map(int, input().split()))
c = []
for _ in range(h):
c.append(eval(input()))
ans = 0
for i in range(2**h):
for j in range(2**w):
tmp = 0
for y in range(h):
for x in range(w):
if i>>y&1 or j>>x&1 or c[y][x]=='.':
continue
... | 15 | 16 | 341 | 386 | h, w, k = list(map(int, input().split()))
c = []
for _ in range(h):
c.append(list(eval(input())))
ans = 0
for x in range(2 ** (h + w)):
cnt = 0
for i in range(h):
for j in range(w):
if x >> i & 1 or x >> (h + j) & 1 or c[i][j] == ".":
continue
cnt += 1
if ... | h, w, k = list(map(int, input().split()))
c = []
for _ in range(h):
c.append(eval(input()))
ans = 0
for i in range(2**h):
for j in range(2**w):
tmp = 0
for y in range(h):
for x in range(w):
if i >> y & 1 or j >> x & 1 or c[y][x] == ".":
continue
... | false | 6.25 | [
"- c.append(list(eval(input())))",
"+ c.append(eval(input()))",
"-for x in range(2 ** (h + w)):",
"- cnt = 0",
"- for i in range(h):",
"- for j in range(w):",
"- if x >> i & 1 or x >> (h + j) & 1 or c[i][j] == \".\":",
"- continue",
"- cnt += 1... | false | 0.112474 | 0.113358 | 0.992207 | [
"s709677594",
"s052420034"
] |
u994988729 | p02996 | python | s832149929 | s470715339 | 774 | 499 | 41,916 | 30,788 | Accepted | Accepted | 35.53 | import sys
from collections import defaultdict
from operator import itemgetter
input = sys.stdin.readline
N = int(eval(input()))
d = defaultdict(int)
for _ in range(N):
a, b = list(map(int, input().split()))
d[b] += a
task = list(d.items())
task.sort()
now = 0
ans = "Yes"
for limit, time in tas... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
def main():
N = int(eval(input()))
work = [] # due, duration
for _ in range(N):
a, b = list(map(int, input().split()))
work.append((b, -a))
work.sort()
now = 0
for b, a in work:
... | 22 | 23 | 398 | 437 | import sys
from collections import defaultdict
from operator import itemgetter
input = sys.stdin.readline
N = int(eval(input()))
d = defaultdict(int)
for _ in range(N):
a, b = list(map(int, input().split()))
d[b] += a
task = list(d.items())
task.sort()
now = 0
ans = "Yes"
for limit, time in task:
now += ti... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
def main():
N = int(eval(input()))
work = [] # due, duration
for _ in range(N):
a, b = list(map(int, input().split()))
work.append((b, -a))
work.sort()
now = 0
for b, a in work:
now = now - a
... | false | 4.347826 | [
"-from collections import defaultdict",
"-from operator import itemgetter",
"-input = sys.stdin.readline",
"-N = int(eval(input()))",
"-d = defaultdict(int)",
"-for _ in range(N):",
"- a, b = list(map(int, input().split()))",
"- d[b] += a",
"-task = list(d.items())",
"-task.sort()",
"-now ... | false | 0.042226 | 0.04276 | 0.987506 | [
"s832149929",
"s470715339"
] |
u125545880 | p02726 | python | s822281061 | s184415743 | 1,964 | 1,618 | 296,968 | 67,808 | Accepted | Accepted | 17.62 | import sys
import numpy as np
import itertools
import collections
from collections import deque
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
# input
N, X, Y = [... |
import collections
def cmd():
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
distance = []
dappend = distance.append
for i in range(N-1):
for j in range(i+1,N):
tmp = min(abs(i-j), abs(X-i) + 1 + abs(Y-j), abs(Y-i) + 1 + abs(X-j))
distan... | 47 | 23 | 1,044 | 476 | import sys
import numpy as np
import itertools
import collections
from collections import deque
from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
)
from scipy.sparse import csr_matrix
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
# input... | import collections
def cmd():
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
distance = []
dappend = distance.append
for i in range(N - 1):
for j in range(i + 1, N):
tmp = min(
abs(i - j), abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j)
... | false | 51.06383 | [
"-import sys",
"-import numpy as np",
"-import itertools",
"-from collections import deque",
"-from scipy.sparse.csgraph import (",
"- shortest_path,",
"- floyd_warshall,",
"- dijkstra,",
"- bellman_ford,",
"- johnson,",
"-)",
"-from scipy.sparse import csr_matrix",
"-",
"-s... | false | 0.330038 | 0.048273 | 6.836894 | [
"s822281061",
"s184415743"
] |
u853728588 | p02693 | python | s144426616 | s720804508 | 23 | 21 | 9,204 | 9,104 | Accepted | Accepted | 8.7 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for x in range(a, b+1):
if x % k == 0:
print('OK')
break
else:
print('NG') | k = int(eval(input()))
a, b = list(map(int, input().split()))
B = b+1
for x in range(a, B):
if x % k == 0:
print('OK')
break
else:
print('NG') | 9 | 9 | 158 | 162 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for x in range(a, b + 1):
if x % k == 0:
print("OK")
break
else:
print("NG")
| k = int(eval(input()))
a, b = list(map(int, input().split()))
B = b + 1
for x in range(a, B):
if x % k == 0:
print("OK")
break
else:
print("NG")
| false | 0 | [
"-for x in range(a, b + 1):",
"+B = b + 1",
"+for x in range(a, B):"
] | false | 0.037722 | 0.042729 | 0.882812 | [
"s144426616",
"s720804508"
] |
u893063840 | p04013 | python | s712446019 | s914394161 | 1,721 | 126 | 69,136 | 28,820 | Accepted | Accepted | 92.68 | n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
MAX = 50 * n
dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i, e in enumerate(x, 1):
for j in range(i):
for k in range(MAX + 1):
dp[i][j][k] += dp[i-1][j][k]
fo... | import numpy as np
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
MAX = 50 * n
dp = np.zeros((n + 1, MAX + 1), np.int64)
dp[0][0] = 1
for e in x:
dp[1:, e:] += dp[:-1, :-e]
cnt = np.arange(1, n + 1)
sm = cnt * a
ans = dp[cnt, sm].sum()
print(ans)
| 22 | 17 | 514 | 294 | n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
MAX = 50 * n
dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i, e in enumerate(x, 1):
for j in range(i):
for k in range(MAX + 1):
dp[i][j][k] += dp[i - 1][j][k]
for j in range(... | import numpy as np
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
MAX = 50 * n
dp = np.zeros((n + 1, MAX + 1), np.int64)
dp[0][0] = 1
for e in x:
dp[1:, e:] += dp[:-1, :-e]
cnt = np.arange(1, n + 1)
sm = cnt * a
ans = dp[cnt, sm].sum()
print(ans)
| false | 22.727273 | [
"+import numpy as np",
"+",
"-dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]",
"-dp[0][0][0] = 1",
"-for i, e in enumerate(x, 1):",
"- for j in range(i):",
"- for k in range(MAX + 1):",
"- dp[i][j][k] += dp[i - 1][j][k]",
"- for j in range(i):",
"- ... | false | 0.04109 | 0.158819 | 0.258722 | [
"s712446019",
"s914394161"
] |
u143278390 | p04031 | python | s310384519 | s582258315 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | N=int(eval(input()))
a=[int(i) for i in input().split()]
ave=round(sum(a)/len(a))
cost=0
for i in a:
cost+=(i-ave)**2
print(cost) | n=int(eval(input()))
a=[int(i) for i in input().split()]
ave=round(sum(a)/len(a))
cost=0
for i in a:
cost+=(ave-i)**2
print(cost) | 9 | 9 | 137 | 137 | N = int(eval(input()))
a = [int(i) for i in input().split()]
ave = round(sum(a) / len(a))
cost = 0
for i in a:
cost += (i - ave) ** 2
print(cost)
| n = int(eval(input()))
a = [int(i) for i in input().split()]
ave = round(sum(a) / len(a))
cost = 0
for i in a:
cost += (ave - i) ** 2
print(cost)
| false | 0 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"- cost += (i - ave) ** 2",
"+ cost += (ave - i) ** 2"
] | false | 0.038605 | 0.047407 | 0.814321 | [
"s310384519",
"s582258315"
] |
u219078733 | p03494 | python | s638628352 | s059432396 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = []
for i in range(n):
c = 0
while True:
if a[i]%2 == 0:
a[i] = a[i]/2
c += 1
else:
ans.append(c)
break
print((min(ans))) | n = int(eval(input()))
a = list(map(int, input().split()))
sum = 0
for num in a:
sum = sum | num
ans = 0
for t in range(200):
if sum & 1 == 0:
sum = sum >> 1
ans += 1
else:
break
print(ans) | 14 | 15 | 263 | 235 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = []
for i in range(n):
c = 0
while True:
if a[i] % 2 == 0:
a[i] = a[i] / 2
c += 1
else:
ans.append(c)
break
print((min(ans)))
| n = int(eval(input()))
a = list(map(int, input().split()))
sum = 0
for num in a:
sum = sum | num
ans = 0
for t in range(200):
if sum & 1 == 0:
sum = sum >> 1
ans += 1
else:
break
print(ans)
| false | 6.666667 | [
"-ans = []",
"-for i in range(n):",
"- c = 0",
"- while True:",
"- if a[i] % 2 == 0:",
"- a[i] = a[i] / 2",
"- c += 1",
"- else:",
"- ans.append(c)",
"- break",
"-print((min(ans)))",
"+sum = 0",
"+for num in a:",
"+ sum = s... | false | 0.045046 | 0.044889 | 1.003505 | [
"s638628352",
"s059432396"
] |
u227020436 | p03262 | python | s672312813 | s666079974 | 132 | 94 | 16,280 | 16,280 | Accepted | Accepted | 28.79 | from fractions import gcd
from functools import reduce
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
assert len(x) == N
x.sort()
# distance between each two cities
dist = [x[i] - x[i-1] for i in range(1, len(x))]
# distance between the first city and the start point
dist.... | from fractions import gcd
from functools import reduce
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
assert len(x) == N
dist = [abs(y - X) for y in x]
print((reduce(gcd, dist))) | 16 | 10 | 364 | 217 | from fractions import gcd
from functools import reduce
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
assert len(x) == N
x.sort()
# distance between each two cities
dist = [x[i] - x[i - 1] for i in range(1, len(x))]
# distance between the first city and the start point
dist.append(abs(x[0] ... | from fractions import gcd
from functools import reduce
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
assert len(x) == N
dist = [abs(y - X) for y in x]
print((reduce(gcd, dist)))
| false | 37.5 | [
"-x.sort()",
"-# distance between each two cities",
"-dist = [x[i] - x[i - 1] for i in range(1, len(x))]",
"-# distance between the first city and the start point",
"-dist.append(abs(x[0] - X))",
"+dist = [abs(y - X) for y in x]"
] | false | 0.105539 | 0.00783 | 13.478171 | [
"s672312813",
"s666079974"
] |
u870793476 | p03449 | python | s444725646 | s958918567 | 21 | 17 | 3,064 | 3,060 | Accepted | Accepted | 19.05 | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
sum = 0
for i in range(len(A1)-1):
temp = 0
for j, (k, l) in enumerate(zip(A1[1:], A2[:-1])):
if j >= i:
temp += l
else:
temp += k
sum = max(sum, temp)
pr... | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = 0
for i in range(N):
ans = max(ans, sum(A1[0:i+1] + A2[i:]))
print(ans) | 15 | 9 | 339 | 182 | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
sum = 0
for i in range(len(A1) - 1):
temp = 0
for j, (k, l) in enumerate(zip(A1[1:], A2[:-1])):
if j >= i:
temp += l
else:
temp += k
sum = max(sum, temp)
print((sum + A1[0... | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = 0
for i in range(N):
ans = max(ans, sum(A1[0 : i + 1] + A2[i:]))
print(ans)
| false | 40 | [
"-sum = 0",
"-for i in range(len(A1) - 1):",
"- temp = 0",
"- for j, (k, l) in enumerate(zip(A1[1:], A2[:-1])):",
"- if j >= i:",
"- temp += l",
"- else:",
"- temp += k",
"- sum = max(sum, temp)",
"-print((sum + A1[0] + A2[-1]))",
"+ans = 0",
"+for ... | false | 0.037966 | 0.037084 | 1.023777 | [
"s444725646",
"s958918567"
] |
u626684023 | p02623 | python | s021329112 | s868493629 | 297 | 266 | 50,628 | 50,576 | Accepted | Accepted | 10.44 | from itertools import accumulate
from bisect import bisect_right
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))
ans = 0
for i in range(N + 1):
if a[i] > K:
break
... | from itertools import accumulate
from bisect import bisect_right
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cumu = [0] + list(accumulate(A))
B_cumu = [0] + list(accumulate(B))
curr_max = 0
for i in range(N + 1):
curr = A_cumu[i]... | 18 | 19 | 390 | 448 | from itertools import accumulate
from bisect import bisect_right
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))
ans = 0
for i in range(N + 1):
if a[i] > K:
break
j = bisect_rig... | from itertools import accumulate
from bisect import bisect_right
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cumu = [0] + list(accumulate(A))
B_cumu = [0] + list(accumulate(B))
curr_max = 0
for i in range(N + 1):
curr = A_cumu[i]
if curr >... | false | 5.263158 | [
"-a = [0] + list(accumulate(A))",
"-b = [0] + list(accumulate(B))",
"-ans = 0",
"+A_cumu = [0] + list(accumulate(A))",
"+B_cumu = [0] + list(accumulate(B))",
"+curr_max = 0",
"- if a[i] > K:",
"+ curr = A_cumu[i]",
"+ if curr > K:",
"- j = bisect_right(b, K - a[i]) - 1",
"- ans = ... | false | 0.063352 | 0.060921 | 1.03991 | [
"s021329112",
"s868493629"
] |
u514118270 | p03767 | python | s855935296 | s679564973 | 235 | 184 | 37,084 | 118,472 | Accepted | Accepted | 21.7 | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort(reverse= True)
ans = 0
for i in range(N*2):
if i%2 == 1:
ans += A[i]
print(ans) | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return eval(input())
def i(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def L(): return list(in... | 8 | 27 | 157 | 610 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N * 2):
if i % 2 == 1:
ans += A[i]
print(ans)
| import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
def s():
return eval(input())
def i():
return int(eval(input()))
def S():
return input().split()
def I():
return list(map(int, input().split()))
def L(... | false | 70.37037 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"+import sys",
"+import math",
"+import itertools",
"+import bisect",
"+from copy import copy",
"+from collections import deque, Counter",
"+from decimal import Decimal",
"+",
"+",
"+def s():",
"+ ... | false | 0.047652 | 0.152026 | 0.313443 | [
"s855935296",
"s679564973"
] |
u883621917 | p02842 | python | s794937416 | s425131808 | 171 | 71 | 38,384 | 61,960 | Accepted | Accepted | 58.48 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
def bs(ok, ng, solve):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
return ok
ans = bs(ok=n, ng=0, solve=(lambda x:... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
def bs(ok, ng, solve):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
return ok
ans = bs(n, 0, lambda x: x * 1.08 >= ... | 20 | 20 | 397 | 383 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
def bs(ok, ng, solve):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
return ok
ans = bs(ok=n, ng=0, solve=(lambda x: x * 1.08 >= n)... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
def bs(ok, ng, solve):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
return ok
ans = bs(n, 0, lambda x: x * 1.08 >= n)
if int(ans *... | false | 0 | [
"-ans = bs(ok=n, ng=0, solve=(lambda x: x * 1.08 >= n))",
"+ans = bs(n, 0, lambda x: x * 1.08 >= n)"
] | false | 0.006044 | 0.035457 | 0.170448 | [
"s794937416",
"s425131808"
] |
u597455618 | p02866 | python | s845356442 | s555883635 | 77 | 68 | 24,552 | 19,764 | Accepted | Accepted | 11.69 | from collections import Counter
import sys
MOD = 998244353
def main():
n, *d = list(map(int, sys.stdin.buffer.read().split()))
D = Counter(d)
if D[0] != 1:
print((0))
else:
ans = 1
for i in d[1:]:
ans = ans*D[i-1]%MOD
print((ans % MOD))
i... | from collections import Counter
import sys
MOD = 998244353
def main():
n, *d = list(map(int, sys.stdin.buffer.read().split()))
e = [0]*n
for i in d:
e[i] += 1
ans = e[0]
for i in d[1:]:
ans *= e[i-1]
ans %= MOD
print(ans)
if __name__ == '__main__':
... | 19 | 19 | 348 | 324 | from collections import Counter
import sys
MOD = 998244353
def main():
n, *d = list(map(int, sys.stdin.buffer.read().split()))
D = Counter(d)
if D[0] != 1:
print((0))
else:
ans = 1
for i in d[1:]:
ans = ans * D[i - 1] % MOD
print((ans % MOD))
if __name__ ... | from collections import Counter
import sys
MOD = 998244353
def main():
n, *d = list(map(int, sys.stdin.buffer.read().split()))
e = [0] * n
for i in d:
e[i] += 1
ans = e[0]
for i in d[1:]:
ans *= e[i - 1]
ans %= MOD
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- D = Counter(d)",
"- if D[0] != 1:",
"- print((0))",
"- else:",
"- ans = 1",
"- for i in d[1:]:",
"- ans = ans * D[i - 1] % MOD",
"- print((ans % MOD))",
"+ e = [0] * n",
"+ for i in d:",
"+ e[i] += 1",
"+ ans = e[0]",
"+ f... | false | 0.031236 | 0.038149 | 0.818799 | [
"s845356442",
"s555883635"
] |
u678167152 | p03854 | python | s679063300 | s185276902 | 211 | 79 | 42,096 | 9,808 | Accepted | Accepted | 62.56 | def check():
S = eval(input())
dp = [False]*len(S)
dp[-1]=True
for i in range(1,len(S)):
dp[i] = (dp[i-5]&(S[max(0,i-4):i+1]in['dream','erase']))|(dp[i-7]&(S[max(0,i-6):i+1]=='dreamer'))|(dp[i-6]&(S[max(0,i-5):i+1]=='eraser'))
if dp[-1]:
return 'YES'
return 'NO'
print(... | def check():
S = eval(input())
n = len(S)
dp = [False]*(n+10)
dp[0] = True
for i in range(n+1):
if S[i:i+5]=='dream':
dp[i+5] |= dp[i]
if S[i:i+7]=='dreamer':
dp[i+7] |= dp[i]
if S[i:i+5]=='erase':
dp[i+5] |= dp[i]
if S[i:i+6]=='eraser':
dp[i+6] |= dp[i]
... | 11 | 18 | 322 | 379 | def check():
S = eval(input())
dp = [False] * len(S)
dp[-1] = True
for i in range(1, len(S)):
dp[i] = (
(dp[i - 5] & (S[max(0, i - 4) : i + 1] in ["dream", "erase"]))
| (dp[i - 7] & (S[max(0, i - 6) : i + 1] == "dreamer"))
| (dp[i - 6] & (S[max(0, i - 5) : i +... | def check():
S = eval(input())
n = len(S)
dp = [False] * (n + 10)
dp[0] = True
for i in range(n + 1):
if S[i : i + 5] == "dream":
dp[i + 5] |= dp[i]
if S[i : i + 7] == "dreamer":
dp[i + 7] |= dp[i]
if S[i : i + 5] == "erase":
dp[i + 5] |= d... | false | 38.888889 | [
"- dp = [False] * len(S)",
"- dp[-1] = True",
"- for i in range(1, len(S)):",
"- dp[i] = (",
"- (dp[i - 5] & (S[max(0, i - 4) : i + 1] in [\"dream\", \"erase\"]))",
"- | (dp[i - 7] & (S[max(0, i - 6) : i + 1] == \"dreamer\"))",
"- | (dp[i - 6] & (S[max(0,... | false | 0.093304 | 0.035786 | 2.607286 | [
"s679063300",
"s185276902"
] |
u460245024 | p03353 | python | s195637245 | s908038528 | 43 | 38 | 4,592 | 4,592 | Accepted | Accepted | 11.63 | S = eval(input())
K = int(eval(input()))
substring_set = set()
for i in range(len(S)):
substring = []
for j in range(min([K, len(S)-i])):
substring.append(S[i+j])
substring_set.add(''.join(substring))
print((sorted(list(substring_set))[K-1]))
| S = eval(input())
K = int(eval(input()))
len_s = len(S)
substring_set = set()
for i in range(len_s):
for j in range(min([K, len_s-i])):
substring_set.add(S[i:i+j+1])
sorted_list = sorted(list(substring_set))
print((sorted_list[K-1]))
| 11 | 11 | 265 | 244 | S = eval(input())
K = int(eval(input()))
substring_set = set()
for i in range(len(S)):
substring = []
for j in range(min([K, len(S) - i])):
substring.append(S[i + j])
substring_set.add("".join(substring))
print((sorted(list(substring_set))[K - 1]))
| S = eval(input())
K = int(eval(input()))
len_s = len(S)
substring_set = set()
for i in range(len_s):
for j in range(min([K, len_s - i])):
substring_set.add(S[i : i + j + 1])
sorted_list = sorted(list(substring_set))
print((sorted_list[K - 1]))
| false | 0 | [
"+len_s = len(S)",
"-for i in range(len(S)):",
"- substring = []",
"- for j in range(min([K, len(S) - i])):",
"- substring.append(S[i + j])",
"- substring_set.add(\"\".join(substring))",
"-print((sorted(list(substring_set))[K - 1]))",
"+for i in range(len_s):",
"+ for j in ran... | false | 0.034523 | 0.038124 | 0.905531 | [
"s195637245",
"s908038528"
] |
u244999348 | p03162 | python | s361144552 | s741525320 | 548 | 484 | 39,044 | 20,740 | Accepted | Accepted | 11.68 | import sys
#import unittest
#import collections
def plan_vacation(activity, n):
dp = [[0] * 3 for i in range(n)]
for i in range(3):
dp[0][i] = activity[0][i]
for i in range(1, n):
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp[i][j], dp[i-1][k] + activity[i][j])
... | import sys
#import unittest
#import collections
def plan_vacation(activity, n):
dp = [0] * 3
for i in range(3):
dp[i] = activity[0][i]
for i in range(1, n):
new_dp = [0] * 3
for j in range(3):
for k in range(3):
if j != k:
new_dp[j] = max(new_dp[j], dp[k] + activity[i][j])
dp =... | 31 | 33 | 679 | 683 | import sys
# import unittest
# import collections
def plan_vacation(activity, n):
dp = [[0] * 3 for i in range(n)]
for i in range(3):
dp[0][i] = activity[0][i]
for i in range(1, n):
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = m... | import sys
# import unittest
# import collections
def plan_vacation(activity, n):
dp = [0] * 3
for i in range(3):
dp[i] = activity[0][i]
for i in range(1, n):
new_dp = [0] * 3
for j in range(3):
for k in range(3):
if j != k:
new_dp[j] ... | false | 6.060606 | [
"- dp = [[0] * 3 for i in range(n)]",
"+ dp = [0] * 3",
"- dp[0][i] = activity[0][i]",
"+ dp[i] = activity[0][i]",
"+ new_dp = [0] * 3",
"- dp[i][j] = max(dp[i][j], dp[i - 1][k] + activity[i][j])",
"- return max(dp[n - 1])",
"+ new_dp... | false | 0.049067 | 0.073602 | 0.666654 | [
"s361144552",
"s741525320"
] |
u645250356 | p03108 | python | s879065630 | s935736641 | 720 | 356 | 37,400 | 104,704 | Accepted | Accepted | 50.56 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | 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... | 78 | 67 | 1,852 | 1,762 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | 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 | 14.102564 | [
"-import sys, bisect, math, itertools, fractions, pprint",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-mod2 = 998244353",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"- # 根を返す",
"+ def ... | false | 0.047759 | 0.066971 | 0.713131 | [
"s879065630",
"s935736641"
] |
u402547605 | p02820 | python | s978970282 | s869227253 | 96 | 83 | 4,212 | 4,212 | Accepted | Accepted | 13.54 | n,k = list(map(int,input().split()))
r,s,p = list(map(int,input().split()))
t = eval(input())
ans = 0
ans_list = [0 for i in range(n)]
for i in range(len(t)):
if t[i] == 'r':
if (t[i-k] != 'r') | (ans_list[i-k] == 0):
ans_list[i] = 1
ans += p
else:
ans_list[i] = 0
ans += ... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
point = 0
win = [0 for i in range(len(t))]
for i in range(len(t)):
if t[i] == 'r':
if (t[i-k] != 'r') or (win[i-k] != 1):
point += p
win[i] = 1
if t[i] == 's':
if (t[i-k] != 's') or ... | 30 | 23 | 635 | 475 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ans = 0
ans_list = [0 for i in range(n)]
for i in range(len(t)):
if t[i] == "r":
if (t[i - k] != "r") | (ans_list[i - k] == 0):
ans_list[i] = 1
ans += p
else:
ans_li... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
point = 0
win = [0 for i in range(len(t))]
for i in range(len(t)):
if t[i] == "r":
if (t[i - k] != "r") or (win[i - k] != 1):
point += p
win[i] = 1
if t[i] == "s":
if (t[i -... | false | 23.333333 | [
"-ans = 0",
"-ans_list = [0 for i in range(n)]",
"+point = 0",
"+win = [0 for i in range(len(t))]",
"- if (t[i - k] != \"r\") | (ans_list[i - k] == 0):",
"- ans_list[i] = 1",
"- ans += p",
"- else:",
"- ans_list[i] = 0",
"- ans += 0",
"+ ... | false | 0.043739 | 0.104237 | 0.419611 | [
"s978970282",
"s869227253"
] |
u901582103 | p03317 | python | s411972301 | s045368914 | 40 | 19 | 13,880 | 4,724 | Accepted | Accepted | 52.5 | n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
print(((n-2)//(k-1)+1)) | n,k=list(map(int,input().split()))
eval(input())
if n==k:
print((1))
else:
print((1+(n-2)//(k-1))) | 3 | 6 | 85 | 95 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
print(((n - 2) // (k - 1) + 1))
| n, k = list(map(int, input().split()))
eval(input())
if n == k:
print((1))
else:
print((1 + (n - 2) // (k - 1)))
| false | 50 | [
"-A = list(map(int, input().split()))",
"-print(((n - 2) // (k - 1) + 1))",
"+eval(input())",
"+if n == k:",
"+ print((1))",
"+else:",
"+ print((1 + (n - 2) // (k - 1)))"
] | false | 0.038878 | 0.047855 | 0.812404 | [
"s411972301",
"s045368914"
] |
u150984829 | p02234 | python | s197580044 | s617125716 | 90 | 80 | 5,720 | 5,712 | Accepted | Accepted | 11.11 | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if 1>m[r][c]or m[r][c]>x:m[r][c]=x
print((m[r]... | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if not 0<m[r][c]<=x:m[r][c]=x
print((m[r][c]))... | 13 | 13 | 346 | 341 | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | false | 0 | [
"- if 1 > m[r][c] or m[r][c] > x:",
"+ if not 0 < m[r][c] <= x:"
] | false | 0.045793 | 0.118374 | 0.386849 | [
"s197580044",
"s617125716"
] |
u549211107 | p02779 | python | s502403889 | s151938119 | 93 | 85 | 26,320 | 26,804 | Accepted | Accepted | 8.6 | import collections
N=int(eval(input()))
L=list(map(int,input().split()))
a=len(L)
c=len(set(L))
if a==c:
print('YES')
else:print('NO') | N=int(eval(input()))
L=list(map(int,input().split()))
a=len(L)
c=len(set(L))
if a==c:
print('YES')
else:print('NO')
| 8 | 7 | 139 | 120 | import collections
N = int(eval(input()))
L = list(map(int, input().split()))
a = len(L)
c = len(set(L))
if a == c:
print("YES")
else:
print("NO")
| N = int(eval(input()))
L = list(map(int, input().split()))
a = len(L)
c = len(set(L))
if a == c:
print("YES")
else:
print("NO")
| false | 12.5 | [
"-import collections",
"-"
] | false | 0.047699 | 0.040535 | 1.176724 | [
"s502403889",
"s151938119"
] |
u285891772 | p03425 | python | s847573460 | s278868146 | 429 | 226 | 31,428 | 19,952 | Accepted | Accepted | 47.32 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy... | 36 | 41 | 1,171 | 1,203 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
product,
groupby,
)
from operator import itemgetter, mu... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
product,
groupby,
)
from operator import itemgetter, mu... | false | 12.195122 | [
"-march_lis = [0] * 5",
"+cnt = defaultdict(int)",
"- if s[0].upper() in march:",
"- march_lis[march.index(s[0].upper())] += 1",
"+ if s[0] in march:",
"+ cnt[s[0]] += 1",
"-for x, y, z in combinations(march_lis, 3):",
"+# print(cnt)",
"+# print(cnt.keys())",
"+# print(cnt.valu... | false | 0.045723 | 0.088592 | 0.516105 | [
"s847573460",
"s278868146"
] |
u170765582 | p02708 | python | s673894116 | s993724630 | 137 | 21 | 19,768 | 9,184 | Accepted | Accepted | 84.67 | a,b=list(map(int,input().split()))
wa=lambda a,b:(a+b)*(b-a+1)//2
print((sum([wa(a+2-i,a+1)-wa(0,i)+1for i in range(b,a+2)])%(10**9+7))) | from math import comb as c
a,b=list(map(int,input().split()))
print((((c(a+2,2)+1)*(a+2-b)-c(a+3-b,3)-c(a+3,3)+c(b+1,3))%(10**9+7))) | 3 | 3 | 130 | 126 | a, b = list(map(int, input().split()))
wa = lambda a, b: (a + b) * (b - a + 1) // 2
print(
(
sum([wa(a + 2 - i, a + 1) - wa(0, i) + 1 for i in range(b, a + 2)])
% (10**9 + 7)
)
)
| from math import comb as c
a, b = list(map(int, input().split()))
print(
(
((c(a + 2, 2) + 1) * (a + 2 - b) - c(a + 3 - b, 3) - c(a + 3, 3) + c(b + 1, 3))
% (10**9 + 7)
)
)
| false | 0 | [
"+from math import comb as c",
"+",
"-wa = lambda a, b: (a + b) * (b - a + 1) // 2",
"- sum([wa(a + 2 - i, a + 1) - wa(0, i) + 1 for i in range(b, a + 2)])",
"+ ((c(a + 2, 2) + 1) * (a + 2 - b) - c(a + 3 - b, 3) - c(a + 3, 3) + c(b + 1, 3))"
] | false | 0.117328 | 0.067874 | 1.728633 | [
"s673894116",
"s993724630"
] |
u677440371 | p03111 | python | s426181713 | s291301168 | 317 | 282 | 10,996 | 10,996 | Accepted | Accepted | 11.04 | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
import itertools
m = 4
n = N
bit_list = list(itertools.product([i for i in range(m)], repeat=n))
res = 10 ** 18
for b in bit_list:
tmp1 = 0
tmp2 = 0
tmp3 = 0
check1 = False
check2 = False
che... | N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
L.append(int(eval(input())))
import itertools
m = 4
bit_list = list(itertools.product([i for i in range(m)], repeat=N))
ans = 10 ** 18
for bit in bit_list:
retA = 0
retB = 0
retC = 0
checkA = False
checkB =... | 38 | 36 | 896 | 868 | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
import itertools
m = 4
n = N
bit_list = list(itertools.product([i for i in range(m)], repeat=n))
res = 10**18
for b in bit_list:
tmp1 = 0
tmp2 = 0
tmp3 = 0
check1 = False
check2 = False
check3 = False
co... | N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
L.append(int(eval(input())))
import itertools
m = 4
bit_list = list(itertools.product([i for i in range(m)], repeat=N))
ans = 10**18
for bit in bit_list:
retA = 0
retB = 0
retC = 0
checkA = False
checkB = False
checkC = ... | false | 5.263158 | [
"-L = [int(eval(input())) for _ in range(N)]",
"+L = []",
"+for i in range(N):",
"+ L.append(int(eval(input())))",
"-n = N",
"-bit_list = list(itertools.product([i for i in range(m)], repeat=n))",
"-res = 10**18",
"-for b in bit_list:",
"- tmp1 = 0",
"- tmp2 = 0",
"- tmp3 = 0",
"- ... | false | 0.314077 | 0.322911 | 0.972641 | [
"s426181713",
"s291301168"
] |
u562935282 | p03162 | python | s644695025 | s829372326 | 700 | 642 | 82,392 | 59,628 | Accepted | Accepted | 8.29 | n = int(eval(input()))
v = tuple(tuple(map(int, input().split())) for _ in range(n))
e = tuple(zip(*v))
# e[j][i(0-indexed)]:=i日目に活動jして得る幸福度
# print(e)
dp = tuple([0] * 3 for _ in range(n + 1))
# dp[i(1-indexed)][j]:=i日目に活動jした最大幸福度
# もらう
for i in range(n):
for j in range(3):
dp[i + 1][j] = max... | def main():
import sys
readline = sys.stdin.readline
n = int(readline())
dp = [[0] * 3 for _ in range(n + 1)]
for i in range(1, n + 1): # i日目の最大幸福度,1-indexed
a, b, c = list(map(int, input().split()))
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a
dp[i][1] = max... | 14 | 19 | 384 | 472 | n = int(eval(input()))
v = tuple(tuple(map(int, input().split())) for _ in range(n))
e = tuple(zip(*v))
# e[j][i(0-indexed)]:=i日目に活動jして得る幸福度
# print(e)
dp = tuple([0] * 3 for _ in range(n + 1))
# dp[i(1-indexed)][j]:=i日目に活動jした最大幸福度
# もらう
for i in range(n):
for j in range(3):
dp[i + 1][j] = max(dp[i][(j + 1)... | def main():
import sys
readline = sys.stdin.readline
n = int(readline())
dp = [[0] * 3 for _ in range(n + 1)]
for i in range(1, n + 1): # i日目の最大幸福度,1-indexed
a, b, c = list(map(int, input().split()))
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a
dp[i][1] = max(dp[i - 1][2]... | false | 26.315789 | [
"-n = int(eval(input()))",
"-v = tuple(tuple(map(int, input().split())) for _ in range(n))",
"-e = tuple(zip(*v))",
"-# e[j][i(0-indexed)]:=i日目に活動jして得る幸福度",
"-# print(e)",
"-dp = tuple([0] * 3 for _ in range(n + 1))",
"-# dp[i(1-indexed)][j]:=i日目に活動jした最大幸福度",
"-# もらう",
"-for i in range(n):",
"- ... | false | 0.05953 | 0.069918 | 0.851431 | [
"s644695025",
"s829372326"
] |
u609061751 | p03095 | python | s939095763 | s236076729 | 178 | 34 | 39,280 | 3,828 | Accepted | Accepted | 80.9 | import sys
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
s = input().rstrip()
from collections import Counter
c = Counter(s)
n_ = len(list(c.keys()))
ans = 1
for i in list(c.keys()):
ans *= (c[i] + 1)
ans %= mod
ans -= 1
print(ans) | import sys
input = lambda : sys.stdin.readline().rstrip()
mod = 10**9 + 7
n = int(eval(input()))
s = eval(input())
from collections import Counter
c = Counter(s)
ans = 1
for i in c:
ans *= c[i] + 1
ans %= mod
ans -= 1
print(ans)
| 22 | 15 | 270 | 249 | import sys
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
s = input().rstrip()
from collections import Counter
c = Counter(s)
n_ = len(list(c.keys()))
ans = 1
for i in list(c.keys()):
ans *= c[i] + 1
ans %= mod
ans -= 1
print(ans)
| import sys
input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7
n = int(eval(input()))
s = eval(input())
from collections import Counter
c = Counter(s)
ans = 1
for i in c:
ans *= c[i] + 1
ans %= mod
ans -= 1
print(ans)
| false | 31.818182 | [
"-input = sys.stdin.readline",
"+input = lambda: sys.stdin.readline().rstrip()",
"-s = input().rstrip()",
"+s = eval(input())",
"-n_ = len(list(c.keys()))",
"-for i in list(c.keys()):",
"+for i in c:"
] | false | 0.039043 | 0.055515 | 0.703293 | [
"s939095763",
"s236076729"
] |
u301624971 | p02843 | python | s605776707 | s860236218 | 168 | 20 | 3,060 | 3,064 | Accepted | Accepted | 88.1 | import itertools
def modelAnswer(X:int):
lis = [i for i in range(100,106)]
C = X//100
for p in itertools.combinations_with_replacement(lis,C):
if(sum(p)==X):
return 1
return 0
def main():
X = int(eval(input()))
print((modelAnswer(X)))
if __name__ == '__main__':
main() | def solve(X:int) -> int:
if(X < 100):return 0
first = int(str(X)[-1])
seccond = int(str(X)[-2])
ans = 0
if(first >= 6):
ans += first + 200
elif(first > 0):
ans += first + 100
ans += (seccond * 2) * 105
return 1 if(ans <= X) else 0
def main():
X = int(e... | 15 | 21 | 312 | 395 | import itertools
def modelAnswer(X: int):
lis = [i for i in range(100, 106)]
C = X // 100
for p in itertools.combinations_with_replacement(lis, C):
if sum(p) == X:
return 1
return 0
def main():
X = int(eval(input()))
print((modelAnswer(X)))
if __name__ == "__main__":
... | def solve(X: int) -> int:
if X < 100:
return 0
first = int(str(X)[-1])
seccond = int(str(X)[-2])
ans = 0
if first >= 6:
ans += first + 200
elif first > 0:
ans += first + 100
ans += (seccond * 2) * 105
return 1 if (ans <= X) else 0
def main():
X = int(eval(in... | false | 28.571429 | [
"-import itertools",
"-",
"-",
"-def modelAnswer(X: int):",
"- lis = [i for i in range(100, 106)]",
"- C = X // 100",
"- for p in itertools.combinations_with_replacement(lis, C):",
"- if sum(p) == X:",
"- return 1",
"- return 0",
"+def solve(X: int) -> int:",
"+ ... | false | 0.096062 | 0.074464 | 1.290038 | [
"s605776707",
"s860236218"
] |
u102461423 | p02680 | python | s541884372 | s476119304 | 737 | 131 | 102,692 | 32,512 | Accepted | Accepted | 82.23 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([A, B, D, [... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([D, [0, -IN... | 103 | 107 | 2,523 | 2,627 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([D, [0, -INF, INF]]))
... | false | 3.738318 | [
"- X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]]))",
"- Y = np.unique(np.concatenate([C, E, F, [0, -INF, INF]]))",
"+ X = np.unique(np.concatenate([D, [0, -INF, INF]]))",
"+ Y = np.unique(np.concatenate([C, [0, -INF, INF]]))",
"- B = np.searchsorted(X, B)",
"+ B = np.searchsorte... | false | 1.089211 | 0.622462 | 1.749843 | [
"s541884372",
"s476119304"
] |
u247211039 | p02917 | python | s710048459 | s496534728 | 30 | 27 | 8,992 | 9,232 | Accepted | Accepted | 10 | N = int(eval(input()))
B = list(map(int, input().split()))
A=[10**6]*N
for i in range(N-1):
if A[i] >= B[i]:
A[i] = B[i]
if A[i+1] >= B[i]:
A[i+1] = B[i]
print((sum(A))) | N=int(eval(input()))
B=list(map(int,input().split()))
A=[0]*N
A[0]=B[0]
A[1]=B[0]
for i in range(1,N-1):
A[i+1]=B[i]
if A[i] > B[i]:
A[i] = B[i]
print((sum(A))) | 12 | 13 | 199 | 184 | N = int(eval(input()))
B = list(map(int, input().split()))
A = [10**6] * N
for i in range(N - 1):
if A[i] >= B[i]:
A[i] = B[i]
if A[i + 1] >= B[i]:
A[i + 1] = B[i]
print((sum(A)))
| N = int(eval(input()))
B = list(map(int, input().split()))
A = [0] * N
A[0] = B[0]
A[1] = B[0]
for i in range(1, N - 1):
A[i + 1] = B[i]
if A[i] > B[i]:
A[i] = B[i]
print((sum(A)))
| false | 7.692308 | [
"-A = [10**6] * N",
"-for i in range(N - 1):",
"- if A[i] >= B[i]:",
"+A = [0] * N",
"+A[0] = B[0]",
"+A[1] = B[0]",
"+for i in range(1, N - 1):",
"+ A[i + 1] = B[i]",
"+ if A[i] > B[i]:",
"- if A[i + 1] >= B[i]:",
"- A[i + 1] = B[i]"
] | false | 0.039811 | 0.036402 | 1.093673 | [
"s710048459",
"s496534728"
] |
u296518383 | p03163 | python | s778487414 | s035721603 | 332 | 297 | 45,436 | 42,092 | Accepted | Accepted | 10.54 | N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [-1 for _ in range(W + 1)] # dp[重量の総和]:= 価値の総和
dp[0] = 0
for i in range(N):
w, v = wv[i]
for j in range(W, -1, -1):
if dp[j] >= 0 and j + w <= W:
dp[j+w] = max(dp[j+w], dp[j]+v)
pri... | # 埋める配列
# dp[w] : 入っている重さがwのときの価値の最大値
# 計算方法
# dp[0][0] = 0
# dp[w] = max(dp[w - wi] + vi)
# 埋める順序
# 後ろから
N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [0] * (W + 1)
for i in range(N):
wi, vi = wv[i]
for j in range(W, -1, -1):
i... | 13 | 21 | 325 | 406 | N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [-1 for _ in range(W + 1)] # dp[重量の総和]:= 価値の総和
dp[0] = 0
for i in range(N):
w, v = wv[i]
for j in range(W, -1, -1):
if dp[j] >= 0 and j + w <= W:
dp[j + w] = max(dp[j + w], dp[j] + v)
print(... | # 埋める配列
# dp[w] : 入っている重さがwのときの価値の最大値
# 計算方法
# dp[0][0] = 0
# dp[w] = max(dp[w - wi] + vi)
# 埋める順序
# 後ろから
N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [0] * (W + 1)
for i in range(N):
wi, vi = wv[i]
for j in range(W, -1, -1):
if j - wi >= 0:
... | false | 38.095238 | [
"+# 埋める配列",
"+# dp[w] : 入っている重さがwのときの価値の最大値",
"+# 計算方法",
"+# dp[0][0] = 0",
"+# dp[w] = max(dp[w - wi] + vi)",
"+# 埋める順序",
"+# 後ろから",
"-dp = [-1 for _ in range(W + 1)] # dp[重量の総和]:= 価値の総和",
"-dp[0] = 0",
"+dp = [0] * (W + 1)",
"- w, v = wv[i]",
"+ wi, vi = wv[i]",
"- if dp[j] >... | false | 0.039924 | 0.039716 | 1.005241 | [
"s778487414",
"s035721603"
] |
u589381719 | p03162 | python | s607900775 | s966948882 | 994 | 784 | 50,340 | 50,332 | Accepted | Accepted | 21.13 | N=int(eval(input()))
dp=[[0]*3 for _ in range(N+1)]
abc=[list(map(int,input().split())) for _ in range(N)]
for i in range(N):
for j in range(3): #移動元
for k in range(3): #移動先
if j==k: continue
dp[i+1][k] = max(dp[i+1][k], dp[i][j]+abc[i][k])
print((max(dp[N]))) | def main():
N=int(eval(input()))
dp=[[0]*3 for _ in range(N+1)]
abc=[list(map(int,input().split())) for _ in range(N)]
for i in range(N):
for j in range(3): #移動元
for k in range(3): #移動先
if j==k: continue
dp[i+1][k] = max(dp[i+1][k], dp[i][j]+ab... | 9 | 13 | 296 | 391 | N = int(eval(input()))
dp = [[0] * 3 for _ in range(N + 1)]
abc = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
for j in range(3): # 移動元
for k in range(3): # 移動先
if j == k:
continue
dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + abc[i][k])
prin... | def main():
N = int(eval(input()))
dp = [[0] * 3 for _ in range(N + 1)]
abc = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
for j in range(3): # 移動元
for k in range(3): # 移動先
if j == k:
continue
dp[i + 1][k... | false | 30.769231 | [
"-N = int(eval(input()))",
"-dp = [[0] * 3 for _ in range(N + 1)]",
"-abc = [list(map(int, input().split())) for _ in range(N)]",
"-for i in range(N):",
"- for j in range(3): # 移動元",
"- for k in range(3): # 移動先",
"- if j == k:",
"- continue",
"- dp[i ... | false | 0.037964 | 0.036099 | 1.051657 | [
"s607900775",
"s966948882"
] |
u389910364 | p03013 | python | s337318177 | s112374237 | 775 | 138 | 21,668 | 9,604 | Accepted | Accepted | 82.19 | import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N, M = list(map(int, sys.stdin.readline().split()))
A = [int(sys.stdin.readline()) for _ in range(M)]
MOD = 10 ** 9 + 7
A = np.array(A)
# http... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N, M = list(map(int, sys.stdin.readline().split()))
A = [int(sys.stdin.readline()) for _ in range(M)]
MOD = 10 ** 9 + 7
safe = [True for _ in range(N + 1)]
for a in A:
... | 115 | 29 | 2,143 | 622 | import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N, M = list(map(int, sys.stdin.readline().split()))
A = [int(sys.stdin.readline()) for _ in range(M)]
MOD = 10**9 + 7
A = np.array(A)
# https://atcoder.jp/contests/ab... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N, M = list(map(int, sys.stdin.readline().split()))
A = [int(sys.stdin.readline()) for _ in range(M)]
MOD = 10**9 + 7
safe = [True for _ in range(N + 1)]
for a in A:
safe[a] = False... | false | 74.782609 | [
"-import numpy as np",
"-A = np.array(A)",
"-# https://atcoder.jp/contests/abc066/submissions/5721975",
"-def mod_invs(max, mod):",
"- \"\"\"",
"- 逆元のリスト 0 から max まで",
"- https://atcoder.jp/contests/abc127/submissions/5630531",
"- ここから。あんまり良くわかってない",
"- :param max:",
"- :param mo... | false | 0.370295 | 0.037592 | 9.850308 | [
"s337318177",
"s112374237"
] |
u254871849 | p02811 | python | s172566726 | s186224153 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | import sys
k, x = list(map(int, sys.stdin.readline().split()))
def main():
return 'Yes' if 500 * k >= x else 'No'
if __name__ == '__main__':
ans = main()
print(ans) | import sys
k, x = list(map(int, sys.stdin.readline().split()))
def main():
ans = 'Yes' if 500*k >= x else 'No'
print(ans)
if __name__ == '__main__':
main() | 10 | 10 | 182 | 174 | import sys
k, x = list(map(int, sys.stdin.readline().split()))
def main():
return "Yes" if 500 * k >= x else "No"
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
k, x = list(map(int, sys.stdin.readline().split()))
def main():
ans = "Yes" if 500 * k >= x else "No"
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- return \"Yes\" if 500 * k >= x else \"No\"",
"+ ans = \"Yes\" if 500 * k >= x else \"No\"",
"+ print(ans)",
"- ans = main()",
"- print(ans)",
"+ main()"
] | false | 0.052058 | 0.149848 | 0.347403 | [
"s172566726",
"s186224153"
] |
u225845681 | p02603 | python | s262689613 | s473133013 | 75 | 33 | 61,828 | 9,208 | Accepted | Accepted | 56 | N = int(eval(input()))
A = list(map(int,input().split()))+[0]
kane = 1000
kabu = 0
baibai = []
#1は買い時、-1は売り時、0は無視
for i in range(N):
sa = A[i+1] -A[i]
if sa == 0:
baibai.append(0)
elif sa != abs(sa):
baibai.append(-1)
else:
baibai.append(1)
#最後の売り時
if 1 in bai... | N = int(eval(input()))
A = list(map(int,input().split()))+[0]
kane = 1000
kabu = 0
baibai = []
#1は買い時、-1は売り時、0は無視
for i in range(N):
sa = A[i+1] -A[i]
if sa == 0:
baibai.append(0)
elif sa != abs(sa):
baibai.append(-1)
else:
baibai.append(1)
#baibai通りに売買(最後の売り... | 36 | 27 | 690 | 518 | N = int(eval(input()))
A = list(map(int, input().split())) + [0]
kane = 1000
kabu = 0
baibai = []
# 1は買い時、-1は売り時、0は無視
for i in range(N):
sa = A[i + 1] - A[i]
if sa == 0:
baibai.append(0)
elif sa != abs(sa):
baibai.append(-1)
else:
baibai.append(1)
# 最後の売り時
if 1 in baibai:
uri... | N = int(eval(input()))
A = list(map(int, input().split())) + [0]
kane = 1000
kabu = 0
baibai = []
# 1は買い時、-1は売り時、0は無視
for i in range(N):
sa = A[i + 1] - A[i]
if sa == 0:
baibai.append(0)
elif sa != abs(sa):
baibai.append(-1)
else:
baibai.append(1)
# baibai通りに売買(最後の売り時で打ち切り)
for j... | false | 25 | [
"-# 最後の売り時",
"-if 1 in baibai:",
"- uri = N - (baibai[::-1].index(1))",
"-else:",
"- uri = -1",
"- if j == uri:",
"- kane += A[j] * kabu",
"- print(kane)",
"- exit()",
"- elif baibai[j] > 0:",
"+ if baibai[j] > 0:"
] | false | 0.045787 | 0.033317 | 1.374274 | [
"s262689613",
"s473133013"
] |
u482157295 | p02848 | python | s288006755 | s236486934 | 38 | 23 | 3,060 | 3,064 | Accepted | Accepted | 39.47 | mojiretu = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
output = ""
index = 0
N = int(eval(input()))
S = eval(input())
for j in S:
count = 0
for i in mojiretu:
if i == j:
output = output + (mojiretu[count + N])
break
count = count + 1
index = index + 1
print(outpu... | n = int(eval(input()))
s = eval(input())
ans = ""
for i in s:
s_asc = ord(i)
dum = s_asc + n
if dum > ord("Z"):
dum = dum - 26
ans = ans + chr(dum)
print(ans) | 16 | 10 | 310 | 179 | mojiretu = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
output = ""
index = 0
N = int(eval(input()))
S = eval(input())
for j in S:
count = 0
for i in mojiretu:
if i == j:
output = output + (mojiretu[count + N])
break
count = count + 1
index = index + 1
print... | n = int(eval(input()))
s = eval(input())
ans = ""
for i in s:
s_asc = ord(i)
dum = s_asc + n
if dum > ord("Z"):
dum = dum - 26
ans = ans + chr(dum)
print(ans)
| false | 37.5 | [
"-mojiretu = \"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
"-output = \"\"",
"-index = 0",
"-N = int(eval(input()))",
"-S = eval(input())",
"-for j in S:",
"- count = 0",
"- for i in mojiretu:",
"- if i == j:",
"- output = output + (mojiretu[count + N])",
"- ... | false | 0.070581 | 0.03685 | 1.915393 | [
"s288006755",
"s236486934"
] |
u584174687 | p03837 | python | s747632771 | s026655799 | 489 | 233 | 53,468 | 40,432 | Accepted | Accepted | 52.35 |
from collections import defaultdict
import heapq
def main():
node_num, edge_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(edge_num)]
graph_data = defaultdict(set)
weight_data = defaultdict(int)
for i in range(edge_num):
a, b, c... |
def main():
node_num, edge_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(edge_num)]
inf = 10 ** 5 + 1
length_data = [[inf for i in range(node_num + 1)] for j in range(node_num + 1)]
for i in range(edge_num):
a, b, c = data[i]
... | 73 | 29 | 2,195 | 788 | from collections import defaultdict
import heapq
def main():
node_num, edge_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(edge_num)]
graph_data = defaultdict(set)
weight_data = defaultdict(int)
for i in range(edge_num):
a, b, c = data[i]
... | def main():
node_num, edge_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(edge_num)]
inf = 10**5 + 1
length_data = [[inf for i in range(node_num + 1)] for j in range(node_num + 1)]
for i in range(edge_num):
a, b, c = data[i]
length_data[a... | false | 60.273973 | [
"-from collections import defaultdict",
"-import heapq",
"-",
"-",
"- graph_data = defaultdict(set)",
"- weight_data = defaultdict(int)",
"+ inf = 10**5 + 1",
"+ length_data = [[inf for i in range(node_num + 1)] for j in range(node_num + 1)]",
"- graph_data[a].add(b)",
"- ... | false | 0.044363 | 0.041686 | 1.064222 | [
"s747632771",
"s026655799"
] |
u102278909 | p02675 | python | s482380555 | s517038981 | 120 | 66 | 65,560 | 65,608 | Accepted | Accepted | 45 | # coding: utf-8
import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI()... | # coding: utf-8
import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return... | 32 | 31 | 891 | 830 | # coding: utf-8
import sys
import math
import collections
import itertools
import bisect
INF = 10**13
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def gcd(x, y):
return x if y == 0 else gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
def I():
return int(input())
d... | # coding: utf-8
import sys
import math
import collections
import itertools
INF = 10**13
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def lcm(x, y):
return (x * y) // math.gcd(x, y)
def I():
return int(input())
def LI():
return [int(x) for x in input().split()]
def RI(N):
... | false | 3.125 | [
"-import bisect",
"-def gcd(x, y):",
"- return x if y == 0 else gcd(y, x % y)",
"-",
"-",
"- return (x * y) // gcd(x, y)",
"+ return (x * y) // math.gcd(x, y)"
] | false | 0.037974 | 0.037869 | 1.002782 | [
"s482380555",
"s517038981"
] |
u977389981 | p03287 | python | s319995477 | s453957054 | 121 | 103 | 14,628 | 14,636 | Accepted | Accepted | 14.88 | from collections import Counter
N, M = list(map(int, input().split()))
A = [0] + [int(i) for i in input().split()]
for i in range(N):
A[i + 1] += A[i]
A[i + 1] %= M
def comb(n, k):
k = min(k, n - k)
result = 1
for i in range(n, n - k, -1):
result *= i
for i in range(1,... | from collections import Counter
N, M = list(map(int, input().split()))
A = [0] + [int(i) for i in input().split()]
for i in range(N):
A[i + 1] += A[i]
A[i + 1] %= M
ans = 0
for i in list(Counter(A).values()):
if i > 1:
ans += i * (i - 1) // 2
print(ans) | 23 | 14 | 462 | 277 | from collections import Counter
N, M = list(map(int, input().split()))
A = [0] + [int(i) for i in input().split()]
for i in range(N):
A[i + 1] += A[i]
A[i + 1] %= M
def comb(n, k):
k = min(k, n - k)
result = 1
for i in range(n, n - k, -1):
result *= i
for i in range(1, k + 1):
... | from collections import Counter
N, M = list(map(int, input().split()))
A = [0] + [int(i) for i in input().split()]
for i in range(N):
A[i + 1] += A[i]
A[i + 1] %= M
ans = 0
for i in list(Counter(A).values()):
if i > 1:
ans += i * (i - 1) // 2
print(ans)
| false | 39.130435 | [
"-",
"-",
"-def comb(n, k):",
"- k = min(k, n - k)",
"- result = 1",
"- for i in range(n, n - k, -1):",
"- result *= i",
"- for i in range(1, k + 1):",
"- result //= i",
"- return result",
"-",
"-",
"- ans += comb(i, 2)",
"+ ans += i * (i - 1) // ... | false | 0.12514 | 0.067622 | 1.850587 | [
"s319995477",
"s453957054"
] |
u896741788 | p03835 | python | s930996489 | s473959962 | 1,476 | 29 | 2,940 | 9,312 | Accepted | Accepted | 98.04 | k,s=list(map(int,input().split()))
ret=0
k+=1
for i in range(k):
for j in range(k):
d=s-i-j
if k>d>=0:
ret+=1
print(ret)
| k,s=list(map(int,input().split()))
dp=[0]*(3*k+4)
dp[0]=1
dp[k+1]=-3
dp[2*k+2]=3
dp[-1]=-1
from itertools import accumulate
dp=list(accumulate(list(accumulate(list(accumulate(dp))))))
print((dp[s])) | 9 | 9 | 139 | 198 | k, s = list(map(int, input().split()))
ret = 0
k += 1
for i in range(k):
for j in range(k):
d = s - i - j
if k > d >= 0:
ret += 1
print(ret)
| k, s = list(map(int, input().split()))
dp = [0] * (3 * k + 4)
dp[0] = 1
dp[k + 1] = -3
dp[2 * k + 2] = 3
dp[-1] = -1
from itertools import accumulate
dp = list(accumulate(list(accumulate(list(accumulate(dp))))))
print((dp[s]))
| false | 0 | [
"-ret = 0",
"-k += 1",
"-for i in range(k):",
"- for j in range(k):",
"- d = s - i - j",
"- if k > d >= 0:",
"- ret += 1",
"-print(ret)",
"+dp = [0] * (3 * k + 4)",
"+dp[0] = 1",
"+dp[k + 1] = -3",
"+dp[2 * k + 2] = 3",
"+dp[-1] = -1",
"+from itertools import ac... | false | 0.041975 | 0.037626 | 1.115593 | [
"s930996489",
"s473959962"
] |
u852690916 | p02603 | python | s853250516 | s243865490 | 70 | 62 | 61,868 | 64,028 | Accepted | Accepted | 11.43 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
m = ans = 1000
s = 0
for i in range(N - 1):
if A[i + 1] > A[i]:
s += m // A[i]
m %= A[i]
else:
m += s * A[i]
s = 0
ans = max(ans, m)
ans = max(an... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
dp = [0] * (N + 1)
dp[0] = 1000
for i in range(1, N + 1):
dp[i] = dp[i - 1]
for j in range(1, i):
dp[i] = max(dp[i], (dp[j] // A[j - 1]) * A[i - 1] + dp[j] % A[j - 1])
print((dp[N]))
if __na... | 21 | 16 | 491 | 445 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
m = ans = 1000
s = 0
for i in range(N - 1):
if A[i + 1] > A[i]:
s += m // A[i]
m %= A[i]
else:
m += s * A[i]
s = 0
ans = max(ans, m)
ans = max(ans, m + s * ... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
dp = [0] * (N + 1)
dp[0] = 1000
for i in range(1, N + 1):
dp[i] = dp[i - 1]
for j in range(1, i):
dp[i] = max(dp[i], (dp[j] // A[j - 1]) * A[i - 1] + dp[j] % A[j - 1])
print((dp[N]))
if __name__ == ... | false | 23.809524 | [
"- m = ans = 1000",
"- s = 0",
"- for i in range(N - 1):",
"- if A[i + 1] > A[i]:",
"- s += m // A[i]",
"- m %= A[i]",
"- else:",
"- m += s * A[i]",
"- s = 0",
"- ans = max(ans, m)",
"- ans = max(ans, m + s * A[-1])",
... | false | 0.076127 | 0.039318 | 1.936169 | [
"s853250516",
"s243865490"
] |
u334712262 | p03725 | python | s537923717 | s319998257 | 327 | 268 | 147,700 | 94,944 | Accepted | Accepted | 18.04 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | 95 | 93 | 1,922 | 1,855 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | false | 2.105263 | [
"- r = [s]",
"+ ans = INF",
"+ t = min(abs(x), abs(x - H + 1), abs(y), abs(y - W + 1))",
"+ ans = min(ans, t)",
"- r.append((vx, vy))",
"- ans = INF",
"- for x, y in r:",
"- t = min(abs(x), abs(x - H + 1), abs(y), abs(y - W + 1))",
"- ans = min(... | false | 0.040542 | 0.113384 | 0.357564 | [
"s537923717",
"s319998257"
] |
u725107050 | p02754 | python | s515422521 | s522828680 | 177 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.83 | N, A, B = list(map(int, input().split()))
res = 0
if N >= (A + B) * pow(10, 100):
print((A * pow(10, 100)))
else:
tmp1 = N // (A + B) * A
if N % (A + B) >= A:
tmp2 = A
else:
tmp2 = N % (A + B)
print((tmp1 + tmp2)) | N, A, B = list(map(int, input().split()))
res = 0
res += N // (A + B) * A
res += min(N % (A + B), A)
print(res) | 13 | 6 | 233 | 111 | N, A, B = list(map(int, input().split()))
res = 0
if N >= (A + B) * pow(10, 100):
print((A * pow(10, 100)))
else:
tmp1 = N // (A + B) * A
if N % (A + B) >= A:
tmp2 = A
else:
tmp2 = N % (A + B)
print((tmp1 + tmp2))
| N, A, B = list(map(int, input().split()))
res = 0
res += N // (A + B) * A
res += min(N % (A + B), A)
print(res)
| false | 53.846154 | [
"-if N >= (A + B) * pow(10, 100):",
"- print((A * pow(10, 100)))",
"-else:",
"- tmp1 = N // (A + B) * A",
"- if N % (A + B) >= A:",
"- tmp2 = A",
"- else:",
"- tmp2 = N % (A + B)",
"-print((tmp1 + tmp2))",
"+res += N // (A + B) * A",
"+res += min(N % (A + B), A)",
"+p... | false | 0.075089 | 0.037921 | 1.980147 | [
"s515422521",
"s522828680"
] |
u835482198 | p03781 | python | s429006545 | s477944331 | 27 | 17 | 2,940 | 2,940 | Accepted | Accepted | 37.04 | X = int(eval(input()))
for n in range(1000000):
# print((n * (n - 1) // 2))
if (n * (n - 1) // 2) >= X:
break
print((n - 1))
|
X = int(eval(input()))
# for n in range(1000000):
# # print((n * (n - 1) // 2))
# if (n * (n - 1) // 2) >= X:
# break
# n^2 - n - 2X <= 0
# n = (1 + sqrt(1 + 8X)) // 2
n = max(int((1 + (1 + 8 * X) ** 0.5) / 2) - 1, 0)
while True:
if (n * (n - 1) // 2) >= X:
break
n += ... | 7 | 17 | 140 | 330 | X = int(eval(input()))
for n in range(1000000):
# print((n * (n - 1) // 2))
if (n * (n - 1) // 2) >= X:
break
print((n - 1))
| X = int(eval(input()))
# for n in range(1000000):
# # print((n * (n - 1) // 2))
# if (n * (n - 1) // 2) >= X:
# break
# n^2 - n - 2X <= 0
# n = (1 + sqrt(1 + 8X)) // 2
n = max(int((1 + (1 + 8 * X) ** 0.5) / 2) - 1, 0)
while True:
if (n * (n - 1) // 2) >= X:
break
n += 1
print((n - 1))
| false | 58.823529 | [
"-for n in range(1000000):",
"- # print((n * (n - 1) // 2))",
"+# for n in range(1000000):",
"+# # print((n * (n - 1) // 2))",
"+# if (n * (n - 1) // 2) >= X:",
"+# break",
"+# n^2 - n - 2X <= 0",
"+# n = (1 + sqrt(1 + 8X)) // 2",
"+n = max(int((1 + (1 + 8 * X) ** 0.5) / 2) - 1, 0... | false | 0.064233 | 0.129723 | 0.495157 | [
"s429006545",
"s477944331"
] |
u493520238 | p03111 | python | s727739589 | s926394925 | 431 | 128 | 55,260 | 83,572 | Accepted | Accepted | 70.3 | from itertools import product
import bisect
N, A, B, C = list(map(int, input().split()))
tl = [C,B,A]
ll = []
for _ in range(N):
ll.append(int(eval(input())))
ans = 10**8
ite = product(list(range(4)),repeat=N)
for pattern in ite:
bag = [[],[],[]]
singles = []
mp = 0
for i, p ... |
from itertools import product
def main():
n,a,b,c = list(map(int, input().split()))
targetl = [a,b,c]
targetl.sort()
ll = []
for _ in range(n):
l = int(eval(input()))
ll.append(l)
ans = 10**9
ite = product(list(range(4)),repeat=n)
ite = list(ite)
for... | 51 | 44 | 1,069 | 972 | from itertools import product
import bisect
N, A, B, C = list(map(int, input().split()))
tl = [C, B, A]
ll = []
for _ in range(N):
ll.append(int(eval(input())))
ans = 10**8
ite = product(list(range(4)), repeat=N)
for pattern in ite:
bag = [[], [], []]
singles = []
mp = 0
for i, p in enumerate(patte... | from itertools import product
def main():
n, a, b, c = list(map(int, input().split()))
targetl = [a, b, c]
targetl.sort()
ll = []
for _ in range(n):
l = int(eval(input()))
ll.append(l)
ans = 10**9
ite = product(list(range(4)), repeat=n)
ite = list(ite)
for it in ite... | false | 13.72549 | [
"-import bisect",
"-N, A, B, C = list(map(int, input().split()))",
"-tl = [C, B, A]",
"-ll = []",
"-for _ in range(N):",
"- ll.append(int(eval(input())))",
"-ans = 10**8",
"-ite = product(list(range(4)), repeat=N)",
"-for pattern in ite:",
"- bag = [[], [], []]",
"- singles = []",
"- ... | false | 0.598841 | 0.190488 | 3.143718 | [
"s727739589",
"s926394925"
] |
u319725914 | p00221 | python | s917637569 | s303297138 | 3,490 | 360 | 5,648 | 7,444 | Accepted | Accepted | 89.68 | while(True):
m,n = list(map(int,input().split()))
if not m: break
a = [True]*m
j = -1
for i in range(1,n+1):
if sum(a) < 2: eval(input()); continue
j = (j+1+((a+a)[j+1:]).index(True))%m
s = eval(input())
if not i%15:
if s == "FizzBuzz": continue
... | while(True):
m,n = list(map(int,input().split()))
if not m: break
a = list(range(1,m+1))
b = [eval(input()) for _ in range(n)]
t = [str(i+1) for i in range(n)]
t[2::3] = ["Fizz"]*len(t[2::3])
t[4::5] = ["Buzz"]*len(t[4::5])
t[14::15] = ["FizzBuzz"]*len(t[14::15])
i=0
... | 20 | 16 | 650 | 495 | while True:
m, n = list(map(int, input().split()))
if not m:
break
a = [True] * m
j = -1
for i in range(1, n + 1):
if sum(a) < 2:
eval(input())
continue
j = (j + 1 + ((a + a)[j + 1 :]).index(True)) % m
s = eval(input())
if not i % 15:
... | while True:
m, n = list(map(int, input().split()))
if not m:
break
a = list(range(1, m + 1))
b = [eval(input()) for _ in range(n)]
t = [str(i + 1) for i in range(n)]
t[2::3] = ["Fizz"] * len(t[2::3])
t[4::5] = ["Buzz"] * len(t[4::5])
t[14::15] = ["FizzBuzz"] * len(t[14::15])
... | false | 20 | [
"- a = [True] * m",
"- j = -1",
"- for i in range(1, n + 1):",
"- if sum(a) < 2:",
"- eval(input())",
"+ a = list(range(1, m + 1))",
"+ b = [eval(input()) for _ in range(n)]",
"+ t = [str(i + 1) for i in range(n)]",
"+ t[2::3] = [\"Fizz\"] * len(t[2::3])",
"+... | false | 0.043742 | 0.043946 | 0.995359 | [
"s917637569",
"s303297138"
] |
u874644572 | p02793 | python | s175358457 | s622284314 | 1,512 | 1,265 | 6,112 | 6,368 | Accepted | Accepted | 16.34 | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 1000000007
lcm = 1
for a in A:
lcm = a // gcd(lcm, a) * lcm
ans = 0
for a in A:
ans += lcm // a
ans %= MOD
print(ans) | from fractions import gcd
n = int(eval(input()))
lcm = list(map(int, input().split()))
ans = [1] * n
while len(lcm) < (1 << 14):
lcm.append(1)
ans.append(0)
for i in range(13, -1, -1):
bit = 1 << i
for j in range(bit):
new = lcm[j] // gcd(lcm[j], lcm[j | bit]) * lcm[j | bit]
ans[j] = new // l... | 12 | 16 | 221 | 422 | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 1000000007
lcm = 1
for a in A:
lcm = a // gcd(lcm, a) * lcm
ans = 0
for a in A:
ans += lcm // a
ans %= MOD
print(ans)
| from fractions import gcd
n = int(eval(input()))
lcm = list(map(int, input().split()))
ans = [1] * n
while len(lcm) < (1 << 14):
lcm.append(1)
ans.append(0)
for i in range(13, -1, -1):
bit = 1 << i
for j in range(bit):
new = lcm[j] // gcd(lcm[j], lcm[j | bit]) * lcm[j | bit]
ans[j] = ne... | false | 25 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-MOD = 1000000007",
"-lcm = 1",
"-for a in A:",
"- lcm = a // gcd(lcm, a) * lcm",
"-ans = 0",
"-for a in A:",
"- ans += lcm // a",
"-ans %= MOD",
"-print(ans)",
"+n = int(eval(input()))",
"+lcm = list(map(int, input().... | false | 0.15006 | 0.153317 | 0.978759 | [
"s175358457",
"s622284314"
] |
u250583425 | p02972 | python | s732452160 | s950669772 | 231 | 204 | 13,108 | 14,768 | Accepted | Accepted | 11.69 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a = tuple(map(int, input().split()))
ls = [0] * n
for i in range(n-1, -1, -1):
if (sum(ls[i::i+1]) % 2) != a[i]:
ls[i] = 1
sum_ls = sum(ls)
print(sum_ls)
if sum_... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a = tuple(map(int, input().split()))
ls = [0] * n
ans = []
for i in range(n-1, -1, -1):
if (sum(ls[i::i+1]) % 2) != a[i]:
ls[i] = 1
ans.append(i+1)
print... | 18 | 20 | 419 | 408 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a = tuple(map(int, input().split()))
ls = [0] * n
for i in range(n - 1, -1, -1):
if (sum(ls[i :: i + 1]) % 2) != a[i]:
ls[i] = 1
sum_ls = sum(ls)
print(sum_ls)
if sum_l... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
a = tuple(map(int, input().split()))
ls = [0] * n
ans = []
for i in range(n - 1, -1, -1):
if (sum(ls[i :: i + 1]) % 2) != a[i]:
ls[i] = 1
ans.append(i + 1)
prin... | false | 10 | [
"+ ans = []",
"- sum_ls = sum(ls)",
"- print(sum_ls)",
"- if sum_ls:",
"- print((*[i + 1 for i, v in enumerate(ls) if v == 1]))",
"+ ans.append(i + 1)",
"+ print((sum(ls)))",
"+ if ans:",
"+ print((*ans[::-1]))"
] | false | 0.033578 | 0.036897 | 0.910036 | [
"s732452160",
"s950669772"
] |
u558242240 | p03287 | python | s906732914 | s449783526 | 301 | 239 | 62,576 | 62,576 | Accepted | Accepted | 20.6 | n, m = list(map(int, input().split()))
a = list(map(int , input().split()))
class Cumulative_Sum:
def __init__(self, a):
la = len(a)
self.s = [0] * (la + 1)
for i in range(la):
self.s[i+1] = self.s[i] + a[i]
# s[l]からs[r]までの和
def sum(self, l, r):
return... | n, m = list(map(int, input().split()))
a = list(map(int , input().split()))
class Cumulative_Sum:
def __init__(self, a):
la = len(a)
self.s = [0] * (la + 1)
for i in range(la):
self.s[i+1] = self.s[i] + a[i]
# s[l]からs[r]までの和
def sum(self, l, r):
return... | 55 | 34 | 1,179 | 709 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
class Cumulative_Sum:
def __init__(self, a):
la = len(a)
self.s = [0] * (la + 1)
for i in range(la):
self.s[i + 1] = self.s[i] + a[i]
# s[l]からs[r]までの和
def sum(self, l, r):
return self.s[... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
class Cumulative_Sum:
def __init__(self, a):
la = len(a)
self.s = [0] * (la + 1)
for i in range(la):
self.s[i + 1] = self.s[i] + a[i]
# s[l]からs[r]までの和
def sum(self, l, r):
return self.s[... | false | 38.181818 | [
"-def nCr(n, r, mod=67280421310721):",
"- r = min(r, n - r)",
"- numer = denom = 1",
"- for i in range(1, r + 1):",
"- numer = numer * (n + 1 - i) % mod",
"- denom = denom * i % mod",
"- return numer * pow(denom, mod - 2, mod) % mod",
"-",
"-",
"-# print(cs.s)",
"-# pri... | false | 0.034994 | 0.079909 | 0.437916 | [
"s906732914",
"s449783526"
] |
u790710233 | p02681 | python | s240343818 | s932828909 | 26 | 21 | 9,020 | 9,032 | Accepted | Accepted | 19.23 | s = eval(input())
t = eval(input())
print(('Yes' if s == t[:-1] else 'No'))
| s = eval(input())
t = input()[:-1]
print(('Yes' if s == t else 'No'))
| 3 | 3 | 64 | 64 | s = eval(input())
t = eval(input())
print(("Yes" if s == t[:-1] else "No"))
| s = eval(input())
t = input()[:-1]
print(("Yes" if s == t else "No"))
| false | 0 | [
"-t = eval(input())",
"-print((\"Yes\" if s == t[:-1] else \"No\"))",
"+t = input()[:-1]",
"+print((\"Yes\" if s == t else \"No\"))"
] | false | 0.038277 | 0.038524 | 0.993585 | [
"s240343818",
"s932828909"
] |
u946996108 | p02726 | python | s396960435 | s383182516 | 1,213 | 254 | 73,052 | 43,228 | Accepted | Accepted | 79.06 | mod = 10**9 + 7
def iip(listed = False):
ret = [int(i) for i in input().split()]
if len(ret) == 1 and not listed:
return ret[0]
return ret
def soinsuu_bunkai(n):
ret = []
for i in range(2, int(n**0.5)+1):
while n % i == 0:
n //= i
ret.append(i)
... | mod = 10**9 + 7
def iip(listed = False):
ret = [int(i) for i in input().split()]
if len(ret) == 1 and not listed:
return ret[0]
return ret
def soinsuu_bunkai(n):
ret = []
for i in range(2, int(n**0.5)+1):
while n % i == 0:
n //= i
ret.append(i)
... | 138 | 80 | 3,077 | 1,625 | mod = 10**9 + 7
def iip(listed=False):
ret = [int(i) for i in input().split()]
if len(ret) == 1 and not listed:
return ret[0]
return ret
def soinsuu_bunkai(n):
ret = []
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
n //= i
ret.append(i)
if ... | mod = 10**9 + 7
def iip(listed=False):
ret = [int(i) for i in input().split()]
if len(ret) == 1 and not listed:
return ret[0]
return ret
def soinsuu_bunkai(n):
ret = []
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
n //= i
ret.append(i)
if ... | false | 42.028986 | [
"- X -= 1",
"- Y -= 1",
"- ret = 0",
"- result = []",
"- for k in range(1, N):",
"- ret = 0",
"- for i in range(N):",
"- ret += search(i, k, N, X, Y)",
"- result.append(str(ret))",
"- print((\"\\n\".join(result)))",
"-",
"-",
"-def search(a, ... | false | 0.035338 | 0.053246 | 0.663683 | [
"s396960435",
"s383182516"
] |
u368780724 | p03291 | python | s724314083 | s714272929 | 360 | 219 | 27,612 | 43,628 | Accepted | Accepted | 39.17 | S = eval(input())
ZABC = [[0 for i in range(4)] for j in range(len(S))]
if S[0] == '?':
ZABC[0][0] = 3
else:
ZABC[0][0] = 1
if S[0] == '?' or S[0] == 'A':
ZABC[0][1] = 1
else:
ZABC[0][1] = 0
for i in range(2):
ZABC[0][i+2] = 0
for i in range(1,len(S)):
if S[i] == '?':
... | S = input().strip()
mod = 10**9+7
dp = [1] + [0]*3
for s in S:
dp1 = dp[:]
if s == 'A':
dp1[1] += dp[0]
elif s == 'B':
dp1[2] += dp[1]
elif s == 'C':
dp1[3] += dp[2]
else:
dp1[1] += dp[0]
dp1[2] += dp[1]
dp1[3] += dp[2]
dp1[0] +=... | 51 | 21 | 1,101 | 457 | S = eval(input())
ZABC = [[0 for i in range(4)] for j in range(len(S))]
if S[0] == "?":
ZABC[0][0] = 3
else:
ZABC[0][0] = 1
if S[0] == "?" or S[0] == "A":
ZABC[0][1] = 1
else:
ZABC[0][1] = 0
for i in range(2):
ZABC[0][i + 2] = 0
for i in range(1, len(S)):
if S[i] == "?":
q = 3
else:
... | S = input().strip()
mod = 10**9 + 7
dp = [1] + [0] * 3
for s in S:
dp1 = dp[:]
if s == "A":
dp1[1] += dp[0]
elif s == "B":
dp1[2] += dp[1]
elif s == "C":
dp1[3] += dp[2]
else:
dp1[1] += dp[0]
dp1[2] += dp[1]
dp1[3] += dp[2]
dp1[0] += 2 * dp[0]
... | false | 58.823529 | [
"-S = eval(input())",
"-ZABC = [[0 for i in range(4)] for j in range(len(S))]",
"-if S[0] == \"?\":",
"- ZABC[0][0] = 3",
"-else:",
"- ZABC[0][0] = 1",
"-if S[0] == \"?\" or S[0] == \"A\":",
"- ZABC[0][1] = 1",
"-else:",
"- ZABC[0][1] = 0",
"-for i in range(2):",
"- ZABC[0][i + ... | false | 0.048617 | 0.04048 | 1.201019 | [
"s724314083",
"s714272929"
] |
u922449550 | p02698 | python | s378010009 | s758863646 | 1,495 | 1,221 | 241,016 | 248,760 | Accepted | Accepted | 18.33 | import bisect
import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
tree = [[] for i in range(N)]
for i in range(N-1):
u, v = map(int, input().split())
tree[u-1].append(v-1); tree[v-1].append(u-1)
ans = [0] * N
ans[0] = 1
INF = 10**10
dp = [INF] * N
dp[0] ... | import bisect
import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
tree = [[] for i in range(N)]
for i in range(N-1):
u, v = map(int, input().split())
tree[u-1].append(v-1); tree[v-1].append(u-1)
ans = [0] * N
ans[0] = 1
INF = 10**10
dp = [INF] * N
dp[0] ... | 39 | 40 | 767 | 822 | import bisect
import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
tree = [[] for i in range(N)]
for i in range(N - 1):
u, v = map(int, input().split())
tree[u - 1].append(v - 1)
tree[v - 1].append(u - 1)
ans = [0] * N
ans[0] = 1
INF = 10**10
dp = [INF] * N
dp[0] = A... | import bisect
import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
tree = [[] for i in range(N)]
for i in range(N - 1):
u, v = map(int, input().split())
tree[u - 1].append(v - 1)
tree[v - 1].append(u - 1)
ans = [0] * N
ans[0] = 1
INF = 10**10
dp = [INF] * N
dp[0] = A... | false | 2.5 | [
"-def dfs(node, par):",
"+def dfs(node, par, n):",
"- ans[child] = bisect.bisect_left(dp, INF)",
"- dfs(child, node)",
"+ ans[child] = max(n, idx + 1)",
"+ # ans[child] = bisect.bisect_left(dp, INF)",
"+ dfs(child, node, max(n, idx + 1))",
"-dfs(0, -1)",
"+dfs(0, -... | false | 0.046833 | 0.047728 | 0.981257 | [
"s378010009",
"s758863646"
] |
u298297089 | p03624 | python | s788432737 | s577451389 | 19 | 17 | 3,188 | 3,188 | Accepted | Accepted | 10.53 | S = eval(input())
for c in 'abcdefghijklmnopqrstuvwxyz':
if S.count(c) == 0:
print(c)
break
else:
print('None') | s = eval(input())
alf = 'abcdefghijklmnopqrstuvwxyz'
for c in alf:
if c not in s:
print(c)
break
else:
print('None') | 7 | 8 | 125 | 129 | S = eval(input())
for c in "abcdefghijklmnopqrstuvwxyz":
if S.count(c) == 0:
print(c)
break
else:
print("None")
| s = eval(input())
alf = "abcdefghijklmnopqrstuvwxyz"
for c in alf:
if c not in s:
print(c)
break
else:
print("None")
| false | 12.5 | [
"-S = eval(input())",
"-for c in \"abcdefghijklmnopqrstuvwxyz\":",
"- if S.count(c) == 0:",
"+s = eval(input())",
"+alf = \"abcdefghijklmnopqrstuvwxyz\"",
"+for c in alf:",
"+ if c not in s:"
] | false | 0.008308 | 0.07105 | 0.116937 | [
"s788432737",
"s577451389"
] |
u887080361 | p02640 | python | s354995919 | s771469767 | 29 | 24 | 9,128 | 8,992 | Accepted | Accepted | 17.24 | data=input().split()
x=int(data[0])
y=int(data[1])
if y%2 != 0:
print('No')
else:
if y-2*x >= 0 and (y-2*x)/2 <=x:
print('Yes')
else:
print('No') | data=input().split()
x=int(data[0])
y=int(data[1])
if (y%2 == 0) and (y-2*x >= 0) and ((y-2*x)/2 <=x):
print('Yes')
else:
print('No') | 10 | 8 | 182 | 153 | data = input().split()
x = int(data[0])
y = int(data[1])
if y % 2 != 0:
print("No")
else:
if y - 2 * x >= 0 and (y - 2 * x) / 2 <= x:
print("Yes")
else:
print("No")
| data = input().split()
x = int(data[0])
y = int(data[1])
if (y % 2 == 0) and (y - 2 * x >= 0) and ((y - 2 * x) / 2 <= x):
print("Yes")
else:
print("No")
| false | 20 | [
"-if y % 2 != 0:",
"+if (y % 2 == 0) and (y - 2 * x >= 0) and ((y - 2 * x) / 2 <= x):",
"+ print(\"Yes\")",
"+else:",
"-else:",
"- if y - 2 * x >= 0 and (y - 2 * x) / 2 <= x:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")"
] | false | 0.150196 | 0.0076 | 19.763738 | [
"s354995919",
"s771469767"
] |
u711539583 | p02697 | python | s398683555 | s676569776 | 112 | 101 | 17,360 | 17,380 | Accepted | Accepted | 9.82 | n, m = list(map(int, input().split()))
a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):
if (n - d in memo) or (2*d == n):
cnt += 1
d += 1
memo.add(d)
if cnt > 1 or a < 1 or a+d > n:
print((1/0))
print((a, a+d))
a -= 1
d += 2
| n,m = list(map(int, input().split()))
a = (n-1) // 2
d = 1
memo = set([])
for i in range(m):
if n-d in memo or 2*d == n:
d += 1
memo.add(d)
print((a, a+d))
a -= 1
d += 2
| 17 | 11 | 297 | 200 | n, m = list(map(int, input().split()))
a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):
if (n - d in memo) or (2 * d == n):
cnt += 1
d += 1
memo.add(d)
if cnt > 1 or a < 1 or a + d > n:
print((1 / 0))
print((a, a + d))
a -= 1
d += 2
| n, m = list(map(int, input().split()))
a = (n - 1) // 2
d = 1
memo = set([])
for i in range(m):
if n - d in memo or 2 * d == n:
d += 1
memo.add(d)
print((a, a + d))
a -= 1
d += 2
| false | 35.294118 | [
"-cnt = 0",
"- if (n - d in memo) or (2 * d == n):",
"- cnt += 1",
"+ if n - d in memo or 2 * d == n:",
"- if cnt > 1 or a < 1 or a + d > n:",
"- print((1 / 0))"
] | false | 0.043895 | 0.038706 | 1.134045 | [
"s398683555",
"s676569776"
] |
u548252256 | p02265 | python | s033407891 | s547817894 | 3,930 | 1,890 | 69,732 | 69,736 | Accepted | Accepted | 51.91 | from collections import deque
n = int(eval(input()))
q = deque()
for _ in range(n):
com = eval(input())
if com[0] == "i":
q.appendleft(com[7:])
elif len(com) == 11:
q.popleft()
elif len(com) == 10:
q.pop()
else:
try:
q.remove(com[7:])
except:
pass
print((*q))
| from collections import deque
from sys import stdin
n = int(eval(input()))
q = deque()
for _ in range(n):
cmd = stdin.readline().strip().split()
if cmd[0] == "insert":
q.appendleft(cmd[1])
elif cmd[0] == "deleteFirst":
q.popleft()
elif cmd[0] == "deleteLast":
q.pop()
elif cmd[0] == "delete"... | 23 | 23 | 295 | 380 | from collections import deque
n = int(eval(input()))
q = deque()
for _ in range(n):
com = eval(input())
if com[0] == "i":
q.appendleft(com[7:])
elif len(com) == 11:
q.popleft()
elif len(com) == 10:
q.pop()
else:
try:
q.remove(com[7:])
except:
... | from collections import deque
from sys import stdin
n = int(eval(input()))
q = deque()
for _ in range(n):
cmd = stdin.readline().strip().split()
if cmd[0] == "insert":
q.appendleft(cmd[1])
elif cmd[0] == "deleteFirst":
q.popleft()
elif cmd[0] == "deleteLast":
q.pop()
elif cm... | false | 0 | [
"+from sys import stdin",
"- com = eval(input())",
"- if com[0] == \"i\":",
"- q.appendleft(com[7:])",
"- elif len(com) == 11:",
"+ cmd = stdin.readline().strip().split()",
"+ if cmd[0] == \"insert\":",
"+ q.appendleft(cmd[1])",
"+ elif cmd[0] == \"deleteFirst\":",
... | false | 0.03662 | 0.045706 | 0.801215 | [
"s033407891",
"s547817894"
] |
u691018832 | p02912 | python | s760396926 | s388433146 | 219 | 157 | 14,380 | 12,600 | Accepted | Accepted | 28.31 | import sys
import heapq
import math
input = sys.stdin.readline
n, m = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
max_a = heapq.heappop(a)
max_a /= 2
heapq.heappush(a, max_a)
for i in range(n):
a[i] = math.floor(-a[... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
import heapq
n, m = list(map(int, readline().split()))
a = list([int(x)*(-1) for x in readline().split()])
heapq.heapify(a)
for i in range(m):
memo = heapq... | 15 | 15 | 338 | 391 | import sys
import heapq
import math
input = sys.stdin.readline
n, m = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
max_a = heapq.heappop(a)
max_a /= 2
heapq.heappush(a, max_a)
for i in range(n):
a[i] = math.floor(-a[i])
print((su... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
import heapq
n, m = list(map(int, readline().split()))
a = list([int(x) * (-1) for x in readline().split()])
heapq.heapify(a)
for i in range(m):
memo = heapq.heappop(a)
... | false | 0 | [
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7)",
"-import math",
"-input = sys.stdin.readline",
"-n, m = list(map(int, input().split()))",
"-a = list([int(x) * (-1) for x in input().split()])",
... | false | 0.038663 | 0.048936 | 0.790075 | [
"s760396926",
"s388433146"
] |
u077291787 | p02913 | python | s120094442 | s154614809 | 354 | 83 | 27,540 | 11,368 | Accepted | Accepted | 76.55 | from typing import List
class RollingHash:
__slots__ = ["_source", "_length", "_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
self._source = source
self._length = len(source)
self._base = base
self._mod =... | from typing import List
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_source", "_length", "_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
self._source = source
self._length = len(source)
self._base =... | 64 | 61 | 2,019 | 1,934 | from typing import List
class RollingHash:
__slots__ = ["_source", "_length", "_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7):
self._source = source
self._length = len(source)
self._base = base
self._mod = mod
... | from typing import List
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_source", "_length", "_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7):
self._source = source
self._length = len(source)
self._base = base
... | false | 4.6875 | [
"+ \"\"\"Rolling Hash\"\"\"",
"+",
"- self._hash = self._get_hash_from_zero()",
"- self._power = self._get_base_pow()",
"+ self._hash = self._build_hash_from_zero()",
"+ self._power = self._build_base_power()",
"- def _get_hash_from_zero(self) -> List[int]:",
"+ de... | false | 0.142686 | 0.041205 | 3.462841 | [
"s120094442",
"s154614809"
] |
u652057333 | p02726 | python | s632117552 | s054844270 | 569 | 501 | 51,804 | 49,500 | Accepted | Accepted | 11.95 | from collections import deque, defaultdict
n, x, y = list(map(int, input().split()))
edges = defaultdict(lambda: [])
for i in range(1, n):
edges[i].append(i+1)
edges[i+1].append(i)
edges[x].append(y)
edges[y].append(x)
# 幅優先
counter = [0 for i in range(n)]
for i in range(1, n+1):
d = deque()
... | from collections import deque, defaultdict
n, x, y = list(map(int, input().split()))
edges = defaultdict(lambda: [])
for i in range(1, n):
edges[i].append(i+1)
edges[i+1].append(i)
edges[x].append(y)
edges[y].append(x)
# 幅優先
counter = [0 for i in range(n)]
for i in range(1, n+1):
d = deque(... | 31 | 28 | 872 | 770 | from collections import deque, defaultdict
n, x, y = list(map(int, input().split()))
edges = defaultdict(lambda: [])
for i in range(1, n):
edges[i].append(i + 1)
edges[i + 1].append(i)
edges[x].append(y)
edges[y].append(x)
# 幅優先
counter = [0 for i in range(n)]
for i in range(1, n + 1):
d = deque()
is_c... | from collections import deque, defaultdict
n, x, y = list(map(int, input().split()))
edges = defaultdict(lambda: [])
for i in range(1, n):
edges[i].append(i + 1)
edges[i + 1].append(i)
edges[x].append(y)
edges[y].append(x)
# 幅優先
counter = [0 for i in range(n)]
for i in range(1, n + 1):
d = deque()
dist... | false | 9.677419 | [
"- is_checked = [False for _ in range(n + 1)]",
"- dist[i] = 0",
"- d.append((i, 0))",
"+ d.append((i, -1))",
"- if is_checked[e]:",
"+ if dist[e] > -1:",
"- is_checked[e] = True",
"- if not is_checked[next_e]:",
"+ if dist[next_e] =... | false | 0.039022 | 0.040561 | 0.962078 | [
"s632117552",
"s054844270"
] |
u072717685 | p02756 | python | s005093770 | s791173952 | 1,346 | 339 | 4,372 | 30,016 | Accepted | Accepted | 74.81 | def main():
s = eval(input())
q = int(eval(input()))
jun = True
mae = ""
ushiro = ""
for _ in range(q):
qu = eval(input())
if qu == '1':
jun = not jun
else:
if qu[2] == '1':
if jun:
mae = qu[4] + mae... | from collections import deque
def main():
s = deque(eval(input()))
q = int(eval(input()))
qs = [tuple(input().split()) for _ in range(q)]
flag = 1
for qse in qs:
if qse[0] == '1':
flag ^= 1
else:
f = int(qse[1]) - 1
f ^= flag
... | 26 | 24 | 607 | 556 | def main():
s = eval(input())
q = int(eval(input()))
jun = True
mae = ""
ushiro = ""
for _ in range(q):
qu = eval(input())
if qu == "1":
jun = not jun
else:
if qu[2] == "1":
if jun:
mae = qu[4] + mae
... | from collections import deque
def main():
s = deque(eval(input()))
q = int(eval(input()))
qs = [tuple(input().split()) for _ in range(q)]
flag = 1
for qse in qs:
if qse[0] == "1":
flag ^= 1
else:
f = int(qse[1]) - 1
f ^= flag
if f:
... | false | 7.692308 | [
"-def main():",
"- s = eval(input())",
"- q = int(eval(input()))",
"- jun = True",
"- mae = \"\"",
"- ushiro = \"\"",
"- for _ in range(q):",
"- qu = eval(input())",
"- if qu == \"1\":",
"- jun = not jun",
"- else:",
"- if qu[2] == \... | false | 0.036124 | 0.039547 | 0.91345 | [
"s005093770",
"s791173952"
] |
u539367121 | p02924 | python | s096376118 | s922695261 | 30 | 27 | 9,168 | 9,044 | Accepted | Accepted | 10 | n=int(eval(input()))
if n==1: print((0)); exit();
if n==2: print((1)); exit();
if n%2==1:
print((((n-1)+1)*((n-1)//2)))
else:
print((((n-1)+1)*((n-1)//2)+n//2)) | n=int(eval(input()))
if n==1: print((0)); exit();
if n==2: print((1)); exit();
print((n*(n-1)//2)) | 9 | 4 | 160 | 89 | n = int(eval(input()))
if n == 1:
print((0))
exit()
if n == 2:
print((1))
exit()
if n % 2 == 1:
print((((n - 1) + 1) * ((n - 1) // 2)))
else:
print((((n - 1) + 1) * ((n - 1) // 2) + n // 2))
| n = int(eval(input()))
if n == 1:
print((0))
exit()
if n == 2:
print((1))
exit()
print((n * (n - 1) // 2))
| false | 55.555556 | [
"-if n % 2 == 1:",
"- print((((n - 1) + 1) * ((n - 1) // 2)))",
"-else:",
"- print((((n - 1) + 1) * ((n - 1) // 2) + n // 2))",
"+print((n * (n - 1) // 2))"
] | false | 0.03841 | 0.038678 | 0.993066 | [
"s096376118",
"s922695261"
] |
u861141787 | p04001 | python | s708258817 | s910957257 | 27 | 19 | 2,940 | 3,060 | Accepted | Accepted | 29.63 | # bit全探索の解法
s = eval(input())
# "+"は数字の間にしか入らないので、n-1で調べる
n = len(s) -1
ans = 0
for bit in range(1<<(n)):
f = s[0]
for i in range(n):
if (bit >> i) & 1 :
f += "+"
f += s[i + 1]
#print(f)
ans += eval(f)
print(ans)
| def dfs(i, f):
if i == n-1:
return sum(list(map(int, f.split("+"))))
return dfs(i+1, f + s[i+1]) + dfs(i+1, f + "+" + s[i+1])
s = eval(input())
n = len(s)
print((dfs(0, s[0]))) | 16 | 8 | 268 | 192 | # bit全探索の解法
s = eval(input())
# "+"は数字の間にしか入らないので、n-1で調べる
n = len(s) - 1
ans = 0
for bit in range(1 << (n)):
f = s[0]
for i in range(n):
if (bit >> i) & 1:
f += "+"
f += s[i + 1]
# print(f)
ans += eval(f)
print(ans)
| def dfs(i, f):
if i == n - 1:
return sum(list(map(int, f.split("+"))))
return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])
s = eval(input())
n = len(s)
print((dfs(0, s[0])))
| false | 50 | [
"-# bit全探索の解法",
"+def dfs(i, f):",
"+ if i == n - 1:",
"+ return sum(list(map(int, f.split(\"+\"))))",
"+ return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + \"+\" + s[i + 1])",
"+",
"+",
"-# \"+\"は数字の間にしか入らないので、n-1で調べる",
"-n = len(s) - 1",
"-ans = 0",
"-for bit in range(1 << (n)):",
... | false | 0.041352 | 0.075434 | 0.548185 | [
"s708258817",
"s910957257"
] |
u346851130 | p02665 | python | s320519782 | s803548194 | 157 | 79 | 83,384 | 85,468 | Accepted | Accepted | 49.68 | def main():
eval(input())
A = list(map(int, input().split()))
cusum = [0] * len(A)
cusum[-1] = A[-1]
if A[0] > 1:
print((-1))
return
for i in range(len(A)-2, -1, -1):
cusum[i] = cusum[i+1] + A[i]
pre_node = 1
ans = 1
for i in range(1, len(A)):
node = (pre_node - A[i-... | def main():
eval(input())
in_a = list(map(int, input().split()))
leaves = [0] * len(in_a)
leaves[-1] = in_a[-1]
if in_a[0] > 1:
print((-1))
return
for i in range(len(in_a)-2, -1, -1):
leaves[i] = leaves[i+1] + in_a[i]
node = 1
total = 1
for i in range(1, len(in_a)):
... | 30 | 31 | 499 | 516 | def main():
eval(input())
A = list(map(int, input().split()))
cusum = [0] * len(A)
cusum[-1] = A[-1]
if A[0] > 1:
print((-1))
return
for i in range(len(A) - 2, -1, -1):
cusum[i] = cusum[i + 1] + A[i]
pre_node = 1
ans = 1
for i in range(1, len(A)):
node... | def main():
eval(input())
in_a = list(map(int, input().split()))
leaves = [0] * len(in_a)
leaves[-1] = in_a[-1]
if in_a[0] > 1:
print((-1))
return
for i in range(len(in_a) - 2, -1, -1):
leaves[i] = leaves[i + 1] + in_a[i]
node = 1
total = 1
for i in range(1, l... | false | 3.225806 | [
"- A = list(map(int, input().split()))",
"- cusum = [0] * len(A)",
"- cusum[-1] = A[-1]",
"- if A[0] > 1:",
"+ in_a = list(map(int, input().split()))",
"+ leaves = [0] * len(in_a)",
"+ leaves[-1] = in_a[-1]",
"+ if in_a[0] > 1:",
"- for i in range(len(A) - 2, -1, -1):",
... | false | 0.039837 | 0.040797 | 0.97648 | [
"s320519782",
"s803548194"
] |
u077291787 | p03569 | python | s780019184 | s849843604 | 84 | 49 | 4,916 | 3,316 | Accepted | Accepted | 41.67 | # code-festival-2017-qualcC - Inserting 'x'
from collections import deque
def main():
S = deque(list(input().rstrip()))
ans = 0
while len(S) >= 2:
l, r = S[0], S[-1]
if l == r:
S.popleft(), S.pop()
else:
ans += 1
if l == "x":
... | # code-festival-2017-qualcC - Inserting 'x'
def main():
S = input().rstrip()
ans, l, r = 0, 0, len(S) - 1
while l < r:
if S[l] == S[r]:
l += 1
r -= 1
else:
ans += 1
if S[l] == "x":
l += 1
elif S[r] == "x"... | 25 | 22 | 536 | 475 | # code-festival-2017-qualcC - Inserting 'x'
from collections import deque
def main():
S = deque(list(input().rstrip()))
ans = 0
while len(S) >= 2:
l, r = S[0], S[-1]
if l == r:
S.popleft(), S.pop()
else:
ans += 1
if l == "x":
S.ap... | # code-festival-2017-qualcC - Inserting 'x'
def main():
S = input().rstrip()
ans, l, r = 0, 0, len(S) - 1
while l < r:
if S[l] == S[r]:
l += 1
r -= 1
else:
ans += 1
if S[l] == "x":
l += 1
elif S[r] == "x":
... | false | 12 | [
"-from collections import deque",
"-",
"-",
"- S = deque(list(input().rstrip()))",
"- ans = 0",
"- while len(S) >= 2:",
"- l, r = S[0], S[-1]",
"- if l == r:",
"- S.popleft(), S.pop()",
"+ S = input().rstrip()",
"+ ans, l, r = 0, 0, len(S) - 1",
"+ wh... | false | 0.065621 | 0.04556 | 1.440325 | [
"s780019184",
"s849843604"
] |
u186838327 | p03044 | python | s769509873 | s720581267 | 782 | 526 | 81,824 | 67,888 | Accepted | Accepted | 32.74 | from collections import deque
n = int(input())
g = [[] for i in range(n)]
for i in range(n-1):
u, v, w = map(int, input().split())
u, v = u-1, v-1
g[u].append([v, w])
g[v].append([u, w])
c = [-1]*n
c[0] = 0
queue = deque([0])
while queue:
x = queue.popleft()
for x_, w_ in g[x]:
... | import sys
#sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n-1):
u, v, w = list(map(int, input().split()))
u, v = u-1, v-1
g[u].append((v, w))
g[v].append((u, w))
from collections import deque
s = deque()
s.append(... | 31 | 28 | 496 | 607 | from collections import deque
n = int(input())
g = [[] for i in range(n)]
for i in range(n - 1):
u, v, w = map(int, input().split())
u, v = u - 1, v - 1
g[u].append([v, w])
g[v].append([u, w])
c = [-1] * n
c[0] = 0
queue = deque([0])
while queue:
x = queue.popleft()
for x_, w_ in g[x]:
... | import sys
# sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u, v = u - 1, v - 1
g[u].append((v, w))
g[v].append((u, w))
from collections import deque
s = deque()
s.append(0)
visi... | false | 9.677419 | [
"+import sys",
"+",
"+# sys.setrecursionlimit(10**6)",
"+input = sys.stdin.readline",
"+n = int(eval(input()))",
"+g = [[] for _ in range(n)]",
"+for i in range(n - 1):",
"+ u, v, w = list(map(int, input().split()))",
"+ u, v = u - 1, v - 1",
"+ g[u].append((v, w))",
"+ g[v].append((... | false | 0.037379 | 0.041088 | 0.909725 | [
"s769509873",
"s720581267"
] |
u156815136 | p04045 | python | s167636672 | s634706502 | 111 | 49 | 3,064 | 10,312 | Accepted | Accepted | 55.86 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Co... | 77 | 57 | 1,313 | 1,260 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
# import math
# mod = 10**9+7
# import itertools
# import fractions
# import numpy as np
# mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict... | false | 25.974026 | [
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+from math import gcd",
"+from itertools import combinations, permutations, accumulate, product # (string,3) 3回",
"+",
"+# from collections import deque"... | false | 0.046681 | 0.252412 | 0.184939 | [
"s167636672",
"s634706502"
] |
u047393579 | p02837 | python | s060181742 | s504038627 | 588 | 292 | 44,252 | 43,628 | Accepted | Accepted | 50.34 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
claim = []
for _ in range(N):
memo = []
A = int(eval(input()))
for _ in range(A):
x, y = input().split()
memo.append((x,y))
claim.append(memo)
maximam = 0
for i in range(2**N):
flag = True
bin_i ... | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
claim = []
for _ in range(N):
memo = []
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
memo.append((x,y))
claim.append(memo)
maximam = 0
for bit in range(2**N):
flag ... | 32 | 28 | 703 | 618 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
claim = []
for _ in range(N):
memo = []
A = int(eval(input()))
for _ in range(A):
x, y = input().split()
memo.append((x, y))
claim.append(memo)
maximam = 0
for i in range(2**N):
flag = True
bin_i = (N - len(str(bin(i... | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
claim = []
for _ in range(N):
memo = []
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
memo.append((x, y))
claim.append(memo)
maximam = 0
for bit in range(2**N):
flag = True
count = ... | false | 12.5 | [
"- x, y = input().split()",
"+ x, y = list(map(int, input().split()))",
"-for i in range(2**N):",
"+for bit in range(2**N):",
"- bin_i = (N - len(str(bin(i))[2:])) * [\"0\"] + list(bin(i))[2:]",
"- for j, man in enumerate(bin_i):",
"- if man == \"0\":",
"- continu... | false | 0.035586 | 0.036741 | 0.968586 | [
"s060181742",
"s504038627"
] |
u839509562 | p03425 | python | s044074551 | s804698655 | 52 | 47 | 10,824 | 10,140 | Accepted | Accepted | 9.62 | import sys
from itertools import combinations
from collections import Counter
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
s = [input()[0] for _ in range(n)]
s = [v for v in s if v in 'MARCH']
c = Counter(s)
ans... | import sys
from itertools import combinations
from collections import Counter
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
s = [input()[0] for _ in range(n)]
c = Counter(s)
ans = 0
for x, y, z in combinations('M... | 23 | 22 | 460 | 426 | import sys
from itertools import combinations
from collections import Counter
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
s = [input()[0] for _ in range(n)]
s = [v for v in s if v in "MARCH"]
c = Counter(s)
ans = 0
for x... | import sys
from itertools import combinations
from collections import Counter
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
s = [input()[0] for _ in range(n)]
c = Counter(s)
ans = 0
for x, y, z in combinations("MARCH", 3):
... | false | 4.347826 | [
"- s = [v for v in s if v in \"MARCH\"]",
"- for x, y, z in combinations(c, 3):",
"+ for x, y, z in combinations(\"MARCH\", 3):"
] | false | 0.043802 | 0.043834 | 0.999261 | [
"s044074551",
"s804698655"
] |
u995004106 | p02690 | python | s076118436 | s647866712 | 310 | 108 | 73,104 | 73,152 | Accepted | Accepted | 65.16 | from math import floor,ceil,sqrt
import fractions
import collections
import itertools
from collections import deque
X=int(eval(input()))
"""
l=[]
for i in range(1,ceil(sqrt(X))+1):
if X%i==0:
l.append(i)
l.append(X//i)
l=list(set(l))
l2=l
for i in range(len(l)):
l2.append(-l[i])
... | from math import floor,ceil,sqrt
import fractions
import collections
import itertools
from collections import deque
X=int(eval(input()))
"""
l=[]
for i in range(1,ceil(sqrt(X))+1):
if X%i==0:
l.append(i)
l.append(X//i)
l=list(set(l))
l2=l
for i in range(len(l)):
l2.append(-l[i])
... | 79 | 100 | 2,305 | 2,894 | from math import floor, ceil, sqrt
import fractions
import collections
import itertools
from collections import deque
X = int(eval(input()))
"""
l=[]
for i in range(1,ceil(sqrt(X))+1):
if X%i==0:
l.append(i)
l.append(X//i)
l=list(set(l))
l2=l
for i in range(len(l)):
l2.append(-l[i])
#print(l2)
... | from math import floor, ceil, sqrt
import fractions
import collections
import itertools
from collections import deque
X = int(eval(input()))
"""
l=[]
for i in range(1,ceil(sqrt(X))+1):
if X%i==0:
l.append(i)
l.append(X//i)
l=list(set(l))
l2=l
for i in range(len(l)):
l2.append(-l[i])
#print(l2)
... | false | 21 | [
"-for i in range(-1000, 1000):",
"- for j in range(-1000, 1000):",
"+# A>0にて",
"+# A=iの時A^5-B^5の最小は",
"+# i^5-(i-1)^5",
"+# i^5-(i-1)^5が10^9を超えていれば、その範囲の中で全探査すれば、必ず入力の解を持つものに出会えるはず(このiをmaxとする)",
"+# A<=0にて",
"+# A=iの時、A^5ーB^5の最小は",
"+# i^5-(i+1)^5",
"+# i^5-(i+1)^5が10^9を超えていれば、その範囲の中で全探査すれば、必ず入... | false | 1.806195 | 0.095085 | 18.995488 | [
"s076118436",
"s647866712"
] |
u631277801 | p03785 | python | s323786539 | s316341549 | 394 | 125 | 19,384 | 7,512 | Accepted | Accepted | 68.27 | from collections import deque
n,c,k = list(map(int, input().split()))
t = [int(eval(input())) for _ in range(n)]
tk = [(ti, ti+k) for ti in t]
tk.sort(key=lambda x:x[1])
tk = deque(tk)
#print(tk)
ans = 0
# tkが尽きるまで
while tk:
_, bus = tk[0]
# バスの時刻より早く来ている客をカウント
cnt = 0
while (... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 32 | 39 | 560 | 853 | from collections import deque
n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for _ in range(n)]
tk = [(ti, ti + k) for ti in t]
tk.sort(key=lambda x: x[1])
tk = deque(tk)
# print(tk)
ans = 0
# tkが尽きるまで
while tk:
_, bus = tk[0]
# バスの時刻より早く来ている客をカウント
cnt = 0
while (tk[cnt][0] <= bus) a... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 17.948718 | [
"-from collections import deque",
"+import sys",
"-n, c, k = list(map(int, input().split()))",
"-t = [int(eval(input())) for _ in range(n)]",
"-tk = [(ti, ti + k) for ti in t]",
"-tk.sort(key=lambda x: x[1])",
"-tk = deque(tk)",
"-# print(tk)",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**5)"... | false | 0.086454 | 0.062633 | 1.380326 | [
"s323786539",
"s316341549"
] |
u319589470 | p03162 | python | s882620146 | s311913968 | 506 | 270 | 22,772 | 105,296 | Accepted | Accepted | 46.64 | n = int(eval(input()))
dp =[[0]*3 for _ in range(n)]
dp[0] = list(map(int,input().split()))
for i in range(1,n):
a,b,c=list(map(int,input().split()))
dp[i][0] = a + max(dp[i-1][1],dp[i-1][2])
dp[i][1] = b + max(dp[i-1][0],dp[i-1][2])
dp[i][2] = c + max(dp[i-1][0],dp[i-1][1])
print((max(dp[n-1]))) | def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
def MI(): return list(map(int,input().split()))
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]
n = I()
act = [[0,0,0]] + LLI(n)
dp = [[-10**10,-10**10,-10**10] for _ in range(n+1)]
#dp[i][0]はi日目でA選ぶときの幸福度の最... | 9 | 17 | 299 | 670 | n = int(eval(input()))
dp = [[0] * 3 for _ in range(n)]
dp[0] = list(map(int, input().split()))
for i in range(1, n):
a, b, c = list(map(int, input().split()))
dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2])
dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2])
dp[i][2] = c + max(dp[i - 1][0], dp[i - 1][1])
pri... | def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
def MI():
return list(map(int, input().split()))
def LLI(n):
return [list(map(int, input().split())) for _ in range(n)]
n = I()
act = [[0, 0, 0]] + LLI(n)
dp = [[-(10**10), -(10**10), -(10**10)] for _ in range(n ... | false | 47.058824 | [
"-n = int(eval(input()))",
"-dp = [[0] * 3 for _ in range(n)]",
"-dp[0] = list(map(int, input().split()))",
"-for i in range(1, n):",
"- a, b, c = list(map(int, input().split()))",
"- dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2])",
"- dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2])",
"- dp... | false | 0.03748 | 0.037937 | 0.987966 | [
"s882620146",
"s311913968"
] |
u699089116 | p03338 | python | s689368169 | s721945869 | 197 | 179 | 38,768 | 38,896 | Accepted | Accepted | 9.14 | n = int(eval(input()))
s = eval(input())
count = 0
for i in range(1, n):
temp = set()
for j in range(i):
if s[j] in s[i:]:
temp.add(s[j])
count = max(len(temp), count)
print(count) | n = int(eval(input()))
s = eval(input())
count = 0
for i in range(1, n):
temp = set()
for j in range(i):
if s[j] in set(s[i:]):
temp.add(s[j])
count = max(len(temp), count)
print(count) | 12 | 12 | 213 | 218 | n = int(eval(input()))
s = eval(input())
count = 0
for i in range(1, n):
temp = set()
for j in range(i):
if s[j] in s[i:]:
temp.add(s[j])
count = max(len(temp), count)
print(count)
| n = int(eval(input()))
s = eval(input())
count = 0
for i in range(1, n):
temp = set()
for j in range(i):
if s[j] in set(s[i:]):
temp.add(s[j])
count = max(len(temp), count)
print(count)
| false | 0 | [
"- if s[j] in s[i:]:",
"+ if s[j] in set(s[i:]):"
] | false | 0.042615 | 0.043331 | 0.983489 | [
"s689368169",
"s721945869"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.