Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N == 1):
  print("Hello World")
else:
  a,b = [int(i) for i in input().split()]
  print(a + b)

Fixed submission:
N = int(input())
if(N == 1):
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a + b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        for i in range(n):
            if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
                good = False
                break
        if good:
            print(cx, cy, h)
            sys.exit()

Fixed submission:
import sys
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        for i in range(n):
            if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
                good = False
                break
        if good:
            print(cx, cy, h)
            sys.exit()
Buggy python submission (verdict: Runtime Error):
n = input()
if n[0]*3 == n:
    print(n)
elif int(n[0]) > int(n[1]) and int(n[0]) > int(n[3]):
    print(n[0] * 3)
else:
    print(str(int(n[0]) +1) * 3)

Fixed submission:
n = input()
for i in range(1,10):
    N = str(i) + str(i) + str(i)
    if n <= N:
        print(N)
        break
Buggy python submission (verdict: Runtime Error):
N,M,X,Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = list(map(int, input().split()))
maxX = max(x)
minY = min(y)

print(maxX,maxY)
for i in range(Y+1):
    if X < i <= Y and maxX < i and minY >= i:
        print("No War")
        break
    elif i == Y:
        print("War")
        break

Fixed submission:
N,M,X,Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = list(map(int, input().split()))
maxX = max(x)
minY = min(y)
flag = True
for i in range(Y+1):
    if X < i <= Y and maxX < i and minY >= i:
        print("No War")
        flag = False
        break
if flag:
    print("War")
Buggy python submission (verdict: Runtime Error):
n = input()
e = len(n)
totalList = []
for i in range(len(n)):
  totalList.append(n[i])
  
total = sum(totalList)
if(total == 0):
  print("Yes")
if(n % total == 0):
  print("Yes")
else:
  print("No")
  

  

Fixed submission:
n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = input())
total = 0
for i in range(len(n)):
  total+=int(n[i])

if(total == 0):
  print("No")
if(int(n) % total == 0):
  print("Yes")
else:
  print("No")

Fixed submission:
n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = input())
total = 0
for i in range(len(n)):
  total+=int(n[i])
  if(total == 0):
    print("No")
if(int(n) % total == 0):
  print("Yes")
else:
  print("No")
      

Fixed submission:
n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
total = 0
for i in range(len(n)):
  total+=n[i]
if(total == 0):
  print("No")
if(n % total == 0):
  print("Yes")
else:
  print("No")
  

