Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len & i==a_len:
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")

Fixed submission:
a = input()
b = input()

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len and i==a_len-1:
        huku.append(a[i])
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")
Buggy python submission (verdict: Runtime Error):
def strToList(str,offset=0):
    res = [];
    for el in str.split(" "):
        if el!='':
            res.append(int(el)+offset)
    return res


[N,M,K] = strToList(input())
A = strToList(input())
B = strToList(input())

current_time = 0
current_value = 0
iA = 0
iB = 0

while iA<N:
    if current_time+A[iA]<=K:
        current_time+=A[iA]
        current_value+=1
        iA+=1
    else:
        break

max_value = current_value

while iA>=0 and iB<M:
    if current_time+B[iB]<=K:
        current_time+=B[iB]
        iB+=1
        current_value+=1
        if current_value>max_value:
            max_value=current_value
    else:
        current_time-=A[iA]
        iA-=1
        current_value-=1

print(max_value)


Fixed submission:
def strToList(str,offset=0):
    res = [];
    for el in str.split(" "):
        if el!='':
            res.append(int(el)+offset)
    return res


[N,M,K] = strToList(input())
A = strToList(input())
B = strToList(input())

current_time = 0
current_value = 0
iA = 0
iB = 0

while iA<N:
    if current_time+A[iA]<=K:
        current_time+=A[iA]
        current_value+=1
        iA+=1
    else:
        break

max_value = current_value
iA-=1

while iA>-2 and iB<M:
    if current_time+B[iB]<=K:
        current_time+=B[iB]
        iB+=1
        current_value+=1
        if current_value>max_value:
            max_value=current_value
    else:
        current_time-=A[iA]
        iA-=1
        current_value-=1

print(max_value)
Buggy python submission (verdict: Runtime Error):
from math import gcd
mod = 10 ** 9 + 7
n, m, t = map(int, input().split())
a = gcd(n, t)
b = gcd(m, t)
n //= a
m //= b
ret = pow(2, n, mod) + pow(2, m, mod) + pow(2, gcd(n, m), mod) - 3
print(pow(ret, a * b, mod))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7
n, m, t = map(int, input().split())
a = gcd(n, t)
b = gcd(m, t)
n //= a
m //= b
ret = pow(2, n, mod) + pow(2, m, mod) + pow(2, gcd(n, m), mod) - 3
print(pow(ret, a * b, mod))
Buggy python submission (verdict: Runtime Error):
n , m = map(float ,input().split())
n = int(n)
ans = str(n * (m * 100)) // 100

print(ans[:ans.find('.')])

Fixed submission:
a, b = input().split()
a = int(a)
b = int(b.replace(".",""))

c = a * b
ans = c//100
print(ans)

Buggy python submission (verdict: Runtime Error):
n , m = map(float ,input().split())
n = int(n)
ans = str(n * (m * 100)) / 100

print(ans[:ans.find('.')])

Fixed submission:
a, b = input().split()
a = int(a)
b = int(b.replace(".",""))

c = a * b
ans = c//100
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n, -1 ,-1):
	if s[i] == 'W':
		ans += sum[i]
print(ans)
	

Fixed submission:
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n - 1, -1 ,-1):
	if s[i] == 'W':
		ans += sum[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n, -1 ,-1):
	print(i)
	if s[i] == 'W':
		ans += sum[i]
print(ans)
	

Fixed submission:
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n - 1, -1 ,-1):
	if s[i] == 'W':
		ans += sum[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
price1 = min(a) + min(b)

for _ in range(M):
  x, y, c = map(int,input().split())
  price2 = a[x-1] + a[y-1] - c
  if price1 > price2:
    price1 = price2
print(price1)

Fixed submission:
A, B, M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
price1 = min(a) + min(b)

for _ in range(M):
  x, y, c = map(int,input().split())
  price2 = a[x-1] + b[y-1] - c
  if price1 > price2:
    price1 = price2
print(price1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
alphabet = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'
alphabet_num = {st: num for num, st in enumerate(alphabet)}
alphabet_list = [st for st in alphabet]

for s in S:
  num = (alphabet_num[s] + N) % 26
  print(alphabet_list[num], end+'')

Fixed submission:
N = int(input())
S = input()
alphabet = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'
alphabet_num = {st: num for num, st in enumerate(alphabet)}
alphabet_list = [st for st in alphabet]

output = ''
for s in S:
  num = (alphabet_num[s] + N) % 26
  output += alphabet_list[num]
print(output)
Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split()))
print(SUM(A) - MAX(A))

