Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,*a=map(int,open(0).read().split())
mod=10**9+7
b0=np.array([0 for i in range(60)])
b1=np.array([0 for i in range(60)])
for i in range(n):
  ai=a[i]
  j=0
  while ai>0:
    if ai&1==1:
      b1[j]+=1
    else:
      b0[j]+=1
    j+=1
    ai>>=1
  b0[j:]+=1
ans=0
for i in range(60):
  ans+=(b0[i]*b1[i]*pow(2,i,mod))
  ans%=mod
print(ans)

Fixed submission:
import numpy as np
n,*a=map(int,open(0).read().split())
mod=10**9+7
a=np.array(a)
ans=0
for i in range(60):
  c=len(a[a&1==1])
  a>>=1
  ans+=c*(n-c)*pow(2,i,mod)
  ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
mod=10**9+7
b0=[0 for i in range(60)]
b1=[0 for i in range(60)]
for i in range(n):
  ai=a[i]
  for j in range(60):
    if ai&1==1:
      b1[j]+=1
    else:
      b0[j]+=1
    ai>>=1
ans=0
for i in range(60):
  ans+=(b0[i]*b1[i]*pow(2,i,mod))
  ans%=mod
print(ans)

Fixed submission:
import numpy as np
n,*a=map(int,open(0).read().split())
mod=10**9+7
a=np.array(a)
ans=0
for i in range(60):
  c=len(a[a&1==1])
  a>>=1
  ans+=c*(n-c)*pow(2,i,mod)
  ans%=mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a)
a=np.sort(a)
for i in range(m):
  a[-1]=a[-1]//2
  a=np.sort(a)
print(sum(a))

Fixed submission:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x:x*(-1),a))
heapq.heapify(a)
for i in range(m):
  mini=heapq.heappop(a)
  mini=(-1)*((-mini)//2)
  heapq.heappush(a,mini)
print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
for i in range(m):
  a[-1]=a[-1]//2
  a=sorted(a)
print(sum(a))

Fixed submission:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x:x*(-1),a))
heapq.heapify(a)
for i in range(m):
  mini=heapq.heappop(a)
  mini=(-1)*((-mini)//2)
  heapq.heappush(a,mini)
print(sum(a)*(-1))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[i for i in range(n)]
print(sum(a))

Fixed submission:
n=int(input())
ans=n*(n-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())),dtype=np.int64)
dp=np.ones(n,dtype=np.int64)*2**64
dp[0]=0
for i in range(n-1):
  cost=np.abs(h[i]-h[i+1:i+k+1])
  np.minimum(dp[i+1:i+k+1],dp[i]+cost,out=dp[i+1:i+k+1])
print(dp[-1])

Fixed submission:
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())),dtype=np.int64)
dp=np.full(n,10**10,dtype=np.int64)
dp[0]=0
for i in range(n-1):
  cost=np.abs(h[i]-h[i+1:i+k+1])
  np.minimum(dp[i+1:i+k+1],dp[i]+cost,out=dp[i+1:i+k+1])
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
cost=[float('inf') for i in range(n)]
cost[0]=0
for i in range(n):
  for j in range(1,k+1):
    if i+j==n:
      break
    d=0
    if h[i]>h[j+i]:
      d=h[i]-h[i+j]
    else:
      d=h[i+j]-h[i]
    a=cost[i]+d
    if cost[i+j]>a:
      cost[i+j]=a
print(cost[-1])

Fixed submission:
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())),dtype=np.int64)
dp=np.full(n,10**10,dtype=np.int64)
dp[0]=0
for i in range(n-1):
  cost=np.abs(h[i]-h[i+1:i+k+1])
  np.minimum(dp[i+1:i+k+1],dp[i]+cost,out=dp[i+1:i+k+1])
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
cost=[float('inf') for i in range(n)]
cost[0]=0
for i in range(n):
  for j in range(1,k+1):
    if i+j==n:
      break
    a=cost[i]+abs(h[i]-h[i+j])
    if cost[i+j]>a:
      cost[i+j]=a
print(cost[-1])

Fixed submission:
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())),dtype=np.int64)
dp=np.full(n,10**10,dtype=np.int64)
dp[0]=0
for i in range(n-1):
  cost=np.abs(h[i]-h[i+1:i+k+1])
  np.minimum(dp[i+1:i+k+1],dp[i]+cost,out=dp[i+1:i+k+1])
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
cost=[float('inf') for i in range(n)]
cost[0]=0
for i in range(n):
  for j in range(1,k+1):
    if i+j==n:
      break
    cost[i+j]=min(cost[i]+abs(h[i]-h[i+j]),cost[i+j])
