Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(k)]
mod = 998244353

s.sort()

dp = np.zeros(n * 2)
dp[1] = 1

for i in range(1, n):
    for l, r in s:
        dp[i + l:i + r + 1] += dp[i]
        dp[i + l:i + r + 1] %= mod

ans=int(dp[n] % mod)
print(ans)


Fixed submission:
n, k = map(int, input().split())
mod = 998244353
lr = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n + 10)
dp[1] = 1
cumsum = [0] * (n + 10)
cumsum[1] = 1

for i in range(2, n + 1):
    for l, r in lr:
        if l >= i:
            continue

        ll = max(1, i - r)
        rr = i - l
        if ll <= rr:
            dp[i] += cumsum[rr] - cumsum[ll - 1]
            dp[i] %= mod
    cumsum[i] = cumsum[i - 1] + dp[i]
    cumsum[i] %= mod

print(dp[n] % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
s = []
mod = 998244353
for _ in range(k):
    l, r = map(int, input().split())
    s += [i for i in range(l, r + 1)]

s.sort()

dp = [0] * 2 * n
dp[1] = 1

for i in range(1, n):
    for j in s:
        if i + j <= n:
            dp[i + j] += dp[i]
            dp[i + j] %= mod

print(dp[n] % mod)


Fixed submission:
n, k = map(int, input().split())
mod = 998244353
lr = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n + 10)
dp[1] = 1
cumsum = [0] * (n + 10)
cumsum[1] = 1

for i in range(2, n + 1):
    for l, r in lr:
        if l >= i:
            continue

        ll = max(1, i - r)
        rr = i - l
        if ll <= rr:
            dp[i] += cumsum[rr] - cumsum[ll - 1]
            dp[i] %= mod
    cumsum[i] = cumsum[i - 1] + dp[i]
    cumsum[i] %= mod

print(dp[n] % mod)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache
import sys

sys.setrecursionlimit(2000)

s = int(input())
mod = 10 ** 9 + 7


@lru_cache(maxsize=1000)
def dfs(n):
    if n <= 2:
        return 0
    elif n==3:
        return 1
    else:
        count = 1
        for i in range(3, n + 1):
            count += dfs(n - i)
            count %= mod

        return count % mod


ans = dfs(s)
print(ans)


Fixed submission:
from functools import lru_cache
import sys

sys.setrecursionlimit(2000)

s = int(input())
mod = 10 ** 9 + 7


@lru_cache(maxsize=None)
def dfs(n):
    if n <= 2:
        return 0
    elif n == 3:
        return 1
    else:
        count = 1
        for i in range(3, n + 1):
            count += dfs(n - i)
            count %= mod

        return count % mod


ans = dfs(s)
print(ans)

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


def dfs(n):
    if n <= 2:
        return 0
    elif n == 3:
        return 1
    else:
        count = 1
        for i in range(3, n + 1):
            count += dfs(n - i)

        return count


ans = dfs(s)
print(ans)


Fixed submission:
from functools import lru_cache
import sys

sys.setrecursionlimit(2000)

s = int(input())
mod = 10 ** 9 + 7


@lru_cache(maxsize=None)
def dfs(n):
    if n <= 2:
        return 0
    elif n == 3:
        return 1
    else:
        count = 1
        for i in range(3, n + 1):
            count += dfs(n - i)
            count %= mod

        return count % mod


ans = dfs(s)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

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

cum = [0] * (n - k + 1)
cum[0] = reduce(lambda x, y: x * y, a[0:0 + k])
for i in range(1, n - k + 1):
    cum[i] = cum[i - 1] * a[i + k - 1] // a[i - 1]

for i in range(1, len(cum)):
    if cum[i] > cum[i - 1]:
        print('Yes')
    else:
        print('No')


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

for i in range(k, n):
    if a[i - k] / a[i] < 1:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

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

cum = [0] * (n - k + 1)
cum[0] = reduce(lambda x, y: x * y, a[0:0 + k])
for i in range(1, n - k + 1):
    cum[i] = cum[i - 1] * a[i + k - 1] // a[i - 1]

