Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
result = 0
ary = list(map(int,input().split()))
miss = False
i = 1
while(True):
  if (i not in ary):
    if (i == 1):
      miss = True
    break
  b = ary.index(i)
  i += 1
  ary = ary[b+1:]

if miss:
  print(-1)
else:
  print(x - i + 1)
    

Fixed submission:
x = int(input())
result = 0
ary = list(map(int,input().split()))
miss = False
res = 1
for i in range(x):
  if (res == ary[i]):
    res += 1
print(-1 if res-1 == 0 else x - res + 1)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
result = 0
ary = list(map(int,input().split()))
miss = False
i = 1
while(True):
  if (i not in ary):
    if (i == 1):
      miss = True
    break
  b = ary.index(i)
  i += 1
  ary = ary[b+1:]

if miss:
  print(-1)
else:
  print(x - i + 1)


Fixed submission:
x = int(input())
result = 0
ary = list(map(int,input().split()))
miss = False
res = 1
for i in range(x):
  if (res == ary[i]):
    res += 1
print(-1 if res-1 == 0 else x - res + 1)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
result = 0
ary = list(map(int,input().split()))
broken = 0
i = 1
while(True):
#  print("----")
#  print(ary)
#  print("i:",i)
  if (i not in ary):
    if (i == 1):
      broken = -1
      break
    else:
      broken += len(ary)
      break
  b = ary.index(i)
  broken += b
#  print("b:",b)
#  print("broken:",broken)
  i += 1
  ary = ary[b+1:]
  if (i+broken > x):
    break
print(broken)
    

Fixed submission:
x = int(input())
result = 0
ary = list(map(int,input().split()))
miss = False
res = 1
for i in range(x):
  if (res == ary[i]):
    res += 1
print(-1 if res-1 == 0 else x - res + 1)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  d = {}
  input()
  l = list(map(int, input().split()))
  for i in range(len(l)):
    d[l[i]] = i+1
  result = ""
  for i in range(len(l)):
    result = result + str(d[i+1]) + " "
  print(result.rstrip())

main()

Fixed submission:
def main():
  d = {}
  input()
  l = list(map(int, input().split()))
  result_list = [0] * len(l)
  for i in range(len(l)):
    result_list[l[i] - 1] = i+1
  print(' '.join(map(str,result_list)))

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

a, b = [0], [0]
for i in range(N):
    a.append[a[i] + A[i]]
for i in range(M):
    b.append[b[i] + B[i]]

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
    


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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
Buggy python submission (verdict: Runtime Error):
a = input()
big = range('A', 'Z')

if big.include(a):
    print 'A'
else:
    print 'a'


Fixed submission:
a = input()

if a.islower():
    print('a')
else:
    print('A')
Buggy python submission (verdict: Runtime Error):
a, b = map(int(intput().split()))
print(a * b)


Fixed submission:
a, b = map(int, input().split())
print(a * b)

Buggy python submission (verdict: Runtime Error):
a, b = int(intput().split())
print(a * b)


Fixed submission:
a, b = map(int, input().split())
print(a * b)
Buggy python submission (verdict: Runtime Error):
a = int(input())

while a > 10:
    a = a % 10

if a == 2 or a == 4 or a == 5 or a == 7 or a == 9
    print("hon")
elif a == 0 or a == 1 or a == 6 or a == 8:
    print("pon" )
else:
    print("bon" )


Fixed submission:
a = int(input())

while a > 10:
    a = a % 10

if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:
    print("hon")
elif a == 0 or a == 1 or a == 6 or a == 8:
    print("pon" )
else:
    print("bon" )
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

if S.length == 0 or S.length >= 11:
    print("No" )
else:
    for i in range(S.length):
        if S[i] !=  T[i]:
            return print("No")
        
    if T.length == S.length + 1:
        print("Yes" )
  


Fixed submission:
S = input()
T = input()

print("Yes" if S == T[:-1] else "No" )

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

if S.length == 0 || S.length >= 11:
    print("No" )
else:
    for i in range(S.length):
        if S[i] !=  T[i]:
            return print("No")
        
    if T.length == S.length + 1:
        print("Yes" )
  


Fixed submission:
S = input()
T = input()

