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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u644907318 | p02612 | python | s634361482 | s161977853 | 80 | 63 | 61,540 | 61,768 | Accepted | Accepted | 21.25 | N = int(eval(input()))
k = N//1000
a = N%1000
if a>0:
ans = 1000-a
else:
ans = 0
print(ans) | import math
N = int(eval(input()))
n = math.ceil(N/1000)
print((1000*n-N)) | 8 | 4 | 100 | 69 | N = int(eval(input()))
k = N // 1000
a = N % 1000
if a > 0:
ans = 1000 - a
else:
ans = 0
print(ans)
| import math
N = int(eval(input()))
n = math.ceil(N / 1000)
print((1000 * n - N))
| false | 50 | [
"+import math",
"+",
"-k = N // 1000",
"-a = N % 1000",
"-if a > 0:",
"- ans = 1000 - a",
"-else:",
"- ans = 0",
"-print(ans)",
"+n = math.ceil(N / 1000)",
"+print((1000 * n - N))"
] | false | 0.044322 | 0.099023 | 0.44759 | [
"s634361482",
"s161977853"
] |
u786020649 | p03575 | python | s159297387 | s838922628 | 52 | 32 | 9,216 | 9,252 | Accepted | Accepted | 38.46 | import sys
read=sys.stdin.read
n,m=list(map(int,input().split()))
edge=[tuple(map(int,lst.split())) for lst in read().splitlines()]
def isconn(v,e0):
clst=[1]*(n+1)
clst[v]=0
for _ in range(n):
for e in edge:
if e!=e0:
tmp=clst[e[1]]&clst[e[0]]
clst[e[1]]=tmp
... | class Unionfind():
def __init__(self,n):
self.parents=[-1]*n
self.ranks=[0]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
self.parents[x]=self.find(self.parents[x])
return self.parents[x]
def union(self,x,y)... | 26 | 43 | 461 | 1,047 | import sys
read = sys.stdin.read
n, m = list(map(int, input().split()))
edge = [tuple(map(int, lst.split())) for lst in read().splitlines()]
def isconn(v, e0):
clst = [1] * (n + 1)
clst[v] = 0
for _ in range(n):
for e in edge:
if e != e0:
tmp = clst[e[1]] & clst[e[0]]
... | class Unionfind:
def __init__(self, n):
self.parents = [-1] * n
self.ranks = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | false | 39.534884 | [
"-import sys",
"+class Unionfind:",
"+ def __init__(self, n):",
"+ self.parents = [-1] * n",
"+ self.ranks = [0] * n",
"-read = sys.stdin.read",
"-n, m = list(map(int, input().split()))",
"-edge = [tuple(map(int, lst.split())) for lst in read().splitlines()]",
"+ def find(self, x... | false | 0.086959 | 0.067572 | 1.286903 | [
"s159297387",
"s838922628"
] |
u029234056 | p03208 | python | s119348011 | s163334247 | 272 | 221 | 7,384 | 7,384 | Accepted | Accepted | 18.75 | N,K=list(map(int,input().split(" ")))
H=[int(eval(input())) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
h1,h2=H[a],H[a+K-1]
tmax=min(tmax,abs(h1-h2))
if(tmax==0):
break
print(tmax) | N,K=list(map(int,input().split()))
H=[int(eval(input())) for _ in range(N)]
H.sort()
tmp=H[K-1]-H[0]
for i in range(0,N-K+1):
if tmp>H[K+i-1]-H[i]:
tmp=H[K+i-1]-H[i]
print(tmp) | 10 | 8 | 215 | 183 | N, K = list(map(int, input().split(" ")))
H = [int(eval(input())) for _ in range(N)]
H.sort()
tmax = 10**9
for a in range(N - K + 1):
h1, h2 = H[a], H[a + K - 1]
tmax = min(tmax, abs(h1 - h2))
if tmax == 0:
break
print(tmax)
| N, K = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort()
tmp = H[K - 1] - H[0]
for i in range(0, N - K + 1):
if tmp > H[K + i - 1] - H[i]:
tmp = H[K + i - 1] - H[i]
print(tmp)
| false | 20 | [
"-N, K = list(map(int, input().split(\" \")))",
"+N, K = list(map(int, input().split()))",
"-tmax = 10**9",
"-for a in range(N - K + 1):",
"- h1, h2 = H[a], H[a + K - 1]",
"- tmax = min(tmax, abs(h1 - h2))",
"- if tmax == 0:",
"- break",
"-print(tmax)",
"+tmp = H[K - 1] - H[0]",
... | false | 0.035385 | 0.033671 | 1.050906 | [
"s119348011",
"s163334247"
] |
u227476288 | p03051 | python | s533840238 | s278670173 | 748 | 674 | 151,768 | 138,528 | Accepted | Accepted | 9.89 | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0]*N
b[0] = A[0]
for n in range(1,N):
b[n] = A[n] ^ b[n-1]
dp = [[not j for i in range(1<<20)] for j in range(2)]
cnt = [0 for i in range(1<<20)]
z = 0
for i in range(N):
if b[i] == 0:
z +=1
dp[0][b... | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0]*N #
b[0] = A[0]
for n in range(1,N):
b[n] = A[n] ^ b[n-1]
#print('累積論理和',b)
m = max(b)
dp = [[0]*(m+1) for j in range(2)]
dp[0] = [True]*(m+1)
dp[1] = [False]*(m+1)
cnt = [0]*(m+1)
z = 0
for i in range(N):
i... | 30 | 34 | 613 | 652 | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0] * N
b[0] = A[0]
for n in range(1, N):
b[n] = A[n] ^ b[n - 1]
dp = [[not j for i in range(1 << 20)] for j in range(2)]
cnt = [0 for i in range(1 << 20)]
z = 0
for i in range(N):
if b[i] == 0:
z += 1
dp[0][b[i]] += dp... | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0] * N #
b[0] = A[0]
for n in range(1, N):
b[n] = A[n] ^ b[n - 1]
# print('累積論理和',b)
m = max(b)
dp = [[0] * (m + 1) for j in range(2)]
dp[0] = [True] * (m + 1)
dp[1] = [False] * (m + 1)
cnt = [0] * (m + 1)
z = 0
for i in range(N):
... | false | 11.764706 | [
"-b = [0] * N",
"+b = [0] * N #",
"-dp = [[not j for i in range(1 << 20)] for j in range(2)]",
"-cnt = [0 for i in range(1 << 20)]",
"+# print('累積論理和',b)",
"+m = max(b)",
"+dp = [[0] * (m + 1) for j in range(2)]",
"+dp[0] = [True] * (m + 1)",
"+dp[1] = [False] * (m + 1)",
"+cnt = [0] * (m + 1)",
... | false | 0.447706 | 0.043045 | 10.400842 | [
"s533840238",
"s278670173"
] |
u631277801 | p03608 | python | s865604764 | s033979161 | 1,441 | 370 | 8,356 | 7,236 | Accepted | Accepted | 74.32 | import sys
stdin = sys.stdin
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 68 | 69 | 1,778 | 1,788 | import sys
stdin = sys.stdin
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
return stdin.readline().r... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 1.449275 | [
"+sys.setrecursionlimit(10**5)",
"+from functools import reduce",
"- searched = [False for _ in range(node)]",
"- if searched[cur_node] or cost > dist[cur_node]:",
"- continue",
"- searched[cur_node] = True",
"- if sum(searched) == node:",
"- break",
"-n... | false | 0.087714 | 0.039331 | 2.230145 | [
"s865604764",
"s033979161"
] |
u120233192 | p02948 | python | s154625749 | s236967200 | 1,979 | 557 | 40,108 | 40,104 | Accepted | Accepted | 71.85 | # 3.4.3
import re
from collections import deque
from functools import reduce
from heapq import heappop
from heapq import heappush
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from sys import ... | # 3.4.3
import re
from collections import deque
from functools import reduce
from heapq import heappop
from heapq import heappush
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from sys import ... | 136 | 138 | 2,982 | 3,015 | # 3.4.3
import re
from collections import deque
from functools import reduce
from heapq import heappop
from heapq import heappush
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from sys import stdin
def rl... | # 3.4.3
import re
from collections import deque
from functools import reduce
from heapq import heappop
from heapq import heappush
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from sys import stdin
def rl... | false | 1.449275 | [
"+ ti = 0",
"- while ab_s and ab_s[0][0] == t:",
"- a, b = ab_s.pop(0)",
"+ while ti < n and ab_s[ti][0] == t:",
"+ a, b = ab_s[ti]",
"+ ti += 1"
] | false | 0.056516 | 0.055293 | 1.022129 | [
"s154625749",
"s236967200"
] |
u577170763 | p02756 | python | s856828919 | s671461321 | 1,792 | 638 | 4,616 | 6,400 | Accepted | Accepted | 64.4 | # standard input
S = eval(input())
Q = int(eval(input()))
Query = []
num_reverse = 0
L = ''
R = ''
rev = False
for _ in range(Q):
q = tuple(map(str, input().split()))
if q[0] == '1':
rev = (not rev)
else:
if (rev and q[1] == '1') or (not rev and q[1] == '2'):
... | # standard input
S = eval(input())
Q = int(eval(input()))
Query = []
num_reverse = 0
L = []
R = []
rev = False
for _ in range(Q):
q = tuple(map(str, input().split()))
if q[0] == '1':
rev = (not rev)
else:
if (rev and q[1] == '1') or (not rev and q[1] == '2'):
... | 28 | 28 | 452 | 496 | # standard input
S = eval(input())
Q = int(eval(input()))
Query = []
num_reverse = 0
L = ""
R = ""
rev = False
for _ in range(Q):
q = tuple(map(str, input().split()))
if q[0] == "1":
rev = not rev
else:
if (rev and q[1] == "1") or (not rev and q[1] == "2"):
R = R + q[2]
e... | # standard input
S = eval(input())
Q = int(eval(input()))
Query = []
num_reverse = 0
L = []
R = []
rev = False
for _ in range(Q):
q = tuple(map(str, input().split()))
if q[0] == "1":
rev = not rev
else:
if (rev and q[1] == "1") or (not rev and q[1] == "2"):
R.append(q[2])
... | false | 0 | [
"-L = \"\"",
"-R = \"\"",
"+L = []",
"+R = []",
"- R = R + q[2]",
"+ R.append(q[2])",
"- L = q[2] + L",
"+ L.append(q[2])",
"- print((R[::-1] + S[::-1] + L[::-1]))",
"+ print((\"\".join(reversed(R)) + S[::-1] + \"\".join(L)))",
"- print((L + S... | false | 0.045977 | 0.045891 | 1.001868 | [
"s856828919",
"s671461321"
] |
u593567568 | p02727 | python | s862522735 | s847378011 | 418 | 248 | 105,444 | 23,616 | Accepted | Accepted | 40.67 | import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(m... | import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(m... | 56 | 25 | 910 | 514 | import sys
from collections import deque
sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input(... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input(... | false | 55.357143 | [
"-R.sort()",
"+R.sort(reverse=True)",
"-ans = sum(P[:X]) + sum(Q[:Y])",
"-p = P.pop()",
"-q = Q.pop()",
"-r = R.pop()",
"-INF = 10**10",
"-while True:",
"- m = min(p, q, r)",
"- if m == r or m == INF:",
"- break",
"- if m == p:",
"- ans += r - p",
"- if P:",
... | false | 0.033802 | 0.03635 | 0.929919 | [
"s862522735",
"s847378011"
] |
u094191970 | p03578 | python | s740283802 | s357886148 | 303 | 249 | 57,048 | 44,732 | Accepted | Accepted | 17.82 | from collections import Counter
n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))
d_c=Counter(d)
t_c=Counter(t)
for i in list(t_c.keys()):
if t_c[i]>d_c[i]:
print('NO')
exit()
print('YES') | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter
n=int(eval(input()))
d=lnii()
m=int(eval(input()))
t=lnii()
c=Counter(d)
for i in t:
if c[i]==0:
print('NO')
exit()
else:
c[i]-=1... | 13 | 19 | 261 | 318 | from collections import Counter
n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))
d_c = Counter(d)
t_c = Counter(t)
for i in list(t_c.keys()):
if t_c[i] > d_c[i]:
print("NO")
exit()
print("YES")
| from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import Counter
n = int(eval(input()))
d = lnii()
m = int(eval(input()))
t = lnii()
c = Counter(d)
for i in t:
if c[i] == 0:
print("NO")
exit()
e... | false | 31.578947 | [
"+from sys import stdin",
"+",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"-d = list(map(int, input().split()))",
"+d = lnii()",
"-t = list(map(int, input().split()))",
"-d_c = Counter(d)",
"-t_c = Counter(t)",
"-for i in ... | false | 0.075012 | 0.03931 | 1.908227 | [
"s740283802",
"s357886148"
] |
u254871849 | p02947 | python | s093891709 | s069480800 | 356 | 190 | 29,540 | 28,288 | Accepted | Accepted | 46.63 | # 2019-11-16 14:51:41(JST)
import sys
import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
from scipy.misc impo... | import sys
from collections import Counter
n, *s = sys.stdin.read().split()
n = int(n)
def comb_2(n):
return n * (n - 1) // 2
def main():
t = [''.join(sorted(t)) for t in s]
c = Counter(t)
pairs_cnt = 0
for v in list(c.values()):
pairs_cnt += comb_2(v)
return pa... | 30 | 22 | 767 | 389 | # 2019-11-16 14:51:41(JST)
import sys
import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
from scipy.misc import comb ... | import sys
from collections import Counter
n, *s = sys.stdin.read().split()
n = int(n)
def comb_2(n):
return n * (n - 1) // 2
def main():
t = ["".join(sorted(t)) for t in s]
c = Counter(t)
pairs_cnt = 0
for v in list(c.values()):
pairs_cnt += comb_2(v)
return pairs_cnt
if __name__... | false | 26.666667 | [
"-# 2019-11-16 14:51:41(JST)",
"-import collections",
"+from collections import Counter",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l",
"-# import itertools",
"-# from functool... | false | 0.452628 | 0.122778 | 3.68655 | [
"s093891709",
"s069480800"
] |
u320567105 | p03253 | python | s293609434 | s222011104 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
N,M=rl()
DIV = 10**9 + 7
def f... | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
N,M=rl()
DIV = 10**9 + 7
def f... | 38 | 38 | 838 | 834 | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
yn = lambda b: print("Yes") if b else print("No")
OE = lambda x: print("Odd") if x % 2 else print("Even")
INF = 10**18
N, M = rl()
DIV = 10**9 + 7
def factor... | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
yn = lambda b: print("Yes") if b else print("No")
OE = lambda x: print("Odd") if x % 2 else print("Even")
INF = 10**18
N, M = rl()
DIV = 10**9 + 7
def factor... | false | 0 | [
"- res *= (N - 1 + i - j) % DIV",
"+ res *= N - 1 + i - j"
] | false | 0.047763 | 0.007931 | 6.022399 | [
"s293609434",
"s222011104"
] |
u079022693 | p02676 | python | s630054214 | s240746465 | 24 | 21 | 9,172 | 9,100 | Accepted | Accepted | 12.5 | from sys import stdin
def main():
#入力
readline=stdin.readline
K=int(readline())
S=readline().strip()
if len(S)<=K:
print(S)
else:
print((S[:K]+"..."))
if __name__=="__main__":
main() | K=int(eval(input()))
S=eval(input())
print((S if len(S)<=K else S[:K]+"...")) | 13 | 3 | 237 | 65 | from sys import stdin
def main():
# 入力
readline = stdin.readline
K = int(readline())
S = readline().strip()
if len(S) <= K:
print(S)
else:
print((S[:K] + "..."))
if __name__ == "__main__":
main()
| K = int(eval(input()))
S = eval(input())
print((S if len(S) <= K else S[:K] + "..."))
| false | 76.923077 | [
"-from sys import stdin",
"-",
"-",
"-def main():",
"- # 入力",
"- readline = stdin.readline",
"- K = int(readline())",
"- S = readline().strip()",
"- if len(S) <= K:",
"- print(S)",
"- else:",
"- print((S[:K] + \"...\"))",
"-",
"-",
"-if __name__ == \"__mai... | false | 0.041963 | 0.04121 | 1.018263 | [
"s630054214",
"s240746465"
] |
u968166680 | p02936 | python | s450396577 | s445794747 | 751 | 636 | 101,408 | 143,248 | Accepted | Accepted | 15.31 | import sys
from collections import deque
read = sys.stdin.buffer.read
def main():
N, Q, *ABPX = list(map(int, read().split()))
A = ABPX[0 : 2 * N - 2 : 2]
B = ABPX[1 : 2 * N - 2 : 2]
P = ABPX[2 * N - 2 :: 2]
X = ABPX[2 * N - 1 :: 2]
G = [[] for _ in range(N)]
for a, b in ... | import sys
from collections import deque
read = sys.stdin.buffer.read
def main():
N, Q, *ABPX = list(map(int, read().split()))
G = [[] for _ in range(N)]
for a, b in zip(ABPX[0 : 2 * N - 2 : 2], ABPX[1 : 2 * N - 2 : 2]):
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
X = [0... | 42 | 35 | 812 | 762 | import sys
from collections import deque
read = sys.stdin.buffer.read
def main():
N, Q, *ABPX = list(map(int, read().split()))
A = ABPX[0 : 2 * N - 2 : 2]
B = ABPX[1 : 2 * N - 2 : 2]
P = ABPX[2 * N - 2 :: 2]
X = ABPX[2 * N - 1 :: 2]
G = [[] for _ in range(N)]
for a, b in zip(A, B):
... | import sys
from collections import deque
read = sys.stdin.buffer.read
def main():
N, Q, *ABPX = list(map(int, read().split()))
G = [[] for _ in range(N)]
for a, b in zip(ABPX[0 : 2 * N - 2 : 2], ABPX[1 : 2 * N - 2 : 2]):
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
X = [0] * N
fo... | false | 16.666667 | [
"- A = ABPX[0 : 2 * N - 2 : 2]",
"- B = ABPX[1 : 2 * N - 2 : 2]",
"- P = ABPX[2 * N - 2 :: 2]",
"- X = ABPX[2 * N - 1 :: 2]",
"- for a, b in zip(A, B):",
"+ for a, b in zip(ABPX[0 : 2 * N - 2 : 2], ABPX[1 : 2 * N - 2 : 2]):",
"- Y = [0] * N",
"- for p, x in zip(P, X):",
"- ... | false | 0.037132 | 0.035895 | 1.034454 | [
"s450396577",
"s445794747"
] |
u780475861 | p03341 | python | s961924839 | s051051537 | 214 | 45 | 24,648 | 3,572 | Accepted | Accepted | 78.97 | _, s = open(0).read().split()
left, right = [0], []
lw, re = 0, 0
for i in s:
if i == 'W':
lw += 1
left += [lw]
for i in s[::-1]:
if i == 'E':
re += 1
right += [re]
print((min(i + j for i, j in zip(left[:-1], right[-2::-1] + [0])))) | def main():
_, s = open(0).read().split()
w, res = 0, 0
for i in s:
if i == 'W':
w += 1
elif w:
w -= 1
res += 1
else:
pass
return res
if __name__ == '__main__':
print((main())) | 12 | 16 | 257 | 237 | _, s = open(0).read().split()
left, right = [0], []
lw, re = 0, 0
for i in s:
if i == "W":
lw += 1
left += [lw]
for i in s[::-1]:
if i == "E":
re += 1
right += [re]
print((min(i + j for i, j in zip(left[:-1], right[-2::-1] + [0]))))
| def main():
_, s = open(0).read().split()
w, res = 0, 0
for i in s:
if i == "W":
w += 1
elif w:
w -= 1
res += 1
else:
pass
return res
if __name__ == "__main__":
print((main()))
| false | 25 | [
"-_, s = open(0).read().split()",
"-left, right = [0], []",
"-lw, re = 0, 0",
"-for i in s:",
"- if i == \"W\":",
"- lw += 1",
"- left += [lw]",
"-for i in s[::-1]:",
"- if i == \"E\":",
"- re += 1",
"- right += [re]",
"-print((min(i + j for i, j in zip(left[:-1], rig... | false | 0.030525 | 0.034698 | 0.879735 | [
"s961924839",
"s051051537"
] |
u925626880 | p03478 | python | s864772809 | s803826581 | 34 | 31 | 3,060 | 2,940 | Accepted | Accepted | 8.82 | N, A, B = list(map(int, input().split()))
ans = 0
for n in range(N+1):
if A <= sum(int(c) for c in str(n)) <= B:
ans += n
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
print((sum(n for n in range(N+1) if A <= sum(int(c) for c in str(n)) <= B)))
| 9 | 5 | 150 | 125 | N, A, B = list(map(int, input().split()))
ans = 0
for n in range(N + 1):
if A <= sum(int(c) for c in str(n)) <= B:
ans += n
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
print((sum(n for n in range(N + 1) if A <= sum(int(c) for c in str(n)) <= B)))
| false | 44.444444 | [
"-for n in range(N + 1):",
"- if A <= sum(int(c) for c in str(n)) <= B:",
"- ans += n",
"-print(ans)",
"+print((sum(n for n in range(N + 1) if A <= sum(int(c) for c in str(n)) <= B)))"
] | false | 0.038147 | 0.038271 | 0.996752 | [
"s864772809",
"s803826581"
] |
u060896757 | p02690 | python | s189383731 | s213699165 | 71 | 63 | 67,608 | 65,700 | Accepted | Accepted | 11.27 | X = int(eval(input()))
A = 0
B = 0
for i in range(10 ** 3):
for j in range(- 10 ** 3, 10 ** 3):
if i ** 5 - j ** 5 == X:
A = i
B = j
print((A, B)) | X = int(eval(input()))
A = 0
B = 0
for a in range(1, 200):
for b in range(-200, 200):
if a ** 5 - b ** 5 == X:
A = a
B = b
print((A, B)) | 9 | 9 | 182 | 172 | X = int(eval(input()))
A = 0
B = 0
for i in range(10**3):
for j in range(-(10**3), 10**3):
if i**5 - j**5 == X:
A = i
B = j
print((A, B))
| X = int(eval(input()))
A = 0
B = 0
for a in range(1, 200):
for b in range(-200, 200):
if a**5 - b**5 == X:
A = a
B = b
print((A, B))
| false | 0 | [
"-for i in range(10**3):",
"- for j in range(-(10**3), 10**3):",
"- if i**5 - j**5 == X:",
"- A = i",
"- B = j",
"+for a in range(1, 200):",
"+ for b in range(-200, 200):",
"+ if a**5 - b**5 == X:",
"+ A = a",
"+ B = b"
] | false | 2.672834 | 0.393588 | 6.790938 | [
"s189383731",
"s213699165"
] |
u119148115 | p03275 | python | s217047783 | s180048776 | 1,078 | 741 | 182,776 | 158,756 | Accepted | Accepted | 31.26 | import sys
from itertools import accumulate
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
class BIT:
def __init__(self,init_value):
self.n = len(init_value)
self.tree = [0]*(self.n+1)
for i in range... | # 座標圧縮した場合
import sys
from itertools import accumulate
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
class BIT:
def __init__(self,init_value):
self.n = len(init_value)
self.tree = [0]*(self.n+1)
... | 60 | 69 | 1,396 | 1,644 | import sys
from itertools import accumulate
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
class BIT:
def __init__(self, init_value):
self.n = len(init_value)
self.tree = [0] * (self.n + 1)
for i... | # 座標圧縮した場合
import sys
from itertools import accumulate
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
class BIT:
def __init__(self, init_value):
self.n = len(init_value)
self.tree = [0] * (self.n + 1)
... | false | 13.043478 | [
"+# 座標圧縮した場合",
"+C = sorted(list(set(A)))",
"+dict_A = {} # dict_A[a] = (a は A の中で何番目に小さい値か)",
"+dict_C = {} # dict_C[i] = (A の中で i 番目に小さい値)",
"+for i in range(1, len(C) + 1):",
"+ dict_C[i] = C[i - 1]",
"+ dict_A[C[i - 1]] = i",
"+A = [dict_A[a] for a in A]",
"-ng = 10**9 + 1",
"+ng = 10*... | false | 0.038849 | 0.044744 | 0.868257 | [
"s217047783",
"s180048776"
] |
u077291787 | p03325 | python | s418069313 | s688476446 | 87 | 24 | 4,148 | 4,212 | Accepted | Accepted | 72.41 | # ABC100C - *3 or /2
n = int(eval(input()))
lst = [i for i in list(map(int, input().rstrip().split())) if i % 2 == 0]
if lst == []:
print((0))
else:
ans = 0
for i in lst:
cnt = 0
while i % 2 == 0:
i //= 2
cnt += 1
ans += cnt
print(ans) | # ABC100C - *3 or /2
def main():
N, *A = list(map(int, open(0).read().split()))
ans = sum(bin(i)[::-1].index("1") for i in A)
print(ans)
if __name__ == "__main__":
main() | 14 | 9 | 304 | 190 | # ABC100C - *3 or /2
n = int(eval(input()))
lst = [i for i in list(map(int, input().rstrip().split())) if i % 2 == 0]
if lst == []:
print((0))
else:
ans = 0
for i in lst:
cnt = 0
while i % 2 == 0:
i //= 2
cnt += 1
ans += cnt
print(ans)
| # ABC100C - *3 or /2
def main():
N, *A = list(map(int, open(0).read().split()))
ans = sum(bin(i)[::-1].index("1") for i in A)
print(ans)
if __name__ == "__main__":
main()
| false | 35.714286 | [
"-n = int(eval(input()))",
"-lst = [i for i in list(map(int, input().rstrip().split())) if i % 2 == 0]",
"-if lst == []:",
"- print((0))",
"-else:",
"- ans = 0",
"- for i in lst:",
"- cnt = 0",
"- while i % 2 == 0:",
"- i //= 2",
"- cnt += 1",
"- ... | false | 0.124885 | 0.051933 | 2.404726 | [
"s418069313",
"s688476446"
] |
u729133443 | p02928 | python | s919847273 | s019494519 | 1,071 | 909 | 3,188 | 3,188 | Accepted | Accepted | 15.13 | n,k,*a=list(map(int,open(0).read().split()))
print((sum(k*~-k//2*(c<d)+k*-~k//2*(c>d)for i,c in enumerate(a)for d in a[i:])%(10**9+7))) | n,k,*a=list(map(int,open(0).read().split()))
print((sum(k*~-k*(c<d)+k*-~k*(c>d)>>1for i,c in enumerate(a)for d in a[i:])%(10**9+7))) | 2 | 2 | 128 | 125 | n, k, *a = list(map(int, open(0).read().split()))
print(
(
sum(
k * ~-k // 2 * (c < d) + k * -~k // 2 * (c > d)
for i, c in enumerate(a)
for d in a[i:]
)
% (10**9 + 7)
)
)
| n, k, *a = list(map(int, open(0).read().split()))
print(
(
sum(
k * ~-k * (c < d) + k * -~k * (c > d) >> 1
for i, c in enumerate(a)
for d in a[i:]
)
% (10**9 + 7)
)
)
| false | 0 | [
"- k * ~-k // 2 * (c < d) + k * -~k // 2 * (c > d)",
"+ k * ~-k * (c < d) + k * -~k * (c > d) >> 1"
] | false | 0.069622 | 0.140881 | 0.49419 | [
"s919847273",
"s019494519"
] |
u655761160 | p03796 | python | s231059952 | s827562211 | 35 | 29 | 2,940 | 2,940 | Accepted | Accepted | 17.14 | N = int(eval(input()))
ans = 1
for i in range(2, N + 1):
ans = (ans * i) % (10**9 + 7)
print(ans) | def factorial(N):
fact = 1
for i in range(2, N + 1):
fact = (fact * i) % (10**9 + 7)
return fact
if __name__ == "__main__":
N = int(eval(input()))
print((factorial(N))) | 5 | 10 | 99 | 199 | N = int(eval(input()))
ans = 1
for i in range(2, N + 1):
ans = (ans * i) % (10**9 + 7)
print(ans)
| def factorial(N):
fact = 1
for i in range(2, N + 1):
fact = (fact * i) % (10**9 + 7)
return fact
if __name__ == "__main__":
N = int(eval(input()))
print((factorial(N)))
| false | 50 | [
"-N = int(eval(input()))",
"-ans = 1",
"-for i in range(2, N + 1):",
"- ans = (ans * i) % (10**9 + 7)",
"-print(ans)",
"+def factorial(N):",
"+ fact = 1",
"+ for i in range(2, N + 1):",
"+ fact = (fact * i) % (10**9 + 7)",
"+ return fact",
"+",
"+",
"+if __name__ == \"__ma... | false | 0.146421 | 0.041171 | 3.556424 | [
"s231059952",
"s827562211"
] |
u343977188 | p03814 | python | s110093339 | s525839156 | 36 | 30 | 9,276 | 9,252 | Accepted | Accepted | 16.67 | def main():
s=str(eval(input()))
l=len(s)
f=None
e=None
for i in range(l):
if s[i]=='A':
f=i
break
for i in range(1,l):
if s[-i]=='Z':
e=l-i
break
print((e-f+1))
if __name__ == "__main__":
main() | def main():
s=str(eval(input()))
print((s.rfind("Z") - s.find("A") + 1))
if __name__ == "__main__":
main() | 16 | 5 | 252 | 110 | def main():
s = str(eval(input()))
l = len(s)
f = None
e = None
for i in range(l):
if s[i] == "A":
f = i
break
for i in range(1, l):
if s[-i] == "Z":
e = l - i
break
print((e - f + 1))
if __name__ == "__main__":
main()
| def main():
s = str(eval(input()))
print((s.rfind("Z") - s.find("A") + 1))
if __name__ == "__main__":
main()
| false | 68.75 | [
"- l = len(s)",
"- f = None",
"- e = None",
"- for i in range(l):",
"- if s[i] == \"A\":",
"- f = i",
"- break",
"- for i in range(1, l):",
"- if s[-i] == \"Z\":",
"- e = l - i",
"- break",
"- print((e - f + 1))",
"+... | false | 0.04412 | 0.043845 | 1.006271 | [
"s110093339",
"s525839156"
] |
u729133443 | p02690 | python | s443173329 | s917989472 | 968 | 35 | 455,104 | 9,060 | Accepted | Accepted | 96.38 | m=5**6
exec(f'i,j=m%128,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));'*2*m) | i=j=x=int(eval(input()))
while(i:=-~i%127)**5-j**5-x:j=j%257-i
print((i,j)) | 2 | 3 | 79 | 69 | m = 5**6
exec(f"i,j=m%128,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));" * 2 * m)
| i = j = x = int(eval(input()))
while (i := -~i % 127) ** 5 - j**5 - x:
j = j % 257 - i
print((i, j))
| false | 33.333333 | [
"-m = 5**6",
"-exec(f\"i,j=m%128,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));\" * 2 * m)",
"+i = j = x = int(eval(input()))",
"+while (i := -~i % 127) ** 5 - j**5 - x:",
"+ j = j % 257 - i",
"+print((i, j))"
] | false | 2.174644 | 0.069669 | 31.213993 | [
"s443173329",
"s917989472"
] |
u150984829 | p02386 | python | s347965915 | s447670102 | 40 | 30 | 5,660 | 5,660 | Accepted | Accepted | 25 | from itertools import*
n=int(eval(input()))
a=[input().split()for _ in[0]*n]
for b in a:
b[3:5]=b[4],b[3]
def f():
for d,e in combinations(a,2):
for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
f=[d[i]for i in p]
if f[0]==e[0]and f[5]==e[5]:
f=f[1:5]... | from itertools import*
n=int(eval(input()))
a=[input().split()for _ in[0]*n]
for b in a:
b[3:5]=b[4],b[3]
def g():
for d,e in combinations(a,2):
for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
f=[d[i]for i in p]
if f[0::5]==e[0::5]:
f=f[1:5]*2
... | 15 | 15 | 404 | 396 | from itertools import *
n = int(eval(input()))
a = [input().split() for _ in [0] * n]
for b in a:
b[3:5] = b[4], b[3]
def f():
for d, e in combinations(a, 2):
for p in (
[0, 1, 2, 3, 4, 5],
[1, 5, 2, 0, 4, 3],
[2, 1, 5, 3, 0, 4],
[3, 0, 2, 5, 4, 1],
... | from itertools import *
n = int(eval(input()))
a = [input().split() for _ in [0] * n]
for b in a:
b[3:5] = b[4], b[3]
def g():
for d, e in combinations(a, 2):
for p in (
[0, 1, 2, 3, 4, 5],
[1, 5, 2, 0, 4, 3],
[2, 1, 5, 3, 0, 4],
[3, 0, 2, 5, 4, 1],
... | false | 0 | [
"-def f():",
"+def g():",
"- if f[0] == e[0] and f[5] == e[5]:",
"+ if f[0::5] == e[0::5]:",
"-print((f()))",
"+print((g()))"
] | false | 0.047963 | 0.047667 | 1.006207 | [
"s347965915",
"s447670102"
] |
u197955752 | p03244 | python | s666309256 | s498115479 | 121 | 100 | 17,432 | 21,184 | Accepted | Accepted | 17.36 | from collections import defaultdict
n = int(eval(input()))
v = [int(x) for x in input().split()]
even_ocr = defaultdict(int) # v[0], v[2], ..., で各数が何回現れるか
odd_ocr = defaultdict(int) # v[1], v[3], ..., で各数が何回現れるか
for i in range(n // 2):
even_ocr[v[2 * i]] += 1
odd_ocr[v[2 * i + 1]] += 1
even_max_n... | from collections import defaultdict, Counter
n = int(eval(input()))
v = [int(x) for x in input().split()]
cnt_even = Counter(v[0::2])
cnt_odd = Counter(v[1::2])
# [(要素, 出現回数), (要素, 出現回数), ....]
common_even = cnt_even.most_common()
common_odd = cnt_odd.most_common()
if len(common_even) == 1: # 1種類の数しかない
... | 46 | 23 | 1,372 | 669 | from collections import defaultdict
n = int(eval(input()))
v = [int(x) for x in input().split()]
even_ocr = defaultdict(int) # v[0], v[2], ..., で各数が何回現れるか
odd_ocr = defaultdict(int) # v[1], v[3], ..., で各数が何回現れるか
for i in range(n // 2):
even_ocr[v[2 * i]] += 1
odd_ocr[v[2 * i + 1]] += 1
even_max_num = 0
even_... | from collections import defaultdict, Counter
n = int(eval(input()))
v = [int(x) for x in input().split()]
cnt_even = Counter(v[0::2])
cnt_odd = Counter(v[1::2])
# [(要素, 出現回数), (要素, 出現回数), ....]
common_even = cnt_even.most_common()
common_odd = cnt_odd.most_common()
if len(common_even) == 1: # 1種類の数しかない
common_eve... | false | 50 | [
"-from collections import defaultdict",
"+from collections import defaultdict, Counter",
"-even_ocr = defaultdict(int) # v[0], v[2], ..., で各数が何回現れるか",
"-odd_ocr = defaultdict(int) # v[1], v[3], ..., で各数が何回現れるか",
"-for i in range(n // 2):",
"- even_ocr[v[2 * i]] += 1",
"- odd_ocr[v[2 * i + 1]] +=... | false | 0.040902 | 0.041953 | 0.974947 | [
"s666309256",
"s498115479"
] |
u968166680 | p02722 | python | s966122027 | s948912640 | 93 | 84 | 66,228 | 65,760 | Accepted | Accepted | 9.68 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
lower.append(i)
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
lower.append(i)
... | 43 | 43 | 771 | 757 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
lower.append(i)
if i != n //... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
lower.append(i)
if i != n //... | false | 0 | [
"- if (n - 1) % d == 0:",
"- ans += 1",
"+ if n % d == 1:",
"+ ans += 1"
] | false | 0.084867 | 0.08533 | 0.99457 | [
"s966122027",
"s948912640"
] |
u564902833 | p03007 | python | s165347245 | s159967521 | 443 | 199 | 68,620 | 21,944 | Accepted | Accepted | 55.08 | N = int(eval(input()))
A = list(map(int, input().split()))
x = []
y = []
P = sorted((a for a in A if a >= 0), reverse=True)
Q = sorted(a for a in A if a < 0)
if not Q:
M = sum(P[:-2]) + (P[-2] - P[-1])
for _ in range(N - 2):
X = P.pop()
Y = P.pop()
x.append(X)
y.app... | # 入力
N = int(eval(input()))
A = list(map(int, input().split()))
# 正-負をなるべく多く達成するように操作する
P = sorted((a for a in A if a >= 0), reverse=True)
Q = sorted(a for a in A if a < 0)
x, y = [], []
if len(P) == 2 and not Q:
Y, X = P.pop(), P.pop()
x.append(X)
y.append(Y)
P.append(X - Y)
if len(P) >... | 46 | 47 | 1,038 | 906 | N = int(eval(input()))
A = list(map(int, input().split()))
x = []
y = []
P = sorted((a for a in A if a >= 0), reverse=True)
Q = sorted(a for a in A if a < 0)
if not Q:
M = sum(P[:-2]) + (P[-2] - P[-1])
for _ in range(N - 2):
X = P.pop()
Y = P.pop()
x.append(X)
y.append(Y)
... | # 入力
N = int(eval(input()))
A = list(map(int, input().split()))
# 正-負をなるべく多く達成するように操作する
P = sorted((a for a in A if a >= 0), reverse=True)
Q = sorted(a for a in A if a < 0)
x, y = [], []
if len(P) == 2 and not Q:
Y, X = P.pop(), P.pop()
x.append(X)
y.append(Y)
P.append(X - Y)
if len(P) >= 3 and not Q:
... | false | 2.12766 | [
"+# 入力",
"-x = []",
"-y = []",
"+# 正-負をなるべく多く達成するように操作する",
"-if not Q:",
"- M = sum(P[:-2]) + (P[-2] - P[-1])",
"- for _ in range(N - 2):",
"- X = P.pop()",
"- Y = P.pop()",
"- x.append(X)",
"- y.append(Y)",
"- P.append(X - Y)",
"- Y = P.pop()",
... | false | 0.042397 | 0.04252 | 0.997112 | [
"s165347245",
"s159967521"
] |
u077337864 | p03253 | python | s303045877 | s327448392 | 820 | 21 | 40,044 | 3,316 | Accepted | Accepted | 97.44 | n, m = list(map(int, input().split()))
yd = {}
i = 2
while m != 1:
while m % i == 0:
if i in yd:
yd[i] += 1
else:
yd[i] = 1
m //= i
i += 1
ans = 1
for v in list(yd.values()):
start = v + n - 1
c = 1
for _ in range(v):
c *= start
start -= 1
d = 1
for _... | import sys
from collections import defaultdict
sys.setrecursionlimit(100000)
MOD = pow(10, 9) + 7
def powmod(m, p):
if p == 0:
return 1
tmp = powmod(m, p // 2)
if p & 1:
return (tmp * tmp % MOD) * m % MOD
else:
return tmp * tmp % MOD
def main():
n, m = list... | 25 | 44 | 386 | 886 | n, m = list(map(int, input().split()))
yd = {}
i = 2
while m != 1:
while m % i == 0:
if i in yd:
yd[i] += 1
else:
yd[i] = 1
m //= i
i += 1
ans = 1
for v in list(yd.values()):
start = v + n - 1
c = 1
for _ in range(v):
c *= start
start -... | import sys
from collections import defaultdict
sys.setrecursionlimit(100000)
MOD = pow(10, 9) + 7
def powmod(m, p):
if p == 0:
return 1
tmp = powmod(m, p // 2)
if p & 1:
return (tmp * tmp % MOD) * m % MOD
else:
return tmp * tmp % MOD
def main():
n, m = list(map(int, inpu... | false | 43.181818 | [
"-n, m = list(map(int, input().split()))",
"-yd = {}",
"-i = 2",
"-while m != 1:",
"- while m % i == 0:",
"- if i in yd:",
"- yd[i] += 1",
"- else:",
"- yd[i] = 1",
"- m //= i",
"- i += 1",
"-ans = 1",
"-for v in list(yd.values()):",
"- s... | false | 0.112301 | 0.038545 | 2.913513 | [
"s303045877",
"s327448392"
] |
u844789719 | p02625 | python | s825919252 | s981742468 | 997 | 787 | 95,816 | 52,428 | Accepted | Accepted | 21.06 | class Factorial:
def __init__(self, max_fact, mod):
#mod should be prime number
#using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
f = [1] * (max_fact + 1)
for idx in range(2, max_fact + 1):
f[idx] = f[idx - 1] * idx
f[idx] %= mod
fi = [pow... | class Factorial:
def __init__(self, max_fact, mod):
#mod should be prime number
#using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
f = [1] * (max_fact + 1)
for idx in range(2, max_fact + 1):
f[idx] = f[idx - 1] * idx
f[idx] %= mod
fi = [pow... | 50 | 50 | 1,344 | 1,346 | class Factorial:
def __init__(self, max_fact, mod):
# mod should be prime number
# using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
f = [1] * (max_fact + 1)
for idx in range(2, max_fact + 1):
f[idx] = f[idx - 1] * idx
f[idx] %= mod
fi = [pow(f[-1]... | class Factorial:
def __init__(self, max_fact, mod):
# mod should be prime number
# using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
f = [1] * (max_fact + 1)
for idx in range(2, max_fact + 1):
f[idx] = f[idx - 1] * idx
f[idx] %= mod
fi = [pow(f[-1]... | false | 0 | [
"-max_fact = 10**6",
"+max_fact = 5 * 10**5"
] | false | 1.383975 | 1.193605 | 1.159492 | [
"s825919252",
"s981742468"
] |
u018679195 | p03556 | python | s929747504 | s172346272 | 184 | 21 | 38,768 | 3,316 | Accepted | Accepted | 88.59 | import math
n = int(eval(input()))
for i in range (n,0,-1):
ans= math.sqrt(i)
sq= int(ans)
sq=float(sq)
#print(ans,sq)
if sq==ans:
print(i)
break
| import sys
def fastio():
from io import StringIO
from atexit import register
global input
sys.stdin = StringIO(sys.stdin.read())
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.stdout = StringIO()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
IN... | 12 | 21 | 189 | 586 | import math
n = int(eval(input()))
for i in range(n, 0, -1):
ans = math.sqrt(i)
sq = int(ans)
sq = float(sq)
# print(ans,sq)
if sq == ans:
print(i)
break
| import sys
def fastio():
from io import StringIO
from atexit import register
global input
sys.stdin = StringIO(sys.stdin.read())
input = lambda: sys.stdin.readline().rstrip("\r\n")
sys.stdout = StringIO()
register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10**2... | false | 42.857143 | [
"-import math",
"+import sys",
"-n = int(eval(input()))",
"-for i in range(n, 0, -1):",
"- ans = math.sqrt(i)",
"- sq = int(ans)",
"- sq = float(sq)",
"- # print(ans,sq)",
"- if sq == ans:",
"- print(i)",
"- break",
"+",
"+def fastio():",
"+ from io import S... | false | 0.142105 | 0.131933 | 1.077095 | [
"s929747504",
"s172346272"
] |
u644907318 | p02987 | python | s453161457 | s225926951 | 167 | 69 | 38,256 | 61,844 | Accepted | Accepted | 58.68 | S = input().strip()
C = {}
for i in range(4):
a = S[i]
if a not in C:
C[a] = 0
C[a] += 1
C = list(C.items())
if len(C)==2 and C[0][1]==2:
print("Yes")
else:
print("No") | S = input().strip()
C = {}
for i in range(len(S)):
if S[i] not in C:
C[S[i]] = 0
C[S[i]] += 1
if len(C)==2:
flag = 0
for a in C:
if C[a]!=2:
flag = 1
break
if flag==0:
print("Yes")
else:
print("No")
else:
print("No") | 12 | 18 | 207 | 317 | S = input().strip()
C = {}
for i in range(4):
a = S[i]
if a not in C:
C[a] = 0
C[a] += 1
C = list(C.items())
if len(C) == 2 and C[0][1] == 2:
print("Yes")
else:
print("No")
| S = input().strip()
C = {}
for i in range(len(S)):
if S[i] not in C:
C[S[i]] = 0
C[S[i]] += 1
if len(C) == 2:
flag = 0
for a in C:
if C[a] != 2:
flag = 1
break
if flag == 0:
print("Yes")
else:
print("No")
else:
print("No")
| false | 33.333333 | [
"-for i in range(4):",
"- a = S[i]",
"- if a not in C:",
"- C[a] = 0",
"- C[a] += 1",
"-C = list(C.items())",
"-if len(C) == 2 and C[0][1] == 2:",
"- print(\"Yes\")",
"+for i in range(len(S)):",
"+ if S[i] not in C:",
"+ C[S[i]] = 0",
"+ C[S[i]] += 1",
"+if le... | false | 0.032943 | 0.035548 | 0.926709 | [
"s453161457",
"s225926951"
] |
u048945791 | p03295 | python | s969493294 | s001761181 | 385 | 227 | 18,248 | 18,188 | Accepted | Accepted | 41.04 | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab.sort(key = lambda x : x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans) | import sys
N, M = list(map(int, input().split()))
ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
ab.sort(key = lambda x : x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans) | 14 | 16 | 259 | 286 | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab.sort(key=lambda x: x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans)
| import sys
N, M = list(map(int, input().split()))
ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
ab.sort(key=lambda x: x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans)
| false | 12.5 | [
"+import sys",
"+",
"-ab = [tuple(map(int, input().split())) for _ in range(M)]",
"+ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]"
] | false | 0.036737 | 0.099277 | 0.370046 | [
"s969493294",
"s001761181"
] |
u141610915 | p03014 | python | s378689407 | s038671435 | 1,415 | 1,287 | 218,504 | 245,000 | Accepted | Accepted | 9.05 | H, W = list(map(int,input().split()))
S = [list(eval(input())) for _ in range(H)]
table = [[0 for _ in range(W)] for _ in range(H)]
def dfsW(n):
global table
l = -1
r = -1
i = 0
while i < W:
if S[n][i] == ".":
if l == -1:
l = i
r = i
else:
if l != -1:
f... | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
S = [list(eval(input()))[: -1] for _ in range(H)]
imoslr = [[0] * (W + 1) for _ in range(H)]
for i in range(H):
c = 0
prev = 0
for j in range(W):
if S[i][j] == "#":
imoslr[i][j] -= c
imoslr[i][prev] += c
... | 53 | 37 | 960 | 862 | H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
table = [[0 for _ in range(W)] for _ in range(H)]
def dfsW(n):
global table
l = -1
r = -1
i = 0
while i < W:
if S[n][i] == ".":
if l == -1:
l = i
r = i
else:
... | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
S = [list(eval(input()))[:-1] for _ in range(H)]
imoslr = [[0] * (W + 1) for _ in range(H)]
for i in range(H):
c = 0
prev = 0
for j in range(W):
if S[i][j] == "#":
imoslr[i][j] -= c
imoslr[i][prev] ... | false | 30.188679 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-S = [list(eval(input())) for _ in range(H)]",
"-table = [[0 for _ in range(W)] for _ in range(H)]",
"-",
"-",
"-def dfsW(n):",
"- global table",
"- l = -1",
"- r = -1",
"- i = 0",
"- while i < W:",
"- if S[n][i] == ... | false | 0.038097 | 0.041229 | 0.92402 | [
"s378689407",
"s038671435"
] |
u716530146 | p02949 | python | s174103910 | s154666712 | 1,761 | 1,047 | 45,276 | 44,608 | Accepted | Accepted | 40.55 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m,p=list(map(int,input().split()))
E=[]
for i in range(m):
a,b,c=list(map(int,input().split(... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m,p=list(map(int,input().split()))
E=[]
for i in range(m):
a,b,c=list(map(int,input().split(... | 38 | 34 | 911 | 781 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m, p = list(map(int, input().split()))
E = []
for i in range(m):
a, b, c = list(map(int, input().sp... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m, p = list(map(int, input().split()))
E = []
for i in range(m):
a, b, c = list(map(int, input().sp... | false | 10.526316 | [
"- for i in range(n + 10000):",
"- update = False",
"+ for i in range(3 * n):",
"- if i >= n + 5000:",
"+ if i >= n:",
"- update = True",
"- # if i==n-2: data=dist[n-1]",
"- # return -1 if dist[n-1] < data else dist"
] | false | 0.065869 | 0.042363 | 1.554869 | [
"s174103910",
"s154666712"
] |
u326609687 | p03112 | python | s755925240 | s676551075 | 1,123 | 839 | 16,144 | 16,152 | Accepted | Accepted | 25.29 | import bisect
A, B, Q = list(map(int, input().split()))
s = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(A)] + [2*10**10]
t = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(B)] + [2*10**10]
x = [int(eval(input())) for _ in range(Q)]
def func(c, d, z):
i = bisect.bisect_left(c, ... | import bisect
A, B, Q = list(map(int, input().split()))
s = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(A)] + [2*10**10]
t = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(B)] + [2*10**10]
x = [int(eval(input())) for _ in range(Q)]
def func(c, d, z):
i = bisect.bisect_left(c, ... | 16 | 22 | 535 | 903 | import bisect
A, B, Q = list(map(int, input().split()))
s = (
[-(10**10) - 1, -(10**10)]
+ [int(eval(input())) for _ in range(A)]
+ [2 * 10**10]
)
t = (
[-(10**10) - 1, -(10**10)]
+ [int(eval(input())) for _ in range(B)]
+ [2 * 10**10]
)
x = [int(eval(input())) for _ in range(Q)]
def func(c, ... | import bisect
A, B, Q = list(map(int, input().split()))
s = (
[-(10**10) - 1, -(10**10)]
+ [int(eval(input())) for _ in range(A)]
+ [2 * 10**10]
)
t = (
[-(10**10) - 1, -(10**10)]
+ [int(eval(input())) for _ in range(B)]
+ [2 * 10**10]
)
x = [int(eval(input())) for _ in range(Q)]
def func(c, ... | false | 27.272727 | [
"- j1 = bisect.bisect_left(d, c[i - 1])",
"- j2 = bisect.bisect_left(d, c[i])",
"- return min(",
"- z - d[j1 - 1], z - c[i - 1] * 2 + d[j1], d[j2] - z, c[i] * 2 - z - d[j2 - 1]",
"- )",
"+ j = bisect.bisect_left(d, z)",
"+ if c[i - 1] < d[j - 1] and c[i] < d[j]:",
"+ re... | false | 0.049445 | 0.049392 | 1.00108 | [
"s755925240",
"s676551075"
] |
u074220993 | p03426 | python | s787063192 | s693838755 | 659 | 332 | 48,664 | 32,888 | Accepted | Accepted | 49.62 | H, W, D = list(map(int, input().split()))
Aindex = [0] * (H*W)
for h in range(H):
w = 0
for A in input().split():
Aindex[int(A)-1] = (h,w)
w += 1
import numpy as np
v, h = int(np.ceil(H*W/D)), D
Mp = np.zeros((v, h), dtype='int64') #MpをMod D別に計算する予定
mp = lambda X, Y: abs(X[0]-Y[0]) ... |
def main():
H, W, D = list(map(int, input().split()))
coordinate = [None] * (H*W)
for i in range(H):
for j, A in enumerate(list(map(int, input().split()))):
coordinate[A-1] = (i, j)
cost = [0] * (H*W)
dist = lambda X, Y: abs(X[0]-Y[0]) + abs(X[1]-Y[1])
for i i... | 24 | 20 | 662 | 586 | H, W, D = list(map(int, input().split()))
Aindex = [0] * (H * W)
for h in range(H):
w = 0
for A in input().split():
Aindex[int(A) - 1] = (h, w)
w += 1
import numpy as np
v, h = int(np.ceil(H * W / D)), D
Mp = np.zeros((v, h), dtype="int64") # MpをMod D別に計算する予定
mp = lambda X, Y: abs(X[0] - Y[0])... | def main():
H, W, D = list(map(int, input().split()))
coordinate = [None] * (H * W)
for i in range(H):
for j, A in enumerate(list(map(int, input().split()))):
coordinate[A - 1] = (i, j)
cost = [0] * (H * W)
dist = lambda X, Y: abs(X[0] - Y[0]) + abs(X[1] - Y[1])
for i in rang... | false | 16.666667 | [
"-H, W, D = list(map(int, input().split()))",
"-Aindex = [0] * (H * W)",
"-for h in range(H):",
"- w = 0",
"- for A in input().split():",
"- Aindex[int(A) - 1] = (h, w)",
"- w += 1",
"-import numpy as np",
"+def main():",
"+ H, W, D = list(map(int, input().split()))",
"+ ... | false | 0.315465 | 0.044699 | 7.057528 | [
"s787063192",
"s693838755"
] |
u585482323 | p02788 | python | s684217240 | s939498826 | 1,700 | 1,418 | 106,920 | 100,008 | Accepted | Accepted | 16.59 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | 65 | 54 | 1,472 | 1,270 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | false | 16.923077 | [
"- def add(i, s):",
"- while i <= n:",
"- bit[i] += s",
"- i += i & -i",
"-",
"- def sum(i):",
"- res = 0",
"- while i > 0:",
"- res += bit[i]",
"- i -= i & -i",
"- return res",
"-",
"- bit = [0] * (n + 1)",
"... | false | 0.034914 | 0.034752 | 1.004651 | [
"s684217240",
"s939498826"
] |
u811733736 | p00144 | python | s477873172 | s682125154 | 4,180 | 600 | 8,608 | 8,556 | Accepted | Accepted | 85.65 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0144
"""
import sys
from sys import stdin
input = stdin.readline
from enum import Enum
class Graph(object):
""" single source shortest path """
class Status(Enum):
""" ?????????????¨??????¶??? """
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0144
"""
import sys
from sys import stdin
input = stdin.readline
from enum import Enum
class Graph(object):
""" single source shortest path """
class Status(Enum):
""" ?????????????¨??????¶??? """
... | 99 | 89 | 3,377 | 3,155 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0144
"""
import sys
from sys import stdin
input = stdin.readline
from enum import Enum
class Graph(object):
"""single source shortest path"""
class Status(Enum):
"""?????????????¨??????¶???"""
white = 1 # ... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0144
"""
import sys
from sys import stdin
input = stdin.readline
from enum import Enum
class Graph(object):
"""single source shortest path"""
class Status(Enum):
"""?????????????¨??????¶???"""
white = 1 # ... | false | 10.10101 | [
"- num_of_nodes = n + 1",
"- self.color = [Graph.Status.white] * num_of_nodes # ????????????????¨??????¶???",
"- self.M = [[float(\"inf\")] * num_of_nodes for _ in range(num_of_nodes)]",
"- for i in range(num_of_nodes):",
"+ self.num_of_nodes = n + 1",
"+ self.co... | false | 0.102447 | 0.039072 | 2.621983 | [
"s477873172",
"s682125154"
] |
u186838327 | p03761 | python | s476181724 | s396476804 | 205 | 19 | 41,964 | 3,064 | Accepted | Accepted | 90.73 | n = int(eval(input()))
d = {}
for k in range(97, 97+26):
d[chr(k)] = 51
for i in range(n):
s = str(eval(input()))
for j in range(97,97+26):
d[chr(j)] = min(d[chr(j)], s.count(chr(j)))
ans = ''
for k, v in list(d.items()):
ans += k*v
print((''.join(sorted(ans)))) | n = int(eval(input()))
d = {}
for i in range(26):
c = chr(i+ord('a'))
d[c] = 10**18
for i in range(n):
s = str(eval(input()))
de = {}
for i in range(26):
c = chr(i+ord('a'))
de[c] = 0
for j in range(len(s)):
if s[j] not in de:
de[s[j]] = 1
... | 16 | 26 | 275 | 497 | n = int(eval(input()))
d = {}
for k in range(97, 97 + 26):
d[chr(k)] = 51
for i in range(n):
s = str(eval(input()))
for j in range(97, 97 + 26):
d[chr(j)] = min(d[chr(j)], s.count(chr(j)))
ans = ""
for k, v in list(d.items()):
ans += k * v
print(("".join(sorted(ans))))
| n = int(eval(input()))
d = {}
for i in range(26):
c = chr(i + ord("a"))
d[c] = 10**18
for i in range(n):
s = str(eval(input()))
de = {}
for i in range(26):
c = chr(i + ord("a"))
de[c] = 0
for j in range(len(s)):
if s[j] not in de:
de[s[j]] = 1
else:
... | false | 38.461538 | [
"-for k in range(97, 97 + 26):",
"- d[chr(k)] = 51",
"+for i in range(26):",
"+ c = chr(i + ord(\"a\"))",
"+ d[c] = 10**18",
"- for j in range(97, 97 + 26):",
"- d[chr(j)] = min(d[chr(j)], s.count(chr(j)))",
"+ de = {}",
"+ for i in range(26):",
"+ c = chr(i + ord(\... | false | 0.032483 | 0.034023 | 0.95473 | [
"s476181724",
"s396476804"
] |
u392319141 | p03061 | python | s123654161 | s015838116 | 271 | 228 | 63,984 | 14,428 | Accepted | Accepted | 15.87 | def gcd(a,b) :
r = a % b
if r == 0 :
return b
else :
return gcd(b,r)
N = int(eval(input()))
A = list(map(int,input().split()))
L = [0] * N
R = [0] * N
for i in range(N) : # iより左(右)
if i == 0 :
L[i] = A[i]
R[-i-1] = A[-i-1]
else :
L[i] =... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(n, m):
if m == 0:
return n
return gcd(m, n % m)
leftGcd = [-1] * (N + 1)
leftGcd[0] = A[0]
for i, a in enumerate(A, start=1):
leftGcd[i] = gcd(leftGcd[i - 1], a)
rightGcd = [-1] * (N + 1)
rightGcd[-1] = A[-1]
fo... | 35 | 25 | 577 | 539 | def gcd(a, b):
r = a % b
if r == 0:
return b
else:
return gcd(b, r)
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
R = [0] * N
for i in range(N): # iより左(右)
if i == 0:
L[i] = A[i]
R[-i - 1] = A[-i - 1]
else:
L[i] = gcd(L[i - 1], A[i -... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(n, m):
if m == 0:
return n
return gcd(m, n % m)
leftGcd = [-1] * (N + 1)
leftGcd[0] = A[0]
for i, a in enumerate(A, start=1):
leftGcd[i] = gcd(leftGcd[i - 1], a)
rightGcd = [-1] * (N + 1)
rightGcd[-1] = A[-1]
for i, a in enumerat... | false | 28.571429 | [
"-def gcd(a, b):",
"- r = a % b",
"- if r == 0:",
"- return b",
"- else:",
"- return gcd(b, r)",
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-L = [0] * N",
"-R = [0] * N",
"-for ... | false | 0.04544 | 0.049603 | 0.916073 | [
"s123654161",
"s015838116"
] |
u312025627 | p02780 | python | s988250014 | s227551638 | 301 | 274 | 81,800 | 84,104 | Accepted | Accepted | 8.97 | def main():
N, K = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
E = [(p*(p+1)//2)/p for p in P]
S = [0]*(N+1)
ma = 0
for i in range(N):
S[i+1] = S[i] + E[i]
for i in range(N-K+1):
ma = max(ma, S[K+i] - S[i])
print(ma)
if __name__ ... | def main():
N, K = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
B = [(p+1)/2 for p in P]
from itertools import accumulate
S = list(accumulate([0] + B))
# print(B, S)
ans = 0
for i in range(N-K+1):
cur = S[i+K] - S[i]
ans = max(ans, cur... | 15 | 16 | 347 | 382 | def main():
N, K = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
E = [(p * (p + 1) // 2) / p for p in P]
S = [0] * (N + 1)
ma = 0
for i in range(N):
S[i + 1] = S[i] + E[i]
for i in range(N - K + 1):
ma = max(ma, S[K + i] - S[i])
print(ma)
if __... | def main():
N, K = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
B = [(p + 1) / 2 for p in P]
from itertools import accumulate
S = list(accumulate([0] + B))
# print(B, S)
ans = 0
for i in range(N - K + 1):
cur = S[i + K] - S[i]
ans = max(ans, cu... | false | 6.25 | [
"- E = [(p * (p + 1) // 2) / p for p in P]",
"- S = [0] * (N + 1)",
"- ma = 0",
"- for i in range(N):",
"- S[i + 1] = S[i] + E[i]",
"+ B = [(p + 1) / 2 for p in P]",
"+ from itertools import accumulate",
"+",
"+ S = list(accumulate([0] + B))",
"+ # print(B, S)",
"+... | false | 0.060524 | 0.037906 | 1.596702 | [
"s988250014",
"s227551638"
] |
u729133443 | p02620 | python | s205948609 | s231619955 | 1,391 | 459 | 122,188 | 90,612 | Accepted | Accepted | 67 | from numba import njit
from numpy import int64,zeros
@njit('i8(i8[:],i8[:])',cache=True)
def func(s,x):
last=zeros(26,int64)
score=0
for i,v in enumerate(x,1):
last[v]=i
c=0
for j in range(26):
c+=s[j]*(i-last[j])
score+=s[i*26+v]-c
return score
d... | def P(s):
R,P,*L=[0]*28
for i in range(D):t=I[i+D][0]-1;P+=s-(i+1-L[t])*C[t];R+=I[i][t]-P;L[t]=i+1
return R
(D,),C,*I=[[*list(map(int,t.split()))]for t in open(0)]
for d,q in I[D-~D:]:I[d-1+D][0]=q;print((P(sum(C)))) | 21 | 6 | 511 | 216 | from numba import njit
from numpy import int64, zeros
@njit("i8(i8[:],i8[:])", cache=True)
def func(s, x):
last = zeros(26, int64)
score = 0
for i, v in enumerate(x, 1):
last[v] = i
c = 0
for j in range(26):
c += s[j] * (i - last[j])
score += s[i * 26 + v] - c
... | def P(s):
R, P, *L = [0] * 28
for i in range(D):
t = I[i + D][0] - 1
P += s - (i + 1 - L[t]) * C[t]
R += I[i][t] - P
L[t] = i + 1
return R
(D,), C, *I = [[*list(map(int, t.split()))] for t in open(0)]
for d, q in I[D - ~D :]:
I[d - 1 + D][0] = q
print((P(sum(C))))
| false | 71.428571 | [
"-from numba import njit",
"-from numpy import int64, zeros",
"+def P(s):",
"+ R, P, *L = [0] * 28",
"+ for i in range(D):",
"+ t = I[i + D][0] - 1",
"+ P += s - (i + 1 - L[t]) * C[t]",
"+ R += I[i][t] - P",
"+ L[t] = i + 1",
"+ return R",
"-@njit(\"i8(i8[:],... | false | 0.084667 | 0.036693 | 2.307429 | [
"s205948609",
"s231619955"
] |
u047796752 | p03127 | python | s701904430 | s400092405 | 316 | 91 | 84,460 | 84,808 | Accepted | Accepted | 71.2 | import sys
input = sys.stdin.readline
from collections import *
from fractions import *
N = int(eval(input()))
A = list(map(int, input().split()))
G = 0
for Ai in A:
G = gcd(G, Ai)
print(G) | import sys
input = sys.stdin.readline
from math import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
G = 0
for Ai in A:
G = gcd(G, Ai)
print(G) | 13 | 12 | 202 | 172 | import sys
input = sys.stdin.readline
from collections import *
from fractions import *
N = int(eval(input()))
A = list(map(int, input().split()))
G = 0
for Ai in A:
G = gcd(G, Ai)
print(G)
| import sys
input = sys.stdin.readline
from math import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
G = 0
for Ai in A:
G = gcd(G, Ai)
print(G)
| false | 7.692308 | [
"-from collections import *",
"-from fractions import *",
"+from math import gcd"
] | false | 0.047237 | 0.038456 | 1.228333 | [
"s701904430",
"s400092405"
] |
u099450021 | p02959 | python | s192714713 | s917048929 | 193 | 160 | 14,992 | 19,648 | Accepted | Accepted | 17.1 | n = int(input())
a = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
ret = 0
for i in range(n):
e = min(a[i], b[i])
ret += e
a[i] -= e
b[i] -= e
e = min(a[i + 1], b[i])
ret += e
a[i + 1] -= e
b[i] -= e
print(ret)
| N = int(eval(input()))
A = [int(s) for s in input().split(' ')]
B = [int(s) for s in input().split(' ')] + [0]
m = 0
pa = 0
for a, b in zip(A, B):
m1 = 0
if pa > 0:
m1 = min(pa, a)
a -= m1
m2 = min(a, b)
pa = b - m2
m += m1 + m2
print(m)
| 15 | 15 | 301 | 283 | n = int(input())
a = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]
ret = 0
for i in range(n):
e = min(a[i], b[i])
ret += e
a[i] -= e
b[i] -= e
e = min(a[i + 1], b[i])
ret += e
a[i + 1] -= e
b[i] -= e
print(ret)
| N = int(eval(input()))
A = [int(s) for s in input().split(" ")]
B = [int(s) for s in input().split(" ")] + [0]
m = 0
pa = 0
for a, b in zip(A, B):
m1 = 0
if pa > 0:
m1 = min(pa, a)
a -= m1
m2 = min(a, b)
pa = b - m2
m += m1 + m2
print(m)
| false | 0 | [
"-n = int(input())",
"-a = [int(i) for i in input().split(\" \")]",
"-b = [int(i) for i in input().split(\" \")]",
"-ret = 0",
"-for i in range(n):",
"- e = min(a[i], b[i])",
"- ret += e",
"- a[i] -= e",
"- b[i] -= e",
"- e = min(a[i + 1], b[i])",
"- ret += e",
"- a[i + 1]... | false | 0.099788 | 0.080917 | 1.233214 | [
"s192714713",
"s917048929"
] |
u553987207 | p02831 | python | s310120543 | s856275394 | 35 | 30 | 5,048 | 8,964 | Accepted | Accepted | 14.29 | from fractions import gcd
A, B = list(map(int, input().split()))
print(((A * B) // gcd(A, B))) | import math
A, B = list(map(int, input().split()))
ans = (A * B) // math.gcd(A, B)
print(ans) | 3 | 4 | 88 | 90 | from fractions import gcd
A, B = list(map(int, input().split()))
print(((A * B) // gcd(A, B)))
| import math
A, B = list(map(int, input().split()))
ans = (A * B) // math.gcd(A, B)
print(ans)
| false | 25 | [
"-from fractions import gcd",
"+import math",
"-print(((A * B) // gcd(A, B)))",
"+ans = (A * B) // math.gcd(A, B)",
"+print(ans)"
] | false | 0.056995 | 0.117485 | 0.485123 | [
"s310120543",
"s856275394"
] |
u905203728 | p03569 | python | s246811118 | s525886249 | 71 | 62 | 3,316 | 3,316 | Accepted | Accepted | 12.68 | import sys
s = eval(input())
l = 0
r = len(s) - 1
cnt = 0
while l < r:
if s[l] != s[r]:
cnt += 1
if s[l] == 'x':
l += 1
elif s[r] == 'x':
r -= 1
else:
print((-1))
sys.exit(0)
else:
l += 1
r -= 1
pri... | s=eval(input())
l,r=0,len(s)-1
cnt=0
while l<r:
if s[r]!=s[l]:
cnt +=1
if s[l]=="x":l +=1
elif s[r]=="x":r -=1
else:print((-1));exit()
else:
r -=1
l +=1
print(cnt) | 19 | 13 | 319 | 223 | import sys
s = eval(input())
l = 0
r = len(s) - 1
cnt = 0
while l < r:
if s[l] != s[r]:
cnt += 1
if s[l] == "x":
l += 1
elif s[r] == "x":
r -= 1
else:
print((-1))
sys.exit(0)
else:
l += 1
r -= 1
print(cnt)
| s = eval(input())
l, r = 0, len(s) - 1
cnt = 0
while l < r:
if s[r] != s[l]:
cnt += 1
if s[l] == "x":
l += 1
elif s[r] == "x":
r -= 1
else:
print((-1))
exit()
else:
r -= 1
l += 1
print(cnt)
| false | 31.578947 | [
"-import sys",
"-",
"-l = 0",
"-r = len(s) - 1",
"+l, r = 0, len(s) - 1",
"- if s[l] != s[r]:",
"+ if s[r] != s[l]:",
"- sys.exit(0)",
"+ exit()",
"+ r -= 1",
"- r -= 1"
] | false | 0.039365 | 0.061759 | 0.637396 | [
"s246811118",
"s525886249"
] |
u933096856 | p00028 | python | s259054784 | s647114703 | 20 | 10 | 7,620 | 6,304 | Accepted | Accepted | 50 | d={}
try:
while True:
n=int(eval(input()))
if n in d:
d[n]+=1
else:
d[n]=1
except EOFError:
pass
a=[]
m=max(d.values())
for key, value in list(d.items()):
if value == m:
a.append(key)
a.sort()
for i in a:
print(i) | d={}
try:
while True:
n=int(input())
if n in d:
d[n]+=1
else:
d[n]=1
except EOFError:
pass
a=[]
m=max(d.values())
for key, value in list(d.items()):
if value == m:
a.append(key)
a.sort()
for i in a:
print(i) | 18 | 18 | 290 | 293 | d = {}
try:
while True:
n = int(eval(input()))
if n in d:
d[n] += 1
else:
d[n] = 1
except EOFError:
pass
a = []
m = max(d.values())
for key, value in list(d.items()):
if value == m:
a.append(key)
a.sort()
for i in a:
print(i)
| d = {}
try:
while True:
n = int(input())
if n in d:
d[n] += 1
else:
d[n] = 1
except EOFError:
pass
a = []
m = max(d.values())
for key, value in list(d.items()):
if value == m:
a.append(key)
a.sort()
for i in a:
print(i)
| false | 0 | [
"- n = int(eval(input()))",
"+ n = int(input())"
] | false | 0.039179 | 0.039745 | 0.985756 | [
"s259054784",
"s647114703"
] |
u072717685 | p02596 | python | s868655434 | s348978984 | 418 | 193 | 77,748 | 9,048 | Accepted | Accepted | 53.83 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
p = 7
plus = 7
amari = set()
r = 1
while (p % k) != 0:
if p in amari:
print((r, -1, p))
... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
p = 7 # '7,77,777…'のmod kをいれる変数
plus = 7 # '70,700,7000…'のmod kをいれる変数
r = 1 # カウント
while (p % k) != 0:... | 26 | 20 | 530 | 548 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
p = 7
plus = 7
amari = set()
r = 1
while (p % k) != 0:
if p in amari:
print((r, -1, p))
s... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
p = 7 # '7,77,777…'のmod kをいれる変数
plus = 7 # '70,700,7000…'のmod kをいれる変数
r = 1 # カウント
while (p % k) != 0: # kで割り切れるかチェック
... | false | 23.076923 | [
"- p = 7",
"- plus = 7",
"- amari = set()",
"- r = 1",
"- while (p % k) != 0:",
"- if p in amari:",
"- print((r, -1, p))",
"- sys.exit()",
"- else:",
"- amari.add(p)",
"- plus = (plus * 10) % k",
"- p += plus",... | false | 0.150808 | 0.11339 | 1.32999 | [
"s868655434",
"s348978984"
] |
u497596438 | p03273 | python | s661684408 | s719690819 | 257 | 183 | 45,416 | 39,408 | Accepted | Accepted | 28.79 | H,W=map(int,input().split())
a=[]
for i in range(H):
ai=input()
if ai=="."*W:
continue
a.append(ai)
h=len(a)
def tenti(a):
b=[]
h=len(a)
w=len(a[0])
for i in range(w):
bi=[]
for j in range(h):
bi.append(a[j][i])
b.append(bi)
re... | H,W=list(map(int,input().split()))
c=[]
for i in range(H):
ci=eval(input())
if ci=="."*W:
continue
c.append(ci+"#")
l=len(c)
k=[True]*(W+1)
for i in range(l):
for j in range(W,-1,-1):
k[j]=k[j] and (c[i][j]==".")
for i in range(l):
for j in range(W,-1,-1):
if k[j]:
c[i]=c[i]... | 33 | 19 | 624 | 364 | H, W = map(int, input().split())
a = []
for i in range(H):
ai = input()
if ai == "." * W:
continue
a.append(ai)
h = len(a)
def tenti(a):
b = []
h = len(a)
w = len(a[0])
for i in range(w):
bi = []
for j in range(h):
bi.append(a[j][i])
b.append(bi)... | H, W = list(map(int, input().split()))
c = []
for i in range(H):
ci = eval(input())
if ci == "." * W:
continue
c.append(ci + "#")
l = len(c)
k = [True] * (W + 1)
for i in range(l):
for j in range(W, -1, -1):
k[j] = k[j] and (c[i][j] == ".")
for i in range(l):
for j in range(W, -1, -1... | false | 42.424242 | [
"-H, W = map(int, input().split())",
"-a = []",
"+H, W = list(map(int, input().split()))",
"+c = []",
"- ai = input()",
"- if ai == \".\" * W:",
"+ ci = eval(input())",
"+ if ci == \".\" * W:",
"- a.append(ai)",
"-h = len(a)",
"-",
"-",
"-def tenti(a):",
"- b = []",
"- ... | false | 0.036725 | 0.037071 | 0.99068 | [
"s661684408",
"s719690819"
] |
u186838327 | p02888 | python | s994857901 | s289520806 | 769 | 351 | 43,884 | 74,492 | Accepted | Accepted | 54.36 | n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
import bisect
ans = 0
for i in range(n-2):
b = L[i]
for j in range(i+1, n-1):
c = L[j]
p = bisect.bisect_left(L, b+c)
#print(b, c, j, p, p-j-1)
ans += max(p-j-1, 0)
print(ans) | n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
#print(L)
import bisect
ans = 0
for i in range(n-2):
for j in range(i+1, n-1):
k = bisect.bisect_left(L, L[i]+L[j])
#print(i, j, k)
ans += max(0, k-j-1)
print(ans)
| 14 | 12 | 291 | 265 | n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
import bisect
ans = 0
for i in range(n - 2):
b = L[i]
for j in range(i + 1, n - 1):
c = L[j]
p = bisect.bisect_left(L, b + c)
# print(b, c, j, p, p-j-1)
ans += max(p - j - 1, 0)
print(ans)
| n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
# print(L)
import bisect
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
k = bisect.bisect_left(L, L[i] + L[j])
# print(i, j, k)
ans += max(0, k - j - 1)
print(ans)
| false | 14.285714 | [
"+# print(L)",
"- b = L[i]",
"- c = L[j]",
"- p = bisect.bisect_left(L, b + c)",
"- # print(b, c, j, p, p-j-1)",
"- ans += max(p - j - 1, 0)",
"+ k = bisect.bisect_left(L, L[i] + L[j])",
"+ # print(i, j, k)",
"+ ans += max(0, k - j - 1)"
] | false | 0.044551 | 0.04498 | 0.990453 | [
"s994857901",
"s289520806"
] |
u200916944 | p02642 | python | s441600975 | s846023972 | 291 | 168 | 177,120 | 117,764 | Accepted | Accepted | 42.27 | n, *a = list(map(int, open(0).read().split()))
a.sort()
s = set()
checked = set()
dup = set()
count = 0 ... | n, *a = list(map(int, open(0).read().split()))
a.sort()
am = a[-1] + 1
dp = [True] * am
ans = 0
dup = set()
for x in a:
d = dp[x]
if d:
ans += 1
for i in range(x, am, x):
dp[i] = False
dp[x] = None
elif d == None:
dup.add(x)
print((ans - len(dup))... | 17 | 17 | 899 | 313 | n, *a = list(map(int, open(0).read().split()))
a.sort()
s = set()
checked = set()
dup = set()
count = 0
for x in a:
if x in s:
if x in checked:
dup.add(x)
continue
count += 1
checked.add(x)
for i in range(1, 10**6 // x + 1):
s.add(x * i)
print((count - len(dup)))
| n, *a = list(map(int, open(0).read().split()))
a.sort()
am = a[-1] + 1
dp = [True] * am
ans = 0
dup = set()
for x in a:
d = dp[x]
if d:
ans += 1
for i in range(x, am, x):
dp[i] = False
dp[x] = None
elif d == None:
dup.add(x)
print((ans - len(dup)))
| false | 0 | [
"-s = set()",
"-checked = set()",
"+am = a[-1] + 1",
"+dp = [True] * am",
"+ans = 0",
"-count = 0",
"- if x in s:",
"- if x in checked:",
"- dup.add(x)",
"- continue",
"- count += 1",
"- checked.add(x)",
"- for i in range(1, 10**6 // x + 1):",
"- ... | false | 0.314825 | 0.043068 | 7.309946 | [
"s441600975",
"s846023972"
] |
u493520238 | p02609 | python | s253417713 | s687183719 | 1,325 | 360 | 89,600 | 87,192 | Accepted | Accepted | 72.83 | def main():
n_ansl = [0]*(2*(10**5))
for i in range(1,2*(10**5)):
# for i in range(1,20):
cnt = 0
one_cnt = bin(i).count("1")
rem = i
while rem != 0:
one_cnt = bin(rem).count("1")
rem = rem%one_cnt
cnt += 1
n_ansl[i] =... | def main():
n_ansl = [0]*(2*(10**5))
for i in range(1,2*(10**5)):
# for i in range(1,20):
cnt = 0
one_cnt = bin(i).count("1")
rem = i
while rem != 0:
one_cnt = bin(rem).count("1")
rem = rem%one_cnt
cnt += 1
n_ansl[i] =... | 69 | 69 | 1,682 | 1,686 | def main():
n_ansl = [0] * (2 * (10**5))
for i in range(1, 2 * (10**5)):
# for i in range(1,20):
cnt = 0
one_cnt = bin(i).count("1")
rem = i
while rem != 0:
one_cnt = bin(rem).count("1")
rem = rem % one_cnt
cnt += 1
n_ansl[i] = ... | def main():
n_ansl = [0] * (2 * (10**5))
for i in range(1, 2 * (10**5)):
# for i in range(1,20):
cnt = 0
one_cnt = bin(i).count("1")
rem = i
while rem != 0:
one_cnt = bin(rem).count("1")
rem = rem % one_cnt
cnt += 1
n_ansl[i] = ... | false | 0 | [
"- curr_2b_m *= 2",
"+ curr_2b_m *= 2"
] | false | 0.309606 | 0.324674 | 0.95359 | [
"s253417713",
"s687183719"
] |
u312025627 | p02861 | python | s204336835 | s498211344 | 207 | 189 | 39,280 | 39,280 | Accepted | Accepted | 8.7 | def main():
N = int(eval(input()))
ans = 0
from itertools import permutations
from math import hypot
XY = [[int(i) for i in input().split()] for j in range(N)]
for p in permutations(list(range(N))):
cur = 0
for i in range(N-1):
cur += hypot(XY[p[i]][0] - XY[p... | def main():
import sys
input = sys.stdin.buffer.readline
from itertools import permutations
from math import hypot
N = int(eval(input()))
XY = [[int(i) for i in input().split()] for j in range(N)]
ans = 0
for p in permutations(list(range(N))):
for i in range(N-1):
... | 20 | 19 | 523 | 519 | def main():
N = int(eval(input()))
ans = 0
from itertools import permutations
from math import hypot
XY = [[int(i) for i in input().split()] for j in range(N)]
for p in permutations(list(range(N))):
cur = 0
for i in range(N - 1):
cur += hypot(XY[p[i]][0] - XY[p[i + 1... | def main():
import sys
input = sys.stdin.buffer.readline
from itertools import permutations
from math import hypot
N = int(eval(input()))
XY = [[int(i) for i in input().split()] for j in range(N)]
ans = 0
for p in permutations(list(range(N))):
for i in range(N - 1):
... | false | 5 | [
"- N = int(eval(input()))",
"- ans = 0",
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"+ N = int(eval(input()))",
"+ ans = 0",
"- cur = 0",
"- cur += hypot(XY[p[i]][0] - XY[p[i + 1]][0], XY[p[i]][1] - XY[p[i + 1]][1])",
"- ans += cur",
"-... | false | 0.043107 | 0.042892 | 1.005024 | [
"s204336835",
"s498211344"
] |
u821624310 | p02421 | python | s118986297 | s257038301 | 30 | 20 | 7,588 | 7,672 | Accepted | Accepted | 33.33 | point_t = 0
point_h = 0
n = int(eval(input()))
for i in range(n):
card_t, card_h = input().split()
if card_t > card_h:
point_t += 3
if card_t < card_h:
point_h += 3
if card_t == card_h:
point_t += 1
point_h += 1
print((point_t, point_h)) | n = int(eval(input()))
T_point = 0
H_point = 0
for i in range(n):
Taro, Hanako = input().split()
if Taro > Hanako:
T_point += 3
elif Hanako > Taro:
H_point += 3
else:
T_point += 1
H_point += 1
print((T_point, H_point)) | 13 | 13 | 289 | 270 | point_t = 0
point_h = 0
n = int(eval(input()))
for i in range(n):
card_t, card_h = input().split()
if card_t > card_h:
point_t += 3
if card_t < card_h:
point_h += 3
if card_t == card_h:
point_t += 1
point_h += 1
print((point_t, point_h))
| n = int(eval(input()))
T_point = 0
H_point = 0
for i in range(n):
Taro, Hanako = input().split()
if Taro > Hanako:
T_point += 3
elif Hanako > Taro:
H_point += 3
else:
T_point += 1
H_point += 1
print((T_point, H_point))
| false | 0 | [
"-point_t = 0",
"-point_h = 0",
"+T_point = 0",
"+H_point = 0",
"- card_t, card_h = input().split()",
"- if card_t > card_h:",
"- point_t += 3",
"- if card_t < card_h:",
"- point_h += 3",
"- if card_t == card_h:",
"- point_t += 1",
"- point_h += 1",
"-... | false | 0.044596 | 0.044408 | 1.004251 | [
"s118986297",
"s257038301"
] |
u334712262 | p02698 | python | s920384370 | s495896796 | 1,985 | 1,814 | 551,408 | 551,636 | Accepted | Accepted | 8.61 | # -*- coding: utf-8 -*-
import bisect
# import heapq
# import math
# import random
import sys
# from collections import Counter, defaultdict, deque
# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
# from functools import lru_cache, reduce
# from itertools import combinations, combinations_with_repla... | # -*- coding: utf-8 -*-
import bisect
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n()... | 107 | 100 | 2,093 | 1,756 | # -*- coding: utf-8 -*-
import bisect
# import heapq
# import math
# import random
import sys
# from collections import Counter, defaultdict, deque
# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
# from functools import lru_cache, reduce
# from itertools import combinations, combinations_with_replacement,... | # -*- coding: utf-8 -*-
import bisect
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62 - 1
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n():
return list(m... | false | 6.542056 | [
"-",
"-# import heapq",
"-# import math",
"-# import random",
"-# from collections import Counter, defaultdict, deque",
"-# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"-# from functools import lru_cache, reduce",
"-# from itertools import combinations, combinations_with_replacement, p... | false | 0.007357 | 0.047109 | 0.156175 | [
"s920384370",
"s495896796"
] |
u936985471 | p03164 | python | s540343737 | s638879969 | 249 | 166 | 14,028 | 28,192 | Accepted | Accepted | 33.33 | N,W=list(map(int,input().split()))
INF=10**9+1
import numpy as np
dp=np.full(N*1000+1,INF,dtype=int)
dp[0]=0
for i in range(N):
w,v=list(map(int,input().split()))
np.minimum(dp[:-v]+w,dp[v:],out=dp[v:])
for i in range(len(dp)-1,-1,-1):
if dp[i]<=W:
print(i)
break
| import sys
readline = sys.stdin.readline
import numpy as np
import math
N,W = list(map(int,readline().split()))
dp = np.array([10 ** 12 + 1] * (10 ** 5 + 1), dtype = int)
dp[0] = 0
for i in range(N):
w,v = list(map(int,readline().split()))
np.minimum(dp[:-v] + w,dp[v:],out = dp[v:])
for i in r... | 13 | 19 | 279 | 375 | N, W = list(map(int, input().split()))
INF = 10**9 + 1
import numpy as np
dp = np.full(N * 1000 + 1, INF, dtype=int)
dp[0] = 0
for i in range(N):
w, v = list(map(int, input().split()))
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
for i in range(len(dp) - 1, -1, -1):
if dp[i] <= W:
print(i)
b... | import sys
readline = sys.stdin.readline
import numpy as np
import math
N, W = list(map(int, readline().split()))
dp = np.array([10**12 + 1] * (10**5 + 1), dtype=int)
dp[0] = 0
for i in range(N):
w, v = list(map(int, readline().split()))
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
for i in range(len(dp) - 1, ... | false | 31.578947 | [
"-N, W = list(map(int, input().split()))",
"-INF = 10**9 + 1",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+import math",
"-dp = np.full(N * 1000 + 1, INF, dtype=int)",
"+N, W = list(map(int, readline().split()))",
"+dp = np.array([10**12 + 1] * (10**5 + 1), dtype=int)",
"- w, v = li... | false | 0.214368 | 0.254284 | 0.843028 | [
"s540343737",
"s638879969"
] |
u562935282 | p03039 | python | s052123106 | s173723065 | 344 | 130 | 26,868 | 3,064 | Accepted | Accepted | 62.21 | """
組み合わせ(nCr)計算
https://qiita.com/derodero24/items/91b6468e66923a87f39f#%E7%95%AA%E5%A4%96%E7%B7%A8
逆元の求め方
http://drken1215.hatenablog.com/entry/2018/06/08/210000
解法@公式放送
https://www.youtube.com/watch?v=SS6kW-d-rJ0&feature=youtu.be&t=7376
"""
def cmb(n, r):
return (fact[n] * finv_t[r] * finv_t[n - r])... | """
https://atcoder.jp/contests/abc127/submissions/5606400
"""
def inv(x):
return pow(x, MOD - 2, MOD)
def cmb(n, r):
r = min(r, n - r)
if r == 0:
return 1
if r == 1:
return n
f = 1
for k in range(n, n - r, -1):
f = (f * k) % MOD
# n!/(n-r)... | 39 | 45 | 813 | 693 | """
組み合わせ(nCr)計算
https://qiita.com/derodero24/items/91b6468e66923a87f39f#%E7%95%AA%E5%A4%96%E7%B7%A8
逆元の求め方
http://drken1215.hatenablog.com/entry/2018/06/08/210000
解法@公式放送
https://www.youtube.com/watch?v=SS6kW-d-rJ0&feature=youtu.be&t=7376
"""
def cmb(n, r):
return (fact[n] * finv_t[r] * finv_t[n - r]) % MOD
MO... | """
https://atcoder.jp/contests/abc127/submissions/5606400
"""
def inv(x):
return pow(x, MOD - 2, MOD)
def cmb(n, r):
r = min(r, n - r)
if r == 0:
return 1
if r == 1:
return n
f = 1
for k in range(n, n - r, -1):
f = (f * k) % MOD
# n!/(n-r)!
d = 1
for ... | false | 13.333333 | [
"-組み合わせ(nCr)計算",
"-https://qiita.com/derodero24/items/91b6468e66923a87f39f#%E7%95%AA%E5%A4%96%E7%B7%A8",
"-逆元の求め方",
"-http://drken1215.hatenablog.com/entry/2018/06/08/210000",
"-解法@公式放送",
"-https://www.youtube.com/watch?v=SS6kW-d-rJ0&feature=youtu.be&t=7376",
"+https://atcoder.jp/contests/abc127/submiss... | false | 0.056614 | 0.041698 | 1.357699 | [
"s052123106",
"s173723065"
] |
u321035578 | p03162 | python | s862384335 | s767335039 | 651 | 535 | 69,848 | 47,388 | Accepted | Accepted | 17.82 | def main():
n=int(eval(input()))
a=[]
for _ in range(n):
a.append(list(map(int,input().split())))
dp=[]
dp.append([a[0][0],a[0][1],a[0][2]])
for i in range(1,n):
tmpa=max(dp[i-1][1],dp[i-1][2])+a[i][0]
tmpb=max(dp[i-1][0],dp[i-1][2])+a[i][1]
tmpc=max(dp[... | def main():
n = int(eval(input()))
hpy = []
for _ in range(n):
tmp = list(map(int,input().split()))
hpy.append(tmp)
# a:0, b:1, c:2
dp = [[0] * 3 for i in range(n) ]
dp[0][0] = hpy[0][0]
dp[0][1] = hpy[0][1]
dp[0][2] = hpy[0][2]
for i, abc in enumerate(dp):... | 15 | 25 | 442 | 635 | def main():
n = int(eval(input()))
a = []
for _ in range(n):
a.append(list(map(int, input().split())))
dp = []
dp.append([a[0][0], a[0][1], a[0][2]])
for i in range(1, n):
tmpa = max(dp[i - 1][1], dp[i - 1][2]) + a[i][0]
tmpb = max(dp[i - 1][0], dp[i - 1][2]) + a[i][1]
... | def main():
n = int(eval(input()))
hpy = []
for _ in range(n):
tmp = list(map(int, input().split()))
hpy.append(tmp)
# a:0, b:1, c:2
dp = [[0] * 3 for i in range(n)]
dp[0][0] = hpy[0][0]
dp[0][1] = hpy[0][1]
dp[0][2] = hpy[0][2]
for i, abc in enumerate(dp):
if... | false | 40 | [
"- a = []",
"+ hpy = []",
"- a.append(list(map(int, input().split())))",
"- dp = []",
"- dp.append([a[0][0], a[0][1], a[0][2]])",
"- for i in range(1, n):",
"- tmpa = max(dp[i - 1][1], dp[i - 1][2]) + a[i][0]",
"- tmpb = max(dp[i - 1][0], dp[i - 1][2]) + a[i][1]",
... | false | 0.039517 | 0.039656 | 0.996486 | [
"s862384335",
"s767335039"
] |
u197300260 | p04044 | python | s679620370 | s205856610 | 24 | 17 | 3,692 | 3,064 | Accepted | Accepted | 29.17 | # _*_ coding:utf-8 _*_
# Atcoder_Beginners_Contest042-B
# TODO https://atcoder.jp/contests/abc042/tasks/abc042_b
import time
from contextlib import contextmanager
# from time import sleep
@contextmanager
def timer(title):
t0 = time.time()
yield
print(("{} - done in {:.0f}s".format(title,time.time()-t0) )... | # Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b
# Python 1st Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): retu... | 28 | 35 | 804 | 791 | # _*_ coding:utf-8 _*_
# Atcoder_Beginners_Contest042-B
# TODO https://atcoder.jp/contests/abc042/tasks/abc042_b
import time
from contextlib import contextmanager
# from time import sleep
@contextmanager
def timer(title):
t0 = time.time()
yield
print(("{} - done in {:.0f}s".format(title, time.time() - t0... | # Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b
# Python 1st Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return li... | false | 20 | [
"-# _*_ coding:utf-8 _*_",
"-# Atcoder_Beginners_Contest042-B",
"-# TODO https://atcoder.jp/contests/abc042/tasks/abc042_b",
"-import time",
"-from contextlib import contextmanager",
"+# Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b",
"+# Python 1st Try",
"+import sys",
"-# from time ... | false | 0.037768 | 0.037428 | 1.009094 | [
"s679620370",
"s205856610"
] |
u571281863 | p02642 | python | s812778403 | s323118994 | 324 | 201 | 32,208 | 32,288 | Accepted | Accepted | 37.96 | N=eval(input())
A=sorted(map(int,input().split()))
M=A[-1]+1
B=[True]*M
c=0
x=0
for i in A:
if B[i]==True:
if i!=c:
for j in range(i*2,M,i):
B[j]=False
x+=1
c=i
else:
B[i]=False
x-=1
print(x) | def main():
N=eval(input())
A=sorted(map(int,input().split()))
M=A[-1]+1
B=[True]*M
c=0
x=0
for i in A:
if B[i]:
if i!=c:
for j in range(i*2,M,i):
B[j]=False
x+=1
c=i
else:
B[i]=False
x-=1
print(x)
main() | 17 | 19 | 249 | 298 | N = eval(input())
A = sorted(map(int, input().split()))
M = A[-1] + 1
B = [True] * M
c = 0
x = 0
for i in A:
if B[i] == True:
if i != c:
for j in range(i * 2, M, i):
B[j] = False
x += 1
c = i
else:
B[i] = False
x -= 1
print(... | def main():
N = eval(input())
A = sorted(map(int, input().split()))
M = A[-1] + 1
B = [True] * M
c = 0
x = 0
for i in A:
if B[i]:
if i != c:
for j in range(i * 2, M, i):
B[j] = False
x += 1
c = i
... | false | 10.526316 | [
"-N = eval(input())",
"-A = sorted(map(int, input().split()))",
"-M = A[-1] + 1",
"-B = [True] * M",
"-c = 0",
"-x = 0",
"-for i in A:",
"- if B[i] == True:",
"- if i != c:",
"- for j in range(i * 2, M, i):",
"- B[j] = False",
"- x += 1",
"- ... | false | 0.007997 | 0.05221 | 0.15316 | [
"s812778403",
"s323118994"
] |
u535171899 | p03481 | python | s288761587 | s693454923 | 22 | 17 | 2,940 | 2,940 | Accepted | Accepted | 22.73 | x,y = list(map(int,input().split()))
ans=1
tmp=x
for i in range(x,y+1):
if tmp*2>y:
break
tmp*=2
ans+=1
print(ans) | x,y = list(map(int,input().split()))
ans = 1
while x<y:
x*=2
ans+=1
if x>y:
ans-=1
break
print(ans) | 9 | 10 | 136 | 131 | x, y = list(map(int, input().split()))
ans = 1
tmp = x
for i in range(x, y + 1):
if tmp * 2 > y:
break
tmp *= 2
ans += 1
print(ans)
| x, y = list(map(int, input().split()))
ans = 1
while x < y:
x *= 2
ans += 1
if x > y:
ans -= 1
break
print(ans)
| false | 10 | [
"-tmp = x",
"-for i in range(x, y + 1):",
"- if tmp * 2 > y:",
"+while x < y:",
"+ x *= 2",
"+ ans += 1",
"+ if x > y:",
"+ ans -= 1",
"- tmp *= 2",
"- ans += 1"
] | false | 0.117425 | 0.046472 | 2.526819 | [
"s288761587",
"s693454923"
] |
u440566786 | p02913 | python | s725948353 | s296806666 | 362 | 193 | 52,952 | 42,736 | Accepted | Accepted | 46.69 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bisection(l,r,f,left=True,discrete=True):
eps=1 if discrete else 10**-12
if((not left)^f(r)): return r if left else r+1
elif(left^f(l)): return l-1 if left else l
while(r-l>... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class RollingHash(object):
__base1=1007; __mod1=10**9+9
__base2=1009; __mod2=10**9+7
def __init__(self,s):
self.__s=s; self.__n=len(s)
b1=self.__base1; m1=self.... | 65 | 60 | 1,872 | 1,890 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def bisection(l, r, f, left=True, discrete=True):
eps = 1 if discrete else 10**-12
if (not left) ^ f(r):
return r if left else r + 1
elif left ^ f(l):
return l - 1... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class RollingHash(object):
__base1 = 1007
__mod1 = 10**9 + 9
__base2 = 1009
__mod2 = 10**9 + 7
def __init__(self, s):
self.__s = s
self.__n = len(s)
... | false | 7.692308 | [
"+",
"+",
"+class RollingHash(object):",
"+ __base1 = 1007",
"+ __mod1 = 10**9 + 9",
"+ __base2 = 1009",
"+ __mod2 = 10**9 + 7",
"+",
"+ def __init__(self, s):",
"+ self.__s = s",
"+ self.__n = len(s)",
"+ b1 = self.__base1",
"+ m1 = self.__mod1",
... | false | 0.103327 | 0.168124 | 0.614586 | [
"s725948353",
"s296806666"
] |
u119148115 | p03285 | python | s858047523 | s668821843 | 84 | 64 | 61,320 | 61,888 | Accepted | Accepted | 23.81 | import sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
A = [1,2,3,5,6,9,10,13,17]
if N in A:
print('No')
else:
print('Yes') | import sys
N = int(sys.stdin.readline().rstrip())
A = [1,2,3,5,6,9,10,13,17]
print(('No' if N in A else 'Yes'))
| 12 | 7 | 164 | 119 | import sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
A = [1, 2, 3, 5, 6, 9, 10, 13, 17]
if N in A:
print("No")
else:
print("Yes")
| import sys
N = int(sys.stdin.readline().rstrip())
A = [1, 2, 3, 5, 6, 9, 10, 13, 17]
print(("No" if N in A else "Yes"))
| false | 41.666667 | [
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-",
"-",
"-N = I()",
"+N = int(sys.stdin.readline().rstrip())",
"-if N in A:",
"- print(\"No\")",
"-else:",
"- print(\"Yes\")",
"+print((\"No\" if N in A else \"Yes\"))"
] | false | 0.084344 | 0.06659 | 1.266613 | [
"s858047523",
"s668821843"
] |
u058781705 | p02720 | python | s438859255 | s040626292 | 616 | 184 | 57,500 | 40,688 | Accepted | Accepted | 70.13 | from queue import Queue
def solve():
K = int(eval(input()))
q = Queue()
for i in range(9):
q.put(i+1)
num = 0
for i in range(K):
num = q.get()
if num % 10 != 0:
q.put(num*10+num % 10-1)
q.put(num*10+num % 10)
if num % 10 != 9:
... | from collections import deque
def solve():
K = int(eval(input()))
dq = deque()
# 一桁のケース
for i in range(9):
dq.append(i+1)
for i in range(K):
num = dq.popleft()
if num % 10 != 0:
dq.append(num*10+num % 10-1)
dq.append(num*10+num % 10)
... | 23 | 25 | 412 | 445 | from queue import Queue
def solve():
K = int(eval(input()))
q = Queue()
for i in range(9):
q.put(i + 1)
num = 0
for i in range(K):
num = q.get()
if num % 10 != 0:
q.put(num * 10 + num % 10 - 1)
q.put(num * 10 + num % 10)
if num % 10 != 9:
... | from collections import deque
def solve():
K = int(eval(input()))
dq = deque()
# 一桁のケース
for i in range(9):
dq.append(i + 1)
for i in range(K):
num = dq.popleft()
if num % 10 != 0:
dq.append(num * 10 + num % 10 - 1)
dq.append(num * 10 + num % 10)
... | false | 8 | [
"-from queue import Queue",
"+from collections import deque",
"- q = Queue()",
"+ dq = deque()",
"+ # 一桁のケース",
"- q.put(i + 1)",
"- num = 0",
"+ dq.append(i + 1)",
"- num = q.get()",
"+ num = dq.popleft()",
"- q.put(num * 10 + num % 10 - 1)",
... | false | 0.181375 | 0.043626 | 4.157554 | [
"s438859255",
"s040626292"
] |
u806403461 | p03778 | python | s342329793 | s141824400 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | w, a, b = list(map(int, input().split()))
if a <= b and b <= a + w:
print((0))
elif a <= b + w and b + w <= a + w:
print((0))
elif b+w < a:
print((a - (b+w)))
elif a+w < b:
print((b - (a+w)))
| w, a, b = list(map(int, input().split()))
print((max(0, abs(a-b)-w)))
| 10 | 3 | 204 | 65 | w, a, b = list(map(int, input().split()))
if a <= b and b <= a + w:
print((0))
elif a <= b + w and b + w <= a + w:
print((0))
elif b + w < a:
print((a - (b + w)))
elif a + w < b:
print((b - (a + w)))
| w, a, b = list(map(int, input().split()))
print((max(0, abs(a - b) - w)))
| false | 70 | [
"-if a <= b and b <= a + w:",
"- print((0))",
"-elif a <= b + w and b + w <= a + w:",
"- print((0))",
"-elif b + w < a:",
"- print((a - (b + w)))",
"-elif a + w < b:",
"- print((b - (a + w)))",
"+print((max(0, abs(a - b) - w)))"
] | false | 0.038357 | 0.03783 | 1.013922 | [
"s342329793",
"s141824400"
] |
u074220993 | p03472 | python | s952649856 | s272994864 | 287 | 251 | 16,620 | 14,904 | Accepted | Accepted | 12.54 | N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
a, b = list(map(int, input().split()))
slash = max(slash, a)
if b > a: Throw.append(b)
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその剣をダメージが大きい順に投げる
import heapq as hq
Throw = [-th for th in Throw if th > slash]
hq.heapify(... | N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
a, b = list(map(int, input().split()))
slash = max(slash, a)
if b > a: Throw.append(b)
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる
Throw = sorted([th for th in Throw if th > slash], reverse=True)
dmg, cnt =... | 21 | 18 | 510 | 474 | N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
a, b = list(map(int, input().split()))
slash = max(slash, a)
if b > a:
Throw.append(b)
# slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその剣をダメージが大きい順に投げる
import heapq as hq
Throw = [-th for th in Throw if th > slash]
hq.heapify(Thro... | N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
a, b = list(map(int, input().split()))
slash = max(slash, a)
if b > a:
Throw.append(b)
# slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる
Throw = sorted([th for th in Throw if th > slash], reverse=True)
dmg, cnt = 0, ... | false | 14.285714 | [
"-# slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその剣をダメージが大きい順に投げる",
"-import heapq as hq",
"-",
"-Throw = [-th for th in Throw if th > slash]",
"-hq.heapify(Throw)",
"+# slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる",
"+Throw = sorted([th for th in Throw if th > slash], reverse=True)",
"-while len(Throw... | false | 0.045359 | 0.127482 | 0.355811 | [
"s952649856",
"s272994864"
] |
u588341295 | p03838 | python | s203314582 | s412775278 | 45 | 41 | 5,536 | 5,280 | Accepted | Accepted | 8.89 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect i... | # -*- coding: utf-8 -*-
"""
・自力AC
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from heapq import heappop, heappush, heapify, heappus... | 40 | 48 | 1,359 | 1,455 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect im... | # -*- coding: utf-8 -*-
"""
・自力AC
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
... | false | 16.666667 | [
"+\"\"\"",
"+・自力AC",
"+\"\"\"",
"+# x, yの大小、正負をまたぐかどうかで場合分け",
"- ans = min(y - x, abs(abs(x) - abs(y)) + 1)",
"+ if x >= 0 or y <= 0:",
"+ ans = y - x",
"+ else:",
"+ ans = abs(abs(x) - abs(y)) + 1"
] | false | 0.07788 | 0.100759 | 0.772934 | [
"s203314582",
"s412775278"
] |
u254871849 | p02804 | python | s651057189 | s194500103 | 988 | 249 | 28,280 | 27,512 | Accepted | Accepted | 74.8 | import sys
import numpy as np
MOD = 10 ** 9 + 7
def cumprod(a, p):
l = len(a); sql = int(np.sqrt(l) + 1)
a = np.resize(a, sql ** 2).reshape(sql, sql)
for i in range(sql - 1): a[:, i+1] *= a[:, i]; a[:, i+1] %= p
for i in range(sql - 1): a[i+1] *= a[i, -1]; a[i+1] %= p
return np.ravel(a)[:l]
def m... | import sys
import numpy as np
MOD = 10 ** 9 + 7
def cumprod(a, p):
l = len(a); sql = int(np.sqrt(l) + 1)
a = np.resize(a, sql ** 2).reshape(sql, sql)
for i in range(sql - 1): a[:, i+1] *= a[:, i]; a[:, i+1] %= p
for i in range(sql - 1): a[i+1] *= a[i, -1]; a[i+1] %= p
return np.ravel(a)[:l]
def m... | 38 | 37 | 1,108 | 1,150 | import sys
import numpy as np
MOD = 10**9 + 7
def cumprod(a, p):
l = len(a)
sql = int(np.sqrt(l) + 1)
a = np.resize(a, sql**2).reshape(sql, sql)
for i in range(sql - 1):
a[:, i + 1] *= a[:, i]
a[:, i + 1] %= p
for i in range(sql - 1):
a[i + 1] *= a[i, -1]
a[i + 1] ... | import sys
import numpy as np
MOD = 10**9 + 7
def cumprod(a, p):
l = len(a)
sql = int(np.sqrt(l) + 1)
a = np.resize(a, sql**2).reshape(sql, sql)
for i in range(sql - 1):
a[:, i + 1] *= a[:, i]
a[:, i + 1] %= p
for i in range(sql - 1):
a[i + 1] *= a[i, -1]
a[i + 1] ... | false | 2.631579 | [
"- if r > n or r < 0:",
"- return 0",
"+ # if r > n or r < 0: return 0",
"- for i in range(n):",
"- res += choose(i, k - 1) * a[i] % MOD",
"- res -= choose(n - i - 1, k - 1) * a[i] % MOD",
"- res %= MOD",
"+ res = (a[k - 1 :] * choose(np.arange(k - 1, n), k - 1)... | false | 0.286286 | 0.214042 | 1.337521 | [
"s651057189",
"s194500103"
] |
u079022693 | p02681 | python | s307613548 | s300981375 | 25 | 22 | 9,048 | 9,032 | Accepted | Accepted | 12 | from sys import stdin
def main():
#入力
readline=stdin.readline
S=readline().strip()
T=readline().strip()
for i in range(len(S)):
if S[i]!=T[i]:
print("No")
break
else:
print("Yes")
if __name__=="__main__":
main() | s=eval(input())
t=eval(input())
print(("Yes" if s==t[:-1] else "No")) | 14 | 3 | 292 | 57 | from sys import stdin
def main():
# 入力
readline = stdin.readline
S = readline().strip()
T = readline().strip()
for i in range(len(S)):
if S[i] != T[i]:
print("No")
break
else:
print("Yes")
if __name__ == "__main__":
main()
| s = eval(input())
t = eval(input())
print(("Yes" if s == t[:-1] else "No"))
| false | 78.571429 | [
"-from sys import stdin",
"-",
"-",
"-def main():",
"- # 入力",
"- readline = stdin.readline",
"- S = readline().strip()",
"- T = readline().strip()",
"- for i in range(len(S)):",
"- if S[i] != T[i]:",
"- print(\"No\")",
"- break",
"- else:",
"-... | false | 0.0466 | 0.045692 | 1.019858 | [
"s307613548",
"s300981375"
] |
u439063038 | p02683 | python | s777281588 | s559415618 | 171 | 91 | 27,276 | 9,168 | Accepted | Accepted | 46.78 | import numpy as np
N, M, X = list(map(int, input().split()))
array = np.array([list(map(int, input().split())) for _ in range(N)])
min_C = np.inf
conbi = None
m = 2**N
for i in range(m):
tmp = []
for _ in range(N):
tmp.append(i%2)
i //= 2
sum_array = np.sum(array[np.where(tmp)], axis=... | N, M, X = list(map(int, input().split()))
c_a_list = [list(map(int, input().split())) for _ in range(N)]
min_money = 1e10
for i in range(2**N):
buy_list = [0] * N
skill = [0] * M
money = 0
for j in range(N):
if i % 2 == 0:
buy_list[j] = 1
i //= 2
for bu... | 26 | 27 | 509 | 717 | import numpy as np
N, M, X = list(map(int, input().split()))
array = np.array([list(map(int, input().split())) for _ in range(N)])
min_C = np.inf
conbi = None
m = 2**N
for i in range(m):
tmp = []
for _ in range(N):
tmp.append(i % 2)
i //= 2
sum_array = np.sum(array[np.where(tmp)], axis=0)
... | N, M, X = list(map(int, input().split()))
c_a_list = [list(map(int, input().split())) for _ in range(N)]
min_money = 1e10
for i in range(2**N):
buy_list = [0] * N
skill = [0] * M
money = 0
for j in range(N):
if i % 2 == 0:
buy_list[j] = 1
i //= 2
for buy_idx, ca in enumer... | false | 3.703704 | [
"-import numpy as np",
"-",
"-array = np.array([list(map(int, input().split())) for _ in range(N)])",
"-min_C = np.inf",
"-conbi = None",
"-m = 2**N",
"-for i in range(m):",
"- tmp = []",
"- for _ in range(N):",
"- tmp.append(i % 2)",
"+c_a_list = [list(map(int, input().split())) fo... | false | 0.188815 | 0.038467 | 4.908435 | [
"s777281588",
"s559415618"
] |
u227082700 | p02850 | python | s108625436 | s847589275 | 1,003 | 841 | 66,556 | 46,716 | Accepted | Accepted | 16.15 | n=int(eval(input()))
s=[[]for _ in range(n)]
d={}
f=[]
for i in range(n-1):
a,b=list(map(int,input().split()))
d[min(a,b)*1000000+max(a,b)]=10**7
s[a-1].append(b-1)
s[b-1].append(a-1)
f.append((a-1,b-1))
se={0}
mc=max(len(s[i])for i in range(n))
print(mc)
Q=[(0,i)for i in s[0]]
r=[-1]*n
r[0]=0
... | n=int(eval(input()))
edge=[[]for _ in range(n)]
point=[0]*n
edges=[]
point_color=[-1]*n
edge_color={}
edge_to_int=lambda x,y:min(x,y)*100007+max(x,y)
for _ in range(n-1):
a,b=list(map(int,input().split()))
a-=1
b-=1
edges.append((a,b))
edge[a].append(b)
edge[b].append(a)
point[a]+=1
point... | 32 | 36 | 600 | 722 | n = int(eval(input()))
s = [[] for _ in range(n)]
d = {}
f = []
for i in range(n - 1):
a, b = list(map(int, input().split()))
d[min(a, b) * 1000000 + max(a, b)] = 10**7
s[a - 1].append(b - 1)
s[b - 1].append(a - 1)
f.append((a - 1, b - 1))
se = {0}
mc = max(len(s[i]) for i in range(n))
print(mc)
Q =... | n = int(eval(input()))
edge = [[] for _ in range(n)]
point = [0] * n
edges = []
point_color = [-1] * n
edge_color = {}
edge_to_int = lambda x, y: min(x, y) * 100007 + max(x, y)
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges.append((a, b))
edge[a].append(b)
edge... | false | 11.111111 | [
"-s = [[] for _ in range(n)]",
"-d = {}",
"-f = []",
"-for i in range(n - 1):",
"+edge = [[] for _ in range(n)]",
"+point = [0] * n",
"+edges = []",
"+point_color = [-1] * n",
"+edge_color = {}",
"+edge_to_int = lambda x, y: min(x, y) * 100007 + max(x, y)",
"+for _ in range(n - 1):",
"- d[m... | false | 0.048593 | 0.121654 | 0.399433 | [
"s108625436",
"s847589275"
] |
u203843959 | p02556 | python | s880088712 | s903466783 | 1,418 | 577 | 119,192 | 52,828 | Accepted | Accepted | 59.31 | N=int(eval(input()))
answer=0
xylist=[]
for _ in range(N):
x,y=list(map(int,input().split()))
xylist.append((x,y))
ppxylist=[]
for i in range(N):
x,y=xylist[i]
ppxylist.append((x+y,x,y))
ppxylist.sort()
#print(ppxylist)
answer=max(answer,ppxylist[-1][0]-ppxylist[0][0])
pmxylist=[]
for i in r... | N=int(eval(input()))
answer=0
xylist=[]
pxylist=[]
mxylist=[]
for _ in range(N):
x,y=list(map(int,input().split()))
xylist.append((x,y))
pxylist.append(x+y)
mxylist.append(x-y)
pxylist.sort()
mxylist.sort()
answer=max(pxylist[-1]-pxylist[0],mxylist[-1]-mxylist[0])
print(answer) | 41 | 16 | 806 | 291 | N = int(eval(input()))
answer = 0
xylist = []
for _ in range(N):
x, y = list(map(int, input().split()))
xylist.append((x, y))
ppxylist = []
for i in range(N):
x, y = xylist[i]
ppxylist.append((x + y, x, y))
ppxylist.sort()
# print(ppxylist)
answer = max(answer, ppxylist[-1][0] - ppxylist[0][0])
pmxylist... | N = int(eval(input()))
answer = 0
xylist = []
pxylist = []
mxylist = []
for _ in range(N):
x, y = list(map(int, input().split()))
xylist.append((x, y))
pxylist.append(x + y)
mxylist.append(x - y)
pxylist.sort()
mxylist.sort()
answer = max(pxylist[-1] - pxylist[0], mxylist[-1] - mxylist[0])
print(answer)... | false | 60.97561 | [
"+pxylist = []",
"+mxylist = []",
"-ppxylist = []",
"-for i in range(N):",
"- x, y = xylist[i]",
"- ppxylist.append((x + y, x, y))",
"-ppxylist.sort()",
"-# print(ppxylist)",
"-answer = max(answer, ppxylist[-1][0] - ppxylist[0][0])",
"-pmxylist = []",
"-for i in range(N):",
"- x, y = ... | false | 0.04375 | 0.097676 | 0.447908 | [
"s880088712",
"s903466783"
] |
u282228874 | p03331 | python | s153239645 | s910252602 | 369 | 17 | 3,864 | 2,940 | Accepted | Accepted | 95.39 | n = int(eval(input()))
ans = []
for i in range(1,n):
j = n-i
si = 0
sj = 0
for s in str(i):
si += int(s)
for t in str(j):
sj += int(t)
ans.append(si+sj)
print((min(ans)))
| n = eval(input())
if int(n)%10 == 0:
print((10))
else:
res = 0
for i in range(len(n)):
res += int(n[i])
print(res) | 13 | 8 | 216 | 125 | n = int(eval(input()))
ans = []
for i in range(1, n):
j = n - i
si = 0
sj = 0
for s in str(i):
si += int(s)
for t in str(j):
sj += int(t)
ans.append(si + sj)
print((min(ans)))
| n = eval(input())
if int(n) % 10 == 0:
print((10))
else:
res = 0
for i in range(len(n)):
res += int(n[i])
print(res)
| false | 38.461538 | [
"-n = int(eval(input()))",
"-ans = []",
"-for i in range(1, n):",
"- j = n - i",
"- si = 0",
"- sj = 0",
"- for s in str(i):",
"- si += int(s)",
"- for t in str(j):",
"- sj += int(t)",
"- ans.append(si + sj)",
"-print((min(ans)))",
"+n = eval(input())",
"+if... | false | 0.316528 | 0.036389 | 8.698339 | [
"s153239645",
"s910252602"
] |
u620084012 | p03745 | python | s348144149 | s155423932 | 106 | 72 | 14,100 | 14,224 | Accepted | Accepted | 32.08 | N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
t = 0
for k in range(1,N):
if A[k-1] > A[k]:
t = -1
break
elif A[k-1] < A[k]:
t = 1
break
if t==0:
print((1))
exit(0)
k = 0
while k < N-1:
k += 1
if t == 1:
if A[k-1] >... | N = int(eval(input()))
A = list(map(int,input().split()))
A = A
f = 0
ans = 1
for k in range(N-1):
if f == 0:
if A[k] > A[k+1]:
f = -1
elif A[k] < A[k+1]:
f = 1
elif f == 1:
if A[k] > A[k+1]:
ans += 1
f = 0
else:
... | 43 | 20 | 844 | 386 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
t = 0
for k in range(1, N):
if A[k - 1] > A[k]:
t = -1
break
elif A[k - 1] < A[k]:
t = 1
break
if t == 0:
print((1))
exit(0)
k = 0
while k < N - 1:
k += 1
if t == 1:
if A[k - 1] > A[k]:
... | N = int(eval(input()))
A = list(map(int, input().split()))
A = A
f = 0
ans = 1
for k in range(N - 1):
if f == 0:
if A[k] > A[k + 1]:
f = -1
elif A[k] < A[k + 1]:
f = 1
elif f == 1:
if A[k] > A[k + 1]:
ans += 1
f = 0
else:
if A[k... | false | 53.488372 | [
"+A = A",
"+f = 0",
"-t = 0",
"-for k in range(1, N):",
"- if A[k - 1] > A[k]:",
"- t = -1",
"- break",
"- elif A[k - 1] < A[k]:",
"- t = 1",
"- break",
"-if t == 0:",
"- print((1))",
"- exit(0)",
"-k = 0",
"-while k < N - 1:",
"- k += 1",
"... | false | 0.035898 | 0.040409 | 0.888369 | [
"s348144149",
"s155423932"
] |
u254871849 | p04045 | python | s884266114 | s445441797 | 77 | 33 | 2,940 | 3,956 | Accepted | Accepted | 57.14 | import sys
n, k, *dislikes = sys.stdin.read().split()
n = int(n)
dislikes = set(dislikes)
def main():
i = n
while True:
if set(str(i)) & dislikes:
i += 1
continue
return i
if __name__ == '__main__':
ans = main()
print(ans) | import sys
from string import digits
n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)
def main(d):
res = ''
flag = True
for i in range(l):
if flag:
if n[i] in d:
res += n[i]
else:
flag = False
... | 17 | 33 | 297 | 742 | import sys
n, k, *dislikes = sys.stdin.read().split()
n = int(n)
dislikes = set(dislikes)
def main():
i = n
while True:
if set(str(i)) & dislikes:
i += 1
continue
return i
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
from string import digits
n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)
def main(d):
res = ""
flag = True
for i in range(l):
if flag:
if n[i] in d:
res += n[i]
else:
flag = False
for j in ... | false | 48.484848 | [
"+from string import digits",
"-n, k, *dislikes = sys.stdin.read().split()",
"-n = int(n)",
"-dislikes = set(dislikes)",
"+n, k, *d = sys.stdin.read().split()",
"+d = set(digits) - set(d)",
"+l = len(n)",
"-def main():",
"- i = n",
"- while True:",
"- if set(str(i)) & dislikes:",
... | false | 0.046297 | 0.04583 | 1.010194 | [
"s884266114",
"s445441797"
] |
u017810624 | p03576 | python | s731753269 | s926777976 | 1,810 | 1,547 | 113,116 | 113,008 | Accepted | Accepted | 14.53 | import heapq
n,k=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]
x=[l[i][0] for i in range(n)]
x.sort()
y=[l[i][1] for i in range(n)]
y.sort()
ans=[]
for i1 in range(n):
for i2 in range(i1+1,n):
for i3 in range(n):
for i4 in range(i3+1,n):
ct=0
... | n,k=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]
x=[l[i][0] for i in range(n)]
x.sort()
y=[l[i][1] for i in range(n)]
y.sort()
ans=[]
for i1 in range(n):
for i2 in range(i1+1,n):
for i3 in range(n):
for i4 in range(i3+1,n):
ct=0
for i5 in ra... | 19 | 17 | 528 | 484 | import heapq
n, k = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
x = [l[i][0] for i in range(n)]
x.sort()
y = [l[i][1] for i in range(n)]
y.sort()
ans = []
for i1 in range(n):
for i2 in range(i1 + 1, n):
for i3 in range(n):
for i4 in range(i3 + 1, n):
... | n, k = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
x = [l[i][0] for i in range(n)]
x.sort()
y = [l[i][1] for i in range(n)]
y.sort()
ans = []
for i1 in range(n):
for i2 in range(i1 + 1, n):
for i3 in range(n):
for i4 in range(i3 + 1, n):
... | false | 10.526316 | [
"-import heapq",
"-",
"-heapq.heapify(ans)",
"-print((heapq.heappop(ans)))",
"+print((min(ans)))"
] | false | 0.035285 | 0.035285 | 1.000014 | [
"s731753269",
"s926777976"
] |
u301030835 | p03033 | python | s100967025 | s371524236 | 1,215 | 1,096 | 64,948 | 57,136 | Accepted | Accepted | 9.79 | import sys
input = sys.stdin.readline
import bisect
N,Q = (int(x) for x in input().split())
stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]
stop_arr_ind = list(range(N))
stop_arr_ind.sort(key=lambda x:stop_arr[x][2])
ans_arr = [-1]*Q
skip_arr = [... | import sys
input = sys.stdin.readline
import bisect
N,Q = (int(x) for x in input().split())
stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]
stop_arr.sort(key=lambda x:x[2])
ans_arr = [-1]*Q
skip_arr = [-1]*(Q+1)
def update_skip(skip_arr, x):
... | 36 | 34 | 883 | 813 | import sys
input = sys.stdin.readline
import bisect
N, Q = (int(x) for x in input().split())
stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]
stop_arr_ind = list(range(N))
stop_arr_ind.sort(key=lambda x: stop_arr[x][2])
ans_arr = [-1] * Q
skip_arr = [-1] * (Q + ... | import sys
input = sys.stdin.readline
import bisect
N, Q = (int(x) for x in input().split())
stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]
stop_arr.sort(key=lambda x: x[2])
ans_arr = [-1] * Q
skip_arr = [-1] * (Q + 1)
def update_skip(skip_arr, x):
if sk... | false | 5.555556 | [
"-stop_arr_ind = list(range(N))",
"-stop_arr_ind.sort(key=lambda x: stop_arr[x][2])",
"+stop_arr.sort(key=lambda x: x[2])",
"-for i in stop_arr_ind:",
"- s, t, x = stop_arr[i]",
"+for s, t, x in stop_arr:"
] | false | 0.042526 | 0.084281 | 0.504569 | [
"s100967025",
"s371524236"
] |
u661439250 | p02779 | python | s432962070 | s334052499 | 197 | 114 | 40,264 | 33,996 | Accepted | Accepted | 42.13 | from collections import Counter
n = int(input())
a = Counter([int(x) for x in input().split()])
print('NO') if a.most_common()[0][1]>1 else print('YES')
| from collections import Counter
n = int(input())
a = Counter([int(x) for x in input().split()])
print('NO') if len(a)!=n else print('YES')
| 4 | 4 | 156 | 142 | from collections import Counter
n = int(input())
a = Counter([int(x) for x in input().split()])
print("NO") if a.most_common()[0][1] > 1 else print("YES")
| from collections import Counter
n = int(input())
a = Counter([int(x) for x in input().split()])
print("NO") if len(a) != n else print("YES")
| false | 0 | [
"-print(\"NO\") if a.most_common()[0][1] > 1 else print(\"YES\")",
"+print(\"NO\") if len(a) != n else print(\"YES\")"
] | false | 0.037879 | 0.081781 | 0.463182 | [
"s432962070",
"s334052499"
] |
u426534722 | p02381 | python | s116824657 | s887557149 | 60 | 50 | 7,072 | 7,064 | Accepted | Accepted | 16.67 | from statistics import pstdev
while True:
data_count = int(eval(input()))
if data_count == 0:
break
print((pstdev(int(x) for x in input().split())))
| from statistics import pstdev
while True:
data_count = int(eval(input()))
if data_count == 0:
break
print((pstdev(list(map(int, input().split())))))
| 6 | 6 | 166 | 160 | from statistics import pstdev
while True:
data_count = int(eval(input()))
if data_count == 0:
break
print((pstdev(int(x) for x in input().split())))
| from statistics import pstdev
while True:
data_count = int(eval(input()))
if data_count == 0:
break
print((pstdev(list(map(int, input().split())))))
| false | 0 | [
"- print((pstdev(int(x) for x in input().split())))",
"+ print((pstdev(list(map(int, input().split())))))"
] | false | 0.050356 | 0.050024 | 1.006633 | [
"s116824657",
"s887557149"
] |
u173644182 | p02713 | python | s234477884 | s905897096 | 1,407 | 180 | 189,116 | 67,696 | Accepted | Accepted | 87.21 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def main():
K = int(eval(input()))
s = sum([gcd(i+1, j+1, k+1) for i in range(K) for j in range(K) for k in range(K)])
print(s)
if __name__=="__main__":
main()
| import math
def main():
K = int(eval(input()))
s = 0
for i in range(1, K+1):
for j in range(1, K + 1):
tmp = math.gcd(i, j)
for k in range(1, K + 1):
s += math.gcd(tmp, k)
print(s)
if __name__=="__main__":
main()
| 17 | 17 | 290 | 296 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def main():
K = int(eval(input()))
s = sum(
[gcd(i + 1, j + 1, k + 1) for i in range(K) for j in range(K) for k in range(K)]
)
print(s)
if __name__ == "__main__":
main()
| import math
def main():
K = int(eval(input()))
s = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = math.gcd(i, j)
for k in range(1, K + 1):
s += math.gcd(tmp, k)
print(s)
if __name__ == "__main__":
main()
| false | 0 | [
"-from functools import reduce",
"-",
"-",
"-def gcd(*numbers):",
"- return reduce(math.gcd, numbers)",
"- s = sum(",
"- [gcd(i + 1, j + 1, k + 1) for i in range(K) for j in range(K) for k in range(K)]",
"- )",
"+ s = 0",
"+ for i in range(1, K + 1):",
"+ for j in ra... | false | 0.085858 | 0.203502 | 0.421903 | [
"s234477884",
"s905897096"
] |
u098012509 | p02804 | python | s879470833 | s540451968 | 250 | 223 | 25,808 | 25,824 | Accepted | Accepted | 10.8 | N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
MOD = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
def cmb(n, k, p):
if (k < 0) or (n < k):
return 0
r = min(k, n - k)
return fact[n] * factinv[k] * factinv[n - k] % p
# N = 10 ** 6
for ... | N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
MOD = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
def cmb(n, k, p):
global fact, factinv
if (k < 0) or (n < k):
return 0
r = min(k, n - k)
return fact[n] * factinv[k] * facti... | 32 | 40 | 667 | 693 | N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
MOD = 10**9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
def cmb(n, k, p):
if (k < 0) or (n < k):
return 0
r = min(k, n - k)
return fact[n] * factinv[k] * factinv[n - k] % p
# N = 10 ** 6
for i in range(2, N + 1):
... | N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
MOD = 10**9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
def cmb(n, k, p):
global fact, factinv
if (k < 0) or (n < k):
return 0
r = min(k, n - k)
return fact[n] * factinv[k] * factinv[n - k] % p
for i ... | false | 20 | [
"+A.sort()",
"+ global fact, factinv",
"-# N = 10 ** 6",
"-A.sort()",
"+masum = 0",
"+misum = 0",
"-for i in range(N - K + 1):",
"- ans += A[-1 - i] * cmb(N - i - 1, K - 1, MOD)",
"- ans -= A[i] * cmb(N - i - 1, K - 1, MOD)",
"+for i in range(N - (K - 1)):",
"+ x = cmb(N - i - 1, K -... | false | 0.037513 | 0.033598 | 1.116527 | [
"s879470833",
"s540451968"
] |
u757117214 | p02873 | python | s139419287 | s508247718 | 293 | 268 | 37,012 | 29,148 | Accepted | Accepted | 8.53 | def renketu(base,a,b):
if base == 1:
b.reverse()
max_ = max(a[-1],b[0])
a.pop(-1)
b[0] = max_
a.extend(b)
return a,b
s = [*eval(input())]
if len(s) == 1:
print((1))
exit()
hugo = ["<", ">"]
a = [0]
b = []
base = -1
for i in range(len(s) - 1):
if base ==... | s = eval(input())
a = [0] * (len(s) + 1)
for i in range(len(s)):
if s[i] == '<':
a[i+1] = a[i] + 1
for i in range(len(s))[::-1]:
if s[i] == '>':
a[i] = max(a[i+1] + 1,a[i])
print((sum(a))) | 47 | 10 | 938 | 224 | def renketu(base, a, b):
if base == 1:
b.reverse()
max_ = max(a[-1], b[0])
a.pop(-1)
b[0] = max_
a.extend(b)
return a, b
s = [*eval(input())]
if len(s) == 1:
print((1))
exit()
hugo = ["<", ">"]
a = [0]
b = []
base = -1
for i in range(len(s) - 1):
if base == -1: # 一番最初
... | s = eval(input())
a = [0] * (len(s) + 1)
for i in range(len(s)):
if s[i] == "<":
a[i + 1] = a[i] + 1
for i in range(len(s))[::-1]:
if s[i] == ">":
a[i] = max(a[i + 1] + 1, a[i])
print((sum(a)))
| false | 78.723404 | [
"-def renketu(base, a, b):",
"- if base == 1:",
"- b.reverse()",
"- max_ = max(a[-1], b[0])",
"- a.pop(-1)",
"- b[0] = max_",
"- a.extend(b)",
"- return a, b",
"-",
"-",
"-s = [*eval(input())]",
"-if len(s) == 1:",
"- print((1))",
"- exit()",
"-hugo = [\"<\... | false | 0.034742 | 0.035812 | 0.970116 | [
"s139419287",
"s508247718"
] |
u891847179 | p02726 | python | s958529449 | s861257800 | 344 | 248 | 48,220 | 45,532 | Accepted | Accepted | 27.91 | from collections import defaultdict
import math
N, X, Y = list(map(int, input().split()))
res = defaultdict(int)
x = []
for i in range(1, N + 1):
for j in range(1, N + 1):
if i >= j:
continue
if i == X and Y == j:
key = 1
else:
key = int(min(j ... | N, X, Y = list(map(int, input().split()))
res = [0] * N
for j in range(1, N + 1):
for i in range(1, j):
res[min(j - i, abs(X - i) + abs(Y - j) + 1)] += 1
for i in range(1, N):
print((res[i]))
| 18 | 8 | 436 | 214 | from collections import defaultdict
import math
N, X, Y = list(map(int, input().split()))
res = defaultdict(int)
x = []
for i in range(1, N + 1):
for j in range(1, N + 1):
if i >= j:
continue
if i == X and Y == j:
key = 1
else:
key = int(min(j - i, math.f... | N, X, Y = list(map(int, input().split()))
res = [0] * N
for j in range(1, N + 1):
for i in range(1, j):
res[min(j - i, abs(X - i) + abs(Y - j) + 1)] += 1
for i in range(1, N):
print((res[i]))
| false | 55.555556 | [
"-from collections import defaultdict",
"-import math",
"-",
"-res = defaultdict(int)",
"-x = []",
"-for i in range(1, N + 1):",
"- for j in range(1, N + 1):",
"- if i >= j:",
"- continue",
"- if i == X and Y == j:",
"- key = 1",
"- else:",
"- ... | false | 0.073641 | 0.123316 | 0.59717 | [
"s958529449",
"s861257800"
] |
u057109575 | p02991 | python | s009813963 | s728335464 | 727 | 291 | 77,528 | 105,476 | Accepted | Accepted | 59.97 | from collections import deque
N, M = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(M)]
S, T = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for u, v in edges:
graph[u].append(v)
INF = 10 ** 9 + 7
dp = [[INF] * (N + 1) for _ in range(3)]
dp[... | from collections import deque
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
S, T = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for u, v in X:
graph[u].append(v)
INF = 10 ** 9 + 7
ctr = [[INF] * (N + 1) for _ in range(3)]
ctr[0][S... | 29 | 27 | 634 | 636 | from collections import deque
N, M = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(M)]
S, T = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for u, v in edges:
graph[u].append(v)
INF = 10**9 + 7
dp = [[INF] * (N + 1) for _ in range(3)]
dp[0][S] = 0
q = ... | from collections import deque
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
S, T = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for u, v in X:
graph[u].append(v)
INF = 10**9 + 7
ctr = [[INF] * (N + 1) for _ in range(3)]
ctr[0][S] = 0
stack = de... | false | 6.896552 | [
"-edges = [list(map(int, input().split())) for _ in range(M)]",
"+X = [list(map(int, input().split())) for _ in range(M)]",
"-for u, v in edges:",
"+for u, v in X:",
"-dp = [[INF] * (N + 1) for _ in range(3)]",
"-dp[0][S] = 0",
"-q = deque()",
"-q.append((S, 0))",
"-while q:",
"- v, t = q.pople... | false | 0.08957 | 0.046109 | 1.942587 | [
"s009813963",
"s728335464"
] |
u729133443 | p02771 | python | s869111187 | s849787737 | 176 | 28 | 38,340 | 8,980 | Accepted | Accepted | 84.09 | print(('YNeos'[len(set(input()[::2]))&1::2])) | print((len(set(eval(input())))%2*'Yes'or'No')) | 1 | 1 | 43 | 38 | print(("YNeos"[len(set(input()[::2])) & 1 :: 2]))
| print((len(set(eval(input()))) % 2 * "Yes" or "No"))
| false | 0 | [
"-print((\"YNeos\"[len(set(input()[::2])) & 1 :: 2]))",
"+print((len(set(eval(input()))) % 2 * \"Yes\" or \"No\"))"
] | false | 0.036605 | 0.035606 | 1.028046 | [
"s869111187",
"s849787737"
] |
u254871849 | p03310 | python | s007561909 | s487697316 | 1,140 | 543 | 24,996 | 24,996 | Accepted | Accepted | 52.37 | import sys
from itertools import accumulate
from bisect import bisect_left as bi_l
n, *a = list(map(int, sys.stdin.read().split()))
def main():
s = list(accumulate(a))
ans = float('inf')
for center in range(1, n-2):
pq = s[center]
left = bi_l(s, pq / 2)
if left == 0:
... | import sys
from itertools import accumulate
n, *a = list(map(int, sys.stdin.read().split()))
def main():
ans = float('inf')
left = 0; right = 2
p = a[0]; q = 0; r = sum(a[1:3]); s = sum(a[3:])
for c in range(1, n-2):
q += a[c]; r -= a[c]
while left < c - 1:
nex ... | 39 | 35 | 908 | 886 | import sys
from itertools import accumulate
from bisect import bisect_left as bi_l
n, *a = list(map(int, sys.stdin.read().split()))
def main():
s = list(accumulate(a))
ans = float("inf")
for center in range(1, n - 2):
pq = s[center]
left = bi_l(s, pq / 2)
if left == 0:
... | import sys
from itertools import accumulate
n, *a = list(map(int, sys.stdin.read().split()))
def main():
ans = float("inf")
left = 0
right = 2
p = a[0]
q = 0
r = sum(a[1:3])
s = sum(a[3:])
for c in range(1, n - 2):
q += a[c]
r -= a[c]
while left < c - 1:
... | false | 10.25641 | [
"-from bisect import bisect_left as bi_l",
"- s = list(accumulate(a))",
"- for center in range(1, n - 2):",
"- pq = s[center]",
"- left = bi_l(s, pq / 2)",
"- if left == 0:",
"- p = s[0]",
"- else:",
"- if pq - s[left] < s[left - 1]:",
"- ... | false | 0.045496 | 0.043514 | 1.045551 | [
"s007561909",
"s487697316"
] |
u238940874 | p03456 | python | s727761079 | s063966557 | 30 | 17 | 2,940 | 2,940 | Accepted | Accepted | 43.33 | a,b=input().split()
num=int(a+b)
for i in range(num):
if i*i == num:
print('Yes')
break
else:
print('No') | a,b=input().split()
x=int(a+b)
for i in range(int(x**0.5)+1):
if i**2 ==x:
print('Yes')
exit()
print('No') | 8 | 7 | 136 | 132 | a, b = input().split()
num = int(a + b)
for i in range(num):
if i * i == num:
print("Yes")
break
else:
print("No")
| a, b = input().split()
x = int(a + b)
for i in range(int(x**0.5) + 1):
if i**2 == x:
print("Yes")
exit()
print("No")
| false | 12.5 | [
"-num = int(a + b)",
"-for i in range(num):",
"- if i * i == num:",
"+x = int(a + b)",
"+for i in range(int(x**0.5) + 1):",
"+ if i**2 == x:",
"- break",
"-else:",
"- print(\"No\")",
"+ exit()",
"+print(\"No\")"
] | false | 0.04348 | 0.039675 | 1.095928 | [
"s727761079",
"s063966557"
] |
u761320129 | p03806 | python | s587764996 | s718162048 | 327 | 203 | 16,208 | 12,756 | Accepted | Accepted | 37.92 | N,MA,MB = list(map(int,input().split()))
ABC = [tuple(map(int,input().split())) for i in range(N)]
INF = float('inf')
from collections import defaultdict
dp = defaultdict(lambda: INF)
dp[(0,0)] = 0
for a,b,c in ABC:
dp2 = defaultdict(lambda: INF)
for (pa,pb),pc in list(dp.items()):
dp2[(pa,pb... | N,MA,MB = list(map(int,input().split()))
ABC = [tuple(map(int,input().split())) for i in range(N)]
from collections import defaultdict
from copy import copy
d = defaultdict(lambda: float('inf'))
d[(0,0)] = 0
for a,b,c in ABC:
d2 = copy(d)
for (pa,pb),pc in list(d.items()):
d2[(pa+a, pb+b)] = ... | 18 | 19 | 513 | 512 | N, MA, MB = list(map(int, input().split()))
ABC = [tuple(map(int, input().split())) for i in range(N)]
INF = float("inf")
from collections import defaultdict
dp = defaultdict(lambda: INF)
dp[(0, 0)] = 0
for a, b, c in ABC:
dp2 = defaultdict(lambda: INF)
for (pa, pb), pc in list(dp.items()):
dp2[(pa, pb... | N, MA, MB = list(map(int, input().split()))
ABC = [tuple(map(int, input().split())) for i in range(N)]
from collections import defaultdict
from copy import copy
d = defaultdict(lambda: float("inf"))
d[(0, 0)] = 0
for a, b, c in ABC:
d2 = copy(d)
for (pa, pb), pc in list(d.items()):
d2[(pa + a, pb + b)]... | false | 5.263158 | [
"-INF = float(\"inf\")",
"+from copy import copy",
"-dp = defaultdict(lambda: INF)",
"-dp[(0, 0)] = 0",
"+d = defaultdict(lambda: float(\"inf\"))",
"+d[(0, 0)] = 0",
"- dp2 = defaultdict(lambda: INF)",
"- for (pa, pb), pc in list(dp.items()):",
"- dp2[(pa, pb)] = min(dp2[(pa, pb)], pc)"... | false | 0.041321 | 0.046834 | 0.882281 | [
"s587764996",
"s718162048"
] |
u923668099 | p02468 | python | s441982477 | s204668273 | 30 | 20 | 7,700 | 7,680 | Accepted | Accepted | 33.33 | import sys
mod = 10**9 + 7
def solve():
m, n = list(map(int, input().split()))
ans = modpow(m, n, mod)
print(ans)
def modpow(x, y, mod):
res = 1
while y:
if y & 1:
res = (res * x) % mod
x = (x * x) % mod
y >>= 1
return res
if __... | import sys
mod = 10**9 + 7
def solve():
m, n = list(map(int, input().split()))
print((pow(m, n, mod)))
if __name__ == '__main__':
solve() | 25 | 10 | 348 | 153 | import sys
mod = 10**9 + 7
def solve():
m, n = list(map(int, input().split()))
ans = modpow(m, n, mod)
print(ans)
def modpow(x, y, mod):
res = 1
while y:
if y & 1:
res = (res * x) % mod
x = (x * x) % mod
y >>= 1
return res
if __name__ == "__main__":
... | import sys
mod = 10**9 + 7
def solve():
m, n = list(map(int, input().split()))
print((pow(m, n, mod)))
if __name__ == "__main__":
solve()
| false | 60 | [
"- ans = modpow(m, n, mod)",
"- print(ans)",
"-",
"-",
"-def modpow(x, y, mod):",
"- res = 1",
"- while y:",
"- if y & 1:",
"- res = (res * x) % mod",
"- x = (x * x) % mod",
"- y >>= 1",
"- return res",
"+ print((pow(m, n, mod)))"
] | false | 0.040248 | 0.047322 | 0.850529 | [
"s441982477",
"s204668273"
] |
u791146764 | p02847 | python | s915746799 | s443775257 | 21 | 19 | 9,108 | 8,960 | Accepted | Accepted | 9.52 | import sys
a=str(eval(input()))
if a=="SUN":
print((7))
elif a=="MON":
print((6))
elif a=="TUE":
print((5))
elif a=="WED":
print((4))
elif a=="THU":
print((3))
elif a=="FRI":
print((2))
else :
print((1))
| a=str(eval(input()))
L=[" ","SAT","FRI","THU","WED","TUE","MON","SUN"]
for i in range(8):
if a==L[i]:
print(i) | 17 | 5 | 238 | 120 | import sys
a = str(eval(input()))
if a == "SUN":
print((7))
elif a == "MON":
print((6))
elif a == "TUE":
print((5))
elif a == "WED":
print((4))
elif a == "THU":
print((3))
elif a == "FRI":
print((2))
else:
print((1))
| a = str(eval(input()))
L = [" ", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"]
for i in range(8):
if a == L[i]:
print(i)
| false | 70.588235 | [
"-import sys",
"-",
"-if a == \"SUN\":",
"- print((7))",
"-elif a == \"MON\":",
"- print((6))",
"-elif a == \"TUE\":",
"- print((5))",
"-elif a == \"WED\":",
"- print((4))",
"-elif a == \"THU\":",
"- print((3))",
"-elif a == \"FRI\":",
"- print((2))",
"-else:",
"- ... | false | 0.12367 | 0.048743 | 2.537192 | [
"s915746799",
"s443775257"
] |
u094999522 | p02844 | python | s089529335 | s964369995 | 84 | 65 | 9,864 | 9,232 | Accepted | Accepted | 22.62 | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
s = [int(i) for i in s]
c = 0
for i in range(10):
for j in range(10):
if i in s:
t = s[s.index(i) + 1:]
if j in t:
c += len(set(t[t.index(j) + 1:]))
print(c)
| #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
c = 0
for i in range(10):
for j in range(10):
a = s.find(str(i))
if a > -1:
b = s.find(str(j), a + 1)
if b > -1:
c += len(set(s[b + 1:]))
print(c)
| 12 | 12 | 273 | 270 | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
s = [int(i) for i in s]
c = 0
for i in range(10):
for j in range(10):
if i in s:
t = s[s.index(i) + 1 :]
if j in t:
c += len(set(t[t.index(j) + 1 :]))
print(c)
| #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
c = 0
for i in range(10):
for j in range(10):
a = s.find(str(i))
if a > -1:
b = s.find(str(j), a + 1)
if b > -1:
c += len(set(s[b + 1 :]))
print(c)
| false | 0 | [
"-s = [int(i) for i in s]",
"- if i in s:",
"- t = s[s.index(i) + 1 :]",
"- if j in t:",
"- c += len(set(t[t.index(j) + 1 :]))",
"+ a = s.find(str(i))",
"+ if a > -1:",
"+ b = s.find(str(j), a + 1)",
"+ if b > -1:",
"+... | false | 0.042028 | 0.036684 | 1.145676 | [
"s089529335",
"s964369995"
] |
u111365362 | p02614 | python | s759338501 | s401134620 | 185 | 92 | 75,144 | 68,604 | Accepted | Accepted | 50.27 | h,w,k = list(map(int,input().split()))
raw = []
for _ in range(h):
tmp = eval(input())
add = []
for j in range(w):
if tmp[j] == '.':
add.append(0)
else:
add.append(1)
raw.append(add)
ans = 0
time1 = [0 for i in range(h)]
time2 = [0 for j in range(w)]
def nex(time):
l = len(t... | h,w,k = list(map(int,input().split()))
time1 = [0 for _ in range(h)]
time2 = [0 for _ in range(w)]
raw = []
for _ in range(h):
raw.append(eval(input()))
def nex(time):
l = len(time)
for i in range(l):
if time[i] == 0:
time[i] = 1
return time
else:
time[i] = 0
else:
r... | 48 | 30 | 997 | 653 | h, w, k = list(map(int, input().split()))
raw = []
for _ in range(h):
tmp = eval(input())
add = []
for j in range(w):
if tmp[j] == ".":
add.append(0)
else:
add.append(1)
raw.append(add)
ans = 0
time1 = [0 for i in range(h)]
time2 = [0 for j in range(w)]
def nex(... | h, w, k = list(map(int, input().split()))
time1 = [0 for _ in range(h)]
time2 = [0 for _ in range(w)]
raw = []
for _ in range(h):
raw.append(eval(input()))
def nex(time):
l = len(time)
for i in range(l):
if time[i] == 0:
time[i] = 1
return time
else:
tim... | false | 37.5 | [
"+time1 = [0 for _ in range(h)]",
"+time2 = [0 for _ in range(w)]",
"- tmp = eval(input())",
"- add = []",
"- for j in range(w):",
"- if tmp[j] == \".\":",
"- add.append(0)",
"- else:",
"- add.append(1)",
"- raw.append(add)",
"-ans = 0",
"-time1 ... | false | 0.046377 | 0.039187 | 1.183482 | [
"s759338501",
"s401134620"
] |
u254871849 | p02970 | python | s510449234 | s238662622 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | # 2019-11-15 14:12:24(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# ... | import sys
n, d = list(map(int, sys.stdin.readline().split()))
def main():
c = 2*d + 1
return (n + c - 1) // c
if __name__ == '__main__':
ans = main()
print(ans) | 20 | 11 | 529 | 184 | # 2019-11-15 14:12:24(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import n... | import sys
n, d = list(map(int, sys.stdin.readline().split()))
def main():
c = 2 * d + 1
return (n + c - 1) // c
if __name__ == "__main__":
ans = main()
print(ans)
| false | 45 | [
"-# 2019-11-15 14:12:24(JST)",
"-# import collections",
"-import math",
"+n, d = list(map(int, sys.stdin.readline().split()))",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools... | false | 0.146007 | 0.153562 | 0.950798 | [
"s510449234",
"s238662622"
] |
u278886389 | p02760 | python | s053035794 | s868598194 | 218 | 164 | 38,528 | 38,384 | Accepted | Accepted | 24.77 | from collections import defaultdict
def a():
A = []
A += list(map(int,input().split()))
A += list(map(int,input().split()))
A += list(map(int,input().split()))
N = int(eval(input()))
d = defaultdict(int)
for _ in range(N):
d[int(eval(input()))] = 1
B = list([d[x] for ... | (lambda A:(lambda N:(lambda
C:(lambda d:(lambda B:print
(["No","Yes"][3 in{sum(B[2:
8:2]),sum(B[::4])}|{sum(B[i
*3:i*3+3])for i in range(3)
} | { sum(B[i::3] )for i in
range(3)} ] ) ) ( list(map(
lambda x:d[x],A))))([x in C
for x in range(101)]))({int
(input())for x in range(N)}
))(int(input())))(list(map(
i... | 28 | 14 | 607 | 408 | from collections import defaultdict
def a():
A = []
A += list(map(int, input().split()))
A += list(map(int, input().split()))
A += list(map(int, input().split()))
N = int(eval(input()))
d = defaultdict(int)
for _ in range(N):
d[int(eval(input()))] = 1
B = list([d[x] for x in A]... | (
lambda A: (
lambda N: (
lambda C: (
lambda d: (
lambda B: print(
["No", "Yes"][
3
in {sum(B[2:8:2]), sum(B[::4])}
| {sum(B[i * 3 : i * 3 + 3]) for i i... | false | 50 | [
"-from collections import defaultdict",
"-",
"-",
"-def a():",
"- A = []",
"- A += list(map(int, input().split()))",
"- A += list(map(int, input().split()))",
"- A += list(map(int, input().split()))",
"- N = int(eval(input()))",
"- d = defaultdict(int)",
"- for _ in range(N)... | false | 0.047069 | 0.046838 | 1.004932 | [
"s053035794",
"s868598194"
] |
u008357982 | p02862 | python | s784676527 | s702445809 | 159 | 130 | 3,064 | 3,064 | Accepted | Accepted | 18.24 | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
print((0))
exit()
if a == 0 or b == 0:
print((1))
exit()
def neko(n, r):
p, q = 1, 1
for i in range(r... | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
print((0))
exit()
if a == 0 or b == 0:
print((1))
exit()
def neko(n, r):
p, q = 1, 1
for i in range(r... | 25 | 26 | 439 | 454 | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
print((0))
exit()
if a == 0 or b == 0:
print((1))
exit()
def neko(n, r):
p, q = 1, 1
for i in range(r):
p = p *... | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
print((0))
exit()
if a == 0 or b == 0:
print((1))
exit()
def neko(n, r):
p, q = 1, 1
for i in range(r):
p = p *... | false | 3.846154 | [
"-print((neko(n, a)))",
"+r = min(a, b)",
"+print((neko(n, r)))"
] | false | 0.064975 | 0.065382 | 0.993789 | [
"s784676527",
"s702445809"
] |
u077291787 | p02972 | python | s281670405 | s933277332 | 199 | 173 | 12,576 | 12,664 | Accepted | Accepted | 13.07 | # ABC134D - Preparing Boxes
# Better ver.
def main():
n = int(eval(input()))
A = [0] + list(map(int, input().rstrip().split()))
ans = [] # answer "in any order"
ans_append = ans.append
for i in range(n, 0, -1):
A[i] = sum(A[i::i]) % 2
if A[i]:
ans_append(i)
... | # ABC134D - Preparing Boxes
def main():
N, *A = list(map(int, open(0).read().split()))
A = [0] + A
for i in range(N // 2, 0, -1): # second half: no multiples
A[i] = sum(A[i::i]) % 2
ans = [i for i, j in enumerate(A) if j]
print((len(ans)))
print((*ans))
if __name__ == "__ma... | 17 | 13 | 392 | 328 | # ABC134D - Preparing Boxes
# Better ver.
def main():
n = int(eval(input()))
A = [0] + list(map(int, input().rstrip().split()))
ans = [] # answer "in any order"
ans_append = ans.append
for i in range(n, 0, -1):
A[i] = sum(A[i::i]) % 2
if A[i]:
ans_append(i)
print((le... | # ABC134D - Preparing Boxes
def main():
N, *A = list(map(int, open(0).read().split()))
A = [0] + A
for i in range(N // 2, 0, -1): # second half: no multiples
A[i] = sum(A[i::i]) % 2
ans = [i for i, j in enumerate(A) if j]
print((len(ans)))
print((*ans))
if __name__ == "__main__":
... | false | 23.529412 | [
"-# Better ver.",
"- n = int(eval(input()))",
"- A = [0] + list(map(int, input().rstrip().split()))",
"- ans = [] # answer \"in any order\"",
"- ans_append = ans.append",
"- for i in range(n, 0, -1):",
"+ N, *A = list(map(int, open(0).read().split()))",
"+ A = [0] + A",
"+ f... | false | 0.036985 | 0.038822 | 0.952677 | [
"s281670405",
"s933277332"
] |
u186838327 | p03436 | python | s808258529 | s164598764 | 200 | 25 | 40,048 | 3,316 | Accepted | Accepted | 87.5 | h, w = list(map(int, input().split()))
b = 0
l = [0]*h
for k in range(h):
a = str(eval(input()))
for k_ in range(w):
if a[k_] == '#':
b += 1
l[k] = a
#l = [str(input()) for _ in range(h)]
from collections import deque
queue = deque()
visit = [[-1]*w for _ in range(h)]
queue.append([0,... | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if M[i][j] == '.':
ans += 1
M = ['#'*w] + M + ['#'*w]
M = ['#'+c+'#' for c in M]
from collections import deque
q = deque()
q.append((1, 1))
visit = ... | 32 | 32 | 768 | 697 | h, w = list(map(int, input().split()))
b = 0
l = [0] * h
for k in range(h):
a = str(eval(input()))
for k_ in range(w):
if a[k_] == "#":
b += 1
l[k] = a
# l = [str(input()) for _ in range(h)]
from collections import deque
queue = deque()
visit = [[-1] * w for _ in range(h)]
queue.append(... | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if M[i][j] == ".":
ans += 1
M = ["#" * w] + M + ["#" * w]
M = ["#" + c + "#" for c in M]
from collections import deque
q = deque()
q.append((1, 1))
visit = [[-1] * (w ... | false | 0 | [
"-b = 0",
"-l = [0] * h",
"-for k in range(h):",
"- a = str(eval(input()))",
"- for k_ in range(w):",
"- if a[k_] == \"#\":",
"- b += 1",
"- l[k] = a",
"-# l = [str(input()) for _ in range(h)]",
"+M = [str(eval(input())) for _ in range(h)]",
"+ans = 0",
"+for i in ra... | false | 0.042484 | 0.037228 | 1.141192 | [
"s808258529",
"s164598764"
] |
u512212329 | p02577 | python | s780359698 | s777282234 | 216 | 54 | 9,148 | 9,172 | Accepted | Accepted | 75 | def main():
num = int(eval(input()))
if num % 9 == 0:
return 'Yes'
else:
return 'No'
if __name__ == '__main__':
ans = main()
print(ans)
| def main():
num = eval(input())
if sum(int(c) for c in num) % 9 == 0:
return 'Yes'
else:
return 'No'
if __name__ == '__main__':
ans = main()
print(ans)
| 11 | 11 | 178 | 194 | def main():
num = int(eval(input()))
if num % 9 == 0:
return "Yes"
else:
return "No"
if __name__ == "__main__":
ans = main()
print(ans)
| def main():
num = eval(input())
if sum(int(c) for c in num) % 9 == 0:
return "Yes"
else:
return "No"
if __name__ == "__main__":
ans = main()
print(ans)
| false | 0 | [
"- num = int(eval(input()))",
"- if num % 9 == 0:",
"+ num = eval(input())",
"+ if sum(int(c) for c in num) % 9 == 0:"
] | false | 0.043366 | 0.047327 | 0.916304 | [
"s780359698",
"s777282234"
] |
u226155577 | p03060 | python | s732974063 | s080763279 | 681 | 18 | 42,092 | 2,940 | Accepted | Accepted | 97.36 | from itertools import product
N = int(eval(input()))
*V, = list(map(int, input().split()))
*C, = list(map(int, input().split()))
ans = -10**18
for p in product([0, 1], repeat=N):
res = 0
for i, e in enumerate(p):
if e:
res += V[i] - C[i]
ans = max(ans, res)
print(ans) | N = int(eval(input()))
*V, = list(map(int, input().split()))
*C, = list(map(int, input().split()))
ans = 0
for v, c in zip(V, C):
if v > c:
ans += v-c
print(ans) | 14 | 9 | 297 | 164 | from itertools import product
N = int(eval(input()))
(*V,) = list(map(int, input().split()))
(*C,) = list(map(int, input().split()))
ans = -(10**18)
for p in product([0, 1], repeat=N):
res = 0
for i, e in enumerate(p):
if e:
res += V[i] - C[i]
ans = max(ans, res)
print(ans)
| N = int(eval(input()))
(*V,) = list(map(int, input().split()))
(*C,) = list(map(int, input().split()))
ans = 0
for v, c in zip(V, C):
if v > c:
ans += v - c
print(ans)
| false | 35.714286 | [
"-from itertools import product",
"-",
"-ans = -(10**18)",
"-for p in product([0, 1], repeat=N):",
"- res = 0",
"- for i, e in enumerate(p):",
"- if e:",
"- res += V[i] - C[i]",
"- ans = max(ans, res)",
"+ans = 0",
"+for v, c in zip(V, C):",
"+ if v > c:",
"+ ... | false | 0.103283 | 0.032085 | 3.218998 | [
"s732974063",
"s080763279"
] |
u022407960 | p02259 | python | s077984522 | s952893846 | 30 | 20 | 7,700 | 7,708 | Accepted | Accepted | 33.33 | #!/usr/bin/env python
# encoding: utf-8
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def bubble_sort():
# write your code here
array_length = int(eval(input()))
unsorted_array = [int(x) for x in input... | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def bubble_sort():
# write your code here
array_length = int(eval(input()))
array = [int(x) for x in input().split()]
flag, count, cursor = 1, 0, 0
while flag:
flag = 0
... | 32 | 28 | 856 | 722 | #!/usr/bin/env python
# encoding: utf-8
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def bubble_sort():
# write your code here
array_length = int(eval(input()))
unsorted_array = [int(x) for x in input().split()]
... | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def bubble_sort():
# write your code here
array_length = int(eval(input()))
array = [int(x) for x in input().split()]
flag, count, cursor = 1, 0, 0
while flag:
flag = 0
for j in ... | false | 12.5 | [
"- \"\"\"",
"- @param prices: Given an integer array",
"- @return: Maximum profit",
"- \"\"\"",
"-",
"- unsorted_array = [int(x) for x in input().split()]",
"- flag = 1",
"- count = 0",
"+ array = [int(x) for x in input().split()]",
"+ flag, count, cu... | false | 0.043599 | 0.043872 | 0.99378 | [
"s077984522",
"s952893846"
] |
u833543158 | p03013 | python | s780738904 | s373651068 | 468 | 60 | 460,020 | 6,900 | Accepted | Accepted | 87.18 | import sys
N, M = list(map(int, input().split()))
ans = [-1] * (N + 1) # not evaluated yet
for line in sys.stdin:
ans[int(line)] = 0 # unreachable
ans[0] = 1 # reachable
if ans[1]:
ans[1] = 1
for i in range(2, N + 1):
if ans[i]:
ans[i] = ans[i - 1] + ans[i - 2]
print((ans[N... | import sys
N, M = list(map(int, input().split()))
ans = [-1] * (N + 1) # not evaluated yet
for line in sys.stdin:
ans[int(line)] = 0 # unreachable
ans[0] = 1 # reachable
if ans[1]: # if not unreachable
ans[1] = 1
for i in range(2, N + 1):
if ans[i]:
ans[i] = (ans[i - 1] + ans... | 18 | 18 | 329 | 353 | import sys
N, M = list(map(int, input().split()))
ans = [-1] * (N + 1) # not evaluated yet
for line in sys.stdin:
ans[int(line)] = 0 # unreachable
ans[0] = 1 # reachable
if ans[1]:
ans[1] = 1
for i in range(2, N + 1):
if ans[i]:
ans[i] = ans[i - 1] + ans[i - 2]
print((ans[N] % 1000000007))
| import sys
N, M = list(map(int, input().split()))
ans = [-1] * (N + 1) # not evaluated yet
for line in sys.stdin:
ans[int(line)] = 0 # unreachable
ans[0] = 1 # reachable
if ans[1]: # if not unreachable
ans[1] = 1
for i in range(2, N + 1):
if ans[i]:
ans[i] = (ans[i - 1] + ans[i - 2]) % 10000000... | false | 0 | [
"-if ans[1]:",
"+if ans[1]: # if not unreachable",
"- ans[i] = ans[i - 1] + ans[i - 2]",
"-print((ans[N] % 1000000007))",
"+ ans[i] = (ans[i - 1] + ans[i - 2]) % 1000000007",
"+print((ans[N]))"
] | false | 0.045571 | 0.034186 | 1.333028 | [
"s780738904",
"s373651068"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.