Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

max_val = int(1e+6+1)
def make_kago(x):
    kago = [0 for _ in range(x+1)]
    sosuu = []
    for i in range(2,x+1):
        if kago[i] != 0:
            continue
        sosuu.append(i)
        for j in range(i, x+1, i):
            if kago[j] == 0:
                kago[j] = i
    return kago, sosuu

kago, sosuu = make_kago(max_val)

def prime_factorization(x):
    if x==0 or x==1:
        return None
    soinsuu = []
    while x!=1:
        soinsuu.append(kago[int(x)])
        x = x/kago[int(x)]
    
    soinsuu_dict = dict()
    for i in range(len(soinsuu)):
        if soinsuu[i] not in soinsuu_dict:
            soinsuu_dict[soinsuu[i]] = 1
        else:
            soinsuu_dict[soinsuu[i]]+=1
    return soinsuu_dict

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

exists = [0 for _ in range(int(1e+6+1))]

complete_ok = True
for i, A in enumerate(As):
    soinsuu_dict = prime_factorization(A)
    keys = list(soinsuu_dict.keys())
    for key in keys:
        if exists[key] != 0:
            complete_ok = False
        exists[key] += 1

part_ok = False
for i in range(len(exists)):
    if exists[i] == len(As):
        part_ok = True

if complete_ok == True:
    print("pairwise coprime")
elif part_ok == False:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:

max_val = int(1e+6+1)
def make_kago(x):
    kago = [0 for _ in range(x+1)]
    sosuu = []
    for i in range(2,x+1):
        if kago[i] != 0:
            continue
        sosuu.append(i)
        for j in range(i, x+1, i):
            if kago[j] == 0:
                kago[j] = i
    return kago, sosuu

kago, sosuu = make_kago(max_val)

def prime_factorization(x):
    if x==0:
        return None
    soinsuu = []
    while x!=1:
        soinsuu.append(kago[int(x)])
        x = x/kago[int(x)]
    
    soinsuu_dict = dict()
    for i in range(len(soinsuu)):
        if soinsuu[i] not in soinsuu_dict:
            soinsuu_dict[soinsuu[i]] = 1
        else:
            soinsuu_dict[soinsuu[i]]+=1
    return soinsuu_dict

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

exists = [0 for _ in range(int(1e+6+1))]

complete_ok = True
exist_one = False

for i, A in enumerate(As):
    if A == 1:
        continue
    soinsuu_dict = prime_factorization(A)
    keys = list(soinsuu_dict.keys())
    for key in keys:
        if exists[key] != 0:
            complete_ok = False
        exists[key] += 1

part_ok = False
for i in range(len(exists)):
    if exists[i] == len(As):
        part_ok = True

if complete_ok == True:
    print("pairwise coprime")
elif part_ok == False:
    print("setwise coprime")
else:
    print("not coprime")
Buggy python submission (verdict: Runtime Error):
f = open("C:/Users/naoki/Desktop/Atcoder/input.txt")

N, D = map(int, f.readline().split())

dis2 = D**2

count = 0
for i in range(N):
    x, y = map(int, f.readline().split())
    if x**2 + y**2 <= dis2:
        count+=1
print(count)

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

dis2 = D**2

count = 0
for i in range(N):
    x, y = map(int, input().split())
    if x**2 + y**2 <= dis2:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))

hq = []

def is_ok(checking):
    cost = 0
    for i in range(n):
        cost += math.ceil(a[i]/checking)-1
    if cost <= k:
        return True
    else:
        return False

def meguru_bisect(ng, ok):
    while (abs(ok-ng)>1):
        mid = (ok+ng)//2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

ok = meguru_bisect(-1, int(1e+10)) 
print(int(ok))
# 初期値の範囲は取りえる値-1～+1とする←範囲内はok,ngどちらもあり得るため

Fixed submission:
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))

hq = []

def is_ok(checking):
    cost = 0
    for i in range(n):
        cost += math.ceil(a[i]/checking)-1
    if cost <= k:
        return True
    else:
        return False

