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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u475675023 | p03524 | python | s826834956 | s628276491 | 24 | 19 | 4,084 | 3,188 | Accepted | Accepted | 20.83 | s=eval(input())
a=s.count('a')
b=s.count('b')
c=s.count('c')
if len(set(list(s)))==1 and len(s)>1:
print('NO')
elif len(set(list(s)))==2 and len(s)>2:
print('NO')
elif abs(a-b)<=1 and abs(b-c)<=1 and abs(c-a)<=1:
print('YES')
else:
print('NO') | s=eval(input())
a=s.count('a')
b=s.count('b')
c=s.count('c')
if abs(a-b)<=1 and abs(b-c)<=1 and abs(c-a)<=1:
print('YES')
else:
print('NO') | 12 | 8 | 256 | 144 | s = eval(input())
a = s.count("a")
b = s.count("b")
c = s.count("c")
if len(set(list(s))) == 1 and len(s) > 1:
print("NO")
elif len(set(list(s))) == 2 and len(s) > 2:
print("NO")
elif abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1:
print("YES")
else:
print("NO")
| s = eval(input())
a = s.count("a")
b = s.count("b")
c = s.count("c")
if abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1:
print("YES")
else:
print("NO")
| false | 33.333333 | [
"-if len(set(list(s))) == 1 and len(s) > 1:",
"- print(\"NO\")",
"-elif len(set(list(s))) == 2 and len(s) > 2:",
"- print(\"NO\")",
"-elif abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1:",
"+if abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1:"
] | false | 0.114618 | 0.03421 | 3.350398 | [
"s826834956",
"s628276491"
] |
u133936772 | p03503 | python | s093466136 | s479516885 | 211 | 59 | 3,188 | 3,188 | Accepted | Accepted | 72.04 | f=lambda:[list(map(int,input().split())) for _ in range(n)]
n=int(eval(input()))
llf,llp=f(),f()
a=-10**9
import itertools as it
for t in it.product([0,1],repeat=10):
if sum(t):
lc=[sum(t[i]*lf[i] for i in range(10)) for lf in llf]
a=max(a,sum(llp[i][lc[i]] for i in range(n)))
print(a) | I=input;R=range;n=int(I())
lf=[int(I()[::2],2) for _ in R(n)]
lp=[list(map(int,I().split())) for _ in R(n)]
print((max(sum(p[bin(i&f).count('1')] for f,p in zip(lf,lp)) for i in R(1,1024)))) | 10 | 4 | 299 | 191 | f = lambda: [list(map(int, input().split())) for _ in range(n)]
n = int(eval(input()))
llf, llp = f(), f()
a = -(10**9)
import itertools as it
for t in it.product([0, 1], repeat=10):
if sum(t):
lc = [sum(t[i] * lf[i] for i in range(10)) for lf in llf]
a = max(a, sum(llp[i][lc[i]] for i in range(n))... | I = input
R = range
n = int(I())
lf = [int(I()[::2], 2) for _ in R(n)]
lp = [list(map(int, I().split())) for _ in R(n)]
print((max(sum(p[bin(i & f).count("1")] for f, p in zip(lf, lp)) for i in R(1, 1024))))
| false | 60 | [
"-f = lambda: [list(map(int, input().split())) for _ in range(n)]",
"-n = int(eval(input()))",
"-llf, llp = f(), f()",
"-a = -(10**9)",
"-import itertools as it",
"-",
"-for t in it.product([0, 1], repeat=10):",
"- if sum(t):",
"- lc = [sum(t[i] * lf[i] for i in range(10)) for lf in llf]",... | false | 0.062973 | 0.038158 | 1.650315 | [
"s093466136",
"s479516885"
] |
u970269944 | p00462 | python | s676019758 | s505429009 | 370 | 340 | 16,380 | 15,572 | Accepted | Accepted | 8.11 | mapping = {}
def find(l, e, start, end):
global mapping
if e in mapping:
return mapping[e]
mid = (start+end)//2
if (l[mid] == e):
mapping[e] = (e, e)
return mapping[e]
elif (l[mid] > e):
if (l[mid-1] < e):
mapping[e] = (l[mid-1], l[mid])
return mapping[e]
return find(l, e, start, mid)
... | def find(l, e, start, end):
mid = (start+end)//2
if (l[mid] == e):
return (e, e)
elif (l[mid] > e):
if (l[mid-1] < e):
return (l[mid-1], l[mid])
return find(l, e, start, mid)
elif (l[mid] < e):
if (l[mid+1] > e):
return (l[mid], l[mid+1])
return find(l, e, mid, end)
def print_sum(input... | 42 | 33 | 960 | 773 | mapping = {}
def find(l, e, start, end):
global mapping
if e in mapping:
return mapping[e]
mid = (start + end) // 2
if l[mid] == e:
mapping[e] = (e, e)
return mapping[e]
elif l[mid] > e:
if l[mid - 1] < e:
mapping[e] = (l[mid - 1], l[mid])
re... | def find(l, e, start, end):
mid = (start + end) // 2
if l[mid] == e:
return (e, e)
elif l[mid] > e:
if l[mid - 1] < e:
return (l[mid - 1], l[mid])
return find(l, e, start, mid)
elif l[mid] < e:
if l[mid + 1] > e:
return (l[mid], l[mid + 1])
... | false | 21.428571 | [
"-mapping = {}",
"-",
"-",
"- global mapping",
"- if e in mapping:",
"- return mapping[e]",
"- mapping[e] = (e, e)",
"- return mapping[e]",
"+ return (e, e)",
"- mapping[e] = (l[mid - 1], l[mid])",
"- return mapping[e]",
"+ ret... | false | 0.112596 | 0.104598 | 1.076466 | [
"s676019758",
"s505429009"
] |
u281610856 | p02723 | python | s028879304 | s721591275 | 41 | 18 | 3,060 | 2,940 | Accepted | Accepted | 56.1 | s = eval(input())
if s[2] == s[3] and s[4] == s[5]:
print('Yes')
else:
print('No') | import sys
input = sys.stdin.readline
def main():
s = eval(input())
if s[2] == s[3] and s[4] == s[5]:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main() | 5 | 13 | 88 | 207 | s = eval(input())
if s[2] == s[3] and s[4] == s[5]:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
def main():
s = eval(input())
if s[2] == s[3] and s[4] == s[5]:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 61.538462 | [
"-s = eval(input())",
"-if s[2] == s[3] and s[4] == s[5]:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ s = eval(input())",
"+ if s[2] == s[3] and s[4] == s[5]:",
"+ print(\"Yes\")",
"... | false | 0.040285 | 0.076033 | 0.529831 | [
"s028879304",
"s721591275"
] |
u644907318 | p03229 | python | s258527446 | s157885009 | 646 | 203 | 60,248 | 95,044 | Accepted | Accepted | 68.58 | from collections import deque
N = int(eval(input()))
A = deque(sorted([int(eval(input())) for _ in range(N)]))
B = deque([])
B.append(A.popleft())
cnt = 0
while A:
a0 = A[0]
a1 = A[-1]
b0 = B[0]
b1 = B[-1]
c00 = abs(a0-b0)
c01 = abs(a0-b1)
c10 = abs(a1-b0)
c11 = abs(a1-b1)
... | N = int(eval(input()))
A = sorted([int(eval(input())) for _ in range(N)])
if N%2==0:
B = A[:N//2]
C = A[N//2:]
C = C[::-1]
D1 = []
D2 = []
for i in range(N//2-1):
D1.append(B[i])
D1.append(C[i])
D2.append(C[i])
D2.append(B[i])
D1.append(B[-1])
... | 26 | 42 | 571 | 991 | from collections import deque
N = int(eval(input()))
A = deque(sorted([int(eval(input())) for _ in range(N)]))
B = deque([])
B.append(A.popleft())
cnt = 0
while A:
a0 = A[0]
a1 = A[-1]
b0 = B[0]
b1 = B[-1]
c00 = abs(a0 - b0)
c01 = abs(a0 - b1)
c10 = abs(a1 - b0)
c11 = abs(a1 - b1)
c... | N = int(eval(input()))
A = sorted([int(eval(input())) for _ in range(N)])
if N % 2 == 0:
B = A[: N // 2]
C = A[N // 2 :]
C = C[::-1]
D1 = []
D2 = []
for i in range(N // 2 - 1):
D1.append(B[i])
D1.append(C[i])
D2.append(C[i])
D2.append(B[i])
D1.append(B[-1])
... | false | 38.095238 | [
"-from collections import deque",
"-",
"-A = deque(sorted([int(eval(input())) for _ in range(N)]))",
"-B = deque([])",
"-B.append(A.popleft())",
"-cnt = 0",
"-while A:",
"- a0 = A[0]",
"- a1 = A[-1]",
"- b0 = B[0]",
"- b1 = B[-1]",
"- c00 = abs(a0 - b0)",
"- c01 = abs(a0 - ... | false | 0.040755 | 0.076485 | 0.532855 | [
"s258527446",
"s157885009"
] |
u748241164 | p03835 | python | s692697699 | s351549572 | 1,468 | 1,042 | 2,940 | 9,160 | Accepted | Accepted | 29.02 | K, S = list(map(int, input().split()))
count= 0
for i in range(K+1):# X
for j in range(K+1):#Y
Z = S - i - j
if 0 <= Z <= K:
count += 1
#print(i,j,Z)
print(count) | K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
#print(i, j)
if 0 <= S - i - j <= K:
ans += 1
print(ans) | 11 | 10 | 190 | 182 | K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1): # X
for j in range(K + 1): # Y
Z = S - i - j
if 0 <= Z <= K:
count += 1
# print(i,j,Z)
print(count)
| K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
# print(i, j)
if 0 <= S - i - j <= K:
ans += 1
print(ans)
| false | 9.090909 | [
"-count = 0",
"-for i in range(K + 1): # X",
"- for j in range(K + 1): # Y",
"- Z = S - i - j",
"- if 0 <= Z <= K:",
"- count += 1",
"- # print(i,j,Z)",
"-print(count)",
"+ans = 0",
"+for i in range(K + 1):",
"+ for j in range(K + 1):",
"+ # p... | false | 0.055113 | 0.140604 | 0.391972 | [
"s692697699",
"s351549572"
] |
u935558307 | p02990 | python | s848538600 | s425604097 | 480 | 275 | 79,856 | 167,936 | Accepted | Accepted | 42.71 | """
問題文は言い換えると、青いボールの連続する区間の数がi個になるような並べ方はいくつあるか。というもの
上記のような並べ方はさらに4種類に分けられる。
(1). 両端が青色になるような並べ方
(2). 両端が赤色になるような並べ方
(3). 左端が赤色、右端が青色になるような並べ方
(4). 左端が青色、右端が赤色になるような並べ方
(1)の場合:A(K個並んでいるの青ボールの隙間にi-1個の赤ボールグループをぶっこむ箇所の場合の数) × B(i-1個のグループに割り振る赤ボールの数)
Aは(k-1)個の隙間から(i-1)個の隙間を選ぶ場合の数なので、(k-1)C(i-1)で計算できる。Bは各グループに... | """
Kをi分割する場合の数=cmb(K+i-1,i-1)
両端が赤になる場合、両端が青になる場合、左端のみ赤になる場合、右端のみ赤になる場合についてそれぞれ計算すればよい。
"""
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 10 ** 9 + 7
N = 10 ** 6 # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod ... | 52 | 39 | 1,458 | 1,016 | """
問題文は言い換えると、青いボールの連続する区間の数がi個になるような並べ方はいくつあるか。というもの
上記のような並べ方はさらに4種類に分けられる。
(1). 両端が青色になるような並べ方
(2). 両端が赤色になるような並べ方
(3). 左端が赤色、右端が青色になるような並べ方
(4). 左端が青色、右端が赤色になるような並べ方
(1)の場合:A(K個並んでいるの青ボールの隙間にi-1個の赤ボールグループをぶっこむ箇所の場合の数) × B(i-1個のグループに割り振る赤ボールの数)
Aは(k-1)個の隙間から(i-1)個の隙間を選ぶ場合の数なので、(k-1)C(i-1)で計算できる。Bは各グループに最低1個は赤色のボールを... | """
Kをi分割する場合の数=cmb(K+i-1,i-1)
両端が赤になる場合、両端が青になる場合、左端のみ赤になる場合、右端のみ赤になる場合についてそれぞれ計算すればよい。
"""
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
p = 10**9 + 7
N = 10**6 # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p)
factinv ... | false | 25 | [
"-問題文は言い換えると、青いボールの連続する区間の数がi個になるような並べ方はいくつあるか。というもの",
"-上記のような並べ方はさらに4種類に分けられる。",
"-(1). 両端が青色になるような並べ方",
"-(2). 両端が赤色になるような並べ方",
"-(3). 左端が赤色、右端が青色になるような並べ方",
"-(4). 左端が青色、右端が赤色になるような並べ方",
"-(1)の場合:A(K個並んでいるの青ボールの隙間にi-1個の赤ボールグループをぶっこむ箇所の場合の数) × B(i-1個のグループに割り振る赤ボールの数)",
"-Aは(k-1)個の隙間から(i-1)個の隙間を選ぶ場合... | false | 0.040388 | 1.949591 | 0.020716 | [
"s848538600",
"s425604097"
] |
u997641430 | p02642 | python | s718985336 | s564519389 | 1,244 | 417 | 104,020 | 218,320 | Accepted | Accepted | 66.48 | n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
if C[a] > 0:
tmp = 2
while a * tmp <= maxA:
D[a * tmp] = 1
t... | n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
C = {a: 0 for a in A}
for a in A:
C[a] += 1
D = {a: 0 for a in A}
for a in A:
if C[a] > 1:
D[a] = 1
for b in range(2 * a, maxA + 1, a):
D[b] = 1
print((sum([D[a] == 0 for a in A])))
| 20 | 13 | 401 | 283 | n = int(eval(input()))
(*A,) = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
if C[a] > 0:
tmp = 2
while a * tmp <= maxA:
D[a * tmp] = 1
tmp += 1
ans ... | n = int(eval(input()))
(*A,) = list(map(int, input().split()))
maxA = max(A)
C = {a: 0 for a in A}
for a in A:
C[a] += 1
D = {a: 0 for a in A}
for a in A:
if C[a] > 1:
D[a] = 1
for b in range(2 * a, maxA + 1, a):
D[b] = 1
print((sum([D[a] == 0 for a in A])))
| false | 35 | [
"-# C[a] = A内のaの個数",
"-# D[a]=1: Aにaより小さいaの約数が存在する",
"- if C[a] > 0:",
"- tmp = 2",
"- while a * tmp <= maxA:",
"- D[a * tmp] = 1",
"- tmp += 1",
"-ans = 0",
"-for a in A:",
"- if C[a] == 1 and D[a] == 0:",
"- ans += 1",
"-print(ans)",
"+ i... | false | 0.12944 | 0.067602 | 1.914743 | [
"s718985336",
"s564519389"
] |
u047102107 | p02862 | python | s037782822 | s448571464 | 485 | 234 | 40,172 | 72,704 | Accepted | Accepted | 51.75 | X, Y = list(map(int, input().split()))
MOD = int(1e9 + 7)
def modinv(a, mod=MOD):
return pow(a, mod-2, mod)
def combination(n, r, mod=MOD):
r = min(r, n - r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i+1, mod) % mod
return res
if (X + Y) % 3 != 0:
print((0)... | # https://atcoder.jp/contests/abc145/tasks/abc145_d
X, Y = list(map(int, input().split()))
MOD = int(1e9 + 7)
def combination(n, r, mod=MOD):
def modinv(a, mod=MOD):
return pow(a, mod-2, mod)
# nCr with MOD
r = min(r, n - r)
res = 1
for i in range(r):
res = res * (n - i... | 26 | 35 | 455 | 761 | X, Y = list(map(int, input().split()))
MOD = int(1e9 + 7)
def modinv(a, mod=MOD):
return pow(a, mod - 2, mod)
def combination(n, r, mod=MOD):
r = min(r, n - r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i + 1, mod) % mod
return res
if (X + Y) % 3 != 0:
print((0))
e... | # https://atcoder.jp/contests/abc145/tasks/abc145_d
X, Y = list(map(int, input().split()))
MOD = int(1e9 + 7)
def combination(n, r, mod=MOD):
def modinv(a, mod=MOD):
return pow(a, mod - 2, mod)
# nCr with MOD
r = min(r, n - r)
res = 1
for i in range(r):
res = res * (n - i) * modin... | false | 25.714286 | [
"+# https://atcoder.jp/contests/abc145/tasks/abc145_d",
"-def modinv(a, mod=MOD):",
"- return pow(a, mod - 2, mod)",
"+def combination(n, r, mod=MOD):",
"+ def modinv(a, mod=MOD):",
"+ return pow(a, mod - 2, mod)",
"-",
"-def combination(n, r, mod=MOD):",
"+ # nCr with MOD",
"+# 1回... | false | 0.511871 | 0.436356 | 1.173059 | [
"s037782822",
"s448571464"
] |
u129978636 | p03944 | python | s669222889 | s639785960 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | w,h,n=list(map(int,input().split()))
x=[]
y=[]
a=[]
ax=0
ix=w
ay=0
iy=h
for i in range(n):
x1,y1,a1=list(map(int,input().split()))
x.append(x1)
y.append(y1)
a.append(a1)
for j in range(n):
if(a[j]==1):
ax=max(ax,x[j])
elif(a[j]==2):
ix=min(ix,x[j])
elif(... | w,h,n=list(map(int,input().split()))
ax=0
ix=w
ay=0
iy=h
for i in range(n):
x,y,a=list(map(int,input().split()))
if(a==1):
ax=max(ax,x)
elif(a==2):
ix=min(ix,x)
elif(a==3):
ay=max(ay,y)
else:
iy=min(iy,y)
if(ax>=ix or ay>=iy):
print('0')
e... | 31 | 23 | 468 | 350 | w, h, n = list(map(int, input().split()))
x = []
y = []
a = []
ax = 0
ix = w
ay = 0
iy = h
for i in range(n):
x1, y1, a1 = list(map(int, input().split()))
x.append(x1)
y.append(y1)
a.append(a1)
for j in range(n):
if a[j] == 1:
ax = max(ax, x[j])
elif a[j] == 2:
ix = min(ix, x[j])... | w, h, n = list(map(int, input().split()))
ax = 0
ix = w
ay = 0
iy = h
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
ax = max(ax, x)
elif a == 2:
ix = min(ix, x)
elif a == 3:
ay = max(ay, y)
else:
iy = min(iy, y)
if ax >= ix or ay >= iy:
p... | false | 25.806452 | [
"-x = []",
"-y = []",
"-a = []",
"- x1, y1, a1 = list(map(int, input().split()))",
"- x.append(x1)",
"- y.append(y1)",
"- a.append(a1)",
"-for j in range(n):",
"- if a[j] == 1:",
"- ax = max(ax, x[j])",
"- elif a[j] == 2:",
"- ix = min(ix, x[j])",
"- elif a... | false | 0.065342 | 0.067506 | 0.967942 | [
"s669222889",
"s639785960"
] |
u761320129 | p03416 | python | s423626594 | s565540311 | 65 | 53 | 3,736 | 2,940 | Accepted | Accepted | 18.46 | A,B = list(map(int,input().split()))
print(([str(n)==str(n)[::-1] for n in range(A,B+1)].count(True))) | A,B = list(map(int,input().split()))
ans = 0
for n in range(A,B+1):
s = str(n)
if s == s[::-1]:
ans += 1
print(ans) | 2 | 7 | 95 | 131 | A, B = list(map(int, input().split()))
print(([str(n) == str(n)[::-1] for n in range(A, B + 1)].count(True)))
| A, B = list(map(int, input().split()))
ans = 0
for n in range(A, B + 1):
s = str(n)
if s == s[::-1]:
ans += 1
print(ans)
| false | 71.428571 | [
"-print(([str(n) == str(n)[::-1] for n in range(A, B + 1)].count(True)))",
"+ans = 0",
"+for n in range(A, B + 1):",
"+ s = str(n)",
"+ if s == s[::-1]:",
"+ ans += 1",
"+print(ans)"
] | false | 0.066453 | 0.056499 | 1.176183 | [
"s423626594",
"s565540311"
] |
u254871849 | p03068 | python | s206472339 | s126334363 | 25 | 17 | 3,768 | 3,064 | Accepted | Accepted | 32 | # 2019-11-23 01:28:44(JST)
import sys
from string import ascii_lowercase as alphabet
def main():
n, s, k = sys.stdin.read().split()
n, k = list(map(int, [n, k]))
c = s[k-1]
for l in alphabet:
if l != c:
s = s.replace(l, '*')
print(s)
if __name__ == ... | # 2019-11-23 01:28:44(JST)
import sys
def main():
n, s, k = sys.stdin.read().split()
n, k = list(map(int, [n, k]))
c = s[k-1]
letters = set(s) - set(c)
for l in letters:
s = s.replace(l, '*')
print(s)
if __name__ == '__main__':
main()
| 19 | 17 | 338 | 294 | # 2019-11-23 01:28:44(JST)
import sys
from string import ascii_lowercase as alphabet
def main():
n, s, k = sys.stdin.read().split()
n, k = list(map(int, [n, k]))
c = s[k - 1]
for l in alphabet:
if l != c:
s = s.replace(l, "*")
print(s)
if __name__ == "__main__":
main()
| # 2019-11-23 01:28:44(JST)
import sys
def main():
n, s, k = sys.stdin.read().split()
n, k = list(map(int, [n, k]))
c = s[k - 1]
letters = set(s) - set(c)
for l in letters:
s = s.replace(l, "*")
print(s)
if __name__ == "__main__":
main()
| false | 10.526316 | [
"-from string import ascii_lowercase as alphabet",
"- for l in alphabet:",
"- if l != c:",
"- s = s.replace(l, \"*\")",
"+ letters = set(s) - set(c)",
"+ for l in letters:",
"+ s = s.replace(l, \"*\")"
] | false | 0.073992 | 0.062396 | 1.185839 | [
"s206472339",
"s126334363"
] |
u046158516 | p02722 | python | s643395037 | s023269231 | 159 | 94 | 67,888 | 66,656 | Accepted | Accepted | 40.88 | N=int(eval(input()))
k=2
ans=1
factors=[]
i=1
while i*i<N-1:
if (N-1)%i==0:
ans+=1
i+=1
while k*k<=N:
n=0
while pow(k,n)<=N:
if (N-pow(k,n))%(pow(k,n+1))==0:
ans+=1
break
n+=1
k+=1
print(ans) | n=int(eval(input()))
ans=set()
ans.add(n)
i=2
x = 1
while x * x <= n-1 :
if (n-1) % x == 0:
ans.add(x)
ans.add((n-1)//x)
x += 1
while i*i<=n:
t=n
while t%i==0:
t/=i
if t%i==1:
ans.add(i)
i+=1
print((len(ans)-1)) | 18 | 18 | 236 | 258 | N = int(eval(input()))
k = 2
ans = 1
factors = []
i = 1
while i * i < N - 1:
if (N - 1) % i == 0:
ans += 1
i += 1
while k * k <= N:
n = 0
while pow(k, n) <= N:
if (N - pow(k, n)) % (pow(k, n + 1)) == 0:
ans += 1
break
n += 1
k += 1
print(ans)
| n = int(eval(input()))
ans = set()
ans.add(n)
i = 2
x = 1
while x * x <= n - 1:
if (n - 1) % x == 0:
ans.add(x)
ans.add((n - 1) // x)
x += 1
while i * i <= n:
t = n
while t % i == 0:
t /= i
if t % i == 1:
ans.add(i)
i += 1
print((len(ans) - 1))
| false | 0 | [
"-N = int(eval(input()))",
"-k = 2",
"-ans = 1",
"-factors = []",
"-i = 1",
"-while i * i < N - 1:",
"- if (N - 1) % i == 0:",
"- ans += 1",
"+n = int(eval(input()))",
"+ans = set()",
"+ans.add(n)",
"+i = 2",
"+x = 1",
"+while x * x <= n - 1:",
"+ if (n - 1) % x == 0:",
"+... | false | 1.226186 | 0.365832 | 3.351774 | [
"s643395037",
"s023269231"
] |
u620084012 | p03371 | python | s111828656 | s759676083 | 232 | 205 | 3,060 | 2,940 | Accepted | Accepted | 11.64 | A,B,C,X,Y = list(map(int, input().split()))
ans = A*X+B*Y
for k in range(2*max(X,Y)+1):
ans = min(ans,2*C*k+A*max(0,X-k)+B*max(0,Y-k))
print(ans) | A, B, C, X, Y = list(map(int,input().split()))
ans = A*X + B*Y
for k in range(X+Y+1):
ans = min(ans,A*max(0,X-k)+B*max(0,Y-k)+2*k*C)
print(ans)
| 7 | 7 | 151 | 150 | A, B, C, X, Y = list(map(int, input().split()))
ans = A * X + B * Y
for k in range(2 * max(X, Y) + 1):
ans = min(ans, 2 * C * k + A * max(0, X - k) + B * max(0, Y - k))
print(ans)
| A, B, C, X, Y = list(map(int, input().split()))
ans = A * X + B * Y
for k in range(X + Y + 1):
ans = min(ans, A * max(0, X - k) + B * max(0, Y - k) + 2 * k * C)
print(ans)
| false | 0 | [
"-for k in range(2 * max(X, Y) + 1):",
"- ans = min(ans, 2 * C * k + A * max(0, X - k) + B * max(0, Y - k))",
"+for k in range(X + Y + 1):",
"+ ans = min(ans, A * max(0, X - k) + B * max(0, Y - k) + 2 * k * C)"
] | false | 0.297322 | 0.092164 | 3.225995 | [
"s111828656",
"s759676083"
] |
u391731808 | p03050 | python | s139119496 | s786728034 | 189 | 120 | 40,300 | 3,424 | Accepted | Accepted | 36.51 | N=int(eval(input()))
ans = 0
for r in range(1,int(N**(0.5))+10):
if (N-r)%r==0:
m = (N-r)//r
if m!=0 and r == N//m:
ans += m
print(ans) | def get_divisor(n):
a,b = [],[]
for i in range(1,int(n**0.5)+1):
if n%i==0:
a.append(i)
b.append(n//i)
if a[-1]==b[-1]:b.pop()
a.extend(b[::-1])
return a
N = int(eval(input()))
ans = 0
for m in get_divisor(N):
m-=1
if m==0 : continue
if N//... | 8 | 17 | 168 | 342 | N = int(eval(input()))
ans = 0
for r in range(1, int(N ** (0.5)) + 10):
if (N - r) % r == 0:
m = (N - r) // r
if m != 0 and r == N // m:
ans += m
print(ans)
| def get_divisor(n):
a, b = [], []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
a.append(i)
b.append(n // i)
if a[-1] == b[-1]:
b.pop()
a.extend(b[::-1])
return a
N = int(eval(input()))
ans = 0
for m in get_divisor(N):
m -= 1
if m == 0:
... | false | 52.941176 | [
"+def get_divisor(n):",
"+ a, b = [], []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ a.append(i)",
"+ b.append(n // i)",
"+ if a[-1] == b[-1]:",
"+ b.pop()",
"+ a.extend(b[::-1])",
"+ return a",
"+",
"+",
"-for r in ran... | false | 0.210512 | 0.195708 | 1.075642 | [
"s139119496",
"s786728034"
] |
u369133448 | p02641 | python | s430663003 | s385423109 | 22 | 20 | 9,228 | 9,064 | Accepted | Accepted | 9.09 | x,n=list(map(int,input().split()))
if n==0:
print(x)
else:
p=list(map(int,input().split()))
dic={}
for i in p:
d=abs(i-x)
if d in dic:
dic[d].append(i)
else:
dic[d]=[i]
sortdic = sorted(list(dic.items()), key=lambda x:x[0])
chk=0
ans=-1
for k,v in sortdic:
if ... | x,y=list(map(int,input().split()))
if y==0:
print(x)
exit()
p=list(map(int,input().split()))
for i in range(200):
if not x-i in p:
print((x-i))
exit()
if not x+i in p:
print((x+i))
exit() | 30 | 12 | 532 | 212 | x, n = list(map(int, input().split()))
if n == 0:
print(x)
else:
p = list(map(int, input().split()))
dic = {}
for i in p:
d = abs(i - x)
if d in dic:
dic[d].append(i)
else:
dic[d] = [i]
sortdic = sorted(list(dic.items()), key=lambda x: x[0])
chk = ... | x, y = list(map(int, input().split()))
if y == 0:
print(x)
exit()
p = list(map(int, input().split()))
for i in range(200):
if not x - i in p:
print((x - i))
exit()
if not x + i in p:
print((x + i))
exit()
| false | 60 | [
"-x, n = list(map(int, input().split()))",
"-if n == 0:",
"+x, y = list(map(int, input().split()))",
"+if y == 0:",
"-else:",
"- p = list(map(int, input().split()))",
"- dic = {}",
"- for i in p:",
"- d = abs(i - x)",
"- if d in dic:",
"- dic[d].append(i)",
"-... | false | 0.047405 | 0.038562 | 1.229328 | [
"s430663003",
"s385423109"
] |
u332906195 | p02787 | python | s641327316 | s083199459 | 570 | 507 | 42,844 | 42,972 | Accepted | Accepted | 11.05 | H, N = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
dp = [0] * (H + 1)
for h in range(1, H + 1):
dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])
print((dp[-1]))
| H, N = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
dp = [0] * (H + 1)
for h in range(1, H + 1):
dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])
print((dp[-1]))
| 9 | 8 | 244 | 215 | H, N = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
dp = [0] * (H + 1)
for h in range(1, H + 1):
dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])
print((dp[-1]))
| H, N = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
dp = [0] * (H + 1)
for h in range(1, H + 1):
dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])
print((dp[-1]))
| false | 11.111111 | [
"-AB.sort(key=lambda x: x[1])"
] | false | 0.076544 | 0.077025 | 0.993745 | [
"s641327316",
"s083199459"
] |
u347640436 | p03634 | python | s160934782 | s981065501 | 725 | 655 | 54,520 | 61,784 | Accepted | Accepted | 9.66 | # ダイクストラ法
from heapq import heappop, heappush
N = int(input())
links = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = map(int, input().split())
links[a].append((b, c))
links[b].append((a, c))
Q, K = map(int, input().split())
d = [float('inf')] * (N + 1)
d[K] = 0
#prev = [None] ... | # 幅優先探索
from collections import deque
N = int(eval(input()))
links = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
links[a].append((b, c))
links[b].append((a, c))
Q, K = list(map(int, input().split()))
d = [float('inf')] * (N + 1)
d[K] = 0
q = d... | 31 | 28 | 711 | 627 | # ダイクストラ法
from heapq import heappop, heappush
N = int(input())
links = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = map(int, input().split())
links[a].append((b, c))
links[b].append((a, c))
Q, K = map(int, input().split())
d = [float("inf")] * (N + 1)
d[K] = 0
# prev = [None] * (N + 1)
q = [... | # 幅優先探索
from collections import deque
N = int(eval(input()))
links = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
links[a].append((b, c))
links[b].append((a, c))
Q, K = list(map(int, input().split()))
d = [float("inf")] * (N + 1)
d[K] = 0
q = deque([K])
while ... | false | 9.677419 | [
"-# ダイクストラ法",
"-from heapq import heappop, heappush",
"+# 幅優先探索",
"+from collections import deque",
"-N = int(input())",
"+N = int(eval(input()))",
"- a, b, c = map(int, input().split())",
"+ a, b, c = list(map(int, input().split()))",
"-Q, K = map(int, input().split())",
"+Q, K = list(map(i... | false | 0.050806 | 0.050413 | 1.007801 | [
"s160934782",
"s981065501"
] |
u588341295 | p03372 | python | s752920131 | s632061308 | 643 | 562 | 28,432 | 20,312 | Accepted | Accepted | 12.6 | # -*- coding: utf-8 -*-
"""
参考:http://blog.livedoor.jp/misteer/archives/9017497.html
https://www.hamayanhamayan.com/entry/2018/04/21/225805
・累積和
・累積max
"""
N, C = list(map(int, input().split()))
x, v = [0], [0]
for i in range(N):
_x, _v = list(map(int, input().split()))
x.append(_x)
v.app... | # -*- coding: utf-8 -*-
"""
参考:http://blog.livedoor.jp/misteer/archives/9017497.html
https://www.hamayanhamayan.com/entry/2018/04/21/225805
・累積max(累積和の応用)
・先に回る方向がiより手前にmaxがあったとしても、
そのパターンは別の周回のiで考慮されているので、
始点まで戻るマイナス分が多くなっていても問題ない。
どのみち先に回る方向で最終的にansに採用されるのはiまで行った時のはず。
"""
N, C = list(map(int, inpu... | 43 | 39 | 1,075 | 975 | # -*- coding: utf-8 -*-
"""
参考:http://blog.livedoor.jp/misteer/archives/9017497.html
https://www.hamayanhamayan.com/entry/2018/04/21/225805
・累積和
・累積max
"""
N, C = list(map(int, input().split()))
x, v = [0], [0]
for i in range(N):
_x, _v = list(map(int, input().split()))
x.append(_x)
v.append(_v)
# 累積和
sm... | # -*- coding: utf-8 -*-
"""
参考:http://blog.livedoor.jp/misteer/archives/9017497.html
https://www.hamayanhamayan.com/entry/2018/04/21/225805
・累積max(累積和の応用)
・先に回る方向がiより手前にmaxがあったとしても、
そのパターンは別の周回のiで考慮されているので、
始点まで戻るマイナス分が多くなっていても問題ない。
どのみち先に回る方向で最終的にansに採用されるのはiまで行った時のはず。
"""
N, C = list(map(int, input().split()))
... | false | 9.302326 | [
"-・累積和",
"-・累積max",
"+・累積max(累積和の応用)",
"+・先に回る方向がiより手前にmaxがあったとしても、",
"+ そのパターンは別の周回のiで考慮されているので、",
"+ 始点まで戻るマイナス分が多くなっていても問題ない。",
"+ どのみち先に回る方向で最終的にansに採用されるのはiまで行った時のはず。",
"-# 累積和",
"-sm_r = [0] * (N + 1)",
"-for i in range(1, N + 1):",
"- sm_r[i] = sm_r[i - 1] + v[i] - (x[i] - x[i - 1])",
... | false | 0.044959 | 0.035159 | 1.278746 | [
"s752920131",
"s632061308"
] |
u863442865 | p03610 | python | s692488425 | s757195404 | 36 | 18 | 4,340 | 3,188 | Accepted | Accepted | 50 | s = eval(input())
res = []
for i,x in enumerate(list(s)):
if i%2==0:
res.append(x)
print((''.join(res))) | s = eval(input())
print((s[::2]))
| 6 | 2 | 113 | 27 | s = eval(input())
res = []
for i, x in enumerate(list(s)):
if i % 2 == 0:
res.append(x)
print(("".join(res)))
| s = eval(input())
print((s[::2]))
| false | 66.666667 | [
"-res = []",
"-for i, x in enumerate(list(s)):",
"- if i % 2 == 0:",
"- res.append(x)",
"-print((\"\".join(res)))",
"+print((s[::2]))"
] | false | 0.039934 | 0.081612 | 0.489319 | [
"s692488425",
"s757195404"
] |
u067227603 | p02837 | python | s145130027 | s995473510 | 1,281 | 75 | 3,444 | 9,212 | Accepted | Accepted | 94.15 | N = int(eval(input()))
A = []
XY = []
honest_count = []
for i in range (N):
a = int(eval(input()))
A.append(a)
inter = []
for x in range(a):
xy = list(map(int, input().split()))
inter.append(xy)
XY.append(inter)
for i in range(2 ** N):
pt = [0] * N
ck = 1
... | import itertools
n = int(eval(input()))
l = []
for i in range(n):
d = int(eval(input()))
for dd in range(d):
x, y = list(map(int, input().split()))
l.append([i, x-1, y])
ans = 0
for p in itertools.product([0, 1], repeat=n):
for ll in l:
if p[ll[0]] == 1 and p[ll[1]] != l... | 31 | 17 | 657 | 381 | N = int(eval(input()))
A = []
XY = []
honest_count = []
for i in range(N):
a = int(eval(input()))
A.append(a)
inter = []
for x in range(a):
xy = list(map(int, input().split()))
inter.append(xy)
XY.append(inter)
for i in range(2**N):
pt = [0] * N
ck = 1
for j in range(N):
... | import itertools
n = int(eval(input()))
l = []
for i in range(n):
d = int(eval(input()))
for dd in range(d):
x, y = list(map(int, input().split()))
l.append([i, x - 1, y])
ans = 0
for p in itertools.product([0, 1], repeat=n):
for ll in l:
if p[ll[0]] == 1 and p[ll[1]] != ll[2]:
... | false | 45.16129 | [
"-N = int(eval(input()))",
"-A = []",
"-XY = []",
"-honest_count = []",
"-for i in range(N):",
"- a = int(eval(input()))",
"- A.append(a)",
"- inter = []",
"- for x in range(a):",
"- xy = list(map(int, input().split()))",
"- inter.append(xy)",
"- XY.append(inter)",... | false | 0.093777 | 0.035924 | 2.610435 | [
"s145130027",
"s995473510"
] |
u863955163 | p02767 | python | s781770579 | s336508953 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
X = [int(i) for i in input().split()]
L, R = min(X), max(X)
ans = 10**1000
for i in range(L, R+1):
box = 0
for j in range(N):
box += (X[j] - i)**2
if ans > box:
ans = box
print(ans)
| N = int(eval(input()))
X = [int(i) for i in input().split()]
P = round(sum(X)/N)
ans = 0
for i in range(N):
ans += (X[i]-P)**2
print(ans)
| 13 | 7 | 241 | 142 | N = int(eval(input()))
X = [int(i) for i in input().split()]
L, R = min(X), max(X)
ans = 10**1000
for i in range(L, R + 1):
box = 0
for j in range(N):
box += (X[j] - i) ** 2
if ans > box:
ans = box
print(ans)
| N = int(eval(input()))
X = [int(i) for i in input().split()]
P = round(sum(X) / N)
ans = 0
for i in range(N):
ans += (X[i] - P) ** 2
print(ans)
| false | 46.153846 | [
"-L, R = min(X), max(X)",
"-ans = 10**1000",
"-for i in range(L, R + 1):",
"- box = 0",
"- for j in range(N):",
"- box += (X[j] - i) ** 2",
"- if ans > box:",
"- ans = box",
"+P = round(sum(X) / N)",
"+ans = 0",
"+for i in range(N):",
"+ ans += (X[i] - P) ** 2"
] | false | 0.040861 | 0.057593 | 0.709487 | [
"s781770579",
"s336508953"
] |
u654470292 | p03253 | python | s192160540 | s237660756 | 1,986 | 176 | 115,164 | 38,512 | Accepted | Accepted | 91.14 | import sys
import math
def input():
return sys.stdin.readline()[:-1]
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def trial_division(n):
factor = []
tmp = int(math.sqrt(n)) + 1
for num in range(2,tmp):
while n % num == 0:... | import sys
import math
def input():
return sys.stdin.readline()[:-1]
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def trial_division(n):
factor = []
tmp = int(math.sqrt(n)) + 1
for num in range(2,tmp):
while n % num == 0:... | 40 | 49 | 842 | 933 | import sys
import math
def input():
return sys.stdin.readline()[:-1]
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def trial_division(n):
factor = []
tmp = int(math.sqrt(n)) + 1
for num in range(2, tmp):
while n % num == 0:
... | import sys
import math
def input():
return sys.stdin.readline()[:-1]
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def trial_division(n):
factor = []
tmp = int(math.sqrt(n)) + 1
for num in range(2, tmp):
while n % num == 0:
... | false | 18.367347 | [
"- ans *= combinations_count(countli[i] + n - 1, countli[i])",
"+ r = countli[i]",
"+ s = n + r - 1",
"+ r = min(r, n - 1)",
"+ p = 1",
"+ for j in range(r):",
"+ p *= s - j",
"+ p //= j + 1",
"+ ans *= p",
"+ ans %= mod"
] | false | 0.444766 | 0.048013 | 9.263447 | [
"s192160540",
"s237660756"
] |
u728566015 | p02720 | python | s369752350 | s409004186 | 328 | 179 | 10,740 | 11,776 | Accepted | Accepted | 45.43 | import heapq
K = int(eval(input()))
def fun(h, n):
tmp = str(n)
if tmp[-1] == '0':
heapq.heappush(h, int(tmp + '0'))
heapq.heappush(h, int(tmp + '1'))
elif tmp[-1] == '9':
heapq.heappush(h, int(tmp + '8'))
heapq.heappush(h, int(tmp + '9'))
else:
hea... | import heapq
K = int(eval(input()))
def fun(h, n):
tmp = n % 10
if tmp != 0:
heapq.heappush(h, 10 * n + tmp - 1)
heapq.heappush(h, 10 * n + tmp)
if tmp != 9:
heapq.heappush(h, 10 * n + tmp + 1)
h = list(range(1, 10))
while K > 0:
n = heapq.heappop(h)
fun(h, n)... | 25 | 20 | 592 | 347 | import heapq
K = int(eval(input()))
def fun(h, n):
tmp = str(n)
if tmp[-1] == "0":
heapq.heappush(h, int(tmp + "0"))
heapq.heappush(h, int(tmp + "1"))
elif tmp[-1] == "9":
heapq.heappush(h, int(tmp + "8"))
heapq.heappush(h, int(tmp + "9"))
else:
heapq.heappush(... | import heapq
K = int(eval(input()))
def fun(h, n):
tmp = n % 10
if tmp != 0:
heapq.heappush(h, 10 * n + tmp - 1)
heapq.heappush(h, 10 * n + tmp)
if tmp != 9:
heapq.heappush(h, 10 * n + tmp + 1)
h = list(range(1, 10))
while K > 0:
n = heapq.heappop(h)
fun(h, n)
K -= 1
els... | false | 20 | [
"- tmp = str(n)",
"- if tmp[-1] == \"0\":",
"- heapq.heappush(h, int(tmp + \"0\"))",
"- heapq.heappush(h, int(tmp + \"1\"))",
"- elif tmp[-1] == \"9\":",
"- heapq.heappush(h, int(tmp + \"8\"))",
"- heapq.heappush(h, int(tmp + \"9\"))",
"- else:",
"- hea... | false | 0.107533 | 0.052195 | 2.060201 | [
"s369752350",
"s409004186"
] |
u576432509 | p03637 | python | s935268973 | s232662199 | 158 | 73 | 14,480 | 14,252 | Accepted | Accepted | 53.8 | def mp2(k):
kk=k
mp=0
while kk>=1:
kr=kk%2
if kr==0:
kk=kk//2
mp=mp+1
# print(kk,kr,mp)
else:
# print(kk,kr,mp)
return mp
return mp
n=int(eval(input()))
a=list(map(int,input().split()))
cnt0=0
... | n=int(eval(input()))
a=list(map(int,input().split()))
b4=0
b2=0
b1=0
for i in range(n):
if a[i]%4==0:
b4+=1
elif a[i]%2==0:
b2+=1
else:
b1+=1
if b2==0:
if b1<=b4+1:
print("Yes")
else:
print("No")
else:
if b1<=b4:
prin... | 42 | 25 | 681 | 364 | def mp2(k):
kk = k
mp = 0
while kk >= 1:
kr = kk % 2
if kr == 0:
kk = kk // 2
mp = mp + 1
# print(kk,kr,mp)
else:
# print(kk,kr,mp)
return mp
return mp
n = int(eval(input()))
a = list(map(int, input()... | n = int(eval(input()))
a = list(map(int, input().split()))
b4 = 0
b2 = 0
b1 = 0
for i in range(n):
if a[i] % 4 == 0:
b4 += 1
elif a[i] % 2 == 0:
b2 += 1
else:
b1 += 1
if b2 == 0:
if b1 <= b4 + 1:
print("Yes")
else:
print("No")
else:
if b1 <= b4:
pr... | false | 40.47619 | [
"-def mp2(k):",
"- kk = k",
"- mp = 0",
"- while kk >= 1:",
"- kr = kk % 2",
"- if kr == 0:",
"- kk = kk // 2",
"- mp = mp + 1",
"- # print(kk,kr,mp)",
"- else:",
"- # print(kk,kr,mp)",
"- re... | false | 0.04404 | 0.047704 | 0.923179 | [
"s935268973",
"s232662199"
] |
u022979415 | p03633 | python | s965613941 | s162043314 | 44 | 38 | 5,512 | 5,384 | Accepted | Accepted | 13.64 | from functools import reduce
from fractions import gcd
def find_lcm(a, b):
return a * b // gcd(a, b)
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
print((reduce(find_lcm, t)))
if __name__ == '__main__':
main()
| from functools import reduce
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
print((reduce(lcm, t)))
if __name__ == '__main__':
main()
| 17 | 17 | 271 | 261 | from functools import reduce
from fractions import gcd
def find_lcm(a, b):
return a * b // gcd(a, b)
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
print((reduce(find_lcm, t)))
if __name__ == "__main__":
main()
| from functools import reduce
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
print((reduce(lcm, t)))
if __name__ == "__main__":
main()
| false | 0 | [
"-def find_lcm(a, b):",
"+def lcm(a, b):",
"- print((reduce(find_lcm, t)))",
"+ print((reduce(lcm, t)))"
] | false | 0.047908 | 0.182033 | 0.263181 | [
"s965613941",
"s162043314"
] |
u606045429 | p02883 | python | s203018535 | s556818631 | 701 | 418 | 127,928 | 53,188 | Accepted | Accepted | 40.37 | def main():
N, K, *I = list(map(int, open(0).read().split()))
A, F = I[:N], I[N:]
A.sort()
F.sort(reverse=True)
ng, ok = -1, 10 ** 12
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if sum(max(0, a - mid // f) for a, f in zip(A, F)) <= K:
ok = mid
e... | from numpy import array, int64, minimum
def main():
N, K, *I = list(map(int, open(0).read().split()))
A, F = array(I[:N], int64), array(I[N:], int64)
A.sort()
F.sort()
F = F[::-1]
sum_A = A.sum()
ng, ok = -1, 10 ** 12
while ng + 1 < ok:
mid = (ok + ng) // 2
... | 20 | 25 | 402 | 485 | def main():
N, K, *I = list(map(int, open(0).read().split()))
A, F = I[:N], I[N:]
A.sort()
F.sort(reverse=True)
ng, ok = -1, 10**12
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if sum(max(0, a - mid // f) for a, f in zip(A, F)) <= K:
ok = mid
else:
... | from numpy import array, int64, minimum
def main():
N, K, *I = list(map(int, open(0).read().split()))
A, F = array(I[:N], int64), array(I[N:], int64)
A.sort()
F.sort()
F = F[::-1]
sum_A = A.sum()
ng, ok = -1, 10**12
while ng + 1 < ok:
mid = (ok + ng) // 2
if (sum_A - mi... | false | 20 | [
"+from numpy import array, int64, minimum",
"+",
"+",
"- A, F = I[:N], I[N:]",
"+ A, F = array(I[:N], int64), array(I[N:], int64)",
"- F.sort(reverse=True)",
"+ F.sort()",
"+ F = F[::-1]",
"+ sum_A = A.sum()",
"- while abs(ok - ng) > 1:",
"+ while ng + 1 < ok:",
"- ... | false | 0.101381 | 0.37376 | 0.271247 | [
"s203018535",
"s556818631"
] |
u272525952 | p03324 | python | s901637745 | s778729736 | 183 | 168 | 38,384 | 38,484 | Accepted | Accepted | 8.2 | a,b=list(map(int,input().split()))
if a==0 and b!=100:
print(b)
elif a==0 and b==100:
print((101))
elif a==1 and b!=100:
print((b*100))
elif a==1 and b==100:
print((10100))
elif a==2 and b!=100:
print((b*10000))
else:
print((101*10**4))
| a,b=list(map(int,input().split()))
if b==100:
print((101*100**a))
else:
print((b*100**a)) | 15 | 5 | 262 | 87 | a, b = list(map(int, input().split()))
if a == 0 and b != 100:
print(b)
elif a == 0 and b == 100:
print((101))
elif a == 1 and b != 100:
print((b * 100))
elif a == 1 and b == 100:
print((10100))
elif a == 2 and b != 100:
print((b * 10000))
else:
print((101 * 10**4))
| a, b = list(map(int, input().split()))
if b == 100:
print((101 * 100**a))
else:
print((b * 100**a))
| false | 66.666667 | [
"-if a == 0 and b != 100:",
"- print(b)",
"-elif a == 0 and b == 100:",
"- print((101))",
"-elif a == 1 and b != 100:",
"- print((b * 100))",
"-elif a == 1 and b == 100:",
"- print((10100))",
"-elif a == 2 and b != 100:",
"- print((b * 10000))",
"+if b == 100:",
"+ print((101... | false | 0.00874 | 0.035837 | 0.243889 | [
"s901637745",
"s778729736"
] |
u535803878 | p02788 | python | s141527041 | s495945179 | 807 | 661 | 95,440 | 97,032 | Accepted | Accepted | 18.09 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
### BIT
def init(bit, values):
for i,v in enumerate(values):
update(bit,i,v)
#a1 ~ aiまでの和 O(logn)
def query(bit,i):
res = 0
while i > 0:
... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n,d,a = list(map(int, input().split()))
xh = [None]*n
# h = [None]*n
for i in range(n):
xh[i] = tuple(map(int, input().split()))
xh.sort()
r = 0
val = 0
fr... | 49 | 34 | 1,048 | 705 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
### BIT
def init(bit, values):
for i, v in enumerate(values):
update(bit, i, v)
# a1 ~ aiまでの和 O(logn)
def query(bit, i):
res = 0
while i > 0:
res +... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, d, a = list(map(int, input().split()))
xh = [None] * n
# h = [None]*n
for i in range(n):
xh[i] = tuple(map(int, input().split()))
xh.sort()
r = 0
val = 0
from queue impor... | false | 30.612245 | [
"-### BIT",
"-def init(bit, values):",
"- for i, v in enumerate(values):",
"- update(bit, i, v)",
"-",
"-",
"-# a1 ~ aiまでの和 O(logn)",
"-def query(bit, i):",
"- res = 0",
"- while i > 0:",
"- res += bit[i]",
"- i -= i & (-i)",
"- return res",
"-",
"-",
"... | false | 0.107196 | 0.153164 | 0.69988 | [
"s141527041",
"s495945179"
] |
u729133443 | p03698 | python | s702873264 | s523823246 | 174 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.66 | s=eval(input());print(('yneos'[len(s)!=len(set(s))::2])) | s=eval(input());print(('yneos'[len(s)>len(set(s))::2])) | 1 | 1 | 48 | 47 | s = eval(input())
print(("yneos"[len(s) != len(set(s)) :: 2]))
| s = eval(input())
print(("yneos"[len(s) > len(set(s)) :: 2]))
| false | 0 | [
"-print((\"yneos\"[len(s) != len(set(s)) :: 2]))",
"+print((\"yneos\"[len(s) > len(set(s)) :: 2]))"
] | false | 0.085628 | 0.036057 | 2.374764 | [
"s702873264",
"s523823246"
] |
u047796752 | p03739 | python | s074065483 | s342146782 | 263 | 99 | 59,120 | 84,380 | Accepted | Accepted | 62.36 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
b = a[:]
acc = 0
for i in range(n):
if i%2==0:
if acc+b[i]<=0:
b[i] += 1-(acc+b[i])
else:
if acc+b[i]>=0:
b[i] -= acc+b[i]+1
acc += b[i]
c = a[... | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
cnt1, now = 0, 0
for i in range(n):
now += a[i]
if i%2==0:
if now<=0:
cnt1 += 1-now
now = 1
else:
if now>=0:
cnt1 += now+1
... | 35 | 34 | 622 | 581 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
b = a[:]
acc = 0
for i in range(n):
if i % 2 == 0:
if acc + b[i] <= 0:
b[i] += 1 - (acc + b[i])
else:
if acc + b[i] >= 0:
b[i] -= acc + b[i] + 1
acc += b[i]
c = a[:]
acc ... | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
cnt1, now = 0, 0
for i in range(n):
now += a[i]
if i % 2 == 0:
if now <= 0:
cnt1 += 1 - now
now = 1
else:
if now >= 0:
cnt1 += now + 1
now = -1
cn... | false | 2.857143 | [
"-b = a[:]",
"-acc = 0",
"+cnt1, now = 0, 0",
"+ now += a[i]",
"- if acc + b[i] <= 0:",
"- b[i] += 1 - (acc + b[i])",
"+ if now <= 0:",
"+ cnt1 += 1 - now",
"+ now = 1",
"- if acc + b[i] >= 0:",
"- b[i] -= acc + b[i] + 1",
"- ... | false | 0.032588 | 0.035612 | 0.91508 | [
"s074065483",
"s342146782"
] |
u977389981 | p02981 | python | s097039038 | s978123162 | 182 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.66 | N, A, B = list(map(int, input().split()))
print((min(A * N, B))) | N, A, B = list(map(int, input().split()))
print((min(N * A, B))) | 3 | 2 | 59 | 57 | N, A, B = list(map(int, input().split()))
print((min(A * N, B)))
| N, A, B = list(map(int, input().split()))
print((min(N * A, B)))
| false | 33.333333 | [
"-print((min(A * N, B)))",
"+print((min(N * A, B)))"
] | false | 0.065063 | 0.033519 | 1.941073 | [
"s097039038",
"s978123162"
] |
u922449550 | p02574 | python | s663167267 | s467429934 | 891 | 527 | 150,048 | 228,172 | Accepted | Accepted | 40.85 | import numpy as np
N = int(eval(input()))
A = list(map(int, input().split()))
exist = [0] * (10**6 + 1)
for a in A:
exist[a] += 1
if np.gcd.reduce(A) != 1:
print('not coprime')
elif np.all([sum(exist[i::i]) <= 1 for i in range(2, 10**6+1)]):
print('pairwise coprime')
else:
print('setwise ... | from math import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
exist = [0] * (10**6 + 1)
for a in A:
exist[a] += 1
g = A[0]
for a in A[1:]:
g = gcd(g, a)
if g != 1:
print('not coprime')
elif all([sum(exist[i::i]) <= 1 for i in range(2, 10**6+1)]):
print('pairwise copri... | 14 | 18 | 323 | 355 | import numpy as np
N = int(eval(input()))
A = list(map(int, input().split()))
exist = [0] * (10**6 + 1)
for a in A:
exist[a] += 1
if np.gcd.reduce(A) != 1:
print("not coprime")
elif np.all([sum(exist[i::i]) <= 1 for i in range(2, 10**6 + 1)]):
print("pairwise coprime")
else:
print("setwise coprime")
| from math import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
exist = [0] * (10**6 + 1)
for a in A:
exist[a] += 1
g = A[0]
for a in A[1:]:
g = gcd(g, a)
if g != 1:
print("not coprime")
elif all([sum(exist[i::i]) <= 1 for i in range(2, 10**6 + 1)]):
print("pairwise coprime")
else:
... | false | 22.222222 | [
"-import numpy as np",
"+from math import gcd",
"-if np.gcd.reduce(A) != 1:",
"+g = A[0]",
"+for a in A[1:]:",
"+ g = gcd(g, a)",
"+if g != 1:",
"-elif np.all([sum(exist[i::i]) <= 1 for i in range(2, 10**6 + 1)]):",
"+elif all([sum(exist[i::i]) <= 1 for i in range(2, 10**6 + 1)]):"
] | false | 0.885689 | 1.086014 | 0.815541 | [
"s663167267",
"s467429934"
] |
u671060652 | p03208 | python | s842224473 | s713060072 | 658 | 205 | 76,116 | 87,332 | Accepted | Accepted | 68.84 | import itertools
import math
import fractions
import functools
import copy
n, k = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(eval(input())))
h.sort()
minimum = 10**10
for i in range(n-k+1):
minimum = min(minimum,h[i+k-1]-h[i])
print(minimum) | def main():
# n = int(input())
n, m = list(map(int, input().split()))
# v = list(map(int, input().split()))
# s = input()
h = [int(eval(input())) for _ in range(n)]
h.sort()
temp = []
for i in range(n-m+1):
temp.append(h[i+m-1]-h[i])
temp.sort()
print((te... | 17 | 19 | 284 | 358 | import itertools
import math
import fractions
import functools
import copy
n, k = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(eval(input())))
h.sort()
minimum = 10**10
for i in range(n - k + 1):
minimum = min(minimum, h[i + k - 1] - h[i])
print(minimum)
| def main():
# n = int(input())
n, m = list(map(int, input().split()))
# v = list(map(int, input().split()))
# s = input()
h = [int(eval(input())) for _ in range(n)]
h.sort()
temp = []
for i in range(n - m + 1):
temp.append(h[i + m - 1] - h[i])
temp.sort()
print((temp[0]))... | false | 10.526316 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ # n = int(input())",
"+ n, m = list(map(int, input().split()))",
"+ # v = list(map(int, input().split()))",
"+ # s = input()",
"+ h = [int(eval(input())) for _ in rang... | false | 0.045477 | 0.04135 | 1.09982 | [
"s842224473",
"s713060072"
] |
u561083515 | p03352 | python | s633334903 | s683187005 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | X = int(eval(input()))
ans = 0
for i in range(1,1001):
for j in range(2,11):
tmp = i ** j
if tmp <= X:
ans = max(ans, i ** j)
print(ans) | X = int(eval(input()))
ans = 1
for i in range(2,int(X**.5)+1):
j = 2
while i ** j <= X:
ans = max(ans, i ** j)
j += 1
print(ans) | 10 | 10 | 173 | 157 | X = int(eval(input()))
ans = 0
for i in range(1, 1001):
for j in range(2, 11):
tmp = i**j
if tmp <= X:
ans = max(ans, i**j)
print(ans)
| X = int(eval(input()))
ans = 1
for i in range(2, int(X**0.5) + 1):
j = 2
while i**j <= X:
ans = max(ans, i**j)
j += 1
print(ans)
| false | 0 | [
"-ans = 0",
"-for i in range(1, 1001):",
"- for j in range(2, 11):",
"- tmp = i**j",
"- if tmp <= X:",
"- ans = max(ans, i**j)",
"+ans = 1",
"+for i in range(2, int(X**0.5) + 1):",
"+ j = 2",
"+ while i**j <= X:",
"+ ans = max(ans, i**j)",
"+ j +... | false | 0.05702 | 0.047962 | 1.188861 | [
"s633334903",
"s683187005"
] |
u970308980 | p03061 | python | s730911478 | s718397977 | 265 | 188 | 65,124 | 16,144 | Accepted | Accepted | 29.06 | # 最大公約数
def gcd(a, b):
while b:
a, b = b, a % b
return a
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0 for _ in range(N)]
R = [0 for _ in range(N)]
L[0] = A[0]
R[N-1] = A[N-1]
for i in range(1, N):
L[i] = gcd(L[i-1], A[i])
for i in reversed(list(range(N... | from itertools import accumulate
from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
cum_gcd_l = list(accumulate(A, gcd))
cum_gcd_r = list(accumulate(reversed(A), gcd))
ans = 0
for i in range(N):
if i == 0:
tmp = cum_gcd_r[-2]
elif i == N-1:
tm... | 33 | 22 | 545 | 437 | # 最大公約数
def gcd(a, b):
while b:
a, b = b, a % b
return a
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0 for _ in range(N)]
R = [0 for _ in range(N)]
L[0] = A[0]
R[N - 1] = A[N - 1]
for i in range(1, N):
L[i] = gcd(L[i - 1], A[i])
for i in reversed(list(range(N - 1))):
R[i] =... | from itertools import accumulate
from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
cum_gcd_l = list(accumulate(A, gcd))
cum_gcd_r = list(accumulate(reversed(A), gcd))
ans = 0
for i in range(N):
if i == 0:
tmp = cum_gcd_r[-2]
elif i == N - 1:
tmp = cum_gcd_l[-2... | false | 33.333333 | [
"-# 最大公約数",
"-def gcd(a, b):",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"+from itertools import accumulate",
"+from fractions import gcd",
"-L = [0 for _ in range(N)]",
"-R = [0 for _ in range(N)]",
"-L[0] = A[0]",
"-R[N - 1] = A[N - 1]",
"-for i in range(1, N):",
... | false | 0.044262 | 0.05098 | 0.868216 | [
"s730911478",
"s718397977"
] |
u285891772 | p03231 | python | s598737579 | s540895315 | 88 | 39 | 5,460 | 5,472 | Accepted | Accepted | 55.68 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 41 | 38 | 1,113 | 1,071 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 7.317073 | [
"-if S[0] != T[0]:",
"- print((-1))",
"- exit()",
"+L = N * M // gcd(N, M)",
"-n = N // G",
"-m = M // G",
"- if S[::n][i] != T[::m][i]:",
"+ if S[N // G * i] != T[M // G * i]:",
"- print((N * M // G))",
"+ print(L)"
] | false | 0.04553 | 0.046038 | 0.988961 | [
"s598737579",
"s540895315"
] |
u606523772 | p02791 | python | s014065423 | s049397659 | 131 | 112 | 24,744 | 24,744 | Accepted | Accepted | 14.5 | N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 0
P_min = 200000
for i in range(N):
if P_min > P[i]:
P_min = P[i]
if P_min == P[i]:
cnt += 1
print(cnt) | N = int(eval(input()))
A_list = list(map(int, input().split()))
min1 = A_list[0]
cnt = 0
for i in range(N):
if A_list[i] <= min1:
min1 = A_list[i]
cnt += 1
print(cnt) | 10 | 9 | 195 | 188 | N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 0
P_min = 200000
for i in range(N):
if P_min > P[i]:
P_min = P[i]
if P_min == P[i]:
cnt += 1
print(cnt)
| N = int(eval(input()))
A_list = list(map(int, input().split()))
min1 = A_list[0]
cnt = 0
for i in range(N):
if A_list[i] <= min1:
min1 = A_list[i]
cnt += 1
print(cnt)
| false | 10 | [
"-P = list(map(int, input().split()))",
"+A_list = list(map(int, input().split()))",
"+min1 = A_list[0]",
"-P_min = 200000",
"- if P_min > P[i]:",
"- P_min = P[i]",
"- if P_min == P[i]:",
"+ if A_list[i] <= min1:",
"+ min1 = A_list[i]"
] | false | 0.046188 | 0.045457 | 1.016084 | [
"s014065423",
"s049397659"
] |
u275666666 | p02689 | python | s098538824 | s928206831 | 386 | 307 | 121,048 | 127,268 | Accepted | Accepted | 20.47 | def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
N,M=list(map(int, input().split()))
H=list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(int(M))]
AB_unique=list(map(list, set(map(tuple, AB))))
AB_road=[True]*N
fo... | N,M=list(map(int, input().split()))
H=list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(int(M))]
AB_unique=list(map(list, set(map(tuple, AB))))
AB_road=[[] for i in range(N)]
for AB in AB_unique:
if H[AB[0]-1] > H[AB[1]-1]:
AB_road[AB[1]-1].append(AB[0])
el... | 21 | 17 | 569 | 500 | def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(int(M))]
AB_unique = list(map(list, set(map(tuple, AB))))
AB_road = [True] * N
for... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(int(M))]
AB_unique = list(map(list, set(map(tuple, AB))))
AB_road = [[] for i in range(N)]
for AB in AB_unique:
if H[AB[0] - 1] > H[AB[1] - 1]:
AB_road[AB[1] - 1].append(AB[0])
... | false | 19.047619 | [
"-def get_unique_list(seq):",
"- seen = []",
"- return [x for x in seq if x not in seen and not seen.append(x)]",
"-",
"-",
"-AB_road = [True] * N",
"+AB_road = [[] for i in range(N)]",
"- AB_road[AB[1] - 1] = False",
"+ AB_road[AB[1] - 1].append(AB[0])",
"- AB_road[AB[0... | false | 0.04543 | 0.086269 | 0.526617 | [
"s098538824",
"s928206831"
] |
u729133443 | p03146 | python | s262491485 | s618962068 | 165 | 20 | 38,384 | 2,940 | Accepted | Accepted | 87.88 | def fun(n):
if n%2:return 3*n+1
return n//2
a=[0]+[int(eval(input()))]
i=1
while not fun(a[i]) in a:a.append(fun(a[i]));i+=1
print((i+1)) | s=int(eval(input()))
i=2
while~-s:s=[s//2,s*3+1][s%2];i+=1
print((max(i,4))) | 7 | 4 | 143 | 71 | def fun(n):
if n % 2:
return 3 * n + 1
return n // 2
a = [0] + [int(eval(input()))]
i = 1
while not fun(a[i]) in a:
a.append(fun(a[i]))
i += 1
print((i + 1))
| s = int(eval(input()))
i = 2
while ~-s:
s = [s // 2, s * 3 + 1][s % 2]
i += 1
print((max(i, 4)))
| false | 42.857143 | [
"-def fun(n):",
"- if n % 2:",
"- return 3 * n + 1",
"- return n // 2",
"-",
"-",
"-a = [0] + [int(eval(input()))]",
"-i = 1",
"-while not fun(a[i]) in a:",
"- a.append(fun(a[i]))",
"+s = int(eval(input()))",
"+i = 2",
"+while ~-s:",
"+ s = [s // 2, s * 3 + 1][s % 2]",
... | false | 0.079497 | 0.042205 | 1.883573 | [
"s262491485",
"s618962068"
] |
u906501980 | p03379 | python | s592210041 | s206470781 | 324 | 299 | 26,772 | 26,772 | Accepted | Accepted | 7.72 | n=int(eval(input()))
x=list(map(int,input().split()))
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
if x[i]<=x1:
print(x2)
else:
print(x1)
| n = int(eval(input()))
x = list(map(int,input().split()))
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i, xx in enumerate(x):
if xx<=x1:
print(x2)
else:
print(x1)
| 9 | 9 | 180 | 190 | n = int(eval(input()))
x = list(map(int, input().split()))
y = sorted(x)
x1, x2 = y[n // 2 - 1], y[n // 2]
for i in range(n):
if x[i] <= x1:
print(x2)
else:
print(x1)
| n = int(eval(input()))
x = list(map(int, input().split()))
y = sorted(x)
x1, x2 = y[n // 2 - 1], y[n // 2]
for i, xx in enumerate(x):
if xx <= x1:
print(x2)
else:
print(x1)
| false | 0 | [
"-for i in range(n):",
"- if x[i] <= x1:",
"+for i, xx in enumerate(x):",
"+ if xx <= x1:"
] | false | 0.046683 | 0.048377 | 0.964983 | [
"s592210041",
"s206470781"
] |
u308684517 | p03814 | python | s984478014 | s771280999 | 61 | 35 | 3,512 | 3,516 | Accepted | Accepted | 42.62 | s = eval(input())
flag = True
for i in range(len(s)):
if s[i] == "A" and flag :
a = i
flag = False
if s[i] == "Z" and not flag:
z = i
print((z-a+1)) | s = eval(input())
flag = True
for i in range(len(s)):
if s[i] == "A":
a = i
break
for i in range(len(s)-1, 0, -1):
if s[i] == "Z":
z = i
break
print((z-a+1)) | 9 | 11 | 180 | 203 | s = eval(input())
flag = True
for i in range(len(s)):
if s[i] == "A" and flag:
a = i
flag = False
if s[i] == "Z" and not flag:
z = i
print((z - a + 1))
| s = eval(input())
flag = True
for i in range(len(s)):
if s[i] == "A":
a = i
break
for i in range(len(s) - 1, 0, -1):
if s[i] == "Z":
z = i
break
print((z - a + 1))
| false | 18.181818 | [
"- if s[i] == \"A\" and flag:",
"+ if s[i] == \"A\":",
"- flag = False",
"- if s[i] == \"Z\" and not flag:",
"+ break",
"+for i in range(len(s) - 1, 0, -1):",
"+ if s[i] == \"Z\":",
"+ break"
] | false | 0.040683 | 0.041043 | 0.991235 | [
"s984478014",
"s771280999"
] |
u379629675 | p02913 | python | s069648551 | s130074679 | 94 | 67 | 5,372 | 4,204 | Accepted | Accepted | 28.72 | import sys
from collections import defaultdict
# input関係の定義
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map... | import sys
# input関係の定義
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
de... | 72 | 76 | 2,382 | 2,530 | import sys
from collections import defaultdict
# input関係の定義
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii():
return int(input())
def mi():
return map(int, input().rstrip().split())
def lmi():
return list(map(int, input().rstrip().split()))
def fi():
return float(input())
def... | import sys
# input関係の定義
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii():
return int(input())
def mi():
return map(int, input().rstrip().split())
def lmi():
return list(map(int, input().rstrip().split()))
def fi():
return float(input())
def mfi():
return map(float, input(... | false | 5.263158 | [
"-from collections import defaultdict",
"- def __init__(self, s):",
"+ def __init__(self, s, opt=2):",
"+ self.opt = opt",
"- self.hash2 = [0] * (self.n + 1)",
"- self.power2 = [1] * (self.n + 1)",
"+ if opt == 2:",
"+ self.hash2 = [0] * (self.n + 1)",
"+... | false | 0.083341 | 0.087256 | 0.955133 | [
"s069648551",
"s130074679"
] |
u644516473 | p03475 | python | s210875631 | s003131184 | 77 | 71 | 3,188 | 3,188 | Accepted | Accepted | 7.79 | import sys
readline = sys.stdin.readline
N = int(readline())
CSF = []
for i in range(N-1):
CSF.append(tuple(map(int, readline().split())))
for i in range(N):
time = 0
for c, s, f in CSF[i:N-1]:
if time < s:
time = s
else:
time = (time+f-1)//f*f
... | import sys
readline = sys.stdin.readline
N = int(readline())
CSF = [tuple(map(int, readline().split())) for _ in range(N-1)]
for i in range(N):
time = 0
for c, s, f in CSF[i:N-1]:
if time < s:
time = s
else:
time = (time+f-1)//f*f
time += c
print... | 16 | 14 | 347 | 327 | import sys
readline = sys.stdin.readline
N = int(readline())
CSF = []
for i in range(N - 1):
CSF.append(tuple(map(int, readline().split())))
for i in range(N):
time = 0
for c, s, f in CSF[i : N - 1]:
if time < s:
time = s
else:
time = (time + f - 1) // f * f
... | import sys
readline = sys.stdin.readline
N = int(readline())
CSF = [tuple(map(int, readline().split())) for _ in range(N - 1)]
for i in range(N):
time = 0
for c, s, f in CSF[i : N - 1]:
if time < s:
time = s
else:
time = (time + f - 1) // f * f
time += c
prin... | false | 12.5 | [
"-CSF = []",
"-for i in range(N - 1):",
"- CSF.append(tuple(map(int, readline().split())))",
"+CSF = [tuple(map(int, readline().split())) for _ in range(N - 1)]"
] | false | 0.038326 | 0.038769 | 0.988572 | [
"s210875631",
"s003131184"
] |
u226849101 | p02693 | python | s731371097 | s363688900 | 25 | 21 | 9,172 | 9,104 | Accepted | Accepted | 16 | K=int(eval(input()))
A,B=list(map(int,input().split()))
flag = False
for i in range(A,B+1):
if i%K==0:
flag=True
break
if flag:
print("OK")
else:
print("NG") | k =int(eval(input()))
a , b=list(map(int,input().split()))
flag = False
if b-a >= k:
flag=True
else:
for i in range(a,b+1):
if i%k==0:
flag=True
if flag :
print("OK")
else:
print("NG")
| 13 | 16 | 187 | 218 | K = int(eval(input()))
A, B = list(map(int, input().split()))
flag = False
for i in range(A, B + 1):
if i % K == 0:
flag = True
break
if flag:
print("OK")
else:
print("NG")
| k = int(eval(input()))
a, b = list(map(int, input().split()))
flag = False
if b - a >= k:
flag = True
else:
for i in range(a, b + 1):
if i % k == 0:
flag = True
if flag:
print("OK")
else:
print("NG")
| false | 18.75 | [
"-K = int(eval(input()))",
"-A, B = list(map(int, input().split()))",
"+k = int(eval(input()))",
"+a, b = list(map(int, input().split()))",
"-for i in range(A, B + 1):",
"- if i % K == 0:",
"- flag = True",
"- break",
"+if b - a >= k:",
"+ flag = True",
"+else:",
"+ for ... | false | 0.065491 | 0.036174 | 1.81045 | [
"s731371097",
"s363688900"
] |
u200887663 | p03325 | python | s183370603 | s438176673 | 62 | 52 | 4,212 | 10,064 | Accepted | Accepted | 16.13 | n=int(eval(input()))
#a,b,n=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
def div2(v):
res=0
if v==0:
return res
while v%2==0:
v=v//2
res+=1
return res
ans=0
for ai in al:
ans+=div2(ai)
print(... | n = int(eval(input()))
#n, W = map(int, input().split())
al = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]
def div2(v, a):
res = 0
if v == 0:
return res
while v % a == 0:
v = v//a
res += 1
return res
ans = 0
for a in al:
ans += d... | 18 | 20 | 321 | 336 | n = int(eval(input()))
# a,b,n=map(int,input().split())
al = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
def div2(v):
res = 0
if v == 0:
return res
while v % 2 == 0:
v = v // 2
res += 1
return res
ans = 0
for ai in al:
ans += div2(... | n = int(eval(input()))
# n, W = map(int, input().split())
al = list(map(int, input().split()))
# al=[list(input()) for i in range(n)]
def div2(v, a):
res = 0
if v == 0:
return res
while v % a == 0:
v = v // a
res += 1
return res
ans = 0
for a in al:
ans += div2(a, 2)
print(... | false | 10 | [
"-# a,b,n=map(int,input().split())",
"+# n, W = map(int, input().split())",
"-# l=[list(map(int,input().split())) for i in range(n)]",
"-def div2(v):",
"+# al=[list(input()) for i in range(n)]",
"+def div2(v, a):",
"- while v % 2 == 0:",
"- v = v // 2",
"+ while v % a == 0:",
"+ ... | false | 0.036402 | 0.04255 | 0.855528 | [
"s183370603",
"s438176673"
] |
u475503988 | p02973 | python | s514654530 | s186748549 | 525 | 411 | 8,188 | 8,060 | Accepted | Accepted | 21.71 | from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, A[i])
if p==0:
d.appendleft(A[i])
else:
d[p-1] = A[i]
ans = len(d)
print(ans)
| import sys
input = sys.stdin.readline
from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, A[i])
if p==0:
d.appendleft(A[i])
else:
d[p-1] = A[i]
ans = len(d)
pr... | 15 | 17 | 277 | 317 | from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, A[i])
if p == 0:
d.appendleft(A[i])
else:
d[p - 1] = A[i]
ans = len(d)
print(ans)
| import sys
input = sys.stdin.readline
from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, A[i])
if p == 0:
d.appendleft(A[i])
else:
d[p - 1] = A[i]
ans = len(d)
print(ans)
| false | 11.764706 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.03827 | 0.040143 | 0.953347 | [
"s514654530",
"s186748549"
] |
u562935282 | p03372 | python | s212142781 | s098191107 | 669 | 469 | 37,576 | 33,608 | Accepted | Accepted | 29.9 | def main():
from collections import namedtuple
Dish = namedtuple('Dish', 'idx x v')
n, c = list(map(int, input().split()))
ds = []
for i in range(n):
x, v = list(map(int, input().split()))
ds.append(Dish(idx=i, x=x, v=v))
gol = [0] * n # 時計回りの最大値
s = 0
... | def main():
from collections import namedtuple
import sys
input = sys.stdin.readline
Sushi = namedtuple('Sushi', 'x cal')
n, c = list(map(int, input().split()))
a = []
for _ in range(n):
x, v = list(map(int, input().split()))
a.append(Sushi(x=x, cal=v))
# ... | 50 | 48 | 1,089 | 1,301 | def main():
from collections import namedtuple
Dish = namedtuple("Dish", "idx x v")
n, c = list(map(int, input().split()))
ds = []
for i in range(n):
x, v = list(map(int, input().split()))
ds.append(Dish(idx=i, x=x, v=v))
gol = [0] * n # 時計回りの最大値
s = 0
ma = 0
for d ... | def main():
from collections import namedtuple
import sys
input = sys.stdin.readline
Sushi = namedtuple("Sushi", "x cal")
n, c = list(map(int, input().split()))
a = []
for _ in range(n):
x, v = list(map(int, input().split()))
a.append(Sushi(x=x, cal=v))
# x昇順ソート済
clo... | false | 4 | [
"+ import sys",
"- Dish = namedtuple(\"Dish\", \"idx x v\")",
"+ input = sys.stdin.readline",
"+ Sushi = namedtuple(\"Sushi\", \"x cal\")",
"- ds = []",
"- for i in range(n):",
"+ a = []",
"+ for _ in range(n):",
"- ds.append(Dish(idx=i, x=x, v=v))",
"- gol = [0] ... | false | 0.159069 | 0.162125 | 0.981152 | [
"s212142781",
"s098191107"
] |
u581187895 | p03633 | python | s590015278 | s906035213 | 35 | 17 | 5,128 | 3,060 | Accepted | Accepted | 51.43 | from functools import reduce
from fractions import gcd
n = int(eval(input()))
arr = [int(eval(input())) for i in range(n)]
def lcm(x, y):
return (x*y)//gcd(x,y)
def lcmm(l):
return reduce(lcm, l)
print((lcmm(arr)))
| def gcd(a, b):
while b:
a, b = b, a%b
return a
def lcm(a, b):
return a*b // gcd(a, b)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
ans = 1
for t in T:
ans = lcm(ans, t)
print(ans)
| 13 | 17 | 221 | 226 | from functools import reduce
from fractions import gcd
n = int(eval(input()))
arr = [int(eval(input())) for i in range(n)]
def lcm(x, y):
return (x * y) // gcd(x, y)
def lcmm(l):
return reduce(lcm, l)
print((lcmm(arr)))
| def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
ans = 1
for t in T:
ans = lcm(ans, t)
print(ans)
| false | 23.529412 | [
"-from functools import reduce",
"-from fractions import gcd",
"-",
"-n = int(eval(input()))",
"-arr = [int(eval(input())) for i in range(n)]",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"-def lcm(x, y):",
"- return (x * y) // gcd(x, y)",
"+def lcm(a, b... | false | 0.093674 | 0.125877 | 0.74417 | [
"s590015278",
"s906035213"
] |
u513081876 | p03435 | python | s440927259 | s422920670 | 149 | 18 | 14,428 | 3,064 | Accepted | Accepted | 87.92 | import numpy as np
c = [[], [], []]
for i in range(3):
c[i] = list(map(int, input().split()))
d = np.array(c)
if len(set(d[1]-d[0])) == 1 and len(set(d[2]-d[0])) == 1:
print('Yes')
else:
print('No') | c = [[int(i) for i in input().split()] for i in range(3)]
for a1 in range(101):
b1 = c[0][0] - a1
b2 = c[0][1] - a1
b3 = c[0][2] - a1
if 0 <= b1 <= 100 or 0 <= b2 <= 100 or 0 <= b3 <= 100:
if c[1][0] - b1 == c[1][1] - b2 == c[1][2] -b3 and 0<=c[1][0] <= 100 and c[2][0] - b1 == c[2][1] - ... | 11 | 12 | 222 | 429 | import numpy as np
c = [[], [], []]
for i in range(3):
c[i] = list(map(int, input().split()))
d = np.array(c)
if len(set(d[1] - d[0])) == 1 and len(set(d[2] - d[0])) == 1:
print("Yes")
else:
print("No")
| c = [[int(i) for i in input().split()] for i in range(3)]
for a1 in range(101):
b1 = c[0][0] - a1
b2 = c[0][1] - a1
b3 = c[0][2] - a1
if 0 <= b1 <= 100 or 0 <= b2 <= 100 or 0 <= b3 <= 100:
if (
c[1][0] - b1 == c[1][1] - b2 == c[1][2] - b3
and 0 <= c[1][0] <= 100
... | false | 8.333333 | [
"-import numpy as np",
"-",
"-c = [[], [], []]",
"-for i in range(3):",
"- c[i] = list(map(int, input().split()))",
"-d = np.array(c)",
"-if len(set(d[1] - d[0])) == 1 and len(set(d[2] - d[0])) == 1:",
"- print(\"Yes\")",
"+c = [[int(i) for i in input().split()] for i in range(3)]",
"+for a1... | false | 0.695923 | 0.03663 | 18.998491 | [
"s440927259",
"s422920670"
] |
u223904637 | p02845 | python | s690888878 | s339653457 | 245 | 161 | 53,996 | 20,572 | Accepted | Accepted | 34.29 | n=int(eval(input()))
l=list(map(int,input().split()))
mod=10**9+7
ans=1
rgb=[0]*3
for i in range(n):
f=0
for j in range(3):
if l[i]==rgb[j]:
if f==0:
rgb[j]+=1
f+=1
ans*=f
ans%=mod
print(ans) | mod=10**9+7
n=int(eval(input()))
l=list(map(int,input().split()))
ans=1
rgb=[0,0,0]
for i in range(n):
c=0
for j in range(3):
if l[i]==rgb[j]:
c+=1
if c==0:
print((0))
exit()
p=rgb.index(l[i])
if not 0<=p<=2:
print((0))
exit()
... | 15 | 21 | 263 | 358 | n = int(eval(input()))
l = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1
rgb = [0] * 3
for i in range(n):
f = 0
for j in range(3):
if l[i] == rgb[j]:
if f == 0:
rgb[j] += 1
f += 1
ans *= f
ans %= mod
print(ans)
| mod = 10**9 + 7
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 1
rgb = [0, 0, 0]
for i in range(n):
c = 0
for j in range(3):
if l[i] == rgb[j]:
c += 1
if c == 0:
print((0))
exit()
p = rgb.index(l[i])
if not 0 <= p <= 2:
print((0))
... | false | 28.571429 | [
"+mod = 10**9 + 7",
"-mod = 10**9 + 7",
"-rgb = [0] * 3",
"+rgb = [0, 0, 0]",
"- f = 0",
"+ c = 0",
"- if f == 0:",
"- rgb[j] += 1",
"- f += 1",
"- ans *= f",
"+ c += 1",
"+ if c == 0:",
"+ print((0))",
"+ exit()",
... | false | 0.045552 | 0.042646 | 1.068139 | [
"s690888878",
"s339653457"
] |
u813450984 | p03331 | python | s488297221 | s885715716 | 1,263 | 179 | 3,060 | 3,060 | Accepted | Accepted | 85.83 | n = int(eval(input()))
ans = float('Inf')
for i in range(1, n):
if i > n//2:
break
if eval('+'.join(str(i))) + eval('+'.join(str(n - i))) < ans:
ans = eval('+'.join(str(i))) + eval('+'.join(str(n - i)))
print(ans) | n = int(eval(input()))
ans = float('Inf')
for i in range(1, n//2+1):
if sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i)))) < ans:
ans = sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i))))
print(ans) | 8 | 6 | 226 | 224 | n = int(eval(input()))
ans = float("Inf")
for i in range(1, n):
if i > n // 2:
break
if eval("+".join(str(i))) + eval("+".join(str(n - i))) < ans:
ans = eval("+".join(str(i))) + eval("+".join(str(n - i)))
print(ans)
| n = int(eval(input()))
ans = float("Inf")
for i in range(1, n // 2 + 1):
if sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i)))) < ans:
ans = sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i))))
print(ans)
| false | 25 | [
"-for i in range(1, n):",
"- if i > n // 2:",
"- break",
"- if eval(\"+\".join(str(i))) + eval(\"+\".join(str(n - i))) < ans:",
"- ans = eval(\"+\".join(str(i))) + eval(\"+\".join(str(n - i)))",
"+for i in range(1, n // 2 + 1):",
"+ if sum(list(map(int, str(i)))) + sum(list(map(in... | false | 0.445283 | 0.058231 | 7.646839 | [
"s488297221",
"s885715716"
] |
u918601425 | p03137 | python | s141960852 | s951275649 | 122 | 103 | 13,840 | 13,832 | Accepted | Accepted | 15.57 | N,M= [int(s) for s in input().split()]
lst = [int(s) for s in input().split()]
lst.sort()
gap=[]
for i in range(1,M):
gap.append(lst[i]-lst[i-1])
gap.sort()
ans=0
for i in range(M-N):
ans+=gap[i]
print(ans) | N,M=[int(s) for s in input().split()]
if N>=M:
print((0))
else:
ls=[int(s) for s in input().split()]
ls.sort()
d=[ls[i+1]-ls[i] for i in range(M-1)]
d.sort()
print((sum(d[:M-N]))) | 11 | 9 | 220 | 195 | N, M = [int(s) for s in input().split()]
lst = [int(s) for s in input().split()]
lst.sort()
gap = []
for i in range(1, M):
gap.append(lst[i] - lst[i - 1])
gap.sort()
ans = 0
for i in range(M - N):
ans += gap[i]
print(ans)
| N, M = [int(s) for s in input().split()]
if N >= M:
print((0))
else:
ls = [int(s) for s in input().split()]
ls.sort()
d = [ls[i + 1] - ls[i] for i in range(M - 1)]
d.sort()
print((sum(d[: M - N])))
| false | 18.181818 | [
"-lst = [int(s) for s in input().split()]",
"-lst.sort()",
"-gap = []",
"-for i in range(1, M):",
"- gap.append(lst[i] - lst[i - 1])",
"-gap.sort()",
"-ans = 0",
"-for i in range(M - N):",
"- ans += gap[i]",
"-print(ans)",
"+if N >= M:",
"+ print((0))",
"+else:",
"+ ls = [int(s... | false | 0.044233 | 0.044452 | 0.995073 | [
"s141960852",
"s951275649"
] |
u332906195 | p03212 | python | s184703481 | s824452436 | 128 | 37 | 3,064 | 3,316 | Accepted | Accepted | 71.09 | # -*- coding: utf-8 -*-
N = int(eval(input()))
ans = 0
cursor = "357"
def increment(cursor):
l = len(cursor)
ret = [''] * (l + 1)
if cursor[-1] == '7':
ret[-1] = '3'
ret[-2] = '3'
elif cursor[-1] == '5':
ret[-1] = '7'
elif cursor[-1] == '3':
ret[-... | from itertools import product
N = int(eval(input()))
ans, L = 0, len(str(N))
for i in range(L + 1):
for p in product(("7", "5", "3"), repeat=i):
if "7" in p and "5" in p and "3" in p:
if (i == L and int(''.join(p)) <= N) or i < L:
ans += 1
print(ans)
| 40 | 10 | 900 | 295 | # -*- coding: utf-8 -*-
N = int(eval(input()))
ans = 0
cursor = "357"
def increment(cursor):
l = len(cursor)
ret = [""] * (l + 1)
if cursor[-1] == "7":
ret[-1] = "3"
ret[-2] = "3"
elif cursor[-1] == "5":
ret[-1] = "7"
elif cursor[-1] == "3":
ret[-1] = "5"
for i ... | from itertools import product
N = int(eval(input()))
ans, L = 0, len(str(N))
for i in range(L + 1):
for p in product(("7", "5", "3"), repeat=i):
if "7" in p and "5" in p and "3" in p:
if (i == L and int("".join(p)) <= N) or i < L:
ans += 1
print(ans)
| false | 75 | [
"-# -*- coding: utf-8 -*-",
"+from itertools import product",
"+",
"-ans = 0",
"-cursor = \"357\"",
"-",
"-",
"-def increment(cursor):",
"- l = len(cursor)",
"- ret = [\"\"] * (l + 1)",
"- if cursor[-1] == \"7\":",
"- ret[-1] = \"3\"",
"- ret[-2] = \"3\"",
"- elif... | false | 0.050147 | 0.041042 | 1.221853 | [
"s184703481",
"s824452436"
] |
u018679195 | p03071 | python | s049081598 | s334844996 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | line = eval(input())
a, b = [int(n) for n in line.split()]
apb = a+b
aa = a+(a-1)
bb = b+(b-1)
print((max(apb, max(bb, aa)))) | a = [int(x) for x in input().split()]
a.sort()
maior = 0
maior += a[-1]
a[-1] -= 1
a.sort()
maior += a[-1]
print(maior)
| 10 | 12 | 130 | 135 | line = eval(input())
a, b = [int(n) for n in line.split()]
apb = a + b
aa = a + (a - 1)
bb = b + (b - 1)
print((max(apb, max(bb, aa))))
| a = [int(x) for x in input().split()]
a.sort()
maior = 0
maior += a[-1]
a[-1] -= 1
a.sort()
maior += a[-1]
print(maior)
| false | 16.666667 | [
"-line = eval(input())",
"-a, b = [int(n) for n in line.split()]",
"-apb = a + b",
"-aa = a + (a - 1)",
"-bb = b + (b - 1)",
"-print((max(apb, max(bb, aa))))",
"+a = [int(x) for x in input().split()]",
"+a.sort()",
"+maior = 0",
"+maior += a[-1]",
"+a[-1] -= 1",
"+a.sort()",
"+maior += a[-1]... | false | 0.044656 | 0.044601 | 1.001235 | [
"s049081598",
"s334844996"
] |
u596276291 | p03813 | python | s956356646 | s104091292 | 32 | 27 | 3,316 | 3,952 | Accepted | Accepted | 15.62 | from collections import defaultdict
def main():
print(("ABC" if int(eval(input())) < 1200 else "ARC"))
if __name__ == '__main__':
main()
| from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 9 | 33 | 149 | 813 | from collections import defaultdict
def main():
print(("ABC" if int(eval(input())) < 1200 else "ARC"))
if __name__ == "__main__":
main()
| from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 72.727273 | [
"-from collections import defaultdict",
"+from collections import defaultdict, Counter",
"+from itertools import product, groupby, count, permutations, combinations",
"+from math import pi, sqrt",
"+from collections import deque",
"+from bisect import bisect, bisect_left, bisect_right",
"+from string im... | false | 0.052155 | 0.036902 | 1.41333 | [
"s956356646",
"s104091292"
] |
u266014018 | p02721 | python | s537597021 | s937496988 | 275 | 160 | 17,508 | 26,224 | Accepted | Accepted | 41.82 | import sys
def yutori():
N, K, C = list(map(int,sys.stdin.readline().split()))
S = [i for i in sys.stdin.readline()]
l = [i+1 for i in range(N) if S[i] == 'o']
Left = []
Right = []
for u in l:
if Left == []:
Left.append(u)
if u > Left[-1] + C:
L... | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n, k, c = list(map(int, input().split()))
s = [True if i == 'o' else False for i in eval(input())]
L = [0]*k
R = [0]*k
i = n-1
now = k-1
while 0 <= now:
if s[i]:
R[now] = i
... | 34 | 33 | 761 | 628 | import sys
def yutori():
N, K, C = list(map(int, sys.stdin.readline().split()))
S = [i for i in sys.stdin.readline()]
l = [i + 1 for i in range(N) if S[i] == "o"]
Left = []
Right = []
for u in l:
if Left == []:
Left.append(u)
if u > Left[-1] + C:
Left.ap... | def main():
import sys
def input():
return sys.stdin.readline().rstrip()
n, k, c = list(map(int, input().split()))
s = [True if i == "o" else False for i in eval(input())]
L = [0] * k
R = [0] * k
i = n - 1
now = k - 1
while 0 <= now:
if s[i]:
R[now] = i
... | false | 2.941176 | [
"-import sys",
"+def main():",
"+ import sys",
"+",
"+ def input():",
"+ return sys.stdin.readline().rstrip()",
"+",
"+ n, k, c = list(map(int, input().split()))",
"+ s = [True if i == \"o\" else False for i in eval(input())]",
"+ L = [0] * k",
"+ R = [0] * k",
"+ i... | false | 0.043635 | 0.042548 | 1.025536 | [
"s537597021",
"s937496988"
] |
u767797498 | p02623 | python | s113529247 | s054122762 | 1,230 | 677 | 41,460 | 41,456 | Accepted | Accepted | 44.96 | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve(n,m,k,a_lst,b_lst):
#机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
aa_lst = make_sum_list(a_lst,k)
bb_lst = make_sum_list(b_lst,k)
len_aa = len(aa_lst)
len_bb = len(bb_lst)
#A,Bいずれかが一冊も読めないケースを考慮
if len_aa == 0... | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve(n,m,k,a_lst,b_lst):
#机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
aa_lst = make_sum_list(a_lst,k)
bb_lst = make_sum_list(b_lst,k)
len_aa = len(aa_lst)
len_bb = len(bb_lst)
#A,Bいずれかが一冊も読めないケースを考慮
if len_aa == 0... | 96 | 96 | 2,264 | 2,267 | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve(n, m, k, a_lst, b_lst):
# 机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
aa_lst = make_sum_list(a_lst, k)
bb_lst = make_sum_list(b_lst, k)
len_aa = len(aa_lst)
len_bb = len(bb_lst)
# A,Bいずれかが一冊も読めないケースを考慮
if len_aa == 0:
... | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve(n, m, k, a_lst, b_lst):
# 机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
aa_lst = make_sum_list(a_lst, k)
bb_lst = make_sum_list(b_lst, k)
len_aa = len(aa_lst)
len_bb = len(bb_lst)
# A,Bいずれかが一冊も読めないケースを考慮
if len_aa == 0:
... | false | 0 | [
"- logd(f\"imid: {imid}\")",
"+ if _DEB:",
"+ logd(f\"imid: {imid}\")",
"-_DEBUG = 0",
"+_DEB = 0",
"- if _DEBUG:",
"+ if _DEB:",
"- if _DEBUG:",
"+ if _DEB:"
] | false | 0.03566 | 0.038164 | 0.934398 | [
"s113529247",
"s054122762"
] |
u977389981 | p03252 | python | s269021834 | s342607187 | 252 | 42 | 4,144 | 3,888 | Accepted | Accepted | 83.33 | from collections import Counter
S = eval(input())
T = eval(input())
lenS = len(Counter(S))
lenT = len(Counter(T))
flag = 0
if lenS == lenT:
for i in range(lenS):
if Counter(S).most_common()[i][1] == Counter(T).most_common()[i][1]:
continue
else:
flag = 1
... | from collections import Counter
S = sorted(Counter(eval(input())).values())
T = sorted(Counter(eval(input())).values())
if S == T:
print('Yes')
else:
print('No') | 23 | 9 | 406 | 167 | from collections import Counter
S = eval(input())
T = eval(input())
lenS = len(Counter(S))
lenT = len(Counter(T))
flag = 0
if lenS == lenT:
for i in range(lenS):
if Counter(S).most_common()[i][1] == Counter(T).most_common()[i][1]:
continue
else:
flag = 1
break
el... | from collections import Counter
S = sorted(Counter(eval(input())).values())
T = sorted(Counter(eval(input())).values())
if S == T:
print("Yes")
else:
print("No")
| false | 60.869565 | [
"-S = eval(input())",
"-T = eval(input())",
"-lenS = len(Counter(S))",
"-lenT = len(Counter(T))",
"-flag = 0",
"-if lenS == lenT:",
"- for i in range(lenS):",
"- if Counter(S).most_common()[i][1] == Counter(T).most_common()[i][1]:",
"- continue",
"- else:",
"- ... | false | 0.093199 | 0.035749 | 2.607006 | [
"s269021834",
"s342607187"
] |
u272557899 | p03078 | python | s375392019 | s179632642 | 739 | 393 | 151,640 | 56,536 | Accepted | Accepted | 46.82 | x, y, z, k = list(map(int, input().split()))
a = [int(m) for m in input().split()]
b = [int(m) for m in input().split()]
c = [int(m) for m in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
s = []
for i in range(x):
for j in range(y):
s.append(a[i] + b[j])
s.sort... | from heapq import heappush, heappop
x, y, z, k = list(map(int, input().split()))
a = [int(m) for m in input().split()]
b = [int(m) for m in input().split()]
c = [int(m) for m in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
Q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
ansli = []
... | 26 | 28 | 551 | 1,236 | x, y, z, k = list(map(int, input().split()))
a = [int(m) for m in input().split()]
b = [int(m) for m in input().split()]
c = [int(m) for m in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
s = []
for i in range(x):
for j in range(y):
s.append(a[i] + b[j])
s.sort(reverse=True... | from heapq import heappush, heappop
x, y, z, k = list(map(int, input().split()))
a = [int(m) for m in input().split()]
b = [int(m) for m in input().split()]
c = [int(m) for m in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
Q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
ansli = []
se = set()
... | false | 7.142857 | [
"+from heapq import heappush, heappop",
"+",
"-s = []",
"-for i in range(x):",
"- for j in range(y):",
"- s.append(a[i] + b[j])",
"-s.sort(reverse=True)",
"-s1 = []",
"-for i in range(min(x * y, k)):",
"- s1.append(s[i])",
"-t = []",
"-for i in range(min(x * y, k)):",
"- for ... | false | 0.0654 | 0.043268 | 1.511534 | [
"s375392019",
"s179632642"
] |
u345966487 | p03311 | python | s073912925 | s937098455 | 252 | 204 | 26,180 | 25,184 | Accepted | Accepted | 19.05 | N = int(eval(input()))
A = list(map(int,input().split()))
B = sorted(A[i] - i - 1 for i in range(N))
def sad(b):
return sum(abs(A[i] - i - 1 - b)for i in range(N))
print((min(sad(B[N//2]),sad(B[min(N//2+1,N-1)]))))
| N=int(eval(input()))
B=sorted(int(x)-i-1 for i,x in enumerate(input().split()))
def sad(x):
return sum(abs(b-x)for b in B)
print((sad(B[N//2])))
| 6 | 5 | 216 | 145 | N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(A[i] - i - 1 for i in range(N))
def sad(b):
return sum(abs(A[i] - i - 1 - b) for i in range(N))
print((min(sad(B[N // 2]), sad(B[min(N // 2 + 1, N - 1)]))))
| N = int(eval(input()))
B = sorted(int(x) - i - 1 for i, x in enumerate(input().split()))
def sad(x):
return sum(abs(b - x) for b in B)
print((sad(B[N // 2])))
| false | 16.666667 | [
"-A = list(map(int, input().split()))",
"-B = sorted(A[i] - i - 1 for i in range(N))",
"+B = sorted(int(x) - i - 1 for i, x in enumerate(input().split()))",
"-def sad(b):",
"- return sum(abs(A[i] - i - 1 - b) for i in range(N))",
"+def sad(x):",
"+ return sum(abs(b - x) for b in B)",
"-print((mi... | false | 0.048648 | 0.171332 | 0.283942 | [
"s073912925",
"s937098455"
] |
u670567845 | p03408 | python | s129634504 | s553210642 | 467 | 80 | 82,828 | 67,160 | Accepted | Accepted | 82.87 | import collections
n = int(eval(input()))
b = [eval(input()) for _ in range(n)]
m = int(eval(input()))
r = [eval(input()) for _ in range(m)]
bc = collections.Counter(b)
rc = collections.Counter(r)
ans = 0
for x in list(bc.keys()):
ans = max(ans, bc[x]-rc[x])
print(ans) | import collections
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
m = int(eval(input()))
t = [eval(input()) for _ in range(m)]
sc = collections.Counter(s)
tc = collections.Counter(t)
ans = 0
for x in list(sc.keys()):
ans = max(ans,sc[x]-tc[x])
print(ans) | 11 | 12 | 251 | 252 | import collections
n = int(eval(input()))
b = [eval(input()) for _ in range(n)]
m = int(eval(input()))
r = [eval(input()) for _ in range(m)]
bc = collections.Counter(b)
rc = collections.Counter(r)
ans = 0
for x in list(bc.keys()):
ans = max(ans, bc[x] - rc[x])
print(ans)
| import collections
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
m = int(eval(input()))
t = [eval(input()) for _ in range(m)]
sc = collections.Counter(s)
tc = collections.Counter(t)
ans = 0
for x in list(sc.keys()):
ans = max(ans, sc[x] - tc[x])
print(ans)
| false | 8.333333 | [
"-b = [eval(input()) for _ in range(n)]",
"+s = [eval(input()) for _ in range(n)]",
"-r = [eval(input()) for _ in range(m)]",
"-bc = collections.Counter(b)",
"-rc = collections.Counter(r)",
"+t = [eval(input()) for _ in range(m)]",
"+sc = collections.Counter(s)",
"+tc = collections.Counter(t)",
"-fo... | false | 0.079991 | 0.036668 | 2.181501 | [
"s129634504",
"s553210642"
] |
u027685417 | p02898 | python | s486281517 | s787050349 | 63 | 49 | 11,912 | 11,912 | Accepted | Accepted | 22.22 | N, K = list(map(int, input().split()))
list_h = list(map(int, input().split()))
list_h.sort()
list_h.insert(0, 0)
list_h.append(500)
L, R = 0, N + 1
while R - L > 1:
C = (L + R) // 2
if list_h[C] >= K:
R = C
else:
L = C
print((len(list_h[R:-1])))
| N, K = list(map(int, input().split()))
list_h = list(map(int, input().split()))
count = 0
for i in list_h:
if i >= K:
count += 1
print(count)
| 16 | 9 | 285 | 158 | N, K = list(map(int, input().split()))
list_h = list(map(int, input().split()))
list_h.sort()
list_h.insert(0, 0)
list_h.append(500)
L, R = 0, N + 1
while R - L > 1:
C = (L + R) // 2
if list_h[C] >= K:
R = C
else:
L = C
print((len(list_h[R:-1])))
| N, K = list(map(int, input().split()))
list_h = list(map(int, input().split()))
count = 0
for i in list_h:
if i >= K:
count += 1
print(count)
| false | 43.75 | [
"-list_h.sort()",
"-list_h.insert(0, 0)",
"-list_h.append(500)",
"-L, R = 0, N + 1",
"-while R - L > 1:",
"- C = (L + R) // 2",
"- if list_h[C] >= K:",
"- R = C",
"- else:",
"- L = C",
"-print((len(list_h[R:-1])))",
"+count = 0",
"+for i in list_h:",
"+ if i >= K:... | false | 0.038081 | 0.047577 | 0.800396 | [
"s486281517",
"s787050349"
] |
u680851063 | p03111 | python | s941291882 | s431743349 | 305 | 254 | 12,788 | 3,316 | Accepted | Accepted | 16.72 | # DFS, パターン列挙_竹'n'本の使用パターン
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
stack = [[0],[1],[2],[-1]] # 初期化_ここでは竹の使用パターン4つを設置
ptns = [] # パターン候補の器_初期化
while stack: # stackが空になるまでループ
tmp = stack.pop() # パターンの候補を pop
if len(tmp) == n: # 条件に合えば append
... | # DFS, パターン列挙_竹'n'本の使用パターン
'''
from collections import deque
n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
queue = deque([[0],[1],[2],[-1]]) # 初期化_ここでは竹の使用パターン4つを設置
ptns = [] # パターン候補の器_初期化
while queue: # stackが空になるまでループ
tmp = queue.pop() # パターンの候補を pop
if len(tmp) ... | 73 | 76 | 1,720 | 1,799 | # DFS, パターン列挙_竹'n'本の使用パターン
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
stack = [[0], [1], [2], [-1]] # 初期化_ここでは竹の使用パターン4つを設置
ptns = [] # パターン候補の器_初期化
while stack: # stackが空になるまでループ
tmp = stack.pop() # パターンの候補を pop
if len(tmp) == n: # 条件に合えば append
ptns.ap... | # DFS, パターン列挙_竹'n'本の使用パターン
"""
from collections import deque
n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
queue = deque([[0],[1],[2],[-1]]) # 初期化_ここでは竹の使用パターン4つを設置
ptns = [] # パターン候補の器_初期化
while queue: # stackが空になるまでループ
tmp = queue.pop() # パターンの候補を pop
if len(tmp) == n: # 条件に合えば a... | false | 3.947368 | [
"-n, a, b, c = list(map(int, input().split()))",
"-l = [int(eval(input())) for _ in range(n)]",
"-stack = [[0], [1], [2], [-1]] # 初期化_ここでは竹の使用パターン4つを設置",
"-ptns = [] # パターン候補の器_初期化",
"-while stack: # stackが空になるまでループ",
"- tmp = stack.pop() # パターンの候補を pop",
"- if len(tmp) == n: # 条件に合えば append"... | false | 0.391801 | 0.218421 | 1.793786 | [
"s941291882",
"s431743349"
] |
u078276601 | p02623 | python | s308368744 | s181382490 | 291 | 237 | 47,372 | 50,624 | Accepted | Accepted | 18.56 | n,m,k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a,b = [0], [0]
for i in range(n):
a.append(a[i]+A[i])
for j in range(m):
b.append(b[j]+B[j])
ans, j = 0, m
for i in range(n+1):
if a[i] > k:
break
while a[i] + b[... | import itertools
n,m,k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
acc_A = [0]+list(itertools.accumulate(A))
acc_B = [0]+list(itertools.accumulate(B))
ans, j = 0, m
for i in range(n+1):
if acc_A[i] > k:
break
while acc_A[i... | 19 | 18 | 374 | 399 | n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(n):
a.append(a[i] + A[i])
for j in range(m):
b.append(b[j] + B[j])
ans, j = 0, m
for i in range(n + 1):
if a[i] > k:
break
while a[i] + b[j] > k:
... | import itertools
n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
acc_A = [0] + list(itertools.accumulate(A))
acc_B = [0] + list(itertools.accumulate(B))
ans, j = 0, m
for i in range(n + 1):
if acc_A[i] > k:
break
while acc_A[i] + acc_B[j... | false | 5.263158 | [
"+import itertools",
"+",
"-a, b = [0], [0]",
"-for i in range(n):",
"- a.append(a[i] + A[i])",
"-for j in range(m):",
"- b.append(b[j] + B[j])",
"+acc_A = [0] + list(itertools.accumulate(A))",
"+acc_B = [0] + list(itertools.accumulate(B))",
"- if a[i] > k:",
"+ if acc_A[i] > k:",
... | false | 0.048615 | 0.039213 | 1.239763 | [
"s308368744",
"s181382490"
] |
u612243550 | p02259 | python | s913152147 | s958250548 | 30 | 20 | 7,664 | 7,672 | Accepted | Accepted | 33.33 | n = int(eval(input()))
A = input().split(' ')
count = 0
flag = True
while flag:
flag = False
for j in reversed(list(range(1, n))):
if int(A[j]) < int(A[j-1]):
(A[j-1], A[j]) = (A[j], A[j-1])
count += 1
flag = True
print((" ".join(A)))
print(count) | n = int(eval(input()))
A = input().split(' ')
count = 0
flag = True
while flag:
flag = False
i = 0
for j in reversed(list(range(i + 1, n))):
if int(A[j]) < int(A[j-1]):
(A[j-1], A[j]) = (A[j], A[j-1])
count += 1
flag = True
i += 1
print(... | 15 | 20 | 301 | 334 | n = int(eval(input()))
A = input().split(" ")
count = 0
flag = True
while flag:
flag = False
for j in reversed(list(range(1, n))):
if int(A[j]) < int(A[j - 1]):
(A[j - 1], A[j]) = (A[j], A[j - 1])
count += 1
flag = True
print((" ".join(A)))
print(count)
| n = int(eval(input()))
A = input().split(" ")
count = 0
flag = True
while flag:
flag = False
i = 0
for j in reversed(list(range(i + 1, n))):
if int(A[j]) < int(A[j - 1]):
(A[j - 1], A[j]) = (A[j], A[j - 1])
count += 1
flag = True
i += 1
print((" ".join(A)))
pr... | false | 25 | [
"- for j in reversed(list(range(1, n))):",
"+ i = 0",
"+ for j in reversed(list(range(i + 1, n))):",
"+ i += 1"
] | false | 0.066897 | 0.067788 | 0.986857 | [
"s913152147",
"s958250548"
] |
u698919163 | p02678 | python | s894320667 | s863691553 | 623 | 466 | 34,192 | 121,876 | Accepted | Accepted | 25.2 | from collections import deque
import sys
N,M = list(map(int,input().split()))
graph = [[] for _ in range(N + 1)]
for i in range(M):
a,b = list(map(int,input().split()))
graph[a].append(b)
graph[b].append(a)
que = deque([1])
ans = [0]*(N+1)
while que:
x = deque.popleft(que)
for i in... | N,M = list(map(int,input().split()))
AB = [list(map(int,input().split())) for i in range(M)]
ans = [-1] * (N+1)
graph = [[] for _ in range(N+1)]
for a,b in AB:
graph[a].append(b)
graph[b].append(a)
from collections import deque
import sys
ans = [-1] * (N+1)
todo = deque([(1,0)])
while todo... | 29 | 34 | 571 | 710 | from collections import deque
import sys
N, M = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for i in range(M):
a, b = list(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
que = deque([1])
ans = [0] * (N + 1)
while que:
x = deque.popleft(que)
for i in graph[x]... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
ans = [-1] * (N + 1)
graph = [[] for _ in range(N + 1)]
for a, b in AB:
graph[a].append(b)
graph[b].append(a)
from collections import deque
import sys
ans = [-1] * (N + 1)
todo = deque([(1, 0)])
while todo:
x, p... | false | 14.705882 | [
"+N, M = list(map(int, input().split()))",
"+AB = [list(map(int, input().split())) for i in range(M)]",
"+ans = [-1] * (N + 1)",
"+graph = [[] for _ in range(N + 1)]",
"+for a, b in AB:",
"+ graph[a].append(b)",
"+ graph[b].append(a)",
"-N, M = list(map(int, input().split()))",
"-graph = [[] f... | false | 0.041841 | 0.041488 | 1.008502 | [
"s894320667",
"s863691553"
] |
u092650292 | p02958 | python | s585715983 | s956440216 | 348 | 24 | 21,596 | 3,700 | Accepted | Accepted | 93.1 | import numpy as np
def main():
n = int(eval(input()))
p = list(map(int,input().split()))
a = np.array(list(range(1,n+1)))
p = np.array(p)
ans = len(np.where((a-p)!=0)[0])
if ans <= 2:
print('YES')
else:
print('NO')
main() | #from math import gcd
from math import factorial as f
from math import ceil,floor,sqrt
import bisect
import re
import heapq
from copy import deepcopy
import itertools
from sys import exit
ii = lambda : int(eval(input()))
mi = lambda : list(map(int,input().split()))
li = lambda : list(map(int,... | 21 | 41 | 288 | 565 | import numpy as np
def main():
n = int(eval(input()))
p = list(map(int, input().split()))
a = np.array(list(range(1, n + 1)))
p = np.array(p)
ans = len(np.where((a - p) != 0)[0])
if ans <= 2:
print("YES")
else:
print("NO")
main()
| # from math import gcd
from math import factorial as f
from math import ceil, floor, sqrt
import bisect
import re
import heapq
from copy import deepcopy
import itertools
from sys import exit
ii = lambda: int(eval(input()))
mi = lambda: list(map(int, input().split()))
li = lambda: list(map(int, input().split()))
yes = ... | false | 48.780488 | [
"-import numpy as np",
"+# from math import gcd",
"+from math import factorial as f",
"+from math import ceil, floor, sqrt",
"+import bisect",
"+import re",
"+import heapq",
"+from copy import deepcopy",
"+import itertools",
"+from sys import exit",
"+",
"+ii = lambda: int(eval(input()))",
"... | false | 0.389757 | 0.03665 | 10.634559 | [
"s585715983",
"s956440216"
] |
u608088992 | p03127 | python | s393779202 | s016807087 | 109 | 85 | 14,224 | 20,016 | Accepted | Accepted | 22.02 | N = int(eval(input()))
A = [int(a) for a in input().split()]
def GCD(a, b):
a, b = max(a, b), min(a, b)
while a % b != 0:
a, b = b, a%b
return b
Ans = GCD(A[0], A[1])
for i in range(2, N):
Ans = GCD(Ans, A[i])
print(Ans) | import sys
def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0:
a, b = b, a % b
return b
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
gcdA = A[0]
for a in A: gcdA = gcd(gcdA, a)
print(gcdA)
... | 13 | 20 | 252 | 365 | N = int(eval(input()))
A = [int(a) for a in input().split()]
def GCD(a, b):
a, b = max(a, b), min(a, b)
while a % b != 0:
a, b = b, a % b
return b
Ans = GCD(A[0], A[1])
for i in range(2, N):
Ans = GCD(Ans, A[i])
print(Ans)
| import sys
def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0:
a, b = b, a % b
return b
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
gcdA = A[0]
for a in A:
gcdA = gcd(gcdA, a)
print(gcdA)
return ... | false | 35 | [
"-N = int(eval(input()))",
"-A = [int(a) for a in input().split()]",
"+import sys",
"-def GCD(a, b):",
"+def gcd(a, b):",
"- while a % b != 0:",
"+ while a % b > 0:",
"-Ans = GCD(A[0], A[1])",
"-for i in range(2, N):",
"- Ans = GCD(Ans, A[i])",
"-print(Ans)",
"+def solve():",
"+ ... | false | 0.046702 | 0.045179 | 1.03372 | [
"s393779202",
"s016807087"
] |
u282228874 | p03111 | python | s284950684 | s261754080 | 73 | 61 | 3,064 | 3,064 | Accepted | Accepted | 16.44 | N,A,B,C = list(map(int,input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10**9+7
def dfs(count,a,b,c):
if count == N:
if min(a,b,c) > 0:
return abs(a-A)+abs(b-B)+abs(c-C)-30
else:
return INF
non = dfs(count+1,a,b,c)
useA = dfs(count+1,a+l[count],b,c)+10
useB = dfs(count+1,a,b... | N,A,B,C = list(map(int,input().split()))
L = [int(eval(input())) for i in range(N)]
def dfs(cnt,la,lb,lc,cost):
if cnt == N:
if la == 0 or lb == 0 or lc == 0:
return 10**10
else:
return cost+abs(A-la)+abs(B-lb)+abs(C-lc)-30
else:
a = dfs(cnt+1,la+L[cnt]... | 17 | 17 | 419 | 512 | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10**9 + 7
def dfs(count, a, b, c):
if count == N:
if min(a, b, c) > 0:
return abs(a - A) + abs(b - B) + abs(c - C) - 30
else:
return INF
non = dfs(count + 1, a, b, c)
useA ... | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for i in range(N)]
def dfs(cnt, la, lb, lc, cost):
if cnt == N:
if la == 0 or lb == 0 or lc == 0:
return 10**10
else:
return cost + abs(A - la) + abs(B - lb) + abs(C - lc) - 30
else:
a = dfs(cn... | false | 0 | [
"-l = [int(eval(input())) for i in range(N)]",
"-INF = 10**9 + 7",
"+L = [int(eval(input())) for i in range(N)]",
"-def dfs(count, a, b, c):",
"- if count == N:",
"- if min(a, b, c) > 0:",
"- return abs(a - A) + abs(b - B) + abs(c - C) - 30",
"+def dfs(cnt, la, lb, lc, cost):",
... | false | 0.059719 | 0.077302 | 0.772541 | [
"s284950684",
"s261754080"
] |
u562935282 | p02659 | python | s923208044 | s581386615 | 26 | 22 | 10,068 | 9,176 | Accepted | Accepted | 15.38 | def main():
from decimal import Decimal
A, B = list(map(Decimal, input().split()))
print((int(A * B)))
if __name__ == '__main__':
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_se... | def main():
A, B = input().split()
A = int(A)
B_int, B_frac = list(map(int, B.split('.'))) # 整数部分, 小数部分
L = len(str(B_frac)) # 小数部分の桁数
ans = (A * (B_int * 100 + B_frac)) // 100
print(ans)
if __name__ == '__main__':
main()
| 25 | 14 | 505 | 264 | def main():
from decimal import Decimal
A, B = list(map(Decimal, input().split()))
print((int(A * B)))
if __name__ == "__main__":
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, fun... | def main():
A, B = input().split()
A = int(A)
B_int, B_frac = list(map(int, B.split("."))) # 整数部分, 小数部分
L = len(str(B_frac)) # 小数部分の桁数
ans = (A * (B_int * 100 + B_frac)) // 100
print(ans)
if __name__ == "__main__":
main()
| false | 44 | [
"- from decimal import Decimal",
"-",
"- A, B = list(map(Decimal, input().split()))",
"- print((int(A * B)))",
"+ A, B = input().split()",
"+ A = int(A)",
"+ B_int, B_frac = list(map(int, B.split(\".\"))) # 整数部分, 小数部分",
"+ L = len(str(B_frac)) # 小数部分の桁数",
"+ ans = (A * (B_i... | false | 0.050702 | 0.047102 | 1.07644 | [
"s923208044",
"s581386615"
] |
u045176840 | p03448 | python | s713382080 | s662847536 | 53 | 29 | 9,108 | 9,136 | Accepted | Accepted | 45.28 | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n+1):
if A_init * a <= X:
for b in range(B_n+1):
if (A_init * a + B_init * b) <= X:
... | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n+1):
if A_init * a <= X:
for b in range(B_n+1):
if (A_init * a + B_init * b) <= X:
... | 25 | 26 | 560 | 578 | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n + 1):
if A_init * a <= X:
for b in range(B_n + 1):
if (A_init * a + B_init * b) <= X:
for c in r... | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n + 1):
if A_init * a <= X:
for b in range(B_n + 1):
if (A_init * a + B_init * b) <= X:
K = X - (A... | false | 3.846154 | [
"- for c in range(C_n + 1):",
"- if (A_init * a + B_init * b + C_init * c) == X:",
"- cnt += 1",
"+ K = X - (A_init * a + B_init * b)",
"+ if K % 50 == 0 and K / C_init <= C_n:",
"+ cnt += 1"
] | false | 0.051732 | 0.03997 | 1.294259 | [
"s713382080",
"s662847536"
] |
u309018392 | p02712 | python | s927507696 | s947350406 | 216 | 147 | 52,684 | 52,832 | Accepted | Accepted | 31.94 | n = int(eval(input()))
a = []
for i in range(1,n+1):
a.append(i)
new_a = [i for i in a if i%3 != 0 and i%5 != 0]
print((sum(new_a))) | n = int(eval(input()))
a = list(range(1,n+1))
new_a = [i for i in a if i%3 != 0 and i%5 != 0]
print((sum(new_a))) | 6 | 4 | 134 | 109 | n = int(eval(input()))
a = []
for i in range(1, n + 1):
a.append(i)
new_a = [i for i in a if i % 3 != 0 and i % 5 != 0]
print((sum(new_a)))
| n = int(eval(input()))
a = list(range(1, n + 1))
new_a = [i for i in a if i % 3 != 0 and i % 5 != 0]
print((sum(new_a)))
| false | 33.333333 | [
"-a = []",
"-for i in range(1, n + 1):",
"- a.append(i)",
"+a = list(range(1, n + 1))"
] | false | 0.56311 | 0.181468 | 3.10308 | [
"s927507696",
"s947350406"
] |
u265939044 | p03457 | python | s656026712 | s034699562 | 495 | 430 | 32,148 | 32,148 | Accepted | Accepted | 13.13 | T = 0
X = 1
Y = 2
item = eval(input())
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
tabiji.append(input().split(' '))
a = 'Yes'
for i in range(0, len(tabiji)-1):
time = int(tabiji[i+1][T]) - int(tabiji[i][T])
dX = int(tabiji[i+1][X]) - int(tabiji[i][X])
dY = int(tabiji[i+1][Y]) - int(... | T = 0
X = 1
Y = 2
item = eval(input())
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
tabiji.append(input().split(' '))
a = 'Yes'
for i in range(0, len(tabiji)-1):
time = int(tabiji[i+1][T]) - int(tabiji[i][T])
dX = abs(int(tabiji[i+1][X]) - int(tabiji[i][X]))
dY = abs(int(tabiji[i+1][Y... | 31 | 18 | 762 | 432 | T = 0
X = 1
Y = 2
item = eval(input())
tabiji = [[0, 0, 0]]
for i in range(1, int(item) + 1):
tabiji.append(input().split(" "))
a = "Yes"
for i in range(0, len(tabiji) - 1):
time = int(tabiji[i + 1][T]) - int(tabiji[i][T])
dX = int(tabiji[i + 1][X]) - int(tabiji[i][X])
dY = int(tabiji[i + 1][Y]) - int(t... | T = 0
X = 1
Y = 2
item = eval(input())
tabiji = [[0, 0, 0]]
for i in range(1, int(item) + 1):
tabiji.append(input().split(" "))
a = "Yes"
for i in range(0, len(tabiji) - 1):
time = int(tabiji[i + 1][T]) - int(tabiji[i][T])
dX = abs(int(tabiji[i + 1][X]) - int(tabiji[i][X]))
dY = abs(int(tabiji[i + 1][Y]... | false | 41.935484 | [
"- dX = int(tabiji[i + 1][X]) - int(tabiji[i][X])",
"- dY = int(tabiji[i + 1][Y]) - int(tabiji[i][Y])",
"- for j in range(time):",
"- if dX > 0:",
"- dX -= 1",
"- elif dX < 0:",
"- dX += 1",
"- elif dY > 0:",
"- dY -= 1",
"- eli... | false | 0.052597 | 0.034476 | 1.525603 | [
"s656026712",
"s034699562"
] |
u379959788 | p03241 | python | s331062307 | s541951234 | 694 | 20 | 3,060 | 3,188 | Accepted | Accepted | 97.12 | def is_prime(N):
if N == 1:
return False
for k in range(2, int(N**0.5) + 1):
if N % k == 0:
return False
return True
N, M = list(map(int, input().split()))
k = 0
if N != 1:
if is_prime(M):
print((1))
exit()
while True:
if M % (N + k) == 0... | import bisect
def make_divisors(N):
divisors = []
for i in range(1, int(N**0.5)+1):
if N % i == 0:
divisors.append(i)
if i != N // i:
divisors.append(N//i)
divisors.sort()
return divisors
N, M = list(map(int, input().split()))
lst = make_divisor... | 21 | 13 | 378 | 364 | def is_prime(N):
if N == 1:
return False
for k in range(2, int(N**0.5) + 1):
if N % k == 0:
return False
return True
N, M = list(map(int, input().split()))
k = 0
if N != 1:
if is_prime(M):
print((1))
exit()
while True:
if M % (N + k) == 0:
ans = ... | import bisect
def make_divisors(N):
divisors = []
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
divisors.append(i)
if i != N // i:
divisors.append(N // i)
divisors.sort()
return divisors
N, M = list(map(int, input().split()))
lst = make_divisors(M... | false | 38.095238 | [
"-def is_prime(N):",
"- if N == 1:",
"- return False",
"- for k in range(2, int(N**0.5) + 1):",
"- if N % k == 0:",
"- return False",
"- return True",
"+import bisect",
"+",
"+",
"+def make_divisors(N):",
"+ divisors = []",
"+ for i in range(1, int(N**... | false | 0.106012 | 0.037858 | 2.800243 | [
"s331062307",
"s541951234"
] |
u467736898 | p02575 | python | s231234324 | s428222815 | 1,741 | 694 | 146,000 | 53,596 | Accepted | Accepted | 60.14 | H, W = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(H)]
A = W+1
identity = -(1<<62)
sqrtA = 500
n_buckets = A // sqrtA + 1
Data = [0] * (n_buckets * sqrtA)
Data[0] = 1<<30
Bucket_min = [0] * n_buckets
Lazy = [identity] * n_buckets
def eval_data(k):
if Lazy[k] !... | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export... | 58 | 94 | 1,495 | 2,859 | H, W = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(H)]
A = W + 1
identity = -(1 << 62)
sqrtA = 500
n_buckets = A // sqrtA + 1
Data = [0] * (n_buckets * sqrtA)
Data[0] = 1 << 30
Bucket_min = [0] * n_buckets
Lazy = [identity] * n_buckets
def eval_data(k):
if Lazy[k] != ident... | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export(func.... | false | 38.297872 | [
"-H, W = list(map(int, input().split()))",
"-AB = [list(map(int, input().split())) for _ in range(H)]",
"-A = W + 1",
"-identity = -(1 << 62)",
"-sqrtA = 500",
"-n_buckets = A // sqrtA + 1",
"-Data = [0] * (n_buckets * sqrtA)",
"-Data[0] = 1 << 30",
"-Bucket_min = [0] * n_buckets",
"-Lazy = [ident... | false | 0.04417 | 0.27979 | 0.157867 | [
"s231234324",
"s428222815"
] |
u646336881 | p02681 | python | s286859398 | s678710997 | 186 | 110 | 70,304 | 70,292 | Accepted | Accepted | 40.86 | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float('inf')
YES = "Yes" # type: str
NO = "No" # type: str
def solve(S: str, T: str):
return [NO, YES][len(S)+1 == len(T) and S == T[:-1]]
de... | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float('inf')
YES = "Yes" # type: str
NO = "No" # type: str
def solve(S: str, T: str):
return [NO, YES][S == T[:-1]]
def main():
sys.se... | 32 | 32 | 665 | 642 | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float("inf")
YES = "Yes" # type: str
NO = "No" # type: str
def solve(S: str, T: str):
return [NO, YES][len(S) + 1 == len(T) and S == T[:-1]]
def main():
... | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float("inf")
YES = "Yes" # type: str
NO = "No" # type: str
def solve(S: str, T: str):
return [NO, YES][S == T[:-1]]
def main():
sys.setrecursionlimit(10*... | false | 0 | [
"- return [NO, YES][len(S) + 1 == len(T) and S == T[:-1]]",
"+ return [NO, YES][S == T[:-1]]"
] | false | 0.038336 | 0.038769 | 0.98883 | [
"s286859398",
"s678710997"
] |
u260980560 | p01101 | python | s894927988 | s079791112 | 1,350 | 50 | 7,680 | 7,764 | Accepted | Accepted | 96.3 | while 1:
n, m = list(map(int, input().split()))
if n == m == 0:
break
*A,=list(map(int, input().split()))
s=0
for i in range(n):
for j in range(i):
if s<A[i]+A[j]<=m:
s = A[i]+A[j]
print((s or"NONE")) | while 1:
n, m = list(map(int, input().split()))
if n == m == 0:
break
A=sorted(map(int, input().split()))
def f():
j = n-1
yield 0
for i in range(n):
while j >= 0 and m < A[i]+A[j]:
j -= 1
if j <= i:
brea... | 11 | 16 | 264 | 402 | while 1:
n, m = list(map(int, input().split()))
if n == m == 0:
break
(*A,) = list(map(int, input().split()))
s = 0
for i in range(n):
for j in range(i):
if s < A[i] + A[j] <= m:
s = A[i] + A[j]
print((s or "NONE"))
| while 1:
n, m = list(map(int, input().split()))
if n == m == 0:
break
A = sorted(map(int, input().split()))
def f():
j = n - 1
yield 0
for i in range(n):
while j >= 0 and m < A[i] + A[j]:
j -= 1
if j <= i:
break
... | false | 31.25 | [
"- (*A,) = list(map(int, input().split()))",
"- s = 0",
"- for i in range(n):",
"- for j in range(i):",
"- if s < A[i] + A[j] <= m:",
"- s = A[i] + A[j]",
"- print((s or \"NONE\"))",
"+ A = sorted(map(int, input().split()))",
"+",
"+ def f():",
... | false | 0.145925 | 0.036759 | 3.969825 | [
"s894927988",
"s079791112"
] |
u968404618 | p02619 | python | s405511903 | s471529054 | 38 | 32 | 9,268 | 9,324 | Accepted | Accepted | 15.79 | D = int(eval(input()))
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
T = [int(eval(input()))-1 for _ in range(D)]
last = [0] * 26
score = 0
for d in range(D):
v = T[d]
score += S[d][v]
for i in range(26):
if i == v:
last[i] = 0
... | d = int(eval(input()))
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(d)]
T = [int(eval(input())) for _ in range(d)]
last = [0] * 26
score = 0
for i, (s, t) in enumerate(zip(S, T), 1):
score += s[t-1]
last[t-1] = i
for j in range(26):
score -= C... | 17 | 15 | 398 | 351 | D = int(eval(input()))
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
T = [int(eval(input())) - 1 for _ in range(D)]
last = [0] * 26
score = 0
for d in range(D):
v = T[d]
score += S[d][v]
for i in range(26):
if i == v:
last[i] = 0
else... | d = int(eval(input()))
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(d)]
T = [int(eval(input())) for _ in range(d)]
last = [0] * 26
score = 0
for i, (s, t) in enumerate(zip(S, T), 1):
score += s[t - 1]
last[t - 1] = i
for j in range(26):
score -= C[j] * (i -... | false | 11.764706 | [
"-D = int(eval(input()))",
"+d = int(eval(input()))",
"-S = [list(map(int, input().split())) for _ in range(D)]",
"-T = [int(eval(input())) - 1 for _ in range(D)]",
"+S = [list(map(int, input().split())) for _ in range(d)]",
"+T = [int(eval(input())) for _ in range(d)]",
"-for d in range(D):",
"- v... | false | 0.070996 | 0.105378 | 0.673726 | [
"s405511903",
"s471529054"
] |
u489762173 | p02995 | python | s459583966 | s065397916 | 41 | 17 | 5,372 | 3,064 | Accepted | Accepted | 58.54 | import sys
input = sys.stdin.readline
import fractions
def main():
A, B, C, D = list(map(int, input().split()))
Aone = A - 1
CDlcm = int(C / fractions.gcd(C, D) * D)
Bc = B // C
Bd = B // D
Blcm = B // CDlcm
Bdec = B - Bc - Bd + Blcm
# print(Bc,Bd,Blcm)
Ac = Aon... | import sys
def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // (gcd(a, b))
def main():
A, B, C, D = list(map(int, input().split()))
Aone = A - 1
CDlcm = lcm(C, D)
Bc = B // C
Bd = ... | 28 | 39 | 464 | 572 | import sys
input = sys.stdin.readline
import fractions
def main():
A, B, C, D = list(map(int, input().split()))
Aone = A - 1
CDlcm = int(C / fractions.gcd(C, D) * D)
Bc = B // C
Bd = B // D
Blcm = B // CDlcm
Bdec = B - Bc - Bd + Blcm
# print(Bc,Bd,Blcm)
Ac = Aone // C
Ad = ... | import sys
def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // (gcd(a, b))
def main():
A, B, C, D = list(map(int, input().split()))
Aone = A - 1
CDlcm = lcm(C, D)
Bc = B // C
Bd = B // D
Blcm = B // CDlcm
... | false | 28.205128 | [
"-input = sys.stdin.readline",
"-import fractions",
"+",
"+def gcd(a, b):",
"+ if a < b:",
"+ a, b = b, a",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def lcm(a, b):",
"+ return a * b // (gcd(a, b))",
"- CDlcm = int(C / fractions.gcd(C, D) * D... | false | 0.045016 | 0.03384 | 1.330287 | [
"s459583966",
"s065397916"
] |
u852690916 | p02777 | python | s916171576 | s987447471 | 180 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.56 | S,T=input().split()
A,B=list(map(int, input().split()))
U=eval(input())
if S==U:
print((A-1,B))
else:
print((A,B-1)) | S,T=input().split()
A,B=list(map(int, input().split()))
U=eval(input())
A-=1 if S==U else 0
B-=1 if T==U else 0
print((A,B)) | 8 | 6 | 116 | 115 | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if S == U:
print((A - 1, B))
else:
print((A, B - 1))
| S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
A -= 1 if S == U else 0
B -= 1 if T == U else 0
print((A, B))
| false | 25 | [
"-if S == U:",
"- print((A - 1, B))",
"-else:",
"- print((A, B - 1))",
"+A -= 1 if S == U else 0",
"+B -= 1 if T == U else 0",
"+print((A, B))"
] | false | 0.112096 | 0.035394 | 3.167082 | [
"s916171576",
"s987447471"
] |
u480138356 | p03283 | python | s189737861 | s744859742 | 2,498 | 1,333 | 15,064 | 15,256 | Accepted | Accepted | 46.64 | # import sys
import numpy as np
# input = sys.stdin.readline
def main():
N, M, Q = list(map(int, input().split()))
check = np.zeros((N+1, N+1))
for i in range(M):
l, r = list(map(int, input().split()))
check[r][l] += 1
# print(check)
for i in range(1, N+1):
... | import sys
import numpy as np
input = sys.stdin.readline
def main():
N, M, Q = list(map(int, input().split()))
check = np.zeros((N+1, N+1))
for i in range(M):
l, r = list(map(int, input().split()))
check[r][l] += 1
# print(check)
for i in range(1, N+1):
che... | 26 | 26 | 610 | 606 | # import sys
import numpy as np
# input = sys.stdin.readline
def main():
N, M, Q = list(map(int, input().split()))
check = np.zeros((N + 1, N + 1))
for i in range(M):
l, r = list(map(int, input().split()))
check[r][l] += 1
# print(check)
for i in range(1, N + 1):
check[i] +=... | import sys
import numpy as np
input = sys.stdin.readline
def main():
N, M, Q = list(map(int, input().split()))
check = np.zeros((N + 1, N + 1))
for i in range(M):
l, r = list(map(int, input().split()))
check[r][l] += 1
# print(check)
for i in range(1, N + 1):
check[i] += c... | false | 0 | [
"-# import sys",
"+import sys",
"-# input = sys.stdin.readline",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.279296 | 1.113632 | 0.250798 | [
"s189737861",
"s744859742"
] |
u116038906 | p02780 | python | s915508625 | s955976052 | 201 | 163 | 29,764 | 32,640 | Accepted | Accepted | 18.91 | # 初期入力
N,K = (int(x) for x in input().split(" "))
A = list(map(int, input().split()))
# 1からnまでの和 S_n = n*(n+1)/2 さいころの期待値は S_n /n
kitaiti = [ (i+1)/2 for i in A ]
# N個のサイコロの期待値の累積和 S
S = [0] * (N +1)
#S[0] = kitaiti[0]
#S =[0]
# S[0] = 0
for i in range(1,N +1):
S[i] = S[i-1] + kitaiti[i-1]
# 隣接するK... | # 初期入力
#import numpy as np
import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
p = list(map(int, input().split()))
expected_value =[(i+1)/2 for i in p] #各さいころの期待値
#隣接する数列の和
adjacent_sum =[0]*N
adjacent_sum[0] =sum(expected_value[:K])
ans =[0]*N
ans[0] =adjacent_sum[0]
for i in ... | 25 | 18 | 478 | 466 | # 初期入力
N, K = (int(x) for x in input().split(" "))
A = list(map(int, input().split()))
# 1からnまでの和 S_n = n*(n+1)/2 さいころの期待値は S_n /n
kitaiti = [(i + 1) / 2 for i in A]
# N個のサイコロの期待値の累積和 S
S = [0] * (N + 1)
# S[0] = kitaiti[0]
# S =[0]
# S[0] = 0
for i in range(1, N + 1):
S[i] = S[i - 1] + kitaiti[i - 1]
# 隣接するK個の期待値... | # 初期入力
# import numpy as np
import sys
input = sys.stdin.readline
N, K = (int(i) for i in input().split())
p = list(map(int, input().split()))
expected_value = [(i + 1) / 2 for i in p] # 各さいころの期待値
# 隣接する数列の和
adjacent_sum = [0] * N
adjacent_sum[0] = sum(expected_value[:K])
ans = [0] * N
ans[0] = adjacent_sum[0]
for i ... | false | 28 | [
"-N, K = (int(x) for x in input().split(\" \"))",
"-A = list(map(int, input().split()))",
"-# 1からnまでの和 S_n = n*(n+1)/2 さいころの期待値は S_n /n",
"-kitaiti = [(i + 1) / 2 for i in A]",
"-# N個のサイコロの期待値の累積和 S",
"-S = [0] * (N + 1)",
"-# S[0] = kitaiti[0]",
"-# S =[0]",
"-# S[0] = 0",
"-for i in range(1, N ... | false | 0.11714 | 0.113128 | 1.035463 | [
"s915508625",
"s955976052"
] |
u960080897 | p02579 | python | s131859250 | s712541213 | 835 | 770 | 119,912 | 108,676 | Accepted | Accepted | 7.78 | # Date [ 2020-08-22 21:07:07 ]
# Problem [ d.py ]
# Author Koki_tkg
import sys; from decimal import Decimal
import math; from itertools import combinations, product
import bisect; from collections import Counter, deque, defaultdict
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
... | # Date [ 2020-08-22 21:07:07 ]
# Problem [ d.py ]
# Author Koki_tkg
import sys; from decimal import Decimal
import math; from itertools import combinations, product
import bisect; from collections import Counter, deque, defaultdict
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
... | 82 | 84 | 2,437 | 2,460 | # Date [ 2020-08-22 21:07:07 ]
# Problem [ d.py ]
# Author Koki_tkg
import sys
from decimal import Decimal
import math
from itertools import combinations, product
import bisect
from collections import Counter, deque, defaultdict
# sys.setrecursionlimit(10 ** 6)
MOD = 10**9 + 7
INF = 10**9
PI = 3.14159265358979323846
... | # Date [ 2020-08-22 21:07:07 ]
# Problem [ d.py ]
# Author Koki_tkg
import sys
from decimal import Decimal
import math
from itertools import combinations, product
import bisect
from collections import Counter, deque, defaultdict
# sys.setrecursionlimit(10 ** 6)
MOD = 10**9 + 7
INF = 10**9
PI = 3.14159265358979323846
... | false | 2.380952 | [
"-",
"-@njit(i8(b1[:, :], i8, i8, i8, i8), cache=True)",
"+# @njit(i8(b1[:,:], i8, i8, i8, i8), cache=True)",
"-def cc_export(config):",
"+def cc_export():",
"- for func, signature in config:",
"- vars()[func.__name__] = njit(signature)(func)",
"- cc.export(func.__name__, signature)(f... | false | 0.263099 | 0.313068 | 0.840391 | [
"s131859250",
"s712541213"
] |
u266874640 | p02831 | python | s770336809 | s291817977 | 53 | 35 | 5,560 | 5,048 | Accepted | Accepted | 33.96 | import fractions
A, B = list(map(int, input().split()))
print((A*B // fractions.gcd(A, B))) | import fractions
A, B = list(map(int,input().split()))
def lcm(A,B):
return (A*B) // fractions.gcd(A,B)
print((lcm(A,B)))
| 3 | 5 | 85 | 122 | import fractions
A, B = list(map(int, input().split()))
print((A * B // fractions.gcd(A, B)))
| import fractions
A, B = list(map(int, input().split()))
def lcm(A, B):
return (A * B) // fractions.gcd(A, B)
print((lcm(A, B)))
| false | 40 | [
"-print((A * B // fractions.gcd(A, B)))",
"+",
"+",
"+def lcm(A, B):",
"+ return (A * B) // fractions.gcd(A, B)",
"+",
"+",
"+print((lcm(A, B)))"
] | false | 0.107555 | 0.108661 | 0.989822 | [
"s770336809",
"s291817977"
] |
u814781830 | p02695 | python | s984331042 | s035750894 | 369 | 274 | 77,772 | 75,668 | Accepted | Accepted | 25.75 | N, M, Q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(Q)]
def calc(p):
ret = 0
# 各条件を満たしていれば、dを加算していく
for a, b, c, d in abcd:
if p[b-1] - p[a-1] == c:
ret += d
return ret
ans = [0]
def dfs(s):
if len(s) == N:
ans[... | N, M, Q = list(map(int, input().split()))
abcd = [tuple(map(int, input().split())) for _ in range(Q)]
ans = 0
def calc(p):
ret = 0
for a, b, c, d in abcd:
a, b = a-1, b-1
if p[b] - p[a] == c:
ret += d
return ret
def dfs(a, d):
global ans
if d == N:
... | 24 | 23 | 468 | 470 | N, M, Q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(Q)]
def calc(p):
ret = 0
# 各条件を満たしていれば、dを加算していく
for a, b, c, d in abcd:
if p[b - 1] - p[a - 1] == c:
ret += d
return ret
ans = [0]
def dfs(s):
if len(s) == N:
ans[0] = m... | N, M, Q = list(map(int, input().split()))
abcd = [tuple(map(int, input().split())) for _ in range(Q)]
ans = 0
def calc(p):
ret = 0
for a, b, c, d in abcd:
a, b = a - 1, b - 1
if p[b] - p[a] == c:
ret += d
return ret
def dfs(a, d):
global ans
if d == N:
ans = m... | false | 4.166667 | [
"-abcd = [list(map(int, input().split())) for _ in range(Q)]",
"+abcd = [tuple(map(int, input().split())) for _ in range(Q)]",
"+ans = 0",
"- # 各条件を満たしていれば、dを加算していく",
"- if p[b - 1] - p[a - 1] == c:",
"+ a, b = a - 1, b - 1",
"+ if p[b] - p[a] == c:",
"-ans = [0]",
"-",
"-"... | false | 0.007247 | 0.278487 | 0.026023 | [
"s984331042",
"s035750894"
] |
u619144316 | p02803 | python | s641934359 | s745994701 | 643 | 27 | 3,444 | 3,444 | Accepted | Accepted | 95.8 | from collections import defaultdict,deque
H, W = list(map(int,input().split()))
MAP = []
for _ in range(H):
MAP.append(tuple(map(str,eval(input()))))
move = [[0,1],[0,-1],[1,0],[-1,0]]
MAX = 0
def bfs(s):
global MAX
stack = deque([])
stack.append(tuple(s))
depth =dict()
depth[tu... | from collections import defaultdict,deque
H, W = list(map(int,input().split()))
MAP = []
for _ in range(H):
MAP.append(list(map(str,eval(input()))))
move = [[0,1],[0,-1],[1,0],[-1,0]]
def bfs(s):
MAX = 0
stack = deque([])
stack.append(tuple(s))
depth =dict()
depth[tuple(s)] = 0
... | 33 | 40 | 835 | 943 | from collections import defaultdict, deque
H, W = list(map(int, input().split()))
MAP = []
for _ in range(H):
MAP.append(tuple(map(str, eval(input()))))
move = [[0, 1], [0, -1], [1, 0], [-1, 0]]
MAX = 0
def bfs(s):
global MAX
stack = deque([])
stack.append(tuple(s))
depth = dict()
depth[tuple... | from collections import defaultdict, deque
H, W = list(map(int, input().split()))
MAP = []
for _ in range(H):
MAP.append(list(map(str, eval(input()))))
move = [[0, 1], [0, -1], [1, 0], [-1, 0]]
def bfs(s):
MAX = 0
stack = deque([])
stack.append(tuple(s))
depth = dict()
depth[tuple(s)] = 0
... | false | 17.5 | [
"- MAP.append(tuple(map(str, eval(input()))))",
"+ MAP.append(list(map(str, eval(input()))))",
"-MAX = 0",
"- global MAX",
"+ MAX = 0",
"+ goal = s",
"- for d in list(depth.values()):",
"- MAX = max(MAX, d)",
"+ for k, d in list(depth.items()):",
"+ if MAX < d:",... | false | 0.122699 | 0.035615 | 3.445129 | [
"s641934359",
"s745994701"
] |
u802963389 | p03287 | python | s408447672 | s410423221 | 117 | 99 | 16,796 | 18,844 | Accepted | Accepted | 15.38 | from collections import defaultdict
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
accum = [0] * (n + 1)
for i in range(n):
accum[i + 1] = accum[i] + A[i]
box = defaultdict(int)
for i in accum:
box[i % m] += 1
ans = 0
for v in list(box.values()):
ans += v * (... | # D - Candy Distribution
# https://atcoder.jp/contests/abc105/tasks/abc105_d
from collections import Counter
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
accr = [0] * (n + 1)
for i in range(n):
accr[i + 1] = accr[i] + A[i]
li = [i % m for i in accr]
C = Counter(li)
... | 20 | 23 | 335 | 402 | from collections import defaultdict
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
accum = [0] * (n + 1)
for i in range(n):
accum[i + 1] = accum[i] + A[i]
box = defaultdict(int)
for i in accum:
box[i % m] += 1
ans = 0
for v in list(box.values()):
ans += v * (v - 1) // 2
print(an... | # D - Candy Distribution
# https://atcoder.jp/contests/abc105/tasks/abc105_d
from collections import Counter
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
accr = [0] * (n + 1)
for i in range(n):
accr[i + 1] = accr[i] + A[i]
li = [i % m for i in accr]
C = Counter(li)
ans = 0
for v in li... | false | 13.043478 | [
"-from collections import defaultdict",
"+# D - Candy Distribution",
"+# https://atcoder.jp/contests/abc105/tasks/abc105_d",
"+from collections import Counter",
"-accum = [0] * (n + 1)",
"+accr = [0] * (n + 1)",
"- accum[i + 1] = accum[i] + A[i]",
"-box = defaultdict(int)",
"-for i in accum:",
... | false | 0.03438 | 0.053611 | 0.64129 | [
"s408447672",
"s410423221"
] |
u088552457 | p03937 | python | s182413469 | s239975660 | 164 | 62 | 38,256 | 62,020 | Accepted | Accepted | 62.2 | import sys
input = sys.stdin.readline
import collections
def main():
h, w = input_list()
masu = []
c = 0
for _ in range(h):
c += input().count('#')
if h + w - 1 == c:
print('Possible')
else:
print('Impossible')
def input_list():
return list(map(int, ... | # import sys
# input = sys.stdin.readline
import itertools
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
h, w = input_list()
count = 0
for _ in range(h):
s = list(eval(input()))
count += s.count('#')
if h+w-1 == count:
print('Possible')
... | 25 | 28 | 453 | 533 | import sys
input = sys.stdin.readline
import collections
def main():
h, w = input_list()
masu = []
c = 0
for _ in range(h):
c += input().count("#")
if h + w - 1 == c:
print("Possible")
else:
print("Impossible")
def input_list():
return list(map(int, input().split... | # import sys
# input = sys.stdin.readline
import itertools
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
h, w = input_list()
count = 0
for _ in range(h):
s = list(eval(input()))
count += s.count("#")
if h + w - 1 == count:
print("Possible")
else:
... | false | 10.714286 | [
"-import sys",
"+# import sys",
"+# input = sys.stdin.readline",
"+import itertools",
"-input = sys.stdin.readline",
"-import collections",
"-",
"-",
"+# 持っているビスケットを叩き、1枚増やす",
"+# ビスケット A枚を 1円に交換する",
"+# 1円をビスケット B枚に交換する",
"- masu = []",
"- c = 0",
"+ count = 0",
"- c += ... | false | 0.042477 | 0.035695 | 1.189994 | [
"s182413469",
"s239975660"
] |
u043048943 | p03078 | python | s851383304 | s851606142 | 491 | 380 | 105,176 | 57,820 | Accepted | Accepted | 22.61 | #coding:utf-8
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True
def main():
X,Y,Z,K = LMIIS()
A = L... | #coding:utf-8
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True
def main():
X,Y,Z,K = LMIIS()
A = L... | 40 | 46 | 862 | 1,246 | # coding:utf-8
import sys
sys.setrecursionlimit(2**31 - 1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda: list(map(int, input().split()))
II = lambda: int(input())
dbg = lambda *something: print(*something) if DEBUG is True else 0
DEBUG = True
def main():
X, Y, Z, K = LMIIS()
A = LMIIS()... | # coding:utf-8
import sys
sys.setrecursionlimit(2**31 - 1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda: list(map(int, input().split()))
II = lambda: int(input())
dbg = lambda *something: print(*something) if DEBUG is True else 0
DEBUG = True
def main():
X, Y, Z, K = LMIIS()
A = LMIIS()... | false | 13.043478 | [
"- ans = []",
"- for ai in range(X):",
"- for bi in range(Y):",
"- if ai * bi > K:",
"- break",
"- for ci in range(Z):",
"- if ai * bi * ci > K:",
"- break",
"- ans.append(A[ai] + B[bi] + C[ci])",
"-... | false | 0.061578 | 0.040478 | 1.521252 | [
"s851383304",
"s851606142"
] |
u806201407 | p03776 | python | s209700321 | s302848696 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | from builtins import print
def comb(n, m) :
ans = 1
for i in range(n) :
ans *= i+1
for i in range(m) :
ans //= i+1
for i in range(n-m) :
ans //= i+1
return ans
N, A, B = map(int, input().split())
val = list(reversed(sorted((map(int, input().split())))))
... | import math
def comb(n, m) :
fact = math.factorial
return fact(n) // fact(m) // fact(n-m)
N, A, B = list(map(int, input().split()))
val = list(reversed(sorted(map(int, input().split()))))
ret = 0
prev = [0, 1]
for i in range(A, B + 1):
cur = [sum([val[j] for j in range(i)]), i]
if i > A ... | 31 | 20 | 700 | 505 | from builtins import print
def comb(n, m):
ans = 1
for i in range(n):
ans *= i + 1
for i in range(m):
ans //= i + 1
for i in range(n - m):
ans //= i + 1
return ans
N, A, B = map(int, input().split())
val = list(reversed(sorted((map(int, input().split())))))
ret = 0
prev =... | import math
def comb(n, m):
fact = math.factorial
return fact(n) // fact(m) // fact(n - m)
N, A, B = list(map(int, input().split()))
val = list(reversed(sorted(map(int, input().split()))))
ret = 0
prev = [0, 1]
for i in range(A, B + 1):
cur = [sum([val[j] for j in range(i)]), i]
if i > A and prev[0]... | false | 35.483871 | [
"-from builtins import print",
"+import math",
"- ans = 1",
"- for i in range(n):",
"- ans *= i + 1",
"- for i in range(m):",
"- ans //= i + 1",
"- for i in range(n - m):",
"- ans //= i + 1",
"- return ans",
"+ fact = math.factorial",
"+ return fact(n)... | false | 0.034764 | 0.035392 | 0.98228 | [
"s209700321",
"s302848696"
] |
u620084012 | p03761 | python | s850841686 | s362540663 | 169 | 22 | 38,640 | 3,316 | Accepted | Accepted | 86.98 | n = int(eval(input()))
S = "abcdefghijklmnopqrstuvwxyz"
C = [[0 for k in range(n)] for l in range(26)]
for k in range(n):
t = eval(input())
for e in t:
C[ord(e)-97][k] += 1
ans = ""
for k in range(26):
ans += S[k]*min(C[k])
print(ans)
| from collections import Counter
N = int(eval(input()))
W = [Counter(eval(input())) for k in range(N)]
A = [100000]*26
S = "abcdefghijklmnopqrstuvwxyz"
for e in W:
for s in S:
A[ord(s)-97] = min(A[ord(s)-97],e[s])
ans = ""
for k in range(26):
ans += S[k]*A[k]
print(ans)
| 11 | 13 | 253 | 287 | n = int(eval(input()))
S = "abcdefghijklmnopqrstuvwxyz"
C = [[0 for k in range(n)] for l in range(26)]
for k in range(n):
t = eval(input())
for e in t:
C[ord(e) - 97][k] += 1
ans = ""
for k in range(26):
ans += S[k] * min(C[k])
print(ans)
| from collections import Counter
N = int(eval(input()))
W = [Counter(eval(input())) for k in range(N)]
A = [100000] * 26
S = "abcdefghijklmnopqrstuvwxyz"
for e in W:
for s in S:
A[ord(s) - 97] = min(A[ord(s) - 97], e[s])
ans = ""
for k in range(26):
ans += S[k] * A[k]
print(ans)
| false | 15.384615 | [
"-n = int(eval(input()))",
"+from collections import Counter",
"+",
"+N = int(eval(input()))",
"+W = [Counter(eval(input())) for k in range(N)]",
"+A = [100000] * 26",
"-C = [[0 for k in range(n)] for l in range(26)]",
"-for k in range(n):",
"- t = eval(input())",
"- for e in t:",
"- ... | false | 0.056019 | 0.035943 | 1.558541 | [
"s850841686",
"s362540663"
] |
u197300773 | p02781 | python | s708413666 | s552250455 | 446 | 18 | 3,192 | 3,064 | Accepted | Accepted | 95.96 | import math
import sys
comb=[0,0,0,1,3,6,10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 17... | import math
import sys
n=int(eval(input()))
k=int(eval(input()))
s=str(n)
l=len(s)
dp0=[[0 for j in range(k+1)] for i in range(l)]
dp1=[[0 for j in range(k+1)] for i in range(l)]
x=int(s[0])
dp0[0][1]=x-1
dp0[0][0]=1
dp1[0][1]=1
for i in range(1,l):
x=int(s[i])
dp0[i][0]=1
for j in range(... | 45 | 26 | 1,439 | 558 | import math
import sys
comb = [
0,
0,
0,
1,
3,
6,
10,
15,
21,
28,
36,
45,
55,
66,
78,
91,
105,
120,
136,
153,
171,
190,
210,
231,
253,
276,
300,
325,
351,
378,
406,
435,
465,
496,
... | import math
import sys
n = int(eval(input()))
k = int(eval(input()))
s = str(n)
l = len(s)
dp0 = [[0 for j in range(k + 1)] for i in range(l)]
dp1 = [[0 for j in range(k + 1)] for i in range(l)]
x = int(s[0])
dp0[0][1] = x - 1
dp0[0][0] = 1
dp1[0][1] = 1
for i in range(1, l):
x = int(s[i])
dp0[i][0] = 1
fo... | false | 42.222222 | [
"-comb = [",
"- 0,",
"- 0,",
"- 0,",
"- 1,",
"- 3,",
"- 6,",
"- 10,",
"- 15,",
"- 21,",
"- 28,",
"- 36,",
"- 45,",
"- 55,",
"- 66,",
"- 78,",
"- 91,",
"- 105,",
"- 120,",
"- 136,",
"- 153,",
"- 171,",
"- 19... | false | 0.080976 | 0.03547 | 2.282957 | [
"s708413666",
"s552250455"
] |
u080364835 | p02971 | python | s326388092 | s488411680 | 389 | 356 | 27,376 | 19,064 | Accepted | Accepted | 8.48 | from collections import Counter
n = int(eval(input()))
al = [int(eval(input())) for _ in range(n)]
al_s = sorted(al, reverse=True)
c = Counter(al_s)
ck = list(c.keys())
cv = list(c.values())
for a in al:
if a == ck[0]:
if cv[0] == 1:
print((ck[1]))
else:
pri... | n = int(eval(input()))
al = list(int(eval(input())) for _ in range(n))
al_s = sorted(al)
fir = al_s[-1]
sec = al_s[-2]
for a in al:
if a == fir:
print(sec)
else:
print(fir)
| 19 | 12 | 351 | 198 | from collections import Counter
n = int(eval(input()))
al = [int(eval(input())) for _ in range(n)]
al_s = sorted(al, reverse=True)
c = Counter(al_s)
ck = list(c.keys())
cv = list(c.values())
for a in al:
if a == ck[0]:
if cv[0] == 1:
print((ck[1]))
else:
print((ck[0]))
e... | n = int(eval(input()))
al = list(int(eval(input())) for _ in range(n))
al_s = sorted(al)
fir = al_s[-1]
sec = al_s[-2]
for a in al:
if a == fir:
print(sec)
else:
print(fir)
| false | 36.842105 | [
"-from collections import Counter",
"-",
"-al = [int(eval(input())) for _ in range(n)]",
"-al_s = sorted(al, reverse=True)",
"-c = Counter(al_s)",
"-ck = list(c.keys())",
"-cv = list(c.values())",
"+al = list(int(eval(input())) for _ in range(n))",
"+al_s = sorted(al)",
"+fir = al_s[-1]",
"+sec ... | false | 0.036074 | 0.035218 | 1.024302 | [
"s326388092",
"s488411680"
] |
u558242240 | p02744 | python | s061160598 | s997365817 | 581 | 529 | 28,968 | 4,404 | Accepted | Accepted | 8.95 | n = int(eval(input()))
ans = []
def dfs(x):
if len(x) == n:
ans.append(x)
return
for i in range(max(x)+1):
y = x.copy()
y.append(i+1)
dfs(y)
dfs([1])
#print(ans)
for ai in ans:
print((''.join([chr(ord('a') + x - 1) for x in ai])))
#r = ['a','b','c'... | n = int(eval(input()))
ans = []
def dfs(x):
if len(x) == n:
print((''.join([chr(ord('a') + i - 1) for i in x])))
return
for i in range(max(x)+1):
y = x.copy()
y.append(i+1)
dfs(y)
dfs([1])
| 22 | 12 | 421 | 246 | n = int(eval(input()))
ans = []
def dfs(x):
if len(x) == n:
ans.append(x)
return
for i in range(max(x) + 1):
y = x.copy()
y.append(i + 1)
dfs(y)
dfs([1])
# print(ans)
for ai in ans:
print(("".join([chr(ord("a") + x - 1) for x in ai])))
# r = ['a','b','c','d','e','... | n = int(eval(input()))
ans = []
def dfs(x):
if len(x) == n:
print(("".join([chr(ord("a") + i - 1) for i in x])))
return
for i in range(max(x) + 1):
y = x.copy()
y.append(i + 1)
dfs(y)
dfs([1])
| false | 45.454545 | [
"- ans.append(x)",
"+ print((\"\".join([chr(ord(\"a\") + i - 1) for i in x])))",
"-# print(ans)",
"-for ai in ans:",
"- print((\"\".join([chr(ord(\"a\") + x - 1) for x in ai])))",
"-# r = ['a','b','c','d','e','f','g','h','i','j']",
"-# for ai in ans:",
"-# print(''.join(map(lambda ... | false | 0.03787 | 0.038227 | 0.990648 | [
"s061160598",
"s997365817"
] |
u281303342 | p03458 | python | s004237403 | s199069234 | 1,847 | 1,284 | 101,884 | 101,888 | Accepted | Accepted | 30.48 | import numpy as np
import sys
def sum2d(i1,j1,i2,j2):
A[i1][j1] += 1
A[i1][j2] -= 1
A[i2][j1] -= 1
A[i2][j2] += 1
N,K = list(map(int,input().split()))
XYC = [list(input().split()) for _ in range(N)]
A = [[0 for _ in range(K*2+1)] for _ in range(K*2+1)]
for x,y,c in XYC:
i = (int(x... | # python 3.4.3
import sys
input = sys.stdin.readline
import numpy as np
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
def sum2d(i1,j1,i2,j2):
A[i1][j1] += 1
A[i1][j2] -= 1
A[i2][j1] -= 1
A[i2][j2] +... | 41 | 60 | 925 | 1,462 | import numpy as np
import sys
def sum2d(i1, j1, i2, j2):
A[i1][j1] += 1
A[i1][j2] -= 1
A[i2][j1] -= 1
A[i2][j2] += 1
N, K = list(map(int, input().split()))
XYC = [list(input().split()) for _ in range(N)]
A = [[0 for _ in range(K * 2 + 1)] for _ in range(K * 2 + 1)]
for x, y, c in XYC:
i = (int(x... | # python 3.4.3
import sys
input = sys.stdin.readline
import numpy as np
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
def sum2d(i1, j1, i2, j2):
A[i1][j1] += 1
A[i1][j2] -= 1
A[i2][j1] -= 1
A[i2][j2] += 1
# ... | false | 31.666667 | [
"-import numpy as np",
"+# python 3.4.3",
"+input = sys.stdin.readline",
"+import numpy as np",
"+# function",
"+# main",
"+ # 白はそのまま, 黒はx軸方向にKずらして白として扱う",
"+ # 分割区画の左下が白の場合 (白は5箇所)",
"+ # a * b",
"+ # * c *",
"+ # d * e",
"- sum2d(0, 0, i0, j0) # 左上",
"- ... | false | 0.311574 | 0.561712 | 0.554686 | [
"s004237403",
"s199069234"
] |
u525065967 | p02695 | python | s946161450 | s770632039 | 1,046 | 698 | 9,168 | 9,172 | Accepted | Accepted | 33.27 | n,m,q = list(map(int,input().split()))
abcd = [[*list(map(int,input().split()))] for _ in range(q)]
from itertools import *
ans = 0
for A in combinations_with_replacement(list(range(1, m+1)), n): # nHr
now = 0
for a,b,c,d in abcd:
if A[b-1] - A[a-1] == c: now += d
ans = max(ans, now)
print(... | n,m,q = list(map(int,input().split()))
abcd = [[*list(map(int,input().split()))] for _ in range(q)]
from itertools import *
ans = 0
for A in combinations_with_replacement(list(range(1, m+1)), n): # nHr
now = sum(d if A[b-1] - A[a-1] == c else 0 for a,b,c,d in abcd)
ans = max(ans, now)
print(ans)
| 10 | 8 | 307 | 294 | n, m, q = list(map(int, input().split()))
abcd = [[*list(map(int, input().split()))] for _ in range(q)]
from itertools import *
ans = 0
for A in combinations_with_replacement(list(range(1, m + 1)), n): # nHr
now = 0
for a, b, c, d in abcd:
if A[b - 1] - A[a - 1] == c:
now += d
ans = ma... | n, m, q = list(map(int, input().split()))
abcd = [[*list(map(int, input().split()))] for _ in range(q)]
from itertools import *
ans = 0
for A in combinations_with_replacement(list(range(1, m + 1)), n): # nHr
now = sum(d if A[b - 1] - A[a - 1] == c else 0 for a, b, c, d in abcd)
ans = max(ans, now)
print(ans)
| false | 20 | [
"- now = 0",
"- for a, b, c, d in abcd:",
"- if A[b - 1] - A[a - 1] == c:",
"- now += d",
"+ now = sum(d if A[b - 1] - A[a - 1] == c else 0 for a, b, c, d in abcd)"
] | false | 0.053213 | 0.05771 | 0.922074 | [
"s946161450",
"s770632039"
] |
u084357428 | p03308 | python | s499939100 | s064699784 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
a=[int(_) for _ in input().split()]
ans = 0
for i in range(1,n):
for j in range(i):
ans = max(ans,abs(a[i]-a[j]))
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
print((max(a)-min(a))) | 7 | 3 | 157 | 70 | n = int(eval(input()))
a = [int(_) for _ in input().split()]
ans = 0
for i in range(1, n):
for j in range(i):
ans = max(ans, abs(a[i] - a[j]))
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
print((max(a) - min(a)))
| false | 57.142857 | [
"-a = [int(_) for _ in input().split()]",
"-ans = 0",
"-for i in range(1, n):",
"- for j in range(i):",
"- ans = max(ans, abs(a[i] - a[j]))",
"-print(ans)",
"+a = list(map(int, input().split()))",
"+print((max(a) - min(a)))"
] | false | 0.038917 | 0.04974 | 0.782412 | [
"s499939100",
"s064699784"
] |
u325206354 | p03796 | python | s729287294 | s832482671 | 44 | 35 | 2,940 | 2,940 | Accepted | Accepted | 20.45 | X=10**9+7
def A(c,d):
return c*d%X
a=int(eval(input()))
x=1
for i in range(1,a+1):
x = A(x,i)
print(x)
| X=10**9+7
a=int(eval(input()))
x=1
for i in range(1,a+1):
x = x*i%X
print(x)
| 11 | 8 | 118 | 84 | X = 10**9 + 7
def A(c, d):
return c * d % X
a = int(eval(input()))
x = 1
for i in range(1, a + 1):
x = A(x, i)
print(x)
| X = 10**9 + 7
a = int(eval(input()))
x = 1
for i in range(1, a + 1):
x = x * i % X
print(x)
| false | 27.272727 | [
"-",
"-",
"-def A(c, d):",
"- return c * d % X",
"-",
"-",
"- x = A(x, i)",
"+ x = x * i % X"
] | false | 0.047425 | 0.087627 | 0.541216 | [
"s729287294",
"s832482671"
] |
u414920281 | p03805 | python | s924610813 | s501515767 | 35 | 24 | 3,064 | 3,064 | Accepted | Accepted | 31.43 | import itertools
n,m=list(map(int,input().split()))
path=[[False]*n for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
a-=1
b-=1
path[a][b]=True
path[b][a]=True
ans=0;
for i in itertools.permutations(list(range(n)),n):
if i[0]==0:
for j in range(n):
... | def dfs(a,count,seen):
nseen=seen[:]
ans=0
nseen[a] = 1;
if count==n-1:
return 1
else:
for i in g[a]:
if not seen[i]:
ans+=dfs(i,count+1,nseen)
return ans
n,m=list(map(int,input().split()))
g=[[]*n for i in range(n)]
for i in range(m):... | 20 | 21 | 445 | 443 | import itertools
n, m = list(map(int, input().split()))
path = [[False] * n for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
path[a][b] = True
path[b][a] = True
ans = 0
for i in itertools.permutations(list(range(n)), n):
if i[0] == 0:
for j in r... | def dfs(a, count, seen):
nseen = seen[:]
ans = 0
nseen[a] = 1
if count == n - 1:
return 1
else:
for i in g[a]:
if not seen[i]:
ans += dfs(i, count + 1, nseen)
return ans
n, m = list(map(int, input().split()))
g = [[] * n for i in range(n)]
for i ... | false | 4.761905 | [
"-import itertools",
"+def dfs(a, count, seen):",
"+ nseen = seen[:]",
"+ ans = 0",
"+ nseen[a] = 1",
"+ if count == n - 1:",
"+ return 1",
"+ else:",
"+ for i in g[a]:",
"+ if not seen[i]:",
"+ ans += dfs(i, count + 1, nseen)",
"+ ... | false | 0.059167 | 0.046273 | 1.278641 | [
"s924610813",
"s501515767"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.