Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    x = []
    xl = {}
    tmp = []
    tmp2 = []
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        low = max(xx-ll+1,0)
        high = xx+ll-1
        lmh = [low,xx,high]
        tmp.append(lmh)
        tmp2.append(lmh)
        x.append(xx)


    tmp.sort()

    # for i in range()
    flg = 0
    for i, a in enumerate(tmp):
        if flg == 0:

            low = a[0]
            high = a[2]
            flg = 1
        else:

            if low <= a[0] and high >= a[0]:
                 aa= tmp2.pop(tmp2.index(a))


        if i+1 < len(tmp) and high < tmp[i+1][0]:
            flg = 0
    print(len(tmp2))
    return


if __name__=='__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    x = []
    xl = {}
    tmp = []
    ans = 0
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        low = xx-ll
        high = xx+ll
        lmh = [high,xx,low]
        tmp.append(lmh)


    tmp.sort()
    high = tmp[0][0]
    ans = 1
    for i in range(1,len(tmp)):
        a = tmp[i]
        if a[2] >= high:
            high = a[0]
            ans += 1
        else:
            continue

    print(ans)
    return


if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    x = []
    xl = {}
    tmp = []
    tmp2 = []
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        low = max(xx-ll+1,0)
        high = xx+ll-1
        lmh = [low,xx,high]
        tmp.append(lmh)
        tmp2.append(lmh)
        x.append(xx)


    tmp.sort()

    # for i in range()
    flg = 0
    for i, a in enumerate(tmp):
        if flg == 0:

            low = a[0]
            high = a[2]
            flg = 1
        else:

            if low <= a[0] and high >= a[0]:
                 aa= tmp2.pop(tmp2.index(a))


        if i+1 < len(tmp) and high < tmp[i+1][0]:
            flg = 0
    print(len(tmp2))
    return


if __name__=='__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    x = []
    xl = {}
    tmp = []
    ans = 0
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        low = xx-ll
        high = xx+ll
        lmh = [high,xx,low]
        tmp.append(lmh)


    tmp.sort()
    high = tmp[0][0]
    ans = 1
    for i in range(1,len(tmp)):
        a = tmp[i]
        if a[2] >= high:
            high = a[0]
            ans += 1
        else:
            continue

    print(ans)
    return


if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    x = []
    xl = {}
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        xl[xx] = ll
        x.append(xx)
    
    temp = [[] for i in range(maxtmp+2)]
    for i in range(maxtmp+1):
        if i in xl.keys():
            for j in range(i-xl[i]+1, i+xl[i]):
                if j < 0 or j > maxtmp+1:
                    continue
                temp[j].append(i)


    for i,a in enumerate(temp):
        if len(a) <= 1:
            continue
        else:
            for j in range(1,len(a)):
                if a[j] in x:
                    v = x.index(a[j])
                    x.pop(v)
    print(len(x))

if __name__=='__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    x = []
    xl = {}
    tmp = []
    ans = 0
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        low = xx-ll
        high = xx+ll
        lmh = [high,xx,low]
        tmp.append(lmh)


    tmp.sort()
    high = tmp[0][0]
    ans = 1
    for i in range(1,len(tmp)):
        a = tmp[i]
        if a[2] >= high:
            high = a[0]
            ans += 1
        else:
            continue

    print(ans)
    return


if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    x = []
    xl = {}
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        xl[xx] = ll
        x.append(xx)
    
    temp = [[] for i in range(maxtmp+2)]
    for i in range(maxtmp+1):
        if i in xl.keys():
            for j in range(i-xl[i]+1, i+xl[i]):
                if j < 0 or j > maxtmp+1:
                    continue
                temp[j].append(i)


    for i,a in enumerate(temp):
        if len(a) <= 1:
            continue
        else:
            for j in range(1,len(a)):
                if a[j] in x:
                    v = x.index(a[j])
                    x.pop(v)
    print(len(x))

if __name__=='__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    x = []
    xl = {}
    tmp = []
    ans = 0
    maxtmp = 0
    for i in range(n):
        xx, ll = map(int,input().split())
        if maxtmp < xx:
            maxtmp = xx
        low = xx-ll
        high = xx+ll
        lmh = [high,xx,low]
        tmp.append(lmh)


    tmp.sort()
    high = tmp[0][0]
    ans = 1
    for i in range(1,len(tmp)):
        a = tmp[i]
        if a[2] >= high:
            high = a[0]
            ans += 1
        else:
            continue

    print(ans)
    return


if __name__=='__main__':
    main()