Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def f():
    N, M = map(int, input().split(" "))
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            
            return -1
        S[s] = min([S.get(s, 10000), c])

    min_digit = min(S.keys())
    if S[min_digit] == 0:
        if min_digit == 0:
            return 0
        else:
            return -1

    l = []
    for i in range(N):
        if i < min_digit:
            default = 1
        else:
            default = 0
        l.append(str(S.get(i + 1, default)))

    return "".join(l)

print(f())

Fixed submission:
def f():
    N, M = map(int, input().split(" "))
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            return -1
        S[s] = min([S.get(s, 10000), c])

    l = []
    for i in range(1000):
        str_i = str(i)
        if len(str_i) != N:
            continue

        flag = all([
            int(str_i[k - 1]) == v
            for k, v in S.items()
        ])
    
        if flag:
            l.append(i)

    if not l:
        return -1
    
    return min(l)

print(f())

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))

def f():
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            
            return -1
        S[s] = min([S.get(s, 10000), c])

    digit = max(S.keys())

    if S[digit] == 0:
        return -1

    N = []
    for i in range(digit):
        N.append(str(S.get(i + 1, 0)))

    return "".join(N)

print(f())

Fixed submission:
def f():
    N, M = map(int, input().split(" "))
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            return -1
        S[s] = min([S.get(s, 10000), c])

    l = []
    for i in range(1000):
        str_i = str(i)
        if len(str_i) != N:
            continue

        flag = all([
            int(str_i[k - 1]) == v
            for k, v in S.items()
        ])
    
        if flag:
            l.append(i)

    if not l:
        return -1
    
    return min(l)

print(f())
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(" "))))

M = np.zeros((100, A.shape[0]))

for i in range(100):
    M[i, :] = A - (i + 1)

t = M * M


t1 = np.sum(t, axis=1)


print(int(np.min(t1)))

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(" "))))

M = np.zeros((100, A.shape[0]))

for i in range(100):
    M[i, :] = A - (i + 1)

t = M * M


t1 = np.sum(t, axis=1)


print(int(np.min(t1)))
Buggy python submission (verdict: Runtime Error):
from math import log2

H = int(input())

print(sum(
    2 ** i
    for i in range(int(log2(H)) + 1)
))

Fixed submission:
from math import log

H = int(input())

print(sum(
    2 ** i
    for i in range(int(log(H, 2)) + 1)
))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split(" "))

P = []
S = []

clear = 0

q = {}
c = []

for i in range(M):
    sss = input().split(" ")
    p = int(sss[0])
    s = sss[1]
    P.append(p)
    S.append(s)

    if p not in c:
        if s == "AC":
            clear += 1
            c.append(p)

        if s == "WA":
            q[p] = q.get(p, 0) + 1

warng = 0
for k, v in q.items():
    if k in c:
        warng += v

print("{} {}".format(clear, warng))

Fixed submission:
N, M = map(int, input().split(" "))

P = []
S = []

clear = 0

q = {}
c = set()

for i in range(M):
    sss = input().split(" ")
    p = int(sss[0])
    s = sss[1]
    P.append(p)
    S.append(s)

    if p not in c:
        if s == "AC":
            clear += 1
            c.add(p)

        if s == "WA":
            q[p] = q.get(p, 0) + 1

warng = sum([
    q[k]
    for k in c
    if k in q
])

print("{} {}".format(clear, warng))
Buggy python submission (verdict: Runtime Error):
import sys
from functools import reduce
import itertools


input = sys.stdin.readline

N = int(input())
P = tuple(map(int, input().split(" ")))
Q = tuple(map(int, input().split(" ")))


res = list(filter(lambda t: t[1] == P or t[1] == Q, enumerate(itertools.permutations(range(1, N + 1)))))

print(abs(res[0][0] - res[1][0]))

Fixed submission:
import sys
from functools import reduce
import itertools


input = sys.stdin.readline

N = int(input())
P = tuple(map(int, input().split(" ")))
Q = tuple(map(int, input().split(" ")))

if (P == Q):
    print(0)
else:
    res = list(filter(lambda t: t[1] == P or t[1] == Q, enumerate(itertools.permutations(range(1, N + 1)))))

    print(abs(res[0][0] - res[1][0]))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
print(t + s)

