Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B, N = map(int, input().split())

tmp = 0
a = 0
i = 0

if B > A:
    for i in range(B - 1, N + 1, B):
        if (s := (A * i) // B - A * (a)) > 0:
            tmp = max(s, tmp)
        else:
        break

if i >= N - B:
    for i in range(N, N - N % B - 2, -1):
        if (s := (A * i) // B - A * (i // B)) > 0:
            tmp = max(s, tmp)
        else:
            break

print(tmp)


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

def f(num):
    return(A * num) // B - A * (num // B)

print(f(min(B - 1, N)))

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

tmp = 0
a = 0
i = 0
for i in range(B - 1, N + 1, B):
    if (s := (A * i) // B - A * (a)) > 0:
        tmp = max(s, tmp)
    else:
        break

if i >= N - B:
    for i in range(N, N - N % B - 1, -1):
        if (s := (A * i) // B - A * (i // B)) > 0:
            tmp = max(s, tmp)
        else:
            break

print(tmp)



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

def f(num):
    return(A * num) // B - A * (num // B)

print(f(min(B - 1, N)))

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

tmp = 0
a = 0
for i in range(B - 1, N + 1, B):
    if (s := (A * i) // B - A * a) > 0:
        tmp = max(s, tmp)
        a += 1
    else:
        break
    
for i in range(N, N - N % B - 1, -1):
    if (s := (A * i) // B - A * (i // B)) > 0:
        tmp = max(s, tmp)
    else:
        break

print(tmp)



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

def f(num):
    return(A * num) // B - A * (num // B)

print(f(min(B - 1, N)))

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

tmp = 0
for i in range(B - 1, N + 1, B):
    if (s := (A * i) // B - A * (i // B)) > 0:
        tmp = max(s, tmp)
    else:
        break
    
for i in range(N, N - N % B - 1, -1):
    tmp = max((A * i) // B - A * (i // B), tmp)

print(tmp)



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

def f(num):
    return(A * num) // B - A * (num // B)

print(f(min(B - 1, N)))

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

tmp = 0
for i in range(B - 1, N + 1, B):
    tmp = max((A * i) // B - A * (i // B), tmp)
    
for i in range(N, N - N % B - 1, -1):
    tmp = max((A * i) // B - A * (i // B), tmp)

print(tmp)



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

def f(num):
    return(A * num) // B - A * (num // B)

print(f(min(B - 1, N)))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

tmp = 1
num = 0
for i in range(len(S) - 1, -1, -1):
    num += tmp * int(S[i])
    lists[num % 2019] += 1
    tmp *= 10

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)


Fixed submission:
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)

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

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

for i in range(len(S)):
    lists[int(S[i:]) % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)


Fixed submission:
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)

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

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

for i in range(len(S)):
    lists[int(S[i:]) % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)

Fixed submission:
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)

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

ans = 0
for i in range(4, len(S)):
    tmp = 0
    for j in range(len(S) - 1, i - 1, -1):
        if tmp > 0:
            tmp -= 1
            continue
        if int(S[j - i: j + 1]) % 2019 == 0:
            ans += 1
            tmp = i - 1

print(ans)


Fixed submission:
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)

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

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

print(ans)

Fixed submission:
S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int n, k;
    scanf("%d %d", &n, &k);
    if (k == 1){
        printf("0\n");
    }else{
        while ((double)n >= (double)k / 2){
            n = abs(k - n);
        }
        printf("%d\n", n);
    }
    return 0;
}


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

if k > n:
    tmp = n
else:
    tmp = n % k

if tmp > k / 2:
    tmp = k - tmp

print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000000)

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

if k == 1:
    print(0)
elif n < k / 2:
    print(n)
else:
    while n >= k / 2:
        n = abs(k - n)
        
    print(n)
    


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

if k > n:
    tmp = n
else:
    tmp = n % k

if tmp > k / 2:
    tmp = k - tmp

print(tmp)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)

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

def a(N, K):
    if abs(K - N) < K / 2:
        print(abs(K - N))
    else:
        a(abs(K - N), K)
        

if k == 1:
    print(0)
elif n < k / 2:
    print(n)
else:
    a(abs(k - n), k)
    


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

if k > n:
    tmp = n
else:
    tmp = n % k

if tmp > k / 2:
    tmp = k - tmp

print(tmp)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000000000000000)

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

def a(N, K):
    if abs(K - N) < K / 2:
        print(abs(K - N))
    else:
        a(abs(K - N), K)
        

if k == 1:
    print(0)
elif n < k / 2:
    print(n)
else:
    a(abs(k - n), k)
    


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

if k > n:
    tmp = n
else:
    tmp = n % k

if tmp > k / 2:
    tmp = k - tmp

print(tmp)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)

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

