Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
for i in range(len(s)):
    if s[i] != t[i]:
        s = s.translate(str.maketrans({s[i]:t[i],t[i]:s[i]}))
if s == t:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
t = input()
l = [0]*26
flag = 0
for i in range(len(s)):
    if l[ord(s[i])-ord("a")] == 0:
        if t[i] not in l:
            l[ord(s[i])-ord("a")] = t[i]
        else:
            flag = 1
            break
    else:
        if l[ord(s[i])-ord("a")] != t[i]:
            flag = 1
            break
if flag == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import fractions
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Fixed submission:
import fractions
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Buggy python submission (verdict: Runtime Error):
import math
from fractions import gcd
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Fixed submission:
import fractions
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Buggy python submission (verdict: Runtime Error):
import math
from fractions import gcd
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(gcd,l))

Fixed submission:
import fractions
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(math.gcd,l))

Fixed submission:
import fractions
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
X = list(map(int,input().split()))
m = float("inf")
for i in range(N-K+1):
    if X[i] > 0:
        d = X[i+K-1]
    elif X[i+K-1] < 0:
        bgd = -X[i]
    else:
        d = X[i+K-1]-X[i]+min(-X[i],X[i+K-1])
    m = min(m,d)
print(m)

Fixed submission:
N,K = map(int,input().split())
X = list(map(int,input().split()))
m = 2*(abs(X[-1])+abs(X[0]))
for i in range(N-K+1):
    if X[i] > 0:
        d = X[i+K-1]
    elif X[i+K-1] < 0:
        d = -X[i]
    else:
        d = X[i+K-1]-X[i]+min(-X[i],X[i+K-1])
    m = min(m,d)
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
X_all = list(map(int,input().split()))
m = float("inf")
for i in range(N-K+1):
    X = X_all[i:i+K]
    if X[0] > 0:
        d = X[-1]
    elif X[-1] < 0:
        d = -X[0]
    else:
        d = X[-1]-X[0]+min(-X[0],X[-1])
    m = min(m,d)
print(m)

Fixed submission:
N,K = map(int,input().split())
X = list(map(int,input().split()))
m = 2*(abs(X[-1])+abs(X[0]))
for i in range(N-K+1):
    if X[i] > 0:
        d = X[i+K-1]
    elif X[i+K-1] < 0:
        d = -X[i]
    else:
        d = X[i+K-1]-X[i]+min(-X[i],X[i+K-1])
    m = min(m,d)
print(m)
Buggy python submission (verdict: Runtime Error):
N = int(input())
base = ""
d = 0
while N != 0:
    if N%2 == 0:
        base += "0"
        N = N//2
    else:
        base += "1"
        if d%2 == 0:
            N = (N-1)//2
        else:
            N = (N+1)//2
    d += 1
print(int(base[::-1]))

Fixed submission:
N = int(input())
base = ""
d = 0
if N == 0:
    print(0)
