qyliang/CodeNanoFix huggingface dataset:
Buggy code:
def calc(x:list, y:int):
    if x.count(y) == 0:
        return -100
    elif x.count(y) == 1:
        return -1
    elif x.count(y) == 2:
        return 1
    elif x.count(y) > 2:
        return -100

loads = []
for _ in range(3):
    loada, loadb = input().split()
    loads.append(int(loada))
    loads.append(int(loadb))

x = 0
for i in range(1,5):
    print(i, calc(loads, i))
    x = x + calc(loads, i)

if x == 0:
    print('YES')
else:
    print('NO')

Fixed code:
def calc(x:list, y:int):
    if x.count(y) == 0:
        return -100
    elif x.count(y) == 1:
        return -1
    elif x.count(y) == 2:
        return 1
    elif x.count(y) > 2:
        return -100

loads = []
for _ in range(3):
    loada, loadb = input().split()
    loads.append(int(loada))
    loads.append(int(loadb))

x = 0
for i in range(1,5):
    x = x + calc(loads, i)

if x == 0:
    print('YES')
else:
    print('NO')
Buggy code:
lst[0], lst[1] = [int(i) for i in input().split()]
lst[2], lst[3] = [int(i) for i in input().split()]
lst[4], lst[5]  = [int(i) for i in input().split()]

flag = [False, False, False, False]

f = 1
for i in range(1, 4+1):
    if (lst.count(i) == 0) or (lst.count(i) == 3):
        print("NO")
        f = 0
        break

if f == 1:
    print("YES")





Fixed code:
lst = [9, 9, 9, 9, 9, 9]
lst[0], lst[1] = [int(i) for i in input().split()]
lst[2], lst[3] = [int(i) for i in input().split()]
lst[4], lst[5]  = [int(i) for i in input().split()]
   
flag = [False, False, False, False]
 
f = 1
for i in range(1, 4+1):
    if (lst.count(i) == 0) or (lst.count(i) == 3):
        print("NO")
        f = 0
        break
 
if f == 1:
    print("YES")
Buggy code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
 
print(A)
C=[0,0,0,0,0]
for i in range(len(A)) :
    C[A[i][0]]+=1
    C[A[i][1]]+=1
 
print(C)
co=0
for i in range(1,5):
    if C[i]==1 or C[i]==3 :
        co+=1
 
if co==0 or co==2 :
    print("YES")
else :
    print("NO")


Fixed code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
 
#print(A)
C=[0,0,0,0,0]
for i in range(len(A)) :
    C[A[i][0]]+=1
    C[A[i][1]]+=1
 
#print(C)
co=0
for i in range(1,5):
    if C[i]==1 or C[i]==3 :
        co+=1
 
if co==0 or co==2 :
    print("YES")
else :
    print("NO")
Buggy code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.append(b[0])
a.append(b[1])
a.append(c[0])
a.append(c[1])
x = [0] * 4

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

for i in range(4):
    if x[i] in [1, 2]:
        print('YES')
    else:
        print('NO')

Fixed code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.append(b[0])
a.append(b[1])
a.append(c[0])
a.append(c[1])
x = [0] * 4

for i in a:
    x[i-1] += 1

f = 0
for i in range(4):
    if x[i] in [1, 2]:
        f += 1

if f == 4:
    print('YES')
else:
    print('NO')
Buggy code:
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())


Fixed code:
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    if c != 1 and c != 2: continue
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())
Buggy code:
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
l=[]
l.append(a1)
l.append(b1)
l.append(a2)
l.append(b2)
l.append(a3)
l.append(b3)
print(l)
if l.count(1)==1 and l.count(4)==1 and l.count(2)==2 and l.count(3)==2:
    print('YES')
else:
    print('NO')

Fixed code:
a1, b1 = map(int,input().split())
a2, b2 = map(int,input().split())
a3, b3 = map(int,input().split())
l = [a1, a2, a3, b1, b2, b3]
if (1 <= l.count(1) and l.count(1) < 3) and (1 <= l.count(2) and l.count(2) < 3) and (1 <= l.count(3) and l.count(3) < 3) and (1 <= l.count(4) and l.count(4) < 3):
    print("YES")
else:
    print("NO")
Buggy code:
lis = [0,0,0,0]
for n,m in lis(map(int,input().split())):
  lis[n-1] += 1
  lis[m-1] += 1
if 3 in lis:
  print("NO")