Fixed submission:
n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
d,k = [int(x) for x in input().split()]
print((100 ** d) * k

Fixed submission:
D, N =map(int,input().split())
if N == 100:
  N = 101
print(N*(100**D))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
total = 0
ans = 0
for i in range(1,1000):
    total += i
    if total - b => 0:
        ans = total -b
        break
        
print(ans)

Fixed submission:
a,b = map(int, input().split())
s = b -a
ans = 0
for i in range(1,s):
  ans += i
  
print(ans - a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = set(map(str,input().split()))
if(len(s) == 3):
  print("Three")
else:
  print("Four")


Fixed submission:
n = int(input())
print(n // 3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = set()
for i in range(N+1):
    a = input()
    s.add(a)
if(len(s) == 3):
  print("Three")
else:
  print("Four")

Fixed submission:
N = int(input())
a = list(input().split())

if("Y" in a):
  print("Four")
else:
  print("Three")

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = set()
for i in range(N):
    a = input()
    s.add(a)
if(len(s) == 3):
  print("Three")
else:
  print("Four")

Fixed submission:
N = int(input())
a = list(input().split())

if("Y" in a):
  print("Four")
else:
  print("Three")

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = set()
for i in range(N):
    a = input()
    s.add(a)
print(len(s))

Fixed submission:
N = int(input())
a = list(input().split())

if("Y" in a):
  print("Four")
else:
  print("Three")
Buggy python submission (verdict: Runtime Error):
a,b = [int(x) for x in input().split()]

if (a * b) % == 0:
  print("Even")
else:
  print("Odd")


Fixed submission:
a,b = [int(x) for x in input().split()]

if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
ans = 0

def sum(k):
  s = 0
  for j in range(len(s)):
    s+=int(k[j])
  return s

for i in range(1,n+1):
  if a<=sum(str(i))<=b:
    ans+=i
print(ans)

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

def sum(k):
  s = 0
  for j in range(len(k)):
    s+=int(k[j])
  return s

for i in range(1,n+1):
  if a<=sum(str(i))<=b:
    ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b = [int(x) for x in input().split()]
 
print(math.ceil((a+b)/2)

Fixed submission:
import math
a,b = [int(x) for x in input().split()]
 
print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
x,a,b = map(int, input().split())
if a => b:
    print("delicious")    
elif b <= x + a:
    print("safe")
else:
    print("dangerous")

Fixed submission:
x,a,b = map(int, input().split())
if a >= b:
    print("delicious")    
elif b <= x + a:
    print("safe")
else:
    print("dangerous")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > b:
    print("GREATER")
elif a < b:
    print("LESS")
else:
    print("EQUAL")

Fixed submission:
a = int(input())
b = int(input())
if a > b:
    print("GREATER")
elif a < b:
    print("LESS")
else:
    print("EQUAL")
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
ab = []
cd = []
for _ in range(n):
    ab.append(list(map(int, input().split())))

for _ in range(m):
    cd.append(list(map(int, input().split())))

for i in range(n):
    minNum = 10000
    for j in range(m):
        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < minNum:
            minNum = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            ans = j + 1
    print(ans)

Fixed submission:
n,m = map(int, input().split())
ab = []
cd = []
for _ in range(n):
    ab.append(list(map(int, input().split())))

for _ in range(m):
    cd.append(list(map(int, input().split())))

for i in range(n):
    minNum = float('inf')
    ans = 0
    for j in range(m):
        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < minNum:
            minNum = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            ans = j + 1
    print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
n = int(input())
ls = list(range(n+1))

ans = 10**9
for a in range(1,n):
    b = bisect.bisect_left(ls, n/a)
    ans = min(ans,int(max(len(str(a)),len(str(ls[b])))))
print(ans)
    

Fixed submission:
import math

n = int(input())
small = [1]
large = [n]
for i in range(2,int(n**0.5)+1):
    if not (n%i):
        small.append(i)
        large.append(n//i)
print(int(math.log10(large[-1]))+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
for i in range(1,n+1):
    ans *= i
    
print(ans % (10 ** 9 + 7))

Fixed submission:
N = int(input())
pow = 1
num = 10**9+7
for i in range(1,N+1):
  pow = pow*i%num
print(pow%num)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans += 1
print(ans)

Fixed submission:
k,s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for a in range(k+1):
    for b in range(k+1):
        for c in range(k+1):
            if a + b + c == s:
                ans += 1
print(ans)

Fixed submission:
k,s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n,s = map(int, input().split())
cnt = 0
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            if s == i + j + k:
                cnt+=1
print(cnt)

Fixed submission:
k,s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int, inpu().split())
na = (a-1) // x + 1
nb = b // x + 1
print(nb-na)

Fixed submission:
a,b,x = map(int, input().split())
na = (a-1) // x + 1
nb = b // x + 1
print(nb-na)
Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())))
for i in range(n):
    a=list(map(int,input().split()))))
    if a[-1]==1:
        w-=a[0]
    elif a[-1]==2:
        w = a[0]
    elif a[-1]==3:
        h-=a[1]
    elif a[-1]==4:
        h = a[1]
print(h*w)

Fixed submission:
W,H,N = map(int, input().split())
ans = [[1 for _ in range(W)] for _ in range(H)]

for i in range(N):
    x,y,a = map(int, input().split())
    if a == 1:
        for i in range(H):
            for j in range(x):
                ans[i][j] = 0
    if a == 2:
        for  i in range(H):
            for j in range(x, W):
                ans[i][j] = 0
    if a == 3:
        for i in range(y):
            for j in range(W):
                ans[i][j] = 0
    if a == 4:
        for i in range(y, H):
            for j in range(W):
                ans[i][j] = 0
print(sum([sum(ans[i]) for i in range(H)]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
*A, = map(int, input().split())
now = 1
for i in A:
    now *= i
if now > 10**18:
    print(-1)
else:
    print(now)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
now = 1
if A.count(0) == 0:
    for i in A:
        now *= i
        if now > 10**18:
            now = -1
            break
else:
    now = 0
print(now)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ai = list(map(int, input().split()))
Ai.insert(0, 0)
for i in range(1, N + 1 ,1):
    buka = Ai.count(i)
    print(buka)

Fixed submission:
N = int(input())
Az = [0 for i in range(N)]
Ai = list(map(int, input().split()))

for i in Ai:
    Az[i-1] += 1
for j in Az:
    print(j)
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N, M = map(int, input().split())
goukei = comb(N, 2, exact=True) + comb(M, 2, exact=True)
print(goukei)

Fixed submission:
N, M = map(int, input().split())
#goukei = comb(N, 2, exact=True) + comb(M, 2, exact=True)
goukei = N * (N-1) / 2 + M * (M - 1) / 2
print(int(goukei))

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N, M = map(int, input().split())
goukei = comb(N, 2, exact=True) + comb(M, 2, exact=True)
print(goukei)

Fixed submission:
N, M = map(int, input().split())
#goukei = comb(N, 2, exact=True) + comb(M, 2, exact=True)
goukei = N * (N-1) / 2 + M * (M - 1) / 2
print(int(goukei))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))
count = 0
for i in range(len(S)):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        count += 1
print(count)

