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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u937642029 | p03640 | python | s846120757 | s019752166 | 186 | 38 | 40,560 | 4,836 | Accepted | Accepted | 79.57 | def main():
h,w = list(map(int,input().split()))
n=int(eval(input()))
a = list(map(int,input().split()))
ans=[[0 for _ in range(w)] for _ in range(h)]
x=y=key=0
for i in range(n):
for _ in range(a[i]):
ans[x][y]=str(i+1)
if key==0:
y+=1
... | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): re... | 25 | 45 | 647 | 1,451 | def main():
h, w = list(map(int, input().split()))
n = int(eval(input()))
a = list(map(int, input().split()))
ans = [[0 for _ in range(w)] for _ in range(h)]
x = y = key = 0
for i in range(n):
for _ in range(a[i]):
ans[x][y] = str(i + 1)
if key == 0:
... | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
... | false | 44.444444 | [
"+import sys, bisect, math, itertools, string, queue, copy",
"+",
"+# import numpy as np",
"+# import scipy",
"+from collections import Counter, defaultdict, deque",
"+from itertools import permutations, combinations",
"+from heapq import heappop, heappush",
"+",
"+input = sys.stdin.readline",
"+s... | false | 0.083684 | 0.037475 | 2.233058 | [
"s846120757",
"s019752166"
] |
u208713671 | p03147 | python | s391084201 | s471871301 | 185 | 66 | 39,664 | 67,116 | Accepted | Accepted | 64.32 | N = int(eval(input()))
H = [0] + list(map(int,input().split()))
cnt = 0
stop = max(H)
while stop>0:
stop += -1
for i in range(1,N+1):
if H[i]>0 and H[i-1]==0:
cnt+=1
for i in range(1,N+1):
if H[i]>0:
H[i]+=-1
print(cnt)
| N = int(eval(input()))
H = list(map(int,input().split()))
H.append(0)
cnt = 0
stop = max(H)
while stop>0:
stop += -1
for i in range(N):
if H[i]>0 and H[i+1]==0:
cnt+=1
for i in range(N):
if H[i]>0:
H[i]+=-1
print(cnt)
| 14 | 15 | 280 | 279 | N = int(eval(input()))
H = [0] + list(map(int, input().split()))
cnt = 0
stop = max(H)
while stop > 0:
stop += -1
for i in range(1, N + 1):
if H[i] > 0 and H[i - 1] == 0:
cnt += 1
for i in range(1, N + 1):
if H[i] > 0:
H[i] += -1
print(cnt)
| N = int(eval(input()))
H = list(map(int, input().split()))
H.append(0)
cnt = 0
stop = max(H)
while stop > 0:
stop += -1
for i in range(N):
if H[i] > 0 and H[i + 1] == 0:
cnt += 1
for i in range(N):
if H[i] > 0:
H[i] += -1
print(cnt)
| false | 6.666667 | [
"-H = [0] + list(map(int, input().split()))",
"+H = list(map(int, input().split()))",
"+H.append(0)",
"- for i in range(1, N + 1):",
"- if H[i] > 0 and H[i - 1] == 0:",
"+ for i in range(N):",
"+ if H[i] > 0 and H[i + 1] == 0:",
"- for i in range(1, N + 1):",
"+ for i in ra... | false | 0.042258 | 0.07359 | 0.574231 | [
"s391084201",
"s471871301"
] |
u107639613 | p02889 | python | s804985175 | s296342711 | 1,922 | 1,256 | 60,376 | 57,436 | Accepted | Accepted | 34.65 | inf = 10 ** 15
N, M, L = list(map(int, input().split()))
dp = [[inf] * N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
dp[a-1][b-1] = c
dp[b-1][a-1] = c
for i in range(N):
dp[i][i] = 0
for k in range(N):
for i in range(N):
for j in range(N):
... | """
気付き
1、float('inf')はちょい遅いみたい
2、input()よりもinput = sys.stdin.readlineの方が爆速らしい(知らんがな)
"""
import sys
inf = 10 ** 15
input = sys.stdin.readline
N, M, L = list(map(int, input().split()))
dp = [[inf] * N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
dp[a-1][b-1] = c
... | 39 | 46 | 924 | 1,059 | inf = 10**15
N, M, L = list(map(int, input().split()))
dp = [[inf] * N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
dp[a - 1][b - 1] = c
dp[b - 1][a - 1] = c
for i in range(N):
dp[i][i] = 0
for k in range(N):
for i in range(N):
for j in range(N):
... | """
気付き
1、float('inf')はちょい遅いみたい
2、input()よりもinput = sys.stdin.readlineの方が爆速らしい(知らんがな)
"""
import sys
inf = 10**15
input = sys.stdin.readline
N, M, L = list(map(int, input().split()))
dp = [[inf] * N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
dp[a - 1][b - 1] = c
dp[b - ... | false | 15.217391 | [
"+\"\"\"",
"+気付き",
"+1、float('inf')はちょい遅いみたい",
"+2、input()よりもinput = sys.stdin.readlineの方が爆速らしい(知らんがな)",
"+\"\"\"",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.043784 | 0.043632 | 1.003496 | [
"s804985175",
"s296342711"
] |
u693953100 | p03745 | python | s667387033 | s284028476 | 77 | 65 | 14,252 | 15,020 | Accepted | Accepted | 15.58 | n = int(eval(input()))
a = list(map(int,input().split()))
cnt = 1
fl = 0
for i in range(1,n):
if fl==1 and a[i]<a[i-1]:
cnt+=1
fl=0
elif fl==-1 and a[i]>a[i-1]:
cnt+=1
fl=0
elif fl==0 and a[i]<a[i-1]:
fl = -1
elif fl==0 and a[i]>a[i-1]:
fl = ... | def solve():
n = int(eval(input()))
a = list(map(int,input().split()))
direction = 0 # 0なら未定 -1なら減少,1なら増加
cnt = 1
for i in range(1,n):
if (a[i]-a[i-1])*direction<0:
cnt+=1
direction = 0
else:
if direction==0:
direction = ... | 16 | 15 | 327 | 382 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 1
fl = 0
for i in range(1, n):
if fl == 1 and a[i] < a[i - 1]:
cnt += 1
fl = 0
elif fl == -1 and a[i] > a[i - 1]:
cnt += 1
fl = 0
elif fl == 0 and a[i] < a[i - 1]:
fl = -1
elif fl == 0 and a[i] > a[i... | def solve():
n = int(eval(input()))
a = list(map(int, input().split()))
direction = 0 # 0なら未定 -1なら減少,1なら増加
cnt = 1
for i in range(1, n):
if (a[i] - a[i - 1]) * direction < 0:
cnt += 1
direction = 0
else:
if direction == 0:
directio... | false | 6.25 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-cnt = 1",
"-fl = 0",
"-for i in range(1, n):",
"- if fl == 1 and a[i] < a[i - 1]:",
"- cnt += 1",
"- fl = 0",
"- elif fl == -1 and a[i] > a[i - 1]:",
"- cnt += 1",
"- fl = 0",
"- elif fl =... | false | 0.032144 | 0.053783 | 0.597659 | [
"s667387033",
"s284028476"
] |
u312025627 | p02695 | python | s947496142 | s377326790 | 550 | 326 | 9,192 | 80,396 | Accepted | Accepted | 40.73 | def main():
from itertools import combinations_with_replacement
import sys
input = sys.stdin.buffer.readline
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
ans = 0
for C in combinations_with_replacement(list(range(1, M+1)), N):
... | def main():
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
def dfs(A):
if len(A) == N:
ret = 0
for (a, b, c, d) in T:
if A[b-1] - A[a-1] == c:
ret += d
return ret... | 19 | 22 | 535 | 530 | def main():
from itertools import combinations_with_replacement
import sys
input = sys.stdin.buffer.readline
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
ans = 0
for C in combinations_with_replacement(list(range(1, M + 1)), N):
... | def main():
N, M, Q = (int(i) for i in input().split())
T = [[int(i) for i in input().split()] for j in range(Q)]
def dfs(A):
if len(A) == N:
ret = 0
for (a, b, c, d) in T:
if A[b - 1] - A[a - 1] == c:
ret += d
return ret
... | false | 13.636364 | [
"- from itertools import combinations_with_replacement",
"- import sys",
"-",
"- input = sys.stdin.buffer.readline",
"- ans = 0",
"- for C in combinations_with_replacement(list(range(1, M + 1)), N):",
"- A = sorted(C)",
"- cur = 0",
"- for a, b, c, d in T:",
"- ... | false | 0.045367 | 0.066691 | 0.680261 | [
"s947496142",
"s377326790"
] |
u780475861 | p03864 | python | s261000773 | s250583194 | 161 | 101 | 14,092 | 14,092 | Accepted | Accepted | 37.27 | import sys
n, x, *lst1 = list(map(int, sys.stdin.read().split()))
res1 = res2 = 0
lst2 = [0] + lst1
lst1.append(0)
for i in range(n):
tmpsum = lst2[i] + lst2[i + 1]
if tmpsum > x:
res1 += tmpsum - x
lst2[i + 1] -= tmpsum - x
for i in range(n, 0, -1):
tmpsum = lst1[i] + lst1[i - 1]
if tmp... | import sys
n, x, *lst1 = list(map(int, sys.stdin.read().split()))
res1 = 0
lst2 = [0] + lst1
lst1.append(0)
for i in range(n):
tmpsum = lst2[i] + lst2[i + 1]
if tmpsum > x:
res1 += tmpsum - x
lst2[i + 1] -= tmpsum - x
print(res1) | 18 | 13 | 403 | 249 | import sys
n, x, *lst1 = list(map(int, sys.stdin.read().split()))
res1 = res2 = 0
lst2 = [0] + lst1
lst1.append(0)
for i in range(n):
tmpsum = lst2[i] + lst2[i + 1]
if tmpsum > x:
res1 += tmpsum - x
lst2[i + 1] -= tmpsum - x
for i in range(n, 0, -1):
tmpsum = lst1[i] + lst1[i - 1]
if tm... | import sys
n, x, *lst1 = list(map(int, sys.stdin.read().split()))
res1 = 0
lst2 = [0] + lst1
lst1.append(0)
for i in range(n):
tmpsum = lst2[i] + lst2[i + 1]
if tmpsum > x:
res1 += tmpsum - x
lst2[i + 1] -= tmpsum - x
print(res1)
| false | 27.777778 | [
"-res1 = res2 = 0",
"+res1 = 0",
"-for i in range(n, 0, -1):",
"- tmpsum = lst1[i] + lst1[i - 1]",
"- if tmpsum > x:",
"- res2 += tmpsum - x",
"- lst1[i - 1] -= tmpsum - x",
"-print((min(res1, res2)))",
"+print(res1)"
] | false | 0.040951 | 0.04044 | 1.012651 | [
"s261000773",
"s250583194"
] |
u540761833 | p03680 | python | s262605082 | s925963945 | 215 | 185 | 7,084 | 7,084 | Accepted | Accepted | 13.95 | N = int(eval(input()))
array = []
for i in range(N):
a = int(eval(input()))-1
array.append(a)
c = 0
now = 0
for i in range(N):
now = array[now]
c += 1
if now == 1:
break
if c == N and now != 1:
print((-1))
else:
print(c) | N = int(eval(input()))
a = [int(eval(input())) for i in range(N)]
nexta = a[0]
ans = -1
for i in range(1,N):
if nexta == 2:
ans = i
break
nexta = a[nexta-1]
print(ans) | 17 | 10 | 259 | 188 | N = int(eval(input()))
array = []
for i in range(N):
a = int(eval(input())) - 1
array.append(a)
c = 0
now = 0
for i in range(N):
now = array[now]
c += 1
if now == 1:
break
if c == N and now != 1:
print((-1))
else:
print(c)
| N = int(eval(input()))
a = [int(eval(input())) for i in range(N)]
nexta = a[0]
ans = -1
for i in range(1, N):
if nexta == 2:
ans = i
break
nexta = a[nexta - 1]
print(ans)
| false | 41.176471 | [
"-array = []",
"-for i in range(N):",
"- a = int(eval(input())) - 1",
"- array.append(a)",
"-c = 0",
"-now = 0",
"-for i in range(N):",
"- now = array[now]",
"- c += 1",
"- if now == 1:",
"+a = [int(eval(input())) for i in range(N)]",
"+nexta = a[0]",
"+ans = -1",
"+for i in... | false | 0.145284 | 0.079583 | 1.82556 | [
"s262605082",
"s925963945"
] |
u678167152 | p02717 | python | s413243447 | s937784402 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | X, Y, Z = map(int, input().split())
ans = (Z,X,Y)
#print(ans)
print(*ans,sep=' ')
| X,Y,Z = list(map(int,input().split()))
print((Z,X,Y)) | 5 | 2 | 86 | 46 | X, Y, Z = map(int, input().split())
ans = (Z, X, Y)
# print(ans)
print(*ans, sep=" ")
| X, Y, Z = list(map(int, input().split()))
print((Z, X, Y))
| false | 60 | [
"-X, Y, Z = map(int, input().split())",
"-ans = (Z, X, Y)",
"-# print(ans)",
"-print(*ans, sep=\" \")",
"+X, Y, Z = list(map(int, input().split()))",
"+print((Z, X, Y))"
] | false | 0.155642 | 0.048921 | 3.181495 | [
"s413243447",
"s937784402"
] |
u644907318 | p03574 | python | s531744332 | s321390793 | 201 | 74 | 40,172 | 71,676 | Accepted | Accepted | 63.18 | def f(i,j):
cnt = 0
if j<W-1 and A[i][j+1]=="#":
cnt += 1
if j<W-1 and i>=1 and A[i-1][j+1]=="#":
cnt += 1
if i>=1 and A[i-1][j]=="#":
cnt += 1
if i>=1 and j>=1 and A[i-1][j-1]=="#":
cnt += 1
if j>=1 and A[i][j-1]=="#":
cnt += 1
if i<H-1 an... | H,W = list(map(int,input().split()))
S = ["."*(W+2)]
for i in range(H):
x=input().strip()
x = "."+x+"."
S.append(x)
S.append("."*(W+2))
A = [[0 for _ in range(W+1)] for _ in range(H+1)]
for i in range(1,H+1):
for j in range(1,W+1):
if S[i][j]=="#":
A[i][j] = "#"
e... | 27 | 32 | 721 | 874 | def f(i, j):
cnt = 0
if j < W - 1 and A[i][j + 1] == "#":
cnt += 1
if j < W - 1 and i >= 1 and A[i - 1][j + 1] == "#":
cnt += 1
if i >= 1 and A[i - 1][j] == "#":
cnt += 1
if i >= 1 and j >= 1 and A[i - 1][j - 1] == "#":
cnt += 1
if j >= 1 and A[i][j - 1] == "#":
... | H, W = list(map(int, input().split()))
S = ["." * (W + 2)]
for i in range(H):
x = input().strip()
x = "." + x + "."
S.append(x)
S.append("." * (W + 2))
A = [[0 for _ in range(W + 1)] for _ in range(H + 1)]
for i in range(1, H + 1):
for j in range(1, W + 1):
if S[i][j] == "#":
A[i][j]... | false | 15.625 | [
"-def f(i, j):",
"- cnt = 0",
"- if j < W - 1 and A[i][j + 1] == \"#\":",
"- cnt += 1",
"- if j < W - 1 and i >= 1 and A[i - 1][j + 1] == \"#\":",
"- cnt += 1",
"- if i >= 1 and A[i - 1][j] == \"#\":",
"- cnt += 1",
"- if i >= 1 and j >= 1 and A[i - 1][j - 1] == \... | false | 0.058819 | 0.079521 | 0.73967 | [
"s531744332",
"s321390793"
] |
u790710233 | p02954 | python | s010458420 | s093227219 | 369 | 122 | 11,504 | 6,512 | Accepted | Accepted | 66.94 | from queue import Queue
s = eval(input())
prev = ""
ls = []
part = ""
for c in s:
if prev == 'L' and c == "R":
ls.append(part)
part = c
else:
part += c
prev = c
ls.append(part)
num_ls = Queue()
for block in ls:
len_block = len(block)
if len_block % 2 == ... | s = eval(input())
def calc_lr(block):
len_block = len(block)
if len_block % 2 == 0:
return (len_block//2, len_block//2)
else:
if block.index("L") % 2 == 1:
return (-(-len_block//2), len_block//2)
else:
return (len_block//2, -(-len_block//2))
... | 38 | 38 | 756 | 772 | from queue import Queue
s = eval(input())
prev = ""
ls = []
part = ""
for c in s:
if prev == "L" and c == "R":
ls.append(part)
part = c
else:
part += c
prev = c
ls.append(part)
num_ls = Queue()
for block in ls:
len_block = len(block)
if len_block % 2 == 0:
num_ls.put... | s = eval(input())
def calc_lr(block):
len_block = len(block)
if len_block % 2 == 0:
return (len_block // 2, len_block // 2)
else:
if block.index("L") % 2 == 1:
return (-(-len_block // 2), len_block // 2)
else:
return (len_block // 2, -(-len_block // 2))
pr... | false | 0 | [
"-from queue import Queue",
"+s = eval(input())",
"-s = eval(input())",
"+",
"+def calc_lr(block):",
"+ len_block = len(block)",
"+ if len_block % 2 == 0:",
"+ return (len_block // 2, len_block // 2)",
"+ else:",
"+ if block.index(\"L\") % 2 == 1:",
"+ return (-... | false | 0.04531 | 0.058447 | 0.775222 | [
"s010458420",
"s093227219"
] |
u777923818 | p03006 | python | s845742310 | s295368736 | 76 | 22 | 10,476 | 3,572 | Accepted | Accepted | 71.05 | from collections import Counter, deque, defaultdict
from operator import itemgetter, xor, mul
import sys
#input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))
g0 = itemgetter(0)
N = int(eval(input()))
X, Y = [0]*N, [0]*N
P... | from collections import defaultdict
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
XY = sorted([inpl() for _ in range(N)])
D = defaultdict(int)
for i in range(N):
for j in range(i+1, N):
D[(XY[j][0] - XY[i][0]), (XY[j][1] - XY[i][1])] += 1
print((N - max(D.values()) if... | 39 | 11 | 892 | 327 | from collections import Counter, deque, defaultdict
from operator import itemgetter, xor, mul
import sys
# input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl():
return list(map(int, input().split()))
g0 = itemgetter(0)
N = int(eval(input()))
X, Y = [0] * N, [0] * N
... | from collections import defaultdict
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
XY = sorted([inpl() for _ in range(N)])
D = defaultdict(int)
for i in range(N):
for j in range(i + 1, N):
D[(XY[j][0] - XY[i][0]), (XY[j][1] - XY[i][1])] += 1
print((N - max(D.values()) if N... | false | 71.794872 | [
"-from collections import Counter, deque, defaultdict",
"-from operator import itemgetter, xor, mul",
"-import sys",
"-",
"-# input = sys.stdin.readline",
"-from sys import setrecursionlimit",
"-",
"-setrecursionlimit(10**9)",
"+from collections import defaultdict",
"-g0 = itemgetter(0)",
"-X, Y... | false | 0.041988 | 0.036189 | 1.160237 | [
"s845742310",
"s295368736"
] |
u553987207 | p03290 | python | s778166422 | s660648350 | 1,313 | 25 | 5,524 | 3,064 | Accepted | Accepted | 98.1 | import functools
D, G = list(map(int, input().split()))
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
n, c = list(map(int, input().split()))
ns[i] = n
cs[i] = c // 100
sumn += n
minn = [0] * (D + 1)
for i in range(1, D + 1):
minn[i] = min(ns[1:i... | from itertools import combinations
D, G = list(map(int, input().split()))
G = G // 100
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
n, c = list(map(int, input().split()))
ns[i] = n
cs[i] = c // 100
ans = sum(ns)
for partialsn in range(1, D + 1):
for partials in combinatio... | 55 | 34 | 1,143 | 957 | import functools
D, G = list(map(int, input().split()))
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
n, c = list(map(int, input().split()))
ns[i] = n
cs[i] = c // 100
sumn += n
minn = [0] * (D + 1)
for i in range(1, D + 1):
minn[i] = min(ns[1 : i + 1])
@fu... | from itertools import combinations
D, G = list(map(int, input().split()))
G = G // 100
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
n, c = list(map(int, input().split()))
ns[i] = n
cs[i] = c // 100
ans = sum(ns)
for partialsn in range(1, D + 1):
for partials in combinations(list(rang... | false | 38.181818 | [
"-import functools",
"+from itertools import combinations",
"-sumn = 0",
"- sumn += n",
"-minn = [0] * (D + 1)",
"-for i in range(1, D + 1):",
"- minn[i] = min(ns[1 : i + 1])",
"-",
"-",
"-@functools.lru_cache(maxsize=None)",
"-def f(i, rn):",
"- if i == 1:",
"- if ns[1] < rn... | false | 0.09429 | 0.046704 | 2.0189 | [
"s778166422",
"s660648350"
] |
u875291233 | p02902 | python | s419097497 | s396475898 | 273 | 21 | 44,252 | 3,316 | Accepted | Accepted | 92.31 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
from collections import deque
def bfs(g,root,memo,backtrack):
q = deque()
# """初期化、キューに入れて訪問済みにする"""
memo[root] = 0
q.append(root)
"""BFS"""
while q: #キューが空になるまで
v =... | # find a cycle
def find_cycle(g):
n = len(g)
used = [0]*n #0:not yet 1: visiting 2: visited
for v in range(n): #各点でDFS
if used[v] == 2: continue
#初期化
stack = [v]
hist =[] #履歴
while stack:
v = stack[-1]
if used[v] == 1:
... | 60 | 89 | 1,200 | 2,114 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
from collections import deque
def bfs(g, root, memo, backtrack):
q = deque()
# """初期化、キューに入れて訪問済みにする"""
memo[root] = 0
q.append(root)
"""BFS"""
while q: # キューが空になるまで
v = q.pople... | # find a cycle
def find_cycle(g):
n = len(g)
used = [0] * n # 0:not yet 1: visiting 2: visited
for v in range(n): # 各点でDFS
if used[v] == 2:
continue
# 初期化
stack = [v]
hist = [] # 履歴
while stack:
v = stack[-1]
if used[v] == 1:
... | false | 32.58427 | [
"+# find a cycle",
"+def find_cycle(g):",
"+ n = len(g)",
"+ used = [0] * n # 0:not yet 1: visiting 2: visited",
"+ for v in range(n): # 各点でDFS",
"+ if used[v] == 2:",
"+ continue",
"+ # 初期化",
"+ stack = [v]",
"+ hist = [] # 履歴",
"+ while... | false | 0.07982 | 0.036096 | 2.211312 | [
"s419097497",
"s396475898"
] |
u803617136 | p02780 | python | s747162371 | s324935120 | 248 | 205 | 71,792 | 25,060 | Accepted | Accepted | 17.34 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
s = sum(P[0:K])
m = s
id = 0
for i in range(1, N - K + 1):
s += (P[i + K - 1] - P[i - 1])
if s > m:
id = i
m = s
ans = 0
for j in range(id, id + K):
ans += (P[j] + 1) / 2
print(ans) | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
e = []
for pi in p:
e.append((pi + 1) / 2)
total = sum(e[:k])
ans = total
for i in range(0, n - k):
total = total - e[i] + e[i + k]
ans = max(ans, total)
print(ans) | 16 | 13 | 295 | 259 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
s = sum(P[0:K])
m = s
id = 0
for i in range(1, N - K + 1):
s += P[i + K - 1] - P[i - 1]
if s > m:
id = i
m = s
ans = 0
for j in range(id, id + K):
ans += (P[j] + 1) / 2
print(ans)
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
e = []
for pi in p:
e.append((pi + 1) / 2)
total = sum(e[:k])
ans = total
for i in range(0, n - k):
total = total - e[i] + e[i + k]
ans = max(ans, total)
print(ans)
| false | 18.75 | [
"-N, K = list(map(int, input().split()))",
"-P = list(map(int, input().split()))",
"-s = sum(P[0:K])",
"-m = s",
"-id = 0",
"-for i in range(1, N - K + 1):",
"- s += P[i + K - 1] - P[i - 1]",
"- if s > m:",
"- id = i",
"- m = s",
"-ans = 0",
"-for j in range(id, id + K):",
... | false | 0.043014 | 0.044864 | 0.958782 | [
"s747162371",
"s324935120"
] |
u310245677 | p02753 | python | s744495158 | s929807939 | 181 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.61 | s = eval(input())
a = s.count("A")
b = s.count("B")
if a == 3 or b == 3:
print('No')
else:
print('Yes') | s=eval(input())
if s=='AAA' or s=='BBB':
print('No')
else:
print('Yes') | 7 | 5 | 107 | 73 | s = eval(input())
a = s.count("A")
b = s.count("B")
if a == 3 or b == 3:
print("No")
else:
print("Yes")
| s = eval(input())
if s == "AAA" or s == "BBB":
print("No")
else:
print("Yes")
| false | 28.571429 | [
"-a = s.count(\"A\")",
"-b = s.count(\"B\")",
"-if a == 3 or b == 3:",
"+if s == \"AAA\" or s == \"BBB\":"
] | false | 0.142402 | 0.097872 | 1.454979 | [
"s744495158",
"s929807939"
] |
u302789073 | p03495 | python | s810490342 | s204698898 | 156 | 128 | 42,872 | 34,584 | Accepted | Accepted | 17.95 | n,k=[int(i) for i in input().split()]
a_list=[int(i) for i in input().split()]
#print(a_list)
dic={}
for i in a_list:
if i not in dic:
dic[i]=1
else:
dic[i]+=1
#print(dic)
#print(len(dic))
#書き換えなくてよい
if len(dic)<=k:
print((0))
else:
ans=sorted(list(dic.items(... | n,k=[int(i) for i in input().split()]
a_list=[int(i) for i in input().split()]
a_dic={}
for i in range(n):
if a_list[i] not in a_dic:
a_dic[a_list[i]]=1
else:
a_dic[a_list[i]]+=1
if len(a_dic)<=k:
print((0))
else:
#値を取り出す
a_value=list(a_dic.values())
... | 27 | 23 | 453 | 393 | n, k = [int(i) for i in input().split()]
a_list = [int(i) for i in input().split()]
# print(a_list)
dic = {}
for i in a_list:
if i not in dic:
dic[i] = 1
else:
dic[i] += 1
# print(dic)
# print(len(dic))
# 書き換えなくてよい
if len(dic) <= k:
print((0))
else:
ans = sorted(list(dic.items()), key=la... | n, k = [int(i) for i in input().split()]
a_list = [int(i) for i in input().split()]
a_dic = {}
for i in range(n):
if a_list[i] not in a_dic:
a_dic[a_list[i]] = 1
else:
a_dic[a_list[i]] += 1
if len(a_dic) <= k:
print((0))
else:
# 値を取り出す
a_value = list(a_dic.values())
a_value.sort(... | false | 14.814815 | [
"-# print(a_list)",
"-dic = {}",
"-for i in a_list:",
"- if i not in dic:",
"- dic[i] = 1",
"+a_dic = {}",
"+for i in range(n):",
"+ if a_list[i] not in a_dic:",
"+ a_dic[a_list[i]] = 1",
"- dic[i] += 1",
"-# print(dic)",
"-# print(len(dic))",
"-# 書き換えなくてよい",
"-i... | false | 0.040817 | 0.04134 | 0.987368 | [
"s810490342",
"s204698898"
] |
u332793228 | p03962 | python | s817378125 | s087546317 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | l=list(map(int,input().split()))
print((len(set(l)))) | print((len(set(input().split())))) | 2 | 1 | 52 | 32 | l = list(map(int, input().split()))
print((len(set(l))))
| print((len(set(input().split()))))
| false | 50 | [
"-l = list(map(int, input().split()))",
"-print((len(set(l))))",
"+print((len(set(input().split()))))"
] | false | 0.041522 | 0.042374 | 0.979904 | [
"s817378125",
"s087546317"
] |
u273010357 | p02848 | python | s740281847 | s416204420 | 158 | 30 | 12,848 | 3,772 | Accepted | Accepted | 81.01 | import string
import numpy as np
N = int(eval(input()))
S = list(eval(input()))
A2Z = string.ascii_uppercase
str_index = np.full(len(S), 0)
mod_26 = np.full(len(S), 26)
#print(str_index)
for i in range(len(S)):
str_index[i] = A2Z.index(S[i])
str_index = (str_index+N) % mod_26
#print(str_index)
tmp... | import string
A2Z = string.ascii_uppercase
N = int(eval(input()))
S = eval(input())
res = ''
for i in range(len(S)):
index = A2Z.index(S[i])
res += A2Z[(index+N)%26]
print(res) | 21 | 11 | 441 | 184 | import string
import numpy as np
N = int(eval(input()))
S = list(eval(input()))
A2Z = string.ascii_uppercase
str_index = np.full(len(S), 0)
mod_26 = np.full(len(S), 26)
# print(str_index)
for i in range(len(S)):
str_index[i] = A2Z.index(S[i])
str_index = (str_index + N) % mod_26
# print(str_index)
tmp = [""] * len... | import string
A2Z = string.ascii_uppercase
N = int(eval(input()))
S = eval(input())
res = ""
for i in range(len(S)):
index = A2Z.index(S[i])
res += A2Z[(index + N) % 26]
print(res)
| false | 47.619048 | [
"-import numpy as np",
"+A2Z = string.ascii_uppercase",
"-S = list(eval(input()))",
"-A2Z = string.ascii_uppercase",
"-str_index = np.full(len(S), 0)",
"-mod_26 = np.full(len(S), 26)",
"-# print(str_index)",
"+S = eval(input())",
"+res = \"\"",
"- str_index[i] = A2Z.index(S[i])",
"-str_index ... | false | 0.251971 | 0.053714 | 4.690975 | [
"s740281847",
"s416204420"
] |
u697101155 | p02743 | python | s733222421 | s339884640 | 169 | 35 | 39,764 | 5,076 | Accepted | Accepted | 79.29 | import math
a, b, c = list(map(int, input().split()))
# a + b + 2 sqrt(ab) < c
# c - a - b > 2 sqrt(ab)
# (c - a - b)^2 > 4ab
if (c - a - b)**2 > 4 * a * b and c - a - b > 0:
print('Yes')
else:
print('No') | from decimal import Decimal
a, b, c = list(map(int, input().split()))
a = Decimal(str(a)).sqrt()
b = Decimal(str(b)).sqrt()
c = Decimal(str(c)).sqrt()
if a + b < c:
print('Yes')
else:
print('No') | 12 | 12 | 221 | 211 | import math
a, b, c = list(map(int, input().split()))
# a + b + 2 sqrt(ab) < c
# c - a - b > 2 sqrt(ab)
# (c - a - b)^2 > 4ab
if (c - a - b) ** 2 > 4 * a * b and c - a - b > 0:
print("Yes")
else:
print("No")
| from decimal import Decimal
a, b, c = list(map(int, input().split()))
a = Decimal(str(a)).sqrt()
b = Decimal(str(b)).sqrt()
c = Decimal(str(c)).sqrt()
if a + b < c:
print("Yes")
else:
print("No")
| false | 0 | [
"-import math",
"+from decimal import Decimal",
"-# a + b + 2 sqrt(ab) < c",
"-# c - a - b > 2 sqrt(ab)",
"-# (c - a - b)^2 > 4ab",
"-if (c - a - b) ** 2 > 4 * a * b and c - a - b > 0:",
"+a = Decimal(str(a)).sqrt()",
"+b = Decimal(str(b)).sqrt()",
"+c = Decimal(str(c)).sqrt()",
"+if a + b < c:"
] | false | 0.034446 | 0.048823 | 0.705525 | [
"s733222421",
"s339884640"
] |
u030626972 | p03127 | python | s687273905 | s223154629 | 90 | 82 | 14,252 | 14,252 | Accepted | Accepted | 8.89 | #モンスター数
n = int(eval(input()))
#モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
ans = mon[0]
for i in range(1,n):
ans = gcd(ans,mon[i])
print(ans) | def main():
#モンスター数
n = int(eval(input()))
#モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
ans = mon[0]
for i in range(1,n):
ans = gcd(ans,mon[i])
prin... | 17 | 20 | 255 | 330 | # モンスター数
n = int(eval(input()))
# モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
ans = mon[0]
for i in range(1, n):
ans = gcd(ans, mon[i])
print(ans)
| def main():
# モンスター数
n = int(eval(input()))
# モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
ans = mon[0]
for i in range(1, n):
ans = gcd(ans, mon[i])
print(ans)
main... | false | 15 | [
"-# モンスター数",
"-n = int(eval(input()))",
"-# モンスターiの体力:mon[i]",
"-mon = list(map(int, input().split()))",
"+def main():",
"+ # モンスター数",
"+ n = int(eval(input()))",
"+ # モンスターiの体力:mon[i]",
"+ mon = list(map(int, input().split()))",
"+",
"+ def gcd(a, b):",
"+ if b == 0:",
... | false | 0.06707 | 0.046138 | 1.453704 | [
"s687273905",
"s223154629"
] |
u127499732 | p03061 | python | s472560304 | s732559136 | 358 | 167 | 96,952 | 16,204 | Accepted | Accepted | 53.35 | def main():
from fractions import gcd
n, *a = list(map(int, open(0).read().split()))
a = [0] + a + [0]
l = [0 for _ in range(n + 1)]
r = [0 for _ in range(n + 1)]
tmpl = 0
tmpr = 0
for i in range(1,n+1):
tmpl = gcd(tmpl, a[i-1])
tmpr = gcd(tmpr, a[-i])
... | def main():
from fractions import gcd
n, *a = list(map(int, open(0).read().split()))
a = tuple([0] + a + [0])
l = [0 for _ in range(n + 1)]
r = [0 for _ in range(n + 1)]
tmpl = 0
tmpr = 0
for i in range(1,n+1):
tmpl = gcd(tmpl, a[i-1])
tmpr = gcd(tmpr, a[-i])
... | 25 | 25 | 505 | 512 | def main():
from fractions import gcd
n, *a = list(map(int, open(0).read().split()))
a = [0] + a + [0]
l = [0 for _ in range(n + 1)]
r = [0 for _ in range(n + 1)]
tmpl = 0
tmpr = 0
for i in range(1, n + 1):
tmpl = gcd(tmpl, a[i - 1])
tmpr = gcd(tmpr, a[-i])
l[i] ... | def main():
from fractions import gcd
n, *a = list(map(int, open(0).read().split()))
a = tuple([0] + a + [0])
l = [0 for _ in range(n + 1)]
r = [0 for _ in range(n + 1)]
tmpl = 0
tmpr = 0
for i in range(1, n + 1):
tmpl = gcd(tmpl, a[i - 1])
tmpr = gcd(tmpr, a[-i])
... | false | 0 | [
"- a = [0] + a + [0]",
"+ a = tuple([0] + a + [0])"
] | false | 0.04457 | 0.053776 | 0.828811 | [
"s472560304",
"s732559136"
] |
u597374218 | p02994 | python | s467053538 | s832736189 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | N,L=list(map(int,input().split()))
taste=[L+i for i in range(N)]
print((sum(taste)-min(taste,key=abs))) | N,L=list(map(int,input().split()))
taste=list(range(L,L+N))
print((sum(taste)-min(taste,key=abs))) | 3 | 3 | 97 | 86 | N, L = list(map(int, input().split()))
taste = [L + i for i in range(N)]
print((sum(taste) - min(taste, key=abs)))
| N, L = list(map(int, input().split()))
taste = list(range(L, L + N))
print((sum(taste) - min(taste, key=abs)))
| false | 0 | [
"-taste = [L + i for i in range(N)]",
"+taste = list(range(L, L + N))"
] | false | 0.042537 | 0.04471 | 0.951396 | [
"s467053538",
"s832736189"
] |
u699994820 | p03556 | python | s445538024 | s504260061 | 38 | 28 | 2,940 | 3,188 | Accepted | Accepted | 26.32 | #2
n = int(eval(input()))
i = 1
f = 0
while i**2<=n :
f = i**2
i = i +1
print(f)
| #2
n = int(eval(input()))
p = 0
for i in range(int(n**0.5)+1):
if i**2<=n: p=i
print((p**2)) | 9 | 6 | 95 | 101 | # 2
n = int(eval(input()))
i = 1
f = 0
while i**2 <= n:
f = i**2
i = i + 1
print(f)
| # 2
n = int(eval(input()))
p = 0
for i in range(int(n**0.5) + 1):
if i**2 <= n:
p = i
print((p**2))
| false | 33.333333 | [
"-i = 1",
"-f = 0",
"-while i**2 <= n:",
"- f = i**2",
"- i = i + 1",
"-print(f)",
"+p = 0",
"+for i in range(int(n**0.5) + 1):",
"+ if i**2 <= n:",
"+ p = i",
"+print((p**2))"
] | false | 0.037165 | 0.041059 | 0.905168 | [
"s445538024",
"s504260061"
] |
u010777300 | p02790 | python | s073559075 | s054565633 | 29 | 25 | 9,060 | 9,028 | Accepted | Accepted | 13.79 | a,b=list(map(int,input().split()))
if a>b:
print((str(b)*a))
if a<=b:
print((str(a)*b))
| a,b=list(map(int,input().split()))
print((str(min(a,b))*max(a,b))) | 6 | 2 | 93 | 59 | a, b = list(map(int, input().split()))
if a > b:
print((str(b) * a))
if a <= b:
print((str(a) * b))
| a, b = list(map(int, input().split()))
print((str(min(a, b)) * max(a, b)))
| false | 66.666667 | [
"-if a > b:",
"- print((str(b) * a))",
"-if a <= b:",
"- print((str(a) * b))",
"+print((str(min(a, b)) * max(a, b)))"
] | false | 0.037994 | 0.081989 | 0.463403 | [
"s073559075",
"s054565633"
] |
u562935282 | p02955 | python | s596442307 | s743613494 | 352 | 165 | 3,188 | 9,352 | Accepted | Accepted | 53.12 | # https://atcoder.jp/contests/abc136/submissions/6708242
def solve():
n, k = list(map(int, input().split()))
a = tuple(sorted(map(int, input().split()), reverse=True))
sum_a = sum(a)
e = set()
divisor = 1
while divisor * divisor <= sum_a:
if sum_a % divisor == 0:
... | # https://betrue12.hateblo.jp/entry/2020/03/28/142051
def main():
N, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
def divisor_generator(n):
div = 1
stock = []
while div * div <= n:
if n % div == 0:
yield n // div... | 43 | 33 | 943 | 814 | # https://atcoder.jp/contests/abc136/submissions/6708242
def solve():
n, k = list(map(int, input().split()))
a = tuple(sorted(map(int, input().split()), reverse=True))
sum_a = sum(a)
e = set()
divisor = 1
while divisor * divisor <= sum_a:
if sum_a % divisor == 0:
e.add(diviso... | # https://betrue12.hateblo.jp/entry/2020/03/28/142051
def main():
N, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
def divisor_generator(n):
div = 1
stock = []
while div * div <= n:
if n % div == 0:
yield n // div
... | false | 23.255814 | [
"-# https://atcoder.jp/contests/abc136/submissions/6708242",
"-def solve():",
"- n, k = list(map(int, input().split()))",
"- a = tuple(sorted(map(int, input().split()), reverse=True))",
"- sum_a = sum(a)",
"- e = set()",
"- divisor = 1",
"- while divisor * divisor <= sum_a:",
"- ... | false | 0.057356 | 0.056346 | 1.01794 | [
"s596442307",
"s743613494"
] |
u083960235 | p03425 | python | s899964439 | s117065798 | 199 | 104 | 4,024 | 11,840 | Accepted | Accepted | 47.74 | import itertools
N=int(eval(input()))
l=[]
for i in range(N):
s=str(eval(input()))
l.append(s[0])
m=0
a=0
r=0
c=0
h=0
for i in range(N):
if l[i]=='M':
m+=1
elif l[i]=='A':
a+=1
elif l[i]=='R':
r+=1
elif l[i]=='C':
c+=1
elif l[i]=='H':
... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 39 | 37 | 577 | 1,019 | import itertools
N = int(eval(input()))
l = []
for i in range(N):
s = str(eval(input()))
l.append(s[0])
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(N):
if l[i] == "M":
m += 1
elif l[i] == "A":
a += 1
elif l[i] == "R":
r += 1
elif l[i] == "C":
c += 1
elif l[i... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 5.128205 | [
"-import itertools",
"+import sys, re, os",
"+from collections import deque, defaultdict, Counter",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from itertools import permutations, combinations, product, accumulate",
"+from operator import itemgetter, mul",
"+from copy impo... | false | 0.088417 | 0.038671 | 2.286364 | [
"s899964439",
"s117065798"
] |
u687053495 | p03862 | python | s341082302 | s530028640 | 176 | 112 | 14,548 | 14,252 | Accepted | Accepted | 36.36 |
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
B = A[::-1]
ansA = 0
ansB = 0
for i in range(N-1):
if A[i] > x:
ansA += A[i] - x
A[i] -= A[i] - x
s = A[i] + A[i+1]
if s > x:
ansA += s - x
A[i+1] -= s - x
for i in range(N-1):
if B[i] > x:
... |
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
B = A[::-1]
ansA = 0
ansB = 0
for i in range(N-1):
if A[i] > x:
ansA += A[i] - x
A[i] -= A[i] - x
s = A[i] + A[i+1]
if s > x:
ansA += s - x
A[i+1] -= s - x
print(ansA) | 29 | 19 | 458 | 283 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
B = A[::-1]
ansA = 0
ansB = 0
for i in range(N - 1):
if A[i] > x:
ansA += A[i] - x
A[i] -= A[i] - x
s = A[i] + A[i + 1]
if s > x:
ansA += s - x
A[i + 1] -= s - x
for i in range(N - 1):
if B[i] > x:... | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
B = A[::-1]
ansA = 0
ansB = 0
for i in range(N - 1):
if A[i] > x:
ansA += A[i] - x
A[i] -= A[i] - x
s = A[i] + A[i + 1]
if s > x:
ansA += s - x
A[i + 1] -= s - x
print(ansA)
| false | 34.482759 | [
"-for i in range(N - 1):",
"- if B[i] > x:",
"- ansB += B[i] - x",
"- B[i] -= B[i] - x",
"- s = B[i] + B[i + 1]",
"- if s > x:",
"- ansB += s - x",
"- B[i + 1] -= s - x",
"-print((min(ansA, ansB)))",
"+print(ansA)"
] | false | 0.036558 | 0.057361 | 0.637335 | [
"s341082302",
"s530028640"
] |
u810288681 | p03598 | python | s390025712 | s610457389 | 179 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.5 | n = int(eval(input()))
k = int(eval(input()))
x = list(map(int, input().split()))
ans = 0
for i in x:
ans += min(abs(i-0),abs(i-k))*2
print(ans) | n = int(eval(input()))
k = int(eval(input()))
xl = list(map(int, input().split()))
ans = 0
for i in xl:
ans+= min(abs(i-0), abs(k-i))*2
print(ans) | 7 | 7 | 142 | 144 | n = int(eval(input()))
k = int(eval(input()))
x = list(map(int, input().split()))
ans = 0
for i in x:
ans += min(abs(i - 0), abs(i - k)) * 2
print(ans)
| n = int(eval(input()))
k = int(eval(input()))
xl = list(map(int, input().split()))
ans = 0
for i in xl:
ans += min(abs(i - 0), abs(k - i)) * 2
print(ans)
| false | 0 | [
"-x = list(map(int, input().split()))",
"+xl = list(map(int, input().split()))",
"-for i in x:",
"- ans += min(abs(i - 0), abs(i - k)) * 2",
"+for i in xl:",
"+ ans += min(abs(i - 0), abs(k - i)) * 2"
] | false | 0.081732 | 0.055448 | 1.474028 | [
"s390025712",
"s610457389"
] |
u680851063 | p02630 | python | s535419566 | s329495767 | 459 | 190 | 20,832 | 20,188 | Accepted | Accepted | 58.61 | def Replacing():
n = int(eval(input()))
A = list(map(int,input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5+1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
for i in range(q):
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
A = list(map(int,input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5+1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
for i in range(q):
b, c = list(map(int,... | 21 | 21 | 511 | 453 | def Replacing():
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5 + 1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
for i in range(q):
b, c = list(map(i... | import sys
input = sys.stdin.readline
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5 + 1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
for i in range(q):
b, c = list(map(int, input().sp... | false | 0 | [
"-def Replacing():",
"- n = int(eval(input()))",
"- A = list(map(int, input().split()))",
"- q = int(eval(input()))",
"- total = sum(A) # これを基に各queryに対応(加算、減算)する",
"- l = [0 for i in range(10**5 + 1)] # 配列のインデックスを各valueとみなす",
"- for _ in A: # 各インデックスに各keyを加算",
"- l[_] += 1"... | false | 0.006591 | 0.038296 | 0.172107 | [
"s535419566",
"s329495767"
] |
u367701763 | p03033 | python | s657227801 | s777777967 | 1,244 | 821 | 162,256 | 146,112 | Accepted | Accepted | 34 | class DualSegmentTree():
def __init__(self, n, op, e):
"""
:param n: 配列の要素数
:param op: 作用素(モノイド=結合則+単位元存在)
:param e: 単位元
"""
self.n = n
self.op = op
self.e = e
self.size = 1 << (self.n - 1).bit_length()
self.lazy = [self.e... | class DualSegmentTree():
def __init__(self, n, op, e):
"""
:param n: 配列の要素数
:param op: 作用素(モノイド=結合則+単位元存在)
:param e: 単位元
"""
self.n = n
self.op = op
self.e = e
self.size = 1 << (self.n - 1).bit_length()
self.lazy = [self.e... | 145 | 100 | 4,356 | 2,767 | class DualSegmentTree:
def __init__(self, n, op, e):
"""
:param n: 配列の要素数
:param op: 作用素(モノイド=結合則+単位元存在)
:param e: 単位元
"""
self.n = n
self.op = op
self.e = e
self.size = 1 << (self.n - 1).bit_length()
self.lazy = [self.e] * (self.size ... | class DualSegmentTree:
def __init__(self, n, op, e):
"""
:param n: 配列の要素数
:param op: 作用素(モノイド=結合則+単位元存在)
:param e: 単位元
"""
self.n = n
self.op = op
self.e = e
self.size = 1 << (self.n - 1).bit_length()
self.lazy = [self.e] * (self.size ... | false | 31.034483 | [
"- self.lazy[r] = self.op(x, self.lazy[r])",
"+ self.lazy[r] = x",
"- self.lazy[l] = self.op(x, self.lazy[l])",
"+ self.lazy[l] = x",
"- self.lazy[2 * x + 1] = self.op(self.lazy[x], self.lazy[2 * x + 1])",
"- self.lazy[2 * x... | false | 0.105036 | 0.084506 | 1.242946 | [
"s657227801",
"s777777967"
] |
u840958781 | p02887 | python | s808779886 | s764137134 | 1,357 | 63 | 3,428 | 3,316 | Accepted | Accepted | 95.36 | n=int(eval(input()))
s=str(eval(input()))
for i in range(n-1):
if s[i]==s[i+1]:
s = s[:i] + 'X' + s[i+1:]
print((len(s.replace('X', '')))) | n=int(eval(input()))
s=eval(input())
li=""
li+=s[0]
for i in range(n):
if i>0 and s[i]!=s[i-1]:
li+=s[i]
print((len(li))) | 6 | 8 | 132 | 126 | n = int(eval(input()))
s = str(eval(input()))
for i in range(n - 1):
if s[i] == s[i + 1]:
s = s[:i] + "X" + s[i + 1 :]
print((len(s.replace("X", ""))))
| n = int(eval(input()))
s = eval(input())
li = ""
li += s[0]
for i in range(n):
if i > 0 and s[i] != s[i - 1]:
li += s[i]
print((len(li)))
| false | 25 | [
"-s = str(eval(input()))",
"-for i in range(n - 1):",
"- if s[i] == s[i + 1]:",
"- s = s[:i] + \"X\" + s[i + 1 :]",
"-print((len(s.replace(\"X\", \"\"))))",
"+s = eval(input())",
"+li = \"\"",
"+li += s[0]",
"+for i in range(n):",
"+ if i > 0 and s[i] != s[i - 1]:",
"+ li += ... | false | 0.065003 | 0.037536 | 1.731733 | [
"s808779886",
"s764137134"
] |
u160244242 | p03038 | python | s473881566 | s520177532 | 942 | 496 | 99,352 | 37,692 | Accepted | Accepted | 47.35 | import heapq
n, m = list(map(int, input().split()))
a_lst = list(map(int, input().split()))
bc_lst = [list(map(int, input().split())) for _ in range(m)]
bc_lst = sorted(bc_lst, key = lambda x: -x[1])
aa_lst = a_lst[:]
heapq.heapify(aa_lst)
for bc in bc_lst:
for i in range(bc[0]):
if aa_lst[0] <... | n, m = list(map(int, input().split()))
a_lst = list(map(int, input().split()))
bc_lst = [list(map(int, input().split())) for _ in range(m)]
sorted_a = sorted(a_lst)
sorted_bc = sorted(bc_lst, key = lambda x: -x[1])
bc_index = 0
bc_count = 1
bc = sorted_bc[bc_index]
for i in range(n):
if sorted_a[i] < b... | 17 | 25 | 431 | 614 | import heapq
n, m = list(map(int, input().split()))
a_lst = list(map(int, input().split()))
bc_lst = [list(map(int, input().split())) for _ in range(m)]
bc_lst = sorted(bc_lst, key=lambda x: -x[1])
aa_lst = a_lst[:]
heapq.heapify(aa_lst)
for bc in bc_lst:
for i in range(bc[0]):
if aa_lst[0] < bc[1]:
... | n, m = list(map(int, input().split()))
a_lst = list(map(int, input().split()))
bc_lst = [list(map(int, input().split())) for _ in range(m)]
sorted_a = sorted(a_lst)
sorted_bc = sorted(bc_lst, key=lambda x: -x[1])
bc_index = 0
bc_count = 1
bc = sorted_bc[bc_index]
for i in range(n):
if sorted_a[i] < bc[1]:
s... | false | 32 | [
"-import heapq",
"-",
"-bc_lst = sorted(bc_lst, key=lambda x: -x[1])",
"-aa_lst = a_lst[:]",
"-heapq.heapify(aa_lst)",
"-for bc in bc_lst:",
"- for i in range(bc[0]):",
"- if aa_lst[0] < bc[1]:",
"- heapq.heapreplace(aa_lst, bc[1])",
"+sorted_a = sorted(a_lst)",
"+sorted_bc ... | false | 0.04317 | 0.078883 | 0.547266 | [
"s473881566",
"s520177532"
] |
u411353821 | p02714 | python | s386853261 | s332976017 | 1,921 | 1,393 | 68,972 | 9,448 | Accepted | Accepted | 27.49 | def main():
n = int(eval(input()))
S = eval(input())
r_inds = []
g_inds = []
b_inds = []
for i in range(len(S)):
if S[i] == "R":
r_inds.append(i)
elif S[i] == "G":
g_inds.append(i)
else:
b_inds.append(i)
total_comb = ... | from collections import defaultdict
def main():
n = int(eval(input()))
S = eval(input())
'''
r_inds = []
g_inds = []
b_inds = []
for i in range(len(S)):
if S[i] == "R":
r_inds.append(i)
elif S[i] == "G":
g_inds.append(i)
else:
... | 37 | 55 | 1,020 | 1,571 | def main():
n = int(eval(input()))
S = eval(input())
r_inds = []
g_inds = []
b_inds = []
for i in range(len(S)):
if S[i] == "R":
r_inds.append(i)
elif S[i] == "G":
g_inds.append(i)
else:
b_inds.append(i)
total_comb = len(r_inds) * l... | from collections import defaultdict
def main():
n = int(eval(input()))
S = eval(input())
"""
r_inds = []
g_inds = []
b_inds = []
for i in range(len(S)):
if S[i] == "R":
r_inds.append(i)
elif S[i] == "G":
g_inds.append(i)
else:
b_i... | false | 32.727273 | [
"+from collections import defaultdict",
"+",
"+",
"+ \"\"\"",
"- total_comb = len(r_inds) * len(g_inds) * len(b_inds)",
"+ total_comb = len(r_inds)*len(g_inds)*len(b_inds)",
"- print((total_comb - ded))",
"+ print(total_comb - ded)",
"+ \"\"\"",
"+ color_num = defaultdict(int)... | false | 0.126656 | 0.076929 | 1.64639 | [
"s386853261",
"s332976017"
] |
u919521780 | p03244 | python | s095037222 | s450342078 | 97 | 73 | 17,656 | 15,588 | Accepted | Accepted | 24.74 | n = int(eval(input()))
v = list(map(int, input().split()))
a = []
b = []
a_dic = {}
b_dic = {}
for i in range(n):
if i % 2 == 0:
if v[i] in list(a_dic.keys()):
a_dic[v[i]] += 1
else:
a_dic[v[i]] = 1
else:
if v[i] in list(b_dic.keys()):
... | # -*- coding: utf-8 -*-
from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
odd = Counter(v[0::2]).most_common(2) + [(0, 0)]
even = Counter(v[1::2]).most_common(2) + [(0, 0)]
n_half = int(n / 2)
if (len(odd) == 1 and len(even) == 1) and odd[0][0] == even[0][0]:
... | 58 | 21 | 1,199 | 547 | n = int(eval(input()))
v = list(map(int, input().split()))
a = []
b = []
a_dic = {}
b_dic = {}
for i in range(n):
if i % 2 == 0:
if v[i] in list(a_dic.keys()):
a_dic[v[i]] += 1
else:
a_dic[v[i]] = 1
else:
if v[i] in list(b_dic.keys()):
b_dic[v[i]] += 1... | # -*- coding: utf-8 -*-
from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
odd = Counter(v[0::2]).most_common(2) + [(0, 0)]
even = Counter(v[1::2]).most_common(2) + [(0, 0)]
n_half = int(n / 2)
if (len(odd) == 1 and len(even) == 1) and odd[0][0] == even[0][0]:
ans = n_half
e... | false | 63.793103 | [
"+# -*- coding: utf-8 -*-",
"+from collections import Counter",
"+",
"-a = []",
"-b = []",
"-a_dic = {}",
"-b_dic = {}",
"-for i in range(n):",
"- if i % 2 == 0:",
"- if v[i] in list(a_dic.keys()):",
"- a_dic[v[i]] += 1",
"- else:",
"- a_dic[v[i]] = 1",... | false | 0.042982 | 0.042935 | 1.001087 | [
"s095037222",
"s450342078"
] |
u772029934 | p03160 | python | s495040592 | s171095732 | 789 | 222 | 265,472 | 52,208 | Accepted | Accepted | 71.86 | N = int(eval(input()))
H = list(map(int,input().split()))
import sys
import functools
#indexi番目にいるときの最小コスト
sys.setrecursionlimit(pow(10,6))
@functools.lru_cache(None)
def func(i):
if i==0:
return 0
if i==1:
return abs(H[0]-H[1])
return min(func(i-1)+abs(H[i]-H[i-1]),func(i-2)+a... | N = int(eval(input()))
H = list(map(int,input().split()))
dp = [0]*N
dp[1]= abs(H[1]-H[0])
#dp[i] インデックスiにいるときの最小値
for i in range(1,N-1):
dp[i+1]=min(dp[i]+abs(H[i+1]-H[i]),dp[i-1]+abs(H[i+1]-H[i-1]))
print((dp[N-1])) | 16 | 12 | 351 | 228 | N = int(eval(input()))
H = list(map(int, input().split()))
import sys
import functools
# indexi番目にいるときの最小コスト
sys.setrecursionlimit(pow(10, 6))
@functools.lru_cache(None)
def func(i):
if i == 0:
return 0
if i == 1:
return abs(H[0] - H[1])
return min(func(i - 1) + abs(H[i] - H[i - 1]), func... | N = int(eval(input()))
H = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(H[1] - H[0])
# dp[i] インデックスiにいるときの最小値
for i in range(1, N - 1):
dp[i + 1] = min(dp[i] + abs(H[i + 1] - H[i]), dp[i - 1] + abs(H[i + 1] - H[i - 1]))
print((dp[N - 1]))
| false | 25 | [
"-import sys",
"-import functools",
"-",
"-# indexi番目にいるときの最小コスト",
"-sys.setrecursionlimit(pow(10, 6))",
"-",
"-",
"-@functools.lru_cache(None)",
"-def func(i):",
"- if i == 0:",
"- return 0",
"- if i == 1:",
"- return abs(H[0] - H[1])",
"- return min(func(i - 1) + a... | false | 0.036569 | 0.033975 | 1.076337 | [
"s495040592",
"s171095732"
] |
u815878613 | p03475 | python | s829939151 | s382173877 | 94 | 79 | 3,188 | 9,164 | Accepted | Accepted | 15.96 | import math
def main():
N = int(eval(input()))
CSF = [[int(x) for x in input().split()] for _ in range(N-1)]
tt = []
for j in range(N-1):
t = CSF[j][1] + CSF[j][0]
for i in range(j+1, N-1):
if t >= CSF[i][1]:
n = (t - CSF[i][1]) / CSF[i][2]
... | import math
N = int(eval(input()))
CSF = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N):
t = 0
for c, s, f in CSF[i:]:
# 待ち時間
if t < s:
t = s
else:
t = math.ceil((t - s) / f) * f + s
# i -> i+1に移動
t +=... | 26 | 19 | 554 | 333 | import math
def main():
N = int(eval(input()))
CSF = [[int(x) for x in input().split()] for _ in range(N - 1)]
tt = []
for j in range(N - 1):
t = CSF[j][1] + CSF[j][0]
for i in range(j + 1, N - 1):
if t >= CSF[i][1]:
n = (t - CSF[i][1]) / CSF[i][2]
... | import math
N = int(eval(input()))
CSF = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N):
t = 0
for c, s, f in CSF[i:]:
# 待ち時間
if t < s:
t = s
else:
t = math.ceil((t - s) / f) * f + s
# i -> i+1に移動
t += c
print(t)
| false | 26.923077 | [
"-",
"-def main():",
"- N = int(eval(input()))",
"- CSF = [[int(x) for x in input().split()] for _ in range(N - 1)]",
"- tt = []",
"- for j in range(N - 1):",
"- t = CSF[j][1] + CSF[j][0]",
"- for i in range(j + 1, N - 1):",
"- if t >= CSF[i][1]:",
"- ... | false | 0.040328 | 0.037391 | 1.078553 | [
"s829939151",
"s382173877"
] |
u150984829 | p02239 | python | s221916624 | s037043895 | 50 | 40 | 7,008 | 6,884 | Accepted | Accepted | 20 | import queue
N=int(eval(input()))
M=[input().split()[2:]for _ in[0]*N]
q=queue.Queue();q.put(0)
d=[-1]*N;d[0]=0
while not q.empty():
u=q.get()
for v in M[u]:
v=int(v)-1
if d[v]<0:d[v]=d[u]+1;q.put(v)
for i in range(N):print((i+1,d[i]))
| import queue
def s():
N=int(eval(input()))
M=[input().split()[2:]for _ in[0]*N]
q=queue.Queue();q.put(0)
d=[-1]*N;d[0]=0
while not q.empty():
u=q.get()
for v in M[u]:
v=int(v)-1
if d[v]<0:d[v]=d[u]+1;q.put(v)
for i in range(N):print((i+1,d[i]))
if'__main__'==__name__:s()
| 11 | 13 | 244 | 292 | import queue
N = int(eval(input()))
M = [input().split()[2:] for _ in [0] * N]
q = queue.Queue()
q.put(0)
d = [-1] * N
d[0] = 0
while not q.empty():
u = q.get()
for v in M[u]:
v = int(v) - 1
if d[v] < 0:
d[v] = d[u] + 1
q.put(v)
for i in range(N):
print((i + 1, d[i])... | import queue
def s():
N = int(eval(input()))
M = [input().split()[2:] for _ in [0] * N]
q = queue.Queue()
q.put(0)
d = [-1] * N
d[0] = 0
while not q.empty():
u = q.get()
for v in M[u]:
v = int(v) - 1
if d[v] < 0:
d[v] = d[u] + 1
... | false | 15.384615 | [
"-N = int(eval(input()))",
"-M = [input().split()[2:] for _ in [0] * N]",
"-q = queue.Queue()",
"-q.put(0)",
"-d = [-1] * N",
"-d[0] = 0",
"-while not q.empty():",
"- u = q.get()",
"- for v in M[u]:",
"- v = int(v) - 1",
"- if d[v] < 0:",
"- d[v] = d[u] + 1",
"... | false | 0.043918 | 0.0903 | 0.486356 | [
"s221916624",
"s037043895"
] |
u815878613 | p03425 | python | s788538187 | s691469365 | 186 | 153 | 3,064 | 16,532 | Accepted | Accepted | 17.74 | def main():
N = int(eval(input()))
cnt = [0]*5
for i in range(N):
S = eval(input())
if S[0] == 'M':
cnt[0] += 1
if S[0] == 'A':
cnt[1] += 1
if S[0] == 'R':
cnt[2] += 1
if S[0] == 'C':
cnt[3] += 1
i... | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N = int(readline())
S = list([x.decode("UTF-8") for x in readlines()])
S = list([x.rstrip('\n') for x in S])
march = list("MARCH")
cnt = [0] * 5
for i in range(N):
for j i... | 27 | 32 | 536 | 662 | def main():
N = int(eval(input()))
cnt = [0] * 5
for i in range(N):
S = eval(input())
if S[0] == "M":
cnt[0] += 1
if S[0] == "A":
cnt[1] += 1
if S[0] == "R":
cnt[2] += 1
if S[0] == "C":
cnt[3] += 1
if S[0] == "H"... | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N = int(readline())
S = list([x.decode("UTF-8") for x in readlines()])
S = list([x.rstrip("\n") for x in S])
march = list("MARCH")
cnt = [0] * 5
for i in range(N):
for j in range(5):
... | false | 15.625 | [
"+import sys",
"+",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+",
"+",
"- N = int(eval(input()))",
"+ N = int(readline())",
"+ S = list([x.decode(\"UTF-8\") for x in readlines()])",
"+ S = list([x.rstrip(\"\\n\") for x in S])",
"+ march =... | false | 0.04604 | 0.049217 | 0.935452 | [
"s788538187",
"s691469365"
] |
u365156087 | p03945 | python | s333016964 | s615295457 | 51 | 46 | 9,000 | 9,144 | Accepted | Accepted | 9.8 | s = eval(input())
cnt = 1
cw = s[0]
for i in range(len(s)):
if s[i] != cw:
cnt += 1
cw = s[i]
print((cnt - 1)) | s = eval(input())
cnt = 0
for i in range(1,len(s)):
if s[i] != s[i-1]:
cnt += 1
print(cnt) | 8 | 6 | 120 | 96 | s = eval(input())
cnt = 1
cw = s[0]
for i in range(len(s)):
if s[i] != cw:
cnt += 1
cw = s[i]
print((cnt - 1))
| s = eval(input())
cnt = 0
for i in range(1, len(s)):
if s[i] != s[i - 1]:
cnt += 1
print(cnt)
| false | 25 | [
"-cnt = 1",
"-cw = s[0]",
"-for i in range(len(s)):",
"- if s[i] != cw:",
"+cnt = 0",
"+for i in range(1, len(s)):",
"+ if s[i] != s[i - 1]:",
"- cw = s[i]",
"-print((cnt - 1))",
"+print(cnt)"
] | false | 0.037853 | 0.042801 | 0.884403 | [
"s333016964",
"s615295457"
] |
u021548497 | p02718 | python | s213648759 | s497969833 | 173 | 18 | 39,860 | 3,060 | Accepted | Accepted | 89.6 | n, m = list(map(int, input().split()))
a = [int(s) for s in input().split()]
a.sort(reverse=True)
if a[m-1]*4*m >= sum(a):
print("Yes")
else:
print("No") | n, m = list(map(int, input().split()))
a = [int(x) for x in input().split()]
a.sort(reverse=True)
if a[m-1]*4*m >= sum(a):
print("Yes")
else:
print("No") | 8 | 7 | 159 | 157 | n, m = list(map(int, input().split()))
a = [int(s) for s in input().split()]
a.sort(reverse=True)
if a[m - 1] * 4 * m >= sum(a):
print("Yes")
else:
print("No")
| n, m = list(map(int, input().split()))
a = [int(x) for x in input().split()]
a.sort(reverse=True)
if a[m - 1] * 4 * m >= sum(a):
print("Yes")
else:
print("No")
| false | 12.5 | [
"-a = [int(s) for s in input().split()]",
"+a = [int(x) for x in input().split()]"
] | false | 0.042065 | 0.039258 | 1.071513 | [
"s213648759",
"s497969833"
] |
u334712262 | p03111 | python | s720772761 | s067495882 | 306 | 272 | 6,372 | 7,520 | Accepted | Accepted | 11.11 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 89 | 90 | 1,736 | 1,745 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 1.111111 | [
"- S = (A, B, C, 0)",
"- for l in product([0, 1, 2, 3], repeat=len(L)):",
"+ S = (A, B, C)",
"+ for l in product([0, 1, 2, None], repeat=len(L)):",
"- s = [A, B, C, 0]",
"+ s = [A, B, C]",
"- if s[f] != S[f] and f != 3:",
"+ if f is None:",
"+ ... | false | 0.328401 | 0.779661 | 0.421209 | [
"s720772761",
"s067495882"
] |
u815878613 | p03206 | python | s783631099 | s157500713 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | import sys
D = int(eval(input()))
if D == 22:
print('Christmas Eve Eve Eve')
elif D == 23:
print('Christmas Eve Eve')
elif D == 24:
print('Christmas Eve')
elif D == 25:
print('Christmas')
| D = int(eval(input()))
if D == 22:
print("Christmas Eve Eve Eve")
if D == 23:
print("Christmas Eve Eve")
if D == 24:
print("Christmas Eve")
if D == 25:
print("Christmas")
| 14 | 10 | 215 | 191 | import sys
D = int(eval(input()))
if D == 22:
print("Christmas Eve Eve Eve")
elif D == 23:
print("Christmas Eve Eve")
elif D == 24:
print("Christmas Eve")
elif D == 25:
print("Christmas")
| D = int(eval(input()))
if D == 22:
print("Christmas Eve Eve Eve")
if D == 23:
print("Christmas Eve Eve")
if D == 24:
print("Christmas Eve")
if D == 25:
print("Christmas")
| false | 28.571429 | [
"-import sys",
"-",
"-elif D == 23:",
"+if D == 23:",
"-elif D == 24:",
"+if D == 24:",
"-elif D == 25:",
"+if D == 25:"
] | false | 0.041168 | 0.039206 | 1.050043 | [
"s783631099",
"s157500713"
] |
u647766105 | p00125 | python | s623663026 | s740047905 | 870 | 20 | 168,640 | 4,420 | Accepted | Accepted | 97.7 | cal = {}
month = [[31,28,31,30,31,30,31,31,30,31,30,31],
[31,29,31,30,31,30,31,31,30,31,30,31]]
count = 1
for y in range(3000):#
f = 1 if y%4 == 0 and y%100 != 0 or y%400 == 0 else 0
for m in range(12):
for d in range(month[f][m]):
cal[(y,m+1,d+1)] = count
count... | from datetime import datetime
while True:
y1,m1,d1,y2,m2,d2 = list(map(int,input().split()))
if any(i<0 for i in (y1,m1,d1,y2,m2,d2)):
break
print((datetime(y2,m2,d2) - datetime(y1,m1,d1)).days) | 15 | 6 | 502 | 216 | cal = {}
month = [
[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
[31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
]
count = 1
for y in range(3000): #
f = 1 if y % 4 == 0 and y % 100 != 0 or y % 400 == 0 else 0
for m in range(12):
for d in range(month[f][m]):
cal[(y, m + 1, d + ... | from datetime import datetime
while True:
y1, m1, d1, y2, m2, d2 = list(map(int, input().split()))
if any(i < 0 for i in (y1, m1, d1, y2, m2, d2)):
break
print((datetime(y2, m2, d2) - datetime(y1, m1, d1)).days)
| false | 60 | [
"-cal = {}",
"-month = [",
"- [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],",
"- [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],",
"-]",
"-count = 1",
"-for y in range(3000): #",
"- f = 1 if y % 4 == 0 and y % 100 != 0 or y % 400 == 0 else 0",
"- for m in range(12):",
"- ... | false | 1.756952 | 0.033406 | 52.593593 | [
"s623663026",
"s740047905"
] |
u678167152 | p03045 | python | s441778729 | s330168860 | 359 | 317 | 28,164 | 13,768 | Accepted | Accepted | 11.7 | N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a,b,c = list(map(int, input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
from collections import deque
ans = 0
visited = [False]*N
d = deque()
for i in range(N):
if visited[i]==False:
visited[i... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
y = self.find(y... | 24 | 51 | 507 | 1,183 | N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
from collections import deque
ans = 0
visited = [False] * N
d = deque()
for i in range(N):
if visited[i] == False:
... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.f... | false | 52.941176 | [
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.parents = [-1] * n",
"+",
"+ def find(self, x):",
"+ if self.parents[x] < 0:",
"+ return x",
"+ else:",
"+ self.parents[x] = self.find(self.parents[x])",
"+ ret... | false | 0.100955 | 0.049562 | 2.036955 | [
"s441778729",
"s330168860"
] |
u754022296 | p03768 | python | s541763627 | s371524864 | 1,815 | 1,435 | 62,328 | 63,460 | Accepted | Accepted | 20.94 | import sys
sys.setrecursionlimit(10**7)
def main():
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = int(eval(input()))
vdc = [list(map(int, input().spli... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = int(eval(input()))
vdc =... | 31 | 32 | 683 | 711 | import sys
sys.setrecursionlimit(10**7)
def main():
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = int(eval(input()))
vdc = [list(ma... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = int(eval(i... | false | 3.125 | [
"+input = sys.stdin.readline"
] | false | 0.03752 | 0.036836 | 1.018576 | [
"s541763627",
"s371524864"
] |
u010110540 | p03599 | python | s835754174 | s081779311 | 458 | 331 | 39,660 | 39,648 | Accepted | Accepted | 27.73 | def solve():
A, B, C, D, E, F = list(map(int, input().split()))
memo = {}
for a in range(31):
for b in range(31):
for c in range(101):
for d in range(101):
if a == 0 and b == 0:
break
if ... | def solve():
A, B, C, D, E, F = list(map(int, input().split()))
memo = {}
for a in range(31):
for b in range(31):
for c in range(101):
for d in range(101):
w = (100*A)*a + (100*B)*b
s = C*c + D*d
... | 27 | 29 | 861 | 845 | def solve():
A, B, C, D, E, F = list(map(int, input().split()))
memo = {}
for a in range(31):
for b in range(31):
for c in range(101):
for d in range(101):
if a == 0 and b == 0:
break
if (100 * A) * a + (100 ... | def solve():
A, B, C, D, E, F = list(map(int, input().split()))
memo = {}
for a in range(31):
for b in range(31):
for c in range(101):
for d in range(101):
w = (100 * A) * a + (100 * B) * b
s = C * c + D * d
if w... | false | 6.896552 | [
"- if a == 0 and b == 0:",
"+ w = (100 * A) * a + (100 * B) * b",
"+ s = C * c + D * d",
"+ if w == 0:",
"- if (100 * A) * a + (100 * B) * b + C * c + D * d > F:",
"+ if w + s > F:",
"- ... | false | 0.173964 | 0.008054 | 21.600342 | [
"s835754174",
"s081779311"
] |
u668503853 | p03456 | python | s817535170 | s302314486 | 33 | 17 | 2,940 | 2,940 | Accepted | Accepted | 48.48 | a,b=input().split()
c=a+b
c=int(c)
if any(i**2 == c for i in range(c//2)):
print("Yes")
else:
print("No") | a,b=input().split()
c=a+b
c=int(c)
if (c ** .5).is_integer():
print("Yes")
else:
print("No") | 7 | 7 | 115 | 102 | a, b = input().split()
c = a + b
c = int(c)
if any(i**2 == c for i in range(c // 2)):
print("Yes")
else:
print("No")
| a, b = input().split()
c = a + b
c = int(c)
if (c**0.5).is_integer():
print("Yes")
else:
print("No")
| false | 0 | [
"-if any(i**2 == c for i in range(c // 2)):",
"+if (c**0.5).is_integer():"
] | false | 0.179931 | 0.085862 | 2.09558 | [
"s817535170",
"s302314486"
] |
u727865521 | p02606 | python | s008554830 | s780303275 | 32 | 29 | 9,096 | 9,016 | Accepted | Accepted | 9.38 | L, R, d = [int(x) for x in input().split()]
compteur = 0
for i in range(L, R+1):
if i%d == 0:
compteur += 1
print(compteur) | L, R, d = [int(x) for x in input().split()]
comp = 0
for el in range(L, R+1):
if el % d == 0:
comp += 1
print(comp) | 8 | 7 | 141 | 134 | L, R, d = [int(x) for x in input().split()]
compteur = 0
for i in range(L, R + 1):
if i % d == 0:
compteur += 1
print(compteur)
| L, R, d = [int(x) for x in input().split()]
comp = 0
for el in range(L, R + 1):
if el % d == 0:
comp += 1
print(comp)
| false | 12.5 | [
"-compteur = 0",
"-for i in range(L, R + 1):",
"- if i % d == 0:",
"- compteur += 1",
"-print(compteur)",
"+comp = 0",
"+for el in range(L, R + 1):",
"+ if el % d == 0:",
"+ comp += 1",
"+print(comp)"
] | false | 0.046209 | 0.044261 | 1.044002 | [
"s008554830",
"s780303275"
] |
u476604182 | p03142 | python | s366073441 | s178212338 | 747 | 352 | 76,372 | 31,600 | Accepted | Accepted | 52.88 | from collections import defaultdict, deque
N, M = list(map(int, input().split()))
dic = defaultdict(list)
par = [0]*(N+1)
cnt = [0]*(N+1)
for i in range(N-1+M):
a, b = list(map(int, input().split()))
dic[a] += [b]
cnt[b] += 1
for i in range(1,N+1):
if cnt[i]==0:
q = deque([i])
break
... | from collections import defaultdict, deque
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
par = [0]*(N+1)
cnt = [0]*(N+1)
for a,b in zip(*[iter(L)]*2):
dic[a] += [b]
cnt[b] += 1
for i in range(1,N+1):
if cnt[i]==0:
q = deque([i])
break
while q:
m = q.poplef... | 25 | 24 | 468 | 450 | from collections import defaultdict, deque
N, M = list(map(int, input().split()))
dic = defaultdict(list)
par = [0] * (N + 1)
cnt = [0] * (N + 1)
for i in range(N - 1 + M):
a, b = list(map(int, input().split()))
dic[a] += [b]
cnt[b] += 1
for i in range(1, N + 1):
if cnt[i] == 0:
q = deque([i])
... | from collections import defaultdict, deque
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
par = [0] * (N + 1)
cnt = [0] * (N + 1)
for a, b in zip(*[iter(L)] * 2):
dic[a] += [b]
cnt[b] += 1
for i in range(1, N + 1):
if cnt[i] == 0:
q = deque([i])
break
while q:
... | false | 4 | [
"-N, M = list(map(int, input().split()))",
"+N, M, *L = list(map(int, open(0).read().split()))",
"-for i in range(N - 1 + M):",
"- a, b = list(map(int, input().split()))",
"+for a, b in zip(*[iter(L)] * 2):"
] | false | 0.036186 | 0.059025 | 0.613053 | [
"s366073441",
"s178212338"
] |
u504562455 | p02725 | python | s943630272 | s294748078 | 284 | 105 | 90,316 | 25,452 | Accepted | Accepted | 63.03 | K, N = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
A.sort()
A_diff = [A[i+1] - A[i] for i in range(N-1)] + [A[0] + K - A[-1]]
print((K - max(A_diff)))
| K, N = [int(_) for _ in input().split()]
# X = int(input())
A = [int(_) for _ in input().split()]
A.sort()
diff = [A[i+1] - A[i] for i in range(N-1)]
diff.append(A[0] + K - A[-1])
print((K-max(diff)))
| 5 | 7 | 181 | 205 | K, N = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
A.sort()
A_diff = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] + K - A[-1]]
print((K - max(A_diff)))
| K, N = [int(_) for _ in input().split()]
# X = int(input())
A = [int(_) for _ in input().split()]
A.sort()
diff = [A[i + 1] - A[i] for i in range(N - 1)]
diff.append(A[0] + K - A[-1])
print((K - max(diff)))
| false | 28.571429 | [
"+# X = int(input())",
"-A_diff = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] + K - A[-1]]",
"-print((K - max(A_diff)))",
"+diff = [A[i + 1] - A[i] for i in range(N - 1)]",
"+diff.append(A[0] + K - A[-1])",
"+print((K - max(diff)))"
] | false | 0.036479 | 0.076454 | 0.477136 | [
"s943630272",
"s294748078"
] |
u142903114 | p03455 | python | s170292582 | s759209217 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | i = eval(input())
l = i.split(' ')
if (int(l[0]) * int(l[1])) %2 == 1:
print('Odd')
else:
print('Even') | a, b = list(map(int, input().split()))
c = a * b
if c % 2 == 0:
print('Even')
else:
print('Odd') | 7 | 8 | 112 | 107 | i = eval(input())
l = i.split(" ")
if (int(l[0]) * int(l[1])) % 2 == 1:
print("Odd")
else:
print("Even")
| a, b = list(map(int, input().split()))
c = a * b
if c % 2 == 0:
print("Even")
else:
print("Odd")
| false | 12.5 | [
"-i = eval(input())",
"-l = i.split(\" \")",
"-if (int(l[0]) * int(l[1])) % 2 == 1:",
"+a, b = list(map(int, input().split()))",
"+c = a * b",
"+if c % 2 == 0:",
"+ print(\"Even\")",
"+else:",
"-else:",
"- print(\"Even\")"
] | false | 0.039498 | 0.039367 | 1.003315 | [
"s170292582",
"s759209217"
] |
u409831002 | p02984 | python | s158787289 | s577319893 | 196 | 95 | 14,220 | 19,096 | Accepted | Accepted | 51.53 | N=int(input())
A=[i for i in map(int,input().split())]
X=[0]*N
for i in range(N//2):
X[0]+=A[i*2]-A[i*2+1]
X[0]+=A[N-1]
for i in range(1, N):
X[i]=2*A[i-1]-X[i-1]
for x in X:
print(x,end=" ")
print()
| N=int(eval(input()))
A=[i for i in map(int,input().split())]
X=[0]*N
X[0]=sum(A[0::2])-sum(A[1::2])
for i in range(1, N):
X[i]=2*A[i-1]-X[i-1]
print((' '.join(map(str,X))))
| 12 | 10 | 224 | 181 | N = int(input())
A = [i for i in map(int, input().split())]
X = [0] * N
for i in range(N // 2):
X[0] += A[i * 2] - A[i * 2 + 1]
X[0] += A[N - 1]
for i in range(1, N):
X[i] = 2 * A[i - 1] - X[i - 1]
for x in X:
print(x, end=" ")
print()
| N = int(eval(input()))
A = [i for i in map(int, input().split())]
X = [0] * N
X[0] = sum(A[0::2]) - sum(A[1::2])
for i in range(1, N):
X[i] = 2 * A[i - 1] - X[i - 1]
print((" ".join(map(str, X))))
| false | 16.666667 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-for i in range(N // 2):",
"- X[0] += A[i * 2] - A[i * 2 + 1]",
"-X[0] += A[N - 1]",
"+X[0] = sum(A[0::2]) - sum(A[1::2])",
"-for x in X:",
"- print(x, end=\" \")",
"-print()",
"+print((\" \".join(map(str, X))))"
] | false | 0.036368 | 0.036019 | 1.009696 | [
"s158787289",
"s577319893"
] |
u780529129 | p02628 | python | s182307432 | s241822000 | 34 | 26 | 9,172 | 9,144 | Accepted | Accepted | 23.53 | n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
p = sorted(p)
ans = 0
for i in range(k):
ans += p[i]
print(ans) | n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
A = sorted(A)
ans = 0
for i in range(k):
ans += A[i]
print(ans) | 7 | 8 | 139 | 141 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p = sorted(p)
ans = 0
for i in range(k):
ans += p[i]
print(ans)
| n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
ans = 0
for i in range(k):
ans += A[i]
print(ans)
| false | 12.5 | [
"-p = list(map(int, input().split()))",
"-p = sorted(p)",
"+A = list(map(int, input().split()))",
"+A = sorted(A)",
"- ans += p[i]",
"+ ans += A[i]"
] | false | 0.038009 | 0.035479 | 1.071289 | [
"s182307432",
"s241822000"
] |
u088552457 | p03319 | python | s127625175 | s530828972 | 219 | 84 | 52,780 | 83,852 | Accepted | Accepted | 61.64 | import math
def main():
n, k = input_list()
a = input_list()
a = math.ceil((n-k)/(k-1))
print((1+a))
def input_list():
return list(map(int, input().split()))
if __name__ == "__main__":
main()
| # import sys
# input = sys.stdin.readline
# import re
import math
import itertools
def main():
n, k, = input_list()
a = input_list()
if (n-1) % (k-1) == 0:
print(((n-1)//(k-1)))
else:
print(((n-1)//(k-1) + 1))
# 累積和
def get_camulative(l):
return [0] + list(itertools... | 16 | 44 | 235 | 934 | import math
def main():
n, k = input_list()
a = input_list()
a = math.ceil((n - k) / (k - 1))
print((1 + a))
def input_list():
return list(map(int, input().split()))
if __name__ == "__main__":
main()
| # import sys
# input = sys.stdin.readline
# import re
import math
import itertools
def main():
(
n,
k,
) = input_list()
a = input_list()
if (n - 1) % (k - 1) == 0:
print(((n - 1) // (k - 1)))
else:
print(((n - 1) // (k - 1) + 1))
# 累積和
def get_camulative(l):
r... | false | 63.636364 | [
"+# import sys",
"+# input = sys.stdin.readline",
"+# import re",
"+import itertools",
"- n, k = input_list()",
"+ (",
"+ n,",
"+ k,",
"+ ) = input_list()",
"- a = math.ceil((n - k) / (k - 1))",
"- print((1 + a))",
"+ if (n - 1) % (k - 1) == 0:",
"+ pri... | false | 0.054003 | 0.041535 | 1.300169 | [
"s127625175",
"s530828972"
] |
u936985471 | p02863 | python | s012771798 | s641618523 | 247 | 213 | 12,860 | 12,520 | Accepted | Accepted | 13.77 | N,T=list(map(int,input().split()))
d=[None]*N
for i in range(N):
a,b=list(map(int,input().split()))
d[i]=[a,b]
import numpy as np
d=sorted(d,key=lambda x:x[0])
dp=np.zeros(T,dtype=int)
ans=0
for i in range(len(d)):
t=d[i][0]
v=d[i][1]
ans=max(ans,dp.max()+v)
np.maximum(dp[:-t]+v,dp[t:],out=dp... | N,T=list(map(int,input().split()))
import numpy as np
dp=np.zeros(T,dtype=int)
maxval=0
meals=[None]*N
for i in range(N):
a,b=list(map(int,input().split()))
meals[i]=a,b
meals=sorted(meals,key=lambda x:x[0])
for i in range(N):
a,b=meals[i]
if maxval<dp[-1]+b:
maxval=dp[-1]+b
np.maximum(... | 17 | 19 | 328 | 355 | N, T = list(map(int, input().split()))
d = [None] * N
for i in range(N):
a, b = list(map(int, input().split()))
d[i] = [a, b]
import numpy as np
d = sorted(d, key=lambda x: x[0])
dp = np.zeros(T, dtype=int)
ans = 0
for i in range(len(d)):
t = d[i][0]
v = d[i][1]
ans = max(ans, dp.max() + v)
np.... | N, T = list(map(int, input().split()))
import numpy as np
dp = np.zeros(T, dtype=int)
maxval = 0
meals = [None] * N
for i in range(N):
a, b = list(map(int, input().split()))
meals[i] = a, b
meals = sorted(meals, key=lambda x: x[0])
for i in range(N):
a, b = meals[i]
if maxval < dp[-1] + b:
maxv... | false | 10.526316 | [
"-d = [None] * N",
"+import numpy as np",
"+",
"+dp = np.zeros(T, dtype=int)",
"+maxval = 0",
"+meals = [None] * N",
"- d[i] = [a, b]",
"-import numpy as np",
"-",
"-d = sorted(d, key=lambda x: x[0])",
"-dp = np.zeros(T, dtype=int)",
"-ans = 0",
"-for i in range(len(d)):",
"- t = d[i... | false | 0.371362 | 0.224148 | 1.656769 | [
"s012771798",
"s641618523"
] |
u917432951 | p02265 | python | s331434876 | s189878932 | 3,920 | 2,100 | 71,576 | 206,268 | Accepted | Accepted | 46.43 | from _collections import deque
n = int(eval(input()))
data_input = []
dlList = deque()
for i in range(n):
x = input().split()
if x[0] == 'insert':
dlList.appendleft(x[1])
elif x[0] == 'delete':
if x[1] in dlList:
dlList.remove(x[1])
else :
pass
... | import sys
from collections import deque
input_lines = sys.stdin.readlines()
doublyLinkedList = deque()
for x in input_lines[1:]:
oneLine = x.split()
if 'insert' in oneLine[0]:
doublyLinkedList.appendleft((int)(oneLine[1]))
elif 'delete' == oneLine[0]:
remove_value = (int)(one... | 22 | 21 | 477 | 597 | from _collections import deque
n = int(eval(input()))
data_input = []
dlList = deque()
for i in range(n):
x = input().split()
if x[0] == "insert":
dlList.appendleft(x[1])
elif x[0] == "delete":
if x[1] in dlList:
dlList.remove(x[1])
else:
pass
elif x[0] =... | import sys
from collections import deque
input_lines = sys.stdin.readlines()
doublyLinkedList = deque()
for x in input_lines[1:]:
oneLine = x.split()
if "insert" in oneLine[0]:
doublyLinkedList.appendleft((int)(oneLine[1]))
elif "delete" == oneLine[0]:
remove_value = (int)(oneLine[1])
... | false | 4.545455 | [
"-from _collections import deque",
"+import sys",
"+from collections import deque",
"-n = int(eval(input()))",
"-data_input = []",
"-dlList = deque()",
"-for i in range(n):",
"- x = input().split()",
"- if x[0] == \"insert\":",
"- dlList.appendleft(x[1])",
"- elif x[0] == \"delet... | false | 0.084637 | 0.085205 | 0.99333 | [
"s331434876",
"s189878932"
] |
u126232616 | p03503 | python | s771948880 | s673503963 | 289 | 86 | 3,188 | 3,064 | Accepted | Accepted | 70.24 | n = int(eval(input()))
f = [list(map(int,input().split())) for i in range(n)]
p = [list(map(int,input().split())) for i in range(n)]
ans = -10**12
for i in range(1,1024):
#print("i=",i)
temp = 0
for j in range(n): #j = 0,1,2,..,n-1で店番号
fi = f[j]
ci = sum([1 for k in range(10) if (i>... | n = int(eval(input()))
f = [int(input().replace(" ",""),2) for i in range(n)] #数にしてしまう
p = [list(map(int,input().split())) for i in range(n)]
ans = -10**12
for i in range(1,1024):
#print("i=",i)
temp = 0
for j in range(n): #j = 0,1,2,..,n-1で店番号
fi = f[j]
ci = bin(fi&i).count("1") #b... | 14 | 16 | 421 | 457 | n = int(eval(input()))
f = [list(map(int, input().split())) for i in range(n)]
p = [list(map(int, input().split())) for i in range(n)]
ans = -(10**12)
for i in range(1, 1024):
# print("i=",i)
temp = 0
for j in range(n): # j = 0,1,2,..,n-1で店番号
fi = f[j]
ci = sum([1 for k in range(10) if (i >... | n = int(eval(input()))
f = [int(input().replace(" ", ""), 2) for i in range(n)] # 数にしてしまう
p = [list(map(int, input().split())) for i in range(n)]
ans = -(10**12)
for i in range(1, 1024):
# print("i=",i)
temp = 0
for j in range(n): # j = 0,1,2,..,n-1で店番号
fi = f[j]
ci = bin(fi & i).count("1"... | false | 12.5 | [
"-f = [list(map(int, input().split())) for i in range(n)]",
"+f = [int(input().replace(\" \", \"\"), 2) for i in range(n)] # 数にしてしまう",
"- ci = sum([1 for k in range(10) if (i >> k) & 1 == 1 and fi[9 - k] == 1])",
"+ ci = bin(fi & i).count(\"1\") # bin()は2進法表記のstrになる。",
"+ # print(\"ci... | false | 0.042218 | 0.038129 | 1.107234 | [
"s771948880",
"s673503963"
] |
u089230684 | p02779 | python | s444267692 | s748973871 | 291 | 66 | 109,524 | 34,228 | Accepted | Accepted | 77.32 | import math
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = {}
for val in a:
cnt[val] = cnt.get(val, 0) + 1
distinct = True
for val in cnt:
if cnt[val] > 1:
distinct = False
if distinct:
print("YES")
else:
... | n=int(eval(input()))
a=list(input().split())
if len(list(a))==len(set(a)):
print('YES')
else:
print('NO')
| 19 | 7 | 374 | 115 | import math
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = {}
for val in a:
cnt[val] = cnt.get(val, 0) + 1
distinct = True
for val in cnt:
if cnt[val] > 1:
distinct = False
if distinct:
print("YES")
else:
print("... | n = int(eval(input()))
a = list(input().split())
if len(list(a)) == len(set(a)):
print("YES")
else:
print("NO")
| false | 63.157895 | [
"-import math",
"-",
"-",
"-def main():",
"- n = int(eval(input()))",
"- a = list(map(int, input().split()))",
"- cnt = {}",
"- for val in a:",
"- cnt[val] = cnt.get(val, 0) + 1",
"- distinct = True",
"- for val in cnt:",
"- if cnt[val] > 1:",
"- di... | false | 0.03657 | 0.060934 | 0.600164 | [
"s444267692",
"s748973871"
] |
u525065967 | p02684 | python | s075628890 | s873743823 | 220 | 166 | 32,376 | 32,372 | Accepted | Accepted | 24.55 | N,K = list(map(int, input().split()))
A = [*[int(x)-1 for x in input().split()]]
cnt, pre = [0]*N, 0
for _ in range(N*2):
cnt[pre] += 1
pre = A[pre]
one, loops = 0, 0
for c in cnt:
if c == 1: one += 1
elif c > 1: loops += 1
k = max(0, K-one) % loops + min(K, one)
pre = 0
for _ in ran... | N,K = list(map(int, input().split()))
A = [*[int(x)-1 for x in input().split()]]
pre = 0
index = [-1]*N
path = []
for n in range(N):
if index[pre] >= 0:
# print('len(path)',len(path),'pre',pre)
# print('n',n,'index[pre]',index[pre])
# print('index',index)
# print('path',p... | 18 | 26 | 354 | 614 | N, K = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
cnt, pre = [0] * N, 0
for _ in range(N * 2):
cnt[pre] += 1
pre = A[pre]
one, loops = 0, 0
for c in cnt:
if c == 1:
one += 1
elif c > 1:
loops += 1
k = max(0, K - one) % loops + min(K, one)
pre = 0
for _ i... | N, K = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
pre = 0
index = [-1] * N
path = []
for n in range(N):
if index[pre] >= 0:
# print('len(path)',len(path),'pre',pre)
# print('n',n,'index[pre]',index[pre])
# print('index',index)
# print('path',path)
... | false | 30.769231 | [
"-cnt, pre = [0] * N, 0",
"-for _ in range(N * 2):",
"- cnt[pre] += 1",
"+pre = 0",
"+index = [-1] * N",
"+path = []",
"+for n in range(N):",
"+ if index[pre] >= 0:",
"+ # print('len(path)',len(path),'pre',pre)",
"+ # print('n',n,'index[pre]',index[pre])",
"+ # print('... | false | 0.053105 | 0.036927 | 1.4381 | [
"s075628890",
"s873743823"
] |
u546285759 | p00016 | python | s624470418 | s034730654 | 30 | 20 | 7,828 | 5,708 | Accepted | Accepted | 33.33 | import math
x = y = 0
theta = 90
while True:
d, a = list(map(int, input().split(',')))
if d==a==0:
break
x += d * math.cos(theta * math.pi / 180)
y += d * math.sin(theta * math.pi / 180)
theta -= a
print((int(x)))
print((int(y))) | import math
x = y = 0
ang = 90
while True:
d, a = list(map(int, input().split(',')))
if d == a == 0:
break
rad = ang * math.pi / 180
x += d * math.cos(rad)
y += d * math.sin(rad)
ang -= a
print((int(x)))
print((int(y)))
| 12 | 13 | 258 | 254 | import math
x = y = 0
theta = 90
while True:
d, a = list(map(int, input().split(",")))
if d == a == 0:
break
x += d * math.cos(theta * math.pi / 180)
y += d * math.sin(theta * math.pi / 180)
theta -= a
print((int(x)))
print((int(y)))
| import math
x = y = 0
ang = 90
while True:
d, a = list(map(int, input().split(",")))
if d == a == 0:
break
rad = ang * math.pi / 180
x += d * math.cos(rad)
y += d * math.sin(rad)
ang -= a
print((int(x)))
print((int(y)))
| false | 7.692308 | [
"-theta = 90",
"+ang = 90",
"- x += d * math.cos(theta * math.pi / 180)",
"- y += d * math.sin(theta * math.pi / 180)",
"- theta -= a",
"+ rad = ang * math.pi / 180",
"+ x += d * math.cos(rad)",
"+ y += d * math.sin(rad)",
"+ ang -= a"
] | false | 0.040518 | 0.036 | 1.125484 | [
"s624470418",
"s034730654"
] |
u411858517 | p03545 | python | s014908272 | s361619764 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | import itertools
S = eval(input())
opt_list = list(itertools.product([0, 1], repeat=3)) #0:+を入れる, 1:-を入れる
res_opt = ['+', '+', '+']
for opt in opt_list:
tmp = int(S[0])
for i in range(3):
if opt[i] == 0:
tmp += int(S[i + 1])
res_opt[i] = '+'
else:
t... | N = eval(input())
for x in ('+', '-'):
for y in ('+', '-'):
for z in ('+', '-'):
res = int(N[0])
if x == '+':
res += int(N[1])
else:
res -= int(N[1])
if y == '+':
r... | 18 | 29 | 496 | 672 | import itertools
S = eval(input())
opt_list = list(itertools.product([0, 1], repeat=3)) # 0:+を入れる, 1:-を入れる
res_opt = ["+", "+", "+"]
for opt in opt_list:
tmp = int(S[0])
for i in range(3):
if opt[i] == 0:
tmp += int(S[i + 1])
res_opt[i] = "+"
else:
tmp -= in... | N = eval(input())
for x in ("+", "-"):
for y in ("+", "-"):
for z in ("+", "-"):
res = int(N[0])
if x == "+":
res += int(N[1])
else:
res -= int(N[1])
if y == "+":
res += int(N[2])
else:
... | false | 37.931034 | [
"-import itertools",
"-",
"-S = eval(input())",
"-opt_list = list(itertools.product([0, 1], repeat=3)) # 0:+を入れる, 1:-を入れる",
"-res_opt = [\"+\", \"+\", \"+\"]",
"-for opt in opt_list:",
"- tmp = int(S[0])",
"- for i in range(3):",
"- if opt[i] == 0:",
"- tmp += int(S[i + 1]... | false | 0.045459 | 0.044909 | 1.012247 | [
"s014908272",
"s361619764"
] |
u790710233 | p03332 | python | s368570936 | s156732086 | 1,224 | 378 | 50,680 | 43,868 | Accepted | Accepted | 69.12 | MOD = 998244353
n, a, b, k = list(map(int, input().split()))
pair = []
for x in range(n+1):
y, r = divmod(k-a*x, b)
if y < 0:
continue
if r == 0:
pair.append((x, y))
memo = [0]*n
def com(n, r):
X = Y = 1
if n < r:
return 0
if n-r < r:
r = n-... | MOD = 998244353
n, a, b, k = list(map(int, input().split()))
memo = [0]*(n//2+1)
def com(n, r):
if n < r or r < 0:
return 0
if n-r < r:
r = n-r
if r == 0:
memo[r] = 1
return memo[r]
if memo[r] != 0:
return memo[r]
X = Y = 1
for i in range... | 37 | 33 | 666 | 637 | MOD = 998244353
n, a, b, k = list(map(int, input().split()))
pair = []
for x in range(n + 1):
y, r = divmod(k - a * x, b)
if y < 0:
continue
if r == 0:
pair.append((x, y))
memo = [0] * n
def com(n, r):
X = Y = 1
if n < r:
return 0
if n - r < r:
r = n - r
if ... | MOD = 998244353
n, a, b, k = list(map(int, input().split()))
memo = [0] * (n // 2 + 1)
def com(n, r):
if n < r or r < 0:
return 0
if n - r < r:
r = n - r
if r == 0:
memo[r] = 1
return memo[r]
if memo[r] != 0:
return memo[r]
X = Y = 1
for i in range(1, r ... | false | 10.810811 | [
"-pair = []",
"-for x in range(n + 1):",
"- y, r = divmod(k - a * x, b)",
"- if y < 0:",
"- continue",
"- if r == 0:",
"- pair.append((x, y))",
"-memo = [0] * n",
"+memo = [0] * (n // 2 + 1)",
"- X = Y = 1",
"- if n < r:",
"+ if n < r or r < 0:",
"+ X = Y =... | false | 0.200757 | 0.537277 | 0.373656 | [
"s368570936",
"s156732086"
] |
u879870653 | p03041 | python | s188006411 | s536490277 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N,K = list(map(int,input().split()))
S = eval(input())
ans = ""
for i in range(N) :
if i == K-1 :
ans += S[i].lower()
else :
ans += S[i]
print(ans) | N,K = list(map(int,input().split()))
S = eval(input())
print((S[:K-1] + S[K-1].lower() + S[K:]))
| 11 | 4 | 171 | 87 | N, K = list(map(int, input().split()))
S = eval(input())
ans = ""
for i in range(N):
if i == K - 1:
ans += S[i].lower()
else:
ans += S[i]
print(ans)
| N, K = list(map(int, input().split()))
S = eval(input())
print((S[: K - 1] + S[K - 1].lower() + S[K:]))
| false | 63.636364 | [
"-ans = \"\"",
"-for i in range(N):",
"- if i == K - 1:",
"- ans += S[i].lower()",
"- else:",
"- ans += S[i]",
"-print(ans)",
"+print((S[: K - 1] + S[K - 1].lower() + S[K:]))"
] | false | 0.047423 | 0.05019 | 0.944867 | [
"s188006411",
"s536490277"
] |
u839537730 | p03671 | python | s686123139 | s388657911 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | a, b, c = list(map(int, input().split(" ")))
print(("%d"%(a+b+c - max(max(a, b), c)))) | a, b, c = list(map(int, input().split(" ")))
print((min(a+b, b+c, c+a))) | 2 | 2 | 85 | 71 | a, b, c = list(map(int, input().split(" ")))
print(("%d" % (a + b + c - max(max(a, b), c))))
| a, b, c = list(map(int, input().split(" ")))
print((min(a + b, b + c, c + a)))
| false | 0 | [
"-print((\"%d\" % (a + b + c - max(max(a, b), c))))",
"+print((min(a + b, b + c, c + a)))"
] | false | 0.048099 | 0.041068 | 1.17121 | [
"s686123139",
"s388657911"
] |
u699330893 | p02755 | python | s684429950 | s373993134 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | import math
A,B = list(map(int,input().split()))
X1 = math.ceil(A / 0.08)
X1max = (A+1) / 0.08
X2 = math.ceil(B / 0.10)
X2max = (B+1) / 0.10
#print (X1,X1max,X2,X2max)
X = max(X1,X2)
if X2max <= X1 or X1max <= X2:
print((-1))
else:
print(X) | import math
A,B = list(map(int,input().split()))
mark = 0
for i in range (1,1009):
if A == math.floor(i * 0.08) and B == math.floor(i * 0.1):
print(i)
mark = 1
break
if mark == 0:
print((-1))
| 13 | 10 | 253 | 225 | import math
A, B = list(map(int, input().split()))
X1 = math.ceil(A / 0.08)
X1max = (A + 1) / 0.08
X2 = math.ceil(B / 0.10)
X2max = (B + 1) / 0.10
# print (X1,X1max,X2,X2max)
X = max(X1, X2)
if X2max <= X1 or X1max <= X2:
print((-1))
else:
print(X)
| import math
A, B = list(map(int, input().split()))
mark = 0
for i in range(1, 1009):
if A == math.floor(i * 0.08) and B == math.floor(i * 0.1):
print(i)
mark = 1
break
if mark == 0:
print((-1))
| false | 23.076923 | [
"-X1 = math.ceil(A / 0.08)",
"-X1max = (A + 1) / 0.08",
"-X2 = math.ceil(B / 0.10)",
"-X2max = (B + 1) / 0.10",
"-# print (X1,X1max,X2,X2max)",
"-X = max(X1, X2)",
"-if X2max <= X1 or X1max <= X2:",
"+mark = 0",
"+for i in range(1, 1009):",
"+ if A == math.floor(i * 0.08) and B == math.floor(i ... | false | 0.054311 | 0.036649 | 1.481917 | [
"s684429950",
"s373993134"
] |
u049182844 | p03072 | python | s314085453 | s278967193 | 30 | 24 | 9,040 | 8,996 | Accepted | Accepted | 20 | def main():
sea = 1
n = int(eval(input()))
h = list(map(int, input().split()))
mountain = h[0]
for i in range(1, n):
if mountain <= h[i]:
sea += 1
mountain = h[i]
print(sea)
if __name__ == '__main__':
main()
| def main():
see_sea = 1
n = int(eval(input()))
h = list(map(int, input().split()))
mountain = h[0]
for i in range(1, n):
if mountain <= h[i]:
see_sea += 1
mountain = h[i]
print(see_sea)
if __name__ == '__main__':
main()
| 14 | 14 | 277 | 289 | def main():
sea = 1
n = int(eval(input()))
h = list(map(int, input().split()))
mountain = h[0]
for i in range(1, n):
if mountain <= h[i]:
sea += 1
mountain = h[i]
print(sea)
if __name__ == "__main__":
main()
| def main():
see_sea = 1
n = int(eval(input()))
h = list(map(int, input().split()))
mountain = h[0]
for i in range(1, n):
if mountain <= h[i]:
see_sea += 1
mountain = h[i]
print(see_sea)
if __name__ == "__main__":
main()
| false | 0 | [
"- sea = 1",
"+ see_sea = 1",
"- sea += 1",
"+ see_sea += 1",
"- print(sea)",
"+ print(see_sea)"
] | false | 0.067601 | 0.041804 | 1.61708 | [
"s314085453",
"s278967193"
] |
u426764965 | p03796 | python | s132000259 | s881370023 | 231 | 35 | 4,020 | 2,940 | Accepted | Accepted | 84.85 | N = int(eval(input()))
from math import factorial
div = int(1e9 + 7)
ans = factorial(N) % div
print(ans) | n = int(eval(input()))
div = 10**9 + 7
pw = 1
for i in range(1, n+1):
pw = (pw * i) % div
print(pw) | 6 | 6 | 105 | 100 | N = int(eval(input()))
from math import factorial
div = int(1e9 + 7)
ans = factorial(N) % div
print(ans)
| n = int(eval(input()))
div = 10**9 + 7
pw = 1
for i in range(1, n + 1):
pw = (pw * i) % div
print(pw)
| false | 0 | [
"-N = int(eval(input()))",
"-from math import factorial",
"-",
"-div = int(1e9 + 7)",
"-ans = factorial(N) % div",
"-print(ans)",
"+n = int(eval(input()))",
"+div = 10**9 + 7",
"+pw = 1",
"+for i in range(1, n + 1):",
"+ pw = (pw * i) % div",
"+print(pw)"
] | false | 0.431841 | 0.077748 | 5.55436 | [
"s132000259",
"s881370023"
] |
u102461423 | p03885 | python | s824217041 | s943997360 | 1,220 | 1,119 | 228,640 | 227,888 | Accepted | Accepted | 8.28 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 10**9 + 7
N = int(readline())
C = np.array([line.split() for line in readlines()],np.int8)
def rank(A):
if (A==0).all():
return 0
i = np.nonzero(A[:,0])[0]
... | from numpy import *
P=10**9+7
N=int(eval(input()))
C=array([input().split() for _ in range(N)],int8)
def r(A):
if(A==0).all():return 0
i=A[:,0].nonzero()[0]
if len(i) == 0:return r(A[:,1:])
t=A[i[0]].copy();A[i[0]]=A[0];A[0]=t
A[1:]^= A[1:,0][:,None]*A[0][None,:]
return 1+r(A[1:,1:])
r=r(C)
p=on... | 48 | 20 | 1,099 | 639 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 10**9 + 7
N = int(readline())
C = np.array([line.split() for line in readlines()], np.int8)
def rank(A):
if (A == 0).all():
return 0
i = np.nonzero(A[:, 0])[0]
if len(i)... | from numpy import *
P = 10**9 + 7
N = int(eval(input()))
C = array([input().split() for _ in range(N)], int8)
def r(A):
if (A == 0).all():
return 0
i = A[:, 0].nonzero()[0]
if len(i) == 0:
return r(A[:, 1:])
t = A[i[0]].copy()
A[i[0]] = A[0]
A[0] = t
A[1:] ^= A[1:, 0][:, N... | false | 58.333333 | [
"-import sys",
"+from numpy import *",
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-sys.setrecursionlimit(10**7)",
"-import numpy as np",
"-",
"-MOD = 10**9 + 7",
"-N = int(readline())",
"-C = np.array([line.split() for line in readlines()], np.int8)",
"+P = 10**9 + 7"... | false | 2.186267 | 0.182533 | 11.977367 | [
"s824217041",
"s943997360"
] |
u707500405 | p02767 | python | s471072823 | s277373241 | 21 | 18 | 3,064 | 3,060 | Accepted | Accepted | 14.29 | N = int(eval(input()))
X = list(map(int, input().split()))
p_min = min(X)
p_max = max(X)
ans = p_min
cost_min = N * p_max ** 2
for p in range(p_min, p_max + 1):
tmp_cost = sum([(x - p) ** 2 for x in X])
if tmp_cost < cost_min:
ans = p
cost_min = tmp_cost
print(cost_min) | N = int(eval(input()))
X = list(map(int, input().split()))
avg_p = int(sum(X) / N)
cost_l = sum([(x - avg_p)**2 for x in X])
cost_r = sum([(x - avg_p - 1)**2 for x in X])
print((min(cost_l, cost_r))) | 15 | 9 | 302 | 212 | N = int(eval(input()))
X = list(map(int, input().split()))
p_min = min(X)
p_max = max(X)
ans = p_min
cost_min = N * p_max**2
for p in range(p_min, p_max + 1):
tmp_cost = sum([(x - p) ** 2 for x in X])
if tmp_cost < cost_min:
ans = p
cost_min = tmp_cost
print(cost_min)
| N = int(eval(input()))
X = list(map(int, input().split()))
avg_p = int(sum(X) / N)
cost_l = sum([(x - avg_p) ** 2 for x in X])
cost_r = sum([(x - avg_p - 1) ** 2 for x in X])
print((min(cost_l, cost_r)))
| false | 40 | [
"-p_min = min(X)",
"-p_max = max(X)",
"-ans = p_min",
"-cost_min = N * p_max**2",
"-for p in range(p_min, p_max + 1):",
"- tmp_cost = sum([(x - p) ** 2 for x in X])",
"- if tmp_cost < cost_min:",
"- ans = p",
"- cost_min = tmp_cost",
"-print(cost_min)",
"+avg_p = int(sum(X) /... | false | 0.039705 | 0.047904 | 0.828852 | [
"s471072823",
"s277373241"
] |
u105290050 | p03086 | python | s047140282 | s777893944 | 167 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.82 | s=str(eval(input()))
s=s.replace('A', '1').replace('T', '1').replace("C", "1").replace("G", "1")
l=len(s)
d=0
for i in range(l):
for k in range(i, l+1):
if s[i:k].count("1")==len(s[i:k]):
d=max(d, len(s[i:k]))
print(d) | def checks(a):
if a=="C" or a=="T" or a=="G"or a=="A":
return True
else:
return False
s=str(eval(input()))
cnt=0
ans=0
for a in s:
if checks(a):
cnt+=1
ans=max(cnt, ans)
else:
cnt=0
print(ans) | 9 | 15 | 232 | 228 | s = str(eval(input()))
s = s.replace("A", "1").replace("T", "1").replace("C", "1").replace("G", "1")
l = len(s)
d = 0
for i in range(l):
for k in range(i, l + 1):
if s[i:k].count("1") == len(s[i:k]):
d = max(d, len(s[i:k]))
print(d)
| def checks(a):
if a == "C" or a == "T" or a == "G" or a == "A":
return True
else:
return False
s = str(eval(input()))
cnt = 0
ans = 0
for a in s:
if checks(a):
cnt += 1
ans = max(cnt, ans)
else:
cnt = 0
print(ans)
| false | 40 | [
"+def checks(a):",
"+ if a == \"C\" or a == \"T\" or a == \"G\" or a == \"A\":",
"+ return True",
"+ else:",
"+ return False",
"+",
"+",
"-s = s.replace(\"A\", \"1\").replace(\"T\", \"1\").replace(\"C\", \"1\").replace(\"G\", \"1\")",
"-l = len(s)",
"-d = 0",
"-for i in range... | false | 0.132349 | 0.044038 | 3.005349 | [
"s047140282",
"s777893944"
] |
u753803401 | p02937 | python | s596100301 | s964885815 | 275 | 249 | 45,808 | 46,320 | Accepted | Accepted | 9.45 | def slove():
import sys
import collections
import bisect
input = sys.stdin.readline
s = str(input().rstrip('\n'))
t = str(input().rstrip('\n'))
d = collections.defaultdict(list)
for i in range(len(s)):
d[s[i]] += [i]
loop = 0
pos = 0
for i in range(len(t... | import sys
import bisect
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
s = str(readline().rstrip().decode('utf-8'))
d = collections.defaultdict(list)
for i in range(len(s)):
d[s[i]] += [i]
loop = 0
pos = 0
t = str(readline(... | 28 | 31 | 663 | 768 | def slove():
import sys
import collections
import bisect
input = sys.stdin.readline
s = str(input().rstrip("\n"))
t = str(input().rstrip("\n"))
d = collections.defaultdict(list)
for i in range(len(s)):
d[s[i]] += [i]
loop = 0
pos = 0
for i in range(len(t)):
i... | import sys
import bisect
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
s = str(readline().rstrip().decode("utf-8"))
d = collections.defaultdict(list)
for i in range(len(s)):
d[s[i]] += [i]
loop = 0
pos = 0
t = str(readline().rstrip().decod... | false | 9.677419 | [
"-def slove():",
"- import sys",
"- import collections",
"- import bisect",
"+import sys",
"+import bisect",
"+import collections",
"- input = sys.stdin.readline",
"- s = str(input().rstrip(\"\\n\"))",
"- t = str(input().rstrip(\"\\n\"))",
"+",
"+def solve():",
"+ readli... | false | 0.039202 | 0.038777 | 1.010945 | [
"s596100301",
"s964885815"
] |
u814781830 | p03148 | python | s958637164 | s496681259 | 634 | 525 | 42,836 | 34,288 | Accepted | Accepted | 17.19 | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
TD = [list(map(int, input().split())) for _ in range(N)]
TD.sort(key=lambda x:x[1], reverse=True)
muptiple = set()
hp = []
for t, d in TD:
flg = 0
if t not in muptiple:
muptiple.add(t)
flg = 1
heappush(hp, ... | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
TD = [list(map(int, input().split())) for _ in range(N)]
TD.sort(key=lambda x:x[1], reverse=True)
muptiple = set()
for i in range(len(TD)):
flg = 0
if TD[i][0] not in muptiple:
muptiple.add(TD[i][0])
flg = 1
... | 39 | 36 | 788 | 772 | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
TD = [list(map(int, input().split())) for _ in range(N)]
TD.sort(key=lambda x: x[1], reverse=True)
muptiple = set()
hp = []
for t, d in TD:
flg = 0
if t not in muptiple:
muptiple.add(t)
flg = 1
heappush(hp, (d * -1, ... | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
TD = [list(map(int, input().split())) for _ in range(N)]
TD.sort(key=lambda x: x[1], reverse=True)
muptiple = set()
for i in range(len(TD)):
flg = 0
if TD[i][0] not in muptiple:
muptiple.add(TD[i][0])
flg = 1
TD[i][0... | false | 7.692308 | [
"-hp = []",
"-for t, d in TD:",
"+for i in range(len(TD)):",
"- if t not in muptiple:",
"- muptiple.add(t)",
"+ if TD[i][0] not in muptiple:",
"+ muptiple.add(TD[i][0])",
"- heappush(hp, (d * -1, flg))",
"+ TD[i][0] = flg",
"+TD.reverse()",
"- v = heappop(hp)",
"- ... | false | 0.043221 | 0.040134 | 1.076916 | [
"s958637164",
"s496681259"
] |
u761529120 | p03161 | python | s292421312 | s892880784 | 387 | 232 | 55,008 | 85,612 | Accepted | Accepted | 40.05 | def main():
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [float('inf')] * (N + K)
dp[0] = 0
for i in range(N):
for k in range(1,K+1):
if i + k <= N - 1:
dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k] - H[i]))
else... | def main():
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [float('inf')] * (N + 5)
dp[0] = 0
for i in range(1,N):
for k in range(1,K+1):
if i - k >= 0:
dp[i] = min(dp[i], dp[i-k] + abs(H[i] - H[i-k]))
print((dp[N-1]... | 18 | 14 | 406 | 356 | def main():
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [float("inf")] * (N + K)
dp[0] = 0
for i in range(N):
for k in range(1, K + 1):
if i + k <= N - 1:
dp[i + k] = min(dp[i + k], dp[i] + abs(H[i + k] - H[i]))
else... | def main():
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [float("inf")] * (N + 5)
dp[0] = 0
for i in range(1, N):
for k in range(1, K + 1):
if i - k >= 0:
dp[i] = min(dp[i], dp[i - k] + abs(H[i] - H[i - k]))
print((dp[N - 1])... | false | 22.222222 | [
"- dp = [float(\"inf\")] * (N + K)",
"+ dp = [float(\"inf\")] * (N + 5)",
"- for i in range(N):",
"+ for i in range(1, N):",
"- if i + k <= N - 1:",
"- dp[i + k] = min(dp[i + k], dp[i] + abs(H[i + k] - H[i]))",
"- else:",
"- break",
"+ ... | false | 0.041209 | 0.041539 | 0.992038 | [
"s292421312",
"s892880784"
] |
u562935282 | p03959 | python | s967714625 | s026074243 | 329 | 181 | 86,372 | 19,012 | Accepted | Accepted | 44.98 | mod = 10 ** 9 + 7
n = int(eval(input()))
t = tuple(map(int, input().split()))
a = tuple(map(int, input().split()))
ans = 1
for i in range(1, n - 1):
x = t[i] if t[i] > t[i - 1] else 1
y = a[i] if a[i] > a[i + 1] else 1
ans = ans * max(0, min(t[i], a[i]) - max(x, y) + 1) % mod
print((ans if a[... | def main():
mod = 10 ** 9 + 7
n = int(eval(input()))
*t, = list(map(int, input().split()))
*a, = list(map(int, input().split()))
if t[-1] != a[0]:
# 高橋と青木の見た山の高さの最大値が一致しない
print((0))
return
ret = 1
# [lo,hi]
for i in range(n):
if i == 0... | 13 | 59 | 333 | 1,332 | mod = 10**9 + 7
n = int(eval(input()))
t = tuple(map(int, input().split()))
a = tuple(map(int, input().split()))
ans = 1
for i in range(1, n - 1):
x = t[i] if t[i] > t[i - 1] else 1
y = a[i] if a[i] > a[i + 1] else 1
ans = ans * max(0, min(t[i], a[i]) - max(x, y) + 1) % mod
print((ans if a[0] == t[-1] else ... | def main():
mod = 10**9 + 7
n = int(eval(input()))
(*t,) = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
if t[-1] != a[0]:
# 高橋と青木の見た山の高さの最大値が一致しない
print((0))
return
ret = 1
# [lo,hi]
for i in range(n):
if i == 0:
lo =... | false | 77.966102 | [
"-mod = 10**9 + 7",
"-n = int(eval(input()))",
"-t = tuple(map(int, input().split()))",
"-a = tuple(map(int, input().split()))",
"-ans = 1",
"-for i in range(1, n - 1):",
"- x = t[i] if t[i] > t[i - 1] else 1",
"- y = a[i] if a[i] > a[i + 1] else 1",
"- ans = ans * max(0, min(t[i], a[i]) - ... | false | 0.069516 | 0.032652 | 2.129016 | [
"s967714625",
"s026074243"
] |
u977661421 | p03449 | python | s735525960 | s111894910 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | # -*- coding: utf-8 -*-
n = int(eval(input()))
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
"""
ans = 0
tmp = 0
for i in range(n):
tmp = sum(a1[0:i+1]) + sum(a2[i:n])
#print(sum(a1[0:i+1]))
#print(sum(a2[i:n]))
if ans < tmp:
ans = tmp
print(ans)
"""... | # -*- coding: utf-8 -*-
n = int(eval(input()))
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
ans = 0
for i in range(n):
tmp = sum(a1[:i+1]) + sum(a2[i:])
if tmp > ans:
ans = tmp
print(ans)
| 26 | 11 | 523 | 242 | # -*- coding: utf-8 -*-
n = int(eval(input()))
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
"""
ans = 0
tmp = 0
for i in range(n):
tmp = sum(a1[0:i+1]) + sum(a2[i:n])
#print(sum(a1[0:i+1]))
#print(sum(a2[i:n]))
if ans < tmp:
ans = tmp
print(ans)
"""
ans = 0
for i... | # -*- coding: utf-8 -*-
n = int(eval(input()))
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
ans = 0
for i in range(n):
tmp = sum(a1[: i + 1]) + sum(a2[i:])
if tmp > ans:
ans = tmp
print(ans)
| false | 57.692308 | [
"-\"\"\"",
"-tmp = 0",
"- tmp = sum(a1[0:i+1]) + sum(a2[i:n])",
"- #print(sum(a1[0:i+1]))",
"- #print(sum(a2[i:n]))",
"- if ans < tmp:",
"+ tmp = sum(a1[: i + 1]) + sum(a2[i:])",
"+ if tmp > ans:",
"-\"\"\"",
"-ans = 0",
"-for i in range(n):",
"- tmp = 0",
"- for j in... | false | 0.080708 | 0.076857 | 1.050107 | [
"s735525960",
"s111894910"
] |
u655663334 | p03013 | python | s329858247 | s186464510 | 633 | 503 | 463,476 | 15,836 | Accepted | Accepted | 20.54 | N, M = list(map(int, input().split()))
brk_stair = [1] * (N + 1)
dp = [0] * (N + 1)
for _ in range(M):
brk_stair[int(eval(input()))] = 0
#print(brk_stair)
dp[0] = 1
dp[1] = 1 * brk_stair[1]
for i in range(2, N + 1):
dp[i] = (dp[i - 1] + dp[i-2]) * brk_stair[i]
print((dp[-1] % 1000000007))
| import numpy as np
N, M = list(map(int, input().split()))
brk_stair = np.ones(N+1, dtype = int)
dp = np.zeros(N+1, dtype= int)
for _ in range(M):
brk_stair[int(eval(input()))] = 0
#print(brk_stair)
dp[0] = 1
dp[1] = 1 * brk_stair[1]
for i in range(2, N + 1):
dp[i] = (dp[i - 1] + dp[i-2]) *... | 17 | 22 | 312 | 435 | N, M = list(map(int, input().split()))
brk_stair = [1] * (N + 1)
dp = [0] * (N + 1)
for _ in range(M):
brk_stair[int(eval(input()))] = 0
# print(brk_stair)
dp[0] = 1
dp[1] = 1 * brk_stair[1]
for i in range(2, N + 1):
dp[i] = (dp[i - 1] + dp[i - 2]) * brk_stair[i]
print((dp[-1] % 1000000007))
| import numpy as np
N, M = list(map(int, input().split()))
brk_stair = np.ones(N + 1, dtype=int)
dp = np.zeros(N + 1, dtype=int)
for _ in range(M):
brk_stair[int(eval(input()))] = 0
# print(brk_stair)
dp[0] = 1
dp[1] = 1 * brk_stair[1]
for i in range(2, N + 1):
dp[i] = (dp[i - 1] + dp[i - 2]) * brk_stair[i]
... | false | 22.727273 | [
"+import numpy as np",
"+",
"-brk_stair = [1] * (N + 1)",
"-dp = [0] * (N + 1)",
"+brk_stair = np.ones(N + 1, dtype=int)",
"+dp = np.zeros(N + 1, dtype=int)",
"+ if dp[i] > 1000000007:",
"+ dp[i] = dp[i] % 1000000007",
"+# print(dp)"
] | false | 0.036646 | 0.261623 | 0.140071 | [
"s329858247",
"s186464510"
] |
u533039576 | p02598 | python | s479478830 | s566583934 | 690 | 531 | 30,944 | 31,048 | Accepted | Accepted | 23.04 | from heapq import heappush, heappop, heapify
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(x):
# 最長の丸太をx以下にできるか
# 任意の丸太をx以下にできるか
cnt = 0
for ai in a:
if ai > x:
if ai % x == 0:
cnt += ai // x - 1
else... | from heapq import heappush, heappop, heapify
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(x):
# 最長の丸太をx以下にできるか
# 任意の丸太をx以下にできるか
cnt = sum([(ai - 1) // x for ai in a])
return cnt <= k
lb = 0 # False
ub = max(a) # True
while ub - lb > 1:
m... | 31 | 24 | 597 | 444 | from heapq import heappush, heappop, heapify
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(x):
# 最長の丸太をx以下にできるか
# 任意の丸太をx以下にできるか
cnt = 0
for ai in a:
if ai > x:
if ai % x == 0:
cnt += ai // x - 1
else:
... | from heapq import heappush, heappop, heapify
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(x):
# 最長の丸太をx以下にできるか
# 任意の丸太をx以下にできるか
cnt = sum([(ai - 1) // x for ai in a])
return cnt <= k
lb = 0 # False
ub = max(a) # True
while ub - lb > 1:
mid = (ub + lb) /... | false | 22.580645 | [
"- cnt = 0",
"- for ai in a:",
"- if ai > x:",
"- if ai % x == 0:",
"- cnt += ai // x - 1",
"- else:",
"- cnt += ai // x",
"- # print('check', x, cnt)",
"+ cnt = sum([(ai - 1) // x for ai in a])"
] | false | 0.101184 | 0.08464 | 1.195456 | [
"s479478830",
"s566583934"
] |
u648881683 | p03252 | python | s350876725 | s497285568 | 114 | 101 | 24,184 | 10,128 | Accepted | Accepted | 11.4 | import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(eval(input()))
def F(): return float(eval(input()))
def SS(): return eval(input())
def LI(): return [int(x) for x in input().spl... | import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(eval(input()))
def F(): return float(eval(input()))
def SS(): return eval(input())
def LI(): return [int(x) for x in input().spl... | 37 | 45 | 982 | 1,155 | import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float("inf")
def I():
return int(eval(input()))
def F():
return float(eval(input()))
def SS():
return eval(input())
def LI():
return [int(x) for... | import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float("inf")
def I():
return int(eval(input()))
def F():
return float(eval(input()))
def SS():
return eval(input())
def LI():
return [int(x) for... | false | 17.777778 | [
"- S_i = [[] for _ in range(26)]",
"- T_i = [[] for _ in range(26)]",
"+ R0 = [-1] * 26",
"+ R1 = [-1] * 26",
"+ is_ok = True",
"- S_i[ord(S[i]) - ord(\"a\")].append(i)",
"- T_i[ord(T[i]) - ord(\"a\")].append(i)",
"- S_set = set()",
"- T_set = set()",
"- for i... | false | 0.035789 | 0.081626 | 0.438448 | [
"s350876725",
"s497285568"
] |
u813098295 | p03475 | python | s340892230 | s954299439 | 88 | 79 | 2,820 | 2,692 | Accepted | Accepted | 10.23 | N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N-1)]
for i in range(N-1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i+1, N-1):
s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]
if t < ans:
n = (ans - t) / u if ((ans - t) % u) == 0 else (ans - t) / u + 1
... | N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N-1)]
for i in range(N):
ans = 0
for j in range(i, N-1):
C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
if ans < S:
ans = S
elif ans % F == 0:
pass
else:
ans = (ans ... | 16 | 16 | 418 | 370 | N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N - 1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i + 1, N - 1):
s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]
if t < ans:
n = (ans - t) / u if ((ans - t) % u) == 0 else (ans - t) / u + 1
... | N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N):
ans = 0
for j in range(i, N - 1):
C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
if ans < S:
ans = S
elif ans % F == 0:
pass
else:
ans = (ans / F + 1) ... | false | 0 | [
"-for i in range(N - 1):",
"- ans = CSF[i][0] + CSF[i][1]",
"- for j in range(i + 1, N - 1):",
"- s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]",
"- if t < ans:",
"- n = (ans - t) / u if ((ans - t) % u) == 0 else (ans - t) / u + 1",
"- ans = s + t + u * n",
"+for ... | false | 0.036438 | 0.035162 | 1.036295 | [
"s340892230",
"s954299439"
] |
u111365362 | p03108 | python | s039001391 | s636171595 | 892 | 710 | 34,284 | 34,172 | Accepted | Accepted | 20.4 | n,m = list(map(int,input().split()))
ab = []
for _ in range(m):
ab.append(list([int(x)-1 for x in input().split()]))
ab.reverse()
pre = [-1 for _ in range(n)]
num = [ 1 for _ in range(n)]
ans = n * (n-1) // 2
out = []
for i in range(m):
out.append(ans)
x,y = ab[i]
X = []
while pre[x] != -1:
... | n,m = list(map(int,input().split()))
ab = []
for _ in range(m):
ab.append(list([int(x)-1 for x in input().split()]))
ab.reverse()
pre = [i for i in range(n)]
num = [1 for _ in range(n)]
ans = n * (n-1) // 2
out = []
for i in range(m):
out.append(ans)
x,y = ab[i]
X = []
while pre[x] != x:
X.a... | 31 | 37 | 605 | 720 | n, m = list(map(int, input().split()))
ab = []
for _ in range(m):
ab.append(list([int(x) - 1 for x in input().split()]))
ab.reverse()
pre = [-1 for _ in range(n)]
num = [1 for _ in range(n)]
ans = n * (n - 1) // 2
out = []
for i in range(m):
out.append(ans)
x, y = ab[i]
X = []
while pre[x] != -1:
... | n, m = list(map(int, input().split()))
ab = []
for _ in range(m):
ab.append(list([int(x) - 1 for x in input().split()]))
ab.reverse()
pre = [i for i in range(n)]
num = [1 for _ in range(n)]
ans = n * (n - 1) // 2
out = []
for i in range(m):
out.append(ans)
x, y = ab[i]
X = []
while pre[x] != x:
... | false | 16.216216 | [
"-pre = [-1 for _ in range(n)]",
"+pre = [i for i in range(n)]",
"- while pre[x] != -1:",
"+ while pre[x] != x:",
"- while pre[y] != -1:",
"+ while pre[y] != y:",
"- if x > y:",
"+ if num[x] >= num[y]:",
"+ win = x",
"+ win = y",
"+ for xx i... | false | 0.116236 | 0.037773 | 3.077196 | [
"s039001391",
"s636171595"
] |
u102278909 | p03103 | python | s548879018 | s794416433 | 298 | 272 | 28,940 | 28,940 | Accepted | Accepted | 8.72 | # coding: utf-8
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x : x[0])
k = 0
ans = 0
while True:
if M > AB[k][1]:
M -= AB[k][1]
ans += AB[k][0] * AB[k][1]
else:
... | # coding: utf-8
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x : x[0])
ans = 0
for k in AB:
if M > k[1]:
M -= k[1]
ans += k[0] * k[1]
else:
ans += k[0] * M
... | 24 | 21 | 386 | 342 | # coding: utf-8
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x: x[0])
k = 0
ans = 0
while True:
if M > AB[k][1]:
M -= AB[k][1]
ans += AB[k][0] * AB[k][1]
else:
ans += AB[k][0] * ... | # coding: utf-8
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x: x[0])
ans = 0
for k in AB:
if M > k[1]:
M -= k[1]
ans += k[0] * k[1]
else:
ans += k[0] * M
break
print(ans... | false | 12.5 | [
"-k = 0",
"-while True:",
"- if M > AB[k][1]:",
"- M -= AB[k][1]",
"- ans += AB[k][0] * AB[k][1]",
"+for k in AB:",
"+ if M > k[1]:",
"+ M -= k[1]",
"+ ans += k[0] * k[1]",
"- ans += AB[k][0] * M",
"+ ans += k[0] * M",
"- k += 1"
] | false | 0.037625 | 0.081837 | 0.459764 | [
"s548879018",
"s794416433"
] |
u268554510 | p02728 | python | s783782174 | s021922272 | 2,838 | 2,294 | 229,268 | 227,548 | Accepted | Accepted | 19.17 | from collections import deque
N = int(eval(input()))
ab = [list(map(int,input().split())) for _ in range(N-1)]
mod = 10**9+7
fact = [1]*(N+1)
fact_inv = [1]*(N+1)
for i in range(1,N+1):
fact[i] = (fact[i-1]*i)%mod
fact_inv[-1] = pow(fact[-1], mod-2, mod)
for i in range(N,0,-1):
fact_inv[i-1] = fact_in... | def main():
from collections import deque
N = int(eval(input()))
ab = [list(map(int,input().split())) for _ in range(N-1)]
mod = 10**9+7
fact = [1]*(N+1)
fact_inv = [1]*(N+1)
for i in range(1,N+1):
fact[i] = (fact[i-1]*i)%mod
fact_inv[-1] = pow(fact[-1], mod-2, mod)
for i in range(N,0,... | 59 | 62 | 1,397 | 1,516 | from collections import deque
N = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
mod = 10**9 + 7
fact = [1] * (N + 1)
fact_inv = [1] * (N + 1)
for i in range(1, N + 1):
fact[i] = (fact[i - 1] * i) % mod
fact_inv[-1] = pow(fact[-1], mod - 2, mod)
for i in range(N, 0, -1):
fact_i... | def main():
from collections import deque
N = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
mod = 10**9 + 7
fact = [1] * (N + 1)
fact_inv = [1] * (N + 1)
for i in range(1, N + 1):
fact[i] = (fact[i - 1] * i) % mod
fact_inv[-1] = pow(fact[-1], mo... | false | 4.83871 | [
"-from collections import deque",
"+def main():",
"+ from collections import deque",
"-N = int(eval(input()))",
"-ab = [list(map(int, input().split())) for _ in range(N - 1)]",
"-mod = 10**9 + 7",
"-fact = [1] * (N + 1)",
"-fact_inv = [1] * (N + 1)",
"-for i in range(1, N + 1):",
"- fact[i] ... | false | 0.044335 | 0.089407 | 0.495878 | [
"s783782174",
"s021922272"
] |
u562935282 | p03037 | python | s527492720 | s804425999 | 308 | 136 | 10,996 | 3,060 | Accepted | Accepted | 55.84 | n, m = list(map(int, input().split()))
l, r = [], []
for _ in range(m):
ll, rr = list(map(int, input().split()))
l.append(ll)
r.append(rr)
print((max(0, min(r) - max(l) + 1)))
| def main():
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
L, R = 1, N
for _ in range(M):
left, right = list(map(int, input().split()))
L = max(L, left)
R = min(R, right)
ans = max(0, R - L + 1)
print(ans)
if __name__... | 9 | 27 | 184 | 479 | n, m = list(map(int, input().split()))
l, r = [], []
for _ in range(m):
ll, rr = list(map(int, input().split()))
l.append(ll)
r.append(rr)
print((max(0, min(r) - max(l) + 1)))
| def main():
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
L, R = 1, N
for _ in range(M):
left, right = list(map(int, input().split()))
L = max(L, left)
R = min(R, right)
ans = max(0, R - L + 1)
print(ans)
if __name__ == "__main__":
... | false | 66.666667 | [
"-n, m = list(map(int, input().split()))",
"-l, r = [], []",
"-for _ in range(m):",
"- ll, rr = list(map(int, input().split()))",
"- l.append(ll)",
"- r.append(rr)",
"-print((max(0, min(r) - max(l) + 1)))",
"+def main():",
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"+ ... | false | 0.042413 | 0.037918 | 1.118529 | [
"s527492720",
"s804425999"
] |
u539692012 | p02546 | python | s435645638 | s282779849 | 86 | 29 | 61,588 | 9,088 | Accepted | Accepted | 66.28 | s = eval(input())
a = s + ('es' if s[-1] == 's' else 's')
print(a) | s=eval(input())
print((s+'es'[s[-1]!='s':])) | 3 | 2 | 62 | 37 | s = eval(input())
a = s + ("es" if s[-1] == "s" else "s")
print(a)
| s = eval(input())
print((s + "es"[s[-1] != "s" :]))
| false | 33.333333 | [
"-a = s + (\"es\" if s[-1] == \"s\" else \"s\")",
"-print(a)",
"+print((s + \"es\"[s[-1] != \"s\" :]))"
] | false | 0.084581 | 0.08947 | 0.945365 | [
"s435645638",
"s282779849"
] |
u070201429 | p02573 | python | s107526096 | s714197748 | 305 | 272 | 87,164 | 82,448 | Accepted | Accepted | 10.82 | # 参考URL https://note.nkmk.me/python-union-find/
class UnionFind():
# parents
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# find(x)
# 要素xが属するグループの根を返す
def find(self, x):
if self.parents[x... | # 参考URL https://note.nkmk.me/python-union-find/
class UnionFind():
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 要素xが属するグループの根を返す
def find(self, x):
if self.parents[x] < 0:
return x
... | 89 | 57 | 2,104 | 1,269 | # 参考URL https://note.nkmk.me/python-union-find/
class UnionFind:
# parents
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# find(x)
# 要素xが属するグループの根を返す
def find(self, x):
if self.parents[x] < 0:
... | # 参考URL https://note.nkmk.me/python-union-find/
class UnionFind:
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 要素xが属するグループの根を返す
def find(self, x):
if self.parents[x] < 0:
return x
else:
... | false | 35.955056 | [
"- # parents",
"- # find(x)",
"- # union(x, y)",
"- # size(x)",
"- # same(x, y)",
"- # 要素x, yが同じグループに属するかどうかを返す",
"- def same(self, x, y):",
"- return self.find(x) == self.find(y)",
"-",
"- # members(x)",
"- # 要素xが属するグループに属する要素をリストで返す",
"- def members(self,... | false | 0.086336 | 0.072354 | 1.193242 | [
"s107526096",
"s714197748"
] |
u497952650 | p03997 | python | s070814051 | s867108177 | 20 | 17 | 9,148 | 2,940 | Accepted | Accepted | 15 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
print(((a+b)*c//2)) | a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
print(((a+b)*h//2)) | 5 | 5 | 73 | 73 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
print(((a + b) * c // 2))
| a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
print(((a + b) * h // 2))
| false | 0 | [
"-c = int(eval(input()))",
"-print(((a + b) * c // 2))",
"+h = int(eval(input()))",
"+print(((a + b) * h // 2))"
] | false | 0.045781 | 0.056548 | 0.809585 | [
"s070814051",
"s867108177"
] |
u370331385 | p03854 | python | s532517852 | s611739791 | 56 | 18 | 3,956 | 3,188 | Accepted | Accepted | 67.86 | S = list(eval(input()))
N = len(S)
for i in range(10):
S.append('')
judge = 1
s1,s2,prev_s1 = '','',''
i = 0
while(1):
s1 = S[i]+S[i+1]+S[i+2]+S[i+3]+S[i+4]
s2 = S[i]+S[i+1]
s2_ = list(s2)
if(s1 == ''):
break
if((s1 == 'erase')or(s1 == 'dream')):
i += 5
elif(s2 == 'er'):
if(prev_s1 ==... | s = eval(input())
words_r = ['eraser', 'erase', 'dreamer', 'dream']
for word_r in words_r:
s = s.replace(word_r, '')
#コードの意味:
#s.replace(p,q) :文字列sにpという文字があればそれを先頭から順にqに置換していく
#sはwords_rに含まれる文字列を''に置換した文字列になる
#->条件に合うならsは最終的に''に,そうでないならそれ以外になる
if (len(s) > 0):
print('NO')
else:
pr... | 38 | 12 | 576 | 324 | S = list(eval(input()))
N = len(S)
for i in range(10):
S.append("")
judge = 1
s1, s2, prev_s1 = "", "", ""
i = 0
while 1:
s1 = S[i] + S[i + 1] + S[i + 2] + S[i + 3] + S[i + 4]
s2 = S[i] + S[i + 1]
s2_ = list(s2)
if s1 == "":
break
if (s1 == "erase") or (s1 == "dream"):
i += 5
... | s = eval(input())
words_r = ["eraser", "erase", "dreamer", "dream"]
for word_r in words_r:
s = s.replace(word_r, "")
# コードの意味:
# s.replace(p,q) :文字列sにpという文字があればそれを先頭から順にqに置換していく
# sはwords_rに含まれる文字列を''に置換した文字列になる
# ->条件に合うならsは最終的に''に,そうでないならそれ以外になる
if len(s) > 0:
print("NO")
else:
print("YES"... | false | 68.421053 | [
"-S = list(eval(input()))",
"-N = len(S)",
"-for i in range(10):",
"- S.append(\"\")",
"-judge = 1",
"-s1, s2, prev_s1 = \"\", \"\", \"\"",
"-i = 0",
"-while 1:",
"- s1 = S[i] + S[i + 1] + S[i + 2] + S[i + 3] + S[i + 4]",
"- s2 = S[i] + S[i + 1]",
"- s2_ = list(s2)",
"- if s1 ==... | false | 0.111989 | 0.108682 | 1.030434 | [
"s532517852",
"s611739791"
] |
u814986259 | p03209 | python | s480658189 | s955034658 | 20 | 18 | 3,188 | 3,188 | Accepted | Accepted | 10 | N, X = list(map(int, input().split()))
if X <= N:
print((0))
exit(0)
p = [0]*(N+1)
p[0] = 1
for i in range(1, N+1):
p[i] = p[i-1]*2 + 3
def solve(N, X):
ret = 0
if X == p[N]:
return((p[N]+1) // 2)
elif X <= N:
return(0)
else:
if X >= (p[N] + 1) // 2... | N, X = list(map(int, input().split()))
L = [0]*(N+1)
L[0] = 1
for i in range(N):
L[i+1] = L[i]*2 + 3
P = [0]*(N+1)
P[0] = 1
for i in range(N):
P[i+1] = P[i]*2 + 1
def solve(n, x):
#print(n, x)
if x == L[n]:
return(P[n])
elif x <= n:
return(0)
else:
... | 25 | 32 | 467 | 572 | N, X = list(map(int, input().split()))
if X <= N:
print((0))
exit(0)
p = [0] * (N + 1)
p[0] = 1
for i in range(1, N + 1):
p[i] = p[i - 1] * 2 + 3
def solve(N, X):
ret = 0
if X == p[N]:
return (p[N] + 1) // 2
elif X <= N:
return 0
else:
if X >= (p[N] + 1) // 2:
... | N, X = list(map(int, input().split()))
L = [0] * (N + 1)
L[0] = 1
for i in range(N):
L[i + 1] = L[i] * 2 + 3
P = [0] * (N + 1)
P[0] = 1
for i in range(N):
P[i + 1] = P[i] * 2 + 1
def solve(n, x):
# print(n, x)
if x == L[n]:
return P[n]
elif x <= n:
return 0
else:
ret = ... | false | 21.875 | [
"-if X <= N:",
"- print((0))",
"- exit(0)",
"-p = [0] * (N + 1)",
"-p[0] = 1",
"-for i in range(1, N + 1):",
"- p[i] = p[i - 1] * 2 + 3",
"+L = [0] * (N + 1)",
"+L[0] = 1",
"+for i in range(N):",
"+ L[i + 1] = L[i] * 2 + 3",
"+P = [0] * (N + 1)",
"+P[0] = 1",
"+for i in range(N... | false | 0.037951 | 0.03632 | 1.044906 | [
"s480658189",
"s955034658"
] |
u677121387 | p03164 | python | s803575197 | s332642847 | 1,198 | 1,015 | 373,704 | 311,448 | Accepted | Accepted | 15.28 | n,W = list(map(int,input().split()))
w = [0]*(n+1)
v = [0]*(n+1)
for i in range(1,n+1): w[i],v[i] = list(map(int,input().split()))
mv = n*max(v)
dp = [[float("INF")]*(mv+1) for _ in range(n+1)]
for i in range(n): dp[i][0] = 0
for i in range(1,n+1):
for s in range(1,mv+1):
if s - v[i] < 0: dp[i][s] ... | n,W = list(map(int,input().split()))
w = [0]*n
v = [0]*n
for i in range(n): w[i],v[i] = list(map(int,input().split()))
mv = n*max(v)
dp = [[float("INF")]*(mv+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
for s in range(mv+1):
if s - v[i] < 0: dp[i+1][s] = dp[i][s]
else: dp[i+1][s... | 15 | 15 | 463 | 424 | n, W = list(map(int, input().split()))
w = [0] * (n + 1)
v = [0] * (n + 1)
for i in range(1, n + 1):
w[i], v[i] = list(map(int, input().split()))
mv = n * max(v)
dp = [[float("INF")] * (mv + 1) for _ in range(n + 1)]
for i in range(n):
dp[i][0] = 0
for i in range(1, n + 1):
for s in range(1, mv + 1):
... | n, W = list(map(int, input().split()))
w = [0] * n
v = [0] * n
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
mv = n * max(v)
dp = [[float("INF")] * (mv + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for s in range(mv + 1):
if s - v[i] < 0:
dp[i + 1][s] = dp[i][... | false | 0 | [
"-w = [0] * (n + 1)",
"-v = [0] * (n + 1)",
"-for i in range(1, n + 1):",
"+w = [0] * n",
"+v = [0] * n",
"+for i in range(n):",
"+dp[0][0] = 0",
"- dp[i][0] = 0",
"-for i in range(1, n + 1):",
"- for s in range(1, mv + 1):",
"+ for s in range(mv + 1):",
"- dp[i][s] = dp[i ... | false | 0.107639 | 0.032995 | 3.26225 | [
"s803575197",
"s332642847"
] |
u761320129 | p03732 | python | s832418180 | s725314456 | 709 | 92 | 3,588 | 4,132 | Accepted | Accepted | 87.02 | import sys
N,W = list(map(int, input().split()))
src = []
wmax = vmax = 0
for i in range(N):
w,v = list(map(int, input().split()))
src.append((w,v))
wmax += w
vmax += v
w1 = src[0][0]
if w1 > W:
print((0))
sys.exit()
if wmax <= W:
print(vmax)
sys.exit()
wend = 3*N+1
dp = [[0 for w i... | from collections import defaultdict
from copy import copy
N,W = list(map(int,input().split()))
src = [tuple(map(int,input().split())) for i in range(N)]
dp = defaultdict(lambda: 0)
dp[0] = 0
for w,v in src:
dp2 = copy(dp)
for pw,pv in list(dp.items()):
if pw+w > W: continue
defv = dp... | 36 | 15 | 705 | 411 | import sys
N, W = list(map(int, input().split()))
src = []
wmax = vmax = 0
for i in range(N):
w, v = list(map(int, input().split()))
src.append((w, v))
wmax += w
vmax += v
w1 = src[0][0]
if w1 > W:
print((0))
sys.exit()
if wmax <= W:
print(vmax)
sys.exit()
wend = 3 * N + 1
dp = [[0 for ... | from collections import defaultdict
from copy import copy
N, W = list(map(int, input().split()))
src = [tuple(map(int, input().split())) for i in range(N)]
dp = defaultdict(lambda: 0)
dp[0] = 0
for w, v in src:
dp2 = copy(dp)
for pw, pv in list(dp.items()):
if pw + w > W:
continue
d... | false | 58.333333 | [
"-import sys",
"+from collections import defaultdict",
"+from copy import copy",
"-src = []",
"-wmax = vmax = 0",
"-for i in range(N):",
"- w, v = list(map(int, input().split()))",
"- src.append((w, v))",
"- wmax += w",
"- vmax += v",
"-w1 = src[0][0]",
"-if w1 > W:",
"- print... | false | 0.08382 | 0.039983 | 2.096375 | [
"s832418180",
"s725314456"
] |
u626217906 | p02684 | python | s070314691 | s678737404 | 156 | 114 | 102,116 | 102,288 | Accepted | Accepted | 26.92 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 1
li = [1]
flag = [True] * n
flag[0] = False
for i in range(k):
num = a[num-1]
if flag[num-1]:
li.append(num)
flag[num-1] = False
else:
break
d = li.index(num)
ans = (k-d)%(len(li)-d)... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
tt = [0] * n
tt[0] = 1
ans_l = [1]
i = 1
for j in range(k):
i = a[i-1]
if tt[i-1] == False:
tt[i-1] = 1
ans_l.append(i)
else:
break
d = ans_l.index(i)
k -= d
ans = k % (len(ans_l)-d)
print((... | 20 | 20 | 334 | 327 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 1
li = [1]
flag = [True] * n
flag[0] = False
for i in range(k):
num = a[num - 1]
if flag[num - 1]:
li.append(num)
flag[num - 1] = False
else:
break
d = li.index(num)
ans = (k - d) % (len(li) - d) + d
pri... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
tt = [0] * n
tt[0] = 1
ans_l = [1]
i = 1
for j in range(k):
i = a[i - 1]
if tt[i - 1] == False:
tt[i - 1] = 1
ans_l.append(i)
else:
break
d = ans_l.index(i)
k -= d
ans = k % (len(ans_l) - d)
print((ans_l[ans +... | false | 0 | [
"-num = 1",
"-li = [1]",
"-flag = [True] * n",
"-flag[0] = False",
"-for i in range(k):",
"- num = a[num - 1]",
"- if flag[num - 1]:",
"- li.append(num)",
"- flag[num - 1] = False",
"+tt = [0] * n",
"+tt[0] = 1",
"+ans_l = [1]",
"+i = 1",
"+for j in range(k):",
"+ ... | false | 0.036831 | 0.035129 | 1.048442 | [
"s070314691",
"s678737404"
] |
u243572357 | p03220 | python | s116471669 | s395194726 | 20 | 18 | 3,188 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
H = [abs(t-a-x * 6e-3) for x in h]
print((1 + H.index(min(H)))) | n = int(eval(input()))
t, a = list(map(int, input().split()))
lst = [ abs((t - i * 0.006)-a) for i in list(map(int, input().split()))]
print((lst.index(min(lst)) + 1))
| 5 | 4 | 151 | 157 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
H = [abs(t - a - x * 6e-3) for x in h]
print((1 + H.index(min(H))))
| n = int(eval(input()))
t, a = list(map(int, input().split()))
lst = [abs((t - i * 0.006) - a) for i in list(map(int, input().split()))]
print((lst.index(min(lst)) + 1))
| false | 20 | [
"-h = list(map(int, input().split()))",
"-H = [abs(t - a - x * 6e-3) for x in h]",
"-print((1 + H.index(min(H))))",
"+lst = [abs((t - i * 0.006) - a) for i in list(map(int, input().split()))]",
"+print((lst.index(min(lst)) + 1))"
] | false | 0.039868 | 0.040002 | 0.996642 | [
"s116471669",
"s395194726"
] |
u489959379 | p03651 | python | s254170374 | s975213953 | 248 | 56 | 65,048 | 20,192 | Accepted | Accepted | 77.42 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def resolve():
n, k = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
if k in set(A):
print("POSS... | import sys
from math import gcd
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
if k > max(A):
print("IMPOSSIBLE")
exit()
g = A... | 41 | 26 | 671 | 462 | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def resolve():
n, k = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
if k in set(A):
print("POSSIBLE")
exit()
... | import sys
from math import gcd
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
if k > max(A):
print("IMPOSSIBLE")
exit()
g = A[0]
for a in A:
... | false | 36.585366 | [
"+from math import gcd",
"+input = sys.stdin.readline",
"-def gcd(a, b):",
"- while b != 0:",
"- a, b = b, a % b",
"- return a",
"-",
"-",
"- A = sorted(list(map(int, input().split())))",
"- if k in set(A):",
"- print(\"POSSIBLE\")",
"- exit()",
"- if k > ... | false | 0.042076 | 0.08162 | 0.515508 | [
"s254170374",
"s975213953"
] |
u823885866 | p03284 | python | s545327997 | s751236145 | 28 | 24 | 9,144 | 8,964 | Accepted | Accepted | 14.29 | import sys
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
n, k = rm()
print((0 if n%k == 0 else 1))
| import sys
rm = lambda: list(map(int, sys.stdin.readline().split()))
n, k = rm()
print((0 if n%k == 0 else 1))
| 5 | 5 | 115 | 108 | import sys
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
n, k = rm()
print((0 if n % k == 0 else 1))
| import sys
rm = lambda: list(map(int, sys.stdin.readline().split()))
n, k = rm()
print((0 if n % k == 0 else 1))
| false | 0 | [
"-rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"+rm = lambda: list(map(int, sys.stdin.readline().split()))"
] | false | 0.047903 | 0.044132 | 1.085439 | [
"s545327997",
"s751236145"
] |
u513081876 | p03721 | python | s767975646 | s266509881 | 520 | 428 | 29,732 | 21,632 | Accepted | Accepted | 17.69 | N, K = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort()
check = 0
for i in range(N):
check += ab[i][1]
if K <= check:
print((ab[i][0]))
break | N, K = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for i in range(N)]
ab.sort()
check = 0
for a, b in ab:
check += b
if check >= K:
print(a)
break | 9 | 9 | 215 | 200 | N, K = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort()
check = 0
for i in range(N):
check += ab[i][1]
if K <= check:
print((ab[i][0]))
break
| N, K = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for i in range(N)]
ab.sort()
check = 0
for a, b in ab:
check += b
if check >= K:
print(a)
break
| false | 0 | [
"-ab = [list(map(int, input().split())) for i in range(N)]",
"+ab = [[int(i) for i in input().split()] for i in range(N)]",
"-for i in range(N):",
"- check += ab[i][1]",
"- if K <= check:",
"- print((ab[i][0]))",
"+for a, b in ab:",
"+ check += b",
"+ if check >= K:",
"+ ... | false | 0.033505 | 0.036359 | 0.921507 | [
"s767975646",
"s266509881"
] |
u449473917 | p03087 | python | s814191246 | s177332466 | 860 | 303 | 7,748 | 37,104 | Accepted | Accepted | 64.77 | N, Q = list(map(int, input().split()))
S = eval(input())
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((t[r-1] - t[l-1]))
| from sys import stdin
n,q=list(map(int,input().split()))
s=eval(input())
l = [stdin.readline().rstrip().split() for _ in range(q)]
t=[0]*(n+1)
for i in range(n):
t[i+1]=t[i]+(1 if s[i:i+2]=="AC" else 0)
for j,k in l:
print((t[int(k)-1]-t[int(j)-1])) | 8 | 11 | 229 | 255 | N, Q = list(map(int, input().split()))
S = eval(input())
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((t[r - 1] - t[l - 1]))
| from sys import stdin
n, q = list(map(int, input().split()))
s = eval(input())
l = [stdin.readline().rstrip().split() for _ in range(q)]
t = [0] * (n + 1)
for i in range(n):
t[i + 1] = t[i] + (1 if s[i : i + 2] == "AC" else 0)
for j, k in l:
print((t[int(k) - 1] - t[int(j) - 1]))
| false | 27.272727 | [
"-N, Q = list(map(int, input().split()))",
"-S = eval(input())",
"-t = [0] * (N + 1)",
"-for i in range(N):",
"- t[i + 1] = t[i] + (1 if S[i : i + 2] == \"AC\" else 0)",
"-for i in range(Q):",
"- l, r = list(map(int, input().split()))",
"- print((t[r - 1] - t[l - 1]))",
"+from sys import st... | false | 0.08619 | 0.131628 | 0.654796 | [
"s814191246",
"s177332466"
] |
u863397945 | p03029 | python | s734137749 | s109287022 | 31 | 27 | 9,012 | 9,148 | Accepted | Accepted | 12.9 | A,P = list(map(int,input().split()))
P = P + A*3
print((P//2)) | A,P = list(map(int,input().split()))
P += A*3
print((P//2)) | 5 | 5 | 60 | 57 | A, P = list(map(int, input().split()))
P = P + A * 3
print((P // 2))
| A, P = list(map(int, input().split()))
P += A * 3
print((P // 2))
| false | 0 | [
"-P = P + A * 3",
"+P += A * 3"
] | false | 0.03523 | 0.03639 | 0.968136 | [
"s734137749",
"s109287022"
] |
u073729602 | p03011 | python | s052652065 | s822206618 | 31 | 27 | 8,888 | 9,136 | Accepted | Accepted | 12.9 | import itertools
p, q, r = list(map(int, input().split()))
mn = 10 ** 9
for v in itertools.combinations([p, q, r], 2):
mn = min(mn, v[0]+v[1])
print(mn)
| l = list(map(int, input().split()))
l.sort()
print((l[0]+l[1]))
| 6 | 3 | 156 | 64 | import itertools
p, q, r = list(map(int, input().split()))
mn = 10**9
for v in itertools.combinations([p, q, r], 2):
mn = min(mn, v[0] + v[1])
print(mn)
| l = list(map(int, input().split()))
l.sort()
print((l[0] + l[1]))
| false | 50 | [
"-import itertools",
"-",
"-p, q, r = list(map(int, input().split()))",
"-mn = 10**9",
"-for v in itertools.combinations([p, q, r], 2):",
"- mn = min(mn, v[0] + v[1])",
"-print(mn)",
"+l = list(map(int, input().split()))",
"+l.sort()",
"+print((l[0] + l[1]))"
] | false | 0.041344 | 0.045125 | 0.916212 | [
"s052652065",
"s822206618"
] |
u121161758 | p03161 | python | s332487252 | s272396575 | 1,998 | 1,714 | 13,980 | 13,980 | Accepted | Accepted | 14.21 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 4 + 1
dp = [inf] * N
dp[0] = 0
for i in range(1,N):
H = h[i]
dp[i] = min( [dp[j] + abs(h[j] - H) for j in range(max(0, i-K),i)])
print((dp[-1]))
| N,K=list(map(int, input().split()))
H=list(map(int, input().split()))
if N-1<=K:
print((abs(H[N-1]-H[0])))
exit()
inf=10**4+1
dp=[inf]*N
dp[0]=0
for i,h in enumerate(H):
if i == 0:continue
m=inf
M=max(0,i-K)
dp[i]=min([dpt+abs(h-ht) for ht,dpt in zip(H[M:i],dp[M:i])])
print((d... | 9 | 17 | 240 | 318 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10**4 + 1
dp = [inf] * N
dp[0] = 0
for i in range(1, N):
H = h[i]
dp[i] = min([dp[j] + abs(h[j] - H) for j in range(max(0, i - K), i)])
print((dp[-1]))
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
if N - 1 <= K:
print((abs(H[N - 1] - H[0])))
exit()
inf = 10**4 + 1
dp = [inf] * N
dp[0] = 0
for i, h in enumerate(H):
if i == 0:
continue
m = inf
M = max(0, i - K)
dp[i] = min([dpt + abs(h - ht) for ht, dpt in zi... | false | 47.058824 | [
"-h = list(map(int, input().split()))",
"+H = list(map(int, input().split()))",
"+if N - 1 <= K:",
"+ print((abs(H[N - 1] - H[0])))",
"+ exit()",
"-for i in range(1, N):",
"- H = h[i]",
"- dp[i] = min([dp[j] + abs(h[j] - H) for j in range(max(0, i - K), i)])",
"-print((dp[-1]))",
"+for... | false | 0.045875 | 0.046237 | 0.992165 | [
"s332487252",
"s272396575"
] |
u923279197 | p03062 | python | s698154818 | s565939070 | 232 | 106 | 64,880 | 14,412 | Accepted | Accepted | 54.31 | n = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
minus = 0
q = abs(a[0])
for i in a:
ans += abs(i)
q = min(q,abs(i))
if i < 0:
minus += 1
if minus%2 == 0:
print(ans)
else:
print((ans - 2*q)) | n = int(eval(input()))
a = list(map(int,input().split()))
minus = 0
mi = 10**10
ans = 0
for i in range(n):
if a[i] < 0:minus+=1
mi = min(mi,abs(a[i]))
ans += abs(a[i])
if minus%2 == 0:
print(ans)
else:
print((ans-2*mi)) | 15 | 13 | 242 | 243 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
minus = 0
q = abs(a[0])
for i in a:
ans += abs(i)
q = min(q, abs(i))
if i < 0:
minus += 1
if minus % 2 == 0:
print(ans)
else:
print((ans - 2 * q))
| n = int(eval(input()))
a = list(map(int, input().split()))
minus = 0
mi = 10**10
ans = 0
for i in range(n):
if a[i] < 0:
minus += 1
mi = min(mi, abs(a[i]))
ans += abs(a[i])
if minus % 2 == 0:
print(ans)
else:
print((ans - 2 * mi))
| false | 13.333333 | [
"+minus = 0",
"+mi = 10**10",
"-minus = 0",
"-q = abs(a[0])",
"-for i in a:",
"- ans += abs(i)",
"- q = min(q, abs(i))",
"- if i < 0:",
"+for i in range(n):",
"+ if a[i] < 0:",
"+ mi = min(mi, abs(a[i]))",
"+ ans += abs(a[i])",
"- print((ans - 2 * q))",
"+ print((an... | false | 0.0371 | 0.035124 | 1.056258 | [
"s698154818",
"s565939070"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.