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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u634461820 | p03086 | python | s400282686 | s380329610 | 334 | 166 | 21,704 | 38,256 | Accepted | Accepted | 50.3 | import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())
s = S()
acgt = ["A","C","G","T"]
cnt = 0
ans =... | import sys
import itertools
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input()... | 24 | 29 | 447 | 518 | import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL():
return list(map(int, input().split()))
def SL():
return input().split()
def I():
return int(sys.stdin.readline())
def S():
return eval(input())
s = S()
acgt = ["A", "C", "G", "T"]... | import sys
import itertools
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL():
return list(map(int, input().split()))
def SL():
return input().split()
def I():
return int(sys.stdin.readline())
def S():
retu... | false | 17.241379 | [
"+import sys",
"-import numpy as np",
"-import sys",
"+import math",
"+from collections import deque",
"-MAX_INT = int(10e10)",
"+MAX_INT = int(10e15)",
"+sys.setrecursionlimit(1000000)",
"-acgt = [\"A\", \"C\", \"G\", \"T\"]",
"+N = len(s)",
"+t = list(\"ACGT\")",
"+ans = 0",
"-ans = 0",
... | false | 0.085837 | 0.046399 | 1.84997 | [
"s400282686",
"s380329610"
] |
u597374218 | p02606 | python | s039811189 | s768569045 | 31 | 24 | 9,152 | 9,144 | Accepted | Accepted | 22.58 | L,R,d=list(map(int,input().split()))
count=0
for num in range(L,R+1):
if num%d==0:
count+=1
print(count) | L,R,d=list(map(int,input().split()))
print((R//d-(L-1)//d)) | 6 | 2 | 115 | 52 | L, R, d = list(map(int, input().split()))
count = 0
for num in range(L, R + 1):
if num % d == 0:
count += 1
print(count)
| L, R, d = list(map(int, input().split()))
print((R // d - (L - 1) // d))
| false | 66.666667 | [
"-count = 0",
"-for num in range(L, R + 1):",
"- if num % d == 0:",
"- count += 1",
"-print(count)",
"+print((R // d - (L - 1) // d))"
] | false | 0.037751 | 0.038816 | 0.972577 | [
"s039811189",
"s768569045"
] |
u467736898 | p02840 | python | s545720410 | s842210619 | 438 | 293 | 88,016 | 84,268 | Accepted | Accepted | 33.11 | def solve(N, X, D):
if D == 0:
if X == 0:
return 1
return N+1
L = {0: [(0, 1), (1, -1)]}
coef_l = 0
coef_r = 1
for coef_x in range(1, N+1):
m = X * coef_x % D
l = X * coef_x // D + coef_l
r = X * coef_x // D + coef_x * N - coef_r
... | import os
import sys
#import numpy as np
def solve(N, X, D):
if D == 0:
if X == 0:
return 1
return N+1
#L = {0: [(0, 1), (1, -1)]}
L = [[(0, 1), (1, -1)]]
mapping = {0: 0}
coef_l = 0
coef_r = 1
for coef_x in range(1, N+1):
m = X * coef_x % ... | 33 | 63 | 802 | 1,669 | def solve(N, X, D):
if D == 0:
if X == 0:
return 1
return N + 1
L = {0: [(0, 1), (1, -1)]}
coef_l = 0
coef_r = 1
for coef_x in range(1, N + 1):
m = X * coef_x % D
l = X * coef_x // D + coef_l
r = X * coef_x // D + coef_x * N - coef_r
coef_l... | import os
import sys
# import numpy as np
def solve(N, X, D):
if D == 0:
if X == 0:
return 1
return N + 1
# L = {0: [(0, 1), (1, -1)]}
L = [[(0, 1), (1, -1)]]
mapping = {0: 0}
coef_l = 0
coef_r = 1
for coef_x in range(1, N + 1):
m = X * coef_x % D
... | false | 47.619048 | [
"+import os",
"+import sys",
"+",
"+# import numpy as np",
"- L = {0: [(0, 1), (1, -1)]}",
"+ # L = {0: [(0, 1), (1, -1)]}",
"+ L = [[(0, 1), (1, -1)]]",
"+ mapping = {0: 0}",
"- if m not in L:",
"- L[m] = []",
"- L[m].append((l, 1))",
"- L[m].append... | false | 0.045985 | 0.046159 | 0.996219 | [
"s545720410",
"s842210619"
] |
u046158516 | p02701 | python | s904895682 | s684647451 | 318 | 287 | 30,968 | 98,116 | Accepted | Accepted | 9.75 | set2=set()
N=int(eval(input()))
ans=0
for i in range(N):
s=eval(input())
if not s in set2:
ans+=1
set2.add(s)
print(ans) | n=int(eval(input()))
t=set()
for i in range(n):
s=eval(input())
t.add(s)
print((len(t))) | 9 | 6 | 128 | 83 | set2 = set()
N = int(eval(input()))
ans = 0
for i in range(N):
s = eval(input())
if not s in set2:
ans += 1
set2.add(s)
print(ans)
| n = int(eval(input()))
t = set()
for i in range(n):
s = eval(input())
t.add(s)
print((len(t)))
| false | 33.333333 | [
"-set2 = set()",
"-N = int(eval(input()))",
"-ans = 0",
"-for i in range(N):",
"+n = int(eval(input()))",
"+t = set()",
"+for i in range(n):",
"- if not s in set2:",
"- ans += 1",
"- set2.add(s)",
"-print(ans)",
"+ t.add(s)",
"+print((len(t)))"
] | false | 0.038807 | 0.036553 | 1.061654 | [
"s904895682",
"s684647451"
] |
u747703115 | p02887 | python | s198671759 | s222106019 | 52 | 42 | 3,316 | 3,316 | Accepted | Accepted | 19.23 | N = int(eval(input()))
S = eval(input())
s = S[0]
for i in range(1, N):
if s[-1] != S[i]:
s += S[i]
print((len(s))) | n = int(eval(input()))
s = eval(input())
cnt = 1
for i in range(n-1):
if s[i] != s[i+1]:
cnt += 1
print(cnt) | 7 | 9 | 119 | 118 | N = int(eval(input()))
S = eval(input())
s = S[0]
for i in range(1, N):
if s[-1] != S[i]:
s += S[i]
print((len(s)))
| n = int(eval(input()))
s = eval(input())
cnt = 1
for i in range(n - 1):
if s[i] != s[i + 1]:
cnt += 1
print(cnt)
| false | 22.222222 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-s = S[0]",
"-for i in range(1, N):",
"- if s[-1] != S[i]:",
"- s += S[i]",
"-print((len(s)))",
"+n = int(eval(input()))",
"+s = eval(input())",
"+cnt = 1",
"+for i in range(n - 1):",
"+ if s[i] != s[i + 1]:",
"+ cnt += 1"... | false | 0.046667 | 0.091331 | 0.510962 | [
"s198671759",
"s222106019"
] |
u254871849 | p03844 | python | s446924000 | s440143919 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A, op, B = input().split()
a, b = [int(x) for x in [A, B]]
if op == '+':
ans = a + b
else:
ans = a - b
print(ans)
| import sys
formula = sys.stdin.readline().rstrip()
def main():
return eval(formula)
if __name__ == '__main__':
ans = main()
print(ans) | 8 | 10 | 130 | 158 | A, op, B = input().split()
a, b = [int(x) for x in [A, B]]
if op == "+":
ans = a + b
else:
ans = a - b
print(ans)
| import sys
formula = sys.stdin.readline().rstrip()
def main():
return eval(formula)
if __name__ == "__main__":
ans = main()
print(ans)
| false | 20 | [
"-A, op, B = input().split()",
"-a, b = [int(x) for x in [A, B]]",
"-if op == \"+\":",
"- ans = a + b",
"-else:",
"- ans = a - b",
"-print(ans)",
"+import sys",
"+",
"+formula = sys.stdin.readline().rstrip()",
"+",
"+",
"+def main():",
"+ return eval(formula)",
"+",
"+",
"+i... | false | 0.041923 | 0.043484 | 0.964112 | [
"s446924000",
"s440143919"
] |
u806976856 | p02573 | python | s341967467 | s722498611 | 756 | 519 | 46,392 | 115,196 | Accepted | Accepted | 31.35 | from _collections import deque
n,m=list(map(int,input().split()))
f=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
f[a].append(b)
f[b].append(a)
g=[0]*(n+1)
p=[0]*(n+1)
for i in range(1,n+1):
if p[i]==0:
p[i]=i
data=[i]
data=deque(da... | from collections import deque
n,m=list(map(int,input().split()))
f=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
f[a].append(b)
f[b].append(a)
g=[0]*(n+1)
p=[0]*(n+1)
for i in range(1,n+1):
if p[i]==0:
p[i]=i
data=[i]
data=deque(dat... | 26 | 26 | 567 | 566 | from _collections import deque
n, m = list(map(int, input().split()))
f = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
f[a].append(b)
f[b].append(a)
g = [0] * (n + 1)
p = [0] * (n + 1)
for i in range(1, n + 1):
if p[i] == 0:
p[i] = i
data = [i]
... | from collections import deque
n, m = list(map(int, input().split()))
f = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
f[a].append(b)
f[b].append(a)
g = [0] * (n + 1)
p = [0] * (n + 1)
for i in range(1, n + 1):
if p[i] == 0:
p[i] = i
data = [i]
... | false | 0 | [
"-from _collections import deque",
"+from collections import deque"
] | false | 0.036857 | 0.040738 | 0.90474 | [
"s341967467",
"s722498611"
] |
u569272329 | p02682 | python | s346556298 | s750969076 | 25 | 23 | 9,152 | 9,168 | Accepted | Accepted | 8 | A, B, C, K = list(map(int, input().split()))
if K <= A:
print(K)
exit(0)
K -= A
ans = A
if K <= B:
print(ans)
exit(0)
K -= B
print((ans-K))
| A, B, C, K = list(map(int, input().split()))
if K <= A:
print(K)
exit(0)
K -= A
if K <= B:
print(A)
exit(0)
print((A-(K-B)))
| 11 | 9 | 158 | 141 | A, B, C, K = list(map(int, input().split()))
if K <= A:
print(K)
exit(0)
K -= A
ans = A
if K <= B:
print(ans)
exit(0)
K -= B
print((ans - K))
| A, B, C, K = list(map(int, input().split()))
if K <= A:
print(K)
exit(0)
K -= A
if K <= B:
print(A)
exit(0)
print((A - (K - B)))
| false | 18.181818 | [
"-ans = A",
"- print(ans)",
"+ print(A)",
"-K -= B",
"-print((ans - K))",
"+print((A - (K - B)))"
] | false | 0.047559 | 0.043169 | 1.101682 | [
"s346556298",
"s750969076"
] |
u802627598 | p02947 | python | s836065565 | s432691023 | 448 | 336 | 10,668 | 19,756 | Accepted | Accepted | 25 | n = int(eval(input()))
s = []
for i in range(n):
tmp = []
tmp = list(eval(input()))
tmp.sort()
s.append("".join(tmp))
s.sort()
cnt = 0
t_cnt = 0
for i in range(n-1):
if s[i] == s[i+1]:
t_cnt += 1
elif s[i] != s[i+1]:
if t_cnt > 1:
t_cnt += 1
... | from collections import Counter
n = int(eval(input()))
s = list(Counter(["".join(sorted(eval(input()))) for _ in [0]*n]).values())
cnt = 0
for i in s:
cnt += i*(i-1)//2
print(cnt)
| 46 | 11 | 770 | 180 | n = int(eval(input()))
s = []
for i in range(n):
tmp = []
tmp = list(eval(input()))
tmp.sort()
s.append("".join(tmp))
s.sort()
cnt = 0
t_cnt = 0
for i in range(n - 1):
if s[i] == s[i + 1]:
t_cnt += 1
elif s[i] != s[i + 1]:
if t_cnt > 1:
t_cnt += 1
t = 0
... | from collections import Counter
n = int(eval(input()))
s = list(Counter(["".join(sorted(eval(input()))) for _ in [0] * n]).values())
cnt = 0
for i in s:
cnt += i * (i - 1) // 2
print(cnt)
| false | 76.086957 | [
"+from collections import Counter",
"+",
"-s = []",
"-for i in range(n):",
"- tmp = []",
"- tmp = list(eval(input()))",
"- tmp.sort()",
"- s.append(\"\".join(tmp))",
"-s.sort()",
"+s = list(Counter([\"\".join(sorted(eval(input()))) for _ in [0] * n]).values())",
"-t_cnt = 0",
"-for... | false | 0.041915 | 0.041621 | 1.007078 | [
"s836065565",
"s432691023"
] |
u723590269 | p03416 | python | s667913247 | s254756181 | 390 | 56 | 3,064 | 2,940 | Accepted | Accepted | 85.64 | a, b = list(map(int,input().strip().split(' ')))
a_rev = ""
i = 0
j = 0
cnt = 0
#chk = []
for i in range(b - a + 1):
for j in range(len(str(a))):
a_rev = a_rev + str(a)[len(str(a)) - 1 - j]
if str(a_rev) == str(a):
cnt+=1
# chk.append(a_rev) #test
el... | a,b = list(map(int,input().split()))
cnt = 0
for i in range(a,b+1):
i = str(i)
if i == i[::-1]:
cnt += 1
print(cnt) | 24 | 10 | 387 | 145 | a, b = list(map(int, input().strip().split(" ")))
a_rev = ""
i = 0
j = 0
cnt = 0
# chk = []
for i in range(b - a + 1):
for j in range(len(str(a))):
a_rev = a_rev + str(a)[len(str(a)) - 1 - j]
if str(a_rev) == str(a):
cnt += 1
# chk.append(a_rev) #test
else:
pass
a +=... | a, b = list(map(int, input().split()))
cnt = 0
for i in range(a, b + 1):
i = str(i)
if i == i[::-1]:
cnt += 1
print(cnt)
| false | 58.333333 | [
"-a, b = list(map(int, input().strip().split(\" \")))",
"-a_rev = \"\"",
"-i = 0",
"-j = 0",
"+a, b = list(map(int, input().split()))",
"-# chk = []",
"-for i in range(b - a + 1):",
"- for j in range(len(str(a))):",
"- a_rev = a_rev + str(a)[len(str(a)) - 1 - j]",
"- if str(a_rev) == ... | false | 0.125007 | 0.101943 | 1.226253 | [
"s667913247",
"s254756181"
] |
u943004959 | p03476 | python | s101470850 | s696466081 | 664 | 464 | 15,548 | 15,528 | Accepted | Accepted | 30.12 | def solve():
q = int(eval(input()))
l, r = [], []
for _ in range(q):
tmp_l, tmp_r = list(map(int, input().split(" ")))
l.append(tmp_l)
r.append(tmp_r)
p = [True for i in range(100000)]
p[0] = p[1] = False
for i in range(2, 100000):
if p[i]:
... | def prime_TorF(n):
p = [True for i in range(n)]
p[0] = p[1] = False
for i in range(2, 100000):
if p[i]:
for j in range(2 * i, 100000, i):
p[j] = False
return p
def solve():
q = int(eval(input()))
l, r = [], []
for _ in range(q):
t... | 28 | 34 | 650 | 713 | def solve():
q = int(eval(input()))
l, r = [], []
for _ in range(q):
tmp_l, tmp_r = list(map(int, input().split(" ")))
l.append(tmp_l)
r.append(tmp_r)
p = [True for i in range(100000)]
p[0] = p[1] = False
for i in range(2, 100000):
if p[i]:
for j in ra... | def prime_TorF(n):
p = [True for i in range(n)]
p[0] = p[1] = False
for i in range(2, 100000):
if p[i]:
for j in range(2 * i, 100000, i):
p[j] = False
return p
def solve():
q = int(eval(input()))
l, r = [], []
for _ in range(q):
tmp_l, tmp_r = li... | false | 17.647059 | [
"+def prime_TorF(n):",
"+ p = [True for i in range(n)]",
"+ p[0] = p[1] = False",
"+ for i in range(2, 100000):",
"+ if p[i]:",
"+ for j in range(2 * i, 100000, i):",
"+ p[j] = False",
"+ return p",
"+",
"+",
"- p = [True for i in range(100000)]",
... | false | 0.161528 | 0.082504 | 1.957812 | [
"s101470850",
"s696466081"
] |
u006880673 | p03470 | python | s448639882 | s444754376 | 23 | 20 | 2,940 | 3,316 | Accepted | Accepted | 13.04 | n = int(eval(input()))
d = [int(eval(input())) for _ in range(n)]
print((len(set(d)))) | from collections import Counter
n = int(eval(input()))
d = [int(eval(input())) for _ in range(n)]
dict = Counter(d)
print((len(list(dict.keys())))) | 3 | 7 | 74 | 135 | n = int(eval(input()))
d = [int(eval(input())) for _ in range(n)]
print((len(set(d))))
| from collections import Counter
n = int(eval(input()))
d = [int(eval(input())) for _ in range(n)]
dict = Counter(d)
print((len(list(dict.keys()))))
| false | 57.142857 | [
"+from collections import Counter",
"+",
"-print((len(set(d))))",
"+dict = Counter(d)",
"+print((len(list(dict.keys()))))"
] | false | 0.037871 | 0.0389 | 0.973552 | [
"s448639882",
"s444754376"
] |
u353919145 | p02959 | python | s162117113 | s078643579 | 206 | 144 | 18,468 | 24,244 | Accepted | Accepted | 30.1 | n=int(eval(input()))
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans=0
for i in range(n):
m=min(a[i],b[i])
ans+=m
a[i]-=m
b[i]-=m
m=min(a[i+1],b[i])
a[i+1]-=m
b[i]-=m
ans+=m
print(ans)
| from sys import stdin,stdout
if __name__=="__main__":
n=int(stdin.readline())
a=[int(x) for x in stdin.readline().split()]
b=[int(x) for x in stdin.readline().split()]
cnt=0
for i in range(n):
if(a[i]>=b[i]):
cnt+=b[i]
else:
cnt+=a[i]
... | 15 | 22 | 262 | 499 | n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = 0
for i in range(n):
m = min(a[i], b[i])
ans += m
a[i] -= m
b[i] -= m
m = min(a[i + 1], b[i])
a[i + 1] -= m
b[i] -= m
ans += m
print(ans)
| from sys import stdin, stdout
if __name__ == "__main__":
n = int(stdin.readline())
a = [int(x) for x in stdin.readline().split()]
b = [int(x) for x in stdin.readline().split()]
cnt = 0
for i in range(n):
if a[i] >= b[i]:
cnt += b[i]
else:
cnt += a[i]
... | false | 31.818182 | [
"-n = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-b = [int(i) for i in input().split()]",
"-ans = 0",
"-for i in range(n):",
"- m = min(a[i], b[i])",
"- ans += m",
"- a[i] -= m",
"- b[i] -= m",
"- m = min(a[i + 1], b[i])",
"- a[i + 1] -= m",
"- b[i] -=... | false | 0.036228 | 0.088055 | 0.411424 | [
"s162117113",
"s078643579"
] |
u680851063 | p02614 | python | s357566165 | s582864722 | 147 | 54 | 9,976 | 9,204 | Accepted | Accepted | 63.27 | h, w, k = list(map(int, input().split()))
pic = [list(eval(input())) for _ in range(h)]
ptns = []
for i in range(2**(h+w)):
tmp = []
for j in range(h+w):
if i>>j & 1:
tmp.append(1)
else:
tmp.append(0)
ptns.append(tmp)
import copy
from itertools import ... | # ビット演算でなく, itertoolsモジュールのproductとrange(2)の組み合わせを活用.
# ※を!
from itertools import product
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
#print(c)
ans = 0
#l = list(product(range(2), repeat=h))
#m = list(product(range(2), repeat=w))
#print(l)
#print(m)
for row... | 30 | 28 | 641 | 742 | h, w, k = list(map(int, input().split()))
pic = [list(eval(input())) for _ in range(h)]
ptns = []
for i in range(2 ** (h + w)):
tmp = []
for j in range(h + w):
if i >> j & 1:
tmp.append(1)
else:
tmp.append(0)
ptns.append(tmp)
import copy
from itertools import chain
a... | # ビット演算でなく, itertoolsモジュールのproductとrange(2)の組み合わせを活用.
# ※を!
from itertools import product
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
# print(c)
ans = 0
# l = list(product(range(2), repeat=h))
# m = list(product(range(2), repeat=w))
# print(l)
# print(m)
for row_bit in product... | false | 6.666667 | [
"+# ビット演算でなく, itertoolsモジュールのproductとrange(2)の組み合わせを活用.",
"+# ※を!",
"+from itertools import product",
"+",
"-pic = [list(eval(input())) for _ in range(h)]",
"-ptns = []",
"-for i in range(2 ** (h + w)):",
"- tmp = []",
"- for j in range(h + w):",
"- if i >> j & 1:",
"- tm... | false | 0.043696 | 0.037552 | 1.163618 | [
"s357566165",
"s582864722"
] |
u950708010 | p03030 | python | s035256884 | s847944943 | 1,487 | 164 | 3,064 | 3,064 | Accepted | Accepted | 88.97 | def solve():
n = int(eval(input()))
query = []
for i in range(n):
tmp = eval(input())
s,p = tmp.split()
query.append((s,p,i+1))
query.sort()
count = 0
while count<1000:
count += 1
for i in range(n):
for j in range(i+1,n):
if query[i][0] == query[j][0]:
... | def solve():
n = int(eval(input()))
query = []
for i in range(n):
tmp = eval(input())
s,p = tmp.split()
query.append((s,p,i+1))
query.sort()
count = 0
while count<n:
count += 1
for i in range(n):
for j in range(i+1,n):
if query[i][0] == query[j][0]:
... | 23 | 23 | 513 | 510 | def solve():
n = int(eval(input()))
query = []
for i in range(n):
tmp = eval(input())
s, p = tmp.split()
query.append((s, p, i + 1))
query.sort()
count = 0
while count < 1000:
count += 1
for i in range(n):
for j in range(i + 1, n):
... | def solve():
n = int(eval(input()))
query = []
for i in range(n):
tmp = eval(input())
s, p = tmp.split()
query.append((s, p, i + 1))
query.sort()
count = 0
while count < n:
count += 1
for i in range(n):
for j in range(i + 1, n):
... | false | 0 | [
"- while count < 1000:",
"+ while count < n:"
] | false | 0.199339 | 0.153734 | 1.296651 | [
"s035256884",
"s847944943"
] |
u423966555 | p02813 | python | s193363047 | s023804299 | 45 | 28 | 8,052 | 8,052 | Accepted | Accepted | 37.78 | import itertools, sys
N = int(eval(input()))
N_list = [i for i in range(1, N+1)]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A == B:
print('0')
sys.exit()
for v, i in enumerate(list(itertools.permutations(N_list))):
i = list(i)
if A == i:
a = v
... | import itertools
N = int(eval(input()))
N_list = [i for i in range(1, N+1)]
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
N_pattern = list(itertools.permutations(N_list))
print((abs(N_pattern.index(A) - N_pattern.index(B))))
| 19 | 11 | 364 | 259 | import itertools, sys
N = int(eval(input()))
N_list = [i for i in range(1, N + 1)]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A == B:
print("0")
sys.exit()
for v, i in enumerate(list(itertools.permutations(N_list))):
i = list(i)
if A == i:
a = v
elif B == i:
... | import itertools
N = int(eval(input()))
N_list = [i for i in range(1, N + 1)]
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
N_pattern = list(itertools.permutations(N_list))
print((abs(N_pattern.index(A) - N_pattern.index(B))))
| false | 42.105263 | [
"-import itertools, sys",
"+import itertools",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-if A == B:",
"- print(\"0\")",
"- sys.exit()",
"-for v, i in enumerate(list(itertools.permutations(N_list))):",
"- i = list(i)",
"- if A == i:",
"- ... | false | 0.00645 | 0.039277 | 0.164215 | [
"s193363047",
"s023804299"
] |
u887207211 | p03469 | python | s795126612 | s272687706 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print((input().replace("2017", "2018"))) | S = input().replace("2017", "2018")
print(S) | 1 | 2 | 38 | 45 | print((input().replace("2017", "2018")))
| S = input().replace("2017", "2018")
print(S)
| false | 50 | [
"-print((input().replace(\"2017\", \"2018\")))",
"+S = input().replace(\"2017\", \"2018\")",
"+print(S)"
] | false | 0.043755 | 0.074256 | 0.589253 | [
"s795126612",
"s272687706"
] |
u319818856 | p03080 | python | s533548582 | s486446287 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | def red_or_blue(N: int, s: str)->bool:
red = sum(c == 'R' for c in s)
return red > N - red
if __name__ == "__main__":
N = int(eval(input()))
s = eval(input())
yes = red_or_blue(N, s)
print(('Yes' if yes else 'No'))
| def red_or_blue(N: int, s: str)->bool:
r = sum(c == 'R' for c in s)
return r > N-r
if __name__ == "__main__":
N = int(eval(input()))
s = eval(input())
yes = red_or_blue(N, s)
print(('Yes' if yes else 'No'))
| 10 | 11 | 236 | 230 | def red_or_blue(N: int, s: str) -> bool:
red = sum(c == "R" for c in s)
return red > N - red
if __name__ == "__main__":
N = int(eval(input()))
s = eval(input())
yes = red_or_blue(N, s)
print(("Yes" if yes else "No"))
| def red_or_blue(N: int, s: str) -> bool:
r = sum(c == "R" for c in s)
return r > N - r
if __name__ == "__main__":
N = int(eval(input()))
s = eval(input())
yes = red_or_blue(N, s)
print(("Yes" if yes else "No"))
| false | 9.090909 | [
"- red = sum(c == \"R\" for c in s)",
"- return red > N - red",
"+ r = sum(c == \"R\" for c in s)",
"+ return r > N - r"
] | false | 0.046701 | 0.047244 | 0.988515 | [
"s533548582",
"s486446287"
] |
u346812984 | p02899 | python | s220722277 | s441840700 | 266 | 210 | 19,456 | 13,880 | Accepted | Accepted | 21.05 | N = int(input())
A = list(map(int, input().split()))
A_sort = []
for i in range(N):
A_sort.append((i + 1, A[i]))
A_sort.sort(key=lambda x: x[1])
for i, _ in A_sort:
print(i, end=" ")
| N = int(input())
A = list(map(int, input().split()))
idx = sorted(range(1, N + 1), key=lambda x: A[x - 1])
for i in idx:
print(i, end=" ")
print("")
| 8 | 6 | 198 | 158 | N = int(input())
A = list(map(int, input().split()))
A_sort = []
for i in range(N):
A_sort.append((i + 1, A[i]))
A_sort.sort(key=lambda x: x[1])
for i, _ in A_sort:
print(i, end=" ")
| N = int(input())
A = list(map(int, input().split()))
idx = sorted(range(1, N + 1), key=lambda x: A[x - 1])
for i in idx:
print(i, end=" ")
print("")
| false | 25 | [
"-A_sort = []",
"-for i in range(N):",
"- A_sort.append((i + 1, A[i]))",
"-A_sort.sort(key=lambda x: x[1])",
"-for i, _ in A_sort:",
"+idx = sorted(range(1, N + 1), key=lambda x: A[x - 1])",
"+for i in idx:",
"+print(\"\")"
] | false | 0.039005 | 0.047819 | 0.815683 | [
"s220722277",
"s441840700"
] |
u606033239 | p03308 | python | s964894099 | s872819938 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | n = int(eval(input()))
a = list(map(int,input().split()))
s = []
for i in range(n):
for j in range(n):
s.append(a[i]-a[j])
print((max(s))) | n = int(eval(input()))
a = list(map(int,input().split()))
print((max(a)-min(a))) | 7 | 3 | 148 | 74 | n = int(eval(input()))
a = list(map(int, input().split()))
s = []
for i in range(n):
for j in range(n):
s.append(a[i] - a[j])
print((max(s)))
| n = int(eval(input()))
a = list(map(int, input().split()))
print((max(a) - min(a)))
| false | 57.142857 | [
"-s = []",
"-for i in range(n):",
"- for j in range(n):",
"- s.append(a[i] - a[j])",
"-print((max(s)))",
"+print((max(a) - min(a)))"
] | false | 0.038651 | 0.040564 | 0.95282 | [
"s964894099",
"s872819938"
] |
u620084012 | p03627 | python | s933370852 | s299522872 | 252 | 97 | 68,760 | 18,600 | Accepted | Accepted | 61.51 | from collections import Counter
N = int(eval(input()))
a = list(map(int,input().split()))
c = Counter(a)
ans = 0
s = []
for e in c:
if c[e] >= 2:
s.append(e)
if c[e] >= 4:
ans = max(ans,e*e)
s = sorted(s)
if len(s) < 2:
print((0))
else:
print((max(ans,s[-1]*s[-2])))
| from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
C = Counter(A)
T = []
F = []
for e in C:
if C[e] >= 4:
F.append(e)
if C[e] >= 2:
T.append(e)
ans = 0
for e in F:
ans = max(ans,e**2)
T = sorted(T)
if len(T) >= 2:
ans = max(ans,T[-1]... | 16 | 18 | 304 | 334 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
s = []
for e in c:
if c[e] >= 2:
s.append(e)
if c[e] >= 4:
ans = max(ans, e * e)
s = sorted(s)
if len(s) < 2:
print((0))
else:
print((max(ans, s[-1] * s[-2])))
| from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
T = []
F = []
for e in C:
if C[e] >= 4:
F.append(e)
if C[e] >= 2:
T.append(e)
ans = 0
for e in F:
ans = max(ans, e**2)
T = sorted(T)
if len(T) >= 2:
ans = max(ans, T[-1] * T[-2])
pr... | false | 11.111111 | [
"-a = list(map(int, input().split()))",
"-c = Counter(a)",
"+A = list(map(int, input().split()))",
"+C = Counter(A)",
"+T = []",
"+F = []",
"+for e in C:",
"+ if C[e] >= 4:",
"+ F.append(e)",
"+ if C[e] >= 2:",
"+ T.append(e)",
"-s = []",
"-for e in c:",
"- if c[e] >... | false | 0.097695 | 0.042049 | 2.323358 | [
"s933370852",
"s299522872"
] |
u476604182 | p04000 | python | s345994243 | s845739986 | 1,733 | 1,305 | 163,508 | 115,468 | Accepted | Accepted | 24.7 | from collections import defaultdict
H, W, N, *L = map(int, open(0).read().split())
dic = defaultdict(int)
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[(i,j)] += 1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in dic.ke... | H, W, N, *L = list(map(int, open(0).read().split()))
dic = {}
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[i*W+j] = dic.get(i*W+j,0)+1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in list(dic.keys()):
ans[dic[k]] +=... | 14 | 13 | 382 | 357 | from collections import defaultdict
H, W, N, *L = map(int, open(0).read().split())
dic = defaultdict(int)
for a, b in zip(*[iter(L)] * 2):
for i in range(a - 2, a + 1):
for j in range(b - 2, b + 1):
if 0 < i and i + 2 <= H and 0 < j and j + 2 <= W:
dic[(i, j)] += 1
ans = [0] * 1... | H, W, N, *L = list(map(int, open(0).read().split()))
dic = {}
for a, b in zip(*[iter(L)] * 2):
for i in range(a - 2, a + 1):
for j in range(b - 2, b + 1):
if 0 < i and i + 2 <= H and 0 < j and j + 2 <= W:
dic[i * W + j] = dic.get(i * W + j, 0) + 1
ans = [0] * 10
ans[0] = (W - 2) ... | false | 7.142857 | [
"-from collections import defaultdict",
"-",
"-H, W, N, *L = map(int, open(0).read().split())",
"-dic = defaultdict(int)",
"+H, W, N, *L = list(map(int, open(0).read().split()))",
"+dic = {}",
"- dic[(i, j)] += 1",
"+ dic[i * W + j] = dic.get(i * W + j, 0) + 1",
"-for k... | false | 0.044076 | 0.048266 | 0.913184 | [
"s345994243",
"s845739986"
] |
u280552586 | p02726 | python | s405769524 | s417621003 | 448 | 330 | 50,908 | 49,372 | Accepted | Accepted | 26.34 | from collections import defaultdict
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
d = defaultdict(int)
for i in range(n-1):
for j in range(i+1, n):
path = min([j-i, abs(x-i)+abs(y-j)+1, abs(x-j)+abs(y-i)+1])
d[path] += 1
for i in range(1, n):
print((d[i]))
| from collections import defaultdict
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
d = defaultdict(int)
for i in range(n-1):
for j in range(i+1, n):
path = min(j-i, abs(x-i)+abs(y-j)+1)
d[path] += 1
for i in range(1, n):
print((d[i]))
| 14 | 14 | 299 | 276 | from collections import defaultdict
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
d = defaultdict(int)
for i in range(n - 1):
for j in range(i + 1, n):
path = min([j - i, abs(x - i) + abs(y - j) + 1, abs(x - j) + abs(y - i) + 1])
d[path] += 1
for i in range(1, n):
print((d[i]))
| from collections import defaultdict
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
d = defaultdict(int)
for i in range(n - 1):
for j in range(i + 1, n):
path = min(j - i, abs(x - i) + abs(y - j) + 1)
d[path] += 1
for i in range(1, n):
print((d[i]))
| false | 0 | [
"- path = min([j - i, abs(x - i) + abs(y - j) + 1, abs(x - j) + abs(y - i) + 1])",
"+ path = min(j - i, abs(x - i) + abs(y - j) + 1)"
] | false | 0.076593 | 0.037679 | 2.032781 | [
"s405769524",
"s417621003"
] |
u028973125 | p02836 | python | s963035438 | s336699746 | 172 | 29 | 38,748 | 9,076 | Accepted | Accepted | 83.14 | #!/usr/bin/python
import sys
def solve(s):
count = 0
len_s = len(s)
l = len_s // 2
for i in range(l):
if s[i] != s[len_s -1 -i]:
count += 1
print(count)
if __name__ == '__main__':
s = sys.stdin.readline().strip()
solve(s) | import sys
S = sys.stdin.readline().strip()
ls = len(S)
ans = 0
h = ls // 2
for i in range(h):
if S[i] != S[ls - 1 - i]:
ans += 1
print(ans) | 17 | 12 | 289 | 166 | #!/usr/bin/python
import sys
def solve(s):
count = 0
len_s = len(s)
l = len_s // 2
for i in range(l):
if s[i] != s[len_s - 1 - i]:
count += 1
print(count)
if __name__ == "__main__":
s = sys.stdin.readline().strip()
solve(s)
| import sys
S = sys.stdin.readline().strip()
ls = len(S)
ans = 0
h = ls // 2
for i in range(h):
if S[i] != S[ls - 1 - i]:
ans += 1
print(ans)
| false | 29.411765 | [
"-#!/usr/bin/python",
"-",
"-def solve(s):",
"- count = 0",
"- len_s = len(s)",
"- l = len_s // 2",
"- for i in range(l):",
"- if s[i] != s[len_s - 1 - i]:",
"- count += 1",
"- print(count)",
"-",
"-",
"-if __name__ == \"__main__\":",
"- s = sys.stdin.re... | false | 0.07386 | 0.037458 | 1.971815 | [
"s963035438",
"s336699746"
] |
u136395536 | p03730 | python | s221594435 | s762952999 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A,B,C = (int(i) for i in input().split())
dekiru = False
for i in range(B):
if((A*(i+1))%B == C):
dekiru = True
if dekiru:
print("YES")
else:
print("NO") | A,B,C = (int(i) for i in input().split())
dividable = False
for i in range(B):
if A*(i+1) % B == C:
dividable = True
if dividable:
print("YES")
else:
print("NO") | 11 | 11 | 185 | 193 | A, B, C = (int(i) for i in input().split())
dekiru = False
for i in range(B):
if (A * (i + 1)) % B == C:
dekiru = True
if dekiru:
print("YES")
else:
print("NO")
| A, B, C = (int(i) for i in input().split())
dividable = False
for i in range(B):
if A * (i + 1) % B == C:
dividable = True
if dividable:
print("YES")
else:
print("NO")
| false | 0 | [
"-dekiru = False",
"+dividable = False",
"- if (A * (i + 1)) % B == C:",
"- dekiru = True",
"-if dekiru:",
"+ if A * (i + 1) % B == C:",
"+ dividable = True",
"+if dividable:"
] | false | 0.039353 | 0.045434 | 0.86615 | [
"s221594435",
"s762952999"
] |
u958506960 | p03086 | python | s504121316 | s996410237 | 31 | 25 | 9,040 | 8,992 | Accepted | Accepted | 19.35 | s = eval(input())
cnt = 0
li = []
for i in range(len(s)):
if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
cnt += 1
else:
li.append(cnt)
cnt = 0
li.append(cnt)
print((max(li))) | s = eval(input())
l = []
cnt = 0
for c in s:
if c == 'A' or c =='C' or c == 'G' or c == 'T':
cnt += 1
else:
l.append(cnt)
cnt = 0
l.append(cnt)
print((max(l))) | 13 | 12 | 226 | 195 | s = eval(input())
cnt = 0
li = []
for i in range(len(s)):
if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
cnt += 1
else:
li.append(cnt)
cnt = 0
li.append(cnt)
print((max(li)))
| s = eval(input())
l = []
cnt = 0
for c in s:
if c == "A" or c == "C" or c == "G" or c == "T":
cnt += 1
else:
l.append(cnt)
cnt = 0
l.append(cnt)
print((max(l)))
| false | 7.692308 | [
"+l = []",
"-li = []",
"-for i in range(len(s)):",
"- if s[i] == \"A\" or s[i] == \"C\" or s[i] == \"G\" or s[i] == \"T\":",
"+for c in s:",
"+ if c == \"A\" or c == \"C\" or c == \"G\" or c == \"T\":",
"- li.append(cnt)",
"+ l.append(cnt)",
"-li.append(cnt)",
"-print((max(li))... | false | 0.03692 | 0.036949 | 0.999214 | [
"s504121316",
"s996410237"
] |
u058433718 | p02398 | python | s321965053 | s701218121 | 30 | 20 | 7,676 | 5,604 | Accepted | Accepted | 33.33 | import sys
data = sys.stdin.readline().strip().split(' ')
a = int(data[0])
b = int(data[1])
c = int(data[2])
cnt = 0
for i in range(a, b+1):
if c % i == 0:
cnt += 1
print(cnt) | data = eval(input())
a, b, c = [int(i) for i in data.split()]
cnt = 0
for i in range(a, b+1):
if c % i == 0:
cnt += 1
print(cnt) | 13 | 9 | 202 | 144 | import sys
data = sys.stdin.readline().strip().split(" ")
a = int(data[0])
b = int(data[1])
c = int(data[2])
cnt = 0
for i in range(a, b + 1):
if c % i == 0:
cnt += 1
print(cnt)
| data = eval(input())
a, b, c = [int(i) for i in data.split()]
cnt = 0
for i in range(a, b + 1):
if c % i == 0:
cnt += 1
print(cnt)
| false | 30.769231 | [
"-import sys",
"-",
"-data = sys.stdin.readline().strip().split(\" \")",
"-a = int(data[0])",
"-b = int(data[1])",
"-c = int(data[2])",
"+data = eval(input())",
"+a, b, c = [int(i) for i in data.split()]"
] | false | 0.041361 | 0.042362 | 0.976372 | [
"s321965053",
"s701218121"
] |
u647766105 | p00026 | python | s247938952 | s063315454 | 20 | 10 | 4,280 | 4,280 | Accepted | Accepted | 50 | import sys
board=[[0]*10 for i in range(10)]
large=[[0,0,1,0,0],
[0,1,1,1,0],
[1,1,1,1,1],
[0,1,1,1,0],
[0,0,1,0,0],]
middle=[[0,0,0,0,0],
[0,1,1,1,0],
[0,1,1,1,0],
[0,1,1,1,0],
[0,0,0,0,0],]
small=[[0,0,0,0,0],
[0,0,1,0,0],
[0,... | import sys
board=[[0]*10 for i in range(10)]
large=[[0,0,1,0,0],
[0,1,1,1,0],
[1,1,1,1,1],
[0,1,1,1,0],
[0,0,1,0,0],]
middle=[[0,0,0,0,0],
[0,1,1,1,0],
[0,1,1,1,0],
[0,1,1,1,0],
[0,0,0,0,0],]
small=[[0,0,0,0,0],
[0,0,1,0,0],
[0,... | 34 | 34 | 783 | 783 | import sys
board = [[0] * 10 for i in range(10)]
large = [
[0, 0, 1, 0, 0],
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 1],
[0, 1, 1, 1, 0],
[0, 0, 1, 0, 0],
]
middle = [
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 1, 1, 1, 0],
[0, 1, 1, 1, 0],
[0, 0, 0, 0, 0],
]
small = [
[0, 0, 0, 0, 0],
... | import sys
board = [[0] * 10 for i in range(10)]
large = [
[0, 0, 1, 0, 0],
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 1],
[0, 1, 1, 1, 0],
[0, 0, 1, 0, 0],
]
middle = [
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 1, 1, 1, 0],
[0, 1, 1, 1, 0],
[0, 0, 0, 0, 0],
]
small = [
[0, 0, 0, 0, 0],
... | false | 0 | [
"-print(max([i for j in board for i in j]))",
"+print(max([j for i in board for j in i]))"
] | false | 0.074645 | 0.040335 | 1.850624 | [
"s247938952",
"s063315454"
] |
u033606236 | p03713 | python | s996852553 | s125227022 | 317 | 254 | 3,064 | 3,064 | Accepted | Accepted | 19.87 | h,w= list(map(int,input().split()))
ans = h*w
if h % 3 == 0 or h % 3 == 0:
print((0))
exit()
for i in range(1,w):
H1, H2= h//2, -(-h//2)
check = max(h*i,H2*(w-i),H1*(w-i))
check2 = min(h*i,H1*(w-i),H2*(w-i))
ans = min(ans,abs(check-check2))
for i in range(1,h):
w1,w2 = w//2, -(-... | h,w = list(map(int,input().split()))
ans = float("Inf")
if h % 3 == 0 or w % 3 == 0:
print((0))
exit()
for i in range(1,h):
a = (h-i)*(w//2)
b = (h-i)*-(-w//2)
ans = min(ans,abs(max(i*w,a,b)-min(i*w,a,b)))
for i in range(1,w):
a = (w-i)*(h//2)
b = (w-i)*-(-h//2)
ans = min(ans... | 17 | 14 | 457 | 365 | h, w = list(map(int, input().split()))
ans = h * w
if h % 3 == 0 or h % 3 == 0:
print((0))
exit()
for i in range(1, w):
H1, H2 = h // 2, -(-h // 2)
check = max(h * i, H2 * (w - i), H1 * (w - i))
check2 = min(h * i, H1 * (w - i), H2 * (w - i))
ans = min(ans, abs(check - check2))
for i in range(1,... | h, w = list(map(int, input().split()))
ans = float("Inf")
if h % 3 == 0 or w % 3 == 0:
print((0))
exit()
for i in range(1, h):
a = (h - i) * (w // 2)
b = (h - i) * -(-w // 2)
ans = min(ans, abs(max(i * w, a, b) - min(i * w, a, b)))
for i in range(1, w):
a = (w - i) * (h // 2)
b = (w - i) * -... | false | 17.647059 | [
"-ans = h * w",
"-if h % 3 == 0 or h % 3 == 0:",
"+ans = float(\"Inf\")",
"+if h % 3 == 0 or w % 3 == 0:",
"+for i in range(1, h):",
"+ a = (h - i) * (w // 2)",
"+ b = (h - i) * -(-w // 2)",
"+ ans = min(ans, abs(max(i * w, a, b) - min(i * w, a, b)))",
"- H1, H2 = h // 2, -(-h // 2)",
... | false | 0.361518 | 0.27627 | 1.308566 | [
"s996852553",
"s125227022"
] |
u077898957 | p03386 | python | s225025121 | s358320164 | 149 | 17 | 12,396 | 3,060 | Accepted | Accepted | 88.59 | import numpy as np
import sys
a,b,k = list(map(int,input().split()))
for i in range(k):
if i <= b-a:
print((a+i))
for i in range(k):
if k-i-1 <= b-a-k:
print((b-k+i+1))
| a,b,k=list(map(int,input().split()))
c=[0]*2*k
for i in range(k):
c[i]=min(a+i,b)
c[k+i]=max(b-i,a)
c=sorted(set(c))
for i in c:
print(i) | 9 | 9 | 191 | 152 | import numpy as np
import sys
a, b, k = list(map(int, input().split()))
for i in range(k):
if i <= b - a:
print((a + i))
for i in range(k):
if k - i - 1 <= b - a - k:
print((b - k + i + 1))
| a, b, k = list(map(int, input().split()))
c = [0] * 2 * k
for i in range(k):
c[i] = min(a + i, b)
c[k + i] = max(b - i, a)
c = sorted(set(c))
for i in c:
print(i)
| false | 0 | [
"-import numpy as np",
"-import sys",
"-",
"+c = [0] * 2 * k",
"- if i <= b - a:",
"- print((a + i))",
"-for i in range(k):",
"- if k - i - 1 <= b - a - k:",
"- print((b - k + i + 1))",
"+ c[i] = min(a + i, b)",
"+ c[k + i] = max(b - i, a)",
"+c = sorted(set(c))",
"... | false | 0.007347 | 0.039794 | 0.184614 | [
"s225025121",
"s358320164"
] |
u671060652 | p02879 | python | s080194009 | s491571804 | 164 | 64 | 38,384 | 61,852 | Accepted | Accepted | 60.98 | a, b = list(map(int, input().split()))
if a > 9 or b > 9:
print((-1))
else:
print((a*b)) | a, b = list(map(int, input().split()))
if a<=9 and b<=9:
print((a*b))
else: print((-1)) | 6 | 4 | 92 | 84 | a, b = list(map(int, input().split()))
if a > 9 or b > 9:
print((-1))
else:
print((a * b))
| a, b = list(map(int, input().split()))
if a <= 9 and b <= 9:
print((a * b))
else:
print((-1))
| false | 33.333333 | [
"-if a > 9 or b > 9:",
"+if a <= 9 and b <= 9:",
"+ print((a * b))",
"+else:",
"-else:",
"- print((a * b))"
] | false | 0.033612 | 0.135109 | 0.248774 | [
"s080194009",
"s491571804"
] |
u600402037 | p02879 | python | s052989201 | s041521181 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int, input().split()))
print((A*B if 1 <= A <= 9 and 1 <= B <= 9 else -1)) | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
print((-1 if max(A, B) >= 10 else A * B))
| 2 | 8 | 83 | 180 | A, B = list(map(int, input().split()))
print((A * B if 1 <= A <= 9 and 1 <= B <= 9 else -1))
| import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
print((-1 if max(A, B) >= 10 else A * B))
| false | 75 | [
"-A, B = list(map(int, input().split()))",
"-print((A * B if 1 <= A <= 9 and 1 <= B <= 9 else -1))",
"+import sys",
"+",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir = lambda: int(sr())",
"+lr = lambda: list(map(int, sr().split()))",
"+A, B = lr()",
"+print((-1 if max(A, B) >= 10 else A * B))... | false | 0.061158 | 0.062653 | 0.976135 | [
"s052989201",
"s041521181"
] |
u729133443 | p03228 | python | s229015603 | s896783806 | 231 | 17 | 38,384 | 3,060 | Accepted | Accepted | 92.64 | a,b,k=list(map(int,input().split()))
c=0
while True:
if a%2:a-=1
b+=a//2
a//=2
c+=1
if c==k:break
if b%2:b-=1
a+=b//2
b//=2
c+=1
if c==k:break
print((a,b)) | a,b,k=list(map(int,input().split()))
for i in range(k):
if i%2<1:b+=a//2;a//=2
else:a+=b//2;b//=2
print((a,b)) | 14 | 5 | 200 | 108 | a, b, k = list(map(int, input().split()))
c = 0
while True:
if a % 2:
a -= 1
b += a // 2
a //= 2
c += 1
if c == k:
break
if b % 2:
b -= 1
a += b // 2
b //= 2
c += 1
if c == k:
break
print((a, b))
| a, b, k = list(map(int, input().split()))
for i in range(k):
if i % 2 < 1:
b += a // 2
a //= 2
else:
a += b // 2
b //= 2
print((a, b))
| false | 64.285714 | [
"-c = 0",
"-while True:",
"- if a % 2:",
"- a -= 1",
"- b += a // 2",
"- a //= 2",
"- c += 1",
"- if c == k:",
"- break",
"- if b % 2:",
"- b -= 1",
"- a += b // 2",
"- b //= 2",
"- c += 1",
"- if c == k:",
"- break",
"+for i ... | false | 0.177585 | 0.036173 | 4.909342 | [
"s229015603",
"s896783806"
] |
u707500405 | p04049 | python | s769783107 | s500823206 | 1,942 | 1,152 | 3,696 | 99,228 | Accepted | Accepted | 40.68 | from collections import deque
def rad_reach(bfr,h,rest,E):
cnt = 0
Q = deque([(bfr,h,rest)])
while Q:
cnt += 1
bfr,h,rest = Q.popleft()
if rest > 0:
for nxt in E[h]:
if nxt == bfr:
continue
Q.append((h,nxt,rest-1))
return cnt
def solve():
N,K = list(map(int,input().split()))
p... | from sys import setrecursionlimit
setrecursionlimit(100000)
def rad_reach(b,h,dist,E,rad):
cnt = 1
if dist < rad:
for nxt in E[h]:
if nxt == b:
continue
cnt += rad_reach(h,nxt,dist+1,E,rad)
return cnt
def solve():
N,K = list(map(int,input().split()))
pairs = []
E = [[] for i in range(N)]... | 32 | 29 | 722 | 684 | from collections import deque
def rad_reach(bfr, h, rest, E):
cnt = 0
Q = deque([(bfr, h, rest)])
while Q:
cnt += 1
bfr, h, rest = Q.popleft()
if rest > 0:
for nxt in E[h]:
if nxt == bfr:
continue
Q.append((h, nxt, res... | from sys import setrecursionlimit
setrecursionlimit(100000)
def rad_reach(b, h, dist, E, rad):
cnt = 1
if dist < rad:
for nxt in E[h]:
if nxt == b:
continue
cnt += rad_reach(h, nxt, dist + 1, E, rad)
return cnt
def solve():
N, K = list(map(int, input(... | false | 9.375 | [
"-from collections import deque",
"+from sys import setrecursionlimit",
"+",
"+setrecursionlimit(100000)",
"-def rad_reach(bfr, h, rest, E):",
"- cnt = 0",
"- Q = deque([(bfr, h, rest)])",
"- while Q:",
"- cnt += 1",
"- bfr, h, rest = Q.popleft()",
"- if rest > 0:",... | false | 0.083159 | 0.071942 | 1.155913 | [
"s769783107",
"s500823206"
] |
u057964173 | p03433 | python | s436709756 | s220373791 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
def main():
n=int(eval(input()))
a=int(eval(input()))
for i in range(21):
for j in range(a+1):
if 500*i+1*j==n:
return 'Yes'
return 'No'
print((... | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(eval(input()))
a=int(eval(input()))
if n%500>a:
print('No')
else:
print('Yes')
resolve() | 14 | 11 | 325 | 200 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
def main():
n = int(eval(input()))
a = int(eval(input()))
for i in range(21):
for j in range(a + 1):
if 500 * i + 1 * j == n:
return "Yes"
return "No"
... | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n = int(eval(input()))
a = int(eval(input()))
if n % 500 > a:
print("No")
else:
print("Yes")
resolve()
| false | 21.428571 | [
"- def main():",
"- n = int(eval(input()))",
"- a = int(eval(input()))",
"- for i in range(21):",
"- for j in range(a + 1):",
"- if 500 * i + 1 * j == n:",
"- return \"Yes\"",
"- return \"No\"",
"-",
"- print((main()))"... | false | 0.051409 | 0.050588 | 1.016236 | [
"s436709756",
"s220373791"
] |
u780962115 | p03030 | python | s986136596 | s208786629 | 25 | 22 | 9,108 | 9,084 | Accepted | Accepted | 12 | N=int(eval(input()))
que=[]
for i in range(N):
s,p=list(input().split())
que.append((s,int(p),i+1))
que.sort(key=lambda x:(x[0],-x[1]))
for x in que:
print((x[-1])) | N,que=int(eval(input())),[]
for i in range(N):
s,p=list(input().split())
que.append((s,-int(p),i+1))
que.sort()
for x in que:
print((x[-1])) | 8 | 7 | 175 | 150 | N = int(eval(input()))
que = []
for i in range(N):
s, p = list(input().split())
que.append((s, int(p), i + 1))
que.sort(key=lambda x: (x[0], -x[1]))
for x in que:
print((x[-1]))
| N, que = int(eval(input())), []
for i in range(N):
s, p = list(input().split())
que.append((s, -int(p), i + 1))
que.sort()
for x in que:
print((x[-1]))
| false | 12.5 | [
"-N = int(eval(input()))",
"-que = []",
"+N, que = int(eval(input())), []",
"- que.append((s, int(p), i + 1))",
"-que.sort(key=lambda x: (x[0], -x[1]))",
"+ que.append((s, -int(p), i + 1))",
"+que.sort()"
] | false | 0.05728 | 0.058193 | 0.984308 | [
"s986136596",
"s208786629"
] |
u864197622 | p03112 | python | s352770184 | s376207749 | 1,446 | 1,226 | 12,800 | 14,100 | Accepted | Accepted | 15.21 | from bisect import bisect_left as bl
def I(a): return [-1<<50] + [int(eval(input())) for i in range(a)] + [1<<50]
A, B, Q = list(map(int, input().split()))
S, T = I(A), I(B)
for _ in range(Q):
x = int(eval(input()))
k, l = bl(S, x), bl(T, x)
a, b, c, d = x-S[k-1], x-T[l-1], S[k]-x, T[l]-x
prin... | import sys
from bisect import bisect_left as bl
def I(a): return [-1<<50] + [int(sys.stdin.readline()) for i in range(a)] + [1<<50]
A, B, Q = list(map(int, input().split()))
S, T = I(A), I(B)
for _ in range(Q):
x = int(eval(input()))
k, l = bl(S, x), bl(T, x)
a, b, c, d = x-S[k-1], x-T[l-1], S[k]-... | 10 | 11 | 358 | 383 | from bisect import bisect_left as bl
def I(a):
return [-1 << 50] + [int(eval(input())) for i in range(a)] + [1 << 50]
A, B, Q = list(map(int, input().split()))
S, T = I(A), I(B)
for _ in range(Q):
x = int(eval(input()))
k, l = bl(S, x), bl(T, x)
a, b, c, d = x - S[k - 1], x - T[l - 1], S[k] - x, T[l... | import sys
from bisect import bisect_left as bl
def I(a):
return [-1 << 50] + [int(sys.stdin.readline()) for i in range(a)] + [1 << 50]
A, B, Q = list(map(int, input().split()))
S, T = I(A), I(B)
for _ in range(Q):
x = int(eval(input()))
k, l = bl(S, x), bl(T, x)
a, b, c, d = x - S[k - 1], x - T[l -... | false | 9.090909 | [
"+import sys",
"- return [-1 << 50] + [int(eval(input())) for i in range(a)] + [1 << 50]",
"+ return [-1 << 50] + [int(sys.stdin.readline()) for i in range(a)] + [1 << 50]"
] | false | 0.036045 | 0.042713 | 0.843875 | [
"s352770184",
"s376207749"
] |
u941644149 | p02681 | python | s414961020 | s276693144 | 24 | 20 | 9,044 | 9,084 | Accepted | Accepted | 16.67 | S = eval(input())
T = eval(input())
flag=0
if len(S)+1 == len(T):
if S == T[:-1]:
flag=1
if flag==1:
print("Yes")
else:
print("No") | S = eval(input())
T = eval(input())
flag=0
#if len(S)+1 == len(T):
if S == T[:-1]:
flag=1
if flag==1:
print("Yes")
else:
print("No") | 13 | 13 | 166 | 159 | S = eval(input())
T = eval(input())
flag = 0
if len(S) + 1 == len(T):
if S == T[:-1]:
flag = 1
if flag == 1:
print("Yes")
else:
print("No")
| S = eval(input())
T = eval(input())
flag = 0
# if len(S)+1 == len(T):
if S == T[:-1]:
flag = 1
if flag == 1:
print("Yes")
else:
print("No")
| false | 0 | [
"-if len(S) + 1 == len(T):",
"- if S == T[:-1]:",
"- flag = 1",
"+# if len(S)+1 == len(T):",
"+if S == T[:-1]:",
"+ flag = 1"
] | false | 0.043063 | 0.043773 | 0.98378 | [
"s414961020",
"s276693144"
] |
u827202523 | p03634 | python | s020154698 | s903836416 | 634 | 410 | 74,800 | 114,936 | Accepted | Accepted | 35.33 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
n = getN()
vtxs = [[] for i in range(n)]
dist = [0 for i in range(n)]
visit = [0 for i in ran... | import sys
# from collections import defaultdict, deque
import math
# import copy
# from bisect import bisect_left, bisect_right
import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: li... | 39 | 63 | 829 | 1,387 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
n = getN()
vtxs = [[] for i in range(n)]
dist = [0 for i in range(n)]
visit = [0 for i in range(n)]
f... | import sys
# from collections import defaultdict, deque
import math
# import copy
# from bisect import bisect_left, bisect_right
import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, in... | false | 38.095238 | [
"+# from collections import defaultdict, deque",
"+import math",
"+",
"+# import copy",
"+# from bisect import bisect_left, bisect_right",
"+import heapq",
"+",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"-sys.setrecursionlimit(1000000)",
"-from collections import deque",
"+getS ... | false | 0.051119 | 0.059749 | 0.85556 | [
"s020154698",
"s903836416"
] |
u404676457 | p03651 | python | s412561866 | s547645478 | 114 | 101 | 14,508 | 14,252 | Accepted | Accepted | 11.4 | import sys
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
if a[-1] < k:
print('IMPOSSIBLE')
sys.exit(0)
seta = set(a)
if k in seta:
print('POSSIBLE')
sys.exit(0)
def gojoho(l, s):
return s if l % s == 0 else gojoho(s, l % s)
koubaisu = gojoho(a... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
def f(l, s):
return s if l % s == 0 else f(s, l % s)
z = f(a[-1], a[0])
for i in a:
z = f(i, z)
if a[-1] >= k and k % z == 0:
print('POSSIBLE')
else:
print('IMPOSSIBLE') | 24 | 14 | 453 | 278 | import sys
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
if a[-1] < k:
print("IMPOSSIBLE")
sys.exit(0)
seta = set(a)
if k in seta:
print("POSSIBLE")
sys.exit(0)
def gojoho(l, s):
return s if l % s == 0 else gojoho(s, l % s)
koubaisu = gojoho(a[1], a[0])
for... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
def f(l, s):
return s if l % s == 0 else f(s, l % s)
z = f(a[-1], a[0])
for i in a:
z = f(i, z)
if a[-1] >= k and k % z == 0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 41.666667 | [
"-import sys",
"-",
"-if a[-1] < k:",
"- print(\"IMPOSSIBLE\")",
"- sys.exit(0)",
"-seta = set(a)",
"-if k in seta:",
"- print(\"POSSIBLE\")",
"- sys.exit(0)",
"-def gojoho(l, s):",
"- return s if l % s == 0 else gojoho(s, l % s)",
"+def f(l, s):",
"+ return s if l % s == 0... | false | 0.132669 | 0.039082 | 3.394654 | [
"s412561866",
"s547645478"
] |
u699296734 | p03835 | python | s423998375 | s193338767 | 600 | 29 | 9,176 | 8,996 | Accepted | Accepted | 95.17 | k, s = list(map(int, input().split()))
counter = 0
for x in range(k + 1):
for y in range(x, k + 1):
z = s - x - y
if y <= z <= k:
if x == y == z:
counter += 1
elif x == y or y == z:
counter += 3
else:
coun... | k, s = list(map(int, input().split()))
counter = 0
for i in range(k + 1):
counter += max(min(k, s - i) - max(0, s - k - i) + 1, 0)
print(counter)
| 14 | 6 | 341 | 150 | k, s = list(map(int, input().split()))
counter = 0
for x in range(k + 1):
for y in range(x, k + 1):
z = s - x - y
if y <= z <= k:
if x == y == z:
counter += 1
elif x == y or y == z:
counter += 3
else:
counter += 6
pr... | k, s = list(map(int, input().split()))
counter = 0
for i in range(k + 1):
counter += max(min(k, s - i) - max(0, s - k - i) + 1, 0)
print(counter)
| false | 57.142857 | [
"-for x in range(k + 1):",
"- for y in range(x, k + 1):",
"- z = s - x - y",
"- if y <= z <= k:",
"- if x == y == z:",
"- counter += 1",
"- elif x == y or y == z:",
"- counter += 3",
"- else:",
"- counte... | false | 0.035897 | 0.03454 | 1.039287 | [
"s423998375",
"s193338767"
] |
u504836877 | p03044 | python | s766560277 | s908554685 | 809 | 690 | 83,232 | 39,292 | Accepted | Accepted | 14.71 | from collections import deque
N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
edge[u-1].append([v-1, w])
edge[v-1].append([u-1, w])
d = [0]*(N)
q = deque()
q.append([0, 0])
visited = [0]*(N)
while q:
temp = q.pop()... | from collections import deque
N = int(eval(input()))
E = [[] for _ in range(N)]
for _ in range(N-1):
u,v,w = list(map(int, input().split()))
E[u-1].append((v-1, w))
E[v-1].append((u-1, w))
ans = [-1]*N
ans[0] = 0
q = deque()
q.append((0, 0))
while q:
temp = q.popleft()
u = temp[0]
... | 24 | 27 | 530 | 554 | from collections import deque
N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
edge[u - 1].append([v - 1, w])
edge[v - 1].append([u - 1, w])
d = [0] * (N)
q = deque()
q.append([0, 0])
visited = [0] * (N)
while q:
temp = q.pop()
fo... | from collections import deque
N = int(eval(input()))
E = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
E[u - 1].append((v - 1, w))
E[v - 1].append((u - 1, w))
ans = [-1] * N
ans[0] = 0
q = deque()
q.append((0, 0))
while q:
temp = q.popleft()
u = temp[0]
... | false | 11.111111 | [
"-edge = [[] for _ in range(N)]",
"+E = [[] for _ in range(N)]",
"- edge[u - 1].append([v - 1, w])",
"- edge[v - 1].append([u - 1, w])",
"-d = [0] * (N)",
"+ E[u - 1].append((v - 1, w))",
"+ E[v - 1].append((u - 1, w))",
"+ans = [-1] * N",
"+ans[0] = 0",
"-q.append([0, 0])",
"-visite... | false | 0.038879 | 0.038659 | 1.005682 | [
"s766560277",
"s908554685"
] |
u753803401 | p02841 | python | s670787575 | s481885891 | 190 | 169 | 38,384 | 38,256 | Accepted | Accepted | 11.05 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
m1, d1 = list(map(int, readline().split()))
m2, d2 = list(map(int, readline().split()))
print((1 if m1 != m2 and m1 < m2 else 0))
if __name__ == '__main__':
solve()
| import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
m, d = list(map(int, input().rstrip('\n').split()))
m, d = list(map(int, input().rstrip('\n').split()))
print((1 if d == 1 else 0))
if __name__ == '__main__':
solve()
| 13 | 13 | 282 | 274 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
m1, d1 = list(map(int, readline().split()))
m2, d2 = list(map(int, readline().split()))
print((1 if m1 != m2 and m1 < m2 else 0))
if __name__ == "__main__":
solve()
| import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
m, d = list(map(int, input().rstrip("\n").split()))
m, d = list(map(int, input().rstrip("\n").split()))
print((1 if d == 1 else 0))
if __name__ == "__main__":
solve()
| false | 0 | [
"- readline = sys.stdin.buffer.readline",
"+ input = sys.stdin.readline",
"- m1, d1 = list(map(int, readline().split()))",
"- m2, d2 = list(map(int, readline().split()))",
"- print((1 if m1 != m2 and m1 < m2 else 0))",
"+ m, d = list(map(int, input().rstrip(\"\\n\").split()))",
"+ m... | false | 0.048274 | 0.048042 | 1.004838 | [
"s670787575",
"s481885891"
] |
u562935282 | p03176 | python | s816422927 | s079589527 | 1,859 | 1,527 | 126,588 | 128,636 | Accepted | Accepted | 17.86 | class SegmentTree:
def __init__(self, a: list, e: 'default', f: 'function'):
n = len(a)
size = 1 << (n - 1).bit_length() # 元の配列サイズ以上の最小の二冪 == 最下段
v = [e] * (size * 2 - 1)
for i in range(n):
# size-1個の上段の次、size個目からn個が元の配列の代入位置
v[size - 1 + i] = a[i]
... | class SegmentTree:
def __init__(self, a: list, e: 'default' = 0, f: 'function' = max):
size = len(a)
n = 1 << (size - 1).bit_length()
seg = [e] * (n * 2 - 1)
for i, a_ in enumerate(a, n - 1):
seg[i] = a_
for i in range(n - 2, -1, -1):
seg[i] = ... | 66 | 54 | 1,889 | 1,420 | class SegmentTree:
def __init__(self, a: list, e: "default", f: "function"):
n = len(a)
size = 1 << (n - 1).bit_length() # 元の配列サイズ以上の最小の二冪 == 最下段
v = [e] * (size * 2 - 1)
for i in range(n):
# size-1個の上段の次、size個目からn個が元の配列の代入位置
v[size - 1 + i] = a[i]
fo... | class SegmentTree:
def __init__(self, a: list, e: "default" = 0, f: "function" = max):
size = len(a)
n = 1 << (size - 1).bit_length()
seg = [e] * (n * 2 - 1)
for i, a_ in enumerate(a, n - 1):
seg[i] = a_
for i in range(n - 2, -1, -1):
seg[i] = f(seg[i ... | false | 18.181818 | [
"- def __init__(self, a: list, e: \"default\", f: \"function\"):",
"- n = len(a)",
"- size = 1 << (n - 1).bit_length() # 元の配列サイズ以上の最小の二冪 == 最下段",
"- v = [e] * (size * 2 - 1)",
"- for i in range(n):",
"- # size-1個の上段の次、size個目からn個が元の配列の代入位置",
"- v[size... | false | 0.115193 | 0.037639 | 3.060456 | [
"s816422927",
"s079589527"
] |
u075012704 | p03660 | python | s639382348 | s615865678 | 1,101 | 928 | 54,944 | 48,004 | Accepted | Accepted | 15.71 | import heapq
N = int(eval(input()))
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
T[a].append([b, 1])
T[b].append([a, 1])
def dijkstra(x):
d = [float('inf')] * N
d[x] = 0
visited = {x}
# d, u
hq = [(0, ... | import sys
sys.setrecursionlimit(10 ** 9)
N = int(eval(input()))
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
T[a].append([b, 1])
T[b].append([a, 1])
def dfs(n):
dist = [-1] * N
dist[n] = 0
stack = [n]
w... | 34 | 38 | 773 | 693 | import heapq
N = int(eval(input()))
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
T[a].append([b, 1])
T[b].append([a, 1])
def dijkstra(x):
d = [float("inf")] * N
d[x] = 0
visited = {x}
# d, u
hq = [(0, x)]
while hq... | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
T[a].append([b, 1])
T[b].append([a, 1])
def dfs(n):
dist = [-1] * N
dist[n] = 0
stack = [n]
while stack:
... | false | 10.526316 | [
"-import heapq",
"+import sys",
"+sys.setrecursionlimit(10**9)",
"-def dijkstra(x):",
"- d = [float(\"inf\")] * N",
"- d[x] = 0",
"- visited = {x}",
"- # d, u",
"- hq = [(0, x)]",
"- while hq:",
"- u = heapq.heappop(hq)[1]",
"- visited.add(u)",
"- for n... | false | 0.039293 | 0.037088 | 1.059466 | [
"s639382348",
"s615865678"
] |
u995004106 | p02781 | python | s937975107 | s377123630 | 162 | 75 | 13,892 | 63,164 | Accepted | Accepted | 53.7 |
import numpy as np
N=eval(input())
K=eval(input())
dp=np.zeros((len(str(N))+10,len(str(N))+10,2))
dp=dp.tolist()
x0=int(N[0])
dp[0][0][0]=1
for i in range(0,len(N),1):
for j in range(0,4,1):
for k in range(0,2,1):
nd=int(N[i])
for d in range(0,10,1):
... | N=list(eval(input()))
K=int(eval(input()))
N=list(map(int,N))
#print(N)
dp=[[[0 for _ in range(4)] for _ in range(len(N))] for _ in range(2)]
for i in range(len(N)):
num=N[i]
mayover=0
if i==0:
for j in range(10):
if j<num:
if j==0:
dp[0][i... | 30 | 48 | 678 | 1,398 | import numpy as np
N = eval(input())
K = eval(input())
dp = np.zeros((len(str(N)) + 10, len(str(N)) + 10, 2))
dp = dp.tolist()
x0 = int(N[0])
dp[0][0][0] = 1
for i in range(0, len(N), 1):
for j in range(0, 4, 1):
for k in range(0, 2, 1):
nd = int(N[i])
for d in range(0, 10, 1):
... | N = list(eval(input()))
K = int(eval(input()))
N = list(map(int, N))
# print(N)
dp = [[[0 for _ in range(4)] for _ in range(len(N))] for _ in range(2)]
for i in range(len(N)):
num = N[i]
mayover = 0
if i == 0:
for j in range(10):
if j < num:
if j == 0:
... | false | 37.5 | [
"-import numpy as np",
"-",
"-N = eval(input())",
"-K = eval(input())",
"-dp = np.zeros((len(str(N)) + 10, len(str(N)) + 10, 2))",
"-dp = dp.tolist()",
"-x0 = int(N[0])",
"-dp[0][0][0] = 1",
"-for i in range(0, len(N), 1):",
"- for j in range(0, 4, 1):",
"- for k in range(0, 2, 1):",
... | false | 0.214727 | 0.036085 | 5.950529 | [
"s937975107",
"s377123630"
] |
u941753895 | p04045 | python | s770910996 | s565993882 | 116 | 72 | 6,432 | 6,304 | Accepted | Accepted | 37.93 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,k=... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,k=... | 29 | 32 | 528 | 540 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 9.375 | [
"- l = LI()",
"- a = 0",
"+ l = LS()",
"+ ans = 1",
"- a += 1",
"- if a >= n:",
"+ if ans >= n:",
"+ s = str(ans)",
"- for x in list(str(a)):",
"- if int(x) in l:",
"+ for x in s:",
"+ if x in l:",
... | false | 0.045598 | 0.056968 | 0.800412 | [
"s770910996",
"s565993882"
] |
u075012704 | p02716 | python | s099005361 | s114197134 | 1,320 | 929 | 300,300 | 189,984 | Accepted | Accepted | 29.62 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
# dp[(i, x, flg)] := i番目までみてx個選んでいる時の最大値。flgは最後の1つをとったかどうか。
dp = defaultdict(lambda: -float('inf'))
dp[(0, 0, 0)] = 0
for i, a in enumerate(A, start=1):
j = i // 2
for x in range(j - 1, j + 2):
dp... | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
# dp[(i, x, flg)] := i番目までみてx個選んでいる時の最大値。flgは最後の1つをとったかどうか。
dp = defaultdict(lambda: -float('inf'))
dp[(0, 0, 0)] = 0
for i, a in enumerate(A, start=1):
for x in range((i - 1) // 2, (i + 1) // 2 + 1):
... | 15 | 14 | 475 | 477 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
# dp[(i, x, flg)] := i番目までみてx個選んでいる時の最大値。flgは最後の1つをとったかどうか。
dp = defaultdict(lambda: -float("inf"))
dp[(0, 0, 0)] = 0
for i, a in enumerate(A, start=1):
j = i // 2
for x in range(j - 1, j + 2):
dp[(i, x, 0)] ... | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
# dp[(i, x, flg)] := i番目までみてx個選んでいる時の最大値。flgは最後の1つをとったかどうか。
dp = defaultdict(lambda: -float("inf"))
dp[(0, 0, 0)] = 0
for i, a in enumerate(A, start=1):
for x in range((i - 1) // 2, (i + 1) // 2 + 1):
dp[(i, x, 0... | false | 6.666667 | [
"- j = i // 2",
"- for x in range(j - 1, j + 2):",
"+ for x in range((i - 1) // 2, (i + 1) // 2 + 1):"
] | false | 0.038255 | 0.040942 | 0.934375 | [
"s099005361",
"s114197134"
] |
u200887663 | p03371 | python | s973354232 | s185942464 | 125 | 95 | 2,940 | 9,188 | Accepted | Accepted | 24 | #n=int(input())
a,b,c,x,y=list(map(int,input().split()))
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(m)]
ans=a*x+b*y
for z in range(0,max(x,y)+1):
ans=min(ans,2*z*c+max(x-z,0)*a+max(y-z,0)*b)
print(ans)
| #n=int(input())
A,B,C,X,Y=list(map(int,input().split()))
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mn=A*X+B*Y
for i in range(max(X,Y)+1):
mn=min(mn,2*i*C+A*max(0,X-i)+B*max(0,Y-i))
print(mn) | 11 | 9 | 255 | 244 | # n=int(input())
a, b, c, x, y = list(map(int, input().split()))
# al=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(m)]
ans = a * x + b * y
for z in range(0, max(x, y) + 1):
ans = min(ans, 2 * z * c + max(x - z, 0) * a + max(y - z, 0) * b)
print(ans)
| # n=int(input())
A, B, C, X, Y = list(map(int, input().split()))
# hl=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mn = A * X + B * Y
for i in range(max(X, Y) + 1):
mn = min(mn, 2 * i * C + A * max(0, X - i) + B * max(0, Y - i))
print(mn)
| false | 18.181818 | [
"-a, b, c, x, y = list(map(int, input().split()))",
"-# al=list(map(int,input().split()))",
"-# l=[list(map(int,input().split())) for i in range(m)]",
"-ans = a * x + b * y",
"-for z in range(0, max(x, y) + 1):",
"- ans = min(ans, 2 * z * c + max(x - z, 0) * a + max(y - z, 0) * b)",
"-print(ans)",
... | false | 0.146622 | 0.05385 | 2.722782 | [
"s973354232",
"s185942464"
] |
u498487134 | p03037 | python | s814096460 | s917277389 | 555 | 105 | 44,264 | 74,600 | Accepted | Accepted | 81.08 | N,M=list(map(int,input().split()))
Lmax=1
Rmin=N
for i in range(M):
L,R=list(map(int,input().split()))
Lmax=max(Lmax,L)
Rmin=min(Rmin,R)
print((max(Rmin-Lmax+1,0))) | import sys
input = sys.stdin.readline
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
N,M=MI()
L=[0]*(N+1)
for _ in range(M):
l,r=MI()
l-=1
r-=1
L... | 9 | 31 | 175 | 528 | N, M = list(map(int, input().split()))
Lmax = 1
Rmin = N
for i in range(M):
L, R = list(map(int, input().split()))
Lmax = max(Lmax, L)
Rmin = min(Rmin, R)
print((max(Rmin - Lmax + 1, 0)))
| import sys
input = sys.stdin.readline
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
N, M = MI()
L = [0] * (N + 1)
for _ in range(M):
l, r = MI()
l -= 1
... | false | 70.967742 | [
"-N, M = list(map(int, input().split()))",
"-Lmax = 1",
"-Rmin = N",
"-for i in range(M):",
"- L, R = list(map(int, input().split()))",
"- Lmax = max(Lmax, L)",
"- Rmin = min(Rmin, R)",
"-print((max(Rmin - Lmax + 1, 0)))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",... | false | 0.066285 | 0.041513 | 1.596749 | [
"s814096460",
"s917277389"
] |
u564902833 | p03000 | python | s524638857 | s817417874 | 210 | 17 | 38,384 | 3,060 | Accepted | Accepted | 91.9 | N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
x = 0
ans = 1
for l in L:
x += l
if x <= X:
ans += 1
print(ans)
| from itertools import accumulate
# 入力
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = sum(acc <= X for acc in accumulate(L)) + 1
# 出力
print(ans)
| 12 | 10 | 163 | 184 | N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
x = 0
ans = 1
for l in L:
x += l
if x <= X:
ans += 1
print(ans)
| from itertools import accumulate
# 入力
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = sum(acc <= X for acc in accumulate(L)) + 1
# 出力
print(ans)
| false | 16.666667 | [
"+from itertools import accumulate",
"+",
"+# 入力",
"-x = 0",
"-ans = 1",
"-for l in L:",
"- x += l",
"- if x <= X:",
"- ans += 1",
"+ans = sum(acc <= X for acc in accumulate(L)) + 1",
"+# 出力"
] | false | 0.077137 | 0.047044 | 1.639678 | [
"s524638857",
"s817417874"
] |
u285891772 | p02732 | python | s958696435 | s003256509 | 325 | 219 | 27,196 | 35,012 | Accepted | Accepted | 32.62 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
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, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 37 | 34 | 1,132 | 1,130 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
product,
groupby,
)
from operator import itemgetter, mu... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 8.108108 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2",
"+from math import (",
"+ ceil,",
"+ sqrt,",
"+ hypot,",
"+ factorial,",
"+ pi,",
"+ sin,",
"+ cos,",
"+ tan,",
"+ asin,",
"+ acos,",
"+ atan,",
"+ radians,",
"+ degr... | false | 0.065131 | 0.062168 | 1.047665 | [
"s958696435",
"s003256509"
] |
u389910364 | p03356 | python | s841275812 | s488133323 | 1,171 | 632 | 50,524 | 95,128 | Accepted | Accepted | 46.03 | import sys
sys.setrecursionlimit(10000)
INF = float('inf')
class WeightedUnionFind:
def __init__(self, nodes):
"""
:param collections.Iterable nodes:
"""
self._parents = {k: k for k in nodes}
self._ranks = {k: 0 for k in nodes}
self._sizes = {k: 1 for ... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
class UnionFind:
def __init__(self, size=None, nodes=None):
"""
size か nodes どっちか指定。
n... | 107 | 85 | 2,554 | 2,170 | import sys
sys.setrecursionlimit(10000)
INF = float("inf")
class WeightedUnionFind:
def __init__(self, nodes):
"""
:param collections.Iterable nodes:
"""
self._parents = {k: k for k in nodes}
self._ranks = {k: 0 for k in nodes}
self._sizes = {k: 1 for k in nodes}
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
class UnionFind:
def __init__(self, size=None, nodes=None):
"""
size か nodes どっちか指定。
nodes は set、size は list を使う。
... | false | 20.560748 | [
"+import os",
"-sys.setrecursionlimit(10000)",
"+if os.getenv(\"LOCAL\"):",
"+ sys.stdin = open(\"_in.txt\", \"r\")",
"+sys.setrecursionlimit(10**9)",
"-",
"-",
"-class WeightedUnionFind:",
"- def __init__(self, nodes):",
"+IINF = 10**18",
"+MOD = 10**9 + 7",
"+# MOD = 998244353",
"+cl... | false | 0.168907 | 0.084846 | 1.99075 | [
"s841275812",
"s488133323"
] |
u168578024 | p03061 | python | s361836968 | s859772450 | 512 | 468 | 60,528 | 60,528 | Accepted | Accepted | 8.59 | import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2**(N-1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] =... | import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2**(N-1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] =... | 65 | 63 | 1,563 | 1,515 | import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2 ** (N - 1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] = x
... | import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2 ** (N - 1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] = x
... | false | 3.076923 | [
"- if a >= b:",
"- return self.I"
] | false | 0.041128 | 0.04147 | 0.991755 | [
"s361836968",
"s859772450"
] |
u552738814 | p04044 | python | s785296573 | s288333719 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | n,l = map(int,input().split())
list = []
for i in range(n):
list.append("{}".format(input()))
list.sort()
for i2 in range(n):
print(list[i2],end="")
| n = input().split()
word_list = []
for i in range(int(n[0])):
word_list.append(eval(input()))
sorted_list = sorted(word_list)
answer = "".join(sorted_list)
print(answer) | 11 | 10 | 170 | 179 | n, l = map(int, input().split())
list = []
for i in range(n):
list.append("{}".format(input()))
list.sort()
for i2 in range(n):
print(list[i2], end="")
| n = input().split()
word_list = []
for i in range(int(n[0])):
word_list.append(eval(input()))
sorted_list = sorted(word_list)
answer = "".join(sorted_list)
print(answer)
| false | 9.090909 | [
"-n, l = map(int, input().split())",
"-list = []",
"-for i in range(n):",
"- list.append(\"{}\".format(input()))",
"-list.sort()",
"-for i2 in range(n):",
"- print(list[i2], end=\"\")",
"+n = input().split()",
"+word_list = []",
"+for i in range(int(n[0])):",
"+ word_list.append(eval(in... | false | 0.045832 | 0.046236 | 0.991278 | [
"s785296573",
"s288333719"
] |
u191874006 | p02836 | python | s451545388 | s191982900 | 176 | 70 | 38,256 | 65,580 | Accepted | Accepted | 60.23 | #!/usr/bin/env python3
#ABC147 B
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Count... | #!/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... | 30 | 26 | 712 | 673 | #!/usr/bin/env python3
# ABC147 B
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from c... | #!/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 | 13.333333 | [
"-# ABC147 B",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-t = s[: n // 2]",
"-u = s[n // 2 :][::-1]",
"- if t[i] != u[i]:",
"+ if s[i] != s[-(i + 1)]:"
] | false | 0.047533 | 0.038652 | 1.229784 | [
"s451545388",
"s191982900"
] |
u864197622 | p03855 | python | s739646123 | s248426538 | 1,131 | 627 | 46,528 | 111,944 | Accepted | Accepted | 44.56 | def col(n, m):
X = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
X[a-1].append(b-1)
X[b-1].append(a-1)
C = [-1] * n
c = 0
for i in range(N):
if C[i] >= 0: continue
Q = [i]
C[i] = c
while Q:
... | import sys
input = sys.stdin.readline
def col(n, m):
X = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
X[a-1].append(b-1)
X[b-1].append(a-1)
C = [-1] * n
c = 0
for i in range(N):
if C[i] >= 0: continue
Q = [i]
... | 31 | 33 | 703 | 743 | def col(n, m):
X = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
X[a - 1].append(b - 1)
X[b - 1].append(a - 1)
C = [-1] * n
c = 0
for i in range(N):
if C[i] >= 0:
continue
Q = [i]
C[i] = c
while Q:... | import sys
input = sys.stdin.readline
def col(n, m):
X = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
X[a - 1].append(b - 1)
X[b - 1].append(a - 1)
C = [-1] * n
c = 0
for i in range(N):
if C[i] >= 0:
continue
... | false | 6.060606 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.040193 | 0.115452 | 0.348139 | [
"s739646123",
"s248426538"
] |
u021019433 | p02555 | python | s081371646 | s605424956 | 32 | 27 | 9,204 | 9,120 | Accepted | Accepted | 15.62 | s = int(eval(input()))
a = [None, 0, 0] + [1] * (s - 2)
for i in range(3, s - 2):
a[i + 3] += a[i]
a[i + 1] += a[i]
print((a[s] % (10**9 + 7)))
| s = int(eval(input()))
a = b = 0; c = int(s > 2)
for _ in range(s - 3):
a, b, c = b, c, (a + c) % (10**9 + 7)
print(c)
| 6 | 5 | 145 | 119 | s = int(eval(input()))
a = [None, 0, 0] + [1] * (s - 2)
for i in range(3, s - 2):
a[i + 3] += a[i]
a[i + 1] += a[i]
print((a[s] % (10**9 + 7)))
| s = int(eval(input()))
a = b = 0
c = int(s > 2)
for _ in range(s - 3):
a, b, c = b, c, (a + c) % (10**9 + 7)
print(c)
| false | 16.666667 | [
"-a = [None, 0, 0] + [1] * (s - 2)",
"-for i in range(3, s - 2):",
"- a[i + 3] += a[i]",
"- a[i + 1] += a[i]",
"-print((a[s] % (10**9 + 7)))",
"+a = b = 0",
"+c = int(s > 2)",
"+for _ in range(s - 3):",
"+ a, b, c = b, c, (a + c) % (10**9 + 7)",
"+print(c)"
] | false | 0.035768 | 0.035864 | 0.997332 | [
"s081371646",
"s605424956"
] |
u350049649 | p03495 | python | s697457747 | s943391526 | 163 | 99 | 44,800 | 35,996 | Accepted | Accepted | 39.26 | N,K=list(map(int,input().split()))
nums=list(input().split())
used_balls=0
dict={}
for n in nums:
if n not in list(dict.keys()):
dict[n]=1
else:
dict[n]+=1
tmp=0
for d in sorted(list(dict.items()),key=lambda x: x[1],reverse=True):
tmp+=1
if tmp<=K:
used_balls+=d[1]
else:
break
... | from collections import Counter
N,K=list(map(int,input().split()))
nums=list(input().split())
a=Counter(nums)
print((sum(sorted(list(a.values()), reverse=True)[K:]))) | 19 | 5 | 331 | 156 | N, K = list(map(int, input().split()))
nums = list(input().split())
used_balls = 0
dict = {}
for n in nums:
if n not in list(dict.keys()):
dict[n] = 1
else:
dict[n] += 1
tmp = 0
for d in sorted(list(dict.items()), key=lambda x: x[1], reverse=True):
tmp += 1
if tmp <= K:
used_ball... | from collections import Counter
N, K = list(map(int, input().split()))
nums = list(input().split())
a = Counter(nums)
print((sum(sorted(list(a.values()), reverse=True)[K:])))
| false | 73.684211 | [
"+from collections import Counter",
"+",
"-used_balls = 0",
"-dict = {}",
"-for n in nums:",
"- if n not in list(dict.keys()):",
"- dict[n] = 1",
"- else:",
"- dict[n] += 1",
"-tmp = 0",
"-for d in sorted(list(dict.items()), key=lambda x: x[1], reverse=True):",
"- tmp +=... | false | 0.039624 | 0.040237 | 0.984785 | [
"s697457747",
"s943391526"
] |
u136869985 | p02622 | python | s208757114 | s598828482 | 54 | 46 | 11,000 | 11,016 | Accepted | Accepted | 14.81 | s = eval(input())
t = eval(input())
print((sum([s[i] != t[i] for i in range(len(s))]))) | print((sum([s != t for s, t in zip(eval(input()), eval(input()))])))
| 3 | 1 | 75 | 55 | s = eval(input())
t = eval(input())
print((sum([s[i] != t[i] for i in range(len(s))])))
| print((sum([s != t for s, t in zip(eval(input()), eval(input()))])))
| false | 66.666667 | [
"-s = eval(input())",
"-t = eval(input())",
"-print((sum([s[i] != t[i] for i in range(len(s))])))",
"+print((sum([s != t for s, t in zip(eval(input()), eval(input()))])))"
] | false | 0.048876 | 0.049703 | 0.983367 | [
"s208757114",
"s598828482"
] |
u296518383 | p03998 | python | s166801600 | s015737696 | 22 | 17 | 3,316 | 3,064 | Accepted | Accepted | 22.73 | import collections
S=[eval(input()) for _ in range(3)]
#print(S)
S=list([x.replace("a","0").replace("b","1").replace("c","2") for x in S])
#print(S)
S=list([collections.deque(list(x)) for x in S])
#print(S)
i=0
while 1:
if len(S[i])==0:
break
i=int(S[i].popleft())
#print(S,i)
print((chr(i... | S = [[{"a": 0, "b": 1, "c": 2}[s] for s in input()[::-1]]for _ in range(3)]
T = {0: "A", 1: "B", 2: "C"}
c = 0
while 1:
c = S[c].pop()
if not S[c]:
print((T[c]))
exit() | 18 | 9 | 326 | 199 | import collections
S = [eval(input()) for _ in range(3)]
# print(S)
S = list([x.replace("a", "0").replace("b", "1").replace("c", "2") for x in S])
# print(S)
S = list([collections.deque(list(x)) for x in S])
# print(S)
i = 0
while 1:
if len(S[i]) == 0:
break
i = int(S[i].popleft())
# print(S,i)
pri... | S = [[{"a": 0, "b": 1, "c": 2}[s] for s in input()[::-1]] for _ in range(3)]
T = {0: "A", 1: "B", 2: "C"}
c = 0
while 1:
c = S[c].pop()
if not S[c]:
print((T[c]))
exit()
| false | 50 | [
"-import collections",
"-",
"-S = [eval(input()) for _ in range(3)]",
"-# print(S)",
"-S = list([x.replace(\"a\", \"0\").replace(\"b\", \"1\").replace(\"c\", \"2\") for x in S])",
"-# print(S)",
"-S = list([collections.deque(list(x)) for x in S])",
"-# print(S)",
"-i = 0",
"+S = [[{\"a\": 0, \"b\"... | false | 0.094555 | 0.100477 | 0.941058 | [
"s166801600",
"s015737696"
] |
u983918956 | p03557 | python | s240280675 | s625632661 | 1,112 | 884 | 23,328 | 24,264 | Accepted | Accepted | 20.5 | def biserch(l,key,flag=True):
if flag is True:
func = judge_1
else:
func = judge_2
left = -1; right = len(l)
while right - left > 1:
middle = (left+right) // 2
if func(l,key,middle) is True:
right = middle
else:
left = middle
... | def biserch_min(l,key):
left = 0; right = len(l)
while left < right:
mid = (left+right)//2
if l[mid] < key:
left = mid+1
else:
right = mid
return left
def biserch_max(l,key):
left = 0; right = len(l)
while left < right:
mid = (lef... | 37 | 32 | 830 | 717 | def biserch(l, key, flag=True):
if flag is True:
func = judge_1
else:
func = judge_2
left = -1
right = len(l)
while right - left > 1:
middle = (left + right) // 2
if func(l, key, middle) is True:
right = middle
else:
left = middle
r... | def biserch_min(l, key):
left = 0
right = len(l)
while left < right:
mid = (left + right) // 2
if l[mid] < key:
left = mid + 1
else:
right = mid
return left
def biserch_max(l, key):
left = 0
right = len(l)
while left < right:
mid = (l... | false | 13.513514 | [
"-def biserch(l, key, flag=True):",
"- if flag is True:",
"- func = judge_1",
"- else:",
"- func = judge_2",
"- left = -1",
"+def biserch_min(l, key):",
"+ left = 0",
"- while right - left > 1:",
"- middle = (left + right) // 2",
"- if func(l, key, midd... | false | 0.069284 | 0.081009 | 0.855266 | [
"s240280675",
"s625632661"
] |
u512212329 | p02702 | python | s168385640 | s782837745 | 88 | 80 | 9,244 | 9,316 | Accepted | Accepted | 9.09 | def main():
s = eval(input())
rem = [0] * 2019 # the count of the each remainder: 0 ~ 2018
rem[0] = 1 # why? can't understand.
temp = 0
digit = 1
for i, c in enumerate(s[::-1]):
# No time to pow.
temp += int(c) * digit
rem[temp % 2019] += 1
digit *= ... | def main():
s = eval(input())
rem = [0] * 2019 # the count of the each remainder: 0 ~ 2018
rem[0] = 1 # why? can't understand.
temp = 0
digit = 1
for c in s[::-1]:
# No time to pow.
temp += int(c) * digit
rem[temp % 2019] += 1
digit *= 10
di... | 19 | 19 | 440 | 426 | def main():
s = eval(input())
rem = [0] * 2019 # the count of the each remainder: 0 ~ 2018
rem[0] = 1 # why? can't understand.
temp = 0
digit = 1
for i, c in enumerate(s[::-1]):
# No time to pow.
temp += int(c) * digit
rem[temp % 2019] += 1
digit *= 10
d... | def main():
s = eval(input())
rem = [0] * 2019 # the count of the each remainder: 0 ~ 2018
rem[0] = 1 # why? can't understand.
temp = 0
digit = 1
for c in s[::-1]:
# No time to pow.
temp += int(c) * digit
rem[temp % 2019] += 1
digit *= 10
digit %= 2019
... | false | 0 | [
"- for i, c in enumerate(s[::-1]):",
"+ for c in s[::-1]:"
] | false | 0.03787 | 0.034205 | 1.107139 | [
"s168385640",
"s782837745"
] |
u183422236 | p02735 | python | s422706217 | s413153634 | 201 | 30 | 42,352 | 3,188 | Accepted | Accepted | 85.07 | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for i in range(h)]
dp = [[0] * w for i in range(h)]
if maze[0][0] == "#":
dp[0][0] = 1
for i in range(h):
for j in range(w):
if i == j == 0:
continue
if i == 0:
if maz... | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for i in range(h)]
dp = [[0] * w for i in range(h)]
for i in range(h):
for j in range(w):
if i == j == 0:
if maze[i][j] == "#":
dp[i][j] += 1
if i == 0 and j != 0:
... | 41 | 33 | 1,034 | 1,006 | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for i in range(h)]
dp = [[0] * w for i in range(h)]
if maze[0][0] == "#":
dp[0][0] = 1
for i in range(h):
for j in range(w):
if i == j == 0:
continue
if i == 0:
if maze[0][j] != maze[0][j - 1]:
... | h, w = list(map(int, input().split()))
maze = [list(eval(input())) for i in range(h)]
dp = [[0] * w for i in range(h)]
for i in range(h):
for j in range(w):
if i == j == 0:
if maze[i][j] == "#":
dp[i][j] += 1
if i == 0 and j != 0:
if maze[0][j] != maze[0][j - ... | false | 19.512195 | [
"-if maze[0][0] == \"#\":",
"- dp[0][0] = 1",
"- continue",
"- if i == 0:",
"+ if maze[i][j] == \"#\":",
"+ dp[i][j] += 1",
"+ if i == 0 and j != 0:",
"- if j == 0:",
"+ if j == 0 and i != 0:",
"- tmp1 = 0",
"- ... | false | 0.105786 | 0.039137 | 2.702953 | [
"s422706217",
"s413153634"
] |
u254871849 | p03330 | python | s418876057 | s768987613 | 1,174 | 234 | 34,912 | 34,536 | Accepted | Accepted | 80.07 | import sys
import numpy as np
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, C = I[:2]
cost = I[2:2+C**2].reshape(C, C)
color = I[2+C**2:].reshape(n, n) - 1
def main():
mod_3 = (np.arange(1, n+1)[:, None] + np.arange(1, n+1)) % 3
c0 = np.bincount(color... | import sys
import numpy as np
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, C = I[:2]
cost = I[2:2+C**2].reshape(C, C)
color = I[2+C**2:].reshape(n, n) - 1
def main():
mod_3 = (np.arange(1, n+1)[:, None] + np.arange(1, n+1)) % 3
c0 = np.bincount(color... | 26 | 29 | 755 | 850 | import sys
import numpy as np
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, C = I[:2]
cost = I[2 : 2 + C**2].reshape(C, C)
color = I[2 + C**2 :].reshape(n, n) - 1
def main():
mod_3 = (np.arange(1, n + 1)[:, None] + np.arange(1, n + 1)) % 3
c0 = np.bincount(color... | import sys
import numpy as np
from itertools import permutations
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, C = I[:2]
cost = I[2 : 2 + C**2].reshape(C, C)
color = I[2 + C**2 :].reshape(n, n) - 1
def main():
mod_3 = (np.arange(1, n + 1)[:, None] + np.arange(1, n + 1)) % 3
c0 = np.bincount(color... | false | 10.344828 | [
"+ r = np.arange(C)",
"+ s0 = np.sum(cost[:, r] * c0[:, None], axis=0)",
"+ s1 = np.sum(cost[:, r] * c1[:, None], axis=0)",
"+ s2 = np.sum(cost[:, r] * c2[:, None], axis=0)",
"- res = np.sum(c0 * cost[:, i])",
"- res += np.sum(c1 * cost[:, j])",
"- res += np.sum(c2 * cos... | false | 0.18017 | 0.286867 | 0.628062 | [
"s418876057",
"s768987613"
] |
u836939578 | p03476 | python | s808299078 | s497283101 | 401 | 362 | 52,256 | 53,024 | Accepted | Accepted | 9.73 | from itertools import accumulate
import sys
input = lambda: sys.stdin.readline().rstrip()
MAX = 10 ** 5
def eratosthenes(n):
is_prime = [1] * (n+1)
is_prime[0] = 0
is_prime[1] = 0
for i in range(2, int(n**0.5)+1):
if not is_prime[i]:
continue
for j in range(i... | from itertools import accumulate
import sys
input = lambda: sys.stdin.readline().rstrip()
def eratosthenes(n):
is_prime = [1] * (n + 1)
is_prime[0] = 0
is_prime[1] = 0
ans = [0] * (n+1)
for i in range(2, int(n**0.5)+1):
if not is_prime[i]:
continue
fo... | 33 | 40 | 668 | 690 | from itertools import accumulate
import sys
input = lambda: sys.stdin.readline().rstrip()
MAX = 10**5
def eratosthenes(n):
is_prime = [1] * (n + 1)
is_prime[0] = 0
is_prime[1] = 0
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1,... | from itertools import accumulate
import sys
input = lambda: sys.stdin.readline().rstrip()
def eratosthenes(n):
is_prime = [1] * (n + 1)
is_prime[0] = 0
is_prime[1] = 0
ans = [0] * (n + 1)
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i... | false | 17.5 | [
"-MAX = 10**5",
"+ ans = [0] * (n + 1)",
"-Q = int(eval(input()))",
"+MAX = 10**5",
"-s = a",
"-s = list(accumulate(s))",
"+s = list(accumulate(a))",
"+Q = int(eval(input()))"
] | false | 0.119991 | 0.194759 | 0.616102 | [
"s808299078",
"s497283101"
] |
u112247039 | p02693 | python | s438560184 | s784574280 | 22 | 20 | 9,116 | 9,044 | Accepted | Accepted | 9.09 | k = int(eval(input()))
a, b = list(map(int,input().split()))
for i in range(a//k,b//k+1):
if (k*i) <= b and k*i >= a:
print('OK'); break
else:
print('NG') | k = int(eval(input()))
a, b = list(map(int,input().split()))
print(('OK' if a <= ( b // k * k) else 'NG')) | 7 | 3 | 177 | 100 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a // k, b // k + 1):
if (k * i) <= b and k * i >= a:
print("OK")
break
else:
print("NG")
| k = int(eval(input()))
a, b = list(map(int, input().split()))
print(("OK" if a <= (b // k * k) else "NG"))
| false | 57.142857 | [
"-for i in range(a // k, b // k + 1):",
"- if (k * i) <= b and k * i >= a:",
"- print(\"OK\")",
"- break",
"-else:",
"- print(\"NG\")",
"+print((\"OK\" if a <= (b // k * k) else \"NG\"))"
] | false | 0.137016 | 0.099115 | 1.382392 | [
"s438560184",
"s784574280"
] |
u408260374 | p01136 | python | s332207417 | s601011542 | 960 | 720 | 7,628 | 7,684 | Accepted | Accepted | 25 | import itertools
while True:
N = int(eval(input()))
if not N:
break
D = [[] for _ in range(30)]
for i in range(N):
for x in map(int, input().split()[1:]):
D[x - 1].append(i)
C = [1 << i for i in range(N)]
for d in range(30):
for i, j in itertools.pe... | import itertools
while True:
N = int(eval(input()))
if not N:
break
D = [[] for _ in range(30)]
for i in range(N):
for x in map(int, input().split()[1:]):
D[x - 1].append(i)
C = [1 << i for i in range(N)]
for d in range(30):
for i, j in itertools.co... | 18 | 18 | 488 | 495 | import itertools
while True:
N = int(eval(input()))
if not N:
break
D = [[] for _ in range(30)]
for i in range(N):
for x in map(int, input().split()[1:]):
D[x - 1].append(i)
C = [1 << i for i in range(N)]
for d in range(30):
for i, j in itertools.permutations... | import itertools
while True:
N = int(eval(input()))
if not N:
break
D = [[] for _ in range(30)]
for i in range(N):
for x in map(int, input().split()[1:]):
D[x - 1].append(i)
C = [1 << i for i in range(N)]
for d in range(30):
for i, j in itertools.combinations... | false | 0 | [
"- for i, j in itertools.permutations(D[d], 2):",
"- C[i] = C[i] | C[j]",
"+ for i, j in itertools.combinations(D[d], 2):",
"+ C[i] = C[j] = C[i] | C[j]"
] | false | 0.115818 | 0.039229 | 2.952401 | [
"s332207417",
"s601011542"
] |
u133936772 | p02733 | python | s716375139 | s846083728 | 409 | 355 | 47,580 | 43,868 | Accepted | Accepted | 13.2 | h,w,k=list(map(int,input().split()))
g=[[int(c) for c in eval(input())] for _ in range(h)]
s=[[0]*(w+1) for _ in range(h+1)]
for i in range(h):
for j in range(w):
s[i+1][j+1]=s[i+1][j]+s[i][j+1]+g[i][j]-s[i][j]
ssum=lambda u,d,l,r:s[d][r]-s[u][r]-s[d][l]+s[u][l]
a=h+w
for i in range(2**(h-1)):
e=[]
... | f=range
h,w,k=list(map(int,input().split()))
g=[[int(i) for i in eval(input())] for _ in f(h)]
s=[[0]*-~w for _ in f(h+1)]
for i in f(h):
for j in f(w):
s[i+1][j+1]=s[i+1][j]+s[i][j+1]+g[i][j]-s[i][j]
a=h+w
for i in f(2**~-h):
u=d=l=r=c=0
e=[]
while d<h:
d+=1
if i>>d-1&1: e+=[(u,d)]; c+... | 28 | 22 | 593 | 487 | h, w, k = list(map(int, input().split()))
g = [[int(c) for c in eval(input())] for _ in range(h)]
s = [[0] * (w + 1) for _ in range(h + 1)]
for i in range(h):
for j in range(w):
s[i + 1][j + 1] = s[i + 1][j] + s[i][j + 1] + g[i][j] - s[i][j]
ssum = lambda u, d, l, r: s[d][r] - s[u][r] - s[d][l] + s[u][l]
a ... | f = range
h, w, k = list(map(int, input().split()))
g = [[int(i) for i in eval(input())] for _ in f(h)]
s = [[0] * -~w for _ in f(h + 1)]
for i in f(h):
for j in f(w):
s[i + 1][j + 1] = s[i + 1][j] + s[i][j + 1] + g[i][j] - s[i][j]
a = h + w
for i in f(2 ** ~-h):
u = d = l = r = c = 0
e = []
whi... | false | 21.428571 | [
"+f = range",
"-g = [[int(c) for c in eval(input())] for _ in range(h)]",
"-s = [[0] * (w + 1) for _ in range(h + 1)]",
"-for i in range(h):",
"- for j in range(w):",
"+g = [[int(i) for i in eval(input())] for _ in f(h)]",
"+s = [[0] * -~w for _ in f(h + 1)]",
"+for i in f(h):",
"+ for j in f(... | false | 0.037966 | 0.037741 | 1.005949 | [
"s716375139",
"s846083728"
] |
u190873802 | p03036 | python | s685091042 | s478739235 | 22 | 17 | 3,316 | 2,940 | Accepted | Accepted | 22.73 | # coding: utf-8
# Your code here!
R, D, X = list(map(int, input().split()))
Plus = X
for i in range(10):
print(((R*Plus)-D))
Plus=(R*Plus)-D | R,D,X=list(map(int, input().split()))
Plus=X
for i in range(10):
print(((Plus*R)-D))
Plus=((Plus*R)-D) | 8 | 5 | 148 | 106 | # coding: utf-8
# Your code here!
R, D, X = list(map(int, input().split()))
Plus = X
for i in range(10):
print(((R * Plus) - D))
Plus = (R * Plus) - D
| R, D, X = list(map(int, input().split()))
Plus = X
for i in range(10):
print(((Plus * R) - D))
Plus = (Plus * R) - D
| false | 37.5 | [
"-# coding: utf-8",
"-# Your code here!",
"- print(((R * Plus) - D))",
"- Plus = (R * Plus) - D",
"+ print(((Plus * R) - D))",
"+ Plus = (Plus * R) - D"
] | false | 0.047839 | 0.043557 | 1.098296 | [
"s685091042",
"s478739235"
] |
u781262926 | p03294 | python | s905003711 | s092451570 | 172 | 18 | 5,372 | 3,316 | Accepted | Accepted | 89.53 | import sys
from fractions import gcd
lcm = lambda x, y : x*y // gcd(x, y)
from functools import reduce
inputs = sys.stdin.readlines()
n = int(inputs[0])
A = list(map(int, inputs[1].split()))
m = reduce(lcm, A)-1
ans = 0
for a in A:
ans += m % a
print(ans) | import sys
inputs = sys.stdin.readlines()
n = int(inputs[0])
A = list(map(int, inputs[1].split()))
print((sum(A) - len(A))) | 14 | 7 | 274 | 129 | import sys
from fractions import gcd
lcm = lambda x, y: x * y // gcd(x, y)
from functools import reduce
inputs = sys.stdin.readlines()
n = int(inputs[0])
A = list(map(int, inputs[1].split()))
m = reduce(lcm, A) - 1
ans = 0
for a in A:
ans += m % a
print(ans)
| import sys
inputs = sys.stdin.readlines()
n = int(inputs[0])
A = list(map(int, inputs[1].split()))
print((sum(A) - len(A)))
| false | 50 | [
"-from fractions import gcd",
"-",
"-lcm = lambda x, y: x * y // gcd(x, y)",
"-from functools import reduce",
"-m = reduce(lcm, A) - 1",
"-ans = 0",
"-for a in A:",
"- ans += m % a",
"-print(ans)",
"+print((sum(A) - len(A)))"
] | false | 0.050914 | 0.038138 | 1.334998 | [
"s905003711",
"s092451570"
] |
u450956662 | p03828 | python | s415529150 | s905313266 | 40 | 35 | 3,064 | 9,432 | Accepted | Accepted | 12.5 | MOD = 10 ** 9 + 7
N = int(eval(input()))
C = [0] * (N + 1)
for i in range(2, N+1):
k = i
for j in range(2, i+1):
while k % j == 0:
k //= j
C[j] += 1
if k == 1:
break
ans = 1
for c in C:
ans *= (c + 1)
ans %= MOD
print(ans) | MOD = 10 ** 9 + 7
def sieve(n):
srn = int(n ** 0.5) + 1
f = [False] * (srn + 1)
res = []
for i in range(2, srn + 1):
if f[i]:
continue
res.append(i)
for j in range(2 * i, srn + 1, i):
f[j] = True
return res
def trial_division(n):
r... | 16 | 34 | 299 | 719 | MOD = 10**9 + 7
N = int(eval(input()))
C = [0] * (N + 1)
for i in range(2, N + 1):
k = i
for j in range(2, i + 1):
while k % j == 0:
k //= j
C[j] += 1
if k == 1:
break
ans = 1
for c in C:
ans *= c + 1
ans %= MOD
print(ans)
| MOD = 10**9 + 7
def sieve(n):
srn = int(n**0.5) + 1
f = [False] * (srn + 1)
res = []
for i in range(2, srn + 1):
if f[i]:
continue
res.append(i)
for j in range(2 * i, srn + 1, i):
f[j] = True
return res
def trial_division(n):
res = dict()
f... | false | 52.941176 | [
"+",
"+",
"+def sieve(n):",
"+ srn = int(n**0.5) + 1",
"+ f = [False] * (srn + 1)",
"+ res = []",
"+ for i in range(2, srn + 1):",
"+ if f[i]:",
"+ continue",
"+ res.append(i)",
"+ for j in range(2 * i, srn + 1, i):",
"+ f[j] = True",
"+... | false | 0.055772 | 0.048135 | 1.158649 | [
"s415529150",
"s905313266"
] |
u461993794 | p03575 | python | s026113170 | s669594763 | 406 | 75 | 82,632 | 68,312 | Accepted | Accepted | 81.53 | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl... | n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = [1]
seen = {1}
... | 32 | 29 | 667 | 622 | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = deque()... | n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = [1]
seen = {1}
while len(q) > ... | false | 9.375 | [
"-from collections import deque",
"-",
"- q = deque()",
"- q.append(1)",
"+ q = [1]",
"- while q:",
"+ while len(q) > 0:"
] | false | 0.161245 | 0.047583 | 3.388692 | [
"s026113170",
"s669594763"
] |
u489959379 | p03151 | python | s884807382 | s130492427 | 152 | 125 | 18,164 | 19,112 | Accepted | Accepted | 17.76 | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff_AB = sum(A) - sum(B)
if diff_AB < 0:
print((-1))
exit()
Diff = []
for i in range(n):
diff = A[i] - B[i]
Diff.append(diff)
Diff = sorted(Diff)
res = 0
for i in range(n):
if Diff[i] < 0:
res ... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff_AB = sum(A) - sum(B)
if diff_AB < 0:
print((-1))... | 31 | 44 | 461 | 776 | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff_AB = sum(A) - sum(B)
if diff_AB < 0:
print((-1))
exit()
Diff = []
for i in range(n):
diff = A[i] - B[i]
Diff.append(diff)
Diff = sorted(Diff)
res = 0
for i in range(n):
if Diff[i] < 0:
res += ... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff_AB = sum(A) - sum(B)
if diff_AB < 0:
print((-1))
exit()
Di... | false | 29.545455 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-diff_AB = sum(A) - sum(B)",
"-if diff_AB < 0:",
"- print((-1))",
"- exit()",
"-Diff = []",
"-for i in range(n):",
"- diff = A[i] - B[i]",
"- Diff.append(diff)",
"-Diff = sor... | false | 0.037812 | 0.073043 | 0.517665 | [
"s884807382",
"s130492427"
] |
u724687935 | p03137 | python | s760788853 | s301015428 | 289 | 153 | 18,000 | 13,960 | Accepted | Accepted | 47.06 | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if N >= M:
print((0))
exit()
q1 = []
for i in range(M - 1):
sec = X[i + 1] - X[i]
heappush(q1, (-sec, i + 1))
q2 = []
for n in range(N - 1):
sec, idx = h... | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if N >= M:
print((0))
exit()
q1 = []
for i in range(M - 1):
sec = X[i + 1] - X[i]
heappush(q1, -sec)
ans = 0
for _ in range(N - 1):
ans -= heappop(q1)
... | 32 | 23 | 487 | 339 | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if N >= M:
print((0))
exit()
q1 = []
for i in range(M - 1):
sec = X[i + 1] - X[i]
heappush(q1, (-sec, i + 1))
q2 = []
for n in range(N - 1):
sec, idx = heappop(q1)
heappush(q2... | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if N >= M:
print((0))
exit()
q1 = []
for i in range(M - 1):
sec = X[i + 1] - X[i]
heappush(q1, -sec)
ans = 0
for _ in range(N - 1):
ans -= heappop(q1)
print((X[-1] - X[0] - ans))
| false | 28.125 | [
"- heappush(q1, (-sec, i + 1))",
"-q2 = []",
"-for n in range(N - 1):",
"- sec, idx = heappop(q1)",
"- heappush(q2, idx)",
"-heappush(q2, M)",
"-cur = 0",
"+ heappush(q1, -sec)",
"-for n in range(N):",
"- idx = heappop(q2)",
"- ans += X[idx - 1] - X[cur]",
"- cur = idx",
... | false | 0.040534 | 0.086461 | 0.468811 | [
"s760788853",
"s301015428"
] |
u761320129 | p04047 | python | s757292295 | s476973418 | 23 | 18 | 2,940 | 3,060 | Accepted | Accepted | 21.74 | N = int(eval(input()))
src = list(map(int,input().split()))
src.sort()
ans = 0
for a,b in zip(src[::2],src[1::2]):
ans += a
print(ans) | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort(reverse=True)
ans = 0
for a,b in zip(L[::2],L[1::2]):
ans += min(a,b)
print(ans) | 7 | 8 | 138 | 151 | N = int(eval(input()))
src = list(map(int, input().split()))
src.sort()
ans = 0
for a, b in zip(src[::2], src[1::2]):
ans += a
print(ans)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort(reverse=True)
ans = 0
for a, b in zip(L[::2], L[1::2]):
ans += min(a, b)
print(ans)
| false | 12.5 | [
"-src = list(map(int, input().split()))",
"-src.sort()",
"+L = list(map(int, input().split()))",
"+L.sort(reverse=True)",
"-for a, b in zip(src[::2], src[1::2]):",
"- ans += a",
"+for a, b in zip(L[::2], L[1::2]):",
"+ ans += min(a, b)"
] | false | 0.035984 | 0.06902 | 0.521356 | [
"s757292295",
"s476973418"
] |
u498487134 | p02769 | python | s067734055 | s677474722 | 329 | 192 | 119,660 | 161,192 | Accepted | Accepted | 41.64 | n,k=list(map(int,input().split()))
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return (fact[n] * factinv[r] * factinv[n-r])%mod
mod=10**9 + 7
fact=[1,1]
factinv=[1,1]
inv=[0,1]
for i in range(2, 2*n + 1):
fact.append((fact[-1] * i) % mod)
inv.appe... | import sys
input = sys.stdin.readline
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
N,K=MI()
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r... | 32 | 46 | 586 | 929 | n, k = list(map(int, input().split()))
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return (fact[n] * factinv[r] * factinv[n - r]) % mod
mod = 10**9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, 2 * n + 1):
fact.append((fact[-1] * i) % mod)
in... | import sys
input = sys.stdin.readline
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
N, K = MI()
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
... | false | 30.434783 | [
"-n, k = list(map(int, input().split()))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-def cmb(n, r, mod):",
"- if (r < 0) or (n < r):",
"- return 0",
"- r = min(r, n - r)",
"- return (fact[n] * factinv[r] * factinv[n - r]) % mod",
"+def I():",
"+ return int(eval(inpu... | false | 0.409143 | 0.226111 | 1.809478 | [
"s067734055",
"s677474722"
] |
u640603056 | p03012 | python | s601474011 | s020539882 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | n = int(eval(input()))
lst_W = list(map(int, input().split()))
ans = 999
for t in range(n):
low = sum(lst_W[:t])
high = sum(lst_W[t:])
if ans > abs(high - low):
ans = abs(high - low)
print(ans) | n = int(eval(input()))
w_lst = list(map(int, input().split()))
min = 1000000
for i in range(1, n):
s1 = sum(w_lst[:i])
s2 = sum(w_lst[i:])
if abs(s1 - s2) < min:
min = abs(s1 - s2)
print(min) | 9 | 9 | 200 | 213 | n = int(eval(input()))
lst_W = list(map(int, input().split()))
ans = 999
for t in range(n):
low = sum(lst_W[:t])
high = sum(lst_W[t:])
if ans > abs(high - low):
ans = abs(high - low)
print(ans)
| n = int(eval(input()))
w_lst = list(map(int, input().split()))
min = 1000000
for i in range(1, n):
s1 = sum(w_lst[:i])
s2 = sum(w_lst[i:])
if abs(s1 - s2) < min:
min = abs(s1 - s2)
print(min)
| false | 0 | [
"-lst_W = list(map(int, input().split()))",
"-ans = 999",
"-for t in range(n):",
"- low = sum(lst_W[:t])",
"- high = sum(lst_W[t:])",
"- if ans > abs(high - low):",
"- ans = abs(high - low)",
"-print(ans)",
"+w_lst = list(map(int, input().split()))",
"+min = 1000000",
"+for i in ... | false | 0.049456 | 0.047506 | 1.041058 | [
"s601474011",
"s020539882"
] |
u542774596 | p02701 | python | s931306788 | s751524301 | 300 | 251 | 35,536 | 35,560 | Accepted | Accepted | 16.33 | n = int(eval(input()))
s_list = []
for i in range(n):
s = str(eval(input()))
s_list.append(s)
print((len(set(s_list)))) | n = int(eval(input()))
list =[eval(input()) for _ in range(n)]
print((len(set(list)))) | 8 | 3 | 130 | 74 | n = int(eval(input()))
s_list = []
for i in range(n):
s = str(eval(input()))
s_list.append(s)
print((len(set(s_list))))
| n = int(eval(input()))
list = [eval(input()) for _ in range(n)]
print((len(set(list))))
| false | 62.5 | [
"-s_list = []",
"-for i in range(n):",
"- s = str(eval(input()))",
"- s_list.append(s)",
"-print((len(set(s_list))))",
"+list = [eval(input()) for _ in range(n)]",
"+print((len(set(list))))"
] | false | 0.12595 | 0.083463 | 1.509051 | [
"s931306788",
"s751524301"
] |
u069838609 | p03209 | python | s699446818 | s971831376 | 206 | 29 | 42,224 | 3,940 | Accepted | Accepted | 85.92 | from functools import lru_cache
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
h_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = 3 + 2 * h_burger[i - 1]
@lru_cache(None)
def num_patti(l, x):
if x == 0:
return 0
elif l == 0:
return 1
... | from functools import lru_cache
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
h_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = 3 + 2 * h_burger[i - 1]
@lru_cache(None)
def num_patties(l, x):
if x == 0:
return 0
elif l == 0:
return 1
... | 28 | 28 | 671 | 684 | from functools import lru_cache
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
h_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = 3 + 2 * h_burger[i - 1]
@lru_cache(None)
def num_patti(l, x):
if x == 0:
return 0
elif l == 0:
return 1
else:
if x... | from functools import lru_cache
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
h_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = 3 + 2 * h_burger[i - 1]
@lru_cache(None)
def num_patties(l, x):
if x == 0:
return 0
elif l == 0:
return 1
else:
if... | false | 0 | [
"-def num_patti(l, x):",
"+def num_patties(l, x):",
"- return num_patti(l - 1, x - 1)",
"+ return num_patties(l - 1, x - 1)",
"- return num_patti(l - 1, h_burger[l - 1]) + 1",
"+ return num_patties(l - 1, h_burger[l - 1]) + 1",
"- num_patti(l - ... | false | 0.078799 | 0.033767 | 2.333598 | [
"s699446818",
"s971831376"
] |
u576432509 | p02574 | python | s219911488 | s593118334 | 1,215 | 255 | 252,160 | 183,936 | Accepted | Accepted | 79.01 |
import sys
def enum_div(n):
ir=int(n**(0.5))+1
ret=[]
for i in range(1,ir):
if n%i == 0:
ret.append(i)
if (i!= 1) & (i*i != n):
ret.append(n//i)
return ret
from collections import deque
# q = deque(l)
# q.append(4) # 後ろから4を挿入, l... | import sys
def enum_div(n):
ir=int(n**(0.5))+1
ret=[]
for i in range(1,ir):
if n%i == 0:
ret.append(i)
if (i!= 1) & (i*i != n):
ret.append(n//i)
return ret
from collections import deque
# q = deque(l)
# q.append(4) # 後ろから4を挿入, l=d... | 81 | 80 | 2,032 | 2,031 | import sys
def enum_div(n):
ir = int(n ** (0.5)) + 1
ret = []
for i in range(1, ir):
if n % i == 0:
ret.append(i)
if (i != 1) & (i * i != n):
ret.append(n // i)
return ret
from collections import deque
# q = deque(l)
# q.append(4) # 後ろから4を挿入, l=... | import sys
def enum_div(n):
ir = int(n ** (0.5)) + 1
ret = []
for i in range(1, ir):
if n % i == 0:
ret.append(i)
if (i != 1) & (i * i != n):
ret.append(n // i)
return ret
from collections import deque
# q = deque(l)
# q.append(4) # 後ろから4を挿入, l=... | false | 1.234568 | [
"-p = get_primenumber(amax)",
"-for pp in p:",
"- # for pp in range(2,amax+1):",
"+# p=get_primenumber(amax)",
"+# for pp in p:",
"+for pp in range(2, amax + 1):"
] | false | 0.264241 | 0.045914 | 5.755084 | [
"s219911488",
"s593118334"
] |
u353797797 | p02814 | python | s676784906 | s834894894 | 392 | 230 | 60,004 | 14,608 | Accepted | Accepted | 41.33 | import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in ... | from itertools import permutations
import sys
sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | 31 | 39 | 668 | 985 | import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [... | from itertools import permutations
import sys
sys.setrecursionlimit(10**6)
from bisect import *
from collections import *
from heapq import *
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split())... | false | 20.512821 | [
"+from itertools import permutations",
"-int1 = lambda x: int(x) - 1",
"-p2D = lambda x: print(*x, sep=\"\\n\")",
"+from bisect import *",
"+from collections import *",
"+from heapq import *",
"+def SI():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"-def gcd(x, y):",
"- while y:",
... | false | 0.111332 | 0.149522 | 0.744589 | [
"s676784906",
"s834894894"
] |
u423925725 | p04045 | python | s192324944 | s618853722 | 164 | 61 | 3,064 | 3,064 | Accepted | Accepted | 62.8 | # coding: utf-8;
def main():
num = [0,1,2,3,4,5,6,7,8,9]
n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
usable_num = list(set(num) - set(d))
while True:
if len(set(map(int, str(n))) - set(usable_num)) == 0:
break
else:
... | # coding: utf-8;
def main():
num = [0,1,2,3,4,5,6,7,8,9]
n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
usable_num = list(set(num) - set(d))
while True:
f = True
for a in str(n):
if int(a) not in usable_num:
f = Fa... | 17 | 20 | 378 | 434 | # coding: utf-8;
def main():
num = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
usable_num = list(set(num) - set(d))
while True:
if len(set(map(int, str(n))) - set(usable_num)) == 0:
break
else:
n +=... | # coding: utf-8;
def main():
num = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
usable_num = list(set(num) - set(d))
while True:
f = True
for a in str(n):
if int(a) not in usable_num:
f = False
... | false | 15 | [
"- if len(set(map(int, str(n))) - set(usable_num)) == 0:",
"+ f = True",
"+ for a in str(n):",
"+ if int(a) not in usable_num:",
"+ f = False",
"+ break",
"+ if f:",
"- else:",
"- n += 1",
"+ n += 1"
] | false | 0.090571 | 0.04864 | 1.862057 | [
"s192324944",
"s618853722"
] |
u729133443 | p02715 | python | s539265090 | s684872578 | 388 | 202 | 11,284 | 11,864 | Accepted | Accepted | 47.94 | M=10**9+7
n,k=list(map(int,input().split()))
d=[0]*-~k
a=0
for i in range(k,0,-1):
t=c=0
for j in range(i,k+1,i):
c+=1
t+=d[j]
d[i]=pow(c,n,M)-t
a=(a+i*d[i])%M
print(a) | M=10**9+7
n,k=list(map(int,input().split()))
d=[0]*-~k
a=0
for i in range(k,0,-1):d[i]=pow(k//i,n,M)-sum(d[::i]);a+=i*d[i]
print((a%M)) | 12 | 6 | 205 | 132 | M = 10**9 + 7
n, k = list(map(int, input().split()))
d = [0] * -~k
a = 0
for i in range(k, 0, -1):
t = c = 0
for j in range(i, k + 1, i):
c += 1
t += d[j]
d[i] = pow(c, n, M) - t
a = (a + i * d[i]) % M
print(a)
| M = 10**9 + 7
n, k = list(map(int, input().split()))
d = [0] * -~k
a = 0
for i in range(k, 0, -1):
d[i] = pow(k // i, n, M) - sum(d[::i])
a += i * d[i]
print((a % M))
| false | 50 | [
"- t = c = 0",
"- for j in range(i, k + 1, i):",
"- c += 1",
"- t += d[j]",
"- d[i] = pow(c, n, M) - t",
"- a = (a + i * d[i]) % M",
"-print(a)",
"+ d[i] = pow(k // i, n, M) - sum(d[::i])",
"+ a += i * d[i]",
"+print((a % M))"
] | false | 0.10704 | 0.092092 | 1.162318 | [
"s539265090",
"s684872578"
] |
u653837719 | p02925 | python | s813842519 | s527199531 | 1,756 | 659 | 87,352 | 178,948 | Accepted | Accepted | 62.47 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
l = [i for i in range(n)]
pos = [0] * n
res = 0
cnt = 0
while True:
res += 1
flag = True
tmp = l.copy()
l = []
used = [False] * n
for v in tmp:
if used[v] or pos[v] == n - 1:
contin... | import collections
def topological():
"""トポロジカルソート (有向グラフ) O(V+E)
Vars:
n (int): 頂点数
edge (list): 辺に関するリスト (edge[i]: iを始点に持つ辺の終点のリスト)
Returns:
list/bool: トポロジカル順序 (閉路が存在する場合はFalse)
"""
in_degree = [0] * n
for i in range(n):
for v in edge[i... | 42 | 64 | 872 | 1,368 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
l = [i for i in range(n)]
pos = [0] * n
res = 0
cnt = 0
while True:
res += 1
flag = True
tmp = l.copy()
l = []
used = [False] * n
for v in tmp:
if used[v] or pos[v] == n - 1:
continue
opp =... | import collections
def topological():
"""トポロジカルソート (有向グラフ) O(V+E)
Vars:
n (int): 頂点数
edge (list): 辺に関するリスト (edge[i]: iを始点に持つ辺の終点のリスト)
Returns:
list/bool: トポロジカル順序 (閉路が存在する場合はFalse)
"""
in_degree = [0] * n
for i in range(n):
for v in edge[i]:
in_d... | false | 34.375 | [
"-n = int(eval(input()))",
"-a = [list(map(int, input().split())) for _ in range(n)]",
"-l = [i for i in range(n)]",
"-pos = [0] * n",
"-res = 0",
"-cnt = 0",
"-while True:",
"- res += 1",
"- flag = True",
"- tmp = l.copy()",
"- l = []",
"- used = [False] * n",
"- for v in ... | false | 0.036869 | 0.036109 | 1.021049 | [
"s813842519",
"s527199531"
] |
u761320129 | p03674 | python | s504827352 | s363001401 | 372 | 303 | 33,084 | 36,660 | Accepted | Accepted | 18.55 | N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
from collections import Counter
ctr = Counter(A)
d = ctr.most_common(1)[0][0]
x = A.index(d)
y = x+1 + A[x+1:].index(d)
f = x + N-y
MAXN = N+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2)... | N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
from collections import Counter
ctr = Counter(A)
dup = ctr.most_common()[0][0]
i = A.index(dup)
j = A[::-1].index(dup)
l = i+j
MAXN = N+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
... | 29 | 31 | 679 | 716 | N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
from collections import Counter
ctr = Counter(A)
d = ctr.most_common(1)[0][0]
x = A.index(d)
y = x + 1 + A[x + 1 :].index(d)
f = x + N - y
MAXN = N + 5
fac = [1, 1] + [0] * MAXN
finv = [1, 1] + [0] * MAXN
inv = [0, 1] + [0] * MAXN
for i in range(2, M... | N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
from collections import Counter
ctr = Counter(A)
dup = ctr.most_common()[0][0]
i = A.index(dup)
j = A[::-1].index(dup)
l = i + j
MAXN = N + 5
fac = [1, 1] + [0] * MAXN
finv = [1, 1] + [0] * MAXN
inv = [0, 1] + [0] * MAXN
for i in range(2, MAXN + 2):
... | false | 6.451613 | [
"-d = ctr.most_common(1)[0][0]",
"-x = A.index(d)",
"-y = x + 1 + A[x + 1 :].index(d)",
"-f = x + N - y",
"+dup = ctr.most_common()[0][0]",
"+i = A.index(dup)",
"+j = A[::-1].index(dup)",
"+l = i + j",
"-for i in range(1, N + 2):",
"- ans.append((comb(N + 1, i) - comb(f, i - 1)) % MOD)",
"+fo... | false | 0.064198 | 0.035673 | 1.799636 | [
"s504827352",
"s363001401"
] |
u305366205 | p03697 | python | s127879966 | s125400538 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | a, b = list(map(int, input().split()))
if a + b >= 10:
print('error')
else:
print((a + b))
| a, b = list(map(int, input().split()))
print(('error' if a + b >= 10 else a + b)) | 6 | 2 | 97 | 74 | a, b = list(map(int, input().split()))
if a + b >= 10:
print("error")
else:
print((a + b))
| a, b = list(map(int, input().split()))
print(("error" if a + b >= 10 else a + b))
| false | 66.666667 | [
"-if a + b >= 10:",
"- print(\"error\")",
"-else:",
"- print((a + b))",
"+print((\"error\" if a + b >= 10 else a + b))"
] | false | 0.075753 | 0.066222 | 1.14391 | [
"s127879966",
"s125400538"
] |
u175034939 | p02573 | python | s115689984 | s684491709 | 1,574 | 500 | 746,000 | 229,292 | Accepted | Accepted | 68.23 | import sys
sys.setrecursionlimit(10**9)
def dfs(G, v, p):
seen[v] = True
for nv in G[v]:
if nv == p: continue
if seen[nv]: continue
dfs(G, nv, v)
for c in G[v]:
if c != p: continue
sz[p] += (sz[v]+1)
n, m = list(map(int, input().split()))
ab = []... | import sys
sys.setrecursionlimit(10**7)
def root(x):
if par[x] == x:
return x
else:
par[x] = root(par[x])
return par[x]
def unite(x, y):
x, y = root(x), root(y)
if x == y: return
par[x] = y
def is_same(x, y):
return root(x) == root(y)
n, m = list(m... | 36 | 30 | 669 | 534 | import sys
sys.setrecursionlimit(10**9)
def dfs(G, v, p):
seen[v] = True
for nv in G[v]:
if nv == p:
continue
if seen[nv]:
continue
dfs(G, nv, v)
for c in G[v]:
if c != p:
continue
sz[p] += sz[v] + 1
n, m = list(map(int, input(... | import sys
sys.setrecursionlimit(10**7)
def root(x):
if par[x] == x:
return x
else:
par[x] = root(par[x])
return par[x]
def unite(x, y):
x, y = root(x), root(y)
if x == y:
return
par[x] = y
def is_same(x, y):
return root(x) == root(y)
n, m = list(map(int,... | false | 16.666667 | [
"-sys.setrecursionlimit(10**9)",
"+sys.setrecursionlimit(10**7)",
"-def dfs(G, v, p):",
"- seen[v] = True",
"- for nv in G[v]:",
"- if nv == p:",
"- continue",
"- if seen[nv]:",
"- continue",
"- dfs(G, nv, v)",
"- for c in G[v]:",
"- i... | false | 0.069476 | 0.06751 | 1.029131 | [
"s115689984",
"s684491709"
] |
u814986259 | p02928 | python | s079579095 | s204508105 | 1,039 | 611 | 3,188 | 9,320 | Accepted | Accepted | 41.19 | N,K=list(map(int,input().split()))
A=list(map(int,input().split()))
ans=0
mod=10**9 + 7
for i in range(N):
count=0
for j in range(i+1,N):
if A[i]>A[j]:
count+=1
ans+=count
count=0
for i in range(N):
for j in range(N):
if A[i]>A[j]:
count+=1
ans*=K
ans+=(count%mod)*(K*(K-1... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
count = [[0, 0] for i in range(N)]
for i in range(N):
for j in range(i):
if A[j] < A[i]:
count[i][0] += 1
for j in range(i+1, N):
if A[j] < A[i]:
count[i][1] += 1
ans = 0
mod = 10**9 +... | 21 | 20 | 342 | 459 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(N):
count = 0
for j in range(i + 1, N):
if A[i] > A[j]:
count += 1
ans += count
count = 0
for i in range(N):
for j in range(N):
if A[i] > A[j]:
count ... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
count = [[0, 0] for i in range(N)]
for i in range(N):
for j in range(i):
if A[j] < A[i]:
count[i][0] += 1
for j in range(i + 1, N):
if A[j] < A[i]:
count[i][1] += 1
ans = 0
mod = 10**9 + 7
for i in... | false | 4.761905 | [
"+count = [[0, 0] for i in range(N)]",
"+for i in range(N):",
"+ for j in range(i):",
"+ if A[j] < A[i]:",
"+ count[i][0] += 1",
"+ for j in range(i + 1, N):",
"+ if A[j] < A[i]:",
"+ count[i][1] += 1",
"- count = 0",
"- for j in range(i + 1, N):",
... | false | 0.067549 | 0.036451 | 1.853131 | [
"s079579095",
"s204508105"
] |
u510331904 | p02641 | python | s455217724 | s256559944 | 22 | 20 | 9,184 | 9,176 | Accepted | Accepted | 9.09 | X, N = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
if not X in p:
print(X)
else:
for i in range(1, 101):
if not X - i in p:
print((X - i))
exit()
elif not X + i in p:
print((X + i))
exit() | X, N = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
if X not in p:
print(X)
else:
for i in range(1, 101):
if X - i not in p:
print((X - i))
exit()
elif X + i not in p:
print((X + i))
exit()
| 13 | 13 | 295 | 296 | X, N = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
if not X in p:
print(X)
else:
for i in range(1, 101):
if not X - i in p:
print((X - i))
exit()
elif not X + i in p:
print((X + i))
exit()
| X, N = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
if X not in p:
print(X)
else:
for i in range(1, 101):
if X - i not in p:
print((X - i))
exit()
elif X + i not in p:
print((X + i))
exit()
| false | 0 | [
"-if not X in p:",
"+if X not in p:",
"- if not X - i in p:",
"+ if X - i not in p:",
"- elif not X + i in p:",
"+ elif X + i not in p:"
] | false | 0.053718 | 0.036737 | 1.462252 | [
"s455217724",
"s256559944"
] |
u325282913 | p02900 | python | s835807101 | s954197094 | 285 | 219 | 64,492 | 3,060 | Accepted | Accepted | 23.16 | import fractions
import math
def x(n):
a=[1]
for i in range(2,int(math.sqrt(n))+1):
while n%i==0:
n//=i
a.append(i)
a.append(n)
return a
A,B = list(map(int,input().split()))
n=fractions.gcd(A,B)
print((len(set(x(n))))) | import math
def trial_division(n):
a = [1]
for i in range(2,int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
ans = set(trial_division(A)) & set(trial_division(B))
print((len(ans))) | 13 | 12 | 270 | 304 | import fractions
import math
def x(n):
a = [1]
for i in range(2, int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
n = fractions.gcd(A, B)
print((len(set(x(n)))))
| import math
def trial_division(n):
a = [1]
for i in range(2, int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
ans = set(trial_division(A)) & set(trial_division(B))
print((len(ans)))
| false | 7.692308 | [
"-import fractions",
"-def x(n):",
"+def trial_division(n):",
"-n = fractions.gcd(A, B)",
"-print((len(set(x(n)))))",
"+ans = set(trial_division(A)) & set(trial_division(B))",
"+print((len(ans)))"
] | false | 0.045932 | 0.036044 | 1.274316 | [
"s835807101",
"s954197094"
] |
u970308980 | p03600 | python | s155430627 | s049212943 | 897 | 579 | 55,388 | 55,388 | Accepted | Accepted | 35.45 | import copy
N = int(eval(input()))
A = []
for i in range(N):
A.append(list(map(int, input().split())))
B = copy.deepcopy(A)
for i in range(N):
for j in range(N):
if i == j:
continue
for k in range(N):
if j == k:
continue
if k =... | import copy
N = int(eval(input()))
A = []
for i in range(N):
A.append(list(map(int, input().split())))
B = copy.deepcopy(A)
for i in range(N):
for j in range(i, N):
for k in range(N):
if not (i != j and j != k and k != i):
continue
if A[i][j] > A[i]... | 30 | 26 | 614 | 553 | import copy
N = int(eval(input()))
A = []
for i in range(N):
A.append(list(map(int, input().split())))
B = copy.deepcopy(A)
for i in range(N):
for j in range(N):
if i == j:
continue
for k in range(N):
if j == k:
continue
if k == i:
... | import copy
N = int(eval(input()))
A = []
for i in range(N):
A.append(list(map(int, input().split())))
B = copy.deepcopy(A)
for i in range(N):
for j in range(i, N):
for k in range(N):
if not (i != j and j != k and k != i):
continue
if A[i][j] > A[i][k] + A[k][j]:... | false | 13.333333 | [
"- for j in range(N):",
"- if i == j:",
"- continue",
"+ for j in range(i, N):",
"- if j == k:",
"- continue",
"- if k == i:",
"+ if not (i != j and j != k and k != i):"
] | false | 0.134392 | 0.062253 | 2.158796 | [
"s155430627",
"s049212943"
] |
u549497563 | p03425 | python | s749646494 | s150191956 | 215 | 160 | 3,316 | 10,672 | Accepted | Accepted | 25.58 | from itertools import combinations
from collections import Counter
n = int(eval(input()))
S = Counter()
for i in range(n):
S[input()[0]]+=1
print((sum(S[a]*S[b]*S[c] for a,b,c in combinations("MARCH",3)))) | from itertools import*
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s = [s[i][0] for i in range(n)]
d=[0]*128
for t in s:
d[ord(t[0])]+=1
print((sum(p*q*r for p,q,r in combinations([d[ord(t)] for t in'MARCH'],3)))) | 7 | 8 | 207 | 227 | from itertools import combinations
from collections import Counter
n = int(eval(input()))
S = Counter()
for i in range(n):
S[input()[0]] += 1
print((sum(S[a] * S[b] * S[c] for a, b, c in combinations("MARCH", 3))))
| from itertools import *
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s = [s[i][0] for i in range(n)]
d = [0] * 128
for t in s:
d[ord(t[0])] += 1
print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in "MARCH"], 3))))
| false | 12.5 | [
"-from itertools import combinations",
"-from collections import Counter",
"+from itertools import *",
"-S = Counter()",
"-for i in range(n):",
"- S[input()[0]] += 1",
"-print((sum(S[a] * S[b] * S[c] for a, b, c in combinations(\"MARCH\", 3))))",
"+s = [eval(input()) for i in range(n)]",
"+s = [s... | false | 0.083179 | 0.10365 | 0.802499 | [
"s749646494",
"s150191956"
] |
u252729807 | p02732 | python | s309090894 | s603526016 | 351 | 222 | 46,792 | 34,132 | Accepted | Accepted | 36.75 | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
#%%
d = defaultdict(lambda: 0)
for key in A:
d[key] += 1
#%%
# それぞれのkeyのnC2
cmb = dict()
cmb2 = dict()
for k in list(d.keys()):
cmb[k] = d[k] * (d[k] - 1) // 2
cmb2[k] = (d[k] - 1) * (d[k] - 2) //... | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = Counter(A)
ans = 0
for v in list(cnt.values()):
ans += v * (v - 1) // 2
for k in A:
# n*(n-1)//2 - (n-1)*(n-2)//2 = n - 1
print((ans - (cnt[k] - 1)))
| 25 | 13 | 453 | 261 | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
#%%
d = defaultdict(lambda: 0)
for key in A:
d[key] += 1
#%%
# それぞれのkeyのnC2
cmb = dict()
cmb2 = dict()
for k in list(d.keys()):
cmb[k] = d[k] * (d[k] - 1) // 2
cmb2[k] = (d[k] - 1) * (d[k] - 2) // 2
#%%
ans_d = d... | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = Counter(A)
ans = 0
for v in list(cnt.values()):
ans += v * (v - 1) // 2
for k in A:
# n*(n-1)//2 - (n-1)*(n-2)//2 = n - 1
print((ans - (cnt[k] - 1)))
| false | 48 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-#%%",
"-d = defaultdict(lambda: 0)",
"-for key in A:",
"- d[key] += 1",
"-#%%",
"-# それぞれのkeyのnC2",
"-cmb = dict()",
"-cmb2 = dict()",
"-for k in list(d.keys()):",
"- cmb[k] = d[k] * (d[k] - 1) // 2",
"- cm... | false | 0.046233 | 0.036173 | 1.278098 | [
"s309090894",
"s603526016"
] |
u129836004 | p03476 | python | s973789306 | s381195357 | 1,099 | 864 | 67,960 | 4,980 | Accepted | Accepted | 21.38 | M = 10**6
p = [1]*M
p[0] = p[1] = 0
for i in range(2, 4*10**4):
if p[i]:
for j in range(i*i, M, i):
p[j] = 0
C = [0]*M
for i in range(2, M):
if p[i] and p[(i+1)//2]:
C[i] = C[i-1] + 1
else:
C[i] = C[i-1]
q = int(eval(input()))
for i in range(q):
l, r = ... | M = 10**5+1
p = [1]*M
p[0] = p[1] = 0
for i in range(2, 10**3):
if p[i]:
for j in range(i*i, M, i):
p[j] = 0
C = [0]*M
for i in range(2, M):
if p[i] and p[(i+1)//2]:
C[i] = C[i-1] + 1
else:
C[i] = C[i-1]
q = int(eval(input()))
for i in range(q):
l, r = ... | 17 | 17 | 365 | 365 | M = 10**6
p = [1] * M
p[0] = p[1] = 0
for i in range(2, 4 * 10**4):
if p[i]:
for j in range(i * i, M, i):
p[j] = 0
C = [0] * M
for i in range(2, M):
if p[i] and p[(i + 1) // 2]:
C[i] = C[i - 1] + 1
else:
C[i] = C[i - 1]
q = int(eval(input()))
for i in range(q):
l, r =... | M = 10**5 + 1
p = [1] * M
p[0] = p[1] = 0
for i in range(2, 10**3):
if p[i]:
for j in range(i * i, M, i):
p[j] = 0
C = [0] * M
for i in range(2, M):
if p[i] and p[(i + 1) // 2]:
C[i] = C[i - 1] + 1
else:
C[i] = C[i - 1]
q = int(eval(input()))
for i in range(q):
l, r =... | false | 0 | [
"-M = 10**6",
"+M = 10**5 + 1",
"-for i in range(2, 4 * 10**4):",
"+for i in range(2, 10**3):"
] | false | 1.276793 | 0.248665 | 5.134599 | [
"s973789306",
"s381195357"
] |
u497596438 | p03835 | python | s740373389 | s898938746 | 362 | 277 | 42,204 | 40,924 | Accepted | Accepted | 23.48 | K,S=list(map(int,input().split()))
num=0
for X in range(S+1):
if X>K:
break
for Y in range(S+1):
Z=S-X-Y
if Y<=K and K>=Z>=0:
num+=1
print(num) | K,S=list(map(int,input().split()))
#K=5
#S=15
num=0
for X in range(K+1):
if X>S:
break
for Y in range(K+1):
Z=S-Y-X
if 0<=Z<=K:
num+=1
print(num) | 10 | 13 | 190 | 208 | K, S = list(map(int, input().split()))
num = 0
for X in range(S + 1):
if X > K:
break
for Y in range(S + 1):
Z = S - X - Y
if Y <= K and K >= Z >= 0:
num += 1
print(num)
| K, S = list(map(int, input().split()))
# K=5
# S=15
num = 0
for X in range(K + 1):
if X > S:
break
for Y in range(K + 1):
Z = S - Y - X
if 0 <= Z <= K:
num += 1
print(num)
| false | 23.076923 | [
"+# K=5",
"+# S=15",
"-for X in range(S + 1):",
"- if X > K:",
"+for X in range(K + 1):",
"+ if X > S:",
"- for Y in range(S + 1):",
"- Z = S - X - Y",
"- if Y <= K and K >= Z >= 0:",
"+ for Y in range(K + 1):",
"+ Z = S - Y - X",
"+ if 0 <= Z <= K:"
] | false | 0.037031 | 0.04262 | 0.868868 | [
"s740373389",
"s898938746"
] |
u104171359 | p02408 | python | s739725669 | s347836098 | 30 | 20 | 7,692 | 7,764 | Accepted | Accepted | 33.33 | #!usr/bin/env python3
import sys
def main():
# S: spades
# H: hearts
# C: clubs
# D: diamonds
card_deck = {'S': [], 'H': [], 'C': [], 'D': []}
card_symbols = ['S', 'H', 'C', 'D']
n = int(sys.stdin.readline())
for i in range(n):
lst = [card for card in sys.stdin... | #!usr/bin/env python3
import sys
def init_card_deck():
# S: spades
# H: hearts
# C: clubs
# D: diamonds
card_deck = {'S': [], 'H': [], 'C': [], 'D': []}
n = int(sys.stdin.readline())
for i in range(n):
lst = [card for card in sys.stdin.readline().split()]
c... | 26 | 35 | 570 | 705 | #!usr/bin/env python3
import sys
def main():
# S: spades
# H: hearts
# C: clubs
# D: diamonds
card_deck = {"S": [], "H": [], "C": [], "D": []}
card_symbols = ["S", "H", "C", "D"]
n = int(sys.stdin.readline())
for i in range(n):
lst = [card for card in sys.stdin.readline().split... | #!usr/bin/env python3
import sys
def init_card_deck():
# S: spades
# H: hearts
# C: clubs
# D: diamonds
card_deck = {"S": [], "H": [], "C": [], "D": []}
n = int(sys.stdin.readline())
for i in range(n):
lst = [card for card in sys.stdin.readline().split()]
card_deck[lst[0]].... | false | 25.714286 | [
"-def main():",
"+def init_card_deck():",
"- card_symbols = [\"S\", \"H\", \"C\", \"D\"]",
"+ return card_deck",
"+",
"+",
"+def print_missing_cards(card_deck):",
"+ card_symbols = [\"S\", \"H\", \"C\", \"D\"]",
"+def main():",
"+ print_missing_cards(init_card_deck())",
"+",
"+"
] | false | 0.036043 | 0.03614 | 0.997313 | [
"s739725669",
"s347836098"
] |
u761989513 | p03200 | python | s550000055 | s271584977 | 72 | 43 | 3,500 | 3,500 | Accepted | Accepted | 40.28 | s = eval(input())
ans = 0
count = 0
for i in range(len(s)):
if s[i] == "W":
ans += i - count
count += 1
print(ans) | s = eval(input())
count = 0
ans = 0
for i in s:
if i == "B":
count += 1
else:
ans += count
print(ans) | 8 | 9 | 135 | 127 | s = eval(input())
ans = 0
count = 0
for i in range(len(s)):
if s[i] == "W":
ans += i - count
count += 1
print(ans)
| s = eval(input())
count = 0
ans = 0
for i in s:
if i == "B":
count += 1
else:
ans += count
print(ans)
| false | 11.111111 | [
"+count = 0",
"-count = 0",
"-for i in range(len(s)):",
"- if s[i] == \"W\":",
"- ans += i - count",
"+for i in s:",
"+ if i == \"B\":",
"+ else:",
"+ ans += count"
] | false | 0.035637 | 0.035845 | 0.994192 | [
"s550000055",
"s271584977"
] |
u226155577 | p02973 | python | s961044648 | s969998955 | 1,290 | 127 | 28,188 | 14,092 | Accepted | Accepted | 90.16 | N, *A = list(map(int, open(0).read().split()))
P = [-e for e in set(A)]
P.sort()
P.append(1)
MP = {e: i for i, e in enumerate(P)}
N += 1
data = [0]*(N+1)
def get(k):
r = 0
while k:
r += data[k]
k -= k & -k
return r
def add(k, x):
while k <= N:
data[k] += x
... | from bisect import bisect
N, *A = list(map(int, open(0).read().split()))
D = [1]*(N+1)
D[0] = -10**10
for a in A:
idx = bisect(D, -a)
D[idx] = min(D[idx], -a)
print((bisect(D, 0)-1)) | 36 | 9 | 676 | 191 | N, *A = list(map(int, open(0).read().split()))
P = [-e for e in set(A)]
P.sort()
P.append(1)
MP = {e: i for i, e in enumerate(P)}
N += 1
data = [0] * (N + 1)
def get(k):
r = 0
while k:
r += data[k]
k -= k & -k
return r
def add(k, x):
while k <= N:
data[k] += x
k += k ... | from bisect import bisect
N, *A = list(map(int, open(0).read().split()))
D = [1] * (N + 1)
D[0] = -(10**10)
for a in A:
idx = bisect(D, -a)
D[idx] = min(D[idx], -a)
print((bisect(D, 0) - 1))
| false | 75 | [
"+from bisect import bisect",
"+",
"-P = [-e for e in set(A)]",
"-P.sort()",
"-P.append(1)",
"-MP = {e: i for i, e in enumerate(P)}",
"-N += 1",
"-data = [0] * (N + 1)",
"-",
"-",
"-def get(k):",
"- r = 0",
"- while k:",
"- r += data[k]",
"- k -= k & -k",
"- retu... | false | 0.082988 | 0.007699 | 10.779391 | [
"s961044648",
"s969998955"
] |
u440566786 | p03184 | python | s848051200 | s510951463 | 843 | 518 | 47,852 | 46,572 | Accepted | Accepted | 38.55 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self,n):
fact=[1]*(n+1); invfact=[1]*(n+1)
for i in range(1,n+1): fact[i]=i*fact[i-1]%MOD
invfact[n]=pow(fact[n],MOD... | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact, invfact = [1] * (n + 1), [1] * (n + 1)
for i in range(1, n + 1): fact[i] = i * fact[i - 1] % MOD
... | 56 | 55 | 1,436 | 1,592 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = i * fact[i ... | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact, invfact = [1] * (n + 1), [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = i * fact[i - 1] % MOD
... | false | 1.785714 | [
"-INF = float(\"inf\")",
"+INF = 1 << 60",
"- fact = [1] * (n + 1)",
"- invfact = [1] * (n + 1)",
"+ fact, invfact = [1] * (n + 1), [1] * (n + 1)",
"- self.__fact = fact",
"- self.__invfact = invfact",
"+ self._fact, self._invfact = fact, invfact",
"- ... | false | 0.13035 | 0.068799 | 1.894652 | [
"s848051200",
"s510951463"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.