print(cost[-1])

Fixed submission:
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())),dtype=np.int64)
dp=np.full(n,10**10,dtype=np.int64)
dp[0]=0
for i in range(n-1):
  cost=np.abs(h[i]-h[i+1:i+k+1])
  np.minimum(dp[i+1:i+k+1],dp[i]+cost,out=dp[i+1:i+k+1])
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,W,*wv=map(int,open(0).read().split())
w=wv[::2]
v=wv[1::2]
dp=[[0 for i in range(W+1)]for j in range(2)]
for i in range(n):
  t=i&1
  for j in range(W,-1,-1):
    if j<w[i]:
      dp[t][:j+1]=dp[t-1][:j+1]
      break
    else:
      dp[t][j]=max(dp[t-1][j-w[i]]+v[i],dp[t-1][j])
print(dp[(n-1)&1][-1])

Fixed submission:
import numpy as np
n,W,*wv=map(int,open(0).read().split())
w=np.array(wv[::2])
v=np.array(wv[1::2])
dp=np.zeros([n+1,W+1],dtype=int)
for i in range(1,n+1):
  now=np.zeros(W+1,dtype=int)
  now[w[i-1]:]=dp[i-1][:-w[i-1]]+v[i-1]
  dp[i]=np.maximum(dp[i-1],now)
print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,W,*wv=map(int,open(0).read().split())
w=wv[::2]
v=wv[1::2]
dp=[[0 for i in range(W+1)]for j in range(2)]
for i in range(n):
  t=i&1
  for j in range(W+1):
    if j<w[i]:
      dp[t][j]=dp[t-1][j]
    else:
      dp[t][j]=max(dp[t-1][j-w[i]]+v[i],dp[t-1][j])
print(dp[(n-1)&1][-1])

Fixed submission:
import numpy as np
n,W,*wv=map(int,open(0).read().split())
w=np.array(wv[::2])
v=np.array(wv[1::2])
dp=np.zeros([n+1,W+1],dtype=int)
for i in range(1,n+1):
  now=np.zeros(W+1,dtype=int)
  now[w[i-1]:]=dp[i-1][:-w[i-1]]+v[i-1]
  dp[i]=np.maximum(dp[i-1],now)
print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,W,*wv=map(int,open(0).read().split())
w=wv[::2]
v=wv[1::2]
dp=[[0 for i in range(W+1)]for j in range(n)]
for i in range(n):
  for j in range(W+1):
    if i==0:
      if j<w[i]:
        dp[i][j]=0
      else:
        dp[i][j]=v[i]
    else:
      if j<w[i]:
        dp[i][j]=dp[i-1][j]
      else:
        dp[i][j]=max(dp[i-1][j-w[i]]+v[i],dp[i-1][j])
print(dp[-1][-1])

Fixed submission:
import numpy as np
n,W,*wv=map(int,open(0).read().split())
w=np.array(wv[::2])
v=np.array(wv[1::2])
dp=np.zeros([n+1,W+1],dtype=int)
for i in range(1,n+1):
  now=np.zeros(W+1,dtype=int)
  now[w[i-1]:]=dp[i-1][:-w[i-1]]+v[i-1]
  dp[i]=np.maximum(dp[i-1],now)
print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
load=[list(map(int,input().split())) for i in range(n)]
dp=[[0 for i in range(w+1)]for j in range(n)]

for i in range(n):
  for j in range(w+1):
    if i==0:
      if j<load[i][0]:
        dp[i][j]=0
      else:
        dp[i][j]=load[i][1]
    else:
      if j<load[i][0]:
        dp[i][j]=dp[i-1][j]
      else:
        dp[i][j]=max(dp[i-1][j-load[i][0]]+load[i][1],dp[i-1][j])
print(dp[-1][-1])

Fixed submission:
import numpy as np
n,W,*wv=map(int,open(0).read().split())
w=np.array(wv[::2])
v=np.array(wv[1::2])
dp=np.zeros([n+1,W+1],dtype=int)
for i in range(1,n+1):
  now=np.zeros(W+1,dtype=int)
  now[w[i-1]:]=dp[i-1][:-w[i-1]]+v[i-1]
  dp[i]=np.maximum(dp[i-1],now)