Fixed submission:
N = int(input())
S = input()
print(S.count('ABC'))
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int,open(0).read().split())
if N == 1:
    print("Hello World")
if N == 2:
    print(A + B)

Fixed submission:
*N,= map(int,open(0).read().split())
if N[0] == 1:
    print("Hello World")
if N[0] == 2:
    print(N[1] + N[2])
Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B >= 2 * C:
    nokori = abs(X - Y)
    if X >= Y and A >= 2 * C:
        ans = C * 2 * X
    if Y >= X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)


Fixed submission:
A, B, C, X, Y = map(int, input().split())
    

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)

Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B > 2 * C:
    nokori = abs(X - Y)
    if X >= Y and A >= 2 * C:
        ans = C * 2 * X
    if Y >= X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)

Fixed submission:
A, B, C, X, Y = map(int, input().split())
    

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)

Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B > 2 * C:
    nokori = abs(X - Y)
    if X > Y and A >= 2 * C:
        ans = C * 2 * X
    if Y > X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)

Fixed submission:
A, B, C, X, Y = map(int, input().split())
    

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop
from math import ceil


def main():
    n, k = map(int, input().split())
    a = [int(i) for i in input().split()]
    c = [1] * n
    h = []
    for i, ai in enumerate(a):
        heappush(h, (-ai, i))
    for _ in range(k):
        ai, i = heappop(h)
        ci = c[i]
        ai = ai * ci / (ci + 1)
        heappush(h, (ai, i))
        c[i] += 1
    print(ceil(-h[0][0]))


if __name__ == '__main__':
    main()


Fixed submission:
from math import ceil


def main():
    n, k = map(int, input().split())
    a = sorted([int(i) for i in input().split()], reverse=True)
    left = 0
    right = a[0]
    while right - left > 1:
        ki = k
        mid = left + (right - left) // 2
        for ai in a:
            if ki < 0:
                left = mid
                break
            if ai <= mid:
                right = mid
                break
            ki -= ceil(ai / mid) - 1
        else:
            if ki < 0:
                left = mid
            else:
                right = mid
    print(right)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop
from math import ceil


def main():
    n, k = map(int, input().split())
    a = [int(i) for i in input().split()]
    c = [1] * n
    h = []
    for i, ai in enumerate(a):
        heappush(h, (-ai, i))
    for _ in range(k):
        ai, i = heappop(h)
        ci = c[i]
        ai = ai * ci / (ci + 1)
        heappush(h, (ai, i))
        c[i] += 1
    print(ceil(-h[0][0]))


if __name__ == '__main__':
    main()


Fixed submission:
from math import ceil


def main():
    n, k = map(int, input().split())
    a = sorted([int(i) for i in input().split()], reverse=True)
    left = 0
    right = a[0]
    while right - left > 1:
        ki = k
        mid = left + (right - left) // 2
        for ai in a:
            if ki < 0:
                left = mid
                break
            if ai <= mid:
                right = mid
                break
            ki -= ceil(ai / mid) - 1
        else:
            if ki < 0:
                left = mid
            else:
                right = mid
    print(right)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
input()print(sum(sorted(map(int,input().split()))[1:]))

Fixed submission:
from heapq import heappush, heapreplace

n = int(input())
a = sorted(map(int, input().split()), reverse=True)
h = [-a[0]]
c = 0
for i in range(1, n):
    c += heapreplace(h, -a[i])
    heappush(h, -a[i])
print(-c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n + 1):
  for j in range(i, n + 1, i):
    ans += j
print(ans)


Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
  for j in range(i, n + 1, i):
    ans += j
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in arnge(1, n + 1):
  for j in range(1, n + 1, i):
    ans += j
