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

Fixed submission:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    RGB = [1, 0, 0]
    ans = 1
    if A[0] !=0:
        print(0)
        return
    for i in range(1, N):
        a = A[i]
        if a == 0:
            if 0 in RGB:
                j = RGB.index(a)
                RGB[j] += 1
            else:
                print(0)
                return
        elif a not in RGB:
            print(0)
            return
        else:
            k = RGB.count(a)
            ans *= k
            ans %= MOD
            j = RGB.index(a)
            RGB[j] += 1
    z = RGB.count(0)
    if z == 0:
        ans *= 6
        ans %= MOD
    elif z == 1:
        ans *= 6
        ans %= MOD
    else:
        ans *= 3
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    RGB = [1, 0, 0]
    ans = 1
    for i in range(1, N):
        a = A[i]
        if a == 0:
            j = RGB.index(a)
            RGB[j] += 1

        elif a in RGB:
            print(0)
            return
        else:
            k = RGB.count(a)
            ans *= k
            ans %= MOD
            j = RGB.index(a)
            RGB[j] += 1
    z = RGB.count(0)
    if z == 0:
        ans *= 6
        ans %= MOD
    elif z == 1:
        ans *= 6
        ans %= MOD
    else:
        ans *= 3
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    RGB = [1, 0, 0]
    ans = 1
    for i in range(1, N):
        a = A[i]
        if a == 0:
            j = RGB.index(a)
            RGB[j] += 1
        else:
            k = RGB.count(a)
            ans *= k
            ans %= MOD
            j = RGB.index(a)
            RGB[j] += 1
    z = RGB.count(0)
    if z == 0:
        ans *= 6
        ans %= MOD
    elif z == 1:
        ans *= 6
        ans %= MOD
    else:
        ans *= 3
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()
Problem p02854 (python)

Fixed submission:
from itertools import accumulate
import sys
n=int(input())
A=list(map(int,input().split()))
S=sum(A)/2
B=list(accumulate(A))

for i in range(n):
    B[i]-=S
    if B[i]<0:
        continue
    elif B[i]==0:
        print(0)
        sys.exit()
    else:
        if i==0:
            print(A[0]-A[1:])
        elif i>0 and i<n-1:
            a=abs(sum(A[:i])-sum(A[i:]))
            b=abs(sum(A[:i+1])-sum(A[i+1:]))
            print(min(a,b))
        else:
            print(A[n-1]-sum(A[:n-1]))
        sys.exit()

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
S=sum(A)//2
cnt=0
i=0
while cnt<S:
    cnt+=A[i]
    i+=1
ans1=abs(cnt-sum(A[i:]))
ans2=abs(cnt+A[i]-sum(A[i+1:]))
print(min(ans1,ans2))
Problem p02972 (python)

Fixed submission:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = []
    C = [0] * N

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

        # divisors.sort()
        return divisors

    for i in range(N):
        if A[N - i - 1] == 1:
            if C[N - i - 1] == 0:
                B.append(N - i)
                D = make_divisors(N - i)
                for d in D:
                    C[d - 1] += 1
                    C[d - 1] %= 2
        else:
            if C[N - i - 1] == 1:
                B.append(N - i)
                D = make_divisors(N - i)
                for d in D:
                    C[d - 1] += 1
                    C[d - 1] %= 2
    print(len(B))
    print(*B, sep=" ")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
B=[]
for i in range(n,0,-1):
    if n//i>1:
        l=n//i
        cnt=0
        for k in range(2,l+1):
            cnt+=a[i*k-1]
        if cnt%2!=a[i-1]:
            B.append(str(i))
    else:
        if a[i-1]==1:
            B.append(str(i))

print(len(B))
if len(B)>0:
    for i in range(len(B)):
        B[i]=str(B[i])
    print(' '.join(B))
Problem p02975 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))
if len(b)==1 and b[0]==0:
    print('Yes')
elif len(b)==2 and min(b)==0:
    b.sort()
    if n%3==0:
        if a.count(b[0])*2==a.count(b[1]):
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif n%3!=0:
    print('No')
else:
    if len(b)!=3:
        print('No')
    elif b[0]^b[1]==b[2]:
        if a.count(b[0])==a.count(b[1])==a.count(b[2]):
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))
if n%3!=0:
    print('No')
else:
    if b[0]^b[1]!=b[2]:
        print('No')
    elif a.count(b[0])==a.count(b[1])==a.count(b[2]):
        print('Yes')
    else:
        print('No')
Problem p03061 (python)

Fixed submission:
try:
    from fractions import gcd
except:
    from math import gcd
from itertools import accumulate
N=int(input())
A=[int(i) for i in input().split()]
l=[0]+list(accumulate(A,gcd))
g=list(reversed(list(accumulate(reversed(A),gcd))))+[0]

