Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02975 (python)

Fixed submission:
import itertools
N=int(input())
an=[int(x) for x in map(int,input().split()[:N])]

ret=an[0]
for x in range(1,N):
    ret= an[x] ^ ret

if ret==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import itertools
N=int(input())
an=[int(x) for x in map(int,input().split()[:N])]

ret=an[0]
for x in range(1,N):
    ret= ret[x] ^ ret

if ret==0:
    print("Yes")
else:
    print("No")
Problem p02982 (python)

Fixed submission:
import numpy as np
from sys import stdin

N,D=[int(x) for x in stdin.readline().rstrip().split()]
data = [stdin.readline().rstrip().split() for _ in range(N)]

ret=0
for i in range(N-1):
    a=[ int(x) for x in data[i]]
    for j in range(i+1,N,1):
        b=[ int(x) for x in data[j]]
        u = np.array(b) - np.array(a)
        c = np.linalg.norm(u)
        de,inte=np.modf(c)
        if de == 0:
            ret+=1
            # print(a,end=" ")
            # print(b)

print(ret,flush=True)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N,D=[int(x) for x in stdin.readline().rstrip().split()]
data = [stdin.readline().rstrip().split() for _ in range(N)]

ret=0
for i in range(N-1):
    for j in range(i+1,N,1):
        a=[ int(x) for x in data[i]]
        b=[ int(x) for x in data[j]]
        u = np.array(b) - np.array(a)
        if np.linalg.norm(u).is_integer:
            ret+=1
            # print(a,end=" ")
            # print(b)

print(ret,flush=True)
Problem p02909 (python)

Fixed submission:
st = [ "Sunny" , "Cloudy" , "Rainy" ]
x = input()
s = st.index(x) + 1
if s <= 2 :
    print(st[s])
else :
    print(st[0])

Buggy submission (verdict: Runtime Error):
x = input()
st = [ 'Sunny' , 'Cloudy' , 'Rainy' ]
print(st[st.index(x) + 1 % 3])

Buggy submission (verdict: Runtime Error):
st = [ "Sunny" , "Cloudy" , "Rainy" ]
x = input()
print(st[st.index(x) + 1 % 3])
Problem p03238 (python)

Fixed submission:
# | Its_Rashid | #
n = int(input())
if n == 1 :
    print('Hello World')
else :
    a = int(input())
    b = int(input())
    print(a + b)

Buggy submission (verdict: Runtime Error):
# | Its_Rashid | #
n = int(input())
if n == 1 :
    print('Hello World')
else :
    print(sum([int(input()) for i in range()]))
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

N = N % 500

if N > A:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())

N = N % 500

if N > A:
  print(No)
else:
  print(Yes)
Problem p03607 (python)

Fixed submission:
n = int(input())

myset = set()
for i in range(n):
    a = int(input())
    if a in myset:
        myset.remove(a)
    else:
        myset.add(a)
ans = len(myset)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

myset = {}
for i in range(n):
    a = int(input())
    if a in myset:
        myset.remove(a)
    else:
        myset.add(a)
ans = len(myset)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]

myset = {}
for i in a:
    if i in myset:
        myset.remove(i)
    else:
        myset.add(i)
ans = len(myset)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]

ans = 0
max_a = max(a)
b = [0]*(max_a + 2)

for i in a:
    b[i] += 1

for i in b:
    if i % 2 != 0:
        ans += 1

print(ans)
Problem p03611 (python)

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

b = [0]*(max_a + 2)

for i in a:
    b[i] += 1

ans = 0
for i in range(max_a + 1):
    tmp = b[i-1] + b[i] + b[i+1]
    ans = max(ans, tmp)

print(ans)

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

a.sort()
cur = a[0]
ans1 = 1
ans = 1

for i in range(max(a)+1):
    if a[i + 1] - a[i] <= 2:
        cur = a[i]
        ans1 = a.count(cur) + a.count(cur + 1) + a.count(cur + 2)

        if ans < ans1:
            ans = ans1
        ans1 = 0

print(ans)
Problem p03693 (python)

Fixed submission:
r,g,b=map(int,input().split())

x = 10*g + b

if x % 4 == 0:
  print("YES") 
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())

x = 10*g + b

