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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u536034761 | p03837 | python | s270994078 | s554890234 | 273 | 167 | 77,084 | 9,360 | Accepted | Accepted | 38.83 | import heapq
n, m = list(map(int, input().split()))
graph = [set() for _ in range(n)]
side = dict()
ans = [0 for _ in range(m + 1)]
for i in range(m):
a, b, c = list(map(int, input().split()))
t = (a - 1, b - 1, c)
side[i] = t
graph[a-1].add(i)
graph[b-1].add(i)
for j in range(n):
... | import heapq
n, m = list(map(int, input().split()))
edges = dict()
ans = [0 for _ in range(m + 1)]
graph = [set() for _ in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
edges[i] = (a - 1, b - 1, c)
graph[a - 1].add(i)
graph[b - 1].add(i)
# (cost,done,node,edge)
... | 32 | 37 | 778 | 843 | import heapq
n, m = list(map(int, input().split()))
graph = [set() for _ in range(n)]
side = dict()
ans = [0 for _ in range(m + 1)]
for i in range(m):
a, b, c = list(map(int, input().split()))
t = (a - 1, b - 1, c)
side[i] = t
graph[a - 1].add(i)
graph[b - 1].add(i)
for j in range(n):
D = [
... | import heapq
n, m = list(map(int, input().split()))
edges = dict()
ans = [0 for _ in range(m + 1)]
graph = [set() for _ in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
edges[i] = (a - 1, b - 1, c)
graph[a - 1].add(i)
graph[b - 1].add(i)
# (cost,done,node,edge)
for i in range(n... | false | 13.513514 | [
"+edges = dict()",
"+ans = [0 for _ in range(m + 1)]",
"-side = dict()",
"-ans = [0 for _ in range(m + 1)]",
"- t = (a - 1, b - 1, c)",
"- side[i] = t",
"+ edges[i] = (a - 1, b - 1, c)",
"-for j in range(n):",
"+# (cost,done,node,edge)",
"+for i in range(n):",
"+ done = [True for _ i... | false | 0.045915 | 0.067838 | 0.676826 | [
"s270994078",
"s554890234"
] |
u057993957 | p02712 | python | s958020038 | s312712011 | 173 | 146 | 30,148 | 29,848 | Accepted | Accepted | 15.61 | n = int(eval(input()))
a = []
for i in range(1, n+1):
if (i % 3 != 0) and (i % 5 != 0):
a.append(i)
print((sum(a))) | n = int(eval(input()))
a= [i for i in range(1, n+1)
if i % 3 != 0 and i % 5 != 0 and i % 15 != 0]
print((sum(a))) | 8 | 4 | 128 | 112 | n = int(eval(input()))
a = []
for i in range(1, n + 1):
if (i % 3 != 0) and (i % 5 != 0):
a.append(i)
print((sum(a)))
| n = int(eval(input()))
a = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0 and i % 15 != 0]
print((sum(a)))
| false | 50 | [
"-a = []",
"-for i in range(1, n + 1):",
"- if (i % 3 != 0) and (i % 5 != 0):",
"- a.append(i)",
"+a = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0 and i % 15 != 0]"
] | false | 0.105446 | 0.090004 | 1.171571 | [
"s958020038",
"s312712011"
] |
u798818115 | p02820 | python | s530748926 | s301772312 | 159 | 61 | 4,828 | 4,212 | Accepted | Accepted | 61.64 | # coding: utf-8
# Your code here!
N,K=list(map(int,input().split()))
R,S,P=list(map(int,input().split()))
l=list(eval(input()))
play=[]
def point(hand):
if hand=="r":
return ["p",P]
elif hand=="s":
return ["r",R]
else:
return ["s",S]
ans=0
for i in range(N)[::-1]:
... | # coding: utf-8
# Your code here!
N,K=list(map(int,input().split()))
R,S,P=list(map(int,input().split()))
point=[R,S,P]
T=eval(input())
myhand=[]
for item in T:
if item == "r":
myhand.append("p")
elif item == "s":
myhand.append("r")
else:
myhand.append("s")
for i in... | 39 | 25 | 985 | 454 | # coding: utf-8
# Your code here!
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
l = list(eval(input()))
play = []
def point(hand):
if hand == "r":
return ["p", P]
elif hand == "s":
return ["r", R]
else:
return ["s", S]
ans = 0
for i in range(N)[... | # coding: utf-8
# Your code here!
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
point = [R, S, P]
T = eval(input())
myhand = []
for item in T:
if item == "r":
myhand.append("p")
elif item == "s":
myhand.append("r")
else:
myhand.append("s")
for i in ... | false | 35.897436 | [
"-l = list(eval(input()))",
"-play = []",
"-",
"-",
"-def point(hand):",
"- if hand == \"r\":",
"- return [\"p\", P]",
"- elif hand == \"s\":",
"- return [\"r\", R]",
"+point = [R, S, P]",
"+T = eval(input())",
"+myhand = []",
"+for item in T:",
"+ if item == \"r\":"... | false | 0.043521 | 0.037019 | 1.175635 | [
"s530748926",
"s301772312"
] |
u983918956 | p03722 | python | s038898847 | s545299644 | 744 | 467 | 3,316 | 3,316 | Accepted | Accepted | 37.23 | inf = float('inf')
N,M = list(map(int,input().split()))
info = []
for _ in range(M):
a,b,c = list(map(int,input().split()))
a -= 1; b -= 1
info.append((a,b,c))
dist = [-inf for _ in range(N)]
dist[0] = 0
for i in range(N):
for v,nv,w in info:
if dist[nv] < dist[v] + w:
... | inf = float('inf')
# distの初期化: dist = [inf for _ in range(N)]; dist[start] = 0
# True - >正常に更新, False -> 負閉路有り
def bellmanford(dist,edges,N):
for i in range(N):
for v ,nv, w in edges:
if dist[nv] > dist[v] + w:
dist[nv] = dist[v] + w
# 頂点数Nなら更新は高々N-1回で済む... | 20 | 28 | 456 | 754 | inf = float("inf")
N, M = list(map(int, input().split()))
info = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
info.append((a, b, c))
dist = [-inf for _ in range(N)]
dist[0] = 0
for i in range(N):
for v, nv, w in info:
if dist[nv] < dist[v] + w:
di... | inf = float("inf")
# distの初期化: dist = [inf for _ in range(N)]; dist[start] = 0
# True - >正常に更新, False -> 負閉路有り
def bellmanford(dist, edges, N):
for i in range(N):
for v, nv, w in edges:
if dist[nv] > dist[v] + w:
dist[nv] = dist[v] + w
# 頂点数Nなら更新は高々N-1回で済む
... | false | 28.571429 | [
"+# distの初期化: dist = [inf for _ in range(N)]; dist[start] = 0",
"+# True - >正常に更新, False -> 負閉路有り",
"+def bellmanford(dist, edges, N):",
"+ for i in range(N):",
"+ for v, nv, w in edges:",
"+ if dist[nv] > dist[v] + w:",
"+ dist[nv] = dist[v] + w",
"+ ... | false | 0.074842 | 0.036692 | 2.039752 | [
"s038898847",
"s545299644"
] |
u139614630 | p03013 | python | s160347588 | s917196933 | 59 | 51 | 11,884 | 11,884 | Accepted | Accepted | 13.56 | #!/usr/bin/env python3
import sys
P_NUM = 1000000007
def solv(n, m, a):
comb_m2 = 1
if 1 in a:
comb_m1 = 0
else:
comb_m1 = 1
comb = 1
for i in range(2, n+1):
if i in a:
comb = 0
a.remove(i)
else:
comb = (com... | #!/usr/bin/env python3
import sys
P_NUM = 1000000007
def solv(n, m, a):
comb_m2 = 1
if 1 in a:
comb_m1 = 0
else:
comb_m1 = 1
for i in range(2, n+1):
if i in a:
comb_m1, comb_m2 = 0, comb_m1
else:
comb_m1, comb_m2 = (comb_m1 +... | 38 | 34 | 603 | 565 | #!/usr/bin/env python3
import sys
P_NUM = 1000000007
def solv(n, m, a):
comb_m2 = 1
if 1 in a:
comb_m1 = 0
else:
comb_m1 = 1
comb = 1
for i in range(2, n + 1):
if i in a:
comb = 0
a.remove(i)
else:
comb = (comb_m1 + comb_m2) % P_... | #!/usr/bin/env python3
import sys
P_NUM = 1000000007
def solv(n, m, a):
comb_m2 = 1
if 1 in a:
comb_m1 = 0
else:
comb_m1 = 1
for i in range(2, n + 1):
if i in a:
comb_m1, comb_m2 = 0, comb_m1
else:
comb_m1, comb_m2 = (comb_m1 + comb_m2) % P_NUM,... | false | 10.526316 | [
"- comb = 1",
"- comb = 0",
"- a.remove(i)",
"+ comb_m1, comb_m2 = 0, comb_m1",
"- comb = (comb_m1 + comb_m2) % P_NUM",
"- comb_m1, comb_m2 = comb, comb_m1",
"- return comb",
"+ comb_m1, comb_m2 = (comb_m1 + comb_m2) % P_NUM, comb_m1"... | false | 0.064133 | 0.039269 | 1.633176 | [
"s160347588",
"s917196933"
] |
u040298438 | p02897 | python | s277176472 | s639963365 | 29 | 26 | 9,136 | 9,108 | Accepted | Accepted | 10.34 | n = int(eval(input()))
print(((n + 1) // 2 / n)) | n = int(eval(input()))
print(((((n + 1) // 2) / n, 0.5)[n % 2 == 0])) | 2 | 2 | 41 | 62 | n = int(eval(input()))
print(((n + 1) // 2 / n))
| n = int(eval(input()))
print(((((n + 1) // 2) / n, 0.5)[n % 2 == 0]))
| false | 0 | [
"-print(((n + 1) // 2 / n))",
"+print(((((n + 1) // 2) / n, 0.5)[n % 2 == 0]))"
] | false | 0.048855 | 0.046633 | 1.047639 | [
"s277176472",
"s639963365"
] |
u332385682 | p03722 | python | s782734732 | s044590260 | 441 | 225 | 68,572 | 42,352 | Accepted | Accepted | 48.98 | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
inf = 1<<100
def solve():
N, M = list(map(int, input().split()))
edges = [None]*M
Adj = [[] for i in range(N)]
for i in range(M):
ui, vi, ci = list(map(int, sys.stdin.readline().split()))
ui, vi ... | import sys
inf = 1<<60
def solve():
N, M = list(map(int, input().split()))
edges = [None] * M
for i in range(M):
ai, bi, ci = list(map(int, sys.stdin.readline().split()))
ai, bi = ai - 1, bi - 1
edges[i] = (ai, bi, -ci)
ans = BellmanFord(N, M, edges)
if an... | 77 | 41 | 1,587 | 825 | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
inf = 1 << 100
def solve():
N, M = list(map(int, input().split()))
edges = [None] * M
Adj = [[] for i in range(N)]
for i in range(M):
ui, vi, ci = list(map(int, sys.stdin.readline().split()))
ui, vi = ui - 1, vi -... | import sys
inf = 1 << 60
def solve():
N, M = list(map(int, input().split()))
edges = [None] * M
for i in range(M):
ai, bi, ci = list(map(int, sys.stdin.readline().split()))
ai, bi = ai - 1, bi - 1
edges[i] = (ai, bi, -ci)
ans = BellmanFord(N, M, edges)
if ans is None:
... | false | 46.753247 | [
"-from collections import Counter",
"-sys.setrecursionlimit(10**7)",
"-inf = 1 << 100",
"+inf = 1 << 60",
"- Adj = [[] for i in range(N)]",
"- ui, vi, ci = list(map(int, sys.stdin.readline().split()))",
"- ui, vi = ui - 1, vi - 1",
"- edges[i] = (ui, vi, -ci)",
"- Adj[... | false | 0.037411 | 0.035605 | 1.050715 | [
"s782734732",
"s044590260"
] |
u761529120 | p03411 | python | s874414610 | s882286968 | 181 | 67 | 39,024 | 63,932 | Accepted | Accepted | 62.98 | def main():
N = int(eval(input()))
Red = []
Blue = []
for i in range(N):
a, b = list(map(int, input().split()))
Red.append([b,a])
for i in range(N):
c, d = list(map(int, input().split()))
Blue.append([c,d])
Red.sort(reverse=True)
Blue.sort()
... | from bisect import bisect_left
def main():
N = int(eval(input()))
ball = []
for i in range(N):
a, b = list(map(int, input().split()))
ball.append([a,b,'r'])
for i in range(N):
c, d = list(map(int, input().split()))
ball.append([c,d,'b'])
sort_ball = so... | 25 | 39 | 539 | 839 | def main():
N = int(eval(input()))
Red = []
Blue = []
for i in range(N):
a, b = list(map(int, input().split()))
Red.append([b, a])
for i in range(N):
c, d = list(map(int, input().split()))
Blue.append([c, d])
Red.sort(reverse=True)
Blue.sort()
ans = 0
... | from bisect import bisect_left
def main():
N = int(eval(input()))
ball = []
for i in range(N):
a, b = list(map(int, input().split()))
ball.append([a, b, "r"])
for i in range(N):
c, d = list(map(int, input().split()))
ball.append([c, d, "b"])
sort_ball = sorted(ball,... | false | 35.897436 | [
"+from bisect import bisect_left",
"+",
"+",
"- Red = []",
"- Blue = []",
"+ ball = []",
"- Red.append([b, a])",
"+ ball.append([a, b, \"r\"])",
"- Blue.append([c, d])",
"- Red.sort(reverse=True)",
"- Blue.sort()",
"+ ball.append([c, d, \"b\"])",
"+... | false | 0.042276 | 0.10723 | 0.39426 | [
"s874414610",
"s882286968"
] |
u186838327 | p03779 | python | s773259636 | s692731443 | 182 | 62 | 38,512 | 63,060 | Accepted | Accepted | 65.93 | x = int(eval(input()))
temp = 0
for i in range(x+1):
temp += i
if temp >= x:
print(i)
exit()
| x = int(eval(input()))
for i in range(10**6):
if i*(i+1)//2 >= x:
print(i)
exit()
| 7 | 5 | 117 | 100 | x = int(eval(input()))
temp = 0
for i in range(x + 1):
temp += i
if temp >= x:
print(i)
exit()
| x = int(eval(input()))
for i in range(10**6):
if i * (i + 1) // 2 >= x:
print(i)
exit()
| false | 28.571429 | [
"-temp = 0",
"-for i in range(x + 1):",
"- temp += i",
"- if temp >= x:",
"+for i in range(10**6):",
"+ if i * (i + 1) // 2 >= x:"
] | false | 0.046969 | 0.036073 | 1.302048 | [
"s773259636",
"s692731443"
] |
u970197315 | p03559 | python | s573985979 | s901958192 | 345 | 319 | 23,360 | 22,516 | Accepted | Accepted | 7.54 | from bisect import bisect_left,bisect_right
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
ai=bisect_left(a,b[i])
ci=bisect_right(c,b[i])
ans+=ai*(n-ci)
print(ans)
| n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
from bisect import bisect_left,bisect_right
ans=0
for i in range(n):
ida=bisect_left(a,b[i])
idc=bisect_right(c,b[i])
ans+=ida*(n-idc)
print(ans) | 15 | 14 | 310 | 305 | from bisect import bisect_left, bisect_right
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in range(n):
ai = bisect_left(a, b[i])
ci = bisect_right(c, b[i])
ans += ai * (n - ci)
pri... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
from bisect import bisect_left, bisect_right
ans = 0
for i in range(n):
ida = bisect_left(a, b[i])
idc = bisect_right(c, b[i])
ans += ida * (n - idc)... | false | 6.666667 | [
"-from bisect import bisect_left, bisect_right",
"-",
"+from bisect import bisect_left, bisect_right",
"+",
"- ai = bisect_left(a, b[i])",
"- ci = bisect_right(c, b[i])",
"- ans += ai * (n - ci)",
"+ ida = bisect_left(a, b[i])",
"+ idc = bisect_right(c, b[i])",
"+ ans += ida * (n... | false | 0.039663 | 0.139212 | 0.284914 | [
"s573985979",
"s901958192"
] |
u127499732 | p03112 | python | s579501219 | s554995107 | 778 | 468 | 36,612 | 36,564 | Accepted | Accepted | 39.85 | def main():
from bisect import bisect_left as bl
a, b, q, *stx = list(map(int, open(0).read().split()))
s = [-float('Inf')] + stx[:a] + [float('Inf')]
t = [-float('Inf')] + stx[a:a + b] + [float('Inf')]
x = stx[a + b:]
tmp = []
for i in x:
f, g = bl(s, i), bl(t, i)
... | def main():
from bisect import bisect_left as bl
a, b, q, *stx = list(map(int, open(0).read().split()))
s = [-float('Inf')] + stx[:a] + [float('Inf')]
t = [-float('Inf')] + stx[a:a + b] + [float('Inf')]
x = stx[a + b:]
tmp = []
for i in x:
f, g = bl(s, i), bl(t, i)
... | 31 | 22 | 884 | 622 | def main():
from bisect import bisect_left as bl
a, b, q, *stx = list(map(int, open(0).read().split()))
s = [-float("Inf")] + stx[:a] + [float("Inf")]
t = [-float("Inf")] + stx[a : a + b] + [float("Inf")]
x = stx[a + b :]
tmp = []
for i in x:
f, g = bl(s, i), bl(t, i)
sl, sr... | def main():
from bisect import bisect_left as bl
a, b, q, *stx = list(map(int, open(0).read().split()))
s = [-float("Inf")] + stx[:a] + [float("Inf")]
t = [-float("Inf")] + stx[a : a + b] + [float("Inf")]
x = stx[a + b :]
tmp = []
for i in x:
f, g = bl(s, i), bl(t, i)
sr, sl... | false | 29.032258 | [
"- sl, sr = s[f - 1], s[f]",
"- tl, tr = t[g - 1], t[g]",
"- d = float(\"Inf\")",
"- for j in [sl, sr]:",
"- for k in [tr, tl]:",
"- if j <= i and k <= i:",
"- d = min(d, i - min(j, k))",
"- elif j <= i <= k or k <... | false | 0.040575 | 0.04016 | 1.010345 | [
"s579501219",
"s554995107"
] |
u284744415 | p02899 | python | s864602725 | s788134697 | 187 | 159 | 24,180 | 24,180 | Accepted | Accepted | 14.97 | n = int(eval(input()))
print((" ".join([str(x[1]) for x in sorted([(int(a), num) for a, num in zip(input().split(" "), list(range(1,n + 1)))])]))) | print((" ".join([str(x[0]) for x in sorted([(num, int(a)) for num, a in zip(list(range(1,int(eval(input())) + 1)), input().split(" "))], key=lambda x: x[1],)]))) | 2 | 1 | 144 | 158 | n = int(eval(input()))
print(
(
" ".join(
[
str(x[1])
for x in sorted(
[
(int(a), num)
for a, num in zip(input().split(" "), list(range(1, n + 1)))
]
)
... | print(
(
" ".join(
[
str(x[0])
for x in sorted(
[
(num, int(a))
for num, a in zip(
list(range(1, int(eval(input())) + 1)), input().split(" ")
)
... | false | 50 | [
"-n = int(eval(input()))",
"- str(x[1])",
"+ str(x[0])",
"- (int(a), num)",
"- for a, num in zip(input().split(\" \"), list(range(1, n + 1)))",
"- ]",
"+ (num, int(a))",
"+ ... | false | 0.041613 | 0.043754 | 0.951067 | [
"s864602725",
"s788134697"
] |
u191874006 | p03244 | python | s526973744 | s818977370 | 284 | 252 | 64,272 | 62,304 | Accepted | Accepted | 11.27 | #!/usr/bin/env python3
#ABC111 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fro... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 49 | 52 | 1,227 | 1,496 | #!/usr/bin/env python3
# ABC111 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools ... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 5.769231 | [
"-# ABC111 C",
"-import bisect",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-sys.setrecursionlimit(1000000000)",
"-from heapq import heappush, heappop",
"+sys.setrecursionlimit(2147483647)",
"+from heapq import heappush, heappop, heappushpop",
"-s, t = [], []... | false | 0.035294 | 0.099013 | 0.356456 | [
"s526973744",
"s818977370"
] |
u077291787 | p03160 | python | s311286117 | s720006678 | 204 | 157 | 24,264 | 13,876 | Accepted | Accepted | 23.04 | # A - Frog 1
from collections import defaultdict
def main():
N, *H = list(map(int, open(0).read().split()))
H = [0] + H + [0, 0]
dp = defaultdict(lambda: 1 << 30)
dp[1] = 0
for i, a in enumerate(H[1:N + 1], 1):
for j, b in enumerate(H[i + 1:i + 3], i + 1):
dp[j] = mi... | # A - Frog 1
def main():
N, *H = list(map(int, open(0).read().split()))
H = [0] + H + [0, 0]
dp = [1 << 30] * (N + 3)
dp[1] = 0
for i, a in enumerate(H[1:N + 1], 1):
for j, b in enumerate(H[i + 1:i + 3], i + 1):
dp[j] = min(dp[j], dp[i] + abs(a - b))
print((dp[N]))
... | 17 | 14 | 405 | 355 | # A - Frog 1
from collections import defaultdict
def main():
N, *H = list(map(int, open(0).read().split()))
H = [0] + H + [0, 0]
dp = defaultdict(lambda: 1 << 30)
dp[1] = 0
for i, a in enumerate(H[1 : N + 1], 1):
for j, b in enumerate(H[i + 1 : i + 3], i + 1):
dp[j] = min(dp[j]... | # A - Frog 1
def main():
N, *H = list(map(int, open(0).read().split()))
H = [0] + H + [0, 0]
dp = [1 << 30] * (N + 3)
dp[1] = 0
for i, a in enumerate(H[1 : N + 1], 1):
for j, b in enumerate(H[i + 1 : i + 3], i + 1):
dp[j] = min(dp[j], dp[i] + abs(a - b))
print((dp[N]))
if _... | false | 17.647059 | [
"-from collections import defaultdict",
"-",
"-",
"- dp = defaultdict(lambda: 1 << 30)",
"+ dp = [1 << 30] * (N + 3)"
] | false | 0.04638 | 0.046885 | 0.989223 | [
"s311286117",
"s720006678"
] |
u896847891 | p02783 | python | s394795717 | s629738523 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | h,a=list(map(int,input().split()))
print((int((h-1)/a)+1)) | h, a = list(map(int, input().split()))
print(((h+a-1)//a)) | 2 | 2 | 51 | 51 | h, a = list(map(int, input().split()))
print((int((h - 1) / a) + 1))
| h, a = list(map(int, input().split()))
print(((h + a - 1) // a))
| false | 0 | [
"-print((int((h - 1) / a) + 1))",
"+print(((h + a - 1) // a))"
] | false | 0.069312 | 0.064963 | 1.066938 | [
"s394795717",
"s629738523"
] |
u298297089 | p03330 | python | s081911357 | s222938177 | 972 | 237 | 3,064 | 3,188 | Accepted | Accepted | 75.62 | from itertools import permutations as perm
N,C = list(map(int, input().split()))
colors = []
for i in range(C):
colors.append(list(map(int, input().split())))
grids = {0:{}, 1:{}, 2:{}}
for i in range(1,N+1):
A =list(map(int, input().split()))
for j in range(N):
if A[j] not in grids[(i+j+... | n,c = list(map(int, input().split()))
color, grid = [], []
for _ in range(c):
color.append(list(map(int, input().split())))
grid = {i:{} for i in range(3)}
for i in range(n):
for j,t in enumerate(map(int, input().split())):
t -= 1
if t not in grid[(i+j + 2) % 3]:
grid[(i+j... | 22 | 31 | 635 | 1,026 | from itertools import permutations as perm
N, C = list(map(int, input().split()))
colors = []
for i in range(C):
colors.append(list(map(int, input().split())))
grids = {0: {}, 1: {}, 2: {}}
for i in range(1, N + 1):
A = list(map(int, input().split()))
for j in range(N):
if A[j] not in grids[(i + j ... | n, c = list(map(int, input().split()))
color, grid = [], []
for _ in range(c):
color.append(list(map(int, input().split())))
grid = {i: {} for i in range(3)}
for i in range(n):
for j, t in enumerate(map(int, input().split())):
t -= 1
if t not in grid[(i + j + 2) % 3]:
grid[(i + j + 2... | false | 29.032258 | [
"-from itertools import permutations as perm",
"-",
"-N, C = list(map(int, input().split()))",
"-colors = []",
"-for i in range(C):",
"- colors.append(list(map(int, input().split())))",
"-grids = {0: {}, 1: {}, 2: {}}",
"-for i in range(1, N + 1):",
"- A = list(map(int, input().split()))",
"... | false | 0.046136 | 0.045848 | 1.006282 | [
"s081911357",
"s222938177"
] |
u927534107 | p03044 | python | s396128196 | s338961295 | 862 | 748 | 57,692 | 57,692 | Accepted | Accepted | 13.23 | n=int(eval(input()))
c=[[] for i in range(n+1)]
d={}
for i in range(n-1):
x,y,z=list(map(int,input().split()))
c[x].append(y)
c[y].append(x)
d[x,y]=z
d[1,1]=0
stack=[1]
parent=[None]*(n+1)
while stack:
i=stack.pop()
for j in c[i]:
if j==parent[i]:
continue
... | import sys
input = sys.stdin.readline
n=int(eval(input()))
c=[[] for i in range(n+1)]
d={}
for i in range(n-1):
x,y,z=list(map(int,input().split()))
c[x].append(y)
c[y].append(x)
d[x,y]=z
d[1,1]=0
stack=[1]
parent=[None]*(n+1)
while stack:
i=stack.pop()
for j in c[i]:
if ... | 21 | 23 | 441 | 481 | n = int(eval(input()))
c = [[] for i in range(n + 1)]
d = {}
for i in range(n - 1):
x, y, z = list(map(int, input().split()))
c[x].append(y)
c[y].append(x)
d[x, y] = z
d[1, 1] = 0
stack = [1]
parent = [None] * (n + 1)
while stack:
i = stack.pop()
for j in c[i]:
if j == parent[i]:
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
c = [[] for i in range(n + 1)]
d = {}
for i in range(n - 1):
x, y, z = list(map(int, input().split()))
c[x].append(y)
c[y].append(x)
d[x, y] = z
d[1, 1] = 0
stack = [1]
parent = [None] * (n + 1)
while stack:
i = stack.pop()
for j in c... | false | 8.695652 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.232763 | 0.046436 | 5.012512 | [
"s396128196",
"s338961295"
] |
u017415492 | p03061 | python | s521588429 | s580401332 | 146 | 135 | 21,100 | 25,768 | Accepted | Accepted | 7.53 | import math
n=int(eval(input()))
a = list(map(int,input().split()))
a.sort()
lr=[0]*n
rl=[0]*n
for i in range(n):
if i==0:
g=a[0]
lr[0]=g
else:
g=math.gcd(a[i],g)
lr[i]=g
for i in range(n-1,0,-1):
if n-1==i:
g=a[n-1]
rl[n-1]=g
else:
g=math.gcd(a[i],g)
r... | import math
n=int(eval(input()))
a=list(map(int,input().split()))
ra=list(reversed(a))
left=[]
right=[]
right.append(ra[0])
left.append(a[0])
if n>2:
k=math.gcd(a[0],a[1])
left.append(k)
for i in range(2,n-1):
k=math.gcd(k,a[i])
left.append(k)
k=math.gcd(ra[0],ra[1])
right.appen... | 37 | 31 | 549 | 571 | import math
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
lr = [0] * n
rl = [0] * n
for i in range(n):
if i == 0:
g = a[0]
lr[0] = g
else:
g = math.gcd(a[i], g)
lr[i] = g
for i in range(n - 1, 0, -1):
if n - 1 == i:
g = a[n - 1]
rl[n - 1... | import math
n = int(eval(input()))
a = list(map(int, input().split()))
ra = list(reversed(a))
left = []
right = []
right.append(ra[0])
left.append(a[0])
if n > 2:
k = math.gcd(a[0], a[1])
left.append(k)
for i in range(2, n - 1):
k = math.gcd(k, a[i])
left.append(k)
k = math.gcd(ra[0], r... | false | 16.216216 | [
"-a.sort()",
"-lr = [0] * n",
"-rl = [0] * n",
"-for i in range(n):",
"- if i == 0:",
"- g = a[0]",
"- lr[0] = g",
"- else:",
"- g = math.gcd(a[i], g)",
"- lr[i] = g",
"-for i in range(n - 1, 0, -1):",
"- if n - 1 == i:",
"- g = a[n - 1]",
"- ... | false | 0.041875 | 0.088919 | 0.470928 | [
"s521588429",
"s580401332"
] |
u832871520 | p02773 | python | s939927855 | s175372816 | 723 | 642 | 45,040 | 45,040 | Accepted | Accepted | 11.2 | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
C = Counter(S)
l = []
max = C.most_common(1)[0][1]
for c in C.most_common():
if max == c[1]:
l.append(c[0])
else:
break
l.sort()
for x in l:
print(x) | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
C = Counter(S)
l = []
max = C.most_common(1)[0][1]
for c in C.most_common():
if max == c[1]:
l.append(c[0])
else:
break
l.sort()
print(("\n".join(l))) | 14 | 13 | 271 | 265 | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
C = Counter(S)
l = []
max = C.most_common(1)[0][1]
for c in C.most_common():
if max == c[1]:
l.append(c[0])
else:
break
l.sort()
for x in l:
print(x)
| from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
C = Counter(S)
l = []
max = C.most_common(1)[0][1]
for c in C.most_common():
if max == c[1]:
l.append(c[0])
else:
break
l.sort()
print(("\n".join(l)))
| false | 7.142857 | [
"-for x in l:",
"- print(x)",
"+print((\"\\n\".join(l)))"
] | false | 0.043243 | 0.065507 | 0.660123 | [
"s939927855",
"s175372816"
] |
u620084012 | p03730 | python | s424045194 | s756925203 | 175 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.29 | A, B, C = list(map(int,input().split()))
for k in range(1,101):
if (A*k)%B == C:
print("YES")
exit(0)
print("NO") | A, B, C = list(map(int,input().split()))
for k in range(1,B+1):
if (A*k)%B == C:
print("YES")
exit(0)
print("NO")
| 7 | 6 | 134 | 133 | A, B, C = list(map(int, input().split()))
for k in range(1, 101):
if (A * k) % B == C:
print("YES")
exit(0)
print("NO")
| A, B, C = list(map(int, input().split()))
for k in range(1, B + 1):
if (A * k) % B == C:
print("YES")
exit(0)
print("NO")
| false | 14.285714 | [
"-for k in range(1, 101):",
"+for k in range(1, B + 1):"
] | false | 0.078154 | 0.036939 | 2.115744 | [
"s424045194",
"s756925203"
] |
u642883360 | p03545 | python | s090712082 | s082178331 | 184 | 162 | 38,384 | 38,496 | Accepted | Accepted | 11.96 | s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
for i in range(2):
for j in range(2):
for k in range(2):
x = a + b*(-1)**i + c*(-1)**j + d*(-1)**k
if x == 7:
print(a, end='')
print('-' if i else '+', end='')
print(b, end='')
print('-' if j else '+', end='')
... | a, b, c, d = eval(input())
for x in "+-":
for y in "+-":
for z in "+-":
f = a + x + b + y + c + z + d
if eval(f) == 7:
print((f + "=7"))
exit() | 20 | 8 | 428 | 159 | s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
for i in range(2):
for j in range(2):
for k in range(2):
x = a + b * (-1) ** i + c * (-1) ** j + d * (-1) ** k
if x == 7:
print(a, end="")
print("-" if i else "+", end="")
... | a, b, c, d = eval(input())
for x in "+-":
for y in "+-":
for z in "+-":
f = a + x + b + y + c + z + d
if eval(f) == 7:
print((f + "=7"))
exit()
| false | 60 | [
"-s = input()",
"-a = int(s[0])",
"-b = int(s[1])",
"-c = int(s[2])",
"-d = int(s[3])",
"-for i in range(2):",
"- for j in range(2):",
"- for k in range(2):",
"- x = a + b * (-1) ** i + c * (-1) ** j + d * (-1) ** k",
"- if x == 7:",
"- print(a, end... | false | 0.044186 | 0.036496 | 1.210713 | [
"s090712082",
"s082178331"
] |
u810356688 | p03986 | python | s044522743 | s571613240 | 177 | 56 | 41,052 | 5,092 | Accepted | Accepted | 68.36 | import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
X=eval(input())
cunt=0
cunt_s=0
for x in X:
if x=='S':
cunt_s+=1
elif cunt_s>0:
cunt_s-=1
else:
cunt+=1
print((cunt+cunt_... | import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
X=eval(input())
stack=deque()
for x in X:
if x=='S' or (x=='T' and (not stack or stack[-1]=='T')):
stack.append(x)
elif stack and stack[-1]=='S':
stack.pop... | 18 | 14 | 355 | 377 | import sys
def input():
return sys.stdin.readline().rstrip()
from collections import Counter
def main():
X = eval(input())
cunt = 0
cunt_s = 0
for x in X:
if x == "S":
cunt_s += 1
elif cunt_s > 0:
cunt_s -= 1
else:
cunt += 1
print... | import sys
def input():
return sys.stdin.readline().rstrip()
from collections import deque
def main():
X = eval(input())
stack = deque()
for x in X:
if x == "S" or (x == "T" and (not stack or stack[-1] == "T")):
stack.append(x)
elif stack and stack[-1] == "S":
... | false | 22.222222 | [
"-from collections import Counter",
"+from collections import deque",
"- cunt = 0",
"- cunt_s = 0",
"+ stack = deque()",
"- if x == \"S\":",
"- cunt_s += 1",
"- elif cunt_s > 0:",
"- cunt_s -= 1",
"- else:",
"- cunt += 1",
"- pr... | false | 0.042405 | 0.04546 | 0.9328 | [
"s044522743",
"s571613240"
] |
u934442292 | p02744 | python | s015026913 | s726112310 | 92 | 81 | 9,304 | 20,048 | Accepted | Accepted | 11.96 | import sys
from collections import deque
input = sys.stdin.readline
def dfs(N):
alphabet = "abcdefghij"
stack = deque(["a"])
while stack:
s = stack.pop()
if len(s) == N:
print(s)
continue
for suffix in reversed(alphabet[:len(set(s)) + 1]):
... | import sys
from collections import deque
input = sys.stdin.readline
def dfs(N):
alphabet = "abcdefghij"
stack = deque(["a"])
ans = []
while stack:
s = stack.pop()
if len(s) == N:
ans.append(s)
continue
for suffix in reversed(alphabet[:len... | 26 | 29 | 462 | 530 | import sys
from collections import deque
input = sys.stdin.readline
def dfs(N):
alphabet = "abcdefghij"
stack = deque(["a"])
while stack:
s = stack.pop()
if len(s) == N:
print(s)
continue
for suffix in reversed(alphabet[: len(set(s)) + 1]):
stac... | import sys
from collections import deque
input = sys.stdin.readline
def dfs(N):
alphabet = "abcdefghij"
stack = deque(["a"])
ans = []
while stack:
s = stack.pop()
if len(s) == N:
ans.append(s)
continue
for suffix in reversed(alphabet[: len(set(s)) + 1])... | false | 10.344828 | [
"+ ans = []",
"- print(s)",
"+ ans.append(s)",
"+ return ans",
"- dfs(N)",
"+ ans = dfs(N)",
"+ print((\"\\n\".join(ans)))"
] | false | 0.048505 | 0.116234 | 0.41731 | [
"s015026913",
"s726112310"
] |
u706414019 | p02898 | python | s471780143 | s502667168 | 59 | 54 | 18,380 | 18,568 | Accepted | Accepted | 8.47 | import bisect
N,K =list(map(int,input().split()))
H =sorted(list(map(int,input().split())))
i = bisect.bisect(H,K-1)
print((N-i)) | N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
counter = 0
for h in H:
if h >= K:
counter += 1
print(counter)
| 5 | 8 | 131 | 154 | import bisect
N, K = list(map(int, input().split()))
H = sorted(list(map(int, input().split())))
i = bisect.bisect(H, K - 1)
print((N - i))
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
counter = 0
for h in H:
if h >= K:
counter += 1
print(counter)
| false | 37.5 | [
"-import bisect",
"-",
"-H = sorted(list(map(int, input().split())))",
"-i = bisect.bisect(H, K - 1)",
"-print((N - i))",
"+H = list(map(int, input().split()))",
"+counter = 0",
"+for h in H:",
"+ if h >= K:",
"+ counter += 1",
"+print(counter)"
] | false | 0.050242 | 0.047942 | 1.047964 | [
"s471780143",
"s502667168"
] |
u372550522 | p03163 | python | s008400485 | s281069392 | 520 | 249 | 120,172 | 148,056 | Accepted | Accepted | 52.12 | inf = 2**60
'''
def table(size, init): #配列生成
x = len(size)
l = [init for i in range(size[x-1])]
for i in range(x-1):
l = [l for k in range(size[x-2-i])]
return l
'''
n, W = list(map(int, input().split()))
w, v = [[0]*n for i in range(2)]
for i in range(n):
w[i], v[i] = list(map(int, input().... | inf = 2**60
'''
def table(size, init): #配列生成
x = len(size)
l = [init for i in range(size[x-1])]
for i in range(x-1):
l = [l for k in range(size[x-2-i])]
return l
'''
n, W = list(map(int, input().split()))
w, v = [[0]*n for i in range(2)]
for i in range(n):
w[i], v[i] = list(map(int, input().... | 26 | 26 | 599 | 559 | inf = 2**60
"""
def table(size, init): #配列生成
x = len(size)
l = [init for i in range(size[x-1])]
for i in range(x-1):
l = [l for k in range(size[x-2-i])]
return l
"""
n, W = list(map(int, input().split()))
w, v = [[0] * n for i in range(2)]
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
... | inf = 2**60
"""
def table(size, init): #配列生成
x = len(size)
l = [init for i in range(size[x-1])]
for i in range(x-1):
l = [l for k in range(size[x-2-i])]
return l
"""
n, W = list(map(int, input().split()))
w, v = [[0] * n for i in range(2)]
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
... | false | 0 | [
"-dp = [[-1] * (W + 1) for i in range(n + 1)]",
"-dp[0][0] = 0",
"+dp = [[0] * (W + 1) for i in range(n + 1)]",
"- if dp[i][j] != -1:",
"- dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])",
"- if j + w[i] <= W:",
"- dp[i + 1][j + w[i]] = max(dp[i][j] + v[i], dp[i + ... | false | 0.039707 | 0.063369 | 0.626603 | [
"s008400485",
"s281069392"
] |
u814986259 | p03311 | python | s270380646 | s742518098 | 261 | 218 | 26,608 | 26,764 | Accepted | Accepted | 16.48 | import math
N=int(eval(input()))
A=list(map(int,input().split()))
B=[A[i]-(i+1) for i in range(N)]
B.sort()
temp=0
if N%2==0:
ans = B[N//2]
ans2= B[N//2 -1]
temp=0
for j in range(N):
temp+= abs(B[j] - ans)
temp2=0
for j in range(N):
temp2+= abs(B[j] - ans2)
ans= min(temp,temp2)
... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
B = [A[i] - (i+1) for i in range(N)]
B.sort()
ans = 0
t = B[len(B)//2]
for x in B:
ans += abs(x - t)
print(ans)
| 26 | 14 | 425 | 205 | import math
N = int(eval(input()))
A = list(map(int, input().split()))
B = [A[i] - (i + 1) for i in range(N)]
B.sort()
temp = 0
if N % 2 == 0:
ans = B[N // 2]
ans2 = B[N // 2 - 1]
temp = 0
for j in range(N):
temp += abs(B[j] - ans)
temp2 = 0
for j in range(N):
temp2 += abs(B[j] ... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
B = [A[i] - (i + 1) for i in range(N)]
B.sort()
ans = 0
t = B[len(B) // 2]
for x in B:
ans += abs(x - t)
print(ans)
| false | 46.153846 | [
"-import math",
"+import collections",
"-temp = 0",
"-if N % 2 == 0:",
"- ans = B[N // 2]",
"- ans2 = B[N // 2 - 1]",
"- temp = 0",
"- for j in range(N):",
"- temp += abs(B[j] - ans)",
"- temp2 = 0",
"- for j in range(N):",
"- temp2 += abs(B[j] - ans2)",
"- ... | false | 0.048621 | 0.04809 | 1.011041 | [
"s270380646",
"s742518098"
] |
u419686324 | p03829 | python | s516550487 | s481779004 | 88 | 70 | 14,252 | 15,020 | Accepted | Accepted | 20.45 | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
acc = 0
for u, v in zip(x[:-1], x[1:]):
acc += min(a * (v - u), b)
print(acc)
| n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
print((sum([min(a * (v - u), b) for u, v in zip(x[:-1], x[1:])]))) | 8 | 4 | 164 | 140 | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
acc = 0
for u, v in zip(x[:-1], x[1:]):
acc += min(a * (v - u), b)
print(acc)
| n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
print((sum([min(a * (v - u), b) for u, v in zip(x[:-1], x[1:])])))
| false | 50 | [
"-acc = 0",
"-for u, v in zip(x[:-1], x[1:]):",
"- acc += min(a * (v - u), b)",
"-print(acc)",
"+print((sum([min(a * (v - u), b) for u, v in zip(x[:-1], x[1:])])))"
] | false | 0.101438 | 0.035449 | 2.861553 | [
"s516550487",
"s481779004"
] |
u075012704 | p02991 | python | s599128325 | s703515537 | 1,482 | 1,365 | 115,876 | 90,668 | Accepted | Accepted | 7.89 | import heapq
N, M = list(map(int, input().split()))
Edge = [list(map(int, input().split())) for i in range(M)]
S, T = list(map(int, input().split()))
S, T = S - 1, T - 1
G3 = [[] for i in range(3 * N)]
for u, v in Edge:
u, v = u - 1, v - 1
G3[u].append([v + N, 1])
G3[u + N].append([v + N * 2,... | N, M = list(map(int, input().split()))
G = [[] for i in range(3 * N)]
for i in range(M):
u, v = list(map(int, input().split()))
u, v = u - 1, v - 1
G[u].append([v + N, 1])
G[u + N].append([v + 2 * N, 1])
G[u + 2 * N].append([v, 1])
S, T = list(map(int, input().split()))
S, T = S - 1, T - ... | 37 | 39 | 836 | 973 | import heapq
N, M = list(map(int, input().split()))
Edge = [list(map(int, input().split())) for i in range(M)]
S, T = list(map(int, input().split()))
S, T = S - 1, T - 1
G3 = [[] for i in range(3 * N)]
for u, v in Edge:
u, v = u - 1, v - 1
G3[u].append([v + N, 1])
G3[u + N].append([v + N * 2, 1])
G3[u ... | N, M = list(map(int, input().split()))
G = [[] for i in range(3 * N)]
for i in range(M):
u, v = list(map(int, input().split()))
u, v = u - 1, v - 1
G[u].append([v + N, 1])
G[u + N].append([v + 2 * N, 1])
G[u + 2 * N].append([v, 1])
S, T = list(map(int, input().split()))
S, T = S - 1, T - 1
def dij... | false | 5.128205 | [
"-import heapq",
"-",
"-Edge = [list(map(int, input().split())) for i in range(M)]",
"+G = [[] for i in range(3 * N)]",
"+for i in range(M):",
"+ u, v = list(map(int, input().split()))",
"+ u, v = u - 1, v - 1",
"+ G[u].append([v + N, 1])",
"+ G[u + N].append([v + 2 * N, 1])",
"+ G[... | false | 0.044648 | 0.04473 | 0.998174 | [
"s599128325",
"s703515537"
] |
u681444474 | p02898 | python | s014802282 | s219025498 | 209 | 55 | 51,440 | 18,472 | Accepted | Accepted | 73.68 | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
h_=[i for i in h if i >= k]
print((len(h_))) | n, k = list(map(int,input().split()))
H = list(map(int,input().split()))
ans = 0
for h in H:
if h >= k:
ans += 1
print(ans) | 6 | 7 | 117 | 135 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h_ = [i for i in h if i >= k]
print((len(h_)))
| n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = 0
for h in H:
if h >= k:
ans += 1
print(ans)
| false | 14.285714 | [
"-h = list(map(int, input().split()))",
"-h_ = [i for i in h if i >= k]",
"-print((len(h_)))",
"+H = list(map(int, input().split()))",
"+ans = 0",
"+for h in H:",
"+ if h >= k:",
"+ ans += 1",
"+print(ans)"
] | false | 0.031418 | 0.03145 | 0.998987 | [
"s014802282",
"s219025498"
] |
u063596417 | p03636 | python | s726736387 | s573520463 | 61 | 29 | 61,708 | 8,752 | Accepted | Accepted | 52.46 | s = eval(input())
print(f'{s[0]}{len(s) - 2}{s[-1]}') | def main():
s = eval(input())
print(f'{s[0]}{len(s) - 2}{s[-1]}')
if __name__ == '__main__':
main()
| 2 | 7 | 48 | 114 | s = eval(input())
print(f"{s[0]}{len(s) - 2}{s[-1]}")
| def main():
s = eval(input())
print(f"{s[0]}{len(s) - 2}{s[-1]}")
if __name__ == "__main__":
main()
| false | 71.428571 | [
"-s = eval(input())",
"-print(f\"{s[0]}{len(s) - 2}{s[-1]}\")",
"+def main():",
"+ s = eval(input())",
"+ print(f\"{s[0]}{len(s) - 2}{s[-1]}\")",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.047775 | 0.101567 | 0.470382 | [
"s726736387",
"s573520463"
] |
u064408584 | p03786 | python | s775385368 | s761315675 | 147 | 104 | 14,320 | 14,320 | Accepted | Accepted | 29.25 | n=int(eval(input()))
a=list(map(int, input().split()))
a.sort(reverse=True)
b=[0]
for i in a:
b.append(i+b[-1])
ans=1
for i in range(1,n):
if b[i]-b[i-1]<=2*(b[-1]-b[i]):
ans+=1
else:break
print(ans) | n=int(eval(input()))
t=sorted(map(int, input().split()),reverse=True)
sm=sum(t)
ans=0
for i in t:
sm-=i
ans+=1
if i>sm*2:
break
print(ans) | 12 | 10 | 224 | 161 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
b = [0]
for i in a:
b.append(i + b[-1])
ans = 1
for i in range(1, n):
if b[i] - b[i - 1] <= 2 * (b[-1] - b[i]):
ans += 1
else:
break
print(ans)
| n = int(eval(input()))
t = sorted(map(int, input().split()), reverse=True)
sm = sum(t)
ans = 0
for i in t:
sm -= i
ans += 1
if i > sm * 2:
break
print(ans)
| false | 16.666667 | [
"-a = list(map(int, input().split()))",
"-a.sort(reverse=True)",
"-b = [0]",
"-for i in a:",
"- b.append(i + b[-1])",
"-ans = 1",
"-for i in range(1, n):",
"- if b[i] - b[i - 1] <= 2 * (b[-1] - b[i]):",
"- ans += 1",
"- else:",
"+t = sorted(map(int, input().split()), reverse=True... | false | 0.11461 | 0.035936 | 3.189297 | [
"s775385368",
"s761315675"
] |
u254871849 | p03854 | python | s514783184 | s556374486 | 22 | 18 | 3,956 | 3,444 | Accepted | Accepted | 18.18 | s = eval(input())
def reverse(string):
return ''.join(reversed(string))
def split_and_join(string, word):
return ''.join(string.split(word))
s_r = reverse(s)
ls = ["eraser", "erase", "dreamer", "dream"]
ls_r = []
for item in ls:
ls_r.append(reverse(item))
for word_r in ls_r:
s_r = split_and_j... | s = eval(input())
def remove_word_from_string(string, word):
return ''.join(string.split(word))
ls = ["eraser", "erase", "dreamer", "dream"]
for word in ls:
s = remove_word_from_string(s, word)
ans = "YES" if s == '' else "NO"
print(ans) | 20 | 13 | 384 | 254 | s = eval(input())
def reverse(string):
return "".join(reversed(string))
def split_and_join(string, word):
return "".join(string.split(word))
s_r = reverse(s)
ls = ["eraser", "erase", "dreamer", "dream"]
ls_r = []
for item in ls:
ls_r.append(reverse(item))
for word_r in ls_r:
s_r = split_and_join(s... | s = eval(input())
def remove_word_from_string(string, word):
return "".join(string.split(word))
ls = ["eraser", "erase", "dreamer", "dream"]
for word in ls:
s = remove_word_from_string(s, word)
ans = "YES" if s == "" else "NO"
print(ans)
| false | 35 | [
"-def reverse(string):",
"- return \"\".join(reversed(string))",
"-",
"-",
"-def split_and_join(string, word):",
"+def remove_word_from_string(string, word):",
"-s_r = reverse(s)",
"-ls_r = []",
"-for item in ls:",
"- ls_r.append(reverse(item))",
"-for word_r in ls_r:",
"- s_r = split... | false | 0.183416 | 0.178171 | 1.02944 | [
"s514783184",
"s556374486"
] |
u705617253 | p03693 | python | s945363245 | s176970050 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | r, g, b = list(map(int, input().split()))
if (10 * g + b) % 4 == 0:
print("YES")
else:
print("NO")
| r, g, b = list(map(int, input().split()))
print(("YES" if (10 * g + b) % 4 == 0 else "NO"))
| 6 | 3 | 107 | 87 | r, g, b = list(map(int, input().split()))
if (10 * g + b) % 4 == 0:
print("YES")
else:
print("NO")
| r, g, b = list(map(int, input().split()))
print(("YES" if (10 * g + b) % 4 == 0 else "NO"))
| false | 50 | [
"-if (10 * g + b) % 4 == 0:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+print((\"YES\" if (10 * g + b) % 4 == 0 else \"NO\"))"
] | false | 0.092318 | 0.047053 | 1.962007 | [
"s945363245",
"s176970050"
] |
u175034939 | p02574 | python | s510836088 | s114636950 | 365 | 318 | 197,176 | 195,028 | Accepted | Accepted | 12.88 | from functools import reduce
from math import gcd
n = int(eval(input()))
A = list(map(int, input().split()))
def furui(x):
memo = [0]*(x+1)
primes = []
for i in range(2, x+1):
if memo[i]: continue
primes.append(i)
memo[i] = i
for j in range(i*i, x+1, i):
... | from math import gcd
n = int(eval(input()))
maxA = 10**6+5
A = list(map(int, input().split()))
c = [0]*maxA
for a in A:
c[a] += 1
for i in range(2, maxA):
cnt = 0
for j in range(i, maxA, i):
cnt += c[j]
if cnt >= 2:
break
else:
print('pairwise coprime')
exit()... | 41 | 26 | 823 | 430 | from functools import reduce
from math import gcd
n = int(eval(input()))
A = list(map(int, input().split()))
def furui(x):
memo = [0] * (x + 1)
primes = []
for i in range(2, x + 1):
if memo[i]:
continue
primes.append(i)
memo[i] = i
for j in range(i * i, x + 1, ... | from math import gcd
n = int(eval(input()))
maxA = 10**6 + 5
A = list(map(int, input().split()))
c = [0] * maxA
for a in A:
c[a] += 1
for i in range(2, maxA):
cnt = 0
for j in range(i, maxA, i):
cnt += c[j]
if cnt >= 2:
break
else:
print("pairwise coprime")
exit()
g = 0
for a in... | false | 36.585366 | [
"-from functools import reduce",
"+maxA = 10**6 + 5",
"-",
"-",
"-def furui(x):",
"- memo = [0] * (x + 1)",
"- primes = []",
"- for i in range(2, x + 1):",
"- if memo[i]:",
"- continue",
"- primes.append(i)",
"- memo[i] = i",
"- for j in range(... | false | 0.540692 | 1.759034 | 0.30738 | [
"s510836088",
"s114636950"
] |
u179169725 | p03112 | python | s723848416 | s392439046 | 1,770 | 1,603 | 13,924 | 14,056 | Accepted | Accepted | 9.44 | A, B, Q = list(map(int, input().split()))
# もし神社(寺)が1つしかなかった場合に両端に仮想の神社を建築して処理の一貫性を保つ。かりにこれが選ばれても最大のコストなので最終的に最適になることはない。
INF = 10 ** 18
S = [-INF] + [int(eval(input())) for _ in range(A)]+[INF]
T = [-INF] + [int(eval(input())) for _ in range(B)]+[INF]
from bisect import bisect_left as bisect_right
from itert... | from sys import stdin
A, B, Q = list(map(int, input().split()))
# もし神社(寺)が1つしかなかった場合に両端に仮想の神社を建築して処理の一貫性を保つ。かりにこれが選ばれても最大のコストなので最終的に最適になることはない。
INF = 10 ** 18
S = [-INF] + [int(stdin.readline()) for _ in range(A)]+[INF]
T = [-INF] + [int(stdin.readline()) for _ in range(B)]+[INF]
from bisect import bisect_rig... | 38 | 39 | 1,120 | 1,207 | A, B, Q = list(map(int, input().split()))
# もし神社(寺)が1つしかなかった場合に両端に仮想の神社を建築して処理の一貫性を保つ。かりにこれが選ばれても最大のコストなので最終的に最適になることはない。
INF = 10**18
S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
from bisect import bisect_left as bisect_right
from itertools imp... | from sys import stdin
A, B, Q = list(map(int, input().split()))
# もし神社(寺)が1つしかなかった場合に両端に仮想の神社を建築して処理の一貫性を保つ。かりにこれが選ばれても最大のコストなので最終的に最適になることはない。
INF = 10**18
S = [-INF] + [int(stdin.readline()) for _ in range(A)] + [INF]
T = [-INF] + [int(stdin.readline()) for _ in range(B)] + [INF]
from bisect import bisect_right
# f... | false | 2.564103 | [
"+from sys import stdin",
"+",
"-S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]",
"-T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]",
"-from bisect import bisect_left as bisect_right",
"+S = [-INF] + [int(stdin.readline()) for _ in range(A)] + [INF]",
"+T = [-INF] + [int(stdin.r... | false | 0.107817 | 0.045451 | 2.37215 | [
"s723848416",
"s392439046"
] |
u377989038 | p02837 | python | s056545256 | s796391890 | 138 | 83 | 9,224 | 3,064 | Accepted | Accepted | 39.86 | from itertools import product
n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
for j in range(int(eval(input()))):
xy[i].append(list(map(int, input().split())))
ans = 0
for bit in product([0, 1], repeat=n):
f = 0
for i, j in enumerate(bit):
if j == 1:
... | from itertools import product
def solve(bit):
for i, j in enumerate(bit):
if j == 1:
for x, y in xy[i]:
if bit[x - 1] != y:
return 0
return sum(bit)
n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
for j in ran... | 21 | 23 | 490 | 480 | from itertools import product
n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
for j in range(int(eval(input()))):
xy[i].append(list(map(int, input().split())))
ans = 0
for bit in product([0, 1], repeat=n):
f = 0
for i, j in enumerate(bit):
if j == 1:
for x,... | from itertools import product
def solve(bit):
for i, j in enumerate(bit):
if j == 1:
for x, y in xy[i]:
if bit[x - 1] != y:
return 0
return sum(bit)
n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
for j in range(int(eval(input... | false | 8.695652 | [
"+",
"+",
"+def solve(bit):",
"+ for i, j in enumerate(bit):",
"+ if j == 1:",
"+ for x, y in xy[i]:",
"+ if bit[x - 1] != y:",
"+ return 0",
"+ return sum(bit)",
"+",
"- f = 0",
"- for i, j in enumerate(bit):",
"- if j =... | false | 0.038045 | 0.043864 | 0.867345 | [
"s056545256",
"s796391890"
] |
u969850098 | p03208 | python | s968510608 | s542641374 | 138 | 117 | 8,256 | 8,280 | Accepted | Accepted | 15.22 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().rstrip().split()))
heights = sorted([int(input().rstrip()) for _ in range(N)])
ans = float('inf')
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans) | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
heights = sorted([int(eval(input())) for _ in range(N)])
ans = float('inf')
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans) | 9 | 9 | 306 | 288 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().rstrip().split()))
heights = sorted([int(input().rstrip()) for _ in range(N)])
ans = float("inf")
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans)
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
heights = sorted([int(eval(input())) for _ in range(N)])
ans = float("inf")
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans)
| false | 0 | [
"-N, K = list(map(int, input().rstrip().split()))",
"-heights = sorted([int(input().rstrip()) for _ in range(N)])",
"+N, K = list(map(int, input().split()))",
"+heights = sorted([int(eval(input())) for _ in range(N)])"
] | false | 0.040168 | 0.036152 | 1.111074 | [
"s968510608",
"s542641374"
] |
u745223262 | p02899 | python | s027676522 | s646041100 | 282 | 171 | 13,880 | 13,812 | Accepted | Accepted | 39.36 | n = int(input())
a = list(map(int, input().split()))
list = [-1]*n
for i in range(n):
list[a[i] - 1] = i+1
# print(list)
print(list[0], end="")
for i in range(1, n):
print(" ", end="")
print(list[i], end="")
| n = int(input())
a = list(map(int, input().split()))
list = [0] * n
for i in range(n):
list[a[i] - 1] = i + 1
for i in range(n):
print(list[i], end=" ")
| 11 | 9 | 230 | 171 | n = int(input())
a = list(map(int, input().split()))
list = [-1] * n
for i in range(n):
list[a[i] - 1] = i + 1
# print(list)
print(list[0], end="")
for i in range(1, n):
print(" ", end="")
print(list[i], end="")
| n = int(input())
a = list(map(int, input().split()))
list = [0] * n
for i in range(n):
list[a[i] - 1] = i + 1
for i in range(n):
print(list[i], end=" ")
| false | 18.181818 | [
"-list = [-1] * n",
"+list = [0] * n",
"-# print(list)",
"-print(list[0], end=\"\")",
"-for i in range(1, n):",
"- print(\" \", end=\"\")",
"- print(list[i], end=\"\")",
"+for i in range(n):",
"+ print(list[i], end=\" \")"
] | false | 0.035491 | 0.036261 | 0.978774 | [
"s027676522",
"s646041100"
] |
u488401358 | p04017 | python | s073209874 | s096441086 | 1,718 | 810 | 132,212 | 135,600 | Accepted | Accepted | 52.85 | import sys,bisect
input=sys.stdin.readline
N=int(eval(input()))
x=list(map(int,input().split()))
L=int(eval(input()))
doubling=[[-1 for i in range(N)] for j in range(20)]
backdoubling=[[-1 for i in range(N)] for j in range(20)]
for i in range(N):
npos=x[i]+L
index=bisect.bisect_right(x,npos)
... | import sys,bisect
input=sys.stdin.readline
N=int(eval(input()))
x=list(map(int,input().split()))
L=int(eval(input()))
doubling=[[-1 for i in range(N)] for j in range(20)]
for i in range(N):
npos=x[i]+L
index=bisect.bisect_right(x,npos)
doubling[0][i]=index-1
for i in range(1,20):
fo... | 71 | 39 | 1,566 | 833 | import sys, bisect
input = sys.stdin.readline
N = int(eval(input()))
x = list(map(int, input().split()))
L = int(eval(input()))
doubling = [[-1 for i in range(N)] for j in range(20)]
backdoubling = [[-1 for i in range(N)] for j in range(20)]
for i in range(N):
npos = x[i] + L
index = bisect.bisect_right(x, npo... | import sys, bisect
input = sys.stdin.readline
N = int(eval(input()))
x = list(map(int, input().split()))
L = int(eval(input()))
doubling = [[-1 for i in range(N)] for j in range(20)]
for i in range(N):
npos = x[i] + L
index = bisect.bisect_right(x, npos)
doubling[0][i] = index - 1
for i in range(1, 20):
... | false | 45.070423 | [
"-backdoubling = [[-1 for i in range(N)] for j in range(20)]",
"+forward = [[-1 for i in range(N)] for j in range(20)]",
"- npos = x[i] - L",
"- index = bisect.bisect_left(x, npos)",
"- backdoubling[0][i] = index",
"+ forward[0][i] = i",
"- backdoubling[i][j] = backdoubling[i - 1][bac... | false | 0.048483 | 0.048455 | 1.000591 | [
"s073209874",
"s096441086"
] |
u855831834 | p03557 | python | s185722228 | s403781570 | 338 | 233 | 23,360 | 105,308 | Accepted | Accepted | 31.07 | import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
#print(A)
#print(B)
#print(C)
ans = 0
for b in B:
a = bisect.bisect_right(A, b-1)
c = N - bisect.bisect_right(C, b)
... | import bisect
n = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
C.sort()
ans = 0
for b in B:
a = bisect.bisect_right(A, b-1)
c = len(C)-bisect.bisect_right(C, b)
ans += a*c
print(ans) | 23 | 16 | 374 | 294 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)
ans = 0
for b in B:
a = bisect.bisect_right(A, b - 1)
c = N - bisect.bisect_right(C, b)
# print("small... | import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
for b in B:
a = bisect.bisect_right(A, b - 1)
c = len(C) - bisect.bisect_right(C, b)
ans += a * c
print(ans)
| false | 30.434783 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-B.sort()",
"-# print(A)",
"-# print(B)",
"-# print(C)",
"- c = N - bisect.bisect_right(C, b)",
"- # print(\"smaller\",a,\"bigger\",c)",
"+ c = len(C) - bisect.bisect_right(C, b)"
] | false | 0.039123 | 0.040051 | 0.97684 | [
"s185722228",
"s403781570"
] |
u556849401 | p02912 | python | s356765412 | s889230012 | 1,327 | 262 | 15,432 | 14,224 | Accepted | Accepted | 80.26 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 2 07:56:16 2019
@author: avina
"""
from queue import PriorityQueue as Q
n,t = list(map(int,input().split()))
q = Q()
for i in input().split():
a = -1*int(i)
q.put(a)
while t >0:
a = -1*(q.get())
a = -1*(a//2)
q.put(a)
t-=1
a... | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 3 07:43:37 2019
@author: avina
"""
import heapq
class Maxheap():
def __init__(self, x):
self.heap = [-e for e in x]
heapq.heapify(self.heap)
def push(self, value):
heapq.heappush(self.heap, -value)
de... | 24 | 33 | 375 | 589 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 2 07:56:16 2019
@author: avina
"""
from queue import PriorityQueue as Q
n, t = list(map(int, input().split()))
q = Q()
for i in input().split():
a = -1 * int(i)
q.put(a)
while t > 0:
a = -1 * (q.get())
a = -1 * (a // 2)
q.put(a)
t -= 1
ans = 0
whi... | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 3 07:43:37 2019
@author: avina
"""
import heapq
class Maxheap:
def __init__(self, x):
self.heap = [-e for e in x]
heapq.heapify(self.heap)
def push(self, value):
heapq.heappush(self.heap, -value)
def pop(self):
return -heapq... | false | 27.272727 | [
"-Created on Wed Oct 2 07:56:16 2019",
"+Created on Thu Oct 3 07:43:37 2019",
"-from queue import PriorityQueue as Q",
"+import heapq",
"+",
"+",
"+class Maxheap:",
"+ def __init__(self, x):",
"+ self.heap = [-e for e in x]",
"+ heapq.heapify(self.heap)",
"+",
"+ def push... | false | 0.109877 | 0.055569 | 1.977294 | [
"s356765412",
"s889230012"
] |
u550061714 | p03165 | python | s834179053 | s310544134 | 575 | 420 | 120,540 | 91,596 | Accepted | Accepted | 26.96 | s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0 for _ in range(lt + 1)] for __ in range(ls + 1)]
for ns in range(ls):
for nt in range(lt):
if s[ns] == t[nt]:
dp[ns + 1][nt + 1] = max(dp[ns][nt] + 1, dp[ns + 1][nt + 1])
dp[ns + 1][nt + 1] = max(dp[ns + ... | import numpy as np
s = np.array(list(eval(input())))
t = np.array(list(eval(input())))
equal = (s[:, None] == t[None, :])
ls, lt = len(s), len(t)
dp = np.zeros((ls + 1, lt + 1), dtype=int)
for i in range(ls):
dp[i + 1][1:] = np.maximum(dp[i][1:], dp[i][:-1] + equal[i])
dp[i + 1] = np.maximum.accum... | 26 | 25 | 590 | 563 | s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0 for _ in range(lt + 1)] for __ in range(ls + 1)]
for ns in range(ls):
for nt in range(lt):
if s[ns] == t[nt]:
dp[ns + 1][nt + 1] = max(dp[ns][nt] + 1, dp[ns + 1][nt + 1])
dp[ns + 1][nt + 1] = max(dp[ns + 1][nt + 1], dp[... | import numpy as np
s = np.array(list(eval(input())))
t = np.array(list(eval(input())))
equal = s[:, None] == t[None, :]
ls, lt = len(s), len(t)
dp = np.zeros((ls + 1, lt + 1), dtype=int)
for i in range(ls):
dp[i + 1][1:] = np.maximum(dp[i][1:], dp[i][:-1] + equal[i])
dp[i + 1] = np.maximum.accumulate(dp[i + 1]... | false | 3.846154 | [
"-s = eval(input())",
"-t = eval(input())",
"-ls = len(s)",
"-lt = len(t)",
"-dp = [[0 for _ in range(lt + 1)] for __ in range(ls + 1)]",
"-for ns in range(ls):",
"- for nt in range(lt):",
"- if s[ns] == t[nt]:",
"- dp[ns + 1][nt + 1] = max(dp[ns][nt] + 1, dp[ns + 1][nt + 1])",
... | false | 0.060906 | 0.198897 | 0.30622 | [
"s834179053",
"s310544134"
] |
u397496203 | p03001 | python | s487504198 | s780930630 | 71 | 65 | 61,860 | 61,908 | Accepted | Accepted | 8.45 | #
import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(eval(input()))
def input_int_list():
return [int(i) for i in input().split()]
def main():
w, h, x, y = input_int_list()
area = (w * h) / 2
bl = ... | w, h, x, y = [int(i) for i in input().split()]
pat = 0
if x == w / 2 and y == h / 2:
pat = 1
print(((w * h) / 2, pat))
| 28 | 7 | 431 | 129 | #
import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(eval(input()))
def input_int_list():
return [int(i) for i in input().split()]
def main():
w, h, x, y = input_int_list()
area = (w * h) / 2
bl = w == 2 * x and h == 2 *... | w, h, x, y = [int(i) for i in input().split()]
pat = 0
if x == w / 2 and y == h / 2:
pat = 1
print(((w * h) / 2, pat))
| false | 75 | [
"-#",
"-import sys",
"-",
"-# sys.setrecursionlimit(100000)",
"-def input():",
"- return sys.stdin.readline().strip()",
"-",
"-",
"-def input_int():",
"- return int(eval(input()))",
"-",
"-",
"-def input_int_list():",
"- return [int(i) for i in input().split()]",
"-",
"-",
"... | false | 0.050507 | 0.114776 | 0.440044 | [
"s487504198",
"s780930630"
] |
u254871849 | p03425 | python | s408924310 | s952250186 | 53 | 45 | 3,064 | 11,596 | Accepted | Accepted | 15.09 | # author: kagemeka
# created: 2019-11-06 16:52:04(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
import itertools
# import statistics
# import functools
# import operator
# def nCr(n, r):
# r = min(r, n ... | import sys
from collections import Counter
from itertools import combinations
MARCH = set('MARCH')
n = int(sys.stdin.readline().rstrip())
s = [x[0] for x in sys.stdin.read().split() if x[0] in MARCH]
def main():
c = Counter(s)
ways = 0
for comb in combinations('MARCH', 3):
res = 1
... | 42 | 23 | 1,013 | 481 | # author: kagemeka
# created: 2019-11-06 16:52:04(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
import itertools
# import statistics
# import functools
# import operator
# def nCr(n, r):
# r = min(r, n - r)
# ret... | import sys
from collections import Counter
from itertools import combinations
MARCH = set("MARCH")
n = int(sys.stdin.readline().rstrip())
s = [x[0] for x in sys.stdin.read().split() if x[0] in MARCH]
def main():
c = Counter(s)
ways = 0
for comb in combinations("MARCH", 3):
res = 1
for i i... | false | 45.238095 | [
"-# author: kagemeka",
"-# created: 2019-11-06 16:52:04(JST)",
"+from collections import Counter",
"+from itertools import combinations",
"-# import collections",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-import ite... | false | 0.036039 | 0.03563 | 1.011479 | [
"s408924310",
"s952250186"
] |
u896791216 | p03294 | python | s276780582 | s206075180 | 145 | 30 | 9,412 | 9,324 | Accepted | Accepted | 79.31 | import math
n = int(eval(input()))
a = list(map(int, input().split()))
common_num = 1
for num in a:
common_num = (common_num * num) // math.gcd(common_num, num)
total = 0
for num in a:
total += (common_num - 1) % num
print(total)
| # 合計が最大になるのは、余りが各aにおいてa-1となるとき。
n = int(eval(input()))
a = list(map(int, input().split()))
# 各aから1ずつ引くをn繰り返しているため。
ans = sum(a) - n
print(ans) | 11 | 6 | 243 | 141 | import math
n = int(eval(input()))
a = list(map(int, input().split()))
common_num = 1
for num in a:
common_num = (common_num * num) // math.gcd(common_num, num)
total = 0
for num in a:
total += (common_num - 1) % num
print(total)
| # 合計が最大になるのは、余りが各aにおいてa-1となるとき。
n = int(eval(input()))
a = list(map(int, input().split()))
# 各aから1ずつ引くをn繰り返しているため。
ans = sum(a) - n
print(ans)
| false | 45.454545 | [
"-import math",
"-",
"+# 合計が最大になるのは、余りが各aにおいてa-1となるとき。",
"-common_num = 1",
"-for num in a:",
"- common_num = (common_num * num) // math.gcd(common_num, num)",
"-total = 0",
"-for num in a:",
"- total += (common_num - 1) % num",
"-print(total)",
"+# 各aから1ずつ引くをn繰り返しているため。",
"+ans = sum(a)... | false | 0.034918 | 0.034993 | 0.997862 | [
"s276780582",
"s206075180"
] |
u924691798 | p02678 | python | s114800271 | s904601021 | 819 | 658 | 39,936 | 38,536 | Accepted | Accepted | 19.66 | from collections import deque
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = deque()
done = [-1]*N
def bfs(fr, now):
done[now] = fr
for to in G[now]:
... | from collections import deque
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = deque()
done = [-1]*N
done[0] = 1
q.appendleft(0)
while q:
now = q.pop()
for to in G[... | 25 | 22 | 530 | 457 | from collections import deque
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = deque()
done = [-1] * N
def bfs(fr, now):
done[now] = fr
for to in G[now]:
if d... | from collections import deque
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
q = deque()
done = [-1] * N
done[0] = 1
q.appendleft(0)
while q:
now = q.pop()
for to in G[now]:
... | false | 12 | [
"-N, M = list(map(int, input().split()))",
"+N, M = map(int, input().split())",
"- a, b = list(map(int, input().split()))",
"+ a, b = map(int, input().split())",
"-",
"-",
"-def bfs(fr, now):",
"- done[now] = fr",
"+done[0] = 1",
"+q.appendleft(0)",
"+while q:",
"+ now = q.pop()",
... | false | 0.038886 | 0.133349 | 0.291608 | [
"s114800271",
"s904601021"
] |
u512212329 | p02850 | python | s776934089 | s475042670 | 1,199 | 1,103 | 95,120 | 95,072 | Accepted | Accepted | 8.01 | from collections import OrderedDict, deque
n = int(eval(input()))
edges = [tuple(map(int, input().split())) for _ in range(n - 1)]
tree = [[] for _ in range(n)] # こうしないとすべて同じリストObjになる.
coloring = OrderedDict()
for e in edges:
a, b = e[0] - 1, e[1] - 1
tree[a].append(b)
tree[b].append(a)
colo... | from collections import OrderedDict, deque
def main():
n = int(eval(input()))
edges = [tuple(map(int, input().split())) for _ in range(n - 1)]
tree = [[] for _ in range(n)] # こうしないとすべて同じリストObjになる.
coloring = OrderedDict()
for e in edges:
a, b = e[0] - 1, e[1] - 1
tree[a]... | 36 | 43 | 971 | 1,178 | from collections import OrderedDict, deque
n = int(eval(input()))
edges = [tuple(map(int, input().split())) for _ in range(n - 1)]
tree = [[] for _ in range(n)] # こうしないとすべて同じリストObjになる.
coloring = OrderedDict()
for e in edges:
a, b = e[0] - 1, e[1] - 1
tree[a].append(b)
tree[b].append(a)
coloring[(a, b... | from collections import OrderedDict, deque
def main():
n = int(eval(input()))
edges = [tuple(map(int, input().split())) for _ in range(n - 1)]
tree = [[] for _ in range(n)] # こうしないとすべて同じリストObjになる.
coloring = OrderedDict()
for e in edges:
a, b = e[0] - 1, e[1] - 1
tree[a].append(b)... | false | 16.27907 | [
"-n = int(eval(input()))",
"-edges = [tuple(map(int, input().split())) for _ in range(n - 1)]",
"-tree = [[] for _ in range(n)] # こうしないとすべて同じリストObjになる.",
"-coloring = OrderedDict()",
"-for e in edges:",
"- a, b = e[0] - 1, e[1] - 1",
"- tree[a].append(b)",
"- tree[b].append(a)",
"- colo... | false | 0.039924 | 0.04341 | 0.919716 | [
"s776934089",
"s475042670"
] |
u588341295 | p02833 | python | s893195338 | s921301894 | 19 | 17 | 3,192 | 3,064 | Accepted | Accepted | 10.53 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 45 | 35 | 1,100 | 894 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 22.222222 | [
"-",
"-",
"-def f(n):",
"- if n <= 1:",
"- return 1",
"- else:",
"- return n * f(n - 2)",
"-",
"-",
"-# for i in range(100):",
"-# for i in [90, 100, 140, 150, 160, 200, 1240, 1250, 1250, 1260]:",
"-# print(i, f(i))",
"-i = 0",
"-while 5**i <= 10**18:",
"- A.ap... | false | 0.043438 | 0.043596 | 0.996374 | [
"s893195338",
"s921301894"
] |
u606523772 | p03146 | python | s505092450 | s307894571 | 22 | 19 | 2,940 | 3,064 | Accepted | Accepted | 13.64 | def func1(N):
if N%2==0:
return N//2
else:
return 3*N+1
s = int(eval(input()))
a_n = {}
for i in range(1, 1000001):
if s in a_n:
break
else:
a_n[s] = 1
s = func1(s)
print(i) | s = int(eval(input()))
a_list = [s]
i = 0
ans = -1
while (ans==-1):
if a_list[i]%2==0:
a_list.append(a_list[i]//2)
else:
a_list.append(3*a_list[i]+1)
i += 1
for j in range(len(a_list)-1):
if a_list[i]==a_list[j]:
ans = i
break
print((ans+1)) | 14 | 15 | 232 | 311 | def func1(N):
if N % 2 == 0:
return N // 2
else:
return 3 * N + 1
s = int(eval(input()))
a_n = {}
for i in range(1, 1000001):
if s in a_n:
break
else:
a_n[s] = 1
s = func1(s)
print(i)
| s = int(eval(input()))
a_list = [s]
i = 0
ans = -1
while ans == -1:
if a_list[i] % 2 == 0:
a_list.append(a_list[i] // 2)
else:
a_list.append(3 * a_list[i] + 1)
i += 1
for j in range(len(a_list) - 1):
if a_list[i] == a_list[j]:
ans = i
break
print((ans + 1)... | false | 6.666667 | [
"-def func1(N):",
"- if N % 2 == 0:",
"- return N // 2",
"+s = int(eval(input()))",
"+a_list = [s]",
"+i = 0",
"+ans = -1",
"+while ans == -1:",
"+ if a_list[i] % 2 == 0:",
"+ a_list.append(a_list[i] // 2)",
"- return 3 * N + 1",
"-",
"-",
"-s = int(eval(input())... | false | 0.038245 | 0.108036 | 0.354006 | [
"s505092450",
"s307894571"
] |
u808373096 | p03624 | python | s663514691 | s294698508 | 60 | 18 | 4,280 | 3,188 | Accepted | Accepted | 70 | s = sorted(eval(input()))
for i in range(26):
if chr(i + 97) not in s:
print((chr(i + 97)))
exit()
print(None)
| s = eval(input())
for i in range(26):
if chr(i + 97) not in s:
print((chr(i + 97)))
quit()
print(None)
| 7 | 7 | 130 | 122 | s = sorted(eval(input()))
for i in range(26):
if chr(i + 97) not in s:
print((chr(i + 97)))
exit()
print(None)
| s = eval(input())
for i in range(26):
if chr(i + 97) not in s:
print((chr(i + 97)))
quit()
print(None)
| false | 0 | [
"-s = sorted(eval(input()))",
"+s = eval(input())",
"- exit()",
"+ quit()"
] | false | 0.039468 | 0.041434 | 0.95255 | [
"s663514691",
"s294698508"
] |
u170201762 | p04014 | python | s819891665 | s221242912 | 995 | 231 | 67,668 | 43,120 | Accepted | Accepted | 76.78 | from math import floor,ceil
def f(b,n):
if n < b:
return n
else:
return f(b,floor(n/b))+n%b
n = int(eval(input()))
s = int(eval(input()))
for b in range(2,320000):
if f(b,n)==s:
print(b)
exit()
if n==s:
print((s+1))
exit()
d = {}
for i in range(1... | def f(b,n):
if n < b:
return n
else:
return f(b,n//b)+n%b
def get_divisor(n):
res = []
for i in range(1,int(n**0.5)+1):
if n%i==0:
res.append(i)
res.append(n//i)
res = list(set(res))
res.sort()
return res
n = int(eval(input())... | 34 | 35 | 595 | 613 | from math import floor, ceil
def f(b, n):
if n < b:
return n
else:
return f(b, floor(n / b)) + n % b
n = int(eval(input()))
s = int(eval(input()))
for b in range(2, 320000):
if f(b, n) == s:
print(b)
exit()
if n == s:
print((s + 1))
exit()
d = {}
for i in range(1,... | def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + n % b
def get_divisor(n):
res = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
res.append(i)
res.append(n // i)
res = list(set(res))
res.sort()
return res
n = int(eval(input... | false | 2.857143 | [
"-from math import floor, ceil",
"-",
"-",
"- return f(b, floor(n / b)) + n % b",
"+ return f(b, n // b) + n % b",
"+",
"+",
"+def get_divisor(n):",
"+ res = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ res.append(i)",
"+ ... | false | 0.200616 | 0.071148 | 2.819708 | [
"s819891665",
"s221242912"
] |
u423585790 | p02667 | python | s378382989 | s764200779 | 72 | 61 | 84,872 | 68,280 | Accepted | Accepted | 15.28 | t=eval(input())
n=len(t)
pos=[]
sum=0
for i in range(n):
if t[i]=="1":
sum+=1
else:
pos.append(sum)
x=(sum+1)//2*((sum+2)//2)
sz=len(pos)
cnt=0
res=[]
for i in range(sz):
if ((pos[i]&1)^(cnt&1)):
sum+=1
cnt+=1
x+=(sum+1)//2
else:
res.append(i)
res=res[::-1]
odd=0
ev... | T=eval(input())
n=len(T)
i=r=a=0
for c in T:
k=i-r
if c=='0':
r+=~k&1
else:
a+=i//2-k//2+(~k&1)*(n-i)
i+=1
print(a)
| 32 | 11 | 486 | 136 | t = eval(input())
n = len(t)
pos = []
sum = 0
for i in range(n):
if t[i] == "1":
sum += 1
else:
pos.append(sum)
x = (sum + 1) // 2 * ((sum + 2) // 2)
sz = len(pos)
cnt = 0
res = []
for i in range(sz):
if (pos[i] & 1) ^ (cnt & 1):
sum += 1
cnt += 1
x += (sum + 1) // 2
... | T = eval(input())
n = len(T)
i = r = a = 0
for c in T:
k = i - r
if c == "0":
r += ~k & 1
else:
a += i // 2 - k // 2 + (~k & 1) * (n - i)
i += 1
print(a)
| false | 65.625 | [
"-t = eval(input())",
"-n = len(t)",
"-pos = []",
"-sum = 0",
"-for i in range(n):",
"- if t[i] == \"1\":",
"- sum += 1",
"+T = eval(input())",
"+n = len(T)",
"+i = r = a = 0",
"+for c in T:",
"+ k = i - r",
"+ if c == \"0\":",
"+ r += ~k & 1",
"- pos.append... | false | 0.03713 | 0.056457 | 0.657669 | [
"s378382989",
"s764200779"
] |
u037830865 | p02861 | python | s997306375 | s229853227 | 429 | 18 | 7,972 | 2,940 | Accepted | Accepted | 95.8 | import itertools
import math
N = int(eval(input()))
city_list = []
for i in range(N):
x, y = [int(z) for z in input().split()]
city_list.append((x, y))
root_list = list(itertools.permutations(city_list, N))
ave = 0
for root in root_list:
length = 0
while len(root) > 1:
x1, y1, x2, y2... | import math
N = int(eval(input()))
city_list = [list(map(int, input().split())) for _ in range(N)]
average = 0
for x1, y1 in city_list:
for x2, y2 in city_list:
average += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print((average / N))
| 17 | 8 | 506 | 247 | import itertools
import math
N = int(eval(input()))
city_list = []
for i in range(N):
x, y = [int(z) for z in input().split()]
city_list.append((x, y))
root_list = list(itertools.permutations(city_list, N))
ave = 0
for root in root_list:
length = 0
while len(root) > 1:
x1, y1, x2, y2 = root[0][... | import math
N = int(eval(input()))
city_list = [list(map(int, input().split())) for _ in range(N)]
average = 0
for x1, y1 in city_list:
for x2, y2 in city_list:
average += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print((average / N))
| false | 52.941176 | [
"-import itertools",
"-city_list = []",
"-for i in range(N):",
"- x, y = [int(z) for z in input().split()]",
"- city_list.append((x, y))",
"-root_list = list(itertools.permutations(city_list, N))",
"-ave = 0",
"-for root in root_list:",
"- length = 0",
"- while len(root) > 1:",
"- ... | false | 0.051026 | 0.039773 | 1.282921 | [
"s997306375",
"s229853227"
] |
u157232135 | p02623 | python | s153842248 | s974874113 | 274 | 232 | 48,768 | 45,696 | Accepted | Accepted | 15.33 | import itertools as it
def main():
n,m,k=list(map(int,input().split()))
Aa = list(map(int,input().split()))
Bb = list(map(int, input().split()))
a, b = [0],[0]
for i in range(n):
a.append(a[i] + Aa[i])
for i in range(m):
b.append(b[i] + Bb[i])
M = m
ans = 0
... | import itertools as it
def main():
n,m,k=list(map(int,input().split()))
a = [0]
a.extend(it.accumulate(list(map(int, input().split()))))
b = [0]
b.extend(it.accumulate(list(map(int, input().split()))))
ans = 0
M = m
for A in range(n+1):
aa = a[A]
Kaa = k-... | 26 | 24 | 619 | 548 | import itertools as it
def main():
n, m, k = list(map(int, input().split()))
Aa = list(map(int, input().split()))
Bb = list(map(int, input().split()))
a, b = [0], [0]
for i in range(n):
a.append(a[i] + Aa[i])
for i in range(m):
b.append(b[i] + Bb[i])
M = m
ans = 0
f... | import itertools as it
def main():
n, m, k = list(map(int, input().split()))
a = [0]
a.extend(it.accumulate(list(map(int, input().split()))))
b = [0]
b.extend(it.accumulate(list(map(int, input().split()))))
ans = 0
M = m
for A in range(n + 1):
aa = a[A]
Kaa = k - aa
... | false | 7.692308 | [
"- Aa = list(map(int, input().split()))",
"- Bb = list(map(int, input().split()))",
"- a, b = [0], [0]",
"- for i in range(n):",
"- a.append(a[i] + Aa[i])",
"- for i in range(m):",
"- b.append(b[i] + Bb[i])",
"+ a = [0]",
"+ a.extend(it.accumulate(list(map(int, inp... | false | 0.034061 | 0.046227 | 0.736819 | [
"s153842248",
"s974874113"
] |
u475503988 | p03212 | python | s816882717 | s549484545 | 84 | 42 | 3,064 | 3,064 | Accepted | Accepted | 50 | def nextn(n):
if n == 0:
return 3
elif n % 10 == 3:
return n+2
elif n % 10== 5:
return n+2
elif n % 10 ==7:
return nextn(n//10)*10 + 3
N = int(eval(input()))
n = 357
ans = 0
while n <= N:
s = str(n)
a = [False,False,False]
for c in s:
... | def nexti(i):
if i == 0:
return 3
elif i % 10 == 3:
return i + 2
elif i % 10== 5:
return i + 2
elif i % 10 ==7:
return nexti(i//10)*10 + 3
n = int(eval(input()))
nn = 0
i = 357
while i <= n:
s = str(i)
if '3' in s:
if '5' in s:
if '7' in ... | 29 | 26 | 553 | 420 | def nextn(n):
if n == 0:
return 3
elif n % 10 == 3:
return n + 2
elif n % 10 == 5:
return n + 2
elif n % 10 == 7:
return nextn(n // 10) * 10 + 3
N = int(eval(input()))
n = 357
ans = 0
while n <= N:
s = str(n)
a = [False, False, False]
for c in s:
if ... | def nexti(i):
if i == 0:
return 3
elif i % 10 == 3:
return i + 2
elif i % 10 == 5:
return i + 2
elif i % 10 == 7:
return nexti(i // 10) * 10 + 3
n = int(eval(input()))
nn = 0
i = 357
while i <= n:
s = str(i)
if "3" in s:
if "5" in s:
if "7" i... | false | 10.344828 | [
"-def nextn(n):",
"- if n == 0:",
"+def nexti(i):",
"+ if i == 0:",
"- elif n % 10 == 3:",
"- return n + 2",
"- elif n % 10 == 5:",
"- return n + 2",
"- elif n % 10 == 7:",
"- return nextn(n // 10) * 10 + 3",
"+ elif i % 10 == 3:",
"+ return i + 2"... | false | 0.08735 | 0.069406 | 1.258526 | [
"s816882717",
"s549484545"
] |
u037430802 | p03426 | python | s145006768 | s111967774 | 966 | 554 | 22,560 | 35,984 | Accepted | Accepted | 42.65 |
H, W, D = list(map(int, input().split()))
field = {}
for i in range(H):
A = list(map(int, input().split()))
for j in range(W):
field[A[j]] = (i,j)
Q = int(eval(input()))
cum = [0] * (H*W+1)
for i in range(D+1, H*W+1):
cum[i] = cum[i-D] + abs(field[i][0] - field[i-D][0]) + abs(fiel... |
H, W, D = list(map(int, input().split()))
field = {}
for i in range(H):
A = list(map(int, input().split()))
for j in range(W):
field[A[j]] = (i,j)
Q = int(eval(input()))
cum = [0] * (H*W+1)
for i in range(D+1, H*W+1):
cum[i] = cum[i-D] + abs(field[i][0] - field[i-D][0]) + abs(fiel... | 32 | 35 | 776 | 816 | H, W, D = list(map(int, input().split()))
field = {}
for i in range(H):
A = list(map(int, input().split()))
for j in range(W):
field[A[j]] = (i, j)
Q = int(eval(input()))
cum = [0] * (H * W + 1)
for i in range(D + 1, H * W + 1):
cum[i] = (
cum[i - D]
+ abs(field[i][0] - field[i - D][... | H, W, D = list(map(int, input().split()))
field = {}
for i in range(H):
A = list(map(int, input().split()))
for j in range(W):
field[A[j]] = (i, j)
Q = int(eval(input()))
cum = [0] * (H * W + 1)
for i in range(D + 1, H * W + 1):
cum[i] = (
cum[i - D]
+ abs(field[i][0] - field[i - D][... | false | 8.571429 | [
"+LR = [None] * Q",
"- print((cum[R] - cum[L]))",
"-# print(field)",
"+ LR[i] = (L, R)",
"+for l, r in LR:",
"+ print((cum[r] - cum[l]))"
] | false | 0.037162 | 0.007795 | 4.767442 | [
"s145006768",
"s111967774"
] |
u411203878 | p03575 | python | s776776940 | s978004438 | 403 | 116 | 86,740 | 76,052 | Accepted | Accepted | 71.22 | import copy
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
class UnionFindPathCompression():
def __init__(self, n:int):
self.parents = list(range(n))
self.rank = [1]*n
self.size = [1]*n
def find(self, x:int) -> int:
if self.... | import copy
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
class UnionFindPathCompression():
def __init__(self, n:int):
self.parents = list(range(n))
self.rank = [1]*n
self.size = [1]*n
def find(self, x:int) -> int:
if self.... | 54 | 55 | 1,399 | 1,406 | import copy
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
class UnionFindPathCompression:
def __init__(self, n: int):
self.parents = list(range(n))
self.rank = [1] * n
self.size = [1] * n
def find(self, x: int) -> int:
if self.parents[x] == x:
... | import copy
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
class UnionFindPathCompression:
def __init__(self, n: int):
self.parents = list(range(n))
self.rank = [1] * n
self.size = [1] * n
def find(self, x: int) -> int:
if self.parents[x] == x:
... | false | 1.818182 | [
"-memo = 0",
"+ans = 0",
"- if len(check) == 1:",
"- memo += 1",
"-print((m - memo))",
"+ if len(check) != 1:",
"+ ans += 1",
"+print(ans)"
] | false | 0.046807 | 0.049102 | 0.953256 | [
"s776776940",
"s978004438"
] |
u260216890 | p03061 | python | s556184124 | s595868869 | 394 | 126 | 98,280 | 103,168 | Accepted | Accepted | 68.02 | n=int(eval(input()))
a=list(map(int,input().split()))
from fractions import gcd
L=[0]
R=[]
l=a[0]
r=a[-1]
for i in range(n-1):
l=gcd(a[i], l)
L.append(l)
r=gcd(a[-i-1], r)
R.append(r)
R=R[::-1]
R.append(0)
M=[]
#print(L,R)
for i in range(n):
m=gcd(L[i],R[i])
M.append(m)
print(... | n=int(eval(input()))
*a,=list(map(int,input().split()))
a=sorted(a)
from math import gcd
for i in range(n):
if i==0:
tmp=a[i]
else:
tmp=gcd(tmp, a[i])
b=[x//tmp for x in a]
for i in range(n):
if i==0:
tmp=b[i]
else:
tmp=gcd(tmp, b[i])
if tmp==... | 20 | 68 | 321 | 1,098 | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
L = [0]
R = []
l = a[0]
r = a[-1]
for i in range(n - 1):
l = gcd(a[i], l)
L.append(l)
r = gcd(a[-i - 1], r)
R.append(r)
R = R[::-1]
R.append(0)
M = []
# print(L,R)
for i in range(n):
m = gcd(L[i], R[i])
M.appen... | n = int(eval(input()))
(*a,) = list(map(int, input().split()))
a = sorted(a)
from math import gcd
for i in range(n):
if i == 0:
tmp = a[i]
else:
tmp = gcd(tmp, a[i])
b = [x // tmp for x in a]
for i in range(n):
if i == 0:
tmp = b[i]
else:
tmp = gcd(tmp, b[i])
if ... | false | 70.588235 | [
"-a = list(map(int, input().split()))",
"-from fractions import gcd",
"+(*a,) = list(map(int, input().split()))",
"+a = sorted(a)",
"+from math import gcd",
"-L = [0]",
"-R = []",
"-l = a[0]",
"-r = a[-1]",
"-for i in range(n - 1):",
"- l = gcd(a[i], l)",
"- L.append(l)",
"- r = gcd... | false | 0.052755 | 0.113999 | 0.462768 | [
"s556184124",
"s595868869"
] |
u753803401 | p03078 | python | s392196089 | s362357786 | 1,565 | 451 | 5,228 | 62,572 | Accepted | Accepted | 71.18 | import heapq
x, y, z , k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
qh = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
h... | def slove():
import sys
import heapq
import collections
input = sys.stdin.readline
x, y, z, k = list(map(int, input().rstrip('\n').split()))
a = list(map(int, input().rstrip('\n').split()))
a.sort(reverse=True)
b = list(map(int, input().rstrip('\n').split()))
b.sort(reverse=... | 27 | 41 | 1,267 | 1,596 | import heapq
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
qh = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
heapq.he... | def slove():
import sys
import heapq
import collections
input = sys.stdin.readline
x, y, z, k = list(map(int, input().rstrip("\n").split()))
a = list(map(int, input().rstrip("\n").split()))
a.sort(reverse=True)
b = list(map(int, input().rstrip("\n").split()))
b.sort(reverse=True)
... | false | 34.146341 | [
"-import heapq",
"+def slove():",
"+ import sys",
"+ import heapq",
"+ import collections",
"-x, y, z, k = list(map(int, input().split()))",
"-a = sorted(list(map(int, input().split())), reverse=True)",
"-b = sorted(list(map(int, input().split())), reverse=True)",
"-c = sorted(list(map(int,... | false | 0.045842 | 0.116289 | 0.39421 | [
"s392196089",
"s362357786"
] |
u017810624 | p03212 | python | s092168722 | s872955515 | 1,164 | 300 | 3,064 | 3,064 | Accepted | Accepted | 74.23 | n=int(eval(input()))
c=0
l=[3,5,7]
L=[]
for i1 in l:
for i2 in l:
for i3 in l:
for i4 in l:
for i5 in l:
L.append(10000*i1+1000*i2+100*i3+10*i4+i5)
for i in range(min(n+1,10000)):
l=str(i)
if '3' in l and '5' in l and '7' in l and '0' not in l and '1' not in l and '2' not i... | n=int(eval(input()))
c=0
l=[0,3,5,7]
for i1 in l:
for i2 in l:
for i3 in l:
for i4 in l:
for i5 in l:
for i6 in l:
for i7 in l:
for i8 in l:
for i9 in l:
x=str(i1+10*i2+100*i3+1000*i4+10000*i5+100000*i6+1000000*i7+10000000*i8+100000000*i9)
if '3' in x a... | 18 | 15 | 627 | 384 | n = int(eval(input()))
c = 0
l = [3, 5, 7]
L = []
for i1 in l:
for i2 in l:
for i3 in l:
for i4 in l:
for i5 in l:
L.append(10000 * i1 + 1000 * i2 + 100 * i3 + 10 * i4 + i5)
for i in range(min(n + 1, 10000)):
l = str(i)
if (
"3" in l
an... | n = int(eval(input()))
c = 0
l = [0, 3, 5, 7]
for i1 in l:
for i2 in l:
for i3 in l:
for i4 in l:
for i5 in l:
for i6 in l:
for i7 in l:
for i8 in l:
for i9 in l:
... | false | 16.666667 | [
"-l = [3, 5, 7]",
"-L = []",
"+l = [0, 3, 5, 7]",
"- L.append(10000 * i1 + 1000 * i2 + 100 * i3 + 10 * i4 + i5)",
"-for i in range(min(n + 1, 10000)):",
"- l = str(i)",
"- if (",
"- \"3\" in l",
"- and \"5\" in l",
"- and \"7\" in l",
"- and \... | false | 1.20449 | 0.425793 | 2.828814 | [
"s092168722",
"s872955515"
] |
u079022693 | p02765 | python | s504399949 | s070452270 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | def main():
N,R=list(map(int,input().split()))
if N>=10:
print(R)
else:
print((R+100*(10-N)))
if __name__=="__main__":
main() | from sys import stdin
def main():
#入力
readline=stdin.readline
n,r=list(map(int,readline().split()))
if n>=10:
print(r)
else:
print((r+100*(10-n)))
if __name__=="__main__":
main() | 8 | 12 | 156 | 230 | def main():
N, R = list(map(int, input().split()))
if N >= 10:
print(R)
else:
print((R + 100 * (10 - N)))
if __name__ == "__main__":
main()
| from sys import stdin
def main():
# 入力
readline = stdin.readline
n, r = list(map(int, readline().split()))
if n >= 10:
print(r)
else:
print((r + 100 * (10 - n)))
if __name__ == "__main__":
main()
| false | 33.333333 | [
"+from sys import stdin",
"+",
"+",
"- N, R = list(map(int, input().split()))",
"- if N >= 10:",
"- print(R)",
"+ # 入力",
"+ readline = stdin.readline",
"+ n, r = list(map(int, readline().split()))",
"+ if n >= 10:",
"+ print(r)",
"- print((R + 100 * (10 -... | false | 0.077342 | 0.076414 | 1.012136 | [
"s504399949",
"s070452270"
] |
u553987207 | p02947 | python | s796499286 | s768567163 | 526 | 169 | 24,652 | 27,928 | Accepted | Accepted | 67.87 | N = int(eval(input()))
s = sorted(sorted(eval(input())) for _ in range(N))
ans = 0
cnt = 1
for i in range(1, N):
if s[i-1] == s[i]:
cnt += 1
else:
if cnt > 1:
ans += (cnt * (cnt - 1) // 2)
cnt = 1
if cnt > 1:
ans += (cnt * (cnt - 1) // 2)
print(ans) | import sys
N = int(eval(input()))
counts = {}
for _ in range(N):
s = tuple(sorted(sys.stdin.readline()))
counts[s] = counts.get(s, 0) + 1
ans = 0
for count in list(counts.values()):
if count > 1:
ans += (count * (count - 1) // 2)
print(ans) | 14 | 11 | 298 | 258 | N = int(eval(input()))
s = sorted(sorted(eval(input())) for _ in range(N))
ans = 0
cnt = 1
for i in range(1, N):
if s[i - 1] == s[i]:
cnt += 1
else:
if cnt > 1:
ans += cnt * (cnt - 1) // 2
cnt = 1
if cnt > 1:
ans += cnt * (cnt - 1) // 2
print(ans)
| import sys
N = int(eval(input()))
counts = {}
for _ in range(N):
s = tuple(sorted(sys.stdin.readline()))
counts[s] = counts.get(s, 0) + 1
ans = 0
for count in list(counts.values()):
if count > 1:
ans += count * (count - 1) // 2
print(ans)
| false | 21.428571 | [
"+import sys",
"+",
"-s = sorted(sorted(eval(input())) for _ in range(N))",
"+counts = {}",
"+for _ in range(N):",
"+ s = tuple(sorted(sys.stdin.readline()))",
"+ counts[s] = counts.get(s, 0) + 1",
"-cnt = 1",
"-for i in range(1, N):",
"- if s[i - 1] == s[i]:",
"- cnt += 1",
"-... | false | 0.071674 | 0.066311 | 1.080876 | [
"s796499286",
"s768567163"
] |
u514401521 | p03325 | python | s578087096 | s907932291 | 125 | 113 | 4,148 | 4,148 | Accepted | Accepted | 9.6 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
while a[i] % 2 == 0:
cnt += 1
a[i] /= 2
print(cnt) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(len(a)):
tmp = a[i]
while tmp % 2 == 0:
ans += 1
tmp /= 2
print(ans) | 10 | 9 | 161 | 176 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
while a[i] % 2 == 0:
cnt += 1
a[i] /= 2
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(len(a)):
tmp = a[i]
while tmp % 2 == 0:
ans += 1
tmp /= 2
print(ans)
| false | 10 | [
"-cnt = 0",
"-for i in range(n):",
"- while a[i] % 2 == 0:",
"- cnt += 1",
"- a[i] /= 2",
"-print(cnt)",
"+ans = 0",
"+for i in range(len(a)):",
"+ tmp = a[i]",
"+ while tmp % 2 == 0:",
"+ ans += 1",
"+ tmp /= 2",
"+print(ans)"
] | false | 0.095834 | 0.042423 | 2.259005 | [
"s578087096",
"s907932291"
] |
u577170763 | p03318 | python | s814931448 | s992926117 | 196 | 181 | 38,896 | 38,640 | Accepted | Accepted | 7.65 | K = int(eval(input()))
def ns(n):
return sum([int(c) for c in str(n)])
ans, base = 0, 1
for _ in range(K):
ans += base
print(ans)
if (ans + base) / ns(ans + base) > (ans + 10 * base) / ns(ans + 10 * base):
base *= 10 | K = int(eval(input()))
def ns(n):
ret, tmp = 0, n
while tmp > 0:
tmp, r = divmod(tmp, 10)
ret += r
return ret
ans, base = 0, 1
for _ in range(K):
ans += base
print(ans)
if (ans + base) / ns(ans + base) > (ans + 10 * base) / ns(ans + 10 * base):
b... | 14 | 20 | 252 | 323 | K = int(eval(input()))
def ns(n):
return sum([int(c) for c in str(n)])
ans, base = 0, 1
for _ in range(K):
ans += base
print(ans)
if (ans + base) / ns(ans + base) > (ans + 10 * base) / ns(ans + 10 * base):
base *= 10
| K = int(eval(input()))
def ns(n):
ret, tmp = 0, n
while tmp > 0:
tmp, r = divmod(tmp, 10)
ret += r
return ret
ans, base = 0, 1
for _ in range(K):
ans += base
print(ans)
if (ans + base) / ns(ans + base) > (ans + 10 * base) / ns(ans + 10 * base):
base *= 10
| false | 30 | [
"- return sum([int(c) for c in str(n)])",
"+ ret, tmp = 0, n",
"+ while tmp > 0:",
"+ tmp, r = divmod(tmp, 10)",
"+ ret += r",
"+ return ret"
] | false | 0.041191 | 0.137145 | 0.300346 | [
"s814931448",
"s992926117"
] |
u092301301 | p02756 | python | s161481738 | s022938924 | 920 | 370 | 83,064 | 75,184 | Accepted | Accepted | 59.78 | s=[i for i in eval(input())]
x=0 ; st=[[],[]]
for _ in range(int(eval(input()))):
inp=list(map(str,input().split()))
if len(inp)==1: x^=1
else: st[(int(inp[1])-1)^x].append(inp[2])
if x==0:
st[0].reverse()
ans=st[0]+s+st[1]
elif x==1:
st[1].reverse()
s.reverse()
ans=st[1]+s+s... | import sys
input = lambda: sys.stdin.readline().rstrip()
s=[i for i in eval(input())]
x=0 ; st=[[],[]]
for _ in range(int(eval(input()))):
inp=list(map(str,input().split()))
if len(inp)==1: x^=1
else: st[(int(inp[1])-1)^x].append(inp[2])
if x==0:
st[0].reverse()
ans=st[0]+s+st[1]
elif x==... | 21 | 18 | 399 | 404 | s = [i for i in eval(input())]
x = 0
st = [[], []]
for _ in range(int(eval(input()))):
inp = list(map(str, input().split()))
if len(inp) == 1:
x ^= 1
else:
st[(int(inp[1]) - 1) ^ x].append(inp[2])
if x == 0:
st[0].reverse()
ans = st[0] + s + st[1]
elif x == 1:
st[1].reverse()
... | import sys
input = lambda: sys.stdin.readline().rstrip()
s = [i for i in eval(input())]
x = 0
st = [[], []]
for _ in range(int(eval(input()))):
inp = list(map(str, input().split()))
if len(inp) == 1:
x ^= 1
else:
st[(int(inp[1]) - 1) ^ x].append(inp[2])
if x == 0:
st[0].reverse()
an... | false | 14.285714 | [
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.044548 | 0.038571 | 1.154966 | [
"s161481738",
"s022938924"
] |
u046187684 | p02850 | python | s153973328 | s024494145 | 544 | 176 | 50,604 | 29,220 | Accepted | Accepted | 67.65 | from collections import deque
def solve(string):
n, *ab = list(map(int, string.split()))
next_ = [dict([]) for _ in range(n + 1)]
queue = deque([1])
for a, b in zip(*[iter(ab)] * 2):
next_[a][b] = 0
next_[b][a] = 0
while len(queue) > 0:
c = queue.popleft()
... | from collections import deque
def solve(string):
n, *ab = list(map(int, string.split()))
e = [[] for _ in range(n + 1)]
q = deque([1])
c = [0] * (n + 1)
for a, b in zip(*[iter(ab)] * 2):
e[a].append(b)
while q:
s = q.popleft()
d = 0
for t in e[s]:
... | 25 | 23 | 835 | 586 | from collections import deque
def solve(string):
n, *ab = list(map(int, string.split()))
next_ = [dict([]) for _ in range(n + 1)]
queue = deque([1])
for a, b in zip(*[iter(ab)] * 2):
next_[a][b] = 0
next_[b][a] = 0
while len(queue) > 0:
c = queue.popleft()
_next = n... | from collections import deque
def solve(string):
n, *ab = list(map(int, string.split()))
e = [[] for _ in range(n + 1)]
q = deque([1])
c = [0] * (n + 1)
for a, b in zip(*[iter(ab)] * 2):
e[a].append(b)
while q:
s = q.popleft()
d = 0
for t in e[s]:
d ... | false | 8 | [
"- next_ = [dict([]) for _ in range(n + 1)]",
"- queue = deque([1])",
"+ e = [[] for _ in range(n + 1)]",
"+ q = deque([1])",
"+ c = [0] * (n + 1)",
"- next_[a][b] = 0",
"- next_[b][a] = 0",
"- while len(queue) > 0:",
"- c = queue.popleft()",
"- _next ... | false | 0.04762 | 0.007362 | 6.468221 | [
"s153973328",
"s024494145"
] |
u285891772 | p03607 | python | s779989822 | s498119243 | 167 | 146 | 18,352 | 18,344 | Accepted | Accepted | 12.57 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 35 | 37 | 1,037 | 1,048 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 5.405405 | [
"-dic = defaultdict(int)",
"+dic = dict()",
"- # print(dic[a])",
"- dic[a] ^= 1",
"+ if a in dic:",
"+ dic[a] ^= 1",
"+ else:",
"+ dic[a] = 1"
] | false | 0.046285 | 0.060456 | 0.765592 | [
"s779989822",
"s498119243"
] |
u210827208 | p02954 | python | s492851103 | s925888592 | 155 | 143 | 6,400 | 6,376 | Accepted | Accepted | 7.74 | s=eval(input())
n=len(s)
C=[0]*n
cnt_r=0
cnt_l=0
def calc(tmp_r,tmp_l):
n=cnt_r+cnt_l
if n%2==0:
C[tmp_r]=n//2
C[tmp_l]=n//2
else:
if cnt_r>cnt_l:
if cnt_r%2==0:
C[tmp_r]=n//2
C[tmp_l]=n//2+1
e... | s=eval(input())+'R'
n=len(s)
C=[0]*n
cnt_r=0
cnt_l=0
def calc(tmp_r,tmp_l,cnt_r,cnt_l):
C[tmp_r]=(cnt_r-1)//2+cnt_l//2+1
C[tmp_l]=cnt_r//2+(cnt_l-1)//2+1
for i in range(n-1):
if s[i]=='R' and s[i+1]=='R':
cnt_r+=1
if s[i]=='R' and s[i+1]=='L':
cnt_r+... | 59 | 37 | 1,077 | 601 | s = eval(input())
n = len(s)
C = [0] * n
cnt_r = 0
cnt_l = 0
def calc(tmp_r, tmp_l):
n = cnt_r + cnt_l
if n % 2 == 0:
C[tmp_r] = n // 2
C[tmp_l] = n // 2
else:
if cnt_r > cnt_l:
if cnt_r % 2 == 0:
C[tmp_r] = n // 2
C[tmp_l] = n // 2 + 1
... | s = eval(input()) + "R"
n = len(s)
C = [0] * n
cnt_r = 0
cnt_l = 0
def calc(tmp_r, tmp_l, cnt_r, cnt_l):
C[tmp_r] = (cnt_r - 1) // 2 + cnt_l // 2 + 1
C[tmp_l] = cnt_r // 2 + (cnt_l - 1) // 2 + 1
for i in range(n - 1):
if s[i] == "R" and s[i + 1] == "R":
cnt_r += 1
if s[i] == "R" and s[i + 1]... | false | 37.288136 | [
"-s = eval(input())",
"+s = eval(input()) + \"R\"",
"-def calc(tmp_r, tmp_l):",
"- n = cnt_r + cnt_l",
"- if n % 2 == 0:",
"- C[tmp_r] = n // 2",
"- C[tmp_l] = n // 2",
"- else:",
"- if cnt_r > cnt_l:",
"- if cnt_r % 2 == 0:",
"- C[tmp_r] =... | false | 0.05821 | 0.042223 | 1.378636 | [
"s492851103",
"s925888592"
] |
u721407235 | p02714 | python | s551274864 | s290749754 | 1,975 | 1,552 | 9,152 | 9,184 | Accepted | Accepted | 21.42 | N=int(eval(input()))
S=eval(input())
ans=S.count("R")*S.count("G")*S.count("B")
#j-i= k-j k=2*j-i
for i in range(N):
for j in range(i+1,N):
if 2*j-i<N:
if S[i]!=S[j] and S[i]!=S[2*j-i] and S[j]!=S[2*j-i]:
ans -=1
print(ans)
| N=int(eval(input()))
S=eval(input())
ans=S.count("R")*S.count("G")*S.count("B")
#j-i= k-j k=2*j-i
for i in range(N):
for j in range(i+1,N):
if 2*j-i>=N:
break
if S[i]!=S[j] and S[i]!=S[2*j-i] and S[j]!=S[2*j-i]:
ans -=1
print(ans)
| 17 | 19 | 276 | 294 | N = int(eval(input()))
S = eval(input())
ans = S.count("R") * S.count("G") * S.count("B")
# j-i= k-j k=2*j-i
for i in range(N):
for j in range(i + 1, N):
if 2 * j - i < N:
if S[i] != S[j] and S[i] != S[2 * j - i] and S[j] != S[2 * j - i]:
ans -= 1
print(ans)
| N = int(eval(input()))
S = eval(input())
ans = S.count("R") * S.count("G") * S.count("B")
# j-i= k-j k=2*j-i
for i in range(N):
for j in range(i + 1, N):
if 2 * j - i >= N:
break
if S[i] != S[j] and S[i] != S[2 * j - i] and S[j] != S[2 * j - i]:
ans -= 1
print(ans)
| false | 10.526316 | [
"- if 2 * j - i < N:",
"- if S[i] != S[j] and S[i] != S[2 * j - i] and S[j] != S[2 * j - i]:",
"- ans -= 1",
"+ if 2 * j - i >= N:",
"+ break",
"+ if S[i] != S[j] and S[i] != S[2 * j - i] and S[j] != S[2 * j - i]:",
"+ ans -= 1"
] | false | 0.045236 | 0.065696 | 0.688557 | [
"s551274864",
"s290749754"
] |
u063052907 | p03503 | python | s592950440 | s195707478 | 224 | 177 | 42,220 | 3,064 | Accepted | Accepted | 20.98 | # 写経
n = int(eval(input()))
lst_F = [list(map(int, input().split())) for _ in range(n)]
lst_P = [list(map(int, input().split())) for _ in range(n)]
ans = -float("INF")
for b in range(1, 2**10):
tmp = 0
for i in range(n):
c = 0
for k in range(10):
if b&(1<<k) and lst_F... | N = int(eval(input()))
lst_F = [list(map(int, input().split())) for _ in range(N)]
lst_P = [list(map(int, input().split())) for _ in range(N)]
n_timetable = 10
lst_joisino = [None] * n_timetable
def score(src, F, P):
cnt = 0
for i, j in zip(src, F):
if i == j == 1:
cnt += 1
... | 20 | 32 | 414 | 755 | # 写経
n = int(eval(input()))
lst_F = [list(map(int, input().split())) for _ in range(n)]
lst_P = [list(map(int, input().split())) for _ in range(n)]
ans = -float("INF")
for b in range(1, 2**10):
tmp = 0
for i in range(n):
c = 0
for k in range(10):
if b & (1 << k) and lst_F[i][k]:
... | N = int(eval(input()))
lst_F = [list(map(int, input().split())) for _ in range(N)]
lst_P = [list(map(int, input().split())) for _ in range(N)]
n_timetable = 10
lst_joisino = [None] * n_timetable
def score(src, F, P):
cnt = 0
for i, j in zip(src, F):
if i == j == 1:
cnt += 1
return P[cn... | false | 37.5 | [
"-# 写経",
"-n = int(eval(input()))",
"-lst_F = [list(map(int, input().split())) for _ in range(n)]",
"-lst_P = [list(map(int, input().split())) for _ in range(n)]",
"-ans = -float(\"INF\")",
"-for b in range(1, 2**10):",
"- tmp = 0",
"- for i in range(n):",
"- c = 0",
"- for k i... | false | 0.099066 | 0.153717 | 0.644469 | [
"s592950440",
"s195707478"
] |
u379716238 | p03493 | python | s625525153 | s493106722 | 150 | 17 | 14,476 | 2,940 | Accepted | Accepted | 88.67 | import numpy as np
s = eval(input())
ss = [int(i) for i in s]
print((np.sum(ss))) | s = eval(input())
print((s.count('1'))) | 5 | 2 | 78 | 32 | import numpy as np
s = eval(input())
ss = [int(i) for i in s]
print((np.sum(ss)))
| s = eval(input())
print((s.count("1")))
| false | 60 | [
"-import numpy as np",
"-",
"-ss = [int(i) for i in s]",
"-print((np.sum(ss)))",
"+print((s.count(\"1\")))"
] | false | 0.183915 | 0.161928 | 1.135783 | [
"s625525153",
"s493106722"
] |
u221345507 | p03262 | python | s838938433 | s434853314 | 339 | 296 | 24,992 | 22,156 | Accepted | Accepted | 12.68 | import numpy as np
import fractions
N, X =list(map(int,input().split()))
x = list(map(int,input().split()))
result = abs(abs(np.array(x))-X)
D= result[0]
for i in range (1,len(result)):
D=fractions.gcd(D,result[i])
print(D)
| N, X = list(map(int,input().split()))
x = list(map(int,input().split()))
import numpy as np
X_abs = abs(np.array(x)-X)
#最大公約数、最小公倍数
import fractions
gcd = X_abs[0]
for i in range (1,N):
gcd = fractions.gcd(gcd,X_abs[i])
print(gcd) | 11 | 13 | 234 | 248 | import numpy as np
import fractions
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
result = abs(abs(np.array(x)) - X)
D = result[0]
for i in range(1, len(result)):
D = fractions.gcd(D, result[i])
print(D)
| N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
import numpy as np
X_abs = abs(np.array(x) - X)
# 最大公約数、最小公倍数
import fractions
gcd = X_abs[0]
for i in range(1, N):
gcd = fractions.gcd(gcd, X_abs[i])
print(gcd)
| false | 15.384615 | [
"+N, X = list(map(int, input().split()))",
"+x = list(map(int, input().split()))",
"+",
"+X_abs = abs(np.array(x) - X)",
"+# 最大公約数、最小公倍数",
"-N, X = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-result = abs(abs(np.array(x)) - X)",
"-D = result[0]",
"-for i in range(1,... | false | 0.223905 | 0.313819 | 0.713484 | [
"s838938433",
"s434853314"
] |
u665078057 | p03160 | python | s600224380 | s444763781 | 156 | 142 | 13,980 | 13,900 | Accepted | Accepted | 8.97 | N = int(eval(input()))
[*h] = list(map(int, input().split()))
dp = [float('inf') for _ in range(N)]
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print((dp[N-1])) | N = int(eval(input()))
[*h] = list(map(int, input().split()))
dp = [0 for _ in range(N)]
dp[1] = abs(h[0]-h[1])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print((dp[N-1])) | 9 | 8 | 234 | 213 | N = int(eval(input()))
[*h] = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| N = int(eval(input()))
[*h] = list(map(int, input().split()))
dp = [0 for _ in range(N)]
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| false | 11.111111 | [
"-dp = [float(\"inf\") for _ in range(N)]",
"-dp[0] = 0",
"+dp = [0 for _ in range(N)]"
] | false | 0.069741 | 0.096731 | 0.720979 | [
"s600224380",
"s444763781"
] |
u367130284 | p03732 | python | s323422483 | s335641173 | 86 | 70 | 4,016 | 4,116 | Accepted | Accepted | 18.6 | N,W=list(map(int,input().split()))
from collections import*
d=defaultdict(int)
d[0]=0
for i in range(N):
w,v=list(map(int,input().split()))
for k,b in list(d.copy().items()):
if k+w<=W:
d[k+w]=max(d[k+w],b+v)
print((max(d.values()))) | import functools
from collections import*
@functools.lru_cache(maxsize=None)
def Knapsack(N,W):
for i in range(N):
w,v=list(map(int,input().split()))
for k,b in list(d.copy().items()):
if k+w<=W:
d[k+w]=max(d[k+w],b+v)
return max(d.values())
N,W=list(map(int... | 10 | 14 | 250 | 382 | N, W = list(map(int, input().split()))
from collections import *
d = defaultdict(int)
d[0] = 0
for i in range(N):
w, v = list(map(int, input().split()))
for k, b in list(d.copy().items()):
if k + w <= W:
d[k + w] = max(d[k + w], b + v)
print((max(d.values())))
| import functools
from collections import *
@functools.lru_cache(maxsize=None)
def Knapsack(N, W):
for i in range(N):
w, v = list(map(int, input().split()))
for k, b in list(d.copy().items()):
if k + w <= W:
d[k + w] = max(d[k + w], b + v)
return max(d.values())
N,... | false | 28.571429 | [
"-N, W = list(map(int, input().split()))",
"+import functools",
"+",
"+@functools.lru_cache(maxsize=None)",
"+def Knapsack(N, W):",
"+ for i in range(N):",
"+ w, v = list(map(int, input().split()))",
"+ for k, b in list(d.copy().items()):",
"+ if k + w <= W:",
"+ ... | false | 0.07756 | 0.077234 | 1.004221 | [
"s323422483",
"s335641173"
] |
u309141201 | p03547 | python | s516760449 | s419062713 | 171 | 32 | 38,256 | 8,904 | Accepted | Accepted | 81.29 | X, Y = list(map(str, input().split()))
if X == 'A':
x = 10
elif X == 'B':
x = 11
elif X == 'C':
x = 12
elif X == 'D':
x = 13
elif X == 'E':
x = 14
elif X == 'F':
x = 15
if Y == 'A':
y = 10
elif Y == 'B':
y = 11
elif Y == 'C':
y = 12
elif Y == 'D':
y = 13
el... | A, B = input().split()
if A > B:
print('>')
elif A == B:
print('=')
else:
print('<')
| 33 | 7 | 449 | 104 | X, Y = list(map(str, input().split()))
if X == "A":
x = 10
elif X == "B":
x = 11
elif X == "C":
x = 12
elif X == "D":
x = 13
elif X == "E":
x = 14
elif X == "F":
x = 15
if Y == "A":
y = 10
elif Y == "B":
y = 11
elif Y == "C":
y = 12
elif Y == "D":
y = 13
elif Y == "E":
y = 14... | A, B = input().split()
if A > B:
print(">")
elif A == B:
print("=")
else:
print("<")
| false | 78.787879 | [
"-X, Y = list(map(str, input().split()))",
"-if X == \"A\":",
"- x = 10",
"-elif X == \"B\":",
"- x = 11",
"-elif X == \"C\":",
"- x = 12",
"-elif X == \"D\":",
"- x = 13",
"-elif X == \"E\":",
"- x = 14",
"-elif X == \"F\":",
"- x = 15",
"-if Y == \"A\":",
"- y = 10... | false | 0.035269 | 0.070178 | 0.502566 | [
"s516760449",
"s419062713"
] |
u918845030 | p03061 | python | s044317023 | s335081101 | 234 | 200 | 14,488 | 14,384 | Accepted | Accepted | 14.53 |
def gcd(a, b):
if b == 0:
return a
elif a == 0:
return b
else:
return gcd(b, a % b)
def solve(n, a):
l, r = [], []
l = [0 for i in range(n + 1)]
r = [0 for i in range(n + 1)]
r[n] = 0
for i in range(0, n):
if i == 0:
l[0] ... | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def solve(n, a):
l = [0] * n
r = [0] * (n + 1)
for i in range(1, n):
l[i] = gcd(l[i - 1], a[i - 1])
for i in range(n - 1, 0, -1):
r[i] = gcd(r[i + 1], a[i])
m = 0
for i in range(n):
... | 48 | 34 | 867 | 608 | def gcd(a, b):
if b == 0:
return a
elif a == 0:
return b
else:
return gcd(b, a % b)
def solve(n, a):
l, r = [], []
l = [0 for i in range(n + 1)]
r = [0 for i in range(n + 1)]
r[n] = 0
for i in range(0, n):
if i == 0:
l[0] = 0
else:
... | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def solve(n, a):
l = [0] * n
r = [0] * (n + 1)
for i in range(1, n):
l[i] = gcd(l[i - 1], a[i - 1])
for i in range(n - 1, 0, -1):
r[i] = gcd(r[i + 1], a[i])
m = 0
for i in range(n):
m = max(m, gcd(l... | false | 29.166667 | [
"- elif a == 0:",
"- return b",
"- else:",
"- return gcd(b, a % b)",
"+ return gcd(b, a % b)",
"- l, r = [], []",
"- l = [0 for i in range(n + 1)]",
"- r = [0 for i in range(n + 1)]",
"- r[n] = 0",
"- for i in range(0, n):",
"- if i == 0:",
"- ... | false | 0.033318 | 0.03664 | 0.90935 | [
"s044317023",
"s335081101"
] |
u762420987 | p02984 | python | s466265805 | s884490711 | 319 | 131 | 64,484 | 14,092 | Accepted | Accepted | 58.93 | N = int(input())
Alist = list(map(int, input().split()))
S = sum(Alist)
Xlist = [0] * N
Xlist[0] = S - 2 * sum([Alist[_] for _ in range(1, N, 2)])
print(Xlist[0], end=" ")
for i in range(1, N):
Xlist[i] = 2*Alist[i-1] - Xlist[i-1]
print(Xlist[i], end=" ")
print()
| N = int(eval(input()))
Alist = list(map(int, input().split()))
S = sum(Alist)
ans = [S - sum([2 * Alist[i] for i in range(1, N - 1, 2)])]
for i in range(1, N):
ans.append(-ans[i - 1] + 2 * Alist[i - 1])
print((*ans)) | 10 | 10 | 280 | 224 | N = int(input())
Alist = list(map(int, input().split()))
S = sum(Alist)
Xlist = [0] * N
Xlist[0] = S - 2 * sum([Alist[_] for _ in range(1, N, 2)])
print(Xlist[0], end=" ")
for i in range(1, N):
Xlist[i] = 2 * Alist[i - 1] - Xlist[i - 1]
print(Xlist[i], end=" ")
print()
| N = int(eval(input()))
Alist = list(map(int, input().split()))
S = sum(Alist)
ans = [S - sum([2 * Alist[i] for i in range(1, N - 1, 2)])]
for i in range(1, N):
ans.append(-ans[i - 1] + 2 * Alist[i - 1])
print((*ans))
| false | 0 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-Xlist = [0] * N",
"-Xlist[0] = S - 2 * sum([Alist[_] for _ in range(1, N, 2)])",
"-print(Xlist[0], end=\" \")",
"+ans = [S - sum([2 * Alist[i] for i in range(1, N - 1, 2)])]",
"- Xlist[i] = 2 * Alist[i - 1] - Xlist[i - 1]",
"- print(Xlist[i], end... | false | 0.162603 | 0.163405 | 0.99509 | [
"s466265805",
"s884490711"
] |
u873482706 | p00067 | python | s402731869 | s147898781 | 50 | 30 | 7,476 | 7,624 | Accepted | Accepted | 40 | def f1():
t = 0
for y, line in enumerate(M):
for x, cell in enumerate(line):
if M[y][x] == '1':
f2(x, y)
t += 1
return t
def f2(x, y):
if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
return
if M[y][x] == '1':
M[y... | def f1():
t = 0
for y, line in enumerate(M):
for x, cell in enumerate(line):
if M[y][x] == '1':
f2(x, y)
t += 1
return t
def f2(x, y):
if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
return
if M[y][x] == '1':
M[y... | 42 | 37 | 884 | 690 | def f1():
t = 0
for y, line in enumerate(M):
for x, cell in enumerate(line):
if M[y][x] == "1":
f2(x, y)
t += 1
return t
def f2(x, y):
if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
return
if M[y][x] == "1":
M[y][x] = "0"
... | def f1():
t = 0
for y, line in enumerate(M):
for x, cell in enumerate(line):
if M[y][x] == "1":
f2(x, y)
t += 1
return t
def f2(x, y):
if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
return
if M[y][x] == "1":
M[y][x] = "0"
... | false | 11.904762 | [
"- for i in range(4):",
"- if i == 0: # U",
"- f2(x, y - 1)",
"- elif i == 1: # D",
"- f2(x, y + 1)",
"- elif i == 2: # R",
"- f2(x + 1, y)",
"- elif i == 3: # L",
"- f2(x - 1, y)",
"... | false | 0.043288 | 0.048312 | 0.896008 | [
"s402731869",
"s147898781"
] |
u532966492 | p03253 | python | s031963538 | s517405677 | 785 | 230 | 3,444 | 3,424 | Accepted | Accepted | 70.7 | N,M=list(map(int,input().split()))
mod=10**9+7
from math import factorial
from collections import Counter
def soinsuu(n):
list_=[]
while(n!=1):
for i in range(2,int(n**0.5)+1):
if n%i==0:
list_.append(i)
n=n//i
break
e... | N,M=list(map(int,input().split()))
from collections import Counter
def soinsuu(n):
list_=[]
while(n!=1):
for i in range(2,int(n**0.5)+1):
if n%i==0:
list_.append(i)
n=n//i
break
else:
list_.append(n)
... | 67 | 42 | 1,668 | 969 | N, M = list(map(int, input().split()))
mod = 10**9 + 7
from math import factorial
from collections import Counter
def soinsuu(n):
list_ = []
while n != 1:
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
list_.append(i)
n = n // i
break
... | N, M = list(map(int, input().split()))
from collections import Counter
def soinsuu(n):
list_ = []
while n != 1:
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
list_.append(i)
n = n // i
break
else:
list_.append(n)
... | false | 37.313433 | [
"-mod = 10**9 + 7",
"-from math import factorial",
"- pro = pro * b % mod",
"+ pro = pro * b % (10**9 + 7)",
"-nPr_list = [nPr(N, i) for i in range(30)]",
"-bunbo_list = dict()",
"-",
"-",
"-def dp(cur, init, seq, lest, num):",
"- # print(cur,init,seq,lest,num)",
"- if cur ==... | false | 0.495866 | 0.072326 | 6.855959 | [
"s031963538",
"s517405677"
] |
u962045495 | p03096 | python | s355500510 | s599689801 | 116 | 103 | 71,536 | 45,212 | Accepted | Accepted | 11.21 | #!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>
"""
import itertools
import os
import sys
from atexit import register
from io import StringIO
from collections import Counter
range = xrange
filter = itert... | #!/usr/bin/env python2
import itertools
import os
import sys
from atexit import register
from io import StringIO
range = xrange
sys.stdout = StringIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = StringIO(os.read(0, os.fstat(0).st_size)).readline
MOD = 10**9 + 7
MODF = float(MOD)
... | 68 | 45 | 1,549 | 975 | #!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>
"""
import itertools
import os
import sys
from atexit import register
from io import StringIO
from collections import Counter
range = xrange
filter = itertools.ifilter
map = it... | #!/usr/bin/env python2
import itertools
import os
import sys
from atexit import register
from io import StringIO
range = xrange
sys.stdout = StringIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = StringIO(os.read(0, os.fstat(0).st_size)).readline
MOD = 10**9 + 7
MODF = float(MOD)
MAGIC = 6755399441055... | false | 33.823529 | [
"-\"\"\"",
"-This file is part of https://github.com/cheran-senthil/PyRival",
"-Copyright 2019 Cheran Senthilkumar <hello@cheran.io>",
"-\"\"\"",
"-from collections import Counter",
"-filter = itertools.ifilter",
"-map = itertools.imap",
"-zip = itertools.izip",
"-fmul = lambda a, b, c=0.0: fmod(",
... | false | 0.057714 | 0.035671 | 1.617954 | [
"s355500510",
"s599689801"
] |
u768896740 | p03031 | python | s229858660 | s960239783 | 39 | 34 | 3,064 | 3,188 | Accepted | Accepted | 12.82 | n, m = list(map(int, input().split()))
switches = []
cnt = 0
for i in range(m):
array = list(map(int, input().split()))
array.pop(0)
switches.append(array)
p = list(map(int, input().split()))
def ch_binary(l, digit):
num = [0] * digit
for i in l:
num[i-1] = 1
return n... | n, m = list(map(int, input().split()))
switches = []
for i in range(m):
array = list(map(int, input().split()))
switches.append(array[1:])
checker = list(map(int, input().split()))
bit_size = 2 ** n
ans = 0
for i in range(bit_size):
num = format(i, 'b').zfill(n)
flag = True
fo... | 47 | 31 | 897 | 620 | n, m = list(map(int, input().split()))
switches = []
cnt = 0
for i in range(m):
array = list(map(int, input().split()))
array.pop(0)
switches.append(array)
p = list(map(int, input().split()))
def ch_binary(l, digit):
num = [0] * digit
for i in l:
num[i - 1] = 1
return num
# スイッチのON、O... | n, m = list(map(int, input().split()))
switches = []
for i in range(m):
array = list(map(int, input().split()))
switches.append(array[1:])
checker = list(map(int, input().split()))
bit_size = 2**n
ans = 0
for i in range(bit_size):
num = format(i, "b").zfill(n)
flag = True
for j in range(m):
... | false | 34.042553 | [
"-cnt = 0",
"- array.pop(0)",
"- switches.append(array)",
"-p = list(map(int, input().split()))",
"-",
"-",
"-def ch_binary(l, digit):",
"- num = [0] * digit",
"- for i in l:",
"- num[i - 1] = 1",
"- return num",
"-",
"-",
"-# スイッチのON、OFFをバイナリで表現する。",
"-switches_2 =... | false | 0.09022 | 0.04402 | 2.049511 | [
"s229858660",
"s960239783"
] |
u389910364 | p03208 | python | s800881698 | s967315025 | 282 | 210 | 7,384 | 17,120 | Accepted | Accepted | 25.53 | n, k = list(map(int, input().split()))
heights = []
for _ in range(n):
heights.append(int(eval(input())))
heights.sort()
ans = float('inf')
for i in range(len(heights)):
if i + k - 1 >= len(heights):
break
ans = min(ans, heights[i + k - 1] - heights[i])
print(ans)
| import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, K = list(map(int, sys.stdin.buffer.readline().split()))
H = [int(sys.stdin.buffer.readline()) ... | 14 | 25 | 290 | 440 | n, k = list(map(int, input().split()))
heights = []
for _ in range(n):
heights.append(int(eval(input())))
heights.sort()
ans = float("inf")
for i in range(len(heights)):
if i + k - 1 >= len(heights):
break
ans = min(ans, heights[i + k - 1] - heights[i])
print(ans)
| import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, K = list(map(int, sys.stdin.buffer.readline().split()))
H = [int(sys.stdin.buffer.readline()) for _ in range(N)]
H = np.... | false | 44 | [
"-n, k = list(map(int, input().split()))",
"-heights = []",
"-for _ in range(n):",
"- heights.append(int(eval(input())))",
"-heights.sort()",
"-ans = float(\"inf\")",
"-for i in range(len(heights)):",
"- if i + k - 1 >= len(heights):",
"- break",
"- ans = min(ans, heights[i + k - 1... | false | 0.03697 | 0.19505 | 0.189542 | [
"s800881698",
"s967315025"
] |
u888092736 | p04012 | python | s995821690 | s428715573 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import Counter
print('No') if any(v % 2 for v in Counter(input()).values()) else print('Yes')
| cntr = [0] * 26
for c in input():
cntr[ord(c) - 97] += 1
print('No') if any(v % 2 for v in cntr) else print('Yes')
| 4 | 4 | 115 | 121 | from collections import Counter
print("No") if any(v % 2 for v in Counter(input()).values()) else print("Yes")
| cntr = [0] * 26
for c in input():
cntr[ord(c) - 97] += 1
print("No") if any(v % 2 for v in cntr) else print("Yes")
| false | 0 | [
"-from collections import Counter",
"-",
"-print(\"No\") if any(v % 2 for v in Counter(input()).values()) else print(\"Yes\")",
"+cntr = [0] * 26",
"+for c in input():",
"+ cntr[ord(c) - 97] += 1",
"+print(\"No\") if any(v % 2 for v in cntr) else print(\"Yes\")"
] | false | 0.04115 | 0.040941 | 1.005106 | [
"s995821690",
"s428715573"
] |
u537962130 | p03136 | python | s223057775 | s797255401 | 178 | 63 | 38,384 | 61,884 | Accepted | Accepted | 64.61 | n=int(eval(input()))
l=list(map(int,input().split()))
s=sum(l)
m=max(l)
ans='Yes' if s>m*2 else 'No'
print(ans) | n=int(eval(input()))
l=list(map(int,input().split()))
print(('YNeos'[max(l)*2>=sum(l)::2])) | 7 | 3 | 112 | 85 | n = int(eval(input()))
l = list(map(int, input().split()))
s = sum(l)
m = max(l)
ans = "Yes" if s > m * 2 else "No"
print(ans)
| n = int(eval(input()))
l = list(map(int, input().split()))
print(("YNeos"[max(l) * 2 >= sum(l) :: 2]))
| false | 57.142857 | [
"-s = sum(l)",
"-m = max(l)",
"-ans = \"Yes\" if s > m * 2 else \"No\"",
"-print(ans)",
"+print((\"YNeos\"[max(l) * 2 >= sum(l) :: 2]))"
] | false | 0.042219 | 0.042555 | 0.992102 | [
"s223057775",
"s797255401"
] |
u537859408 | p02918 | python | s571695297 | s843159218 | 85 | 48 | 3,316 | 3,316 | Accepted | Accepted | 43.53 | N, K = list(map(int, input().split()))
S = eval(input())
happy = 0
ncc = 1 # number of connected components
for i in range(N):
if S[i] == 'L':
if i > 0 and S[i - 1] == 'L':
happy += 1
elif S[i] == 'R':
if i < N - 1 and S[i + 1] == 'R':
happy += 1
if i > 0... | N, K = list(map(int, input().split()))
S = eval(input())
happy = 0
ncc = 1 # number of connected components
for i in range(N - 1):
ncc += S[i] != S[i + 1]
if ncc >= 3:
p = min(K, (ncc - 1) // 2)
ncc -= 2 * p
K -= p
if ncc == 2 and K > 0:
ncc -= 1
print((N - ncc)) | 22 | 14 | 498 | 283 | N, K = list(map(int, input().split()))
S = eval(input())
happy = 0
ncc = 1 # number of connected components
for i in range(N):
if S[i] == "L":
if i > 0 and S[i - 1] == "L":
happy += 1
elif S[i] == "R":
if i < N - 1 and S[i + 1] == "R":
happy += 1
if i > 0 and S[i] !=... | N, K = list(map(int, input().split()))
S = eval(input())
happy = 0
ncc = 1 # number of connected components
for i in range(N - 1):
ncc += S[i] != S[i + 1]
if ncc >= 3:
p = min(K, (ncc - 1) // 2)
ncc -= 2 * p
K -= p
if ncc == 2 and K > 0:
ncc -= 1
print((N - ncc))
| false | 36.363636 | [
"-for i in range(N):",
"- if S[i] == \"L\":",
"- if i > 0 and S[i - 1] == \"L\":",
"- happy += 1",
"- elif S[i] == \"R\":",
"- if i < N - 1 and S[i + 1] == \"R\":",
"- happy += 1",
"- if i > 0 and S[i] != S[i - 1]:",
"- ncc += 1",
"+for i in rang... | false | 0.038362 | 0.038311 | 1.001321 | [
"s571695297",
"s843159218"
] |
u426534722 | p02242 | python | s344792314 | s870771616 | 30 | 20 | 6,304 | 6,072 | Accepted | Accepted | 33.33 | from collections import deque
INF = float("inf")
def MAIN():
n = int(eval(input()))
G = [[i, INF] for i in range(n)]
G[0][1] = 0
m = {}
for _ in range(n):
A = list(map(int, input().split()))
m[A[0]] = {}
for i in range(2, len(A), 2):
m[A[0]][A[i]] = A[i... | from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
n = int(eval(input()))
G = [[i, INF] for i in range(n)]
G[0][1] = 0
m = {}
for _ in range(n):
A = list(map(int, input().split()))
m[A[0]] = {}
for i in range(2, len(A), 2):
m[A[... | 22 | 22 | 591 | 623 | from collections import deque
INF = float("inf")
def MAIN():
n = int(eval(input()))
G = [[i, INF] for i in range(n)]
G[0][1] = 0
m = {}
for _ in range(n):
A = list(map(int, input().split()))
m[A[0]] = {}
for i in range(2, len(A), 2):
m[A[0]][A[i]] = A[i + 1]
... | from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
n = int(eval(input()))
G = [[i, INF] for i in range(n)]
G[0][1] = 0
m = {}
for _ in range(n):
A = list(map(int, input().split()))
m[A[0]] = {}
for i in range(2, len(A), 2):
m[A[0]][A[i]... | false | 0 | [
"-from collections import deque",
"+from heapq import heapify, heappush, heappop",
"- dp = deque([0])",
"+ dp = [(0, 0)]",
"- u = dp.popleft()",
"+ cost, u = heappop(dp)",
"- dp.append(v)",
"+ heappush(dp, (G[v][1], v))"
] | false | 0.046128 | 0.044264 | 1.042113 | [
"s344792314",
"s870771616"
] |
u852690916 | p03712 | python | s900551011 | s315191080 | 179 | 20 | 38,612 | 3,060 | Accepted | Accepted | 88.83 | H,W=list(map(int, input().split()))
A=[eval(input()) for _ in range(H)]
print(('#'*(W+2)))
for a in A:
print(('#' + a + '#'))
print(('#'*(W+2)))
| H,W=list(map(int, input().split()))
ans=[['#']*(W+2) for _ in range(H+2)]
for i in range(1,H+1):
for j,a in enumerate(eval(input())):
j+=1
ans[i][j]=a
for a in ans:
print((''.join(a))) | 6 | 8 | 136 | 201 | H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
print(("#" * (W + 2)))
for a in A:
print(("#" + a + "#"))
print(("#" * (W + 2)))
| H, W = list(map(int, input().split()))
ans = [["#"] * (W + 2) for _ in range(H + 2)]
for i in range(1, H + 1):
for j, a in enumerate(eval(input())):
j += 1
ans[i][j] = a
for a in ans:
print(("".join(a)))
| false | 25 | [
"-A = [eval(input()) for _ in range(H)]",
"-print((\"#\" * (W + 2)))",
"-for a in A:",
"- print((\"#\" + a + \"#\"))",
"-print((\"#\" * (W + 2)))",
"+ans = [[\"#\"] * (W + 2) for _ in range(H + 2)]",
"+for i in range(1, H + 1):",
"+ for j, a in enumerate(eval(input())):",
"+ j += 1",
... | false | 0.054454 | 0.084079 | 0.647652 | [
"s900551011",
"s315191080"
] |
u780025254 | p02400 | python | s664458117 | s675365278 | 50 | 20 | 7,616 | 5,576 | Accepted | Accepted | 60 | import math
r = float(eval(input()))
circle = r * 2 * math.pi
area = (r ** 2) * math.pi
print(('{0:.5f} {1:.5f}'.format(area, circle))) | r = float(eval(input()))
pi = 3.141592653589
print(("{:.10f} {:.10f}".format(r ** 2 * pi, 2 * r * pi)))
| 7 | 3 | 135 | 98 | import math
r = float(eval(input()))
circle = r * 2 * math.pi
area = (r**2) * math.pi
print(("{0:.5f} {1:.5f}".format(area, circle)))
| r = float(eval(input()))
pi = 3.141592653589
print(("{:.10f} {:.10f}".format(r**2 * pi, 2 * r * pi)))
| false | 57.142857 | [
"-import math",
"-",
"-circle = r * 2 * math.pi",
"-area = (r**2) * math.pi",
"-print((\"{0:.5f} {1:.5f}\".format(area, circle)))",
"+pi = 3.141592653589",
"+print((\"{:.10f} {:.10f}\".format(r**2 * pi, 2 * r * pi)))"
] | false | 0.043539 | 0.046943 | 0.927487 | [
"s664458117",
"s675365278"
] |
u328510800 | p03281 | python | s431508855 | s022421540 | 31 | 26 | 9,120 | 9,152 | Accepted | Accepted | 16.13 | # 引数nが持つ正の約数の数を調べる
def divisor_count(n:int) -> int:
count = 0
for x in range(1, n+1):
if n % x == 0:
count += 1
return count
def solve(n: int) -> int:
# [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
result = 0
for x in range(1, n+1):
if x&1 and divisor_count(x) == 8:
result += 1
retur... | # 引数nが持つ正の約数の数を調べる
def divisor_count(n:int) -> int:
count = 0
for x in range(1, n+1):
if n % x == 0:
count += 1
return count
def solve(n: int) -> int:
# [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
result = 0
for x in range(1, n+1, 2):
if divisor_count(x) == 8:
result += 1
return res... | 19 | 19 | 367 | 362 | # 引数nが持つ正の約数の数を調べる
def divisor_count(n: int) -> int:
count = 0
for x in range(1, n + 1):
if n % x == 0:
count += 1
return count
def solve(n: int) -> int:
# [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
result = 0
for x in range(1, n + 1):
if x & 1 and divisor_count(x) == 8:
... | # 引数nが持つ正の約数の数を調べる
def divisor_count(n: int) -> int:
count = 0
for x in range(1, n + 1):
if n % x == 0:
count += 1
return count
def solve(n: int) -> int:
# [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
result = 0
for x in range(1, n + 1, 2):
if divisor_count(x) == 8:
resu... | false | 0 | [
"- for x in range(1, n + 1):",
"- if x & 1 and divisor_count(x) == 8:",
"+ for x in range(1, n + 1, 2):",
"+ if divisor_count(x) == 8:"
] | false | 0.007594 | 0.035637 | 0.213104 | [
"s431508855",
"s022421540"
] |
u721425712 | p02713 | python | s114427990 | s682515791 | 1,809 | 947 | 9,092 | 9,108 | Accepted | Accepted | 47.65 | from math import gcd
k = int(eval(input()))
sum_c = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
sum_c += gcd(gcd(a, b), c)
print(sum_c) | import math
A = int(eval(input()))
def gcd(A):
total = 0
for i in range(1,A+1):
for j in range(1,A+1):
B = math.gcd(i,j)
for k in range(1,A+1):
total += math.gcd(B,k)
return total
print((gcd(A))) | 12 | 11 | 220 | 257 | from math import gcd
k = int(eval(input()))
sum_c = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
sum_c += gcd(gcd(a, b), c)
print(sum_c)
| import math
A = int(eval(input()))
def gcd(A):
total = 0
for i in range(1, A + 1):
for j in range(1, A + 1):
B = math.gcd(i, j)
for k in range(1, A + 1):
total += math.gcd(B, k)
return total
print((gcd(A)))
| false | 8.333333 | [
"-from math import gcd",
"+import math",
"-k = int(eval(input()))",
"-sum_c = 0",
"-for a in range(1, k + 1):",
"- for b in range(1, k + 1):",
"- for c in range(1, k + 1):",
"- sum_c += gcd(gcd(a, b), c)",
"-print(sum_c)",
"+A = int(eval(input()))",
"+",
"+",
"+def gcd(A... | false | 0.162721 | 0.079139 | 2.056135 | [
"s114427990",
"s682515791"
] |
u698176039 | p02761 | python | s363227105 | s932752537 | 43 | 24 | 5,352 | 3,316 | Accepted | Accepted | 44.19 | # -*- coding: utf-8 -*-
import sys
import random
N,M = list(map(int,input().split()))
sc = [list(map(int,input().split())) for _ in range(M)]
# while True:
# N = int(random.randint(1,3))
# M = int()
ms = -1
upt = [False]*N
ans = [0]*N
for s,c in sc:
ms = max(N-s,ms)
if upt[s-1]:
... | # -*- coding: utf-8 -*-
import sys
import random
N,M = list(map(int,input().split()))
sc = [list(map(int,input().split())) for _ in range(M)]
#%%
ans = -1
for i in range(1000):
L = len(str(i))
if L!=N:
continue
a = [0]*L
tmp = i
for j in range(L):
a[L-j-1] = tmp%10
... | 51 | 34 | 898 | 627 | # -*- coding: utf-8 -*-
import sys
import random
N, M = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(M)]
# while True:
# N = int(random.randint(1,3))
# M = int()
ms = -1
upt = [False] * N
ans = [0] * N
for s, c in sc:
ms = max(N - s, ms)
if upt[s - 1]:
if... | # -*- coding: utf-8 -*-
import sys
import random
N, M = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(M)]
#%%
ans = -1
for i in range(1000):
L = len(str(i))
if L != N:
continue
a = [0] * L
tmp = i
for j in range(L):
a[L - j - 1] = tmp % 10
... | false | 33.333333 | [
"-# while True:",
"-# N = int(random.randint(1,3))",
"-# M = int()",
"-ms = -1",
"-upt = [False] * N",
"-ans = [0] * N",
"-for s, c in sc:",
"- ms = max(N - s, ms)",
"- if upt[s - 1]:",
"- if ans[s - 1] != c:",
"- print((-1))",
"- sys.exit()",
"+#%%... | false | 0.036958 | 0.0448 | 0.82495 | [
"s363227105",
"s932752537"
] |
u729133443 | p02619 | python | s311506237 | s844801547 | 618 | 82 | 111,720 | 68,176 | Accepted | Accepted | 86.73 | from time import time
from random import randint
from numba import njit
from numpy import int64
@njit('i8(i8[:],i8[:])')
def func(s,x):
last=[0]*26
score=0
for i,v in enumerate(x,1):
last[v]=i
c=0
for j in range(26):
c+=s[j]*(i-last[j])
score=scor... | def func(s,x):
last=[0]*26
score=0
for i,v in enumerate(x,1):
last[v]=i
c=0
for j in range(26):
c+=s[j]*(i-last[j])
score=score+s[i*26+v]-c
print(score)
return score
def main():
d,*s=list(map(int,open(0).read().split()))
func(s,[t-... | 25 | 15 | 494 | 340 | from time import time
from random import randint
from numba import njit
from numpy import int64
@njit("i8(i8[:],i8[:])")
def func(s, x):
last = [0] * 26
score = 0
for i, v in enumerate(x, 1):
last[v] = i
c = 0
for j in range(26):
c += s[j] * (i - last[j])
score ... | def func(s, x):
last = [0] * 26
score = 0
for i, v in enumerate(x, 1):
last[v] = i
c = 0
for j in range(26):
c += s[j] * (i - last[j])
score = score + s[i * 26 + v] - c
print(score)
return score
def main():
d, *s = list(map(int, open(0).read().sp... | false | 40 | [
"-from time import time",
"-from random import randint",
"-from numba import njit",
"-from numpy import int64",
"-",
"-",
"-@njit(\"i8(i8[:],i8[:])\")",
"- start = time()",
"- s = int64(s)",
"- func(s, s[-d:] - 1)",
"+ func(s, [t - 1 for t in s[-d:]])"
] | false | 0.036913 | 0.037188 | 0.992608 | [
"s311506237",
"s844801547"
] |
u697696097 | p03861 | python | s285274820 | s828671931 | 43 | 18 | 5,624 | 3,060 | Accepted | Accepted | 58.14 | import sys
from io import StringIO
import unittest
def yn(b):
print(("Yes" if b==1 else "No"))
return
def resolve():
readline=sys.stdin.readline
a,b,x=list(map(int, readline().rstrip().split()))
if a%x==0:
f=a
else:
f=a-a%x+x
if f > b:
prin... | import sys
def yn(b):
print(("Yes" if b==1 else "No"))
return
def resolve():
readline=sys.stdin.readline
a,b,x=list(map(int, readline().rstrip().split()))
print((b//x - (a-1)//x))
return
if 'doTest' not in globals():
resolve()
sys.exit() | 33 | 15 | 553 | 276 | import sys
from io import StringIO
import unittest
def yn(b):
print(("Yes" if b == 1 else "No"))
return
def resolve():
readline = sys.stdin.readline
a, b, x = list(map(int, readline().rstrip().split()))
if a % x == 0:
f = a
else:
f = a - a % x + x
if f > b:
... | import sys
def yn(b):
print(("Yes" if b == 1 else "No"))
return
def resolve():
readline = sys.stdin.readline
a, b, x = list(map(int, readline().rstrip().split()))
print((b // x - (a - 1) // x))
return
if "doTest" not in globals():
resolve()
sys.exit()
| false | 54.545455 | [
"-from io import StringIO",
"-import unittest",
"- if a % x == 0:",
"- f = a",
"- else:",
"- f = a - a % x + x",
"- if f > b:",
"- print((0))",
"- return",
"- if b % x == 0:",
"- t = b",
"- else:",
"- t = b - b % x",
"- ... | false | 0.037105 | 0.035758 | 1.037669 | [
"s285274820",
"s828671931"
] |
u046187684 | p02838 | python | s918796566 | s351661219 | 984 | 868 | 73,316 | 70,380 | Accepted | Accepted | 11.79 | from itertools import starmap
def solve(string):
n, *a = list(map(int, string.split()))
a = ["{:060b}".format(_a) for _a in a]
m = 10**9 + 7
ans = 0
for s in starmap(lambda *x: x.count("1"), list(zip(*a))):
ans <<= 1
ans += s * (n - s)
ans %= m
return str(an... | def solve(string):
n, *a = list(map(int, string.split()))
a = ("{:060b}".format(_a) for _a in a)
m = 10**9 + 7
ans = 0
for s in [x.count("1") for x in zip(*a)]:
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __name__ == '__main__':
import sys
... | 18 | 15 | 403 | 363 | from itertools import starmap
def solve(string):
n, *a = list(map(int, string.split()))
a = ["{:060b}".format(_a) for _a in a]
m = 10**9 + 7
ans = 0
for s in starmap(lambda *x: x.count("1"), list(zip(*a))):
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __na... | def solve(string):
n, *a = list(map(int, string.split()))
a = ("{:060b}".format(_a) for _a in a)
m = 10**9 + 7
ans = 0
for s in [x.count("1") for x in zip(*a)]:
ans <<= 1
ans += s * (n - s)
ans %= m
return str(ans)
if __name__ == "__main__":
import sys
print((s... | false | 16.666667 | [
"-from itertools import starmap",
"-",
"-",
"- a = [\"{:060b}\".format(_a) for _a in a]",
"+ a = (\"{:060b}\".format(_a) for _a in a)",
"- for s in starmap(lambda *x: x.count(\"1\"), list(zip(*a))):",
"+ for s in [x.count(\"1\") for x in zip(*a)]:"
] | false | 0.085062 | 0.03761 | 2.2617 | [
"s918796566",
"s351661219"
] |
u400765446 | p02408 | python | s467703249 | s640509159 | 30 | 20 | 5,596 | 5,588 | Accepted | Accepted | 33.33 | def main():
numlist = set()
x = int(eval(input()))
for _ in range(x):
numlist.add(tuple(input().split()))
cards = set()
for mark in ('S', 'H', 'C', 'D'):
for i in range(1,14):
cards.add((mark, str(i)))
for item in numlist:
cards.remove(it... | cards = []
n = int(eval(input()))
for _ in range(n):
cards.append(eval(input()))
# カードを全部用意する
suits = ('S', 'H', 'C', 'D')
res_cards = []
for suit in suits:
for i in range(1, 14):
res_cards.append(suit+' '+str(i))
for card in cards:
res_cards.remove(card)
for card in res_cards:
... | 23 | 17 | 506 | 322 | def main():
numlist = set()
x = int(eval(input()))
for _ in range(x):
numlist.add(tuple(input().split()))
cards = set()
for mark in ("S", "H", "C", "D"):
for i in range(1, 14):
cards.add((mark, str(i)))
for item in numlist:
cards.remove(item)
for mark in (... | cards = []
n = int(eval(input()))
for _ in range(n):
cards.append(eval(input()))
# カードを全部用意する
suits = ("S", "H", "C", "D")
res_cards = []
for suit in suits:
for i in range(1, 14):
res_cards.append(suit + " " + str(i))
for card in cards:
res_cards.remove(card)
for card in res_cards:
print(card)
| false | 26.086957 | [
"-def main():",
"- numlist = set()",
"- x = int(eval(input()))",
"- for _ in range(x):",
"- numlist.add(tuple(input().split()))",
"- cards = set()",
"- for mark in (\"S\", \"H\", \"C\", \"D\"):",
"- for i in range(1, 14):",
"- cards.add((mark, str(i)))",
"- ... | false | 0.062851 | 0.108309 | 0.580299 | [
"s467703249",
"s640509159"
] |
u562935282 | p02555 | python | s090240153 | s157313464 | 29 | 25 | 9,156 | 9,108 | Accepted | Accepted | 13.79 | def main():
MOD = 10 ** 9 + 7
S = int(eval(input()))
dp = [0] * (S + 1)
dp[0] = 1
for x in range(3, S + 1):
# dp[x-3] + dp[x-4] + dp[x-5] + ... + dp[0]
# dp[x-3] + dp[x-1]
dp[x] = (dp[x - 3] + dp[x - 1]) % MOD
print((dp[S]))
if __name__ == '__main__':
... | def main():
MOD = 10 ** 9 + 7
S = int(eval(input()))
dp = [0] * (S + 1)
dp[0] = 1
acc = 0
for x in range(3, S + 1):
dp[x] = (acc := (acc + dp[x - 3]) % MOD)
print((dp[S]))
if __name__ == '__main__':
main()
| 17 | 16 | 324 | 258 | def main():
MOD = 10**9 + 7
S = int(eval(input()))
dp = [0] * (S + 1)
dp[0] = 1
for x in range(3, S + 1):
# dp[x-3] + dp[x-4] + dp[x-5] + ... + dp[0]
# dp[x-3] + dp[x-1]
dp[x] = (dp[x - 3] + dp[x - 1]) % MOD
print((dp[S]))
if __name__ == "__main__":
main()
| def main():
MOD = 10**9 + 7
S = int(eval(input()))
dp = [0] * (S + 1)
dp[0] = 1
acc = 0
for x in range(3, S + 1):
dp[x] = (acc := (acc + dp[x - 3]) % MOD)
print((dp[S]))
if __name__ == "__main__":
main()
| false | 5.882353 | [
"+ acc = 0",
"- # dp[x-3] + dp[x-4] + dp[x-5] + ... + dp[0]",
"- # dp[x-3] + dp[x-1]",
"- dp[x] = (dp[x - 3] + dp[x - 1]) % MOD",
"+ dp[x] = (acc := (acc + dp[x - 3]) % MOD)"
] | false | 0.037284 | 0.035818 | 1.040952 | [
"s090240153",
"s157313464"
] |
u970308980 | p03241 | python | s389799477 | s467152080 | 187 | 22 | 38,640 | 3,188 | Accepted | Accepted | 88.24 | def divisor(n):
ass = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
ass.append(i)
ass.append(n//i)
return ass
N, M = list(map(int, input().split()))
K = divisor(M)
ans = 0
for k in K:
if N * k <= M:
ans = max(ans, k)
print(ans)
| N, M = list(map(int, input().split()))
# Mの約数列挙
divs = set()
for i in range(1, int(M ** 0.5) + 1):
if M % i == 0:
divs.add(i)
divs.add(M // i)
ans = 0
for d in divs:
if N * d <= M:
ans = max(ans, d)
print(ans)
| 21 | 15 | 311 | 253 | def divisor(n):
ass = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
ass.append(i)
ass.append(n // i)
return ass
N, M = list(map(int, input().split()))
K = divisor(M)
ans = 0
for k in K:
if N * k <= M:
ans = max(ans, k)
print(ans)
| N, M = list(map(int, input().split()))
# Mの約数列挙
divs = set()
for i in range(1, int(M**0.5) + 1):
if M % i == 0:
divs.add(i)
divs.add(M // i)
ans = 0
for d in divs:
if N * d <= M:
ans = max(ans, d)
print(ans)
| false | 28.571429 | [
"-def divisor(n):",
"- ass = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- ass.append(i)",
"- ass.append(n // i)",
"- return ass",
"-",
"-",
"-K = divisor(M)",
"+# Mの約数列挙",
"+divs = set()",
"+for i in range(1, int(M**0.5) + 1):",
... | false | 0.049634 | 0.087933 | 0.564454 | [
"s389799477",
"s467152080"
] |
u450904670 | p03449 | python | s101338565 | s383411303 | 149 | 17 | 12,484 | 3,064 | Accepted | Accepted | 88.59 | import numpy as np
n = int(eval(input()))
a = [ list(map(int, input().split())) for _ in range(2) ]
na = np.array(a)
top_sum = na[0].cumsum()
under_sum = na[1][::-1].cumsum()[::-1]
amount = [top_sum[i] + under_sum[i] for i in range(n)]
print((max(amount))) | def main():
n = int(eval(input()))
a = [ list(map(int, input().split())) for _ in range(2)]
print((problem087c(n, a)))
def problem087c(n, a):
dp = [ [0 for _ in range(n)] for _ in range(2)]
dp[0][0] = a[0][0]
dp[1][0] = dp[0][0] + a[1][0]
for i in range(n - 1):
dp[0][i + 1... | 10 | 14 | 260 | 475 | import numpy as np
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(2)]
na = np.array(a)
top_sum = na[0].cumsum()
under_sum = na[1][::-1].cumsum()[::-1]
amount = [top_sum[i] + under_sum[i] for i in range(n)]
print((max(amount)))
| def main():
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(2)]
print((problem087c(n, a)))
def problem087c(n, a):
dp = [[0 for _ in range(n)] for _ in range(2)]
dp[0][0] = a[0][0]
dp[1][0] = dp[0][0] + a[1][0]
for i in range(n - 1):
dp[0][i + 1] += dp[0][... | false | 28.571429 | [
"-import numpy as np",
"+def main():",
"+ n = int(eval(input()))",
"+ a = [list(map(int, input().split())) for _ in range(2)]",
"+ print((problem087c(n, a)))",
"-n = int(eval(input()))",
"-a = [list(map(int, input().split())) for _ in range(2)]",
"-na = np.array(a)",
"-top_sum = na[0].cumsu... | false | 0.182385 | 0.078684 | 2.317956 | [
"s101338565",
"s383411303"
] |
u804566868 | p03073 | python | s865117090 | s667821273 | 90 | 71 | 6,700 | 4,652 | Accepted | Accepted | 21.11 | mass = eval(input())
mass = list(mass)
count = 0
for i in range(0, len(mass)):
try:
if(mass[i] == mass[i+1]):
mass[i+1] = (int(mass[i+1]) + 1) % 2
mass[i+1] = str(mass[i+1])
count += 1
except IndexError:
print(count)
| mass = eval(input())
mass = list(mass) #入力した文字列をリストで管理する
mass = [int(n) for n in mass]
count = 0
for i in range(0, len(mass)):
try:
if(mass[i] == mass[i+1]): #同じ数字が続くか判定する
mass[i+1] = (mass[i+1] + 1) % 2 #0なら1に、1なら0に数字を入れ替える
count += 1
except IndexError: #すべての文字を比較したとき... | 13 | 12 | 285 | 340 | mass = eval(input())
mass = list(mass)
count = 0
for i in range(0, len(mass)):
try:
if mass[i] == mass[i + 1]:
mass[i + 1] = (int(mass[i + 1]) + 1) % 2
mass[i + 1] = str(mass[i + 1])
count += 1
except IndexError:
print(count)
| mass = eval(input())
mass = list(mass) # 入力した文字列をリストで管理する
mass = [int(n) for n in mass]
count = 0
for i in range(0, len(mass)):
try:
if mass[i] == mass[i + 1]: # 同じ数字が続くか判定する
mass[i + 1] = (mass[i + 1] + 1) % 2 # 0なら1に、1なら0に数字を入れ替える
count += 1
except IndexError: # すべての文字を比較した... | false | 7.692308 | [
"-mass = list(mass)",
"+mass = list(mass) # 入力した文字列をリストで管理する",
"+mass = [int(n) for n in mass]",
"- if mass[i] == mass[i + 1]:",
"- mass[i + 1] = (int(mass[i + 1]) + 1) % 2",
"- mass[i + 1] = str(mass[i + 1])",
"+ if mass[i] == mass[i + 1]: # 同じ数字が続くか判定する",
"+ ... | false | 0.109239 | 0.048785 | 2.239183 | [
"s865117090",
"s667821273"
] |
u968166680 | p02973 | python | s263294294 | s541482138 | 261 | 76 | 71,228 | 12,528 | Accepted | Accepted | 70.88 | import sys
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, *A = list(map(int, read().split()))
dp = [A.pop()]
for a in reversed(A):
if a >= dp[-1]:
... | def main():
import sys
import bisect
read = sys.stdin.buffer.read
bisect_right = bisect.bisect_right
N, *A = list(map(int, read().split()))
dp = [A[-1]]
for a in reversed(A[:-1]):
if a >= dp[-1]:
dp.append(a)
else:
dp[bisect_right(dp, ... | 26 | 22 | 469 | 400 | import sys
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, *A = list(map(int, read().split()))
dp = [A.pop()]
for a in reversed(A):
if a >= dp[-1]:
dp.append(a... | def main():
import sys
import bisect
read = sys.stdin.buffer.read
bisect_right = bisect.bisect_right
N, *A = list(map(int, read().split()))
dp = [A[-1]]
for a in reversed(A[:-1]):
if a >= dp[-1]:
dp.append(a)
else:
dp[bisect_right(dp, a)] = a
prin... | false | 15.384615 | [
"-import sys",
"-from bisect import bisect_right",
"+def main():",
"+ import sys",
"+ import bisect",
"-read = sys.stdin.read",
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-sys.setrecursionlimit(10**9)",
"-INF = 1 << 60",
"-",
"-",
"-def main():",
"+ rea... | false | 0.060365 | 0.036924 | 1.634851 | [
"s263294294",
"s541482138"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.