for i in range(1, len(cum)):
    if cum[i] > cum[i - 1]:
        print('Yes')
    else:
        print('No')


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

for i in range(k, n):
    if a[i - k] / a[i] < 1:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

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

cum = [0] * (n - k + 1)
for i in range(n - k + 1):
    cum[i] = reduce(lambda x, y: x * y, a[i:i + k])

for i in range(1, len(cum)):
    if cum[i] > cum[i - 1]:
        print('Yes')
    else:
        print('No')


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

for i in range(k, n):
    if a[i - k] / a[i] < 1:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

for i in range(1, n + 1):
    ans = 0
    limit = int(i ** 0.5) + 1
    for x in range(1, limit):
        for y in range(x, limit):
            for z in range(y, limit):
                if (x + y + z) ** 2 == i + x * y + y * z + z * x:
                    if len(set([x, y, z])) == 1:
                        ans += 1
                    elif len(set([x, y, z])) == 2:
                        ans += 3
                    else:
                        ans += 6
    print(ans)


Fixed submission:
n = int(input())

ans = [0] * (10 ** 4 + 1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x * x + y * y + z * z + x * y + y * z + z * x
            if s <= 10 ** 4:
                ans[s] += 1

for i in range(1, n + 1):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

x = Counter(a)
for b, c in bc:
    x[c] += x[b]
    x[b] = 0

    ans = 0
    for key, value in x.most_common():
        ans += key * value
    print(ans)


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

x = Counter(a)
ans = sum(a)
for b, c in bc:
    ans += (c - b) * x[b]
    print(ans)
    x[c] += x[b]
    x[b] = 0
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
else:
    num = set(range(1, 101)) ^ set(p)
    num = sorted([[abs(i - x), i] for i in num])
    
    if len(num) >= 2 and num[0][0] == num[1][0]:
        print(min(num[0][1], num[1][1]))
    else:
        print(num[0][1])


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

if n == 0:
    print(x)
else:
    num = list(set(range(-200, 200)) ^ set(p))
    num = sorted([[abs(i - x), i] for i in num])
    if len(num) >= 2 and num[0][0] == num[1][0]:
        print(min(num[0][1], num[1][1]))
    else:
        print(num[0][1])

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

if n == 0:
    print(x)
else:
    num = set(range(1, 101)) ^ set(p)
    num = sorted([[abs(i - x), i] for i in num])
    if num[0][0] == num[1][0]:
        print(min(num[0][1], num[1][1]))
    else:
        print(num[0][1])


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

if n == 0:
    print(x)
else:
    num = list(set(range(-200, 200)) ^ set(p))
    num = sorted([[abs(i - x), i] for i in num])
    if len(num) >= 2 and num[0][0] == num[1][0]:
        print(min(num[0][1], num[1][1]))
    else:
        print(num[0][1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

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

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


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

if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            exit()

    print(ans)

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

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

ans = 1
for i in a:
    ans = Decimal(str(ans * i))

print(ans) if ans <= Decimal(str(10 ** 18)) else print(-1)


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

if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            exit()

    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

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

ans = reduce(lambda x, y: x * y, a)
print(ans) if ans <= 10 ** 18 else print(-1)


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

if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            exit()

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
abcd = []
for i in range(q):
    abcd.append(list(map(int, input().split())))

A = []


def dfs(num):
    if len(num) == n:
        A.append(num)
    else:
        now = num[-1]
        for i in range(now, m + 1):
            dfs(num + [i])


for i in range(1, 10):
    dfs([i])

ans = 0
for i in range(len(A)):
    now = A[i]
    point = 0
    for j in range(q):
        a, b, c, d = abcd[j]
        a -= 1
        b -= 1
        if int(now[b]) - int(now[a]) == c:
            point += d

    ans = max(ans, point)

print(ans)


Fixed submission:
n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(q)]

A = []


def dfs(num):
    if len(num) == n:
        A.append(num)
    else:
        now = num[-1]
        for i in range(now, m + 1):
            dfs(num + [i])


for i in range(1, 10):
    dfs([i])

ans = 0
for now in A:
    point = 0
    for a, b, c, d in abcd:
        if now[b-1] - now[a-1] == c:
            point += d

    ans = max(ans, point)

print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
abcd = []
for i in range(q):
    abcd.append(list(map(int, input().split())))

A = []


def dfs(num):
    if len(str(num)) == n:
        A.append(num)
    else:
        now = int(str(num)[-1])
        for i in range(now, m + 1):
            dfs(int(str(num) + str(i)))


for i in range(1, 10):
    dfs(i)

ans = 0
for i in range(len(A)):
    now = str(A[i])
    point = 0
    for j in range(q):
        a, b, c, d = abcd[j]
        a -= 1
        b -= 1
        if int(now[b]) - int(now[a]) == c:
            point += d

    ans = max(ans, point)

print(ans)


Fixed submission:
n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(q)]

A = []


def dfs(num):
    if len(num) == n:
        A.append(num)
    else:
        now = num[-1]
        for i in range(now, m + 1):
            dfs(num + [i])


for i in range(1, 10):
    dfs([i])

ans = 0
for now in A:
    point = 0
    for a, b, c, d in abcd:
        if now[b-1] - now[a-1] == c:
            point += d

    ans = max(ans, point)

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

total = [0] * (n + 1)
cnt = [0] * mod
cnt[0] = 1

for i in range(1, n + 1):
    now = int(s[n - i:])
    now %= mod
    cnt[now] += 1

ans = 0
for i in cnt:
    ans += i * (i - 1) // 2

print(ans)


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

mod = 2019
cnt = [0] * mod
cnt[0] = 1
digit = 1
now = 0

for i in range(1, n + 1):
    now += int(s[-i]) * digit
    digit *= 10
    digit %= mod
    now %= mod
    cnt[now] += 1

ans = 0
for i in cnt:
    ans += i * (i - 1) // 2

print(ans)

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

ans = 0
for i in range(len(s) - 3):
    for j in range(i + 3, len(s)):
        num = int(s[i:j + 1])
        if num % 2019 == 0:
            ans += 1

print(ans)


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

mod = 2019
cnt = [0] * mod
cnt[0] = 1
digit = 1
now = 0

for i in range(1, n + 1):
    now += int(s[-i]) * digit
    digit *= 10
    digit %= mod
    now %= mod
    cnt[now] += 1

ans = 0
for i in cnt:
    ans += i * (i - 1) // 2

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

ans = 0
for j in range(1, n):
    m = s[j]
    for i in range(j):
        l = s[i]
        for k in range(j + 1, n):
            r = s[k]
            if 2 * j == i + k:
                continue
            else:
                if m != l and m != r and l != r:
                    ans += 1

print(ans)


Fixed submission:
n = int(input())
s = list(input())

r = sum([1 for x in s if x == 'R'])
g = sum([1 for x in s if x == 'G'])
b = sum([1 for x in s if x == 'B'])
ans = r * g * b

for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if j < k <= n - 1:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n, x, y = map(int, input().split())

inf = 100100100

x -= 1
y -= 1

ans = [0] * n

for i in range(n):
    dist = [inf] * n
    queue = deque()
    queue.append(i)
    dist[i] = 0
    while queue:
        current = queue.popleft()
        d = dist[current]

        if current - 1 >= 0 and dist[current - 1] == inf:
            queue.append(current - 1)
            dist[current - 1] = d + 1
        if current + 1 < n and dist[current + 1] == inf:
            queue.append(current + 1)
            dist[current + 1] = d + 1
        if current == x and dist[y] == inf:
            queue.append(y)
            dist[y] = d + 1
        if current == y and dist[x] == inf:
            queue.append(x)
            dist[x] = d + 1

    for j in range(n):
        ans[dist[j]] += 1

for k in range(1, n):
    print(ans[k] // 2)


Fixed submission:
from collections import deque, Counter

n, x, y = map(int, input().split())

inf = 100100100
x -= 1
y -= 1

ans = [0] * n

for i in range(n):
    dist = [inf] * n
    queue = deque()
    queue.append(i)
    dist[i] = 0
    while queue:
        current = queue.popleft()
        d = dist[current]

        if current - 1 >= 0 and dist[current - 1] == inf:
            queue.append(current - 1)
            dist[current - 1] = d + 1
        if current + 1 < n and dist[current + 1] == inf:
            queue.append(current + 1)
            dist[current + 1] = d + 1
        if current == x and dist[y] == inf:
            queue.append(y)
            dist[y] = d + 1
        if current == y and dist[x] == inf:
            queue.append(x)
            dist[x] = d + 1

    for j in range(n):
        ans[dist[j]] += 1

for k in range(1, n):
    print(ans[k] // 2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    set = set(a)
    count = [a.count(x) for x in set]
    ans = sum([x * (x - 1) // 2 for x in count])

    for i in range(n):
        print(ans - a.count(a[i]) + 1)


Fixed submission:
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    kw = Counter(a)
    ans = sum([x * (x - 1) // 2 for x in kw.values()])

    for i in range(n):
        print(ans - kw[a[i]] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    kw = Counter(a)
    for i in range(n):
        ans = 0
        for k, v in kw.most_common():
            if k == a[i]:
                ans += (v - 1) * (v - 2) // 2
            else:
                ans += v * (v - 1) // 2

        print(ans)


Fixed submission:
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    kw = Counter(a)
    ans = sum([x * (x - 1) // 2 for x in kw.values()])

    for i in range(n):
        print(ans - kw[a[i]] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    for i in range(n):
        ans = 0
        temp = a[:i] + a[i + 1:]
        for k in [temp.count(x) for x in set(temp)]:
            if k != 1:
                ans += k * (k - 1) // 2

        print(ans)


Fixed submission:
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    kw = Counter(a)
    ans = sum([x * (x - 1) // 2 for x in kw.values()])

    for i in range(n):
        print(ans - kw[a[i]] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    for i in range(n):
        ans = 0
        temp = a[:i] + a[i + 1:]
        kw = Counter(temp)
        for k in kw.values():
            if k != 1:
                ans += k * (k - 1) // 2

        print(ans)


Fixed submission:
from collections import Counter

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

if len(a) == len(set(a)):
    for i in range(n):
        print(0)
else:
    kw = Counter(a)
    ans = sum([x * (x - 1) // 2 for x in kw.values()])

    for i in range(n):
        print(ans - kw[a[i]] + 1)
Buggy python submission (verdict: Runtime Error):
import math

h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
elif (h * w) % 2 == 0:
    ans = (h * w) // 2
else:
    ans = (h // 2) * w + math.ceil(w / 2)

print(ans)


Fixed submission:
import math

h, w = map(int, input().split())

if h == 1 or w == 1:
    ans = 1
elif (h * w) % 2 == 0:
    ans = (h * w) // 2
else:
    ans = (h // 2) * w + math.ceil(w / 2)

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

p_sum = [0] * (n + 1)

for i in range(1, n + 1):
    p_sum[i] = p_sum[i - 1] + p[i]

ans = 0
for i in range(-k + 1):
    ans = max(ans, p_sum[i + k] - p_sum[i])

ans = (ans + k) / 2
print(ans)


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

if n != k:
    memo = [0] * (n + 1)

    for i in range(n):
        memo[i] = memo[i - 1] + p[i]

    ans = 0
    for i in range(k, n):
        ans = max(ans, memo[i] - memo[i - k])

    ans = (ans + k) / 2
    print(ans)
else:
    ans = (sum(p) + k) / 2
    print(ans)

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

memo = [0] * n

for i in range(k - 1, len(p)):
    memo[i] = sum(p[i - k + 1:i + 1])

ans = (max(memo) + k) / 2
print(ans)


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

if n != k:
    memo = [0] * (n + 1)

    for i in range(n):
        memo[i] = memo[i - 1] + p[i]

    ans = 0
    for i in range(k, n):
        ans = max(ans, memo[i] - memo[i - k])

    ans = (ans + k) / 2
    print(ans)
else:
    ans = (sum(p) + k) / 2
    print(ans)

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

ans = 0
for i in range(k - 1, len(p)):
    ans = max(ans, sum(p[i - k + 1:i + 1]))

print((ans + k) / 2)


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

if n != k:
    memo = [0] * (n + 1)

    for i in range(n):
        memo[i] = memo[i - 1] + p[i]

    ans = 0
    for i in range(k, n):
        ans = max(ans, memo[i] - memo[i - k])

    ans = (ans + k) / 2
    print(ans)
else:
    ans = (sum(p) + k) / 2
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(x) for x in input().split()]

ans = 0

for i in range(n):
    baes = p[i]
    flag = True
    for j in range(i):
        if p[i] > p[j]:
            flag = False
            break

    if flag:
        ans += 1

print(ans)


Fixed submission:
n = int(input())
p = [int(x) for x in input().split()]

ans = 1
base = p[0]

for i in range(1, n):
    if p[i] < base:
        ans += 1
        base = p[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

lr = []
for i in range(n):
    l = max(xl[i][0] - xl[i][1], 0)
    r = max(xl[i][0] + xl[i][1], 0)
    lr.append([l, r])

lr = sorted(lr)

remove = 0
skip = False

for i in range(1, n):
    if lr[i - 1][0] == lr[i][0]:
        remove += 1
    elif lr[i - 1][0] < lr[i][0] < lr[i - 1][1]:
        if not lr[i][0] < lr[i + 1][0] < lr[i][1]:
            remove += 1

print(n - remove)


Fixed submission:
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

lr = []
for i in range(n):
    l = max(xl[i][0] - xl[i][1], 0)
    r = max(xl[i][0] + xl[i][1], 0)
    lr.append([r, l])

lr = sorted(lr)
keep = [False] * n
# print(lr)

cur = 0
for i in range(n):
    if cur <= lr[i][1]:
        keep[i] = True
        cur = lr[i][0]
'''
for j in range(n - 1):
    if keep[j]:
        if lr[j][0] == lr[j + 1][0]:
            keep[j + 1] = False
        elif lr[j][0] < lr[j + 1][0]:# < lr[j][1]:
            keep[j + 1] = False
'''
#print(keep)
ans = sum(1 for x in range(n) if keep[x])
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

lr = []
lim = 0
for i in range(n):
    l = max(xl[i][0] - xl[i][1], 0)
    r = max(xl[i][0] + xl[i][1], 0)
    lim = max(lim, l, r)
    lr.append([l, r])

memo = [0] * lim

remove = 0
for i in range(n):
    for j in range(lr[i][0], lr[i][1]):
        if memo[j] == 1:
            remove += 1
            break
        else:
            memo[j] = 1

print(n - remove)


Fixed submission:
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

lr = []
for i in range(n):
    l = max(xl[i][0] - xl[i][1], 0)
    r = max(xl[i][0] + xl[i][1], 0)
    lr.append([r, l])

lr = sorted(lr)
keep = [False] * n
# print(lr)

cur = 0
for i in range(n):
    if cur <= lr[i][1]:
        keep[i] = True
        cur = lr[i][0]
'''
for j in range(n - 1):
    if keep[j]:
        if lr[j][0] == lr[j + 1][0]:
            keep[j + 1] = False
        elif lr[j][0] < lr[j + 1][0]:# < lr[j][1]:
            keep[j + 1] = False
'''
#print(keep)
ans = sum(1 for x in range(n) if keep[x])
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

ans = a * b // math.gcd(a, b)
print(ans)


Fixed submission:
import fractions

a, b = map(int, input().split())

ans = a * b // fractions.gcd(a, b)
print(ans)