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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u352394527 | p02368 | python | s126115242 | s210691353 | 1,100 | 930 | 19,148 | 19,196 | Accepted | Accepted | 15.45 | """
ๅผท้ฃ็ตๆๅๅ่งฃ
"""
import sys
sys.setrecursionlimit(1000000)
def dfs(v, visited, edges, order):
visited[v] = True
for to in edges[v]:
if not visited[to]:
dfs(to, visited, edges, order)
order.append(v)
def search_strongly_connection(v, visited, reverse_edges, parent):
visited[v] = True... | """
ๅผท้ฃ็ตๆๅๅ่งฃ
"""
import sys
sys.setrecursionlimit(1000000)
def dfs(v, visited, edges, order):
visited[v] = True
for to in edges[v]:
if not visited[to]:
dfs(to, visited, edges, order)
order.append(v)
def search_strongly_connection(v, visited, reverse_edges, parent, num):
visited[v] =... | 59 | 53 | 1,309 | 1,199 | """
ๅผท้ฃ็ตๆๅๅ่งฃ
"""
import sys
sys.setrecursionlimit(1000000)
def dfs(v, visited, edges, order):
visited[v] = True
for to in edges[v]:
if not visited[to]:
dfs(to, visited, edges, order)
order.append(v)
def search_strongly_connection(v, visited, reverse_edges, parent):
visited[v] = T... | """
ๅผท้ฃ็ตๆๅๅ่งฃ
"""
import sys
sys.setrecursionlimit(1000000)
def dfs(v, visited, edges, order):
visited[v] = True
for to in edges[v]:
if not visited[to]:
dfs(to, visited, edges, order)
order.append(v)
def search_strongly_connection(v, visited, reverse_edges, parent, num):
visited[v... | false | 10.169492 | [
"-def search_strongly_connection(v, visited, reverse_edges, parent):",
"+def search_strongly_connection(v, visited, reverse_edges, parent, num):",
"- parent[to] = v",
"- search_strongly_connection(to, visited, reverse_edges, parent)",
"-",
"-",
"-def find(parent, x):",
"- if p... | false | 0.069919 | 0.037679 | 1.855644 | [
"s126115242",
"s210691353"
] |
u001024152 | p03944 | python | s385240566 | s441982499 | 147 | 18 | 3,064 | 3,064 | Accepted | Accepted | 87.76 | W,H,N = list(map(int, input().split()))
rec = [["W"]*(W) for _ in range(H)]
for _ in range(N):
x,y,a = list(map(int, input().split()))
if a==1:
for h in range(H):
for w in range(W):
if w<x:
rec[h][w]="B"
elif a==2:
for h in range(H)... | W,H,N = list(map(int, input().split()))
x_min, y_min = 0,0
x_max, y_max = W,H
for _ in range(N):
x,y,a = list(map(int, input().split()))
if a==1:
x_min = max(x_min, x)
elif a==2:
x_max = min(x_max, x)
elif a==3:
y_min = max(y_min, y)
else:
y_max = min(y_ma... | 33 | 16 | 821 | 393 | W, H, N = list(map(int, input().split()))
rec = [["W"] * (W) for _ in range(H)]
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
for h in range(H):
for w in range(W):
if w < x:
rec[h][w] = "B"
elif a == 2:
for h in range(... | W, H, N = list(map(int, input().split()))
x_min, y_min = 0, 0
x_max, y_max = W, H
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
x_min = max(x_min, x)
elif a == 2:
x_max = min(x_max, x)
elif a == 3:
y_min = max(y_min, y)
else:
y_max = min(y_ma... | false | 51.515152 | [
"-rec = [[\"W\"] * (W) for _ in range(H)]",
"+x_min, y_min = 0, 0",
"+x_max, y_max = W, H",
"- for h in range(H):",
"- for w in range(W):",
"- if w < x:",
"- rec[h][w] = \"B\"",
"+ x_min = max(x_min, x)",
"- for h in range(H):",
"- ... | false | 0.037273 | 0.072966 | 0.510829 | [
"s385240566",
"s441982499"
] |
u043048943 | p02685 | python | s680454100 | s604082748 | 195 | 133 | 109,788 | 111,424 | Accepted | Accepted | 31.79 | import sys,os
from collections import defaultdict, deque
from math import ceil, floor, inf
if sys.version_info[1] >= 5:
from math import gcd
else:
from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ... | import sys,os
from collections import defaultdict, deque
from math import ceil, floor, inf
if sys.version_info[1] >= 5:
from math import gcd
else:
from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ... | 46 | 54 | 1,395 | 1,645 | import sys, os
from collections import defaultdict, deque
from math import ceil, floor, inf
if sys.version_info[1] >= 5:
from math import gcd
else:
from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (
(lambda *something: print(*something))
if "TERM_PROGRAM" in os.envi... | import sys, os
from collections import defaultdict, deque
from math import ceil, floor, inf
if sys.version_info[1] >= 5:
from math import gcd
else:
from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (
(lambda *something: print(*something))
if "TERM_PROGRAM" in os.envi... | false | 14.814815 | [
"- for i in range(K, -1, -1):",
"- ans += M * pow(M - 1, N - i - 1, MOD) * cmb.nCr(i)",
"+ powtable = [0] * N",
"+ powtable[N - K - 1] = M * pow(M - 1, N - K - 1, MOD) % MOD",
"+ for i in range(N - K, N):",
"+ powtable[i] = powtable[i - 1] * (M - 1) % MOD",
"+ for i in range... | false | 0.117566 | 0.108875 | 1.079826 | [
"s680454100",
"s604082748"
] |
u254871849 | p03680 | python | s592937334 | s648424112 | 85 | 63 | 7,844 | 15,204 | Accepted | Accepted | 25.88 | # import sys
# input = sys.stdin.readline
N, *a = [int(x) for x in open(0)]
a.insert(0, None)
first = 1
pres = first
count = 0
nex = a[pres] # press the button
count += 1
for i in range(N-1): # operations are at most N-1 times.
if nex == 2: break
prev = pres
pres = nex
nex = a[pres] # ... | import sys
n, *b = list(map(int, sys.stdin.read().split()))
def main():
on = 1
lightened = set([1])
for i in range(1, n):
on = b[on-1]
if on == 2:
return i
if on in lightened:
return -1
lightened.add(on)
if __name__ == '__main__':
... | 21 | 18 | 440 | 345 | # import sys
# input = sys.stdin.readline
N, *a = [int(x) for x in open(0)]
a.insert(0, None)
first = 1
pres = first
count = 0
nex = a[pres] # press the button
count += 1
for i in range(N - 1): # operations are at most N-1 times.
if nex == 2:
break
prev = pres
pres = nex
nex = a[pres] # press... | import sys
n, *b = list(map(int, sys.stdin.read().split()))
def main():
on = 1
lightened = set([1])
for i in range(1, n):
on = b[on - 1]
if on == 2:
return i
if on in lightened:
return -1
lightened.add(on)
if __name__ == "__main__":
ans = main... | false | 14.285714 | [
"-# import sys",
"-# input = sys.stdin.readline",
"-N, *a = [int(x) for x in open(0)]",
"-a.insert(0, None)",
"-first = 1",
"-pres = first",
"-count = 0",
"-nex = a[pres] # press the button",
"-count += 1",
"-for i in range(N - 1): # operations are at most N-1 times.",
"- if nex == 2:",
"... | false | 0.045887 | 0.046268 | 0.991768 | [
"s592937334",
"s648424112"
] |
u934442292 | p03438 | python | s979577787 | s228083001 | 39 | 36 | 10,480 | 10,516 | Accepted | Accepted | 7.69 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
n_2 = 0
n_1 = 0
for a, b in zip(A, B):
if a > b:
n_1 += (a - b)
elif a < b:
n_2 += (b - a... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
n_2 = 0
n_1 = 0
for a, b in zip(A, B):
if a > b:
n_1 += (a - b)
elif a < b:
n_2 += (b - a... | 30 | 28 | 544 | 504 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
n_2 = 0
n_1 = 0
for a, b in zip(A, B):
if a > b:
n_1 += a - b
elif a < b:
n_2 += (b - a + 1) // 2
diff... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
n_2 = 0
n_1 = 0
for a, b in zip(A, B):
if a > b:
n_1 += a - b
elif a < b:
n_2 += (b - a + 1) // 2
diff... | false | 6.666667 | [
"- if diff < 0:",
"- ans = \"No\"",
"- elif n_1 <= diff and n_2 <= diff:",
"+ if n_1 <= diff and n_2 <= diff:"
] | false | 0.112415 | 0.097665 | 1.151034 | [
"s979577787",
"s228083001"
] |
u306950978 | p03141 | python | s445829638 | s421693960 | 581 | 202 | 51,032 | 80,988 | Accepted | Accepted | 65.23 | n = int(eval(input()))
atob = []
ans = 0
for i in range(n):
x,y = list(map(int,input().split()))
ans += x
atob.append(x+y)
atob.sort(reverse=True)
for i in range(n//2):
ans -= atob[2*i+1]
print(ans) | n = int(eval(input()))
ans = 0
cou = []
for i in range(n):
a , b = list(map(int,input().split()))
ans += a
cou.append(a+b)
cou.sort(reverse=True)
for i in range(1,n,2):
ans -= cou[i]
print(ans) | 14 | 11 | 226 | 207 | n = int(eval(input()))
atob = []
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
ans += x
atob.append(x + y)
atob.sort(reverse=True)
for i in range(n // 2):
ans -= atob[2 * i + 1]
print(ans)
| n = int(eval(input()))
ans = 0
cou = []
for i in range(n):
a, b = list(map(int, input().split()))
ans += a
cou.append(a + b)
cou.sort(reverse=True)
for i in range(1, n, 2):
ans -= cou[i]
print(ans)
| false | 21.428571 | [
"-atob = []",
"+cou = []",
"- x, y = list(map(int, input().split()))",
"- ans += x",
"- atob.append(x + y)",
"-atob.sort(reverse=True)",
"-for i in range(n // 2):",
"- ans -= atob[2 * i + 1]",
"+ a, b = list(map(int, input().split()))",
"+ ans += a",
"+ cou.append(a + b)",
... | false | 0.078092 | 0.035713 | 2.186628 | [
"s445829638",
"s421693960"
] |
u263830634 | p04013 | python | s152858808 | s241955404 | 470 | 45 | 103,644 | 5,216 | Accepted | Accepted | 90.43 | N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(x)
if X < A:
X = A
def check(j, k, s):
if dp[j][k][s] != -1:
return dp[j][k][s]
if j == 0 and k == 0 and s == 0:
dp[j][k][s] = 1
return 1
if j >= 1 and s < x[j-1]:
a = check... | N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(x)
if X < A:
X = A
y = []
for i in x:
y += [i-A]
dp = [[-1] * (2*N*X+1) for _ in range(N+1)]
def check(j, t):
if dp[j][t] != -1:
return dp[j][t]
if j == 0 and t == N * X:
dp[j][t]... | 39 | 29 | 934 | 653 | N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(x)
if X < A:
X = A
def check(j, k, s):
if dp[j][k][s] != -1:
return dp[j][k][s]
if j == 0 and k == 0 and s == 0:
dp[j][k][s] = 1
return 1
if j >= 1 and s < x[j - 1]:
a = check(j - 1, k, s... | N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
X = max(x)
if X < A:
X = A
y = []
for i in x:
y += [i - A]
dp = [[-1] * (2 * N * X + 1) for _ in range(N + 1)]
def check(j, t):
if dp[j][t] != -1:
return dp[j][t]
if j == 0 and t == N * X:
dp[j][t] = 1
r... | false | 25.641026 | [
"+y = []",
"+for i in x:",
"+ y += [i - A]",
"+dp = [[-1] * (2 * N * X + 1) for _ in range(N + 1)]",
"-def check(j, k, s):",
"- if dp[j][k][s] != -1:",
"- return dp[j][k][s]",
"- if j == 0 and k == 0 and s == 0:",
"- dp[j][k][s] = 1",
"+def check(j, t):",
"+ if dp[j][t]... | false | 0.08999 | 0.045782 | 1.96559 | [
"s152858808",
"s241955404"
] |
u871596687 | p03035 | python | s304054610 | s343789441 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | A,B = list(map(int,input().split()))
if 13 <= A:
print(B)
elif (6 <= A) and (A<=12):
print((B//2))
else:
print((0))
| a,b = list(map(int,input().split()))
if a >= 13:
print(b)
elif (6 <=a<= 12):
print((b//2))
else:
print("0")
| 8 | 8 | 126 | 120 | A, B = list(map(int, input().split()))
if 13 <= A:
print(B)
elif (6 <= A) and (A <= 12):
print((B // 2))
else:
print((0))
| a, b = list(map(int, input().split()))
if a >= 13:
print(b)
elif 6 <= a <= 12:
print((b // 2))
else:
print("0")
| false | 0 | [
"-A, B = list(map(int, input().split()))",
"-if 13 <= A:",
"- print(B)",
"-elif (6 <= A) and (A <= 12):",
"- print((B // 2))",
"+a, b = list(map(int, input().split()))",
"+if a >= 13:",
"+ print(b)",
"+elif 6 <= a <= 12:",
"+ print((b // 2))",
"- print((0))",
"+ print(\"0\")"... | false | 0.070761 | 0.067766 | 1.044194 | [
"s304054610",
"s343789441"
] |
u165429863 | p02678 | python | s268186530 | s439681645 | 740 | 317 | 34,792 | 46,512 | Accepted | Accepted | 57.16 | from collections import deque
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
for _ in range(M):
A, B = list(map(int, input().split()))
g[A].append(B)
g[B].append(A)
#print("->", g)
def bfs(u):
queue = deque([u])
d = [None] * (N + 1)
d[0] = 0
... | import sys
from collections import deque
def main():
N, M, *AB = list(map(int, sys.stdin.buffer.read().split()))
g = [[] for _ in range(N + 1)]
for A, B in zip(*[iter(AB)] * 2):
g[A].append(B)
g[B].append(A)
#print("->", g)
queue = deque([1])
d = [No... | 39 | 39 | 648 | 721 | from collections import deque
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
for _ in range(M):
A, B = list(map(int, input().split()))
g[A].append(B)
g[B].append(A)
# print("->", g)
def bfs(u):
queue = deque([u])
d = [None] * (N + 1)
d[0] = 0
d[u] = 0
while ... | import sys
from collections import deque
def main():
N, M, *AB = list(map(int, sys.stdin.buffer.read().split()))
g = [[] for _ in range(N + 1)]
for A, B in zip(*[iter(AB)] * 2):
g[A].append(B)
g[B].append(A)
# print("->", g)
queue = deque([1])
d = [None] * (N + 1)
d[0] ... | false | 0 | [
"+import sys",
"-N, M = list(map(int, input().split()))",
"-g = [[] for _ in range(N + 1)]",
"-for _ in range(M):",
"- A, B = list(map(int, input().split()))",
"- g[A].append(B)",
"- g[B].append(A)",
"- # print(\"->\", g)",
"-",
"-def bfs(u):",
"- queue = deque([u])",
"+def main... | false | 0.038293 | 0.038495 | 0.994753 | [
"s268186530",
"s439681645"
] |
u576432509 | p03262 | python | s635931450 | s606126052 | 158 | 99 | 14,252 | 16,200 | Accepted | Accepted | 37.34 | def gcdf(a):
a.sort()
a0=a[0]
a=[int(x%a0) for x in a if x%a0 != 0]
if len(a)==0:
return a0
else:
a.append(a0)
a0=min(a)
return gcdf(a)
n,x=list(map(int,input().split()))
xi=list(map(int,input().split()))
for i in range(n):
if xi[i]>x:
... |
from functools import reduce
from fractions import gcd
#from math import gcd
n,x0=list(map(int,input().split()))
x=list(map(int,input().split()))
for i in range(n):
x[i]=abs(x[i]-x0)
print((reduce(gcd, x)))
| 22 | 13 | 402 | 224 | def gcdf(a):
a.sort()
a0 = a[0]
a = [int(x % a0) for x in a if x % a0 != 0]
if len(a) == 0:
return a0
else:
a.append(a0)
a0 = min(a)
return gcdf(a)
n, x = list(map(int, input().split()))
xi = list(map(int, input().split()))
for i in range(n):
if xi[i] > x:
... | from functools import reduce
from fractions import gcd
# from math import gcd
n, x0 = list(map(int, input().split()))
x = list(map(int, input().split()))
for i in range(n):
x[i] = abs(x[i] - x0)
print((reduce(gcd, x)))
| false | 40.909091 | [
"-def gcdf(a):",
"- a.sort()",
"- a0 = a[0]",
"- a = [int(x % a0) for x in a if x % a0 != 0]",
"- if len(a) == 0:",
"- return a0",
"- else:",
"- a.append(a0)",
"- a0 = min(a)",
"- return gcdf(a)",
"+from functools import reduce",
"+from fractions impo... | false | 0.035578 | 0.071904 | 0.494801 | [
"s635931450",
"s606126052"
] |
u440161695 | p02732 | python | s729867685 | s023997932 | 548 | 382 | 34,848 | 25,716 | Accepted | Accepted | 30.29 | def f(n):#nC2ใฎ้ขๆฐ
if n==0:
return 0
return n*(n-1)/2
N=int(eval(input()))
A=list(map(int,input().split()))
d=dict()
e=dict()
ans=0
for i in range(N):#่พๆธใไฝใ
if A[i] not in d:
d[A[i]]=0
d[A[i]]+=1
for j in d:#ใใใใใฎใญใผใฎๅๆฐใnC2ใจใใฆไฟๅญ
e[j]=f(d[j])
ans+=e[j]#nC2ใฎ็ทๅใใจใ
f... | def f(n):
return (n*(n-1))//2
N=int(eval(input()))
A=list(map(int,input().split()))
d=dict()
ans=0
#ใใใใใไฝๅใใใใ่พๆธใซ็ป้ฒ
for i in range(len(A)):
if A[i] not in d:
d[A[i]]=0
d[A[i]]+=1
for i in d:
ans+=f(d[i])
for i in range(len(A)):
print((ans-d[A[i]]+1)) | 20 | 15 | 352 | 271 | def f(n): # nC2ใฎ้ขๆฐ
if n == 0:
return 0
return n * (n - 1) / 2
N = int(eval(input()))
A = list(map(int, input().split()))
d = dict()
e = dict()
ans = 0
for i in range(N): # ่พๆธใไฝใ
if A[i] not in d:
d[A[i]] = 0
d[A[i]] += 1
for j in d: # ใใใใใฎใญใผใฎๅๆฐใnC2ใจใใฆไฟๅญ
e[j] = f(d[j])
ans +... | def f(n):
return (n * (n - 1)) // 2
N = int(eval(input()))
A = list(map(int, input().split()))
d = dict()
ans = 0
# ใใใใใไฝๅใใใใ่พๆธใซ็ป้ฒ
for i in range(len(A)):
if A[i] not in d:
d[A[i]] = 0
d[A[i]] += 1
for i in d:
ans += f(d[i])
for i in range(len(A)):
print((ans - d[A[i]] + 1))
| false | 25 | [
"-def f(n): # nC2ใฎ้ขๆฐ",
"- if n == 0:",
"- return 0",
"- return n * (n - 1) / 2",
"+def f(n):",
"+ return (n * (n - 1)) // 2",
"-e = dict()",
"-for i in range(N): # ่พๆธใไฝใ",
"+# ใใใใใไฝๅใใใใ่พๆธใซ็ป้ฒ",
"+for i in range(len(A)):",
"-for j in d: # ใใใใใฎใญใผใฎๅๆฐใnC2ใจใใฆไฟๅญ",
"- e[j] = f... | false | 0.035344 | 0.034205 | 1.0333 | [
"s729867685",
"s023997932"
] |
u936985471 | p04020 | python | s428324113 | s250780406 | 229 | 121 | 3,060 | 7,072 | Accepted | Accepted | 47.16 | n=int(eval(input()))
rest=0
ans=0
for i in range(n):
a=int(eval(input()))
if rest==1 and a>0:
ans+=1
a-=1
ans+=a//2
rest=a%2
print(ans)
| # ๅ
้ ญใใ่ฆใฆใใ
# A_i // 2ๅใฏ่ชๅๅๅฃซใงใใขใไฝใฃใฆใใ
# 1ๆไฝใฃใใใA_i+1ใ0ใงใชใใใฐA_i+1ใใ1ๆธใใใฆใใขใไฝใใ
# ใใฎ่ฒชๆฌฒใงOK
import sys
readline = sys.stdin.readline
N = int(readline())
A = [int(readline()) for i in range(N)]
ans = 0
for i in range(N):
pair, mod = divmod(A[i],2)
ans += pair
if mod == 1 and i != N - 1 and A[i + 1] > ... | 13 | 20 | 157 | 371 | n = int(eval(input()))
rest = 0
ans = 0
for i in range(n):
a = int(eval(input()))
if rest == 1 and a > 0:
ans += 1
a -= 1
ans += a // 2
rest = a % 2
print(ans)
| # ๅ
้ ญใใ่ฆใฆใใ
# A_i // 2ๅใฏ่ชๅๅๅฃซใงใใขใไฝใฃใฆใใ
# 1ๆไฝใฃใใใA_i+1ใ0ใงใชใใใฐA_i+1ใใ1ๆธใใใฆใใขใไฝใใ
# ใใฎ่ฒชๆฌฒใงOK
import sys
readline = sys.stdin.readline
N = int(readline())
A = [int(readline()) for i in range(N)]
ans = 0
for i in range(N):
pair, mod = divmod(A[i], 2)
ans += pair
if mod == 1 and i != N - 1 and A[i + 1] > 0:
... | false | 35 | [
"-n = int(eval(input()))",
"-rest = 0",
"+# ๅ
้ ญใใ่ฆใฆใใ",
"+# A_i // 2ๅใฏ่ชๅๅๅฃซใงใใขใไฝใฃใฆใใ",
"+# 1ๆไฝใฃใใใA_i+1ใ0ใงใชใใใฐA_i+1ใใ1ๆธใใใฆใใขใไฝใใ",
"+# ใใฎ่ฒชๆฌฒใงOK",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+A = [int(readline()) for i in range(N)]",
"-for i in range(n):",
"- ... | false | 0.084792 | 0.046112 | 1.838838 | [
"s428324113",
"s250780406"
] |
u977389981 | p03281 | python | s453175590 | s320476083 | 21 | 18 | 2,940 | 2,940 | Accepted | Accepted | 14.29 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
count = 0
for j in range(1, n + 1):
if i % 2 == 0:
break
if i % j == 0:
count += 1
if count == 8:
ans += 1
print(ans) | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 2 == 1:
cnt = 0
for j in range(1, i + 1):
if i % j == 0:
cnt += 1
if cnt == 8:
ans += 1
print(ans) | 14 | 11 | 251 | 234 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
count = 0
for j in range(1, n + 1):
if i % 2 == 0:
break
if i % j == 0:
count += 1
if count == 8:
ans += 1
print(ans)
| n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 2 == 1:
cnt = 0
for j in range(1, i + 1):
if i % j == 0:
cnt += 1
if cnt == 8:
ans += 1
print(ans)
| false | 21.428571 | [
"- count = 0",
"- for j in range(1, n + 1):",
"- if i % 2 == 0:",
"- break",
"- if i % j == 0:",
"- count += 1",
"- if count == 8:",
"- ans += 1",
"+ if i % 2 == 1:",
"+ cnt = 0",
"+ for j in range(1, i + 1):",
"+ ... | false | 0.044867 | 0.048543 | 0.924271 | [
"s453175590",
"s320476083"
] |
u475065881 | p03283 | python | s696299934 | s751755601 | 1,004 | 506 | 15,708 | 36,260 | Accepted | Accepted | 49.6 | N, M , Q = list(map(int, input().split()))
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
L, R = list(map(int, input().split()))
LR[L][R-L+1] += 1
for i in range(2,N+2):
for j in range(1,N-i+2):
LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
A = []
for i in r... | import sys
sin = sys.stdin.readlines()
N, M, Q = list(map(int, sin[0].split()))
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for line in sin[1:M+1]:
L, R = list(map(int, line.split()))
LR[L][R-L+1] += 1
for i in range(2,N+2):
for j in range(1,N-i+2):
LR[j][i] += LR[j][i-1] + LR[j+1][i-1] ... | 18 | 19 | 411 | 449 | N, M, Q = list(map(int, input().split()))
LR = [[0 for _ in range(N + 2 - i)] for i in range(N + 2)]
for i in range(M):
L, R = list(map(int, input().split()))
LR[L][R - L + 1] += 1
for i in range(2, N + 2):
for j in range(1, N - i + 2):
LR[j][i] += LR[j][i - 1] + LR[j + 1][i - 1] - LR[j + 1][i - 2]
... | import sys
sin = sys.stdin.readlines()
N, M, Q = list(map(int, sin[0].split()))
LR = [[0 for _ in range(N + 2 - i)] for i in range(N + 2)]
for line in sin[1 : M + 1]:
L, R = list(map(int, line.split()))
LR[L][R - L + 1] += 1
for i in range(2, N + 2):
for j in range(1, N - i + 2):
LR[j][i] += LR[j][... | false | 5.263158 | [
"-N, M, Q = list(map(int, input().split()))",
"+import sys",
"+",
"+sin = sys.stdin.readlines()",
"+N, M, Q = list(map(int, sin[0].split()))",
"-for i in range(M):",
"- L, R = list(map(int, input().split()))",
"+for line in sin[1 : M + 1]:",
"+ L, R = list(map(int, line.split()))",
"-for i i... | false | 0.08107 | 0.043635 | 1.857901 | [
"s696299934",
"s751755601"
] |
u301624971 | p03037 | python | s314222358 | s490366553 | 504 | 289 | 11,776 | 12,620 | Accepted | Accepted | 42.66 | N, M = list(map(int, input().split()))
L = []
R = []
for i in range(M):
x1, y1 = [int(i) for i in input().split()]
L.append(x1)
R.append(y1)
high=N
low=0
ans = [True for i in range(N)]
for i in range(M):
for c,k in enumerate(range(L[i]-2, low-1, -1)):
if(low < k):
lo... |
def myAnswer(N,M,L,R) -> int:
total = 0
MAXL=max(L)
MINR =min(R)
for i in range(1,N+1):
if(MAXL<= i and MINR >= i):
total += 1
return total
def modelAnswer():
tmp=1
def main():
N, M = list(map(int,input().split()))
L =[]
R = []
for _ in range(M):
l... | 27 | 26 | 484 | 462 | N, M = list(map(int, input().split()))
L = []
R = []
for i in range(M):
x1, y1 = [int(i) for i in input().split()]
L.append(x1)
R.append(y1)
high = N
low = 0
ans = [True for i in range(N)]
for i in range(M):
for c, k in enumerate(range(L[i] - 2, low - 1, -1)):
if low < k:
low = k
... | def myAnswer(N, M, L, R) -> int:
total = 0
MAXL = max(L)
MINR = min(R)
for i in range(1, N + 1):
if MAXL <= i and MINR >= i:
total += 1
return total
def modelAnswer():
tmp = 1
def main():
N, M = list(map(int, input().split()))
L = []
R = []
for _ in range(... | false | 3.703704 | [
"-N, M = list(map(int, input().split()))",
"-L = []",
"-R = []",
"-for i in range(M):",
"- x1, y1 = [int(i) for i in input().split()]",
"- L.append(x1)",
"- R.append(y1)",
"-high = N",
"-low = 0",
"-ans = [True for i in range(N)]",
"-for i in range(M):",
"- for c, k in enumerate(ra... | false | 0.039209 | 0.050289 | 0.779663 | [
"s314222358",
"s490366553"
] |
u645250356 | p03592 | python | s887586987 | s051920090 | 215 | 135 | 41,068 | 77,336 | Accepted | Accepted | 37.21 | from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sy... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 19 | 18 | 605 | 526 | from collections import Counter, defaultdict, deque
import sys, bisect, math, itertools, string, queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str(... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 5.263158 | [
"-import sys, bisect, math, itertools, string, queue",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys.stdin.readline().split())",
"-",
"-",
"-def inpln(n):",
"- return list(in... | false | 0.03894 | 0.038047 | 1.023478 | [
"s887586987",
"s051920090"
] |
u864197622 | p02770 | python | s639530505 | s260220841 | 1,216 | 1,087 | 49,788 | 47,076 | Accepted | Accepted | 10.61 | K, Q = list(map(int, input().split()))
D = [int(a) for a in input().split()]
for _ in range(Q):
N, X, M = list(map(int, input().split()))
if N <= K + 1:
A = [0] * N
A[0] = X % M
ans = 0
for i in range(N-1):
A[i+1] = (A[i] + D[i]) % M
if A[i+1] > ... | K, Q = list(map(int, input().split()))
D = [int(a) for a in input().split()]
for _ in range(Q):
N, X, M = list(map(int, input().split()))
t = X%M
for i in range(K):
t += ((D[i]-1) % M + 1) * ((N-i-2) // K + 1)
print((N - 1 - t//M)) | 22 | 8 | 546 | 248 | K, Q = list(map(int, input().split()))
D = [int(a) for a in input().split()]
for _ in range(Q):
N, X, M = list(map(int, input().split()))
if N <= K + 1:
A = [0] * N
A[0] = X % M
ans = 0
for i in range(N - 1):
A[i + 1] = (A[i] + D[i]) % M
if A[i + 1] > A[i]... | K, Q = list(map(int, input().split()))
D = [int(a) for a in input().split()]
for _ in range(Q):
N, X, M = list(map(int, input().split()))
t = X % M
for i in range(K):
t += ((D[i] - 1) % M + 1) * ((N - i - 2) // K + 1)
print((N - 1 - t // M))
| false | 63.636364 | [
"- if N <= K + 1:",
"- A = [0] * N",
"- A[0] = X % M",
"- ans = 0",
"- for i in range(N - 1):",
"- A[i + 1] = (A[i] + D[i]) % M",
"- if A[i + 1] > A[i]:",
"- ans += 1",
"- print(ans)",
"- continue",
"- ans = N -... | false | 0.04432 | 0.044956 | 0.985845 | [
"s639530505",
"s260220841"
] |
u509405951 | p02619 | python | s424972667 | s695350947 | 37 | 32 | 9,196 | 9,024 | Accepted | Accepted | 13.51 | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
last = [0 for _ in range(26)]
value = 0
for i in range(D):
day = i + 1
value += s[i][t[i]-1]
last[t[i]-1] = day
for j in range(26):
val... | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
def calc(D, s, t):
last = [0 for _ in range(26)]
value = 0
for i in range(D):
day = i + 1
value += s[i][t[i]-1]
last[t[i]-1] = da... | 15 | 17 | 352 | 406 | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
last = [0 for _ in range(26)]
value = 0
for i in range(D):
day = i + 1
value += s[i][t[i] - 1]
last[t[i] - 1] = day
for j in range(26):
va... | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
def calc(D, s, t):
last = [0 for _ in range(26)]
value = 0
for i in range(D):
day = i + 1
value += s[i][t[i] - 1]
last[t[i] ... | false | 11.764706 | [
"-last = [0 for _ in range(26)]",
"-value = 0",
"-for i in range(D):",
"- day = i + 1",
"- value += s[i][t[i] - 1]",
"- last[t[i] - 1] = day",
"- for j in range(26):",
"- value -= c[j] * (day - last[j])",
"- print(value)",
"+",
"+",
"+def calc(D, s, t):",
"+ last = [... | false | 0.037135 | 0.055203 | 0.672701 | [
"s424972667",
"s695350947"
] |
u671060652 | p02779 | python | s627235185 | s704244339 | 406 | 283 | 117,968 | 100,820 | Accepted | Accepted | 30.3 | import itertools
import math
import fractions
import functools
n = int(eval(input()))
a = list(map(int, input().split()))
s = set(a)
if len(s) == len(a):
print("YES")
else: print("NO") | n = int(eval(input()))
a = list(map(int, input().split()))
s = set()
for i in range(n):
s.add(a[i])
if len(s) == len(a):
print("YES")
else: print("NO") | 11 | 9 | 193 | 162 | import itertools
import math
import fractions
import functools
n = int(eval(input()))
a = list(map(int, input().split()))
s = set(a)
if len(s) == len(a):
print("YES")
else:
print("NO")
| n = int(eval(input()))
a = list(map(int, input().split()))
s = set()
for i in range(n):
s.add(a[i])
if len(s) == len(a):
print("YES")
else:
print("NO")
| false | 18.181818 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-",
"-s = set(a)",
"+s = set()",
"+for i in range(n):",
"+ s.add(a[i])"
] | false | 0.061481 | 0.060619 | 1.014223 | [
"s627235185",
"s704244339"
] |
u931118906 | p03160 | python | s843044228 | s163153365 | 151 | 123 | 13,924 | 13,980 | Accepted | Accepted | 18.54 | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[0]
res=0
for i in range(1,n):
if i>1:
if (abs(h[i]-h[i-1])+dp[i-1])>(abs(h[i]-h[i-2])+dp[i-2]):
dp.append(abs(h[i]-h[i-2])+dp[i-2])
else:
dp.append(abs(h[i]-h[i-1])+dp[i-1])
else:
dp.append(abs(h... | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])
if n>2:
for i in range(2,n):
dp[i]=min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])
print((dp[n-1])) | 14 | 8 | 353 | 201 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0]
res = 0
for i in range(1, n):
if i > 1:
if (abs(h[i] - h[i - 1]) + dp[i - 1]) > (abs(h[i] - h[i - 2]) + dp[i - 2]):
dp.append(abs(h[i] - h[i - 2]) + dp[i - 2])
else:
dp.append(abs(h[i] - h[i - 1]) + dp[i - 1]... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[1] = abs(h[1] - h[0])
if n > 2:
for i in range(2, n):
dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2])
print((dp[n - 1]))
| false | 42.857143 | [
"-dp = [0]",
"-res = 0",
"-for i in range(1, n):",
"- if i > 1:",
"- if (abs(h[i] - h[i - 1]) + dp[i - 1]) > (abs(h[i] - h[i - 2]) + dp[i - 2]):",
"- dp.append(abs(h[i] - h[i - 2]) + dp[i - 2])",
"- else:",
"- dp.append(abs(h[i] - h[i - 1]) + dp[i - 1])",
"- ... | false | 0.036993 | 0.037284 | 0.992201 | [
"s843044228",
"s163153365"
] |
u520276780 | p03583 | python | s852588861 | s400998922 | 932 | 207 | 3,064 | 40,556 | Accepted | Accepted | 77.79 | N = int(eval(input()))
for h in range(1,3501):
for n in range(1,h):
if (4*h*n-N*h-N*n)>0 and (h*n)%(4*h*n-N*h-N*n)==0:
print((h,n,h*n*N//(4*h*n-N*h-N*n)))
exit()
| N = int(eval(input()))
for h in range(1,3501):
for n in range(1,3501):
if (4*h*n-N*h-N*n)>0 and (h*n)%(4*h*n-N*h-N*n)==0:
print((h,n,h*n*N//(4*h*n-N*h-N*n)))
exit()
| 6 | 6 | 195 | 198 | N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, h):
if (4 * h * n - N * h - N * n) > 0 and (h * n) % (
4 * h * n - N * h - N * n
) == 0:
print((h, n, h * n * N // (4 * h * n - N * h - N * n)))
exit()
| N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
if (4 * h * n - N * h - N * n) > 0 and (h * n) % (
4 * h * n - N * h - N * n
) == 0:
print((h, n, h * n * N // (4 * h * n - N * h - N * n)))
exit()
| false | 0 | [
"- for n in range(1, h):",
"+ for n in range(1, 3501):"
] | false | 0.229564 | 0.547954 | 0.418948 | [
"s852588861",
"s400998922"
] |
u477977638 | p03137 | python | s813592911 | s661276124 | 125 | 100 | 13,968 | 91,720 | Accepted | Accepted | 20 | n,m=list(map(int,input().split()))
x=sorted(list(map(int,input().split())))
li=[]
for i in range(m-1):
li.append(x[i+1]-x[i])
li.sort(reverse=True)
print((max(x)-min(x)-sum(li[:(n-1)]))) | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return float(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,inp... | 11 | 32 | 194 | 681 | n, m = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
li = []
for i in range(m - 1):
li.append(x[i + 1] - x[i])
li.sort(reverse=True)
print((max(x) - min(x) - sum(li[: (n - 1)])))
| import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return float(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
retur... | false | 65.625 | [
"-n, m = list(map(int, input().split()))",
"-x = sorted(list(map(int, input().split())))",
"-li = []",
"-for i in range(m - 1):",
"- li.append(x[i + 1] - x[i])",
"-li.sort(reverse=True)",
"-print((max(x) - min(x) - sum(li[: (n - 1)])))",
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",... | false | 0.063841 | 0.039402 | 1.62024 | [
"s813592911",
"s661276124"
] |
u671211357 | p02708 | python | s768757975 | s459211162 | 136 | 119 | 16,712 | 9,088 | Accepted | Accepted | 12.5 | N,K=list(map(int,input().split()))
ans=0
kari=[i for i in range(N+1)]
for i in range(K,N+2):
saidai=(N+N-i+1)*i//2
saisyou=(i-1)*i//2
ans+=saidai-saisyou+1
ans%=10**9+7
print(ans) | N,K=list(map(int,input().split()))
ans=0
for i in range(K,N+2):
saidai=(N+N-i+1)*i//2
saisyou=(i-1)*i//2
ans+=saidai-saisyou+1
ans%=10**9+7
print(ans) | 10 | 9 | 195 | 165 | N, K = list(map(int, input().split()))
ans = 0
kari = [i for i in range(N + 1)]
for i in range(K, N + 2):
saidai = (N + N - i + 1) * i // 2
saisyou = (i - 1) * i // 2
ans += saidai - saisyou + 1
ans %= 10**9 + 7
print(ans)
| N, K = list(map(int, input().split()))
ans = 0
for i in range(K, N + 2):
saidai = (N + N - i + 1) * i // 2
saisyou = (i - 1) * i // 2
ans += saidai - saisyou + 1
ans %= 10**9 + 7
print(ans)
| false | 10 | [
"-kari = [i for i in range(N + 1)]"
] | false | 0.203928 | 0.122418 | 1.665825 | [
"s768757975",
"s459211162"
] |
u905582793 | p02996 | python | s130096287 | s904316046 | 950 | 619 | 53,724 | 53,616 | Accepted | Accepted | 34.84 | n=int(eval(input()))
a=[list(map(int,input().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t=0
for i in range(n):
t+=a[i][0]
if t>a[i][1]:
print("No")
break
elif i==n-1:
print("Yes")
| import sys
readline=sys.stdin.readline
n=int(eval(input()))
a=[list(map(int, readline().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t=0
for i in range(n):
t+=a[i][0]
if t>a[i][1]:
print("No")
break
elif i==n-1:
print("Yes") | 11 | 13 | 215 | 259 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t = 0
for i in range(n):
t += a[i][0]
if t > a[i][1]:
print("No")
break
elif i == n - 1:
print("Yes")
| import sys
readline = sys.stdin.readline
n = int(eval(input()))
a = [list(map(int, readline().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t = 0
for i in range(n):
t += a[i][0]
if t > a[i][1]:
print("No")
break
elif i == n - 1:
print("Yes")
| false | 15.384615 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-a = [list(map(int, input().split())) for _ in range(n)]",
"+a = [list(map(int, readline().split())) for _ in range(n)]"
] | false | 0.098028 | 0.074454 | 1.316628 | [
"s130096287",
"s904316046"
] |
u977389981 | p03031 | python | s950145023 | s489440205 | 198 | 37 | 41,456 | 9,136 | Accepted | Accepted | 81.31 | import itertools
N, M = list(map(int, input().split()))
S = []
for i in range(M):
k, *s = list(map(int, input().split()))
S.append(s)
P = [int(i) for i in input().split()]
A = [0, 1]
ans = 0
for i in itertools.product(A, repeat = N):
flag = 0
for j in range(M):
cnt = 0... | import itertools
n, m = list(map(int, input().split()))
S = []
for i in range(m):
s = list(map(int, input().split()))
S.append(s[1:])
P = [int(i) for i in input().split()]
A = [0, 1]
ans = 0
for a in itertools.product(A, repeat = n):
flag = 0
for j in range(m):
cnt = 0
... | 26 | 25 | 499 | 504 | import itertools
N, M = list(map(int, input().split()))
S = []
for i in range(M):
k, *s = list(map(int, input().split()))
S.append(s)
P = [int(i) for i in input().split()]
A = [0, 1]
ans = 0
for i in itertools.product(A, repeat=N):
flag = 0
for j in range(M):
cnt = 0
for s in S[j]:
... | import itertools
n, m = list(map(int, input().split()))
S = []
for i in range(m):
s = list(map(int, input().split()))
S.append(s[1:])
P = [int(i) for i in input().split()]
A = [0, 1]
ans = 0
for a in itertools.product(A, repeat=n):
flag = 0
for j in range(m):
cnt = 0
for s in S[j]:
... | false | 3.846154 | [
"-N, M = list(map(int, input().split()))",
"+n, m = list(map(int, input().split()))",
"-for i in range(M):",
"- k, *s = list(map(int, input().split()))",
"- S.append(s)",
"+for i in range(m):",
"+ s = list(map(int, input().split()))",
"+ S.append(s[1:])",
"-for i in itertools.product(A, ... | false | 0.046542 | 0.036841 | 1.263315 | [
"s950145023",
"s489440205"
] |
u070201429 | p03291 | python | s476870698 | s577397172 | 79 | 73 | 9,372 | 73,304 | Accepted | Accepted | 7.59 | def main():
mod = 10**9 + 7
s = eval(input())
n = len(s)
a_num = 0
c_num = s.count('C')
q_num = 0
q_cnt = s.count('?')
pows = [0] * 4
if q_cnt >= 3:
pows[3] = pow(3, q_cnt-3, mod)
pows[2] = pows[3] * 3 % mod
pows[1] = pows[2] * 3 % mod
... | def main():
mod = 10**9 + 7
s = eval(input())
n = len(s)
a_num = 0
c_num = s.count('C')
q_num = 0
q_cnt = s.count('?')
pow3, pow2, pow1, pow0 = 0, 0, 0, 0
if q_cnt >= 3:
pow3 = pow(3, q_cnt-3, mod)
pow2 = pow3 * 3 % mod
pow1 = pow2 * 3 % mod
... | 47 | 47 | 1,140 | 1,104 | def main():
mod = 10**9 + 7
s = eval(input())
n = len(s)
a_num = 0
c_num = s.count("C")
q_num = 0
q_cnt = s.count("?")
pows = [0] * 4
if q_cnt >= 3:
pows[3] = pow(3, q_cnt - 3, mod)
pows[2] = pows[3] * 3 % mod
pows[1] = pows[2] * 3 % mod
pows[0] = pows... | def main():
mod = 10**9 + 7
s = eval(input())
n = len(s)
a_num = 0
c_num = s.count("C")
q_num = 0
q_cnt = s.count("?")
pow3, pow2, pow1, pow0 = 0, 0, 0, 0
if q_cnt >= 3:
pow3 = pow(3, q_cnt - 3, mod)
pow2 = pow3 * 3 % mod
pow1 = pow2 * 3 % mod
pow0 = p... | false | 0 | [
"- pows = [0] * 4",
"+ pow3, pow2, pow1, pow0 = 0, 0, 0, 0",
"- pows[3] = pow(3, q_cnt - 3, mod)",
"- pows[2] = pows[3] * 3 % mod",
"- pows[1] = pows[2] * 3 % mod",
"- pows[0] = pows[1] * 3 % mod",
"+ pow3 = pow(3, q_cnt - 3, mod)",
"+ pow2 = pow3 * 3 % ... | false | 0.043956 | 0.047821 | 0.919175 | [
"s476870698",
"s577397172"
] |
u254871849 | p03108 | python | s583215773 | s918647901 | 395 | 320 | 34,952 | 34,764 | Accepted | Accepted | 18.99 | import sys
n, m, *ab = map(int, sys.stdin.read().split())
ab = list(zip(*[iter(ab)] * 2))
root = list(range(n+1)); root[0] = None
height = [0] * (n + 1); height[0] = None
size = [1] * (n + 1); size[0] = None
sys.setrecursionlimit(10 ** 9)
def find_root(v):
u = root[v]
if u == v:
return u... | import sys
n, m, *ab = map(int, sys.stdin.read().split())
ab = list(zip(*[iter(ab)] * 2))
root = list(range(n+1)); root[0] = None
height = [0] * (n + 1); height[0] = None
size = [1] * (n + 1); size[0] = None
sys.setrecursionlimit(10 ** 9)
def find_root(v):
u = root[v]
if u == v:
return u... | 65 | 46 | 1,473 | 1,011 | import sys
n, m, *ab = map(int, sys.stdin.read().split())
ab = list(zip(*[iter(ab)] * 2))
root = list(range(n + 1))
root[0] = None
height = [0] * (n + 1)
height[0] = None
size = [1] * (n + 1)
size[0] = None
sys.setrecursionlimit(10**9)
def find_root(v):
u = root[v]
if u == v:
return u
w = find_ro... | import sys
n, m, *ab = map(int, sys.stdin.read().split())
ab = list(zip(*[iter(ab)] * 2))
root = list(range(n + 1))
root[0] = None
height = [0] * (n + 1)
height[0] = None
size = [1] * (n + 1)
size[0] = None
sys.setrecursionlimit(10**9)
def find_root(v):
u = root[v]
if u == v:
return u
w = find_ro... | false | 29.230769 | [
"- return",
"+ return 0",
"+ sv = size[rv]",
"+ su = size[ru]",
"-",
"-",
"-def is_alone(v, rv, sv):",
"- return v == rv and sv == 1",
"+ return sv * su",
"- a, b = ab[m - i]",
"- ra = find_root(a)",
"- rb = find_root(b)",
"- sa = size[ra... | false | 0.045598 | 0.046795 | 0.974427 | [
"s583215773",
"s918647901"
] |
u879870653 | p02937 | python | s313252629 | s101947189 | 302 | 268 | 50,652 | 46,472 | Accepted | Accepted | 11.26 | from bisect import *
S = eval(input())
T = eval(input())
ds = {}
for i,s in enumerate(S) :
if s not in ds :
ds[s] = [i]
else :
ds[s].append(i)
L = []
ind = -1
flg = 0
cnt = 0
for t in T :
if t not in ds :
ans = -1
flg = 1
break
if flg == 0 :
... | from bisect import *
S = eval(input())
T = eval(input())
ds = {}
for i,s in enumerate(S) :
if s not in ds :
ds[s] = [i]
else :
ds[s].append(i)
ind = -1
cnt = 0
for t in T :
if t not in ds :
ans = -1
break
else :
for t in T :
if ds[t][-1] <= in... | 40 | 26 | 720 | 475 | from bisect import *
S = eval(input())
T = eval(input())
ds = {}
for i, s in enumerate(S):
if s not in ds:
ds[s] = [i]
else:
ds[s].append(i)
L = []
ind = -1
flg = 0
cnt = 0
for t in T:
if t not in ds:
ans = -1
flg = 1
break
if flg == 0:
for t in T:
if ind... | from bisect import *
S = eval(input())
T = eval(input())
ds = {}
for i, s in enumerate(S):
if s not in ds:
ds[s] = [i]
else:
ds[s].append(i)
ind = -1
cnt = 0
for t in T:
if t not in ds:
ans = -1
break
else:
for t in T:
if ds[t][-1] <= ind:
ind = ds[t]... | false | 35 | [
"-L = []",
"-flg = 0",
"- flg = 1",
"-if flg == 0:",
"+else:",
"- if ind >= ds[t][-1]:",
"+ if ds[t][-1] <= ind:",
"- L.append(ind)",
"- L.append(ind)",
"- ans = cnt * len(S) + L[-1] + 1",
"-\"\"\"",
"- cnt = 0",
"- val = L[0]",
"- for... | false | 0.050678 | 0.046783 | 1.083271 | [
"s313252629",
"s101947189"
] |
u564589929 | p03575 | python | s919245228 | s357251046 | 34 | 30 | 9,476 | 9,264 | Accepted | Accepted | 11.76 | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return... | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return... | 64 | 110 | 1,824 | 3,103 | import sys
sys.setrecursionlimit(10**9)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | import sys
sys.setrecursionlimit(10**9)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | false | 41.818182 | [
"-from collections import deque, defaultdict",
"-",
"+# from collections import deque, defaultdict",
"+\"\"\"",
"+https://note.nkmk.me/python-union-find/",
"+็ด ้ๅใใผใฟๆง้ ",
"+:parameter",
"+union(x, y): 2ใคใฎ้ๅใไธใคใซไฝตๅใใ",
"+find(x): xใใฉใฎ้ๅใซๅฑใใฆใใใใๅคๅฎใใ",
"+size(x): ่ฆ็ด xใๅฑใใใฐใซใผใใฎใตใคใบ๏ผ่ฆ็ด ๆฐ๏ผใ่ฟใ",
"+same(x, y)... | false | 0.055467 | 0.035993 | 1.541036 | [
"s919245228",
"s357251046"
] |
u723583932 | p03162 | python | s791830730 | s993814122 | 627 | 271 | 60,012 | 103,444 | Accepted | Accepted | 56.78 | n=int(eval(input()))
x=[[0]*3 for i in range(n)]
for i in range(n):
a,b,c=list(map(int,input().split()))
if i==0:
x[i][0]=a
x[i][1]=b
x[i][2]=c
else:
x[i][0]=max(x[i-1][1],x[i-1][2])+a
x[i][1]=max(x[i-1][0],x[i-1][2])+b
x[i][2]=max(x[i-1][0],x[i... | #dp[x][i]=xๆฅ็ฎใซใๅ ดๆiใธใ่กใใจใใฎๅนธ็ฆๅบฆใฎ็ทๅใฎๆๅคงๅค ้ฃๆฅiใซ่กใใใจใฏใงใใชใ็ธใใใใ
#็ดๅ๏ผๆจๆฅใซใใฃใๅ ดๆใjใจใใใจใj!=iใง่กจใใ
n=int(eval(input()))
dp=[[0 for i in range(3)]for j in range(n)]
happy=[]
for i in range(n):
a,b,c=list(map(int,input().split()))
happy.append((a,b,c))
for i in range(3):
dp[0][i]=happy[0][i]
for i in range(1,n):... | 15 | 18 | 343 | 556 | n = int(eval(input()))
x = [[0] * 3 for i in range(n)]
for i in range(n):
a, b, c = list(map(int, input().split()))
if i == 0:
x[i][0] = a
x[i][1] = b
x[i][2] = c
else:
x[i][0] = max(x[i - 1][1], x[i - 1][2]) + a
x[i][1] = max(x[i - 1][0], x[i - 1][2]) + b
x[i... | # dp[x][i]=xๆฅ็ฎใซใๅ ดๆiใธใ่กใใจใใฎๅนธ็ฆๅบฆใฎ็ทๅใฎๆๅคงๅค ้ฃๆฅiใซ่กใใใจใฏใงใใชใ็ธใใใใ
# ็ดๅ๏ผๆจๆฅใซใใฃใๅ ดๆใjใจใใใจใj!=iใง่กจใใ
n = int(eval(input()))
dp = [[0 for i in range(3)] for j in range(n)]
happy = []
for i in range(n):
a, b, c = list(map(int, input().split()))
happy.append((a, b, c))
for i in range(3):
dp[0][i] = happy[0][i]
for i in range(... | false | 16.666667 | [
"+# dp[x][i]=xๆฅ็ฎใซใๅ ดๆiใธใ่กใใจใใฎๅนธ็ฆๅบฆใฎ็ทๅใฎๆๅคงๅค ้ฃๆฅiใซ่กใใใจใฏใงใใชใ็ธใใใใ",
"+# ็ดๅ๏ผๆจๆฅใซใใฃใๅ ดๆใjใจใใใจใj!=iใง่กจใใ",
"-x = [[0] * 3 for i in range(n)]",
"+dp = [[0 for i in range(3)] for j in range(n)]",
"+happy = []",
"- if i == 0:",
"- x[i][0] = a",
"- x[i][1] = b",
"- x[i][2] = c",
"- else:"... | false | 0.047496 | 0.088501 | 0.536673 | [
"s791830730",
"s993814122"
] |
u370968771 | p03457 | python | s073937133 | s033776624 | 374 | 342 | 3,060 | 3,060 | Accepted | Accepted | 8.56 | #!/bin/env python3
N = int(eval(input()))
t_prev = x_prev = y_prev = 0
for i in range(N):
t_i, x_i, y_i = list(map(int, input().split()))
if (x_i+y_i)> t_i:
print("No")
exit()
elif (x_i+y_i) %2 != t_i%2 :
print("No")
exit()
elif (abs(x_i - x_prev) + abs(y... | #!/bin/env python3
N = int(eval(input()))
#t_prev = x_prev = y_prev = 0
for i in range(N):
t_i, x_i, y_i = list(map(int, input().split()))
if (x_i+y_i)> t_i:
print("No")
exit()
elif (x_i+y_i) %2 != t_i%2 :
print("No")
exit()
#elif (abs(x_i - x_prev) + abs... | 19 | 19 | 393 | 397 | #!/bin/env python3
N = int(eval(input()))
t_prev = x_prev = y_prev = 0
for i in range(N):
t_i, x_i, y_i = list(map(int, input().split()))
if (x_i + y_i) > t_i:
print("No")
exit()
elif (x_i + y_i) % 2 != t_i % 2:
print("No")
exit()
elif (abs(x_i - x_prev) + abs(y_i - y_pre... | #!/bin/env python3
N = int(eval(input()))
# t_prev = x_prev = y_prev = 0
for i in range(N):
t_i, x_i, y_i = list(map(int, input().split()))
if (x_i + y_i) > t_i:
print("No")
exit()
elif (x_i + y_i) % 2 != t_i % 2:
print("No")
exit()
# elif (abs(x_i - x_prev) + abs(y_i - y... | false | 0 | [
"-t_prev = x_prev = y_prev = 0",
"+# t_prev = x_prev = y_prev = 0",
"- elif (abs(x_i - x_prev) + abs(y_i - y_prev)) > (t_i - t_prev):",
"- print(\"No\")",
"- exit()",
"+ # elif (abs(x_i - x_prev) + abs(y_i - y_prev)) > (t_i - t_prev):",
"+ # print(\"No\")",
"+ # exit()"... | false | 0.034303 | 0.034783 | 0.986194 | [
"s073937133",
"s033776624"
] |
u596536048 | p03563 | python | s121077065 | s815542217 | 25 | 23 | 8,996 | 9,164 | Accepted | Accepted | 8 | print((-int(eval(input())) + int(eval(input())) * 2))
| current_rating = int(eval(input()))
final_rating = int(eval(input()))
performance = final_rating * 2 - current_rating
print(performance) | 1 | 4 | 40 | 127 | print((-int(eval(input())) + int(eval(input())) * 2))
| current_rating = int(eval(input()))
final_rating = int(eval(input()))
performance = final_rating * 2 - current_rating
print(performance)
| false | 75 | [
"-print((-int(eval(input())) + int(eval(input())) * 2))",
"+current_rating = int(eval(input()))",
"+final_rating = int(eval(input()))",
"+performance = final_rating * 2 - current_rating",
"+print(performance)"
] | false | 0.032472 | 0.053048 | 0.612134 | [
"s121077065",
"s815542217"
] |
u057109575 | p02814 | python | s144690562 | s505874222 | 489 | 444 | 93,408 | 96,824 | Accepted | Accepted | 9.2 | from fractions import gcd
from functools import reduce
def lcm(x, y):
return x * y // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm, numbers, 1)
def sub_by_2(n):
cnt = 0
while n % 2 == 0:
cnt += 1
n //= 2
return cnt
N, M = list(map(int, input().split()))
A =... | from functools import reduce
from fractions import gcd
N, M, *A = list(map(int, open(0).read().split()))
def lcm(x, y):
return x * y // gcd(x, y)
def sub_by_2(n):
cnt = 0
while n % 2 == 0:
n //= 2
cnt += 1
return cnt
lcm_2 = [sub_by_2(n // 2) for n in A]
if all(lcm_2[... | 26 | 22 | 540 | 455 | from fractions import gcd
from functools import reduce
def lcm(x, y):
return x * y // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm, numbers, 1)
def sub_by_2(n):
cnt = 0
while n % 2 == 0:
cnt += 1
n //= 2
return cnt
N, M = list(map(int, input().split()))
A = list(map(int... | from functools import reduce
from fractions import gcd
N, M, *A = list(map(int, open(0).read().split()))
def lcm(x, y):
return x * y // gcd(x, y)
def sub_by_2(n):
cnt = 0
while n % 2 == 0:
n //= 2
cnt += 1
return cnt
lcm_2 = [sub_by_2(n // 2) for n in A]
if all(lcm_2[0] == v for v... | false | 15.384615 | [
"+from functools import reduce",
"-from functools import reduce",
"+",
"+N, M, *A = list(map(int, open(0).read().split()))",
"-def lcm_list(numbers):",
"- return reduce(lcm, numbers, 1)",
"-",
"-",
"+ n //= 2",
"- n //= 2",
"-N, M = list(map(int, input().split()))",
"-A = list... | false | 0.056411 | 0.172616 | 0.326801 | [
"s144690562",
"s505874222"
] |
u571281863 | p02684 | python | s395733681 | s884806877 | 170 | 104 | 32,396 | 99,728 | Accepted | Accepted | 38.82 | N,K=list(map(int,input().split()))
t=list(map(int,input().split()))
g=[1]
h={1}
for i in range(N-1):
x=t[g[i]-1]
g.append(x)
if x in h:
break
h.add(x)
if K>len(g):
a=g.index(g[-1])
b=len(g)-a-1
K=(K-a)%b+a
print((g[K])) | N,K=list(map(int,input().split()))
t=list(map(int,input().split()))
g=[1]
for i in range(N-1):
g.append(t[g[i]-1])
if K>len(g):
a=g.index(g[-1])
b=len(g)-a-1
K=(K-a)%b+a
print((g[K])) | 15 | 10 | 243 | 192 | N, K = list(map(int, input().split()))
t = list(map(int, input().split()))
g = [1]
h = {1}
for i in range(N - 1):
x = t[g[i] - 1]
g.append(x)
if x in h:
break
h.add(x)
if K > len(g):
a = g.index(g[-1])
b = len(g) - a - 1
K = (K - a) % b + a
print((g[K]))
| N, K = list(map(int, input().split()))
t = list(map(int, input().split()))
g = [1]
for i in range(N - 1):
g.append(t[g[i] - 1])
if K > len(g):
a = g.index(g[-1])
b = len(g) - a - 1
K = (K - a) % b + a
print((g[K]))
| false | 33.333333 | [
"-h = {1}",
"- x = t[g[i] - 1]",
"- g.append(x)",
"- if x in h:",
"- break",
"- h.add(x)",
"+ g.append(t[g[i] - 1])"
] | false | 0.036753 | 0.044668 | 0.822805 | [
"s395733681",
"s884806877"
] |
u493520238 | p02924 | python | s407359874 | s688625079 | 72 | 66 | 61,660 | 61,548 | Accepted | Accepted | 8.33 | n = int(eval(input()))
print((n*(n-1)//2)) | n = int(eval(input()))
ans = (n-1)*n//2
print(ans) | 2 | 3 | 35 | 46 | n = int(eval(input()))
print((n * (n - 1) // 2))
| n = int(eval(input()))
ans = (n - 1) * n // 2
print(ans)
| false | 33.333333 | [
"-print((n * (n - 1) // 2))",
"+ans = (n - 1) * n // 2",
"+print(ans)"
] | false | 0.082144 | 0.008095 | 10.147116 | [
"s407359874",
"s688625079"
] |
u997641430 | p02679 | python | s831074392 | s187480639 | 1,190 | 1,097 | 87,904 | 73,192 | Accepted | Accepted | 7.82 | from math import gcd
n = int(eval(input()))
P = [tuple(map(int, input().split())) for i in range(n)]
C = {}
for x, y in P:
if x == 0 and y == 0:
x0, y0 = 0, 0
elif x != 0 and y == 0:
x0, y0 = 1, 0
elif x == 0 and y != 0:
x0, y0 = 0, 1
else:
g = gcd(x, y)
... | from math import gcd
n = int(eval(input()))
XY = [tuple(map(int, input().split())) for i in range(n)]
C = {}
z = 0
for x, y in XY:
if x == 0 and y == 0:
z += 1
continue
g = gcd(x, y)
x, y = x // g, y // g
if y < 0:
x, y = -x, -y
try:
C[(x, y)] += 1
... | 45 | 36 | 963 | 729 | from math import gcd
n = int(eval(input()))
P = [tuple(map(int, input().split())) for i in range(n)]
C = {}
for x, y in P:
if x == 0 and y == 0:
x0, y0 = 0, 0
elif x != 0 and y == 0:
x0, y0 = 1, 0
elif x == 0 and y != 0:
x0, y0 = 0, 1
else:
g = gcd(x, y)
x0, y0 =... | from math import gcd
n = int(eval(input()))
XY = [tuple(map(int, input().split())) for i in range(n)]
C = {}
z = 0
for x, y in XY:
if x == 0 and y == 0:
z += 1
continue
g = gcd(x, y)
x, y = x // g, y // g
if y < 0:
x, y = -x, -y
try:
C[(x, y)] += 1
except KeyErro... | false | 20 | [
"-P = [tuple(map(int, input().split())) for i in range(n)]",
"+XY = [tuple(map(int, input().split())) for i in range(n)]",
"-for x, y in P:",
"+z = 0",
"+for x, y in XY:",
"- x0, y0 = 0, 0",
"- elif x != 0 and y == 0:",
"- x0, y0 = 1, 0",
"- elif x == 0 and y != 0:",
"- ... | false | 0.087728 | 0.042915 | 2.044235 | [
"s831074392",
"s187480639"
] |
u727717182 | p02720 | python | s425413580 | s630860687 | 158 | 94 | 12,184 | 16,780 | Accepted | Accepted | 40.51 | from sys import stdin
import heapq
def main():
input = stdin.readline
K = int(eval(input()))
h = []
for i in range(1,10):
heapq.heappush(h,i)
for i in range(K):
ans = heapq.heappop(h)
if ans % 10 != 0:
heapq.heappush(h,ans * 10 + (an... | from sys import stdin
import heapq
def main():
input = stdin.readline
K = int(eval(input()))
h = []
for i in range(1,10):
h.append(i)
for i in range(K):
ans = h[i]
if ans % 10 != 0:
h.append(ans * 10 + (ans % 10 - 1))
h.append(a... | 26 | 40 | 519 | 848 | from sys import stdin
import heapq
def main():
input = stdin.readline
K = int(eval(input()))
h = []
for i in range(1, 10):
heapq.heappush(h, i)
for i in range(K):
ans = heapq.heappop(h)
if ans % 10 != 0:
heapq.heappush(h, ans * 10 + (ans % 10 - 1))
heapq... | from sys import stdin
import heapq
def main():
input = stdin.readline
K = int(eval(input()))
h = []
for i in range(1, 10):
h.append(i)
for i in range(K):
ans = h[i]
if ans % 10 != 0:
h.append(ans * 10 + (ans % 10 - 1))
h.append(ans * 10 + (ans % 10))
... | false | 35 | [
"- heapq.heappush(h, i)",
"+ h.append(i)",
"- ans = heapq.heappop(h)",
"+ ans = h[i]",
"- heapq.heappush(h, ans * 10 + (ans % 10 - 1))",
"- heapq.heappush(h, ans * 10 + (ans % 10))",
"+ h.append(ans * 10 + (ans % 10 - 1))",
"+ h.append(an... | false | 0.0763 | 0.046104 | 1.654975 | [
"s425413580",
"s630860687"
] |
u276204978 | p03089 | python | s306991125 | s174939363 | 26 | 17 | 3,952 | 2,940 | Accepted | Accepted | 34.62 | from queue import Queue
def solve():
N = int(eval(input()))
b = list(map(int, input().split()))
idx = [i+1 for i in reversed(list(range(N)))]
l = []
for i in range(N):
for bi, j in zip(reversed(b), idx):
if j == bi:
l.append(str(j))
... | def solve():
N = input()
a = ['']
for i in input().split():
a.insert(int(i)-1, i)
print(*a[-1]and[-1]or a)
solve()
| 18 | 8 | 426 | 146 | from queue import Queue
def solve():
N = int(eval(input()))
b = list(map(int, input().split()))
idx = [i + 1 for i in reversed(list(range(N)))]
l = []
for i in range(N):
for bi, j in zip(reversed(b), idx):
if j == bi:
l.append(str(j))
break
... | def solve():
N = input()
a = [""]
for i in input().split():
a.insert(int(i) - 1, i)
print(*a[-1] and [-1] or a)
solve()
| false | 55.555556 | [
"-from queue import Queue",
"+def solve():",
"+ N = input()",
"+ a = [\"\"]",
"+ for i in input().split():",
"+ a.insert(int(i) - 1, i)",
"+ print(*a[-1] and [-1] or a)",
"-def solve():",
"- N = int(eval(input()))",
"- b = list(map(int, input().split()))",
"- idx = [i... | false | 0.036732 | 0.091498 | 0.401446 | [
"s306991125",
"s174939363"
] |
u728566015 | p03673 | python | s310371124 | s588526189 | 165 | 66 | 40,004 | 26,180 | Accepted | Accepted | 60 | N = int(eval(input()))
A = list(map(int, input().split()))
index = []
if N % 2 == 0:
for i in range(N - 1, 0, -2):
index.append(i)
for j in range(0, N - 1, 2):
index.append(j)
else:
for i in range(N - 1, -1, -2):
index.append(i)
for j in range(1, N - 1, 2):
... | N = int(eval(input()))
A = list(map(str, input().split()))
B = A[::2][::-1] + A[1::2]
if N % 2 == 0:
B = B[::-1]
print((' '.join(B))) | 19 | 7 | 402 | 136 | N = int(eval(input()))
A = list(map(int, input().split()))
index = []
if N % 2 == 0:
for i in range(N - 1, 0, -2):
index.append(i)
for j in range(0, N - 1, 2):
index.append(j)
else:
for i in range(N - 1, -1, -2):
index.append(i)
for j in range(1, N - 1, 2):
index.append(j... | N = int(eval(input()))
A = list(map(str, input().split()))
B = A[::2][::-1] + A[1::2]
if N % 2 == 0:
B = B[::-1]
print((" ".join(B)))
| false | 63.157895 | [
"-A = list(map(int, input().split()))",
"-index = []",
"+A = list(map(str, input().split()))",
"+B = A[::2][::-1] + A[1::2]",
"- for i in range(N - 1, 0, -2):",
"- index.append(i)",
"- for j in range(0, N - 1, 2):",
"- index.append(j)",
"-else:",
"- for i in range(N - 1, -1,... | false | 0.122232 | 0.112108 | 1.090297 | [
"s310371124",
"s588526189"
] |
u453055089 | p03161 | python | s961107239 | s032863017 | 471 | 223 | 56,928 | 85,680 | Accepted | Accepted | 52.65 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(n)]
dp[0] = 0
for i in range(n-1):
for j in range(1, min(k+1, n-i)):
dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
print((dp[n-1])) | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")]*n
dp[0] = 0
for i in range(1, n):
for j in range(1, k+1):
if i-j >= 0:
dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]))
print((dp[n-1])) | 10 | 9 | 260 | 253 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(n)]
dp[0] = 0
for i in range(n - 1):
for j in range(1, min(k + 1, n - i)):
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print((dp[n - 1]))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
for j in range(1, k + 1):
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print((dp[n - 1]))
| false | 10 | [
"-dp = [float(\"inf\") for _ in range(n)]",
"+dp = [float(\"inf\")] * n",
"-for i in range(n - 1):",
"- for j in range(1, min(k + 1, n - i)):",
"- dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))",
"+for i in range(1, n):",
"+ for j in range(1, k + 1):",
"+ if i - j >= 0:",... | false | 0.046337 | 0.035936 | 1.289428 | [
"s961107239",
"s032863017"
] |
u380524497 | p02839 | python | s098323275 | s411376018 | 1,275 | 58 | 13,752 | 3,316 | Accepted | Accepted | 95.45 | import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
A = []
for i in range(h):
line = list(map(int, input().split()))
A.append(line)
for i in range(h):
line = list(map(int, input().split()))
for j, num in enumerate(line):
A[i][j] = abs(A[i][j] - num)
... | h, w = list(map(int, input().split()))
A = []
for i in range(h):
line = list(map(int, input().split()))
A.append(line)
for i in range(h):
line = list(map(int, input().split()))
for j, num in enumerate(line):
A[i][j] = abs(A[i][j] - num)
const = 6400
mask = 1 << const
DP = [0]*w
... | 50 | 46 | 954 | 916 | import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
A = []
for i in range(h):
line = list(map(int, input().split()))
A.append(line)
for i in range(h):
line = list(map(int, input().split()))
for j, num in enumerate(line):
A[i][j] = abs(A[i][j] - num)
const = 640000
bitse... | h, w = list(map(int, input().split()))
A = []
for i in range(h):
line = list(map(int, input().split()))
A.append(line)
for i in range(h):
line = list(map(int, input().split()))
for j, num in enumerate(line):
A[i][j] = abs(A[i][j] - num)
const = 6400
mask = 1 << const
DP = [0] * w
DP[0] = mask >>... | false | 8 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-const = 640000",
"-bitset = 1 << const",
"+const = 6400",
"+mask = 1 << const",
"-DP[0] = bitset >> A[0][0]",
"+DP[0] = mask >> A[0][0]",
"-ans = DP[w - 1]",
"+pattern = DP[w - 1]",
"- if (ans >> const + i) & 1 or (ans >> const - i) & 1:"... | false | 0.038223 | 0.035149 | 1.087451 | [
"s098323275",
"s411376018"
] |
u155687575 | p03479 | python | s649670145 | s016364461 | 167 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.82 | x, y = list(map(int, input().split()))
a = []
t = x
while True:
if t > y:
break
a.append(t)
t *= 2
print((len(a))) | x, y = list(map(int, input().split()))
total = 1
now = x
while now*2 <= y:
now *= 2
total += 1
print(total) | 11 | 7 | 138 | 115 | x, y = list(map(int, input().split()))
a = []
t = x
while True:
if t > y:
break
a.append(t)
t *= 2
print((len(a)))
| x, y = list(map(int, input().split()))
total = 1
now = x
while now * 2 <= y:
now *= 2
total += 1
print(total)
| false | 36.363636 | [
"-a = []",
"-t = x",
"-while True:",
"- if t > y:",
"- break",
"- a.append(t)",
"- t *= 2",
"-print((len(a)))",
"+total = 1",
"+now = x",
"+while now * 2 <= y:",
"+ now *= 2",
"+ total += 1",
"+print(total)"
] | false | 0.039651 | 0.03857 | 1.02803 | [
"s649670145",
"s016364461"
] |
u767543103 | p03031 | python | s116293598 | s752983974 | 290 | 259 | 12,508 | 14,456 | Accepted | Accepted | 10.69 | import numpy as np
import itertools as ittr
def test_switch(e_balls, sw, p):
for i, e_ball in enumerate(e_balls):
eb = np.asarray(e_ball)
si = sw[eb - 1]
if p[i] != (np.sum(si == 1) % 2):
return False
return True
N, M = list(map(int, input().split... | import numpy as np
import itertools as ittr
def test_switch(e_balls, sw, p):
for i, e_ball in enumerate(e_balls):
si = sw[e_ball - 1]
if p[i] != (np.sum(si == 1) % 2):
return False
return True
N, M = list(map(int, input().split()))
e_balls = []
for m... | 31 | 30 | 622 | 602 | import numpy as np
import itertools as ittr
def test_switch(e_balls, sw, p):
for i, e_ball in enumerate(e_balls):
eb = np.asarray(e_ball)
si = sw[eb - 1]
if p[i] != (np.sum(si == 1) % 2):
return False
return True
N, M = list(map(int, input().split()))
e_balls = []
for m i... | import numpy as np
import itertools as ittr
def test_switch(e_balls, sw, p):
for i, e_ball in enumerate(e_balls):
si = sw[e_ball - 1]
if p[i] != (np.sum(si == 1) % 2):
return False
return True
N, M = list(map(int, input().split()))
e_balls = []
for m in range(M):
i = input().... | false | 3.225806 | [
"- eb = np.asarray(e_ball)",
"- si = sw[eb - 1]",
"+ si = sw[e_ball - 1]",
"- e_balls.append(s[:])",
"+ e_balls.append(np.asarray(s))"
] | false | 0.54509 | 0.233109 | 2.338346 | [
"s116293598",
"s752983974"
] |
u906501980 | p03372 | python | s354908570 | s737926703 | 712 | 459 | 69,208 | 44,772 | Accepted | Accepted | 35.53 | def main():
n, c = list(map(int, input().split()))
xv = [None]*n
for i in range(n):
xv[i] = list(map(int, input().split()))
v, left_max, right_max = 0, 0, 0
gl = [None]*n
gr = [None]*n
_2oas = [None]*(n+1)
_2obs = [None]*(n+1)
_2oas[0], _2obs[0] = 0, 0
ans = 0
... | def main():
n, c = list(map(int, input().split()))
xv = [list(map(int, input().split())) for _ in range(n)]
v, left_max, right_max = 0, 0, 0
gl = [None]*n
gr = [None]*n
_2oas = [None]*(n+1)
_2obs = [None]*(n+1)
_2oas[0], _2obs[0] = 0, 0
ans = 0
for i, (xi, vi) in enumer... | 33 | 31 | 920 | 884 | def main():
n, c = list(map(int, input().split()))
xv = [None] * n
for i in range(n):
xv[i] = list(map(int, input().split()))
v, left_max, right_max = 0, 0, 0
gl = [None] * n
gr = [None] * n
_2oas = [None] * (n + 1)
_2obs = [None] * (n + 1)
_2oas[0], _2obs[0] = 0, 0
ans =... | def main():
n, c = list(map(int, input().split()))
xv = [list(map(int, input().split())) for _ in range(n)]
v, left_max, right_max = 0, 0, 0
gl = [None] * n
gr = [None] * n
_2oas = [None] * (n + 1)
_2obs = [None] * (n + 1)
_2oas[0], _2obs[0] = 0, 0
ans = 0
for i, (xi, vi) in enum... | false | 6.060606 | [
"- xv = [None] * n",
"- for i in range(n):",
"- xv[i] = list(map(int, input().split()))",
"+ xv = [list(map(int, input().split())) for _ in range(n)]",
"- v = v + vi",
"+ v += vi",
"- v = v + vi",
"+ v += vi"
] | false | 0.044222 | 0.124687 | 0.354662 | [
"s354908570",
"s737926703"
] |
u413165887 | p02733 | python | s995145195 | s051197779 | 968 | 717 | 54,104 | 50,140 | Accepted | Accepted | 25.93 | h, w, k = list(map(int, input().split()))
s = [list(map(int, list(eval(input())))) for _ in range(h)]
result = []
if h*w<=k:
result.append(0)
else:
for i in range(2**(h-1)):
checker, num = 0, i
while num > 0:
checker += num%2
num >>= 1
x = 0
c ... | h, w, k = list(map(int, input().split()))
s = [list(map(int, list(eval(input())))) for _ in range(h)]
result = []
if h*w<=k:
result.append(0)
else:
for i in range(2**(h-1)):
checker, num = 0, i
while num > 0:
checker += num%2
num >>= 1
x = 0
c ... | 33 | 33 | 953 | 923 | h, w, k = list(map(int, input().split()))
s = [list(map(int, list(eval(input())))) for _ in range(h)]
result = []
if h * w <= k:
result.append(0)
else:
for i in range(2 ** (h - 1)):
checker, num = 0, i
while num > 0:
checker += num % 2
num >>= 1
x = 0
c = ... | h, w, k = list(map(int, input().split()))
s = [list(map(int, list(eval(input())))) for _ in range(h)]
result = []
if h * w <= k:
result.append(0)
else:
for i in range(2 ** (h - 1)):
checker, num = 0, i
while num > 0:
checker += num % 2
num >>= 1
x = 0
c = ... | false | 0 | [
"- if any(nex[m] > k for m in range(checker + 1)):",
"+ if max(nex) > k:"
] | false | 0.069087 | 0.098765 | 0.69951 | [
"s995145195",
"s051197779"
] |
u970197315 | p03287 | python | s073703246 | s559772482 | 133 | 101 | 14,696 | 20,728 | Accepted | Accepted | 24.06 | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
from collections import Counter
c=Counter()
s=0
c[s]+=1
for i in range(n):
s+=a[i]
c[s%m]+=1
ans=0
for v in list(c.values()):
ans+=v*(v-1)//2
print(ans)
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter()
sum_val = 0
c[sum_val] += 1
for i in range(n):
sum_val += a[i]
sum_val %= m
c[sum_val] += 1
ans = 0
for v in list(c.values()):
ans += v*(v-1)//2
print(ans)
| 15 | 16 | 231 | 298 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter()
s = 0
c[s] += 1
for i in range(n):
s += a[i]
c[s % m] += 1
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter()
sum_val = 0
c[sum_val] += 1
for i in range(n):
sum_val += a[i]
sum_val %= m
c[sum_val] += 1
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 6.25 | [
"-s = 0",
"-c[s] += 1",
"+sum_val = 0",
"+c[sum_val] += 1",
"- s += a[i]",
"- c[s % m] += 1",
"+ sum_val += a[i]",
"+ sum_val %= m",
"+ c[sum_val] += 1"
] | false | 0.040584 | 0.040974 | 0.9905 | [
"s073703246",
"s559772482"
] |
u955251526 | p03240 | python | s234151688 | s046407605 | 495 | 34 | 3,064 | 3,192 | Accepted | Accepted | 93.13 | n = int(eval(input()))
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
x[i], y[i], h[i] = list(map(int, input().split()))
for a in range(101):
for b in range(101):
hset = set()
for i in range(n):
if h[i] != 0:
hset.add(h[i] + abs(x[i]-a) + abs(y[i]-b... | n = int(eval(input()))
info = [tuple(map(int, input().split())) for _ in range(n)]
nonzeroinfo = []
for x, y, h in info:
if h > 0:
nonzeroinfo.append((x, y, h))
zeroinfo = []
for x, y, h in info:
if h == 0:
zeroinfo.append((x, y, h))
def checknonzero(x, y, h):
for a, b, c in nonze... | 24 | 29 | 698 | 814 | n = int(eval(input()))
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
x[i], y[i], h[i] = list(map(int, input().split()))
for a in range(101):
for b in range(101):
hset = set()
for i in range(n):
if h[i] != 0:
hset.add(h[i] + abs(x[i] - a) + abs(y[i] - b))
... | n = int(eval(input()))
info = [tuple(map(int, input().split())) for _ in range(n)]
nonzeroinfo = []
for x, y, h in info:
if h > 0:
nonzeroinfo.append((x, y, h))
zeroinfo = []
for x, y, h in info:
if h == 0:
zeroinfo.append((x, y, h))
def checknonzero(x, y, h):
for a, b, c in nonzeroinfo:
... | false | 17.241379 | [
"-x = [0] * n",
"-y = [0] * n",
"-h = [0] * n",
"-for i in range(n):",
"- x[i], y[i], h[i] = list(map(int, input().split()))",
"-for a in range(101):",
"- for b in range(101):",
"- hset = set()",
"- for i in range(n):",
"- if h[i] != 0:",
"- hset.add... | false | 0.047334 | 0.036932 | 1.28163 | [
"s234151688",
"s046407605"
] |
u730769327 | p03608 | python | s307988544 | s717689468 | 253 | 211 | 78,800 | 74,556 | Accepted | Accepted | 16.6 | from itertools import permutations
INF=10**18
n,m,r=list(map(int,input().split()))
dist=[[INF for _ in range(n+1)]for _ in range(n+1)]
dp=[[-1 for _ in range(r+1)]for _ in range((1<<r)+1)]
r_t=list(map(int,input().split()))
for i in range(n+1):
dist[i][i]=0
for _ in range(m):
a,b,c=list(map(int,input().sp... | from itertools import*
n,m,r=list(map(int,input().split()))
rc=list(map(int,input().split()))
INF=10**18
d=[[INF]*n for _ in range(n)]
for _ in range(m):
a,b,c=list(map(int,input().split()))
d[a-1][b-1]=c
d[b-1][a-1]=c
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j]=min(d[... | 24 | 21 | 632 | 469 | from itertools import permutations
INF = 10**18
n, m, r = list(map(int, input().split()))
dist = [[INF for _ in range(n + 1)] for _ in range(n + 1)]
dp = [[-1 for _ in range(r + 1)] for _ in range((1 << r) + 1)]
r_t = list(map(int, input().split()))
for i in range(n + 1):
dist[i][i] = 0
for _ in range(m):
a, b... | from itertools import *
n, m, r = list(map(int, input().split()))
rc = list(map(int, input().split()))
INF = 10**18
d = [[INF] * n for _ in range(n)]
for _ in range(m):
a, b, c = list(map(int, input().split()))
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
for k in range(n):
for i in range(n):
for j ... | false | 12.5 | [
"-from itertools import permutations",
"+from itertools import *",
"+n, m, r = list(map(int, input().split()))",
"+rc = list(map(int, input().split()))",
"-n, m, r = list(map(int, input().split()))",
"-dist = [[INF for _ in range(n + 1)] for _ in range(n + 1)]",
"-dp = [[-1 for _ in range(r + 1)] for _ ... | false | 0.035878 | 0.035739 | 1.003896 | [
"s307988544",
"s717689468"
] |
u766684188 | p03063 | python | s545648600 | s052366933 | 254 | 234 | 15,748 | 14,180 | Accepted | Accepted | 7.87 | n=int(eval(input()))
S=list(eval(input()))
if len(set(S))==1:
print((0))
exit()
W,B=[0]*n,[0]*n
if S[0]=='.':
W[0]=1
else:
B[0]=1
for i in range(1,n):
if S[i]=='.':
W[i]=W[i-1]+1
B[i]=B[i-1]
else:
W[i]=W[i-1]
B[i]=B[i-1]+1
cnt1=float('inf')
for i... | n=int(eval(input()))
S=list(eval(input()))
W,B=[0]*(n+1),[0]*(n+1)
for i in range(n):
if S[i]=='.':
W[i+1]=W[i]+1
B[i+1]=B[i]
else:
W[i+1]=W[i]
B[i+1]=B[i]+1
ans=float('inf')
for i in range(n+1):
w=W[i]
b=B[-1]-B[i]
tmp=n-w-b
ans=min(ans,tmp)
print... | 32 | 17 | 588 | 313 | n = int(eval(input()))
S = list(eval(input()))
if len(set(S)) == 1:
print((0))
exit()
W, B = [0] * n, [0] * n
if S[0] == ".":
W[0] = 1
else:
B[0] = 1
for i in range(1, n):
if S[i] == ".":
W[i] = W[i - 1] + 1
B[i] = B[i - 1]
else:
W[i] = W[i - 1]
B[i] = B[i - 1] + ... | n = int(eval(input()))
S = list(eval(input()))
W, B = [0] * (n + 1), [0] * (n + 1)
for i in range(n):
if S[i] == ".":
W[i + 1] = W[i] + 1
B[i + 1] = B[i]
else:
W[i + 1] = W[i]
B[i + 1] = B[i] + 1
ans = float("inf")
for i in range(n + 1):
w = W[i]
b = B[-1] - B[i]
tmp ... | false | 46.875 | [
"-if len(set(S)) == 1:",
"- print((0))",
"- exit()",
"-W, B = [0] * n, [0] * n",
"-if S[0] == \".\":",
"- W[0] = 1",
"-else:",
"- B[0] = 1",
"-for i in range(1, n):",
"+W, B = [0] * (n + 1), [0] * (n + 1)",
"+for i in range(n):",
"- W[i] = W[i - 1] + 1",
"- B[i] = B... | false | 0.08867 | 0.04158 | 2.132489 | [
"s545648600",
"s052366933"
] |
u920977317 | p02691 | python | s078207144 | s231003084 | 243 | 168 | 60,880 | 146,092 | Accepted | Accepted | 30.86 | #j-i=Ai+Aj(j>i)
#j-Aj=Ai+i
#Lj=Ri=X
from bisect import bisect_left
def main():
N=int(eval(input()))
A=list(map(int,input().split()))
L={}
R={}
res=0
for i in range(N):
l=(i+1)-A[i]
r=A[i]+i+1
if (l in list(R.keys())):
res+=len(R[l])
... | def main():
N=int(eval(input()))
A=list(map(int,input().split()))
L={}
R={}
for i in range(N):
l=(i+1)+A[i]
r=(i+1)-A[i]
if (l in list(L.keys())):
L[l]+=1
else:
L[l]=1
if r in list(R.keys()):
R[r]+=1
... | 33 | 27 | 469 | 486 | # j-i=Ai+Aj(j>i)
# j-Aj=Ai+i
# Lj=Ri=X
from bisect import bisect_left
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
L = {}
R = {}
res = 0
for i in range(N):
l = (i + 1) - A[i]
r = A[i] + i + 1
if l in list(R.keys()):
res += len(R[l])... | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
L = {}
R = {}
for i in range(N):
l = (i + 1) + A[i]
r = (i + 1) - A[i]
if l in list(L.keys()):
L[l] += 1
else:
L[l] = 1
if r in list(R.keys()):
R[r] += 1... | false | 18.181818 | [
"-# j-i=Ai+Aj(j>i)",
"-# j-Aj=Ai+i",
"-# Lj=Ri=X",
"-from bisect import bisect_left",
"-",
"-",
"+ for i in range(N):",
"+ l = (i + 1) + A[i]",
"+ r = (i + 1) - A[i]",
"+ if l in list(L.keys()):",
"+ L[l] += 1",
"+ else:",
"+ L[l] = 1",
... | false | 0.040949 | 0.055351 | 0.739803 | [
"s078207144",
"s231003084"
] |
u930705402 | p03294 | python | s628130109 | s331288261 | 172 | 18 | 5,344 | 3,316 | Accepted | Accepted | 89.53 | import fractions
def lcm(a,b):
return (a*b)//fractions.gcd(a,b)
N=int(eval(input()))
a=list(map(int,input().split()))
tmp=a[0]
for i in range(1,N):
tmp=lcm(tmp,a[i])
tmp-=1
ans=0
for i in range(N):
ans+=tmp%a[i]
print(ans) | N=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in range(N):
ans+=a[i]-1
print(ans) | 15 | 6 | 244 | 104 | import fractions
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)
N = int(eval(input()))
a = list(map(int, input().split()))
tmp = a[0]
for i in range(1, N):
tmp = lcm(tmp, a[i])
tmp -= 1
ans = 0
for i in range(N):
ans += tmp % a[i]
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
ans += a[i] - 1
print(ans)
| false | 60 | [
"-import fractions",
"-",
"-",
"-def lcm(a, b):",
"- return (a * b) // fractions.gcd(a, b)",
"-",
"-",
"-tmp = a[0]",
"-for i in range(1, N):",
"- tmp = lcm(tmp, a[i])",
"-tmp -= 1",
"- ans += tmp % a[i]",
"+ ans += a[i] - 1"
] | false | 0.165077 | 0.007254 | 22.755555 | [
"s628130109",
"s331288261"
] |
u028973125 | p02628 | python | s084311188 | s537683348 | 30 | 26 | 9,284 | 9,088 | Accepted | Accepted | 13.33 | import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
P = list(map(int, sys.stdin.readline().strip().split()))
ans = 0
for i, p in enumerate(sorted(P)):
if i == K:
break
ans += p
print(ans) | import sys
N, K = list(map(int, sys.stdin.readline().split()))
P = list(map(int, sys.stdin.readline().split()))
P.sort()
print((sum(P[0:K]))) | 12 | 7 | 230 | 141 | import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
P = list(map(int, sys.stdin.readline().strip().split()))
ans = 0
for i, p in enumerate(sorted(P)):
if i == K:
break
ans += p
print(ans)
| import sys
N, K = list(map(int, sys.stdin.readline().split()))
P = list(map(int, sys.stdin.readline().split()))
P.sort()
print((sum(P[0:K])))
| false | 41.666667 | [
"-N, K = list(map(int, sys.stdin.readline().strip().split()))",
"-P = list(map(int, sys.stdin.readline().strip().split()))",
"-ans = 0",
"-for i, p in enumerate(sorted(P)):",
"- if i == K:",
"- break",
"- ans += p",
"-print(ans)",
"+N, K = list(map(int, sys.stdin.readline().split()))",
... | false | 0.037569 | 0.037302 | 1.007166 | [
"s084311188",
"s537683348"
] |
u860546679 | p03331 | python | s614004304 | s612744561 | 1,274 | 180 | 14,720 | 3,060 | Accepted | Accepted | 85.87 | N=int(eval(input()))
import numpy as np
a=np.arange(N)
a=np.delete(a,0)
b=N-a
num_arr=[]
for i in range(len(a)):
factor_a=[int(x) for x in list(str(a[i]))]
factor_b=[int(x) for x in list(str(b[i]))]
num_arr.append(sum(factor_a)+sum(factor_b))
print((min(num_arr)))
| N=int(eval(input()))
def SumOfDigits(n):
ans=0
while(True):
if n==0:
break
ans+=n%10
n=n//10
return ans
ans=N
for a in range(N):
if a!=0:
b=N-a
if ans>SumOfDigits(a)+SumOfDigits(b):
ans=SumOfDigits(a)+SumOfDigits(b)
print(ans)
| 17 | 18 | 282 | 260 | N = int(eval(input()))
import numpy as np
a = np.arange(N)
a = np.delete(a, 0)
b = N - a
num_arr = []
for i in range(len(a)):
factor_a = [int(x) for x in list(str(a[i]))]
factor_b = [int(x) for x in list(str(b[i]))]
num_arr.append(sum(factor_a) + sum(factor_b))
print((min(num_arr)))
| N = int(eval(input()))
def SumOfDigits(n):
ans = 0
while True:
if n == 0:
break
ans += n % 10
n = n // 10
return ans
ans = N
for a in range(N):
if a != 0:
b = N - a
if ans > SumOfDigits(a) + SumOfDigits(b):
ans = SumOfDigits(a) + SumOfD... | false | 5.555556 | [
"-import numpy as np",
"-a = np.arange(N)",
"-a = np.delete(a, 0)",
"-b = N - a",
"-num_arr = []",
"-for i in range(len(a)):",
"- factor_a = [int(x) for x in list(str(a[i]))]",
"- factor_b = [int(x) for x in list(str(b[i]))]",
"- num_arr.append(sum(factor_a) + sum(factor_b))",
"-print((mi... | false | 0.572441 | 0.065409 | 8.751682 | [
"s614004304",
"s612744561"
] |
u089230684 | p03161 | python | s457290105 | s510898632 | 351 | 189 | 52,444 | 85,868 | Accepted | Accepted | 46.15 | import sys
stdin = sys.stdin
mod = 1000000007
inf = 1 << 60
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()
n, k = na()
h = na()
dp = [inf] * n
dp[0] = 0
for i in range(n):
for j in rang... | n, k = list(map(int,input().split()))
pedras = list(map(int,input().split()))
INF = 1e12
dp = [INF] * n
dp[0] = 0
dp[1] = abs(pedras[1] - pedras[0])
for i in range(2,n):
pulo = 0
for j in range(i-1,-1,-1):
pulo += 1
if pulo > k:
break
else:
... | 23 | 22 | 446 | 389 | import sys
stdin = sys.stdin
mod = 1000000007
inf = 1 << 60
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()
n, k = na()
h = na()
dp = [inf] * n
dp[0] = 0
for i in range(n):
for j in range(1, k + 1):
i... | n, k = list(map(int, input().split()))
pedras = list(map(int, input().split()))
INF = 1e12
dp = [INF] * n
dp[0] = 0
dp[1] = abs(pedras[1] - pedras[0])
for i in range(2, n):
pulo = 0
for j in range(i - 1, -1, -1):
pulo += 1
if pulo > k:
break
else:
dp[i] = min(dp[i... | false | 4.347826 | [
"-import sys",
"-",
"-stdin = sys.stdin",
"-mod = 1000000007",
"-inf = 1 << 60",
"-ni = lambda: int(ns())",
"-na = lambda: list(map(int, stdin.readline().split()))",
"-ns = lambda: stdin.readline().rstrip()",
"-nas = lambda: stdin.readline().split()",
"-n, k = na()",
"-h = na()",
"-dp = [inf] ... | false | 0.052497 | 0.040712 | 1.289474 | [
"s457290105",
"s510898632"
] |
u802963389 | p03145 | python | s574076167 | s155216229 | 21 | 19 | 3,316 | 2,940 | Accepted | Accepted | 9.52 | e = list(map(int, input().split()))
e.sort()
print((int(e[0]*e[1]*(1/2)))) | a, b, c = list(map(int, input().split()))
print((int(a*b/2))) | 3 | 2 | 74 | 54 | e = list(map(int, input().split()))
e.sort()
print((int(e[0] * e[1] * (1 / 2))))
| a, b, c = list(map(int, input().split()))
print((int(a * b / 2)))
| false | 33.333333 | [
"-e = list(map(int, input().split()))",
"-e.sort()",
"-print((int(e[0] * e[1] * (1 / 2))))",
"+a, b, c = list(map(int, input().split()))",
"+print((int(a * b / 2)))"
] | false | 0.040866 | 0.007748 | 5.274208 | [
"s574076167",
"s155216229"
] |
u046187684 | p02820 | python | s759846784 | s368208535 | 70 | 36 | 3,316 | 5,492 | Accepted | Accepted | 48.57 | def solve(string):
*nkrsp, t = string.split()
n, k, *rsp = list(map(int, nkrsp))
table = {k: v for k, v in zip("spr", rsp)}
ans = 0
for s in range(k):
u = t[s::k]
i = 0
while i < len(u):
c = 1
while i < len(u) - 1 and u[i] == u[i + 1]:
... | def solve(string):
*nkrsp, t = string.split()
t = list(t)
n, k, *rsp = list(map(int, nkrsp))
b = {k: v for k, v in zip("spr", rsp)}
ans = sum([b[k] for k in t[:k]])
for i, _t in enumerate(t[k:]):
if _t == t[i]:
t[i + k] = "x"
else:
ans += b[_t]
... | 21 | 17 | 536 | 426 | def solve(string):
*nkrsp, t = string.split()
n, k, *rsp = list(map(int, nkrsp))
table = {k: v for k, v in zip("spr", rsp)}
ans = 0
for s in range(k):
u = t[s::k]
i = 0
while i < len(u):
c = 1
while i < len(u) - 1 and u[i] == u[i + 1]:
... | def solve(string):
*nkrsp, t = string.split()
t = list(t)
n, k, *rsp = list(map(int, nkrsp))
b = {k: v for k, v in zip("spr", rsp)}
ans = sum([b[k] for k in t[:k]])
for i, _t in enumerate(t[k:]):
if _t == t[i]:
t[i + k] = "x"
else:
ans += b[_t]
return ... | false | 19.047619 | [
"+ t = list(t)",
"- table = {k: v for k, v in zip(\"spr\", rsp)}",
"- ans = 0",
"- for s in range(k):",
"- u = t[s::k]",
"- i = 0",
"- while i < len(u):",
"- c = 1",
"- while i < len(u) - 1 and u[i] == u[i + 1]:",
"- i += 1",
... | false | 0.038189 | 0.037568 | 1.016535 | [
"s759846784",
"s368208535"
] |
u220345792 | p03317 | python | s093086696 | s638032813 | 40 | 17 | 14,008 | 3,060 | Accepted | Accepted | 57.5 | M, N =list(map(int, input().split()))
A =list(map(int, input().split()))
print((-(-(M-1)//(N-1)))) | M, N =list(map(int, input().split()))
print((-(-(M-1)//(N-1)))) | 3 | 2 | 92 | 56 | M, N = list(map(int, input().split()))
A = list(map(int, input().split()))
print((-(-(M - 1) // (N - 1))))
| M, N = list(map(int, input().split()))
print((-(-(M - 1) // (N - 1))))
| false | 33.333333 | [
"-A = list(map(int, input().split()))"
] | false | 0.075773 | 0.040667 | 1.863247 | [
"s093086696",
"s638032813"
] |
u764956288 | p03208 | python | s793690492 | s498780844 | 238 | 216 | 12,060 | 11,980 | Accepted | Accepted | 9.24 | N,K = list(map(int, input().split()))
trees = [int(eval(input())) for _ in range(N)]
def solve(N,K,trees):
trees.sort()
diffs = []
for i,h in enumerate(trees[:N-K+1]):
min_h = h
max_h = trees[i+K-1]
#print(min_h,max_h)
diffs.append(max_h-min_h)
print((min(... | N,K = list(map(int, input().split()))
trees = [int(eval(input())) for _ in range(N)]
def solve(N,K,trees):
trees.sort()
diffs = [max_h-min_h for min_h,max_h in zip(trees,trees[K-1:])]
ans = min(diffs)
print(ans)
return
solve(N,K,trees) | 17 | 12 | 346 | 261 | N, K = list(map(int, input().split()))
trees = [int(eval(input())) for _ in range(N)]
def solve(N, K, trees):
trees.sort()
diffs = []
for i, h in enumerate(trees[: N - K + 1]):
min_h = h
max_h = trees[i + K - 1]
# print(min_h,max_h)
diffs.append(max_h - min_h)
print((mi... | N, K = list(map(int, input().split()))
trees = [int(eval(input())) for _ in range(N)]
def solve(N, K, trees):
trees.sort()
diffs = [max_h - min_h for min_h, max_h in zip(trees, trees[K - 1 :])]
ans = min(diffs)
print(ans)
return
solve(N, K, trees)
| false | 29.411765 | [
"- diffs = []",
"- for i, h in enumerate(trees[: N - K + 1]):",
"- min_h = h",
"- max_h = trees[i + K - 1]",
"- # print(min_h,max_h)",
"- diffs.append(max_h - min_h)",
"- print((min(diffs)))",
"+ diffs = [max_h - min_h for min_h, max_h in zip(trees, trees[K - 1 ... | false | 0.082716 | 0.083202 | 0.994161 | [
"s793690492",
"s498780844"
] |
u901447859 | p03102 | python | s960305721 | s950516653 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
a=list(map(int,input().split()))
total=0
for a_,b_ in zip(a,b):
total+=a_*b_
if 0 < total+c:
cnt+=1
print(cnt) | n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
def prod(a,b,init=0):
total=init
for a_,b_ in zip(a,b):
total+=a_*b_
return total
cnt=0
for i in range(n):
a=list(map(int,input().split()))
if 0 < prod(a,b,init=c):
cnt+=1
print(cnt) | 12 | 15 | 227 | 282 | n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for i in range(n):
a = list(map(int, input().split()))
total = 0
for a_, b_ in zip(a, b):
total += a_ * b_
if 0 < total + c:
cnt += 1
print(cnt)
| n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
def prod(a, b, init=0):
total = init
for a_, b_ in zip(a, b):
total += a_ * b_
return total
cnt = 0
for i in range(n):
a = list(map(int, input().split()))
if 0 < prod(a, b, init=c):
cnt += 1
print(cnt)
| false | 20 | [
"+",
"+",
"+def prod(a, b, init=0):",
"+ total = init",
"+ for a_, b_ in zip(a, b):",
"+ total += a_ * b_",
"+ return total",
"+",
"+",
"- total = 0",
"- for a_, b_ in zip(a, b):",
"- total += a_ * b_",
"- if 0 < total + c:",
"+ if 0 < prod(a, b, init=c):... | false | 0.049685 | 0.050741 | 0.979187 | [
"s960305721",
"s950516653"
] |
u646989285 | p03424 | python | s451461026 | s347523550 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import Counter
N = eval(input())
color_list = [i for i in input().split()]
result = len(Counter(color_list))
if result == 3:
result = 'Three'
elif result == 4:
result = 'Four'
print(result) | N = input()
color_list = [i for i in input().split()]
print('Four') if 'Y' in color_list else print('Three')
| 11 | 3 | 220 | 110 | from collections import Counter
N = eval(input())
color_list = [i for i in input().split()]
result = len(Counter(color_list))
if result == 3:
result = "Three"
elif result == 4:
result = "Four"
print(result)
| N = input()
color_list = [i for i in input().split()]
print("Four") if "Y" in color_list else print("Three")
| false | 72.727273 | [
"-from collections import Counter",
"-",
"-N = eval(input())",
"+N = input()",
"-result = len(Counter(color_list))",
"-if result == 3:",
"- result = \"Three\"",
"-elif result == 4:",
"- result = \"Four\"",
"-print(result)",
"+print(\"Four\") if \"Y\" in color_list else print(\"Three\")"
] | false | 0.157391 | 0.090061 | 1.747614 | [
"s451461026",
"s347523550"
] |
u405256066 | p03212 | python | s419097863 | s855153816 | 94 | 60 | 11,992 | 6,260 | Accepted | Accepted | 36.17 | import itertools
from sys import stdin
N=int(stdin.readline().rstrip())
ans=0
for i in range(3,11):
for j in list(itertools.product("753",repeat=i)):
if int("".join(j)) <= N and len(set("".join(j)))==3:
ans+=1
print(ans) | import itertools
from sys import stdin
N=int(stdin.readline().rstrip())
ans=0
for i in range(3,10):
for j in list(itertools.product("753",repeat=i)):
if int("".join(j)) <= N and len(set("".join(j)))==3:
ans+=1
print(ans) | 9 | 9 | 252 | 252 | import itertools
from sys import stdin
N = int(stdin.readline().rstrip())
ans = 0
for i in range(3, 11):
for j in list(itertools.product("753", repeat=i)):
if int("".join(j)) <= N and len(set("".join(j))) == 3:
ans += 1
print(ans)
| import itertools
from sys import stdin
N = int(stdin.readline().rstrip())
ans = 0
for i in range(3, 10):
for j in list(itertools.product("753", repeat=i)):
if int("".join(j)) <= N and len(set("".join(j))) == 3:
ans += 1
print(ans)
| false | 0 | [
"-for i in range(3, 11):",
"+for i in range(3, 10):"
] | false | 0.126048 | 0.159352 | 0.791002 | [
"s419097863",
"s855153816"
] |
u631277801 | p03074 | python | s379776730 | s563174445 | 103 | 63 | 8,408 | 7,160 | Accepted | Accepted | 38.83 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline(... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 61 | 40 | 1,342 | 803 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return map(int, stdin.readline().split())
def li_():
return map(lambda x: int(x) - 1, stdin.readline().split())
def lf():
return map(float, stdin.readline().split())
def ls():
return stdin.readline().split()
def ns():
ret... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 34.42623 | [
"-sys.setrecursionlimit(10**5)",
"+sys.setrecursionlimit(10**7)",
"- return map(int, stdin.readline().split())",
"+ return list(map(int, stdin.readline().split()))",
"- return map(lambda x: int(x) - 1, stdin.readline().split())",
"+ return [int(x) - 1 for x in stdin.readline().split()]",
"- ... | false | 0.04898 | 0.049481 | 0.989891 | [
"s379776730",
"s563174445"
] |
u729133443 | p03127 | python | s274114682 | s616573837 | 90 | 57 | 16,280 | 20,448 | Accepted | Accepted | 36.67 | from fractions import*;eval(input());a,*b=list(map(int,input().split()))
for i in b:a=gcd(a,i)
print(a) | import math
eval(input())
a,*b=list(map(int,input().split()))
for i in b:a=math.gcd(a,i)
print(a) | 3 | 5 | 93 | 89 | from fractions import *
eval(input())
a, *b = list(map(int, input().split()))
for i in b:
a = gcd(a, i)
print(a)
| import math
eval(input())
a, *b = list(map(int, input().split()))
for i in b:
a = math.gcd(a, i)
print(a)
| false | 40 | [
"-from fractions import *",
"+import math",
"- a = gcd(a, i)",
"+ a = math.gcd(a, i)"
] | false | 0.051298 | 0.097384 | 0.526762 | [
"s274114682",
"s616573837"
] |
u074220993 | p03862 | python | s263630972 | s832873540 | 115 | 104 | 20,328 | 19,860 | Accepted | Accepted | 9.57 | import math
N, x = list(map(int, input().split()))
L = [int(x) for x in input().split()]
ans = 0
for i in range(1,N):
if L[i-1] + L[i] > x:
if L[i-1] > x:
ans += L[i-1] - x
ans += L[i]
L[i] = 0
else:
ans += L[i] + L[i-1] - x
L[i... | N, x = list(map(int, input().split()))
A = [0] + [int(x) for x in input().split()]
ans = 0
for i in range(1,N+1):
if A[i-1] + A[i] > x:
ans += A[i-1] + A[i] - x
A[i] = x - A[i-1]
print(ans)
| 14 | 8 | 341 | 211 | import math
N, x = list(map(int, input().split()))
L = [int(x) for x in input().split()]
ans = 0
for i in range(1, N):
if L[i - 1] + L[i] > x:
if L[i - 1] > x:
ans += L[i - 1] - x
ans += L[i]
L[i] = 0
else:
ans += L[i] + L[i - 1] - x
L[i] ... | N, x = list(map(int, input().split()))
A = [0] + [int(x) for x in input().split()]
ans = 0
for i in range(1, N + 1):
if A[i - 1] + A[i] > x:
ans += A[i - 1] + A[i] - x
A[i] = x - A[i - 1]
print(ans)
| false | 42.857143 | [
"-import math",
"-",
"-L = [int(x) for x in input().split()]",
"+A = [0] + [int(x) for x in input().split()]",
"-for i in range(1, N):",
"- if L[i - 1] + L[i] > x:",
"- if L[i - 1] > x:",
"- ans += L[i - 1] - x",
"- ans += L[i]",
"- L[i] = 0",
"- ... | false | 0.045721 | 0.047186 | 0.968957 | [
"s263630972",
"s832873540"
] |
u517447467 | p03208 | python | s428880718 | s971870083 | 252 | 227 | 8,280 | 10,868 | Accepted | Accepted | 9.92 | N, M = list(map(int, input().split()))
K = [int(eval(input())) for i in range(N)]
K = sorted(K)
result = 10 ** 10
for i in range(N-M+1):
result = min([result, K[i+M-1]-K[i]])
print(result) | N, M = list(map(int, input().split()))
K = [int(eval(input())) for i in range(N)]
K = sorted(K)
print((min([K[i+M-1]-K[i] for i in range(N-M+1)]))) | 9 | 4 | 196 | 142 | N, M = list(map(int, input().split()))
K = [int(eval(input())) for i in range(N)]
K = sorted(K)
result = 10**10
for i in range(N - M + 1):
result = min([result, K[i + M - 1] - K[i]])
print(result)
| N, M = list(map(int, input().split()))
K = [int(eval(input())) for i in range(N)]
K = sorted(K)
print((min([K[i + M - 1] - K[i] for i in range(N - M + 1)])))
| false | 55.555556 | [
"-result = 10**10",
"-for i in range(N - M + 1):",
"- result = min([result, K[i + M - 1] - K[i]])",
"-print(result)",
"+print((min([K[i + M - 1] - K[i] for i in range(N - M + 1)])))"
] | false | 0.038483 | 0.070688 | 0.544412 | [
"s428880718",
"s971870083"
] |
u234052535 | p00002 | python | s262403742 | s756284833 | 30 | 20 | 7,576 | 7,584 | Accepted | Accepted | 33.33 | import math
while True:
try:
line = input().split(" ")
a = int(line[0])
b = int(line[1])
print((int(math.log10(a+b))+1))
except:
break | import math
while True:
try:
line = input().split(" ")
print((int(math.log10(int(line[0])+int(line[1])))+1))
except:
break | 9 | 8 | 188 | 160 | import math
while True:
try:
line = input().split(" ")
a = int(line[0])
b = int(line[1])
print((int(math.log10(a + b)) + 1))
except:
break
| import math
while True:
try:
line = input().split(" ")
print((int(math.log10(int(line[0]) + int(line[1]))) + 1))
except:
break
| false | 11.111111 | [
"- a = int(line[0])",
"- b = int(line[1])",
"- print((int(math.log10(a + b)) + 1))",
"+ print((int(math.log10(int(line[0]) + int(line[1]))) + 1))"
] | false | 0.04226 | 0.045122 | 0.936557 | [
"s262403742",
"s756284833"
] |
u784022244 | p02888 | python | s420379569 | s387701452 | 1,456 | 754 | 3,188 | 75,512 | Accepted | Accepted | 48.21 | import bisect
N=int(eval(input()))
L=list(map(int, input().split()))
#a<b+c
#b<c+a
#c<a+b
#a<=b<=c
#c<a+b
L=sorted(L)
ans=0
for i in range(N-2):
for j in range(i+1,N-1):
x=bisect.bisect_left(L,L[i]+L[j])
ans+=x-(j+1)
print(ans) | N=int(eval(input()))
L=list(map(int, input().split()))
L=sorted(L)
import bisect
ans=0
for i in range(N-1):
for j in range(i+1,N):
a=L[i]
b=L[j]
upper = bisect.bisect_left(L,a+b)
lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a))
#print(uppe... | 15 | 17 | 255 | 373 | import bisect
N = int(eval(input()))
L = list(map(int, input().split()))
# a<b+c
# b<c+a
# c<a+b
# a<=b<=c
# c<a+b
L = sorted(L)
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
x = bisect.bisect_left(L, L[i] + L[j])
ans += x - (j + 1)
print(ans)
| N = int(eval(input()))
L = list(map(int, input().split()))
L = sorted(L)
import bisect
ans = 0
for i in range(N - 1):
for j in range(i + 1, N):
a = L[i]
b = L[j]
upper = bisect.bisect_left(L, a + b)
lower = max(j + 1, bisect.bisect_right(L, a - b), bisect.bisect_right(L, b - a))
... | false | 11.764706 | [
"+N = int(eval(input()))",
"+L = list(map(int, input().split()))",
"+L = sorted(L)",
"-N = int(eval(input()))",
"-L = list(map(int, input().split()))",
"-# a<b+c",
"-# b<c+a",
"-# c<a+b",
"-# a<=b<=c",
"-# c<a+b",
"-L = sorted(L)",
"-for i in range(N - 2):",
"- for j in range(i + 1, N - 1... | false | 0.062594 | 0.096137 | 0.651088 | [
"s420379569",
"s387701452"
] |
u561231954 | p03026 | python | s103262328 | s198627478 | 73 | 66 | 14,448 | 6,168 | Accepted | Accepted | 9.59 | MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
MAXN = 10000
G = [[] for _ in range(MAXN)]
color = [-1] * MAXN
def dfs(i,idx,c):
color[i] = c[idx]
for e in G[i]:
if color[e] != -1:
continue
idx = dfs(e,idx... | MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque
def main():
n = int(eval(input()))
G = [[] for _ in range(n)]
for _ in range(n - 1):
a,b = list(map(int,input().split()))
a -= 1
b... | 38 | 37 | 727 | 774 | MOD = 10**9 + 7
INF = 10**10
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
MAXN = 10000
G = [[] for _ in range(MAXN)]
color = [-1] * MAXN
def dfs(i, idx, c):
color[i] = c[idx]
for e in G[i]:
if color[e] != -1:
continue
idx = dfs(e, idx + 1, c)
... | MOD = 10**9 + 7
INF = 10**10
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
from collections import deque
def main():
n = int(eval(input()))
G = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
... | false | 2.631579 | [
"-MAXN = 10000",
"-G = [[] for _ in range(MAXN)]",
"-color = [-1] * MAXN",
"-",
"-",
"-def dfs(i, idx, c):",
"- color[i] = c[idx]",
"- for e in G[i]:",
"- if color[e] != -1:",
"- continue",
"- idx = dfs(e, idx + 1, c)",
"- return idx",
"+from collections imp... | false | 0.116865 | 0.087468 | 1.336081 | [
"s103262328",
"s198627478"
] |
u017810624 | p03150 | python | s224410963 | s312943071 | 24 | 18 | 3,064 | 3,060 | Accepted | Accepted | 25 | s=eval(input())
if s[0:1]=='k' and s[len(s)-6:len(s)]=='eyence':
print('YES')
elif s[0:2]=='ke' and s[len(s)-5:len(s)]=='yence':
print('YES')
elif s[0:3]=='key' and s[len(s)-4:len(s)]=='ence':
print('YES')
elif s[0:4]=='keye' and s[len(s)-3:len(s)]=='nce':
print('YES')
elif s[0:5]=='keyen' and s[len(s)... | s=eval(input())
S='keyence'
c=0
for i in range(7):
if s[0:i]==S[0:i] and s[len(s)-7+i:len(s)]==S[i:7]:
c+=1
if c>0:print('YES')
else:print('NO') | 15 | 8 | 437 | 151 | s = eval(input())
if s[0:1] == "k" and s[len(s) - 6 : len(s)] == "eyence":
print("YES")
elif s[0:2] == "ke" and s[len(s) - 5 : len(s)] == "yence":
print("YES")
elif s[0:3] == "key" and s[len(s) - 4 : len(s)] == "ence":
print("YES")
elif s[0:4] == "keye" and s[len(s) - 3 : len(s)] == "nce":
print("YES")
... | s = eval(input())
S = "keyence"
c = 0
for i in range(7):
if s[0:i] == S[0:i] and s[len(s) - 7 + i : len(s)] == S[i:7]:
c += 1
if c > 0:
print("YES")
else:
print("NO")
| false | 46.666667 | [
"-if s[0:1] == \"k\" and s[len(s) - 6 : len(s)] == \"eyence\":",
"- print(\"YES\")",
"-elif s[0:2] == \"ke\" and s[len(s) - 5 : len(s)] == \"yence\":",
"- print(\"YES\")",
"-elif s[0:3] == \"key\" and s[len(s) - 4 : len(s)] == \"ence\":",
"- print(\"YES\")",
"-elif s[0:4] == \"keye\" and s[len(... | false | 0.117952 | 0.045621 | 2.585481 | [
"s224410963",
"s312943071"
] |
u940139461 | p02732 | python | s860291477 | s968642698 | 868 | 512 | 74,180 | 41,988 | Accepted | Accepted | 41.01 | from collections import Counter
mod = (10 ** 9 + 7) ** 5
MAX = 2 * 10 ** 5 + 1 # ใใใฏๅคๅใใใฎใงๆณจๆ
def com_init(MAX, mod):
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i - 1] * i % ... | from collections import Counter
# mod = (10 ** 9 + 7) ** 5
# MAX = 2 * 10 ** 5 + 1 # ใใใฏๅคๅใใใฎใงๆณจๆ
# def com_init(MAX, mod):
# fac = [0] * MAX
# finv = [0] * MAX
# inv = [0] * MAX
# fac[0] = fac[1] = 1
# finv[0] = finv[1] = 1
# inv[1] = 1
# for i in range(2, MAX):
# fac[... | 51 | 95 | 1,081 | 1,996 | from collections import Counter
mod = (10**9 + 7) ** 5
MAX = 2 * 10**5 + 1 # ใใใฏๅคๅใใใฎใงๆณจๆ
def com_init(MAX, mod):
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i - 1] * i % mod
inv... | from collections import Counter
# mod = (10 ** 9 + 7) ** 5
# MAX = 2 * 10 ** 5 + 1 # ใใใฏๅคๅใใใฎใงๆณจๆ
# def com_init(MAX, mod):
# fac = [0] * MAX
# finv = [0] * MAX
# inv = [0] * MAX
# fac[0] = fac[1] = 1
# finv[0] = finv[1] = 1
# inv[1] = 1
# for i in range(2, MAX):
# fac[i] = fac[i - 1... | false | 46.315789 | [
"-mod = (10**9 + 7) ** 5",
"-MAX = 2 * 10**5 + 1 # ใใใฏๅคๅใใใฎใงๆณจๆ",
"+# mod = (10 ** 9 + 7) ** 5",
"+# MAX = 2 * 10 ** 5 + 1 # ใใใฏๅคๅใใใฎใงๆณจๆ",
"+# def com_init(MAX, mod):",
"+# fac = [0] * MAX",
"+# finv = [0] * MAX",
"+# inv = [0] * MAX",
"+# fac[0] = fac[1] = 1",
"+# finv[0] = fi... | false | 0.764369 | 0.042281 | 18.07816 | [
"s860291477",
"s968642698"
] |
u312025627 | p02642 | python | s251422298 | s346518486 | 246 | 162 | 137,004 | 95,712 | Accepted | Accepted | 34.15 | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort()
B = [True]*(10**6+1)
from collections import Counter
c = Counter(A)
bl = set()
for k, v in list(c.items()):
if v >= 2:
... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0]*(10**6+1)
for a in A:
B[a] += 1
for i in range(1, 10**6):
if not B[i]:
continue
j = 2*i
while j <= 10**6:
... | 28 | 25 | 586 | 490 | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort()
B = [True] * (10**6 + 1)
from collections import Counter
c = Counter(A)
bl = set()
for k, v in list(c.items()):
if v >= 2:
bl.add(k... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0] * (10**6 + 1)
for a in A:
B[a] += 1
for i in range(1, 10**6):
if not B[i]:
continue
j = 2 * i
while j <= 10**6:
... | false | 10.714286 | [
"- A.sort()",
"- B = [True] * (10**6 + 1)",
"- from collections import Counter",
"-",
"- c = Counter(A)",
"- bl = set()",
"- for k, v in list(c.items()):",
"- if v >= 2:",
"- bl.add(k)",
"+ B = [0] * (10**6 + 1)",
"+ for a in A:",
"+ B[a] += 1",... | false | 0.176119 | 1.730098 | 0.101797 | [
"s251422298",
"s346518486"
] |
u361381049 | p03163 | python | s541915884 | s892628929 | 680 | 523 | 173,448 | 120,044 | Accepted | Accepted | 23.09 | n, w = list(map(int, input().split()))
lis = [[0, 0]]
for i in range(n):
lis.append(list(map(int, input().split())))
dp = [[0 for i in range(w+1)] for i in range(n+1)]
#print(dp)
#print(lis)
for i in range(1, n+1):
for j in range(w+1):
if j - lis[i][0] < 0:
dp[i][j] = dp[i-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()))
dp = [[0] * (W + 1) for i in range(n)]
for i in range(n):
for j in range(W+1):
if j - w[i] < 0:
dp[i][j] = dp[i-1][j]
else:
dp[i][j] ... | 16 | 15 | 421 | 380 | n, w = list(map(int, input().split()))
lis = [[0, 0]]
for i in range(n):
lis.append(list(map(int, input().split())))
dp = [[0 for i in range(w + 1)] for i in range(n + 1)]
# print(dp)
# print(lis)
for i in range(1, n + 1):
for j in range(w + 1):
if j - lis[i][0] < 0:
dp[i][j] = dp[i - 1][j]
... | 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()))
dp = [[0] * (W + 1) for i in range(n)]
for i in range(n):
for j in range(W + 1):
if j - w[i] < 0:
dp[i][j] = dp[i - 1][j]
else:
dp[i][j] = max(dp... | false | 6.25 | [
"-n, w = list(map(int, input().split()))",
"-lis = [[0, 0]]",
"+n, W = list(map(int, input().split()))",
"+w = [0] * n",
"+v = [0] * n",
"- lis.append(list(map(int, input().split())))",
"-dp = [[0 for i in range(w + 1)] for i in range(n + 1)]",
"-# print(dp)",
"-# print(lis)",
"-for i in range(... | false | 0.047238 | 0.043935 | 1.075166 | [
"s541915884",
"s892628929"
] |
u908763441 | p02579 | python | s030189163 | s560605529 | 978 | 895 | 174,976 | 174,800 | Accepted | Accepted | 8.49 | from collections import deque
from itertools import product
H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x)-1, input().split())
Dh, Dw = map(lambda x: int(x)-1, input().split())
maze = [list(input()) for _ in range(H)] # ่ฟท่ทฏ
walkFrom = deque([(Ch, Cw)]) # ๆญฉใๅบ็บๅฐ็นใฎๅ่ฃ้
warpFrom = deque() # ใฏใผใๅบ็บๅฐ็นใฎๅ... | from collections import deque
from itertools import product
H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x)-1, input().split())
Dh, Dw = map(lambda x: int(x)-1, input().split())
maze = [list(input()) for _ in range(H)] # ่ฟท่ทฏ
walkFrom = deque([(Ch, Cw)]) # ๆญฉใๅบ็บๅฐ็นใฎๅ่ฃ้
warpFrom = deque() # ใฏใผใๅบ็บๅฐ็นใฎๅ... | 36 | 36 | 1,151 | 1,169 | from collections import deque
from itertools import product
H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x) - 1, input().split())
Dh, Dw = map(lambda x: int(x) - 1, input().split())
maze = [list(input()) for _ in range(H)] # ่ฟท่ทฏ
walkFrom = deque([(Ch, Cw)]) # ๆญฉใๅบ็บๅฐ็นใฎๅ่ฃ้
warpFrom = deque() # ใฏใผใๅบ็บๅฐ็นใฎๅ่ฃ... | from collections import deque
from itertools import product
H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x) - 1, input().split())
Dh, Dw = map(lambda x: int(x) - 1, input().split())
maze = [list(input()) for _ in range(H)] # ่ฟท่ทฏ
walkFrom = deque([(Ch, Cw)]) # ๆญฉใๅบ็บๅฐ็นใฎๅ่ฃ้
warpFrom = deque() # ใฏใผใๅบ็บๅฐ็นใฎๅ่ฃ... | false | 0 | [
"-WarpRange = list(filter(lambda x: x != (0, 0), product(range(-2, 3), repeat=2)))",
"+WarpRange = list(",
"+ filter(lambda x: not x in WalkRange + [(0, 0)], product(range(-2, 3), repeat=2))",
"+)"
] | false | 0.062086 | 0.062518 | 0.993087 | [
"s030189163",
"s560605529"
] |
u546338822 | p02948 | python | s606523019 | s000184745 | 515 | 467 | 26,072 | 26,072 | Accepted | Accepted | 9.32 | def main():
import heapq
n,m = list(map(int,input().split()))
alb = {}
for i in range(n):
a,b = list(map(int,input().split()))
if a not in list(alb.keys()):
alb[a] = [b]
else:
alb[a] += [b]
h = []
s = 0
for i in range(1,m+1):
... | def main():
import heapq
n,m = list(map(int,input().split()))
jobs = {}
for i in range(n):
a,b = list(map(int,input().split()))
if a not in list(jobs.keys()):
jobs[a] = [b]
else:
jobs[a] += [b]
ob = []
ans = 0
for i in range(1,m+1):... | 23 | 22 | 550 | 547 | def main():
import heapq
n, m = list(map(int, input().split()))
alb = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in list(alb.keys()):
alb[a] = [b]
else:
alb[a] += [b]
h = []
s = 0
for i in range(1, m + 1):
if... | def main():
import heapq
n, m = list(map(int, input().split()))
jobs = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in list(jobs.keys()):
jobs[a] = [b]
else:
jobs[a] += [b]
ob = []
ans = 0
for i in range(1, m + 1):
... | false | 4.347826 | [
"- alb = {}",
"+ jobs = {}",
"- if a not in list(alb.keys()):",
"- alb[a] = [b]",
"+ if a not in list(jobs.keys()):",
"+ jobs[a] = [b]",
"- alb[a] += [b]",
"- h = []",
"- s = 0",
"+ jobs[a] += [b]",
"+ ob = []",
"+ ans... | false | 0.036899 | 0.043239 | 0.853384 | [
"s606523019",
"s000184745"
] |
u492910842 | p03694 | python | s096886197 | s826703411 | 116 | 63 | 60,884 | 61,828 | Accepted | Accepted | 45.69 | n=int(eval(input()))
a=list(map(int,input().split()))
print((max(a)-min(a))) | n=int(eval(input()))
a=sorted(list(map(int,input().split())))
print((a[-1]-a[0])) | 3 | 3 | 70 | 75 | n = int(eval(input()))
a = list(map(int, input().split()))
print((max(a) - min(a)))
| n = int(eval(input()))
a = sorted(list(map(int, input().split())))
print((a[-1] - a[0]))
| false | 0 | [
"-a = list(map(int, input().split()))",
"-print((max(a) - min(a)))",
"+a = sorted(list(map(int, input().split())))",
"+print((a[-1] - a[0]))"
] | false | 0.037385 | 0.161202 | 0.231913 | [
"s096886197",
"s826703411"
] |
u562935282 | p03044 | python | s330911556 | s419750466 | 747 | 678 | 70,048 | 40,724 | Accepted | Accepted | 9.24 | from collections import deque
N = int(input())
es = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
es[u].append((v, w))
es[v].append((u, w))
clr = [None] * N
clr[0] = 0
dq = deque()
dq.append(0)
while dq:
v = dq.popleft()
... | from collections import deque
n = int(input())
es = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
es[u].append((v, w))
es[v].append((u, w))
s = 0
ans = [None] * n
ans[s] = 0
dq = deque()
dq.append(s)
while dq:
v = dq.popl... | 26 | 26 | 481 | 470 | from collections import deque
N = int(input())
es = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
es[u].append((v, w))
es[v].append((u, w))
clr = [None] * N
clr[0] = 0
dq = deque()
dq.append(0)
while dq:
v = dq.popleft()
for nv, w in es[v]:
... | from collections import deque
n = int(input())
es = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
es[u].append((v, w))
es[v].append((u, w))
s = 0
ans = [None] * n
ans[s] = 0
dq = deque()
dq.append(s)
while dq:
v = dq.popleft()
for nv, w in e... | false | 0 | [
"-N = int(input())",
"-es = [[] for _ in range(N)]",
"-for _ in range(N - 1):",
"+n = int(input())",
"+es = [[] for _ in range(n)]",
"+for _ in range(n - 1):",
"-clr = [None] * N",
"-clr[0] = 0",
"+s = 0",
"+ans = [None] * n",
"+ans[s] = 0",
"-dq.append(0)",
"+dq.append(s)",
"- if c... | false | 0.06502 | 0.125074 | 0.519856 | [
"s330911556",
"s419750466"
] |
u513081876 | p03637 | python | s265974246 | s919763665 | 73 | 64 | 14,252 | 14,252 | Accepted | Accepted | 12.33 | N = int(eval(input()))
T = list(map(int, input().split()))
ans = 0
for i in range(N):
if T[i] % 4 == 0:
ans += 1
elif T[i] % 2 != 0:
ans -= 1
if N % 2 != 0:
ans += 1
print(('Yes' if ans >= 0 else 'No'))
'''
forๆใฏ if 4ใงๅฒใๅใใ elif 4ใงๅฒใๅใใชใใใฎใฎไธญใง2ใงใๅฒใๅใใชใๆฐๅญโใคใพใๅฅๆฐใใฎใฟใๅคๆญใใ... | N = int(eval(input()))
ans = 0
for i in list(map(int, input().split())):
if i % 4 == 0:
ans += 1
elif i % 2 != 0:
ans -= 1
if N % 2 != 0:
ans += 1
print(('Yes' if ans >= 0 else 'No')) | 20 | 12 | 411 | 217 | N = int(eval(input()))
T = list(map(int, input().split()))
ans = 0
for i in range(N):
if T[i] % 4 == 0:
ans += 1
elif T[i] % 2 != 0:
ans -= 1
if N % 2 != 0:
ans += 1
print(("Yes" if ans >= 0 else "No"))
"""
forๆใฏ if 4ใงๅฒใๅใใ elif 4ใงๅฒใๅใใชใใใฎใฎไธญใง2ใงใๅฒใๅใใชใๆฐๅญโใคใพใๅฅๆฐใใฎใฟใๅคๆญใใ
ๅบๆฌ็ใซใฏ0ใฎๅๆฐๅใ ใ4ใงๅฒใๅใใใใฎใๅฟ
... | N = int(eval(input()))
ans = 0
for i in list(map(int, input().split())):
if i % 4 == 0:
ans += 1
elif i % 2 != 0:
ans -= 1
if N % 2 != 0:
ans += 1
print(("Yes" if ans >= 0 else "No"))
| false | 40 | [
"-T = list(map(int, input().split()))",
"-for i in range(N):",
"- if T[i] % 4 == 0:",
"+for i in list(map(int, input().split())):",
"+ if i % 4 == 0:",
"- elif T[i] % 2 != 0:",
"+ elif i % 2 != 0:",
"-\"\"\"",
"-forๆใฏ if 4ใงๅฒใๅใใ elif 4ใงๅฒใๅใใชใใใฎใฎไธญใง2ใงใๅฒใๅใใชใๆฐๅญโใคใพใๅฅๆฐใใฎใฟใๅคๆญใใ",
"-ๅบๆฌ็ใซใฏ0ใฎๅ... | false | 0.036404 | 0.035715 | 1.019278 | [
"s265974246",
"s919763665"
] |
u968166680 | p02726 | python | s898940793 | s817417446 | 228 | 128 | 75,300 | 74,312 | Accepted | Accepted | 43.86 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, X, Y = list(map(int, readline().split()))
X -= 1
Y -= 1
G = [[] for _ in range(N... | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, X, Y = list(map(int, readline().split()))
X -= 1
Y -= 1
ans = [0] * N
for... | 46 | 30 | 944 | 579 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, X, Y = list(map(int, readline().split()))
X -= 1
Y -= 1
G = [[] for _ in range(N)]
for i in range... | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, X, Y = list(map(int, readline().split()))
X -= 1
Y -= 1
ans = [0] * N
for i in range(N - 1):
... | false | 34.782609 | [
"- G = [[] for _ in range(N)]",
"+ ans = [0] * N",
"- G[i].append(i + 1)",
"- G[i + 1].append(i)",
"- G[X].append(Y)",
"- G[Y].append(X)",
"- count = [0] * N",
"- for i in range(N):",
"- dist = [-1] * N",
"- dist[i] = 0",
"- queue = deque([i])... | false | 0.037846 | 0.035563 | 1.064205 | [
"s898940793",
"s817417446"
] |
u732159958 | p03417 | python | s721343749 | s426587277 | 48 | 18 | 3,060 | 3,064 | Accepted | Accepted | 62.5 | def solve():
c = list(map(int, input().split(' ')))
if c[0] >= 3 and c[1] >= 3:
return (c[0] - 2) * (c[1] - 2)
if c[0] == 1 or c[1] == 1:
if c[0] == 1 and c[1] == 1:
return 1
else:
return max(max(c) - 2, 0)
return 0
print((solve())) | j = list(map(int, input().split()))
counter = 0
j.sort()
if (j[0] >= 3):
print(((j[0] - 2) * (j[1] - 2)))
elif (j[0] == 2):
print((0))
elif (j[0] == 1):
if j[1] == 1:
print((1))
else:
print((j[1] - 2)) | 12 | 13 | 274 | 222 | def solve():
c = list(map(int, input().split(" ")))
if c[0] >= 3 and c[1] >= 3:
return (c[0] - 2) * (c[1] - 2)
if c[0] == 1 or c[1] == 1:
if c[0] == 1 and c[1] == 1:
return 1
else:
return max(max(c) - 2, 0)
return 0
print((solve()))
| j = list(map(int, input().split()))
counter = 0
j.sort()
if j[0] >= 3:
print(((j[0] - 2) * (j[1] - 2)))
elif j[0] == 2:
print((0))
elif j[0] == 1:
if j[1] == 1:
print((1))
else:
print((j[1] - 2))
| false | 7.692308 | [
"-def solve():",
"- c = list(map(int, input().split(\" \")))",
"- if c[0] >= 3 and c[1] >= 3:",
"- return (c[0] - 2) * (c[1] - 2)",
"- if c[0] == 1 or c[1] == 1:",
"- if c[0] == 1 and c[1] == 1:",
"- return 1",
"- else:",
"- return max(max(c) - 2, ... | false | 0.091449 | 0.04177 | 2.189344 | [
"s721343749",
"s426587277"
] |
u885986895 | p02726 | python | s754710909 | s229345624 | 483 | 430 | 86,364 | 82,012 | Accepted | Accepted | 10.97 | import sys
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
d = [[sys.maxsize for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(N):
d[i][j] = min(abs(j-i), abs(X-i) + 1 + abs(j-Y), abs(Y-i) + 1 + abs(j-X))
answer = [0 for _ in range(N-1)]
for h in range(N):
for i... | import sys
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
d = [[sys.maxsize for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(N):
d[i][j] = min(abs(j-i), abs(X-i) + 1 + abs(j-Y))
answer = [0 for _ in range(N-1)]
for h in range(N):
for i in range(h+1, N):
i... | 21 | 21 | 422 | 397 | import sys
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
d = [[sys.maxsize for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(N):
d[i][j] = min(
abs(j - i), abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X)
)
answer = [0 for _ in range(N - 1)]
for h... | import sys
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
d = [[sys.maxsize for _ in range(N)] for _ in range(N)]
for i in range(N):
for j in range(N):
d[i][j] = min(abs(j - i), abs(X - i) + 1 + abs(j - Y))
answer = [0 for _ in range(N - 1)]
for h in range(N):
for i in range(h + 1, N):
... | false | 0 | [
"- d[i][j] = min(",
"- abs(j - i), abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X)",
"- )",
"+ d[i][j] = min(abs(j - i), abs(X - i) + 1 + abs(j - Y))"
] | false | 0.073449 | 0.046146 | 1.591656 | [
"s754710909",
"s229345624"
] |
u476604182 | p02798 | python | s318898289 | s816679065 | 1,357 | 959 | 112,924 | 58,716 | Accepted | Accepted | 29.33 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
N = int(readline())
A = list(map(int,readline().split()))
B = list(map(int,readline().split()))
class BinaryIndexedTree():
def __init__(self, seq):
self.size =... | 98 | 92 | 2,921 | 2,288 | #!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI():
return list(map(int, input().split()))
def LF... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
class BinaryIndexedTree:
def __init__(self, seq):
self.size = len(seq)
... | false | 6.122449 | [
"-#!/usr/bin/env python3",
"-from collections import defaultdict, deque",
"-from heapq import heappush, heappop",
"-from bisect import bisect_left, bisect_right",
"-import sys, random, itertools, math",
"+import sys",
"-sys.setrecursionlimit(10**5)",
"-input = sys.stdin.readline",
"-sqrt = math.sqrt... | false | 0.084156 | 0.037524 | 2.242723 | [
"s318898289",
"s816679065"
] |
u861886710 | p02695 | python | s741669662 | s332828495 | 1,084 | 484 | 21,480 | 9,224 | Accepted | Accepted | 55.35 | from itertools import *
n, m, q = list(map(int, input().split()))
aaa = []
for i in range(1, m+1):
aaa.append(i)
l = []
for i in range(q):
a = list(map(int, input().split()))
l.append(a)
a = list(combinations_with_replacement(aaa, n))
ans = 0
for i in a:
aa = 0
for j in l:
... | def dfs(nums, length, min_lim):
# ่ฟใๅคใฏใใในใฆใฎๆฐๅใฎๅพ็นใฎๆๅคงๅค ans ใงใใ
# numsใฏๆฐๅใฎๆฌไฝใlengthใฏๆฐๅญใฎไฝๅ็ฎใพใงๆฑบใใใใmin_limใฏๆฌกใฎๆฐๅญใฎๆๅฐๅค
ans = 0
if length == n:
# ๆฐๅใๅฎๆใใใฎใงใๅพ็นใ่จ็ฎใใพใ
score_ret = 0
for a, b, c, d in req:
# nums[0]ใๆจใฆใใฎใงใnums[b-1]...ใจใใชใใฆๆธใฟใพใ
if nums[b] - nums[a] == c: ... | 22 | 35 | 431 | 1,111 | from itertools import *
n, m, q = list(map(int, input().split()))
aaa = []
for i in range(1, m + 1):
aaa.append(i)
l = []
for i in range(q):
a = list(map(int, input().split()))
l.append(a)
a = list(combinations_with_replacement(aaa, n))
ans = 0
for i in a:
aa = 0
for j in l:
if i[j[1] - 1] ... | def dfs(nums, length, min_lim):
# ่ฟใๅคใฏใใในใฆใฎๆฐๅใฎๅพ็นใฎๆๅคงๅค ans ใงใใ
# numsใฏๆฐๅใฎๆฌไฝใlengthใฏๆฐๅญใฎไฝๅ็ฎใพใงๆฑบใใใใmin_limใฏๆฌกใฎๆฐๅญใฎๆๅฐๅค
ans = 0
if length == n:
# ๆฐๅใๅฎๆใใใฎใงใๅพ็นใ่จ็ฎใใพใ
score_ret = 0
for a, b, c, d in req:
# nums[0]ใๆจใฆใใฎใงใnums[b-1]...ใจใใชใใฆๆธใฟใพใ
if nums[b] - nums[a] == c... | false | 37.142857 | [
"-from itertools import *",
"+def dfs(nums, length, min_lim):",
"+ # ่ฟใๅคใฏใใในใฆใฎๆฐๅใฎๅพ็นใฎๆๅคงๅค ans ใงใใ",
"+ # numsใฏๆฐๅใฎๆฌไฝใlengthใฏๆฐๅญใฎไฝๅ็ฎใพใงๆฑบใใใใmin_limใฏๆฌกใฎๆฐๅญใฎๆๅฐๅค",
"+ ans = 0",
"+ if length == n:",
"+ # ๆฐๅใๅฎๆใใใฎใงใๅพ็นใ่จ็ฎใใพใ",
"+ score_ret = 0",
"+ for a, b, c, d in req:",
"+ ... | false | 0.056952 | 0.05592 | 1.018438 | [
"s741669662",
"s332828495"
] |
u047102107 | p02880 | python | s841444312 | s357434101 | 166 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.76 | N = int(eval(input()))
for i in range(1, 10):
for j in range(1, 10):
if i * j == N:
print("Yes")
exit()
print("No") | N = int(eval(input()))
for x in range(1, 10):
for y in range(1, 10):
if x * y == N:
print("Yes")
exit()
print("No") | 9 | 9 | 155 | 155 | N = int(eval(input()))
for i in range(1, 10):
for j in range(1, 10):
if i * j == N:
print("Yes")
exit()
print("No")
| N = int(eval(input()))
for x in range(1, 10):
for y in range(1, 10):
if x * y == N:
print("Yes")
exit()
print("No")
| false | 0 | [
"-for i in range(1, 10):",
"- for j in range(1, 10):",
"- if i * j == N:",
"+for x in range(1, 10):",
"+ for y in range(1, 10):",
"+ if x * y == N:"
] | false | 0.04021 | 0.039925 | 1.00715 | [
"s841444312",
"s357434101"
] |
u955248595 | p03775 | python | s103958876 | s935040292 | 467 | 44 | 9,620 | 9,076 | Accepted | Accepted | 90.58 | def PrimeDecomp(N,ConcFlag):
if ConcFlag:
if N<=1:
return [1],1
else:
I = 2
PrimeDec = []
DivCount = 1
while I*I<=N:
Cnt = 0
while N%I==0:
N //= I
PrimeDec.... | def Divisor(N):
Left,RightRev = [],[]
I = 1
while I*I<=N:
if N%I==0:
Left.append(I)
if I!=N//I:
RightRev.append(N//I)
I += 1
Div = Left+RightRev[::-1]
DivCount = len(Div)
return Div,DivCount
N = int(eval(input()))
Div,_ = D... | 55 | 22 | 1,595 | 472 | def PrimeDecomp(N, ConcFlag):
if ConcFlag:
if N <= 1:
return [1], 1
else:
I = 2
PrimeDec = []
DivCount = 1
while I * I <= N:
Cnt = 0
while N % I == 0:
N //= I
PrimeDec.... | def Divisor(N):
Left, RightRev = [], []
I = 1
while I * I <= N:
if N % I == 0:
Left.append(I)
if I != N // I:
RightRev.append(N // I)
I += 1
Div = Left + RightRev[::-1]
DivCount = len(Div)
return Div, DivCount
N = int(eval(input()))
Div, ... | false | 60 | [
"-def PrimeDecomp(N, ConcFlag):",
"- if ConcFlag:",
"- if N <= 1:",
"- return [1], 1",
"- else:",
"- I = 2",
"- PrimeDec = []",
"- DivCount = 1",
"- while I * I <= N:",
"- Cnt = 0",
"- while N %... | false | 0.032122 | 0.04993 | 0.643346 | [
"s103958876",
"s935040292"
] |
u205561862 | p03145 | python | s315040882 | s633166098 | 163 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.57 | print(((lambda l:l[0]*l[1]//2)(sorted(list(map(int,input().split())))))) | print(((lambda l:l[0]*l[1]//2)(list(map(int,input().split())))))
| 1 | 1 | 70 | 63 | print(((lambda l: l[0] * l[1] // 2)(sorted(list(map(int, input().split()))))))
| print(((lambda l: l[0] * l[1] // 2)(list(map(int, input().split())))))
| false | 0 | [
"-print(((lambda l: l[0] * l[1] // 2)(sorted(list(map(int, input().split()))))))",
"+print(((lambda l: l[0] * l[1] // 2)(list(map(int, input().split())))))"
] | false | 0.040503 | 0.03639 | 1.113029 | [
"s315040882",
"s633166098"
] |
u729133443 | p02788 | python | s612755937 | s871881487 | 472 | 431 | 55,768 | 56,152 | Accepted | Accepted | 8.69 | def main():
import sys
from collections import deque
from operator import itemgetter
b=sys.stdin.buffer
n,d,a=list(map(int,b.readline().split()))
m=list(map(int,b.read().split()))
p,q=deque(),deque()
f,g=p.popleft,q.popleft
s=b=0
for x,h in sorted(zip(m,m),key=itemgette... | def main():
import sys
from collections import deque
from operator import itemgetter
b=sys.stdin.buffer
n,d,a=list(map(int,b.readline().split()))
m=list(map(int,b.read().split()))
p,q=deque(),deque()
pl,ql=p.popleft,q.popleft
pa,qa=p.append,q.append
s=b=0
for x,h i... | 23 | 24 | 534 | 567 | def main():
import sys
from collections import deque
from operator import itemgetter
b = sys.stdin.buffer
n, d, a = list(map(int, b.readline().split()))
m = list(map(int, b.read().split()))
p, q = deque(), deque()
f, g = p.popleft, q.popleft
s = b = 0
for x, h in sorted(zip(m, m... | def main():
import sys
from collections import deque
from operator import itemgetter
b = sys.stdin.buffer
n, d, a = list(map(int, b.readline().split()))
m = list(map(int, b.read().split()))
p, q = deque(), deque()
pl, ql = p.popleft, q.popleft
pa, qa = p.append, q.append
s = b =... | false | 4.166667 | [
"- f, g = p.popleft, q.popleft",
"+ pl, ql = p.popleft, q.popleft",
"+ pa, qa = p.append, q.append",
"- f()",
"- b -= g()",
"+ pl()",
"+ b -= ql()",
"- p += (x + d + d,)",
"- q += (t * a,)",
"+ pa(x + d + d)",
... | false | 0.036125 | 0.036897 | 0.979088 | [
"s612755937",
"s871881487"
] |
u421925564 | p00118 | python | s500682843 | s068932857 | 140 | 80 | 8,652 | 15,644 | Accepted | Accepted | 42.86 | h = w = 0
slist =[]
list1=[]
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate= slist.pop()
#print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + '1' + list1[y][x + 1:]
if x + 1 < w:
... | import sys
sys.setrecursionlimit(20000)
h= 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - ... | 41 | 37 | 1,099 | 849 | h = w = 0
slist = []
list1 = []
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate = slist.pop()
# print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + "1" + list1[y][x + 1 :]
if x + 1 < w:
if l... | import sys
sys.setrecursionlimit(20000)
h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + "1" + list1[y][x + 1 :]
if y - 1 >= 0:
if list1[y - 1][x] == f:
dfs(x, y - 1, f)
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
... | false | 9.756098 | [
"-h = w = 0",
"-slist = []",
"+import sys",
"+",
"+sys.setrecursionlimit(20000)",
"+h = 0",
"+w = 0",
"-def dfs(f):",
"- while True:",
"- if len(slist) == 0:",
"- return 1",
"- coordinate = slist.pop()",
"- # print(coordinate)",
"- x = coordinate[0... | false | 0.082736 | 0.046544 | 1.777575 | [
"s500682843",
"s068932857"
] |
u785578220 | p02850 | python | s803158348 | s780054648 | 508 | 450 | 37,600 | 37,580 | Accepted | Accepted | 11.42 | from collections import deque
N = int(eval(input()))
B = []
L = []
for i in range(N-1):
ta,tb = list(map(int,input().split()))
B.append(ta)
B.append(tb)
L.append([ta,tb])
B =B[1::2]
E = [[] for _ in range(N + 1)]
for a, b in L:
E[a].append(b)
Q = deque([1])
C = [0] * (N + 1)
whi... | def main():
from collections import deque
N = int(eval(input()))
B = []
L = []
for i in range(N-1):
ta,tb = list(map(int,input().split()))
B.append(ta)
B.append(tb)
L.append([ta,tb])
B =B[1::2]
E = [[] for _ in range(N + 1)]
for a, b in L... | 28 | 31 | 496 | 614 | from collections import deque
N = int(eval(input()))
B = []
L = []
for i in range(N - 1):
ta, tb = list(map(int, input().split()))
B.append(ta)
B.append(tb)
L.append([ta, tb])
B = B[1::2]
E = [[] for _ in range(N + 1)]
for a, b in L:
E[a].append(b)
Q = deque([1])
C = [0] * (N + 1)
while Q:
v = ... | def main():
from collections import deque
N = int(eval(input()))
B = []
L = []
for i in range(N - 1):
ta, tb = list(map(int, input().split()))
B.append(ta)
B.append(tb)
L.append([ta, tb])
B = B[1::2]
E = [[] for _ in range(N + 1)]
for a, b in L:
E... | false | 9.677419 | [
"-from collections import deque",
"+def main():",
"+ from collections import deque",
"-N = int(eval(input()))",
"-B = []",
"-L = []",
"-for i in range(N - 1):",
"- ta, tb = list(map(int, input().split()))",
"- B.append(ta)",
"- B.append(tb)",
"- L.append([ta, tb])",
"-B = B[1::2... | false | 0.043716 | 0.042708 | 1.023588 | [
"s803158348",
"s780054648"
] |
u271934630 | p03274 | python | s384336817 | s198876263 | 234 | 111 | 62,576 | 14,656 | Accepted | Accepted | 52.56 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
arr = []
for i in range(n-k+1):
arr.append(min((abs(x[i])+abs(x[i]-x[i+k-1])), abs(x[i+k-1])+abs(x[i]-x[i+k-1])))
print((min(arr)))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
N, K = i_l()
x = i_l()
ans = 1 << 31
for i in range(N-K+1):
if x[i] >= 0:
ans = min(ans, x[i+K-1])
elif x[... | 8 | 21 | 212 | 493 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
arr = []
for i in range(n - k + 1):
arr.append(
min(
(abs(x[i]) + abs(x[i] - x[i + k - 1])),
abs(x[i + k - 1]) + abs(x[i] - x[i + k - 1]),
)
)
print((min(arr)))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
N, K = i_l()
x = i_l()
ans = 1 << 31
for i in range(N - K + 1):
if x[i] >= 0:
ans = min(ans, x[i + K - 1])
elif x[i + K - 1] ... | false | 61.904762 | [
"-n, k = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-arr = []",
"-for i in range(n - k + 1):",
"- arr.append(",
"- min(",
"- (abs(x[i]) + abs(x[i] - x[i + k - 1])),",
"- abs(x[i + k - 1]) + abs(x[i] - x[i + k - 1]),",
"- )",
"-... | false | 0.041731 | 0.121915 | 0.342292 | [
"s384336817",
"s198876263"
] |
u203383537 | p02554 | python | s729804775 | s594219727 | 579 | 27 | 11,556 | 9,104 | Accepted | Accepted | 95.34 | N = int(eval(input()))
tot = 10**N - (9**N + 9**N - 8**N)
print((tot%(10**9 + 7))) | n = int(eval(input()))
mod = 10**9 + 7
ans = pow(10,n,mod)
ans -= pow(9,n,mod)*2
ans += pow(8,n,mod)
print((ans%mod)) | 4 | 8 | 78 | 118 | N = int(eval(input()))
tot = 10**N - (9**N + 9**N - 8**N)
print((tot % (10**9 + 7)))
| n = int(eval(input()))
mod = 10**9 + 7
ans = pow(10, n, mod)
ans -= pow(9, n, mod) * 2
ans += pow(8, n, mod)
print((ans % mod))
| false | 50 | [
"-N = int(eval(input()))",
"-tot = 10**N - (9**N + 9**N - 8**N)",
"-print((tot % (10**9 + 7)))",
"+n = int(eval(input()))",
"+mod = 10**9 + 7",
"+ans = pow(10, n, mod)",
"+ans -= pow(9, n, mod) * 2",
"+ans += pow(8, n, mod)",
"+print((ans % mod))"
] | false | 0.497001 | 0.033022 | 15.050515 | [
"s729804775",
"s594219727"
] |
u796942881 | p03244 | python | s695800909 | s510983270 | 64 | 58 | 14,324 | 14,324 | Accepted | Accepted | 9.38 | def main():
n, *v = list(map(int, open(0).read().split()))
be = [0] * int(1e5)
bo = [0] * int(1e5)
for e, o in zip(*[iter(v)] * 2):
be[e - 1] += 1
bo[o - 1] += 1
if be.index(max(be)) == bo.index(max(bo)):
ve = max(be)
vo = max(bo)
be[be.index(ve)] = ... | def main():
n, *v = list(map(int, open(0).read().split()))
be = [0] * int(1e5)
bo = [0] * int(1e5)
for e, o in zip(*[iter(v)] * 2):
be[e - 1] += 1
bo[o - 1] += 1
ve = max(be)
vo = max(bo)
ke = be.index(ve)
ko = bo.index(vo)
if ke == ko:
be[ke] = 0
... | 19 | 21 | 475 | 453 | def main():
n, *v = list(map(int, open(0).read().split()))
be = [0] * int(1e5)
bo = [0] * int(1e5)
for e, o in zip(*[iter(v)] * 2):
be[e - 1] += 1
bo[o - 1] += 1
if be.index(max(be)) == bo.index(max(bo)):
ve = max(be)
vo = max(bo)
be[be.index(ve)] = 0
... | def main():
n, *v = list(map(int, open(0).read().split()))
be = [0] * int(1e5)
bo = [0] * int(1e5)
for e, o in zip(*[iter(v)] * 2):
be[e - 1] += 1
bo[o - 1] += 1
ve = max(be)
vo = max(bo)
ke = be.index(ve)
ko = bo.index(vo)
if ke == ko:
be[ke] = 0
bo[k... | false | 9.52381 | [
"- if be.index(max(be)) == bo.index(max(bo)):",
"- ve = max(be)",
"- vo = max(bo)",
"- be[be.index(ve)] = 0",
"- bo[bo.index(vo)] = 0",
"+ ve = max(be)",
"+ vo = max(bo)",
"+ ke = be.index(ve)",
"+ ko = bo.index(vo)",
"+ if ke == ko:",
"+ be[k... | false | 0.175017 | 0.041491 | 4.218167 | [
"s695800909",
"s510983270"
] |
u858748695 | p03588 | python | s065457946 | s129977205 | 516 | 296 | 29,096 | 10,868 | Accepted | Accepted | 42.64 | #!/usr/bin/env python3
N = int(eval(input()))
ab = [[0, 0] for _ in range(N)]
for i in range(N):
ab[i] = list(map(int, input().split()))
ab.sort(key=lambda x:x[0])
ans = ab[0][0]
for i in range(N)[1::]:
ans += min(ab[i][0] - ab[i-1][0], ab[i-1][1] - ab[i][1])
ans += ab[-1][1]
print(ans)
| #!/usr/bin/env python3
N = int(eval(input()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
idx = A.index(max(A))
print((A[idx] + B[idx]))
| 13 | 9 | 304 | 180 | #!/usr/bin/env python3
N = int(eval(input()))
ab = [[0, 0] for _ in range(N)]
for i in range(N):
ab[i] = list(map(int, input().split()))
ab.sort(key=lambda x: x[0])
ans = ab[0][0]
for i in range(N)[1::]:
ans += min(ab[i][0] - ab[i - 1][0], ab[i - 1][1] - ab[i][1])
ans += ab[-1][1]
print(ans)
| #!/usr/bin/env python3
N = int(eval(input()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
idx = A.index(max(A))
print((A[idx] + B[idx]))
| false | 30.769231 | [
"-ab = [[0, 0] for _ in range(N)]",
"+A = [0] * N",
"+B = [0] * N",
"- ab[i] = list(map(int, input().split()))",
"-ab.sort(key=lambda x: x[0])",
"-ans = ab[0][0]",
"-for i in range(N)[1::]:",
"- ans += min(ab[i][0] - ab[i - 1][0], ab[i - 1][1] - ab[i][1])",
"-ans += ab[-1][1]",
"-print(ans)"... | false | 0.117016 | 0.100544 | 1.163824 | [
"s065457946",
"s129977205"
] |
u020604402 | p03645 | python | s028105959 | s714331731 | 732 | 381 | 37,160 | 37,072 | Accepted | Accepted | 47.95 | N , M = list(map(int,input().split()))
L = []
transit1 = set()
transit2 = set()
for _ in range(M):
t = tuple(map(int,input().split()))
L.append(t)
for x in L :
if x[1] == N:
transit1.add(x[0])
if x[0] == 1:
transit2.add(x[1])
if transit1 & transit2 == set():
print("IMPOS... | import sys
input = sys.stdin.readline
N , M = list(map(int,input().split()))
L = []
transit1 = set()
transit2 = set()
for _ in range(M):
t = tuple(map(int,input().split()))
L.append(t)
for x in L :
if x[1] == N:
transit1.add(x[0])
if x[0] == 1:
transit2.add(x[1])
if transit... | 16 | 18 | 352 | 392 | N, M = list(map(int, input().split()))
L = []
transit1 = set()
transit2 = set()
for _ in range(M):
t = tuple(map(int, input().split()))
L.append(t)
for x in L:
if x[1] == N:
transit1.add(x[0])
if x[0] == 1:
transit2.add(x[1])
if transit1 & transit2 == set():
print("IMPOSSIBLE")
else:... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
L = []
transit1 = set()
transit2 = set()
for _ in range(M):
t = tuple(map(int, input().split()))
L.append(t)
for x in L:
if x[1] == N:
transit1.add(x[0])
if x[0] == 1:
transit2.add(x[1])
if transit1 & transit2 ... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.0502 | 0.051511 | 0.974555 | [
"s028105959",
"s714331731"
] |
u768896740 | p03549 | python | s840964273 | s920856882 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | n, m = list(map(int, input().split()))
ans_time = (n-m) * 100
ans = (2**m) * (1900*m + ans_time)
print(ans) | n, m = list(map(int, input().split()))
print(((m*1900+(n-m)*100)*2**m))
| 5 | 4 | 106 | 69 | n, m = list(map(int, input().split()))
ans_time = (n - m) * 100
ans = (2**m) * (1900 * m + ans_time)
print(ans)
| n, m = list(map(int, input().split()))
print(((m * 1900 + (n - m) * 100) * 2**m))
| false | 20 | [
"-ans_time = (n - m) * 100",
"-ans = (2**m) * (1900 * m + ans_time)",
"-print(ans)",
"+print(((m * 1900 + (n - m) * 100) * 2**m))"
] | false | 0.045733 | 0.048089 | 0.951017 | [
"s840964273",
"s920856882"
] |
u941438707 | p02918 | python | s361357470 | s927019120 | 52 | 46 | 3,316 | 3,316 | Accepted | Accepted | 11.54 | n,k=list(map(int,input().split()))
s="#"+eval(input())+"#"
ans=0
for i in range(1,n+1):
if s[i]=="R" and s[i+1]=="R":
ans+=1
if s[i]=="L" and s[i-1]=="L":
ans+=1
a=max(s.count("LR"),s.count("RL"))
if k>=a:
ans=n-1
else:
ans+=2*k
print(ans) | n,k=list(map(int,input().split()))
s=eval(input())
a=0
for i in range(1,n):
if s[i]==s[i-1]:
a+=1
print((min(n-1,a+2*k))) | 14 | 7 | 272 | 125 | n, k = list(map(int, input().split()))
s = "#" + eval(input()) + "#"
ans = 0
for i in range(1, n + 1):
if s[i] == "R" and s[i + 1] == "R":
ans += 1
if s[i] == "L" and s[i - 1] == "L":
ans += 1
a = max(s.count("LR"), s.count("RL"))
if k >= a:
ans = n - 1
else:
ans += 2 * k
print(ans)
| n, k = list(map(int, input().split()))
s = eval(input())
a = 0
for i in range(1, n):
if s[i] == s[i - 1]:
a += 1
print((min(n - 1, a + 2 * k)))
| false | 50 | [
"-s = \"#\" + eval(input()) + \"#\"",
"-ans = 0",
"-for i in range(1, n + 1):",
"- if s[i] == \"R\" and s[i + 1] == \"R\":",
"- ans += 1",
"- if s[i] == \"L\" and s[i - 1] == \"L\":",
"- ans += 1",
"-a = max(s.count(\"LR\"), s.count(\"RL\"))",
"-if k >= a:",
"- ans = n - 1",... | false | 0.072363 | 0.070542 | 1.02582 | [
"s361357470",
"s927019120"
] |
u810288681 | p02989 | python | s403195954 | s451977123 | 84 | 76 | 14,428 | 14,396 | Accepted | Accepted | 9.52 | n = int(eval(input()))
d = sorted(list(map(int, input().split())))
ans = 0
for i in range(d[n//2-1]+1,d[n//2]+1):
ans +=1
print(ans) | n = int(eval(input()))
d = sorted(list(map(int, input().split())))
if d[n//2]==d[n//2 - 1]:
print((0))
else:
print((d[n//2]-d[n//2 - 1])) | 6 | 6 | 135 | 140 | n = int(eval(input()))
d = sorted(list(map(int, input().split())))
ans = 0
for i in range(d[n // 2 - 1] + 1, d[n // 2] + 1):
ans += 1
print(ans)
| n = int(eval(input()))
d = sorted(list(map(int, input().split())))
if d[n // 2] == d[n // 2 - 1]:
print((0))
else:
print((d[n // 2] - d[n // 2 - 1]))
| false | 0 | [
"-ans = 0",
"-for i in range(d[n // 2 - 1] + 1, d[n // 2] + 1):",
"- ans += 1",
"-print(ans)",
"+if d[n // 2] == d[n // 2 - 1]:",
"+ print((0))",
"+else:",
"+ print((d[n // 2] - d[n // 2 - 1]))"
] | false | 0.04611 | 0.121376 | 0.379891 | [
"s403195954",
"s451977123"
] |
u987164499 | p03103 | python | s040507797 | s225105973 | 1,889 | 324 | 35,300 | 27,880 | Accepted | Accepted | 82.85 | from sys import stdin
n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li.sort(key=lambda x:(x[0],x[1]))
cost = 0
while m > 0:
if li[0][1] > 0:
cost += li[0][0]
li[0][1] -= 1
m -= 1
else:
... | from sys import stdin
n,m = list(map(int,stdin.readline().rstrip().split()))
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li.sort()
yen = 0
for i in li:
j,k = i
if k >= m:
yen += j*m
break
yen += j*k
m -= k
print(yen) | 17 | 16 | 352 | 290 | from sys import stdin
n, m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
li.sort(key=lambda x: (x[0], x[1]))
cost = 0
while m > 0:
if li[0][1] > 0:
cost += li[0][0]
li[0][1] -= 1
m -= 1
else:
li.p... | from sys import stdin
n, m = list(map(int, stdin.readline().rstrip().split()))
li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
li.sort()
yen = 0
for i in li:
j, k = i
if k >= m:
yen += j * m
break
yen += j * k
m -= k
print(yen)
| false | 5.882353 | [
"-n, m = [int(x) for x in stdin.readline().rstrip().split()]",
"+n, m = list(map(int, stdin.readline().rstrip().split()))",
"-li.sort(key=lambda x: (x[0], x[1]))",
"-cost = 0",
"-while m > 0:",
"- if li[0][1] > 0:",
"- cost += li[0][0]",
"- li[0][1] -= 1",
"- m -= 1",
"- ... | false | 0.056995 | 0.083839 | 0.67982 | [
"s040507797",
"s225105973"
] |
u367701763 | p02685 | python | s556662503 | s688276091 | 159 | 110 | 104,000 | 103,892 | Accepted | Accepted | 30.82 | class Combination: # ่จ็ฎ้ใฏ O(n_max + log(mod))
def __init__(self, n_max, mod=10**9+7):
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max+1): # ้ไน(= n_max !)ใฎ้ๅ
ใ็ๆ
f = f * i % mod ... | class Combination: # ่จ็ฎ้ใฏ O(n_max + log(mod))
def __init__(self, n_max, mod=10**9+7):
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max+1): # ้ไน(= n_max !)ใฎ้ๅ
ใ็ๆ
f = f * i % mod ... | 28 | 31 | 1,316 | 1,347 | class Combination: # ่จ็ฎ้ใฏ O(n_max + log(mod))
def __init__(self, n_max, mod=10**9 + 7):
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max + 1): # ้ไน(= n_max !)ใฎ้ๅ
ใ็ๆ
f = f * i % mod # ๅ็่จ็ปๆณใซใใ้ไนใฎ้ซ้่จ็ฎ
fac.append(f) # fac ใฏ้ไนใฎใชในใ
f = ... | class Combination: # ่จ็ฎ้ใฏ O(n_max + log(mod))
def __init__(self, n_max, mod=10**9 + 7):
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max + 1): # ้ไน(= n_max !)ใฎ้ๅ
ใ็ๆ
f = f * i % mod # ๅ็่จ็ปๆณใซใใ้ไนใฎ้ซ้่จ็ฎ
fac.append(f) # fac ใฏ้ไนใฎใชในใ
f = ... | false | 9.677419 | [
"-for k in range(K + 1):",
"- res += C.H(N - k, k) * M * pow(M - 1, N - k - 1, MOD)",
"+p = pow(M - 1, N - K - 1, MOD)",
"+for k in range(K, -1, -1):",
"+ res += C.H(N - k, k) * M * p",
"+ p *= M - 1",
"+ p %= MOD"
] | false | 0.113548 | 0.095104 | 1.193939 | [
"s556662503",
"s688276091"
] |
u687044304 | p03107 | python | s938040144 | s151198926 | 323 | 25 | 3,452 | 3,244 | Accepted | Accepted | 92.26 | # -*- coding:utf-8 -*-
def solve():
S = eval(input())
ans = 0
i = 0
while i != len(S):
if i+1 >= len(S):
break
if S[i] != S[i+1]:
# ๆถใ
if i == 0:
if len(S) <= 2:
ans += 1
S = ""... | # -*- coding:utf-8 -*-
def solve():
S = eval(input())
num0 = 0
num1 = 0
for moji in S:
if moji == "0":
num0 += 1
else:
num1 += 1
erase_num = min(num0, num1)
print((erase_num*2))
if __name__ == "__main__":
solve()
| 41 | 18 | 881 | 294 | # -*- coding:utf-8 -*-
def solve():
S = eval(input())
ans = 0
i = 0
while i != len(S):
if i + 1 >= len(S):
break
if S[i] != S[i + 1]:
# ๆถใ
if i == 0:
if len(S) <= 2:
ans += 1
S = ""
... | # -*- coding:utf-8 -*-
def solve():
S = eval(input())
num0 = 0
num1 = 0
for moji in S:
if moji == "0":
num0 += 1
else:
num1 += 1
erase_num = min(num0, num1)
print((erase_num * 2))
if __name__ == "__main__":
solve()
| false | 56.097561 | [
"- ans = 0",
"- i = 0",
"- while i != len(S):",
"- if i + 1 >= len(S):",
"- break",
"- if S[i] != S[i + 1]:",
"- # ๆถใ",
"- if i == 0:",
"- if len(S) <= 2:",
"- ans += 1",
"- S = \"\"",
... | false | 0.054256 | 0.03566 | 1.521498 | [
"s938040144",
"s151198926"
] |
u488178971 | p03611 | python | s032921819 | s730637333 | 104 | 80 | 16,228 | 13,964 | Accepted | Accepted | 23.08 | #ABC 072 C
N=int(eval(input()))
A=[int(j) for j in input().split()]
cnt=[0]*(10**6)
for a in A:
cnt[a]+=1
cnt[a+1]+=1
cnt[a+2]+=1
print((max(cnt))) | #ABC 072 C
N=int(eval(input()))
A=[int(j) for j in input().split()]
cnt=[0]*(10**5+10)
for a in A:
cnt[a]+=1
cnt[a+1]+=1
cnt[a+2]+=1
print((max(cnt))) | 9 | 9 | 159 | 162 | # ABC 072 C
N = int(eval(input()))
A = [int(j) for j in input().split()]
cnt = [0] * (10**6)
for a in A:
cnt[a] += 1
cnt[a + 1] += 1
cnt[a + 2] += 1
print((max(cnt)))
| # ABC 072 C
N = int(eval(input()))
A = [int(j) for j in input().split()]
cnt = [0] * (10**5 + 10)
for a in A:
cnt[a] += 1
cnt[a + 1] += 1
cnt[a + 2] += 1
print((max(cnt)))
| false | 0 | [
"-cnt = [0] * (10**6)",
"+cnt = [0] * (10**5 + 10)"
] | false | 0.079939 | 0.049266 | 1.622615 | [
"s032921819",
"s730637333"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.