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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u142903114 | p03448 | python | s789184685 | s011288511 | 49 | 43 | 3,060 | 3,064 | Accepted | Accepted | 12.24 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i_a in range(a + 1):
for i_b in range(b + 1):
for i_c in range(c + 1):
if ((i_a * 500) + (i_b * 100) + (i_c * 50)) == x:
count += 1
print(count) | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i_a in range(a+1):
sum_a = 500 * i_a
for i_b in range(b+1):
sum_b = 100 * i_b
for i_c in range(c+1):
sum_c = 50 * i_c
if x == (sum_a + sum_b + sum_c):
... | 13 | 16 | 280 | 337 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i_a in range(a + 1):
for i_b in range(b + 1):
for i_c in range(c + 1):
if ((i_a * 500) + (i_b * 100) + (i_c * 50)) == x:
count += 1
print(count)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i_a in range(a + 1):
sum_a = 500 * i_a
for i_b in range(b + 1):
sum_b = 100 * i_b
for i_c in range(c + 1):
sum_c = 50 * i_c
if x == (sum_a + sum_b + sum_c):
... | false | 18.75 | [
"+ sum_a = 500 * i_a",
"+ sum_b = 100 * i_b",
"- if ((i_a * 500) + (i_b * 100) + (i_c * 50)) == x:",
"+ sum_c = 50 * i_c",
"+ if x == (sum_a + sum_b + sum_c):"
] | false | 0.086191 | 0.0764 | 1.12816 | [
"s789184685",
"s011288511"
] |
u647766105 | p00096 | python | s212639659 | s146798690 | 1,450 | 100 | 4,720 | 4,336 | Accepted | Accepted | 93.1 | T = 1000
N = 4000
dp = [[0] * (N + 1) for _ in range(5)]
#Java: int[][] dp = new int[5][N];
dp[0][0] = 1
for i in range(1,5):
for j in range(i*T+1):
dp[i][j] = sum([dp[i-1][k] for k in range(max(0,j-T),j+1)])
while True:
try:
n = eval(input())
except EOFError:
break
... | T = 1000
def f(x):
return max(0, T + 1 - abs(T - x))
while True:
try:
n = eval(input())
except EOFError:
break
cnt = 0
for i in range(n+1):
cnt += f(i) * f(n-i)
print(cnt)
#O(n), | 17 | 14 | 350 | 235 | T = 1000
N = 4000
dp = [[0] * (N + 1) for _ in range(5)]
# Java: int[][] dp = new int[5][N];
dp[0][0] = 1
for i in range(1, 5):
for j in range(i * T + 1):
dp[i][j] = sum([dp[i - 1][k] for k in range(max(0, j - T), j + 1)])
while True:
try:
n = eval(input())
except EOFError:
break
... | T = 1000
def f(x):
return max(0, T + 1 - abs(T - x))
while True:
try:
n = eval(input())
except EOFError:
break
cnt = 0
for i in range(n + 1):
cnt += f(i) * f(n - i)
print(cnt)
# O(n),
| false | 17.647059 | [
"-N = 4000",
"-dp = [[0] * (N + 1) for _ in range(5)]",
"-# Java: int[][] dp = new int[5][N];",
"-dp[0][0] = 1",
"-for i in range(1, 5):",
"- for j in range(i * T + 1):",
"- dp[i][j] = sum([dp[i - 1][k] for k in range(max(0, j - T), j + 1)])",
"+",
"+",
"+def f(x):",
"+ return max(0... | false | 3.011568 | 0.037088 | 81.200157 | [
"s212639659",
"s146798690"
] |
u729133443 | p03239 | python | s274225457 | s506097549 | 165 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.09 | i=lambda:list(map(int,input().split()));N,T=i();a=min([2000]+[c for c,t in[i()for _ in[0]*N]if t<=T]);print(('TLE'*(a>1000)or a)) | i=lambda:list(map(int,input().split()));N,T=i();print((min([c for c,t in eval('i(),'*N)if t<=T],default='TLE'))) | 1 | 1 | 121 | 104 | i = lambda: list(map(int, input().split()))
N, T = i()
a = min([2000] + [c for c, t in [i() for _ in [0] * N] if t <= T])
print(("TLE" * (a > 1000) or a))
| i = lambda: list(map(int, input().split()))
N, T = i()
print((min([c for c, t in eval("i()," * N) if t <= T], default="TLE")))
| false | 0 | [
"-a = min([2000] + [c for c, t in [i() for _ in [0] * N] if t <= T])",
"-print((\"TLE\" * (a > 1000) or a))",
"+print((min([c for c, t in eval(\"i(),\" * N) if t <= T], default=\"TLE\")))"
] | false | 0.039959 | 0.034801 | 1.148228 | [
"s274225457",
"s506097549"
] |
u197955752 | p02585 | python | s899110882 | s308632287 | 2,028 | 702 | 144,504 | 80,128 | Accepted | Accepted | 65.38 | from collections import defaultdict
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = max(C[1:])
for init in range(1, N + 1): # 初めの場所をiとする
score = defaultdict(int) # int/bool/list....
visited = [-1] * (N + 1... | N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = max(C[1:])
for init in range(1, N + 1): # 初めの場所をinitとする
score = [0] # k回移動後のスコア
i = init
for k in range(1, K + 1):
i = P[i] # k回移動後に着くところ
... | 46 | 22 | 1,293 | 770 | from collections import defaultdict
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = max(C[1:])
for init in range(1, N + 1): # 初めの場所をiとする
score = defaultdict(int) # int/bool/list....
visited = [-1] * (N + 1)
visit... | N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = max(C[1:])
for init in range(1, N + 1): # 初めの場所をinitとする
score = [0] # k回移動後のスコア
i = init
for k in range(1, K + 1):
i = P[i] # k回移動後に着くところ
score.appe... | false | 52.173913 | [
"-from collections import defaultdict",
"-",
"-for init in range(1, N + 1): # 初めの場所をiとする",
"- score = defaultdict(int) # int/bool/list....",
"- visited = [-1] * (N + 1)",
"- visited[init] = 0 # 何回移動後に着いたか?",
"+for init in range(1, N + 1): # 初めの場所をinitとする",
"+ score = [0] # k回移動後のスコア",... | false | 0.042381 | 0.043388 | 0.976797 | [
"s899110882",
"s308632287"
] |
u390727364 | p02713 | python | s927229756 | s817074878 | 438 | 284 | 74,076 | 72,156 | Accepted | Accepted | 35.16 | from math import factorial
from sys import stdin
def gcd(x, y):
if x % y == 0:
return y
return gcd(y, x % y)
def main():
k = int(stdin.readline())
ans = 0
for a in range(1, k + 1):
for b in range(a, k + 1):
d = gcd(a, b)
for c in rang... | from sys import stdin
def gcd(x, y):
if x % y == 0:
return y
return gcd(y, x % y)
def fact(x):
if x == 1:
return x
return x * fact(x - 1)
def main():
k = int(stdin.readline())
ans = 0
for a in range(1, k + 1):
for b in range(a, k + 1):
... | 28 | 32 | 509 | 549 | from math import factorial
from sys import stdin
def gcd(x, y):
if x % y == 0:
return y
return gcd(y, x % y)
def main():
k = int(stdin.readline())
ans = 0
for a in range(1, k + 1):
for b in range(a, k + 1):
d = gcd(a, b)
for c in range(b, k + 1):
... | from sys import stdin
def gcd(x, y):
if x % y == 0:
return y
return gcd(y, x % y)
def fact(x):
if x == 1:
return x
return x * fact(x - 1)
def main():
k = int(stdin.readline())
ans = 0
for a in range(1, k + 1):
for b in range(a, k + 1):
d = gcd(a, b)
... | false | 12.5 | [
"-from math import factorial",
"+",
"+",
"+def fact(x):",
"+ if x == 1:",
"+ return x",
"+ return x * fact(x - 1)",
"- ans += e * factorial(3) // factorial(3 - len(set([a, b, c])) + 1)",
"+ ans += e * fact(3) // fact(3 - len(set([a, b, c])) + 1)"
] | false | 0.187039 | 0.220328 | 0.848915 | [
"s927229756",
"s817074878"
] |
u225388820 | p02558 | python | s065257385 | s232663579 | 233 | 206 | 80,884 | 85,488 | Accepted | Accepted | 11.59 | class UnionFind:
__slots__ = ["N", "root", "rank"]
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
self.rank = [0] * N
... | class UnionFind:
__slots__ = ["N", "root", "rank"]
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
def __repr__(self):
... | 80 | 75 | 2,098 | 1,930 | class UnionFind:
__slots__ = ["N", "root", "rank"]
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
self.rank = [0] * N
def __repr__(... | class UnionFind:
__slots__ = ["N", "root", "rank"]
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
def __repr__(self):
return "\n".j... | false | 6.25 | [
"- self.rank = [0] * N",
"- \"\"\"x,yが属する木をunion\"\"\"",
"+ \"\"\"x, yが属する木をunion\"\"\"",
"- elif self.rank[x] > self.rank[y]:",
"- self.root[x] += self.root[y]",
"- self.root[y] = x",
"- else:",
"- self.root[y] += self.root[x]",
"-... | false | 0.042189 | 0.042839 | 0.984842 | [
"s065257385",
"s232663579"
] |
u883040023 | p02835 | python | s381892602 | s082772430 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | a = eval(input().replace(" ","+"))
print(((a>21)*"bust" or "win")) | print(((eval(input().replace(" ","+"))>21)*"bust" or "win")) | 2 | 1 | 65 | 58 | a = eval(input().replace(" ", "+"))
print(((a > 21) * "bust" or "win"))
| print(((eval(input().replace(" ", "+")) > 21) * "bust" or "win"))
| false | 50 | [
"-a = eval(input().replace(\" \", \"+\"))",
"-print(((a > 21) * \"bust\" or \"win\"))",
"+print(((eval(input().replace(\" \", \"+\")) > 21) * \"bust\" or \"win\"))"
] | false | 0.043285 | 0.041629 | 1.039775 | [
"s381892602",
"s082772430"
] |
u811733736 | p00100 | python | s946015000 | s857513059 | 50 | 40 | 7,968 | 8,420 | Accepted | Accepted | 20 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0100&lang=jp
"""
import sys
def solve(data):
result = []
total_sales = [0 for _ in range(4000+1)]
for id, unit_price, quantity in data:
total_sales[id] += unit_price * quantity
if total_sales[i... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0100&lang=jp
"""
import sys
from collections import OrderedDict
def solve(data):
# ?£???????1,000,000??\????????????ID?????????
# ??????????????????????????°????????´??????????????????ID?????\???????????????????????... | 45 | 45 | 1,121 | 1,173 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0100&lang=jp
"""
import sys
def solve(data):
result = []
total_sales = [0 for _ in range(4000 + 1)]
for id, unit_price, quantity in data:
total_sales[id] += unit_price * quantity
if total_sales[id] >= 1000... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0100&lang=jp
"""
import sys
from collections import OrderedDict
def solve(data):
# ?£???????1,000,000??\????????????ID?????????
# ??????????????????????????°????????´??????????????????ID?????\?????????????????????????????????... | false | 0 | [
"+from collections import OrderedDict",
"- result = []",
"- total_sales = [0 for _ in range(4000 + 1)]",
"- for id, unit_price, quantity in data:",
"- total_sales[id] += unit_price * quantity",
"- if total_sales[id] >= 1000000:",
"- if id not in result:",
"- ... | false | 0.043865 | 0.043267 | 1.013813 | [
"s946015000",
"s857513059"
] |
u424768586 | p02586 | python | s545581790 | s758625368 | 1,692 | 1,493 | 177,220 | 174,060 | Accepted | Accepted | 11.76 | import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | 93 | 94 | 3,117 | 3,173 | import sys
sys.setrecursionlimit(10**7) # 再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2分探索
# bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | import sys
sys.setrecursionlimit(10**7) # 再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2分探索
# bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | false | 1.06383 | [
"- dp = [0] * C",
"+ dp = [[0] * 4 for _ in range(C)]",
"+ dpi = [[0] * 4 for _ in range(C)]",
"- dpi = [[0] * 4 for _ in range(C)]",
"+ else:",
"+ dpi[0] = [0] * 4"
] | false | 0.040211 | 0.05167 | 0.778237 | [
"s545581790",
"s758625368"
] |
u334712262 | p02564 | python | s825991831 | s848330559 | 2,415 | 2,030 | 381,968 | 379,424 | Accepted | Accepted | 15.94 |
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
def scc(V, E):
g = defaultdict(list)
rg = defaultdict(list)
for u, v in E:
g[u].append(v)
rg[v].append(u)
def dfs(u, done, o):
done.add(u)
for v in g[u]:
if v in done... |
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
def scc(V, E):
g = defaultdict(list)
rg = defaultdict(list)
for u, v in E:
g[u].append(v)
rg[v].append(u)
o = []
visited = set()
used = set()
for u in V:
if u in visited:
... | 87 | 122 | 1,567 | 2,303 | from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
def scc(V, E):
g = defaultdict(list)
rg = defaultdict(list)
for u, v in E:
g[u].append(v)
rg[v].append(u)
def dfs(u, done, o):
done.add(u)
for v in g[u]:
if v in done:
... | from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
def scc(V, E):
g = defaultdict(list)
rg = defaultdict(list)
for u, v in E:
g[u].append(v)
rg[v].append(u)
o = []
visited = set()
used = set()
for u in V:
if u in visited:
contin... | false | 28.688525 | [
"+ o = []",
"+ visited = set()",
"+ used = set()",
"+ for u in V:",
"+ if u in visited:",
"+ continue",
"+ s = [(u, True)]",
"+ while s:",
"+ u, f = s.pop()",
"+ if f:",
"+ if u in visited:",
"+ ... | false | 0.047553 | 0.049565 | 0.9594 | [
"s825991831",
"s848330559"
] |
u681444474 | p03037 | python | s037320250 | s247959715 | 351 | 229 | 29,088 | 87,396 | Accepted | Accepted | 34.76 | n,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
L.append(l[i][0])
R.append(l[i][1])
print((max(min(R)-max(L)+1,0))) | # coding: utf-8
n, m = list(map(int,input().split()))
r = float('inf')
l = 0
L = []
for i in range(m):
l_, r_ = list(map(int,input().split()))
L.append([l_,r_])
l = max(l_, l)
r = min(r_, r)
ans = 0
print((max(0, r-l+1))) | 8 | 12 | 187 | 234 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
L = []
R = []
for i in range(m):
L.append(l[i][0])
R.append(l[i][1])
print((max(min(R) - max(L) + 1, 0)))
| # coding: utf-8
n, m = list(map(int, input().split()))
r = float("inf")
l = 0
L = []
for i in range(m):
l_, r_ = list(map(int, input().split()))
L.append([l_, r_])
l = max(l_, l)
r = min(r_, r)
ans = 0
print((max(0, r - l + 1)))
| false | 33.333333 | [
"+# coding: utf-8",
"-l = [list(map(int, input().split())) for i in range(m)]",
"+r = float(\"inf\")",
"+l = 0",
"-R = []",
"- L.append(l[i][0])",
"- R.append(l[i][1])",
"-print((max(min(R) - max(L) + 1, 0)))",
"+ l_, r_ = list(map(int, input().split()))",
"+ L.append([l_, r_])",
"+ ... | false | 0.096856 | 0.035738 | 2.710151 | [
"s037320250",
"s247959715"
] |
u481250941 | p04045 | python | s962308847 | s679159867 | 127 | 113 | 16,188 | 16,200 | Accepted | Accepted | 11.02 | #
# abc042 c
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
ou... | #
# abc042 c
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
ou... | 50 | 48 | 1,074 | 1,036 | #
# abc042 c
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.r... | #
# abc042 c
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.r... | false | 4 | [
"- for i in range(100000):",
"- if i < N:",
"- continue",
"+ for i in range(N, 10 * N + 1):"
] | false | 0.116366 | 0.118358 | 0.983172 | [
"s962308847",
"s679159867"
] |
u385244248 | p03164 | python | s909020199 | s054533089 | 1,093 | 566 | 319,696 | 170,760 | Accepted | Accepted | 48.22 | import sys
import math
from collections import deque
import copy
INF = float("inf")
N, W = list(map(int, input().split()))
weight = []
value = []
for i in range(N):
tempW, tempV = list(map(int, input().split()))
weight.append(tempW)
value.append(tempV)
dp = [[INF for _ in range(N * 1000 + 1)] ... | import sys
import math
from collections import deque
import copy
input = sys.stdin.readline
INF = 10**9+7
N, W = list(map(int, input().split()))
weight = []
value = []
for i in range(N):
tempW, tempV = list(map(int, input().split()))
weight.append(tempW)
value.append(tempV)
dp = [[INF for _ i... | 26 | 27 | 666 | 689 | import sys
import math
from collections import deque
import copy
INF = float("inf")
N, W = list(map(int, input().split()))
weight = []
value = []
for i in range(N):
tempW, tempV = list(map(int, input().split()))
weight.append(tempW)
value.append(tempV)
dp = [[INF for _ in range(N * 1000 + 1)] for _ in rang... | import sys
import math
from collections import deque
import copy
input = sys.stdin.readline
INF = 10**9 + 7
N, W = list(map(int, input().split()))
weight = []
value = []
for i in range(N):
tempW, tempV = list(map(int, input().split()))
weight.append(tempW)
value.append(tempV)
dp = [[INF for _ in range(N * ... | false | 3.703704 | [
"-INF = float(\"inf\")",
"+input = sys.stdin.readline",
"+INF = 10**9 + 7"
] | false | 0.059231 | 0.071498 | 0.828432 | [
"s909020199",
"s054533089"
] |
u001024152 | p02780 | python | s535620609 | s919662550 | 206 | 170 | 23,524 | 25,060 | Accepted | Accepted | 17.48 | N, K = list(map(int, input().split()))
p = list([(int(x)+1)/2 for x in input().split()])
_sum = sum(p[:K])
ans = _sum
for i in range(N-K):
_sum -= p[i]
_sum += p[i+K]
ans = max(ans, _sum)
print(ans)
| N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
s = sum((pi+1)/2 for pi in p[:K])
m = s
for i, pi in enumerate(p):
if i < K:
continue
s -= (p[i-K]+1)/2
s += (p[i]+1)/2
if s > m:
m = s
print(m)
| 10 | 14 | 220 | 261 | N, K = list(map(int, input().split()))
p = list([(int(x) + 1) / 2 for x in input().split()])
_sum = sum(p[:K])
ans = _sum
for i in range(N - K):
_sum -= p[i]
_sum += p[i + K]
ans = max(ans, _sum)
print(ans)
| N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
s = sum((pi + 1) / 2 for pi in p[:K])
m = s
for i, pi in enumerate(p):
if i < K:
continue
s -= (p[i - K] + 1) / 2
s += (p[i] + 1) / 2
if s > m:
m = s
print(m)
| false | 28.571429 | [
"-p = list([(int(x) + 1) / 2 for x in input().split()])",
"-_sum = sum(p[:K])",
"-ans = _sum",
"-for i in range(N - K):",
"- _sum -= p[i]",
"- _sum += p[i + K]",
"- ans = max(ans, _sum)",
"-print(ans)",
"+p = list(map(int, input().split()))",
"+s = sum((pi + 1) / 2 for pi in p[:K])",
"+... | false | 0.038406 | 0.076858 | 0.499699 | [
"s535620609",
"s919662550"
] |
u527993431 | p02881 | python | s864616366 | s348911402 | 166 | 153 | 3,060 | 3,060 | Accepted | Accepted | 7.83 | import math
A = int(eval(input()))
B = int(math.sqrt(A))
count = 0
for i in reversed(list(range(1,B+1))):
if count == 0:
if A % i == 0:
print((int(i+A/i-2)))
count += 1 | import math
N=int(eval(input()))
P=math.sqrt(N)
C=float("inf")
for i in range (1,int(P+1)):
if N%i==0:
C=min(C,(i+N//i))
print((C-2)) | 9 | 9 | 171 | 137 | import math
A = int(eval(input()))
B = int(math.sqrt(A))
count = 0
for i in reversed(list(range(1, B + 1))):
if count == 0:
if A % i == 0:
print((int(i + A / i - 2)))
count += 1
| import math
N = int(eval(input()))
P = math.sqrt(N)
C = float("inf")
for i in range(1, int(P + 1)):
if N % i == 0:
C = min(C, (i + N // i))
print((C - 2))
| false | 0 | [
"-A = int(eval(input()))",
"-B = int(math.sqrt(A))",
"-count = 0",
"-for i in reversed(list(range(1, B + 1))):",
"- if count == 0:",
"- if A % i == 0:",
"- print((int(i + A / i - 2)))",
"- count += 1",
"+N = int(eval(input()))",
"+P = math.sqrt(N)",
"+C = float(\"... | false | 0.093989 | 0.096186 | 0.977166 | [
"s864616366",
"s348911402"
] |
u883040023 | p02713 | python | s926214334 | s759253945 | 1,026 | 530 | 69,844 | 67,800 | Accepted | Accepted | 48.34 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
k = int(eval(input()))
ans = 0
for x in range(1,k+1):
for y in range(1,k+1):
for z in range(1,k+1):
ans += gcd(x,y,z)
print(ans)
| k = int(eval(input()))
ans = 0
import math
for i in range(1,k+1):
for j in range(1,k+1):
for k in range(1,k+1):
ans += math.gcd(i,math.gcd(j,k))
print(ans) | 15 | 11 | 274 | 198 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
k = int(eval(input()))
ans = 0
for x in range(1, k + 1):
for y in range(1, k + 1):
for z in range(1, k + 1):
ans += gcd(x, y, z)
print(ans)
| k = int(eval(input()))
ans = 0
import math
for i in range(1, k + 1):
for j in range(1, k + 1):
for k in range(1, k + 1):
ans += math.gcd(i, math.gcd(j, k))
print(ans)
| false | 26.666667 | [
"-import math",
"-from functools import reduce",
"-",
"-",
"-def gcd(*numbers):",
"- return reduce(math.gcd, numbers)",
"-",
"-",
"-for x in range(1, k + 1):",
"- for y in range(1, k + 1):",
"- for z in range(1, k + 1):",
"- ans += gcd(x, y, z)",
"+import math",
"+"... | false | 0.045224 | 0.039032 | 1.15865 | [
"s926214334",
"s759253945"
] |
u054514819 | p03546 | python | s157290272 | s994648723 | 192 | 102 | 41,308 | 75,704 | Accepted | Accepted | 46.88 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = []
for _ in range(H):
A += list(map(int, input().split()))
for i in range(10):
for j in range(10):
for k in range(10):
C[j][k] = min(C[j][k], C[j][i]+C[i][k])
from collections i... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from heapq import heappop, heappush
H, W = mapint()
Cs = [list(mapint()) for _ in range(10)]
lis = []
for h in range(H):
lis.extend(list(mapint()))
def dijkstra... | 20 | 35 | 459 | 776 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = []
for _ in range(H):
A += list(map(int, input().split()))
for i in range(10):
for j in range(10):
for k in range(10):
C[j][k] = min(C[j][k], C[j][i] + C[i][k])
from collections import Counter... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from heapq import heappop, heappush
H, W = mapint()
Cs = [list(mapint()) for _ in range(10)]
lis = []
for h in range(H):
lis.extend(list(mapint()))
def dijks... | false | 42.857143 | [
"-H, W = list(map(int, input().split()))",
"-C = [list(map(int, input().split())) for _ in range(10)]",
"-A = []",
"-for _ in range(H):",
"- A += list(map(int, input().split()))",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint(... | false | 0.036519 | 0.037435 | 0.975545 | [
"s157290272",
"s994648723"
] |
u521602455 | p02813 | python | s487212248 | s041649534 | 108 | 27 | 4,668 | 8,052 | Accepted | Accepted | 75 | N=int(eval(input()))
P=list(input().split())
Q=list(input().split())
P=int(''.join(P))
Q=int(''.join(Q))
n=[i for i in range(1,N+1)]
A=[]
def dps(n,A,me):
if len(n)==0:
A.append(me)
return
else:
for i in range(0, len(n)):
t=n.pop(i)
dps(n, A, me*10+t... | N=int(eval(input()))
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
import itertools
l=list(itertools.permutations([i for i in range(1, N+1)]))
print((abs(l.index(P)-l.index(Q))))
| 18 | 6 | 390 | 198 | N = int(eval(input()))
P = list(input().split())
Q = list(input().split())
P = int("".join(P))
Q = int("".join(Q))
n = [i for i in range(1, N + 1)]
A = []
def dps(n, A, me):
if len(n) == 0:
A.append(me)
return
else:
for i in range(0, len(n)):
t = n.pop(i)
dps(n,... | N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
import itertools
l = list(itertools.permutations([i for i in range(1, N + 1)]))
print((abs(l.index(P) - l.index(Q))))
| false | 66.666667 | [
"-P = list(input().split())",
"-Q = list(input().split())",
"-P = int(\"\".join(P))",
"-Q = int(\"\".join(Q))",
"-n = [i for i in range(1, N + 1)]",
"-A = []",
"+P = tuple(map(int, input().split()))",
"+Q = tuple(map(int, input().split()))",
"+import itertools",
"-",
"-def dps(n, A, me):",
"- ... | false | 0.128067 | 0.126209 | 1.014724 | [
"s487212248",
"s041649534"
] |
u407160848 | p03013 | python | s394190126 | s230557089 | 245 | 112 | 52,316 | 10,800 | Accepted | Accepted | 54.29 | import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def s(generator, splitter, mapper):
return [ mapper(s) for s in generator().split(splitter) ]
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [ int(s) for s in input().split(" ")]... | import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def s(generator, splitter, mapper):
return [ mapper(s) for s in generator().split(splitter) ]
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [ int(s) for s in input().split(" ")]... | 43 | 43 | 816 | 831 | import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def s(generator, splitter, mapper):
return [mapper(s) for s in generator().split(splitter)]
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [int(s) for s in input().split(" ")]
# 改行区切りの... | import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def s(generator, splitter, mapper):
return [mapper(s) for s in generator().split(splitter)]
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [int(s) for s in input().split(" ")]
# 改行区切りの... | false | 0 | [
"-breaks = list(map(int, sys.stdin.readlines()))",
"+breaks = list(map(int, sys.stdin.readlines())) if m > 0 else []"
] | false | 0.079236 | 0.04384 | 1.807396 | [
"s394190126",
"s230557089"
] |
u923270446 | p02559 | python | s535339992 | s684806982 | 4,458 | 1,438 | 68,784 | 132,332 | Accepted | Accepted | 67.74 | n, q = list(map(int, input().split()))
BIT = [0] * (n + 1)
def add(i, x):
while i <= n:
BIT[i] += x
i += i & -i
def query(i):
s = 0
while i > 0:
s += BIT[i]
i -= i & -i
return s
a = list(map(int, input().split()))
for i in range(n):
add(i + 1, a[i])
for... | class BinaryIndexedTree():
def __init__(self, n):
self.n = n
self.BIT = [0] * (self.n + 1)
def add(self, i, x):
while i <= self.n:
self.BIT[i] += x
i += i & -i
def query(self, i):
res = 0
while i > 0:
res += self.BIT[i]
... | 21 | 25 | 456 | 667 | n, q = list(map(int, input().split()))
BIT = [0] * (n + 1)
def add(i, x):
while i <= n:
BIT[i] += x
i += i & -i
def query(i):
s = 0
while i > 0:
s += BIT[i]
i -= i & -i
return s
a = list(map(int, input().split()))
for i in range(n):
add(i + 1, a[i])
for i in ran... | class BinaryIndexedTree:
def __init__(self, n):
self.n = n
self.BIT = [0] * (self.n + 1)
def add(self, i, x):
while i <= self.n:
self.BIT[i] += x
i += i & -i
def query(self, i):
res = 0
while i > 0:
res += self.BIT[i]
... | false | 16 | [
"-n, q = list(map(int, input().split()))",
"-BIT = [0] * (n + 1)",
"+class BinaryIndexedTree:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.BIT = [0] * (self.n + 1)",
"+",
"+ def add(self, i, x):",
"+ while i <= self.n:",
"+ self.BIT[i] += x",
"+ ... | false | 0.074608 | 0.03583 | 2.082312 | [
"s535339992",
"s684806982"
] |
u397496203 | p03805 | python | s366220398 | s554121208 | 516 | 249 | 3,436 | 3,440 | Accepted | Accepted | 51.74 | from itertools import permutations
from copy import deepcopy
N,M = [int(i) for i in input().split()]
links = [[int(i) for i in input().split()] for _ in range(M)]
ans = 0
for path in permutations(list(range(2,N+1))):
l = deepcopy(links)
p_node = 1
for n_node in path:
if sorted([p_nod... | from itertools import permutations
from copy import deepcopy
N,M = [int(i) for i in input().split()]
links = set([input().strip() for _ in range(M)])
ans = 0
for path in permutations(list(range(2,N+1))):
l = deepcopy(links)
p_node = 1
for n_node in path:
e_l = " ".join([str(s) for s ... | 21 | 23 | 514 | 520 | from itertools import permutations
from copy import deepcopy
N, M = [int(i) for i in input().split()]
links = [[int(i) for i in input().split()] for _ in range(M)]
ans = 0
for path in permutations(list(range(2, N + 1))):
l = deepcopy(links)
p_node = 1
for n_node in path:
if sorted([p_node, n_node])... | from itertools import permutations
from copy import deepcopy
N, M = [int(i) for i in input().split()]
links = set([input().strip() for _ in range(M)])
ans = 0
for path in permutations(list(range(2, N + 1))):
l = deepcopy(links)
p_node = 1
for n_node in path:
e_l = " ".join([str(s) for s in sorted([... | false | 8.695652 | [
"-links = [[int(i) for i in input().split()] for _ in range(M)]",
"+links = set([input().strip() for _ in range(M)])",
"- if sorted([p_node, n_node]) in l:",
"- l.pop(l.index(sorted([p_node, n_node])))",
"+ e_l = \" \".join([str(s) for s in sorted([p_node, n_node])])",
"+ i... | false | 0.006245 | 0.047317 | 0.131981 | [
"s366220398",
"s554121208"
] |
u642874916 | p02714 | python | s957115776 | s566927803 | 351 | 193 | 70,416 | 69,652 | Accepted | Accepted | 45.01 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I(): return int(eval(input()))
def S(): return eval(input())... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I(): return int(input())
def S(): return input()
def MI... | 117 | 96 | 2,679 | 1,846 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I():
return int(eval(input()))
def S():
return eval(input())
def... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I():
return int(input())
def S():
return input()
def MI():
r... | false | 17.948718 | [
"- return int(eval(input()))",
"+ return int(input())",
"- return eval(input())",
"+ return input()",
"- return list(map(int, input().split()))",
"+ return map(int, input().split())",
"- return list(map(str, input().split()))",
"+ return map(str, input().split())",
"- retu... | false | 0.042618 | 0.040945 | 1.040865 | [
"s957115776",
"s566927803"
] |
u957616073 | p02923 | python | s065768740 | s068471777 | 93 | 82 | 14,224 | 14,224 | Accepted | Accepted | 11.83 | eval(input())
x = [int(i) for i in input().split(" ")]
steps = []
res, c = 0, 0
for i in range(len(x)-1):
steps.append(x[i] - x[i+1])
for i in steps:
if i >= 0:
c += 1
else:
c = 0
if c > res:
res = c
print(res)
| eval(input())
x = [int(i) for i in input().split(" ")]
steps = []
res, c = 0, 0
for i in range(len(x)-1):
if x[i] - x[i+1] >= 0:
c += 1
else:
c = 0
if c > res:
res = c
print(res) | 15 | 12 | 241 | 201 | eval(input())
x = [int(i) for i in input().split(" ")]
steps = []
res, c = 0, 0
for i in range(len(x) - 1):
steps.append(x[i] - x[i + 1])
for i in steps:
if i >= 0:
c += 1
else:
c = 0
if c > res:
res = c
print(res)
| eval(input())
x = [int(i) for i in input().split(" ")]
steps = []
res, c = 0, 0
for i in range(len(x) - 1):
if x[i] - x[i + 1] >= 0:
c += 1
else:
c = 0
if c > res:
res = c
print(res)
| false | 20 | [
"- steps.append(x[i] - x[i + 1])",
"-for i in steps:",
"- if i >= 0:",
"+ if x[i] - x[i + 1] >= 0:"
] | false | 0.040688 | 0.05647 | 0.720516 | [
"s065768740",
"s068471777"
] |
u488127128 | p03221 | python | s252155368 | s697360238 | 452 | 362 | 33,856 | 31,496 | Accepted | Accepted | 19.91 | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
A = []
B = [''] * m
for i in range(m):
p, y = list(map(int, input().split()))
A.append([p,y,i])
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
... | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
A = []
B = [''] * m
for i in range(m):
p, y = list(map(int, input().split()))
A += [(p, y, i)]
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
... | 25 | 25 | 532 | 531 | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
A = []
B = [""] * m
for i in range(m):
p, y = list(map(int, input().split()))
A.append([p, y, i])
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
B[a[2... | import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
A = []
B = [""] * m
for i in range(m):
p, y = list(map(int, input().split()))
A += [(p, y, i)]
A.sort()
count = 0
i, x = 1, 1
for a in A:
if a[0] == i:
B[a[2]] ... | false | 0 | [
"- A.append([p, y, i])",
"+ A += [(p, y, i)]"
] | false | 0.050079 | 0.05197 | 0.963614 | [
"s252155368",
"s697360238"
] |
u535803878 | p02679 | python | s655548295 | s033722734 | 1,054 | 633 | 93,512 | 194,568 | Accepted | Accepted | 39.94 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
import bisect
from math import gcd
n = int(eval(input()))
l = [None] * n
for i in range(n):
a,b = list(map(int, input().split()))
g = gcd(a,b)
if g==0... | import math
n = int(eval(input()))
from collections import defaultdict
d = defaultdict(list)
s = set()
zc = 0
for i in range(n):
a,b = list(map(int, input().split()))
g = math.gcd(a,b)
if g!=0:
a //= g; b //= g
if a<0:
a,b = -a, -b
elif a==0 and b<0:
... | 65 | 39 | 1,349 | 816 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
import bisect
from math import gcd
n = int(eval(input()))
l = [None] * n
for i in range(n):
a, b = list(map(int, input().split()))
g = gcd(a, b)
if g == 0:
... | import math
n = int(eval(input()))
from collections import defaultdict
d = defaultdict(list)
s = set()
zc = 0
for i in range(n):
a, b = list(map(int, input().split()))
g = math.gcd(a, b)
if g != 0:
a //= g
b //= g
if a < 0:
a, b = -a, -b
elif a == 0 and b < 0:
... | false | 40 | [
"-import sys",
"-",
"-input = lambda: sys.stdin.readline().rstrip()",
"-sys.setrecursionlimit(max(1000, 10**9))",
"-write = lambda x: sys.stdout.write(x + \"\\n\")",
"-import bisect",
"-from math import gcd",
"+import math",
"-l = [None] * n",
"+from collections import defaultdict",
"+",
"+d =... | false | 0.046974 | 0.042683 | 1.100545 | [
"s655548295",
"s033722734"
] |
u949338836 | p02271 | python | s263109813 | s515465630 | 4,200 | 500 | 45,016 | 7,700 | Accepted | Accepted | 88.1 | #coding:utf-8
#1_5_A
from itertools import combinations
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
ms = list(map(int, input().split()))
numbers = []
for i in range(1, n+1):
for com in combinations(A, i):
numbers.append(sum(com))
for m in ms:
if m ... | #coding:utf-8
#1_5_A
from itertools import combinations
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
ms = list(map(int, input().split()))
numbers = set()
for i in range(1, n+1):
for com in combinations(A, i):
numbers.add(sum(com))
for m in ms:
if m ... | 19 | 19 | 373 | 373 | # coding:utf-8
# 1_5_A
from itertools import combinations
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
ms = list(map(int, input().split()))
numbers = []
for i in range(1, n + 1):
for com in combinations(A, i):
numbers.append(sum(com))
for m in ms:
if m in numbers:
... | # coding:utf-8
# 1_5_A
from itertools import combinations
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
ms = list(map(int, input().split()))
numbers = set()
for i in range(1, n + 1):
for com in combinations(A, i):
numbers.add(sum(com))
for m in ms:
if m in numbers:
... | false | 0 | [
"-numbers = []",
"+numbers = set()",
"- numbers.append(sum(com))",
"+ numbers.add(sum(com))"
] | false | 0.040925 | 0.045099 | 0.907445 | [
"s263109813",
"s515465630"
] |
u401686269 | p02564 | python | s980828109 | s683007287 | 4,299 | 3,785 | 254,532 | 219,224 | Accepted | Accepted | 11.96 | N,M = list(map(int,input().split()))
G1 = [[] for _ in range(N)]
G2 = [[] for _ in range(N)]
for i in range(M):
a,b=list(map(int,input().split()))
if a == b:continue
G1[a].append(b)
G2[b].append(a)
def dfs(a0):
global order
todo = [~a0, a0]
while todo:
a = todo.pop()
i... | N,M = list(map(int,input().split()))
G1 = [[] for _ in range(N)]
G2 = [[] for _ in range(N)]
for i in range(M):
a,b=list(map(int,input().split()))
G1[a].append(b)
G2[b].append(a)
def argsort(arr, reverse=False, shift=20):
N = len(arr)
tmp=[0]*N
for i in range(N):
tmp[i] = (arr[i... | 56 | 75 | 1,194 | 1,716 | N, M = list(map(int, input().split()))
G1 = [[] for _ in range(N)]
G2 = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
if a == b:
continue
G1[a].append(b)
G2[b].append(a)
def dfs(a0):
global order
todo = [~a0, a0]
while todo:
a = todo.pop()... | N, M = list(map(int, input().split()))
G1 = [[] for _ in range(N)]
G2 = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
G1[a].append(b)
G2[b].append(a)
def argsort(arr, reverse=False, shift=20):
N = len(arr)
tmp = [0] * N
for i in range(N):
tmp[i] = (ar... | false | 25.333333 | [
"- if a == b:",
"- continue",
"-def dfs(a0):",
"- global order",
"+def argsort(arr, reverse=False, shift=20):",
"+ N = len(arr)",
"+ tmp = [0] * N",
"+ for i in range(N):",
"+ tmp[i] = (arr[i] << shift) | i",
"+ tmp = sorted(tmp, reverse=reverse)",
"+ out = [0]... | false | 0.036397 | 0.037289 | 0.976094 | [
"s980828109",
"s683007287"
] |
u074220993 | p03546 | python | s946131958 | s088565636 | 272 | 42 | 38,212 | 12,400 | Accepted | Accepted | 84.56 | import numpy as np
H, W = (int(x) for x in input().split())
C = np.array([[int(x) for x in input().split()] for _ in range(10)])
A = [[int(x) if int(x) >= 0 else 1 for x in input().split()] for _ in range(H)]
from scipy.sparse.csgraph import dijkstra
C = dijkstra(C,directed=True) #有向グラフの経路圧縮(ダイクストラ法)
ans = sum(su... | from collections import Counter
from itertools import product
def main():
with open(0) as f:
H, W = list(map(int, f.readline().split()))
C = [list(map(int, f.readline().split())) for _ in range(10)]
A = Counter(list(map(int, f.read().split())))
r10 = list(range(10))
for ... | 8 | 17 | 358 | 484 | import numpy as np
H, W = (int(x) for x in input().split())
C = np.array([[int(x) for x in input().split()] for _ in range(10)])
A = [[int(x) if int(x) >= 0 else 1 for x in input().split()] for _ in range(H)]
from scipy.sparse.csgraph import dijkstra
C = dijkstra(C, directed=True) # 有向グラフの経路圧縮(ダイクストラ法)
ans = sum(sum... | from collections import Counter
from itertools import product
def main():
with open(0) as f:
H, W = list(map(int, f.readline().split()))
C = [list(map(int, f.readline().split())) for _ in range(10)]
A = Counter(list(map(int, f.read().split())))
r10 = list(range(10))
for k, i, j in ... | false | 52.941176 | [
"-import numpy as np",
"+from collections import Counter",
"+from itertools import product",
"-H, W = (int(x) for x in input().split())",
"-C = np.array([[int(x) for x in input().split()] for _ in range(10)])",
"-A = [[int(x) if int(x) >= 0 else 1 for x in input().split()] for _ in range(H)]",
"-from sc... | false | 0.343497 | 0.112224 | 3.060806 | [
"s946131958",
"s088565636"
] |
u757274384 | p02899 | python | s596404779 | s914344778 | 104 | 88 | 13,812 | 19,524 | Accepted | Accepted | 15.38 | n = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * n
for i,val in enumerate(A):
L[val-1] = i + 1
print((*L))
| n = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
ans[A[i]-1] = i+1
ANS = [str(ans[i]) for i in range(n)]
print((" ".join(ANS))) | 8 | 8 | 126 | 174 | n = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * n
for i, val in enumerate(A):
L[val - 1] = i + 1
print((*L))
| n = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
ans[A[i] - 1] = i + 1
ANS = [str(ans[i]) for i in range(n)]
print((" ".join(ANS)))
| false | 0 | [
"-L = [0] * n",
"-for i, val in enumerate(A):",
"- L[val - 1] = i + 1",
"-print((*L))",
"+ans = [0] * n",
"+for i in range(n):",
"+ ans[A[i] - 1] = i + 1",
"+ANS = [str(ans[i]) for i in range(n)]",
"+print((\" \".join(ANS)))"
] | false | 0.060309 | 0.121825 | 0.495044 | [
"s596404779",
"s914344778"
] |
u721425712 | p02813 | python | s173295425 | s368821741 | 56 | 38 | 8,316 | 6,040 | Accepted | Accepted | 32.14 | import itertools
n = int(eval(input()))
p = list(input().split())
q = list(input().split())
def dic(z):
# sorted(list(itertools.permutations(z))) の中に辞書順に並べられた順列が入っている
return sorted(list(itertools.permutations(z))).index(tuple(z)) + 1
print((abs(dic(p) - dic(q)))) | n = int(eval(input()))
p = eval(input())
q = eval(input())
import itertools
l = []
for i in range(1, n+1):
l.append(str(i))
ans = []
for v in itertools.permutations(l):
ans.append(" ".join(v))
a = ans.index(p)
b = ans.index(q)
print((abs(a-b))) | 11 | 17 | 278 | 252 | import itertools
n = int(eval(input()))
p = list(input().split())
q = list(input().split())
def dic(z):
# sorted(list(itertools.permutations(z))) の中に辞書順に並べられた順列が入っている
return sorted(list(itertools.permutations(z))).index(tuple(z)) + 1
print((abs(dic(p) - dic(q))))
| n = int(eval(input()))
p = eval(input())
q = eval(input())
import itertools
l = []
for i in range(1, n + 1):
l.append(str(i))
ans = []
for v in itertools.permutations(l):
ans.append(" ".join(v))
a = ans.index(p)
b = ans.index(q)
print((abs(a - b)))
| false | 35.294118 | [
"+n = int(eval(input()))",
"+p = eval(input())",
"+q = eval(input())",
"-n = int(eval(input()))",
"-p = list(input().split())",
"-q = list(input().split())",
"-",
"-",
"-def dic(z):",
"- # sorted(list(itertools.permutations(z))) の中に辞書順に並べられた順列が入っている",
"- return sorted(list(itertools.permut... | false | 0.038764 | 0.038078 | 1.017991 | [
"s173295425",
"s368821741"
] |
u102461423 | p02881 | python | s544405648 | s077222678 | 197 | 172 | 30,068 | 29,012 | Accepted | Accepted | 12.69 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
U = 10**6 + 100
div = np.arange(1,U,dtype=np.int64)
div = div[N%div==0]
answer = (div + (N//div)).min() - 2
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
U = 10**6 + 100
x = np.arange(1,U,dtype=np.int64)
div = x[N%x==0]
answer = (div + (N//div)).min() - 2
print(answer)
| 14 | 14 | 293 | 287 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
U = 10**6 + 100
div = np.arange(1, U, dtype=np.int64)
div = div[N % div == 0]
answer = (div + (N // div)).min() - 2
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
U = 10**6 + 100
x = np.arange(1, U, dtype=np.int64)
div = x[N % x == 0]
answer = (div + (N // div)).min() - 2
print(answer)
| false | 0 | [
"-div = np.arange(1, U, dtype=np.int64)",
"-div = div[N % div == 0]",
"+x = np.arange(1, U, dtype=np.int64)",
"+div = x[N % x == 0]"
] | false | 0.714308 | 0.617676 | 1.156445 | [
"s544405648",
"s077222678"
] |
u782685137 | p03418 | python | s236730742 | s542742152 | 593 | 456 | 3,316 | 3,060 | Accepted | Accepted | 23.1 | n,k=list(map(int,input().split()))
r=0
for q in range(n+1):
if q==0:
for b in range(1,n+1):r+=max(min(b,k)-1,0)
else:
for b in range(1,n//q+1):r+=min(k,n-q*b+1,b)
print((n*n-r)) | def main():
n,k=list(map(int,input().split()))
r=0
for q in range(n+1):
if q==0:
for b in range(1,n+1):r+=max(min(b,k)-1,0)
else:
for b in range(1,n//q+1):r+=min(k,n-q*b+1,b)
print((n*n-r))
if __name__=="__main__":
main() | 8 | 12 | 200 | 267 | n, k = list(map(int, input().split()))
r = 0
for q in range(n + 1):
if q == 0:
for b in range(1, n + 1):
r += max(min(b, k) - 1, 0)
else:
for b in range(1, n // q + 1):
r += min(k, n - q * b + 1, b)
print((n * n - r))
| def main():
n, k = list(map(int, input().split()))
r = 0
for q in range(n + 1):
if q == 0:
for b in range(1, n + 1):
r += max(min(b, k) - 1, 0)
else:
for b in range(1, n // q + 1):
r += min(k, n - q * b + 1, b)
print((n * n - r))
... | false | 33.333333 | [
"-n, k = list(map(int, input().split()))",
"-r = 0",
"-for q in range(n + 1):",
"- if q == 0:",
"- for b in range(1, n + 1):",
"- r += max(min(b, k) - 1, 0)",
"- else:",
"- for b in range(1, n // q + 1):",
"- r += min(k, n - q * b + 1, b)",
"-print((n * n ... | false | 0.113302 | 0.080481 | 1.407815 | [
"s236730742",
"s542742152"
] |
u189023301 | p02972 | python | s072937193 | s352987963 | 765 | 238 | 13,496 | 13,108 | Accepted | Accepted | 68.89 | n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
p = n // i
a = 0
for j in range(p):
a += val[i * (j + 1) - 1]
if a % 2 == lis[i - 1]:
val[i -... | n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
a = sum(val[i - 1::i])
if a % 2 == lis[i - 1]:
val[i - 1] = 0
else:
val[i - 1] = 1
print(sum(val))
... | 24 | 16 | 519 | 379 | n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
p = n // i
a = 0
for j in range(p):
a += val[i * (j + 1) - 1]
if a % 2 == lis[i - 1]:
val[i - 1] = 0
... | n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
a = sum(val[i - 1 :: i])
if a % 2 == lis[i - 1]:
val[i - 1] = 0
else:
val[i - 1] = 1
print(sum(val))
print(*[i + 1 ... | false | 33.333333 | [
"- p = n // i",
"- a = 0",
"- for j in range(p):",
"- a += val[i * (j + 1) - 1]",
"+ a = sum(val[i - 1 :: i])",
"-t = sum(val) % 2",
"-if lis[0] == t:",
"- print(sum(val))",
"- print(*[i + 1 for i in range(n) if val[i] == 1], sep=\" \")",
"-else:",
"-... | false | 0.032928 | 0.04156 | 0.792318 | [
"s072937193",
"s352987963"
] |
u729133443 | p02755 | python | s895738289 | s733264988 | 417 | 19 | 2,940 | 2,940 | Accepted | Accepted | 95.44 | a,b=list(map(int,input().split()));print((([i for i in range(10**6)if(i//12.5==a)*i//10==b]+[-1])[0])) | a,b=list(map(int,input().split()));l=max(0--a*25//2,b*10);print((l*(-~a*25//2>l<-~b*10)or-1)) | 1 | 1 | 94 | 85 | a, b = list(map(int, input().split()))
print((([i for i in range(10**6) if (i // 12.5 == a) * i // 10 == b] + [-1])[0]))
| a, b = list(map(int, input().split()))
l = max(0 - -a * 25 // 2, b * 10)
print((l * (-~a * 25 // 2 > l < -~b * 10) or -1))
| false | 0 | [
"-print((([i for i in range(10**6) if (i // 12.5 == a) * i // 10 == b] + [-1])[0]))",
"+l = max(0 - -a * 25 // 2, b * 10)",
"+print((l * (-~a * 25 // 2 > l < -~b * 10) or -1))"
] | false | 0.75207 | 0.035812 | 21.000707 | [
"s895738289",
"s733264988"
] |
u296518383 | p03220 | python | s421659119 | s726645388 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
Th = [T - h * 0.006 for h in H]
answer = -1
dif = 10 ** 15
for i, t in enumerate(Th, 1):
if abs(A - t) < dif:
answer = i
dif = abs(A - t)
... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
answer = -1
dif = 10 ** 15
for i, h in enumerate(H, 1):
if abs(A - (T - h * 0.006)) < dif:
answer = i
dif = abs(A - (T - h * 0.006))
print(a... | 17 | 15 | 322 | 314 | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
Th = [T - h * 0.006 for h in H]
answer = -1
dif = 10**15
for i, t in enumerate(Th, 1):
if abs(A - t) < dif:
answer = i
dif = abs(A - t)
print(answer)
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
answer = -1
dif = 10**15
for i, h in enumerate(H, 1):
if abs(A - (T - h * 0.006)) < dif:
answer = i
dif = abs(A - (T - h * 0.006))
print(answer)
| false | 11.764706 | [
"-Th = [T - h * 0.006 for h in H]",
"-for i, t in enumerate(Th, 1):",
"- if abs(A - t) < dif:",
"+for i, h in enumerate(H, 1):",
"+ if abs(A - (T - h * 0.006)) < dif:",
"- dif = abs(A - t)",
"+ dif = abs(A - (T - h * 0.006))"
] | false | 0.049531 | 0.05003 | 0.990033 | [
"s421659119",
"s726645388"
] |
u729133443 | p04029 | python | s732762113 | s903226429 | 166 | 23 | 38,256 | 9,048 | Accepted | Accepted | 86.14 | n=int(eval(input()))
print((n*-~n//2)) | n=int(eval(input()))
print((n*-~n>>1)) | 2 | 2 | 31 | 31 | n = int(eval(input()))
print((n * -~n // 2))
| n = int(eval(input()))
print((n * -~n >> 1))
| false | 0 | [
"-print((n * -~n // 2))",
"+print((n * -~n >> 1))"
] | false | 0.044441 | 0.134417 | 0.330618 | [
"s732762113",
"s903226429"
] |
u562935282 | p03062 | python | s869276519 | s410229994 | 995 | 247 | 23,416 | 69,520 | Accepted | Accepted | 75.18 | from numpy import zeros
inf = float('inf')
n = int(eval(input()))
a = tuple(map(int, input().split()))
dp = zeros((n + 1, 2))
dp[0][1] = -inf
# dp[idx][マイナスを使う必要がある個数]
for i, aa in enumerate(a):
if aa >= 0:
dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1] - aa)
dp[i + 1][1] = max(dp[i][1... | from bisect import bisect_left
n = int(eval(input()))
a = tuple(sorted(map(int, input().split())))
b = tuple(sorted(map(abs, a)))
j = bisect_left(a, 0)
m = a[:j]
if len(m) % 2 == 0:
print((sum(b)))
else:
print((sum(b) - min(b) * 2))
| 21 | 13 | 501 | 246 | from numpy import zeros
inf = float("inf")
n = int(eval(input()))
a = tuple(map(int, input().split()))
dp = zeros((n + 1, 2))
dp[0][1] = -inf
# dp[idx][マイナスを使う必要がある個数]
for i, aa in enumerate(a):
if aa >= 0:
dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1] - aa)
dp[i + 1][1] = max(dp[i][1] + aa, dp[i][0] ... | from bisect import bisect_left
n = int(eval(input()))
a = tuple(sorted(map(int, input().split())))
b = tuple(sorted(map(abs, a)))
j = bisect_left(a, 0)
m = a[:j]
if len(m) % 2 == 0:
print((sum(b)))
else:
print((sum(b) - min(b) * 2))
| false | 38.095238 | [
"-from numpy import zeros",
"+from bisect import bisect_left",
"-inf = float(\"inf\")",
"-a = tuple(map(int, input().split()))",
"-dp = zeros((n + 1, 2))",
"-dp[0][1] = -inf",
"-# dp[idx][マイナスを使う必要がある個数]",
"-for i, aa in enumerate(a):",
"- if aa >= 0:",
"- dp[i + 1][0] = max(dp[i][0] + a... | false | 0.249805 | 0.079362 | 3.147665 | [
"s869276519",
"s410229994"
] |
u912237403 | p00143 | python | s593501917 | s684020935 | 110 | 100 | 4,304 | 4,296 | Accepted | Accepted | 9.09 | def side(a, b, c):
return (c[1]-a[1])*(b[0]-a[0])-(b[1]-a[1])*(c[0]-a[0])>0
def isInner(x): return (side(p0, p1, x)==side(p1, p2, x)==side(p2, p0, x))
for _ in [0]*eval(input()):
P = list(map(int, input().split()))
p0 = P[0:2]
p1 = P[2:4]
p2 = P[4:6]
x1 = P[6:8]
x2 = P[8:]
print(['NG','OK'][... | def side(a, b, c):
return (c[1]-a[1])*(b[0]-a[0])-(b[1]-a[1])*(c[0]-a[0])>0
def isIn(x):
return (side(p0, p1, x)==side(p1, p2, x)==side(p2, p0, x))
for _ in [0]*eval(input()):
P = list(map(int, input().split()))
p0 = P[0:2]
p1 = P[2:4]
p2 = P[4:6]
print(['NG','OK'][isIn(P[6:8])!=isIn(P[8:])]) | 12 | 11 | 337 | 309 | def side(a, b, c):
return (c[1] - a[1]) * (b[0] - a[0]) - (b[1] - a[1]) * (c[0] - a[0]) > 0
def isInner(x):
return side(p0, p1, x) == side(p1, p2, x) == side(p2, p0, x)
for _ in [0] * eval(input()):
P = list(map(int, input().split()))
p0 = P[0:2]
p1 = P[2:4]
p2 = P[4:6]
x1 = P[6:8]
x... | def side(a, b, c):
return (c[1] - a[1]) * (b[0] - a[0]) - (b[1] - a[1]) * (c[0] - a[0]) > 0
def isIn(x):
return side(p0, p1, x) == side(p1, p2, x) == side(p2, p0, x)
for _ in [0] * eval(input()):
P = list(map(int, input().split()))
p0 = P[0:2]
p1 = P[2:4]
p2 = P[4:6]
print(["NG", "OK"][i... | false | 8.333333 | [
"-def isInner(x):",
"+def isIn(x):",
"- x1 = P[6:8]",
"- x2 = P[8:]",
"- print([\"NG\", \"OK\"][isInner(x1) != isInner(x2)])",
"+ print([\"NG\", \"OK\"][isIn(P[6:8]) != isIn(P[8:])])"
] | false | 0.037109 | 0.089503 | 0.414608 | [
"s593501917",
"s684020935"
] |
u790710233 | p03346 | python | s538022058 | s310764140 | 476 | 358 | 50,384 | 37,884 | Accepted | Accepted | 24.79 | n = int(eval(input()))
cnt = 0
queue = []
last = {}
for _ in range(n):
p = int(eval(input()))
if p-1 not in list(last.keys()):
last[p] = len(queue)
queue.append([p])
if cnt < 1:
cnt = 1
else:
queue[last[p-1]].append(p)
last[p] = last[p-1]
... | n = int(eval(input()))
Ps = [int(eval(input()))for _ in range(n)]
p_to_i = {p: i for i, p in enumerate(Ps)}
cnt = x = 1
for p in range(1, n):
if p_to_i[p] < p_to_i[p+1]:
x += 1
if cnt < x:
cnt = x
else:
x = 1
print((n-cnt))
| 18 | 13 | 396 | 267 | n = int(eval(input()))
cnt = 0
queue = []
last = {}
for _ in range(n):
p = int(eval(input()))
if p - 1 not in list(last.keys()):
last[p] = len(queue)
queue.append([p])
if cnt < 1:
cnt = 1
else:
queue[last[p - 1]].append(p)
last[p] = last[p - 1]
if ... | n = int(eval(input()))
Ps = [int(eval(input())) for _ in range(n)]
p_to_i = {p: i for i, p in enumerate(Ps)}
cnt = x = 1
for p in range(1, n):
if p_to_i[p] < p_to_i[p + 1]:
x += 1
if cnt < x:
cnt = x
else:
x = 1
print((n - cnt))
| false | 27.777778 | [
"-cnt = 0",
"-queue = []",
"-last = {}",
"-for _ in range(n):",
"- p = int(eval(input()))",
"- if p - 1 not in list(last.keys()):",
"- last[p] = len(queue)",
"- queue.append([p])",
"- if cnt < 1:",
"- cnt = 1",
"+Ps = [int(eval(input())) for _ in range(n)]",... | false | 0.037376 | 0.038159 | 0.979499 | [
"s538022058",
"s310764140"
] |
u223133214 | p03274 | python | s883152781 | s160923144 | 143 | 100 | 14,484 | 14,224 | Accepted | Accepted | 30.07 | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
if N == 1:
print((abs(X[0])))
exit()
flg = False
for x in X:
if x < 0:
flg = True
if flg is False:
print((X[K - 1]))
exit()
flag2 = False
for x in X:
if x > 0:
flag2 = True
... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
lft, rgt = 0, K - 1
ans = float('inf')
while True:
if rgt == N:
break
ans = min(ans, min(abs(X[lft]) + abs(X[lft] - X[rgt]),
abs(X[rgt]) + abs(X[rgt] - X[lft])))
lft += 1
rgt += 1
pri... | 52 | 14 | 856 | 322 | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
if N == 1:
print((abs(X[0])))
exit()
flg = False
for x in X:
if x < 0:
flg = True
if flg is False:
print((X[K - 1]))
exit()
flag2 = False
for x in X:
if x > 0:
flag2 = True
if flag2 is False:
X.reverse... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
lft, rgt = 0, K - 1
ans = float("inf")
while True:
if rgt == N:
break
ans = min(
ans, min(abs(X[lft]) + abs(X[lft] - X[rgt]), abs(X[rgt]) + abs(X[rgt] - X[lft]))
)
lft += 1
rgt += 1
print(ans)
| false | 73.076923 | [
"-if N == 1:",
"- print((abs(X[0])))",
"- exit()",
"-flg = False",
"-for x in X:",
"- if x < 0:",
"- flg = True",
"-if flg is False:",
"- print((X[K - 1]))",
"- exit()",
"-flag2 = False",
"-for x in X:",
"- if x > 0:",
"- flag2 = True",
"-if flag2 is False... | false | 0.08456 | 0.040197 | 2.103647 | [
"s883152781",
"s160923144"
] |
u841568901 | p02912 | python | s701621335 | s321773396 | 149 | 128 | 20,032 | 20,124 | Accepted | Accepted | 14.09 | import heapq
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x*(-1) for x in a])
heapq.heapify(a)
for _ in range(M):
X = heapq.heappop(a)
heapq.heappush(a, X/2)
print((sum(int(-x) for x in a))) | from heapq import heapify, heappop, heappush
N, M = list(map(int, input().split()))
A = [-a for a in list(map(int, input().split()))]
heapify(A)
for _ in range(M):
p = heappop(A)
heappush(A, -((-p)//2))
print((-sum(A))) | 11 | 8 | 243 | 222 | import heapq
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x * (-1) for x in a])
heapq.heapify(a)
for _ in range(M):
X = heapq.heappop(a)
heapq.heappush(a, X / 2)
print((sum(int(-x) for x in a)))
| from heapq import heapify, heappop, heappush
N, M = list(map(int, input().split()))
A = [-a for a in list(map(int, input().split()))]
heapify(A)
for _ in range(M):
p = heappop(A)
heappush(A, -((-p) // 2))
print((-sum(A)))
| false | 27.272727 | [
"-import heapq",
"+from heapq import heapify, heappop, heappush",
"-a = list(map(int, input().split()))",
"-a = list([x * (-1) for x in a])",
"-heapq.heapify(a)",
"+A = [-a for a in list(map(int, input().split()))]",
"+heapify(A)",
"- X = heapq.heappop(a)",
"- heapq.heappush(a, X / 2)",
"-pr... | false | 0.043544 | 0.046657 | 0.933283 | [
"s701621335",
"s321773396"
] |
u638282348 | p03266 | python | s060284076 | s799859744 | 91 | 39 | 4,632 | 4,632 | Accepted | Accepted | 57.14 | N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = 0
for mod_a in range(K):
mod_b = (K - mod_a) % K
mod_c = (K - mod_b) % K
if mod_b == mod_c:
total += mods[mod_a] * mods[mod_b] * mods[mod_c]
print(total) | N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = mods[0] ** 3
if not K & 1:
total += mods[K >> 1] ** 3
print(total) | 10 | 7 | 295 | 189 | N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = 0
for mod_a in range(K):
mod_b = (K - mod_a) % K
mod_c = (K - mod_b) % K
if mod_b == mod_c:
total += mods[mod_a] * mods[mod_b] * mods[mod_c]
print(total)
| N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = mods[0] ** 3
if not K & 1:
total += mods[K >> 1] ** 3
print(total)
| false | 30 | [
"-total = 0",
"-for mod_a in range(K):",
"- mod_b = (K - mod_a) % K",
"- mod_c = (K - mod_b) % K",
"- if mod_b == mod_c:",
"- total += mods[mod_a] * mods[mod_b] * mods[mod_c]",
"+total = mods[0] ** 3",
"+if not K & 1:",
"+ total += mods[K >> 1] ** 3"
] | false | 0.038976 | 0.042174 | 0.924176 | [
"s060284076",
"s799859744"
] |
u580697892 | p02718 | python | s678682601 | s161054269 | 175 | 19 | 38,384 | 3,060 | Accepted | Accepted | 89.14 | # coding: utf-8
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
cnt = 0
for i in range(N):
if A[i] / total >= 1 / (4 * M):
cnt += 1
print(("Yes" if cnt >= M else "No")) | # coding: utf-8
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
total = sum(A)
for i in range(N):
if A[i]*4*M >= total:
ans += 1
print(("Yes" if ans >= M else "No")) | 9 | 9 | 222 | 212 | # coding: utf-8
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
cnt = 0
for i in range(N):
if A[i] / total >= 1 / (4 * M):
cnt += 1
print(("Yes" if cnt >= M else "No"))
| # coding: utf-8
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
total = sum(A)
for i in range(N):
if A[i] * 4 * M >= total:
ans += 1
print(("Yes" if ans >= M else "No"))
| false | 0 | [
"+ans = 0",
"-cnt = 0",
"- if A[i] / total >= 1 / (4 * M):",
"- cnt += 1",
"-print((\"Yes\" if cnt >= M else \"No\"))",
"+ if A[i] * 4 * M >= total:",
"+ ans += 1",
"+print((\"Yes\" if ans >= M else \"No\"))"
] | false | 0.06303 | 0.043124 | 1.461577 | [
"s678682601",
"s161054269"
] |
u644907318 | p03338 | python | s390099208 | s932346506 | 177 | 61 | 39,792 | 62,536 | Accepted | Accepted | 65.54 | N = int(eval(input()))
S = input().strip()
cmax = 0
for n in range(1,N-1):
X = S[:n]
Y = S[n:]
Cx = {}
Cy = {}
for i in range(n):
a = X[i]
if a not in Cx:
Cx[a] = 0
Cx[a] += 1
for i in range(N-n):
a = Y[i]
if a not in Cy:
... | N = int(eval(input()))
S = input().strip()
cmax = 0
for i in range(1,N-1):
X = set(list(S[:i]))
Y = set(list(S[i:]))
Z = X&Y
cmax = max(cmax,len(Z))
print(cmax) | 24 | 9 | 460 | 178 | N = int(eval(input()))
S = input().strip()
cmax = 0
for n in range(1, N - 1):
X = S[:n]
Y = S[n:]
Cx = {}
Cy = {}
for i in range(n):
a = X[i]
if a not in Cx:
Cx[a] = 0
Cx[a] += 1
for i in range(N - n):
a = Y[i]
if a not in Cy:
Cy[a]... | N = int(eval(input()))
S = input().strip()
cmax = 0
for i in range(1, N - 1):
X = set(list(S[:i]))
Y = set(list(S[i:]))
Z = X & Y
cmax = max(cmax, len(Z))
print(cmax)
| false | 62.5 | [
"-for n in range(1, N - 1):",
"- X = S[:n]",
"- Y = S[n:]",
"- Cx = {}",
"- Cy = {}",
"- for i in range(n):",
"- a = X[i]",
"- if a not in Cx:",
"- Cx[a] = 0",
"- Cx[a] += 1",
"- for i in range(N - n):",
"- a = Y[i]",
"- if a no... | false | 0.089155 | 0.090493 | 0.985216 | [
"s390099208",
"s932346506"
] |
u477977638 | p02911 | python | s458546066 | s365021021 | 262 | 117 | 4,680 | 6,496 | Accepted | Accepted | 55.34 | n,k,q=list(map(int,input().split()))
l=[0]*n
for i in range(q):
l[int(eval(input()))-1]+=1
for i in range(n):
if l[i]>q-k:print("Yes")
else:print("No") | import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n,k,q=list(map(int,input().split()))
A=[q-k]*n
for i in range(q):
A[int(eval(input()))-1]-=1
for i in A:
print(("Yes"... | 8 | 24 | 153 | 371 | n, k, q = list(map(int, input().split()))
l = [0] * n
for i in range(q):
l[int(eval(input())) - 1] += 1
for i in range(n):
if l[i] > q - k:
print("Yes")
else:
print("No")
| import sys
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n, k, q = list(map(int, input().split()))
A = [q - k] * n
for i in range(q):
A[int(eval(input())) - 1] -= 1
for i in A:
... | false | 66.666667 | [
"-n, k, q = list(map(int, input().split()))",
"-l = [0] * n",
"-for i in range(q):",
"- l[int(eval(input())) - 1] += 1",
"-for i in range(n):",
"- if l[i] > q - k:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+import sys",
"+",
"+# input = sys.stdin.readline",
... | false | 0.041501 | 0.188957 | 0.219634 | [
"s458546066",
"s365021021"
] |
u254871849 | p02953 | python | s911393078 | s645752423 | 68 | 48 | 14,108 | 14,108 | Accepted | Accepted | 29.41 | # 2019-11-16 10:55:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
... | import sys
n, *H = list(map(int, sys.stdin.read().split()))
def main():
cur = 0
for h in H:
if h > cur:
cur = h - 1
elif h < cur:
return 'No'
return 'Yes'
if __name__ == '__main__':
ans = main()
print(ans) | 31 | 16 | 669 | 277 | # 2019-11-16 10:55:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import ... | import sys
n, *H = list(map(int, sys.stdin.read().split()))
def main():
cur = 0
for h in H:
if h > cur:
cur = h - 1
elif h < cur:
return "No"
return "Yes"
if __name__ == "__main__":
ans = main()
print(ans)
| false | 48.387097 | [
"-# 2019-11-16 10:55:08(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# fro... | false | 0.036307 | 0.036448 | 0.99613 | [
"s911393078",
"s645752423"
] |
u853185302 | p03378 | python | s322206929 | s682951918 | 19 | 17 | 3,316 | 3,060 | Accepted | Accepted | 10.53 | N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
A_under = [A[i] for i in range(M) if A[i] < X]
A_upper = [A[i] for i in range(M) if A[i] > X]
print((min(len(A_under),len(A_upper)))) | N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
cost = [0]*N
for i in A: cost[i] = 1
print((min(sum(cost[X:]),sum(cost[:X+1])))) | 5 | 5 | 203 | 150 | N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
A_under = [A[i] for i in range(M) if A[i] < X]
A_upper = [A[i] for i in range(M) if A[i] > X]
print((min(len(A_under), len(A_upper))))
| N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cost = [0] * N
for i in A:
cost[i] = 1
print((min(sum(cost[X:]), sum(cost[: X + 1]))))
| false | 0 | [
"-A_under = [A[i] for i in range(M) if A[i] < X]",
"-A_upper = [A[i] for i in range(M) if A[i] > X]",
"-print((min(len(A_under), len(A_upper))))",
"+cost = [0] * N",
"+for i in A:",
"+ cost[i] = 1",
"+print((min(sum(cost[X:]), sum(cost[: X + 1]))))"
] | false | 0.078853 | 0.078633 | 1.002793 | [
"s322206929",
"s682951918"
] |
u707498674 | p02850 | python | s759781137 | s099946585 | 866 | 614 | 80,884 | 50,368 | Accepted | Accepted | 29.1 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
edge = [[] for i in range(N)]
count = [0] * N
color = {}
egs = []
for i in range(N-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
count[a] += 1
count[b] += 1
edge[a].append(b)
edge[b].append(a)
egs... | import sys
from collections import deque, defaultdict
def input() : return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
edges = [tuple(map(int, input().split())) for _ in range(N-1)]
to = [[] for i in range(N)]
for edge in edges:
a, b = edge
a -= 1
... | 44 | 54 | 735 | 1,196 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
edge = [[] for i in range(N)]
count = [0] * N
color = {}
egs = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
count[a] += 1
count[b] += 1
edge[a].append(b)
edge[b].append(a)
egs.append(tuple(s... | import sys
from collections import deque, defaultdict
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
edges = [tuple(map(int, input().split())) for _ in range(N - 1)]
to = [[] for i in range(N)]
for edge in edges:
a, b = edge
a -= 1
b -... | false | 18.518519 | [
"-",
"-sys.setrecursionlimit(10**9)",
"-N = int(eval(input()))",
"-edge = [[] for i in range(N)]",
"-count = [0] * N",
"-color = {}",
"-egs = []",
"-for i in range(N - 1):",
"- a, b = list(map(int, input().split()))",
"- a -= 1",
"- b -= 1",
"- count[a] += 1",
"- count[b] += 1... | false | 0.043792 | 0.037689 | 1.161933 | [
"s759781137",
"s099946585"
] |
u451017206 | p03618 | python | s609183269 | s797901632 | 220 | 35 | 4,072 | 3,960 | Accepted | Accepted | 84.09 | A = eval(input())
l = len(A)
from collections import Counter
from string import ascii_lowercase
c = Counter(A)
a = (l * (l - 1)) // 2
s = sum([c[j] * (c[j] - 1) // 2 for j in ascii_lowercase])
print((a - s + 1))
| A = eval(input())
l = len(A)
from collections import Counter
from string import ascii_lowercase
c = Counter(A)
a = ((l * (l - 1)) // 2) + 1
for j in ascii_lowercase:
a -= (c[j] * (c[j] - 1) // 2)
print(a) | 8 | 9 | 211 | 210 | A = eval(input())
l = len(A)
from collections import Counter
from string import ascii_lowercase
c = Counter(A)
a = (l * (l - 1)) // 2
s = sum([c[j] * (c[j] - 1) // 2 for j in ascii_lowercase])
print((a - s + 1))
| A = eval(input())
l = len(A)
from collections import Counter
from string import ascii_lowercase
c = Counter(A)
a = ((l * (l - 1)) // 2) + 1
for j in ascii_lowercase:
a -= c[j] * (c[j] - 1) // 2
print(a)
| false | 11.111111 | [
"-a = (l * (l - 1)) // 2",
"-s = sum([c[j] * (c[j] - 1) // 2 for j in ascii_lowercase])",
"-print((a - s + 1))",
"+a = ((l * (l - 1)) // 2) + 1",
"+for j in ascii_lowercase:",
"+ a -= c[j] * (c[j] - 1) // 2",
"+print(a)"
] | false | 0.067956 | 0.034128 | 1.991182 | [
"s609183269",
"s797901632"
] |
u148981246 | p02583 | python | s423580411 | s107052957 | 129 | 98 | 9,148 | 9,100 | Accepted | Accepted | 24.03 | N = int(eval(input()))
L = [int(x) for x in input().split()]
cnt = 0
for i in range(len(L) - 2):
for j in range(i+1, len(L)-1):
for k in range(j+1, len(L)):
a = L[i]
b = L[j]
c = L[k]
p = a + b > c
q = b + c > a
r = c + a >... | N = int(eval(input()))
L = [int(x) for x in input().split()]
L.sort()
cnt = 0
for i in range(len(L) - 2):
for j in range(i+1, len(L)-1):
for k in range(j+1, len(L)):
a = L[i]
b = L[j]
c = L[k]
p = a + b > c
s = a != b
t = ... | 19 | 17 | 475 | 389 | N = int(eval(input()))
L = [int(x) for x in input().split()]
cnt = 0
for i in range(len(L) - 2):
for j in range(i + 1, len(L) - 1):
for k in range(j + 1, len(L)):
a = L[i]
b = L[j]
c = L[k]
p = a + b > c
q = b + c > a
r = c + a > b
... | N = int(eval(input()))
L = [int(x) for x in input().split()]
L.sort()
cnt = 0
for i in range(len(L) - 2):
for j in range(i + 1, len(L) - 1):
for k in range(j + 1, len(L)):
a = L[i]
b = L[j]
c = L[k]
p = a + b > c
s = a != b
t = b != c
... | false | 10.526316 | [
"+L.sort()",
"- q = b + c > a",
"- r = c + a > b",
"- u = c != a",
"- if p and q and r and s and t and u:",
"+ if p and s and t:"
] | false | 0.044798 | 0.046606 | 0.961219 | [
"s423580411",
"s107052957"
] |
u148551245 | p03447 | python | s983548315 | s573403166 | 163 | 19 | 38,384 | 3,188 | Accepted | Accepted | 88.34 | x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
print(((x - a) % b)) | x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x-a) % b
print(ans) | 5 | 5 | 74 | 81 | x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
print(((x - a) % b))
| x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
print(ans)
| false | 0 | [
"-print(((x - a) % b))",
"+ans = (x - a) % b",
"+print(ans)"
] | false | 0.045498 | 0.036148 | 1.258644 | [
"s983548315",
"s573403166"
] |
u022979415 | p02732 | python | s328287489 | s243887095 | 322 | 292 | 38,284 | 26,140 | Accepted | Accepted | 9.32 | def main():
dates = int(eval(input()))
numbers = list(map(int, input().split()))
count = {i: 0 for i in range(1, dates + 1)}
for n in numbers:
count[n] += 1
answer = 0
for c in list(count.values()):
answer += c * (c - 1) // 2
for n in numbers:
print((answer ... | def main():
n = int(eval(input()))
a = [int(x) for x in input().split()]
count = {}
for aa in a:
if aa in count:
count[aa] += 1
else:
count[aa] = 1
all_way = 0
for c in list(count.values()):
all_way += c * (c - 1) // 2
for i in rang... | 16 | 22 | 369 | 476 | def main():
dates = int(eval(input()))
numbers = list(map(int, input().split()))
count = {i: 0 for i in range(1, dates + 1)}
for n in numbers:
count[n] += 1
answer = 0
for c in list(count.values()):
answer += c * (c - 1) // 2
for n in numbers:
print((answer - count[n]... | def main():
n = int(eval(input()))
a = [int(x) for x in input().split()]
count = {}
for aa in a:
if aa in count:
count[aa] += 1
else:
count[aa] = 1
all_way = 0
for c in list(count.values()):
all_way += c * (c - 1) // 2
for i in range(n):
... | false | 27.272727 | [
"- dates = int(eval(input()))",
"- numbers = list(map(int, input().split()))",
"- count = {i: 0 for i in range(1, dates + 1)}",
"- for n in numbers:",
"- count[n] += 1",
"- answer = 0",
"+ n = int(eval(input()))",
"+ a = [int(x) for x in input().split()]",
"+ count = {... | false | 0.049764 | 0.049177 | 1.011936 | [
"s328287489",
"s243887095"
] |
u375616706 | p03160 | python | s078019262 | s440424932 | 128 | 100 | 14,004 | 14,012 | Accepted | Accepted | 21.88 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
H = list(map(int, input().split()))
d = [float('inf')]*N
if N <= 3:
print((abs(H[0]-H[-1])))
else:
d[0] = 0
d[1] = abs(H[1]-H[0])
d[2] = abs(H[2]-H[0])
for i in r... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
H = list(map(int, input().split()))
d = [float('inf')]*N
def solve():
if N <= 3:
print((abs(H[0]-H[-1])))
else:
d[0] = 0
d[1] = abs(H[1]-H[0])
... | 18 | 31 | 412 | 636 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
H = list(map(int, input().split()))
d = [float("inf")] * N
if N <= 3:
print((abs(H[0] - H[-1])))
else:
d[0] = 0
d[1] = abs(H[1] - H[0])
d[2] = abs(H[2] - H[0])
for i in range(3, ... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
H = list(map(int, input().split()))
d = [float("inf")] * N
def solve():
if N <= 3:
print((abs(H[0] - H[-1])))
else:
d[0] = 0
d[1] = abs(H[1] - H[0])
d[2] = ... | false | 41.935484 | [
"-if N <= 3:",
"- print((abs(H[0] - H[-1])))",
"-else:",
"- d[0] = 0",
"- d[1] = abs(H[1] - H[0])",
"- d[2] = abs(H[2] - H[0])",
"- for i in range(3, N):",
"- d[i] = min(d[i - 1] + abs(H[i] - H[i - 1]), d[i - 2] + abs(H[i] - H[i - 2]))",
"- print((d[-1]))",
"+",
"+",
"... | false | 0.036359 | 0.037013 | 0.982321 | [
"s078019262",
"s440424932"
] |
u095094246 | p03212 | python | s392799482 | s772642648 | 77 | 62 | 3,060 | 9,140 | Accepted | Accepted | 19.48 | import sys
sys.setrecursionlimit(1000000000)
LET=('3','5','7')
n=int(eval(input()))
def dfs(s):
cnt = 0
if len(s) >0 and int(s) > n:
return cnt
if s.count('3') > 0 and s.count('5')>0 and s.count('7')>0:
cnt += 1
for l in LET:
cnt += dfs(s+l)
return cnt
print((dfs(''))) | import sys
sys.setrecursionlimit(10000000)
n=int(eval(input()))
tex=['3','5','7']
def dfs(value):
ans=0
if value != '' and int(value) > n:
return 0
for x in tex:
if not x in value:
break
else:
ans += 1
for x in tex:
ans += dfs(value+x)
#print(value,ans)
return ans
... | 16 | 20 | 300 | 331 | import sys
sys.setrecursionlimit(1000000000)
LET = ("3", "5", "7")
n = int(eval(input()))
def dfs(s):
cnt = 0
if len(s) > 0 and int(s) > n:
return cnt
if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:
cnt += 1
for l in LET:
cnt += dfs(s + l)
return cnt
print... | import sys
sys.setrecursionlimit(10000000)
n = int(eval(input()))
tex = ["3", "5", "7"]
def dfs(value):
ans = 0
if value != "" and int(value) > n:
return 0
for x in tex:
if not x in value:
break
else:
ans += 1
for x in tex:
ans += dfs(value + x)
# p... | false | 20 | [
"-sys.setrecursionlimit(1000000000)",
"-LET = (\"3\", \"5\", \"7\")",
"+sys.setrecursionlimit(10000000)",
"+tex = [\"3\", \"5\", \"7\"]",
"-def dfs(s):",
"- cnt = 0",
"- if len(s) > 0 and int(s) > n:",
"- return cnt",
"- if s.count(\"3\") > 0 and s.count(\"5\") > 0 and s.count(\"7\")... | false | 0.062794 | 0.057912 | 1.084316 | [
"s392799482",
"s772642648"
] |
u279955105 | p02402 | python | s477527996 | s296251073 | 40 | 20 | 8,628 | 6,540 | Accepted | Accepted | 50 | n = int(eval(input()))
t = list(map(int,input().split()))
a = min(t)
b = max(t)
c = sum(t)
print((str(a),str(b),str(c))) | n = eval(input())
Input = list(map(int, input().split()))
print((min(Input),max(Input),sum(Input)))
| 8 | 3 | 121 | 94 | n = int(eval(input()))
t = list(map(int, input().split()))
a = min(t)
b = max(t)
c = sum(t)
print((str(a), str(b), str(c)))
| n = eval(input())
Input = list(map(int, input().split()))
print((min(Input), max(Input), sum(Input)))
| false | 62.5 | [
"-n = int(eval(input()))",
"-t = list(map(int, input().split()))",
"-a = min(t)",
"-b = max(t)",
"-c = sum(t)",
"-print((str(a), str(b), str(c)))",
"+n = eval(input())",
"+Input = list(map(int, input().split()))",
"+print((min(Input), max(Input), sum(Input)))"
] | false | 0.074934 | 0.07801 | 0.960568 | [
"s477527996",
"s296251073"
] |
u633068244 | p00631 | python | s549044438 | s630601134 | 4,320 | 70 | 4,244 | 4,244 | Accepted | Accepted | 98.38 | def solve(a,i,sa,sb):
if 2*sa >= all: return 2*sa-all
if 2*sb >= all: return 2*sb-all
return min(solve(a,i+1,sa+a[i],sb),solve(a,i+1,sa,sb+a[i]))
while 1:
n = eval(input())
if n == 0: break
a = sorted(map(int,input().split()))
all = sum(a)
print(solve(a,1,a[0],0)) | def solve(a,i,sa,sb):
if 2*sa >= all: return 2*sa-all
if 2*sb >= all: return 2*sb-all
return min(solve(a,i+1,sa+a[i],sb),solve(a,i+1,sa,sb+a[i]))
while 1:
n = eval(input())
if n == 0: break
a = sorted(map(int,input().split()))[::-1]
all = sum(a)
print(solve(a,1,a[0],0)) | 11 | 11 | 281 | 287 | def solve(a, i, sa, sb):
if 2 * sa >= all:
return 2 * sa - all
if 2 * sb >= all:
return 2 * sb - all
return min(solve(a, i + 1, sa + a[i], sb), solve(a, i + 1, sa, sb + a[i]))
while 1:
n = eval(input())
if n == 0:
break
a = sorted(map(int, input().split()))
all = su... | def solve(a, i, sa, sb):
if 2 * sa >= all:
return 2 * sa - all
if 2 * sb >= all:
return 2 * sb - all
return min(solve(a, i + 1, sa + a[i], sb), solve(a, i + 1, sa, sb + a[i]))
while 1:
n = eval(input())
if n == 0:
break
a = sorted(map(int, input().split()))[::-1]
al... | false | 0 | [
"- a = sorted(map(int, input().split()))",
"+ a = sorted(map(int, input().split()))[::-1]"
] | false | 0.074511 | 0.048691 | 1.530295 | [
"s549044438",
"s630601134"
] |
u921168761 | p02861 | python | s367581515 | s254360808 | 417 | 17 | 3,188 | 3,060 | Accepted | Accepted | 95.92 | import itertools
n = int(eval(input()))
x, y = [], []
f = 1
for i in range(n):
f *= i + 1
xi, yi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
p = [i for i in range(n)]
d = 0
for perm in itertools.permutations(p):
for i in range(n - 1):
d += ((x[perm[i]] - x[perm[i... | import itertools
n = int(eval(input()))
x, y = [], []
for i in range(n):
xi, yi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
d = 0
for i in range(n):
for j in range(n):
d += ((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2) ** 0.5
print((d / n))
| 17 | 14 | 388 | 282 | import itertools
n = int(eval(input()))
x, y = [], []
f = 1
for i in range(n):
f *= i + 1
xi, yi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
p = [i for i in range(n)]
d = 0
for perm in itertools.permutations(p):
for i in range(n - 1):
d += (
(x[perm[i]] - x[perm[... | import itertools
n = int(eval(input()))
x, y = [], []
for i in range(n):
xi, yi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
d = 0
for i in range(n):
for j in range(n):
d += ((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2) ** 0.5
print((d / n))
| false | 17.647059 | [
"-f = 1",
"- f *= i + 1",
"-p = [i for i in range(n)]",
"-for perm in itertools.permutations(p):",
"- for i in range(n - 1):",
"- d += (",
"- (x[perm[i]] - x[perm[i + 1]]) ** 2 + (y[perm[i]] - y[perm[i + 1]]) ** 2",
"- ) ** 0.5",
"-print((d / f))",
"+for i in range(n... | false | 0.040986 | 0.038405 | 1.06719 | [
"s367581515",
"s254360808"
] |
u276204978 | p03048 | python | s319335752 | s321623025 | 1,851 | 19 | 3,060 | 3,064 | Accepted | Accepted | 98.97 | R, G, B, N = list(map(int, input().split()))
ans = 0
for g in range(N//G+1):
for b in range(N//B+1):
s = N-g*G-b*B
if s < 0:
break
if s%R == 0:
ans += 1
print(ans) | r, g, b, n = list(map(int, input().split()))
dp = [0 for i in range(n+1)]
dp[0] = 1
for i in range(r, n+1, r):
dp[i] = 1
for i in range(g, n+1):
dp[i] += dp[i-g]
for i in range(b, n+1):
dp[i] += dp[i-b]
print((dp[-1])) | 13 | 13 | 224 | 237 | R, G, B, N = list(map(int, input().split()))
ans = 0
for g in range(N // G + 1):
for b in range(N // B + 1):
s = N - g * G - b * B
if s < 0:
break
if s % R == 0:
ans += 1
print(ans)
| r, g, b, n = list(map(int, input().split()))
dp = [0 for i in range(n + 1)]
dp[0] = 1
for i in range(r, n + 1, r):
dp[i] = 1
for i in range(g, n + 1):
dp[i] += dp[i - g]
for i in range(b, n + 1):
dp[i] += dp[i - b]
print((dp[-1]))
| false | 0 | [
"-R, G, B, N = list(map(int, input().split()))",
"-ans = 0",
"-for g in range(N // G + 1):",
"- for b in range(N // B + 1):",
"- s = N - g * G - b * B",
"- if s < 0:",
"- break",
"- if s % R == 0:",
"- ans += 1",
"-print(ans)",
"+r, g, b, n = list(ma... | false | 0.246889 | 0.010688 | 23.099526 | [
"s319335752",
"s321623025"
] |
u102461423 | p02590 | python | s108887410 | s878986737 | 1,431 | 578 | 149,832 | 153,988 | Accepted | Accepted | 59.61 | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 200_003
R = 2 # primitive root
ntt_mod = 998_244_353
ntt_root = 3
max_ntt = 20
roots = np.empty(1 << max_ntt... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 200_003
R = 2 # primitive root
@njit((i8[:], ), cache=True)
def precompute(A):
exp = np.zeros(MOD - 1, np... | 133 | 48 | 3,342 | 1,149 | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 200_003
R = 2 # primitive root
ntt_mod = 998_244_353
ntt_root = 3
max_ntt = 20
roots = np.empty(1 << max_ntt, np.int64)
iroot... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 200_003
R = 2 # primitive root
@njit((i8[:],), cache=True)
def precompute(A):
exp = np.zeros(MOD - 1, np.int64)
log... | false | 63.909774 | [
"-ntt_mod = 998_244_353",
"-ntt_root = 3",
"-max_ntt = 20",
"-roots = np.empty(1 << max_ntt, np.int64)",
"-iroots = np.empty(1 << max_ntt, np.int64)",
"-ntt_data = (ntt_mod, ntt_root, max_ntt, roots, iroots)",
"-ntt_t = numba.typeof(ntt_data)",
"-",
"-",
"-@njit",
"-def mpow(a, n):",
"- p =... | false | 0.532526 | 0.318387 | 1.672573 | [
"s108887410",
"s878986737"
] |
u588341295 | p02973 | python | s681108568 | s487168340 | 168 | 124 | 8,832 | 9,388 | Accepted | Accepted | 26.19 | # -*- coding: utf-8 -*-
import sys
from collections import deque
from bisect import bisect_left
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 ceil(x, y=1): return int(... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
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 ceil(x, y=1): return int(-(-x // y))
def INT(): return... | 37 | 37 | 1,002 | 974 | # -*- coding: utf-8 -*-
import sys
from collections import deque
from bisect import bisect_left
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 ceil(x, y=1):
... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
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 ceil(x, y=1):
return int(-(-x // y))
de... | false | 0 | [
"-from collections import deque",
"-from bisect import bisect_left",
"+from bisect import bisect_right",
"+N = INT()",
"+A = [INT() for i in range(N)]",
"-def LDS(A: list):",
"- L = deque([A[0]])",
"+def LIS(A: list):",
"+ L = [A[0]]",
"- if a <= L[0]:",
"- # Lの先頭よりaが小さけれ... | false | 0.042138 | 0.081632 | 0.516195 | [
"s681108568",
"s487168340"
] |
u668503853 | p02982 | python | s413336659 | s759905169 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | n, d = list(map(int, input().split()))
X = []
for _ in range(n):
X.append([int(x) for x in input().split()])
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
s = sum((X[i][d] - X[j][d])**2 for d in range(d))
if (s ** .5).is_integer():
ans += 1
print(ans) | n, d = list(map(int, input().split()))
X = []
for _ in range(n):
X.append([int(x) for x in input().split()])
ans = 0
for i in range(n):
for j in range(i):
s = sum((X[i][k] - X[j][k])**2 for k in range(d))
if (s ** .5).is_integer():
ans += 1
print(ans) | 11 | 11 | 288 | 277 | n, d = list(map(int, input().split()))
X = []
for _ in range(n):
X.append([int(x) for x in input().split()])
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
s = sum((X[i][d] - X[j][d]) ** 2 for d in range(d))
if (s**0.5).is_integer():
ans += 1
print(ans)
| n, d = list(map(int, input().split()))
X = []
for _ in range(n):
X.append([int(x) for x in input().split()])
ans = 0
for i in range(n):
for j in range(i):
s = sum((X[i][k] - X[j][k]) ** 2 for k in range(d))
if (s**0.5).is_integer():
ans += 1
print(ans)
| false | 0 | [
"-for i in range(n - 1):",
"- for j in range(i + 1, n):",
"- s = sum((X[i][d] - X[j][d]) ** 2 for d in range(d))",
"+for i in range(n):",
"+ for j in range(i):",
"+ s = sum((X[i][k] - X[j][k]) ** 2 for k in range(d))"
] | false | 0.046328 | 0.041571 | 1.114443 | [
"s413336659",
"s759905169"
] |
u887207211 | p03272 | python | s378384806 | s472240176 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | N, i = list(map(int,input().split()))
print((N-i+1)) | a, b = list(map(int, input().split()))
print((a - b + 1))
| 2 | 2 | 45 | 51 | N, i = list(map(int, input().split()))
print((N - i + 1))
| a, b = list(map(int, input().split()))
print((a - b + 1))
| false | 0 | [
"-N, i = list(map(int, input().split()))",
"-print((N - i + 1))",
"+a, b = list(map(int, input().split()))",
"+print((a - b + 1))"
] | false | 0.04252 | 0.039994 | 1.063171 | [
"s378384806",
"s472240176"
] |
u113835532 | p03697 | python | s916596906 | s720112978 | 29 | 26 | 9,164 | 8,992 | Accepted | Accepted | 10.34 | int_1, int_2 = list(map(int, input().split()))
answer = int_1 + int_2
if 10 <= answer:
print('error')
else:
print(answer) | a, b = list(map(int, input().split()))
answer = a + b
print(('error' if 10 <= answer else answer)) | 7 | 3 | 130 | 92 | int_1, int_2 = list(map(int, input().split()))
answer = int_1 + int_2
if 10 <= answer:
print("error")
else:
print(answer)
| a, b = list(map(int, input().split()))
answer = a + b
print(("error" if 10 <= answer else answer))
| false | 57.142857 | [
"-int_1, int_2 = list(map(int, input().split()))",
"-answer = int_1 + int_2",
"-if 10 <= answer:",
"- print(\"error\")",
"-else:",
"- print(answer)",
"+a, b = list(map(int, input().split()))",
"+answer = a + b",
"+print((\"error\" if 10 <= answer else answer))"
] | false | 0.055518 | 0.036475 | 1.522097 | [
"s916596906",
"s720112978"
] |
u997641430 | p02913 | python | s120024229 | s426088607 | 165 | 86 | 9,508 | 3,748 | Accepted | Accepted | 47.88 | def ok(l):
# 長さlの連続部分列で重ならずに2回以上現れるものがある
D = {}
for i in range(n-l+1):
try:
if D[S[i:i+l]]+l <= i:
return True
except:
D[S[i:i+l]] = i
return False
n = int(eval(input()))
S = eval(input())
# 二分探索でTrueになる最大のkを求める
l, r = 0, n+1
whil... | def ok(l):
# 長さlの連続部分列で重ならずに2回以上現れるものがある
D = {}
for i in range(n-l+1):
h = hash(S[i:i+l])
try:
if D[h] + l <= i:
return True
except:
D[h] = i
return False
n = int(eval(input()))
S = eval(input())
# 二分探索でTrueになる最大のkを求める
l, ... | 23 | 24 | 403 | 419 | def ok(l):
# 長さlの連続部分列で重ならずに2回以上現れるものがある
D = {}
for i in range(n - l + 1):
try:
if D[S[i : i + l]] + l <= i:
return True
except:
D[S[i : i + l]] = i
return False
n = int(eval(input()))
S = eval(input())
# 二分探索でTrueになる最大のkを求める
l, r = 0, n + 1
whil... | def ok(l):
# 長さlの連続部分列で重ならずに2回以上現れるものがある
D = {}
for i in range(n - l + 1):
h = hash(S[i : i + l])
try:
if D[h] + l <= i:
return True
except:
D[h] = i
return False
n = int(eval(input()))
S = eval(input())
# 二分探索でTrueになる最大のkを求める
l, r = 0, n... | false | 4.166667 | [
"+ h = hash(S[i : i + l])",
"- if D[S[i : i + l]] + l <= i:",
"+ if D[h] + l <= i:",
"- D[S[i : i + l]] = i",
"+ D[h] = i"
] | false | 0.067418 | 0.00744 | 9.062015 | [
"s120024229",
"s426088607"
] |
u952708174 | p03993 | python | s200441825 | s383928036 | 72 | 60 | 13,880 | 13,880 | Accepted | Accepted | 16.67 | N = int(eval(input()))
A = [int(i)-1 for i in input().split()]
ans = 0
for i,a in enumerate(A):
if i == A[a] and i < a:
ans += 1
print(ans) | N = int(eval(input()))
A = [int(i) - 1 for i in input().split()]
print((len([1 for i, a in enumerate(A) if i == A[a] and i < a]))) | 8 | 3 | 147 | 124 | N = int(eval(input()))
A = [int(i) - 1 for i in input().split()]
ans = 0
for i, a in enumerate(A):
if i == A[a] and i < a:
ans += 1
print(ans)
| N = int(eval(input()))
A = [int(i) - 1 for i in input().split()]
print((len([1 for i, a in enumerate(A) if i == A[a] and i < a])))
| false | 62.5 | [
"-ans = 0",
"-for i, a in enumerate(A):",
"- if i == A[a] and i < a:",
"- ans += 1",
"-print(ans)",
"+print((len([1 for i, a in enumerate(A) if i == A[a] and i < a])))"
] | false | 0.039503 | 0.045167 | 0.874615 | [
"s200441825",
"s383928036"
] |
u408260374 | p02244 | python | s789912262 | s287725312 | 70 | 30 | 7,760 | 6,556 | Accepted | Accepted | 57.14 | from itertools import permutations
def check(queen):
for r1, c1 in queen:
if any((r1 != r2 or c1 != c2) and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2) for r2, c2 in queen):
return False
return True
N = int(input())
Q, row, col = [], list(range(8)), list(range(8... | import itertools
def check(q):
for r1, c1 in q:
if any((r1 != r2 or c1 != c2) and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2) for r2, c2 in q): return 0
return 1
N = eval(input())
Q, row, col = [], list(range(8)), list(range(8))
for _ in range(N):
r, c = list(map(int, ... | 19 | 17 | 673 | 596 | from itertools import permutations
def check(queen):
for r1, c1 in queen:
if any(
(r1 != r2 or c1 != c2)
and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2)
for r2, c2 in queen
):
return False
return True
N = int(input())
Q, ... | import itertools
def check(q):
for r1, c1 in q:
if any(
(r1 != r2 or c1 != c2)
and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2)
for r2, c2 in q
):
return 0
return 1
N = eval(input())
Q, row, col = [], list(range(8)), list(... | false | 10.526316 | [
"-from itertools import permutations",
"+import itertools",
"-def check(queen):",
"- for r1, c1 in queen:",
"+def check(q):",
"+ for r1, c1 in q:",
"- for r2, c2 in queen",
"+ for r2, c2 in q",
"- return False",
"- return True",
"+ return 0",
... | false | 0.114676 | 0.047826 | 2.397765 | [
"s789912262",
"s287725312"
] |
u226108478 | p03141 | python | s891446861 | s698606122 | 501 | 406 | 21,744 | 22,128 | Accepted | Accepted | 18.96 | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
dishes = list()
ans = 0
# See:
# https://poporix.hatenablog.com/entry/2019/01/28/222905
# https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447
for i in range(n):... | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
dishes = list()
ans = 0
# See:
# https://poporix.hatenablog.com/entry/2019/01/28/222905
# https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447
for i in range(n):... | 26 | 26 | 636 | 647 | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
dishes = list()
ans = 0
# See:
# https://poporix.hatenablog.com/entry/2019/01/28/222905
# https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447
for i in range(n):
ai, b... | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
dishes = list()
ans = 0
# See:
# https://poporix.hatenablog.com/entry/2019/01/28/222905
# https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447
for i in range(n):
ai, b... | false | 0 | [
"- dishes.append(tuple([ai + bi, ai, bi]))",
"- for index, dish in enumerate(sorted(dishes, reverse=True)):",
"+ dishes.append((ai, bi))",
"+ for index, dish in enumerate(",
"+ sorted(dishes, key=lambda x: x[0] + x[1], reverse=True)",
"+ ):",
"- ans += dish[1]",
... | false | 0.043827 | 0.042735 | 1.025543 | [
"s891446861",
"s698606122"
] |
u321155043 | p02889 | python | s728329557 | s869273727 | 1,934 | 1,235 | 82,948 | 72,924 | Accepted | Accepted | 36.14 | import sys
def main():
input = sys.stdin.readline
N, M, L = list(map(int,input().split()))
P = [list(map(int,input().split())) for i in range(M)]
Q = int(eval(input()))
st = [list(map(int,input().split())) for i in range(Q)]
neighbor = [[] for i in range(N)]
for s,e,d in P:
if d<=L:
neighbor... | import sys
input = sys.stdin.readline
N, M, L = list(map(int,input().split()))
P = [list(map(int,input().split())) for i in range(M)]
Q = int(eval(input()))
st = [list(map(int,input().split())) for i in range(Q)]
INF = 100100100100100
dp = [[INF]*N for i in range(N)]
for s,e,d in P:
if d<=L:
dp[s-1][... | 80 | 40 | 1,747 | 821 | import sys
def main():
input = sys.stdin.readline
N, M, L = list(map(int, input().split()))
P = [list(map(int, input().split())) for i in range(M)]
Q = int(eval(input()))
st = [list(map(int, input().split())) for i in range(Q)]
neighbor = [[] for i in range(N)]
for s, e, d in P:
if... | import sys
input = sys.stdin.readline
N, M, L = list(map(int, input().split()))
P = [list(map(int, input().split())) for i in range(M)]
Q = int(eval(input()))
st = [list(map(int, input().split())) for i in range(Q)]
INF = 100100100100100
dp = [[INF] * N for i in range(N)]
for s, e, d in P:
if d <= L:
dp[s ... | false | 50 | [
"-",
"-def main():",
"- input = sys.stdin.readline",
"- N, M, L = list(map(int, input().split()))",
"- P = [list(map(int, input().split())) for i in range(M)]",
"- Q = int(eval(input()))",
"- st = [list(map(int, input().split())) for i in range(Q)]",
"- neighbor = [[] for i in range(... | false | 0.03805 | 0.126603 | 0.300547 | [
"s728329557",
"s869273727"
] |
u562935282 | p03734 | python | s029018729 | s041130072 | 189 | 120 | 39,792 | 3,064 | Accepted | Accepted | 36.51 | def solve():
from itertools import accumulate
N, W = list(map(int, input().split()))
e = tuple([] for _ in range(4))
w1, v1 = list(map(int, input().split()))
e[0].append(v1)
for _ in range(N - 1):
_w, _v = list(map(int, input().split()))
e[_w - w1].append(_v)
... | def main():
N, W = list(map(int, input().split()))
ctr = [0] * 4
goods = [[] for _ in range(4)]
w1, v1 = list(map(int, input().split()))
ctr[0] += 1
goods[0].append(v1)
for _ in range(N - 1):
wi, vi = list(map(int, input().split()))
wi -= w1
ctr[wi] += 1... | 34 | 63 | 974 | 1,551 | def solve():
from itertools import accumulate
N, W = list(map(int, input().split()))
e = tuple([] for _ in range(4))
w1, v1 = list(map(int, input().split()))
e[0].append(v1)
for _ in range(N - 1):
_w, _v = list(map(int, input().split()))
e[_w - w1].append(_v)
g = [None for _... | def main():
N, W = list(map(int, input().split()))
ctr = [0] * 4
goods = [[] for _ in range(4)]
w1, v1 = list(map(int, input().split()))
ctr[0] += 1
goods[0].append(v1)
for _ in range(N - 1):
wi, vi = list(map(int, input().split()))
wi -= w1
ctr[wi] += 1
goods... | false | 46.031746 | [
"-def solve():",
"- from itertools import accumulate",
"+def main():",
"+ N, W = list(map(int, input().split()))",
"+ ctr = [0] * 4",
"+ goods = [[] for _ in range(4)]",
"+ w1, v1 = list(map(int, input().split()))",
"+ ctr[0] += 1",
"+ goods[0].append(v1)",
"+ for _ in rang... | false | 0.038204 | 0.037147 | 1.02846 | [
"s029018729",
"s041130072"
] |
u349091349 | p02836 | python | s152832498 | s948290687 | 175 | 63 | 38,384 | 61,896 | Accepted | Accepted | 64 | s=eval(input())
n=len(s)
c=0
for i in range(n-1):
if i >= n-1-i:
break
if s[i] != s[n-1-i]:
c+=1
print(c) | s=list(eval(input()))
c = 0
for i in range(len(s)//2):
if s[i] != s[-1-i]:
c+=1
print(c) | 9 | 6 | 131 | 99 | s = eval(input())
n = len(s)
c = 0
for i in range(n - 1):
if i >= n - 1 - i:
break
if s[i] != s[n - 1 - i]:
c += 1
print(c)
| s = list(eval(input()))
c = 0
for i in range(len(s) // 2):
if s[i] != s[-1 - i]:
c += 1
print(c)
| false | 33.333333 | [
"-s = eval(input())",
"-n = len(s)",
"+s = list(eval(input()))",
"-for i in range(n - 1):",
"- if i >= n - 1 - i:",
"- break",
"- if s[i] != s[n - 1 - i]:",
"+for i in range(len(s) // 2):",
"+ if s[i] != s[-1 - i]:"
] | false | 0.036369 | 0.036601 | 0.993648 | [
"s152832498",
"s948290687"
] |
u892305365 | p02629 | python | s721401348 | s622760844 | 29 | 26 | 8,956 | 9,196 | Accepted | Accepted | 10.34 | import math
def nextString(text, p):
if text[p] != 'z':
text[p] = chr(ord(text[p])+1)
return text
else:
text[p] = 'a'
nextString(text, p - 1)
n = int(eval(input()))
base = 26
digit = math.floor(math.log(1+(base-1)*n, base))
position = int(n - (base**digit - 1... | import math
n = int(eval(input()))
base = 26
digit = math.floor(math.log(1+(base-1)*n, base))
position = int(n - (base**digit - 1) / (base - 1))
txt = 'a' * digit
txt = list(txt)
for i in range(digit):
txt[digit - i - 1] = chr(ord(txt[digit - i - 1])+(position % base))
position = position //... | 27 | 17 | 526 | 342 | import math
def nextString(text, p):
if text[p] != "z":
text[p] = chr(ord(text[p]) + 1)
return text
else:
text[p] = "a"
nextString(text, p - 1)
n = int(eval(input()))
base = 26
digit = math.floor(math.log(1 + (base - 1) * n, base))
position = int(n - (base**digit - 1) / (base... | import math
n = int(eval(input()))
base = 26
digit = math.floor(math.log(1 + (base - 1) * n, base))
position = int(n - (base**digit - 1) / (base - 1))
txt = "a" * digit
txt = list(txt)
for i in range(digit):
txt[digit - i - 1] = chr(ord(txt[digit - i - 1]) + (position % base))
position = position // base
print... | false | 37.037037 | [
"-",
"-",
"-def nextString(text, p):",
"- if text[p] != \"z\":",
"- text[p] = chr(ord(text[p]) + 1)",
"- return text",
"- else:",
"- text[p] = \"a\"",
"- nextString(text, p - 1)",
"-"
] | false | 0.047559 | 0.043595 | 1.090933 | [
"s721401348",
"s622760844"
] |
u075012704 | p04000 | python | s070668089 | s587113314 | 1,958 | 1,801 | 166,860 | 166,896 | Accepted | Accepted | 8.02 | from collections import defaultdict, Counter
H, W, N = list(map(int, input().split()))
D = defaultdict(int)
for i in range(N):
a, b = list(map(int, input().split()))
for y in range(3):
for x in range(3):
if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:
D[(a - y, b - x)... | from collections import defaultdict
H, W, N = map(int, input().split())
D = defaultdict(int)
for i in range(N):
h, w = map(int, input().split())
h, w = h - 1, w - 1
for dh in range(-1, 2):
for dw in range(-1, 2):
if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):
... | 17 | 20 | 440 | 504 | from collections import defaultdict, Counter
H, W, N = list(map(int, input().split()))
D = defaultdict(int)
for i in range(N):
a, b = list(map(int, input().split()))
for y in range(3):
for x in range(3):
if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:
D[(a - y, b - x)] += 1
C ... | from collections import defaultdict
H, W, N = map(int, input().split())
D = defaultdict(int)
for i in range(N):
h, w = map(int, input().split())
h, w = h - 1, w - 1
for dh in range(-1, 2):
for dw in range(-1, 2):
if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):
... | false | 15 | [
"-from collections import defaultdict, Counter",
"+from collections import defaultdict",
"-H, W, N = list(map(int, input().split()))",
"+H, W, N = map(int, input().split())",
"- a, b = list(map(int, input().split()))",
"- for y in range(3):",
"- for x in range(3):",
"- if 0 < a... | false | 0.039903 | 0.144961 | 0.275264 | [
"s070668089",
"s587113314"
] |
u600195339 | p03161 | python | s436651563 | s125944970 | 467 | 167 | 214,552 | 84,732 | Accepted | Accepted | 64.24 | import sys
sys.setrecursionlimit(10**6)
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [None] * N
def solve(n):
if dp[n] is not None:
return dp[n]
if n == 0:
dp[n] = 0
elif n == 1:
dp[n] = abs(h[0] - h[1])
else:
ans = 10... | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
# dp = [None] * N
dp = [10**9] * N
for i in range(N):
if i == 0:
dp[0] = 0
elif i == 1:
dp[1] = abs(h[0]-h[1])
else:
# ans = 10**10
for j in range(1, K+1):
if j > i:
... | 30 | 20 | 649 | 492 | import sys
sys.setrecursionlimit(10**6)
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [None] * N
def solve(n):
if dp[n] is not None:
return dp[n]
if n == 0:
dp[n] = 0
elif n == 1:
dp[n] = abs(h[0] - h[1])
else:
ans = 10**10
for... | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
# dp = [None] * N
dp = [10**9] * N
for i in range(N):
if i == 0:
dp[0] = 0
elif i == 1:
dp[1] = abs(h[0] - h[1])
else:
# ans = 10**10
for j in range(1, K + 1):
if j > i:
bre... | false | 33.333333 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-dp = [None] * N",
"-",
"-",
"-def solve(n):",
"- if dp[n] is not None:",
"- return dp[n]",
"- if n == 0:",
"- dp[n] = 0",
"- elif n == 1:",
"- dp[n] = abs(h[0] - h[1])",
"+# dp = [None] * N",
"+dp = [10*... | false | 0.056354 | 0.035053 | 1.607659 | [
"s436651563",
"s125944970"
] |
u697713131 | p03074 | python | s739339637 | s678970034 | 73 | 46 | 9,384 | 9,384 | Accepted | Accepted | 36.99 | #参考 https://atcoder.jp/contests/abc124/submissions/4948803
from itertools import accumulate
n, k = list(map(int,input().split()))
p = list(eval(input()))
a = []
pre = '1'
cnt = 0
for i in range(n):
if pre != p[i]:
a.append(cnt)
cnt = 1
pre = p[i]
else:
cn... | #参考 https://atcoder.jp/contests/abc124/submissions/4948803
from itertools import accumulate
def f():
n, k = list(map(int,input().split()))
p = list(eval(input()))
a = []
pre = '1'
cnt = 0
for i in p:
if pre != i:
a.append(cnt)
cnt = 1
... | 30 | 32 | 582 | 708 | # 参考 https://atcoder.jp/contests/abc124/submissions/4948803
from itertools import accumulate
n, k = list(map(int, input().split()))
p = list(eval(input()))
a = []
pre = "1"
cnt = 0
for i in range(n):
if pre != p[i]:
a.append(cnt)
cnt = 1
pre = p[i]
else:
cnt += 1
a.append(cnt)
i... | # 参考 https://atcoder.jp/contests/abc124/submissions/4948803
from itertools import accumulate
def f():
n, k = list(map(int, input().split()))
p = list(eval(input()))
a = []
pre = "1"
cnt = 0
for i in p:
if pre != i:
a.append(cnt)
cnt = 1
pre = i
... | false | 6.25 | [
"-n, k = list(map(int, input().split()))",
"-p = list(eval(input()))",
"-a = []",
"-pre = \"1\"",
"-cnt = 0",
"-for i in range(n):",
"- if pre != p[i]:",
"- a.append(cnt)",
"- cnt = 1",
"- pre = p[i]",
"+",
"+def f():",
"+ n, k = list(map(int, input().split()))",
... | false | 0.043738 | 0.045531 | 0.960616 | [
"s739339637",
"s678970034"
] |
u513434790 | p02936 | python | s827385139 | s096843564 | 1,851 | 1,529 | 83,960 | 84,052 | Accepted | Accepted | 17.4 | from collections import deque
N, q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N-1)]
graph = [[] for i in range(N+1)]
for i,j in AB:
graph[i].append(j)
graph[j].append(i)
c = [0] * (N+1)
for i in range(q):
p1 , x1 = list(map(int, input().split()))
... | from collections import deque
import sys
input = sys.stdin.readline
N, q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N-1)]
graph = [[] for i in range(N+1)]
for i,j in AB:
graph[i].append(j)
graph[j].append(i)
c = [0] * (N+1)
for i in range(q):
p1 ,... | 32 | 34 | 627 | 667 | from collections import deque
N, q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N - 1)]
graph = [[] for i in range(N + 1)]
for i, j in AB:
graph[i].append(j)
graph[j].append(i)
c = [0] * (N + 1)
for i in range(q):
p1, x1 = list(map(int, input().split()))
c[p1] ... | from collections import deque
import sys
input = sys.stdin.readline
N, q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N - 1)]
graph = [[] for i in range(N + 1)]
for i, j in AB:
graph[i].append(j)
graph[j].append(i)
c = [0] * (N + 1)
for i in range(q):
p1, x1 = list... | false | 5.882353 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.043781 | 0.042985 | 1.018516 | [
"s827385139",
"s096843564"
] |
u826263061 | p03166 | python | s350504001 | s170921874 | 1,120 | 658 | 155,852 | 65,200 | Accepted | Accepted | 41.25 | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 16:05:26 2019
DP_G
@author: maezawa
"""
import sys
sys.setrecursionlimit(10**5)
n, m = list(map(int, input().split()))
v = [-1]*(n+1)
adj = [[] for _ in range(n+1)]
for _ in range(m):
i, j = list(map(int, input().split()))
adj[i].append(j)
... | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 16:05:26 2019
DP_G
@author: maezawa
"""
import sys
sys.setrecursionlimit(10**6)
n, m = list(map(int, input().split()))
v = [-1]*(n+1)
adj = [[] for _ in range(n+1)]
for _ in range(m):
i, j = list(map(int, input().split()))
adj[i].append(j)
... | 33 | 34 | 642 | 649 | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 16:05:26 2019
DP_G
@author: maezawa
"""
import sys
sys.setrecursionlimit(10**5)
n, m = list(map(int, input().split()))
v = [-1] * (n + 1)
adj = [[] for _ in range(n + 1)]
for _ in range(m):
i, j = list(map(int, input().split()))
adj[i].append(j)
def dfs(vi):
... | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 16:05:26 2019
DP_G
@author: maezawa
"""
import sys
sys.setrecursionlimit(10**6)
n, m = list(map(int, input().split()))
v = [-1] * (n + 1)
adj = [[] for _ in range(n + 1)]
for _ in range(m):
i, j = list(map(int, input().split()))
adj[i].append(j)
def dfs(vi):
... | false | 2.941176 | [
"-sys.setrecursionlimit(10**5)",
"+sys.setrecursionlimit(10**6)"
] | false | 0.034017 | 0.037598 | 0.904747 | [
"s350504001",
"s170921874"
] |
u754022296 | p04034 | python | s332167655 | s888804175 | 353 | 214 | 4,596 | 10,376 | Accepted | Accepted | 39.38 | n, m = list(map(int, input().split()))
r = [0]*n
r[0] = 1
c = [1]*n
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if r[x]:
if c[x] == 1:
r[x] = 0
r[y] = 1
c[x] -= 1
c[y] += 1
print((r.count(1))) | n, m = list(map(int, input().split()))
C = [0]*(n+1)
C[1] = 1
D = [1]*(n+1)
for _ in range(m):
x, y = list(map(int, input().split()))
if C[x]:
C[y] = 1
if D[x] == 1:
C[x] = 0
D[x] -= 1
D[y] += 1
ans = sum(C)
print(ans) | 15 | 14 | 246 | 241 | n, m = list(map(int, input().split()))
r = [0] * n
r[0] = 1
c = [1] * n
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if r[x]:
if c[x] == 1:
r[x] = 0
r[y] = 1
c[x] -= 1
c[y] += 1
print((r.count(1)))
| n, m = list(map(int, input().split()))
C = [0] * (n + 1)
C[1] = 1
D = [1] * (n + 1)
for _ in range(m):
x, y = list(map(int, input().split()))
if C[x]:
C[y] = 1
if D[x] == 1:
C[x] = 0
D[x] -= 1
D[y] += 1
ans = sum(C)
print(ans)
| false | 6.666667 | [
"-r = [0] * n",
"-r[0] = 1",
"-c = [1] * n",
"+C = [0] * (n + 1)",
"+C[1] = 1",
"+D = [1] * (n + 1)",
"- x -= 1",
"- y -= 1",
"- if r[x]:",
"- if c[x] == 1:",
"- r[x] = 0",
"- r[y] = 1",
"- c[x] -= 1",
"- c[y] += 1",
"-print((r.count(1)))",
"+ ... | false | 0.062687 | 0.093031 | 0.673826 | [
"s332167655",
"s888804175"
] |
u429029348 | p02706 | python | s161689933 | s399375259 | 23 | 21 | 10,004 | 9,956 | Accepted | Accepted | 8.7 | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
total=sum(a)
if n<total:
print((-1))
else:
print((n-total)) | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a_sum=sum(a)
if n<a_sum:
print((-1))
else:
print((n-a_sum)) | 7 | 8 | 131 | 133 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
total = sum(a)
if n < total:
print((-1))
else:
print((n - total))
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a_sum = sum(a)
if n < a_sum:
print((-1))
else:
print((n - a_sum))
| false | 12.5 | [
"-total = sum(a)",
"-if n < total:",
"+a_sum = sum(a)",
"+if n < a_sum:",
"- print((n - total))",
"+ print((n - a_sum))"
] | false | 0.037011 | 0.036183 | 1.022877 | [
"s161689933",
"s399375259"
] |
u858575800 | p03326 | python | s549550616 | s015670758 | 34 | 26 | 3,316 | 3,316 | Accepted | Accepted | 23.53 | N, M = list(map(int, input().split()))
ls = []
for i in range(N):
ls.append(list(map(int, input().split())))
answer = []
temp_ls = []
for j in [[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1], [-1, 1, 1],[-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]:
temp_ls = []
for x in ls:
temp = 0
... | N, M = list(map(int, input().split()))
xyz = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for a in [1, -1]:
for b in [1, -1]:
for c in [1, -1]:
s = []
for x, y, z in xyz:
s.append(a*x + b*y + c*z)
s.sort(reverse=True)
... | 21 | 13 | 550 | 354 | N, M = list(map(int, input().split()))
ls = []
for i in range(N):
ls.append(list(map(int, input().split())))
answer = []
temp_ls = []
for j in [
[1, 1, 1],
[1, 1, -1],
[1, -1, 1],
[1, -1, -1],
[-1, 1, 1],
[-1, 1, -1],
[-1, -1, 1],
[-1, -1, -1],
]:
temp_ls = []
for x in ls:
... | N, M = list(map(int, input().split()))
xyz = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for a in [1, -1]:
for b in [1, -1]:
for c in [1, -1]:
s = []
for x, y, z in xyz:
s.append(a * x + b * y + c * z)
s.sort(reverse=True)
ans =... | false | 38.095238 | [
"-ls = []",
"-for i in range(N):",
"- ls.append(list(map(int, input().split())))",
"-answer = []",
"-temp_ls = []",
"-for j in [",
"- [1, 1, 1],",
"- [1, 1, -1],",
"- [1, -1, 1],",
"- [1, -1, -1],",
"- [-1, 1, 1],",
"- [-1, 1, -1],",
"- [-1, -1, 1],",
"- [-1, -1,... | false | 0.036487 | 0.080739 | 0.451912 | [
"s549550616",
"s015670758"
] |
u597455618 | p03836 | python | s870323568 | s284775350 | 28 | 25 | 9,088 | 9,148 | Accepted | Accepted | 10.71 | def main():
sx, sy, tx, ty = list(map(int, input().split()))
x = tx - sx
y = ty - sy
s = ""
for i in range(2):
tmp = ""
if i:
tmp += "D"
tmp += "R"*(x+1)
tmp += "U"*(y+1)
tmp += "L"
else:
tmp += "R"*x
... | def main():
sx, sy, tx, ty = list(map(int, input().split()))
x = tx - sx
y = ty - sy
s = ""
s += "R"*x
s += "U"*y
s += s.translate(str.maketrans({"U": "D",
"D": "U", "L": "R", "R": "L"}))
tmp = ""
tmp += "D"
tmp += "R"*(x+1)
tmp... | 23 | 21 | 538 | 534 | def main():
sx, sy, tx, ty = list(map(int, input().split()))
x = tx - sx
y = ty - sy
s = ""
for i in range(2):
tmp = ""
if i:
tmp += "D"
tmp += "R" * (x + 1)
tmp += "U" * (y + 1)
tmp += "L"
else:
tmp += "R" * x
... | def main():
sx, sy, tx, ty = list(map(int, input().split()))
x = tx - sx
y = ty - sy
s = ""
s += "R" * x
s += "U" * y
s += s.translate(str.maketrans({"U": "D", "D": "U", "L": "R", "R": "L"}))
tmp = ""
tmp += "D"
tmp += "R" * (x + 1)
tmp += "U" * (y + 1)
tmp += "L"
s +... | false | 8.695652 | [
"- for i in range(2):",
"- tmp = \"\"",
"- if i:",
"- tmp += \"D\"",
"- tmp += \"R\" * (x + 1)",
"- tmp += \"U\" * (y + 1)",
"- tmp += \"L\"",
"- else:",
"- tmp += \"R\" * x",
"- tmp += \"U\" * y",
"- ... | false | 0.045432 | 0.049433 | 0.919048 | [
"s870323568",
"s284775350"
] |
u385244248 | p03001 | python | s863478551 | s933362822 | 184 | 170 | 38,384 | 38,256 | Accepted | Accepted | 7.61 | W,H,a,b =[int(i) for i in input().split()]
if a == W or b == H or a == 0 or b == 0:
r = 0
elif a/W == b/H:
r = 1
else :
r = 0
print(((W*H)/2,int(r)))
| W,H,a,b =[int(i) for i in input().split()]
if (a,b) == (W/2,H/2):
r = 1
else:
r = 0
print(((W*H)/2,int(r)))
| 8 | 6 | 167 | 119 | W, H, a, b = [int(i) for i in input().split()]
if a == W or b == H or a == 0 or b == 0:
r = 0
elif a / W == b / H:
r = 1
else:
r = 0
print(((W * H) / 2, int(r)))
| W, H, a, b = [int(i) for i in input().split()]
if (a, b) == (W / 2, H / 2):
r = 1
else:
r = 0
print(((W * H) / 2, int(r)))
| false | 25 | [
"-if a == W or b == H or a == 0 or b == 0:",
"- r = 0",
"-elif a / W == b / H:",
"+if (a, b) == (W / 2, H / 2):"
] | false | 0.105033 | 0.104226 | 1.007741 | [
"s863478551",
"s933362822"
] |
u347600233 | p02860 | python | s357388843 | s039632685 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
s = eval(input())
flag = 1
if n % 2:
print('No')
else:
for i in range(n//2):
if s[i] != s[n//2 + i]:
flag = 0
if flag:
print('Yes')
else:
print('No') | n = int(eval(input()))
s = eval(input())
flag = 1
if n % 2:
print('No')
else:
if s.count(s[0:n//2]) == 2:
print('Yes')
else:
print('No') | 14 | 11 | 226 | 163 | n = int(eval(input()))
s = eval(input())
flag = 1
if n % 2:
print("No")
else:
for i in range(n // 2):
if s[i] != s[n // 2 + i]:
flag = 0
if flag:
print("Yes")
else:
print("No")
| n = int(eval(input()))
s = eval(input())
flag = 1
if n % 2:
print("No")
else:
if s.count(s[0 : n // 2]) == 2:
print("Yes")
else:
print("No")
| false | 21.428571 | [
"- for i in range(n // 2):",
"- if s[i] != s[n // 2 + i]:",
"- flag = 0",
"- if flag:",
"+ if s.count(s[0 : n // 2]) == 2:"
] | false | 0.050459 | 0.043817 | 1.151594 | [
"s357388843",
"s039632685"
] |
u857759499 | p02756 | python | s637882636 | s758443101 | 378 | 111 | 20,336 | 20,360 | Accepted | Accepted | 70.63 | a = eval(input())
n = int(eval(input()))
rev = False
front = []
back = []
q = [eval(input()) for i in range(n)]
for i in q:
if i == "1":
rev = not rev
else:
i,f,c = i.split()
if rev == False:
if f == "1":
front.append(c)
else:
... | def solve(string):
s, q, *qs = string.split("\n")
pre = []
post = []
preapp = lambda x:pre.append(x)
postapp = lambda x:post.append(x)
r = False
for _q in qs[::-1]:
if _q == "1":
r = not r
continue
_, f, c = _q.split()
if r and f ==... | 25 | 22 | 586 | 608 | a = eval(input())
n = int(eval(input()))
rev = False
front = []
back = []
q = [eval(input()) for i in range(n)]
for i in q:
if i == "1":
rev = not rev
else:
i, f, c = i.split()
if rev == False:
if f == "1":
front.append(c)
else:
bac... | def solve(string):
s, q, *qs = string.split("\n")
pre = []
post = []
preapp = lambda x: pre.append(x)
postapp = lambda x: post.append(x)
r = False
for _q in qs[::-1]:
if _q == "1":
r = not r
continue
_, f, c = _q.split()
if r and f == "2" or no... | false | 12 | [
"-a = eval(input())",
"-n = int(eval(input()))",
"-rev = False",
"-front = []",
"-back = []",
"-q = [eval(input()) for i in range(n)]",
"-for i in q:",
"- if i == \"1\":",
"- rev = not rev",
"- else:",
"- i, f, c = i.split()",
"- if rev == False:",
"- if... | false | 0.072771 | 0.037477 | 1.941751 | [
"s637882636",
"s758443101"
] |
u697758384 | p02729 | python | s216171489 | s150477147 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N, M = list(map(int,input().split()))
print((N*(N-1)//2+M*(M-1)//2))
| N, M = list(map(int,input().split()))
print(((N*(N-1)+M*(M-1))//2)) | 3 | 3 | 64 | 62 | N, M = list(map(int, input().split()))
print((N * (N - 1) // 2 + M * (M - 1) // 2))
| N, M = list(map(int, input().split()))
print(((N * (N - 1) + M * (M - 1)) // 2))
| false | 0 | [
"-print((N * (N - 1) // 2 + M * (M - 1) // 2))",
"+print(((N * (N - 1) + M * (M - 1)) // 2))"
] | false | 0.042302 | 0.041326 | 1.023619 | [
"s216171489",
"s150477147"
] |
u355154595 | p03260 | python | s014111943 | s531381894 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | a,s=list(map(int,input().split()))
if a!=2 and s!=2:
print('Yes')
else:
print('No')
| a,s=list(map(int,input().split()))
if a==2 or s==2:
print('No')
else:
print('Yes')
| 6 | 5 | 96 | 89 | a, s = list(map(int, input().split()))
if a != 2 and s != 2:
print("Yes")
else:
print("No")
| a, s = list(map(int, input().split()))
if a == 2 or s == 2:
print("No")
else:
print("Yes")
| false | 16.666667 | [
"-if a != 2 and s != 2:",
"+if a == 2 or s == 2:",
"+ print(\"No\")",
"+else:",
"-else:",
"- print(\"No\")"
] | false | 0.048626 | 0.049778 | 0.976845 | [
"s014111943",
"s531381894"
] |
u254871849 | p02887 | python | s219615524 | s797951562 | 32 | 27 | 3,316 | 3,316 | Accepted | Accepted | 15.62 | # 2019-11-19 10:28:31(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import a... | import sys
n, s = sys.stdin.read().split()
def main():
cnt = 0
prev = '$'
for c in s:
if c == prev: continue
cnt += 1
prev = c
print(cnt)
if __name__ == '__main__':
main() | 28 | 15 | 629 | 233 | # 2019-11-19 10:28:31(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# fro... | import sys
n, s = sys.stdin.read().split()
def main():
cnt = 0
prev = "$"
for c in s:
if c == prev:
continue
cnt += 1
prev = c
print(cnt)
if __name__ == "__main__":
main()
| false | 46.428571 | [
"-# 2019-11-19 10:28:31(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# imp... | false | 0.054654 | 0.044897 | 1.217332 | [
"s219615524",
"s797951562"
] |
u633068244 | p00590 | python | s849306076 | s572433830 | 140 | 110 | 4,764 | 4,760 | Accepted | Accepted | 21.43 | import math
r = 9999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for j in range(2*i+1,r,i+1)]
prime = []
for i in range(r):
if p[i]:
prime.append(i)
while True:
try:
n = int(input())
count = 0
... | import math
r = 9999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for j in range(2*i+1,r,i+1)]
prime = []
for i in range(r):
if p[i]:
prime.append(i)
while True:
try:
n = int(input())
count = 0
... | 25 | 25 | 509 | 504 | import math
r = 9999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(sqrt):
if p[i]:
p[2 * i + 1 :: i + 1] = [0 for j in range(2 * i + 1, r, i + 1)]
prime = []
for i in range(r):
if p[i]:
prime.append(i)
while True:
try:
n = int(input())
count = 0
... | import math
r = 9999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(sqrt):
if p[i]:
p[2 * i + 1 :: i + 1] = [0 for j in range(2 * i + 1, r, i + 1)]
prime = []
for i in range(r):
if p[i]:
prime.append(i)
while True:
try:
n = int(input())
count = 0
... | false | 0 | [
"- if p[i] * p[n - i - 1] == 1:",
"+ if p[n - i - 1] == 1:"
] | false | 0.106722 | 0.165208 | 0.645984 | [
"s849306076",
"s572433830"
] |
u609407244 | p02258 | python | s378305668 | s558494740 | 930 | 810 | 6,724 | 15,232 | Accepted | Accepted | 12.9 | n = int(eval(input()))
R = (int(eval(input())) for _ in range(n))
ret = -(10 ** 9)
mn = next(R)
for r in R:
ret = max(ret, r - mn)
mn = min(mn, r)
print(ret) | import itertools
n = int(eval(input()))
R = [int(eval(input())) for _ in range(n)]
ret = -(10 ** 9)
mn = R[0]
for r in itertools.islice(R, 1, len(R)):
ret = max(ret, r - mn)
mn = min(mn, r)
print(ret) | 8 | 9 | 160 | 204 | n = int(eval(input()))
R = (int(eval(input())) for _ in range(n))
ret = -(10**9)
mn = next(R)
for r in R:
ret = max(ret, r - mn)
mn = min(mn, r)
print(ret)
| import itertools
n = int(eval(input()))
R = [int(eval(input())) for _ in range(n)]
ret = -(10**9)
mn = R[0]
for r in itertools.islice(R, 1, len(R)):
ret = max(ret, r - mn)
mn = min(mn, r)
print(ret)
| false | 11.111111 | [
"+import itertools",
"+",
"-R = (int(eval(input())) for _ in range(n))",
"+R = [int(eval(input())) for _ in range(n)]",
"-mn = next(R)",
"-for r in R:",
"+mn = R[0]",
"+for r in itertools.islice(R, 1, len(R)):"
] | false | 0.079464 | 0.036882 | 2.154557 | [
"s378305668",
"s558494740"
] |
u297574184 | p02973 | python | s626053534 | s745037819 | 246 | 99 | 7,840 | 7,832 | Accepted | Accepted | 59.76 | from bisect import bisect_left, bisect_right
N = int(eval(input()))
As = [int(eval(input())) for _ in range(N)]
dp = [float('inf')] * (N+1)
for A in reversed(As):
i = bisect_right(dp, A)
dp[i] = A
print((dp.index(float('inf'))))
| from bisect import bisect_left, bisect_right
import sys
input = sys.stdin.readline
INF = float('inf')
N = int(eval(input()))
As = [-int(eval(input())) for _ in range(N)]
def getLenLNDS(As):
dp = [-INF]
for A in As:
if dp[-1] <= A:
dp.append(A)
else:
i = ... | 12 | 22 | 238 | 411 | from bisect import bisect_left, bisect_right
N = int(eval(input()))
As = [int(eval(input())) for _ in range(N)]
dp = [float("inf")] * (N + 1)
for A in reversed(As):
i = bisect_right(dp, A)
dp[i] = A
print((dp.index(float("inf"))))
| from bisect import bisect_left, bisect_right
import sys
input = sys.stdin.readline
INF = float("inf")
N = int(eval(input()))
As = [-int(eval(input())) for _ in range(N)]
def getLenLNDS(As):
dp = [-INF]
for A in As:
if dp[-1] <= A:
dp.append(A)
else:
i = bisect_right(dp... | false | 45.454545 | [
"+import sys",
"+input = sys.stdin.readline",
"+INF = float(\"inf\")",
"-As = [int(eval(input())) for _ in range(N)]",
"-dp = [float(\"inf\")] * (N + 1)",
"-for A in reversed(As):",
"- i = bisect_right(dp, A)",
"- dp[i] = A",
"-print((dp.index(float(\"inf\"))))",
"+As = [-int(eval(input())) ... | false | 0.007884 | 0.038071 | 0.207089 | [
"s626053534",
"s745037819"
] |
u281610856 | p02959 | python | s492165013 | s653243624 | 216 | 95 | 18,476 | 18,624 | Accepted | Accepted | 56.02 | n = int(eval(input()))
a = list(map(int, input().split())) # 初期のモンスターの数
b = list(map(int, input().split())) # 各勇者が倒せるモンスターの数
num = 0
for i in range(n):
# 倒したモンスターの数をnumに追加
num += min(a[i], b[i])
if b[i] - a[i] > 0: # モンスターが残っていないとき
# 隣町の勇者が倒せるモンスターの数か,隣町のモンスター全てか.
num += min(b[i]... | def main():
n = int(eval(input()))
A = list(map(int, input().split()))
Ai = sum(A)
B = list(map(int, input().split()))
for i in range(n):
b = B[i]
if b > A[i]:
b -= A[i]
A[i] = 0
if b > A[i + 1]:
b -= A[i + 1]
... | 13 | 23 | 430 | 501 | n = int(eval(input()))
a = list(map(int, input().split())) # 初期のモンスターの数
b = list(map(int, input().split())) # 各勇者が倒せるモンスターの数
num = 0
for i in range(n):
# 倒したモンスターの数をnumに追加
num += min(a[i], b[i])
if b[i] - a[i] > 0: # モンスターが残っていないとき
# 隣町の勇者が倒せるモンスターの数か,隣町のモンスター全てか.
num += min(b[i] - a[i], ... | def main():
n = int(eval(input()))
A = list(map(int, input().split()))
Ai = sum(A)
B = list(map(int, input().split()))
for i in range(n):
b = B[i]
if b > A[i]:
b -= A[i]
A[i] = 0
if b > A[i + 1]:
b -= A[i + 1]
A[i + ... | false | 43.478261 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split())) # 初期のモンスターの数",
"-b = list(map(int, input().split())) # 各勇者が倒せるモンスターの数",
"-num = 0",
"-for i in range(n):",
"- # 倒したモンスターの数をnumに追加",
"- num += min(a[i], b[i])",
"- if b[i] - a[i] > 0: # モンスターが残っていないとき",
"- # 隣町の勇者が倒せる... | false | 0.044823 | 0.046553 | 0.96285 | [
"s492165013",
"s653243624"
] |
u952798873 | p02848 | python | s231859508 | s115282521 | 28 | 24 | 3,188 | 3,060 | Accepted | Accepted | 14.29 | N = int(eval(input()))
S = eval(input())
L = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
temp = []
ans = ""
for i in range(len(S)):
su = L.index(S[i])+N
if su >=26:
su -= 26
temp.append(su)
for j in range(len(S)):
ans +... | N = int(eval(input()))
S = eval(input())
ans = ""
for i in range(len(S)):
su = ord(S[i])+N
if su >= 91:
su -= 26
ans += chr(su)
print(ans) | 16 | 11 | 343 | 150 | N = int(eval(input()))
S = eval(input())
L = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
]
temp = []
ans = ""
for i in range(len... | N = int(eval(input()))
S = eval(input())
ans = ""
for i in range(len(S)):
su = ord(S[i]) + N
if su >= 91:
su -= 26
ans += chr(su)
print(ans)
| false | 31.25 | [
"-L = [",
"- \"A\",",
"- \"B\",",
"- \"C\",",
"- \"D\",",
"- \"E\",",
"- \"F\",",
"- \"G\",",
"- \"H\",",
"- \"I\",",
"- \"J\",",
"- \"K\",",
"- \"L\",",
"- \"M\",",
"- \"N\",",
"- \"O\",",
"- \"P\",",
"- \"Q\",",
"- \"R\",",
... | false | 0.047725 | 0.043547 | 1.095955 | [
"s231859508",
"s115282521"
] |
u077291787 | p03073 | python | s062335089 | s406718506 | 39 | 26 | 3,188 | 3,188 | Accepted | Accepted | 33.33 | # ABC124C - Coloring Colorfully
def main():
s = eval(input())
a, ans = s[0], 0
for i, j in enumerate(s):
if (i % 2 and j == a) or (not i % 2 and j != a):
ans += 1
print(ans)
if __name__ == "__main__":
main() | # ABC124C - Coloring Colorfully
def main():
S = eval(input())
a = sum(i != "1" for i in S[::2]) + sum(i != "0" for i in S[1::2])
b = len(S) - a
print((min(a, b)))
if __name__ == "__main__":
main() | 12 | 10 | 254 | 219 | # ABC124C - Coloring Colorfully
def main():
s = eval(input())
a, ans = s[0], 0
for i, j in enumerate(s):
if (i % 2 and j == a) or (not i % 2 and j != a):
ans += 1
print(ans)
if __name__ == "__main__":
main()
| # ABC124C - Coloring Colorfully
def main():
S = eval(input())
a = sum(i != "1" for i in S[::2]) + sum(i != "0" for i in S[1::2])
b = len(S) - a
print((min(a, b)))
if __name__ == "__main__":
main()
| false | 16.666667 | [
"- s = eval(input())",
"- a, ans = s[0], 0",
"- for i, j in enumerate(s):",
"- if (i % 2 and j == a) or (not i % 2 and j != a):",
"- ans += 1",
"- print(ans)",
"+ S = eval(input())",
"+ a = sum(i != \"1\" for i in S[::2]) + sum(i != \"0\" for i in S[1::2])",
"+ ... | false | 0.047854 | 0.046779 | 1.022991 | [
"s062335089",
"s406718506"
] |
u075012704 | p03786 | python | s969910066 | s179677706 | 717 | 112 | 15,020 | 14,252 | Accepted | Accepted | 84.38 | import math
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
left = 0
right = N
for i in range(int(math.log(N, 2)) + 10):
center = (left + right) // 2
B = A[:center] + A[center+1:]
slime = A[center]
for b in B:
if 2*slime >= b:
slime += b
els... | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
cumA = [0]
for a in A:
if a > 2*cumA[-1]:
t = A.index(a)
cumA.append(cumA[-1] + a)
print((N-t))
| 21 | 8 | 417 | 178 | import math
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
left = 0
right = N
for i in range(int(math.log(N, 2)) + 10):
center = (left + right) // 2
B = A[:center] + A[center + 1 :]
slime = A[center]
for b in B:
if 2 * slime >= b:
slime += b
else:
... | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
cumA = [0]
for a in A:
if a > 2 * cumA[-1]:
t = A.index(a)
cumA.append(cumA[-1] + a)
print((N - t))
| false | 61.904762 | [
"-import math",
"-",
"-left = 0",
"-right = N",
"-for i in range(int(math.log(N, 2)) + 10):",
"- center = (left + right) // 2",
"- B = A[:center] + A[center + 1 :]",
"- slime = A[center]",
"- for b in B:",
"- if 2 * slime >= b:",
"- slime += b",
"- else:",
... | false | 0.042435 | 0.036889 | 1.150342 | [
"s969910066",
"s179677706"
] |
u546285759 | p00014 | python | s314782695 | s804825868 | 50 | 20 | 7,772 | 5,592 | Accepted | Accepted | 60 | def f(x):
return pow(x, 2)
while True:
try:
d = int(eval(input()))
except:
break
print((sum(f(x) * d for x in range(d, 600, d)))) | while True:
try:
d = int(eval(input()))
except:
break
print((sum(d * x**2 for x in range(d, 600, d))))
| 9 | 7 | 162 | 130 | def f(x):
return pow(x, 2)
while True:
try:
d = int(eval(input()))
except:
break
print((sum(f(x) * d for x in range(d, 600, d))))
| while True:
try:
d = int(eval(input()))
except:
break
print((sum(d * x**2 for x in range(d, 600, d))))
| false | 22.222222 | [
"-def f(x):",
"- return pow(x, 2)",
"-",
"-",
"- print((sum(f(x) * d for x in range(d, 600, d))))",
"+ print((sum(d * x**2 for x in range(d, 600, d))))"
] | false | 0.059061 | 0.037826 | 1.561375 | [
"s314782695",
"s804825868"
] |
u562935282 | p02844 | python | s551304581 | s177880747 | 953 | 279 | 3,188 | 3,316 | Accepted | Accepted | 70.72 | n = int(eval(input()))
s = list(map(int, eval(input())))
dp = tuple([0] * 1000 for _ in range(4))
dp[0][0] = 1
# dp[x][int(str)]:=x文字のstrは構成可能か?0/1
for x in s:
for incomplete_key in range(100):
dp[3][incomplete_key * 10 + x] |= dp[2][incomplete_key]
for incomplete_key in range(10):
... | from operator import add
class SegmentTreeClass:
def __init__(self,
init_val: 'initial value: iterable',
segfunc: 'operation unique in case',
ide_ele: 'identity element corresponding init_val' = 0,
):
self.segfunc = segfunc
... | 17 | 80 | 405 | 2,264 | n = int(eval(input()))
s = list(map(int, eval(input())))
dp = tuple([0] * 1000 for _ in range(4))
dp[0][0] = 1
# dp[x][int(str)]:=x文字のstrは構成可能か?0/1
for x in s:
for incomplete_key in range(100):
dp[3][incomplete_key * 10 + x] |= dp[2][incomplete_key]
for incomplete_key in range(10):
dp[2][incompl... | from operator import add
class SegmentTreeClass:
def __init__(
self,
init_val: "initial value: iterable",
segfunc: "operation unique in case",
ide_ele: "identity element corresponding init_val" = 0,
):
self.segfunc = segfunc
self.ide_ele = ide_ele
self.s... | false | 78.75 | [
"+from operator import add",
"+",
"+",
"+class SegmentTreeClass:",
"+ def __init__(",
"+ self,",
"+ init_val: \"initial value: iterable\",",
"+ segfunc: \"operation unique in case\",",
"+ ide_ele: \"identity element corresponding init_val\" = 0,",
"+ ):",
"+ ... | false | 0.044935 | 0.074629 | 0.602102 | [
"s551304581",
"s177880747"
] |
u332385682 | p03722 | python | s817870887 | s814794626 | 522 | 211 | 3,404 | 45,168 | Accepted | Accepted | 59.58 | 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... | import sys
from math import sqrt
inf = 1<<60
def solve():
N, M = list(map(int, sys.stdin.readline().split()))
edges = [None] * M
Adj = [[] for i in range(N)]
Adjr = [[] for i in range(N)]
for i in range(M):
ai, bi, ci = list(map(int, sys.stdin.readline().split()))
e... | 41 | 64 | 825 | 1,395 | 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:
... | import sys
from math import sqrt
inf = 1 << 60
def solve():
N, M = list(map(int, sys.stdin.readline().split()))
edges = [None] * M
Adj = [[] for i in range(N)]
Adjr = [[] for i in range(N)]
for i in range(M):
ai, bi, ci = list(map(int, sys.stdin.readline().split()))
edges[i] = (ai... | false | 35.9375 | [
"+from math import sqrt",
"- N, M = list(map(int, input().split()))",
"+ N, M = list(map(int, sys.stdin.readline().split()))",
"+ Adj = [[] for i in range(N)]",
"+ Adjr = [[] for i in range(N)]",
"- ai, bi = ai - 1, bi - 1",
"- edges[i] = (ai, bi, -ci)",
"- ans = BellmanFo... | false | 0.076931 | 0.036698 | 2.096322 | [
"s817870887",
"s814794626"
] |
u567281053 | p02277 | python | s448911202 | s116920035 | 1,260 | 1,010 | 54,544 | 54,556 | Accepted | Accepted | 19.84 | import sys
class card:
def __init__(self, types, value):
self.types = types
self.value = value
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, p, q - 1)
quickSort(A, q + 1, r)
def partition(A, p, r):
x = A[r].value
i = p - 1... | import sys
class card:
def __init__(self, suit, num):
self.suit = suit
self.num = num
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, p, q - 1)
quickSort(A, q + 1, r)
def partition(A, p, r):
x = A[r].num
i = p - 1
for j... | 48 | 45 | 1,145 | 1,054 | import sys
class card:
def __init__(self, types, value):
self.types = types
self.value = value
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, p, q - 1)
quickSort(A, q + 1, r)
def partition(A, p, r):
x = A[r].value
i = p - 1
for j i... | import sys
class card:
def __init__(self, suit, num):
self.suit = suit
self.num = num
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, p, q - 1)
quickSort(A, q + 1, r)
def partition(A, p, r):
x = A[r].num
i = p - 1
for j in range(p, ... | false | 6.25 | [
"- def __init__(self, types, value):",
"- self.types = types",
"- self.value = value",
"+ def __init__(self, suit, num):",
"+ self.suit = suit",
"+ self.num = num",
"- x = A[r].value",
"+ x = A[r].num",
"- if A[j].value <= x:",
"+ if A[j].num <... | false | 0.04566 | 0.043361 | 1.053009 | [
"s448911202",
"s116920035"
] |
u888092736 | p02574 | python | s252991181 | s409652624 | 1,246 | 564 | 207,888 | 121,976 | Accepted | Accepted | 54.74 | from math import gcd
from functools import reduce
def factor(n):
res = []
for i in range(2, int(n ** 0.5) + 1):
while n % i == 0:
res.append(i)
n //= i
if n > 1:
return res + [n]
else:
return res
def solve():
PC = "pairwise coprime... | from math import gcd
from functools import reduce
class SmallestPrimeFactors:
def __init__(self, n):
self.spf = list(range(n + 1))
for i in range(2, int(n ** 0.5) + 1):
if self.spf[i] == i:
for j in range(i * i, n + 1, i):
if self.spf[j] ==... | 47 | 46 | 858 | 1,084 | from math import gcd
from functools import reduce
def factor(n):
res = []
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
res.append(i)
n //= i
if n > 1:
return res + [n]
else:
return res
def solve():
PC = "pairwise coprime"
SC = "setwise... | from math import gcd
from functools import reduce
class SmallestPrimeFactors:
def __init__(self, n):
self.spf = list(range(n + 1))
for i in range(2, int(n**0.5) + 1):
if self.spf[i] == i:
for j in range(i * i, n + 1, i):
if self.spf[j] == j:
... | false | 2.12766 | [
"-def factor(n):",
"- res = []",
"- for i in range(2, int(n**0.5) + 1):",
"- while n % i == 0:",
"- res.append(i)",
"- n //= i",
"- if n > 1:",
"- return res + [n]",
"- else:",
"- return res",
"+class SmallestPrimeFactors:",
"+ def __in... | false | 0.070909 | 0.03928 | 1.805215 | [
"s252991181",
"s409652624"
] |
u562935282 | p03262 | python | s745466305 | s051298813 | 122 | 79 | 14,352 | 11,596 | Accepted | Accepted | 35.25 | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
N, X = list(map(int, input().split()))
x = tuple(map(int, input().split()))
x = tuple([a - X for a in x])
xl = [-b for b in [a for a in x if a < 0]]
xr = [a for a in x if a >= 0]
g = 0
for xx in xl:
g = gcd(g... | from functools import reduce
def main():
from functools import reduce
N, X = list(map(int, input().split()))
A = (int(j) - X for j in input().split())
def gcd(a, b):
while b:
a, b = b, a % b
return a
print((abs(reduce(gcd, A))))
if __name__ == '__main__... | 21 | 16 | 381 | 298 | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
N, X = list(map(int, input().split()))
x = tuple(map(int, input().split()))
x = tuple([a - X for a in x])
xl = [-b for b in [a for a in x if a < 0]]
xr = [a for a in x if a >= 0]
g = 0
for xx in xl:
g = gcd(g, xx)
for xx in xr:
... | from functools import reduce
def main():
from functools import reduce
N, X = list(map(int, input().split()))
A = (int(j) - X for j in input().split())
def gcd(a, b):
while b:
a, b = b, a % b
return a
print((abs(reduce(gcd, A))))
if __name__ == "__main__":
main(... | false | 23.809524 | [
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- else:",
"- return gcd(b, a % b)",
"+from functools import reduce",
"-N, X = list(map(int, input().split()))",
"-x = tuple(map(int, input().split()))",
"-x = tuple([a - X for a in x])",
"-xl = [-b for b in [a for a in x if a < ... | false | 0.037778 | 0.041599 | 0.908147 | [
"s745466305",
"s051298813"
] |
u941753895 | p03197 | python | s203863255 | s758526076 | 91 | 76 | 5,076 | 14,676 | Accepted | Accepted | 16.48 | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.... | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) f... | 31 | 27 | 649 | 674 | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | false | 12.903226 | [
"+# def LF(): return [float(x) for x in sys.stdin.readline().split()]",
"+",
"+",
"+def F():",
"+ return float(sys.stdin.readline())",
"- # 最後に食べたら勝ち",
"- # 1を引けば勝ち",
"- # 奇数調整をする",
"- # 相手に全て偶数を与えるよう調整する",
"- # all偶数だと負け",
"- n = I()",
"- f = False",
"- for _ in r... | false | 0.041807 | 0.094145 | 0.444069 | [
"s203863255",
"s758526076"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.