print("Yes" if S == T[:-1] else "No" )
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().slice())
print("OK" if B - A >= K else "NG")


Fixed submission:
K = int(input())
A, B = map(int, input().split())
large = (B // K) * K
if A <= large:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
import math
X = int(input())
Y = 100
count = 0
while Y =< X:
    Y = math.floor(Y * 1.01)
    count += 1

print(count)



Fixed submission:
import math
X = int(input())
Y = 100
count = 0
while Y < X:
    Y = Y + Y // 100
    count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())   
x = [input() for i in range(3)]
print(len(list(set(x))))



Fixed submission:
n = int(input())   
x = [input() for i in range(n)]
print(len(list(set(x))))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
print(list(set(s)).length)



Fixed submission:
n = int(input())   
x = [input() for i in range(n)]
print(len(list(set(x))))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(n - 1):
    ans[A[i] - 1] += 1
for i in range(n):
    print(ans[i])



Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N - 1):
    ans[A[i] - 1] += 1
for i in range(N):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
i = 0
while i < N:
    num = 0
    for j in A:
        if j == i + 1:
            num += 1
    i += 1
    print(num)    



Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N - 1):
    ans[A[i] - 1] += 1
for i in range(N):
    print(ans[i])

Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
i = 0
while i < N:
    num = 0
    for i in len(A):
        if A[i] == i + 1:
            num += 1
    print(num)    



Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N - 1):
    ans[A[i] - 1] += 1
for i in range(N):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T=int(input())

if(A<B):
  if(B+W*T <= A+V*T):
    print("YES")
  else:
    print("NO")
elif(B<A):
    if(A-V*T <= B-W*T):
    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):
  if(B+W*T <= A+V*T):
    print("YES")
  else:
    print("NO")
elif(B<A):
  if(A-V*T <= B-W*T):
    print("YES")
  else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
X=int(input())
N=10**3
i=-10
res=[]

while(i<N):
  j=-10
  while(j<N):
    if(i**5 - j**5==X):
      res.append(i)
      res.append(j)
      break
    j+=1
  if(1<len(res)):
    break
  i+=1

print(str(res[0])+" " +str(res[1]))

Fixed submission:
X=int(input())
N=10**3
i=-1000
res=[]

while(i<N):
  j=-1000
  while(j<N):
    if(i**5 - j**5==X):
      res.append(i)
      res.append(j)
      break
    j+=1
  if(1<len(res)):
    break
  i+=1

print(str(res[0])+" " +str(res[1]))
Buggy python submission (verdict: Runtime Error):
K=int(input())
A, B = map(int, input().split())
a=A//K
b=A%K
c=B%K

if(b==0 or c==0):
  print("OK")
else:
  if(1<a):
    if(a*K<=B):
      print("OK")
    else:
      print("NG")
  else:
    print("NG")
~                  

Fixed submission:
K=int(input())
A, B = map(int, input().split())
a=A//K
b=A%K
c=B%K

if(b==0 or c==0):
  print("OK")
else:
  if(1<a):
    if(a*K<=B):
      print("OK")
    else:
      print("NG")
  else:
    print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list = list(map(int, input().split()))
i=1
res=0

for i in range(1,N+1):
  j=list.count(i)
  res+=j
  print(j)
  if(res>N):
    break
  i+=1

Fixed submission:
from collections import Counter

N=int(input())
list = list(map(int, input().split()))
i=1
counter = Counter(list)

for i in range(1,N+1):
  print(counter[i])

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

for i in range(1,N+1):
  print(list.count(i))
  i+=1

Fixed submission:
from collections import Counter

N=int(input())
list = list(map(int, input().split()))
i=1
counter = Counter(list)

for i in range(1,N+1):
  print(counter[i])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list = list(map(int, input().split()))
res = []
i=1

for i in range(1,N+1):
  res.append(list.count(i))
  i+=1

j=0
for j in range(0,len(res)):
  print(str(res[j]))
  j+=1

Fixed submission:
from collections import Counter

N=int(input())
list = list(map(int, input().split()))
i=1
counter = Counter(list)

for i in range(1,N+1):
  print(counter[i])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list = list(map(int, input().split()))
res = []
i=1

while(i<N+1):
  res.append(list.count(i))
  i+=1

k=0
while(k<len(res)):
  print(str(res[k]))
  k+=1