print(max([gcd(l[i-1],g[i]) for i in range(1,N+1)]))

Buggy submission (verdict: Runtime Error):
from math import gcd
from itertools import accumulate
N=int(input())
A=[int(i) for i in input().split()]
GCD=[]
if len(A)==2:
    print(max(A))
else:
    for i in range(N):
        B=A.copy()
        B.remove(B[i])
        C=list(accumulate(B,gcd))
        GCD.append(C[-1])
    print(max(GCD))
Problem p03086 (python)

Fixed submission:
S=list(input())
Count=[]
for i in range(len(S)):
    if S[i] in ['A','C','T','G']:
        Count.append(1)
    else:
        Count.append(0)
c=0
m=[]
for i in range(len(S)):
    if Count[i]==1:
        c+=1
        m.append(c)
        continue
    else:
        c*=0
        m.append(c)
        continue


print(max(m))

Buggy submission (verdict: Runtime Error):
S=input()
C=[]
count=0
for i in S:
    if i in {'A','C','G','T'}:
        count += 1
        continue
    elif i not in {'A','C','G','T'}:
        C.append(count)
        count=0
        continue
    
print(max(C))
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0
for i in range(1,n):
    t+=1 if (s[i-1]=='A' and s[i]=='C') else 0
    c.append(t)
for i 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()
c=[0]
t=0
for i in range(1,n+1):
    t+=1 if (s[i-1]=='A' and s[i]=='C') else 0
    c.append(t)
for i 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()
c=[0]
t=0
for i in range(1,n+1):
    t+=1 if (s[i-1]=='A' and s[i]=='C') else 0
    c.append(t)
for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])
print(c)

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

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
c=[0]
t=0
for i in range(1:N):
    t+=1 if (s[i-1]=='A' and s[i]=='C') else 0
    c.append(t)
for i in range(q):
    l,r=map(int,input().split())
    print(c[r]-c[l])
Problem p03274 (python)

Fixed submission:
n,k=map(int,input().split())
X=[int(i) for i in input().split()]
road=[]
for i in range(n-k+1):
    if X[i]<=0 and X[i+k-1]>=0:
        r=min(abs(X[i]),X[i+k-1])+X[i+k-1]-X[i]
    elif X[i]<=0 and X[i+k-1]<=0:
        r=abs(X[i])
    else:
        r=X[i+k-1]
    road.append(r)

print(min(road))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
X=[int(i) for i in input().split()]+[0]
X.sort()
sn=X.index(0)
road=[]
for j in range(sn):
    if X[j+k]>0:
        road.append(abs(X[j]-0)+abs(X[j+k]-X[j]))
    else:
        road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))

for j in range(sn+1,n-k+1):
    road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))

if len(road)>0:
    print(min(road))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
X=[int(i) for i in input().split()]+[0]
X.sort()
sn=X.index(0)
print(X)
road=[]
for j in range(sn):
    if X[j+k]>0:
        road.append(abs(X[j]-0)+abs(X[j+k]-X[j]))
    else:
        road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))

for j in range(sn+1,n-k+1):
    road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))

if len(road)>0:
    print(min(road))
else:
    print(0)
Problem p03281 (python)

Fixed submission:

N=int(input())
if N<105:
  print(0)
elif 105<=N<135:
  print(1)
elif 135<=N<165:
  print(2)
elif 165<=N<189:
  print(3)
elif 189<=N<195:
  print(4)
else:
  print(5)

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    if N < 105:
        print(0)
        return

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

    cnt = 1
    for n in range(106, N + 1):
        d = make_divisors(n)
        if len(d) == 8:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()
Problem p03294 (python)

Fixed submission:
from itertools import accumulate
from fractions import gcd
def lcm_(x,y):
    return x*y//gcd(x,y)
def lcm(numbers):
    return list(accumulate(numbers,lcm_))
n=int(input())
A=[int(i) for i in input().split()]
L=lcm(A)[-1]-1
f=0
for i in A:
    f+=L%i

print(f)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
from math import gcd
def lcm_(x,y):
    return x*y//gcd(x,y)
def lcm(numbers):
    return list(accumulate(numbers,lcm_))
n=int(input())
A=[int(i) for i in input().split()]
L=lcm(A)[-1]-1
f=0
for i in A:
    f+=L%i

print(f)
Problem p03347 (python)

