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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u653837719 | p02774 | python | s607179597 | s148113836 | 715 | 632 | 95,108 | 94,724 | Accepted | Accepted | 11.61 | from bisect import bisect_left, bisect_right
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
negative_end = bisect_left(A, 0)
positive_start = bisect_right(A, 0)
positive_cnt = N - positive_start
negative_cnt = negative_end
zero_cnt = N - (positive_cnt + negative_cnt)
... | from bisect import bisect_left, bisect_right
n, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
pos_start = bisect_right(a, 0)
neg_end = bisect_left(a, 0)
pos_cnt = n - pos_start
neg_cnt = neg_end
pairs_cnt = n * (n - 1) // 2
pos_pairs_cnt = pos_cnt * (pos_cnt - 1) // 2 +... | 60 | 62 | 1,642 | 1,461 | from bisect import bisect_left, bisect_right
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
negative_end = bisect_left(A, 0)
positive_start = bisect_right(A, 0)
positive_cnt = N - positive_start
negative_cnt = negative_end
zero_cnt = N - (positive_cnt + negative_cnt)
negative_pairs_... | from bisect import bisect_left, bisect_right
n, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
pos_start = bisect_right(a, 0)
neg_end = bisect_left(a, 0)
pos_cnt = n - pos_start
neg_cnt = neg_end
pairs_cnt = n * (n - 1) // 2
pos_pairs_cnt = pos_cnt * (pos_cnt - 1) // 2 + neg_cnt * (neg... | false | 3.225806 | [
"-N, K = list(map(int, input().split()))",
"-A = sorted(list(map(int, input().split())))",
"-negative_end = bisect_left(A, 0)",
"-positive_start = bisect_right(A, 0)",
"-positive_cnt = N - positive_start",
"-negative_cnt = negative_end",
"-zero_cnt = N - (positive_cnt + negative_cnt)",
"-negative_pair... | false | 0.043261 | 0.042823 | 1.010232 | [
"s607179597",
"s148113836"
] |
u036104576 | p02851 | python | s343902555 | s349488533 | 290 | 245 | 42,884 | 42,808 | Accepted | Accepted | 15.52 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdi... | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdi... | 55 | 52 | 1,190 | 1,133 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
#... | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
#... | false | 5.454545 | [
"-q = deque([])",
"+ if j >= K:",
"+ mp[acc[j - K]] -= 1",
"- q.append(acc[j])",
"- if len(q) == K:",
"- mp[q[0]] -= 1",
"- q.popleft()"
] | false | 0.038177 | 0.129975 | 0.293729 | [
"s343902555",
"s349488533"
] |
u171366497 | p03835 | python | s754292491 | s942992641 | 1,784 | 1,366 | 2,940 | 2,940 | Accepted | Accepted | 23.43 | #1-6-1 #ABC051B
k,s=list(map(int,input().split()))
count=0
for x in range(k+1):
for y in range(k+1):
if s-x-y<=k and s-x-y>=0:count+=1
print(count) | k,s=list(map(int,input().split()))
ans=0
for x in range(min(s+1,k+1)):
first=s-x
for y in range(min(first+1,k+1)):
if first-y >=0and first-y<=k:
ans+=1
print(ans) | 7 | 8 | 160 | 205 | # 1-6-1 #ABC051B
k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
if s - x - y <= k and s - x - y >= 0:
count += 1
print(count)
| k, s = list(map(int, input().split()))
ans = 0
for x in range(min(s + 1, k + 1)):
first = s - x
for y in range(min(first + 1, k + 1)):
if first - y >= 0 and first - y <= k:
ans += 1
print(ans)
| false | 12.5 | [
"-# 1-6-1 #ABC051B",
"-count = 0",
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"- if s - x - y <= k and s - x - y >= 0:",
"- count += 1",
"-print(count)",
"+ans = 0",
"+for x in range(min(s + 1, k + 1)):",
"+ first = s - x",
"+ for y in range(min(first + 1,... | false | 0.043096 | 0.033549 | 1.284568 | [
"s754292491",
"s942992641"
] |
u909514237 | p02572 | python | s238180678 | s318013322 | 172 | 151 | 31,612 | 31,432 | Accepted | Accepted | 12.21 | N = int(eval(input()))
A = list(map(int, input().split()))
Asum = sum(A) % (10**9 + 7)
ans = 0
for i in range(N):
ans += A[i] * (Asum-A[i]) % (10**9 + 7)
Asum -= A[i]
print((ans % (10**9 + 7))) | N = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
s = 0
for i in a:
s += i
ans = 0
for i in range(N):
s -= a[i]
ans += a[i] * s % mod
print((ans%mod))
| 10 | 11 | 200 | 184 | N = int(eval(input()))
A = list(map(int, input().split()))
Asum = sum(A) % (10**9 + 7)
ans = 0
for i in range(N):
ans += A[i] * (Asum - A[i]) % (10**9 + 7)
Asum -= A[i]
print((ans % (10**9 + 7)))
| N = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
s = 0
for i in a:
s += i
ans = 0
for i in range(N):
s -= a[i]
ans += a[i] * s % mod
print((ans % mod))
| false | 9.090909 | [
"-A = list(map(int, input().split()))",
"-Asum = sum(A) % (10**9 + 7)",
"+a = list(map(int, input().split()))",
"+mod = 10**9 + 7",
"+s = 0",
"+for i in a:",
"+ s += i",
"- ans += A[i] * (Asum - A[i]) % (10**9 + 7)",
"- Asum -= A[i]",
"-print((ans % (10**9 + 7)))",
"+ s -= a[i]",
"... | false | 0.043943 | 0.042202 | 1.041256 | [
"s238180678",
"s318013322"
] |
u624475441 | p03222 | python | s318509328 | s811160003 | 26 | 23 | 3,316 | 3,064 | Accepted | Accepted | 11.54 | from collections import defaultdict
A = [1, 2, 3, 5, 8, 13, 21, 34]
MOD = 10**9 + 7
H, W, K = list(map(int, input().split()))
K -= 1
if W == 0:
print((1))
exit()
dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1
for i in range(1, H + 1):
for j in range(i + 1):
for k in [-1, 0, 1]:
... | A = [1, 2, 3, 5, 8, 13, 21]
MOD = 10**9 + 7
H, W, K = list(map(int, input().split()))
if W == 0:
print((1))
exit()
dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1
for i in range(1, H + 1):
for j in range(i + 1):
for k in [-1, 0, 1]:
if not 0 <= j + k < W: continue
... | 26 | 25 | 805 | 783 | from collections import defaultdict
A = [1, 2, 3, 5, 8, 13, 21, 34]
MOD = 10**9 + 7
H, W, K = list(map(int, input().split()))
K -= 1
if W == 0:
print((1))
exit()
dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1
for i in range(1, H + 1):
for j in range(i + 1):
for k in [-1, 0, 1]:
if no... | A = [1, 2, 3, 5, 8, 13, 21]
MOD = 10**9 + 7
H, W, K = list(map(int, input().split()))
if W == 0:
print((1))
exit()
dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1
for i in range(1, H + 1):
for j in range(i + 1):
for k in [-1, 0, 1]:
if not 0 <= j + k < W:
continue
... | false | 3.846154 | [
"-from collections import defaultdict",
"-",
"-A = [1, 2, 3, 5, 8, 13, 21, 34]",
"+A = [1, 2, 3, 5, 8, 13, 21]",
"-K -= 1",
"-print((dp[H][K] % MOD))",
"+ dp[i][j] %= MOD",
"+print((dp[H][K - 1]))"
] | false | 0.043717 | 0.044318 | 0.986445 | [
"s318509328",
"s811160003"
] |
u887207211 | p03416 | python | s885005427 | s256254272 | 133 | 67 | 2,940 | 2,940 | Accepted | Accepted | 49.62 | A, B = list(map(int,input().split()))
cnt = 0
for i in range(A,B+1):
if(list(str(i)) == list(str(i))[::-1]):
cnt += 1
print(cnt) | A, B = list(map(int,input().split()))
cnt = 0
for i in range(A, B+1):
if(str(i) == str(i)[::-1]):
cnt += 1
print(cnt) | 6 | 7 | 133 | 124 | A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B + 1):
if list(str(i)) == list(str(i))[::-1]:
cnt += 1
print(cnt)
| A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B + 1):
if str(i) == str(i)[::-1]:
cnt += 1
print(cnt)
| false | 14.285714 | [
"- if list(str(i)) == list(str(i))[::-1]:",
"+ if str(i) == str(i)[::-1]:"
] | false | 0.076874 | 0.044538 | 1.726019 | [
"s885005427",
"s256254272"
] |
u072717685 | p02684 | python | s334677702 | s029318529 | 143 | 116 | 46,112 | 33,320 | Accepted | Accepted | 18.88 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
n, k, *a = list(map(int, read().split()))
cur_town = 0
transits = set()
tran_time = defaultdict(int)
cnt = 0
while True:
if k == 0:
print((cur_town +... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
n, k, *a = list(map(int, read().split()))
cur_town = 0
tran_time = defaultdict(int)
cnt = 0
while True:
if k == 0:
print((cur_town + 1))
sys.... | 31 | 29 | 746 | 689 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
n, k, *a = list(map(int, read().split()))
cur_town = 0
transits = set()
tran_time = defaultdict(int)
cnt = 0
while True:
if k == 0:
print((cur_town + 1))
... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
n, k, *a = list(map(int, read().split()))
cur_town = 0
tran_time = defaultdict(int)
cnt = 0
while True:
if k == 0:
print((cur_town + 1))
sys.exit()
... | false | 6.451613 | [
"- transits = set()",
"- if cur_town in transits:",
"+ if cur_town in tran_time:",
"- transits.add(cur_town)"
] | false | 0.046075 | 0.007808 | 5.900956 | [
"s334677702",
"s029318529"
] |
u334712262 | p02947 | python | s142146434 | s092607351 | 1,363 | 629 | 27,944 | 155,736 | Accepted | Accepted | 53.85 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 86 | 74 | 1,573 | 1,377 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 13.953488 | [
"- c = []",
"- c = Counter(s)",
"- h = []",
"- for k in sorted(c.keys()):",
"- h.append(k + str(c[k]))",
"- d[\"\".join(h)] += 1",
"- ans = 0",
"- for v in d.values():",
"- if v == 1:",
"- pass",
"- else:",
"- ... | false | 0.03901 | 0.039075 | 0.998324 | [
"s142146434",
"s092607351"
] |
u633068244 | p00053 | python | s814463717 | s186742545 | 50 | 40 | 8,816 | 8,680 | Accepted | Accepted | 20 | import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while Tr... | import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while True:... | 24 | 23 | 397 | 394 | import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1] * r
p[0] = 0
for i in range(1, sqrt):
if p[i]:
for j in range(2 * i + 1, r, i + 1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2, r):
if p[i]:
s[k] = i + 1 + s[k - 1]
k += 1
while True:
n =... | import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1] * r
p[0] = 0
for i in range(1, sqrt):
if p[i]:
p[2 * i + 1 :: i + 1] = [0 for x in range(2 * i + 1, r, i + 1)]
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2, r):
if p[i]:
s[k] = i + 1 + s[k - 1]
k += 1
while True:
... | false | 4.166667 | [
"- for j in range(2 * i + 1, r, i + 1):",
"- p[j] = 0",
"+ p[2 * i + 1 :: i + 1] = [0 for x in range(2 * i + 1, r, i + 1)]"
] | false | 0.207319 | 0.072527 | 2.8585 | [
"s814463717",
"s186742545"
] |
u263830634 | p02721 | python | s738693565 | s179401621 | 358 | 251 | 23,532 | 26,416 | Accepted | Accepted | 29.89 | N, K, C = list(map(int, input().split()))
S = list(eval(input()))
R = []
tmp = 0
count = 0
while tmp < N:
if S[tmp] == 'o':
R.append(tmp)
count += 1
if count == K:
break
tmp += C + 1
else:
tmp += 1
L = []
tmp = N - 1
count = 0
while tmp >=... | import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N, K, C = list(map(int, input().split()))
S = list(eval(input()))
mae = [-1] * N
i = 0
count = 0
while i < N and count < K:
if S[i] == 'o':
mae[i] = count
count += 1
i += C + 1
else... | 33 | 33 | 562 | 613 | N, K, C = list(map(int, input().split()))
S = list(eval(input()))
R = []
tmp = 0
count = 0
while tmp < N:
if S[tmp] == "o":
R.append(tmp)
count += 1
if count == K:
break
tmp += C + 1
else:
tmp += 1
L = []
tmp = N - 1
count = 0
while tmp >= 0:
if S[tmp] == ... | import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, K, C = list(map(int, input().split()))
S = list(eval(input()))
mae = [-1] * N
i = 0
count = 0
while i < N and count < K:
if S[i] == "o":
mae[i] = count
count += 1
i += C + 1
else:
i += 1
ushi... | false | 0 | [
"+import sys",
"+",
"+# input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-R = []",
"-tmp = 0",
"+mae = [-1] * N",
"+i = 0",
"-while tmp < N:",
"- if S[tmp] == \"o\":",
"- R.append(tmp)",
"+while i < N and count < K:",
"+ if S[i] == \"o\":",
... | false | 0.071813 | 0.092127 | 0.779501 | [
"s738693565",
"s179401621"
] |
u408260374 | p00447 | python | s894620759 | s058498463 | 2,030 | 160 | 7,008 | 22,500 | Accepted | Accepted | 92.12 | while True:
m = int(eval(input()))
if m == 0: break
sx, sy = list(map(int, input().split()))
star = []
for i in range(m-1):
x, y = list(map(int, input().split()))
star.append((x-sx, y-sy))
n = int(eval(input()))
starlist = [tuple(map(int, input().split())... | board = [[False]*1000001]*1000001
while True:
m = int(eval(input()))
if m == 0: break
star = tuple(tuple(map(int, input().split())) for i in range(m))
sx, sy = star[0]
n = int(eval(input()))
starlist = [tuple(map(int, input().split())) for i in range(n)]
for i in range(n):
... | 24 | 23 | 721 | 816 | while True:
m = int(eval(input()))
if m == 0:
break
sx, sy = list(map(int, input().split()))
star = []
for i in range(m - 1):
x, y = list(map(int, input().split()))
star.append((x - sx, y - sy))
n = int(eval(input()))
starlist = [tuple(map(int, input().split())) for i... | board = [[False] * 1000001] * 1000001
while True:
m = int(eval(input()))
if m == 0:
break
star = tuple(tuple(map(int, input().split())) for i in range(m))
sx, sy = star[0]
n = int(eval(input()))
starlist = [tuple(map(int, input().split())) for i in range(n)]
for i in range(n):
... | false | 4.166667 | [
"+board = [[False] * 1000001] * 1000001",
"- sx, sy = list(map(int, input().split()))",
"- star = []",
"- for i in range(m - 1):",
"- x, y = list(map(int, input().split()))",
"- star.append((x - sx, y - sy))",
"+ star = tuple(tuple(map(int, input().split())) for i in range(m))"... | false | 0.042965 | 0.068544 | 0.626824 | [
"s894620759",
"s058498463"
] |
u404676457 | p03965 | python | s447409604 | s818830915 | 35 | 21 | 3,956 | 3,956 | Accepted | Accepted | 40 | s = list(eval(input()))
count = 0
for i in s:
if i == 'g':
count += 1
else:
count -= 1
print((count//2)) | s = list(eval(input()))
print(((s.count('g') - s.count('p'))//2)) | 8 | 2 | 127 | 58 | s = list(eval(input()))
count = 0
for i in s:
if i == "g":
count += 1
else:
count -= 1
print((count // 2))
| s = list(eval(input()))
print(((s.count("g") - s.count("p")) // 2))
| false | 75 | [
"-count = 0",
"-for i in s:",
"- if i == \"g\":",
"- count += 1",
"- else:",
"- count -= 1",
"-print((count // 2))",
"+print(((s.count(\"g\") - s.count(\"p\")) // 2))"
] | false | 0.098418 | 0.039736 | 2.476758 | [
"s447409604",
"s818830915"
] |
u969850098 | p03274 | python | s067986683 | s604401226 | 84 | 77 | 14,780 | 14,844 | Accepted | Accepted | 8.33 | import sys
readline = sys.stdin.readline
def main():
N, K = list(map(int, readline().rstrip().split()))
X = list(map(int, readline().rstrip().split()))
len_m = len([x for x in X if x < 0])
len_p = len([x for x in X if x > 0])
ans = 10**10
for i in range(max(0, len_m-K), min(len_m+K, N-... | import sys
readline = sys.stdin.readline
def main():
N, K = list(map(int, readline().rstrip().split()))
X = list(map(int, readline().rstrip().split()))
len_m = len([x for x in X if x < 0])
ans = 10**10
for i in range(max(0, len_m-K), min(len_m+K, N-K+1)):
l = X[i]
r = X[i+... | 23 | 22 | 583 | 541 | import sys
readline = sys.stdin.readline
def main():
N, K = list(map(int, readline().rstrip().split()))
X = list(map(int, readline().rstrip().split()))
len_m = len([x for x in X if x < 0])
len_p = len([x for x in X if x > 0])
ans = 10**10
for i in range(max(0, len_m - K), min(len_m + K, N - K... | import sys
readline = sys.stdin.readline
def main():
N, K = list(map(int, readline().rstrip().split()))
X = list(map(int, readline().rstrip().split()))
len_m = len([x for x in X if x < 0])
ans = 10**10
for i in range(max(0, len_m - K), min(len_m + K, N - K + 1)):
l = X[i]
r = X[i ... | false | 4.347826 | [
"- len_p = len([x for x in X if x > 0])"
] | false | 0.036089 | 0.049415 | 0.730312 | [
"s067986683",
"s604401226"
] |
u844646164 | p03425 | python | s773291755 | s610414945 | 230 | 198 | 10,412 | 87,812 | Accepted | Accepted | 13.91 | from collections import defaultdict
import itertools
N = int(eval(input()))
name_dict = defaultdict(list)
for _ in range(N):
name = eval(input())
f_n = list(name)[0]
name_dict[f_n].append(name)
count = 0
start_name = ['M', 'A', 'R', 'C', 'H']
del_list = []
comb_name = list(itertools.combinations(... | import itertools
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
d = {'M':[], 'A':[], 'R':[], 'C':[], 'H':[]}
for s in S:
for c in ['M', 'A', 'R', 'C', 'H']:
if s.startswith(c):
d[c] += [s]
num = {k: len(d[k]) for k in ['M', 'A', 'R', 'C', 'H']}
ans = 0
for v in iter... | 24 | 19 | 666 | 438 | from collections import defaultdict
import itertools
N = int(eval(input()))
name_dict = defaultdict(list)
for _ in range(N):
name = eval(input())
f_n = list(name)[0]
name_dict[f_n].append(name)
count = 0
start_name = ["M", "A", "R", "C", "H"]
del_list = []
comb_name = list(itertools.combinations(start_name... | import itertools
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
d = {"M": [], "A": [], "R": [], "C": [], "H": []}
for s in S:
for c in ["M", "A", "R", "C", "H"]:
if s.startswith(c):
d[c] += [s]
num = {k: len(d[k]) for k in ["M", "A", "R", "C", "H"]}
ans = 0
for v in itertools.comb... | false | 20.833333 | [
"-from collections import defaultdict",
"-name_dict = defaultdict(list)",
"-for _ in range(N):",
"- name = eval(input())",
"- f_n = list(name)[0]",
"- name_dict[f_n].append(name)",
"-count = 0",
"-start_name = [\"M\", \"A\", \"R\", \"C\", \"H\"]",
"-del_list = []",
"-comb_name = list(iter... | false | 0.148958 | 0.067153 | 2.218186 | [
"s773291755",
"s610414945"
] |
u179169725 | p02775 | python | s739397512 | s065250208 | 826 | 286 | 5,516 | 62,268 | Accepted | Accepted | 65.38 | import sys
read = sys.stdin.readline
# 下の桁から貪欲に見ていくと解ける
# 1の位が4以下ならそのまま紙幣で支払うのが得→自身をそのまま答えに採用 (枚数として加算)
# 6以上ならばお釣り狙いのほうが得→自身は0にセットして、上位桁を+1する (枚数として10-自身を加算)
# 5ちょうどのときは、お釣りもそのまま払っても枚数は変わらない。だけど555みたいに、上位桁に+1すると得になる可能性がある。
# 555→15枚, 1000-445→15枚
# つまり5が出たときは更に上位の桁を見て、4以下ならそのまま払うほうが得,5以上なら桁上りのほうが得
# 5ちょう... | import sys
read = sys.stdin.readline
# 下の桁から貪欲に見ていくと解ける
# 1の位が4以下ならそのまま紙幣で支払うのが得→自身をそのまま答えに採用 (枚数として加算)
# 6以上ならばお釣り狙いのほうが得→自身は0にセットして、上位桁を+1する (枚数として10-自身を加算)
# 5ちょうどのときは、お釣りもそのまま払っても枚数は変わらない。だけど555みたいに、上位桁に+1すると得になる可能性がある。
# 555→15枚, 1000-445→15枚
# つまり5が出たときは更に上位の桁を見て、4以下ならそのまま払うほうが得,5以上なら桁上りのほうが得
# 5ちょう... | 41 | 41 | 904 | 935 | import sys
read = sys.stdin.readline
# 下の桁から貪欲に見ていくと解ける
# 1の位が4以下ならそのまま紙幣で支払うのが得→自身をそのまま答えに採用 (枚数として加算)
# 6以上ならばお釣り狙いのほうが得→自身は0にセットして、上位桁を+1する (枚数として10-自身を加算)
# 5ちょうどのときは、お釣りもそのまま払っても枚数は変わらない。だけど555みたいに、上位桁に+1すると得になる可能性がある。
# 555→15枚, 1000-445→15枚
# つまり5が出たときは更に上位の桁を見て、4以下ならそのまま払うほうが得,5以上なら桁上りのほうが得
# 5ちょうどのときは? #お釣りもそ... | import sys
read = sys.stdin.readline
# 下の桁から貪欲に見ていくと解ける
# 1の位が4以下ならそのまま紙幣で支払うのが得→自身をそのまま答えに採用 (枚数として加算)
# 6以上ならばお釣り狙いのほうが得→自身は0にセットして、上位桁を+1する (枚数として10-自身を加算)
# 5ちょうどのときは、お釣りもそのまま払っても枚数は変わらない。だけど555みたいに、上位桁に+1すると得になる可能性がある。
# 555→15枚, 1000-445→15枚
# つまり5が出たときは更に上位の桁を見て、4以下ならそのまま払うほうが得,5以上なら桁上りのほうが得
# 5ちょうどのときは? #お釣りもそ... | false | 0 | [
"- # loが5以外のとき (お釣りが良いか、そのまま払うのが良いか考えるだけ)",
"- if lo == 5:",
"+ if lo == 5: # 5のときは上の桁の大きさによってお釣りが得になるかそのまま払うのが良くなるか変化する",
"- elif lo < 5: # 5が連続しないときもここに入る",
"+ elif lo < 5:",
"+ # loが5以外のとき (お釣りが良いか、そのまま払うのが良いか考えるだけ)"
] | false | 0.043018 | 0.043336 | 0.992671 | [
"s739397512",
"s065250208"
] |
u256256172 | p00605 | python | s433164664 | s314253828 | 240 | 220 | 7,664 | 7,632 | Accepted | Accepted | 8.33 | while True:
n,k = list(map(int, input().split()))
if n == k == 0:
break
s = [int(x) for x in input().split()]
for _ in range(n):
b = [int(x) for x in input().split()]
for i in range(k):
s[i] -= b[i]
print(("Yes" if min(s) >= 0 else "No")) | while True:
n,k = list(map(int, input().split()))
if n == k == 0:
break
s = list(map(int, input().split()))
for _ in range(n):
b = list(map(int, input().split()))
for i in range(k):
s[i] -= b[i]
print(("Yes" if min(s) >= 0 else "No")) | 10 | 10 | 295 | 291 | while True:
n, k = list(map(int, input().split()))
if n == k == 0:
break
s = [int(x) for x in input().split()]
for _ in range(n):
b = [int(x) for x in input().split()]
for i in range(k):
s[i] -= b[i]
print(("Yes" if min(s) >= 0 else "No"))
| while True:
n, k = list(map(int, input().split()))
if n == k == 0:
break
s = list(map(int, input().split()))
for _ in range(n):
b = list(map(int, input().split()))
for i in range(k):
s[i] -= b[i]
print(("Yes" if min(s) >= 0 else "No"))
| false | 0 | [
"- s = [int(x) for x in input().split()]",
"+ s = list(map(int, input().split()))",
"- b = [int(x) for x in input().split()]",
"+ b = list(map(int, input().split()))"
] | false | 0.044193 | 0.075167 | 0.587923 | [
"s433164664",
"s314253828"
] |
u232852711 | p03045 | python | s118643571 | s295349397 | 1,678 | 1,188 | 92,516 | 126,296 | Accepted | Accepted | 29.2 | from collections import deque
n, m = list(map(int, input().split()))
xyz = {i:[] for i in range(1, n+1)}
for _ in range(m):
x, y, z = list(map(int, input().split()))
xyz[x].append((x, y, z))
xyz[y].append((y, x, z))
connects = [0]*(n+1)
group = 1
for i in range(1, n+1):
if connects[i] > 0:... | from collections import deque
n, m = list(map(int, input().split()))
xyz = []
for _ in range(m):
x, y, z = list(map(int, input().split()))
xyz.append((x, y, z))
uf = [-1]*(n+1)
def find(i):
if uf[i] < 0:
return i
else:
uf[i] = find(uf[i])
return uf[i]
for x, ... | 33 | 28 | 774 | 562 | from collections import deque
n, m = list(map(int, input().split()))
xyz = {i: [] for i in range(1, n + 1)}
for _ in range(m):
x, y, z = list(map(int, input().split()))
xyz[x].append((x, y, z))
xyz[y].append((y, x, z))
connects = [0] * (n + 1)
group = 1
for i in range(1, n + 1):
if connects[i] > 0:
... | from collections import deque
n, m = list(map(int, input().split()))
xyz = []
for _ in range(m):
x, y, z = list(map(int, input().split()))
xyz.append((x, y, z))
uf = [-1] * (n + 1)
def find(i):
if uf[i] < 0:
return i
else:
uf[i] = find(uf[i])
return uf[i]
for x, y, z in xyz:... | false | 15.151515 | [
"-xyz = {i: [] for i in range(1, n + 1)}",
"+xyz = []",
"- xyz[x].append((x, y, z))",
"- xyz[y].append((y, x, z))",
"-connects = [0] * (n + 1)",
"-group = 1",
"-for i in range(1, n + 1):",
"- if connects[i] > 0:",
"- continue",
"- if len(xyz[i]) == 0:",
"- connects[i] =... | false | 0.044438 | 0.070025 | 0.634598 | [
"s118643571",
"s295349397"
] |
u020390084 | p03495 | python | s175481418 | s142838916 | 138 | 121 | 43,760 | 43,760 | Accepted | Accepted | 12.32 | #!/usr/bin/env python3
import sys
import collections
def solve(N: int, K: int, A: "List[int]"):
a_counter = collections.Counter(A)
if len(a_counter) <= K:
print((0))
return
values = sorted(list(a_counter.values()))
answer = 0
for i in range(len(a_counter)-K):
... | #!/usr/bin/env python3
import sys
from collections import Counter
def solve(N: int, K: int, A: "List[int]"):
counter = list(Counter(A).values())
counter.sort()
if len(counter) <= K:
print((0))
else:
need = len(counter)-K
print((sum(counter[:need])))
return
... | 32 | 31 | 920 | 865 | #!/usr/bin/env python3
import sys
import collections
def solve(N: int, K: int, A: "List[int]"):
a_counter = collections.Counter(A)
if len(a_counter) <= K:
print((0))
return
values = sorted(list(a_counter.values()))
answer = 0
for i in range(len(a_counter) - K):
answer += va... | #!/usr/bin/env python3
import sys
from collections import Counter
def solve(N: int, K: int, A: "List[int]"):
counter = list(Counter(A).values())
counter.sort()
if len(counter) <= K:
print((0))
else:
need = len(counter) - K
print((sum(counter[:need])))
return
# Generated b... | false | 3.125 | [
"-import collections",
"+from collections import Counter",
"- a_counter = collections.Counter(A)",
"- if len(a_counter) <= K:",
"+ counter = list(Counter(A).values())",
"+ counter.sort()",
"+ if len(counter) <= K:",
"- return",
"- values = sorted(list(a_counter.values()))",
... | false | 0.118805 | 0.180344 | 0.658767 | [
"s175481418",
"s142838916"
] |
u729133443 | p03026 | python | s613366341 | s606559524 | 243 | 51 | 50,068 | 6,692 | Accepted | Accepted | 79.01 | n,*t=list(map(int,open(0).read().split()))
c=sorted(t[-n:])
print((sum(c[:-1])))
e={i:[]for i in range(n)}
for a,b in zip(t[:-n:2],t[1:-n:2]):e[a-1]+=b-1,;e[b-1]+=a-1,
f=[0]*n
q=[0]
while q:
v=q.pop();f[v]=c.pop()
for w in e[v]:q+=[w]*(f[w]<1)
print((*f)) | n,*t=list(map(int,open(0).read().split()))
c=sorted(t[-n:])
print((sum(c[:-1])))
e=[[]for _ in[0]*n]
for a,b in zip(t[:-n:2],t[1:-n:2]):e[a-1]+=b-1,;e[b-1]+=a-1,
f=[0]*n
q=[0]
while q:
v=q.pop();f[v]=c.pop()
for w in e[v]:q+=[w]*(f[w]<1)
print((*f)) | 11 | 11 | 257 | 251 | n, *t = list(map(int, open(0).read().split()))
c = sorted(t[-n:])
print((sum(c[:-1])))
e = {i: [] for i in range(n)}
for a, b in zip(t[:-n:2], t[1:-n:2]):
e[a - 1] += (b - 1,)
e[b - 1] += (a - 1,)
f = [0] * n
q = [0]
while q:
v = q.pop()
f[v] = c.pop()
for w in e[v]:
q += [w] * (f[w] < 1)
pr... | n, *t = list(map(int, open(0).read().split()))
c = sorted(t[-n:])
print((sum(c[:-1])))
e = [[] for _ in [0] * n]
for a, b in zip(t[:-n:2], t[1:-n:2]):
e[a - 1] += (b - 1,)
e[b - 1] += (a - 1,)
f = [0] * n
q = [0]
while q:
v = q.pop()
f[v] = c.pop()
for w in e[v]:
q += [w] * (f[w] < 1)
print(... | false | 0 | [
"-e = {i: [] for i in range(n)}",
"+e = [[] for _ in [0] * n]"
] | false | 0.311923 | 0.043808 | 7.120262 | [
"s613366341",
"s606559524"
] |
u445624660 | p02802 | python | s256806309 | s020815402 | 306 | 190 | 15,908 | 9,608 | Accepted | Accepted | 37.91 | n, m = list(map(int, input().split()))
table = {}
ac = 0
pena = 0
pena_arr = [0 for _ in range(n + 1)]
for _ in range(m):
a, b = input().split()
a = int(a)
if a in table:
continue
if b == "AC":
ac += 1
table[a] = True
elif b == "WA":
pena_arr[a] += 1
pe... | n, m = list(map(int, input().split()))
account, wacount = 0, 0
acdic = [0] * (n + 10)
for _ in range(m):
p, s = input().split()
p = int(p)
if s == "AC" and acdic[p] <= 0:
account += 1
wacount += abs(acdic[p])
acdic[p] = 1
elif s == "WA" and acdic[p] <= 0:
acdic... | 20 | 13 | 434 | 347 | n, m = list(map(int, input().split()))
table = {}
ac = 0
pena = 0
pena_arr = [0 for _ in range(n + 1)]
for _ in range(m):
a, b = input().split()
a = int(a)
if a in table:
continue
if b == "AC":
ac += 1
table[a] = True
elif b == "WA":
pena_arr[a] += 1
pena = 0
for i in... | n, m = list(map(int, input().split()))
account, wacount = 0, 0
acdic = [0] * (n + 10)
for _ in range(m):
p, s = input().split()
p = int(p)
if s == "AC" and acdic[p] <= 0:
account += 1
wacount += abs(acdic[p])
acdic[p] = 1
elif s == "WA" and acdic[p] <= 0:
acdic[p] -= 1
pr... | false | 35 | [
"-table = {}",
"-ac = 0",
"-pena = 0",
"-pena_arr = [0 for _ in range(n + 1)]",
"+account, wacount = 0, 0",
"+acdic = [0] * (n + 10)",
"- a, b = input().split()",
"- a = int(a)",
"- if a in table:",
"- continue",
"- if b == \"AC\":",
"- ac += 1",
"- table[a] ... | false | 0.035554 | 0.034344 | 1.035241 | [
"s256806309",
"s020815402"
] |
u297574184 | p02844 | python | s465753362 | s581943786 | 692 | 19 | 3,188 | 3,060 | Accepted | Accepted | 97.25 | N = int(eval(input()))
Ss = eval(input())
used1s = [False] * 10
used2s = [False] * 100
used3s = [False] * 1000
for S in Ss:
S = int(S)
for x in range(100):
if used2s[x]:
used3s[x*10+S] = True
for x in range(10):
if used1s[x]:
used2s[x*10+S] = True
... | N = int(eval(input()))
Ss = eval(input())
ans = 0
for P in range(1000):
Ds = str(P).zfill(3)
pos = -1
for D in Ds:
pos = Ss.find(D, pos+1)
if pos == -1:
break
else:
ans += 1
print(ans)
| 19 | 15 | 366 | 241 | N = int(eval(input()))
Ss = eval(input())
used1s = [False] * 10
used2s = [False] * 100
used3s = [False] * 1000
for S in Ss:
S = int(S)
for x in range(100):
if used2s[x]:
used3s[x * 10 + S] = True
for x in range(10):
if used1s[x]:
used2s[x * 10 + S] = True
used1s[S... | N = int(eval(input()))
Ss = eval(input())
ans = 0
for P in range(1000):
Ds = str(P).zfill(3)
pos = -1
for D in Ds:
pos = Ss.find(D, pos + 1)
if pos == -1:
break
else:
ans += 1
print(ans)
| false | 21.052632 | [
"-used1s = [False] * 10",
"-used2s = [False] * 100",
"-used3s = [False] * 1000",
"-for S in Ss:",
"- S = int(S)",
"- for x in range(100):",
"- if used2s[x]:",
"- used3s[x * 10 + S] = True",
"- for x in range(10):",
"- if used1s[x]:",
"- used2s[x * 10 ... | false | 0.057757 | 0.041921 | 1.377767 | [
"s465753362",
"s581943786"
] |
u151037808 | p02888 | python | s554848832 | s423057404 | 1,743 | 754 | 50,268 | 42,204 | Accepted | Accepted | 56.74 | # -*- coding: utf-8 -*-
import bisect
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
l = list(map(int, input().split()))
l = sorted(l)
result = 0
for i in range(n-2):
for j in range(i + 1, n - 1):
result += bisect.bisect_left(l[j+1:],... | # -*- coding: utf-8 -*-
import bisect
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
l = list(map(int, input().split()))
l = sorted(l)
result = 0
for i in range(n-2):
for j in range(i + 1, n - 1):
result += bisect.bisect_left(l, l[i] ... | 21 | 21 | 395 | 399 | # -*- coding: utf-8 -*-
import bisect
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
l = list(map(int, input().split()))
l = sorted(l)
result = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
result += bisect.bisect_left(l[j + 1 :], l[i] + l[j]... | # -*- coding: utf-8 -*-
import bisect
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
l = list(map(int, input().split()))
l = sorted(l)
result = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
result += bisect.bisect_left(l, l[i] + l[j]) - (j + ... | false | 0 | [
"- result += bisect.bisect_left(l[j + 1 :], l[i] + l[j])",
"+ result += bisect.bisect_left(l, l[i] + l[j]) - (j + 1)"
] | false | 0.117711 | 0.079107 | 1.488001 | [
"s554848832",
"s423057404"
] |
u795630164 | p03194 | python | s085909586 | s808239024 | 382 | 292 | 3,060 | 3,060 | Accepted | Accepted | 23.56 | import math
N, P = list(map(int, input().split()))
if N == 1:
print(P)
else:
for i in range(1, round(math.pow(P, 1 / N)) + 1):
if P % (i ** N) == 0:
now_max = i
print(now_max) | import math
N, P = list(map(int, input().split()))
for i in reversed(list(range(1, round(math.pow(P, 1 / N)) + 1))):
if P % (i ** N) == 0:
print(i)
break
| 12 | 7 | 225 | 175 | import math
N, P = list(map(int, input().split()))
if N == 1:
print(P)
else:
for i in range(1, round(math.pow(P, 1 / N)) + 1):
if P % (i**N) == 0:
now_max = i
print(now_max)
| import math
N, P = list(map(int, input().split()))
for i in reversed(list(range(1, round(math.pow(P, 1 / N)) + 1))):
if P % (i**N) == 0:
print(i)
break
| false | 41.666667 | [
"-if N == 1:",
"- print(P)",
"-else:",
"- for i in range(1, round(math.pow(P, 1 / N)) + 1):",
"- if P % (i**N) == 0:",
"- now_max = i",
"- print(now_max)",
"+for i in reversed(list(range(1, round(math.pow(P, 1 / N)) + 1))):",
"+ if P % (i**N) == 0:",
"+ print(i... | false | 0.047827 | 0.041633 | 1.14877 | [
"s085909586",
"s808239024"
] |
u261260430 | p02939 | python | s108717578 | s237738111 | 1,355 | 678 | 38,960 | 38,424 | Accepted | Accepted | 49.96 | import sys
stdin = sys.stdin
ni = lambda: int(ns)
ns = lambda: stdin.readline().rstrip()
na = lambda: map(int, stdin.readline().split())
from itertools import groupby
def f(x):
groups = []
for _, g in groupby(x):
groups += [list(g)]
ans = 0
flag = False
for group in groups:
n = l... | import sys
from itertools import groupby
def f(x):
groups = []
for _, g in groupby(x):
groups += [list(g)]
ans = 0
flag = False
for group in groups:
n = len(group)
if flag:
n -= 1
flag = False
if n == 0:
print(group, file=sys.stderr)
continue
c ... | 47 | 41 | 824 | 676 | import sys
stdin = sys.stdin
ni = lambda: int(ns)
ns = lambda: stdin.readline().rstrip()
na = lambda: map(int, stdin.readline().split())
from itertools import groupby
def f(x):
groups = []
for _, g in groupby(x):
groups += [list(g)]
ans = 0
flag = False
for group in groups:
n = le... | import sys
from itertools import groupby
def f(x):
groups = []
for _, g in groupby(x):
groups += [list(g)]
ans = 0
flag = False
for group in groups:
n = len(group)
if flag:
n -= 1
flag = False
if n == 0:
print(group, file=sys.stde... | false | 12.765957 | [
"-",
"-stdin = sys.stdin",
"-ni = lambda: int(ns)",
"-ns = lambda: stdin.readline().rstrip()",
"-na = lambda: map(int, stdin.readline().split())",
"- s = ns()",
"- print(max(f(s), f(s[::-1])))",
"+ s = input()",
"+ print(f(s))"
] | false | 0.040352 | 0.047149 | 0.855836 | [
"s108717578",
"s237738111"
] |
u780475861 | p03435 | python | s211849598 | s603462426 | 153 | 17 | 12,420 | 3,060 | Accepted | Accepted | 88.89 | import numpy as np
lst = [[int(i) for i in input().split()] for _ in range(3)]
arr = np.array(lst)
if len(set(arr[1,:] - arr[0,:])) == 1 and len(set(arr[2,:] - arr[0,:])) == 1:
print('Yes')
else:
print('No') | lst = [[int(i) for i in input().split()] for _ in range(3)]
lst1 = [lst[1][i] - lst[0][i] for i in range(3)]
lst2 = [lst[2][i] - lst[0][i] for i in range(3)]
if len(set(lst1)) == 1 and len(set(lst2)) == 1:
print('Yes')
else:
print('No') | 8 | 7 | 219 | 246 | import numpy as np
lst = [[int(i) for i in input().split()] for _ in range(3)]
arr = np.array(lst)
if len(set(arr[1, :] - arr[0, :])) == 1 and len(set(arr[2, :] - arr[0, :])) == 1:
print("Yes")
else:
print("No")
| lst = [[int(i) for i in input().split()] for _ in range(3)]
lst1 = [lst[1][i] - lst[0][i] for i in range(3)]
lst2 = [lst[2][i] - lst[0][i] for i in range(3)]
if len(set(lst1)) == 1 and len(set(lst2)) == 1:
print("Yes")
else:
print("No")
| false | 12.5 | [
"-import numpy as np",
"-",
"-arr = np.array(lst)",
"-if len(set(arr[1, :] - arr[0, :])) == 1 and len(set(arr[2, :] - arr[0, :])) == 1:",
"+lst1 = [lst[1][i] - lst[0][i] for i in range(3)]",
"+lst2 = [lst[2][i] - lst[0][i] for i in range(3)]",
"+if len(set(lst1)) == 1 and len(set(lst2)) == 1:"
] | false | 0.199034 | 0.036982 | 5.381982 | [
"s211849598",
"s603462426"
] |
u755116850 | p02983 | python | s071381208 | s210820262 | 44 | 39 | 3,060 | 2,940 | Accepted | Accepted | 11.36 | l, r = list(map(int, input().split()))
ans = 3000
for i in range(l, r):
for j in range(i + 1, r + 1):
if (i * j) % 2019 < ans:
ans = (i * j) % 2019
if ans == 0:
print(ans)
exit()
print(ans) | # coding: utf-8
def main():
l, r = list(map(int, input().split(" ")))
ans = 3000
for i in range(l, r):
for j in range(i+1, r+1):
candidate = (i * j) % 2019
if candidate < ans:
ans = candidate
if ans == 0:
return ... | 12 | 20 | 231 | 371 | l, r = list(map(int, input().split()))
ans = 3000
for i in range(l, r):
for j in range(i + 1, r + 1):
if (i * j) % 2019 < ans:
ans = (i * j) % 2019
if ans == 0:
print(ans)
exit()
print(ans)
| # coding: utf-8
def main():
l, r = list(map(int, input().split(" ")))
ans = 3000
for i in range(l, r):
for j in range(i + 1, r + 1):
candidate = (i * j) % 2019
if candidate < ans:
ans = candidate
if ans == 0:
return ans
return a... | false | 40 | [
"-l, r = list(map(int, input().split()))",
"-ans = 3000",
"-for i in range(l, r):",
"- for j in range(i + 1, r + 1):",
"- if (i * j) % 2019 < ans:",
"- ans = (i * j) % 2019",
"- if ans == 0:",
"- print(ans)",
"- exit()",
"-print(ans)",
"+# coding... | false | 0.034901 | 0.077479 | 0.450461 | [
"s071381208",
"s210820262"
] |
u150984829 | p02265 | python | s075708983 | s368239225 | 1,020 | 830 | 69,732 | 69,732 | Accepted | Accepted | 18.63 | import collections,sys
def s():
d=collections.deque()
eval(input())
for e in sys.stdin:
if'i'==e[0]:d.appendleft(e.split()[1])
else:
if' '==e[6]:
m=e.split()[1]
if m in d:d.remove(m)
elif len(e)%2:d.pop()
else:d.popleft()
print((*d))
if'__main__'==__name__:s()
| import collections,sys
def s():
d=collections.deque()
eval(input())
for e in sys.stdin:
if'i'==e[0]:d.appendleft(e[7:-1])
else:
if' '==e[6]:
m=e[7:-1]
if m in d:d.remove(m)
elif len(e)%2:d.pop()
else:d.popleft()
print((*d))
s()
| 14 | 14 | 291 | 258 | import collections, sys
def s():
d = collections.deque()
eval(input())
for e in sys.stdin:
if "i" == e[0]:
d.appendleft(e.split()[1])
else:
if " " == e[6]:
m = e.split()[1]
if m in d:
d.remove(m)
elif l... | import collections, sys
def s():
d = collections.deque()
eval(input())
for e in sys.stdin:
if "i" == e[0]:
d.appendleft(e[7:-1])
else:
if " " == e[6]:
m = e[7:-1]
if m in d:
d.remove(m)
elif len(e) % 2:... | false | 0 | [
"- d.appendleft(e.split()[1])",
"+ d.appendleft(e[7:-1])",
"- m = e.split()[1]",
"+ m = e[7:-1]",
"-if \"__main__\" == __name__:",
"- s()",
"+s()"
] | false | 0.040445 | 0.034859 | 1.160257 | [
"s075708983",
"s368239225"
] |
u364298541 | p02971 | python | s583065894 | s366611312 | 1,504 | 243 | 16,744 | 15,364 | Accepted | Accepted | 83.84 | A=[]
_max = 0
_max2 = 0
N=int(eval(input()))
for i in range(N):
A.append(int(eval(input())))
if _max<A[-1]:
_max2,_max=_max,A[i]
elif _max2<A[-1]:
_max2=A[i]
#_,_max2,_max=sorted([A[-1],_max2,_max])
for i in range(N):
print((_max if _max!=A[i] else _max2)) | import sys
input=sys.stdin.readline
A=[]
_max = 0
_max2 = 0
N=int(eval(input()))
for i in range(N):
a=int(eval(input()))
A.append(a)
if _max<a:
_max2=_max
_max=a
elif _max2<a:
_max2=a
for a in A:
print((_max if _max!=a else _max2))
| 14 | 19 | 292 | 283 | A = []
_max = 0
_max2 = 0
N = int(eval(input()))
for i in range(N):
A.append(int(eval(input())))
if _max < A[-1]:
_max2, _max = _max, A[i]
elif _max2 < A[-1]:
_max2 = A[i]
# _,_max2,_max=sorted([A[-1],_max2,_max])
for i in range(N):
print((_max if _max != A[i] else _max2))
| import sys
input = sys.stdin.readline
A = []
_max = 0
_max2 = 0
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
A.append(a)
if _max < a:
_max2 = _max
_max = a
elif _max2 < a:
_max2 = a
for a in A:
print((_max if _max != a else _max2))
| false | 26.315789 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- A.append(int(eval(input())))",
"- if _max < A[-1]:",
"- _max2, _max = _max, A[i]",
"- elif _max2 < A[-1]:",
"- _max2 = A[i]",
"- # _,_max2,_max=sorted([A[-1],_max2,_max])",
"-for i in range(N):",
"- print((_max if... | false | 0.038538 | 0.046239 | 0.833436 | [
"s583065894",
"s366611312"
] |
u729133443 | p03252 | python | s131784218 | s135130424 | 41 | 34 | 3,828 | 3,376 | Accepted | Accepted | 17.07 | from collections import*;C=Counter;i=lambda:C(list(C(eval(input())).values()));print(('YNeos'[i()!=i()::2])) | s,t=[sorted(x.count(i)for i in set(x)) for x in open(0)]
print(('YNeos'[s!=t::2])) | 1 | 2 | 94 | 84 | from collections import *
C = Counter
i = lambda: C(list(C(eval(input())).values()))
print(("YNeos"[i() != i() :: 2]))
| s, t = [sorted(x.count(i) for i in set(x)) for x in open(0)]
print(("YNeos"[s != t :: 2]))
| false | 50 | [
"-from collections import *",
"-",
"-C = Counter",
"-i = lambda: C(list(C(eval(input())).values()))",
"-print((\"YNeos\"[i() != i() :: 2]))",
"+s, t = [sorted(x.count(i) for i in set(x)) for x in open(0)]",
"+print((\"YNeos\"[s != t :: 2]))"
] | false | 0.098434 | 0.085844 | 1.146659 | [
"s131784218",
"s135130424"
] |
u285891772 | p02936 | python | s207402049 | s411105882 | 1,606 | 1,223 | 192,796 | 148,888 | Accepted | Accepted | 23.85 | 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... | 59 | 56 | 1,437 | 1,343 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 5.084746 | [
"-",
"-",
"-def main():",
"- N, Q = MAP()",
"- ab = [LIST() for _ in range(N - 1)]",
"- px = [LIST() for _ in range(Q)]",
"- graph = defaultdict(list)",
"- for a, b in ab:",
"- graph[a - 1].append(b - 1)",
"- graph[b - 1].append(a - 1)",
"- dic = defaultdict(int)"... | false | 0.037838 | 0.036686 | 1.031422 | [
"s207402049",
"s411105882"
] |
u347600233 | p02761 | python | s646747583 | s112633232 | 30 | 25 | 9,144 | 9,192 | Accepted | Accepted | 16.67 | n, m = map(int, input().split())
ans = [-1] * n
exist = True
for i in range(m):
s, c = map(int, input().split())
if (n != 1 and (s, c) == (1, 0)) or (ans[s - 1] != -1 and ans[s - 1] != c):
exist = False
break
else:
ans[s - 1] = c
if exist:
for i in range(n):
... | n, m = list(map(int, input().split()))
conditions = [tuple(map(int, input().split())) for j in range(m)]
exist = False
for i in range(1000):
if len(str(i)) == n and all(str(i)[s - 1] == str(c) for s, c in conditions):
ans = i
exist = True
break
print((ans if exist else -1)) | 22 | 9 | 520 | 302 | n, m = map(int, input().split())
ans = [-1] * n
exist = True
for i in range(m):
s, c = map(int, input().split())
if (n != 1 and (s, c) == (1, 0)) or (ans[s - 1] != -1 and ans[s - 1] != c):
exist = False
break
else:
ans[s - 1] = c
if exist:
for i in range(n):
if n != 1 and... | n, m = list(map(int, input().split()))
conditions = [tuple(map(int, input().split())) for j in range(m)]
exist = False
for i in range(1000):
if len(str(i)) == n and all(str(i)[s - 1] == str(c) for s, c in conditions):
ans = i
exist = True
break
print((ans if exist else -1))
| false | 59.090909 | [
"-n, m = map(int, input().split())",
"-ans = [-1] * n",
"-exist = True",
"-for i in range(m):",
"- s, c = map(int, input().split())",
"- if (n != 1 and (s, c) == (1, 0)) or (ans[s - 1] != -1 and ans[s - 1] != c):",
"- exist = False",
"+n, m = list(map(int, input().split()))",
"+conditio... | false | 0.008395 | 0.043489 | 0.193029 | [
"s646747583",
"s112633232"
] |
u002459665 | p02888 | python | s259906619 | s471473934 | 1,926 | 1,158 | 3,188 | 3,188 | Accepted | Accepted | 39.88 | N = int(eval(input()))
# L = map(int, input().split())
SL = [int(i) for i in input().split()]
SL.sort()
# SL = sorted(list(L))
# SL = L.sort()
# print('SL', SL)
import bisect
ans = 0
for i in range(N-2):
for j in range(i+1, N-1):
ab = SL[i] + SL[j]
# print(i, j)
# print(SL[i],... | import bisect
def solve():
N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
total = 0
for s in range(N-2):
for m in range(s+1, N-1):
l = bisect.bisect_left(L, L[s] + L[m], 0, N)
if l > m: total += l - m - 1
print(total)
retu... | 23 | 17 | 498 | 362 | N = int(eval(input()))
# L = map(int, input().split())
SL = [int(i) for i in input().split()]
SL.sort()
# SL = sorted(list(L))
# SL = L.sort()
# print('SL', SL)
import bisect
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
ab = SL[i] + SL[j]
# print(i, j)
# print(SL[i], SL[j])
... | import bisect
def solve():
N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
total = 0
for s in range(N - 2):
for m in range(s + 1, N - 1):
l = bisect.bisect_left(L, L[s] + L[m], 0, N)
if l > m:
total += l - m - 1
print(total)... | false | 26.086957 | [
"-N = int(eval(input()))",
"-# L = map(int, input().split())",
"-SL = [int(i) for i in input().split()]",
"-SL.sort()",
"-# SL = sorted(list(L))",
"-# SL = L.sort()",
"-# print('SL', SL)",
"-ans = 0",
"-for i in range(N - 2):",
"- for j in range(i + 1, N - 1):",
"- ab = SL[i] + SL[j]",... | false | 0.040596 | 0.036465 | 1.113278 | [
"s259906619",
"s471473934"
] |
u825027400 | p03208 | python | s245066686 | s925091375 | 257 | 235 | 8,616 | 8,616 | Accepted | Accepted | 8.56 | N, K = list(map(int, input().split()))
h_list = [None] * N
for n in range(N):
h_list[n] = int(eval(input()))
h_list = list(sorted(h_list))
min_diff = 10 ** 10
for i in range(N):
if K - 1 + i >= N:
break
diff = h_list[K - 1 + i] - h_list[i]
if diff < min_diff:
min_diff = di... | N, K = list(map(int, input().split()))
h_list = [None] * N
for n in range(N):
h_list[n] = int(eval(input()))
h_list = list(sorted(h_list))
print((min(h_list[K - 1 + i] - h_list[i] for i in range(N - K + 1)))) | 15 | 8 | 327 | 207 | N, K = list(map(int, input().split()))
h_list = [None] * N
for n in range(N):
h_list[n] = int(eval(input()))
h_list = list(sorted(h_list))
min_diff = 10**10
for i in range(N):
if K - 1 + i >= N:
break
diff = h_list[K - 1 + i] - h_list[i]
if diff < min_diff:
min_diff = diff
print(min_diff... | N, K = list(map(int, input().split()))
h_list = [None] * N
for n in range(N):
h_list[n] = int(eval(input()))
h_list = list(sorted(h_list))
print((min(h_list[K - 1 + i] - h_list[i] for i in range(N - K + 1))))
| false | 46.666667 | [
"-min_diff = 10**10",
"-for i in range(N):",
"- if K - 1 + i >= N:",
"- break",
"- diff = h_list[K - 1 + i] - h_list[i]",
"- if diff < min_diff:",
"- min_diff = diff",
"-print(min_diff)",
"+print((min(h_list[K - 1 + i] - h_list[i] for i in range(N - K + 1))))"
] | false | 0.077883 | 0.075436 | 1.032435 | [
"s245066686",
"s925091375"
] |
u024807881 | p02947 | python | s248638565 | s375418911 | 231 | 195 | 26,896 | 19,504 | Accepted | Accepted | 15.58 | from sys import stdin
readline = stdin.readline
def main():
# _, *keys = map(lambda s: ''.join(sorted(s.rstrip())), open(0))
_, *keys = [tuple(sorted(s)) for s in open(0)]
primes = {}
res = 0
for key in keys:
if key in primes:
res += primes[key]
primes[key... | from sys import stdin
readline = stdin.readline
def main():
_, *keys = [''.join(sorted(s.rstrip())) for s in open(0)]
# _, *keys = map(lambda s: tuple(sorted(s)), open(0))
primes = {}
res = 0
for key in keys:
if key in primes:
res += primes[key]
primes[key... | 19 | 19 | 436 | 436 | from sys import stdin
readline = stdin.readline
def main():
# _, *keys = map(lambda s: ''.join(sorted(s.rstrip())), open(0))
_, *keys = [tuple(sorted(s)) for s in open(0)]
primes = {}
res = 0
for key in keys:
if key in primes:
res += primes[key]
primes[key] += 1
... | from sys import stdin
readline = stdin.readline
def main():
_, *keys = ["".join(sorted(s.rstrip())) for s in open(0)]
# _, *keys = map(lambda s: tuple(sorted(s)), open(0))
primes = {}
res = 0
for key in keys:
if key in primes:
res += primes[key]
primes[key] += 1
... | false | 0 | [
"- # _, *keys = map(lambda s: ''.join(sorted(s.rstrip())), open(0))",
"- _, *keys = [tuple(sorted(s)) for s in open(0)]",
"+ _, *keys = [\"\".join(sorted(s.rstrip())) for s in open(0)]",
"+ # _, *keys = map(lambda s: tuple(sorted(s)), open(0))"
] | false | 0.035424 | 0.035502 | 0.997792 | [
"s248638565",
"s375418911"
] |
u936985471 | p03231 | python | s154932065 | s274236792 | 19 | 17 | 3,316 | 3,316 | Accepted | Accepted | 10.53 | N,M=list(map(int,input().split()))
S=eval(input())
T=eval(input())
def gcd(a,b):
if a<b:
a,b=b,a
while a%b>0:
a,b=b,a%b
return b
def lcm(a,b):
return (a//gcd(a,b))*b
length=lcm(N,M)
gapt=length//N
gaps=length//M
i=0
j=0
while i<N:
if S[i]!=T[j]:
print((-1))
break
el... | def gcd(a,b):
if a<b:
a,b=b,a
while a%b>0:
a,b=b,a%b
return b
def lcm(a,b):
return (a//gcd(a,b))*b
N,M=list(map(int,input().split()))
S=eval(input())
T=eval(input())
length=lcm(N,M)
S=S[::length//M]
T=T[::length//N]
if S==T:
print(length)
else:
print((-1))
| 28 | 21 | 353 | 280 | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
def gcd(a, b):
if a < b:
a, b = b, a
while a % b > 0:
a, b = b, a % b
return b
def lcm(a, b):
return (a // gcd(a, b)) * b
length = lcm(N, M)
gapt = length // N
gaps = length // M
i = 0
j = 0
while i < N:
... | def gcd(a, b):
if a < b:
a, b = b, a
while a % b > 0:
a, b = b, a % b
return b
def lcm(a, b):
return (a // gcd(a, b)) * b
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
length = lcm(N, M)
S = S[:: length // M]
T = T[:: length // N]
if S == T:
print(len... | false | 25 | [
"-N, M = list(map(int, input().split()))",
"-S = eval(input())",
"-T = eval(input())",
"-",
"-",
"+N, M = list(map(int, input().split()))",
"+S = eval(input())",
"+T = eval(input())",
"-gapt = length // N",
"-gaps = length // M",
"-i = 0",
"-j = 0",
"-while i < N:",
"- if S[i] != T[j]:"... | false | 0.047386 | 0.043301 | 1.094325 | [
"s154932065",
"s274236792"
] |
u493520238 | p02888 | python | s338239391 | s509437917 | 1,031 | 342 | 74,800 | 74,428 | Accepted | Accepted | 66.83 | import bisect
n = int(eval(input()))
ll = list(map(int, input().split()))
ll.sort()
ans = 0
for i in range(n-2):
e1 = ll[i]
for j in range(i+1, n-1):
e2 = ll[j]
comb = bisect.bisect_left(ll[j+1:], e1+e2)
# comb -= (j+1)
ans += max(comb,0)
print(ans)
| import bisect
n = int(eval(input()))
ll = list(map(int, input().split()))
ll.sort()
ans = 0
for i in range(n-2):
e1 = ll[i]
for j in range(i+1, n-1):
e2 = ll[j]
cnt = bisect.bisect_left(ll, e1+e2)
cnt -= (j+1)
ans += max(cnt,0)
print(ans)
| 17 | 17 | 304 | 293 | import bisect
n = int(eval(input()))
ll = list(map(int, input().split()))
ll.sort()
ans = 0
for i in range(n - 2):
e1 = ll[i]
for j in range(i + 1, n - 1):
e2 = ll[j]
comb = bisect.bisect_left(ll[j + 1 :], e1 + e2)
# comb -= (j+1)
ans += max(comb, 0)
print(ans)
| import bisect
n = int(eval(input()))
ll = list(map(int, input().split()))
ll.sort()
ans = 0
for i in range(n - 2):
e1 = ll[i]
for j in range(i + 1, n - 1):
e2 = ll[j]
cnt = bisect.bisect_left(ll, e1 + e2)
cnt -= j + 1
ans += max(cnt, 0)
print(ans)
| false | 0 | [
"- comb = bisect.bisect_left(ll[j + 1 :], e1 + e2)",
"- # comb -= (j+1)",
"- ans += max(comb, 0)",
"+ cnt = bisect.bisect_left(ll, e1 + e2)",
"+ cnt -= j + 1",
"+ ans += max(cnt, 0)"
] | false | 0.036399 | 0.034632 | 1.051039 | [
"s338239391",
"s509437917"
] |
u392319141 | p03044 | python | s066770621 | s801215163 | 663 | 518 | 45,436 | 45,544 | Accepted | Accepted | 21.87 | from collections import deque
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N - 1):
fr, to, c = map(int, input().split())
fr -= 1
to -= 1
edges[fr].append((to, c))
edges[to].append((fr, c))
depth = [-1] * N
st = deque([(0, -1, 0)]) # now, parent, dep
while st:
... | from collections import deque
import sys
input = sys.stdin.buffer.readline
N = int(input())
INF = 10**18
edges = [[] for _ in range(N)]
for _ in range(N - 1):
fr, to, w = map(int, input().split())
fr -= 1
to -= 1
edges[fr].append((to, w))
edges[to].append((fr, w))
dist = [INF] * N
... | 27 | 29 | 542 | 570 | from collections import deque
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N - 1):
fr, to, c = map(int, input().split())
fr -= 1
to -= 1
edges[fr].append((to, c))
edges[to].append((fr, c))
depth = [-1] * N
st = deque([(0, -1, 0)]) # now, parent, dep
while st:
now, parent, d =... | from collections import deque
import sys
input = sys.stdin.buffer.readline
N = int(input())
INF = 10**18
edges = [[] for _ in range(N)]
for _ in range(N - 1):
fr, to, w = map(int, input().split())
fr -= 1
to -= 1
edges[fr].append((to, w))
edges[to].append((fr, w))
dist = [INF] * N
que = deque([(0, ... | false | 6.896552 | [
"+import sys",
"+input = sys.stdin.buffer.readline",
"+INF = 10**18",
"- fr, to, c = map(int, input().split())",
"+ fr, to, w = map(int, input().split())",
"- edges[fr].append((to, c))",
"- edges[to].append((fr, c))",
"-depth = [-1] * N",
"-st = deque([(0, -1, 0)]) # now, parent, dep",
... | false | 0.041076 | 0.094125 | 0.436392 | [
"s066770621",
"s801215163"
] |
u145035045 | p04013 | python | s714637458 | s884443487 | 1,212 | 975 | 62,972 | 4,596 | Accepted | Accepted | 19.55 | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
dp[... | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
#xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
"""
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1)... | 37 | 51 | 895 | 1,187 | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
dp... | def main():
n, a = list(map(int, input().split()))
xlst = list(map(int, input().split()))
# xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""
"""
dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
... | false | 27.45098 | [
"- xlst.insert(0, 0)",
"+ # xlst.insert(0, 0)",
"- dp = [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]",
"- for i in range(n + 1):",
"- dp[i][0][0] = 1",
"- for i in range(1, n + 1):",
"- x = xlst[i]",
"- dpi = dp[i]",
"- dpi_1 = dp[i - ... | false | 0.080087 | 0.042038 | 1.905136 | [
"s714637458",
"s884443487"
] |
u060896757 | p02689 | python | s303159052 | s184402011 | 434 | 230 | 38,656 | 85,136 | Accepted | Accepted | 47 | import numpy as np
N, M = list(map(int, input().split()))
H = [int(a) for a in input().split()]
good = np.zeros(N, dtype=int)
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
if H[a] > H[b]:
good[b] += 1
elif H[a] < H[b]:
good[a] += 1
else:
... | N, M = list(map(int, input().split()))
H = [int(i) for i in input().split()]
HP = [0] * N
for _ in range(M):
A, B = list(map(int, input().split()))
A -= 1
B -= 1
if H[A] > H[B]:
HP[B] += 1
elif H[A] < H[B]:
HP[A] += 1
else:
HP[A] += 1
HP[B] += 1
pr... | 22 | 16 | 423 | 324 | import numpy as np
N, M = list(map(int, input().split()))
H = [int(a) for a in input().split()]
good = np.zeros(N, dtype=int)
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
if H[a] > H[b]:
good[b] += 1
elif H[a] < H[b]:
good[a] += 1
else:
good[a]... | N, M = list(map(int, input().split()))
H = [int(i) for i in input().split()]
HP = [0] * N
for _ in range(M):
A, B = list(map(int, input().split()))
A -= 1
B -= 1
if H[A] > H[B]:
HP[B] += 1
elif H[A] < H[B]:
HP[A] += 1
else:
HP[A] += 1
HP[B] += 1
print((HP.count(0)... | false | 27.272727 | [
"-import numpy as np",
"-",
"-H = [int(a) for a in input().split()]",
"-good = np.zeros(N, dtype=int)",
"-for i in range(M):",
"- a, b = list(map(int, input().split()))",
"- a -= 1",
"- b -= 1",
"- if H[a] > H[b]:",
"- good[b] += 1",
"- elif H[a] < H[b]:",
"- good[... | false | 0.232813 | 0.036776 | 6.330543 | [
"s303159052",
"s184402011"
] |
u227082700 | p02820 | python | s791900022 | s854864775 | 493 | 76 | 16,372 | 10,132 | Accepted | Accepted | 84.58 | n,k=list(map(int,input().split()))
r,s,p=list(map(int,input().split()))
t=eval(input())
ss=[""]*k
ans=0
for i in range(n):ss[i%k]+=t[i]
for t in ss:
m=len(t)
dp=[[0,0,0]for _ in range(m)]
#rsp
if t[0]=="r":dp[0]=[0,0,p]
elif t[0]=="s":dp[0]=[r,0,0]
else:dp[0]=[0,s,0]
for i in range(1,m):
... | n,k=list(map(int,input().split()))
r,s,p=list(map(int,input().split()))
t=eval(input())
x=list(t)
ans=0
for i in range(n):
if x[i]=="r":x[i]="p"
elif x[i]=="p":x[i]="s"
else:x[i]="r"
for i in range(k):
if x[i]=="r":ans+=r
elif x[i]=="p":ans+=p
else:ans+=s
for i in range(k,n):
if x[i]==x[i-k]... | 21 | 21 | 521 | 406 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ss = [""] * k
ans = 0
for i in range(n):
ss[i % k] += t[i]
for t in ss:
m = len(t)
dp = [[0, 0, 0] for _ in range(m)]
# rsp
if t[0] == "r":
dp[0] = [0, 0, p]
elif t[0] == "s":
dp[0]... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
x = list(t)
ans = 0
for i in range(n):
if x[i] == "r":
x[i] = "p"
elif x[i] == "p":
x[i] = "s"
else:
x[i] = "r"
for i in range(k):
if x[i] == "r":
ans += r
elif x[i] == ... | false | 0 | [
"-ss = [\"\"] * k",
"+x = list(t)",
"- ss[i % k] += t[i]",
"-for t in ss:",
"- m = len(t)",
"- dp = [[0, 0, 0] for _ in range(m)]",
"- # rsp",
"- if t[0] == \"r\":",
"- dp[0] = [0, 0, p]",
"- elif t[0] == \"s\":",
"- dp[0] = [r, 0, 0]",
"+ if x[i] == \"r\":",... | false | 0.039686 | 0.130454 | 0.304215 | [
"s791900022",
"s854864775"
] |
u459511441 | p02676 | python | s221122486 | s578497214 | 31 | 28 | 9,132 | 9,056 | Accepted | Accepted | 9.68 | K = int(eval(input()))
S = eval(input())
S_num = len(S)
if K >= S_num:
print(S)
else:
print((S[:K] + "..."))
| K = int(eval(input()))
S = eval(input())
if len(S) <= K:
print(S)
else:
print((S[0:K] + '...'))
| 9 | 7 | 113 | 97 | K = int(eval(input()))
S = eval(input())
S_num = len(S)
if K >= S_num:
print(S)
else:
print((S[:K] + "..."))
| K = int(eval(input()))
S = eval(input())
if len(S) <= K:
print(S)
else:
print((S[0:K] + "..."))
| false | 22.222222 | [
"-S_num = len(S)",
"-if K >= S_num:",
"+if len(S) <= K:",
"- print((S[:K] + \"...\"))",
"+ print((S[0:K] + \"...\"))"
] | false | 0.046523 | 0.097108 | 0.479084 | [
"s221122486",
"s578497214"
] |
u714642969 | p03164 | python | s295624091 | s409502776 | 1,004 | 482 | 307,656 | 123,116 | Accepted | Accepted | 51.99 | N,W=list(map(int,input().split()))
li=[list(map(int,input().split())) for i in range(N)]
max_n=0
for a in range(N):
max_n+=li[a][1]
dp=[[float('INF')]*(max_n+1) for i in range(N+1)]
dp[0][0]=0
for i in range(N):
for sum_v in range(max_n+1):
if sum_v >= li[i][1]:
dp[i+1][sum_v]=min(... | import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()
def main():
N,W=list(map(int,input().split()))
w,v=[0]*N,[0]*N
for i in range(N):
w[i],v[i]=list(map(int,input().split()))
dp=[[INF]*(10**5+1) for _ in range(N+1)]
dp... | 18 | 25 | 500 | 684 | N, W = list(map(int, input().split()))
li = [list(map(int, input().split())) for i in range(N)]
max_n = 0
for a in range(N):
max_n += li[a][1]
dp = [[float("INF")] * (max_n + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for sum_v in range(max_n + 1):
if sum_v >= li[i][1]:
dp[i +... | import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
def input():
return sys.stdin.readline().rstrip()
def main():
N, W = list(map(int, input().split()))
w, v = [0] * N, [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[INF] * (10**5 + 1) for... | false | 28 | [
"-N, W = list(map(int, input().split()))",
"-li = [list(map(int, input().split())) for i in range(N)]",
"-max_n = 0",
"-for a in range(N):",
"- max_n += li[a][1]",
"-dp = [[float(\"INF\")] * (max_n + 1) for i in range(N + 1)]",
"-dp[0][0] = 0",
"-for i in range(N):",
"- for sum_v in range(max_... | false | 0.037854 | 0.585433 | 0.06466 | [
"s295624091",
"s409502776"
] |
u935984175 | p02608 | python | s808838005 | s977382393 | 468 | 99 | 92,164 | 74,764 | Accepted | Accepted | 78.85 | import sys
from math import ceil
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
def solve():
N = int(rl())
ans = [0] * (N + 1)
for x in range(1, ceil(N ** 0.5) + 1):
for y in range(1, ceil(N ** 0.5) + 1):
for z in range(1, ceil(N ** 0.5) + 1):
... | import sys
from math import ceil
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
def solve():
N = int(rl())
ans = [0] * (N + 1)
for x in range(1, ceil(N ** 0.5) + 1):
for y in range(1, ceil(N ** 0.5) + 1):
tmp = x ** 2 + y ** 2 + x * y
if N <= tmp... | 22 | 25 | 512 | 584 | import sys
from math import ceil
sys.setrecursionlimit(10**7)
rl = sys.stdin.readline
def solve():
N = int(rl())
ans = [0] * (N + 1)
for x in range(1, ceil(N**0.5) + 1):
for y in range(1, ceil(N**0.5) + 1):
for z in range(1, ceil(N**0.5) + 1):
n = x**2 + y**2 + z**2 + ... | import sys
from math import ceil
sys.setrecursionlimit(10**7)
rl = sys.stdin.readline
def solve():
N = int(rl())
ans = [0] * (N + 1)
for x in range(1, ceil(N**0.5) + 1):
for y in range(1, ceil(N**0.5) + 1):
tmp = x**2 + y**2 + x * y
if N <= tmp:
break
... | false | 12 | [
"+ tmp = x**2 + y**2 + x * y",
"+ if N <= tmp:",
"+ break",
"- n = x**2 + y**2 + z**2 + x * y + y * z + z * x",
"+ n = tmp + z**2 + y * z + z * x"
] | false | 0.242669 | 0.04541 | 5.344002 | [
"s808838005",
"s977382393"
] |
u762420987 | p03106 | python | s410381395 | s133576057 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | A,B,K = list(map(int,input().split()))
count_list = []
for i in range(1,101):
if A%i==0 and B%i==0:
count_list.append(i)
print((count_list[-K]))
| A,B,K = list(map(int,input().split()))
count_list = [i for i in range(1,101) if A%i==0 and B%i==0]
print((count_list[-K]))
| 7 | 4 | 156 | 119 | A, B, K = list(map(int, input().split()))
count_list = []
for i in range(1, 101):
if A % i == 0 and B % i == 0:
count_list.append(i)
print((count_list[-K]))
| A, B, K = list(map(int, input().split()))
count_list = [i for i in range(1, 101) if A % i == 0 and B % i == 0]
print((count_list[-K]))
| false | 42.857143 | [
"-count_list = []",
"-for i in range(1, 101):",
"- if A % i == 0 and B % i == 0:",
"- count_list.append(i)",
"+count_list = [i for i in range(1, 101) if A % i == 0 and B % i == 0]"
] | false | 0.033231 | 0.032877 | 1.010775 | [
"s410381395",
"s133576057"
] |
u102126195 | p02744 | python | s524482345 | s294221160 | 818 | 378 | 51,272 | 57,176 | Accepted | Accepted | 53.79 | import copy
def make(n, data):
out = []
# print(ord(data[-1]) + 1 - ord("a"))
key = data[1]
for i in range(key + 1):
# print(key)
out.append([data[0] + chr(ord("a") + i), max(key, i + 1)])
return out
n = int(eval(input()))
ans = [["a", 1]]
for i in range(1, n):
tmp ... | def solve(n, s, mx):
# print(n, s, mx)
if n == 0:
print(s)
else:
for i in range(mx):
solve(n - 1, s + chr(ord("a") + i), max(mx, i + 2))
n = int(eval(input()))
solve(n - 1, 'a', 2) | 24 | 10 | 517 | 224 | import copy
def make(n, data):
out = []
# print(ord(data[-1]) + 1 - ord("a"))
key = data[1]
for i in range(key + 1):
# print(key)
out.append([data[0] + chr(ord("a") + i), max(key, i + 1)])
return out
n = int(eval(input()))
ans = [["a", 1]]
for i in range(1, n):
tmp = []
f... | def solve(n, s, mx):
# print(n, s, mx)
if n == 0:
print(s)
else:
for i in range(mx):
solve(n - 1, s + chr(ord("a") + i), max(mx, i + 2))
n = int(eval(input()))
solve(n - 1, "a", 2)
| false | 58.333333 | [
"-import copy",
"-",
"-",
"-def make(n, data):",
"- out = []",
"- # print(ord(data[-1]) + 1 - ord(\"a\"))",
"- key = data[1]",
"- for i in range(key + 1):",
"- # print(key)",
"- out.append([data[0] + chr(ord(\"a\") + i), max(key, i + 1)])",
"- return out",
"+def so... | false | 0.055831 | 0.085377 | 0.653934 | [
"s524482345",
"s294221160"
] |
u368796742 | p03618 | python | s841793864 | s396903904 | 581 | 102 | 24,712 | 9,252 | Accepted | Accepted | 82.44 | a = eval(input())
n = len(a)
l = [0]*(2*n-1)
i = 0
j = 0
while i < 2*n - 1:
while i >= j and i+j+1 < 2*n and a[(i-j)//2] == a[(i+j+1)//2]:
j += 1
l[i] = j
k = 1
while i + k < 2*n-1 and i >= k and l[i] >= k and l[i-k] != l[i]-k:
l[i+k] = min(l[i-k],l[i]-k)
k += 1
... | a = eval(input())
count = [0]*26
ans = 1
for i in range(len(a)):
x = ord(a[i])-ord("a")
ans += i-count[x]
count[x] += 1
print(ans)
| 27 | 9 | 516 | 146 | a = eval(input())
n = len(a)
l = [0] * (2 * n - 1)
i = 0
j = 0
while i < 2 * n - 1:
while i >= j and i + j + 1 < 2 * n and a[(i - j) // 2] == a[(i + j + 1) // 2]:
j += 1
l[i] = j
k = 1
while i + k < 2 * n - 1 and i >= k and l[i] >= k and l[i - k] != l[i] - k:
l[i + k] = min(l[i - k], l[i... | a = eval(input())
count = [0] * 26
ans = 1
for i in range(len(a)):
x = ord(a[i]) - ord("a")
ans += i - count[x]
count[x] += 1
print(ans)
| false | 66.666667 | [
"-n = len(a)",
"-l = [0] * (2 * n - 1)",
"-i = 0",
"-j = 0",
"-while i < 2 * n - 1:",
"- while i >= j and i + j + 1 < 2 * n and a[(i - j) // 2] == a[(i + j + 1) // 2]:",
"- j += 1",
"- l[i] = j",
"- k = 1",
"- while i + k < 2 * n - 1 and i >= k and l[i] >= k and l[i - k] != l[i]... | false | 0.047522 | 0.094327 | 0.503806 | [
"s841793864",
"s396903904"
] |
u218838821 | p02982 | python | s333196547 | s501541259 | 32 | 28 | 9,432 | 9,356 | Accepted | Accepted | 12.5 | N, D = list(map(int,input().split()))
X = []
ans = 0
for i in range(N):
X.append(list(map(int,input().split())))
for j in range(i):
dis = 0
for k in range(D):
dis += (X[i][k] - X[j][k])**2
if k == D-1:
if (dis) ** (1/2) - int((dis) ** (1/2)) ... | N,D = list(map(int,input().split()))
X = []
for i in range(N):
X.append(list(map(int,input().split())))
ans = 0
for i in range(N):
for j in range(i+1,N):
d = 0
for k in range(D):
d += (X[i][k] - X[j][k])**2
d = d**(1/2)
if int(d) == d:
ans +=... | 16 | 16 | 363 | 333 | N, D = list(map(int, input().split()))
X = []
ans = 0
for i in range(N):
X.append(list(map(int, input().split())))
for j in range(i):
dis = 0
for k in range(D):
dis += (X[i][k] - X[j][k]) ** 2
if k == D - 1:
if (dis) ** (1 / 2) - int((dis) ** (1 / 2)) == 0... | N, D = list(map(int, input().split()))
X = []
for i in range(N):
X.append(list(map(int, input().split())))
ans = 0
for i in range(N):
for j in range(i + 1, N):
d = 0
for k in range(D):
d += (X[i][k] - X[j][k]) ** 2
d = d ** (1 / 2)
if int(d) == d:
ans += 1... | false | 0 | [
"+for i in range(N):",
"+ X.append(list(map(int, input().split())))",
"- X.append(list(map(int, input().split())))",
"- for j in range(i):",
"- dis = 0",
"+ for j in range(i + 1, N):",
"+ d = 0",
"- dis += (X[i][k] - X[j][k]) ** 2",
"- if k == D - 1:",... | false | 0.04385 | 0.034398 | 1.274808 | [
"s333196547",
"s501541259"
] |
u024383312 | p02615 | python | s517595745 | s146402701 | 128 | 118 | 31,444 | 31,564 | Accepted | Accepted | 7.81 | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort(reverse=True)
# print(A)
ans = A[0]
for i in range(2,N):
ans += A[i//2]
print(ans) | def main():
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = A[0]
for i in range(2,N):
ans += A[i//2]
print(ans)
if __name__ == '__main__':
main()
| 8 | 15 | 152 | 276 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
# print(A)
ans = A[0]
for i in range(2, N):
ans += A[i // 2]
print(ans)
| def main():
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = A[0]
for i in range(2, N):
ans += A[i // 2]
print(ans)
if __name__ == "__main__":
main()
| false | 46.666667 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"-# print(A)",
"-ans = A[0]",
"-for i in range(2, N):",
"- ans += A[i // 2]",
"-print(ans)",
"+def main():",
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"+ N = int(eval(input()))"... | false | 0.046983 | 0.048479 | 0.969127 | [
"s517595745",
"s146402701"
] |
u268318377 | p03200 | python | s839963405 | s587951413 | 59 | 47 | 11,400 | 11,400 | Accepted | Accepted | 20.34 | S = eval(input())
N = S.count('W')
B = [b for b in range(1, N + 1) if S[b-1] == 'B']
W = [w for w in range(N+1, len(S)+1) if S[w-1] == 'W']
# assert len(B) == len(W)
ans = 0
for b, w in zip(B, W):
ans += w - b
print(ans) | S = eval(input())
N = S.count('W')
B = [b for b in range(1, N + 1) if S[b-1] == 'B']
W = [w for w in range(N+1, len(S)+1) if S[w-1] == 'W']
# assert len(B) == len(W)
print((sum(W) - sum(B))) | 12 | 8 | 232 | 191 | S = eval(input())
N = S.count("W")
B = [b for b in range(1, N + 1) if S[b - 1] == "B"]
W = [w for w in range(N + 1, len(S) + 1) if S[w - 1] == "W"]
# assert len(B) == len(W)
ans = 0
for b, w in zip(B, W):
ans += w - b
print(ans)
| S = eval(input())
N = S.count("W")
B = [b for b in range(1, N + 1) if S[b - 1] == "B"]
W = [w for w in range(N + 1, len(S) + 1) if S[w - 1] == "W"]
# assert len(B) == len(W)
print((sum(W) - sum(B)))
| false | 33.333333 | [
"-ans = 0",
"-for b, w in zip(B, W):",
"- ans += w - b",
"-print(ans)",
"+print((sum(W) - sum(B)))"
] | false | 0.036037 | 0.036008 | 1.000813 | [
"s839963405",
"s587951413"
] |
u094999522 | p03721 | python | s118107735 | s662509623 | 301 | 145 | 27,968 | 29,804 | Accepted | Accepted | 51.83 | #!/usr/bin/env python3
(n, k), *q = [[*list(map(int, i.split()))] for i in open(0)]
q.sort()
for a, b in q:
k -= b
if k <= 0:
print(a)
break
| #!/usr/bin/env python3
(n, k), *q = [[*list(map(int, i.split()))] for i in open(0)]
bucket = [0] * (10**5 + 1)
for a, b in q:
bucket[a] += b
for n, i in enumerate(bucket):
k -= i
if k <= 0:
print(n)
break
| 8 | 10 | 166 | 236 | #!/usr/bin/env python3
(n, k), *q = [[*list(map(int, i.split()))] for i in open(0)]
q.sort()
for a, b in q:
k -= b
if k <= 0:
print(a)
break
| #!/usr/bin/env python3
(n, k), *q = [[*list(map(int, i.split()))] for i in open(0)]
bucket = [0] * (10**5 + 1)
for a, b in q:
bucket[a] += b
for n, i in enumerate(bucket):
k -= i
if k <= 0:
print(n)
break
| false | 20 | [
"-q.sort()",
"+bucket = [0] * (10**5 + 1)",
"- k -= b",
"+ bucket[a] += b",
"+for n, i in enumerate(bucket):",
"+ k -= i",
"- print(a)",
"+ print(n)"
] | false | 0.041894 | 0.083017 | 0.50464 | [
"s118107735",
"s662509623"
] |
u060938295 | p03032 | python | s315387162 | s122657552 | 138 | 35 | 3,064 | 3,064 | Accepted | Accepted | 74.64 | # -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:05 2019
@author: Yamazaki Kenichi
"""
import heapq
N,K = list(map(int,input().split()))
V = list(map(int,input().split()))
def a(K):
if K > N:
return N
else:
return K
ans = 0
for i in range(K):
for j in range(a(K-... | # -*- coding: utf-8 -*-
"""
Created on Wed May 29 22:59:58 2019
@author: Yamazaki Kenichi
"""
N, K = list(map(int,input().split()))
V = list(map(int,input().split()))
ans = 0
for pickup_n in range(min(K, N)+1):
for start in range(pickup_n + 1):
tmp = [0]
for i in range(pickup_n):
... | 35 | 25 | 717 | 554 | # -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:05 2019
@author: Yamazaki Kenichi
"""
import heapq
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
def a(K):
if K > N:
return N
else:
return K
ans = 0
for i in range(K):
for j in range(a(K - i) + 1):
... | # -*- coding: utf-8 -*-
"""
Created on Wed May 29 22:59:58 2019
@author: Yamazaki Kenichi
"""
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for pickup_n in range(min(K, N) + 1):
for start in range(pickup_n + 1):
tmp = [0]
for i in range(pickup_n):
tmp... | false | 28.571429 | [
"-Created on Sun May 26 20:56:05 2019",
"+Created on Wed May 29 22:59:58 2019",
"-import heapq",
"-",
"-",
"-",
"-def a(K):",
"- if K > N:",
"- return N",
"- else:",
"- return K",
"-",
"-",
"-for i in range(K):",
"- for j in range(a(K - i) + 1):",
"- tmp =... | false | 0.067008 | 0.044923 | 1.491631 | [
"s315387162",
"s122657552"
] |
u047796752 | p02891 | python | s363104178 | s957356811 | 167 | 64 | 38,384 | 62,060 | Accepted | Accepted | 61.68 | import sys
input = sys.stdin.readline
from collections import *
S = input()[:-1]
K = int(eval(input()))
if S==S[0]*len(S):
print((len(S)*K//2))
exit()
l = []
cnt = 1
for i in range(len(S)-1):
if S[i]!=S[i+1]:
l.append((S[i], cnt))
cnt = 1
else:
cnt += 1... | S = eval(input())
K = int(eval(input()))
if S==S[0]*len(S):
print((len(S)*K//2))
exit()
rle = []
cnt = 1
for i in range(len(S)-1):
if S[i]!=S[i+1]:
rle.append((S[i], cnt))
cnt = 1
else:
cnt += 1
rle.append((S[-1], cnt))
#print(rle)
if rle[0][0]==rle[-... | 37 | 34 | 599 | 579 | import sys
input = sys.stdin.readline
from collections import *
S = input()[:-1]
K = int(eval(input()))
if S == S[0] * len(S):
print((len(S) * K // 2))
exit()
l = []
cnt = 1
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
l.append((S[i], cnt))
cnt = 1
else:
cnt += 1
l.append((... | S = eval(input())
K = int(eval(input()))
if S == S[0] * len(S):
print((len(S) * K // 2))
exit()
rle = []
cnt = 1
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
rle.append((S[i], cnt))
cnt = 1
else:
cnt += 1
rle.append((S[-1], cnt))
# print(rle)
if rle[0][0] == rle[-1][0]:
a... | false | 8.108108 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from collections import *",
"-",
"-S = input()[:-1]",
"+S = eval(input())",
"-l = []",
"+rle = []",
"- l.append((S[i], cnt))",
"+ rle.append((S[i], cnt))",
"-l.append((S[-1], cnt))",
"-if K == 1 or l[0][0] != l[-1][0]:",
"+... | false | 0.035367 | 0.035282 | 1.002428 | [
"s363104178",
"s957356811"
] |
u644907318 | p03197 | python | s479425167 | s276195868 | 521 | 151 | 50,520 | 13,036 | Accepted | Accepted | 71.02 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
cnt = 0
for i in range(N):
if A[i]%2==1:
cnt += 1
if cnt>0:
print("first")
else:
print("second") | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
flag = 0
for i in range(N):
if A[i]%2==1:
flag = 1
break
if flag==1:
print("first")
else:
print("second") | 10 | 11 | 179 | 197 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
cnt = 0
for i in range(N):
if A[i] % 2 == 1:
cnt += 1
if cnt > 0:
print("first")
else:
print("second")
| N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
flag = 0
for i in range(N):
if A[i] % 2 == 1:
flag = 1
break
if flag == 1:
print("first")
else:
print("second")
| false | 9.090909 | [
"-cnt = 0",
"+flag = 0",
"- cnt += 1",
"-if cnt > 0:",
"+ flag = 1",
"+ break",
"+if flag == 1:"
] | false | 0.044097 | 0.043426 | 1.015444 | [
"s479425167",
"s276195868"
] |
u573754721 | p02881 | python | s851288564 | s993833068 | 153 | 136 | 2,940 | 3,060 | Accepted | Accepted | 11.11 | import math
n=int(eval(input()))
num=math.ceil(math.sqrt(n))
c=n+2
for i in range(1,num+1):
if n%i==0 and (i+n//i)<c:
a=i
b=n//i
c=a+b
print((a+b-2))
| import math
n=int(eval(input()))
num=math.ceil(math.sqrt(n))
L=max([i for i in range(1,num+1) if n%i==0])
print((L+n//L-2)) | 13 | 5 | 199 | 119 | import math
n = int(eval(input()))
num = math.ceil(math.sqrt(n))
c = n + 2
for i in range(1, num + 1):
if n % i == 0 and (i + n // i) < c:
a = i
b = n // i
c = a + b
print((a + b - 2))
| import math
n = int(eval(input()))
num = math.ceil(math.sqrt(n))
L = max([i for i in range(1, num + 1) if n % i == 0])
print((L + n // L - 2))
| false | 61.538462 | [
"-c = n + 2",
"-for i in range(1, num + 1):",
"- if n % i == 0 and (i + n // i) < c:",
"- a = i",
"- b = n // i",
"- c = a + b",
"-print((a + b - 2))",
"+L = max([i for i in range(1, num + 1) if n % i == 0])",
"+print((L + n // L - 2))"
] | false | 0.096616 | 0.092769 | 1.041467 | [
"s851288564",
"s993833068"
] |
u489959379 | p02972 | python | s120614456 | s411672062 | 770 | 545 | 7,244 | 100,128 | Accepted | Accepted | 29.22 | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
b = [0] * (n + 1)
for i in reversed(list(range(1, n + 1))):
k = i
cnt = 0
while k <= n:
cnt += b[k]
k += i
if cnt % 2 != a[i]:
b[i] = 1
print((sum(b)))
for i in range(1, n + 1):
if b[i] == 1:
... | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (n + 1)
res = []
for i in reversed(list(range(1, n + 1))):
if B[i] % 2 != A[i]:
res.append... | 18 | 29 | 323 | 626 | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
b = [0] * (n + 1)
for i in reversed(list(range(1, n + 1))):
k = i
cnt = 0
while k <= n:
cnt += b[k]
k += i
if cnt % 2 != a[i]:
b[i] = 1
print((sum(b)))
for i in range(1, n + 1):
if b[i] == 1:
print(i)
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (n + 1)
res = []
for i in reversed(list(range(1, n + 1))):
if B[i] % 2 != A[i]:
res.append(i)
for ... | false | 37.931034 | [
"-n = int(eval(input()))",
"-a = [0] + list(map(int, input().split()))",
"-b = [0] * (n + 1)",
"-for i in reversed(list(range(1, n + 1))):",
"- k = i",
"- cnt = 0",
"- while k <= n:",
"- cnt += b[k]",
"- k += i",
"- if cnt % 2 != a[i]:",
"- b[i] = 1",
"-print((... | false | 0.040715 | 0.077788 | 0.523406 | [
"s120614456",
"s411672062"
] |
u647999897 | p03775 | python | s655620601 | s926467368 | 171 | 104 | 39,024 | 63,776 | Accepted | Accepted | 39.18 | from math import sqrt
def solve():
N = int(eval(input()))
mn = float('inf')
for A in range(int(sqrt(N))+1,0,-1):
if N % A == 0:
B = N // A
mn = min(f(A,B), mn)
print(mn)
def f(A,B):
return max(len(str(A)), len(str(B)))
if __name__ == '__main__':... | from math import sqrt
def solve():
N = int(eval(input()))
ans = float('inf')
for A in range(1,int(sqrt(N))+1):
if N % A == 0:
ans = min(ans, len(str(N//A)))
print(ans)
if __name__ == '__main__':
solve() | 17 | 12 | 327 | 253 | from math import sqrt
def solve():
N = int(eval(input()))
mn = float("inf")
for A in range(int(sqrt(N)) + 1, 0, -1):
if N % A == 0:
B = N // A
mn = min(f(A, B), mn)
print(mn)
def f(A, B):
return max(len(str(A)), len(str(B)))
if __name__ == "__main__":
solve(... | from math import sqrt
def solve():
N = int(eval(input()))
ans = float("inf")
for A in range(1, int(sqrt(N)) + 1):
if N % A == 0:
ans = min(ans, len(str(N // A)))
print(ans)
if __name__ == "__main__":
solve()
| false | 29.411765 | [
"- mn = float(\"inf\")",
"- for A in range(int(sqrt(N)) + 1, 0, -1):",
"+ ans = float(\"inf\")",
"+ for A in range(1, int(sqrt(N)) + 1):",
"- B = N // A",
"- mn = min(f(A, B), mn)",
"- print(mn)",
"-",
"-",
"-def f(A, B):",
"- return max(len(str(A)), len(s... | false | 0.054856 | 0.054781 | 1.001358 | [
"s655620601",
"s926467368"
] |
u425177436 | p02708 | python | s939792367 | s625319382 | 82 | 21 | 9,096 | 9,108 | Accepted | Accepted | 74.39 | n, k = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(k, n+2):
ans += i*(n-i+1) + 1
ans %= mod
print(ans) | n, k = list(map(int, input().split()))
print(((n-k+2)*(n**2-2*k**2+k*(n+2)+n+6)//6 % (10**9+7))) | 7 | 2 | 137 | 89 | n, k = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(k, n + 2):
ans += i * (n - i + 1) + 1
ans %= mod
print(ans)
| n, k = list(map(int, input().split()))
print(((n - k + 2) * (n**2 - 2 * k**2 + k * (n + 2) + n + 6) // 6 % (10**9 + 7)))
| false | 71.428571 | [
"-mod = 10**9 + 7",
"-ans = 0",
"-for i in range(k, n + 2):",
"- ans += i * (n - i + 1) + 1",
"- ans %= mod",
"-print(ans)",
"+print(((n - k + 2) * (n**2 - 2 * k**2 + k * (n + 2) + n + 6) // 6 % (10**9 + 7)))"
] | false | 0.2373 | 0.06637 | 3.575419 | [
"s939792367",
"s625319382"
] |
u616217092 | p03338 | python | s202871255 | s878735998 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | from sys import stdin
def main():
N = int(stdin.readline().rstrip())
S = stdin.readline()
result = 0
for i in range(1, N):
s1 = S[:i]
s2 = S[i:]
result = max(result, len(set(s1) & set(s2)))
print(result)
if __name__ == '__main__':
main()
| from sys import stdin
def main():
N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()
print((max([len(set(S[:i]) & set(S[i:])) for i in range(1, N)])))
if __name__ == '__main__':
main()
| 16 | 11 | 305 | 227 | from sys import stdin
def main():
N = int(stdin.readline().rstrip())
S = stdin.readline()
result = 0
for i in range(1, N):
s1 = S[:i]
s2 = S[i:]
result = max(result, len(set(s1) & set(s2)))
print(result)
if __name__ == "__main__":
main()
| from sys import stdin
def main():
N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()
print((max([len(set(S[:i]) & set(S[i:])) for i in range(1, N)])))
if __name__ == "__main__":
main()
| false | 31.25 | [
"- S = stdin.readline()",
"- result = 0",
"- for i in range(1, N):",
"- s1 = S[:i]",
"- s2 = S[i:]",
"- result = max(result, len(set(s1) & set(s2)))",
"- print(result)",
"+ S = stdin.readline().rstrip()",
"+ print((max([len(set(S[:i]) & set(S[i:])) for i in ran... | false | 0.043982 | 0.042676 | 1.030609 | [
"s202871255",
"s878735998"
] |
u208216648 | p03163 | python | s023824103 | s228028892 | 770 | 645 | 171,784 | 173,448 | Accepted | Accepted | 16.23 | n,w = list(map(int,input().split()))
weight = [0 for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
weight[i],value[i] = list(map(int,input().split()))
#dp[i][j]: i番目の品物までの中から選び、重さがj以下になる時の、価値の総和の最大値
dp = [[0 for i in range(w+1)] for j in range(n+1)]
for i in range(1,n+1):
for... | n,w = list(map(int,input().split()))
weight = [0 for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
weight[i],value[i] = list(map(int,input().split()))
#dp[i][j]: i番目の品物までの中から選び、重さがj以下になる時の、価値の総和の最大値
dp = [[0 for i in range(w+1)] for j in range(n+1)]
for i in range(n):
for j... | 17 | 18 | 508 | 504 | n, w = list(map(int, input().split()))
weight = [0 for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
weight[i], value[i] = list(map(int, input().split()))
# dp[i][j]: i番目の品物までの中から選び、重さがj以下になる時の、価値の総和の最大値
dp = [[0 for i in range(w + 1)] for j in range(n + 1)]
for i in range(1, n + 1):
for j in ... | n, w = list(map(int, input().split()))
weight = [0 for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
weight[i], value[i] = list(map(int, input().split()))
# dp[i][j]: i番目の品物までの中から選び、重さがj以下になる時の、価値の総和の最大値
dp = [[0 for i in range(w + 1)] for j in range(n + 1)]
for i in range(n):
for j in range(w... | false | 5.555556 | [
"-for i in range(1, n + 1):",
"+for i in range(n):",
"- dp[i][j] = max(dp[i][j], dp[i - 1][j])",
"- if j - weight[i - 1] >= 0:",
"- dp[i][j] = max(dp[i - 1][j - weight[i - 1]] + value[i - 1], dp[i][j])",
"+ if j - weight[i] >= 0:",
"+ dp[i + 1][j] = max(dp[i][j... | false | 0.036506 | 0.040318 | 0.905446 | [
"s023824103",
"s228028892"
] |
u952708174 | p03965 | python | s709857434 | s587447001 | 23 | 18 | 3,188 | 3,188 | Accepted | Accepted | 21.74 | def d_AtCoDeer_and_RockPaper(S):
# 解説どおり
n = len(S) # ターン数
p = 0 # 相手がパーを出した回数
for c in S:
if c == 'p':
p += 1
return n // 2 - p
S = input().strip()
print((d_AtCoDeer_and_RockPaper(S))) | def d_atcodeer_and_rock_paper(S):
return len(S) // 2 - S.count('p')
S = input().strip()
print((d_atcodeer_and_rock_paper(S))) | 11 | 5 | 236 | 132 | def d_AtCoDeer_and_RockPaper(S):
# 解説どおり
n = len(S) # ターン数
p = 0 # 相手がパーを出した回数
for c in S:
if c == "p":
p += 1
return n // 2 - p
S = input().strip()
print((d_AtCoDeer_and_RockPaper(S)))
| def d_atcodeer_and_rock_paper(S):
return len(S) // 2 - S.count("p")
S = input().strip()
print((d_atcodeer_and_rock_paper(S)))
| false | 54.545455 | [
"-def d_AtCoDeer_and_RockPaper(S):",
"- # 解説どおり",
"- n = len(S) # ターン数",
"- p = 0 # 相手がパーを出した回数",
"- for c in S:",
"- if c == \"p\":",
"- p += 1",
"- return n // 2 - p",
"+def d_atcodeer_and_rock_paper(S):",
"+ return len(S) // 2 - S.count(\"p\")",
"-print((... | false | 0.041596 | 0.046741 | 0.889938 | [
"s709857434",
"s587447001"
] |
u753803401 | p03767 | python | s629659316 | s929505337 | 358 | 297 | 107,536 | 79,088 | Accepted | Accepted | 17.04 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
a = list(map(int, input().rstrip('\n').split()))
a.sort(reverse=True)
print((sum(a[1:n*2:2])))
if __name__ == '__main__':
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
a.sort(reverse=True)
t = 0
for i in range(1, n * 2, 2):
t += a[i]
print(t)
if __name__ == '__main__':
solve()
| 11 | 17 | 249 | 312 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
a = list(map(int, input().rstrip("\n").split()))
a.sort(reverse=True)
print((sum(a[1 : n * 2 : 2])))
if __name__ == "__main__":
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = list(map(int, readline().split()))
a.sort(reverse=True)
t = 0
for i in range(1, n * 2, 2):
t += a[i]
print(t)
if __name__ == "__main__":
solve()
| false | 35.294118 | [
"-def slove():",
"- import sys",
"+import sys",
"- input = sys.stdin.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = list(map(int, input().rstrip(\"\\n\").split()))",
"+",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+ mod = 10**9 + 7",
"+ n = int(read... | false | 0.086497 | 0.040361 | 2.143096 | [
"s629659316",
"s929505337"
] |
u312025627 | p02959 | python | s218399200 | s391887286 | 297 | 270 | 82,148 | 81,892 | Accepted | Accepted | 9.09 |
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
dp_town = [0]*(n+1)
dp_town[0] = min(a[0],b[0])
b[0] = b[0] - min(a[0],b[0])
for i in range(1,n):
if b[i-1] > 0:
dp_town[i] = min(a[i],b[i-1])
a[i] -= b[i-1]
b[i-1] -= min(a[i],b[i-1])
... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
if A[i] < B[i]:
B[i] -= A[i]
ans += A[i]
if A[i+1] < B[i]:
ans += A[i+1]
A[... | 20 | 23 | 493 | 525 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp_town = [0] * (n + 1)
dp_town[0] = min(a[0], b[0])
b[0] = b[0] - min(a[0], b[0])
for i in range(1, n):
if b[i - 1] > 0:
dp_town[i] = min(a[i], b[i - 1])
a[i] -= b[i - 1]
b[i - 1] -= min(a[i], b[i... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
if A[i] < B[i]:
B[i] -= A[i]
ans += A[i]
if A[i + 1] < B[i]:
ans += A[i + 1]
A[i + 1] ... | false | 13.043478 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-dp_town = [0] * (n + 1)",
"-dp_town[0] = min(a[0], b[0])",
"-b[0] = b[0] - min(a[0], b[0])",
"-for i in range(1, n):",
"- if b[i - 1] > 0:",
"- dp_town[i] = min(a[i], b[i - 1])",
... | false | 0.006617 | 0.03574 | 0.185147 | [
"s218399200",
"s391887286"
] |
u573754721 | p02791 | python | s388309936 | s209185905 | 105 | 88 | 26,012 | 24,744 | Accepted | Accepted | 16.19 | n=int(eval(input()))
P=list(map(int,input().split()))
ans=0
pre=float('inf')
for i in range(n):
if P[i]<=pre:
ans+=1
pre=P[i]
print(ans)
| n=int(eval(input()))
P=list(map(int,input().split()))
ans=0
bef=float("inf")
for i in P:
if i<=bef:
ans+=1
bef=i
print(ans) | 11 | 9 | 191 | 145 | n = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
pre = float("inf")
for i in range(n):
if P[i] <= pre:
ans += 1
pre = P[i]
print(ans)
| n = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
bef = float("inf")
for i in P:
if i <= bef:
ans += 1
bef = i
print(ans)
| false | 18.181818 | [
"-pre = float(\"inf\")",
"-for i in range(n):",
"- if P[i] <= pre:",
"+bef = float(\"inf\")",
"+for i in P:",
"+ if i <= bef:",
"- pre = P[i]",
"+ bef = i"
] | false | 0.0352 | 0.03397 | 1.036227 | [
"s388309936",
"s209185905"
] |
u254871849 | p03266 | python | s790172247 | s222466571 | 1,010 | 17 | 238,556 | 3,060 | Accepted | Accepted | 98.32 | import sys
sys.setrecursionlimit(10**9)
nCr = {}
def comb(n, r):
if r == 0 or r == n: return 1
if r == 1: return n
if (n,r) in nCr: return nCr[(n,r)]
nCr[(n,r)] = comb(n-1,r) + comb(n-1,r-1)
return nCr[(n,r)]
def count(q):
res = 0
if q >= 1:
res += comb(q, 1) * comb(3... | import sys
n, k = list(map(int, sys.stdin.readline().split()))
def main():
res = 0
c = n // k
res += c ** 3
if k & 1:
return res
if n - k * c < k // 2:
return res * 2
else:
return res + (c + 1) ** 3
if __name__ == '__main__':
ans = main()
print... | 39 | 18 | 847 | 319 | import sys
sys.setrecursionlimit(10**9)
nCr = {}
def comb(n, r):
if r == 0 or r == n:
return 1
if r == 1:
return n
if (n, r) in nCr:
return nCr[(n, r)]
nCr[(n, r)] = comb(n - 1, r) + comb(n - 1, r - 1)
return nCr[(n, r)]
def count(q):
res = 0
if q >= 1:
r... | import sys
n, k = list(map(int, sys.stdin.readline().split()))
def main():
res = 0
c = n // k
res += c**3
if k & 1:
return res
if n - k * c < k // 2:
return res * 2
else:
return res + (c + 1) ** 3
if __name__ == "__main__":
ans = main()
print(ans)
| false | 53.846154 | [
"-",
"-sys.setrecursionlimit(10**9)",
"-nCr = {}",
"-",
"-",
"-def comb(n, r):",
"- if r == 0 or r == n:",
"- return 1",
"- if r == 1:",
"- return n",
"- if (n, r) in nCr:",
"- return nCr[(n, r)]",
"- nCr[(n, r)] = comb(n - 1, r) + comb(n - 1, r - 1)",
"- ... | false | 0.050526 | 0.037768 | 1.337791 | [
"s790172247",
"s222466571"
] |
u513081876 | p03779 | python | s932369238 | s406207405 | 35 | 27 | 2,940 | 2,940 | Accepted | Accepted | 22.86 | X = int(eval(input()))
for i in range(1, 10**6):
if X <= 0.5 * i * (i + 1):
print(i)
break | X = int(eval(input()))
ans = 0
check = 0
for i in range(1, 10**7):
ans += i
check += 1
if X <= ans:
print(check)
break | 5 | 10 | 108 | 150 | X = int(eval(input()))
for i in range(1, 10**6):
if X <= 0.5 * i * (i + 1):
print(i)
break
| X = int(eval(input()))
ans = 0
check = 0
for i in range(1, 10**7):
ans += i
check += 1
if X <= ans:
print(check)
break
| false | 50 | [
"-for i in range(1, 10**6):",
"- if X <= 0.5 * i * (i + 1):",
"- print(i)",
"+ans = 0",
"+check = 0",
"+for i in range(1, 10**7):",
"+ ans += i",
"+ check += 1",
"+ if X <= ans:",
"+ print(check)"
] | false | 0.030951 | 0.041416 | 0.747331 | [
"s932369238",
"s406207405"
] |
u729133443 | p02777 | python | s167817197 | s539653574 | 164 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.63 | s,a,u=open(0);i=u in s;print((int(a[:2])-1+i,int(a[2:])-i)) | s,a,u=open(0)
*a,=list(map(int,a.split()))
a[u in s]-=1
print((*a)) | 1 | 4 | 57 | 62 | s, a, u = open(0)
i = u in s
print((int(a[:2]) - 1 + i, int(a[2:]) - i))
| s, a, u = open(0)
(*a,) = list(map(int, a.split()))
a[u in s] -= 1
print((*a))
| false | 75 | [
"-i = u in s",
"-print((int(a[:2]) - 1 + i, int(a[2:]) - i))",
"+(*a,) = list(map(int, a.split()))",
"+a[u in s] -= 1",
"+print((*a))"
] | false | 0.042182 | 0.036235 | 1.164138 | [
"s167817197",
"s539653574"
] |
u207137484 | p02720 | python | s005867783 | s465122204 | 1,197 | 652 | 12,544 | 58,452 | Accepted | Accepted | 45.53 | import queue
n = int(eval(input()))
q = queue.Queue()
count=0
p=0
for i in range(1,10):
q.put(i)
while count!=n:
count+=1
a = q.get()
p = a
str_a = str(a)
if str_a[-1]=='0':
q.put(a*10)
q.put(a*10+1)
elif str_a[-1]=='9':
q.put(a*10+8)
q.put(a*... | import queue
k = int(eval(input()))
q = queue.Queue()
for i in range(1,10):
q.put(i)
count = 0
while count < k:
num = q.get()
num_1 = int((str(num))[-1])
if num_1 ==0:
q.put(num*10)
q.put(num*10+1)
elif num_1==9:
q.put(num*10+num_1-1)
q.put(num*10+... | 26 | 28 | 465 | 494 | import queue
n = int(eval(input()))
q = queue.Queue()
count = 0
p = 0
for i in range(1, 10):
q.put(i)
while count != n:
count += 1
a = q.get()
p = a
str_a = str(a)
if str_a[-1] == "0":
q.put(a * 10)
q.put(a * 10 + 1)
elif str_a[-1] == "9":
q.put(a * 10 + 8)
q... | import queue
k = int(eval(input()))
q = queue.Queue()
for i in range(1, 10):
q.put(i)
count = 0
while count < k:
num = q.get()
num_1 = int((str(num))[-1])
if num_1 == 0:
q.put(num * 10)
q.put(num * 10 + 1)
elif num_1 == 9:
q.put(num * 10 + num_1 - 1)
q.put(num * 10 +... | false | 7.142857 | [
"-n = int(eval(input()))",
"+k = int(eval(input()))",
"-count = 0",
"-p = 0",
"-while count != n:",
"+count = 0",
"+while count < k:",
"+ num = q.get()",
"+ num_1 = int((str(num))[-1])",
"+ if num_1 == 0:",
"+ q.put(num * 10)",
"+ q.put(num * 10 + 1)",
"+ elif num_1... | false | 0.325314 | 0.114748 | 2.835033 | [
"s005867783",
"s465122204"
] |
u078042885 | p00239 | python | s244952683 | s302110130 | 210 | 180 | 7,968 | 8,068 | Accepted | Accepted | 14.29 | while 1:
n=int(eval(input()))
if n==0:break
a=[[0]*5for _ in range(n)]
for i in range(n):
a[i][:4]=list(map(int,input().split()))
a[i][4]=4*(sum(a[i][1:4:2]))+9*a[i][2]
p,q,r,c=list(map(int,input().split()))
f=1
for i in range(n):
if a[i][1]<=p and a[i][2]<=... | while 1:
n=int(input())
if n==0:break
a=[list(map(int,input().split())) for _ in range(n)]
p,q,r,c=map(int,input().split())
b=[x[0] for x in a if x[1]<=p and x[2]<=q and x[3]<=r and 4*(x[1]+x[3])+9*x[2]<=c]
if len(b):print(*b,sep='\n')
else:print('NA')
| 12 | 8 | 374 | 287 | while 1:
n = int(eval(input()))
if n == 0:
break
a = [[0] * 5 for _ in range(n)]
for i in range(n):
a[i][:4] = list(map(int, input().split()))
a[i][4] = 4 * (sum(a[i][1:4:2])) + 9 * a[i][2]
p, q, r, c = list(map(int, input().split()))
f = 1
for i in range(n):
... | while 1:
n = int(input())
if n == 0:
break
a = [list(map(int, input().split())) for _ in range(n)]
p, q, r, c = map(int, input().split())
b = [
x[0]
for x in a
if x[1] <= p and x[2] <= q and x[3] <= r and 4 * (x[1] + x[3]) + 9 * x[2] <= c
]
if len(b):
... | false | 33.333333 | [
"- n = int(eval(input()))",
"+ n = int(input())",
"- a = [[0] * 5 for _ in range(n)]",
"- for i in range(n):",
"- a[i][:4] = list(map(int, input().split()))",
"- a[i][4] = 4 * (sum(a[i][1:4:2])) + 9 * a[i][2]",
"- p, q, r, c = list(map(int, input().split()))",
"- f = 1"... | false | 0.09561 | 0.048791 | 1.959592 | [
"s244952683",
"s302110130"
] |
u482227082 | p02397 | python | s683541689 | s030539654 | 60 | 50 | 5,608 | 5,624 | Accepted | Accepted | 16.67 | for i in range(10000):
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
break
else:
if a < b:
print((a, b))
else:
print((b, a))
#print(min(a,b), max(a,b))
| #
# 3c
#
def main():
while True:
x, y = list(map(int, input().split()))
if x == y == 0:
break
elif x > y:
print(f"{y} {x}")
else:
print(f"{x} {y}")
if __name__ == '__main__':
main()
| 10 | 17 | 234 | 271 | for i in range(10000):
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
break
else:
if a < b:
print((a, b))
else:
print((b, a))
# print(min(a,b), max(a,b))
| #
# 3c
#
def main():
while True:
x, y = list(map(int, input().split()))
if x == y == 0:
break
elif x > y:
print(f"{y} {x}")
else:
print(f"{x} {y}")
if __name__ == "__main__":
main()
| false | 41.176471 | [
"-for i in range(10000):",
"- a, b = list(map(int, input().split()))",
"- if a == 0 and b == 0:",
"- break",
"- else:",
"- if a < b:",
"- print((a, b))",
"+#",
"+# 3c",
"+#",
"+def main():",
"+ while True:",
"+ x, y = list(map(int, input().split())... | false | 0.070885 | 0.036554 | 1.939177 | [
"s683541689",
"s030539654"
] |
u604774382 | p02379 | python | s726077611 | s124834235 | 30 | 20 | 6,840 | 5,660 | Accepted | Accepted | 33.33 | import math
x1, y1, x2, y2 = [ float( i ) for i in input( ).split( " " ) ]
print(( math.sqrt( ( x1 - x2 )**2 + ( y1 - y2 )**2 ) )) | import math
x1,y1,x2,y2 = [ float( val ) for val in input().split( ' ' ) ]
distance = math.sqrt( pow(abs(x1-x2),2)+pow(abs(y1-y2),2) )
print( distance )
| 4 | 5 | 132 | 158 | import math
x1, y1, x2, y2 = [float(i) for i in input().split(" ")]
print((math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)))
| import math
x1, y1, x2, y2 = [float(val) for val in input().split(" ")]
distance = math.sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2))
print(distance)
| false | 20 | [
"-x1, y1, x2, y2 = [float(i) for i in input().split(\" \")]",
"-print((math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)))",
"+x1, y1, x2, y2 = [float(val) for val in input().split(\" \")]",
"+distance = math.sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2))",
"+print(distance)"
] | false | 0.127314 | 0.042369 | 3.004928 | [
"s726077611",
"s124834235"
] |
u201802797 | p03700 | python | s968664227 | s127554198 | 1,625 | 1,441 | 7,068 | 11,060 | Accepted | Accepted | 11.32 | import math
import io
nim, mike, kite = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(nim)]
OK = max(H)//kite+1
NG = 0
ans = OK
while OK-NG > 1:
mid = (OK+NG)//2 # 試行する値
cnt = 0
for h in H:
if h > mid*kite:
cnt += math.ceil((h-mid*kite)/(mike... | nim, mike, kite = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(nim)]
C = mike - kite
l, r = 0, 1<<30
while r - l > 1:
m = (l + r) // 2
if sum([max((h - kite * m + C - 1) // C, 0) for h in H]) <= m:
r = m
else:
l = m
print(r) | 24 | 11 | 398 | 276 | import math
import io
nim, mike, kite = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(nim)]
OK = max(H) // kite + 1
NG = 0
ans = OK
while OK - NG > 1:
mid = (OK + NG) // 2 # 試行する値
cnt = 0
for h in H:
if h > mid * kite:
cnt += math.ceil((h - mid * kite) / (mike ... | nim, mike, kite = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(nim)]
C = mike - kite
l, r = 0, 1 << 30
while r - l > 1:
m = (l + r) // 2
if sum([max((h - kite * m + C - 1) // C, 0) for h in H]) <= m:
r = m
else:
l = m
print(r)
| false | 54.166667 | [
"-import math",
"-import io",
"-",
"-OK = max(H) // kite + 1",
"-NG = 0",
"-ans = OK",
"-while OK - NG > 1:",
"- mid = (OK + NG) // 2 # 試行する値",
"- cnt = 0",
"- for h in H:",
"- if h > mid * kite:",
"- cnt += math.ceil((h - mid * kite) / (mike - kite))",
"- if c... | false | 0.14943 | 0.173747 | 0.860041 | [
"s968664227",
"s127554198"
] |
u119148115 | p02901 | python | s495892884 | s298330077 | 311 | 275 | 43,100 | 42,732 | Accepted | Accepted | 11.58 | import sys
def S(): return sys.stdin.readline().rstrip()
N,M = list(map(int,S().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(i) for i in S().split()))
C.append(sum(1<<(int(i)-1) for i in S().split()))
dp = [float('inf')]*(1<<N)
dp[0] = 0
for i in range(1<<N):
for j in ran... | import sys
def S(): return sys.stdin.readline().rstrip()
N,M = list(map(int,S().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(i) for i in S().split()))
C.append(sum(1<<(int(i)-1) for i in S().split()))
dp = [10**18]*(1<<N)
dp[0] = 0
for i in range(1<<N):
for j in range(M):... | 23 | 23 | 470 | 458 | import sys
def S():
return sys.stdin.readline().rstrip()
N, M = list(map(int, S().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(i) for i in S().split()))
C.append(sum(1 << (int(i) - 1) for i in S().split()))
dp = [float("inf")] * (1 << N)
dp[0] = 0
for i in range(1 << N):
for j in ... | import sys
def S():
return sys.stdin.readline().rstrip()
N, M = list(map(int, S().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(i) for i in S().split()))
C.append(sum(1 << (int(i) - 1) for i in S().split()))
dp = [10**18] * (1 << N)
dp[0] = 0
for i in range(1 << N):
for j in range(... | false | 0 | [
"-dp = [float(\"inf\")] * (1 << N)",
"+dp = [10**18] * (1 << N)",
"-if dp[-1] == float(\"inf\"):",
"+if dp[-1] == 10**18:"
] | false | 0.037459 | 0.037392 | 1.001782 | [
"s495892884",
"s298330077"
] |
u952708174 | p02923 | python | s576844147 | s001506194 | 70 | 60 | 14,224 | 14,252 | Accepted | Accepted | 14.29 | def c_lower():
N = int(eval(input()))
H = [int(i) for i in input().split()]
can_move = [0] * N
for i in range(N - 1):
if H[i] >= H[i + 1]:
can_move[i] = 1
cnt = 0
for i in range(N - 1, -1, -1):
if can_move[i] != 0:
cnt += 1
can_move[... | def c_lower():
N = int(eval(input()))
H = [int(i) for i in input().split()] + [float('inf')]
can_move = []
tmp = 0
for i in range(N):
if H[i] >= H[i + 1]:
tmp += 1
else:
can_move.append(tmp)
tmp = 0
return max(can_move)
print((c... | 17 | 15 | 404 | 322 | def c_lower():
N = int(eval(input()))
H = [int(i) for i in input().split()]
can_move = [0] * N
for i in range(N - 1):
if H[i] >= H[i + 1]:
can_move[i] = 1
cnt = 0
for i in range(N - 1, -1, -1):
if can_move[i] != 0:
cnt += 1
can_move[i] = cnt
... | def c_lower():
N = int(eval(input()))
H = [int(i) for i in input().split()] + [float("inf")]
can_move = []
tmp = 0
for i in range(N):
if H[i] >= H[i + 1]:
tmp += 1
else:
can_move.append(tmp)
tmp = 0
return max(can_move)
print((c_lower()))
| false | 11.764706 | [
"- H = [int(i) for i in input().split()]",
"- can_move = [0] * N",
"- for i in range(N - 1):",
"+ H = [int(i) for i in input().split()] + [float(\"inf\")]",
"+ can_move = []",
"+ tmp = 0",
"+ for i in range(N):",
"- can_move[i] = 1",
"- cnt = 0",
"- for i in r... | false | 0.036374 | 0.036147 | 1.006256 | [
"s576844147",
"s001506194"
] |
u620084012 | p03776 | python | s419348536 | s726902683 | 169 | 18 | 38,640 | 3,064 | Accepted | Accepted | 89.35 | # ABC 057 D
import math
N, A, B = list(map(int,input().split()))
v = sorted(list(map(int,input().split())))[::-1]
def nCr(n,r):
return (math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))
a = sum(v[:A])/A
print(a)
s = 0
for k in range(N):
if v[A-1] == v[k]:
s += 1
t = 0
for k ... | import math
def nCr(n,r):
return (math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))
N, A, B = list(map(int,input().split()))
v = sorted(list(map(int,input().split())), reverse = True)
print((sum(v[:A])/A))
t = v[A-1]
m, u = 0, 0
for k in range(A):
if v[k] == t:
m += 1
for k in ran... | 31 | 22 | 561 | 493 | # ABC 057 D
import math
N, A, B = list(map(int, input().split()))
v = sorted(list(map(int, input().split())))[::-1]
def nCr(n, r):
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
a = sum(v[:A]) / A
print(a)
s = 0
for k in range(N):
if v[A - 1] == v[k]:
s += 1
t = 0
for k in ... | import math
def nCr(n, r):
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
N, A, B = list(map(int, input().split()))
v = sorted(list(map(int, input().split())), reverse=True)
print((sum(v[:A]) / A))
t = v[A - 1]
m, u = 0, 0
for k in range(A):
if v[k] == t:
m += 1
for k in ran... | false | 29.032258 | [
"-# ABC 057 D",
"-",
"-N, A, B = list(map(int, input().split()))",
"-v = sorted(list(map(int, input().split())))[::-1]",
"-a = sum(v[:A]) / A",
"-print(a)",
"-s = 0",
"-for k in range(N):",
"- if v[A - 1] == v[k]:",
"- s += 1",
"-t = 0",
"+N, A, B = list(map(int, input().split()))",
... | false | 0.038504 | 0.032765 | 1.175135 | [
"s419348536",
"s726902683"
] |
u658288444 | p03447 | python | s903735601 | s459168337 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | x,a,b = [int(eval(input())) for i in range(3)]
print((x - a - b*((x-a)//b))) | x,a,b = [int(eval(input())) for i in range(3)]
print(((x-a)%b)) | 2 | 2 | 69 | 56 | x, a, b = [int(eval(input())) for i in range(3)]
print((x - a - b * ((x - a) // b)))
| x, a, b = [int(eval(input())) for i in range(3)]
print(((x - a) % b))
| false | 0 | [
"-print((x - a - b * ((x - a) // b)))",
"+print(((x - a) % b))"
] | false | 0.049009 | 0.120765 | 0.40582 | [
"s903735601",
"s459168337"
] |
u695811449 | p03251 | python | s484822660 | s433039363 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | A=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
x=max(X)
y=min(Y)
if x<y and A[2]<A[3] and A[2]<y and x<A[3]:
print("No War")
else:
print("War")
| N,M,X,Y=list(map(int,input().split()))
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x=x+[X]
y=y+[Y]
if max(x)<min(y):
print("No War")
else:
print("War") | 11 | 11 | 216 | 187 | A = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
x = max(X)
y = min(Y)
if x < y and A[2] < A[3] and A[2] < y and x < A[3]:
print("No War")
else:
print("War")
| N, M, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = x + [X]
y = y + [Y]
if max(x) < min(y):
print("No War")
else:
print("War")
| false | 0 | [
"-A = list(map(int, input().split()))",
"-X = list(map(int, input().split()))",
"-Y = list(map(int, input().split()))",
"-x = max(X)",
"-y = min(Y)",
"-if x < y and A[2] < A[3] and A[2] < y and x < A[3]:",
"+N, M, X, Y = list(map(int, input().split()))",
"+x = list(map(int, input().split()))",
"+y =... | false | 0.071709 | 0.073485 | 0.975833 | [
"s484822660",
"s433039363"
] |
u508164527 | p02831 | python | s083909595 | s189657002 | 39 | 17 | 5,304 | 2,940 | Accepted | Accepted | 56.41 | import fractions
A, B = (int(x) for x in input().split())
print((A*B//fractions.gcd(A,B))) | def gcd(a,b):
if a <= b:
a,b = b,a
if b == 0:
return a
else:
return gcd(b,a%b)
A, B = (int(x) for x in input().split())
print((A*B//gcd(A,B))) | 3 | 10 | 90 | 170 | import fractions
A, B = (int(x) for x in input().split())
print((A * B // fractions.gcd(A, B)))
| def gcd(a, b):
if a <= b:
a, b = b, a
if b == 0:
return a
else:
return gcd(b, a % b)
A, B = (int(x) for x in input().split())
print((A * B // gcd(A, B)))
| false | 70 | [
"-import fractions",
"+def gcd(a, b):",
"+ if a <= b:",
"+ a, b = b, a",
"+ if b == 0:",
"+ return a",
"+ else:",
"+ return gcd(b, a % b)",
"+",
"-print((A * B // fractions.gcd(A, B)))",
"+print((A * B // gcd(A, B)))"
] | false | 0.046723 | 0.03666 | 1.274506 | [
"s083909595",
"s189657002"
] |
u844789719 | p03822 | python | s806028219 | s812004287 | 486 | 433 | 52,660 | 52,916 | Accepted | Accepted | 10.91 | N, *A = [int(_) for _ in open(0).read().split()]
win_lose = {i: set() for i in range(1, N + 1)}
for win, lose in zip(A, list(range(2, N + 1))):
win_lose[win].add(lose)
s1 = [1]
s2 = []
while s1:
a = s1.pop()
s2 += [a]
for b in win_lose[a]:
s1 += [b]
dp = [0] * (N + 1)
for x in s2[::-... | N, *A = [int(_) for _ in open(0).read().split()]
win_lose = {i: set() for i in range(1, N + 1)}
for win, lose in zip(A, list(range(2, N + 1))):
win_lose[win].add(lose)
s1 = [1]
s2 = []
while s1:
a = s1.pop()
s2 += [a]
for b in win_lose[a]:
s1 += [b]
dp = [0] * (N + 1)
for x in s2[::-... | 19 | 20 | 509 | 515 | N, *A = [int(_) for _ in open(0).read().split()]
win_lose = {i: set() for i in range(1, N + 1)}
for win, lose in zip(A, list(range(2, N + 1))):
win_lose[win].add(lose)
s1 = [1]
s2 = []
while s1:
a = s1.pop()
s2 += [a]
for b in win_lose[a]:
s1 += [b]
dp = [0] * (N + 1)
for x in s2[::-1]:
if w... | N, *A = [int(_) for _ in open(0).read().split()]
win_lose = {i: set() for i in range(1, N + 1)}
for win, lose in zip(A, list(range(2, N + 1))):
win_lose[win].add(lose)
s1 = [1]
s2 = []
while s1:
a = s1.pop()
s2 += [a]
for b in win_lose[a]:
s1 += [b]
dp = [0] * (N + 1)
for x in s2[::-1]:
if w... | false | 5 | [
"- a + b",
"- for a, b in zip(",
"- sorted(dp[y] for y in win_lose[x])[::-1], list(range(1, N + 1))",
"- )",
"+ i + v + 1 for i, v in enumerate(sorted(dp[y] for y in win_lose[x])[::-1])"
] | false | 0.03958 | 0.040914 | 0.967404 | [
"s806028219",
"s812004287"
] |
u983918956 | p02954 | python | s646542888 | s381676002 | 179 | 148 | 6,400 | 6,400 | Accepted | Accepted | 17.32 | S = eval(input())
N = len(S)
arr = [0] * N
cnt = 0
R = 0
res = -1
for i in range(N-1):
if S[i] == "R":
R += 1
res += 1
if S[i+1] == "L":
arr[i+1] += R // 2
arr[i] += -(-R // 2)
R = 0
cnt = max(cnt, res)
res = -1
L = 0
res = -1
for... | S = eval(input())
N = len(S)
arr = [0] * N
R = 0
for i in range(N-1):
if S[i] == "R":
R += 1
if S[i+1] == "L":
arr[i+1] += R // 2
arr[i] += -(-R // 2)
R = 0
L = 0
for i in range(N-1,0,-1):
if S[i] == "L":
L += 1
if S[i-1] == "R":
ar... | 34 | 25 | 549 | 394 | S = eval(input())
N = len(S)
arr = [0] * N
cnt = 0
R = 0
res = -1
for i in range(N - 1):
if S[i] == "R":
R += 1
res += 1
if S[i + 1] == "L":
arr[i + 1] += R // 2
arr[i] += -(-R // 2)
R = 0
cnt = max(cnt, res)
res = -1
L = 0
res = -1
for i in range(N - 1, 0... | S = eval(input())
N = len(S)
arr = [0] * N
R = 0
for i in range(N - 1):
if S[i] == "R":
R += 1
if S[i + 1] == "L":
arr[i + 1] += R // 2
arr[i] += -(-R // 2)
R = 0
L = 0
for i in range(N - 1, 0, -1):
if S[i] == "L":
L += 1
if S[i - 1] == "R":
arr[i - 1] += ... | false | 26.470588 | [
"-cnt = 0",
"-res = -1",
"- res += 1",
"- cnt = max(cnt, res)",
"- res = -1",
"-res = -1",
"- res += 1",
"- cnt = max(cnt, res)",
"- res = -1"
] | false | 0.047696 | 0.042461 | 1.123295 | [
"s646542888",
"s381676002"
] |
u423585790 | p02925 | python | s669369851 | s719798164 | 1,836 | 1,036 | 35,952 | 35,952 | Accepted | Accepted | 43.57 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(... | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(... | 119 | 119 | 2,668 | 2,666 | #!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI():
return list(map(int, input().split()))
def LF... | #!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI():
return list(map(int, input().split()))
def LF... | false | 0 | [
"- if time.time() - start >= 1.8:",
"+ if time.time() - start >= 1:"
] | false | 0.037225 | 0.037077 | 1.00399 | [
"s669369851",
"s719798164"
] |
u554503378 | p02276 | python | s860096142 | s025617494 | 180 | 60 | 16,592 | 16,584 | Accepted | Accepted | 66.67 | n = int(eval(input()))
lst_n = list(map(int,input().split()))
x = lst_n[n-1]
left = []
right = []
i = -1
for j in range(0,n-1):
if lst_n[j] <= x:
i += 1
lst_n[i],lst_n[j] = lst_n[j],lst_n[i]
i += 1
lst_n[i],lst_n[n-1] = lst_n[n-1],lst_n[i]
ans = ['['+str(lst_n[k])+']' if k == i else s... | def partition(lst,start,last):
x = lst[last]
i = start
for j in range(start,last):
if lst[j] <= x:
lst[i],lst[j] = lst[j],lst[i]
i += 1
lst[i],lst[last] = lst[last],lst[i]
return i
n = int(eval(input()))
n_lst = list(map(int,input().split()))
p = partitio... | 16 | 16 | 386 | 420 | n = int(eval(input()))
lst_n = list(map(int, input().split()))
x = lst_n[n - 1]
left = []
right = []
i = -1
for j in range(0, n - 1):
if lst_n[j] <= x:
i += 1
lst_n[i], lst_n[j] = lst_n[j], lst_n[i]
i += 1
lst_n[i], lst_n[n - 1] = lst_n[n - 1], lst_n[i]
ans = [
"[" + str(lst_n[k]) + "]" if k == ... | def partition(lst, start, last):
x = lst[last]
i = start
for j in range(start, last):
if lst[j] <= x:
lst[i], lst[j] = lst[j], lst[i]
i += 1
lst[i], lst[last] = lst[last], lst[i]
return i
n = int(eval(input()))
n_lst = list(map(int, input().split()))
p = partition(n... | false | 0 | [
"+def partition(lst, start, last):",
"+ x = lst[last]",
"+ i = start",
"+ for j in range(start, last):",
"+ if lst[j] <= x:",
"+ lst[i], lst[j] = lst[j], lst[i]",
"+ i += 1",
"+ lst[i], lst[last] = lst[last], lst[i]",
"+ return i",
"+",
"+",
"-lst_n ... | false | 0.043827 | 0.037381 | 1.172434 | [
"s860096142",
"s025617494"
] |
u358254559 | p03807 | python | s329279405 | s062570222 | 113 | 93 | 84,904 | 83,236 | Accepted | Accepted | 17.7 | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for num in a:
b.append(num%2)
import collections
c = collections.Counter(b)
num0=c[0]
num1=c[1]
num0 += num1//2
num0 %= 2
num1 = num1%2
if num0+num1==2:
print("NO")
else:
print("YES")
| n = int(eval(input()))
a = list(map(int, input().split()))
if sum(a)%2==0:
print("YES")
else:
print("NO") | 20 | 7 | 276 | 110 | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for num in a:
b.append(num % 2)
import collections
c = collections.Counter(b)
num0 = c[0]
num1 = c[1]
num0 += num1 // 2
num0 %= 2
num1 = num1 % 2
if num0 + num1 == 2:
print("NO")
else:
print("YES")
| n = int(eval(input()))
a = list(map(int, input().split()))
if sum(a) % 2 == 0:
print("YES")
else:
print("NO")
| false | 65 | [
"-b = []",
"-for num in a:",
"- b.append(num % 2)",
"-import collections",
"-",
"-c = collections.Counter(b)",
"-num0 = c[0]",
"-num1 = c[1]",
"-num0 += num1 // 2",
"-num0 %= 2",
"-num1 = num1 % 2",
"-if num0 + num1 == 2:",
"+if sum(a) % 2 == 0:",
"+ print(\"YES\")",
"+else:",
"-... | false | 0.04758 | 0.109757 | 0.433509 | [
"s329279405",
"s062570222"
] |
u678167152 | p03170 | python | s297394915 | s369430178 | 575 | 68 | 3,828 | 68,032 | Accepted | Accepted | 88.17 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = ['First']*(K+1)
dp[0] = 'Second'
def solve(dp):
for i in range(1,K+1):
for j in range(N):
dp[i] = 'Second'
if dp[i-A[j]]=='Second':
dp[i] = 'First'
break
a... | def solve():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = ['Second']*(K*2)
for i in range(K):
if dp[i]!='Second':
continue
for j in range(N):
dp[i+A[j]]='First'
ans = dp[K]
return ans
print((solve())) | 15 | 12 | 358 | 270 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = ["First"] * (K + 1)
dp[0] = "Second"
def solve(dp):
for i in range(1, K + 1):
for j in range(N):
dp[i] = "Second"
if dp[i - A[j]] == "Second":
dp[i] = "First"
break
a... | def solve():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = ["Second"] * (K * 2)
for i in range(K):
if dp[i] != "Second":
continue
for j in range(N):
dp[i + A[j]] = "First"
ans = dp[K]
return ans
print((solve()))
| false | 20 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-dp = [\"First\"] * (K + 1)",
"-dp[0] = \"Second\"",
"-",
"-",
"-def solve(dp):",
"- for i in range(1, K + 1):",
"+def solve():",
"+ N, K = list(map(int, input().split()))",
"+ A = list(map(int, input().... | false | 0.041079 | 0.039403 | 1.04253 | [
"s297394915",
"s369430178"
] |
u176796545 | p03448 | python | s461330367 | s265113218 | 49 | 45 | 3,060 | 3,064 | Accepted | Accepted | 8.16 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count=0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500*i + 100*j + 50*k == X:
count += 1
print(count) | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count=0
for a in [a*500 for a in range(A + 1)]:
for j in range(B + 1):
for k in range(C + 1):
if a + 100*j + 50*k == X:
count += 1
print(count) | 11 | 11 | 249 | 261 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500 * i + 100 * j + 50 * k == X:
count += 1
print(count)
| A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count = 0
for a in [a * 500 for a in range(A + 1)]:
for j in range(B + 1):
for k in range(C + 1):
if a + 100 * j + 50 * k == X:
count += 1
print(count)
| false | 0 | [
"-for i in range(A + 1):",
"+for a in [a * 500 for a in range(A + 1)]:",
"- if 500 * i + 100 * j + 50 * k == X:",
"+ if a + 100 * j + 50 * k == X:"
] | false | 0.080958 | 0.089398 | 0.905586 | [
"s461330367",
"s265113218"
] |
u729133443 | p03860 | python | s251917852 | s057643773 | 38 | 18 | 27,756 | 2,940 | Accepted | Accepted | 52.63 | print('A%sC'%input()[8]) | print((input('A')[8]+'C')) | 1 | 1 | 26 | 24 | print("A%sC" % input()[8])
| print((input("A")[8] + "C"))
| false | 0 | [
"-print(\"A%sC\" % input()[8])",
"+print((input(\"A\")[8] + \"C\"))"
] | false | 0.038901 | 0.044818 | 0.867968 | [
"s251917852",
"s057643773"
] |
u505420467 | p03162 | python | s395960072 | s883452406 | 655 | 388 | 47,192 | 3,060 | Accepted | Accepted | 40.76 | n = int(eval(input()))
dpa, dpb, dpc = 0, 0, 0
for i in range(n):
a, b, c = list(map(int, input().split()))
dpa, dpb, dpc = max(dpb, dpc) + a, max(dpa, dpc) + b, max(dpa, dpb) + c
print((max(dpa, dpb, dpc)))
| n = int(eval(input()))
da, db, dc = 0, 0, 0
for i in range(n):
a, b, c = list(map(int, input().split()))
da, db, dc = max(db, dc) + a, max(da, dc) + b, max(da, db) + c
print((max(da, db, dc)))
| 9 | 8 | 213 | 196 | n = int(eval(input()))
dpa, dpb, dpc = 0, 0, 0
for i in range(n):
a, b, c = list(map(int, input().split()))
dpa, dpb, dpc = max(dpb, dpc) + a, max(dpa, dpc) + b, max(dpa, dpb) + c
print((max(dpa, dpb, dpc)))
| n = int(eval(input()))
da, db, dc = 0, 0, 0
for i in range(n):
a, b, c = list(map(int, input().split()))
da, db, dc = max(db, dc) + a, max(da, dc) + b, max(da, db) + c
print((max(da, db, dc)))
| false | 11.111111 | [
"-dpa, dpb, dpc = 0, 0, 0",
"+da, db, dc = 0, 0, 0",
"- dpa, dpb, dpc = max(dpb, dpc) + a, max(dpa, dpc) + b, max(dpa, dpb) + c",
"-print((max(dpa, dpb, dpc)))",
"+ da, db, dc = max(db, dc) + a, max(da, dc) + b, max(da, db) + c",
"+print((max(da, db, dc)))"
] | false | 0.055842 | 0.041887 | 1.333154 | [
"s395960072",
"s883452406"
] |
u722535636 | p03078 | python | s520349541 | s847767455 | 119 | 36 | 9,528 | 5,108 | Accepted | Accepted | 69.75 | x,y,z,k=list(map(int,input().split()))
a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]
L=[]
for i in range(x):
for j in range(y):
if (i+1)*(j+1)>k:
break
for m in range(z):
if (i+1)*(j+1)*(m+1)>k:
break
else:... | import heapq
x,y,z,t=list(map(int,input().split()))
a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]
heap=[(-a[0]-b[0]-c[0],0,0,0)]
ed=set()
for _ in range(t):
p,i,j,k=heapq.heappop(heap)
print((-p))
if i+1<x and (i+1,j,k) not in ed:
ed.add((i+1,j,k))
heapq.heappush(heap,(-... | 14 | 18 | 408 | 559 | x, y, z, k = list(map(int, input().split()))
a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]
L = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > k:
break
for m in range(z):
if (i + 1) * (j + 1) * (m + 1) > k:
... | import heapq
x, y, z, t = list(map(int, input().split()))
a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]
heap = [(-a[0] - b[0] - c[0], 0, 0, 0)]
ed = set()
for _ in range(t):
p, i, j, k = heapq.heappop(heap)
print((-p))
if i + 1 < x and (i + 1, j, k) not in ed:
... | false | 22.222222 | [
"-x, y, z, k = list(map(int, input().split()))",
"+import heapq",
"+",
"+x, y, z, t = list(map(int, input().split()))",
"-L = []",
"-for i in range(x):",
"- for j in range(y):",
"- if (i + 1) * (j + 1) > k:",
"- break",
"- for m in range(z):",
"- if (i + 1)... | false | 0.037991 | 0.047231 | 0.80436 | [
"s520349541",
"s847767455"
] |
u359358631 | p03548 | python | s328196310 | s856544209 | 71 | 64 | 61,740 | 62,660 | Accepted | Accepted | 9.86 | def main():
x, y, z = list(map(int, input().split()))
print(((x - z) // (y + z)))
if __name__ == "__main__":
main()
| def main():
x, y, z = list(map(int, input().split()))
for i in range(1, 10 ** 5 + 1):
if (z + y) * i + z > x:
print((i - 1))
exit()
if __name__ == "__main__":
main()
| 8 | 11 | 130 | 215 | def main():
x, y, z = list(map(int, input().split()))
print(((x - z) // (y + z)))
if __name__ == "__main__":
main()
| def main():
x, y, z = list(map(int, input().split()))
for i in range(1, 10**5 + 1):
if (z + y) * i + z > x:
print((i - 1))
exit()
if __name__ == "__main__":
main()
| false | 27.272727 | [
"- print(((x - z) // (y + z)))",
"+ for i in range(1, 10**5 + 1):",
"+ if (z + y) * i + z > x:",
"+ print((i - 1))",
"+ exit()"
] | false | 0.042527 | 0.095552 | 0.445066 | [
"s328196310",
"s856544209"
] |
u750990077 | p02692 | python | s674026025 | s426682925 | 220 | 203 | 100,508 | 18,876 | Accepted | Accepted | 7.73 | def main():
n, a, b, c = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(n)]
t = a+b+c
d = dict(A=a, B=b, C=c)
ans = []
if t == 0:
print("No")
return
if t == 1:
for i in range(n):
si = s[i]
if d[si[0]] == 1:
... | def main():
n, a, b, c = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(n)]
num = dict(A=a, B=b, C=c)
t = a+b+c
ans = []
if t == 0:
print("No")
return
if t == 1:
for i in range(n):
si = s[i]
if num[si[0]] ==... | 65 | 62 | 1,841 | 1,669 | def main():
n, a, b, c = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(n)]
t = a + b + c
d = dict(A=a, B=b, C=c)
ans = []
if t == 0:
print("No")
return
if t == 1:
for i in range(n):
si = s[i]
if d[si[0]] == 1:
... | def main():
n, a, b, c = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(n)]
num = dict(A=a, B=b, C=c)
t = a + b + c
ans = []
if t == 0:
print("No")
return
if t == 1:
for i in range(n):
si = s[i]
if num[si[0]] == 1:
... | false | 4.615385 | [
"+ num = dict(A=a, B=b, C=c)",
"- d = dict(A=a, B=b, C=c)",
"- if d[si[0]] == 1:",
"- d[si[0]], d[si[1]] = 0, 1",
"+ if num[si[0]] == 1:",
"+ num[si[0]] -= 1",
"+ num[si[1]] += 1",
"- elif d[si[1]] == 1:",
"- ... | false | 0.038805 | 0.038619 | 1.004829 | [
"s674026025",
"s426682925"
] |
u945181840 | p03599 | python | s589691222 | s638330659 | 845 | 407 | 110,800 | 3,064 | Accepted | Accepted | 51.83 | A, B, C, D, E, F = list(map(int, input().split()))
c = []
ans_list = []
for i in range(1, F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
if a > F:
break
for k in range((F - a) // C + 1):
for l in range((F - a) // D + ... | A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
c = 0
for i in range(1, F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
if a > F:
break
for k in range((F - a) // C + 1):
for l in range((F - a) // ... | 21 | 21 | 631 | 680 | A, B, C, D, E, F = list(map(int, input().split()))
c = []
ans_list = []
for i in range(1, F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
if a > F:
break
for k in range((F - a) // C + 1):
for l in range((F - a) // D + 1):
... | A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
c = 0
for i in range(1, F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
if a > F:
break
for k in range((F - a) // C + 1):
for l in range((F - a) // D + 1):
... | false | 0 | [
"-c = []",
"-ans_list = []",
"+ans = [100 * A, 0]",
"+c = 0",
"+ concentration = 100 * b / (a + b)",
"- c.append(100 * b / (a + b))",
"- ans_list.append([a + b, b])",
"+ if concentration > c:",
"+ c = conc... | false | 0.152725 | 0.127056 | 1.202026 | [
"s589691222",
"s638330659"
] |
u057109575 | p03575 | python | s258075127 | s217889462 | 274 | 194 | 48,112 | 41,324 | Accepted | Accepted | 29.2 | N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return
if rank... | N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
graph = [[False] * N for _ in range(N)]
for a, b in X:
graph[a - 1][b - 1] = True
graph[b - 1][a - 1] = True
def dfs(u):
visited[u] = True
for v in range(N):
if visited[v] or not graph[u... | 40 | 34 | 800 | 639 | N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return
if rank[x] < rank[y]:
... | N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
graph = [[False] * N for _ in range(N)]
for a, b in X:
graph[a - 1][b - 1] = True
graph[b - 1][a - 1] = True
def dfs(u):
visited[u] = True
for v in range(N):
if visited[v] or not graph[u][v]:
... | false | 15 | [
"+graph = [[False] * N for _ in range(N)]",
"+for a, b in X:",
"+ graph[a - 1][b - 1] = True",
"+ graph[b - 1][a - 1] = True",
"-def find(x):",
"- if par[x] == x:",
"- return x",
"- else:",
"- par[x] = find(par[x])",
"- return par[x]",
"+def dfs(u):",
"+ vis... | false | 0.036978 | 0.036931 | 1.001292 | [
"s258075127",
"s217889462"
] |
u933341648 | p02866 | python | s365529288 | s053928179 | 140 | 101 | 27,228 | 14,396 | Accepted | Accepted | 27.86 | from collections import Counter
n = int(eval(input()))
d = list(map(int, input().split()))
mod = 998244353
a = sorted(list(set(d)))
if d[0] != 0:
ans = 0
elif a[-1] != len(a)-1:
ans = 0
else:
c = sorted(Counter(d).items())
if c[0] != (0, 1):
ans = 0
else:
ans = 1
... | n = int(eval(input()))
d = list(map(int, input().split()))
mod = 998244353
a = [0] * n
for d_ in d:
a[d_] += 1
res = d[0] == 0 and a[0] == 1
pre = 1
for a_ in a:
res *= pre ** a_
res %= mod
pre = a_
print(res) | 25 | 16 | 442 | 237 | from collections import Counter
n = int(eval(input()))
d = list(map(int, input().split()))
mod = 998244353
a = sorted(list(set(d)))
if d[0] != 0:
ans = 0
elif a[-1] != len(a) - 1:
ans = 0
else:
c = sorted(Counter(d).items())
if c[0] != (0, 1):
ans = 0
else:
ans = 1
pre = 1
... | n = int(eval(input()))
d = list(map(int, input().split()))
mod = 998244353
a = [0] * n
for d_ in d:
a[d_] += 1
res = d[0] == 0 and a[0] == 1
pre = 1
for a_ in a:
res *= pre**a_
res %= mod
pre = a_
print(res)
| false | 36 | [
"-from collections import Counter",
"-",
"-a = sorted(list(set(d)))",
"-if d[0] != 0:",
"- ans = 0",
"-elif a[-1] != len(a) - 1:",
"- ans = 0",
"-else:",
"- c = sorted(Counter(d).items())",
"- if c[0] != (0, 1):",
"- ans = 0",
"- else:",
"- ans = 1",
"- ... | false | 0.04698 | 0.046697 | 1.006053 | [
"s365529288",
"s053928179"
] |
u503227287 | p02714 | python | s833413245 | s792326116 | 523 | 147 | 76,236 | 73,608 | Accepted | Accepted | 71.89 | import sys
import fractions
def in_ctrl():
_input = [_.rstrip() for _ in sys.stdin.readlines()]
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
N = int(_input[0])
S = _input[1]
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return N,S
def out_ctrl(s):
print(s)
... | from sys import stdin
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N = int(_in[0]) # type:int
S = _in[1] # type:str
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = S.count('R')*S.count('G')*S.count('B')
for i in range(N):
for j i... | 80 | 18 | 2,988 | 558 | import sys
import fractions
def in_ctrl():
_input = [_.rstrip() for _ in sys.stdin.readlines()]
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
N = int(_input[0])
S = _input[1]
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return N, S
def out_ctrl(s):
print(s)
if __name__... | from sys import stdin
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N = int(_in[0]) # type:int
S = _in[1] # type:str
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
for j in range(i + ... | false | 77.5 | [
"-import sys",
"-import fractions",
"-",
"-",
"-def in_ctrl():",
"- _input = [_.rstrip() for _ in sys.stdin.readlines()]",
"- # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv",
"- N = int(_input[0])",
"- S = _input[1]",
"- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",... | false | 0.135565 | 0.061638 | 2.199382 | [
"s833413245",
"s792326116"
] |
u597374218 | p03644 | python | s288869006 | s041793416 | 33 | 29 | 9,088 | 9,052 | Accepted | Accepted | 12.12 | N=int(eval(input()))
div=1
index=0
while div<=N:
index+=1
div=2**index
print((div//2)) | N=int(eval(input()))
div=1
while div*2<=N:
div*=2
print(div) | 7 | 5 | 92 | 62 | N = int(eval(input()))
div = 1
index = 0
while div <= N:
index += 1
div = 2**index
print((div // 2))
| N = int(eval(input()))
div = 1
while div * 2 <= N:
div *= 2
print(div)
| false | 28.571429 | [
"-index = 0",
"-while div <= N:",
"- index += 1",
"- div = 2**index",
"-print((div // 2))",
"+while div * 2 <= N:",
"+ div *= 2",
"+print(div)"
] | false | 0.047805 | 0.080122 | 0.59666 | [
"s288869006",
"s041793416"
] |
u116002573 | p02791 | python | s750294693 | s543369586 | 251 | 105 | 75,472 | 99,912 | Accepted | Accepted | 58.17 | def main():
N = int(eval(input()))
p = list(map(int, input().split()))
min_v = float('inf')
ans = 0
for i in range(N):
if p[i] <= min_v:
ans += 1
min_v = min(min_v, p[i])
return ans
if __name__ == '__main__':
print((main())) | def main():
N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
min_v = float('inf')
for i in range(N):
if P[i] <= min_v:
min_v = P[i]
ans += 1
return ans
if __name__ == '__main__':
print((main()))
| 15 | 15 | 290 | 282 | def main():
N = int(eval(input()))
p = list(map(int, input().split()))
min_v = float("inf")
ans = 0
for i in range(N):
if p[i] <= min_v:
ans += 1
min_v = min(min_v, p[i])
return ans
if __name__ == "__main__":
print((main()))
| def main():
N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
min_v = float("inf")
for i in range(N):
if P[i] <= min_v:
min_v = P[i]
ans += 1
return ans
if __name__ == "__main__":
print((main()))
| false | 0 | [
"- p = list(map(int, input().split()))",
"+ P = list(map(int, input().split()))",
"+ ans = 0",
"- ans = 0",
"- if p[i] <= min_v:",
"+ if P[i] <= min_v:",
"+ min_v = P[i]",
"- min_v = min(min_v, p[i])"
] | false | 0.033639 | 0.035592 | 0.945119 | [
"s750294693",
"s543369586"
] |
u644907318 | p02959 | python | s207252072 | s984447229 | 288 | 105 | 82,148 | 90,684 | Accepted | Accepted | 63.54 | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
cnt = 0
for i in range(N):
cnt += min(A[i],B[i])
a = A[i]
A[i] = max(a-B[i],0)
B[i] = max(B[i]-a,0)
cnt += min(A[i+1],B[i])
A[i+1] = max(A[i+1]-B[i],0)
print(cnt) | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
tot = 0
c = 0
for i in range(N):
a = A[i]
b = B[i]
if a>=c:
a -= c
tot += c
if a>=b:
tot += b
c = 0
else:
tot += a
c = ... | 12 | 23 | 284 | 400 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for i in range(N):
cnt += min(A[i], B[i])
a = A[i]
A[i] = max(a - B[i], 0)
B[i] = max(B[i] - a, 0)
cnt += min(A[i + 1], B[i])
A[i + 1] = max(A[i + 1] - B[i], 0)
print(cnt)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
tot = 0
c = 0
for i in range(N):
a = A[i]
b = B[i]
if a >= c:
a -= c
tot += c
if a >= b:
tot += b
c = 0
else:
tot += a
c = b - a
... | false | 47.826087 | [
"-cnt = 0",
"+tot = 0",
"+c = 0",
"- cnt += min(A[i], B[i])",
"- A[i] = max(a - B[i], 0)",
"- B[i] = max(B[i] - a, 0)",
"- cnt += min(A[i + 1], B[i])",
"- A[i + 1] = max(A[i + 1] - B[i], 0)",
"-print(cnt)",
"+ b = B[i]",
"+ if a >= c:",
"+ a -= c",
"+ tot +... | false | 0.079653 | 0.044972 | 1.771196 | [
"s207252072",
"s984447229"
] |
u163703551 | p03645 | python | s814521105 | s313262017 | 965 | 880 | 27,464 | 27,448 | Accepted | Accepted | 8.81 | import sys
from collections import Counter
# sys.stdin = open('c1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
n, m = read_int_l... | import sys
from collections import Counter
# sys.stdin = open('c1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
def solve():
... | 36 | 40 | 526 | 605 | import sys
from collections import Counter
# sys.stdin = open('c1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
n, m = read_int_list()
c = Counter()
for ... | import sys
from collections import Counter
# sys.stdin = open('c1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
def solve():
n, m = read_int_list()
... | false | 10 | [
"-n, m = read_int_list()",
"-c = Counter()",
"-for i in range(m):",
"- a, b = read_int_list()",
"- if a == 1:",
"- c[b] += 1",
"- if b == n:",
"- c[a] += 1",
"-res = \"IMPOSSIBLE\"",
"-if 2 in list(c.values()):",
"- res = \"POSSIBLE\"",
"+def solve():",
"+ n, m =... | false | 0.076787 | 0.042964 | 1.787253 | [
"s814521105",
"s313262017"
] |
u333945892 | p03545 | python | s335686830 | s673714887 | 30 | 17 | 4,212 | 3,060 | Accepted | Accepted | 43.33 | from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())
li = list(map(int,list(eval(input()))))
f... |
import itertools
nn = eval(input())
for ss in itertools.product(["+", "-"], repeat=3):
tmp = "".join([s1 + s2 for (s1, s2) in zip(nn, ss)]) + nn[-1]
if eval(tmp) == 7:
print((tmp + "=7"))
exit()
| 31 | 9 | 665 | 221 | from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inpl():
return list(map(int, input().split()))
def inpl_s():
return list(input().split())
li = list(map(int, list(eval(i... | import itertools
nn = eval(input())
for ss in itertools.product(["+", "-"], repeat=3):
tmp = "".join([s1 + s2 for (s1, s2) in zip(nn, ss)]) + nn[-1]
if eval(tmp) == 7:
print((tmp + "=7"))
exit()
| false | 70.967742 | [
"-from collections import defaultdict",
"-import sys, heapq, bisect, math, itertools, string, queue, datetime",
"+import itertools",
"-sys.setrecursionlimit(10**8)",
"-INF = float(\"inf\")",
"-mod = 10**9 + 7",
"-eps = 10**-7",
"-",
"-",
"-def inpl():",
"- return list(map(int, input().split()... | false | 0.100606 | 0.038176 | 2.635339 | [
"s335686830",
"s673714887"
] |
u367130284 | p03059 | python | s949810121 | s952369321 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | a,b,t=list(map(int,input().split()))
t+=0.5
print((int(t//a*b))) | a,b,t=list(map(int,input().split()));print((int(t//a*b)))
| 3 | 1 | 58 | 50 | a, b, t = list(map(int, input().split()))
t += 0.5
print((int(t // a * b)))
| a, b, t = list(map(int, input().split()))
print((int(t // a * b)))
| false | 66.666667 | [
"-t += 0.5"
] | false | 0.04515 | 0.129445 | 0.348796 | [
"s949810121",
"s952369321"
] |
u765590009 | p02953 | python | s516278418 | s429524548 | 81 | 72 | 20,548 | 20,416 | Accepted | Accepted | 11.11 | n = int(eval(input()))
hn = [int(num) for num in input().split()]
max_num = 0
for i in range(n):
if hn[i] < max_num - 1 :
print("No")
exit()
max_num = max(max_num, hn[i])
print("Yes") | n = int(eval(input()))
hn = [int(num) for num in input().split()]
for i in range(n-1,0,-1):
if hn[i-1] > hn[i]:
hn[i-1] -= 1
if hn[i-1] > hn[i]:
print("No")
exit()
print("Yes") | 10 | 11 | 212 | 216 | n = int(eval(input()))
hn = [int(num) for num in input().split()]
max_num = 0
for i in range(n):
if hn[i] < max_num - 1:
print("No")
exit()
max_num = max(max_num, hn[i])
print("Yes")
| n = int(eval(input()))
hn = [int(num) for num in input().split()]
for i in range(n - 1, 0, -1):
if hn[i - 1] > hn[i]:
hn[i - 1] -= 1
if hn[i - 1] > hn[i]:
print("No")
exit()
print("Yes")
| false | 9.090909 | [
"-max_num = 0",
"-for i in range(n):",
"- if hn[i] < max_num - 1:",
"- print(\"No\")",
"- exit()",
"- max_num = max(max_num, hn[i])",
"+for i in range(n - 1, 0, -1):",
"+ if hn[i - 1] > hn[i]:",
"+ hn[i - 1] -= 1",
"+ if hn[i - 1] > hn[i]:",
"+ pri... | false | 0.044012 | 0.036334 | 1.211325 | [
"s516278418",
"s429524548"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.