else:
    while N != 0:
        if N%2 == 0:
            base += "0"
            N = N//2
        else:
            base += "1"
            if d%2 == 0:
                N = (N-1)//2
            else:
                N = (N+1)//2
        d += 1
    print(int(base[::-1]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = N-1
for i in range(N):
    ans = min(ans,S[:i].count("W")+S[i+1:].count("E"))
print(ans)

Fixed submission:
N = int(input())
S = input()
left = [0]
for i in range(N):
    if S[i] == "W":
        left.append(left[-1]+1)
    else:
        left.append(left[-1])
right = [0]
for i in range(N):
    if S[-i-1] == "E":
        right.append(right[-1]+1)
    else:
        right.append(right[-1])
ans = N-1
for i in range(N):
    ans = min(ans,left[i]+right[N-i-1])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n%500 > A:
    print("No")
else:
    print("Yes")

Fixed submission:
n = int(input())
a = int(input())
if n%500 > a:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n,y = map(int,input().split())
s,t,u = -1,-1,-1
for i in range(y//10000+1):
    for j in range((y-i*10000)//5000+1):
        if (y-i*10000-j*5000)%1000 == 0 and i+j+(y-i*10000-j*5000)/1000 == n:
            s,t,u = i,j,int((y-i*10000-j*5000)/1000)
print(s,t,u)

Fixed submission:
n,y = map(int,input().split())
s,t,u = -1,-1,-1
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j) == y:
            s,t,u = i,j,n-i-j
print(s,t,u)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
l = []
ans = 0
for x in a:
    if x not in l:
        num = a.count(x)
        if num > x:
            ans += num-x
        if num < x:
            ans += num
        l.append(x)
print(ans)

Fixed submission:
import collections
N = int(input())
a = list(map(int,input().split()))
l = collections.Counter(a)
ans = 0
for x in l:
    if l[x] > x:
        ans += l[x]-x
    if l[x] < x:
        ans += l[x]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
    L = L0 + L1
    L0,L1 = L1,L
print(L)

Fixed submission:
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
    L = L0 + L1
    L0,L1 = L1,L
if N == 1:
    print(1)
else:
    print(L)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for i in range(N):
    count_A = len([0 for j in range(N) if A[j] < B[i]])
    count_C = len([0 for j in range(N) if C[j] > B[i]])
    ans += count_A*count_C
print(ans)

Fixed submission:
import bisect

N = int(input())
A = sorted(list(map(int,input().split())))
B = list(map(int,input().split()))
C = sorted(list(map(int,input().split())))
ans = 0
for x in B:
    ai = bisect.bisect_left(A,x)
    ci = bisect.bisect_right(C,x)
    ans += (ai*(N-ci))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,100000):
    cnt =0
    for x in a:
        if abs(i-x) <= 1:
            cnt += 1
    ans = max(ans,cnt)
print(ans)

Fixed submission:
import collections
N = int(input())
a = list(map(int,input().split()))
dic = collections.Counter(a)
ans = 0
for i in range(min(a),max(a)+1):
    cnt = dic[i-1]+dic[i]+dic[i+1]
    ans = max(ans,cnt)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
boat = [list(map(int,input().split())) for _ in range(M)]
flag = 0
for i in range(2,N):
    if [1,i] in boat and [i,N] in boat:
        flag = 1
print("IMPOSSIBLE" if flag == 0 else "POSSIBLE")

Fixed submission:
n,m=map(int,input().split())
A=set()
B=set()
for i in range(m):
  a,b=input().split()
  if a=="1":
    A.add(b)
  if b==str(n):
    B.add(a)
print("POSSIBLE" if A&B else "IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()
que = [A[0]]
for i in range(1,N):
    if i%2 == 0:
        que.append(A[i])
    else:
        que.insert(0,A[i])
if N%2 == 1:
    que = que[::-1]
for i in range(N):
    print(que[i],end = " ")

Fixed submission:
from collections import deque
N = int(input())
A = input().split()
que = deque([A[0]])
for i in range(1,N):
    if i%2 == 0:
        que.append(A[i])
    else:
        que.appendleft(A[i])
if N%2 == 1:
    que.reverse()
for i in range(N):
    print(que[i],end = " ")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N = int(input())
A = deque([])
for _ in range(N):
    A.append(int(input())-1)
b = 0
cnt = 0
pushed = deque([0])
while b != 1:
    cnt += 1
    b = A[b]
    if b in pushed:
        print(-1)
        break
    pushed.append(b)
else:
    print(cnt)

Fixed submission:
from collections import deque
N = int(input())
A = deque([])
for _ in range(N):
    A.append(int(input())-1)
b = 0
cnt = 0
for i in range(N):
    cnt += 1
    b = A[b]
    if b == 1:
        print(cnt)
        break
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input())-1)
b = 0
cnt = 0
pushed = [0]
while b != 1:
    cnt += 1
    b = A[b]
    if b in pushed:
        print(-1)
        break
    pushed.append(b)
else:
    print(cnt)

Fixed submission:
from collections import deque
N = int(input())
A = deque([])
for _ in range(N):
    A.append(int(input())-1)
b = 0
cnt = 0
for i in range(N):
    cnt += 1
    b = A[b]
    if b == 1:
        print(cnt)
        break
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [int(input()) for _ in range(N)]
ans = 0
for i in range(1<<N):
    total = 0
    for j in range(N):
        if (i>>j)&1:
            total += s[j]
    if total%10 != 0:
        ans = max(ans,total)
print(ans)

Fixed submission:
N = int(input())
s = [int(input()) for _ in range(N)]
t = [x for x in s if x%10 != 0]
total = sum(s)
if total%10 != 0:
    print(total)
else:
    if len(t) == 0:
        print(0)
    else:
        print(total-min(t))
Buggy python submission (verdict: Runtime Error):
import math
A,B,C = map(int,input().split())
if C%math.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")

Fixed submission:
import fractions
A,B,C = map(int,input().split())
if C%fractions.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
import math
A,B,C = map(int,input().split())
if C%math.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")

Fixed submission:
import fractions
A,B,C = map(int,input().split())
if C%fractions.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N  =int(input())
p = 1
for i in range(1,N+1):
    p = p*i
print(p%(10**9+7))

Fixed submission:
N  =int(input())
p = 1
for i in range(1,N+1):
    p = p*i
    p = p%(10**9+7)
print(p%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
count = 0
for x in range(k+1):
    for y in range(x,k+1):
        for z in range(y,k+1):
            if x+y+z == s:
                if x == y and y == z:
                    count += 1
                elif x == y or y == z or x == z:
                    count += 3
                else:
                    count += 6
print(count)

Fixed submission:
k,s = map(int,input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if z <= k and 0 <= z:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                count += 1
print(count)

Fixed submission:
k,s = map(int,input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if z <= k and 0 <= z:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
c = input()
if c in ["a","i","u","e","o"]:
    print("vowel")
else:
    print(consonant)

Fixed submission:
c = input()
if c in ["a","i","u","e","o"]:
    print("vowel")
else:
    print("consonant")
Buggy python submission (verdict: Time Limit Exceeded):
input_num = int(input())
line = input().split(" ")
output = 1
zero_flg = False
for i in range(input_num):
    if int(line[i]) == 0:
        zero_flg = True
        break
    output = output * int(line[i])
    
if zero_flg:
    print("0")
elif output > 10 ** 18:
    print("-1")
else:
    print(output)

Fixed submission:
input_num = int(input())
line = input().split(" ")
over_flg = False
if ("0" in line):
    print("0")
else:
    output = 1
    for i in range(input_num):
        output = output * int(line[i])
        if output > 10 ** 18:
            over_flg = True
            break
    if over_flg:
        print("-1")
    else:
        print(output)
Buggy python submission (verdict: Time Limit Exceeded):
keihin = int(input())

keihin_list = []
for i in range(keihin):
    now_keihin = input()
    if now_keihin not in keihin_list:
        keihin_list.append(now_keihin)

print(len(keihin_list))

Fixed submission:
keihin = int(input())

keihin_list = []
for i in range(keihin):
    keihin_list.append(input())

print(len(set(keihin_list)))
Buggy python submission (verdict: Runtime Error):
input_list = input().split(" ")
syoumi = int(input_list[0])
mae = int(input_list[1])
eat = int(input_list[2])
if eat < mae:
  print("delicious")
else if (eat - mae) < syoumi:
  print("safe")
else:
  print("dangerous")

Fixed submission:
input_list = input().split(" ")
syoumi = int(input_list[0])
mae = int(input_list[1])
eat = int(input_list[2])
if eat <= mae:
  print("delicious")
elif (eat - mae) <= syoumi:
  print("safe")
else:
  print("dangerous")
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
y=[10**18]
f=0
for i in range (10**18):
    x=a-b
    if x<0:
        y.append(x*(-1))
        a=x*(-1)
    else :
        y.append(x)
        a=x
    if y[i]<=y[i+1]:
        f=y[i]
        break

print(f)

Fixed submission:
a,b,c=input().split()
print(c+" "+a+" "+b)
Buggy python submission (verdict: Runtime Error):
X=input()
L=X[::-1]
if N % 2 == 1:
    if L==X:
        N=len(X)
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya and LYb == Yb:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Fixed submission:
X=input()
L=X[::-1]
N=len(X)
if N % 2 == 1:
    if L==X:
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya and LYb == Yb:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
P = set(list(map(int, input().split())))

targets = set(range(1, 101)) - P
print(min([(target, abs(X - target)) for target in targets], key=lambda x: x[1])[0])


Fixed submission:
X, N = map(int, input().split())
P = set(list(map(int, input().split())))

targets = set(range(-101, 102)) - P
if targets:
    print(min([(target, abs(X - target)) for target in targets], key=lambda x: x[1])[0])
else:
    print(X)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul

N = int(input())
A = reduce(mul, map(int, input().split()))
if A > 10 ** 18:
    print(-1)
else:

    print(A)


Fixed submission:
from math import log10

N = int(input())
A = list(map(int, input().split()))
s = 1
threshold = 10**18
if 0 in A:
    print(0)
else:
    for a in A:
        s *= a
        if s > threshold:
            print(-1)
            break
    else:
        print(s)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

N, M = map(int, input().split())
Hs = list(map(int, input().split()))
ABs = []
for _ in range(M):
    ABs.append(tuple(map(int, input().split())))

ans = 0
edges = defaultdict(list)
for u, v in ABs:
    if u > v:
        u, v = v, u
    if v not in edges[u]:
        edges[u].append(v)
        edges[v].append(u)

for e, neighbors in edges.items():
    heights = [Hs[neighbor - 1] for neighbor in neighbors]
    is_good = all(list(map(lambda x: Hs[e - 1] > x, heights)))
    if is_good:
        ans += 1

print(ans + len(set(range(1, N + 1)) - set(edges.keys())))


Fixed submission:
from collections import defaultdict

N, M = map(int, input().split())
Hs = list(map(int, input().split()))
ABs = []
for _ in range(M):
    ABs.append(tuple(map(int, input().split())))

ans = 0
edges = defaultdict(list)
for u, v in ABs:
    if u > v:
        u, v = v, u
    if v not in edges[u]:
        edges[u].append(v)
        edges[v].append(u)

for e, neighbors in edges.items():
    heights = [Hs[neighbor - 1] for neighbor in neighbors]
    is_good = all(list(map(lambda x: Hs[e - 1] > x, heights)))
    if is_good:
        ans += 1

print(ans + len(set(range(1, N + 1)) - set(edges.keys())))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter


def choose(n: int) -> int:
    if n < 2:
        return 0
    else:
        return (n * (n - 1)) // 2


N = int(input())
A = list(map(int, input().split()))
for k in range(N):
    c = Counter(A[:k] + A[k + 1:])

    print(sum(map(choose, c.values())))


Fixed submission:
from collections import Counter


def choose(n: int) -> int:
    if n < 2:
        return 0
    else:
        return (n * (n - 1)) // 2


N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
d = {key: choose(value) for key, value in c.items()}
if len(d) > 1:
    sum_d = sum(d.values())
    for a in A:
        print(sum_d - d[a] + choose(c[a] - 1))
else:
    ans = choose(N - 1)
    for _ in range(N):
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from math import factorial


def choose(n: int) -> int:
    if n < 2:
        return 0
    else:
        return factorial(n) // (2 * factorial(n - 2))


N = int(input())
A = list(map(int, input().split()))
for k in range(N):
    c = Counter(A[:k] + A[k + 1:])

    print(sum(map(choose, c.values())))


Fixed submission:
from collections import Counter


def choose(n: int) -> int:
    if n < 2:
        return 0
    else:
        return (n * (n - 1)) // 2


N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
d = {key: choose(value) for key, value in c.items()}
if len(d) > 1:
    sum_d = sum(d.values())
    for a in A:
        print(sum_d - d[a] + choose(c[a] - 1))
else:
    ans = choose(N - 1)
    for _ in range(N):
        print(ans)
Buggy python submission (verdict: Runtime Error):
from math import sqrt

a, b, c = map(int, input().split())
A = sqrt(c) - (sqrt(a) + sqrt(b))
B = 0.0

if abs(A - B) <= max(1e-09 * max(abs(A), abs(B)), 0.0):

    print("Yes")
else:
    print("No")


Fixed submission:
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(A[K - 1])
Buggy python submission (verdict: Runtime Error):
from math import sqrt, isclose

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

if isclose(sqrt(c) - (sqrt(a) + sqrt(b)), 0):
    print("Yes")
else:
    print("No")


Fixed submission:
from math import sqrt
from decimal import Decimal, getcontext

a, b, c = map(int, input().split())
if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

N, K = map(int, input().split())
P = list(map(int, input().split()))


@lru_cache(maxsize=None)
def calc_exp(n: int):
    return (n + 1) / 2


len_sum = -1
max_len = None
for i in range(N):
    if len(P[i:i + K]) == K:
        l = sum(P[i:i + K])
        if l > len_sum:
            max_len = P[i:i + K]
            len_sum = sum(max_len)

print(sum(map(calc_exp, max_len)))


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = list(map(lambda x: (x + 1) / 2, P))

s = sum(P[:K])
ans = [s]
for prev_a, next_a in zip(P, P[K:]):
    s -= prev_a
    s += next_a
    ans.append(s)
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

N, K = map(int, input().split())
P = list(map(int, input().split()))


@lru_cache(maxsize=None)
def calc_exp(n: int):
    return sum(range(1, n + 1)) / n


len_sum = -1
max_len = None
for i in range(len(P)):
    if len(P[i:i + K]) == K:
        l = sum(P[i:i + K])
        if l > len_sum:
            max_len = P[i:i + K]
            len_sum = sum(max_len)

print(sum(map(calc_exp, max_len)))


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = list(map(lambda x: (x + 1) / 2, P))

s = sum(P[:K])
ans = [s]
for prev_a, next_a in zip(P, P[K:]):
    s -= prev_a
    s += next_a
    ans.append(s)
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

N, K = map(int, input().split())
P = list(map(int, input().split()))


@lru_cache(maxsize=None)
def calc_exp(n: int):
    return sum(range(1, n + 1)) / n


exp = -1
for i in range(len(P)):
    if len(P[i:i + K]) == K:
        e = sum(map(calc_exp, P[i:i + K]))
        if e > exp:
            exp = e

print(exp)


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = list(map(lambda x: (x + 1) / 2, P))

s = sum(P[:K])
ans = [s]
for prev_a, next_a in zip(P, P[K:]):
    s -= prev_a
    s += next_a
    ans.append(s)
print(max(ans))

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


def calc_exp(n: int):
    return sum(range(1, n + 1)) / n


exp = -1
for i in range(len(P)):
    if len(P[i:i + K]) == K:
        e = sum(map(calc_exp, P[i:i + K]))
        if e > exp:
            exp = e

print(exp)


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = list(map(lambda x: (x + 1) / 2, P))

s = sum(P[:K])
ans = [s]
for prev_a, next_a in zip(P, P[K:]):
    s -= prev_a
    s += next_a
    ans.append(s)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
from math import log2, floor

H = int(input())

a = 0
for i in range(floor(log2(H)) + 1):
    a += 2 ** i
print(a)


Fixed submission:
from math import log, floor

H = int(input())

a = 0
for i in range(floor(log(H, 2)) + 1):
    a += 2 ** i
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for _ in range(K):
    if A:
        A -= 1
    elif B:
        B -= 1
else:
    print(A, B)



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

if K <= A:
    print(A - K, B)
elif A < K <= A + B:
    print(0, B - (K - A))
else:
    print(0, 0)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations, compress

N = int(input())
S = input()

targets = tuple(f"{i:0>3}" for i in range(1000))
ans = []
for target in targets:
    a, b, c = target
    a_index = S.find(a)
    b_index = S.find(b, a_index + 1)
    c_index = S.find(c, b_index + 1)
    ret = (a_index, b_index, c_index)
    if -1 not in ret:
        # print(target, ret)
        ans.append(ret)
print(len(ans))

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

targets = tuple("{:0>3}".format(i) for i in range(1000))
ans = []
for target in targets:
    a, b, c = target
    a_index = S.find(a)
    b_index = S.find(b, a_index + 1)
    c_index = S.find(c, b_index + 1)
    ret = (a_index, b_index, c_index)
    if -1 not in ret:
        # print(target, ret)
        ans.append(ret)
print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int, input().split(" ")))
d = {i: (sum(A[:i]), sum(A[i:])) for i in range(N)}

print(min(abs(value[0] - value[1]) for key, value in d.items()))


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

S = sum(A)
ans = S
s = 0
for i in range(N):
    s += A[i]
    ans = min(ans, abs(s - (S - s)))
print(ans)