Fixed submission:
A = list(map(int,input().split()))
print(sum(A)-max(A))
Buggy python submission (verdict: Runtime Error):
x = input(int())
for i in range(2, 10):
  if 200*i <= x < 200*(i+1)-1:
    pprint(10-i)

Fixed submission:
x = int(input())
for i in range(2,10):
  if 200*i <= x < 200*(i+1):
    print(10-i)
Buggy python submission (verdict: Runtime Error):
n, k = int(input().split())
a = list(map(int, input().split()))
for i in range(n-k-1):
    ab = a[i]*a[k-1+i]
    aa = a[i+1]*a[k+i]
    if aa > ab:
        print("Yes")
    else:
        print("No")




    
    


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n-k):
    ab = a[i]
    aa = a[k+i]
    if aa > ab:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
s=raw_input()
k=len(s)/2+1
lef=(len(s)-1)/2
ch=s[lef]
rig=(len(s))/2
while 0<=lef and rig<len(s):
    if s[lef]==s[rig] and ch==s[lef]:
        lef-=1
        rig+=1
        k+=1
    else:
        k-=1
        break
print(k)

Fixed submission:
s=raw_input()
k=len(s)/2+1
lef=(len(s)-1)/2
ch=s[lef]
rig=(len(s))/2
while 0<=lef and rig<len(s):
    if s[lef]==s[rig] and ch==s[lef]:
        k+=1
        lef-=1
        rig+=1
    else:
        k-=1
        break
print(k-(lef==-1))
Buggy python submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
cand1=abs(a[-1]-a[-2])
cand2=abs(a[-1]-w)
res=max(cand1,cand2)
print(res)

Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
print(max(abs(a[-2]-a[-1]),abs(a[-1]-w)) if n>=2 else abs(a[-1]-w))

Buggy python submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
cand1=abs(a[-1]-a[-2])
cand2=abs(a[-1]-w)
res=max(cand1,cand2)
print(res)

Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
print(max(abs(a[-2]-a[-1]),abs(a[-1]-w)) if n>=2 else abs(a[-1]-w))
Buggy python submission (verdict: Runtime Error):
def main():
    import math
    n,k=map(int,input().split(" "))
    a=map(int,input().split(" "))
    g=a[0]
    m=max(a)
    for i in range(n):
        g=math.gcd(g,a[i])
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Fixed submission:
def gcd(a,b):
    if a==0: return b
    else: return gcd(b%a,a)

def main():
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=a[0]
    for e in a:
        g=gcd(g,e)
        if m<e: m=e
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Buggy python submission (verdict: Runtime Error):

def main():
    import math
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=max(a)
    for i in range(n):
        g=math.gcd(g,a[i])
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Fixed submission:
def gcd(a,b):
    if a==0: return b
    else: return gcd(b%a,a)

def main():
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=a[0]
    for e in a:
        g=gcd(g,e)
        if m<e: m=e
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Buggy python submission (verdict: Runtime Error):
import math
n,k=map(int,input().split(" "))
a=list(map(int,input().split(" ")))
g=a[0]
m=max(a)
for i in range(n):
    g=math.gcd(g,a[i])
if k % g==0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
def gcd(a,b):
    if a==0: return b
    else: return gcd(b%a,a)

def main():
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=a[0]
    for e in a:
        g=gcd(g,e)
        if m<e: m=e
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Buggy python submission (verdict: Runtime Error):
import math
n,k=map(int,input().split(" "))
a=list(map(int,input().split(" ")))

g=a[0]
m=a[0]
for i in range(n):
    g=math.gcd(g,a[i])
    m=max(a[i],m)

if k % g==0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
def gcd(a,b):
    if a==0: return b
    else: return gcd(b%a,a)

def main():
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=a[0]
    for e in a:
        g=gcd(g,e)
        if m<e: m=e
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()
Buggy python submission (verdict: Runtime Error):
n=input()
k=input()
x=input()
y=input()
if n>k:
    n-=k
else:
    k=n
    n=0
print(k*x+n*y)


Fixed submission:
n=input()
k=input()
x=input()
y=input()
if n>k:
    n-=k
else:
    k=n
    n=0
print(k*x+n*y)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce

