Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
for i in range(len(s) - len(t) + 1):
    can = True
    for j in range(len(t)):
        if s[i + j] == "?" or s[i + j] == t[j]:
            continue
        else:
            can = False
            break
    if can:
        break
if can:
    res = []
    for j in range(i):
        if s[j] == "?":
            res.append("a")
        else:
            res.append(s[j])
    for j in range(len(t)):
        res.append(t[j])
    for j in range(len(s) - len(t) - i):
        if s[j + len(t) + i] == "?":
            res.append("a")
        else:
            res.append(s[j + len(t) + i])
    print("".join(res))

else:
    print("UNRESTORABLE")

Fixed submission:
import pprint
s = input()
t = input()
candidate = []
for i in range(len(s) - len(t) + 1):
    can = True
    for j in range(len(t)):
        if s[i + j] == "?" or s[i + j] == t[j]:
            continue
        else:
            can = False
            break
    if can:
        res = []
        for j in range(i):
            if s[j] == "?":
                res.append("a")
            else:
                res.append(s[j])
        for j in range(len(t)):
            res.append(t[j])
        for j in range(len(s) - len(t) - i):
            if s[j + len(t) + i] == "?":
                res.append("a")
            else:
                res.append(s[j + len(t) + i])
        candidate.append("".join(res))

if len(candidate) != 0:
    candidate.sort()
    #pprint.pprint(candidate)
    print(candidate[0])

else:
    print("UNRESTORABLE")
Buggy python submission (verdict: Time Limit Exceeded):
def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect.bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

n = int(input())
import bisect
dat = []
for i in range(n):
    x = int(input())
    a =  index(dat, x)
    if a == -1:
        bisect.insort_left(dat, x)
    else:
        del dat[a]
print(len(dat))

Fixed submission:
dat = dict()

n = int(input())
import bisect
for i in range(n):
    x = int(input())
    if x in dat:
        del dat[x]
    else:
        dat[x] = 1

print(len(dat))
Buggy python submission (verdict: Runtime Error):
n = int(input())
dat =[]
link = []
for i in range(n+1):
    link.append([])