Fixed submission:
from collections import Counter

N=int(input())
list = list(map(int, input().split()))
i=1
counter = Counter(list)

for i in range(1,N+1):
  print(counter[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

r=0

if(N<K):
  if(abs(N-K)<N):
    r=abs(N-K)
  else:
    r=N

elif(K==1):
   r=0

elif(K<N):
  while(0<N):
    r=abs(N-K)
    N=N-K

print(r)

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

r=0

if(N<K):
  if(abs(N-K)<N):
    r=abs(N-K)
  else:
    r=N

elif(K==1):
   r=0

elif(K<N):
  a=N//K
  N=N-K*a
  while(0<N):
    r=abs(N-K)
    N=N-K

print(r)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int, input().split())

if(a>=c or b>=c):
  print("No")
else:
  r=round(math.sqrt(a),1000000000) + round(math.sqrt(b),1000000000)
  s=round(math.sqrt(c),1000000000)

  if(r<s):
    print("Yes")
  else:
    print("No")

Fixed submission:
K=int(input())

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 3, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[K-1])
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

r=N//(A+B)
s=N%(A+B)

if(B=0):
  t=N//A + N%A

else:
  if(A!=0):
    t=(A*r)+s
  else:
    t=0

print(t)

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

if(A==0 & B==0):
  print("0")

else:
  r=N//(A+B)
  s=N%(A+B)
  if(A<s):
    s=A
  if(A!=0):
    t=(A*r)+s
  else:
    t=0
  print(t)

Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split())
list=[]
m=0

def add(i,j):
  while(i<A):
    list.append("b")
    i+=1

  while(j<B):
    list.append("r")
    j+=1

while(m<N):
    i=0
    j=0
    add(i,j)
    m+=A
    m+=B

l=list[0:N]
r=l.count("b")
print(r)

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

if(A==0 & B==0):
  print("0")

else:
  r=N//(A+B)
  s=N%(A+B)
  if(A<s):
    s=A
  if(A!=0):
    t=(A*r)+s
  else:
    t=0
  print(t)
Buggy python submission (verdict: Time Limit Exceeded):
l=int(input())
list = list(map(int, input().split()))

i=0
r="YES"

while(i<l):
  j=i+1
  while(j<l):
    if(list[i]==list[j]):
      r="NO"
    j+=1
  i+=1

print(r)

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

def has_duplicates(seq):
    return len(seq) != len(set(seq))

r=has_duplicates(list)

if(str(r)=="False"):
  print("YES")
else:
  print("NO")

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

i=0
r="YES"

while(i<l):
  j=i
  while(j<l):
    if(i!=j):
      if(list[i]==list[j]):
        r="NO"
    j+=1
  i+=1

print(r)

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

def has_duplicates(seq):
    return len(seq) != len(set(seq))

r=has_duplicates(list)

if(str(r)=="False"):
  print("YES")
else:
  print("NO")

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

i=0
r="YES"

while(i<l):
  j=0
  while(j<l):
    if(i!=j):
      if(list[i]==list[j]):
        r="NO"
    j+=1
  i+=1

print(r)

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

def has_duplicates(seq):
    return len(seq) != len(set(seq))

r=has_duplicates(list)

if(str(r)=="False"):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())

list = list(map(int, input().split()))

i=0

r=0

while(i<3):
  r+=list[i]
  i+=1

if(h<=r):
  print("Yes")
else:
  print("No")


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

list = list(map(int, input().split()))

i=0
r=0

while(i<n):
  r+=list[i]
  i+=1

if(h<=r):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
print("please input W")
w=int(input())

print("please input N")
n=int(input())

i=0
j=0

if(h>=w):
  s=h
else:
  s=w

while j<n:
  i+=1
  j=j+s

print(i)

Fixed submission:
h=int(input())

w=int(input())

n=int(input())

i=0
j=0

if(h>=w):
  s=h
else:
  s=w

while j<n:
  i+=1
  j=j+s

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

import itertools
c = itertools.combinations(p, K)
L = [sum(item) for item in c]
print(min(L))

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

