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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u704658587 | p02659 | python | s271052096 | s530943766 | 29 | 21 | 9,872 | 9,164 | Accepted | Accepted | 27.59 | from decimal import *
a, b = input().split()
b = b.replace('.', '')
print((Decimal(a) * Decimal(b) // 100)) | a, b = input().split()
b = b.replace('.', '')
print((int(a) * int(b) // 100)) | 5 | 4 | 110 | 79 | from decimal import *
a, b = input().split()
b = b.replace(".", "")
print((Decimal(a) * Decimal(b) // 100))
| a, b = input().split()
b = b.replace(".", "")
print((int(a) * int(b) // 100))
| false | 20 | [
"-from decimal import *",
"-",
"-print((Decimal(a) * Decimal(b) // 100))",
"+print((int(a) * int(b) // 100))"
] | false | 0.041089 | 0.037477 | 1.096375 | [
"s271052096",
"s530943766"
] |
u581187895 | p03835 | python | s235775393 | s414175868 | 1,460 | 19 | 2,940 | 3,060 | Accepted | Accepted | 98.7 | K, S = list(map(int, input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
z = S-x-y
if 0 <= z <= K:
ans += 1
print(ans) | """
Y+Z=S−X が成り立つことは分かるものの1通りには決まりません。
満たすべき条件は 0≤Y,Z≤K と Y+Z=S−X なので、変数 Z を消去すると以下の不等式が得られます。
0≤Y≤K
0≤Z=S−Y−X≤K
変形して、Y≤S−X かつ S−X−K≤Y
つまり Y の下限は Ymin=max(0,S−X−K) 、
上限は Ymax=min(K,S−X) となります。
"""
K, S = list(map(int, input().split()))
ans = 0
for x in range(K+1):
mn = max(0, S-x-K)
mx = min(K... | 8 | 21 | 157 | 365 | K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
ans += 1
print(ans)
| """
Y+Z=S−X が成り立つことは分かるものの1通りには決まりません。
満たすべき条件は 0≤Y,Z≤K と Y+Z=S−X なので、変数 Z を消去すると以下の不等式が得られます。
0≤Y≤K
0≤Z=S−Y−X≤K
変形して、Y≤S−X かつ S−X−K≤Y
つまり Y の下限は Ymin=max(0,S−X−K) 、
上限は Ymax=min(K,S−X) となります。
"""
K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
mn = max(0, S - x - K)
mx = min(K, S - x)
... | false | 61.904762 | [
"+\"\"\"",
"+Y+Z=S−X が成り立つことは分かるものの1通りには決まりません。",
"+満たすべき条件は 0≤Y,Z≤K と Y+Z=S−X なので、変数 Z を消去すると以下の不等式が得られます。",
"+0≤Y≤K",
"+0≤Z=S−Y−X≤K",
"+変形して、Y≤S−X かつ S−X−K≤Y",
"+つまり Y の下限は Ymin=max(0,S−X−K) 、",
"+上限は Ymax=min(K,S−X) となります。",
"+\"\"\"",
"- for y in range(K + 1):",
"- z = S - x - y",... | false | 0.067194 | 0.044092 | 1.523971 | [
"s235775393",
"s414175868"
] |
u014333473 | p03860 | python | s495126473 | s137913429 | 28 | 25 | 9,084 | 8,952 | Accepted | Accepted | 10.71 | print(*[i[0] for i in input().split()],sep='')
| print(f'A{input()[8]}C') | 1 | 1 | 46 | 24 | print(*[i[0] for i in input().split()], sep="")
| print(f"A{input()[8]}C")
| false | 0 | [
"-print(*[i[0] for i in input().split()], sep=\"\")",
"+print(f\"A{input()[8]}C\")"
] | false | 0.073127 | 0.060797 | 1.202812 | [
"s495126473",
"s137913429"
] |
u626467464 | p03493 | python | s914956207 | s657244789 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | line = eval(input())
count = 0
for i in range(3):
if line[i] == "1":
count += 1
print(count) | line = eval(input())
answer = line.count("1")
print(answer) | 6 | 3 | 97 | 55 | line = eval(input())
count = 0
for i in range(3):
if line[i] == "1":
count += 1
print(count)
| line = eval(input())
answer = line.count("1")
print(answer)
| false | 50 | [
"-count = 0",
"-for i in range(3):",
"- if line[i] == \"1\":",
"- count += 1",
"-print(count)",
"+answer = line.count(\"1\")",
"+print(answer)"
] | false | 0.042757 | 0.042212 | 1.012907 | [
"s914956207",
"s657244789"
] |
u707498674 | p03212 | python | s721075548 | s590384831 | 97 | 72 | 2,940 | 6,004 | Accepted | Accepted | 25.77 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0"))) | import bisect
N = int(eval(input()))
seven53 = []
def dfs(cur, s):
if all(s.count(c) > 0 for c in "753"):
seven53.append(s)
if cur > 8:
return
else:
for i in "753":
dfs(cur + 1, s+i)
dfs(0, "")
seven53 = list(map(int, seven53))
seven53.sort()
print((bisect.b... | 9 | 15 | 182 | 337 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0")))
| import bisect
N = int(eval(input()))
seven53 = []
def dfs(cur, s):
if all(s.count(c) > 0 for c in "753"):
seven53.append(s)
if cur > 8:
return
else:
for i in "753":
dfs(cur + 1, s + i)
dfs(0, "")
seven53 = list(map(int, seven53))
seven53.sort()
print((bisect.bisect_r... | false | 40 | [
"+import bisect",
"+",
"+seven53 = []",
"-def dfs(s):",
"- if int(s) > N:",
"- return 0",
"- ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0",
"- for c in \"753\":",
"- ret += dfs(s + c)",
"- return ret",
"+def dfs(cur, s):",
"+ if all(s.count(c) > 0 for c i... | false | 0.045449 | 0.078906 | 0.575993 | [
"s721075548",
"s590384831"
] |
u111365362 | p03031 | python | s891697370 | s598708478 | 54 | 35 | 3,064 | 3,064 | Accepted | Accepted | 35.19 | n,m = list(map(int,input().split()))
ss = []
for mi in range(m):
splus = [0]*n
s = list(map(int,input().split()))[1:]
for ni in range(n):
if (ni+1) in s:
splus[ni] = 1
ss.append(splus)
p = list(map(int,input().split()))
score = 0
swi = [0]*n
while True:
judge = 1
for mi in range(m):
... | n,m = list(map(int,input().split()))
time = [0 for _ in range(n)]
def nex(time):
for i in range(n):
if time[i] == 0:
time[i] += 1
break
else:
time[i] = 0
else:
time = 'over'
return time
s = []
for _ in range(m):
raw = list(map(int,input().split()))
add = [0 for _ i... | 29 | 32 | 606 | 644 | n, m = list(map(int, input().split()))
ss = []
for mi in range(m):
splus = [0] * n
s = list(map(int, input().split()))[1:]
for ni in range(n):
if (ni + 1) in s:
splus[ni] = 1
ss.append(splus)
p = list(map(int, input().split()))
score = 0
swi = [0] * n
while True:
judge = 1
fo... | n, m = list(map(int, input().split()))
time = [0 for _ in range(n)]
def nex(time):
for i in range(n):
if time[i] == 0:
time[i] += 1
break
else:
time[i] = 0
else:
time = "over"
return time
s = []
for _ in range(m):
raw = list(map(int, input(... | false | 9.375 | [
"-ss = []",
"-for mi in range(m):",
"- splus = [0] * n",
"- s = list(map(int, input().split()))[1:]",
"- for ni in range(n):",
"- if (ni + 1) in s:",
"- splus[ni] = 1",
"- ss.append(splus)",
"+time = [0 for _ in range(n)]",
"+",
"+",
"+def nex(time):",
"+ for... | false | 0.06679 | 0.061349 | 1.088695 | [
"s891697370",
"s598708478"
] |
u648212584 | p03221 | python | s130362748 | s850876456 | 990 | 619 | 46,972 | 37,864 | Accepted | Accepted | 37.47 | def main():
N,M = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(M)]
for i in range(M):
X[i].append(i)
X.sort(key=lambda X:(X[0],X[1]))
anslist = [[0,0] for _ in range(M)]
tmp = 0
count = 1
for i in range(M):
if tmp != X[i][0... | from operator import itemgetter
import sys
input = sys.stdin.readline
def main():
N,M = list(map(int,input().split()))
f = []
for i in range(M):
P,Y = list(map(int,input().split()))
f.append([P,Y,i])
f.sort(key = itemgetter(0,1))
s = 1
count = 0
for i ... | 27 | 35 | 832 | 826 | def main():
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
for i in range(M):
X[i].append(i)
X.sort(key=lambda X: (X[0], X[1]))
anslist = [[0, 0] for _ in range(M)]
tmp = 0
count = 1
for i in range(M):
if tmp != X[i][0]:
... | from operator import itemgetter
import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
f = []
for i in range(M):
P, Y = list(map(int, input().split()))
f.append([P, Y, i])
f.sort(key=itemgetter(0, 1))
s = 1
count = 0
for i in range(M):
... | false | 22.857143 | [
"+from operator import itemgetter",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"- X = [list(map(int, input().split())) for _ in range(M)]",
"+ f = []",
"- X[i].append(i)",
"- X.sort(key=lambda X: (X[0], X[1]))",
"- anslist = [[0, 0] for _ in range(M)]",
"- ... | false | 0.039877 | 0.046684 | 0.854205 | [
"s130362748",
"s850876456"
] |
u968166680 | p02863 | python | s233881624 | s050742864 | 655 | 274 | 215,852 | 144,960 | Accepted | Accepted | 58.17 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *AB = list(map(int, read().split()))
A = AB[::2]
B = AB[1::2]
dp1 = [[0] * T for _ in range(N + 1)]
for i... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
A, B = list(zip(*D... | 43 | 37 | 1,051 | 793 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *AB = list(map(int, read().split()))
A = AB[::2]
B = AB[1::2]
dp1 = [[0] * T for _ in range(N + 1)]
for i in range(N):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
A, B = list(zip(*D))
dp = [[0] *... | false | 13.953488 | [
"- A = AB[::2]",
"- B = AB[1::2]",
"- dp1 = [[0] * T for _ in range(N + 1)]",
"+ D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]",
"+ D.sort()",
"+ A, B = list(zip(*D))",
"+ dp = [[0] * T for _ in range(N + 1)]",
"- dp1[i + 1][t] = dp1[i][t - A[i]] + B[i]",
"- ... | false | 0.034778 | 0.057257 | 0.607403 | [
"s233881624",
"s050742864"
] |
u930705402 | p03286 | python | s568223147 | s927218240 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N=int(eval(input()))
if(N==0):
print((0))
exit()
res=''
while(N!=0):
r=N%2
if(r<0):
r+=2
res+=str(r)
N=(N-r)//(-2)
print((res[::-1])) | N=int(eval(input()))
s=''
if(N==0):
print((0))
exit()
while(N!=0):
m=N%2
s+=str(m)
N=(N-m)//-2
print((s[::-1])) | 12 | 10 | 166 | 130 | N = int(eval(input()))
if N == 0:
print((0))
exit()
res = ""
while N != 0:
r = N % 2
if r < 0:
r += 2
res += str(r)
N = (N - r) // (-2)
print((res[::-1]))
| N = int(eval(input()))
s = ""
if N == 0:
print((0))
exit()
while N != 0:
m = N % 2
s += str(m)
N = (N - m) // -2
print((s[::-1]))
| false | 16.666667 | [
"+s = \"\"",
"-res = \"\"",
"- r = N % 2",
"- if r < 0:",
"- r += 2",
"- res += str(r)",
"- N = (N - r) // (-2)",
"-print((res[::-1]))",
"+ m = N % 2",
"+ s += str(m)",
"+ N = (N - m) // -2",
"+print((s[::-1]))"
] | false | 0.037571 | 0.038495 | 0.975989 | [
"s568223147",
"s927218240"
] |
u631277801 | p03285 | python | s396306238 | s061793524 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
four = [4*i for i in range(26)]
seven = [7*i for i in range(15)]
exist = False
for f in four:
for s in seven:
sm = f+s
if sm == N:
exist = True
if exist:
print("Yes")
else:
print("No") | N = int(eval(input()))
four = [4*i for i in range(26)]
seven = [7*i for i in range(15)]
exist = False
for f in four:
for s in seven:
if f+s == N:
exist = True
if exist:
print("Yes")
else:
print("No")
| 16 | 15 | 271 | 262 | N = int(eval(input()))
four = [4 * i for i in range(26)]
seven = [7 * i for i in range(15)]
exist = False
for f in four:
for s in seven:
sm = f + s
if sm == N:
exist = True
if exist:
print("Yes")
else:
print("No")
| N = int(eval(input()))
four = [4 * i for i in range(26)]
seven = [7 * i for i in range(15)]
exist = False
for f in four:
for s in seven:
if f + s == N:
exist = True
if exist:
print("Yes")
else:
print("No")
| false | 6.25 | [
"- sm = f + s",
"- if sm == N:",
"+ if f + s == N:"
] | false | 0.108927 | 0.046266 | 2.354356 | [
"s396306238",
"s061793524"
] |
u191394596 | p03290 | python | s264803426 | s234364596 | 237 | 63 | 46,296 | 3,444 | Accepted | Accepted | 73.42 | import sys
INF = sys.maxsize
D, G = list(map(int, input().split()))
class P:
def __init__(self, index, number, bonus):
self.index = index
self.number = number
self.bonus = bonus
@property
def score(self):
return (self.index + 1) * 100
@property
def complete_score(sel... | import sys
from collections import namedtuple
# 完答 + 最大1種類の問題が半端に解けている状態のとき最適
# 1. 完投する問題を全探索する 2^10
# 2. 残りの問題から配点が一番高い問題を目標に達するまで解く
# 3. 1,2の中で最も回答問題数が少ないケースが答え
Problem = namedtuple('Problem', 'score number bonus')
D, G = list(map(int, input().split()))
problems = []
for i in ... | 66 | 61 | 1,465 | 1,277 | import sys
INF = sys.maxsize
D, G = list(map(int, input().split()))
class P:
def __init__(self, index, number, bonus):
self.index = index
self.number = number
self.bonus = bonus
@property
def score(self):
return (self.index + 1) * 100
@property
def complete_score... | import sys
from collections import namedtuple
# 完答 + 最大1種類の問題が半端に解けている状態のとき最適
# 1. 完投する問題を全探索する 2^10
# 2. 残りの問題から配点が一番高い問題を目標に達するまで解く
# 3. 1,2の中で最も回答問題数が少ないケースが答え
Problem = namedtuple("Problem", "score number bonus")
D, G = list(map(int, input().split()))
problems = []
for i in range(D):
p, c = list(map(int, input... | false | 7.575758 | [
"+from collections import namedtuple",
"-INF = sys.maxsize",
"+# 完答 + 最大1種類の問題が半端に解けている状態のとき最適",
"+# 1. 完投する問題を全探索する 2^10",
"+# 2. 残りの問題から配点が一番高い問題を目標に達するまで解く",
"+# 3. 1,2の中で最も回答問題数が少ないケースが答え",
"+Problem = namedtuple(\"Problem\", \"score number bonus\")",
"-",
"-",
"-class P:",
"- def __init_... | false | 0.096412 | 0.061901 | 1.557524 | [
"s264803426",
"s234364596"
] |
u525227429 | p02918 | python | s613038110 | s812369291 | 171 | 45 | 20,364 | 3,316 | Accepted | Accepted | 73.68 | N, K = list(map(int, input().split()))
S = list(eval(input()))
l = []
tmp = 0
for i in range(1, N):
if S[i - 1] != S[i]:
l.append([tmp, i - 1, i - tmp])
tmp = i
if i == N - 1:
l.append([tmp, i, i - tmp + 1])
for k in range(K):
i = 2 * k + 1
if i >= len(l):
break
if S[l[i][0]]... | N, K = list(map(int, input().split()))
S = eval(input())
ans = K * 2
for i in range(N - 1):
if S[i] == S[i + 1]:
ans += 1
ans = min(ans, N - 1)
print(ans) | 27 | 9 | 504 | 157 | N, K = list(map(int, input().split()))
S = list(eval(input()))
l = []
tmp = 0
for i in range(1, N):
if S[i - 1] != S[i]:
l.append([tmp, i - 1, i - tmp])
tmp = i
if i == N - 1:
l.append([tmp, i, i - tmp + 1])
for k in range(K):
i = 2 * k + 1
if i >= len(l):
break
if S[... | N, K = list(map(int, input().split()))
S = eval(input())
ans = K * 2
for i in range(N - 1):
if S[i] == S[i + 1]:
ans += 1
ans = min(ans, N - 1)
print(ans)
| false | 66.666667 | [
"-S = list(eval(input()))",
"-l = []",
"-tmp = 0",
"-for i in range(1, N):",
"- if S[i - 1] != S[i]:",
"- l.append([tmp, i - 1, i - tmp])",
"- tmp = i",
"- if i == N - 1:",
"- l.append([tmp, i, i - tmp + 1])",
"-for k in range(K):",
"- i = 2 * k + 1",
"- if i >... | false | 0.100957 | 0.040509 | 2.492243 | [
"s613038110",
"s812369291"
] |
u597374218 | p03821 | python | s270570692 | s880024712 | 276 | 253 | 32,160 | 28,108 | Accepted | Accepted | 8.33 | N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N)][::-1]
count=0
for i in range(N):
AB[i][0]+=count
if AB[i][0]%AB[i][1]!=0:
count+=AB[i][1]-(AB[i][0]%AB[i][1])
print(count) | N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N)]
count=0
for a,b in AB[::-1]:
a+=count
if a%b!=0:
count+=b-(a%b)
print(count) | 8 | 8 | 214 | 168 | N = int(eval(input()))
AB = [list(map(int, input().split())) for i in range(N)][::-1]
count = 0
for i in range(N):
AB[i][0] += count
if AB[i][0] % AB[i][1] != 0:
count += AB[i][1] - (AB[i][0] % AB[i][1])
print(count)
| N = int(eval(input()))
AB = [list(map(int, input().split())) for i in range(N)]
count = 0
for a, b in AB[::-1]:
a += count
if a % b != 0:
count += b - (a % b)
print(count)
| false | 0 | [
"-AB = [list(map(int, input().split())) for i in range(N)][::-1]",
"+AB = [list(map(int, input().split())) for i in range(N)]",
"-for i in range(N):",
"- AB[i][0] += count",
"- if AB[i][0] % AB[i][1] != 0:",
"- count += AB[i][1] - (AB[i][0] % AB[i][1])",
"+for a, b in AB[::-1]:",
"+ a ... | false | 0.04298 | 0.039892 | 1.077412 | [
"s270570692",
"s880024712"
] |
u249218427 | p02714 | python | s590638447 | s745351142 | 1,501 | 1,321 | 9,216 | 9,108 | Accepted | Accepted | 11.99 | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = eval(input())
R = 0
G = 0
B = 0
for i in range(N):
if S[i] == 'R':
R += 1
elif S[i] == 'G':
G += 1
else:
B += 1
count = 0
for i in range(N-1):
for j in range(i+1,N):
if 2*j-i>=N:
break
if S[i]!=S[j] and S[2*... | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = eval(input())
R = 0
G = 0
B = 0
for i in range(N):
if S[i] == 'R':
R += 1
elif S[i] == 'G':
G += 1
else:
B += 1
count = 0
for i in range(N-2):
for j in range(i+1,N-1):
k = 2*j-i
if k>=N:
break
if S[i]!=S[j]... | 25 | 26 | 378 | 379 | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = eval(input())
R = 0
G = 0
B = 0
for i in range(N):
if S[i] == "R":
R += 1
elif S[i] == "G":
G += 1
else:
B += 1
count = 0
for i in range(N - 1):
for j in range(i + 1, N):
if 2 * j - i >= N:
break
if S[... | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = eval(input())
R = 0
G = 0
B = 0
for i in range(N):
if S[i] == "R":
R += 1
elif S[i] == "G":
G += 1
else:
B += 1
count = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
k = 2 * j - i
if k >= N:
b... | false | 3.846154 | [
"-for i in range(N - 1):",
"- for j in range(i + 1, N):",
"- if 2 * j - i >= N:",
"+for i in range(N - 2):",
"+ for j in range(i + 1, N - 1):",
"+ k = 2 * j - i",
"+ if k >= N:",
"- if S[i] != S[j] and S[2 * j - i] != S[i] and S[2 * j - i] != S[j]:",
"+ if S[... | false | 0.105741 | 0.048953 | 2.16004 | [
"s590638447",
"s745351142"
] |
u075012704 | p02925 | python | s498788676 | s721888188 | 581 | 518 | 55,388 | 55,388 | Accepted | Accepted | 10.84 | N = int(eval(input()))
A = [list([int(x) - 1 for x in input().split()]) + [-1] for i in range(N)]
ans = 0
matched = 0
marker = [0] * N
que = list(range(N))
while matched < N * (N - 1) // 2:
already_matched = set()
no_matched = True
next_que = []
while que:
player = que.pop()
... | N = int(eval(input()))
A = [list([int(x) - 1 for x in input().split()]) + [-1] for i in range(N)]
ans = 0
matched = 0
marker = [0] * N
que = list(range(N))
while matched < N * (N - 1) // 2:
already_matched = set()
next_que = []
while que:
player = que.pop()
partner = A[playe... | 42 | 40 | 943 | 890 | N = int(eval(input()))
A = [list([int(x) - 1 for x in input().split()]) + [-1] for i in range(N)]
ans = 0
matched = 0
marker = [0] * N
que = list(range(N))
while matched < N * (N - 1) // 2:
already_matched = set()
no_matched = True
next_que = []
while que:
player = que.pop()
partner = A[... | N = int(eval(input()))
A = [list([int(x) - 1 for x in input().split()]) + [-1] for i in range(N)]
ans = 0
matched = 0
marker = [0] * N
que = list(range(N))
while matched < N * (N - 1) // 2:
already_matched = set()
next_que = []
while que:
player = que.pop()
partner = A[player][marker[player]... | false | 4.761905 | [
"- no_matched = True",
"- no_matched = False",
"+ if not next_que:",
"+ print((-1))",
"+ break",
"- if no_matched:",
"- print((-1))",
"- break"
] | false | 0.038373 | 0.040998 | 0.935979 | [
"s498788676",
"s721888188"
] |
u089830331 | p02258 | python | s598775910 | s682039050 | 500 | 240 | 7,644 | 21,884 | Accepted | Accepted | 52 | n = int(eval(input()))
max_diff = - 10 ** 9
min_n = int(eval(input()))
for i in range(1, n):
n = int(eval(input()))
max_diff = max(max_diff, n - min_n)
min_n = min(min_n, n)
print(max_diff) | import sys
n = int(eval(input()))
max_diff = - 10 ** 9
min_n = int(eval(input()))
for n in map(int, sys.stdin.readlines()):
max_diff = max(max_diff, n - min_n)
min_n = min(min_n, n)
print(max_diff) | 11 | 12 | 190 | 204 | n = int(eval(input()))
max_diff = -(10**9)
min_n = int(eval(input()))
for i in range(1, n):
n = int(eval(input()))
max_diff = max(max_diff, n - min_n)
min_n = min(min_n, n)
print(max_diff)
| import sys
n = int(eval(input()))
max_diff = -(10**9)
min_n = int(eval(input()))
for n in map(int, sys.stdin.readlines()):
max_diff = max(max_diff, n - min_n)
min_n = min(min_n, n)
print(max_diff)
| false | 8.333333 | [
"+import sys",
"+",
"-for i in range(1, n):",
"- n = int(eval(input()))",
"+for n in map(int, sys.stdin.readlines()):"
] | false | 0.040821 | 0.049091 | 0.831543 | [
"s598775910",
"s682039050"
] |
u660912567 | p00767 | python | s547297270 | s770550345 | 80 | 60 | 9,060 | 8,964 | Accepted | Accepted | 25 | l = [[i**2+j**2,i,j] for j in range(1,151) for i in range(1,151) if i!=j and i<j]
l = sorted(l)
while True:
h,w = map(int,input().split())
if w==h==0: break
i = l.index([w**2+h**2,h,w])+1
print(*l[i][1:],sep=' ')
| import bisect
l = [[i**2+j**2,i,j] for j in range(1,151) for i in range(1,151) if i!=j and i<j]
l.sort()
while True:
h,w = list(map(int,input().split()))
if w==h==0: break
r = l[bisect.bisect_right(l,[w**2+h**2,h,w])]
print((r[1],r[2])) | 7 | 8 | 234 | 251 | l = [
[i**2 + j**2, i, j]
for j in range(1, 151)
for i in range(1, 151)
if i != j and i < j
]
l = sorted(l)
while True:
h, w = map(int, input().split())
if w == h == 0:
break
i = l.index([w**2 + h**2, h, w]) + 1
print(*l[i][1:], sep=" ")
| import bisect
l = [
[i**2 + j**2, i, j]
for j in range(1, 151)
for i in range(1, 151)
if i != j and i < j
]
l.sort()
while True:
h, w = list(map(int, input().split()))
if w == h == 0:
break
r = l[bisect.bisect_right(l, [w**2 + h**2, h, w])]
print((r[1], r[2]))
| false | 12.5 | [
"+import bisect",
"+",
"-l = sorted(l)",
"+l.sort()",
"- h, w = map(int, input().split())",
"+ h, w = list(map(int, input().split()))",
"- i = l.index([w**2 + h**2, h, w]) + 1",
"- print(*l[i][1:], sep=\" \")",
"+ r = l[bisect.bisect_right(l, [w**2 + h**2, h, w])]",
"+ print((r[1... | false | 0.079849 | 0.067458 | 1.183686 | [
"s547297270",
"s770550345"
] |
u072717685 | p02608 | python | s577573444 | s133956629 | 990 | 805 | 11,684 | 11,796 | Accepted | Accepted | 18.69 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
n = int(eval(input()))
if n == 1:
print((0))
sys.exit()
r = defaultdict(int)
for i1 in range(1,101):
for i2 in range(1,101):
for i3 in range(1,... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import sqrt
from collections import defaultdict
def main():
n = int(eval(input()))
n2 = int(sqrt(n) + 1)
d1 = defaultdict(int)
for i1 in range(1, n2):
for i2 in range(1, n2):
... | 21 | 23 | 554 | 625 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
n = int(eval(input()))
if n == 1:
print((0))
sys.exit()
r = defaultdict(int)
for i1 in range(1, 101):
for i2 in range(1, 101):
for i3 in range(1, 101):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import sqrt
from collections import defaultdict
def main():
n = int(eval(input()))
n2 = int(sqrt(n) + 1)
d1 = defaultdict(int)
for i1 in range(1, n2):
for i2 in range(1, n2):
f... | false | 8.695652 | [
"+readline = sys.stdin.readline",
"+from math import sqrt",
"- if n == 1:",
"- print((0))",
"- sys.exit()",
"- r = defaultdict(int)",
"- for i1 in range(1, 101):",
"- for i2 in range(1, 101):",
"- for i3 in range(1, 101):",
"- t = pow(i1, 2) ... | false | 2.533074 | 0.048803 | 51.904332 | [
"s577573444",
"s133956629"
] |
u562935282 | p03240 | python | s756112612 | s445844673 | 120 | 61 | 3,064 | 3,700 | Accepted | Accepted | 49.17 | N = int(eval(input()))
xyh = [tuple(map(int, input().split())) for _ in range(N)]
for cx in range(100 + 1):
for cy in range(100 + 1):
# すべての中心候補に対して
H = -1
for x, y, h in xyh:
if h > 0:
t = h + abs(x - cx) + abs(y - cy)
if H == -1:
... | def solve():
cands = []
for cx in range(100 + 1):
for cy in range(100 + 1):
is_center = True
temp_h = -1
for x, y, h in m:
if h != 0:
calc_h = h + abs(cx - x) + abs(cy - y)
if temp_h == -1:
... | 24 | 35 | 727 | 1,052 | N = int(eval(input()))
xyh = [tuple(map(int, input().split())) for _ in range(N)]
for cx in range(100 + 1):
for cy in range(100 + 1):
# すべての中心候補に対して
H = -1
for x, y, h in xyh:
if h > 0:
t = h + abs(x - cx) + abs(y - cy)
if H == -1:
... | def solve():
cands = []
for cx in range(100 + 1):
for cy in range(100 + 1):
is_center = True
temp_h = -1
for x, y, h in m:
if h != 0:
calc_h = h + abs(cx - x) + abs(cy - y)
if temp_h == -1:
... | false | 31.428571 | [
"-N = int(eval(input()))",
"-xyh = [tuple(map(int, input().split())) for _ in range(N)]",
"-for cx in range(100 + 1):",
"- for cy in range(100 + 1):",
"- # すべての中心候補に対して",
"- H = -1",
"- for x, y, h in xyh:",
"- if h > 0:",
"- t = h + abs(x - cx) + ab... | false | 0.037464 | 0.043871 | 0.853948 | [
"s756112612",
"s445844673"
] |
u058781705 | p03289 | python | s446025974 | s157667986 | 171 | 64 | 38,384 | 61,812 | Accepted | Accepted | 62.57 |
def solve():
s = list(eval(input()))
if s[0] == "A" and s[2:-1].count("C") == 1:
s.remove("A")
s.remove("C")
if "".join(s).islower():
print("AC")
exit()
print("WA")
if __name__ == "__main__":
solve()
| S = eval(input())
if S[0] == "A":
if S.count("C") == 1:
if S[2:-1].count("C") == 1:
S = S.replace("A", "")
S = S.replace("C", "")
if S.islower():
print("AC")
exit()
print("WA")
| 17 | 12 | 280 | 264 | def solve():
s = list(eval(input()))
if s[0] == "A" and s[2:-1].count("C") == 1:
s.remove("A")
s.remove("C")
if "".join(s).islower():
print("AC")
exit()
print("WA")
if __name__ == "__main__":
solve()
| S = eval(input())
if S[0] == "A":
if S.count("C") == 1:
if S[2:-1].count("C") == 1:
S = S.replace("A", "")
S = S.replace("C", "")
if S.islower():
print("AC")
exit()
print("WA")
| false | 29.411765 | [
"-def solve():",
"- s = list(eval(input()))",
"- if s[0] == \"A\" and s[2:-1].count(\"C\") == 1:",
"- s.remove(\"A\")",
"- s.remove(\"C\")",
"- if \"\".join(s).islower():",
"- print(\"AC\")",
"- exit()",
"- print(\"WA\")",
"-",
"-",
"-if __na... | false | 0.037694 | 0.037752 | 0.998481 | [
"s446025974",
"s157667986"
] |
u278714855 | p02388 | python | s145162015 | s549206399 | 20 | 10 | 4,188 | 6,424 | Accepted | Accepted | 50 | x=int(input())
print(x*x*x) | a = input()
print(int(a)**3) | 2 | 2 | 31 | 32 | x = int(input())
print(x * x * x)
| a = input()
print(int(a) ** 3)
| false | 0 | [
"-x = int(input())",
"-print(x * x * x)",
"+a = input()",
"+print(int(a) ** 3)"
] | false | 0.037277 | 0.067176 | 0.554911 | [
"s145162015",
"s549206399"
] |
u796942881 | p03775 | python | s342655219 | s610340629 | 53 | 23 | 3,188 | 3,060 | Accepted | Accepted | 56.6 | import math
def divisor(div, N):
# 約数
i = 1
n = N
while i <= math.sqrt(n):
if n % i == 0:
div.append([i, n // i])
i += 1
def main():
N = int(eval(input()))
div = []
divisor(div, N)
print((max(int(math.log10(div[-1][0]) + 1),
... | import math
def divisor(div, n):
# 約数
ini = 1 if n % 2 else 2
for i in range(ini, int(math.sqrt(n)) + 1, 2):
if n % i == 0:
div.append([i, n // i])
def main():
N = int(eval(input()))
div = []
divisor(div, N)
print((max(int(math.log10(div[-1][0]) + 1),
... | 24 | 21 | 374 | 385 | import math
def divisor(div, N):
# 約数
i = 1
n = N
while i <= math.sqrt(n):
if n % i == 0:
div.append([i, n // i])
i += 1
def main():
N = int(eval(input()))
div = []
divisor(div, N)
print((max(int(math.log10(div[-1][0]) + 1), int(math.log10(div[-1][1]) + 1)... | import math
def divisor(div, n):
# 約数
ini = 1 if n % 2 else 2
for i in range(ini, int(math.sqrt(n)) + 1, 2):
if n % i == 0:
div.append([i, n // i])
def main():
N = int(eval(input()))
div = []
divisor(div, N)
print((max(int(math.log10(div[-1][0]) + 1), int(math.log10(d... | false | 12.5 | [
"-def divisor(div, N):",
"+def divisor(div, n):",
"- i = 1",
"- n = N",
"- while i <= math.sqrt(n):",
"+ ini = 1 if n % 2 else 2",
"+ for i in range(ini, int(math.sqrt(n)) + 1, 2):",
"- i += 1"
] | false | 0.040891 | 0.121572 | 0.336353 | [
"s342655219",
"s610340629"
] |
u316464887 | p03372 | python | s916722527 | s864000786 | 907 | 625 | 75,992 | 72,280 | Accepted | Accepted | 31.09 | class SegTree:
def __init__(self, a, func):
self.n = 2**(len(a) - 1).bit_length()
self.f = func
self.d = [0] * (2 * self.n - 1)
self.d[self.n - 1:self.n - 1 + len(a)] = a
for i in reversed(list(range(self.n - 1))):
self.d[i] = self.f(self.d[2 * i + 1], self... | #AC dattakedo segtree iranaikara keshita
def main():
N, C = list(map(int, input().split()))
S = []
for i in range(N):
x, v = list(map(int, input().split()))
S.append((x,v))
r = [S[0][1] - S[0][0]]
rm = [S[0][1] - S[0][0]]
for i, v in enumerate(S[1:], start=1):
r... | 55 | 28 | 1,692 | 909 | class SegTree:
def __init__(self, a, func):
self.n = 2 ** (len(a) - 1).bit_length()
self.f = func
self.d = [0] * (2 * self.n - 1)
self.d[self.n - 1 : self.n - 1 + len(a)] = a
for i in reversed(list(range(self.n - 1))):
self.d[i] = self.f(self.d[2 * i + 1], self.d[... | # AC dattakedo segtree iranaikara keshita
def main():
N, C = list(map(int, input().split()))
S = []
for i in range(N):
x, v = list(map(int, input().split()))
S.append((x, v))
r = [S[0][1] - S[0][0]]
rm = [S[0][1] - S[0][0]]
for i, v in enumerate(S[1:], start=1):
r.append(... | false | 49.090909 | [
"-class SegTree:",
"- def __init__(self, a, func):",
"- self.n = 2 ** (len(a) - 1).bit_length()",
"- self.f = func",
"- self.d = [0] * (2 * self.n - 1)",
"- self.d[self.n - 1 : self.n - 1 + len(a)] = a",
"- for i in reversed(list(range(self.n - 1))):",
"- ... | false | 0.096969 | 0.081373 | 1.191657 | [
"s916722527",
"s864000786"
] |
u036104576 | p02924 | python | s243092109 | s140799382 | 151 | 17 | 12,400 | 2,940 | Accepted | Accepted | 88.74 | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(eval(input()))
print(((n) * (n-1)//2)) | N = int(eval(input()))
print((N * (N - 1) // 2)) | 11 | 3 | 204 | 43 | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(eval(input()))
print(((n) * (n - 1) // 2))
| N = int(eval(input()))
print((N * (N - 1) // 2))
| false | 72.727273 | [
"-import sys",
"-import itertools",
"-import numpy as np",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-n = int(eval(input()))",
"-print(((n) * (n - 1) // 2))",
"+N = int(eval(input()))",
"+print((N * (N - 1) // 2))"
... | false | 0.034519 | 0.035258 | 0.979044 | [
"s243092109",
"s140799382"
] |
u621935300 | p03078 | python | s358076063 | s306450267 | 745 | 119 | 155,080 | 39,452 | Accepted | Accepted | 84.03 | 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()))
L=[]
for a in A:
for b in B:
L.append(a+b)
L.sort(reverse=True)
L=L[:K]
L2=[]
for ab in L:
for c in C:
L2.append(ab+c)
L2.sort(reverse=True)
for i ... | 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()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
L=[]
for ia, a in enumerate(A):
for ib, b in enumerate(B):
for ic, c in enumerate(C):
if (ia+1... | 22 | 22 | 338 | 432 | 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()))
L = []
for a in A:
for b in B:
L.append(a + b)
L.sort(reverse=True)
L = L[:K]
L2 = []
for ab in L:
for c in C:
L2.append(ab + c)
L2.sort(revers... | 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()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
L = []
for ia, a in enumerate(A):
for ib, b in enumerate(B):
for ic, c in enumerate(C):
... | false | 0 | [
"+A.sort(reverse=True)",
"+B.sort(reverse=True)",
"+C.sort(reverse=True)",
"-for a in A:",
"- for b in B:",
"- L.append(a + b)",
"+for ia, a in enumerate(A):",
"+ for ib, b in enumerate(B):",
"+ for ic, c in enumerate(C):",
"+ if (ia + 1) * (ib + 1) * (ic + 1) <= K:"... | false | 0.047773 | 0.04205 | 1.136104 | [
"s358076063",
"s306450267"
] |
u761320129 | p03634 | python | s508522665 | s588394997 | 1,510 | 1,268 | 44,300 | 71,188 | Accepted | Accepted | 16.03 | import heapq
N = int(eval(input()))
es = [[] for i in range(N)]
for i in range(N-1):
a,b,c = list(map(int,input().split()))
a,b = a-1, b-1
es[a].append((b,c))
es[b].append((a,c))
Q,K = list(map(int, input().split()))
K -= 1
INF = float('inf')
ds = [INF for i in range(N)]
ds[K] = 0
visited... | import heapq
N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(N-1)]
Q,K = list(map(int,input().split()))
K -= 1
qs = [tuple(map(int,input().split())) for i in range(Q)]
es = [[] for i in range(N)]
for a,b,c in src:
a,b = a-1,b-1
es[a].append((c,b))
es[b].append((c,a))... | 29 | 29 | 656 | 638 | import heapq
N = int(eval(input()))
es = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a, b = a - 1, b - 1
es[a].append((b, c))
es[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
INF = float("inf")
ds = [INF for i in range(N)]
ds[K] = 0
visited ... | import heapq
N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(N - 1)]
Q, K = list(map(int, input().split()))
K -= 1
qs = [tuple(map(int, input().split())) for i in range(Q)]
es = [[] for i in range(N)]
for a, b, c in src:
a, b = a - 1, b - 1
es[a].append((c, b))
es[b].append((c... | false | 0 | [
"-es = [[] for i in range(N)]",
"-for i in range(N - 1):",
"- a, b, c = list(map(int, input().split()))",
"- a, b = a - 1, b - 1",
"- es[a].append((b, c))",
"- es[b].append((a, c))",
"+src = [tuple(map(int, input().split())) for i in range(N - 1)]",
"+qs = [tuple(map(int, input().split()))... | false | 0.042714 | 0.043319 | 0.986047 | [
"s508522665",
"s588394997"
] |
u724687935 | p03494 | python | s683092441 | s335673829 | 177 | 18 | 38,640 | 2,940 | Accepted | Accepted | 89.83 | def main():
_ = eval(input())
li = list(map(int, input().split()))
cnt = 0
while True:
if 1 in [x % 2 for x in li]:
break
else:
cnt += 1
li = [x // 2 for x in li]
print(cnt)
if __name__ == '__main__':
main()
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
B = []
for a in A:
cnt = 0
while a % 2 == 0:
a //= 2
cnt += 1
B.append(cnt)
print((min(B)))
| 16 | 13 | 296 | 193 | def main():
_ = eval(input())
li = list(map(int, input().split()))
cnt = 0
while True:
if 1 in [x % 2 for x in li]:
break
else:
cnt += 1
li = [x // 2 for x in li]
print(cnt)
if __name__ == "__main__":
main()
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
B = []
for a in A:
cnt = 0
while a % 2 == 0:
a //= 2
cnt += 1
B.append(cnt)
print((min(B)))
| false | 18.75 | [
"-def main():",
"- _ = eval(input())",
"- li = list(map(int, input().split()))",
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"+ans = 0",
"+B = []",
"+for a in A:",
"- while True:",
"- if 1 in [x % 2 for x in li]:",
"- break",
"- else:",
... | false | 0.045183 | 0.042147 | 1.072034 | [
"s683092441",
"s335673829"
] |
u221898645 | p03798 | python | s234328486 | s139879576 | 1,349 | 231 | 3,500 | 3,444 | Accepted | Accepted | 82.88 | global S,ans
def check_at(i):
global S,ans
if ans[i] == "S":
if (S[i] == "o" and ans[i-1] != ans[i+1]) or (S[i] == "x" and ans[i-1] == ans[i+1]):
return True
else:
if (S[i] == "o" and ans[i-1] == ans[i+1]) or (S[i] == "x" and ans[i-1] != ans[i+1]):
return True
N = int(eval(input... | N = int(eval(input()))
S = eval(input())
opposite = {"S": "W",
"W": "S"}
for ans in ["SS","SW","WS","WW"]:
for i in range(1,N-1):
if ans[i] == "S" and S[i] == "o":
ans += ans[i-1]
elif ans[i] == "S" and S[i] == "x":
ans += opposite[ans[i-1]]
elif ans[i] == "W" and S[i... | 34 | 29 | 815 | 742 | global S, ans
def check_at(i):
global S, ans
if ans[i] == "S":
if (S[i] == "o" and ans[i - 1] != ans[i + 1]) or (
S[i] == "x" and ans[i - 1] == ans[i + 1]
):
return True
else:
if (S[i] == "o" and ans[i - 1] == ans[i + 1]) or (
S[i] == "x" and ans... | N = int(eval(input()))
S = eval(input())
opposite = {"S": "W", "W": "S"}
for ans in ["SS", "SW", "WS", "WW"]:
for i in range(1, N - 1):
if ans[i] == "S" and S[i] == "o":
ans += ans[i - 1]
elif ans[i] == "S" and S[i] == "x":
ans += opposite[ans[i - 1]]
elif ans[i] == "... | false | 14.705882 | [
"-global S, ans",
"-",
"-",
"-def check_at(i):",
"- global S, ans",
"- if ans[i] == \"S\":",
"- if (S[i] == \"o\" and ans[i - 1] != ans[i + 1]) or (",
"- S[i] == \"x\" and ans[i - 1] == ans[i + 1]",
"- ):",
"- return True",
"- else:",
"- if (... | false | 0.079967 | 0.035699 | 2.240044 | [
"s234328486",
"s139879576"
] |
u708255304 | p02787 | python | s601370940 | s052241605 | 1,164 | 602 | 289,416 | 122,476 | Accepted | Accepted | 48.28 | H, N = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# 個数制限なしナップサック
# i番目までの魔法を使ったときにHダメージを実現できるときの最小の魔力
dp = [[float('inf')]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
for j in range(H+1):
... | H, N = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# 個数制限なしナップサック
# i番目までの魔法を使ったときにHダメージを実現できるときの最小の魔力
dp = [[10**10]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
for j in range(H+1):
... | 20 | 20 | 515 | 509 | H, N = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# 個数制限なしナップサック
# i番目までの魔法を使ったときにHダメージを実現できるときの最小の魔力
dp = [[float("inf")] * (H + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(H + 1):
... | H, N = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# 個数制限なしナップサック
# i番目までの魔法を使ったときにHダメージを実現できるときの最小の魔力
dp = [[10**10] * (H + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(H + 1):
# i番目の... | false | 0 | [
"-dp = [[float(\"inf\")] * (H + 1) for _ in range(N + 1)]",
"+dp = [[10**10] * (H + 1) for _ in range(N + 1)]"
] | false | 0.148462 | 0.146661 | 1.01228 | [
"s601370940",
"s052241605"
] |
u550535134 | p02712 | python | s464765952 | s615566208 | 170 | 156 | 9,160 | 9,156 | Accepted | Accepted | 8.24 | N = int(eval(input()))
total = 0
for i in range(1, N+1):
if (i%3) != 0 and (i%5) != 0:
total = total + i
print(total)
| N = int(eval(input()))
total = 0
for i in range(1, N+1):
if (i%3) != 0 and (i%5) != 0:
total += i
print(total)
| 6 | 6 | 124 | 116 | N = int(eval(input()))
total = 0
for i in range(1, N + 1):
if (i % 3) != 0 and (i % 5) != 0:
total = total + i
print(total)
| N = int(eval(input()))
total = 0
for i in range(1, N + 1):
if (i % 3) != 0 and (i % 5) != 0:
total += i
print(total)
| false | 0 | [
"- total = total + i",
"+ total += i"
] | false | 0.433711 | 0.295662 | 1.466914 | [
"s464765952",
"s615566208"
] |
u113971909 | p03487 | python | s470575476 | s754775282 | 150 | 110 | 21,236 | 21,220 | Accepted | Accepted | 26.67 | N=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
from collections import Counter
A=Counter(A)
ret=0
for i in A.most_common():
if i[0]>i[1]:
ret+=i[1]
else:
ret+=i[1]-i[0]
print(ret) | N=int(eval(input()))
A=list(map(int,input().split()))
from collections import Counter
A=Counter(A)
ret=0
for i in A.most_common():
if i[0]>i[1]:
ret+=i[1]
else:
ret+=i[1]-i[0]
print(ret) | 12 | 11 | 212 | 202 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from collections import Counter
A = Counter(A)
ret = 0
for i in A.most_common():
if i[0] > i[1]:
ret += i[1]
else:
ret += i[1] - i[0]
print(ret)
| N = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter
A = Counter(A)
ret = 0
for i in A.most_common():
if i[0] > i[1]:
ret += i[1]
else:
ret += i[1] - i[0]
print(ret)
| false | 8.333333 | [
"-A.sort()"
] | false | 0.082811 | 0.034339 | 2.411579 | [
"s470575476",
"s754775282"
] |
u813102292 | p03476 | python | s634261414 | s756371356 | 558 | 500 | 29,796 | 29,812 | Accepted | Accepted | 10.39 | q = int(eval(input()))
a = [list(int(i) for i in input().split()) for i in range(q)]
MAX = 10**5
is_prime = [1]*MAX
for i in range(2, MAX):
if not is_prime[i]:
continue
for j in range(i*2, MAX, i):
is_prime[j] = 0
s = [0]*MAX
for i in range(3,MAX):
s[i] = s[i-1] + 1 if is_prime[i]... | def main():
q = int(eval(input()))
a = [list(int(i) for i in input().split()) for i in range(q)]
MAX = 10**5
is_prime = [1]*MAX
for i in range(2, MAX):
if not is_prime[i]:
continue
for j in range(i*2, MAX, i):
is_prime[j] = 0
s = [0]*MAX
for... | 15 | 19 | 409 | 524 | q = int(eval(input()))
a = [list(int(i) for i in input().split()) for i in range(q)]
MAX = 10**5
is_prime = [1] * MAX
for i in range(2, MAX):
if not is_prime[i]:
continue
for j in range(i * 2, MAX, i):
is_prime[j] = 0
s = [0] * MAX
for i in range(3, MAX):
s[i] = s[i - 1] + 1 if is_prime[i] a... | def main():
q = int(eval(input()))
a = [list(int(i) for i in input().split()) for i in range(q)]
MAX = 10**5
is_prime = [1] * MAX
for i in range(2, MAX):
if not is_prime[i]:
continue
for j in range(i * 2, MAX, i):
is_prime[j] = 0
s = [0] * MAX
for i in... | false | 21.052632 | [
"-q = int(eval(input()))",
"-a = [list(int(i) for i in input().split()) for i in range(q)]",
"-MAX = 10**5",
"-is_prime = [1] * MAX",
"-for i in range(2, MAX):",
"- if not is_prime[i]:",
"- continue",
"- for j in range(i * 2, MAX, i):",
"- is_prime[j] = 0",
"-s = [0] * MAX",
... | false | 0.14386 | 0.124637 | 1.154232 | [
"s634261414",
"s756371356"
] |
u707124227 | p02775 | python | s940007931 | s237893101 | 806 | 112 | 236,020 | 75,868 | Accepted | Accepted | 86.1 | s='0'
s+=eval(input())
n=len(s)
inf=float('inf')
dp=[[inf]*2 for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
for j in range(2):
si=int(s[-i-1])
si+=j
for a in range(10):
ni=i+1
nj=0
b=a-si
if b<0:
nj=1
b+=10
dp[ni][nj]=min(dp[ni][nj],dp[i][... | s=eval(input())
n=len(s)
dp=0,1
for i in range(n):
si=int(s[i])
a=min(dp[0]+si,dp[1]+10-si)
b=min(dp[0]+si+1,dp[1]+10-(si+1))
dp=a,b
print((dp[0])) | 19 | 9 | 338 | 155 | s = "0"
s += eval(input())
n = len(s)
inf = float("inf")
dp = [[inf] * 2 for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for j in range(2):
si = int(s[-i - 1])
si += j
for a in range(10):
ni = i + 1
nj = 0
b = a - si
if b < 0:
... | s = eval(input())
n = len(s)
dp = 0, 1
for i in range(n):
si = int(s[i])
a = min(dp[0] + si, dp[1] + 10 - si)
b = min(dp[0] + si + 1, dp[1] + 10 - (si + 1))
dp = a, b
print((dp[0]))
| false | 52.631579 | [
"-s = \"0\"",
"-s += eval(input())",
"+s = eval(input())",
"-inf = float(\"inf\")",
"-dp = [[inf] * 2 for _ in range(n + 1)]",
"-dp[0][0] = 0",
"+dp = 0, 1",
"- for j in range(2):",
"- si = int(s[-i - 1])",
"- si += j",
"- for a in range(10):",
"- ni = i + 1"... | false | 0.037675 | 0.046332 | 0.81314 | [
"s940007931",
"s237893101"
] |
u273010357 | p03160 | python | s529688605 | s695906652 | 155 | 139 | 13,928 | 13,928 | Accepted | Accepted | 10.32 | def chmin(a, b):
if a > b:
return b
else:
return a
# input
N = int(eval(input()))
h = list(map(int, input().split()))
# dp table
dp = [float('inf')]*(10**5 + 10)
# 初期条件
dp[0] = 0
for i in range(1,N):
dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 1:
... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')]*(10**5 + 10)
dp[0] = 0
for i in range(1,N):
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1])) | 23 | 10 | 393 | 226 | def chmin(a, b):
if a > b:
return b
else:
return a
# input
N = int(eval(input()))
h = list(map(int, input().split()))
# dp table
dp = [float("inf")] * (10**5 + 10)
# 初期条件
dp[0] = 0
for i in range(1, N):
dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = ch... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * (10**5 + 10)
dp[0] = 0
for i in range(1, N):
dp[i] = min(
dp[i], dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])
)
print((dp[N - 1]))
| false | 56.521739 | [
"-def chmin(a, b):",
"- if a > b:",
"- return b",
"- else:",
"- return a",
"-",
"-",
"-# input",
"-# dp table",
"-# 初期条件",
"- dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- if i > 1:",
"- dp[i] = chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))",
... | false | 0.042851 | 0.041988 | 1.020553 | [
"s529688605",
"s695906652"
] |
u175034939 | p03221 | python | s541681165 | s706492944 | 1,077 | 924 | 49,468 | 39,372 | Accepted | Accepted | 14.21 | n,m = list(map(int,input().split()))
ken = []
for i in range(m):
p,y = list(map(int,input().split()))
ken.append([p,y,i+1])
k = sorted(ken)
a = []
cnt = 1
for i in range(m):
if i >= 1:
if k[i][0] == k[i-1][0]:
cnt += 1
else:
cnt = 1
a.append([k[i][... | n,m = list(map(int,input().split()))
ken = []
for i in range(m):
p,y = list(map(int,input().split()))
ken.append([p,y,i+1])
k = sorted(ken)
a = []
cnt = 1
for i in range(m):
if i >= 1:
if k[i][0] == k[i-1][0]:
cnt += 1
else:
cnt = 1
a.append([k[i]... | 24 | 20 | 498 | 432 | n, m = list(map(int, input().split()))
ken = []
for i in range(m):
p, y = list(map(int, input().split()))
ken.append([p, y, i + 1])
k = sorted(ken)
a = []
cnt = 1
for i in range(m):
if i >= 1:
if k[i][0] == k[i - 1][0]:
cnt += 1
else:
cnt = 1
a.append([k[i][-1], k... | n, m = list(map(int, input().split()))
ken = []
for i in range(m):
p, y = list(map(int, input().split()))
ken.append([p, y, i + 1])
k = sorted(ken)
a = []
cnt = 1
for i in range(m):
if i >= 1:
if k[i][0] == k[i - 1][0]:
cnt += 1
else:
cnt = 1
a.append([k[i][-1], k... | false | 16.666667 | [
"-b = []",
"- b.append([aa[i][1], aa[i][2]])",
"-for i in range(m):",
"- print((\"{0:06d}\".format(b[i][0]) + \"{0:06d}\".format(b[i][1])))",
"+ print((\"{0:06d}\".format(aa[i][1]) + \"{0:06d}\".format(aa[i][2])))"
] | false | 0.04237 | 0.04098 | 1.033908 | [
"s541681165",
"s706492944"
] |
u608088992 | p02983 | python | s867722944 | s480495734 | 1,210 | 606 | 3,060 | 3,060 | Accepted | Accepted | 49.92 | import sys
def solve():
input = sys.stdin.readline
L, R = list(map(int, input().split()))
if R - L >= 2018: print((0))
else:
ans = 2019
for i in range(L, R):
for j in range(L + 1, R + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
... | import sys
def solve():
input = sys.stdin.readline
L, R = list(map(int, input().split()))
if R - L >= 2019: print((0))
else:
minMod = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
minMod = min((i * j) % 2019, minMod)
print(minMod... | 17 | 17 | 364 | 372 | import sys
def solve():
input = sys.stdin.readline
L, R = list(map(int, input().split()))
if R - L >= 2018:
print((0))
else:
ans = 2019
for i in range(L, R):
for j in range(L + 1, R + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
return 0... | import sys
def solve():
input = sys.stdin.readline
L, R = list(map(int, input().split()))
if R - L >= 2019:
print((0))
else:
minMod = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
minMod = min((i * j) % 2019, minMod)
print(minMod)
... | false | 0 | [
"- if R - L >= 2018:",
"+ if R - L >= 2019:",
"- ans = 2019",
"+ minMod = 2019",
"- for j in range(L + 1, R + 1):",
"- ans = min(ans, (i * j) % 2019)",
"- print(ans)",
"+ for j in range(i + 1, R + 1):",
"+ minMod = min((i... | false | 0.191998 | 0.110206 | 1.742175 | [
"s867722944",
"s480495734"
] |
u533039576 | p03111 | python | s717616682 | s567740627 | 427 | 69 | 3,064 | 3,064 | Accepted | Accepted | 83.84 | n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = 3000
for bits in range(4**n):
xa = xb = xc = 0
tmp_ans = 0
for i in range(n):
f = (bits//(4**i)) % 4
if f == 1:
if xa != 0:
tmp_ans += 10
xa += l... | n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
INF = 10**9
def dfs(index, x, y, z):
if index == n:
return abs(a-x) + abs(b-y) + abs(c-z) - 30 if min(x, y, z) > 0 else INF
cand1 = dfs(index+1, x+l[index], y, z) + 10
cand2 = dfs(index+1, x, y+l[index... | 29 | 16 | 680 | 475 | n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = 3000
for bits in range(4**n):
xa = xb = xc = 0
tmp_ans = 0
for i in range(n):
f = (bits // (4**i)) % 4
if f == 1:
if xa != 0:
tmp_ans += 10
xa += l[i]
... | n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
INF = 10**9
def dfs(index, x, y, z):
if index == n:
return abs(a - x) + abs(b - y) + abs(c - z) - 30 if min(x, y, z) > 0 else INF
cand1 = dfs(index + 1, x + l[index], y, z) + 10
cand2 = dfs(index + 1, x, y + l[... | false | 44.827586 | [
"-ans = 3000",
"-for bits in range(4**n):",
"- xa = xb = xc = 0",
"- tmp_ans = 0",
"- for i in range(n):",
"- f = (bits // (4**i)) % 4",
"- if f == 1:",
"- if xa != 0:",
"- tmp_ans += 10",
"- xa += l[i]",
"- elif f == 2:",
"- ... | false | 0.40253 | 0.089098 | 4.517823 | [
"s717616682",
"s567740627"
] |
u545368057 | p03612 | python | s803448324 | s010004552 | 78 | 71 | 14,008 | 20,540 | Accepted | Accepted | 8.97 | N = int(eval(input()))
ps = list(map(int,input().split()))
# p_swap = [-1]*N
ans = 0
for i in range(N-1):
if i+1 == ps[i]:
p1,p2 = ps[i:i+2]
ps[i] = p2
ps[i+1] = p1
ans += 1
if ps[N-1] == N:
ans += 1
print(ans) | # 前から順番に後ろに向けてswap
n = int(eval(input()))
ps = list(map(int, input().split()))
cnt = 0
for i in range(n-1):
if i + 1 == ps[i]:
tmp = ps[i]
ps[i] = ps[i+1]
ps[i+1] = tmp
cnt += 1
# 最後残っていたら直前とswap
if ps[n-1] == n:
cnt += 1
print(cnt)
| 13 | 16 | 256 | 284 | N = int(eval(input()))
ps = list(map(int, input().split()))
# p_swap = [-1]*N
ans = 0
for i in range(N - 1):
if i + 1 == ps[i]:
p1, p2 = ps[i : i + 2]
ps[i] = p2
ps[i + 1] = p1
ans += 1
if ps[N - 1] == N:
ans += 1
print(ans)
| # 前から順番に後ろに向けてswap
n = int(eval(input()))
ps = list(map(int, input().split()))
cnt = 0
for i in range(n - 1):
if i + 1 == ps[i]:
tmp = ps[i]
ps[i] = ps[i + 1]
ps[i + 1] = tmp
cnt += 1
# 最後残っていたら直前とswap
if ps[n - 1] == n:
cnt += 1
print(cnt)
| false | 18.75 | [
"-N = int(eval(input()))",
"+# 前から順番に後ろに向けてswap",
"+n = int(eval(input()))",
"-# p_swap = [-1]*N",
"-ans = 0",
"-for i in range(N - 1):",
"+cnt = 0",
"+for i in range(n - 1):",
"- p1, p2 = ps[i : i + 2]",
"- ps[i] = p2",
"- ps[i + 1] = p1",
"- ans += 1",
"-if ps[N... | false | 0.040901 | 0.147908 | 0.276533 | [
"s803448324",
"s010004552"
] |
u757030836 | p03086 | python | s927251444 | s381761464 | 21 | 19 | 3,188 | 3,188 | Accepted | Accepted | 9.52 | import re
print((max(list(map(len,re.findall("[ACGT]*",eval(input()))))))) | import re
s = eval(input())
print((max(list(map(len,re.split("[^ACGT]",s)))))) | 2 | 4 | 61 | 68 | import re
print((max(list(map(len, re.findall("[ACGT]*", eval(input())))))))
| import re
s = eval(input())
print((max(list(map(len, re.split("[^ACGT]", s))))))
| false | 50 | [
"-print((max(list(map(len, re.findall(\"[ACGT]*\", eval(input())))))))",
"+s = eval(input())",
"+print((max(list(map(len, re.split(\"[^ACGT]\", s))))))"
] | false | 0.196008 | 0.119426 | 1.641254 | [
"s927251444",
"s381761464"
] |
u902151549 | p03078 | python | s049186741 | s813942400 | 778 | 133 | 142,120 | 8,708 | Accepted | Accepted | 82.9 | import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
ab=[]
for a in abc[0]:
for b in abc[1]:
ab.append(a+b)
ab.sort()
ab.reverse()
abc[2].sort()
abc[2].reverse()
abc2=[]
for c in range(len(abc[2])):
for a in range(min([math.ceil(xyzk[3])... | import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
for a in range(3):
abc[a].sort()
abc[a].reverse()
abc2=[]
for a in range(len(abc[0])):
for b in range(len(abc[1])):
if (a+1)*(b+1)>xyzk[3]:
break
for c in range(l... | 19 | 19 | 445 | 530 | import math
xyzk = list(map(int, input().split()))
abc = [list(map(int, input().split())) for a in range(3)]
ab = []
for a in abc[0]:
for b in abc[1]:
ab.append(a + b)
ab.sort()
ab.reverse()
abc[2].sort()
abc[2].reverse()
abc2 = []
for c in range(len(abc[2])):
for a in range(min([math.ceil(xyzk[3]), le... | import math
xyzk = list(map(int, input().split()))
abc = [list(map(int, input().split())) for a in range(3)]
for a in range(3):
abc[a].sort()
abc[a].reverse()
abc2 = []
for a in range(len(abc[0])):
for b in range(len(abc[1])):
if (a + 1) * (b + 1) > xyzk[3]:
break
for c in range... | false | 0 | [
"-ab = []",
"-for a in abc[0]:",
"- for b in abc[1]:",
"- ab.append(a + b)",
"-ab.sort()",
"-ab.reverse()",
"-abc[2].sort()",
"-abc[2].reverse()",
"+for a in range(3):",
"+ abc[a].sort()",
"+ abc[a].reverse()",
"-for c in range(len(abc[2])):",
"- for a in range(min([math.c... | false | 0.045497 | 0.116615 | 0.390147 | [
"s049186741",
"s813942400"
] |
u488178971 | p02819 | python | s715415791 | s664564477 | 230 | 18 | 7,576 | 3,060 | Accepted | Accepted | 92.17 | X = int(eval(input()))
import math
def get_prime(n):
if n <=1:
return []
prime = [2]
limit = int(math.sqrt(n))
# 奇数のリストを作成
data = [i+1 for i in range(2,n,2)]
while limit > data[0]:
prime.append(data[0])
data = [j for j in data if j % data[0] !=0]
... | X = int(eval(input()))
def is_prime(n):
if n <= 1:
return False
for i in range(2,int(n**0.5)+1):
if n % i ==0:
return False
return True
for i in range(X,(X*2)+100,):
if is_prime(i):
print(i)
break
| 20 | 15 | 414 | 283 | X = int(eval(input()))
import math
def get_prime(n):
if n <= 1:
return []
prime = [2]
limit = int(math.sqrt(n))
# 奇数のリストを作成
data = [i + 1 for i in range(2, n, 2)]
while limit > data[0]:
prime.append(data[0])
data = [j for j in data if j % data[0] != 0]
return prime ... | X = int(eval(input()))
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
for i in range(
X,
(X * 2) + 100,
):
if is_prime(i):
print(i)
break
| false | 25 | [
"-import math",
"-def get_prime(n):",
"+def is_prime(n):",
"- return []",
"- prime = [2]",
"- limit = int(math.sqrt(n))",
"- # 奇数のリストを作成",
"- data = [i + 1 for i in range(2, n, 2)]",
"- while limit > data[0]:",
"- prime.append(data[0])",
"- data = [j for j in ... | false | 0.178061 | 0.036816 | 4.83653 | [
"s715415791",
"s664564477"
] |
u368796742 | p02703 | python | s484165848 | s059418361 | 1,010 | 567 | 99,456 | 26,236 | Accepted | Accepted | 43.86 | def main():
import heapq
def dijkstra(graph,start,cd,s):
dist = [[float("inf")]*2505 for _ in range(n)]
q = []
dist[start][s] = 0
heapq.heappush(q, (0,start,s))
while q:
cost, cur_node,coin = heapq.heappop(q)
... | def main():
import heapq
def dijkstra(graph,s,cd,c):
dist = [[float("inf")]*2505 for _ in range(n)]
q = []
dist[s][c] = 0
heapq.heappush(q, (0,s,c))
while q:
d, p,c = heapq.heappop(q)
if dist[p][c] < d:
... | 41 | 46 | 1,444 | 1,416 | def main():
import heapq
def dijkstra(graph, start, cd, s):
dist = [[float("inf")] * 2505 for _ in range(n)]
q = []
dist[start][s] = 0
heapq.heappush(q, (0, start, s))
while q:
cost, cur_node, coin = heapq.heappop(q)
if dist[cur_node][coin] < cost... | def main():
import heapq
def dijkstra(graph, s, cd, c):
dist = [[float("inf")] * 2505 for _ in range(n)]
q = []
dist[s][c] = 0
heapq.heappush(q, (0, s, c))
while q:
d, p, c = heapq.heappop(q)
if dist[p][c] < d:
continue
... | false | 10.869565 | [
"- def dijkstra(graph, start, cd, s):",
"+ def dijkstra(graph, s, cd, c):",
"- dist[start][s] = 0",
"- heapq.heappush(q, (0, start, s))",
"+ dist[s][c] = 0",
"+ heapq.heappush(q, (0, s, c))",
"- cost, cur_node, coin = heapq.heappop(q)",
"- if dis... | false | 0.122137 | 0.204051 | 0.598563 | [
"s484165848",
"s059418361"
] |
u596276291 | p03425 | python | s673157180 | s026930183 | 454 | 177 | 12,028 | 3,956 | Accepted | Accepted | 61.01 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cac... | 33 | 36 | 765 | 853 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
impor... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import... | false | 8.333333 | [
"+#!/usr/bin/python3",
"-",
"-INF = float(\"inf\")",
"+INF = float(\"inf\")",
"+YES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"",
"+dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]",
"-def solve(N, S):",
"- d = Counter([s[0] for s in S if s[0] in \"MARCH\"])",
"- ans = 0",... | false | 0.037161 | 0.007331 | 5.0687 | [
"s673157180",
"s026930183"
] |
u994988729 | p03111 | python | s120794933 | s786305223 | 388 | 273 | 3,064 | 3,064 | Accepted | Accepted | 29.64 | from itertools import product
n,a,b,c=list(map(int,input().split()))
abc=[a,b,c]
l=tuple(int(eval(input())) for _ in range(n))
ans=10**18
for a in product(list(range(4)), repeat=n):
MP=0
take=[[] for _ in range(4)]
for i in range(n):
take[a[i]].append(l[i])
if take[0] and tak... | from itertools import product
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = 10 ** 18
for alloc in product(list(range(4)), repeat=N):
La = 0
Lb = 0
Lc = 0
use_a = 0
... | 23 | 42 | 507 | 895 | from itertools import product
n, a, b, c = list(map(int, input().split()))
abc = [a, b, c]
l = tuple(int(eval(input())) for _ in range(n))
ans = 10**18
for a in product(list(range(4)), repeat=n):
MP = 0
take = [[] for _ in range(4)]
for i in range(n):
take[a[i]].append(l[i])
if take[0] and take... | from itertools import product
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = 10**18
for alloc in product(list(range(4)), repeat=N):
La = 0
Lb = 0
Lc = 0
use_a = 0
use_b = 0
u... | false | 45.238095 | [
"+import sys",
"-n, a, b, c = list(map(int, input().split()))",
"-abc = [a, b, c]",
"-l = tuple(int(eval(input())) for _ in range(n))",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**7)",
"+N, A, B, C = list(map(int, input().split()))",
"+L = [int(eval(input())) for _ in range(N)]",... | false | 0.249262 | 0.49926 | 0.499262 | [
"s120794933",
"s786305223"
] |
u600402037 | p03456 | python | s719689928 | s630266968 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | a,b=input().split()
print(('Yes' if (int(a+b)**.5).is_integer() else 'No')) | print(('No' if int(input().replace(' ',''))**.5%1 else 'Yes')) | 2 | 1 | 74 | 60 | a, b = input().split()
print(("Yes" if (int(a + b) ** 0.5).is_integer() else "No"))
| print(("No" if int(input().replace(" ", "")) ** 0.5 % 1 else "Yes"))
| false | 50 | [
"-a, b = input().split()",
"-print((\"Yes\" if (int(a + b) ** 0.5).is_integer() else \"No\"))",
"+print((\"No\" if int(input().replace(\" \", \"\")) ** 0.5 % 1 else \"Yes\"))"
] | false | 0.074231 | 0.069325 | 1.07077 | [
"s719689928",
"s630266968"
] |
u600402037 | p02886 | python | s370748348 | s855987778 | 301 | 147 | 21,496 | 12,488 | Accepted | Accepted | 51.16 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
D = np.array(lr())
recover = D[:, None] * D[None, :]
np.fill_diagonal(recover, 0)
answer = recover.sum() // 2
print(answer)
| import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
D = np.array(lr())
recover = D[:, None] * D[None, :]
answer = recover.sum() - np.diag(recover).sum()
print((answer // 2))
| 13 | 12 | 285 | 280 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
D = np.array(lr())
recover = D[:, None] * D[None, :]
np.fill_diagonal(recover, 0)
answer = recover.sum() // 2
print(answer)
| import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
D = np.array(lr())
recover = D[:, None] * D[None, :]
answer = recover.sum() - np.diag(recover).sum()
print((answer // 2))
| false | 7.692308 | [
"-np.fill_diagonal(recover, 0)",
"-answer = recover.sum() // 2",
"-print(answer)",
"+answer = recover.sum() - np.diag(recover).sum()",
"+print((answer // 2))"
] | false | 0.218973 | 0.229043 | 0.956036 | [
"s370748348",
"s855987778"
] |
u852690916 | p03994 | python | s084820531 | s361797301 | 208 | 183 | 55,408 | 46,832 | Accepted | Accepted | 12.02 | s = eval(input())
K = int(eval(input()))
c = [ord(s1)-ord('a') for s1 in s]
sl = list(s)
for i in range(len(s)):
if c[i] and 26-c[i] <= K:
sl[i] = 'a'
K -= 26-c[i]
sl[len(s)-1] = chr((ord(sl[len(s)-1]) - ord('a') + K) % 26 + ord('a'))
print((''.join(sl))) | import sys
def main():
input = sys.stdin.readline
s = input().rstrip()
K = int(eval(input()))
def c(x): return ord(x) - ord('a')
def d(x): return chr(x + ord('a'))
ans = []
i = 0
while i < (len(s) - 1):
to_a = (26 - c(s[i])) % 26
if to_a <= K:
an... | 13 | 26 | 276 | 574 | s = eval(input())
K = int(eval(input()))
c = [ord(s1) - ord("a") for s1 in s]
sl = list(s)
for i in range(len(s)):
if c[i] and 26 - c[i] <= K:
sl[i] = "a"
K -= 26 - c[i]
sl[len(s) - 1] = chr((ord(sl[len(s) - 1]) - ord("a") + K) % 26 + ord("a"))
print(("".join(sl)))
| import sys
def main():
input = sys.stdin.readline
s = input().rstrip()
K = int(eval(input()))
def c(x):
return ord(x) - ord("a")
def d(x):
return chr(x + ord("a"))
ans = []
i = 0
while i < (len(s) - 1):
to_a = (26 - c(s[i])) % 26
if to_a <= K:
... | false | 50 | [
"-s = eval(input())",
"-K = int(eval(input()))",
"-c = [ord(s1) - ord(\"a\") for s1 in s]",
"-sl = list(s)",
"-for i in range(len(s)):",
"- if c[i] and 26 - c[i] <= K:",
"- sl[i] = \"a\"",
"- K -= 26 - c[i]",
"-sl[len(s) - 1] = chr((ord(sl[len(s) - 1]) - ord(\"a\") + K) % 26 + ord(\... | false | 0.076436 | 0.09525 | 0.802483 | [
"s084820531",
"s361797301"
] |
u759412327 | p03574 | python | s216427089 | s812047631 | 34 | 27 | 9,340 | 9,164 | Accepted | Accepted | 20.59 | import itertools
H,W = map(int,input().split())
S = [input() for h in range(H)]
a = [[0 if cell=="." else "#" for cell in row] for row in S]
for h in range(H):
for w in range(W):
if S[h][w]!="#":
continue
for dx,dy in itertools.product([-1,0,1],repeat=2):
x = h+dx
y = w+dy
... | H,W = list(map(int,input().split()))
S = [(2+W)*"."]+["."+eval(input())+"." for h in range(H)]+[(2+W)*"."]
for h in range(1,1+H):
for w in range(1,1+W):
if S[h][w]!="#":
s = S[h-1][w-1:w+2]+S[h][w-1]+S[h][w+1]+S[h+1][w-1:w+2]
S[h]=S[h][:w]+str(s.count("#"))+S[h][w+1:]
for h in range(1,1+H):... | 22 | 11 | 494 | 330 | import itertools
H, W = map(int, input().split())
S = [input() for h in range(H)]
a = [[0 if cell == "." else "#" for cell in row] for row in S]
for h in range(H):
for w in range(W):
if S[h][w] != "#":
continue
for dx, dy in itertools.product([-1, 0, 1], repeat=2):
x = h + d... | H, W = list(map(int, input().split()))
S = [(2 + W) * "."] + ["." + eval(input()) + "." for h in range(H)] + [(2 + W) * "."]
for h in range(1, 1 + H):
for w in range(1, 1 + W):
if S[h][w] != "#":
s = (
S[h - 1][w - 1 : w + 2]
+ S[h][w - 1]
+ S[h][w... | false | 50 | [
"-import itertools",
"-",
"-H, W = map(int, input().split())",
"-S = [input() for h in range(H)]",
"-a = [[0 if cell == \".\" else \"#\" for cell in row] for row in S]",
"-for h in range(H):",
"- for w in range(W):",
"+H, W = list(map(int, input().split()))",
"+S = [(2 + W) * \".\"] + [\".\" + ev... | false | 0.043151 | 0.084246 | 0.512198 | [
"s216427089",
"s812047631"
] |
u380524497 | p02750 | python | s070048107 | s856594318 | 1,587 | 593 | 58,592 | 95,632 | Accepted | Accepted | 62.63 | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
... | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
... | 46 | 46 | 1,058 | 1,025 | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
shops.append... | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
shops.append... | false | 0 | [
"- count_A0 = len(cumA0) - 1",
"- for count, spend_time in enumerate(DP):",
"+ count_A = 28",
"+ for count, spend_time in enumerate(cumA0):",
"- while count_A0 > 0 and cumA0[count_A0] > residue:",
"- count_A0 -= 1",
"- ans.append(count_A0 + count)",
"+ while... | false | 0.032365 | 0.077658 | 0.416763 | [
"s070048107",
"s856594318"
] |
u223663729 | p02760 | python | s339404702 | s612782849 | 171 | 18 | 38,384 | 3,064 | Accepted | Accepted | 89.47 | def f():
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
A = a1+a2+a3
N = int(eval(input()))
c = [False]*9
for i in range(N):
b = int(eval(input()))
if b in A:
c[A.index(b)] = True
for i in range(3):
if ... | *A, = list(map(int, open(0).read().split()))
N = A[9]
B = A[10:]
A = A[:9]
T = [False]*9
for b in B:
if b in A:
T[A.index(b)] = True
bingo = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6),
(1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
for a, b, c in bingo:
if T[a] and T[b] and T[c... | 28 | 20 | 548 | 378 | def f():
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
A = a1 + a2 + a3
N = int(eval(input()))
c = [False] * 9
for i in range(N):
b = int(eval(input()))
if b in A:
c[A.index(b)] = True
for i in r... | (*A,) = list(map(int, open(0).read().split()))
N = A[9]
B = A[10:]
A = A[:9]
T = [False] * 9
for b in B:
if b in A:
T[A.index(b)] = True
bingo = [
(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(0, 3, 6),
(1, 4, 7),
(2, 5, 8),
(0, 4, 8),
(2, 4, 6),
]
for a, b, c in bingo:
if T[a] and T... | false | 28.571429 | [
"-def f():",
"- a1 = list(map(int, input().split()))",
"- a2 = list(map(int, input().split()))",
"- a3 = list(map(int, input().split()))",
"- A = a1 + a2 + a3",
"- N = int(eval(input()))",
"- c = [False] * 9",
"- for i in range(N):",
"- b = int(eval(input()))",
"- ... | false | 0.098472 | 0.036563 | 2.69317 | [
"s339404702",
"s612782849"
] |
u029315034 | p03946 | python | s927352454 | s345576117 | 119 | 97 | 14,244 | 14,244 | Accepted | Accepted | 18.49 | N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]
max_profit = 0
ans = 1
left = 0
right = 1
while right < N:
if a[left] < a[right]:
profit = a[right] - a[left]
if profit == max_profit:
ans += 1
else:
max_profit = max(max_pr... | N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]
max_profit = 0
ans = 1
left = 0
right = 1
min_a = a[0]
for i in range(1, N):
if min_a < a[i]:
profit = a[i] - min_a
if profit == max_profit:
ans += 1
else:
max_profit = max... | 20 | 20 | 397 | 400 | N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]
max_profit = 0
ans = 1
left = 0
right = 1
while right < N:
if a[left] < a[right]:
profit = a[right] - a[left]
if profit == max_profit:
ans += 1
else:
max_profit = max(max_profit, profit)
... | N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]
max_profit = 0
ans = 1
left = 0
right = 1
min_a = a[0]
for i in range(1, N):
if min_a < a[i]:
profit = a[i] - min_a
if profit == max_profit:
ans += 1
else:
max_profit = max(max_profit, prof... | false | 0 | [
"-while right < N:",
"- if a[left] < a[right]:",
"- profit = a[right] - a[left]",
"+min_a = a[0]",
"+for i in range(1, N):",
"+ if min_a < a[i]:",
"+ profit = a[i] - min_a",
"- left = right",
"- right += 1",
"+ min_a = min(min_a, a[i])"
] | false | 0.122965 | 0.080222 | 1.532801 | [
"s927352454",
"s345576117"
] |
u912237403 | p00025 | python | s480718581 | s509838873 | 20 | 10 | 4,204 | 4,208 | Accepted | Accepted | 50 | import sys
f=0
for s in sys.stdin:
f=1-f
b=list(map(int,s.split()))
if f:
a=b
continue
c1=0
c2=0
for i,e in enumerate(b):
if e==a[i]: c1+=1
elif e in a: c2+=1
print(c1, c2) | import sys
f=1
for s in sys.stdin:
b=list(map(int,s.split()))
if f:
a=b
f=0
continue
c1=0
c2=0
for i,e in enumerate(b):
if e==a[i]: c1+=1
elif e in a: c2+=1
print(c1, c2)
f=1 | 14 | 15 | 238 | 249 | import sys
f = 0
for s in sys.stdin:
f = 1 - f
b = list(map(int, s.split()))
if f:
a = b
continue
c1 = 0
c2 = 0
for i, e in enumerate(b):
if e == a[i]:
c1 += 1
elif e in a:
c2 += 1
print(c1, c2)
| import sys
f = 1
for s in sys.stdin:
b = list(map(int, s.split()))
if f:
a = b
f = 0
continue
c1 = 0
c2 = 0
for i, e in enumerate(b):
if e == a[i]:
c1 += 1
elif e in a:
c2 += 1
print(c1, c2)
f = 1
| false | 6.666667 | [
"-f = 0",
"+f = 1",
"- f = 1 - f",
"+ f = 0",
"+ f = 1"
] | false | 0.049162 | 0.045751 | 1.074569 | [
"s480718581",
"s509838873"
] |
u225528554 | p03546 | python | s420395415 | s305871737 | 48 | 44 | 5,872 | 3,444 | Accepted | Accepted | 8.33 | def dijkstra(graph,src):
if graph is None:
return None
nodes = [i for i in range(len(graph))]
visited=[]
if src in nodes:
visited.append(src)
nodes.remove(src)
else:
return None
distance={src:0}
for i in nodes:
distance[i]=int(graph[src][i]... | if __name__=="__main__":
sum = 0
x,y = list(map(int,input().split()))
c = [list(map(int,input().split())) for n in range(10)]
for k in range(10):
for i in range(10):
for j in range(10):
if c[i][j]>c[i][k]+c[k][j]:
c[i][j] = c[i][k]+c[k][j]
... | 63 | 19 | 1,819 | 525 | def dijkstra(graph, src):
if graph is None:
return None
nodes = [i for i in range(len(graph))]
visited = []
if src in nodes:
visited.append(src)
nodes.remove(src)
else:
return None
distance = {src: 0}
for i in nodes:
distance[i] = int(graph[src][i])
... | if __name__ == "__main__":
sum = 0
x, y = list(map(int, input().split()))
c = [list(map(int, input().split())) for n in range(10)]
for k in range(10):
for i in range(10):
for j in range(10):
if c[i][j] > c[i][k] + c[k][j]:
c[i][j] = c[i][k] + c[k][... | false | 69.84127 | [
"-def dijkstra(graph, src):",
"- if graph is None:",
"- return None",
"- nodes = [i for i in range(len(graph))]",
"- visited = []",
"- if src in nodes:",
"- visited.append(src)",
"- nodes.remove(src)",
"- else:",
"- return None",
"- distance = {src: ... | false | 0.151501 | 0.179664 | 0.843245 | [
"s420395415",
"s305871737"
] |
u525065967 | p02888 | python | s900786040 | s109185174 | 1,846 | 1,579 | 3,188 | 3,188 | Accepted | Accepted | 14.46 | import bisect
N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
ans = 0
for b in range(N):
l = b + 1
for a in range(b):
maxL = L[a] + L[b]
r = bisect.bisect_left(L, maxL)
ans += max(0, r-l)
print(ans) | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
ans = 0
for b in range(N):
l = b + 1
r = l
for a in range(b):
maxL = L[a] + L[b]
while r<N and L[r]<maxL: r += 1
ans += max(0, r-l)
print(ans) | 12 | 12 | 254 | 250 | import bisect
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for b in range(N):
l = b + 1
for a in range(b):
maxL = L[a] + L[b]
r = bisect.bisect_left(L, maxL)
ans += max(0, r - l)
print(ans)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for b in range(N):
l = b + 1
r = l
for a in range(b):
maxL = L[a] + L[b]
while r < N and L[r] < maxL:
r += 1
ans += max(0, r - l)
print(ans)
| false | 0 | [
"-import bisect",
"-",
"+ r = l",
"- r = bisect.bisect_left(L, maxL)",
"+ while r < N and L[r] < maxL:",
"+ r += 1"
] | false | 0.034337 | 0.067081 | 0.511873 | [
"s900786040",
"s109185174"
] |
u389910364 | p02856 | python | s059316232 | s062928294 | 1,065 | 395 | 79,708 | 45,428 | Accepted | Accepted | 62.91 | import itertools
import os
import sys
from functools import lru_cache
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
M = int(sys.stdin.buffer.readline())
DC = [list(map(int, sys.stdin... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
# 桁数*9 + 総和が 9 ずつ減る
M = int(sys.stdin.buffer.readline())
DC = [list(map(int, sys.stdin.buffer.readline().split())) for... | 111 | 24 | 2,216 | 441 | import itertools
import os
import sys
from functools import lru_cache
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
M = int(sys.stdin.buffer.readline())
DC = [list(map(int, sys.stdin.buffer.readline().split())... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
# 桁数*9 + 総和が 9 ずつ減る
M = int(sys.stdin.buffer.readline())
DC = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]
s = 0
l ... | false | 78.378378 | [
"-import itertools",
"-from functools import lru_cache",
"+# 桁数*9 + 総和が 9 ずつ減る",
"-",
"-",
"-def test(n):",
"- round = {str(n)}",
"- ret = 0",
"- while round:",
"- next_round = set()",
"- for n in round:",
"- for i in range(len(n) - 1):",
"- s... | false | 0.118014 | 0.07561 | 1.560822 | [
"s059316232",
"s062928294"
] |
u587669944 | p02947 | python | s348654789 | s232167071 | 656 | 419 | 62,040 | 17,852 | Accepted | Accepted | 36.13 | # coding: utf-8
n = int(eval(input()))
dic = {}
for i in range(n):
t = ''.join(sorted(eval(input())))
dic.setdefault(t, 0)
dic[t] += 1
ans = 0
for x in list(dic.values()):
ans += x * (x - 1) // 2
print(ans) | # coding: utf-8
n = int(eval(input()))
dic = {}
for i in range(n):
s = "".join(sorted(eval(input())))
dic.setdefault(s, 0)
dic[s] += 1
ans = 0
for x in list(dic.values()):
ans += int(x * (x - 1) / 2)
print(ans) | 11 | 11 | 214 | 218 | # coding: utf-8
n = int(eval(input()))
dic = {}
for i in range(n):
t = "".join(sorted(eval(input())))
dic.setdefault(t, 0)
dic[t] += 1
ans = 0
for x in list(dic.values()):
ans += x * (x - 1) // 2
print(ans)
| # coding: utf-8
n = int(eval(input()))
dic = {}
for i in range(n):
s = "".join(sorted(eval(input())))
dic.setdefault(s, 0)
dic[s] += 1
ans = 0
for x in list(dic.values()):
ans += int(x * (x - 1) / 2)
print(ans)
| false | 0 | [
"- t = \"\".join(sorted(eval(input())))",
"- dic.setdefault(t, 0)",
"- dic[t] += 1",
"+ s = \"\".join(sorted(eval(input())))",
"+ dic.setdefault(s, 0)",
"+ dic[s] += 1",
"- ans += x * (x - 1) // 2",
"+ ans += int(x * (x - 1) / 2)"
] | false | 0.046126 | 0.044324 | 1.040644 | [
"s348654789",
"s232167071"
] |
u968166680 | p02861 | python | s788280811 | s576340170 | 176 | 18 | 39,024 | 3,064 | Accepted | Accepted | 89.77 | import sys
from itertools import permutations
from math import factorial
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def distance2(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
def main():
... | import sys
from itertools import permutations
from math import factorial
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def distance2(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
def main():
... | 35 | 30 | 817 | 644 | import sys
from itertools import permutations
from math import factorial
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def distance2(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
def main():
N = int(readline... | import sys
from itertools import permutations
from math import factorial
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def distance2(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
def main():
N = int(readline... | false | 14.285714 | [
"- dist = [[0] * N for _ in range(N)]",
"+ ans = 0",
"- dist[i][j] = dist[j][i] = distance2(C[i][0], C[i][1], C[j][0], C[j][1])",
"- ans = 0",
"- for perm in permutations(list(range(N))):",
"- for i in range(N - 1):",
"- ans += dist[perm[i]][perm[i + 1]]",
"- ... | false | 0.154398 | 0.039869 | 3.872613 | [
"s788280811",
"s576340170"
] |
u491763171 | p00014 | python | s798145305 | s745969824 | 20 | 10 | 4,200 | 4,200 | Accepted | Accepted | 50 | L = []
while 1:
try:
d = eval(input())
x = 600
ret = 0
for i in range(0, 600, d):
ret += d * (i ** 2)
print(ret)
except:
break | while 1:
try:
d = eval(input())
print(sum(d * (i ** 2) for i in range(0, 600, d)))
except:
break | 11 | 6 | 197 | 126 | L = []
while 1:
try:
d = eval(input())
x = 600
ret = 0
for i in range(0, 600, d):
ret += d * (i**2)
print(ret)
except:
break
| while 1:
try:
d = eval(input())
print(sum(d * (i**2) for i in range(0, 600, d)))
except:
break
| false | 45.454545 | [
"-L = []",
"- x = 600",
"- ret = 0",
"- for i in range(0, 600, d):",
"- ret += d * (i**2)",
"- print(ret)",
"+ print(sum(d * (i**2) for i in range(0, 600, d)))"
] | false | 0.046796 | 0.111349 | 0.420259 | [
"s798145305",
"s745969824"
] |
u281610856 | p03449 | python | s741670343 | s440167957 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
ans = 0
if n == 1:
print((a1[0] + a2[0]))
exit()
for i in range(1, n):
ans = max(sum(a1[:i])+sum(a2[i-1:]), ans)
print(ans)
| n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
sum_list = [sum(a1[:i]) + sum(a2[i-1:]) for i in range(1, n+1)]
print((max(sum_list)))
| 10 | 6 | 234 | 182 | n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
ans = 0
if n == 1:
print((a1[0] + a2[0]))
exit()
for i in range(1, n):
ans = max(sum(a1[:i]) + sum(a2[i - 1 :]), ans)
print(ans)
| n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
sum_list = [sum(a1[:i]) + sum(a2[i - 1 :]) for i in range(1, n + 1)]
print((max(sum_list)))
| false | 40 | [
"-ans = 0",
"-if n == 1:",
"- print((a1[0] + a2[0]))",
"- exit()",
"-for i in range(1, n):",
"- ans = max(sum(a1[:i]) + sum(a2[i - 1 :]), ans)",
"-print(ans)",
"+sum_list = [sum(a1[:i]) + sum(a2[i - 1 :]) for i in range(1, n + 1)]",
"+print((max(sum_list)))"
] | false | 0.050769 | 0.048832 | 1.039669 | [
"s741670343",
"s440167957"
] |
u753803401 | p03807 | python | s163062373 | s340179881 | 338 | 205 | 88,940 | 56,816 | Accepted | Accepted | 39.35 | import sys
import bisect
import collections
import fractions
import heapq
def slove():
input = sys.stdin.readline
n = int(input().rstrip('\n'))
a = list(map(int, input().rstrip('\n').split()))
cnt = 0
for i in range(n):
if a[i] % 2 != 0:
cnt += 1
if cnt % 2 =... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
cnt = 0
for v in a:
if v % 2 != 0:
cnt += 1
print(("YES" if cnt % 2 == 0 else "NO"))
if __name__ == '__main__':
... | 23 | 17 | 424 | 328 | import sys
import bisect
import collections
import fractions
import heapq
def slove():
input = sys.stdin.readline
n = int(input().rstrip("\n"))
a = list(map(int, input().rstrip("\n").split()))
cnt = 0
for i in range(n):
if a[i] % 2 != 0:
cnt += 1
if cnt % 2 == 0:
pr... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = list(map(int, readline().split()))
cnt = 0
for v in a:
if v % 2 != 0:
cnt += 1
print(("YES" if cnt % 2 == 0 else "NO"))
if __name__ == "__main__":
solve()
| false | 26.086957 | [
"-import bisect",
"-import collections",
"-import fractions",
"-import heapq",
"-def slove():",
"- input = sys.stdin.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = list(map(int, input().rstrip(\"\\n\").split()))",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+... | false | 0.120783 | 0.105226 | 1.147843 | [
"s163062373",
"s340179881"
] |
u192154323 | p03262 | python | s524753446 | s266619385 | 220 | 94 | 19,608 | 85,572 | Accepted | Accepted | 57.27 | import math
from fractions import gcd
from functools import reduce
n,x = list(map(int, input().split()))
y_ls = list(map(int, input().split()))
y_ls.sort()
d_ls = [0] * (n-1)
if n != 1:
first_ls = []
for i in range(n):
first = abs(x - y_ls[i])
first_ls.append(first)
for i in ... | from math import gcd
n,start = list(map(int,input().split()))
x_ls = list(map(int, input().split()))
diff_ls = [0] * n
for i in range(n):
diff_ls[i] = abs(start-x_ls[i])
ans = diff_ls[0]
for i in range(1,n):
ans = gcd(ans,diff_ls[i])
print(ans) | 29 | 13 | 608 | 261 | import math
from fractions import gcd
from functools import reduce
n, x = list(map(int, input().split()))
y_ls = list(map(int, input().split()))
y_ls.sort()
d_ls = [0] * (n - 1)
if n != 1:
first_ls = []
for i in range(n):
first = abs(x - y_ls[i])
first_ls.append(first)
for i in range(n - 1)... | from math import gcd
n, start = list(map(int, input().split()))
x_ls = list(map(int, input().split()))
diff_ls = [0] * n
for i in range(n):
diff_ls[i] = abs(start - x_ls[i])
ans = diff_ls[0]
for i in range(1, n):
ans = gcd(ans, diff_ls[i])
print(ans)
| false | 55.172414 | [
"-import math",
"-from fractions import gcd",
"-from functools import reduce",
"+from math import gcd",
"-n, x = list(map(int, input().split()))",
"-y_ls = list(map(int, input().split()))",
"-y_ls.sort()",
"-d_ls = [0] * (n - 1)",
"-if n != 1:",
"- first_ls = []",
"- for i in range(n):",
... | false | 0.129576 | 0.039385 | 3.289998 | [
"s524753446",
"s266619385"
] |
u745087332 | p03687 | python | s843624923 | s302984127 | 61 | 35 | 3,316 | 3,316 | Accepted | Accepted | 42.62 | # coding:utf-8
from collections import Counter
def inpl(): return list(map(int, input().split()))
S = eval(input())
C = Counter(S)
if len(S) == 1:
print((0))
exit()
ans = 100
for key in list(C.keys()):
prev_S = list(S)
cnt = 0
t = len(S) - 1
while t > 0:
if all(... | # coding:utf-8
import sys
from collections import Counter
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 LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.r... | 35 | 39 | 672 | 837 | # coding:utf-8
from collections import Counter
def inpl():
return list(map(int, input().split()))
S = eval(input())
C = Counter(S)
if len(S) == 1:
print((0))
exit()
ans = 100
for key in list(C.keys()):
prev_S = list(S)
cnt = 0
t = len(S) - 1
while t > 0:
if all([1 if s == key els... | # coding:utf-8
import sys
from collections import Counter
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 LS():
return sys.stdin.readline().split()
def II():
return int(sy... | false | 10.25641 | [
"+import sys",
"-",
"-def inpl():",
"- return list(map(int, input().split()))",
"+INF = float(\"inf\")",
"+MOD = 10**9 + 7",
"-S = eval(input())",
"-C = Counter(S)",
"-if len(S) == 1:",
"- print((0))",
"- exit()",
"-ans = 100",
"-for key in list(C.keys()):",
"- prev_S = list(S)... | false | 0.045667 | 0.038012 | 1.201376 | [
"s843624923",
"s302984127"
] |
u528470578 | p03329 | python | s206408963 | s096054672 | 221 | 103 | 42,080 | 80,264 | Accepted | Accepted | 53.39 | N = int(eval(input()))
INF = int(1e10)
dp = [INF] * N
dp[0] = 1
dp = [0] + dp
bt = set()
for i in range(1, 100):
if 6**i > N:
break
bt.add(6**i)
for i in range(1, 100):
if 9**i > N:
break
bt.add(9**i)
bt = sorted(bt)
for i in range(1, N+1):
dp[i] = dp[i-1] + 1... | N = int(eval(input()))
inf = float("inf")
dp = [inf for _ in range(N+1)]
l6 = 7
l9 = 6
dp[0] = 0
# DP
for i in range(1, N+1):
# 1円を引き出す
dp[i] = min(dp[i], dp[i-1] + 1)
# 6の累乗円を引き出す
for j in range(1, l6):
if i - 6**j >= 0:
dp[i] = min(dp[i], dp[i - 6**j] + 1)
... | 26 | 23 | 420 | 458 | N = int(eval(input()))
INF = int(1e10)
dp = [INF] * N
dp[0] = 1
dp = [0] + dp
bt = set()
for i in range(1, 100):
if 6**i > N:
break
bt.add(6**i)
for i in range(1, 100):
if 9**i > N:
break
bt.add(9**i)
bt = sorted(bt)
for i in range(1, N + 1):
dp[i] = dp[i - 1] + 1
for j in bt:
... | N = int(eval(input()))
inf = float("inf")
dp = [inf for _ in range(N + 1)]
l6 = 7
l9 = 6
dp[0] = 0
# DP
for i in range(1, N + 1):
# 1円を引き出す
dp[i] = min(dp[i], dp[i - 1] + 1)
# 6の累乗円を引き出す
for j in range(1, l6):
if i - 6**j >= 0:
dp[i] = min(dp[i], dp[i - 6**j] + 1)
# 9の累乗円を引き出す
... | false | 11.538462 | [
"-INF = int(1e10)",
"-dp = [INF] * N",
"-dp[0] = 1",
"-dp = [0] + dp",
"-bt = set()",
"-for i in range(1, 100):",
"- if 6**i > N:",
"- break",
"- bt.add(6**i)",
"-for i in range(1, 100):",
"- if 9**i > N:",
"- break",
"- bt.add(9**i)",
"-bt = sorted(bt)",
"+inf ... | false | 0.200092 | 0.212 | 0.943829 | [
"s206408963",
"s096054672"
] |
u426534722 | p02412 | python | s548653187 | s096945549 | 730 | 580 | 5,628 | 5,648 | Accepted | Accepted | 20.55 | from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
cnt = 0
for li in combinations(list(range(1, n + 1)), 3):
if sum(li) == x:
cnt += 1
print(cnt)
| from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print((sum(1 for li in combinations(list(range(1, n + 1)), 3) if sum(li) == x)))
| 11 | 6 | 250 | 200 | from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
cnt = 0
for li in combinations(list(range(1, n + 1)), 3):
if sum(li) == x:
cnt += 1
print(cnt)
| from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print((sum(1 for li in combinations(list(range(1, n + 1)), 3) if sum(li) == x)))
| false | 45.454545 | [
"- cnt = 0",
"- for li in combinations(list(range(1, n + 1)), 3):",
"- if sum(li) == x:",
"- cnt += 1",
"- print(cnt)",
"+ print((sum(1 for li in combinations(list(range(1, n + 1)), 3) if sum(li) == x)))"
] | false | 0.036219 | 0.041642 | 0.869764 | [
"s548653187",
"s096945549"
] |
u729133443 | p02803 | python | s511599669 | s861004568 | 413 | 298 | 31,908 | 55,336 | Accepted | Accepted | 27.85 | from scipy.sparse import*
_,*s=open(0)
M=999
*g,=eval('[0]*M,'*M)
i=0
for t in s:
i+=1;j=0
for u in t:k=i*20+j;g[k][k+20]=u>'#'<(s+['#'*M])[i][j];j+=1;g[k][k+1]=u>'#'<t[j]
a=csgraph.johnson(csr_matrix(g),0)
print((int(max(a[a<M])))) | from scipy.sparse import*
_,*s=open(i:=0)
M=999
*g,=eval('[0]*M,'*M)
for t in s:
i+=1;j=0
for u in t:k=i*20+j;g[k][k+20]=u>'#'<(s+['#'*M])[i][j];j+=1;g[k][k+1]=u>'#'<t[j]
a=csgraph.johnson(csr_matrix(g),0)
print((int(max(a[a<M])))) | 10 | 9 | 241 | 239 | from scipy.sparse import *
_, *s = open(0)
M = 999
(*g,) = eval("[0]*M," * M)
i = 0
for t in s:
i += 1
j = 0
for u in t:
k = i * 20 + j
g[k][k + 20] = u > "#" < (s + ["#" * M])[i][j]
j += 1
g[k][k + 1] = u > "#" < t[j]
a = csgraph.johnson(csr_matrix(g), 0)
print((int(max(a[a... | from scipy.sparse import *
_, *s = open(i := 0)
M = 999
(*g,) = eval("[0]*M," * M)
for t in s:
i += 1
j = 0
for u in t:
k = i * 20 + j
g[k][k + 20] = u > "#" < (s + ["#" * M])[i][j]
j += 1
g[k][k + 1] = u > "#" < t[j]
a = csgraph.johnson(csr_matrix(g), 0)
print((int(max(a[a ... | false | 10 | [
"-_, *s = open(0)",
"+_, *s = open(i := 0)",
"-i = 0"
] | false | 1.60242 | 0.915975 | 1.749415 | [
"s511599669",
"s861004568"
] |
u260980560 | p00179 | python | s686786682 | s444022052 | 2,740 | 2,330 | 6,752 | 6,752 | Accepted | Accepted | 14.96 | import queue
que = queue.PriorityQueue()
dic = {
ord('r')+ord('g'): 'b',
ord('g')+ord('b'): 'r',
ord('b')+ord('r'): 'g',
}
while True:
s = input()
if s=='0':
break
while not que.empty():
que.get()
cost = {}
cost[s] = 0
que.put((0, s)... | import queue
dic = {
'rg':'b', 'gr':'b',
'gb':'r', 'bg':'r',
'br':'g', 'rb':'g',
}
while True:
s = input()
if s=='0':
break
que = queue.PriorityQueue()
l = len(s)
cost = {}
cost[s] = 0
que.put((0, s))
ans = -1
while not que.empt... | 33 | 32 | 887 | 824 | import queue
que = queue.PriorityQueue()
dic = {
ord("r") + ord("g"): "b",
ord("g") + ord("b"): "r",
ord("b") + ord("r"): "g",
}
while True:
s = input()
if s == "0":
break
while not que.empty():
que.get()
cost = {}
cost[s] = 0
que.put((0, s))
ans = -1
while n... | import queue
dic = {
"rg": "b",
"gr": "b",
"gb": "r",
"bg": "r",
"br": "g",
"rb": "g",
}
while True:
s = input()
if s == "0":
break
que = queue.PriorityQueue()
l = len(s)
cost = {}
cost[s] = 0
que.put((0, s))
ans = -1
while not que.empty():
nn... | false | 3.030303 | [
"-que = queue.PriorityQueue()",
"- ord(\"r\") + ord(\"g\"): \"b\",",
"- ord(\"g\") + ord(\"b\"): \"r\",",
"- ord(\"b\") + ord(\"r\"): \"g\",",
"+ \"rg\": \"b\",",
"+ \"gr\": \"b\",",
"+ \"gb\": \"r\",",
"+ \"bg\": \"r\",",
"+ \"br\": \"g\",",
"+ \"rb\": \"g\",",
"- ... | false | 0.275571 | 0.2936 | 0.938593 | [
"s686786682",
"s444022052"
] |
u968166680 | p03732 | python | s024716278 | s579855640 | 497 | 194 | 9,228 | 9,160 | Accepted | Accepted | 60.97 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, W, *WV = list(map(int, read().split()))
weight = WV[::2]
value = WV[1::2]
w_min... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, W, *WV = list(map(int, read().split()))
weight = WV[::2]
value = WV[1::2]
w_min... | 53 | 47 | 1,196 | 1,000 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, W, *WV = list(map(int, read().split()))
weight = WV[::2]
value = WV[1::2]
w_min = min(weight)
... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, W, *WV = list(map(int, read().split()))
weight = WV[::2]
value = WV[1::2]
w_min = min(weight)
... | false | 11.320755 | [
"- def rec(i, vec):",
"+ def rec(i, w, v):",
"- ans = 0",
"- w_total = 0",
"- for j in range(4):",
"- w_total += (w_min + j) * vec[j]",
"- if w_total > W:",
"+ if w <= W:",
"+ return v",
"+ else:"... | false | 0.040624 | 0.040356 | 1.006657 | [
"s024716278",
"s579855640"
] |
u806976856 | p02678 | python | s732716057 | s854884712 | 835 | 571 | 45,620 | 123,388 | Accepted | Accepted | 31.62 | from collections import deque
n,m=list(map(int,input().split()))
r=[[] for i in range(n+1)]
R=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep=[-1]*(n+1)
dep[0]=0
dep[1]=0
data=deque([1])
d=0
... | from collections import deque
n,m=list(map(int,input().split()))
r=[[] for i in range(n+1)]
R=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep=[-1]*(n+1)
dep[0]=0
dep[1]=0
data=deque([1])
d=0
... | 31 | 31 | 685 | 678 | from collections import deque
n, m = list(map(int, input().split()))
r = [[] for i in range(n + 1)]
R = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep = [-1] * (n + 1)
dep[0] = 0
dep[1] = 0
data = ... | from collections import deque
n, m = list(map(int, input().split()))
r = [[] for i in range(n + 1)]
R = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep = [-1] * (n + 1)
dep[0] = 0
dep[1] = 0
data = ... | false | 0 | [
"- r[p] = []"
] | false | 0.036559 | 0.035602 | 1.026892 | [
"s732716057",
"s854884712"
] |
u672475305 | p02695 | python | s044054776 | s176682642 | 1,077 | 483 | 9,200 | 9,072 | Accepted | Accepted | 55.15 | from itertools import *
n,m,q = list(map(int,input().split()))
lst = [list(map(int,input().split())) for _ in range(q)]
A = [i for i in range(1, m+1)]
ans = 0
for l in combinations_with_replacement(A, n):
l = list(l)
tmp = 0
for a,b,c,d in lst:
if l[b-1] - l[a-1] == c:
tmp += d
ans = ... | def dfs(nums, length, min_lim):
ans = 0
if length == n:
score_ret = 0
for a,b,c,d in req:
if nums[b] - nums[a] == c:
score_ret += d
return score_ret
else:
for nu in range(min_lim, m+1):
new_nums = nums + [nu]
... | 13 | 20 | 339 | 537 | from itertools import *
n, m, q = list(map(int, input().split()))
lst = [list(map(int, input().split())) for _ in range(q)]
A = [i for i in range(1, m + 1)]
ans = 0
for l in combinations_with_replacement(A, n):
l = list(l)
tmp = 0
for a, b, c, d in lst:
if l[b - 1] - l[a - 1] == c:
tmp ... | def dfs(nums, length, min_lim):
ans = 0
if length == n:
score_ret = 0
for a, b, c, d in req:
if nums[b] - nums[a] == c:
score_ret += d
return score_ret
else:
for nu in range(min_lim, m + 1):
new_nums = nums + [nu]
score = df... | false | 35 | [
"-from itertools import *",
"+def dfs(nums, length, min_lim):",
"+ ans = 0",
"+ if length == n:",
"+ score_ret = 0",
"+ for a, b, c, d in req:",
"+ if nums[b] - nums[a] == c:",
"+ score_ret += d",
"+ return score_ret",
"+ else:",
"+ ... | false | 0.061995 | 0.068366 | 0.906817 | [
"s044054776",
"s176682642"
] |
u360116509 | p03722 | python | s211999526 | s432457141 | 1,669 | 1,372 | 3,404 | 3,304 | Accepted | Accepted | 17.8 | def main():
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
d = [float('INF')] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
c = -c
g[a].append((b, c))
for i in range(2 * N):
for x, r in enumerate(g... | def main():
N, M = list(map(int, input().split()))
g = []
d = [float('INF')] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
g.append((a, b, -c))
for i in range(2 * N):
for x, y, z in g:
if d[x] != float('INF') and d[y... | 22 | 20 | 583 | 488 | def main():
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
d = [float("INF")] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
c = -c
g[a].append((b, c))
for i in range(2 * N):
for x, r in enumerate(g):
... | def main():
N, M = list(map(int, input().split()))
g = []
d = [float("INF")] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
g.append((a, b, -c))
for i in range(2 * N):
for x, y, z in g:
if d[x] != float("INF") and d[y] > d[x] +... | false | 9.090909 | [
"- g = [[] for _ in range(N + 1)]",
"+ g = []",
"- c = -c",
"- g[a].append((b, c))",
"+ g.append((a, b, -c))",
"- for x, r in enumerate(g):",
"- for y, c in r:",
"- if d[x] != float(\"INF\") and d[y] > d[x] + c:",
"- d[y]... | false | 0.046026 | 0.042243 | 1.089552 | [
"s211999526",
"s432457141"
] |
u210827208 | p02629 | python | s714747270 | s436640950 | 168 | 73 | 61,444 | 61,072 | Accepted | Accepted | 56.55 | n=int(eval(input()))
x=1
X='abcdefghijklmnopqrstuvwxyz'
for i in range(1,100):
if x<=n<x+26**i:
n-=x
cnt=i
break
else:
x+=26**i
ans=''
for i in reversed(list(range(cnt))):
ans+=X[n//(26**i)]
n%=(26**i)
print(ans) | n=int(eval(input()))
x=1
X='abcdefghijklmnopqrstuvwxyz'
for i in range(1,100):
if x<=n<x+26**i:
n-=x
cnt=i
break
else:
x+=26**i
ans=''
for i in range(cnt):
ans=ans+X[n%26]
n//=26
print((ans[::-1])) | 15 | 16 | 262 | 253 | n = int(eval(input()))
x = 1
X = "abcdefghijklmnopqrstuvwxyz"
for i in range(1, 100):
if x <= n < x + 26**i:
n -= x
cnt = i
break
else:
x += 26**i
ans = ""
for i in reversed(list(range(cnt))):
ans += X[n // (26**i)]
n %= 26**i
print(ans)
| n = int(eval(input()))
x = 1
X = "abcdefghijklmnopqrstuvwxyz"
for i in range(1, 100):
if x <= n < x + 26**i:
n -= x
cnt = i
break
else:
x += 26**i
ans = ""
for i in range(cnt):
ans = ans + X[n % 26]
n //= 26
print((ans[::-1]))
| false | 6.25 | [
"-for i in reversed(list(range(cnt))):",
"- ans += X[n // (26**i)]",
"- n %= 26**i",
"-print(ans)",
"+for i in range(cnt):",
"+ ans = ans + X[n % 26]",
"+ n //= 26",
"+print((ans[::-1]))"
] | false | 0.042121 | 0.037675 | 1.118025 | [
"s714747270",
"s436640950"
] |
u842555843 | p02688 | python | s115128926 | s863664522 | 27 | 23 | 9,128 | 9,044 | Accepted | Accepted | 14.81 | N, K = list(map(int, input().split()))
s = set([i for i in range(1, N+1)])
ss = set()
for i in range(K):
int(eval(input()))
ss = ss | set(list(map(int, input().split())))
print((len(s - ss))) | N, K = list(map(int, input().split()))
s = set([i for i in range(1, N+1)])
ss = []
for i in range(K):
int(eval(input()))
ss += list(map(int, input().split()))
print((len(s - set(ss)))) | 7 | 7 | 195 | 185 | N, K = list(map(int, input().split()))
s = set([i for i in range(1, N + 1)])
ss = set()
for i in range(K):
int(eval(input()))
ss = ss | set(list(map(int, input().split())))
print((len(s - ss)))
| N, K = list(map(int, input().split()))
s = set([i for i in range(1, N + 1)])
ss = []
for i in range(K):
int(eval(input()))
ss += list(map(int, input().split()))
print((len(s - set(ss))))
| false | 0 | [
"-ss = set()",
"+ss = []",
"- ss = ss | set(list(map(int, input().split())))",
"-print((len(s - ss)))",
"+ ss += list(map(int, input().split()))",
"+print((len(s - set(ss))))"
] | false | 0.050699 | 0.068878 | 0.736066 | [
"s115128926",
"s863664522"
] |
u514118270 | p02642 | python | s262606560 | s503585475 | 795 | 414 | 176,144 | 33,268 | Accepted | Accepted | 47.92 | M=10**7
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in sorted(l):
a[i]+=1
if a[i]==1:
for j in range(2*i,M,i):a[j]+=9
print((a.count(1))) | M=10**6+1
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in sorted(l):
a[i]+=1
if a[i]==1:
for j in range(2*i,M,i):a[j]+=9
print((a.count(1))) | 8 | 8 | 157 | 159 | M = 10**7
_, *l = list(map(int, open(0).read().split()))
a = [0] * M
for i in sorted(l):
a[i] += 1
if a[i] == 1:
for j in range(2 * i, M, i):
a[j] += 9
print((a.count(1)))
| M = 10**6 + 1
_, *l = list(map(int, open(0).read().split()))
a = [0] * M
for i in sorted(l):
a[i] += 1
if a[i] == 1:
for j in range(2 * i, M, i):
a[j] += 9
print((a.count(1)))
| false | 0 | [
"-M = 10**7",
"+M = 10**6 + 1"
] | false | 1.825467 | 0.174985 | 10.432125 | [
"s262606560",
"s503585475"
] |
u270681687 | p03111 | python | s077290904 | s105261201 | 217 | 81 | 44,252 | 3,064 | Accepted | Accepted | 62.67 | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = []
def f(i, anum, alen, bnum, blen, cnum, clen):
if i == n:
if alen * blen * clen == 0:
return
mp = abs(anum-a)+10*(alen-1) + abs(bnum-b)+10*... | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
mp = float('inf')
def f(i, anum, alen, bnum, blen, cnum, clen):
global mp
if i == n:
if alen * blen * clen == 0:
return
mp = min(mp, abs(anum-... | 26 | 23 | 706 | 656 | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = []
def f(i, anum, alen, bnum, blen, cnum, clen):
if i == n:
if alen * blen * clen == 0:
return
mp = (
abs(anum - a)
+ 10 * (ale... | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
mp = float("inf")
def f(i, anum, alen, bnum, blen, cnum, clen):
global mp
if i == n:
if alen * blen * clen == 0:
return
mp = min(
mp,
... | false | 11.538462 | [
"-ans = []",
"+mp = float(\"inf\")",
"+ global mp",
"- mp = (",
"+ mp = min(",
"+ mp,",
"- + 10 * (clen - 1)",
"+ + 10 * (clen - 1),",
"- ans.append(mp)",
"-res = float(\"inf\")",
"-for i in ans:",
"- res = min(res, i)",
"-print(res... | false | 0.343735 | 0.07535 | 4.561844 | [
"s077290904",
"s105261201"
] |
u630566146 | p02268 | python | s120460803 | s991692993 | 230 | 210 | 16,708 | 16,712 | Accepted | Accepted | 8.7 | def binary_search(l, t):
left = 0
right = len(l) - 1
while left <= right:
mid = (left + right)//2
if l[mid] < t:
left = mid + 1
elif t < l[mid]:
right = mid - 1
else:
return True
def main():
n = int(eval(input()))
s... | def binary_search(l, t):
left = 0
right = len(l)
while left < right:
mid = (left + right)//2
if l[mid] < t:
left = mid + 1
elif t < l[mid]:
right = mid
else:
return True
def main():
n = int(eval(input()))
s = list(m... | 30 | 30 | 580 | 571 | def binary_search(l, t):
left = 0
right = len(l) - 1
while left <= right:
mid = (left + right) // 2
if l[mid] < t:
left = mid + 1
elif t < l[mid]:
right = mid - 1
else:
return True
def main():
n = int(eval(input()))
s = list(map(i... | def binary_search(l, t):
left = 0
right = len(l)
while left < right:
mid = (left + right) // 2
if l[mid] < t:
left = mid + 1
elif t < l[mid]:
right = mid
else:
return True
def main():
n = int(eval(input()))
s = list(map(int, input... | false | 0 | [
"- right = len(l) - 1",
"- while left <= right:",
"+ right = len(l)",
"+ while left < right:",
"- right = mid - 1",
"+ right = mid"
] | false | 0.035279 | 0.038316 | 0.920757 | [
"s120460803",
"s991692993"
] |
u788703383 | p03860 | python | s082251530 | s755628892 | 171 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.06 | a = input().split()
x = a[1]
print(('A' + x[0] + 'C')) | print(('A'+input()[8]+'C')) | 3 | 1 | 54 | 25 | a = input().split()
x = a[1]
print(("A" + x[0] + "C"))
| print(("A" + input()[8] + "C"))
| false | 66.666667 | [
"-a = input().split()",
"-x = a[1]",
"-print((\"A\" + x[0] + \"C\"))",
"+print((\"A\" + input()[8] + \"C\"))"
] | false | 0.038296 | 0.047214 | 0.811113 | [
"s082251530",
"s755628892"
] |
u562935282 | p03062 | python | s954005127 | s378078310 | 998 | 97 | 22,600 | 14,412 | Accepted | Accepted | 90.28 | import numpy as np
inf = float('inf')
N = int(eval(input()))
a = list(map(int, input().split()))
dp = np.empty((N + 1, 2))
dp[0][0] = 0
dp[0][1] = -inf
# dp[i][0]:=1-indexedで、a_iとa_i+1を反転させない場合の最大値
# dp[i][1]:=1-indexedで、a_iとa_i+1を反転させる場合の最大値
for i, aa in enumerate(a, 0):
dp[i + 1][0] = max(dp[i][... | n = int(eval(input()))
a = tuple(map(int, input().split()))
minus_count = len(tuple([x for x in a if x < 0]))
b = tuple(sorted(map(abs, a)))
s = sum(b)
if minus_count % 2 == 1:
s -= b[0] * 2
print(s)
| 20 | 9 | 478 | 210 | import numpy as np
inf = float("inf")
N = int(eval(input()))
a = list(map(int, input().split()))
dp = np.empty((N + 1, 2))
dp[0][0] = 0
dp[0][1] = -inf
# dp[i][0]:=1-indexedで、a_iとa_i+1を反転させない場合の最大値
# dp[i][1]:=1-indexedで、a_iとa_i+1を反転させる場合の最大値
for i, aa in enumerate(a, 0):
dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1]... | n = int(eval(input()))
a = tuple(map(int, input().split()))
minus_count = len(tuple([x for x in a if x < 0]))
b = tuple(sorted(map(abs, a)))
s = sum(b)
if minus_count % 2 == 1:
s -= b[0] * 2
print(s)
| false | 55 | [
"-import numpy as np",
"-",
"-inf = float(\"inf\")",
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-dp = np.empty((N + 1, 2))",
"-dp[0][0] = 0",
"-dp[0][1] = -inf",
"-# dp[i][0]:=1-indexedで、a_iとa_i+1を反転させない場合の最大値",
"-# dp[i][1]:=1-indexedで、a_iとa_i+1を反転させる場合の最大値",
"-for i, a... | false | 0.54501 | 0.038855 | 14.026767 | [
"s954005127",
"s378078310"
] |
u427984570 | p02756 | python | s025784400 | s332353082 | 749 | 669 | 8,820 | 8,692 | Accepted | Accepted | 10.68 | from collections import deque
s = deque(eval(input()))
#s = input()
n = int(eval(input()))
f = 1
for i in range(n):
l = list(map(str, input().split()))
if l[0] == "2":
tmp = int(l[1])*f
if tmp == 1 or tmp == -2:
s.appendleft(l[2])
else:
s.append(l[2])
else:
f *= -1
if ... | from collections import deque
s = deque(eval(input()))
n = int(eval(input()))
f = 0
for i in range(n):
l = list(map(str, input().split()))
if l[0] == "2":
if (l[1] == "1" and f == 0) or (l[1] == "2" and f == 1):
s.appendleft(l[2])
else:
s.append(l[2])
else:
if f == 0:
f ... | 19 | 19 | 351 | 382 | from collections import deque
s = deque(eval(input()))
# s = input()
n = int(eval(input()))
f = 1
for i in range(n):
l = list(map(str, input().split()))
if l[0] == "2":
tmp = int(l[1]) * f
if tmp == 1 or tmp == -2:
s.appendleft(l[2])
else:
s.append(l[2])
else... | from collections import deque
s = deque(eval(input()))
n = int(eval(input()))
f = 0
for i in range(n):
l = list(map(str, input().split()))
if l[0] == "2":
if (l[1] == "1" and f == 0) or (l[1] == "2" and f == 1):
s.appendleft(l[2])
else:
s.append(l[2])
else:
i... | false | 0 | [
"-# s = input()",
"-f = 1",
"+f = 0",
"- tmp = int(l[1]) * f",
"- if tmp == 1 or tmp == -2:",
"+ if (l[1] == \"1\" and f == 0) or (l[1] == \"2\" and f == 1):",
"- f *= -1",
"-if f == -1:",
"+ if f == 0:",
"+ f = 1",
"+ else:",
"+ ... | false | 0.044576 | 0.046544 | 0.957722 | [
"s025784400",
"s332353082"
] |
u581603131 | p02706 | python | s421864832 | s979116727 | 25 | 23 | 10,040 | 10,196 | Accepted | Accepted | 8 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(M):
N -= A[i]
if N>=0:
print(N)
elif N < 0:
print((-1)) | #先にAの合計値を出してもよい
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
suma = sum(A)
if N-suma>=0:
print((N-suma))
else:
print((-1)) | 8 | 8 | 156 | 157 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(M):
N -= A[i]
if N >= 0:
print(N)
elif N < 0:
print((-1))
| # 先にAの合計値を出してもよい
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
suma = sum(A)
if N - suma >= 0:
print((N - suma))
else:
print((-1))
| false | 0 | [
"+# 先にAの合計値を出してもよい",
"-for i in range(M):",
"- N -= A[i]",
"-if N >= 0:",
"- print(N)",
"-elif N < 0:",
"+suma = sum(A)",
"+if N - suma >= 0:",
"+ print((N - suma))",
"+else:"
] | false | 0.044089 | 0.071783 | 0.6142 | [
"s421864832",
"s979116727"
] |
u090361088 | p03854 | python | s301744876 | s448586516 | 37 | 19 | 3,188 | 3,188 | Accepted | Accepted | 48.65 | S = str(eval(input()))
T = ''
cnt = 0
while True:
if S[cnt:cnt+5] == 'dream':
try:
if S[cnt:cnt+7] == 'dreamer' and (S[cnt+7] != 'a'):
cnt += 7
T = T + 'dreamer'
else:
T = T + 'dream'
cnt += 5
except ... | s = eval(input())
l = ['eraser', 'dreamer', 'erase', 'dream', 'ase']
for i in l:
s = s.replace(i, '')
if len(s) == 0:
print('YES')
else:
print('NO') | 37 | 8 | 831 | 161 | S = str(eval(input()))
T = ""
cnt = 0
while True:
if S[cnt : cnt + 5] == "dream":
try:
if S[cnt : cnt + 7] == "dreamer" and (S[cnt + 7] != "a"):
cnt += 7
T = T + "dreamer"
else:
T = T + "dream"
cnt += 5
except In... | s = eval(input())
l = ["eraser", "dreamer", "erase", "dream", "ase"]
for i in l:
s = s.replace(i, "")
if len(s) == 0:
print("YES")
else:
print("NO")
| false | 78.378378 | [
"-S = str(eval(input()))",
"-T = \"\"",
"-cnt = 0",
"-while True:",
"- if S[cnt : cnt + 5] == \"dream\":",
"- try:",
"- if S[cnt : cnt + 7] == \"dreamer\" and (S[cnt + 7] != \"a\"):",
"- cnt += 7",
"- T = T + \"dreamer\"",
"- else:",
... | false | 0.047054 | 0.046793 | 1.005584 | [
"s301744876",
"s448586516"
] |
u656771711 | p02960 | python | s708301866 | s459817617 | 1,467 | 1,262 | 43,772 | 44,224 | Accepted | Accepted | 13.97 | S=eval(input())
d=[0]*13
d[0]=1
for i in range(len(S)):
n=[0]*13
for j in range(13):
for k in range(10):
n[(10*j+k)%13]+=(1 if S[i]=='?' or int(S[i])==k else 0)*d[j]
for j in range(13): d[j]=n[j]%(10**9+7)
print((d[5])) | S=eval(input())
d=[0]*13
d[0]=1
for i in range(len(S)):
n=[0]*13
for j in range(13):
for k in range(10):
if S[i]=='?' or int(S[i])==k: n[(10*j+k)%13]+=d[j]
for j in range(13): d[j]=n[j]%(10**9+7)
print((d[5])) | 10 | 10 | 236 | 226 | S = eval(input())
d = [0] * 13
d[0] = 1
for i in range(len(S)):
n = [0] * 13
for j in range(13):
for k in range(10):
n[(10 * j + k) % 13] += (1 if S[i] == "?" or int(S[i]) == k else 0) * d[j]
for j in range(13):
d[j] = n[j] % (10**9 + 7)
print((d[5]))
| S = eval(input())
d = [0] * 13
d[0] = 1
for i in range(len(S)):
n = [0] * 13
for j in range(13):
for k in range(10):
if S[i] == "?" or int(S[i]) == k:
n[(10 * j + k) % 13] += d[j]
for j in range(13):
d[j] = n[j] % (10**9 + 7)
print((d[5]))
| false | 0 | [
"- n[(10 * j + k) % 13] += (1 if S[i] == \"?\" or int(S[i]) == k else 0) * d[j]",
"+ if S[i] == \"?\" or int(S[i]) == k:",
"+ n[(10 * j + k) % 13] += d[j]"
] | false | 0.100548 | 0.038405 | 2.618073 | [
"s708301866",
"s459817617"
] |
u389910364 | p02815 | python | s674877289 | s485455650 | 381 | 287 | 31,020 | 30,996 | Accepted | Accepted | 24.67 | import os
import sys
import numpy as np
# from libs.debug import debug
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N = int(sys.stdin.buffer.readline())
C = list(map(int, sys.stdi... | import os
import sys
import numpy as np
# from libs.debug import debug
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N = int(sys.stdin.buffer.readline())
C = list(map(int, sys.stdi... | 70 | 71 | 1,990 | 2,056 | import os
import sys
import numpy as np
# from libs.debug import debug
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N = int(sys.stdin.buffer.readline())
C = list(map(int, sys.stdin.buffer.readline().split()))... | import os
import sys
import numpy as np
# from libs.debug import debug
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N = int(sys.stdin.buffer.readline())
C = list(map(int, sys.stdin.buffer.readline().split()))... | false | 1.408451 | [
"-C.sort()",
"-#",
"+# R[d][i]: C が降順にソートされてるとして、C[i] が上から d 番目の大きさになる選び方の数",
"+# # 自分より大きいのの選び方の総数",
"+# # 順位かける",
"+# # 自分より小さいのの選び方をかける",
"+# # 順位が小さいのに大きいのをかける",
"+# # 同じ選び方が 2**N 個ある",
"-#",
"- arr = np.full(N + 1, pow(2, N - 2, MOD), dtype=int)",
"- arr = arr.cumsum()[1:]",
"- a... | false | 0.22167 | 0.220786 | 1.004008 | [
"s674877289",
"s485455650"
] |
u797673668 | p02271 | python | s853691083 | s572964006 | 5,640 | 1,970 | 228,988 | 220,828 | Accepted | Accepted | 65.07 | from itertools import combinations
n, a, q, ms = int(eval(input())), list(map(int, input().split())), eval(input()), list(map(int, input().split()))
cache = {}
def sum_a(tmp, t):
global a, cache
if t in cache:
return tmp + cache[t]
elif len(t) == 1:
return tmp + a[t[0]]
... | from itertools import combinations
n, a, q, ms, cache = int(eval(input())), list(map(int, input().split())), eval(input()), list(map(int, input().split())), {}
def sum_a(tmp, t):
global a, cache
if t in cache:
return tmp + cache[t]
elif len(t) == 1:
return tmp + a[t[0]]
els... | 22 | 20 | 525 | 521 | from itertools import combinations
n, a, q, ms = (
int(eval(input())),
list(map(int, input().split())),
eval(input()),
list(map(int, input().split())),
)
cache = {}
def sum_a(tmp, t):
global a, cache
if t in cache:
return tmp + cache[t]
elif len(t) == 1:
return tmp + a[t[0... | from itertools import combinations
n, a, q, ms, cache = (
int(eval(input())),
list(map(int, input().split())),
eval(input()),
list(map(int, input().split())),
{},
)
def sum_a(tmp, t):
global a, cache
if t in cache:
return tmp + cache[t]
elif len(t) == 1:
return tmp + a... | false | 9.090909 | [
"-n, a, q, ms = (",
"+n, a, q, ms, cache = (",
"+ {},",
"-cache = {}",
"-l = list(sum_a(0, t) for i in range(n) for t in combinations(list(range(n)), i + 1))",
"+l = set(sum_a(0, t) for i in range(n) for t in combinations(list(range(n)), i + 1))"
] | false | 0.047118 | 0.253562 | 0.185823 | [
"s853691083",
"s572964006"
] |
u971091945 | p02576 | python | s451586005 | s700357798 | 30 | 24 | 9,088 | 9,024 | Accepted | Accepted | 20 | n, x, t = list(map(int, input().split()))
print((-(-n//x)*t)) | import math
n, x, t = list(map(int, input().split()))
print((math.ceil(n/x)*t)) | 2 | 3 | 54 | 73 | n, x, t = list(map(int, input().split()))
print((-(-n // x) * t))
| import math
n, x, t = list(map(int, input().split()))
print((math.ceil(n / x) * t))
| false | 33.333333 | [
"+import math",
"+",
"-print((-(-n // x) * t))",
"+print((math.ceil(n / x) * t))"
] | false | 0.084756 | 0.120854 | 0.701313 | [
"s451586005",
"s700357798"
] |
u214617707 | p03343 | python | s692618122 | s371295280 | 1,728 | 1,460 | 3,188 | 3,316 | Accepted | Accepted | 15.51 | N, K, Q = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("inf")
for i in range(N):
tmp = []
rec = []
for j in range(N):
if a[i] <= a[j]:
tmp.append(a[j])
else:
if len(tmp) >= K:
tmp = sorted(tmp)
... | N, K, Q = list(map(int, input().split()))
A = list(map(int, input().split()))
D = set()
for i in range(N):
D.add(A[i])
D = list(D)
ans = float('inf')
for Y in D:
T = []
tmp = []
for j in range(N):
if A[j] >= Y:
tmp.append(A[j])
else:
if len(tmp) >=... | 22 | 30 | 568 | 626 | N, K, Q = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("inf")
for i in range(N):
tmp = []
rec = []
for j in range(N):
if a[i] <= a[j]:
tmp.append(a[j])
else:
if len(tmp) >= K:
tmp = sorted(tmp)
rec += ... | N, K, Q = list(map(int, input().split()))
A = list(map(int, input().split()))
D = set()
for i in range(N):
D.add(A[i])
D = list(D)
ans = float("inf")
for Y in D:
T = []
tmp = []
for j in range(N):
if A[j] >= Y:
tmp.append(A[j])
else:
if len(tmp) >= K:
... | false | 26.666667 | [
"-a = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"+D = set()",
"+for i in range(N):",
"+ D.add(A[i])",
"+D = list(D)",
"-for i in range(N):",
"+for Y in D:",
"+ T = []",
"- rec = []",
"- if a[i] <= a[j]:",
"- tmp.append(a[j])",
"+ ... | false | 0.04069 | 0.041604 | 0.978031 | [
"s692618122",
"s371295280"
] |
u633068244 | p00515 | python | s113018882 | s769641316 | 20 | 10 | 4,188 | 4,188 | Accepted | Accepted | 50 | print(sum([max(40,eval(input())) for i in [1]*5])/5) | print(sum([max(8,eval(input())/5) for i in [1]*5])) | 1 | 1 | 45 | 44 | print(sum([max(40, eval(input())) for i in [1] * 5]) / 5)
| print(sum([max(8, eval(input()) / 5) for i in [1] * 5]))
| false | 0 | [
"-print(sum([max(40, eval(input())) for i in [1] * 5]) / 5)",
"+print(sum([max(8, eval(input()) / 5) for i in [1] * 5]))"
] | false | 0.047014 | 0.048556 | 0.968237 | [
"s113018882",
"s769641316"
] |
u191874006 | p03712 | python | s465541739 | s530304892 | 168 | 78 | 38,384 | 66,020 | Accepted | Accepted | 53.57 | #!/usr/bin/env python3
#ABC62 B
h,w = list(map(int,input().split()))
x = ['#']*(w+2)
a = [list(eval(input())) for _ in range(h)]
for i in range(h):
a[i].insert(0,'#')
a[i].append('#')
a.insert(0,x)
a.append(x)
for i in range(h+2):
print((''.join(a[i])))
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 14 | 24 | 267 | 678 | #!/usr/bin/env python3
# ABC62 B
h, w = list(map(int, input().split()))
x = ["#"] * (w + 2)
a = [list(eval(input())) for _ in range(h)]
for i in range(h):
a[i].insert(0, "#")
a[i].append("#")
a.insert(0, x)
a.append(x)
for i in range(h + 2):
print(("".join(a[i])))
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 41.666667 | [
"-# ABC62 B",
"-h, w = list(map(int, input().split()))",
"-x = [\"#\"] * (w + 2)",
"-a = [list(eval(input())) for _ in range(h)]",
"-for i in range(h):",
"- a[i].insert(0, \"#\")",
"- a[i].append(\"#\")",
"-a.insert(0, x)",
"-a.append(x)",
"-for i in range(h + 2):",
"- print((\"\".join(... | false | 0.044988 | 0.044485 | 1.011306 | [
"s465541739",
"s530304892"
] |
u707498674 | p02703 | python | s437623083 | s578317329 | 1,156 | 1,028 | 39,268 | 36,544 | Accepted | Accepted | 11.07 | from heapq import heappop, heappush
import sys
def input():return sys.stdin.readline().strip()
def main():
N, M, S = list(map(int, input().split()))
to = [{} for _ in range(N)]
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
to[u][... | from heapq import heappop, heappush
import sys
def input():return sys.stdin.readline().strip()
def main():
N, M, S = list(map(int, input().split()))
to = [{} for _ in range(N)]
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
to[u][... | 51 | 52 | 1,384 | 1,427 | from heapq import heappop, heappush
import sys
def input():
return sys.stdin.readline().strip()
def main():
N, M, S = list(map(int, input().split()))
to = [{} for _ in range(N)]
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
to[u][v] = (... | from heapq import heappop, heappush
import sys
def input():
return sys.stdin.readline().strip()
def main():
N, M, S = list(map(int, input().split()))
to = [{} for _ in range(N)]
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
to[u][v] = (... | false | 1.923077 | [
"+ if cost[now][ns] <= nt:",
"+ continue"
] | false | 0.124245 | 0.114805 | 1.082227 | [
"s437623083",
"s578317329"
] |
u130900604 | p03476 | python | s353729530 | s023426004 | 876 | 437 | 7,124 | 82,920 | Accepted | Accepted | 50.11 | # coding: utf-8
# Your code here!
U=10**5
is_prime=[True]*(U+1)
is_prime[0]=False
is_prime[1]=False
for p in range(2,U+1):
if p*p>U:
break
if is_prime[p]:
for j in range(p*p,U+1,p):
is_prime[j]=False
is_2017like=[0]*(U+1)
for p in range(1,U+1):
if (p+1)//2>U:
... | def like2017(x):
if isprime[x]:
if isprime[(x+1)//2]:
return True
return False
n=108000
isprime=[True]*(n+1)
isprime[0]=isprime[1]=False
for i in range(2,n+1):
if isprime[i]:
for j in range(i*i,n+1,i):
isprime[j]=False
cum=[]
cum.append(like2017(0))
for i in range(1,n+1):
tm... | 24 | 27 | 546 | 519 | # coding: utf-8
# Your code here!
U = 10**5
is_prime = [True] * (U + 1)
is_prime[0] = False
is_prime[1] = False
for p in range(2, U + 1):
if p * p > U:
break
if is_prime[p]:
for j in range(p * p, U + 1, p):
is_prime[j] = False
is_2017like = [0] * (U + 1)
for p in range(1, U + 1):
... | def like2017(x):
if isprime[x]:
if isprime[(x + 1) // 2]:
return True
return False
n = 108000
isprime = [True] * (n + 1)
isprime[0] = isprime[1] = False
for i in range(2, n + 1):
if isprime[i]:
for j in range(i * i, n + 1, i):
isprime[j] = False
cum = []
cum.append(... | false | 11.111111 | [
"-# coding: utf-8",
"-# Your code here!",
"-U = 10**5",
"-is_prime = [True] * (U + 1)",
"-is_prime[0] = False",
"-is_prime[1] = False",
"-for p in range(2, U + 1):",
"- if p * p > U:",
"- break",
"- if is_prime[p]:",
"- for j in range(p * p, U + 1, p):",
"- is_pr... | false | 0.1967 | 0.116563 | 1.687505 | [
"s353729530",
"s023426004"
] |
u592547545 | p02842 | python | s050447132 | s431195805 | 31 | 27 | 9,188 | 9,184 | Accepted | Accepted | 12.9 | def readinput():
n=int(eval(input()))
return n
def main(n):
x7=int(n/1.07)
x8=int(n/1.08)
x9=int(n/1.09)
n100=n*100
for x in range(max(1,x9-1),x7+1+1):
xx=x*108//100
#print(x,xx)
if xx==n:
print(x)
break
else:
print... | def readinput():
n=int(eval(input()))
return n
def main(n):
x7=int(n/1.07)+1
x9=int(n/1.09)-1
n100=n*100
for x in range(max(1,x9),x7+1):
xx=x*108//100
#print(x,xx)
if xx==n:
print(x)
break
else:
print(':(')
... | 23 | 22 | 393 | 373 | def readinput():
n = int(eval(input()))
return n
def main(n):
x7 = int(n / 1.07)
x8 = int(n / 1.08)
x9 = int(n / 1.09)
n100 = n * 100
for x in range(max(1, x9 - 1), x7 + 1 + 1):
xx = x * 108 // 100
# print(x,xx)
if xx == n:
print(x)
break
... | def readinput():
n = int(eval(input()))
return n
def main(n):
x7 = int(n / 1.07) + 1
x9 = int(n / 1.09) - 1
n100 = n * 100
for x in range(max(1, x9), x7 + 1):
xx = x * 108 // 100
# print(x,xx)
if xx == n:
print(x)
break
else:
print(":... | false | 4.347826 | [
"- x7 = int(n / 1.07)",
"- x8 = int(n / 1.08)",
"- x9 = int(n / 1.09)",
"+ x7 = int(n / 1.07) + 1",
"+ x9 = int(n / 1.09) - 1",
"- for x in range(max(1, x9 - 1), x7 + 1 + 1):",
"+ for x in range(max(1, x9), x7 + 1):"
] | false | 0.04492 | 0.046178 | 0.972753 | [
"s050447132",
"s431195805"
] |
u350049649 | p03078 | python | s578854341 | s695576165 | 688 | 40 | 8,708 | 5,224 | Accepted | Accepted | 94.19 | X, Y, Z, K= list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort(reverse=True)
B=list(map(int,input().split()))
B.sort(reverse=True)
C=list(map(int,input().split()))
C.sort(reverse=True)
ABC=[]
for i in range(X):
for j in range(Y):
for k in range(Z):
if (i+1)*(j+1)... | import heapq
hq=[]
X, Y, Z, K= list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort(reverse=True)
B=list(map(int,input().split()))
B.sort(reverse=True)
C=list(map(int,input().split()))
C.sort(reverse=True)
searched={(0,0,0)}
heapq.heappush(hq,(-(A[0]+B[0]+C[0]),0,0,0))
D=[[1,0,0],[0,1,0],[0... | 21 | 20 | 481 | 619 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
ABC = []
for i in range(X):
for j in range(Y):
for k in range(Z):
if (i + 1) * (... | import heapq
hq = []
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
searched = {(0, 0, 0)}
heapq.heappush(hq, (-(A[0] + B[0] + C[0]), 0, 0, 0))
D = [[... | false | 4.761905 | [
"+import heapq",
"+",
"+hq = []",
"-ABC = []",
"-for i in range(X):",
"- for j in range(Y):",
"- for k in range(Z):",
"- if (i + 1) * (j + 1) * (k + 1) <= K:",
"- ABC.append(A[i] + B[j] + C[k])",
"- else:",
"- break",
"-ABC.sort(rev... | false | 0.077235 | 0.036482 | 2.117062 | [
"s578854341",
"s695576165"
] |
u796060588 | p03274 | python | s384806048 | s882767831 | 106 | 88 | 11,880 | 11,880 | Accepted | Accepted | 16.98 | # vim: set fileencoding=utf-8:
import bisect
def main():
N, K = list(map(int, input().split()))
x = [int(ele) for ele in input().split()]
o = bisect.bisect_right(x, 0)
top = min(o + K, N)
bottom = max(o - K, 0)
best = 999999999999
for i in range(K):
if top < bottom + i ... | # vim: set fileencoding=utf-8:
import bisect
def main():
N, K = list(map(int, input().split()))
x = [int(ele) for ele in input().split()]
o = bisect.bisect_right(x, 0)
top = min(o + K, N)
bottom = max(o - K, 0)
best = 999999999999
for i in range(K):
if top < bottom + i ... | 30 | 29 | 861 | 705 | # vim: set fileencoding=utf-8:
import bisect
def main():
N, K = list(map(int, input().split()))
x = [int(ele) for ele in input().split()]
o = bisect.bisect_right(x, 0)
top = min(o + K, N)
bottom = max(o - K, 0)
best = 999999999999
for i in range(K):
if top < bottom + i + K:
... | # vim: set fileencoding=utf-8:
import bisect
def main():
N, K = list(map(int, input().split()))
x = [int(ele) for ele in input().split()]
o = bisect.bisect_right(x, 0)
top = min(o + K, N)
bottom = max(o - K, 0)
best = 999999999999
for i in range(K):
if top < bottom + i + K:
... | false | 3.333333 | [
"- if x[bottom + i + K - 1] < 0:",
"- best = min(best, abs(x[bottom + i]))",
"- elif x[bottom + i] < 0 <= x[bottom + i + K - 1]:",
"- ans1 = 2 * min(abs(x[bottom + i]), x[bottom + i + K - 1])",
"- ans2 = max(abs(x[bottom + i]), x[bottom + i + K - 1])",
"- ... | false | 0.065258 | 0.035753 | 1.825237 | [
"s384806048",
"s882767831"
] |
u670180528 | p03043 | python | s193747837 | s394848751 | 179 | 59 | 39,536 | 2,940 | Accepted | Accepted | 67.04 | n,k = list(map(int, input().split()))
ans = 0
for i in range(n):
score = i+1
count = 0
while score <= k-1:
count += 1
temp = score
score = temp*2
ans += 1/n * ((1/2)**count)
print(ans) | n,k=list(map(int, input().split()))
a=0
for i in range(n):
s=i+1;c=0
while s<=k-1:
c+=1;s*=2
a+=1/n*(1/2**c)
print(a) | 11 | 8 | 209 | 129 | n, k = list(map(int, input().split()))
ans = 0
for i in range(n):
score = i + 1
count = 0
while score <= k - 1:
count += 1
temp = score
score = temp * 2
ans += 1 / n * ((1 / 2) ** count)
print(ans)
| n, k = list(map(int, input().split()))
a = 0
for i in range(n):
s = i + 1
c = 0
while s <= k - 1:
c += 1
s *= 2
a += 1 / n * (1 / 2**c)
print(a)
| false | 27.272727 | [
"-ans = 0",
"+a = 0",
"- score = i + 1",
"- count = 0",
"- while score <= k - 1:",
"- count += 1",
"- temp = score",
"- score = temp * 2",
"- ans += 1 / n * ((1 / 2) ** count)",
"-print(ans)",
"+ s = i + 1",
"+ c = 0",
"+ while s <= k - 1:",
"+ ... | false | 0.05828 | 0.062711 | 0.929343 | [
"s193747837",
"s394848751"
] |
u533039576 | p03241 | python | s161469678 | s276676236 | 468 | 20 | 40,044 | 3,060 | Accepted | Accepted | 95.73 | n, m = list(map(int, input().split()))
p = m // n
while m % p != 0:
p -= 1
print(p)
| import math
n, m = list(map(int, input().split()))
def divisor(m):
ans = []
for i in range(1, int(math.sqrt(m)) + 1):
if m % i == 0:
ans.append(i)
ans.append(m // i)
return sorted(ans)
divs = divisor(m)
j = len(divs) - 1
while True:
if divs[j] * n <= m... | 7 | 20 | 90 | 367 | n, m = list(map(int, input().split()))
p = m // n
while m % p != 0:
p -= 1
print(p)
| import math
n, m = list(map(int, input().split()))
def divisor(m):
ans = []
for i in range(1, int(math.sqrt(m)) + 1):
if m % i == 0:
ans.append(i)
ans.append(m // i)
return sorted(ans)
divs = divisor(m)
j = len(divs) - 1
while True:
if divs[j] * n <= m:
print... | false | 65 | [
"+import math",
"+",
"-p = m // n",
"-while m % p != 0:",
"- p -= 1",
"-print(p)",
"+",
"+",
"+def divisor(m):",
"+ ans = []",
"+ for i in range(1, int(math.sqrt(m)) + 1):",
"+ if m % i == 0:",
"+ ans.append(i)",
"+ ans.append(m // i)",
"+ return ... | false | 0.051211 | 0.037 | 1.384066 | [
"s161469678",
"s276676236"
] |
u581187895 | p03579 | python | s521155409 | s083211406 | 549 | 499 | 55,780 | 34,652 | Accepted | Accepted | 9.11 | import sys
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(M)]
G = [[] for _ in range(N+1)]
for a,b in AB:
G[a].append(b)
G[b].append(a)
color = [None]*(N+1)
# 二部グラフ判定
def dfs(v, c):
color[v] = c
for e in G[v]:
i... | import sys
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(M)]
G = [[] for _ in range(N+1)]
for a,b in AB:
G[a].append(b)
G[b].append(a)
color = [None]*(N+1)
color[1] = 0
q = [1]
# 二部グラフ判定
while q:
x = q.pop()
for y... | 28 | 29 | 600 | 568 | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(M)]
G = [[] for _ in range(N + 1)]
for a, b in AB:
G[a].append(b)
G[b].append(a)
color = [None] * (N + 1)
# 二部グラフ判定
def dfs(v, c):
color[v] = c
for e in G[v]:
if... | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(M)]
G = [[] for _ in range(N + 1)]
for a, b in AB:
G[a].append(b)
G[b].append(a)
color = [None] * (N + 1)
color[1] = 0
q = [1]
# 二部グラフ判定
while q:
x = q.pop()
for y in G[... | false | 3.448276 | [
"+color[1] = 0",
"+q = [1]",
"-def dfs(v, c):",
"- color[v] = c",
"- for e in G[v]:",
"- if color[e] == None:",
"- color[e] = 1 - color[v]",
"- dfs(e, c ^ 1) # c^1 == xor (0+1==True)",
"-",
"-",
"-dfs(1, 0)",
"+while q:",
"+ x = q.pop()",
"+ for y ... | false | 0.038806 | 0.089638 | 0.432916 | [
"s521155409",
"s083211406"
] |
u367130284 | p03387 | python | s621881511 | s292318300 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | a=list(map(int,input().split()))
s=max(a)*3-sum(a);print(([s//2+2,s//2][s%2<1])) | a,b,c=sorted(map(int,input().split()))
print((c-b+(b-a+1)//2+((b-a)&1))) | 2 | 2 | 79 | 71 | a = list(map(int, input().split()))
s = max(a) * 3 - sum(a)
print(([s // 2 + 2, s // 2][s % 2 < 1]))
| a, b, c = sorted(map(int, input().split()))
print((c - b + (b - a + 1) // 2 + ((b - a) & 1)))
| false | 0 | [
"-a = list(map(int, input().split()))",
"-s = max(a) * 3 - sum(a)",
"-print(([s // 2 + 2, s // 2][s % 2 < 1]))",
"+a, b, c = sorted(map(int, input().split()))",
"+print((c - b + (b - a + 1) // 2 + ((b - a) & 1)))"
] | false | 0.048129 | 0.047856 | 1.005703 | [
"s621881511",
"s292318300"
] |
u057109575 | p02780 | python | s681292907 | s516991545 | 118 | 107 | 106,000 | 98,660 | Accepted | Accepted | 9.32 | N, K, *X = list(map(int, open(0).read().split()))
y = [float(x * (x + 1) / 2 / x) for x in X]
ans = sum(y[:K])
res = ans
for i in range(K, N):
res = res - y[i - K] + y[i]
ans = max(ans, res)
print(ans)
|
N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
cur = sum((X[i] + 1) / 2 for i in range(K))
ans = cur
for i in range(K, N):
cur += (X[i] + 1) / 2 - (X[i - K] + 1) / 2
ans = max(ans, cur)
print(ans)
| 9 | 11 | 213 | 240 | N, K, *X = list(map(int, open(0).read().split()))
y = [float(x * (x + 1) / 2 / x) for x in X]
ans = sum(y[:K])
res = ans
for i in range(K, N):
res = res - y[i - K] + y[i]
ans = max(ans, res)
print(ans)
| N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
cur = sum((X[i] + 1) / 2 for i in range(K))
ans = cur
for i in range(K, N):
cur += (X[i] + 1) / 2 - (X[i - K] + 1) / 2
ans = max(ans, cur)
print(ans)
| false | 18.181818 | [
"-N, K, *X = list(map(int, open(0).read().split()))",
"-y = [float(x * (x + 1) / 2 / x) for x in X]",
"-ans = sum(y[:K])",
"-res = ans",
"+N, K = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"+cur = sum((X[i] + 1) / 2 for i in range(K))",
"+ans = cur",
"- res = res - ... | false | 0.036418 | 0.036834 | 0.988706 | [
"s681292907",
"s516991545"
] |
u203222829 | p02409 | python | s904142024 | s484944626 | 30 | 20 | 5,632 | 5,628 | Accepted | Accepted | 33.33 | # coding: utf-8
def showBuilding(buildings):
for i, tou in enumerate(buildings):
for wow in tou:
for room in wow:
print(' ' + str(room), end='')
print()
if i != 3:
print('####################')
if __name__ == '__main__':
b... | # coding: utf-8
def showBuilding(mansion):
for i, building in enumerate(mansion):
for line in building:
for room in line:
print(' ' + str(room), end='')
print()
if i != 3:
print('####################')
def calcMoving(mansion, moving_st... | 28 | 32 | 797 | 860 | # coding: utf-8
def showBuilding(buildings):
for i, tou in enumerate(buildings):
for wow in tou:
for room in wow:
print(" " + str(room), end="")
print()
if i != 3:
print("####################")
if __name__ == "__main__":
buildings = [[[0 for ... | # coding: utf-8
def showBuilding(mansion):
for i, building in enumerate(mansion):
for line in building:
for room in line:
print(" " + str(room), end="")
print()
if i != 3:
print("####################")
def calcMoving(mansion, moving_status):
... | false | 12.5 | [
"-def showBuilding(buildings):",
"- for i, tou in enumerate(buildings):",
"- for wow in tou:",
"- for room in wow:",
"+def showBuilding(mansion):",
"+ for i, building in enumerate(mansion):",
"+ for line in building:",
"+ for room in line:",
"+def calcMoving... | false | 0.048432 | 0.047893 | 1.011249 | [
"s904142024",
"s484944626"
] |
u754022296 | p03083 | python | s738206694 | s161661718 | 783 | 618 | 36,796 | 36,768 | Accepted | Accepted | 21.07 | U = 2*10**5
MOD = 10**9+7
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
two = [1]*(U+1)
two_inv = [1]*(U+1)
for i in range(1,U+1):
fact[i] = (fact[i-1]*i)%MOD
two[i] = (two[i-1]*2)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
two_inv[U] = pow(two[U], MOD-2, MOD)
for i in range(U,0,-1):
fact_inv[i... | def main():
U = 2*10**5
MOD = 10**9+7
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
two = [1]*(U+1)
two_inv = [1]*(U+1)
for i in range(1,U+1):
fact[i] = (fact[i-1]*i)%MOD
two[i] = (two[i-1]*2)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
two_inv[U] = pow(two[U], MOD-2, MOD)
for... | 41 | 46 | 819 | 945 | U = 2 * 10**5
MOD = 10**9 + 7
fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
two = [1] * (U + 1)
two_inv = [1] * (U + 1)
for i in range(1, U + 1):
fact[i] = (fact[i - 1] * i) % MOD
two[i] = (two[i - 1] * 2) % MOD
fact_inv[U] = pow(fact[U], MOD - 2, MOD)
two_inv[U] = pow(two[U], MOD - 2, MOD)
for i in range(U, 0,... | def main():
U = 2 * 10**5
MOD = 10**9 + 7
fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
two = [1] * (U + 1)
two_inv = [1] * (U + 1)
for i in range(1, U + 1):
fact[i] = (fact[i - 1] * i) % MOD
two[i] = (two[i - 1] * 2) % MOD
fact_inv[U] = pow(fact[U], MOD - 2, MOD)
two... | false | 10.869565 | [
"-U = 2 * 10**5",
"-MOD = 10**9 + 7",
"-fact = [1] * (U + 1)",
"-fact_inv = [1] * (U + 1)",
"-two = [1] * (U + 1)",
"-two_inv = [1] * (U + 1)",
"-for i in range(1, U + 1):",
"- fact[i] = (fact[i - 1] * i) % MOD",
"- two[i] = (two[i - 1] * 2) % MOD",
"-fact_inv[U] = pow(fact[U], MOD - 2, MOD)... | false | 0.551909 | 0.84646 | 0.65202 | [
"s738206694",
"s161661718"
] |
u309977459 | p03504 | python | s538592105 | s927256431 | 1,984 | 538 | 54,752 | 51,860 | Accepted | Accepted | 72.88 | from itertools import accumulate
N, C = list(map(int, input().split()))
STC = [list(map(int, input().split())) for _ in range(N)]
M = 10**5+1
merge = [[0]*(M+1) for _ in range(31)]
for i in range(N):
s, t, c = STC[i]
merge[c][s] += 1
merge[c][t+1] -= 1
for c in range(31):
merge[c] = list([in... | from itertools import accumulate
N, C = list(map(int, input().split()))
STC = [list(map(int, input().split())) for _ in range(N)]
M = 10**5+1
merge = [[0]*(M+1) for _ in range(31)]
for i in range(N):
s, t, c = STC[i]
#merge[c][s] += 1
#merge[c][t+1] -= 1
merge[c][s:t+1] = [1]*(t-s+1)
#for c ... | 20 | 22 | 500 | 581 | from itertools import accumulate
N, C = list(map(int, input().split()))
STC = [list(map(int, input().split())) for _ in range(N)]
M = 10**5 + 1
merge = [[0] * (M + 1) for _ in range(31)]
for i in range(N):
s, t, c = STC[i]
merge[c][s] += 1
merge[c][t + 1] -= 1
for c in range(31):
merge[c] = list([int(b... | from itertools import accumulate
N, C = list(map(int, input().split()))
STC = [list(map(int, input().split())) for _ in range(N)]
M = 10**5 + 1
merge = [[0] * (M + 1) for _ in range(31)]
for i in range(N):
s, t, c = STC[i]
# merge[c][s] += 1
# merge[c][t+1] -= 1
merge[c][s : t + 1] = [1] * (t - s + 1)
... | false | 9.090909 | [
"- merge[c][s] += 1",
"- merge[c][t + 1] -= 1",
"-for c in range(31):",
"- merge[c] = list([int(bool(x)) for x in accumulate(merge[c])])",
"-ans = []",
"-for i in range(M + 1):",
"- res = 0",
"- for j in range(31):",
"- res += merge[j][i]",
"- ans.append(res)",
"-print((... | false | 2.281797 | 0.531036 | 4.296879 | [
"s538592105",
"s927256431"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.