print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,w,*wv=map(int,open(0).read().split())
wei=wv[0::2]
val=wv[1::2]
sack=np.array([[0 for i in range(w+1)] for j in range(2)])
for i in range(n):
  t=i&1
  np.maximum(sack[t-1][:-wei[i]]+val[i],sack[t-1][wei[i]:],out=sack[t][wei[i]:])
  sack[t][:wei[i]]=sack[t-1][:wei[i]]
print(sack[(n-1)&1][-1])

Fixed submission:
import numpy as np
n,w,*wv=map(int,open(0).read().split())
wei=wv[0::2]
val=wv[1::2]
sack=np.array([float('inf') for i in range(sum(val)+1)])
sack[0]=0
for i in range(n):
  sack[val[i]:]=np.minimum(sack[val[i]:],sack[:-val[i]]+wei[i])
print(np.where(sack<=w)[0][-1])
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n=int(input())
x=[]
y=[]
for i in range(n):
  xx,yy=map(int,input().split())
  x.append([xx,i])
  y.append([yy,i])
x.sort()
y.sort()
px=[]
py=[]
for i in range(n-1):
  px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
  py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
x=[]
y=[]
px=[]
py=[]
heapq.heapify(p)
r=[i for i in range(n)]
rank=[1 for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(x,y):
  rx=root(x)
  ry=root(y)
  if rank[rx]>rank[ry]:
    r[rx]=ry
    rank[rx]+=rank[ry]
  else:
    r[ry]=rx
    rank[ry]+=rank[rx]
ans=0
while p:
  path=heapq.heappop(p)
  if root(path[1])==root(path[2]):
    continue
  union(path[1],path[2])
  ans+=path[0]
print(ans)

Fixed submission:
n=int(input())
x=[]
y=[]
for i in range(n):
  xx,yy=map(int,input().split())
  x.append([xx,i])
  y.append([yy,i])
x.sort()
y.sort()
px=[]
py=[]
for i in range(n-1):
  px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
  py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
x=[]
y=[]
px=[]
py=[]
p.sort()
r=[i for i in range(n)]
rank=[1 for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(path):
  rx=root(path[1])
  ry=root(path[2])
  if rx==ry:
    return 0
  else:
    if rank[rx]>rank[ry]:
      r[rx]=ry
      rank[rx]+=rank[ry]
    else:
      r[ry]=rx
      rank[ry]+=rank[rx]
    return path[0]
ans=0
for i in range(len(p)):
  ans+=union(p[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import heapq
n=int(input())
x=[]
y=[]
for i in range(n):
  xx,yy=map(int,input().split())
  x.append([xx,i])
  y.append([yy,i])
x=sorted(x)
y=sorted(y)
px=[]
py=[]
for i in range(n-1):
  px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
  py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
heapq.heapify(p)
r=[i for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(x,y):
  rx=root(x)
  ry=root(y)
  if rx==ry:
    return
  else:
    r[rx]=ry
ans=0
while p:
  path=heapq.heappop(p)
  if root(path[1])==root(path[2]):
    continue
  union(path[1],path[2])
  ans+=path[0]
print(ans)

Fixed submission:
n=int(input())
x=[]
y=[]
for i in range(n):
  xx,yy=map(int,input().split())
  x.append([xx,i])
  y.append([yy,i])
x.sort()
y.sort()
px=[]
py=[]
for i in range(n-1):
  px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
  py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
x=[]
y=[]
px=[]
py=[]
p.sort()
r=[i for i in range(n)]
rank=[1 for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(path):
  rx=root(path[1])
  ry=root(path[2])
  if rx==ry:
    return 0
  else:
    if rank[rx]>rank[ry]:
      r[rx]=ry
      rank[rx]+=rank[ry]
    else:
      r[ry]=rx
      rank[ry]+=rank[rx]
    return path[0]
ans=0
for i in range(len(p)):
  ans+=union(p[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N + 1, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)


Fixed submission:
N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
count = 0

for i in range(0, N + 1, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)


Fixed submission:
N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
count = 0

for i in range(1, len(arr) + 1, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)

Fixed submission:
N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
count = 0

for i in range(1, len(arr) + 1, 2):
    if arr[i] % 2 == 0:
        count += 1
        
print(count)

Fixed submission:
N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = map(int, input().split())
count = 0

for i in range(1, len(arr), 2):
    if arr[i] % 2 == 0:
        count += 1
        
print(count)

Fixed submission:
N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)
Buggy python submission (verdict: Runtime Error):
n = input()

if n == 1:
    print("Hello Workd")
else:
    a = int(input())
    b = int(input())
    print(a + b)


Fixed submission:
N = input()

if N == '1':
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)
Buggy python submission (verdict: Runtime Error):
L, R, d = list(map(int, input().split()))
result = 0
for i in range(L, R + 1):
  if i % d == 0:
    result += 1
print(result)L, R, d = list(map(int, input().split()))
result = 0
for i in range(L, R + 1):
  if i % d == 0:
    result += 1
print(result)

Fixed submission:
L, R, d = list(map(int, input().split()))
result = 0
for i in range(L, R + 1):
  if i % d == 0:
    result += 1
print(result)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]

time = 0
maxBooks = 0
for i in range(N):
  if K - time >= A[i]:
    time += A[i]
    maxBooks += 1
  else:
    break

A_count = maxBooks
nowBooks = maxBooks
flag = True
for i in range(M):
  if K - time >= B[i]:
    time += B[i]
    nowBooks += 1
  else:
    time += B[i]
    nowBooks += 1
    while K < time:
      time -= A[A_count]
      A_count -= 1
      nowBooks -= 1
      if A_count < 0:
        break
    if flag:
      break

  if maxBooks < nowBooks:
    maxBooks = nowBooks
    
print(maxBooks)

Fixed submission:
N, M, K = map(int, input().split())
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]

time = 0
maxBooks = 0

for i in range(N):
  if K - time >= A[i]:
    time += A[i]
    maxBooks += 1
  else:
    break

A_count = maxBooks - 1
nowBooks = maxBooks

for i in range(M):
  time += B[i]
  nowBooks += 1
  
  while K < time:
    if A_count < 0:
      nowBooks = 0
      break
    time -= A[A_count]
    A_count -= 1
    nowBooks -= 1
      
  if maxBooks < nowBooks:
    maxBooks = nowBooks
    
print(maxBooks)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]

time = 0
maxBooks = 0
for i in range(N):
  if K - time >= A[i]:
    time += A[i]
    maxBooks += 1
  else:
    break

A_count = maxBooks
nowBooks = maxBooks

for i in range(M):
  if K - time >= B[i]:
    time += B[i]
    nowBooks += 1
  else:
    if A_count < 0:
      break
    while K - time < B[i]:
      time -= A[A_count]
      A_count -= 1
      nowBooks -= 1
    time += B[i]
    nowBooks += 1
  if maxBooks < nowBooks:
    maxBooks = nowBooks
    
print(maxBooks)

Fixed submission:
N, M, K = map(int, input().split())
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]

time = 0
maxBooks = 0

for i in range(N):
  if K - time >= A[i]:
    time += A[i]
    maxBooks += 1
  else:
    break

A_count = maxBooks - 1
nowBooks = maxBooks

for i in range(M):
  time += B[i]
  nowBooks += 1
  
  while K < time:
    if A_count < 0:
      nowBooks = 0
      break
    time -= A[A_count]
    A_count -= 1
    nowBooks -= 1
      
  if maxBooks < nowBooks:
    maxBooks = nowBooks
    
print(maxBooks)
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A < B:
  A_P = A + V * T
  B_P = B + W * T
  if A_P >= B_P:
    print("YES")
  else:
    print("NO")
else A > B:
  A_P = A - V * T
  B_P = B - W * T
  if A_P <= B_P:
    print("YES")
  else:
    print("NO")

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A < B:
  A_P = A + V * T
  B_P = B + W * T
  if A_P >= B_P:
    print("YES")
  else:
    print("NO")
else:
  A_P = A - V * T
  B_P = B - W * T
  if A_P <= B_P:
    print("YES")
  else:
    print("NO")
Buggy python submission (verdict: Runtime Error):

def action(A, N):
  B = [0] * (N + 1)
  for i, bright in enumerate(A):
    s = max(0, i - bright)
    B[s] += 1
    e = min(N, i + bright)
    B[e + 1] -= 1
  
  for i in range(N):
    B[i + 1] += B[i]
  return B[:-1]

def main():
  N, K = map(int, input().split())
  A = list(map(int, input().split()))

  for i in range(K):
    A = action(A, N)
    if A[0] == N & all(A):
      break
      
  print(*A, sep=" ")

if __name__ == '__main__':
  main()

Fixed submission:
def action(A, N):
  B = [0] * N
  for i, bright in enumerate(A):
    s = max(0, i - bright)
    B[s] += 1
    e = min(N, i + bright)
    if e < N - 1:
      B[e + 1] -= 1
  
  for i in range(N - 1):
    B[i + 1] += B[i]
  return B

def main():
  N, K = map(int, input().split())
  A = list(map(int, input().split()))

  for i in range(K):
    A = action(A, N)
    if (A[0] == N) & all(A):
      break
      
  print(*A, sep=" ")

if __name__ == '__main__':
  main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()
result = 1
line = pow(10,18)

for i in range(N):
  result *= int(A[i])
if result > line:
  result = -1

print(result)


Fixed submission:
N = int(input())
A = input().split()
result = 1
line = pow(10,18)

if "0" in A:
  result = 0
else:
  for i in range(N):
    result *= int(A[i])
    if result > line:
      result = -1
      break

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j + A[i]] %= mod