p.sort()
print(sum(p[:K]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in range(N):
    ans = ans*A[i]
# print(len(str(ans))-1)
if ans<=10**18:
    print(ans)
else:
    print(-1)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = 1
Flag = True
zero_flag = False
for i in range(N):
    if A[i]==0:
        zero_flag = True
        break
for i in range(N):
    ans = ans*A[i]
    if ans > 10**18:
        Flag = False
        break
        
# print(len(str(ans))-1)
if zero_flag:
    print(0)
elif ans<=10**18 or Flag:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int,input().split())
abcd = []
for i in range(Q):
    abcd.append(list(map(int,input().split())))
abcd.sort()

import itertools
LIST = []
for i in range(1,M+1):
    LIST.extend([i for j in range(N)])
A = list(itertools.combinations(LIST,N))
# print(A)
ans = 0
for item in A:
    tmp = 0
    for req in abcd:
        if item[req[1]-1] - item[req[0]-1] == req[2]:
            tmp+= req[3]
    ans = max(ans,tmp)
print(ans)

Fixed submission:
N,M,Q = map(int,input().split())
abcd = []
for i in range(Q):
    abcd.append(list(map(int,input().split())))
abcd.sort()

import itertools
A = list(itertools.combinations_with_replacement(range(1,M+1),N))
# print(A)
ans = 0
for item in A:
    tmp = 0
    for req in abcd:
        if item[req[1]-1] - item[req[0]-1] == req[2]:
            tmp+= req[3]
    ans = max(ans,tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
import collections

c = collections.Counter(A)
keys = c.keys()
ans_dict = {}
ans_dict2 = {}
for key in keys:
    ans_dict[key] = cmb(c[key]-1,2)
    ans_dict2[key] = cmb(c[key],2)

SUM  = sum(ans_dict2.values())

# print(ans_dict)
# print(ans_dict2)

for key in A:
    print(SUM-ans_dict2[key]+ans_dict[key])

Fixed submission:
def cmb(n, r):
    if r > n: return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

N = int(input())
A = list(map(int,input().split()))
import collections

c = collections.Counter(A)
keys = c.keys()
ans_dict = {}
ans_dict2 = {}
for key in keys:
    ans_dict[key] = cmb(c[key]-1,2)
    ans_dict2[key] = cmb(c[key],2)

SUM  = sum(ans_dict2.values())

# print(ans_dict)
# print(ans_dict2)

for key in A:
    print(SUM-ans_dict2[key]+ans_dict[key])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
    S.append(input())
MAX = 0

import collections
c =  collections.Counter(S)
MAX = max(c.values())
SET = []
for i in range(N):
    if S.count(S[i])==MAX:
        SET.append(S[i])
SET = list(set(SET))
SET.sort()
for item in SET:
    print(item)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(input())
MAX = 0

import collections
c =  collections.Counter(S)
MAX = max(c.values())
SET = []
for i in range(N):
    if c[S[i]]==MAX:
        SET.append(S[i])
SET = list(set(SET))
SET.sort()
for item in SET:
    print(item)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
    S.append(input())
MAX = 0
for i in range(N):
    MAX = max(S.count(S[i]),MAX)
SET = []
for i in range(N):
    if S.count(S[i])==MAX:
        SET.append(S[i])
SET = list(set(SET))
SET.sort()
for item in SET:
    print(item)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(input())
MAX = 0

import collections
c =  collections.Counter(S)
MAX = max(c.values())
SET = []
for i in range(N):
    if c[S[i]]==MAX:
        SET.append(S[i])
SET = list(set(SET))
SET.sort()
for item in SET:
    print(item)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))

S = []
for i in range(N):
    S.append(sum(range(p[i]+1))/p[i])

DP = [0 for i in range(N+1)]
SS = sum(S[:K])

for i in range(K):
    DP[i] = SS
# print(DP)
for i in range(K,N):
    DP[i] = DP[i-1]-S[i-K]+S[i]
# print(S)
# print(DP)
print(max(DP))

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

S = []
for i in range(N):
    S.append(sum(range(p[i]+1))/p[i])

DP = [0 for i in range(N+1)]
SS = sum(S[:K])

for i in range(K):
    DP[i] = SS
# print(DP)
for i in range(K,N):
    DP[i] = DP[i-1]-S[i-K]+S[i]
# print(S)
# print(DP)
print(max(DP))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = ''
if a> b:
    for i in range(len(b)):
        s = s+str(a)