print(ans)


Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
  for j in range(i, n + 1, i):
    ans += j
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    k = max(a).bit_length()
    c = np.zeros(n, dtype=np.int)
    for i in range(k):
        b = np.array([ai // 2**i % 2 for ai in a], dtype=np.int)
        if b.sum() % 2:
            b = 1 - b
        c += b * 2**i
    print(*c)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    k = max(a).bit_length()
    c = [0] * n
    for i in range(k):
        b = [ai // 2**i % 2 for ai in a]
        if sum(b) % 2:
            b = [1 - bi for bi in b]
        for j in range(n):
            c[j] += b[j] * 2**i
    print(*c)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate


def main():
    n, k = map(int, input().split())
    a = [int(i) for i in input().split()]
    ini = [0] * n
    fin = [n] * n
    for _ in range(k):
        b = ini.copy()
        for i, ai in enumerate(a):
            b[max(i - ai, 0)] += 1
            if i + ai + 1 < n:
                b[i + ai + 1] -= 1
        a = list(accumulate(b))
        if a == fin:
            print(*a)
            return
    print(*a)


if __name__ == '__main__':
    main()


Fixed submission:
from itertools import accumulate


def main():
    n, k = map(int, input().split())
    a = [int(i) for i in input().split()]
    ini = [0] * n
    fin = [n] * n
    for c in range(min(k, 45)):
        b = ini.copy()
        for i, ai in enumerate(a):
            b[max(i - ai, 0)] += 1
            if i + ai + 1 < n:
                b[i + ai + 1] -= 1
        a = list(accumulate(b))
    print(*a)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def main():
    n, s = map(int, input().split())
    a = [int(i) for i in input().split()]
    mod = 998244353
    dp = np.zeros((n + 1, s + 1), dtype=int)
    dp[0][0] = 1
    for i in range(n):
        ai = a[i]
        for j in range(s + 1):
            if j < ai:
                dp[i + 1][j] = dp[i][j] * 2 % mod
            else:
                dp[i + 1][j] = (dp[i][j] * 2 + dp[i][j - ai]) % mod
    print(dp[n][s])

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, s = map(int, input().split())
    a = sorted([int(i) for i in input().split()])
    mod = 998244353
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        ai = a[i]
        for j in range(s + 1):
            if j < ai:
                dp[i + 1][j] = dp[i][j] * 2 % mod
            else:
                dp[i + 1][j] = (dp[i][j] * 2 % mod + dp[i][j - ai]) % mod
    print(dp[n][s])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, s = map(int, input().split())
    a = [int(i) for i in input().split()]
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        ai = a[i]
        for j in range(s + 1):
            if j < ai:
                dp[i + 1][j] = dp[i][j] * 2 % 998244353
            else:
                dp[i + 1][j] = (dp[i][j] * 2 + dp[i][j - ai]) % 998244353
    print(dp[n][s])

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, s = map(int, input().split())
    a = sorted([int(i) for i in input().split()])
    mod = 998244353
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        ai = a[i]
        for j in range(s + 1):
            if j < ai:
                dp[i + 1][j] = dp[i][j] * 2 % mod
            else:
                dp[i + 1][j] = (dp[i][j] * 2 % mod + dp[i][j - ai]) % mod
    print(dp[n][s])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, s = map(int, input().split())
    a = sorted([int(i) for i in input().split()])
    mod = 998244353
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        ai = a[i]
        for j in range(s + 1):
            if j < ai:
                dp[i + 1][j] = dp[i][j] * 2 % mod
            else:
                dp[i + 1][j] = (dp[i][j] * 2 % mod + dp[i][j - ai]) % mod
    print(dp[n][s])

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, s = map(int, input().split())
    a = sorted([int(i) for i in input().split()])
    mod = 998244353
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        ai = a[i]
        for j in range(s + 1):
            if j < ai:
                dp[i + 1][j] = dp[i][j] * 2 % mod
            else:
                dp[i + 1][j] = (dp[i][j] * 2 % mod + dp[i][j - ai]) % mod
    print(dp[n][s])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    c = 0
    for i, ai in enumerate(a):
        for j in range(i + ai + 1, n):
            if j - i == ai + a[j]:
                c += 1
    print(c)

if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict

def main():
    n = int(input())
    l = defaultdict(int)
    r = defaultdict(int)
    for i, ai in enumerate(map(int, input().split())):
        l[i - ai] += 1
        r[i + ai] += 1
    print(sum(l[i] * r[i] for i in range(1, n - 1)))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate

n, k = map(int, input().split())
e = [(int(i) + 1) / 2 for i in input().split()]
a = list(accumulate(e))
s = [a[i + k] - a[i] for i in range(n - k)]
print(max(a[k - 1], *s))

Fixed submission:
from itertools import accumulate

n, k = map(int, input().split())
e = [(int(i) + 1) / 2 for i in input().split()]
a = list(accumulate(e))
s = [a[i + k] - a[i] for i in range(n - k)]
print(max(a[k - 1], *s) if n > k else a[-1])