Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k,c = map(int, input().split())
s = str(input())
t = [0 for i in range(n)]
u = [0 for i in range(n)]
i,x,y = 0,0,0
j = n-1
while i < n and x <= k:
    if s[i] == "o":
        t[i] = 1
        x += 1
        i += c
    i += 1

while j >= 0 and y <= k:
    if s[j] == "o":
        u[j] = 1
        y += 1
        j += -c
    j += -1

for i in range(0,n):
    if t[i] == 1 and u[i] == 1:
        print(i+1)

Fixed submission:
a,b,c = map(int, input().split())
print(c,a,b)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,c = map(int, input().split())
s = str(input())
t = []
u = []
i,x,y,j = 0,0,0,n-1
while i < n and x < k:
    if s[i] == "o":
        t.append(i)
        x += 1
        i += c
    i += 1

while j >= 0 and y < k:
    if s[j] == "o":
        u.insert(0,j)
        y += 1
        j += -c
    j += -1

for i in range(0,k):
    if t[i] == u[i]:
        print(t[i]+1)

Fixed submission:
n,k,c = map(int, input().split())
s = str(input())
t = []
u = []
i,x,y,j = 0,0,0,n-1
while i < n and x < k:
    if s[i] == "o":
        t.append(i)
        x += 1
        i += c
    i += 1
 
while j >= 0 and y < k:
    if s[j] == "o":
        u.append(j)
        y += 1
        j += -c
    j += -1
 
for i in range(0,k):
    if t[i] == u[k-1-i]:
        print(t[i]+1)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,x,y = map(int, input().split())
t = np.zeros(n)
x = x-1
y = y-1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    b = abs(i-j)
    if a < b:
      t[a-1] += 1
    else:
      t[b-1] += 1

for k in range(0,n-1):
  print(int(t[k]))

Fixed submission:
n,x,y = map(int, input().split())
t = [0 for i in range(n)]
x = x-1
y = y-1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    b = abs(i-j)
    if a < b:
      t[a-1] += 1
    else:
      t[b-1] += 1

