Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
X = readline().decode().rstrip()

hoge = [pow(2, i) for i in range(N + 5)]
counts = [1 if i in hoge else -1 for i in range(N + 5)]

for i in range(N):
    cnt = X.count('1')

    tmp = 0
    X_ = list(X)
    m = 0
    if X[i] == "0":
        cnt += 1
        X_[i] = "1"
    else:
        X_[i] = "0"
        cnt -= 1

    X_ = "".join(X_)
    acc = 0
    for j, c in enumerate(X_[::-1]):
        if c == '1':
            acc += hoge[j]
    if acc > 2 * pow(10, 5):
        if acc % cnt == 0:
            print(1)
            continue
        else:
            acc %= cnt
            cnt = bin(acc).count('1')
            tmp += 1

    if counts[acc] != -1:
        print(counts[acc] + tmp)
    else:
        while True:
            if acc % cnt == 0:
                counts[acc] = 1
                print(counts[acc] + tmp)
                break
            elif counts[acc % cnt] != 0:
                counts[acc] = counts[acc % cnt] + 1
                print(counts[acc] + tmp)
                break

            acc %= cnt
            cnt = bin(acc).count('1')
            #print(acc, cnt)


Fixed submission:
#! /usr/bin/env python3

import sys
import numpy as np
from functools import lru_cache
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)


@lru_cache(maxsize=None)
def f(x):
    if x == 0:
        return 0
    return f(x % bin(x).count('1')) + 1


N = int(readline())
X = readline().decode().rstrip()
X_ = int(X, 2)
X_cnt = X.count('1')
p1 = X_ % (X_cnt + 1)
m1 = X_ % (X_cnt - 1) if X_cnt > 1 else 0

