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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u896451538 | p02766 | python | s182568361 | s423648363 | 39 | 17 | 5,328 | 2,940 | Accepted | Accepted | 56.41 | import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy
sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlin... |
n,k = list(map(int,input().split()))
ans=0
while n>0:
n=n//k
ans+=1
print(ans) | 28 | 8 | 688 | 95 | import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy
sys.setrecursionlimit(10**9)
mod = 10**7 + 9
inf = 10**20
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI():
return [list(map(int, l.split())) for l in sys.stdin.readline... | n, k = list(map(int, input().split()))
ans = 0
while n > 0:
n = n // k
ans += 1
print(ans)
| false | 71.428571 | [
"-import math",
"-import itertools",
"-import fractions",
"-import heapq",
"-import collections",
"-import bisect",
"-import sys",
"-import copy",
"-",
"-sys.setrecursionlimit(10**9)",
"-mod = 10**7 + 9",
"-inf = 10**20",
"-",
"-",
"-def LI():",
"- return list(map(int, sys.stdin.rea... | false | 0.03707 | 0.035428 | 1.046348 | [
"s182568361",
"s423648363"
] |
u691896522 | p03805 | python | s474592196 | s595399644 | 784 | 209 | 56,408 | 41,948 | Accepted | Accepted | 73.34 | import copy
n, m = list(map(int, input().split()))
adjacent_list = [[] for i in range(n+1)]
for i in range(m):
a, b = list(map(int, input().split()))
adjacent_list[a].append(b)
adjacent_list[b].append(a)
ans = 0
def dfs(node,f):
f.add(node)
global ans
if len(f) == n:
ans += 1... | n, m = list(map(int, input().split()))
adjacent_list = [[] for i in range(n+1)]
for i in range(m):
a, b = list(map(int, input().split()))
adjacent_list[a].append(b)
adjacent_list[b].append(a)
ans = 0
def dfs(node,f):
global ans
if len(f) == n:
ans += 1
else:
for i in ... | 20 | 18 | 476 | 445 | import copy
n, m = list(map(int, input().split()))
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
adjacent_list[a].append(b)
adjacent_list[b].append(a)
ans = 0
def dfs(node, f):
f.add(node)
global ans
if len(f) == n:
ans += 1
e... | n, m = list(map(int, input().split()))
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
adjacent_list[a].append(b)
adjacent_list[b].append(a)
ans = 0
def dfs(node, f):
global ans
if len(f) == n:
ans += 1
else:
for i in adjacen... | false | 10 | [
"-import copy",
"-",
"- f.add(node)",
"- k = copy.deepcopy(f)",
"+ k = f | set([i])",
"-dfs(1, set())",
"+dfs(1, set([1]))"
] | false | 0.035602 | 0.04386 | 0.811719 | [
"s474592196",
"s595399644"
] |
u608007704 | p02597 | python | s920292474 | s686319073 | 70 | 30 | 9,460 | 9,300 | Accepted | Accepted | 57.14 | N=int(eval(input()))
c=eval(input())
rCount=0
for i in range(N):
if c[i]=='R':
rCount+=1
wCount=0
for i in range(rCount):
if c[i]=='W':
wCount+=1
print(wCount)
| N=int(eval(input()))
c=eval(input())
rCount=c.count('R')
wCount=c[0:rCount].count('W')
print(wCount) | 14 | 6 | 179 | 94 | N = int(eval(input()))
c = eval(input())
rCount = 0
for i in range(N):
if c[i] == "R":
rCount += 1
wCount = 0
for i in range(rCount):
if c[i] == "W":
wCount += 1
print(wCount)
| N = int(eval(input()))
c = eval(input())
rCount = c.count("R")
wCount = c[0:rCount].count("W")
print(wCount)
| false | 57.142857 | [
"-rCount = 0",
"-for i in range(N):",
"- if c[i] == \"R\":",
"- rCount += 1",
"-wCount = 0",
"-for i in range(rCount):",
"- if c[i] == \"W\":",
"- wCount += 1",
"+rCount = c.count(\"R\")",
"+wCount = c[0:rCount].count(\"W\")"
] | false | 0.035981 | 0.036504 | 0.985676 | [
"s920292474",
"s686319073"
] |
u524534026 | p03805 | python | s543310324 | s104963808 | 288 | 133 | 8,052 | 81,824 | Accepted | Accepted | 53.82 | import sys
import itertools
n,m=list(map(int,input().split()))
ab=[]
for _ in range(m):
ab.append(list(map(int,input().split())))
lis=list(range(1,n+1))
per_lis =[i for i in list(itertools.permutations(lis)) if i[0]==1]
ans=0
for one_case in per_lis:
tmp=0
for j in range(n-1):
for ... | import sys
import math
import itertools
import statistics
n,m=list(map(int,input().split()))
side=[]
for _ in range(m):
side.append(tuple(map(int,input().split())))
per_lis =[i for i in list(itertools.permutations(list(range(1,n+1)))) if i[0]==1]
ans=0
for one_case in per_lis:
tmp=0
for i in ran... | 30 | 19 | 597 | 483 | import sys
import itertools
n, m = list(map(int, input().split()))
ab = []
for _ in range(m):
ab.append(list(map(int, input().split())))
lis = list(range(1, n + 1))
per_lis = [i for i in list(itertools.permutations(lis)) if i[0] == 1]
ans = 0
for one_case in per_lis:
tmp = 0
for j in range(n - 1):
... | import sys
import math
import itertools
import statistics
n, m = list(map(int, input().split()))
side = []
for _ in range(m):
side.append(tuple(map(int, input().split())))
per_lis = [i for i in list(itertools.permutations(list(range(1, n + 1)))) if i[0] == 1]
ans = 0
for one_case in per_lis:
tmp = 0
for i ... | false | 36.666667 | [
"+import math",
"+import statistics",
"-ab = []",
"+side = []",
"- ab.append(list(map(int, input().split())))",
"-lis = list(range(1, n + 1))",
"-per_lis = [i for i in list(itertools.permutations(lis)) if i[0] == 1]",
"+ side.append(tuple(map(int, input().split())))",
"+per_lis = [i for i in l... | false | 0.126873 | 0.062447 | 2.031705 | [
"s543310324",
"s104963808"
] |
u021019433 | p02630 | python | s043104802 | s559758478 | 579 | 485 | 22,132 | 17,824 | Accepted | Accepted | 16.23 | from collections import Counter
R = lambda: list(map(int, input().split()))
R()
d = Counter(R())
s = sum(d.elements())
q, = R()
for _ in range(q):
b, c = R()
s += (c - b) * d[b]
print(s)
d[c]+=d[b]
d[b] = 0
| R = lambda: list(map(int, input().split()))
R()
a = [0] * 100001
s = 0
for x in R():
s += x
a[x] += 1
q, = R()
for _ in range(q):
b, c = R()
s += (c - b) * a[b]
print(s)
a[c]+=a[b]
a[b] = 0
| 13 | 14 | 224 | 211 | from collections import Counter
R = lambda: list(map(int, input().split()))
R()
d = Counter(R())
s = sum(d.elements())
(q,) = R()
for _ in range(q):
b, c = R()
s += (c - b) * d[b]
print(s)
d[c] += d[b]
d[b] = 0
| R = lambda: list(map(int, input().split()))
R()
a = [0] * 100001
s = 0
for x in R():
s += x
a[x] += 1
(q,) = R()
for _ in range(q):
b, c = R()
s += (c - b) * a[b]
print(s)
a[c] += a[b]
a[b] = 0
| false | 7.142857 | [
"-from collections import Counter",
"-",
"-d = Counter(R())",
"-s = sum(d.elements())",
"+a = [0] * 100001",
"+s = 0",
"+for x in R():",
"+ s += x",
"+ a[x] += 1",
"- s += (c - b) * d[b]",
"+ s += (c - b) * a[b]",
"- d[c] += d[b]",
"- d[b] = 0",
"+ a[c] += a[b]",
"+ ... | false | 0.036875 | 0.10944 | 0.336941 | [
"s043104802",
"s559758478"
] |
u379136995 | p02612 | python | s091128386 | s014239897 | 35 | 27 | 9,108 | 9,044 | Accepted | Accepted | 22.86 | a=int(eval(input()))
if a%1000==0:
print((0))
else:
print((1000-a%1000)) | n=int(eval(input()))
n=n%1000
if n==0:
print((0))
else:
print((1000-n)) | 5 | 6 | 72 | 70 | a = int(eval(input()))
if a % 1000 == 0:
print((0))
else:
print((1000 - a % 1000))
| n = int(eval(input()))
n = n % 1000
if n == 0:
print((0))
else:
print((1000 - n))
| false | 16.666667 | [
"-a = int(eval(input()))",
"-if a % 1000 == 0:",
"+n = int(eval(input()))",
"+n = n % 1000",
"+if n == 0:",
"- print((1000 - a % 1000))",
"+ print((1000 - n))"
] | false | 0.046557 | 0.045961 | 1.012972 | [
"s091128386",
"s014239897"
] |
u729133443 | p02900 | python | s437781583 | s482673343 | 44 | 33 | 5,820 | 4,692 | Accepted | Accepted | 25 | import fractions as f,subprocess as s;print((len(set(s.Popen(('factor',str(f.gcd(*list(map(int,input().split()))))),stdout=s.PIPE).stdout.read().split())))) | from subprocess import*;a,b=[set(Popen(('factor',x),stdout=PIPE).stdout.read().split()[1:])for x in input().split()];print((len(a&b)+1)) | 1 | 1 | 148 | 134 | import fractions as f, subprocess as s
print(
(
len(
set(
s.Popen(
("factor", str(f.gcd(*list(map(int, input().split()))))),
stdout=s.PIPE,
)
.stdout.read()
.split()
)
)
... | from subprocess import *
a, b = [
set(Popen(("factor", x), stdout=PIPE).stdout.read().split()[1:])
for x in input().split()
]
print((len(a & b) + 1))
| false | 0 | [
"-import fractions as f, subprocess as s",
"+from subprocess import *",
"-print(",
"- (",
"- len(",
"- set(",
"- s.Popen(",
"- (\"factor\", str(f.gcd(*list(map(int, input().split()))))),",
"- stdout=s.PIPE,",
"- ... | false | 0.066977 | 0.056696 | 1.181336 | [
"s437781583",
"s482673343"
] |
u273010357 | p02844 | python | s430489309 | s013420538 | 1,048 | 829 | 3,572 | 3,828 | Accepted | Accepted | 20.9 | from collections import defaultdict
n = int(eval(input()))
S = eval(input())
d1 = defaultdict(int)
d2 = defaultdict(int)
d3 = defaultdict(int)
for s in S:
for x in d2:
d3[x+s]+=1
for y in d1:
d2[y+s]+=1
d1[s]+=1
print((len(d3))) | N = int(eval(input()))
S = list(eval(input()))
def ind(l, x, default=-1):
if x in l:
return l.index(x)
else:
return default
cnt = 0
for i in range(1000):
tmp = S
t = str(i).zfill(3)
pos_1 = ind(tmp,t[0])
if pos_1>=0:
tmp = tmp[pos_1+1:]
elif pos_1 ... | 16 | 33 | 260 | 592 | from collections import defaultdict
n = int(eval(input()))
S = eval(input())
d1 = defaultdict(int)
d2 = defaultdict(int)
d3 = defaultdict(int)
for s in S:
for x in d2:
d3[x + s] += 1
for y in d1:
d2[y + s] += 1
d1[s] += 1
print((len(d3)))
| N = int(eval(input()))
S = list(eval(input()))
def ind(l, x, default=-1):
if x in l:
return l.index(x)
else:
return default
cnt = 0
for i in range(1000):
tmp = S
t = str(i).zfill(3)
pos_1 = ind(tmp, t[0])
if pos_1 >= 0:
tmp = tmp[pos_1 + 1 :]
elif pos_1 == -1:
... | false | 51.515152 | [
"-from collections import defaultdict",
"+N = int(eval(input()))",
"+S = list(eval(input()))",
"-n = int(eval(input()))",
"-S = eval(input())",
"-d1 = defaultdict(int)",
"-d2 = defaultdict(int)",
"-d3 = defaultdict(int)",
"-for s in S:",
"- for x in d2:",
"- d3[x + s] += 1",
"- fo... | false | 0.034104 | 0.04186 | 0.814728 | [
"s430489309",
"s013420538"
] |
u263830634 | p03944 | python | s993233811 | s519161899 | 154 | 68 | 12,508 | 3,064 | Accepted | Accepted | 55.84 | import numpy as np
W, H, N = list(map(int, input().split()))
g = np.array([[1] * W for _ in range(H)])
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
g[:,:x] = 0
elif a == 2:
g[:,x:] = 0
elif a == 3:
g[H - y:,:] = 0
elif a == 4:
... | W, H, N = list(map(int, input().split()))
G = [[1] * H for _ in range(W)]
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
for x_ in range(x):
for y_ in range(H):
G[x_][y_] = 0
if a == 2:
for x_ in range(x, W):
... | 19 | 33 | 359 | 666 | import numpy as np
W, H, N = list(map(int, input().split()))
g = np.array([[1] * W for _ in range(H)])
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
g[:, :x] = 0
elif a == 2:
g[:, x:] = 0
elif a == 3:
g[H - y :, :] = 0
elif a == 4:
g[: H - y... | W, H, N = list(map(int, input().split()))
G = [[1] * H for _ in range(W)]
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
for x_ in range(x):
for y_ in range(H):
G[x_][y_] = 0
if a == 2:
for x_ in range(x, W):
for y_ in range(H)... | false | 42.424242 | [
"-import numpy as np",
"-",
"-g = np.array([[1] * W for _ in range(H)])",
"+G = [[1] * H for _ in range(W)]",
"- g[:, :x] = 0",
"- elif a == 2:",
"- g[:, x:] = 0",
"- elif a == 3:",
"- g[H - y :, :] = 0",
"- elif a == 4:",
"- g[: H - y, :] = 0",
"-print((g.... | false | 0.383502 | 0.038428 | 9.979788 | [
"s993233811",
"s519161899"
] |
u759412327 | p03485 | python | s312136018 | s859018544 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | import math
a,b = list(map(int,input().split()))
print((math.ceil((a+b)/2))) | from math import ceil
print((ceil((sum(list(map(int,input().split()))))/2))) | 3 | 2 | 76 | 75 | import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| from math import ceil
print((ceil((sum(list(map(int, input().split())))) / 2)))
| false | 33.333333 | [
"-import math",
"+from math import ceil",
"-a, b = list(map(int, input().split()))",
"-print((math.ceil((a + b) / 2)))",
"+print((ceil((sum(list(map(int, input().split())))) / 2)))"
] | false | 0.043046 | 0.046781 | 0.920166 | [
"s312136018",
"s859018544"
] |
u745087332 | p04021 | python | s024193249 | s767775331 | 225 | 113 | 14,872 | 14,612 | Accepted | Accepted | 49.78 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A)
C = A[::2] + B[1::2]
D = set(C)
print((N - len(D))) | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()... | 15 | 26 | 222 | 565 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A)
C = A[::2] + B[1::2]
D = set(C)
print((N - len(D)))
| # coding:utf-8
import sys
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline... | false | 42.307692 | [
"+import sys",
"+",
"+MOD = 10**9 + 7",
"-def inpl():",
"- return list(map(int, input().split()))",
"+def LI():",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"-N = int(eval(input()))",
"-A = [int(eval(input())) for _ in range(N)]",
"-B = sorted(A)",
"-C = A[::2] + B[1::2]",
... | false | 0.057832 | 0.037101 | 1.558788 | [
"s024193249",
"s767775331"
] |
u218834617 | p02573 | python | s465125690 | s634193000 | 538 | 324 | 111,248 | 107,416 | Accepted | Accepted | 39.78 | n,m=list(map(int,input().split()))
adj=[[] for _ in range(n)]
for _ in range(m):
a,b=list(map(int,input().split()))
a,b=a-1,b-1
adj[a].append(b)
adj[b].append(a)
ans=0
vis=[0]*n
for i in range(n):
if vis[i]:
continue
vis[i]=1
k=0
stk=[i]
while stk:
u... | import sys
n,m=list(map(int,next(sys.stdin).split()))
adj=[[] for _ in range(n)]
for _ in range(m):
a,b=list(map(int,next(sys.stdin).split()))
a,b=a-1,b-1
adj[a].append(b)
adj[b].append(a)
ans=0
vis=[0]*n
for i in range(n):
if vis[i]:
continue
vis[i]=1
k=0
stk=... | 27 | 29 | 492 | 522 | n, m = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
adj[a].append(b)
adj[b].append(a)
ans = 0
vis = [0] * n
for i in range(n):
if vis[i]:
continue
vis[i] = 1
k = 0
stk = [i]
while st... | import sys
n, m = list(map(int, next(sys.stdin).split()))
adj = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, next(sys.stdin).split()))
a, b = a - 1, b - 1
adj[a].append(b)
adj[b].append(a)
ans = 0
vis = [0] * n
for i in range(n):
if vis[i]:
continue
vis[i] = 1
k = ... | false | 6.896552 | [
"-n, m = list(map(int, input().split()))",
"+import sys",
"+",
"+n, m = list(map(int, next(sys.stdin).split()))",
"- a, b = list(map(int, input().split()))",
"+ a, b = list(map(int, next(sys.stdin).split()))"
] | false | 0.085095 | 0.040156 | 2.119118 | [
"s465125690",
"s634193000"
] |
u147544115 | p02948 | python | s005395106 | s372030178 | 489 | 443 | 26,020 | 26,072 | Accepted | Accepted | 9.41 | # -*- coding: utf-8 -*-
from heapq import heappush, heappop
n, m = list(map(int, input().split()))
# A日後、報酬B
workList = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in workList:
workList[a] = [-b]
else:
workList[a].append(-b)
# print(workList)
hq ... | # -*- coding: utf-8 -*-
from heapq import heappush, heappop
n, m = list(map(int, input().split()))
# A日後、報酬B
# 日付ごとに報酬をリスト化
workList = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in workList:
workList[a] = [b]
else:
workList[a].append(b)
hq = []
... | 30 | 31 | 558 | 583 | # -*- coding: utf-8 -*-
from heapq import heappush, heappop
n, m = list(map(int, input().split()))
# A日後、報酬B
workList = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in workList:
workList[a] = [-b]
else:
workList[a].append(-b)
# print(workList)
hq = []
sum = 0
for i ... | # -*- coding: utf-8 -*-
from heapq import heappush, heappop
n, m = list(map(int, input().split()))
# A日後、報酬B
# 日付ごとに報酬をリスト化
workList = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in workList:
workList[a] = [b]
else:
workList[a].append(b)
hq = []
sum = 0
for i in ra... | false | 3.225806 | [
"+# 日付ごとに報酬をリスト化",
"- workList[a] = [-b]",
"+ workList[a] = [b]",
"- workList[a].append(-b)",
"-# print(workList)",
"+ workList[a].append(b)",
"+ # 日付が短い順にheapに追加",
"+ # 最大値を取り出すため正負は逆に",
"- heappush(hq, w)",
"- val = None",
"+ heappush(... | false | 0.048237 | 0.043889 | 1.099065 | [
"s005395106",
"s372030178"
] |
u161164709 | p02585 | python | s108357099 | s871367251 | 2,616 | 1,422 | 884,604 | 296,124 | Accepted | Accepted | 45.64 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0]*n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.app... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
# mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0]*n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.a... | 41 | 43 | 1,135 | 1,206 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0] * n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.append(score... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
# mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0] * n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.append(sco... | false | 4.651163 | [
"-mv_array = [set() for _ in range(n)]",
"+# mv_array = [set() for _ in range(n)]",
"+ start_pos = p[pos] - 1",
"- if pos in mv_array[i]:",
"+ # if pos in mv_array[i]:",
"+ if j != 0 and pos == start_pos:",
"- mv_array[i].add(pos)",
"+ # mv_array[i].add(pos)"
] | false | 0.037925 | 0.086282 | 0.439549 | [
"s108357099",
"s871367251"
] |
u493520238 | p03044 | python | s096230736 | s342771673 | 377 | 241 | 95,588 | 95,172 | Accepted | Accepted | 36.07 | from collections import deque
def bfs(start, g, visited):
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
for next_node, w in g[curr_node]:
if visited[next_node] >= 0: continue
visited[next_node] = (visited[curr_node] + w)%2
... | import sys
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def dfs(start,n,g):
visited = [-1]*(n+1)
visited[start] = 0
stack = deque([start])
while stack:
c_node = stack.pop()
for neib, dist in g[c_node]:
if visited[neib] != ... | 25 | 33 | 624 | 713 | from collections import deque
def bfs(start, g, visited):
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
for next_node, w in g[curr_node]:
if visited[next_node] >= 0:
continue
visited[next_node] = (visited[curr_node] + w) % 2
... | import sys
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def dfs(start, n, g):
visited = [-1] * (n + 1)
visited[start] = 0
stack = deque([start])
while stack:
c_node = stack.pop()
for neib, dist in g[c_node]:
if visited[neib] != -1:
... | false | 24.242424 | [
"+import sys",
"-",
"-def bfs(start, g, visited):",
"- q = deque([start])",
"- visited[start] = 0",
"- while q:",
"- curr_node = q.popleft()",
"- for next_node, w in g[curr_node]:",
"- if visited[next_node] >= 0:",
"- continue",
"- visi... | false | 0.079186 | 0.045225 | 1.750941 | [
"s096230736",
"s342771673"
] |
u606045429 | p03716 | python | s973821392 | s811842344 | 339 | 283 | 40,164 | 36,308 | Accepted | Accepted | 16.52 | from heapq import heapify, heappop, heappush
N, *A = list(map(int, open(0).read().split()))
Q = A[:N]
heapify(Q)
R = [sum(Q)]
for a in A[N:2 * N]:
heappush(Q, a)
R.append(R[-1] + a - heappop(Q))
Q = [-a for a in A[2 * N:]]
heapify(Q)
B = [sum(Q)]
for a in reversed(A[N:2 * N]):
heappush... | from heapq import heapify, heappushpop
N, *A = list(map(int, open(0).read().split()))
Q = A[:N]
heapify(Q)
R = [sum(Q)]
for a in A[N:2 * N]:
R.append(R[-1] + a - heappushpop(Q, a))
Q = [-a for a in A[2 * N:]]
heapify(Q)
B = [sum(Q)]
for a in reversed(A[N:2 * N]):
B.append(B[-1] - a - heappu... | 21 | 19 | 413 | 381 | from heapq import heapify, heappop, heappush
N, *A = list(map(int, open(0).read().split()))
Q = A[:N]
heapify(Q)
R = [sum(Q)]
for a in A[N : 2 * N]:
heappush(Q, a)
R.append(R[-1] + a - heappop(Q))
Q = [-a for a in A[2 * N :]]
heapify(Q)
B = [sum(Q)]
for a in reversed(A[N : 2 * N]):
heappush(Q, -a)
B.ap... | from heapq import heapify, heappushpop
N, *A = list(map(int, open(0).read().split()))
Q = A[:N]
heapify(Q)
R = [sum(Q)]
for a in A[N : 2 * N]:
R.append(R[-1] + a - heappushpop(Q, a))
Q = [-a for a in A[2 * N :]]
heapify(Q)
B = [sum(Q)]
for a in reversed(A[N : 2 * N]):
B.append(B[-1] - a - heappushpop(Q, -a))
p... | false | 9.52381 | [
"-from heapq import heapify, heappop, heappush",
"+from heapq import heapify, heappushpop",
"- heappush(Q, a)",
"- R.append(R[-1] + a - heappop(Q))",
"+ R.append(R[-1] + a - heappushpop(Q, a))",
"- heappush(Q, -a)",
"- B.append(B[-1] - a - heappop(Q))",
"+ B.append(B[-1] - a - heappu... | false | 0.094344 | 0.048072 | 1.962534 | [
"s973821392",
"s811842344"
] |
u743420240 | p02844 | python | s044573833 | s805948139 | 698 | 575 | 3,188 | 3,188 | Accepted | Accepted | 17.62 | def main():
# 入力
n = int(eval(input()))
s = eval(input())
set1 = set()
set2 = set()
set3 = set()
for x in s:
for x2 in set2:
_x2 = x2+x
if x2+x not in set3:
set3.add(_x2)
for x1 in set1:
_x1 = x1+x
... | def main():
# 入力
n = int(eval(input()))
s = eval(input())
set1 = set()
set2 = set()
set3 = set()
for x in s:
for x2 in set2:
_x2 = x2+x
set3.add(_x2)
for x1 in set1:
_x1 = x1+x
set2.add(_x1)
set1.add(x)
... | 24 | 21 | 450 | 343 | def main():
# 入力
n = int(eval(input()))
s = eval(input())
set1 = set()
set2 = set()
set3 = set()
for x in s:
for x2 in set2:
_x2 = x2 + x
if x2 + x not in set3:
set3.add(_x2)
for x1 in set1:
_x1 = x1 + x
if x1 + ... | def main():
# 入力
n = int(eval(input()))
s = eval(input())
set1 = set()
set2 = set()
set3 = set()
for x in s:
for x2 in set2:
_x2 = x2 + x
set3.add(_x2)
for x1 in set1:
_x1 = x1 + x
set2.add(_x1)
set1.add(x)
print((le... | false | 12.5 | [
"- if x2 + x not in set3:",
"- set3.add(_x2)",
"+ set3.add(_x2)",
"- if x1 + x not in set2:",
"- set2.add(_x1)",
"- if x not in set1:",
"- set1.add(x)",
"+ set2.add(_x1)",
"+ set1.add(x)"
] | false | 0.037427 | 0.041945 | 0.892289 | [
"s044573833",
"s805948139"
] |
u934442292 | p03721 | python | s676848445 | s058151330 | 223 | 146 | 18,216 | 5,736 | Accepted | Accepted | 34.53 | import sys
from operator import itemgetter
input = sys.stdin.readline # NOQA
def main():
N, K = list(map(int, input().split()))
ab = [None] * N
for i in range(N):
ab[i] = tuple(map(int, input().split()))
ab.sort(key=itemgetter(0))
cnt = 0
for a, b in ab:
c... | import sys
input = sys.stdin.readline # NOQA
def main():
N, K = list(map(int, input().split()))
cnt = [0] * (1 + 10**5)
for i in range(N):
a, b = list(map(int, input().split()))
cnt[a] += b
total = 0
for i in range(1, 10**5 + 1):
total += cnt[i]
if... | 24 | 23 | 444 | 421 | import sys
from operator import itemgetter
input = sys.stdin.readline # NOQA
def main():
N, K = list(map(int, input().split()))
ab = [None] * N
for i in range(N):
ab[i] = tuple(map(int, input().split()))
ab.sort(key=itemgetter(0))
cnt = 0
for a, b in ab:
cnt += b
if c... | import sys
input = sys.stdin.readline # NOQA
def main():
N, K = list(map(int, input().split()))
cnt = [0] * (1 + 10**5)
for i in range(N):
a, b = list(map(int, input().split()))
cnt[a] += b
total = 0
for i in range(1, 10**5 + 1):
total += cnt[i]
if total >= K:
... | false | 4.166667 | [
"-from operator import itemgetter",
"- ab = [None] * N",
"+ cnt = [0] * (1 + 10**5)",
"- ab[i] = tuple(map(int, input().split()))",
"- ab.sort(key=itemgetter(0))",
"- cnt = 0",
"- for a, b in ab:",
"- cnt += b",
"- if cnt >= K:",
"- ans = a",
"+ ... | false | 0.057351 | 0.073348 | 0.78191 | [
"s676848445",
"s058151330"
] |
u621935300 | p03069 | python | s760637344 | s206004984 | 76 | 69 | 46,364 | 46,364 | Accepted | Accepted | 9.21 | N=eval(input())
S=input()
L=[0]
for i,x in enumerate(S):
if x=="#":
L.append( L[-1]+1 )
else:
L.append( L[-1] )
ans=float("inf")
for i in range(N+1):
b=L[i] # black on left
w=N-i-(L[-1]-L[i])
ans=min(ans , b+w)
print(ans) | N=eval(input())
S=input()
L=[0]
for i,x in enumerate(S):
if x=="#":
L.append( L[-1]+1 )
else:
L.append( L[-1] )
ans=float("inf")
for i in range(N+1):
b=L[i] # black on left
w=N-i-(L[-1]-L[i]) # white on right
ans=min(ans , b+w)
print(ans) | 18 | 18 | 251 | 270 | N = eval(input())
S = input()
L = [0]
for i, x in enumerate(S):
if x == "#":
L.append(L[-1] + 1)
else:
L.append(L[-1])
ans = float("inf")
for i in range(N + 1):
b = L[i] # black on left
w = N - i - (L[-1] - L[i])
ans = min(ans, b + w)
print(ans)
| N = eval(input())
S = input()
L = [0]
for i, x in enumerate(S):
if x == "#":
L.append(L[-1] + 1)
else:
L.append(L[-1])
ans = float("inf")
for i in range(N + 1):
b = L[i] # black on left
w = N - i - (L[-1] - L[i]) # white on right
ans = min(ans, b + w)
print(ans)
| false | 0 | [
"- w = N - i - (L[-1] - L[i])",
"+ w = N - i - (L[-1] - L[i]) # white on right"
] | false | 0.036577 | 0.035835 | 1.02073 | [
"s760637344",
"s206004984"
] |
u416011173 | p02691 | python | s080865290 | s464987152 | 193 | 151 | 40,448 | 40,460 | Accepted | Accepted | 21.76 | # -*- coding: utf-8 -*-
# モジュールのインポート
import collections
# 標準入力の取得
N = int(eval(input()))
A = list(map(int, input().split()))
# 求解処理
left = {}
result = 0
for j in range(N):
r = -A[j] + j
result += left.get(r, 0)
l = A[j] + j
left[l] = left.get(l, 0) + 1
# 結果出力
print(result)
| # -*- coding: utf-8 -*-
# 標準入力の取得
N = int(eval(input()))
A = list(map(int, input().split()))
def main() -> None:
"""Entry point
"""
# 求解処理
"""
1 <= i < j <= Nとすると、
j - i = A_i + A_j ⇒ -A_j + j = A_i +i
となる。
したがって、各jについて、左辺の値を計算し、等式が成立するようなi(< j)の個数を求めればよい。
"""
r... | 19 | 30 | 306 | 561 | # -*- coding: utf-8 -*-
# モジュールのインポート
import collections
# 標準入力の取得
N = int(eval(input()))
A = list(map(int, input().split()))
# 求解処理
left = {}
result = 0
for j in range(N):
r = -A[j] + j
result += left.get(r, 0)
l = A[j] + j
left[l] = left.get(l, 0) + 1
# 結果出力
print(result)
| # -*- coding: utf-8 -*-
# 標準入力の取得
N = int(eval(input()))
A = list(map(int, input().split()))
def main() -> None:
"""Entry point"""
# 求解処理
"""
1 <= i < j <= Nとすると、
j - i = A_i + A_j ⇒ -A_j + j = A_i +i
となる。
したがって、各jについて、左辺の値を計算し、等式が成立するようなi(< j)の個数を求めればよい。
"""
right = {}
result ... | false | 36.666667 | [
"-# モジュールのインポート",
"-import collections",
"-",
"-# 求解処理",
"-left = {}",
"-result = 0",
"-for j in range(N):",
"- r = -A[j] + j",
"- result += left.get(r, 0)",
"- l = A[j] + j",
"- left[l] = left.get(l, 0) + 1",
"-# 結果出力",
"-print(result)",
"+",
"+",
"+def main() -> None:",
... | false | 0.134372 | 0.072939 | 1.842242 | [
"s080865290",
"s464987152"
] |
u354916249 | p02918 | python | s494274511 | s547176533 | 49 | 44 | 3,316 | 3,316 | Accepted | Accepted | 10.2 | N, K = list(map(int, input().split()))
S = eval(input())
counter = 0
RL = 0
RL_L = 0
RL_R = 0
if S[0] == 'L':
RL_L += 1
if S[N-1] == 'R':
RL_R += 1
for i in range(N-1):
if S[i:i+2] == 'RL':
counter += 1
if (counter - K) >= 0:
counter -= K
K = 0
else:
K -= counter... | N, K = list(map(int, input().split()))
S = eval(input())
counter = 0
ans = N-1
for i in range(N-1):
if S[i] != S[i+1]:
ans -= 1
print((min(N-1, ans+2*K))) | 36 | 11 | 509 | 165 | N, K = list(map(int, input().split()))
S = eval(input())
counter = 0
RL = 0
RL_L = 0
RL_R = 0
if S[0] == "L":
RL_L += 1
if S[N - 1] == "R":
RL_R += 1
for i in range(N - 1):
if S[i : i + 2] == "RL":
counter += 1
if (counter - K) >= 0:
counter -= K
K = 0
else:
K -= counter
counter = 0
... | N, K = list(map(int, input().split()))
S = eval(input())
counter = 0
ans = N - 1
for i in range(N - 1):
if S[i] != S[i + 1]:
ans -= 1
print((min(N - 1, ans + 2 * K)))
| false | 69.444444 | [
"-RL = 0",
"-RL_L = 0",
"-RL_R = 0",
"-if S[0] == \"L\":",
"- RL_L += 1",
"-if S[N - 1] == \"R\":",
"- RL_R += 1",
"+ans = N - 1",
"- if S[i : i + 2] == \"RL\":",
"- counter += 1",
"-if (counter - K) >= 0:",
"- counter -= K",
"- K = 0",
"-else:",
"- K -= counter"... | false | 0.046601 | 0.046463 | 1.002981 | [
"s494274511",
"s547176533"
] |
u823458368 | p03804 | python | s278916145 | s490109640 | 318 | 150 | 21,676 | 3,064 | Accepted | Accepted | 52.83 | import numpy as np
n, m = list(map(int, input().split()))
a = [[j for j in eval(input())] for i in range(n)]
b = [[j for j in eval(input())] for i in range(m)]
ans = 'No'
na = np.array(a)
nb = np.array(b)
for i in range(n-m+1):
for j in range(n-m+1):
s = na[i:m+i, list(range(j, m+j))]
if (... | a, b = list(map(int,input().split()))
A = [eval(input()) for _ in range(a)]
B = [eval(input()) for _ in range(b)]
ans = "No"
for i in range(a-b+1):
for j in range(a-b+1):
cnt = 0
if A[i][j] == B[0][0]:
for k in range(b):
for l in range(b):
if... | 14 | 16 | 367 | 448 | import numpy as np
n, m = list(map(int, input().split()))
a = [[j for j in eval(input())] for i in range(n)]
b = [[j for j in eval(input())] for i in range(m)]
ans = "No"
na = np.array(a)
nb = np.array(b)
for i in range(n - m + 1):
for j in range(n - m + 1):
s = na[i : m + i, list(range(j, m + j))]
... | a, b = list(map(int, input().split()))
A = [eval(input()) for _ in range(a)]
B = [eval(input()) for _ in range(b)]
ans = "No"
for i in range(a - b + 1):
for j in range(a - b + 1):
cnt = 0
if A[i][j] == B[0][0]:
for k in range(b):
for l in range(b):
if ... | false | 12.5 | [
"-import numpy as np",
"-",
"-n, m = list(map(int, input().split()))",
"-a = [[j for j in eval(input())] for i in range(n)]",
"-b = [[j for j in eval(input())] for i in range(m)]",
"+a, b = list(map(int, input().split()))",
"+A = [eval(input()) for _ in range(a)]",
"+B = [eval(input()) for _ in range(... | false | 0.465787 | 0.007798 | 59.73428 | [
"s278916145",
"s490109640"
] |
u790710233 | p03164 | python | s749630531 | s694113397 | 417 | 300 | 120,044 | 41,964 | Accepted | Accepted | 28.06 | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = 10**10
dp = [[INF]*(UV+1) for _ in range(n+1)]
for i in range(n+1):
dp[i][0] = 0
for i in range(1, n+1):
for j in range(1, UV+1):
dp[i][j] = dp[i-1][j... | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = 10**10
dp = [INF]*(UV+1)
dp[0] = 0
for i in range(1, n+1):
for j in reversed(list(range(1, UV+1))):
if j-values[i-1] < 0:
continue
dp[j] ... | 20 | 20 | 528 | 457 | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = 10**10
dp = [[INF] * (UV + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for i in range(1, n + 1):
for j in range(1, UV + 1):
dp[i][j] = dp[i - 1][j]... | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = 10**10
dp = [INF] * (UV + 1)
dp[0] = 0
for i in range(1, n + 1):
for j in reversed(list(range(1, UV + 1))):
if j - values[i - 1] < 0:
continue
dp[j] ... | false | 0 | [
"-dp = [[INF] * (UV + 1) for _ in range(n + 1)]",
"-for i in range(n + 1):",
"- dp[i][0] = 0",
"+dp = [INF] * (UV + 1)",
"+dp[0] = 0",
"- for j in range(1, UV + 1):",
"- dp[i][j] = dp[i - 1][j]",
"- if 0 <= j - values[i - 1]:",
"- dp[i][j] = min(dp[i][j], dp[i - 1][j -... | false | 0.738183 | 1.050969 | 0.702383 | [
"s749630531",
"s694113397"
] |
u970899068 | p02990 | python | s606146306 | s851013895 | 549 | 31 | 3,444 | 4,596 | Accepted | Accepted | 94.35 | def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
pivot = denominator[p - 1]
if pivot > 1:
offset = (n - r) % p
... | 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
mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.ap... | 29 | 25 | 744 | 582 | def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2, r + 1):
pivot = denominator[p - 1]
if pivot > 1:
offset = (n ... | 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
mod = 10**9 + 7 # 出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | false | 13.793103 | [
"-def cmb(n, r):",
"- if n - r < r:",
"- r = n - r",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return n",
"- numerator = [n - r + k + 1 for k in range(r)]",
"- denominator = [k + 1 for k in range(r)]",
"- for p in range(2, r + 1):",
"- pivot =... | false | 0.154207 | 0.04685 | 3.291475 | [
"s606146306",
"s851013895"
] |
u298297089 | p03240 | python | s667730420 | s036499580 | 301 | 276 | 51,440 | 49,520 | Accepted | Accepted | 8.31 | N = int(eval(input()))
A = []
for i in range(N):
x,y,h = list(map(int, input().split()))
A.append([x,y,h])
H = max([h for x,y,h in A])
while True:
for i in range(100+1):
for j in range(100+1):
for x,y,h in A:
tx, ty = abs(x-i), abs(y-j)
if max... | n = int(eval(input()))
py = []
start = 0
for i in range(n):
x,y,h = list(map(int, input().split()))
if start < h:
start = h
py.append((x,y,h))
height = lambda x,y,cx,cy,hh:max(hh -abs(x-cx) -abs(y-cy), 0)
while True:
for i in range(101):
for j in range(101):
for... | 18 | 22 | 443 | 538 | N = int(eval(input()))
A = []
for i in range(N):
x, y, h = list(map(int, input().split()))
A.append([x, y, h])
H = max([h for x, y, h in A])
while True:
for i in range(100 + 1):
for j in range(100 + 1):
for x, y, h in A:
tx, ty = abs(x - i), abs(y - j)
if ... | n = int(eval(input()))
py = []
start = 0
for i in range(n):
x, y, h = list(map(int, input().split()))
if start < h:
start = h
py.append((x, y, h))
height = lambda x, y, cx, cy, hh: max(hh - abs(x - cx) - abs(y - cy), 0)
while True:
for i in range(101):
for j in range(101):
fo... | false | 18.181818 | [
"-N = int(eval(input()))",
"-A = []",
"-for i in range(N):",
"+n = int(eval(input()))",
"+py = []",
"+start = 0",
"+for i in range(n):",
"- A.append([x, y, h])",
"-H = max([h for x, y, h in A])",
"+ if start < h:",
"+ start = h",
"+ py.append((x, y, h))",
"+height = lambda x,... | false | 0.086158 | 0.089305 | 0.964752 | [
"s667730420",
"s036499580"
] |
u289547799 | p02695 | python | s621765700 | s513994721 | 1,680 | 995 | 23,060 | 9,256 | Accepted | Accepted | 40.77 | n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for i in range(q)]
lst = []
if n == 2:
for a in range(1,m+1):
for b in range(a, m+1):
lst.append([a, b])
if n == 3:
for a in range(1,m+1):
for b in range(a, m+1):
for c in range(b, m+1):
... | N, M, Q = list(map(int, input().split()))
req = [list(map(int, input().split())) for i in range(Q)]
maxi = 0
def dfs(A):
global maxi
if len(A) == N: # 終端条件 --- 10 重ループまで回したら処理して打ち切り
ans = 0
for i in range(Q):
if A[req[i][1]-1] - A[req[i][0]-1] == req[i][2]:
ans += req[i][3]
... | 96 | 29 | 2,776 | 599 | n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for i in range(q)]
lst = []
if n == 2:
for a in range(1, m + 1):
for b in range(a, m + 1):
lst.append([a, b])
if n == 3:
for a in range(1, m + 1):
for b in range(a, m + 1):
for c in range(b, ... | N, M, Q = list(map(int, input().split()))
req = [list(map(int, input().split())) for i in range(Q)]
maxi = 0
def dfs(A):
global maxi
if len(A) == N: # 終端条件 --- 10 重ループまで回したら処理して打ち切り
ans = 0
for i in range(Q):
if A[req[i][1] - 1] - A[req[i][0] - 1] == req[i][2]:
ans... | false | 69.791667 | [
"-n, m, q = list(map(int, input().split()))",
"-req = [list(map(int, input().split())) for i in range(q)]",
"-lst = []",
"-if n == 2:",
"- for a in range(1, m + 1):",
"- for b in range(a, m + 1):",
"- lst.append([a, b])",
"-if n == 3:",
"- for a in range(1, m + 1):",
"- ... | false | 0.19255 | 0.061924 | 3.10945 | [
"s621765700",
"s513994721"
] |
u222668979 | p03330 | python | s617889119 | s201587783 | 158 | 144 | 76,620 | 76,524 | Accepted | Accepted | 8.86 | from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [[0] * c for _ in range(3)]
for i in range(n):
for j in range(n):
mod = (i + j) % 3
dcnt[mod... | from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [[0] * c for _ in range(3)]
for i, ci in enumerate(cmat):
for j, cij in enumerate(ci):
mod = (i + j) ... | 19 | 19 | 542 | 556 | from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [[0] * c for _ in range(3)]
for i in range(n):
for j in range(n):
mod = (i + j) % 3
dcnt[mod][cmat[i][j... | from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [[0] * c for _ in range(3)]
for i, ci in enumerate(cmat):
for j, cij in enumerate(ci):
mod = (i + j) % 3
... | false | 0 | [
"-for i in range(n):",
"- for j in range(n):",
"+for i, ci in enumerate(cmat):",
"+ for j, cij in enumerate(ci):",
"- dcnt[mod][cmat[i][j] - 1] += 1",
"+ dcnt[mod][cij - 1] += 1"
] | false | 0.04479 | 0.043622 | 1.026771 | [
"s617889119",
"s201587783"
] |
u585482323 | p03767 | python | s416388741 | s868840850 | 644 | 316 | 120,508 | 77,936 | Accepted | Accepted | 50.93 | #!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()... | #!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... | 91 | 37 | 1,576 | 900 | #!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... | #!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 | 59.340659 | [
"+from itertools import permutations, accumulate",
"-import random",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"- return li... | false | 0.046577 | 0.047013 | 0.990727 | [
"s416388741",
"s868840850"
] |
u399973890 | p02848 | python | s559397900 | s649424427 | 25 | 23 | 3,188 | 3,316 | Accepted | Accepted | 8 | N = int(eval(input()))
S = list(eval(input()))
alphabet = ['A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
answer = []
for s in S:
number = alphabet.index(s)
while number + N >= 26:
... | def minus26(idx):
while idx >= 26:
idx = idx - 26
return idx
N = int(eval(input()))
S = list(eval(input()))
alphabet = ['A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
... | 14 | 16 | 401 | 443 | N = int(eval(input()))
S = list(eval(input()))
alphabet = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
]
answer = []
for s in S:
... | def minus26(idx):
while idx >= 26:
idx = idx - 26
return idx
N = int(eval(input()))
S = list(eval(input()))
alphabet = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
... | false | 12.5 | [
"+def minus26(idx):",
"+ while idx >= 26:",
"+ idx = idx - 26",
"+ return idx",
"+",
"+",
"-answer = []",
"-for s in S:",
"- number = alphabet.index(s)",
"- while number + N >= 26:",
"- number = number - 26",
"- answer.append(alphabet[number + N])",
"-print((\"\"... | false | 0.045079 | 0.038248 | 1.178592 | [
"s559397900",
"s649424427"
] |
u968166680 | p02788 | python | s920497436 | s178607436 | 644 | 580 | 148,056 | 152,628 | Accepted | Accepted | 9.94 | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, D, A, *XH = list(map(int, read().split()))
monster = [0] * N
for i, (x, h) in enumerate(... | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, D, A, *XH = list(map(int, read().split()))
monster = [0] * N
for i, (x, h) in enumerate(... | 43 | 43 | 886 | 880 | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, D, A, *XH = list(map(int, read().split()))
monster = [0] * N
for i, (x, h) in enumerate(zip(*[iter(XH)] ... | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, D, A, *XH = list(map(int, read().split()))
monster = [0] * N
for i, (x, h) in enumerate(zip(*[iter(XH)] ... | false | 0 | [
"- left = right = 0",
"- cum_damage = 0",
"+ idx = 0",
"+ cur_damage = 0",
"- left = right",
"- right = bisect_left(pos, x)",
"- cum_damage -= sum(damage[left:right])",
"- if h > cum_damage:",
"+ while idx < len(pos) and pos[idx] < x:",
"+ ... | false | 0.038764 | 0.03697 | 1.048516 | [
"s920497436",
"s178607436"
] |
u562935282 | p03290 | python | s077360451 | s866862433 | 360 | 21 | 3,064 | 3,064 | Accepted | Accepted | 94.17 | inf = float('inf')
def rec(cur, partially_solved, solve_num, score):
if cur == d:
return solve_num if score >= g else inf
res = rec(cur + 1, partially_solved, solve_num, score)
res = min(res,
rec(cur + 1, partially_solved, solve_num + p[cur], score + p[cur] * (cur + 1) * 10... | def main():
from itertools import product
D, G = list(map(int, input().split()))
prob = []
for j in range(1, D + 1):
p, c = list(map(int, input().split()))
prob.append((j * 100, p, c)) # score,amount,bonus
ans = -1
for prd in product([0, 1], repeat=D):
cnt... | 25 | 35 | 709 | 931 | inf = float("inf")
def rec(cur, partially_solved, solve_num, score):
if cur == d:
return solve_num if score >= g else inf
res = rec(cur + 1, partially_solved, solve_num, score)
res = min(
res,
rec(
cur + 1,
partially_solved,
solve_num + p[cur],
... | def main():
from itertools import product
D, G = list(map(int, input().split()))
prob = []
for j in range(1, D + 1):
p, c = list(map(int, input().split()))
prob.append((j * 100, p, c)) # score,amount,bonus
ans = -1
for prd in product([0, 1], repeat=D):
cnt = 0
g... | false | 28.571429 | [
"-inf = float(\"inf\")",
"+def main():",
"+ from itertools import product",
"+",
"+ D, G = list(map(int, input().split()))",
"+ prob = []",
"+ for j in range(1, D + 1):",
"+ p, c = list(map(int, input().split()))",
"+ prob.append((j * 100, p, c)) # score,amount,bonus",
"... | false | 0.041299 | 0.037146 | 1.111797 | [
"s077360451",
"s866862433"
] |
u461833298 | p02861 | python | s166750835 | s045922177 | 351 | 203 | 3,188 | 3,064 | Accepted | Accepted | 42.17 | import itertools
import math
N = int(eval(input()))
P = [[int(x) for x in input().split()] for _ in range(N)]
ans=0
for p in itertools.permutations(P):
for (x1, y1), (x2, y2) in zip(p, p[1:]):
ans += ((x1-x2)**2 + (y1-y2)**2)**.5
print((ans/math.factorial(N))) | import itertools
import math
N = int(eval(input()))
P = [[int(x) for x in input().split()] for _ in range(N)]
ans=0
for p in itertools.permutations(P):
for (x1, y1), (x2, y2) in zip(p, p[1:]):
ans += math.hypot(x1-x2, y1-y2)
print((ans/math.factorial(N))) | 10 | 10 | 274 | 269 | import itertools
import math
N = int(eval(input()))
P = [[int(x) for x in input().split()] for _ in range(N)]
ans = 0
for p in itertools.permutations(P):
for (x1, y1), (x2, y2) in zip(p, p[1:]):
ans += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
print((ans / math.factorial(N)))
| import itertools
import math
N = int(eval(input()))
P = [[int(x) for x in input().split()] for _ in range(N)]
ans = 0
for p in itertools.permutations(P):
for (x1, y1), (x2, y2) in zip(p, p[1:]):
ans += math.hypot(x1 - x2, y1 - y2)
print((ans / math.factorial(N)))
| false | 0 | [
"- ans += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5",
"+ ans += math.hypot(x1 - x2, y1 - y2)"
] | false | 0.04126 | 0.045001 | 0.916879 | [
"s166750835",
"s045922177"
] |
u952467214 | p03475 | python | s883370878 | s937301144 | 128 | 84 | 3,444 | 3,444 | Accepted | Accepted | 34.38 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n = int(eval(input()))
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)
for i in range(n-1):
c[i], s[i], f[i] = list(map(int, input().split()))
def dfs(eki,t):
if eki == n-1:
return t
cc = c[eki]
ss = s[eki]
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n = int(eval(input()))
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)
for i in range(n-1):
c[i], s[i], f[i] = list(map(int, input().split()))
def dfs(eki,t):
if eki == n-1:
return t
cc = c[eki]
ss = s[eki]
... | 28 | 28 | 499 | 472 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
c = [0] * (n - 1)
s = [0] * (n - 1)
f = [0] * (n - 1)
for i in range(n - 1):
c[i], s[i], f[i] = list(map(int, input().split()))
def dfs(eki, t):
if eki == n - 1:
return t
cc = c[eki]
ss = s[eki]
ff =... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
c = [0] * (n - 1)
s = [0] * (n - 1)
f = [0] * (n - 1)
for i in range(n - 1):
c[i], s[i], f[i] = list(map(int, input().split()))
def dfs(eki, t):
if eki == n - 1:
return t
cc = c[eki]
ss = s[eki]
ff =... | false | 0 | [
"- m = max(0, -(-t + ss) // ff)"
] | false | 0.099985 | 0.112021 | 0.892562 | [
"s883370878",
"s937301144"
] |
u905203728 | p03354 | python | s992408886 | s821734521 | 1,632 | 684 | 127,596 | 35,276 | Accepted | Accepted | 58.09 | #Union Findで連結を判定
N,M = list(map(int,input().split()))
*P, = list(map(int,input().split()))
XY = [list(map(int,input().split())) for _ in range(M)]
class UnionFind:
def __init__(self,N):
self.Parent = [-1]*N
def get_Parent(self,n):
if self.Parent[n] == -1:return n
p = self.get... | class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*n
self.rank=[-1]*n
def Find_Root(self,x):
if self.root[x]<0:return x
else:
self.root[x]=self.Find_Root(self.root[x])
return self.root[x]
def Unite(self,x,y):
... | 27 | 55 | 735 | 1,470 | # Union Findで連結を判定
N, M = list(map(int, input().split()))
(*P,) = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(M)]
class UnionFind:
def __init__(self, N):
self.Parent = [-1] * N
def get_Parent(self, n):
if self.Parent[n] == -1:
return n
... | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * n
self.rank = [-1] * n
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(sel... | false | 50.909091 | [
"-# Union Findで連結を判定",
"-N, M = list(map(int, input().split()))",
"-(*P,) = list(map(int, input().split()))",
"-XY = [list(map(int, input().split())) for _ in range(M)]",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.root = [-1] * n",
"+ self.rank =... | false | 0.041779 | 0.047141 | 0.886252 | [
"s992408886",
"s821734521"
] |
u573754721 | p02952 | python | s983728385 | s384054720 | 57 | 47 | 2,940 | 2,940 | Accepted | Accepted | 17.54 | n=int(eval(input()))
c=0
for i in range(1,n+1):
if len(str(i))%2!=0:
c+=1
print(c)
| n=int(eval(input()))
print((sum(len(str(i))%2 for i in range(1,n+1)))) | 6 | 2 | 100 | 63 | n = int(eval(input()))
c = 0
for i in range(1, n + 1):
if len(str(i)) % 2 != 0:
c += 1
print(c)
| n = int(eval(input()))
print((sum(len(str(i)) % 2 for i in range(1, n + 1))))
| false | 66.666667 | [
"-c = 0",
"-for i in range(1, n + 1):",
"- if len(str(i)) % 2 != 0:",
"- c += 1",
"-print(c)",
"+print((sum(len(str(i)) % 2 for i in range(1, n + 1))))"
] | false | 0.112358 | 0.055875 | 2.010884 | [
"s983728385",
"s384054720"
] |
u585348179 | p02713 | python | s727100148 | s779362347 | 1,061 | 961 | 69,464 | 69,780 | Accepted | Accepted | 9.43 | K=int(eval(input()))
import itertools,math
from functools import reduce
data = [i for i in range(1,K+1)]
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans = 0
for a,b,c in itertools.product(data, repeat=3):
ans += gcd(a,b,c)
print(ans)
| K=int(eval(input()))
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans = 0
for a in range(1,K+1):
for b in range(1,K+1):
for c in range(1,K+1):
ans += gcd(a,b,c)
print(ans)
| 15 | 15 | 263 | 260 | K = int(eval(input()))
import itertools, math
from functools import reduce
data = [i for i in range(1, K + 1)]
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans = 0
for a, b, c in itertools.product(data, repeat=3):
ans += gcd(a, b, c)
print(ans)
| K = int(eval(input()))
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(a, b, c)
print(ans)
| false | 0 | [
"-import itertools, math",
"+import math",
"-",
"-data = [i for i in range(1, K + 1)]",
"-for a, b, c in itertools.product(data, repeat=3):",
"- ans += gcd(a, b, c)",
"+for a in range(1, K + 1):",
"+ for b in range(1, K + 1):",
"+ for c in range(1, K + 1):",
"+ ans += gcd(a... | false | 0.047997 | 0.041945 | 1.14428 | [
"s727100148",
"s779362347"
] |
u488127128 | p03448 | python | s918865315 | s173728555 | 49 | 44 | 3,060 | 3,060 | Accepted | Accepted | 10.2 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
x = int(eval(input()))
count = 0
if x % 50 != 0:
print((0))
else:
for c in range(C+1):
for b in range(B+1):
for a in range(A+1):
if c*50 + b*100 + a*500 == x:
count += 1
... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
x = int(eval(input()))
print((sum([1 for a in range(A+1) for b in range(B+1) for c in range(C+1) if 500*a + 100*b + 50*c == x]))) | 15 | 5 | 308 | 176 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
x = int(eval(input()))
count = 0
if x % 50 != 0:
print((0))
else:
for c in range(C + 1):
for b in range(B + 1):
for a in range(A + 1):
if c * 50 + b * 100 + a * 500 == x:
count += 1
p... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
x = int(eval(input()))
print(
(
sum(
[
1
for a in range(A + 1)
for b in range(B + 1)
for c in range(C + 1)
if 500 * a + 100 * b + 50 * c == x
... | false | 66.666667 | [
"-count = 0",
"-if x % 50 != 0:",
"- print((0))",
"-else:",
"- for c in range(C + 1):",
"- for b in range(B + 1):",
"- for a in range(A + 1):",
"- if c * 50 + b * 100 + a * 500 == x:",
"- count += 1",
"- print(count)",
"+print(",
"+ ... | false | 0.048855 | 0.106802 | 0.457434 | [
"s918865315",
"s173728555"
] |
u562935282 | p03944 | python | s721271424 | s092527317 | 73 | 18 | 3,064 | 3,064 | Accepted | Accepted | 75.34 | w, h ,n = list(map(int, input().split()))
sq = list(list(True for _ in range(h)) for _ in range(w))##sq[w][h]
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
for ix in range(x):
for iy in range(h):
sq[ix][iy] = False
if a == 2:
for... | def main():
W, H, N = list(map(int, input().split()))
xl, xh = 0, W
yl, yh = 0, H
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
xl = max(xl, x)
elif a == 2:
xh = min(xh, x)
elif a == 3:
yl = max(yl... | 25 | 23 | 713 | 462 | w, h, n = list(map(int, input().split()))
sq = list(list(True for _ in range(h)) for _ in range(w)) ##sq[w][h]
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
for ix in range(x):
for iy in range(h):
sq[ix][iy] = False
if a == 2:
for ix in ... | def main():
W, H, N = list(map(int, input().split()))
xl, xh = 0, W
yl, yh = 0, H
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
xl = max(xl, x)
elif a == 2:
xh = min(xh, x)
elif a == 3:
yl = max(yl, y)
... | false | 8 | [
"-w, h, n = list(map(int, input().split()))",
"-sq = list(list(True for _ in range(h)) for _ in range(w)) ##sq[w][h]",
"-for i in range(n):",
"- x, y, a = list(map(int, input().split()))",
"- if a == 1:",
"- for ix in range(x):",
"- for iy in range(h):",
"- sq[i... | false | 0.056256 | 0.076219 | 0.738086 | [
"s721271424",
"s092527317"
] |
u023229441 | p03127 | python | s853955014 | s748247621 | 1,592 | 92 | 15,020 | 14,252 | Accepted | Accepted | 94.22 | n=int(eval(input()))
A=list(map(int,input().split()))
B=A
while len(B)>1:
C=[i for i in range(len(B))]
C.remove(B.index(min(B)))
d=min(B)
for i in C:
B[i]=B[i]%d
while 0 in B:
B.remove(0)
print((B[0])) | n=int(eval(input()))
A=list(map(int,input().split()))
ans=A[0]
def gcd(a,b):
if b==0: return a
else:
return gcd(b,a%b)
def lcm(a,b):
return a*b//gcd(a,b)
for i in range(n-1):
ans=gcd(ans,A[i+1])
if ans==1:
print((1));exit()
print(ans) | 14 | 16 | 226 | 279 | n = int(eval(input()))
A = list(map(int, input().split()))
B = A
while len(B) > 1:
C = [i for i in range(len(B))]
C.remove(B.index(min(B)))
d = min(B)
for i in C:
B[i] = B[i] % d
while 0 in B:
B.remove(0)
print((B[0]))
| n = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(a, b)
for i in range(n - 1):
ans = gcd(ans, A[i + 1])
if ans == 1:
print((1))
exit()
print(ans)... | false | 12.5 | [
"-B = A",
"-while len(B) > 1:",
"- C = [i for i in range(len(B))]",
"- C.remove(B.index(min(B)))",
"- d = min(B)",
"- for i in C:",
"- B[i] = B[i] % d",
"- while 0 in B:",
"- B.remove(0)",
"-print((B[0]))",
"+ans = A[0]",
"+",
"+",
"+def gcd(a, b):",
"+ if... | false | 0.112633 | 0.035426 | 3.179395 | [
"s853955014",
"s748247621"
] |
u553987207 | p02785 | python | s003250936 | s575408310 | 155 | 105 | 26,764 | 31,568 | Accepted | Accepted | 32.26 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
if N <= K:
print((0))
else:
H.sort(reverse=True)
print((sum(H[K:]))) | N, K = list(map(int, input().split()))
H = sorted(map(int, input().split()), reverse=True)
ans = sum(H[K:])
print(ans) | 7 | 4 | 151 | 115 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
if N <= K:
print((0))
else:
H.sort(reverse=True)
print((sum(H[K:])))
| N, K = list(map(int, input().split()))
H = sorted(map(int, input().split()), reverse=True)
ans = sum(H[K:])
print(ans)
| false | 42.857143 | [
"-H = list(map(int, input().split()))",
"-if N <= K:",
"- print((0))",
"-else:",
"- H.sort(reverse=True)",
"- print((sum(H[K:])))",
"+H = sorted(map(int, input().split()), reverse=True)",
"+ans = sum(H[K:])",
"+print(ans)"
] | false | 0.034793 | 0.034168 | 1.01828 | [
"s003250936",
"s575408310"
] |
u977661421 | p03624 | python | s187727631 | s696768991 | 1,245 | 322 | 3,956 | 3,956 | Accepted | Accepted | 74.14 | # -*- coding: utf-8 -*-
s = list(str(eval(input())))
alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
if len(set(s)) >= 26:
print("None")
exit()
for i in alph:
for j in s:
if not(i in s):
... | # -*- coding: utf-8 -*-
s = list(str(eval(input())))
alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
"""
if len(set(s)) >= 26:
print("None")
exit()
for i in alph:
for j in s:
if not(i in s):
... | 12 | 29 | 343 | 637 | # -*- coding: utf-8 -*-
s = list(str(eval(input())))
alph = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
if len(set(s)) >= 26:
... | # -*- coding: utf-8 -*-
s = list(str(eval(input())))
alph = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
"""
if len(set(s)) >= ... | false | 58.62069 | [
"+\"\"\"",
"- if not (i in s):",
"+ if not(i in s):",
"+\"\"\"",
"+check = [False] * 26",
"+for i in s:",
"+ for j in range(26):",
"+ if i == alph[j]:",
"+ check[j] = True",
"+tmp = 0",
"+for i in range(26):",
"+ if check[i] == False:",
"+ print((... | false | 0.040073 | 0.046047 | 0.870255 | [
"s187727631",
"s696768991"
] |
u086503932 | p03069 | python | s175127511 | s397944709 | 123 | 83 | 11,756 | 9,776 | Accepted | Accepted | 32.52 | #!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
def main():
N = int(eval(input()))
S = eval(input())
B = []
W = []
i = 0
fin = None
while i < N:
if S[i] == '#':
if i == N-1:
... | #!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
def main():
N = int(eval(input()))
S = eval(input())
B = 0
W = S.count('.')
ans = B+W
for i in range(N):
if S[i] == '#':
B += 1
... | 68 | 22 | 1,552 | 428 | #!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
def main():
N = int(eval(input()))
S = eval(input())
B = []
W = []
i = 0
fin = None
while i < N:
if S[i] == "#":
if i == N - 1:
... | #!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
def main():
N = int(eval(input()))
S = eval(input())
B = 0
W = S.count(".")
ans = B + W
for i in range(N):
if S[i] == "#":
B += 1
else:
... | false | 67.647059 | [
"- B = []",
"- W = []",
"- i = 0",
"- fin = None",
"- while i < N:",
"+ B = 0",
"+ W = S.count(\".\")",
"+ ans = B + W",
"+ for i in range(N):",
"- if i == N - 1:",
"- B.append(1)",
"- fin = True",
"- else:",
"-... | false | 0.06691 | 0.120396 | 0.555751 | [
"s175127511",
"s397944709"
] |
u934225857 | p02659 | python | s015017187 | s860422316 | 30 | 22 | 10,464 | 9,060 | Accepted | Accepted | 26.67 | from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b))) | a, b = input().split()
a = int(a)
b_int, b_frac = b.split(".")
bb = int(b_int) * 100 + int(b_frac)
print((a * bb // 100)) | 6 | 5 | 128 | 123 | from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b)))
| a, b = input().split()
a = int(a)
b_int, b_frac = b.split(".")
bb = int(b_int) * 100 + int(b_frac)
print((a * bb // 100))
| false | 16.666667 | [
"-from math import floor",
"-from fractions import Fraction",
"-",
"-b = Fraction(b)",
"-print((floor(a * b)))",
"+b_int, b_frac = b.split(\".\")",
"+bb = int(b_int) * 100 + int(b_frac)",
"+print((a * bb // 100))"
] | false | 0.045411 | 0.039744 | 1.142585 | [
"s015017187",
"s860422316"
] |
u747602774 | p02844 | python | s810622997 | s182365175 | 764 | 177 | 45,148 | 38,384 | Accepted | Accepted | 76.83 | N = int(eval(input()))
S = list(eval(input()))
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
n = 0
while str(i) != S[n] and n < N-3:
n += 1
if S[n] != str(i):
break
n += 1
while str(... | N = int(eval(input()))
S = eval(input())
ans = 0
snumber = [str(i) for i in range(10)]
for i in snumber:
for j in snumber:
for k in snumber:
a = S.find(i)
if a == -1:
break
b = S.find(j,a+1)
if b == -1:
break
... | 22 | 17 | 571 | 395 | N = int(eval(input()))
S = list(eval(input()))
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
n = 0
while str(i) != S[n] and n < N - 3:
n += 1
if S[n] != str(i):
break
n += 1
while str(j) != S[n]... | N = int(eval(input()))
S = eval(input())
ans = 0
snumber = [str(i) for i in range(10)]
for i in snumber:
for j in snumber:
for k in snumber:
a = S.find(i)
if a == -1:
break
b = S.find(j, a + 1)
if b == -1:
break
c = ... | false | 22.727273 | [
"-S = list(eval(input()))",
"+S = eval(input())",
"-for i in range(10):",
"- for j in range(10):",
"- for k in range(10):",
"- n = 0",
"- while str(i) != S[n] and n < N - 3:",
"- n += 1",
"- if S[n] != str(i):",
"+snumber = [str(i) for i in... | false | 0.03873 | 0.039345 | 0.984387 | [
"s810622997",
"s182365175"
] |
u600402037 | p03128 | python | s188279652 | s058367137 | 1,184 | 255 | 255,112 | 51,164 | Accepted | Accepted | 78.46 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# まずは桁数を増やす→数字の大きい順に並べる
N, M = lr()
A = lr()
matches = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
A = [(matches[a], a) for a in A]
A.sort(key = lambda x: x[1], reverse=True)
A.sort(k... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
A = lr()
dp = [-1] * (N+1)
dp[0] = 0
for x in range(N):
for a in A:
y = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6][a]
if x + y > N:
cont... | 43 | 21 | 1,290 | 411 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# まずは桁数を増やす→数字の大きい順に並べる
N, M = lr()
A = lr()
matches = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
A = [(matches[a], a) for a in A]
A.sort(key=lambda x: x[1], reverse=True)
A.sort(key=lambda x: x[0... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
A = lr()
dp = [-1] * (N + 1)
dp[0] = 0
for x in range(N):
for a in A:
y = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6][a]
if x + y > N:
continue
d... | false | 51.162791 | [
"-# まずは桁数を増やす→数字の大きい順に並べる",
"-matches = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]",
"-A = [(matches[a], a) for a in A]",
"-A.sort(key=lambda x: x[1], reverse=True)",
"-A.sort(key=lambda x: x[0])",
"-top_match = A[0][0]",
"-dp = [None] * (N + 1)",
"-dp[0] = []",
"-used = set()",
"-for match, num in A:",
"- ... | false | 0.035611 | 0.070668 | 0.503925 | [
"s188279652",
"s058367137"
] |
u392319141 | p03329 | python | s987397380 | s009899572 | 760 | 650 | 6,296 | 3,828 | Accepted | Accepted | 14.47 | N = int(eval(input()))
dp = [float('inf') for _ in range(N + 1)]
dp[N] = 0
for i in range(N, -1, -1) :
if i - 1 >= 0 :
dp[i - 1] = min(dp[i - 1], dp[i] + 1)
dis = 6
while i - dis >= 0 :
dp[i - dis] = min(dp[i - dis], dp[i] + 1)
dis *= 6
dis = 9
while i - dis >=... | N = int(eval(input()))
dp = [10**18] * (N + 1)
dp[0] = 0
for i in range(N):
prd = 6
while i + prd <= N:
dp[i + prd] = min(dp[i + prd], dp[i] + 1)
prd *= 6
prd = 9
while i + prd <= N:
dp[i + prd] = min(dp[i + prd], dp[i] + 1)
prd *= 9
ans = 10**18
for i,... | 18 | 19 | 403 | 378 | N = int(eval(input()))
dp = [float("inf") for _ in range(N + 1)]
dp[N] = 0
for i in range(N, -1, -1):
if i - 1 >= 0:
dp[i - 1] = min(dp[i - 1], dp[i] + 1)
dis = 6
while i - dis >= 0:
dp[i - dis] = min(dp[i - dis], dp[i] + 1)
dis *= 6
dis = 9
while i - dis >= 0:
dp[i -... | N = int(eval(input()))
dp = [10**18] * (N + 1)
dp[0] = 0
for i in range(N):
prd = 6
while i + prd <= N:
dp[i + prd] = min(dp[i + prd], dp[i] + 1)
prd *= 6
prd = 9
while i + prd <= N:
dp[i + prd] = min(dp[i + prd], dp[i] + 1)
prd *= 9
ans = 10**18
for i, c in enumerate(dp)... | false | 5.263158 | [
"-dp = [float(\"inf\") for _ in range(N + 1)]",
"-dp[N] = 0",
"-for i in range(N, -1, -1):",
"- if i - 1 >= 0:",
"- dp[i - 1] = min(dp[i - 1], dp[i] + 1)",
"- dis = 6",
"- while i - dis >= 0:",
"- dp[i - dis] = min(dp[i - dis], dp[i] + 1)",
"- dis *= 6",
"- dis = 9... | false | 0.169715 | 0.21869 | 0.776053 | [
"s987397380",
"s009899572"
] |
u620868411 | p03252 | python | s987916975 | s451158542 | 385 | 142 | 6,224 | 3,632 | Accepted | Accepted | 63.12 | # -*- coding: utf-8 -*-
import unittest
def func(s,t):
n = len(s)
for c in set(s):
d = None
for i in range(n):
if s[i]==c:
if d is None:
d = t[i]
elif d!=t[i]:
return "No"
for c in set(t):
... | # -*- coding: utf-8 -*-
s = eval(input())
t = eval(input())
n = len(s)
ds = {}
dt = {}
for i in range(n):
if s[i] not in ds:
ds[s[i]] = t[i]
elif ds[s[i]]!=t[i]:
print("No")
exit()
if t[i] not in dt:
dt[t[i]] = s[i]
elif dt[t[i]]!=s[i]:
print("No"... | 36 | 19 | 966 | 340 | # -*- coding: utf-8 -*-
import unittest
def func(s, t):
n = len(s)
for c in set(s):
d = None
for i in range(n):
if s[i] == c:
if d is None:
d = t[i]
elif d != t[i]:
return "No"
for c in set(t):
d = ... | # -*- coding: utf-8 -*-
s = eval(input())
t = eval(input())
n = len(s)
ds = {}
dt = {}
for i in range(n):
if s[i] not in ds:
ds[s[i]] = t[i]
elif ds[s[i]] != t[i]:
print("No")
exit()
if t[i] not in dt:
dt[t[i]] = s[i]
elif dt[t[i]] != s[i]:
print("No")
exi... | false | 47.222222 | [
"-import unittest",
"-",
"-",
"-def func(s, t):",
"- n = len(s)",
"- for c in set(s):",
"- d = None",
"- for i in range(n):",
"- if s[i] == c:",
"- if d is None:",
"- d = t[i]",
"- elif d != t[i]:",
"- ... | false | 0.105777 | 0.0767 | 1.379108 | [
"s987916975",
"s451158542"
] |
u933096856 | p02417 | python | s786045426 | s253234920 | 30 | 10 | 7,536 | 6,508 | Accepted | Accepted | 66.67 | a=[0]*26
w='abcdefghijklmnopqrstuvwxyz'
try:
while True:
s=list(input().upper())
for i in s:
if i=='A':
a[0]+=1
elif i=='B':
a[1]+=1
elif i=='C':
a[2]+=1
elif i=='D':
a[3]+=1
... | a=[0]*26
w='abcdefghijklmnopqrstuvwxyz'
try:
while True:
s=list(input().upper())
for i in s:
if i=='A':
a[0]+=1
elif i=='B':
a[1]+=1
elif i=='C':
a[2]+=1
elif i=='D':
a[3]+=1
... | 64 | 64 | 1,548 | 1,551 | a = [0] * 26
w = "abcdefghijklmnopqrstuvwxyz"
try:
while True:
s = list(input().upper())
for i in s:
if i == "A":
a[0] += 1
elif i == "B":
a[1] += 1
elif i == "C":
a[2] += 1
elif i == "D":
... | a = [0] * 26
w = "abcdefghijklmnopqrstuvwxyz"
try:
while True:
s = list(input().upper())
for i in s:
if i == "A":
a[0] += 1
elif i == "B":
a[1] += 1
elif i == "C":
a[2] += 1
elif i == "D":
... | false | 0 | [
"- print((w[i : i + 1], \":\", str(a[i])))",
"+ print(w[i : i + 1], \":\", str(a[i]))"
] | false | 0.039826 | 0.03824 | 1.041495 | [
"s786045426",
"s253234920"
] |
u759412327 | p03696 | python | s855562446 | s964556766 | 31 | 26 | 9,068 | 9,152 | Accepted | Accepted | 16.13 | N = int(eval(input()))
S = eval(input())
T = S
for n in range(N):
T = T.replace("()","")
L = T.count("(")
R = T.count(")")
S = R*"("+S+L*")"
print(S) | N = int(eval(input()))
S = T = eval(input())
while "()" in S:
S = S.replace("()","")
print(("("*S.count(")")+T+S.count("(")*")")) | 11 | 7 | 151 | 125 | N = int(eval(input()))
S = eval(input())
T = S
for n in range(N):
T = T.replace("()", "")
L = T.count("(")
R = T.count(")")
S = R * "(" + S + L * ")"
print(S)
| N = int(eval(input()))
S = T = eval(input())
while "()" in S:
S = S.replace("()", "")
print(("(" * S.count(")") + T + S.count("(") * ")"))
| false | 36.363636 | [
"-S = eval(input())",
"-T = S",
"-for n in range(N):",
"- T = T.replace(\"()\", \"\")",
"-L = T.count(\"(\")",
"-R = T.count(\")\")",
"-S = R * \"(\" + S + L * \")\"",
"-print(S)",
"+S = T = eval(input())",
"+while \"()\" in S:",
"+ S = S.replace(\"()\", \"\")",
"+print((\"(\" * S.count(... | false | 0.0367 | 0.036513 | 1.005131 | [
"s855562446",
"s964556766"
] |
u312025627 | p03291 | python | s487572413 | s005370818 | 400 | 127 | 9,156 | 73,672 | Accepted | Accepted | 68.25 | MOD = 10**9 + 7
def main():
S = eval(input())
N = len(S)
pre_hatena = S[:1].count("?")
a = S[:1].count("A")
post_hatena = S[2:].count("?")
c = S[2:].count("C")
ans = 0
for i in range(1, N-1):
if S[i] == "?" or S[i] == "B":
pre_pow = pow(3, pre_hatena-... | MOD = 10**9 + 7
def main():
S = eval(input())
N = len(S)
pre_hatena = S[:1].count("?")
a = S[:1].count("A")
post_hatena = S[2:].count("?")
c = S[2:].count("C")
rev_3 = pow(3, MOD-2, MOD)
ans = 0
for i in range(1, N-1):
if S[i] == "?" or S[i] == "B":
... | 33 | 34 | 831 | 867 | MOD = 10**9 + 7
def main():
S = eval(input())
N = len(S)
pre_hatena = S[:1].count("?")
a = S[:1].count("A")
post_hatena = S[2:].count("?")
c = S[2:].count("C")
ans = 0
for i in range(1, N - 1):
if S[i] == "?" or S[i] == "B":
pre_pow = pow(3, pre_hatena - 1, MOD)
... | MOD = 10**9 + 7
def main():
S = eval(input())
N = len(S)
pre_hatena = S[:1].count("?")
a = S[:1].count("A")
post_hatena = S[2:].count("?")
c = S[2:].count("C")
rev_3 = pow(3, MOD - 2, MOD)
ans = 0
for i in range(1, N - 1):
if S[i] == "?" or S[i] == "B":
pre_pow ... | false | 2.941176 | [
"+ rev_3 = pow(3, MOD - 2, MOD)",
"- pre_pow = pow(3, pre_hatena - 1, MOD)",
"- pre = ((pre_pow * 3) % MOD) * a + pre_pow * pre_hatena",
"- post_pow = pow(3, post_hatena - 1, MOD)",
"- post = ((post_pow * 3) % MOD) * c + post_pow * post_hatena",
"+ ... | false | 0.034865 | 0.035827 | 0.973156 | [
"s487572413",
"s005370818"
] |
u422104747 | p03330 | python | s589614307 | s681953692 | 1,404 | 216 | 5,244 | 3,188 | Accepted | Accepted | 84.62 | s=input().split()
N=int(s[0])
C=int(s[1])
d=[]
for i in range(C):
s=input().split()
temp=[]
for item in s:
temp.append(int(item))
d.append(temp)
if N==1:
print("0")
else:
c=[[],[],[]]
cost=[[],[],[]]
for j in range(N):
s=input().split()
for i in r... | s=input().split()
n=int(s[0])
c=int(s[1])
d=[[0 for i in range(c+1)] for j in range(c+1)]
for i in range(c):
s=input().split()
for j in range(c):
d[i+1][j+1]=int(s[j])
cnt=[[0 for i in range(c+1)],[0 for i in range(c+1)],[0 for i in range(c+1)]]
for i in range(n):
s=input().split()
for j in range(n):
... | 39 | 27 | 1,004 | 790 | s = input().split()
N = int(s[0])
C = int(s[1])
d = []
for i in range(C):
s = input().split()
temp = []
for item in s:
temp.append(int(item))
d.append(temp)
if N == 1:
print("0")
else:
c = [[], [], []]
cost = [[], [], []]
for j in range(N):
s = input().split()
for... | s = input().split()
n = int(s[0])
c = int(s[1])
d = [[0 for i in range(c + 1)] for j in range(c + 1)]
for i in range(c):
s = input().split()
for j in range(c):
d[i + 1][j + 1] = int(s[j])
cnt = [[0 for i in range(c + 1)], [0 for i in range(c + 1)], [0 for i in range(c + 1)]]
for i in range(n):
s = i... | false | 30.769231 | [
"-N = int(s[0])",
"-C = int(s[1])",
"-d = []",
"-for i in range(C):",
"+n = int(s[0])",
"+c = int(s[1])",
"+d = [[0 for i in range(c + 1)] for j in range(c + 1)]",
"+for i in range(c):",
"- temp = []",
"- for item in s:",
"- temp.append(int(item))",
"- d.append(temp)",
"-if N... | false | 0.054649 | 0.036825 | 1.48402 | [
"s589614307",
"s681953692"
] |
u022979415 | p03325 | python | s827297633 | s521033858 | 84 | 68 | 4,148 | 4,148 | Accepted | Accepted | 19.05 | def main():
N = int(eval(input()))
numbers = list(map(int, input().split(" ")))
answer = 0
odds = 0
while odds < N:
odds = 0
for i in range(N):
if not numbers[i] % 2:
numbers[i] //= 2
answer += 1
else:
... | def main():
n = int(eval(input()))
a = [int(x) for x in input().split()]
answer = 0
for aa in a:
while aa > 0 and aa % 2 == 0:
aa //= 2
answer += 1
print(answer)
if __name__ == '__main__':
main()
| 18 | 14 | 388 | 262 | def main():
N = int(eval(input()))
numbers = list(map(int, input().split(" ")))
answer = 0
odds = 0
while odds < N:
odds = 0
for i in range(N):
if not numbers[i] % 2:
numbers[i] //= 2
answer += 1
else:
odds += 1
... | def main():
n = int(eval(input()))
a = [int(x) for x in input().split()]
answer = 0
for aa in a:
while aa > 0 and aa % 2 == 0:
aa //= 2
answer += 1
print(answer)
if __name__ == "__main__":
main()
| false | 22.222222 | [
"- N = int(eval(input()))",
"- numbers = list(map(int, input().split(\" \")))",
"+ n = int(eval(input()))",
"+ a = [int(x) for x in input().split()]",
"- odds = 0",
"- while odds < N:",
"- odds = 0",
"- for i in range(N):",
"- if not numbers[i] % 2:",
"- ... | false | 0.041646 | 0.040557 | 1.026835 | [
"s827297633",
"s521033858"
] |
u186838327 | p03165 | python | s950183430 | s823134490 | 516 | 349 | 119,132 | 149,792 | Accepted | Accepted | 32.36 | s = str(eval(input()))
t = str(eval(input()))
dp = [[-1]*3100 for _ in range(3100)]
# dp[i+1][j+1]: s[i], t[j]まで見たときのLCSの長さ
dp[0][0] = 0
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])... | s = str(eval(input()))
t = str(eval(input()))
dp = [[0]*3100 for _ in range(3100)]
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
dp[i+1][j+1] = max(dp[i+1][j+1... | 27 | 26 | 573 | 588 | s = str(eval(input()))
t = str(eval(input()))
dp = [[-1] * 3100 for _ in range(3100)]
# dp[i+1][j+1]: s[i], t[j]まで見たときのLCSの長さ
dp[0][0] = 0
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
dp[i + 1][j + 1] = max(dp[i +... | s = str(eval(input()))
t = str(eval(input()))
dp = [[0] * 3100 for _ in range(3100)]
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j])
dp[i + 1][j + 1] = m... | false | 3.703704 | [
"-dp = [[-1] * 3100 for _ in range(3100)]",
"-# dp[i+1][j+1]: s[i], t[j]まで見たときのLCSの長さ",
"-dp[0][0] = 0",
"+dp = [[0] * 3100 for _ in range(3100)]",
"-ans = \"\"",
"+ans = []",
"- ans = s[i - 1] + ans",
"+ ans.append(s[i - 1])",
"-print(ans)",
"+ans.reverse()",
"+print((\"\".join(an... | false | 0.035339 | 0.0356 | 0.99268 | [
"s950183430",
"s823134490"
] |
u809819902 | p02835 | python | s550236385 | s732640668 | 32 | 29 | 9,072 | 9,156 | Accepted | Accepted | 9.38 | a = list(map(int, input().split()))
print(("bust" if sum(a)>=22 else "win")) | a=list(map(int, input().split()))
b=sum(a)
print(("bust" if b>=22 else "win")) | 2 | 3 | 69 | 78 | a = list(map(int, input().split()))
print(("bust" if sum(a) >= 22 else "win"))
| a = list(map(int, input().split()))
b = sum(a)
print(("bust" if b >= 22 else "win"))
| false | 33.333333 | [
"-print((\"bust\" if sum(a) >= 22 else \"win\"))",
"+b = sum(a)",
"+print((\"bust\" if b >= 22 else \"win\"))"
] | false | 0.046503 | 0.047123 | 0.986858 | [
"s550236385",
"s732640668"
] |
u579699847 | p03163 | python | s663987185 | s334751257 | 738 | 358 | 121,200 | 22,440 | Accepted | Accepted | 51.49 | import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)] #1_indexed
for i,j in itertools.product(list(range(N)),list(range(W+1))):
w,v = wv[i]
if j-w>=0:
dp[i+1][j] = max(dp[i+1][j],dp... | import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = np.zeros(W+1,dtype=int) #1_indexed
for i in range(N):
w,v = wv[i]
dp[w:] = np.fmax(dp[:-w]+v,dp[w:])
print((dp[-1]))
| 11 | 9 | 382 | 270 | import itertools, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, W = LI()
wv = [LI() for _ in range(N)]
dp = [[0] * (W + 1) for _ in range(N + 1)] # 1_indexed
for i, j in itertools.product(list(range(N)), list(range(W + 1))):
w, v = wv[i]
if j - w >= 0:
dp[i + 1][... | import numpy as np, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, W = LI()
wv = [LI() for _ in range(N)]
dp = np.zeros(W + 1, dtype=int) # 1_indexed
for i in range(N):
w, v = wv[i]
dp[w:] = np.fmax(dp[:-w] + v, dp[w:])
print((dp[-1]))
| false | 18.181818 | [
"-import itertools, sys",
"+import numpy as np, sys",
"-dp = [[0] * (W + 1) for _ in range(N + 1)] # 1_indexed",
"-for i, j in itertools.product(list(range(N)), list(range(W + 1))):",
"+dp = np.zeros(W + 1, dtype=int) # 1_indexed",
"+for i in range(N):",
"- if j - w >= 0:",
"- dp[i + 1][j]... | false | 0.038694 | 0.182154 | 0.212426 | [
"s663987185",
"s334751257"
] |
u687574784 | p02712 | python | s340899127 | s719668769 | 113 | 21 | 30,120 | 9,008 | Accepted | Accepted | 81.42 | print((sum([i for i in range(1, int(eval(input()))+1) if i%3!=0 and i%5!=0]))) | n = int(eval(input()))
def s(n):
return n*(n+1)//2
print((s(n) - s(n//3)*3 - s(n//5)*5 + s(n//15)*15)) | 1 | 4 | 70 | 101 | print((sum([i for i in range(1, int(eval(input())) + 1) if i % 3 != 0 and i % 5 != 0])))
| n = int(eval(input()))
def s(n):
return n * (n + 1) // 2
print((s(n) - s(n // 3) * 3 - s(n // 5) * 5 + s(n // 15) * 15))
| false | 75 | [
"-print((sum([i for i in range(1, int(eval(input())) + 1) if i % 3 != 0 and i % 5 != 0])))",
"+n = int(eval(input()))",
"+",
"+",
"+def s(n):",
"+ return n * (n + 1) // 2",
"+",
"+",
"+print((s(n) - s(n // 3) * 3 - s(n // 5) * 5 + s(n // 15) * 15))"
] | false | 0.006632 | 0.031103 | 0.213237 | [
"s340899127",
"s719668769"
] |
u562935282 | p02883 | python | s482383063 | s733692002 | 648 | 569 | 122,900 | 122,132 | Accepted | Accepted | 12.19 | def binary_search(*, ok, ng, func):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if func(mid):
ok = mid
else:
ng = mid
return ok
def main():
N, K = list(map(int, input().split()))
*A, = sorted(map(int, input().split()))
*F, = sorted(map(... | # https://atcoder.jp/contests/abc144/submissions/8168248
# is_okでscoreを割るアイディア
def binary_search(*, ok, ng, func):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if func(mid):
ok = mid
else:
ng = mid
return ok
def main():
N, K = list(map(int, in... | 32 | 32 | 789 | 759 | def binary_search(*, ok, ng, func):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if func(mid):
ok = mid
else:
ng = mid
return ok
def main():
N, K = list(map(int, input().split()))
(*A,) = sorted(map(int, input().split()))
(*F,) = sorted(map(int, inpu... | # https://atcoder.jp/contests/abc144/submissions/8168248
# is_okでscoreを割るアイディア
def binary_search(*, ok, ng, func):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if func(mid):
ok = mid
else:
ng = mid
return ok
def main():
N, K = list(map(int, input().split()))... | false | 0 | [
"+# https://atcoder.jp/contests/abc144/submissions/8168248",
"+# is_okでscoreを割るアイディア",
"- exceed = max(0, a * f - score)",
"- if exceed:",
"- need = (exceed + f - 1) // f",
"- if need > a or need > rest:",
"- return False",
"- ... | false | 0.114133 | 0.042107 | 2.710558 | [
"s482383063",
"s733692002"
] |
u129749062 | p02641 | python | s181168922 | s592950420 | 37 | 27 | 9,188 | 9,184 | Accepted | Accepted | 27.03 | import sys
X ,N = list(map(int,input().split()))
p = list(map(int,input().split()))
min_dif = 10000
output = 10000
for i in range(10000):
if (5000 - i in p) == False:
if abs(X-(5000-i)) <= min_dif:
min_dif = abs(X-(5000 - i))
output = 5000 - i
print(output)
| X,N = list(map(int,input().split()))
p = list(map(int,input().split()))
p.sort()
diff = 100000
ans = 0
for i in range(-200, 200):
if i not in p:
if abs(X-i) < diff:
diff = abs(X-i)
ans = i
print(ans) | 13 | 11 | 292 | 221 | import sys
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
min_dif = 10000
output = 10000
for i in range(10000):
if (5000 - i in p) == False:
if abs(X - (5000 - i)) <= min_dif:
min_dif = abs(X - (5000 - i))
output = 5000 - i
print(output)
| X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
diff = 100000
ans = 0
for i in range(-200, 200):
if i not in p:
if abs(X - i) < diff:
diff = abs(X - i)
ans = i
print(ans)
| false | 15.384615 | [
"-import sys",
"-",
"-min_dif = 10000",
"-output = 10000",
"-for i in range(10000):",
"- if (5000 - i in p) == False:",
"- if abs(X - (5000 - i)) <= min_dif:",
"- min_dif = abs(X - (5000 - i))",
"- output = 5000 - i",
"-print(output)",
"+p.sort()",
"+diff = 1000... | false | 0.101506 | 0.122056 | 0.831632 | [
"s181168922",
"s592950420"
] |
u102461423 | p02702 | python | s238879261 | s127185462 | 1,398 | 344 | 29,156 | 29,012 | Accepted | Accepted | 75.39 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % 2019
dp = np.roll(d... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % 2019
newdp = np.emp... | 36 | 39 | 718 | 802 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % 2019
dp = np.roll(dp, x)
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % 2019
newdp = np.empty_like(dp)
... | false | 7.692308 | [
"- dp = np.roll(dp, x)",
"+ newdp = np.empty_like(dp)",
"+ newdp[x:] = dp[:-x]",
"+ newdp[:x] = dp[-x:]",
"+ dp = newdp"
] | false | 0.266237 | 0.257632 | 1.033402 | [
"s238879261",
"s127185462"
] |
u095021077 | p03037 | python | s871989987 | s308478670 | 574 | 457 | 44,136 | 12,504 | Accepted | Accepted | 20.38 | temp=input().split()
N=int(temp[0])
M=int(temp[1])
Lmax=int(0)
Rmin=int(N-1)
for i in range(M):
temp=list(map(int, input().split()))
if Lmax<temp[0]-1:
Lmax=temp[0]-1
if Rmin>temp[1]-1:
Rmin=temp[1]-1
if Rmin>=Lmax:
print((Rmin-Lmax+1))
else:
print((0)) | import numpy as np
N, M=list(map(int, input().split()))
L=1
R=N
for i in range(M):
temp=list(map(int, input().split()))
if L<temp[0]:
L=temp[0]
if R>temp[1]:
R=temp[1]
temp=int(R-L+1)
if temp>0:
print(temp)
else:
print((0)) | 18 | 21 | 295 | 269 | temp = input().split()
N = int(temp[0])
M = int(temp[1])
Lmax = int(0)
Rmin = int(N - 1)
for i in range(M):
temp = list(map(int, input().split()))
if Lmax < temp[0] - 1:
Lmax = temp[0] - 1
if Rmin > temp[1] - 1:
Rmin = temp[1] - 1
if Rmin >= Lmax:
print((Rmin - Lmax + 1))
else:
print... | import numpy as np
N, M = list(map(int, input().split()))
L = 1
R = N
for i in range(M):
temp = list(map(int, input().split()))
if L < temp[0]:
L = temp[0]
if R > temp[1]:
R = temp[1]
temp = int(R - L + 1)
if temp > 0:
print(temp)
else:
print((0))
| false | 14.285714 | [
"-temp = input().split()",
"-N = int(temp[0])",
"-M = int(temp[1])",
"-Lmax = int(0)",
"-Rmin = int(N - 1)",
"+import numpy as np",
"+",
"+N, M = list(map(int, input().split()))",
"+L = 1",
"+R = N",
"- if Lmax < temp[0] - 1:",
"- Lmax = temp[0] - 1",
"- if Rmin > temp[1] - 1:",... | false | 0.040255 | 0.036775 | 1.094638 | [
"s871989987",
"s308478670"
] |
u729133443 | p03240 | python | s319870854 | s005737408 | 281 | 48 | 50,140 | 3,928 | Accepted | Accepted | 82.92 | n=int(eval(input()))
p=[list(map(int,input().split()))for _ in range(n)]
ax,ay,ah=list([x for x in p if x[2]])[0]
for x in range(101):
for y in range(101):
H=ah+abs(ax-x)+abs(ay-y)
if all(max(H-abs(t[0]-x)-abs(t[1]-y),0)==t[2]for t in p):
print((x,y,H)) |
n=int(eval(input()));p=eval('list(map(int,input().split())),'*n);x,y,h=[x for x in p if x[2]][0]
for I in range(10201):j,i=I//101,I%101;H=h+abs(x-j)+abs(y-i);print((*(j,i,H)*all(max(H-abs(t[0]-j)-abs(t[1]-i),0)==t[2]for t in p))) | 8 | 3 | 269 | 224 | n = int(eval(input()))
p = [list(map(int, input().split())) for _ in range(n)]
ax, ay, ah = list([x for x in p if x[2]])[0]
for x in range(101):
for y in range(101):
H = ah + abs(ax - x) + abs(ay - y)
if all(max(H - abs(t[0] - x) - abs(t[1] - y), 0) == t[2] for t in p):
print((x, y, H))
| n = int(eval(input()))
p = eval("list(map(int,input().split()))," * n)
x, y, h = [x for x in p if x[2]][0]
for I in range(10201):
j, i = I // 101, I % 101
H = h + abs(x - j) + abs(y - i)
print(
(*(j, i, H) * all(max(H - abs(t[0] - j) - abs(t[1] - i), 0) == t[2] for t in p))
)
| false | 62.5 | [
"-p = [list(map(int, input().split())) for _ in range(n)]",
"-ax, ay, ah = list([x for x in p if x[2]])[0]",
"-for x in range(101):",
"- for y in range(101):",
"- H = ah + abs(ax - x) + abs(ay - y)",
"- if all(max(H - abs(t[0] - x) - abs(t[1] - y), 0) == t[2] for t in p):",
"- ... | false | 0.159912 | 0.063153 | 2.53216 | [
"s319870854",
"s005737408"
] |
u094191970 | p03085 | python | s861035105 | s413905361 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | b=eval(input())
print(('A' if b=='T' else 'T' if b=='A' else 'C' if b=='G' else 'G')) | s=eval(input())
print(('T' if s=='A' else 'G' if s=='C' else 'A' if s=='T' else 'C')) | 2 | 2 | 78 | 78 | b = eval(input())
print(("A" if b == "T" else "T" if b == "A" else "C" if b == "G" else "G"))
| s = eval(input())
print(("T" if s == "A" else "G" if s == "C" else "A" if s == "T" else "C"))
| false | 0 | [
"-b = eval(input())",
"-print((\"A\" if b == \"T\" else \"T\" if b == \"A\" else \"C\" if b == \"G\" else \"G\"))",
"+s = eval(input())",
"+print((\"T\" if s == \"A\" else \"G\" if s == \"C\" else \"A\" if s == \"T\" else \"C\"))"
] | false | 0.049068 | 0.050953 | 0.962996 | [
"s861035105",
"s413905361"
] |
u476124554 | p03111 | python | s033355915 | s851744287 | 245 | 73 | 3,192 | 4,984 | Accepted | Accepted | 70.2 | from itertools import combinations
def f(in_A,in_B,in_C,A,B,C,ex_l,counter):
if (counter == len(ex_l)):
return abs(in_A-A)+abs(in_B-B)+abs(in_C-C)
else:
tmp = ex_l[counter]
counter +=1
a1 = f(in_A+tmp,in_B,in_C,A,B,C,ex_l,counter)+10
a2 = f(in_A,in_B+tmp,in_C,A,... | n,a,b,c = list(map(int,input().split()))
l = []
ans = []
for i in range(n):
l.append(int(eval(input())))
def f(x,y,z,arr,ca,cb,cc):
global a
global b
global c
global ans
if arr:
f(x + arr[0], y, z, arr[1:],ca+1,cb,cc)
f(x, y + arr[0], z, arr[1:],ca,cb+1,cc)
... | 35 | 21 | 1,249 | 559 | from itertools import combinations
def f(in_A, in_B, in_C, A, B, C, ex_l, counter):
if counter == len(ex_l):
return abs(in_A - A) + abs(in_B - B) + abs(in_C - C)
else:
tmp = ex_l[counter]
counter += 1
a1 = f(in_A + tmp, in_B, in_C, A, B, C, ex_l, counter) + 10
a2 = f(in... | n, a, b, c = list(map(int, input().split()))
l = []
ans = []
for i in range(n):
l.append(int(eval(input())))
def f(x, y, z, arr, ca, cb, cc):
global a
global b
global c
global ans
if arr:
f(x + arr[0], y, z, arr[1:], ca + 1, cb, cc)
f(x, y + arr[0], z, arr[1:], ca, cb + 1, cc)
... | false | 40 | [
"-from itertools import combinations",
"+n, a, b, c = list(map(int, input().split()))",
"+l = []",
"+ans = []",
"+for i in range(n):",
"+ l.append(int(eval(input())))",
"-def f(in_A, in_B, in_C, A, B, C, ex_l, counter):",
"- if counter == len(ex_l):",
"- return abs(in_A - A) + abs(in_B ... | false | 0.631062 | 0.137399 | 4.592923 | [
"s033355915",
"s851744287"
] |
u023958502 | p03078 | python | s406476908 | s200166740 | 827 | 36 | 4,592 | 4,852 | Accepted | Accepted | 95.65 | import heapq
X,Y,Z,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
asort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)
already = [[0,0,0]]
print((asort[0] + bsort[0] + csort[0]))
x,y,... | import heapq
_x, _y, _z, k = list(map(int, input().split()))
aa = list(reversed(sorted(map(int, input().split()))))
bb = list(reversed(sorted(map(int, input().split()))))
cc = list(reversed(sorted(map(int, input().split()))))
ar = []
history = set()
def push(x, y, z):
if (x, y, z) in history:
... | 23 | 35 | 962 | 773 | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
asort, bsort, csort = (
sorted(A, reverse=True),
sorted(B, reverse=True),
sorted(C, reverse=True),
)
already = [[0, 0, 0]]
print((asort[0] + ... | import heapq
_x, _y, _z, k = list(map(int, input().split()))
aa = list(reversed(sorted(map(int, input().split()))))
bb = list(reversed(sorted(map(int, input().split()))))
cc = list(reversed(sorted(map(int, input().split()))))
ar = []
history = set()
def push(x, y, z):
if (x, y, z) in history:
pass
el... | false | 34.285714 | [
"-X, Y, Z, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"-asort, bsort, csort = (",
"- sorted(A, reverse=True),",
"- sorted(B, reverse=True),",
"- sorted(C, reverse=True),",
"-)"... | false | 0.101503 | 0.037837 | 2.68262 | [
"s406476908",
"s200166740"
] |
u301624971 | p02861 | python | s017392208 | s621460463 | 383 | 18 | 3,064 | 3,064 | Accepted | Accepted | 95.3 | import itertools
import math
N=int(eval(input()))
x=[]
y=[]
for _ in range(N):
x1,y1=list(map(int,input().split()))
x.append(x1)
y.append(y1)
conut=[i for i in range(N)]
conb=itertools.permutations(conut, N)
total=0
for n,c in enumerate(conb):
for i in range(N-1):
n1=c[... | import itertools
N=int(eval(input()))
XY=[]
for _ in range(N):
tmp=list(map(int,input().split()))
XY.append(tmp)
l=[i for i in range(N)]
permutation = itertools.permutations(l, 2)
total=0
for p in permutation:
i=p[0]
j=p[1]
total+=((XY[i][0] - XY[j][0])**2 + (XY[i][1] - XY[j][1])**2)**0.... | 26 | 15 | 432 | 333 | import itertools
import math
N = int(eval(input()))
x = []
y = []
for _ in range(N):
x1, y1 = list(map(int, input().split()))
x.append(x1)
y.append(y1)
conut = [i for i in range(N)]
conb = itertools.permutations(conut, N)
total = 0
for n, c in enumerate(conb):
for i in range(N - 1):
n1 = c[i]
... | import itertools
N = int(eval(input()))
XY = []
for _ in range(N):
tmp = list(map(int, input().split()))
XY.append(tmp)
l = [i for i in range(N)]
permutation = itertools.permutations(l, 2)
total = 0
for p in permutation:
i = p[0]
j = p[1]
total += ((XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1])... | false | 42.307692 | [
"-import math",
"-x = []",
"-y = []",
"+XY = []",
"- x1, y1 = list(map(int, input().split()))",
"- x.append(x1)",
"- y.append(y1)",
"-conut = [i for i in range(N)]",
"-conb = itertools.permutations(conut, N)",
"+ tmp = list(map(int, input().split()))",
"+ XY.append(tmp)",
"+l = ... | false | 0.081931 | 0.03847 | 2.129755 | [
"s017392208",
"s621460463"
] |
u006880673 | p02936 | python | s159996988 | s363202559 | 1,507 | 1,129 | 193,492 | 239,840 | Accepted | Accepted | 25.08 | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
a = [0]*(N) #1 index
b = [0]*(N) #1 index
p = [0]*(Q+1) #1 index
x = [0]*(Q+1) #1 index
counter = [0]*(N+1) #1 index
for i in range(1, N):
a[i], b[i] = list(map(int, input().split()))
for i in range(1, Q+1):
p[i], x[i] = l... | from collections import deque, defaultdict
N, Q = list(map(int, input().split()))
G = defaultdict(lambda: deque())
for _ in range(N-1):
a,b = list(map(int, input().split()))
G[a].append(b)
G[b].append(a)
cnt = [0]*(N+1)
for _ in range(Q):
p, x = list(map(int, input().split()))
cnt[p] ... | 41 | 31 | 916 | 708 | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
a = [0] * (N) # 1 index
b = [0] * (N) # 1 index
p = [0] * (Q + 1) # 1 index
x = [0] * (Q + 1) # 1 index
counter = [0] * (N + 1) # 1 index
for i in range(1, N):
a[i], b[i] = list(map(int, input().split()))
for i in range(1, Q + 1):
... | from collections import deque, defaultdict
N, Q = list(map(int, input().split()))
G = defaultdict(lambda: deque())
for _ in range(N - 1):
a, b = list(map(int, input().split()))
G[a].append(b)
G[b].append(a)
cnt = [0] * (N + 1)
for _ in range(Q):
p, x = list(map(int, input().split()))
cnt[p] += x
... | false | 24.390244 | [
"-import sys",
"+from collections import deque, defaultdict",
"-input = sys.stdin.readline",
"-a = [0] * (N) # 1 index",
"-b = [0] * (N) # 1 index",
"-p = [0] * (Q + 1) # 1 index",
"-x = [0] * (Q + 1) # 1 index",
"-counter = [0] * (N + 1) # 1 index",
"-for i in range(1, N):",
"- a[i], b[i]... | false | 0.047546 | 0.043613 | 1.090168 | [
"s159996988",
"s363202559"
] |
u279493135 | p03103 | python | s781534679 | s741268569 | 1,951 | 302 | 22,384 | 29,024 | Accepted | Accepted | 84.52 | N, M = list(map(int, input().split()))
A_B = []
for i in range(N):
A_B.append([int(x) for x in input().split()])
money = 0
count = 0
A_B = sorted(A_B)
while count < M:
if count+A_B[0][1] <= M:
count += A_B[0][1]
money += A_B[0][0] * A_B[0][1]
else:
money += A_B[0][0] * ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | 17 | 35 | 373 | 1,064 | N, M = list(map(int, input().split()))
A_B = []
for i in range(N):
A_B.append([int(x) for x in input().split()])
money = 0
count = 0
A_B = sorted(A_B)
while count < M:
if count + A_B[0][1] <= M:
count += A_B[0][1]
money += A_B[0][0] * A_B[0][1]
else:
money += A_B[0][0] * (M - count)
... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | false | 51.428571 | [
"-N, M = list(map(int, input().split()))",
"-A_B = []",
"-for i in range(N):",
"- A_B.append([int(x) for x in input().split()])",
"-money = 0",
"-count = 0",
"-A_B = sorted(A_B)",
"-while count < M:",
"- if count + A_B[0][1] <= M:",
"- count += A_B[0][1]",
"- money += A_B[0][... | false | 0.040967 | 0.035867 | 1.142181 | [
"s781534679",
"s741268569"
] |
u886747123 | p03176 | python | s949437682 | s761034479 | 1,819 | 1,495 | 124,880 | 124,880 | Accepted | Accepted | 17.81 | N = int(eval(input()))
h = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 2
while num <= N+1:
num *= 2
seg = [0]*(2*num-1)
#update(i,x):Aiをxに更新する
def update(i,x):
k = i + num - 1
while k >= 0:
seg[k] = max(x,seg[k])
k = (k-1)//2
#query(a,b,0,0,... | N = int(eval(input()))
h = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 2**((N+1).bit_length())
seg = [0]*(2*num-1)
#update(i,x):Aiをxに更新する
def update(i,x):
k = i + num - 1
while k >= 0:
seg[k] = max(x,seg[k])
k = (k-1)//2
#query(a,b,0,0,num):[a,b)の... | 31 | 29 | 627 | 616 | N = int(eval(input()))
h = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 2
while num <= N + 1:
num *= 2
seg = [0] * (2 * num - 1)
# update(i,x):Aiをxに更新する
def update(i, x):
k = i + num - 1
while k >= 0:
seg[k] = max(x, seg[k])
k = (k - 1) // 2
# query(a,b,0,0,num... | N = int(eval(input()))
h = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 2 ** ((N + 1).bit_length())
seg = [0] * (2 * num - 1)
# update(i,x):Aiをxに更新する
def update(i, x):
k = i + num - 1
while k >= 0:
seg[k] = max(x, seg[k])
k = (k - 1) // 2
# query(a,b,0,0,num):[a,b)... | false | 6.451613 | [
"-num = 2",
"-while num <= N + 1:",
"- num *= 2",
"+num = 2 ** ((N + 1).bit_length())"
] | false | 0.049156 | 0.044177 | 1.112708 | [
"s949437682",
"s761034479"
] |
u989345508 | p03287 | python | s580250235 | s829195788 | 390 | 86 | 14,484 | 14,628 | Accepted | Accepted | 77.95 | from itertools import accumulate
from collections import Counter
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,m=list(map(int,input().split()))
s=list([x%m for x in list(accumulate(list(map(int,input().split()))))])
s.append(0)
#print... | from itertools import accumulate
from collections import Counter
n,m=list(map(int,input().split()))
s=[0]+list([x%m for x in list(accumulate(list(map(int,input().split()))))])
ans=0
for i in list(Counter(s).values()):
ans+=(i*(i-1)//2)
print(ans) | 18 | 8 | 435 | 248 | from itertools import accumulate
from collections import Counter
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, m = list(map(int, input().split()))
s = list([x % m for x in list(accumulate(list(map(int, input().split()))))])
s.append(0)
# pri... | from itertools import accumulate
from collections import Counter
n, m = list(map(int, input().split()))
s = [0] + list([x % m for x in list(accumulate(list(map(int, input().split()))))])
ans = 0
for i in list(Counter(s).values()):
ans += i * (i - 1) // 2
print(ans)
| false | 55.555556 | [
"-import math",
"-",
"-",
"-def combinations_count(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"-s = list([x % m for x in list(accumulate(list(map(int, input().split()))))])",
"-s.append(0)",
"-# print(s)",
"-d = Counter(s)",
"-# print(d)",
"+s... | false | 0.072356 | 0.043143 | 1.677128 | [
"s580250235",
"s829195788"
] |
u426764965 | p02596 | python | s609194585 | s654585481 | 1,750 | 125 | 9,164 | 9,156 | Accepted | Accepted | 92.86 | k = int(eval(input()))
x = 0
ans = -1
if k % 2 == 1:
for i in range(10**6):
x = (x + 7 * pow(10, i, k)) % k
if x == 0:
ans = i + 1
break
print(ans) | def abc174_c():
k = int(eval(input()))
ans = -1
if k % 2 == 0 or k % 5 == 0:
return ans
f = 0
for i in range(k+1):
f = (f * 10 + 7) % k
if f == 0:
ans = i + 1
break
return ans
if __name__ == '__main__':
print((abc174_c())) | 10 | 15 | 194 | 305 | k = int(eval(input()))
x = 0
ans = -1
if k % 2 == 1:
for i in range(10**6):
x = (x + 7 * pow(10, i, k)) % k
if x == 0:
ans = i + 1
break
print(ans)
| def abc174_c():
k = int(eval(input()))
ans = -1
if k % 2 == 0 or k % 5 == 0:
return ans
f = 0
for i in range(k + 1):
f = (f * 10 + 7) % k
if f == 0:
ans = i + 1
break
return ans
if __name__ == "__main__":
print((abc174_c()))
| false | 33.333333 | [
"-k = int(eval(input()))",
"-x = 0",
"-ans = -1",
"-if k % 2 == 1:",
"- for i in range(10**6):",
"- x = (x + 7 * pow(10, i, k)) % k",
"- if x == 0:",
"+def abc174_c():",
"+ k = int(eval(input()))",
"+ ans = -1",
"+ if k % 2 == 0 or k % 5 == 0:",
"+ return ans",... | false | 0.610075 | 0.052714 | 11.573206 | [
"s609194585",
"s654585481"
] |
u218843509 | p02962 | python | s259346084 | s467381162 | 912 | 376 | 56,848 | 133,304 | Accepted | Accepted | 58.77 | import sys
def input():
return sys.stdin.readline()[:-1]
class KMP():
def __init__(self, sentence):
self.sentence = sent = sentence
self.l = l = len(sent)
self.table = table = [0 for _ in range(l+1)]
table[0] = -1
j = -1
for i in range(l):
while j >= 0 and sent[i] != sent[j]:
j = tabl... | import sys
def input():
return sys.stdin.readline()[:-1]
def Z_algorithm(s):
l = len(s)
res = [-1 for _ in range(l)]
res[0] = l
i, j = 1, 0
while i < l:
while i+j < l and s[j] == s[i+j]:
j += 1
res[i] = j
if j == 0:
i += 1
continue
else:
k = 1
while i+k < l and k + res[... | 94 | 86 | 1,630 | 1,379 | import sys
def input():
return sys.stdin.readline()[:-1]
class KMP:
def __init__(self, sentence):
self.sentence = sent = sentence
self.l = l = len(sent)
self.table = table = [0 for _ in range(l + 1)]
table[0] = -1
j = -1
for i in range(l):
while j ... | import sys
def input():
return sys.stdin.readline()[:-1]
def Z_algorithm(s):
l = len(s)
res = [-1 for _ in range(l)]
res[0] = l
i, j = 1, 0
while i < l:
while i + j < l and s[j] == s[i + j]:
j += 1
res[i] = j
if j == 0:
i += 1
conti... | false | 8.510638 | [
"-class KMP:",
"- def __init__(self, sentence):",
"- self.sentence = sent = sentence",
"- self.l = l = len(sent)",
"- self.table = table = [0 for _ in range(l + 1)]",
"- table[0] = -1",
"- j = -1",
"- for i in range(l):",
"- while j >= 0 and se... | false | 0.032185 | 0.13867 | 0.2321 | [
"s259346084",
"s467381162"
] |
u818050295 | p03721 | python | s409866943 | s946575110 | 384 | 300 | 5,924 | 5,928 | Accepted | Accepted | 21.88 | tmp1 = list(map(int, input().split(" ")))
num = [0 for i in range(10**5)]
for i in range(tmp1[0]):
tmp = list(map(int, input().split(" ")))
num[tmp[0]-1] += tmp[1]
tmp = 0
i = 0
while tmp < tmp1[1]:
tmp = tmp + num[i]
if tmp >= tmp1[1]:
print((i+1))
i = i + 1 | tmp = input().split(" ")
K = int(tmp[1])
num = [0 for i in range(10**5)]
for i in range(int(tmp[0])):
tmp = input().split(" ")
num[int(tmp[0])-1] += int(tmp[1])
tmp = 0
i = 0
while tmp < K:
tmp = tmp + num[i]
if tmp >= K:
print((i+1))
i = i + 1 | 12 | 15 | 296 | 291 | tmp1 = list(map(int, input().split(" ")))
num = [0 for i in range(10**5)]
for i in range(tmp1[0]):
tmp = list(map(int, input().split(" ")))
num[tmp[0] - 1] += tmp[1]
tmp = 0
i = 0
while tmp < tmp1[1]:
tmp = tmp + num[i]
if tmp >= tmp1[1]:
print((i + 1))
i = i + 1
| tmp = input().split(" ")
K = int(tmp[1])
num = [0 for i in range(10**5)]
for i in range(int(tmp[0])):
tmp = input().split(" ")
num[int(tmp[0]) - 1] += int(tmp[1])
tmp = 0
i = 0
while tmp < K:
tmp = tmp + num[i]
if tmp >= K:
print((i + 1))
i = i + 1
| false | 20 | [
"-tmp1 = list(map(int, input().split(\" \")))",
"+tmp = input().split(\" \")",
"+K = int(tmp[1])",
"-for i in range(tmp1[0]):",
"- tmp = list(map(int, input().split(\" \")))",
"- num[tmp[0] - 1] += tmp[1]",
"+for i in range(int(tmp[0])):",
"+ tmp = input().split(\" \")",
"+ num[int(tmp[0... | false | 0.159084 | 0.130407 | 1.219905 | [
"s409866943",
"s946575110"
] |
u477320129 | p02887 | python | s168671440 | s938864998 | 324 | 63 | 4,108 | 15,988 | Accepted | Accepted | 80.56 | from functools import reduce
_ = eval(input())
S = eval(input())
print((len(reduce(lambda a, b: a if a[-1] == b else a + b , S[1:], S[0])))) | from itertools import groupby
_ = eval(input())
print((len(tuple(groupby(eval(input()))))))
| 4 | 3 | 129 | 80 | from functools import reduce
_ = eval(input())
S = eval(input())
print((len(reduce(lambda a, b: a if a[-1] == b else a + b, S[1:], S[0]))))
| from itertools import groupby
_ = eval(input())
print((len(tuple(groupby(eval(input()))))))
| false | 25 | [
"-from functools import reduce",
"+from itertools import groupby",
"-S = eval(input())",
"-print((len(reduce(lambda a, b: a if a[-1] == b else a + b, S[1:], S[0]))))",
"+print((len(tuple(groupby(eval(input()))))))"
] | false | 0.054146 | 0.0417 | 1.298454 | [
"s168671440",
"s938864998"
] |
u079022693 | p02629 | python | s140840269 | s098451820 | 30 | 25 | 9,152 | 9,172 | Accepted | Accepted | 16.67 | def to_n(x,n):
ans=[]
if x==0:
return [0]
while x>0:
x-=1
ans.append(x%n)
x//=n
return ans[::-1]
from sys import stdin
def main():
#入力
readline=stdin.readline
n=int(readline())
alp=[chr(i) for i in range(97,97+26)]
m=to_n(n,26)
... | def to_n(x,n,cnt):
ans=[]
for _ in range(cnt):
ans.append(x%n)
x//=n
return ans[::-1]
from sys import stdin
def main():
#入力
readline=stdin.readline
n=int(readline())
alp=[chr(i) for i in range(97,97+26)]
tmp=26
cnt=1
while n>tmp:
n-=tm... | 23 | 29 | 423 | 501 | def to_n(x, n):
ans = []
if x == 0:
return [0]
while x > 0:
x -= 1
ans.append(x % n)
x //= n
return ans[::-1]
from sys import stdin
def main():
# 入力
readline = stdin.readline
n = int(readline())
alp = [chr(i) for i in range(97, 97 + 26)]
m = to_n(n... | def to_n(x, n, cnt):
ans = []
for _ in range(cnt):
ans.append(x % n)
x //= n
return ans[::-1]
from sys import stdin
def main():
# 入力
readline = stdin.readline
n = int(readline())
alp = [chr(i) for i in range(97, 97 + 26)]
tmp = 26
cnt = 1
while n > tmp:
... | false | 20.689655 | [
"-def to_n(x, n):",
"+def to_n(x, n, cnt):",
"- if x == 0:",
"- return [0]",
"- while x > 0:",
"- x -= 1",
"+ for _ in range(cnt):",
"- m = to_n(n, 26)",
"- ans = [alp[m[i]] for i in range(len(m))]",
"- print((\"\".join(ans)))",
"+ tmp = 26",
"+ cnt = 1",
... | false | 0.034797 | 0.076568 | 0.454454 | [
"s140840269",
"s098451820"
] |
u864090097 | p02584 | python | s998159752 | s273711296 | 37 | 29 | 9,172 | 9,116 | Accepted | Accepted | 21.62 | X, K, D = list(map(int ,input().split()))
if K * D < abs(X):
ans = abs(X) - K * D
else:
if abs(X) // D % 2 == 0:
if K % 2 == 0:
ans = abs(X) % D
else:
ans = abs(abs(X) % D - D)
else:
if K % 2 == 0:
ans = abs(abs(X) % D - D)
el... | X, K, D = list(map(int ,input().split()))
X = abs(X)
if K * D < X:
ans = X - K * D
else:
if X // D % 2 == 0:
if K % 2 == 0:
ans = X % D
else:
ans = abs(X % D - D)
else:
if K % 2 == 0:
ans = abs(X % D - D)
else:
a... | 17 | 18 | 361 | 339 | X, K, D = list(map(int, input().split()))
if K * D < abs(X):
ans = abs(X) - K * D
else:
if abs(X) // D % 2 == 0:
if K % 2 == 0:
ans = abs(X) % D
else:
ans = abs(abs(X) % D - D)
else:
if K % 2 == 0:
ans = abs(abs(X) % D - D)
else:
... | X, K, D = list(map(int, input().split()))
X = abs(X)
if K * D < X:
ans = X - K * D
else:
if X // D % 2 == 0:
if K % 2 == 0:
ans = X % D
else:
ans = abs(X % D - D)
else:
if K % 2 == 0:
ans = abs(X % D - D)
else:
ans = X % D
print... | false | 5.555556 | [
"-if K * D < abs(X):",
"- ans = abs(X) - K * D",
"+X = abs(X)",
"+if K * D < X:",
"+ ans = X - K * D",
"- if abs(X) // D % 2 == 0:",
"+ if X // D % 2 == 0:",
"- ans = abs(X) % D",
"+ ans = X % D",
"- ans = abs(abs(X) % D - D)",
"+ ans = abs... | false | 0.044004 | 0.049148 | 0.895336 | [
"s998159752",
"s273711296"
] |
u562935282 | p03105 | python | s100120702 | s200206595 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | a, b, c = list(map(int, input().split()))
max = (b // a)
print((max if max < c else c)) | A, B, C = list(map(int, input().split()))
print((min(B // A, C)))
| 5 | 2 | 85 | 59 | a, b, c = list(map(int, input().split()))
max = b // a
print((max if max < c else c))
| A, B, C = list(map(int, input().split()))
print((min(B // A, C)))
| false | 60 | [
"-a, b, c = list(map(int, input().split()))",
"-max = b // a",
"-print((max if max < c else c))",
"+A, B, C = list(map(int, input().split()))",
"+print((min(B // A, C)))"
] | false | 0.091317 | 0.120444 | 0.758163 | [
"s100120702",
"s200206595"
] |
u476604182 | p03837 | python | s048932680 | s958633309 | 549 | 239 | 64,092 | 17,244 | Accepted | Accepted | 56.47 | from collections import defaultdict
from heapq import heappush, heappop
N, M = list(map(int, input().split()))
dic = defaultdict(list)
Els = []
for i in range(M):
a, b, c = list(map(int, input().split()))
dic[a-1] += [(b-1,c)]
dic[b-1] += [(a-1, c)]
Els += [(a-1,b-1,c)]
def dijkstra(s,e):
dist = ... | from scipy.sparse.csgraph import shortest_path
N, M = list(map(int, input().split()))
dic = [[0]*N for i in range(N)]
Els = []
for i in range(M):
a, b, c = list(map(int, input().split()))
dic[a-1][b-1] = c
dic[b-1][a-1] = c
Els += [(a-1,b-1,c)]
d, p = shortest_path(dic, return_predecessors=True, method... | 34 | 16 | 696 | 389 | from collections import defaultdict
from heapq import heappush, heappop
N, M = list(map(int, input().split()))
dic = defaultdict(list)
Els = []
for i in range(M):
a, b, c = list(map(int, input().split()))
dic[a - 1] += [(b - 1, c)]
dic[b - 1] += [(a - 1, c)]
Els += [(a - 1, b - 1, c)]
def dijkstra(s,... | from scipy.sparse.csgraph import shortest_path
N, M = list(map(int, input().split()))
dic = [[0] * N for i in range(N)]
Els = []
for i in range(M):
a, b, c = list(map(int, input().split()))
dic[a - 1][b - 1] = c
dic[b - 1][a - 1] = c
Els += [(a - 1, b - 1, c)]
d, p = shortest_path(dic, return_predecess... | false | 52.941176 | [
"-from collections import defaultdict",
"-from heapq import heappush, heappop",
"+from scipy.sparse.csgraph import shortest_path",
"-dic = defaultdict(list)",
"+dic = [[0] * N for i in range(N)]",
"- dic[a - 1] += [(b - 1, c)]",
"- dic[b - 1] += [(a - 1, c)]",
"+ dic[a - 1][b - 1] = c",
"+ ... | false | 0.038827 | 0.304387 | 0.127559 | [
"s048932680",
"s958633309"
] |
u912237403 | p00070 | python | s401181428 | s713773506 | 3,580 | 2,850 | 4,252 | 4,252 | Accepted | Accepted | 20.39 | import sys
def f0070(A,n,s):
if n==1:
if s in A:f=1
else:f=0
return f
c=0
A=sorted(A)
A1=A[:n][::-1]
A2=A[-n:]
N=list(range(n))
def f(A):
return sum([(i+1)*A[i] for i in N])
if f(A1)<=s<=f(A2):
for i in range(len(A)):
b=s-A[i]*n
c+=f0070(A[:i]+A[i+1:],n-1,... | import sys
def f0070(A,n,s):
if n==1:return s in A
A=sorted(A)
A1=A[:n][::-1]
A2=A[-n:]
N=list(range(n))
b1=0
b2=0
c=0
for i in N:
b1+=(i+1)*A1[i]
b2+=(i+1)*A2[i]
if b1<=s<=b2:
for i in range(len(A)):
b=s-A[i]*n
c+=f0070(A[:i]+A[i+1:],n-1,b)
return c
for a... | 22 | 21 | 407 | 384 | import sys
def f0070(A, n, s):
if n == 1:
if s in A:
f = 1
else:
f = 0
return f
c = 0
A = sorted(A)
A1 = A[:n][::-1]
A2 = A[-n:]
N = list(range(n))
def f(A):
return sum([(i + 1) * A[i] for i in N])
if f(A1) <= s <= f(A2):
... | import sys
def f0070(A, n, s):
if n == 1:
return s in A
A = sorted(A)
A1 = A[:n][::-1]
A2 = A[-n:]
N = list(range(n))
b1 = 0
b2 = 0
c = 0
for i in N:
b1 += (i + 1) * A1[i]
b2 += (i + 1) * A2[i]
if b1 <= s <= b2:
for i in range(len(A)):
... | false | 4.545455 | [
"- if s in A:",
"- f = 1",
"- else:",
"- f = 0",
"- return f",
"- c = 0",
"+ return s in A",
"-",
"- def f(A):",
"- return sum([(i + 1) * A[i] for i in N])",
"-",
"- if f(A1) <= s <= f(A2):",
"+ b1 = 0",
"+ b2 = 0",
... | false | 0.036617 | 0.036246 | 1.010216 | [
"s401181428",
"s713773506"
] |
u023229441 | p03309 | python | s486033661 | s702065673 | 271 | 145 | 26,892 | 123,112 | Accepted | Accepted | 46.49 | import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここま... | n=int(eval(input()))
A=list(map(int,input().split()))
if n==1:print((0));exit()
A=[A[i]-i-1 for i in range(n)]
B=sorted(A)
#print(B)
if n%2==1:
d=B[n//2]
print((sum([abs(A[i]-d) for i in range(n)])))
exit()
ans=0
d=(B[n//2-1]+B[n//2])//2
print((sum([abs(A[i]-d) for i in range(n)])))
| 29 | 16 | 630 | 302 | import sys
import math
mod = 10**9 + 7
inf = float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input = lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
# メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
# 引数にlistはだめ
#######ここ... | n = int(eval(input()))
A = list(map(int, input().split()))
if n == 1:
print((0))
exit()
A = [A[i] - i - 1 for i in range(n)]
B = sorted(A)
# print(B)
if n % 2 == 1:
d = B[n // 2]
print((sum([abs(A[i] - d) for i in range(n)])))
exit()
ans = 0
d = (B[n // 2 - 1] + B[n // 2]) // 2
print((sum([abs(A[i] ... | false | 44.827586 | [
"-import sys",
"-import math",
"-",
"-mod = 10**9 + 7",
"-inf = float(\"inf\")",
"-from math import sqrt",
"-from collections import deque",
"-from collections import Counter",
"-",
"-input = lambda: sys.stdin.readline().strip()",
"-sys.setrecursionlimit(11451419)",
"-from functools import lru... | false | 0.083311 | 0.220692 | 0.3775 | [
"s486033661",
"s702065673"
] |
u576432509 | p03836 | python | s463328355 | s474281046 | 20 | 17 | 3,064 | 3,060 | Accepted | Accepted | 15 | sx,sy,tx,ty=list(map(int,input().split()))
dx=tx-sx
dy=ty-sy
root=""
for i in range(dy):
root=root+"U"
for i in range(dx):
root=root+"R"
for i in range(dy):
root=root+"D"
for i in range(dx):
root=root+"L"
root=root+"L"
for i in range(dy+1):
root=root+"U"
for i in range(dx+1)... | sx,sy,tx,ty=list(map(int,input().split()))
dx=tx-sx
dy=ty-sy
r="U"*dy+"R"*dx
r=r+"D"*dy+"L"*dx
r=r+"L"+"U"*(dy+1)+"R"*(dx+1)+"D"
r=r+"R"+"D"*(dy+1)+"L"*(dx+1)+"U"
print(r) | 31 | 10 | 486 | 176 | sx, sy, tx, ty = list(map(int, input().split()))
dx = tx - sx
dy = ty - sy
root = ""
for i in range(dy):
root = root + "U"
for i in range(dx):
root = root + "R"
for i in range(dy):
root = root + "D"
for i in range(dx):
root = root + "L"
root = root + "L"
for i in range(dy + 1):
root = root + "U"
for... | sx, sy, tx, ty = list(map(int, input().split()))
dx = tx - sx
dy = ty - sy
r = "U" * dy + "R" * dx
r = r + "D" * dy + "L" * dx
r = r + "L" + "U" * (dy + 1) + "R" * (dx + 1) + "D"
r = r + "R" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
print(r)
| false | 67.741935 | [
"-root = \"\"",
"-for i in range(dy):",
"- root = root + \"U\"",
"-for i in range(dx):",
"- root = root + \"R\"",
"-for i in range(dy):",
"- root = root + \"D\"",
"-for i in range(dx):",
"- root = root + \"L\"",
"-root = root + \"L\"",
"-for i in range(dy + 1):",
"- root = root ... | false | 0.067875 | 0.071222 | 0.953003 | [
"s463328355",
"s474281046"
] |
u083960235 | p02899 | python | s752592024 | s341530400 | 307 | 139 | 25,624 | 15,940 | Accepted | Accepted | 54.72 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 33 | 41 | 919 | 1,021 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 19.512195 | [
"-L = []",
"-for i, a in enumerate(A):",
"- L.append([i + 1, a])",
"-L = sorted(L, key=lambda x: x[1])",
"-ans = []",
"-for i in range(N):",
"- ans.append(L[i][0])",
"+ans = [0] * N",
"+for i in range(len(A)):",
"+ ans[A[i] - 1] = i + 1",
"+# L = []",
"+# for i, a in enumerate(A):",
... | false | 0.036835 | 0.036799 | 1.000986 | [
"s752592024",
"s341530400"
] |
u373047809 | p02744 | python | s217309901 | s756898408 | 195 | 156 | 17,884 | 24,176 | Accepted | Accepted | 20 | k = "a",
for _ in range(int(input()) - 1):
k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep='\n')
| k = "a",
for _ in range(int(eval(input())) - 1):
k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
for i in sorted(k):print(i) | 4 | 4 | 132 | 132 | k = ("a",)
for _ in range(int(input()) - 1):
k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep="\n")
| k = ("a",)
for _ in range(int(eval(input())) - 1):
k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
for i in sorted(k):
print(i)
| false | 0 | [
"-for _ in range(int(input()) - 1):",
"+for _ in range(int(eval(input())) - 1):",
"-print(*sorted(k), sep=\"\\n\")",
"+for i in sorted(k):",
"+ print(i)"
] | false | 0.039359 | 0.037045 | 1.06247 | [
"s217309901",
"s756898408"
] |
u022979415 | p03295 | python | s767956331 | s613752435 | 455 | 412 | 29,088 | 22,820 | Accepted | Accepted | 9.45 | def main():
islands, request_num = list(map(int, input().split()))
demolition = []
requests = []
for _ in range(request_num):
requests.append(list(map(int, input().split())))
requests.sort(key=lambda x: x[1], reverse=False)
for begin, end in requests:
if 0 < len(demolitio... | def main():
n, m = list(map(int, input().split()))
query = [[int(x) for x in input().split()] for _ in range(m)]
break_bridges = [-1]
query.sort(key=lambda x: x[1])
for begin, end in query:
if not (begin <= break_bridges[-1] < end):
break_bridges.append(end - 1)
print... | 18 | 14 | 503 | 385 | def main():
islands, request_num = list(map(int, input().split()))
demolition = []
requests = []
for _ in range(request_num):
requests.append(list(map(int, input().split())))
requests.sort(key=lambda x: x[1], reverse=False)
for begin, end in requests:
if 0 < len(demolition) and b... | def main():
n, m = list(map(int, input().split()))
query = [[int(x) for x in input().split()] for _ in range(m)]
break_bridges = [-1]
query.sort(key=lambda x: x[1])
for begin, end in query:
if not (begin <= break_bridges[-1] < end):
break_bridges.append(end - 1)
print((len(br... | false | 22.222222 | [
"- islands, request_num = list(map(int, input().split()))",
"- demolition = []",
"- requests = []",
"- for _ in range(request_num):",
"- requests.append(list(map(int, input().split())))",
"- requests.sort(key=lambda x: x[1], reverse=False)",
"- for begin, end in requests:",
"-... | false | 0.037171 | 0.03696 | 1.005707 | [
"s767956331",
"s613752435"
] |
u867826040 | p02596 | python | s149021198 | s483366821 | 480 | 141 | 105,752 | 27,488 | Accepted | Accepted | 70.62 | from numba import njit,prange
@njit('i8(i8)',cache=True)
def f(k):
a = 7%k
for i in prange(k):
if a == 0:
return i+1
a = (a*10+7)%k
else:
return -1
k = int(eval(input()))
print((f(k))) | import sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("solve")
@cc.export('solve', 'i8(i8)')
def f(k):
a = 7 % k
for i in range(k):
if a == 0:
return i + 1
a = (a * 10 + 7) % k
else:
ret... | 12 | 20 | 235 | 412 | from numba import njit, prange
@njit("i8(i8)", cache=True)
def f(k):
a = 7 % k
for i in prange(k):
if a == 0:
return i + 1
a = (a * 10 + 7) % k
else:
return -1
k = int(eval(input()))
print((f(k)))
| import sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("solve")
@cc.export("solve", "i8(i8)")
def f(k):
a = 7 % k
for i in range(k):
if a == 0:
return i + 1
a = (a * 10 + 7) % k
else:
return -1
c... | false | 40 | [
"-from numba import njit, prange",
"+import sys",
"+if sys.argv[-1] == \"ONLINE_JUDGE\":",
"+ from numba.pycc import CC",
"-@njit(\"i8(i8)\", cache=True)",
"-def f(k):",
"- a = 7 % k",
"- for i in prange(k):",
"- if a == 0:",
"- return i + 1",
"- a = (a * 10 + 7... | false | 0.045887 | 0.04644 | 0.988087 | [
"s149021198",
"s483366821"
] |
u426534722 | p02234 | python | s688093923 | s053998859 | 230 | 170 | 5,672 | 5,720 | Accepted | Accepted | 26.09 | INF = float("inf")
n = int(eval(input()))
z = []
m = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
a, b = list(map(int, input().split()))
z.append(a)
z.append(b)
for l in range(1, n):
for i in range(1, n - l + 1):
j = i + l
m[i][j] = INF
for k in range(i... | import sys
INF = float("inf")
n = int(eval(input()))
m = [[0] * (n + 1) for _ in range(n + 1)]
li = [list(map(int, a.split())) for a in sys.stdin]
z = (li[0][0], ) + list(zip(*li))[1]
for l in range(1, n):
for i in range(1, n - l + 1):
j = i + l
m[i][j] = INF
for k in range(i, j):
... | 16 | 14 | 416 | 416 | INF = float("inf")
n = int(eval(input()))
z = []
m = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
a, b = list(map(int, input().split()))
z.append(a)
z.append(b)
for l in range(1, n):
for i in range(1, n - l + 1):
j = i + l
m[i][j] = INF
for k in range(i, j):
... | import sys
INF = float("inf")
n = int(eval(input()))
m = [[0] * (n + 1) for _ in range(n + 1)]
li = [list(map(int, a.split())) for a in sys.stdin]
z = (li[0][0],) + list(zip(*li))[1]
for l in range(1, n):
for i in range(1, n - l + 1):
j = i + l
m[i][j] = INF
for k in range(i, j):
... | false | 12.5 | [
"+import sys",
"+",
"-z = []",
"-for i in range(1, n + 1):",
"- a, b = list(map(int, input().split()))",
"- z.append(a)",
"-z.append(b)",
"+li = [list(map(int, a.split())) for a in sys.stdin]",
"+z = (li[0][0],) + list(zip(*li))[1]"
] | false | 0.076913 | 0.064415 | 1.194022 | [
"s688093923",
"s053998859"
] |
u827241372 | p03338 | python | s693858698 | s203414283 | 22 | 19 | 3,060 | 2,940 | Accepted | Accepted | 13.64 | def main() -> None:
N = int(eval(input()))
S = eval(input())
m = 0
for i in range(N):
l1 = S[0:i]
l2 = S[i:]
if m < len(set(sorted(l1)) & set(sorted(l2))):
m = len(set(sorted(l1)) & set(sorted(l2)))
print(m)
if __name__ == '__main__':
main... | def main() -> None:
N = int(eval(input()))
S = eval(input())
m = 0
for i in range(N):
same_num = len(set(sorted(S[0:i])) & set(sorted(S[i:])))
m = same_num if m < same_num else m
print(m)
if __name__ == '__main__':
main()
| 15 | 13 | 311 | 269 | def main() -> None:
N = int(eval(input()))
S = eval(input())
m = 0
for i in range(N):
l1 = S[0:i]
l2 = S[i:]
if m < len(set(sorted(l1)) & set(sorted(l2))):
m = len(set(sorted(l1)) & set(sorted(l2)))
print(m)
if __name__ == "__main__":
main()
| def main() -> None:
N = int(eval(input()))
S = eval(input())
m = 0
for i in range(N):
same_num = len(set(sorted(S[0:i])) & set(sorted(S[i:])))
m = same_num if m < same_num else m
print(m)
if __name__ == "__main__":
main()
| false | 13.333333 | [
"- l1 = S[0:i]",
"- l2 = S[i:]",
"- if m < len(set(sorted(l1)) & set(sorted(l2))):",
"- m = len(set(sorted(l1)) & set(sorted(l2)))",
"+ same_num = len(set(sorted(S[0:i])) & set(sorted(S[i:])))",
"+ m = same_num if m < same_num else m"
] | false | 0.039288 | 0.038905 | 1.009828 | [
"s693858698",
"s203414283"
] |
u334712262 | p02550 | python | s590275309 | s447384823 | 864 | 567 | 88,824 | 94,052 | Accepted | Accepted | 34.38 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 117 | 101 | 2,275 | 1,795 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 13.675214 | [
"- # if math.gcd(X, M) != 1:",
"- if False:",
"- for _ in range(N):",
"- ans += x",
"- x *= x",
"- x %= M",
"- if x == 0:",
"- break",
"- return ans",
"- else:",
"- x = X",
"- s = [X]",
"- ... | false | 0.082385 | 0.036536 | 2.254916 | [
"s590275309",
"s447384823"
] |
u941645670 | p02726 | python | s812585194 | s701401892 | 1,995 | 1,562 | 3,444 | 3,444 | Accepted | Accepted | 21.7 | n,x,y=list(map(int,input().split()))
ans=[0]*n #個数を数えるのにバケットを用意する
for i in range(1,n+1): #i<jなるすべての頂点の組について最短距離を求める
for j in range(i+1,n+1):
dist1=j-i
dist2=abs(x-i)+abs(y-j)+1
dist3=abs(y-i)+abs(x-j)+1
d=min(dist1,dist2,dist3) #最短距離は上式により求められる
ans[d]+=1 #最短距離がdとなる組の個... | n,x,y=list(map(int,input().split()))
ans=[0]*n #個数を数えるのにバケットを用意する
for i in range(1,n+1): #i<jなるすべての頂点の組について最短距離を求める
for j in range(i+1,n+1):
dist1=j-i
dist2=abs(x-i)+abs(y-j)+1
d=min(dist1,dist2) #最短距離は上式により求められる
ans[d]+=1 #最短距離がdとなる組の個数を1増やす
for i in range(1,n):
print((... | 11 | 10 | 361 | 320 | n, x, y = list(map(int, input().split()))
ans = [0] * n # 個数を数えるのにバケットを用意する
for i in range(1, n + 1): # i<jなるすべての頂点の組について最短距離を求める
for j in range(i + 1, n + 1):
dist1 = j - i
dist2 = abs(x - i) + abs(y - j) + 1
dist3 = abs(y - i) + abs(x - j) + 1
d = min(dist1, dist2, dist3) # 最短距離... | n, x, y = list(map(int, input().split()))
ans = [0] * n # 個数を数えるのにバケットを用意する
for i in range(1, n + 1): # i<jなるすべての頂点の組について最短距離を求める
for j in range(i + 1, n + 1):
dist1 = j - i
dist2 = abs(x - i) + abs(y - j) + 1
d = min(dist1, dist2) # 最短距離は上式により求められる
ans[d] += 1 # 最短距離がdとなる組の個数を1増... | false | 9.090909 | [
"- dist3 = abs(y - i) + abs(x - j) + 1",
"- d = min(dist1, dist2, dist3) # 最短距離は上式により求められる",
"+ d = min(dist1, dist2) # 最短距離は上式により求められる"
] | false | 0.047407 | 0.04734 | 1.001406 | [
"s812585194",
"s701401892"
] |
u303059352 | p03109 | python | s865838356 | s835167525 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | print(("Heisei" if eval(input())<="2019/04/30" else "TBD"))
| print(("Heisei" if eval(input()) < "2019/05/01" else "TBD")) | 1 | 1 | 52 | 52 | print(("Heisei" if eval(input()) <= "2019/04/30" else "TBD"))
| print(("Heisei" if eval(input()) < "2019/05/01" else "TBD"))
| false | 0 | [
"-print((\"Heisei\" if eval(input()) <= \"2019/04/30\" else \"TBD\"))",
"+print((\"Heisei\" if eval(input()) < \"2019/05/01\" else \"TBD\"))"
] | false | 0.069685 | 0.069123 | 1.008129 | [
"s865838356",
"s835167525"
] |
u725757838 | p03478 | python | s100574200 | s903497837 | 56 | 31 | 5,108 | 2,940 | Accepted | Accepted | 44.64 | n,a,b=list(map(int,input().split()))
listint=[i for i in range(1,n+1)]
liststr=[str(listint[i]) for i in range(n)]
anssum=[[] for i in range(n)]
def calculate_sum(listint,liststr,k):
sumnumber=liststr[k-1]
sumlist=list(sumnumber)
sumlistint=[int(sumlist[i]) for i in range(len(sumlist))]
sum=0
for i i... | n,a,b=list(map(int,input().split()))
answer=0
for i in range(1,n+1):
if a<=sum(map(int,str(i)))<=b:
answer=answer+i
print(answer)
| 21 | 7 | 579 | 145 | n, a, b = list(map(int, input().split()))
listint = [i for i in range(1, n + 1)]
liststr = [str(listint[i]) for i in range(n)]
anssum = [[] for i in range(n)]
def calculate_sum(listint, liststr, k):
sumnumber = liststr[k - 1]
sumlist = list(sumnumber)
sumlistint = [int(sumlist[i]) for i in range(len(sumli... | n, a, b = list(map(int, input().split()))
answer = 0
for i in range(1, n + 1):
if a <= sum(map(int, str(i))) <= b:
answer = answer + i
print(answer)
| false | 66.666667 | [
"-listint = [i for i in range(1, n + 1)]",
"-liststr = [str(listint[i]) for i in range(n)]",
"-anssum = [[] for i in range(n)]",
"-",
"-",
"-def calculate_sum(listint, liststr, k):",
"- sumnumber = liststr[k - 1]",
"- sumlist = list(sumnumber)",
"- sumlistint = [int(sumlist[i]) for i in ran... | false | 0.042841 | 0.039082 | 1.096181 | [
"s100574200",
"s903497837"
] |
u910632349 | p02594 | python | s964080467 | s144248212 | 31 | 28 | 9,136 | 8,924 | Accepted | Accepted | 9.68 | a=int(eval(input()))
if a>=30:
print("Yes")
else:
print("No") | x=int(eval(input()))
print(("Yes" if x>=30 else "No")) | 5 | 2 | 67 | 47 | a = int(eval(input()))
if a >= 30:
print("Yes")
else:
print("No")
| x = int(eval(input()))
print(("Yes" if x >= 30 else "No"))
| false | 60 | [
"-a = int(eval(input()))",
"-if a >= 30:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+x = int(eval(input()))",
"+print((\"Yes\" if x >= 30 else \"No\"))"
] | false | 0.091617 | 0.111832 | 0.819239 | [
"s964080467",
"s144248212"
] |
u177388368 | p03031 | python | s084129491 | s369935998 | 56 | 45 | 3,064 | 9,136 | Accepted | Accepted | 19.64 | n,m=list(map(int,input().split()))
s=[]
k=[]
for i in range(m):
ss=list(map(int,input().split()))
k.append(ss[0])
s.append(ss[1:])
p=list(map(int,input().split()))
def cntbin(num):
bin_num = bin(num)[2:]
count = 0
for i in bin_num:
count += int(i)
return count
... | n,m=list(map(int,input().split()))
k=[]
s=[]
def cntbin(num):
bin_num = bin(num)[2:]
count = 0
for i in bin_num:
count += int(i)
return count
for i in range(m):
kk,*ss=list(map(int,input().split()))
k.append(kk)
s.append(ss)
p=list(map(int,input().split()))
... | 33 | 33 | 600 | 590 | n, m = list(map(int, input().split()))
s = []
k = []
for i in range(m):
ss = list(map(int, input().split()))
k.append(ss[0])
s.append(ss[1:])
p = list(map(int, input().split()))
def cntbin(num):
bin_num = bin(num)[2:]
count = 0
for i in bin_num:
count += int(i)
return count
ans =... | n, m = list(map(int, input().split()))
k = []
s = []
def cntbin(num):
bin_num = bin(num)[2:]
count = 0
for i in bin_num:
count += int(i)
return count
for i in range(m):
kk, *ss = list(map(int, input().split()))
k.append(kk)
s.append(ss)
p = list(map(int, input().split()))
ans = 0... | false | 0 | [
"+k = []",
"-k = []",
"-for i in range(m):",
"- ss = list(map(int, input().split()))",
"- k.append(ss[0])",
"- s.append(ss[1:])",
"-p = list(map(int, input().split()))",
"+for i in range(m):",
"+ kk, *ss = list(map(int, input().split()))",
"+ k.append(kk)",
"+ s.append(ss)",
... | false | 0.045742 | 0.038347 | 1.19283 | [
"s084129491",
"s369935998"
] |
u604839890 | p03162 | python | s128871599 | s112883971 | 438 | 332 | 41,884 | 42,240 | Accepted | Accepted | 24.2 | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
aabbcc = [[0], [0], [0]]
tmp = [0]*3
for i in abc:
for j in range(3):
tmp[j] = i[j] + max(aabbcc[(j+1)%3][-1], aabbcc[(j+2)%3][-1])
for j in range(3):
aabbcc[j].append(tmp[j])
print((max([i[-1] for i in aabbcc]))) | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
a, b, c = [0], [0], [0]
for i in abc:
aa = i[0] + max(b[-1], c[-1])
bb = i[1] + max(c[-1], a[-1])
cc = i[2] + max(a[-1], b[-1])
a.append(aa)
b.append(bb)
c.append(cc)
print((max(a[-1], b[-1], c[-1]))) | 11 | 12 | 309 | 297 | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
aabbcc = [[0], [0], [0]]
tmp = [0] * 3
for i in abc:
for j in range(3):
tmp[j] = i[j] + max(aabbcc[(j + 1) % 3][-1], aabbcc[(j + 2) % 3][-1])
for j in range(3):
aabbcc[j].append(tmp[j])
print((max([i[-1] for i in aa... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
a, b, c = [0], [0], [0]
for i in abc:
aa = i[0] + max(b[-1], c[-1])
bb = i[1] + max(c[-1], a[-1])
cc = i[2] + max(a[-1], b[-1])
a.append(aa)
b.append(bb)
c.append(cc)
print((max(a[-1], b[-1], c[-1])))
| false | 8.333333 | [
"-aabbcc = [[0], [0], [0]]",
"-tmp = [0] * 3",
"+a, b, c = [0], [0], [0]",
"- for j in range(3):",
"- tmp[j] = i[j] + max(aabbcc[(j + 1) % 3][-1], aabbcc[(j + 2) % 3][-1])",
"- for j in range(3):",
"- aabbcc[j].append(tmp[j])",
"-print((max([i[-1] for i in aabbcc])))",
"+ aa =... | false | 0.007965 | 0.036596 | 0.217659 | [
"s128871599",
"s112883971"
] |
u186838327 | p03050 | python | s110163365 | s292217820 | 117 | 73 | 3,268 | 65,828 | Accepted | Accepted | 37.61 | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
#divisors.sort(reverse=True)
return divisors
d = make_divisors(n)
ans = 0
... | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
#divisors.sort(reverse=True)
return divisors
D = make_divisors(n)
ans = 0
f... | 24 | 20 | 468 | 412 | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True)
return divisors
d = make_divisors(n)
ans = 0
for a in... | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True)
return divisors
D = make_divisors(n)
ans = 0
for d in... | false | 16.666667 | [
"-d = make_divisors(n)",
"+D = make_divisors(n)",
"-for a in d:",
"- if a == 1:",
"- continue",
"- else:",
"- q = n // a",
"- m = a - 1",
"- if 0 <= q <= m - 1:",
"- ans += m",
"+for d in D:",
"+ m = d - 1",
"+ q = n // d",
"+ if m > 0 ... | false | 0.286893 | 0.19393 | 1.479365 | [
"s110163365",
"s292217820"
] |
u307159845 | p03854 | python | s044780668 | s357409248 | 184 | 88 | 3,188 | 3,956 | Accepted | Accepted | 52.17 | S = eval(input())
S_r = S[::-1]
dire = ['dream','dreamer','erase','eraser']
dire_r = [0]*4
for i in range(4):
tmp = dire[i]
dire_r[i] = tmp[::-1]
ind = 0
excep = 0
while ind <len(S_r):
if excep == 1:
break
flag2= 0
for j in range(4):
if flag2 ==0:
case... | S = eval(input())
dire = ['dream','dreamer','erase','eraser']
DP = [0] * 100000
DP[0] = 1
for s in range(len(S)):
if DP[s] != 1:
continue
for i in range(4):
tmp = S[s: s+len(dire[i])]
if tmp == dire[i]:
DP[s + len(dire[i])] = 1
if DP[len(S)] == 1:
... | 42 | 21 | 1,030 | 351 | S = eval(input())
S_r = S[::-1]
dire = ["dream", "dreamer", "erase", "eraser"]
dire_r = [0] * 4
for i in range(4):
tmp = dire[i]
dire_r[i] = tmp[::-1]
ind = 0
excep = 0
while ind < len(S_r):
if excep == 1:
break
flag2 = 0
for j in range(4):
if flag2 == 0:
case = 0
... | S = eval(input())
dire = ["dream", "dreamer", "erase", "eraser"]
DP = [0] * 100000
DP[0] = 1
for s in range(len(S)):
if DP[s] != 1:
continue
for i in range(4):
tmp = S[s : s + len(dire[i])]
if tmp == dire[i]:
DP[s + len(dire[i])] = 1
if DP[len(S)] == 1:
print("YES")
else:... | false | 50 | [
"-S_r = S[::-1]",
"-dire_r = [0] * 4",
"-for i in range(4):",
"- tmp = dire[i]",
"- dire_r[i] = tmp[::-1]",
"-ind = 0",
"-excep = 0",
"-while ind < len(S_r):",
"- if excep == 1:",
"- break",
"- flag2 = 0",
"- for j in range(4):",
"- if flag2 == 0:",
"- ... | false | 0.037568 | 0.037492 | 1.00203 | [
"s044780668",
"s357409248"
] |
u075012704 | p02708 | python | s290686575 | s531792427 | 130 | 112 | 9,192 | 9,176 | Accepted | Accepted | 13.85 | N, K = list(map(int, input().split()))
MOD = 10 ** 9 + 7
LOW, HIGH = 0, N
ans = 0
if 1 >= K:
ans += (HIGH - LOW + 1)
for i in range(2, N + 2):
LOW += i - 1
HIGH += N - i + 1
LOW %= MOD
HIGH %= MOD
if i >= K:
ans += (HIGH - LOW + 1)
ans %= MOD
print(ans)
| N, K = list(map(int, input().split()))
MOD = 10 ** 9 + 7
low, high = 0, 0
ans = 0
for i in range(1, N + 2):
low += i - 1
high += N - i + 1
if i >= K:
ans += (high - low + 1)
ans %= MOD
print(ans)
| 19 | 14 | 310 | 234 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
LOW, HIGH = 0, N
ans = 0
if 1 >= K:
ans += HIGH - LOW + 1
for i in range(2, N + 2):
LOW += i - 1
HIGH += N - i + 1
LOW %= MOD
HIGH %= MOD
if i >= K:
ans += HIGH - LOW + 1
ans %= MOD
print(ans)
| N, K = list(map(int, input().split()))
MOD = 10**9 + 7
low, high = 0, 0
ans = 0
for i in range(1, N + 2):
low += i - 1
high += N - i + 1
if i >= K:
ans += high - low + 1
ans %= MOD
print(ans)
| false | 26.315789 | [
"-LOW, HIGH = 0, N",
"+low, high = 0, 0",
"-if 1 >= K:",
"- ans += HIGH - LOW + 1",
"-for i in range(2, N + 2):",
"- LOW += i - 1",
"- HIGH += N - i + 1",
"- LOW %= MOD",
"- HIGH %= MOD",
"+for i in range(1, N + 2):",
"+ low += i - 1",
"+ high += N - i + 1",
"- an... | false | 0.06708 | 0.061884 | 1.083958 | [
"s290686575",
"s531792427"
] |
u654558363 | p03846 | python | s907202509 | s140256936 | 153 | 141 | 14,436 | 14,308 | Accepted | Accepted | 7.84 | from functools import reduce
if __name__ == "__main__":
n = int(eval(input()))
a = [int(x) for x in input().split()]
x = [0]*n
if n % 2 == 0:
for i in a:
if i % 2 != 1:
print((0))
exit()
else:
for i in a:
if i % 2 ... | from functools import reduce
if __name__ == "__main__":
n = int(eval(input()))
a = [int(x) for x in input().split()]
x = [0]*n
"""if n % 2 == 0:
for i in a:
if i % 2 != 1:
print(0)
exit()
else:
for i in a:
if i % 2... | 26 | 26 | 643 | 649 | from functools import reduce
if __name__ == "__main__":
n = int(eval(input()))
a = [int(x) for x in input().split()]
x = [0] * n
if n % 2 == 0:
for i in a:
if i % 2 != 1:
print((0))
exit()
else:
for i in a:
if i % 2 != 0:
... | from functools import reduce
if __name__ == "__main__":
n = int(eval(input()))
a = [int(x) for x in input().split()]
x = [0] * n
"""if n % 2 == 0:
for i in a:
if i % 2 != 1:
print(0)
exit()
else:
for i in a:
if i % 2 != 0:
... | false | 0 | [
"- if n % 2 == 0:",
"+ \"\"\"if n % 2 == 0:",
"- print((0))",
"+ print(0)",
"- print((0))",
"- exit()",
"+ print(0)",
"+ exit()\"\"\""
] | false | 0.037078 | 0.036476 | 1.016478 | [
"s907202509",
"s140256936"
] |
u610473220 | p03107 | python | s118176858 | s287376590 | 29 | 18 | 3,188 | 3,188 | Accepted | Accepted | 37.93 | S = eval(input())
c0 = 0
c1 = 0
for i in S:
if i == "0":
c0 += 1
else:
c1 += 1
print((min(c0, c1) * 2)) | S = eval(input())
c0 = S.count("0")
c1 = S.count("1")
print((min(c0, c1) * 2)) | 9 | 4 | 127 | 73 | S = eval(input())
c0 = 0
c1 = 0
for i in S:
if i == "0":
c0 += 1
else:
c1 += 1
print((min(c0, c1) * 2))
| S = eval(input())
c0 = S.count("0")
c1 = S.count("1")
print((min(c0, c1) * 2))
| false | 55.555556 | [
"-c0 = 0",
"-c1 = 0",
"-for i in S:",
"- if i == \"0\":",
"- c0 += 1",
"- else:",
"- c1 += 1",
"+c0 = S.count(\"0\")",
"+c1 = S.count(\"1\")"
] | false | 0.062302 | 0.05024 | 1.240087 | [
"s118176858",
"s287376590"
] |
u075012704 | p02695 | python | s197647265 | s376317354 | 1,063 | 595 | 9,060 | 9,212 | Accepted | Accepted | 44.03 | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
for pattern in combinations_with_replacement(list(range(1, M + 1)), N):
tmp_ans = 0
pattern = list(pattern)
for a, b, c, d in X:
if ... | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
def calc(arr):
score = 0
for a, b, c, d in X:
if arr[b - 1] - arr[a - 1] == c:
score += d
return score
def dfs(arr... | 14 | 29 | 415 | 592 | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
for pattern in combinations_with_replacement(list(range(1, M + 1)), N):
tmp_ans = 0
pattern = list(pattern)
for a, b, c, d in X:
if pattern[b... | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
def calc(arr):
score = 0
for a, b, c, d in X:
if arr[b - 1] - arr[a - 1] == c:
score += d
return score
def dfs(arr):
glob... | false | 51.724138 | [
"-for pattern in combinations_with_replacement(list(range(1, M + 1)), N):",
"- tmp_ans = 0",
"- pattern = list(pattern)",
"+",
"+",
"+def calc(arr):",
"+ score = 0",
"- if pattern[b - 1] - pattern[a - 1] == c:",
"- tmp_ans += d",
"- ans = max(ans, tmp_ans)",
"+ ... | false | 0.130506 | 0.066038 | 1.976213 | [
"s197647265",
"s376317354"
] |
u504836877 | p03112 | python | s810819952 | s890625579 | 2,000 | 1,512 | 78,312 | 12,128 | Accepted | Accepted | 24.4 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10 ** 18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(eval(input()))
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
res =... | A,B,Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
import bisect
for _ in range(Q):
x = int(eval(input()))
s_idx = bisect.bisect_left(S, x)
t_idx = bisect.bisect_left(T, x)
if s_idx == A and t_idx == B:
ans = x-m... | 15 | 28 | 491 | 1,212 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(eval(input()))
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
res = INF
fo... | A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
import bisect
for _ in range(Q):
x = int(eval(input()))
s_idx = bisect.bisect_left(S, x)
t_idx = bisect.bisect_left(T, x)
if s_idx == A and t_idx == B:
ans = x - min(S... | false | 46.428571 | [
"+A, B, Q = list(map(int, input().split()))",
"+S = [int(eval(input())) for _ in range(A)]",
"+T = [int(eval(input())) for _ in range(B)]",
"-A, B, Q = list(map(int, input().split()))",
"-INF = 10**18",
"-s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]",
"-t = [-INF] + [int(eval(input())) fo... | false | 0.049102 | 0.04815 | 1.019767 | [
"s810819952",
"s890625579"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.