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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u200887663 | p02732 | python | s684709210 | s120991476 | 450 | 337 | 26,268 | 26,268 | Accepted | Accepted | 25.11 | n=int(eval(input()))
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dic={}
for a in al:
dic[a]=dic.get(a,0)+1
total=0
for k in list(dic.keys()):
total+=dic[k]*(dic[k]-1)//2
for k in range(n):
count=dic[al[k]]
ans=to... | n=int(eval(input()))
#n,p=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dic={}
for a in al:
dic[a]=dic.get(a,0)+1
total=0
for v in list(dic.values()):
total+=v*(v-1)//2
for k in range(n):
res=total-(dic[al[k]]-1)
print(re... | 17 | 16 | 370 | 313 | n = int(eval(input()))
# a,b=map(int,input().split())
al = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
dic = {}
for a in al:
dic[a] = dic.get(a, 0) + 1
total = 0
for k in list(dic.keys()):
total += dic[k] * (dic[k] - 1) // 2
for k in range(n):
count = dic[al[k]]
... | n = int(eval(input()))
# n,p=map(int,input().split())
al = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
dic = {}
for a in al:
dic[a] = dic.get(a, 0) + 1
total = 0
for v in list(dic.values()):
total += v * (v - 1) // 2
for k in range(n):
res = total - (dic[al[k]] - 1... | false | 5.882353 | [
"-# a,b=map(int,input().split())",
"+# n,p=map(int,input().split())",
"-for k in list(dic.keys()):",
"- total += dic[k] * (dic[k] - 1) // 2",
"+for v in list(dic.values()):",
"+ total += v * (v - 1) // 2",
"- count = dic[al[k]]",
"- ans = total - count * (count - 1) // 2 + (count - 1) * (c... | false | 0.048305 | 0.049086 | 0.984087 | [
"s684709210",
"s120991476"
] |
u562935282 | p03041 | python | s191131165 | s116756161 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N, K = list(map(int, input().split()))
s = eval(input())
if s[K - 1] == 'A':
t = 'a'
elif s[K - 1] == 'B':
t = 'b'
else:
t = 'c'
print((s[:K - 1] + t + s[K:]))
| N, K = list(map(int, input().split()))
s = eval(input())
res = ''
for i, ss in enumerate(s, 1):
if i != K:
res += ss
else:
res += ss.lower()
print(res)
| 11 | 10 | 170 | 174 | N, K = list(map(int, input().split()))
s = eval(input())
if s[K - 1] == "A":
t = "a"
elif s[K - 1] == "B":
t = "b"
else:
t = "c"
print((s[: K - 1] + t + s[K:]))
| N, K = list(map(int, input().split()))
s = eval(input())
res = ""
for i, ss in enumerate(s, 1):
if i != K:
res += ss
else:
res += ss.lower()
print(res)
| false | 9.090909 | [
"-if s[K - 1] == \"A\":",
"- t = \"a\"",
"-elif s[K - 1] == \"B\":",
"- t = \"b\"",
"-else:",
"- t = \"c\"",
"-print((s[: K - 1] + t + s[K:]))",
"+res = \"\"",
"+for i, ss in enumerate(s, 1):",
"+ if i != K:",
"+ res += ss",
"+ else:",
"+ res += ss.lower()",
"+... | false | 0.042238 | 0.044467 | 0.94988 | [
"s191131165",
"s116756161"
] |
u102126195 | p03074 | python | s941601012 | s000705302 | 254 | 93 | 15,672 | 5,540 | Accepted | Accepted | 63.39 | N, K = list(map(int, input().split()))
s = list(eval(input()))
cnt_list = []
i = 0
if s[0] == "0":
key = "0"
else:
key = "1"
last = 0
while i < N:
j = i
tmp = 1
for j in range(i + 1, N):
if s[j] == key:
tmp += 1
if j == N - 1:
last = ... | N, K = list(map(int, input().split()))
s = list(eval(input()))
cnt = 1
cntlist = []
for i in range(1, N):
if s[i - 1] != s[i]:
cntlist.append(cnt)
cnt = 1
else:
cnt += 1
cntlist.append(cnt)
if s[0] == "0":
cntlist = [0] + cntlist
ans = 0
for i in range(2 * K + 1):... | 69 | 38 | 1,317 | 688 | N, K = list(map(int, input().split()))
s = list(eval(input()))
cnt_list = []
i = 0
if s[0] == "0":
key = "0"
else:
key = "1"
last = 0
while i < N:
j = i
tmp = 1
for j in range(i + 1, N):
if s[j] == key:
tmp += 1
if j == N - 1:
last = 1
else:
... | N, K = list(map(int, input().split()))
s = list(eval(input()))
cnt = 1
cntlist = []
for i in range(1, N):
if s[i - 1] != s[i]:
cntlist.append(cnt)
cnt = 1
else:
cnt += 1
cntlist.append(cnt)
if s[0] == "0":
cntlist = [0] + cntlist
ans = 0
for i in range(2 * K + 1):
if i >= len(cnt... | false | 44.927536 | [
"-cnt_list = []",
"-i = 0",
"+cnt = 1",
"+cntlist = []",
"+for i in range(1, N):",
"+ if s[i - 1] != s[i]:",
"+ cntlist.append(cnt)",
"+ cnt = 1",
"+ else:",
"+ cnt += 1",
"+cntlist.append(cnt)",
"- key = \"0\"",
"-else:",
"- key = \"1\"",
"-last = 0",
... | false | 0.037692 | 0.037899 | 0.994541 | [
"s941601012",
"s000705302"
] |
u402629484 | p02609 | python | s837720442 | s767931988 | 592 | 428 | 13,408 | 15,736 | Accepted | Accepted | 27.7 | import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(eval(input()))
... | import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(eval(input()))
... | 122 | 123 | 2,917 | 2,939 | import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b):
return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(eval(input()))
... | import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b):
return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(eval(input()))
... | false | 0.813008 | [
"+ @lru_cache(None)"
] | false | 0.043943 | 0.040568 | 1.083175 | [
"s837720442",
"s767931988"
] |
u365686736 | p02396 | python | s340690805 | s322516014 | 60 | 50 | 7,388 | 7,548 | Accepted | Accepted | 16.67 | import sys
i=1
for l in sys.stdin:
x=l.rstrip('\r\n')
if x=="0":break
print(("Case %d: %s"%(i,x)))
i+=1 | import sys
i=1
for l in sys.stdin:
x=l.strip()
if x=="0":break
print(("Case %d: %s"%(i,x)))
i+=1 | 7 | 7 | 123 | 116 | import sys
i = 1
for l in sys.stdin:
x = l.rstrip("\r\n")
if x == "0":
break
print(("Case %d: %s" % (i, x)))
i += 1
| import sys
i = 1
for l in sys.stdin:
x = l.strip()
if x == "0":
break
print(("Case %d: %s" % (i, x)))
i += 1
| false | 0 | [
"- x = l.rstrip(\"\\r\\n\")",
"+ x = l.strip()"
] | false | 0.039615 | 0.03891 | 1.018122 | [
"s340690805",
"s322516014"
] |
u285891772 | p03607 | python | s484849947 | s779989822 | 181 | 167 | 17,196 | 18,352 | Accepted | Accepted | 7.73 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 34 | 35 | 997 | 1,037 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 2.857143 | [
"-num = defaultdict(int)",
"-for _ in range(N):",
"- A = INT()",
"- num[A - 1] ^= 1",
"+A = [INT() for _ in range(N)]",
"+dic = defaultdict(int)",
"+for a in A:",
"+ # print(dic[a])",
"+ dic[a] ^= 1",
"+# print(dic)",
"-for x in num:",
"- ans += num[x]",
"+for x in dic:",
"+... | false | 0.071791 | 0.046285 | 1.551079 | [
"s484849947",
"s779989822"
] |
u927220534 | p02912 | python | s386432105 | s182403569 | 194 | 167 | 42,996 | 42,996 | Accepted | Accepted | 13.92 | rr = raw_input
rri = lambda: int(input())
rrm = lambda: list(map(int, input().split()))
import heapq
def solve(N, M, A):
pq = [-x for x in A]
heapq.heapify(pq)
for _ in range(M):
x = -heapq.heappop(pq)
x /= 2
heapq.heappush(pq, -x)
return -sum(pq)
N, M = rrm()... | import heapq
readints = lambda: list(map(int, input().split()))
def solve(N, M, A):
pq = [-x for x in A]
heapq.heapify(pq)
for _ in range(M):
x = -heapq.heappop(pq)
x /= 2
heapq.heappush(pq, -x)
return -sum(pq)
N, M = readints()
print(solve(N, M, readints()))
| 18 | 15 | 350 | 316 | rr = raw_input
rri = lambda: int(input())
rrm = lambda: list(map(int, input().split()))
import heapq
def solve(N, M, A):
pq = [-x for x in A]
heapq.heapify(pq)
for _ in range(M):
x = -heapq.heappop(pq)
x /= 2
heapq.heappush(pq, -x)
return -sum(pq)
N, M = rrm()
print(solve(N, ... | import heapq
readints = lambda: list(map(int, input().split()))
def solve(N, M, A):
pq = [-x for x in A]
heapq.heapify(pq)
for _ in range(M):
x = -heapq.heappop(pq)
x /= 2
heapq.heappush(pq, -x)
return -sum(pq)
N, M = readints()
print(solve(N, M, readints()))
| false | 16.666667 | [
"-rr = raw_input",
"-rri = lambda: int(input())",
"-rrm = lambda: list(map(int, input().split()))",
"+",
"+readints = lambda: list(map(int, input().split()))",
"-N, M = rrm()",
"-print(solve(N, M, rrm()))",
"+N, M = readints()",
"+print(solve(N, M, readints()))"
] | false | 0.093658 | 0.045942 | 2.038605 | [
"s386432105",
"s182403569"
] |
u763534154 | p02267 | python | s419420346 | s570018365 | 70 | 60 | 7,916 | 8,120 | Accepted | Accepted | 14.29 | n = eval(input())
s = input().split()
q = eval(input())
t = input().split()
ans = 0
for c1 in t:
for c2 in s:
if c1 == c2:
ans += 1
break
print(ans) | def linear_search(l, key):
_l = l + [key]
i = 0
while key != _l[i]:
i += 1
if i == len(_l) - 1:
return -1
return i
if __name__ == '__main__':
n = eval(input())
s = input().split()
q = eval(input())
t = input().split()
ans = 0
for c1 i... | 13 | 25 | 186 | 391 | n = eval(input())
s = input().split()
q = eval(input())
t = input().split()
ans = 0
for c1 in t:
for c2 in s:
if c1 == c2:
ans += 1
break
print(ans)
| def linear_search(l, key):
_l = l + [key]
i = 0
while key != _l[i]:
i += 1
if i == len(_l) - 1:
return -1
return i
if __name__ == "__main__":
n = eval(input())
s = input().split()
q = eval(input())
t = input().split()
ans = 0
for c1 in t:
if linear_s... | false | 48 | [
"-n = eval(input())",
"-s = input().split()",
"-q = eval(input())",
"-t = input().split()",
"-ans = 0",
"-for c1 in t:",
"- for c2 in s:",
"- if c1 == c2:",
"+def linear_search(l, key):",
"+ _l = l + [key]",
"+ i = 0",
"+ while key != _l[i]:",
"+ i += 1",
"+ if... | false | 0.038596 | 0.037847 | 1.019774 | [
"s419420346",
"s570018365"
] |
u858748695 | p03545 | python | s975948426 | s349394852 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | #!/usr/bin/env python3
N = eval(input())
for i in range(8):
num = [int(i) for i in N]
for j in range(3):
if (i >> j) % 2 == 1:
num[-j - 1] *= -1
if sum(num) == 7:
print(('{:d}{:+d}{:+d}{:+d}=7'.format(num[0], num[1], num[2], num[3])))
break
| #!/usr/bin/env python3
N = eval(input())
for i in range(1 << 3):
s = N[0]
for j in range(3):
s += '+-'[i >> j & 1] + N[j + 1]
if eval(s) == 7:
print((s + '=7'))
break
| 11 | 10 | 292 | 205 | #!/usr/bin/env python3
N = eval(input())
for i in range(8):
num = [int(i) for i in N]
for j in range(3):
if (i >> j) % 2 == 1:
num[-j - 1] *= -1
if sum(num) == 7:
print(("{:d}{:+d}{:+d}{:+d}=7".format(num[0], num[1], num[2], num[3])))
break
| #!/usr/bin/env python3
N = eval(input())
for i in range(1 << 3):
s = N[0]
for j in range(3):
s += "+-"[i >> j & 1] + N[j + 1]
if eval(s) == 7:
print((s + "=7"))
break
| false | 9.090909 | [
"-for i in range(8):",
"- num = [int(i) for i in N]",
"+for i in range(1 << 3):",
"+ s = N[0]",
"- if (i >> j) % 2 == 1:",
"- num[-j - 1] *= -1",
"- if sum(num) == 7:",
"- print((\"{:d}{:+d}{:+d}{:+d}=7\".format(num[0], num[1], num[2], num[3])))",
"+ s += \"+... | false | 0.037897 | 0.037885 | 1.000317 | [
"s975948426",
"s349394852"
] |
u883621917 | p03297 | python | s597794672 | s560104114 | 123 | 104 | 79,568 | 77,380 | Accepted | Accepted | 15.45 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import math
import decimal
ctx = decimal.Context(prec=1, rounding=decimal.ROUND_CEILING)
for i in range(int(eval(input()))):
a, b, c, d = lis... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import math
import decimal
ctx = decimal.Context(prec=1, rounding=decimal.ROUND_CEILING)
for i in range(int(eval(input()))):
a, b, c, d = lis... | 44 | 45 | 1,132 | 1,187 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import math
import decimal
ctx = decimal.Context(prec=1, rounding=decimal.ROUND_CEILING)
for i in range(int(eval(input()))):
a, b, c, d = list(map(int, input... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import math
import decimal
ctx = decimal.Context(prec=1, rounding=decimal.ROUND_CEILING)
for i in range(int(eval(input()))):
a, b, c, d = list(map(int, input... | false | 2.222222 | [
"- _max = (",
"- (",
"- int(",
"- (",
"- (decimal.Decimal(b, context=ctx) - decimal.Decimal(r, context=ctx))",
"- / decimal.Decimal(g, context=ctx)",
"- ).to_integral_exact(context=ctx)",
"- )",
"- ... | false | 0.094389 | 0.04679 | 2.01727 | [
"s597794672",
"s560104114"
] |
u896741788 | p03911 | python | s776073810 | s761847522 | 720 | 296 | 62,808 | 10,328 | Accepted | Accepted | 58.89 | n,m=map(int,input().split())
class UnionFind:
#def -> foo=UnionFind(n,1) <- 1-based index, default is 0
#method -> foo.hoge(huga)
__slots__ = ["_size", "_first_idx", "_parents"]
def __init__(self, size: int, first_index: int = 0) -> None:
self._size = size
self._first_idx = fir... | def f():
import sys
input=sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
lang={}
class UnionFind:
#def -> foo=UnionFind(n,1) <- 1-based index, default is 0
#method -> foo.hoge(huga)
__slots__ = ["_size", "_first_idx", "_par... | 38 | 52 | 1,463 | 1,795 | n, m = map(int, input().split())
class UnionFind:
# def -> foo=UnionFind(n,1) <- 1-based index, default is 0
# method -> foo.hoge(huga)
__slots__ = ["_size", "_first_idx", "_parents"]
def __init__(self, size: int, first_index: int = 0) -> None:
self._size = size
self._first_idx = f... | def f():
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())
lang = {}
class UnionFind:
# def -> foo=UnionFind(n,1) <- 1-based index, default is 0
# method -> foo.hoge(huga)
__slots__ = ["_size", "_first_idx", "_... | false | 26.923077 | [
"-n, m = map(int, input().split())",
"+def f():",
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"+ sys.setrecursionlimit(10**9)",
"+ n, m = map(int, input().split())",
"+ lang = {}",
"+",
"+ class UnionFind:",
"+ # def -> foo=UnionFind(n,1) <- 1-based in... | false | 0.072298 | 0.039701 | 1.821056 | [
"s776073810",
"s761847522"
] |
u701644092 | p02761 | python | s383932943 | s935972984 | 37 | 29 | 9,932 | 9,116 | Accepted | Accepted | 21.62 | N,M = list(map(int,input().split()))
pattern = ["."] * N
for i in range(M):
s,c = input().split()
s = int(s)
if pattern[s - 1] not in (".",c):
print((-1))
exit(0)
pattern[s - 1] = c
import re
comp = re.compile("^" + "".join(pattern) + "$")
for i in range(1001):
res = comp.match(str... | N,M = list(map(int,input().split()))
if N == 1:
ans = ["0"]
default = "0"
else:
ans = ["1"] + ["0"] * (N - 1)
default = "1" + "0" * (N - 1)
for i in range(M):
s,c = input().split()
s = int(s) - 1
if N > 1 and s == 0 and c == "0":
print((-1))
exit(0)
if ans[s] == default[s] or an... | 22 | 22 | 373 | 403 | N, M = list(map(int, input().split()))
pattern = ["."] * N
for i in range(M):
s, c = input().split()
s = int(s)
if pattern[s - 1] not in (".", c):
print((-1))
exit(0)
pattern[s - 1] = c
import re
comp = re.compile("^" + "".join(pattern) + "$")
for i in range(1001):
res = comp.match(... | N, M = list(map(int, input().split()))
if N == 1:
ans = ["0"]
default = "0"
else:
ans = ["1"] + ["0"] * (N - 1)
default = "1" + "0" * (N - 1)
for i in range(M):
s, c = input().split()
s = int(s) - 1
if N > 1 and s == 0 and c == "0":
print((-1))
exit(0)
if ans[s] == defaul... | false | 0 | [
"-pattern = [\".\"] * N",
"+if N == 1:",
"+ ans = [\"0\"]",
"+ default = \"0\"",
"+else:",
"+ ans = [\"1\"] + [\"0\"] * (N - 1)",
"+ default = \"1\" + \"0\" * (N - 1)",
"- s = int(s)",
"- if pattern[s - 1] not in (\".\", c):",
"+ s = int(s) - 1",
"+ if N > 1 and s == 0 an... | false | 0.046069 | 0.0366 | 1.258709 | [
"s383932943",
"s935972984"
] |
u282228874 | p03361 | python | s544967071 | s645602037 | 24 | 21 | 3,064 | 3,064 | Accepted | Accepted | 12.5 | h,w = list(map(int,input().split()))
S = [eval(input()) for p in range(h)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(h):
for j in range(w):
if S[i][j] == '.':
continue
else:
count = 0
for k in range(4):
if not 0<=i+dy[k]<h o... | H,W = list(map(int,input().split()))
S = [eval(input()) for i in range(H)]
dy = [0,1,0,-1]
dx = [1,0,-1,0]
for y in range(H):
for x in range(W):
if S[y][x] == '.':
continue
if any(0<=y+dy[i]<H and 0<=x+dx[i]<W and S[y+dy[i]][x+dx[i]] == '#' for i in range(4)):
contin... | 22 | 13 | 546 | 365 | h, w = list(map(int, input().split()))
S = [eval(input()) for p in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(h):
for j in range(w):
if S[i][j] == ".":
continue
else:
count = 0
for k in range(4):
if not 0 <= i + dy[k] < h or not... | H, W = list(map(int, input().split()))
S = [eval(input()) for i in range(H)]
dy = [0, 1, 0, -1]
dx = [1, 0, -1, 0]
for y in range(H):
for x in range(W):
if S[y][x] == ".":
continue
if any(
0 <= y + dy[i] < H and 0 <= x + dx[i] < W and S[y + dy[i]][x + dx[i]] == "#"
... | false | 40.909091 | [
"-h, w = list(map(int, input().split()))",
"-S = [eval(input()) for p in range(h)]",
"+H, W = list(map(int, input().split()))",
"+S = [eval(input()) for i in range(H)]",
"+dy = [0, 1, 0, -1]",
"-dy = [0, 1, 0, -1]",
"-for i in range(h):",
"- for j in range(w):",
"- if S[i][j] == \".\":",
... | false | 0.039269 | 0.037809 | 1.038621 | [
"s544967071",
"s645602037"
] |
u777923818 | p04006 | python | s977786972 | s582382807 | 1,220 | 290 | 3,188 | 42,732 | Accepted | Accepted | 76.23 | # -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N, x = inpl()
A = inpl()
ans = sum(A)
for i in range(1, N):
A = [min(A[j], A[(j-1)%N]) for j in range(N)]
ans = min(ans, sum(A) + x*i)
print(ans) | from collections import Counter
def inpl(): return list(map(int, input().split()))
N, x = inpl()
A = inpl()
B = [a for a in A]
ans = 1e15
for i in range(N+1):
for j in range(N):
B[j] = min(B[j], A[(j-i)%N])
tmp = x*i + sum(B)
ans = min(ans, tmp)
print(ans)
| 11 | 13 | 240 | 290 | # -*- coding: utf-8 -*-
def inpl():
return list(map(int, input().split()))
N, x = inpl()
A = inpl()
ans = sum(A)
for i in range(1, N):
A = [min(A[j], A[(j - 1) % N]) for j in range(N)]
ans = min(ans, sum(A) + x * i)
print(ans)
| from collections import Counter
def inpl():
return list(map(int, input().split()))
N, x = inpl()
A = inpl()
B = [a for a in A]
ans = 1e15
for i in range(N + 1):
for j in range(N):
B[j] = min(B[j], A[(j - i) % N])
tmp = x * i + sum(B)
ans = min(ans, tmp)
print(ans)
| false | 15.384615 | [
"-# -*- coding: utf-8 -*-",
"+from collections import Counter",
"+",
"+",
"-ans = sum(A)",
"-for i in range(1, N):",
"- A = [min(A[j], A[(j - 1) % N]) for j in range(N)]",
"- ans = min(ans, sum(A) + x * i)",
"+B = [a for a in A]",
"+ans = 1e15",
"+for i in range(N + 1):",
"+ for j in ... | false | 0.041466 | 0.146815 | 0.282438 | [
"s977786972",
"s582382807"
] |
u143492911 | p03761 | python | s573628656 | s068944984 | 36 | 18 | 3,060 | 3,060 | Accepted | Accepted | 50 | n=int(eval(input()))
s=[eval(input())for i in range(n)]
ans=""
for i in range(97,97+26):
small=float("inf")
for j in range(n):
cnt=0
for k in range(len(s[j])):
if s[j][k]==chr(i):
cnt+=1
small=min(small,cnt)
for l in range(small):
ans+=... | n=int(eval(input()))
a=[eval(input())for i in range(n)]
ans=""
for i in range(97,97+26):
cnt=float("inf")
for j in range(n):
ven=a[j].count(chr(i))
cnt=min(cnt,ven)
ans+=chr(i)*cnt
print(ans)
| 15 | 10 | 329 | 217 | n = int(eval(input()))
s = [eval(input()) for i in range(n)]
ans = ""
for i in range(97, 97 + 26):
small = float("inf")
for j in range(n):
cnt = 0
for k in range(len(s[j])):
if s[j][k] == chr(i):
cnt += 1
small = min(small, cnt)
for l in range(small):
... | n = int(eval(input()))
a = [eval(input()) for i in range(n)]
ans = ""
for i in range(97, 97 + 26):
cnt = float("inf")
for j in range(n):
ven = a[j].count(chr(i))
cnt = min(cnt, ven)
ans += chr(i) * cnt
print(ans)
| false | 33.333333 | [
"-s = [eval(input()) for i in range(n)]",
"+a = [eval(input()) for i in range(n)]",
"- small = float(\"inf\")",
"+ cnt = float(\"inf\")",
"- cnt = 0",
"- for k in range(len(s[j])):",
"- if s[j][k] == chr(i):",
"- cnt += 1",
"- small = min(small, c... | false | 0.04016 | 0.090985 | 0.441391 | [
"s573628656",
"s068944984"
] |
u111365362 | p02883 | python | s301016201 | s470373061 | 773 | 582 | 120,416 | 119,500 | Accepted | Accepted | 24.71 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort()
b.sort(reverse=True)
#print(a)
#print(b)
big = 44
stand = 2 ** big
width = 2 ** (big-1)
if sum(a) <= k:
print((0))
else:
while True:
tmp = []
for i in range(n):
tmp.appe... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
f = list(map(int,input().split()))
a.sort()
f.sort(reverse=True)
#print(a)
#print(f)
scale = 42
aim = 2 ** scale -1
gap = 2 ** (scale-1)
while True:
train = 0
for i in range(n):
train += max(0, a[i] - aim//f[i])
if gap == 0:... | 30 | 27 | 595 | 508 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort(reverse=True)
# print(a)
# print(b)
big = 44
stand = 2**big
width = 2 ** (big - 1)
if sum(a) <= k:
print((0))
else:
while True:
tmp = []
for i in range(n):
t... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
# print(a)
# print(f)
scale = 42
aim = 2**scale - 1
gap = 2 ** (scale - 1)
while True:
train = 0
for i in range(n):
train += max(0, a[i] - aim // f[i])
if gap ... | false | 10 | [
"-b = list(map(int, input().split()))",
"+f = list(map(int, input().split()))",
"-b.sort(reverse=True)",
"+f.sort(reverse=True)",
"-# print(b)",
"-big = 44",
"-stand = 2**big",
"-width = 2 ** (big - 1)",
"-if sum(a) <= k:",
"- print((0))",
"-else:",
"- while True:",
"- tmp = []"... | false | 0.043103 | 0.037727 | 1.142517 | [
"s301016201",
"s470373061"
] |
u904943473 | p03244 | python | s141122553 | s108109042 | 105 | 89 | 21,084 | 24,152 | Accepted | Accepted | 15.24 | from collections import Counter
n = int(eval(input()))
lst_v = list(map(int, input().split()))
if len(set(lst_v)) == 1:
ans = n // 2
else:
lst_odd = lst_v[::2]
lst_even = lst_v[1::2]
cnt_odd = sorted(list(Counter(lst_odd).items()), key=lambda x: -x[1])
cnt_even = sorted(list(Counter... | # C
import collections
n = int(eval(input()))
lst = list(map(int, input().split()))
lst1 = lst[::2]
lst2 = lst[1::2]
dct1 = sorted(list(dict(collections.Counter(lst1)).items()), key=lambda x:-x[1])
dct2 = sorted(list(dict(collections.Counter(lst2)).items()), key=lambda x:-x[1])
ans = 0
if (len(dct1) == 1 a... | 25 | 32 | 686 | 873 | from collections import Counter
n = int(eval(input()))
lst_v = list(map(int, input().split()))
if len(set(lst_v)) == 1:
ans = n // 2
else:
lst_odd = lst_v[::2]
lst_even = lst_v[1::2]
cnt_odd = sorted(list(Counter(lst_odd).items()), key=lambda x: -x[1])
cnt_even = sorted(list(Counter(lst_even).items... | # C
import collections
n = int(eval(input()))
lst = list(map(int, input().split()))
lst1 = lst[::2]
lst2 = lst[1::2]
dct1 = sorted(list(dict(collections.Counter(lst1)).items()), key=lambda x: -x[1])
dct2 = sorted(list(dict(collections.Counter(lst2)).items()), key=lambda x: -x[1])
ans = 0
if len(dct1) == 1 and len(dct2... | false | 21.875 | [
"-from collections import Counter",
"+# C",
"+import collections",
"-lst_v = list(map(int, input().split()))",
"-if len(set(lst_v)) == 1:",
"- ans = n // 2",
"-else:",
"- lst_odd = lst_v[::2]",
"- lst_even = lst_v[1::2]",
"- cnt_odd = sorted(list(Counter(lst_odd).items()), key=lambda x... | false | 0.036232 | 0.083491 | 0.433956 | [
"s141122553",
"s108109042"
] |
u812354010 | p02576 | python | s268623800 | s646520238 | 77 | 69 | 61,780 | 62,028 | Accepted | Accepted | 10.39 | n,x,t=list(map(int, input().split()))
if n%x==0:
print((n//x*t))
else:
print(((n//x+1)*t))
| n,x,t=list(map(int, input().split()))
import math
print((math.ceil(n/x)*t)) | 7 | 3 | 108 | 69 | n, x, t = list(map(int, input().split()))
if n % x == 0:
print((n // x * t))
else:
print(((n // x + 1) * t))
| n, x, t = list(map(int, input().split()))
import math
print((math.ceil(n / x) * t))
| false | 57.142857 | [
"-if n % x == 0:",
"- print((n // x * t))",
"-else:",
"- print(((n // x + 1) * t))",
"+import math",
"+",
"+print((math.ceil(n / x) * t))"
] | false | 0.086774 | 0.045883 | 1.891223 | [
"s268623800",
"s646520238"
] |
u456353530 | p02564 | python | s929421143 | s545432542 | 2,249 | 1,830 | 302,820 | 265,496 | Accepted | Accepted | 18.63 | #-------最強ライブラリSCC(Python) ver25252------
class scc_graph:
# n 頂点数
def __init__(s, n):
s._n = n
s.g = {}
s.rg = {}
def num_vertices(s): return s._n
# 辺を追加 frm 矢元 to 矢先
# O(1)
def add_edge(s, frm, to):
if frm in s.g: s.g[frm].append(to)
else: s.g[frm] = [to]
if to in s.... | #-------最強ライブラリSCC(Python) ver25252------
import sys
sys.setrecursionlimit(1000000)
class scc_graph:
# n 頂点数
def __init__(s, n):
s._n = n
s.g = {}
def num_vertices(s): return s._n
# 辺を追加 frm 矢元 to 矢先
# O(1)
def add_edge(s, frm, to):
if frm in s.g: s.g[frm].append(to)
else: s... | 98 | 93 | 2,088 | 2,116 | # -------最強ライブラリSCC(Python) ver25252------
class scc_graph:
# n 頂点数
def __init__(s, n):
s._n = n
s.g = {}
s.rg = {}
def num_vertices(s):
return s._n
# 辺を追加 frm 矢元 to 矢先
# O(1)
def add_edge(s, frm, to):
if frm in s.g:
s.g[frm].append(to)
... | # -------最強ライブラリSCC(Python) ver25252------
import sys
sys.setrecursionlimit(1000000)
class scc_graph:
# n 頂点数
def __init__(s, n):
s._n = n
s.g = {}
def num_vertices(s):
return s._n
# 辺を追加 frm 矢元 to 矢先
# O(1)
def add_edge(s, frm, to):
if frm in s.g:
... | false | 5.102041 | [
"+import sys",
"+",
"+sys.setrecursionlimit(1000000)",
"+",
"+",
"- s.rg = {}",
"- if to in s.rg:",
"- s.rg[to].append(frm)",
"- else:",
"- s.rg[to] = [frm]",
"- def dfs(v):",
"- stack = [v]",
"- while stack:",
"- ... | false | 0.036595 | 0.037003 | 0.988975 | [
"s929421143",
"s545432542"
] |
u912237403 | p00039 | python | s902275461 | s979970066 | 20 | 10 | 4,216 | 4,208 | Accepted | Accepted | 50 | roman={"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}
try:
while True:
x=[]
line = input()
tmp = roman[line[0]]
x.append(tmp)
for c in line[1:]:
tmp = roman[c]
if x[-1]<tmp: x[-1] = -x[-1]
x.append(tmp)
print... | import sys
roman={"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}
for s in sys.stdin:
x=[]
tmp = roman[s[0]]
x.append(tmp)
for c in s[1:-1]:
tmp = roman[c]
if x[-1]<tmp: x[-1] *= -1
x.append(tmp)
print(sum(x)) | 15 | 12 | 350 | 274 | roman = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
try:
while True:
x = []
line = input()
tmp = roman[line[0]]
x.append(tmp)
for c in line[1:]:
tmp = roman[c]
if x[-1] < tmp:
x[-1] = -x[-1]
x.append(tm... | import sys
roman = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
for s in sys.stdin:
x = []
tmp = roman[s[0]]
x.append(tmp)
for c in s[1:-1]:
tmp = roman[c]
if x[-1] < tmp:
x[-1] *= -1
x.append(tmp)
print(sum(x))
| false | 20 | [
"+import sys",
"+",
"-try:",
"- while True:",
"- x = []",
"- line = input()",
"- tmp = roman[line[0]]",
"+for s in sys.stdin:",
"+ x = []",
"+ tmp = roman[s[0]]",
"+ x.append(tmp)",
"+ for c in s[1:-1]:",
"+ tmp = roman[c]",
"+ if x[-1] < t... | false | 0.039291 | 0.052861 | 0.743281 | [
"s902275461",
"s979970066"
] |
u729133443 | p03546 | python | s978927455 | s688625923 | 253 | 203 | 16,884 | 14,016 | Accepted | Accepted | 19.76 | from scipy.sparse import*
*a,=list(map(int,open(0).read().split()))
c=csgraph.dijkstra(csr_matrix([a[i:i+10]for i in range(2,99,10)]))
print((int(sum(c[i][1]for i in a[102:]if i>=0)))) | from scipy.sparse import*
_,*a=[list(map(int,t.split()))for t in open(0)]
c=csgraph.dijkstra(csr_matrix(a[:10]))
print((int(sum(c[j][1]for i in a[10:]for j in i if j>=0)))) | 4 | 4 | 179 | 173 | from scipy.sparse import *
(*a,) = list(map(int, open(0).read().split()))
c = csgraph.dijkstra(csr_matrix([a[i : i + 10] for i in range(2, 99, 10)]))
print((int(sum(c[i][1] for i in a[102:] if i >= 0))))
| from scipy.sparse import *
_, *a = [list(map(int, t.split())) for t in open(0)]
c = csgraph.dijkstra(csr_matrix(a[:10]))
print((int(sum(c[j][1] for i in a[10:] for j in i if j >= 0))))
| false | 0 | [
"-(*a,) = list(map(int, open(0).read().split()))",
"-c = csgraph.dijkstra(csr_matrix([a[i : i + 10] for i in range(2, 99, 10)]))",
"-print((int(sum(c[i][1] for i in a[102:] if i >= 0))))",
"+_, *a = [list(map(int, t.split())) for t in open(0)]",
"+c = csgraph.dijkstra(csr_matrix(a[:10]))",
"+print((int(su... | false | 0.327944 | 0.391858 | 0.836896 | [
"s978927455",
"s688625923"
] |
u717839182 | p03457 | python | s316010230 | s535495365 | 488 | 397 | 14,388 | 14,168 | Accepted | Accepted | 18.65 | import unittest
def is_ある時刻での判定(t, d):
# 時刻t >= d でないと実現不可能
if t < d:
return True
# 偶奇が一致しないと実現不可能
if not (t % 2 == d % 2):
return True
return False
def can_not_realize(N, t_list, x_list, y_list) -> bool:
# 各時刻ごとの判定
for t, x, y in zip(t_list, x_list, y_... | def can_not_realize(N, t_list, x_list, y_list) -> bool:
# t_n と t_n+1 間 での移動判定
for i in range(N):
diff_t = t_list[i + 1] - t_list[i]
diff_x = abs(x_list[i + 1] - x_list[i])
diff_y = abs(y_list[i + 1] - y_list[i])
sum_of_moving = diff_x + diff_y
# 時刻t >= sum_of_... | 57 | 41 | 1,119 | 996 | import unittest
def is_ある時刻での判定(t, d):
# 時刻t >= d でないと実現不可能
if t < d:
return True
# 偶奇が一致しないと実現不可能
if not (t % 2 == d % 2):
return True
return False
def can_not_realize(N, t_list, x_list, y_list) -> bool:
# 各時刻ごとの判定
for t, x, y in zip(t_list, x_list, y_list):
d = ... | def can_not_realize(N, t_list, x_list, y_list) -> bool:
# t_n と t_n+1 間 での移動判定
for i in range(N):
diff_t = t_list[i + 1] - t_list[i]
diff_x = abs(x_list[i + 1] - x_list[i])
diff_y = abs(y_list[i + 1] - y_list[i])
sum_of_moving = diff_x + diff_y
# 時刻t >= sum_of_moving でないと... | false | 28.070175 | [
"-import unittest",
"-",
"-",
"-def is_ある時刻での判定(t, d):",
"- # 時刻t >= d でないと実現不可能",
"- if t < d:",
"- return True",
"- # 偶奇が一致しないと実現不可能",
"- if not (t % 2 == d % 2):",
"- return True",
"- return False",
"-",
"-",
"- # 各時刻ごとの判定",
"- for t, x, y in zip(t_l... | false | 0.104128 | 0.035777 | 2.910456 | [
"s316010230",
"s535495365"
] |
u150984829 | p00090 | python | s061058755 | s198871395 | 2,740 | 100 | 5,664 | 5,704 | Accepted | Accepted | 96.35 | import itertools
x=[0.]*100;y=[0.]*100
for e in iter(input,'0'):
a=0
n=int(e)
for i in range(n):x[i],y[i]=list(map(float,input().split(',')))
for i,j in itertools.product(list(range(100)),list(range(100))):
c=0
for k in range(n):
if pow(x[k]-(i/10),2)+pow... | def get_intersections(p0, p1):
dist = abs(p0 - p1)
if dist > 2:
return []
elif dist == 2:
return [(p0 + p1) / 2]
else:
m = (p0 + p1) / 2
v = m - p0
w = complex(v.imag, -v.real)
n = w / abs(w)
d = abs(v)
l = (1 - d ** 2)**.5
... | 12 | 34 | 367 | 857 | import itertools
x = [0.0] * 100
y = [0.0] * 100
for e in iter(input, "0"):
a = 0
n = int(e)
for i in range(n):
x[i], y[i] = list(map(float, input().split(",")))
for i, j in itertools.product(list(range(100)), list(range(100))):
c = 0
for k in range(n):
if pow(x[k] -... | def get_intersections(p0, p1):
dist = abs(p0 - p1)
if dist > 2:
return []
elif dist == 2:
return [(p0 + p1) / 2]
else:
m = (p0 + p1) / 2
v = m - p0
w = complex(v.imag, -v.real)
n = w / abs(w)
d = abs(v)
l = (1 - d**2) ** 0.5
inter0 ... | false | 64.705882 | [
"-import itertools",
"+def get_intersections(p0, p1):",
"+ dist = abs(p0 - p1)",
"+ if dist > 2:",
"+ return []",
"+ elif dist == 2:",
"+ return [(p0 + p1) / 2]",
"+ else:",
"+ m = (p0 + p1) / 2",
"+ v = m - p0",
"+ w = complex(v.imag, -v.real)",
... | false | 0.258774 | 0.037646 | 6.873966 | [
"s061058755",
"s198871395"
] |
u353895424 | p03672 | python | s377485970 | s454919637 | 179 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.5 | s = list(eval(input()))
n = len(s)
while len(s) > 1:
s.pop(-1)
if len(s)%2 == 0:
s1 = s[0:len(s)//2]
s2 = s[len(s)//2:]
# print(s1)
# print(s2)
if s1 == s2:
print((len(s)))
exit() | s = eval(input())
n = len(s)
for i in range(n-1):
s = s[:len(s)-1]
if s[:len(s)//2] == s[len(s)//2:]:
print((len(s)))
exit()
| 13 | 8 | 260 | 149 | s = list(eval(input()))
n = len(s)
while len(s) > 1:
s.pop(-1)
if len(s) % 2 == 0:
s1 = s[0 : len(s) // 2]
s2 = s[len(s) // 2 :]
# print(s1)
# print(s2)
if s1 == s2:
print((len(s)))
exit()
| s = eval(input())
n = len(s)
for i in range(n - 1):
s = s[: len(s) - 1]
if s[: len(s) // 2] == s[len(s) // 2 :]:
print((len(s)))
exit()
| false | 38.461538 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"-while len(s) > 1:",
"- s.pop(-1)",
"- if len(s) % 2 == 0:",
"- s1 = s[0 : len(s) // 2]",
"- s2 = s[len(s) // 2 :]",
"- # print(s1)",
"- # print(s2)",
"- if s1 == s2:",
"- print((len(s)))",
"... | false | 0.046099 | 0.038777 | 1.188839 | [
"s377485970",
"s454919637"
] |
u994521204 | p02727 | python | s943056302 | s224113393 | 618 | 342 | 116,816 | 111,852 | Accepted | Accepted | 44.66 | from heapq import heappop, heapify, heappush
x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [-i for i in C]
A.sort(reverse=True)
B.sort(reverse=True)
AB = A[:x] + (B[:y])
heapify(AB)
heapify(... | x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
ABC = A[:x] + B[:y] + C
ABC.sort(reverse=True)
print((sum(ABC[:(x+y)]))) | 24 | 9 | 494 | 270 | from heapq import heappop, heapify, heappush
x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [-i for i in C]
A.sort(reverse=True)
B.sort(reverse=True)
AB = A[:x] + (B[:y])
heapify(AB)
heapify(D)
ans = 0
for ... | x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
ABC = A[:x] + B[:y] + C
ABC.sort(reverse=True)
print((sum(ABC[: (x + y)])))
| false | 62.5 | [
"-from heapq import heappop, heapify, heappush",
"-",
"-D = [-i for i in C]",
"-AB = A[:x] + (B[:y])",
"-heapify(AB)",
"-heapify(D)",
"-ans = 0",
"-for _ in range(c):",
"- d = -heappop(D)",
"- ab = heappop(AB)",
"- if ab > d:",
"- heappush(AB, ab)",
"- break",
"- ... | false | 0.054875 | 0.036813 | 1.490636 | [
"s943056302",
"s224113393"
] |
u374802266 | p03018 | python | s737215637 | s746867970 | 93 | 80 | 5,796 | 11,336 | Accepted | Accepted | 13.98 | def rep(s):
a,b='',[]
for i in range(len(s)):
if s[i]=='C' or s[i]=='B':
b.append(a)
a=''
else:
a+=s[i]
b.append(a)
a=[]
for i in range(len(b)):
if b[i]!='':
a.append(b[i])
return a
s=rep(input().replace('BC','... | s=input().replace('BC','D')
a=[]
b=''
for c in s:
if c=='B' or c=='C':
a.append(b)
b=''
else:
b+=c
a.append(b)
ans=0
for i in a:
ac=0
for j in i:
if j=='A':
ac+=1
else:
ans+=ac
print(ans) | 24 | 19 | 449 | 285 | def rep(s):
a, b = "", []
for i in range(len(s)):
if s[i] == "C" or s[i] == "B":
b.append(a)
a = ""
else:
a += s[i]
b.append(a)
a = []
for i in range(len(b)):
if b[i] != "":
a.append(b[i])
return a
s = rep(input().replace(... | s = input().replace("BC", "D")
a = []
b = ""
for c in s:
if c == "B" or c == "C":
a.append(b)
b = ""
else:
b += c
a.append(b)
ans = 0
for i in a:
ac = 0
for j in i:
if j == "A":
ac += 1
else:
ans += ac
print(ans)
| false | 20.833333 | [
"-def rep(s):",
"- a, b = \"\", []",
"- for i in range(len(s)):",
"- if s[i] == \"C\" or s[i] == \"B\":",
"- b.append(a)",
"- a = \"\"",
"- else:",
"- a += s[i]",
"- b.append(a)",
"- a = []",
"- for i in range(len(b)):",
"- i... | false | 0.035912 | 0.054111 | 0.663678 | [
"s737215637",
"s746867970"
] |
u281303342 | p03625 | python | s115725358 | s553642937 | 190 | 110 | 21,540 | 21,540 | Accepted | Accepted | 42.11 | from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
C = sorted(Counter(A).most_common(),reverse=True)
D = list([x for x in C if x[1]>=2])
if len(D)<2:
print((0))
else:
print((D[0][0]**2 if D[0][1]>=4 else D[0][0]*D[1][0])) | N = int(eval(input()))
A = list(map(int,input().split()))
from collections import Counter
# 2本以上ある棒のみ集計
C = Counter(A).most_common()
D = []
for (k,v) in C:
if v>=2:
D.append((k,v))
D.sort()
# 一番長い棒が4本あれば正方形(も長方形のうち)
if len(D)>=1 and D[-1][1]>=4:
print((D[-1][0]**2))
elif len(D)>=2:
... | 9 | 21 | 268 | 362 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
C = sorted(Counter(A).most_common(), reverse=True)
D = list([x for x in C if x[1] >= 2])
if len(D) < 2:
print((0))
else:
print((D[0][0] ** 2 if D[0][1] >= 4 else D[0][0] * D[1][0]))
| N = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter
# 2本以上ある棒のみ集計
C = Counter(A).most_common()
D = []
for (k, v) in C:
if v >= 2:
D.append((k, v))
D.sort()
# 一番長い棒が4本あれば正方形(も長方形のうち)
if len(D) >= 1 and D[-1][1] >= 4:
print((D[-1][0] ** 2))
elif len(D) >= 2:
pri... | false | 57.142857 | [
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-C = sorted(Counter(A).most_common(), reverse=True)",
"-D = list([x for x in C if x[1] >= 2])",
"-if len(D) < 2:",
"+# 2本以上ある棒のみ集計",
"+C = Counter(A).most_common()",... | false | 0.044561 | 0.044134 | 1.009677 | [
"s115725358",
"s553642937"
] |
u583507988 | p02959 | python | s553500826 | s616960113 | 122 | 107 | 24,224 | 97,704 | Accepted | Accepted | 12.3 | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))+[0]
ans=0
for i in range(n+1):
if a[i]>=b[i]:
ans+=b[i]
else:
ans+=a[i]
d=b[i]-a[i]
if a[i+1]>d:
ans+=d
a[i+1]-=d
else:
ans+=a[i+1]
a[i+1]=0
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
if a[i]>=b[i]:
ans+=b[i]
else:
res=b[i]-a[i]
if a[i+1]-res<0:
ans+=a[i]+a[i+1]
a[i+1]=0
else:
ans+=b[i]
a[i+1]-=res
print(ans) | 17 | 16 | 296 | 291 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split())) + [0]
ans = 0
for i in range(n + 1):
if a[i] >= b[i]:
ans += b[i]
else:
ans += a[i]
d = b[i] - a[i]
if a[i + 1] > d:
ans += d
a[i + 1] -= d
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] >= b[i]:
ans += b[i]
else:
res = b[i] - a[i]
if a[i + 1] - res < 0:
ans += a[i] + a[i + 1]
a[i + 1] = 0
else:
ans ... | false | 5.882353 | [
"-b = list(map(int, input().split())) + [0]",
"+b = list(map(int, input().split()))",
"-for i in range(n + 1):",
"+for i in range(n):",
"- ans += a[i]",
"- d = b[i] - a[i]",
"- if a[i + 1] > d:",
"- ans += d",
"- a[i + 1] -= d",
"+ res = b[i] - a[i... | false | 0.047591 | 0.044403 | 1.071784 | [
"s553500826",
"s616960113"
] |
u761320129 | p03339 | python | s962123695 | s046269408 | 346 | 263 | 15,520 | 15,520 | Accepted | Accepted | 23.99 | N = int(eval(input()))
S = eval(input())
cumw = [0]
for c in S:
cumw.append(cumw[-1] + int(c=='W'))
ans = N
for i in range(N):
tmp = cumw[i]
tmp += (N-i-1) - (cumw[-1]-cumw[i+1])
ans = min(ans,tmp)
print(ans) | N = int(eval(input()))
S = eval(input())
cum_e = [0]
for c in S:
cum_e.append(cum_e[-1] + int(c == 'E'))
ans = N
for i in range(N):
tmp = i - cum_e[i] + cum_e[-1] - cum_e[i+1]
ans = min(ans, tmp)
print(ans) | 13 | 12 | 226 | 219 | N = int(eval(input()))
S = eval(input())
cumw = [0]
for c in S:
cumw.append(cumw[-1] + int(c == "W"))
ans = N
for i in range(N):
tmp = cumw[i]
tmp += (N - i - 1) - (cumw[-1] - cumw[i + 1])
ans = min(ans, tmp)
print(ans)
| N = int(eval(input()))
S = eval(input())
cum_e = [0]
for c in S:
cum_e.append(cum_e[-1] + int(c == "E"))
ans = N
for i in range(N):
tmp = i - cum_e[i] + cum_e[-1] - cum_e[i + 1]
ans = min(ans, tmp)
print(ans)
| false | 7.692308 | [
"-cumw = [0]",
"+cum_e = [0]",
"- cumw.append(cumw[-1] + int(c == \"W\"))",
"+ cum_e.append(cum_e[-1] + int(c == \"E\"))",
"- tmp = cumw[i]",
"- tmp += (N - i - 1) - (cumw[-1] - cumw[i + 1])",
"+ tmp = i - cum_e[i] + cum_e[-1] - cum_e[i + 1]"
] | false | 0.046961 | 0.046601 | 1.007716 | [
"s962123695",
"s046269408"
] |
u821624310 | p02399 | python | s323096856 | s164631540 | 30 | 20 | 7,624 | 7,624 | Accepted | Accepted | 33.33 | a, b = list(map(int, input().split()))
f = a / b
print((int(a / b), a % b, "{0:.5f}".format(f))) | a, b = list(map(int, input().split()))
f = a / b
print((int(a / b), a % b, "{0:.5f}".format(a / b))) | 3 | 3 | 90 | 94 | a, b = list(map(int, input().split()))
f = a / b
print((int(a / b), a % b, "{0:.5f}".format(f)))
| a, b = list(map(int, input().split()))
f = a / b
print((int(a / b), a % b, "{0:.5f}".format(a / b)))
| false | 0 | [
"-print((int(a / b), a % b, \"{0:.5f}\".format(f)))",
"+print((int(a / b), a % b, \"{0:.5f}\".format(a / b)))"
] | false | 0.045355 | 0.117532 | 0.385898 | [
"s323096856",
"s164631540"
] |
u283869437 | p02623 | python | s717969101 | s449156099 | 290 | 249 | 55,288 | 54,980 | Accepted | Accepted | 14.14 | n,m,k,*x=list(map(int,open(0).read().split()))
s=sum(x[:n])
z=i=j=n
while~i:
while j<n+m and s+x[j]<=k:s+=x[j];j+=1
if s<=k:z=max(z,i+j)
i-=1
s-=x[i]
print((z-n)) | n,m,k,*x=list(map(int,open(0).read().split()))
s=sum(x[:n])
z=i=j=n
x+=k,
while~i:
while s+x[j]<=k:s+=x[j];j+=1
if s<=k:z=max(z,i+j)
i-=1
s-=x[i]
print((z-n)) | 9 | 10 | 166 | 163 | n, m, k, *x = list(map(int, open(0).read().split()))
s = sum(x[:n])
z = i = j = n
while ~i:
while j < n + m and s + x[j] <= k:
s += x[j]
j += 1
if s <= k:
z = max(z, i + j)
i -= 1
s -= x[i]
print((z - n))
| n, m, k, *x = list(map(int, open(0).read().split()))
s = sum(x[:n])
z = i = j = n
x += (k,)
while ~i:
while s + x[j] <= k:
s += x[j]
j += 1
if s <= k:
z = max(z, i + j)
i -= 1
s -= x[i]
print((z - n))
| false | 10 | [
"+x += (k,)",
"- while j < n + m and s + x[j] <= k:",
"+ while s + x[j] <= k:"
] | false | 0.045193 | 0.113056 | 0.399744 | [
"s717969101",
"s449156099"
] |
u847165882 | p02767 | python | s042351932 | s259279628 | 178 | 22 | 38,640 | 3,064 | Accepted | Accepted | 87.64 | N=int(eval(input()))
X=[int(s) for s in input().split()]
sum=0
Ans=0
count=0
Xmax=sorted(X)[N-1]
Xmax2=sorted(X)[N-2]
for i in range(2*Xmax):
sum=0
for j in range(N):
sum+=(X[j]-i)**2
count+=1
if count==1:
Ans=sum
Ans=min(Ans,sum)
print(Ans) | N=int(eval(input()))
X=[int(s) for s in input().split(" ")]
X.sort()
Ans=N*(X[-1]**2)
for i in range(X[-1]+1):
Sum=0
for j in range(N):
Sum=Sum+(X[j]-i)**2
if Sum<Ans:
Ans=Sum
print(Ans) | 20 | 14 | 298 | 224 | N = int(eval(input()))
X = [int(s) for s in input().split()]
sum = 0
Ans = 0
count = 0
Xmax = sorted(X)[N - 1]
Xmax2 = sorted(X)[N - 2]
for i in range(2 * Xmax):
sum = 0
for j in range(N):
sum += (X[j] - i) ** 2
count += 1
if count == 1:
Ans = sum
Ans = min(Ans, sum)
print(Ans)
| N = int(eval(input()))
X = [int(s) for s in input().split(" ")]
X.sort()
Ans = N * (X[-1] ** 2)
for i in range(X[-1] + 1):
Sum = 0
for j in range(N):
Sum = Sum + (X[j] - i) ** 2
if Sum < Ans:
Ans = Sum
print(Ans)
| false | 30 | [
"-X = [int(s) for s in input().split()]",
"-sum = 0",
"-Ans = 0",
"-count = 0",
"-Xmax = sorted(X)[N - 1]",
"-Xmax2 = sorted(X)[N - 2]",
"-for i in range(2 * Xmax):",
"- sum = 0",
"+X = [int(s) for s in input().split(\" \")]",
"+X.sort()",
"+Ans = N * (X[-1] ** 2)",
"+for i in range(X[-1] +... | false | 0.044605 | 0.036689 | 1.215775 | [
"s042351932",
"s259279628"
] |
u794173881 | p03167 | python | s160030505 | s460405094 | 679 | 285 | 165,284 | 53,744 | Accepted | Accepted | 58.03 | H,W = list(map(int,input().split()))
a = [list(eval(input())) for i in range(H)]
dp=[[0]*(W) for i in range(H)]
flagH = 0
flagW = 0
for i in range(H):
if a[i][0]=="." and flagH==0:
dp[i][0]=1
else:
dp[i][0]=0
flagH=1
for j in range(W):
if a[0][j]=="." and flagW==0:
dp[0][j]=1
... | h, w = list(map(int, input().split()))
a = [eval(input()) for i in range(h)]
MOD = 10**9 + 7
dp = [[0]*w for i in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
if a[i][j] == ".":
if i+1 < h:
dp[i+1][j] += dp[i][j]
dp[i+1][j] %= MOD
... | 28 | 18 | 487 | 425 | H, W = list(map(int, input().split()))
a = [list(eval(input())) for i in range(H)]
dp = [[0] * (W) for i in range(H)]
flagH = 0
flagW = 0
for i in range(H):
if a[i][0] == "." and flagH == 0:
dp[i][0] = 1
else:
dp[i][0] = 0
flagH = 1
for j in range(W):
if a[0][j] == "." and flagW == 0... | h, w = list(map(int, input().split()))
a = [eval(input()) for i in range(h)]
MOD = 10**9 + 7
dp = [[0] * w for i in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
if a[i][j] == ".":
if i + 1 < h:
dp[i + 1][j] += dp[i][j]
dp[i + 1][j] %= MOD
... | false | 35.714286 | [
"-H, W = list(map(int, input().split()))",
"-a = [list(eval(input())) for i in range(H)]",
"-dp = [[0] * (W) for i in range(H)]",
"-flagH = 0",
"-flagW = 0",
"-for i in range(H):",
"- if a[i][0] == \".\" and flagH == 0:",
"- dp[i][0] = 1",
"- else:",
"- dp[i][0] = 0",
"- ... | false | 0.04871 | 0.048186 | 1.010873 | [
"s160030505",
"s460405094"
] |
u153665391 | p02267 | python | s522096114 | s019855344 | 60 | 20 | 6,548 | 6,316 | Accepted | Accepted | 66.67 | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
match_count = 0
for i in T:
for j in S:
if i == j:
match_count += 1
break
print((str(match_count)))
| N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
match_count = 0
for i in T:
if i in S:
match_count += 1
print((str(match_count)))
| 14 | 11 | 256 | 210 | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
match_count = 0
for i in T:
for j in S:
if i == j:
match_count += 1
break
print((str(match_count)))
| N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
match_count = 0
for i in T:
if i in S:
match_count += 1
print((str(match_count)))
| false | 21.428571 | [
"- for j in S:",
"- if i == j:",
"- match_count += 1",
"- break",
"+ if i in S:",
"+ match_count += 1"
] | false | 0.044949 | 0.041574 | 1.081166 | [
"s522096114",
"s019855344"
] |
u787456042 | p02947 | python | s843184834 | s708444749 | 1,653 | 250 | 81,816 | 31,080 | Accepted | Accepted | 84.88 | from collections import Counter as C
n,*s=open(0)
print((int(sum([x*(x-1)//2 for x in list(C(tuple(sorted(C(i.strip()).most_common(),key=lambda x:x[0]))for i in s).values())])))) | from collections import Counter as C
n,*s=open(0)
print((sum(x*(x-1)//2 for x in list(C(tuple(sorted(i.strip()))for i in s).values())))) | 3 | 3 | 175 | 130 | from collections import Counter as C
n, *s = open(0)
print(
(
int(
sum(
[
x * (x - 1) // 2
for x in list(
C(
tuple(
sorted(C(i.strip()).most_common(), key=... | from collections import Counter as C
n, *s = open(0)
print(
(
sum(
x * (x - 1) // 2
for x in list(C(tuple(sorted(i.strip())) for i in s).values())
)
)
)
| false | 0 | [
"- int(",
"- sum(",
"- [",
"- x * (x - 1) // 2",
"- for x in list(",
"- C(",
"- tuple(",
"- sorted(C(i.strip()).most_common(), key=lambda x: x[0])",
... | false | 0.049703 | 0.035494 | 1.400316 | [
"s843184834",
"s708444749"
] |
u920103253 | p02947 | python | s803719698 | s646039783 | 1,369 | 328 | 43,368 | 25,320 | Accepted | Accepted | 76.04 |
def s0():return eval(input())
def s1():return input().split()
def s2(n):return [eval(input()) for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):... |
def s0():return eval(input())
def s1():return input().split()
def s2(n):return [eval(input()) for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):... | 36 | 32 | 1,063 | 979 | def s0():
return eval(input())
def s1():
return input().split()
def s2(n):
return [eval(input()) for x in range(n)]
def s3(n):
return [input().split() for _ in range(n)]
def s4(n):
return [[x for x in s] for s in s2(n)]
def n0():
return int(eval(input()))
def n1():
return [int(x)... | def s0():
return eval(input())
def s1():
return input().split()
def s2(n):
return [eval(input()) for x in range(n)]
def s3(n):
return [input().split() for _ in range(n)]
def s4(n):
return [[x for x in s] for s in s2(n)]
def n0():
return int(eval(input()))
def n1():
return [int(x)... | false | 11.111111 | [
"- a = [0] * 26",
"- c = set((Counter(line)).items())",
"- for t in c:",
"- a[ord(t[0]) - 97] = t[1]",
"- d[tuple(a)] += 1",
"+ d[\"\".join(sorted(line))] += 1"
] | false | 0.047507 | 0.09436 | 0.503467 | [
"s803719698",
"s646039783"
] |
u066413086 | p03161 | python | s949508637 | s582456784 | 1,979 | 374 | 20,772 | 56,508 | Accepted | Accepted | 81.1 | import numpy as np
import sys
N, K = list(map(int,input().split()))
h = np.fromstring(eval(input()), dtype=np.int64, sep=' ')
# コスト無限大で初期化
INF = 10**10
dp = np.array([INF]*N)
dp[0] = 0
for i in range(1, N):
# i番目の梯子までの最小移動コストは、
# 「i-1番目までの移動コスト」+「i-1番目からi番目への移動コスト」
# もしくは、
# 「i-2番目までの移動コスト」+「i-2番目... | import sys
read = sys.stdin.buffer.read
N, K, *h = list(map(int, read().split()))
# print(N, K, h)
def chmin(l, i, v):
if l[i] > v:
l[i] = v
return True
return False
def chmax(l, i, v):
if l[i] < v:
l[i] = v
return True
return False
# コスト無限大で初期化
INF = float("inf")
dp ... | 25 | 40 | 578 | 749 | import numpy as np
import sys
N, K = list(map(int, input().split()))
h = np.fromstring(eval(input()), dtype=np.int64, sep=" ")
# コスト無限大で初期化
INF = 10**10
dp = np.array([INF] * N)
dp[0] = 0
for i in range(1, N):
# i番目の梯子までの最小移動コストは、
# 「i-1番目までの移動コスト」+「i-1番目からi番目への移動コスト」
# もしくは、
# 「i-2番目までの移動コスト」+「i-2番目から... | import sys
read = sys.stdin.buffer.read
N, K, *h = list(map(int, read().split()))
# print(N, K, h)
def chmin(l, i, v):
if l[i] > v:
l[i] = v
return True
return False
def chmax(l, i, v):
if l[i] < v:
l[i] = v
return True
return False
# コスト無限大で初期化
INF = float("inf")
dp... | false | 37.5 | [
"-import numpy as np",
"-N, K = list(map(int, input().split()))",
"-h = np.fromstring(eval(input()), dtype=np.int64, sep=\" \")",
"+read = sys.stdin.buffer.read",
"+N, K, *h = list(map(int, read().split()))",
"+# print(N, K, h)",
"+def chmin(l, i, v):",
"+ if l[i] > v:",
"+ l[i] = v",
"+... | false | 0.167147 | 0.035719 | 4.679508 | [
"s949508637",
"s582456784"
] |
u969850098 | p03211 | python | s597371678 | s587418597 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S = eval(input())
ans = 753
for i in range(len(S) - 2):
if abs(753 - int(S[i: i + 3])) < ans:
ans = abs(753 - int(S[i: i + 3]))
print(ans) | S = eval(input())
res = 753
for i in range(len(S)-2):
res = min(res, abs(int(S[i:i+3]) - 753))
print(res) | 6 | 6 | 149 | 109 | S = eval(input())
ans = 753
for i in range(len(S) - 2):
if abs(753 - int(S[i : i + 3])) < ans:
ans = abs(753 - int(S[i : i + 3]))
print(ans)
| S = eval(input())
res = 753
for i in range(len(S) - 2):
res = min(res, abs(int(S[i : i + 3]) - 753))
print(res)
| false | 0 | [
"-ans = 753",
"+res = 753",
"- if abs(753 - int(S[i : i + 3])) < ans:",
"- ans = abs(753 - int(S[i : i + 3]))",
"-print(ans)",
"+ res = min(res, abs(int(S[i : i + 3]) - 753))",
"+print(res)"
] | false | 0.051328 | 0.044419 | 1.155535 | [
"s597371678",
"s587418597"
] |
u620084012 | p03486 | python | s864912145 | s827339886 | 172 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.12 | s = [str(x) for x in eval(input())]
t = [str(x) for x in eval(input())]
s = sorted(s)
t = sorted(t,reverse = True)
if "".join(s) < "".join(t):
print("Yes")
else:
print("No")
| s = sorted(eval(input()))
t = sorted(eval(input()),reverse = True)
print(("Yes" if s<t else "No"))
| 9 | 3 | 179 | 87 | s = [str(x) for x in eval(input())]
t = [str(x) for x in eval(input())]
s = sorted(s)
t = sorted(t, reverse=True)
if "".join(s) < "".join(t):
print("Yes")
else:
print("No")
| s = sorted(eval(input()))
t = sorted(eval(input()), reverse=True)
print(("Yes" if s < t else "No"))
| false | 66.666667 | [
"-s = [str(x) for x in eval(input())]",
"-t = [str(x) for x in eval(input())]",
"-s = sorted(s)",
"-t = sorted(t, reverse=True)",
"-if \"\".join(s) < \"\".join(t):",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+s = sorted(eval(input()))",
"+t = sorted(eval(input()), reverse=True)",
"... | false | 0.043015 | 0.042588 | 1.010022 | [
"s864912145",
"s827339886"
] |
u392319141 | p02852 | python | s291762774 | s350698753 | 168 | 153 | 10,248 | 10,248 | Accepted | Accepted | 8.93 | from bisect import bisect_right
N, M = list(map(int, input().split()))
S = [-i for i, s in enumerate(eval(input())) if s == '0']
S = S[:: -1]
ans = []
now = 0
while S[now] != 0:
to = bisect_right(S, S[now] + M) - 1
if to == now:
print('-1')
exit()
ans.append(S[to] - S[now])
... | from bisect import bisect_right
N, M = list(map(int, input().split()))
S = [N - i for i, s in enumerate(eval(input())) if s == '0']
S = S[::-1]
ans = []
now = 0
while now < N:
i = bisect_right(S, now + M) - 1
if S[i] == now:
print('-1')
exit()
ans.append(S[i] - now)
n... | 19 | 19 | 354 | 339 | from bisect import bisect_right
N, M = list(map(int, input().split()))
S = [-i for i, s in enumerate(eval(input())) if s == "0"]
S = S[::-1]
ans = []
now = 0
while S[now] != 0:
to = bisect_right(S, S[now] + M) - 1
if to == now:
print("-1")
exit()
ans.append(S[to] - S[now])
now = to
ans ... | from bisect import bisect_right
N, M = list(map(int, input().split()))
S = [N - i for i, s in enumerate(eval(input())) if s == "0"]
S = S[::-1]
ans = []
now = 0
while now < N:
i = bisect_right(S, now + M) - 1
if S[i] == now:
print("-1")
exit()
ans.append(S[i] - now)
now = S[i]
print((*a... | false | 0 | [
"-S = [-i for i, s in enumerate(eval(input())) if s == \"0\"]",
"+S = [N - i for i, s in enumerate(eval(input())) if s == \"0\"]",
"-while S[now] != 0:",
"- to = bisect_right(S, S[now] + M) - 1",
"- if to == now:",
"+while now < N:",
"+ i = bisect_right(S, now + M) - 1",
"+ if S[i] == now:... | false | 0.044874 | 0.049607 | 0.90459 | [
"s291762774",
"s350698753"
] |
u262995141 | p03387 | python | s436209986 | s825141484 | 149 | 17 | 12,488 | 2,940 | Accepted | Accepted | 88.59 | #https://atcoder.jp/contests/abc093/tasks/arc094_a
import numpy
data = list(map(int, input().split()))
cost = 0
max_index = numpy.argmax(data)
m = data.pop(max_index)
if abs(data[0]-data[1])%2 == 1:
cost += 2
cost += (abs(data[0]-data[1])//2 + m - max(data))
print(cost)
| #https://atcoder.jp/contests/abc093/tasks/arc094_a
a, b, c = list(map(int, input().split()))
diff = 3*max(a, b, c) - (a + b + c)
if diff%2 == 1:
print((diff//2+2))
else:
print((diff//2))
| 12 | 10 | 288 | 197 | # https://atcoder.jp/contests/abc093/tasks/arc094_a
import numpy
data = list(map(int, input().split()))
cost = 0
max_index = numpy.argmax(data)
m = data.pop(max_index)
if abs(data[0] - data[1]) % 2 == 1:
cost += 2
cost += abs(data[0] - data[1]) // 2 + m - max(data)
print(cost)
| # https://atcoder.jp/contests/abc093/tasks/arc094_a
a, b, c = list(map(int, input().split()))
diff = 3 * max(a, b, c) - (a + b + c)
if diff % 2 == 1:
print((diff // 2 + 2))
else:
print((diff // 2))
| false | 16.666667 | [
"-import numpy",
"-",
"-data = list(map(int, input().split()))",
"-cost = 0",
"-max_index = numpy.argmax(data)",
"-m = data.pop(max_index)",
"-if abs(data[0] - data[1]) % 2 == 1:",
"- cost += 2",
"-cost += abs(data[0] - data[1]) // 2 + m - max(data)",
"-print(cost)",
"+a, b, c = list(map(int,... | false | 0.179168 | 0.082623 | 2.168496 | [
"s436209986",
"s825141484"
] |
u798557584 | p02729 | python | s917310681 | s506152176 | 23 | 17 | 3,064 | 3,060 | Accepted | Accepted | 26.09 | import itertools
N,M=list(map(int,input().split()))
l=[]
t=1
for i in range(N):
l.append(t)
t+=2
t=2
for i in range(M):
l.append(t)
t+=2
count=0
for v in itertools.combinations(l,2):
#print(v[0],v[1])
if (v[0]+v[1])%2==0:
count+=1
print(count) | import math
def combinations_count(n,r):
if n<r:
return 0
# c=n!/(r!*(n-r)!)
return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
N,M=list(map(int,input().split()))
print((combinations_count(N,2)+combinations_count(M,2))) | 17 | 8 | 287 | 259 | import itertools
N, M = list(map(int, input().split()))
l = []
t = 1
for i in range(N):
l.append(t)
t += 2
t = 2
for i in range(M):
l.append(t)
t += 2
count = 0
for v in itertools.combinations(l, 2):
# print(v[0],v[1])
if (v[0] + v[1]) % 2 == 0:
count += 1
print(count)
| import math
def combinations_count(n, r):
if n < r:
return 0
# c=n!/(r!*(n-r)!)
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = list(map(int, input().split()))
print((combinations_count(N, 2) + combinations_count(M, 2)))
| false | 52.941176 | [
"-import itertools",
"+import math",
"+",
"+",
"+def combinations_count(n, r):",
"+ if n < r:",
"+ return 0",
"+ # c=n!/(r!*(n-r)!)",
"+ return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"+",
"-l = []",
"-t = 1",
"-for i in range(N):",
"- l.append... | false | 0.087474 | 0.068789 | 1.271632 | [
"s917310681",
"s506152176"
] |
u811967730 | p02881 | python | s511596257 | s844455374 | 221 | 141 | 2,940 | 2,940 | Accepted | Accepted | 36.2 | N = int(eval(input()))
x = int(N ** 0.5)
for i in range(x):
if N % x == 0:
y = N // x
break
x -= 1
ans = x + y - 2
print(ans)
| N = int(eval(input()))
x = int(N ** 0.5)
for i in range(x, 0, -1):
if N % i == 0:
y = N // i
break
ans = N // y + y - 2
print(ans)
| 13 | 12 | 160 | 160 | N = int(eval(input()))
x = int(N**0.5)
for i in range(x):
if N % x == 0:
y = N // x
break
x -= 1
ans = x + y - 2
print(ans)
| N = int(eval(input()))
x = int(N**0.5)
for i in range(x, 0, -1):
if N % i == 0:
y = N // i
break
ans = N // y + y - 2
print(ans)
| false | 7.692308 | [
"-for i in range(x):",
"- if N % x == 0:",
"- y = N // x",
"+for i in range(x, 0, -1):",
"+ if N % i == 0:",
"+ y = N // i",
"- x -= 1",
"-ans = x + y - 2",
"+ans = N // y + y - 2"
] | false | 0.125903 | 0.124058 | 1.014869 | [
"s511596257",
"s844455374"
] |
u513081876 | p03775 | python | s665927452 | s024040525 | 160 | 30 | 12,500 | 3,060 | Accepted | Accepted | 81.25 | n = int(eval(input()))
ans = len(str(n))
import numpy
for i in range(2, int(numpy.sqrt(n))+1):
if n % i == 0:
ABmax = max(len(str(i)), len(str(n//i)))
ans = min (ans, ABmax)
print(ans) | from math import sqrt
N = int(eval(input()))
ans = float('inf')
for A in range(1, int(sqrt(N))+1):
if N % A == 0:
B = N // A
ans = min(ans, max(len(str(A)), len(str(B))))
print(ans) | 10 | 11 | 209 | 208 | n = int(eval(input()))
ans = len(str(n))
import numpy
for i in range(2, int(numpy.sqrt(n)) + 1):
if n % i == 0:
ABmax = max(len(str(i)), len(str(n // i)))
ans = min(ans, ABmax)
print(ans)
| from math import sqrt
N = int(eval(input()))
ans = float("inf")
for A in range(1, int(sqrt(N)) + 1):
if N % A == 0:
B = N // A
ans = min(ans, max(len(str(A)), len(str(B))))
print(ans)
| false | 9.090909 | [
"-n = int(eval(input()))",
"-ans = len(str(n))",
"-import numpy",
"+from math import sqrt",
"-for i in range(2, int(numpy.sqrt(n)) + 1):",
"- if n % i == 0:",
"- ABmax = max(len(str(i)), len(str(n // i)))",
"- ans = min(ans, ABmax)",
"+N = int(eval(input()))",
"+ans = float(\"inf\... | false | 0.252557 | 0.039184 | 6.445413 | [
"s665927452",
"s024040525"
] |
u471898432 | p02837 | python | s347667970 | s132641217 | 547 | 96 | 3,064 | 3,064 | Accepted | Accepted | 82.45 | import itertools
def is_compatible(hyp, testimonies):
return all([(key in hyp) == (val == 1) for key, val in list(testimonies.items())])
def is_compatible_all(hyp, all_testimonies):
return all([is_compatible(hyp, all_testimonies[i]) for i in hyp])
def main():
n = int(eval(input()))
... | import itertools
def is_compatible(hyp, testimonies):
return all((key in hyp) == (val == 1) for key, val in list(testimonies.items()))
def is_compatible_all(hyp, all_testimonies):
return all(is_compatible(hyp, all_testimonies[i]) for i in hyp)
def main():
n = int(eval(input()))
all_... | 39 | 39 | 901 | 897 | import itertools
def is_compatible(hyp, testimonies):
return all([(key in hyp) == (val == 1) for key, val in list(testimonies.items())])
def is_compatible_all(hyp, all_testimonies):
return all([is_compatible(hyp, all_testimonies[i]) for i in hyp])
def main():
n = int(eval(input()))
all_testimonies... | import itertools
def is_compatible(hyp, testimonies):
return all((key in hyp) == (val == 1) for key, val in list(testimonies.items()))
def is_compatible_all(hyp, all_testimonies):
return all(is_compatible(hyp, all_testimonies[i]) for i in hyp)
def main():
n = int(eval(input()))
all_testimonies = [... | false | 0 | [
"- return all([(key in hyp) == (val == 1) for key, val in list(testimonies.items())])",
"+ return all((key in hyp) == (val == 1) for key, val in list(testimonies.items()))",
"- return all([is_compatible(hyp, all_testimonies[i]) for i in hyp])",
"+ return all(is_compatible(hyp, all_testimonies[i]) ... | false | 0.040038 | 0.048341 | 0.82824 | [
"s347667970",
"s132641217"
] |
u761529120 | p03033 | python | s681047513 | s770710410 | 1,619 | 1,429 | 124,688 | 125,020 | Accepted | Accepted | 11.74 | import sys
input = sys.stdin.readline
from bisect import bisect_left
# 区間更新 1点取得
class SegmentTree:
def __init__(self, N):
tmp = 1
while tmp < N:
tmp <<= 1
# self.N : 完全二分木の葉の数(N以上の最小の2べき)
self.N = tmp
# 2*self.N - 1 : 完全二分木のノード数
# 1-indexedで... | from bisect import bisect_left
import sys
input = sys.stdin.readline
class SegmentTree():
def __init__(self,size,func,default):
self.leaf=2**(size-1).bit_length()
self.data=[default]*(2*self.leaf-1)
self.f=func; self.d=default
def rangeupdate(self,l,r,x):
l+=self.leaf-... | 65 | 64 | 1,518 | 1,553 | import sys
input = sys.stdin.readline
from bisect import bisect_left
# 区間更新 1点取得
class SegmentTree:
def __init__(self, N):
tmp = 1
while tmp < N:
tmp <<= 1
# self.N : 完全二分木の葉の数(N以上の最小の2べき)
self.N = tmp
# 2*self.N - 1 : 完全二分木のノード数
# 1-indexedで管理するので1プラス
... | from bisect import bisect_left
import sys
input = sys.stdin.readline
class SegmentTree:
def __init__(self, size, func, default):
self.leaf = 2 ** (size - 1).bit_length()
self.data = [default] * (2 * self.leaf - 1)
self.f = func
self.d = default
def rangeupdate(self, l, r, x):... | false | 1.538462 | [
"+from bisect import bisect_left",
"-from bisect import bisect_left",
"-# 区間更新 1点取得",
"+",
"- def __init__(self, N):",
"- tmp = 1",
"- while tmp < N:",
"- tmp <<= 1",
"- # self.N : 完全二分木の葉の数(N以上の最小の2べき)",
"- self.N = tmp",
"- # 2*self.N - 1 : 完全二分... | false | 0.031964 | 0.033153 | 0.964136 | [
"s681047513",
"s770710410"
] |
u254871849 | p03828 | python | s407076693 | s849538099 | 313 | 25 | 131,548 | 3,436 | Accepted | Accepted | 92.01 | import sys
from collections import defaultdict
from bisect import bisect_right as bi_r
def sieve_of_eratosthenes(n=10 ** 6):
if n == 1: return set()
sieve = set(range(2, n + 1))
for p in sieve_of_eratosthenes(int(n ** 0.5)):
sieve -= set(range(p * 2, n + 1, p))
return sieve
prime_numbers = siev... | import sys
from collections import defaultdict
from bisect import bisect_right as bi_r
U = 5 * 10 ** 6
def sieve_of_eratosthenes(n=U):
if n == 1: return set()
sieve = set(range(2, n + 1))
for p in sieve_of_eratosthenes(int(n ** 0.5)):
sieve -= set(range(p * 2, n + 1, p))
return sieve
prime_num... | 47 | 48 | 1,109 | 1,127 | import sys
from collections import defaultdict
from bisect import bisect_right as bi_r
def sieve_of_eratosthenes(n=10**6):
if n == 1:
return set()
sieve = set(range(2, n + 1))
for p in sieve_of_eratosthenes(int(n**0.5)):
sieve -= set(range(p * 2, n + 1, p))
return sieve
prime_numbers... | import sys
from collections import defaultdict
from bisect import bisect_right as bi_r
U = 5 * 10**6
def sieve_of_eratosthenes(n=U):
if n == 1:
return set()
sieve = set(range(2, n + 1))
for p in sieve_of_eratosthenes(int(n**0.5)):
sieve -= set(range(p * 2, n + 1, p))
return sieve
pr... | false | 2.083333 | [
"+U = 5 * 10**6",
"-def sieve_of_eratosthenes(n=10**6):",
"+",
"+def sieve_of_eratosthenes(n=U):",
"-prime_numbers = sieve_of_eratosthenes()",
"+prime_numbers = sieve_of_eratosthenes(10**3)"
] | false | 0.628295 | 0.040994 | 15.326411 | [
"s407076693",
"s849538099"
] |
u393253137 | p02744 | python | s093904301 | s803067102 | 67 | 52 | 16,340 | 15,368 | Accepted | Accepted | 22.39 | n = int(eval(input()))
A = ['a']
S = 'abcdefghij'
for _ in range(n-1):
B = []
for a in A:
for s in S[:len(set(a)) + 1]:
B.append(a + s)
A = B[::]
print(('\n'.join(A))) | n = int(eval(input()))
A = ['a']
S = 'abcdefghij'
for _ in range(n-1):
A = [ a + s for a in A for s in S[:len(set(a)) + 1]]
print(('\n'.join(A))) | 10 | 6 | 200 | 146 | n = int(eval(input()))
A = ["a"]
S = "abcdefghij"
for _ in range(n - 1):
B = []
for a in A:
for s in S[: len(set(a)) + 1]:
B.append(a + s)
A = B[::]
print(("\n".join(A)))
| n = int(eval(input()))
A = ["a"]
S = "abcdefghij"
for _ in range(n - 1):
A = [a + s for a in A for s in S[: len(set(a)) + 1]]
print(("\n".join(A)))
| false | 40 | [
"- B = []",
"- for a in A:",
"- for s in S[: len(set(a)) + 1]:",
"- B.append(a + s)",
"- A = B[::]",
"+ A = [a + s for a in A for s in S[: len(set(a)) + 1]]"
] | false | 0.091255 | 0.118183 | 0.77215 | [
"s093904301",
"s803067102"
] |
u386819480 | p03017 | python | s491485959 | s106010471 | 24 | 19 | 5,364 | 3,572 | Accepted | Accepted | 20.83 | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, D: int, S: str):
if(S[A-1] == '#' or S[B-1] == '#' or S[C-1] == '#' or S[D-1] == '#'):
print(NO)
sys.exit()
if(S[A-1:C].count('##') == 0 and S[B-1:D].count(... | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, D: int, S: str):
if(S[A-1:C+1].count('##') > 0 or S[B-1:D+1].count('##')):
# if(S[A:max(C,D)].count('##') > 1):
print(NO)
sys.exit()
if(D < C):
... | 65 | 41 | 2,037 | 1,132 | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, D: int, S: str):
if S[A - 1] == "#" or S[B - 1] == "#" or S[C - 1] == "#" or S[D - 1] == "#":
print(NO)
sys.exit()
if S[A - 1 : C].count("##") == 0 and S[B - 1 : D].coun... | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
def solve(N: int, A: int, B: int, C: int, D: int, S: str):
if S[A - 1 : C + 1].count("##") > 0 or S[B - 1 : D + 1].count("##"):
# if(S[A:max(C,D)].count('##') > 1):
print(NO)
sys.exit()
if D < C:
... | false | 36.923077 | [
"- if S[A - 1] == \"#\" or S[B - 1] == \"#\" or S[C - 1] == \"#\" or S[D - 1] == \"#\":",
"+ if S[A - 1 : C + 1].count(\"##\") > 0 or S[B - 1 : D + 1].count(\"##\"):",
"+ # if(S[A:max(C,D)].count('##') > 1):",
"- if S[A - 1 : C].count(\"##\") == 0 and S[B - 1 : D].count(\"##\") == 0:",
"- ... | false | 0.041944 | 0.041682 | 1.006265 | [
"s491485959",
"s106010471"
] |
u729133443 | p03761 | python | s552117367 | s892285013 | 175 | 17 | 38,512 | 3,060 | Accepted | Accepted | 90.29 | _,*s=open(0)
for c in map(chr,range(97,123)):print(c*min(t.count(c)for t in s),end='')
| _,*s=open(0)
for c in sorted(set(s[0])):print(c*min(t.count(c)for t in s),end='')
| 2 | 2 | 87 | 82 | _, *s = open(0)
for c in map(chr, range(97, 123)):
print(c * min(t.count(c) for t in s), end="")
| _, *s = open(0)
for c in sorted(set(s[0])):
print(c * min(t.count(c) for t in s), end="")
| false | 0 | [
"-for c in map(chr, range(97, 123)):",
"+for c in sorted(set(s[0])):"
] | false | 0.062288 | 0.043873 | 1.419724 | [
"s552117367",
"s892285013"
] |
u394950523 | p02886 | python | s566681393 | s334144096 | 20 | 18 | 3,188 | 3,060 | Accepted | Accepted | 10 | import itertools
import operator
N = int(eval(input()))
d = list(map(int, input().split()))
n = N * (N - 1) // 2
l = []
c = list(itertools.combinations(d, 2))
for i in range(n):
l.append(operator.mul(c[i][0], c[i][1]))
ans = sum(l)
print(ans) | import itertools
N = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
c = list(itertools.combinations(d, 2))
for x in c:
ans += x[0] * x[1]
print(ans) | 14 | 11 | 256 | 175 | import itertools
import operator
N = int(eval(input()))
d = list(map(int, input().split()))
n = N * (N - 1) // 2
l = []
c = list(itertools.combinations(d, 2))
for i in range(n):
l.append(operator.mul(c[i][0], c[i][1]))
ans = sum(l)
print(ans)
| import itertools
N = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
c = list(itertools.combinations(d, 2))
for x in c:
ans += x[0] * x[1]
print(ans)
| false | 21.428571 | [
"-import operator",
"-n = N * (N - 1) // 2",
"-l = []",
"+ans = 0",
"-for i in range(n):",
"- l.append(operator.mul(c[i][0], c[i][1]))",
"-ans = sum(l)",
"+for x in c:",
"+ ans += x[0] * x[1]"
] | false | 0.038945 | 0.040122 | 0.970675 | [
"s566681393",
"s334144096"
] |
u917558625 | p03997 | python | s586453248 | s653856765 | 28 | 25 | 9,092 | 9,012 | Accepted | Accepted | 10.71 | a=int(eval(input()))
b=int(eval(input()))
h=int(eval(input()))
print(((a+b)*h//2)) | print(((int(eval(input()))+int(eval(input())))*int(eval(input()))//2)) | 4 | 1 | 65 | 50 | a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
print(((a + b) * h // 2))
| print(((int(eval(input())) + int(eval(input()))) * int(eval(input())) // 2))
| false | 75 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-h = int(eval(input()))",
"-print(((a + b) * h // 2))",
"+print(((int(eval(input())) + int(eval(input()))) * int(eval(input())) // 2))"
] | false | 0.038186 | 0.044673 | 0.854797 | [
"s586453248",
"s653856765"
] |
u906501980 | p03363 | python | s990747122 | s522538587 | 264 | 175 | 52,544 | 41,496 | Accepted | Accepted | 33.71 | n = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0]*(n+1)
num = {}
for i in range(n):
S[i+1] = S[i] + A[i]
for i in S:
s = str(i)
num[s] = 1 if s not in list(num.keys()) else num[s]+1
out = [i*(i-1)//2 for i in list(num.values()) if i > 1]
print((sum(out))) | from collections import Counter
n = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
S[i+1] = S[i] + A[i]
out = [i*(i-1)//2 for i in list(Counter(S).values()) if i > 1]
print((sum(out))) | 11 | 8 | 276 | 224 | n = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0] * (n + 1)
num = {}
for i in range(n):
S[i + 1] = S[i] + A[i]
for i in S:
s = str(i)
num[s] = 1 if s not in list(num.keys()) else num[s] + 1
out = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]
print((sum(out)))
| from collections import Counter
n = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0] * (n + 1)
for i in range(n):
S[i + 1] = S[i] + A[i]
out = [i * (i - 1) // 2 for i in list(Counter(S).values()) if i > 1]
print((sum(out)))
| false | 27.272727 | [
"+from collections import Counter",
"+",
"-num = {}",
"-for i in S:",
"- s = str(i)",
"- num[s] = 1 if s not in list(num.keys()) else num[s] + 1",
"-out = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]",
"+out = [i * (i - 1) // 2 for i in list(Counter(S).values()) if i > 1]"
] | false | 0.037513 | 0.0074 | 5.068951 | [
"s990747122",
"s522538587"
] |
u261103969 | p02881 | python | s241697141 | s139763549 | 180 | 79 | 2,940 | 65,220 | Accepted | Accepted | 56.11 | import sys
n = int(eval(input()))
for i in range(int(n**0.5),0,-1):
if n % i == 0:
print((n//i + i - 2 ))
sys.exit() | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
def enum_divisors(n):
# 約数列挙
divisors = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
... | 8 | 37 | 137 | 670 | import sys
n = int(eval(input()))
for i in range(int(n**0.5), 0, -1):
if n % i == 0:
print((n // i + i - 2))
sys.exit()
| import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
def enum_divisors(n):
# 約数列挙
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
... | false | 78.378378 | [
"-n = int(eval(input()))",
"-for i in range(int(n**0.5), 0, -1):",
"- if n % i == 0:",
"- print((n // i + i - 2))",
"- sys.exit()",
"+readline = sys.stdin.readline",
"+MOD = 10**9 + 7",
"+INF = float(\"INF\")",
"+sys.setrecursionlimit(10**5)",
"+",
"+",
"+def main():",
"+ ... | false | 0.228481 | 0.039073 | 5.847483 | [
"s241697141",
"s139763549"
] |
u145950990 | p03146 | python | s619432051 | s175515571 | 169 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.94 | s = int(eval(input()))
def f(x):
if x%2==0: return x//2
else: return 3*x+1
a = []
for i in range(1000000):
if s in a:
print((i+1))
break
else:
a.append(s)
s = f(s)
| s = int(eval(input()))
def f(x):
if x%2==0:return x//2
else:return x*3+1
a = []
i = 1
while True:
if s in a:
print(i)
exit()
else:
a.append(s)
s = f(s)
i+=1 | 14 | 16 | 219 | 223 | s = int(eval(input()))
def f(x):
if x % 2 == 0:
return x // 2
else:
return 3 * x + 1
a = []
for i in range(1000000):
if s in a:
print((i + 1))
break
else:
a.append(s)
s = f(s)
| s = int(eval(input()))
def f(x):
if x % 2 == 0:
return x // 2
else:
return x * 3 + 1
a = []
i = 1
while True:
if s in a:
print(i)
exit()
else:
a.append(s)
s = f(s)
i += 1
| false | 12.5 | [
"- return 3 * x + 1",
"+ return x * 3 + 1",
"-for i in range(1000000):",
"+i = 1",
"+while True:",
"- print((i + 1))",
"- break",
"+ print(i)",
"+ exit()",
"+ i += 1"
] | false | 0.123566 | 0.045892 | 2.692515 | [
"s619432051",
"s175515571"
] |
u227082700 | p03965 | python | s797967519 | s423960274 | 24 | 18 | 3,956 | 3,188 | Accepted | Accepted | 25 | s=[i for i in eval(input())];g,p=s.count("g"),s.count("p");print(((g-p)//2)) | s=eval(input())
print(((s.count("g")-s.count("p"))//2)) | 1 | 2 | 68 | 48 | s = [i for i in eval(input())]
g, p = s.count("g"), s.count("p")
print(((g - p) // 2))
| s = eval(input())
print(((s.count("g") - s.count("p")) // 2))
| false | 50 | [
"-s = [i for i in eval(input())]",
"-g, p = s.count(\"g\"), s.count(\"p\")",
"-print(((g - p) // 2))",
"+s = eval(input())",
"+print(((s.count(\"g\") - s.count(\"p\")) // 2))"
] | false | 0.078067 | 0.045215 | 1.726585 | [
"s797967519",
"s423960274"
] |
u254871849 | p03798 | python | s847025851 | s411534711 | 144 | 133 | 5,956 | 6,372 | Accepted | Accepted | 7.64 | n = int(eval(input()))
s = eval(input())
def loop():
for i in range(1, n-1):
if ans[i] == 'S':
if s[i] == 'x':
if ans[i-1] == 'S':
ans[i+1] = 'W'
else:
ans[i+1] = 'S'
else:
i... | import sys
from itertools import product
n = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()
resp = s
resp = resp.replace('o', '1')
resp = resp.replace('x', '0')
resp = [None] + [int(x) for x in resp]
def restore(pattern):
for i in range(1, n):
if resp[i] ^ pattern[i]:
... | 73 | 46 | 1,746 | 1,168 | n = int(eval(input()))
s = eval(input())
def loop():
for i in range(1, n - 1):
if ans[i] == "S":
if s[i] == "x":
if ans[i - 1] == "S":
ans[i + 1] = "W"
else:
ans[i + 1] = "S"
else:
if ans[i - 1]... | import sys
from itertools import product
n = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()
resp = s
resp = resp.replace("o", "1")
resp = resp.replace("x", "0")
resp = [None] + [int(x) for x in resp]
def restore(pattern):
for i in range(1, n):
if resp[i] ^ pattern[i]:
pa... | false | 36.986301 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"+import sys",
"+from itertools import product",
"+",
"+n = int(sys.stdin.readline().rstrip())",
"+s = sys.stdin.readline().rstrip()",
"+resp = s",
"+resp = resp.replace(\"o\", \"1\")",
"+resp = resp.replace(\"x\", \"0\")",
"+resp = [None] + [int(... | false | 0.047604 | 0.089333 | 0.532882 | [
"s847025851",
"s411534711"
] |
u764956288 | p02698 | python | s118099809 | s321854343 | 1,789 | 1,093 | 283,996 | 283,820 | Accepted | Accepted | 38.9 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N = int(eval(input()))
As = list(map(int, input().split()))
edges = (list(map(int, readline().strip().split())) for _ in range(N-1))
tree = [[] for _ in range(N)]
for u, v in edges:
tree[u-... | import sys
readline = sys.stdin.readline
from bisect import bisect_left
sys.setrecursionlimit(10 ** 7)
def main():
N = int(eval(input()))
As = list(map(int, input().split()))
edges = (list(map(int, readline().strip().split())) for _ in range(N-1))
tree = [[] for _ in range(N)]
f... | 56 | 43 | 1,133 | 877 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N = int(eval(input()))
As = list(map(int, input().split()))
edges = (list(map(int, readline().strip().split())) for _ in range(N - 1))
tree = [[] for _ in range(N)]
for u, v in edges:
tree[u - 1].append(v - ... | import sys
readline = sys.stdin.readline
from bisect import bisect_left
sys.setrecursionlimit(10**7)
def main():
N = int(eval(input()))
As = list(map(int, input().split()))
edges = (list(map(int, readline().strip().split())) for _ in range(N - 1))
tree = [[] for _ in range(N)]
for u, v in edges:... | false | 23.214286 | [
"+from bisect import bisect_left",
"+",
"- inf = 10**18",
"+ inf = 10**12",
"- lb = binary_search(dp, v)",
"+ lb = bisect_left(dp, v)",
"- ans[node] = binary_search(dp, inf)",
"+ ans[node] = bisect_left(dp, inf)",
"-def binary_search(seq, v):",
"- left = 0",
... | false | 0.038214 | 0.038081 | 1.003512 | [
"s118099809",
"s321854343"
] |
u367965715 | p02595 | python | s827391744 | s689022406 | 1,120 | 513 | 9,940 | 9,568 | Accepted | Accepted | 54.2 | from decimal import Decimal
n, d = list(map(int, input().split()))
res = 0
for _ in range(n):
x, y = list(map(Decimal, input().split()))
if (x**2 + y**2).sqrt() <= d:
res += 1
print(res)
| n, d = list(map(int, input().split()))
res = 0
for _ in range(n):
x, y = list(map(int, input().split()))
if (x**2 + y**2)**0.5 <= d:
res += 1
print(res)
| 9 | 7 | 200 | 163 | from decimal import Decimal
n, d = list(map(int, input().split()))
res = 0
for _ in range(n):
x, y = list(map(Decimal, input().split()))
if (x**2 + y**2).sqrt() <= d:
res += 1
print(res)
| n, d = list(map(int, input().split()))
res = 0
for _ in range(n):
x, y = list(map(int, input().split()))
if (x**2 + y**2) ** 0.5 <= d:
res += 1
print(res)
| false | 22.222222 | [
"-from decimal import Decimal",
"-",
"- x, y = list(map(Decimal, input().split()))",
"- if (x**2 + y**2).sqrt() <= d:",
"+ x, y = list(map(int, input().split()))",
"+ if (x**2 + y**2) ** 0.5 <= d:"
] | false | 0.048722 | 0.03739 | 1.303074 | [
"s827391744",
"s689022406"
] |
u512212329 | p02574 | python | s110963323 | s633294455 | 977 | 481 | 136,448 | 133,312 | Accepted | Accepted | 50.77 | from math import gcd
from functools import reduce
def main():
eval(input()) # N
array = [int(x) for x in input().split()]
MAX_A = 10 ** 6 + 1
histogram = [0] * MAX_A
for x in array:
histogram[int(x)] += 1
# エラトステネスの篩
primes = []
not_primes = set()
for a in ... | from math import gcd
from functools import reduce
def facs(n):
"""試し割り法における割る数を生成する。"""
yield 2
for x in range(3, n, 2):
yield x
def main():
eval(input()) # N
array = [int(x) for x in input().split()]
MAX_A = 10 ** 6 + 1
histogram = [0] * MAX_A
for x in array... | 38 | 35 | 837 | 709 | from math import gcd
from functools import reduce
def main():
eval(input()) # N
array = [int(x) for x in input().split()]
MAX_A = 10**6 + 1
histogram = [0] * MAX_A
for x in array:
histogram[int(x)] += 1
# エラトステネスの篩
primes = []
not_primes = set()
for a in range(2, MAX_A):
... | from math import gcd
from functools import reduce
def facs(n):
"""試し割り法における割る数を生成する。"""
yield 2
for x in range(3, n, 2):
yield x
def main():
eval(input()) # N
array = [int(x) for x in input().split()]
MAX_A = 10**6 + 1
histogram = [0] * MAX_A
for x in array:
histogra... | false | 7.894737 | [
"+",
"+",
"+def facs(n):",
"+ \"\"\"試し割り法における割る数を生成する。\"\"\"",
"+ yield 2",
"+ for x in range(3, n, 2):",
"+ yield x",
"- # エラトステネスの篩",
"- primes = []",
"- not_primes = set()",
"- for a in range(2, MAX_A):",
"- if a in not_primes:",
"- continue",... | false | 1.852144 | 0.617765 | 2.998135 | [
"s110963323",
"s633294455"
] |
u677523557 | p02820 | python | s091601816 | s909840228 | 306 | 77 | 60,208 | 18,680 | Accepted | Accepted | 74.84 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = input().rstrip()
dp = [[0, 0, 0] for _ in range(N)]
for i in range(K):
Q = T[i]
if Q == "s":
dp[i][0] = R
elif Q == "p":
dp[i][1] = S
else:
... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = list(input().rstrip())
D = [[] for _ in range(K)]
for i, t in enumerate(T):
D[i%K].append(t)
ans = 0
for List in D:
pre ... | 38 | 34 | 925 | 686 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = input().rstrip()
dp = [[0, 0, 0] for _ in range(N)]
for i in range(K):
Q = T[i]
if Q == "s":
dp[i][0] = R
elif Q == "p":
dp[i][1] = S
else:
dp[i][2] = P
for... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = list(input().rstrip())
D = [[] for _ in range(K)]
for i, t in enumerate(T):
D[i % K].append(t)
ans = 0
for List in D:
pre = -1
for... | false | 10.526316 | [
"-N, K = list(map(int, input().split()))",
"-R, S, P = list(map(int, input().split()))",
"-T = input().rstrip()",
"-dp = [[0, 0, 0] for _ in range(N)]",
"-for i in range(K):",
"- Q = T[i]",
"- if Q == \"s\":",
"- dp[i][0] = R",
"- elif Q == \"p\":",
"- dp[i][1] = S",
"- ... | false | 0.087142 | 0.105926 | 0.822674 | [
"s091601816",
"s909840228"
] |
u379959788 | p03564 | python | s467541134 | s219951400 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | # ABC076-B
N = int(eval(input()))
K = int(eval(input()))
ans_list = []
for a in range(N+1):
tmp = 1
b = N - a
for i in range(a):
tmp *= 2
tmp += b * K
ans_list.append(tmp)
print((min(ans_list))) | # ABC076-B
N = int(eval(input()))
K = int(eval(input()))
ans = 1
for i in range(N):
if ans * 2 < ans + K:
ans *= 2
else:
ans += K
print(ans) | 12 | 10 | 223 | 161 | # ABC076-B
N = int(eval(input()))
K = int(eval(input()))
ans_list = []
for a in range(N + 1):
tmp = 1
b = N - a
for i in range(a):
tmp *= 2
tmp += b * K
ans_list.append(tmp)
print((min(ans_list)))
| # ABC076-B
N = int(eval(input()))
K = int(eval(input()))
ans = 1
for i in range(N):
if ans * 2 < ans + K:
ans *= 2
else:
ans += K
print(ans)
| false | 16.666667 | [
"-ans_list = []",
"-for a in range(N + 1):",
"- tmp = 1",
"- b = N - a",
"- for i in range(a):",
"- tmp *= 2",
"- tmp += b * K",
"- ans_list.append(tmp)",
"-print((min(ans_list)))",
"+ans = 1",
"+for i in range(N):",
"+ if ans * 2 < ans + K:",
"+ ans *= 2",
... | false | 0.052425 | 0.053014 | 0.988887 | [
"s467541134",
"s219951400"
] |
u189513668 | p03031 | python | s058036190 | s138831165 | 42 | 38 | 3,064 | 3,064 | Accepted | Accepted | 9.52 | N, M = list(map(int, input().split()))
S = []
for i in range(M):
s = list(map(int, input().split()))
S.append(s)
P = list(map(int, input().split()))
count = 0
for i in range(2**N):
switch = []
for j in range(N):
if ((i >> j) & 1):
switch.append(j+1)
#print(switc... |
N, M = list(map(int, input().split()))
s = []
for i in range(M):
S = list(map(int, input().split()))
s.append(S[1:])
p = list(map(int, input().split()))
#print(s)
count = 0
for i in range(2**N):
b = bin(i)[2:][::-1]
switch = []
for j in range(len(b)):
if b[j] == "1":
... | 29 | 37 | 583 | 637 | N, M = list(map(int, input().split()))
S = []
for i in range(M):
s = list(map(int, input().split()))
S.append(s)
P = list(map(int, input().split()))
count = 0
for i in range(2**N):
switch = []
for j in range(N):
if (i >> j) & 1:
switch.append(j + 1)
# print(switch)
c = 0
... | N, M = list(map(int, input().split()))
s = []
for i in range(M):
S = list(map(int, input().split()))
s.append(S[1:])
p = list(map(int, input().split()))
# print(s)
count = 0
for i in range(2**N):
b = bin(i)[2:][::-1]
switch = []
for j in range(len(b)):
if b[j] == "1":
switch.appe... | false | 21.621622 | [
"-S = []",
"+s = []",
"- s = list(map(int, input().split()))",
"- S.append(s)",
"-P = list(map(int, input().split()))",
"+ S = list(map(int, input().split()))",
"+ s.append(S[1:])",
"+p = list(map(int, input().split()))",
"+# print(s)",
"+ b = bin(i)[2:][::-1]",
"- for j in ran... | false | 0.038944 | 0.039034 | 0.997696 | [
"s058036190",
"s138831165"
] |
u709304134 | p02660 | python | s553270390 | s145027112 | 875 | 126 | 16,796 | 9,312 | Accepted | Accepted | 85.6 |
K = int(eval(input()))
N = 10**6
dp = [1] * (N+1)
dp[0] = dp[1] = 0
def pw(j,i):
while(j%i==0):
j //= i
if j == 1:
return True
else:
return False
for i in range(2,N+1):
if dp[i]:
for j in range(i*i, N+1, i):
#if not pw(j,i):
... | N = int(eval(input()))
def factorize(N):
n = N
r = []
for i in range(2,int(N**0.5)+1): # intに変換すること
cnt = 0
while(n%i==0):
cnt += 1
n //= i # 整数除算(//)を使うこと
if cnt!=0:
r.append((i,cnt))
if n!=1:
r.append((n,1))
return r... | 44 | 23 | 672 | 447 | K = int(eval(input()))
N = 10**6
dp = [1] * (N + 1)
dp[0] = dp[1] = 0
def pw(j, i):
while j % i == 0:
j //= i
if j == 1:
return True
else:
return False
for i in range(2, N + 1):
if dp[i]:
for j in range(i * i, N + 1, i):
# if not pw(j,i):
dp[j]... | N = int(eval(input()))
def factorize(N):
n = N
r = []
for i in range(2, int(N**0.5) + 1): # intに変換すること
cnt = 0
while n % i == 0:
cnt += 1
n //= i # 整数除算(//)を使うこと
if cnt != 0:
r.append((i, cnt))
if n != 1:
r.append((n, 1))
retur... | false | 47.727273 | [
"-K = int(eval(input()))",
"-N = 10**6",
"-dp = [1] * (N + 1)",
"-dp[0] = dp[1] = 0",
"+N = int(eval(input()))",
"-def pw(j, i):",
"- while j % i == 0:",
"- j //= i",
"- if j == 1:",
"- return True",
"- else:",
"- return False",
"+def factorize(N):",
"+ n =... | false | 1.260597 | 0.05528 | 22.803686 | [
"s553270390",
"s145027112"
] |
u086566114 | p02412 | python | s928295792 | s898141968 | 110 | 100 | 6,420 | 6,332 | Accepted | Accepted | 9.09 | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(n3 - 1, (x - n3 + 1) / 2 - 1, -1):
for n1 in range(n2 - 1, 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return ans
while True:
... | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(n3 - 1, (x - n3 + 1) / 2 - 1, -1):
for n1 in range(n2 - 1, 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return ans
data = []
while... | 19 | 25 | 482 | 589 | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(n3 - 1, (x - n3 + 1) / 2 - 1, -1):
for n1 in range(n2 - 1, 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return ans
while True:
[n, x] = [i... | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(n3 - 1, (x - n3 + 1) / 2 - 1, -1):
for n1 in range(n2 - 1, 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return ans
data = []
while True:
[... | false | 24 | [
"+data = []",
"- print((0))",
"+ data.append(0)",
"+ # print(0)",
"- print((get_num(n, x)))",
"+ data.append(get_num(n, x))",
"+ # print(get_num(n, x))",
"+for n in data:",
"+ print(n)"
] | false | 0.03601 | 0.046697 | 0.771131 | [
"s928295792",
"s898141968"
] |
u401686269 | p02947 | python | s503465175 | s473178501 | 844 | 252 | 30,064 | 22,448 | Accepted | Accepted | 70.14 | from collections import Counter,defaultdict
N=int(eval(input()))
count = defaultdict(int)
for i in range(N):
s=Counter(list(eval(input())))
count[str(sorted(s.items()))] += 1
count = list(count.values())
SUM = 0
for c in count:
if c>1:SUM += c*(c-1)//2
print(SUM) | from collections import defaultdict
N=int(eval(input()))
count = defaultdict(int)
for i in range(N):
s = eval(input())
s = ''.join(sorted(s))
count[s] += 1
SUM = 0
for val in list(count.values()):
if val > 1:SUM+=val*(val-1)//2
print(SUM) | 13 | 13 | 271 | 242 | from collections import Counter, defaultdict
N = int(eval(input()))
count = defaultdict(int)
for i in range(N):
s = Counter(list(eval(input())))
count[str(sorted(s.items()))] += 1
count = list(count.values())
SUM = 0
for c in count:
if c > 1:
SUM += c * (c - 1) // 2
print(SUM)
| from collections import defaultdict
N = int(eval(input()))
count = defaultdict(int)
for i in range(N):
s = eval(input())
s = "".join(sorted(s))
count[s] += 1
SUM = 0
for val in list(count.values()):
if val > 1:
SUM += val * (val - 1) // 2
print(SUM)
| false | 0 | [
"-from collections import Counter, defaultdict",
"+from collections import defaultdict",
"- s = Counter(list(eval(input())))",
"- count[str(sorted(s.items()))] += 1",
"-count = list(count.values())",
"+ s = eval(input())",
"+ s = \"\".join(sorted(s))",
"+ count[s] += 1",
"-for c in co... | false | 0.067437 | 0.037207 | 1.812476 | [
"s503465175",
"s473178501"
] |
u281610856 | p02780 | python | s003869374 | s087442079 | 272 | 174 | 25,052 | 25,060 | Accepted | Accepted | 36.03 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
kitaiti = [0 for _ in range(n)]
ruisekiwa = [0 for _ in range(n)]
r = k - 1
max = 0
now = 0
ans_list = []
for i in range(n):
kitaiti[i] = (p[i]+1) / 2
if i == 0:
ruisekiwa[0] = kitaiti[0]
else:
ruisek... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
now = sum(p[:k])
ans = (now + k) / 2
for i in range(k, n):
now += p[i] - p[i - k]
ans = max(ans, (now + k) / 2)
print(ans) | 23 | 8 | 508 | 206 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
kitaiti = [0 for _ in range(n)]
ruisekiwa = [0 for _ in range(n)]
r = k - 1
max = 0
now = 0
ans_list = []
for i in range(n):
kitaiti[i] = (p[i] + 1) / 2
if i == 0:
ruisekiwa[0] = kitaiti[0]
else:
ruisekiwa[i] = ruisek... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
now = sum(p[:k])
ans = (now + k) / 2
for i in range(k, n):
now += p[i] - p[i - k]
ans = max(ans, (now + k) / 2)
print(ans)
| false | 65.217391 | [
"-kitaiti = [0 for _ in range(n)]",
"-ruisekiwa = [0 for _ in range(n)]",
"-r = k - 1",
"-max = 0",
"-now = 0",
"-ans_list = []",
"-for i in range(n):",
"- kitaiti[i] = (p[i] + 1) / 2",
"- if i == 0:",
"- ruisekiwa[0] = kitaiti[0]",
"- else:",
"- ruisekiwa[i] = ruisekiwa... | false | 0.057822 | 0.05572 | 1.037741 | [
"s003869374",
"s087442079"
] |
u439396449 | p03283 | python | s289883553 | s859333060 | 1,716 | 804 | 14,816 | 13,608 | Accepted | Accepted | 53.15 | N, M, Q = list(map(int, input().split()))
class CumSum2d(object):
def __init__(self, H, W):
self.H, self.W = H, W
self.tiles = [[0] * W for _ in range(H)]
def add(self, x, y, c=1):
self.tiles[y][x] += c
def build(self):
for y in range(self.H):
for... | import sys
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
class CumSum2d(object):
def __init__(self, H, W):
self.H, self.W = H, W
self.tiles = [[0] * W for _ in range(H)]
def add(self, x, y, c=1):
self.tiles[y][x] += c
def build(self):
... | 41 | 44 | 1,104 | 1,146 | N, M, Q = list(map(int, input().split()))
class CumSum2d(object):
def __init__(self, H, W):
self.H, self.W = H, W
self.tiles = [[0] * W for _ in range(H)]
def add(self, x, y, c=1):
self.tiles[y][x] += c
def build(self):
for y in range(self.H):
for x in range(1... | import sys
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
class CumSum2d(object):
def __init__(self, H, W):
self.H, self.W = H, W
self.tiles = [[0] * W for _ in range(H)]
def add(self, x, y, c=1):
self.tiles[y][x] += c
def build(self):
for y in rang... | false | 6.818182 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.077166 | 0.042836 | 1.801437 | [
"s289883553",
"s859333060"
] |
u123756661 | p02866 | python | s180302679 | s596638690 | 258 | 234 | 53,556 | 53,676 | Accepted | Accepted | 9.3 | mod = 998244353
n=int(eval(input()))
d=[int(i) for i in input().split()]
ans=[0]*n
for i in d:
ans[i]+=1
f=mod
for i in ans:
if f==0 and i>0:
print((0))
exit()
f=min(f,i)
if d.count(0)!=1 or d[0]!=0:
print((0))
exit()
cnt=1
for i in range(1,n):
if ans[i-1]==0:
... | mod = 998244353
n=int(eval(input()))
d=[int(i) for i in input().split()]
ans=[0]*n
for i in d:
ans[i]+=1
f=mod
for i in ans:
if f==0 and i>0:
print((0))
exit()
f=min(f,i)
if d.count(0)!=1 or d[0]!=0:
print((0))
exit()
cnt=1
if ans[2]==0:
print((1))
exit()
f... | 22 | 25 | 382 | 422 | mod = 998244353
n = int(eval(input()))
d = [int(i) for i in input().split()]
ans = [0] * n
for i in d:
ans[i] += 1
f = mod
for i in ans:
if f == 0 and i > 0:
print((0))
exit()
f = min(f, i)
if d.count(0) != 1 or d[0] != 0:
print((0))
exit()
cnt = 1
for i in range(1, n):
if ans[i ... | mod = 998244353
n = int(eval(input()))
d = [int(i) for i in input().split()]
ans = [0] * n
for i in d:
ans[i] += 1
f = mod
for i in ans:
if f == 0 and i > 0:
print((0))
exit()
f = min(f, i)
if d.count(0) != 1 or d[0] != 0:
print((0))
exit()
cnt = 1
if ans[2] == 0:
print((1))
... | false | 12 | [
"+if ans[2] == 0:",
"+ print((1))",
"+ exit()",
"- if ans[i - 1] == 0:",
"+ if ans[i] == 0:"
] | false | 0.034249 | 0.037682 | 0.908899 | [
"s180302679",
"s596638690"
] |
u314050667 | p02804 | python | s429242990 | s361380740 | 1,953 | 996 | 31,652 | 23,156 | Accepted | Accepted | 49 | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
mod = 10**9+7
A.sort()
fact = np.zeros(N+1, np.int64)
inv = np.zeros(N+1, np.int64)
fact[0], fact[1] = 1, ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())), dtype = np.int64)
MOD = 10**9+7
def cumprod(x, MOD = MOD):
L = len(x)
Lsq = int(L**.5 + 1)
x = np.resiz... | 57 | 51 | 1,013 | 1,197 | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
mod = 10**9 + 7
A.sort()
fact = np.zeros(N + 1, np.int64)
inv = np.zeros(N + 1, np.int64)
fact[0], fact[1] = 1, 1
inv[0]... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())), dtype=np.int64)
MOD = 10**9 + 7
def cumprod(x, MOD=MOD):
L = len(x)
Lsq = int(L**0.5 + 1)
x = np.resize(x... | false | 10.526316 | [
"-import numpy as np",
"+import numpy as np",
"+",
"-A = np.array(list(map(int, input().split())))",
"-mod = 10**9 + 7",
"+A = np.array(list(map(int, input().split())), dtype=np.int64)",
"+MOD = 10**9 + 7",
"+",
"+",
"+def cumprod(x, MOD=MOD):",
"+ L = len(x)",
"+ Lsq = int(L**0.5 + 1)",... | false | 0.39939 | 0.46294 | 0.862726 | [
"s429242990",
"s361380740"
] |
u882620594 | p03633 | python | s622481233 | s352954827 | 20 | 18 | 3,060 | 3,064 | Accepted | Accepted | 10 | def gcd(a, b):
if b == 1:
return 1
# a > b を仮定
r = a % b
if r == 0:
return b
else:
return gcd(b, r)
#def lcm(A, n):
# if n == 2:
# return A[0]*A[1] // gcd(A[0], A[1])
# #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
# a = lcm(A, n-1)
# return a* A[n-1] ... | import sys
sys.setrecursionlimit(10000)
def gcd(a, b):
if b == 1:
return 1
r = a % b
if r == 0:
return b
else:
return gcd(b, r)
def lcm(A, n):
if n == 2:
return A[0]* (A[1] // gcd(A[0], A[1]))
#lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
rec = lcm(A, n... | 27 | 28 | 549 | 519 | def gcd(a, b):
if b == 1:
return 1
# a > b を仮定
r = a % b
if r == 0:
return b
else:
return gcd(b, r)
# def lcm(A, n):
# if n == 2:
# return A[0]*A[1] // gcd(A[0], A[1])
# #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
# a = lcm(A, n-1)
# return a* A[n-1] // gcd(a, A[n... | import sys
sys.setrecursionlimit(10000)
def gcd(a, b):
if b == 1:
return 1
r = a % b
if r == 0:
return b
else:
return gcd(b, r)
def lcm(A, n):
if n == 2:
return A[0] * (A[1] // gcd(A[0], A[1]))
# lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
rec = lcm(A, n - 1)
r... | false | 3.571429 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10000)",
"+",
"+",
"- # a > b を仮定",
"-# def lcm(A, n):",
"-# if n == 2:",
"-# return A[0]*A[1] // gcd(A[0], A[1])",
"-# #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める",
"-# a = lcm(A, n-1)",
"-# return a* A[n-1] // gcd(a, A[n-1])",
"+def ... | false | 0.170458 | 0.068451 | 2.490215 | [
"s622481233",
"s352954827"
] |
u392319141 | p02788 | python | s671999647 | s675561587 | 1,525 | 738 | 89,384 | 44,608 | Accepted | Accepted | 51.61 | from bisect import bisect_right
import sys
input = sys.stdin.readline
class SegmentTree:
"""
0-indexed
query : [L, R)
"""
def __init__(self, size, initValue, cmpFunc):
self.size = 1 << (size.bit_length()) # 完全二分木にする
self.data = [initValue] * (2 * self.size - 1)
... | from collections import deque
import sys
input = sys.stdin.readline
N, D, A = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
ans = 0
cnt = 0
que = deque()
for x, h in XH:
while que and que[0][0] <= x:
cnt -= que.popleft()[1]
h -= c... | 64 | 27 | 1,813 | 469 | from bisect import bisect_right
import sys
input = sys.stdin.readline
class SegmentTree:
"""
0-indexed
query : [L, R)
"""
def __init__(self, size, initValue, cmpFunc):
self.size = 1 << (size.bit_length()) # 完全二分木にする
self.data = [initValue] * (2 * self.size - 1)
self.init... | from collections import deque
import sys
input = sys.stdin.readline
N, D, A = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
ans = 0
cnt = 0
que = deque()
for x, h in XH:
while que and que[0][0] <= x:
cnt -= que.popleft()[1]
h -= cnt * A
if h <= ... | false | 57.8125 | [
"-from bisect import bisect_right",
"+from collections import deque",
"-",
"-",
"-class SegmentTree:",
"- \"\"\"",
"- 0-indexed",
"- query : [L, R)",
"- \"\"\"",
"-",
"- def __init__(self, size, initValue, cmpFunc):",
"- self.size = 1 << (size.bit_length()) # 完全二分木にする",
... | false | 0.039176 | 0.038548 | 1.016281 | [
"s671999647",
"s675561587"
] |
u185802209 | p03215 | python | s456096612 | s569694293 | 705 | 565 | 67,136 | 27,544 | Accepted | Accepted | 19.86 | import itertools
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [a[0]]
for i in range(n-1):
b.append(b[i]+a[i+1])
c = list(itertools.combinations(list(range(n)),2))
s = a
for i in c:
s.append(b[i[1]]-b[i[0]]+a[i[0]])
s.sort(reverse=True)
l = len(bin(s[0]))-2
d = 1<<l-1
... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [a[0]]
for i in range(n-1):
b.append(b[i]+a[i+1])
s = b
for i in range(n-1):
for j in range(i,n-1):
s.append(b[j+1]-b[i])
s.sort(reverse=True)
l = len(bin(s[0]))-2
d = 1<<l-1
t = 0
while d>0:
s1 = []
if s[... | 32 | 31 | 680 | 645 | import itertools
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [a[0]]
for i in range(n - 1):
b.append(b[i] + a[i + 1])
c = list(itertools.combinations(list(range(n)), 2))
s = a
for i in c:
s.append(b[i[1]] - b[i[0]] + a[i[0]])
s.sort(reverse=True)
l = len(bin(s[0])) - 2
d = 1 <... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [a[0]]
for i in range(n - 1):
b.append(b[i] + a[i + 1])
s = b
for i in range(n - 1):
for j in range(i, n - 1):
s.append(b[j + 1] - b[i])
s.sort(reverse=True)
l = len(bin(s[0])) - 2
d = 1 << l - 1
t = 0
while d > 0:
s1 = [... | false | 3.125 | [
"-import itertools",
"-",
"-c = list(itertools.combinations(list(range(n)), 2))",
"-s = a",
"-for i in c:",
"- s.append(b[i[1]] - b[i[0]] + a[i[0]])",
"+s = b",
"+for i in range(n - 1):",
"+ for j in range(i, n - 1):",
"+ s.append(b[j + 1] - b[i])"
] | false | 0.049078 | 0.049686 | 0.987767 | [
"s456096612",
"s569694293"
] |
u556589653 | p02645 | python | s157794055 | s838740012 | 30 | 27 | 9,060 | 9,060 | Accepted | Accepted | 10 | print((input()[:3])) | print((input()[0:3])) | 1 | 1 | 18 | 19 | print((input()[:3]))
| print((input()[0:3]))
| false | 0 | [
"-print((input()[:3]))",
"+print((input()[0:3]))"
] | false | 0.04115 | 0.040573 | 1.014231 | [
"s157794055",
"s838740012"
] |
u677121387 | p02787 | python | s149419943 | s403493244 | 458 | 175 | 46,684 | 68,056 | Accepted | Accepted | 61.79 | h,n = list(map(int,input().split()))
aa = [0]*n
bb = [0]*n
for i in range(n):
a,b = list(map(int,input().split()))
aa[i] = a
bb[i] = b
m = max(aa)
dp = [float("inf") for _ in range(h+m)]
dp[0] = 0
for i in range(1,h+m):
for j in range(n):
if i-aa[j] >= 0:
dp[i] = min(d... | h,n = list(map(int,input().split()))
a = [0]*n
b = [0]*n
for i in range(n): a[i],b[i] = list(map(int,input().split()))
dp = [10**9]*(h+1)
dp[0] = 0
for i in range(h):
for j in range(n):
dp[min(i+a[j],h)] = min(dp[min(i+a[j],h)],dp[i]+b[j])
print((dp[h])) | 17 | 10 | 354 | 261 | h, n = list(map(int, input().split()))
aa = [0] * n
bb = [0] * n
for i in range(n):
a, b = list(map(int, input().split()))
aa[i] = a
bb[i] = b
m = max(aa)
dp = [float("inf") for _ in range(h + m)]
dp[0] = 0
for i in range(1, h + m):
for j in range(n):
if i - aa[j] >= 0:
dp[i] = min(d... | h, n = list(map(int, input().split()))
a = [0] * n
b = [0] * n
for i in range(n):
a[i], b[i] = list(map(int, input().split()))
dp = [10**9] * (h + 1)
dp[0] = 0
for i in range(h):
for j in range(n):
dp[min(i + a[j], h)] = min(dp[min(i + a[j], h)], dp[i] + b[j])
print((dp[h]))
| false | 41.176471 | [
"-aa = [0] * n",
"-bb = [0] * n",
"+a = [0] * n",
"+b = [0] * n",
"- a, b = list(map(int, input().split()))",
"- aa[i] = a",
"- bb[i] = b",
"-m = max(aa)",
"-dp = [float(\"inf\") for _ in range(h + m)]",
"+ a[i], b[i] = list(map(int, input().split()))",
"+dp = [10**9] * (h + 1)",
"... | false | 0.090012 | 0.113503 | 0.793029 | [
"s149419943",
"s403493244"
] |
u535803878 | p02709 | python | s536281304 | s732641801 | 223 | 167 | 123,424 | 105,952 | Accepted | Accepted | 25.11 | import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(eval(input()))
a = list(map(int, input().split()))
a = [(item, i) for i,item in enumerate(a)]
s = sorted(a)[::-1] # (value, index)
dp = [[None] * (n+1) for _ in range(n+1)] # 高い方からx+y人について、a_i * (p_i - i) + a_i * (i - p_i) の和の最大値
dp[0][0] = 0
... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
a = list(map(int, input().split()))
a = [(num,i) for i,num in enumerate(a)]
a.sort(reverse=True)
dp = [[0]*(n+1) for _ in range(n+1)]
for i in ... | 27 | 19 | 802 | 616 | import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
a = list(map(int, input().split()))
a = [(item, i) for i, item in enumerate(a)]
s = sorted(a)[::-1] # (value, index)
dp = [
[None] * (n + 1) for _ in range(n + 1)
] # 高い方からx+y人について、a_i * (p_i - i) + a_i * (i - p_i) の和の最大値
dp[0][0] = ... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
a = list(map(int, input().split()))
a = [(num, i) for i, num in enumerate(a)]
a.sort(reverse=True)
dp = [[0] * (n + 1) for _ in range(n + 1)]
for i in ran... | false | 29.62963 | [
"+sys.setrecursionlimit(max(1000, 10**9))",
"+write = lambda x: sys.stdout.write(x + \"\\n\")",
"-a = [(item, i) for i, item in enumerate(a)]",
"-s = sorted(a)[::-1] # (value, index)",
"-dp = [",
"- [None] * (n + 1) for _ in range(n + 1)",
"-] # 高い方からx+y人について、a_i * (p_i - i) + a_i * (i - p_i) の和の最大... | false | 0.048334 | 0.043082 | 1.121916 | [
"s536281304",
"s732641801"
] |
u279493135 | p03283 | python | s103806013 | s137492996 | 1,074 | 815 | 121,944 | 77,948 | Accepted | Accepted | 24.12 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | 48 | 31 | 1,130 | 1,081 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | false | 35.416667 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"-from itertools import permutations, combinations, product, accumulate",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd",
"+from itertools import (",
"+ accumulate,",
"+ permutations,",
"+ com... | false | 0.038038 | 0.296957 | 0.128093 | [
"s103806013",
"s137492996"
] |
u077291787 | p03014 | python | s850433224 | s561969319 | 1,570 | 598 | 177,240 | 176,728 | Accepted | Accepted | 61.91 | # ABC129D - Lamp
def main():
H, W, *S = open(0).read().split()
H, W = int(H), int(W)
L, R = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
U, D = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
for x1 in range(H):
for y1 in range(W):
if S[x1][y1] == "."... | # ABC129D - Lamp
def main():
H, W, *S = open(0).read().split()
H, W = int(H), int(W)
L, R = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
U, D = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
for x1 in range(H):
for y1 in range(W):
if S[x1][y1] == "."... | 21 | 24 | 797 | 839 | # ABC129D - Lamp
def main():
H, W, *S = open(0).read().split()
H, W = int(H), int(W)
L, R = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
U, D = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
for x1 in range(H):
for y1 in range(W):
if S[x1][y1] == ".": # lef... | # ABC129D - Lamp
def main():
H, W, *S = open(0).read().split()
H, W = int(H), int(W)
L, R = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
U, D = [[0] * W for _ in range(H)], [[0] * W for _ in range(H)]
for x1 in range(H):
for y1 in range(W):
if S[x1][y1] == ".": # lef... | false | 12.5 | [
"- ans = max(",
"- L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3 for i in range(H) for j in range(W)",
"- )",
"+ ans = -1",
"+ for i in range(H):",
"+ for j in range(W):",
"+ ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)"
] | false | 0.07446 | 0.118696 | 0.627317 | [
"s850433224",
"s561969319"
] |
u729133443 | p03251 | python | s614249011 | s955042395 | 162 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.51 | x,y=input().split()[2:];print(('No '*(max(list(map(int,input().split()+[x])))<min(list(map(int,input().split()+[y]))))+'War')) | i=lambda:list(map(int,input().split()));n,m,x,y=i();print(('No '*(max(list(i())+[x])<min(list(i())+[y]))+'War')) | 1 | 1 | 112 | 104 | x, y = input().split()[2:]
print(
(
"No "
* (
max(list(map(int, input().split() + [x])))
< min(list(map(int, input().split() + [y])))
)
+ "War"
)
)
| i = lambda: list(map(int, input().split()))
n, m, x, y = i()
print(("No " * (max(list(i()) + [x]) < min(list(i()) + [y])) + "War"))
| false | 0 | [
"-x, y = input().split()[2:]",
"-print(",
"- (",
"- \"No \"",
"- * (",
"- max(list(map(int, input().split() + [x])))",
"- < min(list(map(int, input().split() + [y])))",
"- )",
"- + \"War\"",
"- )",
"-)",
"+i = lambda: list(map(int, input(... | false | 0.035107 | 0.034249 | 1.025061 | [
"s614249011",
"s955042395"
] |
u700805562 | p02537 | python | s458864888 | s439542209 | 745 | 675 | 124,044 | 129,972 | Accepted | Accepted | 9.4 | import typing
def _ceil_pow2(n: int) -> int:
x = 0
while (1 << x) < n:
x += 1
return x
class SegTree:
def __init__(self,
op: typing.Callable[[typing.Any, typing.Any], typing.Any],
e: typing.Any,
v: typing.Union[int, typing.List[typin... | import typing
class SegTree:
def _ceil_pow2(self, n: int) -> int:
x = 0
while (1 << x) < n:
x += 1
return x
def __init__(self,
op: typing.Callable[[typing.Any, typing.Any], typing.Any],
e: typing.Any,
v: typin... | 128 | 69 | 3,760 | 1,955 | import typing
def _ceil_pow2(n: int) -> int:
x = 0
while (1 << x) < n:
x += 1
return x
class SegTree:
def __init__(
self,
op: typing.Callable[[typing.Any, typing.Any], typing.Any],
e: typing.Any,
v: typing.Union[int, typing.List[typing.Any]],
):
se... | import typing
class SegTree:
def _ceil_pow2(self, n: int) -> int:
x = 0
while (1 << x) < n:
x += 1
return x
def __init__(
self,
op: typing.Callable[[typing.Any, typing.Any], typing.Any],
e: typing.Any,
v: typing.Union[int, typing.List[typing... | false | 46.09375 | [
"-def _ceil_pow2(n: int) -> int:",
"- x = 0",
"- while (1 << x) < n:",
"- x += 1",
"- return x",
"+class SegTree:",
"+ def _ceil_pow2(self, n: int) -> int:",
"+ x = 0",
"+ while (1 << x) < n:",
"+ x += 1",
"+ return x",
"-",
"-class SegTree:... | false | 0.044716 | 0.045333 | 0.986391 | [
"s458864888",
"s439542209"
] |
u915737443 | p02582 | python | s780863829 | s460480182 | 36 | 30 | 8,972 | 9,024 | Accepted | Accepted | 16.67 | S = list(eval(input()))
count = 0
max_count = 0
for i in range(len(S)):
a = S[i]
if a == 'R':
count += 1
else:
max_count = max(max_count, count)
count = 0
max_count = max(max_count, count)
print(max_count) | S = eval(input())
if S == "RRR":
print((3))
elif S == "RRS" or S == "SRR":
print((2))
elif "R" in S:
print((1))
else:
print((0)) | 12 | 9 | 243 | 138 | S = list(eval(input()))
count = 0
max_count = 0
for i in range(len(S)):
a = S[i]
if a == "R":
count += 1
else:
max_count = max(max_count, count)
count = 0
max_count = max(max_count, count)
print(max_count)
| S = eval(input())
if S == "RRR":
print((3))
elif S == "RRS" or S == "SRR":
print((2))
elif "R" in S:
print((1))
else:
print((0))
| false | 25 | [
"-S = list(eval(input()))",
"-count = 0",
"-max_count = 0",
"-for i in range(len(S)):",
"- a = S[i]",
"- if a == \"R\":",
"- count += 1",
"- else:",
"- max_count = max(max_count, count)",
"- count = 0",
"-max_count = max(max_count, count)",
"-print(max_count)",
... | false | 0.04502 | 0.044496 | 1.011781 | [
"s780863829",
"s460480182"
] |
u977389981 | p03599 | python | s205230443 | s267773887 | 65 | 59 | 3,188 | 3,188 | Accepted | Accepted | 9.23 | A, B, C, D, E, F = list(map(int, input().split()))
W = set()
for a in range(0, F+1, 100*A):
for b in range(0, F+1-a, 100*B):
W.add(a+b)
S = set()
for c in range(0, F+1, C):
for d in range(0, F+1-c, D):
S.add(c+d)
rate = -1
for w in W:
for s in S:
if 0 < w+s <= F and... | A, B, C, D, E, F = list(map(int, input().split()))
W = set()
for a in range(0, F + 1, 100 * A):
for b in range(0, F + 1 - a, 100 * B):
W.add(a + b)
S = set()
for c in range(0, F + 1, C):
for d in range(0, F + 1 - c, D):
S.add(c + d)
rate = -1
for w in W:
for ... | 21 | 21 | 465 | 527 | A, B, C, D, E, F = list(map(int, input().split()))
W = set()
for a in range(0, F + 1, 100 * A):
for b in range(0, F + 1 - a, 100 * B):
W.add(a + b)
S = set()
for c in range(0, F + 1, C):
for d in range(0, F + 1 - c, D):
S.add(c + d)
rate = -1
for w in W:
for s in S:
if 0 < w + s <= F... | A, B, C, D, E, F = list(map(int, input().split()))
W = set()
for a in range(0, F + 1, 100 * A):
for b in range(0, F + 1 - a, 100 * B):
W.add(a + b)
S = set()
for c in range(0, F + 1, C):
for d in range(0, F + 1 - c, D):
S.add(c + d)
rate = -1
for w in W:
for s in S:
if 0 < w + s <= F... | false | 0 | [
"- if 0 < w + s <= F and s <= (E / 100) * w:",
"+ if 0 < w + s <= F and s / (w + s) <= E / (E + 100):"
] | false | 0.07954 | 0.236622 | 0.336148 | [
"s205230443",
"s267773887"
] |
u811967730 | p02971 | python | s299937837 | s995282187 | 577 | 392 | 14,140 | 14,204 | Accepted | Accepted | 32.06 | n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for i in range(n):
max_val = sorted_nums[n - 1]
if nums[i] == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for i in range(n):
max_val = sorted_nums[n - 1]
if nums[i] == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| 12 | 15 | 256 | 298 | n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for i in range(n):
max_val = sorted_nums[n - 1]
if nums[i] == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for i in range(n):
max_val = sorted_nums[n - 1]
if nums[i] == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| false | 20 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.035939 | 0.035635 | 1.00853 | [
"s299937837",
"s995282187"
] |
u144913062 | p03053 | python | s939548966 | s385814376 | 644 | 475 | 132,188 | 85,980 | Accepted | Accepted | 26.24 | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().rstrip() for _ in range(H)]
dp = [[float('inf') if A[i][j] == '.' else 0 for j in range(W)] for i in range(H)]
for i in range(H):
for j in range(W):
if i > 0:
dp[i][j] = min(dp[i][j], dp[i-1][j] +... | from collections import deque
import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().rstrip() for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
queue = deque()
for i in range(H):
for j in range(W):
if A[i][j] == '#':
dist[i][j] = 0
... | 31 | 21 | 1,029 | 642 | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().rstrip() for _ in range(H)]
dp = [[float("inf") if A[i][j] == "." else 0 for j in range(W)] for i in range(H)]
for i in range(H):
for j in range(W):
if i > 0:
dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1)
... | from collections import deque
import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().rstrip() for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
queue = deque()
for i in range(H):
for j in range(W):
if A[i][j] == "#":
dist[i][j] = 0
queue.appen... | false | 32.258065 | [
"+from collections import deque",
"-dp = [[float(\"inf\") if A[i][j] == \".\" else 0 for j in range(W)] for i in range(H)]",
"+dist = [[-1] * W for _ in range(H)]",
"+queue = deque()",
"- if i > 0:",
"- dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1)",
"- if j > 0:",
"- ... | false | 0.174839 | 0.038635 | 4.525395 | [
"s939548966",
"s385814376"
] |
u590825760 | p02768 | python | s173160010 | s950948077 | 1,568 | 866 | 3,064 | 3,064 | Accepted | Accepted | 44.77 | n,a,b = [int(x) for x in input().split()]
ans = 0
mod = 10**9+7
ans = (pow(2,n,mod)-1)%mod
com1 = 1
for i in range(n-a+1,n+1):
com1 = com1*i%mod
for i in range(1,a+1):
com1 = com1 * pow(i,mod-2,mod)%mod
com2 = 1
for i in range(n-b+1,n+1):
com2 = com2*i%mod
for i in range(1,b+1):
com2 = ... | n,a,b = [int(x) for x in input().split()]
ans = 0
mod = 10**9+7
ans = (pow(2,n,mod)-1)%mod
com1 = 1
for i in range(n-a+1,n+1):
com1 = com1*i%mod
for i in range(1,a+1):
com1 = com1 * pow(i,mod-2,mod)%mod
com2 = 1
for i in range(n-b+1,n+1):
com2 = com2*i%mod
x = 1
for i in range(1,b+1):
... | 18 | 21 | 388 | 410 | n, a, b = [int(x) for x in input().split()]
ans = 0
mod = 10**9 + 7
ans = (pow(2, n, mod) - 1) % mod
com1 = 1
for i in range(n - a + 1, n + 1):
com1 = com1 * i % mod
for i in range(1, a + 1):
com1 = com1 * pow(i, mod - 2, mod) % mod
com2 = 1
for i in range(n - b + 1, n + 1):
com2 = com2 * i % mod
for i in r... | n, a, b = [int(x) for x in input().split()]
ans = 0
mod = 10**9 + 7
ans = (pow(2, n, mod) - 1) % mod
com1 = 1
for i in range(n - a + 1, n + 1):
com1 = com1 * i % mod
for i in range(1, a + 1):
com1 = com1 * pow(i, mod - 2, mod) % mod
com2 = 1
for i in range(n - b + 1, n + 1):
com2 = com2 * i % mod
x = 1
for ... | false | 14.285714 | [
"+x = 1",
"- com2 = com2 * pow(i, mod - 2, mod) % mod",
"+ x = x * i % mod",
"+com2 = com2 * pow(x, mod - 2, mod) % mod"
] | false | 0.942782 | 0.31896 | 2.955796 | [
"s173160010",
"s950948077"
] |
u365686736 | p02388 | python | s843571064 | s192414930 | 20 | 10 | 7,652 | 6,324 | Accepted | Accepted | 50 | print((int(eval(input()))**3)) | print(int(eval(input()))**3) | 1 | 1 | 23 | 21 | print((int(eval(input())) ** 3))
| print(int(eval(input())) ** 3)
| false | 0 | [
"-print((int(eval(input())) ** 3))",
"+print(int(eval(input())) ** 3)"
] | false | 0.047095 | 0.045571 | 1.033432 | [
"s843571064",
"s192414930"
] |
u368780724 | p03112 | python | s486408842 | s870095865 | 1,581 | 875 | 130,880 | 109,408 | Accepted | Accepted | 44.66 | from bisect import bisect_left
A, B, Q = list(map(int, input().split()))
S = [-10**11] + [int(eval(input())) for _ in range(A)] + [10**11]
T = [-10**11] + [int(eval(input())) for _ in range(B)] + [10**11]
X = [int(eval(input())) for _ in range(Q)]
S1 = [0]*A
T1 = [0]*B
for i, s in enumerate(S[1:-1]):
x = ... | import sys
from bisect import bisect as br
A, B, Q = list(map(int, input().split()))
inf = 10**11
S = [-inf] + [int(sys.stdin.readline()) for _ in range(A)] + [inf]
T = [-inf] + [int(sys.stdin.readline()) for _ in range(B)] + [inf]
X = [int(sys.stdin.readline()) for _ in range(Q)]
StoT = [0]*A
for i, s in enu... | 21 | 24 | 712 | 704 | from bisect import bisect_left
A, B, Q = list(map(int, input().split()))
S = [-(10**11)] + [int(eval(input())) for _ in range(A)] + [10**11]
T = [-(10**11)] + [int(eval(input())) for _ in range(B)] + [10**11]
X = [int(eval(input())) for _ in range(Q)]
S1 = [0] * A
T1 = [0] * B
for i, s in enumerate(S[1:-1]):
x = b... | import sys
from bisect import bisect as br
A, B, Q = list(map(int, input().split()))
inf = 10**11
S = [-inf] + [int(sys.stdin.readline()) for _ in range(A)] + [inf]
T = [-inf] + [int(sys.stdin.readline()) for _ in range(B)] + [inf]
X = [int(sys.stdin.readline()) for _ in range(Q)]
StoT = [0] * A
for i, s in enumerate(... | false | 12.5 | [
"-from bisect import bisect_left",
"+import sys",
"+from bisect import bisect as br",
"-S = [-(10**11)] + [int(eval(input())) for _ in range(A)] + [10**11]",
"-T = [-(10**11)] + [int(eval(input())) for _ in range(B)] + [10**11]",
"-X = [int(eval(input())) for _ in range(Q)]",
"-S1 = [0] * A",
"-T1 = [... | false | 0.03914 | 0.039843 | 0.982375 | [
"s486408842",
"s870095865"
] |
u130900604 | p02761 | python | s463866555 | s906460483 | 175 | 18 | 38,640 | 3,064 | Accepted | Accepted | 89.71 | def MI():return list(map(int,input().split()))
N,M=MI()
sc=[]
for i in range(M):
x,y=MI()
sc.append((x,y))
for i in range(0,10**3):
h=str(i)
if len(h)==N:
if all([h[s-1]==str(c) for (s,c) in sc]):
print(i)
exit()
print((-1))
| def mi():return list(map(int,input().split()))
n,m=mi()
sc=[]
for i in range(m):
s,c=mi()
sc+=(s,c),
for i in range(0,999+1):
h=str(i)
if len(h)==n:
if all([h[s-1]==str(c) for s,c in sc]):
print(i)
exit()
print((-1)) | 14 | 14 | 286 | 252 | def MI():
return list(map(int, input().split()))
N, M = MI()
sc = []
for i in range(M):
x, y = MI()
sc.append((x, y))
for i in range(0, 10**3):
h = str(i)
if len(h) == N:
if all([h[s - 1] == str(c) for (s, c) in sc]):
print(i)
exit()
print((-1))
| def mi():
return list(map(int, input().split()))
n, m = mi()
sc = []
for i in range(m):
s, c = mi()
sc += ((s, c),)
for i in range(0, 999 + 1):
h = str(i)
if len(h) == n:
if all([h[s - 1] == str(c) for s, c in sc]):
print(i)
exit()
print((-1))
| false | 0 | [
"-def MI():",
"+def mi():",
"-N, M = MI()",
"+n, m = mi()",
"-for i in range(M):",
"- x, y = MI()",
"- sc.append((x, y))",
"-for i in range(0, 10**3):",
"+for i in range(m):",
"+ s, c = mi()",
"+ sc += ((s, c),)",
"+for i in range(0, 999 + 1):",
"- if len(h) == N:",
"- ... | false | 0.043124 | 0.035917 | 1.200656 | [
"s463866555",
"s906460483"
] |
u535171899 | p02624 | python | s113953360 | s062888400 | 2,205 | 1,570 | 271,708 | 183,348 | Accepted | Accepted | 28.8 | import numpy as np
from numba import jit
@jit
def main(n):
dp = np.zeros(n+1,np.int64)
#dp[1]=1
for i in range(1,n+1):
for j in range(i,n+1,i):
dp[j]+=1
dp*=np.arange(n+1)
return dp.sum()
n = int(eval(input()))
print((main(n))) | import numpy as np
def solve(stdin):
n = stdin[0]
dp = np.zeros(n+1,dtype=np.int64)
for i in range(1,n+1):
for j in range(i,n+1,i):
dp[j]+=1
dp*=np.arange(n+1)
return dp.sum()
def main():
stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
print(... | 16 | 28 | 277 | 640 | import numpy as np
from numba import jit
@jit
def main(n):
dp = np.zeros(n + 1, np.int64)
# dp[1]=1
for i in range(1, n + 1):
for j in range(i, n + 1, i):
dp[j] += 1
dp *= np.arange(n + 1)
return dp.sum()
n = int(eval(input()))
print((main(n)))
| import numpy as np
def solve(stdin):
n = stdin[0]
dp = np.zeros(n + 1, dtype=np.int64)
for i in range(1, n + 1):
for j in range(i, n + 1, i):
dp[j] += 1
dp *= np.arange(n + 1)
return dp.sum()
def main():
stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=" ")
p... | false | 42.857143 | [
"-from numba import jit",
"-@jit",
"-def main(n):",
"- dp = np.zeros(n + 1, np.int64)",
"- # dp[1]=1",
"+def solve(stdin):",
"+ n = stdin[0]",
"+ dp = np.zeros(n + 1, dtype=np.int64)",
"-n = int(eval(input()))",
"-print((main(n)))",
"+def main():",
"+ stdin = np.fromstring(open(... | false | 0.51945 | 0.454488 | 1.142934 | [
"s113953360",
"s062888400"
] |
u102461423 | p02648 | python | s244993236 | s998898354 | 1,856 | 1,252 | 517,360 | 434,116 | Accepted | Accepted | 32.54 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# ノード、重さ→価値
@njit('(i4,i4[:],i4[:])', cache=True)
def precompute(N, V, W):
U = 10**5 + 10
dp = np.zeros((1024, U), np.int32)
for v in r... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(N, V, W, v, L):
def precompute(N, V, W):
U = 10**5 + 10
dp = np.zeros((1024, U), np.int32)
for v in range(1, min(1024, N + 1)):
... | 62 | 69 | 1,720 | 1,862 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# ノード、重さ→価値
@njit("(i4,i4[:],i4[:])", cache=True)
def precompute(N, V, W):
U = 10**5 + 10
dp = np.zeros((1024, U), np.int32)
for v in range(1, min(10... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(N, V, W, v, L):
def precompute(N, V, W):
U = 10**5 + 10
dp = np.zeros((1024, U), np.int32)
for v in range(1, min(1024, N + 1)):
p = v... | false | 10.144928 | [
"-from numba import njit",
"-# ノード、重さ→価値",
"-@njit(\"(i4,i4[:],i4[:])\", cache=True)",
"-def precompute(N, V, W):",
"- U = 10**5 + 10",
"- dp = np.zeros((1024, U), np.int32)",
"- for v in range(1, min(1024, N + 1)):",
"- p = v // 2",
"- dp[v] = dp[p]",
"- dp[v, W[v] :... | false | 0.714696 | 0.229681 | 3.111696 | [
"s244993236",
"s998898354"
] |
u530606147 | p03311 | python | s848073524 | s474918290 | 426 | 297 | 87,108 | 26,180 | Accepted | Accepted | 30.28 | n = int(eval(input()))
a = list(map(int, input().split()))
def sadness(b):
sad = 0
for i, e in enumerate(a):
i += 1
sad += abs(e - (b + i))
return sad
left, right = -10**9, 10**9 + 1
while right - left > 1:
mid = (left + right) // 2
if sadness(mid) > sadness(mid + 1):
left = ... | n = int(eval(input()))
a = list(map(int, input().split()))
def sadness(b):
sad = 0
for i, e in enumerate(a):
i += 1
sad += abs(e - (b + i))
return sad
d = []
for i, e in enumerate(a):
i += 1
d.append(e - i)
d.sort()
if len(d) % 2 == 1:
print((sadness(d[len(d) // 2])))
else... | 25 | 23 | 444 | 382 | n = int(eval(input()))
a = list(map(int, input().split()))
def sadness(b):
sad = 0
for i, e in enumerate(a):
i += 1
sad += abs(e - (b + i))
return sad
left, right = -(10**9), 10**9 + 1
while right - left > 1:
mid = (left + right) // 2
if sadness(mid) > sadness(mid + 1):
l... | n = int(eval(input()))
a = list(map(int, input().split()))
def sadness(b):
sad = 0
for i, e in enumerate(a):
i += 1
sad += abs(e - (b + i))
return sad
d = []
for i, e in enumerate(a):
i += 1
d.append(e - i)
d.sort()
if len(d) % 2 == 1:
print((sadness(d[len(d) // 2])))
else:
... | false | 8 | [
"-left, right = -(10**9), 10**9 + 1",
"-while right - left > 1:",
"- mid = (left + right) // 2",
"- if sadness(mid) > sadness(mid + 1):",
"- left = mid",
"- else:",
"- right = mid",
"-# for b in range(-20, 20):",
"-# print(b,sadness(b))",
"-print((min(sadness(left), sadnes... | false | 0.042095 | 0.111938 | 0.376057 | [
"s848073524",
"s474918290"
] |
u131264627 | p02659 | python | s802091335 | s809244121 | 27 | 23 | 9,964 | 9,100 | Accepted | Accepted | 14.81 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a * b))) | s = input().split()
a = int(s[0])
b, c = list(map(int, s[1].split('.'))) if '.' in s[1] else list(map(int, [s[1], 0]))
print((a * b + a * c // 100)) | 3 | 4 | 84 | 137 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| s = input().split()
a = int(s[0])
b, c = list(map(int, s[1].split("."))) if "." in s[1] else list(map(int, [s[1], 0]))
print((a * b + a * c // 100))
| false | 25 | [
"-from decimal import Decimal",
"-",
"-a, b = list(map(Decimal, input().split()))",
"-print((int(a * b)))",
"+s = input().split()",
"+a = int(s[0])",
"+b, c = list(map(int, s[1].split(\".\"))) if \".\" in s[1] else list(map(int, [s[1], 0]))",
"+print((a * b + a * c // 100))"
] | false | 0.053078 | 0.04885 | 1.086547 | [
"s802091335",
"s809244121"
] |
u977661421 | p03612 | python | s227670791 | s984910721 | 86 | 75 | 13,880 | 13,880 | Accepted | Accepted | 12.79 | # -*- coding: utf-8 -*-
n = int(eval(input()))
p = list(map(int, input().split()))
i = 0
ans = 0
while True:
if p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
i += 1
else:
i += 1
if i == n - 1:
if p[i] == i + 1:
ans += 1
b... | # -*- coding: utf-8 -*-
n = int(eval(input()))
p = [int(i) for i in input().split()]
ans = 0
for i in range(n - 1):
if p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
if p[-1] == n:
ans += 1
print(ans)
| 18 | 12 | 331 | 240 | # -*- coding: utf-8 -*-
n = int(eval(input()))
p = list(map(int, input().split()))
i = 0
ans = 0
while True:
if p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
i += 1
else:
i += 1
if i == n - 1:
if p[i] == i + 1:
ans += 1
break
print(ans)
| # -*- coding: utf-8 -*-
n = int(eval(input()))
p = [int(i) for i in input().split()]
ans = 0
for i in range(n - 1):
if p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
if p[-1] == n:
ans += 1
print(ans)
| false | 33.333333 | [
"-p = list(map(int, input().split()))",
"-i = 0",
"+p = [int(i) for i in input().split()]",
"-while True:",
"+for i in range(n - 1):",
"- i += 1",
"- else:",
"- i += 1",
"- if i == n - 1:",
"- if p[i] == i + 1:",
"- ans += 1",
"- break",
"+if p[-1... | false | 0.036601 | 0.037789 | 0.968569 | [
"s227670791",
"s984910721"
] |
u260036763 | p03457 | python | s204868864 | s843710015 | 344 | 208 | 11,636 | 11,636 | Accepted | Accepted | 39.53 | import sys
def main():
N = int(eval(input()))
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
t[i], x[i], y[i] = list(map(int, input().split()))
flag = True
for i in range(N):
dt = t[i+1] - t[i]
dist = abs(x[i+1] - x[i]) + ab... | import sys
def main():
def input():
return sys.stdin.readline().rstrip()
N = int(eval(input()))
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
t[i], x[i], y[i] = list(map(int, input().split()))
flag = True
for i in range(N):... | 24 | 27 | 518 | 586 | import sys
def main():
N = int(eval(input()))
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N + 1):
t[i], x[i], y[i] = list(map(int, input().split()))
flag = True
for i in range(N):
dt = t[i + 1] - t[i]
dist = abs(x[i + 1] - x[i]) + abs(y[i... | import sys
def main():
def input():
return sys.stdin.readline().rstrip()
N = int(eval(input()))
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N + 1):
t[i], x[i], y[i] = list(map(int, input().split()))
flag = True
for i in range(N):
dt ... | false | 11.111111 | [
"+ def input():",
"+ return sys.stdin.readline().rstrip()",
"+"
] | false | 0.090867 | 0.04111 | 2.210347 | [
"s204868864",
"s843710015"
] |
u841568901 | p02830 | python | s448265561 | s549867592 | 29 | 24 | 9,072 | 9,168 | Accepted | Accepted | 17.24 | N = int(input())
S, T = input().split()
L = [S[i]+T[i] for i in range(N)]
print(*L, sep="")
| N = int(eval(input()))
S, T = input().split()
L = []
for i in range(2*N):
if i&1:
L.append(T[(i-1)//2])
else:
L.append(S[i//2])
print(("".join(L))) | 4 | 9 | 94 | 159 | N = int(input())
S, T = input().split()
L = [S[i] + T[i] for i in range(N)]
print(*L, sep="")
| N = int(eval(input()))
S, T = input().split()
L = []
for i in range(2 * N):
if i & 1:
L.append(T[(i - 1) // 2])
else:
L.append(S[i // 2])
print(("".join(L)))
| false | 55.555556 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-L = [S[i] + T[i] for i in range(N)]",
"-print(*L, sep=\"\")",
"+L = []",
"+for i in range(2 * N):",
"+ if i & 1:",
"+ L.append(T[(i - 1) // 2])",
"+ else:",
"+ L.append(S[i // 2])",
"+print((\"\".join(L)))"
] | false | 0.038121 | 0.043136 | 0.883745 | [
"s448265561",
"s549867592"
] |
u654470292 | p03732 | python | s968160153 | s542111663 | 847 | 305 | 133,748 | 66,028 | Accepted | Accepted | 63.99 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') +... | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') +... | 34 | 37 | 913 | 958 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
al = [chr(ord(... | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
al = [chr(ord(... | false | 8.108108 | [
"-n, w = list(map(int, input().split()))",
"+n, W = list(map(int, input().split()))",
"-dp = [[-float(\"inf\")] * 101 * 400 for i in range(n + 1)]",
"-dp[0][0] = 0",
"-kijun = wv[0][0]",
"+w1 = wv[0][0]",
"+wv.sort()",
"+lst = [[], [], [], []]",
"- for j in range(101 * 400):",
"- if dp[i... | false | 0.14006 | 0.110363 | 1.26908 | [
"s968160153",
"s542111663"
] |
u399721252 | p03112 | python | s386623093 | s545718173 | 1,535 | 617 | 12,188 | 12,180 | Accepted | Accepted | 59.8 | import bisect
a, b, q = [ int(v) for v in input().split() ]
temple_list = [ int(eval(input())) for i in range(a) ]
shrine_list = [ int(eval(input())) for i in range(b) ]
def excursion(x):
global temple_list, shine_list
temple_west = bisect.bisect_left(temple_list,x)
shrine_west = bisect.bisect_left(s... | import bisect
import sys
input = sys.stdin.readline
a, b, q = [ int(v) for v in input().split() ]
temple_list = [ int(eval(input())) for i in range(a) ]
shrine_list = [ int(eval(input())) for i in range(b) ]
def excursion(x):
global temple_list, shine_list
temple_west = bisect.bisect_left(temple_list... | 20 | 22 | 697 | 736 | import bisect
a, b, q = [int(v) for v in input().split()]
temple_list = [int(eval(input())) for i in range(a)]
shrine_list = [int(eval(input())) for i in range(b)]
def excursion(x):
global temple_list, shine_list
temple_west = bisect.bisect_left(temple_list, x)
shrine_west = bisect.bisect_left(shrine_lis... | import bisect
import sys
input = sys.stdin.readline
a, b, q = [int(v) for v in input().split()]
temple_list = [int(eval(input())) for i in range(a)]
shrine_list = [int(eval(input())) for i in range(b)]
def excursion(x):
global temple_list, shine_list
temple_west = bisect.bisect_left(temple_list, x)
shrin... | false | 9.090909 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.082201 | 0.037173 | 2.211325 | [
"s386623093",
"s545718173"
] |
u961945062 | p02629 | python | s286007063 | s473605983 | 34 | 31 | 9,184 | 9,136 | Accepted | Accepted | 8.82 | N = int(eval(input()))
ans = []
lst = []
n = N
while n > 26:
x = n%26
if x == 0:
n = n//26 - 1
else:
n = n//26
lst.append(x)
for i in range(len(lst)):
x = lst[i]
if x == 0:
y = chr(97+25)
else:
y = chr(97 + x-1)
ans.append(y)
an... | n = int(eval(input()))
ans = ""
while n:
n -= 1
ans += chr(n%26+ord("a"))
n //= 26
print((ans[::-1])) | 29 | 8 | 391 | 113 | N = int(eval(input()))
ans = []
lst = []
n = N
while n > 26:
x = n % 26
if x == 0:
n = n // 26 - 1
else:
n = n // 26
lst.append(x)
for i in range(len(lst)):
x = lst[i]
if x == 0:
y = chr(97 + 25)
else:
y = chr(97 + x - 1)
ans.append(y)
ans.append(chr(97 + ... | n = int(eval(input()))
ans = ""
while n:
n -= 1
ans += chr(n % 26 + ord("a"))
n //= 26
print((ans[::-1]))
| false | 72.413793 | [
"-N = int(eval(input()))",
"-ans = []",
"-lst = []",
"-n = N",
"-while n > 26:",
"- x = n % 26",
"- if x == 0:",
"- n = n // 26 - 1",
"- else:",
"- n = n // 26",
"- lst.append(x)",
"-for i in range(len(lst)):",
"- x = lst[i]",
"- if x == 0:",
"- y =... | false | 0.041295 | 0.136273 | 0.303033 | [
"s286007063",
"s473605983"
] |
u623819879 | p02745 | python | s462531298 | s486595140 | 1,893 | 1,653 | 54,236 | 55,516 | Accepted | Accepted | 12.68 | R=range
def F(a,b):A=len(a);return[all([len(set([a[i+j],b[j],'?']))<3for j in R(min(A-i,len(b)))])for i in R(A)]+[1]
def Z(X):
i,j,k=X;A,B,C=[len(S[t])for t in X];q=1e5
for l in R(A+1):
if M[i][j][l]:
for r in R(l,A+B+1):
if(B<r-l or M[j][k][r-l])*M[i][k][min(A,r)]:q=min(q,max(A,l+B,r+C))
return q
... | K=4000
S=[eval(input())for i in range(3)]
A,B,C=S
a,b,c=len(A),len(B),len(C)
def F(S,T):
R=[1]*(K*2+1)
for i in range(-len(T),len(S)):
for j in range(max(i,0),min(len(S),len(T)+i)):
if S[j]!=T[j-i]and S[j]!="?"and T[j-i]!="?":
R[i]=0
break
return R
S=F(A,B)
T=F(A,C)
U=F(B,C)
m=K*3
for p ... | 12 | 22 | 448 | 452 | R = range
def F(a, b):
A = len(a)
return [
all([len(set([a[i + j], b[j], "?"])) < 3 for j in R(min(A - i, len(b)))])
for i in R(A)
] + [1]
def Z(X):
i, j, k = X
A, B, C = [len(S[t]) for t in X]
q = 1e5
for l in R(A + 1):
if M[i][j][l]:
for r in R(l, A ... | K = 4000
S = [eval(input()) for i in range(3)]
A, B, C = S
a, b, c = len(A), len(B), len(C)
def F(S, T):
R = [1] * (K * 2 + 1)
for i in range(-len(T), len(S)):
for j in range(max(i, 0), min(len(S), len(T) + i)):
if S[j] != T[j - i] and S[j] != "?" and T[j - i] != "?":
R[i] ... | false | 45.454545 | [
"-R = range",
"+K = 4000",
"+S = [eval(input()) for i in range(3)]",
"+A, B, C = S",
"+a, b, c = len(A), len(B), len(C)",
"-def F(a, b):",
"- A = len(a)",
"- return [",
"- all([len(set([a[i + j], b[j], \"?\"])) < 3 for j in R(min(A - i, len(b)))])",
"- for i in R(A)",
"- ]... | false | 0.115748 | 0.042146 | 2.746381 | [
"s462531298",
"s486595140"
] |
u256678932 | p02399 | python | s894325864 | s816191359 | 30 | 20 | 7,628 | 5,608 | Accepted | Accepted | 33.33 | a, b = list(map(int, input().split(' ')))
print(("{} {} {:5f}".format(int(a/b), a%b, a/b))) | a, b = list(map(int, input().split()))
d, r = divmod(a, b)
f = a / b
print(("{} {} {:.5f}".format(d,r,f)))
| 3 | 6 | 86 | 106 | a, b = list(map(int, input().split(" ")))
print(("{} {} {:5f}".format(int(a / b), a % b, a / b)))
| a, b = list(map(int, input().split()))
d, r = divmod(a, b)
f = a / b
print(("{} {} {:.5f}".format(d, r, f)))
| false | 50 | [
"-a, b = list(map(int, input().split(\" \")))",
"-print((\"{} {} {:5f}\".format(int(a / b), a % b, a / b)))",
"+a, b = list(map(int, input().split()))",
"+d, r = divmod(a, b)",
"+f = a / b",
"+print((\"{} {} {:.5f}\".format(d, r, f)))"
] | false | 0.033337 | 0.035574 | 0.937124 | [
"s894325864",
"s816191359"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.