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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u607155447 | p02675 | python | s407385034 | s935072328 | 31 | 27 | 9,132 | 9,084 | Accepted | Accepted | 12.9 | N = int(eval(input()))
n = N % 10
if n == 3:
print('bon')
elif n ==0 or n==1 or n==6 or n==8:
print('pon')
else:
print('hon') | N = int(eval(input()))
ch = ['pon', 'pon', 'hon', 'bon', 'hon', 'hon', 'pon', 'hon', 'pon', 'hon']
print((ch[N%10])) | 11 | 3 | 144 | 110 | N = int(eval(input()))
n = N % 10
if n == 3:
print("bon")
elif n == 0 or n == 1 or n == 6 or n == 8:
print("pon")
else:
print("hon")
| N = int(eval(input()))
ch = ["pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"]
print((ch[N % 10]))
| false | 72.727273 | [
"-n = N % 10",
"-if n == 3:",
"- print(\"bon\")",
"-elif n == 0 or n == 1 or n == 6 or n == 8:",
"- print(\"pon\")",
"-else:",
"- print(\"hon\")",
"+ch = [\"pon\", \"pon\", \"hon\", \"bon\", \"hon\", \"hon\", \"pon\", \"hon\", \"pon\", \"hon\"]",
"+print((ch[N % 10]))"
] | false | 0.047299 | 0.038325 | 1.23416 | [
"s407385034",
"s935072328"
] |
u397531548 | p04012 | python | s187813723 | s301815486 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | from collections import Counter
w = Counter(eval(input()))
ans = "Yes"
for i in list(w.values()):
if i % 2 != 0:
ans = "No"
print(ans) | w=eval(input())
for X in ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]:
if int(w.count(X))%2==1:
print("No")
break
else:
print("Yes") | 7 | 7 | 140 | 217 | from collections import Counter
w = Counter(eval(input()))
ans = "Yes"
for i in list(w.values()):
if i % 2 != 0:
ans = "No"
print(ans)
| w = eval(input())
for X in [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]:
if int(w.count(X)) % 2 == 1:
print("No")
... | false | 0 | [
"-from collections import Counter",
"-",
"-w = Counter(eval(input()))",
"-ans = \"Yes\"",
"-for i in list(w.values()):",
"- if i % 2 != 0:",
"- ans = \"No\"",
"-print(ans)",
"+w = eval(input())",
"+for X in [",
"+ \"a\",",
"+ \"b\",",
"+ \"c\",",
"+ \"d\",",
"+ \... | false | 0.070138 | 0.070788 | 0.990814 | [
"s187813723",
"s301815486"
] |
u201234972 | p03050 | python | s637854709 | s138656419 | 213 | 117 | 41,328 | 3,564 | Accepted | Accepted | 45.07 | from collections import deque
from copy import deepcopy
def factors(N):
ret = []
for i in range(2, int(N**(1/2))+1):
if N%i == 0:
ret.append([])
t = 1
while N%i == 0:
N //= i
ret[-1].append(i**t)
t += 1
r... | def factors(N): #約数を全て求める。ただし、順不同
from collections import deque
ret = deque()
middle = int( N**(1/2))
for i in range(1, middle):
if N%i == 0:
ret.append(i)
ret.append(N//i)
if N%middle == 0:
ret.append(middle)
if middle != N//mi... | 32 | 27 | 610 | 609 | from collections import deque
from copy import deepcopy
def factors(N):
ret = []
for i in range(2, int(N ** (1 / 2)) + 1):
if N % i == 0:
ret.append([])
t = 1
while N % i == 0:
N //= i
ret[-1].append(i**t)
t += 1
r... | def factors(N): # 約数を全て求める。ただし、順不同
from collections import deque
ret = deque()
middle = int(N ** (1 / 2))
for i in range(1, middle):
if N % i == 0:
ret.append(i)
ret.append(N // i)
if N % middle == 0:
ret.append(middle)
if middle != N // middle:
... | false | 15.625 | [
"-from collections import deque",
"-from copy import deepcopy",
"+def factors(N): # 約数を全て求める。ただし、順不同",
"+ from collections import deque",
"-",
"-def factors(N):",
"- ret = []",
"- for i in range(2, int(N ** (1 / 2)) + 1):",
"+ ret = deque()",
"+ middle = int(N ** (1 / 2))",
"+ ... | false | 0.381201 | 0.246214 | 1.548248 | [
"s637854709",
"s138656419"
] |
u798093965 | p02678 | python | s501103920 | s561319422 | 1,510 | 1,320 | 60,232 | 58,060 | Accepted | Accepted | 12.58 | n,m=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(m)]
ikeruheya = [[] for i in range(n)]
ans = [0]*n
ans[0]=1
for i in range(m):
ikeruheya[a[i][0]-1].append(a[i][1])
ikeruheya[a[i][1]-1].append(a[i][0])
next=[1]
while len(next):
imaheya = next.pop(0)-1
... | n,m=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(m)]
ikeruheya = [[] for i in range(n)]
ans = [0]*(n+1)
ans[0]=-1
ans[1]=1
for i in range(m):
if a[i][0]==1:
ikeruheya[0].append(a[i][1])
elif a[i][1]==1:
ikeruheya[0].append(a[i][0])
else:
... | 33 | 41 | 708 | 895 | n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]
ikeruheya = [[] for i in range(n)]
ans = [0] * n
ans[0] = 1
for i in range(m):
ikeruheya[a[i][0] - 1].append(a[i][1])
ikeruheya[a[i][1] - 1].append(a[i][0])
next = [1]
while len(next):
imaheya = next.pop(0) - 1
... | n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]
ikeruheya = [[] for i in range(n)]
ans = [0] * (n + 1)
ans[0] = -1
ans[1] = 1
for i in range(m):
if a[i][0] == 1:
ikeruheya[0].append(a[i][1])
elif a[i][1] == 1:
ikeruheya[0].append(a[i][0])
else:
... | false | 19.512195 | [
"-ans = [0] * n",
"-ans[0] = 1",
"+ans = [0] * (n + 1)",
"+ans[0] = -1",
"+ans[1] = 1",
"- ikeruheya[a[i][0] - 1].append(a[i][1])",
"- ikeruheya[a[i][1] - 1].append(a[i][0])",
"+ if a[i][0] == 1:",
"+ ikeruheya[0].append(a[i][1])",
"+ elif a[i][1] == 1:",
"+ ikeruheya[0... | false | 0.03725 | 0.037094 | 1.004217 | [
"s501103920",
"s561319422"
] |
u281610856 | p03408 | python | s580301254 | s332891003 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
D = {}
for s in S:
if s in D:
D[s] += 1
else:
D[s] = 1
m = int(eval(input()))
T = [eval(input()) for _ in range(m)]
for t in T:
if t in D:
D[t] -= 1
D_sorted = sorted(list(D.items()), key=lambda x: x[1], revers... | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
ans = 0
temp = set(S)
for i in temp:
if S.count(i) - T.count(i) > ans:
ans = S.count(i) - T.count(i)
print(ans)
| 17 | 10 | 354 | 231 | n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
D = {}
for s in S:
if s in D:
D[s] += 1
else:
D[s] = 1
m = int(eval(input()))
T = [eval(input()) for _ in range(m)]
for t in T:
if t in D:
D[t] -= 1
D_sorted = sorted(list(D.items()), key=lambda x: x[1], reverse=True)
for k... | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
ans = 0
temp = set(S)
for i in temp:
if S.count(i) - T.count(i) > ans:
ans = S.count(i) - T.count(i)
print(ans)
| false | 41.176471 | [
"-n = int(eval(input()))",
"-S = [eval(input()) for _ in range(n)]",
"-D = {}",
"-for s in S:",
"- if s in D:",
"- D[s] += 1",
"- else:",
"- D[s] = 1",
"-m = int(eval(input()))",
"-T = [eval(input()) for _ in range(m)]",
"-for t in T:",
"- if t in D:",
"- D[t] -... | false | 0.043547 | 0.043619 | 0.998335 | [
"s580301254",
"s332891003"
] |
u450956662 | p02928 | python | s348082266 | s307490983 | 1,165 | 705 | 3,188 | 3,188 | Accepted | Accepted | 39.48 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
if K == 1:
for i in range(N-1):
for j in range(i+1, N):
if A[i] > A[j]:
ans += 1
ans %= mod
print(ans)
exit()
for i in range(N):
tmp = 0
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
x, y = 0, 0
for i in range(N):
for j in range(i+1, N):
if A[i] > A[j]:
x += 1
for j in range(i):
if A[i] > A[j]:
y += 1
ans = x * K * (K+1) // 2 + y * (K-1) * K... | 28 | 18 | 558 | 339 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
if K == 1:
for i in range(N - 1):
for j in range(i + 1, N):
if A[i] > A[j]:
ans += 1
ans %= mod
print(ans)
exit()
for i in range(N):
tmp = 0
for j in range(i... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
x, y = 0, 0
for i in range(N):
for j in range(i + 1, N):
if A[i] > A[j]:
x += 1
for j in range(i):
if A[i] > A[j]:
y += 1
ans = x * K * (K + 1) // 2 + y * (K - 1) * K // 2
print((an... | false | 35.714286 | [
"-ans = 0",
"-if K == 1:",
"- for i in range(N - 1):",
"- for j in range(i + 1, N):",
"- if A[i] > A[j]:",
"- ans += 1",
"- ans %= mod",
"- print(ans)",
"- exit()",
"+x, y = 0, 0",
"- tmp = 0",
"- tmp += (K * (K + 1) // 2) % mod",
... | false | 0.037602 | 0.036586 | 1.027774 | [
"s348082266",
"s307490983"
] |
u075303794 | p02773 | python | s859643877 | s567154848 | 931 | 569 | 43,228 | 35,824 | Accepted | Accepted | 38.88 | n = int(eval(input()))
dic = {}
val_set = set()
ans = []
for i in range(n):
temp = eval(input())
try:
dic[temp] += 1
except:
dic[temp] = 1
dic = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
for key,val in dic:
val_set.add(val)
if len(val_set) == 2:
break
else:... | from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name,val in counter.items() if val==max_cnt]
names.sort()
print(*names, sep='\n')
| 25 | 12 | 375 | 248 | n = int(eval(input()))
dic = {}
val_set = set()
ans = []
for i in range(n):
temp = eval(input())
try:
dic[temp] += 1
except:
dic[temp] = 1
dic = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
for key, val in dic:
val_set.add(val)
if len(val_set) == 2:
break
e... | from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, val in counter.items() if val == max_cnt]
names.sort()
print(*names, sep="\n")
| false | 52 | [
"-n = int(eval(input()))",
"-dic = {}",
"-val_set = set()",
"-ans = []",
"-for i in range(n):",
"- temp = eval(input())",
"- try:",
"- dic[temp] += 1",
"- except:",
"- dic[temp] = 1",
"-dic = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)",
"-for key, val in... | false | 0.039206 | 0.034976 | 1.120945 | [
"s859643877",
"s567154848"
] |
u754022296 | p02599 | python | s642103653 | s501778953 | 1,406 | 1,036 | 243,576 | 227,128 | Accepted | Accepted | 26.32 | n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1]*(n+1)
A = [0]*q
U = 10**6
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted(r*U+i for i, (l, r) in enumerate(LR))
B = [0]*(1<<n.bit_length())
def add(i, a):
while i <= n:
B[i] += a
i += i & -... | import sys
input = sys.stdin.readline
n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1]*(n+1)
A = [0]*q
U = 10**6
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted(r*U+i for i, (l, r) in enumerate(LR))
B = [0]*(1<<n.bit_length())
def add(i, a):
wh... | 31 | 34 | 644 | 686 | n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1] * (n + 1)
A = [0] * q
U = 10**6
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted(r * U + i for i, (l, r) in enumerate(LR))
B = [0] * (1 << n.bit_length())
def add(i, a):
while i <= n:
B[i] += a
... | import sys
input = sys.stdin.readline
n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1] * (n + 1)
A = [0] * q
U = 10**6
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted(r * U + i for i, (l, r) in enumerate(LR))
B = [0] * (1 << n.bit_length())
def add(i, a):
... | false | 8.823529 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.007433 | 0.152726 | 0.048672 | [
"s642103653",
"s501778953"
] |
u277175276 | p02946 | python | s122959635 | s544468562 | 277 | 152 | 18,608 | 12,392 | Accepted | Accepted | 45.13 | import numpy as np
#K,Xの定義づけ
Y,D=list(map(int,input().split()))
#行列の作成
B=np.array(list(range(-Y+D+1,Y+D,1)))
#printする
for i in B:
print(i) | import numpy as np
#K,Xの定義づけ
K,X=list(map(int,input().split()))
#行列の作成
B=np.array(list(range(-K+X+1,K+X,1)))
#printする
for i in B:
print(i) | 8 | 8 | 135 | 135 | import numpy as np
# K,Xの定義づけ
Y, D = list(map(int, input().split()))
# 行列の作成
B = np.array(list(range(-Y + D + 1, Y + D, 1)))
# printする
for i in B:
print(i)
| import numpy as np
# K,Xの定義づけ
K, X = list(map(int, input().split()))
# 行列の作成
B = np.array(list(range(-K + X + 1, K + X, 1)))
# printする
for i in B:
print(i)
| false | 0 | [
"-Y, D = list(map(int, input().split()))",
"+K, X = list(map(int, input().split()))",
"-B = np.array(list(range(-Y + D + 1, Y + D, 1)))",
"+B = np.array(list(range(-K + X + 1, K + X, 1)))"
] | false | 0.262454 | 0.255177 | 1.028517 | [
"s122959635",
"s544468562"
] |
u785578220 | p03352 | python | s097826456 | s234091030 | 20 | 18 | 2,940 | 3,064 | Accepted | Accepted | 10 | a = int(eval(input()))
l = []
for i in range(100):
for j in range(2,10):
if i**j <= a:
l.append(i**j)
print((max(l))) | a = int(eval(input()))
m = 1
for i in range(a//2+1):
for j in range(1,10):
if a>=i**j and m <i**j:
m = i**j
if a < i**j:
break
print(m)
| 8 | 9 | 142 | 182 | a = int(eval(input()))
l = []
for i in range(100):
for j in range(2, 10):
if i**j <= a:
l.append(i**j)
print((max(l)))
| a = int(eval(input()))
m = 1
for i in range(a // 2 + 1):
for j in range(1, 10):
if a >= i**j and m < i**j:
m = i**j
if a < i**j:
break
print(m)
| false | 11.111111 | [
"-l = []",
"-for i in range(100):",
"- for j in range(2, 10):",
"- if i**j <= a:",
"- l.append(i**j)",
"-print((max(l)))",
"+m = 1",
"+for i in range(a // 2 + 1):",
"+ for j in range(1, 10):",
"+ if a >= i**j and m < i**j:",
"+ m = i**j",
"+ if ... | false | 0.070687 | 0.074013 | 0.955071 | [
"s097826456",
"s234091030"
] |
u424768586 | p02757 | python | s120876288 | s380779881 | 299 | 209 | 41,308 | 41,308 | Accepted | Accepted | 30.1 | import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
#import queue
from copy import copy, deepcopy
from operator import itemgetter
import bisect#2分探索
#bisect_left(l,x), bisect(l,x)
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうの... | import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
#import queue
from copy import copy, deepcopy
from operator import itemgetter
import bisect#2分探索
#bisect_left(l,x), bisect(l,x)
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうの... | 66 | 69 | 1,806 | 1,838 | import sys
sys.setrecursionlimit(10**6) # 再帰関数の上限
import math
# import queue
from copy import copy, deepcopy
from operator import itemgetter
import bisect # 2分探索
# bisect_left(l,x), bisect(l,x)
from collections import deque
# deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので... | import sys
sys.setrecursionlimit(10**6) # 再帰関数の上限
import math
# import queue
from copy import copy, deepcopy
from operator import itemgetter
import bisect # 2分探索
# bisect_left(l,x), bisect(l,x)
from collections import deque
# deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので... | false | 4.347826 | [
"+ p10 = 1",
"- count += int(S[N - i]) * pow(10, (i - 1), P)",
"+ count += int(S[N - i]) * p10",
"+ p10 *= 10",
"+ p10 %= P"
] | false | 0.042181 | 0.038054 | 1.108472 | [
"s120876288",
"s380779881"
] |
u687053495 | p03761 | python | s213314726 | s896056127 | 26 | 21 | 3,436 | 3,316 | Accepted | Accepted | 19.23 | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
C = []
for s in S:
cnt = Counter()
for cha in s:
cnt[cha] += 1
C.append(cnt)
merged = C[0]
for c in C:
cnt = Counter()
for (key1, value1) in list(merged.items()):
for (key2, value2) in list(... | from collections import Counter
N = int(eval(input()))
S = [Counter(eval(input())) for i in range(N)]
merged = S[0]
for s in S:
merged &= s
ans = ""
for (key, value) in list(merged.items()):
ans += key * value
print(("".join(sorted(ans)))) | 27 | 14 | 492 | 240 | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
C = []
for s in S:
cnt = Counter()
for cha in s:
cnt[cha] += 1
C.append(cnt)
merged = C[0]
for c in C:
cnt = Counter()
for (key1, value1) in list(merged.items()):
for (key2, value2) in list(... | from collections import Counter
N = int(eval(input()))
S = [Counter(eval(input())) for i in range(N)]
merged = S[0]
for s in S:
merged &= s
ans = ""
for (key, value) in list(merged.items()):
ans += key * value
print(("".join(sorted(ans))))
| false | 48.148148 | [
"-S = [eval(input()) for i in range(N)]",
"-C = []",
"+S = [Counter(eval(input())) for i in range(N)]",
"+merged = S[0]",
"- cnt = Counter()",
"- for cha in s:",
"- cnt[cha] += 1",
"- C.append(cnt)",
"-merged = C[0]",
"-for c in C:",
"- cnt = Counter()",
"- for (key1, val... | false | 0.037631 | 0.074366 | 0.506028 | [
"s213314726",
"s896056127"
] |
u411353821 | p02936 | python | s833249928 | s202709471 | 1,635 | 748 | 56,088 | 128,228 | Accepted | Accepted | 54.25 | from collections import deque
def main():
N, Q = list(map(int, input().split()))
g = [[] for _ in range(N)]
# for storing the value of the each node
cnt = [0]*N
# for DFS
stack = deque()
stack.append(0)
seen = [0] * N
# store the structure of the graph
for i ... | from collections import deque
def main():
N, Q = list(map(int, input().split()))
g = [[] for _ in range(N)]
score = [0] * N
seen = [0] * N
for _ in range(N-1):
a, b = list(map(int, input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
for _ in range(Q):
... | 41 | 33 | 839 | 666 | from collections import deque
def main():
N, Q = list(map(int, input().split()))
g = [[] for _ in range(N)]
# for storing the value of the each node
cnt = [0] * N
# for DFS
stack = deque()
stack.append(0)
seen = [0] * N
# store the structure of the graph
for i in range(N - 1):
... | from collections import deque
def main():
N, Q = list(map(int, input().split()))
g = [[] for _ in range(N)]
score = [0] * N
seen = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
for _ in range(Q):
... | false | 19.512195 | [
"- # for storing the value of the each node",
"- cnt = [0] * N",
"- # for DFS",
"- stack = deque()",
"- stack.append(0)",
"+ score = [0] * N",
"- # store the structure of the graph",
"- for i in range(N - 1):",
"+ for _ in range(N - 1):",
"+ g[a - 1].append(b - 1)... | false | 0.04692 | 0.047305 | 0.991857 | [
"s833249928",
"s202709471"
] |
u133936772 | p02813 | python | s188637681 | s211118960 | 177 | 27 | 44,656 | 8,052 | Accepted | Accepted | 84.75 | n = int(eval(input()))
tp = tuple(map(int, input().split()))
tq = tuple(map(int, input().split()))
import itertools as it
l = list(it.permutations(list(range(1, n+1))))
print((abs(l.index(tp) - l.index(tq)))) | f=lambda:tuple(map(int,input().split()))
n=int(eval(input()))
tp,tq=f(),f()
import itertools as it
l=list(it.permutations(list(range(1,n+1))))
print((abs(l.index(tp)-l.index(tq)))) | 9 | 6 | 205 | 171 | n = int(eval(input()))
tp = tuple(map(int, input().split()))
tq = tuple(map(int, input().split()))
import itertools as it
l = list(it.permutations(list(range(1, n + 1))))
print((abs(l.index(tp) - l.index(tq))))
| f = lambda: tuple(map(int, input().split()))
n = int(eval(input()))
tp, tq = f(), f()
import itertools as it
l = list(it.permutations(list(range(1, n + 1))))
print((abs(l.index(tp) - l.index(tq))))
| false | 33.333333 | [
"+f = lambda: tuple(map(int, input().split()))",
"-tp = tuple(map(int, input().split()))",
"-tq = tuple(map(int, input().split()))",
"+tp, tq = f(), f()"
] | false | 0.149525 | 0.155012 | 0.964604 | [
"s188637681",
"s211118960"
] |
u102461423 | p02589 | python | s171351073 | s940921575 | 2,711 | 815 | 153,064 | 381,348 | Accepted | Accepted | 69.94 | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MASK30 = (1 << 30) - 1
MASK31 = (1 << 31) - 1
MASK61 = (1 << 61) - 1
@njit((i8, ), cache=True)
def rh_modulo(x):
... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:], ), cache=True)
def main(S):
S = S.copy()
l_ind = np.where(S == -1)[0][:-1] + 1
r_ind = np.wh... | 112 | 58 | 2,867 | 1,482 | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MASK30 = (1 << 30) - 1
MASK31 = (1 << 31) - 1
MASK61 = (1 << 61) - 1
@njit((i8,), cache=True)
def rh_modulo(x):
xu, xd = x >> ... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:],), cache=True)
def main(S):
S = S.copy()
l_ind = np.where(S == -1)[0][:-1] + 1
r_ind = np.where(S == -1)[... | false | 48.214286 | [
"-MASK30 = (1 << 30) - 1",
"-MASK31 = (1 << 31) - 1",
"-MASK61 = (1 << 61) - 1",
"-",
"-",
"-@njit((i8,), cache=True)",
"-def rh_modulo(x):",
"- xu, xd = x >> 61, x & MASK61",
"- x = xu + xd",
"- if x >= MASK61:",
"- x -= MASK61",
"- return x",
"-",
"-",
"-@njit((i8, i... | false | 0.53402 | 0.269551 | 1.981145 | [
"s171351073",
"s940921575"
] |
u838644735 | p02660 | python | s473441550 | s482829397 | 112 | 86 | 9,172 | 9,212 | Accepted | Accepted | 23.21 | import math
def append_factor(f, p):
if p not in f:
f[p] = 0
f[p] += 1
def append_factors(n, f, p):
num_factors = 0
while n % p == 0:
num_factors += 1
n //= p
if num_factors != 0:
f[p] = num_factors
return n
def factors(n):
l = int(math.sqr... | import math
def factors(n):
l = int(math.sqrt(n)) + 1
ret = {}
nf2 = 0
while n % 2 == 0:
nf2 += 1
n //= 2
if nf2 != 0:
ret[2] = nf2
nf3 = 0
while n % 3 == 0:
nf3 += 1
n //= 3
if nf3 != 0:
ret[3] = nf3
# n = append_fact... | 53 | 63 | 1,069 | 1,304 | import math
def append_factor(f, p):
if p not in f:
f[p] = 0
f[p] += 1
def append_factors(n, f, p):
num_factors = 0
while n % p == 0:
num_factors += 1
n //= p
if num_factors != 0:
f[p] = num_factors
return n
def factors(n):
l = int(math.sqrt(n)) + 1
... | import math
def factors(n):
l = int(math.sqrt(n)) + 1
ret = {}
nf2 = 0
while n % 2 == 0:
nf2 += 1
n //= 2
if nf2 != 0:
ret[2] = nf2
nf3 = 0
while n % 3 == 0:
nf3 += 1
n //= 3
if nf3 != 0:
ret[3] = nf3
# n = append_factors(n, ret, 2)
... | false | 15.873016 | [
"-",
"-",
"-def append_factor(f, p):",
"- if p not in f:",
"- f[p] = 0",
"- f[p] += 1",
"-",
"-",
"-def append_factors(n, f, p):",
"- num_factors = 0",
"- while n % p == 0:",
"- num_factors += 1",
"- n //= p",
"- if num_factors != 0:",
"- f[p] =... | false | 0.038604 | 0.038549 | 1.001441 | [
"s473441550",
"s482829397"
] |
u268793453 | p03166 | python | s458585910 | s688244853 | 914 | 529 | 119,116 | 37,992 | Accepted | Accepted | 42.12 | from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
n, m = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(m)]
E = [[] for i in range(n+1)]
for a, b in X:
E[a].append(b)
memo = [-1] * (n+1)
def dfs(i):
if memo[i] != -1:
return memo[i] ... | from collections import deque
n, m = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(m)]
E = [[] for i in range(n+1)]
IN = [0] * (n+1)
for a, b in X:
E[a].append(b)
IN[b] += 1
q = deque((i, 0) for i in range(1, n+1) if IN[i] == 0)
D = [0] * (n+1)
while... | 23 | 25 | 471 | 479 | from sys import setrecursionlimit
setrecursionlimit(10**9)
n, m = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(m)]
E = [[] for i in range(n + 1)]
for a, b in X:
E[a].append(b)
memo = [-1] * (n + 1)
def dfs(i):
if memo[i] != -1:
return memo[i] + 1
if not ... | from collections import deque
n, m = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(m)]
E = [[] for i in range(n + 1)]
IN = [0] * (n + 1)
for a, b in X:
E[a].append(b)
IN[b] += 1
q = deque((i, 0) for i in range(1, n + 1) if IN[i] == 0)
D = [0] * (n + 1)
while q:
i, ... | false | 8 | [
"-from sys import setrecursionlimit",
"+from collections import deque",
"-setrecursionlimit(10**9)",
"+IN = [0] * (n + 1)",
"-memo = [-1] * (n + 1)",
"-",
"-",
"-def dfs(i):",
"- if memo[i] != -1:",
"- return memo[i] + 1",
"- if not E[i]:",
"- return 0",
"- memo[i] = m... | false | 0.037915 | 0.061445 | 0.617053 | [
"s458585910",
"s688244853"
] |
u644907318 | p03371 | python | s453725020 | s757524000 | 180 | 68 | 38,384 | 61,784 | Accepted | Accepted | 62.22 | A,B,C,X,Y = list(map(int,input().split()))
if 2*C<=A+B:
if X<=Y:
ans = 2*C*X
ans += (Y-X)*min(B,2*C)
else:
ans = 2*C*Y
ans += (X-Y)*min(A,2*C)
else:
if X<=Y:
ans = (A+B)*X
ans += (Y-X)*B
else:
ans = (A+B)*Y
ans += (X-Y)*A
pri... | A,B,C,X,Y = list(map(int,input().split()))
if X<=Y:
ans = X*min(A+B,2*C)
ans += (Y-X)*min(B,2*C)
else:
ans = Y*min(A+B,2*C)
ans += (X-Y)*min(A,2*C)
print(ans) | 16 | 8 | 325 | 175 | A, B, C, X, Y = list(map(int, input().split()))
if 2 * C <= A + B:
if X <= Y:
ans = 2 * C * X
ans += (Y - X) * min(B, 2 * C)
else:
ans = 2 * C * Y
ans += (X - Y) * min(A, 2 * C)
else:
if X <= Y:
ans = (A + B) * X
ans += (Y - X) * B
else:
ans = (A +... | A, B, C, X, Y = list(map(int, input().split()))
if X <= Y:
ans = X * min(A + B, 2 * C)
ans += (Y - X) * min(B, 2 * C)
else:
ans = Y * min(A + B, 2 * C)
ans += (X - Y) * min(A, 2 * C)
print(ans)
| false | 50 | [
"-if 2 * C <= A + B:",
"- if X <= Y:",
"- ans = 2 * C * X",
"- ans += (Y - X) * min(B, 2 * C)",
"- else:",
"- ans = 2 * C * Y",
"- ans += (X - Y) * min(A, 2 * C)",
"+if X <= Y:",
"+ ans = X * min(A + B, 2 * C)",
"+ ans += (Y - X) * min(B, 2 * C)",
"- if... | false | 0.03608 | 0.061522 | 0.586456 | [
"s453725020",
"s757524000"
] |
u863370423 | p03323 | python | s605844398 | s798486442 | 34 | 17 | 27,884 | 2,940 | Accepted | Accepted | 50 | a, b = list(map(int, input().split()))
if a > 8 or b > 8:
print(":(")
else:
print("Yay!")
| a, b = input().split()
a = int(a)
b = int(b)
if(a < 9 and b < 9):
print('Yay!')
else:
print(':(') | 7 | 8 | 96 | 109 | a, b = list(map(int, input().split()))
if a > 8 or b > 8:
print(":(")
else:
print("Yay!")
| a, b = input().split()
a = int(a)
b = int(b)
if a < 9 and b < 9:
print("Yay!")
else:
print(":(")
| false | 12.5 | [
"-a, b = list(map(int, input().split()))",
"-if a > 8 or b > 8:",
"+a, b = input().split()",
"+a = int(a)",
"+b = int(b)",
"+if a < 9 and b < 9:",
"+ print(\"Yay!\")",
"+else:",
"-else:",
"- print(\"Yay!\")"
] | false | 0.166951 | 0.116122 | 1.437729 | [
"s605844398",
"s798486442"
] |
u235376569 | p02714 | python | s338350487 | s950679716 | 1,970 | 1,348 | 9,200 | 9,200 | Accepted | Accepted | 31.57 | N=int(eval(input()))
S=eval(input())
ans=S.count("R")*S.count("G")*S.count("B")
for i in range(N):
for j in range(i+1,N):
k=j+(j-i)
if k<=N-1:
if S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
ans-=1
print(ans) | N=int(eval(input()))
S=eval(input())
ans=S.count("R")*S.count("G")*S.count("B")
for i in range(N):
for j in range(i+1,N):
k=j+(j-i)
if N-1<k:
break
if S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
ans-=1
print(ans) | 11 | 14 | 230 | 250 | N = int(eval(input()))
S = eval(input())
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
for j in range(i + 1, N):
k = j + (j - i)
if k <= N - 1:
if S[j] != S[i] and S[j] != S[k] and S[k] != S[i]:
ans -= 1
print(ans)
| N = int(eval(input()))
S = eval(input())
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
for j in range(i + 1, N):
k = j + (j - i)
if N - 1 < k:
break
if S[j] != S[i] and S[j] != S[k] and S[k] != S[i]:
ans -= 1
print(ans)
| false | 21.428571 | [
"- if k <= N - 1:",
"- if S[j] != S[i] and S[j] != S[k] and S[k] != S[i]:",
"- ans -= 1",
"+ if N - 1 < k:",
"+ break",
"+ if S[j] != S[i] and S[j] != S[k] and S[k] != S[i]:",
"+ ans -= 1"
] | false | 0.075176 | 0.040447 | 1.85864 | [
"s338350487",
"s950679716"
] |
u170201762 | p03722 | python | s657837125 | s902759619 | 1,970 | 490 | 3,396 | 49,112 | Accepted | Accepted | 75.13 | V,E = list(map(int,input().split()))
edge = []
for _ in range(E):
a,b,c = list(map(int,input().split()))
edge.append([a-1,b-1,-c])
inf = float('inf')
d = [inf]*V
d[0] = 0
for i in range(V):
update = False
for j in range(E):
From,To,cost = edge[j]
if d[From] != inf and d[T... | inf = float('inf')
V,E = list(map(int,input().split()))
edge = []
edge_rev = []
for i in range(E):
A,B,C = list(map(int,input().split()))
edge_rev.append([B-1,A-1,-C])
edge.append([A-1,B-1,-C])
d = [inf]*V
d[0] = 0
for i in range(V):
update = False
for j in range(E):
From,To,c... | 33 | 61 | 735 | 1,347 | V, E = list(map(int, input().split()))
edge = []
for _ in range(E):
a, b, c = list(map(int, input().split()))
edge.append([a - 1, b - 1, -c])
inf = float("inf")
d = [inf] * V
d[0] = 0
for i in range(V):
update = False
for j in range(E):
From, To, cost = edge[j]
if d[From] != inf and d[To... | inf = float("inf")
V, E = list(map(int, input().split()))
edge = []
edge_rev = []
for i in range(E):
A, B, C = list(map(int, input().split()))
edge_rev.append([B - 1, A - 1, -C])
edge.append([A - 1, B - 1, -C])
d = [inf] * V
d[0] = 0
for i in range(V):
update = False
for j in range(E):
From,... | false | 45.901639 | [
"+inf = float(\"inf\")",
"-for _ in range(E):",
"- a, b, c = list(map(int, input().split()))",
"- edge.append([a - 1, b - 1, -c])",
"-inf = float(\"inf\")",
"+edge_rev = []",
"+for i in range(E):",
"+ A, B, C = list(map(int, input().split()))",
"+ edge_rev.append([B - 1, A - 1, -C])",
... | false | 0.05557 | 0.155794 | 0.356688 | [
"s657837125",
"s902759619"
] |
u716530146 | p02949 | python | s154666712 | s679254918 | 1,047 | 810 | 44,608 | 43,484 | Accepted | Accepted | 22.64 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m,p=list(map(int,input().split()))
E=[]
for i in range(m):
a,b,c=list(map(int,input().split(... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m,p=list(map(int,input().split()))
E=[]
for i in range(m):
a,b,c=list(map(int,input().split(... | 34 | 34 | 781 | 781 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m, p = list(map(int, input().split()))
E = []
for i in range(m):
a, b, c = list(map(int, input().sp... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m, p = list(map(int, input().split()))
E = []
for i in range(m):
a, b, c = list(map(int, input().sp... | false | 0 | [
"- for i in range(3 * n):",
"+ for i in range(2 * n):"
] | false | 0.042363 | 0.043376 | 0.976649 | [
"s154666712",
"s679254918"
] |
u145231176 | p03038 | python | s523157880 | s047403176 | 522 | 311 | 81,508 | 109,392 | Accepted | Accepted | 40.42 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import d... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 44 | 72 | 1,008 | 1,701 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import def... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 38.888889 | [
"+def rand_N(ran1, ran2):",
"+ return random.randint(ran1, ran2)",
"+",
"+",
"+def rand_List(ran1, ran2, rantime):",
"+ return [random.randint(ran1, ran2) for i in range(rantime)]",
"+",
"+",
"+def rand_ints_nodup(ran1, ran2, rantime):",
"+ ns = []",
"+ while len(ns) < rantime:",
"... | false | 0.044851 | 0.04952 | 0.90571 | [
"s523157880",
"s047403176"
] |
u724428568 | p03998 | python | s151950303 | s534460215 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | from collections import deque
hands = {'a': list(eval(input())),
'b': list(eval(input())),
'c': list(eval(input())),
}
next_hand = hands['a'][0]
while True:
try:
next_hand = hands[next_hand].pop(0)
except:
break
print((next_hand.upper())) | hands = {char:list(eval(input())) for char in 'abc'}
next_hand = 'a'
while hands[next_hand]:
next_hand = hands[next_hand].pop(0)
print((next_hand.upper())) | 12 | 6 | 267 | 156 | from collections import deque
hands = {
"a": list(eval(input())),
"b": list(eval(input())),
"c": list(eval(input())),
}
next_hand = hands["a"][0]
while True:
try:
next_hand = hands[next_hand].pop(0)
except:
break
print((next_hand.upper()))
| hands = {char: list(eval(input())) for char in "abc"}
next_hand = "a"
while hands[next_hand]:
next_hand = hands[next_hand].pop(0)
print((next_hand.upper()))
| false | 50 | [
"-from collections import deque",
"-",
"-hands = {",
"- \"a\": list(eval(input())),",
"- \"b\": list(eval(input())),",
"- \"c\": list(eval(input())),",
"-}",
"-next_hand = hands[\"a\"][0]",
"-while True:",
"- try:",
"- next_hand = hands[next_hand].pop(0)",
"- except:",
... | false | 0.037251 | 0.037848 | 0.984204 | [
"s151950303",
"s534460215"
] |
u633068244 | p00447 | python | s797167505 | s178214476 | 760 | 260 | 4,480 | 4,480 | Accepted | Accepted | 65.79 | while True:
try:
dax,bx = [],[]
m = int(input())
a = sorted([list(map(int, input().split())) for i in range(m)])
for i in range(m):
dax.append(a[i][0]-a[0][0])
n = int(input())
b = sorted([list(map(int, input().split())) for i in range(n)])
... | while True:
try:
m = int(input())
a = sorted([list(map(int, input().split())) for i in range(m)])
dax = [a[i][0]-a[0][0] for i in range(m)]
n = int(input())
b = sorted([list(map(int, input().split())) for i in range(n)])
bx = [b[i][0] for i in range(n)]
... | 20 | 17 | 643 | 588 | while True:
try:
dax, bx = [], []
m = int(input())
a = sorted([list(map(int, input().split())) for i in range(m)])
for i in range(m):
dax.append(a[i][0] - a[0][0])
n = int(input())
b = sorted([list(map(int, input().split())) for i in range(n)])
for... | while True:
try:
m = int(input())
a = sorted([list(map(int, input().split())) for i in range(m)])
dax = [a[i][0] - a[0][0] for i in range(m)]
n = int(input())
b = sorted([list(map(int, input().split())) for i in range(n)])
bx = [b[i][0] for i in range(n)]
for ... | false | 15 | [
"- dax, bx = [], []",
"- for i in range(m):",
"- dax.append(a[i][0] - a[0][0])",
"+ dax = [a[i][0] - a[0][0] for i in range(m)]",
"- for i in b:",
"- bx.append(i[0])",
"+ bx = [b[i][0] for i in range(n)]",
"- if bx.count(bx[i] + d... | false | 0.065213 | 0.04077 | 1.599512 | [
"s797167505",
"s178214476"
] |
u723590269 | p02900 | python | s948903103 | s046794093 | 454 | 243 | 5,432 | 3,064 | Accepted | Accepted | 46.48 | #gcd
from fractions import gcd
#素因数分解
def primefact(x0):
tmp_l = [1]
if x0 == 1:
return tmp_l
i = 2
while 1:
if i > pow(x0,1/2):
if x0 == 1:
break
tmp_l.append(x0)
break
if x0 % i == 0:
tmp_l.append(... | #素因数分解
def prime_factorize(x0):
tmp_l = [1]
if x0 == 1:
return tmp_l
if x0%2 == 0:
tmp_l.append(2)
while x0 % 2 == 0:
x0 //=2
if x0 > 2:
i = 3
while 1:
if i > pow(x0,1/2):
if x0 == 1:
break
... | 27 | 39 | 491 | 809 | # gcd
from fractions import gcd
# 素因数分解
def primefact(x0):
tmp_l = [1]
if x0 == 1:
return tmp_l
i = 2
while 1:
if i > pow(x0, 1 / 2):
if x0 == 1:
break
tmp_l.append(x0)
break
if x0 % i == 0:
tmp_l.append(i)
... | # 素因数分解
def prime_factorize(x0):
tmp_l = [1]
if x0 == 1:
return tmp_l
if x0 % 2 == 0:
tmp_l.append(2)
while x0 % 2 == 0:
x0 //= 2
if x0 > 2:
i = 3
while 1:
if i > pow(x0, 1 / 2):
if x0 == 1:
break
... | false | 30.769231 | [
"-# gcd",
"-from fractions import gcd",
"-",
"-def primefact(x0):",
"+def prime_factorize(x0):",
"- i = 2",
"- while 1:",
"- if i > pow(x0, 1 / 2):",
"- if x0 == 1:",
"+ if x0 % 2 == 0:",
"+ tmp_l.append(2)",
"+ while x0 % 2 == 0:",
"+ x0 /... | false | 0.127667 | 0.104872 | 1.217351 | [
"s948903103",
"s046794093"
] |
u905203728 | p03805 | python | s853650246 | s920912518 | 189 | 79 | 41,820 | 73,112 | Accepted | Accepted | 58.2 | def DFS(num):
global ans,color
color[num]="black"
if "white" not in color:
ans +=1
for i in M[num]:
if color[i]=="white":
DFS(i)
color[num]="white"
n,m=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(m)]
M=[[] for _ in ran... | from itertools import permutations
n,m=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(m)]
MAP=[[] for _ in range(n)]
for a,b in AB:
MAP[a-1].append(b-1)
MAP[b-1].append(a-1)
ans=0
for A in permutations(list(range(n)),n):
if A[0]==0:
for i in range(n):
... | 23 | 17 | 448 | 435 | def DFS(num):
global ans, color
color[num] = "black"
if "white" not in color:
ans += 1
for i in M[num]:
if color[i] == "white":
DFS(i)
color[num] = "white"
n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
M = [[] for _ in r... | from itertools import permutations
n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
MAP = [[] for _ in range(n)]
for a, b in AB:
MAP[a - 1].append(b - 1)
MAP[b - 1].append(a - 1)
ans = 0
for A in permutations(list(range(n)), n):
if A[0] == 0:
for i in ... | false | 26.086957 | [
"-def DFS(num):",
"- global ans, color",
"- color[num] = \"black\"",
"- if \"white\" not in color:",
"- ans += 1",
"- for i in M[num]:",
"- if color[i] == \"white\":",
"- DFS(i)",
"- color[num] = \"white\"",
"-",
"+from itertools import permutations",
"-... | false | 0.039928 | 0.053419 | 0.747455 | [
"s853650246",
"s920912518"
] |
u127499732 | p02780 | python | s836088645 | s051028718 | 159 | 131 | 23,616 | 23,896 | Accepted | Accepted | 17.61 | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
*exp, = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ans = l[k - 1]
for i in range(0, n - k):
x = l[i + k] - l[i]
ans = max(ans, x)
print(ans)
... | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
*exp, = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ll = [l[k - 1]] + [l[i + k] - l[i] for i in range(n-k)]
ans = max(ll)
print(ans)
if __name__ == '__main__':... | 15 | 13 | 359 | 332 | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
(*exp,) = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ans = l[k - 1]
for i in range(0, n - k):
x = l[i + k] - l[i]
ans = max(ans, x)
print(ans)
if __name... | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
(*exp,) = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ll = [l[k - 1]] + [l[i + k] - l[i] for i in range(n - k)]
ans = max(ll)
print(ans)
if __name__ == "__main__":
m... | false | 13.333333 | [
"- ans = l[k - 1]",
"- for i in range(0, n - k):",
"- x = l[i + k] - l[i]",
"- ans = max(ans, x)",
"+ ll = [l[k - 1]] + [l[i + k] - l[i] for i in range(n - k)]",
"+ ans = max(ll)"
] | false | 0.06854 | 0.041484 | 1.652211 | [
"s836088645",
"s051028718"
] |
u631277801 | p03040 | python | s061377444 | s254248489 | 890 | 701 | 19,056 | 11,112 | Accepted | Accepted | 21.24 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 46 | 66 | 1,019 | 1,711 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 30.30303 | [
"-from heapq import heappush, heappop",
"+from heapq import heappop, heappush",
"-# 中央値以上と以下をheapで管理",
"-upper_asc = []",
"-lower_dsc = []",
"+bigger = []",
"+smaller = []",
"+",
"+",
"+def modify(bigger, smaller, a: int, b: int, mid: int, ans: int):",
"+ if not bigger and not smaller:",
"+... | false | 0.067664 | 0.045913 | 1.473739 | [
"s061377444",
"s254248489"
] |
u531599639 | p02779 | python | s542214452 | s610562891 | 78 | 67 | 30,160 | 30,160 | Accepted | Accepted | 14.1 | N = int(eval(input()))
A = set(input().split())
print(('YNEOS'[len(A)!=N::2])) | n = int(eval(input()))
print(('YNEOS'[len(set(input().split()))!=n::2])) | 3 | 2 | 72 | 65 | N = int(eval(input()))
A = set(input().split())
print(("YNEOS"[len(A) != N :: 2]))
| n = int(eval(input()))
print(("YNEOS"[len(set(input().split())) != n :: 2]))
| false | 33.333333 | [
"-N = int(eval(input()))",
"-A = set(input().split())",
"-print((\"YNEOS\"[len(A) != N :: 2]))",
"+n = int(eval(input()))",
"+print((\"YNEOS\"[len(set(input().split())) != n :: 2]))"
] | false | 0.065153 | 0.045912 | 1.419096 | [
"s542214452",
"s610562891"
] |
u273496671 | p02911 | python | s740498845 | s082304716 | 557 | 142 | 51,024 | 10,416 | Accepted | Accepted | 74.51 | N,K,Q = list(map(int,input().split()))
A = [0] * Q
for i in range(Q):
A[i] = int(eval(input()))
judge = [K-Q] * N
for j in A:
judge[j-1] += 1
for k in judge:
if k > 0:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
N,K,Q = list(map(int,input().split()))
A = [0] * Q
for i in range(Q):
A[i] = int(eval(input()))
judge = [K-Q] * N
for j in A:
judge[j-1] += 1
for k in judge:
if k > 0:
print("Yes")
else:
print("No")
| 14 | 16 | 238 | 278 | N, K, Q = list(map(int, input().split()))
A = [0] * Q
for i in range(Q):
A[i] = int(eval(input()))
judge = [K - Q] * N
for j in A:
judge[j - 1] += 1
for k in judge:
if k > 0:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
N, K, Q = list(map(int, input().split()))
A = [0] * Q
for i in range(Q):
A[i] = int(eval(input()))
judge = [K - Q] * N
for j in A:
judge[j - 1] += 1
for k in judge:
if k > 0:
print("Yes")
else:
print("No")
| false | 12.5 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.035903 | 0.037966 | 0.945659 | [
"s740498845",
"s082304716"
] |
u057415180 | p03031 | python | s008999672 | s568213004 | 46 | 33 | 3,064 | 3,064 | Accepted | Accepted | 28.26 | n, m = list(map(int, input().split()))
g = [[-1]*n for _ in range(m)]
for i in range(m):
s = list(map(int, input().split()))
s.pop(0)
for j in s:
g[i][j-1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
switch = [0]*n
for j in range(n):
if ((i >> j) & 1):
sw... | def main():
n, m = list(map(int, input().split()))
g = [[-1]*n for _ in range(m)]
for i in range(m):
s = list(map(int, input().split()))
for j in s[1:]:
g[i][j-1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
s = [0]*n
for j in range(n):
if (... | 28 | 31 | 538 | 621 | n, m = list(map(int, input().split()))
g = [[-1] * n for _ in range(m)]
for i in range(m):
s = list(map(int, input().split()))
s.pop(0)
for j in s:
g[i][j - 1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
switch = [0] * n
for j in range(n):
if (i >> j) & 1:
... | def main():
n, m = list(map(int, input().split()))
g = [[-1] * n for _ in range(m)]
for i in range(m):
s = list(map(int, input().split()))
for j in s[1:]:
g[i][j - 1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
s = [0] * n
for... | false | 9.677419 | [
"-n, m = list(map(int, input().split()))",
"-g = [[-1] * n for _ in range(m)]",
"-for i in range(m):",
"- s = list(map(int, input().split()))",
"- s.pop(0)",
"- for j in s:",
"- g[i][j - 1] = 1",
"-p = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(2**n):",
"- ... | false | 0.050925 | 0.050041 | 1.017651 | [
"s008999672",
"s568213004"
] |
u391819434 | p03556 | python | s724826699 | s199527983 | 47 | 43 | 3,316 | 3,188 | Accepted | Accepted | 8.51 | N=int(eval(input()))
while N:
if N**0.5%1==0:
print(N)
break
else:
N-=1 | N=int(eval(input()))
while N:
if N**0.5%1==0:print(N);break
N-=1 | 7 | 4 | 103 | 69 | N = int(eval(input()))
while N:
if N**0.5 % 1 == 0:
print(N)
break
else:
N -= 1
| N = int(eval(input()))
while N:
if N**0.5 % 1 == 0:
print(N)
break
N -= 1
| false | 42.857143 | [
"- else:",
"- N -= 1",
"+ N -= 1"
] | false | 0.04352 | 0.039705 | 1.096092 | [
"s724826699",
"s199527983"
] |
u497952650 | p02702 | python | s233795920 | s892410842 | 340 | 313 | 15,992 | 9,392 | Accepted | Accepted | 7.94 | S = input()[::-1]
P = [0]*(len(S)+1)
for i,j in enumerate((S)):
P[i+1] = (P[i] + int(j)*pow(10,i,2019))%2019
dp = [0]*2019
for i in P:
dp[i%2019] += 1
print((sum([i*(i-1)//2 for i in dp]))) | S = input()[::-1]
mods = [0]*2019
mods[0] += 1
f = 0
for i in range(len(S)):
f = (f+pow(10,i,2019)*int(S[i]))%2019
mods[f] += 1
print((sum([i*(i-1)//2 for i in mods]))) | 9 | 10 | 205 | 185 | S = input()[::-1]
P = [0] * (len(S) + 1)
for i, j in enumerate((S)):
P[i + 1] = (P[i] + int(j) * pow(10, i, 2019)) % 2019
dp = [0] * 2019
for i in P:
dp[i % 2019] += 1
print((sum([i * (i - 1) // 2 for i in dp])))
| S = input()[::-1]
mods = [0] * 2019
mods[0] += 1
f = 0
for i in range(len(S)):
f = (f + pow(10, i, 2019) * int(S[i])) % 2019
mods[f] += 1
print((sum([i * (i - 1) // 2 for i in mods])))
| false | 10 | [
"-P = [0] * (len(S) + 1)",
"-for i, j in enumerate((S)):",
"- P[i + 1] = (P[i] + int(j) * pow(10, i, 2019)) % 2019",
"-dp = [0] * 2019",
"-for i in P:",
"- dp[i % 2019] += 1",
"-print((sum([i * (i - 1) // 2 for i in dp])))",
"+mods = [0] * 2019",
"+mods[0] += 1",
"+f = 0",
"+for i in range... | false | 0.079817 | 0.040941 | 1.949573 | [
"s233795920",
"s892410842"
] |
u387774811 | p02788 | python | s929056153 | s008818951 | 1,822 | 839 | 59,864 | 77,776 | Accepted | Accepted | 53.95 | import sys
input = sys.stdin.readline
def nibun_right(a, x):
lo, hi = 0, len(a)
while lo < hi:
mid = (lo+hi)//2
if x < a[mid][0]: hi = mid
else: lo = mid+1
return lo
N,D,A=list(map(int,input().split()))
lst=[0]*N
for i in range(N):
lst[i]=list(map(int,input().split()))
lst[i][1]=int((lst[i][1]-1... | import sys
from operator import itemgetter
input = sys.stdin.readline
def nibun_right(a, x):
lo, hi = 0, len(a)
while lo < hi:
mid = (lo+hi)//2
if x < a[mid][0]: hi = mid
else: lo = mid+1
return lo
N,D,A=list(map(int,input().split()))
lst=[0]*N
for i in range(N):
lst[i]=list(map(int,input().split... | 25 | 26 | 510 | 560 | import sys
input = sys.stdin.readline
def nibun_right(a, x):
lo, hi = 0, len(a)
while lo < hi:
mid = (lo + hi) // 2
if x < a[mid][0]:
hi = mid
else:
lo = mid + 1
return lo
N, D, A = list(map(int, input().split()))
lst = [0] * N
for i in range(N):
lst[... | import sys
from operator import itemgetter
input = sys.stdin.readline
def nibun_right(a, x):
lo, hi = 0, len(a)
while lo < hi:
mid = (lo + hi) // 2
if x < a[mid][0]:
hi = mid
else:
lo = mid + 1
return lo
N, D, A = list(map(int, input().split()))
lst = [0]... | false | 3.846154 | [
"+from operator import itemgetter",
"-lst.sort()",
"+lst.sort(key=itemgetter(0))"
] | false | 0.257406 | 0.074143 | 3.471762 | [
"s929056153",
"s008818951"
] |
u342869120 | p02608 | python | s239811721 | s190699661 | 1,351 | 111 | 69,868 | 69,252 | Accepted | Accepted | 91.78 | import math
N = int(eval(input()))
for n in range(1, N+1):
nn = int(n**0.5+1)
ans = 0
for x in range(1, nn):
for y in range(1, nn):
d = n-x*x-y*y-x*y
if d < 0:
break
l, r = 0, nn
while (r-l) > 1:
m = (r+l)//2... | N = int(eval(input()))
a = [0]*(N+1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
d = x*x+y*y+z*z+x*y+y*z+x*z
if d <= N:
a[d] += 1
for i in range(1, N+1):
print((a[i]))
| 22 | 10 | 555 | 253 | import math
N = int(eval(input()))
for n in range(1, N + 1):
nn = int(n**0.5 + 1)
ans = 0
for x in range(1, nn):
for y in range(1, nn):
d = n - x * x - y * y - x * y
if d < 0:
break
l, r = 0, nn
while (r - l) > 1:
m = (... | N = int(eval(input()))
a = [0] * (N + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
d = x * x + y * y + z * z + x * y + y * z + x * z
if d <= N:
a[d] += 1
for i in range(1, N + 1):
print((a[i]))
| false | 54.545455 | [
"-import math",
"-",
"-for n in range(1, N + 1):",
"- nn = int(n**0.5 + 1)",
"- ans = 0",
"- for x in range(1, nn):",
"- for y in range(1, nn):",
"- d = n - x * x - y * y - x * y",
"- if d < 0:",
"- break",
"- l, r = 0, nn",
"- ... | false | 0.054292 | 0.741585 | 0.073211 | [
"s239811721",
"s190699661"
] |
u821624310 | p02402 | python | s818004591 | s195173807 | 30 | 20 | 8,288 | 8,580 | Accepted | Accepted | 33.33 | N = int(eval(input()))
a = input().split()
min = 1000000
max = -1000000
kei = 0
for i in a:
i = int(i)
if i < min:
min = i
if i > max:
max = i
kei += i
print((min, max, kei)) | n = int(eval(input()))
a = list(map(int, input().split()))
min_a = 1000000
max_a = -1000000
sum_a = 0
for i in range(n):
if min_a > a[i]:
min_a = a[i]
if max_a < a[i]:
max_a = a[i]
sum_a += a[i]
print((min_a, max_a, sum_a)) | 13 | 15 | 210 | 264 | N = int(eval(input()))
a = input().split()
min = 1000000
max = -1000000
kei = 0
for i in a:
i = int(i)
if i < min:
min = i
if i > max:
max = i
kei += i
print((min, max, kei))
| n = int(eval(input()))
a = list(map(int, input().split()))
min_a = 1000000
max_a = -1000000
sum_a = 0
for i in range(n):
if min_a > a[i]:
min_a = a[i]
if max_a < a[i]:
max_a = a[i]
sum_a += a[i]
print((min_a, max_a, sum_a))
| false | 13.333333 | [
"-N = int(eval(input()))",
"-a = input().split()",
"-min = 1000000",
"-max = -1000000",
"-kei = 0",
"-for i in a:",
"- i = int(i)",
"- if i < min:",
"- min = i",
"- if i > max:",
"- max = i",
"- kei += i",
"-print((min, max, kei))",
"+n = int(eval(input()))",
"+... | false | 0.050587 | 0.04932 | 1.025676 | [
"s818004591",
"s195173807"
] |
u256464928 | p03698 | python | s724873170 | s873276264 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | s = eval(input())
print(("yes" if len(s)==len(list(set(s))) else "no")) | s = eval(input())
print(("yes" if len(s)==len(set(s)) else "no")) | 2 | 2 | 64 | 58 | s = eval(input())
print(("yes" if len(s) == len(list(set(s))) else "no"))
| s = eval(input())
print(("yes" if len(s) == len(set(s)) else "no"))
| false | 0 | [
"-print((\"yes\" if len(s) == len(list(set(s))) else \"no\"))",
"+print((\"yes\" if len(s) == len(set(s)) else \"no\"))"
] | false | 0.100871 | 0.046672 | 2.161279 | [
"s724873170",
"s873276264"
] |
u254871849 | p02732 | python | s654195421 | s252483483 | 1,977 | 341 | 26,828 | 28,416 | Accepted | Accepted | 82.75 | import sys
from collections import Counter
def comb(n, r):
if r > n:
return 0
r = min(r, n - r)
if r == 0: return 1
if r == 1: return n
numerator = list(range(n-r+1, n+1))
denominator = list(range(1, r+1))
for p in range(2,r+1):
pivot = denominator[p - 1]
... | import sys
from collections import Counter
def comb(n):
return n * (n - 1) // 2
n, *a = map(int, sys.stdin.read().split())
def main():
c = Counter(a)
res = 0
for v in c.values():
res += comb(v)
for i in a:
yield res - comb(c[i]) + comb(c[i]-1)
if __name_... | 38 | 20 | 928 | 381 | import sys
from collections import Counter
def comb(n, r):
if r > n:
return 0
r = min(r, n - r)
if r == 0:
return 1
if r == 1:
return n
numerator = list(range(n - r + 1, n + 1))
denominator = list(range(1, r + 1))
for p in range(2, r + 1):
pivot = denominato... | import sys
from collections import Counter
def comb(n):
return n * (n - 1) // 2
n, *a = map(int, sys.stdin.read().split())
def main():
c = Counter(a)
res = 0
for v in c.values():
res += comb(v)
for i in a:
yield res - comb(c[i]) + comb(c[i] - 1)
if __name__ == "__main__":
... | false | 47.368421 | [
"-def comb(n, r):",
"- if r > n:",
"- return 0",
"- r = min(r, n - r)",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return n",
"- numerator = list(range(n - r + 1, n + 1))",
"- denominator = list(range(1, r + 1))",
"- for p in range(2, r + 1):",
"... | false | 0.068683 | 0.084007 | 0.817579 | [
"s654195421",
"s252483483"
] |
u525423408 | p03624 | python | s193494876 | s466306048 | 28 | 19 | 3,836 | 3,188 | Accepted | Accepted | 32.14 | import string
a = set(string.ascii_lowercase) - set(eval(input()))
if a == set():
print("None")
else:
print((min(a))) | a = set("abcdefghijklmnopqrstuvwxyz") - set(eval(input()))
if a == set():
print("None")
else:
print((min(a))) | 6 | 5 | 122 | 113 | import string
a = set(string.ascii_lowercase) - set(eval(input()))
if a == set():
print("None")
else:
print((min(a)))
| a = set("abcdefghijklmnopqrstuvwxyz") - set(eval(input()))
if a == set():
print("None")
else:
print((min(a)))
| false | 16.666667 | [
"-import string",
"-",
"-a = set(string.ascii_lowercase) - set(eval(input()))",
"+a = set(\"abcdefghijklmnopqrstuvwxyz\") - set(eval(input()))"
] | false | 0.046497 | 0.039256 | 1.18445 | [
"s193494876",
"s466306048"
] |
u297574184 | p03031 | python | s305979398 | s829099913 | 34 | 28 | 3,064 | 3,064 | Accepted | Accepted | 17.65 | from itertools import product
N, M = list(map(int, input().split()))
sss = []
for _ in range(M):
k, *ss = list(map(int, input().split()))
sss.append(ss)
ps = list(map(int, input().split()))
ans = 0
for ptn in product(list(range(2)), repeat=N):
numL = 0
for ss, p in zip(sss, ps):
n... | N, M = list(map(int, input().split()))
switchss = []
for _ in range(M):
k, *sws = list(map(int, input().split()))
switchss.append([sw-1 for sw in sws])
ps = list(map(int, input().split()))
ans = 0
for S in range(1<<N):
for i in range(M):
num = 0
for sw in switchss[i]:
... | 22 | 20 | 464 | 442 | from itertools import product
N, M = list(map(int, input().split()))
sss = []
for _ in range(M):
k, *ss = list(map(int, input().split()))
sss.append(ss)
ps = list(map(int, input().split()))
ans = 0
for ptn in product(list(range(2)), repeat=N):
numL = 0
for ss, p in zip(sss, ps):
numON = 0
... | N, M = list(map(int, input().split()))
switchss = []
for _ in range(M):
k, *sws = list(map(int, input().split()))
switchss.append([sw - 1 for sw in sws])
ps = list(map(int, input().split()))
ans = 0
for S in range(1 << N):
for i in range(M):
num = 0
for sw in switchss[i]:
if (S >... | false | 9.090909 | [
"-from itertools import product",
"-",
"-sss = []",
"+switchss = []",
"- k, *ss = list(map(int, input().split()))",
"- sss.append(ss)",
"+ k, *sws = list(map(int, input().split()))",
"+ switchss.append([sw - 1 for sw in sws])",
"-for ptn in product(list(range(2)), repeat=N):",
"- nu... | false | 0.048942 | 0.048063 | 1.01829 | [
"s305979398",
"s829099913"
] |
u875291233 | p03221 | python | s310888253 | s840867895 | 1,168 | 937 | 24,820 | 73,492 | Accepted | Accepted | 19.78 | # coding: utf-8
# Your code here!
from bisect import bisect_left
n,m = [int(i) for i in input().split()]
py = [[int(i) for i in input().split()] for _ in range(m)]
spy = list(sorted(py))
for p,y in py:
l2 = bisect_left(spy,[p,y])
l1 = bisect_left(spy,[p,0])
print((format(p, '06')+format(l2-... | # coding: utf-8
# Your code here!
n,m = [int(i) for i in input().split()]
py = [[int(i) for i in input().split()] for _ in range(m)]
spy = list(sorted(py+[[p,0] for p in range(n+1)]))
zaatu = {(p,y):i for i, (p,y) in enumerate(spy)}
for p,y in py:
print((format(p, '06')+format(zaatu[(p,y)]-zaatu[(p... | 14 | 13 | 331 | 332 | # coding: utf-8
# Your code here!
from bisect import bisect_left
n, m = [int(i) for i in input().split()]
py = [[int(i) for i in input().split()] for _ in range(m)]
spy = list(sorted(py))
for p, y in py:
l2 = bisect_left(spy, [p, y])
l1 = bisect_left(spy, [p, 0])
print((format(p, "06") + format(l2 - l1 + 1... | # coding: utf-8
# Your code here!
n, m = [int(i) for i in input().split()]
py = [[int(i) for i in input().split()] for _ in range(m)]
spy = list(sorted(py + [[p, 0] for p in range(n + 1)]))
zaatu = {(p, y): i for i, (p, y) in enumerate(spy)}
for p, y in py:
print((format(p, "06") + format(zaatu[(p, y)] - zaatu[(p, ... | false | 7.142857 | [
"-from bisect import bisect_left",
"-",
"-spy = list(sorted(py))",
"+spy = list(sorted(py + [[p, 0] for p in range(n + 1)]))",
"+zaatu = {(p, y): i for i, (p, y) in enumerate(spy)}",
"- l2 = bisect_left(spy, [p, y])",
"- l1 = bisect_left(spy, [p, 0])",
"- print((format(p, \"06\") + format(l2 ... | false | 0.04844 | 0.048647 | 0.995743 | [
"s310888253",
"s840867895"
] |
u968166680 | p02695 | python | s796032300 | s483034870 | 660 | 338 | 9,288 | 9,252 | Accepted | Accepted | 48.79 | from sys import stdin
def input():
return stdin.readline().strip()
def main():
N, M, Q = list(map(int, input().split()))
a, b, c, d = [0] * Q, [0] * Q, [0] * Q, [0] * Q
for i in range(Q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
a[i] -= 1
b[i] -= ... | from sys import stdin
def input():
return stdin.readline().strip()
def main():
N, M, Q = list(map(int, input().split()))
a, b, c, d = [0] * Q, [0] * Q, [0] * Q, [0] * Q
for i in range(Q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
a[i] -= 1
b[i] -= ... | 40 | 40 | 837 | 838 | from sys import stdin
def input():
return stdin.readline().strip()
def main():
N, M, Q = list(map(int, input().split()))
a, b, c, d = [0] * Q, [0] * Q, [0] * Q, [0] * Q
for i in range(Q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
a[i] -= 1
b[i] -= 1
ans = 0... | from sys import stdin
def input():
return stdin.readline().strip()
def main():
N, M, Q = list(map(int, input().split()))
a, b, c, d = [0] * Q, [0] * Q, [0] * Q, [0] * Q
for i in range(Q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
a[i] -= 1
b[i] -= 1
ans = 0... | false | 0 | [
"- dfs([])",
"+ dfs([1])"
] | false | 0.050831 | 0.04214 | 1.206252 | [
"s796032300",
"s483034870"
] |
u297574184 | p03039 | python | s623187898 | s542595329 | 222 | 121 | 10,868 | 3,064 | Accepted | Accepted | 45.5 | MOD = 10**9 + 7
N, M, K = list(map(int, input().split()))
invs = [1] * (K-1)
for x in range(2, K-1):
invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
C = 1
for x in range(N*M-K+1, N*M-1):
C *= x
C %= MOD
for x in range(1, K-1):
C *= invs[x]
C %= MOD
ans1 = 0
for d in range(1, N):
... | MOD = 10**9 + 7
N, M, K = list(map(int, input().split()))
def getComb(n, k, MOD):
if n < k:
return 0
if n-k < k:
k = n-k
comb = 1
for x in range(n-k+1, n+1):
comb = (comb * x) % MOD
d = 1
for x in range(1, k+1):
d = (d * x) % MOD
comb *= pow(d... | 31 | 33 | 510 | 560 | MOD = 10**9 + 7
N, M, K = list(map(int, input().split()))
invs = [1] * (K - 1)
for x in range(2, K - 1):
invs[x] = (-(MOD // x) * invs[MOD % x]) % MOD
C = 1
for x in range(N * M - K + 1, N * M - 1):
C *= x
C %= MOD
for x in range(1, K - 1):
C *= invs[x]
C %= MOD
ans1 = 0
for d in range(1, N):
an... | MOD = 10**9 + 7
N, M, K = list(map(int, input().split()))
def getComb(n, k, MOD):
if n < k:
return 0
if n - k < k:
k = n - k
comb = 1
for x in range(n - k + 1, n + 1):
comb = (comb * x) % MOD
d = 1
for x in range(1, k + 1):
d = (d * x) % MOD
comb *= pow(d, M... | false | 6.060606 | [
"-invs = [1] * (K - 1)",
"-for x in range(2, K - 1):",
"- invs[x] = (-(MOD // x) * invs[MOD % x]) % MOD",
"-C = 1",
"-for x in range(N * M - K + 1, N * M - 1):",
"- C *= x",
"- C %= MOD",
"-for x in range(1, K - 1):",
"- C *= invs[x]",
"- C %= MOD",
"-ans1 = 0",
"-for d in range... | false | 0.036303 | 0.034582 | 1.049787 | [
"s623187898",
"s542595329"
] |
u313291636 | p02713 | python | s076972331 | s442285743 | 1,315 | 509 | 9,152 | 67,560 | Accepted | Accepted | 61.29 | import math
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
sum1 = math.gcd(i , j)
for l in range(1, k + 1):
sum += math.gcd(sum1, l)
print(sum)
| import math
k = int(eval(input()))
sum = 0
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += math.gcd(math.gcd(a, b), c)
print(ans) | 11 | 12 | 218 | 206 | import math
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
sum1 = math.gcd(i, j)
for l in range(1, k + 1):
sum += math.gcd(sum1, l)
print(sum)
| import math
k = int(eval(input()))
sum = 0
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += math.gcd(math.gcd(a, b), c)
print(ans)
| false | 8.333333 | [
"-for i in range(1, k + 1):",
"- for j in range(1, k + 1):",
"- sum1 = math.gcd(i, j)",
"- for l in range(1, k + 1):",
"- sum += math.gcd(sum1, l)",
"-print(sum)",
"+ans = 0",
"+for a in range(1, k + 1):",
"+ for b in range(1, k + 1):",
"+ for c in range(1, k ... | false | 0.116243 | 0.208701 | 0.556983 | [
"s076972331",
"s442285743"
] |
u102461423 | p02680 | python | s047235556 | s259778561 | 2,488 | 1,282 | 227,780 | 172,988 | Accepted | Accepted | 48.47 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
N, M = list(map(int, readline().split()))
data = np.array(read().split(), np.int64)
A = data[::3]
B = data[1::3]
C = data[2::3]
... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
N, M = list(map(int, readline().split()))
data = np.array(read().split(), np.int64)
A = data[::3]
B = data[1::3]
C = data[2::3]
... | 122 | 105 | 2,537 | 2,140 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
N, M = list(map(int, readline().split()))
data = np.array(read().split(), np.int64)
A = data[::3]
B = data[1::3]
C = data[2::3]
D = A[N:]
E = B[N... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
N, M = list(map(int, readline().split()))
data = np.array(read().split(), np.int64)
A = data[::3]
B = data[1::3]
C = data[2::3]
D = A[N:]
E = B[N... | false | 13.934426 | [
"- p = 0",
"- head = np.full(N, -1, np.int32)",
"- ng = np.empty(4 * N, np.int32)",
"- nxt = np.empty(4 * N, np.int32)",
"-",
"- def add(v, w):",
"- nonlocal p",
"- nxt[p] = head[v]",
"- head[v] = p",
"- ng[p] = w",
"- p += 1",
"-",
"+ ng ... | false | 0.394832 | 0.284466 | 1.387976 | [
"s047235556",
"s259778561"
] |
u047796752 | p03433 | python | s353563409 | s763360061 | 179 | 60 | 38,384 | 61,716 | Accepted | Accepted | 66.48 | N = int(eval(input()))
A = int(eval(input()))
for i in range(A+1):
if (N-i)%500==0:
print('Yes')
break
else:
print('No') | N = int(eval(input()))
A = int(eval(input()))
print(('Yes' if N%500<=A else 'No'))
| 9 | 3 | 141 | 71 | N = int(eval(input()))
A = int(eval(input()))
for i in range(A + 1):
if (N - i) % 500 == 0:
print("Yes")
break
else:
print("No")
| N = int(eval(input()))
A = int(eval(input()))
print(("Yes" if N % 500 <= A else "No"))
| false | 66.666667 | [
"-for i in range(A + 1):",
"- if (N - i) % 500 == 0:",
"- print(\"Yes\")",
"- break",
"-else:",
"- print(\"No\")",
"+print((\"Yes\" if N % 500 <= A else \"No\"))"
] | false | 0.036213 | 0.111271 | 0.32545 | [
"s353563409",
"s763360061"
] |
u729133443 | p03987 | python | s548310108 | s235952776 | 1,190 | 825 | 25,884 | 25,884 | Accepted | Accepted | 30.67 | from bisect import*
class BTreeNode:
def __init__(self):self.key,self.child=[],[]
class BTree:
def __init__(self):self.root=BTreeNode()
def search_higher(self,key):
ptr=self.root
ret=None
while ptr.child:
i=bisect(ptr.key,key)
if i!=len(ptr.key):ret=... | from bisect import*
class SqrtSet:
def __init__(self,block_limit=201):
self.key=[]
self.child=[[]]
self.block_limit=block_limit
def search_lower(self,key):
if not key:return None
ret=None
i=bisect_left(self.key,key)
if i:ret=self.key[i-1]
... | 68 | 46 | 2,223 | 1,330 | from bisect import *
class BTreeNode:
def __init__(self):
self.key, self.child = [], []
class BTree:
def __init__(self):
self.root = BTreeNode()
def search_higher(self, key):
ptr = self.root
ret = None
while ptr.child:
i = bisect(ptr.key, key)
... | from bisect import *
class SqrtSet:
def __init__(self, block_limit=201):
self.key = []
self.child = [[]]
self.block_limit = block_limit
def search_lower(self, key):
if not key:
return None
ret = None
i = bisect_left(self.key, key)
if i:
... | false | 32.352941 | [
"-class BTreeNode:",
"- def __init__(self):",
"- self.key, self.child = [], []",
"+class SqrtSet:",
"+ def __init__(self, block_limit=201):",
"+ self.key = []",
"+ self.child = [[]]",
"+ self.block_limit = block_limit",
"-",
"-class BTree:",
"- def __init__(s... | false | 0.037468 | 0.035994 | 1.040929 | [
"s548310108",
"s235952776"
] |
u401452016 | p03161 | python | s394246123 | s561349006 | 464 | 418 | 57,052 | 56,540 | Accepted | Accepted | 9.91 | import sys
n, K = list(map(int, sys.stdin.readline().split()))
H = list(map(int, sys.stdin.readline().split()))
p = [float('inf') for _ in range(n)]
p[0] = 0
for i in range(1, n):
for k in range(1, K+1):
if i-k >=0:
tmp = abs(H[i]-H[i-k]) + p[i-k]
if p[i] > tmp:
... | #EDP-B
import sys
n, K = list(map(int, sys.stdin.readline().split()))
H = list(map(int, sys.stdin.readline().split()))
dp = [0 for i in range(n)]
#初期条件
for i in range(1, n):
dp[i] = abs(H[i]-H[i-1]) + dp[i-1]
#print(dp)
for i in range(2, n):
for k in range(1, K+1):
if i-k>=0:
dp[... | 14 | 16 | 347 | 405 | import sys
n, K = list(map(int, sys.stdin.readline().split()))
H = list(map(int, sys.stdin.readline().split()))
p = [float("inf") for _ in range(n)]
p[0] = 0
for i in range(1, n):
for k in range(1, K + 1):
if i - k >= 0:
tmp = abs(H[i] - H[i - k]) + p[i - k]
if p[i] > tmp:
... | # EDP-B
import sys
n, K = list(map(int, sys.stdin.readline().split()))
H = list(map(int, sys.stdin.readline().split()))
dp = [0 for i in range(n)]
# 初期条件
for i in range(1, n):
dp[i] = abs(H[i] - H[i - 1]) + dp[i - 1]
# print(dp)
for i in range(2, n):
for k in range(1, K + 1):
if i - k >= 0:
... | false | 12.5 | [
"+# EDP-B",
"-p = [float(\"inf\") for _ in range(n)]",
"-p[0] = 0",
"+dp = [0 for i in range(n)]",
"+# 初期条件",
"+ dp[i] = abs(H[i] - H[i - 1]) + dp[i - 1]",
"+# print(dp)",
"+for i in range(2, n):",
"- tmp = abs(H[i] - H[i - k]) + p[i - k]",
"- if p[i] > tmp:",
"- ... | false | 0.042772 | 0.041766 | 1.024068 | [
"s394246123",
"s561349006"
] |
u562935282 | p03240 | python | s735862993 | s611685266 | 132 | 61 | 3,064 | 3,064 | Accepted | Accepted | 53.79 | def solve(xyhs):
for cx in range(100 + 1):
for cy in range(100 + 1):
cand = None
for x, y, h in [xyh for xyh in xyhs if xyh[2] != 0]:
t = h + abs(x - cx) + abs(y - cy)
if cand is None:
cand = t
elif cand != t... | def solve():
for cx in range(100 + 1):
for cy in range(100 + 1):
h_cand = None
for x, y, h in xyh:
if h == 0:
continue
h_calced = h + abs(x - cx) + abs(y - cy)
if (h_cand is None) or (h_cand == h_calced):
... | 24 | 35 | 729 | 936 | def solve(xyhs):
for cx in range(100 + 1):
for cy in range(100 + 1):
cand = None
for x, y, h in [xyh for xyh in xyhs if xyh[2] != 0]:
t = h + abs(x - cx) + abs(y - cy)
if cand is None:
cand = t
elif cand != t:
... | def solve():
for cx in range(100 + 1):
for cy in range(100 + 1):
h_cand = None
for x, y, h in xyh:
if h == 0:
continue
h_calced = h + abs(x - cx) + abs(y - cy)
if (h_cand is None) or (h_cand == h_calced):
... | false | 31.428571 | [
"-def solve(xyhs):",
"+def solve():",
"- cand = None",
"- for x, y, h in [xyh for xyh in xyhs if xyh[2] != 0]:",
"- t = h + abs(x - cx) + abs(y - cy)",
"- if cand is None:",
"- cand = t",
"- elif cand != t:",
"+ ... | false | 0.047094 | 0.050568 | 0.931291 | [
"s735862993",
"s611685266"
] |
u820351940 | p03643 | python | s947466359 | s033895671 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
result = "ABC" + s
print(result) | print(("ABC" + eval(input()))) | 3 | 1 | 46 | 22 | s = eval(input())
result = "ABC" + s
print(result)
| print(("ABC" + eval(input())))
| false | 66.666667 | [
"-s = eval(input())",
"-result = \"ABC\" + s",
"-print(result)",
"+print((\"ABC\" + eval(input())))"
] | false | 0.050417 | 0.050699 | 0.994442 | [
"s947466359",
"s033895671"
] |
u260216890 | p02775 | python | s258427836 | s061255690 | 1,623 | 1,144 | 83,240 | 5,492 | Accepted | Accepted | 29.51 | N=eval(input())
dp0=[0]*(len(N)+1)
dp1=[0]*(len(N)+1)
dp1[0]=1
for i in range(len(N)):
n=int(N[i])
dp0[i+1]=min(dp0[i]+n, dp1[i]+(10-n))
n+=1
dp1[i+1]=min(dp0[i]+n, dp1[i]+(10-n))
#print(dp0)
#print(dp1)
print((dp0[-1]))
| N = eval(input())
dp0 = 0
dp1 = 1
for n in N:
n = int(n)
dp0_new = min(dp0 + n, dp1 + (10 - n))
n = n + 1 #繰り上げさせてる
dp1_new = min(dp0 + n, dp1 + (10 - n))
dp0, dp1 = dp0_new, dp1_new
print(dp0) | 15 | 13 | 246 | 227 | N = eval(input())
dp0 = [0] * (len(N) + 1)
dp1 = [0] * (len(N) + 1)
dp1[0] = 1
for i in range(len(N)):
n = int(N[i])
dp0[i + 1] = min(dp0[i] + n, dp1[i] + (10 - n))
n += 1
dp1[i + 1] = min(dp0[i] + n, dp1[i] + (10 - n))
# print(dp0)
# print(dp1)
print((dp0[-1]))
| N = eval(input())
dp0 = 0
dp1 = 1
for n in N:
n = int(n)
dp0_new = min(dp0 + n, dp1 + (10 - n))
n = n + 1 # 繰り上げさせてる
dp1_new = min(dp0 + n, dp1 + (10 - n))
dp0, dp1 = dp0_new, dp1_new
print(dp0)
| false | 13.333333 | [
"-dp0 = [0] * (len(N) + 1)",
"-dp1 = [0] * (len(N) + 1)",
"-dp1[0] = 1",
"-for i in range(len(N)):",
"- n = int(N[i])",
"- dp0[i + 1] = min(dp0[i] + n, dp1[i] + (10 - n))",
"- n += 1",
"- dp1[i + 1] = min(dp0[i] + n, dp1[i] + (10 - n))",
"-# print(dp0)",
"-# print(dp1)",
"-print((dp0... | false | 0.037798 | 0.038392 | 0.984525 | [
"s258427836",
"s061255690"
] |
u073852194 | p03600 | python | s746400003 | s314389636 | 1,249 | 577 | 46,300 | 92,960 | Accepted | Accepted | 53.8 | N = int(eval(input()))
A = [list(map(int,input().split())) for i in range(N)]
for k in range(N):
for i in range(N):
for j in range(N):
if A[i][j] > A[i][k]+A[k][j]:
print((-1))
exit()
ans = 0
for i in range(N):
for j in range(N):
if all(... | class Graph(): #non-directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.edge = edge
self.indexed = indexed
self.graph = [[] for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
self.graph[e[1... | 17 | 61 | 433 | 1,708 | N = int(eval(input()))
A = [list(map(int, input().split())) for i in range(N)]
for k in range(N):
for i in range(N):
for j in range(N):
if A[i][j] > A[i][k] + A[k][j]:
print((-1))
exit()
ans = 0
for i in range(N):
for j in range(N):
if all([A[i][j] < A... | class Graph: # non-directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.edge = edge
self.indexed = indexed
self.graph = [[] for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
self.graph[e[1] - index... | false | 72.131148 | [
"+class Graph: # non-directed",
"+ def __init__(self, n, edge, indexed=1):",
"+ self.n = n",
"+ self.edge = edge",
"+ self.indexed = indexed",
"+ self.graph = [[] for _ in range(n)]",
"+ for e in edge:",
"+ self.graph[e[0] - indexed].append((e[1] - ind... | false | 0.047825 | 0.047827 | 0.99996 | [
"s746400003",
"s314389636"
] |
u070201429 | p02839 | python | s307055567 | s437644257 | 1,366 | 922 | 272,660 | 249,340 | Accepted | Accepted | 32.5 | def main():
from sys import stdin
def input():
return stdin.readline().strip()
h, w = list(map(int, input().split()))
g = []
for _ in range(h):
g.append(list(map(int, input().split())))
for i in range(h):
k = list(map(int, input().split()))
for j in ra... | def main():
from sys import stdin
def input():
return stdin.readline().strip()
h, w = list(map(int, input().split()))
g = []
for _ in range(h):
g.append(list(map(int, input().split())))
for i in range(h):
k = list(map(int, input().split()))
for j in ra... | 48 | 57 | 1,271 | 1,514 | def main():
from sys import stdin
def input():
return stdin.readline().strip()
h, w = list(map(int, input().split()))
g = []
for _ in range(h):
g.append(list(map(int, input().split())))
for i in range(h):
k = list(map(int, input().split()))
for j in range(w):
... | def main():
from sys import stdin
def input():
return stdin.readline().strip()
h, w = list(map(int, input().split()))
g = []
for _ in range(h):
g.append(list(map(int, input().split())))
for i in range(h):
k = list(map(int, input().split()))
for j in range(w):
... | false | 15.789474 | [
"- m = (h + w) * 80",
"+ m = (h + w) * 50",
"- dp[j][k + g[0][j]] = True",
"+ try:",
"+ dp[j][k + g[0][j]] = True",
"+ except:",
"+ pass",
"- new_dp[0][k + g[i][0]] = True",
"+ try:... | false | 0.04703 | 0.047083 | 0.998884 | [
"s307055567",
"s437644257"
] |
u620084012 | p03222 | python | s794941896 | s084713447 | 249 | 199 | 46,572 | 41,712 | Accepted | Accepted | 20.08 | # ABC 113 D
MOD = 7 + 10**9
H, W, K = list(map(int,input().split()))
dp = [[0 for k in range(W)] for l in range(H+1)]
dp[0][0] = 1
for i in range(H):
for j in range(W):
for k in range(1<<(W-1)):
f = 1
for l in range(W-2):
if (k>>l)&1 and (k>>(l+1))&1:
... | MOD = 10**9 + 7
H, W, K = list(map(int,input().split()))
dp = [[0 for k in range(W)] for l in range(H+1)]
dp[0][0] = 1
A = [] # ありうる横棒のリスト
for b in range(2**(W-1)):
if "11" not in bin(b):
A.append(bin(b)[2:].zfill(W-1))
for k in range(H):
for e in A:
for i in range(W):
... | 25 | 23 | 745 | 681 | # ABC 113 D
MOD = 7 + 10**9
H, W, K = list(map(int, input().split()))
dp = [[0 for k in range(W)] for l in range(H + 1)]
dp[0][0] = 1
for i in range(H):
for j in range(W):
for k in range(1 << (W - 1)):
f = 1
for l in range(W - 2):
if (k >> l) & 1 and (k >> (l + 1)) & ... | MOD = 10**9 + 7
H, W, K = list(map(int, input().split()))
dp = [[0 for k in range(W)] for l in range(H + 1)]
dp[0][0] = 1
A = [] # ありうる横棒のリスト
for b in range(2 ** (W - 1)):
if "11" not in bin(b):
A.append(bin(b)[2:].zfill(W - 1))
for k in range(H):
for e in A:
for i in range(W):
if i... | false | 8 | [
"-# ABC 113 D",
"-MOD = 7 + 10**9",
"+MOD = 10**9 + 7",
"-for i in range(H):",
"- for j in range(W):",
"- for k in range(1 << (W - 1)):",
"- f = 1",
"- for l in range(W - 2):",
"- if (k >> l) & 1 and (k >> (l + 1)) & 1:",
"- f = 0",... | false | 0.050909 | 0.037343 | 1.36329 | [
"s794941896",
"s084713447"
] |
u380772254 | p03281 | python | s097270269 | s049247579 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | def divisors(n, sort=False):
"""
nの約数をO(√n)で列挙する
"""
d = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
d.append(i)
if i != n // i:
d.append(n//i)
if sort:
d.sort()
return d
N = int(eval(input()))
cnt = 0
f... | def divisors(n, sort=False):
"""
nの約数をO(√n)で列挙する
"""
d = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
d.append(i)
if i != n // i:
d.append(n//i)
if sort:
d.sort()
return d
N = int(eval(input()))
cnt = 0
f... | 25 | 23 | 439 | 405 | def divisors(n, sort=False):
"""
nの約数をO(√n)で列挙する
"""
d = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
d.append(i)
if i != n // i:
d.append(n // i)
if sort:
d.sort()
return d
N = int(eval(input()))
cnt = 0
for i in range(1, N ... | def divisors(n, sort=False):
"""
nの約数をO(√n)で列挙する
"""
d = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
d.append(i)
if i != n // i:
d.append(n // i)
if sort:
d.sort()
return d
N = int(eval(input()))
cnt = 0
for i in range(1, N ... | false | 8 | [
"-for i in range(1, N + 1):",
"- if i % 2 == 0:",
"- continue",
"+for i in range(1, N + 1, 2):"
] | false | 0.043187 | 0.085456 | 0.505374 | [
"s097270269",
"s049247579"
] |
u641604021 | p02700 | python | s215264370 | s748294828 | 24 | 20 | 9,068 | 9,048 | Accepted | Accepted | 16.67 | # This Python file uses the following encoding: utf-8
# if __name__ == "__main__":
# pass
a, b, c, d = list(map(int, input().split()))
'''
while a > 0 and c > 0:
c -= b
a -= d
if c <= 0:
print("Yes")
else:
print("No")
'''
if -(-c//b) <= -(-a//d):
print("Yes")
else:
print("... | a, b, c, d = list(map(int, input().split()))
if -(-c//b) <= -(-a//d):
print("Yes")
else:
print("No")
| 18 | 6 | 319 | 110 | # This Python file uses the following encoding: utf-8
# if __name__ == "__main__":
# pass
a, b, c, d = list(map(int, input().split()))
"""
while a > 0 and c > 0:
c -= b
a -= d
if c <= 0:
print("Yes")
else:
print("No")
"""
if -(-c // b) <= -(-a // d):
print("Yes")
else:
print("No")
| a, b, c, d = list(map(int, input().split()))
if -(-c // b) <= -(-a // d):
print("Yes")
else:
print("No")
| false | 66.666667 | [
"-# This Python file uses the following encoding: utf-8",
"-# if __name__ == \"__main__\":",
"-# pass",
"-\"\"\"",
"-while a > 0 and c > 0:",
"- c -= b",
"- a -= d",
"-if c <= 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"-\"\"\""
] | false | 0.036513 | 0.037629 | 0.970337 | [
"s215264370",
"s748294828"
] |
u864197622 | p02651 | python | s426258034 | s060006268 | 189 | 111 | 9,176 | 9,212 | Accepted | Accepted | 41.27 | class VectorSpace:
def __init__(self, k):
self.k = k
self.E = [0] * k
def chk(self, n):
for i in range(self.k)[::-1]:
n = min(n, n ^ self.E[i])
return 1 if n == 0 else 0
def add(self, n):
for i in range(self.k)[::-1]:
n = ... | class VectorSpace01:
def __init__(self):
self.E = []
def chk(self, n):
for e in self.E:
n = min(n, n ^ e)
return 1 if n == 0 else 0
def add(self, n):
for e in self.E:
n = min(n, n ^ e)
if n: self.E.append(n)
retur... | 32 | 31 | 803 | 721 | class VectorSpace:
def __init__(self, k):
self.k = k
self.E = [0] * k
def chk(self, n):
for i in range(self.k)[::-1]:
n = min(n, n ^ self.E[i])
return 1 if n == 0 else 0
def add(self, n):
for i in range(self.k)[::-1]:
n = min(n, n ^ self.E[i]... | class VectorSpace01:
def __init__(self):
self.E = []
def chk(self, n):
for e in self.E:
n = min(n, n ^ e)
return 1 if n == 0 else 0
def add(self, n):
for e in self.E:
n = min(n, n ^ e)
if n:
self.E.append(n)
return 1 if n ... | false | 3.125 | [
"-class VectorSpace:",
"- def __init__(self, k):",
"- self.k = k",
"- self.E = [0] * k",
"+class VectorSpace01:",
"+ def __init__(self):",
"+ self.E = []",
"- for i in range(self.k)[::-1]:",
"- n = min(n, n ^ self.E[i])",
"+ for e in self.E:",
... | false | 0.103492 | 0.038335 | 2.699686 | [
"s426258034",
"s060006268"
] |
u746419473 | p03160 | python | s791866588 | s742211153 | 237 | 129 | 53,752 | 13,980 | Accepted | Accepted | 45.57 | n = int(eval(input()))
*h, = list(map(int, input().split()))
dp = [float("inf")]*n
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = dp[i-1] + abs(h[i-1] - h[i])
else:
dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]))
print((dp[n-1]))
| n = int(eval(input()))
*h, = list(map(int, input().split()))
dp = [float("inf")]*(n+1)
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = dp[i-1] + abs(h[i-1]-h[i])
dp[i] = min(dp[i-2] + abs(h[i-2]-h[i]), dp[i-1] + abs(h[i-1]-h[i]))
print((dp[n-1]))
| 13 | 13 | 283 | 268 | n = int(eval(input()))
(*h,) = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])
else:
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((dp[n - 1]))
| n = int(eval(input()))
(*h,) = list(map(int, input().split()))
dp = [float("inf")] * (n + 1)
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])
dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))
print((dp[n - 1]))
| false | 0 | [
"-dp = [float(\"inf\")] * n",
"+dp = [float(\"inf\")] * (n + 1)",
"- else:",
"- dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))",
"+ dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))"
] | false | 0.037501 | 0.173414 | 0.216251 | [
"s791866588",
"s742211153"
] |
u937642029 | p02803 | python | s796141653 | s275131317 | 304 | 272 | 47,704 | 47,064 | Accepted | Accepted | 10.53 | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): ... | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): ... | 68 | 68 | 2,108 | 2,110 | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp(): # ... | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp(): # ... | false | 0 | [
"- que.append([sx, sy])",
"+ que.append((sx, sy))",
"- [qx, qy] = que.popleft()",
"+ (qx, qy) = que.popleft()",
"- que.append([nx, ny])",
"+ que.append((nx, ny))"
] | false | 0.043203 | 0.040455 | 1.067929 | [
"s796141653",
"s275131317"
] |
u278955646 | p02780 | python | s162461096 | s721657978 | 1,187 | 232 | 26,328 | 25,572 | Accepted | Accepted | 80.45 | import queue
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
queue = queue.Queue()
currentSum = 0
maxSum = 0
for i in range(len(p)):
currentSum = currentSum + p[i] + 1
queue.put(p[i] + 1)
if i >= K:
currentSum = currentSum - queue.get()
if i >= K - 1:
... | from collections import deque
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
queue = deque()
currentSum = 0
maxSum = 0
for i in range(len(p)):
currentSum = currentSum + p[i] + 1
queue.append(p[i] + 1)
if i >= K:
currentSum = currentSum - queue.popleft()
... | 18 | 18 | 395 | 413 | import queue
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
queue = queue.Queue()
currentSum = 0
maxSum = 0
for i in range(len(p)):
currentSum = currentSum + p[i] + 1
queue.put(p[i] + 1)
if i >= K:
currentSum = currentSum - queue.get()
if i >= K - 1:
maxSum =... | from collections import deque
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
queue = deque()
currentSum = 0
maxSum = 0
for i in range(len(p)):
currentSum = currentSum + p[i] + 1
queue.append(p[i] + 1)
if i >= K:
currentSum = currentSum - queue.popleft()
if i >= K - 1... | false | 0 | [
"-import queue",
"+from collections import deque",
"-queue = queue.Queue()",
"+queue = deque()",
"- queue.put(p[i] + 1)",
"+ queue.append(p[i] + 1)",
"- currentSum = currentSum - queue.get()",
"+ currentSum = currentSum - queue.popleft()"
] | false | 0.096674 | 0.037346 | 2.588585 | [
"s162461096",
"s721657978"
] |
u794173881 | p02665 | python | s891447390 | s800872008 | 89 | 78 | 83,404 | 83,324 | Accepted | Accepted | 12.36 | n = int(eval(input()))
a = list(map(int, input().split()))
b = a[::-1]
if n == 0 and a[0] == 1:
print((1))
exit()
if n == 0:
print((-1))
exit()
if a[0] >= 1:
print((-1))
exit()
ans = [0] * (n + 1)
for i in range(n):
ans[i + 1] = ans[i] + b[i]
ans = ans[::-1... | n = int(eval(input()))
a = list(map(int, input().split()))
b = a[::-1]
if n == 0 and a[0] == 1:
print((1))
exit()
if a[0] >= 1:
print((-1))
exit()
ans = [0] * (n + 1)
for i in range(n):
ans[i + 1] = ans[i] + b[i]
ans = ans[::-1]
ans = ans[1::]
a = a[1::]
res = 1
prev_... | 36 | 32 | 541 | 494 | n = int(eval(input()))
a = list(map(int, input().split()))
b = a[::-1]
if n == 0 and a[0] == 1:
print((1))
exit()
if n == 0:
print((-1))
exit()
if a[0] >= 1:
print((-1))
exit()
ans = [0] * (n + 1)
for i in range(n):
ans[i + 1] = ans[i] + b[i]
ans = ans[::-1]
ans = ans[1::]
a = a[1::]
res = 1... | n = int(eval(input()))
a = list(map(int, input().split()))
b = a[::-1]
if n == 0 and a[0] == 1:
print((1))
exit()
if a[0] >= 1:
print((-1))
exit()
ans = [0] * (n + 1)
for i in range(n):
ans[i + 1] = ans[i] + b[i]
ans = ans[::-1]
ans = ans[1::]
a = a[1::]
res = 1
prev_cnt = 1
for i in range(n):
c... | false | 11.111111 | [
"- exit()",
"-if n == 0:",
"- print((-1))"
] | false | 0.039432 | 0.037377 | 1.054993 | [
"s891447390",
"s800872008"
] |
u821624310 | p02420 | python | s298210959 | s630688264 | 30 | 20 | 7,740 | 7,732 | Accepted | Accepted | 33.33 | m = ""
while True:
S = eval(input())
if S == "-":
break
S = list(S)
L = S
n = int(eval(input()))
for i in range(n):
m = int(eval(input()))
for j in range(m):
t = L.pop(0)
L.append(t)
L = "".join(L)
print(L) | while True:
card = [w for w in input()]
if card[-1] == "-":
break
m = int(input())
for i in range(m):
h = int(input())
for i in range(h):
t = card[0]
del card[0]
card.append(t)
for i in range(len(card)):
print(card[i], e... | 17 | 14 | 286 | 345 | m = ""
while True:
S = eval(input())
if S == "-":
break
S = list(S)
L = S
n = int(eval(input()))
for i in range(n):
m = int(eval(input()))
for j in range(m):
t = L.pop(0)
L.append(t)
L = "".join(L)
print(L)
| while True:
card = [w for w in input()]
if card[-1] == "-":
break
m = int(input())
for i in range(m):
h = int(input())
for i in range(h):
t = card[0]
del card[0]
card.append(t)
for i in range(len(card)):
print(card[i], end="")
p... | false | 17.647059 | [
"-m = \"\"",
"- S = eval(input())",
"- if S == \"-\":",
"+ card = [w for w in input()]",
"+ if card[-1] == \"-\":",
"- S = list(S)",
"- L = S",
"- n = int(eval(input()))",
"- for i in range(n):",
"- m = int(eval(input()))",
"- for j in range(m):",
"- ... | false | 0.04283 | 0.042795 | 1.000817 | [
"s298210959",
"s630688264"
] |
u536034761 | p02555 | python | s171482218 | s453778877 | 204 | 118 | 73,264 | 9,004 | Accepted | Accepted | 42.16 | import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
S = int(eval(input()))
ans = 0
mod = 10 ** 9 + 7
for i in range(1,700):
x = S - 3 * i
if x < 0:
break
ans += (combinations_count(x + i - 1, i - 1)) % mod
ans %= ... | import math
#n個からr個とるときの組み合わせの数
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
S = int(eval(input()))
ans = 0
mod = 10 ** 9 + 7
for i in range(1,S // 3 + 1): #長さiの数列のとき
x = S - 3 * i #3を分配後の余り
ans += (combinations_count(... | 16 | 16 | 330 | 382 | import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
S = int(eval(input()))
ans = 0
mod = 10**9 + 7
for i in range(1, 700):
x = S - 3 * i
if x < 0:
break
ans += (combinations_count(x + i - 1, i - 1)) % mod
ans %= mod
print(ans)... | import math
# n個からr個とるときの組み合わせの数
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
S = int(eval(input()))
ans = 0
mod = 10**9 + 7
for i in range(1, S // 3 + 1): # 長さiの数列のとき
x = S - 3 * i # 3を分配後の余り
ans += (combinations_count(x + i - 1, i - 1)) % mod ... | false | 0 | [
"-",
"+# n個からr個とるときの組み合わせの数",
"-for i in range(1, 700):",
"- x = S - 3 * i",
"- if x < 0:",
"- break",
"- ans += (combinations_count(x + i - 1, i - 1)) % mod",
"+for i in range(1, S // 3 + 1): # 長さiの数列のとき",
"+ x = S - 3 * i # 3を分配後の余り",
"+ ans += (combinations_count(x + i -... | false | 0.152965 | 0.11448 | 1.336182 | [
"s171482218",
"s453778877"
] |
u837673618 | p02744 | python | s403409887 | s958945390 | 235 | 132 | 5,024 | 5,016 | Accepted | Accepted | 43.83 | from string import ascii_lowercase as alph
from operator import itemgetter
def gen_pattern(N, pre=[]):
for i in range(max(pre or [-1])+2):
indexes = pre+[i]
if len(indexes) == N:
print(("".join(itemgetter(*indexes)(alph))))
else:
gen_pattern(N, indexes)
gen_pattern(int(eval(input(... | from string import ascii_lowercase as alph
def gen_pattern(N, pre=""):
for i in range(ord(max(pre or "\x60"))-0x5f):
pattern = pre+alph[i]
if len(pattern) == N:
print(pattern)
else:
gen_pattern(N, pattern)
gen_pattern(int(eval(input())))
| 12 | 11 | 317 | 270 | from string import ascii_lowercase as alph
from operator import itemgetter
def gen_pattern(N, pre=[]):
for i in range(max(pre or [-1]) + 2):
indexes = pre + [i]
if len(indexes) == N:
print(("".join(itemgetter(*indexes)(alph))))
else:
gen_pattern(N, indexes)
gen_pa... | from string import ascii_lowercase as alph
def gen_pattern(N, pre=""):
for i in range(ord(max(pre or "\x60")) - 0x5F):
pattern = pre + alph[i]
if len(pattern) == N:
print(pattern)
else:
gen_pattern(N, pattern)
gen_pattern(int(eval(input())))
| false | 8.333333 | [
"-from operator import itemgetter",
"-def gen_pattern(N, pre=[]):",
"- for i in range(max(pre or [-1]) + 2):",
"- indexes = pre + [i]",
"- if len(indexes) == N:",
"- print((\"\".join(itemgetter(*indexes)(alph))))",
"+def gen_pattern(N, pre=\"\"):",
"+ for i in range(ord(... | false | 0.085596 | 0.042609 | 2.008851 | [
"s403409887",
"s958945390"
] |
u827202523 | p02689 | python | s558520757 | s300503083 | 324 | 219 | 99,996 | 99,752 | Accepted | Accepted | 32.41 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict
from sys import exit
import math
def main():
n, m = getList()
nums = getList()
tree = [[] for _ in... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lam... | 38 | 71 | 773 | 1,376 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict
from sys import exit
import math
def main():
n, m = getList()
nums = getList()
tree = [[] for _ in range(n)]... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int... | false | 46.478873 | [
"-def getN():",
"- return int(eval(input()))",
"+import sys",
"+from collections import defaultdict, deque, Counter",
"+import math",
"+",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+import heapq",
"+",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"+in... | false | 0.041209 | 0.037225 | 1.107029 | [
"s558520757",
"s300503083"
] |
u623819879 | p03945 | python | s482682448 | s494306984 | 169 | 71 | 39,408 | 61,968 | Accepted | Accepted | 57.99 | s=str(eval(input()))
ans=0
for i in range(len(s)-1):
if s[i]!=s[i+1]:
ans+=1
print(ans)
|
s=eval(input())
a=s.count('BW')
b=s.count('WB')
print((a+b)) | 6 | 6 | 93 | 59 | s = str(eval(input()))
ans = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
| s = eval(input())
a = s.count("BW")
b = s.count("WB")
print((a + b))
| false | 0 | [
"-s = str(eval(input()))",
"-ans = 0",
"-for i in range(len(s) - 1):",
"- if s[i] != s[i + 1]:",
"- ans += 1",
"-print(ans)",
"+s = eval(input())",
"+a = s.count(\"BW\")",
"+b = s.count(\"WB\")",
"+print((a + b))"
] | false | 0.080008 | 0.13646 | 0.586309 | [
"s482682448",
"s494306984"
] |
u761320129 | p03599 | python | s054409956 | s584384399 | 116 | 92 | 3,188 | 3,188 | Accepted | Accepted | 20.69 | A,B,C,D,E,F = list(map(int, input().split()))
ws = set()
i = j = 0
while True:
j = 0
if B*i > F//100: break
while True:
w = B*i + A*j
if w > F//100: break
ws.add(w)
j += 1
i += 1
ws = list(ws)
ws.sort()
ss = set()
i = j = 0
while True:
j = 0
... | A,B,C,D,E,F = list(map(int,input().split()))
waters = set()
for wb in range(0,F+1,100*B):
wa = 0
while wa + wb <= F:
waters.add(wa + wb)
wa += 100*A
waters.remove(0)
sugars = set()
for sd in range(0,F+1,D):
sc = 0
while sc + sd <= F:
sugars.add(sc + sd)
s... | 46 | 29 | 815 | 622 | A, B, C, D, E, F = list(map(int, input().split()))
ws = set()
i = j = 0
while True:
j = 0
if B * i > F // 100:
break
while True:
w = B * i + A * j
if w > F // 100:
break
ws.add(w)
j += 1
i += 1
ws = list(ws)
ws.sort()
ss = set()
i = j = 0
while True:
... | A, B, C, D, E, F = list(map(int, input().split()))
waters = set()
for wb in range(0, F + 1, 100 * B):
wa = 0
while wa + wb <= F:
waters.add(wa + wb)
wa += 100 * A
waters.remove(0)
sugars = set()
for sd in range(0, F + 1, D):
sc = 0
while sc + sd <= F:
sugars.add(sc + sd)
... | false | 36.956522 | [
"-ws = set()",
"-i = j = 0",
"-while True:",
"- j = 0",
"- if B * i > F // 100:",
"- break",
"- while True:",
"- w = B * i + A * j",
"- if w > F // 100:",
"- break",
"- ws.add(w)",
"- j += 1",
"- i += 1",
"-ws = list(ws)",
"-ws.so... | false | 0.056789 | 0.05301 | 1.071291 | [
"s054409956",
"s584384399"
] |
u863442865 | p02793 | python | s838690151 | s837464935 | 1,115 | 421 | 76,124 | 59,608 | Accepted | Accepted | 62.24 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fr... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fr... | 55 | 59 | 1,288 | 1,351 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from h... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from h... | false | 6.779661 | [
"+ # 素因数分解",
"+ def prime_decomp(n):",
"+ i = 2",
"+ res = []",
"+ while i**2 <= n:",
"+ while n % i == 0:",
"+ n //= i",
"+ res.append(i)",
"+ i += 1",
"+ if n > 1:",
"+ res.append(n)",
"+ ... | false | 0.04335 | 0.297141 | 0.145892 | [
"s838690151",
"s837464935"
] |
u968166680 | p03266 | python | s241790478 | s761405190 | 61 | 27 | 10,328 | 9,200 | Accepted | Accepted | 55.74 | 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, K = list(map(int, readline().split()))
R = [0] * K
for n in range(1, N + 1):
R[n % K] += 1
ans = 0
... | 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, K = list(map(int, readline().split()))
ans = pow(N // K, 3)
if K % 2 == 0:
ans += pow((N + K // 2) // K, 3)
... | 29 | 23 | 501 | 387 | 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, K = list(map(int, readline().split()))
R = [0] * K
for n in range(1, N + 1):
R[n % K] += 1
ans = 0
for a in range(K):
... | 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, K = list(map(int, readline().split()))
ans = pow(N // K, 3)
if K % 2 == 0:
ans += pow((N + K // 2) // K, 3)
print(ans)
... | false | 20.689655 | [
"- R = [0] * K",
"- for n in range(1, N + 1):",
"- R[n % K] += 1",
"- ans = 0",
"- for a in range(K):",
"- b = (K - a) % K",
"- if 2 * b % K == 0:",
"- ans += R[a] * R[b] * R[b]",
"+ ans = pow(N // K, 3)",
"+ if K % 2 == 0:",
"+ ans += pow... | false | 0.039318 | 0.042165 | 0.932481 | [
"s241790478",
"s761405190"
] |
u186838327 | p02913 | python | s102255450 | s226996140 | 885 | 405 | 53,036 | 75,940 | Accepted | Accepted | 54.24 | n = int(eval(input()))
s = str(eval(input()))
def z_algorithm(s):
n = len(s)
Z = [0]*n
Z[0] = n
i = 1
j = 0
while i < n:
while i+j < n and s[j] == s[i+j]:
j += 1
Z[i] = j
if j == 0:
i += 1
continue
k = 1
... | n = int(eval(input()))
s = str(eval(input()))
def z_algorithm(s):
n = len(s)
Z = [0]*n
Z[0] = n
i = 1
j = 0
while i < n:
while i+j < n and s[j] == s[i+j]:
j += 1
Z[i] = j
if j == 0:
i += 1
continue
k = 1
... | 38 | 32 | 697 | 601 | n = int(eval(input()))
s = str(eval(input()))
def z_algorithm(s):
n = len(s)
Z = [0] * n
Z[0] = n
i = 1
j = 0
while i < n:
while i + j < n and s[j] == s[i + j]:
j += 1
Z[i] = j
if j == 0:
i += 1
continue
k = 1
while i ... | n = int(eval(input()))
s = str(eval(input()))
def z_algorithm(s):
n = len(s)
Z = [0] * n
Z[0] = n
i = 1
j = 0
while i < n:
while i + j < n and s[j] == s[i + j]:
j += 1
Z[i] = j
if j == 0:
i += 1
continue
k = 1
while i ... | false | 15.789474 | [
"-s = list(s)",
"-s.reverse()",
"-import copy",
"-",
"- if i != 0:",
"- s.pop()",
"- t = copy.copy(s)",
"- t.reverse()",
"- t = \"\".join(t)",
"- Z = z_algorithm(t)",
"- for i, z in enumerate(Z):",
"- ans = max(ans, min(i, z))",
"+ t = s[i:]",
"+ z = z... | false | 0.047085 | 0.085824 | 0.548621 | [
"s102255450",
"s226996140"
] |
u701644092 | p03163 | python | s893918346 | s114535806 | 333 | 297 | 147,832 | 148,404 | Accepted | Accepted | 10.81 | N,W = list(map(int,input().split()))
w = [None] * N
v = [None] * N
for i in range(N):
w[i],v[i] = list(map(int,input().split()))
dp = [[-1] * (W + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(len(dp[i]) - 2, -1, -1):
if dp[i][j] == -1:
continue
dp[i + 1][j]... | N,W = list(map(int,input().split()))
dp = [[-1] * (W + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
w,v = list(map(int,input().split()))
for j in range(len(dp[i]) - 2, -1, -1):
if dp[i][j] == -1:
continue
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
if j + w >= len(dp[i]):
... | 20 | 16 | 476 | 404 | N, W = list(map(int, input().split()))
w = [None] * N
v = [None] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[-1] * (W + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(len(dp[i]) - 2, -1, -1):
if dp[i][j] == -1:
continue
dp[i + ... | N, W = list(map(int, input().split()))
dp = [[-1] * (W + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(len(dp[i]) - 2, -1, -1):
if dp[i][j] == -1:
continue
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
if j + w >=... | false | 20 | [
"-w = [None] * N",
"-v = [None] * N",
"-for i in range(N):",
"- w[i], v[i] = list(map(int, input().split()))",
"+ w, v = list(map(int, input().split()))",
"- if j + w[i] >= len(dp[i]):",
"+ if j + w >= len(dp[i]):",
"- dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] ... | false | 0.040209 | 0.04179 | 0.962178 | [
"s893918346",
"s114535806"
] |
u297574184 | p03921 | python | s527736615 | s155365195 | 546 | 466 | 12,632 | 37,656 | Accepted | Accepted | 14.65 | # Union-Findデータ構造
class UnionFind:
def __init__(self, numV):
self.pars = list(range(numV))
self.ranks = [0] * numV
def find(self, x):
if self.pars[x] == x: return x
else:
self.pars[x] = self.find(self.pars[x])
return self.pars[x]
def union(se... | import sys
sys.setrecursionlimit(10**9)
def dfs(vNow):
useds[vNow] = True
for v2 in adjL[vNow]:
if not useds[v2]:
dfs(v2)
N, M = list(map(int, input().split()))
adjL = [[] for v in range(N+M)]
for i in range(N):
K, *Ls = list(map(int, input().split()))
for L in Ls:
... | 31 | 21 | 926 | 446 | # Union-Findデータ構造
class UnionFind:
def __init__(self, numV):
self.pars = list(range(numV))
self.ranks = [0] * numV
def find(self, x):
if self.pars[x] == x:
return x
else:
self.pars[x] = self.find(self.pars[x])
return self.pars[x]
def unio... | import sys
sys.setrecursionlimit(10**9)
def dfs(vNow):
useds[vNow] = True
for v2 in adjL[vNow]:
if not useds[v2]:
dfs(v2)
N, M = list(map(int, input().split()))
adjL = [[] for v in range(N + M)]
for i in range(N):
K, *Ls = list(map(int, input().split()))
for L in Ls:
adj... | false | 32.258065 | [
"-# Union-Findデータ構造",
"-class UnionFind:",
"- def __init__(self, numV):",
"- self.pars = list(range(numV))",
"- self.ranks = [0] * numV",
"+import sys",
"- def find(self, x):",
"- if self.pars[x] == x:",
"- return x",
"- else:",
"- self.par... | false | 0.038805 | 0.03488 | 1.112504 | [
"s527736615",
"s155365195"
] |
u606045429 | p03291 | python | s180372467 | s256253547 | 473 | 350 | 27,596 | 27,596 | Accepted | Accepted | 26 | MOD = 10 ** 9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 4 for _ in range(N + 1)]
for i in reversed(list(range(N + 1))):
for j in reversed(list(range(4))):
if i == N:
dp[i][j] = int(j == 3)
else:
dp[i][j] = dp[i + 1][j] * (3 if S[i] == "?" else 1)
... | def main():
MOD = 10 ** 9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 4 for _ in range(N + 1)]
for i in reversed(list(range(N + 1))):
for j in reversed(list(range(4))):
if i == N:
dp[i][j] = int(j == 3)
else:
dp[i][j] =... | 18 | 23 | 446 | 559 | MOD = 10**9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 4 for _ in range(N + 1)]
for i in reversed(list(range(N + 1))):
for j in reversed(list(range(4))):
if i == N:
dp[i][j] = int(j == 3)
else:
dp[i][j] = dp[i + 1][j] * (3 if S[i] == "?" else 1)
if j < 3 and (S[... | def main():
MOD = 10**9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 4 for _ in range(N + 1)]
for i in reversed(list(range(N + 1))):
for j in reversed(list(range(4))):
if i == N:
dp[i][j] = int(j == 3)
else:
dp[i][j] = dp[i + 1][j] * (3... | false | 21.73913 | [
"-MOD = 10**9 + 7",
"-S = eval(input())",
"-N = len(S)",
"-dp = [[0] * 4 for _ in range(N + 1)]",
"-for i in reversed(list(range(N + 1))):",
"- for j in reversed(list(range(4))):",
"- if i == N:",
"- dp[i][j] = int(j == 3)",
"- else:",
"- dp[i][j] = dp[i + 1]... | false | 0.035836 | 0.037314 | 0.960383 | [
"s180372467",
"s256253547"
] |
u864197622 | p02704 | python | s324968834 | s676401954 | 661 | 455 | 188,244 | 143,108 | Accepted | Accepted | 31.16 | from functools import reduce
from operator import and_, or_
N = int(eval(input()))
S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]
X = [[U[i] & V[j] if S[i] and T[j] else U[i] if T[j] else V[j] if S[i] else U[i] | V[j] for j in range(N)] for i in range(N)]
for _ in range(2):
A1 = [[-1] ... | from functools import reduce
from operator import and_, or_
N = int(eval(input()))
S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]
X = [[U[i] & V[j] if S[i] and T[j] else U[i] if T[j] else V[j] if S[i] else U[i] | V[j] for j in range(N)] for i in range(N)]
for _ in range(2):
A1 = [-1] *... | 31 | 30 | 996 | 937 | from functools import reduce
from operator import and_, or_
N = int(eval(input()))
S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]
X = [
[
U[i] & V[j]
if S[i] and T[j]
else U[i]
if T[j]
else V[j]
if S[i]
else U[i] | V[j]
for j in ra... | from functools import reduce
from operator import and_, or_
N = int(eval(input()))
S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]
X = [
[
U[i] & V[j]
if S[i] and T[j]
else U[i]
if T[j]
else V[j]
if S[i]
else U[i] | V[j]
for j in ra... | false | 3.225806 | [
"- A1 = [[-1] * N for _ in range(N)]",
"+ A1 = [-1] * N",
"- if i:",
"- A1[i][j] = A1[i - 1][j] & X[i - 1][j]",
"- X[i][j] |= ~(A1[i][j] & A2[i][j] | a)",
"- a |= X[i][j]",
"+ X[i][j] |= ~(A1[j] & A2[i][j] | a)",
"+ ... | false | 0.04135 | 0.036694 | 1.126897 | [
"s324968834",
"s676401954"
] |
u191874006 | p03073 | python | s499315063 | s775755568 | 213 | 184 | 49,616 | 39,536 | Accepted | Accepted | 13.62 | #!/usr/bin/env python3
#ABC124 C
s = list(map(int,list(eval(input()))))
n = len(s)
ans1 = 0
ans2 = 0
for i in range(n):
if i % 2 == 0:
if s[i] != 1:
ans1 += 1
else:
if s[i] != 0:
ans1 += 1
for i in range(n):
if i % 2 == 0:
if s[i] != 0:
... | #!/usr/bin/env python3
#ABC124 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | 22 | 34 | 411 | 795 | #!/usr/bin/env python3
# ABC124 C
s = list(map(int, list(eval(input()))))
n = len(s)
ans1 = 0
ans2 = 0
for i in range(n):
if i % 2 == 0:
if s[i] != 1:
ans1 += 1
else:
if s[i] != 0:
ans1 += 1
for i in range(n):
if i % 2 == 0:
if s[i] != 0:
ans2 += 1... | #!/usr/bin/env python3
# ABC124 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | false | 35.294118 | [
"-s = list(map(int, list(eval(input()))))",
"-n = len(s)",
"-ans1 = 0",
"-ans2 = 0",
"-for i in range(n):",
"- if i % 2 == 0:",
"- if s[i] != 1:",
"+import sys",
"+import math",
"+import bisect",
"+",
"+sys.setrecursionlimit(1000000000)",
"+from heapq import heappush, heappop, heap... | false | 0.094548 | 0.102815 | 0.9196 | [
"s499315063",
"s775755568"
] |
u046187684 | p02814 | python | s778934888 | s013739329 | 486 | 167 | 17,168 | 17,172 | Accepted | Accepted | 65.64 | from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def solve(string):
n, m, *a = list(map(int, string.split()))
l = reduce(lcm, a)
while a[0] % 2 == 0:
c = a[0] % 2
for _a in a[1:]:
if _a % 2 != c:
... | from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def solve(string):
n, m, *a = list(map(int, string.split()))
l = reduce(lcm, a)
c = 1
while a[0] % (2 * c) == 0:
c *= 2
a = [_a // c if _a % c == 0 else 0 for _a in a]
f... | 28 | 24 | 613 | 531 | from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def solve(string):
n, m, *a = list(map(int, string.split()))
l = reduce(lcm, a)
while a[0] % 2 == 0:
c = a[0] % 2
for _a in a[1:]:
if _a % 2 != c:
return "0"
... | from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def solve(string):
n, m, *a = list(map(int, string.split()))
l = reduce(lcm, a)
c = 1
while a[0] % (2 * c) == 0:
c *= 2
a = [_a // c if _a % c == 0 else 0 for _a in a]
for _a in a:
... | false | 14.285714 | [
"- while a[0] % 2 == 0:",
"- c = a[0] % 2",
"- for _a in a[1:]:",
"- if _a % 2 != c:",
"- return \"0\"",
"- if not c:",
"- a = [_a // 2 for _a in a]",
"- c = a[0] % 2",
"- for _a in a[1:]:",
"- if _a % 2 != c:",
"+ c = ... | false | 0.059813 | 0.116239 | 0.514569 | [
"s778934888",
"s013739329"
] |
u102461423 | p03767 | python | s121975765 | s163855796 | 219 | 197 | 37,084 | 31,500 | Accepted | Accepted | 10.05 | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(x) for x in input().split()]
A.sort()
answer = sum(A[N::2])
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,*A = list(map(int,read().split()))
A.sort()
answer = sum(A[N::2])
print(answer) | 8 | 10 | 145 | 202 | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(x) for x in input().split()]
A.sort()
answer = sum(A[N::2])
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
A.sort()
answer = sum(A[N::2])
print(answer)
| false | 20 | [
"-input = sys.stdin.readline",
"-N = int(eval(input()))",
"-A = [int(x) for x in input().split()]",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+N, *A = list(map(int, read().split()))"
] | false | 0.05678 | 0.035614 | 1.594325 | [
"s121975765",
"s163855796"
] |
u021548497 | p03167 | python | s117132500 | s305071461 | 1,137 | 119 | 43,716 | 77,840 | Accepted | Accepted | 89.53 | h, w = list(map(int, input().split()))
a = [0]*h
for i in range(h):
a[i] = eval(input())
dp = [[0]*w for i in range(h)]
inf = 10**9+7
dp[0][0] = 1
for i in range(h):
for j in range(w):
if a[i][j] == "#":
continue
else:
if i > 0:
dp[i][j] += dp[i-1][j]
dp[i][j]... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100007)
def main():
h, w = list(map(int, input().split()))
grid = [None]*h
for i in range(h):
grid[i] = eval(input())
mod = pow(10, 9)+7
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
for i in range(h):
... | 23 | 25 | 413 | 617 | h, w = list(map(int, input().split()))
a = [0] * h
for i in range(h):
a[i] = eval(input())
dp = [[0] * w for i in range(h)]
inf = 10**9 + 7
dp[0][0] = 1
for i in range(h):
for j in range(w):
if a[i][j] == "#":
continue
else:
if i > 0:
dp[i][j] += dp[i - 1]... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100007)
def main():
h, w = list(map(int, input().split()))
grid = [None] * h
for i in range(h):
grid[i] = eval(input())
mod = pow(10, 9) + 7
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
for i in range(h):
for j i... | false | 8 | [
"-h, w = list(map(int, input().split()))",
"-a = [0] * h",
"-for i in range(h):",
"- a[i] = eval(input())",
"-dp = [[0] * w for i in range(h)]",
"-inf = 10**9 + 7",
"-dp[0][0] = 1",
"-for i in range(h):",
"- for j in range(w):",
"- if a[i][j] == \"#\":",
"- continue",
"... | false | 0.046288 | 0.043551 | 1.06284 | [
"s117132500",
"s305071461"
] |
u762420987 | p03102 | python | s007111229 | s208158380 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | N,M,C = list(map(int,input().split()))
Blist = list(map(int,input().split()))
Alist = [list(map(int,input().split())) for i in range(N)]
counter = 0
for x in range(N):
all = C
xlist = Alist[x]
for j in range(M):
all += Blist[j]*xlist[j]
if all>0:
counter += 1
print(count... | N, M, C = list(map(int, input().split()))
Blist = list(map(int, input().split()))
ans = 0
for i in range(N):
score = C
Alist = list(map(int, input().split()))
for j in range(M):
score += Alist[j]*Blist[j]
if score > 0:
ans += 1
print(ans) | 15 | 11 | 318 | 274 | N, M, C = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Alist = [list(map(int, input().split())) for i in range(N)]
counter = 0
for x in range(N):
all = C
xlist = Alist[x]
for j in range(M):
all += Blist[j] * xlist[j]
if all > 0:
counter += 1
print(counter)
| N, M, C = list(map(int, input().split()))
Blist = list(map(int, input().split()))
ans = 0
for i in range(N):
score = C
Alist = list(map(int, input().split()))
for j in range(M):
score += Alist[j] * Blist[j]
if score > 0:
ans += 1
print(ans)
| false | 26.666667 | [
"-Alist = [list(map(int, input().split())) for i in range(N)]",
"-counter = 0",
"-for x in range(N):",
"- all = C",
"- xlist = Alist[x]",
"+ans = 0",
"+for i in range(N):",
"+ score = C",
"+ Alist = list(map(int, input().split()))",
"- all += Blist[j] * xlist[j]",
"- if all... | false | 0.036839 | 0.03471 | 1.061353 | [
"s007111229",
"s208158380"
] |
u813098295 | p03221 | python | s297319283 | s225579581 | 903 | 783 | 24,168 | 24,172 | Accepted | Accepted | 13.29 | # coding: utf-8
# N : 県の数, M: 市の数
import bisect
N, M = map(int, input().split())
ps, ys = [], []
v = [ [] for _ in range(N+1) ]
for i in range(M):
p, y = map(int, input().split())
ps += [p]; ys += [y];
v[p].append(y)
for i in range(N):
v[i+1].sort()
for i in range(M):
print(... | from bisect import bisect_left
N, M = map(int, input().split())
P, Y = [], []
v = [[] for _ in range(N+1)]
for i in range(M):
p, y = map(int, input().split())
P += [p]
Y += [y]
v[p] += [y]
for i in range(N+1):
v[i].sort()
for x, y in zip(P, Y):
print ("%06d" % x, end = "")
... | 21 | 18 | 419 | 370 | # coding: utf-8
# N : 県の数, M: 市の数
import bisect
N, M = map(int, input().split())
ps, ys = [], []
v = [[] for _ in range(N + 1)]
for i in range(M):
p, y = map(int, input().split())
ps += [p]
ys += [y]
v[p].append(y)
for i in range(N):
v[i + 1].sort()
for i in range(M):
print("{:06d}".format(ps[i... | from bisect import bisect_left
N, M = map(int, input().split())
P, Y = [], []
v = [[] for _ in range(N + 1)]
for i in range(M):
p, y = map(int, input().split())
P += [p]
Y += [y]
v[p] += [y]
for i in range(N + 1):
v[i].sort()
for x, y in zip(P, Y):
print("%06d" % x, end="")
print("%06d" % i... | false | 14.285714 | [
"-# coding: utf-8",
"-# N : 県の数, M: 市の数",
"-import bisect",
"+from bisect import bisect_left",
"-ps, ys = [], []",
"+P, Y = [], []",
"- ps += [p]",
"- ys += [y]",
"- v[p].append(y)",
"-for i in range(N):",
"- v[i + 1].sort()",
"-for i in range(M):",
"- print(\"{:06d}\".format(... | false | 0.220838 | 0.047085 | 4.690231 | [
"s297319283",
"s225579581"
] |
u718706790 | p03377 | python | s932342758 | s972235590 | 25 | 17 | 3,316 | 3,064 | Accepted | Accepted | 32 | a, b, x = list(map(int, input().split()))
if x <= a + b and x >= a:
print('YES')
else:
print('NO') | a, b, x = list(map(int, input().split()))
print(('YES' if a <= x <= a + b else 'NO')) | 6 | 2 | 102 | 78 | a, b, x = list(map(int, input().split()))
if x <= a + b and x >= a:
print("YES")
else:
print("NO")
| a, b, x = list(map(int, input().split()))
print(("YES" if a <= x <= a + b else "NO"))
| false | 66.666667 | [
"-if x <= a + b and x >= a:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+print((\"YES\" if a <= x <= a + b else \"NO\"))"
] | false | 0.14734 | 0.037876 | 3.890031 | [
"s932342758",
"s972235590"
] |
u842396874 | p03041 | python | s091531129 | s940840790 | 21 | 17 | 3,444 | 2,940 | Accepted | Accepted | 19.05 | # coding: utf-8
# Your code here!
# ABC126A
from copy import deepcopy
N, K = list(map(int, input().split()))
S = eval(input())
l = [s for s in S]
l[K-1] = l[K-1].lower()
print((''.join(l))) | n, k = list(map(int, input().split()))
s = eval(input())
ans = ""
for i in range(len(s)):
if i == k-1:
ans += s[i].lower()
else:
ans += s[i]
print(ans)
| 11 | 11 | 187 | 164 | # coding: utf-8
# Your code here!
# ABC126A
from copy import deepcopy
N, K = list(map(int, input().split()))
S = eval(input())
l = [s for s in S]
l[K - 1] = l[K - 1].lower()
print(("".join(l)))
| n, k = list(map(int, input().split()))
s = eval(input())
ans = ""
for i in range(len(s)):
if i == k - 1:
ans += s[i].lower()
else:
ans += s[i]
print(ans)
| false | 0 | [
"-# coding: utf-8",
"-# Your code here!",
"-# ABC126A",
"-from copy import deepcopy",
"-",
"-N, K = list(map(int, input().split()))",
"-S = eval(input())",
"-l = [s for s in S]",
"-l[K - 1] = l[K - 1].lower()",
"-print((\"\".join(l)))",
"+n, k = list(map(int, input().split()))",
"+s = eval(inp... | false | 0.037487 | 0.090265 | 0.4153 | [
"s091531129",
"s940840790"
] |
u411203878 | p03074 | python | s591644667 | s075517736 | 199 | 86 | 49,804 | 83,520 | Accepted | Accepted | 56.78 | n,k = list(map(int,input().split()))
s=list(eval(input()))
memo = [0]
for i in range(1,n):
if s[i] != s[i-1]:
memo.append(i)
ans = 0
kyoukai_math = len(memo)
for i in range(kyoukai_math):
if s[memo[i]] == '1':
hasi = i+k*2+1
else:
hasi = i+k*2
if hasi < kyoukai_math:
... | n,k = list(map(int,input().split()))
s=list(eval(input()))
border = [0]
for i in range(1,n):
if s[i-1] != s[i]:
border.append(i)
border_count = len(border)
ans = 0
for i in range(border_count):
if s[border[i]] == '0':
block_1 = i+k*2
else:
block_1 = i+k*2+1
... | 25 | 25 | 396 | 478 | n, k = list(map(int, input().split()))
s = list(eval(input()))
memo = [0]
for i in range(1, n):
if s[i] != s[i - 1]:
memo.append(i)
ans = 0
kyoukai_math = len(memo)
for i in range(kyoukai_math):
if s[memo[i]] == "1":
hasi = i + k * 2 + 1
else:
hasi = i + k * 2
if hasi < kyoukai_m... | n, k = list(map(int, input().split()))
s = list(eval(input()))
border = [0]
for i in range(1, n):
if s[i - 1] != s[i]:
border.append(i)
border_count = len(border)
ans = 0
for i in range(border_count):
if s[border[i]] == "0":
block_1 = i + k * 2
else:
block_1 = i + k * 2 + 1
# pri... | false | 0 | [
"-memo = [0]",
"+border = [0]",
"- if s[i] != s[i - 1]:",
"- memo.append(i)",
"+ if s[i - 1] != s[i]:",
"+ border.append(i)",
"+border_count = len(border)",
"-kyoukai_math = len(memo)",
"-for i in range(kyoukai_math):",
"- if s[memo[i]] == \"1\":",
"- hasi = i + k *... | false | 0.047046 | 0.041804 | 1.125405 | [
"s591644667",
"s075517736"
] |
u926412290 | p02678 | python | s170945191 | s387727399 | 650 | 441 | 35,436 | 100,404 | Accepted | Accepted | 32.15 | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for i in range(M):
A, B = list(map(int, input().split()))
to[A-1].append(B-1)
to[B-1].append(A-1)
route = deque([0])
dist = [0]*N
prev = [-1]*N
while route:
v = route.popleft()
for ... | from collections import deque
def solve():
N, M = map(int, input().split())
to = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
a, b = a - 1, b - 1
to[a].append(b)
to[b].append(a)
que = deque()
hint = [0] * N
seen = [... | 26 | 36 | 480 | 698 | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for i in range(M):
A, B = list(map(int, input().split()))
to[A - 1].append(B - 1)
to[B - 1].append(A - 1)
route = deque([0])
dist = [0] * N
prev = [-1] * N
while route:
v = route.popleft()
for u in to[v... | from collections import deque
def solve():
N, M = map(int, input().split())
to = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
a, b = a - 1, b - 1
to[a].append(b)
to[b].append(a)
que = deque()
hint = [0] * N
seen = [False] * N
se... | false | 27.777778 | [
"-N, M = list(map(int, input().split()))",
"-to = [[] for _ in range(N)]",
"-for i in range(M):",
"- A, B = list(map(int, input().split()))",
"- to[A - 1].append(B - 1)",
"- to[B - 1].append(A - 1)",
"-route = deque([0])",
"-dist = [0] * N",
"-prev = [-1] * N",
"-while route:",
"- v ... | false | 0.040637 | 0.042958 | 0.945972 | [
"s170945191",
"s387727399"
] |
u564902833 | p03043 | python | s712698603 | s144277006 | 173 | 53 | 39,280 | 2,940 | Accepted | Accepted | 69.36 | N, K = list(map(int, input().split()))
def f(x):
k = 0
while x < K:
x *= 2
k += 1
return k
ans = sum(
1 / (2**f(i))
for i in range(1, N + 1)
) / N
print(ans)
| from math import ceil
# 入力
N, K = list(map(int, input().split()))
# サイコロの各目について勝率を求め、それらの和を解とする
ans = sum(
1 / (2**((ceil(K / i) - 1).bit_length()))
for i in range(1, N + 1)
) / N
# 出力
print(ans)
| 17 | 13 | 209 | 213 | N, K = list(map(int, input().split()))
def f(x):
k = 0
while x < K:
x *= 2
k += 1
return k
ans = sum(1 / (2 ** f(i)) for i in range(1, N + 1)) / N
print(ans)
| from math import ceil
# 入力
N, K = list(map(int, input().split()))
# サイコロの各目について勝率を求め、それらの和を解とする
ans = sum(1 / (2 ** ((ceil(K / i) - 1).bit_length())) for i in range(1, N + 1)) / N
# 出力
print(ans)
| false | 23.529412 | [
"+from math import ceil",
"+",
"+# 入力",
"-",
"-",
"-def f(x):",
"- k = 0",
"- while x < K:",
"- x *= 2",
"- k += 1",
"- return k",
"-",
"-",
"-ans = sum(1 / (2 ** f(i)) for i in range(1, N + 1)) / N",
"+# サイコロの各目について勝率を求め、それらの和を解とする",
"+ans = sum(1 / (2 ** ((ceil... | false | 0.057258 | 0.067049 | 0.853978 | [
"s712698603",
"s144277006"
] |
u761989513 | p03062 | python | s380194525 | s679063409 | 221 | 70 | 25,588 | 14,412 | Accepted | Accepted | 68.33 | n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0] * 2 for i in range(n + 1)]
# dp[i + 1][j] := i 番目までの最大値(j = 1 なら a[i] の符号反転)
dp[0][1] = -float("inf")
for i in range(n):
dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i])
dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i])
... | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
count = 0
for i in a:
if i < 0:
count += 1
b.append(abs(i))
if count % 2:
print((sum(b) - 2 * min(b)))
else:
print((sum(b))) | 13 | 14 | 329 | 219 | n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0] * 2 for i in range(n + 1)]
# dp[i + 1][j] := i 番目までの最大値(j = 1 なら a[i] の符号反転)
dp[0][1] = -float("inf")
for i in range(n):
dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i])
dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i])
print((dp[n][0])... | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
count = 0
for i in a:
if i < 0:
count += 1
b.append(abs(i))
if count % 2:
print((sum(b) - 2 * min(b)))
else:
print((sum(b)))
| false | 7.142857 | [
"-dp = [[0] * 2 for i in range(n + 1)]",
"-# dp[i + 1][j] := i 番目までの最大値(j = 1 なら a[i] の符号反転)",
"-dp[0][1] = -float(\"inf\")",
"-for i in range(n):",
"- dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i])",
"- dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i])",
"-print((dp[n][0]))",
"+b = []"... | false | 0.096212 | 0.037253 | 2.582653 | [
"s380194525",
"s679063409"
] |
u698771758 | p03457 | python | s063097405 | s153428666 | 360 | 325 | 27,300 | 3,060 | Accepted | Accepted | 9.72 | N=int(eval(input()))
T=[list(map(int,input().split())) for i in range(N)]
for i in range(N):
t=T[i][0]
j=T[i][1]+T[i][2]
if t<j or (t+j)%2:
print("No")
exit()
print("Yes") | N=int(eval(input()))
for i in range(N):
t,x,y=list(map(int, input().split()))
j=x+y
if t<j or (t+j)%2:
print("No")
exit()
print("Yes") | 9 | 8 | 201 | 157 | N = int(eval(input()))
T = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
t = T[i][0]
j = T[i][1] + T[i][2]
if t < j or (t + j) % 2:
print("No")
exit()
print("Yes")
| N = int(eval(input()))
for i in range(N):
t, x, y = list(map(int, input().split()))
j = x + y
if t < j or (t + j) % 2:
print("No")
exit()
print("Yes")
| false | 11.111111 | [
"-T = [list(map(int, input().split())) for i in range(N)]",
"- t = T[i][0]",
"- j = T[i][1] + T[i][2]",
"+ t, x, y = list(map(int, input().split()))",
"+ j = x + y"
] | false | 0.037101 | 0.036587 | 1.01405 | [
"s063097405",
"s153428666"
] |
u847467233 | p00196 | python | s270215585 | s710674943 | 30 | 20 | 5,604 | 5,608 | Accepted | Accepted | 33.33 | # AOJ 0196 Baseball Championship
# Python3 2018.6.21 bal4u
while 1:
n = int(eval(input()))
if n == 0: break
team = []
for i in range(n):
r = list(eval(input()))
t = r.pop(0)
w = l = 0
for p in r:
if p.isdigit() == False: pass
elif int(p) == 0: w += 1 # 勝ち数
elif int(p) == 1: l +=... | # AOJ 0196 Baseball Championship
# Python3 2018.6.21 bal4u
while 1:
n = int(eval(input()))
if n == 0: break
team = []
for i in range(n):
r = list(input().split())
t = r.pop(0)
w = l = 0
for p in r:
if int(p) == 0: w += 1 # 勝ち数
elif int(p) == 1: l += 1 # 負け数
team.append((t, i, ... | 18 | 17 | 423 | 393 | # AOJ 0196 Baseball Championship
# Python3 2018.6.21 bal4u
while 1:
n = int(eval(input()))
if n == 0:
break
team = []
for i in range(n):
r = list(eval(input()))
t = r.pop(0)
w = l = 0
for p in r:
if p.isdigit() == False:
pass
... | # AOJ 0196 Baseball Championship
# Python3 2018.6.21 bal4u
while 1:
n = int(eval(input()))
if n == 0:
break
team = []
for i in range(n):
r = list(input().split())
t = r.pop(0)
w = l = 0
for p in r:
if int(p) == 0:
w += 1 # 勝ち数
... | false | 5.555556 | [
"- r = list(eval(input()))",
"+ r = list(input().split())",
"- if p.isdigit() == False:",
"- pass",
"- elif int(p) == 0:",
"+ if int(p) == 0:"
] | false | 0.061813 | 0.062826 | 0.983866 | [
"s270215585",
"s710674943"
] |
u966364923 | p00741 | python | s163249313 | s376779162 | 70 | 60 | 9,636 | 9,636 | Accepted | Accepted | 14.29 | import sys
def dfs(tiles, W, H, x, y):
tiles[y][x] = '0'
for dx,dy in ((-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)):
if 0<=x+dx<W and 0<=y+dy<H and tiles[y+dy][x+dx]=='1':
dfs(tiles, W, H, x+dx, y+dy)
return
def main():
while True:
W,H = [int(x) fo... | import sys
def dfs(tiles, W, H, x, y):
tiles[y][x] = '0'
for dx,dy in ((-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)):
if 0<=x+dx<W and 0<=y+dy<H and tiles[y+dy][x+dx]=='1':
dfs(tiles, W, H, x+dx, y+dy)
return
def main():
while True:
W,H = [int(x) fo... | 25 | 25 | 744 | 730 | import sys
def dfs(tiles, W, H, x, y):
tiles[y][x] = "0"
for dx, dy in (
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
):
if 0 <= x + dx < W and 0 <= y + dy < H and tiles[y + dy][x + dx] == "1":
dfs... | import sys
def dfs(tiles, W, H, x, y):
tiles[y][x] = "0"
for dx, dy in (
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
):
if 0 <= x + dx < W and 0 <= y + dy < H and tiles[y + dy][x + dx] == "1":
dfs... | false | 0 | [
"- tiles = [[c for c in input().split()] for h in range(H)]",
"+ tiles = [input().split() for h in range(H)]",
"- sys.setrecursionlimit(100000)",
"+ sys.setrecursionlimit(10000)"
] | false | 0.1768 | 0.007856 | 22.504109 | [
"s163249313",
"s376779162"
] |
u827202523 | p02945 | python | s703740218 | s585577740 | 179 | 64 | 38,384 | 61,540 | Accepted | Accepted | 64.25 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
a, b = getList()
print((max([a+b, a-b, a*b])))
# print(ans) | import sys
# from collections import defaultdict, deque
# import math
# import copy
# from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda... | 15 | 31 | 249 | 653 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
a, b = getList()
print((max([a + b, a - b, a * b])))
# print(ans)
| import sys
# from collections import defaultdict, deque
# import math
# import copy
# from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, ... | false | 51.612903 | [
"+# from collections import defaultdict, deque",
"+# import math",
"+# import copy",
"+# from bisect import bisect_left, bisect_right",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"-sys.setrecursionlimit(100000)",
"+getS = lambda: input().strip()",
"+getN = lambda: ... | false | 0.047035 | 0.036326 | 1.294799 | [
"s703740218",
"s585577740"
] |
u934442292 | p02888 | python | s110634754 | s387534893 | 941 | 700 | 9,300 | 9,336 | Accepted | Accepted | 25.61 | import sys
from bisect import bisect_left
input = sys.stdin.readline
def main():
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for a in range(N - 2):
for b in range(a + 1, N - 1):
x = bisect_left(L, L[a] + L[b], lo=b)
a... | import sys
from bisect import bisect_left
input = sys.stdin.readline
def main():
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for a in range(N - 2):
for b in range(a + 1, N - 1):
x = bisect_left(L, L[a] + L[b])
ans += ... | 22 | 22 | 394 | 388 | import sys
from bisect import bisect_left
input = sys.stdin.readline
def main():
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for a in range(N - 2):
for b in range(a + 1, N - 1):
x = bisect_left(L, L[a] + L[b], lo=b)
ans += x - 1 - b
... | import sys
from bisect import bisect_left
input = sys.stdin.readline
def main():
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for a in range(N - 2):
for b in range(a + 1, N - 1):
x = bisect_left(L, L[a] + L[b])
ans += x - 1 - b
pr... | false | 0 | [
"- x = bisect_left(L, L[a] + L[b], lo=b)",
"+ x = bisect_left(L, L[a] + L[b])"
] | false | 0.03677 | 0.046367 | 0.793018 | [
"s110634754",
"s387534893"
] |
u137912513 | p03545 | python | s176657110 | s610439708 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | str_input = list(eval(input()))
for i in range(2**3):
ope = ['-'] * 3
siki = ''
for j in range(3):
if(i>>j)&1:
ope[j] = '+'
for moji, op in zip(str_input, ope+['']):
siki +=(moji+op)
ans = eval(siki)
if ans == 7:
print((siki + '=7'))
break
| moji = list(input())
x = len(moji) -1
for i in range(2**x):
ope = ['-'] * 3
formula = ''
for j in range(x):
if (i>>j)&1:
ope[j] = '+'
for mo,op in zip(moji, ope+['']):
formula += (mo+op)
if eval(formula) == 7:
print(formula, '=7', sep='')
break... | 13 | 13 | 312 | 321 | str_input = list(eval(input()))
for i in range(2**3):
ope = ["-"] * 3
siki = ""
for j in range(3):
if (i >> j) & 1:
ope[j] = "+"
for moji, op in zip(str_input, ope + [""]):
siki += moji + op
ans = eval(siki)
if ans == 7:
print((siki + "=7"))
break
| moji = list(input())
x = len(moji) - 1
for i in range(2**x):
ope = ["-"] * 3
formula = ""
for j in range(x):
if (i >> j) & 1:
ope[j] = "+"
for mo, op in zip(moji, ope + [""]):
formula += mo + op
if eval(formula) == 7:
print(formula, "=7", sep="")
break
| false | 0 | [
"-str_input = list(eval(input()))",
"-for i in range(2**3):",
"+moji = list(input())",
"+x = len(moji) - 1",
"+for i in range(2**x):",
"- siki = \"\"",
"- for j in range(3):",
"+ formula = \"\"",
"+ for j in range(x):",
"- for moji, op in zip(str_input, ope + [\"\"]):",
"- ... | false | 0.048743 | 0.049249 | 0.989721 | [
"s176657110",
"s610439708"
] |
u372550522 | p02848 | python | s765791259 | s022179491 | 30 | 20 | 3,772 | 3,060 | Accepted | Accepted | 33.33 | from string import ascii_uppercase as upper
n = int(eval(input()))
s = eval(input())
t = ''
for i in range(len(s)):
t += upper[(upper.find(s[i]) + n) % 26]
print(t) | n = int(eval(input()))
s = eval(input())
t = [chr((ord(s[i])-65+n) % 26 + 65) for i in range(len(s))]
print((''.join(t))) | 8 | 4 | 164 | 110 | from string import ascii_uppercase as upper
n = int(eval(input()))
s = eval(input())
t = ""
for i in range(len(s)):
t += upper[(upper.find(s[i]) + n) % 26]
print(t)
| n = int(eval(input()))
s = eval(input())
t = [chr((ord(s[i]) - 65 + n) % 26 + 65) for i in range(len(s))]
print(("".join(t)))
| false | 50 | [
"-from string import ascii_uppercase as upper",
"-",
"-t = \"\"",
"-for i in range(len(s)):",
"- t += upper[(upper.find(s[i]) + n) % 26]",
"-print(t)",
"+t = [chr((ord(s[i]) - 65 + n) % 26 + 65) for i in range(len(s))]",
"+print((\"\".join(t)))"
] | false | 0.048366 | 0.050291 | 0.961715 | [
"s765791259",
"s022179491"
] |
u888092736 | p03127 | python | s197959522 | s676845960 | 86 | 79 | 13,168 | 13,296 | Accepted | Accepted | 8.14 | from fractions import gcd
eval(input())
A = list(map(int, input().split()))
ans = next(A)
for a in A:
ans = gcd(ans, a)
print(ans)
| from fractions import gcd
from functools import reduce
eval(input())
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| 9 | 7 | 133 | 123 | from fractions import gcd
eval(input())
A = list(map(int, input().split()))
ans = next(A)
for a in A:
ans = gcd(ans, a)
print(ans)
| from fractions import gcd
from functools import reduce
eval(input())
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| false | 22.222222 | [
"+from functools import reduce",
"-ans = next(A)",
"-for a in A:",
"- ans = gcd(ans, a)",
"-print(ans)",
"+print((reduce(gcd, A)))"
] | false | 0.091404 | 0.134223 | 0.680982 | [
"s197959522",
"s676845960"
] |
u186082958 | p00061 | python | s261441864 | s019995097 | 30 | 20 | 7,568 | 7,560 | Accepted | Accepted | 33.33 | import itertools
from operator import itemgetter
nums={}
while True:
p,s=list(map(int,input().split(',')))
if(p==0 and s==0):break
if not s in nums:
nums[s]=[]
nums[s].append(p)
while True:
try:
q=int(eval(input()))
ans=len(nums)
for ns in list(nums.i... | nums={}
while True:
p,s=list(map(int,input().split(',')))
if(p==0 and s==0):break
if not s in nums:
nums[s]=[]
nums[s].append(p)
while True:
try:
q=int(eval(input()))
ans=len(nums)
for ns in list(nums.items()):
if q in ns[1]:
... | 25 | 19 | 455 | 384 | import itertools
from operator import itemgetter
nums = {}
while True:
p, s = list(map(int, input().split(",")))
if p == 0 and s == 0:
break
if not s in nums:
nums[s] = []
nums[s].append(p)
while True:
try:
q = int(eval(input()))
ans = len(nums)
for ns in lis... | nums = {}
while True:
p, s = list(map(int, input().split(",")))
if p == 0 and s == 0:
break
if not s in nums:
nums[s] = []
nums[s].append(p)
while True:
try:
q = int(eval(input()))
ans = len(nums)
for ns in list(nums.items()):
if q in ns[1]:
... | false | 24 | [
"-import itertools",
"-from operator import itemgetter",
"-"
] | false | 0.042868 | 0.043147 | 0.993525 | [
"s261441864",
"s019995097"
] |
u127499732 | p02720 | python | s589321937 | s119635074 | 65 | 47 | 18,996 | 18,312 | Accepted | Accepted | 27.69 | def main():
from collections import deque
k = int(eval(input()))
ans = 0
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
x = 0
for _ in range(k):
x = que.popleft()
p = x % 10
e = 10 * x
if p != 0:
a = e + p - 1
que.append(a)
... | def LunLun(k, count, base):
nx = []
n = len(base)
if count + n >= k:
print((base[k - count - 1]))
return
for x in base:
count += 1
p = x % 10
x *= 10
a = x + p - 1
b = a + 1
c = b + 1
n = 3
if p == 0:
... | 24 | 34 | 480 | 642 | def main():
from collections import deque
k = int(eval(input()))
ans = 0
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
x = 0
for _ in range(k):
x = que.popleft()
p = x % 10
e = 10 * x
if p != 0:
a = e + p - 1
que.append(a)
b = e + p
... | def LunLun(k, count, base):
nx = []
n = len(base)
if count + n >= k:
print((base[k - count - 1]))
return
for x in base:
count += 1
p = x % 10
x *= 10
a = x + p - 1
b = a + 1
c = b + 1
n = 3
if p == 0:
n -= 1
... | false | 29.411765 | [
"+def LunLun(k, count, base):",
"+ nx = []",
"+ n = len(base)",
"+ if count + n >= k:",
"+ print((base[k - count - 1]))",
"+ return",
"+ for x in base:",
"+ count += 1",
"+ p = x % 10",
"+ x *= 10",
"+ a = x + p - 1",
"+ b = a + 1",
... | false | 0.04164 | 0.040506 | 1.028003 | [
"s589321937",
"s119635074"
] |
u968404618 | p02707 | python | s947495008 | s618561961 | 186 | 149 | 33,864 | 32,348 | Accepted | Accepted | 19.89 | import collections
n = int(eval(input()))
A = list(map(int, input().split()))
C = collections.Counter(A)
for i in range(1, n+1):
print((C[i]))
| n = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * n
for a in A:
ans[a-1] += 1
for i in ans:
print(i) | 8 | 10 | 146 | 135 | import collections
n = int(eval(input()))
A = list(map(int, input().split()))
C = collections.Counter(A)
for i in range(1, n + 1):
print((C[i]))
| n = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * n
for a in A:
ans[a - 1] += 1
for i in ans:
print(i)
| false | 20 | [
"-import collections",
"-",
"-C = collections.Counter(A)",
"-for i in range(1, n + 1):",
"- print((C[i]))",
"+ans = [0] * n",
"+for a in A:",
"+ ans[a - 1] += 1",
"+for i in ans:",
"+ print(i)"
] | false | 0.03937 | 0.039829 | 0.988469 | [
"s947495008",
"s618561961"
] |
u659753499 | p03425 | python | s991930671 | s095185887 | 208 | 156 | 3,316 | 3,060 | Accepted | Accepted | 25 | from itertools import combinations
from collections import Counter
N = int(eval(input()))
S = Counter()
for _ in range(N):
S[input()[0]] += 1
print((sum([S[p0]*S[p1]*S[p2] for p0,p1,p2 in combinations('MARCH', 3)])))
quit()
| from itertools import combinations
N = int(eval(input()))
d = [0]*128
for _ in range(N): d[ord(input()[0])] += 1
print((sum([d[ord(p0)]*d[ord(p1)]*d[ord(p2)] for p0,p1,p2 in combinations('MARCH', 3)])))
| 8 | 5 | 225 | 199 | from itertools import combinations
from collections import Counter
N = int(eval(input()))
S = Counter()
for _ in range(N):
S[input()[0]] += 1
print((sum([S[p0] * S[p1] * S[p2] for p0, p1, p2 in combinations("MARCH", 3)])))
quit()
| from itertools import combinations
N = int(eval(input()))
d = [0] * 128
for _ in range(N):
d[ord(input()[0])] += 1
print(
(
sum(
[
d[ord(p0)] * d[ord(p1)] * d[ord(p2)]
for p0, p1, p2 in combinations("MARCH", 3)
]
)
)
)
| false | 37.5 | [
"-from collections import Counter",
"-S = Counter()",
"+d = [0] * 128",
"- S[input()[0]] += 1",
"-print((sum([S[p0] * S[p1] * S[p2] for p0, p1, p2 in combinations(\"MARCH\", 3)])))",
"-quit()",
"+ d[ord(input()[0])] += 1",
"+print(",
"+ (",
"+ sum(",
"+ [",
"+ ... | false | 0.037864 | 0.035161 | 1.076884 | [
"s991930671",
"s095185887"
] |
u600402037 | p03112 | python | s799768379 | s251995360 | 1,734 | 1,115 | 12,824 | 17,640 | Accepted | Accepted | 35.7 | import bisect
import itertools
A, B, Q = list(map(int, input().split()))
INF = 10 ** 15
S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(Q):
answer = INF
x = int(eval(input()))
si = bisect.bisect_left(S, x) ... | import bisect
import itertools
A,B,Q = list(map(int,input().split()))
# 簡略化のため常に左右に存在するようにしておく
INF = 10 ** 15
S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
X = [int(eval(input())) for _ in range(Q)]
def solve(x):
# xの位置
i = bi... | 17 | 25 | 508 | 581 | import bisect
import itertools
A, B, Q = list(map(int, input().split()))
INF = 10**15
S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(Q):
answer = INF
x = int(eval(input()))
si = bisect.bisect_left(S, x)
ti = bisect.... | import bisect
import itertools
A, B, Q = list(map(int, input().split()))
# 簡略化のため常に左右に存在するようにしておく
INF = 10**15
S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
X = [int(eval(input())) for _ in range(Q)]
def solve(x):
# xの位置
i = bisect.bis... | false | 32 | [
"+# 簡略化のため常に左右に存在するようにしておく",
"-for _ in range(Q):",
"- answer = INF",
"- x = int(eval(input()))",
"- si = bisect.bisect_left(S, x)",
"- ti = bisect.bisect_left(T, x)",
"- for s, t in itertools.product(S[si - 1 : si + 1], T[ti - 1 : ti + 1]):",
"+X = [int(eval(input())) for _ in range(Q)... | false | 0.043979 | 0.045408 | 0.968524 | [
"s799768379",
"s251995360"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.