else:
    for i in range(len(a)):
        s = s+str(b)
print(s)

Fixed submission:
a,b = map(int,input().split())
s = ''
if a> b:
    for i in range(a):
        s = s+str(b)
else:
    for i in range(b):
        s = s+str(a)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
import numpy as np
MAX = max(A)
BIG = 10**9+7
L = len(bin(MAX)[2:])
ans = 0
for j in range(L):
    zero = 0
    one = 0
    for i in range(N):
        if (A[i] >> j) & 1:
            one+=1
        else:
            zero+=1
    ans += ((zero*one)%BIG)*pow(2,j,BIG)
    ans = ans%BIG
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
BIG = 10**9+7
L = len(bin(MAX)[2:])
ans = 0
for j in range(L):
    zero = 0
    one = 0
    for i in range(N):
        if (A[i] >> j) & 1:
            one+=1
        else:
            zero+=1
    ans += ((zero*one)%BIG)*pow(2,j,BIG)
    ans = ans%BIG
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
import numpy as np
MAX = max(A)
BIG = 10**9+7
L = len(bin(MAX)[2:])
ans = 0
for j in range(L):
    zero = 0
    one = 0
    for i in range(N):
        if (A[i] >> j) & 1:
            one+=1
        else:
            zero+=1
    ans += ((zero*one)%BIG)*2**j 
    ans = ans%BIG
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
BIG = 10**9+7
L = len(bin(MAX)[2:])
ans = 0
for j in range(L):
    zero = 0
    one = 0
    for i in range(N):
        if (A[i] >> j) & 1:
            one+=1
        else:
            zero+=1
    ans += ((zero*one)%BIG)*pow(2,j,BIG)
    ans = ans%BIG
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
import numpy as np
MAX = max(A)
BIG = 10**9+7
L = len(bin(MAX)[2:])
ans = 0
for j in range(L):
    zero = 0
    one = 0
    for i in range(N):
        if (A[i] >> j) & 1:
            one+=1
        else:
            zero+=1
    ans += zero*one*2**j
    ans = ans%BIG
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
BIG = 10**9+7
L = len(bin(MAX)[2:])
ans = 0
for j in range(L):
    zero = 0
    one = 0
    for i in range(N):
        if (A[i] >> j) & 1:
            one+=1
        else:
            zero+=1
    ans += ((zero*one)%BIG)*pow(2,j,BIG)
    ans = ans%BIG
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
import itertools
N = int(input())
x = []
y = []
for i in range(N):
    s1,s2 = map(int,input().split())
    x.append(s1)
    y.append(s2)
    
def length(i,j):
    return np.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)

LI = [i for i in range(N)]
A = list(itertools.permutations(LI))
ans = 0
for item in A:
#     print(item)
    count = 0
    for i in range(len(item)):
        if i == len(item)-1:
            break
#         print(length(item[count],item[count+1]))
        ans = ans+length(item[count],item[count+1])
        count +=1
print(ans/math.factorial(N))

Fixed submission:
import math
# import numpy as np
import itertools
N = int(input())
x = []
y = []
for i in range(N):
    s1,s2 = map(int,input().split())
    x.append(s1)
    y.append(s2)
    
def length(i,j):
    return math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)

LI = [i for i in range(N)]
A = list(itertools.permutations(LI))
ans = 0
for item in A:
#     print(item)
    count = 0
    for i in range(len(item)):
        if i == len(item)-1:
            break
#         print(length(item[count],item[count+1]))
        ans = ans+length(item[count],item[count+1])
        count +=1
print(ans/math.factorial(N))
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
import numpy as np
if x<=(a*a*b)/2:
    A = 2*x/(a*b*b)
    Z = A
    print(A)
    print(np.arctan(Z)*180/(np.pi))
else:
    A = a*a*b-x
    B = (a*a)/A
    Z = B
    print(np.arctan(Z)*180/np.pi)

Fixed submission:
import math
a,b,x = map(int,input().split())
if x/(a*a) <= (b/2):
    ans = 2*x/(a*b*b)
    print(90-math.degrees(math.atan(ans)))
else:
    ans = (2*a*a*b-2*x)/(a*a*a)
    print(math.degrees(math.atan(ans)))