Fixed submission:
[s, t] = input().split(" ")
print(t + s)
Buggy python submission (verdict: Runtime Error):
import math

def lcm (x, y):
    return (x * y) // math.gcd(x, y)

a, b = map(int, input().split())

print (lcm(a,b))

Fixed submission:
from fractions import gcd

def lcm (x, y):
    return (x * y) // gcd(x, y)

a, b = map(int, input().split())

print (lcm(a,b))

Buggy python submission (verdict: Runtime Error):
import math

def lcm (x, y):
    return (x * y) // math.gcd(x, y)

a, b = map(int, input().split())

print (lcm(a,b))

Fixed submission:
from fractions import gcd

def lcm (x, y):
    return (x * y) // gcd(x, y)

a, b = map(int, input().split())

print (lcm(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = list(map(int, input().split()))

pos = 1
ans = 0
leng = len(alist)
while(len(alist) > 0 and pos <= len(alist)):
    if (pos != alist[pos-1]):
        del(alist[pos-1])        
        ans += 1
        continue
    else:
        pos += 1

if (leng == ans):
    print("-1")
else:  
    print (ans)


Fixed submission:
n = int(input())
alist = list(map(int, input().split()))

pos = 1
ans = 0
leng = len(alist)
while(leng >= pos+ans):
    if (pos != alist[pos-1+ans]):
        ans += 1
    else:
        pos += 1

if (leng == ans):
    print("-1")
else:  
    print (ans)
Buggy python submission (verdict: Runtime Error):
P, Q, R = map(int, input().split())
abc = P+Q
acb = P+R
cab = R+Q

ans = 10000
ans = min(ans, abc)
ans = min(ans, acb)
ans = min(ans, dca)
print(ans)


Fixed submission:
P, Q, R = map(int, input().split())
abc = P+Q
acb = P+R
cab = R+Q

ans = 10000
ans = min(ans, abc)
ans = min(ans, acb)
ans = min(ans, cab)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = {}
for i in range(n):
  p = input()
  if p in s:
    s[p] += 1
  else:
    s[p] = 1

l = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

l.sort()

for i in l:
  print(i)

Fixed submission:
n = int(input())
s = {}
m = 1
for i in range(n):
  p = input()
  if p in s:
    s[p] += 1
    if m < s[p]:
      m = s[p]
  else:
    s[p] = 1

l = [kv[0] for kv in s.items() if kv[1] == m]

l.sort()

for i in l:
  print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

b = [0] * max(a)
d = 'YES'

for i in range(n):
  b[a[i]-1] += 1

if max(b) > 1:
  d = 'NO'

print(d)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

b = set(a)

if len(a) == len(b):
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

d = 'YES'

for i in range(n):
  if a[i:].count(a[i]) > 1:
    d = 'NO'
    break

print(d)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

b = set(a)

if len(a) == len(b):
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

d = 'YES'

for i in range(n):
  if a.count(a[i]) > 1:
    d = 'NO'
    break

print(d)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

b = set(a)

if len(a) == len(b):
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

i = 0
r = 0

while i<len(a):
    if a[i] == i+1:
        i += 1
    else:
        a.pop(i)

if len(a) == 0:
    print(-1)
else:
    print(n-len(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

i = 0

for j in range(n):
    if a[j] == j+1-i:
        continue
    else:
        i += 1

if i == n:
    print(-1)
else:
    print(i)
Buggy python submission (verdict: Runtime Error):
a1, a2, a3 = int(input().split())

if (a1 + a2 + a3 <= 21):
    print('win')
else:
    print('bust')

Fixed submission:
a1, a2, a3 = map(int, input().split())

if (a1 + a2 + a3 <= 21):
    print('win')
else:
    print('bust')
Buggy python submission (verdict: Runtime Error):
i = int(input())

print(N**3)

Fixed submission:
N = int(input())

print(N**3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
B = list(int,map(input().split()))

res = B[0]
for i in range(1,N-1):
	res += min(B[i],B[i-1])
res += B[N-2]

print(res)

Fixed submission:
N = int(input())
B = list(map(int,input().split()))

res = B[0]
for i in range(1,N-1):
	res += min(B[i],B[i-1])
res += B[N-2]

print(res)
Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]

cnt = 0

for a in range(1,N+1):
    for b in range(1,N+1):
        if (a+b) % K !=0:
            continue
        else:
            for c in range(1,N+1):
                if (a+c) % K !=0 || (b+c) % K !=0:
                    continue
                cnt = cnt+1

print(cnt)

Fixed submission:
k = int(input())
q = k // 2
m = k %  2

k_odd  = q + m
k_even = q

ans = k_odd * k_even
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = [int(i) for i in input().split()]

n_max = max(list)
n_min = min(list)

print(n_max - n_min)

Fixed submission:
n = int(input())
mod = n%2
if mod==0:
    dst = n
else:
    dst = n*2

print(dst)
Buggy python submission (verdict: Runtime Error):
N = int(input)
S = input()

d = S.replace('()','')

l = d.count('(')
r = d.count(')')

z = '('*l + d + ')'*r

print(z)

Fixed submission:
N = int(input())
S = input()

d = S
while d.count('()')!=0:
	d = d.replace('()','')

l = d.count('(')
r = d.count(')')

z = '('*r + S + ')'*l

print(z)
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())

print(N // 2 + N % 2)

Fixed submission:
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
  
n = I()

print(n // 2 + n % 2)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = list(map(int, input().split()))

b_counter = 0
total = 0
count = 0
color = "test"


while total < n:
  count += 1
  if (count % 2) == 1: #blue
    color="B"
    b_counter += a
    total += a
  else: #red
    color = "R"
    total += b
    
if color == "B":
  b_counter = b_counter - (total - n)
  print(b_counter)
else:
  print(b_counter)

Fixed submission:
n,a,b = list(map(int, input().split()))

if (a+b) == 0:
  print(0)
else:
  trial_num = n // (a + b)
  amari = n % (a + b)
  
  if a == 0:
    print(0)
  else:
    if a <= amari:
      print(trial_num*a + a)
    else:
      print(trial_num*a + amari)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

counter = 0

for i in range(n):
  if i == 0:
    counter += 1
  else:
    Min = min(p[:i+1])
  
    if Min == p[i]:
      counter += 1
    else:
      pass
  
print(counter)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))

counter = 0
Min = p[0]

for i in range(n):
  if i == 0:
    counter += 1
  else:
    if p[i] <= Min:
      counter += 1
      Min = p[i]
  
print(counter)
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce
import math

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int, input().split()))

saikou = lcm_list(a)
ans = 0

for i in a:
  b = saikou / i
  ans += b
  
print(int(ans) % 1000000007)

Fixed submission:
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int, input().split()))

