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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u847467233 | p02441 | python | s176442444 | s482967581 | 50 | 20 | 5,636 | 5,632 | Accepted | Accepted | 60 | # AOJ ITP2_3_C: Count
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
for i in range(q):
b, e, k = list(map(int, input().split()))
s = a[b:e]
print((s.count(k)))
| # AOJ ITP2_3_C: Count
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
for i in range(q):
b, e, k = list(map(int, input().split()))
print((a[b:e].count(k)))
| 10 | 9 | 215 | 207 | # AOJ ITP2_3_C: Count
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
for i in range(q):
b, e, k = list(map(int, input().split()))
s = a[b:e]
print((s.count(k)))
| # AOJ ITP2_3_C: Count
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
for i in range(q):
b, e, k = list(map(int, input().split()))
print((a[b:e].count(k)))
| false | 10 | [
"- s = a[b:e]",
"- print((s.count(k)))",
"+ print((a[b:e].count(k)))"
] | false | 0.044942 | 0.085396 | 0.526278 | [
"s176442444",
"s482967581"
] |
u614314290 | p02948 | python | s966874767 | s313266083 | 579 | 454 | 32,748 | 27,656 | Accepted | Accepted | 21.59 | import math, heapq
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = float("inf")
MOD = int(1e9 + 7)
# ヒープ
class heapque:
def __init__(self, *args):
self.que = []
for arg in args:
self.push(arg)
def push(self, v):
heapq.he... | import math, heapq
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = float("inf")
MOD = int(1e9 + 7)
# ヒープ
class heapque:
def __init__(self, *args):
self.que = []
for arg in args:
self.push(arg)
def push(self, v):
heapq.he... | 101 | 100 | 2,857 | 2,802 | import math, heapq
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = float("inf")
MOD = int(1e9 + 7)
# ヒープ
class heapque:
def __init__(self, *args):
self.que = []
for arg in args:
self.push(arg)
def push(self, v):
heapq.heappush(self... | import math, heapq
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = float("inf")
MOD = int(1e9 + 7)
# ヒープ
class heapque:
def __init__(self, *args):
self.que = []
for arg in args:
self.push(arg)
def push(self, v):
heapq.heappush(self... | false | 0.990099 | [
"- AB = [list(map(int, input().split())) for _ in range(N)]",
"- ab = sorted(AB)",
"+ ab = dd(list)",
"+ for _ in range(N):",
"+ a, b = list(map(int, input().split()))",
"+ ab[a].append(b)",
"- v, i = 0, 0",
"+ v = 0",
"- while i < N:",
"- if ab[i]... | false | 0.045674 | 0.06252 | 0.730549 | [
"s966874767",
"s313266083"
] |
u320567105 | p03112 | python | s696873180 | s275639128 | 1,816 | 1,033 | 113,724 | 17,780 | Accepted | Accepted | 43.12 | A,B,Q=list(map(int,input().split()))
s=[0]*(A+2)
t=[0]*(B+2)
X=[0]*Q
s[0] = -float('inf')
s[A+1] = float('inf')
t[0] = -float('inf')
t[B+1] = float('inf')
for i in range(1,A+1):
s[i] = int(eval(input()))
for i in range(1,B+1):
t[i] = int(eval(input()))
for i in range(Q):
X[i] = int(eval(input()... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
A,B,Q=rl()
s=[0]*(A+2)
t=[0]*(B+2)
X=[0]*Q
for i in range(1,A+1):
s[i]=ri()
s[0],s[A+1]=-float('inf'),float('inf')
s.sort()
for i in range(1,B+1):
t[i]=ri()
t[0],t[B+1]=-float('inf'),float('inf')
t.sort()
for i in range(... | 29 | 30 | 609 | 637 | A, B, Q = list(map(int, input().split()))
s = [0] * (A + 2)
t = [0] * (B + 2)
X = [0] * Q
s[0] = -float("inf")
s[A + 1] = float("inf")
t[0] = -float("inf")
t[B + 1] = float("inf")
for i in range(1, A + 1):
s[i] = int(eval(input()))
for i in range(1, B + 1):
t[i] = int(eval(input()))
for i in range(Q):
X[i] ... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
A, B, Q = rl()
s = [0] * (A + 2)
t = [0] * (B + 2)
X = [0] * Q
for i in range(1, A + 1):
s[i] = ri()
s[0], s[A + 1] = -float("inf"), float("inf")
s.sort()
for i in range(1, B + 1):
t[i] = ri()
t[0], t[B + 1] = -float("inf"), float("inf... | false | 3.333333 | [
"-A, B, Q = list(map(int, input().split()))",
"+ri = lambda: int(eval(input()))",
"+rl = lambda: list(map(int, input().split()))",
"+A, B, Q = rl()",
"-s[0] = -float(\"inf\")",
"-s[A + 1] = float(\"inf\")",
"-t[0] = -float(\"inf\")",
"-t[B + 1] = float(\"inf\")",
"- s[i] = int(eval(input()))",
... | false | 0.035351 | 0.035728 | 0.989452 | [
"s696873180",
"s275639128"
] |
u498487134 | p02839 | python | s073388376 | s098314781 | 260 | 133 | 58,076 | 89,864 | Accepted | Accepted | 48.85 | import sys
input = sys.stdin.readline
H,W = list(map(int,input().split()))
#差分だけで良い,これを*1 or -1していく
diff = [list(map(int, input().split())) for _ in range(H)]
for i in range(H):
B = list(map(int,input().split()))
for j in range(W):
diff[i][j] = abs(diff[i][j] - B[j])
# i,jマスにおいて,... | 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()))
"""
面倒なので差分を考えておく,
この差分を+ or - のどちらで使うかの2択,
合計値を0に近づけたい,
各マスごとに取れる範囲をsetで持ちながら,とやりたいが取れる範囲が多そうな気もする.
絶対値が6400を超える分は持つ必要ないな,ギリ行けるかも?... | 34 | 78 | 828 | 1,621 | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
# 差分だけで良い,これを*1 or -1していく
diff = [list(map(int, input().split())) for _ in range(H)]
for i in range(H):
B = list(map(int, input().split()))
for j in range(W):
diff[i][j] = abs(diff[i][j] - B[j])
# i,jマスにおいて,偏りがkになれるかどうかでDP
# d... | 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()))
"""
面倒なので差分を考えておく,
この差分を+ or - のどちらで使うかの2択,
合計値を0に近づけたい,
各マスごとに取れる範囲をsetで持ちながら,とやりたいが取れる範囲が多そうな気もする.
絶対値が6400を超える分は持つ必要ないな,ギリ行ける... | false | 56.410256 | [
"-H, W = list(map(int, input().split()))",
"-# 差分だけで良い,これを*1 or -1していく",
"-diff = [list(map(int, input().split())) for _ in range(H)]",
"-for i in range(H):",
"- B = list(map(int, input().split()))",
"- for j in range(W):",
"- diff[i][j] = abs(diff[i][j] - B[j])",
"-# i,jマスにおいて,偏りがkになれるかど... | false | 0.040724 | 0.034691 | 1.173905 | [
"s073388376",
"s098314781"
] |
u444069166 | p02912 | python | s462114288 | s576185667 | 1,483 | 392 | 128,984 | 78,316 | Accepted | Accepted | 73.57 | #!/usr/bin/python3
from fractions import Fraction
import heapq
import math
import sys
DEBUG = False
def inp():
return sys.stdin.readline().rstrip()
def dprint(*value, sep=' ', end='\n'):
if DEBUG:
print(*value, sep=sep, end=end)
def solve(N, M, A):
hq = [-a for a in A]
... | #!/usr/bin/python3
import heapq
import math
import sys
DEBUG = False
def inp():
return sys.stdin.readline().rstrip()
def dprint(*value, sep=' ', end='\n'):
if DEBUG:
print(*value, sep=sep, end=end)
def solve(N, M, A):
hq = [-a for a in A]
heapq.heapify(hq)
for ... | 41 | 40 | 713 | 670 | #!/usr/bin/python3
from fractions import Fraction
import heapq
import math
import sys
DEBUG = False
def inp():
return sys.stdin.readline().rstrip()
def dprint(*value, sep=" ", end="\n"):
if DEBUG:
print(*value, sep=sep, end=end)
def solve(N, M, A):
hq = [-a for a in A]
heapq.heapify(hq)
... | #!/usr/bin/python3
import heapq
import math
import sys
DEBUG = False
def inp():
return sys.stdin.readline().rstrip()
def dprint(*value, sep=" ", end="\n"):
if DEBUG:
print(*value, sep=sep, end=end)
def solve(N, M, A):
hq = [-a for a in A]
heapq.heapify(hq)
for _ in range(M):
v... | false | 2.439024 | [
"-from fractions import Fraction",
"- v = Fraction(v, 2)",
"+ v //= 2"
] | false | 0.044601 | 0.206198 | 0.216302 | [
"s462114288",
"s576185667"
] |
u216392490 | p02554 | python | s431860040 | s327625343 | 380 | 59 | 86,360 | 61,704 | Accepted | Accepted | 84.47 | n = int(eval(input()))
mod = 10**9 + 7
ans = (10**n - 9**n - 9**n + 8**n) % mod
print(ans)
| n = int(eval(input()))
mod = 10**9 + 7
ans = pow(10, n, mod)
ans += -2 * pow(9, n, mod)
ans += pow(8, n, mod)
print((ans%mod))
| 5 | 7 | 90 | 126 | n = int(eval(input()))
mod = 10**9 + 7
ans = (10**n - 9**n - 9**n + 8**n) % mod
print(ans)
| n = int(eval(input()))
mod = 10**9 + 7
ans = pow(10, n, mod)
ans += -2 * pow(9, n, mod)
ans += pow(8, n, mod)
print((ans % mod))
| false | 28.571429 | [
"-ans = (10**n - 9**n - 9**n + 8**n) % mod",
"-print(ans)",
"+ans = pow(10, n, mod)",
"+ans += -2 * pow(9, n, mod)",
"+ans += pow(8, n, mod)",
"+print((ans % mod))"
] | false | 0.116707 | 0.044945 | 2.59665 | [
"s431860040",
"s327625343"
] |
u864197622 | p03776 | python | s511051438 | s144515318 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | from itertools import accumulate as ac
t = 3099044504245996706400 # LCM(1..50)
N, A, B = list(map(int, input().split()))
V = sorted([int(a) * t for a in input().split()])[::-1]
l, r = 0, 1<<200
while r - l > 1:
m = (l+r) // 2
if list(ac([v-m for v in V]))[A-1] >= 0:
l = m
else:
r =... | N, A, B = list(map(int, input().split()))
V = sorted([int(a) for a in input().split()])[::-1]
fa = [1]
for i in range(1, 60): fa.append(fa[-1] * i)
C = lambda a, b: fa[a] // (fa[a-b] * fa[b])
print((sum(V[:A])/A))
print((sum([C(V.count(V[i-1]), V[:i].count(V[i-1])) for i in range(A, B+1) if sum(V[:i])*A == su... | 19 | 9 | 539 | 324 | from itertools import accumulate as ac
t = 3099044504245996706400 # LCM(1..50)
N, A, B = list(map(int, input().split()))
V = sorted([int(a) * t for a in input().split()])[::-1]
l, r = 0, 1 << 200
while r - l > 1:
m = (l + r) // 2
if list(ac([v - m for v in V]))[A - 1] >= 0:
l = m
else:
r =... | N, A, B = list(map(int, input().split()))
V = sorted([int(a) for a in input().split()])[::-1]
fa = [1]
for i in range(1, 60):
fa.append(fa[-1] * i)
C = lambda a, b: fa[a] // (fa[a - b] * fa[b])
print((sum(V[:A]) / A))
print(
(
sum(
[
C(V.count(V[i - 1]), V[:i].count(V[i - 1])... | false | 52.631579 | [
"-from itertools import accumulate as ac",
"-",
"-t = 3099044504245996706400 # LCM(1..50)",
"-V = sorted([int(a) * t for a in input().split()])[::-1]",
"-l, r = 0, 1 << 200",
"-while r - l > 1:",
"- m = (l + r) // 2",
"- if list(ac([v - m for v in V]))[A - 1] >= 0:",
"- l = m",
"- ... | false | 0.047332 | 0.047132 | 1.004224 | [
"s511051438",
"s144515318"
] |
u970197315 | p02691 | python | s990863443 | s533115331 | 279 | 192 | 63,196 | 50,256 | Accepted | Accepted | 31.18 | n=int(eval(input()))
a=list(map(int,input().split()))
from collections import Counter
ai,aj=[],[]
for i in range(n):
aj.append(i-a[i])
ai.append(i+a[i])
c1=Counter(ai)
c2=Counter(aj)
ans=0
for k in list(c1.keys()):
ans+=c1[k]*c2[k]
print(ans)
| n = int(eval(input()))
a = list(map(int,input().split()))
x = [ aa + i for i,aa in enumerate(a,start = 1)]
y = [ i - aa for i,aa in enumerate(a,start = 1)]
from collections import Counter
c = Counter(y)
ans = 0
for xx in x:
ans += c[xx]
print(ans)
| 15 | 15 | 253 | 267 | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
ai, aj = [], []
for i in range(n):
aj.append(i - a[i])
ai.append(i + a[i])
c1 = Counter(ai)
c2 = Counter(aj)
ans = 0
for k in list(c1.keys()):
ans += c1[k] * c2[k]
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
x = [aa + i for i, aa in enumerate(a, start=1)]
y = [i - aa for i, aa in enumerate(a, start=1)]
from collections import Counter
c = Counter(y)
ans = 0
for xx in x:
ans += c[xx]
print(ans)
| false | 0 | [
"+x = [aa + i for i, aa in enumerate(a, start=1)]",
"+y = [i - aa for i, aa in enumerate(a, start=1)]",
"-ai, aj = [], []",
"-for i in range(n):",
"- aj.append(i - a[i])",
"- ai.append(i + a[i])",
"-c1 = Counter(ai)",
"-c2 = Counter(aj)",
"+c = Counter(y)",
"-for k in list(c1.keys()):",
"-... | false | 0.046705 | 0.046449 | 1.005519 | [
"s990863443",
"s533115331"
] |
u562935282 | p03338 | python | s182952932 | s593784474 | 24 | 18 | 3,772 | 3,064 | Accepted | Accepted | 25 | from string import ascii_lowercase
n = int(eval(input()))
s = eval(input())
ans = -1
for mid in range(1, n):
# [0, mid), [mid, n)
left = set(s[:mid])
right = set(s[mid:])
cnt = 0
for c in ascii_lowercase:
if c in left and c in right:
cnt += 1
ans = max(ans, ... | def main():
N = int(eval(input()))
s = eval(input())
acc = []
t = [0] * 26
for c in s:
i = ord(c) - ord('a')
t[i] += 1
acc.append(t.copy())
ans = 0
for i in range(N - 1):
left = acc[i]
right = [cn - ci for ci, cn in zip(acc[i], acc[N - ... | 17 | 25 | 325 | 519 | from string import ascii_lowercase
n = int(eval(input()))
s = eval(input())
ans = -1
for mid in range(1, n):
# [0, mid), [mid, n)
left = set(s[:mid])
right = set(s[mid:])
cnt = 0
for c in ascii_lowercase:
if c in left and c in right:
cnt += 1
ans = max(ans, cnt)
print(ans)
| def main():
N = int(eval(input()))
s = eval(input())
acc = []
t = [0] * 26
for c in s:
i = ord(c) - ord("a")
t[i] += 1
acc.append(t.copy())
ans = 0
for i in range(N - 1):
left = acc[i]
right = [cn - ci for ci, cn in zip(acc[i], acc[N - 1])]
cnt... | false | 32 | [
"-from string import ascii_lowercase",
"+def main():",
"+ N = int(eval(input()))",
"+ s = eval(input())",
"+ acc = []",
"+ t = [0] * 26",
"+ for c in s:",
"+ i = ord(c) - ord(\"a\")",
"+ t[i] += 1",
"+ acc.append(t.copy())",
"+ ans = 0",
"+ for i in ra... | false | 0.125416 | 0.045464 | 2.758584 | [
"s182952932",
"s593784474"
] |
u206133536 | p02657 | python | s951435373 | s806519242 | 105 | 68 | 60,848 | 61,856 | Accepted | Accepted | 35.24 | print((eval(input().replace(' ','*')))) | st = input().strip().split()
a = int(st[0])
b = int(float(st[1])*1000)
print((a*b//1000)) | 1 | 4 | 37 | 90 | print((eval(input().replace(" ", "*"))))
| st = input().strip().split()
a = int(st[0])
b = int(float(st[1]) * 1000)
print((a * b // 1000))
| false | 75 | [
"-print((eval(input().replace(\" \", \"*\"))))",
"+st = input().strip().split()",
"+a = int(st[0])",
"+b = int(float(st[1]) * 1000)",
"+print((a * b // 1000))"
] | false | 0.044429 | 0.083292 | 0.533409 | [
"s951435373",
"s806519242"
] |
u726615467 | p03013 | python | s890517183 | s689739513 | 244 | 176 | 7,848 | 7,848 | Accepted | Accepted | 27.87 | N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
a.sort()
a.append(10 ** 9 + 7)
a.append(10 ** 9 + 7)
memo = [0] * (N + 1)
memo[0] = 1
idx = 0
for pos in range(1, N + 1):
if a[idx] == pos:
memo[pos] = 0
for i in range(idx, N):
if a[i] > po... | # -*- coding: utf-8 -*-
MOD = 1000000007
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
a.append(int(eval(input())))
def getPatternNum(num):
pattern = [0] * (num + 2)
pattern[0] = 0
for i in range(1, num + 2):
if i == 0 or i == 1:
pattern[i] = 1
... | 30 | 46 | 693 | 1,151 | N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
a.sort()
a.append(10**9 + 7)
a.append(10**9 + 7)
memo = [0] * (N + 1)
memo[0] = 1
idx = 0
for pos in range(1, N + 1):
if a[idx] == pos:
memo[pos] = 0
for i in range(idx, N):
if a[i] > pos:
b... | # -*- coding: utf-8 -*-
MOD = 1000000007
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
a.append(int(eval(input())))
def getPatternNum(num):
pattern = [0] * (num + 2)
pattern[0] = 0
for i in range(1, num + 2):
if i == 0 or i == 1:
pattern[i] = 1
contin... | false | 34.782609 | [
"+# -*- coding: utf-8 -*-",
"+MOD = 1000000007",
"-a = [int(eval(input())) for _ in range(M)]",
"-a.sort()",
"-a.append(10**9 + 7)",
"-a.append(10**9 + 7)",
"-memo = [0] * (N + 1)",
"-memo[0] = 1",
"-idx = 0",
"-for pos in range(1, N + 1):",
"- if a[idx] == pos:",
"- memo[pos] = 0",
... | false | 0.091077 | 0.036539 | 2.492577 | [
"s890517183",
"s689739513"
] |
u901582103 | p03086 | python | s017169606 | s811245672 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S=eval(input())
r=0
c=0
for s in S:
if s=='A'or s=='T'or s=='C'or s=='G':
c+=1
r=max(r,c)
else:
c=0
print(r) | S=eval(input())
c=0
r=0
for s in S:
if s in 'ATCG':
c+=1
r=max(r,c)
else:
c=0
print(r) | 10 | 10 | 143 | 121 | S = eval(input())
r = 0
c = 0
for s in S:
if s == "A" or s == "T" or s == "C" or s == "G":
c += 1
r = max(r, c)
else:
c = 0
print(r)
| S = eval(input())
c = 0
r = 0
for s in S:
if s in "ATCG":
c += 1
r = max(r, c)
else:
c = 0
print(r)
| false | 0 | [
"+c = 0",
"-c = 0",
"- if s == \"A\" or s == \"T\" or s == \"C\" or s == \"G\":",
"+ if s in \"ATCG\":"
] | false | 0.048077 | 0.047428 | 1.013666 | [
"s017169606",
"s811245672"
] |
u816631826 | p03836 | python | s846206747 | s341327579 | 38 | 17 | 4,596 | 3,064 | Accepted | Accepted | 55.26 | sx, sy, tx, ty = map(int, input().split(" "))
tx -= sx
ty -= sy
sx = 0
sy = 0
line = []
for i in range(tx):
line.append("R")
for i in range(ty):
line.append("U")
for i in range(tx):
line.append("L")
for i in range(ty):
line.append("D")
line.append("D")
for i in range(tx+1):
line.appe... | sx,sy,tx,ty = list([int(x) for x in input().split(" ")])
route = ""
route += "U" * (ty-sy)
route += "R" * (tx-sx)
route += "D" * (ty-sy)
route += "L" * (tx-sx)
route += "L"
route += "U" * (ty-sy+1)
route += "R" * (tx-sx+1)
route += "D"
route += "R"
route += "D" * (ty-sy+1)
route += "L" * (tx-sx+1)
route ... | 31 | 17 | 634 | 347 | sx, sy, tx, ty = map(int, input().split(" "))
tx -= sx
ty -= sy
sx = 0
sy = 0
line = []
for i in range(tx):
line.append("R")
for i in range(ty):
line.append("U")
for i in range(tx):
line.append("L")
for i in range(ty):
line.append("D")
line.append("D")
for i in range(tx + 1):
line.append("R")
for i ... | sx, sy, tx, ty = list([int(x) for x in input().split(" ")])
route = ""
route += "U" * (ty - sy)
route += "R" * (tx - sx)
route += "D" * (ty - sy)
route += "L" * (tx - sx)
route += "L"
route += "U" * (ty - sy + 1)
route += "R" * (tx - sx + 1)
route += "D"
route += "R"
route += "D" * (ty - sy + 1)
route += "L" * (tx - sx... | false | 45.16129 | [
"-sx, sy, tx, ty = map(int, input().split(\" \"))",
"-tx -= sx",
"-ty -= sy",
"-sx = 0",
"-sy = 0",
"-line = []",
"-for i in range(tx):",
"- line.append(\"R\")",
"-for i in range(ty):",
"- line.append(\"U\")",
"-for i in range(tx):",
"- line.append(\"L\")",
"-for i in range(ty):",
... | false | 0.038878 | 0.036858 | 1.054803 | [
"s846206747",
"s341327579"
] |
u588341295 | p03436 | python | s574761333 | s284426781 | 37 | 30 | 3,692 | 3,444 | Accepted | Accepted | 18.92 | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from collections import deque
H, W = list(map(int, input().split()))
start, goal = (1, 1), (H, W)
# 左右上下
directions = [[0,-1],[0,1],[-1,0],[1,0]]
# 四方に一回り大きいフィールドを作る
field = [['*'] * (W+2) for i in range(H+2)]
for i in range(1,H+1):
ro... | # -*- coding: utf-8 -*-
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c... | 72 | 83 | 1,945 | 2,188 | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from collections import deque
H, W = list(map(int, input().split()))
start, goal = (1, 1), (H, W)
# 左右上下
directions = [[0, -1], [0, 1], [-1, 0], [1, 0]]
# 四方に一回り大きいフィールドを作る
field = [["*"] * (W + 2) for i in range(H + 2)]
for i in range(1, H + 1):
row =... | # -*- coding: utf-8 -*-
import sys
from collections import deque
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d fo... | false | 13.253012 | [
"-",
"-input = sys.stdin.readline",
"-H, W = list(map(int, input().split()))",
"-start, goal = (1, 1), (H, W)",
"-# 左右上下",
"-directions = [[0, -1], [0, 1], [-1, 0], [1, 0]]",
"-# 四方に一回り大きいフィールドを作る",
"-field = [[\"*\"] * (W + 2) for i in range(H + 2)]",
"-for i in range(1, H + 1):",
"- row = lis... | false | 0.064729 | 0.048508 | 1.334407 | [
"s574761333",
"s284426781"
] |
u525065967 | p02550 | python | s486889450 | s453619268 | 56 | 51 | 13,476 | 13,400 | Accepted | Accepted | 8.93 | n, x, m = list(map(int, input().split()))
mn = min(n, m)
P = [] # value of pre & cycle
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(mn):
if X[x] > -1:
cyc_len = len(P) - X[x]
nxt_len = (n - X[x]) % cyc_len
pre = sum(P[:X[x]])
cyc = (sum_p - p... | n, x, m = list(map(int, input().split()))
P = [] # value of pre & cycle
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(n):
if X[x] > -1:
cyc_len = len(P) - X[x]
nxt_len = (n - X[x]) % cyc_len
pre = sum(P[:X[x]])
cyc = (sum_p - pre) * ((n - X[x])... | 19 | 18 | 514 | 497 | n, x, m = list(map(int, input().split()))
mn = min(n, m)
P = [] # value of pre & cycle
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(mn):
if X[x] > -1:
cyc_len = len(P) - X[x]
nxt_len = (n - X[x]) % cyc_len
pre = sum(P[: X[x]])
cyc = (sum_p - pre) * ... | n, x, m = list(map(int, input().split()))
P = [] # value of pre & cycle
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(n):
if X[x] > -1:
cyc_len = len(P) - X[x]
nxt_len = (n - X[x]) % cyc_len
pre = sum(P[: X[x]])
cyc = (sum_p - pre) * ((n - X[x]) // c... | false | 5.263158 | [
"-mn = min(n, m)",
"-for i in range(mn):",
"+for i in range(n):"
] | false | 0.045409 | 0.045755 | 0.992435 | [
"s486889450",
"s453619268"
] |
u803617136 | p02761 | python | s170054565 | s010393911 | 177 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.83 | import math
N, M = list(map(int, input().split()))
candidate = []
for i in range(1000):
if N == len(str(i)):
candidate.append(i)
for _ in range(M):
s, c = list(map(int, input().split()))
tmp = []
for n in candidate:
if int(str(n)[s - 1]) == c:
tmp.append(n)
... | n, m = list(map(int, input().split()))
nums = []
for i in range(1000):
if len(str(i)) == n:
nums.append(i)
for _ in range(m):
s, c = list(map(int, input().split()))
next_nums = []
for a in nums:
if int(str(a)[s - 1]) == c:
next_nums.append(a)
nums = next_nums... | 21 | 15 | 391 | 343 | import math
N, M = list(map(int, input().split()))
candidate = []
for i in range(1000):
if N == len(str(i)):
candidate.append(i)
for _ in range(M):
s, c = list(map(int, input().split()))
tmp = []
for n in candidate:
if int(str(n)[s - 1]) == c:
tmp.append(n)
candidate = t... | n, m = list(map(int, input().split()))
nums = []
for i in range(1000):
if len(str(i)) == n:
nums.append(i)
for _ in range(m):
s, c = list(map(int, input().split()))
next_nums = []
for a in nums:
if int(str(a)[s - 1]) == c:
next_nums.append(a)
nums = next_nums
print((nums[... | false | 28.571429 | [
"-import math",
"-",
"-N, M = list(map(int, input().split()))",
"-candidate = []",
"+n, m = list(map(int, input().split()))",
"+nums = []",
"- if N == len(str(i)):",
"- candidate.append(i)",
"-for _ in range(M):",
"+ if len(str(i)) == n:",
"+ nums.append(i)",
"+for _ in ran... | false | 0.130158 | 0.044516 | 2.923844 | [
"s170054565",
"s010393911"
] |
u738898077 | p04045 | python | s396824959 | s524825393 | 186 | 54 | 3,060 | 3,060 | Accepted | Accepted | 70.97 | n,k = list(map(int,input().split()))
dls = list(map(int,input().split()))
while 1:
s = list(map(int,list(str(n))))
for i in dls:
if i in s:
break
else:
print(n)
exit()
n += 1 | n,k = list(map(int,input().split()))
dls = list(map(str,input().split()))
while 1:
s = str(n)
for i in dls:
if i in s:
break
else:
print(n)
exit()
n += 1 | 11 | 11 | 230 | 209 | n, k = list(map(int, input().split()))
dls = list(map(int, input().split()))
while 1:
s = list(map(int, list(str(n))))
for i in dls:
if i in s:
break
else:
print(n)
exit()
n += 1
| n, k = list(map(int, input().split()))
dls = list(map(str, input().split()))
while 1:
s = str(n)
for i in dls:
if i in s:
break
else:
print(n)
exit()
n += 1
| false | 0 | [
"-dls = list(map(int, input().split()))",
"+dls = list(map(str, input().split()))",
"- s = list(map(int, list(str(n))))",
"+ s = str(n)"
] | false | 0.00767 | 0.070424 | 0.108915 | [
"s396824959",
"s524825393"
] |
u495267515 | p03698 | python | s654019069 | s850601409 | 53 | 49 | 5,328 | 5,192 | Accepted | Accepted | 7.55 | # -*- coding: utf-8 -*-
import sys
import subprocess
import json
import time
import math
import re
import sqlite3
S = eval(input())
dic = {}
for c in S:
if c in dic:
print("no")
exit(0)
dic[c] = 1
print("yes")
| # -*- coding: utf-8 -*-
import sys
import subprocess
import json
import time
import math
import re
import sqlite3
S = eval(input())
if len(set(S)) == len(S): print("yes")
else: print("no")
| 20 | 15 | 251 | 201 | # -*- coding: utf-8 -*-
import sys
import subprocess
import json
import time
import math
import re
import sqlite3
S = eval(input())
dic = {}
for c in S:
if c in dic:
print("no")
exit(0)
dic[c] = 1
print("yes")
| # -*- coding: utf-8 -*-
import sys
import subprocess
import json
import time
import math
import re
import sqlite3
S = eval(input())
if len(set(S)) == len(S):
print("yes")
else:
print("no")
| false | 25 | [
"-dic = {}",
"-for c in S:",
"- if c in dic:",
"- print(\"no\")",
"- exit(0)",
"- dic[c] = 1",
"-print(\"yes\")",
"+if len(set(S)) == len(S):",
"+ print(\"yes\")",
"+else:",
"+ print(\"no\")"
] | false | 0.104828 | 0.084202 | 1.244957 | [
"s654019069",
"s850601409"
] |
u796408111 | p03556 | python | s546063536 | s888077088 | 22 | 18 | 2,940 | 2,940 | Accepted | Accepted | 18.18 | N = int(eval(input()))
ans = 1
while ans * ans <= N:
ans += 1
ans = (ans - 1) * (ans - 1)
print(ans)
| import math
N = int(eval(input()))
print((math.floor(N**0.5)**2))
| 7 | 3 | 106 | 60 | N = int(eval(input()))
ans = 1
while ans * ans <= N:
ans += 1
ans = (ans - 1) * (ans - 1)
print(ans)
| import math
N = int(eval(input()))
print((math.floor(N**0.5) ** 2))
| false | 57.142857 | [
"+import math",
"+",
"-ans = 1",
"-while ans * ans <= N:",
"- ans += 1",
"-ans = (ans - 1) * (ans - 1)",
"-print(ans)",
"+print((math.floor(N**0.5) ** 2))"
] | false | 0.036945 | 0.03681 | 1.003684 | [
"s546063536",
"s888077088"
] |
u093861603 | p02659 | python | s957014395 | s630528427 | 23 | 20 | 9,064 | 9,136 | Accepted | Accepted | 13.04 | A,B=input().split()
A=int(A)
B=int(B.replace(".",""))*100
print((A*B//10000))
| A,B=input().split()
A=int(A)
B=int(B.replace(".",""))
print((A*B//100))
| 4 | 4 | 79 | 73 | A, B = input().split()
A = int(A)
B = int(B.replace(".", "")) * 100
print((A * B // 10000))
| A, B = input().split()
A = int(A)
B = int(B.replace(".", ""))
print((A * B // 100))
| false | 0 | [
"-B = int(B.replace(\".\", \"\")) * 100",
"-print((A * B // 10000))",
"+B = int(B.replace(\".\", \"\"))",
"+print((A * B // 100))"
] | false | 0.054215 | 0.055279 | 0.980753 | [
"s957014395",
"s630528427"
] |
u588341295 | p03212 | python | s308650212 | s467061009 | 339 | 64 | 42,732 | 3,060 | Accepted | Accepted | 81.12 | # -*- coding: utf-8 -*-
from itertools import product
N = int(eval(input()))
cnt = 0
# 候補となりうる9桁までの数字を列挙
for prod in product(['0', '3', '5', '7'], repeat=9):
# チェック用に変形
num = int(''.join(prod))
s = str(num)
# 753数ではない
if (s.find('3') == -1 or s.find('5') == -1
or s.find(... | # -*- coding: utf-8 -*-
"""
解説参考
再帰関数で候補の数を作っていく版
"""
N = int(eval(input()))
def dfs(s):
# N以下しかやらない
if int(s) > N:
return 0
# 753数かどうか
if '7' in s and '5' in s and '3' in s:
res = 1
else:
res = 0
# sの後ろに753を付けたもので再帰していく
for c in '753':
... | 21 | 25 | 442 | 399 | # -*- coding: utf-8 -*-
from itertools import product
N = int(eval(input()))
cnt = 0
# 候補となりうる9桁までの数字を列挙
for prod in product(["0", "3", "5", "7"], repeat=9):
# チェック用に変形
num = int("".join(prod))
s = str(num)
# 753数ではない
if s.find("3") == -1 or s.find("5") == -1 or s.find("7") == -1 or s.find("0") != ... | # -*- coding: utf-8 -*-
"""
解説参考
再帰関数で候補の数を作っていく版
"""
N = int(eval(input()))
def dfs(s):
# N以下しかやらない
if int(s) > N:
return 0
# 753数かどうか
if "7" in s and "5" in s and "3" in s:
res = 1
else:
res = 0
# sの後ろに753を付けたもので再帰していく
for c in "753":
res += dfs(s + c)
... | false | 16 | [
"-from itertools import product",
"+\"\"\"",
"+解説参考",
"+再帰関数で候補の数を作っていく版",
"+\"\"\"",
"+N = int(eval(input()))",
"-N = int(eval(input()))",
"-cnt = 0",
"-# 候補となりうる9桁までの数字を列挙",
"-for prod in product([\"0\", \"3\", \"5\", \"7\"], repeat=9):",
"- # チェック用に変形",
"- num = int(\"\".join(prod))",... | false | 0.85144 | 0.101559 | 8.383703 | [
"s308650212",
"s467061009"
] |
u162612857 | p04020 | python | s120270268 | s100143845 | 231 | 190 | 7,200 | 7,072 | Accepted | Accepted | 17.75 |
# 直感的に分かる貪欲(下から組を作る)だと思うんだけど、これでdiff1185は数字が高すぎじゃない?
n = int(eval(input()))
nums = [int(eval(input())) for _ in range(n)]
ans = 0
for idx, m in enumerate(nums):
if m > 0:
ans += m // 2
# m -= (m // 2) * 2
m = m & 1
if m == 1 and idx != n-1 and nums[idx+1] >= 1:
a... | # 直感的に分かる貪欲(下から組を作る)だと思うんだけど、これでdiff1185は数字が高すぎじゃない?
# 貪欲で取っていくのを考えると、非ゼロの区間が連続する場合、その連続に対して下からペアを作って、最後に0か1だけ残ることがわかり、
# 単純に書ける。こんなふうに。
n = int(eval(input()))
nums = [int(eval(input())) for _ in range(n)]
ans = 0
temp = 0
for m in nums:
if m == 0:
ans += temp // 2
temp = 0
else:... | 18 | 17 | 372 | 358 | # 直感的に分かる貪欲(下から組を作る)だと思うんだけど、これでdiff1185は数字が高すぎじゃない?
n = int(eval(input()))
nums = [int(eval(input())) for _ in range(n)]
ans = 0
for idx, m in enumerate(nums):
if m > 0:
ans += m // 2
# m -= (m // 2) * 2
m = m & 1
if m == 1 and idx != n - 1 and nums[idx + 1] >= 1:
ans += 1
... | # 直感的に分かる貪欲(下から組を作る)だと思うんだけど、これでdiff1185は数字が高すぎじゃない?
# 貪欲で取っていくのを考えると、非ゼロの区間が連続する場合、その連続に対して下からペアを作って、最後に0か1だけ残ることがわかり、
# 単純に書ける。こんなふうに。
n = int(eval(input()))
nums = [int(eval(input())) for _ in range(n)]
ans = 0
temp = 0
for m in nums:
if m == 0:
ans += temp // 2
temp = 0
else:
temp +=... | false | 5.555556 | [
"+# 貪欲で取っていくのを考えると、非ゼロの区間が連続する場合、その連続に対して下からペアを作って、最後に0か1だけ残ることがわかり、",
"+# 単純に書ける。こんなふうに。",
"-for idx, m in enumerate(nums):",
"- if m > 0:",
"- ans += m // 2",
"- # m -= (m // 2) * 2",
"- m = m & 1",
"- if m == 1 and idx != n - 1 and nums[idx + 1] >= 1:",
"- ans +=... | false | 0.042253 | 0.04162 | 1.015208 | [
"s120270268",
"s100143845"
] |
u006883624 | p02720 | python | s381395849 | s274996659 | 132 | 83 | 12,004 | 11,876 | Accepted | Accepted | 37.12 | from collections import deque
from heapq import heappush, heappop
def main():
K = int(eval(input()))
q = []
for i in range(1, 10):
heappush(q, i)
while True:
v = heappop(q)
K -= 1
if K == 0:
print(v)
exit()
u = v % ... | from collections import deque
from collections import deque
def main():
K = int(eval(input()))
q = deque()
for i in range(1, 10):
q.append(i)
while True:
v = q.popleft()
K -= 1
if K == 0:
print(v)
exit()
u = v % 10
... | 33 | 35 | 570 | 608 | from collections import deque
from heapq import heappush, heappop
def main():
K = int(eval(input()))
q = []
for i in range(1, 10):
heappush(q, i)
while True:
v = heappop(q)
K -= 1
if K == 0:
print(v)
exit()
u = v % 10
nv = v * 10 ... | from collections import deque
from collections import deque
def main():
K = int(eval(input()))
q = deque()
for i in range(1, 10):
q.append(i)
while True:
v = q.popleft()
K -= 1
if K == 0:
print(v)
exit()
u = v % 10
nv = v * 10 + u... | false | 5.714286 | [
"-from heapq import heappush, heappop",
"+from collections import deque",
"- q = []",
"+ q = deque()",
"- heappush(q, i)",
"+ q.append(i)",
"- v = heappop(q)",
"+ v = q.popleft()",
"- heappush(q, nv)",
"- heappush(q, nv + 1)",
"+ q.a... | false | 0.118009 | 0.04312 | 2.736788 | [
"s381395849",
"s274996659"
] |
u760802228 | p03470 | python | s618171237 | s650060197 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | _, *d = open(0).read().split()
print((len(set(d)))) | _, *d = open(0)
print((len(set(d)))) | 2 | 2 | 50 | 35 | _, *d = open(0).read().split()
print((len(set(d))))
| _, *d = open(0)
print((len(set(d))))
| false | 0 | [
"-_, *d = open(0).read().split()",
"+_, *d = open(0)"
] | false | 0.007553 | 0.106558 | 0.070885 | [
"s618171237",
"s650060197"
] |
u994988729 | p03175 | python | s772269373 | s100182538 | 723 | 609 | 114,004 | 30,248 | Accepted | Accepted | 15.77 | #EDPC P_Independent_Set
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N = int(eval(input()))
edge = [[] for _ in range(N + 1)]
mod = 10 ** 9 + 7
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
root = 1
bla... | from collections import deque
N = int(eval(input()))
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
x, y = list(map(int, input().split()))
edge[x].append(y)
edge[y].append(x)
mod = 10 ** 9 + 7
parent = [-1] * (N + 1)
node = deque([1])
ts = []
while node:
s = node.popleft()
... | 46 | 38 | 894 | 766 | # EDPC P_Independent_Set
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
edge = [[] for _ in range(N + 1)]
mod = 10**9 + 7
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
root = 1
black = [1] * (N + 1)
white ... | from collections import deque
N = int(eval(input()))
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
x, y = list(map(int, input().split()))
edge[x].append(y)
edge[y].append(x)
mod = 10**9 + 7
parent = [-1] * (N + 1)
node = deque([1])
ts = []
while node:
s = node.popleft()
ts.append(s)
... | false | 17.391304 | [
"-# EDPC P_Independent_Set",
"-import sys",
"+from collections import deque",
"-input = sys.stdin.buffer.readline",
"-sys.setrecursionlimit(10**7)",
"+for _ in range(N - 1):",
"+ x, y = list(map(int, input().split()))",
"+ edge[x].append(y)",
"+ edge[y].append(x)",
"-for _ in range(N - 1)... | false | 0.041638 | 0.041882 | 0.994188 | [
"s772269373",
"s100182538"
] |
u634079249 | p02881 | python | s033374434 | s135763775 | 202 | 114 | 3,064 | 3,064 | Accepted | Accepted | 43.56 | import sys
import os
import math
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline().rstrip())
max = int(math.sqrt(N) + 1)
ret = float('inf')
for i in range(1, max):
q, mod = divmod(N, i)
if mod == 0:
... | import sys
import os
import math
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [s... | 23 | 27 | 438 | 691 | import sys
import os
import math
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline().rstrip())
max = int(math.sqrt(N) + 1)
ret = float("inf")
for i in range(1, max):
q, mod = divmod(N, i)
if mod == 0:
j = N // i
... | import sys
import os
import math
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.b... | false | 14.814815 | [
"+",
"+ii = lambda: int(sys.stdin.buffer.readline().rstrip())",
"+il = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"+iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"+iss = lambda: sys.stdin.buffer.readline().decode().rstrip()",
"+isn = lambda n: [sys.stdi... | false | 0.036984 | 0.037709 | 0.980784 | [
"s033374434",
"s135763775"
] |
u422104747 | p03141 | python | s460217745 | s577352423 | 1,205 | 844 | 84,056 | 59,640 | Accepted | Accepted | 29.96 | n=int(eval(input()))
taka=[]
ao=[]
s=set()
for i in range(n):
a,b=list(map(int,input().split()))
taka.append([a+b,a,i])
ao.append([a+b,b,i])
s.add(i)
taka.sort(reverse=True)
ao.sort(reverse=True)
takapt=0
takaind=0
aopt=0
aoind=0
while len(s)>0:
while taka[takaind][2] not in s:
... | n=int(eval(input()))
l=[]
for i in range(n):
a,b=list(map(int,input().split()))
l.append([a+b,a,b])
l.sort(reverse=True)
t=0
a=0
for i in range(n):
if i%2==0:
t+=l[i][1]
else:
a+=l[i][2]
print((t-a))
| 27 | 15 | 543 | 233 | n = int(eval(input()))
taka = []
ao = []
s = set()
for i in range(n):
a, b = list(map(int, input().split()))
taka.append([a + b, a, i])
ao.append([a + b, b, i])
s.add(i)
taka.sort(reverse=True)
ao.sort(reverse=True)
takapt = 0
takaind = 0
aopt = 0
aoind = 0
while len(s) > 0:
while taka[takaind][2] n... | n = int(eval(input()))
l = []
for i in range(n):
a, b = list(map(int, input().split()))
l.append([a + b, a, b])
l.sort(reverse=True)
t = 0
a = 0
for i in range(n):
if i % 2 == 0:
t += l[i][1]
else:
a += l[i][2]
print((t - a))
| false | 44.444444 | [
"-taka = []",
"-ao = []",
"-s = set()",
"+l = []",
"- taka.append([a + b, a, i])",
"- ao.append([a + b, b, i])",
"- s.add(i)",
"-taka.sort(reverse=True)",
"-ao.sort(reverse=True)",
"-takapt = 0",
"-takaind = 0",
"-aopt = 0",
"-aoind = 0",
"-while len(s) > 0:",
"- while taka[t... | false | 0.046809 | 0.041436 | 1.129672 | [
"s460217745",
"s577352423"
] |
u515740713 | p02647 | python | s225139897 | s802886965 | 1,560 | 1,046 | 129,368 | 126,364 | Accepted | Accepted | 32.95 | import sys
import numpy as np
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, *A = list(map(int, read().split()))
@jit
def imos(A):
B = np.zeros_like(A)
for i,x in enumerate(A):
a = max(0,i-x)
b = min(N-1,i+x... | import sys
import numpy as np
from numba import jit
readline = sys.stdin.readline
@jit
def loop(n,k,a):
for j in range(k):
b = np.zeros(n+1, dtype=np.int64)
for i in range(n):
b[max(i-a[i], 0)] += 1
b[min(i+a[i]+1, n)] -= 1
a = np.cumsum(b)[:-1]
... | 25 | 26 | 476 | 540 | import sys
import numpy as np
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, *A = list(map(int, read().split()))
@jit
def imos(A):
B = np.zeros_like(A)
for i, x in enumerate(A):
a = max(0, i - x)
b = min(N -... | import sys
import numpy as np
from numba import jit
readline = sys.stdin.readline
@jit
def loop(n, k, a):
for j in range(k):
b = np.zeros(n + 1, dtype=np.int64)
for i in range(n):
b[max(i - a[i], 0)] += 1
b[min(i + a[i] + 1, n)] -= 1
a = np.cumsum(b)[:-1]
i... | false | 3.846154 | [
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-N, K, *A = list(map(int, read().split()))",
"+readline = sys.stdin.readline",
"-def imos(A):",
"- B = np.zeros_like(A)",
"- for i, x in enumerate(A):",
"- a = max(0, i ... | false | 0.233824 | 0.280049 | 0.834938 | [
"s225139897",
"s802886965"
] |
u759412327 | p02911 | python | s057795376 | s717335446 | 193 | 178 | 11,500 | 15,540 | Accepted | Accepted | 7.77 | N,K,Q = list(map(int,input().split()))
P = N*[K-Q]
for q in range(Q):
a = int(eval(input()))
P[a-1]+=1
for n in range(N):
if P[n]<=0:
print("No")
else:
print("Yes") | N,K,Q = list(map(int,input().split()))
A = [int(eval(input())) for q in range(Q)]
P = N*[K-Q]
for a in A:
P[a-1]+=1
for n in range(N):
if P[n]<=0:
print("No")
else:
print("Yes") | 12 | 12 | 181 | 192 | N, K, Q = list(map(int, input().split()))
P = N * [K - Q]
for q in range(Q):
a = int(eval(input()))
P[a - 1] += 1
for n in range(N):
if P[n] <= 0:
print("No")
else:
print("Yes")
| N, K, Q = list(map(int, input().split()))
A = [int(eval(input())) for q in range(Q)]
P = N * [K - Q]
for a in A:
P[a - 1] += 1
for n in range(N):
if P[n] <= 0:
print("No")
else:
print("Yes")
| false | 0 | [
"+A = [int(eval(input())) for q in range(Q)]",
"-for q in range(Q):",
"- a = int(eval(input()))",
"+for a in A:"
] | false | 0.03482 | 0.036966 | 0.941951 | [
"s057795376",
"s717335446"
] |
u581040514 | p03681 | python | s132921601 | s992564637 | 49 | 43 | 3,064 | 3,064 | Accepted | Accepted | 12.24 | N, M = [int(_) for _ in input().split()]
mod = 10**9+7
if N < M:
N, M = M, N
if N == M:
answer = 2
for i in range(2, N+1):
answer = answer * i * i
answer = answer % mod
print (answer)
elif N == M+1:
answer = 1
for i in range(2, N):
answer = answer * i * i
answer = answer % mod
ans... | N, M = [int(_) for _ in input().split()]
mod = 10**9+7
if N < M:
N, M = M, N
if N == M:
answer = 1
for i in range(2, N+1):
answer = answer * i
answer = answer % mod
answer = answer**2 * 2 % mod
print (answer)
elif N == M+1:
answer = 1
for i in range(2, M+1):
answer = answer * i
answ... | 23 | 24 | 378 | 404 | N, M = [int(_) for _ in input().split()]
mod = 10**9 + 7
if N < M:
N, M = M, N
if N == M:
answer = 2
for i in range(2, N + 1):
answer = answer * i * i
answer = answer % mod
print(answer)
elif N == M + 1:
answer = 1
for i in range(2, N):
answer = answer * i * i
ans... | N, M = [int(_) for _ in input().split()]
mod = 10**9 + 7
if N < M:
N, M = M, N
if N == M:
answer = 1
for i in range(2, N + 1):
answer = answer * i
answer = answer % mod
answer = answer**2 * 2 % mod
print(answer)
elif N == M + 1:
answer = 1
for i in range(2, M + 1):
an... | false | 4.166667 | [
"- answer = 2",
"+ answer = 1",
"- answer = answer * i * i",
"+ answer = answer * i",
"+ answer = answer**2 * 2 % mod",
"- for i in range(2, N):",
"- answer = answer * i * i",
"+ for i in range(2, M + 1):",
"+ answer = answer * i",
"- answer = answer *... | false | 0.123807 | 0.110046 | 1.125055 | [
"s132921601",
"s992564637"
] |
u062147869 | p03801 | python | s463851620 | s743919102 | 468 | 430 | 85,736 | 77,924 | Accepted | Accepted | 8.12 | from collections import defaultdict
import sys
class BIT():
def __init__(self, number):
self.n = number
self.list = [0] * (number + 1)
def add(self, i, x): # ith added x 1indexed
while i <= self.n:
self.list[i] += x
i += i & -i
def search(self,... | from operator import itemgetter
import sys
N=int(eval(input()))
A=[int(i) for i in input().split()]
B=[(A[i],i) for i in range(N)]
B=sorted(B,key=itemgetter(1))
B=sorted(B,key=itemgetter(0))
T=[0]*N
cos,pt=B.pop()
for i in range(1,N):
cos2,pt2=B.pop()
T[pt]+=(cos-cos2)*i
pt=min(pt,pt2)
cos=... | 70 | 17 | 1,390 | 360 | from collections import defaultdict
import sys
class BIT:
def __init__(self, number):
self.n = number
self.list = [0] * (number + 1)
def add(self, i, x): # ith added x 1indexed
while i <= self.n:
self.list[i] += x
i += i & -i
def search(self, i): # 1-i ... | from operator import itemgetter
import sys
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [(A[i], i) for i in range(N)]
B = sorted(B, key=itemgetter(1))
B = sorted(B, key=itemgetter(0))
T = [0] * N
cos, pt = B.pop()
for i in range(1, N):
cos2, pt2 = B.pop()
T[pt] += (cos - cos2) * i
pt = ... | false | 75.714286 | [
"-from collections import defaultdict",
"+from operator import itemgetter",
"-",
"-",
"-class BIT:",
"- def __init__(self, number):",
"- self.n = number",
"- self.list = [0] * (number + 1)",
"-",
"- def add(self, i, x): # ith added x 1indexed",
"- while i <= self.n:"... | false | 0.035787 | 0.036356 | 0.984346 | [
"s463851620",
"s743919102"
] |
u136843617 | p02732 | python | s724855294 | s064402852 | 415 | 280 | 26,268 | 26,012 | Accepted | Accepted | 32.53 | n = int(input())
balls = list(map(int, input().split()))
conbi = [0]*n
for i in balls:
conbi[i-1] +=1
result = 0
for j in range(n):
result += (conbi[j]*(conbi[j]-1))//2
for k in balls:
print(result-conbi[k-1]+1, end=" ")
| def solve():
N = int(eval(input()))
A = list(map(int,input().split()))
conb = [0]*N
ans = 0
for i in A:
conb[i-1] += 1
for j in conb:
if j != 0:
ans += j*(j-1)//2
for k in range(N):
print((ans- conb[A[k]-1]+1))
if __name__ == '__main__':
... | 10 | 17 | 242 | 324 | n = int(input())
balls = list(map(int, input().split()))
conbi = [0] * n
for i in balls:
conbi[i - 1] += 1
result = 0
for j in range(n):
result += (conbi[j] * (conbi[j] - 1)) // 2
for k in balls:
print(result - conbi[k - 1] + 1, end=" ")
| def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
conb = [0] * N
ans = 0
for i in A:
conb[i - 1] += 1
for j in conb:
if j != 0:
ans += j * (j - 1) // 2
for k in range(N):
print((ans - conb[A[k] - 1] + 1))
if __name__ == "__main__":
... | false | 41.176471 | [
"-n = int(input())",
"-balls = list(map(int, input().split()))",
"-conbi = [0] * n",
"-for i in balls:",
"- conbi[i - 1] += 1",
"-result = 0",
"-for j in range(n):",
"- result += (conbi[j] * (conbi[j] - 1)) // 2",
"-for k in balls:",
"- print(result - conbi[k - 1] + 1, end=\" \")",
"+de... | false | 0.051592 | 0.036307 | 1.421004 | [
"s724855294",
"s064402852"
] |
u731368968 | p02691 | python | s488556597 | s906951557 | 339 | 216 | 110,120 | 120,704 | Accepted | Accepted | 36.28 | n = int(eval(input()))
A = list(map(int, input().split()))
B = [A[i] - i for i in range(n)]
C = [-A[i] - i for i in range(n)]
# Bの要素それぞれに対するCの中ある等しいものの数の総和
C.sort()
from bisect import *
ans = 0
for b in B:
ans += bisect(C, b) - bisect_left(C, b)
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
C = sorted([-A[i] - i for i in range(n)])
from bisect import *
print((sum(bisect(C, b) - bisect_left(C, b) for b in [A[i] - i for i in range(n)])))
| 16 | 5 | 275 | 203 | n = int(eval(input()))
A = list(map(int, input().split()))
B = [A[i] - i for i in range(n)]
C = [-A[i] - i for i in range(n)]
# Bの要素それぞれに対するCの中ある等しいものの数の総和
C.sort()
from bisect import *
ans = 0
for b in B:
ans += bisect(C, b) - bisect_left(C, b)
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
C = sorted([-A[i] - i for i in range(n)])
from bisect import *
print((sum(bisect(C, b) - bisect_left(C, b) for b in [A[i] - i for i in range(n)])))
| false | 68.75 | [
"-B = [A[i] - i for i in range(n)]",
"-C = [-A[i] - i for i in range(n)]",
"-# Bの要素それぞれに対するCの中ある等しいものの数の総和",
"-C.sort()",
"+C = sorted([-A[i] - i for i in range(n)])",
"-ans = 0",
"-for b in B:",
"- ans += bisect(C, b) - bisect_left(C, b)",
"-print(ans)",
"+print((sum(bisect(C, b) - bisect_left... | false | 0.043244 | 0.044146 | 0.979551 | [
"s488556597",
"s906951557"
] |
u440161695 | p03487 | python | s213659743 | s165980136 | 101 | 92 | 18,672 | 20,852 | Accepted | Accepted | 8.91 | from collections import Counter
N=int(eval(input()))
A=list(map(int,input().split()))
d=Counter(A)
ans=0
for i in d:
if d[i]>=i:
ans+=d[i]-i
else:
ans+=d[i]
print(ans) | from collections import Counter
n=int(eval(input()))
a=Counter(input().split())
ans=0
for i,j in list(a.items()):
i=int(i)
if i>j:
ans+=j
elif i<j:
ans+=j-i
print(ans) | 11 | 11 | 183 | 193 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
ans = 0
for i in d:
if d[i] >= i:
ans += d[i] - i
else:
ans += d[i]
print(ans)
| from collections import Counter
n = int(eval(input()))
a = Counter(input().split())
ans = 0
for i, j in list(a.items()):
i = int(i)
if i > j:
ans += j
elif i < j:
ans += j - i
print(ans)
| false | 0 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-d = Counter(A)",
"+n = int(eval(input()))",
"+a = Counter(input().split())",
"-for i in d:",
"- if d[i] >= i:",
"- ans += d[i] - i",
"- else:",
"- ans += d[i]",
"+for i, j in list(a.items()):",
"+ i = i... | false | 0.046516 | 0.046661 | 0.996908 | [
"s213659743",
"s165980136"
] |
u689701565 | p02682 | python | s786078045 | s446074894 | 25 | 23 | 9,176 | 9,176 | Accepted | Accepted | 8 | paramA, paramB, paramC, paramK = list([int(x) for x in input().split(' ')])
result = min(paramA, paramK)
paramK -= paramA
if paramK > 0:
paramK -= paramB
if paramK > 0:
result -= min(paramC, paramK)
print(result) | paramA, paramB, paramC, paramK = list([int(x) for x in input().split(' ')])
result = min(paramA, paramK)
paramK -= paramA
paramK -= paramB
if paramK > 0:
result -= min(paramC, paramK)
print(result) | 10 | 9 | 244 | 216 | paramA, paramB, paramC, paramK = list([int(x) for x in input().split(" ")])
result = min(paramA, paramK)
paramK -= paramA
if paramK > 0:
paramK -= paramB
if paramK > 0:
result -= min(paramC, paramK)
print(result)
| paramA, paramB, paramC, paramK = list([int(x) for x in input().split(" ")])
result = min(paramA, paramK)
paramK -= paramA
paramK -= paramB
if paramK > 0:
result -= min(paramC, paramK)
print(result)
| false | 10 | [
"+paramK -= paramB",
"- paramK -= paramB",
"- if paramK > 0:",
"- result -= min(paramC, paramK)",
"+ result -= min(paramC, paramK)"
] | false | 0.047233 | 0.043787 | 1.078698 | [
"s786078045",
"s446074894"
] |
u673173160 | p02602 | python | s332117763 | s230141533 | 168 | 148 | 96,032 | 105,544 | Accepted | Accepted | 11.9 | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')... | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
now = 1000
for i in range(k, n):
#print(A[i], A[i-k])
if A[i] > A[i-k]:
print("Yes")
else:
print("No") | 21 | 9 | 667 | 207 | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = floa... | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
now = 1000
for i in range(k, n):
# print(A[i], A[i-k])
if A[i] > A[i - k]:
print("Yes")
else:
print("No")
| false | 57.142857 | [
"-import sys, math, itertools, collections, bisect",
"-",
"-input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"-inf = float(\"inf\")",
"-mod = 10**9 + 7",
"-mans = inf",
"-ans = 0",
"-count = 0",
"-pro = 1",
"-import sys, math, itertools, collections, bisect",
"-",
"-inp... | false | 0.041987 | 0.080515 | 0.521483 | [
"s332117763",
"s230141533"
] |
u530606147 | p02639 | python | s326474411 | s238887977 | 20 | 18 | 9,036 | 9,156 | Accepted | Accepted | 10 | x = list(map(int, input().split()))
print((list(set(range(1, 5 + 1)) - set(x))[0]))
| x = list(map(int, input().split()))
print((sum(range(1, 5 + 1)) - sum(x)))
| 3 | 3 | 85 | 76 | x = list(map(int, input().split()))
print((list(set(range(1, 5 + 1)) - set(x))[0]))
| x = list(map(int, input().split()))
print((sum(range(1, 5 + 1)) - sum(x)))
| false | 0 | [
"-print((list(set(range(1, 5 + 1)) - set(x))[0]))",
"+print((sum(range(1, 5 + 1)) - sum(x)))"
] | false | 0.037994 | 0.040703 | 0.933434 | [
"s326474411",
"s238887977"
] |
u312025627 | p03779 | python | s555021829 | s484701240 | 192 | 173 | 44,656 | 40,560 | Accepted | Accepted | 9.9 | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
from itertools import accumulate
S = [i for i in accumulate(list(range(1, min(N+1, 100000))))]
def is_ok(mid):
if N <= S[mid]:
return True
else:
return False
... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
from itertools import accumulate
S = [i for i in accumulate(list(range(1, min(N+1, 44725))))]
def is_ok(mid):
if N <= S[mid]:
return True
else:
return False
... | 30 | 30 | 687 | 686 | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
from itertools import accumulate
S = [i for i in accumulate(list(range(1, min(N + 1, 100000))))]
def is_ok(mid):
if N <= S[mid]:
return True
else:
return False
def bina... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
from itertools import accumulate
S = [i for i in accumulate(list(range(1, min(N + 1, 44725))))]
def is_ok(mid):
if N <= S[mid]:
return True
else:
return False
def binar... | false | 0 | [
"- S = [i for i in accumulate(list(range(1, min(N + 1, 100000))))]",
"+ S = [i for i in accumulate(list(range(1, min(N + 1, 44725))))]"
] | false | 0.049903 | 0.046286 | 1.078142 | [
"s555021829",
"s484701240"
] |
u918601425 | p03317 | python | s786781105 | s066389590 | 26 | 17 | 3,060 | 3,060 | Accepted | Accepted | 34.62 | N,K=[int(s) for s in input().split()]
x=1
for i in range(1,N):
x+=(K-1)
if x>=N:
print(i)
break
| N,K=[int(s) for s in input().split()]
print(((N+K-3)//(K-1))) | 9 | 2 | 121 | 60 | N, K = [int(s) for s in input().split()]
x = 1
for i in range(1, N):
x += K - 1
if x >= N:
print(i)
break
| N, K = [int(s) for s in input().split()]
print(((N + K - 3) // (K - 1)))
| false | 77.777778 | [
"-x = 1",
"-for i in range(1, N):",
"- x += K - 1",
"- if x >= N:",
"- print(i)",
"- break",
"+print(((N + K - 3) // (K - 1)))"
] | false | 0.045921 | 0.037234 | 1.233329 | [
"s786781105",
"s066389590"
] |
u740284863 | p03127 | python | s607305448 | s157948747 | 123 | 79 | 14,252 | 14,748 | Accepted | Accepted | 35.77 | import sys
input = sys.stdin.readline
n = int(eval(input()))
A = list(map(int,input().split()))
while True:
if A.count(0) == n - 1:
print((max(A)))
exit()
else:
B = [ _ for _ in A if _ != 0 ]
attack = min(B)
sn = A.index(attack)
for i in ra... | import sys
input = sys.stdin.readline
from functools import reduce
def gcd_list(n):
return reduce(gcd, n)
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
n = int(eval(input()))
a = list(map(int, input().split()))
print((gcd_list(a)))
| 21 | 14 | 508 | 269 | import sys
input = sys.stdin.readline
n = int(eval(input()))
A = list(map(int, input().split()))
while True:
if A.count(0) == n - 1:
print((max(A)))
exit()
else:
B = [_ for _ in A if _ != 0]
attack = min(B)
sn = A.index(attack)
for i in range(n):
if A... | import sys
input = sys.stdin.readline
from functools import reduce
def gcd_list(n):
return reduce(gcd, n)
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
n = int(eval(input()))
a = list(map(int, input().split()))
print((gcd_list(a)))
| false | 33.333333 | [
"+from functools import reduce",
"+",
"+",
"+def gcd_list(n):",
"+ return reduce(gcd, n)",
"+",
"+",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"+",
"+",
"-A = list(map(int, input().split()))",
"-while True:",
"- if A.count(0) == n - 1... | false | 0.060572 | 0.101461 | 0.597 | [
"s607305448",
"s157948747"
] |
u803848678 | p02852 | python | s361608794 | s787202913 | 454 | 322 | 65,128 | 54,748 | Accepted | Accepted | 29.07 | import sys
input = sys.stdin.readline
# 区間更新
# 小さいものを残すパターン
class RangeUpdateQuery:
def __init__(self, n):
self.n0 = 2**(n-1).bit_length()
# 初期値
self.INF = float("inf")
self.data = [self.INF]*(2*self.n0-1)
# 0-indexedで[l, r)をvに更新
# [l, r]を更新したかったら (l, r+1)を引数に入... | from heapq import heappop, heappush
n,m = list(map(int, input().split()))
s = eval(input())
heap = [(0,n)]
turn = [-1]*(n+1)
turn[-1] = 0
for i in range(n-1, -1, -1):
if s[i] == "1":
continue
while heap and heap[0][1]-i>m:
heappop(heap)
if not heap:
break
cnt, pr... | 71 | 31 | 1,584 | 619 | import sys
input = sys.stdin.readline
# 区間更新
# 小さいものを残すパターン
class RangeUpdateQuery:
def __init__(self, n):
self.n0 = 2 ** (n - 1).bit_length()
# 初期値
self.INF = float("inf")
self.data = [self.INF] * (2 * self.n0 - 1)
# 0-indexedで[l, r)をvに更新
# [l, r]を更新したかったら (l, r+1)を引数に入れる
... | from heapq import heappop, heappush
n, m = list(map(int, input().split()))
s = eval(input())
heap = [(0, n)]
turn = [-1] * (n + 1)
turn[-1] = 0
for i in range(n - 1, -1, -1):
if s[i] == "1":
continue
while heap and heap[0][1] - i > m:
heappop(heap)
if not heap:
break
cnt, prev =... | false | 56.338028 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-# 区間更新",
"-# 小さいものを残すパターン",
"-class RangeUpdateQuery:",
"- def __init__(self, n):",
"- self.n0 = 2 ** (n - 1).bit_length()",
"- # 初期値",
"- self.INF = float(\"inf\")",
"- self.data = [self.INF] * (2 * self.n0 - 1)... | false | 0.080049 | 0.044923 | 1.781896 | [
"s361608794",
"s787202913"
] |
u263830634 | p03038 | python | s978422761 | s151329582 | 715 | 338 | 34,952 | 31,964 | Accepted | Accepted | 52.73 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
cb = []
for i in A:
cb += [[i,1]]
for _ in range(M):
b, c = list(map(int, input().split()))
cb += [[c, b]]
cb.sort(reverse = True)
#print (cb)
ans = 0
i = 0
j = 0
while i <= N:
a = min(N-i, cb[j][1])
ans +=... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [tuple(map(int, input().split())) for _ in range(M)]
BC_append = BC.append
for a in A:
BC_append((1, a))
BC.sort(key = lambda x: x[1])
ans = 0
while N > 0:
bc = BC.pop()
... | 24 | 27 | 417 | 461 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
cb = []
for i in A:
cb += [[i, 1]]
for _ in range(M):
b, c = list(map(int, input().split()))
cb += [[c, b]]
cb.sort(reverse=True)
# print (cb)
ans = 0
i = 0
j = 0
while i <= N:
a = min(N - i, cb[j][1])
ans += cb[j][0] * a
... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [tuple(map(int, input().split())) for _ in range(M)]
BC_append = BC.append
for a in A:
BC_append((1, a))
BC.sort(key=lambda x: x[1])
ans = 0
while N > 0:
bc = BC.pop()
b = bc[0]
c = bc[... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-cb = []",
"-for i in A:",
"- cb += [[i, 1]]",
"-for _ in range(M):",
"- b, c = list(map(int, input().split()))",
"- cb += [[c, b]]",
"-cb.sort(reverse=True)",
"-# print (cb)",
"+BC = [tuple(map(int, input().split())) for _ in range(... | false | 0.038882 | 0.045998 | 0.845307 | [
"s978422761",
"s151329582"
] |
u102461423 | p03885 | python | s943997360 | s564479197 | 1,119 | 228 | 227,888 | 16,900 | Accepted | Accepted | 79.62 | from numpy import *
P=10**9+7
N=int(eval(input()))
C=array([input().split() for _ in range(N)],int8)
def r(A):
if(A==0).all():return 0
i=A[:,0].nonzero()[0]
if len(i) == 0:return r(A[:,1:])
t=A[i[0]].copy();A[i[0]]=A[0];A[0]=t
A[1:]^= A[1:,0][:,None]*A[0][None,:]
return 1+r(A[1:,1:])
r=r(C)
p=on... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 10**9 + 7
N = int(readline())
C = np.array([line.split() for line in readlines()],np.int8)
def rank(A):
if (A==0).all():
return 0
i = np.nonzero(A[:,0])[0]
... | 20 | 69 | 639 | 1,572 | from numpy import *
P = 10**9 + 7
N = int(eval(input()))
C = array([input().split() for _ in range(N)], int8)
def r(A):
if (A == 0).all():
return 0
i = A[:, 0].nonzero()[0]
if len(i) == 0:
return r(A[:, 1:])
t = A[i[0]].copy()
A[i[0]] = A[0]
A[0] = t
A[1:] ^= A[1:, 0][:, N... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 10**9 + 7
N = int(readline())
C = np.array([line.split() for line in readlines()], np.int8)
def rank(A):
if (A == 0).all():
return 0
i = np.nonzero(A[:, 0])[0]
if len(i)... | false | 71.014493 | [
"-from numpy import *",
"+import sys",
"-P = 10**9 + 7",
"-N = int(eval(input()))",
"-C = array([input().split() for _ in range(N)], int8)",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"+sys.setrecursionlimit(10**7)",
"+import numpy as np",
"+",
"+MOD = 10**9 + 7",
"+... | false | 0.182533 | 0.2995 | 0.609459 | [
"s943997360",
"s564479197"
] |
u411203878 | p03696 | python | s752738279 | s027815201 | 164 | 69 | 38,256 | 61,952 | Accepted | Accepted | 57.93 | n=int(eval(input()))
s=eval(input())
s=list(s)
flag = True
ans = []
count = 0
for i in s:
if flag:
if i==')':
ans.append(')')
ans.insert(0, '(')
else:
flag = False
ans.append('(')
count += 1
else:
if i=='... | N = int(eval(input()))
S = list(eval(input()))
ans = []
count = 0
addFlag = True
for i in range(N):
if addFlag:
if S[i] == ')':
ans.append(')')
ans.insert(0,'(')
else:
ans.append('(')
count += 1
addFlag = False
else:
... | 33 | 29 | 584 | 580 | n = int(eval(input()))
s = eval(input())
s = list(s)
flag = True
ans = []
count = 0
for i in s:
if flag:
if i == ")":
ans.append(")")
ans.insert(0, "(")
else:
flag = False
ans.append("(")
count += 1
else:
if i == "(":
... | N = int(eval(input()))
S = list(eval(input()))
ans = []
count = 0
addFlag = True
for i in range(N):
if addFlag:
if S[i] == ")":
ans.append(")")
ans.insert(0, "(")
else:
ans.append("(")
count += 1
addFlag = False
else:
if S[i] ==... | false | 12.121212 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-s = list(s)",
"-flag = True",
"+N = int(eval(input()))",
"+S = list(eval(input()))",
"-for i in s:",
"- if flag:",
"- if i == \")\":",
"+addFlag = True",
"+for i in range(N):",
"+ if addFlag:",
"+ if S[i] == \")\":",
"-... | false | 0.035234 | 0.035817 | 0.983724 | [
"s752738279",
"s027815201"
] |
u873190923 | p02948 | python | s958463597 | s101900381 | 989 | 885 | 74,200 | 78,168 | Accepted | Accepted | 10.52 | import heapq # 優先度付きキュー(最小値取り出し)
n,m = list(map(int, input().split()))
a = [list(map(int,input().split())) for i in range(n)]
a.sort(reverse = True)
b = []
heapq.heapify(b) # ヒープ化
ans = 0
for i in range(1,m+1):
while a and a[-1][0] == i:
val = a.pop()[1]
heapq.heappush(b, (-1)*(val)) ... | import heapq # 優先度付きキュー(最小値取り出し)
inf = 10**15
mod = 10**9+7
n,m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key = lambda x:x[0], reverse = True)
q = []
heapq.heapify(q) # ヒープ化
ans = 0
for i in range(1,m+1): # m-i日目からスタートして間に合う仕事
while ab and ab[-1... | 16 | 18 | 444 | 454 | import heapq # 優先度付きキュー(最小値取り出し)
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
a.sort(reverse=True)
b = []
heapq.heapify(b) # ヒープ化
ans = 0
for i in range(1, m + 1):
while a and a[-1][0] == i:
val = a.pop()[1]
heapq.heappush(b, (-1) * (val)) # 今考えて... | import heapq # 優先度付きキュー(最小値取り出し)
inf = 10**15
mod = 10**9 + 7
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[0], reverse=True)
q = []
heapq.heapify(q) # ヒープ化
ans = 0
for i in range(1, m + 1): # m-i日目からスタートして間に合う仕事
while ab and ab[-1][0] ==... | false | 11.111111 | [
"+inf = 10**15",
"+mod = 10**9 + 7",
"-a = [list(map(int, input().split())) for i in range(n)]",
"-a.sort(reverse=True)",
"-b = []",
"-heapq.heapify(b) # ヒープ化",
"+ab = [list(map(int, input().split())) for i in range(n)]",
"+ab.sort(key=lambda x: x[0], reverse=True)",
"+q = []",
"+heapq.heapify(q)... | false | 0.07685 | 0.073231 | 1.049415 | [
"s958463597",
"s101900381"
] |
u716530146 | p03997 | python | s043667256 | s178036381 | 281 | 168 | 64,364 | 38,256 | Accepted | Accepted | 40.21 | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
a,b,h=[int(eval(input())) for i in range(3)]
print(((a+b)*h//2)) | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
a=int(eval(input()))
b=int(eval(input()))
h=int(eval(input()))
print(((a+b)*h//2)) | 9 | 10 | 288 | 287 | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
a, b, h = [int(eval(input())) for i in range(3)]
print(((a + b) * h // 2))
| #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
print(((a + b) * h // 2))
| false | 10 | [
"-import sys, math, itertools, heapq, collections, bisect, fractions",
"+import sys, math, itertools, collections, bisect",
"-sys.setrecursionlimit(10**8)",
"-ans = count = 0",
"-a, b, h = [int(eval(input())) for i in range(3)]",
"+mod = 10**9 + 7",
"+mans = inf",
"+ans = 0",
"+count = 0",
"+pro =... | false | 0.040309 | 0.035749 | 1.127554 | [
"s043667256",
"s178036381"
] |
u623231048 | p03645 | python | s013581890 | s443268620 | 697 | 584 | 11,420 | 6,132 | Accepted | Accepted | 16.21 | n,m = list(map(int,input().split()))
li1 = []
lin = []
for _ in range(m):
a,b = list(map(int,input().split()))
if a == 1:
li1.append(b)
elif b == n:
lin.append(a)
li1.sort()
lin.sort()
tmp = 0
if not len(lin):
print('IMPOSSIBLE')
exit()
for i in li1:
w... | n,m = list(map(int,input().split()))
li1 = [False] * n
lin = [False] * n
for _ in range(m):
a,b = list(map(int,input().split()))
if a == 1:
li1[b-1] = True
elif b == n:
lin[a-1] = True
for i in range(n):
if li1[i] and lin[i]:
print('POSSIBLE')
exit()
... | 33 | 18 | 518 | 328 | n, m = list(map(int, input().split()))
li1 = []
lin = []
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
li1.append(b)
elif b == n:
lin.append(a)
li1.sort()
lin.sort()
tmp = 0
if not len(lin):
print("IMPOSSIBLE")
exit()
for i in li1:
while i > lin[tmp]:
... | n, m = list(map(int, input().split()))
li1 = [False] * n
lin = [False] * n
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
li1[b - 1] = True
elif b == n:
lin[a - 1] = True
for i in range(n):
if li1[i] and lin[i]:
print("POSSIBLE")
exit()
print("IMPOSS... | false | 45.454545 | [
"-li1 = []",
"-lin = []",
"+li1 = [False] * n",
"+lin = [False] * n",
"- li1.append(b)",
"+ li1[b - 1] = True",
"- lin.append(a)",
"-li1.sort()",
"-lin.sort()",
"-tmp = 0",
"-if not len(lin):",
"- print(\"IMPOSSIBLE\")",
"- exit()",
"-for i in li1:",
"- whil... | false | 0.047792 | 0.049436 | 0.966751 | [
"s013581890",
"s443268620"
] |
u416011173 | p03294 | python | s143403131 | s787211486 | 43 | 26 | 10,660 | 9,248 | Accepted | Accepted | 39.53 | # モジュールのインポート
import fractions
# 標準入力を取得
N = int(eval(input()))
a = list(map(int, input().split()))
# 求解処理
ans = sum(a) - N
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
a = list(map(int, input().split()))
return N, a
def main(N: int, a: list) -> None:
"""
メイン処理.
Args:\n
N (int): 正整数の数(2 <= N... | 12 | 36 | 150 | 540 | # モジュールのインポート
import fractions
# 標準入力を取得
N = int(eval(input()))
a = list(map(int, input().split()))
# 求解処理
ans = sum(a) - N
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
a = list(map(int, input().split()))
return N, a
def main(N: int, a: list) -> None:
"""
メイン処理.
Args:\n
N (int): 正整数の数(2 <= N <= 3000)
a (lis... | false | 66.666667 | [
"-# モジュールのインポート",
"-import fractions",
"+# -*- coding: utf-8 -*-",
"+def get_input() -> tuple:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ tuple: 標準入力",
"+ \"\"\"",
"+ N = int(eval(input()))",
"+ a = list(map(int, input().split()))",
"+ return N, a",
"-# 標準入... | false | 0.085585 | 0.099965 | 0.856149 | [
"s143403131",
"s787211486"
] |
u408260374 | p02364 | python | s864133185 | s386144746 | 1,450 | 1,210 | 47,768 | 45,224 | Accepted | Accepted | 16.55 | from heapq import heappush, heappop
class Prim:
""" find minimum spanning tree by Prim's algorithm
"""
def __init__(self, V, E, start=0, INF=10**9):
""" V: the number of vertexes
E: adjacency list (undirected graph)
start: start vertex
INF: Infinity cost... | class UnionFindTree:
"""Disjoint-Set Data Structure
Union-Find Tree
used in SRM505 div.2 900
"""
def __init__(self, n):
self.par = list(range(n)) # parent
self.rank = [0] * n # depth of tree
def find(self, x):
if self.par[x] == x:
re... | 40 | 74 | 1,051 | 2,004 | from heapq import heappush, heappop
class Prim:
"""find minimum spanning tree by Prim's algorithm"""
def __init__(self, V, E, start=0, INF=10**9):
"""V: the number of vertexes
E: adjacency list (undirected graph)
start: start vertex
INF: Infinity cost
"""
self.... | class UnionFindTree:
"""Disjoint-Set Data Structure
Union-Find Tree
used in SRM505 div.2 900
"""
def __init__(self, n):
self.par = list(range(n)) # parent
self.rank = [0] * n # depth of tree
def find(self, x):
if self.par[x] == x:
return x
else:
... | false | 45.945946 | [
"-from heapq import heappush, heappop",
"+class UnionFindTree:",
"+ \"\"\"Disjoint-Set Data Structure",
"+ Union-Find Tree",
"+ used in SRM505 div.2 900",
"+ \"\"\"",
"+",
"+ def __init__(self, n):",
"+ self.par = list(range(n)) # parent",
"+ self.rank = [0] * n # de... | false | 0.041733 | 0.041148 | 1.014227 | [
"s864133185",
"s386144746"
] |
u257374434 | p02750 | python | s195768974 | s103159034 | 1,655 | 1,232 | 107,352 | 101,852 | Accepted | Accepted | 25.56 | import bisect
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
"""
a_x = 1 and b_x is t_i = 2*(t_i +2)
n 店舗回るのに 2^nはかかる
30店舗以上は回れない
"""
a0 = []
nab = []
for a, b in AB:
if a == 0:
a0.append(b)
else:
nab.append(((b + 1) / a, a, b... | import bisect
import sys
input = sys.stdin.readline
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
"""
a_x = 1 and b_x is t_i = 2*(t_i +2)
n 店舗回るのに 2^nはかかる
30店舗以上は回れない
"""
a0 = []
nab = []
for a, b in AB:
if a == 0:
a0.append(b)
else:
... | 48 | 49 | 953 | 991 | import bisect
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
"""
a_x = 1 and b_x is t_i = 2*(t_i +2)
n 店舗回るのに 2^nはかかる
30店舗以上は回れない
"""
a0 = []
nab = []
for a, b in AB:
if a == 0:
a0.append(b)
else:
nab.append(((b + 1) / a, a, b))
a0.sort()
nab.so... | import bisect
import sys
input = sys.stdin.readline
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
"""
a_x = 1 and b_x is t_i = 2*(t_i +2)
n 店舗回るのに 2^nはかかる
30店舗以上は回れない
"""
a0 = []
nab = []
for a, b in AB:
if a == 0:
a0.append(b)
else:
nab.append... | false | 2.040816 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.088861 | 0.210012 | 0.423124 | [
"s195768974",
"s103159034"
] |
u429029348 | p02607 | python | s317805534 | s945161647 | 30 | 26 | 9,180 | 9,096 | Accepted | Accepted | 13.33 | n=int(eval(input()))
a=list(map(int,input().split()))
b=a[::2]
cnt=0
for i in range(len(b)):
if b[i]%2==1:
cnt+=1
print(cnt) | n = int(eval(input()))
a = list(map(int, input().split()))
aa = a[::2]
cnt = 0
for i in aa:
if i % 2 == 1:
cnt += 1
print(cnt)
| 8 | 10 | 131 | 144 | n = int(eval(input()))
a = list(map(int, input().split()))
b = a[::2]
cnt = 0
for i in range(len(b)):
if b[i] % 2 == 1:
cnt += 1
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
aa = a[::2]
cnt = 0
for i in aa:
if i % 2 == 1:
cnt += 1
print(cnt)
| false | 20 | [
"-b = a[::2]",
"+aa = a[::2]",
"-for i in range(len(b)):",
"- if b[i] % 2 == 1:",
"+for i in aa:",
"+ if i % 2 == 1:"
] | false | 0.067595 | 0.032795 | 2.061141 | [
"s317805534",
"s945161647"
] |
u263830634 | p02868 | python | s782608975 | s263789113 | 1,454 | 1,266 | 100,332 | 97,148 | Accepted | Accepted | 12.93 | INF = 10 ** 18
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
L, R, C = list(map(int, input().split()))
G[L].append([C, R])
G[R].append([C, L])
for i in range(1, N):
G[i + 1].append([0, i])
d = [INF] * (N + 1)
def dijkstra(s):
import hea... | def main():
import sys
input = sys.stdin.readline
INF = 10 ** 18
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
L, R, C = list(map(int, input().split()))
G[L].append([C, R])
G[R].append([C, L])
for i in range... | 35 | 42 | 744 | 966 | INF = 10**18
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
L, R, C = list(map(int, input().split()))
G[L].append([C, R])
G[R].append([C, L])
for i in range(1, N):
G[i + 1].append([0, i])
d = [INF] * (N + 1)
def dijkstra(s):
import heapq
d[s] = 0
... | def main():
import sys
input = sys.stdin.readline
INF = 10**18
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
L, R, C = list(map(int, input().split()))
G[L].append([C, R])
G[R].append([C, L])
for i in range(1, N):
G[i... | false | 16.666667 | [
"-INF = 10**18",
"-N, M = list(map(int, input().split()))",
"-G = [[] for _ in range(N + 1)]",
"-for _ in range(M):",
"- L, R, C = list(map(int, input().split()))",
"- G[L].append([C, R])",
"- G[R].append([C, L])",
"-for i in range(1, N):",
"- G[i + 1].append([0, i])",
"-d = [INF] * (N... | false | 0.046801 | 0.08877 | 0.527216 | [
"s782608975",
"s263789113"
] |
u823513038 | p02389 | python | s812434608 | s865368070 | 30 | 20 | 7,644 | 5,584 | Accepted | Accepted | 33.33 | a, b = list(map(int, input().split()))
print((a * b, 2 * a + 2 * b)) | a, b = list(map(int, input().split()))
print((a * b, (a + b) * 2))
| 2 | 2 | 61 | 60 | a, b = list(map(int, input().split()))
print((a * b, 2 * a + 2 * b))
| a, b = list(map(int, input().split()))
print((a * b, (a + b) * 2))
| false | 0 | [
"-print((a * b, 2 * a + 2 * b))",
"+print((a * b, (a + b) * 2))"
] | false | 0.046923 | 0.04695 | 0.999423 | [
"s812434608",
"s865368070"
] |
u838644735 | p03546 | python | s392083136 | s058252624 | 1,950 | 34 | 3,444 | 3,444 | Accepted | Accepted | 98.26 | def calc_mp(C, candidates, n, ans):
for i in range(len(candidates)):
candidates2 = [c for c in candidates]
c = candidates[i]
del candidates2[i]
a = C[n][c]
if c != 1:
a += calc_mp(C, candidates2, c, ans)
ans = min(a, ans)
return ans
def mai... | def calc_mp(C, d):
for k in range(10):
for i in range(10):
for j in range(10):
if k == 0:
d[i][j][k] = min(C[i][j], C[i][k] + C[k][j])
else:
d[i][j][k] = min(d[i][j][k-1], d[i][k][k-1] + d[k][j][k-1])
def main():
... | 38 | 33 | 986 | 890 | def calc_mp(C, candidates, n, ans):
for i in range(len(candidates)):
candidates2 = [c for c in candidates]
c = candidates[i]
del candidates2[i]
a = C[n][c]
if c != 1:
a += calc_mp(C, candidates2, c, ans)
ans = min(a, ans)
return ans
def main():
H... | def calc_mp(C, d):
for k in range(10):
for i in range(10):
for j in range(10):
if k == 0:
d[i][j][k] = min(C[i][j], C[i][k] + C[k][j])
else:
d[i][j][k] = min(d[i][j][k - 1], d[i][k][k - 1] + d[k][j][k - 1])
def main():
... | false | 13.157895 | [
"-def calc_mp(C, candidates, n, ans):",
"- for i in range(len(candidates)):",
"- candidates2 = [c for c in candidates]",
"- c = candidates[i]",
"- del candidates2[i]",
"- a = C[n][c]",
"- if c != 1:",
"- a += calc_mp(C, candidates2, c, ans)",
"- ... | false | 2.712456 | 0.049556 | 54.735663 | [
"s392083136",
"s058252624"
] |
u784022244 | p02631 | python | s323216385 | s200205157 | 203 | 187 | 94,264 | 105,632 | Accepted | Accepted | 7.88 | N=int(input())
A=list(map(int, input().split()))
"""
20 10100 11010
11 01011 00101
9 01001 00111
24 11000 10110
"""
for i in range(N):
if i==0:
now=A[0]
else:
now=now^A[i]
for i in range(N):
ans=now^A[i]
print(ans, end=" ")
| N=int(input())
A=list(map(int, input().split()))
now=A[0]
for i in range(1,N):
now=now^A[i]
for i in range(N):
print(now^A[i], end=" ")
| 16 | 8 | 271 | 151 | N = int(input())
A = list(map(int, input().split()))
"""
20 10100 11010
11 01011 00101
9 01001 00111
24 11000 10110
"""
for i in range(N):
if i == 0:
now = A[0]
else:
now = now ^ A[i]
for i in range(N):
ans = now ^ A[i]
print(ans, end=" ")
| N = int(input())
A = list(map(int, input().split()))
now = A[0]
for i in range(1, N):
now = now ^ A[i]
for i in range(N):
print(now ^ A[i], end=" ")
| false | 50 | [
"-\"\"\"",
"-20 10100 11010",
"-11 01011 00101",
"-9 01001 00111",
"-24 11000 10110",
"-\"\"\"",
"+now = A[0]",
"+for i in range(1, N):",
"+ now = now ^ A[i]",
"- if i == 0:",
"- now = A[0]",
"- else:",
"- now = now ^ A[i]",
"-for i in range(N):",
"- ans = now ... | false | 0.040762 | 0.041 | 0.9942 | [
"s323216385",
"s200205157"
] |
u145950990 | p02983 | python | s261354643 | s425247216 | 1,549 | 673 | 3,064 | 9,136 | Accepted | Accepted | 56.55 | l,r = list(map(int,input().split()))
ans = 2019
for i in range(l,min(l+2019,r)):
for j in range(l+1,min(l+2019,r+1)):
ans = min(ans,i*j%2019)
print(ans) | l,r = list(map(int,input().split()))
r = min(r,l+2019)
ans = 2019
for i in range(l,r+1):
for j in range(i+1,r+1):
ans = min(ans,i*j%2019)
print(ans) | 6 | 7 | 163 | 160 | l, r = list(map(int, input().split()))
ans = 2019
for i in range(l, min(l + 2019, r)):
for j in range(l + 1, min(l + 2019, r + 1)):
ans = min(ans, i * j % 2019)
print(ans)
| l, r = list(map(int, input().split()))
r = min(r, l + 2019)
ans = 2019
for i in range(l, r + 1):
for j in range(i + 1, r + 1):
ans = min(ans, i * j % 2019)
print(ans)
| false | 14.285714 | [
"+r = min(r, l + 2019)",
"-for i in range(l, min(l + 2019, r)):",
"- for j in range(l + 1, min(l + 2019, r + 1)):",
"+for i in range(l, r + 1):",
"+ for j in range(i + 1, r + 1):"
] | false | 0.14054 | 0.079551 | 1.766657 | [
"s261354643",
"s425247216"
] |
u761320129 | p02626 | python | s807251602 | s026491340 | 32 | 26 | 9,188 | 9,184 | Accepted | Accepted | 18.75 | N = int(eval(input()))
A,B,*C = list(map(int,input().split()))
X = 0
for c in C:
X ^= c
S = A+B
K = 43
dp = [[[-1]*2 for _ in range(2)] for _ in range(K)]
dp[0][0][0] = 0
for i in range(K-1):
cx = (X>>i)&1
cs = (S>>i)&1
ca = (A>>i)&1
for j in range(2):
for k in range(2):
... | N = int(eval(input()))
A,B,*C = list(map(int,input().split()))
X = 0
for c in C:
X ^= c
S = A+B
K = 43
dp = [[[-1]*2 for _ in range(2)] for _ in range(K)]
dp[0][0][0] = 0
for i in range(K-1):
cx = (X>>i)&1
cs = (S>>i)&1
ca = (A>>i)&1
for j in range(2):
for k in range(2):
... | 36 | 35 | 938 | 841 | N = int(eval(input()))
A, B, *C = list(map(int, input().split()))
X = 0
for c in C:
X ^= c
S = A + B
K = 43
dp = [[[-1] * 2 for _ in range(2)] for _ in range(K)]
dp[0][0][0] = 0
for i in range(K - 1):
cx = (X >> i) & 1
cs = (S >> i) & 1
ca = (A >> i) & 1
for j in range(2):
for k in range(2):... | N = int(eval(input()))
A, B, *C = list(map(int, input().split()))
X = 0
for c in C:
X ^= c
S = A + B
K = 43
dp = [[[-1] * 2 for _ in range(2)] for _ in range(K)]
dp[0][0][0] = 0
for i in range(K - 1):
cx = (X >> i) & 1
cs = (S >> i) & 1
ca = (A >> i) & 1
for j in range(2):
for k in range(2):... | false | 2.777778 | [
"- for nb in range(2):",
"- if (na ^ nb) != cx:",
"- continue",
"- ns = na + nb + j",
"- if ns % 2 != cs:",
"- continue",
"- nj = ns // 2",
"- if ... | false | 0.040451 | 0.040246 | 1.005084 | [
"s807251602",
"s026491340"
] |
u600402037 | p02845 | python | s381241139 | s556890231 | 318 | 120 | 14,008 | 14,008 | Accepted | Accepted | 62.26 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = lr()
hat = [0, 0, 0]
MOD = 10 ** 9 + 7
answer = 1
for i in range(N):
x = hat.count(A[i])
if x == 0:
answer = 0
else:
answer *= x
j = ... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = lr()
hat = [0, 0, 0]
MOD = 10 ** 9 + 7
answer = 1
for i in range(N):
x = hat.count(A[i])
if x == 0:
answer = 0
else:
answer *= x
j = ... | 22 | 23 | 383 | 407 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = lr()
hat = [0, 0, 0]
MOD = 10**9 + 7
answer = 1
for i in range(N):
x = hat.count(A[i])
if x == 0:
answer = 0
else:
answer *= x
j = hat.index(A[i])
... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = lr()
hat = [0, 0, 0]
MOD = 10**9 + 7
answer = 1
for i in range(N):
x = hat.count(A[i])
if x == 0:
answer = 0
else:
answer *= x
j = hat.index(A[i])
... | false | 4.347826 | [
"+ answer %= MOD"
] | false | 0.037828 | 0.037174 | 1.017585 | [
"s381241139",
"s556890231"
] |
u687135117 | p02693 | python | s403302813 | s438533591 | 22 | 19 | 9,108 | 9,108 | Accepted | Accepted | 13.64 | #import collections
# c = collections.Counter()
#import itertools as it
#import math
#import numpy as np
#import sys
#sys.exit()
# = input()
k = int(eval(input()))
a, b = list(map(int, input().split()))
'''
# = list(map(int, input().split()))
'''
'''
n = input()
a = [int(input()) for i in range(n... | k = int(eval(input()))
a,b = list(map(int, input().split()))
if a%k==0 or b%k==0 or a//k!=b//k:
print('OK')
else:
print('NG') | 29 | 7 | 527 | 125 | # import collections
# c = collections.Counter()
# import itertools as it
# import math
# import numpy as np
# import sys
# sys.exit()
# = input()
k = int(eval(input()))
a, b = list(map(int, input().split()))
"""
# = list(map(int, input().split()))
"""
"""
n = input()
a = [int(input()) for i in range(n)]
"""
"""
n,m ... | k = int(eval(input()))
a, b = list(map(int, input().split()))
if a % k == 0 or b % k == 0 or a // k != b // k:
print("OK")
else:
print("NG")
| false | 75.862069 | [
"-# import collections",
"-# c = collections.Counter()",
"-# import itertools as it",
"-# import math",
"-# import numpy as np",
"-# import sys",
"-# sys.exit()",
"-# = input()",
"-\"\"\"",
"-# = list(map(int, input().split()))",
"-\"\"\"",
"-\"\"\"",
"-n = input()",
"-a = [int(input()) ... | false | 0.070715 | 0.037561 | 1.882686 | [
"s403302813",
"s438533591"
] |
u841623074 | p03608 | python | s297115580 | s348092998 | 832 | 647 | 28,100 | 18,528 | Accepted | Accepted | 22.24 | from itertools import permutations as p
from scipy.sparse.csgraph import floyd_warshall
n, m, r = list(map(int, input().split()))
R = list(map(int, input().split()))
l = [[0]*n for _ in range(n)]
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
l[a][b] = c
l... | from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall
n,m,r=list(map(int,input().split()))
R=list(map(int,input().split()))
l=[[float('inf')]*n for _ in range(n)]
for _ in range(m):
a,b,c,=list(map(int,input().split()))
a-=1
b-=1
l[a][b]=c
l[b][a]=c
for i in r... | 22 | 29 | 500 | 748 | from itertools import permutations as p
from scipy.sparse.csgraph import floyd_warshall
n, m, r = list(map(int, input().split()))
R = list(map(int, input().split()))
l = [[0] * n for _ in range(n)]
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
l[a][b] = c
l[b][a] = c
F ... | from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall
n, m, r = list(map(int, input().split()))
R = list(map(int, input().split()))
l = [[float("inf")] * n for _ in range(n)]
for _ in range(m):
(
a,
b,
c,
) = list(map(int, input().split()))
a -= 1
b ... | false | 24.137931 | [
"-from itertools import permutations as p",
"+from itertools import permutations",
"-l = [[0] * n for _ in range(n)]",
"+l = [[float(\"inf\")] * n for _ in range(n)]",
"- a, b, c = list(map(int, input().split()))",
"+ (",
"+ a,",
"+ b,",
"+ c,",
"+ ) = list(map(int, i... | false | 0.410212 | 0.303801 | 1.350263 | [
"s297115580",
"s348092998"
] |
u131634965 | p03370 | python | s111447802 | s999846244 | 37 | 17 | 3,064 | 2,940 | Accepted | Accepted | 54.05 | n,x=list(map(int, input().split()))
m=[int(eval(input())) for _ in range(n)]
count=0
for i in range(len(m)):
if x>=m[i]:
x-=m[i]
count+=1
min_donut=min(m)
while(x>=min_donut):
x-=min_donut
count+=1
print(count) | n,x=list(map(int, input().split()))
m=[int(eval(input())) for _ in range(n)]
print(((x-sum(m))//min(m)+n)) | 16 | 4 | 257 | 96 | n, x = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(n)]
count = 0
for i in range(len(m)):
if x >= m[i]:
x -= m[i]
count += 1
min_donut = min(m)
while x >= min_donut:
x -= min_donut
count += 1
print(count)
| n, x = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(n)]
print(((x - sum(m)) // min(m) + n))
| false | 75 | [
"-count = 0",
"-for i in range(len(m)):",
"- if x >= m[i]:",
"- x -= m[i]",
"- count += 1",
"-min_donut = min(m)",
"-while x >= min_donut:",
"- x -= min_donut",
"- count += 1",
"-print(count)",
"+print(((x - sum(m)) // min(m) + n))"
] | false | 0.037596 | 0.081274 | 0.462585 | [
"s111447802",
"s999846244"
] |
u133936772 | p02881 | python | s573278545 | s764916562 | 152 | 131 | 2,940 | 2,940 | Accepted | Accepted | 13.82 | n=int(eval(input()))
for i in range(int(n**.5),0,-1):
if n%i<1: print((i+n//i-2)); break | n=int(eval(input()))
print((min(i+n//i-2 for i in range(1,int(n**.5)+1) if n%i<1))) | 3 | 2 | 84 | 76 | n = int(eval(input()))
for i in range(int(n**0.5), 0, -1):
if n % i < 1:
print((i + n // i - 2))
break
| n = int(eval(input()))
print((min(i + n // i - 2 for i in range(1, int(n**0.5) + 1) if n % i < 1)))
| false | 33.333333 | [
"-for i in range(int(n**0.5), 0, -1):",
"- if n % i < 1:",
"- print((i + n // i - 2))",
"- break",
"+print((min(i + n // i - 2 for i in range(1, int(n**0.5) + 1) if n % i < 1)))"
] | false | 0.047772 | 0.05021 | 0.951439 | [
"s573278545",
"s764916562"
] |
u923270446 | p02685 | python | s882878275 | s950916114 | 1,298 | 278 | 9,236 | 79,600 | Accepted | Accepted | 78.58 | n, m, k = list(map(int, input().split()))
mod = 998244353
ans = 0
x = 1
for i in range(k + 1):
ans += (((m * pow(m - 1, n - i - 1, mod)) % mod) * x) % mod
ans %= mod
x = (x * (n - i - 1) * pow(i + 1, mod - 2, mod)) % mod
print((ans % mod)) | mod = 998244353
def comb(n, r):
if n < r:return 0
if n < 0 or r < 0:return 0
return fa[n] * fi[r] % mod * fi[n - r] % mod
n, m, k = list(map(int, input().split()))
fa = [1] * (n + 1)
fi = [1] * (n + 1)
for i in range(1, n + 1):
fa[i] = fa[i - 1] * i % mod
fi[i] = pow(fa[i], mod - 2, mod)
... | 9 | 16 | 251 | 445 | n, m, k = list(map(int, input().split()))
mod = 998244353
ans = 0
x = 1
for i in range(k + 1):
ans += (((m * pow(m - 1, n - i - 1, mod)) % mod) * x) % mod
ans %= mod
x = (x * (n - i - 1) * pow(i + 1, mod - 2, mod)) % mod
print((ans % mod))
| mod = 998244353
def comb(n, r):
if n < r:
return 0
if n < 0 or r < 0:
return 0
return fa[n] * fi[r] % mod * fi[n - r] % mod
n, m, k = list(map(int, input().split()))
fa = [1] * (n + 1)
fi = [1] * (n + 1)
for i in range(1, n + 1):
fa[i] = fa[i - 1] * i % mod
fi[i] = pow(fa[i], mod... | false | 43.75 | [
"+mod = 998244353",
"+",
"+",
"+def comb(n, r):",
"+ if n < r:",
"+ return 0",
"+ if n < 0 or r < 0:",
"+ return 0",
"+ return fa[n] * fi[r] % mod * fi[n - r] % mod",
"+",
"+",
"-mod = 998244353",
"+fa = [1] * (n + 1)",
"+fi = [1] * (n + 1)",
"+for i in range(1, n ... | false | 0.065686 | 0.128557 | 0.510951 | [
"s882878275",
"s950916114"
] |
u801359367 | p03325 | python | s593307374 | s385216829 | 155 | 104 | 4,148 | 4,152 | Accepted | Accepted | 32.9 | N = int(eval(input()))
A = list(map(int,input().split()))
count_A =[]
for i in range(N):
count = 0
while A[i]%2 == 0:
A[i] = A[i]/2
count += 1
count_A.append(count)
print((sum(count_A))) | N = int(eval(input()))
A = list(map(int,input().split()))
SUM = 0
for i in A:
count = 0
while i%2 == 0:
i = i/2
count += 1
SUM+=count
print(SUM) | 12 | 11 | 219 | 177 | N = int(eval(input()))
A = list(map(int, input().split()))
count_A = []
for i in range(N):
count = 0
while A[i] % 2 == 0:
A[i] = A[i] / 2
count += 1
count_A.append(count)
print((sum(count_A)))
| N = int(eval(input()))
A = list(map(int, input().split()))
SUM = 0
for i in A:
count = 0
while i % 2 == 0:
i = i / 2
count += 1
SUM += count
print(SUM)
| false | 8.333333 | [
"-count_A = []",
"-for i in range(N):",
"+SUM = 0",
"+for i in A:",
"- while A[i] % 2 == 0:",
"- A[i] = A[i] / 2",
"+ while i % 2 == 0:",
"+ i = i / 2",
"- count_A.append(count)",
"-print((sum(count_A)))",
"+ SUM += count",
"+print(SUM)"
] | false | 0.04289 | 0.038613 | 1.110754 | [
"s593307374",
"s385216829"
] |
u912237403 | p00068 | python | s103941281 | s994927518 | 20 | 10 | 4,280 | 4,276 | Accepted | Accepted | 50 | import sys
def side(p1, p2, p3):
y1,x1=p1
y2,x2=p2
y3,x3=p3
return (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)>0
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
p1=D[0]
D1=D[:]
while True:
for p2 in D1:
if p1==p2:continue
for p3 in D[::-1]:... | import sys
def side(p1,p2):
global D
y1,x1=p1
y2,x2=p2
dy=y2-y1
dx=x2-x1
for p3 in D[::-1]:
if p1==p3 or p2==p3:continue
y3,x3=p3
if (x3-x1)*dy-dx*(y3-y1)<0:return 0
else:return 1
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
... | 23 | 26 | 471 | 469 | import sys
def side(p1, p2, p3):
y1, x1 = p1
y2, x2 = p2
y3, x3 = p3
return (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) > 0
while 1:
n = eval(input())
if n == 0:
break
D = sorted([list(eval(input())) for i in range(n)])
p1 = D[0]
D1 = D[:]
while True:
for p2... | import sys
def side(p1, p2):
global D
y1, x1 = p1
y2, x2 = p2
dy = y2 - y1
dx = x2 - x1
for p3 in D[::-1]:
if p1 == p3 or p2 == p3:
continue
y3, x3 = p3
if (x3 - x1) * dy - dx * (y3 - y1) < 0:
return 0
else:
return 1
while 1:
n ... | false | 11.538462 | [
"-def side(p1, p2, p3):",
"+def side(p1, p2):",
"+ global D",
"- y3, x3 = p3",
"- return (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) > 0",
"+ dy = y2 - y1",
"+ dx = x2 - x1",
"+ for p3 in D[::-1]:",
"+ if p1 == p3 or p2 == p3:",
"+ continue",
"+ y3, x... | false | 0.039148 | 0.039302 | 0.996074 | [
"s103941281",
"s994927518"
] |
u211706121 | p02580 | python | s415565043 | s200952120 | 1,003 | 654 | 210,420 | 225,432 | Accepted | Accepted | 34.8 |
from collections import defaultdict
H,W,M=list(map(int,input().split()))
AB=[tuple(map(int,input().split()))for i in range(M)]
AB=[(a-1,b-1)for a,b in AB]
st=set(AB)
Wc=defaultdict(lambda :0)
Hc=defaultdict(lambda :0)
for a,b in AB:
Hc[a]+=1
Wc[b]+=1
Hm=max(Hc.values())
hhh=list(Hc.keys())
w... | H,W,M=list(map(int,input().split()))
HW=[tuple(map(int,input().split()))for i in range(M)]
HW=[(h-1,w-1)for h,w in HW]
st=set(HW)
countH=[0]*H
countW=[0]*W
for h,w in HW:
countH[h]+=1
countW[w]+=1
maxH=max(countH)
maxW=max(countW)
candiH=[]
candiW=[]
for i in range(H):
if maxH==countH[i]:
... | 37 | 30 | 701 | 606 | from collections import defaultdict
H, W, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for i in range(M)]
AB = [(a - 1, b - 1) for a, b in AB]
st = set(AB)
Wc = defaultdict(lambda: 0)
Hc = defaultdict(lambda: 0)
for a, b in AB:
Hc[a] += 1
Wc[b] += 1
Hm = max(Hc.values())
hhh = lis... | H, W, M = list(map(int, input().split()))
HW = [tuple(map(int, input().split())) for i in range(M)]
HW = [(h - 1, w - 1) for h, w in HW]
st = set(HW)
countH = [0] * H
countW = [0] * W
for h, w in HW:
countH[h] += 1
countW[w] += 1
maxH = max(countH)
maxW = max(countW)
candiH = []
candiW = []
for i in range(H):
... | false | 18.918919 | [
"-from collections import defaultdict",
"-",
"-AB = [tuple(map(int, input().split())) for i in range(M)]",
"-AB = [(a - 1, b - 1) for a, b in AB]",
"-st = set(AB)",
"-Wc = defaultdict(lambda: 0)",
"-Hc = defaultdict(lambda: 0)",
"-for a, b in AB:",
"- Hc[a] += 1",
"- Wc[b] += 1",
"-Hm = ma... | false | 0.138216 | 0.081781 | 1.69008 | [
"s415565043",
"s200952120"
] |
u901582103 | p02912 | python | s101555955 | s054359437 | 162 | 145 | 14,180 | 14,180 | Accepted | Accepted | 10.49 | from heapq import heappop, heappush
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
B=sorted([x * -1 for x in A])
for i in range(m):
a=heappop(B)
a=-(-a//2)
heappush(B,a)
print((-sum(B))) | from heapq import heappop,heappush,heapify
n,m=list(map(int,input().split()))
A=[-i for i in list(map(int,input().split()))]
heapify(A)
for i in range(m):
a=heappop(A)
heappush(A,-(-a//2))
print((-sum(A))) | 9 | 8 | 224 | 206 | from heapq import heappop, heappush
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
B = sorted([x * -1 for x in A])
for i in range(m):
a = heappop(B)
a = -(-a // 2)
heappush(B, a)
print((-sum(B)))
| from heapq import heappop, heappush, heapify
n, m = list(map(int, input().split()))
A = [-i for i in list(map(int, input().split()))]
heapify(A)
for i in range(m):
a = heappop(A)
heappush(A, -(-a // 2))
print((-sum(A)))
| false | 11.111111 | [
"-from heapq import heappop, heappush",
"+from heapq import heappop, heappush, heapify",
"-A = list(map(int, input().split()))",
"-B = sorted([x * -1 for x in A])",
"+A = [-i for i in list(map(int, input().split()))]",
"+heapify(A)",
"- a = heappop(B)",
"- a = -(-a // 2)",
"- heappush(B, a)... | false | 0.085978 | 0.086452 | 0.99451 | [
"s101555955",
"s054359437"
] |
u064505481 | p03165 | python | s843773839 | s452942876 | 628 | 426 | 123,996 | 153,872 | Accepted | Accepted | 32.17 | from sys import stdin, stdout
from collections import deque, defaultdict
import math as m
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float('inf'), float('-inf')
def main():
s = rll()[0]
t = rll()[0]
m, n = le... | from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
rlf = lambda: list(map(float, stdin.re... | 57 | 45 | 1,257 | 1,196 | from sys import stdin, stdout
from collections import deque, defaultdict
import math as m
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")
def main():
s = rll()[0]
t = rll()[0]
m, n = len(s)... | from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
rlf = lambda: list(map(float, stdin.readline()... | false | 21.052632 | [
"-from sys import stdin, stdout",
"-from collections import deque, defaultdict",
"-import math as m",
"+from sys import stdin, stdout, setrecursionlimit",
"+from collections import deque, defaultdict, Counter",
"+from heapq import heappush, heappop",
"+import math",
"+rlf = lambda: list(map(float, std... | false | 0.110277 | 0.0467 | 2.3614 | [
"s843773839",
"s452942876"
] |
u119982001 | p03681 | python | s365824356 | s804033139 | 711 | 64 | 5,180 | 3,060 | Accepted | Accepted | 91 | from math import factorial as frac
N, M = list(map(int, input().split()))
INF = 10**9 + 7
if abs(N-M) > 1:
print((0))
elif abs(N-M) == 1:
print((frac(N)*frac(M)%INF))
else:
print((((frac(N)*frac(M))*2)%INF))
| from math import factorial as frac
N, M = list(map(int, input().split()))
MOD = 10**9 + 7
def nPk(n, k):
r = 1
while k > 0:
r *= n
r %= MOD
n -= 1
k -= 1
return r
if abs(N-M) > 1:
print((0))
elif N==M:
print((((nPk(N,N)*nPk(M,M))*2)%MOD))
else:... | 12 | 21 | 222 | 345 | from math import factorial as frac
N, M = list(map(int, input().split()))
INF = 10**9 + 7
if abs(N - M) > 1:
print((0))
elif abs(N - M) == 1:
print((frac(N) * frac(M) % INF))
else:
print((((frac(N) * frac(M)) * 2) % INF))
| from math import factorial as frac
N, M = list(map(int, input().split()))
MOD = 10**9 + 7
def nPk(n, k):
r = 1
while k > 0:
r *= n
r %= MOD
n -= 1
k -= 1
return r
if abs(N - M) > 1:
print((0))
elif N == M:
print((((nPk(N, N) * nPk(M, M)) * 2) % MOD))
else:
pr... | false | 42.857143 | [
"-INF = 10**9 + 7",
"+MOD = 10**9 + 7",
"+",
"+",
"+def nPk(n, k):",
"+ r = 1",
"+ while k > 0:",
"+ r *= n",
"+ r %= MOD",
"+ n -= 1",
"+ k -= 1",
"+ return r",
"+",
"+",
"-elif abs(N - M) == 1:",
"- print((frac(N) * frac(M) % INF))",
"+elif N... | false | 0.042638 | 0.038583 | 1.105108 | [
"s365824356",
"s804033139"
] |
u020373088 | p03416 | python | s510622669 | s710017761 | 61 | 18 | 2,940 | 3,060 | Accepted | Accepted | 70.49 | a, b = list(map(int, input().split()))
ans = 0
for i in range(a,b+1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans) | a, b = list(map(int, input().split()))
ans = 0
for i in range(1,10):
for j in range(0,10):
for k in range(0,10):
x = 10000*i + 1000*j + 100*k + 10*j + i
if a <= x <= b:
ans += 1
print(ans) | 6 | 9 | 121 | 216 | a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans)
| a, b = list(map(int, input().split()))
ans = 0
for i in range(1, 10):
for j in range(0, 10):
for k in range(0, 10):
x = 10000 * i + 1000 * j + 100 * k + 10 * j + i
if a <= x <= b:
ans += 1
print(ans)
| false | 33.333333 | [
"-for i in range(a, b + 1):",
"- if str(i) == str(i)[::-1]:",
"- ans += 1",
"+for i in range(1, 10):",
"+ for j in range(0, 10):",
"+ for k in range(0, 10):",
"+ x = 10000 * i + 1000 * j + 100 * k + 10 * j + i",
"+ if a <= x <= b:",
"+ ans += ... | false | 0.059931 | 0.073096 | 0.819901 | [
"s510622669",
"s710017761"
] |
u131625544 | p02983 | python | s579769495 | s040057190 | 1,508 | 205 | 3,064 | 39,024 | Accepted | Accepted | 86.41 | L, R = (int(i) for i in input().split())
if (R - L) <= 2019:
temp1 = float("inf")
for i in range(R - L):
for j in range(R - L):
temp2 = ((R-i) * (R - 1 -j)) % 2019
if temp2 < temp1:
temp1 = temp2
print(temp1)
else:
temp1 = float("inf")
for... | import sys
input = sys.stdin.readline
class Solution:
def main(self):
L, R = list(map(int, input().split()))
ans = 2019
for i in range(L, min(R + 1, L + 2019)):
for j in range(i + 1, min(R + 1, L + 2019)):
ans = min(ans, (i * j) % 2019)
... | 20 | 20 | 545 | 392 | L, R = (int(i) for i in input().split())
if (R - L) <= 2019:
temp1 = float("inf")
for i in range(R - L):
for j in range(R - L):
temp2 = ((R - i) * (R - 1 - j)) % 2019
if temp2 < temp1:
temp1 = temp2
print(temp1)
else:
temp1 = float("inf")
for i in rang... | import sys
input = sys.stdin.readline
class Solution:
def main(self):
L, R = list(map(int, input().split()))
ans = 2019
for i in range(L, min(R + 1, L + 2019)):
for j in range(i + 1, min(R + 1, L + 2019)):
ans = min(ans, (i * j) % 2019)
print(ans)
# R... | false | 0 | [
"-L, R = (int(i) for i in input().split())",
"-if (R - L) <= 2019:",
"- temp1 = float(\"inf\")",
"- for i in range(R - L):",
"- for j in range(R - L):",
"- temp2 = ((R - i) * (R - 1 - j)) % 2019",
"- if temp2 < temp1:",
"- temp1 = temp2",
"- print... | false | 0.199857 | 0.007308 | 27.346421 | [
"s579769495",
"s040057190"
] |
u604774382 | p02382 | python | s492115957 | s488661927 | 40 | 20 | 6,868 | 5,720 | Accepted | Accepted | 50 | import math
def getDistance( x, y, n, p ):
dxy = 0
for i in range( n ):
dxy += abs( x[i] - y[i] )**p
return dxy**(1/float( p ) )
n = int( eval(input()) )
x = [ float( i ) for i in input( ).split( " " ) ]
y = [ float( i ) for i in input( ).split( " " ) ]
print(( getDistance( x, y, n, 1 ) ))
print(( ... | import math
n = int( eval(input()) )
x = [ float( val ) for val in input().split( ' ' ) ]
y = [ float( val ) for val in input().split( ' ' ) ]
Dxy = Dxy2 = Dxy3 = Dxyp = 0
for i in range( n ):
t = abs(x[i]-y[i])
Dxy += t
Dxy2 += t**2
Dxy3 += t**3
Dxyp = max( Dxyp, t )
print( Dxy )
print(( Dxy2**(1/... | 20 | 18 | 468 | 357 | import math
def getDistance(x, y, n, p):
dxy = 0
for i in range(n):
dxy += abs(x[i] - y[i]) ** p
return dxy ** (1 / float(p))
n = int(eval(input()))
x = [float(i) for i in input().split(" ")]
y = [float(i) for i in input().split(" ")]
print((getDistance(x, y, n, 1)))
print((getDistance(x, y, n, ... | import math
n = int(eval(input()))
x = [float(val) for val in input().split(" ")]
y = [float(val) for val in input().split(" ")]
Dxy = Dxy2 = Dxy3 = Dxyp = 0
for i in range(n):
t = abs(x[i] - y[i])
Dxy += t
Dxy2 += t**2
Dxy3 += t**3
Dxyp = max(Dxyp, t)
print(Dxy)
print((Dxy2 ** (1 / 2)))
print((Dxy... | false | 10 | [
"-",
"-def getDistance(x, y, n, p):",
"- dxy = 0",
"- for i in range(n):",
"- dxy += abs(x[i] - y[i]) ** p",
"- return dxy ** (1 / float(p))",
"-",
"-",
"-x = [float(i) for i in input().split(\" \")]",
"-y = [float(i) for i in input().split(\" \")]",
"-print((getDistance(x, y, n,... | false | 0.117339 | 0.048491 | 2.419831 | [
"s492115957",
"s488661927"
] |
u844789719 | p03725 | python | s401399920 | s080558292 | 674 | 616 | 107,228 | 101,212 | Accepted | Accepted | 8.61 | import itertools, math, collections, sys
input = sys.stdin.readline
H, W, K = [int(_) for _ in input().split()]
A = [list(eval(input())) for _ in range(H)]
for h, w in itertools.product(list(range(H)), list(range(W))):
if A[h][w] == 'S':
break
visited = [['.'] * W for _ in range(H)]
res = K - 1
Q =... | import itertools, math, collections, sys
input = sys.stdin.readline
H, W, K = [int(_) for _ in input().split()]
A = [list(eval(input())) for _ in range(H)]
for h, w in itertools.product(list(range(H)), list(range(W))):
if A[h][w] == 'S':
break
visited = A
res = K - 1
Q = collections.deque([[h - 1, ... | 26 | 26 | 889 | 861 | import itertools, math, collections, sys
input = sys.stdin.readline
H, W, K = [int(_) for _ in input().split()]
A = [list(eval(input())) for _ in range(H)]
for h, w in itertools.product(list(range(H)), list(range(W))):
if A[h][w] == "S":
break
visited = [["."] * W for _ in range(H)]
res = K - 1
Q = collect... | import itertools, math, collections, sys
input = sys.stdin.readline
H, W, K = [int(_) for _ in input().split()]
A = [list(eval(input())) for _ in range(H)]
for h, w in itertools.product(list(range(H)), list(range(W))):
if A[h][w] == "S":
break
visited = A
res = K - 1
Q = collections.deque(
[[h - 1, w, ... | false | 0 | [
"-visited = [[\".\"] * W for _ in range(H)]",
"+visited = A"
] | false | 0.117677 | 0.11672 | 1.008194 | [
"s401399920",
"s080558292"
] |
u952708174 | p03634 | python | s829625972 | s099028759 | 1,270 | 1,119 | 89,924 | 88,688 | Accepted | Accepted | 11.89 | def Q4(x):
N = x[0][0] # 木の頂点数
edge = x[1:N][:] # 辺とその距離
Q = x[N][0] # クエリ数
K = x[N][1] # 経由すべき頂点の番号
query = x[N + 1:][:] # クエリの内容
# 木の初期化
tree = list(range(N)) # adjacent(隣接)のほうがいいかな?
for idx in range(N):
tree[idx] = []
for idx in range(len(edge)):
... | def d_transit_tree_path(N, E, Q, K, V):
# 頂点数、辺とそのコスト、クエリの数、経由する頂点、出発/到達頂点
# 隣接リストの作成
edge = [[] for _ in range(N)]
for a, b, c in E:
edge[a - 1].append([b - 1, c])
edge[b - 1].append([a - 1, c])
# Kから各節点への距離を求める
dist = [0 for i in range(N)] # 頂点Kからの距離
is_visit ... | 45 | 34 | 1,275 | 1,007 | def Q4(x):
N = x[0][0] # 木の頂点数
edge = x[1:N][:] # 辺とその距離
Q = x[N][0] # クエリ数
K = x[N][1] # 経由すべき頂点の番号
query = x[N + 1 :][:] # クエリの内容
# 木の初期化
tree = list(range(N)) # adjacent(隣接)のほうがいいかな?
for idx in range(N):
tree[idx] = []
for idx in range(len(edge)):
# i番目の要素は、節... | def d_transit_tree_path(N, E, Q, K, V):
# 頂点数、辺とそのコスト、クエリの数、経由する頂点、出発/到達頂点
# 隣接リストの作成
edge = [[] for _ in range(N)]
for a, b, c in E:
edge[a - 1].append([b - 1, c])
edge[b - 1].append([a - 1, c])
# Kから各節点への距離を求める
dist = [0 for i in range(N)] # 頂点Kからの距離
is_visit = [False for ... | false | 24.444444 | [
"-def Q4(x):",
"- N = x[0][0] # 木の頂点数",
"- edge = x[1:N][:] # 辺とその距離",
"- Q = x[N][0] # クエリ数",
"- K = x[N][1] # 経由すべき頂点の番号",
"- query = x[N + 1 :][:] # クエリの内容",
"- # 木の初期化",
"- tree = list(range(N)) # adjacent(隣接)のほうがいいかな?",
"- for idx in range(N):",
"- tree[id... | false | 0.041596 | 0.043331 | 0.959958 | [
"s829625972",
"s099028759"
] |
u186838327 | p02972 | python | s794729178 | s762989573 | 881 | 337 | 19,004 | 66,780 | Accepted | Accepted | 61.75 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = [0]*n
for i in reversed(list(range(n))):
j = i+1
b = 0
while j <= n:
b += ans[j-1]
j += i+1
if b%2 != l[i]:
ans[i] = 1
print((sum(ans)))
print((' '.join(map(str, [i+1 for i, x in enumerate(ans) if x!= 0])))) | n = int(eval(input()))
A = list(map(int, input().split()))
B = [0]*n
for i in reversed(list(range(n))):
j = i+1
cnt = 0
while j <= n:
cnt += B[j-1]
j += i+1
if cnt%2 != A[i]:
B[i] = 1
m = 0
ans = []
for i, b in enumerate(B):
if b != 0:
m += 1
... | 16 | 23 | 294 | 373 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = [0] * n
for i in reversed(list(range(n))):
j = i + 1
b = 0
while j <= n:
b += ans[j - 1]
j += i + 1
if b % 2 != l[i]:
ans[i] = 1
print((sum(ans)))
print((" ".join(map(str, [i + 1 for i, x in enumerate(ans) if x != 0... | n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * n
for i in reversed(list(range(n))):
j = i + 1
cnt = 0
while j <= n:
cnt += B[j - 1]
j += i + 1
if cnt % 2 != A[i]:
B[i] = 1
m = 0
ans = []
for i, b in enumerate(B):
if b != 0:
m += 1
ans.app... | false | 30.434783 | [
"-l = list(map(int, input().split()))",
"-ans = [0] * n",
"+A = list(map(int, input().split()))",
"+B = [0] * n",
"- b = 0",
"+ cnt = 0",
"- b += ans[j - 1]",
"+ cnt += B[j - 1]",
"- if b % 2 != l[i]:",
"- ans[i] = 1",
"-print((sum(ans)))",
"-print((\" \".join(map... | false | 0.038052 | 0.045825 | 0.830391 | [
"s794729178",
"s762989573"
] |
u595289165 | p03044 | python | s547690167 | s964491031 | 681 | 402 | 50,852 | 111,416 | Accepted | Accepted | 40.97 | from collections import deque
n = int(eval(input()))
tree = [[] for _ in range(n+1)]
color1 = [-1] * (n+1)
color1[1] = 0
color2 = [-1] * (n+1)
color2[1] = 1
for _ in range(n-1):
u, v, w = list(map(int, input().split()))
tree[u].append((v, w))
tree[v].append((u, w))
q = deque([1])
visited = {... | n = int(eval(input()))
tree = [[] for _ in range(n+1)]
for _ in range(n-1):
u, v, w = list(map(int, input().split()))
tree[u].append([v, w])
tree[v].append([u, w])
color = [-1] * (n+1)
color[1] = 0
stack = [1]
while stack:
node = stack.pop()
for vertex, weight in tree[node]:
... | 36 | 25 | 775 | 487 | from collections import deque
n = int(eval(input()))
tree = [[] for _ in range(n + 1)]
color1 = [-1] * (n + 1)
color1[1] = 0
color2 = [-1] * (n + 1)
color2[1] = 1
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
tree[u].append((v, w))
tree[v].append((u, w))
q = deque([1])
visited = {1}
whil... | n = int(eval(input()))
tree = [[] for _ in range(n + 1)]
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
tree[u].append([v, w])
tree[v].append([u, w])
color = [-1] * (n + 1)
color[1] = 0
stack = [1]
while stack:
node = stack.pop()
for vertex, weight in tree[node]:
if color[v... | false | 30.555556 | [
"-from collections import deque",
"-",
"-color1 = [-1] * (n + 1)",
"-color1[1] = 0",
"-color2 = [-1] * (n + 1)",
"-color2[1] = 1",
"- tree[u].append((v, w))",
"- tree[v].append((u, w))",
"-q = deque([1])",
"-visited = {1}",
"-while len(q) > 0:",
"- now = q.popleft()",
"- visited.... | false | 0.099592 | 0.110952 | 0.897617 | [
"s547690167",
"s964491031"
] |
u210827208 | p03426 | python | s380332994 | s076806757 | 1,234 | 957 | 45,992 | 20,712 | Accepted | Accepted | 22.45 | H,W,D=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(eval(input()))
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
for j in range(W):
X[A[i][j]%D][A[i][j]//D][0]=i
X[A[i][j]%D][A[i][j]//D][1]=j
M=[[0]*((H*W)//D+1) for _ ... | H,W,D=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(eval(input()))
X=[[0,0] for _ in range(H*W+1)]
for i in range(H):
for j in range(W):
X[A[i][j]][0]=i
X[A[i][j]][1]=j
M=[0]*(H*W+1)
for d in range(D+1,H*W+1):
M[d]=abs(X[d][0]-X[d-D][0])+... | 16 | 15 | 550 | 415 | H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
Q = int(eval(input()))
X = [[[0, 0] for _ in range((H * W) // D + 1)] for _ in range(D)]
for i in range(H):
for j in range(W):
X[A[i][j] % D][A[i][j] // D][0] = i
X[A[i][j] % D][A[i][j] // D][1] = j
M =... | H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
Q = int(eval(input()))
X = [[0, 0] for _ in range(H * W + 1)]
for i in range(H):
for j in range(W):
X[A[i][j]][0] = i
X[A[i][j]][1] = j
M = [0] * (H * W + 1)
for d in range(D + 1, H * W + 1):
M[d] =... | false | 6.25 | [
"-X = [[[0, 0] for _ in range((H * W) // D + 1)] for _ in range(D)]",
"+X = [[0, 0] for _ in range(H * W + 1)]",
"- X[A[i][j] % D][A[i][j] // D][0] = i",
"- X[A[i][j] % D][A[i][j] // D][1] = j",
"-M = [[0] * ((H * W) // D + 1) for _ in range(D)]",
"-for d in range(D):",
"- for k in rang... | false | 0.041433 | 0.040649 | 1.019289 | [
"s380332994",
"s076806757"
] |
u347640436 | p03504 | python | s060132641 | s440771520 | 1,815 | 601 | 53,492 | 35,464 | Accepted | Accepted | 66.89 | N, C = list(map(int, input().split()))
tt = [[0] * (2 * 10 ** 5 + 1) for _ in range(30)]
for _ in range(N):
s, t, c = list(map(int, input().split()))
ttc = tt[c - 1]
for i in range(s * 2 - 1, t * 2):
ttc[i] = 1
ct = [0] * (2 * 10 ** 5 + 1)
for i in range(30):
tti = tt[i]
for j ... | from operator import itemgetter
N, C = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(N)]
stc.sort(key=itemgetter(2, 0))
cs = [0] * (10 ** 5 * 2 + 1)
pc = -1
for s, t, c in stc:
if pc != c:
pt = -1
pc = c
if pt == s:
cs[s * 2] += 1
... | 16 | 23 | 378 | 464 | N, C = list(map(int, input().split()))
tt = [[0] * (2 * 10**5 + 1) for _ in range(30)]
for _ in range(N):
s, t, c = list(map(int, input().split()))
ttc = tt[c - 1]
for i in range(s * 2 - 1, t * 2):
ttc[i] = 1
ct = [0] * (2 * 10**5 + 1)
for i in range(30):
tti = tt[i]
for j in range(2 * 10**5... | from operator import itemgetter
N, C = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(N)]
stc.sort(key=itemgetter(2, 0))
cs = [0] * (10**5 * 2 + 1)
pc = -1
for s, t, c in stc:
if pc != c:
pt = -1
pc = c
if pt == s:
cs[s * 2] += 1
else:
... | false | 30.434783 | [
"+from operator import itemgetter",
"+",
"-tt = [[0] * (2 * 10**5 + 1) for _ in range(30)]",
"-for _ in range(N):",
"- s, t, c = list(map(int, input().split()))",
"- ttc = tt[c - 1]",
"- for i in range(s * 2 - 1, t * 2):",
"- ttc[i] = 1",
"-ct = [0] * (2 * 10**5 + 1)",
"-for i in r... | false | 1.910332 | 0.128094 | 14.913471 | [
"s060132641",
"s440771520"
] |
u969850098 | p02702 | python | s997176100 | s512239024 | 131 | 119 | 25,436 | 17,912 | Accepted | Accepted | 9.16 | import sys
readline = sys.stdin.readline
from collections import Counter
MOD = 2019
def main():
S = list(map(int, list(readline().rstrip())))
N = len(S)
T = [0] * (N+1)
e = 1
for i in range(N-1, -1, -1):
T[i] = (T[i+1] + int(S[i]) * e) % MOD
e = e * 10 % MOD
T... | import sys
readline = sys.stdin.readline
from collections import Counter
MOD = 2019
def main():
S = list(map(int, list(readline().rstrip())))
N = len(S)
T = [0] * (N+1)
e = 1
for i in range(N-1, -1, -1):
T[i] = (T[i+1] + int(S[i]) * e) % MOD
e = e * 10 % MOD
c... | 24 | 23 | 497 | 467 | import sys
readline = sys.stdin.readline
from collections import Counter
MOD = 2019
def main():
S = list(map(int, list(readline().rstrip())))
N = len(S)
T = [0] * (N + 1)
e = 1
for i in range(N - 1, -1, -1):
T[i] = (T[i + 1] + int(S[i]) * e) % MOD
e = e * 10 % MOD
T = [t % MO... | import sys
readline = sys.stdin.readline
from collections import Counter
MOD = 2019
def main():
S = list(map(int, list(readline().rstrip())))
N = len(S)
T = [0] * (N + 1)
e = 1
for i in range(N - 1, -1, -1):
T[i] = (T[i + 1] + int(S[i]) * e) % MOD
e = e * 10 % MOD
c = Counter... | false | 4.166667 | [
"- T = [t % MOD for t in T]"
] | false | 0.043104 | 0.037952 | 1.13573 | [
"s997176100",
"s512239024"
] |
u909514237 | p02553 | python | s000087385 | s933700069 | 33 | 28 | 9,184 | 9,036 | Accepted | Accepted | 15.15 | a,b,c,d = list(map(int, input().split()))
t = list()
ac = a*c
bc = b*c
ad = a*d
bd = b*d
t.append(ac)
t.append(bc)
t.append(ad)
t.append(bd)
ans = -1 * 10**18
for i in range(4):
ans = max(t[i],ans)
print(ans) | a,b,c,d = list(map(int, input().split()))
ans = max(a*c, a*d, b*c, b*d)
print(ans) | 14 | 4 | 217 | 80 | a, b, c, d = list(map(int, input().split()))
t = list()
ac = a * c
bc = b * c
ad = a * d
bd = b * d
t.append(ac)
t.append(bc)
t.append(ad)
t.append(bd)
ans = -1 * 10**18
for i in range(4):
ans = max(t[i], ans)
print(ans)
| a, b, c, d = list(map(int, input().split()))
ans = max(a * c, a * d, b * c, b * d)
print(ans)
| false | 71.428571 | [
"-t = list()",
"-ac = a * c",
"-bc = b * c",
"-ad = a * d",
"-bd = b * d",
"-t.append(ac)",
"-t.append(bc)",
"-t.append(ad)",
"-t.append(bd)",
"-ans = -1 * 10**18",
"-for i in range(4):",
"- ans = max(t[i], ans)",
"+ans = max(a * c, a * d, b * c, b * d)"
] | false | 0.122665 | 0.03628 | 3.381022 | [
"s000087385",
"s933700069"
] |
u281610856 | p03290 | python | s389451866 | s232522779 | 65 | 18 | 3,192 | 3,064 | Accepted | Accepted | 72.31 | D, G = list(map(int, input().split()))
p = [0] * D
c = [0] * D
for i in range(D):
p[i], c[i] = list(map(int, input().split()))
ans = float('inf')
for bit in range(1 << D):
score = 0
cnt = 0
l = [0] * D
for j in range(D):
if (bit >> j) & 1 == 1:
score += p[j] * 100 * (... | D, G = list(map(int, input().split()))
p = [0] * (D + 1)
c = [0] * (D + 1)
for i in range(1, D+1):
p[i], c[i] = list(map(int, input().split()))
ans = float('inf')
def dfs(i, g):
global ans
if i == 0:
return ans
cnt = min(g // (100 * i), p[i])
score = 100 * i * cnt
if cnt ... | 30 | 22 | 770 | 454 | D, G = list(map(int, input().split()))
p = [0] * D
c = [0] * D
for i in range(D):
p[i], c[i] = list(map(int, input().split()))
ans = float("inf")
for bit in range(1 << D):
score = 0
cnt = 0
l = [0] * D
for j in range(D):
if (bit >> j) & 1 == 1:
score += p[j] * 100 * (j + 1) + c[j... | D, G = list(map(int, input().split()))
p = [0] * (D + 1)
c = [0] * (D + 1)
for i in range(1, D + 1):
p[i], c[i] = list(map(int, input().split()))
ans = float("inf")
def dfs(i, g):
global ans
if i == 0:
return ans
cnt = min(g // (100 * i), p[i])
score = 100 * i * cnt
if cnt == p[i]:
... | false | 26.666667 | [
"-p = [0] * D",
"-c = [0] * D",
"-for i in range(D):",
"+p = [0] * (D + 1)",
"+c = [0] * (D + 1)",
"+for i in range(1, D + 1):",
"-for bit in range(1 << D):",
"- score = 0",
"- cnt = 0",
"- l = [0] * D",
"- for j in range(D):",
"- if (bit >> j) & 1 == 1:",
"- sc... | false | 0.072663 | 0.036247 | 2.004633 | [
"s389451866",
"s232522779"
] |
u477977638 | p02644 | python | s579615844 | s968805182 | 1,086 | 644 | 281,504 | 282,940 | Accepted | Accepted | 40.7 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(... | 98 | 65 | 1,895 | 1,260 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
... | false | 33.673469 | [
"- for i in range(1, k + 1):",
"- if G[now + i] == d or G[now + i] == \"@\":",
"- break",
"- elif G[now + i] == \".\":",
"- G[now + i] = d + 1",
"- Q.append([now + i, d + 1])",
"- elif G[now + i] == d + 1:",
"- ... | false | 0.042252 | 0.037624 | 1.122997 | [
"s579615844",
"s968805182"
] |
u761320129 | p03501 | python | s814348247 | s820215547 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | N,A,B = list(map(int,input().split()))
print((min(N*A, B)))
| N,A,B = list(map(int,input().split()))
print((min(B,N*A))) | 2 | 2 | 53 | 51 | N, A, B = list(map(int, input().split()))
print((min(N * A, B)))
| N, A, B = list(map(int, input().split()))
print((min(B, N * A)))
| false | 0 | [
"-print((min(N * A, B)))",
"+print((min(B, N * A)))"
] | false | 0.051843 | 0.12695 | 0.408376 | [
"s814348247",
"s820215547"
] |
u888092736 | p03018 | python | s612951599 | s101299214 | 216 | 52 | 13,564 | 9,260 | Accepted | Accepted | 75.93 | class FenwickTree:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.k_init = 2 ** (self.n - 1).bit_length()
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
... | S = eval(input())
S = S.replace("BC", "D")
cur = 0
ans = 0
for c in S:
if c == "A":
cur += 1
elif c == "D":
ans += cur
else:
cur = 0
print(ans)
| 43 | 12 | 840 | 185 | class FenwickTree:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.k_init = 2 ** (self.n - 1).bit_length()
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
while... | S = eval(input())
S = S.replace("BC", "D")
cur = 0
ans = 0
for c in S:
if c == "A":
cur += 1
elif c == "D":
ans += cur
else:
cur = 0
print(ans)
| false | 72.093023 | [
"-class FenwickTree:",
"- def __init__(self, n):",
"- self.n = n",
"- self.data = [0] * (n + 1)",
"- self.k_init = 2 ** (self.n - 1).bit_length()",
"-",
"- def sum(self, i):",
"- s = 0",
"- while i > 0:",
"- s += self.data[i]",
"- i ... | false | 0.035568 | 0.073604 | 0.48324 | [
"s612951599",
"s101299214"
] |
u348805958 | p02762 | python | s230789008 | s052115752 | 1,224 | 990 | 42,724 | 10,992 | Accepted | Accepted | 19.12 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
from bisect import bisect
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ... | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
from bisect import bisect
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ... | 58 | 57 | 1,179 | 1,111 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
from bisect import bisect
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ai - aj
# ... | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
from bisect import bisect
def resolve():
def find(i):
x = S[i]
if x < 0:
return i
S[i] = find(x)
return S[i]
def join(i, j):
ai = find(i)
aj = find(j)
diff = ai - aj
if... | false | 1.724138 | [
"- # print(\"j\", ai, aj)",
"- U = [set() for i in range(N)]",
"- U[ai].add(bi)",
"- U[bi].add(ai)",
"+ if same(ai, bi):",
"+ T[ai] += 1",
"+ T[bi] += 1",
"- ans = [size(i) - T[i] - sum(same(i, j) for j in U[i]) for i in range(N)]",
"+ ans =... | false | 0.007993 | 0.174966 | 0.045681 | [
"s230789008",
"s052115752"
] |
u200887663 | p03457 | python | s966141273 | s374087570 | 424 | 242 | 27,380 | 9,104 | Accepted | Accepted | 42.92 | n=int(eval(input()))
li=[list(map(int,input().split())) for i in range(n)]
li.insert(0,[0,0,0])
#print(li)
for i in range(n) :
cr=li[i]
nx=li[i+1]
dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
dt=nx[0]-cr[0]
if dt<dist :
print("No")
exit()
if (dt%2) != (dist%2) :
print("No")
exit(... | n=int(eval(input()))
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
t_bef=0
x_bef=0
y_bef=0
flag='Yes'
for i in range(1,n+1):
t,x,y=list(map(int,input().split()))
dt=t-t_bef
dist=abs(x-x_bef)+abs(y-y_bef)
if (dt%2 != di... | 18 | 19 | 329 | 404 | n = int(eval(input()))
li = [list(map(int, input().split())) for i in range(n)]
li.insert(0, [0, 0, 0])
# print(li)
for i in range(n):
cr = li[i]
nx = li[i + 1]
dist = abs(nx[1] - cr[1]) + abs(nx[2] - cr[2])
dt = nx[0] - cr[0]
if dt < dist:
print("No")
exit()
if (dt % 2) != (dist... | n = int(eval(input()))
# a,b=map(int,input().split())
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
t_bef = 0
x_bef = 0
y_bef = 0
flag = "Yes"
for i in range(1, n + 1):
t, x, y = list(map(int, input().split()))
dt = t - t_bef
dist = abs(x - x_bef) + abs(y - y_bef)... | false | 5.263158 | [
"-li = [list(map(int, input().split())) for i in range(n)]",
"-li.insert(0, [0, 0, 0])",
"-# print(li)",
"-for i in range(n):",
"- cr = li[i]",
"- nx = li[i + 1]",
"- dist = abs(nx[1] - cr[1]) + abs(nx[2] - cr[2])",
"- dt = nx[0] - cr[0]",
"- if dt < dist:",
"- print(\"No\")"... | false | 0.037975 | 0.007976 | 4.761384 | [
"s966141273",
"s374087570"
] |
u624475441 | p03291 | python | s272158272 | s120174294 | 146 | 102 | 3,188 | 3,188 | Accepted | Accepted | 30.14 | M = 10**9 + 7
dp = [0] * 4
dp[0] = 1
idx = {'A': 1, 'B': 2, 'C': 3}
m = lambda x: x % M if x > M else x
for c in eval(input()):
if c == '?':
N, A, AB, ABC = dp
dp = [m(N * 3), m(A * 3 + N), m(AB * 3 + A), m(ABC * 3 + AB)]
else:
dp[idx[c]] += dp[idx[c] - 1]
print((dp[3] % M)) | M = 10**9 + 7
N, A, AB, ABC = 1, 0, 0, 0
idx = {'A': 1, 'B': 2, 'C': 3}
for c in eval(input()):
if c == '?':
N, A, AB, ABC = (N * 3) % M, (A * 3 + N) % M, (AB * 3 + A) % M, (ABC * 3 + AB) % M
else:
dp = [N, A, AB, ABC]
dp[idx[c]] += dp[idx[c] - 1]
N, A, AB, ABC = dp
pri... | 12 | 11 | 310 | 325 | M = 10**9 + 7
dp = [0] * 4
dp[0] = 1
idx = {"A": 1, "B": 2, "C": 3}
m = lambda x: x % M if x > M else x
for c in eval(input()):
if c == "?":
N, A, AB, ABC = dp
dp = [m(N * 3), m(A * 3 + N), m(AB * 3 + A), m(ABC * 3 + AB)]
else:
dp[idx[c]] += dp[idx[c] - 1]
print((dp[3] % M))
| M = 10**9 + 7
N, A, AB, ABC = 1, 0, 0, 0
idx = {"A": 1, "B": 2, "C": 3}
for c in eval(input()):
if c == "?":
N, A, AB, ABC = (
(N * 3) % M,
(A * 3 + N) % M,
(AB * 3 + A) % M,
(ABC * 3 + AB) % M,
)
else:
dp = [N, A, AB, ABC]
dp[idx[c... | false | 8.333333 | [
"-dp = [0] * 4",
"-dp[0] = 1",
"+N, A, AB, ABC = 1, 0, 0, 0",
"-m = lambda x: x % M if x > M else x",
"+ N, A, AB, ABC = (",
"+ (N * 3) % M,",
"+ (A * 3 + N) % M,",
"+ (AB * 3 + A) % M,",
"+ (ABC * 3 + AB) % M,",
"+ )",
"+ else:",
"+... | false | 0.059798 | 0.041029 | 1.457458 | [
"s272158272",
"s120174294"
] |
u966695411 | p03864 | python | s932276991 | s509157121 | 177 | 118 | 14,592 | 14,132 | Accepted | Accepted | 33.33 | #! /usr/bin/env python3
N, x = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
if C[i]+C[i+1] > x:
a = C[i]+C[i+1] - x
cnt += a
C[i] = min(C[i+1]-a, 0)
C[i+1] = max(C[i+1]-a, 0)
print(cnt) | #! /usr/bin/env python3
N, M = list(map(int, input().split()))
cnt = 0
a = list(map(int, input().split())) + [0]
for i in range(N):
if a[i] + a[i+1] > M:
o = a[i] + a[i+1] - M
cnt += o
if o > a[i+1]:
o -= a[i+1]
a[i+1] = 0
# a[i] -= o
... | 12 | 16 | 279 | 357 | #! /usr/bin/env python3
N, x = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
for i in range(N - 1):
if C[i] + C[i + 1] > x:
a = C[i] + C[i + 1] - x
cnt += a
C[i] = min(C[i + 1] - a, 0)
C[i + 1] = max(C[i + 1] - a, 0)
print(cnt)
| #! /usr/bin/env python3
N, M = list(map(int, input().split()))
cnt = 0
a = list(map(int, input().split())) + [0]
for i in range(N):
if a[i] + a[i + 1] > M:
o = a[i] + a[i + 1] - M
cnt += o
if o > a[i + 1]:
o -= a[i + 1]
a[i + 1] = 0
# a[i] -= o
els... | false | 25 | [
"-N, x = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"+N, M = list(map(int, input().split()))",
"-for i in range(N - 1):",
"- if C[i] + C[i + 1] > x:",
"- a = C[i] + C[i + 1] - x",
"- cnt += a",
"- C[i] = min(C[i + 1] - a, 0)",
"- C[i + 1]... | false | 0.044287 | 0.046927 | 0.943749 | [
"s932276991",
"s509157121"
] |
u771007149 | p02732 | python | s373604959 | s873465827 | 380 | 224 | 26,780 | 34,220 | Accepted | Accepted | 41.05 | import collections
n = int(eval(input()))
a = list(map(int,input().split()))
cnt = 0
c = collections.Counter(a)
for i in list(c.values()):
cnt += i*(i-1) // 2
for j in range(n):
print((cnt - c[a[j]] + 1)) | from collections import Counter
n = int(eval(input()))
a = list(map(int,input().split()))
c = Counter(a)
#print(c)
s = 0
for i in list(c.values()):
s += i * (i-1) // 2
for i in range(n):
print((s - c[a[i]] + 1)) | 9 | 13 | 206 | 220 | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
c = collections.Counter(a)
for i in list(c.values()):
cnt += i * (i - 1) // 2
for j in range(n):
print((cnt - c[a[j]] + 1))
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
# print(c)
s = 0
for i in list(c.values()):
s += i * (i - 1) // 2
for i in range(n):
print((s - c[a[i]] + 1))
| false | 30.769231 | [
"-import collections",
"+from collections import Counter",
"-cnt = 0",
"-c = collections.Counter(a)",
"+c = Counter(a)",
"+# print(c)",
"+s = 0",
"- cnt += i * (i - 1) // 2",
"-for j in range(n):",
"- print((cnt - c[a[j]] + 1))",
"+ s += i * (i - 1) // 2",
"+for i in range(n):",
"+ ... | false | 0.04156 | 0.115904 | 0.358575 | [
"s373604959",
"s873465827"
] |
u891847179 | p02726 | python | s468505970 | s892031915 | 1,929 | 1,618 | 3,444 | 3,444 | Accepted | Accepted | 16.12 | N, X, Y = list(map(int, input().split()))
res = [0] * N
for i in range(1, N + 1):
for j in range(1, N + 1):
if i >= j:
continue
if i == X and Y == j:
key = 1
else:
key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
res[key] += 1
for i ... | N, X, Y = list(map(int, input().split()))
res = [0] * N
for j in range(1, N + 1):
for i in range(1, j):
if i == X and Y == j:
key = 1
else:
key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
res[key] += 1
for i in range(1, N):
print((res[i])) | 14 | 12 | 355 | 308 | N, X, Y = list(map(int, input().split()))
res = [0] * N
for i in range(1, N + 1):
for j in range(1, N + 1):
if i >= j:
continue
if i == X and Y == j:
key = 1
else:
key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
res[key] += 1
for i in range(1, N... | N, X, Y = list(map(int, input().split()))
res = [0] * N
for j in range(1, N + 1):
for i in range(1, j):
if i == X and Y == j:
key = 1
else:
key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
res[key] += 1
for i in range(1, N):
print((res[i]))
| false | 14.285714 | [
"-for i in range(1, N + 1):",
"- for j in range(1, N + 1):",
"- if i >= j:",
"- continue",
"+for j in range(1, N + 1):",
"+ for i in range(1, j):"
] | false | 0.075554 | 0.035707 | 2.115968 | [
"s468505970",
"s892031915"
] |
u393253137 | p03361 | python | s357749092 | s016806519 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | h,w=list(map(int,input().split()))
s=list(eval(input()) for _ in range(h))
flag=1
for i in range(h):
for j in range(w):
check=0
if s[i][j]=="#":
if i!=0 and s[i-1][j]=="#":check +=1
if i!=h-1 and s[i+1][j]=="#":check += 1
if j!=0 and s[i][j-1]=="#":check ... | h,w=list(map(int,input().split()))
#枠を大きめに確保してout of rangeを避ける!
grid = ["."*(w+2)]
for _ in range(h):
grid.append("." + eval(input()) + ".")
grid += ["."*(w+2)]
for i in range(1,h+1):
for j in range(1,w+1):
if grid[i][j]=="#":
if not (grid[i][j-1]=="#" or grid[i][j+1]=="#"or \
... | 13 | 15 | 429 | 437 | h, w = list(map(int, input().split()))
s = list(eval(input()) for _ in range(h))
flag = 1
for i in range(h):
for j in range(w):
check = 0
if s[i][j] == "#":
if i != 0 and s[i - 1][j] == "#":
check += 1
if i != h - 1 and s[i + 1][j] == "#":
chec... | h, w = list(map(int, input().split()))
# 枠を大きめに確保してout of rangeを避ける!
grid = ["." * (w + 2)]
for _ in range(h):
grid.append("." + eval(input()) + ".")
grid += ["." * (w + 2)]
for i in range(1, h + 1):
for j in range(1, w + 1):
if grid[i][j] == "#":
if not (
grid[i][j - 1] == "... | false | 13.333333 | [
"-s = list(eval(input()) for _ in range(h))",
"-flag = 1",
"-for i in range(h):",
"- for j in range(w):",
"- check = 0",
"- if s[i][j] == \"#\":",
"- if i != 0 and s[i - 1][j] == \"#\":",
"- check += 1",
"- if i != h - 1 and s[i + 1][j] == \"#\":... | false | 0.035858 | 0.034027 | 1.053812 | [
"s357749092",
"s016806519"
] |
u537550206 | p03324 | python | s424594570 | s106898258 | 261 | 28 | 3,060 | 9,164 | Accepted | Accepted | 89.27 | d, n = list(map(int, input().split()))
def division(x):
if x % 100 != 0:
return 0
else:
return division(x//100) +1
count= 0
for i in range(1, 1010001):
if division(i) == d:
count +=1
if count == n:
print(i)
break | d, n = list(map(int, input().split()))
if d == 0:
count = 0
for i in range(1, 110):
if i % 100 != 0:
count += 1
if count == n:
print(i)
break
else:
continue
if d == 1:
count = 0
for i in range(10... | 13 | 37 | 274 | 783 | d, n = list(map(int, input().split()))
def division(x):
if x % 100 != 0:
return 0
else:
return division(x // 100) + 1
count = 0
for i in range(1, 1010001):
if division(i) == d:
count += 1
if count == n:
print(i)
break
| d, n = list(map(int, input().split()))
if d == 0:
count = 0
for i in range(1, 110):
if i % 100 != 0:
count += 1
if count == n:
print(i)
break
else:
continue
if d == 1:
count = 0
for i in range(100, 20000, 100):
i... | false | 64.864865 | [
"-",
"-",
"-def division(x):",
"- if x % 100 != 0:",
"- return 0",
"- else:",
"- return division(x // 100) + 1",
"-",
"-",
"-count = 0",
"-for i in range(1, 1010001):",
"- if division(i) == d:",
"- count += 1",
"- if count == n:",
"- print(i)",
"... | false | 0.379961 | 0.007486 | 50.759518 | [
"s424594570",
"s106898258"
] |
u498487134 | p02936 | python | s693458927 | s652606703 | 1,297 | 731 | 128,244 | 137,244 | Accepted | Accepted | 43.64 | import queue
import sys
input = sys.stdin.readline
N,Q=list(map(int,input().split()))
c=[0]*N#count
to=[[] for i in range(N)]
for i in range(N-1):
a,b =list(map(int,input().split()))
a-=1
b-=1
to[a].append(b)
to[b].append(a)
for i in range(Q):
p,x =list(map(int,inp... | 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
import queue
N,Q=MI()
adj=[[]for _ in range(N)]
for _ in range(N-1):
a,b=MI()
... | 36 | 40 | 609 | 781 | import queue
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
c = [0] * N # count
to = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
to[a].append(b)
to[b].append(a)
for i in range(Q):
p, x = list(map(int, input().... | 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
import queue
N, Q = MI()
adj = [[] for _ in range(N)]
for _ in range(N - 1):
... | false | 10 | [
"-import queue",
"-N, Q = list(map(int, input().split()))",
"-c = [0] * N # count",
"-to = [[] for i in range(N)]",
"-for i in range(N - 1):",
"- a, b = list(map(int, input().split()))",
"- a -= 1",
"- b -= 1",
"- to[a].append(b)",
"- to[b].append(a)",
"-for i in range(Q):",
"-... | false | 0.041111 | 0.047398 | 0.867366 | [
"s693458927",
"s652606703"
] |
u497046426 | p02735 | python | s424419119 | s062743437 | 79 | 71 | 7,156 | 7,412 | Accepted | Accepted | 10.13 | from itertools import product
from heapq import heappush, heappop
class Dijkstra:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
self.E[init].append((end, weight))
if undirected: s... | from itertools import product
from collections import deque
class ZeroOneBFS:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
assert weight in [0, 1]
self.E[init].append((en... | 62 | 62 | 2,080 | 2,113 | from itertools import product
from heapq import heappush, heappop
class Dijkstra:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
self.E[init].append((end, weight))
if undirected:
... | from itertools import product
from collections import deque
class ZeroOneBFS:
def __init__(self, N):
self.N = N # #vertices
self.E = [[] for _ in range(N)]
def add_edge(self, init, end, weight, undirected=False):
assert weight in [0, 1]
self.E[init].append((end, weight))
... | false | 0 | [
"-from heapq import heappush, heappop",
"+from collections import deque",
"-class Dijkstra:",
"+class ZeroOneBFS:",
"+ assert weight in [0, 1]",
"+ dq = deque([(0, -1, s)]) # (dist, prev, vertex)",
"- heap = []",
"- heappush(heap, (0, -1, s))",
"- while heap:",
... | false | 0.007805 | 0.088409 | 0.088286 | [
"s424419119",
"s062743437"
] |
u449580152 | p02689 | python | s633977312 | s232289075 | 413 | 379 | 25,968 | 26,048 | Accepted | Accepted | 8.23 | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
sore = [[0] for i in range(n)]
for i in range(m):
road = list(map(int, input().split()))
sore[road[0]-1].append(h[road[1]-1])
sore[road[1]-1].append(h[road[0]-1])
ans = 0
for i in range(n):
if h[i] > max(sore[i]):
... | n,m = list(map(int, input().split()))
H = list(map(int, input().split()))
s = [[0] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
s[a-1].append(H[b-1])
s[b-1].append(H[a-1])
c = 0
for j in range(n):
if H[j] > max(s[j]):
c+= 1
print(c) | 12 | 12 | 335 | 288 | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
sore = [[0] for i in range(n)]
for i in range(m):
road = list(map(int, input().split()))
sore[road[0] - 1].append(h[road[1] - 1])
sore[road[1] - 1].append(h[road[0] - 1])
ans = 0
for i in range(n):
if h[i] > max(sore[i]):
... | n, m = list(map(int, input().split()))
H = list(map(int, input().split()))
s = [[0] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
s[a - 1].append(H[b - 1])
s[b - 1].append(H[a - 1])
c = 0
for j in range(n):
if H[j] > max(s[j]):
c += 1
print(c)
| false | 0 | [
"-h = list(map(int, input().split()))",
"-sore = [[0] for i in range(n)]",
"+H = list(map(int, input().split()))",
"+s = [[0] for i in range(n)]",
"- road = list(map(int, input().split()))",
"- sore[road[0] - 1].append(h[road[1] - 1])",
"- sore[road[1] - 1].append(h[road[0] - 1])",
"-ans = 0"... | false | 0.035337 | 0.032511 | 1.086937 | [
"s633977312",
"s232289075"
] |
u201928947 | p03061 | python | s007221370 | s007144134 | 370 | 203 | 105,696 | 16,120 | Accepted | Accepted | 45.14 | from fractions import gcd
n = int(eval(input()))
a = list(map(int,input().split()))
GCD= a[0]
dp = [set() for i in range(n)]
dp[1].add(a[0])
dp[1].add(a[1])
for i in range(1,n):
x = a[i]
for j in dp[i-1]:
dp[i].add(gcd(j,x))
if x % GCD != 0:
dp[i].add(GCD)
GCD = gcd(... | from fractions import gcd
n = int(eval(input()))
a = list(map(int,input().split()))
left = []
right = []
left.append(a[0])
for i in range(1,n-1):
left.append(gcd(left[-1],a[i]))
a = a[::-1]
right.append(a[0])
for i in range(1,n-1):
right.append(gcd(right[-1],a[i]))
ans = 1
for i in range(n-1):
... | 15 | 18 | 341 | 407 | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
GCD = a[0]
dp = [set() for i in range(n)]
dp[1].add(a[0])
dp[1].add(a[1])
for i in range(1, n):
x = a[i]
for j in dp[i - 1]:
dp[i].add(gcd(j, x))
if x % GCD != 0:
dp[i].add(GCD)
GCD = gcd(GCD, x)
pr... | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
left = []
right = []
left.append(a[0])
for i in range(1, n - 1):
left.append(gcd(left[-1], a[i]))
a = a[::-1]
right.append(a[0])
for i in range(1, n - 1):
right.append(gcd(right[-1], a[i]))
ans = 1
for i in range(n - 1):
a... | false | 16.666667 | [
"-GCD = a[0]",
"-dp = [set() for i in range(n)]",
"-dp[1].add(a[0])",
"-dp[1].add(a[1])",
"-for i in range(1, n):",
"- x = a[i]",
"- for j in dp[i - 1]:",
"- dp[i].add(gcd(j, x))",
"- if x % GCD != 0:",
"- dp[i].add(GCD)",
"- GCD = gcd(GCD, x)",
"-print((max(dp[n ... | false | 0.04953 | 0.108064 | 0.458335 | [
"s007221370",
"s007144134"
] |
u903948194 | p03290 | python | s643178809 | s512461322 | 53 | 49 | 9,240 | 9,104 | Accepted | Accepted | 7.55 | D, G = [int(n) for n in input().split()]
score_table = []
for i in range(1, D+1):
p, c = [int(n) for n in input().split()]
score_table.append([i*100, p, c])
min_count = sum([l[1] for l in score_table])
#print(min_count)
for bit in range(1<<D):
score = 0
count = 0
for i in range(D):... | D, G = [int(n) for n in input().split()]
score_table = []
for i in range(1, D+1):
p, c = [int(n) for n in input().split()]
score_table.append([i*100, p, c])
min_count = sum([l[1] for l in score_table])
#print(min_count)
for bit in range(1<<D):
score = 0
count = 0
for i in range(D):... | 44 | 44 | 1,166 | 1,177 | D, G = [int(n) for n in input().split()]
score_table = []
for i in range(1, D + 1):
p, c = [int(n) for n in input().split()]
score_table.append([i * 100, p, c])
min_count = sum([l[1] for l in score_table])
# print(min_count)
for bit in range(1 << D):
score = 0
count = 0
for i in range(D):
if... | D, G = [int(n) for n in input().split()]
score_table = []
for i in range(1, D + 1):
p, c = [int(n) for n in input().split()]
score_table.append([i * 100, p, c])
min_count = sum([l[1] for l in score_table])
# print(min_count)
for bit in range(1 << D):
score = 0
count = 0
for i in range(D):
if... | false | 0 | [
"- add_score = additional_[0]",
"- for k in range(add_score[1] - 1):",
"- score += add_score[0]",
"+ # add_score = additional_[0]",
"+ for k in range(additional_[0][1] - 1):",
"+ score += additional_[0][0]"
] | false | 0.037141 | 0.037857 | 0.981098 | [
"s643178809",
"s512461322"
] |
u179169725 | p03372 | python | s268982884 | s046551160 | 496 | 428 | 39,588 | 92,380 | Accepted | Accepted | 13.71 | # https://atcoder.jp/contests/abc095/tasks/arc096_b
# 写真参考
import sys
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_col(H):
'''
H is number of rows
A列、B列が与えられるようなとき
ex1)A,B=read_col(H) ex2) A,=read_col(... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
'''
H is number of rows
'''
ret = []
for _ in range(H):
... | 73 | 125 | 1,798 | 2,635 | # https://atcoder.jp/contests/abc095/tasks/arc096_b
# 写真参考
import sys
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_col(H):
"""
H is number of rows
A列、B列が与えられるようなとき
ex1)A,B=read_col(H) ex2) A,=read_col(H) #一列の場合
"""
... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
"""
H is number of rows
"""
ret = []
for _ in range(H):
ret.append(tupl... | false | 41.6 | [
"-# https://atcoder.jp/contests/abc095/tasks/arc096_b",
"-# 写真参考",
"+sys.setrecursionlimit(1 << 25)",
"+",
"+",
"+def read_a_int():",
"+ return int(read())",
"+",
"+",
"+def read_tuple(H):",
"+ \"\"\"",
"+ H is number of rows",
"+ \"\"\"",
"+ ret = []",
"+ for _ in rang... | false | 0.044854 | 0.125968 | 0.356072 | [
"s268982884",
"s046551160"
] |
u077291787 | p02787 | python | s023045190 | s946141479 | 603 | 307 | 44,548 | 40,560 | Accepted | Accepted | 49.09 | # E - Crested Ibis vs Monster
from collections import defaultdict
def main():
H, N, *AB = list(map(int, open(0).read().split()))
dp = defaultdict(lambda: 1 << 30) # dp[i] := min magic points to decrease monster's health by i
dp[0] = 0
for i in range(H):
if i not in dp:
c... | # E - Crested Ibis vs Monster
def main():
INF = 1 << 30
H, N, *AB = list(map(int, open(0).read().split()))
dp = [INF] * (H + 1) # dp[i] := min magic points to decrease monster's health by i
dp[0] = 0
for i in range(H):
if dp[i] == INF:
continue
for a, b in... | 21 | 20 | 575 | 547 | # E - Crested Ibis vs Monster
from collections import defaultdict
def main():
H, N, *AB = list(map(int, open(0).read().split()))
dp = defaultdict(
lambda: 1 << 30
) # dp[i] := min magic points to decrease monster's health by i
dp[0] = 0
for i in range(H):
if i not in dp:
... | # E - Crested Ibis vs Monster
def main():
INF = 1 << 30
H, N, *AB = list(map(int, open(0).read().split()))
dp = [INF] * (H + 1) # dp[i] := min magic points to decrease monster's health by i
dp[0] = 0
for i in range(H):
if dp[i] == INF:
continue
for a, b in zip(*[iter(AB)... | false | 4.761905 | [
"-from collections import defaultdict",
"-",
"-",
"+ INF = 1 << 30",
"- dp = defaultdict(",
"- lambda: 1 << 30",
"- ) # dp[i] := min magic points to decrease monster's health by i",
"+ dp = [INF] * (H + 1) # dp[i] := min magic points to decrease monster's health by i",
"- ... | false | 0.178528 | 0.091819 | 1.944336 | [
"s023045190",
"s946141479"
] |
u627803856 | p02947 | python | s706948131 | s197464037 | 783 | 424 | 132,608 | 17,808 | Accepted | Accepted | 45.85 | import collections
n=int(eval(input()))
s=[(eval(input())) for _ in range(n)]
lis=[list(s[i]) for i in range(n)]
lis_sort = [sorted(lis[i]) for i in range(n)]
lis_sort = [''.join(lis_sort[i]) for i in range(n)]
lis_sort.sort()
c = collections.Counter(lis_sort)
values, counts = list(zip(*c.most_common(len(... | n = int(eval(input()))
d = {}
for i in range(n):
s = sorted(list(eval(input())))
s = ''.join(s)
d[s] = d.get(s, 0) + 1
cnt = 0
for k,v in list(d.items()):
if v >= 2:
cnt += v * (v - 1) // 2 # 組の個数
print(cnt) | 17 | 13 | 440 | 230 | import collections
n = int(eval(input()))
s = [(eval(input())) for _ in range(n)]
lis = [list(s[i]) for i in range(n)]
lis_sort = [sorted(lis[i]) for i in range(n)]
lis_sort = ["".join(lis_sort[i]) for i in range(n)]
lis_sort.sort()
c = collections.Counter(lis_sort)
values, counts = list(zip(*c.most_common(len(c))))
c... | n = int(eval(input()))
d = {}
for i in range(n):
s = sorted(list(eval(input())))
s = "".join(s)
d[s] = d.get(s, 0) + 1
cnt = 0
for k, v in list(d.items()):
if v >= 2:
cnt += v * (v - 1) // 2 # 組の個数
print(cnt)
| false | 23.529412 | [
"-import collections",
"-",
"-s = [(eval(input())) for _ in range(n)]",
"-lis = [list(s[i]) for i in range(n)]",
"-lis_sort = [sorted(lis[i]) for i in range(n)]",
"-lis_sort = [\"\".join(lis_sort[i]) for i in range(n)]",
"-lis_sort.sort()",
"-c = collections.Counter(lis_sort)",
"-values, counts = li... | false | 0.077417 | 0.044959 | 1.721963 | [
"s706948131",
"s197464037"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.