cost = [-1] * (n + 1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    dat.append((a, b, c))
    link[a].append((b,c))
    link[b].append((a,c))

dat_q = []
q, k = map(int, input().split())

for i in range(q):
    x, y = map(int, input().split())
    dat_q.append((x,y))

#print(link)

def search(curcost, current):
    #print("cost{0}, pos {1}: ".format(curcost, current))
    cost[current] = curcost
    for npos, ncost in link[current]:
        if cost[npos] != -1:
            # 戻らない
            continue
        search(curcost + ncost, npos)

search(0, k)

#print(cost)
for i in range(q):
    x,y = dat_q[i]
    print(cost[x] + cost[y])

Fixed submission:
import sys
sys.setrecursionlimit(4100000)

n = int(input())
dat =[]
link = []
for i in range(n+1):
    link.append([])
cost = [-1] * (n + 1)

for i in range(n - 1):
    a, b, c = map(int, input().split())
    dat.append((a, b, c))
    link[a].append((b,c))
    link[b].append((a,c))

dat_q = []
q, k = map(int, input().split())

for i in range(q):
    x, y = map(int, input().split())
    dat_q.append((x,y))

#print(link)

def search(curcost, current):
    #print("cost{0}, pos {1}: ".format(curcost, current))
    cost[current] = curcost
    for npos, ncost in link[current]:
        if cost[npos] != -1:
            # 戻らない
            continue
        search(curcost + ncost, npos)

search(0, k)

#print(cost)
for i in range(q):
    x,y = dat_q[i]
    print(cost[x] + cost[y])
Buggy python submission (verdict: Runtime Error):
import math
math.log2(2)

Fixed submission:
import math
n = int(input())
curnum = 1
curmax = 0
for i in range(1, n + 1):
    c = int(math.log2(i))
    if c > curmax:
        curmax = c
        curnum = i
print(curnum)

Buggy python submission (verdict: Runtime Error):
import math
math.log2("hoge")

Fixed submission:
import math
n = int(input())
curnum = 1
curmax = 0
for i in range(1, n + 1):
    c = int(math.log2(i))
    if c > curmax:
        curmax = c
        curnum = i
print(curnum)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
curnum = 1
curmax = 0
for i in range(1, n + 1):
    c = int(math.log2(i))
    if c > curmax:
        curmax = c
        curnum = i
print(curnum)

Fixed submission:
import math
n = int(input())
curnum = 1
curmax = 0
for i in range(1, n + 1):
    c = int(math.log2(i))
    if c > curmax:
        curmax = c
        curnum = i
print(curnum)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
curnum = 1
curmax = 0
for i in range(1, n + 1):
    c = int(math.log2(i))
    if c > curmax:
        curmax = c
        curnum = i
print(curnum)

Fixed submission:
import math
n = int(input())
curnum = 1
curmax = 0
for i in range(1, n + 1):
    c = int(math.log2(i))
    if c > curmax:
        curmax = c
        curnum = i
print(curnum)
Buggy python submission (verdict: Runtime Error):
import math
n,m = map(int, input().split())
dat_n = []
dat_m = []
for i in range(n):
    a,b = map(int, input().split())
    dat_n.append((a, b))
for i in range(m):
    a,b = map(int, input().split())
    dat_m.append((a, b))
for i in range(n):
    a, b = dat_n[i]
    index = -1
    distance = math.inf
    for j in range(m):
        c,d = dat_m[j]
        t = abs(a-c) + abs(b-d)
        if t < distance:
            index = j + 1
            distance = t
    print(index)


Fixed submission:
n,m = map(int, input().split())
dat_n = []
dat_m = []
for i in range(n):
    a,b = map(int, input().split())
    dat_n.append((a, b))
for i in range(m):
    a,b = map(int, input().split())
    dat_m.append((a, b))
for i in range(n):
    a, b = dat_n[i]
    index = -1
    distance = 1000000001
    for j in range(m):
        c,d = dat_m[j]
        t = abs(a-c) + abs(b-d)
        if t < distance:
            index = j + 1
            distance = t
    print(index)
Buggy python submission (verdict: Runtime Error):
mod = 1000000000 + 7
 
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr
 
n = int(input())
dat = [0] * 2000 # 約数として求められたある数の合計
 
# N! の各要素の素因数分解をする
res = 1
for i in range(1, n + 1):
    d = factorization(i)
    for j in range(len(d)):
        dat[d[j][0]] += d[j][1]
 
for i in range(2, n + 1):
    res *= (dat[i] + 1)
    res %= mod
 
print(res)

Fixed submission:
a,b,c,d = map(int, input().split())
if a*b > c*d:
    print(a*b)
else:
    print(c*d)
Buggy python submission (verdict: Runtime Error):
import math
math.log2(2)

Fixed submission:
a,o,b = input().split()
a = int(a)
b = int(b)
if o == "+":
    print(a+b)
else:
    print(a-b)
Buggy python submission (verdict: Runtime Error):
    maze = []
    h, w = map(int,input().split())
    for _ in range(h):
        maze.append(list(input()))
    #print(maze)
    x,y = 0,0
    while True:
        maze[y][x] = "."
        if x == w-1 and  y == h-1:
            break
        if x != w-1 and maze[y][x+1]== "#":
            x += 1
            continue
        if y != h-1 and maze[y+1][x]=="#":
            y += 1
            continue
        break
    from pprint import pprint
    #pprint(maze)
    f= True
    for i in range(h):
        if maze[i].count("#") != 0:
            f = False
    print("Impossible" if not f else "Possible")


Fixed submission:
maze = []
h, w = map(int,input().split())
for _ in range(h):
    maze.append(list(input()))
#print(maze)
x,y = 0,0
while True:
    maze[y][x] = "."
    if x == w-1 and  y == h-1:
        break
    if x != w-1 and maze[y][x+1]== "#":
        x += 1
        continue
    if y != h-1 and maze[y+1][x]=="#":
        y += 1
        continue
    break
from pprint import pprint
#pprint(maze)
f= True
for i in range(h):
    if maze[i].count("#") != 0:
        f = False
print("Impossible" if not f else "Possible")
Buggy python submission (verdict: Runtime Error):
N=int(input())
DP=[0]*(N+1)
DP[3]=1
tmp=0
mod=10**9+7
for i in range(4,N+1):
   DP[i]=(DP[i-1]+DP[i-3])%mod
print(DP[N]%mod)

Fixed submission:
N=int(input())
DP=[0]*(N+1)
tmp=0
mod=10**9+7
if N<3:
   print(0)
   exit()
DP[3]=1
for i in range(4,N+1):
   DP[i]=(DP[i-1]+DP[i-3])%mod
print(DP[N]%mod)
Buggy python submission (verdict: Runtime Error):
A,B=list(map(int,input().split()))
B*=100
A=A*B
print(A//100)

Fixed submission:
A,B=input().split()
B=int(B.replace(".",""))
A=int(A)*B
print(A//100)
Buggy python submission (verdict: Time Limit Exceeded):
A = int(input())
listB = list(map(int,input().split()))
for i in range(1,A+1):
    print(listB.count(i))

Fixed submission:
A = int(input())
import collections
listB = list(map(int,input().split()))
listC = collections.Counter(listB)
for i in range(1,A+1):
    print(listC[i])
Buggy python submission (verdict: Runtime Error):
W,H=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
DP=[[201]*W for i in range(H)]
DP[0][0]=0
for y in range(H):
   for x in range(W):
      if x ==0 and y==0:
         DP[y][x] += 1 if l[y][x] == "#" else 0
         continue
      elif x == 0:
         DP[y][x] = DP[y-1][x]
      elif y == 0:
         DP[y][x] = DP[y][x-1]
      else:
         DP[y][x] = min(DP[y][x-1],DP[y-1][x])
      DP[y][x] += 1 if l[y][x] == "#" else 0
print(DP[H-1][W-1])

Fixed submission:
H,W=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
inf=10**9
DP=[[inf]*W for i in range(H)]
DP[0][0]=0 if l[0][0]=="." else 1
for i in range(H):
   for j in range(W):
      if i>0:
         DP[i][j]=min(DP[i][j],DP[i-1][j]+1) if l[i-1][j] == "." and l[i][j]=="#" else min(DP[i][j],DP[i-1][j])
      if j>0:
         DP[i][j]=min(DP[i][j],DP[i][j-1]+1) if l[i][j-1] == "." and l[i][j]=="#" else min(DP[i][j],DP[i][j-1])
print(DP[H-1][W-1])

Buggy python submission (verdict: Runtime Error):
W,H=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
DP=[[201]*W for i in range(H)]
DP[0][0]=0
for y in range(H):
   for x in range(W):
      if x ==0 and y==0:
         DP[x][y] += 1 if l[x][y] == "#" else 0
         continue
      elif x == 0:
         DP[x][y] = DP[x][y-1]
      elif y == 0:
         DP[x][y] = DP[x-1][y]
      else:
         DP[x][y] = min(DP[x-1][y],DP[x][y-1])
      DP[x][y] += 1 if l[x][y] == "#" else 0
print(DP[W-1][H-1])

Fixed submission:
H,W=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
inf=10**9
DP=[[inf]*W for i in range(H)]
DP[0][0]=0 if l[0][0]=="." else 1
for i in range(H):
   for j in range(W):
      if i>0:
         DP[i][j]=min(DP[i][j],DP[i-1][j]+1) if l[i-1][j] == "." and l[i][j]=="#" else min(DP[i][j],DP[i-1][j])
      if j>0:
         DP[i][j]=min(DP[i][j],DP[i][j-1]+1) if l[i][j-1] == "." and l[i][j]=="#" else min(DP[i][j],DP[i][j-1])
print(DP[H-1][W-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
A = deque(input())
B = int(input())
for i in range(B):
    C = sys.stdin.readline().split()
    if C[0] == "1":
        A.reverse()
    else:
        if C[1] == "1":
            A.appendleft(C[2])
        else:
            A.append(C[2])
print("".join(A))

Fixed submission:
A = input()
B = int(input())
C = ""
for i in range(B):
    D = input().split()
    if D[0] == "1":
        C,A = A,C
    else:
        if D[1] == "1":
            C += D[2]
        else:
            A += D[2]
C = C[::-1]
print(C+A)

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
A = deque(input())
B = int(input())
for i in range(B):
    C = sys.stdin.readline().split()
    if C[0] == "1":
        A.reverse()
    else:
		X = C[2]
        if C[1] == "1":
            A.appendleft(X)
        else:
            A.append(X)
print("".join(A))

Fixed submission:
A = input()
B = int(input())
C = ""
for i in range(B):
    D = input().split()
    if D[0] == "1":
        C,A = A,C
    else:
        if D[1] == "1":
            C += D[2]
        else:
            A += D[2]
C = C[::-1]
print(C+A)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
A = deque(input())
B = int(input())
for i in range(B):
    C = sys.stdin.readline().split()
    if C[0] == "1":
        A.reverse()
    else:
        if C[1] == "1":
            A.appendleft(C[2])
        else:
            A.append(C[2])
print("".join(A))

Fixed submission:
A = input()
B = int(input())
C = ""
for i in range(B):
    D = input().split()
    if D[0] == "1":
        C,A = A,C
    else:
        if D[1] == "1":
            C += D[2]
        else:
            A += D[2]
C = C[::-1]
print(C+A)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
A = input()
B = int(input())
for i in range(B):
    C = sys.stdin.readline().split()
    if C[0] == "1":
        A = A[::-1]
    else:
        if C[1] == "1":
            A=C[2]+A
        else:
            A=A+C[2]
print(A)

Fixed submission:
A = input()
B = int(input())
C = ""
for i in range(B):
    D = input().split()
    if D[0] == "1":
        C,A = A,C
    else:
        if D[1] == "1":
            C += D[2]
        else:
            A += D[2]
C = C[::-1]
print(C+A)
Buggy python submission (verdict: Runtime Error):
A = []
N,M = list(map(int,input().split()))
for i in range(M):
    A.append(list(input().split()))
for i in range(10 ** N):
    str_i = str(i)
    try:
        if N == len(str_i):
            for j,k in A:
                if str_i[int(j)-1] == k:
                    pass
                else:
                    break
            if str_i[int(j)-1] == k:
                print(i)
                exit()
    except IndexError:
        print("-1")
        exit()
print("-1")

Fixed submission:
A = []
N,M = list(map(int,input().split()))
if M == 0:
    if N == 1:
        print(0)
        exit()
    else:
        print("1" + "0"*(N-1))
        exit()
for i in range(M):
    A.append(list(input().split()))
for i in range(10 ** N):
    str_i = str(i)
    try:
        if N == len(str_i):
            for j,k in A:
                if str_i[int(j)-1] == k:
                    pass
                else:
                    break
            if str_i[int(j)-1] == k:
                print(i)
                exit()
    except IndexError:
        print("-1")
        exit()
print("-1")

Buggy python submission (verdict: Runtime Error):
A = []
N,M = list(map(int,input().split()))
for i in range(M):
    A.append(list(input().split()))
for i in range(10 ** N):
    str_i = str(i)
    if N == len(str_i):
        for j,k in A:
            if str_i[int(j)-1] == k:
                pass
            else:
                break
        if str_i[int(j)-1] == k:
            print(i)
            exit()
print("-1")

Fixed submission:
A = []
N,M = list(map(int,input().split()))
if M == 0:
    if N == 1:
        print(0)
        exit()
    else:
        print("1" + "0"*(N-1))
        exit()
for i in range(M):
    A.append(list(input().split()))
for i in range(10 ** N):
    str_i = str(i)
    try:
        if N == len(str_i):
            for j,k in A:
                if str_i[int(j)-1] == k:
                    pass
                else:
                    break
            if str_i[int(j)-1] == k:
                print(i)
                exit()
    except IndexError:
        print("-1")
        exit()
print("-1")
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
listA = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
print(c[0][0])
for i in range(1,N+1):
    if max_number == c[i][1]:
        print(c[i][0])
    else:
        exit()

Fixed submission:
import collections
N = int(input())
listA = []
listB = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
listB.append(c[0][0])
A = len(c)
for i in range(1,A):
    if max_number == c[i][1]:
        listB.append(str(c[i][0]))
    else:
        break
listB.sort()
for i in listB:
    print(i)
Buggy python submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
R = list(map(int,input().split()))
R.sort(reverse=True)
for i in range(K):
    R[i] = 0
print(sum(R))

Fixed submission:
N,K = list(map(int,input().split()))
R = list(map(int,input().split()))
R.sort(reverse=True)
if N < K:
    print(0)
    exit()
for i in range(K):
    R[i] = 0
print(sum(R))

Buggy python submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
R = list(map(int,input().split()))
R.sort(reverse=True)
for i in range(K):
    R.pop(0)
print(sum(R))

Fixed submission:
N,K = list(map(int,input().split()))
R = list(map(int,input().split()))
R.sort(reverse=True)
if N < K:
    print(0)
    exit()
for i in range(K):
    R[i] = 0
print(sum(R))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
    B = set(A[0:i+1])
    if A[i] == min(B):
        count += 1
print(count)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count = 0
min_number = A[0]
for i in range(N):
    if A[i] <= min_number:
        min_number = A[i]
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
    if A[i] == min(A[0:i+1]):
        count += 1
print(count)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count = 0
min_number = A[0]
for i in range(N):
    if A[i] <= min_number:
        min_number = A[i]
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
list_number = list(map(int,input().split(" ")))
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
number_max = lcm_list(list_number)
newlist = list(map(lambda x: number_max // x, list_number))
print(sum(newlist) % 1000000007)

Fixed submission:
import fractions
N = int(input())
list_number = list(map(int,input().split(" ")))
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)
number_max = lcm_list(list_number)
newlist = list(map(lambda x: number_max // x, list_number))
print(sum(newlist) % 1000000007)
Buggy python submission (verdict: Runtime Error):
A = int(input())
i = 0
S = 0
B = int(math.sqrt(A))
while i == 0:
    S = 0
    B = int(math.sqrt(A))
    for n in range(2,B + 1):
        if A % n == 0:
            A += 1
            S = 1
            break
    if S == 0:
        print(A)
        exit()

Fixed submission:
import math
A = int(input())
i = 0
S = 0
B = int(math.sqrt(A))
while i == 0:
    S = 0
    B = int(math.sqrt(A))
    for n in range(2,B + 1):
        if A % n == 0:
            A += 1
            S = 1
            break
    if S == 0:
        print(A)
        exit()

Buggy python submission (verdict: Runtime Error):
A = int(input())
i = 0
S = 0
B = int(math.sqrt(A))
while i == 0:
    S = 0
    B = int(math.sqrt(A))
    for n in range(2,B + 1):
        if A % n == 0:
            A += 1
            S = 1
            break
    if S == 0:
        print(A)
        exit()

Fixed submission:
import math
A = int(input())
i = 0
S = 0
B = int(math.sqrt(A))
while i == 0:
    S = 0
    B = int(math.sqrt(A))
    for n in range(2,B + 1):
        if A % n == 0:
            A += 1
            S = 1
            break
    if S == 0:
        print(A)
        exit()
Buggy python submission (verdict: Runtime Error):
S = input().split(" ")
N = S[0]
A = S[1]
B = S[2]
C = B - A
if C % 2 == 0:
	print(C // 2)
	exit()
print(min(B - 1,N - A))

Fixed submission:
N,A,B = list(map(int,input().split(" ")))
C = B - A
count = 0
if C % 2 == 0:
    print(str(C // 2))
else:
    count += min(A - 1,N - B)
    count += (C - 1) // 2
    print(str(count + 1))
Buggy python submission (verdict: Runtime Error):
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = fractions.gcd(A,B)
print(round(C / D))

Fixed submission:
from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)

Buggy python submission (verdict: Runtime Error):
import math
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = math.gcd(A,B)
print(round(C / D))

Fixed submission:
from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)

Buggy python submission (verdict: Runtime Error):
import math
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = math.gcd(A,B)
print(C // D)

Fixed submission:
from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)

Buggy python submission (verdict: Runtime Error):
import math
X = input().split(" ")
A = int(X[0])
B = int(X[1])
print(str(A * B // math.gcd(A,B)))

Fixed submission:
from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)

Buggy python submission (verdict: Runtime Error):
import math
X = input().split(" ")
A = int(X[0])
B = int(X[1])
print(str(A * B // math.gcd(A,B)))

Fixed submission:
from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)
Buggy python submission (verdict: Runtime Error):
A = list(input())
B = round(len(A) / 2)
A.pop(B - 1)
R = 0
C = A[0:B-1]
D = A[-(B - 1):]
D.sort(reverse=True)
count = 0
for i in range(B - 1):
	if C[count] != D[count]:
	R += 1
	count += 1
print(str(R))

Fixed submission:
A = list(input())
import math
B = math.ceil(len(A) / 2)
R = 0
C = A[0:B]
D = A[-B:]
D = D[::-1]
count = 0
for i in range(B):
	if C[count] != D[count]:
		R += 1
	count += 1
print(str(R))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))
ans=0
mod=10**9+7
for i in range(1,61):
   zero,one=0,0
   for j in S:
      tmp=bin(j)[2:]
      tmp=tmp.zfill(60)
      if tmp[-i]=="1":
         one+=1
      else:
         zero+=1
   s=pow(2,i-1,mod)
   ans+=s*zero*one%mod
   ans%=mod
print(ans)

Fixed submission:
import numpy as np 
N=int(input())
a=np.array(list(map(int, input().split())))
ans=0
mod=10**9+7
for i in range(60):
   s=np.count_nonzero(a>>i&1)
   ans+=pow(2,i,mod)*s*(N-s)%mod
   ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))
ans=0
mod=10**9+7
for i in range(1,61):
   zero,one=0,0
   for j in S:
      tmp=bin(j)[2:]
      tmp=tmp.zfill(60)
      if tmp[-i]=="1":
         one+=1
      else:
         zero+=1
   ans+=(2**(i-1)*zero*one)%mod
   ans%=mod
print(ans)

Fixed submission:
import numpy as np 
N=int(input())
a=np.array(list(map(int, input().split())))
ans=0
mod=10**9+7
for i in range(60):
   s=np.count_nonzero(a>>i&1)
   ans+=pow(2,i,mod)*s*(N-s)%mod
   ans%=mod
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
Dictionary = {"SAT":1,"FRI":2,"THU":3,"WED":4,"TUE":5,"MON":6,"SUN":7}
Day = Dictionary[S]
print(DAY)


Fixed submission:
S = input()
Dictionary = {"SAT":1,"FRI":2,"THU":3,"WED":4,"TUE":5,"MON":6,"SUN":7}
Day = Dictionary[S]
print(Day)
Buggy python submission (verdict: Time Limit Exceeded):
A=int(input())
l=list(map(int,input().split()))
n=set()
for i in range(A-1):
    n.add(abs(sum(l[:i+1])-sum(l[i+1:])))
print(min(n))

Fixed submission:
A=int(input())
l=list(map(int,input().split()))
right=l[0]
left=sum(l[1:])
ans=left-right
for i in range(A-2):
    right+=l[i+1]
    left-=l[i+1]
    ans=min(ans,abs(right-left))
print(ans)