print(DP[N][S])

Fixed submission:
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j + A[i]] %= mod

print(DP[N][S])

Buggy python submission (verdict: Time Limit Exceeded):
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j] %= mod

print(DP[N][S])

Fixed submission:
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j + A[i]] %= mod

print(DP[N][S])

Buggy python submission (verdict: Time Limit Exceeded):
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
    DP[i + 1][j] %= mod

print(DP[N][S])

Fixed submission:
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j + A[i]] %= mod

print(DP[N][S])

Buggy python submission (verdict: Time Limit Exceeded):
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
    DP[i + 1][j] %= mod

print(DP[N][S])

Fixed submission:
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j + A[i]] %= mod

print(DP[N][S])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()

pear = 0

for i in range(N-1, 0, -1):
  for j in range(i):
    if int(A[i]) >= (i - j):
      break
    if (i - j) == (int(A[i]) + int(A[j])):
      pear += 1
      
print(pear)

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

pear = 0

i_result = {}
j_result = {}

for i in range(N):
  result = str(i + int(A[i]))
  if result in i_result:
    i_result[result] += 1
  else:
    i_result[result] = 1

for j in range(N):
  result = str(j - int(A[j]))
  if result in j_result:
    j_result[result] += 1
  else:
    j_result[result] = 1

for k in i_result.keys():
  if k in j_result:
    pear += (i_result[k] * j_result[k])
      
      