for i in range(N):
    if X[i] == '0':
        cnt = X_cnt + 1
        acc = (p1 + pow(2, N - i - 1, cnt)) % cnt

    else:
        cnt = X_cnt - 1
        if cnt == 0:
            print(0)
            continue
        acc = (m1 - pow(2, N - i - 1, cnt)) % cnt
    print(f(acc) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

ans = 1
for a in A:
    ans *= a

print(ans) if ans <= pow(10, 18) else print(-1)


Fixed submission:
#! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

limit = pow(10, 18)
N, *A = map(int, read().split())
A = sorted(A)

ans = 1
for a in A:
    ans *= a
    if ans > limit:
        print(-1)
        sys.exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


c = list(Counter(prime_factorize(N)).values())

ans = 0
used = {}

for i in range(len(c)):
    acc = 0
    cnt = 1
    while True:
        if c[i] >= acc + cnt:
            c[i] -= acc+cnt
            acc = acc+cnt
            ans += 1
        else:
            break
c = sorted(c)[::-1]

hoge = 1
for hoge in range(1, 1000):
    for _ in range(100000):
        for i in range(len(c)-1):
            if min(c[i:i+hoge+1]) >= 1:
                for k in range(hoge+1):
                    c[i+k]-=1
                ans += 1
        c = sorted(c)[::-1]

print(ans)


Fixed submission:
#! /usr/bin/env python3

import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


c = list(Counter(prime_factorize(N)).values())

ans = 0
used = {}

for i in range(len(c)):
    cnt = 1
    while True:
        if c[i] >= cnt:
            c[i] -= cnt
            ans += 1
            cnt += 1
        else:
            break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

X = int(read())

for a in range(pow(10, 9)):
    B_ = pow(a, 5) - X
    B = pow(B_, -5)
    if B_ == pow(B, 5):
        print(a, int(B))
        sys.exit()


Fixed submission:
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

X = int(read())
A = np.array([pow(i, 5) for i in range(7000)])

for i, B_f in enumerate(A):
    for sig in [1, -1]:
        diff = A - (sig * B_f)
        if (diff == X).any():
            A_f = X + (sig * B_f)
            AA = A.tolist().index(A_f)
            B = A.tolist().index(B_f)
            print(AA, sig * B)
            sys.exit()
Buggy python submission (verdict: Runtime Error):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S, W = map(int, read())

if W >= S:
    print("unsafe")
else:
    print("safe")


    

Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S, W = map(int, read().split())

if W >= S:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()

l = 0

cnt = 0
while l < len(S):
    r = l + 3
    while r < len(S):
        acc = S[l:r + 1]
        if int(acc) % 2019 == 0:
            cnt += 1
        r += 1
    l += 1

print(cnt)


Fixed submission:
import sys
from collections import Counter, defaultdict
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()

reminders = defaultdict(lambda: 0)
tmp = 0
mul = 1

for c in S[::-1]:
    c = int(c)
    tmp = (tmp + c * mul) % 2019
    mul = mul * 10 % 2019
    reminders[tmp] += 1
reminders[0] += 1

ans = 0

for r, cnt in reminders.items():
    ans += cnt * (cnt - 1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()

l = 0
r = 0

cnt = 0
while l < len(S):
    r = l
    while r < len(S):
        acc = S[l:r + 1]
        if int(acc) % 2019 == 0:
            cnt += 1
        r += 1
    l += 1

print(cnt)


Fixed submission:
import sys
from collections import Counter, defaultdict
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()

reminders = defaultdict(lambda: 0)
tmp = 0
mul = 1

for c in S[::-1]:
    c = int(c)
    tmp = (tmp + c * mul) % 2019
    mul = mul * 10 % 2019
    reminders[tmp] += 1
reminders[0] += 1

ans = 0

for r, cnt in reminders.items():
    ans += cnt * (cnt - 1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from fractions import gcd
from itertools import combinations
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

K = int(read())
ans = 0

for a in range(1, K + 1):
    for b in range(1, K + 1):
        acc = gcd(a, b)
        for c in range(1, K + 1):
            acc_ = gcd(acc, c)
            ans += acc_
print(ans)

Fixed submission:
import sys
#from fractions import gcd
from math import gcd
from itertools import combinations
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

K = int(read())
ans = 0

for a in range(1, K + 1):
    for b in range(1, K + 1):
        acc = gcd(a, b)
        for c in range(1, K + 1):
            acc_ = gcd(acc, c)
            ans += acc_
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

K, N = map(int, readline().split())
A = list(map(int, readline().split()))
A_ = [a + K for a in A]

ans = 10**9 + 7
min1, max1 = min(A), max(A)

for i, a_ in enumerate(A_):
    A_[i] -= K
    max2 = max(A_)
    min2 = min(A_)
    acc = min(max1 - min1, max2 - min2)
    ans = min(ans, acc)
    A_[i] += K

print(ans)


Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

K, N = map(int, readline().split())
A = list(map(int, readline().split()))
A_ = [a + K for a in A]

ans = 10**9 + 7
min1, max1 = min(A), max(A)

for i in range(N):
    if A[i - 1] - A[i] > 0:
        CW = A[i - 1] - A[i]
    else:
        CW = A[i] + K - A[i - 1]

    if i != N - 1:
        if A[i] - A[i + 1] > 0:
            CCW = A[i] - A[i + 1]
        else:
            CCW = A[i] + K - A[i + 1]
    else:
        CCW = A[i] - A[0]

    ans = min(ans, min(CW, CCW))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)


def warshall_floyd(dist):
    for k, _ in enumerate(dist):
        for i, _ in enumerate(dist):
            for j, _ in enumerate(dist):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    return dist


N, X, Y = map(int, read().split())
c = [[N + 10] * N for _ in range(N)]
for i in range(N - 1):
    c[i][i] = 0
    c[i][i + 1] = 1
    c[i + 1][i] = 1
c[N - 1][N - 1] = 0
c[X - 1][Y - 1] = 1
c[Y - 1][X - 1] = 1

cc = sum(warshall_floyd(c), [])

for i in range(1, N):
    print(cc.count(i) // 2)


Fixed submission:
import sys
import numpy as np
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, X, Y = map(int, read().split())
dist = []
for i in range(1, N):
    node = np.arange(i + 1, N + 1)

    d = np.abs(node - i)
    dd = np.abs(i - X) + np.abs(Y - node) + 1
    ddd = np.abs(i - Y) + np.abs(X - node) + 1

    acc = np.minimum(np.minimum(d, dd), ddd)

    dist.append(acc)

dist = np.concatenate(dist)

cnt = np.bincount(dist, minlength=N)
for i in range(1, N):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)


def warshall_floyd(dist):
    for k, _ in enumerate(dist):
        for i, _ in enumerate(dist):
            for j, _ in enumerate(dist):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    return dist


N, X, Y = map(int, read().split())
c = [[N + 10] * N for _ in range(N)]
for i in range(N - 1):
    c[i][i] = 0
    c[i][i + 1] = 1
    c[i + 1][i] = 1
c[N - 1][N - 1] = 0
c[X - 1][Y - 1] = 1
c[Y - 1][X - 1] = 1

cc = sum(warshall_floyd(c), [])

for i in range(1, N):
    print(cc.count(i) // 2)


Fixed submission:
import sys
import numpy as np
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, X, Y = map(int, read().split())
dist = []
for i in range(1, N):
    node = np.arange(i + 1, N + 1)

    d = np.abs(node - i)
    dd = np.abs(i - X) + np.abs(Y - node) + 1
    ddd = np.abs(i - Y) + np.abs(X - node) + 1

    acc = np.minimum(np.minimum(d, dd), ddd)

    dist.append(acc)

dist = np.concatenate(dist)

cnt = np.bincount(dist, minlength=N)
for i in range(1, N):
    print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
A = list(map(int, readline().split()))

counts = {}

for a in A:
    if a not in counts:
        counts[a] = 1
    else:
        counts[a] += 1

for a in A:
    ans = 0
    counts[a] -= 1

    for k, v in counts.items():
        if v >= 2:
            ans += v * (v - 1) // 2
    counts[a] += 1
    print(ans)


Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
A = list(map(int, readline().split()))

counts = {}

for a in A:
    if a not in counts:
        counts[a] = 1
    else:
        counts[a] += 1

alls = 0
for k, v in counts.items():
    if v >= 2:
        alls += v * (v - 1) // 2
for a in A:
    acc = counts[a]
    print(alls - (acc - 1))
Buggy python submission (verdict: Runtime Error):
import sys
from  decimal import *
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

a, b, c = map(int, read().split())
if pow(Decimal(a), .5) + pow(Decimal(b, .5)) < pow(Decimal(c, .5)):


        print("Yes")
    else:
        print("No")


Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

a, b, c = map(int, read().split())
if ((c - a - b) > 0) & (4 * a * b < pow(c - a - b, 2)):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import sys
from  decimal import *
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

a, b, c = map(int, read().split())
if pow(Decimal(a), .5) + pow(Decimal(b, .5) < pow(Decimal(c, .5)):


        print("Yes")
    else:
        print("No")


Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

a, b, c = map(int, read().split())
if ((c - a - b) > 0) & (4 * a * b < pow(c - a - b, 2)):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()
q = int(readline())

head = ""
tail = ""
flip = 0
for _ in range(q):
    que = readline().decode().split()
    if len(que) == 1:
        head, tail = tail[::-1], head[::-1]
        flip += 1

    else:
        if que[1] == '1':

            head = ''.join([que[2], head])

        else:
            tail = ''.join([tail, que[2]])

if flip % 2 == 0:
    print(''.join([head, S, tail]))
else:
    print(''.join([head, S[::-1], tail]))


Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()
q = int(readline())

head = ""
tail = ""
flip = 0
for _ in range(q):
    que = readline().decode().split()
    if len(que) == 1:
        flip += 1

    else:
        if que[1] == '1':
            if flip % 2 == 0:

                head = ''.join([que[2], head])
            else:
                tail = ''.join([tail, que[2]])

        else:
            if flip % 2 == 0:

                tail = ''.join([tail, que[2]])
            else:
                head = ''.join([que[2], head])

if flip % 2 == 0:
    print(''.join([head, S, tail]))
else:
    print(''.join([tail[::-1], S[::-1], head[::-1]]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()
q = int(readline())

for _ in range(q):
    que = readline().decode().split()
    if len(que) == 1:
        S = S[::-1]
    else:
        if que[1] == '1':
            S = que[2] + S
        else:
            S += que[2]

print(S)


Fixed submission:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()
q = int(readline())

head = ""
tail = ""
flip = 0
for _ in range(q):
    que = readline().decode().split()
    if len(que) == 1:
        flip += 1

    else:
        if que[1] == '1':
            if flip % 2 == 0:

                head = ''.join([que[2], head])
            else:
                tail = ''.join([tail, que[2]])

        else:
            if flip % 2 == 0:

                tail = ''.join([tail, que[2]])
            else:
                head = ''.join([que[2], head])

if flip % 2 == 0:
    print(''.join([head, S, tail]))
else:
    print(''.join([tail[::-1], S[::-1], head[::-1]]))
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

s, t = read().decode().split()
a, b = map(int, read().split())
u = read().decode()

if u == s:
    a -= 1
else:
    b -= 1

print(a, b)


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

s, t = readline().decode('utf-8').split()
a, b = map(int, readline().split())
u = read().decode('utf-8').rstrip()

if u == s:
    a -= 1
else:
    b -= 1

print(a, b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *P = map(int, read().split())

P_ = [0] * N
for i in range(N):
    P_[i] = (1 + P[i]) / 2

ans = 0

for i in range(N - K + 1):
    acc = sum(P_[i:i + K])
    ans = max(ans, acc)

print(ans)


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *P = map(int, read().split())

P_ = [0] * N

acc = sum(P[:K])
ans = (acc + K) / 2

for i in range(N - K):
    acc -= P[i]
    acc += P[i + K]
    ans = max(ans, (acc + K) / 2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *P = map(int, read().split())
P = np.array(P)

cnt = 0
for i in range(N):
    acc = P >= P[i]
    if acc[:i + 1].sum() == i + 1:
        cnt += 1

print(cnt)


Fixed submission:
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *P = map(int, read().split())
P = np.array(P)

acc = P[0]
cnt = 0
for p in P:
    if acc >= p:
        cnt += 1
    acc = min(acc, p)

print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(readline())
xl = [list(map(int, readline().decode('utf-8').split())) for _ in range(n)]
xl = np.array(xl)
xl_ = np.c_[xl[:, 0] - xl[:, 1], xl[:, 0] + xl[:, 1]]
xl_ += abs(xl_.min()) + 1

cnt_array = np.zeros(xl_.max())
cnt = 0
for l, r in xl_:
    if (cnt_array[l:r] > 0).sum() > 0:
        continue
    else:
        cnt_array[l:r] += 1
        cnt += 1

cnt_ = 0
for l, r in xl_[::-1]:
    if (cnt_array[l:r] > 0).sum() > 0:
        continue
    else:
        cnt_array[l:r] += 1
        cnt_ += 1

print(max(cnt, cnt_))


Fixed submission:
import sys
from operator import itemgetter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(readline())
xl = [list(map(int, readline().decode('utf-8').split())) for _ in range(n)]
LR = [(x - l, x + l) for x, l in xl]
LR.sort(key=itemgetter(1))

acc = -10**18

cnt = 0

for l, r in LR:
    if acc > l:
        continue
    cnt += 1
    acc = r

print(cnt)

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(readline())
xl = [list(map(int, readline().decode('utf-8').split())) for _ in range(n)]
xl = np.array(xl)
xl_ = np.c_[xl[:, 0] - xl[:, 1], xl[:, 0] + xl[:, 1]]
xl_ += abs(xl_.min())

cnt_array = np.zeros(xl_.max())
cnt = 0
for l, r in xl_:
    if (cnt_array[l:r] > 0).sum() > 0:
        continue
    else:
        cnt_array[l:r] += 1
        cnt += 1

cnt_ = 0
for l, r in xl_[::-1]:
    if (cnt_array[l:r] > 0).sum() > 0:
        continue
    else:
        cnt_array[l:r] += 1
        cnt_ += 1

print(max(cnt, cnt_))


Fixed submission:
import sys
from operator import itemgetter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(readline())
xl = [list(map(int, readline().decode('utf-8').split())) for _ in range(n)]
LR = [(x - l, x + l) for x, l in xl]
LR.sort(key=itemgetter(1))

acc = -10**18

cnt = 0

for l, r in LR:
    if acc > l:
        continue
    cnt += 1
    acc = r

print(cnt)