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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u150984829 | p00447 | python | s068129795 | s265750688 | 90 | 70 | 6,048 | 5,900 | Accepted | Accepted | 22.22 | for e in iter(input,'0'):
a=list(tuple(map(int,input().split())) for _ in range(int(e)))
s,t=a[0]
b={tuple(map(int,input().split())) for _ in range(int(eval(input())))}
for x,y in b:
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:break
else:print((x-s,y-t));break
| def f(e):
a=list(tuple(map(int,input().split())) for _ in range(int(e)))
s,t=a[0]
b={tuple(map(int,input().split())) for _ in range(int(input()))}
for x,y in b:
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:break
else:return print(x-s,y-t)
for e in iter(input,'0'):f(e)
| 8 | 9 | 269 | 285 | for e in iter(input, "0"):
a = list(tuple(map(int, input().split())) for _ in range(int(e)))
s, t = a[0]
b = {tuple(map(int, input().split())) for _ in range(int(eval(input())))}
for x, y in b:
for u, v in a[1:]:
if (x + u - s, y + v - t) not in b:
break
else:... | def f(e):
a = list(tuple(map(int, input().split())) for _ in range(int(e)))
s, t = a[0]
b = {tuple(map(int, input().split())) for _ in range(int(input()))}
for x, y in b:
for u, v in a[1:]:
if (x + u - s, y + v - t) not in b:
break
else:
return pri... | false | 11.111111 | [
"-for e in iter(input, \"0\"):",
"+def f(e):",
"- b = {tuple(map(int, input().split())) for _ in range(int(eval(input())))}",
"+ b = {tuple(map(int, input().split())) for _ in range(int(input()))}",
"- print((x - s, y - t))",
"- break",
"+ return print(x - s, y - t... | false | 0.036453 | 0.036772 | 0.991333 | [
"s068129795",
"s265750688"
] |
u753803401 | p03308 | python | s704931794 | s061216421 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n = int(eval(input()))
a = list(map(int, input().split()))
ma = 0
for i in range(n):
for j in range(i + 1, n):
ma = max(ma, abs(a[i] - a[j]))
print(ma)
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((abs(a[0] - a[-1])))
| 7 | 4 | 164 | 90 | n = int(eval(input()))
a = list(map(int, input().split()))
ma = 0
for i in range(n):
for j in range(i + 1, n):
ma = max(ma, abs(a[i] - a[j]))
print(ma)
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((abs(a[0] - a[-1])))
| false | 42.857143 | [
"-ma = 0",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- ma = max(ma, abs(a[i] - a[j]))",
"-print(ma)",
"+a.sort()",
"+print((abs(a[0] - a[-1])))"
] | false | 0.090609 | 0.091093 | 0.994692 | [
"s704931794",
"s061216421"
] |
u254871849 | p03557 | python | s860589973 | s439987341 | 303 | 273 | 22,720 | 50,040 | Accepted | Accepted | 9.9 | import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
n = int(sys.stdin.readline().rstrip())
a = sorted(map(int, sys.stdin.readline().split()))
b = sorted(map(int, sys.stdin.readline().split()))
c = sorted(map(int, sys.stdin.readline().split()))
def main():
combs = 0
for x in b:
... | import sys
import numpy as np
n = int(sys.stdin.readline().rstrip())
a, b, c = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(3, n)
a.sort(); c.sort()
def main():
print((np.sum(np.searchsorted(a, b) * (n - np.searchsorted(c, b, side='right')))))
if __name__ == '__main__':
main() | 16 | 12 | 426 | 312 | import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
n = int(sys.stdin.readline().rstrip())
a = sorted(map(int, sys.stdin.readline().split()))
b = sorted(map(int, sys.stdin.readline().split()))
c = sorted(map(int, sys.stdin.readline().split()))
def main():
combs = 0
for x in b:
com... | import sys
import numpy as np
n = int(sys.stdin.readline().rstrip())
a, b, c = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(3, n)
a.sort()
c.sort()
def main():
print((np.sum(np.searchsorted(a, b) * (n - np.searchsorted(c, b, side="right")))))
if __name__ == "__main__":
main()
| false | 25 | [
"-from bisect import bisect_left as bi_l, bisect_right as bi_r",
"+import numpy as np",
"-a = sorted(map(int, sys.stdin.readline().split()))",
"-b = sorted(map(int, sys.stdin.readline().split()))",
"-c = sorted(map(int, sys.stdin.readline().split()))",
"+a, b, c = np.array(sys.stdin.read().split(), dtype=... | false | 0.060138 | 0.307934 | 0.195294 | [
"s860589973",
"s439987341"
] |
u022407960 | p02240 | python | s195988272 | s614729304 | 400 | 360 | 35,696 | 35,624 | Accepted | Accepted | 10 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def assign_color():
_color = 1
for m in range(vertices_num):
if vertices_status_list[m] == -1:
graph_dfs(m, _color)
_color += 1
return None
def graph_dfs(vertex, color):
vertices_stack = list()
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def assign_color():
_color = 1
for m in range(vertices_num):
if vertices_status_list[m] == -1:
graph_dfs(m, _color)
_color += 1
return None
def graph_dfs(vertex, color):
vertices_stack = list()
... | 55 | 60 | 1,518 | 1,588 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def assign_color():
_color = 1
for m in range(vertices_num):
if vertices_status_list[m] == -1:
graph_dfs(m, _color)
_color += 1
return None
def graph_dfs(vertex, color):
vertices_stack = list()
vertices_stac... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def assign_color():
_color = 1
for m in range(vertices_num):
if vertices_status_list[m] == -1:
graph_dfs(m, _color)
_color += 1
return None
def graph_dfs(vertex, color):
vertices_stack = list()
vertices_stac... | false | 8.333333 | [
"-if __name__ == \"__main__\":",
"- _input = sys.stdin.readlines()",
"- vertices_num, relation_num = list(map(int, _input[0].split()))",
"- relation_info = _input[1 : relation_num + 1]",
"- question_num = int(_input[relation_num + 1])",
"- question_list = _input[relation_num + 2 :]",
"- ... | false | 0.049078 | 0.049565 | 0.990178 | [
"s195988272",
"s614729304"
] |
u991567869 | p03038 | python | s498223297 | s904788096 | 556 | 376 | 97,052 | 37,424 | Accepted | Accepted | 32.37 | from collections import Counter
n, m = list(map(int, input().split()))
a = Counter(list(map(int, input().split())))
bc = [list(map(int, input().split())) for i in range(m)]
b = {}
ans = 0
for i, j in bc:
if j in b:
ref = b[j]
b[j] = ref + i
else:
b[j] = i
d = Counter(a)... | n, m = list(map(int, input().split()))
l = [(a, 1) for a in list(map(int, input().split()))]
for i in range(m):
b, c = list(map(int, input().split()))
l.append((c, b))
l = sorted(l)[::-1]
ans = 0
for i, j in l:
if j < n:
ans += i*j
n -= j
else:
ans += n*i
b... | 28 | 17 | 504 | 326 | from collections import Counter
n, m = list(map(int, input().split()))
a = Counter(list(map(int, input().split())))
bc = [list(map(int, input().split())) for i in range(m)]
b = {}
ans = 0
for i, j in bc:
if j in b:
ref = b[j]
b[j] = ref + i
else:
b[j] = i
d = Counter(a) + Counter(b)
key... | n, m = list(map(int, input().split()))
l = [(a, 1) for a in list(map(int, input().split()))]
for i in range(m):
b, c = list(map(int, input().split()))
l.append((c, b))
l = sorted(l)[::-1]
ans = 0
for i, j in l:
if j < n:
ans += i * j
n -= j
else:
ans += n * i
break
print(... | false | 39.285714 | [
"-from collections import Counter",
"-",
"-a = Counter(list(map(int, input().split())))",
"-bc = [list(map(int, input().split())) for i in range(m)]",
"-b = {}",
"+l = [(a, 1) for a in list(map(int, input().split()))]",
"+for i in range(m):",
"+ b, c = list(map(int, input().split()))",
"+ l.ap... | false | 0.061118 | 0.098252 | 0.622056 | [
"s498223297",
"s904788096"
] |
u054825571 | p03038 | python | s150374209 | s737632868 | 319 | 237 | 38,940 | 38,968 | Accepted | Accepted | 25.71 | N,M=list(map(int,input().split()))
L=sorted(list([(1,int(x)) for x in input().split()])
+[tuple(map(int,input().split())) for _ in range(M)]
,key=lambda x: x[1],reverse=True)
ans,k=0,0
for n,a in L:
if n+k>=N:
ans+=a*(N-k)
break
else:
ans+=a*n
k+=n
print(ans) | import sys
N,M=list(map(int,sys.stdin.readline().split()))
L=sorted(list([(1,int(x)) for x in sys.stdin.readline().split()])
+[tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
,key=lambda x: x[1],reverse=True)
ans,k=0,0
for n,a in L:
if n+k>=N:
ans+=a*(N-k)
break
... | 13 | 14 | 308 | 360 | N, M = list(map(int, input().split()))
L = sorted(
list([(1, int(x)) for x in input().split()])
+ [tuple(map(int, input().split())) for _ in range(M)],
key=lambda x: x[1],
reverse=True,
)
ans, k = 0, 0
for n, a in L:
if n + k >= N:
ans += a * (N - k)
break
else:
ans += a ... | import sys
N, M = list(map(int, sys.stdin.readline().split()))
L = sorted(
list([(1, int(x)) for x in sys.stdin.readline().split()])
+ [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)],
key=lambda x: x[1],
reverse=True,
)
ans, k = 0, 0
for n, a in L:
if n + k >= N:
ans += a ... | false | 7.142857 | [
"-N, M = list(map(int, input().split()))",
"+import sys",
"+",
"+N, M = list(map(int, sys.stdin.readline().split()))",
"- list([(1, int(x)) for x in input().split()])",
"- + [tuple(map(int, input().split())) for _ in range(M)],",
"+ list([(1, int(x)) for x in sys.stdin.readline().split()])",
... | false | 0.035865 | 0.03599 | 0.996532 | [
"s150374209",
"s737632868"
] |
u046187684 | p03458 | python | s617567605 | s873633069 | 1,181 | 1,034 | 136,804 | 136,804 | Accepted | Accepted | 12.45 | import numpy as np
def solve(string):
n, k, *xyc = string.split()
k = int(k)
l = 2 * int(k)
xy = [(int(x) % l, int(y) % l) if c == "W" else (int(x) % l, (int(y) + k) % l)
for x, y, c in zip(xyc[::3], xyc[1::3], xyc[2::3])]
ans = [[0 for j in range(l + 0)] for i in range(l + 0)]
... | import numpy as np
def solve(string):
n, k, *xyc = string.split()
k = int(k)
l = 2 * int(k)
xy = [(int(x) % l, int(y) % l) if c == "W" else (int(x) % l, (int(y) + k) % l)
for x, y, c in zip(xyc[::3], xyc[1::3], xyc[2::3])]
ans = [[0 for j in range(l + 0)] for i in range(l + 0)]
... | 40 | 34 | 1,261 | 1,015 | import numpy as np
def solve(string):
n, k, *xyc = string.split()
k = int(k)
l = 2 * int(k)
xy = [
(int(x) % l, int(y) % l) if c == "W" else (int(x) % l, (int(y) + k) % l)
for x, y, c in zip(xyc[::3], xyc[1::3], xyc[2::3])
]
ans = [[0 for j in range(l + 0)] for i in range(l + 0... | import numpy as np
def solve(string):
n, k, *xyc = string.split()
k = int(k)
l = 2 * int(k)
xy = [
(int(x) % l, int(y) % l) if c == "W" else (int(x) % l, (int(y) + k) % l)
for x, y, c in zip(xyc[::3], xyc[1::3], xyc[2::3])
]
ans = [[0 for j in range(l + 0)] for i in range(l + 0... | false | 15 | [
"- _x %= k",
"- _y %= k",
"- ans[_x][_y] += 2",
"- ans[_x + k][_y] -= 2",
"- ans[_x][_y + k] -= 2",
"- ans[_x + k][_y + k] += 2",
"- ans[_x + k][0] += 1",
"- ans[0][_y + k] += 1",
"+ lt = 2",
"+ ... | false | 0.44568 | 0.203827 | 2.186564 | [
"s617567605",
"s873633069"
] |
u894258749 | p03063 | python | s587120468 | s876005376 | 112 | 73 | 6,720 | 3,500 | Accepted | Accepted | 34.82 | inpl = lambda: list(map(int,input().split()))
def get_sequence(arr):
if len(arr) == 0:
return [], []
elements = []
nums = []
n = 1
prev = arr[0]
for c in arr[1:]:
if c == prev:
n += 1
else:
elements.append(prev)
nums.appe... | inpl = lambda: list(map(int,input().split()))
N = int(eval(input()))
S = eval(input())
W = S.count('.')
cur = W
ans = cur
for i in range(N):
if S[i] == '.':
cur -= 1
if cur < ans:
ans = cur
else:
cur += 1
print(ans) | 43 | 15 | 736 | 262 | inpl = lambda: list(map(int, input().split()))
def get_sequence(arr):
if len(arr) == 0:
return [], []
elements = []
nums = []
n = 1
prev = arr[0]
for c in arr[1:]:
if c == prev:
n += 1
else:
elements.append(prev)
nums.append(n)
... | inpl = lambda: list(map(int, input().split()))
N = int(eval(input()))
S = eval(input())
W = S.count(".")
cur = W
ans = cur
for i in range(N):
if S[i] == ".":
cur -= 1
if cur < ans:
ans = cur
else:
cur += 1
print(ans)
| false | 65.116279 | [
"-",
"-",
"-def get_sequence(arr):",
"- if len(arr) == 0:",
"- return [], []",
"- elements = []",
"- nums = []",
"- n = 1",
"- prev = arr[0]",
"- for c in arr[1:]:",
"- if c == prev:",
"- n += 1",
"- else:",
"- elements.append(pr... | false | 0.047505 | 0.118447 | 0.401065 | [
"s587120468",
"s876005376"
] |
u379142263 | p02773 | python | s006359687 | s875883725 | 1,559 | 788 | 54,112 | 35,572 | Accepted | Accepted | 49.45 | import sys
import collections
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s = sorted(s)
c = collections.Counter(s)
li = []
max_v = -1
for k,j in list(c.items()):
li.append([k,j])
if max_v<j:
max_v = j
li = sorted(li)
for i in range(len(li)):
if li[i][1] == max_v:
... | import collections
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s.sort()
t = collections.Counter(s)
maxv = max(t.values())
li = []
for key,value in list(t.items()):
if value == maxv:
li.append(key)
li.sort()
for i in range(len(li)):
print((li[i])) | 16 | 13 | 321 | 271 | import sys
import collections
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s = sorted(s)
c = collections.Counter(s)
li = []
max_v = -1
for k, j in list(c.items()):
li.append([k, j])
if max_v < j:
max_v = j
li = sorted(li)
for i in range(len(li)):
if li[i][1] == max_v:
print(... | import collections
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s.sort()
t = collections.Counter(s)
maxv = max(t.values())
li = []
for key, value in list(t.items()):
if value == maxv:
li.append(key)
li.sort()
for i in range(len(li)):
print((li[i]))
| false | 18.75 | [
"-import sys",
"-s = sorted(s)",
"-c = collections.Counter(s)",
"+s.sort()",
"+t = collections.Counter(s)",
"+maxv = max(t.values())",
"-max_v = -1",
"-for k, j in list(c.items()):",
"- li.append([k, j])",
"- if max_v < j:",
"- max_v = j",
"-li = sorted(li)",
"+for key, value in... | false | 0.041646 | 0.037352 | 1.114971 | [
"s006359687",
"s875883725"
] |
u252828980 | p03476 | python | s664730803 | s174927135 | 1,662 | 911 | 4,980 | 8,124 | Accepted | Accepted | 45.19 | import bisect
q = int(eval(input()))
def pr(n):
is_prime = [True]*(n+2)
is_prime[0] = False
is_prime[1] = False
for i in range(2,int((n+1)**0.5)+1):
for j in range(2,i+1):
if is_prime[i] == False:
continue
for k in range(2*i,n+1,i):
... | q = int (eval(input()))
def pr(n):
L = [1]*(n+1)
L[0] = 0
L[1] = 0
for i in range(2,n+1):
for j in range(2*i,n,i):
L[j] = 0
return L
a = pr(100001)
li = [0]*(100001)
for i in range(1,100000,2):
if a[i] and a[(i+1)//2]:
li[i] = 1
from ... | 29 | 24 | 651 | 449 | import bisect
q = int(eval(input()))
def pr(n):
is_prime = [True] * (n + 2)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int((n + 1) ** 0.5) + 1):
for j in range(2, i + 1):
if is_prime[i] == False:
continue
for k in range(2 * i, n + 1, i):
... | q = int(eval(input()))
def pr(n):
L = [1] * (n + 1)
L[0] = 0
L[1] = 0
for i in range(2, n + 1):
for j in range(2 * i, n, i):
L[j] = 0
return L
a = pr(100001)
li = [0] * (100001)
for i in range(1, 100000, 2):
if a[i] and a[(i + 1) // 2]:
li[i] = 1
from itertools im... | false | 17.241379 | [
"-import bisect",
"-",
"- is_prime = [True] * (n + 2)",
"- is_prime[0] = False",
"- is_prime[1] = False",
"- for i in range(2, int((n + 1) ** 0.5) + 1):",
"- for j in range(2, i + 1):",
"- if is_prime[i] == False:",
"- continue",
"- for k in ... | false | 2.305251 | 0.199458 | 11.557602 | [
"s664730803",
"s174927135"
] |
u165578704 | p02367 | python | s728844999 | s564959438 | 270 | 200 | 19,224 | 19,152 | Accepted | Accepted | 25.93 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
INF=float('inf')
N,M=MAP()
nodes=[[] for i in range(... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
INF=float('inf')
N,M=MAP()
nodes=[[] for i in range(... | 50 | 48 | 1,156 | 1,113 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
INF = float("inf")
N, M = MAP()
nodes = [[... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
INF = float("inf")
N, M = MAP()
nodes = [[... | false | 4 | [
"-visited = [False] * N",
"- visited[cur] = True",
"- if not visited[nxt]:",
"+ if not prenum[nxt]:"
] | false | 0.037643 | 0.037286 | 1.009577 | [
"s728844999",
"s564959438"
] |
u394721319 | p03723 | python | s471151995 | s982321953 | 183 | 27 | 38,384 | 9,136 | Accepted | Accepted | 85.25 | A,B,C = [int(i) for i in input().split()]
if A%2 == 0 and B%2 == 0 and C%2 == 0:
if A==B and B==C:
print((-1))
exit()
ans = 0
while True:
if A%2 == 0 and B%2 == 0 and C%2 == 0:
ans += 1
A,B,C = [(A+B)/2, (B+C)/2, (C+A)/2]
else:
... | A,B,C = [int(i) for i in input().split()]
if A%2+B%2+C%2 != 0:
print((0))
exit()
p = [set([A,B,C])]
cnt = 1
while True:
a = B//2+C//2
b = A//2+C//2
c = A//2+B//2
if a%2+b%2+c%2 != 0:
print(cnt)
exit()
if set([a,b,c]) in p:
print((-1))
exit... | 17 | 25 | 373 | 425 | A, B, C = [int(i) for i in input().split()]
if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
if A == B and B == C:
print((-1))
exit()
ans = 0
while True:
if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
ans += 1
A, B, C = [(A + B) / 2, (B + C) / 2, (C + A) / 2]
... | A, B, C = [int(i) for i in input().split()]
if A % 2 + B % 2 + C % 2 != 0:
print((0))
exit()
p = [set([A, B, C])]
cnt = 1
while True:
a = B // 2 + C // 2
b = A // 2 + C // 2
c = A // 2 + B // 2
if a % 2 + b % 2 + c % 2 != 0:
print(cnt)
exit()
if set([a, b, c]) in p:
p... | false | 32 | [
"-if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:",
"- if A == B and B == C:",
"+if A % 2 + B % 2 + C % 2 != 0:",
"+ print((0))",
"+ exit()",
"+p = [set([A, B, C])]",
"+cnt = 1",
"+while True:",
"+ a = B // 2 + C // 2",
"+ b = A // 2 + C // 2",
"+ c = A // 2 + B // 2",
"+ if ... | false | 0.041136 | 0.05659 | 0.726901 | [
"s471151995",
"s982321953"
] |
u227662707 | p02879 | python | s471728077 | s839232403 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | a, b=list(map(int, input().split()))
if 9>=a and a>=1 and 9>=b and b>=1:
print((a*b))
else:
print((-1))
| a, b=list(map(int, input().split()))
if a>=1 and 9>=a and b>=1 and 9>=b:
print((a * b))
else:
print((-1))
| 6 | 6 | 104 | 106 | a, b = list(map(int, input().split()))
if 9 >= a and a >= 1 and 9 >= b and b >= 1:
print((a * b))
else:
print((-1))
| a, b = list(map(int, input().split()))
if a >= 1 and 9 >= a and b >= 1 and 9 >= b:
print((a * b))
else:
print((-1))
| false | 0 | [
"-if 9 >= a and a >= 1 and 9 >= b and b >= 1:",
"+if a >= 1 and 9 >= a and b >= 1 and 9 >= b:"
] | false | 0.040564 | 0.039123 | 1.036828 | [
"s471728077",
"s839232403"
] |
u288335507 | p02732 | python | s390562470 | s771984161 | 456 | 372 | 99,660 | 26,912 | Accepted | Accepted | 18.42 | n = int(eval(input()))
a = list(map(int, input().split()))
def factorial(n):
v = 1
for i in range(1, n + 1):
v *= i
return v
def comb(a, b):
return factorial(a) // (factorial(b) * factorial(a - b))
from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values(... | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in range(len(value)):
if value[i] > 1:
sv += (value[i]*(value[i]-1))//2
for i in range(n):
cur = a[i]
cursv = sv
if acnt[cur] ... | 27 | 18 | 596 | 422 | n = int(eval(input()))
a = list(map(int, input().split()))
def factorial(n):
v = 1
for i in range(1, n + 1):
v *= i
return v
def comb(a, b):
return factorial(a) // (factorial(b) * factorial(a - b))
from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
... | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in range(len(value)):
if value[i] > 1:
sv += (value[i] * (value[i] - 1)) // 2
for i in range(n):
cur = a[i]
cursv = sv
if acnt[cur] > 2:
... | false | 33.333333 | [
"-",
"-",
"-def factorial(n):",
"- v = 1",
"- for i in range(1, n + 1):",
"- v *= i",
"- return v",
"-",
"-",
"-def comb(a, b):",
"- return factorial(a) // (factorial(b) * factorial(a - b))",
"-",
"-"
] | false | 0.036259 | 0.036949 | 0.981325 | [
"s390562470",
"s771984161"
] |
u827241372 | p03061 | python | s693258182 | s272855058 | 202 | 171 | 16,112 | 16,148 | Accepted | Accepted | 15.35 | import fractions
def main() -> None:
N = int(eval(input()))
A = [int(x) for x in input().split()]
left = [0] * (N + 1)
right = [0] * (N + 1)
for i in range(N):
left[i + 1] = (fractions.gcd(left[i], A[i]))
right[N - i - 1] = (fractions.gcd(right[N - i], A[N - 1 - i]))
... | import fractions
def main() -> None:
N = int(eval(input()))
A = list(map(int, input().split()))
gcd_l = [0]
gcd_r = [0]
for i in range(N):
gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
gcd_r.append(fractions.gcd(gcd_r[i], A[-(i + 1)]))
gcd_r = gcd_r[::-1]
ans ... | 21 | 23 | 473 | 469 | import fractions
def main() -> None:
N = int(eval(input()))
A = [int(x) for x in input().split()]
left = [0] * (N + 1)
right = [0] * (N + 1)
for i in range(N):
left[i + 1] = fractions.gcd(left[i], A[i])
right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i])
ans = 0
fo... | import fractions
def main() -> None:
N = int(eval(input()))
A = list(map(int, input().split()))
gcd_l = [0]
gcd_r = [0]
for i in range(N):
gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
gcd_r.append(fractions.gcd(gcd_r[i], A[-(i + 1)]))
gcd_r = gcd_r[::-1]
ans = []
for i i... | false | 8.695652 | [
"- A = [int(x) for x in input().split()]",
"- left = [0] * (N + 1)",
"- right = [0] * (N + 1)",
"+ A = list(map(int, input().split()))",
"+ gcd_l = [0]",
"+ gcd_r = [0]",
"- left[i + 1] = fractions.gcd(left[i], A[i])",
"- right[N - i - 1] = fractions.gcd(right[N - i], A... | false | 0.048813 | 0.137815 | 0.354188 | [
"s693258182",
"s272855058"
] |
u906501980 | p02726 | python | s563886936 | s934921999 | 472 | 375 | 89,564 | 83,804 | Accepted | Accepted | 20.55 | from collections import deque
def main():
n, x, y = list(map(int, input().split()))
cnt = [0]*n
q = deque()
for i in range(n):
q.appendleft([i, 0])
dist = [None]*n
dist[i] = 0
while q:
j, d = q.pop()
cnt[d] += 1
if j... | from collections import deque
def main():
n, x, y = list(map(int, input().split()))
cnt = [0]*n
q = deque()
for i in range(n):
q.appendleft(i)
dist = [None]*n
dist[i] = 0
while q:
j = q.pop()
d = dist[j]
cnt[d] += 1
... | 32 | 33 | 899 | 888 | from collections import deque
def main():
n, x, y = list(map(int, input().split()))
cnt = [0] * n
q = deque()
for i in range(n):
q.appendleft([i, 0])
dist = [None] * n
dist[i] = 0
while q:
j, d = q.pop()
cnt[d] += 1
if j > 0 and dist[... | from collections import deque
def main():
n, x, y = list(map(int, input().split()))
cnt = [0] * n
q = deque()
for i in range(n):
q.appendleft(i)
dist = [None] * n
dist[i] = 0
while q:
j = q.pop()
d = dist[j]
cnt[d] += 1
if... | false | 3.030303 | [
"- q.appendleft([i, 0])",
"+ q.appendleft(i)",
"- j, d = q.pop()",
"+ j = q.pop()",
"+ d = dist[j]",
"- q.appendleft([j - 1, d + 1])",
"+ q.appendleft(j - 1)",
"- q.appendleft([j + 1, d + 1])",
"+ ... | false | 0.041164 | 0.101853 | 0.404157 | [
"s563886936",
"s934921999"
] |
u059210959 | p03206 | python | s422362313 | s853794319 | 170 | 37 | 14,164 | 10,744 | Accepted | Accepted | 78.24 | # encoding:utf-8
import copy
import numpy as np
import random
d = int(eval(input()))
christmas = "Christmas"
plus = " Eve"
print((christmas+plus*(25-d)))
| #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | 12 | 22 | 161 | 483 | # encoding:utf-8
import copy
import numpy as np
import random
d = int(eval(input()))
christmas = "Christmas"
plus = " Eve"
print((christmas + plus * (25 - d)))
| #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | false | 45.454545 | [
"+#!/usr/bin/env python3",
"-import numpy as np",
"+import bisect # bisect_left これで二部探索の大小検索が行える",
"+import fractions # 最小公倍数などはこっち",
"+import math",
"+import sys",
"+import collections",
"+from decimal import Decimal # 10進数で考慮できる",
"-d = int(eval(input()))",
"-christmas = \"Christmas\"",
"-p... | false | 0.055602 | 0.045875 | 1.212022 | [
"s422362313",
"s853794319"
] |
u130900604 | p02657 | python | s716265146 | s728560276 | 55 | 34 | 61,628 | 8,928 | Accepted | Accepted | 38.18 | print((eval(input().replace(" ","*")))) | a,b=list(map(int,input().split()))
print((a*b)) | 1 | 2 | 37 | 40 | print((eval(input().replace(" ", "*"))))
| a, b = list(map(int, input().split()))
print((a * b))
| false | 50 | [
"-print((eval(input().replace(\" \", \"*\"))))",
"+a, b = list(map(int, input().split()))",
"+print((a * b))"
] | false | 0.007945 | 0.036462 | 0.217906 | [
"s716265146",
"s728560276"
] |
u998741086 | p03680 | python | s210674204 | s480061289 | 176 | 161 | 16,708 | 12,912 | Accepted | Accepted | 8.52 | #/usr/bin/env python
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
lighted = [0]
ans = 0
for i in range(n):
u = lighted[-1]
v = a[u]-1
ans += 1
if v == 1:
print(ans)
exit()
lighted.append(v)
print((-1))
| #/usr/bin/env python
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
ans = 0
v = 0
for i in range(n):
v = a[v]-1
ans += 1
if v == 1:
print(ans)
exit()
print((-1))
| 18 | 15 | 268 | 214 | # /usr/bin/env python
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
lighted = [0]
ans = 0
for i in range(n):
u = lighted[-1]
v = a[u] - 1
ans += 1
if v == 1:
print(ans)
exit()
lighted.append(v)
print((-1))
| # /usr/bin/env python
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
ans = 0
v = 0
for i in range(n):
v = a[v] - 1
ans += 1
if v == 1:
print(ans)
exit()
print((-1))
| false | 16.666667 | [
"-lighted = [0]",
"+v = 0",
"- u = lighted[-1]",
"- v = a[u] - 1",
"+ v = a[v] - 1",
"- lighted.append(v)"
] | false | 0.055863 | 0.154223 | 0.362223 | [
"s210674204",
"s480061289"
] |
u309834353 | p03164 | python | s594418226 | s447987518 | 1,100 | 760 | 305,104 | 278,792 | Accepted | Accepted | 30.91 | n,W = list(map(int, input().split()))
w = []
v = []
for i in range(n):
a,b = list(map(int, input().split()))
w.append(a)
v.append(b)
max_v = n*max(v)
c = [[0 for j in range(max_v)] for i in range(n)]
for i in range(max_v):
if i+1 > v[0]:
c[0][i] = float('inf')
else:
c[... | # 横軸:重さ
def knapsack(W,weight,value):
n = len(weight)#or len(value)
dp = [[0]*(W+1) for _ in range(n+1)]
# 初期化
for j in range(W):
dp[0][j] = 0
for i in range(n):
for j in range(W+1):
if weight[i] <= j:
dp[i+1][j] = max(dp[i][j-weight[i]]+value[i]... | 34 | 53 | 882 | 1,446 | n, W = list(map(int, input().split()))
w = []
v = []
for i in range(n):
a, b = list(map(int, input().split()))
w.append(a)
v.append(b)
max_v = n * max(v)
c = [[0 for j in range(max_v)] for i in range(n)]
for i in range(max_v):
if i + 1 > v[0]:
c[0][i] = float("inf")
else:
c[0][i] = w... | # 横軸:重さ
def knapsack(W, weight, value):
n = len(weight) # or len(value)
dp = [[0] * (W + 1) for _ in range(n + 1)]
# 初期化
for j in range(W):
dp[0][j] = 0
for i in range(n):
for j in range(W + 1):
if weight[i] <= j:
dp[i + 1][j] = max(dp[i][j - weight[i]] +... | false | 35.849057 | [
"-n, W = list(map(int, input().split()))",
"-w = []",
"-v = []",
"-for i in range(n):",
"- a, b = list(map(int, input().split()))",
"- w.append(a)",
"- v.append(b)",
"-max_v = n * max(v)",
"-c = [[0 for j in range(max_v)] for i in range(n)]",
"-for i in range(max_v):",
"- if i + 1 > ... | false | 0.046214 | 0.046918 | 0.984993 | [
"s594418226",
"s447987518"
] |
u837286475 | p03523 | python | s550037550 | s283497572 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 |
import re
s = eval(input())
pattern = re.compile("(A?KIHA?BA?RA?)")
ret = pattern.findall(s)
ret2 = pattern.findall("[^AKIHBR]")
#print(ret)
if ret is not None and len(ret) == 1 and len(ret[0]) == len(s):
ans = "YES"
else:
ans = "NO"
print(ans) |
def solve1():
import re
s = eval(input())
pattern = re.compile("(A?KIHA?BA?RA?)")
ret = pattern.findall(s)
#print(ret)
if ret is not None and len(ret) == 1 and len(ret[0]) == len(s):
ans = "YES"
else:
ans = "NO"
print(ans)
def solve2():
... | 18 | 48 | 271 | 787 | import re
s = eval(input())
pattern = re.compile("(A?KIHA?BA?RA?)")
ret = pattern.findall(s)
ret2 = pattern.findall("[^AKIHBR]")
# print(ret)
if ret is not None and len(ret) == 1 and len(ret[0]) == len(s):
ans = "YES"
else:
ans = "NO"
print(ans)
| def solve1():
import re
s = eval(input())
pattern = re.compile("(A?KIHA?BA?RA?)")
ret = pattern.findall(s)
# print(ret)
if ret is not None and len(ret) == 1 and len(ret[0]) == len(s):
ans = "YES"
else:
ans = "NO"
print(ans)
def solve2():
s = eval(input())
base ... | false | 62.5 | [
"-import re",
"+def solve1():",
"+ import re",
"-s = eval(input())",
"-pattern = re.compile(\"(A?KIHA?BA?RA?)\")",
"-ret = pattern.findall(s)",
"-ret2 = pattern.findall(\"[^AKIHBR]\")",
"-# print(ret)",
"-if ret is not None and len(ret) == 1 and len(ret[0]) == len(s):",
"- ans = \"YES\"",
... | false | 0.050311 | 0.046018 | 1.09329 | [
"s550037550",
"s283497572"
] |
u934529721 | p03624 | python | s373198463 | s062934827 | 32 | 24 | 3,960 | 3,832 | Accepted | Accepted | 25 | import string
S = eval(input())
al = string.ascii_lowercase
for x in al:
if x not in S:
print(x)
break
else:
print("None") | import string
S = eval(input())
eigo = string.ascii_lowercase
eigo_list = list(eigo)
count = 0
for x in eigo_list:
if not x in S:
print(x)
count += 1
break
if count == 0:
print("None")
| 9 | 16 | 148 | 239 | import string
S = eval(input())
al = string.ascii_lowercase
for x in al:
if x not in S:
print(x)
break
else:
print("None")
| import string
S = eval(input())
eigo = string.ascii_lowercase
eigo_list = list(eigo)
count = 0
for x in eigo_list:
if not x in S:
print(x)
count += 1
break
if count == 0:
print("None")
| false | 43.75 | [
"-al = string.ascii_lowercase",
"-for x in al:",
"- if x not in S:",
"+eigo = string.ascii_lowercase",
"+eigo_list = list(eigo)",
"+count = 0",
"+for x in eigo_list:",
"+ if not x in S:",
"+ count += 1",
"-else:",
"+if count == 0:"
] | false | 0.048216 | 0.054341 | 0.887289 | [
"s373198463",
"s062934827"
] |
u970197315 | p02791 | python | s226379493 | s275998797 | 193 | 105 | 25,348 | 32,372 | Accepted | Accepted | 45.6 | # ABC 152 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
snm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
n=ni()
p=nl()
s=[]
ans=0
min_v=10**6
for i in range(n):
if i==0:
ans+=1
s.appen... | n=int(eval(input()))
p=list(map(int,input().split()))
min_val=10**18
ans=0
for i in range(n):
if i==0:
min_val=p[i]
ans+=1
continue
if min_val>=p[i]:
min_val=p[i]
ans+=1
print(ans)
| 22 | 15 | 448 | 215 | # ABC 152 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
snm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
n = ni()
p = nl()
s = []
ans = 0
min_v = 10**6
for i in range(n):
if i == 0:
ans += 1
s.appen... | n = int(eval(input()))
p = list(map(int, input().split()))
min_val = 10**18
ans = 0
for i in range(n):
if i == 0:
min_val = p[i]
ans += 1
continue
if min_val >= p[i]:
min_val = p[i]
ans += 1
print(ans)
| false | 31.818182 | [
"-# ABC 152 C",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-snm = lambda: list(map(str, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-n = ni()",
"-p = nl()",
"-s = []",
"+n = int(eval(input()))",
"... | false | 0.03871 | 0.041114 | 0.941549 | [
"s226379493",
"s275998797"
] |
u780962115 | p03546 | python | s245308842 | s143197238 | 79 | 38 | 3,620 | 3,444 | Accepted | Accepted | 51.9 | magialist=[]
datalist=[]
h,w=list(map(int,input().split()))
for i in range(10):
add=list(map(int,input().split()))
magialist.append(add)
for j in range(h):
add1=list(map(int,input().split()))
datalist.extend(add1)
storelist=[[[[] for i in range(10)] for i in range(10)] for i in range(10)]
... | h,w=list(map(int,input().split()))
d=[list(map(int,input().split())) for _ in range(10)]
e=[list(map(int,input().split())) for _ in range(h)]
def warshall_floyd(d,n):
#d[i][j]=i番目の頂点からj番目の頂点までの最短距離
for k in range(n+1):
for i in range(n+1):
for j in range(n+1):
d[i][j]... | 38 | 17 | 1,072 | 503 | magialist = []
datalist = []
h, w = list(map(int, input().split()))
for i in range(10):
add = list(map(int, input().split()))
magialist.append(add)
for j in range(h):
add1 = list(map(int, input().split()))
datalist.extend(add1)
storelist = [[[[] for i in range(10)] for i in range(10)] for i in range(10)... | h, w = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(10)]
e = [list(map(int, input().split())) for _ in range(h)]
def warshall_floyd(d, n):
# d[i][j]=i番目の頂点からj番目の頂点までの最短距離
for k in range(n + 1):
for i in range(n + 1):
for j in range(n + 1):
... | false | 55.263158 | [
"-magialist = []",
"-datalist = []",
"-for i in range(10):",
"- add = list(map(int, input().split()))",
"- magialist.append(add)",
"-for j in range(h):",
"- add1 = list(map(int, input().split()))",
"- datalist.extend(add1)",
"-storelist = [[[[] for i in range(10)] for i in range(10)] for... | false | 0.036762 | 0.044876 | 0.819208 | [
"s245308842",
"s143197238"
] |
u250583425 | p02733 | python | s077003787 | s396053054 | 1,079 | 338 | 43,100 | 42,972 | Accepted | Accepted | 68.67 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
H, W, K = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
ans = 10 ** 9
for bit in range(1 << (H-1)):
canSolve = True
ord = [0] * (H + 1)
N = 0
for i in range(H)... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
H, W, K = list(map(int, input().split()))
S = [tuple(map(int, list(eval(input())))) for _ in range(H)]
ans = 10 ** 9
for bit in range(1 << (H-1)):
canSolve = True
ord = [0] * (H + 1)
N = 0
... | 41 | 41 | 1,086 | 1,099 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
H, W, K = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
ans = 10**9
for bit in range(1 << (H - 1)):
canSolve = True
ord = [0] * (H + 1)
N = 0
for i in range(H):
... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
H, W, K = list(map(int, input().split()))
S = [tuple(map(int, list(eval(input())))) for _ in range(H)]
ans = 10**9
for bit in range(1 << (H - 1)):
canSolve = True
ord = [0] * (H + 1)
N = 0
fo... | false | 0 | [
"- S = [eval(input()) for _ in range(H)]",
"+ S = [tuple(map(int, list(eval(input())))) for _ in range(H)]",
"- one[ord[h]] += int(S[h][w])",
"- nums[ord[h]] += int(S[h][w])",
"+ one[ord[h]] += S[h][w]",
"+ nums[ord[h]] += S[h][w]"
] | false | 0.079642 | 0.106264 | 0.749477 | [
"s077003787",
"s396053054"
] |
u564589929 | p03127 | python | s160043305 | s722297090 | 178 | 84 | 15,120 | 16,296 | Accepted | Accepted | 52.81 | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): retur... | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): retur... | 39 | 29 | 952 | 695 | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def... | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def... | false | 25.641026 | [
"+from fractions import gcd",
"- A = sorted(A)",
"- # print(A)",
"- # for _ in range(10):",
"- while 1:",
"- if len(set(A)) == 1:",
"- print((A[0]))",
"- return",
"- a0 = A[0]",
"- for i in range(1, n):",
"- ai = A[i]",
"- ... | false | 0.146177 | 0.046124 | 3.169199 | [
"s160043305",
"s722297090"
] |
u773265208 | p02924 | python | s324275572 | s332258420 | 167 | 17 | 38,384 | 3,064 | Accepted | Accepted | 89.82 | n = int(eval(input()))
print((n*(n+1)//2 - n)) | n = int(eval(input()))
print((n * (n-1)//2 ))
| 2 | 3 | 39 | 41 | n = int(eval(input()))
print((n * (n + 1) // 2 - n))
| n = int(eval(input()))
print((n * (n - 1) // 2))
| false | 33.333333 | [
"-print((n * (n + 1) // 2 - n))",
"+print((n * (n - 1) // 2))"
] | false | 0.043346 | 0.044738 | 0.968883 | [
"s324275572",
"s332258420"
] |
u386819480 | p03796 | python | s678060092 | s922586516 | 36 | 30 | 2,940 | 2,940 | Accepted | Accepted | 16.67 | ## ABC 055B
d = 1000000007
n = int(eval(input()))
ans = 1
for i in range(1,n+1):
ans = (ans*i)%d
print(ans) | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
MOD = 1000000007 # type: int
def solve(N: int):
ans = 1
for i in range(1, N+1):
ans = (ans * i) % MOD
print(ans)
return
# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use t... | 9 | 29 | 115 | 667 | ## ABC 055B
d = 1000000007
n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
ans = (ans * i) % d
print(ans)
| #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
MOD = 1000000007 # type: int
def solve(N: int):
ans = 1
for i in range(1, N + 1):
ans = (ans * i) % MOD
print(ans)
return
# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default templa... | false | 68.965517 | [
"-## ABC 055B",
"-d = 1000000007",
"-n = int(eval(input()))",
"-ans = 1",
"-for i in range(1, n + 1):",
"- ans = (ans * i) % d",
"-print(ans)",
"+#!/usr/bin/env python3",
"+import sys",
"+",
"+sys.setrecursionlimit(10000000)",
"+MOD = 1000000007 # type: int",
"+",
"+",
"+def solve(N:... | false | 0.049945 | 0.050857 | 0.98206 | [
"s678060092",
"s922586516"
] |
u821624310 | p02411 | python | s898306167 | s785851953 | 30 | 20 | 7,652 | 7,596 | Accepted | Accepted | 33.33 | while 1:
m, f, r = map(int, input().split())
if m == -1 and f == -1 and r == -1:
break
if m == -1 or f == -1:
print("F")
elif m + f < 30:
print("F")
elif m + f < 50 and r < 50:
print("D")
elif m + f < 65\
or m + f < 50 and r > 50:
print("... | while True:
m, f, r = map(int, input().split())
if m == -1\
and f == -1\
and r == -1:
break
if m == -1\
or f == -1:
print("F")
elif m + f >= 80:
print("A")
elif m + f >= 65:
print("B")
elif m + f >= 50\
or r >= 50:
print("C... | 17 | 21 | 396 | 407 | while 1:
m, f, r = map(int, input().split())
if m == -1 and f == -1 and r == -1:
break
if m == -1 or f == -1:
print("F")
elif m + f < 30:
print("F")
elif m + f < 50 and r < 50:
print("D")
elif m + f < 65 or m + f < 50 and r > 50:
print("C")
elif m + f ... | while True:
m, f, r = map(int, input().split())
if m == -1 and f == -1 and r == -1:
break
if m == -1 or f == -1:
print("F")
elif m + f >= 80:
print("A")
elif m + f >= 65:
print("B")
elif m + f >= 50 or r >= 50:
print("C")
elif m + f >= 30:
prin... | false | 19.047619 | [
"-while 1:",
"+while True:",
"+ elif m + f >= 80:",
"+ print(\"A\")",
"+ elif m + f >= 65:",
"+ print(\"B\")",
"+ elif m + f >= 50 or r >= 50:",
"+ print(\"C\")",
"+ elif m + f >= 30:",
"+ print(\"D\")",
"- elif m + f < 50 and r < 50:",
"- prin... | false | 0.071098 | 0.159547 | 0.445623 | [
"s898306167",
"s785851953"
] |
u897329068 | p02947 | python | s801976489 | s999345857 | 426 | 378 | 19,996 | 19,504 | Accepted | Accepted | 11.27 | from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1,r + 1)))
return over // under
N = int(eval(input()))
ss = []
for i in range(N):
ss.append(""... | N = int(eval(input()))
ss = []
for i in range(N):
ss.append("".join(sorted(list(eval(input())))))
dicS = {}
for s in ss:
if s not in dicS:
dicS[s] = 1
else:
dicS[s] += 1
#print(dicS)
ans = 0
for v in list(dicS.values()):
if v != 1:
ans += int((v*(v-1))/2)
print(ans) | 31 | 20 | 522 | 287 | from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
return over // under
N = int(eval(input()))
ss = []
for i in range(N):
ss.append("".join... | N = int(eval(input()))
ss = []
for i in range(N):
ss.append("".join(sorted(list(eval(input())))))
dicS = {}
for s in ss:
if s not in dicS:
dicS[s] = 1
else:
dicS[s] += 1
# print(dicS)
ans = 0
for v in list(dicS.values()):
if v != 1:
ans += int((v * (v - 1)) / 2)
print(ans)
| false | 35.483871 | [
"-from operator import mul",
"-from functools import reduce",
"-",
"-",
"-def cmb(n, r):",
"- r = min(n - r, r)",
"- if r == 0:",
"- return 1",
"- over = reduce(mul, list(range(n, n - r, -1)))",
"- under = reduce(mul, list(range(1, r + 1)))",
"- return over // under",
"-"... | false | 0.041918 | 0.070043 | 0.598467 | [
"s801976489",
"s999345857"
] |
u124605948 | p02572 | python | s683008536 | s376545213 | 178 | 121 | 31,636 | 31,760 | Accepted | Accepted | 32.02 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
cs = [0]
for a in A:
cs.append(cs[-1]+a)
cs = cs[1:]
ans = 0
for i in range(n):
ans += A[i] * (cs[-1]-cs[i])
ans %= mod
print(ans) | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
x = (((sum(A))**2) // 2)
x -= (sum([a**2 for a in A]) // 2)
x %= mod
print(x) | 15 | 9 | 226 | 154 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
cs = [0]
for a in A:
cs.append(cs[-1] + a)
cs = cs[1:]
ans = 0
for i in range(n):
ans += A[i] * (cs[-1] - cs[i])
ans %= mod
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
x = ((sum(A)) ** 2) // 2
x -= sum([a**2 for a in A]) // 2
x %= mod
print(x)
| false | 40 | [
"-cs = [0]",
"-for a in A:",
"- cs.append(cs[-1] + a)",
"-cs = cs[1:]",
"-ans = 0",
"-for i in range(n):",
"- ans += A[i] * (cs[-1] - cs[i])",
"- ans %= mod",
"-print(ans)",
"+x = ((sum(A)) ** 2) // 2",
"+x -= sum([a**2 for a in A]) // 2",
"+x %= mod",
"+print(x)"
] | false | 0.037568 | 0.037606 | 0.998968 | [
"s683008536",
"s376545213"
] |
u556589653 | p03486 | python | s173854089 | s608252412 | 169 | 18 | 38,384 | 3,060 | Accepted | Accepted | 89.35 | s = eval(input())
t = eval(input())
s_dash = []
t_dash = []
s_d = ""
t_d = ""
for i in range(len(s)):
s_dash.append(s[i])
for j in range(len(t)):
t_dash.append(t[j])
s_dash.sort()
t_dash.sort()
t_dash.reverse()
for i in range(len(s_dash)):
s_d += s_dash[i]
for j in range(len(t_dash)):
t_d += t_d... | s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort()
t.reverse()
A = ''.join(s)
B = ''.join(t)
if s<t:
print("Yes")
else:
print("No") | 21 | 11 | 365 | 148 | s = eval(input())
t = eval(input())
s_dash = []
t_dash = []
s_d = ""
t_d = ""
for i in range(len(s)):
s_dash.append(s[i])
for j in range(len(t)):
t_dash.append(t[j])
s_dash.sort()
t_dash.sort()
t_dash.reverse()
for i in range(len(s_dash)):
s_d += s_dash[i]
for j in range(len(t_dash)):
t_d += t_dash[j]
i... | s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort()
t.reverse()
A = "".join(s)
B = "".join(t)
if s < t:
print("Yes")
else:
print("No")
| false | 47.619048 | [
"-s = eval(input())",
"-t = eval(input())",
"-s_dash = []",
"-t_dash = []",
"-s_d = \"\"",
"-t_d = \"\"",
"-for i in range(len(s)):",
"- s_dash.append(s[i])",
"-for j in range(len(t)):",
"- t_dash.append(t[j])",
"-s_dash.sort()",
"-t_dash.sort()",
"-t_dash.reverse()",
"-for i in rang... | false | 0.040781 | 0.035588 | 1.145941 | [
"s173854089",
"s608252412"
] |
u645250356 | p03416 | python | s871744076 | s771052506 | 180 | 62 | 39,024 | 10,404 | Accepted | Accepted | 65.56 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
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 inpln(n): return list(int(sys.st... | 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()))
... | 16 | 16 | 501 | 442 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools
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 inpln(n):
r... | 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 | 0 | [
"-import sys, bisect, math, itertools",
"+import sys, bisect, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-for i in range(a, b + 1):",
"- tmp = str(i)",
"- if tmp[0] == tmp[-1] and... | false | 0.043451 | 0.043329 | 1.0028 | [
"s871744076",
"s771052506"
] |
u309141201 | p03699 | python | s766456631 | s677578201 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | import itertools
N = int(eval(input()))
s = [0] * N
not10 = []
answer = 0
for i in range(N):
s[i] = int(eval(input()))
SUM = sum(s)
if SUM % 10 != 0:
print(SUM)
exit()
else:
for i in range(N):
if s[i] % 10 != 0:
not10.append(s[i])
not10.sort()
if len(not10) ... | import itertools
N = int(eval(input()))
s = [0] * N
not10 = []
for i in range(N):
s[i] = int(eval(input()))
SUM = sum(s)
if SUM % 10 != 0:
print(SUM)
else:
for i in range(N):
if s[i] % 10 != 0:
not10.append(s[i])
not10.sort()
if len(not10) == 0:
print((0)... | 33 | 19 | 650 | 350 | import itertools
N = int(eval(input()))
s = [0] * N
not10 = []
answer = 0
for i in range(N):
s[i] = int(eval(input()))
SUM = sum(s)
if SUM % 10 != 0:
print(SUM)
exit()
else:
for i in range(N):
if s[i] % 10 != 0:
not10.append(s[i])
not10.sort()
if len(not10) == 0:
pri... | import itertools
N = int(eval(input()))
s = [0] * N
not10 = []
for i in range(N):
s[i] = int(eval(input()))
SUM = sum(s)
if SUM % 10 != 0:
print(SUM)
else:
for i in range(N):
if s[i] % 10 != 0:
not10.append(s[i])
not10.sort()
if len(not10) == 0:
print((0))
else:
... | false | 42.424242 | [
"-answer = 0",
"- exit()",
"- exit()",
"-# print(not10)",
"-# for i in range(1, N+1): # 何問正解するか、0からN問まで",
"-# for v in itertools.combinations(s, i):",
"-# if sum(v) % 10 != 0 and answer <= sum(v):",
"-# answer = sum(v)",
"-# print(v, sum(v))",
"-# print(answe... | false | 0.043243 | 0.044022 | 0.982307 | [
"s766456631",
"s677578201"
] |
u260980560 | p01105 | python | s757758898 | s457180384 | 690 | 130 | 7,672 | 7,848 | Accepted | Accepted | 81.16 | a=65280; b=61680; c=52428; d=43690; e=65535
base = [a, b, c, d, e, 0]
L = {el: 1 for el in base}
for i in range(6):
R = dict(L)
for p in R:
if R[p] < 16:
L[p ^ e] = min(L.get(p ^ e, 16), R[p] + 1)
if R[p]+3 < 16:
for q in R:
if R[p] + R[q] + 3 <=... | a=65280; b=61680; c=52428; d=43690; e=65535
L = {el: 1 for el in [a, b, c, d, e, 0]}
for i in range(6):
R = sorted(L.items(), key=lambda x: x[1])
for p, l in R:
if l < 16:
L[p ^ e] = min(L.get(p ^ e, 16), l+1)
if l+3 < 16:
for q, r in R:
... | 14 | 15 | 592 | 639 | a = 65280
b = 61680
c = 52428
d = 43690
e = 65535
base = [a, b, c, d, e, 0]
L = {el: 1 for el in base}
for i in range(6):
R = dict(L)
for p in R:
if R[p] < 16:
L[p ^ e] = min(L.get(p ^ e, 16), R[p] + 1)
if R[p] + 3 < 16:
for q in R:
if R[p] + R[q] + 3 <= 1... | a = 65280
b = 61680
c = 52428
d = 43690
e = 65535
L = {el: 1 for el in [a, b, c, d, e, 0]}
for i in range(6):
R = sorted(L.items(), key=lambda x: x[1])
for p, l in R:
if l < 16:
L[p ^ e] = min(L.get(p ^ e, 16), l + 1)
if l + 3 < 16:
for q, r in R:
... | false | 6.666667 | [
"-base = [a, b, c, d, e, 0]",
"-L = {el: 1 for el in base}",
"+L = {el: 1 for el in [a, b, c, d, e, 0]}",
"- R = dict(L)",
"- for p in R:",
"- if R[p] < 16:",
"- L[p ^ e] = min(L.get(p ^ e, 16), R[p] + 1)",
"- if R[p] + 3 < 16:",
"- for q in R:",
"- ... | false | 0.815035 | 0.280896 | 2.901555 | [
"s757758898",
"s457180384"
] |
u648901783 | p03479 | python | s017178479 | s138476628 | 23 | 17 | 3,444 | 2,940 | Accepted | Accepted | 26.09 | x,y = list(map(int,input().split()))
import copy
x1=copy.deepcopy(x)
y1=copy.deepcopy(y)
count=0
while(y1>=x1):
y1//=2
count+=1
print(count)
| X, Y = list(map(int,input().split()))
A = X
ans = 1
while(1):
if X*2 > Y:
break
X *= 2
ans += 1
print(ans) | 11 | 12 | 155 | 134 | x, y = list(map(int, input().split()))
import copy
x1 = copy.deepcopy(x)
y1 = copy.deepcopy(y)
count = 0
while y1 >= x1:
y1 //= 2
count += 1
print(count)
| X, Y = list(map(int, input().split()))
A = X
ans = 1
while 1:
if X * 2 > Y:
break
X *= 2
ans += 1
print(ans)
| false | 8.333333 | [
"-x, y = list(map(int, input().split()))",
"-import copy",
"-",
"-x1 = copy.deepcopy(x)",
"-y1 = copy.deepcopy(y)",
"-count = 0",
"-while y1 >= x1:",
"- y1 //= 2",
"- count += 1",
"-print(count)",
"+X, Y = list(map(int, input().split()))",
"+A = X",
"+ans = 1",
"+while 1:",
"+ i... | false | 0.039085 | 0.036994 | 1.056538 | [
"s017178479",
"s138476628"
] |
u067962264 | p03962 | python | s175604598 | s666397576 | 19 | 17 | 3,316 | 3,060 | Accepted | Accepted | 10.53 | x,y,z = list(map(int,input().split()))
if x == y and y==z:
print((1))
elif x == y or y == z or z ==x :
print((2))
else:
print((3))
| a,b,c = list(map(int, input().split()))
if a==b==c:
print((1))
elif a==b or b==c or a==c:
print((2))
else:
print((3)) | 7 | 7 | 131 | 117 | x, y, z = list(map(int, input().split()))
if x == y and y == z:
print((1))
elif x == y or y == z or z == x:
print((2))
else:
print((3))
| a, b, c = list(map(int, input().split()))
if a == b == c:
print((1))
elif a == b or b == c or a == c:
print((2))
else:
print((3))
| false | 0 | [
"-x, y, z = list(map(int, input().split()))",
"-if x == y and y == z:",
"+a, b, c = list(map(int, input().split()))",
"+if a == b == c:",
"-elif x == y or y == z or z == x:",
"+elif a == b or b == c or a == c:"
] | false | 0.036812 | 0.03736 | 0.985334 | [
"s175604598",
"s666397576"
] |
u644907318 | p03854 | python | s592239921 | s525211939 | 177 | 38 | 40,176 | 9,252 | Accepted | Accepted | 78.53 | S = input().strip()
cur = 0
flag = 0
while cur<len(S):
if S[cur:cur+11]=="dreameraser":
cur += 11
elif S[cur:cur+10]=="dreamerase":
cur += 10
elif S[cur:cur+7]=="dreamer":
cur += 7
elif S[cur:cur+6]=="eraser":
cur += 6
elif S[cur:cur+5]=="dream" or S[cur:c... | S = input().strip()
N = len(S)
if N<5:
print("NO")
else:
flag = 0
cur = N
while cur>0:
if cur>=7 and S[cur-7:cur]=="dreamer":
cur -= 7
elif cur>=6 and S[cur-6:cur]=="eraser":
cur -= 6
elif cur>=5 and S[cur-5:cur] in ["dream","erase"]:
... | 21 | 21 | 452 | 459 | S = input().strip()
cur = 0
flag = 0
while cur < len(S):
if S[cur : cur + 11] == "dreameraser":
cur += 11
elif S[cur : cur + 10] == "dreamerase":
cur += 10
elif S[cur : cur + 7] == "dreamer":
cur += 7
elif S[cur : cur + 6] == "eraser":
cur += 6
elif S[cur : cur + 5] =... | S = input().strip()
N = len(S)
if N < 5:
print("NO")
else:
flag = 0
cur = N
while cur > 0:
if cur >= 7 and S[cur - 7 : cur] == "dreamer":
cur -= 7
elif cur >= 6 and S[cur - 6 : cur] == "eraser":
cur -= 6
elif cur >= 5 and S[cur - 5 : cur] in ["dream", "era... | false | 0 | [
"-cur = 0",
"-flag = 0",
"-while cur < len(S):",
"- if S[cur : cur + 11] == \"dreameraser\":",
"- cur += 11",
"- elif S[cur : cur + 10] == \"dreamerase\":",
"- cur += 10",
"- elif S[cur : cur + 7] == \"dreamer\":",
"- cur += 7",
"- elif S[cur : cur + 6] == \"eraser... | false | 0.035421 | 0.060036 | 0.589991 | [
"s592239921",
"s525211939"
] |
u923270446 | p02552 | python | s624044476 | s292201053 | 33 | 25 | 9,080 | 9,152 | Accepted | Accepted | 24.24 | x = int(eval(input()))
print(([1, 0][x])) | print((int(eval(input()))^1)) | 2 | 1 | 34 | 21 | x = int(eval(input()))
print(([1, 0][x]))
| print((int(eval(input())) ^ 1))
| false | 50 | [
"-x = int(eval(input()))",
"-print(([1, 0][x]))",
"+print((int(eval(input())) ^ 1))"
] | false | 0.041452 | 0.07638 | 0.542713 | [
"s624044476",
"s292201053"
] |
u119148115 | p03298 | python | s746077054 | s933910657 | 1,631 | 785 | 223,272 | 281,020 | Accepted | Accepted | 51.87 | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
N = I()
S = LS2()
# 左N個のマスをどう塗るかで半分全列挙
ans = 0
left = []
right = []
for i in range(2**N):
red = []
blue = []
for j in range(N):
if (i >> j) & 1:
... | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | 50 | 43 | 1,023 | 1,151 | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LS2():
return list(sys.stdin.readline().rstrip()) # 空白なし
N = I()
S = LS2()
# 左N個のマスをどう塗るかで半分全列挙
ans = 0
left = []
right = []
for i in range(2**N):
red = []
blue = []
for j in range(N):
if (i >> j) & 1:
red.a... | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | false | 14 | [
"+",
"+sys.setrecursionlimit(10**7)",
"+",
"+",
"+def MI():",
"+ return list(map(int, sys.stdin.readline().rstrip().split()))",
"+",
"+",
"+def LI():",
"+ return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"+",
"+",
"+def LI2():",
"+ return list(map(int, sys.st... | false | 0.914985 | 0.792038 | 1.15523 | [
"s746077054",
"s933910657"
] |
u102367647 | p03043 | python | s772891791 | s446120429 | 64 | 21 | 4,208 | 3,316 | Accepted | Accepted | 67.19 | #ABC126C-DiceAndCoin.py
from sys import stdin
import random
N,K = list(map(int, stdin.readline().split()))
result = 0
for n in range(N):
n = n + 1
x = 0
while True:
if 2 ** x * n >= K:
break
x += 1
result += 1/N * 0.5 ** x
print(result)
| #ABC126C-DiceAndCoin.py
from sys import stdin
import random
N,K = list(map(int, stdin.readline().split()))
result = 0
i,j = 0, N
X = []
while True:
if j >= K/(2**i):
k = int(j-(K/(2**i)-1))
X.append(k)
j -= k
else:
X.append(0)
if K/(2**i) < 1:
b... | 19 | 27 | 304 | 435 | # ABC126C-DiceAndCoin.py
from sys import stdin
import random
N, K = list(map(int, stdin.readline().split()))
result = 0
for n in range(N):
n = n + 1
x = 0
while True:
if 2**x * n >= K:
break
x += 1
result += 1 / N * 0.5**x
print(result)
| # ABC126C-DiceAndCoin.py
from sys import stdin
import random
N, K = list(map(int, stdin.readline().split()))
result = 0
i, j = 0, N
X = []
while True:
if j >= K / (2**i):
k = int(j - (K / (2**i) - 1))
X.append(k)
j -= k
else:
X.append(0)
if K / (2**i) < 1:
break
... | false | 29.62963 | [
"-for n in range(N):",
"- n = n + 1",
"- x = 0",
"- while True:",
"- if 2**x * n >= K:",
"- break",
"- x += 1",
"- result += 1 / N * 0.5**x",
"+i, j = 0, N",
"+X = []",
"+while True:",
"+ if j >= K / (2**i):",
"+ k = int(j - (K / (2**i) - 1))",
... | false | 0.081002 | 0.037596 | 2.154559 | [
"s772891791",
"s446120429"
] |
u556589653 | p02790 | python | s934721083 | s067663337 | 167 | 29 | 38,384 | 9,064 | Accepted | Accepted | 82.63 | a,b = list(map(int,input().split()))
a_l = ""
b_l = ""
for i in range(b):
a_l += str(a)
for j in range(a):
b_l += str(b)
if a>b:
print(b_l)
elif b<a:
print(a_l)
else:
print(a_l) | a,b = list(map(int,input().split()))
k = str(a)
l = str(b)
X = k*b
Y = l*a
if (X < Y):
print(X)
else:
print(Y) | 13 | 9 | 193 | 116 | a, b = list(map(int, input().split()))
a_l = ""
b_l = ""
for i in range(b):
a_l += str(a)
for j in range(a):
b_l += str(b)
if a > b:
print(b_l)
elif b < a:
print(a_l)
else:
print(a_l)
| a, b = list(map(int, input().split()))
k = str(a)
l = str(b)
X = k * b
Y = l * a
if X < Y:
print(X)
else:
print(Y)
| false | 30.769231 | [
"-a_l = \"\"",
"-b_l = \"\"",
"-for i in range(b):",
"- a_l += str(a)",
"-for j in range(a):",
"- b_l += str(b)",
"-if a > b:",
"- print(b_l)",
"-elif b < a:",
"- print(a_l)",
"+k = str(a)",
"+l = str(b)",
"+X = k * b",
"+Y = l * a",
"+if X < Y:",
"+ print(X)",
"- p... | false | 0.046896 | 0.080326 | 0.583817 | [
"s934721083",
"s067663337"
] |
u533039576 | p03112 | python | s375327256 | s596388354 | 1,896 | 1,674 | 12,080 | 14,096 | Accepted | Accepted | 11.71 | from bisect import bisect_left, bisect_right
def func(x, y, z):
yi = bisect_right(y, x)
if yi == 0 or yi == len(y):
ans = 0
if yi == len(y):
yi -= 1
ans += abs(y[yi] - x)
x = y[yi]
zi = bisect_right(z, x)
ans += min(abs(z[zi % len(z)] -... | from bisect import bisect_right
a, b, q = list(map(int, input().split()))
INF = 10**11
s = [-INF] + [int(eval(input())) for _ in range(a)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(b)] + [INF]
for _ in range(q):
x = int(eval(input()))
si = bisect_right(s, x)
ti = bisect_right(t, ... | 37 | 20 | 983 | 537 | from bisect import bisect_left, bisect_right
def func(x, y, z):
yi = bisect_right(y, x)
if yi == 0 or yi == len(y):
ans = 0
if yi == len(y):
yi -= 1
ans += abs(y[yi] - x)
x = y[yi]
zi = bisect_right(z, x)
ans += min(abs(z[zi % len(z)] - x), abs(z[(zi... | from bisect import bisect_right
a, b, q = list(map(int, input().split()))
INF = 10**11
s = [-INF] + [int(eval(input())) for _ in range(a)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(b)] + [INF]
for _ in range(q):
x = int(eval(input()))
si = bisect_right(s, x)
ti = bisect_right(t, x)
ans = ... | false | 45.945946 | [
"-from bisect import bisect_left, bisect_right",
"-",
"-",
"-def func(x, y, z):",
"- yi = bisect_right(y, x)",
"- if yi == 0 or yi == len(y):",
"- ans = 0",
"- if yi == len(y):",
"- yi -= 1",
"- ans += abs(y[yi] - x)",
"- x = y[yi]",
"- zi = ... | false | 0.035086 | 0.036353 | 0.965142 | [
"s375327256",
"s596388354"
] |
u730769327 | p03565 | python | s410716046 | s801854272 | 172 | 66 | 38,512 | 63,688 | Accepted | Accepted | 61.63 | s=eval(input())
t=eval(input())
n=len(s)
m=len(t)
ans='UNRESTORABLE'
a=[]
for i in range(n-m+1):
if s[i]==t[0] or s[i]=='?':
for j in range(m):
if s[i+j]!=t[j] and s[i+j]!='?':
break
else:
an=list(s[:i]+t+s[i+j+1:])
for k in range(n):
if an[k]=='?':
a... | s=eval(input())
t=eval(input())
ans=[]
for i in range(len(s)-len(t)+1):
for j in range(len(t)):
if s[i+j]!=t[j] and s[i+j]!='?':break
else:
a=''
for k in s[0:i]+t+s[i+len(t):]:
if k=='?':a+='a'
else:a+=k
ans+=[a]
ans=sorted(ans)
if ans:print((ans[0]))
else:print('UNRESTORAB... | 21 | 15 | 404 | 310 | s = eval(input())
t = eval(input())
n = len(s)
m = len(t)
ans = "UNRESTORABLE"
a = []
for i in range(n - m + 1):
if s[i] == t[0] or s[i] == "?":
for j in range(m):
if s[i + j] != t[j] and s[i + j] != "?":
break
else:
an = list(s[:i] + t + s[i + j + 1 :])
... | s = eval(input())
t = eval(input())
ans = []
for i in range(len(s) - len(t) + 1):
for j in range(len(t)):
if s[i + j] != t[j] and s[i + j] != "?":
break
else:
a = ""
for k in s[0:i] + t + s[i + len(t) :]:
if k == "?":
a += "a"
else:
... | false | 28.571429 | [
"-n = len(s)",
"-m = len(t)",
"-ans = \"UNRESTORABLE\"",
"-a = []",
"-for i in range(n - m + 1):",
"- if s[i] == t[0] or s[i] == \"?\":",
"- for j in range(m):",
"- if s[i + j] != t[j] and s[i + j] != \"?\":",
"- break",
"- else:",
"- an = li... | false | 0.108445 | 0.038175 | 2.840729 | [
"s410716046",
"s801854272"
] |
u021019433 | p02844 | python | s297351183 | s406198014 | 655 | 574 | 3,188 | 3,188 | Accepted | Accepted | 12.37 | eval(input())
a, b, c = set(), set(), set()
for x in eval(input()):
c |= {y + x for y in b}
b |= {y + x for y in a}
a.add(x)
print((len(c)))
| eval(input())
a, b, c = set(), set(), set()
for x in eval(input()):
c.update(y + x for y in b)
b.update(y + x for y in a)
a.add(x)
print((len(c)))
| 7 | 7 | 139 | 145 | eval(input())
a, b, c = set(), set(), set()
for x in eval(input()):
c |= {y + x for y in b}
b |= {y + x for y in a}
a.add(x)
print((len(c)))
| eval(input())
a, b, c = set(), set(), set()
for x in eval(input()):
c.update(y + x for y in b)
b.update(y + x for y in a)
a.add(x)
print((len(c)))
| false | 0 | [
"- c |= {y + x for y in b}",
"- b |= {y + x for y in a}",
"+ c.update(y + x for y in b)",
"+ b.update(y + x for y in a)"
] | false | 0.050805 | 0.034763 | 1.461481 | [
"s297351183",
"s406198014"
] |
u941753895 | p02833 | python | s960905331 | s953860878 | 57 | 42 | 6,452 | 10,728 | Accepted | Accepted | 26.32 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,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()]
de... | 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... | 37 | 30 | 847 | 697 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, 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) ... | 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 | 18.918919 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"+import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy",
"-def LI_():",
"- return [int(x) - 1 for x in sys.stdin.readline().split()]",
"+# def LF(): return [floa... | false | 0.039111 | 0.040458 | 0.9667 | [
"s960905331",
"s953860878"
] |
u352394527 | p00468 | python | s794957143 | s244519118 | 110 | 100 | 8,056 | 8,056 | Accepted | Accepted | 9.09 | while True:
n = int(eval(input()))
if not n:
break
m = int(eval(input()))
edge = [[0 for i in range(n + 1)] for j in range(n + 1)]
for i in range(m):
a,b = list(map(int,input().split()))
edge[a][b] = 1
edge[b][a] = 1
friends1 = [i for i in range(n + 1) if edge[1][i]]
friends2 = ... | def solve():
while True:
n = int(eval(input()))
if not n:
break
m = int(eval(input()))
edge = [[0 for i in range(n + 1)] for j in range(n + 1)]
for i in range(m):
a,b = list(map(int,input().split()))
edge[a][b] = 1
edge[b][a] = 1
friends1 = [i for i in range(... | 20 | 21 | 510 | 571 | while True:
n = int(eval(input()))
if not n:
break
m = int(eval(input()))
edge = [[0 for i in range(n + 1)] for j in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
edge[a][b] = 1
edge[b][a] = 1
friends1 = [i for i in range(n + 1) if edge[1... | def solve():
while True:
n = int(eval(input()))
if not n:
break
m = int(eval(input()))
edge = [[0 for i in range(n + 1)] for j in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
edge[a][b] = 1
edge[b][a] ... | false | 4.761905 | [
"-while True:",
"- n = int(eval(input()))",
"- if not n:",
"- break",
"- m = int(eval(input()))",
"- edge = [[0 for i in range(n + 1)] for j in range(n + 1)]",
"- for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- edge[a][b] = 1",
"- edge... | false | 0.037262 | 0.036748 | 1.013998 | [
"s794957143",
"s244519118"
] |
u020390084 | p03682 | python | s226329544 | s066472699 | 1,038 | 959 | 58,816 | 58,560 | Accepted | Accepted | 7.61 | import sys
input = sys.stdin.readline
def INT(): return int(eval(input()))
def MAP(): return list(map(int,input().split()))
def LI(): return list(map(int,input().split()))
import decimal
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(sel... | import sys
input = sys.stdin.readline
def INT(): return int(eval(input()))
def MAP(): return list(map(int,input().split()))
def LI(): return list(map(int,input().split()))
import decimal
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(sel... | 82 | 82 | 2,137 | 2,171 | import sys
input = sys.stdin.readline
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
import decimal
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find... | import sys
input = sys.stdin.readline
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
import decimal
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find... | false | 0 | [
"- x.sort()",
"- y.sort()",
"+ x.sort(key=lambda x: x[0])",
"+ y.sort(key=lambda x: x[0])"
] | false | 0.047263 | 0.047843 | 0.987884 | [
"s226329544",
"s066472699"
] |
u814986259 | p03201 | python | s379985689 | s091006340 | 1,626 | 515 | 92,312 | 56,628 | Accepted | Accepted | 68.33 | N=int(eval(input()))
A=list(map(int,input().split()))
import math
import collections
powers =[2**i for i in range(1,int(math.log(max(A),2)+2))]
table=collections.defaultdict(int)
table2=collections.defaultdict(set)
ans=0
for i in range(N):
table[A[i]]+=1
for x in table:
for y in reversed(powers):
if... | def main():
from collections import Counter
import sys
input = sys.stdin.buffer.readline
_ = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
c = Counter(A)
B = sorted(list(c.keys()), reverse=True)
for b in B:
if c[b] == 0:
continu... | 31 | 32 | 632 | 644 | N = int(eval(input()))
A = list(map(int, input().split()))
import math
import collections
powers = [2**i for i in range(1, int(math.log(max(A), 2) + 2))]
table = collections.defaultdict(int)
table2 = collections.defaultdict(set)
ans = 0
for i in range(N):
table[A[i]] += 1
for x in table:
for y in reversed(powe... | def main():
from collections import Counter
import sys
input = sys.stdin.buffer.readline
_ = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
c = Counter(A)
B = sorted(list(c.keys()), reverse=True)
for b in B:
if c[b] == 0:
continue
a = (2... | false | 3.125 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-import math",
"-import collections",
"+def main():",
"+ from collections import Counter",
"+ import sys",
"-powers = [2**i for i in range(1, int(math.log(max(A), 2) + 2))]",
"-table = collections.defaultdict(int)",
"-table2... | false | 0.075333 | 0.095276 | 0.790688 | [
"s379985689",
"s091006340"
] |
u347600233 | p02708 | python | s588187802 | s034758840 | 61 | 23 | 9,128 | 9,160 | Accepted | Accepted | 62.3 | n, k = list(map(int, input().split()))
cnt = 0
for i in range(k, n + 2):
cnt += i * (n - i + 1) + 1
print((cnt % (10**9 + 7))) | n, k = list(map(int, input().split()))
print((((n*(n + 1)*(n + 2) - (k - 1)*k*(3*n - 2*k + 4))//6 + n - k + 2) % (10**9 + 7))) | 5 | 2 | 126 | 119 | n, k = list(map(int, input().split()))
cnt = 0
for i in range(k, n + 2):
cnt += i * (n - i + 1) + 1
print((cnt % (10**9 + 7)))
| n, k = list(map(int, input().split()))
print(
(
((n * (n + 1) * (n + 2) - (k - 1) * k * (3 * n - 2 * k + 4)) // 6 + n - k + 2)
% (10**9 + 7)
)
)
| false | 60 | [
"-cnt = 0",
"-for i in range(k, n + 2):",
"- cnt += i * (n - i + 1) + 1",
"-print((cnt % (10**9 + 7)))",
"+print(",
"+ (",
"+ ((n * (n + 1) * (n + 2) - (k - 1) * k * (3 * n - 2 * k + 4)) // 6 + n - k + 2)",
"+ % (10**9 + 7)",
"+ )",
"+)"
] | false | 0.089114 | 0.071606 | 1.244505 | [
"s588187802",
"s034758840"
] |
u210992699 | p02314 | python | s640545778 | s386650025 | 760 | 590 | 7,256 | 10,772 | Accepted | Accepted | 22.37 | n, m =list(map(int,input().split()))
c = list(map(int,input().split()))
INF = 10**10
dp = [INF]*(n+1)
dp[0] = 0
for i in range (n+1):
for j in range (len(c)):
if i-c[j]>=0:
dp[i] = min(dp[i],dp[i-c[j]]+1)
print((dp[n]))
| n, m =list(map(int,input().split()))
c = list(map(int,input().split()))
INF = 10**100
dp = [INF]*500000
dp[0] = 0
for i in range (n+1):
for j in c:
dp[i+j] = min(dp[i+j],dp[i]+1)
print((dp[n]))
| 13 | 11 | 251 | 210 | n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (n + 1)
dp[0] = 0
for i in range(n + 1):
for j in range(len(c)):
if i - c[j] >= 0:
dp[i] = min(dp[i], dp[i - c[j]] + 1)
print((dp[n]))
| n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
INF = 10**100
dp = [INF] * 500000
dp[0] = 0
for i in range(n + 1):
for j in c:
dp[i + j] = min(dp[i + j], dp[i] + 1)
print((dp[n]))
| false | 15.384615 | [
"-INF = 10**10",
"-dp = [INF] * (n + 1)",
"+INF = 10**100",
"+dp = [INF] * 500000",
"- for j in range(len(c)):",
"- if i - c[j] >= 0:",
"- dp[i] = min(dp[i], dp[i - c[j]] + 1)",
"+ for j in c:",
"+ dp[i + j] = min(dp[i + j], dp[i] + 1)"
] | false | 0.047852 | 0.051791 | 0.923959 | [
"s640545778",
"s386650025"
] |
u729133443 | p03026 | python | s320491737 | s436056923 | 473 | 308 | 27,868 | 19,344 | Accepted | Accepted | 34.88 | from scipy.sparse import*
n,*t=list(map(int,open(0).read().split()))
c=sorted(t[-n:])
i=n
for j in csgraph.depth_first_order(csr_matrix((t[:n-1],(t[:-n:2],t[1:-n:2])),[n+1]*2),1,0,0):i-=1;t[j-1]=c[i]
print((sum(c[:-1]),*t[:n])) | from scipy.sparse import*
n,*t=list(map(int,open(0).read().split()))
c=sorted(t[-n:])
f=c[:]
for i in csgraph.depth_first_order(csr_matrix((f[1:],(t[:-n:2],t[1:-n:2])),[n+1]*2),1,0,0):n-=1;f[i-1]=c[n]
print((sum(c[:-1]),*f)) | 6 | 6 | 224 | 221 | from scipy.sparse import *
n, *t = list(map(int, open(0).read().split()))
c = sorted(t[-n:])
i = n
for j in csgraph.depth_first_order(
csr_matrix((t[: n - 1], (t[:-n:2], t[1:-n:2])), [n + 1] * 2), 1, 0, 0
):
i -= 1
t[j - 1] = c[i]
print((sum(c[:-1]), *t[:n]))
| from scipy.sparse import *
n, *t = list(map(int, open(0).read().split()))
c = sorted(t[-n:])
f = c[:]
for i in csgraph.depth_first_order(
csr_matrix((f[1:], (t[:-n:2], t[1:-n:2])), [n + 1] * 2), 1, 0, 0
):
n -= 1
f[i - 1] = c[n]
print((sum(c[:-1]), *f))
| false | 0 | [
"-i = n",
"-for j in csgraph.depth_first_order(",
"- csr_matrix((t[: n - 1], (t[:-n:2], t[1:-n:2])), [n + 1] * 2), 1, 0, 0",
"+f = c[:]",
"+for i in csgraph.depth_first_order(",
"+ csr_matrix((f[1:], (t[:-n:2], t[1:-n:2])), [n + 1] * 2), 1, 0, 0",
"- i -= 1",
"- t[j - 1] = c[i]",
"-print... | false | 0.262207 | 0.259932 | 1.008749 | [
"s320491737",
"s436056923"
] |
u179304833 | p02699 | python | s919022557 | s370208425 | 22 | 20 | 9,184 | 9,052 | Accepted | Accepted | 9.09 | S,W= list(map(int, input().split()))
if S<=W:
print("unsafe")
elif S>W:
print("safe") | s,w =input().split()
if int(w) >= int(s):
print("unsafe")
else:
print("safe")
| 5 | 6 | 87 | 89 | S, W = list(map(int, input().split()))
if S <= W:
print("unsafe")
elif S > W:
print("safe")
| s, w = input().split()
if int(w) >= int(s):
print("unsafe")
else:
print("safe")
| false | 16.666667 | [
"-S, W = list(map(int, input().split()))",
"-if S <= W:",
"+s, w = input().split()",
"+if int(w) >= int(s):",
"-elif S > W:",
"+else:"
] | false | 0.032121 | 0.032463 | 0.98947 | [
"s919022557",
"s370208425"
] |
u347600233 | p02675 | python | s454293593 | s290004484 | 22 | 19 | 9,172 | 9,160 | Accepted | Accepted | 13.64 | n = eval(input())
if int(n[-1]) in {2, 4, 5, 7, 9}:
print('hon')
elif int(n[-1]) in {0, 1, 6, 8}:
print('pon')
else:
print('bon') | n = eval(input())
print(('hon' if int(n[-1]) in {2, 4, 5, 7, 9} else 'pon' if int(n[-1]) in {0, 1, 6, 8} else 'bon')) | 7 | 2 | 141 | 110 | n = eval(input())
if int(n[-1]) in {2, 4, 5, 7, 9}:
print("hon")
elif int(n[-1]) in {0, 1, 6, 8}:
print("pon")
else:
print("bon")
| n = eval(input())
print(
(
"hon"
if int(n[-1]) in {2, 4, 5, 7, 9}
else "pon"
if int(n[-1]) in {0, 1, 6, 8}
else "bon"
)
)
| false | 71.428571 | [
"-if int(n[-1]) in {2, 4, 5, 7, 9}:",
"- print(\"hon\")",
"-elif int(n[-1]) in {0, 1, 6, 8}:",
"- print(\"pon\")",
"-else:",
"- print(\"bon\")",
"+print(",
"+ (",
"+ \"hon\"",
"+ if int(n[-1]) in {2, 4, 5, 7, 9}",
"+ else \"pon\"",
"+ if int(n[-1]) in {0... | false | 0.037353 | 0.043387 | 0.860928 | [
"s454293593",
"s290004484"
] |
u981931040 | p03379 | python | s921203944 | s660944386 | 282 | 245 | 25,620 | 32,568 | Accepted | Accepted | 13.12 | N = int(eval(input()))
X = list(map(int,input().split()))
X_work = sorted(X)
before = X_work[N // 2]
after = X_work[N // 2 - 1]
for x in X:
if x <= after:
print(before)
else:
print(after) | import copy
N = int(eval(input()))
X = list(map(int, input().split()))
tmp_X = copy.deepcopy(X)
tmp_X.sort()
m1 = tmp_X[N // 2]
m2 = tmp_X[N // 2 - 1]
for x in X:
if x < m1:
print(m1)
else:
print(m2) | 10 | 12 | 214 | 228 | N = int(eval(input()))
X = list(map(int, input().split()))
X_work = sorted(X)
before = X_work[N // 2]
after = X_work[N // 2 - 1]
for x in X:
if x <= after:
print(before)
else:
print(after)
| import copy
N = int(eval(input()))
X = list(map(int, input().split()))
tmp_X = copy.deepcopy(X)
tmp_X.sort()
m1 = tmp_X[N // 2]
m2 = tmp_X[N // 2 - 1]
for x in X:
if x < m1:
print(m1)
else:
print(m2)
| false | 16.666667 | [
"+import copy",
"+",
"-X_work = sorted(X)",
"-before = X_work[N // 2]",
"-after = X_work[N // 2 - 1]",
"+tmp_X = copy.deepcopy(X)",
"+tmp_X.sort()",
"+m1 = tmp_X[N // 2]",
"+m2 = tmp_X[N // 2 - 1]",
"- if x <= after:",
"- print(before)",
"+ if x < m1:",
"+ print(m1)",
"... | false | 0.037062 | 0.03988 | 0.929339 | [
"s921203944",
"s660944386"
] |
u423665486 | p02694 | python | s824133188 | s221363181 | 62 | 23 | 62,716 | 9,140 | Accepted | Accepted | 62.9 | def resolve():
s = 100
x = int(eval(input()))
step = 0
while s < x:
step += 1
s += s // 100
print(step)
resolve() | import math
def resolve():
x = int(eval(input()))
v = 100
y = 0
while True:
y += 1
v += math.floor(v*0.01)
if v >= x:
print(y)
return
resolve() | 9 | 12 | 124 | 164 | def resolve():
s = 100
x = int(eval(input()))
step = 0
while s < x:
step += 1
s += s // 100
print(step)
resolve()
| import math
def resolve():
x = int(eval(input()))
v = 100
y = 0
while True:
y += 1
v += math.floor(v * 0.01)
if v >= x:
print(y)
return
resolve()
| false | 25 | [
"+import math",
"+",
"+",
"- s = 100",
"- step = 0",
"- while s < x:",
"- step += 1",
"- s += s // 100",
"- print(step)",
"+ v = 100",
"+ y = 0",
"+ while True:",
"+ y += 1",
"+ v += math.floor(v * 0.01)",
"+ if v >= x:",
"+ ... | false | 0.106646 | 0.037372 | 2.853624 | [
"s824133188",
"s221363181"
] |
u932465688 | p03341 | python | s753706040 | s696858197 | 249 | 211 | 15,564 | 67,836 | Accepted | Accepted | 15.26 | N = int(eval(input()))
S = eval(input())
L = [S[1:].count('E'),S[:N].count('W')]
k = 0
w = 0
e = S[1:].count('E')
while (k <= N-2):
if (S[k] == 'W' and S[k+1] == 'W'):
w += 1
elif (S[k] == 'W' and S[k+1] == 'E'):
w += 1
e -= 1
elif (S[k] == 'E' and S[k+1] == 'W'):
w += 0
else:
... | N = int(eval(input()))
S = eval(input())
E = []
W = []
k = 0
for i in range(N):
if S[i] == 'E':
k += 1
E.append(k)
l = 0
for i in range(N):
if S[N-i-1] == 'W':
l += 1
W.append(l)
W.reverse()
ME = E[N-1]
MW = W[0]
ans = float('inf')
for i in range(N):
if ans >= ME-E[i]+MW-W[i]:
... | 20 | 22 | 361 | 341 | N = int(eval(input()))
S = eval(input())
L = [S[1:].count("E"), S[:N].count("W")]
k = 0
w = 0
e = S[1:].count("E")
while k <= N - 2:
if S[k] == "W" and S[k + 1] == "W":
w += 1
elif S[k] == "W" and S[k + 1] == "E":
w += 1
e -= 1
elif S[k] == "E" and S[k + 1] == "W":
w += 0
... | N = int(eval(input()))
S = eval(input())
E = []
W = []
k = 0
for i in range(N):
if S[i] == "E":
k += 1
E.append(k)
l = 0
for i in range(N):
if S[N - i - 1] == "W":
l += 1
W.append(l)
W.reverse()
ME = E[N - 1]
MW = W[0]
ans = float("inf")
for i in range(N):
if ans >= ME - E[i] + MW - ... | false | 9.090909 | [
"-L = [S[1:].count(\"E\"), S[:N].count(\"W\")]",
"+E = []",
"+W = []",
"-w = 0",
"-e = S[1:].count(\"E\")",
"-while k <= N - 2:",
"- if S[k] == \"W\" and S[k + 1] == \"W\":",
"- w += 1",
"- elif S[k] == \"W\" and S[k + 1] == \"E\":",
"- w += 1",
"- e -= 1",
"- eli... | false | 0.14414 | 0.043421 | 3.319622 | [
"s753706040",
"s696858197"
] |
u211706121 | p03169 | python | s947164140 | s726648402 | 1,276 | 1,142 | 508,936 | 507,532 | Accepted | Accepted | 10.5 | n=int(eval(input()))
A=[0]*3
for i in map(int,input().split()):
A[i-1]+=1
dp=[[[0]*(n+2)for _ in range(n+2)]for __ in range(n+2)]
for i in range(A[2]+1):
for j in range(n-A[0]-i+1):
for k in range(n-i-j+1):
if i+j+k!=0:
dp[i][j][k]=(dp[i-1][j+1][k]*i+dp[i][j-1][k+1]*... | def main():
n=int(eval(input()))
A=[0]*3
for i in map(int,input().split()):
A[i-1]+=1
dp=[[[0]*(n+2)for _ in range(n+2)]for __ in range(n+2)]
for i in range(A[2]+1):
for j in range(n-A[0]-i+1):
for k in range(n-i-j+1):
if i+j+k!=0:
... | 12 | 14 | 371 | 440 | n = int(eval(input()))
A = [0] * 3
for i in map(int, input().split()):
A[i - 1] += 1
dp = [[[0] * (n + 2) for _ in range(n + 2)] for __ in range(n + 2)]
for i in range(A[2] + 1):
for j in range(n - A[0] - i + 1):
for k in range(n - i - j + 1):
if i + j + k != 0:
dp[i][j][k] =... | def main():
n = int(eval(input()))
A = [0] * 3
for i in map(int, input().split()):
A[i - 1] += 1
dp = [[[0] * (n + 2) for _ in range(n + 2)] for __ in range(n + 2)]
for i in range(A[2] + 1):
for j in range(n - A[0] - i + 1):
for k in range(n - i - j + 1):
... | false | 14.285714 | [
"-n = int(eval(input()))",
"-A = [0] * 3",
"-for i in map(int, input().split()):",
"- A[i - 1] += 1",
"-dp = [[[0] * (n + 2) for _ in range(n + 2)] for __ in range(n + 2)]",
"-for i in range(A[2] + 1):",
"- for j in range(n - A[0] - i + 1):",
"- for k in range(n - i - j + 1):",
"- ... | false | 0.037584 | 0.037079 | 1.013616 | [
"s947164140",
"s726648402"
] |
u527993431 | p03640 | python | s141208504 | s680526856 | 34 | 28 | 3,828 | 3,884 | Accepted | Accepted | 17.65 | H,W=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
k=1
L=[]
for i in range(N):
for j in range(A[i]):
L.append(k)
k=k+1
k=0
c=1
for j in range(H):
if c==-1:
tmp=L[k:k+W]
ans=tmp[::-1]
else:
ans=L[k:k+W]
for i in ans:
print(i,end=" ")
print()
k+=W
c=-1*c
| H,W=list(map(int,input().split()))
N=int(eval(input()))
L=list(map(int,input().split()))
ans=[]
for i in range(N):
for j in range(L[i]):
ans.append((i+1))
for i in range(H):
if i%2==0:
print((*ans[i*W:(i+1)*W]))
elif i%2==1:
tmp=ans[i*W:(i+1)*W]
print((*tmp[::-1])) | 22 | 13 | 317 | 272 | H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))
k = 1
L = []
for i in range(N):
for j in range(A[i]):
L.append(k)
k = k + 1
k = 0
c = 1
for j in range(H):
if c == -1:
tmp = L[k : k + W]
ans = tmp[::-1]
else:
ans = L[k : k + W]
for... | H, W = list(map(int, input().split()))
N = int(eval(input()))
L = list(map(int, input().split()))
ans = []
for i in range(N):
for j in range(L[i]):
ans.append((i + 1))
for i in range(H):
if i % 2 == 0:
print((*ans[i * W : (i + 1) * W]))
elif i % 2 == 1:
tmp = ans[i * W : (i + 1) * W]... | false | 40.909091 | [
"-H, W = map(int, input().split())",
"-N = int(input())",
"-A = list(map(int, input().split()))",
"-k = 1",
"-L = []",
"+H, W = list(map(int, input().split()))",
"+N = int(eval(input()))",
"+L = list(map(int, input().split()))",
"+ans = []",
"- for j in range(A[i]):",
"- L.append(k)",
... | false | 0.048812 | 0.039724 | 1.228767 | [
"s141208504",
"s680526856"
] |
u581187895 | p03739 | python | s338830070 | s808261185 | 141 | 77 | 14,468 | 14,212 | Accepted | Accepted | 45.39 | n = int(eval(input()))
a = list(map(int, input().split()))
minA = 0
sumA = 0
# 奇数項を正としたときの操作回数minA
for i in range(n):
sumA += a[i]
if i%2 == 0:
if sumA <= 0:
minA += abs(sumA)+1
sumA += abs(sumA)+1
else:
if sumA >= 0:
minA += abs(sumA)+1
sumA -= abs(sumA)+1... | def F(list_A, sign):
total = 0
cnt = 0
for a in list_A:
total += a
if sign==True and total < 1:
cnt += 1- total
total = 1
elif sign==False and total > -1:
cnt += total + 1
total = -1
sign = not sign
return cnt
N = int(eval(input()))
A = list(map(int,... | 31 | 20 | 604 | 382 | n = int(eval(input()))
a = list(map(int, input().split()))
minA = 0
sumA = 0
# 奇数項を正としたときの操作回数minA
for i in range(n):
sumA += a[i]
if i % 2 == 0:
if sumA <= 0:
minA += abs(sumA) + 1
sumA += abs(sumA) + 1
else:
if sumA >= 0:
minA += abs(sumA) + 1
... | def F(list_A, sign):
total = 0
cnt = 0
for a in list_A:
total += a
if sign == True and total < 1:
cnt += 1 - total
total = 1
elif sign == False and total > -1:
cnt += total + 1
total = -1
sign = not sign
return cnt
N = int... | false | 35.483871 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-minA = 0",
"-sumA = 0",
"-# 奇数項を正としたときの操作回数minA",
"-for i in range(n):",
"- sumA += a[i]",
"- if i % 2 == 0:",
"- if sumA <= 0:",
"- minA += abs(sumA) + 1",
"- sumA += abs(sumA) + 1",
"- ... | false | 0.103338 | 0.037862 | 2.729307 | [
"s338830070",
"s808261185"
] |
u631277801 | p03761 | python | s129307370 | s817071267 | 24 | 17 | 3,436 | 3,060 | Accepted | Accepted | 29.17 |
from collections import defaultdict
N = int(eval(input()))
S = []
for i in range(N):
S.append(input().rstrip())
dic = defaultdict(int)
for i in range(len(S[0])):
dic[S[0][i]] += 1
for s in S[1:]:
temp_dic = defaultdict(int)
for i in range(len(s)):
temp_dic[s[i]] += 1
... | N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
ALPHA = "abcdefghijklmnopqrstuvwxyz"
ans = ""
for a in ALPHA:
count = 50
for s in S:
if s.count(a) < count:
count = s.count(a)
ans += a*count
print(ans) | 28 | 17 | 498 | 281 | from collections import defaultdict
N = int(eval(input()))
S = []
for i in range(N):
S.append(input().rstrip())
dic = defaultdict(int)
for i in range(len(S[0])):
dic[S[0][i]] += 1
for s in S[1:]:
temp_dic = defaultdict(int)
for i in range(len(s)):
temp_dic[s[i]] += 1
for k, v in list(dic.it... | N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
ALPHA = "abcdefghijklmnopqrstuvwxyz"
ans = ""
for a in ALPHA:
count = 50
for s in S:
if s.count(a) < count:
count = s.count(a)
ans += a * count
print(ans)
| false | 39.285714 | [
"-from collections import defaultdict",
"-",
"- S.append(input().rstrip())",
"-dic = defaultdict(int)",
"-for i in range(len(S[0])):",
"- dic[S[0][i]] += 1",
"-for s in S[1:]:",
"- temp_dic = defaultdict(int)",
"- for i in range(len(s)):",
"- temp_dic[s[i]] += 1",
"- for k,... | false | 0.037445 | 0.04475 | 0.836762 | [
"s129307370",
"s817071267"
] |
u392319141 | p03031 | python | s012834142 | s088484331 | 35 | 31 | 3,064 | 3,064 | Accepted | Accepted | 11.43 | N, M = list(map(int, input().split()))
lights = []
for _ in range(M):
S = list(map(int, input().split()))
mask = 0
for a in S[1:]:
mask |= (1 << (a - 1))
lights.append(mask)
P = list(map(int, input().split()))
ans = 0
for mask in range(1 << N):
for state, p in zip(lights, P)... | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
s = tuple([int(a) - 1 for a in input().split()])[1:]
S.append(s)
P = tuple(map(int, input().split()))
ans = 0
for state in range(1 << N):
for p, s in zip(P, S):
cnt = 0
for i in s:
cnt += 1 if (stat... | 25 | 21 | 541 | 432 | N, M = list(map(int, input().split()))
lights = []
for _ in range(M):
S = list(map(int, input().split()))
mask = 0
for a in S[1:]:
mask |= 1 << (a - 1)
lights.append(mask)
P = list(map(int, input().split()))
ans = 0
for mask in range(1 << N):
for state, p in zip(lights, P):
cnt = 0
... | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
s = tuple([int(a) - 1 for a in input().split()])[1:]
S.append(s)
P = tuple(map(int, input().split()))
ans = 0
for state in range(1 << N):
for p, s in zip(P, S):
cnt = 0
for i in s:
cnt += 1 if (state & (1 << i)) > 0... | false | 16 | [
"-lights = []",
"+S = []",
"- S = list(map(int, input().split()))",
"- mask = 0",
"- for a in S[1:]:",
"- mask |= 1 << (a - 1)",
"- lights.append(mask)",
"-P = list(map(int, input().split()))",
"+ s = tuple([int(a) - 1 for a in input().split()])[1:]",
"+ S.append(s)",
"+... | false | 0.033024 | 0.040861 | 0.808214 | [
"s012834142",
"s088484331"
] |
u983918956 | p03107 | python | s604882579 | s603984579 | 85 | 18 | 4,212 | 3,188 | Accepted | Accepted | 78.82 | from collections import deque
S = eval(input())
dq = deque()
for s in S:
if not(dq):
dq.append(s)
continue
if int(dq[-1]) + int(s) == 1:
dq.pop()
else:
dq.append(s)
ans = len(S) - len(dq)
print(ans) | S = eval(input())
red = S.count("0")
blue = S.count("1")
ans = len(S) - abs(red-blue)
print(ans) | 13 | 5 | 248 | 94 | from collections import deque
S = eval(input())
dq = deque()
for s in S:
if not (dq):
dq.append(s)
continue
if int(dq[-1]) + int(s) == 1:
dq.pop()
else:
dq.append(s)
ans = len(S) - len(dq)
print(ans)
| S = eval(input())
red = S.count("0")
blue = S.count("1")
ans = len(S) - abs(red - blue)
print(ans)
| false | 61.538462 | [
"-from collections import deque",
"-",
"-dq = deque()",
"-for s in S:",
"- if not (dq):",
"- dq.append(s)",
"- continue",
"- if int(dq[-1]) + int(s) == 1:",
"- dq.pop()",
"- else:",
"- dq.append(s)",
"-ans = len(S) - len(dq)",
"+red = S.count(\"0\")",
"... | false | 0.006038 | 0.039164 | 0.154186 | [
"s604882579",
"s603984579"
] |
u072053884 | p00430 | python | s289777744 | s344981878 | 140 | 120 | 8,180 | 6,600 | Accepted | Accepted | 14.29 | def solve():
answers = [[] for i in range(31)]
ans = []
def square(n, rest, limit):
if rest == 0:
answers[n].append(ans[:])
else:
for i in range(rest, 0, -1):
if i > limit:
continue
ans.append(i)
... | def solve():
answers = []
ans = []
def square(n, rest, limit):
if rest == 0:
answers.append(' '.join(map(str, ans)))
else:
for i in range(rest, 0, -1):
if i > limit:
continue
ans.append(i)
... | 25 | 23 | 612 | 551 | def solve():
answers = [[] for i in range(31)]
ans = []
def square(n, rest, limit):
if rest == 0:
answers[n].append(ans[:])
else:
for i in range(rest, 0, -1):
if i > limit:
continue
ans.append(i)
squ... | def solve():
answers = []
ans = []
def square(n, rest, limit):
if rest == 0:
answers.append(" ".join(map(str, ans)))
else:
for i in range(rest, 0, -1):
if i > limit:
continue
ans.append(i)
square(n, ... | false | 8 | [
"- answers = [[] for i in range(31)]",
"+ answers = []",
"- answers[n].append(ans[:])",
"+ answers.append(\" \".join(map(str, ans)))",
"- a = answers[n]",
"- if not a:",
"- square(n, n, n)",
"- for l in a:",
"- print((*l))",
"+... | false | 0.045925 | 0.046609 | 0.985332 | [
"s289777744",
"s344981878"
] |
u620084012 | p03449 | python | s087845239 | s307120843 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | N = int(eval(input()))
A = [list(map(int, input().split())) for k in range(2)]
ans = 0
for k in range(N):
ans = max(ans,sum(A[0][0:k+1])+sum(A[1][k:]))
print(ans)
| N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for k in range(N):
ans = max(ans,sum(A[:k+1])+sum(B[k:]))
print(ans)
| 7 | 7 | 168 | 174 | N = int(eval(input()))
A = [list(map(int, input().split())) for k in range(2)]
ans = 0
for k in range(N):
ans = max(ans, sum(A[0][0 : k + 1]) + sum(A[1][k:]))
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for k in range(N):
ans = max(ans, sum(A[: k + 1]) + sum(B[k:]))
print(ans)
| false | 0 | [
"-A = [list(map(int, input().split())) for k in range(2)]",
"+A = list(map(int, input().split()))",
"+B = list(map(int, input().split()))",
"- ans = max(ans, sum(A[0][0 : k + 1]) + sum(A[1][k:]))",
"+ ans = max(ans, sum(A[: k + 1]) + sum(B[k:]))"
] | false | 0.066101 | 0.067176 | 0.983996 | [
"s087845239",
"s307120843"
] |
u691018832 | p02960 | python | s782966758 | s506109485 | 1,118 | 547 | 3,316 | 61,788 | Accepted | Accepted | 51.07 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
s = readline().rstrip().decode()
mod = 10 ** 9 + 7
ans = [0] * 13
ans[0] = 1
for check in s:
dp = [0] * 13
for i in range(13):
dp[(i * 10) % 13... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
s = read().rstrip().decode()
dp = [[0] * 13 for _ in range(len(s))]
mod = 10 ** 9 + 7
if s[0] == '?':
dp[0] = 10 * [1] + [0] * 3
else:
dp[0][int(s[0])] ... | 21 | 24 | 523 | 668 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
s = readline().rstrip().decode()
mod = 10**9 + 7
ans = [0] * 13
ans[0] = 1
for check in s:
dp = [0] * 13
for i in range(13):
dp[(i * 10) % 13] = ans[i] % mod
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
s = read().rstrip().decode()
dp = [[0] * 13 for _ in range(len(s))]
mod = 10**9 + 7
if s[0] == "?":
dp[0] = 10 * [1] + [0] * 3
else:
dp[0][int(s[0])] += 1
for i, ss i... | false | 12.5 | [
"-s = readline().rstrip().decode()",
"+s = read().rstrip().decode()",
"+dp = [[0] * 13 for _ in range(len(s))]",
"-ans = [0] * 13",
"-ans[0] = 1",
"-for check in s:",
"- dp = [0] * 13",
"- for i in range(13):",
"- dp[(i * 10) % 13] = ans[i] % mod",
"- dp += dp",
"- for i in ra... | false | 0.048305 | 0.045572 | 1.059971 | [
"s782966758",
"s506109485"
] |
u444856278 | p03145 | python | s127057768 | s655191528 | 156 | 18 | 12,432 | 2,940 | Accepted | Accepted | 88.46 | [print(n.prod([int(i)for i in input().split()][:2])//2)for n in[__import__("numpy")]]
| [print(a*b//2)for a,b in[[int(i) for i in input().split()][:2]]]
| 1 | 1 | 85 | 64 | [
print(n.prod([int(i) for i in input().split()][:2]) // 2)
for n in [__import__("numpy")]
]
| [print(a * b // 2) for a, b in [[int(i) for i in input().split()][:2]]]
| false | 0 | [
"-[",
"- print(n.prod([int(i) for i in input().split()][:2]) // 2)",
"- for n in [__import__(\"numpy\")]",
"-]",
"+[print(a * b // 2) for a, b in [[int(i) for i in input().split()][:2]]]"
] | false | 0.244147 | 0.12863 | 1.898054 | [
"s127057768",
"s655191528"
] |
u077291787 | p02913 | python | s735023809 | s121730485 | 1,544 | 409 | 53,612 | 20,172 | Accepted | Accepted | 73.51 | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_... | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_... | 49 | 49 | 1,626 | 1,645 | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_base_pow... | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_base_pow... | false | 0 | [
"- rh, ok, ng = RollingHash(S), 0, N // 2 + 1",
"+ rh, ok, ng = RollingHash(S, 1007, 10**9 + 7), 0, N // 2 + 1"
] | false | 0.046628 | 0.046483 | 1.003124 | [
"s735023809",
"s121730485"
] |
u252828980 | p02813 | python | s486033313 | s950382923 | 34 | 28 | 8,052 | 3,064 | Accepted | Accepted | 17.65 | n = int(eval(input()))
#a,b = map(int,input().split())
L1 = tuple(map(int,input().split()))
L2 = tuple(map(int,input().split()))
L = [x+1 for x in range(n)]
li = []
import itertools
for x in itertools.permutations(L,n):
#print(x)
li.append(x)
#print(li)
print((abs(li.index(L1)-li.index(L2)))) | n = int(eval(input()))
a = tuple(map(int,input().split()))
b = tuple(map(int,input().split()))
l = tuple(x+1 for x in range(n))
#print(a,b,l)
c,d = 0,0
cnt = 0
from itertools import permutations
for k in permutations(l):
#print(k)
cnt += 1
if a ==k:
c = cnt
if b ==k:
d = cn... | 13 | 16 | 306 | 332 | n = int(eval(input()))
# a,b = map(int,input().split())
L1 = tuple(map(int, input().split()))
L2 = tuple(map(int, input().split()))
L = [x + 1 for x in range(n)]
li = []
import itertools
for x in itertools.permutations(L, n):
# print(x)
li.append(x)
# print(li)
print((abs(li.index(L1) - li.index(L2))))
| n = int(eval(input()))
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
l = tuple(x + 1 for x in range(n))
# print(a,b,l)
c, d = 0, 0
cnt = 0
from itertools import permutations
for k in permutations(l):
# print(k)
cnt += 1
if a == k:
c = cnt
if b == k:
d = cnt
p... | false | 18.75 | [
"-# a,b = map(int,input().split())",
"-L1 = tuple(map(int, input().split()))",
"-L2 = tuple(map(int, input().split()))",
"-L = [x + 1 for x in range(n)]",
"-li = []",
"-import itertools",
"+a = tuple(map(int, input().split()))",
"+b = tuple(map(int, input().split()))",
"+l = tuple(x + 1 for x in ran... | false | 0.048803 | 0.048223 | 1.012028 | [
"s486033313",
"s950382923"
] |
u670567845 | p02572 | python | s034058433 | s266613934 | 152 | 136 | 31,608 | 31,508 | Accepted | Accepted | 10.53 | N = int(eval(input()))
A = list(map(int, input().split()))
inf = 10**9+7
aa = [0]*N
for i in range(N):
aa[i] = A[i]**2
X = sum(A)**2 - sum(aa)
print(((X//2)%inf)) | N = int(eval(input()))
A = list(map(int, input().split()))
sa = sum(A)
INF = 10**9+7
ans = 0
for i in range(N):
sa -= A[i]
ans += (A[i]*sa)%INF
print((ans%INF)) | 9 | 9 | 165 | 164 | N = int(eval(input()))
A = list(map(int, input().split()))
inf = 10**9 + 7
aa = [0] * N
for i in range(N):
aa[i] = A[i] ** 2
X = sum(A) ** 2 - sum(aa)
print(((X // 2) % inf))
| N = int(eval(input()))
A = list(map(int, input().split()))
sa = sum(A)
INF = 10**9 + 7
ans = 0
for i in range(N):
sa -= A[i]
ans += (A[i] * sa) % INF
print((ans % INF))
| false | 0 | [
"-inf = 10**9 + 7",
"-aa = [0] * N",
"+sa = sum(A)",
"+INF = 10**9 + 7",
"+ans = 0",
"- aa[i] = A[i] ** 2",
"-X = sum(A) ** 2 - sum(aa)",
"-print(((X // 2) % inf))",
"+ sa -= A[i]",
"+ ans += (A[i] * sa) % INF",
"+print((ans % INF))"
] | false | 0.080251 | 0.042556 | 1.885773 | [
"s034058433",
"s266613934"
] |
u867826040 | p02726 | python | s588537688 | s498115542 | 984 | 746 | 112,320 | 110,960 | Accepted | Accepted | 24.19 | from numba import njit,prange
@njit(cache=True,parallel=True)
def solve(n,x,y):
ans = [0] * (n - 1)
for i in prange(n):
for j in prange(n):
c = min(abs(i - j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
if c:
ans[c-1] += 1
return ans
n, x, y = ... | from numba import njit
@njit(cache=True)
def solve(n,x,y):
ans = [0] * (n - 1)
for i in range(n):
for j in range(n):
c = min(abs(i - j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
if c:
ans[c-1] += 1
return ans
n, x, y = list(map(int, input().s... | 20 | 20 | 416 | 393 | from numba import njit, prange
@njit(cache=True, parallel=True)
def solve(n, x, y):
ans = [0] * (n - 1)
for i in prange(n):
for j in prange(n):
c = min(
abs(i - j), abs(i - x) + abs(j - y) + 1, abs(i - y) + abs(j - x) + 1
)
if c:
ans[... | from numba import njit
@njit(cache=True)
def solve(n, x, y):
ans = [0] * (n - 1)
for i in range(n):
for j in range(n):
c = min(
abs(i - j), abs(i - x) + abs(j - y) + 1, abs(i - y) + abs(j - x) + 1
)
if c:
ans[c - 1] += 1
return an... | false | 0 | [
"-from numba import njit, prange",
"+from numba import njit",
"-@njit(cache=True, parallel=True)",
"+@njit(cache=True)",
"- for i in prange(n):",
"- for j in prange(n):",
"+ for i in range(n):",
"+ for j in range(n):"
] | false | 0.038151 | 0.070153 | 0.543829 | [
"s588537688",
"s498115542"
] |
u961288441 | p03545 | python | s860201223 | s240795780 | 71 | 61 | 61,968 | 62,064 | Accepted | Accepted | 14.08 | A, B, C, D = eval(input())
for i in range(2**3):
ans =["+", "+", "+"]
for j in range(3):
if (i>>j) & 1:
ans[j] = "-"
if eval(A+ans[0]+B+ans[1]+C+ans[2]+D) ==7:
print((A+ans[0]+B+ans[1]+C+ans[2]+D+'=7'))
break | import itertools
A, B, C, D = eval(input())
for i in itertools.product(['+', '-'], repeat=3):
if eval(A+i[0]+B+i[1]+C+i[2]+D) ==7:
print((A+i[0]+B+i[1]+C+i[2]+D+'=7'))
exit() | 9 | 6 | 256 | 191 | A, B, C, D = eval(input())
for i in range(2**3):
ans = ["+", "+", "+"]
for j in range(3):
if (i >> j) & 1:
ans[j] = "-"
if eval(A + ans[0] + B + ans[1] + C + ans[2] + D) == 7:
print((A + ans[0] + B + ans[1] + C + ans[2] + D + "=7"))
break
| import itertools
A, B, C, D = eval(input())
for i in itertools.product(["+", "-"], repeat=3):
if eval(A + i[0] + B + i[1] + C + i[2] + D) == 7:
print((A + i[0] + B + i[1] + C + i[2] + D + "=7"))
exit()
| false | 33.333333 | [
"+import itertools",
"+",
"-for i in range(2**3):",
"- ans = [\"+\", \"+\", \"+\"]",
"- for j in range(3):",
"- if (i >> j) & 1:",
"- ans[j] = \"-\"",
"- if eval(A + ans[0] + B + ans[1] + C + ans[2] + D) == 7:",
"- print((A + ans[0] + B + ans[1] + C + ans[2] + D + \... | false | 0.055094 | 0.036113 | 1.525625 | [
"s860201223",
"s240795780"
] |
u581187895 | p03475 | python | s461736453 | s846190009 | 137 | 88 | 3,064 | 3,188 | Accepted | Accepted | 35.77 | # 駅jjを出発する時刻は、
#S[j]+F[j]×kS[j]+F[j]×kとなる(kは車両数)。
#出発する時刻は現在時刻tt以上である必要があるので、
#S[j]+F[j]×k≥tS[j]+F[j]×k≥tとする。 式変形
N = int(eval(input()))
C = [0]*(N+1)
S = [0]*(N+1)
F = [0]*(N+1)
for i in range(N-1):
c, s, f = list(map(int, input().split()))
C[i] = c
S[i] = s
F[i] = f
for i in range(N): # 駅iを始点... | # 駅jjを出発する時刻は、
#S[j]+F[j]×kS[j]+F[j]×kとなる(kは車両数)。
#出発する時刻は現在時刻tt以上である必要があるので、
#S[j]+F[j]×k≥tS[j]+F[j]×k≥tとする。 式変形
import math
N = int(eval(input()))
CSF = [list(map(int, input().split())) for _ in range(N-1)]
for i in range(N): # 駅iを始点とする
t = 0 # 現在時刻
for j in range(i, N-1):
c, s, f = CSF[j]
if... | 25 | 17 | 485 | 417 | # 駅jjを出発する時刻は、
# S[j]+F[j]×kS[j]+F[j]×kとなる(kは車両数)。
# 出発する時刻は現在時刻tt以上である必要があるので、
# S[j]+F[j]×k≥tS[j]+F[j]×k≥tとする。 式変形
N = int(eval(input()))
C = [0] * (N + 1)
S = [0] * (N + 1)
F = [0] * (N + 1)
for i in range(N - 1):
c, s, f = list(map(int, input().split()))
C[i] = c
S[i] = s
F[i] = f
for i in range(N):... | # 駅jjを出発する時刻は、
# S[j]+F[j]×kS[j]+F[j]×kとなる(kは車両数)。
# 出発する時刻は現在時刻tt以上である必要があるので、
# S[j]+F[j]×k≥tS[j]+F[j]×k≥tとする。 式変形
import math
N = int(eval(input()))
CSF = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N): # 駅iを始点とする
t = 0 # 現在時刻
for j in range(i, N - 1):
c, s, f = CSF[j]
... | false | 32 | [
"+import math",
"+",
"-C = [0] * (N + 1)",
"-S = [0] * (N + 1)",
"-F = [0] * (N + 1)",
"-for i in range(N - 1):",
"- c, s, f = list(map(int, input().split()))",
"- C[i] = c",
"- S[i] = s",
"- F[i] = f",
"+CSF = [list(map(int, input().split())) for _ in range(N - 1)]",
"- # k... | false | 0.085354 | 0.071962 | 1.186101 | [
"s461736453",
"s846190009"
] |
u442396147 | p03163 | python | s230944882 | s882231179 | 1,154 | 774 | 287,332 | 178,292 | Accepted | Accepted | 32.93 | import sys
import pdb
input = sys.stdin.readline
N, W = list(map(int, input().split()))
ws = []
vs = []
for _ in range(N):
w, v = list(map(int, input().split()))
ws.append(w)
vs.append(v)
inf = 1e10
# Value[i番目までの品番][重さj以下]
Value = [[-inf for _ in range(W+1)] for __ in range(N)]
for load in r... | import sys
import pdb
input = sys.stdin.readline
N, W = list(map(int, input().split()))
ws = []
vs = []
for _ in range(N):
w, v = list(map(int, input().split()))
ws.append(w)
vs.append(v)
# Value[i番目までの品番][重さj以下]
Value = [[0 for _ in range(W+1)] for __ in range(N)]
for load in range(W+1):
if ... | 34 | 32 | 823 | 806 | import sys
import pdb
input = sys.stdin.readline
N, W = list(map(int, input().split()))
ws = []
vs = []
for _ in range(N):
w, v = list(map(int, input().split()))
ws.append(w)
vs.append(v)
inf = 1e10
# Value[i番目までの品番][重さj以下]
Value = [[-inf for _ in range(W + 1)] for __ in range(N)]
for load in range(W + 1):... | import sys
import pdb
input = sys.stdin.readline
N, W = list(map(int, input().split()))
ws = []
vs = []
for _ in range(N):
w, v = list(map(int, input().split()))
ws.append(w)
vs.append(v)
# Value[i番目までの品番][重さj以下]
Value = [[0 for _ in range(W + 1)] for __ in range(N)]
for load in range(W + 1):
if load <... | false | 5.882353 | [
"-inf = 1e10",
"-Value = [[-inf for _ in range(W + 1)] for __ in range(N)]",
"+Value = [[0 for _ in range(W + 1)] for __ in range(N)]"
] | false | 0.117254 | 0.078917 | 1.485797 | [
"s230944882",
"s882231179"
] |
u466116762 | p02885 | python | s780207521 | s364051979 | 194 | 165 | 38,384 | 38,256 | Accepted | Accepted | 14.95 | a,b=list(map(int,input().split()))
c = a-b*2
if c <0:
print((0))
else:
print(c) | a,b=map(int,input().split())
c = a-b*2
print(0) if c < 0 else print(c)
| 6 | 4 | 84 | 75 | a, b = list(map(int, input().split()))
c = a - b * 2
if c < 0:
print((0))
else:
print(c)
| a, b = map(int, input().split())
c = a - b * 2
print(0) if c < 0 else print(c)
| false | 33.333333 | [
"-a, b = list(map(int, input().split()))",
"+a, b = map(int, input().split())",
"-if c < 0:",
"- print((0))",
"-else:",
"- print(c)",
"+print(0) if c < 0 else print(c)"
] | false | 0.037243 | 0.037563 | 0.991474 | [
"s780207521",
"s364051979"
] |
u047796752 | p02929 | python | s936798975 | s676013632 | 218 | 200 | 61,552 | 53,728 | Accepted | Accepted | 8.26 | N = int(eval(input()))
S = list(eval(input()))
for i in range(2*N):
if (2*N-i)%2==1:
S[i] = 'B' if S[i]=='W' else 'W'
if S.count('B')!=N:
print((0))
exit()
ans = 1
MOD = 10**9+7
B = 0
for Si in S:
if Si=='B':
B += 1
else:
ans *= B
ans %... | import sys
input = sys.stdin.readline
from collections import *
N = int(eval(input()))
S = input()[:-1]
if S[0]=='W':
print((0))
exit()
l = [0]
ans = 1
MOD = 10**9+7
for i in range(1, 2*N):
if S[i]==S[i-1]:
l.append(1^l[-1])
else:
l.append(l[-1])
if l.count(... | 32 | 40 | 445 | 560 | N = int(eval(input()))
S = list(eval(input()))
for i in range(2 * N):
if (2 * N - i) % 2 == 1:
S[i] = "B" if S[i] == "W" else "W"
if S.count("B") != N:
print((0))
exit()
ans = 1
MOD = 10**9 + 7
B = 0
for Si in S:
if Si == "B":
B += 1
else:
ans *= B
ans %= MOD
... | import sys
input = sys.stdin.readline
from collections import *
N = int(eval(input()))
S = input()[:-1]
if S[0] == "W":
print((0))
exit()
l = [0]
ans = 1
MOD = 10**9 + 7
for i in range(1, 2 * N):
if S[i] == S[i - 1]:
l.append(1 ^ l[-1])
else:
l.append(l[-1])
if l.count(0) != N:
pri... | false | 20 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+from collections import *",
"+",
"-S = list(eval(input()))",
"-for i in range(2 * N):",
"- if (2 * N - i) % 2 == 1:",
"- S[i] = \"B\" if S[i] == \"W\" else \"W\"",
"-if S.count(\"B\") != N:",
"+S = input()[:-1]",
"+if S[0] == \"W\"... | false | 0.038838 | 0.035406 | 1.096921 | [
"s936798975",
"s676013632"
] |
u840310460 | p03448 | python | s217105721 | s930008707 | 178 | 49 | 39,536 | 3,060 | Accepted | Accepted | 72.47 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
to = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i + 100*j + 50*k == X:
to += 1
print(to) | A, B, C, X = [int(eval(input())) for i in range(4)]
ans =0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i + 100*j + 50*k == X:
ans += 1
print(ans) | 11 | 9 | 235 | 230 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
to = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500 * i + 100 * j + 50 * k == X:
to += 1
print(to)
| A, B, C, X = [int(eval(input())) for i in range(4)]
ans = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500 * i + 100 * j + 50 * k == X:
ans += 1
print(ans)
| false | 18.181818 | [
"-A = int(eval(input()))",
"-B = int(eval(input()))",
"-C = int(eval(input()))",
"-X = int(eval(input()))",
"-to = 0",
"+A, B, C, X = [int(eval(input())) for i in range(4)]",
"+ans = 0",
"- to += 1",
"-print(to)",
"+ ans += 1",
"+print(ans)"
] | false | 0.072668 | 0.071758 | 1.012673 | [
"s217105721",
"s930008707"
] |
u984276646 | p02793 | python | s644420511 | s077268299 | 1,642 | 594 | 4,084 | 4,084 | Accepted | Accepted | 63.82 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e+9 + 7)
L = A[0]
p = mod - 2
X = []
while p != 0:
X = [p%2] + X[:]
p //= 2
def inved(x):
y = 1
for i in range(len(X)):
if X[i] == 1:
y *= x
y %= mod
if i != len(X) - 1:
y *= y
y %= mod
re... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e+9 + 7)
L = A[0]
def inved(a):
x, y, u, v, k, l = 1, 0, 0, 1, a, mod
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
k, l = l, k % l
return x % mod
for i in range(N-1):
a, b = L, A[i+1]
while b != 0:... | 33 | 24 | 518 | 464 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e9 + 7)
L = A[0]
p = mod - 2
X = []
while p != 0:
X = [p % 2] + X[:]
p //= 2
def inved(x):
y = 1
for i in range(len(X)):
if X[i] == 1:
y *= x
y %= mod
if i != len(X) - 1:
y *= y
... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e9 + 7)
L = A[0]
def inved(a):
x, y, u, v, k, l = 1, 0, 0, 1, a, mod
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
k, l = l, k % l
return x % mod
for i in range(N - 1):
a, b = L, A[i + 1]
... | false | 27.272727 | [
"-p = mod - 2",
"-X = []",
"-while p != 0:",
"- X = [p % 2] + X[:]",
"- p //= 2",
"-def inved(x):",
"- y = 1",
"- for i in range(len(X)):",
"- if X[i] == 1:",
"- y *= x",
"- y %= mod",
"- if i != len(X) - 1:",
"- y *= y",
"- ... | false | 0.111839 | 0.036425 | 3.070359 | [
"s644420511",
"s077268299"
] |
u091307273 | p02720 | python | s993474850 | s527845365 | 1,953 | 43 | 18,480 | 13,972 | Accepted | Accepted | 97.8 | def main():
k = int(eval(input()))
hp = list(range(1, 10))
for i in range(k-1):
n = hp.pop(0)
nm = n % 10
val = n * 10 + nm
if nm != 0:
hp.append(val - 1)
hp.append(val)
if nm != 9:
hp.append(val + 1)
print((hp... | def main():
k = int(eval(input()))
hp = [i for i in range(k+4)]
r, w = 1, 10
while w <= k:
n = hp[r]
r += 1
nm = n % 10
val = n * 10 + nm
if nm != 0:
hp[w] = val - 1
w += 1
hp[w] = val
w += 1
... | 16 | 22 | 328 | 405 | def main():
k = int(eval(input()))
hp = list(range(1, 10))
for i in range(k - 1):
n = hp.pop(0)
nm = n % 10
val = n * 10 + nm
if nm != 0:
hp.append(val - 1)
hp.append(val)
if nm != 9:
hp.append(val + 1)
print((hp[0]))
main()
| def main():
k = int(eval(input()))
hp = [i for i in range(k + 4)]
r, w = 1, 10
while w <= k:
n = hp[r]
r += 1
nm = n % 10
val = n * 10 + nm
if nm != 0:
hp[w] = val - 1
w += 1
hp[w] = val
w += 1
if nm != 9:
... | false | 27.272727 | [
"- hp = list(range(1, 10))",
"- for i in range(k - 1):",
"- n = hp.pop(0)",
"+ hp = [i for i in range(k + 4)]",
"+ r, w = 1, 10",
"+ while w <= k:",
"+ n = hp[r]",
"+ r += 1",
"- hp.append(val - 1)",
"- hp.append(val)",
"+ hp[w] = ... | false | 0.343572 | 0.046233 | 7.431262 | [
"s993474850",
"s527845365"
] |
u638282348 | p02702 | python | s034861382 | s265947482 | 319 | 115 | 19,868 | 9,652 | Accepted | Accepted | 63.95 | from collections import Counter
S = list(reversed(eval(input())))
l = len(S)
N = 0
counts = Counter([(N := N + (pow(10, i, 2019) * int(S[i])) % 2019) % 2019 for i in range(l)] + [0])
print((sum(n * (n - 1) // 2 for n in list(counts.values()))))
| from collections import Counter
l = len(S := eval(input()))
counts = Counter((n := (n + (d := d * 10 % 2019) * int(S[-i])) % 2019 if i else (n := 0 * (d := 202)) for i in range(l + 1)))
print((sum(n * (n - 1) // 2 for n in list(counts.values()))))
| 6 | 4 | 236 | 237 | from collections import Counter
S = list(reversed(eval(input())))
l = len(S)
N = 0
counts = Counter(
[(N := N + (pow(10, i, 2019) * int(S[i])) % 2019) % 2019 for i in range(l)] + [0]
)
print((sum(n * (n - 1) // 2 for n in list(counts.values()))))
| from collections import Counter
l = len(S := eval(input()))
counts = Counter(
(
n := (n + (d := d * 10 % 2019) * int(S[-i])) % 2019
if i
else (n := 0 * (d := 202))
for i in range(l + 1)
)
)
print((sum(n * (n - 1) // 2 for n in list(counts.values()))))
| false | 33.333333 | [
"-S = list(reversed(eval(input())))",
"-l = len(S)",
"-N = 0",
"+l = len(S := eval(input()))",
"- [(N := N + (pow(10, i, 2019) * int(S[i])) % 2019) % 2019 for i in range(l)] + [0]",
"+ (",
"+ n := (n + (d := d * 10 % 2019) * int(S[-i])) % 2019",
"+ if i",
"+ else (n := 0 *... | false | 0.037265 | 0.072831 | 0.511663 | [
"s034861382",
"s265947482"
] |
u644907318 | p03946 | python | s892975424 | s600349876 | 383 | 111 | 84,884 | 93,040 | Accepted | Accepted | 71.02 | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {}
amin = A[0]
for i in range(1,N):
a = A[i]
if a>amin:
b = a-amin
if b not in C:
C[b] = []
C[b].append(i)
elif a==amin:
continue
else:
amin = a
C = sorted(list(... | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [0 for _ in range(N)]
amax = A[-1]
for i in range(N-2,-1,-1):
a = A[i]
if a>amax:
B[i] = 0
amax = a
else:
B[i] = amax-a
bmax = 0
amax = 0
for i in range(N):
b = B[i]
if b>bmax:
... | 17 | 32 | 377 | 614 | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
C = {}
amin = A[0]
for i in range(1, N):
a = A[i]
if a > amin:
b = a - amin
if b not in C:
C[b] = []
C[b].append(i)
elif a == amin:
continue
else:
amin = a
C = sorted(list(C.ite... | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0 for _ in range(N)]
amax = A[-1]
for i in range(N - 2, -1, -1):
a = A[i]
if a > amax:
B[i] = 0
amax = a
else:
B[i] = amax - a
bmax = 0
amax = 0
for i in range(N):
b = B[i]
if b > bmax:
am... | false | 46.875 | [
"-C = {}",
"-amin = A[0]",
"-for i in range(1, N):",
"+B = [0 for _ in range(N)]",
"+amax = A[-1]",
"+for i in range(N - 2, -1, -1):",
"- if a > amin:",
"- b = a - amin",
"- if b not in C:",
"- C[b] = []",
"- C[b].append(i)",
"- elif a == amin:",
"- ... | false | 0.040208 | 0.039023 | 1.030368 | [
"s892975424",
"s600349876"
] |
u008229752 | p02861 | python | s552048966 | s140448665 | 1,028 | 881 | 13,772 | 13,772 | Accepted | Accepted | 14.3 | import numpy as np
from itertools import permutations
import math
n = int(eval(input()))
li = []
for _ in range(n):
i, j = list(map(int, input().split()))
li.append(np.array([i, j]))
li2 = permutations(li)
re = []
for a in li2:
dis = 0
for (x1,y1),(x2,y2) in zip(a,a[1:]):
d... | import numpy as np
from itertools import permutations
import math
n = int(eval(input()))
li = []
for _ in range(n):
i, j = list(map(int, input().split()))
li.append(np.array([i, j]))
li2 = permutations(li)
re = []
for a in li2:
dis = 0
for (x1,y1),(x2,y2) in zip(a,a[1:]):
... | 21 | 23 | 402 | 423 | import numpy as np
from itertools import permutations
import math
n = int(eval(input()))
li = []
for _ in range(n):
i, j = list(map(int, input().split()))
li.append(np.array([i, j]))
li2 = permutations(li)
re = []
for a in li2:
dis = 0
for (x1, y1), (x2, y2) in zip(a, a[1:]):
dis += math.sqrt((... | import numpy as np
from itertools import permutations
import math
n = int(eval(input()))
li = []
for _ in range(n):
i, j = list(map(int, input().split()))
li.append(np.array([i, j]))
li2 = permutations(li)
re = []
for a in li2:
dis = 0
for (x1, y1), (x2, y2) in zip(a, a[1:]):
x = x1 - x2
... | false | 8.695652 | [
"- dis += math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))",
"+ x = x1 - x2",
"+ y = y1 - y2",
"+ dis += math.sqrt(x * x + y * y)"
] | false | 0.24423 | 0.501745 | 0.486761 | [
"s552048966",
"s140448665"
] |
u497952650 | p02720 | python | s495382479 | s344035813 | 145 | 121 | 31,588 | 38,080 | Accepted | Accepted | 16.55 | def runrun(K,S):
if K <= len(S):
S.sort()
##print(S)
print((S[K-1]))
return
else:
for i in range(len(S)):
tmp = S[i]%10
if tmp == 9:
S.append(S[i]*10+8)
S.append(S[i]*10+9)
elif tmp == 0:
... | def lunlun(K,S):
if len(S) >= K:
S.sort()
print((S[K-1]))
return
for a in range(len(S)):
i = S[a]
rem = i%10
n = 10*i + rem
if rem == 9:
S.append(n)
S.append(n-1)
elif rem == 0:
S.append(n)
... | 28 | 28 | 702 | 528 | def runrun(K, S):
if K <= len(S):
S.sort()
##print(S)
print((S[K - 1]))
return
else:
for i in range(len(S)):
tmp = S[i] % 10
if tmp == 9:
S.append(S[i] * 10 + 8)
S.append(S[i] * 10 + 9)
elif tmp == 0:
... | def lunlun(K, S):
if len(S) >= K:
S.sort()
print((S[K - 1]))
return
for a in range(len(S)):
i = S[a]
rem = i % 10
n = 10 * i + rem
if rem == 9:
S.append(n)
S.append(n - 1)
elif rem == 0:
S.append(n)
S... | false | 0 | [
"-def runrun(K, S):",
"- if K <= len(S):",
"+def lunlun(K, S):",
"+ if len(S) >= K:",
"- ##print(S)",
"- else:",
"- for i in range(len(S)):",
"- tmp = S[i] % 10",
"- if tmp == 9:",
"- S.append(S[i] * 10 + 8)",
"- S.append... | false | 0.069518 | 0.066373 | 1.047387 | [
"s495382479",
"s344035813"
] |
u855775311 | p02362 | python | s911175958 | s884952043 | 350 | 310 | 8,208 | 8,276 | Accepted | Accepted | 11.43 | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
E = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
E.append((u, v, w))
INF = float('inf')
weights = [INF] * nvertices
weights[s] = 0
for i in range(nvertices - 1... | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
edges = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
edges.append((u, v, w))
INF = float('inf')
weights = [INF] * nvertices
weights[s] = 0
for i in range(nve... | 29 | 31 | 675 | 695 | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
E = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
E.append((u, v, w))
INF = float("inf")
weights = [INF] * nvertices
weights[s] = 0
for i in range(nvertices - 1):
f... | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
edges = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
edges.append((u, v, w))
INF = float("inf")
weights = [INF] * nvertices
weights[s] = 0
for i in range(nvertices - 1):
... | false | 6.451613 | [
"- E = []",
"+ edges = []",
"- E.append((u, v, w))",
"+ edges.append((u, v, w))",
"- for u, v, w in E:",
"+ for u, v, w in edges:",
"- for u, v, w in E:",
"+ for u, v, w in edges:"
] | false | 0.04329 | 0.076945 | 0.562613 | [
"s911175958",
"s884952043"
] |
u756829954 | p02862 | python | s274329964 | s215892232 | 319 | 193 | 119,148 | 38,512 | Accepted | Accepted | 39.5 | def p_d():
x, y = list(map(int, input().split()))
if y > x:
x, y = y, x
if (x + y) % 3 != 0:
print((0))
exit()
if x - y > (x + y) // 3:
print((0))
exit()
x, y = x - (x + y) // 3, y - (x + y) // 3
mod = 10 ** 9 + 7 # 出力の制限
N = x + y
... | def p_d():
x, y = list(map(int, input().split()))
if y > x:
x, y = y, x
if (x + y) % 3 != 0:
print((0))
exit()
if x - y > (x + y) // 3:
print((0))
exit()
x, y = x - (x + y) // 3, y - (x + y) // 3
def c_mod(n, r, mod=10 ** 9 + 7):
n1, ... | 32 | 23 | 781 | 575 | def p_d():
x, y = list(map(int, input().split()))
if y > x:
x, y = y, x
if (x + y) % 3 != 0:
print((0))
exit()
if x - y > (x + y) // 3:
print((0))
exit()
x, y = x - (x + y) // 3, y - (x + y) // 3
mod = 10**9 + 7 # 出力の制限
N = x + y
g1 = [1, 1] # 元テ... | def p_d():
x, y = list(map(int, input().split()))
if y > x:
x, y = y, x
if (x + y) % 3 != 0:
print((0))
exit()
if x - y > (x + y) // 3:
print((0))
exit()
x, y = x - (x + y) // 3, y - (x + y) // 3
def c_mod(n, r, mod=10**9 + 7):
n1, r = n + 1, min(... | false | 28.125 | [
"- mod = 10**9 + 7 # 出力の制限",
"- N = x + y",
"- g1 = [1, 1] # 元テーブル",
"- g2 = [1, 1] # 逆元テーブル",
"- inverse = [0, 1] # 逆元テーブル計算用テーブル",
"- for i in range(2, N + 1):",
"- g1.append((g1[-1] * i) % mod)",
"- inverse.append((-inverse[mod % i] * (mod // i)) % mod)",
"- ... | false | 0.378497 | 0.0543 | 6.970451 | [
"s274329964",
"s215892232"
] |
u891504219 | p02772 | python | s295706203 | s423806117 | 178 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.45 | def main():
N = int(eval(input()))
A = list(map(int,input().split()))
answer = "APPROVED"
for a in A:
if a % 2 == 0:
if a % 3 == 0 or a % 5 == 0:
pass
else:
answer = "DENIED"
else:
pass
print(answer)
i... | def main():
N = int(eval(input()))
A = list(map(int,input().split()))
answer = "APPROVED"
for a in A:
if a % 2 == 0:
if a % 3 == 0 or a % 5 == 0:
continue
else:
answer = "DENIED"
print(answer)
if __name__ == "__main__":
... | 16 | 14 | 351 | 322 | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
answer = "APPROVED"
for a in A:
if a % 2 == 0:
if a % 3 == 0 or a % 5 == 0:
pass
else:
answer = "DENIED"
else:
pass
print(answer)
if __name__ =... | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
answer = "APPROVED"
for a in A:
if a % 2 == 0:
if a % 3 == 0 or a % 5 == 0:
continue
else:
answer = "DENIED"
print(answer)
if __name__ == "__main__":
main()
| false | 12.5 | [
"- pass",
"+ continue",
"- else:",
"- pass"
] | false | 0.116627 | 0.061512 | 1.896017 | [
"s295706203",
"s423806117"
] |
u564902833 | p03266 | python | s320227389 | s286769022 | 137 | 17 | 2,940 | 3,060 | Accepted | Accepted | 87.59 | N, K = list(map(int, input().split()))
ans = sum(((N + a % K) // K)**2 for a in range(1, N + 1) if (2 * a) % K == 0)
print(ans) | from math import ceil, floor
N, K = map(int, input().split())
r = floor((2 * N) / K)
ans = floor(N / K)**3 if K % 2 == 1 \
else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1)**2 + floor(r / 2) * floor(N / K)**2
print(ans)
| 3 | 6 | 123 | 232 | N, K = list(map(int, input().split()))
ans = sum(((N + a % K) // K) ** 2 for a in range(1, N + 1) if (2 * a) % K == 0)
print(ans)
| from math import ceil, floor
N, K = map(int, input().split())
r = floor((2 * N) / K)
ans = (
floor(N / K) ** 3
if K % 2 == 1
else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1) ** 2
+ floor(r / 2) * floor(N / K) ** 2
)
print(ans)
| false | 50 | [
"-N, K = list(map(int, input().split()))",
"-ans = sum(((N + a % K) // K) ** 2 for a in range(1, N + 1) if (2 * a) % K == 0)",
"+from math import ceil, floor",
"+",
"+N, K = map(int, input().split())",
"+r = floor((2 * N) / K)",
"+ans = (",
"+ floor(N / K) ** 3",
"+ if K % 2 == 1",
"+ els... | false | 0.059299 | 0.043761 | 1.355065 | [
"s320227389",
"s286769022"
] |
u223646582 | p02948 | python | s179408784 | s761245067 | 617 | 506 | 28,492 | 20,988 | Accepted | Accepted | 17.99 | import heapq
N, M = list(map(int, input().split()))
W = [] # 取り組める仕事のリスト
for _ in range(N):
W.append(tuple(map(int, input().split())))
W = sorted(W, key=lambda x: (x[0], -x[1]))
a = []
heapq.heapify(a) # リストaのheap化
ans = 0
c = 0
for day in range(1, M+1):
day_c = 0
while c != N and W[c]... | import heapq
N, M = list(map(int, input().split()))
AB = []
for _ in range(N):
A, B = list(map(int, input().split()))
AB.append((A, B))
AB = sorted(AB, key=lambda x: x[0])
hq = []
heapq.heapify(hq) # リストhqのheap化
ans = 0
i = 0
for d in range(1, M+1):
while i <= N-1 and AB[i][0] <= d:
... | 26 | 21 | 579 | 474 | import heapq
N, M = list(map(int, input().split()))
W = [] # 取り組める仕事のリスト
for _ in range(N):
W.append(tuple(map(int, input().split())))
W = sorted(W, key=lambda x: (x[0], -x[1]))
a = []
heapq.heapify(a) # リストaのheap化
ans = 0
c = 0
for day in range(1, M + 1):
day_c = 0
while c != N and W[c][0] == day:
... | import heapq
N, M = list(map(int, input().split()))
AB = []
for _ in range(N):
A, B = list(map(int, input().split()))
AB.append((A, B))
AB = sorted(AB, key=lambda x: x[0])
hq = []
heapq.heapify(hq) # リストhqのheap化
ans = 0
i = 0
for d in range(1, M + 1):
while i <= N - 1 and AB[i][0] <= d:
heapq.heap... | false | 19.230769 | [
"-W = [] # 取り組める仕事のリスト",
"+AB = []",
"- W.append(tuple(map(int, input().split())))",
"-W = sorted(W, key=lambda x: (x[0], -x[1]))",
"-a = []",
"-heapq.heapify(a) # リストaのheap化",
"+ A, B = list(map(int, input().split()))",
"+ AB.append((A, B))",
"+AB = sorted(AB, key=lambda x: x[0])",
"+h... | false | 0.049778 | 0.049983 | 0.995898 | [
"s179408784",
"s761245067"
] |
u968166680 | p03476 | python | s491353023 | s163068862 | 135 | 124 | 29,016 | 29,016 | Accepted | Accepted | 8.15 | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n ** 0.5 - 1... | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n ** 0.5 - 1... | 36 | 39 | 810 | 898 | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n**0.5 - 1) / 2) + 1):
i... | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n**0.5 - 1) / 2) + 1):
i... | false | 7.692308 | [
"-N = 10**5",
"-primes = prime_numbers(N)",
"-a = [1 if n in primes and (n + 1) // 2 in primes else 0 for n in range(N + 1)]",
"-a = tuple(accumulate(a))",
"-ans = []",
"-Q, *LR = list(map(int, open(0).read().split()))",
"-for l, r in zip(*[iter(LR)] * 2):",
"- ans.append(a[r] - a[l - 1])",
"-pri... | false | 0.161027 | 0.197302 | 0.816141 | [
"s491353023",
"s163068862"
] |
u794448346 | p02888 | python | s563131544 | s495127218 | 1,210 | 197 | 9,376 | 73,216 | Accepted | Accepted | 83.72 | N = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
ans = 0
max = l[N-1]
tc = N
st = [j+1 for j in range(N-1)]
for i in range(N-2):
if l[i]+l[i+1] > max:
k = N-i-1
ans += ((k-1)*k*(k+1))//6
break
for j in range(i+1,N-1):
if j == tc:
ans +=... | N = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(N-2):
for j in range(i+1,N-1):
s = l[i]+l[j]
start = j+1
end = N
while start != end:
center = (start + end)//2
if s <= l[center]:
end = center... | 38 | 17 | 903 | 406 | N = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
max = l[N - 1]
tc = N
st = [j + 1 for j in range(N - 1)]
for i in range(N - 2):
if l[i] + l[i + 1] > max:
k = N - i - 1
ans += ((k - 1) * k * (k + 1)) // 6
break
for j in range(i + 1, N - 1):
if j == tc:
... | N = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
s = l[i] + l[j]
start = j + 1
end = N
while start != end:
center = (start + end) // 2
if s <= l[center]:
end = cent... | false | 55.263158 | [
"-max = l[N - 1]",
"-tc = N",
"-st = [j + 1 for j in range(N - 1)]",
"- if l[i] + l[i + 1] > max:",
"- k = N - i - 1",
"- ans += ((k - 1) * k * (k + 1)) // 6",
"- break",
"- if j == tc:",
"- ans += tp",
"- break",
"- if s <= l[j + 1]:",... | false | 0.054793 | 0.035262 | 1.553866 | [
"s563131544",
"s495127218"
] |
u844789719 | p04013 | python | s470753507 | s114306591 | 69 | 50 | 3,188 | 3,188 | Accepted | Accepted | 27.54 | N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
M = max(X + [A])
dp = [0] * (2 * N * M + 1)
dp[N * M] = 1
for x in X:
dp_old = dp.copy()
for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)):
dp[i + x] += dp_old[i]
print((dp[N * M] - 1))
| N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_plus = len(X_plus)
l_minus = len(X_minus)
l_zero = len(X) - l_plus - l_minus
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = [1] + [0] * s_plus
dp_minu... | 10 | 24 | 308 | 804 | N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
M = max(X + [A])
dp = [0] * (2 * N * M + 1)
dp[N * M] = 1
for x in X:
dp_old = dp.copy()
for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)):
dp[i + x] += dp_old[i]
print((dp[N * M] - 1))
| N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_plus = len(X_plus)
l_minus = len(X_minus)
l_zero = len(X) - l_plus - l_minus
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = [1] + [0] * s_plus
dp_minus = [1] + ... | false | 58.333333 | [
"-M = max(X + [A])",
"-dp = [0] * (2 * N * M + 1)",
"-dp[N * M] = 1",
"-for x in X:",
"- dp_old = dp.copy()",
"- for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)):",
"- dp[i + x] += dp_old[i]",
"-print((dp[N * M] - 1))",
"+X_plus = [_ for _ in X if _ > 0]",
"+X_minus =... | false | 0.04075 | 0.041155 | 0.990164 | [
"s470753507",
"s114306591"
] |
u312025627 | p02854 | python | s200447881 | s045565345 | 288 | 159 | 89,296 | 26,220 | Accepted | Accepted | 44.79 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
s = [0] * (N + 1)
for i in range(0, N):
s[i+1] = s[i] + A[i]
ans = (1 << 63) - 1
for j in range(1, N):
left = s[j] - s[0]
right = s[N] - s[j]
ans = min(ans, abs(right - left))
... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from itertools import accumulate
acc = [a for a in accumulate([0] + A)]
ans = acc[-1]
for i in range(1, N+1):
a = acc[i]
b = acc[N] - acc[i]
v = abs(a-b)
ans = min(ans, v)
prin... | 16 | 16 | 369 | 365 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
s = [0] * (N + 1)
for i in range(0, N):
s[i + 1] = s[i] + A[i]
ans = (1 << 63) - 1
for j in range(1, N):
left = s[j] - s[0]
right = s[N] - s[j]
ans = min(ans, abs(right - left))
print(ans... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from itertools import accumulate
acc = [a for a in accumulate([0] + A)]
ans = acc[-1]
for i in range(1, N + 1):
a = acc[i]
b = acc[N] - acc[i]
v = abs(a - b)
ans = min(ans, v)
print(ans)... | false | 0 | [
"- s = [0] * (N + 1)",
"- for i in range(0, N):",
"- s[i + 1] = s[i] + A[i]",
"- ans = (1 << 63) - 1",
"- for j in range(1, N):",
"- left = s[j] - s[0]",
"- right = s[N] - s[j]",
"- ans = min(ans, abs(right - left))",
"+ from itertools import accumulate",
... | false | 0.064762 | 0.070586 | 0.917489 | [
"s200447881",
"s045565345"
] |
u068692021 | p02887 | python | s100164405 | s209912056 | 47 | 32 | 3,316 | 3,316 | Accepted | Accepted | 31.91 | N=int(eval(input()))
S=eval(input())
count = 0
ans=0
j=''
for i in S:
count +=1
if (count>=2) & (i==j): continue
else:
j=i
ans += 1
print(ans) | def resolve():
n = int(eval(input()))
targets = eval(input())
ans = 1
for i in range(len(targets)-1):
if targets[i] == targets[i+1]:
pass
else:
ans += 1
print(ans)
resolve() | 14 | 14 | 173 | 237 | N = int(eval(input()))
S = eval(input())
count = 0
ans = 0
j = ""
for i in S:
count += 1
if (count >= 2) & (i == j):
continue
else:
j = i
ans += 1
print(ans)
| def resolve():
n = int(eval(input()))
targets = eval(input())
ans = 1
for i in range(len(targets) - 1):
if targets[i] == targets[i + 1]:
pass
else:
ans += 1
print(ans)
resolve()
| false | 0 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-count = 0",
"-ans = 0",
"-j = \"\"",
"-for i in S:",
"- count += 1",
"- if (count >= 2) & (i == j):",
"- continue",
"- else:",
"- j = i",
"- ans += 1",
"-print(ans)",
"+def resolve():",
"+ n = int(eval(in... | false | 0.047127 | 0.043475 | 1.083999 | [
"s100164405",
"s209912056"
] |
u143509139 | p02999 | python | s292007466 | s649763899 | 171 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | x, a = list(map(int, input().split()))
if x < a:
print((0))
else:
print((10)) | x, a = list(map(int, input().split()))
print((0 if x < a else 10)) | 5 | 2 | 79 | 59 | x, a = list(map(int, input().split()))
if x < a:
print((0))
else:
print((10))
| x, a = list(map(int, input().split()))
print((0 if x < a else 10))
| false | 60 | [
"-if x < a:",
"- print((0))",
"-else:",
"- print((10))",
"+print((0 if x < a else 10))"
] | false | 0.137275 | 0.046994 | 2.921099 | [
"s292007466",
"s649763899"
] |
u995004106 | p02679 | python | s566459089 | s175353956 | 1,082 | 971 | 227,356 | 228,404 | Accepted | Accepted | 10.26 | def modpow(a,n,p):
if n==0:
return 1
x=modpow(a,n//2,p)
x=(x*x)%p
if (n%2)==1:
x=(x*a)%p
return x%p
def modinv(a,p):
return modpow(a,p-2,p)
def ggcd(a,b):
if(b==0):
return a
return ggcd(b,a%b)
import math
import fractions
import collections
import... | def modpow(a,n,p):
if n==0:
return 1
x=modpow(a,n//2,p)
x=(x*x)%p
if (n%2)==1:
x=(x*a)%p
return x%p
def modinv(a,p):
return modpow(a,p-2,p)
def ggcd(a,b):
if(b==0):
return a
return ggcd(b,a%b)
import math
import fractions
import collections
import... | 77 | 83 | 1,546 | 1,964 | def modpow(a, n, p):
if n == 0:
return 1
x = modpow(a, n // 2, p)
x = (x * x) % p
if (n % 2) == 1:
x = (x * a) % p
return x % p
def modinv(a, p):
return modpow(a, p - 2, p)
def ggcd(a, b):
if b == 0:
return a
return ggcd(b, a % b)
import math
import fraction... | def modpow(a, n, p):
if n == 0:
return 1
x = modpow(a, n // 2, p)
x = (x * x) % p
if (n % 2) == 1:
x = (x * a) % p
return x % p
def modinv(a, p):
return modpow(a, p - 2, p)
def ggcd(a, b):
if b == 0:
return a
return ggcd(b, a % b)
import math
import fraction... | false | 7.228916 | [
"+ # イメージ的にはa/bを格納していく感じ",
"+ # ai/bi==-bj/ajならダメ",
"- if g != 0:",
"+ if g != 0: # ggcdの定義よりa=b=0なら0になりそう(a=0,b!=0ならb,逆もしかり)",
"- if (b == 0) and (a > 0):",
"- a = 1",
"- elif b < 0:",
"+ # ここらへんで、a,bをそのgcdで割ることによる正規化が完了しているはず",
"+ if b < 0:",
"+ # b<0の時に強制的にbを正... | false | 0.050967 | 0.146095 | 0.34886 | [
"s566459089",
"s175353956"
] |
u047796752 | p02845 | python | s063337006 | s895504437 | 211 | 97 | 53,356 | 84,160 | Accepted | Accepted | 54.03 | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0]*N
p = 0
ans = 1
MOD = 10**9+7
for Ai in A:
if Ai==0:
cnt[Ai] += 1
p += 1
else:
ans *= cnt[Ai-1]
ans %= MOD
cnt[Ai-1] -= 1
cnt[Ai] += 1
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
MOD = 10**9+7
r, g, b = 0, 0, 0
for Ai in A:
cnt = 0
if r==Ai:
cnt += 1
if g==Ai:
cnt += 1
if b==Ai:
cnt += 1
ans *= cnt
... | 30 | 32 | 427 | 441 | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0] * N
p = 0
ans = 1
MOD = 10**9 + 7
for Ai in A:
if Ai == 0:
cnt[Ai] += 1
p += 1
else:
ans *= cnt[Ai - 1]
ans %= MOD
cnt[Ai - 1] -= 1
cnt[Ai] += 1
if p == 1:
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
MOD = 10**9 + 7
r, g, b = 0, 0, 0
for Ai in A:
cnt = 0
if r == Ai:
cnt += 1
if g == Ai:
cnt += 1
if b == Ai:
cnt += 1
ans *= cnt
ans %= MOD
if r == Ai:
r ... | false | 6.25 | [
"-cnt = [0] * N",
"-p = 0",
"+r, g, b = 0, 0, 0",
"- if Ai == 0:",
"- cnt[Ai] += 1",
"- p += 1",
"+ cnt = 0",
"+ if r == Ai:",
"+ cnt += 1",
"+ if g == Ai:",
"+ cnt += 1",
"+ if b == Ai:",
"+ cnt += 1",
"+ ans *= cnt",
"+ ans %= MOD... | false | 0.037251 | 0.079998 | 0.465647 | [
"s063337006",
"s895504437"
] |
u584174687 | p03148 | python | s826564084 | s166534461 | 801 | 499 | 70,488 | 65,884 | Accepted | Accepted | 37.7 |
import heapq
def main():
num_sushi, chose_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(num_sushi)]
data.sort(key=lambda x: -x[1])
delicious_heap = []
count_d, count_n = 0, 0
neta_data = [0 for i in range(num_sushi + 1)]
for i ... |
import heapq
import sys
input = sys.stdin.readline
def main():
num_sushi, chose_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(num_sushi)]
data.sort(key=lambda x: -x[1])
delicious_heap = []
count_d, count_n = 0, 0
neta_data = [0 for i ... | 45 | 46 | 1,037 | 1,075 | import heapq
def main():
num_sushi, chose_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(num_sushi)]
data.sort(key=lambda x: -x[1])
delicious_heap = []
count_d, count_n = 0, 0
neta_data = [0 for i in range(num_sushi + 1)]
for i in range(chose_n... | import heapq
import sys
input = sys.stdin.readline
def main():
num_sushi, chose_num = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(num_sushi)]
data.sort(key=lambda x: -x[1])
delicious_heap = []
count_d, count_n = 0, 0
neta_data = [0 for i in range(num... | false | 2.173913 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.045876 | 0.04579 | 1.001877 | [
"s826564084",
"s166534461"
] |
u476604182 | p02793 | python | s355593770 | s934039816 | 693 | 297 | 17,256 | 15,456 | Accepted | Accepted | 57.14 | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6 + 10
T = np.zeros(U, np.bool)
T[2] = 1
T[3::2] = 1
for p in range(3,U,2):
if p*p>U:
break
if T[p]==1:
T[p*p::p+p] = 0
pls = np.where(T==1)[0].tolist()
M = pls[:1000]
B = A.copy()
... | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6 + 10
T = np.zeros(U, np.bool)
T[2] = 1
T[3::2] = 1
for p in range(3,U,2):
if p*p>U:
break
if T[p]==1:
T[p*p::p+p] = 0
M = np.where(T[:1000])[0].tolist()
B = A.copy()
lcm = 1
for ... | 33 | 32 | 551 | 537 | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), np.int64)
MOD = 10**9 + 7
U = 10**6 + 10
T = np.zeros(U, np.bool)
T[2] = 1
T[3::2] = 1
for p in range(3, U, 2):
if p * p > U:
break
if T[p] == 1:
T[p * p :: p + p] = 0
pls = np.where(T == 1)[0].tolist()
M = pls[:1000]
B = A... | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), np.int64)
MOD = 10**9 + 7
U = 10**6 + 10
T = np.zeros(U, np.bool)
T[2] = 1
T[3::2] = 1
for p in range(3, U, 2):
if p * p > U:
break
if T[p] == 1:
T[p * p :: p + p] = 0
M = np.where(T[:1000])[0].tolist()
B = A.copy()
lcm = 1... | false | 3.030303 | [
"-pls = np.where(T == 1)[0].tolist()",
"-M = pls[:1000]",
"+M = np.where(T[:1000])[0].tolist()"
] | false | 0.539885 | 0.260156 | 2.075234 | [
"s355593770",
"s934039816"
] |
u609061751 | p03162 | python | s544583891 | s514098660 | 694 | 382 | 76,348 | 70,236 | Accepted | Accepted | 44.96 | N=int(eval(input()))
a=[]
for _ in range(N):
b=list(map(int,input().split()))
a.append(b)
dp=[]
for _ in range(N):
dp.append([0,0,0])
dp[0][0]=a[0][0]
dp[0][1]=a[0][1]
dp[0][2]=a[0][2]
for i in range(1,N):
dp[i][0]=max(dp[i-1][1]+a[i][0],dp[i-1][2]+a[i][0])
dp[i][1]=max(dp[i-1][0]+a[i]... | import sys
input = sys.stdin.readline
n = int(eval(input()))
abc = [[int(x) for x in input().split()] for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, n):
a, b, c = abc[i]
dp[i][0] = max(dp[i - 1][1] + a, dp[i - ... | 16 | 18 | 440 | 458 | N = int(eval(input()))
a = []
for _ in range(N):
b = list(map(int, input().split()))
a.append(b)
dp = []
for _ in range(N):
dp.append([0, 0, 0])
dp[0][0] = a[0][0]
dp[0][1] = a[0][1]
dp[0][2] = a[0][2]
for i in range(1, N):
dp[i][0] = max(dp[i - 1][1] + a[i][0], dp[i - 1][2] + a[i][0])
dp[i][1] = ma... | import sys
input = sys.stdin.readline
n = int(eval(input()))
abc = [[int(x) for x in input().split()] for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, n):
a, b, c = abc[i]
dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)
... | false | 11.111111 | [
"-N = int(eval(input()))",
"-a = []",
"-for _ in range(N):",
"- b = list(map(int, input().split()))",
"- a.append(b)",
"-dp = []",
"-for _ in range(N):",
"- dp.append([0, 0, 0])",
"-dp[0][0] = a[0][0]",
"-dp[0][1] = a[0][1]",
"-dp[0][2] = a[0][2]",
"-for i in range(1, N):",
"- dp... | false | 0.04458 | 0.141192 | 0.315742 | [
"s544583891",
"s514098660"
] |
u021019433 | p02669 | python | s407214685 | s394481473 | 569 | 259 | 11,340 | 10,960 | Accepted | Accepted | 54.48 | a = 2, 3, 5
def f(n):
m = memo.get(n)
if m is None:
s = {(0, 0, 0)}.union(*({(n // p, p, c), (-(-n // p), p, c)} for p, c in zip(a, b)))
m = min(f(x) + abs(x * p - n) * d + c for x, p, c in s)
memo[n] = m
return m
t = int(eval(input()))
for _ in range(t):
n, *b, d = list(map(int, input... | a = 2, 3, 5
def f(n):
m = memo.get(n)
if m is None:
m = d * n
for p, c in zip(a, b):
k, r = divmod(n, p);
m = min(m, f(k) + r * d + c, r and f(k + 1) + (p - r) * d + c or m)
memo[n] = m
return m
t = int(eval(input()))
for _ in range(t):
n, *b, d = list(map(int, input().s... | 15 | 17 | 359 | 355 | a = 2, 3, 5
def f(n):
m = memo.get(n)
if m is None:
s = {(0, 0, 0)}.union(
*({(n // p, p, c), (-(-n // p), p, c)} for p, c in zip(a, b))
)
m = min(f(x) + abs(x * p - n) * d + c for x, p, c in s)
memo[n] = m
return m
t = int(eval(input()))
for _ in range(t):
... | a = 2, 3, 5
def f(n):
m = memo.get(n)
if m is None:
m = d * n
for p, c in zip(a, b):
k, r = divmod(n, p)
m = min(m, f(k) + r * d + c, r and f(k + 1) + (p - r) * d + c or m)
memo[n] = m
return m
t = int(eval(input()))
for _ in range(t):
n, *b, d = list(... | false | 11.764706 | [
"- s = {(0, 0, 0)}.union(",
"- *({(n // p, p, c), (-(-n // p), p, c)} for p, c in zip(a, b))",
"- )",
"- m = min(f(x) + abs(x * p - n) * d + c for x, p, c in s)",
"+ m = d * n",
"+ for p, c in zip(a, b):",
"+ k, r = divmod(n, p)",
"+ ... | false | 1.099975 | 0.181372 | 6.064744 | [
"s407214685",
"s394481473"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.