for k in range(0,n-1):
  print(int(t[k]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,x,y = map(int, input().split())
s = np.zeros((n,n))
t = np.zeros(n)
x = x-1
y = y-1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    b = abs(i-j)
    if a < b:
      t[a-1] += 1
    else:
      t[b-1] += 1

for k in range(0,n-1):
  print(int(t[k]))

Fixed submission:
n,x,y = map(int, input().split())
t = [0 for i in range(n)]
x = x-1
y = y-1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    b = abs(i-j)
    if a < b:
      t[a-1] += 1
    else:
      t[b-1] += 1

for k in range(0,n-1):
  print(int(t[k]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,x,y = map(int, input().split())
s = np.zeros((n,n))
t = np.zeros(n)
for i in range(0,n):
  for j in range(i,n):
    s[i][j] = abs(i-j)
x = x-1
y = y-1
s[x][y] = 1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    if a < s[i][j]:
      s[i][j] = a

for i in range(0,n):
  for j in range(i,n):
    for k in range(0,n):
      if k+1 == s[i][j]:
        t[k+1] += 1

for k in range(1,n):
  print(int(t[k]))

Fixed submission:
n,x,y = map(int, input().split())
t = [0 for i in range(n)]
x = x-1
y = y-1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    b = abs(i-j)
    if a < b:
      t[a-1] += 1
    else:
      t[b-1] += 1

for k in range(0,n-1):
  print(int(t[k]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,x,y = map(int, input().split())
s = np.zeros((n,n))
t = np.zeros(n)
for i in range(0,n):
  for j in range(i,n):
    s[i][j] = abs(i-j)
x = x-1
y = y-1
s[x][y] = 1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    if a < s[i][j];
    s[i][j] = a

for i in range(0,n):
  for j in range(i,n):
    for k in range(0.n):
      if k+1 == s[i][j]:
        t[k+1] += 1

for k in range(0.n):
  print t[k]

Fixed submission:
n,x,y = map(int, input().split())
t = [0 for i in range(n)]
x = x-1
y = y-1
for i in range(0,n):
  for j in range(i,n):
    a = abs(i-x)+abs(j-y)+1
    b = abs(i-j)
    if a < b:
      t[a-1] += 1
    else:
      t[b-1] += 1

for k in range(0,n-1):
  print(int(t[k]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
a = 0
for i in range(0,n):
  if s[i] == "A":
    if s[i+1] == "B":
      if s[i+2] == "C":
        a +=1

print(a)

Fixed submission:
n = int(input())
s = str(input())
a = 0
for i in range(0,n-2):
  if s[i] == "A":
    if s[i+1] == "B":
      if s[i+2] == "C":
        a +=1

print(a)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n,k,q = map(int, input().split())
a = np.zeros(n)
for i in range(0,k):
  b = int(input())
  a[b-1] += 1

for i in range(0,n):
  a[i] = k - a[i]
  if a[i] >= q:
    print("No")
  else:
    print("Yes")

Fixed submission:
import numpy as np

n,k,q = map(int, input().split())
a = np.zeros(n)
for i in range(0,q):
  b = int(input())
  a[b-1] += 1

for i in range(0,n):
  a[i] = q - a[i]
  if a[i] >= k:
    print("No")
  else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,m = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for  i in range(0,m):
    max = np.argmax(a)
    a[max] = a[max] // 2

for j in range(0,n):
    ans += a[j]

print(ans)

Fixed submission:
import heapq as hq

n,m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(lambda x: x*(-1), a))
hq.heapify(b)
for  _ in range(0,m):
    max = hq.heappop(b)*(-1)
    max = (-1)*(max // 2)
    hq.heappush(b, max)

print(-sum(b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a,b = 0, n-1
print(0,flush=True)
s = str(input())
if s == 'Vacant':
    exit()
for i in (19):
    check = (a+b) // 2
    print(check,flush=True)
    t = str(input())
    if t == 'Vacant':
        exit()
    if (check-a) % 2 == 0 and s == t:
        a = check
    elif (check-a) % 2 == 0 and s != t:
        b = check
    elif (check-a) % 2 == 1 and s == t:
        b = check
    else:
        a,s = check,t


Fixed submission:
n = int(input())
a,b = 0, n
print(a,flush=True)
s = str(input())
if s == 'Vacant':
        exit()
for i in range(19):
    check = (a+b) // 2
    print(check,flush=True)
    t = str(input())
    if t == 'Vacant':
        exit()
    if (check-a) % 2 == 0 and s == t:
        a = check
    elif (check-a) % 2 == 0 and s != t:
        b = check
    elif s == t:
        b = check
    else:
        a,s = check,t
Buggy python submission (verdict: Runtime Error):
a, b, c = input1
k = int(input())

for i in range(k):
    if a >= b:
        b *= 2
    elif b >= c:
        c *= 2
    else:
        c *= 2

if a < b < c:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())
k = int(input())

for i in range(k):
    if a >= b:
        b *= 2
    elif b >= c:
        c *= 2
    else:
        c *= 2

if a < b < c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

for n in range(1, N+1):
    ans = 0
    for x in range(1, int(n**(1/2))+1):
        for y in range(1, int(n**(1/2))+1):
            c = x**2 + y**2 + x*y - n
            b = x+y
            if b**2 - 4*c >= 0:
                d = (-b+(b**2-4*c)**(1/2))/2
                if int(d) == d and d >= 1:
                    ans += 1
    print(ans)


Fixed submission:

N = int(input())
a = []
for n in range(1, N+1):
    ans = 0
    for x in range(1, int(n**(1/2))+1):
        for y in range(x, int(n**(1/2))+1):
            c = x**2 + y**2 + x*y - n
            b = x+y
            if b**2 - 4*c >= 0:
                d = (-b+(b**2-4*c)**(1/2))/2
                if int(d) == d and d >= 1:
                    if x != y:
                        ans += 2
                    else:
                        ans += 1
    print(ans)
Buggy python submission (verdict: Runtime Error):
from bisect import *
from itertools import accumulate
n, m, k = map(int, input().split())
a = [0]+list(map(int, input().split()))
b = [0]+list(map(int, input().split()))
a = accumulate(a)
b = accumulate(b)
ans = 0
for i in range(n+1):
    ind = bisect_right(b, k-a[i])
    ans = max(ans, ind+i-1)

print(ans)


Fixed submission:
from bisect import *
from itertools import accumulate
n, m, k = map(int, input().split())
a = [0]+list(map(int, input().split()))
b = [0]+list(map(int, input().split()))
a = list(accumulate(a))
b = list(accumulate(b))
ans = 0
for i in range(n+1):
    if a[i] > k:
        continue
    ind = bisect_right(b, k-a[i])
    ans = max(ans, ind+i-1)

print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input())
s = input()
n = len(s)
dp = [0]*(k+1)
dp[0] = 1

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


mod = 10**9+7
N = 2000001
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


ans = 0
for i in range(n, n+k+1):
    ans += cmb(n+k, i) * pow(25, n+k-i, mod)
    ans %= mod

print(ans)


Fixed submission:
k = int(input())
s = input()
n = len(s)

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


mod = 10**9+7
N = 2000001
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


ans = 0
for i in range(n, n+k+1):
    ans += cmb(n+k, i, mod) * pow(25, n+k-i, mod)
    ans %= mod

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
dp = [[None]*(n+1) for i in range(64)]
for i in range(1, n+1):
    dp[0][i] = a[i]
for i in range(63):
    for j in range(1, n+1):
        dp[i+1][j] = dp[i][dp[i][j]]

k = format(k, "064b")
now = 1
for i in range(64):
    if k[i] == "1":
        now = dp[~i][now]

print(now)


Fixed submission:
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

loop = [1]
now = 1
d = set([1])
for i in range(n):
    now = a[now]
    if now in d:
        for j in range(len(loop)):
            if now == loop[j]:
                ind = j
        break
    d.add(now)
    loop.append(now)

if len(loop) >= k+1:

    print(loop[k])

else:
    k -= ind
    loop = loop[ind:]
    print(loop[k%len(loop)])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

num = [0] * (3*10**6)
for i in range(n):
    a[i] -= i
    num[a[i]] += 1

ans = 0
for i in range(n):
    if abs(-2*i - a[i]) <= 10**6:
        ans += num[-2*i - a[i]]
    num[a[i]] -= 1

print(ans)


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

num = [0] * (3*10**6)
for i in range(n):
    a[i] -= i
    if abs(a[i]) <= 10**6:
        num[a[i]] += 1

ans = 0
for i in range(n):
    if abs(-2*i - a[i]) <= 10**6:
        ans += num[-2*i - a[i]]
    if abs(a[i]) <= 10**6:
        num[a[i]] -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

remain = [0]*2020
now = 0
ans = 0
for i in range(len(s)-1, -1, -1):
    now += int(s[i])*pow(10, len(s)-i-1)
    ans += remain[now%2019]
    remain[now%2019] += 1

ans += remain[0]

print(ans)


Fixed submission:
s = input()

remain = [0]*2020
now = 0
ans = 0
for i in range(len(s)-1, -1, -1):
    now += int(s[i])*pow(10, len(s)-i-1, 2019)
    ans += remain[now%2019]
    remain[now%2019] += 1

ans += remain[0]

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k, c = map(int, input().split())
s = input()


count = 0
i = 0
ansleft = set()
while i < n:
    if s[i] == "o":
        ansleft.add(i+1)
        i += c+1
        count += 1
    else:
        i += 1

if count >= k+1:
    sys.exit()


ansright = set()
s = s[::-1]
i = 0
while i < n:
    if s[i] == "o":
        ansright.add(n-i)
        i += c+1
    else:
        i += 1

ans = ansright&ansleft
ans = list(ans)
ans.sort()
for i in ans:
    print(i)


Fixed submission:
import sys
n, k, c = map(int, input().split())
s = input()


count = 0
i = 0
ansleft = set()
while i < n:
    if s[i] == "o":
        ansleft.add(i+1)
        i += c+1
        count += 1
    else:
        i += 1

if count >= k+1:
    sys.exit()


ansright = set()
s = s[::-1]
i = 0
while i < n:
    if s[i] == "o":
        ansright.add(n-i)
        i += c+1
    else:
        i += 1

ans = ansright&ansleft
ans = list(ans)
ans.sort()
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
n, k, c = map(int, input().split())
s = input()


if s[i] == "o":
    if i+c+1 <= n-1:
        if s[i+c+1] == "x" and s[i+1] == "x":
            print(i+1)


Fixed submission:
import sys
n, k, c = map(int, input().split())
s = input()


count = 0
i = 0
ansleft = set()
while i < n:
    if s[i] == "o":
        ansleft.add(i+1)
        i += c+1
        count += 1
    else:
        i += 1

if count >= k+1:
    sys.exit()


ansright = set()
s = s[::-1]
i = 0
while i < n:
    if s[i] == "o":
        ansright.add(n-i)
        i += c+1
    else:
        i += 1

ans = ansright&ansleft
ans = list(ans)
ans.sort()
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
h, w, K = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())

ans = 1000000
for i in range(2**(h-1)):
    b = format(i, "0{}b".format(h-1))
    ans_temp = b.count("1")
    white_after = [0]*(ans_temp+1)
    index = 0
    for j in range(w):
        for k in range(h):
            if grid[k][j] == "1":
                white_after[index] += 1
            if k != h-1:
                if b[k] == "1":
                    index += 1
        if max(white_after) <= K:
            white_before = white_after[:]
        else:
            for k in range(len(white_after)):
                white_after[k] -= white_before[k]
            white_before = white_after[:]
            ans_temp += 1
        index = 0
    ans = min(ans, ans_temp)

print(ans)


Fixed submission:
h, w, K = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())

ans = 1000000
for i in range(2**(h-1)):
    b = format(i, "0{}b".format(h-1))
    ans_temp = b.count("1")
    white_after = [0]*(ans_temp+1)
    index = 0
    flag = 1
    for j in range(w):
        for k in range(h):
            if grid[k][j] == "1":
                white_after[index] += 1
            if k != h-1:
                if b[k] == "1":
                    index += 1
        if max(white_after) <= K:
            white_before = white_after[:]
        else:
            try:
                for k in range(len(white_after)):
                    white_after[k] -= white_before[k]
                    if white_after[k] > K:
                        flag = 0
                white_before = white_after[:]
                ans_temp += 1
            except:
                flag = 0
                break
        index = 0
    if flag == 0:
        continue
    ans = min(ans, ans_temp)

print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import *
getcontext().prec = 28
a, b, c = map(int, input().split())
a = Decimal(str(a))
b = Decimal(str(b))
c = Decimal(str(c))

if a.sqrt() + b.sqrt() < c.sqrt()):
  print("Yes")
else:
  print("No")


Fixed submission:
from decimal import *
a, b, c = map(int, input().split())
a = Decimal(str(a))
b = Decimal(str(b))
c = Decimal(str(c))
if a.sqrt() + b.sqrt() < c.sqrt():
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from decimal import *
getcontext().prec = 28
a, b, c = map(int, input().split())
if sqrt(str(a)) + sqrt(str(b)) < sqrt(str(c)):
  print("Yes")
else:
  print("No")

Fixed submission:
from decimal import *
a, b, c = map(int, input().split())
a = Decimal(str(a))
b = Decimal(str(b))
c = Decimal(str(c))
if a.sqrt() + b.sqrt() < c.sqrt():
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

before = ["1"]
for i in range(n-1):
    next = []
    for elem in before:
        m = 1
        for j in range(len(elem)):
            m = max(m, int(elem[j]))
        for j in range(m+1):
            next.append(elem+str(j+1))
    before = next[:]

before.sort()
d = {"1":"a", "2":"b", "3":"c", "4":"d", "5":"e", "6":"f", "7":"g", "8":"h", "9":"i", "10":"j"}
for elem in before:
    ans = []
    for i in range(len(elem)):
        ans.append(d[elem[i]])
    print("".join(ans))


Fixed submission:
n = int(input())

before = ["0"]
for i in range(n-1):
    next = []
    for elem in before:
        m = 1
        for j in range(len(elem)):
            m = max(m, int(elem[j])+1)
        for j in range(m+1):
            next.append(elem+str(j))
    before = next[:]

before.sort()
d = {"0":"a", "1":"b", "2":"c", "3":"d", "4":"e", "5":"f", "6":"g", "7":"h", "8":"i", "9":"j"}
for elem in before:
    ans = []
    for i in range(len(elem)):
        ans.append(d[elem[i]])
    print("".join(ans))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n, t = map(int, input().split())
shop = []
shop_0 = []
for i in range(n):
    a, b = map(int, input().split())
    if a == 0:
        shop_0.append((a, b))
        n -= 1
    else:
        shop.append((a, b))
shop.sort(key = lambda x: (x[0])/(1+x[1]), reverse = True)
shop0.sort(key = lambda x: x[1])

inf = 10**18
dp = [[inf for i in range(30)] for j in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for j in range(29):
        dp[i+1][j] = min(dp[i][j], dp[i+1][j])
        dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + dp[i][j]*(shop[i][0])+shop[i][1]+1)



ans = 0
for i in range(30):
    tmp = i
    T = dp[n][i]
    if T > t:
        continue
    else:
        for j in range(len(shop_0)):
            if T+shop_0[j][1]+1 <= t:
                T += shop_0[j][1]+1
                tmp += 1
            else:
                break
    ans = max(tmp, ans)

print(ans)


Fixed submission:
import sys
input = sys.stdin.readline
n, t = map(int, input().split())
shop = []
shop_0 = []
for i in range(n):
    a, b = map(int, input().split())
    if a == 0:
        shop_0.append((a, b))
        n -= 1
    else:
        shop.append((a, b))
shop.sort(key = lambda x: (x[0])/(1+x[1]), reverse = True)
shop_0.sort()

inf = 10**18
dp = [[inf for i in range(30)] for j in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for j in range(29):
        dp[i+1][j] = min(dp[i][j], dp[i+1][j])
        dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + (dp[i][j]+1)*(shop[i][0])+shop[i][1]+1)



ans = 0
for i in range(30):
    tmp = i
    T = dp[n][i]
    if T > t:
        continue
    else:
        for j in range(len(shop_0)):
            if T+shop_0[j][1]+1 <= t:
                T += shop_0[j][1]+1
                tmp += 1
            else:
                break
    ans = max(tmp, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

table = [[0 for i in range(10)] for j in range(10)]
for i in range(1, n+1):
    i = str(i)
    a, b = i[0], i[-1]
    table[a][b] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += table[i][j] * table[j][i]

print(ans)


Fixed submission:
n = int(input())

table = [[0 for i in range(10)] for j in range(10)]
for i in range(1, n+1):
    i = str(i)
    a, b = int(i[0]), int(i[-1])
    table[a][b] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += table[i][j] * table[j][i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))

x_diff = []
for i in range(n-1):
    x_diff.append(x[i+1] - x[i])



def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

base = 1
for i in range(1, n):
    base *= i
    base %= 10**9+7

frac = []
for i in range(1, n):
    frac.append(base*modinv(i) % (10**9+7))

import itertools
frac = list(itertools.accumulate(frac))

ans = 0
for i in range(n-1):
    ans += frac[i]*x_diff[i]
    ans %= 10**9+7

print(ans)


Fixed submission:
n = int(input())
ans = 0
music = []
for i in range(n):
    s, t = input().split()
    music.append([s,t])

x = input()
flag = 0
for i in range(n):
    if flag == 1:
        ans += int(music[i][1])
    if music[i][0] == x:
        flag = 1

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for i in range((len(s)-1)//2+1):
  if a[i] != a[-1-i]:
    ans += 1
print(ans)

Fixed submission:
s = input()
ans = 0
for i in range((len(s)-1)//2+1):
  if s[i] != s[-1-i]:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 0
for j in range(60):
    odd = 0
    even = 0
    for i in range(n):
        if a[i] % 2 == 0:
            even += 1
        else:
            odd += 1
    ans += even * odd * 2**j
    a = [i//2 for i in a]
    ans %= 10**9+7

print(ans)


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

ans = 0
for j in range(60):
    odd = 0
    even = 0
    for i in range(n):
        if a[i] % 2 == 0:
            even += 1
        else:
            odd += 1
    ans += even * odd * 2**j
    a = [i//2 for i in a]
    ans %= 10**9+7

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = 0
for i in range(1000):
    i = str(i).zfill(3)

    one, two, three = False, False, False
    for j in range(n):
        if one:
            if two:
                if three:
                    break
                else:
                    if s[j] == i[2]:
                        three = True
            else:
                if s[j] == i[1]:
                    two = True
        else:
            if s[j] == i[0]:
                one = True
    if three:
        ans += 1
print(ans)


Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    s = str(i).zfill(3)

    index = 0
    for j in range(N):
        if s[index] == S[j]:
            index += 1
        if index == 3:
            ans += 1
            break

print(ans)
Buggy python submission (verdict: Runtime Error):
x, y = map(int(input().split()))
ans = 0
if x == 1:
  ans += 300000
elif x == 2:
  ans += 200000
elif x == 3:
  ans += 100000

if y == 1:
  ans += 300000
elif y == 2:
  ans += 200000
elif y == 3:
  ans += 100000
if x == 1 and y == 1:
  ans += 400000
  
print(ans)
  
  
           

Fixed submission:
x, y = map(int,input().split())
ans = 0
if x == 1:
  ans += 300000
elif x == 2:
  ans += 200000
elif x == 3:
  ans += 100000

if y == 1:
  ans += 300000
elif y == 2:
  ans += 200000
elif y == 3:
  ans += 100000
if x == 1 and y == 1:
  ans += 400000
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 100000000000000
for i in range(n-1):
  ans = min(ans,abs(sum(a[:i+1]) - sum(a[i+1:])))
print(ans)
  

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
for i in range(n-1):
  a[i+1] += a[i]
ans = 100000000000000
for i in range(n-1):
  ans = min(ans, abs(a[-1] - 2*a[i]))

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i], i+1)
b.sort()
ans = []
for i in range(n):
  ans.append(b[i][1])
print(''.join(map(str, ans)))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append([a[i], i+1])
b.sort()
ans = []
for i in range(n):
  ans.append(b[i][1])
print(' '.join(map(str, ans)))