def find_lcm(denominators):
    return reduce(lambda a,b: a*b // gcd(a,b), denominators)

def solve(nums):
    modula = 10**9 + 7
    lcm = find_lcm(nums)

    bs = []
    for n in nums:
        bs.append((lcm // n) % modula)

    print(sum(bs) % modula)

    
def iin(): return int(input())
def iln(): return list(map(int, input().split()))


N = iin()
nums = iln()
solve(nums)


Fixed submission:
def iln(): return list(map(int, input().split()))


def solve(N, M):
  print("Yes" if N == M else "No")
  
  
N, M = iln()
solve(N, M)
Buggy python submission (verdict: Runtime Error):
def solve(N, W, weight_values):
  dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
  dp[0][0] = 1

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(i_weight, W + 1):
      dp[i][w] = max(dp[i - 1][w - i_weight] + i_value, dp[i - 1][w])

  print(dp[N][W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v = iln()
  
solve(N, W, w_v)


Fixed submission:

def solve(N, heights):
  dp = [float('inf')] * N
  dp[0] = 0
  for i in range(N - 1):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(heights[i] - heights[i + 1]))
    if i + 2 < N:
      dp[i + 2] = min(dp[i + 2], dp[i] + abs(heights[i] - heights[i + 2]))

  print(dp[N-1])

def iin(): return int(input())
def iln(): return list(map(int, input().split()))

solve(iin(), iln())
Buggy python submission (verdict: Time Limit Exceeded):
def solve(N, K, heights):
  dp = [0] * N
  for i in range(1, N):
    min_cost = float('inf')
    for k in range(max(0, i - K), i):
      min_cost = min(min_cost, dp[k] + abs(heights[i] - heights[k]))
    dp[i] = min_cost
  print(dp[N - 1])

 
def iin(): return int(input())
def iln(): return list(map(int, input().split()))
 
N, K = iln()
solve(N, K, iln())


Fixed submission:
def solve(N, K, heights):
  dp = [0] * N
  for i in range(1, N):
    min_cost = float('inf')
    for k in range(max(0, i - K), i):
      # min_cost = min(min_cost, dp[k] + abs(heights[i] - heights[k]))
      temp = dp[k] + abs(heights[i] - heights[k])
      if temp < min_cost:
        min_cost = temp
    dp[i] = min_cost
  print(dp[N - 1])


 
def iin(): return int(input())
def iln(): return list(map(int, input().split()))
 
N, K = iln()
solve(N, K, iln())

Buggy python submission (verdict: Time Limit Exceeded):
def solve(N, K, heights):
  dp = [float('inf')] * N
  dp[0] = 0
  for i in range(N - 1):
    for k in range(1, K + 1):
      if i + k < N:
        dp[i + k] = min(dp[i + k], dp[i] + abs(heights[i] - heights[i + k]))
  print(dp[N - 1])

def iin(): return int(input())
def iln(): return list(map(int, input().split()))

N, K = iln()
solve(N, K, iln())


Fixed submission:
def solve(N, K, heights):
  dp = [0] * N
  for i in range(1, N):
    min_cost = float('inf')
    for k in range(max(0, i - K), i):
      # min_cost = min(min_cost, dp[k] + abs(heights[i] - heights[k]))
      temp = dp[k] + abs(heights[i] - heights[k])
      if temp < min_cost:
        min_cost = temp
    dp[i] = min_cost
  print(dp[N - 1])


 
def iin(): return int(input())
def iln(): return list(map(int, input().split()))
 
N, K = iln()
solve(N, K, iln())
Buggy python submission (verdict: Time Limit Exceeded):
def solve(N, W, weight_values):
  dp = [0 for _ in range(W + 1)]
  dp[0] = 0

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(W, -1, -1):
      if i_weight <= w:
        dp[w] = max(dp[w - i_weight] + i_value, dp[w])
      else:
        dp[w] = dp[w]

  print(dp[W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v.append(iln())
  
solve(N, W, w_v)


Fixed submission:
def solve(N, W, weight_values):
  dp = [0 for _ in range(W + 1)]

  for i in range(N):
    i_weight, i_value = weight_values[i]
    for w in range(W, i_weight - 1, -1):
      # dp[w] = max(dp[w - i_weight] + i_value, dp[w])
      temp = dp[w - i_weight] + i_value
      if temp > dp[w]:
        dp[w] = temp

  print(dp[W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v.append(iln())
  
solve(N, W, w_v)

Buggy python submission (verdict: Runtime Error):
def solve(N, W, weight_values):
  dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
  dp[0][0] = 1

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(i_weight, W + 1):
      dp[i][w] = max(dp[i - 1][w - i_weight] + i_value, dp[i - 1][w])

  print(dp[N][W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v = iln()
  
solve(N, W, w_v)


Fixed submission:
def solve(N, W, weight_values):
  dp = [0 for _ in range(W + 1)]

  for i in range(N):
    i_weight, i_value = weight_values[i]
    for w in range(W, i_weight - 1, -1):
      # dp[w] = max(dp[w - i_weight] + i_value, dp[w])
      temp = dp[w - i_weight] + i_value
      if temp > dp[w]:
        dp[w] = temp

  print(dp[W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v.append(iln())
  
solve(N, W, w_v)

Buggy python submission (verdict: Runtime Error):
def solve(N, W, weight_values):
  dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
  dp[0][0] = 1

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(i_weight, W + 1):
      dp[i][w] = max(dp[i - 1][w - i_weight] + i_value, dp[i - 1][w])

  print(dp[N][W])

N, W = iln()
w_v = []
for i in range(N):
  w_v = iln()
  
solve(N, W, w_v)

Fixed submission:
def solve(N, W, weight_values):
  dp = [0 for _ in range(W + 1)]

  for i in range(N):
    i_weight, i_value = weight_values[i]
    for w in range(W, i_weight - 1, -1):
      # dp[w] = max(dp[w - i_weight] + i_value, dp[w])
      temp = dp[w - i_weight] + i_value
      if temp > dp[w]:
        dp[w] = temp

  print(dp[W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v.append(iln())
  
solve(N, W, w_v)
Buggy python submission (verdict: Time Limit Exceeded):
def solve(N, M, edges):
  inbound = {}
  for s,t in edges:
    if t in inbound:
      inbound[t].append(s)
    else:
      inbound[t] = [s]

  dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]

  for s,t in edges:
    dp[s][t] = 1

  max_so_far = 0
  for i in range(1, N + 1):
    for s in range(1, N + 1):
      for t in range(1, N + 1):
        t_inbound = inbound[t] if t in inbound else []
        for t_i in t_inbound:
          # dp[s][t] = max(dp[s][t], dp[s][t_i] + 1)
          # max_so_far = max(max_so_far, dp[s][t])
          temp = dp[s][t_i] + 1
          if temp > dp[s][t]:
            dp[s][t] = temp
          if temp > max_so_far:
            max_so_far = temp

  print(max_so_far)


def iln(): return list(map(int, input().split()))


N, M = iln()
edges = []
for i in range(M):
  edges.append(iln())
  
solve(N, M, edges)

Fixed submission:
from collections import defaultdict, deque

def solve(N, M, edges):
  outbound = defaultdict(deque)
  in_degree = defaultdict(int)
  for s,t in edges:
    outbound[s].append(t)
    in_degree[t] += 1

  q = deque()
  for i in range(N + 1):
    if in_degree[i] == 0:
      q.append(i)

  dp = [0 for _ in range(N + 1)]

  while q:
    node = q.popleft()
    for child in outbound[node]:
      dp[child] = max(dp[child], dp[node] + 1)
      in_degree[child] -= 1
      if in_degree[child] == 0:
        q.append(child)

  print(max(dp))


def iln(): return list(map(int, input().split()))


N, M = iln()
edges = []
for i in range(M):
  edges.append(iln())
  
solve(N, M, edges)
Buggy python submission (verdict: Time Limit Exceeded):
def solve(N, K, cards):
  min_elem = cards[0]

  TARO, JIRO = 0, 1
  dp = [[-1 for _ in range(K + 1)] for _ in range(2)]

  dp[TARO][0] = TARO
  dp[JIRO][0] = JIRO

  for i in range(min_elem):
    dp[JIRO][i] = TARO
    dp[TARO][i] = JIRO

  for k in range(1, K + 1):
    for turn in [TARO, JIRO]:
      opp = JIRO if turn == TARO else TARO
      dp[turn][k] = opp
      for c in cards:
        if c > k:
          break
        if k - c == 0:
          dp[turn][k] = turn
          break
        if k - c > 0 and dp[opp][k - c] == turn:
          dp[turn][k] = turn

  print("First" if dp[TARO][K] == TARO else "Second")

  
def iln(): return list(map(int, input().split()))


N, K = iln()
cards = iln()
solve(N, K, cards)

Fixed submission:
def solve(N, K, cards):
  min_elem = cards[0]

  # dp[i] == True: Current player will win if i stones left
  dp = [False for _ in range(K + 1)]
  for i in range(min_elem):
    dp[i] = False

  for k in range(1, K + 1):
    for c in cards:
      if c > k:
        break
      if k - c >= 0 and dp[k - c] == False:
        dp[k] = True

  print("First" if dp[K] else "Second")

  
def iln(): return list(map(int, input().split()))


N, K = iln()
cards = iln()
solve(N, K, cards)
Buggy python submission (verdict: Runtime Error):
N = int(input())
masu=[int(x) for x in input().split(" ")]
c=0
for i in range(0,N,2)
	if masu[i]%2 !=0:
    	c+=1
print(c)

Fixed submission:
N = int(input())
masu=[int(x) for x in input().split(" ")]
c=0
for i in range(0,N,2):
	if masu[i]%2 !=0: c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
a,b=[int(x) for x in input().split(" ")]
x=(b-2a)/2
y=(4a-b)/2
print("Yes" if x>0 and y>0 and x%1==0.0 and y%1==0.0 else "No")

Fixed submission:
a,b=[int(x) for x in input().split(" ")]
x=(b-2*a)/2
y=(4*a-b)/2
print("Yes" if x>=0 and y>=0 and x%1==0.0 and y%1==0.0 else "No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(x) for x in input().split(" ")]
sum = 0
pow = 0
while any(a):
    one = 0
    for i in range(N):
        if a[i] & 1:
            one += 1
        a[i] >>= 1
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
print(sum)

Fixed submission:
import numpy as np

N = int(input())
a = np.array([int(x) for x in input().split(" ")], np.int64)
sum = 0
pow = 0
while any(a):
    one = np.count_nonzero(a & 1)
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
    a >>= 1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(x) for x in input().split(" ")]
sum = 0
pow = 0
while any(a):
    zero = 0; one = 0
    for i in range(N):
        if a[i] % 2 == 0:
            zero += 1
        else:
            one += 1
        a[i] >>= 1
    sum += zero * one * 2 ** pow
    pow += 1
print(sum % (10 ** 9 + 7))

Fixed submission:
import numpy as np

N = int(input())
a = np.array([int(x) for x in input().split(" ")], np.int64)
sum = 0
pow = 0
while any(a):
    one = np.count_nonzero(a & 1)
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
    a >>= 1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(x) for x in input().split(" ")]
sum = 0
pow = 0
while any(a):
    zero = 0; one = 0
    for i in range(N):
        if a[i] % 2 == 0:
            zero += 1
        else:
            one += 1
        a[i] //= 2
    sum += zero * one * 2 ** pow
    pow += 1
print(sum % (10 ** 9 + 7))

Fixed submission:
import numpy as np

N = int(input())
a = np.array([int(x) for x in input().split(" ")], np.int64)
sum = 0
pow = 0
while any(a):
    one = np.count_nonzero(a & 1)
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
    a >>= 1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(x) for x in input().split(" ")]
sum = 0
for i in range(N - 1):
    for j in range(i+1, N):
        sum += a[i] ^ a[j]
print(sum % (10 ** 9 + 7))

Fixed submission:
import numpy as np

N = int(input())
a = np.array([int(x) for x in input().split(" ")], np.int64)
sum = 0
pow = 0
while any(a):
    one = np.count_nonzero(a & 1)
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
    a >>= 1
print(sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = 100; r = 105
for i in range(5000):
    if l <= N <= r:
        print(1)
        break
    l += 100
    r += 105
print(0)

Fixed submission:
a, b = [int(x) for x in input().split(" ")]
c, d = [int(x) for x in input().split(" ")]
print(0 if a == c else 1)
Buggy python submission (verdict: Runtime Error):
A, B, C=map(int,input().split(' '))
if(A<C ans C<B):
  print('Yes')
else:
  print('No')

Fixed submission:
A, B, C=map(int,input().split(' '))
if((A-C)*(B-C)<0):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
vec = [0 for _ in range(3)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')

Fixed submission:
vec = [0 for _ in range(4)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')