def a(N, K):
    if abs(K - N) < K / 2:
        print(abs(K - N))
    else:
        a(abs(K - N), K)
        

if k == 1:
    print(0)
elif n < k / 2:
    print(n)
else:
    a(abs(k - n), k)
    


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

if k > n:
    tmp = n
else:
    tmp = n % k

if tmp > k / 2:
    tmp = k - tmp

print(tmp)
Buggy python submission (verdict: Runtime Error):
from math import gcd, sqrt
from collections import Counter

n = int(input()) 
times = 0

# 公約数を求める
def gcd(tmpn):
    lists = []
    while True:
        end = True
        for i in range(2, int(sqrt(tmpn)) + 1):
            if tmpn % i == 0:
                lists.append(i)
                tmpn = tmpn // i
                end = False         
        if end:  
            lists.append(tmpn)
            break
    return lists
    
def gori(lists, num=1, ans=[]):
    if len(lists) == 0:
        ans.append(num)
        return ans
    for i in range(len(lists)):
        tmp = lists[0:i] + lists[i + 1:len(lists)]
        ans = gori(tmp, num * lists[i], ans)
        ans = gori(tmp, num, ans)
    return ans

# 1を除いた公約数の個数を出力する
a = Counter(gcd(n - 1))
times = sum(map(lambda x: x+1, a.values())) - 1

a = set(gori(gcd(n)))
a.remove(1)

for i in a:
    tmp = n // i
    if tmp < i:
        if tmp == 1:
            times += 1
        
    else:
        while True:
            if tmp < i:
                if tmp == 1:
                    times += 1
                    break
            if tmp % i == 0:
                tmp = tmp // i
                    
            else:
                if tmp % i == 1:
                    times += 1
                break

print(times)       


Fixed submission:
from collections import Counter

n = int(input()) 
times = 0

def make_divisors(n):
    divisors = [n]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors
    
times = len(make_divisors(n - 1))
a = make_divisors(n)

for i in a:
    tmp = n // i
    if tmp == 1:
        times += 1 
        continue
    while tmp % i == 0:
        tmp = tmp // i
    if tmp % i == 1:
        times += 1 
    
print(times if n != 2 else 1)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
s, c = [], []
for i in range(m):
    a, b = map(input().split())
    s.append(a), c.append(b)
loop = True

for i in range(10 ** (n - 1), 10 ** n):
    string = str(i)
    for j in range(m):
        if string[s[j] - 1] != c[j]:
            break
        if j == m - 1:
            print(string)
            loop = False
    if loop == False:
        break
    if i == 10 ** n - 1:
        print('-1')
        

Fixed submission:
n, m = map(int, input().split())
s, c = [], []
for i in range(m):
    a, b = map(int, input().split())
    s.append(a), c.append(b)


for i in range(0, 10 ** n):
    loop = True
    string = str(i)
    if len(string) != n:
        continue
    for j in range(m):
        if string[s[j] - 1] != str(c[j]):
            loop = False
    if loop:
        print(string)
        exit()

print('-1')

Buggy python submission (verdict: Runtime Error):
s, c = [], []
for i in range(m):
    a, b = map(int, input().split())
    s.append(a), c.append(b)

dicts = {}

ans = [0 for i in range(n)]
b = 0