if x % 4 == 0:
  print("YES") 
  else 
  print("NO")

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())

x = 10*g + b

if x%4 == 0 :
  print("YES") 
  else 
  print("NO")

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())

x = 10*g + b

if x%4 == 0 :
  print("YES")
  
else
  print("NO")
Problem p02612 (python)

Fixed submission:
import math
n=int(input())
if n%1000==0:
    print(0)
else:
    x=math.ceil(n/1000)
    ans=int(x*1000)-n
    print(ans)

Buggy submission (verdict: Runtime Error):

n=int(input())
if n%1000==0:
    print(0)
else:
    x=math.ceil(n/1000)
    ans=int(x*1000)-n
    print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
r=[0]*(n+1)
for i in range(n):
    l[i+1]=gcd(l[i],a[i])
for i in range(n-1,-1,-1):
    r[i]=gcd(r[i+1],a[i])
ans=l[-1]
for i in range(n):
    ans=max(ans,gcd(l[i],r[i+1]))
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
r=[0]*(n+1)
for i in range(n):
    l[i+1]=gcd(l[i],a[i])
for i in range(n-1,-1,-1):
    r[i]=gcd(r[i+1],a[i])
ans=l[-1]
for i in range(n):
    ans=max(ans,gcd(l[i],r[i+1]))
print(ans)
Problem p02657 (python)

Fixed submission:
x, y = map(int, input().split())
print(x * y)

Buggy submission (verdict: Runtime Error):
a, b = map(int, __import('sys')__.stdin.readline().split())
print(a * b)
Problem p02675 (python)

Fixed submission:
n = int(input()[-1])
if n in [2, 4, 5, 7, 9]: print('hon')
elif n in [0, 1, 6, 8]: print('pon')
else: print('bon')

Buggy submission (verdict: Runtime Error):
n = int(input()[-1])
if n in [2, 4, 5, 7, 9]: print('hon')
else if n in [0, 1, 6, 8]: print('pon')
else: print('bon')
Problem p02705 (python)

Fixed submission:
from math import pi
print(f'{2 * pi * int(input()):.5f}')

Buggy submission (verdict: Runtime Error):
from math import pi
print(f'{2 * pi * r:.5f}')
Problem p02780 (python)

Fixed submission:
import sys
input = sys.stdin.readline

(n, k), s, res, sm = map(int, input().split()), list(map(lambda x: (int(x) + 1) / 2, input().split())), 0, 0
for i in range(n):
	if i < k: sm += s[i]
	else: sm += s[i]; sm -= s[i-k]
	res = max(res, sm)
print(f'{res:.10f}')
# print(f'{max([sum(s[i:i+k]) for i in range(n - k + 1)]):.10f}')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

(n, k), s = map(int, input().split()), list(map(lambda x: (int(x) + 1) / 2, input().split()))
print(f'{max([sum(s[i:i+k]) for i in range(n - k)]):.10f}')
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*(r**2))

Buggy submission (verdict: Runtime Error):
3*(r**2)

Buggy submission (verdict: Runtime Error):
3(r**2)

