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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u717993780 | p03338 | python | s692182834 | s026144143 | 159 | 18 | 12,504 | 3,060 | Accepted | Accepted | 88.68 | import numpy as np
n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(1,n):
tmp = 0
for a in set(list(s[:i])):
tmp += max(np.sign(s[i:].find(a)+0.5),0)
cnt = max(cnt,tmp)
print((int(cnt))) | n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(n):
tmp = len(set(s[:i]).intersection(s[i:]))
cnt = max(tmp,cnt)
print(cnt) | 11 | 8 | 208 | 139 | import numpy as np
n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(1, n):
tmp = 0
for a in set(list(s[:i])):
tmp += max(np.sign(s[i:].find(a) + 0.5), 0)
cnt = max(cnt, tmp)
print((int(cnt)))
| n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(n):
tmp = len(set(s[:i]).intersection(s[i:]))
cnt = max(tmp, cnt)
print(cnt)
| false | 27.272727 | [
"-import numpy as np",
"-",
"-for i in range(1, n):",
"- tmp = 0",
"- for a in set(list(s[:i])):",
"- tmp += max(np.sign(s[i:].find(a) + 0.5), 0)",
"- cnt = max(cnt, tmp)",
"-print((int(cnt)))",
"+for i in range(n):",
"+ tmp = len(set(s[:i]).intersection(s[i:]))",
"+ cnt = ... | false | 0.169437 | 0.036402 | 4.654597 | [
"s692182834",
"s026144143"
] |
u145950990 | p03043 | python | s372110778 | s114926962 | 180 | 28 | 38,768 | 9,344 | Accepted | Accepted | 84.44 | n,k = list(map(int,input().split()))
import math
ans = 0
for i in range(1,n+1):
if i<k:
p = math.ceil(math.log(k/i)/math.log(2))
ans += (1/2)**p
else:
ans += 1
print((ans/n))
| n,k = list(map(int,input().split()))
import math
ans = 0
for i in range(1,n+1):
if i>=k:
ans += n-i+1
break
x = math.ceil(math.log(k/i,2))
ans += (1/2)**x
print((ans/n)) | 10 | 10 | 208 | 198 | n, k = list(map(int, input().split()))
import math
ans = 0
for i in range(1, n + 1):
if i < k:
p = math.ceil(math.log(k / i) / math.log(2))
ans += (1 / 2) ** p
else:
ans += 1
print((ans / n))
| n, k = list(map(int, input().split()))
import math
ans = 0
for i in range(1, n + 1):
if i >= k:
ans += n - i + 1
break
x = math.ceil(math.log(k / i, 2))
ans += (1 / 2) ** x
print((ans / n))
| false | 0 | [
"- if i < k:",
"- p = math.ceil(math.log(k / i) / math.log(2))",
"- ans += (1 / 2) ** p",
"- else:",
"- ans += 1",
"+ if i >= k:",
"+ ans += n - i + 1",
"+ break",
"+ x = math.ceil(math.log(k / i, 2))",
"+ ans += (1 / 2) ** x"
] | false | 0.069178 | 0.035951 | 1.924237 | [
"s372110778",
"s114926962"
] |
u596368396 | p02854 | python | s897099238 | s504306539 | 304 | 278 | 101,072 | 100,300 | Accepted | Accepted | 8.55 | N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
B = [0]
for i in range(N):
B.append(B[i] + A[i])
ans = float('inf')
for i in range(1, N):
ans = min(ans, abs(s-(2*B[i])))
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
B = [0]
for i in range(N):
B.append(B[i] + A[i])
ans = float('inf')
for i in range(1, N):
_ans = ans
ans = min(ans, abs(B[i] - (s - B[i])))
if ans > _ans:
break
print(ans)
| 13 | 16 | 220 | 278 | N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
B = [0]
for i in range(N):
B.append(B[i] + A[i])
ans = float("inf")
for i in range(1, N):
ans = min(ans, abs(s - (2 * B[i])))
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
B = [0]
for i in range(N):
B.append(B[i] + A[i])
ans = float("inf")
for i in range(1, N):
_ans = ans
ans = min(ans, abs(B[i] - (s - B[i])))
if ans > _ans:
break
print(ans)
| false | 18.75 | [
"- ans = min(ans, abs(s - (2 * B[i])))",
"+ _ans = ans",
"+ ans = min(ans, abs(B[i] - (s - B[i])))",
"+ if ans > _ans:",
"+ break"
] | false | 0.034246 | 0.033891 | 1.010477 | [
"s897099238",
"s504306539"
] |
u383713431 | p03044 | python | s738333007 | s848594458 | 555 | 498 | 52,684 | 84,512 | Accepted | Accepted | 10.27 | from collections import deque
N = int(eval(input()))
dist = {}
graph = [[] for i in range(N)]
for i in range(1, N):
u, v, w = list(map(int, input().split()))
graph[u-1].append(v-1)
graph[v-1].append(u-1)
dist[(u-1, v-1)] = w
q = deque()
q.append(0)
color = [-1] * N
color[0] = 0
... | import sys
sys.setrecursionlimit(10**8)
N = int(eval(input()))
graph = [[] for _ in range(N)]
for i in range(1, N):
u, v, w = list(map(int, input().split()))
graph[u-1].append((v-1, w))
graph[v-1].append((u-1, w))
color = [0 for _ in range(N)]
visited = [False for _ in range(N)]
def dfs(now)... | 34 | 34 | 644 | 684 | from collections import deque
N = int(eval(input()))
dist = {}
graph = [[] for i in range(N)]
for i in range(1, N):
u, v, w = list(map(int, input().split()))
graph[u - 1].append(v - 1)
graph[v - 1].append(u - 1)
dist[(u - 1, v - 1)] = w
q = deque()
q.append(0)
color = [-1] * N
color[0] = 0
while q:
... | import sys
sys.setrecursionlimit(10**8)
N = int(eval(input()))
graph = [[] for _ in range(N)]
for i in range(1, N):
u, v, w = list(map(int, input().split()))
graph[u - 1].append((v - 1, w))
graph[v - 1].append((u - 1, w))
color = [0 for _ in range(N)]
visited = [False for _ in range(N)]
def dfs(now):
... | false | 0 | [
"-from collections import deque",
"+import sys",
"+sys.setrecursionlimit(10**8)",
"-dist = {}",
"-graph = [[] for i in range(N)]",
"+graph = [[] for _ in range(N)]",
"- graph[u - 1].append(v - 1)",
"- graph[v - 1].append(u - 1)",
"- dist[(u - 1, v - 1)] = w",
"-q = deque()",
"-q.append(... | false | 0.036642 | 0.034932 | 1.048944 | [
"s738333007",
"s848594458"
] |
u855710796 | p02900 | python | s937113917 | s769794861 | 201 | 140 | 38,512 | 5,176 | Accepted | Accepted | 30.35 | A, B = list(map(int, input().split()))
def prime_decompose(x):
decomposed = []
for i in range(2,int(pow(x,0.5))+1):
while x % i == 0:
x //= i
decomposed.append(i)
if x > 1:
decomposed.append(x)
return decomposed
A_dec = set(prime_decompose(A))
B_dec... | import fractions
A, B = list(map(int, input().split()))
g = fractions.gcd(A, B)
def prime_decompose(x):
decomposed = []
for i in range(2,int(pow(x,0.5))+1):
while x % i == 0:
x //= i
decomposed.append(i)
if x > 1:
decomposed.append(x)
return decom... | 21 | 18 | 421 | 375 | A, B = list(map(int, input().split()))
def prime_decompose(x):
decomposed = []
for i in range(2, int(pow(x, 0.5)) + 1):
while x % i == 0:
x //= i
decomposed.append(i)
if x > 1:
decomposed.append(x)
return decomposed
A_dec = set(prime_decompose(A))
B_dec = set(... | import fractions
A, B = list(map(int, input().split()))
g = fractions.gcd(A, B)
def prime_decompose(x):
decomposed = []
for i in range(2, int(pow(x, 0.5)) + 1):
while x % i == 0:
x //= i
decomposed.append(i)
if x > 1:
decomposed.append(x)
return decomposed
g_... | false | 14.285714 | [
"+import fractions",
"+",
"+g = fractions.gcd(A, B)",
"-A_dec = set(prime_decompose(A))",
"-B_dec = set(prime_decompose(B))",
"-ans = 1",
"-for a in A_dec:",
"- if a in B_dec:",
"- ans += 1",
"-print(ans)",
"+g_dec = set(prime_decompose(g))",
"+print((len(g_dec) + 1))"
] | false | 0.086601 | 0.11099 | 0.78026 | [
"s937113917",
"s769794861"
] |
u643679148 | p02713 | python | s133207253 | s102562170 | 1,278 | 1,124 | 9,024 | 9,056 | Accepted | Accepted | 12.05 |
import math
rst = 0
K = int(eval(input()))
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = math.gcd(i, j)
for k in range(1, K + 1):
rst += math.gcd(k, tmp)
print(rst)
|
from math import gcd as g
k = int(eval(input()))
ans = 0
for a in range(1, k+1):
for b in range(1, k+1):
temp = g(a, b)
for c in range(1, k+1):
ans += g(temp, c)
print(ans)
| 11 | 15 | 215 | 219 | import math
rst = 0
K = int(eval(input()))
for i in range(1, K + 1):
for j in range(1, K + 1):
tmp = math.gcd(i, j)
for k in range(1, K + 1):
rst += math.gcd(k, tmp)
print(rst)
| from math import gcd as g
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
temp = g(a, b)
for c in range(1, k + 1):
ans += g(temp, c)
print(ans)
| false | 26.666667 | [
"-import math",
"+from math import gcd as g",
"-rst = 0",
"-K = int(eval(input()))",
"-for i in range(1, K + 1):",
"- for j in range(1, K + 1):",
"- tmp = math.gcd(i, j)",
"- for k in range(1, K + 1):",
"- rst += math.gcd(k, tmp)",
"-print(rst)",
"+k = int(eval(input(... | false | 0.049393 | 0.049613 | 0.99558 | [
"s133207253",
"s102562170"
] |
u836737505 | p03408 | python | s127893533 | s387343935 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | from collections import Counter
n =int(eval(input()))
a = [eval(input()) for i in range(n)]
m =int(eval(input()))
b = [eval(input()) for i in range(m)]
c = Counter(a)
d = Counter(b)
e = -100000
for i,j in c.most_common():
e = max(j-d[i],e)
print((max(e,0))) | n =int(eval(input()))
a = [eval(input()) for i in range(n)]
m =int(eval(input()))
b = [eval(input()) for i in range(m)]
l = set(a)
e = -100000
for i in l:
e = max(e,a.count(i)-b.count(i))
print((max(e,0))) | 11 | 9 | 245 | 191 | from collections import Counter
n = int(eval(input()))
a = [eval(input()) for i in range(n)]
m = int(eval(input()))
b = [eval(input()) for i in range(m)]
c = Counter(a)
d = Counter(b)
e = -100000
for i, j in c.most_common():
e = max(j - d[i], e)
print((max(e, 0)))
| n = int(eval(input()))
a = [eval(input()) for i in range(n)]
m = int(eval(input()))
b = [eval(input()) for i in range(m)]
l = set(a)
e = -100000
for i in l:
e = max(e, a.count(i) - b.count(i))
print((max(e, 0)))
| false | 18.181818 | [
"-from collections import Counter",
"-",
"-c = Counter(a)",
"-d = Counter(b)",
"+l = set(a)",
"-for i, j in c.most_common():",
"- e = max(j - d[i], e)",
"+for i in l:",
"+ e = max(e, a.count(i) - b.count(i))"
] | false | 0.044138 | 0.10147 | 0.434981 | [
"s127893533",
"s387343935"
] |
u583507988 | p03433 | python | s968498083 | s966881371 | 32 | 25 | 9,064 | 9,048 | Accepted | Accepted | 21.88 | n = int(eval(input()))
a = int(eval(input()))
res = n%500
if res <= a:
print('Yes')
else:
print('No') | n = int(eval(input()))
a = int(eval(input()))
n -= (n//500)*500
if n<=a:
print('Yes')
else:
print('No') | 8 | 8 | 101 | 103 | n = int(eval(input()))
a = int(eval(input()))
res = n % 500
if res <= a:
print("Yes")
else:
print("No")
| n = int(eval(input()))
a = int(eval(input()))
n -= (n // 500) * 500
if n <= a:
print("Yes")
else:
print("No")
| false | 0 | [
"-res = n % 500",
"-if res <= a:",
"+n -= (n // 500) * 500",
"+if n <= a:"
] | false | 0.047991 | 0.043953 | 1.091863 | [
"s968498083",
"s966881371"
] |
u830054172 | p03163 | python | s097439435 | s700041371 | 309 | 227 | 41,452 | 91,924 | Accepted | Accepted | 26.54 | N, W = list(map(int, input().split()))
dp = [-1]*(W+1)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(W-w, -1, -1):
if dp[i] == -1:
continue
if dp[i+w] < dp[i] + v:
dp[i+w] = dp[i] + v
print((max(dp))) | import numpy as np
n, W = list(map(int, input().split()))
dp = np.zeros((n,W+1), dtype='int64')
for i in range(n):
w, v = list(map(int , input().split()))
# print("left", dp[i, :w])
# print("right", dp[i-1, :w])
dp[i, :w] = dp[i-1, :w]
dp[i, w:] = np.fmax(dp[i-1, w:], dp[i-1,:W-w+1]+v)
... | 11 | 14 | 281 | 348 | N, W = list(map(int, input().split()))
dp = [-1] * (W + 1)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(W - w, -1, -1):
if dp[i] == -1:
continue
if dp[i + w] < dp[i] + v:
dp[i + w] = dp[i] + v
print((max(dp)))
| import numpy as np
n, W = list(map(int, input().split()))
dp = np.zeros((n, W + 1), dtype="int64")
for i in range(n):
w, v = list(map(int, input().split()))
# print("left", dp[i, :w])
# print("right", dp[i-1, :w])
dp[i, :w] = dp[i - 1, :w]
dp[i, w:] = np.fmax(dp[i - 1, w:], dp[i - 1, : W - w + 1] +... | false | 21.428571 | [
"-N, W = list(map(int, input().split()))",
"-dp = [-1] * (W + 1)",
"-dp[0] = 0",
"-for _ in range(N):",
"+import numpy as np",
"+",
"+n, W = list(map(int, input().split()))",
"+dp = np.zeros((n, W + 1), dtype=\"int64\")",
"+for i in range(n):",
"- for i in range(W - w, -1, -1):",
"- if... | false | 0.040141 | 0.176722 | 0.227141 | [
"s097439435",
"s700041371"
] |
u046158516 | p02586 | python | s654179988 | s771759901 | 840 | 667 | 439,788 | 431,148 | Accepted | Accepted | 20.6 | import os,io
import sys
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
r,c,k=list(map(int,input().split()))
dp = [0]*(r*c*4)
m=[]
for i in range(r):
m.append([])
for j in range(c):
m[i].append(0)
for i in range(k):
ri,ci,v=list(map(int,input().split()))
m[ri-1][ci-1]=v
dp[0*r*c+0*c+0... | import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
r,c,k=list(map(int,input().split()))
dp = [0]*(r*c*4)
m=[0]*(r*c)
for i in range(k):
ri,ci,v=list(map(int,input().split()))
m[(ri-1)*c+ci-1]=v
dp[0*r*c+0*c+0]=0
dp[1*r*c+0*c+0]=m[0]
dp[2*r*c+0*c+0]=m[0]
dp[3*r*c+0*c+0]=m[0]
for i in ... | 31 | 28 | 1,045 | 923 | import os, io
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
r, c, k = list(map(int, input().split()))
dp = [0] * (r * c * 4)
m = []
for i in range(r):
m.append([])
for j in range(c):
m[i].append(0)
for i in range(k):
ri, ci, v = list(map(int, input().split()))
m[ri - 1... | import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
r, c, k = list(map(int, input().split()))
dp = [0] * (r * c * 4)
m = [0] * (r * c)
for i in range(k):
ri, ci, v = list(map(int, input().split()))
m[(ri - 1) * c + ci - 1] = v
dp[0 * r * c + 0 * c + 0] = 0
dp[1 * r * c + 0 * c + 0] = m[0... | false | 9.677419 | [
"-import sys",
"-m = []",
"-for i in range(r):",
"- m.append([])",
"- for j in range(c):",
"- m[i].append(0)",
"+m = [0] * (r * c)",
"- m[ri - 1][ci - 1] = v",
"+ m[(ri - 1) * c + ci - 1] = v",
"-dp[1 * r * c + 0 * c + 0] = m[0][0]",
"-dp[2 * r * c + 0 * c + 0] = m[0][0]",
"... | false | 0.036865 | 0.041944 | 0.878924 | [
"s654179988",
"s771759901"
] |
u029473859 | p02388 | python | s209423322 | s126569580 | 20 | 10 | 7,608 | 6,336 | Accepted | Accepted | 50 | x = eval(input())
x_int = int(x)
y = x_int ** 3
print(y) | x = eval(input())
y = x ** 3
print(y) | 4 | 3 | 53 | 33 | x = eval(input())
x_int = int(x)
y = x_int**3
print(y)
| x = eval(input())
y = x**3
print(y)
| false | 25 | [
"-x_int = int(x)",
"-y = x_int**3",
"+y = x**3"
] | false | 0.036722 | 0.039584 | 0.927709 | [
"s209423322",
"s126569580"
] |
u708255304 | p02947 | python | s395127048 | s265366112 | 481 | 362 | 22,336 | 30,992 | Accepted | Accepted | 24.74 | wa = [0, 0, 1]
for i in range(2, 100005):
wa.append(wa[-1]+i)
# print(wa)
# exit()
N = int(eval(input()))
# data = set()
data = {}
ans = 0
for i in range(N):
s_list = list(str(eval(input())))
s_list = sorted(s_list)
hoge = "".join(s_list)
data.setdefault(hoge, 0)
data[hoge]... | def dns(n):
fact = [0, 0, 1]
for i in range(2, n+1):
fact.append(fact[-1]+i)
return fact
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
hoge = dns(100008)
anagram_dict = {}
new_S = []
for s in S:
tmp = "".join(sorted(list(s)))
new_S.append(tmp)
for s ... | 24 | 29 | 373 | 457 | wa = [0, 0, 1]
for i in range(2, 100005):
wa.append(wa[-1] + i)
# print(wa)
# exit()
N = int(eval(input()))
# data = set()
data = {}
ans = 0
for i in range(N):
s_list = list(str(eval(input())))
s_list = sorted(s_list)
hoge = "".join(s_list)
data.setdefault(hoge, 0)
data[hoge] += 1
for v in list(... | def dns(n):
fact = [0, 0, 1]
for i in range(2, n + 1):
fact.append(fact[-1] + i)
return fact
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
hoge = dns(100008)
anagram_dict = {}
new_S = []
for s in S:
tmp = "".join(sorted(list(s)))
new_S.append(tmp)
for s in new_S:
anagram... | false | 17.241379 | [
"-wa = [0, 0, 1]",
"-for i in range(2, 100005):",
"- wa.append(wa[-1] + i)",
"-# print(wa)",
"-# exit()",
"+def dns(n):",
"+ fact = [0, 0, 1]",
"+ for i in range(2, n + 1):",
"+ fact.append(fact[-1] + i)",
"+ return fact",
"+",
"+",
"-# data = set()",
"-data = {}",
"+S... | false | 0.07691 | 0.042584 | 1.80609 | [
"s395127048",
"s265366112"
] |
u714642969 | p03283 | python | s187143754 | s789951992 | 1,061 | 563 | 57,564 | 58,332 | Accepted | Accepted | 46.94 | 6# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()
def main():
N,M,Q=list(map(int,input().split()))
x=[[0]*N for _ in range(N)]
for i in range(M):
L,R=[int(x)-1 for x in input().split()]
x[L][... | 6# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()
def main():
N,M,Q=list(map(int,input().split()))
x=[[0]*N for _ in range(N)]
for i in range(M):
L,R=[int(x)-1 for x in input().split()]
x[L][... | 26 | 23 | 674 | 651 | 6 # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
def input():
return sys.stdin.readline().rstrip()
def main():
N, M, Q = list(map(int, input().split()))
x = [[0] * N for _ in range(N)]
for i in range(M):
L, R = [int(x) - 1 for x in input().spli... | 6 # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
def input():
return sys.stdin.readline().rstrip()
def main():
N, M, Q = list(map(int, input().split()))
x = [[0] * N for _ in range(N)]
for i in range(M):
L, R = [int(x) - 1 for x in input().spli... | false | 11.538462 | [
"- S = [[0] * (N + 1) for _ in range(N)]",
"+ S = [[0] * (N + 1) for _ in range(N + 1)]",
"- S[i][j + 1] = S[i][j] + x[i][j]",
"+ S[i + 1][j + 1] = S[i + 1][j] + S[i][j + 1] - S[i][j] + x[i][j]",
"- ans = 0",
"- for i in range(p, q + 1):",
"- ans += S... | false | 0.037775 | 0.037958 | 0.995186 | [
"s187143754",
"s789951992"
] |
u816631826 | p03796 | python | s943126374 | s221920898 | 231 | 43 | 4,100 | 2,940 | Accepted | Accepted | 81.39 | import math
n = int(eval(input()))
print((math.factorial(n)%(10**(9) + 7))) | mod = 10**9+7
ans = 1
for i in range(int(eval(input()))):
ans *= i+1
ans %= mod
print(ans) | 5 | 6 | 73 | 97 | import math
n = int(eval(input()))
print((math.factorial(n) % (10 ** (9) + 7)))
| mod = 10**9 + 7
ans = 1
for i in range(int(eval(input()))):
ans *= i + 1
ans %= mod
print(ans)
| false | 16.666667 | [
"-import math",
"-",
"-n = int(eval(input()))",
"-print((math.factorial(n) % (10 ** (9) + 7)))",
"+mod = 10**9 + 7",
"+ans = 1",
"+for i in range(int(eval(input()))):",
"+ ans *= i + 1",
"+ ans %= mod",
"+print(ans)"
] | false | 0.116987 | 0.051859 | 2.255843 | [
"s943126374",
"s221920898"
] |
u684120680 | p03436 | python | s539387974 | s813892700 | 1,953 | 26 | 5,104 | 3,192 | Accepted | Accepted | 98.67 | import sys
h,w = [int(i) for i in input().split()]
sys.setrecursionlimit(100000)
s = [['#']*(w+2)] + [['#']+list(eval(input()))+['#'] for _ in range(h)] + [['#']*(w+2)]
#print(s)
cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)]
cost[1][1] = 0
#print(cost)
def l... | import sys
h,w = [int(i) for i in input().split()]
sys.setrecursionlimit(100000)
s = [['#']*(w+2)] + [['#']+list(eval(input()))+['#'] for _ in range(h)] + [['#']*(w+2)]
#print(s)
cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)]
cost[1][1] = 0
#print(cost)
move_... | 57 | 61 | 1,240 | 1,400 | import sys
h, w = [int(i) for i in input().split()]
sys.setrecursionlimit(100000)
s = (
[["#"] * (w + 2)]
+ [["#"] + list(eval(input())) + ["#"] for _ in range(h)]
+ [["#"] * (w + 2)]
)
# print(s)
cost = [
[-1 if s[y][x] == "#" else float("inf") for x in range(w + 2)] for y in range(h + 2)
]
cost[1][1]... | import sys
h, w = [int(i) for i in input().split()]
sys.setrecursionlimit(100000)
s = (
[["#"] * (w + 2)]
+ [["#"] + list(eval(input())) + ["#"] for _ in range(h)]
+ [["#"] * (w + 2)]
)
# print(s)
cost = [
[-1 if s[y][x] == "#" else float("inf") for x in range(w + 2)] for y in range(h + 2)
]
cost[1][1]... | false | 6.557377 | [
"+move_que = [[1, 1]]",
"+",
"+",
"-def move(y, x):",
"+def move(place):",
"+ y, x = place",
"- move(y + 1, x)",
"+ move_que.append([y + 1, x])",
"- move(y - 1, x)",
"+ move_que.append([y - 1, x])",
"- move(y, x + 1)",
"+ mov... | false | 0.061233 | 0.069744 | 0.877973 | [
"s539387974",
"s813892700"
] |
u562935282 | p03038 | python | s579349204 | s682863717 | 476 | 278 | 42,656 | 46,216 | Accepted | Accepted | 41.6 | def main():
from collections import Counter
from operator import itemgetter
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
ctr = Counter(a)
for _ in range(M):
b, c = list(map(int, input().split()))
... | def main():
from collections import defaultdict
from operator import itemgetter
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ctr = defaultdict(int)
for x in A:
ctr[x] += 1
for _ in range(M):
... | 37 | 33 | 760 | 780 | def main():
from collections import Counter
from operator import itemgetter
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
ctr = Counter(a)
for _ in range(M):
b, c = list(map(int, input().split()))
ctr[c] ... | def main():
from collections import defaultdict
from operator import itemgetter
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ctr = defaultdict(int)
for x in A:
ctr[x] += 1
for _ in range(M):
num_of_c... | false | 10.810811 | [
"- from collections import Counter",
"+ from collections import defaultdict",
"- a = list(map(int, input().split()))",
"- ctr = Counter(a)",
"+ A = list(map(int, input().split()))",
"+ ctr = defaultdict(int)",
"+ for x in A:",
"+ ctr[x] += 1",
"- b, c = list(map(in... | false | 0.044524 | 0.084168 | 0.528995 | [
"s579349204",
"s682863717"
] |
u695474809 | p02779 | python | s375457599 | s937101909 | 108 | 97 | 35,876 | 41,140 | Accepted | Accepted | 10.19 | import collections
N = int(eval(input()))
number = list(map(int,input().split()))
number_count = collections.Counter(number)
for i,j in list(number_count.items()):
if j >1:
print("NO")
exit(0)
print("YES")
| N = int(eval(input()))
number = set(map(int,input().split()))
if len(number)==N:print("YES")
else:print("NO") | 10 | 4 | 227 | 106 | import collections
N = int(eval(input()))
number = list(map(int, input().split()))
number_count = collections.Counter(number)
for i, j in list(number_count.items()):
if j > 1:
print("NO")
exit(0)
print("YES")
| N = int(eval(input()))
number = set(map(int, input().split()))
if len(number) == N:
print("YES")
else:
print("NO")
| false | 60 | [
"-import collections",
"-",
"-number = list(map(int, input().split()))",
"-number_count = collections.Counter(number)",
"-for i, j in list(number_count.items()):",
"- if j > 1:",
"- print(\"NO\")",
"- exit(0)",
"-print(\"YES\")",
"+number = set(map(int, input().split()))",
"+if ... | false | 0.034541 | 0.036117 | 0.956349 | [
"s375457599",
"s937101909"
] |
u450956662 | p03700 | python | s466619567 | s579340803 | 1,194 | 765 | 7,088 | 13,236 | Accepted | Accepted | 35.93 | import math
def bs(n, a, b, hp, min=0, max=10**9):
left = min
right = max
def count(num):
base = b * num
attackcount = 0
diff = a-b
for i in range(n):
tmp = math.ceil((hp[i] - base) / diff)
if tmp <= 0:
pass
el... | def check(T):
res = 0
for h in H:
tmp = (h - B * T + A - B - 1) // (A - B)
if tmp <= 0:
break
res += tmp
return True if res <= T else False
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort(reverse=True)
res = 0
left... | 31 | 22 | 770 | 472 | import math
def bs(n, a, b, hp, min=0, max=10**9):
left = min
right = max
def count(num):
base = b * num
attackcount = 0
diff = a - b
for i in range(n):
tmp = math.ceil((hp[i] - base) / diff)
if tmp <= 0:
pass
else:
... | def check(T):
res = 0
for h in H:
tmp = (h - B * T + A - B - 1) // (A - B)
if tmp <= 0:
break
res += tmp
return True if res <= T else False
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort(reverse=True)
res = 0
left = 0
right =... | false | 29.032258 | [
"-import math",
"+def check(T):",
"+ res = 0",
"+ for h in H:",
"+ tmp = (h - B * T + A - B - 1) // (A - B)",
"+ if tmp <= 0:",
"+ break",
"+ res += tmp",
"+ return True if res <= T else False",
"-def bs(n, a, b, hp, min=0, max=10**9):",
"- left = min"... | false | 0.041845 | 0.102466 | 0.408381 | [
"s466619567",
"s579340803"
] |
u319818856 | p03147 | python | s343486534 | s088488099 | 24 | 17 | 3,572 | 2,940 | Accepted | Accepted | 29.17 | from functools import reduce
N = int(eval(input()))
h = [int(s) for s in input().split()]
prev = 0
count = 0
for i in range(N):
count += h[i] - prev if h[i] > prev else 0
prev = h[i]
print(count)
| def grand_garden(N: int, H: list) -> int:
before = 0
op = 0
for h in H:
if before < h:
op += h - before
before = h
return op
if __name__ == "__main__":
N = int(eval(input()))
H = [int(s) for s in input().split()]
ans = grand_garden(N, H)
pr... | 13 | 17 | 214 | 323 | from functools import reduce
N = int(eval(input()))
h = [int(s) for s in input().split()]
prev = 0
count = 0
for i in range(N):
count += h[i] - prev if h[i] > prev else 0
prev = h[i]
print(count)
| def grand_garden(N: int, H: list) -> int:
before = 0
op = 0
for h in H:
if before < h:
op += h - before
before = h
return op
if __name__ == "__main__":
N = int(eval(input()))
H = [int(s) for s in input().split()]
ans = grand_garden(N, H)
print(ans)
| false | 23.529412 | [
"-from functools import reduce",
"+def grand_garden(N: int, H: list) -> int:",
"+ before = 0",
"+ op = 0",
"+ for h in H:",
"+ if before < h:",
"+ op += h - before",
"+ before = h",
"+ return op",
"-N = int(eval(input()))",
"-h = [int(s) for s in input().spli... | false | 0.079241 | 0.035194 | 2.251572 | [
"s343486534",
"s088488099"
] |
u440566786 | p02861 | python | s747404633 | s199464916 | 207 | 168 | 38,384 | 38,588 | Accepted | Accepted | 18.84 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
C=[0]*n
for i in range(n):
x,y=list(map(int,input().split()))
C[i]=complex(x,y)
from itertools import product
S=sum(... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
C=[None]*n
for i in range(n):
x,y=list(map(int,input().split()))
C[i]=x+y*1j
s=sum(abs(C[i]-C[j]) for i in range(n) for j ... | 16 | 15 | 388 | 347 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
C = [0] * n
for i in range(n):
x, y = list(map(int, input().split()))
C[i] = complex(x, y)
from itertools import product
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
C = [None] * n
for i in range(n):
x, y = list(map(int, input().split()))
C[i] = x + y * 1j
s = sum(abs(C[i] - C[j]) for i... | false | 6.25 | [
"- C = [0] * n",
"+ C = [None] * n",
"- C[i] = complex(x, y)",
"- from itertools import product",
"-",
"- S = sum(abs(C[i] - C[j]) for i, j in product(list(range(n)), repeat=2))",
"- print((S / n))",
"+ C[i] = x + y * 1j",
"+ s = sum(abs(C[i] - C[j]) for i in range(n)... | false | 0.049699 | 0.049089 | 1.012423 | [
"s747404633",
"s199464916"
] |
u911537358 | p03177 | python | s728729403 | s336421282 | 544 | 479 | 42,732 | 43,484 | Accepted | Accepted | 11.95 | # @author
import sys
class RWalk:
def solve(self):
MOD = 10 ** 9 + 7
def mult(A, B):
n, m, p = len(A), len(A[0]), len(B[0])
assert(len(B) == m)
C = [[0] * p for _ in range(n)]
for i in range(n):
for j in range(p):
... | # @author
import sys
class RWalk:
def solve(self):
MOD = 10 ** 9 + 7
def mult(A, B):
n, m, p = len(A), len(A[0]), len(B[0])
assert(len(B) == m)
C = [[0] * p for _ in range(n)]
for i in range(n):
for k in range(m):
... | 42 | 44 | 1,030 | 1,088 | # @author
import sys
class RWalk:
def solve(self):
MOD = 10**9 + 7
def mult(A, B):
n, m, p = len(A), len(A[0]), len(B[0])
assert len(B) == m
C = [[0] * p for _ in range(n)]
for i in range(n):
for j in range(p):
fo... | # @author
import sys
class RWalk:
def solve(self):
MOD = 10**9 + 7
def mult(A, B):
n, m, p = len(A), len(A[0]), len(B[0])
assert len(B) == m
C = [[0] * p for _ in range(n)]
for i in range(n):
for k in range(m):
a ... | false | 4.545455 | [
"- for j in range(p):",
"- for k in range(m):",
"- C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD",
"+ for k in range(m):",
"+ a = A[i][k]",
"+ row = B[k]",
"+ for j in range(p... | false | 0.161341 | 0.051845 | 3.112013 | [
"s728729403",
"s336421282"
] |
u952164537 | p02887 | python | s093085103 | s981881814 | 52 | 40 | 4,020 | 3,956 | Accepted | Accepted | 23.08 | N = int(eval(input()))
l = list(eval(input()))
r = 0
for i, s in enumerate(l):
if i + 1 == N:
r += 1
print(r)
break
if s != l[i + 1]:
r += 1 | N = int(eval(input()))
l = list(eval(input()))
r = 0
S = ''
for s in l:
if S != s:
r += 1
S = s
print(r) | 10 | 9 | 177 | 116 | N = int(eval(input()))
l = list(eval(input()))
r = 0
for i, s in enumerate(l):
if i + 1 == N:
r += 1
print(r)
break
if s != l[i + 1]:
r += 1
| N = int(eval(input()))
l = list(eval(input()))
r = 0
S = ""
for s in l:
if S != s:
r += 1
S = s
print(r)
| false | 10 | [
"-for i, s in enumerate(l):",
"- if i + 1 == N:",
"+S = \"\"",
"+for s in l:",
"+ if S != s:",
"- print(r)",
"- break",
"- if s != l[i + 1]:",
"- r += 1",
"+ S = s",
"+print(r)"
] | false | 0.035736 | 0.042233 | 0.846161 | [
"s093085103",
"s981881814"
] |
u901582103 | p03150 | python | s943516003 | s643829369 | 30 | 27 | 9,112 | 9,100 | Accepted | Accepted | 10 | S=eval(input())
if 'keyence'==S[:7] or 'keyence'==S[-7:]:
print('YES')
exit()
if 'k'==S[:1] and 'eyence'==S[-6:]:
print('YES')
exit()
if 'ke'==S[:2] and 'yence'==S[-5:]:
print('YES')
exit()
if 'key'==S[:3] and 'ence'==S[-4:]:
print('YES')
exit()
if 'keye'==S[:4] and 'nce'==S... | S=eval(input())
n=len(S)
for i in range(8):
if S[:i]+S[n-7+i:]=='keyence':
print('YES')
exit()
print('NO') | 23 | 7 | 497 | 126 | S = eval(input())
if "keyence" == S[:7] or "keyence" == S[-7:]:
print("YES")
exit()
if "k" == S[:1] and "eyence" == S[-6:]:
print("YES")
exit()
if "ke" == S[:2] and "yence" == S[-5:]:
print("YES")
exit()
if "key" == S[:3] and "ence" == S[-4:]:
print("YES")
exit()
if "keye" == S[:4] and "... | S = eval(input())
n = len(S)
for i in range(8):
if S[:i] + S[n - 7 + i :] == "keyence":
print("YES")
exit()
print("NO")
| false | 69.565217 | [
"-if \"keyence\" == S[:7] or \"keyence\" == S[-7:]:",
"- print(\"YES\")",
"- exit()",
"-if \"k\" == S[:1] and \"eyence\" == S[-6:]:",
"- print(\"YES\")",
"- exit()",
"-if \"ke\" == S[:2] and \"yence\" == S[-5:]:",
"- print(\"YES\")",
"- exit()",
"-if \"key\" == S[:3] and \"ence\"... | false | 0.045247 | 0.044469 | 1.017486 | [
"s943516003",
"s643829369"
] |
u923172145 | p02551 | python | s296355368 | s300670223 | 356 | 326 | 94,148 | 100,056 | Accepted | Accepted | 8.43 | N, Q = list(map(int, input().split()))
N -= 2
BIT = [[0 for i in range(N+1)] for _ in range(2)]
n = N
def BIT_query(idx,BIT):
res_sum = 0
while idx > 0:
res_sum += BIT[idx]
idx -= idx&(-idx)
return res_sum
def BIT_update(idx,x,BIT):
while idx <= n:
BIT[idx] += x... | N, Q = list(map(int, input().split()))
N -= 2 # ๆ ใๅใ้คใใใตใคใบใซ็ดใ
#ใใใใ33่ก็ฎใพใงๆบๅใBinary indexed tree(BIT)ใจใใใใผใฟๆง้ ใไฝฟใใ
BIT = [[0 for i in range(N+1)] for _ in range(2)] #BITใ2ใค็จๆ
# BITใงใงใใใใจใ
# 1, ่ฆ็ด ใฎๆดๆฐใO(logn)ใง่กใ
# 2, ็ดฏ็ฉๅใO(logn)ใงๆฑใใใ
# ใโป ไธกๆนใจใใใใชใใซๆฉใใงใใใฎใใกใชใใใ
# ๆฎ้ใฎ้
ๅใ ใจใ1ใจ2ใใใใใO(1),O(n)ใใใใ
# ไธๆนใ็ดฏ... | 40 | 73 | 729 | 2,273 | N, Q = list(map(int, input().split()))
N -= 2
BIT = [[0 for i in range(N + 1)] for _ in range(2)]
n = N
def BIT_query(idx, BIT):
res_sum = 0
while idx > 0:
res_sum += BIT[idx]
idx -= idx & (-idx)
return res_sum
def BIT_update(idx, x, BIT):
while idx <= n:
BIT[idx] += x
... | N, Q = list(map(int, input().split()))
N -= 2 # ๆ ใๅใ้คใใใตใคใบใซ็ดใ
# ใใใใ33่ก็ฎใพใงๆบๅใBinary indexed tree(BIT)ใจใใใใผใฟๆง้ ใไฝฟใใ
BIT = [[0 for i in range(N + 1)] for _ in range(2)] # BITใ2ใค็จๆ
# BITใงใงใใใใจใ
# 1, ่ฆ็ด ใฎๆดๆฐใO(logn)ใง่กใ
# 2, ็ดฏ็ฉๅใO(logn)ใงๆฑใใใ
# ใโป ไธกๆนใจใใใใชใใซๆฉใใงใใใฎใใกใชใใใ
# ๆฎ้ใฎ้
ๅใ ใจใ1ใจ2ใใใใใO(1),O(n)ใใใใ
# ไธๆนใ็ดฏ็ฉๅใง่จ้ฒใใ้
ๅ... | false | 45.205479 | [
"-N -= 2",
"-BIT = [[0 for i in range(N + 1)] for _ in range(2)]",
"-n = N",
"+N -= 2 # ๆ ใๅใ้คใใใตใคใบใซ็ดใ",
"+# ใใใใ33่ก็ฎใพใงๆบๅใBinary indexed tree(BIT)ใจใใใใผใฟๆง้ ใไฝฟใใ",
"+BIT = [[0 for i in range(N + 1)] for _ in range(2)] # BITใ2ใค็จๆ",
"+# BITใงใงใใใใจใ",
"+# 1, ่ฆ็ด ใฎๆดๆฐใO(logn)ใง่กใ",
"+# 2, ็ดฏ็ฉๅใO(logn)ใงๆฑใใใ",
... | false | 0.043503 | 0.042452 | 1.024773 | [
"s296355368",
"s300670223"
] |
u762533651 | p02719 | python | s080063985 | s309720700 | 69 | 63 | 60,992 | 61,856 | Accepted | Accepted | 8.7 | n, k = list(map(int, input().split()))
t = n // k
re = n - t * k
i = True
while i == True:
if abs(re - k) < re:
re = abs(re - k)
i = True
else:
i = False
print(re)
| n, k = list(map(int, input().split()))
t = n // k
re = n - t * k
if abs(re - k) < re:
re = abs(re - k)
i = True
print(re)
| 15 | 11 | 208 | 138 | n, k = list(map(int, input().split()))
t = n // k
re = n - t * k
i = True
while i == True:
if abs(re - k) < re:
re = abs(re - k)
i = True
else:
i = False
print(re)
| n, k = list(map(int, input().split()))
t = n // k
re = n - t * k
if abs(re - k) < re:
re = abs(re - k)
i = True
print(re)
| false | 26.666667 | [
"-i = True",
"-while i == True:",
"- if abs(re - k) < re:",
"- re = abs(re - k)",
"- i = True",
"- else:",
"- i = False",
"+if abs(re - k) < re:",
"+ re = abs(re - k)",
"+ i = True"
] | false | 0.042609 | 0.040225 | 1.05925 | [
"s080063985",
"s309720700"
] |
u888092736 | p02720 | python | s956832713 | s843047610 | 878 | 64 | 110,428 | 6,092 | Accepted | Accepted | 92.71 | def gen_lunlun(digit, li):
if len(li) == digit:
lunluns.append(''.join(map(str, li)))
return
min_num = max(0, li[-1] - 1)
max_num = min(9, li[-1] + 1)
for i in range(min_num, max_num + 1):
gen_lunlun(digit, li + [i])
k = int(eval(input()))
lunluns = []
for d in ra... | from collections import deque
def nth_ll(k):
if k < 10:
return k
queue = deque([i for i in range(1, 10)])
cnt = 9
while True:
n = queue.popleft()
for i in range(-1 if n % 10 != 0 else 0, 2 if n % 10 != 9 else 1):
queue.append(10 * n + n % 10 + i)
... | 17 | 17 | 405 | 427 | def gen_lunlun(digit, li):
if len(li) == digit:
lunluns.append("".join(map(str, li)))
return
min_num = max(0, li[-1] - 1)
max_num = min(9, li[-1] + 1)
for i in range(min_num, max_num + 1):
gen_lunlun(digit, li + [i])
k = int(eval(input()))
lunluns = []
for d in range(1, 11):
... | from collections import deque
def nth_ll(k):
if k < 10:
return k
queue = deque([i for i in range(1, 10)])
cnt = 9
while True:
n = queue.popleft()
for i in range(-1 if n % 10 != 0 else 0, 2 if n % 10 != 9 else 1):
queue.append(10 * n + n % 10 + i)
cnt += ... | false | 0 | [
"-def gen_lunlun(digit, li):",
"- if len(li) == digit:",
"- lunluns.append(\"\".join(map(str, li)))",
"- return",
"- min_num = max(0, li[-1] - 1)",
"- max_num = min(9, li[-1] + 1)",
"- for i in range(min_num, max_num + 1):",
"- gen_lunlun(digit, li + [i])",
"+from co... | false | 1.710421 | 0.047588 | 35.942029 | [
"s956832713",
"s843047610"
] |
u860829879 | p02912 | python | s439348247 | s991866126 | 427 | 156 | 72,216 | 94,532 | Accepted | Accepted | 63.47 | import heapq
N,M=list(map(int,input().split()))
A=list([-int(x) for x in input().split()])
heapq.heapify(A)
while M>0:
a=heapq.heappop(A)
a=-a
a=a>>1
a=-a
heapq.heappush(A,a)
M-=1
print((-sum(A))) | import heapq
n,m=list(map(int,input().split()))
*a,=list(map(int,input().split()))
q=[]
for aa in a:
heapq.heappush(q,-aa)
while m>0:
aa=heapq.heappop(q)
heapq.heappush(q,-((-aa)//2))
m-=1
print((-sum(q))) | 16 | 15 | 241 | 225 | import heapq
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
while M > 0:
a = heapq.heappop(A)
a = -a
a = a >> 1
a = -a
heapq.heappush(A, a)
M -= 1
print((-sum(A)))
| import heapq
n, m = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
q = []
for aa in a:
heapq.heappush(q, -aa)
while m > 0:
aa = heapq.heappop(q)
heapq.heappush(q, -((-aa) // 2))
m -= 1
print((-sum(q)))
| false | 6.25 | [
"-N, M = list(map(int, input().split()))",
"-A = list([-int(x) for x in input().split()])",
"-heapq.heapify(A)",
"-while M > 0:",
"- a = heapq.heappop(A)",
"- a = -a",
"- a = a >> 1",
"- a = -a",
"- heapq.heappush(A, a)",
"- M -= 1",
"-print((-sum(A)))",
"+n, m = list(map(int... | false | 0.098912 | 0.040919 | 2.417279 | [
"s439348247",
"s991866126"
] |
u628285938 | p03371 | python | s990496761 | s385892390 | 23 | 17 | 3,060 | 3,064 | Accepted | Accepted | 26.09 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020
@author: liang
"""
A, B, C, X, Y = list(map(int,input().split()))
if A + B > 2*C:
if X > Y :
if A < 2 * C:
ans = Y * C * 2 + abs(X-Y) * A
else:
ans = X * C * 2
else:
if B < 2 * C:
... | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020
@author: liang
"""
###็
ฉ้ => ๅๆใใฆๆๅฐๅคใๅบๅ
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
if X > Y :
if A < 2 * C:
ans = Y * C * 2 + abs(X-Y) * A
else:
ans = X * C * 2 ##
else:
... | 22 | 35 | 443 | 802 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020
@author: liang
"""
A, B, C, X, Y = list(map(int, input().split()))
if A + B > 2 * C:
if X > Y:
if A < 2 * C:
ans = Y * C * 2 + abs(X - Y) * A
else:
ans = X * C * 2
else:
if B < 2 * C:
ans ... | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020
@author: liang
"""
###็
ฉ้ => ๅๆใใฆๆๅฐๅคใๅบๅ
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
if X > Y :
if A < 2 * C:
ans = Y * C * 2 + abs(X-Y) * A
else:
ans = X * C * 2 ##
else:
if B < 2 * C... | false | 37.142857 | [
"+###็
ฉ้ => ๅๆใใฆๆๅฐๅคใๅบๅ",
"+\"\"\"",
"+A, B, C, X, Y = map(int,input().split())",
"+if A + B > 2*C:",
"+ if X > Y :",
"+ if A < 2 * C:",
"+ ans = Y * C * 2 + abs(X-Y) * A",
"+ else:",
"+ ans = X * C * 2 ##",
"+ else:",
"+ if B < 2 * C:",
"+ ... | false | 0.036762 | 0.036596 | 1.004522 | [
"s990496761",
"s385892390"
] |
u189575640 | p03945 | python | s701431988 | s435221961 | 43 | 35 | 3,188 | 3,188 | Accepted | Accepted | 18.6 | import sys
# N,M = [int(n) for n in input().split()]
S = str(eval(input()))
# T = str(input())
if (not "B" in S) or (not "W" in S):
print((0))
sys.exit()
changecount = 0
for i in range(1,len(S)):
if(S[i] != S[i-1]):
changecount+=1
print(changecount)
| import sys
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = str(eval(input()))
# L = len(S)
# T = str(input())
ans = 0
prev = S[0]
for s in S:
if(s != prev):
ans+=1
prev = s
print(ans)
| 13 | 14 | 275 | 265 | import sys
# N,M = [int(n) for n in input().split()]
S = str(eval(input()))
# T = str(input())
if (not "B" in S) or (not "W" in S):
print((0))
sys.exit()
changecount = 0
for i in range(1, len(S)):
if S[i] != S[i - 1]:
changecount += 1
print(changecount)
| import sys
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = str(eval(input()))
# L = len(S)
# T = str(input())
ans = 0
prev = S[0]
for s in S:
if s != prev:
ans += 1
prev = s
print(ans)
| false | 7.142857 | [
"-# N,M = [int(n) for n in input().split()]",
"+# A,B,C = [int(n) for n in input().split()]",
"+# N = int(input())",
"+# a = [int(input()) for _ in range(N)]",
"+# L = len(S)",
"-if (not \"B\" in S) or (not \"W\" in S):",
"- print((0))",
"- sys.exit()",
"-changecount = 0",
"-for i in range(1... | false | 0.085218 | 0.101846 | 0.83674 | [
"s701431988",
"s435221961"
] |
u123756661 | p03240 | python | s275865218 | s270335509 | 539 | 211 | 3,188 | 41,584 | Accepted | Accepted | 60.85 | n=int(eval(input()))
x,y,h=list(map(int,input().split()))
d=set([(x,y,h)])
t=[x,y,h]
for i in range(n-1):
x,y,h=list(map(int,input().split()))
d.add((x,y,h))
if t[2]==0: t=[x,y,h]
for i in range(101):
for j in range(101):
f=0
p=abs(t[0]-i)+abs(t[1]-j)+t[2]
for k in ... | n=int(eval(input()))
d=[]
for i in range(n):
a,b,c=list(map(int,input().split()))
d.append((a,b,c))
if c!=0:
x=a
y=b
h=c
for i in range(101):
for j in range(101):
p=abs(i-x)+abs(j-y)+h
for a,b,c in d:
if (c==0 and p-abs(i-a)-abs(j-b)<1) ... | 19 | 22 | 497 | 490 | n = int(eval(input()))
x, y, h = list(map(int, input().split()))
d = set([(x, y, h)])
t = [x, y, h]
for i in range(n - 1):
x, y, h = list(map(int, input().split()))
d.add((x, y, h))
if t[2] == 0:
t = [x, y, h]
for i in range(101):
for j in range(101):
f = 0
p = abs(t[0] - i) + ab... | n = int(eval(input()))
d = []
for i in range(n):
a, b, c = list(map(int, input().split()))
d.append((a, b, c))
if c != 0:
x = a
y = b
h = c
for i in range(101):
for j in range(101):
p = abs(i - x) + abs(j - y) + h
for a, b, c in d:
if (c == 0 and p - a... | false | 13.636364 | [
"-x, y, h = list(map(int, input().split()))",
"-d = set([(x, y, h)])",
"-t = [x, y, h]",
"-for i in range(n - 1):",
"- x, y, h = list(map(int, input().split()))",
"- d.add((x, y, h))",
"- if t[2] == 0:",
"- t = [x, y, h]",
"+d = []",
"+for i in range(n):",
"+ a, b, c = list(ma... | false | 0.053279 | 0.049578 | 1.074658 | [
"s275865218",
"s270335509"
] |
u352394527 | p00731 | python | s259483541 | s773115866 | 900 | 810 | 6,216 | 6,212 | Accepted | Accepted | 10 | from heapq import heappush, heappop
R_next = tuple((x, y) for x in range(-3, 0) for y in range(-2, 3) if abs(x) + abs(y) <= 3)
L_next = tuple((x, y) for x in range(1, 4) for y in range(-2, 3) if abs(x) + abs(y) <= 3)
c_num = tuple(str(i) for i in range(10))
L, R = 0, 1
INF = 10 ** 20
def conv(c):
if c in c... | from heapq import heappush, heappop
R_next = tuple((x, y) for x in range(-3, 0) for y in range(-2, 3) if abs(x) + abs(y) <= 3)
L_next = tuple((x, y) for x in range(1, 4) for y in range(-2, 3) if abs(x) + abs(y) <= 3)
c_num = tuple(str(i) for i in range(10))
L, R = 0, 1
INF = 10 ** 20
def conv(c):
if c in c... | 66 | 67 | 1,716 | 1,695 | from heapq import heappush, heappop
R_next = tuple(
(x, y) for x in range(-3, 0) for y in range(-2, 3) if abs(x) + abs(y) <= 3
)
L_next = tuple(
(x, y) for x in range(1, 4) for y in range(-2, 3) if abs(x) + abs(y) <= 3
)
c_num = tuple(str(i) for i in range(10))
L, R = 0, 1
INF = 10**20
def conv(c):
if c ... | from heapq import heappush, heappop
R_next = tuple(
(x, y) for x in range(-3, 0) for y in range(-2, 3) if abs(x) + abs(y) <= 3
)
L_next = tuple(
(x, y) for x in range(1, 4) for y in range(-2, 3) if abs(x) + abs(y) <= 3
)
c_num = tuple(str(i) for i in range(10))
L, R = 0, 1
INF = 10**20
def conv(c):
if c ... | false | 1.492537 | [
"- dic = {}",
"+ visited = {}",
"- dic[(x, y, L)] = 0",
"- dic[(x, y, R)] = 0",
"+ visited[(x, y, L)] = True",
"+ visited[(x, y, R)] = True",
"- if (",
"- not (nx, ny, next_foot) in dic",
"- ... | false | 0.111819 | 0.044233 | 2.527973 | [
"s259483541",
"s773115866"
] |
u973972117 | p02712 | python | s194898716 | s047839817 | 208 | 182 | 9,012 | 8,992 | Accepted | Accepted | 12.5 | N = int(eval(input()))
S = 0
for i in range(0,N):
if (i+1) % 3 != 0 and (i+1) % 5 != 0:
S = S + i+1
print(S) | N = int(eval(input()))
S = 0
for x in range(0,N+1):
if (x % 3) != 0 and (x % 5) != 0:
S += x
else:
S += 0
print(S) | 6 | 8 | 113 | 139 | N = int(eval(input()))
S = 0
for i in range(0, N):
if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
S = S + i + 1
print(S)
| N = int(eval(input()))
S = 0
for x in range(0, N + 1):
if (x % 3) != 0 and (x % 5) != 0:
S += x
else:
S += 0
print(S)
| false | 25 | [
"-for i in range(0, N):",
"- if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:",
"- S = S + i + 1",
"+for x in range(0, N + 1):",
"+ if (x % 3) != 0 and (x % 5) != 0:",
"+ S += x",
"+ else:",
"+ S += 0"
] | false | 0.242131 | 0.439382 | 0.551072 | [
"s194898716",
"s047839817"
] |
u489959379 | p03160 | python | s674817344 | s322743230 | 128 | 116 | 13,928 | 14,484 | Accepted | Accepted | 9.38 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[n-1])) | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
H = list(map(int, input().split()))
dp = [f_inf for _ in range(n)]
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2, n):
dp[i] = min(dp[i], dp[i - ... | 9 | 22 | 222 | 443 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[n - 1]))
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
H = list(map(int, input().split()))
dp = [f_inf for _ in range(n)]
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2, n):
dp[i] = min(
dp[i], dp[i - 1] + ab... | false | 59.090909 | [
"-n = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-dp = [0] * n",
"-dp[0] = 0",
"-dp[1] = abs(h[1] - h[0])",
"-for i in range(2, n):",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))",
"-print((dp[n - 1]))",
"+import sys",
"+",
"+sys.setrec... | false | 0.007989 | 0.037577 | 0.212607 | [
"s674817344",
"s322743230"
] |
u811733736 | p02346 | python | s085529474 | s323477172 | 760 | 700 | 10,136 | 10,124 | Accepted | Accepted | 7.89 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class BIT(object):
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class BIT(object):
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
... | 51 | 51 | 1,086 | 1,086 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class BIT(object):
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
# ??????????... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class BIT(object):
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
# ??????????... | false | 0 | [
"- # i &= (i - 1)",
"- i -= i & -i",
"+ i &= i - 1",
"+ # i -= (i & -i)"
] | false | 0.036461 | 0.040343 | 0.903782 | [
"s085529474",
"s323477172"
] |
u368249389 | p03107 | python | s076219950 | s338851416 | 35 | 31 | 3,188 | 3,956 | Accepted | Accepted | 11.43 | # Problem C - Unification
# input
s = eval(input())
# initialization
zero_count = 0
one_count = 0
# count
for i in range(len(s)):
if s[i]=='0':
zero_count += 1
else:
one_count += 1
# output
if zero_count>0 and one_count>0:
if zero_count>=one_count:
print((one_c... | # Problem C - Unification
# input
S = list(eval(input()))
# initialization
zero_num = 0
one_num = 0
# count
for s in S:
if s=='0':
zero_num += 1
else:
one_num += 1
# output
if not zero_num>0 or not one_num>0:
print((0))
else:
min_ans = min(zero_num, one_num)
... | 24 | 22 | 382 | 331 | # Problem C - Unification
# input
s = eval(input())
# initialization
zero_count = 0
one_count = 0
# count
for i in range(len(s)):
if s[i] == "0":
zero_count += 1
else:
one_count += 1
# output
if zero_count > 0 and one_count > 0:
if zero_count >= one_count:
print((one_count * 2))
... | # Problem C - Unification
# input
S = list(eval(input()))
# initialization
zero_num = 0
one_num = 0
# count
for s in S:
if s == "0":
zero_num += 1
else:
one_num += 1
# output
if not zero_num > 0 or not one_num > 0:
print((0))
else:
min_ans = min(zero_num, one_num)
print((min_ans * 2)... | false | 8.333333 | [
"-s = eval(input())",
"+S = list(eval(input()))",
"-zero_count = 0",
"-one_count = 0",
"+zero_num = 0",
"+one_num = 0",
"-for i in range(len(s)):",
"- if s[i] == \"0\":",
"- zero_count += 1",
"+for s in S:",
"+ if s == \"0\":",
"+ zero_num += 1",
"- one_count += 1"... | false | 0.054907 | 0.035352 | 1.553129 | [
"s076219950",
"s338851416"
] |
u074220993 | p03599 | python | s820532495 | s068573322 | 2,075 | 1,090 | 10,252 | 10,160 | Accepted | Accepted | 47.47 | A,B,C,D,E,F = (int(x) for x in input().split())
CCT = {}
for a in range(F//(100*A)+1):
for b in range(F//(100*B)+1):
water = (a*A+b*B)*100
if water > F:
continue
max_suger = water*E//100
for c in range(max_suger//C+1):
for d in range(max_suger//D+1)... | A,B,C,D,E,F = (int(x) for x in input().split())
CCT = {}
for a in range(F//(100*A)+1):
for b in range(F//(100*B)+1):
water = (a*A+b*B)*100
if water > F:
continue
max_suger = water*E//100
for c in range(max_suger//C+1):
for d in range((max_suger-c*C)... | 26 | 24 | 753 | 711 | A, B, C, D, E, F = (int(x) for x in input().split())
CCT = {}
for a in range(F // (100 * A) + 1):
for b in range(F // (100 * B) + 1):
water = (a * A + b * B) * 100
if water > F:
continue
max_suger = water * E // 100
for c in range(max_suger // C + 1):
for d in... | A, B, C, D, E, F = (int(x) for x in input().split())
CCT = {}
for a in range(F // (100 * A) + 1):
for b in range(F // (100 * B) + 1):
water = (a * A + b * B) * 100
if water > F:
continue
max_suger = water * E // 100
for c in range(max_suger // C + 1):
for d in... | false | 7.692308 | [
"- for d in range(max_suger // D + 1):",
"+ for d in range((max_suger - c * C) // D + 1):",
"- if total > F or total == 0:",
"- continue",
"- if max_suger < suger:",
"+ if total > F or total == 0 or max_suger < suger:"
] | false | 0.755257 | 0.715642 | 1.055355 | [
"s820532495",
"s068573322"
] |
u669360983 | p02388 | python | s960075008 | s191204715 | 30 | 20 | 6,724 | 4,184 | Accepted | Accepted | 33.33 | x=int(eval(input()))
print((x * x * x)) | x=int(input())
print(x**3) | 2 | 2 | 33 | 30 | x = int(eval(input()))
print((x * x * x))
| x = int(input())
print(x**3)
| false | 0 | [
"-x = int(eval(input()))",
"-print((x * x * x))",
"+x = int(input())",
"+print(x**3)"
] | false | 0.036611 | 0.038054 | 0.962059 | [
"s960075008",
"s191204715"
] |
u857428111 | p02802 | python | s467719729 | s148894764 | 382 | 331 | 17,296 | 67,420 | Accepted | Accepted | 13.35 | # coding: utf-8
# Your code here!
def pin(type=int):
return list(map(type,input().split()))
#1่กใใจใซ่ชญใฟ่พผใใงใใ
#ๅคๆฐไธๅใ ใใฎใจใใฏใซใณใใๅ
ฅใใใ ใใinput()็ธๅฝใใกใใใใ
#sum้ขๆฐใชใฉintใ็ธๆใซใใ้ขๆฐใๆธใๆใซไพฟๅฉใชใฎใงใใใฉใซใใintๅใซใใ
N,M = pin()
p=[0 for j in range(0,M)]
S=[0 for j in range(0,M)]
for j in range(0,M):
p[j],S[j] =pin(str) #p_i,... | #!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return list(map(type,input().split()))
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
N,M=pin()
ps=[tupin(str) for _ in range(M)]
WA=[0]*N
AC=[0]*N
... | 63 | 28 | 1,447 | 624 | # coding: utf-8
# Your code here!
def pin(type=int):
return list(map(type, input().split()))
# 1่กใใจใซ่ชญใฟ่พผใใงใใ
# ๅคๆฐไธๅใ ใใฎใจใใฏใซใณใใๅ
ฅใใใ ใใinput()็ธๅฝใใกใใใใ
# sum้ขๆฐใชใฉintใ็ธๆใซใใ้ขๆฐใๆธใๆใซไพฟๅฉใชใฎใงใใใฉใซใใintๅใซใใ
N, M = pin()
p = [0 for j in range(0, M)]
S = [0 for j in range(0, M)]
for j in range(0, M):
p[j], S[j] = pin(str) # p_... | #!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input = lambda: sys.stdin.readline().rstrip()
def pin(type=int):
return list(map(type, input().split()))
def tupin(t=int):
return tuple(pin(t))
#%%code
def resolve():
N, M = pin()
ps = [tupin(str) for _ in range(M)]
WA = [0] * N
... | false | 55.555556 | [
"-# coding: utf-8",
"-# Your code here!",
"+#!/usr/bin/env python3",
"+#%% for atcoder uniittest use",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()",
"+",
"+",
"-# 1่กใใจใซ่ชญใฟ่พผใใงใใ",
"-# ๅคๆฐไธๅใ ใใฎใจใใฏใซใณใใๅ
ฅใใใ ใใinput()็ธๅฝใใกใใใใ",
"-# sum้ขๆฐใชใฉintใ็ธๆใซใใ้ขๆฐใๆธใๆใซไพฟๅฉใชใฎใงใใใฉใซใใintๅใซใใ",
... | false | 0.050483 | 0.045805 | 1.102128 | [
"s467719729",
"s148894764"
] |
u959225525 | p03607 | python | s803119824 | s554011290 | 244 | 204 | 7,388 | 11,884 | Accepted | Accepted | 16.39 | n=int(eval(input()))
li=[]
ans=0
fl=1
for i in range(n):
li.append(int(eval(input())))
li.sort()
for j in range(n-1):
if li[j]!=li[j+1]:
if fl%2==1:
ans+=1
fl=1
else:
fl=1
else:
fl+=1
if fl%2==1:
ans+=1
print(ans) | n=int(eval(input()))
li=set()
for i in range(n):
a=int(eval(input()))
if a in li:
li.remove(a)
else:
li.add(a)
print((len(li))) | 25 | 11 | 307 | 154 | n = int(eval(input()))
li = []
ans = 0
fl = 1
for i in range(n):
li.append(int(eval(input())))
li.sort()
for j in range(n - 1):
if li[j] != li[j + 1]:
if fl % 2 == 1:
ans += 1
fl = 1
else:
fl = 1
else:
fl += 1
if fl % 2 == 1:
ans += 1
print(ans... | n = int(eval(input()))
li = set()
for i in range(n):
a = int(eval(input()))
if a in li:
li.remove(a)
else:
li.add(a)
print((len(li)))
| false | 56 | [
"-li = []",
"-ans = 0",
"-fl = 1",
"+li = set()",
"- li.append(int(eval(input())))",
"-li.sort()",
"-for j in range(n - 1):",
"- if li[j] != li[j + 1]:",
"- if fl % 2 == 1:",
"- ans += 1",
"- fl = 1",
"- else:",
"- fl = 1",
"+ a = int... | false | 0.071336 | 0.043626 | 1.635164 | [
"s803119824",
"s554011290"
] |
u863370423 | p02785 | python | s327444778 | s531664706 | 284 | 155 | 88,908 | 26,020 | Accepted | Accepted | 45.42 | n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
if k >= n: print((0))
else: print((sum(arr[:n-k])))
| def main():
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
y.sort()
if (x[1]!=0):
z = y[:-x[1]]
else:
z = y
print((sum(z)))
if __name__== "__main__":
main() | 5 | 11 | 134 | 204 | n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
if k >= n:
print((0))
else:
print((sum(arr[: n - k])))
| def main():
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
y.sort()
if x[1] != 0:
z = y[: -x[1]]
else:
z = y
print((sum(z)))
if __name__ == "__main__":
main()
| false | 54.545455 | [
"-n, k = list(map(int, input().split()))",
"-arr = list(map(int, input().split()))",
"-arr.sort()",
"-if k >= n:",
"- print((0))",
"-else:",
"- print((sum(arr[: n - k])))",
"+def main():",
"+ x = [int(i) for i in input().split()]",
"+ y = [int(i) for i in input().split()]",
"+ y.s... | false | 0.039069 | 0.085686 | 0.45596 | [
"s327444778",
"s531664706"
] |
u298123314 | p02621 | python | s872733460 | s821233320 | 34 | 28 | 9,140 | 9,140 | Accepted | Accepted | 17.65 | a = int(eval(input()))
print((a + (a * a) + (a * a * a)))
| a = int(eval(input()))
print((a + a**2 + a**3))
| 3 | 3 | 53 | 43 | a = int(eval(input()))
print((a + (a * a) + (a * a * a)))
| a = int(eval(input()))
print((a + a**2 + a**3))
| false | 0 | [
"-print((a + (a * a) + (a * a * a)))",
"+print((a + a**2 + a**3))"
] | false | 0.034955 | 0.037367 | 0.935447 | [
"s872733460",
"s821233320"
] |
u583507988 | p02725 | python | s843183847 | s715672509 | 125 | 110 | 26,444 | 32,280 | Accepted | Accepted | 12 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
res = []
for i in range(n-1):
j = a[i+1] - a[i]
res.append(j)
l = k + a[0] - a[n-1]
res.append(l)
m = max(res)
print((k - m)) | k,n=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
data=[0]*n
for i in range(n-1):
data[i]=a[i+1]-a[i]
data[n-1]=k+a[0]-a[n-1]
print((sum(data)-max(data))) | 11 | 8 | 207 | 182 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
res = []
for i in range(n - 1):
j = a[i + 1] - a[i]
res.append(j)
l = k + a[0] - a[n - 1]
res.append(l)
m = max(res)
print((k - m))
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
data = [0] * n
for i in range(n - 1):
data[i] = a[i + 1] - a[i]
data[n - 1] = k + a[0] - a[n - 1]
print((sum(data) - max(data)))
| false | 27.272727 | [
"-res = []",
"+a.sort()",
"+data = [0] * n",
"- j = a[i + 1] - a[i]",
"- res.append(j)",
"-l = k + a[0] - a[n - 1]",
"-res.append(l)",
"-m = max(res)",
"-print((k - m))",
"+ data[i] = a[i + 1] - a[i]",
"+data[n - 1] = k + a[0] - a[n - 1]",
"+print((sum(data) - max(data)))"
] | false | 0.046571 | 0.049045 | 0.949559 | [
"s843183847",
"s715672509"
] |
u773265208 | p03012 | python | s645148134 | s061800242 | 169 | 17 | 38,640 | 2,940 | Accepted | Accepted | 89.94 | from collections import deque
n = int(eval(input()))
w = list(map(int,input().split()))
d = deque(w)
s1 = d.popleft()
s2 = d.pop()
for _ in range(n-2):
if s1 < s2:
s1 += d.popleft()
else:
s2 += d.pop()
print((abs(s1 - s2)))
| n = int(eval(input()))
w = list(map(int,input().split()))
ans = []
for i in range(1,n):
ans.append(abs(sum(w[:i])-sum(w[i:])))
print((min(ans)))
| 17 | 8 | 243 | 150 | from collections import deque
n = int(eval(input()))
w = list(map(int, input().split()))
d = deque(w)
s1 = d.popleft()
s2 = d.pop()
for _ in range(n - 2):
if s1 < s2:
s1 += d.popleft()
else:
s2 += d.pop()
print((abs(s1 - s2)))
| n = int(eval(input()))
w = list(map(int, input().split()))
ans = []
for i in range(1, n):
ans.append(abs(sum(w[:i]) - sum(w[i:])))
print((min(ans)))
| false | 52.941176 | [
"-from collections import deque",
"-",
"-d = deque(w)",
"-s1 = d.popleft()",
"-s2 = d.pop()",
"-for _ in range(n - 2):",
"- if s1 < s2:",
"- s1 += d.popleft()",
"- else:",
"- s2 += d.pop()",
"-print((abs(s1 - s2)))",
"+ans = []",
"+for i in range(1, n):",
"+ ans.appe... | false | 0.091705 | 0.042449 | 2.16038 | [
"s645148134",
"s061800242"
] |
u261103969 | p02554 | python | s165284207 | s552064956 | 389 | 30 | 10,896 | 9,168 | Accepted | Accepted | 92.29 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
ans = 10 ** N - 2 * 9 ** N + 8 ** N
print((ans % MOD))
if __name__ == '__main__':
main()
| MOD = 10 ** 9 + 7
N = int(eval(input()))
ans = pow(10, N, MOD)
ans -= 2 * pow(9, N, MOD)
ans += pow(8, N, MOD)
ans %= MOD # ๆๅพใซMODใๅใๅฟใใชใใใใซๆฐใใคใใพใใใ
print(ans) | 17 | 10 | 266 | 165 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
ans = 10**N - 2 * 9**N + 8**N
print((ans % MOD))
if __name__ == "__main__":
main()
| MOD = 10**9 + 7
N = int(eval(input()))
ans = pow(10, N, MOD)
ans -= 2 * pow(9, N, MOD)
ans += pow(8, N, MOD)
ans %= MOD # ๆๅพใซMODใๅใๅฟใใชใใใใซๆฐใใคใใพใใใ
print(ans)
| false | 41.176471 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- N = int(readline())",
"- ans = 10**N - 2 * 9**N + 8**N",
"- print((ans % MOD))",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",... | false | 0.08574 | 0.036327 | 2.360258 | [
"s165284207",
"s552064956"
] |
u057109575 | p04013 | python | s667106039 | s370387569 | 446 | 270 | 93,148 | 5,612 | Accepted | Accepted | 39.46 | N, A, *x = list(map(int, open(0).read().split()))
c_nx = N * max(x + [A])
dp = [[[0] * (c_nx + 1) for _ in range(N + 1)]
for _ in range(N + 1)]
x = [0] + x
dp[0][0][0] = 1
for j in range(1, N + 1):
for k in range(N + 1):
for s in range(c_nx + 1):
if s < x[j]:
... | N, A, *x = list(map(int, open(0).read().split()))
NX = N * max(x + [A])
y = [0] + [v - A for v in x]
dp = [[0] * (2 * NX + 1) for _ in range(N + 1)]
dp[0][NX] = 1
for j in range(1, N + 1):
for t in range(2 * NX + 1):
if t - y[j] < 0 or t - y[j] > 2 * NX:
dp[j][t] = dp[j - 1][t]
... | 17 | 15 | 521 | 449 | N, A, *x = list(map(int, open(0).read().split()))
c_nx = N * max(x + [A])
dp = [[[0] * (c_nx + 1) for _ in range(N + 1)] for _ in range(N + 1)]
x = [0] + x
dp[0][0][0] = 1
for j in range(1, N + 1):
for k in range(N + 1):
for s in range(c_nx + 1):
if s < x[j]:
dp[j][k][s] = dp[j -... | N, A, *x = list(map(int, open(0).read().split()))
NX = N * max(x + [A])
y = [0] + [v - A for v in x]
dp = [[0] * (2 * NX + 1) for _ in range(N + 1)]
dp[0][NX] = 1
for j in range(1, N + 1):
for t in range(2 * NX + 1):
if t - y[j] < 0 or t - y[j] > 2 * NX:
dp[j][t] = dp[j - 1][t]
elif 0 <=... | false | 11.764706 | [
"-c_nx = N * max(x + [A])",
"-dp = [[[0] * (c_nx + 1) for _ in range(N + 1)] for _ in range(N + 1)]",
"-x = [0] + x",
"-dp[0][0][0] = 1",
"+NX = N * max(x + [A])",
"+y = [0] + [v - A for v in x]",
"+dp = [[0] * (2 * NX + 1) for _ in range(N + 1)]",
"+dp[0][NX] = 1",
"- for k in range(N + 1):",
... | false | 0.043307 | 0.041738 | 1.037593 | [
"s667106039",
"s370387569"
] |
u596276291 | p03699 | python | s574157137 | s340135501 | 74 | 26 | 3,436 | 3,952 | Accepted | Accepted | 64.86 | from collections import defaultdict
def main():
N = int(eval(input()))
s_list = [int(eval(input())) for _ in range(N)]
dp = [False] * (100 * 100 + 1)
dp[0] = True
for s in s_list:
for i in range(len(dp) - 1, -1, -1):
if dp[i]:
dp[i + s] = True
... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 23 | 41 | 482 | 979 | from collections import defaultdict
def main():
N = int(eval(input()))
s_list = [int(eval(input())) for _ in range(N)]
dp = [False] * (100 * 100 + 1)
dp[0] = True
for s in s_list:
for i in range(len(dp) - 1, -1, -1):
if dp[i]:
dp[i + s] = True
for i in range... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 43.902439 | [
"-from collections import defaultdict",
"+from collections import defaultdict, Counter",
"+from itertools import product, groupby, count, permutations, combinations",
"+from math import pi, sqrt",
"+from collections import deque",
"+from bisect import bisect, bisect_left, bisect_right",
"+from string im... | false | 0.037946 | 0.037508 | 1.011693 | [
"s574157137",
"s340135501"
] |
u325227960 | p02803 | python | s988698211 | s861375069 | 582 | 278 | 31,456 | 47,836 | Accepted | Accepted | 52.23 | h,w = list(map(int,input().split()))
S = [eval(input()) for i in range(h)]
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
m = h*w
N = [[float("inf")]* m for i in range(m)]
for i in range(m):
N[i][i] = 0
for i in range(h):
for j in range(w):
t=w*i+j
if S[i... | h,w = list(map(int,input().split()))
S = [eval(input()) for i in range(h)]
ans = -1
for si in range(h):
for sj in range(w):
if S[si][sj] == ".":
V = [[-1] * w for i in range(h)]
Q = [[si, sj, 0]]
s = 0
V[si][sj] = 0
while s < len(Q):
... | 44 | 28 | 963 | 846 | h, w = list(map(int, input().split()))
S = [eval(input()) for i in range(h)]
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
m = h * w
N = [[float("inf")] * m for i in range(m)]
for i in range(m):
N[i][i] = 0
for i in range(h):
for j in range(w):
t = w * i + j
if S[i][j] != "... | h, w = list(map(int, input().split()))
S = [eval(input()) for i in range(h)]
ans = -1
for si in range(h):
for sj in range(w):
if S[si][sj] == ".":
V = [[-1] * w for i in range(h)]
Q = [[si, sj, 0]]
s = 0
V[si][sj] = 0
while s < len(Q):
... | false | 36.363636 | [
"-import numpy as np",
"-from scipy.sparse.csgraph import floyd_warshall",
"-",
"-m = h * w",
"-N = [[float(\"inf\")] * m for i in range(m)]",
"-for i in range(m):",
"- N[i][i] = 0",
"-for i in range(h):",
"- for j in range(w):",
"- t = w * i + j",
"- if S[i][j] != \"#\":",
... | false | 0.445578 | 0.086513 | 5.150393 | [
"s988698211",
"s861375069"
] |
u588341295 | p03295 | python | s758862920 | s161538657 | 514 | 260 | 27,868 | 18,264 | Accepted | Accepted | 49.42 | # -*- coding: utf-8 -*-
N,M = list(map(int, input().split()))
abM = [list(map(int, input().split())) for i in range(M)]
abM.sort()
tmp_e = abM[0][1]
cnt = 1
for i in range(1,M):
if tmp_e > abM[i][0]:
tmp_e = min(abM[i][1], tmp_e)
else:
cnt += 1
tmp_e = abM[i][1]
print... | # -*- coding: utf-8 -*-
import sys
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range... | 17 | 37 | 319 | 1,014 | # -*- coding: utf-8 -*-
N, M = list(map(int, input().split()))
abM = [list(map(int, input().split())) for i in range(M)]
abM.sort()
tmp_e = abM[0][1]
cnt = 1
for i in range(1, M):
if tmp_e > abM[i][0]:
tmp_e = min(abM[i][1], tmp_e)
else:
cnt += 1
tmp_e = abM[i][1]
print(cnt)
| # -*- coding: utf-8 -*-
import sys
from operator import itemgetter
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d ... | false | 54.054054 | [
"-N, M = list(map(int, input().split()))",
"-abM = [list(map(int, input().split())) for i in range(M)]",
"-abM.sort()",
"-tmp_e = abM[0][1]",
"-cnt = 1",
"-for i in range(1, M):",
"- if tmp_e > abM[i][0]:",
"- tmp_e = min(abM[i][1], tmp_e)",
"- else:",
"+import sys",
"+from operator... | false | 0.07036 | 0.090376 | 0.778524 | [
"s758862920",
"s161538657"
] |
u489959379 | p03287 | python | s004752836 | s303387416 | 89 | 79 | 21,448 | 25,720 | Accepted | Accepted | 11.24 | import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A_sum = [0]
D = defaultdict(int)
D[A_sum[-1]] +... | import sys
from itertools import accumulate
from collections import Counter
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
R = [0] + list(accumulate(A))
R_mod = [r % m for r... | 28 | 25 | 542 | 482 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A_sum = [0]
D = defaultdict(int)
D[A_sum[-1]] += 1
for a in A:
... | import sys
from itertools import accumulate
from collections import Counter
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
R = [0] + list(accumulate(A))
R_mod = [r % m for r in R]
D = Coun... | false | 10.714286 | [
"-from collections import defaultdict",
"+from itertools import accumulate",
"+from collections import Counter",
"-input = sys.stdin.readline",
"- A_sum = [0]",
"- D = defaultdict(int)",
"- D[A_sum[-1]] += 1",
"- for a in A:",
"- A_sum.append((A_sum[-1] + a) % m)",
"- D[A... | false | 0.068473 | 0.037071 | 1.847066 | [
"s004752836",
"s303387416"
] |
u150984829 | p02381 | python | s647629155 | s677399359 | 40 | 20 | 5,672 | 5,736 | Accepted | Accepted | 50 | while 1:
n=int(eval(input()))
if n==0:break
s=[int(x) for x in input().split()]
print(((sum([(m-sum(s)/n)**2 for m in s])/n)**.5)) | while 1:
n=int(eval(input()))
if n==0:break
s=input().split()
a=sum([int(x) for x in s])/n
print(((sum([int(x)**2 for x in s])/n-a*a)**.5)) | 5 | 6 | 130 | 141 | while 1:
n = int(eval(input()))
if n == 0:
break
s = [int(x) for x in input().split()]
print(((sum([(m - sum(s) / n) ** 2 for m in s]) / n) ** 0.5))
| while 1:
n = int(eval(input()))
if n == 0:
break
s = input().split()
a = sum([int(x) for x in s]) / n
print(((sum([int(x) ** 2 for x in s]) / n - a * a) ** 0.5))
| false | 16.666667 | [
"- s = [int(x) for x in input().split()]",
"- print(((sum([(m - sum(s) / n) ** 2 for m in s]) / n) ** 0.5))",
"+ s = input().split()",
"+ a = sum([int(x) for x in s]) / n",
"+ print(((sum([int(x) ** 2 for x in s]) / n - a * a) ** 0.5))"
] | false | 0.039302 | 0.042941 | 0.915244 | [
"s647629155",
"s677399359"
] |
u408071652 | p02594 | python | s800574321 | s238787637 | 92 | 32 | 61,664 | 9,052 | Accepted | Accepted | 65.22 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
X =int(eval(input()))
if X<30:
print("No")
else:
print("Yes")
pass
if __name__ == "__main__":
main()
| x=int(eval(input()))
if x >=30:
print("Yes")
else:
print("No") | 20 | 5 | 235 | 64 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
X = int(eval(input()))
if X < 30:
print("No")
else:
print("Yes")
pass
if __name__ == "__main__":
main()
| x = int(eval(input()))
if x >= 30:
print("Yes")
else:
print("No")
| false | 75 | [
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"-def main():",
"- X = int(eval(input()))",
"- if X < 30:",
"- print(\"No\")",
"- else:",
"- print(\"Yes\")",
"- pass",
"-",
"-",
"-if __name__ == \"__main__\":"... | false | 0.038285 | 0.036232 | 1.056685 | [
"s800574321",
"s238787637"
] |
u414980766 | p02923 | python | s073805581 | s943576212 | 112 | 79 | 14,252 | 14,252 | Accepted | Accepted | 29.46 | N = int(eval(input()))
H = list(map(int, input().split()))
dp = [- 1]*N
dp[-1] = 0
res = 0
for i in range(N - 2, - 1, - 1):
if H[i] >= H[i + 1]:
dp[i] = dp[i + 1] + 1
res = max(res, dp[i])
else:
dp[i] = 0
print(res) | N = int(eval(input()))
H = list(map(int, input().split()))
dp = [- 1]*N
dp[-1] = 0
for i in range(N - 2, - 1, - 1):
if H[i] >= H[i + 1]:
dp[i] = dp[i + 1] + 1
else:
dp[i] = 0
print((max(dp))) | 12 | 10 | 252 | 216 | N = int(eval(input()))
H = list(map(int, input().split()))
dp = [-1] * N
dp[-1] = 0
res = 0
for i in range(N - 2, -1, -1):
if H[i] >= H[i + 1]:
dp[i] = dp[i + 1] + 1
res = max(res, dp[i])
else:
dp[i] = 0
print(res)
| N = int(eval(input()))
H = list(map(int, input().split()))
dp = [-1] * N
dp[-1] = 0
for i in range(N - 2, -1, -1):
if H[i] >= H[i + 1]:
dp[i] = dp[i + 1] + 1
else:
dp[i] = 0
print((max(dp)))
| false | 16.666667 | [
"-res = 0",
"- res = max(res, dp[i])",
"-print(res)",
"+print((max(dp)))"
] | false | 0.037395 | 0.037658 | 0.992998 | [
"s073805581",
"s943576212"
] |
u671060652 | p03244 | python | s551706295 | s641354791 | 104 | 93 | 99,736 | 85,684 | Accepted | Accepted | 10.58 |
n = int(eval(input()))
v = list(map(int, input().split()))
kisu = [0]*(10**6)
gusu = [0]*(10**6)
for i in range(n):
if i % 2 == 0:
gusu[v[i]] += 1
else:
kisu[v[i]] += 1
count = 0
gusu_m = gusu.index(max(gusu))
kisu_m = kisu.index(max(kisu))
if gusu_m == kisu_m:
gusu[gu... | def main():
n = int(eval(input()))
# n, k = map(int, input().split())
v = list(map(int, input().split()))
# s = input()
even = [0] * (10 ** 5 + 100)
odd = [0] * (10 ** 5 + 100)
for i in range(n):
if i % 2 == 0:
even[v[i]] += 1
else:
odd[... | 32 | 37 | 624 | 855 | n = int(eval(input()))
v = list(map(int, input().split()))
kisu = [0] * (10**6)
gusu = [0] * (10**6)
for i in range(n):
if i % 2 == 0:
gusu[v[i]] += 1
else:
kisu[v[i]] += 1
count = 0
gusu_m = gusu.index(max(gusu))
kisu_m = kisu.index(max(kisu))
if gusu_m == kisu_m:
gusu[gusu_m] = 0
kisu[... | def main():
n = int(eval(input()))
# n, k = map(int, input().split())
v = list(map(int, input().split()))
# s = input()
even = [0] * (10**5 + 100)
odd = [0] * (10**5 + 100)
for i in range(n):
if i % 2 == 0:
even[v[i]] += 1
else:
odd[v[i]] += 1
max_... | false | 13.513514 | [
"-n = int(eval(input()))",
"-v = list(map(int, input().split()))",
"-kisu = [0] * (10**6)",
"-gusu = [0] * (10**6)",
"-for i in range(n):",
"- if i % 2 == 0:",
"- gusu[v[i]] += 1",
"- else:",
"- kisu[v[i]] += 1",
"-count = 0",
"-gusu_m = gusu.index(max(gusu))",
"-kisu_m = k... | false | 0.359382 | 0.056223 | 6.392046 | [
"s551706295",
"s641354791"
] |
u077291787 | p03627 | python | s826398704 | s157330492 | 193 | 97 | 21,660 | 18,592 | Accepted | Accepted | 49.74 | # ARC081C - Make a Rectangle
from collections import Counter
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = sorted(Counter(lst).most_common(), reverse=True)
ans = []
for i, j in cnt:
if len(ans) >= 2:
break
if j >= 4:... | # ARC081C - Make a Rectangle (ABC071C)
from collections import Counter
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = sorted(
list({k: v for k, v in list(Counter(lst).items()) if v >= 2}.items()), reverse=True
)
if cnt == []:
prin... | 21 | 20 | 482 | 456 | # ARC081C - Make a Rectangle
from collections import Counter
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = sorted(Counter(lst).most_common(), reverse=True)
ans = []
for i, j in cnt:
if len(ans) >= 2:
break
if j >= 4:
... | # ARC081C - Make a Rectangle (ABC071C)
from collections import Counter
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = sorted(
list({k: v for k, v in list(Counter(lst).items()) if v >= 2}.items()),
reverse=True,
)
if cnt == []:
print(... | false | 4.761905 | [
"-# ARC081C - Make a Rectangle",
"+# ARC081C - Make a Rectangle (ABC071C)",
"- cnt = sorted(Counter(lst).most_common(), reverse=True)",
"- ans = []",
"- for i, j in cnt:",
"- if len(ans) >= 2:",
"- break",
"- if j >= 4:",
"- ans += [i] + [i]",
"- ... | false | 0.083139 | 0.087531 | 0.949823 | [
"s826398704",
"s157330492"
] |
u189479417 | p02577 | python | s052203546 | s059236044 | 219 | 72 | 9,132 | 9,256 | Accepted | Accepted | 67.12 | N = int(eval(input()))
if N % 9 == 0:
print('Yes')
else:
print('No') | N = eval(input())
SUM = 0
for i in N:
SUM += int(i)
if SUM % 9 == 0:
print('Yes')
else:
print('No') | 6 | 10 | 76 | 116 | N = int(eval(input()))
if N % 9 == 0:
print("Yes")
else:
print("No")
| N = eval(input())
SUM = 0
for i in N:
SUM += int(i)
if SUM % 9 == 0:
print("Yes")
else:
print("No")
| false | 40 | [
"-N = int(eval(input()))",
"-if N % 9 == 0:",
"+N = eval(input())",
"+SUM = 0",
"+for i in N:",
"+ SUM += int(i)",
"+if SUM % 9 == 0:"
] | false | 0.044807 | 0.078383 | 0.571638 | [
"s052203546",
"s059236044"
] |
u724548524 | p02283 | python | s055673446 | s066819782 | 6,250 | 3,530 | 125,576 | 63,332 | Accepted | Accepted | 43.52 | import sys
class Node():
def __init__(self, parent = -1, left = -1, right = -1):
self.parent = parent
self.left = left
self.right = right
def __eq__(self, other):
if self.num == other.num:
return True
else:
return False
def... | import sys
class Node():
__slots__ = ['key', 'left', 'right']
def __init__(self, key):
self.key = key
self.left, self.right = None, None
def __str__(self):
return self.key
root = None
def insert(z):
global root
x, y = root, None
while x:
... | 61 | 44 | 1,329 | 931 | import sys
class Node:
def __init__(self, parent=-1, left=-1, right=-1):
self.parent = parent
self.left = left
self.right = right
def __eq__(self, other):
if self.num == other.num:
return True
else:
return False
def insert(node, z):
global... | import sys
class Node:
__slots__ = ["key", "left", "right"]
def __init__(self, key):
self.key = key
self.left, self.right = None, None
def __str__(self):
return self.key
root = None
def insert(z):
global root
x, y = root, None
while x:
y = x
if z <... | false | 27.868852 | [
"- def __init__(self, parent=-1, left=-1, right=-1):",
"- self.parent = parent",
"- self.left = left",
"- self.right = right",
"+ __slots__ = [\"key\", \"left\", \"right\"]",
"- def __eq__(self, other):",
"- if self.num == other.num:",
"- return True",
... | false | 0.039285 | 0.045713 | 0.859374 | [
"s055673446",
"s066819782"
] |
u191635495 | p03416 | python | s289068464 | s260886338 | 66 | 19 | 2,940 | 3,060 | Accepted | Accepted | 71.21 | A, B = list(map(int, input().split()))
res = 0
for i in range(A, B+1):
if str(i) == str(i)[::-1]:
res += 1
print(res) | A, B = list(map(int, input().split()))
res = 0
for i in range(10):
for j in range(10):
for k in range(10):
cand = int(''.join([str(i), str(j), str(k), str(j), str(i)]))
if A <= cand <= B:
res += 1
print(res) | 8 | 12 | 132 | 267 | A, B = list(map(int, input().split()))
res = 0
for i in range(A, B + 1):
if str(i) == str(i)[::-1]:
res += 1
print(res)
| A, B = list(map(int, input().split()))
res = 0
for i in range(10):
for j in range(10):
for k in range(10):
cand = int("".join([str(i), str(j), str(k), str(j), str(i)]))
if A <= cand <= B:
res += 1
print(res)
| false | 33.333333 | [
"-for i in range(A, B + 1):",
"- if str(i) == str(i)[::-1]:",
"- res += 1",
"+for i in range(10):",
"+ for j in range(10):",
"+ for k in range(10):",
"+ cand = int(\"\".join([str(i), str(j), str(k), str(j), str(i)]))",
"+ if A <= cand <= B:",
"+ ... | false | 0.104471 | 0.055276 | 1.890009 | [
"s289068464",
"s260886338"
] |
u098012509 | p02899 | python | s921127774 | s055012447 | 255 | 226 | 23,460 | 26,476 | Accepted | Accepted | 11.37 | import sys
input = sys.stdin.readline
from operator import itemgetter
def main():
N = int(input())
A = [int(x) for x in input().split()]
B = []
for i in range(1, N + 1):
B.append([A[i - 1], i])
B_sorted = sorted(B, key=itemgetter(0))
for x in B_sorted:
print(x[1]... | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = []
for i, a in enumerate(A):
B.append([a, i + 1])
B.sort()
ans = []
for b in B:
ans.append(b[1])
print((*ans))
| 20 | 15 | 381 | 195 | import sys
input = sys.stdin.readline
from operator import itemgetter
def main():
N = int(input())
A = [int(x) for x in input().split()]
B = []
for i in range(1, N + 1):
B.append([A[i - 1], i])
B_sorted = sorted(B, key=itemgetter(0))
for x in B_sorted:
print(x[1], end=" ")
i... | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = []
for i, a in enumerate(A):
B.append([a, i + 1])
B.sort()
ans = []
for b in B:
ans.append(b[1])
print((*ans))
| false | 25 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from operator import itemgetter",
"-",
"-",
"-def main():",
"- N = int(input())",
"- A = [int(x) for x in input().split()]",
"- B = []",
"- for i in range(1, N + 1):",
"- B.append([A[i - 1], i])",
"- B_sorted = sorted... | false | 0.007466 | 0.035353 | 0.211195 | [
"s921127774",
"s055012447"
] |
u021548497 | p04016 | python | s360376935 | s076954084 | 635 | 319 | 64,072 | 74,080 | Accepted | Accepted | 49.76 | import sys
input = sys.stdin.readline
def digit_sum(n, b):
res = 0
while n > 0:
res += n % b
n //= b
return res
def main():
n = int(eval(input()))
s = int(eval(input()))
ans = -1
if n < s:
ans = -1
elif n == s:
ans = n + 1
els... | import sys
input = sys.stdin.readline
def digit_sum(n, b):
if b == 1:
return n
res = 0
while n > 0:
res += n % b
n //= b
return res
def main():
n = int(eval(input()))
s = int(eval(input()))
ans = -1
if n == s:
ans = n + 1
else... | 65 | 46 | 1,529 | 1,021 | import sys
input = sys.stdin.readline
def digit_sum(n, b):
res = 0
while n > 0:
res += n % b
n //= b
return res
def main():
n = int(eval(input()))
s = int(eval(input()))
ans = -1
if n < s:
ans = -1
elif n == s:
ans = n + 1
else:
key = []
... | import sys
input = sys.stdin.readline
def digit_sum(n, b):
if b == 1:
return n
res = 0
while n > 0:
res += n % b
n //= b
return res
def main():
n = int(eval(input()))
s = int(eval(input()))
ans = -1
if n == s:
ans = n + 1
else:
for b in ra... | false | 29.230769 | [
"+ if b == 1:",
"+ return n",
"- if n < s:",
"- ans = -1",
"- elif n == s:",
"+ if n == s:",
"- key = []",
"- start, first = n, 1",
"- for i in range(1, n):",
"- first = digit_sum(n, start)",
"- end = start - n // i // (i + 1)"... | false | 0.045518 | 0.03963 | 1.148581 | [
"s360376935",
"s076954084"
] |
u516272298 | p03107 | python | s046285328 | s403438075 | 31 | 18 | 4,784 | 3,188 | Accepted | Accepted | 41.94 | s = list(sorted(str(eval(input()))))
print((min(s.count("0"),s.count("1"))*2)) | s = str(eval(input()))
a = s.count("1")
b = s.count("0")
if a == b:
print((2*a))
elif a > b:
print((2*b))
elif a < b:
print((2*a)) | 2 | 9 | 71 | 138 | s = list(sorted(str(eval(input()))))
print((min(s.count("0"), s.count("1")) * 2))
| s = str(eval(input()))
a = s.count("1")
b = s.count("0")
if a == b:
print((2 * a))
elif a > b:
print((2 * b))
elif a < b:
print((2 * a))
| false | 77.777778 | [
"-s = list(sorted(str(eval(input()))))",
"-print((min(s.count(\"0\"), s.count(\"1\")) * 2))",
"+s = str(eval(input()))",
"+a = s.count(\"1\")",
"+b = s.count(\"0\")",
"+if a == b:",
"+ print((2 * a))",
"+elif a > b:",
"+ print((2 * b))",
"+elif a < b:",
"+ print((2 * a))"
] | false | 0.037916 | 0.061145 | 0.620101 | [
"s046285328",
"s403438075"
] |
u729133443 | p02928 | python | s666738677 | s650549152 | 809 | 531 | 3,188 | 3,188 | Accepted | Accepted | 34.36 | n,k,*a=list(map(int,open(0).read().split()))
l=k*~-k//2
s=0
for i,c in enumerate(a):
for d in a[i:]:s+=l*(c<d)+(l+k)*(c>d)
print((s%(10**9+7))) | n,k,*a=list(map(int,open(0).read().split()))
l=k*~-k//2
print((sum(l*(c<d)+(l+k)*(c>d)for i,c in enumerate(a)for d in a[i:])%(10**9+7))) | 6 | 3 | 141 | 130 | n, k, *a = list(map(int, open(0).read().split()))
l = k * ~-k // 2
s = 0
for i, c in enumerate(a):
for d in a[i:]:
s += l * (c < d) + (l + k) * (c > d)
print((s % (10**9 + 7)))
| n, k, *a = list(map(int, open(0).read().split()))
l = k * ~-k // 2
print(
(
sum(l * (c < d) + (l + k) * (c > d) for i, c in enumerate(a) for d in a[i:])
% (10**9 + 7)
)
)
| false | 50 | [
"-s = 0",
"-for i, c in enumerate(a):",
"- for d in a[i:]:",
"- s += l * (c < d) + (l + k) * (c > d)",
"-print((s % (10**9 + 7)))",
"+print(",
"+ (",
"+ sum(l * (c < d) + (l + k) * (c > d) for i, c in enumerate(a) for d in a[i:])",
"+ % (10**9 + 7)",
"+ )",
"+)"
] | false | 0.107279 | 0.079775 | 1.344773 | [
"s666738677",
"s650549152"
] |
u069838609 | p03209 | python | s971831376 | s314495073 | 29 | 18 | 3,940 | 3,064 | Accepted | Accepted | 37.93 | from functools import lru_cache
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
h_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = 3 + 2 * h_burger[i - 1]
@lru_cache(None)
def num_patties(l, x):
if x == 0:
return 0
elif l == 0:
return 1
... | N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
p_burger = [None] * (N + 1)
h_burger[0] = 1
p_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = h_burger[i - 1] * 2 + 3
p_burger[i] = p_burger[i - 1] * 2 + 1
def num_patties(l, x):
if l == 0:
return 1 if x >... | 28 | 24 | 684 | 656 | from functools import lru_cache
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
h_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = 3 + 2 * h_burger[i - 1]
@lru_cache(None)
def num_patties(l, x):
if x == 0:
return 0
elif l == 0:
return 1
else:
if... | N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
p_burger = [None] * (N + 1)
h_burger[0] = 1
p_burger[0] = 1
for i in range(1, N + 1):
h_burger[i] = h_burger[i - 1] * 2 + 3
p_burger[i] = p_burger[i - 1] * 2 + 1
def num_patties(l, x):
if l == 0:
return 1 if x >= 1 else 0
... | false | 14.285714 | [
"-from functools import lru_cache",
"-",
"+p_burger = [None] * (N + 1)",
"+p_burger[0] = 1",
"- h_burger[i] = 3 + 2 * h_burger[i - 1]",
"+ h_burger[i] = h_burger[i - 1] * 2 + 3",
"+ p_burger[i] = p_burger[i - 1] * 2 + 1",
"-@lru_cache(None)",
"- if x == 0:",
"- return 0",
"- ... | false | 0.033767 | 0.038303 | 0.88157 | [
"s971831376",
"s314495073"
] |
u166306121 | p03044 | python | s042959125 | s670896429 | 989 | 777 | 43,708 | 78,252 | Accepted | Accepted | 21.44 | import sys
input = sys.stdin.readline
def ii(): return int(eval(input()))
def mi(): return list(map(int, input().rstrip().split()))
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template
# BEGIN CUT HERE
from queue import Queue
def bfs(field, sy, sx, wal... | import sys
input = sys.stdin.readline
def ii(): return int(eval(input()))
def mi(): return list(map(int, input().rstrip().split()))
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template
# BEGIN CUT HERE
from queue import Queue
def bfs(field, sy, sx, wal... | 104 | 104 | 2,715 | 2,780 | import sys
input = sys.stdin.readline
def ii():
return int(eval(input()))
def mi():
return list(map(int, input().rstrip().split()))
def lmi():
return list(map(int, input().rstrip().split()))
def li():
return list(input().rstrip())
# template
# BEGIN CUT HERE
from queue import Queue
def bfs(... | import sys
input = sys.stdin.readline
def ii():
return int(eval(input()))
def mi():
return list(map(int, input().rstrip().split()))
def lmi():
return list(map(int, input().rstrip().split()))
def li():
return list(input().rstrip())
# template
# BEGIN CUT HERE
from queue import Queue
def bfs(... | false | 0 | [
"- is_bipartite = True",
"+# verified on 2019/06/28",
"+# Python3 https://atcoder.jp/contests/abc126/submissions/6141196"
] | false | 0.040498 | 0.077696 | 0.521237 | [
"s042959125",
"s670896429"
] |
u941753895 | p02702 | python | s962376242 | s277397296 | 385 | 191 | 21,352 | 21,764 | Accepted | Accepted | 50.39 | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) f... | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) f... | 60 | 65 | 1,176 | 1,229 | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | false | 7.692308 | [
"+# ็ดฏ็ฉๅใฎๆธใๆนใใใใชใใใค",
"- s = s[::-1]",
"- rl = [0] * (n + 1)",
"- for i, x in enumerate(s):",
"- rl[i + 1] = (int(x) * pow(10, i, 2019)) % 2019",
"- for i in range(n):",
"- rl[i + 1] += rl[i]",
"- rl[i + 1] %= 2019",
"- sl = summarizeList(rl)",
"+ l = []",
"... | false | 0.042843 | 0.036784 | 1.164713 | [
"s962376242",
"s277397296"
] |
u670180528 | p03700 | python | s800466707 | s225372117 | 1,424 | 1,156 | 14,092 | 14,092 | Accepted | Accepted | 18.82 | n,a,b,*H=list(map(int,open(0).read().split()))
l,r=0,10**9
while r-l>1:
x=0;m=(l+r)//2
for h in H:
x-=min(0,(h-m*b)//(b-a))
if x>m:
l=m
else:
r=m
print(r) | _,a,b,*H=list(map(int,open(0).read().split()))
l,r=0,10**9
while r-l>1:
m=(l+r)//2
if-sum(min(0,(h-m*b)//(b-a))for h in H)>m:l=m
else:r=m
print(r) | 11 | 7 | 168 | 149 | n, a, b, *H = list(map(int, open(0).read().split()))
l, r = 0, 10**9
while r - l > 1:
x = 0
m = (l + r) // 2
for h in H:
x -= min(0, (h - m * b) // (b - a))
if x > m:
l = m
else:
r = m
print(r)
| _, a, b, *H = list(map(int, open(0).read().split()))
l, r = 0, 10**9
while r - l > 1:
m = (l + r) // 2
if -sum(min(0, (h - m * b) // (b - a)) for h in H) > m:
l = m
else:
r = m
print(r)
| false | 36.363636 | [
"-n, a, b, *H = list(map(int, open(0).read().split()))",
"+_, a, b, *H = list(map(int, open(0).read().split()))",
"- x = 0",
"- for h in H:",
"- x -= min(0, (h - m * b) // (b - a))",
"- if x > m:",
"+ if -sum(min(0, (h - m * b) // (b - a)) for h in H) > m:"
] | false | 0.175253 | 0.109595 | 1.599097 | [
"s800466707",
"s225372117"
] |
u919730120 | p02813 | python | s208493839 | s200747673 | 231 | 86 | 46,832 | 16,656 | Accepted | Accepted | 62.77 | import itertools
n=int(eval(input()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
s=list(itertools.permutations(list(range(1,n+1))))
a=b=-1
for i in range(len(s)):
if p==list(s[i]):
a=i
if q==list(s[i]):
b=i
if a>=0 and b>=0:
break
print((abs(a-b))) | from bisect import bisect_left
from itertools import permutations
n=int(eval(input()))
p=''.join(map(str,input().split()))
q=''.join(map(str,input().split()))
l=list(range(1,n+1))
A=list(permutations(l,n))
A=[''.join(map(str,i)) for i in A]
A.sort()
a=bisect_left(A,p)
b=bisect_left(A,q)
print((abs(a-b))) | 14 | 12 | 288 | 308 | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
s = list(itertools.permutations(list(range(1, n + 1))))
a = b = -1
for i in range(len(s)):
if p == list(s[i]):
a = i
if q == list(s[i]):
b = i
if a >= 0 and b >= 0:
break
... | from bisect import bisect_left
from itertools import permutations
n = int(eval(input()))
p = "".join(map(str, input().split()))
q = "".join(map(str, input().split()))
l = list(range(1, n + 1))
A = list(permutations(l, n))
A = ["".join(map(str, i)) for i in A]
A.sort()
a = bisect_left(A, p)
b = bisect_left(A, q)
print(... | false | 14.285714 | [
"-import itertools",
"+from bisect import bisect_left",
"+from itertools import permutations",
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"-s = list(itertools.permutations(list(range(1, n + 1))))",
"-a = b = -1",
"-for i in range(len(s)):",
"- if p == list(s[i... | false | 0.044314 | 0.064311 | 0.689061 | [
"s208493839",
"s200747673"
] |
u614181788 | p02732 | python | s133056157 | s717044315 | 495 | 296 | 26,268 | 32,224 | Accepted | Accepted | 40.2 | n = int(eval(input()))
a = list(map(int,input().split()))
import collections
c = collections.Counter(a)
ans = 0
for i in list(c.values()):
ans += i*(i-1)//2
for i in range(n):
print((ans - c[a[i]]*(c[a[i]]-1)//2 + (c[a[i]]-1)*(c[a[i]]-2)//2))
| n = int(eval(input()))
a = list(map(int,input().split()))
s = [0]*(n+1)
for x in a:
s[x] += 1
p = 0
for i in range(1,n+1):
if s[i] >= 2:
p += s[i]*(s[i]-1)//2
for i in range(n):
ans = p - s[a[i]]*(s[a[i]]-1)//2 + (s[a[i]]-2)*(s[a[i]]-1)//2
print(ans) | 10 | 16 | 256 | 291 | n = int(eval(input()))
a = list(map(int, input().split()))
import collections
c = collections.Counter(a)
ans = 0
for i in list(c.values()):
ans += i * (i - 1) // 2
for i in range(n):
print((ans - c[a[i]] * (c[a[i]] - 1) // 2 + (c[a[i]] - 1) * (c[a[i]] - 2) // 2))
| n = int(eval(input()))
a = list(map(int, input().split()))
s = [0] * (n + 1)
for x in a:
s[x] += 1
p = 0
for i in range(1, n + 1):
if s[i] >= 2:
p += s[i] * (s[i] - 1) // 2
for i in range(n):
ans = p - s[a[i]] * (s[a[i]] - 1) // 2 + (s[a[i]] - 2) * (s[a[i]] - 1) // 2
print(ans)
| false | 37.5 | [
"-import collections",
"-",
"-c = collections.Counter(a)",
"-ans = 0",
"-for i in list(c.values()):",
"- ans += i * (i - 1) // 2",
"+s = [0] * (n + 1)",
"+for x in a:",
"+ s[x] += 1",
"+p = 0",
"+for i in range(1, n + 1):",
"+ if s[i] >= 2:",
"+ p += s[i] * (s[i] - 1) // 2",
... | false | 0.032582 | 0.041825 | 0.778995 | [
"s133056157",
"s717044315"
] |
u250583425 | p02820 | python | s303332692 | s807188226 | 54 | 45 | 4,212 | 4,084 | Accepted | Accepted | 16.67 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
pre = []
def win_point(a):
if a == 'r':
pre.append('r')
return p
elif a =... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
pre = ['x'] * n
ans = 0
for i, j in enumerate(t):
if i < k or j != pre[i-k]:
pre[i] = j
... | 32 | 23 | 689 | 509 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
pre = []
def win_point(a):
if a == "r":
pre.append("r")
return p
elif a == "s":... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
pre = ["x"] * n
ans = 0
for i, j in enumerate(t):
if i < k or j != pre[i - k]:
pre[i] = j
... | false | 28.125 | [
"- pre = []",
"-",
"- def win_point(a):",
"- if a == \"r\":",
"- pre.append(\"r\")",
"- return p",
"- elif a == \"s\":",
"- pre.append(\"s\")",
"- return r",
"- else:",
"- pre.append(\"p\")",
"- return... | false | 0.082289 | 0.082963 | 0.991885 | [
"s303332692",
"s807188226"
] |
u614063956 | p02658 | python | s102461877 | s662063376 | 1,607 | 49 | 21,644 | 21,644 | Accepted | Accepted | 96.95 | n = int(eval(input()))
arr = list(map(int, input().split()))
while len(arr) > 1:
m = len(arr)
if m & 1:
arr.append(1)
m += 1
left, right = arr[:m // 2], arr[m // 2:]
arr = [x * y for x, y in zip(left, right)]
x = arr[0]
if x > 10 ** 18:
print((-1))
else:
print(... | n = int(eval(input()))
arr = list(map(int, input().split()))
if 0 in arr:
print((0))
exit(0)
prod = 1
for a in arr:
prod *= a
if prod > 1000000000000000000:
print((-1))
exit(0)
print(prod)
| 17 | 15 | 315 | 228 | n = int(eval(input()))
arr = list(map(int, input().split()))
while len(arr) > 1:
m = len(arr)
if m & 1:
arr.append(1)
m += 1
left, right = arr[: m // 2], arr[m // 2 :]
arr = [x * y for x, y in zip(left, right)]
x = arr[0]
if x > 10**18:
print((-1))
else:
print(x)
| n = int(eval(input()))
arr = list(map(int, input().split()))
if 0 in arr:
print((0))
exit(0)
prod = 1
for a in arr:
prod *= a
if prod > 1000000000000000000:
print((-1))
exit(0)
print(prod)
| false | 11.764706 | [
"-while len(arr) > 1:",
"- m = len(arr)",
"- if m & 1:",
"- arr.append(1)",
"- m += 1",
"- left, right = arr[: m // 2], arr[m // 2 :]",
"- arr = [x * y for x, y in zip(left, right)]",
"-x = arr[0]",
"-if x > 10**18:",
"- print((-1))",
"-else:",
"- print(x)",
"... | false | 0.040704 | 0.035009 | 1.162682 | [
"s102461877",
"s662063376"
] |
u179169725 | p03739 | python | s548211177 | s443810703 | 260 | 113 | 61,780 | 95,136 | Accepted | Accepted | 56.54 | # https://atcoder.jp/contests/abc059/tasks/arc072_a
# ็ดฏ็ฉๅใไฝใฃใฆใใใฆใใใฎ็ดฏ็ฉๅใฎ็ฌฆๅทใไบคไบใซใชใใใใซใใฆใใ
# ็ดฏ็ฉๅใฎiไปฅ้ใฎ่ฆ็ด ใใในใฆๅคๆดใใไปฃใใใซใใใค่ถณใใฐใใใฎใๆใฃใฆใใ(imosๆณใฎใคใกใผใธ)
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
class cumsum1d: # ไธๆฌก... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# ๅใๆธกใใใใในใฆใฎ่ฆ็ด ใใsubใ ใๅผใ.ใชในใใ*ใใคใใฆๅฑ้ใใฆใใใใจ
def a_int(): return int(read... | 63 | 111 | 1,429 | 2,389 | # https://atcoder.jp/contests/abc059/tasks/arc072_a
# ็ดฏ็ฉๅใไฝใฃใฆใใใฆใใใฎ็ดฏ็ฉๅใฎ็ฌฆๅทใไบคไบใซใชใใใใซใใฆใใ
# ็ดฏ็ฉๅใฎiไปฅ้ใฎ่ฆ็ด ใใในใฆๅคๆดใใไปฃใใใซใใใค่ถณใใฐใใใฎใๆใฃใฆใใ(imosๆณใฎใคใกใผใธ)
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
class cumsum1d: # ไธๆฌกๅ
็ดฏ็ฉๅใฏใฉใน
def ... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# ๅใๆธกใใใใในใฆใฎ่ฆ็ด ใใsubใ ใๅผใ.ใชในใใ*ใใคใใฆๅฑ้ใใฆใใใใจ
def a_int():
return int(read())
d... | false | 43.243243 | [
"-# https://atcoder.jp/contests/abc059/tasks/arc072_a",
"-# ็ดฏ็ฉๅใไฝใฃใฆใใใฆใใใฎ็ดฏ็ฉๅใฎ็ฌฆๅทใไบคไบใซใชใใใใซใใฆใใ",
"-# ็ดฏ็ฉๅใฎiไปฅ้ใฎ่ฆ็ด ใใในใฆๅคๆดใใไปฃใใใซใใใค่ถณใใฐใใใฎใๆใฃใฆใใ(imosๆณใฎใคใกใผใธ)",
"+sys.setrecursionlimit(1 << 25)",
"+ra = range",
"+enu = enumerate",
"-def read_ints():",
"+def exit(*argv, **kwarg):",
"+ print(*argv, **kwarg)"... | false | 0.036923 | 0.037248 | 0.991271 | [
"s548211177",
"s443810703"
] |
u952708174 | p03164 | python | s779621048 | s276569019 | 359 | 179 | 67,036 | 13,604 | Accepted | Accepted | 50.14 | def e_knapsack2(N, W, Goods):
"""
Dใจๅใ่จญๅฎใ ใใๅถ็ดใ้ใ(1 <= v_i <= 10^3 ใจไพกๅคใฎๅถ็ดใใใใ)
"""
from collections import defaultdict
# dp[v]: ไพกๅคvใ้ๆใใใใใซ่ฆๆฑใใใ้ใใฎๆๅฐๅค
dp = defaultdict(lambda: float('inf'))
dp[0] = 0
# w, vใฎ้ ๅบใ้ใซใชใฃใฆใใใฎใฏdpใใผใใซใฎ้ฝๅไธ
for w, v in Goods:
for nv, nw in li... | def e_knapsack2(N, W, Goods):
"""
Dใจๅใ่จญๅฎใ ใใๅถ็ดใ้ใ(1 <= v_i <= 10^3 ใจไพกๅคใฎๅถ็ดใใใใ)
"""
import numpy as np
# dp[v]: ไพกๅคvใ้ๆใใใฎใซๅฟ
่ฆใช้้ใฎๆๅฐๅค
# dpใฎ้ทใใฏใใในใฆใฎ่ท็ฉใๅ
ฅใใใจใใฎไพกๅค+1ใงๅๅ
# ๅ่ฆ็ด ใฎๅๆๅคใฏใWใ่ถ
ใใๅคใชใใใ(np.infใ ใจใใพใๅไฝใใชใใ)
max_value = np.sum(np.array(Goods), axis=0)[1]
dp = np.full(max_value + 1,... | 21 | 20 | 656 | 724 | def e_knapsack2(N, W, Goods):
"""
Dใจๅใ่จญๅฎใ ใใๅถ็ดใ้ใ(1 <= v_i <= 10^3 ใจไพกๅคใฎๅถ็ดใใใใ)
"""
from collections import defaultdict
# dp[v]: ไพกๅคvใ้ๆใใใใใซ่ฆๆฑใใใ้ใใฎๆๅฐๅค
dp = defaultdict(lambda: float("inf"))
dp[0] = 0
# w, vใฎ้ ๅบใ้ใซใชใฃใฆใใใฎใฏdpใใผใใซใฎ้ฝๅไธ
for w, v in Goods:
for nv, nw in list(dp.items... | def e_knapsack2(N, W, Goods):
"""
Dใจๅใ่จญๅฎใ ใใๅถ็ดใ้ใ(1 <= v_i <= 10^3 ใจไพกๅคใฎๅถ็ดใใใใ)
"""
import numpy as np
# dp[v]: ไพกๅคvใ้ๆใใใฎใซๅฟ
่ฆใช้้ใฎๆๅฐๅค
# dpใฎ้ทใใฏใใในใฆใฎ่ท็ฉใๅ
ฅใใใจใใฎไพกๅค+1ใงๅๅ
# ๅ่ฆ็ด ใฎๅๆๅคใฏใWใ่ถ
ใใๅคใชใใใ(np.infใ ใจใใพใๅไฝใใชใใ)
max_value = np.sum(np.array(Goods), axis=0)[1]
dp = np.full(max_value + 1, W + 1, ... | false | 4.761905 | [
"- from collections import defaultdict",
"+ import numpy as np",
"- # dp[v]: ไพกๅคvใ้ๆใใใใใซ่ฆๆฑใใใ้ใใฎๆๅฐๅค",
"- dp = defaultdict(lambda: float(\"inf\"))",
"- dp[0] = 0",
"- # w, vใฎ้ ๅบใ้ใซใชใฃใฆใใใฎใฏdpใใผใใซใฎ้ฝๅไธ",
"+ # dp[v]: ไพกๅคvใ้ๆใใใฎใซๅฟ
่ฆใช้้ใฎๆๅฐๅค",
"+ # dpใฎ้ทใใฏใใในใฆใฎ่ท็ฉใๅ
ฅใใใจใใฎไพกๅค+1ใงๅๅ",
"+ # ๅ... | false | 0.173072 | 0.221379 | 0.781788 | [
"s779621048",
"s276569019"
] |
u968166680 | p03488 | python | s912168356 | s281526285 | 843 | 261 | 94,272 | 81,020 | Accepted | Accepted | 69.04 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def check(vec, init_pos, target_pos):
base = 8000
dp = [False] * 16001
dp[init_pos + base] = True
for i in range(len(vec)):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def check(vec, init_pos, target_pos):
dp = {init_pos}
for nv in vec:
dp_next = set()
for v in dp:
dp_next.a... | 66 | 45 | 1,366 | 827 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def check(vec, init_pos, target_pos):
base = 8000
dp = [False] * 16001
dp[init_pos + base] = True
for i in range(len(vec)):
dp, dp_prev = ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def check(vec, init_pos, target_pos):
dp = {init_pos}
for nv in vec:
dp_next = set()
for v in dp:
dp_next.add(v - nv)
... | false | 31.818182 | [
"- base = 8000",
"- dp = [False] * 16001",
"- dp[init_pos + base] = True",
"- for i in range(len(vec)):",
"- dp, dp_prev = [False] * 16001, dp",
"- for j in range(16001):",
"- if (",
"- j - vec[i] >= 0",
"- and dp_prev[j - vec[i]]",
... | false | 0.132351 | 0.094304 | 1.40346 | [
"s912168356",
"s281526285"
] |
u000212387 | p03317 | python | s742461131 | s213937094 | 199 | 39 | 52,780 | 13,880 | Accepted | Accepted | 80.4 | n,k=list(map(int,input().split()))
k-=1
a=list(map(int, input().split()))
i=n-1
print((-(-i//k)-(-(n-i-1)//k)))#pythonใงๅใไธใใฎๆธใๆน | n,k=list(map(int,input().split()))
a=list(map(int, input().split()))
print((-(-(n-1)//(k-1)))) | 5 | 3 | 123 | 88 | n, k = list(map(int, input().split()))
k -= 1
a = list(map(int, input().split()))
i = n - 1
print((-(-i // k) - (-(n - i - 1) // k))) # pythonใงๅใไธใใฎๆธใๆน
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
print((-(-(n - 1) // (k - 1))))
| false | 40 | [
"-k -= 1",
"-i = n - 1",
"-print((-(-i // k) - (-(n - i - 1) // k))) # pythonใงๅใไธใใฎๆธใๆน",
"+print((-(-(n - 1) // (k - 1))))"
] | false | 0.083778 | 0.041412 | 2.023023 | [
"s742461131",
"s213937094"
] |
u627600101 | p04000 | python | s509307281 | s390805654 | 1,565 | 1,248 | 166,912 | 185,584 | Accepted | Accepted | 20.26 | H,W,N = list(map(int,input().split()))
Nli=[]
for k in range(N):
a,b=list(map(int,input().split()))
for n in range(-1,2):
for m in range(-1,2):
if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:
Nli.append((b-n)*(H)+(a-m))
import collections
s = collections.Counter(Nli)
v = list(s.v... | H,W,N = list(map(int,input().split()))
Nli=[0 for j in range(9*N)]
q=0
for k in range(N):
a,b=list(map(int,input().split()))
for n in range(-1,2):
for m in range(-1,2):
if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:
Nli[q]=(b-n)*(H)+(a-m)
q+=1
del Nli[q:]
import... | 14 | 17 | 396 | 452 | H, W, N = list(map(int, input().split()))
Nli = []
for k in range(N):
a, b = list(map(int, input().split()))
for n in range(-1, 2):
for m in range(-1, 2):
if 0 <= a - 2 - m < H - 2 and 0 <= b - 2 - n < W - 2:
Nli.append((b - n) * (H) + (a - m))
import collections
s = collect... | H, W, N = list(map(int, input().split()))
Nli = [0 for j in range(9 * N)]
q = 0
for k in range(N):
a, b = list(map(int, input().split()))
for n in range(-1, 2):
for m in range(-1, 2):
if 0 <= a - 2 - m < H - 2 and 0 <= b - 2 - n < W - 2:
Nli[q] = (b - n) * (H) + (a - m)
... | false | 17.647059 | [
"-Nli = []",
"+Nli = [0 for j in range(9 * N)]",
"+q = 0",
"- Nli.append((b - n) * (H) + (a - m))",
"+ Nli[q] = (b - n) * (H) + (a - m)",
"+ q += 1",
"+del Nli[q:]"
] | false | 0.046731 | 0.046918 | 0.996014 | [
"s509307281",
"s390805654"
] |
u470286613 | p03329 | python | s401796007 | s083611095 | 506 | 363 | 6,900 | 3,060 | Accepted | Accepted | 28.26 | N=int(eval(input()))
weights=[1]
pow6=6
while N>=pow6:
weights.append(pow6)
pow6*=6
pow9=9
while N>=pow9:
weights.append(pow9)
pow9*=9
dp=[1<<28]*(N+1)
dp[0]=0
for i in range(len(weights)):
for j in range(weights[i],N+1):
dp[j]=min(dp[j],dp[j-weights[i]]+1)
print((dp[N])) | N=int(eval(input()))
res=N
for i in range(N+1):
cc=0
tmp=i
while tmp>0:
cc+=tmp%6
tmp=tmp//6
tmp=N-i
while tmp>0:
cc+=tmp%9
tmp=tmp//9
res=min(res,cc)
print(res) | 16 | 14 | 307 | 224 | N = int(eval(input()))
weights = [1]
pow6 = 6
while N >= pow6:
weights.append(pow6)
pow6 *= 6
pow9 = 9
while N >= pow9:
weights.append(pow9)
pow9 *= 9
dp = [1 << 28] * (N + 1)
dp[0] = 0
for i in range(len(weights)):
for j in range(weights[i], N + 1):
dp[j] = min(dp[j], dp[j - weights[i]] + 1... | N = int(eval(input()))
res = N
for i in range(N + 1):
cc = 0
tmp = i
while tmp > 0:
cc += tmp % 6
tmp = tmp // 6
tmp = N - i
while tmp > 0:
cc += tmp % 9
tmp = tmp // 9
res = min(res, cc)
print(res)
| false | 12.5 | [
"-weights = [1]",
"-pow6 = 6",
"-while N >= pow6:",
"- weights.append(pow6)",
"- pow6 *= 6",
"-pow9 = 9",
"-while N >= pow9:",
"- weights.append(pow9)",
"- pow9 *= 9",
"-dp = [1 << 28] * (N + 1)",
"-dp[0] = 0",
"-for i in range(len(weights)):",
"- for j in range(weights[i], N ... | false | 0.329953 | 0.189251 | 1.743468 | [
"s401796007",
"s083611095"
] |
u645250356 | p03575 | python | s377677107 | s664310859 | 209 | 41 | 41,324 | 5,172 | Accepted | Accepted | 80.38 | from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return ... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 62 | 45 | 1,576 | 1,105 | from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush
import sys, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def ... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 27.419355 | [
"-from heapq import heapify, heappop, heappush",
"-import sys, bisect, math, itertools, string, queue",
"+from heapq import heappop, heappush, heapify",
"+import sys, bisect, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys.stdin.readline().split())... | false | 0.125742 | 0.037877 | 3.319769 | [
"s377677107",
"s664310859"
] |
u094999522 | p03592 | python | s707267962 | s462188709 | 272 | 29 | 9,072 | 9,168 | Accepted | Accepted | 89.34 | #!/usr/bin/env python3
n, m, k = list(map(int, input().split()))
for i in range(n + 1):
for j in range(m + 1):
if m * i + j * n - 2 * i * j == k:
print("Yes")
exit()
print('No')
| #!/usr/bin/env python3
n, m, k = list(map(int, input().split()))
for i in range(n + 1):
a = k - i * m
b = n - 2 * i
if b != 0 and a % b == 0 and 0 <= a // b <= m:
print("Yes")
exit()
print("No")
| 8 | 9 | 215 | 225 | #!/usr/bin/env python3
n, m, k = list(map(int, input().split()))
for i in range(n + 1):
for j in range(m + 1):
if m * i + j * n - 2 * i * j == k:
print("Yes")
exit()
print("No")
| #!/usr/bin/env python3
n, m, k = list(map(int, input().split()))
for i in range(n + 1):
a = k - i * m
b = n - 2 * i
if b != 0 and a % b == 0 and 0 <= a // b <= m:
print("Yes")
exit()
print("No")
| false | 11.111111 | [
"- for j in range(m + 1):",
"- if m * i + j * n - 2 * i * j == k:",
"- print(\"Yes\")",
"- exit()",
"+ a = k - i * m",
"+ b = n - 2 * i",
"+ if b != 0 and a % b == 0 and 0 <= a // b <= m:",
"+ print(\"Yes\")",
"+ exit()"
] | false | 0.091165 | 0.046337 | 1.967415 | [
"s707267962",
"s462188709"
] |
u552145906 | p02658 | python | s136475694 | s900796976 | 62 | 52 | 21,588 | 21,632 | Accepted | Accepted | 16.13 | N = int(eval(input()))
A = list(map(int, input().split()))
num = 1
for i in range(0,N):
if A[i]==0:
num=0
break
for i in range(0,N):
if num>10**18:
break
else:
num *=A[i]
if num>10**18:
print((-1))
else:
print(num) | N = eval(input())
A = list(map(int, input().split()))
if 0 in A:
print((0))
exit()
Ans = 1
for i in range(0,len(A)):
Ans *= A[i]
if Ans > 10**18:
print((-1))
exit()
else:
continue
print(Ans) | 16 | 16 | 271 | 241 | N = int(eval(input()))
A = list(map(int, input().split()))
num = 1
for i in range(0, N):
if A[i] == 0:
num = 0
break
for i in range(0, N):
if num > 10**18:
break
else:
num *= A[i]
if num > 10**18:
print((-1))
else:
print(num)
| N = eval(input())
A = list(map(int, input().split()))
if 0 in A:
print((0))
exit()
Ans = 1
for i in range(0, len(A)):
Ans *= A[i]
if Ans > 10**18:
print((-1))
exit()
else:
continue
print(Ans)
| false | 0 | [
"-N = int(eval(input()))",
"+N = eval(input())",
"-num = 1",
"-for i in range(0, N):",
"- if A[i] == 0:",
"- num = 0",
"- break",
"-for i in range(0, N):",
"- if num > 10**18:",
"- break",
"+if 0 in A:",
"+ print((0))",
"+ exit()",
"+Ans = 1",
"+for i in ... | false | 0.036156 | 0.035248 | 1.02575 | [
"s136475694",
"s900796976"
] |
u790012205 | p03495 | python | s317223204 | s121232140 | 177 | 159 | 32,184 | 43,164 | Accepted | Accepted | 10.17 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
D = {}
for a in A:
if a not in D:
D[a] = 1
else:
D[a] += 1
E = sorted(D.values())
c = 0
i = 0
l = len(D)
while l > K:
c += E[i]
l -= 1
i += 1
print(c) | from collections import Counter
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
C = Counter(A)
C = sorted(list(C.items()), key=lambda x: x[1])
k = len(C)
c = 0
for i in range(k - K):
k, v = C[i]
c += v
print(c) | 18 | 12 | 273 | 245 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
D = {}
for a in A:
if a not in D:
D[a] = 1
else:
D[a] += 1
E = sorted(D.values())
c = 0
i = 0
l = len(D)
while l > K:
c += E[i]
l -= 1
i += 1
print(c)
| from collections import Counter
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
C = Counter(A)
C = sorted(list(C.items()), key=lambda x: x[1])
k = len(C)
c = 0
for i in range(k - K):
k, v = C[i]
c += v
print(c)
| false | 33.333333 | [
"+from collections import Counter",
"+",
"-D = {}",
"-for a in A:",
"- if a not in D:",
"- D[a] = 1",
"- else:",
"- D[a] += 1",
"-E = sorted(D.values())",
"+C = Counter(A)",
"+C = sorted(list(C.items()), key=lambda x: x[1])",
"+k = len(C)",
"-i = 0",
"-l = len(D)",
"-... | false | 0.047144 | 0.048054 | 0.981074 | [
"s317223204",
"s121232140"
] |
u562935282 | p03201 | python | s955020843 | s413260425 | 734 | 599 | 56,124 | 56,664 | Accepted | Accepted | 18.39 | # https://beta.atcoder.jp/contests/agc029/submissions/3804087
from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = Counter(a)
ans = 0
for t in a:
if b[t] == 0: continue
s = (1 << t.bit_length()) - t
if t == s:
ans +... | N = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
cnt = {}
for n in a:
cnt[n] = cnt.get(n, 0) + 1
ans = 0
for n in a:
g = 2 ** n.bit_length()
s = g - n
if n == s:
pair = cnt.get(s, 0) // 2
ans += pair
cnt[s] = cnt.get(s, 0) % ... | 22 | 22 | 455 | 488 | # https://beta.atcoder.jp/contests/agc029/submissions/3804087
from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = Counter(a)
ans = 0
for t in a:
if b[t] == 0:
continue
s = (1 << t.bit_length()) - t
if t == s:
ans += b[t]... | N = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
cnt = {}
for n in a:
cnt[n] = cnt.get(n, 0) + 1
ans = 0
for n in a:
g = 2 ** n.bit_length()
s = g - n
if n == s:
pair = cnt.get(s, 0) // 2
ans += pair
cnt[s] = cnt.get(s, 0) % 2
else:
... | false | 0 | [
"-# https://beta.atcoder.jp/contests/agc029/submissions/3804087",
"-from collections import Counter",
"-",
"-b = Counter(a)",
"+cnt = {}",
"+for n in a:",
"+ cnt[n] = cnt.get(n, 0) + 1",
"-for t in a:",
"- if b[t] == 0:",
"- continue",
"- s = (1 << t.bit_length()) - t",
"- i... | false | 0.00846 | 0.036476 | 0.231938 | [
"s955020843",
"s413260425"
] |
u608088992 | p03319 | python | s608987007 | s076241903 | 50 | 45 | 14,132 | 13,876 | Accepted | Accepted | 10 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
l = A.index(1)
count = 1
r = K - 1
while r < l:
r += (K - 1)
count += 1
if r < N - 1:
... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
mid = A.index(1)
count = 1
r = K - 1
while r < mid:
r += (K - 1)
count += 1
if r < N - 1:
l = N - K
count += 1
... | 27 | 26 | 506 | 464 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
l = A.index(1)
count = 1
r = K - 1
while r < l:
r += K - 1
count += 1
if r < N - 1:
ll = N - K
c... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
mid = A.index(1)
count = 1
r = K - 1
while r < mid:
r += K - 1
count += 1
if r < N - 1:
l = N - K
count += 1
while l >... | false | 3.703704 | [
"-from collections import deque",
"- l = A.index(1)",
"+ mid = A.index(1)",
"- while r < l:",
"+ while r < mid:",
"- ll = N - K",
"+ l = N - K",
"- while ll > r:",
"- ll -= K - 1",
"+ while l > r:",
"+ l -= K - 1"
] | false | 0.043778 | 0.044156 | 0.99144 | [
"s608987007",
"s076241903"
] |
u334712262 | p02606 | python | s428091635 | s558613567 | 710 | 470 | 76,720 | 76,820 | Accepted | Accepted | 33.8 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutati... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutati... | 78 | 74 | 1,452 | 1,380 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from... | false | 5.128205 | [
"- ans = 0",
"- for i in range(L, R + 1):",
"- if i % D == 0:",
"- ans += 1",
"- return ans",
"+ return R // D - (L - 1) // D"
] | false | 0.065396 | 0.054316 | 1.203995 | [
"s428091635",
"s558613567"
] |
u489959379 | p03818 | python | s726191000 | s316780492 | 87 | 65 | 18,632 | 21,968 | Accepted | Accepted | 25.29 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
d = Counter(a)
cnt = 0
for v in list(d.values()):
if v % 2 == 0:
cnt += 1
if cnt % 2 != 0:
print((len(d)- 1))
else:
print((len(d))) | import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
D = Counter(A)
ev = 0
od = 0
for k, v in list(D.items()):
... | 15 | 28 | 256 | 514 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
d = Counter(a)
cnt = 0
for v in list(d.values()):
if v % 2 == 0:
cnt += 1
if cnt % 2 != 0:
print((len(d) - 1))
else:
print((len(d)))
| import sys
from collections import Counter
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
D = Counter(A)
ev = 0
od = 0
for k, v in list(D.items()):
if v % 2 == 0:
... | false | 46.428571 | [
"+import sys",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-a = sorted(a)",
"-d = Counter(a)",
"-cnt = 0",
"-for v in list(d.values()):",
"- if v % 2 == 0:",
"- cnt += 1",
"-if cnt % 2 != 0:",
"- print((len(d) - 1))",
"-else:",
"- print((len(d)))",
"... | false | 0.038727 | 0.040439 | 0.957664 | [
"s726191000",
"s316780492"
] |
u298297089 | p03380 | python | s512661855 | s705325891 | 76 | 59 | 14,060 | 14,052 | Accepted | Accepted | 22.37 | N = int(eval(input()))
A = list(map(int, input().split()))
mx = max(A)
ans = mx * 3
med = mx // 2
for a in A:
if mx == a:
continue
if abs(med - ans) > abs(med - a):
ans = a
print((mx, ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
mx = max(A)
A.remove(mx)
ans = 10**9
ans_dist = ans
med = mx // 2
for a in A:
if ans_dist > abs(med - a):
ans, ans_dist = a, abs(med - a)
print((mx, ans))
| 11 | 12 | 216 | 230 | N = int(eval(input()))
A = list(map(int, input().split()))
mx = max(A)
ans = mx * 3
med = mx // 2
for a in A:
if mx == a:
continue
if abs(med - ans) > abs(med - a):
ans = a
print((mx, ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
mx = max(A)
A.remove(mx)
ans = 10**9
ans_dist = ans
med = mx // 2
for a in A:
if ans_dist > abs(med - a):
ans, ans_dist = a, abs(med - a)
print((mx, ans))
| false | 8.333333 | [
"-ans = mx * 3",
"+A.remove(mx)",
"+ans = 10**9",
"+ans_dist = ans",
"- if mx == a:",
"- continue",
"- if abs(med - ans) > abs(med - a):",
"- ans = a",
"+ if ans_dist > abs(med - a):",
"+ ans, ans_dist = a, abs(med - a)"
] | false | 0.041971 | 0.044763 | 0.937643 | [
"s512661855",
"s705325891"
] |
u730769327 | p03633 | python | s619828201 | s634109384 | 108 | 63 | 73,072 | 62,744 | Accepted | Accepted | 41.67 | from fractions import gcd
from functools import reduce
n=int(eval(input()))
g=1
for i in range(n):
t=int(eval(input()))
g=g*t//gcd(g,t)
print(g)
| from math import gcd
n=int(eval(input()))
a=int(eval(input()))
for _ in range(n-1):
i=int(eval(input()))
a=a*i//gcd(a,i)
print(a) | 8 | 7 | 144 | 121 | from fractions import gcd
from functools import reduce
n = int(eval(input()))
g = 1
for i in range(n):
t = int(eval(input()))
g = g * t // gcd(g, t)
print(g)
| from math import gcd
n = int(eval(input()))
a = int(eval(input()))
for _ in range(n - 1):
i = int(eval(input()))
a = a * i // gcd(a, i)
print(a)
| false | 12.5 | [
"-from fractions import gcd",
"-from functools import reduce",
"+from math import gcd",
"-g = 1",
"-for i in range(n):",
"- t = int(eval(input()))",
"- g = g * t // gcd(g, t)",
"-print(g)",
"+a = int(eval(input()))",
"+for _ in range(n - 1):",
"+ i = int(eval(input()))",
"+ a = a *... | false | 0.045436 | 0.043005 | 1.056513 | [
"s619828201",
"s634109384"
] |
u941407962 | p03040 | python | s579009024 | s101095161 | 1,288 | 1,142 | 113,628 | 104,924 | Accepted | Accepted | 11.34 | # ABC140E
import sys
input = sys.stdin.readline
def bsearch(target, min_i, max_i, func):
# func(index) <= target < func(index+1) ใจใชใindexใ่ฟใ
if func(max_i) <= target:
return max_i
if target < func(min_i):
return None
index = (max_i + min_i)//2
while True:
if func(i... | # ABC140E
import sys
input = sys.stdin.readline
def bsearch(target, min_i, max_i, func):
# func(index) <= target < func(index+1) ใจใชใindexใ่ฟใ
if func(max_i) <= target:
return max_i
if target < func(min_i):
return None
index = (max_i + min_i)//2
while True:
if func(i... | 118 | 79 | 3,364 | 2,071 | # ABC140E
import sys
input = sys.stdin.readline
def bsearch(target, min_i, max_i, func):
# func(index) <= target < func(index+1) ใจใชใindexใ่ฟใ
if func(max_i) <= target:
return max_i
if target < func(min_i):
return None
index = (max_i + min_i) // 2
while True:
if func(index) ... | # ABC140E
import sys
input = sys.stdin.readline
def bsearch(target, min_i, max_i, func):
# func(index) <= target < func(index+1) ใจใชใindexใ่ฟใ
if func(max_i) <= target:
return max_i
if target < func(min_i):
return None
index = (max_i + min_i) // 2
while True:
if func(index) ... | false | 33.050847 | [
"-",
"-",
"-class SegTree:",
"- def __init__(self, init_val, n, ide_ele, seg_func):",
"- self.segfunc = seg_func",
"- self.num = 2 ** (n - 1).bit_length()",
"- self.ide_ele = ide_ele",
"- self.seg = [self.ide_ele] * 2 * self.num",
"- for i in range(n):",
"- ... | false | 0.037062 | 0.037017 | 1.001195 | [
"s579009024",
"s101095161"
] |
u439396449 | p04013 | python | s577037004 | s131363880 | 221 | 156 | 21,156 | 21,248 | Accepted | Accepted | 29.41 | from collections import defaultdict
N, A = list(map(int, input().split()))
x = [int(x) for x in input().split()]
for i in range(N):
x[i] -= A
X = max(max(x), A)
dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for j in range(-N * X, N * X + 1):
if - N * X <= ... | from collections import defaultdict
N, A = list(map(int, input().split()))
x = [int(x) for x in input().split()]
for i in range(N):
x[i] -= A
X = max(max(x), A)
dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for j in range(-N * X, N * X + 1):
dp[i + 1][j] =... | 18 | 15 | 461 | 363 | from collections import defaultdict
N, A = list(map(int, input().split()))
x = [int(x) for x in input().split()]
for i in range(N):
x[i] -= A
X = max(max(x), A)
dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for j in range(-N * X, N * X + 1):
if -N * X <= j - x[i] <= N * ... | from collections import defaultdict
N, A = list(map(int, input().split()))
x = [int(x) for x in input().split()]
for i in range(N):
x[i] -= A
X = max(max(x), A)
dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for j in range(-N * X, N * X + 1):
dp[i + 1][j] = dp[i][j] + dp[... | false | 16.666667 | [
"- if -N * X <= j - x[i] <= N * X:",
"- dp[i + 1][j] = dp[i][j] + dp[i][j - x[i]]",
"- else:",
"- dp[i + 1][j] = dp[i][j]",
"+ dp[i + 1][j] = dp[i][j] + dp[i][j - x[i]]"
] | false | 0.039874 | 0.077094 | 0.517204 | [
"s577037004",
"s131363880"
] |
u681444474 | p03102 | python | s834951470 | s922859377 | 173 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.17 | N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [0]*N
for i in range(N):
A[i] = list(map(int,input().split()))
cnt = 0
for j in range(N):
sum = 0
for k in range(M):
sum += A[j][k]*B[k]
if sum+C > 0:
cnt += 1
print(cnt) | # coding: utf-8
n, m, c = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(n):
A = list(map(int,input().split()))
tmp = 0
for j in range(m):
tmp += A[j]*B[j]
tmp += c
if tmp > 0:
ans += 1
print(ans) | 14 | 16 | 296 | 286 | N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0] * N
for i in range(N):
A[i] = list(map(int, input().split()))
cnt = 0
for j in range(N):
sum = 0
for k in range(M):
sum += A[j][k] * B[k]
if sum + C > 0:
cnt += 1
print(cnt)
| # coding: utf-8
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(n):
A = list(map(int, input().split()))
tmp = 0
for j in range(m):
tmp += A[j] * B[j]
tmp += c
if tmp > 0:
ans += 1
print(ans)
| false | 12.5 | [
"-N, M, C = list(map(int, input().split()))",
"+# coding: utf-8",
"+n, m, c = list(map(int, input().split()))",
"-A = [0] * N",
"-for i in range(N):",
"- A[i] = list(map(int, input().split()))",
"-cnt = 0",
"-for j in range(N):",
"- sum = 0",
"- for k in range(M):",
"- sum += A[j... | false | 0.041019 | 0.124783 | 0.328726 | [
"s834951470",
"s922859377"
] |
u606045429 | p02713 | python | s036563562 | s981425483 | 1,867 | 687 | 9,072 | 111,600 | Accepted | Accepted | 63.2 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans) | from numba import njit
from math import gcd
K = int(eval(input()))
@njit
def solve():
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
return ans
print((solve())) | 11 | 15 | 196 | 281 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
| from numba import njit
from math import gcd
K = int(eval(input()))
@njit
def solve():
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
return ans
print((solve()))
| false | 26.666667 | [
"+from numba import njit",
"-ans = 0",
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- for c in range(1, K + 1):",
"- ans += gcd(gcd(a, b), c)",
"-print(ans)",
"+",
"+",
"+@njit",
"+def solve():",
"+ ans = 0",
"+ for a in range(1, K + 1):",
"+ ... | false | 0.155452 | 0.078283 | 1.985768 | [
"s036563562",
"s981425483"
] |
u261646994 | p02954 | python | s096606549 | s061937198 | 123 | 110 | 10,364 | 10,356 | Accepted | Accepted | 10.57 | S = eval(input())
count = 0
letter = "R"
end = [0] * len(S)
for i, s in enumerate(S):
if s == letter:
count += 1
else:
letter = s
evens = count // 2
odds = (count + 1) // 2
if s == "L":
if count % 2 == 0:
end[i - 1] += evens
... | S = eval(input())
count = 0
letter = "R"
end = [0] * len(S)
for i, s in enumerate(S + "E"):
if s == letter:
count += 1
else:
odds = (count + 1) // 2
evens = count // 2
if s == "L":
end[i] += evens
end[i - 1] += odds
else:
... | 34 | 25 | 722 | 493 | S = eval(input())
count = 0
letter = "R"
end = [0] * len(S)
for i, s in enumerate(S):
if s == letter:
count += 1
else:
letter = s
evens = count // 2
odds = (count + 1) // 2
if s == "L":
if count % 2 == 0:
end[i - 1] += evens
end... | S = eval(input())
count = 0
letter = "R"
end = [0] * len(S)
for i, s in enumerate(S + "E"):
if s == letter:
count += 1
else:
odds = (count + 1) // 2
evens = count // 2
if s == "L":
end[i] += evens
end[i - 1] += odds
else:
end[i - count]... | false | 26.470588 | [
"-for i, s in enumerate(S):",
"+for i, s in enumerate(S + \"E\"):",
"- letter = s",
"+ odds = (count + 1) // 2",
"- odds = (count + 1) // 2",
"- if count % 2 == 0:",
"- end[i - 1] += evens",
"- end[i] += odds",
"- else:",
"- ... | false | 0.045029 | 0.008085 | 5.569074 | [
"s096606549",
"s061937198"
] |
u968404618 | p02923 | python | s929016463 | s091120932 | 94 | 84 | 15,020 | 20,408 | Accepted | Accepted | 10.64 | n = int(eval(input()))
h = list(map(int, input().split()))
h.reverse()
ans = 0
val = 0
for i in range(1, n):
if h[i-1] <= h[i]:
val +=1
else:
val = 0
ans = max(ans, val)
print(ans) | n = int(eval(input()))
H = list(map(int, input().split()))
tmp = H[0]
cnt = 0
ans = 0
for h in H[1:]:
if tmp >= h:
cnt += 1
else:
cnt = 0
tmp = h
ans = max(ans, cnt)
print(ans) | 14 | 14 | 217 | 216 | n = int(eval(input()))
h = list(map(int, input().split()))
h.reverse()
ans = 0
val = 0
for i in range(1, n):
if h[i - 1] <= h[i]:
val += 1
else:
val = 0
ans = max(ans, val)
print(ans)
| n = int(eval(input()))
H = list(map(int, input().split()))
tmp = H[0]
cnt = 0
ans = 0
for h in H[1:]:
if tmp >= h:
cnt += 1
else:
cnt = 0
tmp = h
ans = max(ans, cnt)
print(ans)
| false | 0 | [
"-h = list(map(int, input().split()))",
"-h.reverse()",
"+H = list(map(int, input().split()))",
"+tmp = H[0]",
"+cnt = 0",
"-val = 0",
"-for i in range(1, n):",
"- if h[i - 1] <= h[i]:",
"- val += 1",
"+for h in H[1:]:",
"+ if tmp >= h:",
"+ cnt += 1",
"- val = 0",... | false | 0.073214 | 0.036692 | 1.995352 | [
"s929016463",
"s091120932"
] |
u200887663 | p02917 | python | s213422254 | s727975584 | 20 | 17 | 2,940 | 3,060 | Accepted | Accepted | 15 | n=int(eval(input()))
bl=list(map(int,input().split()))
al=[0 for i in range(n)]
al[n-1]=bl[n-2]
for i in range(n-2,-1,-1):
if al[i+1]>bl[i]:
al[i+1]=bl[i]
al[i]=bl[i]
print((sum(al)))
| n=int(eval(input()))
#a,b,x=map(int,input().split())
bl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
al=[0 for i in range(n)]
al[n-1]=bl[-1]
for i in range(n-2,-1,-1):
al[i]=bl[i]
if al[i+1]>bl[i]:
al[i+1]=bl[i]
print((sum(al)))
| 9 | 15 | 200 | 295 | n = int(eval(input()))
bl = list(map(int, input().split()))
al = [0 for i in range(n)]
al[n - 1] = bl[n - 2]
for i in range(n - 2, -1, -1):
if al[i + 1] > bl[i]:
al[i + 1] = bl[i]
al[i] = bl[i]
print((sum(al)))
| n = int(eval(input()))
# a,b,x=map(int,input().split())
bl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
al = [0 for i in range(n)]
al[n - 1] = bl[-1]
for i in range(n - 2, -1, -1):
al[i] = bl[i]
if al[i + 1] > bl[i]:
al[i + 1] = bl[i]
print((sum(al)))
| false | 40 | [
"+# a,b,x=map(int,input().split())",
"+# l=[list(map(int,input().split())) for i in range(n)]",
"-al[n - 1] = bl[n - 2]",
"+al[n - 1] = bl[-1]",
"+ al[i] = bl[i]",
"- al[i] = bl[i]"
] | false | 0.049617 | 0.047659 | 1.04109 | [
"s213422254",
"s727975584"
] |
u656391577 | p02577 | python | s315304361 | s144956955 | 72 | 57 | 10,536 | 12,396 | Accepted | Accepted | 20.83 | N = str(eval(input()))
a = list(N)
result = 0
for x in a:
x = int(x)
result += x
if result%9 == 0:
print("Yes")
else:
print("No") | N = str(eval(input()))
a = sum([int(n) for n in list(N)])
if a%9 == 0:
print("Yes")
else:
print("No")
| 14 | 8 | 156 | 113 | N = str(eval(input()))
a = list(N)
result = 0
for x in a:
x = int(x)
result += x
if result % 9 == 0:
print("Yes")
else:
print("No")
| N = str(eval(input()))
a = sum([int(n) for n in list(N)])
if a % 9 == 0:
print("Yes")
else:
print("No")
| false | 42.857143 | [
"-a = list(N)",
"-result = 0",
"-for x in a:",
"- x = int(x)",
"- result += x",
"-if result % 9 == 0:",
"+a = sum([int(n) for n in list(N)])",
"+if a % 9 == 0:"
] | false | 0.037398 | 0.037432 | 0.99907 | [
"s315304361",
"s144956955"
] |
u761320129 | p03253 | python | s825598647 | s313406512 | 294 | 149 | 28,624 | 15,972 | Accepted | Accepted | 49.32 | N,M = list(map(int,input().split()))
from collections import Counter
def factorize(n):
d = Counter()
m = 2
while m*m <= n:
while n%m == 0:
n //= m
d[m] += 1
m += 1
if n > 1:
d[n] += 1
return d
MOD = 10**9+7
MAX = 2*10**5
fac = [1... | N,M = list(map(int,input().split()))
MOD = 10**9+7
from collections import Counter
def factorize(n):
d = Counter()
m = 2
while m*m <= n:
while n%m == 0:
n //= m
d[m] += 1
m += 1
if n > 1:
d[n] += 1
return d
MAXN = N+99
fac = [1,1] + ... | 41 | 39 | 803 | 800 | N, M = list(map(int, input().split()))
from collections import Counter
def factorize(n):
d = Counter()
m = 2
while m * m <= n:
while n % m == 0:
n //= m
d[m] += 1
m += 1
if n > 1:
d[n] += 1
return d
MOD = 10**9 + 7
MAX = 2 * 10**5
fac = [1, 1] + [0... | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
from collections import Counter
def factorize(n):
d = Counter()
m = 2
while m * m <= n:
while n % m == 0:
n //= m
d[m] += 1
m += 1
if n > 1:
d[n] += 1
return d
MAXN = N + 99
fac = [1, 1] + [0] ... | false | 4.878049 | [
"+MOD = 10**9 + 7",
"-MOD = 10**9 + 7",
"-MAX = 2 * 10**5",
"-fac = [1, 1] + [0] * MAX",
"-finv = [1, 1] + [0] * MAX",
"-inv = [0, 1] + [0] * MAX",
"-for i in range(2, MAX + 2):",
"+MAXN = N + 99",
"+fac = [1, 1] + [0] * MAXN",
"+finv = [1, 1] + [0] * MAXN",
"+inv = [0, 1] + [0] * MAXN",
"+for... | false | 0.58592 | 0.070829 | 8.27237 | [
"s825598647",
"s313406512"
] |
u877415670 | p03061 | python | s299055188 | s908212644 | 772 | 674 | 63,984 | 63,984 | Accepted | Accepted | 12.69 | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
d={}
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
for i in make_diviso... | from collections import defaultdict
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
d=defaultdict(int)
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.appe... | 36 | 30 | 764 | 620 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
d = {}
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
for i in make_divis... | from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
d = defaultdict(int)
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.appen... | false | 16.666667 | [
"+from collections import defaultdict",
"+",
"-d = {}",
"+d = defaultdict(int)",
"- d[i] = 1",
"-for g in range(1, n):",
"- if g == 1:",
"- new = {}",
"- for i, m in list(d.items()):",
"- if a[g] % i == 0:",
"- d[i] += 1",
"- if not ... | false | 0.039853 | 0.045922 | 0.867827 | [
"s299055188",
"s908212644"
] |
u359358631 | p02847 | python | s681919508 | s463427142 | 105 | 71 | 61,760 | 61,780 | Accepted | Accepted | 32.38 | def main():
S = eval(input())
lst = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
ans = 6 - lst.index(S)
if ans == 0:
ans = 7
print(ans)
if __name__ == "__main__":
main()
| def main():
S = eval(input())
lst = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
ans = 7 - lst.index(S)
print(ans)
if __name__ == "__main__":
main()
| 15 | 12 | 221 | 184 | def main():
S = eval(input())
lst = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
ans = 6 - lst.index(S)
if ans == 0:
ans = 7
print(ans)
if __name__ == "__main__":
main()
| def main():
S = eval(input())
lst = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
ans = 7 - lst.index(S)
print(ans)
if __name__ == "__main__":
main()
| false | 20 | [
"- lst = [\"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\", \"SUN\"]",
"- ans = 6 - lst.index(S)",
"- if ans == 0:",
"- ans = 7",
"+ lst = [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"]",
"+ ans = 7 - lst.index(S)"
] | false | 0.042295 | 0.043684 | 0.968204 | [
"s681919508",
"s463427142"
] |
u033606236 | p03574 | python | s885181898 | s735165366 | 33 | 24 | 3,572 | 3,064 | Accepted | Accepted | 27.27 | h, w = map(int,input().split())
a = [list(input()) for _ in range(h)]
b = [[0 for _ in range(w)]for _ in range(h)]
H = [-1,-1,-1, 0, 0, 1, 1, 1]
W = [-1, 0, 1,-1, 1,-1, 0, 1]
for i in range(h):
for j in range(w):
if a[i][j] == "#":
b[i][j] = "#"
for k in range(len(H)):
... | h, w = list(map(int,input().split()))
a = ["."+eval(input())+"." for _ in range(h)]
a.insert(0,"."*(w+2))
a.append("."*(w+2))
y = [1,1, 1,-1,-1,-1,0, 0]
x = [0,1,-1, 0, 1,-1,1,-1]
for i in range(1,h+1):
l =[]
for j in range(1,w+1):
if a[i][j] == "#":
l += "#"
else: l += st... | 16 | 13 | 567 | 388 | h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
b = [[0 for _ in range(w)] for _ in range(h)]
H = [-1, -1, -1, 0, 0, 1, 1, 1]
W = [-1, 0, 1, -1, 1, -1, 0, 1]
for i in range(h):
for j in range(w):
if a[i][j] == "#":
b[i][j] = "#"
for k in range(len(H)):
... | h, w = list(map(int, input().split()))
a = ["." + eval(input()) + "." for _ in range(h)]
a.insert(0, "." * (w + 2))
a.append("." * (w + 2))
y = [1, 1, 1, -1, -1, -1, 0, 0]
x = [0, 1, -1, 0, 1, -1, 1, -1]
for i in range(1, h + 1):
l = []
for j in range(1, w + 1):
if a[i][j] == "#":
l += "#"
... | false | 18.75 | [
"-h, w = map(int, input().split())",
"-a = [list(input()) for _ in range(h)]",
"-b = [[0 for _ in range(w)] for _ in range(h)]",
"-H = [-1, -1, -1, 0, 0, 1, 1, 1]",
"-W = [-1, 0, 1, -1, 1, -1, 0, 1]",
"-for i in range(h):",
"- for j in range(w):",
"+h, w = list(map(int, input().split()))",
"+a = ... | false | 0.036578 | 0.041974 | 0.871442 | [
"s885181898",
"s735165366"
] |
u226108478 | p03828 | python | s794104694 | s988953181 | 70 | 25 | 3,316 | 3,064 | Accepted | Accepted | 64.29 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
# See:
# https://beta.atcoder.jp/contests/abc052/submissions/2246922
def get_prime_dict(number: int) -> dict:
''' number: 2 or greater.
'''
from collections import OrderedDict
prime_dict = OrderedDict()
j = 2
prime... | # -*- coding: utf-8 -*-
'''Snippets for factorization.
Available functions:
- run_prime_factorization: Run prime factorization.
'''
def run_prime_factorization(max_number: int) -> dict:
'''Run prime factorization.
Args:
max_number: Int of number (greater than 1).
Returns:
A dic... | 56 | 61 | 1,279 | 1,264 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
# See:
# https://beta.atcoder.jp/contests/abc052/submissions/2246922
def get_prime_dict(number: int) -> dict:
"""number: 2 or greater."""
from collections import OrderedDict
prime_dict = OrderedDict()
j = 2
prime_dict[j] = 0
for i i... | # -*- coding: utf-8 -*-
"""Snippets for factorization.
Available functions:
- run_prime_factorization: Run prime factorization.
"""
def run_prime_factorization(max_number: int) -> dict:
"""Run prime factorization.
Args:
max_number: Int of number (greater than 1).
Returns:
A dictionary's it... | false | 8.196721 | [
"-# AtCoder Beginner Contest",
"-# Problem C",
"-# See:",
"-# https://beta.atcoder.jp/contests/abc052/submissions/2246922",
"-def get_prime_dict(number: int) -> dict:",
"- \"\"\"number: 2 or greater.\"\"\"",
"- from collections import OrderedDict",
"-",
"- prime_dict = OrderedDict()",
"- ... | false | 0.046917 | 0.036523 | 1.284574 | [
"s794104694",
"s988953181"
] |
u957167787 | p03074 | python | s120875049 | s846392032 | 147 | 129 | 4,212 | 8,004 | Accepted | Accepted | 12.24 | N, K = list(map(int, input().split()))
S = eval(input())
l = []
now = 1 # ไป่ฆใฆใใๆฐ(1ใใ่ฆใ้
ๅใไฝใใใใฎใง1ใงๅๆๅ)
cnt = 0
# lใซใฏ(1ใฎๅๆฐ),(0ใฎๅๆฐ),(1ใฎๅๆฐ),(0ใฎๅๆฐ),...(1ใฎๅๆฐ)ใจใใๆใใฎใชในใใๅ
ฅใใใ(ไธก็ซฏใ0ใใๅงใพใใจใใฆใ1ใ0ใใใใจใใฆใซใฆใณใใใใ)
for i in range(N):
if int(S[i]) == now:
cnt += 1
else:
l.append(cnt)
cnt = ... | N, K = list(map(int, input().split()))
S = eval(input())
l = []
now = 1 # ไป่ฆใฆใใๆฐ(1ใใ่ฆใ้
ๅใไฝใใใใฎใง1ใงๅๆๅ)
cnt = 0
# lใซใฏ(1ใฎๅๆฐ),(0ใฎๅๆฐ),(1ใฎๅๆฐ),(0ใฎๅๆฐ),...(1ใฎๅๆฐ)ใจใใๆใใฎใชในใใๅ
ฅใใใ(ไธก็ซฏใ0ใใๅงใพใใจใใฆใ1ใ0ใใใใจใใฆใซใฆใณใใใใ)
for i in range(N):
if int(S[i]) == now:
cnt += 1
else:
l.append(cnt)
cnt = ... | 50 | 76 | 1,140 | 1,664 | N, K = list(map(int, input().split()))
S = eval(input())
l = []
now = 1 # ไป่ฆใฆใใๆฐ(1ใใ่ฆใ้
ๅใไฝใใใใฎใง1ใงๅๆๅ)
cnt = 0
# lใซใฏ(1ใฎๅๆฐ),(0ใฎๅๆฐ),(1ใฎๅๆฐ),(0ใฎๅๆฐ),...(1ใฎๅๆฐ)ใจใใๆใใฎใชในใใๅ
ฅใใใ(ไธก็ซฏใ0ใใๅงใพใใจใใฆใ1ใ0ใใใใจใใฆใซใฆใณใใใใ)
for i in range(N):
if int(S[i]) == now:
cnt += 1
else:
l.append(cnt)
cnt = 1
now ... | N, K = list(map(int, input().split()))
S = eval(input())
l = []
now = 1 # ไป่ฆใฆใใๆฐ(1ใใ่ฆใ้
ๅใไฝใใใใฎใง1ใงๅๆๅ)
cnt = 0
# lใซใฏ(1ใฎๅๆฐ),(0ใฎๅๆฐ),(1ใฎๅๆฐ),(0ใฎๅๆฐ),...(1ใฎๅๆฐ)ใจใใๆใใฎใชในใใๅ
ฅใใใ(ไธก็ซฏใ0ใใๅงใพใใจใใฆใ1ใ0ใใใใจใใฆใซใฆใณใใใใ)
for i in range(N):
if int(S[i]) == now:
cnt += 1
else:
l.append(cnt)
cnt = 1
now ... | false | 34.210526 | [
"+# ็ดฏ็ฉๅ",
"+# ๅ
ใฎใชในใใ[0, 1, 2, 3, 4, 5]ใฎๆใซ[0, 1, 2, 3, 4, 5, 6]ใฎใใใซๅๆฐใฏ+1ใซใชใ(ใคใพใๆๅใฏ0)",
"+lsum = [0 for _ in range(len(l) + 1)] # len(l)+1ๅใฎ่ฆ็ด ",
"+for i in range(len(l)): # 0ใใlen(l)ใพใง",
"+ lsum[i + 1] = lsum[i] + l[i]",
"+# print(lsum)",
"+for i in range(0, len(l), 2): # ใใใ2ใใจใซใใใใจใง1ใฎๅๆฐใๆฐใใใใ",
... | false | 0.086909 | 0.083663 | 1.0388 | [
"s120875049",
"s846392032"
] |
u340781749 | p03051 | python | s015190428 | s750927876 | 891 | 512 | 97,272 | 80,416 | Accepted | Accepted | 42.54 | import sys
from collections import defaultdict
from itertools import accumulate
from operator import xor
def solve_0(acc):
MOD = 10 ** 9 + 7
cnt_0 = 0
counts = defaultdict(list)
last_0 = {}
for a in acc:
if a == 0:
cnt_0 += 1
else:
cnt = count... | from collections import defaultdict
from itertools import accumulate
from operator import xor
def solve(acc):
MOD = 10 ** 9 + 7
cnt0 = 0
dp0 = defaultdict(lambda: 1)
dp1 = defaultdict(lambda: 0)
last_0 = defaultdict(lambda: 0)
for a in acc:
if a == 0:
cnt0 += 1... | 67 | 35 | 1,544 | 913 | import sys
from collections import defaultdict
from itertools import accumulate
from operator import xor
def solve_0(acc):
MOD = 10**9 + 7
cnt_0 = 0
counts = defaultdict(list)
last_0 = {}
for a in acc:
if a == 0:
cnt_0 += 1
else:
cnt = counts[a]
... | from collections import defaultdict
from itertools import accumulate
from operator import xor
def solve(acc):
MOD = 10**9 + 7
cnt0 = 0
dp0 = defaultdict(lambda: 1)
dp1 = defaultdict(lambda: 0)
last_0 = defaultdict(lambda: 0)
for a in acc:
if a == 0:
cnt0 += 1
else:
... | false | 47.761194 | [
"-import sys",
"-def solve_0(acc):",
"+def solve(acc):",
"- cnt_0 = 0",
"- counts = defaultdict(list)",
"- last_0 = {}",
"+ cnt0 = 0",
"+ dp0 = defaultdict(lambda: 1)",
"+ dp1 = defaultdict(lambda: 0)",
"+ last_0 = defaultdict(lambda: 0)",
"- cnt_0 += 1",
"+ ... | false | 0.087409 | 0.036025 | 2.426325 | [
"s015190428",
"s750927876"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.