for i in range(m):
    if s[i] not in dicts:
        dicts[s[i]] = c[i]
    elif s[i] in dicts and dicts[s[i]] != c[i]:
        print('-1')
        break


    if i == m - 1:
        for j in range(n + 1):
            if j in dicts:
                ans[j - 1] = dicts[j]
        # print(ans)
        for j in range(n):
            b += ans[n - j - 1] * (10 ** j)
        
        if b >= 10 ** (n - 1) and b <= (10 ** n) - 1:
            print(b)
        else:
            print('-1')


Fixed submission:
n, m = map(int, input().split())
s, c = [], []
for i in range(m):
    a, b = map(int, input().split())
    s.append(a), c.append(b)


for i in range(0, 10 ** n):
    loop = True
    string = str(i)
    if len(string) != n:
        continue
    for j in range(m):
        if string[s[j] - 1] != str(c[j]):
            loop = False
    if loop:
        print(string)
        exit()

print('-1')
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
tmp = 1
mod = 10 ** 9 + 7

# 組み合わせ
kaijo = [(tmp := (i * tmp) % mod) for i in range(1, n + 1)]
inv = pow(kaijo[-1], mod - 2, mod)
invs = [inv] + [(inv := (inv * i) % mod) for i in range(n, 0, -1)]
C = [(((kaijo[n - 1] * invs[n - i]) % mod) * invs[i]) % mod for i in range(0, n + 1)]

print(pow(2, n, mod) - 1 - C[a] - C[b])


Fixed submission:
n, a, b = map(int, input().split())
if a > b: a, b = b, a
mod = 10 ** 9 + 7
tmp = 1

C = n
ans = 0
if a == 1: Ca = n
for r in range(1, n + 1):
    C = (((C * (n - r)) % mod )* pow(r + 1, mod - 2, mod)) % mod
    if r == a - 1:
        Ca = C
    if r == b - 1:
        Cb = C
        break

print((pow(2, n, mod) - Ca - Cb - 1) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(lambda i: (i + 1) / 2, list(map(int, input().split()))))
# print(p)
lists = [sum(p[i:i + k]) for i in range(n - k + 1)]
print('{0:.10f}'.format(max(lists)))

Fixed submission:
n, k = map(int, input().split())
p = list(map(lambda i: (i + 1) / 2, list(map(int, input().split()))))
suma = sum(p[0:k]) 
max = suma
for i in range(k, n):
    suma += (p[i] - p[i - k])
    if suma > max:
        max = suma

print('{:.8f}'.format(max))

Buggy python submission (verdict: Time Limit Exceeded):
def summm(a):
    ans = 0
    for i in a:
        ans += (i + 1) / 2
    return ans

n, k = map(int, input().split())
p = list(map(int, input().split()))
lists = [summm(p[i:i + k]) for i in range(n - k + 1)]
print('{0:.10f}'.format(max(lists)))

Fixed submission:
n, k = map(int, input().split())
p = list(map(lambda i: (i + 1) / 2, list(map(int, input().split()))))
suma = sum(p[0:k]) 
max = suma
for i in range(k, n):
    suma += (p[i] - p[i - k])
    if suma > max:
        max = suma

print('{:.8f}'.format(max))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

def ccc(lists, a=1):
    if a not in lists:
        return a - 1
    for i, j in enumerate(lists):
        if j == a:
            return ccc(lists[i:], a + 1)

print(len(a) - ccc(a) if ccc(a) != 0 else -1)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
num = 1
for i in a:
    if i == num:
        num += 1
    
print(len(a) - num + 1 if num != 1 else -1)
Buggy python submission (verdict: Runtime Error):
x = int(input())

