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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u695811449 | p03262 | python | s513677392 | s905213958 | 118 | 80 | 14,252 | 14,252 | Accepted | Accepted | 32.2 | import sys
N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
if N==1:
print((abs(X-x[0])))
sys.exit()
x.append(X)
x.sort()
ANS=gcd(x[1]-x[0],x[2]-x[1])
for i in range(N):
ANS=gcd(ANS,x[i+1]-x[i])
print(AN... | N,X=list(map(int,input().split()))
A=list(map(int,input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
s=abs(A[0]-X)
for i in range(1,N):
s=gcd(s,abs(A[i]-X))
print(s) | 25 | 13 | 315 | 198 | import sys
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
if N == 1:
print((abs(X - x[0])))
sys.exit()
x.append(X)
x.sort()
ANS = gcd(x[1] - x[0], x[2] - x[1])
for i in range(N):
ANS = gcd(ANS, x[i + 1] - x[i])... | N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
s = abs(A[0] - X)
for i in range(1, N):
s = gcd(s, abs(A[i] - X))
print(s)
| false | 48 | [
"-import sys",
"-",
"-x = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"-if N == 1:",
"- print((abs(X - x[0])))",
"- sys.exit()",
"-x.append(X)",
"-x.sort()",
"-ANS = gcd(x[1] - x[0], x[2] - x[1])",
"-for i in range(N):",
"- ANS = gcd(ANS, x[i + 1] - x[i])... | false | 0.056079 | 0.043521 | 1.288568 | [
"s513677392",
"s905213958"
] |
u621935300 | p03504 | python | s722986586 | s176448835 | 533 | 337 | 32,104 | 50,844 | Accepted | Accepted | 36.77 | import collections
N,C=list(map(int,input().split()))
a=collections.defaultdict(list)
max_t=0
for i in range(N):
s,t,c=list(map(int,input().split()))
a[c].append((s,t))
max_t=max(max_t,t)
[a[i].sort() for i in list(a.keys())]
#print a
#print max_t
b=collections.defaultdict(list)
for i,j in list... | # -*- coding: utf-8 -*-
import sys
from collections import deque
N,C=list(map(int, sys.stdin.readline().split()))
stc=[ list(map(int, sys.stdin.readline().split())) for _ in range(N)]
stc.sort(key=lambda x:(x[0]) )
max_t=max(stc, key=(lambda x: x[1]))[1]
channel=[ deque() for _ in range(C+1) ]
for s,t,c ... | 55 | 33 | 783 | 783 | import collections
N, C = list(map(int, input().split()))
a = collections.defaultdict(list)
max_t = 0
for i in range(N):
s, t, c = list(map(int, input().split()))
a[c].append((s, t))
max_t = max(max_t, t)
[a[i].sort() for i in list(a.keys())]
# print a
# print max_t
b = collections.defaultdict(list)
for i,... | # -*- coding: utf-8 -*-
import sys
from collections import deque
N, C = list(map(int, sys.stdin.readline().split()))
stc = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
stc.sort(key=lambda x: (x[0]))
max_t = max(stc, key=(lambda x: x[1]))[1]
channel = [deque() for _ in range(C + 1)]
for s, t, c in s... | false | 40 | [
"-import collections",
"+# -*- coding: utf-8 -*-",
"+import sys",
"+from collections import deque",
"-N, C = list(map(int, input().split()))",
"-a = collections.defaultdict(list)",
"-max_t = 0",
"-for i in range(N):",
"- s, t, c = list(map(int, input().split()))",
"- a[c].append((s, t))",
... | false | 0.036538 | 0.080135 | 0.455952 | [
"s722986586",
"s176448835"
] |
u020390084 | p03503 | python | s859577092 | s465495732 | 157 | 87 | 3,188 | 3,188 | Accepted | Accepted | 44.59 | #!/usr/bin/env python3
import itertools
def main():
N = int(eval(input()))
F = [list(map(int,input().split())) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
bit_list = list(itertools.product([0, 1], repeat=10))
bit_list.pop(0)
answer = -10**9-1
for b in... | #!/usr/bin/env python3
import itertools
def main():
N = int(eval(input()))
F = [int(input().replace(' ',''),2) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
answer = -float('inf')
for bit in range(1,1<<10):
tmp_profit = 0
for i in range(N):
... | 27 | 21 | 656 | 521 | #!/usr/bin/env python3
import itertools
def main():
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
bit_list = list(itertools.product([0, 1], repeat=10))
bit_list.pop(0)
answer = -(10**9) - 1
for b in bi... | #!/usr/bin/env python3
import itertools
def main():
N = int(eval(input()))
F = [int(input().replace(" ", ""), 2) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
answer = -float("inf")
for bit in range(1, 1 << 10):
tmp_profit = 0
for i in range(N):
... | false | 22.222222 | [
"- F = [list(map(int, input().split())) for _ in range(N)]",
"+ F = [int(input().replace(\" \", \"\"), 2) for _ in range(N)]",
"- bit_list = list(itertools.product([0, 1], repeat=10))",
"- bit_list.pop(0)",
"- answer = -(10**9) - 1",
"- for b in bit_list:",
"- profit = 0",
"+ ... | false | 0.045084 | 0.033528 | 1.344656 | [
"s859577092",
"s465495732"
] |
u729133443 | p03597 | python | s705346078 | s622670826 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | print((eval(eval(input())+'**2-'+eval(input())))) | n,a=list(map(int,open(0)));print((n*n-a)) | 1 | 1 | 35 | 33 | print((eval(eval(input()) + "**2-" + eval(input()))))
| n, a = list(map(int, open(0)))
print((n * n - a))
| false | 0 | [
"-print((eval(eval(input()) + \"**2-\" + eval(input()))))",
"+n, a = list(map(int, open(0)))",
"+print((n * n - a))"
] | false | 0.031681 | 0.03291 | 0.962658 | [
"s705346078",
"s622670826"
] |
u750058957 | p02779 | python | s877148776 | s765130269 | 103 | 94 | 26,808 | 36,088 | Accepted | Accepted | 8.74 | a = int(eval(input()))
b = list(map(int, input().split(" ")))
t = set(b)
bb = list(t)
if (len(b) == len(bb)):
print("YES")
else:
print("NO")
| N = int(eval(input()))
A = {i for i in input().split()}
print(("YES" if N==len(A) else "NO")) | 9 | 3 | 148 | 87 | a = int(eval(input()))
b = list(map(int, input().split(" ")))
t = set(b)
bb = list(t)
if len(b) == len(bb):
print("YES")
else:
print("NO")
| N = int(eval(input()))
A = {i for i in input().split()}
print(("YES" if N == len(A) else "NO"))
| false | 66.666667 | [
"-a = int(eval(input()))",
"-b = list(map(int, input().split(\" \")))",
"-t = set(b)",
"-bb = list(t)",
"-if len(b) == len(bb):",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+N = int(eval(input()))",
"+A = {i for i in input().split()}",
"+print((\"YES\" if N == len(A) else \"NO\"))"
... | false | 0.035907 | 0.065909 | 0.544799 | [
"s877148776",
"s765130269"
] |
u535659144 | p02707 | python | s507805636 | s609790897 | 211 | 162 | 116,240 | 92,324 | Accepted | Accepted | 23.22 | import copy
import math
n=int(eval(input()))
x=[list() for a in range(n)]
y=list(map(int,input().split()))
for t in y:
x[t-1].append("a")
for s in x:
print((len(s))) | n = int(eval(input()))
li = list(map(int,input().split()))
li.sort(reverse = True)
count = 0
for i in range(1,n+1):
count = 0
while True:
if li:
if li[-1]==i:
count+=1
li.pop()
else:
break
else:
bre... | 9 | 16 | 174 | 334 | import copy
import math
n = int(eval(input()))
x = [list() for a in range(n)]
y = list(map(int, input().split()))
for t in y:
x[t - 1].append("a")
for s in x:
print((len(s)))
| n = int(eval(input()))
li = list(map(int, input().split()))
li.sort(reverse=True)
count = 0
for i in range(1, n + 1):
count = 0
while True:
if li:
if li[-1] == i:
count += 1
li.pop()
else:
break
else:
break
p... | false | 43.75 | [
"-import copy",
"-import math",
"-",
"-x = [list() for a in range(n)]",
"-y = list(map(int, input().split()))",
"-for t in y:",
"- x[t - 1].append(\"a\")",
"-for s in x:",
"- print((len(s)))",
"+li = list(map(int, input().split()))",
"+li.sort(reverse=True)",
"+count = 0",
"+for i in r... | false | 0.039203 | 0.095719 | 0.409559 | [
"s507805636",
"s609790897"
] |
u369752439 | p03317 | python | s280903329 | s803418637 | 47 | 17 | 14,008 | 3,060 | Accepted | Accepted | 63.83 | N, K = list(map(int, input().strip().split()))
AList = list(map(int, input().strip().split()))
length = len(AList ) - 1
ans = 0
while(length > 0):
ans += 1
length = length - (K - 1)
print(ans) | N, K = list(map(int, input().strip().split()))
print((int((N- 1) / (K - 1)) + (0 if (N-1)%(K-1)==0 else 1))) | 9 | 2 | 209 | 107 | N, K = list(map(int, input().strip().split()))
AList = list(map(int, input().strip().split()))
length = len(AList) - 1
ans = 0
while length > 0:
ans += 1
length = length - (K - 1)
print(ans)
| N, K = list(map(int, input().strip().split()))
print((int((N - 1) / (K - 1)) + (0 if (N - 1) % (K - 1) == 0 else 1)))
| false | 77.777778 | [
"-AList = list(map(int, input().strip().split()))",
"-length = len(AList) - 1",
"-ans = 0",
"-while length > 0:",
"- ans += 1",
"- length = length - (K - 1)",
"-print(ans)",
"+print((int((N - 1) / (K - 1)) + (0 if (N - 1) % (K - 1) == 0 else 1)))"
] | false | 0.059473 | 0.086064 | 0.69103 | [
"s280903329",
"s803418637"
] |
u188827677 | p02732 | python | s572343621 | s944367642 | 296 | 217 | 24,996 | 34,024 | Accepted | Accepted | 26.69 | n = int(eval(input()))
a = list(map(int, input().split()))
nums = [0]*(n+1)
for i in a: nums[i] += 1
t = 0
for i in nums: t += i*(i-1)//2
for i in a: print((t+1-nums[i])) | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
count = Counter(a)
numSum = 0
for i in list(count.values()):
numSum += i*(i-1)//2
for i in a:
print((numSum - (count[i]-1))) | 10 | 11 | 174 | 217 | n = int(eval(input()))
a = list(map(int, input().split()))
nums = [0] * (n + 1)
for i in a:
nums[i] += 1
t = 0
for i in nums:
t += i * (i - 1) // 2
for i in a:
print((t + 1 - nums[i]))
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
count = Counter(a)
numSum = 0
for i in list(count.values()):
numSum += i * (i - 1) // 2
for i in a:
print((numSum - (count[i] - 1)))
| false | 9.090909 | [
"+from collections import Counter",
"+",
"-nums = [0] * (n + 1)",
"+count = Counter(a)",
"+numSum = 0",
"+for i in list(count.values()):",
"+ numSum += i * (i - 1) // 2",
"- nums[i] += 1",
"-t = 0",
"-for i in nums:",
"- t += i * (i - 1) // 2",
"-for i in a:",
"- print((t + 1 - n... | false | 0.052765 | 0.03227 | 1.635081 | [
"s572343621",
"s944367642"
] |
u047796752 | p03170 | python | s563072449 | s141585160 | 368 | 194 | 41,964 | 74,188 | Accepted | Accepted | 47.28 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [False]*(K+1)
for i in range(K+1):
for ai in a:
if i-ai>=0:
dp[i] |= not dp[i-ai]
if dp[K]:
print('First')
else:
print('Second') | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [False]*(K+1)
for i in range(K+1):
for ai in a:
if i-ai>=0:
dp[i] |= not dp[i-ai]
if dp[K]:
print('First')
else:
print('Second') | 13 | 16 | 248 | 290 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [False] * (K + 1)
for i in range(K + 1):
for ai in a:
if i - ai >= 0:
dp[i] |= not dp[i - ai]
if dp[K]:
print("First")
else:
print("Second")
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [False] * (K + 1)
for i in range(K + 1):
for ai in a:
if i - ai >= 0:
dp[i] |= not dp[i - ai]
if dp[K]:
print("First")
else:
print("Second")
| false | 18.75 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038115 | 0.047759 | 0.798082 | [
"s563072449",
"s141585160"
] |
u960171798 | p03073 | python | s113541001 | s960899312 | 64 | 42 | 4,776 | 3,188 | Accepted | Accepted | 34.38 | s = list(str(eval(input())))
S = []
for i in range(len(s)):
S.append(int(s[i]))
ans1 = 100000
ans2 = 100000
ans = 0
t = 0
s = 0
if S[0]==0:
for i in range(1,len(S),2):
if S[i] != 1:
t += 1
for i in range(0,len(S),2):
if S[i] != 0:
s += 1
ans1 = min(t+s,len(S)-t-s)
else:
... | S = eval(input())
len_S = len(S)
cnt1 = 0
if len_S%2 == 0:
ans = "01"*(len_S//2)
else:
ans = "01"*(len_S//2)+"0"
for i in range(len_S):
if S[i]!=ans[i]:
cnt1 += 1
final_ans = min(len_S-cnt1,cnt1)
print(final_ans) | 28 | 13 | 503 | 229 | s = list(str(eval(input())))
S = []
for i in range(len(s)):
S.append(int(s[i]))
ans1 = 100000
ans2 = 100000
ans = 0
t = 0
s = 0
if S[0] == 0:
for i in range(1, len(S), 2):
if S[i] != 1:
t += 1
for i in range(0, len(S), 2):
if S[i] != 0:
s += 1
ans1 = min(t + s, le... | S = eval(input())
len_S = len(S)
cnt1 = 0
if len_S % 2 == 0:
ans = "01" * (len_S // 2)
else:
ans = "01" * (len_S // 2) + "0"
for i in range(len_S):
if S[i] != ans[i]:
cnt1 += 1
final_ans = min(len_S - cnt1, cnt1)
print(final_ans)
| false | 53.571429 | [
"-s = list(str(eval(input())))",
"-S = []",
"-for i in range(len(s)):",
"- S.append(int(s[i]))",
"-ans1 = 100000",
"-ans2 = 100000",
"-ans = 0",
"-t = 0",
"-s = 0",
"-if S[0] == 0:",
"- for i in range(1, len(S), 2):",
"- if S[i] != 1:",
"- t += 1",
"- for i in ra... | false | 0.038383 | 0.034501 | 1.112516 | [
"s113541001",
"s960899312"
] |
u896741788 | p03044 | python | s488740374 | s479629552 | 834 | 683 | 85,180 | 85,168 | Accepted | Accepted | 18.11 | n=int(input())
edges=[[] for i in range(n)]
import sys
sys.setrecursionlimit(10**7)
for i in range(n-1):
a,s,w=map(int,input().split())
edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])
colors=[-1]*n
colors[0]=1
def dfs(now):
for to,cost in edges[now]:
if colors[to]==-1:
... | import sys
input=sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n=int(input())
edges=[[] for i in range(n)]
for i in range(n-1):
a,s,w=map(int,input().split())
edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])
colors=[-1]*n
colors[0]=1
def dfs(now):
for to,cost in edges[now]:
... | 18 | 18 | 410 | 441 | n = int(input())
edges = [[] for i in range(n)]
import sys
sys.setrecursionlimit(10**7)
for i in range(n - 1):
a, s, w = map(int, input().split())
edges[a - 1].append([s - 1, w])
edges[s - 1].append([a - 1, w])
colors = [-1] * n
colors[0] = 1
def dfs(now):
for to, cost in edges[now]:
if color... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n = int(input())
edges = [[] for i in range(n)]
for i in range(n - 1):
a, s, w = map(int, input().split())
edges[a - 1].append([s - 1, w])
edges[s - 1].append([a - 1, w])
colors = [-1] * n
colors[0] = 1
def dfs(now):
for to, co... | false | 0 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**9)",
"-import sys",
"-",
"-sys.setrecursionlimit(10**7)"
] | false | 0.047421 | 0.114921 | 0.412636 | [
"s488740374",
"s479629552"
] |
u614314290 | p03450 | python | s406011528 | s249927951 | 1,320 | 1,187 | 165,968 | 113,164 | Accepted | Accepted | 10.08 | import sys
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
LRD = [list(map(int, input().split())) for _ in range(M)]
graph = [{} for _ in range(N)]
for l, r, d in LRD:
l, r = l - 1, r - 1
graph[l][r] = d
graph[r][l] = -d
visited = [False] * N
depths = [-1] * N
def dfs(v, p, d):
... | import sys
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
LRD = [list(map(int, input().split())) for _ in range(M)]
graph = [{} for _ in range(N)]
for l, r, d in LRD:
l, r = l - 1, r - 1
graph[l][r] = d
graph[r][l] = -d
visited = [False] * N
depths = [0] * N
def dfs(v):
q = [... | 37 | 35 | 698 | 661 | import sys
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
LRD = [list(map(int, input().split())) for _ in range(M)]
graph = [{} for _ in range(N)]
for l, r, d in LRD:
l, r = l - 1, r - 1
graph[l][r] = d
graph[r][l] = -d
visited = [False] * N
depths = [-1] * N
def dfs(v, p, d):
i... | import sys
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
LRD = [list(map(int, input().split())) for _ in range(M)]
graph = [{} for _ in range(N)]
for l, r, d in LRD:
l, r = l - 1, r - 1
graph[l][r] = d
graph[r][l] = -d
visited = [False] * N
depths = [0] * N
def dfs(v):
q = [v]
... | false | 5.405405 | [
"-depths = [-1] * N",
"+depths = [0] * N",
"-def dfs(v, p, d):",
"- if visited[v]:",
"- return True",
"- visited[v] = True",
"- depths[v] = d",
"- for n in graph[v]:",
"- if n == p:",
"- continue",
"- n_depth = d + graph[v][n]",
"- if depths[n... | false | 0.044212 | 0.039562 | 1.117536 | [
"s406011528",
"s249927951"
] |
u644907318 | p03549 | python | s853721424 | s260477202 | 62 | 27 | 61,664 | 9,144 | Accepted | Accepted | 56.45 | N,M = list(map(int,input().split()))
T = (N-M)*100+M*1900
print((T*2**M)) | N,M = list(map(int,input().split()))
print(((1900*M+(N-M)*100)*2**M)) | 3 | 2 | 67 | 62 | N, M = list(map(int, input().split()))
T = (N - M) * 100 + M * 1900
print((T * 2**M))
| N, M = list(map(int, input().split()))
print(((1900 * M + (N - M) * 100) * 2**M))
| false | 33.333333 | [
"-T = (N - M) * 100 + M * 1900",
"-print((T * 2**M))",
"+print(((1900 * M + (N - M) * 100) * 2**M))"
] | false | 0.171147 | 0.044446 | 3.850674 | [
"s853721424",
"s260477202"
] |
u150984829 | p02277 | python | s289073437 | s848755757 | 760 | 660 | 21,120 | 26,992 | Accepted | Accepted | 13.16 | import sys
def t(A,p,r):
x=A[r][1];i=p-1
for j in range(p,r):
if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
A[i+1],A[r]=A[r],A[i+1]
return i+1
def k(A,p,r):
if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
for i in range(n-1):
if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
return'S'
n=int(ev... | import sys
def t(A,p,r):
x=A[r][1];i=p-1
for j in range(p,r):
if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
A[i+1],A[r]=A[r],A[i+1]
return i+1
def k(A,p,r):
if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
for i in range(n-1):
if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
return'S'
n=int(ev... | 17 | 18 | 437 | 463 | import sys
def t(A, p, r):
x = A[r][1]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
def k(A, p, r):
if p < r:
q = t(A, p, r)
k(A, p, q - 1)
k(A, q + 1, r)
... | import sys
def t(A, p, r):
x = A[r][1]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
def k(A, p, r):
if p < r:
q = t(A, p, r)
k(A, p, q - 1)
k(A, q + 1, r)
... | false | 5.555556 | [
"-for e in [[s(A) + \"table\"]] + A:",
"- print((*e[:2]))",
"+print((s(A) + \"table\"))",
"+print((\"\\n\".join(f\"{a} {b}\" for a, b, c in A)))"
] | false | 0.03148 | 0.036422 | 0.864338 | [
"s289073437",
"s848755757"
] |
u964299793 | p03682 | python | s267723774 | s188817337 | 1,773 | 1,567 | 112,860 | 53,720 | Accepted | Accepted | 11.62 | class UnionFind():
def __init__(self,n):
self.n=n
self.par=[i for i in range(n)]
self.size=[1]*n
def find(self,x):
if x==self.par[x]:
return self.par[x]
else:
self.par[x]=self.find(self.par[x])
return self.par[x]
def unit... | class UnionFind():
def __init__(self,n):
self.n=n
self.par=[i for i in range(n)]
self.size=[1]*n
def find(self,x):
if x==self.par[x]:
return self.par[x]
else:
self.par[x]=self.find(self.par[x])
return self.par[x]
def unit... | 56 | 54 | 1,212 | 1,167 | class UnionFind:
def __init__(self, n):
self.n = n
self.par = [i for i in range(n)]
self.size = [1] * n
def find(self, x):
if x == self.par[x]:
return self.par[x]
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def u... | class UnionFind:
def __init__(self, n):
self.n = n
self.par = [i for i in range(n)]
self.size = [1] * n
def find(self, x):
if x == self.par[x]:
return self.par[x]
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def u... | false | 3.571429 | [
"-import sys",
"-",
"-input = sys.stdin.buffer.readline"
] | false | 0.047589 | 0.036997 | 1.286295 | [
"s267723774",
"s188817337"
] |
u832039789 | p03739 | python | s744002567 | s797524331 | 132 | 121 | 14,212 | 14,212 | Accepted | Accepted | 8.33 | import itertools
n = int(eval(input()))
a = list(map(int,input().split()))
sum = list(itertools.accumulate(a))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i in range(n):
s = sum[i] + dif1
t = sum[i] + dif2
if i%2==0:
if s<1:
dif1 += 1 - s
... | import itertools
n = int(eval(input()))
a = list(map(int,input().split()))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i,j in enumerate(itertools.accumulate(a)):
s = j + dif1
t = j + dif2
if i%2==0:
if s<1:
dif1 += 1 - s
res1 += 1 - s
... | 29 | 26 | 632 | 561 | import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
sum = list(itertools.accumulate(a))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i in range(n):
s = sum[i] + dif1
t = sum[i] + dif2
if i % 2 == 0:
if s < 1:
dif1 += 1 - s
res1... | import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i, j in enumerate(itertools.accumulate(a)):
s = j + dif1
t = j + dif2
if i % 2 == 0:
if s < 1:
dif1 += 1 - s
res1 += 1 - s
... | false | 10.344828 | [
"-sum = list(itertools.accumulate(a))",
"-for i in range(n):",
"- s = sum[i] + dif1",
"- t = sum[i] + dif2",
"+for i, j in enumerate(itertools.accumulate(a)):",
"+ s = j + dif1",
"+ t = j + dif2",
"- # print(dif1,res1,dif2,res2)",
"-# print(res1,res2)"
] | false | 0.033667 | 0.035417 | 0.950571 | [
"s744002567",
"s797524331"
] |
u815763296 | p02571 | python | s639608993 | s962649774 | 68 | 62 | 9,112 | 8,984 | Accepted | Accepted | 8.82 | S = eval(input())
T = eval(input())
Ls = len(S)
Lt = len(T)
ans = 0
for i in range(Ls-Lt+1):
count = 0
for j in range(Lt):
count += S[i+j] == T[j]
ans = max(ans, count)
ans = Lt-ans
print(ans)
| S = eval(input())
T = eval(input())
Ls = len(S)
Lt = len(T)
ans = 1000
for i in range(Ls-Lt+1):
count = 0
for j in range(Lt):
if S[i+j] != T[j]:
count += 1
ans = min(ans, count)
print(ans)
| 12 | 12 | 212 | 220 | S = eval(input())
T = eval(input())
Ls = len(S)
Lt = len(T)
ans = 0
for i in range(Ls - Lt + 1):
count = 0
for j in range(Lt):
count += S[i + j] == T[j]
ans = max(ans, count)
ans = Lt - ans
print(ans)
| S = eval(input())
T = eval(input())
Ls = len(S)
Lt = len(T)
ans = 1000
for i in range(Ls - Lt + 1):
count = 0
for j in range(Lt):
if S[i + j] != T[j]:
count += 1
ans = min(ans, count)
print(ans)
| false | 0 | [
"-ans = 0",
"+ans = 1000",
"- count += S[i + j] == T[j]",
"- ans = max(ans, count)",
"-ans = Lt - ans",
"+ if S[i + j] != T[j]:",
"+ count += 1",
"+ ans = min(ans, count)"
] | false | 0.045305 | 0.154002 | 0.294188 | [
"s639608993",
"s962649774"
] |
u905203728 | p03231 | python | s923956332 | s580054325 | 216 | 36 | 28,988 | 5,344 | Accepted | Accepted | 83.33 | from fractions import gcd
def lcm(x,y):
return (x*y)//gcd(x,y)
n,m=list(map(int,input().split()))
s=eval(input())
t=eval(input())
lcm=lcm(n,m)
S=[(i,int(i*(lcm/n)+1)) for i in range(n)]
L=[(i,int(i*(lcm/m)+1)) for i in range(m)]
left,right=0,0
ans=[]
while left!=n and right!=m:
if S[left][1]... | from fractions import gcd
def lcm(x,y):return (x*y)//gcd(x,y)
n,m=list(map(int,input().split()))
s,t=eval(input()),eval(input())
lcm=lcm(n,m)
if s[::int(lcm/m)]!=t[::int(lcm/n)]:print((-1));exit()
print(lcm) | 28 | 7 | 588 | 193 | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
lcm = lcm(n, m)
S = [(i, int(i * (lcm / n) + 1)) for i in range(n)]
L = [(i, int(i * (lcm / m) + 1)) for i in range(m)]
left, right = 0, 0
ans = []
while left != n and ... | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
n, m = list(map(int, input().split()))
s, t = eval(input()), eval(input())
lcm = lcm(n, m)
if s[:: int(lcm / m)] != t[:: int(lcm / n)]:
print((-1))
exit()
print(lcm)
| false | 75 | [
"-s = eval(input())",
"-t = eval(input())",
"+s, t = eval(input()), eval(input())",
"-S = [(i, int(i * (lcm / n) + 1)) for i in range(n)]",
"-L = [(i, int(i * (lcm / m) + 1)) for i in range(m)]",
"-left, right = 0, 0",
"-ans = []",
"-while left != n and right != m:",
"- if S[left][1] == L[right][... | false | 0.110159 | 0.045512 | 2.420443 | [
"s923956332",
"s580054325"
] |
u811733736 | p00120 | python | s221079672 | s006459882 | 50 | 30 | 7,904 | 7,944 | Accepted | Accepted | 40 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0120
"""
import sys
from sys import stdin
input = stdin.readline
def calc_width(cakes):
# ??±????????????????????????(?????????)????????????????????????????????????????¨??????????
if len(cakes) == 1:
ret... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0120
"""
import sys
from sys import stdin
input = stdin.readline
def calc_width(cakes):
# ??±????????????????????????(?????????)????????????????????????????????????????¨??????????
if len(cakes) == 1:
ret... | 138 | 75 | 3,761 | 1,981 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0120
"""
import sys
from sys import stdin
input = stdin.readline
def calc_width(cakes):
# ??±????????????????????????(?????????)????????????????????????????????????????¨??????????
if len(cakes) == 1:
return cakes[0] ... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0120
"""
import sys
from sys import stdin
input = stdin.readline
def calc_width(cakes):
# ??±????????????????????????(?????????)????????????????????????????????????????¨??????????
if len(cakes) == 1:
return cakes[0] ... | false | 45.652174 | [
"- if h_diff == 0:",
"- width += prev_r",
"- width += r",
"- else:",
"- w = ((prev_r + r) ** 2 - h_diff**2) ** 0.5",
"- width += w",
"+ w = ((prev_r + r) ** 2 - h_diff**2) ** 0.5",
"+ width += w",
"+ # ??±????????????????... | false | 0.080035 | 0.070474 | 1.135665 | [
"s221079672",
"s006459882"
] |
u426534722 | p02235 | python | s996662536 | s464236636 | 2,870 | 2,400 | 6,024 | 5,616 | Accepted | Accepted | 16.38 | import sys
readline = sys.stdin.readline
from collections import defaultdict
from bisect import bisect_left, bisect, insort_left, insort
INF = 10000
def lcs(s1, s2):
c = defaultdict(list)
for i, s in enumerate(s1):
c[s].append(i)
for s in set(s2):
c[s].append(INF)
dp = []
... | for _ in range(int(eval(input()))):
a = eval(input())
b = eval(input())
if len(a) < len(b):
a, b = b, a
indices = []
for cb in b:
bgn_idx = 0
for i, cur_idx in enumerate(indices):
chr_idx = a.find(cb, bgn_idx) + 1
if not chr_idx:
... | 33 | 20 | 959 | 570 | import sys
readline = sys.stdin.readline
from collections import defaultdict
from bisect import bisect_left, bisect, insort_left, insort
INF = 10000
def lcs(s1, s2):
c = defaultdict(list)
for i, s in enumerate(s1):
c[s].append(i)
for s in set(s2):
c[s].append(INF)
dp = []
for s2_... | for _ in range(int(eval(input()))):
a = eval(input())
b = eval(input())
if len(a) < len(b):
a, b = b, a
indices = []
for cb in b:
bgn_idx = 0
for i, cur_idx in enumerate(indices):
chr_idx = a.find(cb, bgn_idx) + 1
if not chr_idx:
break
... | false | 39.393939 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-from collections import defaultdict",
"-from bisect import bisect_left, bisect, insort_left, insort",
"-",
"-INF = 10000",
"-",
"-",
"-def lcs(s1, s2):",
"- c = defaultdict(list)",
"- for i, s in enumerate(s1):",
"- c[s].ap... | false | 0.042182 | 0.036199 | 1.165271 | [
"s996662536",
"s464236636"
] |
u143509139 | p03157 | python | s624305769 | s322271471 | 605 | 288 | 35,532 | 55,636 | Accepted | Accepted | 52.4 | H, W = list(map(int, input().split()))
s = [eval(input()) for _ in range(H)]
def dfs(startx: int, starty: int) -> set:
dxdy = [[1, 0], [-1, 0], [0, 1], [0, -1]]
stack = [(startx, starty, s[starty][startx] == '#')]
reached = set()
reached.add((startx, starty))
b, w = 0, 0
while stack:... | dxdy = [(0, 1), (0, -1), (1, 0), (-1, 0)]
h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
for i in range(h):
for j in range(w):
if (i + j) % 2:
if s[i][j] == '.':
s[i][j] = '#'
else:
s[i][j] = '.'
d = [[True... | 34 | 31 | 916 | 924 | H, W = list(map(int, input().split()))
s = [eval(input()) for _ in range(H)]
def dfs(startx: int, starty: int) -> set:
dxdy = [[1, 0], [-1, 0], [0, 1], [0, -1]]
stack = [(startx, starty, s[starty][startx] == "#")]
reached = set()
reached.add((startx, starty))
b, w = 0, 0
while stack:
d... | dxdy = [(0, 1), (0, -1), (1, 0), (-1, 0)]
h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
for i in range(h):
for j in range(w):
if (i + j) % 2:
if s[i][j] == ".":
s[i][j] = "#"
else:
s[i][j] = "."
d = [[True] * w for ... | false | 8.823529 | [
"-H, W = list(map(int, input().split()))",
"-s = [eval(input()) for _ in range(H)]",
"-",
"-",
"-def dfs(startx: int, starty: int) -> set:",
"- dxdy = [[1, 0], [-1, 0], [0, 1], [0, -1]]",
"- stack = [(startx, starty, s[starty][startx] == \"#\")]",
"- reached = set()",
"- reached.add((sta... | false | 0.03945 | 0.080932 | 0.487449 | [
"s624305769",
"s322271471"
] |
u153428169 | p02897 | python | s208762598 | s459537065 | 11 | 10 | 2,568 | 2,568 | Accepted | Accepted | 9.09 | n = eval(input())
print((n/2+n%2)/float(n)) | # coding:utf-8
n = eval(input()) # 获取输入数字N
# 根据获取的数据n,进行后续代码的补充
if n % 2 == 0:
print(0.5)
else:
print((n+1)*1.0/2/n)
| 2 | 9 | 37 | 128 | n = eval(input())
print((n / 2 + n % 2) / float(n))
| # coding:utf-8
n = eval(input()) # 获取输入数字N
# 根据获取的数据n,进行后续代码的补充
if n % 2 == 0:
print(0.5)
else:
print((n + 1) * 1.0 / 2 / n)
| false | 77.777778 | [
"-n = eval(input())",
"-print((n / 2 + n % 2) / float(n))",
"+# coding:utf-8",
"+n = eval(input()) # 获取输入数字N",
"+# 根据获取的数据n,进行后续代码的补充",
"+if n % 2 == 0:",
"+ print(0.5)",
"+else:",
"+ print((n + 1) * 1.0 / 2 / n)"
] | false | 0.034531 | 0.03529 | 0.978488 | [
"s208762598",
"s459537065"
] |
u133936772 | p02899 | python | s832637379 | s024741734 | 265 | 95 | 24,916 | 19,972 | Accepted | Accepted | 64.15 | f=input;f();print((*list(zip(*sorted((int(i),e+1) for e,i in enumerate(f().split()))))[1])) | n,*l=list(map(int,open(0).read().split()))
a=[0]*n
for i in range(n): a[l[i]-1]=i+1
print((*a)) | 1 | 4 | 89 | 90 | f = input
f()
print((*list(zip(*sorted((int(i), e + 1) for e, i in enumerate(f().split()))))[1]))
| n, *l = list(map(int, open(0).read().split()))
a = [0] * n
for i in range(n):
a[l[i] - 1] = i + 1
print((*a))
| false | 75 | [
"-f = input",
"-f()",
"-print((*list(zip(*sorted((int(i), e + 1) for e, i in enumerate(f().split()))))[1]))",
"+n, *l = list(map(int, open(0).read().split()))",
"+a = [0] * n",
"+for i in range(n):",
"+ a[l[i] - 1] = i + 1",
"+print((*a))"
] | false | 0.037712 | 0.037175 | 1.014445 | [
"s832637379",
"s024741734"
] |
u451017206 | p02861 | python | s258841879 | s374752785 | 408 | 349 | 3,064 | 3,064 | Accepted | Accepted | 14.46 | N = int(eval(input()))
L=[[int(j) for j in input().split()] for i in range(N)]
from math import factorial, sqrt
S = 0
def solve(L, r):
global S
if len(L) == 0:
for i in range(N-1):
x, y = r[i]
x2, y2 = r[i+1]
S += sqrt((x - x2)**2 + (y - y2)**2)
for i... | N = int(eval(input()))
L=[[int(j) for j in input().split()] for i in range(N)]
from math import factorial, sqrt
from itertools import permutations
S = 0
def k(a, b):
return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)
for l in permutations(L):
S += sum([k(l[i], l[i+1]) for i in range(N-1)])
print((S/fac... | 20 | 11 | 499 | 323 | N = int(eval(input()))
L = [[int(j) for j in input().split()] for i in range(N)]
from math import factorial, sqrt
S = 0
def solve(L, r):
global S
if len(L) == 0:
for i in range(N - 1):
x, y = r[i]
x2, y2 = r[i + 1]
S += sqrt((x - x2) ** 2 + (y - y2) ** 2)
for i... | N = int(eval(input()))
L = [[int(j) for j in input().split()] for i in range(N)]
from math import factorial, sqrt
from itertools import permutations
S = 0
def k(a, b):
return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
for l in permutations(L):
S += sum([k(l[i], l[i + 1]) for i in range(N - 1)])
print((S... | false | 45 | [
"+from itertools import permutations",
"-def solve(L, r):",
"- global S",
"- if len(L) == 0:",
"- for i in range(N - 1):",
"- x, y = r[i]",
"- x2, y2 = r[i + 1]",
"- S += sqrt((x - x2) ** 2 + (y - y2) ** 2)",
"- for i, v in enumerate(L):",
"- ... | false | 0.039614 | 0.039846 | 0.994185 | [
"s258841879",
"s374752785"
] |
u852690916 | p03464 | python | s510325810 | s962443379 | 118 | 87 | 14,224 | 83,680 | Accepted | Accepted | 26.27 | K=int(eval(input()))
A=list(map(int, input().split()))
mx=2
mn=2
for i in range(K-1,-1,-1):
a = A[i]
a_mn = ((mn+a-1)//a)*a
a_mx = mx - mx%a
if a_mn > a_mx:
print((-1))
exit()
mn=a_mn
mx=a_mx+a-1
print(("{} {}".format(mn,mx))) | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
mx = 2
mn = 2
for a in reversed(A):
mx = (mx // a + 1) * a - 1
mn = (mn + a - 1) // a * a
if mn > mx:
print((-1))
return
print((mn, mx))
if __name__ == '__main__':
... | 15 | 18 | 271 | 419 | K = int(eval(input()))
A = list(map(int, input().split()))
mx = 2
mn = 2
for i in range(K - 1, -1, -1):
a = A[i]
a_mn = ((mn + a - 1) // a) * a
a_mx = mx - mx % a
if a_mn > a_mx:
print((-1))
exit()
mn = a_mn
mx = a_mx + a - 1
print(("{} {}".format(mn, mx)))
| # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
mx = 2
mn = 2
for a in reversed(A):
mx = (mx // a + 1) * a - 1
mn = (mn + a - 1) // a * a
if mn > mx:
print((-1))
return
print((mn, mx))
if __name__ == "__main__":
input = sy... | false | 16.666667 | [
"-K = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-mx = 2",
"-mn = 2",
"-for i in range(K - 1, -1, -1):",
"- a = A[i]",
"- a_mn = ((mn + a - 1) // a) * a",
"- a_mx = mx - mx % a",
"- if a_mn > a_mx:",
"- print((-1))",
"- exit()",
"- mn = a_mn",
... | false | 0.034781 | 0.044053 | 0.789532 | [
"s510325810",
"s962443379"
] |
u285891772 | p03241 | python | s518050004 | s047968467 | 47 | 41 | 10,820 | 10,828 | Accepted | Accepted | 12.77 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 35 | 38 | 1,145 | 1,290 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 7.894737 | [
"-m = [] # Mの約数を格納",
"-for i in range(1, int(M**0.5) + 1):",
"- if M % i == 0:",
"- m.append(i)",
"- if i != M // i:",
"- m.append(M // i)",
"-m.sort()",
"-n = m[bisect_left(m, N)]",
"+",
"+",
"+def make_divisors(n): # 約数列挙",
"+ divisors = []",
"+ for i in... | false | 0.080344 | 0.074924 | 1.072338 | [
"s518050004",
"s047968467"
] |
u754046530 | p02682 | python | s124833640 | s463484779 | 25 | 21 | 9,200 | 9,192 | Accepted | Accepted | 16 | a = input().rstrip().split(' ')
A,B,C,K = int(a[0]),int(a[1]),int(a[2]),int(a[3])
s = 0
if K - A <= 0:
print(K)
else:
K -= A
if K - B <= 0:
print(A)
else:
K -= B
print((A-K)) | A,B,C,K = list(map(int,input().split()))
xa = min(K,A)
K -= xa
xb = min(K,B)
K -= xb
ans = xa - K
print(ans) | 13 | 10 | 225 | 114 | a = input().rstrip().split(" ")
A, B, C, K = int(a[0]), int(a[1]), int(a[2]), int(a[3])
s = 0
if K - A <= 0:
print(K)
else:
K -= A
if K - B <= 0:
print(A)
else:
K -= B
print((A - K))
| A, B, C, K = list(map(int, input().split()))
xa = min(K, A)
K -= xa
xb = min(K, B)
K -= xb
ans = xa - K
print(ans)
| false | 23.076923 | [
"-a = input().rstrip().split(\" \")",
"-A, B, C, K = int(a[0]), int(a[1]), int(a[2]), int(a[3])",
"-s = 0",
"-if K - A <= 0:",
"- print(K)",
"-else:",
"- K -= A",
"- if K - B <= 0:",
"- print(A)",
"- else:",
"- K -= B",
"- print((A - K))",
"+A, B, C, K = list... | false | 0.102473 | 0.048049 | 2.132673 | [
"s124833640",
"s463484779"
] |
u779805689 | p02954 | python | s679290018 | s866195286 | 1,467 | 124 | 345,740 | 98,976 | Accepted | Accepted | 91.55 | def f(S):
if S=="R":
return 1
else:
return -1
S=eval(input())
N=len(S)
K=334
L=list(map(f,S))
A=[[0]*N for _ in range(K)]
for i in range(N):
A[0][i]=i+L[i]
for k in range(1,K):
for x in range(N):
A[k][x]=A[k-1][A[k-1][x]]
Z=[0]*(N)
for k in range(N):
... | def f(S):
if S=="R":
return 1
else:
return -1
S=eval(input())
N=len(S)
K=20
L=list(map(f,S))
A=[[0]*N for _ in range(K)]
for i in range(N):
A[0][i]=i+L[i]
for k in range(1,K):
for x in range(N):
A[k][x]=A[k-1][A[k-1][x]]
Z=[0]*(N)
for k in range(N):
... | 33 | 33 | 473 | 470 | def f(S):
if S == "R":
return 1
else:
return -1
S = eval(input())
N = len(S)
K = 334
L = list(map(f, S))
A = [[0] * N for _ in range(K)]
for i in range(N):
A[0][i] = i + L[i]
for k in range(1, K):
for x in range(N):
A[k][x] = A[k - 1][A[k - 1][x]]
Z = [0] * (N)
for k in range(N... | def f(S):
if S == "R":
return 1
else:
return -1
S = eval(input())
N = len(S)
K = 20
L = list(map(f, S))
A = [[0] * N for _ in range(K)]
for i in range(N):
A[0][i] = i + L[i]
for k in range(1, K):
for x in range(N):
A[k][x] = A[k - 1][A[k - 1][x]]
Z = [0] * (N)
for k in range(N)... | false | 0 | [
"-K = 334",
"+K = 20",
"- P = 10**100",
"+ P = 10**6"
] | false | 0.077087 | 0.037574 | 2.051601 | [
"s679290018",
"s866195286"
] |
u799164835 | p02596 | python | s252156712 | s330739705 | 332 | 225 | 16,696 | 9,164 | Accepted | Accepted | 32.23 | k = int(eval(input()))
checked = [False] * k
surplus = 0
ans = 1
while 1:
surplus = ((surplus * 10) + 7) % k
if checked[surplus]:
print((-1))
exit()
if surplus == 0:
break
checked[surplus] = True
ans += 1
print(ans)
|
k = int(eval(input()))
surplus = 0
ans = 1
while 1:
if ans > k:
print((-1))
exit()
surplus = ((surplus * 10) + 7) % k
if surplus == 0:
break
ans += 1
print(ans)
| 16 | 15 | 269 | 210 | k = int(eval(input()))
checked = [False] * k
surplus = 0
ans = 1
while 1:
surplus = ((surplus * 10) + 7) % k
if checked[surplus]:
print((-1))
exit()
if surplus == 0:
break
checked[surplus] = True
ans += 1
print(ans)
| k = int(eval(input()))
surplus = 0
ans = 1
while 1:
if ans > k:
print((-1))
exit()
surplus = ((surplus * 10) + 7) % k
if surplus == 0:
break
ans += 1
print(ans)
| false | 6.25 | [
"-checked = [False] * k",
"- surplus = ((surplus * 10) + 7) % k",
"- if checked[surplus]:",
"+ if ans > k:",
"+ surplus = ((surplus * 10) + 7) % k",
"- checked[surplus] = True"
] | false | 0.101968 | 0.083429 | 1.222218 | [
"s252156712",
"s330739705"
] |
u282228874 | p03112 | python | s026039138 | s235831278 | 1,995 | 1,096 | 12,800 | 12,804 | Accepted | Accepted | 45.06 | from bisect import bisect_left
a,b,q = list(map(int,input().split()))
inf = float('inf')
S = [-inf]+[int(eval(input())) for i in range(a)]+[inf]
T = [-inf]+[int(eval(input())) for i in range(b)]+[inf]
def f(S,T):
res = 10**30
s = bisect_left(S,x)
ans = 0
t = bisect_left(T,S[s-1])
ans ... | from bisect import bisect_left
import sys
input = sys.stdin.readline
a,b,q = list(map(int,input().split()))
inf = float('inf')
S = [-inf]+[int(eval(input())) for i in range(a)]+[inf]
T = [-inf]+[int(eval(input())) for i in range(b)]+[inf]
def f(S,T):
res = 10**30
s = bisect_left(S,x)
ans = 0
... | 28 | 30 | 642 | 681 | from bisect import bisect_left
a, b, q = list(map(int, input().split()))
inf = float("inf")
S = [-inf] + [int(eval(input())) for i in range(a)] + [inf]
T = [-inf] + [int(eval(input())) for i in range(b)] + [inf]
def f(S, T):
res = 10**30
s = bisect_left(S, x)
ans = 0
t = bisect_left(T, S[s - 1])
... | from bisect import bisect_left
import sys
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
inf = float("inf")
S = [-inf] + [int(eval(input())) for i in range(a)] + [inf]
T = [-inf] + [int(eval(input())) for i in range(b)] + [inf]
def f(S, T):
res = 10**30
s = bisect_left(S, x)
ans = 0... | false | 6.666667 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.035856 | 0.042504 | 0.843597 | [
"s026039138",
"s235831278"
] |
u360116509 | p03475 | python | s279762624 | s008879002 | 74 | 68 | 3,188 | 3,188 | Accepted | Accepted | 8.11 | def main():
N = int(eval(input()))
csf = []
for _ in range(N - 1):
C, S, F = list(map(int, input().split()))
csf.append((C, S, F))
ans = []
for i in range(N - 1):
c, s, _ = csf[i]
t = c + s
for ii in range(i + 1, N - 1):
nc, ns, n... | def main():
N = int(eval(input()))
csf = []
for _ in range(N - 1):
C, S, F = list(map(int, input().split()))
csf.append((C, S, F))
ans = []
for i in range(N - 1):
c, s, _ = csf[i]
t = c + s
for ii in range(i + 1, N - 1):
nc, ns, n... | 27 | 26 | 640 | 590 | def main():
N = int(eval(input()))
csf = []
for _ in range(N - 1):
C, S, F = list(map(int, input().split()))
csf.append((C, S, F))
ans = []
for i in range(N - 1):
c, s, _ = csf[i]
t = c + s
for ii in range(i + 1, N - 1):
nc, ns, nf = csf[ii]
... | def main():
N = int(eval(input()))
csf = []
for _ in range(N - 1):
C, S, F = list(map(int, input().split()))
csf.append((C, S, F))
ans = []
for i in range(N - 1):
c, s, _ = csf[i]
t = c + s
for ii in range(i + 1, N - 1):
nc, ns, nf = csf[ii]
... | false | 3.703704 | [
"- if (t - ns) % nf == 0:",
"- ns += ((t - ns) // nf) * nf",
"- else:",
"- ns += ((t - ns) // nf + 1) * nf",
"+ ns += ((t - ns) // nf) * nf",
"+ if (t - ns) % nf != 0:",
"+ ns += nf"
] | false | 0.123506 | 0.093598 | 1.319526 | [
"s279762624",
"s008879002"
] |
u714378447 | p03111 | python | s155892132 | s371280142 | 437 | 330 | 3,064 | 3,064 | Accepted | Accepted | 24.49 | N,*T = list(map(int,input().split()))
L = [int(eval(input())) for i in range(N)]
ans = 3000
for x in range(4**N):
l = [0]*4
t = [0]*4
n = 4
i = 0
for i in range(N):
l[x%n] += L[i]
t[x%n] += 1
x//=n
if 0 in l[:3]:
continue
cost = 0
for ... | from itertools import product
N,*T = list(map(int,input().split()))
L = [int(eval(input())) for i in range(N)]
ans = 3000
for x in product([0,1,2,3], repeat=N):
cost = 0
l = [0]*4
for i,v in enumerate(x):
l[v] += L[i]
if v<3:
cost += 10
if 0 in l[:3]:
... | 24 | 22 | 424 | 431 | N, *T = list(map(int, input().split()))
L = [int(eval(input())) for i in range(N)]
ans = 3000
for x in range(4**N):
l = [0] * 4
t = [0] * 4
n = 4
i = 0
for i in range(N):
l[x % n] += L[i]
t[x % n] += 1
x //= n
if 0 in l[:3]:
continue
cost = 0
for i in rang... | from itertools import product
N, *T = list(map(int, input().split()))
L = [int(eval(input())) for i in range(N)]
ans = 3000
for x in product([0, 1, 2, 3], repeat=N):
cost = 0
l = [0] * 4
for i, v in enumerate(x):
l[v] += L[i]
if v < 3:
cost += 10
if 0 in l[:3]:
conti... | false | 8.333333 | [
"+from itertools import product",
"+",
"-for x in range(4**N):",
"+for x in product([0, 1, 2, 3], repeat=N):",
"+ cost = 0",
"- t = [0] * 4",
"- n = 4",
"- i = 0",
"- for i in range(N):",
"- l[x % n] += L[i]",
"- t[x % n] += 1",
"- x //= n",
"+ for i, v... | false | 0.414632 | 0.294135 | 1.409669 | [
"s155892132",
"s371280142"
] |
u160414758 | p03565 | python | s938571577 | s618694609 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())
Sp = S()
T = S()
S = ""
flag = True
for i in range(len(Sp)-len(T),-1,-1):
... | Sp = eval(input())
T = eval(input())
S = ""
flag = True
for i in range(len(Sp)-len(T),-1,-1):
if flag:
for j in range(len(T)):
if Sp[i+j] != "?" and T[j] != Sp[i+j]:
break
elif j == len(T)-1:
S = Sp[:i] + T + Sp[i+j+1:]
flag ... | 23 | 16 | 631 | 395 | import sys, collections
sys.setrecursionlimit(10**7)
def Is():
return [int(x) for x in sys.stdin.readline().split()]
def Ss():
return sys.stdin.readline().split()
def I():
return int(sys.stdin.readline())
def S():
return eval(input())
Sp = S()
T = S()
S = ""
flag = True
for i in range(len(Sp)... | Sp = eval(input())
T = eval(input())
S = ""
flag = True
for i in range(len(Sp) - len(T), -1, -1):
if flag:
for j in range(len(T)):
if Sp[i + j] != "?" and T[j] != Sp[i + j]:
break
elif j == len(T) - 1:
S = Sp[:i] + T + Sp[i + j + 1 :]
f... | false | 30.434783 | [
"-import sys, collections",
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def Is():",
"- return [int(x) for x in sys.stdin.readline().split()]",
"-",
"-",
"-def Ss():",
"- return sys.stdin.readline().split()",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline())",
"-... | false | 0.047817 | 0.048211 | 0.991822 | [
"s938571577",
"s618694609"
] |
u038021590 | p03361 | python | s489357661 | s342530245 | 182 | 72 | 40,048 | 67,688 | Accepted | Accepted | 60.44 | H, W = list(map(int, input().split()))
M = [[] for _ in range(H)]
for _ in range(H):
S = eval(input())
for __ in range(W):
M[_].append(S[__])
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
for i in range(H):
for j in range(W):
if M[i][j] == '#':
flag = False
... | H, W = list(map(int, input().split()))
Map = [[s for s in eval(input())] for _ in range(H)]
for i in range(H):
for j in range(W):
if Map[i][j] == '#':
for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
ny = i + dy
nx = j + dx
if ny < 0 or ... | 27 | 17 | 681 | 520 | H, W = list(map(int, input().split()))
M = [[] for _ in range(H)]
for _ in range(H):
S = eval(input())
for __ in range(W):
M[_].append(S[__])
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
for i in range(H):
for j in range(W):
if M[i][j] == "#":
flag = False
for k in range(4):... | H, W = list(map(int, input().split()))
Map = [[s for s in eval(input())] for _ in range(H)]
for i in range(H):
for j in range(W):
if Map[i][j] == "#":
for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
ny = i + dy
nx = j + dx
if ny < 0 or ny >= H or... | false | 37.037037 | [
"-M = [[] for _ in range(H)]",
"-for _ in range(H):",
"- S = eval(input())",
"- for __ in range(W):",
"- M[_].append(S[__])",
"-dx = [-1, 0, 1, 0]",
"-dy = [0, 1, 0, -1]",
"+Map = [[s for s in eval(input())] for _ in range(H)]",
"- if M[i][j] == \"#\":",
"- flag = Fa... | false | 0.049794 | 0.080477 | 0.618742 | [
"s489357661",
"s342530245"
] |
u254871849 | p03486 | python | s872980554 | s061413785 | 25 | 18 | 3,768 | 3,064 | Accepted | Accepted | 28 | import sys
# import collections
# import math
import string
# import bisect
# import re
# import itertools
# import statistics
def main():
s, t = sys.stdin.read().split()
n, m = len(s), len(t)
s = sorted(s)
t = list(reversed(sorted(t)))
if n < m:
for i in range(n):
... | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
s, t = sys.stdin.read().split()
n, m = len(s), len(t)
s = sorted(s)
t = list(reversed(sorted(t)))
if n < m:
for i in range(n):
... | 45 | 33 | 1,253 | 737 | import sys
# import collections
# import math
import string
# import bisect
# import re
# import itertools
# import statistics
def main():
s, t = sys.stdin.read().split()
n, m = len(s), len(t)
s = sorted(s)
t = list(reversed(sorted(t)))
if n < m:
for i in range(n):
f_s, f_t = F... | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
s, t = sys.stdin.read().split()
n, m = len(s), len(t)
s = sorted(s)
t = list(reversed(sorted(t)))
if n < m:
for i in range(n):
if s[i] < t... | false | 26.666667 | [
"-import string",
"-",
"+# import string",
"- f_s, f_t = False, False",
"- for c in string.ascii_lowercase:",
"- if s[i] == c:",
"- f_s = True",
"- if t[i] == c:",
"- f_t = True",
"- if f_s and... | false | 0.050356 | 0.047896 | 1.051367 | [
"s872980554",
"s061413785"
] |
u936985471 | p03634 | python | s181519276 | s498379811 | 1,532 | 689 | 55,108 | 50,348 | Accepted | Accepted | 55.03 | n=int(eval(input()))
dist=[[] for i in range(n)]
for i in range(n-1):
a,b,c=list(map(int,input().split()))
dist[a-1].append([b-1,c])
dist[b-1].append([a-1,c])
Q,K=list(map(int,input().split()))
INF=10**9+1
distFromK=[-1 for i in range(n)]
# start from K
stack=[]
stack.append([K-1,0,-1])
while ... | # Kから各頂点への距離をメモする
# xからKの距離とyからKの距離を足したものが答え
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a,b,c = list(map(int,readline().split()))
G[a-1].append((b-1,c))
G[b-1].append((a-1,c))
dist = [-1 for i in range(N)] # Kからの距離
Q,K = list(map... | 33 | 32 | 702 | 690 | n = int(eval(input()))
dist = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
dist[a - 1].append([b - 1, c])
dist[b - 1].append([a - 1, c])
Q, K = list(map(int, input().split()))
INF = 10**9 + 1
distFromK = [-1 for i in range(n)]
# start from K
stack = []
stack.append... | # Kから各頂点への距離をメモする
# xからKの距離とyからKの距離を足したものが答え
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, readline().split()))
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
dist = [-1 for i in range(N)] # Kからの距離
Q, K = lis... | false | 3.030303 | [
"-n = int(eval(input()))",
"-dist = [[] for i in range(n)]",
"-for i in range(n - 1):",
"- a, b, c = list(map(int, input().split()))",
"- dist[a - 1].append([b - 1, c])",
"- dist[b - 1].append([a - 1, c])",
"-Q, K = list(map(int, input().split()))",
"-INF = 10**9 + 1",
"-distFromK = [-1 for... | false | 0.144951 | 0.073023 | 1.985008 | [
"s181519276",
"s498379811"
] |
u465699806 | p03665 | python | s519591556 | s489752601 | 282 | 227 | 81,520 | 76,724 | Accepted | Accepted | 19.5 | import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def dump_impl(*objects):
print(*objects, file=sys.stderr)
def dump_dummy(*objects):
pass
dump = dump_impl if "DEBU... | import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def dump_impl(*objects):
print(*objects, file=sys.stderr)
def dump_dummy(*objects):
pass
dump = dump_impl if "DEBU... | 58 | 54 | 1,108 | 1,079 | import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def dump_impl(*objects):
print(*objects, file=sys.stderr)
def dump_dummy(*objects):
pass
dump = dump_impl if "DEBUG" in sys.argv el... | import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def dump_impl(*objects):
print(*objects, file=sys.stderr)
def dump_dummy(*objects):
pass
dump = dump_impl if "DEBUG" in sys.argv el... | false | 6.896552 | [
"-def main():",
"+if __name__ == \"__main__\":",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()"
] | false | 0.037057 | 0.047363 | 0.782415 | [
"s519591556",
"s489752601"
] |
u413165887 | p02901 | python | s479064260 | s938791769 | 960 | 547 | 3,188 | 3,188 | Accepted | Accepted | 43.02 | n, m = list(map(int, input().split(' ')))
dp = [10**9 for _ in range(2**n)]
dp[0] = 0
for i in range(m):
a, b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
num = 0
for j in range(b):
num += 1 << (c[j]-1)
for s in range(2**n):
if dp[s|num] >= dp... | def main():
n, m = list(map(int, input().split(' ')))
dp = [10**9 for _ in range(2**n)]
dp[0] = 0
for i in range(m):
a, b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
num = 0
for j in range(b):
num += 1 << (c[j]-1)
... | 16 | 19 | 413 | 530 | n, m = list(map(int, input().split(" ")))
dp = [10**9 for _ in range(2**n)]
dp[0] = 0
for i in range(m):
a, b = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))
num = 0
for j in range(b):
num += 1 << (c[j] - 1)
for s in range(2**n):
if dp[s | num] >= dp[s] + ... | def main():
n, m = list(map(int, input().split(" ")))
dp = [10**9 for _ in range(2**n)]
dp[0] = 0
for i in range(m):
a, b = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))
num = 0
for j in range(b):
num += 1 << (c[j] - 1)
for ... | false | 15.789474 | [
"-n, m = list(map(int, input().split(\" \")))",
"-dp = [10**9 for _ in range(2**n)]",
"-dp[0] = 0",
"-for i in range(m):",
"- a, b = list(map(int, input().split(\" \")))",
"- c = list(map(int, input().split(\" \")))",
"- num = 0",
"- for j in range(b):",
"- num += 1 << (c[j] - 1)"... | false | 0.086631 | 0.135089 | 0.641287 | [
"s479064260",
"s938791769"
] |
u970449052 | p02812 | python | s686972706 | s050421630 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | n=int(eval(input()))
s=eval(input())
print((s.count('ABC'))) | eval(input());print((input().count('ABC'))) | 3 | 1 | 48 | 35 | n = int(eval(input()))
s = eval(input())
print((s.count("ABC")))
| eval(input())
print((input().count("ABC")))
| false | 66.666667 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-print((s.count(\"ABC\")))",
"+eval(input())",
"+print((input().count(\"ABC\")))"
] | false | 0.037594 | 0.085098 | 0.441774 | [
"s686972706",
"s050421630"
] |
u382114513 | p02725 | python | s669597674 | s085639278 | 326 | 126 | 26,444 | 26,444 | Accepted | Accepted | 61.35 | from sys import stdin
inp = stdin.readline
n, k = [int(x) for x in inp().strip().split()]
array = [int(x) for x in inp().strip().split()]
distance = [0]*(k * 2)
for i in range(k - 1):
distance[i] = array[i+1] - array[i]
distance[k-1] = n-array[k-1] + array[0]
distance[2*k-1] = n-array[k-1] + a... | from sys import stdin
inp = stdin.readline
n, k = [int(x) for x in inp().strip().split()]
array = [int(x) for x in inp().strip().split()]
distance = [0]*(k * 2)
for i in range(k - 1):
distance[i] = array[i+1] - array[i]
distance[k-1] = n-array[k-1] + array[0]
print((n-max(distance))) | 35 | 17 | 720 | 310 | from sys import stdin
inp = stdin.readline
n, k = [int(x) for x in inp().strip().split()]
array = [int(x) for x in inp().strip().split()]
distance = [0] * (k * 2)
for i in range(k - 1):
distance[i] = array[i + 1] - array[i]
distance[k - 1] = n - array[k - 1] + array[0]
distance[2 * k - 1] = n - array[k - 1] + arra... | from sys import stdin
inp = stdin.readline
n, k = [int(x) for x in inp().strip().split()]
array = [int(x) for x in inp().strip().split()]
distance = [0] * (k * 2)
for i in range(k - 1):
distance[i] = array[i + 1] - array[i]
distance[k - 1] = n - array[k - 1] + array[0]
print((n - max(distance)))
| false | 51.428571 | [
"-distance[2 * k - 1] = n - array[k - 1] + array[0]",
"-for i in range(k - 1):",
"- distance[k + i] = array[i + 1] - array[i]",
"-minimum = 999999999",
"-count = 0",
"-total = 0",
"-countLimit = k - 1",
"-for i in range(k * 2):",
"- if count < countLimit:",
"- total += distance[i]",
... | false | 0.061337 | 0.03699 | 1.658198 | [
"s669597674",
"s085639278"
] |
u841621946 | p02844 | python | s581071529 | s365590734 | 36 | 28 | 4,456 | 3,064 | Accepted | Accepted | 22.22 | import bisect
N = int(eval(input()))
S = eval(input())
X = [[] for i in range(10)]
for i in range(len(S)):
S_tmp = int(S[i])
X[S_tmp].append(i)
ans = 0
for i in range(1000):
i_tmp = i+1000
p = [0]*3
for j in range(3):
p[j] = int(str(i_tmp)[j+1])
if len(X[p[0]]) != 0:
... | N = int(eval(input()))
S = eval(input())
re = 0
for i in range(1000):
ans = [0]*3
for j in range(3):
ans[j] = str(i % 10)
i = i // 10
ans.reverse()
flag = False
idx_left = S.find(ans[0])
idx_right = S.rfind(ans[2])
if idx_left != -1 and idx_right != -1 and idx_lef... | 24 | 18 | 645 | 436 | import bisect
N = int(eval(input()))
S = eval(input())
X = [[] for i in range(10)]
for i in range(len(S)):
S_tmp = int(S[i])
X[S_tmp].append(i)
ans = 0
for i in range(1000):
i_tmp = i + 1000
p = [0] * 3
for j in range(3):
p[j] = int(str(i_tmp)[j + 1])
if len(X[p[0]]) != 0:
x1 = ... | N = int(eval(input()))
S = eval(input())
re = 0
for i in range(1000):
ans = [0] * 3
for j in range(3):
ans[j] = str(i % 10)
i = i // 10
ans.reverse()
flag = False
idx_left = S.find(ans[0])
idx_right = S.rfind(ans[2])
if idx_left != -1 and idx_right != -1 and idx_left < idx_ri... | false | 25 | [
"-import bisect",
"-",
"-X = [[] for i in range(10)]",
"-for i in range(len(S)):",
"- S_tmp = int(S[i])",
"- X[S_tmp].append(i)",
"-ans = 0",
"+re = 0",
"- i_tmp = i + 1000",
"- p = [0] * 3",
"+ ans = [0] * 3",
"- p[j] = int(str(i_tmp)[j + 1])",
"- if len(X[p[0]]) !=... | false | 0.081527 | 0.073468 | 1.109689 | [
"s581071529",
"s365590734"
] |
u644972721 | p02540 | python | s274550944 | s333695746 | 1,554 | 1,077 | 140,176 | 132,200 | Accepted | Accepted | 30.69 | import heapq
from collections import deque
def bfs(i, c):
color[i] = c
cnt[c] += 1
q = deque()
q.append(i)
while q:
j = q.popleft()
for k in G[j]:
if color[k] == -1:
color[k] = c
cnt[c] += 1
q.append(k)
r... | import heapq
from collections import deque
def bfs(i, c):
color[i] = c
cnt[c] += 1
q = deque()
q.append(i)
while q:
j = q.popleft()
for k in G[j]:
if color[k] == -1:
color[k] = c
cnt[c] += 1
q.append(k)
r... | 51 | 50 | 1,064 | 1,059 | import heapq
from collections import deque
def bfs(i, c):
color[i] = c
cnt[c] += 1
q = deque()
q.append(i)
while q:
j = q.popleft()
for k in G[j]:
if color[k] == -1:
color[k] = c
cnt[c] += 1
q.append(k)
return
n = in... | import heapq
from collections import deque
def bfs(i, c):
color[i] = c
cnt[c] += 1
q = deque()
q.append(i)
while q:
j = q.popleft()
for k in G[j]:
if color[k] == -1:
color[k] = c
cnt[c] += 1
q.append(k)
return
n = in... | false | 1.960784 | [
"-xy = []",
"+xy = [0] * n",
"- xy.append([x, y, i])",
"-xy.sort()",
"+ xy[x - 1] = [x, y, i]"
] | false | 0.044143 | 0.037694 | 1.171112 | [
"s274550944",
"s333695746"
] |
u403301154 | p03033 | python | s000010590 | s931501010 | 1,743 | 1,294 | 61,716 | 61,696 | Accepted | Accepted | 25.76 | from bisect import bisect_left
n, Q = [int(x) for x in input().split()]
stx = [[int(x) for x in input().split()] for i in range(n)]
q = [int(eval(input())) for i in range(Q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(Q)]
skip = [-1 for i in range(Q)]
for (s, t, x) in stx:
begin = bisect_left(q, ... | from bisect import bisect_left
import sys
n, Q = [int(x) for x in sys.stdin.readline().split()]
stx = [[int(x) for x in sys.stdin.readline().split()] for i in range(n)]
q = [int(sys.stdin.readline()) for i in range(Q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(Q)]
skip = [-1 for i in range(Q)]
for... | 20 | 21 | 522 | 573 | from bisect import bisect_left
n, Q = [int(x) for x in input().split()]
stx = [[int(x) for x in input().split()] for i in range(n)]
q = [int(eval(input())) for i in range(Q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(Q)]
skip = [-1 for i in range(Q)]
for (s, t, x) in stx:
begin = bisect_left(q, s - x)
... | from bisect import bisect_left
import sys
n, Q = [int(x) for x in sys.stdin.readline().split()]
stx = [[int(x) for x in sys.stdin.readline().split()] for i in range(n)]
q = [int(sys.stdin.readline()) for i in range(Q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(Q)]
skip = [-1 for i in range(Q)]
for (s, t, x... | false | 4.761905 | [
"+import sys",
"-n, Q = [int(x) for x in input().split()]",
"-stx = [[int(x) for x in input().split()] for i in range(n)]",
"-q = [int(eval(input())) for i in range(Q)]",
"+n, Q = [int(x) for x in sys.stdin.readline().split()]",
"+stx = [[int(x) for x in sys.stdin.readline().split()] for i in range(n)]",
... | false | 0.098935 | 0.080236 | 1.233048 | [
"s000010590",
"s931501010"
] |
u600402037 | p03317 | python | s428696366 | s292519372 | 370 | 41 | 28,020 | 13,880 | Accepted | Accepted | 88.92 | import numpy as np
import statistics
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
print(((N-1+K-2)//(K-1))) | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
A = lr()
answer = -(-(N-1)//(K-1))
print(answer)
| 7 | 11 | 137 | 208 | import numpy as np
import statistics
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
print(((N - 1 + K - 2) // (K - 1)))
| # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
A = lr()
answer = -(-(N - 1) // (K - 1))
print(answer)
| false | 36.363636 | [
"-import numpy as np",
"-import statistics",
"+# coding: utf-8",
"+import sys",
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-print(((N - 1 + K - 2) // (K - 1)))",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir = lambda: int(sr())",
"+lr = lambda: list(m... | false | 0.055223 | 0.036641 | 1.507159 | [
"s428696366",
"s292519372"
] |
u781262926 | p03393 | python | s341702852 | s229710591 | 37 | 28 | 9,868 | 9,140 | Accepted | Accepted | 24.32 | from string import ascii_lowercase as T
S = eval(input())
if len(S) != 26:
A = [0] * 26
offset = ord('a')
for s in S:
A[ord(s)-offset] = 1
print((S + chr(A.index(0)+offset)))
elif S == T[::-1]:
print((-1))
else:
k = 25
while S[k-1] > S[k]:
k -= 1
x = S[k-1]
Y = sorted(S[k-1:])
... | S = eval(input())
if len(S) != 26:
A = [0] * 26
offset = ord('a')
for s in S:
A[ord(s)-offset] = 1
print((S + chr(A.index(0)+offset)))
elif S == 'zyxwvutsrqponmlkjihgfedcba':
print((-1))
else:
k = 25
while S[k-1] > S[k]:
k -= 1
X = sorted(S[k-1:])
print((S[:k-1] + X[X.index(S[k-1... | 17 | 15 | 346 | 317 | from string import ascii_lowercase as T
S = eval(input())
if len(S) != 26:
A = [0] * 26
offset = ord("a")
for s in S:
A[ord(s) - offset] = 1
print((S + chr(A.index(0) + offset)))
elif S == T[::-1]:
print((-1))
else:
k = 25
while S[k - 1] > S[k]:
k -= 1
x = S[k - 1]
Y... | S = eval(input())
if len(S) != 26:
A = [0] * 26
offset = ord("a")
for s in S:
A[ord(s) - offset] = 1
print((S + chr(A.index(0) + offset)))
elif S == "zyxwvutsrqponmlkjihgfedcba":
print((-1))
else:
k = 25
while S[k - 1] > S[k]:
k -= 1
X = sorted(S[k - 1 :])
print((S[: ... | false | 11.764706 | [
"-from string import ascii_lowercase as T",
"-",
"-elif S == T[::-1]:",
"+elif S == \"zyxwvutsrqponmlkjihgfedcba\":",
"- x = S[k - 1]",
"- Y = sorted(S[k - 1 :])",
"- print((S[: k - 1] + Y[Y.index(x) + 1]))",
"+ X = sorted(S[k - 1 :])",
"+ print((S[: k - 1] + X[X.index(S[k - 1]) + 1])... | false | 0.052411 | 0.043954 | 1.192412 | [
"s341702852",
"s229710591"
] |
u191874006 | p02586 | python | s486356006 | s219784559 | 1,005 | 837 | 354,692 | 359,408 | Accepted | Accepted | 16.72 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 36 | 36 | 1,223 | 1,163 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 0 | [
"-maze = [[0] * c for _ in range(r)]",
"+maze = [[0] * (c + 1) for _ in range(r + 1)]",
"- maze[R - 1][C - 1] = V",
"+ maze[R][C] = V",
"- dp1[i - 1][j] + maze[i - 1][j - 1],",
"- maze[i - 1][j - 1],",
"- dp2[i - 1][j] + maze[i - 1][j - 1],",
"- dp3[i ... | false | 0.076986 | 0.038359 | 2.006953 | [
"s486356006",
"s219784559"
] |
u525065967 | p03637 | python | s399629077 | s044799856 | 61 | 51 | 11,100 | 11,096 | Accepted | Accepted | 16.39 | # C - 4-adjacent
n = int(eval(input()))
count2 = count4 = 0
for a in [int(x)%4 for x in input().split()]:
if a==0: count4 += 1
elif a==2: count2 += 1
print(("Yes" if n//2 <= count4 + count2//2 else "No")) | # C - 4-adjacent
# _,a = input(),[int(x)%4 for x in input().split()]
# print("Yes" if a.count(1) + a.count(3) <= a.count(0) + (0 if a.count(2)>0 else 1) else "No")
n,a = int(eval(input())),[int(x)%4 for x in input().split()]
# print("Yes" if n - a.count(2) - a.count(0) <= a.count(0) + (0 if a.count(2)>0 else 1)... | 7 | 10 | 210 | 565 | # C - 4-adjacent
n = int(eval(input()))
count2 = count4 = 0
for a in [int(x) % 4 for x in input().split()]:
if a == 0:
count4 += 1
elif a == 2:
count2 += 1
print(("Yes" if n // 2 <= count4 + count2 // 2 else "No"))
| # C - 4-adjacent
# _,a = input(),[int(x)%4 for x in input().split()]
# print("Yes" if a.count(1) + a.count(3) <= a.count(0) + (0 if a.count(2)>0 else 1) else "No")
n, a = int(eval(input())), [int(x) % 4 for x in input().split()]
# print("Yes" if n - a.count(2) - a.count(0) <= a.count(0) + (0 if a.count(2)>0 else 1) els... | false | 30 | [
"-n = int(eval(input()))",
"-count2 = count4 = 0",
"-for a in [int(x) % 4 for x in input().split()]:",
"- if a == 0:",
"- count4 += 1",
"- elif a == 2:",
"- count2 += 1",
"-print((\"Yes\" if n // 2 <= count4 + count2 // 2 else \"No\"))",
"+# _,a = input(),[int(x)%4 for x in input... | false | 0.047108 | 0.05151 | 0.914531 | [
"s399629077",
"s044799856"
] |
u673361376 | p04043 | python | s619504026 | s117058339 | 165 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.7 | S = eval(input())
print(('YES' if S.count('5') == 2 and S.count('7') == 1 else 'NO')) | print(('YES' if [5, 5, 7] == sorted(list(map(int, input().split()))) else 'NO'))
| 2 | 2 | 78 | 81 | S = eval(input())
print(("YES" if S.count("5") == 2 and S.count("7") == 1 else "NO"))
| print(("YES" if [5, 5, 7] == sorted(list(map(int, input().split()))) else "NO"))
| false | 0 | [
"-S = eval(input())",
"-print((\"YES\" if S.count(\"5\") == 2 and S.count(\"7\") == 1 else \"NO\"))",
"+print((\"YES\" if [5, 5, 7] == sorted(list(map(int, input().split()))) else \"NO\"))"
] | false | 0.042442 | 0.039831 | 1.065557 | [
"s619504026",
"s117058339"
] |
u411203878 | p03611 | python | s034682935 | s552803802 | 216 | 88 | 52,780 | 83,300 | Accepted | Accepted | 59.26 | n=int(eval(input()))
t = list(map(int,input().split()))
memo = [0]*(2+10**5)
for a in t:
memo[a-1] += 1
memo[a] += 1
memo[a+1] += 1
print((max(memo))) | N = int(eval(input()))
a = list(map(int,input().split()))
memo = [0]*(2+10**5)
for i in range(N):
tmp = a[i]
memo[tmp-1] += 1
memo[tmp] += 1
memo[tmp+1] += 1
ans = max(memo)
print(ans) | 11 | 15 | 167 | 213 | n = int(eval(input()))
t = list(map(int, input().split()))
memo = [0] * (2 + 10**5)
for a in t:
memo[a - 1] += 1
memo[a] += 1
memo[a + 1] += 1
print((max(memo)))
| N = int(eval(input()))
a = list(map(int, input().split()))
memo = [0] * (2 + 10**5)
for i in range(N):
tmp = a[i]
memo[tmp - 1] += 1
memo[tmp] += 1
memo[tmp + 1] += 1
ans = max(memo)
print(ans)
| false | 26.666667 | [
"-n = int(eval(input()))",
"-t = list(map(int, input().split()))",
"+N = int(eval(input()))",
"+a = list(map(int, input().split()))",
"-for a in t:",
"- memo[a - 1] += 1",
"- memo[a] += 1",
"- memo[a + 1] += 1",
"-print((max(memo)))",
"+for i in range(N):",
"+ tmp = a[i]",
"+ me... | false | 0.14185 | 0.139954 | 1.013548 | [
"s034682935",
"s552803802"
] |
u346812984 | p03013 | python | s695493313 | s627389855 | 191 | 85 | 7,832 | 7,668 | Accepted | Accepted | 55.5 | N, M = list(map(int, input().split()))
MOD = 10 ** 9 + 7
is_broken = [False for _ in range(N + 1)]
for _ in range(M):
a = int(eval(input()))
is_broken[a] = True
dp = [0 for _ in range(N + 1)]
dp[0] = 1
for i in range(1, N + 1):
if is_broken[i]:
continue
if i == 1:
dp[i]... | import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N, M = list(map(int, input().split()))
dp = [0] * (N + 1)
safe = [True] * (N + 1)
for _ in range(M):
a = int(eval(input()))
... | 22 | 33 | 416 | 619 | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
is_broken = [False for _ in range(N + 1)]
for _ in range(M):
a = int(eval(input()))
is_broken[a] = True
dp = [0 for _ in range(N + 1)]
dp[0] = 1
for i in range(1, N + 1):
if is_broken[i]:
continue
if i == 1:
dp[i] += dp[i - 1]
el... | import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N, M = list(map(int, input().split()))
dp = [0] * (N + 1)
safe = [True] * (N + 1)
for _ in range(M):
a = int(eval(input()))
safe[a] = False
... | false | 33.333333 | [
"-N, M = list(map(int, input().split()))",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+INF = float(\"inf\")",
"-is_broken = [False for _ in range(N + 1)]",
"-for _ in range(M):",
"- a = int(eval(input()))",
"- is_broken[a] = True",
"-dp = [0 for _ in range(N + 1)]",
"-dp[0] = 1"... | false | 0.042107 | 0.036679 | 1.148003 | [
"s695493313",
"s627389855"
] |
u297574184 | p03536 | python | s206107379 | s251250579 | 1,660 | 874 | 123,652 | 57,712 | Accepted | Accepted | 47.35 | N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
INF = float('inf')
dp = [0]
for H, P in HPs:
if dp[-1] != INF:
dp += [INF]
dp = list(map(min, list(zip([0] + [hgt + P if hgt <= H else INF for hgt in dp], dp))))
dp += [IN... | N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
dp = {0: 0}
for H, P in HPs:
for num, minH in list(dp.items()):
if H >= minH:
if num + 1 in dp:
dp[num + 1] = min(dp[num + 1], minH + P)
... | 14 | 15 | 337 | 385 | N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
INF = float("inf")
dp = [0]
for H, P in HPs:
if dp[-1] != INF:
dp += [INF]
dp = list(
map(min, list(zip([0] + [hgt + P if hgt <= H else INF for hgt in dp], dp)))
)
dp += [INF... | N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
dp = {0: 0}
for H, P in HPs:
for num, minH in list(dp.items()):
if H >= minH:
if num + 1 in dp:
dp[num + 1] = min(dp[num + 1], minH + P)
else:
... | false | 6.666667 | [
"-INF = float(\"inf\")",
"-dp = [0]",
"+dp = {0: 0}",
"- if dp[-1] != INF:",
"- dp += [INF]",
"- dp = list(",
"- map(min, list(zip([0] + [hgt + P if hgt <= H else INF for hgt in dp], dp)))",
"- )",
"-dp += [INF]",
"-print((dp.index(INF) - 1))",
"+ for num, minH in list(... | false | 0.043825 | 0.081591 | 0.537135 | [
"s206107379",
"s251250579"
] |
u352394527 | p00083 | python | s374859456 | s940655934 | 30 | 20 | 5,600 | 5,596 | Accepted | Accepted | 33.33 | def put_era(day):
if day < [1868, 9, 8]:
print("pre-meiji")
elif day <= [1912, 7, 29]:
print((*["meiji",day[0] - 1868 + 1, day[1], day[2]]))
elif day <= [1926, 12, 24]:
print((*["taisho",day[0] - 1912 + 1, day[1], day[2]]))
elif day <= [1989, 1, 7]:
print((*["showa",day[0] - ... | def put_era(day):
if day < [1868, 9, 8]:
print("pre-meiji")
elif day <= [1912, 7, 29]:
print(("meiji",day[0] - 1868 + 1, day[1], day[2]))
elif day <= [1926, 12, 24]:
print(("taisho",day[0] - 1912 + 1, day[1], day[2]))
elif day <= [1989, 1, 7]:
print(("showa",day[0] - 1926 + 1... | 23 | 23 | 530 | 518 | def put_era(day):
if day < [1868, 9, 8]:
print("pre-meiji")
elif day <= [1912, 7, 29]:
print((*["meiji", day[0] - 1868 + 1, day[1], day[2]]))
elif day <= [1926, 12, 24]:
print((*["taisho", day[0] - 1912 + 1, day[1], day[2]]))
elif day <= [1989, 1, 7]:
print((*["showa", da... | def put_era(day):
if day < [1868, 9, 8]:
print("pre-meiji")
elif day <= [1912, 7, 29]:
print(("meiji", day[0] - 1868 + 1, day[1], day[2]))
elif day <= [1926, 12, 24]:
print(("taisho", day[0] - 1912 + 1, day[1], day[2]))
elif day <= [1989, 1, 7]:
print(("showa", day[0] - 1... | false | 0 | [
"- print((*[\"meiji\", day[0] - 1868 + 1, day[1], day[2]]))",
"+ print((\"meiji\", day[0] - 1868 + 1, day[1], day[2]))",
"- print((*[\"taisho\", day[0] - 1912 + 1, day[1], day[2]]))",
"+ print((\"taisho\", day[0] - 1912 + 1, day[1], day[2]))",
"- print((*[\"showa\", day[0]... | false | 0.043515 | 0.043549 | 0.999222 | [
"s374859456",
"s940655934"
] |
u254871849 | p03475 | python | s037945632 | s493005479 | 63 | 50 | 3,188 | 3,188 | Accepted | Accepted | 20.63 | import sys
n = int(sys.stdin.readline().rstrip())
csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))
def main():
take_time = [None] * n
for i in range(n):
cur = i
t = 0
while cur < n - 1:
c, s, f = csf[cur]
if t < s:
t = s... | import sys
n, *csf = list(map(int, sys.stdin.read().split()))
csf = list(zip(*[iter(csf)] * 3))
def main():
for i in range(n - 1):
t = 0
for c, s, f in csf[i:]:
if t <= s: t = s + c
else: t = s + ((t - s + f - 1) // f) * f + c
print(t)
print((0))
... | 25 | 16 | 564 | 351 | import sys
n = int(sys.stdin.readline().rstrip())
csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))
def main():
take_time = [None] * n
for i in range(n):
cur = i
t = 0
while cur < n - 1:
c, s, f = csf[cur]
if t < s:
t = s
el... | import sys
n, *csf = list(map(int, sys.stdin.read().split()))
csf = list(zip(*[iter(csf)] * 3))
def main():
for i in range(n - 1):
t = 0
for c, s, f in csf[i:]:
if t <= s:
t = s + c
else:
t = s + ((t - s + f - 1) // f) * f + c
print(... | false | 36 | [
"-n = int(sys.stdin.readline().rstrip())",
"-csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))",
"+n, *csf = list(map(int, sys.stdin.read().split()))",
"+csf = list(zip(*[iter(csf)] * 3))",
"- take_time = [None] * n",
"- for i in range(n):",
"- cur = i",
"+ for i in range(n - ... | false | 0.041527 | 0.036461 | 1.138957 | [
"s037945632",
"s493005479"
] |
u429841998 | p02388 | python | s182838647 | s626759018 | 30 | 20 | 5,572 | 5,576 | Accepted | Accepted | 33.33 | x = eval(input())
y = int(x) ** 3
print((str(y)))
| x = eval(input())
y = int(x) ** 3
print(y)
| 3 | 3 | 44 | 39 | x = eval(input())
y = int(x) ** 3
print((str(y)))
| x = eval(input())
y = int(x) ** 3
print(y)
| false | 0 | [
"-print((str(y)))",
"+print(y)"
] | false | 0.046263 | 0.046782 | 0.988911 | [
"s182838647",
"s626759018"
] |
u260216890 | p03212 | python | s800047997 | s194750861 | 215 | 96 | 40,940 | 74,140 | Accepted | Accepted | 55.35 | from collections import deque
N=int(eval(input()))
nums=["3","5","7"]
stack=deque(nums)
cnt=0
while stack:
cand=stack.pop()
if ('3' in cand) and ('5' in cand) and ('7' in cand):
cnt+=1
for c in nums:
if int(cand+c)<=N:
stack.append(cand+c)
print(cnt) | n=int(eval(input()))
lim=len(str(n))
cand=[3,5,7]
ans=[]
while cand:
i=cand.pop()
for j in [3,5,7]:
k=int(str(i)+str(j))
if k<=n:
cand.append(k)
if len(set(str(k)))==3:
ans.append(k)
print((len(ans))) | 14 | 13 | 298 | 268 | from collections import deque
N = int(eval(input()))
nums = ["3", "5", "7"]
stack = deque(nums)
cnt = 0
while stack:
cand = stack.pop()
if ("3" in cand) and ("5" in cand) and ("7" in cand):
cnt += 1
for c in nums:
if int(cand + c) <= N:
stack.append(cand + c)
print(cnt)
| n = int(eval(input()))
lim = len(str(n))
cand = [3, 5, 7]
ans = []
while cand:
i = cand.pop()
for j in [3, 5, 7]:
k = int(str(i) + str(j))
if k <= n:
cand.append(k)
if len(set(str(k))) == 3:
ans.append(k)
print((len(ans)))
| false | 7.142857 | [
"-from collections import deque",
"-",
"-N = int(eval(input()))",
"-nums = [\"3\", \"5\", \"7\"]",
"-stack = deque(nums)",
"-cnt = 0",
"-while stack:",
"- cand = stack.pop()",
"- if (\"3\" in cand) and (\"5\" in cand) and (\"7\" in cand):",
"- cnt += 1",
"- for c in nums:",
"- ... | false | 0.174841 | 0.085445 | 2.046237 | [
"s800047997",
"s194750861"
] |
u112317104 | p02771 | python | s951318648 | s613572431 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | def solve():
N, M, L = list(map(int, input().split()))
ans = 'No'
if N == M and M == L:
return ans
if N == M or M == L or L == N:
ans = 'Yes'
return ans
print((solve())) | def solve():
A = list(map(int, input().split()))
a, b, c = A
if a == b == c: return 'No'
return 'Yes' if (a == b or b == c or c == a) else 'No'
print((solve())) | 13 | 7 | 229 | 181 | def solve():
N, M, L = list(map(int, input().split()))
ans = "No"
if N == M and M == L:
return ans
if N == M or M == L or L == N:
ans = "Yes"
return ans
print((solve()))
| def solve():
A = list(map(int, input().split()))
a, b, c = A
if a == b == c:
return "No"
return "Yes" if (a == b or b == c or c == a) else "No"
print((solve()))
| false | 46.153846 | [
"- N, M, L = list(map(int, input().split()))",
"- ans = \"No\"",
"- if N == M and M == L:",
"- return ans",
"- if N == M or M == L or L == N:",
"- ans = \"Yes\"",
"- return ans",
"+ A = list(map(int, input().split()))",
"+ a, b, c = A",
"+ if a == b == c:",
... | false | 0.043832 | 0.045645 | 0.960289 | [
"s951318648",
"s613572431"
] |
u936985471 | p03291 | python | s408683968 | s813699211 | 421 | 376 | 32,064 | 32,040 | Accepted | Accepted | 10.69 | import sys
readline = sys.stdin.readline
S = readline().rstrip()
DIV = 10 ** 9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
# dp[i + 1][0] : i文字目まで見たとき、ABCの部分文字列がまだ始まっていない場合の数
# dp[i + 1][1] : i文字目まで見たとき、ABCのAまで一致した場合の数
# dp[i + 1][2] : i文字目まで見たとき、ABCのBまで一致した場合の数
# dp[i + 1][3] : i文字目まで見たとき、ABCのCまで一致した場合の数... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
DIV = 10 ** 9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
# dp[i + 1][0] : i文字目まで見たとき、ABCの部分文字列がまだ始まっていない場合の数
# dp[i + 1][1] : i文字目まで見たとき、ABCのAまで一致した場合の数
# dp[i + 1][2] : i文字目まで見たとき、ABCのBまで一致した場合の数
# dp[i + 1][3] : i文字目まで見たとき、ABCのCまで一致した場合の数... | 41 | 33 | 1,271 | 841 | import sys
readline = sys.stdin.readline
S = readline().rstrip()
DIV = 10**9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
# dp[i + 1][0] : i文字目まで見たとき、ABCの部分文字列がまだ始まっていない場合の数
# dp[i + 1][1] : i文字目まで見たとき、ABCのAまで一致した場合の数
# dp[i + 1][2] : i文字目まで見たとき、ABCのBまで一致した場合の数
# dp[i + 1][3] : i文字目まで見たとき、ABCのCまで一致した場合の数
dp[0][0] = 1... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
DIV = 10**9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
# dp[i + 1][0] : i文字目まで見たとき、ABCの部分文字列がまだ始まっていない場合の数
# dp[i + 1][1] : i文字目まで見たとき、ABCのAまで一致した場合の数
# dp[i + 1][2] : i文字目まで見たとき、ABCのBまで一致した場合の数
# dp[i + 1][3] : i文字目まで見たとき、ABCのCまで一致した場合の数
dp[0][0] = 1... | false | 19.512195 | [
"+ # 状態を遷移しない場合",
"+ for j in range(4):",
"+ dp[i + 1][j] += dp[i][j] * (3 if S[i] == \"?\" else 1) # ?の場合は全ての遷移があり得る",
"- dp[i + 1][0] += dp[i][0] # まだ始まっていない状態をそのまま",
"- dp[i + 1][1] += dp[i][1] # まだ始まっていない状態をそのまま",
"- dp[i + 1][2] += dp[i][2] # まだ始まっていない状態をそのまま",
... | false | 0.03386 | 0.044139 | 0.767137 | [
"s408683968",
"s813699211"
] |
u156815136 | p03387 | python | s963936701 | s403864546 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | #import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
mod = 10**9 + 7
def readInts():
return list(map(int,input().split()))
def main():
a,b,c = readInts()
if (max(a,b,c)*3 - a - b - c) % 2 == 0:# 3 4 5 5 * 3 = 15 15 - 12 = 3
p... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bi... | 16 | 36 | 471 | 805 | # import collections
# aa = collections.Counter(a) # list to list
# from itertools import combinations # (string,3) 3回
mod = 10**9 + 7
def readInts():
return list(map(int, input().split()))
def main():
a, b, c = readInts()
if (max(a, b, c) * 3 - a - b - c) % 2 == 0: # 3 4 5 5 * 3 = 15 15 - 12 = 3
... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from itertools import combinations # (string,3) 3回
# from collections import deque
# import collections.defaultdict
# import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bise... | false | 55.555556 | [
"+# from statistics import median",
"-# aa = collections.Counter(a) # list to list",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+# from collections import deque",
"+# import collections.defaultdict",
"+# import bisect",
"+#",
"+# d = m - k[i] - k[j]",
... | false | 0.048606 | 0.044385 | 1.095089 | [
"s963936701",
"s403864546"
] |
u606045429 | p03148 | python | s673591838 | s565455231 | 376 | 343 | 31,424 | 31,428 | Accepted | Accepted | 8.78 | from heapq import heappush, heappop, heapreplace
def main():
INF = 10 ** 9 + 7
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
... | from heapq import heappush, heappop, heapreplace
def main():
INF = 10 ** 9 + 7
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
... | 44 | 44 | 917 | 924 | from heapq import heappush, heappop, heapreplace
def main():
INF = 10**9 + 7
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
else:
... | from heapq import heappush, heappop, heapreplace
def main():
INF = 10**9 + 7
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
else:
... | false | 0 | [
"- E.sort(reverse=True)",
"+ E.sort(key=lambda x: -x[0])"
] | false | 0.162153 | 0.142893 | 1.134782 | [
"s673591838",
"s565455231"
] |
u297574184 | p03040 | python | s087117238 | s284290986 | 658 | 576 | 35,928 | 52,548 | Accepted | Accepted | 12.46 | from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
ss = eval(input())
t, A, B = list(map(int, ss.split()))
PQ1, PQ2 = [-A], [A]
fr = to = A
minF = 0
accB = B
anss = []
for _ in range(Q-1):
ss = eval(input())
if ss[0] == '1':
t, A, B ... | from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
querys = [tuple(map(int, input().split())) for _ in range(Q)]
anss = []
PQL, PQR = [], []
sumL = sumR = 0
numL = numR = 0
sumB = 0
for query in querys:
if query[0] == 1: # 更新
a, b = que... | 40 | 51 | 984 | 1,317 | from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
ss = eval(input())
t, A, B = list(map(int, ss.split()))
PQ1, PQ2 = [-A], [A]
fr = to = A
minF = 0
accB = B
anss = []
for _ in range(Q - 1):
ss = eval(input())
if ss[0] == "1":
t, A, B = list(map(in... | from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
querys = [tuple(map(int, input().split())) for _ in range(Q)]
anss = []
PQL, PQR = [], []
sumL = sumR = 0
numL = numR = 0
sumB = 0
for query in querys:
if query[0] == 1: # 更新
a, b = query[1:]
... | false | 21.568627 | [
"-ss = eval(input())",
"-t, A, B = list(map(int, ss.split()))",
"-PQ1, PQ2 = [-A], [A]",
"-fr = to = A",
"-minF = 0",
"-accB = B",
"+querys = [tuple(map(int, input().split())) for _ in range(Q)]",
"-for _ in range(Q - 1):",
"- ss = eval(input())",
"- if ss[0] == \"1\":",
"- t, A, B ... | false | 0.113067 | 0.113248 | 0.998403 | [
"s087117238",
"s284290986"
] |
u089230684 | p03162 | python | s497838909 | s338177637 | 722 | 251 | 78,040 | 100,680 | Accepted | Accepted | 65.24 | N = int(eval(input()))
vacation = []
for i in range(N):
vacation.append(list(map(int, input().split())))
activities = 3
schedules = [[None for _ in range(activities)] for _ in range(N)]
schedules[0] = vacation[0]
for i in range(1, N):
for j in range(activities):
schedules[i][j] = max(schedu... | n = int(eval(input()))
felicidade = []
for x in range(n):
felicidade.append(list(map(int,input().split())))
dp = []
dp.append([felicidade[0][0],felicidade[0][1],felicidade[0][2]])
for i in range(n-1):
dp.append([0,0,0])
for dia in range(1,n):
dp[dia][0] = felicidade[dia][0] + max(dp[d... | 14 | 22 | 418 | 504 | N = int(eval(input()))
vacation = []
for i in range(N):
vacation.append(list(map(int, input().split())))
activities = 3
schedules = [[None for _ in range(activities)] for _ in range(N)]
schedules[0] = vacation[0]
for i in range(1, N):
for j in range(activities):
schedules[i][j] = (
max(sched... | n = int(eval(input()))
felicidade = []
for x in range(n):
felicidade.append(list(map(int, input().split())))
dp = []
dp.append([felicidade[0][0], felicidade[0][1], felicidade[0][2]])
for i in range(n - 1):
dp.append([0, 0, 0])
for dia in range(1, n):
dp[dia][0] = felicidade[dia][0] + max(dp[dia - 1][1], dp[... | false | 36.363636 | [
"-N = int(eval(input()))",
"-vacation = []",
"-for i in range(N):",
"- vacation.append(list(map(int, input().split())))",
"-activities = 3",
"-schedules = [[None for _ in range(activities)] for _ in range(N)]",
"-schedules[0] = vacation[0]",
"-for i in range(1, N):",
"- for j in range(activiti... | false | 0.035572 | 0.041222 | 0.86292 | [
"s497838909",
"s338177637"
] |
u896741788 | p02866 | python | s818406426 | s454582566 | 374 | 175 | 14,020 | 21,468 | Accepted | Accepted | 53.21 | n=int(eval(input()))
l=list(map(int,input().split()))
if l[0]:print((0));exit()
mod=998244353
k=[0]*n
for i in l:k[i]+=1
if k[0]!=1:print((0));exit()
ans=1
for i,s in zip(k,k[1:]):ans*=pow(i,s,mod)
print((ans%mod)) | mod=998244353
n=int(eval(input()))
from collections import Counter as co
j=list(map(int,input().split()))
l=co(j)
ll=len(l)
for i in range(ll):
if i not in l:print((0));exit()
if l[0]>=2 or j[0]!=0:print((0));exit()
ans=1
pre=1
for k,v in sorted(l.items()):
ans*=pow(pre,v,mod)
ans%=mod
pre... | 10 | 16 | 211 | 328 | n = int(eval(input()))
l = list(map(int, input().split()))
if l[0]:
print((0))
exit()
mod = 998244353
k = [0] * n
for i in l:
k[i] += 1
if k[0] != 1:
print((0))
exit()
ans = 1
for i, s in zip(k, k[1:]):
ans *= pow(i, s, mod)
print((ans % mod))
| mod = 998244353
n = int(eval(input()))
from collections import Counter as co
j = list(map(int, input().split()))
l = co(j)
ll = len(l)
for i in range(ll):
if i not in l:
print((0))
exit()
if l[0] >= 2 or j[0] != 0:
print((0))
exit()
ans = 1
pre = 1
for k, v in sorted(l.items()):
ans *= ... | false | 37.5 | [
"+mod = 998244353",
"-l = list(map(int, input().split()))",
"-if l[0]:",
"- print((0))",
"- exit()",
"-mod = 998244353",
"-k = [0] * n",
"-for i in l:",
"- k[i] += 1",
"-if k[0] != 1:",
"+from collections import Counter as co",
"+",
"+j = list(map(int, input().split()))",
"+l = co... | false | 0.087182 | 0.039136 | 2.227662 | [
"s818406426",
"s454582566"
] |
u827141374 | p02983 | python | s614292616 | s856162539 | 503 | 396 | 75,416 | 112,596 | Accepted | Accepted | 21.27 | l,r=list(map(int,input().split()))
a=0
if r-l<2019:
a=min([(i%2019*j%2019) for i in range(l,r+1) for j in range(i+1,r+1)])
print((a%2019)) | l,r=list(map(int,input().split()))
a=0
if r-l<2019:
a=min([(i*j)%2019 for i in range(l,r+1) for j in range(i+1,r+1)])
print(a) | 5 | 5 | 136 | 126 | l, r = list(map(int, input().split()))
a = 0
if r - l < 2019:
a = min(
[(i % 2019 * j % 2019) for i in range(l, r + 1) for j in range(i + 1, r + 1)]
)
print((a % 2019))
| l, r = list(map(int, input().split()))
a = 0
if r - l < 2019:
a = min([(i * j) % 2019 for i in range(l, r + 1) for j in range(i + 1, r + 1)])
print(a)
| false | 0 | [
"- a = min(",
"- [(i % 2019 * j % 2019) for i in range(l, r + 1) for j in range(i + 1, r + 1)]",
"- )",
"-print((a % 2019))",
"+ a = min([(i * j) % 2019 for i in range(l, r + 1) for j in range(i + 1, r + 1)])",
"+print(a)"
] | false | 0.154111 | 0.048169 | 3.199391 | [
"s614292616",
"s856162539"
] |
u585482323 | p03330 | python | s270861055 | s569933353 | 323 | 243 | 46,428 | 43,996 | Accepted | Accepted | 24.77 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 99 | 59 | 2,074 | 1,552 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 40.40404 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"+from itertools import permutations, accumulate",
"-import random",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.buffer.readlin... | false | 0.039825 | 0.047557 | 0.837418 | [
"s270861055",
"s569933353"
] |
u102461423 | p02715 | python | s126983750 | s429011212 | 28 | 25 | 9,408 | 9,460 | Accepted | Accepted | 10.71 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
M = int(K ** .5)
f_l = [0] * (M+1) # f(k)
f_h = [0] * (M+1) # f(K//d)
def f(k):
return f_l[k] if k <= M else f_h[K//k]
def compute_f(k):
x = pow(k, N, MOD)
sq = int(k ** .5)
for d in range(2, k+1):
n = k // d
if n <= sq:
b... | MOD = 10**9 + 7
e, N = list(map(int, input().split()))
def phi_table(N):
phi = list(range(N + 1))
for p in range(2, N + 1):
if phi[p] == p:
for n in range(N // p, 0, -1):
phi[p * n] -= phi[n]
return phi
L = int(N ** .66)
H = int(N // (L + 1))
phi = phi_ta... | 45 | 62 | 830 | 1,201 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
M = int(K**0.5)
f_l = [0] * (M + 1) # f(k)
f_h = [0] * (M + 1) # f(K//d)
def f(k):
return f_l[k] if k <= M else f_h[K // k]
def compute_f(k):
x = pow(k, N, MOD)
sq = int(k**0.5)
for d in range(2, k + 1):
n = k // d
if n <= sq:
... | MOD = 10**9 + 7
e, N = list(map(int, input().split()))
def phi_table(N):
phi = list(range(N + 1))
for p in range(2, N + 1):
if phi[p] == p:
for n in range(N // p, 0, -1):
phi[p * n] -= phi[n]
return phi
L = int(N**0.66)
H = int(N // (L + 1))
phi = phi_table(L)
# f(n) ... | false | 27.419355 | [
"-N, K = list(map(int, input().split()))",
"-M = int(K**0.5)",
"-f_l = [0] * (M + 1) # f(k)",
"-f_h = [0] * (M + 1) # f(K//d)",
"+e, N = list(map(int, input().split()))",
"-def f(k):",
"- return f_l[k] if k <= M else f_h[K // k]",
"+def phi_table(N):",
"+ phi = list(range(N + 1))",
"+ f... | false | 0.048238 | 0.082745 | 0.582972 | [
"s126983750",
"s429011212"
] |
u761320129 | p03178 | python | s853357472 | s672144249 | 1,230 | 1,131 | 62,812 | 129,884 | Accepted | Accepted | 8.05 | K = eval(input())
D = int(eval(input()))
L = len(K)
MOD = 10**9+7
dp = [[[0]*D for j in range(2)] for i in range(L+1)] #dp[i][less][modD]
dp[0][0][0] = 1
for i,c in enumerate(K):
for less in range(2):
lim = 9 if less else int(c)
for r in range(D):
for d in range(lim+1):
... | K = eval(input())
L = len(K)
D = int(eval(input()))
MOD = 10**9+7
dp = [[[0,0] for _ in range(D)] for _ in range(L+1)]
dp[0][0][0] = 1
for i,c in enumerate(K):
c = int(c)
for x in range(D):
for d in range(10):
y = (x+d)%D
dp[i+1][y][1] += dp[i][x][1]
dp[... | 15 | 18 | 477 | 482 | K = eval(input())
D = int(eval(input()))
L = len(K)
MOD = 10**9 + 7
dp = [[[0] * D for j in range(2)] for i in range(L + 1)] # dp[i][less][modD]
dp[0][0][0] = 1
for i, c in enumerate(K):
for less in range(2):
lim = 9 if less else int(c)
for r in range(D):
for d in range(lim + 1):
... | K = eval(input())
L = len(K)
D = int(eval(input()))
MOD = 10**9 + 7
dp = [[[0, 0] for _ in range(D)] for _ in range(L + 1)]
dp[0][0][0] = 1
for i, c in enumerate(K):
c = int(c)
for x in range(D):
for d in range(10):
y = (x + d) % D
dp[i + 1][y][1] += dp[i][x][1]
dp[i ... | false | 16.666667 | [
"+L = len(K)",
"-L = len(K)",
"-dp = [[[0] * D for j in range(2)] for i in range(L + 1)] # dp[i][less][modD]",
"+dp = [[[0, 0] for _ in range(D)] for _ in range(L + 1)]",
"- for less in range(2):",
"- lim = 9 if less else int(c)",
"- for r in range(D):",
"- for d in range(... | false | 0.037542 | 0.007358 | 5.10235 | [
"s853357472",
"s672144249"
] |
u451017206 | p03212 | python | s234783050 | s714883440 | 1,174 | 67 | 3,060 | 3,060 | Accepted | Accepted | 94.29 | from itertools import product
N = int(eval(input()))
ans = 0
for k in range(3,11):
for i in product([0,3,5,7],repeat=k):
if set(i) != {3,5,7}:
continue
if sum([10**j*v for j,v in enumerate(i)]) <= N:
ans += 1
print(ans)
| N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if len(set(s)) == 4 else 0
for i in ('3', '5', '7'):
ret += dfs(s+i)
return ret
print((dfs('0')))
| 10 | 13 | 268 | 205 | from itertools import product
N = int(eval(input()))
ans = 0
for k in range(3, 11):
for i in product([0, 3, 5, 7], repeat=k):
if set(i) != {3, 5, 7}:
continue
if sum([10**j * v for j, v in enumerate(i)]) <= N:
ans += 1
print(ans)
| N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if len(set(s)) == 4 else 0
for i in ("3", "5", "7"):
ret += dfs(s + i)
return ret
print((dfs("0")))
| false | 23.076923 | [
"-from itertools import product",
"+N = int(eval(input()))",
"-N = int(eval(input()))",
"-ans = 0",
"-for k in range(3, 11):",
"- for i in product([0, 3, 5, 7], repeat=k):",
"- if set(i) != {3, 5, 7}:",
"- continue",
"- if sum([10**j * v for j, v in enumerate(i)]) <= N:",... | false | 3.111403 | 0.042439 | 73.315262 | [
"s234783050",
"s714883440"
] |
u498487134 | p02989 | python | s721621696 | s118665723 | 215 | 97 | 52,680 | 84,152 | Accepted | Accepted | 54.88 | N=int(eval(input()))
d=list(map(int,input().split()))
d.sort()
floor=d[N//2-1]
ceil=d[N//2]
print((ceil-floor)) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
d=LI()
d.sort()
a=d[N//2-1]
b=d[N//2]
ans=b-a
print(ans)
main()
| 8 | 18 | 112 | 305 | N = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
floor = d[N // 2 - 1]
ceil = d[N // 2]
print((ceil - floor))
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
d = LI()
d.sort()
a = d[N // 2 - 1]
b = d[N // 2]
ans = b - a
... | false | 55.555556 | [
"-N = int(eval(input()))",
"-d = list(map(int, input().split()))",
"-d.sort()",
"-floor = d[N // 2 - 1]",
"-ceil = d[N // 2]",
"-print((ceil - floor))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def I():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
... | false | 0.039147 | 0.041127 | 0.95184 | [
"s721621696",
"s118665723"
] |
u506858457 | p02850 | python | s567731575 | s351070436 | 797 | 517 | 84,516 | 92,568 | Accepted | Accepted | 35.13 | '''catupper
ポイントA.再帰DFSで全ての頂点をチェックし、辺の色を求める。上限に注意。
ポイントB.入力に注意。
頂点が連結しているということは、そこに辺があるということ。
辺は頂点を結ぶので、辺が連結している二つの頂点(a[i], b[i])で表現され、
まず、辺をedgeに格納する。
辺の色は辞書color_dictに格納している。
辺である(a[i], b[i])をキーとして使って、color_dict[(a[i], b[i])]で
その辺に対応する色の番号が分かるようにしている。
辞書のキーが配列になっているので、注意。
ポイントC.色を頂点の順番で辺毎に出力する。辺の数は頂点-1個。
f... | import sys
sys.setrecursionlimit(1000000)
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
N=II()
edge=[[] for i in range(N)]
a=[0]*N
b=[0]*N
for i in range(N-1):
a[i],b[i]=MI()
a[i]-=1
b[i]-=1
edge[a[i]].append(b[i])
edge[b[i]].append(a[i])
k=0
color_dict={}... | 85 | 32 | 2,447 | 626 | """catupper
ポイントA.再帰DFSで全ての頂点をチェックし、辺の色を求める。上限に注意。
ポイントB.入力に注意。
頂点が連結しているということは、そこに辺があるということ。
辺は頂点を結ぶので、辺が連結している二つの頂点(a[i], b[i])で表現され、
まず、辺をedgeに格納する。
辺の色は辞書color_dictに格納している。
辺である(a[i], b[i])をキーとして使って、color_dict[(a[i], b[i])]で
その辺に対応する色の番号が分かるようにしている。
辞書のキーが配列になっているので、注意。
ポイントC.色を頂点の順番で辺毎に出力する。辺の数は頂点-1個。
for i in ran... | import sys
sys.setrecursionlimit(1000000)
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
N = II()
edge = [[] for i in range(N)]
a = [0] * N
b = [0] * N
for i in range(N - 1):
a[i], b[i] = MI()
a[i] -= 1
b[i] -= 1
edge[a[i]].append(b[i])
edge[b[i]]... | false | 62.352941 | [
"-\"\"\"catupper",
"-ポイントA.再帰DFSで全ての頂点をチェックし、辺の色を求める。上限に注意。",
"-ポイントB.入力に注意。",
"-頂点が連結しているということは、そこに辺があるということ。",
"-辺は頂点を結ぶので、辺が連結している二つの頂点(a[i], b[i])で表現され、",
"-まず、辺をedgeに格納する。",
"-辺の色は辞書color_dictに格納している。",
"-辺である(a[i], b[i])をキーとして使って、color_dict[(a[i], b[i])]で",
"-その辺に対応する色の番号が分かるようにしている。",
"-辞書の... | false | 0.037189 | 0.07695 | 0.483284 | [
"s567731575",
"s351070436"
] |
u680004123 | p03455 | python | s656711005 | s283464868 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | # -*- coding:utf-8 -*-
a,b = list(map(int, input().split()))
sum = a * b
if sum % 2 == 0:
print("Even")
else:
print("Odd") | a,b = map(int, input().split())
print("Even") if (a*b)%2==0 else print("Odd")
| 8 | 2 | 140 | 78 | # -*- coding:utf-8 -*-
a, b = list(map(int, input().split()))
sum = a * b
if sum % 2 == 0:
print("Even")
else:
print("Odd")
| a, b = map(int, input().split())
print("Even") if (a * b) % 2 == 0 else print("Odd")
| false | 75 | [
"-# -*- coding:utf-8 -*-",
"-a, b = list(map(int, input().split()))",
"-sum = a * b",
"-if sum % 2 == 0:",
"- print(\"Even\")",
"-else:",
"- print(\"Odd\")",
"+a, b = map(int, input().split())",
"+print(\"Even\") if (a * b) % 2 == 0 else print(\"Odd\")"
] | false | 0.070198 | 0.04901 | 1.432333 | [
"s656711005",
"s283464868"
] |
u122428774 | p03145 | python | s322656377 | s080528077 | 181 | 161 | 38,384 | 38,352 | Accepted | Accepted | 11.05 | i=sorted(map(int,input().split()));print((int(i[0]*i[1]/2))) | a,b,_=list(map(int,input().split()));print((a*b//2)) | 1 | 1 | 58 | 44 | i = sorted(map(int, input().split()))
print((int(i[0] * i[1] / 2)))
| a, b, _ = list(map(int, input().split()))
print((a * b // 2))
| false | 0 | [
"-i = sorted(map(int, input().split()))",
"-print((int(i[0] * i[1] / 2)))",
"+a, b, _ = list(map(int, input().split()))",
"+print((a * b // 2))"
] | false | 0.064742 | 0.045535 | 1.421813 | [
"s322656377",
"s080528077"
] |
u688587139 | p03031 | python | s031731072 | s177108339 | 89 | 42 | 74,220 | 9,208 | Accepted | Accepted | 52.81 | N, M = list(map(int, input().split()))
switches_bulbs_connection = {}
for i in range(M):
switches_bulbs_connection[i] = list(map(int, input().split()))[1:]
p = list(map(int, input().split()))
count = 0
flag = 0
for i in range(2 ** N): # スイッチのon/offについてビット全探索
switch_on_off = [0] * N
bulb_stat =... | N, M = list(map(int, input().split()))
bulb = []
count = 0
for _ in range(M):
tmp = list(map(int, input().split()))
bulb.append(tmp[1:])
P = list(map(int, input().split()))
for i in range(2 ** N):
switch = []
for j in range(N): # スイッチの押し方を全探索
if (i >> j) & 1:
switch... | 28 | 28 | 765 | 703 | N, M = list(map(int, input().split()))
switches_bulbs_connection = {}
for i in range(M):
switches_bulbs_connection[i] = list(map(int, input().split()))[1:]
p = list(map(int, input().split()))
count = 0
flag = 0
for i in range(2**N): # スイッチのon/offについてビット全探索
switch_on_off = [0] * N
bulb_stat = [0] * M
fo... | N, M = list(map(int, input().split()))
bulb = []
count = 0
for _ in range(M):
tmp = list(map(int, input().split()))
bulb.append(tmp[1:])
P = list(map(int, input().split()))
for i in range(2**N):
switch = []
for j in range(N): # スイッチの押し方を全探索
if (i >> j) & 1:
switch.append(j + 1)
... | false | 0 | [
"-switches_bulbs_connection = {}",
"-for i in range(M):",
"- switches_bulbs_connection[i] = list(map(int, input().split()))[1:]",
"-p = list(map(int, input().split()))",
"+bulb = []",
"-flag = 0",
"-for i in range(2**N): # スイッチのon/offについてビット全探索",
"- switch_on_off = [0] * N",
"- bulb_stat =... | false | 0.038378 | 0.063199 | 0.607254 | [
"s031731072",
"s177108339"
] |
u062147869 | p04035 | python | s801037737 | s917272847 | 299 | 269 | 63,984 | 73,828 | Accepted | Accepted | 10.03 | import sys
N,L=list(map(int,input().split()))
A=[int(i) for i in input().split()]
flag=True
a=-1
for i in range(N-1):
if A[i+1]+A[i]>=L:
flag=False
a=i+1
break
if flag:
print('Impossible')
sys.exit()
print('Possible')
for i in range(1,a):
print(i)
for i in range(N... | import sys
N,L=list(map(int,input().split()))
A=[int(i) for i in input().split()]
s=10**23
for i in range(N-1):
if A[i]+A[i+1]>=L:
s=i
break
if s==10**23:
print('Impossible')
sys.exit()
print('Possible')
L=[]
for i in range(s):
L.append(i+1)
for i in range(N-2,s,-1):
... | 19 | 20 | 348 | 385 | import sys
N, L = list(map(int, input().split()))
A = [int(i) for i in input().split()]
flag = True
a = -1
for i in range(N - 1):
if A[i + 1] + A[i] >= L:
flag = False
a = i + 1
break
if flag:
print("Impossible")
sys.exit()
print("Possible")
for i in range(1, a):
print(i)
for i ... | import sys
N, L = list(map(int, input().split()))
A = [int(i) for i in input().split()]
s = 10**23
for i in range(N - 1):
if A[i] + A[i + 1] >= L:
s = i
break
if s == 10**23:
print("Impossible")
sys.exit()
print("Possible")
L = []
for i in range(s):
L.append(i + 1)
for i in range(N - 2,... | false | 5 | [
"-flag = True",
"-a = -1",
"+s = 10**23",
"- if A[i + 1] + A[i] >= L:",
"- flag = False",
"- a = i + 1",
"+ if A[i] + A[i + 1] >= L:",
"+ s = i",
"-if flag:",
"+if s == 10**23:",
"-for i in range(1, a):",
"- print(i)",
"-for i in range(N - 1, a, -1):",
"- p... | false | 0.043776 | 0.037506 | 1.167173 | [
"s801037737",
"s917272847"
] |
u692453235 | p03253 | python | s171895065 | s115664781 | 1,099 | 118 | 127,692 | 20,928 | Accepted | Accepted | 89.26 | N, M = list(map(int, input().split()))
import math
def prime_fac(n):
p_lis = []
temp = n
for i in range(2, int(math.sqrt(n)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
p_lis.append([i, cnt])
if temp != 1:
p_lis.append([te... | N, M = list(map(int, input().split()))
import math
def prime_fac(n):
p_lis = []
temp = n
for i in range(2, int(math.sqrt(n)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
p_lis.append([i, cnt])
if temp != 1:
p_lis.append([te... | 48 | 48 | 872 | 871 | N, M = list(map(int, input().split()))
import math
def prime_fac(n):
p_lis = []
temp = n
for i in range(2, int(math.sqrt(n)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
p_lis.append([i, cnt])
if te... | N, M = list(map(int, input().split()))
import math
def prime_fac(n):
p_lis = []
temp = n
for i in range(2, int(math.sqrt(n)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
p_lis.append([i, cnt])
if te... | false | 0 | [
"-MAX = 10**6",
"+MAX = N + 50"
] | false | 1.440496 | 0.054691 | 26.339033 | [
"s171895065",
"s115664781"
] |
u227020436 | p03309 | python | s680658752 | s388880369 | 239 | 199 | 26,832 | 25,196 | Accepted | Accepted | 16.74 | from math import ceil, floor
N = int(eval(input()))
A = [int(t) for t in input().split()]
if len(A) != N: raise
p = [A[i-1] - i for i in range(1, N+1)]
p.sort()
q = []
for b in p[N//2 - 1 : N//2 + 2]:
q.append(sum(abs(x - b) for x in p))
print((min(q)))
| N = int(eval(input()))
A = [int(t) for t in input().split()]
if len(A) != N: raise
p = [A[i-1] - i for i in range(1, N+1)]
p.sort()
b = p[N // 2]
print((sum(abs(x - b) for x in p)))
| 13 | 9 | 265 | 184 | from math import ceil, floor
N = int(eval(input()))
A = [int(t) for t in input().split()]
if len(A) != N:
raise
p = [A[i - 1] - i for i in range(1, N + 1)]
p.sort()
q = []
for b in p[N // 2 - 1 : N // 2 + 2]:
q.append(sum(abs(x - b) for x in p))
print((min(q)))
| N = int(eval(input()))
A = [int(t) for t in input().split()]
if len(A) != N:
raise
p = [A[i - 1] - i for i in range(1, N + 1)]
p.sort()
b = p[N // 2]
print((sum(abs(x - b) for x in p)))
| false | 30.769231 | [
"-from math import ceil, floor",
"-",
"-q = []",
"-for b in p[N // 2 - 1 : N // 2 + 2]:",
"- q.append(sum(abs(x - b) for x in p))",
"-print((min(q)))",
"+b = p[N // 2]",
"+print((sum(abs(x - b) for x in p)))"
] | false | 0.043746 | 0.03764 | 1.162198 | [
"s680658752",
"s388880369"
] |
u540761833 | p02862 | python | s456593655 | s282776913 | 1,361 | 173 | 123,816 | 3,192 | Accepted | Accepted | 87.29 | X,Y = list(map(int,input().split()))
if (X+Y)%3 != 0 or X > 2*Y or Y > 2*X:
print((0))
else:
ab = (X+Y)//3
a = X - ab
b = ab - a
mod = 10**9+7
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
... | X,Y = list(map(int,input().split()))
def comb(n,k,p):
"""power_funcを用いて(nCk) mod p を求める"""
from math import factorial
if n<0 or k<0 or n<k: return 0
if n==0 or k==0: return 1
a = 1
b = 1
c = 1
for i in range(1,n+1):
a = (a*i)%p
for i in range(1,k+1):
b = (b*i)%p
for i in range(1... | 28 | 33 | 679 | 758 | X, Y = list(map(int, input().split()))
if (X + Y) % 3 != 0 or X > 2 * Y or Y > 2 * X:
print((0))
else:
ab = (X + Y) // 3
a = X - ab
b = ab - a
mod = 10**9 + 7
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] %... | X, Y = list(map(int, input().split()))
def comb(n, k, p):
"""power_funcを用いて(nCk) mod p を求める"""
from math import factorial
if n < 0 or k < 0 or n < k:
return 0
if n == 0 or k == 0:
return 1
a = 1
b = 1
c = 1
for i in range(1, n + 1):
a = (a * i) % p
for i in... | false | 15.151515 | [
"+",
"+",
"+def comb(n, k, p):",
"+ \"\"\"power_funcを用いて(nCk) mod p を求める\"\"\"",
"+ from math import factorial",
"+",
"+ if n < 0 or k < 0 or n < k:",
"+ return 0",
"+ if n == 0 or k == 0:",
"+ return 1",
"+ a = 1",
"+ b = 1",
"+ c = 1",
"+ for i in ra... | false | 1.28442 | 0.068853 | 18.654554 | [
"s456593655",
"s282776913"
] |
u382748202 | p03049 | python | s597691503 | s373300804 | 40 | 27 | 3,064 | 3,188 | Accepted | Accepted | 32.5 | N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
count_ab += s.count("AB")
if s[0] + s[-1] == "BA":
count_fbea += 1
elif s[0] == "B":
count_fb += 1
elif s[-1] == "A":
count_ea += 1
ans = count_... | import sys
input = sys.stdin.readline
N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
count_ab += s.count("AB")
if s[0] + s[-2] == "BA":
count_fbea += 1
elif s[0] == "B":
count_fb += 1
elif s[-2] == "... | 27 | 30 | 527 | 569 | N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
count_ab += s.count("AB")
if s[0] + s[-1] == "BA":
count_fbea += 1
elif s[0] == "B":
count_fb += 1
elif s[-1] == "A":
count_ea += 1
ans = count_ab
if count_fbea >... | import sys
input = sys.stdin.readline
N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
count_ab += s.count("AB")
if s[0] + s[-2] == "BA":
count_fbea += 1
elif s[0] == "B":
count_fb += 1
elif s[-2] == "A":
count... | false | 10 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- if s[0] + s[-1] == \"BA\":",
"+ if s[0] + s[-2] == \"BA\":",
"- elif s[-1] == \"A\":",
"+ elif s[-2] == \"A\":"
] | false | 0.092935 | 0.046567 | 1.995729 | [
"s597691503",
"s373300804"
] |
u094191970 | p03700 | python | s740205439 | s907210630 | 1,906 | 1,412 | 15,004 | 15,016 | Accepted | Accepted | 25.92 | n,a,b=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]
h_sum=sum(h)
ok=10**9
ng=0
while abs(ok-ng)>1:
mid=(ok+ng)//2
l=[max(i-(mid*b),0) for i in h]
cnt=0
for j in l:
# if j<=0:
# continue
if j%(a-b)==0:
cnt+=j//(a-b)
else:
cnt+=j//(a-b)+1
if cnt<=mid... | n,a,b=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]
ok=10**9
ng=0
while abs(ok-ng)>1:
mid=(ok+ng)//2
l=[i-(mid*b) for i in h]
cnt=0
for j in l:
if j<=0:
continue
cnt+=(j+a-b-1)//(a-b)
if cnt<=mid:
ok=mid
else:
ng=mid
print(ok) | 28 | 22 | 350 | 283 | n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
h_sum = sum(h)
ok = 10**9
ng = 0
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
l = [max(i - (mid * b), 0) for i in h]
cnt = 0
for j in l:
# if j<=0:
# continue
if j % (a - b) == 0:
... | n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
ok = 10**9
ng = 0
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
l = [i - (mid * b) for i in h]
cnt = 0
for j in l:
if j <= 0:
continue
cnt += (j + a - b - 1) // (a - b)
if cnt <= mid:
... | false | 21.428571 | [
"-h_sum = sum(h)",
"- l = [max(i - (mid * b), 0) for i in h]",
"+ l = [i - (mid * b) for i in h]",
"- # if j<=0:",
"- # continue",
"- if j % (a - b) == 0:",
"- cnt += j // (a - b)",
"- else:",
"- cnt += j // (a - b) + 1",
"+ if j <=... | false | 0.036628 | 0.038197 | 0.958924 | [
"s740205439",
"s907210630"
] |
u374103100 | p03017 | python | s580061012 | s660422145 | 195 | 170 | 61,168 | 40,816 | Accepted | Accepted | 12.82 | # https://atcoder.jp/contests/agc034/tasks/agc034_a
import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq
def main():
N, A, B, C, D = list(map(int, input().split()))
S = list(eval(input()))
blocks = 0
for s in range(A... | # https://atcoder.jp/contests/agc034/tasks/agc034_a
import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq
def main():
n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
ans = 'Yes'
if '##' in s[a - 1:c]... | 49 | 31 | 1,068 | 600 | # https://atcoder.jp/contests/agc034/tasks/agc034_a
import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq
def main():
N, A, B, C, D = list(map(int, input().split()))
S = list(eval(input()))
blocks = 0
for s in range(A - 1, C):
... | # https://atcoder.jp/contests/agc034/tasks/agc034_a
import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq
def main():
n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
ans = "Yes"
if "##" in s[a - 1 : c] or "##" in s... | false | 36.734694 | [
"- N, A, B, C, D = list(map(int, input().split()))",
"- S = list(eval(input()))",
"- blocks = 0",
"- for s in range(A - 1, C):",
"- if S[s] == \".\":",
"- if blocks > 1:",
"- print(\"No\")",
"- exit()",
"- blocks = 0",
"+ n,... | false | 0.03567 | 0.036489 | 0.977531 | [
"s580061012",
"s660422145"
] |
u279670936 | p03160 | python | s812948683 | s471920431 | 254 | 133 | 14,380 | 20,956 | Accepted | Accepted | 47.64 | import sys
sample = sys.stdin.read().splitlines()
n, stones = int(sample[0]), list(map(int, sample[1].split()))
dp = [float('inf')] * n
jumps = (1, 2)
dp[0] = 0
for idx in range(len(dp)):
for jump in jumps:
if idx+jump < len(dp):
dp[idx+jump] = min(dp[idx]+abs(stones[idx+jump]-stones[idx]), dp[idx... | import sys, os
sys.setrecursionlimit(10**8)
#resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
read = lambda : sys.stdin.readline().rstrip('\n')
tint = lambda x: [int(x) for x in x.split()]
inf = float('inf')
def main():
n = tint(read())[0]
stones = tint(read())
dp = [inf]*n
dp[0] = 0... | 12 | 23 | 346 | 596 | import sys
sample = sys.stdin.read().splitlines()
n, stones = int(sample[0]), list(map(int, sample[1].split()))
dp = [float("inf")] * n
jumps = (1, 2)
dp[0] = 0
for idx in range(len(dp)):
for jump in jumps:
if idx + jump < len(dp):
dp[idx + jump] = min(
dp[idx] + abs(stones[idx ... | import sys, os
sys.setrecursionlimit(10**8)
# resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
read = lambda: sys.stdin.readline().rstrip("\n")
tint = lambda x: [int(x) for x in x.split()]
inf = float("inf")
def main():
n = tint(read())[0]
stones = tint(read())
dp = [inf] * n
dp[0] = 0
for i... | false | 47.826087 | [
"-import sys",
"+import sys, os",
"-sample = sys.stdin.read().splitlines()",
"-n, stones = int(sample[0]), list(map(int, sample[1].split()))",
"-dp = [float(\"inf\")] * n",
"-jumps = (1, 2)",
"-dp[0] = 0",
"-for idx in range(len(dp)):",
"- for jump in jumps:",
"- if idx + jump < len(dp):... | false | 0.042232 | 0.042283 | 0.998804 | [
"s812948683",
"s471920431"
] |
u761320129 | p03161 | python | s610459623 | s589101024 | 415 | 358 | 55,008 | 52,448 | Accepted | Accepted | 13.73 | N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
INF = float('inf')
dp = [INF] * N
dp[0] = 0
for i in range(1,N):
for j in range(K):
if i-j-1 < 0: break
dp[i] = min(dp[i], dp[i-j-1] + abs(H[i] - H[i-j-1]))
print((dp[-1])) | N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
dp = [10**18]*N
dp[0] = 0
for i in range(1,N):
for j in range(max(0,i-K),i):
dp[i] = min(dp[i], dp[j] + abs(H[i]-H[j]))
print((dp[-1])) | 11 | 8 | 267 | 218 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = float("inf")
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
for j in range(K):
if i - j - 1 < 0:
break
dp[i] = min(dp[i], dp[i - j - 1] + abs(H[i] - H[i - j - 1]))
print((dp[-1]))
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [10**18] * N
dp[0] = 0
for i in range(1, N):
for j in range(max(0, i - K), i):
dp[i] = min(dp[i], dp[j] + abs(H[i] - H[j]))
print((dp[-1]))
| false | 27.272727 | [
"-INF = float(\"inf\")",
"-dp = [INF] * N",
"+dp = [10**18] * N",
"- for j in range(K):",
"- if i - j - 1 < 0:",
"- break",
"- dp[i] = min(dp[i], dp[i - j - 1] + abs(H[i] - H[i - j - 1]))",
"+ for j in range(max(0, i - K), i):",
"+ dp[i] = min(dp[i], dp[j] + abs... | false | 0.102869 | 0.043344 | 2.373342 | [
"s610459623",
"s589101024"
] |
u585482323 | p03252 | python | s202576334 | s709305216 | 263 | 225 | 72,380 | 42,548 | Accepted | Accepted | 14.45 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 86 | 50 | 1,594 | 1,146 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 41.860465 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"- return list(map(list, sys.stdin.readline().split()))",
... | false | 0.046821 | 0.04658 | 1.005182 | [
"s202576334",
"s709305216"
] |
u651235280 | p03087 | python | s031920461 | s119194340 | 225 | 164 | 29,872 | 90,396 | Accepted | Accepted | 27.11 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
cnt = [0] * (n)
for i in range(0, n - 1):
if s[i] == 'A' and s[i + 1] == 'C':
cnt[i + 1] = cnt[i] + 1
else:
... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
cnt = [0] * (n)
for i in range(0, n - 1):
if s[i:i+2] == 'AC':
cnt[i + 1] = cnt[i] + 1
else:
cnt[i + ... | 19 | 19 | 433 | 418 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
cnt = [0] * (n)
for i in range(0, n - 1):
if s[i] == "A" and s[i + 1] == "C":
cnt[i + 1] = cnt[i] + 1
else:
cnt[i ... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
cnt = [0] * (n)
for i in range(0, n - 1):
if s[i : i + 2] == "AC":
cnt[i + 1] = cnt[i] + 1
else:
cnt[i + 1] = cnt[... | false | 0 | [
"- if s[i] == \"A\" and s[i + 1] == \"C\":",
"+ if s[i : i + 2] == \"AC\":"
] | false | 0.043732 | 0.043113 | 1.014351 | [
"s031920461",
"s119194340"
] |
u380524497 | p03426 | python | s115844920 | s866568286 | 1,227 | 1,134 | 61,052 | 27,100 | Accepted | Accepted | 7.58 | H, W, D = list(map(int, input().split()))
dic = {}
K = H*W//D
memo = [[0]* (K+1) for _ in range(D+1)]
for y in range(1, H+1):
A = list(map(int, input().split()))
for x, a in enumerate(A, 1):
dic[a] = [x, y]
for extra in range(H*W+1, H*W+2*D):
dic[extra] = [0, 0]
for i in range(1, D... | h, w, d = list(map(int, input().split()))
A = []
for _ in range(h):
line = list(map(int, input().split()))
A.append(line)
num_to_xy = [[0, 0] for i in range(h*w + 1)]
for y in range(h):
for x in range(w):
num = A[y][x]
num_to_xy[num] = [x, y]
costs = [[] for i in range(d+1)... | 32 | 38 | 716 | 820 | H, W, D = list(map(int, input().split()))
dic = {}
K = H * W // D
memo = [[0] * (K + 1) for _ in range(D + 1)]
for y in range(1, H + 1):
A = list(map(int, input().split()))
for x, a in enumerate(A, 1):
dic[a] = [x, y]
for extra in range(H * W + 1, H * W + 2 * D):
dic[extra] = [0, 0]
for i in range(1... | h, w, d = list(map(int, input().split()))
A = []
for _ in range(h):
line = list(map(int, input().split()))
A.append(line)
num_to_xy = [[0, 0] for i in range(h * w + 1)]
for y in range(h):
for x in range(w):
num = A[y][x]
num_to_xy[num] = [x, y]
costs = [[] for i in range(d + 1)]
for mod in r... | false | 15.789474 | [
"-H, W, D = list(map(int, input().split()))",
"-dic = {}",
"-K = H * W // D",
"-memo = [[0] * (K + 1) for _ in range(D + 1)]",
"-for y in range(1, H + 1):",
"- A = list(map(int, input().split()))",
"- for x, a in enumerate(A, 1):",
"- dic[a] = [x, y]",
"-for extra in range(H * W + 1, H ... | false | 0.039327 | 0.046538 | 0.845056 | [
"s115844920",
"s866568286"
] |
u022979415 | p03062 | python | s997798072 | s937003090 | 81 | 62 | 14,412 | 14,412 | Accepted | Accepted | 23.46 | def main():
N = int(eval(input()))
A = list(map(int, input().split(" ")))
negative = 0
result = 0
abs_minimum = 10**9
for a in A:
abs_minimum = min(abs_minimum, abs(a))
if a < 0:
negative += 1
if negative % 2 == 0:
for a in A:
resul... | def main():
n = int(eval(input()))
a = [int(x) for x in input().split()]
count_negative = 0
for i in range(n):
if a[i] < 0:
count_negative += 1
a = [abs(x) for x in a]
answer = sum(a)
if count_negative % 2:
answer -= 2 * min(a)
print(answer)
if... | 24 | 17 | 550 | 353 | def main():
N = int(eval(input()))
A = list(map(int, input().split(" ")))
negative = 0
result = 0
abs_minimum = 10**9
for a in A:
abs_minimum = min(abs_minimum, abs(a))
if a < 0:
negative += 1
if negative % 2 == 0:
for a in A:
result += abs(a)
... | def main():
n = int(eval(input()))
a = [int(x) for x in input().split()]
count_negative = 0
for i in range(n):
if a[i] < 0:
count_negative += 1
a = [abs(x) for x in a]
answer = sum(a)
if count_negative % 2:
answer -= 2 * min(a)
print(answer)
if __name__ == "... | false | 29.166667 | [
"- N = int(eval(input()))",
"- A = list(map(int, input().split(\" \")))",
"- negative = 0",
"- result = 0",
"- abs_minimum = 10**9",
"- for a in A:",
"- abs_minimum = min(abs_minimum, abs(a))",
"- if a < 0:",
"- negative += 1",
"- if negative % 2 == 0:... | false | 0.070685 | 0.037374 | 1.891278 | [
"s997798072",
"s937003090"
] |
u022407960 | p02343 | python | s710171945 | s145090983 | 480 | 430 | 16,624 | 16,628 | Accepted | Accepted | 10.42 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 12
0 1 4
0 2 3
1 1 2
1 3 4
1 1 4
1 3 2
0 1 3
1 2 4
1 3 0
0 0 4
1 0 2
1 3 0
output:
0
0
1
1
1
0
1
1
"""
import sys
class UnionFind(object):
__slots__ = ('size', 'rank', 'p_list')
def __init__(self, size):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 12
0 1 4
0 2 3
1 1 2
1 3 4
1 1 4
1 3 2
0 1 3
1 2 4
1 3 0
0 0 4
1 0 2
1 3 0
output:
0
0
1
1
1
0
1
1
"""
import sys
class UnionFind(object):
__slots__ = ('size', 'rank', 'p_list')
def __init__(self, size):
... | 85 | 85 | 1,550 | 1,532 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 12
0 1 4
0 2 3
1 1 2
1 3 4
1 1 4
1 3 2
0 1 3
1 2 4
1 3 0
0 0 4
1 0 2
1 3 0
output:
0
0
1
1
1
0
1
1
"""
import sys
class UnionFind(object):
__slots__ = ("size", "rank", "p_list")
def __init__(self, size):
self.size = int(size)
self.ran... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 12
0 1 4
0 2 3
1 1 2
1 3 4
1 1 4
1 3 2
0 1 3
1 2 4
1 3 0
0 0 4
1 0 2
1 3 0
output:
0
0
1
1
1
0
1
1
"""
import sys
class UnionFind(object):
__slots__ = ("size", "rank", "p_list")
def __init__(self, size):
self.size = int(size)
self.ran... | false | 0 | [
"- def find_set(self, x):",
"+ def _find(self, x):",
"- self.p_list[x] = self.find_set(self.p_list[x])",
"+ self.p_list[x] = self._find(self.p_list[x])",
"- return self.find_set(x) == self.find_set(y)",
"+ return self._find(x) == self._find(y)",
"- def unite(... | false | 0.063029 | 0.045779 | 1.376813 | [
"s710171945",
"s145090983"
] |
u066413086 | p02685 | python | s515593805 | s144288762 | 732 | 671 | 32,588 | 32,836 | Accepted | Accepted | 8.33 | mod = 998244353 #出力の制限
N = 2 * (10**5)
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
g2.append( (g2[-1] * inverse[-1]) % mod )
def nCr(n, r, mod):
... |
class ModCombination():
def __init__(self, n, mod=998244353):
self.mod = mod
self.N = n
fact = [1, 1] # 元テーブル
ifact = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, n + 1 ):
fact.append( ( fact[-1] * i ) % mod )
... | 44 | 51 | 1,157 | 1,492 | mod = 998244353 # 出力の制限
N = 2 * (10**5)
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-inverse[mod % i] * (mod // i)) % mod)
g2.append((g2[-1] * inverse[-1]) % mod)
def nCr(n, r, mod):
if r < 0 or r... | class ModCombination:
def __init__(self, n, mod=998244353):
self.mod = mod
self.N = n
fact = [1, 1] # 元テーブル
ifact = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, n + 1):
fact.append((fact[-1] * i) % mod)
inverse.append((... | false | 13.72549 | [
"-mod = 998244353 # 出力の制限",
"-N = 2 * (10**5)",
"-g1 = [1, 1] # 元テーブル",
"-g2 = [1, 1] # 逆元テーブル",
"-inverse = [0, 1] # 逆元テーブル計算用テーブル",
"-for i in range(2, N + 1):",
"- g1.append((g1[-1] * i) % mod)",
"- inverse.append((-inverse[mod % i] * (mod // i)) % mod)",
"- g2.append((g2[-1] * inver... | false | 0.748597 | 0.191342 | 3.912358 | [
"s515593805",
"s144288762"
] |
u391725895 | p02615 | python | s604359284 | s316984338 | 148 | 132 | 33,240 | 105,316 | Accepted | Accepted | 10.81 | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
a = deque(A)
arrival = 1
ans = 0
while arrival < N:
score = a.popleft()
if arrival == 1:
ans += score
arrival += 1
else:
ans += score*min(2, N - arriva... | N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
arrival = 1
ans = 0
while arrival < N:
score = a.pop()
if arrival == 1:
ans += score
arrival += 1
else:
ans += score*min(2, N - arrival)
arrival += 2
print(ans) | 22 | 18 | 352 | 287 | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
a = deque(A)
arrival = 1
ans = 0
while arrival < N:
score = a.popleft()
if arrival == 1:
ans += score
arrival += 1
else:
ans += score * min(2, N - arrival)
arrival +... | N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
arrival = 1
ans = 0
while arrival < N:
score = a.pop()
if arrival == 1:
ans += score
arrival += 1
else:
ans += score * min(2, N - arrival)
arrival += 2
print(ans)
| false | 18.181818 | [
"-from collections import deque",
"-",
"-A = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"-a = deque(A)",
"+a = list(map(int, input().split()))",
"+a.sort()",
"- score = a.popleft()",
"+ score = a.pop()"
] | false | 0.042352 | 0.142428 | 0.297359 | [
"s604359284",
"s316984338"
] |
u962330718 | p03399 | python | s911952833 | s079383298 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A=[int(eval(input())) for i in range(4)]
print((min(A[0]+A[2],A[0]+A[3],A[1]+A[2],A[1]+A[3]))) | a,b,c,d=[int(eval(input())) for i in range(4)]
print((min(a,b)+min(c,d))) | 2 | 2 | 87 | 66 | A = [int(eval(input())) for i in range(4)]
print((min(A[0] + A[2], A[0] + A[3], A[1] + A[2], A[1] + A[3])))
| a, b, c, d = [int(eval(input())) for i in range(4)]
print((min(a, b) + min(c, d)))
| false | 0 | [
"-A = [int(eval(input())) for i in range(4)]",
"-print((min(A[0] + A[2], A[0] + A[3], A[1] + A[2], A[1] + A[3])))",
"+a, b, c, d = [int(eval(input())) for i in range(4)]",
"+print((min(a, b) + min(c, d)))"
] | false | 0.049248 | 0.048328 | 1.019041 | [
"s911952833",
"s079383298"
] |
u935558307 | p03483 | python | s066834394 | s377929177 | 219 | 191 | 96,184 | 88,408 | Accepted | Accepted | 12.79 | from collections import Counter
class BIT:
def __init__(self,n):
self.tree = [0]*(n+1)
self.size = n
def sum(self,i):
s = 0
while i > 0:
s += self.tree[i]
i -= i&-i
return s
def add(self,i,x):
while i <= self.size:... | """
まず、奇数個存在する文字種が複数ある場合は、回文にできない。
それ以外の場合は、回文にできる。
次に、操作の最小回数は、回文になった場合の各文字のインデックスを求めておき、BITを使って、入れ替えが必要な回数を求めて置く
"""
from collections import Counter
S = eval(input())
N = len(S)
#各文字の出現回数をカウント
apperance = Counter(S)
#回文を作成できるか判定
flag = False
for k,v in list(apperance.items()):
if v%2==1:
i... | 64 | 79 | 1,243 | 1,569 | from collections import Counter
class BIT:
def __init__(self, n):
self.tree = [0] * (n + 1)
self.size = n
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
... | """
まず、奇数個存在する文字種が複数ある場合は、回文にできない。
それ以外の場合は、回文にできる。
次に、操作の最小回数は、回文になった場合の各文字のインデックスを求めておき、BITを使って、入れ替えが必要な回数を求めて置く
"""
from collections import Counter
S = eval(input())
N = len(S)
# 各文字の出現回数をカウント
apperance = Counter(S)
# 回文を作成できるか判定
flag = False
for k, v in list(apperance.items()):
if v % 2 == 1:
if flag:
... | false | 18.987342 | [
"+\"\"\"",
"+まず、奇数個存在する文字種が複数ある場合は、回文にできない。",
"+それ以外の場合は、回文にできる。",
"+次に、操作の最小回数は、回文になった場合の各文字のインデックスを求めておき、BITを使って、入れ替えが必要な回数を求めて置く",
"+\"\"\"",
"+",
"+S = eval(input())",
"+N = len(S)",
"+# 各文字の出現回数をカウント",
"+apperance = Counter(S)",
"+# 回文を作成できるか判定",
"+flag = False",
"+for k, v in list(appe... | false | 0.043913 | 0.077579 | 0.566038 | [
"s066834394",
"s377929177"
] |
u348805958 | p02762 | python | s052115752 | s367085745 | 990 | 658 | 10,992 | 10,972 | Accepted | Accepted | 33.54 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
from bisect import bisect
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ... | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ai -... | 57 | 56 | 1,111 | 1,107 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
from bisect import bisect
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ai - aj
if... | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ai - aj
if ... | false | 1.754386 | [
"-iim = lambda: list(map(int, input().rstrip().split()))",
"-from bisect import bisect",
"+import sys",
"+",
"+iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))"
] | false | 0.174966 | 0.113588 | 1.540366 | [
"s052115752",
"s367085745"
] |
u726823037 | p02631 | python | s662566232 | s475494385 | 215 | 177 | 31,400 | 31,444 | Accepted | Accepted | 17.67 | n = int(input())
a = list(map(int,input().split()))
b = [0]*(n-1)
ans = a[0]
for i in range(1,n):
b[i-1] = a[0]^a[i]
ans ^= b[i-1]
print(ans,end=' ')
for i in range(1,n):
print(ans^b[i-1],end=' ')
| import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))
n = Ii()
a = Li()
b = 0
for i in range(n):
b ^= a[i]
ans = []
for i in range(n):
print(b^a[i],end=' ')
| 10 | 13 | 211 | 287 | n = int(input())
a = list(map(int, input().split()))
b = [0] * (n - 1)
ans = a[0]
for i in range(1, n):
b[i - 1] = a[0] ^ a[i]
ans ^= b[i - 1]
print(ans, end=" ")
for i in range(1, n):
print(ans ^ b[i - 1], end=" ")
| import sys
def Ii():
return int(sys.stdin.readline())
def Mi():
return map(int, sys.stdin.readline().split())
def Li():
return list(map(int, sys.stdin.readline().split()))
n = Ii()
a = Li()
b = 0
for i in range(n):
b ^= a[i]
ans = []
for i in range(n):
print(b ^ a[i], end=" ")
| false | 23.076923 | [
"-n = int(input())",
"-a = list(map(int, input().split()))",
"-b = [0] * (n - 1)",
"-ans = a[0]",
"-for i in range(1, n):",
"- b[i - 1] = a[0] ^ a[i]",
"- ans ^= b[i - 1]",
"-print(ans, end=\" \")",
"-for i in range(1, n):",
"- print(ans ^ b[i - 1], end=\" \")",
"+import sys",
"+",
... | false | 0.047784 | 0.135367 | 0.352999 | [
"s662566232",
"s475494385"
] |
u054514819 | p02696 | python | s914939690 | s900160597 | 420 | 27 | 72,840 | 9,176 | Accepted | Accepted | 93.57 | A, B, N = list(map(int, input().split()))
from fractions import gcd
ans = 0
x = min(B-1, N)
p = int((A*x)/B) - A*int(x/B)
ans = p
print(ans) | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
A, B, N = mapint()
x = min(B-1, N)
print((int(A*x/B)-A*int(x/B))) | 11 | 8 | 148 | 207 | A, B, N = list(map(int, input().split()))
from fractions import gcd
ans = 0
x = min(B - 1, N)
p = int((A * x) / B) - A * int(x / B)
ans = p
print(ans)
| import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
A, B, N = mapint()
x = min(B - 1, N)
print((int(A * x / B) - A * int(x / B)))
| false | 27.272727 | [
"-A, B, N = list(map(int, input().split()))",
"-from fractions import gcd",
"+import sys",
"-ans = 0",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"... | false | 0.075318 | 0.035823 | 2.10249 | [
"s914939690",
"s900160597"
] |
u846226907 | p03293 | python | s793059275 | s992626704 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
t = eval(input())
ss = s+s+s
f = 0
for i in range(len(s)):
# print(s[i:len(s)+i])
if ss[i:len(s)+i] == t:
f = 1
if f:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
ss = s+s
f = 0
for i in range(len(s)):
# print(s[i:len(s)+i])
if ss[i:len(s)+i] == t:
f = 1
if f:
print("Yes")
else:
print("No")
| 16 | 16 | 197 | 195 | s = eval(input())
t = eval(input())
ss = s + s + s
f = 0
for i in range(len(s)):
# print(s[i:len(s)+i])
if ss[i : len(s) + i] == t:
f = 1
if f:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
ss = s + s
f = 0
for i in range(len(s)):
# print(s[i:len(s)+i])
if ss[i : len(s) + i] == t:
f = 1
if f:
print("Yes")
else:
print("No")
| false | 0 | [
"-ss = s + s + s",
"+ss = s + s"
] | false | 0.046978 | 0.046357 | 1.01338 | [
"s793059275",
"s992626704"
] |
u477320129 | p02886 | python | s220723236 | s326018908 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | from itertools import accumulate
_ = int(eval(input()))
d = tuple(map(int, input().split()))
a = tuple(reversed(tuple(accumulate(reversed(d)))))
print((sum(dd * aa for dd, aa in zip(d, a[1:])))) | from itertools import accumulate
_ = int(eval(input()))
d = tuple(map(int, input().split()))
a = tuple(accumulate(reversed(d)))[::-1]
print((sum(dd * aa for dd, aa in zip(d, a[1:])))) | 6 | 6 | 192 | 181 | from itertools import accumulate
_ = int(eval(input()))
d = tuple(map(int, input().split()))
a = tuple(reversed(tuple(accumulate(reversed(d)))))
print((sum(dd * aa for dd, aa in zip(d, a[1:]))))
| from itertools import accumulate
_ = int(eval(input()))
d = tuple(map(int, input().split()))
a = tuple(accumulate(reversed(d)))[::-1]
print((sum(dd * aa for dd, aa in zip(d, a[1:]))))
| false | 0 | [
"-a = tuple(reversed(tuple(accumulate(reversed(d)))))",
"+a = tuple(accumulate(reversed(d)))[::-1]"
] | false | 0.048807 | 0.008918 | 5.473008 | [
"s220723236",
"s326018908"
] |
u310381103 | p03448 | python | s077868343 | s207071703 | 208 | 49 | 41,324 | 9,116 | Accepted | Accepted | 76.44 | A=eval(input())
B=eval(input())
C=eval(input())
X=eval(input())
sum=0
for a in range(int(A)+1):
for b in range(int(B)+1):
for c in range(int(C)+1):
if 500*a+100*b+50*c==int(X):
sum+=1
print(sum) | a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
x=int(eval(input()))
ans=0
for ai in range(a+1):
for bi in range(b+1):
for ci in range(c+1):
y=500*ai+100*bi+50*ci
if x == y:
ans+=1
if y>x:
break
print(ans) | 11 | 14 | 220 | 249 | A = eval(input())
B = eval(input())
C = eval(input())
X = eval(input())
sum = 0
for a in range(int(A) + 1):
for b in range(int(B) + 1):
for c in range(int(C) + 1):
if 500 * a + 100 * b + 50 * c == int(X):
sum += 1
print(sum)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for ai in range(a + 1):
for bi in range(b + 1):
for ci in range(c + 1):
y = 500 * ai + 100 * bi + 50 * ci
if x == y:
ans += 1
if y > x:
brea... | false | 21.428571 | [
"-A = eval(input())",
"-B = eval(input())",
"-C = eval(input())",
"-X = eval(input())",
"-sum = 0",
"-for a in range(int(A) + 1):",
"- for b in range(int(B) + 1):",
"- for c in range(int(C) + 1):",
"- if 500 * a + 100 * b + 50 * c == int(X):",
"- sum += 1",
"-... | false | 0.195934 | 0.035043 | 5.591303 | [
"s077868343",
"s207071703"
] |
u798803522 | p02362 | python | s655311089 | s494944474 | 750 | 340 | 8,748 | 8,636 | Accepted | Accepted | 54.67 | from collections import defaultdict
import heapq
vertice,edge,source = list(map(int,input().split(" ")))
link = defaultdict(dict)
weight = defaultdict(dict)
cost = [float("inf") for n in range(vertice)]
cost[source] = 0
for e in range(edge):
i,j,w = list(map(int,input().split(" ")))
link[i] = link.ge... | from collections import defaultdict
v_num, e_num, source = (int(n) for n in input().split(" "))
conn = []
cost = [float("inf") for n in range(v_num)]
cost[source] = 0
for _ in range(e_num):
s1, t1, weight = (int(n) for n in input().split(" "))
conn.append([s1, t1, weight])
def bellman_ford(source, con... | 29 | 24 | 807 | 757 | from collections import defaultdict
import heapq
vertice, edge, source = list(map(int, input().split(" ")))
link = defaultdict(dict)
weight = defaultdict(dict)
cost = [float("inf") for n in range(vertice)]
cost[source] = 0
for e in range(edge):
i, j, w = list(map(int, input().split(" ")))
link[i] = link.get(i,... | from collections import defaultdict
v_num, e_num, source = (int(n) for n in input().split(" "))
conn = []
cost = [float("inf") for n in range(v_num)]
cost[source] = 0
for _ in range(e_num):
s1, t1, weight = (int(n) for n in input().split(" "))
conn.append([s1, t1, weight])
def bellman_ford(source, conn, v_nu... | false | 17.241379 | [
"-import heapq",
"-vertice, edge, source = list(map(int, input().split(\" \")))",
"-link = defaultdict(dict)",
"-weight = defaultdict(dict)",
"-cost = [float(\"inf\") for n in range(vertice)]",
"+v_num, e_num, source = (int(n) for n in input().split(\" \"))",
"+conn = []",
"+cost = [float(\"inf\") for... | false | 0.043104 | 0.045737 | 0.942437 | [
"s655311089",
"s494944474"
] |
u411203878 | p02861 | python | s122870372 | s131321447 | 114 | 103 | 75,128 | 74,568 | Accepted | Accepted | 9.65 | import itertools
n=int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
narabi = [0+i for i in range(n)]
ans = 0
count = 0
for v in itertools.permutations(narabi, n):
count += 1
tmp_len = 0
for i in range(1,n):
x, y = abs... | import itertools
n=int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
memo = []
for i in range(n):
memo.append(i)
ans = 0
count = 0
for v in itertools.permutations(memo, n):
count += 1
tmp_root = 0
for i in range(1, n):
... | 21 | 22 | 452 | 442 | import itertools
n = int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
narabi = [0 + i for i in range(n)]
ans = 0
count = 0
for v in itertools.permutations(narabi, n):
count += 1
tmp_len = 0
for i in range(1, n):
x, y = (
ab... | import itertools
n = int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
memo = []
for i in range(n):
memo.append(i)
ans = 0
count = 0
for v in itertools.permutations(memo, n):
count += 1
tmp_root = 0
for i in range(1, n):
tmp_root +=... | false | 4.545455 | [
"-narabi = [0 + i for i in range(n)]",
"+memo = []",
"+for i in range(n):",
"+ memo.append(i)",
"-for v in itertools.permutations(narabi, n):",
"+for v in itertools.permutations(memo, n):",
"- tmp_len = 0",
"+ tmp_root = 0",
"- x, y = (",
"- abs(ab[v[i - 1]][0] - ab[v[i]... | false | 0.037472 | 0.037851 | 0.989987 | [
"s122870372",
"s131321447"
] |
u696499790 | p03160 | python | s142014262 | s768852921 | 139 | 103 | 13,980 | 20,280 | Accepted | Accepted | 25.9 | N=int(eval(input()))
h=list(map(int,input().split()))
DP=[0]*N
DP[0]=0
DP[1]=abs(h[1]-h[0])+DP[0]
i=2
while i<N:
DP[i]=min(abs(h[i]-h[i-1])+DP[i-1],abs(h[i]-h[i-2])+DP[i-2])
i+=1
print((DP[-1])) | def main():
N=int(eval(input()))
h=list(map(int,input().split()))
DP=[0]*N
DP[1]=abs(h[1]-h[0])
for i in range(2,N):
# from 2step before
pre_2=DP[i-2] + abs(h[i]-h[i-2])
pre_1=DP[i-1] + abs(h[i]-h[i-1])
DP[i]=min(pre_1,pre_2)
pass
print((DP[-1]))
if __name__ == '__main__':
... | 10 | 16 | 199 | 324 | N = int(eval(input()))
h = list(map(int, input().split()))
DP = [0] * N
DP[0] = 0
DP[1] = abs(h[1] - h[0]) + DP[0]
i = 2
while i < N:
DP[i] = min(abs(h[i] - h[i - 1]) + DP[i - 1], abs(h[i] - h[i - 2]) + DP[i - 2])
i += 1
print((DP[-1]))
| def main():
N = int(eval(input()))
h = list(map(int, input().split()))
DP = [0] * N
DP[1] = abs(h[1] - h[0])
for i in range(2, N):
# from 2step before
pre_2 = DP[i - 2] + abs(h[i] - h[i - 2])
pre_1 = DP[i - 1] + abs(h[i] - h[i - 1])
DP[i] = min(pre_1, pre_2)
p... | false | 37.5 | [
"-N = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-DP = [0] * N",
"-DP[0] = 0",
"-DP[1] = abs(h[1] - h[0]) + DP[0]",
"-i = 2",
"-while i < N:",
"- DP[i] = min(abs(h[i] - h[i - 1]) + DP[i - 1], abs(h[i] - h[i - 2]) + DP[i - 2])",
"- i += 1",
"-print((DP[-1]))",
"+def main(... | false | 0.057912 | 0.057812 | 1.001721 | [
"s142014262",
"s768852921"
] |
u841793789 | p02958 | python | s701127577 | s002928541 | 300 | 17 | 21,640 | 3,060 | Accepted | Accepted | 94.33 | import numpy as np
N = int(eval(input()))
p= list(map(int, input().split()))
cnt = 0
org=np.arange(1,N+1,1)
for n in range(N):
if org[n] != p[n]:
cnt += 1
print(('NO' if cnt>2 else 'YES')) | N = int(eval(input()))
p= list(map(int, input().split()))
cnt = 0
org=list(range(1,N+1))
for n in range(N):
if org[n] != p[n]:
cnt += 1
print(('NO' if cnt>2 else 'YES')) | 9 | 8 | 200 | 180 | import numpy as np
N = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
org = np.arange(1, N + 1, 1)
for n in range(N):
if org[n] != p[n]:
cnt += 1
print(("NO" if cnt > 2 else "YES"))
| N = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
org = list(range(1, N + 1))
for n in range(N):
if org[n] != p[n]:
cnt += 1
print(("NO" if cnt > 2 else "YES"))
| false | 11.111111 | [
"-import numpy as np",
"-",
"-org = np.arange(1, N + 1, 1)",
"+org = list(range(1, N + 1))"
] | false | 1.08718 | 0.035754 | 30.407476 | [
"s701127577",
"s002928541"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.