else:
  print("YES")

Fixed code:
lis = [0,0,0,0]
for _ in range(3):
  n,m = list(map(int,input().split()))
  lis[n-1] += 1
  lis[m-1] += 1
if 3 in lis:
  print("NO")
else:
  print("YES")
Buggy code:
array = [0] * 4
for i in range(3):
    thisData = list(map(int, input().split()))
    for j in thisData:
        array[j - 1] += 1
print(array)
if max(array) == 3:
    print("NO")
else:
    print("YES")

Fixed code:
array = [0] * 4
for i in range(3):
    thisData = list(map(int, input().split()))
    for j in thisData:
        array[j - 1] += 1

if max(array) == 3:
    print("NO")
else:
    print("YES")
Buggy code:
 A = []
 B = []
 for i in range(3):
     a, b = [int(n) for n in input().split()]
     A.append(a)
     B.append(b)

 counter = [0] * 4

 for i in range(3):
     counter[A[i] - 1] += 1
     counter[B[i] - 1] += 1

 oddscounter = 0

 for i in range(4):
     if counter[i] % 2 == 1:
         oddscounter += 1

 answer = ""
 if oddscounter >= 3:
     answer = "NO"
 else:
     answer = "YES"

 print(answer)


Fixed code:
A = []
B = []
for i in range(3):
    a, b = [int(n) for n in input().split()]
    A.append(a)
    B.append(b)

counter = [0] * 4

for i in range(3):
    counter[A[i] - 1] += 1
    counter[B[i] - 1] += 1

oddscounter = 0

for i in range(4):
    if counter[i] % 2 == 1:
        oddscounter += 1

answer = "YES"
if oddscounter >= 3:
    answer = "NO"
else:
    answer = "YES"

print(answer)
Buggy code:
import numpy as np

ll = []
# li=[1,2,3,4,5,...,n]
li = list(map(int,input().split()))
ll += ll
li = list(map(int,input().split()))
ll += ll
li = list(map(int,input().split()))
ll += ll

cnt = 0
cnt += ll.count(1)%2
cnt += ll.count(2)%2
cnt += ll.count(3)%2
cnt += ll.count(4)%2

if cnt>2:
    print("NO")
else:
    print("YES")


Fixed code:
import numpy as np

ll = []
# li=[1,2,3,4,5,...,n]
li = list(map(int,input().split()))
ll += li
li = list(map(int,input().split()))
ll += li
li = list(map(int,input().split()))
ll += li

cnt = 0
cnt += ll.count(1)%2
cnt += ll.count(2)%2
cnt += ll.count(3)%2
cnt += ll.count(4)%2

if ll.count(1) > 2 or ll.count(2) > 2 or ll.count(3) > 2 or ll.count(4) > 2:
    print("NO")
    exit()

if cnt>2:
    print("NO")
else:
    print("YES")
Buggy code:
from collections import Counter
lis = [0 for i in range(4)]
for i in range(3):
    a,b = map(int,input().split())
    lis[a-1] += 1
    lis[b-1] += 1
if lis.count(2) == 4:
    print("YES")
else:print("NO")

Fixed code:
from collections import Counter
c = Counter()
count = [0,0,0,0]
for i in range(3):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    c[a] += 1
    c[b] += 1
for i in c:
    count[c[i]-1] += 1

if count == [2,2,0,0]:
    print('YES')
else:
    print('NO')