elif x >= 100:
    print(1 if x % 100 <= x // 100 * 5 else 0)
else:
    print(0)


Fixed submission:
x = int(input())

if x >= 2000:
    print(1) 
elif x >= 100:
    print(1 if x % 100 <= x // 100 * 5 else 0)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
for i in range(len(s) + 1):
    tmp, tmpb = 0, 0
    for j in range(i, len(s)):
        if s[j] == '<':
            break
        tmpb += 1
    
    for j in range(i - 1, -1, -1):
        if s[j] == '>':
            break
        tmp += 1
    ans += max(tmp, tmpb)

print(ans)
    

Fixed submission:
s = input()
ans = 0
t = [0 for i in range(len(s) + 1)]
tmp = 0
for i in range(1, len(s) + 1):
    if s[i - 1] == '<':
        tmp += 1
    else:
        tmp = 0
    t[i] = tmp

ans += t[len(s)]
tmp = 0
for i in range(len(s) - 1, -1, -1):
    if s[i] == '>':
        tmp += 1
    else:
        tmp = 0
    ans += max(tmp, t[i])
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
for i in range(len(s) + 1):
    tmp, tmpb = 0, 0
    for j in range(len(s)):
        if i > j:
            if s[j] == '<':
                tmp += 1
            else:
                tmp = 0
        else:
            if s[j] == '>':
                tmpb += 1
            else:
                break
    ans += max(tmp, tmpb)

print(ans)
    

Fixed submission:
s = input()
ans = 0
t = [0 for i in range(len(s) + 1)]
tmp = 0
for i in range(1, len(s) + 1):
    if s[i - 1] == '<':
        tmp += 1
    else:
        tmp = 0
    t[i] = tmp

ans += t[len(s)]
tmp = 0
for i in range(len(s) - 1, -1, -1):
    if s[i] == '>':
        tmp += 1
    else:
        tmp = 0
    ans += max(tmp, t[i])
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def ABC146D_ColoringEdge():
    N = int(input())

    graph = [[] for i in range(0, N)]
    edge = [0] * (N - 1)
    for i in range(0, N - 1):
        frm, to = list(map(int, input().split()))
        frm -= 1
        to -= 1
        graph[frm].append(i)
        graph[to].append(i)
    
    maxColor = 0
    for node in graph:
        usedColor = []
        maxColor = max(maxColor, len(node))
        for eNo in node:
            if edge[eNo] is not 0:
                usedColor.append(edge[eNo])
        
        nowColor = 1
        for eNo in node:
            if edge[eNo] is 0:
                while nowColor in usedColor:
                    nowColor += 1

                edge[eNo] = nowColor
                usedColor.append(nowColor)

    print(maxColor)
    
    for color in edge:
        print(color)


def main():
    ABC146D_ColoringEdge()

if __name__ == "__main__":
    main()


Fixed submission:
def ABC146D_ColoringEdge():
    N = int(input())

    graph = [[] for i in range(0, N)]
    edge = [0] * (N - 1)
    for i in range(0, N - 1):
        frm, to = list(map(int, input().split()))
        frm -= 1
        to -= 1
        graph[frm].append(i)
        graph[to].append(i)
    
    maxColor = 0
    for node in graph:
        usedColor = []
        maxColor = max(maxColor, len(node))
        for eNo in node:
            if edge[eNo] is not 0:
                usedColor.append(edge[eNo])
        
        nowColor = 1
        for eNo in node:
            if edge[eNo] is 0:
                while nowColor in usedColor:
                    nowColor += 1

                edge[eNo] = nowColor
                usedColor.append(nowColor)

    print(maxColor)
    
    for color in edge:
        print(color)


def main():
    ABC146D_ColoringEdge()

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):

N, A, B  = input()

train = N * A

if(train < B) :
  print(train)
else:
  print(B)

Fixed submission:

N, A, B  = map(int, input().split())

train = N * A

if(train < B) :
  print(train)
else:
  print(B)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def ABC073C_WriteAndErase():
    N = int(input().strip())
    
    Ai = Counter()
    for i in range(N):
        num = int(input())

        if num in Ai.keys():
            del Ai[num]
        else:
            Ai[num] = 1

    print(len(Ai))
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()


Fixed submission:
from collections import Counter
def ABC073C_WriteAndErase():
    N = int(input().strip())
    Ai = [int(input().strip()) for i in range(N)]


    Bi = Counter(Ai)
    count = 0
    for key, val in Bi.items():
        if val % 2 == 1:
            count += 1

    print(count)
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def ABC073C_WriteAndErase():
    N = int(input().strip())
    
    Ai = []
    for i in range(N):
        num = int(input())

        if num in Ai:
            Ai.remove(num)
        else:
            Ai.append(num)

    print(len(Ai))
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()


Fixed submission:
from collections import Counter
def ABC073C_WriteAndErase():
    N = int(input().strip())
    Ai = [int(input().strip()) for i in range(N)]


    Bi = Counter(Ai)
    count = 0
    for key, val in Bi.items():
        if val % 2 == 1:
            count += 1

    print(count)
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def ABC073C_WriteAndErase():
    N = int(input().strip())
    
    Ai = []
    for i in range(N):
        num = int(input())

        if num in Ai:
            Ai.remove(num)
        else:
            Ai.append(num)

    print(len(Ai))
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()


Fixed submission:
from collections import Counter
def ABC073C_WriteAndErase():
    N = int(input().strip())
    Ai = [int(input().strip()) for i in range(N)]


    Bi = Counter(Ai)
    count = 0
    for key, val in Bi.items():
        if val % 2 == 1:
            count += 1

    print(count)
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
mod = int(1e9 +7)

ans = pow(10, N, mod=mod)
ans -= 2*pow(9, N, mod=mod)
ans += pow(8, N, mod=mod)

print(ans%mod)

Fixed submission:
N = int(input())
mod = int(1e9 +7)

ans = pow(10, N, mod=mod)
ans -= 2*pow(9, N, mod=mod)
ans += pow(8, N, mod=mod)

print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = [[] for _ in range(N)]
ans = 0
for i in range(N):
    X[i] = list(map(int, input().split()))
    for j in range(i):
        ans = max(ans,(abs(X[i][0]-X[j][0])+abs(X[i][1]-X[j][1])))

# for i in range(1, N):
#     for j in range(i):
#         ans = max(ans,(abs(X[i][0]-X[j][0])+abs(X[i][1]-X[j][1])))
print(ans)

Fixed submission:
N = int(input())
X = [[] for _ in range(N)]
z = [0 for _ in range(N)]
w = [0 for _ in range(N)]
for i in range(N):
    X[i] = list(map(int, input().split()))
    z[i] = X[i][0] +X[i][1]
    w[i] = X[i][0] -X[i][1]

ans = max(max(z)-min(z), max(w)-min(w))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = [[] for _ in range(N)]
ans = 0
for i in range(N):
    X[i] = list(map(int, input().split()))

for i in range(1, N):
    for j in range(i):
        ans = max(ans,(abs(X[i][0]-X[j][0])+abs(X[i][1]-X[j][1])))
print(ans)

Fixed submission:
N = int(input())
X = [[] for _ in range(N)]
z = [0 for _ in range(N)]
w = [0 for _ in range(N)]
for i in range(N):
    X[i] = list(map(int, input().split()))
    z[i] = X[i][0] +X[i][1]
    w[i] = X[i][0] -X[i][1]

ans = max(max(z)-min(z), max(w)-min(w))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = [[] for _ in range(N)]
d = set()
ans = 0
for i in range(N):
    X[i] = list(map(int, input().split()))

for i in range(1, N):
    for j in range(i):
        d.add(abs(X[i][0]-X[j][0])+abs(X[i][1]-X[j][1]))
print(max(d))

Fixed submission:
N = int(input())
X = [[] for _ in range(N)]
z = [0 for _ in range(N)]
w = [0 for _ in range(N)]
for i in range(N):
    X[i] = list(map(int, input().split()))
    z[i] = X[i][0] +X[i][1]
    w[i] = X[i][0] -X[i][1]

ans = max(max(z)-min(z), max(w)-min(w))
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
mod = int(1e9+7)

all = pow(sum(A), 2, mod=mod)%mod
d = 0
for a in A:
    d += pow(a,2)
    d = d%mod

print(int((all-d)*pow(2, mod-2, mod=mod))%mod)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = int(1e9+7)

all = pow(sum(A), 2, mod=mod)%mod
d = 0
for a in A:
    d += pow(a,2)
    d = d%mod

print(int((all-d)*pow(2, mod-2, mod=mod))%mod)