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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u517910772 | p02659 | python | s940505922 | s783239911 | 26 | 24 | 10,084 | 9,204 | Accepted | Accepted | 7.69 | def c():
from decimal import Decimal
import math
a, b = list(map(str, input().split()))
print((int(math.floor(Decimal(a) * Decimal(b)))))
if __name__ == "__main__":
c()
| def cc():
a, b = list(map(str, input().split()))
a2 = int(a)
b2 = int(b.replace('.', ''))
c = a2 * b2
ans = str(c)[0:-2] if len(str(c)) > 2 else 0
print(ans)
if __name__ == "__main__":
cc()
| 8 | 9 | 189 | 220 | def c():
from decimal import Decimal
import math
a, b = list(map(str, input().split()))
print((int(math.floor(Decimal(a) * Decimal(b)))))
if __name__ == "__main__":
c()
| def cc():
a, b = list(map(str, input().split()))
a2 = int(a)
b2 = int(b.replace(".", ""))
c = a2 * b2
ans = str(c)[0:-2] if len(str(c)) > 2 else 0
print(ans)
if __name__ == "__main__":
cc()
| false | 11.111111 | [
"-def c():",
"- from decimal import Decimal",
"- import math",
"-",
"+def cc():",
"- print((int(math.floor(Decimal(a) * Decimal(b)))))",
"+ a2 = int(a)",
"+ b2 = int(b.replace(\".\", \"\"))",
"+ c = a2 * b2",
"+ ans = str(c)[0:-2] if len(str(c)) > 2 else 0",
"+ print(ans)... | false | 0.130002 | 0.064813 | 2.005793 | [
"s940505922",
"s783239911"
] |
u312025627 | p03352 | python | s824567768 | s142937146 | 176 | 28 | 38,256 | 2,940 | Accepted | Accepted | 84.09 | def main():
X = int(eval(input()))
ans = []
for b in range(1, 100):
for p in range(2, 10):
if b**p <= X:
ans.append(b**p)
print((max(ans)))
if __name__ == '__main__':
main()
| def main():
N = int(eval(input()))
ans = set()
for a in range(N+1):
for b in range(2, 31):
if a**b > N:
continue
ans.add(a**b)
print((max(ans)))
if __name__ == '__main__':
main()
| 12 | 13 | 235 | 253 | def main():
X = int(eval(input()))
ans = []
for b in range(1, 100):
for p in range(2, 10):
if b**p <= X:
ans.append(b**p)
print((max(ans)))
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
ans = set()
for a in range(N + 1):
for b in range(2, 31):
if a**b > N:
continue
ans.add(a**b)
print((max(ans)))
if __name__ == "__main__":
main()
| false | 7.692308 | [
"- X = int(eval(input()))",
"- ans = []",
"- for b in range(1, 100):",
"- for p in range(2, 10):",
"- if b**p <= X:",
"- ans.append(b**p)",
"+ N = int(eval(input()))",
"+ ans = set()",
"+ for a in range(N + 1):",
"+ for b in range(2, 31):",... | false | 0.057858 | 0.039687 | 1.457858 | [
"s824567768",
"s142937146"
] |
u077291787 | p03745 | python | s305370198 | s501742925 | 66 | 53 | 14,356 | 14,352 | Accepted | Accepted | 19.7 | # AGC013A - Sorted Arrays
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
# compress continuous parts of same numbers (e.g. 111 -> 1)
B, cur = [], 0
for i in A:
if i != cur:
B += [i]
cur = i
B += [0]
# check the ... | # AGC013A - Sorted Arrays
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
ans, cur = 0, A[0]
flg = 0 # unknown (0), increasing (1), decreasing (2)
for i in A:
if (flg == 1 and i < cur) or (flg == 2 and i > cur): # end of trend
ans += 1
... | 26 | 20 | 653 | 565 | # AGC013A - Sorted Arrays
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
# compress continuous parts of same numbers (e.g. 111 -> 1)
B, cur = [], 0
for i in A:
if i != cur:
B += [i]
cur = i
B += [0]
# check the modified sequen... | # AGC013A - Sorted Arrays
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
ans, cur = 0, A[0]
flg = 0 # unknown (0), increasing (1), decreasing (2)
for i in A:
if (flg == 1 and i < cur) or (flg == 2 and i > cur): # end of trend
ans += 1
flg = ... | false | 23.076923 | [
"- A = tuple(map(int, input().rstrip().split()))",
"- # compress continuous parts of same numbers (e.g. 111 -> 1)",
"- B, cur = [], 0",
"+ A = tuple(map(int, input().split()))",
"+ ans, cur = 0, A[0]",
"+ flg = 0 # unknown (0), increasing (1), decreasing (2)",
"- if i != cur:",... | false | 0.04418 | 0.04581 | 0.964407 | [
"s305370198",
"s501742925"
] |
u102461423 | p02702 | python | s815067088 | s803644718 | 591 | 325 | 29,148 | 29,192 | Accepted | Accepted | 45.01 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % 2019
newdp = np.zer... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 2019
def solve(S):
dp = np.zeros(MOD, np.int64)
temp = np.empty_like(dp)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x =... | 39 | 40 | 807 | 813 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % 2019
newdp = np.zeros_like(dp)
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 2019
def solve(S):
dp = np.zeros(MOD, np.int64)
temp = np.empty_like(dp)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 % ... | false | 2.5 | [
"+MOD = 2019",
"+",
"- dp = np.zeros(2019, np.int64)",
"+ dp = np.zeros(MOD, np.int64)",
"+ temp = np.empty_like(dp)",
"- x = x * pow10 % 2019",
"- newdp = np.zeros_like(dp)",
"- newdp[x:] += dp[:-x]",
"- newdp[:x] += dp[-x:]",
"- answer += newdp[0]",
... | false | 0.203232 | 0.207878 | 0.977653 | [
"s815067088",
"s803644718"
] |
u883621917 | p02900 | python | s725534998 | s330175357 | 325 | 220 | 29,840 | 79,600 | Accepted | Accepted | 32.31 | a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)
import sys
if small == 1:
print((1))
sys.exit(0)
import math
import collections
# FYI: https://ja.wikipedia.org/wiki/%E8%A9%A6%E3%81%97%E5%89%B2%E3%82%8A%E6%B3%95
def prime_factorization(num, divisors=None):
if num... | a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)
import sys
if small == 1:
print((1))
sys.exit(0)
import math
import collections
# FYI: https://ja.wikipedia.org/wiki/%E8%A9%A6%E3%81%97%E5%89%B2%E3%82%8A%E6%B3%95
def prime_factorization(num, divisors=None):
if num... | 44 | 42 | 1,184 | 1,087 | a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)
import sys
if small == 1:
print((1))
sys.exit(0)
import math
import collections
# FYI: https://ja.wikipedia.org/wiki/%E8%A9%A6%E3%81%97%E5%89%B2%E3%82%8A%E6%B3%95
def prime_factorization(num, divisors=None):
if num <= 1:
as... | a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)
import sys
if small == 1:
print((1))
sys.exit(0)
import math
import collections
# FYI: https://ja.wikipedia.org/wiki/%E8%A9%A6%E3%81%97%E5%89%B2%E3%82%8A%E6%B3%95
def prime_factorization(num, divisors=None):
if num <= 1:
as... | false | 4.545455 | [
"-# divisors = [2] + [i for i in range(3, int(math.sqrt(big)) + 1) if i % 2 != 0]",
"-# small_factors = set(prime_factorization(small, divisors))",
"-# big_factors = set(prime_factorization(big, divisors))",
"-small_factors = set(prime_factorization(small))",
"-big_factors = set(prime_factorization(big))",
... | false | 0.039279 | 0.038677 | 1.015543 | [
"s725534998",
"s330175357"
] |
u221898645 | p02813 | python | s758142971 | s002043459 | 35 | 27 | 8,052 | 8,052 | Accepted | Accepted | 22.86 | N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
import itertools
X = list(itertools.permutations(list(range(1,N+1)),N))
for i in range(len(X)):
x = X[i]
if P == x:
a = i
if Q == x:
b = i
print((abs(a-b))) | N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
import itertools
X = list(itertools.permutations(list(range(1,N+1)),N))
print((abs(X.index(Q)-X.index(P)))) | 14 | 8 | 269 | 199 | N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
import itertools
X = list(itertools.permutations(list(range(1, N + 1)), N))
for i in range(len(X)):
x = X[i]
if P == x:
a = i
if Q == x:
b = i
print((abs(a - b)))
| N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
import itertools
X = list(itertools.permutations(list(range(1, N + 1)), N))
print((abs(X.index(Q) - X.index(P))))
| false | 42.857143 | [
"-for i in range(len(X)):",
"- x = X[i]",
"- if P == x:",
"- a = i",
"- if Q == x:",
"- b = i",
"-print((abs(a - b)))",
"+print((abs(X.index(Q) - X.index(P))))"
] | false | 0.048392 | 0.090323 | 0.53576 | [
"s758142971",
"s002043459"
] |
u681444474 | p03160 | python | s310174701 | s772249887 | 237 | 141 | 52,464 | 13,900 | Accepted | Accepted | 40.51 | N = int(eval(input()))
H_ = list(map(int,input().split()))
def dp_solver(x):#x番の足場に行くための最小コスト
H = H_
dp = [0]*len(H)
dp[1] = abs(H[0]-H[1])
for i in range(len(H)-2):
dp[i+2] = min(dp[i]+abs(H[i+2]-H[i]),dp[i+1]+abs(H[i+2]-H[i+1]))
return dp[x]
print((dp_solver(N-1))) | N = int(eval(input()))
H_ = list(map(int,input().split()))
def dp_solver(x):
H = H_
dp=[float('inf')]*N
dp[0]=0
dp[1]=abs(H[1]-H[0])
for i in range(N-2):
dp[i+2] = min(dp[i+2],dp[i]+abs(H[i+2]-H[i]))
dp[i+2] = min(dp[i+2],dp[i+1]+abs(H[i+2]-H[i+1]))
return dp[x-1]
prin... | 11 | 12 | 302 | 329 | N = int(eval(input()))
H_ = list(map(int, input().split()))
def dp_solver(x): # x番の足場に行くための最小コスト
H = H_
dp = [0] * len(H)
dp[1] = abs(H[0] - H[1])
for i in range(len(H) - 2):
dp[i + 2] = min(
dp[i] + abs(H[i + 2] - H[i]), dp[i + 1] + abs(H[i + 2] - H[i + 1])
)
return d... | N = int(eval(input()))
H_ = list(map(int, input().split()))
def dp_solver(x):
H = H_
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(N - 2):
dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i + 2] - H[i]))
dp[i + 2] = min(dp[i + 2], dp[i + 1] + abs(H[i + 2] - H[i ... | false | 8.333333 | [
"-def dp_solver(x): # x番の足場に行くための最小コスト",
"+def dp_solver(x):",
"- dp = [0] * len(H)",
"- dp[1] = abs(H[0] - H[1])",
"- for i in range(len(H) - 2):",
"- dp[i + 2] = min(",
"- dp[i] + abs(H[i + 2] - H[i]), dp[i + 1] + abs(H[i + 2] - H[i + 1])",
"- )",
"- return dp... | false | 0.05409 | 0.069583 | 0.777346 | [
"s310174701",
"s772249887"
] |
u912237403 | p00017 | python | s884482593 | s649990865 | 20 | 10 | 4,376 | 4,208 | Accepted | Accepted | 50 | import sys,string
A="abcdefghijklmnopqrstuvwxyz"
tbl=string.maketrans(A,A[1:]+A[0])
for s in sys.stdin.readlines():
while not("the" in s or "that" in s or "this" in s):
s=s.translate(tbl)
print(s[:-1]) | import sys
A="abcdefghijklmnopqrstuvwxyza"
def rot(s):
x=""
for c in s:
if c in A: x+=A[A.index(c)+1]
else: x+=c
return x
for s in sys.stdin.readlines():
while not("the" in s or "that" in s or "this" in s):
s=rot(s)
print(s[:-1]) | 7 | 13 | 222 | 287 | import sys, string
A = "abcdefghijklmnopqrstuvwxyz"
tbl = string.maketrans(A, A[1:] + A[0])
for s in sys.stdin.readlines():
while not ("the" in s or "that" in s or "this" in s):
s = s.translate(tbl)
print(s[:-1])
| import sys
A = "abcdefghijklmnopqrstuvwxyza"
def rot(s):
x = ""
for c in s:
if c in A:
x += A[A.index(c) + 1]
else:
x += c
return x
for s in sys.stdin.readlines():
while not ("the" in s or "that" in s or "this" in s):
s = rot(s)
print(s[:-1])
| false | 46.153846 | [
"-import sys, string",
"+import sys",
"-A = \"abcdefghijklmnopqrstuvwxyz\"",
"-tbl = string.maketrans(A, A[1:] + A[0])",
"+A = \"abcdefghijklmnopqrstuvwxyza\"",
"+",
"+",
"+def rot(s):",
"+ x = \"\"",
"+ for c in s:",
"+ if c in A:",
"+ x += A[A.index(c) + 1]",
"+ ... | false | 0.04414 | 0.08903 | 0.495783 | [
"s884482593",
"s649990865"
] |
u017415492 | p03208 | python | s394724978 | s874239402 | 249 | 223 | 7,384 | 7,484 | Accepted | Accepted | 10.44 | n,k=list(map(int,input().split()))
h=[]
for i in range(n):
h.append(int(eval(input())))
h.sort()
S=10000000000000
for i in range(n-k+1):
if S>h[i+k-1]-h[i]:
S=h[i+k-1]-h[i]
print(S) | n,k=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]
h.sort()
hantei=10**9+1
for i in range(len(h)-k+1):
if (h[i+k-1]-h[i])<hantei:
hantei=h[i+k-1]-h[i]
print(hantei) | 11 | 8 | 188 | 190 | n, k = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(eval(input())))
h.sort()
S = 10000000000000
for i in range(n - k + 1):
if S > h[i + k - 1] - h[i]:
S = h[i + k - 1] - h[i]
print(S)
| n, k = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
h.sort()
hantei = 10**9 + 1
for i in range(len(h) - k + 1):
if (h[i + k - 1] - h[i]) < hantei:
hantei = h[i + k - 1] - h[i]
print(hantei)
| false | 27.272727 | [
"-h = []",
"-for i in range(n):",
"- h.append(int(eval(input())))",
"+h = [int(eval(input())) for i in range(n)]",
"-S = 10000000000000",
"-for i in range(n - k + 1):",
"- if S > h[i + k - 1] - h[i]:",
"- S = h[i + k - 1] - h[i]",
"-print(S)",
"+hantei = 10**9 + 1",
"+for i in range... | false | 0.049584 | 0.061875 | 0.80136 | [
"s394724978",
"s874239402"
] |
u998741086 | p02601 | python | s368759393 | s608785629 | 33 | 24 | 9,200 | 9,156 | Accepted | Accepted | 27.27 | #!/usr/bin/env python
ta, tb, tc = list(map(int, input().split()))
k = int(eval(input()))
def dfs(s):
a = ta
b = tb
c = tc
if len(s) == k:
#print(s)
for i in range(k):
if 'A' == s[i]:
a *= 2
elif 'B' == s[i]:
b *= 2... | #!/usr/bin/env python
a, b, c = list(map(int, input().split()))
k = int(eval(input()))
t = 0
while a>=b:
b *= 2
t += 1
while b>=c:
c *= 2
t += 1
if t<=k:
print('Yes')
else:
print('No')
| 29 | 17 | 524 | 217 | #!/usr/bin/env python
ta, tb, tc = list(map(int, input().split()))
k = int(eval(input()))
def dfs(s):
a = ta
b = tb
c = tc
if len(s) == k:
# print(s)
for i in range(k):
if "A" == s[i]:
a *= 2
elif "B" == s[i]:
b *= 2
e... | #!/usr/bin/env python
a, b, c = list(map(int, input().split()))
k = int(eval(input()))
t = 0
while a >= b:
b *= 2
t += 1
while b >= c:
c *= 2
t += 1
if t <= k:
print("Yes")
else:
print("No")
| false | 41.37931 | [
"-ta, tb, tc = list(map(int, input().split()))",
"+a, b, c = list(map(int, input().split()))",
"-",
"-",
"-def dfs(s):",
"- a = ta",
"- b = tb",
"- c = tc",
"- if len(s) == k:",
"- # print(s)",
"- for i in range(k):",
"- if \"A\" == s[i]:",
"- ... | false | 0.086258 | 0.034559 | 2.495942 | [
"s368759393",
"s608785629"
] |
u639343026 | p02887 | python | s662795728 | s109018340 | 49 | 45 | 3,316 | 3,316 | Accepted | Accepted | 8.16 | n=int(eval(input()))
s=eval(input())
cnt=1
if n==1:
print(cnt)
else:
for i in range(n):
if i==0: memo=s[i]
else:
if memo==s[i]:
continue
else:
cnt+=1
memo=s[i]
print(cnt) | n=eval(input())
s=eval(input())
res=1
for i in range(1,int(n)):
if s[i-1]!=s[i]:
res+=1
print(res) | 16 | 7 | 278 | 104 | n = int(eval(input()))
s = eval(input())
cnt = 1
if n == 1:
print(cnt)
else:
for i in range(n):
if i == 0:
memo = s[i]
else:
if memo == s[i]:
continue
else:
cnt += 1
memo = s[i]
print(cnt)
| n = eval(input())
s = eval(input())
res = 1
for i in range(1, int(n)):
if s[i - 1] != s[i]:
res += 1
print(res)
| false | 56.25 | [
"-n = int(eval(input()))",
"+n = eval(input())",
"-cnt = 1",
"-if n == 1:",
"- print(cnt)",
"-else:",
"- for i in range(n):",
"- if i == 0:",
"- memo = s[i]",
"- else:",
"- if memo == s[i]:",
"- continue",
"- else:",
"- ... | false | 0.047292 | 0.048102 | 0.983169 | [
"s662795728",
"s109018340"
] |
u236127431 | p03575 | python | s221584743 | s434940155 | 33 | 25 | 3,060 | 3,064 | Accepted | Accepted | 24.24 | N,M=list(map(int,input().split()))
List=[[int(i) for i in input().split()] for i in range(M)]
S=0
for i in range(M):
new_List=list(List)
del new_List[i]
islands=[1]
for i in islands:
for j in new_List:
if i in j:
j=[item for item in j if item not in islands]
islands.extend(j... | class Unionfind:
def __init__(self,n):
self.Tree=[i for i in range(n)]
def find(self,x):
if x==self.Tree[x]:
return x
else:
root=self.find(self.Tree[x])
self.Tree[x]=root
return root
def unite(self,x,y):
s1=self.find(x)
s2=self.find(y)
if s1==s2:
... | 16 | 43 | 363 | 823 | N, M = list(map(int, input().split()))
List = [[int(i) for i in input().split()] for i in range(M)]
S = 0
for i in range(M):
new_List = list(List)
del new_List[i]
islands = [1]
for i in islands:
for j in new_List:
if i in j:
j = [item for item in j if item not in isla... | class Unionfind:
def __init__(self, n):
self.Tree = [i for i in range(n)]
def find(self, x):
if x == self.Tree[x]:
return x
else:
root = self.find(self.Tree[x])
self.Tree[x] = root
return root
def unite(self, x, y):
s1 = self.... | false | 62.790698 | [
"+class Unionfind:",
"+ def __init__(self, n):",
"+ self.Tree = [i for i in range(n)]",
"+",
"+ def find(self, x):",
"+ if x == self.Tree[x]:",
"+ return x",
"+ else:",
"+ root = self.find(self.Tree[x])",
"+ self.Tree[x] = root",
"+ ... | false | 0.046701 | 0.045724 | 1.021369 | [
"s221584743",
"s434940155"
] |
u376420711 | p03073 | python | s572478482 | s376539724 | 46 | 19 | 3,632 | 3,188 | Accepted | Accepted | 58.7 | zero = "01" * 10**5
one = "10" * 10**5
s = str(eval(input()))
ans1 = 0
ans2 = 0
for i, j in zip(s, zero):
if i != j:
ans1 += 1
for i, j in zip(s, one):
if i != j:
ans2 += 1
print((min(ans1, ans2)))
| s = str(eval(input()))
ans1 = s[::2].count("0") + s[1::2].count("1")
ans2 = s[::2].count("1") + s[1::2].count("0")
print((min(ans1, ans2))) | 12 | 4 | 225 | 134 | zero = "01" * 10**5
one = "10" * 10**5
s = str(eval(input()))
ans1 = 0
ans2 = 0
for i, j in zip(s, zero):
if i != j:
ans1 += 1
for i, j in zip(s, one):
if i != j:
ans2 += 1
print((min(ans1, ans2)))
| s = str(eval(input()))
ans1 = s[::2].count("0") + s[1::2].count("1")
ans2 = s[::2].count("1") + s[1::2].count("0")
print((min(ans1, ans2)))
| false | 66.666667 | [
"-zero = \"01\" * 10**5",
"-one = \"10\" * 10**5",
"-ans1 = 0",
"-ans2 = 0",
"-for i, j in zip(s, zero):",
"- if i != j:",
"- ans1 += 1",
"-for i, j in zip(s, one):",
"- if i != j:",
"- ans2 += 1",
"+ans1 = s[::2].count(\"0\") + s[1::2].count(\"1\")",
"+ans2 = s[::2].count(... | false | 0.03734 | 0.036986 | 1.009592 | [
"s572478482",
"s376539724"
] |
u327179339 | p02863 | python | s250319356 | s848457685 | 886 | 565 | 178,948 | 116,184 | Accepted | Accepted | 36.23 | n, T = list(map(int, input().split()))
food = []
for _ in range(n):
a, b = list(map(int, input().split()))
food.append((a, b))
dp1 = [[0]*T for _ in range(1+n)]
dp2 = [[0]*T for _ in range(1+n)]
for i in range(n):
for j in range(T):
dp1[i+1][j] = dp1[i][j]
if j - food[i][0] >= ... | n, t = list(map(int, input().split()))
l = []
for i in range(n):
a, b = list(map(int, input().split()))
l.append((a, b))
l.sort()
ans = 0
dp = [[0]*t for _ in range(n+1)]
for i in range(n):
cur = dp[i][t-1] + l[i][1]
ans = max(ans, cur)
for j in range(t):
dp[i+1][j] = max(dp[i+1][j], ... | 26 | 20 | 721 | 421 | n, T = list(map(int, input().split()))
food = []
for _ in range(n):
a, b = list(map(int, input().split()))
food.append((a, b))
dp1 = [[0] * T for _ in range(1 + n)]
dp2 = [[0] * T for _ in range(1 + n)]
for i in range(n):
for j in range(T):
dp1[i + 1][j] = dp1[i][j]
if j - food[i][0] >= 0:
... | n, t = list(map(int, input().split()))
l = []
for i in range(n):
a, b = list(map(int, input().split()))
l.append((a, b))
l.sort()
ans = 0
dp = [[0] * t for _ in range(n + 1)]
for i in range(n):
cur = dp[i][t - 1] + l[i][1]
ans = max(ans, cur)
for j in range(t):
dp[i + 1][j] = max(dp[i + 1][j... | false | 23.076923 | [
"-n, T = list(map(int, input().split()))",
"-food = []",
"-for _ in range(n):",
"+n, t = list(map(int, input().split()))",
"+l = []",
"+for i in range(n):",
"- food.append((a, b))",
"-dp1 = [[0] * T for _ in range(1 + n)]",
"-dp2 = [[0] * T for _ in range(1 + n)]",
"+ l.append((a, b))",
"+... | false | 0.050529 | 0.113565 | 0.444934 | [
"s250319356",
"s848457685"
] |
u332793228 | p02881 | python | s212351493 | s233774207 | 183 | 150 | 2,940 | 2,940 | Accepted | Accepted | 18.03 | n=int(eval(input()))
move=10**12
for i in range(1,int(n**0.5)+1):
if n%i==0:
move=min(move,n//i+i-2)
print(move) | n=int(eval(input()))
num_i=0
for i in range(1,int(n**0.5)+1):
if n%i==0:
num_i=i
num_j=n//num_i
print((num_i+num_j-2)) | 6 | 7 | 123 | 130 | n = int(eval(input()))
move = 10**12
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
move = min(move, n // i + i - 2)
print(move)
| n = int(eval(input()))
num_i = 0
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
num_i = i
num_j = n // num_i
print((num_i + num_j - 2))
| false | 14.285714 | [
"-move = 10**12",
"+num_i = 0",
"- move = min(move, n // i + i - 2)",
"-print(move)",
"+ num_i = i",
"+num_j = n // num_i",
"+print((num_i + num_j - 2))"
] | false | 0.039549 | 0.044213 | 0.894518 | [
"s212351493",
"s233774207"
] |
u707498674 | p02694 | python | s918766193 | s604866126 | 24 | 19 | 9,168 | 9,168 | Accepted | Accepted | 20.83 | X = int(eval(input()))
now = 100
ans = 0
while now < X:
now *= (101)
now //= 100
ans += 1
print(ans) | X = int(eval(input()))
now = 100
ans = 0
while now < X:
now += now//100
ans += 1
print(ans) | 8 | 7 | 113 | 99 | X = int(eval(input()))
now = 100
ans = 0
while now < X:
now *= 101
now //= 100
ans += 1
print(ans)
| X = int(eval(input()))
now = 100
ans = 0
while now < X:
now += now // 100
ans += 1
print(ans)
| false | 12.5 | [
"- now *= 101",
"- now //= 100",
"+ now += now // 100"
] | false | 0.044155 | 0.046852 | 0.942432 | [
"s918766193",
"s604866126"
] |
u222207357 | p03200 | python | s796166162 | s697283205 | 126 | 48 | 3,500 | 3,500 | Accepted | Accepted | 61.9 | S = eval(input())
cntB = 0
cntW = 0
ans = 0
idx = 0
while idx < len(S):
#print(idx,cntB,cntW,ans)
if S[idx] == 'B':
cntB += 1
idx += 1
else:
while idx < len(S):
if S[idx] == 'W':
cntW += 1
idx += 1
#prin... | S = eval(input())
cntB = 0
ans = 0
for ch in S:
if ch == 'B':
cntB += 1
else:
ans += cntB
print(ans) | 26 | 11 | 475 | 130 | S = eval(input())
cntB = 0
cntW = 0
ans = 0
idx = 0
while idx < len(S):
# print(idx,cntB,cntW,ans)
if S[idx] == "B":
cntB += 1
idx += 1
else:
while idx < len(S):
if S[idx] == "W":
cntW += 1
idx += 1
# print(idx,cntW)
... | S = eval(input())
cntB = 0
ans = 0
for ch in S:
if ch == "B":
cntB += 1
else:
ans += cntB
print(ans)
| false | 57.692308 | [
"-cntW = 0",
"-idx = 0",
"-while idx < len(S):",
"- # print(idx,cntB,cntW,ans)",
"- if S[idx] == \"B\":",
"+for ch in S:",
"+ if ch == \"B\":",
"- idx += 1",
"- while idx < len(S):",
"- if S[idx] == \"W\":",
"- cntW += 1",
"- idx ... | false | 0.036863 | 0.061528 | 0.599125 | [
"s796166162",
"s697283205"
] |
u039864635 | p02784 | python | s120702254 | s749043390 | 45 | 41 | 13,964 | 13,964 | Accepted | Accepted | 8.89 | h, n = list(map(int, input().split()))
a = [int(x) for x in input().split()]
h -= sum(a)
if h <= 0:
print('Yes')
else:
print('No')
| def can_win_without_repeated_move(health, special_moves_damages) -> str:
"""
Given a monster's health and a number of special moves with differ damages,
can we deplete the monster's health without repeating the same move twice?
:param health: int
:param special_moves_damages: list[int]
:... | 9 | 13 | 143 | 556 | h, n = list(map(int, input().split()))
a = [int(x) for x in input().split()]
h -= sum(a)
if h <= 0:
print("Yes")
else:
print("No")
| def can_win_without_repeated_move(health, special_moves_damages) -> str:
"""
Given a monster's health and a number of special moves with differ damages,
can we deplete the monster's health without repeating the same move twice?
:param health: int
:param special_moves_damages: list[int]
:return: ... | false | 30.769231 | [
"-h, n = list(map(int, input().split()))",
"-a = [int(x) for x in input().split()]",
"-h -= sum(a)",
"-if h <= 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+def can_win_without_repeated_move(health, special_moves_damages) -> str:",
"+ \"\"\"",
"+ Given a monster's health and ... | false | 0.076519 | 0.037698 | 2.029809 | [
"s120702254",
"s749043390"
] |
u476199965 | p03355 | python | s457499879 | s049766447 | 89 | 66 | 6,972 | 3,060 | Accepted | Accepted | 25.84 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]
def LI(): return [int(x) for x in... |
s = eval(input())
k = int(eval(input()))
n = len(s)
res = []
for i in range(n):
for j in range(i,n)[0:5]:
s1 = s[i:j+1]
if s1 not in res:
for m in range(len(res)):
if s1 < res[m]:
res.insert(m, s1)
break
... | 36 | 19 | 1,041 | 367 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0, -1), (1, 0), (0, 1), (-1, 0)]
ddn = [(0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, -1), (-1, 0), (-1, 1)]
def LI... | s = eval(input())
k = int(eval(input()))
n = len(s)
res = []
for i in range(n):
for j in range(i, n)[0:5]:
s1 = s[i : j + 1]
if s1 not in res:
for m in range(len(res)):
if s1 < res[m]:
res.insert(m, s1)
break
res.append(... | false | 47.222222 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools",
"-",
"-sys.setrecursionlimit(10**7)",
"-inf = 10**20",
"-eps = 1.0 / 10**10",
"-mod = 998244353",
"-dd = [(0, -1), (1, 0), (0, 1), (-1, 0)]",
"-ddn = [(0, -1), (1, -1), (1, 0), (1, ... | false | 0.04081 | 0.040687 | 1.003024 | [
"s457499879",
"s049766447"
] |
u761320129 | p03409 | python | s509262397 | s791132478 | 25 | 20 | 3,064 | 3,188 | Accepted | Accepted | 20 | N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(2*N)]
es = [[] for i in range(2*N)]
for i,(x1,y1) in enumerate(src[:N]):
for j,(x2,y2) in enumerate(src[N:]):
if x1 < x2 and y1 < y2:
es[i].append(j+N)
es[j+N].append(i)
used = [False] * (2*N)
mat... | N = int(eval(input()))
rs = [tuple(map(int,input().split())) for i in range(N)]
bs = [tuple(map(int,input().split())) for i in range(N)]
bs.sort()
rs.sort(key=lambda x:-x[1])
removed = [0]*N
ans = 0
for bx,by in bs:
for ri in range(N):
if removed[ri]: continue
rx,ry = rs[ri]
i... | 34 | 18 | 827 | 418 | N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(2 * N)]
es = [[] for i in range(2 * N)]
for i, (x1, y1) in enumerate(src[:N]):
for j, (x2, y2) in enumerate(src[N:]):
if x1 < x2 and y1 < y2:
es[i].append(j + N)
es[j + N].append(i)
used = [False] * (2 * N)... | N = int(eval(input()))
rs = [tuple(map(int, input().split())) for i in range(N)]
bs = [tuple(map(int, input().split())) for i in range(N)]
bs.sort()
rs.sort(key=lambda x: -x[1])
removed = [0] * N
ans = 0
for bx, by in bs:
for ri in range(N):
if removed[ri]:
continue
rx, ry = rs[ri]
... | false | 47.058824 | [
"-src = [tuple(map(int, input().split())) for i in range(2 * N)]",
"-es = [[] for i in range(2 * N)]",
"-for i, (x1, y1) in enumerate(src[:N]):",
"- for j, (x2, y2) in enumerate(src[N:]):",
"- if x1 < x2 and y1 < y2:",
"- es[i].append(j + N)",
"- es[j + N].append(i)",
"... | false | 0.037974 | 0.038102 | 0.996642 | [
"s509262397",
"s791132478"
] |
u021019433 | p02574 | python | s081440929 | s334830719 | 729 | 654 | 211,732 | 179,224 | Accepted | Accepted | 10.29 | import math
eval(input())
a = *list(map(int, input().split())),
N = max(a) + 1
spf = [*list(range(N))]
i = 2
while i * i < N:
if spf[i] == i:
for j in range(i * i, N, i):
if spf[j] == j:
spf[j] = i
i += 1
r = 'pairwise'
d = None
u = set()
for x in a:
d = ma... | import math
N = 1000001
spf = [*list(range(N))]
i = 2
while i * i < N:
if spf[i] == i:
for j in range(i * i, N, i):
if spf[j] == j:
spf[j] = i
i += 1
r = 'pairwise'
eval(input())
d = None
u = set()
for x in map(int, input().split()):
d = math.gcd(d or x, x)
s = set... | 31 | 29 | 476 | 454 | import math
eval(input())
a = (*list(map(int, input().split())),)
N = max(a) + 1
spf = [*list(range(N))]
i = 2
while i * i < N:
if spf[i] == i:
for j in range(i * i, N, i):
if spf[j] == j:
spf[j] = i
i += 1
r = "pairwise"
d = None
u = set()
for x in a:
d = math.gcd(d or ... | import math
N = 1000001
spf = [*list(range(N))]
i = 2
while i * i < N:
if spf[i] == i:
for j in range(i * i, N, i):
if spf[j] == j:
spf[j] = i
i += 1
r = "pairwise"
eval(input())
d = None
u = set()
for x in map(int, input().split()):
d = math.gcd(d or x, x)
s = set()... | false | 6.451613 | [
"-eval(input())",
"-a = (*list(map(int, input().split())),)",
"-N = max(a) + 1",
"+N = 1000001",
"+eval(input())",
"-for x in a:",
"+for x in map(int, input().split()):"
] | false | 0.040071 | 1.189971 | 0.033674 | [
"s081440929",
"s334830719"
] |
u173148629 | p02820 | python | s760286174 | s855483968 | 128 | 63 | 4,084 | 4,084 | Accepted | Accepted | 50.78 | N,K=list(map(int,input().split()))
R,S,P=list(map(int,input().split())) #RSP グーチョキパー
T=list(eval(input()))
c=0
def jan(a):
if a=="r":
return P
elif a=="s":
return R
elif a=="p":
return S
else:
return 0
for i in range(K,N):
if T[i-K]==T[i]:
... | N,K=list(map(int,input().split()))
R,S,P=list(map(int,input().split())) #RSP グーチョキパー
T=list(eval(input()))
c=0
def jan(a):
if a=="r":
return P
elif a=="s":
return R
elif a=="p":
return S
else:
return 0
for i in range(K,N):
if T[i-K]==T[i]:
... | 27 | 24 | 455 | 353 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split())) # RSP グーチョキパー
T = list(eval(input()))
c = 0
def jan(a):
if a == "r":
return P
elif a == "s":
return R
elif a == "p":
return S
else:
return 0
for i in range(K, N):
if T[i - K] == T[i]... | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split())) # RSP グーチョキパー
T = list(eval(input()))
c = 0
def jan(a):
if a == "r":
return P
elif a == "s":
return R
elif a == "p":
return S
else:
return 0
for i in range(K, N):
if T[i - K] == T[i]... | false | 11.111111 | [
"-for i in range(1, K + 1): # modK",
"- for j in range(N // K + 1):",
"- if i + K * j > N:",
"- continue",
"- c += jan(T[i + K * j - 1])",
"+for i in T:",
"+ c += jan(i)"
] | false | 0.060041 | 0.045334 | 1.324406 | [
"s760286174",
"s855483968"
] |
u056358163 | p02819 | python | s184005503 | s583935544 | 22 | 18 | 3,060 | 3,060 | Accepted | Accepted | 18.18 | X = int(eval(input()))
def is_prime(x):
if x == 2:
return True
if x % 2 == 0:
return False
else:
for i in range(3, x, 2):
if x % i == 0:
return False
return True
a = X
if (X % 2 == 0) & (X > 2):
a += 1
while 1:
if is_prime(a):
print(a)
break
else:
a += 2
| import math
X = int(eval(input()))
def is_prime(x):
if x == 2:
return True
if x % 2 == 0:
return False
else:
for i in range(3, int(math.sqrt(x))+1, 2):
if x % i == 0:
return False
return True
a = X
if (X % 2 == 0) & (X > 2):
a += 1
while 1:
if is_prime(a):
print(a)
break
... | 23 | 24 | 304 | 335 | X = int(eval(input()))
def is_prime(x):
if x == 2:
return True
if x % 2 == 0:
return False
else:
for i in range(3, x, 2):
if x % i == 0:
return False
return True
a = X
if (X % 2 == 0) & (X > 2):
a += 1
while 1:
if is_prime(a):
p... | import math
X = int(eval(input()))
def is_prime(x):
if x == 2:
return True
if x % 2 == 0:
return False
else:
for i in range(3, int(math.sqrt(x)) + 1, 2):
if x % i == 0:
return False
return True
a = X
if (X % 2 == 0) & (X > 2):
a += 1
while... | false | 4.166667 | [
"+import math",
"+",
"- for i in range(3, x, 2):",
"+ for i in range(3, int(math.sqrt(x)) + 1, 2):"
] | false | 0.049598 | 0.044645 | 1.110945 | [
"s184005503",
"s583935544"
] |
u477062848 | p02684 | python | s001308622 | s848033490 | 154 | 131 | 32,384 | 32,188 | Accepted | Accepted | 14.94 | N, K = list(map(int,input().split()))
A = [0] + list(map(int,input().split()))
T = {1:1}
current_town = 1
for i in range(2,K+1):
current_town = A[current_town]
K -= 1
if current_town in T:
loop_towns = list(T.keys())[T[current_town]-1:]
print((loop_towns[K%len(loop_towns)]))
... | N,K=list(map(int,input().split()))
A=[0]+list(map(int,input().split()))
T={1:1}
c=1
for i in range(2,K+1):
c=A[c]
K-=1
if c in T:
l = list(T.keys())[T[c]-1:]
print((l[K%len(l)]))
break
else: T[c]=i
else: print((A[c])) | 15 | 13 | 394 | 259 | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
T = {1: 1}
current_town = 1
for i in range(2, K + 1):
current_town = A[current_town]
K -= 1
if current_town in T:
loop_towns = list(T.keys())[T[current_town] - 1 :]
print((loop_towns[K % len(loop_towns)]))
... | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
T = {1: 1}
c = 1
for i in range(2, K + 1):
c = A[c]
K -= 1
if c in T:
l = list(T.keys())[T[c] - 1 :]
print((l[K % len(l)]))
break
else:
T[c] = i
else:
print((A[c]))
| false | 13.333333 | [
"-current_town = 1",
"+c = 1",
"- current_town = A[current_town]",
"+ c = A[c]",
"- if current_town in T:",
"- loop_towns = list(T.keys())[T[current_town] - 1 :]",
"- print((loop_towns[K % len(loop_towns)]))",
"+ if c in T:",
"+ l = list(T.keys())[T[c] - 1 :]",
"+ ... | false | 0.076409 | 0.075027 | 1.018414 | [
"s001308622",
"s848033490"
] |
u174434198 | p02793 | python | s481158884 | s437807520 | 1,953 | 963 | 4,084 | 4,084 | Accepted | Accepted | 50.69 |
def gcd(a, b):
if(a < b):
a, b = b, a
if(b == 0):
return a
return gcd(b, a % b)
def lcm(a, b):
return a // gcd(a, b) * b
N = int(eval(input()))
A = list(map(int, input().split()))
l = A[0]
for a in A:
l = lcm(l, a)
ans = 0
mod = 10**9+7
for a in A:
ans += (l... |
def gcd(a, b):
if(a < b):
a, b = b, a
if(b == 0):
return a
return gcd(b, a % b)
def lcm(a, b):
return a // gcd(a, b) * b
N = int(eval(input()))
A = list(map(int, input().split()))
l = 1
for a in A:
l = lcm(l, a)
ans = 0
mod = 10**9+7
l %= mod
for a in A:
an... | 22 | 23 | 369 | 376 | def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a // gcd(a, b) * b
N = int(eval(input()))
A = list(map(int, input().split()))
l = A[0]
for a in A:
l = lcm(l, a)
ans = 0
mod = 10**9 + 7
for a in A:
ans += (l * pow(a, mod - 2,... | def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a // gcd(a, b) * b
N = int(eval(input()))
A = list(map(int, input().split()))
l = 1
for a in A:
l = lcm(l, a)
ans = 0
mod = 10**9 + 7
l %= mod
for a in A:
ans += (l * pow(a, mo... | false | 4.347826 | [
"-l = A[0]",
"+l = 1",
"+l %= mod"
] | false | 0.045557 | 0.084807 | 0.537187 | [
"s481158884",
"s437807520"
] |
u606045429 | p03504 | python | s902977544 | s529507729 | 252 | 227 | 36,468 | 36,468 | Accepted | Accepted | 9.92 | N, C, *STC = list(map(int, open(0).read().split()))
T = [[0] * 10 ** 5 for _ in range(C + 1)]
for s, t, c in zip(*[iter(STC)] * 3):
T[c][s - 1:t] = [1] * (t - s + 1)
print((max(list(map(sum, list(zip(*T))))))) | def main():
N, C, *STC = list(map(int, open(0).read().split()))
T = [[0] * 10 ** 5 for _ in range(C + 1)]
for s, t, c in zip(*[iter(STC)] * 3):
T[c][s - 1:t] = [1] * (t - s + 1)
print((max(list(map(sum, list(zip(*T)))))))
main() | 7 | 10 | 201 | 244 | N, C, *STC = list(map(int, open(0).read().split()))
T = [[0] * 10**5 for _ in range(C + 1)]
for s, t, c in zip(*[iter(STC)] * 3):
T[c][s - 1 : t] = [1] * (t - s + 1)
print((max(list(map(sum, list(zip(*T)))))))
| def main():
N, C, *STC = list(map(int, open(0).read().split()))
T = [[0] * 10**5 for _ in range(C + 1)]
for s, t, c in zip(*[iter(STC)] * 3):
T[c][s - 1 : t] = [1] * (t - s + 1)
print((max(list(map(sum, list(zip(*T)))))))
main()
| false | 30 | [
"-N, C, *STC = list(map(int, open(0).read().split()))",
"-T = [[0] * 10**5 for _ in range(C + 1)]",
"-for s, t, c in zip(*[iter(STC)] * 3):",
"- T[c][s - 1 : t] = [1] * (t - s + 1)",
"-print((max(list(map(sum, list(zip(*T)))))))",
"+def main():",
"+ N, C, *STC = list(map(int, open(0).read().split(... | false | 0.174639 | 0.07819 | 2.233508 | [
"s902977544",
"s529507729"
] |
u729133443 | p03951 | python | s935954716 | s585639241 | 19 | 17 | 3,956 | 2,940 | Accepted | Accepted | 10.53 | I=input;n=i=int(I());s,t=I(),I();j=0;exec('j=max(i*(s[-i:]==t[:i]),j);i-=1;'*n);print((2*n-j)) | I=input;n=int(I());s,t=I(),I();print((2*n-max(i*(s[-i:]==t[:i])for i in range(n+1)))) | 1 | 1 | 92 | 83 | I = input
n = i = int(I())
s, t = I(), I()
j = 0
exec("j=max(i*(s[-i:]==t[:i]),j);i-=1;" * n)
print((2 * n - j))
| I = input
n = int(I())
s, t = I(), I()
print((2 * n - max(i * (s[-i:] == t[:i]) for i in range(n + 1))))
| false | 0 | [
"-n = i = int(I())",
"+n = int(I())",
"-j = 0",
"-exec(\"j=max(i*(s[-i:]==t[:i]),j);i-=1;\" * n)",
"-print((2 * n - j))",
"+print((2 * n - max(i * (s[-i:] == t[:i]) for i in range(n + 1))))"
] | false | 0.036133 | 0.049207 | 0.7343 | [
"s935954716",
"s585639241"
] |
u850491413 | p03045 | python | s323984612 | s386098104 | 624 | 495 | 118,620 | 53,040 | Accepted | Accepted | 20.67 |
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math
N, M = list(map(int, input().split()))
XYZ = []
for i in range(M):
XYZ.append(list(map(int, input().split())))
renketu = [dict() for i in range(N)]
f... |
import sys
def input():
return sys.stdin.readline().strip()
N, M = list(map(int, input().split()))
class Union_Find():
def __init__(self, n):
self.union = [i for i in range(n)]
self.level = [0 for i in range(n)]
self.num = n
def root(self, i, mode=0):
keiro = [i]
ans = i
while ans... | 39 | 47 | 885 | 1,051 | import sys
from collections import deque, defaultdict
import copy
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
import math
N, M = list(map(int, input().split()))
XYZ = []
for i in range(M):
XYZ.append(list(map(int, input().split())))
renketu = [dict() for i in range(N)]
for i in range(N):... | import sys
def input():
return sys.stdin.readline().strip()
N, M = list(map(int, input().split()))
class Union_Find:
def __init__(self, n):
self.union = [i for i in range(n)]
self.level = [0 for i in range(n)]
self.num = n
def root(self, i, mode=0):
keiro = [i]
... | false | 17.021277 | [
"-from collections import deque, defaultdict",
"-import copy",
"-import bisect",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**9)",
"-import math",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"-XYZ = []",
"+",
"+",
"+class Union_Find:",
"+ def _... | false | 0.160073 | 0.087516 | 1.829077 | [
"s323984612",
"s386098104"
] |
u670180528 | p03660 | python | s630902576 | s517147760 | 493 | 450 | 37,208 | 37,232 | Accepted | Accepted | 8.72 | from collections import deque
n,*L=list(map(int,open(0).read().split()))
G=[[]for _ in range(n)]
db=[-1]*n
dw=[-1]*n
for a,b in zip(*[iter(L)]*2):
G[a-1]+=[b-1]
G[b-1]+=[a-1]
q=deque([(0,0)])
while q:
cur,d=q.popleft()
db[cur]=d
for nxt in G[cur]:
if db[nxt]<0:
q.append((nxt,d+1))
q=deque([(n-1... | from collections import deque
n,*L=list(map(int,open(0).read().split()))
G=[[]for _ in range(n)]
db=[-1]*n;db[0]=0
dw=[-1]*n;dw[-1]=0
for a,b in zip(*[iter(L)]*2):
G[a-1]+=[b-1]
G[b-1]+=[a-1]
q=deque([0])
while q:
cur=q.popleft()
for nxt in G[cur]:
if db[nxt]<0:
q.append(nxt)
db[nxt]=db[cur]+1... | 30 | 28 | 533 | 540 | from collections import deque
n, *L = list(map(int, open(0).read().split()))
G = [[] for _ in range(n)]
db = [-1] * n
dw = [-1] * n
for a, b in zip(*[iter(L)] * 2):
G[a - 1] += [b - 1]
G[b - 1] += [a - 1]
q = deque([(0, 0)])
while q:
cur, d = q.popleft()
db[cur] = d
for nxt in G[cur]:
if db... | from collections import deque
n, *L = list(map(int, open(0).read().split()))
G = [[] for _ in range(n)]
db = [-1] * n
db[0] = 0
dw = [-1] * n
dw[-1] = 0
for a, b in zip(*[iter(L)] * 2):
G[a - 1] += [b - 1]
G[b - 1] += [a - 1]
q = deque([0])
while q:
cur = q.popleft()
for nxt in G[cur]:
if db[nx... | false | 6.666667 | [
"+db[0] = 0",
"+dw[-1] = 0",
"-q = deque([(0, 0)])",
"+q = deque([0])",
"- cur, d = q.popleft()",
"- db[cur] = d",
"+ cur = q.popleft()",
"- q.append((nxt, d + 1))",
"-q = deque([(n - 1, 0)])",
"+ q.append(nxt)",
"+ db[nxt] = db[cur] + 1",
"+q = deque(... | false | 0.043873 | 0.03795 | 1.156065 | [
"s630902576",
"s517147760"
] |
u260216890 | p02659 | python | s702991086 | s332880046 | 68 | 56 | 61,740 | 61,628 | Accepted | Accepted | 17.65 | a,b=input().split()
a=int(a)
b1=int(b[0])
b2=int(b[2:])
x=a*b1+(a*b2)//100
print(x)
| a,b=input().split()
a=int(a)
b=round(float(b)*100)
x=a*b//100
print(x)
| 6 | 5 | 89 | 75 | a, b = input().split()
a = int(a)
b1 = int(b[0])
b2 = int(b[2:])
x = a * b1 + (a * b2) // 100
print(x)
| a, b = input().split()
a = int(a)
b = round(float(b) * 100)
x = a * b // 100
print(x)
| false | 16.666667 | [
"-b1 = int(b[0])",
"-b2 = int(b[2:])",
"-x = a * b1 + (a * b2) // 100",
"+b = round(float(b) * 100)",
"+x = a * b // 100"
] | false | 0.036501 | 0.03602 | 1.013347 | [
"s702991086",
"s332880046"
] |
u968166680 | p03078 | python | s454787888 | s070789729 | 1,514 | 42 | 248,372 | 10,452 | Accepted | Accepted | 97.23 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
... | import sys
from heapq import heappush, heappop
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = l... | 33 | 45 | 691 | 1,214 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(i... | import sys
from heapq import heappush, heappop
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, rea... | false | 26.666667 | [
"+from heapq import heappush, heappop",
"- AB = [a + b for a in A[:K] for b in B[:K]]",
"- AB.sort(reverse=True)",
"- ABC = [ab + c for ab in AB[:K] for c in C[:K]]",
"- ABC.sort(reverse=True)",
"- print(*ABC[:K], sep=\"\\n\")",
"+ hq = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]",
"+ ans ... | false | 0.08866 | 0.042584 | 2.082002 | [
"s454787888",
"s070789729"
] |
u775681539 | p02984 | python | s869486648 | s970727290 | 294 | 174 | 118,384 | 13,656 | Accepted | Accepted | 40.82 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000000)
from itertools import accumulate
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
Ae = A[1::2]
Ao = A[::2]
x1 = (sum(... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000000)
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
Ae = A[1::2]
Ao = A[::2]
x1 = (sum(Ao)-sum(Ae))//2
table = [0]*(... | 24 | 20 | 597 | 502 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000000)
from itertools import accumulate
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
Ae = A[1::2]
Ao = A[::2]
x1 = (sum(Ao) - su... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000000)
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
Ae = A[1::2]
Ao = A[::2]
x1 = (sum(Ao) - sum(Ae)) // 2
table = [0] * (N ... | false | 16.666667 | [
"-from itertools import accumulate",
"-",
"- def rec(i):",
"- if i == N:",
"- return",
"+ for i in range(N):",
"- rec(i + 1)",
"-",
"- rec(0)"
] | false | 0.05427 | 0.083049 | 0.65347 | [
"s869486648",
"s970727290"
] |
u887207211 | p03293 | python | s790741285 | s186178466 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | S = eval(input())
T = eval(input())
ans = "No"
for i in range(len(S)):
if(T == S[i:]+S[:i]):
ans = "Yes"
print(ans) | S = eval(input())
T = eval(input())
ans = "No"
for i in range(len(S)):
S[i:]+S[:i]
if(S[i:]+S[:i] == T):
ans = "Yes"
print(ans) | 7 | 9 | 115 | 132 | S = eval(input())
T = eval(input())
ans = "No"
for i in range(len(S)):
if T == S[i:] + S[:i]:
ans = "Yes"
print(ans)
| S = eval(input())
T = eval(input())
ans = "No"
for i in range(len(S)):
S[i:] + S[:i]
if S[i:] + S[:i] == T:
ans = "Yes"
print(ans)
| false | 22.222222 | [
"- if T == S[i:] + S[:i]:",
"+ S[i:] + S[:i]",
"+ if S[i:] + S[:i] == T:"
] | false | 0.041266 | 0.042202 | 0.977816 | [
"s790741285",
"s186178466"
] |
u850491413 | p03216 | python | s803360006 | s515085530 | 2,118 | 1,745 | 143,060 | 143,060 | Accepted | Accepted | 17.61 | import sys
def input():
return sys.stdin.readline().strip()
N = int(eval(input()))
S = eval(input())
Q = int(eval(input()))
k = list(map(int, input().split()))
DM_total = [(0,0,0)]
C_list = []
for i in range(N):
if S[i] == "D":
DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2])... | import sys
def input():
return sys.stdin.readline().strip()
N = int(eval(input()))
S = eval(input())
Q = int(eval(input()))
k = list(map(int, input().split()))
DM_total = [(0,0,0)]
C_list = []
for i in range(N):
if S[i] == "D":
DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2])... | 33 | 33 | 765 | 824 | import sys
def input():
return sys.stdin.readline().strip()
N = int(eval(input()))
S = eval(input())
Q = int(eval(input()))
k = list(map(int, input().split()))
DM_total = [(0, 0, 0)]
C_list = []
for i in range(N):
if S[i] == "D":
DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2]... | import sys
def input():
return sys.stdin.readline().strip()
N = int(eval(input()))
S = eval(input())
Q = int(eval(input()))
k = list(map(int, input().split()))
DM_total = [(0, 0, 0)]
C_list = []
for i in range(N):
if S[i] == "D":
DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2]... | false | 0 | [
"+ans_list = [0] * Q",
"- ans = 0",
"- ans += DM_total[c + 1][2]",
"+ ans_list[q] += DM_total[c + 1][2]",
"- ans += DM_total[c + 1][2] - DM_total[c + 1 - k[q]][2]",
"- ans -= DM_total[c + 1 - k[q]][0] * (",
"+ ans_list[q] += DM_total[c + 1][2] - ... | false | 0.049104 | 0.048864 | 1.004918 | [
"s803360006",
"s515085530"
] |
u906501980 | p03361 | python | s080405154 | s826798305 | 1,539 | 182 | 21,536 | 13,352 | Accepted | Accepted | 88.17 | import numpy as np
h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
s = np.array(s)
out = "Yes"
for i in range(h):
for j in range(w):
if s[i][j] == ".":
continue
if i == 0 and j == 0:
up = s[i][j]
down = s[i + 1][j]
... | import numpy as np
h, w = list(map(int, input().split()))
s = np.array([list(eval(input())) for _ in range(h)])
w1, w2 = np.array(["."]*h), np.array(["."]*(w+2))
s = np.hstack((w1.reshape(len(w1),1), s))
s = np.hstack((s, w1.reshape(len(w1),1)))
s = np.vstack((w2, s))
s = np.vstack((s, w2))
dx, dy = [1, 0, -1, ... | 57 | 24 | 1,768 | 686 | import numpy as np
h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
s = np.array(s)
out = "Yes"
for i in range(h):
for j in range(w):
if s[i][j] == ".":
continue
if i == 0 and j == 0:
up = s[i][j]
down = s[i + 1][j]
l... | import numpy as np
h, w = list(map(int, input().split()))
s = np.array([list(eval(input())) for _ in range(h)])
w1, w2 = np.array(["."] * h), np.array(["."] * (w + 2))
s = np.hstack((w1.reshape(len(w1), 1), s))
s = np.hstack((s, w1.reshape(len(w1), 1)))
s = np.vstack((w2, s))
s = np.vstack((s, w2))
dx, dy = [1, 0, -1,... | false | 57.894737 | [
"-s = [list(eval(input())) for _ in range(h)]",
"-s = np.array(s)",
"-out = \"Yes\"",
"-for i in range(h):",
"- for j in range(w):",
"- if s[i][j] == \".\":",
"+s = np.array([list(eval(input())) for _ in range(h)])",
"+w1, w2 = np.array([\".\"] * h), np.array([\".\"] * (w + 2))",
"+s = np.... | false | 0.525432 | 0.232604 | 2.258917 | [
"s080405154",
"s826798305"
] |
u225084815 | p03288 | python | s922067106 | s436751896 | 171 | 92 | 38,384 | 68,428 | Accepted | Accepted | 46.2 | R = int(eval(input()))
if R >= 2800:
print('AGC')
elif R >= 1200:
print('ARC')
else:
print('ABC') | import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return list(map(int,sys.stdin.readline().rstrip().split()))
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS()... | 7 | 14 | 103 | 466 | R = int(eval(input()))
if R >= 2800:
print("AGC")
elif R >= 1200:
print("ARC")
else:
print("ABC")
| import bisect, collections, copy, heapq, itertools, math, string
import sys
def S():
return sys.stdin.readline().rstrip()
def M():
return list(map(int, sys.stdin.readline().rstrip().split()))
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().r... | false | 50 | [
"-R = int(eval(input()))",
"-if R >= 2800:",
"- print(\"AGC\")",
"-elif R >= 1200:",
"+import bisect, collections, copy, heapq, itertools, math, string",
"+import sys",
"+",
"+",
"+def S():",
"+ return sys.stdin.readline().rstrip()",
"+",
"+",
"+def M():",
"+ return list(map(int, ... | false | 0.037108 | 0.037232 | 0.996675 | [
"s922067106",
"s436751896"
] |
u699089116 | p02917 | python | s657836104 | s404938403 | 161 | 71 | 38,384 | 62,032 | Accepted | Accepted | 55.9 | n = int(eval(input()))
b = list(map(int, input().split()))
a = [0] * n
a[0] = b[0]
a[-1] = b[-1]
for i in range(1, n-1):
a[i] = min(b[i], b[i - 1])
print((sum(a))) | n = int(eval(input()))
B = list(map(int, input().split()))
a = [-1] * n
for i, b in enumerate(B):
if a[i] > B[i]:
a[i] = b
a[i+1] = b
elif a[i] != -1:
a[i+1] = b
elif a[i] == -1:
a[i] = b
a[i+1] = b
print((sum(a))) | 11 | 16 | 172 | 276 | n = int(eval(input()))
b = list(map(int, input().split()))
a = [0] * n
a[0] = b[0]
a[-1] = b[-1]
for i in range(1, n - 1):
a[i] = min(b[i], b[i - 1])
print((sum(a)))
| n = int(eval(input()))
B = list(map(int, input().split()))
a = [-1] * n
for i, b in enumerate(B):
if a[i] > B[i]:
a[i] = b
a[i + 1] = b
elif a[i] != -1:
a[i + 1] = b
elif a[i] == -1:
a[i] = b
a[i + 1] = b
print((sum(a)))
| false | 31.25 | [
"-b = list(map(int, input().split()))",
"-a = [0] * n",
"-a[0] = b[0]",
"-a[-1] = b[-1]",
"-for i in range(1, n - 1):",
"- a[i] = min(b[i], b[i - 1])",
"+B = list(map(int, input().split()))",
"+a = [-1] * n",
"+for i, b in enumerate(B):",
"+ if a[i] > B[i]:",
"+ a[i] = b",
"+ ... | false | 0.043806 | 0.039963 | 1.096167 | [
"s657836104",
"s404938403"
] |
u596536048 | p03145 | python | s409949537 | s518430573 | 28 | 25 | 9,048 | 9,048 | Accepted | Accepted | 10.71 | AB, BC, CA = list(map(int, input().split()))
print((int(AB * BC / 2)))
| length1, length2, length3 = list(map(int, input().split()))
area = length1 * length2 / 2
print((int(area))) | 2 | 3 | 64 | 101 | AB, BC, CA = list(map(int, input().split()))
print((int(AB * BC / 2)))
| length1, length2, length3 = list(map(int, input().split()))
area = length1 * length2 / 2
print((int(area)))
| false | 33.333333 | [
"-AB, BC, CA = list(map(int, input().split()))",
"-print((int(AB * BC / 2)))",
"+length1, length2, length3 = list(map(int, input().split()))",
"+area = length1 * length2 / 2",
"+print((int(area)))"
] | false | 0.03602 | 0.037396 | 0.963194 | [
"s409949537",
"s518430573"
] |
u261103969 | p02791 | python | s626459547 | s398923350 | 151 | 101 | 25,768 | 100,020 | Accepted | Accepted | 33.11 | n = int(eval(input()))
p = [int(i) for i in input().split()]
p_min = [p[0],] * n
for i in range(1,n):
if p_min[i-1] > p[i]:
p_min[i] = p[i]
else:
p_min[i] = p_min[i-1]
print((sum([1 for i in range(n) if p_min[i] >= p[i]]))) | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
P = list(map(int, readline().split()))
cur = N + 1
ans = 0
for x in P:
if cur > x:
ans += 1
cur = x
p... | 12 | 22 | 253 | 372 | n = int(eval(input()))
p = [int(i) for i in input().split()]
p_min = [
p[0],
] * n
for i in range(1, n):
if p_min[i - 1] > p[i]:
p_min[i] = p[i]
else:
p_min[i] = p_min[i - 1]
print((sum([1 for i in range(n) if p_min[i] >= p[i]])))
| import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
P = list(map(int, readline().split()))
cur = N + 1
ans = 0
for x in P:
if cur > x:
ans += 1
cur = x
print(ans)
if __name__... | false | 45.454545 | [
"-n = int(eval(input()))",
"-p = [int(i) for i in input().split()]",
"-p_min = [",
"- p[0],",
"-] * n",
"-for i in range(1, n):",
"- if p_min[i - 1] > p[i]:",
"- p_min[i] = p[i]",
"- else:",
"- p_min[i] = p_min[i - 1]",
"-print((sum([1 for i in range(n) if p_min[i] >= p[i]... | false | 0.044026 | 0.04276 | 1.029606 | [
"s626459547",
"s398923350"
] |
u416758623 | p03556 | python | s728961632 | s636388007 | 36 | 27 | 2,940 | 2,940 | Accepted | Accepted | 25 | N=int(eval(input()))
ans=1
for i in range(1,N):
if i**2<=N:
ans=i**2
else:
break
print(ans)
| n = int(eval(input()))
ans = 1
for i in range(1,n+1):
if i **2 > n:
ans = (i-1) ** 2
break
print(ans)
| 8 | 7 | 117 | 122 | N = int(eval(input()))
ans = 1
for i in range(1, N):
if i**2 <= N:
ans = i**2
else:
break
print(ans)
| n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
if i**2 > n:
ans = (i - 1) ** 2
break
print(ans)
| false | 12.5 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-for i in range(1, N):",
"- if i**2 <= N:",
"- ans = i**2",
"- else:",
"+for i in range(1, n + 1):",
"+ if i**2 > n:",
"+ ans = (i - 1) ** 2"
] | false | 0.047681 | 0.038504 | 1.238363 | [
"s728961632",
"s636388007"
] |
u496344397 | p03565 | python | s185289494 | s260276941 | 22 | 17 | 3,444 | 3,064 | Accepted | Accepted | 22.73 | from copy import deepcopy
S = eval(input())
T = eval(input())
answer = ''
for i in range(len(S)-len(T)+1):
found = True
if any([S[i+j] != '?' and S[i+j] != T[j] for j in range(len(T))]):
continue
tmp = deepcopy(S).replace('?', 'a')
tmp = tmp[:i] + T + tmp[i+len(T):]
if answer =... | S = eval(input())
T = eval(input())
answer = ''
for i in range(len(S)-len(T)+1):
if any([S[i+j] != '?' and S[i+j] != T[j] for j in range(len(T))]):
continue
tmp = (S[:i] + T + S[i+len(T):]).replace('?', 'a')
if answer == '' or tmp < answer:
answer = tmp
if answer == '':
pr... | 19 | 15 | 424 | 353 | from copy import deepcopy
S = eval(input())
T = eval(input())
answer = ""
for i in range(len(S) - len(T) + 1):
found = True
if any([S[i + j] != "?" and S[i + j] != T[j] for j in range(len(T))]):
continue
tmp = deepcopy(S).replace("?", "a")
tmp = tmp[:i] + T + tmp[i + len(T) :]
if answer == ... | S = eval(input())
T = eval(input())
answer = ""
for i in range(len(S) - len(T) + 1):
if any([S[i + j] != "?" and S[i + j] != T[j] for j in range(len(T))]):
continue
tmp = (S[:i] + T + S[i + len(T) :]).replace("?", "a")
if answer == "" or tmp < answer:
answer = tmp
if answer == "":
print(... | false | 21.052632 | [
"-from copy import deepcopy",
"-",
"- found = True",
"- tmp = deepcopy(S).replace(\"?\", \"a\")",
"- tmp = tmp[:i] + T + tmp[i + len(T) :]",
"+ tmp = (S[:i] + T + S[i + len(T) :]).replace(\"?\", \"a\")"
] | false | 0.046495 | 0.048373 | 0.961167 | [
"s185289494",
"s260276941"
] |
u729133443 | p03208 | python | s626368253 | s187938463 | 261 | 97 | 71,612 | 14,092 | Accepted | Accepted | 62.84 | n,k,*h=list(map(int,open(0).read().split()));h.sort();print((min(h[i]-h[i-k+1]for i in range(k-1,n)))) | n,k,*h=list(map(int,open(0).read().split()));h.sort();print((min(h[i+k-1]-h[i]for i in range(n-k+1)))) | 1 | 1 | 94 | 94 | n, k, *h = list(map(int, open(0).read().split()))
h.sort()
print((min(h[i] - h[i - k + 1] for i in range(k - 1, n))))
| n, k, *h = list(map(int, open(0).read().split()))
h.sort()
print((min(h[i + k - 1] - h[i] for i in range(n - k + 1))))
| false | 0 | [
"-print((min(h[i] - h[i - k + 1] for i in range(k - 1, n))))",
"+print((min(h[i + k - 1] - h[i] for i in range(n - k + 1))))"
] | false | 0.03863 | 0.038683 | 0.998641 | [
"s626368253",
"s187938463"
] |
u207799478 | p02682 | python | s888505985 | s034937666 | 84 | 42 | 68,736 | 10,496 | Accepted | Accepted | 50 | import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math... | from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy
def readints():
return list(map(int, input().spli... | 60 | 55 | 1,109 | 1,035 | import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2 * 10**5)
INF = 2**60
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n) ... | from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy
def readints():
return list(map(int, input().split()))
def nCr... | false | 8.333333 | [
"-import itertools",
"+from copy import deepcopy",
"+from decimal import Decimal",
"+import sys",
"+import fractions",
"-import sys",
"-",
"-sys.setrecursionlimit(2 * 10**5)",
"-INF = 2**60",
"+import itertools",
"+import copy",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, ... | false | 0.047718 | 0.046813 | 1.019343 | [
"s888505985",
"s034937666"
] |
u621935300 | p03495 | python | s151469840 | s029256771 | 286 | 107 | 43,596 | 81,148 | Accepted | Accepted | 62.59 | import collections
import sys
N,K=list(map(int,input().split()))
a=[]
a=collections.Counter( list(map(int,input().split())) )
b=sorted(list(a.items()), key=lambda x:x[1])
if len(b)=="K":
print(0)
sys.exit()
else:
sum=0
for i in range(len(b)-K):
sum+=b[i][1]
else:
print(sum)
| import sys
from collections import Counter
N,K=list(map(int, sys.stdin.readline().split()))
A=list(map(int, sys.stdin.readline().split()))
C=Counter(A)
C=list(C.values())
C.sort()
print(sum(C[:-1*K])) | 16 | 8 | 288 | 194 | import collections
import sys
N, K = list(map(int, input().split()))
a = []
a = collections.Counter(list(map(int, input().split())))
b = sorted(list(a.items()), key=lambda x: x[1])
if len(b) == "K":
print(0)
sys.exit()
else:
sum = 0
for i in range(len(b) - K):
sum += b[i][1]
else:
p... | import sys
from collections import Counter
N, K = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
C = Counter(A)
C = list(C.values())
C.sort()
print(sum(C[: -1 * K]))
| false | 50 | [
"-import collections",
"+from collections import Counter",
"-N, K = list(map(int, input().split()))",
"-a = []",
"-a = collections.Counter(list(map(int, input().split())))",
"-b = sorted(list(a.items()), key=lambda x: x[1])",
"-if len(b) == \"K\":",
"- print(0)",
"- sys.exit()",
"-else:",
... | false | 0.042412 | 0.034983 | 1.212346 | [
"s151469840",
"s029256771"
] |
u729133443 | p03136 | python | s152678523 | s797835890 | 165 | 11 | 38,384 | 2,568 | Accepted | Accepted | 93.33 | _,*s=list(map(int,open(0).read().split()));print(('YNeos'[sum(s)-max(s)*2<1::2])) | eval(input());s=list(map(int,input().split()));print('YNeos'[sum(s)-max(s)*2<1::2]) | 1 | 1 | 73 | 73 | _, *s = list(map(int, open(0).read().split()))
print(("YNeos"[sum(s) - max(s) * 2 < 1 :: 2]))
| eval(input())
s = list(map(int, input().split()))
print("YNeos"[sum(s) - max(s) * 2 < 1 :: 2])
| false | 0 | [
"-_, *s = list(map(int, open(0).read().split()))",
"-print((\"YNeos\"[sum(s) - max(s) * 2 < 1 :: 2]))",
"+eval(input())",
"+s = list(map(int, input().split()))",
"+print(\"YNeos\"[sum(s) - max(s) * 2 < 1 :: 2])"
] | false | 0.081997 | 0.034469 | 2.378848 | [
"s152678523",
"s797835890"
] |
u596276291 | p03805 | python | s145147215 | s988591925 | 32 | 28 | 3,316 | 3,572 | Accepted | Accepted | 12.5 | from collections import defaultdict
from itertools import permutations
def main():
N, M = list(map(int, input().split()))
graph = defaultdict(list)
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
ans = 0
for rout... | from collections import defaultdict
from itertools import permutations
def main():
N, M = list(map(int, input().split()))
s = set()
for _ in range(M):
a, b = list(map(int, input().split()))
s.add((a, b))
s.add((b, a))
ans = 0
for x in permutations(list(range(2, ... | 28 | 24 | 607 | 542 | from collections import defaultdict
from itertools import permutations
def main():
N, M = list(map(int, input().split()))
graph = defaultdict(list)
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
ans = 0
for route in permutati... | from collections import defaultdict
from itertools import permutations
def main():
N, M = list(map(int, input().split()))
s = set()
for _ in range(M):
a, b = list(map(int, input().split()))
s.add((a, b))
s.add((b, a))
ans = 0
for x in permutations(list(range(2, N + 1))):
... | false | 14.285714 | [
"- graph = defaultdict(list)",
"+ s = set()",
"- graph[a].append(b)",
"- graph[b].append(a)",
"+ s.add((a, b))",
"+ s.add((b, a))",
"- for route in permutations(list(range(2, N + 1)), N - 1):",
"- ok = True",
"+ for x in permutations(list(range(2, N + 1... | false | 0.072475 | 0.044209 | 1.639372 | [
"s145147215",
"s988591925"
] |
u631277801 | p03353 | python | s572572761 | s843702694 | 44 | 33 | 4,548 | 4,464 | Accepted | Accepted | 25 | s = eval(input())
N = int(eval(input()))
len_s = len(s)
sub_set = set()
for start in range(len_s):
k = 1
while k <= min(len_s-start, N):
sub_set.add(s[start:start+k])
k += 1
sub_list = list(sub_set)
sub_list.sort()
print((sub_list[N-1])) | s = eval(input())
K = int(eval(input()))
len_s = len(s)
sub_set = set()
for k in range(1,6):
for i in range(len_s-k+1):
sub_set.add(s[i:i+k])
sub_list = list(sub_set)
sub_list.sort()
print((sub_list[K-1]))
| 17 | 15 | 276 | 246 | s = eval(input())
N = int(eval(input()))
len_s = len(s)
sub_set = set()
for start in range(len_s):
k = 1
while k <= min(len_s - start, N):
sub_set.add(s[start : start + k])
k += 1
sub_list = list(sub_set)
sub_list.sort()
print((sub_list[N - 1]))
| s = eval(input())
K = int(eval(input()))
len_s = len(s)
sub_set = set()
for k in range(1, 6):
for i in range(len_s - k + 1):
sub_set.add(s[i : i + k])
sub_list = list(sub_set)
sub_list.sort()
print((sub_list[K - 1]))
| false | 11.764706 | [
"-N = int(eval(input()))",
"+K = int(eval(input()))",
"-for start in range(len_s):",
"- k = 1",
"- while k <= min(len_s - start, N):",
"- sub_set.add(s[start : start + k])",
"- k += 1",
"+for k in range(1, 6):",
"+ for i in range(len_s - k + 1):",
"+ sub_set.add(s[i :... | false | 0.033897 | 0.036397 | 0.931316 | [
"s572572761",
"s843702694"
] |
u027557357 | p03325 | python | s150999155 | s055529854 | 126 | 85 | 4,148 | 10,016 | Accepted | Accepted | 32.54 | N = eval(input())
a = list(map(int,input().split()))
ans=0
for x in a:
if x%2!=0:
continue
for j in range(1,50):
if x%2**j!=0:
ans+=j-1
break
print(ans) | N = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
for i in a :
if i%2 == 0:
for j in range(i):
if i%2 == 1:
break
i = i/2
ans += 1
print((int(ans))) | 11 | 11 | 204 | 230 | N = eval(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
if x % 2 != 0:
continue
for j in range(1, 50):
if x % 2**j != 0:
ans += j - 1
break
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
if i % 2 == 0:
for j in range(i):
if i % 2 == 1:
break
i = i / 2
ans += 1
print((int(ans)))
| false | 0 | [
"-N = eval(input())",
"+N = int(eval(input()))",
"-for x in a:",
"- if x % 2 != 0:",
"- continue",
"- for j in range(1, 50):",
"- if x % 2**j != 0:",
"- ans += j - 1",
"- break",
"-print(ans)",
"+for i in a:",
"+ if i % 2 == 0:",
"+ for j i... | false | 0.075762 | 0.067762 | 1.118049 | [
"s150999155",
"s055529854"
] |
u353919145 | p02789 | python | s543822704 | s051660675 | 21 | 19 | 2,940 | 2,940 | Accepted | Accepted | 9.52 | s = eval(input())
a = s.split()
if len(a) != 2:
print("No")
if a[0] == a[1]:
print("Yes")
else:
print("No") | r = input ().split ()
print(("Yes" if r[0] == r[1] else "No")) | 8 | 2 | 114 | 62 | s = eval(input())
a = s.split()
if len(a) != 2:
print("No")
if a[0] == a[1]:
print("Yes")
else:
print("No")
| r = input().split()
print(("Yes" if r[0] == r[1] else "No"))
| false | 75 | [
"-s = eval(input())",
"-a = s.split()",
"-if len(a) != 2:",
"- print(\"No\")",
"-if a[0] == a[1]:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+r = input().split()",
"+print((\"Yes\" if r[0] == r[1] else \"No\"))"
] | false | 0.110026 | 0.041843 | 2.629497 | [
"s543822704",
"s051660675"
] |
u606045429 | p03738 | python | s159263446 | s780770254 | 20 | 18 | 2,940 | 3,060 | Accepted | Accepted | 10 | A, B = eval(input()), eval(input())
if len(A) > len(B):
print("GREATER")
elif len(A) < len(B):
print("LESS")
elif A > B:
print("GREATER")
elif A < B:
print("LESS")
else:
print("EQUAL")
| A, B = eval(input()), eval(input())
C = len(A) - len(B)
if C == 0 and A > B or C > 0:
print("GREATER")
elif C == 0 and A < B or C < 0:
print("LESS")
else:
print("EQUAL") | 11 | 8 | 203 | 176 | A, B = eval(input()), eval(input())
if len(A) > len(B):
print("GREATER")
elif len(A) < len(B):
print("LESS")
elif A > B:
print("GREATER")
elif A < B:
print("LESS")
else:
print("EQUAL")
| A, B = eval(input()), eval(input())
C = len(A) - len(B)
if C == 0 and A > B or C > 0:
print("GREATER")
elif C == 0 and A < B or C < 0:
print("LESS")
else:
print("EQUAL")
| false | 27.272727 | [
"-if len(A) > len(B):",
"+C = len(A) - len(B)",
"+if C == 0 and A > B or C > 0:",
"-elif len(A) < len(B):",
"- print(\"LESS\")",
"-elif A > B:",
"- print(\"GREATER\")",
"-elif A < B:",
"+elif C == 0 and A < B or C < 0:"
] | false | 0.0454 | 0.045919 | 0.98869 | [
"s159263446",
"s780770254"
] |
u609061751 | p03281 | python | s275164646 | s017401909 | 174 | 72 | 38,896 | 63,880 | Accepted | Accepted | 58.62 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1, 2):
cnt = 0
for j in range(1, N + 1):
if i % j == 0:
cnt += 1
if cnt == 8:
ans += 1
print(ans) | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
n = int(eval(input()))
def num_divisors_table(n):
table = [0] * (n + 1)
for i in range(1, n + 1):
for j in range(i, n + 1, i):
table[j] += 1
return table
table = num_divisors_table(n)
ans = 0
for ... | 11 | 20 | 195 | 391 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1, 2):
cnt = 0
for j in range(1, N + 1):
if i % j == 0:
cnt += 1
if cnt == 8:
ans += 1
print(ans)
| import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
n = int(eval(input()))
def num_divisors_table(n):
table = [0] * (n + 1)
for i in range(1, n + 1):
for j in range(i, n + 1, i):
table[j] += 1
return table
table = num_divisors_table(n)
ans = 0
for i in range(1, n + 1, 2):... | false | 45 | [
"-N = int(eval(input()))",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")",
"+n = int(eval(input()))",
"+",
"+",
"+def num_divisors_table(n):",
"+ table = [0] * (n + 1)",
"+ for i in range(1, n + 1):",
"+ for j in range(i, n + 1, i):",
"+ ... | false | 0.039222 | 0.044959 | 0.872382 | [
"s275164646",
"s017401909"
] |
u561231954 | p03364 | python | s354001920 | s308335367 | 828 | 389 | 73,856 | 27,840 | Accepted | Accepted | 53.02 | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
def main():
N = int(eval(input()))
grid = [eval(input()) for _ in range(N)]
ans = 0
for i in range(N):
flag = True
for j in range(N):
for k in range(N):
if j == k:
... | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
import numpy as np
def main():
N = int(eval(input()))
grid = np.array([list(eval(input())) for _ in range(N)],'S1')
ans = 0
for i in range(N):
X = np.vstack((grid[i:,:],grid[:i,:]))
if np.all(X... | 24 | 18 | 552 | 395 | import sys
sys.setrecursionlimit(10000000)
MOD = 10**9 + 7
INF = 10**15
def main():
N = int(eval(input()))
grid = [eval(input()) for _ in range(N)]
ans = 0
for i in range(N):
flag = True
for j in range(N):
for k in range(N):
if j == k:
c... | import sys
sys.setrecursionlimit(10000000)
MOD = 10**9 + 7
INF = 10**15
import numpy as np
def main():
N = int(eval(input()))
grid = np.array([list(eval(input())) for _ in range(N)], "S1")
ans = 0
for i in range(N):
X = np.vstack((grid[i:, :], grid[:i, :]))
if np.all(X == X.T):
... | false | 25 | [
"+import numpy as np",
"- grid = [eval(input()) for _ in range(N)]",
"+ grid = np.array([list(eval(input())) for _ in range(N)], \"S1\")",
"- flag = True",
"- for j in range(N):",
"- for k in range(N):",
"- if j == k:",
"- continue",
"... | false | 0.04762 | 0.266079 | 0.178969 | [
"s354001920",
"s308335367"
] |
u753803401 | p02854 | python | s451567987 | s054780126 | 283 | 254 | 80,928 | 76,016 | Accepted | Accepted | 10.25 | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input().rstrip('\n'))
a = list(map(int, input().rstrip('\n').split()))
st = sum(a)
t = 0
abs_t = 10 ** 10
for i in range(n-1):
t += a[i]
st -= a[i]
abs_t = min(abs_t, abs(... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
sa = sum(a)
t = 0
mt = 10 ** 20
for v in a:
t += v
mt = min(mt, abs(sa - t - t))
print(mt)
if __name__ == '__... | 20 | 19 | 392 | 342 | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input().rstrip("\n"))
a = list(map(int, input().rstrip("\n").split()))
st = sum(a)
t = 0
abs_t = 10**10
for i in range(n - 1):
t += a[i]
st -= a[i]
abs_t = min(abs_t, abs(st - t))
pri... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = list(map(int, readline().split()))
sa = sum(a)
t = 0
mt = 10**20
for v in a:
t += v
mt = min(mt, abs(sa - t - t))
print(mt)
if __name__ == "__main__":
solve()
| false | 5 | [
"- input = sys.stdin.readline",
"+ readline = sys.stdin.buffer.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = list(map(int, input().rstrip(\"\\n\").split()))",
"- st = sum(a)",
"+ n = int(readline())",
"+ a = list(map(int, readline().split()))",
"+ sa = sum(a)",
"- ... | false | 0.049687 | 0.080834 | 0.61468 | [
"s451567987",
"s054780126"
] |
u977389981 | p02989 | python | s554149883 | s071995954 | 224 | 71 | 52,780 | 20,764 | Accepted | Accepted | 68.3 | N = int(eval(input()))
D = sorted([int(i) for i in input().split()])
maxK = D[N // 2]
minK = D[N // 2 - 1]
print((maxK - minK)) | n = int(eval(input()))
D = sorted([int(i) for i in input().split()])
if n % 2 == 1:
print((0))
else:
m = n // 2
print((D[m] - D[m - 1])) | 7 | 8 | 127 | 146 | N = int(eval(input()))
D = sorted([int(i) for i in input().split()])
maxK = D[N // 2]
minK = D[N // 2 - 1]
print((maxK - minK))
| n = int(eval(input()))
D = sorted([int(i) for i in input().split()])
if n % 2 == 1:
print((0))
else:
m = n // 2
print((D[m] - D[m - 1]))
| false | 12.5 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-maxK = D[N // 2]",
"-minK = D[N // 2 - 1]",
"-print((maxK - minK))",
"+if n % 2 == 1:",
"+ print((0))",
"+else:",
"+ m = n // 2",
"+ print((D[m] - D[m - 1]))"
] | false | 0.06192 | 0.045448 | 1.362427 | [
"s554149883",
"s071995954"
] |
u579699847 | p03338 | python | s025308092 | s206720949 | 23 | 18 | 3,316 | 3,060 | Accepted | Accepted | 21.74 | import collections,sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
N = I()
S = S()
ans = 0
for i in range(N):
set_top = set()
set_bottom = set()
for s in collections.Counter(S[:i]):
set_top.add(s)
for s in collections.Counter(S[i:])... | import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
N = I()
S = S()
ans = 0
for i in range(N):
ans = max(ans,len(set(S[:i])&set(S[i:])))
print(ans)
| 15 | 9 | 405 | 216 | import collections, sys
def S():
return sys.stdin.readline().rstrip()
def I():
return int(sys.stdin.readline().rstrip())
N = I()
S = S()
ans = 0
for i in range(N):
set_top = set()
set_bottom = set()
for s in collections.Counter(S[:i]):
set_top.add(s)
for s in collections.Counter(S[... | import sys
def S():
return sys.stdin.readline().rstrip()
def I():
return int(sys.stdin.readline().rstrip())
N = I()
S = S()
ans = 0
for i in range(N):
ans = max(ans, len(set(S[:i]) & set(S[i:])))
print(ans)
| false | 40 | [
"-import collections, sys",
"+import sys",
"- set_top = set()",
"- set_bottom = set()",
"- for s in collections.Counter(S[:i]):",
"- set_top.add(s)",
"- for s in collections.Counter(S[i:]):",
"- set_bottom.add(s)",
"- ans = max(ans, len(set_top & set_bottom))",
"+ a... | false | 0.047441 | 0.097434 | 0.4869 | [
"s025308092",
"s206720949"
] |
u285891772 | p03546 | python | s634233486 | s850284017 | 314 | 223 | 21,560 | 14,692 | Accepted | Accepted | 28.98 | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 54 | 52 | 1,497 | 1,489 | import sys, re
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from collections import deque, defaultdict, Counter
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from collections import deque, defaultdict, Counter
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 3.703704 | [
"- for x in A[i]:",
"- if x == 1 or x == -1:",
"- continue",
"- else:",
"- ans += c[x][1]",
"+ for j in range(len(A[i])):",
"+ if A[i][j] != -1:",
"+ ans += c[A[i][j]][1]"
] | false | 0.768361 | 0.593726 | 1.294134 | [
"s634233486",
"s850284017"
] |
u454557108 | p03805 | python | s859887379 | s332539369 | 172 | 31 | 12,436 | 3,316 | Accepted | Accepted | 81.98 | # -*- coding: utf-8 -*-
import numpy as np
n,m = list(map(int, input().split()))
graph = [[0 for i in range(n)] for j in range(n)]
graph = np.array(graph)
for i in range(m):
a,b = list(map(int, input().split()))
graph[a-1,b-1] = 1
graph[b-1,a-1] = 1
used = [False]*n
used[0] = True
def DFS... | from collections import deque
def dfs(G, visited, s, n, ans):
# すべての頂点を訪れた場合の処理
if all(visited) :
ans += 1
return ans
# 次の頂点の探索
for i in range(n) :
if visited[i] == False and (G[s][i] == 1 or G[i][s] == 1) :
visited[i] = True
ans = dfs(G, visited, i, n, ans)
visited[i]... | 30 | 28 | 602 | 633 | # -*- coding: utf-8 -*-
import numpy as np
n, m = list(map(int, input().split()))
graph = [[0 for i in range(n)] for j in range(n)]
graph = np.array(graph)
for i in range(m):
a, b = list(map(int, input().split()))
graph[a - 1, b - 1] = 1
graph[b - 1, a - 1] = 1
used = [False] * n
used[0] = True
def DFS(v... | from collections import deque
def dfs(G, visited, s, n, ans):
# すべての頂点を訪れた場合の処理
if all(visited):
ans += 1
return ans
# 次の頂点の探索
for i in range(n):
if visited[i] == False and (G[s][i] == 1 or G[i][s] == 1):
visited[i] = True
ans = dfs(G, visited, i, n, an... | false | 6.666667 | [
"-# -*- coding: utf-8 -*-",
"-import numpy as np",
"-",
"-n, m = list(map(int, input().split()))",
"-graph = [[0 for i in range(n)] for j in range(n)]",
"-graph = np.array(graph)",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- graph[a - 1, b - 1] = 1",
"- graph[b -... | false | 1.006245 | 0.094498 | 10.648344 | [
"s859887379",
"s332539369"
] |
u597455618 | p03457 | python | s432002292 | s997901738 | 531 | 351 | 37,132 | 35,940 | Accepted | Accepted | 33.9 | def dif(two_lists):
return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]
n = int(eval(input()))
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(dif, list(zip(txy, txy[1:]))))
for i in range(n):
dt, dx, dy = dtxy[i]
if dx + dy > dt or (dt -... | import sys
def dif(two_lists):
return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]
n = int(eval(input()))
txy = [[0, 0, 0]] + [[int(s) for s in line.split()] for line in sys.stdin]
dtxy = list(map(dif, list(zip(txy, txy[1:]))))
for i in range(n):
dt, dx, dy = dtxy[i]
if dx + d... | 15 | 16 | 374 | 389 | def dif(two_lists):
return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]
n = int(eval(input()))
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(dif, list(zip(txy, txy[1:]))))
for i in range(n):
dt, dx, dy = dtxy[i]
if dx + dy > dt or (dt - dx - dy) % 2:... | import sys
def dif(two_lists):
return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]
n = int(eval(input()))
txy = [[0, 0, 0]] + [[int(s) for s in line.split()] for line in sys.stdin]
dtxy = list(map(dif, list(zip(txy, txy[1:]))))
for i in range(n):
dt, dx, dy = dtxy[i]
if dx + dy > dt or (dt... | false | 6.25 | [
"+import sys",
"+",
"+",
"-txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]",
"+txy = [[0, 0, 0]] + [[int(s) for s in line.split()] for line in sys.stdin]"
] | false | 0.075152 | 0.054849 | 1.370162 | [
"s432002292",
"s997901738"
] |
u077291787 | p02913 | python | s605360236 | s038553937 | 83 | 74 | 11,208 | 10,120 | Accepted | Accepted | 10.84 | from typing import List, Tuple
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
self._base = base
self._mod = mod
self._hash, self._power = self._build(sour... | class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7) -> None:
self._base = base
self._mod = mod
self._hash = [0] * (len(source) + 1)
self._power = [0] * (len... | 55 | 49 | 1,723 | 1,518 | from typing import List, Tuple
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7):
self._base = base
self._mod = mod
self._hash, self._power = self._build(source)
def ... | class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7) -> None:
self._base = base
self._mod = mod
self._hash = [0] * (len(source) + 1)
self._power = [0] * (len(source) + ... | false | 10.909091 | [
"-from typing import List, Tuple",
"-",
"-",
"- def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7):",
"+ def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7) -> None:",
"- self._hash, self._power = self._build(source)",
"+ self._hash = [0] * (l... | false | 0.081822 | 0.080907 | 1.011302 | [
"s605360236",
"s038553937"
] |
u562935282 | p03331 | python | s458994587 | s678178289 | 135 | 107 | 3,060 | 3,060 | Accepted | Accepted | 20.74 | def func(x):
if x // 10 == 0:
return x
else:
return x % 10 + func(x // 10)
n = int(eval(input()))
ans = float('inf')
for a in range(1, (n // 2) + 1):
ans = min(ans, func(a) + func(n - a))
print(ans) | def d_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
n = int(eval(input()))
ans = float('inf')
for a in range(1, n // 2 + 1):
b = n - a
ans = min(ans, d_sum(a) + d_sum(b))
print(ans) | 11 | 15 | 231 | 245 | def func(x):
if x // 10 == 0:
return x
else:
return x % 10 + func(x // 10)
n = int(eval(input()))
ans = float("inf")
for a in range(1, (n // 2) + 1):
ans = min(ans, func(a) + func(n - a))
print(ans)
| def d_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
n = int(eval(input()))
ans = float("inf")
for a in range(1, n // 2 + 1):
b = n - a
ans = min(ans, d_sum(a) + d_sum(b))
print(ans)
| false | 26.666667 | [
"-def func(x):",
"- if x // 10 == 0:",
"- return x",
"- else:",
"- return x % 10 + func(x // 10)",
"+def d_sum(x):",
"+ res = 0",
"+ while x > 0:",
"+ res += x % 10",
"+ x //= 10",
"+ return res",
"-for a in range(1, (n // 2) + 1):",
"- ans = min... | false | 0.05191 | 0.143142 | 0.362647 | [
"s458994587",
"s678178289"
] |
u756195685 | p03160 | python | s064336078 | s702587535 | 138 | 125 | 13,928 | 20,420 | Accepted | Accepted | 9.42 | N = int(eval(input()))
A = list(map(int,input().split()))
dp = [0] * (N+10)
dp[2] = abs(A[1] - A[0])
for i in range(2,N):
Ai = abs(A[i] - A[i-1])
Ai2 = abs(A[i] - A[i-2])
dp[i+1] = min(dp[i]+Ai,dp[i-1]+Ai2)
print((dp[N])) | N = int(eval(input()))
h = list(map(int,input().split()))
dp = [0] * N
dp[1] = abs(h[0]-h[1])
for i in range(2,N):
dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
print((dp[-1]))
| 10 | 7 | 235 | 196 | N = int(eval(input()))
A = list(map(int, input().split()))
dp = [0] * (N + 10)
dp[2] = abs(A[1] - A[0])
for i in range(2, N):
Ai = abs(A[i] - A[i - 1])
Ai2 = abs(A[i] - A[i - 2])
dp[i + 1] = min(dp[i] + Ai, dp[i - 1] + Ai2)
print((dp[N]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((dp[-1]))
| false | 30 | [
"-A = list(map(int, input().split()))",
"-dp = [0] * (N + 10)",
"-dp[2] = abs(A[1] - A[0])",
"+h = list(map(int, input().split()))",
"+dp = [0] * N",
"+dp[1] = abs(h[0] - h[1])",
"- Ai = abs(A[i] - A[i - 1])",
"- Ai2 = abs(A[i] - A[i - 2])",
"- dp[i + 1] = min(dp[i] + Ai, dp[i - 1] + Ai2)",... | false | 0.11101 | 0.081026 | 1.370061 | [
"s064336078",
"s702587535"
] |
u581187895 | p02881 | python | s286161038 | s424797203 | 246 | 169 | 3,064 | 29,000 | Accepted | Accepted | 31.3 | # a+b-2
# N = a*b よってNの約数を求める
N = int(eval(input()))
ans = N-1
for i in range(1, int(N**0.5+1)):
if N//i*i == N:
ans = min(ans, i+N//i-2)
print(ans)
| # a+b-2
# N = a*b よってNの約数を求める
import numpy as np
N = int(eval(input()))
U = 10**6+100
x = np.arange(1, U, dtype=np.int64)
div = x[N%x==0]
ans = (div + N//div).min() - 2
print(ans) | 9 | 10 | 163 | 184 | # a+b-2
# N = a*b よってNの約数を求める
N = int(eval(input()))
ans = N - 1
for i in range(1, int(N**0.5 + 1)):
if N // i * i == N:
ans = min(ans, i + N // i - 2)
print(ans)
| # a+b-2
# N = a*b よってNの約数を求める
import numpy as np
N = int(eval(input()))
U = 10**6 + 100
x = np.arange(1, U, dtype=np.int64)
div = x[N % x == 0]
ans = (div + N // div).min() - 2
print(ans)
| false | 10 | [
"+import numpy as np",
"+",
"-ans = N - 1",
"-for i in range(1, int(N**0.5 + 1)):",
"- if N // i * i == N:",
"- ans = min(ans, i + N // i - 2)",
"+U = 10**6 + 100",
"+x = np.arange(1, U, dtype=np.int64)",
"+div = x[N % x == 0]",
"+ans = (div + N // div).min() - 2"
] | false | 0.040288 | 0.551405 | 0.073065 | [
"s286161038",
"s424797203"
] |
u707124227 | p03388 | python | s668998717 | s073784356 | 68 | 29 | 63,652 | 9,444 | Accepted | Accepted | 57.35 | q=int(eval(input()))
ab=[list(map(int,input().split())) for _ in range(q)]
from math import floor
for a,b in ab:
if a==b:
print((2*a-2))
continue
t=floor((a*b)**0.5)
# t,t+1 組み合わせの積がa*bで抑えられているかどうか
if t*t>=a*b: # t*tもだめ
print((2*t-3))
elif t*(t+1)>=a*b: # t*(t+1)はだめ
print((2*t-2))
... | q=int(eval(input()))
ab=[list(map(int,input().split())) for _ in range(q)]
from math import floor
for a,b in ab:
# a*bをぎりぎりまで攻めたい
# (1,1)とかはもったいない。(1,a*b-1)は良い。片方は√a*b未満で、片方は√a*bより大きい組み合わせ。
# a==bならa未満の整数yについて適切な数字xを選べばy*x<a*bとできる。xは他のxと被らないように選択できる。
if a==b:
print((2*a-2))
else:
... | 15 | 23 | 352 | 954 | q = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(q)]
from math import floor
for a, b in ab:
if a == b:
print((2 * a - 2))
continue
t = floor((a * b) ** 0.5)
# t,t+1 組み合わせの積がa*bで抑えられているかどうか
if t * t >= a * b: # t*tもだめ
print((2 * t - 3))
elif t * (t... | q = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(q)]
from math import floor
for a, b in ab:
# a*bをぎりぎりまで攻めたい
# (1,1)とかはもったいない。(1,a*b-1)は良い。片方は√a*b未満で、片方は√a*bより大きい組み合わせ。
# a==bならa未満の整数yについて適切な数字xを選べばy*x<a*bとできる。xは他のxと被らないように選択できる。
if a == b:
print((2 * a - 2))
else... | false | 34.782609 | [
"+ # a*bをぎりぎりまで攻めたい",
"+ # (1,1)とかはもったいない。(1,a*b-1)は良い。片方は√a*b未満で、片方は√a*bより大きい組み合わせ。",
"+ # a==bならa未満の整数yについて適切な数字xを選べばy*x<a*bとできる。xは他のxと被らないように選択できる。",
"- continue",
"- t = floor((a * b) ** 0.5)",
"- # t,t+1 組み合わせの積がa*bで抑えられているかどうか",
"- if t * t >= a * b: # t*tもだめ",
"- ... | false | 0.036239 | 0.078424 | 0.462087 | [
"s668998717",
"s073784356"
] |
u227438830 | p02399 | python | s682236240 | s148994999 | 30 | 20 | 7,620 | 5,604 | Accepted | Accepted | 33.33 | a, b = list(map(int, input().split()))
d = a//b
r = a % b
f = a / b
print(("{:d} {:d} {:.5f}".format(d,r,f))) | a, b = list(map(int,input().split()))
d,r,f = a//b,a%b,a/b
print(('{} {} {:.5f}'.format(d,r,f)))
| 5 | 3 | 105 | 91 | a, b = list(map(int, input().split()))
d = a // b
r = a % b
f = a / b
print(("{:d} {:d} {:.5f}".format(d, r, f)))
| a, b = list(map(int, input().split()))
d, r, f = a // b, a % b, a / b
print(("{} {} {:.5f}".format(d, r, f)))
| false | 40 | [
"-d = a // b",
"-r = a % b",
"-f = a / b",
"-print((\"{:d} {:d} {:.5f}\".format(d, r, f)))",
"+d, r, f = a // b, a % b, a / b",
"+print((\"{} {} {:.5f}\".format(d, r, f)))"
] | false | 0.043039 | 0.137054 | 0.314025 | [
"s682236240",
"s148994999"
] |
u644907318 | p03715 | python | s624703906 | s080259744 | 192 | 89 | 40,304 | 73,784 | Accepted | Accepted | 53.65 | H,W = list(map(int,input().split()))
if (H*W)%3==0:
dif = 0
else:
dif = min(H,W)
for i in range(1,W//2+1):
s1 = H*i
s2 = (W-i)*(H//2)
s3 = (W-i)*(H-H//2)
d = max(s1,s2,s3)-min(s1,s2,s3)
dif = min(dif,d)
for j in range(1,H//2+1):
s1 = W*j
... | H,W = list(map(int,input().split()))
cmin = H*W
if H%3==0 or W%3==0:
ans = 0
else:
for i in range(H-1):
s1 = W*(i+1)
t = H-i-1
s2 = W*(t//2)
s3 = W*(t-t//2)
d = max(abs(s1-s2),abs(s2-s3),abs(s3-s1))
cmin = min(cmin,d)
t1 = W//2
s2 = t*... | 18 | 31 | 442 | 780 | H, W = list(map(int, input().split()))
if (H * W) % 3 == 0:
dif = 0
else:
dif = min(H, W)
for i in range(1, W // 2 + 1):
s1 = H * i
s2 = (W - i) * (H // 2)
s3 = (W - i) * (H - H // 2)
d = max(s1, s2, s3) - min(s1, s2, s3)
dif = min(dif, d)
for j in range(1, H // 2... | H, W = list(map(int, input().split()))
cmin = H * W
if H % 3 == 0 or W % 3 == 0:
ans = 0
else:
for i in range(H - 1):
s1 = W * (i + 1)
t = H - i - 1
s2 = W * (t // 2)
s3 = W * (t - t // 2)
d = max(abs(s1 - s2), abs(s2 - s3), abs(s3 - s1))
cmin = min(cmin, d)
... | false | 41.935484 | [
"-if (H * W) % 3 == 0:",
"- dif = 0",
"+cmin = H * W",
"+if H % 3 == 0 or W % 3 == 0:",
"+ ans = 0",
"- dif = min(H, W)",
"- for i in range(1, W // 2 + 1):",
"- s1 = H * i",
"- s2 = (W - i) * (H // 2)",
"- s3 = (W - i) * (H - H // 2)",
"- d = max(s1, s2, s... | false | 0.035028 | 0.035564 | 0.984922 | [
"s624703906",
"s080259744"
] |
u013513417 | p03162 | python | s482076571 | s970419666 | 672 | 273 | 71,772 | 100,904 | Accepted | Accepted | 59.38 | #S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合
S = [[0 for j in range(3)] for i in range(100010)]
DP= [[0 for j in range(3)] for i in range(100010)]
N=int(eval(input()))
for i in range(N):
L=list(map(int,input().split()))
for j in range(len(L)):
S[i][j]=L[j]
for i in range(N):
... | N=int(eval(input()))
#S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合
S = [[0 for j in range(3)] for i in range(100010)]
def chmax(a,b):
if a>b:
return a
else:
return b
for i in range(N):
A,B,C=list(map(int,input().split()))
S[i+1][0]=A
S[i+1][1]=B
... | 27 | 39 | 611 | 762 | # S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合
S = [[0 for j in range(3)] for i in range(100010)]
DP = [[0 for j in range(3)] for i in range(100010)]
N = int(eval(input()))
for i in range(N):
L = list(map(int, input().split()))
for j in range(len(L)):
S[i][j] = L[j]
for i in range(N):
for j... | N = int(eval(input()))
# S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合
S = [[0 for j in range(3)] for i in range(100010)]
def chmax(a, b):
if a > b:
return a
else:
return b
for i in range(N):
A, B, C = list(map(int, input().split()))
S[i + 1][0] = A
S[i + 1][1] = B
S[... | false | 30.769231 | [
"+N = int(eval(input()))",
"+",
"+",
"+def chmax(a, b):",
"+ if a > b:",
"+ return a",
"+ else:",
"+ return b",
"+",
"+",
"+for i in range(N):",
"+ A, B, C = list(map(int, input().split()))",
"+ S[i + 1][0] = A",
"+ S[i + 1][1] = B",
"+ S[i + 1][2] = C",
... | false | 0.682638 | 0.718199 | 0.950486 | [
"s482076571",
"s970419666"
] |
u075595666 | p02837 | python | s657388658 | s590144324 | 339 | 210 | 53,340 | 9,136 | Accepted | Accepted | 38.05 | import sys
input = sys.stdin.readline
n = int(eval(input()))
chk = [[set(),set()] for _ in range(n)]
for o in range(n):
a = int(eval(input()))
for i in range(a):
x,y = [int(i) for i in input().split()]
if y == 0:
chk[o][0].add(x-1)
if y == 1:
chk[o][1].add(x-1)
chk = tuple(... | n = int(eval(input()))
a = []
xy = []
for i in range(n):
a += [int(eval(input()))]
xy += [[list(map(int,input().split())) for i in range(a[i])]]
honest = []
for i in range(2 ** n):
flag = 0
for j in range(n):
if (i >> j)&1 == 1: #j番目は正直であるとき
for person_state in xy[j]:
... | 36 | 18 | 748 | 524 | import sys
input = sys.stdin.readline
n = int(eval(input()))
chk = [[set(), set()] for _ in range(n)]
for o in range(n):
a = int(eval(input()))
for i in range(a):
x, y = [int(i) for i in input().split()]
if y == 0:
chk[o][0].add(x - 1)
if y == 1:
chk[o][1].add(x ... | n = int(eval(input()))
a = []
xy = []
for i in range(n):
a += [int(eval(input()))]
xy += [[list(map(int, input().split())) for i in range(a[i])]]
honest = []
for i in range(2**n):
flag = 0
for j in range(n):
if (i >> j) & 1 == 1: # j番目は正直であるとき
for person_state in xy[j]:
... | false | 50 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-chk = [[set(), set()] for _ in range(n)]",
"-for o in range(n):",
"- a = int(eval(input()))",
"- for i in range(a):",
"- x, y = [int(i) for i in input().split()]",
"- if y == 0:",
"- chk[o][0].add(x - 1)",
"- ... | false | 0.075989 | 0.054127 | 1.403908 | [
"s657388658",
"s590144324"
] |
u964494353 | p03244 | python | s832959775 | s645411848 | 102 | 94 | 17,528 | 17,056 | Accepted | Accepted | 7.84 | n = int(eval(input()))
lst = list(map(int, input().split()))
ma = {}
mb = {}
for i in range(0, n, 2):
lst[i] in ma
if lst[i] in ma:
ma[lst[i]] += 1
else:
ma[lst[i]] = 1
lst[i+1] in mb
if lst[i+1] in mb:
mb[lst[i+1]] += 1
else:
mb[lst[i+1]] = 1
if ma... | n = int(eval(input()))
lst = list(map(int, input().split()))
m1 = {}
m2 = {}
for i in range(0, n, 2):
if lst[i] in m1:
m1[lst[i]] += 1
else:
m1[lst[i]] = 1
if lst[i+1] in m2:
m2[lst[i+1]] += 1
else:
m2[lst[i+1]] = 1
if max(m1, key=m1.get) != max(m2, key=m2.ge... | 26 | 22 | 638 | 578 | n = int(eval(input()))
lst = list(map(int, input().split()))
ma = {}
mb = {}
for i in range(0, n, 2):
lst[i] in ma
if lst[i] in ma:
ma[lst[i]] += 1
else:
ma[lst[i]] = 1
lst[i + 1] in mb
if lst[i + 1] in mb:
mb[lst[i + 1]] += 1
else:
mb[lst[i + 1]] = 1
if max(ma, k... | n = int(eval(input()))
lst = list(map(int, input().split()))
m1 = {}
m2 = {}
for i in range(0, n, 2):
if lst[i] in m1:
m1[lst[i]] += 1
else:
m1[lst[i]] = 1
if lst[i + 1] in m2:
m2[lst[i + 1]] += 1
else:
m2[lst[i + 1]] = 1
if max(m1, key=m1.get) != max(m2, key=m2.get):
... | false | 15.384615 | [
"-ma = {}",
"-mb = {}",
"+m1 = {}",
"+m2 = {}",
"- lst[i] in ma",
"- if lst[i] in ma:",
"- ma[lst[i]] += 1",
"+ if lst[i] in m1:",
"+ m1[lst[i]] += 1",
"- ma[lst[i]] = 1",
"- lst[i + 1] in mb",
"- if lst[i + 1] in mb:",
"- mb[lst[i + 1]] += 1",
"+... | false | 0.039182 | 0.038345 | 1.021834 | [
"s832959775",
"s645411848"
] |
u098012509 | p02631 | python | s011685993 | s540728302 | 159 | 141 | 31,404 | 31,408 | Accepted | Accepted | 11.32 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(input())
A = [int(x) for x in input().split()]
ans = A[0]
for a in A[1:]:
ans ^= a
for a in A:
print(a ^ ans, end=" ")
if __name__ == '__main__':
main()
| import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
s = 0
for a in A:
s ^= a
for a in A:
print((s ^ a))
if __name__ == '__main__':
main()
| 21 | 22 | 310 | 298 | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(input())
A = [int(x) for x in input().split()]
ans = A[0]
for a in A[1:]:
ans ^= a
for a in A:
print(a ^ ans, end=" ")
if __name__ == "__main__":
main()
| import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
s = 0
for a in A:
s ^= a
for a in A:
print((s ^ a))
if __name__ == "__main__":
main()
| false | 4.545455 | [
"- N = int(input())",
"+ N = int(eval(input()))",
"- ans = A[0]",
"- for a in A[1:]:",
"- ans ^= a",
"+ s = 0",
"- print(a ^ ans, end=\" \")",
"+ s ^= a",
"+ for a in A:",
"+ print((s ^ a))"
] | false | 0.040967 | 0.097369 | 0.420742 | [
"s011685993",
"s540728302"
] |
u753803401 | p03160 | python | s616881490 | s143912126 | 234 | 209 | 52,208 | 51,696 | Accepted | Accepted | 10.68 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
a = list(map(int, input().rstrip('\n').split()))
ls = [0] * n
for i in range(1, n):
if i == 1:
ls[i] = abs(a[i] - a[i-1])
else:
ls[i] = min(ls[i-1] + abs(a[i] - a[i-... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
h = list(map(int, readline().split()))
dp = [10 ** 10] * n
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i])
... | 16 | 20 | 419 | 483 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
a = list(map(int, input().rstrip("\n").split()))
ls = [0] * n
for i in range(1, n):
if i == 1:
ls[i] = abs(a[i] - a[i - 1])
else:
ls[i] = min(
ls[i - 1] + abs... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
h = list(map(int, readline().split()))
dp = [10**10] * n
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i])
else:
... | false | 20 | [
"-def slove():",
"- import sys",
"+import sys",
"- input = sys.stdin.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = list(map(int, input().rstrip(\"\\n\").split()))",
"- ls = [0] * n",
"+",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+ mod = 10**9 + 7... | false | 0.044826 | 0.044359 | 1.010524 | [
"s616881490",
"s143912126"
] |
u872538555 | p02791 | python | s284708354 | s379985222 | 148 | 89 | 25,116 | 25,116 | Accepted | Accepted | 39.86 | n, *p_n = list(map(int, open(0).read().split()))
count = 0
p_n_min = p_n[0]
for i in range(n):
p_n_min = min(p_n_min,p_n[i])
if p_n_min == p_n[i]:
count += 1
print(count) | n, *p_n = list(map(int, open(0).read().split()))
count = 0
min_num = p_n[0]
for p in p_n:
if p <= min_num:
min_num = p
count += 1
print(count) | 9 | 9 | 189 | 165 | n, *p_n = list(map(int, open(0).read().split()))
count = 0
p_n_min = p_n[0]
for i in range(n):
p_n_min = min(p_n_min, p_n[i])
if p_n_min == p_n[i]:
count += 1
print(count)
| n, *p_n = list(map(int, open(0).read().split()))
count = 0
min_num = p_n[0]
for p in p_n:
if p <= min_num:
min_num = p
count += 1
print(count)
| false | 0 | [
"-p_n_min = p_n[0]",
"-for i in range(n):",
"- p_n_min = min(p_n_min, p_n[i])",
"- if p_n_min == p_n[i]:",
"+min_num = p_n[0]",
"+for p in p_n:",
"+ if p <= min_num:",
"+ min_num = p"
] | false | 0.059615 | 0.064214 | 0.928388 | [
"s284708354",
"s379985222"
] |
u667084803 | p02775 | python | s376822651 | s006075604 | 1,113 | 932 | 154,500 | 154,884 | Accepted | Accepted | 16.26 | Z = [0,1,2,3,4,5,6,7,8,9,10]
C = [0,1,2,3,4,5,6,7,8,9]
X = [0,1,2,3,4,5,6,7,8,9]
def solve_dp(s):
n = len(s)
s = [int(c) for c in s]
inf = 10**9
dp = [[inf] * 2 for _ in range(n)]
d0 = s[0]
dp[0][0] = Z[d0]
dp[0][1] = Z[d0+1]
for i in range(1, n):
for j in ran... | def solve_dp(s):
n = len(s)
s = [int(c) for c in s]
inf = 10**9
dp = [[inf] * 2 for _ in range(n)]
d0 = s[0]
dp[0][0] = d0
dp[0][1] = d0+1
for i in range(1, n):
for j in range(2):
d = s[i] + j
for k in range(10):
if d + k ... | 30 | 26 | 719 | 602 | Z = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
C = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
X = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
def solve_dp(s):
n = len(s)
s = [int(c) for c in s]
inf = 10**9
dp = [[inf] * 2 for _ in range(n)]
d0 = s[0]
dp[0][0] = Z[d0]
dp[0][1] = Z[d0 + 1]
for i in range(1, n):
... | def solve_dp(s):
n = len(s)
s = [int(c) for c in s]
inf = 10**9
dp = [[inf] * 2 for _ in range(n)]
d0 = s[0]
dp[0][0] = d0
dp[0][1] = d0 + 1
for i in range(1, n):
for j in range(2):
d = s[i] + j
for k in range(10):
if d + k >= 10:
... | false | 13.333333 | [
"-Z = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"-C = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-X = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-",
"-",
"- dp[0][0] = Z[d0]",
"- dp[0][1] = Z[d0 + 1]",
"+ dp[0][0] = d0",
"+ dp[0][1] = d0 + 1",
"- if d + C[k] >= 10:",
"- dp... | false | 0.050852 | 0.05052 | 1.006556 | [
"s376822651",
"s006075604"
] |
u533883485 | p02265 | python | s912308658 | s650067664 | 4,860 | 3,590 | 557,300 | 214,360 | Accepted | Accepted | 26.13 | # coding=utf-8
from collections import deque
n = int(eval(input()))
deque = deque()
input_lines = [input().split() for x in range(n)]
for i in range(n):
inp = input_lines[i]
if inp[0] == 'insert':
deque.appendleft(inp[1])
elif inp[0] == 'deleteFirst':
deque.popleft()
elif in... | # coding=utf-8
from collections import deque
n = int(eval(input()))
deque = deque()
input_lines = [eval(input()) for x in range(n)]
for i in range(n):
inp = input_lines[i].split()
if inp[0] == 'insert':
deque.appendleft(inp[1])
elif inp[0] == 'deleteFirst':
deque.popleft()
e... | 19 | 19 | 447 | 447 | # coding=utf-8
from collections import deque
n = int(eval(input()))
deque = deque()
input_lines = [input().split() for x in range(n)]
for i in range(n):
inp = input_lines[i]
if inp[0] == "insert":
deque.appendleft(inp[1])
elif inp[0] == "deleteFirst":
deque.popleft()
elif inp[0] == "del... | # coding=utf-8
from collections import deque
n = int(eval(input()))
deque = deque()
input_lines = [eval(input()) for x in range(n)]
for i in range(n):
inp = input_lines[i].split()
if inp[0] == "insert":
deque.appendleft(inp[1])
elif inp[0] == "deleteFirst":
deque.popleft()
elif inp[0] =... | false | 0 | [
"-input_lines = [input().split() for x in range(n)]",
"+input_lines = [eval(input()) for x in range(n)]",
"- inp = input_lines[i]",
"+ inp = input_lines[i].split()"
] | false | 0.035998 | 0.037401 | 0.962493 | [
"s912308658",
"s650067664"
] |
u909514237 | p02554 | python | s877706227 | s909043408 | 288 | 29 | 82,256 | 8,728 | Accepted | Accepted | 89.93 | import math
mod = 10**9 + 7
N = int(eval(input()))
ans = (10**N % mod) - 2 * (9**N % mod) + (8**N % mod)
print((ans%mod)) | N = int(eval(input()))
mod = 10**9 + 7
ans = pow(10,N,mod) - pow(9,N,mod)*2 + pow(8,N,mod)
print((ans%mod)) | 7 | 5 | 121 | 104 | import math
mod = 10**9 + 7
N = int(eval(input()))
ans = (10**N % mod) - 2 * (9**N % mod) + (8**N % mod)
print((ans % mod))
| N = int(eval(input()))
mod = 10**9 + 7
ans = pow(10, N, mod) - pow(9, N, mod) * 2 + pow(8, N, mod)
print((ans % mod))
| false | 28.571429 | [
"-import math",
"-",
"+N = int(eval(input()))",
"-N = int(eval(input()))",
"-ans = (10**N % mod) - 2 * (9**N % mod) + (8**N % mod)",
"+ans = pow(10, N, mod) - pow(9, N, mod) * 2 + pow(8, N, mod)"
] | false | 0.130835 | 0.039498 | 3.312423 | [
"s877706227",
"s909043408"
] |
u670180528 | p03045 | python | s355720884 | s829937515 | 1,192 | 488 | 291,544 | 120,460 | Accepted | Accepted | 59.06 | from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)
n,m,*l=list(map(int,open(0).read().split()))
graph=[[]*n for _ in range(n)]
unvis=[True]*n
@lru_cache(maxsize=None)
def dfs(x):
for y in graph[x]:
if unvis[y]:
unvis[y]=False
dfs(y)
for i,j in zip(l[::3],l[1::3]):
gr... | import sys
sys.setrecursionlimit(200000)
n,m,*l=list(map(int,open(0).read().split()))
graph=[[]*n for _ in range(n)]
unvis=[True]*n
def dfs(x):
for y in graph[x]:
if unvis[y]:
unvis[y]=False
dfs(y)
for i,j in zip(l[::3],l[1::3]):
graph[i-1].append(j-1)
graph[j-1].append(i-1)
ans=0
fo... | 26 | 24 | 454 | 396 | from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)
n, m, *l = list(map(int, open(0).read().split()))
graph = [[] * n for _ in range(n)]
unvis = [True] * n
@lru_cache(maxsize=None)
def dfs(x):
for y in graph[x]:
if unvis[y]:
unvis[y] = False
dfs(y)
for i, j i... | import sys
sys.setrecursionlimit(200000)
n, m, *l = list(map(int, open(0).read().split()))
graph = [[] * n for _ in range(n)]
unvis = [True] * n
def dfs(x):
for y in graph[x]:
if unvis[y]:
unvis[y] = False
dfs(y)
for i, j in zip(l[::3], l[1::3]):
graph[i - 1].append(j - 1)
... | false | 7.692308 | [
"-from functools import lru_cache",
"-sys.setrecursionlimit(10**7)",
"+sys.setrecursionlimit(200000)",
"-@lru_cache(maxsize=None)"
] | false | 0.048124 | 0.045722 | 1.052516 | [
"s355720884",
"s829937515"
] |
u169138653 | p02936 | python | s717414415 | s860966137 | 1,841 | 1,672 | 106,124 | 54,524 | Accepted | Accepted | 9.18 | from collections import deque
n,q=list(map(int,input().split()))
edge=[[] for i in range(n)]
cnt=[0 for i in range(n)]
visited=[-1 for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
for i in range(q):
p,x=list(map(int,input().... | from collections import deque
n,q=list(map(int,input().split()))
edge=[[] for _ in range(n)]
for _ in range(n-1):
a,b=list(map(int,input().split()))
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
def dfs(edge):
visited=[-1]*n
stack=deque([0])
visited[0]=0
while stack:
p=stack.pop()
... | 27 | 28 | 617 | 551 | from collections import deque
n, q = list(map(int, input().split()))
edge = [[] for i in range(n)]
cnt = [0 for i in range(n)]
visited = [-1 for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
for i in range(q):
p, x... | from collections import deque
n, q = list(map(int, input().split()))
edge = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
def dfs(edge):
visited = [-1] * n
stack = deque([0])
visited[0] = 0
wh... | false | 3.571429 | [
"-edge = [[] for i in range(n)]",
"-cnt = [0 for i in range(n)]",
"-visited = [-1 for i in range(n)]",
"-for i in range(n - 1):",
"+edge = [[] for _ in range(n)]",
"+for _ in range(n - 1):",
"-for i in range(q):",
"- p, x = list(map(int, input().split()))",
"- cnt[p - 1] += x",
"-def dfs(edg... | false | 0.037673 | 0.036269 | 1.038685 | [
"s717414415",
"s860966137"
] |
u375616706 | p02585 | python | s600081319 | s673998224 | 1,999 | 718 | 413,528 | 78,144 | Accepted | Accepted | 64.08 | N,K = list(map(int,input().split()))
P=list([int(x)-1 for x in input().split()])
C=list(map(int,input().split()))
DP=[[C[P[n]]] for n in range(N)]
for start in range(N):
visited=set()
cur=P[start]
while cur not in visited:
visited.add(cur)
cur = P[cur]
DP[start].append(... | N,K = list(map(int,input().split()))
P=list([int(x)-1 for x in input().split()])
C=list(map(int,input().split()))
ans=-float("inf")
for start in range(N):
cur=P[start]
scores=[C[cur]]
for _ in range(K):
if cur==start:
break
cur = P[cur]
scores.append(C[cur]... | 30 | 25 | 724 | 604 | N, K = list(map(int, input().split()))
P = list([int(x) - 1 for x in input().split()])
C = list(map(int, input().split()))
DP = [[C[P[n]]] for n in range(N)]
for start in range(N):
visited = set()
cur = P[start]
while cur not in visited:
visited.add(cur)
cur = P[cur]
DP[start].append... | N, K = list(map(int, input().split()))
P = list([int(x) - 1 for x in input().split()])
C = list(map(int, input().split()))
ans = -float("inf")
for start in range(N):
cur = P[start]
scores = [C[cur]]
for _ in range(K):
if cur == start:
break
cur = P[cur]
scores.append(C[cu... | false | 16.666667 | [
"-DP = [[C[P[n]]] for n in range(N)]",
"-for start in range(N):",
"- visited = set()",
"- cur = P[start]",
"- while cur not in visited:",
"- visited.add(cur)",
"- cur = P[cur]",
"- DP[start].append(C[cur] + DP[start][-1])",
"-for n in range(N):",
"- DP[n] = DP[n][:... | false | 0.041207 | 0.06818 | 0.604395 | [
"s600081319",
"s673998224"
] |
u745087332 | p03339 | python | s920561795 | s636930734 | 233 | 186 | 3,780 | 3,708 | Accepted | Accepted | 20.17 | # coding:utf-8
INF = float('inf')
N = int(eval(input()))
S = eval(input())
num_E = 0
num_W = 0
for s in S:
if s == 'E':
num_E += 1
else:
num_W += 1
e = num_E
w = num_W
ans = INF
for s in S:
cost = 0
if s == 'E':
e -= 1
cost = e + (num_W - w)
... | # coding:utf-8
INF = float('inf')
N = int(eval(input()))
S = eval(input())
num_E = S[:].count('E')
num_W = S[:].count('W')
e = num_E
w = num_W
ans = INF
for s in S:
cost = 0
if s == 'E':
e -= 1
cost = e + (num_W - w)
else:
w -= 1
cost = e + (num_W ... | 30 | 26 | 409 | 356 | # coding:utf-8
INF = float("inf")
N = int(eval(input()))
S = eval(input())
num_E = 0
num_W = 0
for s in S:
if s == "E":
num_E += 1
else:
num_W += 1
e = num_E
w = num_W
ans = INF
for s in S:
cost = 0
if s == "E":
e -= 1
cost = e + (num_W - w)
else:
w -= 1
... | # coding:utf-8
INF = float("inf")
N = int(eval(input()))
S = eval(input())
num_E = S[:].count("E")
num_W = S[:].count("W")
e = num_E
w = num_W
ans = INF
for s in S:
cost = 0
if s == "E":
e -= 1
cost = e + (num_W - w)
else:
w -= 1
cost = e + (num_W - w - 1)
ans = min(ans, ... | false | 13.333333 | [
"-num_E = 0",
"-num_W = 0",
"-for s in S:",
"- if s == \"E\":",
"- num_E += 1",
"- else:",
"- num_W += 1",
"+num_E = S[:].count(\"E\")",
"+num_W = S[:].count(\"W\")"
] | false | 0.047285 | 0.046996 | 1.006154 | [
"s920561795",
"s636930734"
] |
u541610817 | p02923 | python | s447561356 | s852997088 | 132 | 105 | 14,252 | 14,252 | Accepted | Accepted | 20.45 | n = int(eval(input()))
H = [int(x) for x in input().split()]
res = 0
right = 0
for left in range(n):
while right+1 < n and H[right] >= H[right+1]:
right += 1
res = max(res, right - left)
if right == left:
right += 1
print(res) | n = int(eval(input()))
h = [int(x) for x in input().split()]
dp = [0] * (n + 1)
cc = 0
for i in range(1, n):
if h[i] <= h[i-1]:
cc += 1
dp[i+1] = max(cc, dp[i])
else:
dp[i+1] = dp[i]
cc = 0
print((dp[n]))
| 11 | 12 | 245 | 228 | n = int(eval(input()))
H = [int(x) for x in input().split()]
res = 0
right = 0
for left in range(n):
while right + 1 < n and H[right] >= H[right + 1]:
right += 1
res = max(res, right - left)
if right == left:
right += 1
print(res)
| n = int(eval(input()))
h = [int(x) for x in input().split()]
dp = [0] * (n + 1)
cc = 0
for i in range(1, n):
if h[i] <= h[i - 1]:
cc += 1
dp[i + 1] = max(cc, dp[i])
else:
dp[i + 1] = dp[i]
cc = 0
print((dp[n]))
| false | 8.333333 | [
"-H = [int(x) for x in input().split()]",
"-res = 0",
"-right = 0",
"-for left in range(n):",
"- while right + 1 < n and H[right] >= H[right + 1]:",
"- right += 1",
"- res = max(res, right - left)",
"- if right == left:",
"- right += 1",
"-print(res)",
"+h = [int(x) for x ... | false | 0.096537 | 0.036737 | 2.627755 | [
"s447561356",
"s852997088"
] |
u413021823 | p03086 | python | s791638997 | s745288312 | 67 | 29 | 64,988 | 9,084 | Accepted | Accepted | 56.72 | import sys
from collections import deque
from itertools import *
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
temp = 0
ans = 0
for char in s:
if char in 'ACGT':
... | 28 | 19 | 474 | 403 | import sys
from collections import deque
from itertools import *
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def S():
return sys.stdin.readline().rstrip()
def LS():
return list(sys.stdin.readline().rstrip().split())
... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def S():
return sys.stdin.readline().rstrip()
def LS():
return list(sys.stdin.readline().rstrip().split())
s = S()
temp = 0
ans = 0
for char in s:
if char in... | false | 32.142857 | [
"-from collections import deque",
"-from itertools import *",
"+temp = 0",
"-temp = 0",
"-for s_s in s:",
"- if s_s in \"ACGT\":",
"+for char in s:",
"+ if char in \"ACGT\":"
] | false | 0.037417 | 0.074027 | 0.505449 | [
"s791638997",
"s745288312"
] |
u189487046 | p03624 | python | s228337368 | s735208897 | 19 | 17 | 3,188 | 3,188 | Accepted | Accepted | 10.53 | ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
s = eval(input())
for i in range(26):
if s.count(ALPHABET[i]) == 0:
print((ALPHABET[i]))
break
else:
print("None")
| ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
s = eval(input())
for i in range(26):
if ALPHABET[i] not in s:
print((ALPHABET[i]))
break
else:
print("None")
| 11 | 11 | 308 | 303 | ALPHABET = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
s = eval(input())
for i in range(26):
if s.count(ALPHABET[i]) == 0:... | ALPHABET = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
s = eval(input())
for i in range(26):
if ALPHABET[i] not in s:
... | false | 0 | [
"- if s.count(ALPHABET[i]) == 0:",
"+ if ALPHABET[i] not in s:"
] | false | 0.040514 | 0.040436 | 1.001926 | [
"s228337368",
"s735208897"
] |
u545368057 | p02991 | python | s050453291 | s574110087 | 703 | 523 | 60,100 | 61,372 | Accepted | Accepted | 25.6 | from collections import deque
# 木構造を作る
N,M = list(map(int, input().split()))
G = [[] for i in range(3*N)]
for i in range(M):
# グラフに頂点を追加(距離があるときは,u,vの後に入れる)
u,v = list(map(int,input().split()))
G[3*(u-1)].append((3*(v-1)+1))
G[3*(u-1)+1].append((3*(v-1)+2))
G[3*(u-1)+2].append((3*(v-1)))
... | from collections import deque
n, m = list(map(int, input().split()))
edges = [[] for i in range(3*n)]
for i in range(m):
u,v = list(map(int, input().split()))
u -= 1
v -= 1
edges[u].append(v+n)
edges[u+n].append(v+2*n)
edges[u+2*n].append(v)
s,t = list(map(int, input().split()))
s -... | 29 | 32 | 640 | 619 | from collections import deque
# 木構造を作る
N, M = list(map(int, input().split()))
G = [[] for i in range(3 * N)]
for i in range(M):
# グラフに頂点を追加(距離があるときは,u,vの後に入れる)
u, v = list(map(int, input().split()))
G[3 * (u - 1)].append((3 * (v - 1) + 1))
G[3 * (u - 1) + 1].append((3 * (v - 1) + 2))
G[3 * (u - 1) ... | from collections import deque
n, m = list(map(int, input().split()))
edges = [[] for i in range(3 * n)]
for i in range(m):
u, v = list(map(int, input().split()))
u -= 1
v -= 1
edges[u].append(v + n)
edges[u + n].append(v + 2 * n)
edges[u + 2 * n].append(v)
s, t = list(map(int, input().split()))... | false | 9.375 | [
"-# 木構造を作る",
"-N, M = list(map(int, input().split()))",
"-G = [[] for i in range(3 * N)]",
"-for i in range(M):",
"- # グラフに頂点を追加(距離があるときは,u,vの後に入れる)",
"+n, m = list(map(int, input().split()))",
"+edges = [[] for i in range(3 * n)]",
"+for i in range(m):",
"- G[3 * (u - 1)].append((3 * (v - 1) ... | false | 0.041202 | 0.035125 | 1.173 | [
"s050453291",
"s574110087"
] |
u515052479 | p03053 | python | s887338264 | s458326464 | 956 | 499 | 51,584 | 146,144 | Accepted | Accepted | 47.8 | def main():
h,w = list(map(int,input().split()))
a = []
for i in range(h):
a.append(eval(input()))
used = [True]*(h*w)
p = []
for i in range(h):
for j in range(w):
if a[i][j] == '#':
p.append(i*w+j)
used[i*w+j] = False
... | def main():
num_r,num_c = list(map(int,input().split()))
field = [eval(input()) for i in range(num_r)]
q = []
seen = [0]*(num_c*num_r)
count = 0
for i in range(num_r):
for j in range(num_c):
if field[i][j] == "#":
seen[i*num_c+j] = 1
q.append([i,j])
while q:... | 39 | 38 | 919 | 939 | def main():
h, w = list(map(int, input().split()))
a = []
for i in range(h):
a.append(eval(input()))
used = [True] * (h * w)
p = []
for i in range(h):
for j in range(w):
if a[i][j] == "#":
p.append(i * w + j)
used[i * w + j] = False
... | def main():
num_r, num_c = list(map(int, input().split()))
field = [eval(input()) for i in range(num_r)]
q = []
seen = [0] * (num_c * num_r)
count = 0
for i in range(num_r):
for j in range(num_c):
if field[i][j] == "#":
seen[i * num_c + j] = 1
... | false | 2.564103 | [
"- h, w = list(map(int, input().split()))",
"- a = []",
"- for i in range(h):",
"- a.append(eval(input()))",
"- used = [True] * (h * w)",
"- p = []",
"- for i in range(h):",
"- for j in range(w):",
"- if a[i][j] == \"#\":",
"- p.append(i * ... | false | 0.086375 | 0.046135 | 1.872218 | [
"s887338264",
"s458326464"
] |
u136090046 | p03575 | python | s314873704 | s481987697 | 29 | 20 | 3,444 | 3,064 | Accepted | Accepted | 31.03 | import copy
n, m = list(map(int, input().split()))
array = [[int(x) for x in input().split()] for y in range(m)]
t = copy.copy(array)
def solver(start, array, visited, cnt):
if visited[start]:
return cnt
else:
visited[start] = True
for i in array[start]:
if len(set(... | n, m = list(map(int, input().split()))
ab_array = [[int(x) for x in input().split()] for y in range(m)]
graph = [[] for x in range(n + 1)]
def dfs(graph, now, a, b):
visited[now] = True
for next in graph[now]:
if (now == a and next == b) or (now == b and next == a):
continue
... | 41 | 26 | 929 | 657 | import copy
n, m = list(map(int, input().split()))
array = [[int(x) for x in input().split()] for y in range(m)]
t = copy.copy(array)
def solver(start, array, visited, cnt):
if visited[start]:
return cnt
else:
visited[start] = True
for i in array[start]:
if len(set(visited)) == 1:... | n, m = list(map(int, input().split()))
ab_array = [[int(x) for x in input().split()] for y in range(m)]
graph = [[] for x in range(n + 1)]
def dfs(graph, now, a, b):
visited[now] = True
for next in graph[now]:
if (now == a and next == b) or (now == b and next == a):
continue
if not... | false | 36.585366 | [
"-import copy",
"-",
"-array = [[int(x) for x in input().split()] for y in range(m)]",
"-t = copy.copy(array)",
"+ab_array = [[int(x) for x in input().split()] for y in range(m)]",
"+graph = [[] for x in range(n + 1)]",
"-def solver(start, array, visited, cnt):",
"- if visited[start]:",
"- ... | false | 0.163851 | 0.078844 | 2.07816 | [
"s314873704",
"s481987697"
] |
u227082700 | p02911 | python | s990838780 | s092265907 | 269 | 245 | 4,808 | 8,632 | Accepted | Accepted | 8.92 | n,k,q=list(map(int,input().split()))
p=[0]*n
for i in range(q):p[int(eval(input()))-1]+=1
for i in range(n):
if k<=q-p[i]:print("No")
else:print("Yes") | n,k,q=list(map(int,input().split()))
k=q-k
a=[int(eval(input()))for _ in range(q)]
x=[0]*n
for i in a:x[i-1]+=1
for i in x:
if i>k:print('Yes')
else:print('No') | 6 | 8 | 148 | 159 | n, k, q = list(map(int, input().split()))
p = [0] * n
for i in range(q):
p[int(eval(input())) - 1] += 1
for i in range(n):
if k <= q - p[i]:
print("No")
else:
print("Yes")
| n, k, q = list(map(int, input().split()))
k = q - k
a = [int(eval(input())) for _ in range(q)]
x = [0] * n
for i in a:
x[i - 1] += 1
for i in x:
if i > k:
print("Yes")
else:
print("No")
| false | 25 | [
"-p = [0] * n",
"-for i in range(q):",
"- p[int(eval(input())) - 1] += 1",
"-for i in range(n):",
"- if k <= q - p[i]:",
"+k = q - k",
"+a = [int(eval(input())) for _ in range(q)]",
"+x = [0] * n",
"+for i in a:",
"+ x[i - 1] += 1",
"+for i in x:",
"+ if i > k:",
"+ print(... | false | 0.044146 | 0.042237 | 1.045186 | [
"s990838780",
"s092265907"
] |
u845333844 | p03361 | python | s967258511 | s996358479 | 30 | 18 | 3,064 | 3,064 | Accepted | Accepted | 40 | h,w=list(map(int,input().split()))
l=[eval(input()) for i in range(h)]
ans='Yes'
for i in range(1,h-1):
for j in range(1,w-1):
if l[i][j]=='#':
if l[i-1][j]==l[i+1][j]==l[i][j-1]==l[i][j+1]=='.':
ans='No'
print(ans) | h,w=list(map(int,input().split()))
l=['.'*(w+2)]+['.'+eval(input())+'.' for i in range(h)]+['.'*(w+2)]
ans='Yes'
for i in range(1,h+1):
for j in range(1,w+1):
if l[i][j]=='#':
if l[i-1][j]==l[i+1][j]==l[i][j-1]==l[i][j+1]=='.':
ans='No'
print(ans) | 10 | 10 | 253 | 285 | h, w = list(map(int, input().split()))
l = [eval(input()) for i in range(h)]
ans = "Yes"
for i in range(1, h - 1):
for j in range(1, w - 1):
if l[i][j] == "#":
if l[i - 1][j] == l[i + 1][j] == l[i][j - 1] == l[i][j + 1] == ".":
ans = "No"
print(ans)
| h, w = list(map(int, input().split()))
l = ["." * (w + 2)] + ["." + eval(input()) + "." for i in range(h)] + ["." * (w + 2)]
ans = "Yes"
for i in range(1, h + 1):
for j in range(1, w + 1):
if l[i][j] == "#":
if l[i - 1][j] == l[i + 1][j] == l[i][j - 1] == l[i][j + 1] == ".":
ans ... | false | 0 | [
"-l = [eval(input()) for i in range(h)]",
"+l = [\".\" * (w + 2)] + [\".\" + eval(input()) + \".\" for i in range(h)] + [\".\" * (w + 2)]",
"-for i in range(1, h - 1):",
"- for j in range(1, w - 1):",
"+for i in range(1, h + 1):",
"+ for j in range(1, w + 1):"
] | false | 0.035173 | 0.042005 | 0.83735 | [
"s967258511",
"s996358479"
] |
u596276291 | p03803 | python | s251407468 | s927165657 | 107 | 27 | 3,700 | 3,316 | Accepted | Accepted | 74.77 | from collections import defaultdict
def main():
A, B = list(map(int, input().split()))
if A == 1:
A += 100
if B == 1:
B += 100
if A == B:
print("Draw")
elif A > B:
print("Alice")
else:
print("Bob")
if __name__ == '__main__':
m... | from collections import defaultdict
def main():
A, B = list(map(int, input().split()))
d = {1: 14}
if d.get(A, A) == d.get(B, B):
print("Draw")
elif d.get(A, A) > d.get(B, B):
print("Alice")
else:
print("Bob")
if __name__ == '__main__':
main()
| 21 | 17 | 320 | 307 | from collections import defaultdict
def main():
A, B = list(map(int, input().split()))
if A == 1:
A += 100
if B == 1:
B += 100
if A == B:
print("Draw")
elif A > B:
print("Alice")
else:
print("Bob")
if __name__ == "__main__":
main()
| from collections import defaultdict
def main():
A, B = list(map(int, input().split()))
d = {1: 14}
if d.get(A, A) == d.get(B, B):
print("Draw")
elif d.get(A, A) > d.get(B, B):
print("Alice")
else:
print("Bob")
if __name__ == "__main__":
main()
| false | 19.047619 | [
"- if A == 1:",
"- A += 100",
"- if B == 1:",
"- B += 100",
"- if A == B:",
"+ d = {1: 14}",
"+ if d.get(A, A) == d.get(B, B):",
"- elif A > B:",
"+ elif d.get(A, A) > d.get(B, B):"
] | false | 0.03772 | 0.037185 | 1.014393 | [
"s251407468",
"s927165657"
] |
u280667879 | p03078 | python | s415024025 | s291619247 | 193 | 151 | 38,044 | 35,560 | Accepted | Accepted | 21.76 | #!/usr/bin/python
import sys
import heapq
R=lambda:list(map(int,sys.stdin.readline().split()))
xa,xb,xc,k=R()
a=sorted(R())
b=sorted(R())
c=sorted(R())
h=set()
q=[[-(a[-1]+b[-1]+c[-1]),xa-1,xb-1,xc-1]]
for _ in range(k):
x,ya,yb,yc=heapq.heappop(q)
print((-x))
if ya>0 and (ya-1,yb,yc) not in h:
h.add... | import sys,heapq
R=lambda:list(map(int,sys.stdin.readline().split()))
x=list(R())
k=x.pop()
a=[sorted(R())for _ in range(3)]
h=set()
q=[[-sum(e[-1] for e in a)]+[e-1 for e in x]]
for _ in range(k):
y=heapq.heappop(q)
x=y.pop(0)
print((-x))
for i in range(3):
ny=list(y)
ny[i]-=1
if y[i] and tuple... | 22 | 17 | 596 | 400 | #!/usr/bin/python
import sys
import heapq
R = lambda: list(map(int, sys.stdin.readline().split()))
xa, xb, xc, k = R()
a = sorted(R())
b = sorted(R())
c = sorted(R())
h = set()
q = [[-(a[-1] + b[-1] + c[-1]), xa - 1, xb - 1, xc - 1]]
for _ in range(k):
x, ya, yb, yc = heapq.heappop(q)
print((-x))
if ya > 0... | import sys, heapq
R = lambda: list(map(int, sys.stdin.readline().split()))
x = list(R())
k = x.pop()
a = [sorted(R()) for _ in range(3)]
h = set()
q = [[-sum(e[-1] for e in a)] + [e - 1 for e in x]]
for _ in range(k):
y = heapq.heappop(q)
x = y.pop(0)
print((-x))
for i in range(3):
ny = list(y)... | false | 22.727273 | [
"-#!/usr/bin/python",
"-import sys",
"-import heapq",
"+import sys, heapq",
"-xa, xb, xc, k = R()",
"-a = sorted(R())",
"-b = sorted(R())",
"-c = sorted(R())",
"+x = list(R())",
"+k = x.pop()",
"+a = [sorted(R()) for _ in range(3)]",
"-q = [[-(a[-1] + b[-1] + c[-1]), xa - 1, xb - 1, xc - 1]]",... | false | 0.123144 | 0.044543 | 2.764599 | [
"s415024025",
"s291619247"
] |
u403234553 | p02694 | python | s836474897 | s261297326 | 22 | 20 | 9,160 | 9,156 | Accepted | Accepted | 9.09 | n = 0
m = 100
X = int(eval(input()))
while m < X:
m += (m // 100)
n += 1
print(n)
| X = int(eval(input()))
n = 0
x = 100
while x < X:
x += x // 100
n += 1
print(n) | 7 | 7 | 90 | 83 | n = 0
m = 100
X = int(eval(input()))
while m < X:
m += m // 100
n += 1
print(n)
| X = int(eval(input()))
n = 0
x = 100
while x < X:
x += x // 100
n += 1
print(n)
| false | 0 | [
"+X = int(eval(input()))",
"-m = 100",
"-X = int(eval(input()))",
"-while m < X:",
"- m += m // 100",
"+x = 100",
"+while x < X:",
"+ x += x // 100"
] | false | 0.04632 | 0.046459 | 0.996998 | [
"s836474897",
"s261297326"
] |
u334712262 | p02693 | python | s173979705 | s016030435 | 569 | 66 | 76,908 | 61,956 | Accepted | Accepted | 88.4 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
INF = 2**62-1
def read_int():
return int(eval(input()))
def read_int_n():
return list(map(int, input().split()))
def slv(K, A, B):
for i in range(INF):
if A <= i*K <= B:
return 'OK'
if i * K > B:
break
return 'NG'
... | 77 | 29 | 1,408 | 443 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
INF = 2**62 - 1
def read_int():
return int(eval(input()))
def read_int_n():
return list(map(int, input().split()))
def slv(K, A, B):
for i in range(INF):
if A <= i * K <= B:
return "OK"
if i * K > B:
break
return "NG"
def main():
... | false | 62.337662 | [
"-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_wit... | false | 0.074276 | 0.062292 | 1.192387 | [
"s173979705",
"s016030435"
] |
u644907318 | p03800 | python | s982316068 | s177438459 | 194 | 98 | 4,340 | 75,516 | Accepted | Accepted | 49.48 | def f(x,y,z):
if x=="S" and y=="o":
return z
if x=="S" and y=="x":
return g(z)
if x=="W" and y=="o":
return g(z)
if x=="W" and y=="x":
return z
def g(x):
if x=="S":
return "W"
if x=="W":
return "S"
def check(x,y):
t[0]=x
t[1... | N = int(eval(input()))
s = input().strip()
flag = 1
A = [0 for _ in range(N)]
for a in range(2):
for b in range(2):
A[0]=a
A[1]=b
for i in range(1,N-1):
if A[i]==0 and s[i]=="o":
A[i+1]=A[i-1]
elif A[i]==0 and s[i]=="x":
A[i... | 38 | 78 | 796 | 2,096 | def f(x, y, z):
if x == "S" and y == "o":
return z
if x == "S" and y == "x":
return g(z)
if x == "W" and y == "o":
return g(z)
if x == "W" and y == "x":
return z
def g(x):
if x == "S":
return "W"
if x == "W":
return "S"
def check(x, y):
t[0... | N = int(eval(input()))
s = input().strip()
flag = 1
A = [0 for _ in range(N)]
for a in range(2):
for b in range(2):
A[0] = a
A[1] = b
for i in range(1, N - 1):
if A[i] == 0 and s[i] == "o":
A[i + 1] = A[i - 1]
elif A[i] == 0 and s[i] == "x":
... | false | 51.282051 | [
"-def f(x, y, z):",
"- if x == \"S\" and y == \"o\":",
"- return z",
"- if x == \"S\" and y == \"x\":",
"- return g(z)",
"- if x == \"W\" and y == \"o\":",
"- return g(z)",
"- if x == \"W\" and y == \"x\":",
"- return z",
"-",
"-",
"-def g(x):",
"- ... | false | 0.047983 | 0.085164 | 0.563419 | [
"s982316068",
"s177438459"
] |
u481250941 | p02899 | python | s718469964 | s821353227 | 377 | 251 | 78,824 | 55,852 | Accepted | Accepted | 33.42 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
I = list(range(1, N+1))
dic = dict(list(zip(I, A)))
dic2 = sorted(list(dic.items()), key=lambda x: x[1])
ans = []
for i in dic2:
... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = [None] * N
for i in range(N):
ans[A[i]-1] = i+1
print((*ans))
if __name__ == '__main__':
main()
| 21 | 18 | 374 | 285 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
I = list(range(1, N + 1))
dic = dict(list(zip(I, A)))
dic2 = sorted(list(dic.items()), key=lambda x: x[1])
ans = []
for i in dic2:
ans.append(i[... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = [None] * N
for i in range(N):
ans[A[i] - 1] = i + 1
print((*ans))
if __name__ == "__main__":
main()
| false | 14.285714 | [
"- I = list(range(1, N + 1))",
"- dic = dict(list(zip(I, A)))",
"- dic2 = sorted(list(dic.items()), key=lambda x: x[1])",
"- ans = []",
"- for i in dic2:",
"- ans.append(i[0])",
"+ ans = [None] * N",
"+ for i in range(N):",
"+ ans[A[i] - 1] = i + 1"
] | false | 0.141936 | 0.100651 | 1.410183 | [
"s718469964",
"s821353227"
] |
u671060652 | p02771 | python | s656899047 | s475745632 | 274 | 181 | 64,876 | 38,384 | Accepted | Accepted | 33.94 | import itertools
import math
import fractions
import functools
a, b, c = list(map(int, input().split()))
if (a == b and a != c) or (b == c and b != a) or (a == c and a != b):
print("Yes")
else: print("No") | a, b, c = list(map(int, input().split()))
if (a == b or a == c or b ==c) and not (a == b and a == c):
print("Yes")
else:print("No") | 8 | 4 | 210 | 132 | import itertools
import math
import fractions
import functools
a, b, c = list(map(int, input().split()))
if (a == b and a != c) or (b == c and b != a) or (a == c and a != b):
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if (a == b or a == c or b == c) and not (a == b and a == c):
print("Yes")
else:
print("No")
| false | 50 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-",
"-if (a == b and a != c) or (b == c and b != a) or (a == c and a != b):",
"+if (a == b or a == c or b == c) and not (a == b and a == c):"
] | false | 0.04122 | 0.041876 | 0.984353 | [
"s656899047",
"s475745632"
] |
u607865971 | p03475 | python | s833039056 | s675589790 | 115 | 75 | 3,188 | 3,188 | Accepted | Accepted | 34.78 | import sys
import math
N = int(eval(input()))
C = []
S = []
F = []
for i in range(N - 1):
c, s, f = [int(x) for x in input().split()]
C.append(c)
S.append(s)
F.append(f)
def f(idx, t):
depT = -1
if t <= S[idx]:
depT = S[idx]
else:
depT = S[idx] + F[idx... | #!/usr/bin/python3
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
MOD = 10 ** 9 + 7
#N = int(input())
#A = [int(x) for x in input().split()]
#V = [[0] * 100 for _ in range(100)]
N = int(eval(input()))
CSF = []
for _ in range(N-1):
C, S, F = [int(x) for x in input().split()]
... | 31 | 33 | 494 | 689 | import sys
import math
N = int(eval(input()))
C = []
S = []
F = []
for i in range(N - 1):
c, s, f = [int(x) for x in input().split()]
C.append(c)
S.append(s)
F.append(f)
def f(idx, t):
depT = -1
if t <= S[idx]:
depT = S[idx]
else:
depT = S[idx] + F[idx] * math.ceil((t - S[... | #!/usr/bin/python3
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
MOD = 10**9 + 7
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
N = int(eval(input()))
CSF = []
for _ in range(N - 1):
C, S, F = [int(x) for x in input().split()]
CSF.append... | false | 6.060606 | [
"+#!/usr/bin/python3",
"-import math",
"+# input = sys.stdin.readline",
"+sys.setrecursionlimit(100000)",
"+MOD = 10**9 + 7",
"+# N = int(input())",
"+# A = [int(x) for x in input().split()]",
"+# V = [[0] * 100 for _ in range(100)]",
"-C = []",
"-S = []",
"-F = []",
"-for i in range(N - 1):",... | false | 0.036989 | 0.044092 | 0.838914 | [
"s833039056",
"s675589790"
] |
u642874916 | p03127 | python | s751074580 | s868423952 | 351 | 243 | 88,428 | 63,084 | Accepted | Accepted | 30.77 | import fractions
# N個の最大公約数
# ユークリッド互除法
def good(A, N):
# A = sorted(A)
ans = A[0]
for i in range(1, N):
ans = fractions.gcd(A[i], ans)
print(ans)
def my(A, N):
A = sorted(A)
while True:
v = A[0]
tmp = [v]
for i in range(len(A)):
... | # N個の最大公約数
# ユークリッド互除法
# Check
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a*b // gcd(a, b)
def good(A, N):
# A = sorted(A)
ans = A[0]
# for i in range(1, N):
# ans = fractions.gcd(A[i], ans)
for i in range(1, N):
... | 46 | 126 | 764 | 2,208 | import fractions
# N個の最大公約数
# ユークリッド互除法
def good(A, N):
# A = sorted(A)
ans = A[0]
for i in range(1, N):
ans = fractions.gcd(A[i], ans)
print(ans)
def my(A, N):
A = sorted(A)
while True:
v = A[0]
tmp = [v]
for i in range(len(A)):
if A[i] % v == 1:
... | # N個の最大公約数
# ユークリッド互除法
# Check
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(a, b)
def good(A, N):
# A = sorted(A)
ans = A[0]
# for i in range(1, N):
# ans = fractions.gcd(A[i], ans)
for i in range(1, N):
ans = lcm(ans,... | false | 63.492063 | [
"-import fractions",
"-",
"+# Check",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"+",
"+",
"+def lcm(a, b):",
"+ return a * b // gcd(a, b)",
"+",
"+",
"+ # for i in range(1, N):",
"+ # ans = fractions.gcd(A[i], ans)",
"- ... | false | 0.040781 | 0.037377 | 1.091073 | [
"s751074580",
"s868423952"
] |
u753803401 | p02886 | python | s954943566 | s382788179 | 175 | 161 | 38,512 | 38,512 | Accepted | Accepted | 8 | import sys
import itertools
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input().rstrip('\n'))
d = list(map(int, input().rstrip('\n').split()))
t = 0
for v in itertools.combinations(d, 2):
t += (v[0] * v[1])
print(t)
if __name__ == '__main__':
... | import sys
import itertools
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
t = 0
for v in itertools.combinations(a, 2):
t += v[0] * v[1]
print(t)
if __name__ == '__main__':
solve()... | 17 | 17 | 333 | 321 | import sys
import itertools
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input().rstrip("\n"))
d = list(map(int, input().rstrip("\n").split()))
t = 0
for v in itertools.combinations(d, 2):
t += v[0] * v[1]
print(t)
if __name__ == "__main__":
solve()
| import sys
import itertools
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = list(map(int, readline().split()))
t = 0
for v in itertools.combinations(a, 2):
t += v[0] * v[1]
print(t)
if __name__ == "__main__":
solve()
| false | 0 | [
"- input = sys.stdin.readline",
"+ readline = sys.stdin.buffer.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- d = list(map(int, input().rstrip(\"\\n\").split()))",
"+ n = int(readline())",
"+ a = list(map(int, readline().split()))",
"- for v in itertools.combinations(d, 2):",
... | false | 0.065091 | 0.040571 | 1.604375 | [
"s954943566",
"s382788179"
] |
u836939578 | p02787 | python | s626037892 | s946808487 | 451 | 415 | 41,836 | 41,708 | Accepted | Accepted | 7.98 | H, N = list(map(int, input().split()))
A, B = [0] * N, [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
dp = [[10**9]*(H+1)]*(N+1)
dp[0][0] = 0
for i in range(N):
for j in range(H+1):
nj = min(j+A[i], H)
dp[i+1][nj] = min(dp[i][nj], dp[i+1][j] + B[i])
... | H, N = list(map(int, input().split()))
A, B = [0] * N, [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
dp = [10**9] * (H+1)
dp[0] = 0
for i in range(N):
for j in range(H+1):
nj = min(j+A[i], H)
dp[nj] = min(dp[nj], dp[j]+B[i])
print((dp[H])) | 17 | 15 | 324 | 293 | H, N = list(map(int, input().split()))
A, B = [0] * N, [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
dp = [[10**9] * (H + 1)] * (N + 1)
dp[0][0] = 0
for i in range(N):
for j in range(H + 1):
nj = min(j + A[i], H)
dp[i + 1][nj] = min(dp[i][nj], dp[i + 1][j] + B[i])
print... | H, N = list(map(int, input().split()))
A, B = [0] * N, [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
dp = [10**9] * (H + 1)
dp[0] = 0
for i in range(N):
for j in range(H + 1):
nj = min(j + A[i], H)
dp[nj] = min(dp[nj], dp[j] + B[i])
print((dp[H]))
| false | 11.764706 | [
"-dp = [[10**9] * (H + 1)] * (N + 1)",
"-dp[0][0] = 0",
"+dp = [10**9] * (H + 1)",
"+dp[0] = 0",
"- dp[i + 1][nj] = min(dp[i][nj], dp[i + 1][j] + B[i])",
"-print((dp[N][H]))",
"+ dp[nj] = min(dp[nj], dp[j] + B[i])",
"+print((dp[H]))"
] | false | 0.103171 | 0.272204 | 0.37902 | [
"s626037892",
"s946808487"
] |
u352394527 | p00429 | python | s208043471 | s836560120 | 140 | 100 | 7,568 | 7,580 | Accepted | Accepted | 28.57 | while True:
n = int(eval(input()))
if not n:
break
ss = [s for s in input()[::-1]]
for i in range(n):
new = []
app = new.append
last = ss.pop()
count = 1
while ss:
a = ss.pop()
if a == last:
count += 1
else:
app(str(count))
app(la... | def main():
while True:
n = int(eval(input()))
if not n:
break
ss = [s for s in input()[::-1]]
for i in range(n):
new = []
app = new.append
last = ss.pop()
count = 1
while ss:
a = ss.pop()
if a == last:
count += 1
els... | 25 | 28 | 497 | 570 | while True:
n = int(eval(input()))
if not n:
break
ss = [s for s in input()[::-1]]
for i in range(n):
new = []
app = new.append
last = ss.pop()
count = 1
while ss:
a = ss.pop()
if a == last:
count += 1
el... | def main():
while True:
n = int(eval(input()))
if not n:
break
ss = [s for s in input()[::-1]]
for i in range(n):
new = []
app = new.append
last = ss.pop()
count = 1
while ss:
a = ss.pop()
... | false | 10.714286 | [
"-while True:",
"- n = int(eval(input()))",
"- if not n:",
"- break",
"- ss = [s for s in input()[::-1]]",
"- for i in range(n):",
"- new = []",
"- app = new.append",
"- last = ss.pop()",
"- count = 1",
"- while ss:",
"- a = ss.p... | false | 0.042765 | 0.035748 | 1.196268 | [
"s208043471",
"s836560120"
] |
u204800924 | p02659 | python | s408471597 | s480310999 | 33 | 24 | 10,056 | 9,044 | Accepted | Accepted | 27.27 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print((int(a*b))) | a, b = input().split()
a = int(a)
b = int(b.replace('.', ''))
ans = a * b // 100
print(ans) | 8 | 7 | 106 | 101 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print((int(a * b)))
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
ans = a * b // 100
print(ans)
| false | 12.5 | [
"-from decimal import Decimal",
"-",
"-a = Decimal(a)",
"-b = Decimal(b)",
"-print((int(a * b)))",
"+a = int(a)",
"+b = int(b.replace(\".\", \"\"))",
"+ans = a * b // 100",
"+print(ans)"
] | false | 0.035836 | 0.043733 | 0.819418 | [
"s408471597",
"s480310999"
] |
u906501980 | p02901 | python | s271882452 | s521605171 | 883 | 767 | 3,188 | 3,188 | Accepted | Accepted | 13.14 | def main():
n, m = list(map(int, input().split()))
p = 2**n
inf = float('inf')
dp = [inf]*p
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2**(int(i)-1) for i in input().split()])
for s in range(p):
t = s|c
... | def main():
n, m = list(map(int, input().split()))
p = 2**n
inf = 10**7
dp = [inf]*p
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([1<<(int(i)-1) for i in input().split()])
for s in range(p):
t = s|c
... | 20 | 21 | 490 | 504 | def main():
n, m = list(map(int, input().split()))
p = 2**n
inf = float("inf")
dp = [inf] * p
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2 ** (int(i) - 1) for i in input().split()])
for s in range(p):
t = s | c
if ... | def main():
n, m = list(map(int, input().split()))
p = 2**n
inf = 10**7
dp = [inf] * p
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([1 << (int(i) - 1) for i in input().split()])
for s in range(p):
t = s | c
new = dp[s... | false | 4.761905 | [
"- inf = float(\"inf\")",
"+ inf = 10**7",
"- c = sum([2 ** (int(i) - 1) for i in input().split()])",
"+ c = sum([1 << (int(i) - 1) for i in input().split()])",
"- if dp[t] > dp[s] + a:",
"- dp[t] = dp[s] + a",
"+ new = dp[s] + a",
"+ ... | false | 0.059583 | 0.039552 | 1.506442 | [
"s271882452",
"s521605171"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.