Fixed submission:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    if A[0] != 0:
        print(-1)
        return
    answer = 0
    flag = 0
    for i in range(N - 1):
        if A[i + 1] - A[i] > 1:
            print(-1)
            return
        elif A[i + 1] == A[i]:
            answer += A[i]
        elif A[i + 1] == A[i] + 1:
            flag = A[i + 1]
        else:
            answer += flag
            flag = A[i + 1]
    answer += flag
    print(answer)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    if A[0] != 0:
        print(-1)
        return
    answer = 0
    for i in range(N - 1):
        if A[i + 1] - A[i] > 1:
            print(-1)
            return
        elif A[i + 1] == A[i]:
            answer += A[i]
        elif A[i + 1] == A[i] + 1:
            flag = A[i + 1]
        else:
            answer += flag
            flag = 0
    answer += flag
    print(answer)


if __name__ == "__main__":
    main()
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print('Yes')
elif abs(b-a)<=d and abs(c-b)<=d:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print('Yes')
elif abc(b-a)<=d and abs(c-b)<=d:
  print('Yes')
else:
  print('No')
Problem p03393 (python)

Fixed submission:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    S = input()
    A = set(chr(ord("a") + x) for x in range(26))
    if len(S) < 26:
        se = A - set(S)
        x = min(se)
        print(S + x)

    else:
        if S == "".join(sorted(A, reverse=True)):
            print(-1)
            return
        else:
            c = []
            S = list(S)
            while True:
                x = S[-1]
                if not c or (x > max(c)):
                    c.append(S.pop())
                    continue
                y = min(ch for ch in c if ch > x)
                S = "".join(S[:-1]) + y
                print(S)
                return


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    s = input()
    S = list(s)
    A = list(reversed(list("zyxwvutsrqponmlkjihgfedcba")))
    for i in range(26):
        if A[i] not in S:
            S.append(A[i])
            print(*S, sep="")
            return
    else:
        B = []
        for s in S:
            B.append(ord(s))
        for i in range(25):
            if B[25 - i] > B[25 - i - 1]:
                continue
            else:
                k = 25 - i - 1
        if k == 0:
            print(-1)
            return
        a = S[k - 1]
        S = S[: k - 1]
        for i in range(26):
            if A[i] not in S:
                if ord(A[i]) > ord(a):
                    S.append(A[i])
                    print(*S, sep="")
                    return


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    s = input()
    S = list(s)
    A = list(reversed(list("zyxwvutsrqponmlkjihgfedcba")))
    for i in range(26):
        if A[i] not in S:
            S.append(A[i])
            print(*S, sep="")
            return
    else:
        A = []
        for s in S:
            A.append(ord(s))
        for i in range(25):
            if A[25 - i] > A[25 - i - 1]:
                continue
            else:
                k = 25 - i - 1
        if k == 0:
            print(-1)
            return
        S = S[: k - 1]
        S.append(chr(min(A[k:])))
        print(*S, sep="")


if __name__ == "__main__":
    main()
Problem p03436 (python)

Fixed submission:
from collections import deque
h,w=map(int,input().split())
field=[list(input()) for _ in range(h)]
cost=[[float('inf')]*w for _ in range(h)]
cost[0][0]=1
queue=deque([[0,0]])
count=0
for i in range(h):
    for j in range(w):
        if field[i][j]=='.':
            count+=1
def bfs():
    while queue:
        x,y=queue.popleft()
        for dx,dy in [[1,0],[-1,0],[0,1],[0,-1]]:
            if 0<=x+dx<h and 0<=y+dy<w:
                if field[x+dx][y+dy]=='.' and cost[x+dx][y+dy]==float('inf'):
                    cost[x+dx][y+dy]=cost[x][y]+1
                    queue.append([x+dx,y+dy])
bfs()
#print(cost)
if cost[-1][-1]<float('inf'):
    print(count-cost[-1][-1])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
h,w=map(int,input().split())
field=[list(input()) for _ in range(h)]
count=0
queue=deque([[0,0,0]])
for i in range(h):
    for j in range(w):
        if field[i][j]=='.':
            count+=1
def bfs(x,y,k):
    if (not 0<=x<h) or (not 0<=y<w):
        return
    if field[x][y]=='#':
        return
    queue.append([x,y,k+1])
#    print(queue)
#    print(field)
while True:
    x,y,k=queue.popleft()
    if x==h-1 and y==w-1:
        print(count-k-1)
        sys.exit()
    field[x][y]='#'
    bfs(x+1,y,k)
    bfs(x-1,y,k)
    bfs(x,y-1,k)
    bfs(x,y+1,k)
print(-1)
Problem p03486 (python)

Fixed submission:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)

for i in range(min(len(s),len(t))):
    if s[i]==t[i]:
        count=1
        continue
    elif s[i]<t[i]:
        count=2
        break
    else:
        count=0
        break
if count==1:
    if len(s)<len(t):
        print('Yes')
    else:
        print('No')
elif count==2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
count=0
for i in range(len(s)):
    if s[i]==t[i]:
        count=1
        continue
    elif s[i]<t[i]:
        count=2
        break
    else:
        count=0
        break