print(pear)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()

pear = 0

for i in range(N, 1, -1):
  for j in range(i):
    if int(A[i]) >= (i - j):
      break
    if (i - j) == (int(A[i]) + int(A[j])):
      pear += 1
      
print(pear)
  

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

pear = 0

i_result = {}
j_result = {}

for i in range(N):
  result = str(i + int(A[i]))
  if result in i_result:
    i_result[result] += 1
  else:
    i_result[result] = 1

for j in range(N):
  result = str(j - int(A[j]))
  if result in j_result:
    j_result[result] += 1
  else:
    j_result[result] = 1

for k in i_result.keys():
  if k in j_result:
    pear += (i_result[k] * j_result[k])
      
      
print(pear)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()

pear = 0

for i in range(N-1):
  for j in range(i+1, N):
    if (j - i) == (int(A[i]) + int(A[j])):
      pear += 1
      
print(pear)
  

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

pear = 0

i_result = {}
j_result = {}

for i in range(N):
  result = str(i + int(A[i]))
  if result in i_result:
    i_result[result] += 1
  else:
    i_result[result] = 1

for j in range(N):
  result = str(j - int(A[j]))
  if result in j_result:
    j_result[result] += 1
  else:
    j_result[result] = 1

for k in i_result.keys():
  if k in j_result:
    pear += (i_result[k] * j_result[k])
      
      
print(pear)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

itemCount = 0
itemList = []

for i in range(N):
  item = input()
  if item not in itemList:
    itemCount += 1
    itemList.append(item)

print(itemCount)

Fixed submission:
N = int(input())

itemCount = 0
itemList = {}

for i in range(N):
  item = input()
  if item in itemList:
    continue
  else:
    itemCount += 1
    itemList[item] = item

print(itemCount)