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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u075595666 | p02889 | python | s493959944 | s924704434 | 1,016 | 818 | 69,340 | 46,636 | Accepted | Accepted | 19.49 | import sys
sys.setrecursionlimit(10**9)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M,L = list(map(int,readline().split()))
ABC = [list(map(int,readline().split())) for _ in range(M)]
Q = int(readline())
ST = [list(map(int,readline().split())) for... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
N,M,L = list(map(int,readline().split()))
ABC = [list(map(int,readline().split())) for _ in range(M)]
Q = int(... | 43 | 46 | 1,011 | 1,109 | import sys
sys.setrecursionlimit(10**9)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M, L = list(map(int, readline().split()))
ABC = [list(map(int, readline().split())) for _ in range(M)]
Q = int(readline())
ST = [list(map(int, readline().split())) for _ i... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
N, M, L = list(map(int, readline().split()))
ABC = [list(map(int, readline().split())) for _ in range(M)]
Q = int(read... | false | 6.521739 | [
"-sys.setrecursionlimit(10**9)",
"+from scipy.sparse import csr_matrix",
"+from scipy.sparse.csgraph import floyd_warshall",
"+",
"-chk = warshall_floyd(d)",
"+d = csr_matrix(d)",
"+d = floyd_warshall(csgraph=d)",
"- if chk[i][j] <= L:",
"+ if d[i][j] <= L:",
"-ans = warshall_floyd(a... | false | 0.007732 | 0.405093 | 0.019086 | [
"s493959944",
"s924704434"
] |
u169042722 | p02555 | python | s384620274 | s650285884 | 566 | 446 | 9,380 | 9,168 | Accepted | Accepted | 21.2 | S=int(eval(input()))
memo=[0]*2001
def rec(a):
if memo[a]!=0:
return memo[a]
if a<3:
return 0
ans=1
tmp=0
while a-3-tmp>=3:
ans+=rec(a-3-tmp)
tmp+=1
memo[a]=ans
return ans
print((rec(S) % 1000000007)) | S=int(eval(input()))
MOD=1000000007
dp=[0]*2001
dp[3]=1
dp[4]=1
dp[5]=1
for i in range(6,S+1):
tmp=1
for j in range(3,i-2):
tmp+=dp[j]
tmp%=MOD
dp[i]=tmp
print(( dp[S]))
| 17 | 13 | 270 | 202 | S = int(eval(input()))
memo = [0] * 2001
def rec(a):
if memo[a] != 0:
return memo[a]
if a < 3:
return 0
ans = 1
tmp = 0
while a - 3 - tmp >= 3:
ans += rec(a - 3 - tmp)
tmp += 1
memo[a] = ans
return ans
print((rec(S) % 1000000007))
| S = int(eval(input()))
MOD = 1000000007
dp = [0] * 2001
dp[3] = 1
dp[4] = 1
dp[5] = 1
for i in range(6, S + 1):
tmp = 1
for j in range(3, i - 2):
tmp += dp[j]
tmp %= MOD
dp[i] = tmp
print((dp[S]))
| false | 23.529412 | [
"-memo = [0] * 2001",
"-",
"-",
"-def rec(a):",
"- if memo[a] != 0:",
"- return memo[a]",
"- if a < 3:",
"- return 0",
"- ans = 1",
"- tmp = 0",
"- while a - 3 - tmp >= 3:",
"- ans += rec(a - 3 - tmp)",
"- tmp += 1",
"- memo[a] = ans",
"- ... | false | 0.104465 | 0.083144 | 1.256441 | [
"s384620274",
"s650285884"
] |
u270144704 | p02614 | python | s406608763 | s273944655 | 169 | 82 | 71,704 | 73,928 | Accepted | Accepted | 51.48 | import itertools
import copy
h, w, k = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
ans = 0
for ptr_h in itertools.product([0, 1], repeat=h):
for ptr_w in itertools.product([0, 1], repeat=w):
times = 0
tmp = copy.deepcopy(table)
for i, v in enumera... | import itertools
h, w, k = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
ans = 0
for ptr_h in itertools.product([0, 1], repeat=h):
for ptr_w in itertools.product([0, 1], repeat=w):
cnt = 0
for i in range(h):
for j in range(w):
if... | 26 | 15 | 805 | 475 | import itertools
import copy
h, w, k = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
ans = 0
for ptr_h in itertools.product([0, 1], repeat=h):
for ptr_w in itertools.product([0, 1], repeat=w):
times = 0
tmp = copy.deepcopy(table)
for i, v in enumerate(ptr_w... | import itertools
h, w, k = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
ans = 0
for ptr_h in itertools.product([0, 1], repeat=h):
for ptr_w in itertools.product([0, 1], repeat=w):
cnt = 0
for i in range(h):
for j in range(w):
if ptr_h[i... | false | 42.307692 | [
"-import copy",
"- times = 0",
"- tmp = copy.deepcopy(table)",
"- for i, v in enumerate(ptr_w):",
"- if v == 1:",
"- for p in tmp:",
"- p[i] = \"red\"",
"- for i, v in enumerate(ptr_h):",
"- if v == 1:",
"- ... | false | 0.040006 | 0.045414 | 0.880923 | [
"s406608763",
"s273944655"
] |
u263830634 | p03031 | python | s907972470 | s364851916 | 207 | 43 | 41,200 | 3,064 | Accepted | Accepted | 79.23 | #入力
N, M = list(map(int, input().split()))
#入力: 電球iについての情報
lst = []
for i in range(M):
a = list(map(int, input().split()))
lst += [a]
#入力: どのような情報であればOKかのリスト
p = list(map(int, input().split()))
# print ('lst', lst)
#計算部分
ans = 0 #全探索用の答え
for i in range(2 ** N): #1をon, 0をoffとする2bit
#最大でもスイ... | N, M = list(map(int, input().split()))
lst = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
count = 0
#bit全探索
for i in range(2**N): #スイッチの状態をbit-全探索
c = [0] * M
for j in range(N): #j桁目を確認
if (i >> j) & 1: #j桁目 = j個目のスイッチがONの時
for k in range... | 43 | 24 | 1,217 | 554 | # 入力
N, M = list(map(int, input().split()))
# 入力: 電球iについての情報
lst = []
for i in range(M):
a = list(map(int, input().split()))
lst += [a]
# 入力: どのような情報であればOKかのリスト
p = list(map(int, input().split()))
# print ('lst', lst)
# 計算部分
ans = 0 # 全探索用の答え
for i in range(2**N): # 1をon, 0をoffとする2bit
# 最大でもスイッチは10桁+2進数であ... | N, M = list(map(int, input().split()))
lst = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
count = 0
# bit全探索
for i in range(2**N): # スイッチの状態をbit-全探索
c = [0] * M
for j in range(N): # j桁目を確認
if (i >> j) & 1: # j桁目 = j個目のスイッチがONの時
for k in range(M):... | false | 44.186047 | [
"-# 入力",
"-# 入力: 電球iについての情報",
"-lst = []",
"-for i in range(M):",
"- a = list(map(int, input().split()))",
"- lst += [a]",
"-# 入力: どのような情報であればOKかのリスト",
"+lst = [list(map(int, input().split())) for i in range(M)]",
"-# print ('lst', lst)",
"-# 計算部分",
"-ans = 0 # 全探索用の答え",
"-for i in rang... | false | 0.042561 | 0.03628 | 1.173121 | [
"s907972470",
"s364851916"
] |
u239528020 | p02861 | python | s704605253 | s527104384 | 214 | 17 | 16,124 | 3,188 | Accepted | Accepted | 92.06 | ### C
from itertools import combinations
from math import factorial
from scipy.misc import comb
N = int(eval(input()))
x = []
y = []
for i in range(N):
tmp = list(map(int, input().split()))
x.append(tmp[0])
y.append(tmp[1])
len_all = 0
for i, j in combinations(list(range(N)), 2):
len_... | #!/usr/bin/env python3
import itertools
import math
n = int(eval(input()))
ab = [list(map(int, input().split())) for i in range(n)]
sum_dis = 0
for i, j in itertools.permutations(list(range(n)), 2):
x1, y1 = ab[i]
x2, y2 = ab[j]
sum_dis += ((x1-x2)**2+(y1-y2)**2)**0.5
sum_dis /= n*(n-1... | 20 | 19 | 406 | 338 | ### C
from itertools import combinations
from math import factorial
from scipy.misc import comb
N = int(eval(input()))
x = []
y = []
for i in range(N):
tmp = list(map(int, input().split()))
x.append(tmp[0])
y.append(tmp[1])
len_all = 0
for i, j in combinations(list(range(N)), 2):
len_all += ((x[i] - x[... | #!/usr/bin/env python3
import itertools
import math
n = int(eval(input()))
ab = [list(map(int, input().split())) for i in range(n)]
sum_dis = 0
for i, j in itertools.permutations(list(range(n)), 2):
x1, y1 = ab[i]
x2, y2 = ab[j]
sum_dis += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
sum_dis /= n * (n - 1) / 2... | false | 5 | [
"-### C",
"-from itertools import combinations",
"-from math import factorial",
"-from scipy.misc import comb",
"+#!/usr/bin/env python3",
"+import itertools",
"+import math",
"-N = int(eval(input()))",
"-x = []",
"-y = []",
"-for i in range(N):",
"- tmp = list(map(int, input().split()))",
... | false | 0.185019 | 0.037061 | 4.992335 | [
"s704605253",
"s527104384"
] |
u118211443 | p02659 | python | s981284889 | s338822563 | 27 | 23 | 9,932 | 9,160 | Accepted | Accepted | 14.81 | from decimal import Decimal, ROUND_DOWN
marume = 1
a, b = list(map(str, input().split()))
print(((Decimal(a) * Decimal(b)).quantize(Decimal(marume), rounding=ROUND_DOWN)))
| a,b=list(map(str,input().split()))
a=int(a)
b=float(b)
print((int(a*int(100*b+0.5)//100))) | 5 | 4 | 169 | 85 | from decimal import Decimal, ROUND_DOWN
marume = 1
a, b = list(map(str, input().split()))
print(((Decimal(a) * Decimal(b)).quantize(Decimal(marume), rounding=ROUND_DOWN)))
| a, b = list(map(str, input().split()))
a = int(a)
b = float(b)
print((int(a * int(100 * b + 0.5) // 100)))
| false | 20 | [
"-from decimal import Decimal, ROUND_DOWN",
"-",
"-marume = 1",
"-print(((Decimal(a) * Decimal(b)).quantize(Decimal(marume), rounding=ROUND_DOWN)))",
"+a = int(a)",
"+b = float(b)",
"+print((int(a * int(100 * b + 0.5) // 100)))"
] | false | 0.053255 | 0.095865 | 0.555516 | [
"s981284889",
"s338822563"
] |
u440566786 | p02925 | python | s327833870 | s187845783 | 1,198 | 648 | 131,712 | 67,932 | Accepted | Accepted | 45.91 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
from itertools import product
n=int(eval(input()))
match=[[0]*n for _ in range(n)]
V=0 # V=n(n-1)/2
for i,j in product(list(range(n)),repeat=2):
if(... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
# popするため逆順にしておく
A=[list([int(x)-1 for x in input().split()]) for _ in range(n)]
for i in range(n): A[i].reverse()
stack=[]
def c... | 43 | 31 | 1,127 | 806 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
from itertools import product
n = int(eval(input()))
match = [[0] * n for _ in range(n)]
V = 0 # V=n(n-1)/2
for i, j in product(list(range(n)), repeat=2):... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
# popするため逆順にしておく
A = [list([int(x) - 1 for x in input().split()]) for _ in range(n)]
for i in range(n):
A[i].reverse()
stack ... | false | 27.906977 | [
"- from itertools import product",
"+ n = int(eval(input()))",
"+ # popするため逆順にしておく",
"+ A = [list([int(x) - 1 for x in input().split()]) for _ in range(n)]",
"+ for i in range(n):",
"+ A[i].reverse()",
"+ stack = []",
"- n = int(eval(input()))",
"- match = [[0] * n for... | false | 0.112909 | 0.083674 | 1.349392 | [
"s327833870",
"s187845783"
] |
u226191225 | p03731 | python | s744562360 | s454027782 | 259 | 158 | 85,456 | 25,200 | Accepted | Accepted | 39 | n,t = list(map(int,input().split()))
a = [int(i) for i in input().split()]
ans = t
for i in range(1,n):
if a[i]-a[i-1] < t:
ans += a[i]-a[i-1]
else:
ans += t
print(ans) | n,t = list(map(int,input().split()))
time = list(map(int,input().split()))
ans = 0
for i in range(n-1):
ans += min(time[i+1]-time[i],t)
print((ans+t)) | 9 | 6 | 182 | 151 | n, t = list(map(int, input().split()))
a = [int(i) for i in input().split()]
ans = t
for i in range(1, n):
if a[i] - a[i - 1] < t:
ans += a[i] - a[i - 1]
else:
ans += t
print(ans)
| n, t = list(map(int, input().split()))
time = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
ans += min(time[i + 1] - time[i], t)
print((ans + t))
| false | 33.333333 | [
"-a = [int(i) for i in input().split()]",
"-ans = t",
"-for i in range(1, n):",
"- if a[i] - a[i - 1] < t:",
"- ans += a[i] - a[i - 1]",
"- else:",
"- ans += t",
"-print(ans)",
"+time = list(map(int, input().split()))",
"+ans = 0",
"+for i in range(n - 1):",
"+ ans += mi... | false | 0.039378 | 0.15043 | 0.261768 | [
"s744562360",
"s454027782"
] |
u493520238 | p03212 | python | s670621584 | s728241893 | 215 | 38 | 42,588 | 3,956 | Accepted | Accepted | 82.33 | from itertools import product
n = int(eval(input()))
n_len = len(str(n))
ans = 0
for i in range(3,n_len):
ite = product(list(range(3)),repeat=i)
for it in ite:
if 0 in it and 1 in it and 2 in it:
ans += 1
num_d = {0:7,1:5,2:3}
ite = product(list(range(3)),repeat=n_len)
for i... | import sys
sys.setrecursionlimit(10**6)
def dfs(curr_num, e753, list753, n):
if curr_num > n: return
if e753 == 7:
list753.append(curr_num)
dfs(curr_num*10+7, e753|4, list753, n)
dfs(curr_num*10+5, e753|2, list753, n)
dfs(curr_num*10+3, e753|1, list753, n)
def main():
n... | 23 | 22 | 523 | 446 | from itertools import product
n = int(eval(input()))
n_len = len(str(n))
ans = 0
for i in range(3, n_len):
ite = product(list(range(3)), repeat=i)
for it in ite:
if 0 in it and 1 in it and 2 in it:
ans += 1
num_d = {0: 7, 1: 5, 2: 3}
ite = product(list(range(3)), repeat=n_len)
for it in ite... | import sys
sys.setrecursionlimit(10**6)
def dfs(curr_num, e753, list753, n):
if curr_num > n:
return
if e753 == 7:
list753.append(curr_num)
dfs(curr_num * 10 + 7, e753 | 4, list753, n)
dfs(curr_num * 10 + 5, e753 | 2, list753, n)
dfs(curr_num * 10 + 3, e753 | 1, list753, n)
def ... | false | 4.347826 | [
"-from itertools import product",
"+import sys",
"-n = int(eval(input()))",
"-n_len = len(str(n))",
"-ans = 0",
"-for i in range(3, n_len):",
"- ite = product(list(range(3)), repeat=i)",
"- for it in ite:",
"- if 0 in it and 1 in it and 2 in it:",
"- ans += 1",
"-num_d = ... | false | 0.163045 | 0.091331 | 1.78521 | [
"s670621584",
"s728241893"
] |
u597374218 | p03252 | python | s044457668 | s513271685 | 42 | 35 | 3,828 | 3,632 | Accepted | Accepted | 16.67 | from collections import Counter
S=Counter(eval(input()))
T=Counter(eval(input()))
s=list(S.values())
t=list(T.values())
print(("Yes" if sorted(s)==sorted(t) else "No")) | s=eval(input())
t=eval(input())
S=sorted(map(s.count,set(s)))
T=sorted(map(t.count,set(t)))
print(("Yes" if S==T else "No")) | 6 | 5 | 147 | 114 | from collections import Counter
S = Counter(eval(input()))
T = Counter(eval(input()))
s = list(S.values())
t = list(T.values())
print(("Yes" if sorted(s) == sorted(t) else "No"))
| s = eval(input())
t = eval(input())
S = sorted(map(s.count, set(s)))
T = sorted(map(t.count, set(t)))
print(("Yes" if S == T else "No"))
| false | 16.666667 | [
"-from collections import Counter",
"-",
"-S = Counter(eval(input()))",
"-T = Counter(eval(input()))",
"-s = list(S.values())",
"-t = list(T.values())",
"-print((\"Yes\" if sorted(s) == sorted(t) else \"No\"))",
"+s = eval(input())",
"+t = eval(input())",
"+S = sorted(map(s.count, set(s)))",
"+T... | false | 0.037601 | 0.042908 | 0.876314 | [
"s044457668",
"s513271685"
] |
u102445737 | p02659 | python | s540591462 | s119352853 | 474 | 26 | 71,436 | 9,900 | Accepted | Accepted | 94.51 | #from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**1... | #from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**1... | 22 | 22 | 496 | 496 | # from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x, end="")
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda: input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
... | # from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x, end="")
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda: input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
... | false | 0 | [
"-b = Decimal(b)",
"-b = int(100 * b)",
"+b = float(b)",
"+b = round(100 * b)"
] | false | 0.099739 | 0.034393 | 2.900014 | [
"s540591462",
"s119352853"
] |
u925364229 | p03565 | python | s482415663 | s248853439 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | S_raw = eval(input())
T_raw = eval(input())
S = list(S_raw)
T = list(T_raw)
i = 0
j = 0
j_list = []
S_list = []
lt = len(T)
ls = len(S)
while True:
if (j >= ls) or (i >= lt):
if i < lt :
if j_list == []:
print("UNRESTORABLE")
exit(0)
else:
break
elif j < ls:
j_lis... | S = eval(input())
T = eval(input())
ans = []
sl = len(S)
tl = len(T)
for i in range(sl-tl+1):
if S[i] == '?' or S[i] == T[0]:
flg = True
for j in range(1,tl):
if S[i+j] != '?' and S[i+j] != T[j]:
flg = False
break
if flg:
s = S[:i] + T + S[i+tl:]
ans.append(s.replace('?','a'))
... | 59 | 24 | 744 | 388 | S_raw = eval(input())
T_raw = eval(input())
S = list(S_raw)
T = list(T_raw)
i = 0
j = 0
j_list = []
S_list = []
lt = len(T)
ls = len(S)
while True:
if (j >= ls) or (i >= lt):
if i < lt:
if j_list == []:
print("UNRESTORABLE")
exit(0)
else:
... | S = eval(input())
T = eval(input())
ans = []
sl = len(S)
tl = len(T)
for i in range(sl - tl + 1):
if S[i] == "?" or S[i] == T[0]:
flg = True
for j in range(1, tl):
if S[i + j] != "?" and S[i + j] != T[j]:
flg = False
break
if flg:
s = S... | false | 59.322034 | [
"-S_raw = eval(input())",
"-T_raw = eval(input())",
"-S = list(S_raw)",
"-T = list(T_raw)",
"-i = 0",
"-j = 0",
"-j_list = []",
"-S_list = []",
"-lt = len(T)",
"-ls = len(S)",
"-while True:",
"- if (j >= ls) or (i >= lt):",
"- if i < lt:",
"- if j_list == []:",
"- ... | false | 0.044906 | 0.044178 | 1.016494 | [
"s482415663",
"s248853439"
] |
u525796732 | p02793 | python | s221178011 | s857753719 | 1,896 | 1,557 | 6,136 | 17,168 | Accepted | Accepted | 17.88 | import sys
import math
import fractions
from collections import defaultdict
from functools import reduce
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(map(int, stdin.readli... | import sys
import math
import fractions
from collections import defaultdict
from functools import reduce
import collections
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(... | 29 | 83 | 642 | 1,809 | import sys
import math
import fractions
from collections import defaultdict
from functools import reduce
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(map(int, stdin.readline().split()))
INF =... | import sys
import math
import fractions
from collections import defaultdict
from functools import reduce
import collections
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(map(int, stdin.readlin... | false | 65.060241 | [
"+import collections",
"+NMAX = 10**6",
"+",
"+",
"+class Sieve:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.f = [0] * (n + 1)",
"+ self.prime = []",
"+ self.f[0] = self.f[1] = -1",
"+ for i in range(2, n + 1):",
"+ if self.f[i]:",
"... | false | 0.053882 | 0.731757 | 0.073634 | [
"s221178011",
"s857753719"
] |
u686713618 | p03478 | python | s911649020 | s944326808 | 47 | 25 | 2,940 | 2,940 | Accepted | Accepted | 46.81 | N, A, B = list(map(int, input().split()))
sum = 0
ans = 0
for i in range (N+1):
for j in range (len(str(i))):
sum += int(str(i)[j])
if A <= sum and sum <= B:
ans += i
sum = 0
print(ans)
| def keta(n):
sum = 0
while n>0:
sum += n%10
n = n//10
return(sum)
def mium():
N, A, B = list(map(int, input().split()))
ans = 0
for i in range (N):
a = keta(i+1)
if A <= a and a <= B:
ans += i+1
print(ans)
if __name__ == "__main__":
mium() | 11 | 16 | 208 | 288 | N, A, B = list(map(int, input().split()))
sum = 0
ans = 0
for i in range(N + 1):
for j in range(len(str(i))):
sum += int(str(i)[j])
if A <= sum and sum <= B:
ans += i
sum = 0
print(ans)
| def keta(n):
sum = 0
while n > 0:
sum += n % 10
n = n // 10
return sum
def mium():
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N):
a = keta(i + 1)
if A <= a and a <= B:
ans += i + 1
print(ans)
if __name__ == "__main__":
... | false | 31.25 | [
"-N, A, B = list(map(int, input().split()))",
"-sum = 0",
"-ans = 0",
"-for i in range(N + 1):",
"- for j in range(len(str(i))):",
"- sum += int(str(i)[j])",
"- if A <= sum and sum <= B:",
"- ans += i",
"+def keta(n):",
"-print(ans)",
"+ while n > 0:",
"+ sum += n... | false | 0.04768 | 0.073556 | 0.648211 | [
"s911649020",
"s944326808"
] |
u417365712 | p02762 | python | s484264534 | s721841522 | 1,284 | 895 | 118,824 | 118,040 | Accepted | Accepted | 30.3 | class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def find_root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.find_root(self.root[x])
return self.root[x]
... | class UnionFind():
def __init__(self, n):
self._n = n
self._table = [-1]*n
def _root(self, x):
stack = []
while self._table[x] >= 0:
stack.append(x)
x = self._table[x]
for y in stack:
self._table[y] = x
return x
... | 60 | 62 | 1,721 | 1,579 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def find_root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find_root(self.root[x])
return self.root[x]
def... | class UnionFind:
def __init__(self, n):
self._n = n
self._table = [-1] * n
def _root(self, x):
stack = []
while self._table[x] >= 0:
stack.append(x)
x = self._table[x]
for y in stack:
self._table[y] = x
return x
def unite(... | false | 3.225806 | [
"- self.n = n",
"- self.root = [-1] * (n + 1)",
"- self.rnk = [0] * (n + 1)",
"+ self._n = n",
"+ self._table = [-1] * n",
"- def find_root(self, x):",
"- if self.root[x] < 0:",
"- return x",
"- else:",
"- self.root[x] = sel... | false | 0.038298 | 0.037767 | 1.014069 | [
"s484264534",
"s721841522"
] |
u870178975 | p02859 | python | s366928460 | s858430368 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | print(((int(eval(input())))**2)) | n=int(eval(input()))
print((int(n**2))) | 1 | 2 | 24 | 32 | print(((int(eval(input()))) ** 2))
| n = int(eval(input()))
print((int(n**2)))
| false | 50 | [
"-print(((int(eval(input()))) ** 2))",
"+n = int(eval(input()))",
"+print((int(n**2)))"
] | false | 0.064493 | 0.071471 | 0.902363 | [
"s366928460",
"s858430368"
] |
u670180528 | p03164 | python | s036779729 | s570429744 | 1,021 | 171 | 311,448 | 3,444 | Accepted | Accepted | 83.25 | N,W,*l = list(map(int,open(0).read().split()))
wl = l[::2]
vl = l[1::2]
M = N*max(vl)
INF = float("inf")
dp = [[INF]*(M+1) for _ in range(N+1)]
dp[0][0] = 0
# minimum weight with value == j
for i in range(N):
w,v = wl[i],vl[i]
for j in range(M+1):
if j >= v:
dp[i+1][j] = min(dp[i][j],dp[i][j-v]+w)
... | from heapq import heappop, heappush
from operator import itemgetter
def branchAndBound(N: int, M: int, V: list, W: list, R: list) -> int:
def upperbound(w, v, i):
rest = M - w
_v = v
for j in range(i + 1, N):
if W[j] >= rest:
rest -= W[j]
... | 23 | 48 | 487 | 1,368 | N, W, *l = list(map(int, open(0).read().split()))
wl = l[::2]
vl = l[1::2]
M = N * max(vl)
INF = float("inf")
dp = [[INF] * (M + 1) for _ in range(N + 1)]
dp[0][0] = 0
# minimum weight with value == j
for i in range(N):
w, v = wl[i], vl[i]
for j in range(M + 1):
if j >= v:
dp[i + 1][j] = min... | from heapq import heappop, heappush
from operator import itemgetter
def branchAndBound(N: int, M: int, V: list, W: list, R: list) -> int:
def upperbound(w, v, i):
rest = M - w
_v = v
for j in range(i + 1, N):
if W[j] >= rest:
rest -= W[j]
v += V[... | false | 52.083333 | [
"-N, W, *l = list(map(int, open(0).read().split()))",
"-wl = l[::2]",
"-vl = l[1::2]",
"-M = N * max(vl)",
"-INF = float(\"inf\")",
"-dp = [[INF] * (M + 1) for _ in range(N + 1)]",
"-dp[0][0] = 0",
"-# minimum weight with value == j",
"-for i in range(N):",
"- w, v = wl[i], vl[i]",
"- for ... | false | 0.042296 | 0.05631 | 0.751128 | [
"s036779729",
"s570429744"
] |
u315485238 | p03464 | python | s958374155 | s108621790 | 1,034 | 129 | 14,428 | 14,252 | Accepted | Accepted | 87.52 | K = int(eval(input()))
A = list(map(int, input().split()))
def winner_count(N, A=A):
for a in A:
N = a*(N//a)
return N
def bisect_left(func, l, r, target):
# n>=i ⇒ func(n) <= targetを満たす最小のi
# l=1, r=sum(A)+2
# func(l)<= target, target<=func(r)
if l==r:
return 0
... | K = int(eval(input()))
A = list(map(int, input().split()))
_min=2
_max=2
for a in A[::-1]:
# min ~ maxでaの倍数 minはそのまま、maxは+(a-1)
if _min%a:
if a*(_min//a) + a > _max:
print((-1))
break
else:
_min = a*(_min//a) + a
else:
_min = _min
_max = a*(_max//a) + a-1
els... | 47 | 20 | 1,060 | 335 | K = int(eval(input()))
A = list(map(int, input().split()))
def winner_count(N, A=A):
for a in A:
N = a * (N // a)
return N
def bisect_left(func, l, r, target):
# n>=i ⇒ func(n) <= targetを満たす最小のi
# l=1, r=sum(A)+2
# func(l)<= target, target<=func(r)
if l == r:
return 0
if ... | K = int(eval(input()))
A = list(map(int, input().split()))
_min = 2
_max = 2
for a in A[::-1]:
# min ~ maxでaの倍数 minはそのまま、maxは+(a-1)
if _min % a:
if a * (_min // a) + a > _max:
print((-1))
break
else:
_min = a * (_min // a) + a
else:
_min = _min
... | false | 57.446809 | [
"-",
"-",
"-def winner_count(N, A=A):",
"- for a in A:",
"- N = a * (N // a)",
"- return N",
"-",
"-",
"-def bisect_left(func, l, r, target):",
"- # n>=i ⇒ func(n) <= targetを満たす最小のi",
"- # l=1, r=sum(A)+2",
"- # func(l)<= target, target<=func(r)",
"- if l == r:",
"... | false | 0.127384 | 0.065316 | 1.950294 | [
"s958374155",
"s108621790"
] |
u153665391 | p02264 | python | s366687849 | s568063554 | 600 | 400 | 24,388 | 13,272 | Accepted | Accepted | 33.33 | process_num, qms = list(map(int, input().split()))
raw_procs = [eval(input()) for i in range(process_num)]
if __name__ == '__main__':
procs = []
for row in raw_procs:
name, time = row.split()
procs.append({
"name": name,
"time": int(time),
})
t... | from collections import deque
n,p=list(map(int ,input().split()))
que=deque([])
for i in range(n):
name,time=input().split()
time=int(time)
que.append([name,time])
t=0
while len(que)>0:
atop=que.popleft()
spend=min(atop[1],p)
atop[1]-=spend
t+=spend
if(atop[1]==0):
... | 29 | 20 | 921 | 377 | process_num, qms = list(map(int, input().split()))
raw_procs = [eval(input()) for i in range(process_num)]
if __name__ == "__main__":
procs = []
for row in raw_procs:
name, time = row.split()
procs.append(
{
"name": name,
"time": int(time),
... | from collections import deque
n, p = list(map(int, input().split()))
que = deque([])
for i in range(n):
name, time = input().split()
time = int(time)
que.append([name, time])
t = 0
while len(que) > 0:
atop = que.popleft()
spend = min(atop[1], p)
atop[1] -= spend
t += spend
if atop[1] ==... | false | 31.034483 | [
"-process_num, qms = list(map(int, input().split()))",
"-raw_procs = [eval(input()) for i in range(process_num)]",
"-if __name__ == \"__main__\":",
"- procs = []",
"- for row in raw_procs:",
"- name, time = row.split()",
"- procs.append(",
"- {",
"- \"na... | false | 0.042924 | 0.040557 | 1.058377 | [
"s366687849",
"s568063554"
] |
u386819480 | p03612 | python | s225985192 | s182233605 | 80 | 71 | 14,452 | 14,452 | Accepted | Accepted | 11.25 | #!/usr/bin/env python3
import sys
def solve(N: int, p: "List[int]"):
ans = 0
for i in range(N-1):
if(i+1 == p[i]):
p[i],p[i+1] = p[i+1],p[i]
ans += 1
for i in range(N-1,-1,-1):
if(i+1 == p[i]):
p[i],p[i-1] = p[i-1],p[i]
... | #!/usr/bin/env python3
import sys
def solve(N: int, p: "List[int]"):
ans = 0
for i in range(N-1):
if(i+1 == p[i]):
p[i],p[i+1] = p[i+1],p[i]
ans += 1
if(N == p[N-1]):
ans += 1
print(ans)
# for i in range(N-1):
# ... | 37 | 47 | 884 | 1,077 | #!/usr/bin/env python3
import sys
def solve(N: int, p: "List[int]"):
ans = 0
for i in range(N - 1):
if i + 1 == p[i]:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
for i in range(N - 1, -1, -1):
if i + 1 == p[i]:
p[i], p[i - 1] = p[i - 1], p[i]
an... | #!/usr/bin/env python3
import sys
def solve(N: int, p: "List[int]"):
ans = 0
for i in range(N - 1):
if i + 1 == p[i]:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
if N == p[N - 1]:
ans += 1
print(ans)
# for i in range(N-1):
# if(i+1 == p[i]):
# ... | false | 21.276596 | [
"- for i in range(N - 1, -1, -1):",
"- if i + 1 == p[i]:",
"- p[i], p[i - 1] = p[i - 1], p[i]",
"- ans += 1",
"+ if N == p[N - 1]:",
"+ ans += 1",
"+ # for i in range(N-1):",
"+ # if(i+1 == p[i]):",
"+ # p[i],p[i+1] = p[i+1],p[i]",
"+ ... | false | 0.035646 | 0.103323 | 0.344995 | [
"s225985192",
"s182233605"
] |
u896588506 | p02683 | python | s073644979 | s950366834 | 92 | 84 | 9,164 | 9,240 | Accepted | Accepted | 8.7 | n,m,x = list(map(int,input().split()))
books = []
for i in range(n):
book = list(map(int,input().split()))
books.append(book)
min_money = -1
#n冊あるとき、2**n通りの選び方
count = 0
for i in range(2**n):
select = format(count, "0" + str(n) + "b")
lst = []
# print(select)
while "1" in selec... | n,m,x = list(map(int,input().split()))
books = []
for i in range(n):
book = list(map(int,input().split()))
books.append(book)
min_money = -1
#n冊あるとき、2**n通りの選び方
count = 0
for i in range(2**n):
select = format(count, "0" + str(n) + "b")
lst = []
while "1" in select:
index = s... | 35 | 32 | 885 | 779 | n, m, x = list(map(int, input().split()))
books = []
for i in range(n):
book = list(map(int, input().split()))
books.append(book)
min_money = -1
# n冊あるとき、2**n通りの選び方
count = 0
for i in range(2**n):
select = format(count, "0" + str(n) + "b")
lst = []
# print(select)
while "1" in select:
in... | n, m, x = list(map(int, input().split()))
books = []
for i in range(n):
book = list(map(int, input().split()))
books.append(book)
min_money = -1
# n冊あるとき、2**n通りの選び方
count = 0
for i in range(2**n):
select = format(count, "0" + str(n) + "b")
lst = []
while "1" in select:
index = select.index("... | false | 8.571429 | [
"- # print(select)",
"- select = \"0\" * (index + 1) + select[index + 1 :]",
"- # print(lst)",
"+ select = select.replace(\"1\", \"0\", 1)",
"- # print(\"skill\" + str(j) + \"sum\" + str(skill))"
] | false | 0.081635 | 0.037649 | 2.168285 | [
"s073644979",
"s950366834"
] |
u235376569 | p02783 | python | s921267820 | s706030974 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | h,a = [int(x) for x in input().rstrip().split()]
if h%a==0:
print((h//a))
else:
print(((h//a)+1)) | H,A=[int(x) for x in input().rstrip().split()]
if H%A==0:
print((H//A))
else:
print((H//A+1))
| 5 | 6 | 105 | 100 | h, a = [int(x) for x in input().rstrip().split()]
if h % a == 0:
print((h // a))
else:
print(((h // a) + 1))
| H, A = [int(x) for x in input().rstrip().split()]
if H % A == 0:
print((H // A))
else:
print((H // A + 1))
| false | 16.666667 | [
"-h, a = [int(x) for x in input().rstrip().split()]",
"-if h % a == 0:",
"- print((h // a))",
"+H, A = [int(x) for x in input().rstrip().split()]",
"+if H % A == 0:",
"+ print((H // A))",
"- print(((h // a) + 1))",
"+ print((H // A + 1))"
] | false | 0.039563 | 0.058082 | 0.681157 | [
"s921267820",
"s706030974"
] |
u094191970 | p02995 | python | s309793221 | s072111166 | 39 | 35 | 5,348 | 5,048 | Accepted | Accepted | 10.26 | import fractions
a,b,c,d = list(map(int, input().split()))
lcm = (c*d)//fractions.gcd(c,d)
sum = b-a+1
x = (b//c) - ((a-1)//c)
y = (b//d) - ((a-1)//d)
z = (b//lcm) - ((a-1)//lcm)
n_i = x+y-z
print((int(sum-n_i))) | from fractions import gcd
a,b,c,d=list(map(int,input().split()))
ok1=b-a+1
ng1=b//c-a//c if a%c!=0 else b//c-a//c+1
ng2=b//d-a//d if a%d!=0 else b//d-a//d+1
lcm=(c*d)//gcd(c,d)
ok2=b//lcm-a//lcm if a%lcm!=0 else b//lcm-a//lcm+1
print((ok1-ng1-ng2+ok2)) | 9 | 11 | 212 | 257 | import fractions
a, b, c, d = list(map(int, input().split()))
lcm = (c * d) // fractions.gcd(c, d)
sum = b - a + 1
x = (b // c) - ((a - 1) // c)
y = (b // d) - ((a - 1) // d)
z = (b // lcm) - ((a - 1) // lcm)
n_i = x + y - z
print((int(sum - n_i)))
| from fractions import gcd
a, b, c, d = list(map(int, input().split()))
ok1 = b - a + 1
ng1 = b // c - a // c if a % c != 0 else b // c - a // c + 1
ng2 = b // d - a // d if a % d != 0 else b // d - a // d + 1
lcm = (c * d) // gcd(c, d)
ok2 = b // lcm - a // lcm if a % lcm != 0 else b // lcm - a // lcm + 1
print((ok1 -... | false | 18.181818 | [
"-import fractions",
"+from fractions import gcd",
"-lcm = (c * d) // fractions.gcd(c, d)",
"-sum = b - a + 1",
"-x = (b // c) - ((a - 1) // c)",
"-y = (b // d) - ((a - 1) // d)",
"-z = (b // lcm) - ((a - 1) // lcm)",
"-n_i = x + y - z",
"-print((int(sum - n_i)))",
"+ok1 = b - a + 1",
"+ng1 = b ... | false | 0.047892 | 0.1029 | 0.465429 | [
"s309793221",
"s072111166"
] |
u298297089 | p02984 | python | s392565029 | s121519813 | 117 | 98 | 15,432 | 17,224 | Accepted | Accepted | 16.24 | N = int(eval(input()))
A = list(map(int,input().split()))
x1 = sum(A) - 2 * sum(A[1::2])
ans = []
ans.append(x1)
for i in range(N-1):
x1 = 2 * A[i] - x1
ans.append(x1)
print((*ans)) | N = int(eval(input()))
A = list(map(int,input().split()))
x1 = sum(A) - 2 * sum(A[1::2])
ans = []
ans.append(str(x1))
for i in range(N-1):
x1 = 2 * A[i] - x1
ans.append(str(x1))
print((' '.join(ans))) | 10 | 10 | 191 | 210 | N = int(eval(input()))
A = list(map(int, input().split()))
x1 = sum(A) - 2 * sum(A[1::2])
ans = []
ans.append(x1)
for i in range(N - 1):
x1 = 2 * A[i] - x1
ans.append(x1)
print((*ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
x1 = sum(A) - 2 * sum(A[1::2])
ans = []
ans.append(str(x1))
for i in range(N - 1):
x1 = 2 * A[i] - x1
ans.append(str(x1))
print((" ".join(ans)))
| false | 0 | [
"-ans.append(x1)",
"+ans.append(str(x1))",
"- ans.append(x1)",
"-print((*ans))",
"+ ans.append(str(x1))",
"+print((\" \".join(ans)))"
] | false | 0.035927 | 0.035256 | 1.019028 | [
"s392565029",
"s121519813"
] |
u352394527 | p01525 | python | s549551394 | s387598705 | 11,090 | 7,230 | 868,088 | 868,660 | Accepted | Accepted | 34.81 | from collections import defaultdict
MAX = 3652425
n, q = list(map(int, input().split()))
lst = [tuple(map(int, input().split())) for _ in range(n)]
restor = [0] * (MAX + 10010)
t0s = [0] * (MAX + 10010)
t1s = [0] * (MAX + 10010)
t2s = [0] * (MAX + 10010)
t3s = [0] * (MAX + 10010)
t1_cnt_save = defaultdict(int)... | from collections import defaultdict
def main():
MAX = 3652425
n, q = list(map(int, input().split()))
lst = [tuple(map(int, input().split())) for _ in range(n)]
restore = [0] * (MAX + 10010)
t0s = [0] * (MAX + 10010)
t1s = [0] * (MAX + 10010)
t2s = [0] * (MAX + 10010)
t3s = [0] * (MAX + 10010)... | 57 | 61 | 1,709 | 1,811 | from collections import defaultdict
MAX = 3652425
n, q = list(map(int, input().split()))
lst = [tuple(map(int, input().split())) for _ in range(n)]
restor = [0] * (MAX + 10010)
t0s = [0] * (MAX + 10010)
t1s = [0] * (MAX + 10010)
t2s = [0] * (MAX + 10010)
t3s = [0] * (MAX + 10010)
t1_cnt_save = defaultdict(int)
t3_cnt_... | from collections import defaultdict
def main():
MAX = 3652425
n, q = list(map(int, input().split()))
lst = [tuple(map(int, input().split())) for _ in range(n)]
restore = [0] * (MAX + 10010)
t0s = [0] * (MAX + 10010)
t1s = [0] * (MAX + 10010)
t2s = [0] * (MAX + 10010)
t3s = [0] * (MAX +... | false | 6.557377 | [
"-MAX = 3652425",
"-n, q = list(map(int, input().split()))",
"-lst = [tuple(map(int, input().split())) for _ in range(n)]",
"-restor = [0] * (MAX + 10010)",
"-t0s = [0] * (MAX + 10010)",
"-t1s = [0] * (MAX + 10010)",
"-t2s = [0] * (MAX + 10010)",
"-t3s = [0] * (MAX + 10010)",
"-t1_cnt_save = default... | false | 0.283719 | 0.18943 | 1.49775 | [
"s549551394",
"s387598705"
] |
u143509139 | p02771 | python | s866406334 | s151737272 | 177 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.4 | a, b, c = list(map(int, input().split()))
if a == c and a != b:
print('Yes')
elif a == b and a != c:
print('Yes')
elif b == c and a != b:
print('Yes')
else:
print('No')
| if len(set(input().split()))==2:
print('Yes')
else:
print('No') | 9 | 4 | 187 | 70 | a, b, c = list(map(int, input().split()))
if a == c and a != b:
print("Yes")
elif a == b and a != c:
print("Yes")
elif b == c and a != b:
print("Yes")
else:
print("No")
| if len(set(input().split())) == 2:
print("Yes")
else:
print("No")
| false | 55.555556 | [
"-a, b, c = list(map(int, input().split()))",
"-if a == c and a != b:",
"- print(\"Yes\")",
"-elif a == b and a != c:",
"- print(\"Yes\")",
"-elif b == c and a != b:",
"+if len(set(input().split())) == 2:"
] | false | 0.096702 | 0.035572 | 2.71845 | [
"s866406334",
"s151737272"
] |
u659034691 | p02268 | python | s395619235 | s807316009 | 950 | 710 | 18,764 | 18,776 | Accepted | Accepted | 25.26 | # your code goes here
#binary
n=int(eval(input()))
S=[int(i) for i in input().split()]
q=int(eval(input()))
T=[int(i) for i in input().split()]
C=0
for i in range(q):
j=n//2
b=n//2
while T[i]!=S[j] and b>1:
if b%2==1:
b+=1
b//=2
if T[i]>S[j]:
j+... | # your code goes here
#binary search function
def bi(B0,bA,BI):
bm=bA[1]+bA[2]
bm//=2
if BI[bA[1]]<=B0<=BI[bm]:
bA=[0,bA[1],bm]
else:
bA=[0,bm,bA[2]]
# print(bA)
return bA
def bs(B0,BI):
if B0<BI[0]:
bA=[0,0,0]
elif B0>BI[-1]:
bA=[0,-1,-1]
... | 36 | 38 | 678 | 793 | # your code goes here
# binary
n = int(eval(input()))
S = [int(i) for i in input().split()]
q = int(eval(input()))
T = [int(i) for i in input().split()]
C = 0
for i in range(q):
j = n // 2
b = n // 2
while T[i] != S[j] and b > 1:
if b % 2 == 1:
b += 1
b //= 2
if T[i] > S[... | # your code goes here
# binary search function
def bi(B0, bA, BI):
bm = bA[1] + bA[2]
bm //= 2
if BI[bA[1]] <= B0 <= BI[bm]:
bA = [0, bA[1], bm]
else:
bA = [0, bm, bA[2]]
# print(bA)
return bA
def bs(B0, BI):
if B0 < BI[0]:
bA = [0, 0, 0]
elif B0 > BI[-1]:
... | false | 5.263158 | [
"-# binary",
"+# binary search function",
"+def bi(B0, bA, BI):",
"+ bm = bA[1] + bA[2]",
"+ bm //= 2",
"+ if BI[bA[1]] <= B0 <= BI[bm]:",
"+ bA = [0, bA[1], bm]",
"+ else:",
"+ bA = [0, bm, bA[2]]",
"+ # print(bA)",
"+ return bA",
"+",
"+",
"+def bs(B0, BI)... | false | 0.036365 | 0.037801 | 0.962003 | [
"s395619235",
"s807316009"
] |
u567124995 | p03231 | python | s251095259 | s824781340 | 47 | 19 | 5,560 | 3,316 | Accepted | Accepted | 59.57 | import fractions
n, m = list(map(int,input().split()))
s = eval(input())
t = eval(input())
q = fractions.gcd(n, m)
l = n * m // q #lcm(n, m)
for i in range(0, q):
if s[i * n//q] != t[i * m//q]:
print('-1')
exit()
print(l) | n, m = list(map(int,input().split()))
s = eval(input())
t = eval(input())
def gcd(a, b):
while b > 0:
a, b = b, a%b
return a
g = gcd(n, m)
l = n * m // g
for i in range(0, g):
if s[i * n//g] != t[i * m//g]:
print('-1')
exit()
print(l) | 11 | 14 | 223 | 255 | import fractions
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
q = fractions.gcd(n, m)
l = n * m // q # lcm(n, m)
for i in range(0, q):
if s[i * n // q] != t[i * m // q]:
print("-1")
exit()
print(l)
| n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
g = gcd(n, m)
l = n * m // g
for i in range(0, g):
if s[i * n // g] != t[i * m // g]:
print("-1")
exit()
print(l)
| false | 21.428571 | [
"-import fractions",
"-",
"-q = fractions.gcd(n, m)",
"-l = n * m // q # lcm(n, m)",
"-for i in range(0, q):",
"- if s[i * n // q] != t[i * m // q]:",
"+",
"+",
"+def gcd(a, b):",
"+ while b > 0:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+g = gcd(n, m)",
"+l = n ... | false | 0.155621 | 0.042748 | 3.640443 | [
"s251095259",
"s824781340"
] |
u816872429 | p03031 | python | s122593383 | s006845857 | 223 | 29 | 42,352 | 3,064 | Accepted | Accepted | 87 | n, m = list(map(int, input().split()))
s = [list(map(int, input().split()[1:])) for _ in range(m)]
p = list(map(int, input().split()))
ret = 0
for b in range(1 << n):
if all(sum((b >> (i - 1)) & 1 for i in s[j]) % 2 == p[j] for j in range(m)):
ret += 1
print(ret) | n, m = list(map(int, input().split()))
k = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
print((sum(all(sum((b >> (j - 1)) & 1 for j in k[i]) % 2 == p[i] for i in range(m)) for b in range(2 ** n)))) | 8 | 4 | 276 | 239 | n, m = list(map(int, input().split()))
s = [list(map(int, input().split()[1:])) for _ in range(m)]
p = list(map(int, input().split()))
ret = 0
for b in range(1 << n):
if all(sum((b >> (i - 1)) & 1 for i in s[j]) % 2 == p[j] for j in range(m)):
ret += 1
print(ret)
| n, m = list(map(int, input().split()))
k = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
print(
(
sum(
all(sum((b >> (j - 1)) & 1 for j in k[i]) % 2 == p[i] for i in range(m))
for b in range(2**n)
)
)
)
| false | 50 | [
"-s = [list(map(int, input().split()[1:])) for _ in range(m)]",
"+k = [list(map(int, input().split()))[1:] for _ in range(m)]",
"-ret = 0",
"-for b in range(1 << n):",
"- if all(sum((b >> (i - 1)) & 1 for i in s[j]) % 2 == p[j] for j in range(m)):",
"- ret += 1",
"-print(ret)",
"+print(",
... | false | 0.03555 | 0.058414 | 0.608578 | [
"s122593383",
"s006845857"
] |
u533885955 | p03325 | python | s130435080 | s078925524 | 156 | 139 | 4,148 | 4,148 | Accepted | Accepted | 10.9 | N = int(eval(input()))
array = list(map(int,input().split(" ")))
i = 0
count = 0
while i < N:
if array[i]%2 == 0:
array[i] = array[i]/2
count+=1
else:
i+=1
print(count) | N=int(eval(input()))
a=list(map(int,input().split()))
count=0
for i in range(N):
while a[i]%2==0:
a[i]=int(a[i]/2)
count+=1
print(count) | 11 | 8 | 204 | 147 | N = int(eval(input()))
array = list(map(int, input().split(" ")))
i = 0
count = 0
while i < N:
if array[i] % 2 == 0:
array[i] = array[i] / 2
count += 1
else:
i += 1
print(count)
| N = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in range(N):
while a[i] % 2 == 0:
a[i] = int(a[i] / 2)
count += 1
print(count)
| false | 27.272727 | [
"-array = list(map(int, input().split(\" \")))",
"-i = 0",
"+a = list(map(int, input().split()))",
"-while i < N:",
"- if array[i] % 2 == 0:",
"- array[i] = array[i] / 2",
"+for i in range(N):",
"+ while a[i] % 2 == 0:",
"+ a[i] = int(a[i] / 2)",
"- else:",
"- i += ... | false | 0.040895 | 0.0434 | 0.942265 | [
"s130435080",
"s078925524"
] |
u138486156 | p03494 | python | s442446605 | s863970766 | 21 | 17 | 3,064 | 3,060 | Accepted | Accepted | 19.05 | N = int(eval(input()))
list = input().split()
num_list = []
for c in list:
n = int(c)
num_list.append(n)
state = True
i = 0
while state:
j = 0
for n in num_list:
if n % 2:
state = False
else:
del num_list[j]
n /= 2
n... | import math
n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - (bin(i).rfind("1") + 1))
print(ans) | 26 | 7 | 434 | 165 | N = int(eval(input()))
list = input().split()
num_list = []
for c in list:
n = int(c)
num_list.append(n)
state = True
i = 0
while state:
j = 0
for n in num_list:
if n % 2:
state = False
else:
del num_list[j]
n /= 2
n = int(n)
nu... | import math
n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - (bin(i).rfind("1") + 1))
print(ans)
| false | 73.076923 | [
"-N = int(eval(input()))",
"-list = input().split()",
"-num_list = []",
"-for c in list:",
"- n = int(c)",
"- num_list.append(n)",
"-state = True",
"-i = 0",
"-while state:",
"- j = 0",
"- for n in num_list:",
"- if n % 2:",
"- state = False",
"- else:"... | false | 0.048757 | 0.047804 | 1.019917 | [
"s442446605",
"s863970766"
] |
u255595446 | p02717 | python | s352794467 | s149260056 | 185 | 20 | 38,384 | 9,112 | Accepted | Accepted | 89.19 | X,Y,Z = list(map(int,input().split()))
print((Z,X,Y))
| import sys
import heapq
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
# N = list(map(int,input().split()))
B,C,A = list(map(int,input().split()))
print((A,B,C)) | 3 | 8 | 49 | 189 | X, Y, Z = list(map(int, input().split()))
print((Z, X, Y))
| import sys
import heapq
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
# N = list(map(int,input().split()))
B, C, A = list(map(int, input().split()))
print((A, B, C))
| false | 62.5 | [
"-X, Y, Z = list(map(int, input().split()))",
"-print((Z, X, Y))",
"+import sys",
"+import heapq",
"+",
"+sys.setrecursionlimit(10**6)",
"+input = lambda: sys.stdin.readline().rstrip()",
"+# N = list(map(int,input().split()))",
"+B, C, A = list(map(int, input().split()))",
"+print((A, B, C))"
] | false | 0.034904 | 0.036003 | 0.969471 | [
"s352794467",
"s149260056"
] |
u279493135 | p02599 | python | s142410790 | s128778063 | 1,848 | 1,129 | 205,876 | 229,048 | Accepted | Accepted | 38.91 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | 74 | 73 | 2,199 | 2,094 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | false | 1.351351 | [
"-ilr = [[i] + LIST() for i, _ in enumerate(range(Q))]",
"-ilr.sort(key=lambda x: x[2])",
"+ps = [[] for _ in range(N + 1)]",
"+qs = [[] for _ in range(N + 1)]",
"+for i in range(Q):",
"+ l, r = MAP()",
"+ qs[l].append((r, i))",
"+checked = [-1] * (N + 1)",
"+for i, x in enumerate(c):",
"+ ... | false | 0.124421 | 0.048911 | 2.54381 | [
"s142410790",
"s128778063"
] |
u077291787 | p02558 | python | s727148165 | s581152703 | 357 | 324 | 18,908 | 18,912 | Accepted | Accepted | 9.24 | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int) -> None:
self._data_size = data_size
self._roots = [-1] * data_size
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
... | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int) -> None:
self._data_size = data_size
self._roots = [-1] * data_size
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
... | 39 | 44 | 983 | 1,088 | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int) -> None:
self._data_size = data_size
self._roots = [-1] * data_size
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
def is_... | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int) -> None:
self._data_size = data_size
self._roots = [-1] * data_size
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
def is_... | false | 11.363636 | [
"-import sys",
"+def main():",
"+ import sys",
"-readline = sys.stdin.readline",
"-N, Q = list(map(int, readline().split()))",
"-tree = UnionFind(N)",
"-res = []",
"-for _ in range(Q):",
"- t, u, v = list(map(int, readline().split()))",
"- if t:",
"- res.append(int(tree.is_connec... | false | 0.041165 | 0.041478 | 0.992457 | [
"s727148165",
"s581152703"
] |
u555962250 | p03805 | python | s446608401 | s816483499 | 1,375 | 189 | 171,456 | 40,304 | Accepted | Accepted | 86.25 | import itertools
N, M = list(map(int, input().split()))
ab = []
for i in range(M):
ab.append(list(map(int, input().split())))
ans = 0
if M >= N - 1:
for i in list(itertools.combinations(ab, N - 1)):
g = {}
for j in range(N):
g[j + 1] = []
for j, k in i:
... | import itertools
N, M = list(map(int, input().split()))
e = set([])
for i in range(M):
a, b = list(map(int, input().split()))
e.add((a, b))
ans = 0
for i in list(itertools.permutations(list(range(2, N + 1)))):
a = 1
for b in i:
if (a, b) in e or (b, a) in e:
a = b
... | 27 | 17 | 687 | 372 | import itertools
N, M = list(map(int, input().split()))
ab = []
for i in range(M):
ab.append(list(map(int, input().split())))
ans = 0
if M >= N - 1:
for i in list(itertools.combinations(ab, N - 1)):
g = {}
for j in range(N):
g[j + 1] = []
for j, k in i:
g[j].appe... | import itertools
N, M = list(map(int, input().split()))
e = set([])
for i in range(M):
a, b = list(map(int, input().split()))
e.add((a, b))
ans = 0
for i in list(itertools.permutations(list(range(2, N + 1)))):
a = 1
for b in i:
if (a, b) in e or (b, a) in e:
a = b
contin... | false | 37.037037 | [
"-ab = []",
"+e = set([])",
"- ab.append(list(map(int, input().split())))",
"+ a, b = list(map(int, input().split()))",
"+ e.add((a, b))",
"-if M >= N - 1:",
"- for i in list(itertools.combinations(ab, N - 1)):",
"- g = {}",
"- for j in range(N):",
"- g[j + 1] ... | false | 0.064838 | 0.068368 | 0.948367 | [
"s446608401",
"s816483499"
] |
u841623074 | p03776 | python | s192672206 | s707187628 | 22 | 18 | 3,316 | 3,064 | Accepted | Accepted | 18.18 | import math
from collections import Counter
N, A, B = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse = True)
cnt_v = Counter(v)
ave = []
for i in range(A, B+1):
ave.append(sum(v[0:i]) / i)
max_ave = max(ave)
ans = 0
for j in range(B-A+1):
temp = 1
i... | N,A,B=list(map(int,input().split()))
v=[int(x)for x in input().split()]
v.sort(reverse=True)
a=sum(v[:A])/A
m=min(v[:A])
k=v.count(m)
l=v.index(m)
ans=0
import math
for i in range(A,B+1):
if i==A:
ans+=(math.factorial(k)//math.factorial(i-l))//math.factorial(k-i+l)
else:
if k-i+l>=0... | 27 | 21 | 592 | 514 | import math
from collections import Counter
N, A, B = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt_v = Counter(v)
ave = []
for i in range(A, B + 1):
ave.append(sum(v[0:i]) / i)
max_ave = max(ave)
ans = 0
for j in range(B - A + 1):
temp = 1
if ave[j] == max_av... | N, A, B = list(map(int, input().split()))
v = [int(x) for x in input().split()]
v.sort(reverse=True)
a = sum(v[:A]) / A
m = min(v[:A])
k = v.count(m)
l = v.index(m)
ans = 0
import math
for i in range(A, B + 1):
if i == A:
ans += (math.factorial(k) // math.factorial(i - l)) // math.factorial(k - i + l)
... | false | 22.222222 | [
"+N, A, B = list(map(int, input().split()))",
"+v = [int(x) for x in input().split()]",
"+v.sort(reverse=True)",
"+a = sum(v[:A]) / A",
"+m = min(v[:A])",
"+k = v.count(m)",
"+l = v.index(m)",
"+ans = 0",
"-from collections import Counter",
"-N, A, B = list(map(int, input().split()))",
"-v = lis... | false | 0.109697 | 0.18893 | 0.580622 | [
"s192672206",
"s707187628"
] |
u133936772 | p02785 | python | s914213980 | s756971227 | 161 | 108 | 26,356 | 31,752 | Accepted | Accepted | 32.92 | f=lambda:list(map(int,input().split()))
n,k=f()
l=sorted(f())[::-1]
if n>k:
print((sum(l[k:])))
else:
print((0)) | n,k,*l=list(map(int,open(0).read().split()))
print(([0,sum(sorted(l)[:n-k])][n>k])) | 7 | 2 | 112 | 76 | f = lambda: list(map(int, input().split()))
n, k = f()
l = sorted(f())[::-1]
if n > k:
print((sum(l[k:])))
else:
print((0))
| n, k, *l = list(map(int, open(0).read().split()))
print(([0, sum(sorted(l)[: n - k])][n > k]))
| false | 71.428571 | [
"-f = lambda: list(map(int, input().split()))",
"-n, k = f()",
"-l = sorted(f())[::-1]",
"-if n > k:",
"- print((sum(l[k:])))",
"-else:",
"- print((0))",
"+n, k, *l = list(map(int, open(0).read().split()))",
"+print(([0, sum(sorted(l)[: n - k])][n > k]))"
] | false | 0.040943 | 0.007967 | 5.13929 | [
"s914213980",
"s756971227"
] |
u467736898 | p02868 | python | s591295092 | s206224025 | 1,733 | 1,220 | 40,936 | 107,604 | Accepted | Accepted | 29.6 | class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
def __init__(self, a, sqrt_n=500):
from itertools import zip_longest
self.n = len(a)
self.sqrt_n = sqrt_n
self.layer1 = a
self.layer0 = [min(values) for values in zip_longest(*[iter(a)]*sqrt_n, fillvalue=float("inf"))]
... | # セグ木のパフォーマンステスト
class SegmentTree(object):
__slots__ = ["elem_size", "tree", "default", "op"]
def __init__(self, a, default, op):
self.default = default
self.op = op
if hasattr(a, "__iter__"):
real_size = len(a)
self.elem_size = elem_size = 1 << (real... | 65 | 68 | 1,842 | 2,123 | class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
def __init__(self, a, sqrt_n=500):
from itertools import zip_longest
self.n = len(a)
self.sqrt_n = sqrt_n
self.layer1 = a
self.layer0 = [
min(values)
for values in zip_longest(*[iter(a)] * sqrt_n, fillv... | # セグ木のパフォーマンステスト
class SegmentTree(object):
__slots__ = ["elem_size", "tree", "default", "op"]
def __init__(self, a, default, op):
self.default = default
self.op = op
if hasattr(a, "__iter__"):
real_size = len(a)
self.elem_size = elem_size = 1 << (real_size - 1).... | false | 4.411765 | [
"-class Rmq:",
"- # 平方分割",
"- # 値を変更すると元のリストの値も書き換わる",
"- def __init__(self, a, sqrt_n=500):",
"- from itertools import zip_longest",
"+# セグ木のパフォーマンステスト",
"+class SegmentTree(object):",
"+ __slots__ = [\"elem_size\", \"tree\", \"default\", \"op\"]",
"- self.n = len(a)",
"... | false | 0.036753 | 0.037498 | 0.980129 | [
"s591295092",
"s206224025"
] |
u912650255 | p02848 | python | s332620444 | s709846957 | 28 | 22 | 3,060 | 3,060 | Accepted | Accepted | 21.43 | arb='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(eval(input()))
S = eval(input())
ans =''
for i in range(len(S)):
if arb.index(S[i]) + N +1 <= len(arb):
ans += arb[arb.index(S[i])+N]
else:
ans += arb[-len(arb) + arb.index(S[i]) + N]
print(ans) | N = int(eval(input()))
S = eval(input())
ans = ''
for i in S:
if ord(i) + N <= 90:
ans += chr(ord(i)+N)
else:
ans += chr(-90 + ord(i) +N +64)
print(ans)
| 10 | 11 | 256 | 177 | arb = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(eval(input()))
S = eval(input())
ans = ""
for i in range(len(S)):
if arb.index(S[i]) + N + 1 <= len(arb):
ans += arb[arb.index(S[i]) + N]
else:
ans += arb[-len(arb) + arb.index(S[i]) + N]
print(ans)
| N = int(eval(input()))
S = eval(input())
ans = ""
for i in S:
if ord(i) + N <= 90:
ans += chr(ord(i) + N)
else:
ans += chr(-90 + ord(i) + N + 64)
print(ans)
| false | 9.090909 | [
"-arb = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
"-for i in range(len(S)):",
"- if arb.index(S[i]) + N + 1 <= len(arb):",
"- ans += arb[arb.index(S[i]) + N]",
"+for i in S:",
"+ if ord(i) + N <= 90:",
"+ ans += chr(ord(i) + N)",
"- ans += arb[-len(arb) + arb.index(S[i]) + N]",
"+ ... | false | 0.08287 | 0.035756 | 2.31761 | [
"s332620444",
"s709846957"
] |
u729133443 | p04047 | python | s976280312 | s789681963 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | eval(input());print((sum(sorted(map(int,input().split()))[::2]))) | n,l=open(0);print((sum(sorted(map(int,l.split()))[::2]))) | 1 | 1 | 57 | 55 | eval(input())
print((sum(sorted(map(int, input().split()))[::2])))
| n, l = open(0)
print((sum(sorted(map(int, l.split()))[::2])))
| false | 0 | [
"-eval(input())",
"-print((sum(sorted(map(int, input().split()))[::2])))",
"+n, l = open(0)",
"+print((sum(sorted(map(int, l.split()))[::2])))"
] | false | 0.034017 | 0.038167 | 0.891265 | [
"s976280312",
"s789681963"
] |
u145231176 | p02850 | python | s459505545 | s486767993 | 899 | 529 | 99,104 | 130,536 | Accepted | Accepted | 41.16 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
from collections import defaultdict, deque
from sys import exit
import math
im... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 60 | 82 | 1,301 | 1,941 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
from collections import defaultdict, deque
from sys import exit
import math
import ... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 26.829268 | [
"-from collections import defaultdict, deque",
"+def input():",
"+ return sys.stdin.readline().rstrip()",
"+",
"+",
"+def rand_N(ran1, ran2):",
"+ return random.randint(ran1, ran2)",
"+",
"+",
"+def rand_List(ran1, ran2, rantime):",
"+ return [random.randint(ran1, ran2) for i in range(r... | false | 0.043216 | 0.045617 | 0.94735 | [
"s459505545",
"s486767993"
] |
u664610890 | p03836 | python | s395031195 | s279716943 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | sx, sy, tx, ty = list(map(int, input().split()))
s = ''
dx = tx - sx
dy = ty - sy
for i in range(dx):
s += 'R'
for i in range(dy):
s += 'U'
for i in range(dx):
s += 'L'
for i in range(dy+1):
s += 'D'
for i in range(dx+1):
s += 'R'
for i in range(dy+1):
s += 'U'
s +=... | sx, sy, tx, ty = list(map(int, input().split()))
s = ''
dx = tx - sx
dy = ty - sy
s += 'R'*dx + 'U'*dy + 'L'*dx + 'D'*(dy+1)
s += 'R'*(dx+1) + 'U'*(dy+1) + 'LU' + 'L'*(dx+1) + 'D'*(dy+1) + 'R'
print(s)
| 34 | 10 | 422 | 208 | sx, sy, tx, ty = list(map(int, input().split()))
s = ""
dx = tx - sx
dy = ty - sy
for i in range(dx):
s += "R"
for i in range(dy):
s += "U"
for i in range(dx):
s += "L"
for i in range(dy + 1):
s += "D"
for i in range(dx + 1):
s += "R"
for i in range(dy + 1):
s += "U"
s += "LU"
for i in range(dx ... | sx, sy, tx, ty = list(map(int, input().split()))
s = ""
dx = tx - sx
dy = ty - sy
s += "R" * dx + "U" * dy + "L" * dx + "D" * (dy + 1)
s += "R" * (dx + 1) + "U" * (dy + 1) + "LU" + "L" * (dx + 1) + "D" * (dy + 1) + "R"
print(s)
| false | 70.588235 | [
"-for i in range(dx):",
"- s += \"R\"",
"-for i in range(dy):",
"- s += \"U\"",
"-for i in range(dx):",
"- s += \"L\"",
"-for i in range(dy + 1):",
"- s += \"D\"",
"-for i in range(dx + 1):",
"- s += \"R\"",
"-for i in range(dy + 1):",
"- s += \"U\"",
"-s += \"LU\"",
"-fo... | false | 0.042429 | 0.043106 | 0.984292 | [
"s395031195",
"s279716943"
] |
u645250356 | p03486 | python | s167597618 | s740893843 | 287 | 120 | 65,004 | 72,204 | Accepted | Accepted | 58.19 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 15 | 15 | 465 | 457 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 0 | [
"-from heapq import heappop, heappush, heapify",
"+from heapq import heappop, heappush"
] | false | 0.043926 | 0.03598 | 1.220843 | [
"s167597618",
"s740893843"
] |
u606045429 | p03673 | python | s357799367 | s408335289 | 232 | 163 | 25,412 | 25,412 | Accepted | Accepted | 29.74 | from collections import deque
N = int(eval(input()))
A = [int(i) for i in input().split()]
Q = deque()
for i, a in enumerate(A):
if i % 2 == 0:
Q.append(a)
else:
Q.appendleft(a)
if N % 2 == 1:
Q.reverse()
print((*Q))
| from collections import deque
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((*A[::-2] + A[N % 2::2]))
| 16 | 6 | 256 | 122 | from collections import deque
N = int(eval(input()))
A = [int(i) for i in input().split()]
Q = deque()
for i, a in enumerate(A):
if i % 2 == 0:
Q.append(a)
else:
Q.appendleft(a)
if N % 2 == 1:
Q.reverse()
print((*Q))
| from collections import deque
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((*A[::-2] + A[N % 2 :: 2]))
| false | 62.5 | [
"-Q = deque()",
"-for i, a in enumerate(A):",
"- if i % 2 == 0:",
"- Q.append(a)",
"- else:",
"- Q.appendleft(a)",
"-if N % 2 == 1:",
"- Q.reverse()",
"-print((*Q))",
"+print((*A[::-2] + A[N % 2 :: 2]))"
] | false | 0.038515 | 0.033562 | 1.147589 | [
"s357799367",
"s408335289"
] |
u744034042 | p03807 | python | s621793650 | s744370782 | 59 | 50 | 14,112 | 14,108 | Accepted | Accepted | 15.25 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if a[i]%2 == 1:
cnt += 1
if cnt%2 == 1:
print('NO')
else:
print('YES') | n = int(eval(input()))
a = list(map(int, input().split()))
if sum([1 for b in a if b%2 == 1]) % 2 == 1:
print('NO')
else:
print('YES') | 10 | 6 | 179 | 141 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if a[i] % 2 == 1:
cnt += 1
if cnt % 2 == 1:
print("NO")
else:
print("YES")
| n = int(eval(input()))
a = list(map(int, input().split()))
if sum([1 for b in a if b % 2 == 1]) % 2 == 1:
print("NO")
else:
print("YES")
| false | 40 | [
"-cnt = 0",
"-for i in range(n):",
"- if a[i] % 2 == 1:",
"- cnt += 1",
"-if cnt % 2 == 1:",
"+if sum([1 for b in a if b % 2 == 1]) % 2 == 1:"
] | false | 0.046111 | 0.047823 | 0.96422 | [
"s621793650",
"s744370782"
] |
u490553751 | p02783 | python | s739985390 | s312777396 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | #template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
H,A = inputlist()
d = H //A
m = H % A
if m != 0:
d +=1
print(d) | #template
def inputlist(): return [int(k) for k in input().split()]
#template
H,A = inputlist()
if H % A == 0:
print((H//A))
else:
print(((H//A)+1)) | 9 | 8 | 175 | 159 | # template
from collections import Counter
def inputlist():
return [int(j) for j in input().split()]
H, A = inputlist()
d = H // A
m = H % A
if m != 0:
d += 1
print(d)
| # template
def inputlist():
return [int(k) for k in input().split()]
# template
H, A = inputlist()
if H % A == 0:
print((H // A))
else:
print(((H // A) + 1))
| false | 11.111111 | [
"-from collections import Counter",
"+def inputlist():",
"+ return [int(k) for k in input().split()]",
"-def inputlist():",
"- return [int(j) for j in input().split()]",
"-",
"-",
"+# template",
"-d = H // A",
"-m = H % A",
"-if m != 0:",
"- d += 1",
"-print(d)",
"+if H % A == 0:"... | false | 0.069968 | 0.068702 | 1.018436 | [
"s739985390",
"s312777396"
] |
u047796752 | p03426 | python | s614483865 | s189222143 | 1,109 | 434 | 78,684 | 81,108 | Accepted | Accepted | 60.87 | from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
xd = defaultdict(int)
yd = defaultdict(int)
for i in range(H):
for j in range(W):
xd[A[i][j]] = i
yd[A[i][j]] = j
acc = [[0] for _ in range(D)]
for i in range... | import sys
input = sys.stdin.readline
from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
xd = defaultdict(int)
yd = defaultdict(int)
for i in range(H):
for j in range(W):
xd[A[i][j]] = i
yd[A[i][j]] = j
acc = [... | 27 | 29 | 626 | 666 | from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
xd = defaultdict(int)
yd = defaultdict(int)
for i in range(H):
for j in range(W):
xd[A[i][j]] = i
yd[A[i][j]] = j
acc = [[0] for _ in range(D)]
for i in range(D + 1, H * W + 1... | import sys
input = sys.stdin.readline
from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
xd = defaultdict(int)
yd = defaultdict(int)
for i in range(H):
for j in range(W):
xd[A[i][j]] = i
yd[A[i][j]] = j
acc = [[0] for _ in ra... | false | 6.896552 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.036043 | 0.127045 | 0.283708 | [
"s614483865",
"s189222143"
] |
u197615397 | p00009 | python | s316758459 | s455040375 | 220 | 140 | 56,004 | 40,592 | Accepted | Accepted | 36.36 | import sys
import math
from bisect import bisect_right
n = 1000000
a = set(range(3, n, 2))
diff = a.difference_update
for i in range(3, int(math.sqrt(n)), 2):
if i in a:
diff(list(range(i*2, n+1, i)))
primes = [2] + list(a)
for l in map(int, sys.stdin.readlines()):
print((bisect_right(prime... | def get_prime_set(ub):
from itertools import chain
from math import sqrt
if ub < 4:
return ({}, {}, {2}, {2, 3})[ub]
ub, ub_sqrt = ub+1, int(sqrt(ub))+1
primes = {2, 3} | set(chain(range(5, ub, 6), range(7, ub, 6)))
du = primes.difference_update
for n in chain(range(5, ub... | 13 | 21 | 319 | 593 | import sys
import math
from bisect import bisect_right
n = 1000000
a = set(range(3, n, 2))
diff = a.difference_update
for i in range(3, int(math.sqrt(n)), 2):
if i in a:
diff(list(range(i * 2, n + 1, i)))
primes = [2] + list(a)
for l in map(int, sys.stdin.readlines()):
print((bisect_right(primes, l)))
| def get_prime_set(ub):
from itertools import chain
from math import sqrt
if ub < 4:
return ({}, {}, {2}, {2, 3})[ub]
ub, ub_sqrt = ub + 1, int(sqrt(ub)) + 1
primes = {2, 3} | set(chain(range(5, ub, 6), range(7, ub, 6)))
du = primes.difference_update
for n in chain(range(5, ub_sqrt, ... | false | 38.095238 | [
"+def get_prime_set(ub):",
"+ from itertools import chain",
"+ from math import sqrt",
"+",
"+ if ub < 4:",
"+ return ({}, {}, {2}, {2, 3})[ub]",
"+ ub, ub_sqrt = ub + 1, int(sqrt(ub)) + 1",
"+ primes = {2, 3} | set(chain(range(5, ub, 6), range(7, ub, 6)))",
"+ du = primes.d... | false | 0.482974 | 0.328172 | 1.471708 | [
"s316758459",
"s455040375"
] |
u352394527 | p00484 | python | s094487250 | s394345322 | 670 | 410 | 6,356 | 6,328 | Accepted | Accepted | 38.81 | from heapq import heappush as push
from heapq import heappop as pop
def solve():
n, k = list(map(int,input().split()))
group_num = 10
book_map = [[] for i in range(group_num)]
acc_map = [[0] for i in range(group_num)]
for i in range(n):
c,g = list(map(int,input().split()))
push(book_map... | def solve():
n, k = list(map(int,input().split()))
group_num = 10
book_map = [[] for i in range(group_num)]
acc_map = [[0] for i in range(group_num)]
for i in range(n):
c,g = list(map(int,input().split()))
book_map[g - 1].append(c)
for i in range(group_num):
bmi = book_map[i]
... | 35 | 30 | 870 | 754 | from heapq import heappush as push
from heapq import heappop as pop
def solve():
n, k = list(map(int, input().split()))
group_num = 10
book_map = [[] for i in range(group_num)]
acc_map = [[0] for i in range(group_num)]
for i in range(n):
c, g = list(map(int, input().split()))
push(... | def solve():
n, k = list(map(int, input().split()))
group_num = 10
book_map = [[] for i in range(group_num)]
acc_map = [[0] for i in range(group_num)]
for i in range(n):
c, g = list(map(int, input().split()))
book_map[g - 1].append(c)
for i in range(group_num):
bmi = book... | false | 14.285714 | [
"-from heapq import heappush as push",
"-from heapq import heappop as pop",
"-",
"-",
"- push(book_map[g - 1], -c)",
"+ book_map[g - 1].append(c)",
"+ bmi.sort(reverse=True)",
"- acc += pop(bmi) - j * 2",
"+ acc += bmi[j] + j * 2",
"- for z in ... | false | 0.053755 | 0.08894 | 0.604397 | [
"s094487250",
"s394345322"
] |
u382748202 | p03078 | python | s520000102 | s814585785 | 103 | 37 | 8,732 | 4,964 | Accepted | Accepted | 64.08 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ABC = []
for i, a in enumerate(A):
for j, b in enumerate(B):
if (i + 1) * ... | import heapq
used = {}
def is_used(a, b, c):
hash = (a, b, c)
ret = hash in used
used[hash] = 1
return ret
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B... | 24 | 52 | 552 | 1,165 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ABC = []
for i, a in enumerate(A):
for j, b in enumerate(B):
if (i + 1) * (j + 1) > K:
... | import heapq
used = {}
def is_used(a, b, c):
hash = (a, b, c)
ret = hash in used
used[hash] = 1
return ret
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=Tru... | false | 53.846154 | [
"+import heapq",
"+",
"+used = {}",
"+",
"+",
"+def is_used(a, b, c):",
"+ hash = (a, b, c)",
"+ ret = hash in used",
"+ used[hash] = 1",
"+ return ret",
"+",
"+",
"-ABC = []",
"-for i, a in enumerate(A):",
"- for j, b in enumerate(B):",
"- if (i + 1) * (j + 1) > ... | false | 0.045708 | 0.045864 | 0.996592 | [
"s520000102",
"s814585785"
] |
u477977638 | p03274 | python | s025186788 | s802409876 | 88 | 81 | 14,568 | 14,168 | Accepted | Accepted | 7.95 | n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=10**9
for i in range(n-k+1):
if x[i+k-1]<0:
ans=min(ans,-x[i])
elif x[i]>0:
ans=min(ans,x[i+k-1])
else:
ans=min(ans,2*x[i+k-1]-x[i],2*(-x[i])+x[i+k-1])
print(ans) | import sys
input = sys.stdin.buffer.readline
input = sys.stdin.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np
def main():
n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=10**18
for i in range(n):
try:
l=x[i]
r=... | 14 | 34 | 262 | 508 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(n - k + 1):
if x[i + k - 1] < 0:
ans = min(ans, -x[i])
elif x[i] > 0:
ans = min(ans, x[i + k - 1])
else:
ans = min(ans, 2 * x[i + k - 1] - x[i], 2 * (-x[i]) + x[i + k - 1])
print(ans... | import sys
input = sys.stdin.buffer.readline
input = sys.stdin.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**18
for i in range(n):
try:
... | false | 58.823529 | [
"-n, k = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-ans = 10**9",
"-for i in range(n - k + 1):",
"- if x[i + k - 1] < 0:",
"- ans = min(ans, -x[i])",
"- elif x[i] > 0:",
"- ans = min(ans, x[i + k - 1])",
"- else:",
"- ans = min(ans, 2 ... | false | 0.040494 | 0.046344 | 0.873762 | [
"s025186788",
"s802409876"
] |
u077291787 | p03593 | python | s716588549 | s964403463 | 28 | 22 | 3,700 | 3,316 | Accepted | Accepted | 21.43 | # code-festival-2017-qualaC - Palindromic Matrix
from collections import Counter
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), list(Counter("".join(A)).values())
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
C_mod4, C_div4 = list... | # code-festival-2017-qualaC - Palindromic Matrix
from collections import Counter
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), list(Counter("".join(A)).values())
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
C_mod4 = [i % 4 for i... | 16 | 16 | 508 | 484 | # code-festival-2017-qualaC - Palindromic Matrix
from collections import Counter
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), list(Counter("".join(A)).values())
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
C_mod4, C_div4 = list(zip(*[(i... | # code-festival-2017-qualaC - Palindromic Matrix
from collections import Counter
def main():
H, W, *A = open(0).read().split()
H, W, C = int(H), int(W), list(Counter("".join(A)).values())
single = H & W & 1
double = (H >> 1 if W & 1 else 0) + (W >> 1 if H & 1 else 0)
C_mod4 = [i % 4 for i in C]
... | false | 0 | [
"- C_mod4, C_div4 = list(zip(*[(i % 4, i // 4) for i in C]))",
"+ C_mod4 = [i % 4 for i in C]"
] | false | 0.038481 | 0.03426 | 1.123216 | [
"s716588549",
"s964403463"
] |
u729133443 | p02947 | python | s727937682 | s801321848 | 560 | 339 | 134,108 | 21,980 | Accepted | Accepted | 39.46 | d={}
c=0
for i in open(0):i=tuple(sorted(i));t=d.get(i,0);c+=t;d[i]=t+1
print(c) | d={}
c=0
for i in open(0):i=str(sorted(i));t=d.get(i,0);c+=t;d[i]=t+1
print(c) | 4 | 4 | 83 | 81 | d = {}
c = 0
for i in open(0):
i = tuple(sorted(i))
t = d.get(i, 0)
c += t
d[i] = t + 1
print(c)
| d = {}
c = 0
for i in open(0):
i = str(sorted(i))
t = d.get(i, 0)
c += t
d[i] = t + 1
print(c)
| false | 0 | [
"- i = tuple(sorted(i))",
"+ i = str(sorted(i))"
] | false | 0.073257 | 0.090623 | 0.808369 | [
"s727937682",
"s801321848"
] |
u119127920 | p02376 | python | s588282874 | s858368178 | 130 | 30 | 6,328 | 6,340 | Accepted | Accepted | 76.92 | from collections import deque
class Edge:
def __init__(self, to, rev, cap):
self.to = to
self.rev = rev
self.cap = cap
# 最大流問題を解く O(|E||V|^2)
class Dinic:
def __init__(self, num_of_node: int):
assert num_of_node > 0
self.graph = [list() for _ in range(... | from collections import deque
class Edge:
def __init__(self, to, flow, cap, rev, is_rev):
self.to = to
self.flow = flow
self.cap = cap
self.rev = rev
self.is_rev = is_rev
class Dinic:
def __init__(self, num_of_node: int):
assert num_of_node > 0
... | 85 | 86 | 2,352 | 2,460 | from collections import deque
class Edge:
def __init__(self, to, rev, cap):
self.to = to
self.rev = rev
self.cap = cap
# 最大流問題を解く O(|E||V|^2)
class Dinic:
def __init__(self, num_of_node: int):
assert num_of_node > 0
self.graph = [list() for _ in range(num_of_node)] #... | from collections import deque
class Edge:
def __init__(self, to, flow, cap, rev, is_rev):
self.to = to
self.flow = flow
self.cap = cap
self.rev = rev
self.is_rev = is_rev
class Dinic:
def __init__(self, num_of_node: int):
assert num_of_node > 0
self.gr... | false | 1.162791 | [
"- def __init__(self, to, rev, cap):",
"+ def __init__(self, to, flow, cap, rev, is_rev):",
"+ self.flow = flow",
"+ self.cap = cap",
"- self.cap = cap",
"+ self.is_rev = is_rev",
"-# 最大流問題を解く O(|E||V|^2)",
"- self.graph[f].append(Edge(t, len(self.graph[t]), ca... | false | 0.085439 | 0.042583 | 2.00638 | [
"s588282874",
"s858368178"
] |
u078214750 | p03086 | python | s349642597 | s748083347 | 33 | 24 | 9,872 | 9,116 | Accepted | Accepted | 27.27 | import re
pattern = re.compile('[ACGT]+')
S = eval(input())
print((len(max(re.findall(pattern, S), key=len, default='')))) | S = eval(input())
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all('ACGT'.count(c)==1 for c in S[i:j+1]):
ans = max(ans, j-i+1)
print(ans) | 4 | 8 | 117 | 169 | import re
pattern = re.compile("[ACGT]+")
S = eval(input())
print((len(max(re.findall(pattern, S), key=len, default=""))))
| S = eval(input())
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all("ACGT".count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)
| false | 50 | [
"-import re",
"-",
"-pattern = re.compile(\"[ACGT]+\")",
"-print((len(max(re.findall(pattern, S), key=len, default=\"\"))))",
"+N = len(S)",
"+ans = 0",
"+for i in range(N):",
"+ for j in range(i, N):",
"+ if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):",
"+ ans = max(an... | false | 0.086455 | 0.072362 | 1.194762 | [
"s349642597",
"s748083347"
] |
u185249212 | p02732 | python | s077352165 | s291565316 | 706 | 410 | 121,536 | 82,780 | Accepted | Accepted | 41.93 |
import array
import bisect
import collections
import copy
import fractions
import functools
import heapq
import itertools
import math
import operator
import random
import re
import string
import sys
import time
from collections import Counter, deque
from fractions import Fraction
from functools imp... |
import sys
sys.setrecursionlimit(500000)
input = sys.stdin.readline
from collections import Counter
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
return
#
n = int(input().strip())
a = list(map(int, input().strip().split()))
#
C=Counter()
for i in range(n):
C... | 86 | 28 | 1,679 | 502 | import array
import bisect
import collections
import copy
import fractions
import functools
import heapq
import itertools
import math
import operator
import random
import re
import string
import sys
import time
from collections import Counter, deque
from fractions import Fraction
from functools import reduce
from heapq... | import sys
sys.setrecursionlimit(500000)
input = sys.stdin.readline
from collections import Counter
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
return
#
n = int(input().strip())
a = list(map(int, input().strip().split()))
#
C = Counter()
for i in range(n):
C[a[i]] += 1
xsum = 0... | false | 67.44186 | [
"-import array",
"-import bisect",
"-import collections",
"-import copy",
"-import fractions",
"-import functools",
"-import heapq",
"-import itertools",
"-import math",
"-import operator",
"-import random",
"-import re",
"-import string",
"-import time",
"-from collections import Counte... | false | 0.101821 | 0.126202 | 0.806805 | [
"s077352165",
"s291565316"
] |
u279955105 | p02402 | python | s836534601 | s200453215 | 60 | 40 | 8,636 | 8,636 | Accepted | Accepted | 33.33 | t = eval(input())
lst = list(map(int, input().split()))
a = max(lst)
b = min(lst)
c = sum(lst)
print((str(b) + " " + str(a) + " " + str(c))) | t = int(eval(input()))
lst = list(map(int, input().split()))
a = min(lst)
b = max(lst)
c = sum(lst)
print((str(a) + " " + str(b) + " " + str(c))) | 6 | 6 | 137 | 142 | t = eval(input())
lst = list(map(int, input().split()))
a = max(lst)
b = min(lst)
c = sum(lst)
print((str(b) + " " + str(a) + " " + str(c)))
| t = int(eval(input()))
lst = list(map(int, input().split()))
a = min(lst)
b = max(lst)
c = sum(lst)
print((str(a) + " " + str(b) + " " + str(c)))
| false | 0 | [
"-t = eval(input())",
"+t = int(eval(input()))",
"-a = max(lst)",
"-b = min(lst)",
"+a = min(lst)",
"+b = max(lst)",
"-print((str(b) + \" \" + str(a) + \" \" + str(c)))",
"+print((str(a) + \" \" + str(b) + \" \" + str(c)))"
] | false | 0.040942 | 0.043026 | 0.951577 | [
"s836534601",
"s200453215"
] |
u623814058 | p02813 | python | s600609268 | s332974069 | 49 | 33 | 14,248 | 13,848 | Accepted | Accepted | 32.65 | import itertools as i
eval(input())
f=lambda:tuple(map(int,input().split()))
P=f()
Q=f()
x=sorted(list(i.permutations(P)))
print((abs(-~x.index(P)--~x.index(Q)))) | import itertools as i
f=lambda:tuple(map(int,input().split()))
x=list(i.permutations(list(range(1,int(eval(input()))+1))))
print((abs(-~x.index(f())--~x.index(f())))) | 7 | 4 | 160 | 155 | import itertools as i
eval(input())
f = lambda: tuple(map(int, input().split()))
P = f()
Q = f()
x = sorted(list(i.permutations(P)))
print((abs(-~x.index(P) - -~x.index(Q))))
| import itertools as i
f = lambda: tuple(map(int, input().split()))
x = list(i.permutations(list(range(1, int(eval(input())) + 1))))
print((abs(-~x.index(f()) - -~x.index(f()))))
| false | 42.857143 | [
"-eval(input())",
"-P = f()",
"-Q = f()",
"-x = sorted(list(i.permutations(P)))",
"-print((abs(-~x.index(P) - -~x.index(Q))))",
"+x = list(i.permutations(list(range(1, int(eval(input())) + 1))))",
"+print((abs(-~x.index(f()) - -~x.index(f()))))"
] | false | 0.055978 | 0.037316 | 1.500121 | [
"s600609268",
"s332974069"
] |
u790710233 | p02793 | python | s905800264 | s133549558 | 580 | 367 | 4,708 | 44,148 | Accepted | Accepted | 36.72 | from functools import reduce
MOD = 10**9+7
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a*(b//gcd(a, b))
x = reduce(lcm, A) % MOD
print((sum(x*pow(a, MOD-2, MOD) for a in A) % MOD)) | from collections import defaultdict
MOD = 10**9+7
n = int(eval(input()))
A = list(map(int, input().split()))
def sieve(n):
res = [i for i in range(n)]
for i in range(2, int(n**.5)+1):
if res[i] < i:
continue
for j in range(i**2, n, i):
if res[j] == j:
... | 18 | 42 | 308 | 805 | from functools import reduce
MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a * (b // gcd(a, b))
x = reduce(lcm, A) % MOD
print((sum(x * pow(a, MOD - 2, MOD) for a in A) % MOD))
| from collections import defaultdict
MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
def sieve(n):
res = [i for i in range(n)]
for i in range(2, int(n**0.5) + 1):
if res[i] < i:
continue
for j in range(i**2, n, i):
if res[j] == j:
... | false | 57.142857 | [
"-from functools import reduce",
"+from collections import defaultdict",
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- return gcd(b, a % b)",
"+def sieve(n):",
"+ res = [i for i in range(n)]",
"+ for i in range(2, int(n**0.5) + 1):",
"+ if res[i] < i:",
"+ ... | false | 0.037035 | 0.997951 | 0.037111 | [
"s905800264",
"s133549558"
] |
u334712262 | p02948 | python | s925100543 | s737532732 | 671 | 582 | 93,400 | 72,408 | Accepted | Accepted | 13.26 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | 77 | 119 | 1,536 | 2,297 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | false | 35.294118 | [
"-import bisect",
"-import heapq",
"-import math",
"-import random",
"-from collections import Counter, defaultdict, deque",
"-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"-from functools import lru_cache, reduce",
"-from itertools import combinations, combinations_with_replacement, pr... | false | 0.16108 | 0.123979 | 1.299245 | [
"s925100543",
"s737532732"
] |
u844789719 | p03575 | python | s284880206 | s924620971 | 456 | 56 | 3,548 | 3,572 | Accepted | Accepted | 87.72 | import copy
N, M = [int(_) for _ in input().split()]
AB = [[int(_) - 1 for _ in input().split()] for _ in range(M)]
G = [[0] * N for _ in range(N)]
for ab in AB:
G[ab[0]][ab[1]] = 1
G[ab[1]][ab[0]] = 1
def dfs(Gn, a, x):
a[x] = 1
for i in range(N):
if Gn[x][i] == 1 and a[i] == 0:... | import copy
N, M = [int(_) for _ in input().split()]
AB = [[int(_) - 1 for _ in input().split()] for _ in range(M)]
G = [set() for _ in range(N)]
a = set()
for ab in AB:
G[ab[0]].add(ab[1])
def find(a, x):
if a[x] != x:
a[x] = find(a, a[x])
return a[x]
def unite(a, x, y):
x... | 35 | 40 | 827 | 879 | import copy
N, M = [int(_) for _ in input().split()]
AB = [[int(_) - 1 for _ in input().split()] for _ in range(M)]
G = [[0] * N for _ in range(N)]
for ab in AB:
G[ab[0]][ab[1]] = 1
G[ab[1]][ab[0]] = 1
def dfs(Gn, a, x):
a[x] = 1
for i in range(N):
if Gn[x][i] == 1 and a[i] == 0:
... | import copy
N, M = [int(_) for _ in input().split()]
AB = [[int(_) - 1 for _ in input().split()] for _ in range(M)]
G = [set() for _ in range(N)]
a = set()
for ab in AB:
G[ab[0]].add(ab[1])
def find(a, x):
if a[x] != x:
a[x] = find(a, a[x])
return a[x]
def unite(a, x, y):
x = find(a, x)
... | false | 12.5 | [
"-G = [[0] * N for _ in range(N)]",
"+G = [set() for _ in range(N)]",
"+a = set()",
"- G[ab[0]][ab[1]] = 1",
"- G[ab[1]][ab[0]] = 1",
"+ G[ab[0]].add(ab[1])",
"-def dfs(Gn, a, x):",
"- a[x] = 1",
"- for i in range(N):",
"- if Gn[x][i] == 1 and a[i] == 0:",
"- a[i... | false | 0.104073 | 0.039219 | 2.653615 | [
"s284880206",
"s924620971"
] |
u171276253 | p03478 | python | s892540725 | s363526832 | 35 | 32 | 3,060 | 3,060 | Accepted | Accepted | 8.57 | x, min, max = input().rstrip().split()
ans = 0
i = int(x)
while i > 0:
num = sum(map(int, str(i)))
if int(min) <= num <=int(max):
ans += i
i = i - 1
print(ans) | x, min, max = input().rstrip().split()
ans = 0
for i in range(int(x) + 1):
if int(min) <= sum(map(int, str(i))) <=int(max):
ans += i
print(ans)
| 9 | 6 | 187 | 161 | x, min, max = input().rstrip().split()
ans = 0
i = int(x)
while i > 0:
num = sum(map(int, str(i)))
if int(min) <= num <= int(max):
ans += i
i = i - 1
print(ans)
| x, min, max = input().rstrip().split()
ans = 0
for i in range(int(x) + 1):
if int(min) <= sum(map(int, str(i))) <= int(max):
ans += i
print(ans)
| false | 33.333333 | [
"-i = int(x)",
"-while i > 0:",
"- num = sum(map(int, str(i)))",
"- if int(min) <= num <= int(max):",
"+for i in range(int(x) + 1):",
"+ if int(min) <= sum(map(int, str(i))) <= int(max):",
"- i = i - 1"
] | false | 0.109932 | 0.046759 | 2.351033 | [
"s892540725",
"s363526832"
] |
u925364229 | p03232 | python | s371839104 | s166299611 | 355 | 311 | 63,572 | 63,636 | Accepted | Accepted | 12.39 | N = int(eval(input()))
A = list(map(int,input().split(" ")))
mod = 10**9+7
fact = 1
for i in range(2,N+1):
fact *= i
fact %= mod
rev = [ pow((i),mod-2,mod) for i in range(1,N+1) ]
for i in range(N-1):
rev[i+1] += rev[i]
ans = 0
for i in range(N):
ans += A[i] * (fact * (rev[i] + rev[N-1... | N = int(eval(input()))
A = list(map(int,input().split(" ")))
mod = 10**9+7
fact = 1
for i in range(2,N+1):
fact *= i
fact %= mod
rev = [ (pow((i),mod-2,mod)*fact)%mod for i in range(1,N+1) ]
for i in range(N-1):
rev[i+1] += rev[i]
rev[i+1] %= mod
ans = 0
for i in range(N):
ans += ... | 20 | 21 | 367 | 390 | N = int(eval(input()))
A = list(map(int, input().split(" ")))
mod = 10**9 + 7
fact = 1
for i in range(2, N + 1):
fact *= i
fact %= mod
rev = [pow((i), mod - 2, mod) for i in range(1, N + 1)]
for i in range(N - 1):
rev[i + 1] += rev[i]
ans = 0
for i in range(N):
ans += A[i] * (fact * (rev[i] + rev[N - 1 ... | N = int(eval(input()))
A = list(map(int, input().split(" ")))
mod = 10**9 + 7
fact = 1
for i in range(2, N + 1):
fact *= i
fact %= mod
rev = [(pow((i), mod - 2, mod) * fact) % mod for i in range(1, N + 1)]
for i in range(N - 1):
rev[i + 1] += rev[i]
rev[i + 1] %= mod
ans = 0
for i in range(N):
ans +... | false | 4.761905 | [
"-rev = [pow((i), mod - 2, mod) for i in range(1, N + 1)]",
"+rev = [(pow((i), mod - 2, mod) * fact) % mod for i in range(1, N + 1)]",
"+ rev[i + 1] %= mod",
"- ans += A[i] * (fact * (rev[i] + rev[N - 1 - i] - rev[0])) % mod",
"+ ans += A[i] * (rev[i] + rev[N - 1 - i] - rev[0]) % mod"
] | false | 0.038368 | 0.048197 | 0.796058 | [
"s371839104",
"s166299611"
] |
u945181840 | p03666 | python | s718551226 | s702551077 | 330 | 18 | 2,940 | 3,064 | Accepted | Accepted | 94.55 | N, A, B, C, D = list(map(int, input().split()))
for i in range(N):
minimum = A + C * i - (N - 1 - i) * D
maximum = A + D * i - (N - 1 - i) * C
if minimum <= B <= maximum:
print('YES')
exit()
else:
print('NO')
| N, A, B, C, D = list(map(int, input().split()))
left = 0
right = N
if A > B:
A, B = B, A
def solve(n):
minimum = A + C * n - (N - 1 - n) * D
maximum = A + D * n - (N - 1 - n) * C
if minimum <= B <= maximum:
print('YES')
exit()
elif B < minimum:
return False
... | 10 | 28 | 245 | 502 | N, A, B, C, D = list(map(int, input().split()))
for i in range(N):
minimum = A + C * i - (N - 1 - i) * D
maximum = A + D * i - (N - 1 - i) * C
if minimum <= B <= maximum:
print("YES")
exit()
else:
print("NO")
| N, A, B, C, D = list(map(int, input().split()))
left = 0
right = N
if A > B:
A, B = B, A
def solve(n):
minimum = A + C * n - (N - 1 - n) * D
maximum = A + D * n - (N - 1 - n) * C
if minimum <= B <= maximum:
print("YES")
exit()
elif B < minimum:
return False
else:
... | false | 64.285714 | [
"-for i in range(N):",
"- minimum = A + C * i - (N - 1 - i) * D",
"- maximum = A + D * i - (N - 1 - i) * C",
"+left = 0",
"+right = N",
"+if A > B:",
"+ A, B = B, A",
"+",
"+",
"+def solve(n):",
"+ minimum = A + C * n - (N - 1 - n) * D",
"+ maximum = A + D * n - (N - 1 - n) * C"... | false | 0.141313 | 0.035221 | 4.012127 | [
"s718551226",
"s702551077"
] |
u312025627 | p02845 | python | s440630529 | s141347920 | 241 | 88 | 62,188 | 84,472 | Accepted | Accepted | 63.49 | MOD = 10**9 + 7
class modint():
def __init__(self, value):
self.value = value % MOD
def __int__(self):
return int(self.value)
def __float__(self):
return float(self.value)
def __str__(self):
return str(self.value)
def __repr__(self):
ret... | MOD = 10**9 + 7
def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0]*N
ans = 3
for a in A:
if a == 0:
if B[a] == 1:
ans *= 2
else:
ans *= B[a-1] - B[a]
B[a] += 1
if 3 < B[a] or (a != ... | 101 | 24 | 3,151 | 456 | MOD = 10**9 + 7
class modint:
def __init__(self, value):
self.value = value % MOD
def __int__(self):
return int(self.value)
def __float__(self):
return float(self.value)
def __str__(self):
return str(self.value)
def __repr__(self):
return str(self.value)... | MOD = 10**9 + 7
def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0] * N
ans = 3
for a in A:
if a == 0:
if B[a] == 1:
ans *= 2
else:
ans *= B[a - 1] - B[a]
B[a] += 1
if 3 < B[a] or (a != 0 and B[a -... | false | 76.237624 | [
"-class modint:",
"- def __init__(self, value):",
"- self.value = value % MOD",
"-",
"- def __int__(self):",
"- return int(self.value)",
"-",
"- def __float__(self):",
"- return float(self.value)",
"-",
"- def __str__(self):",
"- return str(self.value)",... | false | 0.036313 | 0.056044 | 0.647943 | [
"s440630529",
"s141347920"
] |
u072717685 | p02732 | python | s315758653 | s835145246 | 1,027 | 302 | 25,592 | 36,500 | Accepted | Accepted | 70.59 | import sys
input = sys.stdin.readline
from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, list(range(n,... | import sys
read = sys.stdin.read
from collections import Counter
def main():
n = int(eval(input()))
a = tuple(map(int, input().split()))
ac = Counter(a)
com_base = {}
for i in ac:
com_base[i] = ac[i] * (ac[i] - 1) / 2
sum_combase = sum(com_base.values())
for ae in a:
... | 38 | 17 | 853 | 449 | import sys
input = sys.stdin.readline
from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n,... | import sys
read = sys.stdin.read
from collections import Counter
def main():
n = int(eval(input()))
a = tuple(map(int, input().split()))
ac = Counter(a)
com_base = {}
for i in ac:
com_base[i] = ac[i] * (ac[i] - 1) / 2
sum_combase = sum(com_base.values())
for ae in a:
r = s... | false | 55.263158 | [
"-input = sys.stdin.readline",
"-from math import factorial",
"-from itertools import combinations",
"+read = sys.stdin.read",
"-from copy import deepcopy",
"-from operator import mul",
"-from functools import reduce",
"-",
"-",
"-def cmb(n, r):",
"- r = min(n - r, r)",
"- if r == 0:",
... | false | 0.036135 | 0.036276 | 0.9961 | [
"s315758653",
"s835145246"
] |
u970267139 | p02684 | python | s953084064 | s644358635 | 213 | 156 | 32,384 | 32,160 | Accepted | Accepted | 26.76 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
t = [1]
for i in range(n):
t.append(a[t[-1] - 1])
t_sort = sorted(t)
for i in range(n):
if t_sort[i] == t_sort[i + 1]:
b = t_sort[i]
break
count = 0
for i in range(n):
if t[i] == b:
if coun... | n, k = list(map(int, input().split()))
a_list = list(map(int, input().split()))
visit = [1]
for i in range(n):
visit.append(a_list[visit[-1] - 1])
for i in range(n - 1):
if visit[-1] == visit[n - i - 1]:
break
s = i + 1
for i in range(n - s):
if visit[i] == visit[i + s]:
br... | 32 | 20 | 593 | 393 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
t = [1]
for i in range(n):
t.append(a[t[-1] - 1])
t_sort = sorted(t)
for i in range(n):
if t_sort[i] == t_sort[i + 1]:
b = t_sort[i]
break
count = 0
for i in range(n):
if t[i] == b:
if count == 0:
... | n, k = list(map(int, input().split()))
a_list = list(map(int, input().split()))
visit = [1]
for i in range(n):
visit.append(a_list[visit[-1] - 1])
for i in range(n - 1):
if visit[-1] == visit[n - i - 1]:
break
s = i + 1
for i in range(n - s):
if visit[i] == visit[i + s]:
break
if k < i:
... | false | 37.5 | [
"-a = list(map(int, input().split()))",
"-t = [1]",
"+a_list = list(map(int, input().split()))",
"+visit = [1]",
"- t.append(a[t[-1] - 1])",
"-t_sort = sorted(t)",
"-for i in range(n):",
"- if t_sort[i] == t_sort[i + 1]:",
"- b = t_sort[i]",
"+ visit.append(a_list[visit[-1] - 1])",... | false | 0.041388 | 0.046468 | 0.890681 | [
"s953084064",
"s644358635"
] |
u498487134 | p02773 | python | s949245702 | s110802332 | 1,238 | 451 | 95,320 | 148,256 | Accepted | Accepted | 63.57 | from collections import defaultdict
dd = defaultdict(int)
ma=0
N=int(eval(input()))
for i in range(N):
S=eval(input())
dd[S]+=1
if dd[S]>ma:
ma=dd[S]
ans=[]
for k,v in list(dd.items()):
if v==ma:
ans.append(k)
ans.sort()
for i in range(len(... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
from collections import defaultdict
dd = defaultdict(int)
N=I()
M=0
for i in range(N):
s=eval(input())
... | 25 | 30 | 334 | 534 | from collections import defaultdict
dd = defaultdict(int)
ma = 0
N = int(eval(input()))
for i in range(N):
S = eval(input())
dd[S] += 1
if dd[S] > ma:
ma = dd[S]
ans = []
for k, v in list(dd.items()):
if v == ma:
ans.append(k)
ans.sort()
for i in range(len(ans)):
print((ans[i]))
| def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
from collections import defaultdict
dd = defaultdict(int)
N = I()
M = 0
for i in range(N):
s = eval(input())... | false | 16.666667 | [
"-from collections import defaultdict",
"+def I():",
"+ return int(eval(input()))",
"-dd = defaultdict(int)",
"-ma = 0",
"-N = int(eval(input()))",
"-for i in range(N):",
"- S = eval(input())",
"- dd[S] += 1",
"- if dd[S] > ma:",
"- ma = dd[S]",
"-ans = []",
"-for k, v in ... | false | 0.041003 | 0.093583 | 0.438145 | [
"s949245702",
"s110802332"
] |
u352048883 | p03163 | python | s851778297 | s792032348 | 1,482 | 401 | 7,668 | 119,788 | Accepted | Accepted | 72.94 | def dp():
N, W = list(map(int, input().split()))
WV = (list(map(int, input().split())) for _ in range(N))
DP = [0] * (W+1)
for w, v in WV:
for j in range(W, w-1, -1):
dp = DP[j-w] + v
if DP[j] < dp:
DP[j] = dp
return max(DP)
print((dp()))
| N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(N)]
dp = [[0] * (W+1) for i in range(N)]
for i in range(N):
w, v = wv[i]
for j in range(W, 0, -1):
if j - w < 0:
dp[i][j] = dp[i-1][j]
else:
dp[i][j] = max(dp[i-1][j-w]+v, dp[i-1][j])
pr... | 12 | 15 | 272 | 336 | def dp():
N, W = list(map(int, input().split()))
WV = (list(map(int, input().split())) for _ in range(N))
DP = [0] * (W + 1)
for w, v in WV:
for j in range(W, w - 1, -1):
dp = DP[j - w] + v
if DP[j] < dp:
DP[j] = dp
return max(DP)
print((dp()))
| N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(N)]
dp = [[0] * (W + 1) for i in range(N)]
for i in range(N):
w, v = wv[i]
for j in range(W, 0, -1):
if j - w < 0:
dp[i][j] = dp[i - 1][j]
else:
dp[i][j] = max(dp[i - 1][j - w] + v... | false | 20 | [
"-def dp():",
"- N, W = list(map(int, input().split()))",
"- WV = (list(map(int, input().split())) for _ in range(N))",
"- DP = [0] * (W + 1)",
"- for w, v in WV:",
"- for j in range(W, w - 1, -1):",
"- dp = DP[j - w] + v",
"- if DP[j] < dp:",
"- ... | false | 0.042696 | 0.042322 | 1.008842 | [
"s851778297",
"s792032348"
] |
u488401358 | p02635 | python | s312681747 | s007544899 | 2,533 | 1,897 | 109,040 | 108,476 | Accepted | Accepted | 25.11 | S,K=input().split()
K=int(K)
K=min(K,300)
mod=998244353
a=[]
val=0
for i in range(len(S)):
if S[i]=="0":
a.append(val)
val=0
else:
val+=1
if val!=0:
a.append(val)
m=len(a)
K=min(sum(a),K)
dp=[[[0 for i in range(K+1)] for j in range(K+1)] for k in range(m+1)]
fo... | S,K=input().split()
K=int(K)
K=min(K,300)
mod=998244353
a=[]
val=0
for i in range(len(S)):
if S[i]=="0":
a.append(val)
val=0
else:
val+=1
if val!=0:
a.append(val)
m=len(a)
K=min(sum(a),K)
dp=[[[0 for i in range(K+1)] for j in range(K+1)] for k in range(m+1)]
fo... | 38 | 38 | 817 | 828 | S, K = input().split()
K = int(K)
K = min(K, 300)
mod = 998244353
a = []
val = 0
for i in range(len(S)):
if S[i] == "0":
a.append(val)
val = 0
else:
val += 1
if val != 0:
a.append(val)
m = len(a)
K = min(sum(a), K)
dp = [[[0 for i in range(K + 1)] for j in range(K + 1)] for k in rang... | S, K = input().split()
K = int(K)
K = min(K, 300)
mod = 998244353
a = []
val = 0
for i in range(len(S)):
if S[i] == "0":
a.append(val)
val = 0
else:
val += 1
if val != 0:
a.append(val)
m = len(a)
K = min(sum(a), K)
dp = [[[0 for i in range(K + 1)] for j in range(K + 1)] for k in rang... | false | 0 | [
"- for j in range(K + 1):",
"- for k in range(min(b[i], K) + 1):",
"+ for k in range(min(b[i], K) + 1):",
"+ for j in range(min(K, k + c[i]) + 1):"
] | false | 0.062204 | 0.059268 | 1.049536 | [
"s312681747",
"s007544899"
] |
u968166680 | p03281 | python | s295202580 | s486477384 | 174 | 31 | 38,384 | 9,360 | Accepted | Accepted | 82.18 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def divisors(n):
lower = []
upper = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
lower.append(i)
if i != n ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
lower.append(i)
... | 38 | 37 | 658 | 659 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def divisors(n):
lower = []
upper = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
lower.append(i)
if i != n // i:
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
lower.append(i)
if i != n //... | false | 2.631579 | [
"+MOD = 1000000007",
"- d = divisors(n)",
"- if len(d) == 8:",
"+ if len(divisors(n)) == 8:"
] | false | 0.061637 | 0.03538 | 1.742139 | [
"s295202580",
"s486477384"
] |
u001024152 | p03111 | python | s501741700 | s409545616 | 488 | 309 | 3,064 | 3,064 | Accepted | Accepted | 36.68 | N,A,B,C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float('inf')
for i in range(1<<N):
for j in range(1<<N):
a,b,c = [],[],[]
cost = 0
for keta in range(N):
bit_i = i&(1<<keta)
bit_j = j&(1<<keta)
if bit_i... | from itertools import product
N,A,B,C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float('inf')
for p in product(list(range(4)), repeat=N): # 4^Nループ
take = [[] for _ in range(4)] # [A,B,C,使わない]
for i in range(N):
take[p[i]].append(L[i])
a,b,c = take[0],t... | 30 | 15 | 853 | 501 | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float("inf")
for i in range(1 << N):
for j in range(1 << N):
a, b, c = [], [], []
cost = 0
for keta in range(N):
bit_i = i & (1 << keta)
bit_j = j & (1 << keta)
i... | from itertools import product
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float("inf")
for p in product(list(range(4)), repeat=N): # 4^Nループ
take = [[] for _ in range(4)] # [A,B,C,使わない]
for i in range(N):
take[p[i]].append(L[i])
a, b, c = take[0], ... | false | 50 | [
"+from itertools import product",
"+",
"-for i in range(1 << N):",
"- for j in range(1 << N):",
"- a, b, c = [], [], []",
"- cost = 0",
"- for keta in range(N):",
"- bit_i = i & (1 << keta)",
"- bit_j = j & (1 << keta)",
"- if bit_i == 0 and... | false | 0.525431 | 0.654542 | 0.802746 | [
"s501741700",
"s409545616"
] |
u945181840 | p02973 | python | s815497545 | s273372187 | 99 | 85 | 14,056 | 14,092 | Accepted | Accepted | 14.14 | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N = int(readline())
A = list(map(int, read().split()))
a = [-1] * N
for i in A:
n = bisect_left(a, i)
a[n - 1] = i
print((N - a.count(-1))) | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
def main():
N, *A = list(map(int, read().split()))
a = [-1] * N
for i in A:
n = bisect_left(a, i)
a[n - 1] = i
print((N - a.count(-1)))
if __name__ == '__main__':
m... | 16 | 20 | 284 | 317 | import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N = int(readline())
A = list(map(int, read().split()))
a = [-1] * N
for i in A:
n = bisect_left(a, i)
a[n - 1] = i
print((N - a.count(-1)))
| import sys
from bisect import bisect_left
read = sys.stdin.read
readline = sys.stdin.readline
def main():
N, *A = list(map(int, read().split()))
a = [-1] * N
for i in A:
n = bisect_left(a, i)
a[n - 1] = i
print((N - a.count(-1)))
if __name__ == "__main__":
main()
| false | 20 | [
"-readlines = sys.stdin.readlines",
"-N = int(readline())",
"-A = list(map(int, read().split()))",
"-a = [-1] * N",
"-for i in A:",
"- n = bisect_left(a, i)",
"- a[n - 1] = i",
"-print((N - a.count(-1)))",
"+",
"+",
"+def main():",
"+ N, *A = list(map(int, read().split()))",
"+ a... | false | 0.038003 | 0.042421 | 0.895873 | [
"s815497545",
"s273372187"
] |
u441320782 | p02700 | python | s466550783 | s429104503 | 23 | 20 | 9,172 | 9,176 | Accepted | Accepted | 13.04 | A,B,C,D=list(map(int,input().split()))
while True:
C-=B
if C<=0:
break
A-=D
if A<=0:
break
if A>=C:
print("Yes")
else:
print("No") | A,B,C,D=list(map(int,input().split()))
k1=0
k2=0
if C%B==0:
k1=C//B
else:
k1=C//B+1
if A%D==0:
k2=A//D
else:
k2=A//D+1
if k1<=k2:
print("Yes")
else:
print("No")
| 14 | 17 | 159 | 190 | A, B, C, D = list(map(int, input().split()))
while True:
C -= B
if C <= 0:
break
A -= D
if A <= 0:
break
if A >= C:
print("Yes")
else:
print("No")
| A, B, C, D = list(map(int, input().split()))
k1 = 0
k2 = 0
if C % B == 0:
k1 = C // B
else:
k1 = C // B + 1
if A % D == 0:
k2 = A // D
else:
k2 = A // D + 1
if k1 <= k2:
print("Yes")
else:
print("No")
| false | 17.647059 | [
"-while True:",
"- C -= B",
"- if C <= 0:",
"- break",
"- A -= D",
"- if A <= 0:",
"- break",
"-if A >= C:",
"+k1 = 0",
"+k2 = 0",
"+if C % B == 0:",
"+ k1 = C // B",
"+else:",
"+ k1 = C // B + 1",
"+if A % D == 0:",
"+ k2 = A // D",
"+else:",
"+ ... | false | 0.040517 | 0.035363 | 1.14574 | [
"s466550783",
"s429104503"
] |
u015593272 | p02819 | python | s287537563 | s622573971 | 150 | 18 | 14,420 | 3,060 | Accepted | Accepted | 88 | import numpy as np
def judge_prime(num):
FLAG = True
for i in range(2, int(num**.5)+1):
if (num%i == 0):
FLAG = False
if (num == 2):
FLAG = True
return(FLAG)
X = int(eval(input()))
while (True):
flag = judge_prime(X)
if (fla... | def judge_prime(num):
FLAG = True
for i in range(2, int(num**0.5)+1):
if (num%i == 0):
FLAG = False
if (num == 2):
FLAG = True
return(FLAG)
X = int(eval(input()))
while (True):
flag = judge_prime(X)
if (flag):
break
... | 26 | 24 | 363 | 342 | import numpy as np
def judge_prime(num):
FLAG = True
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
FLAG = False
if num == 2:
FLAG = True
return FLAG
X = int(eval(input()))
while True:
flag = judge_prime(X)
if flag:
break
X += 1
print(X)
| def judge_prime(num):
FLAG = True
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
FLAG = False
if num == 2:
FLAG = True
return FLAG
X = int(eval(input()))
while True:
flag = judge_prime(X)
if flag:
break
X += 1
print(X)
| false | 7.692308 | [
"-import numpy as np",
"-",
"-"
] | false | 0.063195 | 0.099229 | 0.636859 | [
"s287537563",
"s622573971"
] |
u287132915 | p04044 | python | s021841285 | s951194056 | 176 | 64 | 38,256 | 62,920 | Accepted | Accepted | 63.64 | n, l = list(map(int, input().split()))
lst = []
for i in range(n):
si = eval(input())
lst.append(si)
lst.sort()
ans = ''
for i in range(n):
ans += lst[i]
print(ans) | n, l = list(map(int, input().split()))
lst = []
for i in range(n):
s = eval(input())
lst.append(s)
lst.sort()
ans = ''
for i in range(n):
ans += lst[i]
print(ans) | 11 | 12 | 175 | 175 | n, l = list(map(int, input().split()))
lst = []
for i in range(n):
si = eval(input())
lst.append(si)
lst.sort()
ans = ""
for i in range(n):
ans += lst[i]
print(ans)
| n, l = list(map(int, input().split()))
lst = []
for i in range(n):
s = eval(input())
lst.append(s)
lst.sort()
ans = ""
for i in range(n):
ans += lst[i]
print(ans)
| false | 8.333333 | [
"- si = eval(input())",
"- lst.append(si)",
"+ s = eval(input())",
"+ lst.append(s)"
] | false | 0.043911 | 0.041346 | 1.062051 | [
"s021841285",
"s951194056"
] |
u345966487 | p03161 | python | s230630210 | s686137545 | 1,497 | 398 | 22,924 | 52,592 | Accepted | Accepted | 73.41 | import numpy as np
N, K = list(map(int, input().split()))
H = np.array(list(map(int, input().split())), dtype=np.int64)
dp = np.ones(N, dtype=np.int64) * (2 ** 62)
dp[0] = 0
for i in range(1, N):
cost = np.abs(H[i - 1] - H[i : i + K])
np.minimum(dp[i : i + K], dp[i - 1] + cost, out=dp[i : i + K])
prin... | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [1 << 62] * N
dp[0] = 0
for i in range(1, N):
for j in range(K):
if i + j < N:
cost = abs(H[i - 1] - H[i + j])
dp[i + j] = min(dp[i + j], dp[i - 1] + cost)
print((dp[-1]))
| 10 | 10 | 324 | 289 | import numpy as np
N, K = list(map(int, input().split()))
H = np.array(list(map(int, input().split())), dtype=np.int64)
dp = np.ones(N, dtype=np.int64) * (2**62)
dp[0] = 0
for i in range(1, N):
cost = np.abs(H[i - 1] - H[i : i + K])
np.minimum(dp[i : i + K], dp[i - 1] + cost, out=dp[i : i + K])
print((dp[-1]))... | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
dp = [1 << 62] * N
dp[0] = 0
for i in range(1, N):
for j in range(K):
if i + j < N:
cost = abs(H[i - 1] - H[i + j])
dp[i + j] = min(dp[i + j], dp[i - 1] + cost)
print((dp[-1]))
| false | 0 | [
"-import numpy as np",
"-",
"-H = np.array(list(map(int, input().split())), dtype=np.int64)",
"-dp = np.ones(N, dtype=np.int64) * (2**62)",
"+H = list(map(int, input().split()))",
"+dp = [1 << 62] * N",
"- cost = np.abs(H[i - 1] - H[i : i + K])",
"- np.minimum(dp[i : i + K], dp[i - 1] + cost, ou... | false | 0.196533 | 0.036141 | 5.437986 | [
"s230630210",
"s686137545"
] |
u686036872 | p03574 | python | s534776700 | s136741255 | 24 | 22 | 3,444 | 3,444 | Accepted | Accepted | 8.33 | h, w = map(int, input().split())
S=[]
S.append(["."] * (w + 2))
for i in range(h):
S.append(["."] + list(input()) + ["."])
S.append(["."] * (w + 2))
for i in range(1, h+1):
for j in range(1, w+1):
counter = 0
if S[i][j] == ".":
if S[i-1][j-1] == "#":
counter += 1
if S[i... | H, W = map(int, input().split())
lis=[["."]*(W+2)]
for i in range(H):
lis+=[["."]+list(input())+["."]]
lis += [["."]*(W+2)]
for h in range(1, H+1):
for w in range(1, W+1):
x=0
if lis[h][w] == ".":
if lis[h+1][w-1] == "#":
x += 1
if lis[h+1][w] =... | 34 | 29 | 780 | 802 | h, w = map(int, input().split())
S = []
S.append(["."] * (w + 2))
for i in range(h):
S.append(["."] + list(input()) + ["."])
S.append(["."] * (w + 2))
for i in range(1, h + 1):
for j in range(1, w + 1):
counter = 0
if S[i][j] == ".":
if S[i - 1][j - 1] == "#":
counter... | H, W = map(int, input().split())
lis = [["."] * (W + 2)]
for i in range(H):
lis += [["."] + list(input()) + ["."]]
lis += [["."] * (W + 2)]
for h in range(1, H + 1):
for w in range(1, W + 1):
x = 0
if lis[h][w] == ".":
if lis[h + 1][w - 1] == "#":
x += 1
i... | false | 14.705882 | [
"-h, w = map(int, input().split())",
"-S = []",
"-S.append([\".\"] * (w + 2))",
"-for i in range(h):",
"- S.append([\".\"] + list(input()) + [\".\"])",
"-S.append([\".\"] * (w + 2))",
"-for i in range(1, h + 1):",
"- for j in range(1, w + 1):",
"- counter = 0",
"- if S[i][j] ==... | false | 0.035209 | 0.036671 | 0.960132 | [
"s534776700",
"s136741255"
] |
u623819879 | p02949 | python | s961728190 | s545032393 | 1,491 | 586 | 51,308 | 48,360 | Accepted | Accepted | 60.7 | from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int,input().split()))
def I():
... | from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
return int(input())
def MI():
return map(int,input().s... | 73 | 120 | 1,651 | 2,789 | from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int, input().split()))
def I():
re... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
# import random
def I():
return int(input())
def MI():
return map(int, input().spli... | false | 39.166667 | [
"-from heapq import heappush, heappop",
"+from heapq import heappush, heappop, heapify",
"-from itertools import permutations",
"+from itertools import permutations, combinations",
"+import math",
"+import time",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def SI():",
"- return input().split... | false | 0.036561 | 0.042077 | 0.868901 | [
"s961728190",
"s545032393"
] |
u802772880 | p02923 | python | s300778483 | s896571199 | 95 | 68 | 14,252 | 14,224 | Accepted | Accepted | 28.42 | n=int(eval(input()))
inf=10*100
h=list(map(int,input().split()))+[inf]
n=len(h)
length=[0]*(n-1)+[1]
cnt=[]
move=0
for i in range(n-1):
if h[i]<h[i+1]:
length[i+1]=1
if i==0:
length[i]=1
for i in range(1,n):
if length[i]==0:
move+=1
else:
cnt.appen... | n=int(eval(input()))
h=list(map(int,input().split()))
cnt=[]
move=0
for i in range(n-1):
if h[i]>=h[i+1]:
move+=1
else:
cnt.append(move)
move=0
cnt.append(move)
print((max(cnt))) | 22 | 12 | 398 | 213 | n = int(eval(input()))
inf = 10 * 100
h = list(map(int, input().split())) + [inf]
n = len(h)
length = [0] * (n - 1) + [1]
cnt = []
move = 0
for i in range(n - 1):
if h[i] < h[i + 1]:
length[i + 1] = 1
if i == 0:
length[i] = 1
for i in range(1, n):
if length[i] == 0:
move += 1... | n = int(eval(input()))
h = list(map(int, input().split()))
cnt = []
move = 0
for i in range(n - 1):
if h[i] >= h[i + 1]:
move += 1
else:
cnt.append(move)
move = 0
cnt.append(move)
print((max(cnt)))
| false | 45.454545 | [
"-inf = 10 * 100",
"-h = list(map(int, input().split())) + [inf]",
"-n = len(h)",
"-length = [0] * (n - 1) + [1]",
"+h = list(map(int, input().split()))",
"- if h[i] < h[i + 1]:",
"- length[i + 1] = 1",
"- if i == 0:",
"- length[i] = 1",
"-for i in range(1, n):",
"- ... | false | 0.042657 | 0.042946 | 0.993276 | [
"s300778483",
"s896571199"
] |
u131984977 | p02412 | python | s797713783 | s582264215 | 610 | 210 | 6,724 | 6,724 | Accepted | Accepted | 65.57 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for a in range(1, n + 1 - 2):
for b in range(a + 1, n + 1 - 1):
for c in range(b + 1, n + 1):
if (a + b + c) == x:
count += 1
print(count... | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for a in range(n if n < x else x, 2, -1):
for b in range(a-1, 1, -1):
if a + b > x:
continue
for c in range(b-1, 0, -1):
s = a + b + c
... | 12 | 17 | 321 | 480 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for a in range(1, n + 1 - 2):
for b in range(a + 1, n + 1 - 1):
for c in range(b + 1, n + 1):
if (a + b + c) == x:
count += 1
print(count)
| while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for a in range(n if n < x else x, 2, -1):
for b in range(a - 1, 1, -1):
if a + b > x:
continue
for c in range(b - 1, 0, -1):
s = a + b + c
... | false | 29.411765 | [
"- for a in range(1, n + 1 - 2):",
"- for b in range(a + 1, n + 1 - 1):",
"- for c in range(b + 1, n + 1):",
"- if (a + b + c) == x:",
"+ for a in range(n if n < x else x, 2, -1):",
"+ for b in range(a - 1, 1, -1):",
"+ if a + b > x:",
"+ ... | false | 0.064544 | 0.064063 | 1.007497 | [
"s797713783",
"s582264215"
] |
u191874006 | p03212 | python | s800220209 | s968084656 | 277 | 102 | 45,788 | 76,856 | Accepted | Accepted | 63.18 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 44 | 37 | 1,011 | 986 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 15.909091 | [
"-s = str(n)",
"-m = len(str(n))",
"-lst = [3, 5, 7]",
"-que = deque([3, 5, 7])",
"-for _ in range(3**m):",
"- x = que.popleft()",
"- for j in [3, 5, 7]:",
"- que.append(int(str(x) + str(j)))",
"- lst.append(int(str(x) + str(j)))",
"+num = [\"7\", \"5\", \"3\"]",
"+stack = [(... | false | 0.356684 | 0.122791 | 2.904817 | [
"s800220209",
"s968084656"
] |
u532966492 | p02803 | python | s413949888 | s580487018 | 193 | 171 | 3,188 | 3,188 | Accepted | Accepted | 11.4 | def main():
h, w = list(map(int, input().split()))
grid = [eval(input()) for _ in [0]*h]
ans_list = []
for i in range(h):
for j in range(w):
if grid[i][j] == ".":
ans_list.append((i, j))
m = 0
for i, j in ans_list:
q = [(i, j)]
dist ... | def main():
h, w = list(map(int, input().split()))
grid = ["#"*(w+2)]+["#"+eval(input())+"#" for _ in [0]*h]+["#"*(w+2)]
#grid = [[i == "." for i in j] for j in grid]
ans_list = []
for i in range(1, h+1):
for j in range(1, w+1):
if grid[i][j] == ".":
ans_l... | 45 | 42 | 1,470 | 1,394 | def main():
h, w = list(map(int, input().split()))
grid = [eval(input()) for _ in [0] * h]
ans_list = []
for i in range(h):
for j in range(w):
if grid[i][j] == ".":
ans_list.append((i, j))
m = 0
for i, j in ans_list:
q = [(i, j)]
dist = [[-1] *... | def main():
h, w = list(map(int, input().split()))
grid = (
["#" * (w + 2)] + ["#" + eval(input()) + "#" for _ in [0] * h] + ["#" * (w + 2)]
)
# grid = [[i == "." for i in j] for j in grid]
ans_list = []
for i in range(1, h + 1):
for j in range(1, w + 1):
if grid[i][j... | false | 6.666667 | [
"- grid = [eval(input()) for _ in [0] * h]",
"+ grid = (",
"+ [\"#\" * (w + 2)] + [\"#\" + eval(input()) + \"#\" for _ in [0] * h] + [\"#\" * (w + 2)]",
"+ )",
"+ # grid = [[i == \".\" for i in j] for j in grid]",
"- for i in range(h):",
"- for j in range(w):",
"+ for i... | false | 0.057999 | 0.03718 | 1.559949 | [
"s413949888",
"s580487018"
] |
u167931717 | p03061 | python | s338760399 | s143293266 | 297 | 258 | 65,764 | 65,516 | Accepted | Accepted | 13.13 | n = int(eval(input()))
alist = [int(i) for i in input().split()]
alist.sort()
def calc_gcm(x, y):
while y != 0:
z = x % y
x = y
y = z
return x
def get_custum(xlist):
prev = None
gcm_list = []
for a in xlist:
if prev is None:
gcm_list.ap... | n = int(eval(input()))
alist = [int(i) for i in input().split()]
def calc_gcm(x, y):
while y != 0:
z = x % y
x = y
y = z
return x
def listup_gcm(xlist):
list_gcm = []
prev = None
for a in xlist:
if prev is None:
list_gcm.append(a)
... | 53 | 41 | 1,107 | 821 | n = int(eval(input()))
alist = [int(i) for i in input().split()]
alist.sort()
def calc_gcm(x, y):
while y != 0:
z = x % y
x = y
y = z
return x
def get_custum(xlist):
prev = None
gcm_list = []
for a in xlist:
if prev is None:
gcm_list.append(a)
... | n = int(eval(input()))
alist = [int(i) for i in input().split()]
def calc_gcm(x, y):
while y != 0:
z = x % y
x = y
y = z
return x
def listup_gcm(xlist):
list_gcm = []
prev = None
for a in xlist:
if prev is None:
list_gcm.append(a)
prev = a
... | false | 22.641509 | [
"-alist.sort()",
"-def get_custum(xlist):",
"+def listup_gcm(xlist):",
"+ list_gcm = []",
"- gcm_list = []",
"- gcm_list.append(a)",
"+ list_gcm.append(a)",
"- ret = calc_gcm(a, prev)",
"- gcm_list.append(ret)",
"- prev = ret",
"- for boundary,... | false | 0.036321 | 0.033672 | 1.078667 | [
"s338760399",
"s143293266"
] |
u968166680 | p02838 | python | s724466409 | s284853051 | 479 | 313 | 136,516 | 118,580 | Accepted | Accepted | 34.66 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
ans = 0
for i in range(60):
s = 0
for a in A:
if a ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
ans = 0
p = 1
for _ in range(60):
n = 0
for i in range(N):
... | 34 | 30 | 661 | 532 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
ans = 0
for i in range(60):
s = 0
for a in A:
if a & (1 << i):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
ans = 0
p = 1
for _ in range(60):
n = 0
for i in range(N):
if A[i] ... | false | 11.764706 | [
"- for i in range(60):",
"- s = 0",
"- for a in A:",
"- if a & (1 << i):",
"- s += 1",
"- tmp = 0",
"- for j in range(N):",
"- if A[j] & (1 << i):",
"- s -= 1",
"- tmp += (N - j - 1) - s",
"- ... | false | 0.043371 | 0.041673 | 1.040746 | [
"s724466409",
"s284853051"
] |
u976225138 | p03846 | python | s187894832 | s559568390 | 122 | 100 | 11,248 | 13,880 | Accepted | Accepted | 18.03 | def index(n:int, a: int):
if a % 2 == 0:
i = n // 2 - a // 2
j = (i + 1) * -1
return (i, j) if i != n // 2 else (i,)
else:
i = (n // 2 - 1) - (a - 1) // 2
j = (i + 1) * -1
return (i, j)
n = int(eval(input()))
line = [0 for _ in range(n)]
for a in map(... | n = int(eval(input()))
a = [int(x) for x in input().split()]
line = [abs(i - (n - i - 1)) for i in range(n)]
if sorted(a) == sorted(line):
print(((2 ** (n // 2)) % (10 ** 9 + 7)))
else:
print((0)) | 24 | 7 | 678 | 200 | def index(n: int, a: int):
if a % 2 == 0:
i = n // 2 - a // 2
j = (i + 1) * -1
return (i, j) if i != n // 2 else (i,)
else:
i = (n // 2 - 1) - (a - 1) // 2
j = (i + 1) * -1
return (i, j)
n = int(eval(input()))
line = [0 for _ in range(n)]
for a in map(int, input... | n = int(eval(input()))
a = [int(x) for x in input().split()]
line = [abs(i - (n - i - 1)) for i in range(n)]
if sorted(a) == sorted(line):
print(((2 ** (n // 2)) % (10**9 + 7)))
else:
print((0))
| false | 70.833333 | [
"-def index(n: int, a: int):",
"- if a % 2 == 0:",
"- i = n // 2 - a // 2",
"- j = (i + 1) * -1",
"- return (i, j) if i != n // 2 else (i,)",
"- else:",
"- i = (n // 2 - 1) - (a - 1) // 2",
"- j = (i + 1) * -1",
"- return (i, j)",
"-",
"-",
"-lin... | false | 0.041067 | 0.045856 | 0.895565 | [
"s187894832",
"s559568390"
] |
u017810624 | p02928 | python | s189428985 | s864039118 | 475 | 389 | 3,188 | 3,188 | Accepted | Accepted | 18.11 | import sys
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
A=sorted(a)
shokou=[]
kousa=[]
m=10**9+7
for i in range(n):
ct=0
for j in range(i+1,n):
if a[i]>a[j]:ct+=1
shokou.append(ct)
for i in range(n):
kousa.append(A.index(a[i]))
ans=0
S=0
for i in range(n):
S=(k*(2*s... | n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
A=sorted(l)
x=[];d=[]
m=10**9+7
for i in range(n):
ct=0
for j in range(i+1,n):
if l[i]>l[j]:ct+=1
x.append(ct)
for i in range(n):
d.append(A.index(l[i]))
ans=0
for i in range(n):
ans+=((k*(2*x[i]+(k-1)*d[i]))//2)%m
print((a... | 21 | 16 | 374 | 318 | import sys
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
A = sorted(a)
shokou = []
kousa = []
m = 10**9 + 7
for i in range(n):
ct = 0
for j in range(i + 1, n):
if a[i] > a[j]:
ct += 1
shokou.append(ct)
for i in range(n):
kousa.append(A.index(a[i]))
ans =... | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
A = sorted(l)
x = []
d = []
m = 10**9 + 7
for i in range(n):
ct = 0
for j in range(i + 1, n):
if l[i] > l[j]:
ct += 1
x.append(ct)
for i in range(n):
d.append(A.index(l[i]))
ans = 0
for i in range(n):
ans ... | false | 23.809524 | [
"-import sys",
"-",
"-a = list(map(int, input().split()))",
"-A = sorted(a)",
"-shokou = []",
"-kousa = []",
"+l = list(map(int, input().split()))",
"+A = sorted(l)",
"+x = []",
"+d = []",
"- if a[i] > a[j]:",
"+ if l[i] > l[j]:",
"- shokou.append(ct)",
"+ x.append(ct)"... | false | 0.049461 | 0.04955 | 0.998211 | [
"s189428985",
"s864039118"
] |
u418826171 | p02771 | python | s355840990 | s759397685 | 32 | 29 | 9,124 | 9,196 | Accepted | Accepted | 9.38 | ls = sorted(list(map(int,input().split())))
if ls[0] == ls[1] and ls[0] != ls[2]:
print('Yes')
elif ls[1] == ls[2] and ls[0] != ls[1]:
print('Yes')
elif ls[0] == ls[2] and ls[0] != ls[1]:
print('Yes')
else:
print('No') | ls = sorted(list(map(int,input().split())))
bool = 0
if ls[0] == ls[1] and ls[1] != ls[2]:
bool = 1
elif ls[1] == ls[2] and ls[0] != ls[1]:
bool = 1
elif ls[0] == ls[2] and ls[0] != ls[1]:
bool = 1
if bool:
print('Yes')
else:
print('No') | 9 | 12 | 242 | 270 | ls = sorted(list(map(int, input().split())))
if ls[0] == ls[1] and ls[0] != ls[2]:
print("Yes")
elif ls[1] == ls[2] and ls[0] != ls[1]:
print("Yes")
elif ls[0] == ls[2] and ls[0] != ls[1]:
print("Yes")
else:
print("No")
| ls = sorted(list(map(int, input().split())))
bool = 0
if ls[0] == ls[1] and ls[1] != ls[2]:
bool = 1
elif ls[1] == ls[2] and ls[0] != ls[1]:
bool = 1
elif ls[0] == ls[2] and ls[0] != ls[1]:
bool = 1
if bool:
print("Yes")
else:
print("No")
| false | 25 | [
"-if ls[0] == ls[1] and ls[0] != ls[2]:",
"- print(\"Yes\")",
"+bool = 0",
"+if ls[0] == ls[1] and ls[1] != ls[2]:",
"+ bool = 1",
"- print(\"Yes\")",
"+ bool = 1",
"+ bool = 1",
"+if bool:"
] | false | 0.133483 | 0.04459 | 2.993592 | [
"s355840990",
"s759397685"
] |
u297574184 | p03164 | python | s961662229 | s114834348 | 1,019 | 635 | 5,740 | 14,292 | Accepted | Accepted | 37.68 | INF = float('inf')
N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW, INF):
sumV = sum([v for w, v in items])
dp = [0] + [INF]*sumV
accV = 0
for wi, vi in sorted(items, key=lambda x: x[1]):
accV += vi
... | N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW):
dp = {0: 0}
for wi, vi in sorted(items, key=lambda x: x[1]):
for v, w in list(dp.items()):
v2 = v + vi
if w+wi <= capW:
w2... | 20 | 18 | 584 | 545 | INF = float("inf")
N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW, INF):
sumV = sum([v for w, v in items])
dp = [0] + [INF] * sumV
accV = 0
for wi, vi in sorted(items, key=lambda x: x[1]):
accV += vi
for... | N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW):
dp = {0: 0}
for wi, vi in sorted(items, key=lambda x: x[1]):
for v, w in list(dp.items()):
v2 = v + vi
if w + wi <= capW:
w2 = w +... | false | 10 | [
"-INF = float(\"inf\")",
"-def knapsack01(items, capW, INF):",
"- sumV = sum([v for w, v in items])",
"- dp = [0] + [INF] * sumV",
"- accV = 0",
"+def knapsack01(items, capW):",
"+ dp = {0: 0}",
"- accV += vi",
"- for v in reversed(list(range(vi, min(sumV, accV) + 1))):",
... | false | 0.036144 | 0.087498 | 0.413083 | [
"s961662229",
"s114834348"
] |
u450983668 | p02861 | python | s647650947 | s031062035 | 153 | 17 | 12,504 | 3,064 | Accepted | Accepted | 88.89 | import numpy as np
def dist(ax, ay, bx, by):
ans = np.sqrt( (ax-bx)**2 +(ay-by)**2 )
return ans
N = int(eval(input()))
xs = []
ys = []
for _ in range(N):
x, y = list(map(int, input().split()))
xs.append(x)
ys.append(y)
di2 = 0.0
for i in range(N):
for j in range(N):
if i >= j:
... | def dist(a, b):
return ( (a[0]-b[0])**2 + (a[1]-b[1])**2 )**0.5
N = int(eval(input()))
xy = []
for _ in range(N):
x, y = list(map(int, input().split()))
xy.append([x,y])
di2 = 0.0
for i in range(N):
for j in range(N):
if i >= j:
continue
else:
di2 += dist(xy[i], xy[j])
... | 23 | 19 | 395 | 324 | import numpy as np
def dist(ax, ay, bx, by):
ans = np.sqrt((ax - bx) ** 2 + (ay - by) ** 2)
return ans
N = int(eval(input()))
xs = []
ys = []
for _ in range(N):
x, y = list(map(int, input().split()))
xs.append(x)
ys.append(y)
di2 = 0.0
for i in range(N):
for j in range(N):
if i >= j:... | def dist(a, b):
return ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** 0.5
N = int(eval(input()))
xy = []
for _ in range(N):
x, y = list(map(int, input().split()))
xy.append([x, y])
di2 = 0.0
for i in range(N):
for j in range(N):
if i >= j:
continue
else:
di2 += di... | false | 17.391304 | [
"-import numpy as np",
"-",
"-",
"-def dist(ax, ay, bx, by):",
"- ans = np.sqrt((ax - bx) ** 2 + (ay - by) ** 2)",
"- return ans",
"+def dist(a, b):",
"+ return ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** 0.5",
"-xs = []",
"-ys = []",
"+xy = []",
"- xs.append(x)",
"- ys.appen... | false | 0.22633 | 0.043542 | 5.197917 | [
"s647650947",
"s031062035"
] |
u209275335 | p02767 | python | s133048616 | s375094713 | 187 | 165 | 38,896 | 38,256 | Accepted | Accepted | 11.76 | n = int(eval(input()))
li = list(map(int,input().split()))
lia = []
for i in range(1,100):
a = 0
for j in range(n):
a += (abs(li[j]-i))**2
lia.append(a)
print((min(lia))) | n = int(eval(input()))
li = list(map(int,input().split()))
o1 = (sum(li))//n
o2 = o1 + 1
li1 = []
li2 = []
for i in range(n):
li1.append((int(li[i]-o1))**2)
for j in range(n):
li2.append((int(li[j]-o2))**2)
if sum(li1) >= sum(li2):
print((sum(li2)))
else:
print((sum(li1))) | 9 | 14 | 190 | 294 | n = int(eval(input()))
li = list(map(int, input().split()))
lia = []
for i in range(1, 100):
a = 0
for j in range(n):
a += (abs(li[j] - i)) ** 2
lia.append(a)
print((min(lia)))
| n = int(eval(input()))
li = list(map(int, input().split()))
o1 = (sum(li)) // n
o2 = o1 + 1
li1 = []
li2 = []
for i in range(n):
li1.append((int(li[i] - o1)) ** 2)
for j in range(n):
li2.append((int(li[j] - o2)) ** 2)
if sum(li1) >= sum(li2):
print((sum(li2)))
else:
print((sum(li1)))
| false | 35.714286 | [
"-lia = []",
"-for i in range(1, 100):",
"- a = 0",
"- for j in range(n):",
"- a += (abs(li[j] - i)) ** 2",
"- lia.append(a)",
"-print((min(lia)))",
"+o1 = (sum(li)) // n",
"+o2 = o1 + 1",
"+li1 = []",
"+li2 = []",
"+for i in range(n):",
"+ li1.append((int(li[i] - o1)) ** ... | false | 0.099951 | 0.038627 | 2.58762 | [
"s133048616",
"s375094713"
] |
u709304134 | p03108 | python | s889677756 | s366336155 | 750 | 655 | 24,828 | 24,848 | Accepted | Accepted | 12.67 | N, M = list(map(int, input().split()))
ab = [tuple([int(x)-1 for x in input().split()]) for _ in range(M)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1) # 木の高さ
self.n = [1] * (n+1) # グループメンバー数
def find(self, x):
... | N, M = list(map(int, input().split()))
ab = [tuple([int(x)-1 for x in input().split()]) for _ in range(M)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1) # 木の高さ
self.n = [1] * (n+1) # グループメンバー数
def find(self, x):
... | 49 | 50 | 1,340 | 1,379 | N, M = list(map(int, input().split()))
ab = [tuple([int(x) - 1 for x in input().split()]) for _ in range(M)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1) # 木の高さ
self.n = [1] * (n + 1) # グループメンバー数
def find(self, x):
if... | N, M = list(map(int, input().split()))
ab = [tuple([int(x) - 1 for x in input().split()]) for _ in range(M)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1) # 木の高さ
self.n = [1] * (n + 1) # グループメンバー数
def find(self, x):
if... | false | 2 | [
"- p -= uf.find_n(px) * uf.find_n(py)",
"+ # p -= uf.find_n(px) * uf.find_n(py)",
"+ p -= uf.n[px] * uf.n[py]"
] | false | 0.058312 | 0.054129 | 1.077276 | [
"s889677756",
"s366336155"
] |
u762420987 | p03000 | python | s278858595 | s695013751 | 25 | 17 | 3,444 | 2,940 | Accepted | Accepted | 32 | from copy import deepcopy
import sys
from itertools import accumulate
N,X = list(map(int,input().split()))
Llist = list(map(int,input().split()))
ruiseki = accumulate(Llist)
for i,r in enumerate(ruiseki,2):
if r <= X:
continue
else:
print((i-1))
sys.exit()
print(i) | N, X = list(map(int, input().split()))
Llist = list(map(int, input().split()))
now = 0
ans = 1
for i in range(N):
now += Llist[i]
if now <= X:
ans += 1
print(ans)
| 14 | 9 | 303 | 181 | from copy import deepcopy
import sys
from itertools import accumulate
N, X = list(map(int, input().split()))
Llist = list(map(int, input().split()))
ruiseki = accumulate(Llist)
for i, r in enumerate(ruiseki, 2):
if r <= X:
continue
else:
print((i - 1))
sys.exit()
print(i)
| N, X = list(map(int, input().split()))
Llist = list(map(int, input().split()))
now = 0
ans = 1
for i in range(N):
now += Llist[i]
if now <= X:
ans += 1
print(ans)
| false | 35.714286 | [
"-from copy import deepcopy",
"-import sys",
"-from itertools import accumulate",
"-",
"-ruiseki = accumulate(Llist)",
"-for i, r in enumerate(ruiseki, 2):",
"- if r <= X:",
"- continue",
"- else:",
"- print((i - 1))",
"- sys.exit()",
"-print(i)",
"+now = 0",
"+a... | false | 0.170107 | 0.035253 | 4.825364 | [
"s278858595",
"s695013751"
] |
u223133214 | p03680 | python | s435831310 | s537852869 | 198 | 87 | 7,884 | 7,888 | Accepted | Accepted | 56.06 | N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
b = [-1] * N
botan = a[0]
cnt = 0
for i in range(N):
if botan == 2:
print((cnt + 1))
exit()
cnt += 1
botan = a[botan - 1]
print((-1))
| from sys import stdin
input = stdin.readline
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
b = [-1] * N
botan = a[0]
cnt = 0
for i in range(N):
if botan == 2:
print((cnt + 1))
exit()
cnt += 1
botan = a[botan - 1]
print((-1))
| 15 | 17 | 229 | 276 | N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
b = [-1] * N
botan = a[0]
cnt = 0
for i in range(N):
if botan == 2:
print((cnt + 1))
exit()
cnt += 1
botan = a[botan - 1]
print((-1))
| from sys import stdin
input = stdin.readline
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
b = [-1] * N
botan = a[0]
cnt = 0
for i in range(N):
if botan == 2:
print((cnt + 1))
exit()
cnt += 1
botan = a[botan - 1]
print((-1))
| false | 11.764706 | [
"+from sys import stdin",
"+",
"+input = stdin.readline"
] | false | 0.06046 | 0.082518 | 0.732687 | [
"s435831310",
"s537852869"
] |
u123756661 | p03062 | python | s462164340 | s856546810 | 246 | 108 | 65,184 | 91,448 | Accepted | Accepted | 56.1 | int(eval(input()))
a=[int(i) for i in input().split()]
b=[abs(int(i)) for i in a]
c=[int(i) for i in a if i<0]
print((sum(b)-[0,min(b)*2][len(c)%2])) | n=int(eval(input()))
a=[int(i) for i in input().split()]
x=0
b=[]
for i in a:
if i<0: x=x+1
b.append(abs(i))
b.sort()
print((sum(b)-b[0]*2 if x%2 else sum(b))) | 5 | 9 | 145 | 164 | int(eval(input()))
a = [int(i) for i in input().split()]
b = [abs(int(i)) for i in a]
c = [int(i) for i in a if i < 0]
print((sum(b) - [0, min(b) * 2][len(c) % 2]))
| n = int(eval(input()))
a = [int(i) for i in input().split()]
x = 0
b = []
for i in a:
if i < 0:
x = x + 1
b.append(abs(i))
b.sort()
print((sum(b) - b[0] * 2 if x % 2 else sum(b)))
| false | 44.444444 | [
"-int(eval(input()))",
"+n = int(eval(input()))",
"-b = [abs(int(i)) for i in a]",
"-c = [int(i) for i in a if i < 0]",
"-print((sum(b) - [0, min(b) * 2][len(c) % 2]))",
"+x = 0",
"+b = []",
"+for i in a:",
"+ if i < 0:",
"+ x = x + 1",
"+ b.append(abs(i))",
"+b.sort()",
"+print... | false | 0.046246 | 0.046572 | 0.993013 | [
"s462164340",
"s856546810"
] |
u141610915 | p02632 | python | s097689286 | s292618205 | 1,193 | 1,018 | 269,348 | 232,832 | Accepted | Accepted | 14.67 | import sys
input = sys.stdin.readline
K = int(eval(input()))
S = list(eval(input()))[: -1]
mod = 10 ** 9 + 7
class Factorial:
def __init__(self, n, mod):
self.f = [1]
for i in range(1, n + 1):
self.f.append(self.f[-1] * i % mod)
self.i = [pow(self.f[-1], mod - 2, mod)]
for i in rang... | import sys
input = sys.stdin.readline
K = int(eval(input()))
S = list(eval(input()))[: -1]
N = len(S)
mod = 10 ** 9 + 7
class Factorial:
def __init__(self, n, mod):
self.f = [1]
for i in range(1, n + 1):
self.f.append(self.f[-1] * i % mod)
self.i = [pow(self.f[-1], mod - 2, mod)]
f... | 31 | 31 | 816 | 779 | import sys
input = sys.stdin.readline
K = int(eval(input()))
S = list(eval(input()))[:-1]
mod = 10**9 + 7
class Factorial:
def __init__(self, n, mod):
self.f = [1]
for i in range(1, n + 1):
self.f.append(self.f[-1] * i % mod)
self.i = [pow(self.f[-1], mod - 2, mod)]
fo... | import sys
input = sys.stdin.readline
K = int(eval(input()))
S = list(eval(input()))[:-1]
N = len(S)
mod = 10**9 + 7
class Factorial:
def __init__(self, n, mod):
self.f = [1]
for i in range(1, n + 1):
self.f.append(self.f[-1] * i % mod)
self.i = [pow(self.f[-1], mod - 2, mod)]... | false | 0 | [
"+N = len(S)",
"-###",
"-f = Factorial(10**6 * 3, mod)",
"+f = Factorial(N + K + 1, mod)",
"-for i in range(K + 1):",
"- # i ko migi soto",
"- t = f.combi(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, mod) % mod",
"- t = t * pow(26, i, mod) % mod",
"- res += t",
"+for l in range(K +... | false | 0.046153 | 0.047022 | 0.981537 | [
"s097689286",
"s292618205"
] |
u094999522 | p02630 | python | s172080270 | s310420074 | 454 | 366 | 40,236 | 40,248 | Accepted | Accepted | 19.38 | import collections
_ = eval(input())
a = [*list(map(int, input().split()))]
q = int(eval(input()))
s = sum(a)
b = [[*list(map(int,input().split()))] for _ in range(q)]
c = collections.Counter(a)
for i,j in b:
if j not in c:
c[j] = 0
if i not in c:
c[i] = 0
s += (j-i)*c[i]
c[... | from collections import defaultdict
_ = eval(input())
a = [*list(map(int, input().split()))]
q = int(eval(input()))
s = sum(a)
b = [[*list(map(int,input().split()))] for _ in range(q)]
c = defaultdict(int)
for i in a:
c[i]+=1
for i,j in b:
s += (j-i)*c[i]
c[j]+=c[i]
c[i] = 0
print(s) | 16 | 14 | 332 | 293 | import collections
_ = eval(input())
a = [*list(map(int, input().split()))]
q = int(eval(input()))
s = sum(a)
b = [[*list(map(int, input().split()))] for _ in range(q)]
c = collections.Counter(a)
for i, j in b:
if j not in c:
c[j] = 0
if i not in c:
c[i] = 0
s += (j - i) * c[i]
c[j] += ... | from collections import defaultdict
_ = eval(input())
a = [*list(map(int, input().split()))]
q = int(eval(input()))
s = sum(a)
b = [[*list(map(int, input().split()))] for _ in range(q)]
c = defaultdict(int)
for i in a:
c[i] += 1
for i, j in b:
s += (j - i) * c[i]
c[j] += c[i]
c[i] = 0
print(s)
| false | 12.5 | [
"-import collections",
"+from collections import defaultdict",
"-c = collections.Counter(a)",
"+c = defaultdict(int)",
"+for i in a:",
"+ c[i] += 1",
"- if j not in c:",
"- c[j] = 0",
"- if i not in c:",
"- c[i] = 0"
] | false | 0.070249 | 0.110461 | 0.635962 | [
"s172080270",
"s310420074"
] |
u921168761 | p02695 | python | s505213308 | s826393785 | 1,180 | 481 | 9,224 | 9,044 | Accepted | Accepted | 59.24 | import itertools
n, m, q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(q)]
ls = list(range(n + m - 1))
mx = 0
for l in itertools.combinations(ls, m - 1):
a = [0]
idx = 0
val = 1
for i in range(n + m - 1):
if idx < m - 1 and i == l[idx]:
... | import sys
sys.setrecursionlimit(10**7)
n, m, q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(q)]
def dfs(k, x):
global mx
if k == n:
v = 0
for line in query:
a, b, c, d = line
if x[b] - x[a] == c: v += d
... | 22 | 22 | 531 | 454 | import itertools
n, m, q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(q)]
ls = list(range(n + m - 1))
mx = 0
for l in itertools.combinations(ls, m - 1):
a = [0]
idx = 0
val = 1
for i in range(n + m - 1):
if idx < m - 1 and i == l[idx]:
va... | import sys
sys.setrecursionlimit(10**7)
n, m, q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(q)]
def dfs(k, x):
global mx
if k == n:
v = 0
for line in query:
a, b, c, d = line
if x[b] - x[a] == c:
v += d
... | false | 0 | [
"-import itertools",
"+import sys",
"+sys.setrecursionlimit(10**7)",
"-ls = list(range(n + m - 1))",
"+",
"+",
"+def dfs(k, x):",
"+ global mx",
"+ if k == n:",
"+ v = 0",
"+ for line in query:",
"+ a, b, c, d = line",
"+ if x[b] - x[a] == c:",
"+ ... | false | 0.184474 | 0.067736 | 2.72344 | [
"s505213308",
"s826393785"
] |
u595375942 | p02744 | python | s491406264 | s529897589 | 106 | 84 | 16,428 | 16,340 | Accepted | Accepted | 20.75 | import collections
N = int(eval(input()))
S = "abcdefghij"
result = []
deq = collections.deque(["a"])
while deq:
s = deq.popleft()
if len(s) == N:
result.append(s)
continue
else:
for i in S[:len(set(s))+1]:
deq.append(s + i)
print(('\n'.join(result))) | import collections
def bfs(N):
S = "abcdefghij"
result = []
deq = collections.deque(["a"])
while deq:
s = deq.popleft()
if len(s) == N:
result.append(s)
continue
else:
for i in S[:len(set(s))+1]:
deq.append(s + i... | 17 | 20 | 310 | 397 | import collections
N = int(eval(input()))
S = "abcdefghij"
result = []
deq = collections.deque(["a"])
while deq:
s = deq.popleft()
if len(s) == N:
result.append(s)
continue
else:
for i in S[: len(set(s)) + 1]:
deq.append(s + i)
print(("\n".join(result)))
| import collections
def bfs(N):
S = "abcdefghij"
result = []
deq = collections.deque(["a"])
while deq:
s = deq.popleft()
if len(s) == N:
result.append(s)
continue
else:
for i in S[: len(set(s)) + 1]:
deq.append(s + i)
retur... | false | 15 | [
"+",
"+def bfs(N):",
"+ S = \"abcdefghij\"",
"+ result = []",
"+ deq = collections.deque([\"a\"])",
"+ while deq:",
"+ s = deq.popleft()",
"+ if len(s) == N:",
"+ result.append(s)",
"+ continue",
"+ else:",
"+ for i in S[: len(s... | false | 0.165915 | 0.157453 | 1.05374 | [
"s491406264",
"s529897589"
] |
u667469290 | p03244 | python | s608758765 | s276413388 | 122 | 92 | 18,456 | 20,572 | Accepted | Accepted | 24.59 | # -*- coding: utf-8 -*-
from collections import defaultdict
from operator import itemgetter
def solve():
n = int(eval(input()))
V = list(map(int, input().split()))
l = defaultdict(int)
u = defaultdict(int)
for i in range(0,n,2):
l[V[i]] += 1
u[V[i+1]] += 1
l = sorted... | # -*- coding: utf-8 -*-
from collections import Counter
from operator import itemgetter
def solve():
eval(input())
V = list(map(int, input().split()))
l = sorted(list(Counter(V[::2]).items())+[(0,0)], key=itemgetter(1), reverse=True)
u = sorted(list(Counter(V[1::2]).items())+[(0,0)], key=itemgett... | 32 | 14 | 1,036 | 533 | # -*- coding: utf-8 -*-
from collections import defaultdict
from operator import itemgetter
def solve():
n = int(eval(input()))
V = list(map(int, input().split()))
l = defaultdict(int)
u = defaultdict(int)
for i in range(0, n, 2):
l[V[i]] += 1
u[V[i + 1]] += 1
l = sorted(list(l... | # -*- coding: utf-8 -*-
from collections import Counter
from operator import itemgetter
def solve():
eval(input())
V = list(map(int, input().split()))
l = sorted(
list(Counter(V[::2]).items()) + [(0, 0)], key=itemgetter(1), reverse=True
)
u = sorted(
list(Counter(V[1::2]).items()) ... | false | 56.25 | [
"-from collections import defaultdict",
"+from collections import Counter",
"- n = int(eval(input()))",
"+ eval(input())",
"- l = defaultdict(int)",
"- u = defaultdict(int)",
"- for i in range(0, n, 2):",
"- l[V[i]] += 1",
"- u[V[i + 1]] += 1",
"- l = sorted(list(l.... | false | 0.035121 | 0.035296 | 0.995033 | [
"s608758765",
"s276413388"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.