if count==1:
    if len(s)<len(t):
        print('Yes')
    else:
        print('No')
elif count==2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
count=0
for i in range(len(s)):
    if s[i]==t[i]:
        count+=1
        continue
    elif s[i]<t[i]:
        print('Yes')
        count=0
        break
    else:
        print('No')
        count=0
        break
if count!=0 and len(s)<len(t):
    print('Yes')
elif count!=0 and len(s)>=len(t):
    print('No')
Problem p03611 (python)

Fixed submission:
import numpy as np

N = int(input())
A = np.bincount(np.array(list(map(int, input().split()))))

B = A.copy()
B[1:] += A[:-1]
B[:-1] += A[1:]

answer = B.max()
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

if N >= 3:
    counter = Counter(A)
    m = min(A)
    M = max(A)
    cnt = []
    for i in range(m, M - 1):
        ans = counter[i] + counter[i + 1] + counter[i + 2]
        if ans:
            cnt.append(ans)
        print(cnt)
    print(max(cnt))

elif N == 2:
    if abs(A[0] - A[1]) <= 2:
        print(2)
    else:
        print(1)

elif N == 1:
    print(1)

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

if N >= 3:
    counter = Counter(A)
    m = min(A)
    M = max(A)
    cnt = []
    for i in range(m, M - 2):
        cnt.append(counter[i] + counter[i + 1] + counter[i + 2])
    print(max(cnt))

elif N == 2:
    if abs(A[0] - A[1]) <= 2:
        print(2)
    else:
        print(1)

elif N == 1:
    print(1)
Problem p03613 (python)

Fixed submission:
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
if n==1:
        print(1)
elif n==2:
    if abs(A[0]-A[1])==1:
        print(2)
    else:
        print(1)
else:
    for i in A:
        if i not in L:
            L[i]=1
        else:
            L[i]+=1
    ans=[]
    for j in range(A[0],A[-1]+1):
        if (j in L) and (j-1 in L) and (j+1 in L):
            ans.append(L[j]+L[j+1]+L[j-1])
        elif (j in L) and (j-1 in L):
            ans.append(L[j-1]+L[j])
        elif (j in L) and (j+1 in L):
            ans.append(L[j+1]+L[j])
        elif (j-1 in L) and (j+1 in L):
            ans.append(L[j+1]+L[j-1])
        elif (j in L):
            ans.append(L[j])
    print(max(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
if n==1:
        print(1)
elif n==2:
    if abs(A[0]-A[1])==1:
        print(2)
    else:
        print(1)
else:
    for i in A:
        if i not in L:
            L[i]=1
        else:
            L[i]+=1
    print(L)
    ans=[]
    for j in range(A[0],A[-1]+1):
        if (j in L) and (j-1 in L) and (j+1 in L):
            ans.append(L[j]+L[j+1]+L[j-1])
        elif (j in L) and (j-1 in L):
            ans.append(L[j-1]+L[j])
        elif (j in L) and (j+1 in L):
            ans.append(L[j+1]+L[j])
        elif (j-1 in L) and (j+1 in L):
            ans.append(L[j+1]+L[j-1])
        elif (j in L):
            ans.append(L[j])
print(max(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
for i in A:
    if i not in L:
        L[i]=1
    else:
        L[i]+=1
ans=[]
for j in range(A[0],A[-1]+1):
    if j in L:
        if j-1 in L:
            if j+1 in L:
                ans.append(L[j]+L[j+1]+L[j-1])
if len(A)>=3:
    print(max(ans))
else:
    if len(A)==1:
        print(1)
    else:
        if abs(A[0]-A[1])==1:
            print(2)
        else:
            print(1)
Problem p03816 (python)

Fixed submission:
import sys
from collections import Counter
import heapq


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Cnt = Counter(A)
    V = list(Cnt.values())
    heap = []
    for v in V:
        heapq.heappush(heap, -1 * v)
    if len(heap) == 1:
        print(1)
        return
    while heap:
        a = heapq.heappop(heap)
        if a == -1:
            print(-1 * sum(heap) + 1)
            return
        b = heapq.heappop(heap)
        heapq.heappush(heap, a + 1)
        heapq.heappush(heap, b + 1)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
import heapq


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Cnt = Counter(A)
    V = list(Cnt.values())
    heap = []
    for v in V:
        heapq.heappush(heap, -1 * v)
    while heap:
        a = heapq.heappop(heap)
        if a == -1:
            print(-1 * sum(heap) + 1)
            return
        b = heapq.heappop(heap)
        heapq.heappush(heap, a + 1)
        heapq.heappush(heap, b + 1)


if __name__ == "__main__":
    main()