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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u744920373 | p02787 | python | s771772350 | s239751525 | 673 | 545 | 120,284 | 119,644 | Accepted | Accepted | 19.02 | H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N)]
INF = 10**10+1
dp = [[INF]*(H+1) for i in range(N+1)]
dp[0][0] = 0
for i in range(1, N+1):
dp[i][0] = 0
A = AB[i-1][0]
for j in range(1, H+1):
if j-AB[i-1][0]>=0:
dp[i][j] = min(... | H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N)]
INF = 10**10+1
dp = [[INF]*(H+1) for i in range(N+1)]
dp[0][0] = 0
for i in range(1, N+1):
dp[i][0] = 0
A = AB[i-1][0]
for j in range(1, H+1):
if j-AB[i-1][0]>=0:
dp[i][j] = min(... | 17 | 17 | 477 | 443 | H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N)]
INF = 10**10 + 1
dp = [[INF] * (H + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(1, N + 1):
dp[i][0] = 0
A = AB[i - 1][0]
for j in range(1, H + 1):
if j - AB[i - 1][0] >= 0:
dp[i][j] ... | H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N)]
INF = 10**10 + 1
dp = [[INF] * (H + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(1, N + 1):
dp[i][0] = 0
A = AB[i - 1][0]
for j in range(1, H + 1):
if j - AB[i - 1][0] >= 0:
dp[i][j] ... | false | 0 | [
"- dp[i][j] = min(",
"- dp[i - 1][j],",
"- dp[i - 1][j - AB[i - 1][0]] + AB[i - 1][1],",
"- dp[i][j - AB[i - 1][0]] + AB[i - 1][1],",
"- )",
"+ dp[i][j] = min(dp[i - 1][j], dp[i][j - AB[i - 1][0]] + AB[i - 1][1])"
] | false | 0.357347 | 0.320032 | 1.1166 | [
"s771772350",
"s239751525"
] |
u264349861 | p03167 | python | s580382752 | s315916496 | 356 | 99 | 251,136 | 76,840 | Accepted | Accepted | 72.19 | #dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(eval(input())),lambda :[int(w) for w in input().split()]
M = 10**9+7
h,w = ip()
grid = [input().strip() for i in range(h)]
dp = [[0]*w for i in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w)... | #dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(eval(input())),lambda :[int(w) for w in input().split()]
M = 10**9+7
h,w = ip()
grid = [input().strip() for i in range(h)]
dp = [[0]*w for i in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w)... | 16 | 17 | 500 | 524 | # dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
inp, ip = lambda: int(eval(input())), lambda: [int(w) for w in input().split()]
M = 10**9 + 7
h, w = ip()
grid = [input().strip() for i in range(h)]
dp = [[0] * w for i in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
... | # dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
inp, ip = lambda: int(eval(input())), lambda: [int(w) for w in input().split()]
M = 10**9 + 7
h, w = ip()
grid = [input().strip() for i in range(h)]
dp = [[0] * w for i in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
... | false | 5.882353 | [
"+ dp[i][j] %= M"
] | false | 0.092706 | 0.035854 | 2.585695 | [
"s580382752",
"s315916496"
] |
u222668979 | p02579 | python | s799379523 | s209708375 | 1,115 | 664 | 97,260 | 95,300 | Accepted | Accepted | 40.45 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
near = product(list(range(-2, 3)), repeat=2)
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh - 1):... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
near = list(product(list(range(-2, 3)), repeat=2))
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh... | 35 | 35 | 998 | 977 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
near = product(list(range(-2, 3)), repeat=2)
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh - 1):
re... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
near = list(product(list(range(-2, 3)), repeat=2))
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh - 1):
... | false | 0 | [
"- near = product(list(range(-2, 3)), repeat=2)",
"+ near = list(product(list(range(-2, 3)), repeat=2))",
"- for dx, dy in product(list(range(-2, 3)), repeat=2):",
"+ for dx, dy in near:"
] | false | 0.081711 | 0.086475 | 0.944906 | [
"s799379523",
"s209708375"
] |
u318127926 | p03714 | python | s080749118 | s764915914 | 406 | 320 | 42,932 | 42,684 | Accepted | Accepted | 21.18 | from heapq import heapify, heapreplace
n = int(eval(input()))
a = list(map(int, input().split()))
a1 = a[:n]
heapify(a1)
a2 = a[n:2*n]
a3 = [-i for i in a[2*n:]]
heapify(a3)
b1 = [sum(a1)]
b2 = [sum(a3)]
for i in range(n):
b1.append(a2[i]-heapreplace(a1, a2[i]))
b2.append(-heapreplace(a3, -a2[n-i-1]... | from heapq import heapify, heappushpop
n = int(eval(input()))
a = list(map(int, input().split()))
a1 = a[:n]
heapify(a1)
a2 = a[n:2*n]
a3 = [-i for i in a[2*n:]]
heapify(a3)
b1 = [sum(a1)]
b2 = [sum(a3)]
for i in range(n):
b1.append(b1[-1]+a2[i]-heappushpop(a1, a2[i]))
b2.append(b2[-1]-heappushpop(a... | 27 | 17 | 589 | 427 | from heapq import heapify, heapreplace
n = int(eval(input()))
a = list(map(int, input().split()))
a1 = a[:n]
heapify(a1)
a2 = a[n : 2 * n]
a3 = [-i for i in a[2 * n :]]
heapify(a3)
b1 = [sum(a1)]
b2 = [sum(a3)]
for i in range(n):
b1.append(a2[i] - heapreplace(a1, a2[i]))
b2.append(-heapreplace(a3, -a2[n - i - ... | from heapq import heapify, heappushpop
n = int(eval(input()))
a = list(map(int, input().split()))
a1 = a[:n]
heapify(a1)
a2 = a[n : 2 * n]
a3 = [-i for i in a[2 * n :]]
heapify(a3)
b1 = [sum(a1)]
b2 = [sum(a3)]
for i in range(n):
b1.append(b1[-1] + a2[i] - heappushpop(a1, a2[i]))
b2.append(b2[-1] - heappushpop... | false | 37.037037 | [
"-from heapq import heapify, heapreplace",
"+from heapq import heapify, heappushpop",
"- b1.append(a2[i] - heapreplace(a1, a2[i]))",
"- b2.append(-heapreplace(a3, -a2[n - i - 1]) - a2[n - i - 1])",
"-for i in range(n):",
"- b1[i + 1] += b1[i]",
"- b2[i + 1] += b2[i]",
"-accu = []",
"-mx ... | false | 0.105138 | 0.044571 | 2.35889 | [
"s080749118",
"s764915914"
] |
u968404618 | p03265 | python | s908133378 | s458093760 | 31 | 25 | 9,096 | 9,056 | Accepted | Accepted | 19.35 | x1, y1, x2, y2 = list(map(int, input().split()))
x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x3-(y3-y2)
y4 = y3+(x3-x2)
print((x3,y3,x4,y4)) | x1, y1, x2, y2 = list(map(int, input().split()))
X = x2-x1
Y = y2-y1
print((x2-Y, y2+X, x1-Y, y1+X)) | 8 | 5 | 134 | 97 | x1, y1, x2, y2 = list(map(int, input().split()))
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x3 - (y3 - y2)
y4 = y3 + (x3 - x2)
print((x3, y3, x4, y4))
| x1, y1, x2, y2 = list(map(int, input().split()))
X = x2 - x1
Y = y2 - y1
print((x2 - Y, y2 + X, x1 - Y, y1 + X))
| false | 37.5 | [
"-x3 = x2 - (y2 - y1)",
"-y3 = y2 + (x2 - x1)",
"-x4 = x3 - (y3 - y2)",
"-y4 = y3 + (x3 - x2)",
"-print((x3, y3, x4, y4))",
"+X = x2 - x1",
"+Y = y2 - y1",
"+print((x2 - Y, y2 + X, x1 - Y, y1 + X))"
] | false | 0.043576 | 0.042817 | 1.017726 | [
"s908133378",
"s458093760"
] |
u014333473 | p03495 | python | s766193307 | s054287479 | 114 | 103 | 24,744 | 45,536 | Accepted | Accepted | 9.65 | N,K=list(map(int,input().split()))
A=list(map(int,input().split()))
count = [0]*max(A)
for i in A:
count[i-1] += 1
print((sum(sorted(count,reverse=True)[K:]))) | import collections as c
n,k=list(map(int,input().split()));a=c.Counter(list(map(int,input().split())))
print(([0,sum(sorted([i for i in list(a.values())])[:len(a)-k])][len(a)>k])) | 6 | 3 | 158 | 161 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
count = [0] * max(A)
for i in A:
count[i - 1] += 1
print((sum(sorted(count, reverse=True)[K:])))
| import collections as c
n, k = list(map(int, input().split()))
a = c.Counter(list(map(int, input().split())))
print(([0, sum(sorted([i for i in list(a.values())])[: len(a) - k])][len(a) > k]))
| false | 50 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-count = [0] * max(A)",
"-for i in A:",
"- count[i - 1] += 1",
"-print((sum(sorted(count, reverse=True)[K:])))",
"+import collections as c",
"+",
"+n, k = list(map(int, input().split()))",
"+a = c.Counter(list(m... | false | 0.039773 | 0.038743 | 1.026591 | [
"s766193307",
"s054287479"
] |
u600402037 | p03494 | python | s895460985 | s420041647 | 23 | 20 | 3,060 | 3,060 | Accepted | Accepted | 13.04 | N = int(eval(input()))
A = [int(l) for l in input().split()]
count = 0
k = 0
while True:
for i in range(N):
if A[i]/2** k % 2 !=0:
break
else:
count += 1
k += 1
continue
break
print(count) | N = int(eval(input()))
A = [int(l) for l in input().split()]
count = 0
while True:
for i in range(N):
if A[i] / 2 ** count % 2 !=0:
break
else:
count += 1
continue
break
print(count) | 16 | 14 | 259 | 243 | N = int(eval(input()))
A = [int(l) for l in input().split()]
count = 0
k = 0
while True:
for i in range(N):
if A[i] / 2**k % 2 != 0:
break
else:
count += 1
k += 1
continue
break
print(count)
| N = int(eval(input()))
A = [int(l) for l in input().split()]
count = 0
while True:
for i in range(N):
if A[i] / 2**count % 2 != 0:
break
else:
count += 1
continue
break
print(count)
| false | 12.5 | [
"-k = 0",
"- if A[i] / 2**k % 2 != 0:",
"+ if A[i] / 2**count % 2 != 0:",
"- k += 1"
] | false | 0.037979 | 0.038182 | 0.994698 | [
"s895460985",
"s420041647"
] |
u869919400 | p03476 | python | s545358259 | s206859216 | 1,294 | 520 | 66,268 | 79,328 | Accepted | Accepted | 59.81 | Q = int(eval(input()))
from functools import lru_cache
@lru_cache(maxsize=None)
def is_prime(n: int):
if n == 2:
return True
if n == 1 or n % 2 == 0:
return False
for p in range(3, int(n**0.5)+1, 2):
if n % p == 0:
return False
return True
like_2017s =... | Q = int(eval(input()))
import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in ran... | 25 | 25 | 620 | 790 | Q = int(eval(input()))
from functools import lru_cache
@lru_cache(maxsize=None)
def is_prime(n: int):
if n == 2:
return True
if n == 1 or n % 2 == 0:
return False
for p in range(3, int(n**0.5) + 1, 2):
if n % p == 0:
return False
return True
like_2017s = []
for i ... | Q = int(eval(input()))
import math
def sieve_of_erastosthenes(num):
input_list = [
False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)
]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial... | false | 0 | [
"-from functools import lru_cache",
"+import math",
"-@lru_cache(maxsize=None)",
"-def is_prime(n: int):",
"- if n == 2:",
"- return True",
"- if n == 1 or n % 2 == 0:",
"- return False",
"- for p in range(3, int(n**0.5) + 1, 2):",
"- if n % p == 0:",
"- ... | false | 0.161619 | 0.064634 | 2.500542 | [
"s545358259",
"s206859216"
] |
u073852194 | p03965 | python | s175644397 | s415648797 | 177 | 46 | 39,536 | 3,316 | Accepted | Accepted | 74.01 | s = eval(input())
n = len(s)
ans = 0
dif = 0
for i in range(n):
if s[i] == 'g':
if dif > 0:
ans += 1
dif -= 1
else:
dif += 1
else:
if dif > 0:
dif -= 1
else:
ans -= 1
dif += 1
... | s = eval(input())
p = 0
g = 0
res = 0
for i in range(len(s)):
if s[i] == 'g':
if p < g:
p += 1
res += 1
else:
g += 1
else:
if p < g:
p += 1
else:
g += 1
res -= 1
print(res) | 21 | 21 | 327 | 301 | s = eval(input())
n = len(s)
ans = 0
dif = 0
for i in range(n):
if s[i] == "g":
if dif > 0:
ans += 1
dif -= 1
else:
dif += 1
else:
if dif > 0:
dif -= 1
else:
ans -= 1
dif += 1
print(ans)
| s = eval(input())
p = 0
g = 0
res = 0
for i in range(len(s)):
if s[i] == "g":
if p < g:
p += 1
res += 1
else:
g += 1
else:
if p < g:
p += 1
else:
g += 1
res -= 1
print(res)
| false | 0 | [
"-n = len(s)",
"-ans = 0",
"-dif = 0",
"-for i in range(n):",
"+p = 0",
"+g = 0",
"+res = 0",
"+for i in range(len(s)):",
"- if dif > 0:",
"- ans += 1",
"- dif -= 1",
"+ if p < g:",
"+ p += 1",
"+ res += 1",
"- dif += 1... | false | 0.076359 | 0.065567 | 1.164591 | [
"s175644397",
"s415648797"
] |
u094191970 | p03659 | python | s652495665 | s242631675 | 247 | 176 | 24,800 | 24,824 | Accepted | Accepted | 28.74 | n=int(eval(input()))
a=list(map(int,input().split()))
ans=n*10**9
b=[0]
for i in range(1,n+1):
b.append(a[i-1]+b[i-1])
for i in range(n-1):
t_ans=abs(b[i+1]-(b[-1]-b[i+1]))
ans=min(ans,t_ans)
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
ans=n*10**9
t=sum(a)
s=0
for i in range(n-1):
# s=sum(a[:i])
s+=a[i]
ans=min(ans,abs(t-2*s))
print(ans) | 14 | 13 | 225 | 177 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = n * 10**9
b = [0]
for i in range(1, n + 1):
b.append(a[i - 1] + b[i - 1])
for i in range(n - 1):
t_ans = abs(b[i + 1] - (b[-1] - b[i + 1]))
ans = min(ans, t_ans)
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = n * 10**9
t = sum(a)
s = 0
for i in range(n - 1):
# s=sum(a[:i])
s += a[i]
ans = min(ans, abs(t - 2 * s))
print(ans)
| false | 7.142857 | [
"-b = [0]",
"-for i in range(1, n + 1):",
"- b.append(a[i - 1] + b[i - 1])",
"+t = sum(a)",
"+s = 0",
"- t_ans = abs(b[i + 1] - (b[-1] - b[i + 1]))",
"- ans = min(ans, t_ans)",
"+ # s=sum(a[:i])",
"+ s += a[i]",
"+ ans = min(ans, abs(t - 2 * s))"
] | false | 0.040228 | 0.056371 | 0.713633 | [
"s652495665",
"s242631675"
] |
u309120194 | p02831 | python | s518234719 | s491979834 | 43 | 27 | 9,164 | 9,156 | Accepted | Accepted | 37.21 | a, b = list(map(int, input().split()))
# aの倍数を順に探索する
# abはa, bの公倍数なので、高々B回で十分。O(B)
lcm = 0
for i in range(1, b+1):
if (a * i) % b == 0:
lcm = a * i
break
print(lcm) | import math
a, b = list(map(int, input().split()))
# 最小公倍数lcmと最大公約数gcdに成り立つ関係:gcd(a,b)*lcm(a,b)=ab を用いる
print((a * b // math.gcd(a, b))) | 11 | 5 | 183 | 133 | a, b = list(map(int, input().split()))
# aの倍数を順に探索する
# abはa, bの公倍数なので、高々B回で十分。O(B)
lcm = 0
for i in range(1, b + 1):
if (a * i) % b == 0:
lcm = a * i
break
print(lcm)
| import math
a, b = list(map(int, input().split()))
# 最小公倍数lcmと最大公約数gcdに成り立つ関係:gcd(a,b)*lcm(a,b)=ab を用いる
print((a * b // math.gcd(a, b)))
| false | 54.545455 | [
"+import math",
"+",
"-# aの倍数を順に探索する",
"-# abはa, bの公倍数なので、高々B回で十分。O(B)",
"-lcm = 0",
"-for i in range(1, b + 1):",
"- if (a * i) % b == 0:",
"- lcm = a * i",
"- break",
"-print(lcm)",
"+# 最小公倍数lcmと最大公約数gcdに成り立つ関係:gcd(a,b)*lcm(a,b)=ab を用いる",
"+print((a * b // math.gcd(a, b)))"
... | false | 0.052013 | 0.084223 | 0.617566 | [
"s518234719",
"s491979834"
] |
u389910364 | p04012 | python | s160110305 | s565473804 | 1,849 | 164 | 23,556 | 38,384 | Accepted | Accepted | 91.13 | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as np
if o... | import os
import sys
from collections import Counter
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
W = sys.stdin.readline().rstrip()
if any([w % 2 for w in list(Counter(list(W)).values())]):
print('No')
else:
... | 29 | 17 | 585 | 327 | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as np
if os.getenv("LOCAL")... | import os
import sys
from collections import Counter
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
W = sys.stdin.readline().rstrip()
if any([w % 2 for w in list(Counter(list(W)).values())]):
print("No")
else:
print("Yes")
| false | 41.37931 | [
"-import bisect",
"-import heapq",
"-import itertools",
"-import math",
"-import re",
"-import string",
"-from collections import Counter, deque, defaultdict",
"-from decimal import Decimal",
"-from fractions import gcd",
"-from functools import lru_cache, reduce",
"-from operator import itemget... | false | 0.061722 | 0.046293 | 1.333298 | [
"s160110305",
"s565473804"
] |
u761320129 | p03425 | python | s230910848 | s371171550 | 545 | 149 | 10,232 | 11,008 | Accepted | Accepted | 72.66 | from collections import Counter
import itertools
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter()
for s in src:
ctr.update(s[0])
ans = 0
for ptn in itertools.combinations('MARCH',3):
a,b,c = ptn
ans += ctr[a] * ctr[b] * ctr[c]
print(ans)
| import itertools
from collections import Counter
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter([s[0] for s in src])
ans = 0
for ptn in itertools.combinations('MARCH',3):
ans += ctr[ptn[0]]*ctr[ptn[1]]*ctr[ptn[2]]
print(ans)
| 15 | 10 | 285 | 257 | from collections import Counter
import itertools
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter()
for s in src:
ctr.update(s[0])
ans = 0
for ptn in itertools.combinations("MARCH", 3):
a, b, c = ptn
ans += ctr[a] * ctr[b] * ctr[c]
print(ans)
| import itertools
from collections import Counter
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter([s[0] for s in src])
ans = 0
for ptn in itertools.combinations("MARCH", 3):
ans += ctr[ptn[0]] * ctr[ptn[1]] * ctr[ptn[2]]
print(ans)
| false | 33.333333 | [
"+import itertools",
"-import itertools",
"-ctr = Counter()",
"-for s in src:",
"- ctr.update(s[0])",
"+ctr = Counter([s[0] for s in src])",
"- a, b, c = ptn",
"- ans += ctr[a] * ctr[b] * ctr[c]",
"+ ans += ctr[ptn[0]] * ctr[ptn[1]] * ctr[ptn[2]]"
] | false | 0.035449 | 0.039968 | 0.886931 | [
"s230910848",
"s371171550"
] |
u379716238 | p03805 | python | s766088279 | s041660830 | 28 | 18 | 3,064 | 3,064 | Accepted | Accepted | 35.71 | N, M = list(map(int, input().split()))
adj_matrix = [[0]*N for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
adj_matrix[a-1][b-1] = 1
adj_matrix[b-1][a-1] = 1
def dfs(v, used):
if not False in used:
return 1
ans = 0
for i in range(N):
i... | N, M = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
memo = {}
All_used = (1 << N) - 1
def dfs(v, used):
if used == All_used:
return 1
key = (v, used)
if key in memo:
retur... | 26 | 28 | 557 | 515 | N, M = list(map(int, input().split()))
adj_matrix = [[0] * N for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
adj_matrix[a - 1][b - 1] = 1
adj_matrix[b - 1][a - 1] = 1
def dfs(v, used):
if not False in used:
return 1
ans = 0
for i in range(N):
if not... | N, M = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
memo = {}
All_used = (1 << N) - 1
def dfs(v, used):
if used == All_used:
return 1
key = (v, used)
if key in memo:
... | false | 7.142857 | [
"-adj_matrix = [[0] * N for _ in range(N)]",
"+g = [[] for i in range(N)]",
"- adj_matrix[a - 1][b - 1] = 1",
"- adj_matrix[b - 1][a - 1] = 1",
"+ g[a - 1].append(b - 1)",
"+ g[b - 1].append(a - 1)",
"+memo = {}",
"+All_used = (1 << N) - 1",
"- if not False in used:",
"+ if used ... | false | 0.036944 | 0.055668 | 0.663641 | [
"s766088279",
"s041660830"
] |
u228223940 | p03112 | python | s042851568 | s976412148 | 1,066 | 866 | 16,132 | 17,664 | Accepted | Accepted | 18.76 | import sys
import bisect
input = sys.stdin.readline
a,b,q = list(map(int,input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q)... | import sys
import bisect
input = sys.stdin.readline
a,b,q = list(map(int,input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q)... | 27 | 27 | 678 | 650 | import sys
import bisect
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q):
ans = 10**1... | import sys
import bisect
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q):
ans = 10**1... | false | 0 | [
"- for j in range(2):",
"- for k in range(2):",
"- ans = min(",
"- ans,",
"- abs(x[i] - s[s_idx + j]) + abs(s[s_idx + j] - t[t_idx + k]),",
"- abs(x[i] - t[t_idx + k]) + abs(s[s_idx + j] - t[t_idx + k]),",
"- )",
"+ for j ... | false | 0.035893 | 0.044601 | 0.804762 | [
"s042851568",
"s976412148"
] |
u321035578 | p03244 | python | s075519619 | s831239816 | 95 | 86 | 23,772 | 21,952 | Accepted | Accepted | 9.47 | import collections
def main():
n = int(eval(input()))
v = list(map(int,input().split()))
if len(set(v)) == 1:
print((n//2))
elif len(set(v)) == 2:
cnt1 = 0
cnt2 = 0
tmp1 = list(set(v))
tmp2 = [tmp1[1], tmp1[0]]
# even = v[::2]
# odd =... | import collections
def main():
n = int(eval(input()))
v = list(map(int,input().split()))
even = v[::2]
odd = v[1::2]
count_e = collections.Counter(even)
count_o = collections.Counter(odd)
ce = count_e.most_common()
co = count_o.most_common()
if ce[0][0] != co[0][0]:
... | 49 | 28 | 1,286 | 673 | import collections
def main():
n = int(eval(input()))
v = list(map(int, input().split()))
if len(set(v)) == 1:
print((n // 2))
elif len(set(v)) == 2:
cnt1 = 0
cnt2 = 0
tmp1 = list(set(v))
tmp2 = [tmp1[1], tmp1[0]]
# even = v[::2]
# odd = v[1::2]
... | import collections
def main():
n = int(eval(input()))
v = list(map(int, input().split()))
even = v[::2]
odd = v[1::2]
count_e = collections.Counter(even)
count_o = collections.Counter(odd)
ce = count_e.most_common()
co = count_o.most_common()
if ce[0][0] != co[0][0]:
print(... | false | 42.857143 | [
"- if len(set(v)) == 1:",
"- print((n // 2))",
"- elif len(set(v)) == 2:",
"- cnt1 = 0",
"- cnt2 = 0",
"- tmp1 = list(set(v))",
"- tmp2 = [tmp1[1], tmp1[0]]",
"- # even = v[::2]",
"- # odd = v[1::2]",
"- #",
"- for i, a in enum... | false | 0.041349 | 0.040119 | 1.030648 | [
"s075519619",
"s831239816"
] |
u102461423 | p03595 | python | s036607503 | s123619103 | 441 | 371 | 64,064 | 58,576 | Accepted | Accepted | 15.87 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 998244353
N,M = list(map(int,readline().split()))
A = np.array(list(readline().rstrip()),dtype=np.int64) - 48
B = np.array(list(readline().rstrip()),dtype=np.int64) ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 998244353
N,M = list(map(int,readline().split()))
A,B,C,D = [np.array(list(readline().rstrip()))-48 for _ in range(4)]
def cumprod(arr,MOD):
L = len(arr); Lsq... | 127 | 95 | 3,975 | 2,976 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 998244353
N, M = list(map(int, readline().split()))
A = np.array(list(readline().rstrip()), dtype=np.int64) - 48
B = np.array(list(readline().rstrip()), dtype=np.int64) - 48
C =... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 998244353
N, M = list(map(int, readline().split()))
A, B, C, D = [np.array(list(readline().rstrip())) - 48 for _ in range(4)]
def cumprod(arr, MOD):
L = len(arr)
Lsq =... | false | 25.19685 | [
"-A = np.array(list(readline().rstrip()), dtype=np.int64) - 48",
"-B = np.array(list(readline().rstrip()), dtype=np.int64) - 48",
"-C = np.array(list(readline().rstrip()), dtype=np.int64) - 48",
"-D = np.array(list(readline().rstrip()), dtype=np.int64) - 48",
"+A, B, C, D = [np.array(list(readline().rstrip(... | false | 0.746757 | 0.522016 | 1.430526 | [
"s036607503",
"s123619103"
] |
u987164499 | p02813 | python | s308695003 | s410302521 | 55 | 28 | 10,484 | 3,064 | Accepted | Accepted | 49.09 | from sys import stdin
import math
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
lin = list(map(int,stdin.readline().rstrip().split()))
from itertools import permutations
lis = permutations(li)
liv = []
for i in lis:
liv.append(list(i))
liv.sort()
a = liv.i... | from itertools import permutations
n = int(eval(input()))
li = [i for i in range(1,n+1)]
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
for i,j in enumerate(permutations(li)):
if j == p:
num_p = i
if j == q:
num_q = i
print((abs(num_p-num_q))) | 18 | 14 | 367 | 300 | from sys import stdin
import math
n = int(stdin.readline().rstrip())
li = list(map(int, stdin.readline().rstrip().split()))
lin = list(map(int, stdin.readline().rstrip().split()))
from itertools import permutations
lis = permutations(li)
liv = []
for i in lis:
liv.append(list(i))
liv.sort()
a = liv.index(li)
b = ... | from itertools import permutations
n = int(eval(input()))
li = [i for i in range(1, n + 1)]
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
for i, j in enumerate(permutations(li)):
if j == p:
num_p = i
if j == q:
num_q = i
print((abs(num_p - num_q)))
| false | 22.222222 | [
"-from sys import stdin",
"-import math",
"-",
"-n = int(stdin.readline().rstrip())",
"-li = list(map(int, stdin.readline().rstrip().split()))",
"-lin = list(map(int, stdin.readline().rstrip().split()))",
"-lis = permutations(li)",
"-liv = []",
"-for i in lis:",
"- liv.append(list(i))",
"-liv... | false | 0.127352 | 0.084067 | 1.514876 | [
"s308695003",
"s410302521"
] |
u554781254 | p02695 | python | s501709233 | s175290792 | 1,419 | 677 | 21,900 | 9,224 | Accepted | Accepted | 52.29 | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
N,... | import sys
import itertools
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
abcd_ls = [list(map(int, input().split())) for _ in range(Q)]
def calc():
score = 0
for abcd in abcd_ls:
a, b, c, d = abcd
a -= 1
b -= 1
... | 31 | 37 | 771 | 629 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
from itertools import (
permutations,
combinations,
accumulate,
product,
combinations_with_replacement,
)
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heap... | import sys
import itertools
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
abcd_ls = [list(map(int, input().split())) for _ in range(Q)]
def calc():
score = 0
for abcd in abcd_ls:
a, b, c, d = abcd
a -= 1
b -= 1
if c == A[b] -... | false | 16.216216 | [
"+import itertools",
"-from itertools import (",
"- permutations,",
"- combinations,",
"- accumulate,",
"- product,",
"- combinations_with_replacement,",
"-)",
"-from functools import *",
"-from collections import deque, defaultdict, Counter",
"-from heapq import heapify, heappop,... | false | 0.159227 | 0.051067 | 3.117979 | [
"s501709233",
"s175290792"
] |
u969850098 | p03102 | python | s199443104 | s628487379 | 150 | 18 | 12,392 | 3,064 | Accepted | Accepted | 88 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
cnt = 0
for _ in range(N):
A =np.array( list(map(int, input().split())))
if sum(A * B) + C > 0:
cnt += 1
print(cnt) | import sys
readline = sys.stdin.readline
def main():
N, M, C = list(map(int, readline().rstrip().split()))
B = list(map(int, readline().rstrip().split()))
ans = 0
for _ in range(N):
A = list(map(int, readline().rstrip().split()))
if sum([a*b for a, b in zip(A, B)]) + C > 0:
... | 9 | 17 | 240 | 398 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
cnt = 0
for _ in range(N):
A = np.array(list(map(int, input().split())))
if sum(A * B) + C > 0:
cnt += 1
print(cnt)
| import sys
readline = sys.stdin.readline
def main():
N, M, C = list(map(int, readline().rstrip().split()))
B = list(map(int, readline().rstrip().split()))
ans = 0
for _ in range(N):
A = list(map(int, readline().rstrip().split()))
if sum([a * b for a, b in zip(A, B)]) + C > 0:
... | false | 47.058824 | [
"-import numpy as np",
"+import sys",
"-N, M, C = list(map(int, input().split()))",
"-B = np.array(list(map(int, input().split())))",
"-cnt = 0",
"-for _ in range(N):",
"- A = np.array(list(map(int, input().split())))",
"- if sum(A * B) + C > 0:",
"- cnt += 1",
"-print(cnt)",
"+read... | false | 0.189445 | 0.038296 | 4.946805 | [
"s199443104",
"s628487379"
] |
u752522099 | p02755 | python | s483742786 | s127032067 | 22 | 20 | 2,940 | 3,064 | Accepted | Accepted | 9.09 | import math
a,b = list(map(int,input().split()))
i = math.floor(a/0.08)
while i < 10001:
if math.floor(i*0.08) == a and math.floor(i*0.1) ==b:
print(i)
break
i += 1
else:
print((-1))
| a,b = list(map(int,input().split()))
for price in range(10000):
if price * 8 // 100 == a and price * 10//100 ==b:
print(price)
exit()
else:
print((-1)) | 11 | 7 | 214 | 173 | import math
a, b = list(map(int, input().split()))
i = math.floor(a / 0.08)
while i < 10001:
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
break
i += 1
else:
print((-1))
| a, b = list(map(int, input().split()))
for price in range(10000):
if price * 8 // 100 == a and price * 10 // 100 == b:
print(price)
exit()
else:
print((-1))
| false | 36.363636 | [
"-import math",
"-",
"-i = math.floor(a / 0.08)",
"-while i < 10001:",
"- if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:",
"- print(i)",
"- break",
"- i += 1",
"+for price in range(10000):",
"+ if price * 8 // 100 == a and price * 10 // 100 == b:",
"+ pr... | false | 0.042891 | 0.041187 | 1.041357 | [
"s483742786",
"s127032067"
] |
u873915460 | p02567 | python | s502480664 | s730309506 | 1,281 | 633 | 139,244 | 157,632 | Accepted | Accepted | 50.59 | from copy import *
def init(N,node,unit,func):
n=1
while n<N:
n<<=1
for i in range(n*2-1):
if len(node)<=i:
node.append(deepcopy(unit))
else:
node[i]=deepcopy(unit)
node.append(func)
node.append(unit)
node.append(n)
def upd(node,x,a):
y=node[-1]+x
node[y-1]=a
... | from copy import *
import sys
S=sys.stdin.readlines()
def init(N,node,unit,func):
n=1
while n<N:
n<<=1
for i in range(n*2-1):
if len(node)<=i:
node.append(deepcopy(unit))
else:
node[i]=deepcopy(unit)
node.append(func)
node.append(unit)
node.append(n)
def upd(node,x... | 93 | 95 | 1,788 | 1,819 | from copy import *
def init(N, node, unit, func):
n = 1
while n < N:
n <<= 1
for i in range(n * 2 - 1):
if len(node) <= i:
node.append(deepcopy(unit))
else:
node[i] = deepcopy(unit)
node.append(func)
node.append(unit)
node.append(n)
def upd(nod... | from copy import *
import sys
S = sys.stdin.readlines()
def init(N, node, unit, func):
n = 1
while n < N:
n <<= 1
for i in range(n * 2 - 1):
if len(node) <= i:
node.append(deepcopy(unit))
else:
node[i] = deepcopy(unit)
node.append(func)
node.append(... | false | 2.105263 | [
"+import sys",
"+",
"+S = sys.stdin.readlines()",
"-N, Q = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"+N, Q = list(map(int, S[0].split()))",
"+A = list(map(int, S[1].split()))",
"- t, a, b = list(map(int, input().split()))",
"+ t, a, b = list(map(int, S[i + 2].s... | false | 0.045886 | 0.039579 | 1.159359 | [
"s502480664",
"s730309506"
] |
u146803137 | p02899 | python | s153632265 | s269957984 | 179 | 136 | 14,024 | 87,268 | Accepted | Accepted | 24.02 | import math
def py():
print("Yes")
def pn():
print("No")
def iin():
x = int(input())
return x
neko = 0
nya = 0
nuko = 0
n = iin()
a = [int(x) for x in input().split()]
b = [0] * n
for i in range(n):
b[a[i]-1] = i + 1
for i in range(n):
print(b[i],end=' ')
| n = int(input())
a = list(map(int,input().split()))
b = [None] * n
for i in range(n):
b[a[i]-1] = i+1
for i in range(n):
print(b[i],end = ' ')
| 21 | 7 | 302 | 157 | import math
def py():
print("Yes")
def pn():
print("No")
def iin():
x = int(input())
return x
neko = 0
nya = 0
nuko = 0
n = iin()
a = [int(x) for x in input().split()]
b = [0] * n
for i in range(n):
b[a[i] - 1] = i + 1
for i in range(n):
print(b[i], end=" ")
| n = int(input())
a = list(map(int, input().split()))
b = [None] * n
for i in range(n):
b[a[i] - 1] = i + 1
for i in range(n):
print(b[i], end=" ")
| false | 66.666667 | [
"-import math",
"-",
"-",
"-def py():",
"- print(\"Yes\")",
"-",
"-",
"-def pn():",
"- print(\"No\")",
"-",
"-",
"-def iin():",
"- x = int(input())",
"- return x",
"-",
"-",
"-neko = 0",
"-nya = 0",
"-nuko = 0",
"-n = iin()",
"-a = [int(x) for x in input().split()... | false | 0.038183 | 0.007341 | 5.201476 | [
"s153632265",
"s269957984"
] |
u691018832 | p02975 | python | s544786322 | s467208143 | 64 | 56 | 14,100 | 12,468 | Accepted | Accepted | 12.5 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(1, n):
a[i] ^= a[i - 1]
if a[n - 1] == 0:
print('Yes')
else:
print('No')
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, *a = list(map(int, read().split()))
for af in a[1:]:
a[0] ^= af
print(('Yes' if a[0] == 0 else 'No'))
| 11 | 10 | 196 | 258 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(1, n):
a[i] ^= a[i - 1]
if a[n - 1] == 0:
print("Yes")
else:
print("No")
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n, *a = list(map(int, read().split()))
for af in a[1:]:
a[0] ^= af
print(("Yes" if a[0] == 0 else "No"))
| false | 9.090909 | [
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-for i in range(1, n):",
"- a[i] ^= a[i - 1]",
"-if a[n - 1] == 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readlin... | false | 0.043625 | 0.042802 | 1.019228 | [
"s544786322",
"s467208143"
] |
u459150945 | p03212 | python | s000658543 | s515050131 | 234 | 39 | 45,168 | 3,188 | Accepted | Accepted | 83.33 | import itertools
N = int(eval(input()))
ans = 0
for i in range(3, 10):
product = list(itertools.product(['3', '5', '7'], repeat=i))
for li in product:
if len(set(li)) == 3:
if int(''.join(li)) <= N:
ans += 1
print(ans)
| N = int(eval(input()))
def dfs(cur, use, cnt):
if cur > N:
return
if use == 0b111:
cnt.append(1)
dfs(cur*10 + 7, use | 0b001, cnt)
dfs(cur*10 + 5, use | 0b010, cnt)
dfs(cur*10 + 3, use | 0b100, cnt)
res = []
dfs(0, 0, res)
print((sum(res)))
| 10 | 16 | 266 | 288 | import itertools
N = int(eval(input()))
ans = 0
for i in range(3, 10):
product = list(itertools.product(["3", "5", "7"], repeat=i))
for li in product:
if len(set(li)) == 3:
if int("".join(li)) <= N:
ans += 1
print(ans)
| N = int(eval(input()))
def dfs(cur, use, cnt):
if cur > N:
return
if use == 0b111:
cnt.append(1)
dfs(cur * 10 + 7, use | 0b001, cnt)
dfs(cur * 10 + 5, use | 0b010, cnt)
dfs(cur * 10 + 3, use | 0b100, cnt)
res = []
dfs(0, 0, res)
print((sum(res)))
| false | 37.5 | [
"-import itertools",
"+N = int(eval(input()))",
"-N = int(eval(input()))",
"-ans = 0",
"-for i in range(3, 10):",
"- product = list(itertools.product([\"3\", \"5\", \"7\"], repeat=i))",
"- for li in product:",
"- if len(set(li)) == 3:",
"- if int(\"\".join(li)) <= N:",
"- ... | false | 0.191591 | 0.042504 | 4.507647 | [
"s000658543",
"s515050131"
] |
u067983636 | p03201 | python | s242172016 | s060697361 | 782 | 582 | 56,056 | 43,728 | Accepted | Accepted | 25.58 | import bisect
import math
N = int(eval(input()))
A = list(map(int, input().split()))
T = [2 ** i for i in range(31)]
A.sort()
already = set()
def to_dic(A):
d = {}
for a in A:
d[a] = d.setdefault(a, 0) + 1
return d
def is_in(t, num):
i = D.setdefault(t, 0)
if i == 0:
... | import bisect
import math
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
already = set()
key = {}
def is_in(t, n):
i = key.setdefault(t, bisect.bisect_left(A, t))
if i >= n:
return -1
while i < n and t == A[i]:
if i not in already:
already.ad... | 53 | 39 | 825 | 693 | import bisect
import math
N = int(eval(input()))
A = list(map(int, input().split()))
T = [2**i for i in range(31)]
A.sort()
already = set()
def to_dic(A):
d = {}
for a in A:
d[a] = d.setdefault(a, 0) + 1
return d
def is_in(t, num):
i = D.setdefault(t, 0)
if i == 0:
return 0
... | import bisect
import math
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
already = set()
key = {}
def is_in(t, n):
i = key.setdefault(t, bisect.bisect_left(A, t))
if i >= n:
return -1
while i < n and t == A[i]:
if i not in already:
already.add(i)
... | false | 26.415094 | [
"-T = [2**i for i in range(31)]",
"+key = {}",
"-def to_dic(A):",
"- d = {}",
"- for a in A:",
"- d[a] = d.setdefault(a, 0) + 1",
"- return d",
"-",
"-",
"-def is_in(t, num):",
"- i = D.setdefault(t, 0)",
"- if i == 0:",
"- return 0",
"- s = min(i, num)",
... | false | 0.057913 | 0.129799 | 0.446175 | [
"s242172016",
"s060697361"
] |
u628070051 | p03852 | python | s659859193 | s634129102 | 27 | 23 | 9,020 | 8,900 | Accepted | Accepted | 14.81 | c = str.lower(eval(input()))
n = ('a', 'e', 'i', 'o', 'u')
if c in n:
print('vowel')
else:
print('consonant')
| c = str.lower(eval(input()))
def answer(c: str) -> str:
n = ('a', 'e', 'i', 'o', 'u')
if c in n:
return 'vowel'
else:
return 'consonant'
print((answer(c)))
| 7 | 11 | 119 | 189 | c = str.lower(eval(input()))
n = ("a", "e", "i", "o", "u")
if c in n:
print("vowel")
else:
print("consonant")
| c = str.lower(eval(input()))
def answer(c: str) -> str:
n = ("a", "e", "i", "o", "u")
if c in n:
return "vowel"
else:
return "consonant"
print((answer(c)))
| false | 36.363636 | [
"-n = (\"a\", \"e\", \"i\", \"o\", \"u\")",
"-if c in n:",
"- print(\"vowel\")",
"-else:",
"- print(\"consonant\")",
"+",
"+",
"+def answer(c: str) -> str:",
"+ n = (\"a\", \"e\", \"i\", \"o\", \"u\")",
"+ if c in n:",
"+ return \"vowel\"",
"+ else:",
"+ return \... | false | 0.100084 | 0.036817 | 2.718394 | [
"s659859193",
"s634129102"
] |
u512212329 | p02579 | python | s520921855 | s584459644 | 541 | 477 | 193,384 | 189,704 | Accepted | Accepted | 11.83 | # 01-BFS
# 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
# 01-BFSのちょっと丁寧な解説 - ARMERIA
# https://betrue12.hateblo.jp/entry/2018/12/08/000020
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in... | # 01-BFS
# 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
# 01-BFSのちょっと丁寧な解説 - ARMERIA
# https://betrue12.hateblo.jp/entry/2018/12/08/000020
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in... | 45 | 45 | 1,490 | 1,492 | # 01-BFS
# 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
# 01-BFSのちょっと丁寧な解説 - ARMERIA
# https://betrue12.hateblo.jp/entry/2018/12/08/000020
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in input().spl... | # 01-BFS
# 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
# 01-BFSのちょっと丁寧な解説 - ARMERIA
# https://betrue12.hateblo.jp/entry/2018/12/08/000020
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in input().spl... | false | 0 | [
"- warp_can_reach = set(gen_warp_can_reach)",
"+ warp_can_reach = tuple(gen_warp_can_reach)"
] | false | 0.084923 | 0.11195 | 0.758578 | [
"s520921855",
"s584459644"
] |
u844789719 | p03277 | python | s729530754 | s131406514 | 1,240 | 813 | 124,580 | 121,756 | Accepted | Accepted | 34.44 | import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
class SegmentTree():
"""
Parameters
----------
array : list
to construct segment tree from
f : func
binary operation of the monoid
e :
identity e... | import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
class BinaryIndexedTree:
"""
Parameters
----------
array : list
to construct BIT from
f : func
binary operation of the abelian group
fi : func
inv... | 93 | 98 | 2,270 | 2,438 | import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
class SegmentTree:
"""
Parameters
----------
array : list
to construct segment tree from
f : func
binary operation of the monoid
e :
identity element of the monoid
size : int
limi... | import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
class BinaryIndexedTree:
"""
Parameters
----------
array : list
to construct BIT from
f : func
binary operation of the abelian group
fi : func
inverse mapping of f
i.e. f(a, b) == c <... | false | 5.102041 | [
"-class SegmentTree:",
"+class BinaryIndexedTree:",
"- to construct segment tree from",
"+ to construct BIT from",
"- binary operation of the monoid",
"+ binary operation of the abelian group",
"+ fi : func",
"+ inverse mapping of f",
"+ i.e. f(a, b) == c... | false | 0.045417 | 0.125149 | 0.362903 | [
"s729530754",
"s131406514"
] |
u956836108 | p03835 | python | s625111172 | s865762426 | 1,340 | 1,043 | 9,124 | 9,140 | Accepted | Accepted | 22.16 | # -*- coding: utf-8 -*-
k, s = list(map(int, input().split()))
ans = 0
if s == 3*k:
ans = 1
elif s > 3*k:
ans = 0
elif s == k:
ans = int((k + 1) * (k + 2) / 2)
else:
l = k
while l >= 0:
t_sum = s - l
m = s - t_sum
if t_sum > 2*k:
... | K, S = list(map(int, input().split()))
ans = 0
for i in range(0,K+1):
for j in range (0,K+1):
if (S-K) <= (i + j) <= S:
ans += 1
continue
print(ans) | 39 | 8 | 613 | 185 | # -*- coding: utf-8 -*-
k, s = list(map(int, input().split()))
ans = 0
if s == 3 * k:
ans = 1
elif s > 3 * k:
ans = 0
elif s == k:
ans = int((k + 1) * (k + 2) / 2)
else:
l = k
while l >= 0:
t_sum = s - l
m = s - t_sum
if t_sum > 2 * k:
break
if m < k:
... | K, S = list(map(int, input().split()))
ans = 0
for i in range(0, K + 1):
for j in range(0, K + 1):
if (S - K) <= (i + j) <= S:
ans += 1
continue
print(ans)
| false | 79.487179 | [
"-# -*- coding: utf-8 -*-",
"-k, s = list(map(int, input().split()))",
"+K, S = list(map(int, input().split()))",
"-if s == 3 * k:",
"- ans = 1",
"-elif s > 3 * k:",
"- ans = 0",
"-elif s == k:",
"- ans = int((k + 1) * (k + 2) / 2)",
"-else:",
"- l = k",
"- while l >= 0:",
"- ... | false | 0.077931 | 0.04096 | 1.902602 | [
"s625111172",
"s865762426"
] |
u729133443 | p02889 | python | s581051320 | s093925444 | 441 | 348 | 24,032 | 36,284 | Accepted | Accepted | 21.09 | import sys
from scipy.sparse.csgraph import floyd_warshall as f
input=sys.stdin.buffer.readline
def main():
n,m,l=list(map(int,input().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for _ in range(m):
a,b,c=list(map(int,input().split()))
d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
a=[d[tuple(map(int... | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n,m,l,*t=list(map(int,sys.stdin.buffer.read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
print(('\n'.join(map(str,list(map(int,list(map(d.__getitem__,... | 14 | 10 | 405 | 341 | import sys
from scipy.sparse.csgraph import floyd_warshall as f
input = sys.stdin.buffer.readline
def main():
n, m, l = list(map(int, input().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
a, b, c = list(map(int, input().split()))
d[a][b] = c
d = f(f(d, 0) <= l... | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n, m, l, *t = list(map(int, sys.stdin.buffer.read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l) - 1
d[d > n] = -1
print(
... | false | 28.571429 | [
"-input = sys.stdin.buffer.readline",
"-",
"- n, m, l = list(map(int, input().split()))",
"+ n, m, l, *t = list(map(int, sys.stdin.buffer.read().split()))",
"- for _ in range(m):",
"- a, b, c = list(map(int, input().split()))",
"+ for a, b, c in zip(*[iter(t[: m * 3])] * 3):",
"- ... | false | 0.347052 | 0.695537 | 0.498969 | [
"s581051320",
"s093925444"
] |
u865383026 | p02571 | python | s823924965 | s302408701 | 49 | 44 | 9,060 | 9,136 | Accepted | Accepted | 10.2 | S = eval(input())
T = list(eval(input()))
l = len(S) - len(T) + 1
ans = len(T)
t = len(T)
for i in range(l):
s = list(S[i:i+t])
ans = min(ans, len([0 for i in range(t) if T[i] != s[i]]))
print(ans) | S = eval(input())
T = eval(input())
l = len(S) - len(T) + 1
ans = len(T)
t = len(T)
for i in range(l):
s = S[i:i+t]
ans = min(ans, len([0 for i in range(t) if T[i] != s[i]]))
print(ans) | 9 | 9 | 197 | 185 | S = eval(input())
T = list(eval(input()))
l = len(S) - len(T) + 1
ans = len(T)
t = len(T)
for i in range(l):
s = list(S[i : i + t])
ans = min(ans, len([0 for i in range(t) if T[i] != s[i]]))
print(ans)
| S = eval(input())
T = eval(input())
l = len(S) - len(T) + 1
ans = len(T)
t = len(T)
for i in range(l):
s = S[i : i + t]
ans = min(ans, len([0 for i in range(t) if T[i] != s[i]]))
print(ans)
| false | 0 | [
"-T = list(eval(input()))",
"+T = eval(input())",
"- s = list(S[i : i + t])",
"+ s = S[i : i + t]"
] | false | 0.085666 | 0.087994 | 0.973541 | [
"s823924965",
"s302408701"
] |
u518042385 | p02918 | python | s072227320 | s898113128 | 72 | 56 | 4,084 | 4,084 | Accepted | Accepted | 22.22 | n,k=list(map(int,input().split()))
l=list(eval(input()))
s=l[0]
m=0
c=1
for i in range(1,n):
if l[i]!=s:
c+=1
s=l[i]
if c//2<=k:
print((n-1))
else:
for i in range(1,n-1):
if l[i]=="R":
if l[i+1]=="R":
m+=1
if l[i]=="L":
if l[i-1]=="L":
m+=1
if l[0]=... | n,k=list(map(int,input().split()))
l=list(eval(input()))
m=0
if n==1:
print((0))
else:
for i in range(1,n-1):
if l[i]=="R":
if l[i+1]=="R":
m+=1
if l[i]=="L":
if l[i-1]=="L":
m+=1
if l[0]=="R" and l[0]==l[1]:
m+=1
if l[-1]=="L" and l[-2]==l[-1]:
m+=1
... | 24 | 18 | 397 | 329 | n, k = list(map(int, input().split()))
l = list(eval(input()))
s = l[0]
m = 0
c = 1
for i in range(1, n):
if l[i] != s:
c += 1
s = l[i]
if c // 2 <= k:
print((n - 1))
else:
for i in range(1, n - 1):
if l[i] == "R":
if l[i + 1] == "R":
m += 1
if l[i... | n, k = list(map(int, input().split()))
l = list(eval(input()))
m = 0
if n == 1:
print((0))
else:
for i in range(1, n - 1):
if l[i] == "R":
if l[i + 1] == "R":
m += 1
if l[i] == "L":
if l[i - 1] == "L":
m += 1
if l[0] == "R" and l[0] == ... | false | 25 | [
"-s = l[0]",
"-c = 1",
"-for i in range(1, n):",
"- if l[i] != s:",
"- c += 1",
"- s = l[i]",
"-if c // 2 <= k:",
"- print((n - 1))",
"+if n == 1:",
"+ print((0))",
"- print((m + k * 2))",
"+ print((min(m + k * 2, n - 1)))"
] | false | 0.04772 | 0.048227 | 0.989483 | [
"s072227320",
"s898113128"
] |
u670180528 | p03660 | python | s517147760 | s528411597 | 450 | 334 | 37,232 | 37,228 | Accepted | Accepted | 25.78 | from collections import deque
n,*L=list(map(int,open(0).read().split()))
G=[[]for _ in range(n)]
db=[-1]*n;db[0]=0
dw=[-1]*n;dw[-1]=0
for a,b in zip(*[iter(L)]*2):
G[a-1]+=[b-1]
G[b-1]+=[a-1]
q=deque([0])
while q:
cur=q.popleft()
for nxt in G[cur]:
if db[nxt]<0:
q.append(nxt)
db[nxt]=db[cur]+1... | from collections import*
n,*L=list(map(int,open(0).read().split()))
G=[[]for _ in range(n)]
for a,b in zip(*[iter(L)]*2):
G[a-1]+=[b-1]
G[b-1]+=[a-1]
def F(m):
q=deque([m])
d=[-1]*n
while q:
cur=q.popleft()
for nxt in G[cur]:
if d[nxt]<0:
q.append(nxt)
d[nxt]=d[cur]+1
return d
print... | 28 | 17 | 540 | 378 | from collections import deque
n, *L = list(map(int, open(0).read().split()))
G = [[] for _ in range(n)]
db = [-1] * n
db[0] = 0
dw = [-1] * n
dw[-1] = 0
for a, b in zip(*[iter(L)] * 2):
G[a - 1] += [b - 1]
G[b - 1] += [a - 1]
q = deque([0])
while q:
cur = q.popleft()
for nxt in G[cur]:
if db[nx... | from collections import *
n, *L = list(map(int, open(0).read().split()))
G = [[] for _ in range(n)]
for a, b in zip(*[iter(L)] * 2):
G[a - 1] += [b - 1]
G[b - 1] += [a - 1]
def F(m):
q = deque([m])
d = [-1] * n
while q:
cur = q.popleft()
for nxt in G[cur]:
if d[nxt] < ... | false | 39.285714 | [
"-from collections import deque",
"+from collections import *",
"-db = [-1] * n",
"-db[0] = 0",
"-dw = [-1] * n",
"-dw[-1] = 0",
"-q = deque([0])",
"-while q:",
"- cur = q.popleft()",
"- for nxt in G[cur]:",
"- if db[nxt] < 0:",
"- q.append(nxt)",
"- db[nxt... | false | 0.03795 | 0.037349 | 1.016105 | [
"s517147760",
"s528411597"
] |
u312025627 | p03854 | python | s962281228 | s397794152 | 163 | 19 | 39,920 | 3,188 | Accepted | Accepted | 88.34 | def main():
S = input()
if S.replace("eraser", "").replace("erase", "")\
.replace("dreamer", "").replace("dream", "") == "":
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
| def main():
S = input()
if S.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", ""):
return print("NO")
else:
return print("YES")
if __name__ == '__main__':
main()
| 11 | 10 | 246 | 239 | def main():
S = input()
if (
S.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
== ""
):
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| def main():
S = input()
if (
S.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
):
return print("NO")
else:
return print("YES")
if __name__ == "__main__":
main()
| false | 9.090909 | [
"- == \"\"",
"- print(\"YES\")",
"+ return print(\"NO\")",
"- print(\"NO\")",
"+ return print(\"YES\")"
] | false | 0.037776 | 0.046682 | 0.809205 | [
"s962281228",
"s397794152"
] |
u500376440 | p03545 | python | s497149946 | s976974010 | 33 | 28 | 9,008 | 9,048 | Accepted | Accepted | 15.15 | num_=eval(input())
op_=len(num_)-1
for i in range(2**op_):
op=["-"]*op_
for j in range(op_):
if ((i>>j)&1):
op[op_-1-j]="+"
formula=""
op.append("")
for p_num,p_op in zip(num_,op):
formula+=p_num+p_op
if eval(formula)==7:
print((formula+"=7"))
break
| ABCD=eval(input())
f=""
for bit in range(1<<3):
f=ABCD[0]
for i in range(3):
if bit&(1<<i):
f+="+"
else:
f+="-"
f+=ABCD[i+1]
if eval(f)==7:
print((f+"=7"))
exit()
| 14 | 13 | 289 | 205 | num_ = eval(input())
op_ = len(num_) - 1
for i in range(2**op_):
op = ["-"] * op_
for j in range(op_):
if (i >> j) & 1:
op[op_ - 1 - j] = "+"
formula = ""
op.append("")
for p_num, p_op in zip(num_, op):
formula += p_num + p_op
if eval(formula) == 7:
print((for... | ABCD = eval(input())
f = ""
for bit in range(1 << 3):
f = ABCD[0]
for i in range(3):
if bit & (1 << i):
f += "+"
else:
f += "-"
f += ABCD[i + 1]
if eval(f) == 7:
print((f + "=7"))
exit()
| false | 7.142857 | [
"-num_ = eval(input())",
"-op_ = len(num_) - 1",
"-for i in range(2**op_):",
"- op = [\"-\"] * op_",
"- for j in range(op_):",
"- if (i >> j) & 1:",
"- op[op_ - 1 - j] = \"+\"",
"- formula = \"\"",
"- op.append(\"\")",
"- for p_num, p_op in zip(num_, op):",
"- ... | false | 0.169489 | 0.039907 | 4.247063 | [
"s497149946",
"s976974010"
] |
u343251190 | p02255 | python | s384131886 | s064694246 | 30 | 20 | 8,200 | 8,096 | Accepted | Accepted | 33.33 | n = int(eval(input()))
data = list(map(int, input().split()))
def insertion_sort(A, N):
print((*A))
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print((*A))
insertion_sort(data,... | n = int(eval(input()))
data = list(map(int, input().split()))
def insertionsort(a, n):
for i in range(n):
v = a[i]
j = i - 1;
while (j >= 0 and a[j] > v):
a[j+1] = a[j]
j -= 1
a[j+1] = v
print((*a))
insertionsort(data, n) | 15 | 14 | 313 | 296 | n = int(eval(input()))
data = list(map(int, input().split()))
def insertion_sort(A, N):
print((*A))
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print((*A))
insertion_sort(data, n)
| n = int(eval(input()))
data = list(map(int, input().split()))
def insertionsort(a, n):
for i in range(n):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j + 1] = a[j]
j -= 1
a[j + 1] = v
print((*a))
insertionsort(data, n)
| false | 6.666667 | [
"-def insertion_sort(A, N):",
"- print((*A))",
"- for i in range(1, N):",
"- v = A[i]",
"+def insertionsort(a, n):",
"+ for i in range(n):",
"+ v = a[i]",
"- while j >= 0 and A[j] > v:",
"- A[j + 1] = A[j]",
"+ while j >= 0 and a[j] > v:",
"+ ... | false | 0.045045 | 0.052234 | 0.862371 | [
"s384131886",
"s064694246"
] |
u119148115 | p03609 | python | s738377740 | s564709662 | 168 | 73 | 61,456 | 61,908 | Accepted | Accepted | 56.55 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
X,t = MI()
print((max(0,X-t)))
| 13 | 5 | 520 | 109 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
X, t = MI()
print((max(0, X - t)))
| false | 61.538462 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし"... | false | 0.153408 | 0.071495 | 2.145708 | [
"s738377740",
"s564709662"
] |
u852690916 | p03862 | python | s569997993 | s536676175 | 161 | 95 | 14,052 | 84,232 | Accepted | Accepted | 40.99 | N,x=list(map(int,input().split()))
A=list(map(int,input().split()))
ans=0
pre=0
for i in range(N-1):
s=A[i]+A[i+1]-pre
ans+=max(0,s-x)
pre=min(max(0,s-x),A[i+1])
print(ans) | N, x = list(map(int, input().split()))
*A, = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
w = A[i] + A[i + 1]
if w <= x: continue
r = max(0, A[i + 1] - (w - x))
l = x - r
ans += A[i] - l + A[i + 1] - r
A[i + 1] = r
print(ans)
| 9 | 11 | 186 | 266 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
pre = 0
for i in range(N - 1):
s = A[i] + A[i + 1] - pre
ans += max(0, s - x)
pre = min(max(0, s - x), A[i + 1])
print(ans)
| N, x = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
w = A[i] + A[i + 1]
if w <= x:
continue
r = max(0, A[i + 1] - (w - x))
l = x - r
ans += A[i] - l + A[i + 1] - r
A[i + 1] = r
print(ans)
| false | 18.181818 | [
"-A = list(map(int, input().split()))",
"+(*A,) = list(map(int, input().split()))",
"-pre = 0",
"- s = A[i] + A[i + 1] - pre",
"- ans += max(0, s - x)",
"- pre = min(max(0, s - x), A[i + 1])",
"+ w = A[i] + A[i + 1]",
"+ if w <= x:",
"+ continue",
"+ r = max(0, A[i + 1] - ... | false | 0.036119 | 0.036064 | 1.001523 | [
"s569997993",
"s536676175"
] |
u670180528 | p03457 | python | s279032116 | s049243610 | 125 | 100 | 26,760 | 26,632 | Accepted | Accepted | 20 | n,*l=list(map(int,open(0).read().split()));print(("YNeos"[any((i+j+k)%2+(i<j+k)for i,j,k in zip(*[iter([abs(i-j)for i,j in zip([0,0,0]+l,l)])]*3))::2])) | _,*l=list(map(int,open(0).read().split()));print(("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])) | 1 | 1 | 144 | 108 | n, *l = list(map(int, open(0).read().split()))
print(
(
"YNeos"[
any(
(i + j + k) % 2 + (i < j + k)
for i, j, k in zip(
*[iter([abs(i - j) for i, j in zip([0, 0, 0] + l, l)])] * 3
)
) :: 2
]
)
)
| _, *l = list(map(int, open(0).read().split()))
print(
(
"YNeos"[
any((t + x + y) % 2 + (t < x + y) for t, x, y in zip(*[iter(l)] * 3)) :: 2
]
)
)
| false | 0 | [
"-n, *l = list(map(int, open(0).read().split()))",
"+_, *l = list(map(int, open(0).read().split()))",
"- any(",
"- (i + j + k) % 2 + (i < j + k)",
"- for i, j, k in zip(",
"- *[iter([abs(i - j) for i, j in zip([0, 0, 0] + l, l)])] * 3",
"- ... | false | 0.037746 | 0.037671 | 1.001991 | [
"s279032116",
"s049243610"
] |
u935558307 | p03221 | python | s552605160 | s775133760 | 490 | 400 | 96,244 | 129,700 | Accepted | Accepted | 18.37 | N,M = list(map(int,input().split()))
digit = 'zero padding: {:0=6}'
dic = [[] for _ in range(N+1)]
for i in range(M):
p,y = list(map(int,input().split()))
dic[p].append((y,i))
for p in dic:
p.sort()
ans = [None for _ in range(M)]
for k in range(1,N+1):
p = dic[k]
for j in range(len(... | N,M = list(map(int,input().split()))
PY = [list(map(int,input().split())) for _ in range(M)]
dic = [[] for _ in range(N+1)]
for p,y in PY:
dic[p].append(y)
for a in dic:
a.sort()
dic2 = [{} for _ in range(N+1)]
for p in range(N+1):
dic2[p] = {y:i+1 for i,y in enumerate(dic[p])}
for p,y in ... | 21 | 17 | 434 | 382 | N, M = list(map(int, input().split()))
digit = "zero padding: {:0=6}"
dic = [[] for _ in range(N + 1)]
for i in range(M):
p, y = list(map(int, input().split()))
dic[p].append((y, i))
for p in dic:
p.sort()
ans = [None for _ in range(M)]
for k in range(1, N + 1):
p = dic[k]
for j in range(len(p)):
... | N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) for _ in range(M)]
dic = [[] for _ in range(N + 1)]
for p, y in PY:
dic[p].append(y)
for a in dic:
a.sort()
dic2 = [{} for _ in range(N + 1)]
for p in range(N + 1):
dic2[p] = {y: i + 1 for i, y in enumerate(dic[p])}
for p, y in PY:... | false | 19.047619 | [
"-digit = \"zero padding: {:0=6}\"",
"+PY = [list(map(int, input().split())) for _ in range(M)]",
"-for i in range(M):",
"- p, y = list(map(int, input().split()))",
"- dic[p].append((y, i))",
"-for p in dic:",
"- p.sort()",
"-ans = [None for _ in range(M)]",
"-for k in range(1, N + 1):",
... | false | 0.109641 | 0.075862 | 1.445274 | [
"s552605160",
"s775133760"
] |
u633068244 | p00176 | python | s915435732 | s566361339 | 40 | 20 | 4,328 | 4,340 | Accepted | Accepted | 50 | clr=["black","blue","lime","aqua","red","fuchsia","yellow","white"]
hex=["000000","0000ff","00ff00","00ffff","ff0000","ff00ff","ffff00","ffffff"]
def L(s1,s2):
return ((int(s1[:2],16)-int(s2[:2],16))**2+(int(s1[2:4],16)-int(s2[2:4],16))**2+(int(s1[4:],16)-int(s2[4:],16))**2)**0.5
def nn(s):
mn=mni=99999
for ... | ff=255
clr=["black","blue","lime","aqua","red","fuchsia","yellow","white"]
val=[[0,0,0],[0,0,ff],[0,ff,0],[0,ff,ff],[ff,0,0],[ff,0,ff],[ff,ff,0],[ff,ff,ff]]
def L(s1,s2):
return ((s1[0]-s2[0])**2+(s1[1]-s2[1])**2+(s1[2]-s2[2])**2)**0.5
while 1:
rgb=input()
if rgb=="0":break
rgb=[int(rgb[1:3],16),int(rg... | 16 | 12 | 469 | 410 | clr = ["black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"]
hex = ["000000", "0000ff", "00ff00", "00ffff", "ff0000", "ff00ff", "ffff00", "ffffff"]
def L(s1, s2):
return (
(int(s1[:2], 16) - int(s2[:2], 16)) ** 2
+ (int(s1[2:4], 16) - int(s2[2:4], 16)) ** 2
+ (int(s1[4:], 1... | ff = 255
clr = ["black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"]
val = [
[0, 0, 0],
[0, 0, ff],
[0, ff, 0],
[0, ff, ff],
[ff, 0, 0],
[ff, 0, ff],
[ff, ff, 0],
[ff, ff, ff],
]
def L(s1, s2):
return ((s1[0] - s2[0]) ** 2 + (s1[1] - s2[1]) ** 2 + (s1[2] - s2[2]) *... | false | 25 | [
"+ff = 255",
"-hex = [\"000000\", \"0000ff\", \"00ff00\", \"00ffff\", \"ff0000\", \"ff00ff\", \"ffff00\", \"ffffff\"]",
"+val = [",
"+ [0, 0, 0],",
"+ [0, 0, ff],",
"+ [0, ff, 0],",
"+ [0, ff, ff],",
"+ [ff, 0, 0],",
"+ [ff, 0, ff],",
"+ [ff, ff, 0],",
"+ [ff, ff, ff],",
... | false | 0.048323 | 0.107402 | 0.449929 | [
"s915435732",
"s566361339"
] |
u375616706 | p03166 | python | s074960554 | s503520452 | 1,305 | 1,018 | 242,472 | 125,028 | Accepted | Accepted | 21.99 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
edges = [set() for _ in range(N)]
ins = [0]*N
for _ in range(M):
a, b = [int(x)-1 for x in input().split()]
ins[b] += 1
edges[a].add(b)
dp = [-1]*N
start... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
edges = [set() for _ in range(N)]
ins = [0]*N
for _ in range(M):
a, b = [int(x)-1 for x in input().split()]
ins[b] += 1
edges[a].add(b)
dp = [-1]*N
def... | 37 | 31 | 667 | 562 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
edges = [set() for _ in range(N)]
ins = [0] * N
for _ in range(M):
a, b = [int(x) - 1 for x in input().split()]
ins[b] += 1
edges[a].add(b)
dp = [-1] * N
start = []
for i... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
edges = [set() for _ in range(N)]
ins = [0] * N
for _ in range(M):
a, b = [int(x) - 1 for x in input().split()]
ins[b] += 1
edges[a].add(b)
dp = [-1] * N
def dfs(s):
... | false | 16.216216 | [
"-start = []",
"-for i in range(N):",
"- if ins[i] == 0:",
"- start.append(i)",
"- if ins[i] == 0:",
"- ans = max(ans, dfs(i))",
"+ ans = max(ans, dfs(i))"
] | false | 0.044785 | 0.045091 | 0.993216 | [
"s074960554",
"s503520452"
] |
u874320250 | p02765 | python | s341570404 | s923000282 | 73 | 65 | 61,432 | 61,784 | Accepted | Accepted | 10.96 | N, R = list(map(int, input().split()))
print((R+max(0, 10-N)*100))
| N, R = list(map(int, input().split()))
if N >= 10:
print(R)
else:
print((R+100*(10-N)))
| 2 | 6 | 60 | 94 | N, R = list(map(int, input().split()))
print((R + max(0, 10 - N) * 100))
| N, R = list(map(int, input().split()))
if N >= 10:
print(R)
else:
print((R + 100 * (10 - N)))
| false | 66.666667 | [
"-print((R + max(0, 10 - N) * 100))",
"+if N >= 10:",
"+ print(R)",
"+else:",
"+ print((R + 100 * (10 - N)))"
] | false | 0.045013 | 0.034894 | 1.289999 | [
"s341570404",
"s923000282"
] |
u992910889 | p03606 | python | s679280782 | s212399189 | 199 | 175 | 38,768 | 38,256 | Accepted | Accepted | 12.06 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
N=int(eval(input()))
cnt=0
for i in range(N):
l... | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
cnt=0
N=int(eval(input()))
for i in range(N):
l,r=list(map(int,input().split()))
cnt+=r-l+1
print(cnt)
resolve() | 18 | 13 | 392 | 257 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
N = int(eval(input()))
cnt = 0
for i in range(N):
l, r = lis... | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
cnt = 0
N = int(eval(input()))
for i in range(N):
l, r = list(map(int, input().split()))
cnt += r - l + 1
print(cnt)
resolve()
| false | 27.777778 | [
"-# import bisect",
"-# import copy",
"-# import fractions",
"-# import math",
"-# import numpy as np",
"-# from collections import Counter, deque",
"-# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product",
"+import sys",
"+",
"+sys.setrecursionlimit(1... | false | 0.043284 | 0.09913 | 0.436636 | [
"s679280782",
"s212399189"
] |
u183509493 | p02819 | python | s388083155 | s532168997 | 60 | 28 | 10,452 | 9,400 | Accepted | Accepted | 53.33 | MAX=200000
def get_prime(x):
is_prime = [True] * 200000
for i in range(2,MAX):
if is_prime[i] and i >= x:
return i
elif is_prime[i]:
for j in range(2 * i, MAX, i):
is_prime[j] = False
print((get_prime(int(eval(input())))))
| # Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
import sys
sys.setrecursionlimit(1000000)
x= int(eval(input()))
def prime_check(num,count):
if (num % count) != 0:
if num <= count**2:
print(num)
else:
prime_check(num,count+1)
... | 11 | 19 | 258 | 409 | MAX = 200000
def get_prime(x):
is_prime = [True] * 200000
for i in range(2, MAX):
if is_prime[i] and i >= x:
return i
elif is_prime[i]:
for j in range(2 * i, MAX, i):
is_prime[j] = False
print((get_prime(int(eval(input())))))
| # Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
import sys
sys.setrecursionlimit(1000000)
x = int(eval(input()))
def prime_check(num, count):
if (num % count) != 0:
if num <= count**2:
print(num)
else:
prime_check(num, count + 1)
else:... | false | 42.105263 | [
"-MAX = 200000",
"+# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042",
"+import sys",
"+",
"+sys.setrecursionlimit(1000000)",
"+x = int(eval(input()))",
"-def get_prime(x):",
"- is_prime = [True] * 200000",
"- for i in range(2, MAX):",
"- if is_prime[i]... | false | 0.057095 | 0.040006 | 1.42716 | [
"s388083155",
"s532168997"
] |
u644907318 | p04011 | python | s175664239 | s700249847 | 177 | 140 | 38,384 | 61,200 | Accepted | Accepted | 20.9 | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N<=K:
c = X*N
else:
c = X*K+Y*(N-K)
print(c) | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N<=K:
ans = X*N
else:
ans = X*K
ans += Y*(N-K)
print(ans) | 9 | 10 | 131 | 149 | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N <= K:
c = X * N
else:
c = X * K + Y * (N - K)
print(c)
| N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N <= K:
ans = X * N
else:
ans = X * K
ans += Y * (N - K)
print(ans)
| false | 10 | [
"- c = X * N",
"+ ans = X * N",
"- c = X * K + Y * (N - K)",
"-print(c)",
"+ ans = X * K",
"+ ans += Y * (N - K)",
"+print(ans)"
] | false | 0.034651 | 0.034145 | 1.01483 | [
"s175664239",
"s700249847"
] |
u917140501 | p03074 | python | s204262334 | s872616306 | 145 | 128 | 4,792 | 8,432 | Accepted | Accepted | 11.72 | N,K= list(map(int, input().split()))
S=[int(x) for x in list(str(eval(input())))]
nums=list()
ds={0:1,1:0}
now=1
cnt=0
for i in S:
if i==now:
cnt=cnt+1
else:
nums.append(cnt)
now=ds[now]
cnt=1
if cnt!=0:
nums.append(cnt)
if len(nums)%2==0:
nums.appen... | N,K= list(map(int, input().split()))
S=[int(x) for x in list(str(eval(input())))]
nums=list()
ds={0:1,1:0}
now=1
cnt=0
for i in S:
if i==now:
cnt=cnt+1
else:
nums.append(cnt)
now=ds[now]
cnt=1
if cnt!=0:
nums.append(cnt)
if len(nums)%2==0:
nums.appen... | 42 | 37 | 643 | 567 | N, K = list(map(int, input().split()))
S = [int(x) for x in list(str(eval(input())))]
nums = list()
ds = {0: 1, 1: 0}
now = 1
cnt = 0
for i in S:
if i == now:
cnt = cnt + 1
else:
nums.append(cnt)
now = ds[now]
cnt = 1
if cnt != 0:
nums.append(cnt)
if len(nums) % 2 == 0:
n... | N, K = list(map(int, input().split()))
S = [int(x) for x in list(str(eval(input())))]
nums = list()
ds = {0: 1, 1: 0}
now = 1
cnt = 0
for i in S:
if i == now:
cnt = cnt + 1
else:
nums.append(cnt)
now = ds[now]
cnt = 1
if cnt != 0:
nums.append(cnt)
if len(nums) % 2 == 0:
n... | false | 11.904762 | [
"-left = 0",
"-right = 0",
"-tmp = 0",
"+sum = [0] * (len(nums) + 1)",
"+for i in range(len(nums)):",
"+ sum[i + 1] = sum[i] + nums[i]",
"- nextleft = i",
"- nextright = min(i + Add, len(nums))",
"- while nextleft > left:",
"- tmp = tmp - nums[left]",
"- left += 1",
"... | false | 0.04903 | 0.04886 | 1.003493 | [
"s204262334",
"s872616306"
] |
u197300260 | p03624 | python | s656410985 | s277390854 | 30 | 19 | 3,316 | 3,316 | Accepted | Accepted | 36.67 | # _*_ coding:utf-8 _*_
# Atcoder_Beginners_Contest071-B
# TODO https://atcoder.jp/contests/abc071/tasks/abc071_b
def firstCharNotFound(givenString):
# initialize for char
checkList = [False for _ in range(0,26,+1)]
stringLength = list(range(0,len(givenString),+1))
for pos in stringLength:
charIntVers... | # Problem:
# Python Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_num... | 26 | 38 | 714 | 1,080 | # _*_ coding:utf-8 _*_
# Atcoder_Beginners_Contest071-B
# TODO https://atcoder.jp/contests/abc071/tasks/abc071_b
def firstCharNotFound(givenString):
# initialize for char
checkList = [False for _ in range(0, 26, +1)]
stringLength = list(range(0, len(givenString), +1))
for pos in stringLength:
... | # Problem:
# Python Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(... | false | 31.578947 | [
"-# _*_ coding:utf-8 _*_",
"-# Atcoder_Beginners_Contest071-B",
"-# TODO https://atcoder.jp/contests/abc071/tasks/abc071_b",
"-def firstCharNotFound(givenString):",
"- # initialize for char",
"- checkList = [False for _ in range(0, 26, +1)]",
"- stringLength = list(range(0, len(givenString), ... | false | 0.076938 | 0.070209 | 1.095853 | [
"s656410985",
"s277390854"
] |
u442877951 | p03107 | python | s222759482 | s877030857 | 29 | 26 | 3,188 | 3,444 | Accepted | Accepted | 10.34 | S = str(eval(input()))
zero = 0
one = 0
for i in S:
if i == "0":
zero += 1
else:
one += 1
ans = min(zero,one)*2
print(ans) | from collections import Counter
S = str(eval(input()))
SC = Counter(S)
v,c = list(zip(*SC.most_common()))
if len(c) == 2:
print((len(S) - abs(c[1]-c[0])))
else:
print((0)) | 10 | 8 | 137 | 166 | S = str(eval(input()))
zero = 0
one = 0
for i in S:
if i == "0":
zero += 1
else:
one += 1
ans = min(zero, one) * 2
print(ans)
| from collections import Counter
S = str(eval(input()))
SC = Counter(S)
v, c = list(zip(*SC.most_common()))
if len(c) == 2:
print((len(S) - abs(c[1] - c[0])))
else:
print((0))
| false | 20 | [
"+from collections import Counter",
"+",
"-zero = 0",
"-one = 0",
"-for i in S:",
"- if i == \"0\":",
"- zero += 1",
"- else:",
"- one += 1",
"-ans = min(zero, one) * 2",
"-print(ans)",
"+SC = Counter(S)",
"+v, c = list(zip(*SC.most_common()))",
"+if len(c) == 2:",
"+... | false | 0.039409 | 0.040643 | 0.969641 | [
"s222759482",
"s877030857"
] |
u028973125 | p03464 | python | s493818265 | s767326875 | 251 | 109 | 83,920 | 20,608 | Accepted | Accepted | 56.57 | import sys
K = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
# うまい方法がない気がするため、二分探索で攻める
l = 0
r = 2 * 10**15
ans1 = -1
while l != r:
n = (l + r) // 2
res = n
for a in A:
res = res - res % a
if res >= 2:
r = n
if res == 2:
... | import sys
K = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
if A[-1] != 2:
print((-1))
sys.exit()
l = 2
r = 2
for i in range(K-2, -1, -1):
l = ((l - 1) // A[i] + 1) * A[i]
r = ((r + A[i+1] - 1) // A[i]) * A[i]
if l > r:
print((-1))
... | 41 | 21 | 722 | 367 | import sys
K = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
# うまい方法がない気がするため、二分探索で攻める
l = 0
r = 2 * 10**15
ans1 = -1
while l != r:
n = (l + r) // 2
res = n
for a in A:
res = res - res % a
if res >= 2:
r = n
if res == 2:
ans1 = n
else... | import sys
K = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
if A[-1] != 2:
print((-1))
sys.exit()
l = 2
r = 2
for i in range(K - 2, -1, -1):
l = ((l - 1) // A[i] + 1) * A[i]
r = ((r + A[i + 1] - 1) // A[i]) * A[i]
if l > r:
print((-1))
sys.exit()
# prin... | false | 48.780488 | [
"-# うまい方法がない気がするため、二分探索で攻める",
"-l = 0",
"-r = 2 * 10**15",
"-ans1 = -1",
"-while l != r:",
"- n = (l + r) // 2",
"- res = n",
"- for a in A:",
"- res = res - res % a",
"- if res >= 2:",
"- r = n",
"- if res == 2:",
"- ans1 = n",
"- else:",
"... | false | 0.072368 | 0.035918 | 2.014818 | [
"s493818265",
"s767326875"
] |
u506858457 | p02713 | python | s741882766 | s017837349 | 1,026 | 181 | 69,788 | 68,552 | Accepted | Accepted | 82.36 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans=0
K=int(eval(input()))
for a in range(1,K+1):
for b in range(1,K+1):
for c in range(1,K+1):
ans+=gcd(a,b,c)
print(ans)
| k = int(eval(input()))
from math import gcd
#gcd_sum = [0] * 201
ans = 0
'''
for i in range(1, k+1):
for j in range(1, k+1):
gcd_sum[i] += gcd(i,j)
#print(gcd(i,j))
#print(gcd_sum[i])
'''
for a in range(1,k+1):
for b in range(1,k+1):
g = gcd(a,b)
... | 13 | 24 | 240 | 423 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans = 0
K = int(eval(input()))
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(a, b, c)
print(ans)
| k = int(eval(input()))
from math import gcd
# gcd_sum = [0] * 201
ans = 0
"""
for i in range(1, k+1):
for j in range(1, k+1):
gcd_sum[i] += gcd(i,j)
#print(gcd(i,j))
#print(gcd_sum[i])
"""
for a in range(1, k + 1):
for b in range(1, k + 1):
g = gcd(a, b)
for c in range(1... | false | 45.833333 | [
"-import math",
"-from functools import reduce",
"+k = int(eval(input()))",
"+from math import gcd",
"-",
"-def gcd(*numbers):",
"- return reduce(math.gcd, numbers)",
"-",
"-",
"+# gcd_sum = [0] * 201",
"-K = int(eval(input()))",
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1... | false | 0.086705 | 0.191151 | 0.453592 | [
"s741882766",
"s017837349"
] |
u503228842 | p02614 | python | s565464247 | s773582740 | 61 | 49 | 9,200 | 9,056 | Accepted | Accepted | 19.67 | H, W, K = list(map(int, input().split()))
g = [eval(input()) for _ in range(H)]
ans = 0
for bit in range(2**(H + W)):
cnt = 0
for h in range(H):
if (bit & (h << 1)):
pass
if ((bit >> h) & 1):
#print(h,"cancel")
continue
for w in range(W):
... | h, w, k = list(map(int, input().split()))
g = [eval(input()) for _ in range(h)]
ans = 0
for bit in range(2**(h+w)):
cnt = 0
for hh in range(h):
if ((bit >> hh) & 1):
continue
for ww in range(w):
if ((bit >> h + ww) & 1):
continue
if ... | 25 | 16 | 656 | 400 | H, W, K = list(map(int, input().split()))
g = [eval(input()) for _ in range(H)]
ans = 0
for bit in range(2 ** (H + W)):
cnt = 0
for h in range(H):
if bit & (h << 1):
pass
if (bit >> h) & 1:
# print(h,"cancel")
continue
for w in range(W):
if... | h, w, k = list(map(int, input().split()))
g = [eval(input()) for _ in range(h)]
ans = 0
for bit in range(2 ** (h + w)):
cnt = 0
for hh in range(h):
if (bit >> hh) & 1:
continue
for ww in range(w):
if (bit >> h + ww) & 1:
continue
if g[hh][ww] =... | false | 36 | [
"-H, W, K = list(map(int, input().split()))",
"-g = [eval(input()) for _ in range(H)]",
"+h, w, k = list(map(int, input().split()))",
"+g = [eval(input()) for _ in range(h)]",
"-for bit in range(2 ** (H + W)):",
"+for bit in range(2 ** (h + w)):",
"- for h in range(H):",
"- if bit & (h << 1)... | false | 0.083554 | 0.042234 | 1.978344 | [
"s565464247",
"s773582740"
] |
u528720841 | p02953 | python | s902027170 | s483893561 | 84 | 71 | 11,152 | 11,152 | Accepted | Accepted | 15.48 | import sys
N = int(eval(input()))
H = list(map(int, input().split()))
m = 0
for h in H:
if m <= h-1 or m-1 <= h:
m = max(m, h)
else:
print("No")
sys.exit()
print("Yes")
| import sys
N = int(eval(input()))
H = list(map(int, input().split()))
m = 0
for h in H:
if m-1 <= h:
m = max(m, h)
else:
print("No")
sys.exit()
print("Yes")
| 14 | 14 | 212 | 200 | import sys
N = int(eval(input()))
H = list(map(int, input().split()))
m = 0
for h in H:
if m <= h - 1 or m - 1 <= h:
m = max(m, h)
else:
print("No")
sys.exit()
print("Yes")
| import sys
N = int(eval(input()))
H = list(map(int, input().split()))
m = 0
for h in H:
if m - 1 <= h:
m = max(m, h)
else:
print("No")
sys.exit()
print("Yes")
| false | 0 | [
"- if m <= h - 1 or m - 1 <= h:",
"+ if m - 1 <= h:"
] | false | 0.039411 | 0.072869 | 0.540852 | [
"s902027170",
"s483893561"
] |
u391589398 | p02579 | python | s998638599 | s855050480 | 834 | 561 | 134,528 | 133,484 | Accepted | Accepted | 32.73 | h, w = list(map(int, input().split()))
ch, cw = [int(x)-1 for x in input().split()]
dh, dw = [int(x)-1 for x in input().split()]
S = [list(eval(input())) for _ in range(h)]
from collections import deque
# 座標, 座標, ワープカウント
q = deque([[ch, cw, 0]])
visited = [[-1] * w for _ in range(h)]
visited[ch][cw] = 0
an... | h, w = list(map(int, input().split()))
ch, cw = [int(x)-1 for x in input().split()]
dh, dw = [int(x)-1 for x in input().split()]
S = [list(eval(input())) for _ in range(h)]
from collections import deque
# 座標, 座標, ワープカウント
q = deque([[ch, cw, 0]])
wall = deque()
visited = [[-1] * w for _ in range(h)]
visited[c... | 35 | 51 | 1,198 | 1,695 | h, w = list(map(int, input().split()))
ch, cw = [int(x) - 1 for x in input().split()]
dh, dw = [int(x) - 1 for x in input().split()]
S = [list(eval(input())) for _ in range(h)]
from collections import deque
# 座標, 座標, ワープカウント
q = deque([[ch, cw, 0]])
visited = [[-1] * w for _ in range(h)]
visited[ch][cw] = 0
ans = -1
w... | h, w = list(map(int, input().split()))
ch, cw = [int(x) - 1 for x in input().split()]
dh, dw = [int(x) - 1 for x in input().split()]
S = [list(eval(input())) for _ in range(h)]
from collections import deque
# 座標, 座標, ワープカウント
q = deque([[ch, cw, 0]])
wall = deque()
visited = [[-1] * w for _ in range(h)]
visited[ch][cw]... | false | 31.372549 | [
"+wall = deque()",
"-ans = -1",
"-while q:",
"- i, j, wc = q.popleft()",
"- if i == dh and j == dw:",
"- ans = wc",
"+ans = -2",
"+while True:",
"+ # つながっているエリアを探索",
"+ while q:",
"+ i, j, wc = q.popleft()",
"+ if i == dh and j == dw:",
"+ ans = wc... | false | 0.061094 | 0.036769 | 1.661545 | [
"s998638599",
"s855050480"
] |
u396495667 | p03803 | python | s416245039 | s104103707 | 173 | 17 | 38,256 | 3,060 | Accepted | Accepted | 90.17 | a,b = list(map(int, input().split()))
if a == 1: a+=13
if b == 1: b+=13
if a >b:
print('Alice')
elif b>a:
print('Bob')
elif a == b:
print('Draw') | a,b = list(map(int, input().split()))
if a==b==1:
print('Draw')
elif a ==1:
print('Alice')
elif b ==1:
print('Bob')
if a !=1 and b !=1:
if a>b:
print('Alice')
elif a<b:
print('Bob')
elif a==b:
print('Draw') | 11 | 15 | 157 | 243 | a, b = list(map(int, input().split()))
if a == 1:
a += 13
if b == 1:
b += 13
if a > b:
print("Alice")
elif b > a:
print("Bob")
elif a == b:
print("Draw")
| a, b = list(map(int, input().split()))
if a == b == 1:
print("Draw")
elif a == 1:
print("Alice")
elif b == 1:
print("Bob")
if a != 1 and b != 1:
if a > b:
print("Alice")
elif a < b:
print("Bob")
elif a == b:
print("Draw")
| false | 26.666667 | [
"-if a == 1:",
"- a += 13",
"-if b == 1:",
"- b += 13",
"-if a > b:",
"+if a == b == 1:",
"+ print(\"Draw\")",
"+elif a == 1:",
"-elif b > a:",
"+elif b == 1:",
"-elif a == b:",
"- print(\"Draw\")",
"+if a != 1 and b != 1:",
"+ if a > b:",
"+ print(\"Alice\")",
"+... | false | 0.099303 | 0.045552 | 2.179975 | [
"s416245039",
"s104103707"
] |
u969190727 | p02822 | python | s680486505 | s980096467 | 1,060 | 818 | 103,160 | 103,160 | Accepted | Accepted | 22.83 | import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n=int(eval(input()))
edge=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
inf=10**6
Par=[inf]*n
Par[0]=-1
Deg=[0]*n
Deg[0]=0
Chk=[0]
while Chk:
c=Chk.pop(... | import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n=int(eval(input()))
edge=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
inf=10**6
Par=[inf]*n
Par[0]=-1
Deg=[0]*n
Deg[0]=0
Chk=[0]
while Chk:
c=Chk.pop(... | 66 | 66 | 1,208 | 1,199 | import sys
input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7
n = int(eval(input()))
edge = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
inf = 10**6
Par = [inf] * n
Par[0] = -1
Deg = [0] * n
Deg[0] = 0
Ch... | import sys
input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7
n = int(eval(input()))
edge = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
inf = 10**6
Par = [inf] * n
Par[0] = -1
Deg = [0] * n
Deg[0] = 0
Ch... | false | 0 | [
"- ans = (ans + cur) % mod",
"+ ans += cur"
] | false | 0.037739 | 0.037441 | 1.007943 | [
"s680486505",
"s980096467"
] |
u146346223 | p02640 | python | s865526489 | s487845355 | 24 | 22 | 9,124 | 9,168 | Accepted | Accepted | 8.33 | x, y = list(map(int, input().split()))
for a in range(0, 100):
for b in range(0, 100):
if (2*a + 4*b) == y:
if a + b == x:
print('Yes')
exit()
print('No') | x, y = list(map(int, input().split()))
if y % 2 == 0 and (x * 2 <= y) and (y <= x * 4):
print('Yes')
else:
print('No') | 10 | 6 | 215 | 126 | x, y = list(map(int, input().split()))
for a in range(0, 100):
for b in range(0, 100):
if (2 * a + 4 * b) == y:
if a + b == x:
print("Yes")
exit()
print("No")
| x, y = list(map(int, input().split()))
if y % 2 == 0 and (x * 2 <= y) and (y <= x * 4):
print("Yes")
else:
print("No")
| false | 40 | [
"-for a in range(0, 100):",
"- for b in range(0, 100):",
"- if (2 * a + 4 * b) == y:",
"- if a + b == x:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+if y % 2 == 0 and (x * 2 <= y) and (y <= x * 4):",
"+ print(\"Yes\")",
"+else:",
"+... | false | 0.049918 | 0.048718 | 1.024627 | [
"s865526489",
"s487845355"
] |
u138486156 | p03006 | python | s550871259 | s518674633 | 464 | 231 | 3,188 | 42,864 | Accepted | Accepted | 50.22 | N = int(eval(input()))
XY = sorted([tuple(map(int, input().split())) for _ in range(N)])
PQ = []
for i in range(N-1):
for j in range(i, N):
PQ.append((XY[j][0]-XY[i][0], XY[j][1]-XY[i][1]))
PQ = list(set(PQ))
ans = N
for p, q in PQ:
tmp1 = 1
check=[0]*N
for i in range(N-1):
i... | from collections import deque
from collections import defaultdict
from copy import copy
N = int(eval(input()))
XY = list(sorted([tuple(map(int, input().split())) for _ in range(N)]))
PQ = []
for i in range(N-1):
for j in range(i, N):
PQ.append((XY[j][0]-XY[i][0], XY[j][1]-XY[i][1]))
PQ = list(set(P... | 34 | 37 | 772 | 802 | N = int(eval(input()))
XY = sorted([tuple(map(int, input().split())) for _ in range(N)])
PQ = []
for i in range(N - 1):
for j in range(i, N):
PQ.append((XY[j][0] - XY[i][0], XY[j][1] - XY[i][1]))
PQ = list(set(PQ))
ans = N
for p, q in PQ:
tmp1 = 1
check = [0] * N
for i in range(N - 1):
i... | from collections import deque
from collections import defaultdict
from copy import copy
N = int(eval(input()))
XY = list(sorted([tuple(map(int, input().split())) for _ in range(N)]))
PQ = []
for i in range(N - 1):
for j in range(i, N):
PQ.append((XY[j][0] - XY[i][0], XY[j][1] - XY[i][1]))
PQ = list(set(PQ)... | false | 8.108108 | [
"+from collections import deque",
"+from collections import defaultdict",
"+from copy import copy",
"+",
"-XY = sorted([tuple(map(int, input().split())) for _ in range(N)])",
"+XY = list(sorted([tuple(map(int, input().split())) for _ in range(N)]))",
"- check = [0] * N",
"- for i in range(N - 1)... | false | 0.077933 | 0.068093 | 1.144514 | [
"s550871259",
"s518674633"
] |
u803848678 | p03343 | python | s193052071 | s309578955 | 523 | 457 | 47,196 | 47,196 | Accepted | Accepted | 12.62 | n,k,q = list(map(int, input().split()))
a = list(map(int, input().split()))
num_set = set(a)
def parse(b):
ret = []
tmp = []
for ai in a:
if ai >= b:
tmp.append(ai)
else:
if len(tmp) >= k:
tmp.sort(reverse=True)
for i in r... | n,k,q = list(map(int, input().split()))
a = list(map(int, input().split()))
def parse(b):
ret = []
tmp = []
for ai in a:
if ai >= b:
tmp.append(ai)
else:
if len(tmp) >= k:
tmp.sort(reverse=True)
for i in range(k-1,len(tmp))... | 34 | 34 | 770 | 756 | n, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
num_set = set(a)
def parse(b):
ret = []
tmp = []
for ai in a:
if ai >= b:
tmp.append(ai)
else:
if len(tmp) >= k:
tmp.sort(reverse=True)
for i in range(k - 1... | n, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
def parse(b):
ret = []
tmp = []
for ai in a:
if ai >= b:
tmp.append(ai)
else:
if len(tmp) >= k:
tmp.sort(reverse=True)
for i in range(k - 1, len(tmp)):
... | false | 0 | [
"-num_set = set(a)",
"-for b in num_set:",
"+for b in set(a):",
"- ans_tmp = sorted(lis)[q - 1] - min(lis)",
"+ lis.sort()",
"+ ans_tmp = lis[q - 1] - lis[0]"
] | false | 0.037743 | 0.096573 | 0.390827 | [
"s193052071",
"s309578955"
] |
u388927326 | p02713 | python | s734242428 | s297719645 | 854 | 767 | 109,600 | 106,360 | Accepted | Accepted | 10.19 | #!/usr/bin/env python3
from numba import njit
def main():
k = int(eval(input()))
print((getresult(k)))
@njit
def getresult(k):
res = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
res += gcd(gcd(a, b), c)
return r... | #!/usr/bin/env python3
import numpy as np
from numba import njit
def main():
k = int(eval(input()))
print((getresult(k)))
@njit("i4(i4, i4)", cache=True)
def gcd(x, y):
if x < y:
x, y = y, x # x >= y
while y > 0:
r = x % y
x = y
y = r
return x
... | 29 | 30 | 535 | 608 | #!/usr/bin/env python3
from numba import njit
def main():
k = int(eval(input()))
print((getresult(k)))
@njit
def getresult(k):
res = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
res += gcd(gcd(a, b), c)
return res
@njit("i4... | #!/usr/bin/env python3
import numpy as np
from numba import njit
def main():
k = int(eval(input()))
print((getresult(k)))
@njit("i4(i4, i4)", cache=True)
def gcd(x, y):
if x < y:
x, y = y, x # x >= y
while y > 0:
r = x % y
x = y
y = r
return x
@njit("i8(i4)", c... | false | 3.333333 | [
"+import numpy as np",
"-",
"-",
"-@njit",
"-def getresult(k):",
"- res = 0",
"- for a in range(1, k + 1):",
"- for b in range(1, k + 1):",
"- for c in range(1, k + 1):",
"- res += gcd(gcd(a, b), c)",
"- return res",
"+@njit(\"i8(i4)\", cache=True)",
... | false | 0.0376 | 0.198524 | 0.189396 | [
"s734242428",
"s297719645"
] |
u790710233 | p03212 | python | s016374119 | s386568211 | 1,474 | 71 | 3,188 | 3,060 | Accepted | Accepted | 95.18 | n = int(eval(input()))
def squ(x):
if x == 0:
return '0'
a = ""
while x != 0:
x, mod = divmod(x, 4)
a += str(mod)
return a[::-1]
ans = 0
for x in range(10**6):
x_squ = squ(x)
x_str = x_squ.replace('3', '7').replace('2', '5').replace('1', '3')
if... | N = int(eval(input()))
def dfs(x):
if int('0'+x) > N:
return 0
retval = 1 if len(set(x)) == 3 else 0
for c in '753':
retval += dfs(x + c)
return retval
print((dfs(''))) | 30 | 13 | 468 | 208 | n = int(eval(input()))
def squ(x):
if x == 0:
return "0"
a = ""
while x != 0:
x, mod = divmod(x, 4)
a += str(mod)
return a[::-1]
ans = 0
for x in range(10**6):
x_squ = squ(x)
x_str = x_squ.replace("3", "7").replace("2", "5").replace("1", "3")
if "0" in x_str:
... | N = int(eval(input()))
def dfs(x):
if int("0" + x) > N:
return 0
retval = 1 if len(set(x)) == 3 else 0
for c in "753":
retval += dfs(x + c)
return retval
print((dfs("")))
| false | 56.666667 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-def squ(x):",
"- if x == 0:",
"- return \"0\"",
"- a = \"\"",
"- while x != 0:",
"- x, mod = divmod(x, 4)",
"- a += str(mod)",
"- return a[::-1]",
"+def dfs(x):",
"+ if int(\"0\" + x) > N:",
"+ ... | false | 0.472532 | 0.044164 | 10.699555 | [
"s016374119",
"s386568211"
] |
u170201762 | p02955 | python | s489542977 | s816717530 | 375 | 286 | 44,140 | 42,844 | Accepted | Accepted | 23.73 | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
N,K = list(map(int,input().split()))
A = list(map(int,input().split(... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
s = sum(A)
divisors = []
for i in range(1,int(s**0.5)+1):
if s%i==0:
divisors.append(i)
divisors.append(s//i)
divisors = list(set(divisors))
divisors.sort(reverse=True)
def possible(n):
a = []
for i in ra... | 51 | 43 | 1,068 | 860 | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
D... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
s = sum(A)
divisors = []
for i in range(1, int(s**0.5) + 1):
if s % i == 0:
divisors.append(i)
divisors.append(s // i)
divisors = list(set(divisors))
divisors.sort(reverse=True)
def possible(n):
a = []
for i in rang... | false | 15.686275 | [
"-def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"- divisors.append(n // i)",
"- divisors.sort()",
"- return divisors",
"+N, K = list(map(in... | false | 0.087803 | 0.036155 | 2.428514 | [
"s489542977",
"s816717530"
] |
u367130284 | p03073 | python | s405786354 | s907740629 | 113 | 102 | 4,852 | 3,316 | Accepted | Accepted | 9.73 | s=eval(input())
x=[i%2 for i in range(len(s))]
y=[~i%2 for i in range(len(s))]
#print(x,y)
c=0
e=0
for i in range(len(s)):
#print(s[i],x[i],y[i])
if int(s[i])!=x[i]:
c+=1
if int(s[i])!=y[i]:
e+=1
print((min(c,e))) | s=eval(input())
ans=0
ans2=0
for i in range(len(s)):
if int(s[i])!=i%2:
ans+=1
if int(s[i])!=(i+1)%2:
ans2+=1
print((min(ans,ans2))) | 13 | 9 | 245 | 156 | s = eval(input())
x = [i % 2 for i in range(len(s))]
y = [~i % 2 for i in range(len(s))]
# print(x,y)
c = 0
e = 0
for i in range(len(s)):
# print(s[i],x[i],y[i])
if int(s[i]) != x[i]:
c += 1
if int(s[i]) != y[i]:
e += 1
print((min(c, e)))
| s = eval(input())
ans = 0
ans2 = 0
for i in range(len(s)):
if int(s[i]) != i % 2:
ans += 1
if int(s[i]) != (i + 1) % 2:
ans2 += 1
print((min(ans, ans2)))
| false | 30.769231 | [
"-x = [i % 2 for i in range(len(s))]",
"-y = [~i % 2 for i in range(len(s))]",
"-# print(x,y)",
"-c = 0",
"-e = 0",
"+ans = 0",
"+ans2 = 0",
"- # print(s[i],x[i],y[i])",
"- if int(s[i]) != x[i]:",
"- c += 1",
"- if int(s[i]) != y[i]:",
"- e += 1",
"-print((min(c, e)))"... | false | 0.04387 | 0.007326 | 5.988212 | [
"s405786354",
"s907740629"
] |
u367701763 | p03163 | python | s694997745 | s774845126 | 242 | 166 | 152,564 | 74,520 | Accepted | Accepted | 31.4 | import sys
input = sys.stdin.readline
M, W = list(map(int, input().split())) # M: 品物の種類 W: 重量制限
single = True # True = 重複なし
price_list = [0]
weight_list = [0]
for _ in range(M):
weight, price = list(map(int, input().spli... | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split())) # N: 品物の種類 W: 重量制限
price_list = []
weight_list = []
for _ in range(N):
weight, price = list(map(int, input().split()))
price_list.append(price)
weight_list.append(weight)
########... | 44 | 36 | 1,775 | 914 | import sys
input = sys.stdin.readline
M, W = list(map(int, input().split())) # M: 品物の種類 W: 重量制限
single = True # True = 重複なし
price_list = [0]
weight_list = [0]
for _ in range(M):
weight, price = list(map(int, input().split()))
price_list.append(price)
weight_list.append(weight)
###########################... | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split())) # N: 品物の種類 W: 重量制限
price_list = []
weight_list = []
for _ in range(N):
weight, price = list(map(int, input().split()))
price_list.append(price)
weight_list.append(weight)
##########################################################... | false | 18.181818 | [
"-M, W = list(map(int, input().split())) # M: 品物の種類 W: 重量制限",
"-single = True # True = 重複なし",
"-price_list = [0]",
"-weight_list = [0]",
"-for _ in range(M):",
"+N, W = list(map(int, input().split())) # N: 品物の種類 W: 重量制限",
"+price_list = []",
"+weight_list = []",
"+for _ in range(N):",
"+def max... | false | 0.040834 | 0.038084 | 1.07223 | [
"s694997745",
"s774845126"
] |
u600402037 | p02900 | python | s480167747 | s768457078 | 174 | 91 | 3,064 | 3,064 | Accepted | Accepted | 47.7 | import sys
sys.setrecursionlimit(10 ** 7)
def gcd(a, b):
while b:
a, b = b, a % b
return a
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n //= i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
A, B ... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f... | 25 | 32 | 438 | 599 | import sys
sys.setrecursionlimit(10**7)
def gcd(a, b):
while b:
a, b = b, a % b
return a
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n //= i
table.append(i)
i += 1
if n > 1:
table.append(n)
retu... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n ... | false | 21.875 | [
"-sys.setrecursionlimit(10**7)",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir = lambda: int(sr())",
"+lr = lambda: list(map(int, sr().split()))",
"+A, B = lr()",
"-def gcd(a, b):",
"- while b:",
"- a, b = b, a % b",
"+def prime_factorize(n):",
"+ a = []",
"+ while n % 2 ==... | false | 0.035533 | 0.036773 | 0.96629 | [
"s480167747",
"s768457078"
] |
u254871849 | p03379 | python | s693630385 | s068671035 | 490 | 310 | 25,180 | 25,052 | Accepted | Accepted | 36.73 | # author: kagemeka
# created: 2019-11-07 11:52:43(JST)
import sys
# import collections
# import math
# import string
import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
def main():
n, *x = (int(i) for ... | # author: kagemeka
# created: 2019-11-07 11:52:43(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
def main():
n, *x = (int(i) fo... | 25 | 24 | 616 | 578 | # author: kagemeka
# created: 2019-11-07 11:52:43(JST)
import sys
# import collections
# import math
# import string
import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
def main():
n, *x = (int(i) for i in sys.stdin... | # author: kagemeka
# created: 2019-11-07 11:52:43(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
def main():
n, *x = (int(i) for i in sys.stdi... | false | 4 | [
"-import bisect",
"-",
"+# import bisect",
"- b = bisect.bisect_left(s_x, i)",
"- print((m_l if b < half else m_s))",
"+ print((m_l if i < m_l else m_s))"
] | false | 0.045152 | 0.04638 | 0.973523 | [
"s693630385",
"s068671035"
] |
u197300773 | p03291 | python | s216313700 | s903154804 | 290 | 254 | 3,188 | 3,188 | Accepted | Accepted | 12.41 | s=eval(input())
a=[1,0,0,0]
for i in range(len(s)):
if s[i]=="A":
a[1]+=a[0]
elif s[i]=="B":
a[2]+=a[1]
elif s[i]=="C":
a[3]+=a[2]
else:
a=[ a[0]*3 ] + [ a[j]*3+a[j-1] for j in range(1,4) ]
a=[a[i]%1000000007 for i in range(4)]
print((a[3])) | s=eval(input())
a=[1,0,0,0]
for i in range(len(s)):
c=s[i]
if c=="A":
a[1]+=a[0]
elif c=="B":
a[2]+=a[1]
elif c=="C":
a[3]+=a[2]
else:
a=[ a[0]*3 ] + [ a[j+1]*3+a[j] for j in range(3) ]
a=[a[i]%1000000007 for i in range(4)]
print((a[3])) | 17 | 18 | 305 | 306 | s = eval(input())
a = [1, 0, 0, 0]
for i in range(len(s)):
if s[i] == "A":
a[1] += a[0]
elif s[i] == "B":
a[2] += a[1]
elif s[i] == "C":
a[3] += a[2]
else:
a = [a[0] * 3] + [a[j] * 3 + a[j - 1] for j in range(1, 4)]
a = [a[i] % 1000000007 for i in range(4)]
print((a[3... | s = eval(input())
a = [1, 0, 0, 0]
for i in range(len(s)):
c = s[i]
if c == "A":
a[1] += a[0]
elif c == "B":
a[2] += a[1]
elif c == "C":
a[3] += a[2]
else:
a = [a[0] * 3] + [a[j + 1] * 3 + a[j] for j in range(3)]
a = [a[i] % 1000000007 for i in range(4)]
print((a[... | false | 5.555556 | [
"- if s[i] == \"A\":",
"+ c = s[i]",
"+ if c == \"A\":",
"- elif s[i] == \"B\":",
"+ elif c == \"B\":",
"- elif s[i] == \"C\":",
"+ elif c == \"C\":",
"- a = [a[0] * 3] + [a[j] * 3 + a[j - 1] for j in range(1, 4)]",
"+ a = [a[0] * 3] + [a[j + 1] * 3 + a[j] for j in... | false | 0.084394 | 0.039694 | 2.126124 | [
"s216313700",
"s903154804"
] |
u703950586 | p03739 | python | s439654186 | s911235927 | 620 | 321 | 122,232 | 61,928 | Accepted | Accepted | 48.23 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
n = NI()
bit = [0] * (n+1)
A = LI()
d... | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
n = NI()
bit = [0] * (n+1)
def add(i,x):... | 45 | 46 | 982 | 964 | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
n = NI()
bit = [0] * (n + 1)
A = LI()
def a... | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
n = NI()
bit = [0] * (n + 1)
def add(i, x):
... | false | 2.173913 | [
"- A = LI()",
"- for i, a in enumerate(A):",
"+ for i, a in enumerate(LI()):",
"- bit_c = copy.deepcopy(bit)",
"+ b = [bit, copy.copy(bit)]",
"- bit = copy.deepcopy(bit_c)",
"+ bit = b[(s + 1) // 2]"
] | false | 0.061393 | 0.077174 | 0.795507 | [
"s439654186",
"s911235927"
] |
u945345165 | p00033 | python | s894989502 | s769551422 | 30 | 20 | 7,756 | 7,732 | Accepted | Accepted | 33.33 | import sys
def solve(balls):
ans = distribute(balls, [], [])
if ans is True: print('YES')
else: print("NO")
def distribute(balls, R, L):
if len(balls) != 0:
next = balls[0]
ans = False
#case R
if isMutch(next, R):
neoR = R
... | import sys
def solve(balls):
if distribute(balls, [], []): print('YES')
else: print("NO")
def distribute(balls, R, L):
if len(balls) != 0:
next = balls[0]
if isMutch(next, R):
neoR = R
neoR.append(next)
if distribute(balls[1:], neoR... | 52 | 41 | 1,205 | 1,013 | import sys
def solve(balls):
ans = distribute(balls, [], [])
if ans is True:
print("YES")
else:
print("NO")
def distribute(balls, R, L):
if len(balls) != 0:
next = balls[0]
ans = False
# case R
if isMutch(next, R):
neoR = R
neoR... | import sys
def solve(balls):
if distribute(balls, [], []):
print("YES")
else:
print("NO")
def distribute(balls, R, L):
if len(balls) != 0:
next = balls[0]
if isMutch(next, R):
neoR = R
neoR.append(next)
if distribute(balls[1:], neoR, L)... | false | 21.153846 | [
"- ans = distribute(balls, [], [])",
"- if ans is True:",
"+ if distribute(balls, [], []):",
"- ans = False",
"- # case R",
"- ans = distribute(balls[1:], neoR, L)",
"- if ans:",
"- return True",
"+ if distribute(balls[1:], neoR, L):",
... | false | 0.156435 | 0.051577 | 3.033016 | [
"s894989502",
"s769551422"
] |
u745087332 | p04006 | python | s263393859 | s353931119 | 1,302 | 758 | 3,188 | 3,188 | Accepted | Accepted | 41.78 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N, x = inpl()
A = inpl()
min_index = A.index(min(A))
B = A[min_index:] + A[:min_index]
cost = [B[i] for i in range(N)]
ans = INF
for magic in range(N):
for i in range(N):
if i - magic >= 0:
... | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()... | 25 | 42 | 423 | 914 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N, x = inpl()
A = inpl()
min_index = A.index(min(A))
B = A[min_index:] + A[:min_index]
cost = [B[i] for i in range(N)]
ans = INF
for magic in range(N):
for i in range(N):
if i - magic >= 0:
cost[i] = min... | # coding:utf-8
import sys
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline... | false | 40.47619 | [
"+import sys",
"+",
"+MOD = 10**9 + 7",
"-def inpl():",
"- return list(map(int, input().split()))",
"+def LI():",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"-N, x = inpl()",
"-A = inpl()",
"-min_index = A.index(min(A))",
"-B = A[min_index:] + A[:min_index]",
"-cost = [B[... | false | 0.046122 | 0.064231 | 0.718067 | [
"s263393859",
"s353931119"
] |
u305366205 | p03476 | python | s227739020 | s486967062 | 786 | 494 | 67,800 | 18,932 | Accepted | Accepted | 37.15 | import math
def is_prime(n):
if n == 1:
return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
q = int(eval(input()))
scope = [tuple(map(int, input().split())) for _ in range(q)]
prime_cnt = [0] * (10 ** 5 + 1)
for i ... | import math
q = int(eval(input()))
scope = [tuple(map(int, input().split())) for _ in range(q)]
prime_flag = [True] * (10 ** 5 + 1)
prime_flag[0] = False
prime_flag[1] = False
prime_cnt = [0] * (10 ** 5 + 1)
for i in range(2, math.ceil(math.sqrt(10 ** 5))):
for j in range(i + i, 10 ** 5 + 1, i):
... | 26 | 23 | 599 | 646 | import math
def is_prime(n):
if n == 1:
return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
q = int(eval(input()))
scope = [tuple(map(int, input().split())) for _ in range(q)]
prime_cnt = [0] * (10**5 + 1)
for i in range(1, 10**5 + 1... | import math
q = int(eval(input()))
scope = [tuple(map(int, input().split())) for _ in range(q)]
prime_flag = [True] * (10**5 + 1)
prime_flag[0] = False
prime_flag[1] = False
prime_cnt = [0] * (10**5 + 1)
for i in range(2, math.ceil(math.sqrt(10**5))):
for j in range(i + i, 10**5 + 1, i):
prime_flag[j] = Fa... | false | 11.538462 | [
"-",
"-",
"-def is_prime(n):",
"- if n == 1:",
"- return False",
"- for k in range(2, int(math.sqrt(n)) + 1):",
"- if n % k == 0:",
"- return False",
"- return True",
"-",
"+prime_flag = [True] * (10**5 + 1)",
"+prime_flag[0] = False",
"+prime_flag[1] = Fals... | false | 0.713143 | 0.499538 | 1.427604 | [
"s227739020",
"s486967062"
] |
u941753895 | p03107 | python | s062669178 | s818060250 | 829 | 55 | 5,536 | 6,608 | Accepted | Accepted | 93.37 | import queue
q=queue.Queue()
s=list(eval(input()))
c=0
for i in s:
if q.empty():
q.put(i)
else:
a=q.get()
if a!=i:
c+=2
else:
q.put(a)
q.put(i)
print(c) | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
s=S(... | 15 | 16 | 198 | 370 | import queue
q = queue.Queue()
s = list(eval(input()))
c = 0
for i in s:
if q.empty():
q.put(i)
else:
a = q.get()
if a != i:
c += 2
else:
q.put(a)
q.put(i)
print(c)
| import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 6.25 | [
"-import queue",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"-q = queue.Queue()",
"-s = list(eval(input()))",
"-c = 0",
"-for i in s:",
"- if q.empty():",
"- q.put(i)",
"- else:",
"- a = q.get()",
"- if a != ... | false | 0.100072 | 0.036698 | 2.726945 | [
"s062669178",
"s818060250"
] |
u408262366 | p02683 | python | s487068123 | s160174306 | 1,895 | 1,247 | 197,000 | 164,612 | Accepted | Accepted | 34.2 | import numpy as np
from itertools import combinations_with_replacement
N,M,X = list(map(int,input().split()))
CA = []
for i in range(N):
CA.append(list(map(int,input().split())))
OK = True
CA = np.array(CA)
sums = np.sum(CA,axis=0)
for i in range(1,M+1):
if sums[i] < X:
OK = False
break
i... | import numpy as np
from itertools import combinations_with_replacement
N,M,X = list(map(int,input().split()))
CA = []
for i in range(N):
CA.append(list(map(int,input().split())))
OK = True
CA = np.array(CA)
sums = np.sum(CA,axis=0)
for i in range(1,M+1):
if sums[i] < X:
OK = False
break
i... | 43 | 38 | 1,017 | 829 | import numpy as np
from itertools import combinations_with_replacement
N, M, X = list(map(int, input().split()))
CA = []
for i in range(N):
CA.append(list(map(int, input().split())))
OK = True
CA = np.array(CA)
sums = np.sum(CA, axis=0)
for i in range(1, M + 1):
if sums[i] < X:
OK = False
break... | import numpy as np
from itertools import combinations_with_replacement
N, M, X = list(map(int, input().split()))
CA = []
for i in range(N):
CA.append(list(map(int, input().split())))
OK = True
CA = np.array(CA)
sums = np.sum(CA, axis=0)
for i in range(1, M + 1):
if sums[i] < X:
OK = False
break... | false | 11.627907 | [
"- # As = []",
"- # for A in combinations_with_replacement(range(0, N), r=M):",
"- # As.append(tuple(set(A)))",
"- # As = list(map(list, set(As)))",
"+ As = []",
"+ for A in combinations_with_replacement(list(range(0, N)), N):",
"+ As.append(tuple(set(A)))",
"+ As = list(... | false | 0.2743 | 0.246801 | 1.111421 | [
"s487068123",
"s160174306"
] |
u729008627 | p03078 | python | s860519474 | s834445521 | 696 | 118 | 8,708 | 8,708 | Accepted | Accepted | 83.05 | # solution 2
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
L = []
for i in range(X):
for j in range(Y):
for k in range(Z):
... | # solution 2
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
L = []
for i in range(X):
for j in range(Y):
if (i+1)*(j+1) > K:
... | 19 | 21 | 492 | 543 | # solution 2
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
L = []
for i in range(X):
for j in range(Y):
for k in range(Z):
if ... | # solution 2
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
L = []
for i in range(X):
for j in range(Y):
if (i + 1) * (j + 1) > K:
... | false | 9.52381 | [
"+ if (i + 1) * (j + 1) > K:",
"+ break",
"- if (i + 1) * (j + 1) * (k + 1) <= K:",
"+ if (i + 1) * (j + 1) * (k + 1) > K:",
"+ break",
"+ else:",
"- else:",
"- break"
] | false | 0.037485 | 0.037762 | 0.992683 | [
"s860519474",
"s834445521"
] |
u794173881 | p03221 | python | s177789368 | s967962598 | 1,437 | 906 | 103,896 | 85,080 | Accepted | Accepted | 36.95 | from operator import itemgetter
n,m = list(map(int,input().split()))
p = [list(map(int,input().split())) for i in range(m)]
b=[[i] for i in range(m)]
for i in range(m):
p[i].extend(b[i])
p = sorted(sorted(p, key=itemgetter(1)))
old_p=0
for i in range(m):
if p[i][0] != old_p :
old_p = p[i][... | from operator import itemgetter
n, m = list(map(int, input().split()))
info = [list(map(int, input().split())) + [i] for i in range(m)]
info = sorted(info, key=itemgetter(1))
ans = [0] * m
cnt_ind = [1] * (n + 1)
for i in range(m):
p, y, ind = info[i]
cnt = cnt_ind[p]
cnt_ind[p] += 1
a... | 26 | 17 | 522 | 404 | from operator import itemgetter
n, m = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(m)]
b = [[i] for i in range(m)]
for i in range(m):
p[i].extend(b[i])
p = sorted(sorted(p, key=itemgetter(1)))
old_p = 0
for i in range(m):
if p[i][0] != old_p:
old_p = p[i][0]
... | from operator import itemgetter
n, m = list(map(int, input().split()))
info = [list(map(int, input().split())) + [i] for i in range(m)]
info = sorted(info, key=itemgetter(1))
ans = [0] * m
cnt_ind = [1] * (n + 1)
for i in range(m):
p, y, ind = info[i]
cnt = cnt_ind[p]
cnt_ind[p] += 1
ans[ind] = ("00000... | false | 34.615385 | [
"-p = [list(map(int, input().split())) for i in range(m)]",
"-b = [[i] for i in range(m)]",
"+info = [list(map(int, input().split())) + [i] for i in range(m)]",
"+info = sorted(info, key=itemgetter(1))",
"+ans = [0] * m",
"+cnt_ind = [1] * (n + 1)",
"- p[i].extend(b[i])",
"-p = sorted(sorted(p, key... | false | 0.03749 | 0.037729 | 0.993657 | [
"s177789368",
"s967962598"
] |
u340781749 | p03665 | python | s175511801 | s608445096 | 395 | 182 | 24,476 | 14,228 | Accepted | Accepted | 53.92 | from collections import Counter
from scipy.misc import comb
n, p = list(map(int, input().split()))
ac = Counter(int(x) & 1 for x in input().split())
ans = 0
for c in range(p, ac[1] + 1, 2):
ans += comb(ac[1], c, exact=True)
ans <<= ac[0]
print(ans)
| from collections import Counter
from scipy.misc import comb
n, p = list(map(int, input().split()))
ac = Counter(int(x) & 1 for x in input().split())
print((sum(comb(ac[1], c, exact=True) for c in range(p, ac[1] + 1, 2)) << ac[0]))
| 14 | 6 | 265 | 229 | from collections import Counter
from scipy.misc import comb
n, p = list(map(int, input().split()))
ac = Counter(int(x) & 1 for x in input().split())
ans = 0
for c in range(p, ac[1] + 1, 2):
ans += comb(ac[1], c, exact=True)
ans <<= ac[0]
print(ans)
| from collections import Counter
from scipy.misc import comb
n, p = list(map(int, input().split()))
ac = Counter(int(x) & 1 for x in input().split())
print((sum(comb(ac[1], c, exact=True) for c in range(p, ac[1] + 1, 2)) << ac[0]))
| false | 57.142857 | [
"-ans = 0",
"-for c in range(p, ac[1] + 1, 2):",
"- ans += comb(ac[1], c, exact=True)",
"-ans <<= ac[0]",
"-print(ans)",
"+print((sum(comb(ac[1], c, exact=True) for c in range(p, ac[1] + 1, 2)) << ac[0]))"
] | false | 0.198015 | 0.227556 | 0.870181 | [
"s175511801",
"s608445096"
] |
u488127128 | p03607 | python | s166660679 | s483106591 | 95 | 68 | 19,172 | 13,196 | Accepted | Accepted | 28.42 | import sys
n,*A = sys.stdin
B = set()
for a in A:
if int(a) in B:
B.remove(int(a))
else:
B.add(int(a))
print((len(B))) | import sys
n,*A = list(map(int,sys.stdin))
B = set()
for a in A:
if a in B:
B.remove(a)
else:
B.add(a)
print((len(B))) | 9 | 9 | 148 | 142 | import sys
n, *A = sys.stdin
B = set()
for a in A:
if int(a) in B:
B.remove(int(a))
else:
B.add(int(a))
print((len(B)))
| import sys
n, *A = list(map(int, sys.stdin))
B = set()
for a in A:
if a in B:
B.remove(a)
else:
B.add(a)
print((len(B)))
| false | 0 | [
"-n, *A = sys.stdin",
"+n, *A = list(map(int, sys.stdin))",
"- if int(a) in B:",
"- B.remove(int(a))",
"+ if a in B:",
"+ B.remove(a)",
"- B.add(int(a))",
"+ B.add(a)"
] | false | 0.04267 | 0.033601 | 1.269913 | [
"s166660679",
"s483106591"
] |
u923668099 | p02343 | python | s726636909 | s567175891 | 440 | 280 | 10,436 | 11,272 | Accepted | Accepted | 36.36 | import sys
def solve():
n, q = map(int, sys.stdin.readline().split())
uf = UnionFind(n)
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
uf.unite(x, y)
else:
ans.append(1 if uf.is_same(x, y) else 0)
... | import sys
def solve():
n, q = map(int, sys.stdin.readline().split())
ds = [[i] for i in range(n)]
n2s = [i for i in range(n)]
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
merge(ds, n2s, x, y)
else:
... | 57 | 44 | 1,333 | 966 | import sys
def solve():
n, q = map(int, sys.stdin.readline().split())
uf = UnionFind(n)
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
uf.unite(x, y)
else:
ans.append(1 if uf.is_same(x, y) else 0)
print(*ans,... | import sys
def solve():
n, q = map(int, sys.stdin.readline().split())
ds = [[i] for i in range(n)]
n2s = [i for i in range(n)]
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
merge(ds, n2s, x, y)
else:
ans.app... | false | 22.807018 | [
"- uf = UnionFind(n)",
"+ ds = [[i] for i in range(n)]",
"+ n2s = [i for i in range(n)]",
"- uf.unite(x, y)",
"+ merge(ds, n2s, x, y)",
"- ans.append(1 if uf.is_same(x, y) else 0)",
"+ ans.append(1 if n2s[x] == n2s[y] else 0)",
"-class UnionFind:",
... | false | 0.044459 | 0.044621 | 0.996362 | [
"s726636909",
"s567175891"
] |
u794544096 | p02830 | python | s602080963 | s917175243 | 165 | 71 | 38,384 | 61,760 | Accepted | Accepted | 56.97 | n = int(eval(input()))
s, t = input().split()
list = []
for i in range(n):
list.append(s[i])
list.append(t[i])
print((''.join(list))) | n = int(eval(input()))
s, t = input().split()
list = []
for i in range(n):
list += s[i]
list += t[i]
print((''.join(list))) | 10 | 9 | 149 | 137 | n = int(eval(input()))
s, t = input().split()
list = []
for i in range(n):
list.append(s[i])
list.append(t[i])
print(("".join(list)))
| n = int(eval(input()))
s, t = input().split()
list = []
for i in range(n):
list += s[i]
list += t[i]
print(("".join(list)))
| false | 10 | [
"- list.append(s[i])",
"- list.append(t[i])",
"+ list += s[i]",
"+ list += t[i]"
] | false | 0.00709 | 0.04054 | 0.174887 | [
"s602080963",
"s917175243"
] |
u067095357 | p02689 | python | s527178229 | s611147561 | 329 | 283 | 31,888 | 19,992 | Accepted | Accepted | 13.98 | n, m = list(map(int, input().split()))
hs = list(map(int, input().split()))
ans = [1]*n
roads = []
for i in range(m):
roads += [list(map(int, input().split()))]
for road in roads:
if hs[road[0]-1] <= hs[road[1]-1]:
ans[road[0]-1] = 0
if hs[road[0]-1] >= hs[road[1]-1]:
ans[road[1]-... | n, m = list(map(int, input().split()))
hs = list(map(int, input().split()))
ans = [1]*n
for i in range(m):
road = list(map(int, input().split()))
if hs[road[0]-1] <= hs[road[1]-1]:
ans[road[0]-1] = 0
if hs[road[0]-1] >= hs[road[1]-1]:
ans[road[1]-1] = 0
print((ans.count(1)))
| 12 | 10 | 348 | 312 | n, m = list(map(int, input().split()))
hs = list(map(int, input().split()))
ans = [1] * n
roads = []
for i in range(m):
roads += [list(map(int, input().split()))]
for road in roads:
if hs[road[0] - 1] <= hs[road[1] - 1]:
ans[road[0] - 1] = 0
if hs[road[0] - 1] >= hs[road[1] - 1]:
ans[road[1]... | n, m = list(map(int, input().split()))
hs = list(map(int, input().split()))
ans = [1] * n
for i in range(m):
road = list(map(int, input().split()))
if hs[road[0] - 1] <= hs[road[1] - 1]:
ans[road[0] - 1] = 0
if hs[road[0] - 1] >= hs[road[1] - 1]:
ans[road[1] - 1] = 0
print((ans.count(1)))
| false | 16.666667 | [
"-roads = []",
"- roads += [list(map(int, input().split()))]",
"-for road in roads:",
"+ road = list(map(int, input().split()))"
] | false | 0.035999 | 0.036745 | 0.979688 | [
"s527178229",
"s611147561"
] |
u143492911 | p03455 | python | s792408102 | s532959443 | 20 | 17 | 3,316 | 3,064 | Accepted | Accepted | 15 | a,b=list(map(int,input().split()))
v=a*b
print(("Even" if v%2==0 else "Odd"))
| a,b=map(int,input().split())
print("Even") if a*b%2==0 else print("Odd")
| 3 | 2 | 72 | 74 | a, b = list(map(int, input().split()))
v = a * b
print(("Even" if v % 2 == 0 else "Odd"))
| a, b = map(int, input().split())
print("Even") if a * b % 2 == 0 else print("Odd")
| false | 33.333333 | [
"-a, b = list(map(int, input().split()))",
"-v = a * b",
"-print((\"Even\" if v % 2 == 0 else \"Odd\"))",
"+a, b = map(int, input().split())",
"+print(\"Even\") if a * b % 2 == 0 else print(\"Odd\")"
] | false | 0.038436 | 0.038767 | 0.991449 | [
"s792408102",
"s532959443"
] |
u032662562 | p00079 | python | s360108076 | s347269475 | 30 | 20 | 7,668 | 7,400 | Accepted | Accepted | 33.33 | import math
f = []
while True:
try:
st = input().strip().split(',')
x,y = list(map(float,st ))
f.append(x + y*1j)
except EOFError:
break
px = [p.real for p in f]
ox = (max(px) + min(px)) / 2.0
py = [p.imag for p in f]
oy = (max(py) + min(py)) / 2.0
fo = ox + oy... | def cross(x, y):
return (x.conjugate() * y).imag
def area_polygon(points):
area = 0
n = len(points)
for i in range(n):
area += cross(points[i], points[(i+1)%n])
return area / 2
import sys
p = []
for line in sys.stdin:
x, y = list(map(float, line.split(','))... | 31 | 19 | 598 | 376 | import math
f = []
while True:
try:
st = input().strip().split(",")
x, y = list(map(float, st))
f.append(x + y * 1j)
except EOFError:
break
px = [p.real for p in f]
ox = (max(px) + min(px)) / 2.0
py = [p.imag for p in f]
oy = (max(py) + min(py)) / 2.0
fo = ox + oy * 1j
ss = 0.0
... | def cross(x, y):
return (x.conjugate() * y).imag
def area_polygon(points):
area = 0
n = len(points)
for i in range(n):
area += cross(points[i], points[(i + 1) % n])
return area / 2
import sys
p = []
for line in sys.stdin:
x, y = list(map(float, line.split(",")))
p.append(complex... | false | 38.709677 | [
"-import math",
"+def cross(x, y):",
"+ return (x.conjugate() * y).imag",
"-f = []",
"-while True:",
"- try:",
"- st = input().strip().split(\",\")",
"- x, y = list(map(float, st))",
"- f.append(x + y * 1j)",
"- except EOFError:",
"- break",
"-px = [p.real ... | false | 0.063893 | 0.043566 | 1.466584 | [
"s360108076",
"s347269475"
] |
u498487134 | p02838 | python | s250604251 | s049802616 | 647 | 386 | 122,808 | 118,728 | Accepted | Accepted | 40.34 | N = int(eval(input()))
A = list(map(int, input().split()))
#Aiを二進数として,各けたを見れば良い?1の個数*0の個数
ans =0
mod =pow(10,9)+7
#Aiは最大で2^60-1
Max = 61
#i桁目を見る
for i in range(Max):
count = 0#その桁での1の数
for j in range(N):
if(A[j]>>i & 1)==1:
count+=1
ans+=count*(N-count)*pow(2,i)
... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
M=65
A=LI()
cnt=[0]*M
for i in range(N):
a=A[i]
for j in... | 20 | 30 | 341 | 554 | N = int(eval(input()))
A = list(map(int, input().split()))
# Aiを二進数として,各けたを見れば良い?1の個数*0の個数
ans = 0
mod = pow(10, 9) + 7
# Aiは最大で2^60-1
Max = 61
# i桁目を見る
for i in range(Max):
count = 0 # その桁での1の数
for j in range(N):
if (A[j] >> i & 1) == 1:
count += 1
ans += count * (N - count) * pow(2, i... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
M = 65
A = LI()
cnt = [0] * M
for i in range(N):
a = A[i]
... | false | 33.333333 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-# Aiを二進数として,各けたを見れば良い?1の個数*0の個数",
"-ans = 0",
"-mod = pow(10, 9) + 7",
"-# Aiは最大で2^60-1",
"-Max = 61",
"-# i桁目を見る",
"-for i in range(Max):",
"- count = 0 # その桁での1の数",
"- for j in range(N):",
"- if (A[j] >> i & 1... | false | 0.035987 | 0.04205 | 0.855817 | [
"s250604251",
"s049802616"
] |
u201928947 | p02573 | python | s253480961 | s200687321 | 425 | 270 | 87,916 | 87,084 | Accepted | Accepted | 36.47 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 55 | 58 | 1,394 | 1,444 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 5.172414 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline"
] | false | 0.044306 | 0.04019 | 1.10241 | [
"s253480961",
"s200687321"
] |
u790710233 | p03361 | python | s314975433 | s735341028 | 21 | 19 | 3,064 | 3,064 | Accepted | Accepted | 9.52 | h, w = list(map(int, input().split()))
m = [list(eval(input())) for _ in range(h)]
for i in range(h):
for j in range(w):
if m[i][j] == '#':
cnt = sum([0 <= i-1, i+1 < h, 0 <= j-1, j+1 < w])
# up
if 0 <= i-1:
if m[i-1][j] != '#':
... | h, w = list(map(int, input().split()))
m = [['.']*(w+2)]
for _ in range(h):
m.append(list('.' + eval(input()) + '.'))
m.append(['.']*(w+2))
for i in range(1, h+1):
for j in range(1, w+1):
if m[i][j] == '#':
if all(m[i+x][j+y] == '.' for x, y in [(-1, 0), (1, 0), (0, -1), (0, 1)]):
... | 32 | 14 | 775 | 386 | h, w = list(map(int, input().split()))
m = [list(eval(input())) for _ in range(h)]
for i in range(h):
for j in range(w):
if m[i][j] == "#":
cnt = sum([0 <= i - 1, i + 1 < h, 0 <= j - 1, j + 1 < w])
# up
if 0 <= i - 1:
if m[i - 1][j] != "#":
... | h, w = list(map(int, input().split()))
m = [["."] * (w + 2)]
for _ in range(h):
m.append(list("." + eval(input()) + "."))
m.append(["."] * (w + 2))
for i in range(1, h + 1):
for j in range(1, w + 1):
if m[i][j] == "#":
if all(
m[i + x][j + y] == "." for x, y in [(-1, 0), (1, ... | false | 56.25 | [
"-m = [list(eval(input())) for _ in range(h)]",
"-for i in range(h):",
"- for j in range(w):",
"+m = [[\".\"] * (w + 2)]",
"+for _ in range(h):",
"+ m.append(list(\".\" + eval(input()) + \".\"))",
"+m.append([\".\"] * (w + 2))",
"+for i in range(1, h + 1):",
"+ for j in range(1, w + 1):",
... | false | 0.040123 | 0.045299 | 0.885733 | [
"s314975433",
"s735341028"
] |
u909643606 | p03074 | python | s906554206 | s873093536 | 199 | 53 | 45,676 | 4,396 | Accepted | Accepted | 73.37 | import sys
input = sys.stdin.readline
def main():
n, k = [int(i) for i in input().split()]
s = eval(input()) + "3"
s0 = []
s1 = []
cnt = 0
start = 1
for i in range(n+1):
if start == 1 and s[i] != "1":
s1.append(cnt)
cnt = 1
start = 0... | def main():
n, k = [int(i) for i in input().split()]
s = eval(input()) + "3"
s0 = []
s1 = []
cnt = 0
start = 1
for i in range(n+1):
if start == 1 and s[i] != "1":
s1.append(cnt)
cnt = 1
start = 0
elif start == 0 and s[i] != "0":... | 44 | 30 | 1,006 | 699 | import sys
input = sys.stdin.readline
def main():
n, k = [int(i) for i in input().split()]
s = eval(input()) + "3"
s0 = []
s1 = []
cnt = 0
start = 1
for i in range(n + 1):
if start == 1 and s[i] != "1":
s1.append(cnt)
cnt = 1
start = 0
e... | def main():
n, k = [int(i) for i in input().split()]
s = eval(input()) + "3"
s0 = []
s1 = []
cnt = 0
start = 1
for i in range(n + 1):
if start == 1 and s[i] != "1":
s1.append(cnt)
cnt = 1
start = 0
elif start == 0 and s[i] != "0":
... | false | 31.818182 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"- # ans = max(s1)",
"- # for i in range(n // 2 +1):",
"- # ans = max(ans, sum(s1[i:i+k+1]) + sum(s0[i:i+k]))",
"+ if len(s0) == len(s1):",
"+ s1.append(0)",
"- for i in range(n):",
"- try:",
"- ... | false | 0.080365 | 0.057029 | 1.409191 | [
"s906554206",
"s873093536"
] |
u282228874 | p03087 | python | s328235333 | s516509398 | 1,058 | 859 | 55,512 | 8,072 | Accepted | Accepted | 18.81 | n,q = list(map(int,input().split()))
S = eval(input())
s = [0]*(n+1)
for i in range(1,n):
if S[i-1] == 'A' and S[i] == 'C':
s[i] = 1
for i in range(1,n):
s[i] += s[i-1]
for i in range(q):
l,r = [int(j)-1 for j in input().split()]
print((s[r]-s[l])) | n,q = list(map(int,input().split()))
S = eval(input())
b = [0]*(n+1)
for i in range(n-1):
if S[i] == 'A' and S[i+1] == 'C':
b[i+1] += 1
from itertools import accumulate
b = list(accumulate(b))
#print(b)
for i in range(q):
l,r = list(map(int,input().split()))
print((b[r-1]-b[l-1])) | 11 | 12 | 252 | 291 | n, q = list(map(int, input().split()))
S = eval(input())
s = [0] * (n + 1)
for i in range(1, n):
if S[i - 1] == "A" and S[i] == "C":
s[i] = 1
for i in range(1, n):
s[i] += s[i - 1]
for i in range(q):
l, r = [int(j) - 1 for j in input().split()]
print((s[r] - s[l]))
| n, q = list(map(int, input().split()))
S = eval(input())
b = [0] * (n + 1)
for i in range(n - 1):
if S[i] == "A" and S[i + 1] == "C":
b[i + 1] += 1
from itertools import accumulate
b = list(accumulate(b))
# print(b)
for i in range(q):
l, r = list(map(int, input().split()))
print((b[r - 1] - b[l - 1... | false | 8.333333 | [
"-s = [0] * (n + 1)",
"-for i in range(1, n):",
"- if S[i - 1] == \"A\" and S[i] == \"C\":",
"- s[i] = 1",
"-for i in range(1, n):",
"- s[i] += s[i - 1]",
"+b = [0] * (n + 1)",
"+for i in range(n - 1):",
"+ if S[i] == \"A\" and S[i + 1] == \"C\":",
"+ b[i + 1] += 1",
"+fro... | false | 0.043725 | 0.083671 | 0.522591 | [
"s328235333",
"s516509398"
] |
u112364985 | p03073 | python | s690539223 | s891813378 | 63 | 53 | 10,496 | 9,696 | Accepted | Accepted | 15.87 | s=list(eval(input()))
s=[int(s[i]) for i in range(len(s))]
tile=s[0]
cnt=0
for i in range(1,len(s)):
if s[i]==tile:
cnt+=1
if tile==1:
tile=0
else:
tile=1
print(cnt) | s=list(eval(input()))
a=["0","1"]
cnt=0
for i in range(len(s)):
if s[i]!=a[i%2]:
cnt+=1
print((min(cnt,len(s)-cnt))) | 12 | 7 | 206 | 126 | s = list(eval(input()))
s = [int(s[i]) for i in range(len(s))]
tile = s[0]
cnt = 0
for i in range(1, len(s)):
if s[i] == tile:
cnt += 1
if tile == 1:
tile = 0
else:
tile = 1
print(cnt)
| s = list(eval(input()))
a = ["0", "1"]
cnt = 0
for i in range(len(s)):
if s[i] != a[i % 2]:
cnt += 1
print((min(cnt, len(s) - cnt)))
| false | 41.666667 | [
"-s = [int(s[i]) for i in range(len(s))]",
"-tile = s[0]",
"+a = [\"0\", \"1\"]",
"-for i in range(1, len(s)):",
"- if s[i] == tile:",
"+for i in range(len(s)):",
"+ if s[i] != a[i % 2]:",
"- if tile == 1:",
"- tile = 0",
"- else:",
"- tile = 1",
"-print(cnt)",
"+pr... | false | 0.038395 | 0.045027 | 0.852708 | [
"s690539223",
"s891813378"
] |
u968166680 | p02913 | python | s048065493 | s725097712 | 751 | 464 | 270,220 | 270,088 | Accepted | Accepted | 38.22 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N - 1, -1, -1):... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N - 1, -1, -1):... | 32 | 32 | 669 | 675 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N - 1, -1, -1):
for j in ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N - 1, -1, -1):
for j in ... | false | 0 | [
"- for j in range(N - 1, -1, -1):",
"+ for j in range(N - 1, i, -1):",
"- for j in range(N):",
"+ for j in range(i + 1, N):"
] | false | 0.054232 | 0.034365 | 1.578102 | [
"s048065493",
"s725097712"
] |
u150984829 | p02264 | python | s740116948 | s870687982 | 250 | 200 | 18,124 | 16,940 | Accepted | Accepted | 20 | import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
d=deque(list(e.split())for e in s[1:])
t=0
while d:
k,v=d.popleft();v=int(v)
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;print((k,t))
| import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
f=lambda x,y:(x,int(y))
d=deque(f(*e.split())for e in s[1:])
t,a=0,[]
while d:
k,v=d.popleft()
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;a+=[f'{k} {t}']
print(*a,sep='\n')
| 10 | 12 | 231 | 275 | import sys
from collections import deque
s = sys.stdin.readlines()
q = int(s[0].split()[1])
d = deque(list(e.split()) for e in s[1:])
t = 0
while d:
k, v = d.popleft()
v = int(v)
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
print((k, t))
| import sys
from collections import deque
s = sys.stdin.readlines()
q = int(s[0].split()[1])
f = lambda x, y: (x, int(y))
d = deque(f(*e.split()) for e in s[1:])
t, a = 0, []
while d:
k, v = d.popleft()
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
a += [f"{k}... | false | 16.666667 | [
"-d = deque(list(e.split()) for e in s[1:])",
"-t = 0",
"+f = lambda x, y: (x, int(y))",
"+d = deque(f(*e.split()) for e in s[1:])",
"+t, a = 0, []",
"- v = int(v)",
"- print((k, t))",
"+ a += [f\"{k} {t}\"]",
"+print(*a, sep=\"\\n\")"
] | false | 0.03734 | 0.036971 | 1.009986 | [
"s740116948",
"s870687982"
] |
u562016607 | p03293 | python | s598902838 | s748252965 | 169 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.35 | S=eval(input())
T=eval(input())
N=len(S)
for i in range(N):
U=T[i:]+T[:i]
if S==U:
print("Yes")
exit()
print("No")
| # coding: utf-8
S = eval(input())
T = eval(input())
for i in range(100):
Scheck=S[i+1:]+S[0:i+1]
if(Scheck==T):
print("Yes")
exit()
print("No")
| 9 | 9 | 123 | 164 | S = eval(input())
T = eval(input())
N = len(S)
for i in range(N):
U = T[i:] + T[:i]
if S == U:
print("Yes")
exit()
print("No")
| # coding: utf-8
S = eval(input())
T = eval(input())
for i in range(100):
Scheck = S[i + 1 :] + S[0 : i + 1]
if Scheck == T:
print("Yes")
exit()
print("No")
| false | 0 | [
"+# coding: utf-8",
"-N = len(S)",
"-for i in range(N):",
"- U = T[i:] + T[:i]",
"- if S == U:",
"+for i in range(100):",
"+ Scheck = S[i + 1 :] + S[0 : i + 1]",
"+ if Scheck == T:"
] | false | 0.099242 | 0.031991 | 3.102178 | [
"s598902838",
"s748252965"
] |
u073852194 | p02815 | python | s975666214 | s294324966 | 991 | 689 | 26,800 | 26,800 | Accepted | Accepted | 30.47 | MOD = 1000000007
N = int(eval(input()))
C = list(map(int,input().split()))
C.sort(reverse=True)
ans = 0
if N > 1:
for i in range(N):
ans += C[i]*(2+i)*pow(2,N-2,MOD)*pow(2,N,MOD)
ans %= MOD
else:
ans = 2*C[0]%MOD
print(ans) | MOD = 1000000007
N = int(eval(input()))
C = list(map(int,input().split()))
C.sort(reverse=True)
ans = 0
for i in range(N):
ans += C[i]*(2+i)*pow(4,N-1,MOD)
ans %= MOD
print(ans) | 17 | 14 | 262 | 197 | MOD = 1000000007
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort(reverse=True)
ans = 0
if N > 1:
for i in range(N):
ans += C[i] * (2 + i) * pow(2, N - 2, MOD) * pow(2, N, MOD)
ans %= MOD
else:
ans = 2 * C[0] % MOD
print(ans)
| MOD = 1000000007
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort(reverse=True)
ans = 0
for i in range(N):
ans += C[i] * (2 + i) * pow(4, N - 1, MOD)
ans %= MOD
print(ans)
| false | 17.647059 | [
"-if N > 1:",
"- for i in range(N):",
"- ans += C[i] * (2 + i) * pow(2, N - 2, MOD) * pow(2, N, MOD)",
"- ans %= MOD",
"-else:",
"- ans = 2 * C[0] % MOD",
"+for i in range(N):",
"+ ans += C[i] * (2 + i) * pow(4, N - 1, MOD)",
"+ ans %= MOD"
] | false | 0.164721 | 0.034264 | 4.807354 | [
"s975666214",
"s294324966"
] |
u380524497 | p03013 | python | s364792419 | s240061172 | 469 | 66 | 460,020 | 11,884 | Accepted | Accepted | 85.93 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
broken = set()
for i in range(m):
a = int(eval(input()))
broken.add(a)
pattern = [0]*(n+1)
pattern[0] = 1
if 1 in broken:
pattern[1] = 0
else:
pattern[1] = 1
for i in range(2, n+1):
if i in broken:
... | import sys
input = sys.stdin.readline
mod = 10**9+7
n, m = list(map(int, input().split()))
broken = set(int(eval(input())) for i in range(m))
pattern = [0]*(n+1)
pattern[0] = 1
if 1 in broken:
pattern[1] = 0
else:
pattern[1] = 1
for i in range(2, n+1):
if i in broken:
continue
... | 25 | 21 | 425 | 395 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
broken = set()
for i in range(m):
a = int(eval(input()))
broken.add(a)
pattern = [0] * (n + 1)
pattern[0] = 1
if 1 in broken:
pattern[1] = 0
else:
pattern[1] = 1
for i in range(2, n + 1):
if i in broken:
pattern[i]... | import sys
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().split()))
broken = set(int(eval(input())) for i in range(m))
pattern = [0] * (n + 1)
pattern[0] = 1
if 1 in broken:
pattern[1] = 0
else:
pattern[1] = 1
for i in range(2, n + 1):
if i in broken:
continue
else:
... | false | 16 | [
"+mod = 10**9 + 7",
"-broken = set()",
"-for i in range(m):",
"- a = int(eval(input()))",
"- broken.add(a)",
"+broken = set(int(eval(input())) for i in range(m))",
"- pattern[i] = 0",
"+ continue",
"- pattern[i] = pattern[i - 1] + pattern[i - 2]",
"-print((pattern[n] % (... | false | 0.036008 | 0.034493 | 1.043922 | [
"s364792419",
"s240061172"
] |
u776402923 | p02275 | python | s804670011 | s676238156 | 2,270 | 1,980 | 241,480 | 241,484 | Accepted | Accepted | 12.78 | def CountingSort(A, k):
C = [0] * (k+1)
n = len(A)
for a in A:
C[a] = C[a] + 1
for i in range(1, k+1):
C[i] = C[i] + C[i-1]
B = [0] * n
for j in range(n-1, -1, -1):
rank = C[ A[j] ]
B[ rank - 1] = A[j]
C[ A[j] ] = C[ A[j] ] - 1
... | def CountingSort(A, k):
C = [0] * (k+1)
n = len(A)
for a in A:
C[a] = C[a] + 1
for i in range(1, k+1):
C[i] = C[i] + C[i-1]
B = [0] * n
for a in A:
rank = C[a]
B[rank - 1] = a
C[a] = C[a] - 1
return B
n = int(eval(input())... | 28 | 28 | 483 | 447 | def CountingSort(A, k):
C = [0] * (k + 1)
n = len(A)
for a in A:
C[a] = C[a] + 1
for i in range(1, k + 1):
C[i] = C[i] + C[i - 1]
B = [0] * n
for j in range(n - 1, -1, -1):
rank = C[A[j]]
B[rank - 1] = A[j]
C[A[j]] = C[A[j]] - 1
return B
n = int(eval... | def CountingSort(A, k):
C = [0] * (k + 1)
n = len(A)
for a in A:
C[a] = C[a] + 1
for i in range(1, k + 1):
C[i] = C[i] + C[i - 1]
B = [0] * n
for a in A:
rank = C[a]
B[rank - 1] = a
C[a] = C[a] - 1
return B
n = int(eval(input()))
A = [int(i) for i in... | false | 0 | [
"- for j in range(n - 1, -1, -1):",
"- rank = C[A[j]]",
"- B[rank - 1] = A[j]",
"- C[A[j]] = C[A[j]] - 1",
"+ for a in A:",
"+ rank = C[a]",
"+ B[rank - 1] = a",
"+ C[a] = C[a] - 1"
] | false | 0.045347 | 0.043618 | 1.039625 | [
"s804670011",
"s676238156"
] |
u223646582 | p03330 | python | s838019242 | s541506036 | 593 | 188 | 45,148 | 71,308 | Accepted | Accepted | 68.3 | from collections import defaultdict
N, C = list(map(int, input().split()))
D = [tuple(map(int, input().split())) for _ in range(C)]
d = [defaultdict(int) for i in range(3)]
for i in range(N):
c = [int(x) for x in input().split()]
for j in range(N):
for k in range(C):
d[(i+j) ... | from collections import defaultdict
N, C = list(map(int, input().split()))
D = [[int(i) for i in input().split()] for _ in range(C)]
color = [[int(i) for i in input().split()] for _ in range(N)]
M = [defaultdict(int) for _ in range(3)]
for i in range(N):
for j in range(N):
M[(i+j) % 3][color[i][j]]... | 23 | 22 | 554 | 695 | from collections import defaultdict
N, C = list(map(int, input().split()))
D = [tuple(map(int, input().split())) for _ in range(C)]
d = [defaultdict(int) for i in range(3)]
for i in range(N):
c = [int(x) for x in input().split()]
for j in range(N):
for k in range(C):
d[(i + j) % 3][k] += D[... | from collections import defaultdict
N, C = list(map(int, input().split()))
D = [[int(i) for i in input().split()] for _ in range(C)]
color = [[int(i) for i in input().split()] for _ in range(N)]
M = [defaultdict(int) for _ in range(3)]
for i in range(N):
for j in range(N):
M[(i + j) % 3][color[i][j]] += 1
... | false | 4.347826 | [
"-D = [tuple(map(int, input().split())) for _ in range(C)]",
"-d = [defaultdict(int) for i in range(3)]",
"+D = [[int(i) for i in input().split()] for _ in range(C)]",
"+color = [[int(i) for i in input().split()] for _ in range(N)]",
"+M = [defaultdict(int) for _ in range(3)]",
"- c = [int(x) for x in ... | false | 0.063368 | 0.061876 | 1.024121 | [
"s838019242",
"s541506036"
] |
u479462609 | p02830 | python | s661209948 | s053212878 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | N=int(eval(input()))
S,T=(x for x in input().split())
alist=[]
for i in range(N):
alist.append(S[i])
alist.append(T[i])
o="".join(alist)
print(o) | N=int(eval(input()))
S,T=input().split()
l=[]
for i in range(N):
l.append(S[i])
l.append(T[i])
o="".join(l)
print(o) | 10 | 8 | 154 | 121 | N = int(eval(input()))
S, T = (x for x in input().split())
alist = []
for i in range(N):
alist.append(S[i])
alist.append(T[i])
o = "".join(alist)
print(o)
| N = int(eval(input()))
S, T = input().split()
l = []
for i in range(N):
l.append(S[i])
l.append(T[i])
o = "".join(l)
print(o)
| false | 20 | [
"-S, T = (x for x in input().split())",
"-alist = []",
"+S, T = input().split()",
"+l = []",
"- alist.append(S[i])",
"- alist.append(T[i])",
"-o = \"\".join(alist)",
"+ l.append(S[i])",
"+ l.append(T[i])",
"+o = \"\".join(l)"
] | false | 0.043715 | 0.041751 | 1.047053 | [
"s661209948",
"s053212878"
] |
u141610915 | p02850 | python | s240055817 | s058653952 | 1,242 | 900 | 137,692 | 118,180 | Accepted | Accepted | 27.54 | import sys
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for i in range(N - 1):
a, b = tuple(map(int, input().split()))
e[a].append((b, i))
e[b].append((a, i))
res = [0] * (N - 1)
vis = set()
def dfs(x):
globa... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(eval(input()))
e = dd(list)
for i in range(N - 1):
u, v = list(map(int, input().split()))
e[u].append((v, i))
e[v].append((u, i))
res = [0] * (N - 1)
def dfs(x):
global res
c = 1... | 37 | 27 | 719 | 567 | import sys
sys.setrecursionlimit(10**7)
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for i in range(N - 1):
a, b = tuple(map(int, input().split()))
e[a].append((b, i))
e[b].append((a, i))
res = [0] * (N - 1)
vis = set()
def dfs(x):
global v... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(eval(input()))
e = dd(list)
for i in range(N - 1):
u, v = list(map(int, input().split()))
e[u].append((v, i))
e[v].append((u, i))
res = [0] * (N - 1)
def dfs(x):
global res
c = 1
... | false | 27.027027 | [
"-",
"-sys.setrecursionlimit(10**7)",
"+sys.setrecursionlimit(10**6)",
"- a, b = tuple(map(int, input().split()))",
"- e[a].append((b, i))",
"- e[b].append((a, i))",
"+ u, v = list(map(int, input().split()))",
"+ e[u].append((v, i))",
"+ e[v].append((u, i))",
"-vis = set()",
"-... | false | 0.059972 | 0.042403 | 1.414331 | [
"s240055817",
"s058653952"
] |
u552738814 | p03805 | python | s267776912 | s907660069 | 39 | 30 | 9,208 | 9,216 | Accepted | Accepted | 23.08 | N,M = [int(a) for a in input().split()]
#iから進める場所をリストにして保管
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
a,b = [int(a) for a in input().split()]
edges[a].append(b)
edges[b].append(a)
#深さ優先探索
def dfs(list):
#lst(通過点)の数がN(頂点数)と等しくなったら探索終了(成功)
if len(list) == N:
return 1
els... | N,M = list(map(int,input().split()))
#iから進める場所をリストにして保管
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
a,b = [int(a) for a in input().split()]
edges[a].append(b)
edges[b].append(a)
#深さ優先探索
def dfs(list):
#lst(通過点)の数がN(頂点数)と等しくなったら探索終了(成功)
if len(list) == N:
return 1
else:
... | 36 | 36 | 667 | 658 | N, M = [int(a) for a in input().split()]
# iから進める場所をリストにして保管
edges = {i: [] for i in range(1, N + 1)}
for i in range(M):
a, b = [int(a) for a in input().split()]
edges[a].append(b)
edges[b].append(a)
# 深さ優先探索
def dfs(list):
# lst(通過点)の数がN(頂点数)と等しくなったら探索終了(成功)
if len(list) == N:
return 1
... | N, M = list(map(int, input().split()))
# iから進める場所をリストにして保管
edges = {i: [] for i in range(1, N + 1)}
for i in range(M):
a, b = [int(a) for a in input().split()]
edges[a].append(b)
edges[b].append(a)
# 深さ優先探索
def dfs(list):
# lst(通過点)の数がN(頂点数)と等しくなったら探索終了(成功)
if len(list) == N:
return 1
el... | false | 0 | [
"-N, M = [int(a) for a in input().split()]",
"+N, M = list(map(int, input().split()))"
] | false | 0.068808 | 0.038581 | 1.783453 | [
"s267776912",
"s907660069"
] |
u788068140 | p03634 | python | s618228722 | s931994573 | 1,062 | 814 | 108,660 | 197,376 | Accepted | Accepted | 23.35 | from collections import deque
#
# N = 5
# ARR = [
# [1, 2, 1],
# [1, 3, 1],
# [2, 4, 1],
# [3, 5, 1]
# ]
#
# Q, K = 3, 1
#
# BRR = [
# [2, 4],
# [2, 3],
# [4, 5],
# ]
#
#
# N = 7
# ARR = [
# [1, 2, 1],
# [1, 3, 3],
# [1, 4, 5],
# [1, 5, 7],
# [1, ... | import sys
sys.setrecursionlimit(20000000)
# N = 5
# ARR = [
# [1, 2, 1],
# [1, 3, 1],
# [2, 4, 1],
# [3, 5, 1]
# ]
#
# Q, K = 3, 1
#
# BRR = [
# [2, 4],
# [2, 3],
# [4, 5],
# ]
#
#
N = int(eval(input()))
ARR = [list(map(int,input().split())) for i in range(N-1)]
Q... | 129 | 66 | 2,715 | 1,233 | from collections import deque
#
# N = 5
# ARR = [
# [1, 2, 1],
# [1, 3, 1],
# [2, 4, 1],
# [3, 5, 1]
# ]
#
# Q, K = 3, 1
#
# BRR = [
# [2, 4],
# [2, 3],
# [4, 5],
# ]
#
#
# N = 7
# ARR = [
# [1, 2, 1],
# [1, 3, 3],
# [1, 4, 5],
# [1, 5, 7],
# [1, 6, 9],
# [1, 7, 11],... | import sys
sys.setrecursionlimit(20000000)
# N = 5
# ARR = [
# [1, 2, 1],
# [1, 3, 1],
# [2, 4, 1],
# [3, 5, 1]
# ]
#
# Q, K = 3, 1
#
# BRR = [
# [2, 4],
# [2, 3],
# [4, 5],
# ]
#
#
N = int(eval(input()))
ARR = [list(map(int, input().split())) for i in range(N - 1)]
Q, K = list(map(int, inp... | false | 48.837209 | [
"-from collections import deque",
"+import sys",
"-#",
"+sys.setrecursionlimit(20000000)",
"-# N = 7",
"-# ARR = [",
"-# [1, 2, 1],",
"-# [1, 3, 3],",
"-# [1, 4, 5],",
"-# [1, 5, 7],",
"-# [1, 6, 9],",
"-# [1, 7, 11],",
"-# ]",
"-#",
"-# Q, K = 3, 2",
"-#",
"-... | false | 0.043254 | 0.036881 | 1.1728 | [
"s618228722",
"s931994573"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.