saikou = lcm_list(a)
ans = 0

for i in a:
  b = saikou // i
  ans += b
  
print(int(ans) % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int, input().split()))
x = []
for i in range(m):
  x.append(list(map(str,input().split())))
  
qu = []
count = 0
AC,WA = 0,0
for i in x:
  qu.append(i[0])
  

qu_set = list(set(qu))
for i in qu_set:
  x_target = [j for j in x if j[0] == i]
  
  #ACがあるかどうか、あった場合そのインデックス
  if [i,"AC"] in x:
    index = x_target.index([i,"AC"])
    WA += index
    AC += 1
  else:
    pass
  
print(AC, WA)

Fixed submission:
n,m = list(map(int, input().split()))

ac = [0]*n
wa = [0]*(n+1)
pena = 0

for i in range(m):
  ques, state = input().split()
  ques = int(ques)-1
  
  if (state=="AC") and (ac[ques]==0):
    ac[ques] = 1
    pena += wa[ques]
  elif (state=="WA") and (ac[ques]==0):
    wa[ques] += 1
    
print(sum(ac), pena)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int, input().split()))
x = []
for i in range(m):
  x.append(list(map(str,input().split())))
  
qu = []
AC,WA = 0,0
for i in x:
  qu.append(i[0])

qu = list(set(qu))
for i in qu:
  x_target = [j for j in x if j[0] == i]
  
  #ACがあるかどうか、あった場合そのインデックス
  if [i,"AC"] in x:
    index = x_target.index([i,"AC"])
    WA += index
    AC += 1
  else:
    pass
  
print(AC, WA)

Fixed submission:
n,m = list(map(int, input().split()))

ac = [0]*n
wa = [0]*(n+1)
pena = 0