Buggy submission (verdict: Runtime Error):
S = 3*(r**2)
Problem p04020 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import math
from functools import reduce
from operator import add
if __name__ == '__main__':
    n = int(input())
    a = [0]
    ans = 0
    for i in range(n):
        tmp = int(input())
        a.append(tmp)
        if tmp == 0:
            ans += math.floor(reduce(add, a) // 2)
            a.clear()
            a.append(0)
    ans += math.floor(reduce(add, a) // 2)
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
from functools import reduce
if __name__ == '__main__':
    n = int(input())
    a = []
    ans = 0
    for i in range(n):
        tmp = int(input())
        a.append(tmp)
        if tmp == 0:
            ans += math.floor(reduce(lambda x, y: x + y, a) // 2)
            a.clear()
    ans += math.floor(reduce(lambda x, y: x + y, a) // 2)
    print(ans)
Problem p02612 (python)

Fixed submission:
n = int(input())
l = [1000,2000,3000,4000,5000,6000,7000,8000,9000,10000]
for i in l:
    if n <= i:
        r = i
        break
result = r - n
print(result)

Buggy submission (verdict: Runtime Error):
n = input()
l = [1000,2000,3000,4000,5000,6000,7000,8000,9000,10000]
for i in l:
    if n <= i:
        r = i
        break
result = r - n
print(result)
Problem p03087 (python)

Fixed submission:
n,q=(map(int,input().split()))
s=input()
count=0
c=[0]*n
for i in range(1,n):
        if s[i-1]=='A':
            if s[i]=='C':
               count+=1
        c[i]=count
for _ in range(q):
    l,r=(map(int,input().split())) 
    print(c[r-1]-c[l-1])

Buggy submission (verdict: Runtime Error):
n,q=(map(int,input().split()))
s=input()
count=0
for _ in range(q):
    l,r=[*map(int,input().split())]
    for i in range(l,r):
        if s[i-1]=='A':
            if s[i]=='C':
               count+=1 
    print(count)
    count=0

Buggy submission (verdict: Runtime Error):
n,q=(map(int,input().split()))
s=input()
count=0
for _ in range(q):
    l,r=[*map(int,input().split())]
    for i in range(l,r):
        if s[i-1]=="A":
            if s[i]=="C":
               count+=1 
    print(count)
    count=0

Buggy submission (verdict: Runtime Error):
n,q=[*map(int,input().split())]
s=input()
count=0
for _ in range(q):
    l,r=[*map(int,input().split())]
    for i in range(l,r):
        if s[i-1]=="A":
            if s[i]=="C":
               count+=1 
    print(count)
    count=0
Problem p03160 (python)

Fixed submission:
no=int(input())
s=list(map(int,input().split()))
a=[0]
a.append(abs(s[1]-s[0]))
for i in range(2,no):
    a.append(min(abs((s[i]-s[i-1]))+a[i-1],abs((s[i]-s[i-2]))+a[i-2]))
print(a[-1])

Buggy submission (verdict: Runtime Error):
no=int(input())
s=[*map(int,input().split())]
q=0
p=0
le=len(s)
if no==2:
    print(abs(s[1]-s[0]))
elif no==3:
    print(abs(s[2]-s[0]))
else:
    a=abs(s[1]-s[0])
    b=abs(s[2]-s[0])
    if no%2==0:
        for i in range(1,len(s)-1,2):
            q=q+abs(s[i]-s[i+2])
        q+=a
        for k in range(2,len(s)-2,2):
            p=p+abs(s[k]-s[k+2])    
        p+=b
        p=p+(abs((s[le-1])-(s[le-2])))
        print(min(q,p))
    else:
        for i in range(1,len(s)-2,2):
            q=q+abs(s[i]-s[i+2])
        q+=a
        q=q+(abs((s[le-1])-(s[le-2])))
        for k in range(2,len(s)-1,2):
            p=p+abs(s[k]-s[k+2])    
        p+=b
        print(min(q,p))

Buggy submission (verdict: Runtime Error):
no=int(input())
s=[*map(int,input().split())]
q=0
p=0
le=len(s)
if no==2:
    print(abs(s[1]-s[0]))
if no==3:
    print(abs(s[2]-s[0]))
else:
    a=abs(s[1]-s[0])
    b=abs(s[2]-s[0])
    if no%2==0:
        for i in range(1,len(s)-1,2):
            q=q+abs(s[i]-s[i+2])
        q+=a
        for k in range(2,len(s)-2,2):
            p=p+abs(s[k]-s[k+2])    
        p+=b
        p=p+(abs((s[le-1])-(s[le-2])))
        print(min(q,p))
    else:
        for i in range(1,len(s)-2,2):
            q=q+abs(s[i]-s[i+2])
        q+=a
        q=q+(abs((s[le-1])-(s[le-2])))
        for k in range(2,len(s)-1,2):
            p=p+abs(s[k]-s[k+2])    
        p+=b
        print(min(q,p))

Buggy submission (verdict: Runtime Error):
no=int(input())
s=[*map(int,input().split())]
q=0
p=0
le=len(s)
if no==2:
    print(abs(s[1]-s[0]))
if no==3:
    print(abs(s[2]-s[0]))
else:
    a=abs(s[1]-s[0])
    b=abs(s[2]-s[0])
    for i in range(1,len(s)-1,2):
        q=q+abs(s[i]-s[i+2])
    q+=a
    for k in range(2,len(s)-2,2):
        p=p+abs(s[k]-s[k+2])    
    p+=b
    p=p+(abs((s[le-1])-(s[le-2])))
    # print(p,q)
    print(min(q,p))
Problem p03102 (python)

Fixed submission:
import numpy as np

n, m, c = map(int, input().split())
array = np.array(list(map(int,input().split())))
nm = []
for _ in range(n):
    _ = list(map(int,input().split()))
    nm.append(_)

count = 0
for _ in nm:
    if np.inner(array, _)+c>0:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np

n, m, c = map(int, input().split())
array = np.array(list(map(int,input().split())))
nm = []
for _ in range(n):
    _ = list(map(int,input().split()))
    nm.append(_)

count = 0
for _ in nm:
    if np.inner(array, _)+c>0:
        count += 1
print(count)
Problem p02789 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from fractions import gcd
from string import ascii_lowercase as ABC
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
N, M = inpl()
if (N == M):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from heapq import heapify, heappop, heappush
from random import randint
from collections import defaultdict
from itertools import accumulate
from fractions import gcd
import sys
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
MOD = 10**9 + 7
N = int(input())
A = inpl()
#N = 10**4
#A = [randint(0, 10**6) for _ in range(10**4)]

lcm = 1
for a in A:
    lcm = a * lcm // gcd(a, lcm)
ans = 0
for i in range(N):
    ans = (ans + lcm // A[i])%MOD
print(ans)
Problem p02839 (python)

Fixed submission:
def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = [inpl() for _ in range(H)]
B = [inpl() for _ in range(H)]

DP = [[0 for _ in range(W+1)] for _ in range(H+1)]
DP[0][0] = 1 << 12800

for h in range(H):
    for w in range(W):
        d = abs(A[h][w] - B[h][w])
        DP[h+1][w] |= DP[h][w] >> d
        DP[h+1][w] |= DP[h][w] << d
        DP[h][w+1] |= DP[h][w] >> d
        DP[h][w+1] |= DP[h][w] << d
l = 1 << 12800
r = 1 << 12800
for i in range(12801):
    if (DP[-1][-2]& l) | (DP[-1][-2] & r):
        print(i)
        break
    l = l << 1
    r = r >> 1

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = [inpl() for _ in range(H)]
B = [inpl() for _ in range(W)]

DP = [[0 for _ in range(W+1)] for _ in range(H+1)]
DP[0][0] = 1 << 12800

for h in range(H):
    for w in range(W):
        d = abs(A[h][w] - B[h][w])
        DP[h+1][w] |= DP[h][w] >> d
        DP[h+1][w] |= DP[h][w] << d
        DP[h][w+1] |= DP[h][w] >> d
        DP[h][w+1] |= DP[h][w] << d
l = 1 << 12800
r = 1 << 12800
for i in range(12801):
    if (DP[-1][-2]& l) | (DP[-1][-2] & r):
        print(i)
        break
    l = l << 1
    r = r >> 1

Buggy submission (verdict: Runtime Error):
def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = [inpl() for _ in range(H)]
B = [inpl() for _ in range(W)]

DP = [[0 for _ in range(W+1)] for _ in range(H+1)]
DP[0][0] = 1 << 12800

for h in range(H):
    for w in range(W):
        d = abs(A[h][w] - B[h][w])
        DP[h+1][w] |= DP[h][w] >> d
        DP[h+1][w] |= DP[h][w] << d
        DP[h][w+1] |= DP[h][w] >> d
        DP[h][w+1] |= DP[h][w] << d
l = 1 << 12800
r = 1 << 12800
for i in range(12800):
    if (DP[-1][-2]& l) | (DP[-1][-2] & r):
        print(i)
        break
    l = l << 1
    r = r >> 1

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from heapq import heapify, heappop, heappush
from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = [inpl() for _ in range(H)]
B = [inpl() for _ in range(W)]

DP = [[[0]*25601 for _ in range(W+1)] for _ in range(H+1)]
DP[0][0][12800] = 1

for h in range(H):
    for w in range(W):
        d = A[h][w] - B[h][w]
        for i in range(25601):
            if DP[h][w][i] == 1:
                DP[h+1][w][i+d] = 1
                DP[h+1][w][i-d] = 1
                DP[h][w+1][i+d] = 1
                DP[h][w+1][i-d] = 1
for i in range(12800):
    if DP[-1][-2][12800+i] | DP[-1][-2][12800-i]:
        print(i)
        break
Problem p02866 (python)

Fixed submission:
from collections import Counter
import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

MOD = 998244353
N= int(input())
D = inpl()
C = Counter(D)

if (D[0] != 0) or (C[0] != 1):
    print(0)
else:
    M = max(C.keys())
    ans = 1
    for i in range(M):
        ans = ans * pow(C[i], C[i+1], MOD) % MOD
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

MOD = 998244353
N= int(input())
D = inpl()
C = Counter(D)

if (D[0] != 0) or (C[0] != 1):
    print(0)
else:
    M = max(C.keys())
    ans = 1
    for i in range(M):
        ans = ans * pow(C[i], C[i+1], MOD) % MOD
    print(ans)

Buggy submission (verdict: Runtime Error):
def inpl(): return list(map(int, input().split()))

MOD = 998244353
N= int(input())
D = inpl()
C = Counter(D)

if (D[0] != 0) or (C[0] != 1):
    print(0)
else:
    M = max(C.keys())
    ans = 1
    for i in range(M):
        ans = ans * pow(C[i], C[i+1], MOD) % MOD
    print(ans)
Problem p02868 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
from operator import itemgetter
from heapq import heappop, heappush
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N, M = inpl()
D = [0] + [10**18]*(N-1)
g0 = itemgetter(0)
Q = sorted([inpl() for _ in range(M)], key=g0, reverse=True)
#print(*Q, sep="\n")

HQ = [(0, 0), (10**18, N)]

for i in range(N):
    while HQ[0][1] < i:
        heappop(HQ)
    v = HQ[0][0]
    while len(Q) and (i == (Q[-1][0]-1)):
        l, r, c = Q.pop()
        heappush(HQ, (v+c, r-1))


if v == 10**18:
    print(-1)
else:
    print(v)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
from operator import itemgetter
from heapq import heappop, heappush
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N, M = inpl()
D = [0] + [10**18]*(N-1)
g0 = itemgetter(0)
Q = sorted([inpl() for _ in range(M)], key=g0, reverse=True)
#print(*Q, sep="\n")

HQ = [(0, 0)]

for i in range(N):
    while HQ[0][1] < i:
        heappop(HQ)
    v = HQ[0][0]
    while len(Q) and (i == (Q[-1][0]-1)):
        l, r, c = Q.pop()
        heappush(HQ, (v+c, r-1))


if v == 10**18:
    print(-1)
else:
    print(v)
Problem p02889 (python)

Fixed submission:
import sys
from heapq import heappush, heappop
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N, M, L = inpl()
G = [[] for _ in range(N)]
G2 = [[999]*(N) for _ in range(N)]

for _ in range(M):
    a, b, c = inpl()
    if c <= L:
        G[a-1].append([b-1, c])
        G[b-1].append([a-1, c])

for i in range(N):
    supply = [999]*N
    remain = [0]*N
    supply[i] = 1
    remain[i] = L
    Q = [(1, -L, i)]
    while Q:
        s, r, p = heappop(Q)
        r = -r
        if s > supply[p]:
            continue
        if (s == supply[p]) and (r < remain[p]):
            continue
        for q, c in G[p]:
            if r >= c:
                if supply[q] > s:
                    supply[q] = s
                    remain[q] = r - c
                    heappush(Q, (s, c-r, q))
                elif (supply[q] == s) & (remain[q] < r - c):
                    remain[q] = r-c
                    heappush(Q, (s, c-r, q))
            else:
                if supply[q] > (s + 1):
                    supply[q] = s + 1
                    remain[q] = L - c
                    heappush(Q, (s+1, c-L, q))
                elif (supply[q] == (s+1)) & (remain[q] < L - c):
                    supply[q] = s+1
                    remain[q] = L-c
                    heappush(Q, (s+1, c-L, q))
    for j in range(N):
        G2[i][j] = supply[j]


for _ in range(int(input())):
    s, t = inpl()
    if G2[s-1][t-1] == 999:
        print(-1)
    else:
        print(G2[s-1][t-1]-1)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N, M, L = inpl()
G = [[] for _ in range(N)]
G2 = [[999]*(N) for _ in range(N)]

for _ in range(M):
    a, b, c = inpl()
    if c <= L:
        G[a-1].append([b-1, c])
        G[b-1].append([a-1, c])

for i in range(N):
    supply = [999]*N
    remain = [0]*N
    supply[i] = 1
    remain[i] = L
    Q = [(1, -L, i)]
    while Q:
        s, r, p = heappop(Q)
        r = -r
        if s > supply[p]:
            continue
        if (s == supply[p]) and (r < remain[p]):
            continue
        for q, c in G[p]:
            if r >= c:
                if supply[q] > s:
                    supply[q] = s
                    remain[q] = r - c
                    heappush(Q, (s, c-r, q))
                elif (supply[q] == s) & (remain[q] < r - c):
                    remain[q] = r-c
                    heappush(Q, (s, c-r, q))
            else:
                if supply[q] > s:
                    supply[q] = s + 1
                    remain[q] = L - c
                    heappush(Q, (s+1, c-L, q))
                elif (supply[q] == (s+1)) & (remain[q] < L - c):
                    supply[q] = s+1
                    remain[q] = L-c
                    heappush(Q, (s+1, c-L, q))
    for j in range(N):
        G2[i][j] = supply[j]


for _ in range(int(input())):
    s, t = inpl()
    if G2[s-1][t-1] == 999:
        print(-1)
    else:
        print(G2[s-1][t-1]-1)
Problem p02969 (python)

Fixed submission:
print(3*int(input())**2)

Buggy submission (verdict: Runtime Error):
print(3*int(input()**2)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stfin.readline
n=int(input())
a=[int(input())for _ in range(n)]
b=sorted(a)
for a in a:print(b[(a<b[-1])-2])
Problem p02972 (python)

Fixed submission:
def inpl(): return list(map(int, input().split()))

N = int(input())
A = [0] + inpl()
D = [0]*(N+1)

for i in range(N, 0, -1):
    D[i] = (sum(D[2*i::i])%2)^A[i]
print(sum(D))
print(*[i for i in range(N+1) if D[i]])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0] + inpl()
D = [0]*(N+1)

for i in range(N, 0, -1):
    D[i] = (sum(D[2*i::i])%2)^A[i]

print(sum(D))
print(*[i for i in range(N+1) if D[i]])
Problem p02982 (python)

Fixed submission:
def inpl(): return map(int, input().split())
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
input = sys.stdin.readline
from collections import Counter
import numpy as np
def inpl(): return list(map(int, input().split()))
N, D = inpl()
S = set([i**2 for i in range(1, 400)])
X = np.array([inpl() for _ in range(N)], dtype=np.int64)

ans = 0
for i in range(N):
    for x in np.power(X - X[i], 2).sum(axis=1):
        if x in S:
            ans += 1
print(ans//2)

Buggy submission (verdict: Runtime Error):
def inpl(): return map(int, input().split())
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
input = sys.stdin.readline
from collections import Counter
import numpy as np
def inpl(): return list(map(int, input().split()))
N, D = inpl()
S = set([i**2 for i in range(1, 400)])
X = np.array([inpl() for _ in range(N)], dtype=np.int64)

ans = 0
for i in range(N):
    for x in np.power(X - X[i], 2).sum(axis=1):
        if x in S:
            ans += 1
print(ans//2)
Problem p02999 (python)

Fixed submission:
def inpl(): return list(map(int, input().split()))
X, A = inpl()
if X < A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
def inpl(): return list(map(int, input().split()))
W, H, x, y = inpl()
if x > W/2:
    x = W-x
if y > H/2:
    y = H-y

a = W*y
b = H*x
if x == 0 or y == 0:
    print(H*W/2, 0)
elif W/H == x/y:
    print(H*W/2, int(W/2==x))
elif a == b:
    print(a, 1)
    raise
elif a > b:
    print(a, int(2*x == W))
else:
    print(b, int(2*y == H))