Buggy code:
vec = [0 for _ in range(3)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')

Fixed code:
vec = [0 for _ in range(4)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')
Buggy code:
k, a, b = map(int, input().split())
  
if b/a <= 2 or k-(a-1) <= 0:
    ans = 1 + k
else:
    k = k - (a-1)
    ans=(b-a) * ((k//2) -1) + b * (k//2) + k%2

print(int(ans))


Fixed code:
k, a, b = map(int, input().split())
if b-a<=2 or k<=a-1:
    print(1+k)
else:
    print((k-a+1)//2*(b-a)+(k-a+1)%2+a)
Buggy code:
k,a,b=map(int,input().split())
if b-a>2:
    bisk=a
    k-=a-1
    bisk+=k//2*(b-a)
    bisk+=k%2
    print(bisk)
else:print(a+k)

Fixed code:
k,a,b=map(int,input().split())
if b-a>1:
    if k-a+1>0:
        bisk=a
        k-=a-1
    else:
        bisk+=k
        print(bisk)
        exit()
    bisk+=k//2*(b-a)
    bisk+=k%2
    print(bisk)
else:print(1+k)
Buggy code:
# -*- coding: utf-8 -*-

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

if a+2>b|k<=a+1:
    print(k+1)
else:
    s=k-a+1
    print(int(s/2)*(b-a)+a+(s%2))
    


Fixed code:
# -*- coding: utf-8 -*-

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

if ((b-a)<=2)|(k<=a):
    print(k+1)
else:
    s=k-a+1
    print(int(s/2)*(b-a)+a+(s%2))
Buggy code:
k,a,b=map(int,input().split())
n=1
if b-a<=2:
    print(k+1)

else:
    if n < a:
        n = a
        k = k-a
    m = k // 2
    print(n,m,b-a)
    n += (b-a)*m
    if k % 2 ==1:
        n+=1
    print(n)


Fixed code:
k, a, b = map(int, input().split())
n = 1
m = 0
n += a - 1
k -= a - 1
if a + 1 < b:
  n += (b - a) * (k // 2) + k % 2
else:
  n += k
print(n)
Buggy code:
# input
k, a, b = map(int, input().split())

ans = 1 + k
if b <= a + 2:
    print(ans)
else:
    i = a - 1
    ans = 1 + i + ((b - a) * (k - i) // 2)
    print(ans)


Fixed code:
# input
k, a, b = map(int, input().split())

ans = 1 + k
if b <= a + 2:
    print(ans)
else:
    if (k - a + 1) % 2 == 0:
        i = a - 1
    else:
        i = a
    ans = 1 + i + ((b - a) * (k - i) // 2)
    print(ans)
Buggy code:

def main():
	k, a, b = list(map(int, input().split()))

	n = 1

	if a >= k - 1:
		print(n + k)
		return

	n += a - 1
	k -= a - 1

	print(n, k, a, b)
	if b - a >= 2 and k >= 2:
		n += (b - a) * (k // 2) + k % 2
	else:
		n += k

	print(n)


if __name__ == '__main__':
	main()




Fixed code:

def main():
	k, a, b = list(map(int, input().split()))

	n = 1

	if a > k - 1:
		print(n + k)
		return

	n += a - 1
	k -= a - 1

	#print(n, k, a, b)
	if b - a >= 2 and k >= 2:
		n += (b - a) * (k // 2) + k % 2
	else:
		n += k

	print(n)


if __name__ == '__main__':
	main()
Buggy code:
def read():
    return int(input())

def reads():
    return list(map(int, input().split()))

k,a,b=reads()
k2 = 0
if (b-a)/2 <= 1:
    print(1+k)
else:
    k2 = k-a+1
    if k2 >= 2:
        if k2 % 2 == 0:
            print(int(a + (b-a)*k2/2))
        else:
            print(int(a + (b-a)*(k2-1)/2 + 1))
    else:
        print(1 + k)

Fixed code:
def read():
    return int(input())

def reads():
    return list(map(int, input().split()))

k,a,b=reads()
k2 = 0
if (b-a)/2 <= 1:
    print(1+k)
else:
    k2 = k-a+1
    if k2 >= 2:
        print(int(a + (b-a)*(k2-k2%2)//2 + k2%2))
    else:
        print(1 + k)
Buggy code:
k, a, b = list(map(int, input().split()))

if a-1 >= k or a >= b-2:
    print(k+1)
    exit()

ans = a
k -= a-1
print(ans, k)
ans += (b-a)*(k//2)
ans += k%2
print(ans)

Fixed code:
k, a, b = list(map(int, input().split()))

if a-1 >= k or a >= b-2:
    print(k+1)
    exit()
ans = a
k -= a-1
ans += (b-a)*(k//2)
ans += k%2
print(ans)
Buggy code:
K, A, B = map(int, input().split())

if B - A <= 2 or K - 3 < A:
    print(K + 1)
else:
    if (K - A + 1) % 2 == 0:
        print(A + (B - A) * ((K - A + 1) // 2))
    else:
        print(1 + A + (B - A) * ((K - A + 1) // 2))

Fixed code:
K, A, B = map(int, input().split())
if B - A <= 2 or K <= A:
    print(K + 1)
else:
    K -= A + 1
    if K % 2:
        print(B + (B - A) * ((K - 1) // 2) + 1)
    else:
        print(B + (B - A) * (K // 2))
Buggy code:
k, a, b = map(int, input().split())
bis, jpn = 1, 0
if b-a < 2 or k <= a-1:
    print(k+1)
else:

    bis = a + max(b-a, 2) * (k-a+1)/2 + (k-a+1)%2
        
    print(int(bis))






Fixed code:
k, a, b = map(int, input().split())
bis, jpn = 1, 0
if b-a < 2 or k <= a-1:
    print(k+1)
else:

    bis = a + max(b-a, 2) * int((k-a+1)/2) + (k-a+1)%2
        
    print(int(bis))
Buggy code:
K,A,B = (int(x) for x in input().split())
total = 0
if(B-A<3):
    print(K+1)
else:
    if((K-(A+1))%2 == 0):
        total = B + ((B-A)*((K-A-1)/2))
    else:
        total = B + ((B-A)*(int((K-A-1)/2))) + 1
    print(int(total))



Fixed code:
K,A,B = (int(x) for x in input().split())
total = 0
if(B-A<3):
    print(K+1)
    exit()
else:
    if((K-(A+1))%2 == 0):
        print(B + (K-(A+1))//2*(B-A))
    else:
        print(B + (K-(A+1))//2*(B-A) + 1)
Buggy code:
K,A,B = map(int,input().split())
if abs(A-B) <= 1:
    print(K + 1)
elif A > B:
    print(K + 1)
else:
    print((K+1)//(A+2)*B + (K+1)%(A+2))

Fixed code:
K,A,B = map(int,input().split())
bis = 0
if abs(A-B) <= 1:
    print(K + 1)
elif A > B:
    print(K + 1)
else:
    K = K - A -1
    bis += B
    bis += K // 2 * B - K // 2 * A 
    print(bis + K % 2)
Buggy code:
k, a, b = map(int, input().split())

if (k == 1):
    print(2)
    exit()

if (b <= (a + 1)):
    print(k + 1)
    exit()
else:
    tmp1 = k - (a - 1)
    sabun = b - a

    if (tmp1 % 2 == 0):
        bis = ((tmp1 / 2) - 1) * sabun + b
    else:
        bis = ((tmp1 // 2) - 1) * sabun + b + 1

    print(bis)

Fixed code:
k, a, b = map(int, input().split())

if (k == 1):
    print(2)
    exit()

if (b <= (a + 1)):
    print(k + 1)
    exit()
else:
    tmp1 = k - (a - 1)
    sabun = b - a

    if (tmp1 % 2 == 0):
        bis = int((tmp1 / 2 - 1)) * int(sabun) + b
    else:
        zouka = int((tmp1 // 2 - 1)) * int(sabun)
        bis = zouka + b + 1

    print(bis)
Buggy code:
a,b,c = map(int,input().split())
k = 0
if b >= c+1:
	print(a+1)
else:
	if b-1 >= a:
		print(a+1)
	else:
		k = a - b - 1
		if k % 2 == 0:
			su = k//2 * (c-b) + c
		else:
			su = k//2 * (c-b) + c + 1
		print(su)


Fixed code:
a,b,c = map(int,input().split())
k = 0
if b+1 >= c:
	print(a+1)
else:
	if b-1 >= a:
		print(a+1)
	else:
		k = a - b - 1
		if k % 2 == 0:
			su = k//2 * (c-b) + c
		else:
			su = k//2 * (c-b) + c + 1
		print(su)
Buggy code:
import sys
input = sys.stdin.readline

k, a, b = [int(x) for x in input().split()]

biscuits = 0

if a + 1 > k or a >= b:
    print(k)
    sys.exit()

biscuits += b
k -= (a + 1)
biscuits += (b - a) * (k // 2) + (k % 2)

print(biscuits)

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

k, a, b = [int(x) for x in input().split()]

biscuits = 0

if a + 1 > k or (b - a) <= 2:
    print(k + 1)
    sys.exit()

biscuits += b
k -= (a + 1)
biscuits += (b - a) * (k // 2) + (k % 2)

print(biscuits)
Buggy code:
k,a,b=map(int,input().split())
import sys

if k <a or b-a <2:
  print(k+1)
  sys.exit()
if (k-a) %2 ==0:
  print(a+(b-a)*(k-a)//2+1)
else:
  print(a+(b-a)*((k-a)//2-1)+2)    


Fixed code:
k,a,b=map(int,input().split())
import sys

if k<a-1 or b-a <2:
  print(k+1)
  sys.exit()
if (k+1-a) %2 ==0:
  print(a+(b-a)*(k+1-a)//2)
else:
  print(a+(b-a)*((k-a)//2)+1)
Buggy code:
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    print(a-1 + (b-a)*(k-a+1)//2 + (k-a+1)%2)

Fixed code:
k,a,b=map(int,input().split())
k+=1
ans=0
if a+2>b:
    ans=k
else:
    if a>k:
        ans=k
    else:
        ans=a+(k-a)//2*(b-a)+(k-a)%2
print(ans)
Buggy code:
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    c = (k+1)//(a+2)
    print((k+1)%(a+2) + c*b)

Fixed code:
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    print(a + (b-a)*((k-a+1)//2) + (k-a+1)%2)
Buggy code:
K,A,B =[int(i)for i in input().split()]
if A+2 >= B or K <= A:
    print(K+1)
else:
    N = K -A+1
    N =N//2
    print(N,K+1,(B-A-2))
    print(K+1+(B-A-2)*N)

Fixed code:
K,A,B =[int(i)for i in input().split()]
if A+2 >= B or K <= A:
    print(K+1)
else:
    N = K -A+1
    N =N//2
    print(K+1+(B-A-2)*N)
Buggy code:
from math import ceil
K, A, B = map(int, input().split())
b = 1

if B - A > 2:
    b += min(A - 1, K)
    K -= min(A - 1, K)
    if K == 0:
        print(b)
        exit()
    n = K // 2
    b += n * (B - A)
    n += K
    print(b)
else:
    b += K
    print(b)


Fixed code:
from math import ceil
K, A, B = map(int, input().split())
b = 1

if B - A > 2:
    b += min(A - 1, K)
    K -= min(A - 1, K)
    if K == 0:
        print(b)
        exit()
    n = K // 2
    b += n * (B - A)
    b += K % 2
    print(b)
else:
    b += K
    print(b)
Buggy code:
k, a, b = list(map(int, input().split()))

if a + 2 <= b and k + 3 > a:
    k -= a - 1
    n = k // 2
    x = (b - a) * n
    y = k % 2
    print(x + y)

else:
    print(1 + k)
    



Fixed code:
k, a, b = list(map(int, input().split()))

if a + 2 <= b and k + 3 > a:
    k -= a - 1
    n = k // 2
    x = (b - a) * n + a
    y = k % 2
    print(x + y)

else:
    print(1 + k)
Buggy code:
import math
K,A,B = map(int, input().split())
cookie = 0

if K > A  or B - A <  A  :
    
    cookie = B
    K = K-A-1

    if K%2==0:
        cookie += (B-A)* math.floor(K/2)
        print(cookie)
    else:
        cookie += (B-A)*math.floor((K-1)/2)
        print(cookie + 1)
else:
    print(K + 1)

Fixed code:
import math
K,A,B = map(int, input().split())
cookie = 0

if abs(A-B) <= 1:
    print(K + 1)
elif A > B:
    print(K + 1)

else:
    cookie = B
    K = K-A-1

    if K%2==0:
        cookie += (B-A)* math.floor(K/2)
        print(cookie)
    else:
        cookie += (B-A)*math.floor((K-1)/2)
        print(cookie + 1)
Buggy code:
a,b,c = map(int,input().split())
kaisuu = int((a-(b-1))/2)
amari = (a-(b-1))%2
if b >= (c-2):
        print(a+1)
else:
        if amari == 1:
                print(kaisuu*c+1)
        else:
                print(kaisuu*c)

Fixed code:
a,b,c = map(int,input().split())
kaisuu = int((a-(b-1))/2)
amari = (a-(b-1))%2
if b >= (c-2):
        print(a+1)
else:
        if amari == 1:
                print(kaisuu*(c-b)+1+b)
        else:
                print(kaisuu*(c-b)+b)
Buggy code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else :
  count = K - (A + 1)
  if count % 2 == 1:
    ans = (count // 2 + 1) * B 
  else:
    ans = (count//2 + 1) * B + 1
  print(ans)
  

Fixed code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else:
  count = K - (A + 1)
  if count % 2 == 0:
    ans = count // 2 * (B - A) + B
  else:
    ans = count//2 * (B - A) + B + 1
  print(ans)
Buggy code:
K,A,B = (int(i) for i in input().split())
if A+2>=B:
    print(1+K)
else:
    Bis = A
    K-=A-1
    print(K)
    Bis += int(K/2)*(B-A)
    if(K)%2==1:
        Bis+=1
    print(Bis)



Fixed code:
K,A,B = (int(i) for i in input().split())
if A+2>=B:
    print(1+K)
else:
    Bis = A
    K-=A-1
    Bis += int(K/2)*(B-A)
    if(K)%2==1:
        Bis+=1
    print(Bis)
Buggy code:
K,A,B=list(map(int,input().split()))
hand=0
if B-A<=2:
    print(K+1)
    exit()
K=K-A+1
print(K)
if K%2==1:
    hand=1+int((K-1)/2)*(B-A)
else:
    hand=int(K/2)*(B-A)
print(hand+A)

Fixed code:
K,A,B=list(map(int,input().split()))
hand=0
if B-A<=2:
    print(K+1)
    exit()
K=K-A+1
if K%2==1:
    hand=1+int((K-1)/2)*(B-A)
else:
    hand=int(K/2)*(B-A)
print(hand+A)
Buggy code:
k, a, b = map(int,input().split())

if b - a <= 2:
    print(k+1)
else:
    if ((k-(a-1))//2) == 1:
        print(((k-(a-1))//2)*(b)+((k-(a-1))//2)%2)
    else:
        print(((k-(a-1))//2)*(b-a)+((k-(a-1))//2)%2)

Fixed code:
k,a,b=map(int,input().split())
if b-a<=2 or a>k-1: print(k+1)
else:
    k-=a-1
    print(a+(b-a)*(k//2)+k%2)
Buggy code:
k,a,b=map(int,input().split())
if(b-a<3 or k+1<=a):
  print(k+1)
else:
  bis=a
  k=k-a+1
  if(k%2==0):
    print(bis+(b-a)*(k/2))
  else:
    print(bis+(b-a)*(k//2)+1)

Fixed code:
k,a,b=map(int,input().split())
if(b-a<3 or k+1<=a):
  print(k+1)
else:
  bis=a
  k=k-a+1
  if(k%2==0):
    print(bis+(b-a)*(k//2))
  else:
    print(bis+(b-a)*(k//2)+1)
Buggy code:
k,a,b = list(map(int,input().split()))
if (((b-a)/2) <= 1) and (k <= a):
  print(k+1)
else:
  t = k-a+1
  print((t//2)*(b-a)+(t%2)+a)

Fixed code:
k,a,b = list(map(int,input().split()))
if (((b-a)/2) <= 1) or (k <= a):
  print(k+1)
else:
  t = k-a+1
  print((t//2)*(b-a)+(t%2)+a)
Buggy code:
K,A,B = map(int,input().split())
if A+2>=B or K-1<A:
  print(1+K)
else:
  print((B*(K-(A-1))//2)+(K-(A-1))%2)

Fixed code:
K, A, B = map(int, input().split())
ans = 0
if A + 1 >= B or K + 1 <= A :
    ans = K + 1
else:
    ans = ans + B
    ans = ans + (K - A - 1) // 2 * (B - A)
    ans = ans + (K - A - 1) % 2

print(ans)
Buggy code:
K,A,B=map(int,input().split())

if B - A <= 2:
    print(K+1)
elif K < A:
    print(K+1)
elif A % 2 == 0:
    print(B+(B-A)*((K-A-2)//2)+1)
else:
    print(B+(B-A)*((K-A-1)//2))

Fixed code:
K, A, B = map(int, input().split())
ans = 1
if B - A <= 1:
    print(K+1)
elif K < A + 1:
    print(K+1)
else:
    K -= A+1
    ans = B
    ans += (B - A) * (K // 2)
    ans += K % 2
    print(ans)
Buggy code:
k,a,b=map(int,input().split())
k+=1
mouke=b-a
j=0
if mouke>1:
    j=(k-a)//2
    print(j)
    cnt=j*(b-a)+a+(k-2*j-a)
else:
    cnt=k
print(cnt)

Fixed code:
k,a,b=map(int,input().split())
mouke=b-a
j=0
if mouke>1:
    j=(k+1-a)//2
    cnt=j*(b-a)+a+(k-2*j-a)+1
else:
    cnt=k+1
print(cnt)
Buggy code:
K , A , B = map(int, input().split())
if A >= B:
    print(K+1)
elif A < B:
    if (K-A+1)%2 == 0:
        ma = ((K-A+1)//2-1)*(B-A)+B
    elif (K-A+1)%2 == 1:
        ma = ((K-A+1)//2-1)*(B-A)+B + 1
print(ma)

Fixed code:
K , A , B = map(int, input().split())
ma = 0
if A >= B:
    ma = K + 1
elif A < B:
    if (K-A+1)%2 == 0:
        ma = max(((K-A+1)//2-1)*(B-A)+B,K+1)
    elif (K-A+1)%2 == 1:
        ma = max(((K-A+1)//2-1)*(B-A)+B+1,K+1)
print(ma)
Buggy code:
k,a,b = map(int,input().split())
if a >= b+2:
  print(k+1)
else:
  d = k-(a-1)
  e = a
  e += (b-a)*d//2
  e += d%2
  print(e)

Fixed code:
k,a,b = map(int,input().split())
if a >= b-2:
  print(k+1)
else:
  d = k-(a-1)
  e = a
  e += (b-a)*(d//2)
  e += d%2
  print(e)
Buggy code:
k, a, b = map(int, input().split())

if a >= b-1:
    print(k+1)
else:
    if k <= a:
        print(k+1)
    else:
        if k-a % 2 == 1:
            print((k-a)//2*(b-a)+a)
        else:
            print((k-a)//2*(b-a)+a+1)


Fixed code:
k, a, b = map(int, input().split())

if a >= b-1:
    print(k+1)
else:
    if k <= a-1:
        print(k+1)
    else:
        k -= a
        k += 1
        if k % 2 == 1:
            print(k//2*(b-a)+a+1)
        else:
            print(k//2*(b-a)+a)
Buggy code:
K, A, B = map(int, input().split())

if B - A <= 2:
  print(K + 1)
else:
  if K % 2 == 0:
    print((B - A) * K // 2 + 1)
  else:
    print((B - A) * (K - 1) // 2 + 1)


Fixed code:
K, A, B = map(int, input().split())

if (B - A) <= 2:
  print(K + 1)
else:
  res = K-A+1
  print(A+(B-A)*(res//2)+res%2)
Buggy code:
k,a,b=map(int,input().split())
if b - a <= 2:
    ans = k + 1
else:
    if 1 <= k <= a - 1:
        ans = k + 1
    else:
        if k - (a-1) % 2 == 0:
            ans = a + (b-a)*(k - (a-1)//2)
        else:
            ans = 1 + a + (b-a)*(k - (a-1)//2)
print(ans)

Fixed code:
k, a, b = map(int, input().split())

ans = 1
if b - a <= 1:
    ans += k
else:
    ans += a - 1
    k -= a - 1
    if k % 2 == 0:
        ans += k // 2 * (b - a)
    else:
        ans += k // 2 * (b - a) + 1

print(ans)
Buggy code:
K, A, B = map(int, input().split())

if not B - A <= 2:
    if not (A == K or A == K + 1):
        if (K - A) // 2 == 0:
            print(B + (B - A) * ((K - A - 1) // 2) + 1)
        else:
            print(B + (B - A) * ((K - A - 1) // 2))
    else:
        print(K + 1)

else:
    print(K + 1)


Fixed code:
K, A, B = map(int, input().split())

if not B - A <= 2:
    if not (A == K or A == K + 1):
        if (K - A) % 2 == 0:
            print(B + (B - A) * ((K - A - 1) // 2) + 1)
        else:
            print(B + (B - A) * ((K - A - 1) // 2))
    else:
        print(K + 1)

else:
    print(K + 1)
Buggy code:
k,a,b=map(int,input().split())
g=k+1
if b-a<=1:
  print(g)
else:
  k-=a-1
  h=1+(k//2)*(b-a)
  print(max(g,h))

Fixed code:
k,a,b=map(int,input().split())
g=k+1
if b-a<=1:
    print(g)
else:
    k-=a-1
    h=a+(k//2)*(b-a)+(k%2)
    print(max(g,h))
Buggy code:
K,A,B = map(int,input().split())
if A+2 >= B:
    print(1+K)
else:
    beatC,m = divmod((K - (A-1)),2)
    print(beatC*(B-A)+(K - 2 * beatC))


Fixed code:
K,A,B = map(int,input().split())
if A+2 >= B:
    print(1+K)
else:
    beatC,m = divmod((K - (A-1)),2)
    print(beatC*(B-A)+(K - 2 * beatC)+1)