for i in range(m):
  ques, state = input().split()
  ques = int(ques)-1
  
  if (state=="AC") and (ac[ques]==0):
    ac[ques] = 1
    pena += wa[ques]
  elif (state=="WA") and (ac[ques]==0):
    wa[ques] += 1
    
print(sum(ac), pena)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int, input().split()))

x = []
for i in range(m):
  x.append(list(map(str,input().split())))
  
qu,ju = [],[]
AC,WA = 0,0
for i in x:
  qu.append(i[0])
  ju.append(i[1])

qu = list(set(qu))
for i in qu:
  x_target = [j for j in x if j[0] == i]
  
  #ACがあるかどうか、あった場合そのインデックス
  if [i,"AC"] in x_target:
    index = x_target.index([i,"AC"])
    WA += index
    AC += 1
  else:
    pass
  
print(AC, WA)

Fixed submission:
n,m = list(map(int, input().split()))

ac = [0]*n
wa = [0]*(n+1)
pena = 0

for i in range(m):
  ques, state = input().split()
  ques = int(ques)-1
  
  if (state=="AC") and (ac[ques]==0):
    ac[ques] = 1
    pena += wa[ques]
  elif (state=="WA") and (ac[ques]==0):
    wa[ques] += 1
    
print(sum(ac), pena)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools

N = int(input())

X = []
for i in range(N):
  X.append(list(map(int,input().split())))

pattern = list(itertools.permutations(X))
dist_sum = 0

for i in pattern:
  for j in range(N-1):
    a = np.array(i[j])
    b = np.array(i[j+1])
    dist = np.linalg.norm(a-b)
    dist_sum += dist

#平均計算
dist_avr = dist_sum / len(pattern)
print(dist_avr)

Fixed submission:
import numpy as np
import math
import itertools

N = int(input())

X = []
for i in range(N):
  X.append(list(map(int,input().split())))

pattern = list(itertools.combinations(X, 2))
pattern2 = list(itertools.permutations(X))
dist_list = []

for i in pattern:
  a = np.array(i[0])
  b = np.array(i[1])
  dist_list.append(np.linalg.norm(a-b))
  
#係数求める
kaijou = math.factorial(N)
nC2 = len(pattern2)

k = (kaijou * (N-1)) / nC2

print(sum(dist_list)*k / len(pattern))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = K - Q
for i in range(1, N+1):
  correct_num = len(np.where(A==i)[0])
  fin_point = points + correct_num
  
  if fin_point > 0:
    print("Yes")
  else:
    print("No")  

Fixed submission:
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K-Q)

for i in range(0, Q):
  points[A[i]-1] += 1
 
for i in points:
  if i > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = K - Q
for i in range(1, N+1):
  correct_num = len(np.where(A==i)[0])
  fin_point = points[i-1] + correct_num
  
  if fin_point > 0:
    print("Yes")
  else:
    print("No")  

Fixed submission:
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K-Q)

for i in range(0, Q):
  points[A[i]-1] += 1
 
for i in points:
  if i > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K) - Q

correct_num = []
for i in range(1, N+1):
  correct_num = len(np.where(A==i)[0])
  fin_point = points[i-1] + correct_num
  
  if fin_point > 0:
    print("Yes")
  else:
    print("No")  

Fixed submission:
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K-Q)

for i in range(0, Q):
  points[A[i]-1] += 1
 
for i in points:
  if i > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K) - Q

correct_num = []
for i in range(1, N+1):
  correct_num.append(len(np.where(A==i)[0]))

correct_num = np.array(correct_num)
fin_points = points + correct_num

ans = np.where(fin_points > 0, "Yes", "No")

for i in ans:
  print(i)
  

Fixed submission:
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K-Q)

for i in range(0, Q):
  points[A[i]-1] += 1
 
for i in points:
  if i > 0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))

pos = 0
steps = 0
max_step = 0
fin = False

while fin == False:
  if h[pos] >= h[pos+1]:
    steps += 1
  else:
    steps=0
    
  pos += 1
  if steps > max_step:
    max_step = steps
   
  if pos == n-1:
    fin = True

print(max_step)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))

pos = 0
steps = 0
max_step = 0
fin = False

if len(h) == 1:
  print(0)
else:
  while fin == False:
    if h[pos] >= h[pos+1]:
      steps += 1
    else:
      steps=0

    pos += 1
    if steps > max_step:
      max_step = steps

    if pos == n-1:
      fin = True

  print(max_step)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import itertools