def meguru_bisect(ng, ok):
    while (abs(ok-ng)>1):
        mid = (ok+ng)//2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

ok = meguru_bisect(0, int(1e+10)) 
print(int(ok))
# 初期値の範囲は取りえる値-1～+1とする←範囲内はok,ngどちらもあり得るため
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

counts = [0 for i in range(N+1)]

for i in range(1,150):
    for j in range(1,150):
        for k in range(1,150):
            now = i**2 + j**2 + k**2 + i*j + j*k + k*i
            try:
                counts[now] += 1
            except:
                pass
for i in range(1,N+1):
    print(counts[i])

Fixed submission:
N = int(input())

counts = [0 for i in range(N+1)]

for i in range(1,150):
    for j in range(1,150):
        for k in range(1,150):
            now = i**2 + j**2 + k**2 + i*j + j*k + k*i
            try:
                counts[now] += 1
            except:
                pass
for i in range(1,N+1):
    print(counts[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

answer = 1
for i in range(n):
    answer*=a[i]
    
if answer>int(1e+18):
    print(-1)
else:
    print(answer)

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

answer = 1
zero_exist = False
up_to_threshold = False
for i in range(n):
    if answer>int(1e+18):
        up_to_threshold = True
    else:
        answer*=a[i]
    if a[i] == 0:
        zero_exist = True
    
if zero_exist == True:
    print(0)
elif up_to_threshold == True or answer > int(1e+18):
    print(-1)
else:
    print(answer)
Buggy python submission (verdict: Runtime Error):
import numpy as np

print(1)

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

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

for i in range(n):
    plus = [dp[j-a[i]]  if j-a[i] >=0 else 0 for j in range(s+1)]
    for j in range(s+1):
        dp[j] = (dp[j]*2 +plus[j])%mod

print(dp[s])

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, s = map(int, input().split())
a = list(map(int, input().split()))

dp = np.array([0 for _ in range(s+1)])
dp[0] = 1

for i in range(n):
    plus = [dp[j-a[i]]  if j-a[i] >=0 else 0 for j in range(s+1)]
    dp = dp*2
    dp = dp+plus

print(dp[s])

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

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

for i in range(n):
    plus = [dp[j-a[i]]  if j-a[i] >=0 else 0 for j in range(s+1)]
    for j in range(s+1):
        dp[j] = (dp[j]*2 +plus[j])%mod

print(dp[s])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 20:51:45 2020

@author: naoki
"""
from collections import deque
N, X, Y = map(int,input().split())

distance_count = [0] * (N + 1)
route = [[i-1, i+1] for i in range(N+1)]

del route[-1][-1]

All_distances = [0]*N
route[X].append(Y)
route[Y].append(X)
#%%
for j in range(1,N):
    todo = deque([j])
    seen = [0 for i in range(N+1)]
    distance = [float("inf")] * (N+1)
    distance[j] = 0
    while len(todo) > 0:
        now = todo.pop()
        if now == N+1 or now == 0:
            continue
        for checking in route[now]:
            if seen[checking] < 2 and distance[checking] > distance[now] + 1:
                distance[checking] = distance[now] + 1
                todo.append(checking)
                seen[checking] += 1
            elif distance[checking] > distance[now] + 1:
                distance[checking] = distance[now] + 1
    for i in range(j,len(distance)):
        if distance[i] != float("inf"):
            All_distances[distance[i]] += 1
for i in range(1,N):
    print(All_distances[i])

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 20:51:45 2020

@author: naoki
"""
from collections import deque
N, X, Y = map(int,input().split())

distance_count = [0] * (N + 1)
route = [[i-1, i+1] for i in range(N+1)]

del route[-1][-1]

All_distances = [0]*N
route[X].append(Y)
route[Y].append(X)
#%%
for j in range(1,N):
    todo = deque([j])
    seen = [0 for i in range(N+1)]
    distance = [N+1] * (N+1)
    distance[j] = 0
    while len(todo) > 0:
        now = todo.pop()
        if now == N+1 or now == 0:
            continue
        for checking in route[now]:
            kari1 = distance[checking]
            kari2 = distance[now] + 1
            if seen[checking] < 2 and kari1 > kari2:
                distance[checking] = kari2
                todo.append(checking)
                seen[checking] += 1
            elif kari1 > kari2:
                distance[checking] = kari2
    for i in range(j,len(distance)):
        if distance[i] != N+1:
            All_distances[distance[i]] += 1
for i in range(1,N):
    print(All_distances[i])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 20:56:06 2020

@author: naoki
"""
import math
f = open("C:/Users/naoki/Desktop/Atcoder/input.txt")
H, W, K = map(int, input().split())
S = [list(map(int,str(input()).replace('\n',''))) for _ in range(H)]
t_S = [[S[j][i] for j in range(len(S))]for i in range(len(S[0]))]

sum_gyo = [sum(gyo) for gyo in S]
sum_retu = [sum(retu) for retu in t_S]

katamari = [sum(sum_retu)]

if katamari[0] > K:
    print(math.ceil(katamari[0]/K))
else:
    print(0)

Fixed submission:
H, W, K = map(int, input().split())
Ss = [list(map(int, input().replace("\n", ""))) for _ in range(H)]

cut_yoko_patterns = ["0","1"]
options = ["0","1"]

import copy

for i in range(H-2):
    cut_yoko_patterns = [cut_yoko_patterns[i] + options[j] for i in range(len(cut_yoko_patterns)) for j in range(len(options))]

answer = int(1e+5)
for cut_yoko_pattern in cut_yoko_patterns:
    yoko_cut_num = cut_yoko_pattern.count("1")
    boxs = [0 for _ in range(yoko_cut_num+1)]
    box_num = [0 for _ in range(H)]
    for i in range(H-1):
        if cut_yoko_pattern[i] == "1":
            box_num[i+1] = box_num[i] + 1
        else:
            box_num[i+1] = box_num[i]
    
    tate_cut_num = 0
    for j in range(W):
        temp_boxs = [0 for _ in range(yoko_cut_num+1)]
        for i in range(H):
            if Ss[i][j] == 1:
                temp_boxs[box_num[i]] += 1
        Impossible = False
        Should_cut = False
        for i in range(yoko_cut_num+1):
            if temp_boxs[i] > K:
                Impossible = True
            
            elif boxs[i] + temp_boxs[i] > K:
                Should_cut = True
        
        if Impossible == True:
            break
        elif Should_cut ==True:
            boxs = copy.deepcopy(temp_boxs)
            tate_cut_num += 1
        else:
            for i in range(yoko_cut_num+1):
                boxs[i] += temp_boxs[i]
    else:
        
        if tate_cut_num+yoko_cut_num < answer:
            answer = tate_cut_num + yoko_cut_num
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):


from decimal import Decimal
from decimal import *
a, b, c = map(str, input().split())

getcontext().prec = 10000

a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**Decimal("0.5")  + b**Decimal("0.5") < c**Decimal("0.5"):
    print("Yes")
else:
    print("No")


Fixed submission:


from decimal import Decimal
from decimal import *
a, b, c = map(str, input().split())

getcontext().prec = 500

a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**Decimal("0.5")  + b**Decimal("0.5") < c**Decimal("0.5"):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 21:02:42 2020

@author: morihiranaoki
"""
import numpy as np
from decimal import Decimal
a, b, c = map(str, input().split())


a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**Decimal("0.5")  + b**Decimal("0.5") < c**Decimal("0.5"):
    print("Yes")
else:
    print("No")


Fixed submission:


from decimal import Decimal
from decimal import *
a, b, c = map(str, input().split())

getcontext().prec = 500

a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**Decimal("0.5")  + b**Decimal("0.5") < c**Decimal("0.5"):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
querys = [list(map(str,input().split())) for _ in range(q)]

direction = 0
mae = ""
ato = ""

for i,query in enumerate(querys):
    if query[0] == "1":
        direction = (direction+1)%2
    else:
        if (int(query[1])-1 + direction)%2 == 0:
            mae += query[2]
        else:
            ato += query[2]


s = mae[::-1] + s
s = s + ato

if direction == 1:
    print(s[::-1])
else:
    print(s)

Fixed submission:
s = input()
q = int(input())
querys = [list(map(str,input().split())) for _ in range(q)]

direction = 0
mae = ""
ato = ""

for i,query in enumerate(querys):
    if query[0] == "1":
        direction = (direction+1)%2
    else:
        if (int(query[1])-1 + direction)%2 == 0:
            mae += query[2]
        else:
            ato += query[2]

s = mae[::-1] + s
s = s + ato

if direction == 1:
    print(s[::-1])
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
n = str(input())
p = int(input())

keta = len(n)
Dp = [[[0 for _ in range(2)] for _ in range(keta+1)]for _ in range(keta+1)]

Dp[0][0][1] = 1

for i in range(keta):
    for j in range(i+1):
        for k in range(10):
            if k == 0:
                if k < int(n[i]):
                    Dp[i+1][j][0] += Dp[i][j][0]
                    Dp[i+1][j][0] += Dp[i][j][1]
                    
                elif k == int(n[i]):
                    Dp[i+1][j][1] += Dp[i][j][1]
                    Dp[i+1][j][0] += Dp[i][j][0]
                
                else:
                    Dp[i+1][j][0] += Dp[i][j][0]
            
            else:
                if k < int(n[i]):
                    Dp[i+1][j+1][0] += Dp[i][j][0]
                    Dp[i+1][j+1][0] += Dp[i][j][1]
                elif k == int(n[i]):
                    Dp[i+1][j+1][1] += Dp[i][j][1]
                    Dp[i+1][j+1][0] += Dp[i][j][0]
                else:
                    Dp[i+1][j+1][0] += Dp[i][j][0]

print(sum(Dp[-1][p]))

Fixed submission:
n = str(input())
p = int(input())

keta = len(n)
Dp = [[[0 for _ in range(2)] for _ in range(keta+1)]for _ in range(keta+1)]

Dp[0][0][1] = 1
10
for i in range(keta):
    for j in range(i+1):
        for k in range(10):
            if k == 0:
                if k < int(n[i]):
                    Dp[i+1][j][0] += Dp[i][j][0]
                    Dp[i+1][j][0] += Dp[i][j][1]
                    
                elif k == int(n[i]):
                    Dp[i+1][j][1] += Dp[i][j][1]
                    Dp[i+1][j][0] += Dp[i][j][0]
                
                else:
                    Dp[i+1][j][0] += Dp[i][j][0]
            
            else:
                if k < int(n[i]):
                    Dp[i+1][j+1][0] += Dp[i][j][0]
                    Dp[i+1][j+1][0] += Dp[i][j][1]
                elif k == int(n[i]):
                    Dp[i+1][j+1][1] += Dp[i][j][1]
                    Dp[i+1][j+1][0] += Dp[i][j][0]
                else:
                    Dp[i+1][j+1][0] += Dp[i][j][0]

if p > keta:
    print(0)
else:
    print(sum(Dp[-1][p]))
Buggy python submission (verdict: Time Limit Exceeded):
import math

H = int(input())
#H = list(map(int,input().split()))
#H = sorted(H,reverse=True)

mon_num = 1
attack_num = 0
for k in range(1000000000000):
    
    attack_num += mon_num
    
    H = math.floor(H/2)
    mon_num = mon_num*2
    
    
    if H == 1:
        attack_num += mon_num
        break
print(attack_num)
        
    

Fixed submission:
import math
import sys
H = int(input())
#H = list(map(int,input().split()))
#H = sorted(H,reverse=True)

if H == 0:
    print(0)
    sys.exit()
elif H == 1:
    print(1)
    sys.exit()

mon_num = 1
attack_num = 0
for k in range(1000000000000):
    
    attack_num += mon_num
    
    H = math.floor(H/2)
    mon_num = mon_num*2
    
    
    if H == 1:
        attack_num += mon_num
        break
print(attack_num)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

H, N = list(map(int,input().split()))
AB = [list(map(int,input().split())) for i in range(N)]


cost = [100000000 for _ in range(H)]
min_cost = 100000000

cost[0] = 0

attack_num = 0
for k in range(H):
    for j in range(N):
        if k + AB[j][0] >= H:
            if min_cost > cost[k] + AB[j][1] :
                min_cost = cost[k] + AB[j][1]
        else:
            if cost[k+AB[j][0]] > cost[k] + AB[j][1]:
                cost[k+AB[j][0]] = cost[k] + AB[j][1]
print(min_cost)                


Fixed submission:

def main():
    H, N = list(map(int,input().split()))
    AB = [list(map(int,input().split())) for i in range(N)]
    
    cost = [100000000 for _ in range(H)]
    min_cost = 100000000
    
    cost[0] = 0
    
    for k in range(H):
        for j in range(N):
            if k + AB[j][0] >= H:
                kari1 = cost[k] + AB[j][1]
                if min_cost > kari1:
                    min_cost = kari1
            else:
                kari2 = cost[k] + AB[j][1]
                if cost[k+AB[j][0]] > kari2:
                    cost[k+AB[j][0]] = kari2
    print(min_cost)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 1
    for i in range(1,N):
        for p in range(i):
            if P[p] < P[i]:
                break
        else:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

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

if n == m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 1
    for i in range(1,N):
        if sum([1 for x in P[:i] if x<P[i]])>=1:
            continue
        else:
            count += 1
    print(count)
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    min_val = 2*10e5
    count = 1
    for i in range(1,N):
        if min_val > P[i-1]:
            min_val = P[i-1]
        if P[i] <= min_val:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

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

count = 1
for i in range(1,N):
    for p in range(i):
        if P[p] < P[i]:
            break
    else:
        count += 1

print(count)


Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    min_val = 2*10e5
    count = 1
    for i in range(1,N):
        if min_val > P[i-1]:
            min_val = P[i-1]
        if P[i] <= min_val:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 1
    for i in range(1,N):
        for p in range(i):
            if P[p] < P[i]:
                break
        else:
            count += 1
    print(count)
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    min_val = 2*10e5
    count = 1
    for i in range(1,N):
        if min_val > P[i-1]:
            min_val = P[i-1]
        if P[i] <= min_val:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

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

count = 1
for i in range(1,N):
    for p in range(i):
        if P[p] < P[i]:
            break
    else:
        count += 1

print(count)

Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    min_val = 2*10e5
    count = 1
    for i in range(1,N):
        if min_val > P[i-1]:
            min_val = P[i-1]
        if P[i] <= min_val:
            count += 1
    print(count)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""
N = int(input())
xl = [list(map(int, input())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -10000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]
print(count)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""
N = int(input())
xl = [list(map(int, input().split())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -100000000000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]
print(count)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""


N = int(input())
xl = [list(map(int, input())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -10000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""
N = int(input())
xl = [list(map(int, input().split())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -100000000000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]
print(count)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""

f = open("C:/Users/naoki/Desktop/Atcoder/input.txt")

N = int(input())
xl = [list(map(int, input())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -10000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""
N = int(input())
xl = [list(map(int, input().split())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -100000000000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
mod = 1000000007

for i in range(60):
    one_count =0
    zero_count = 0
    for j in range(N):
        if A[j] >> i & 1 == 1:
            one_count+=1
        else:
            zero_count+=1
    ans += (one_count % mod) *(zero_count%mod) * (2**i) % mod
    ans = ans % mod
print(ans)

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

ans = 0
mod = 1000000007

for i in range(60):
    one_count =0
    zero_count = 0
    for j in range(N):
        if A[j] >> i & 1 == 1:
            one_count+=1
        else:
            zero_count+=1
    ans += (one_count*zero_count)*(2**i)
    ans = ans%mod
print(ans)