n = int(input())
x = []
for i in range(n):
  x.append(sorted(input()))
  
x_sort = sorted(x)
ans = 0

counter = Counter(map(tuple, x_sort))
for word, cnt in counter.most_common():
  ans += len(list(itertools.combinations(list(range(cnt)), 2)))
  
print(ans)

Fixed submission:
from collections import Counter
import itertools

n = int(input())
x = []
for i in range(n):
  x.append(sorted(input()))
  
x_sort = sorted(x)
ans = 0

counter = Counter(map(tuple, x_sort))
for word, cnt in counter.most_common():
  ans += (cnt*(cnt-1))//2
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())

ans1 = []
ans2 = []
while len(ans1) <= N:
    for i in range(A):
        ans1.append("b")
    for i in range(B):    
        ans1.append("r")
for i in range(N):
    if ans1[i] == "b":
        ans2.append(ans1[i])
print(len(ans2))

Fixed submission:
N,A,B = map(int,input().split())

C = N // (A + B)
D = N % (A + B)
ans = A * C

if D >= A:
    ans += A
else:
    ans += D
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
 
N,M = map(int,input().split())
s = []
c = []
if M >= 1:
    for i in range (M):
        s,c = map(int,input().split())
        s.append(s)
        c.append(c)
    
    for i in range(M):
        if s[i] == 1 and c[i] == 0:
            print("-1")
            sys.exit()
a = zip(s, c)
a.sort()
s, c = zip(*a)
s = list(s)
c = list(c)
    if M >= 2:
        for i in range(1,M):
            if s[i - 1] == s[i] and c[i - 1] != c[i]:
                print("-1")
                sys.exit()
        if s[M - 1] == s[M] and c[M - 1] != c[M]:
            print("-1")
            sys.exit()
    for i in range(M):
        cc = [0] * N
        cc[s[i] - 1] = c[i]
    for i in range(min(s[i])):
        cc[i] = 1
    print(cc)
if M == 0:
    cc = [0] * N
    cc[0] = 1
    print(cc)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print("{}".format(int(N / 2)))
else:
    print("{}".format(int((N + 1) / 2)))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))

maximum = 0
for i in range(N - K + 1):
    ans = sum(p[j] for j in range(i,i + K))
    if ans >= maximum:
        maximum = ans
maximum = (maximum + K) / 2
print(maximum)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
summ = sum(p[i] for i in range(K))
sum_list = [summ]
maximum = 0

for i in range(N - K):
    summ += p[i + K] - p[i]
    sum_list.append(summ)

maximum = max(sum_list)

print("{}".format((maximum + K) / 2))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))

maximum = 0
for i in range(N - K + 1):
    ans = 0
    for j in range(K):
        ans += (p[i + j] + 1) / 2
    if ans >= maximum:
        maximum = ans
print(maximum)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
summ = sum(p[i] for i in range(K))
sum_list = [summ]
maximum = 0

for i in range(N - K):
    summ += p[i + K] - p[i]
    sum_list.append(summ)

maximum = max(sum_list)

print("{}".format((maximum + K) / 2))
Buggy python submission (verdict: Runtime Error):
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]

a,b = map(int,input().split())

ia = a//(0.08)
la = int(ia*0.08)
while la==a:
    ia += 1
    la = int(ia*0.08)
ia -= 1
lla =int(ia)

ia = a//0.08)
la = int(ia*0.08)
while la==a:
    ia -= 1
    la = int(ia*0.08)
ia = int(ia)+1

ib = b//(0.1)
lb = int(ib*0.1)
while lb==b:
    ib += 1
    lb = int(ib*0.1)
ib -= 1
llb = int(ib)

ib = b//(0.1)
lb = int(ib*0.1)
while lb==b:
    ib -= 1
    lb = int(ib*0.1)
ib = int(ib)+1

sa = set(range(ia,lla+1))
sb = set(range(ib,llb+1))
ans = sa & sb
print(min(ans) if ans else -1)

Fixed submission:
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]

a,b = map(int,input().split())

at = []
for i in range(1,1500):
    if int(i*0.08)==a: at += [i]

bt = []
for i in range(1,1500):
    if int(i*0.1)==b: bt += [i]

ans = set(at) & set(bt)

print(min(ans) if ans else -1)