qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a,b = map(int,input().split())
x = abs(a)-abs(b)
y = abs(x)
if (a == 0 and b > 0) or (a < 0 and b == 0):
    print(y)
elif (a == 0 and b < 0) or (a > 0 and b == 0):
    print(y+1)
elif a>=0 and b>=0:
    if y > 0:
        print(y+2)
    else:
        print(y)
elif a*b <= 0:
    print(y+1)
else:
    if y > 0:
        print(y)
    else:
        print(y+2)


Fixed code:
a,b = map(int,input().split())
y = abs(abs(a)-abs(b))
if 0 < b < a or b < a < 0:
    print(y+2)
elif a*b < 0 or (a == 0 and b < 0) or (a > 0 and b == 0):
    print(y+1)
else:
    print(y)
Buggy code:
x,y = map(int,input().split())
ans = 10**10
for i in [[-1,1],[1,0]]:
    for j in [[-1,1],[1,0]]:
        print(x*i[0],y*j[0],i[1],j[1])
        if x*i[0] <= y*j[0]:
            ans = min(ans,y*j[0]-x*i[0]+i[1]+j[1])
            print(ans)
print(ans)

Fixed code:
x,y = map(int,input().split())
ans = 10**10
for i in [[-1,1],[1,0]]:
    for j in [[-1,1],[1,0]]:
        if x*i[0] <= y*j[0]:
            ans = min(ans,y*j[0]-x*i[0]+i[1]+j[1])
print(ans)
Buggy code:
x, y = map(int, input().split())
X = abs(x)
Y = abs(y)
if x * y < 0:
    print(max(Y - X, X - Y) + 1)
else:
    print(max(x - y, y - x) + 2 * (y < x))x, y = map(int, input().split())
X = abs(x)
Y = abs(y)
if x * y < 0:
    print(max(Y - X, X - Y) + 1)
elif x * y > 0:
    print(max(x - y, y - x) + (y < x) + (X > 0))

Fixed code:
x, y = map(int, input().split())
X, Y = abs(x), abs(y)

if x == y:
    print(0)
elif x*y == 0:
    if x > y:
        print(X+Y+1)
    else:
        print(X+Y)
elif x*y > 0:
    if x > y:
        print(abs(x-y)+2)
    else:
        print(abs(x-y))
else:
    print(abs(x+y)+1)
Buggy code:
x,y = map(int,input())
ans = 0
while True:
  if x == y:
    print(ans)
    break
  
  if x == -y:
    x = -x
    ans += 1
    continue

  if (abs(x)<abs(y) and x<0) or (abs(y)<abs(x) and 0<=x):
    x = -x
    ans += 1
    continue
  
  ans += abs(abs(x)-abs(y))
  x += abs(abs(x)-abs(y))

Fixed code:
x,y = map(int,input().split())
ans = 0
while True:
  if x == y:
    print(ans)
    break
  
  if x == -y:
    x = -x
    ans += 1
    continue

  if (abs(x)<abs(y) and x<0) or (abs(y)<abs(x) and 0<=x):
    x = -x
    ans += 1
    continue
  
  ans += abs(abs(x)-abs(y))
  x += abs(abs(x)-abs(y))
Buggy code:
input_nums = [int(c) for c in input().split(" ")]
x = input_nums[0]
y = input_nums[1]
ad = 0

if x = y:
  print(0)
  return

if x > y:
  ad = 2
if (x < 0 and y > 0) or (x >= 0 and y <= 0):
  ad = 1
  
x, y = abs(x), abs(y)

print(abs(x-y)+ad)



Fixed code:
input_nums = [int(c) for c in input().split(" ")]
x = input_nums[0]
y = input_nums[1]
ad = 0

if x > y:
  ad = 2
if (x < 0 and y > 0) or (x >= 0 and y <= 0):
  ad = 1
if x == y:
  ad = 0

x, y = abs(x), abs(y)

print(abs(x-y)+ad)
Buggy code:
x, y = map(int, raw_input().split())
if x == y:
    print 0
elif x*y >= 0 and x <= y:
    print y - x
elif x*y >= 0 and x > y:
    print x - y + 2
else:
    print abs(abs(y) - abs(x)) + 1


Fixed code:
x,y=map(int,input().split())
if x*y>0:
    if x<y:
        print(abs(x-y))
    elif x>y:
        print(abs(x-y)+2)
elif x*y<0:
    print(abs(abs(y)-abs(x))+1)
else:
    if x<0 and y==0:
        print(abs(x))
    elif x>0 and y==0:
        print(x+1)
    elif x==0 and y<0:
        print(abs(y)+1)
    else:
        print(y)
Buggy code:
x,y = map(int, input().split())
if abs(x) <= abs(y):
    c = abs(abs(x) - abs(y))
    if x >= 0 and y >= 0:
        print(c)
    elif x < 0 and y < 0:
        print(c+2)
    else:
        print(c+1)
else:
    c = abs(abs(x) - abs(y))
    if y = 0:
        print(c)
    elif x >= 0 and y >= 0:
        print(c+2)
    elif x < 0 and y < 0:
        print(c)
    else:
        print(c+1)

Fixed code:
x,y=map(int,input().split())

c=0
if x < 0 and y < 0:
  if abs(x) < abs(y):
    print(x-y+2)
  else:
    print(y-x)
elif x*y<=0:
  if x != 0 and y != 0:
    print(abs(x+y)+1)
  elif x == 0 and y == 0:
    print(0)
  elif x == 0:
    print(y if y > 0 else -y + 1)
  else:
    print(-x if x < 0 else x + 1)
else:
  if x > y:
    print(x - y + 2)
  else:
    print(y - x)
Buggy code:
x,y = map(int,input().split())
if x == y:
    ans = 0
elif 0 <= x < y:
    ans = y - x
elif 0 <= y < x:
    if y == 0:
        ans = 1 + x 
    else:
        ans = 1 - y + x + 1
elif x < y <= 0:
    ans = y - x
elif y < x <= 0:
    if x == 0:
        ans = - y + 1
    else:
        ans = 1 - y + x + 1
elif x < y:
    if abs(x) < abs(y):
        ans = 1 + y + x
    elif abs(x) > abs(y):
        ans = - y - x + 1
elif y < x:
    if abs(x) < abs(y):
        ans = - y - x + 1
    elif abs(x) > abs(y):
        ans = 1 + y + x
print(ans)

Fixed code:
# input
x, y = map(int, input().split())

if y >= x:
    if x >= 0:
        ans = y - x
    else:
        if y > 0:
            ans = 1 + abs(x + y)
        else:
            ans = y - x
else:
    if x < 0:
        ans = 2 + x - y
    else:
        if y > 0:
            ans = 2 + x - y
        elif y > -x:
            ans = 1 + x + y
        else:
            ans = 1 - x - y    

print(ans)
Buggy code:
x,y=map(int,input().split())
if x<0:
    if y<0:
        print(abs(abs(x)-abs(y))+2)
    else:
        print(abs(abs(x)-abs(y))+1)
else:
    if y<0:
        printabs((abs(x)-abs(y))+1)
    else:
        print(abs(abs(x)-abs(y)))

Fixed code:
x,y = map(int,input().split())

if x < y:
    if x*y < 0:
        print(1 + abs(abs(x) - y))
    else:
        print(y - x)
else:
    if x*y <= 0:
        print(1 + abs(x - abs(y)))
    else:
        print(2 + abs(x - y))
Buggy code:
x,y=map(int,input().split())

ans=10**10

if x<=y: ans=min(ans,y-x)
elif -x<=y: ans=min(ans,y+x+1)
elif x<=-y: ans=min(ans,-y-x+1)
elif -x<=-y: ans=min(ans,-y+x+2)

print(ans)


Fixed code:
x,y=map(int, input().split())
ans=10**10
if x<=y:ans=min(ans,y-x)
if -x<=y:ans=min(ans,y+x+1)
if x<=-y:ans=min(ans,-y-x+1)
if -x<-y:ans=min(ans,-y+x+2)
print(ans)
Buggy code:
x,y = map(int, input().split())
ans = 0

if (x==0 and y>0) or (y==0 and x<0):
  ans = abs(y)-abs(x)
elif (x==0 and y<0) or (y==0 and x>0):
  ans = abs(y)-abs(x)+1
else:
  x,y = y,x
  ans = abs(y)-abs(x)
  if x>0 and y<0:
    ans += 1
  elif x<0 and y>0:
    ans += 1
  elif x<0 and y<0:
    ans += 2

print(ans)




Fixed code:
x, y = map(int, input().split())

ans = abs(abs(x) - abs(y))
if x == 0 or y == 0:
    if x > y:
        print(ans + 1)
    else:
        print(ans)
    exit()

if abs(x) == abs(y):
    if x * y < 0:
        print(1)
    else:
        print(0)
    exit()

if x > y:
    if y > 0:
        print(ans + 2)
    elif x > 0 and y < 0:
        print(ans + 1)
    else:
        print(ans + 2)
elif x < y:
    if y < 0:
        print(ans)
    elif x < 0 and y > 0:
        print(ans + 1)
    else:
        print(ans)
Buggy code:
x,y = list(map(int,input().split()))
if x>y:
    print(min(abs(x-y),abs(x+y)+1))
else:
    print(min(abs(x+y)+1,abs(x-y)+2))

Fixed code:
x, y = map(int, input().split())

if x < y:
    if abs(x - y) > abs(-x - y):
        print(abs(-x - y) + 1)
    else:
        print(abs(x - y))
else:
    print(min(abs(-x - y) + 1, abs(x - y) + 2))
Buggy code:
x, y = map(int, input().split())

if x == y:
  print(0)
elif abs(x) == abs(y):
  print(1)
elif x < y:
  if x*y < 0:
    print(abs(y)-abs(x)+2)
  else:
    print(y-x)
elif x > y:
  print(abs(x)-abs(y)+2)

Fixed code:
x, y = list(map(int, input().split()))
if x*y == 0:
    if x <= y:
        print(abs(y-x))
    else:
        print(abs(y-x)+1)
elif x*y < 0:
    print(abs(x+y)+1)
else:
    if x < y:
        print(y-x)
    else:
        print(x-y+2)
Buggy code:
x,y=map(int,raw_input().split())
if x>=0 and y>=0:
    print(y-x)
elif x>=0 and y<0:
    print(-y-x+1)
elif x<0 and y<0:
    print(-y+x+2)
else:
    print(y+x+1)


Fixed code:
x,y=map(int,input().split())
if 0<x<=y:
  print(y-x)
if 0<y<x:
  print(x-y+2)
if x>0 and y<=0:
  if(x<=-y):
    print(-y-x+1)
  else:
    print(y+x+1)
if x<=0 and y>0:
  if(x==0):
    print(y)
  elif(-x<=y):
    print(y+x+1)
  else:
    print(-y-x+1)
if x<=0 and y<=0:
  if(x==0):
    print(1-y)
  elif(x<=y):
    print(y-x)
  else:
    print(x-y+2)
Buggy code:
x,y = map(int,input().split())
if abs(y) > abs(x):
  if x < 0:ans += 1
  if y < 0:ans += 1
  ans += (abs(y)-abs(x))
else:
  if x > 0:ans += 1
  if y > 0:ans += 1
  ans += (abs(x)-abs(y))
print(ans)

Fixed code:
x,y = map(int,input().split())
if x == y:
    ans = 0
elif 0 <= x < y:
    ans = y - x
elif 0 <= y < x:
    if y == 0:
        ans = 1 + x 
    else:
        ans = 1 - y + x + 1
elif x < y <= 0:
    ans = y - x
elif y < x <= 0:
    if x == 0:
        ans = - y + 1
    else:
        ans = 1 - y + x + 1
elif x < y:
    if abs(x) <= abs(y):
        ans = 1 + y + x
    elif abs(x) > abs(y):
        ans = - y - x + 1
elif y < x:
    if abs(x) <= abs(y):
        ans = - y - x + 1
    elif abs(x) > abs(y):
        ans = 1 + y + x
print(ans)
Buggy code:
a,b=map(int,input().split())
if b>a>0 or 0>b>a:
  print(b-a)
if a>b>0 or 0>a>b:
  print(1+abs(a)+abs(b))
if a>0 and b<0:
  print(1+abs(abs(a)-abs(b)))
if a<0 and b>0:
  print(b-abs(a)+1)

Fixed code:
a,b=map(int,input().split())
if a==b:
  print(0)
if a>b>0 or 0>a>b:
  print(2+a-b)
if a>0 and b==0:
  print(1+a)
if a>0 and b<0:
  print(1+abs(a+b))
if a==0 and b<0:
  print(-b+1)
if a<b<=0 or 0<=a<b:
  print(b-a)
if a<0 and b>0:
  print(1+abs(a+b))
Buggy code:
x,y = map(int,input().split())
ans = float("inf")
if y>=x:
  ans = min(ans,y-x)
if -y>=x:
  ans = min(ans,-y-x+1)
if -y>=-x:
  ans = min(ans,-y-x+2)
if y>=-x:
  ans = min(ans,y+x+1)
print(ans)

Fixed code:
x,y = map(int,input().split())
ans = float("inf")
if y>=x:
  ans = min(ans,y-x)
if -y>=x:
  ans = min(ans,-y-x+1)
if -y>=-x:
  ans = min(ans,-y+x+2)
if y>=-x:
  ans = min(ans,y+x+1)
print(ans)
Buggy code:
a,b = map(int,input().split())
ans = 0
if a < 0 and b < 0:
    ans = abs(a-b) + 2
elif a >= 0 and b < 0:
    ans = abs(a-b) + 1
else:
    ans = abs(a-b)
print(ans)

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

if a>0:
    if a<=b:
        ans = b-a
    elif b>0:
        ans = 2 + a-b
    elif abs(b)<=a:
        ans = 1 + b + a
    else:
        ans = 1 - b - a
elif a<0:
    if b<a:
        ans = 2 + a-b
    elif b<=0:
        ans = b - a
    elif b < abs(a):
        ans = 1 - a - b
    else:
        ans = 1 + b + a
else:
    if b>0:
        ans = b
    elif b<0:
        ans = 1 - b
    else:
        ans = 0
        
print(ans)
Buggy code:
x, y = [int(_) for _ in input().split()]
print(max(y - x, x - y + 2), abs(x + y) + 1)


Fixed code:
x, y = [int(_) for _ in input().split()]
print(min(max(y - x, x - y + 2), abs(x + y) + 1))
Buggy code:
# input
x, y = map(int, input().split())

if y >= x:
    ans = y - x
elif x * y > 0:
    ans = 2 + x - y
else:
    ans = 1 + x - y

print(ans)

Fixed code:
x,y = map(int,input().split())
if x == y :
    ans = 0
elif (x+y) == 0 :
    ans = 1
elif x < y :
    if x*y >= 0 :
        ans = y-x
    else :
        if -x < y :
            ans = (y+x)+1
        else :
            ans = -(y+x)+1
else :
    if x*y > 0 :
        ans = x-y+2
    else :
        if -x > y :
            ans = -(y+x)+1
        else :
            ans = (y+x)+1
print(ans)
Buggy code:
x,y = map(int,input().split())
if 0 <= x < y or x < y <= 0:
    print(abs(y-x))
elif 0 <= y < x or y < x <= 0:
    print(abs(x-y) + 1)
elif 0 < y < x or y < x < 0:
    print(abs(x-y) + 2)
elif x < y:
    if y < abs(x):
        print(abs(x)-y + 1)
    else:
        print(y-abs(x) + 1)
else:
    if x < abs(y):
        print(abs(y)-x + 1)
    else:
        print(x-abs(y) + 1)

Fixed code:
x, y = map(int, input().split())

if (0 <= x <= y) or (x <= y <= 0):
    print(y - x)
elif (0 <= y <= x) or (y <= x <= 0):
    if x == 0 or y == 0:
        print(x - y + 1)
    else:
        print(x - y + 2)
else:
    absX, absY = abs(x), abs(y)
    if absX <= absY:
        print(absY - absX + 1)
    else:
        print(absX - absY + 1)
Buggy code:
x, y = map(int, input().split())
if abs(x) == abs(y):
    print(1)
elif -x < y:
    print(x + y + 1)
else:
    if x > y:
        print(x - y + 2)
    else:
        print(y - x)

Fixed code:
x,y=map(int,input().split())
if x+y==0:print(1)
elif x*y>0:
  if x<y:print(y-x)
  else:print(x-y+2)
elif x*y==0:
  if x>y:print(abs(x+y)+1)
  else:print(abs(x+y))
else:print(abs(x+y)+1)
Buggy code:
x,y = map(int, input().split())
if x > 0:
  if x > y:
    if y >= 0:
      print(x+y+1)
    else:
      print(abs(x-y)+1)
  else:
    print(y-x)
    
elif x == 0:
  if y >= 0:
    print(y)
  else:
    print((-y)+1)
else:
  if x > y:
    print(x-y+2)
  else:
    print(y-x)

Fixed code:
x, y = map(int, input().split())
if x > y:
    if 0 > x:
        ans = x-y+2
    elif x == 0:
        ans = abs(y) + 1
    else:
        if 0 > y:
            ans = abs(abs(y)-x) + 1 
        elif y == 0:
            ans = x + 1
        else:
            ans = abs(x-y) + 2
elif x == y:
    ans = 0
else:
    if 0 > y:
        ans = y-x
    elif y == 0:
        ans = abs(x)
    else:
        if 0 > x:
            ans = abs(y-abs(x)) + 1
        elif x == 0:
            ans = y
        else:
            ans = y-x
print(ans)
Buggy code:
x, y = map(int, input().split())

if x >= 0 and y >= 0:
    if x >= y:
        print(x - y)
    else:
        if y == 0:
            print(1 + abs(x))
        else:
            print(x - y + 2)
elif x < 0 and y < 0:
    if y >= x:
        print(y - x)
    else:
        print(2 + x - y)
else:
    if y == 0:
        print(abs(abs(x) - abs(y)) + 1)
    else:
        print(abs(abs(x) - abs(y)) + 2)

Fixed code:
x,y=map(int,input().split())

if x>=0 and y>=0:
  if y>x:
    print(y-x)
    exit()
  else:
    if y==0:
      print(x-y+1)
      exit()
    else:
      print(x-y+2)
      exit()
if x>=0 and y<0:
  if abs(y)>=x:
    print(abs(y)-x+1)
    exit()
  else:
    print(x-abs(y)+1)
    exit()
if x<0 and y>=0:
  if y-abs(x)>=0:
    print(y-abs(x)+1)
    exit()
  else:
    if y==0:
      print(abs(x)-y)
      exit()
    print(abs(x)-y+1)
    exit()
else:
  if x-y<=0:
    print(abs(x-y))
  else:
    print(abs(y-x)+2)
Buggy code:
ans = 0
x, y = map(int, input().split())
if x * y < 0:
    ans = abs(x + y) + 1
if x == 0:
    ans = y + int(y < 0)
if y == 0:
    ans = x + int(x > 0)
if x < y:
    ans = y - x
print(ans)

Fixed code:
x,y = map(int,input().split())
ans = 0
if abs(y) > abs(x):
  if x < 0:ans += 1
  if y < 0:ans += 1
  ans += (abs(y)-abs(x))
else:
  if x > 0:ans += 1
  if y > 0:ans += 1
  ans += (abs(x)-abs(y))
print(ans)
Buggy code:
x,y = list(map(int,input().split()))
a = [y-x, y+x+1, -y-x+1, -y-x+2]
a = [i for i in a if i>=0]
print(min(a))


Fixed code:
x,y = list(map(int,input().split()))
a = [y-x, y+x+1, -y-x+1, -y+x+2]
a = [i for i in a if i>=0]
print(min(a))
Buggy code:
x, y = map(int, raw_input().split())
if x < y:
    print y - x
elif x > y:
    if x < 0:
        print x - y + 2
    elif x >= 0:
        if abs(y) > x:
            print -x + y + 1
        else:
            print x + y + 1

Fixed code:
x, y = map(int, input().split())

if x >= 0:
	if y >= x:
		print(y - x)
	elif abs(y) < x:
		if y <= 0:
			print(1 + x + y)
		else:
			print(2 + x - y)
	elif -y == x:
		print(1)
	else:
		print(1 - x - y)
else:
	if -x == y:
		print(1)
	elif abs(x) >= abs(y):
		if y <= 0:
			print(y - x)
		else:
			print(1 - x - y)
	elif y > 0:
		print(1 + x + y)
	else:
		print(2 + x - y)
Buggy code:
x, y = map(int,input().split())

tmp = abs(abs(x)-abs(y))
if(x < 0 and y < 0 and y < x):
  print(tmp+2)
elif((x > 0 and y > 0) or x > y or (x < 0 and y > 0) or (x > 0 and y < 0)):
  print(tmp+1)
else:
  print(tmp)

Fixed code:
x,y=map(int,input().split())
tmp = abs(abs(x)-abs(y))
if (y == 0 and 0 < x) or (x == 0 and y < 0):
  print(tmp+1)
elif 0 <= x*y and x <= y:
  print(tmp)
elif 0 <= x*y and y < x:
  print(tmp+2)
else:
  print(tmp+1)
Buggy code:
x, y = map(int, input().split())
if 0<=x<y or x<y<0:
    print(abs(x-y))
elif 0>x and 0<=y:
    if abs(x) > y:
        print(abs(x) + y)
    elif abs(x) == y:
        print(1)
    else:
        print(y-abs(x)+1)
elif 0<=y<x:
    print(x+y+1)
elif y<x<=0:
    print(abs(x) + abs(y) + 1)
elif x>=0 and y<0:
    if abs(y)<x:
        print(x-abs(y)+1)
    else:
        print(abs(y)-x+1)

Fixed code:
x,y=map(int,input().split())

if abs(y)-abs(x) == 0:
  print(1)
elif x==0 or y==0:
  if y>x:
    print(abs(y-x))
  else:
    print(abs(y-x)+1)
else:
  if (x<0 and y>0) or (x>0 and y<0):
    print(abs(abs(y)-abs(x))+1)
  else:
    if x>y:
      print(x-y+2)
    else:
      print(y-x)
Buggy code:
a,b=[int(i) in i for input().split()]
abab=abs(abs(a) - abs(b))
saab=abs(b-a)
if b < a and b * a >0:
  print(saab + 2)
elif b > a and b * a >0:
  print(saab)
elif b < a and b * a <0:
  print(saab + 1)
elif b > a and b * a >0:
  print(max(saab,abab+1))

Fixed code:
a,b=[int(i) for i in input().split()]
abab=abs(abs(a) - abs(b))
saab=abs(b-a)
if b < a and b * a >0:
  print(saab + 2)
elif b > a and b * a >=0:
  print(saab)
elif b < a and b * a <=0:
  print(min(saab + 1,abab+1))
elif b > a and b * a <0:
  print(min(saab,abab+1))
Buggy code:
x, y = map(int, input().split())
if (0 =< x < y) or (x < y =< 0):
  print(y - x)
elif (0 < y < x) or (y < x < 0):
  ans = 2 + abs(x - y)
  print(ans)
else:
  ans = 1 + abs(abs(x) - abs(y))
  print(ans)

Fixed code:
x,y = map(int,input().split())

if y*x<0:
    print(abs(abs(y)-abs(x))+1)
elif y-x<0:
    if x==0 or y==0:
        print(abs(abs(y)-abs(x))+1)
    else:
        print(abs(abs(y)-abs(x))+2)
else:
    print(abs(abs(y)-abs(x)))
Buggy code:
a, b = map(int, input().split())

if b > a > 0 or a < b < 0:
    print(abs(a-b))
elif a > b > 0 or 0 > a > b:
    print(abs(abs(a)-abs(b))+2)
else:
    print(abs(a-b)+1)

Fixed code:
a, b = map(int,input().split())
if a*b < 0:
    print(abs(a+b)+1)
elif a == 0:
    if b<0:
        print(abs(b)+1)
    else:
        print(b)
elif b == 0:
    if a >= 0:
        print(a+1)
    else:
        print(abs(a))
elif a<b:
    print(abs(b-a))
else:
    print(abs(a-b)+2)
Buggy code:
x,y=map(int,input().split())
if abs(x)==abs(y):#
    print(1)
elif x*y<0:
    print(abs(abs(x)-abs(y))+1)
elif x<y:
    print(abs(x)-abs(y))
elif x*y!=0:
    print(abs(abs(x)-abs(y))+2)
else:
    print(abs(abs(x)-abs(y))+1)    

Fixed code:
x,y=map(int,input().split())
if abs(x)==abs(y):
    print(1)
elif x*y<0:
    print(abs(abs(x)-abs(y))+1)
elif x<y:
    print(abs(abs(x)-abs(y)))
elif x*y!=0:
    print(abs(abs(x)-abs(y))+2)
else:
    print(abs(abs(x)-abs(y))+1)
Buggy code:
x,y = map(int,input().split())
if x == 0 and y > 0:
    print(y-x)
elif x == 0 and y < 0:
    print(1+abs(x+y))
elif y == 0 and x > 0:
    print(1+abs(x+y))
elif y == 0 and x < 0:
    print(y-x)
    
elif 0 < x and x < y:
    print(y-x)
elif 0 < x and x > y:
    print(abs(y+x)+1)
elif x < 0 and y > 0 
    print(abs(y+x)+1)
elif y < 0 and x < y:
    print(y-x)
elif x < 0 and y < x:
    print(2+abs(x-y))



Fixed code:
x, y = map(int, input().split())


ans = 0
if x == y :
    ans = 0
elif x == -y :
    ans = 1
elif x > 0 and y > 0 :
    if x > y :
        ans = x - y + 2
    elif x < y : 
        ans = y - x
elif x > 0 and y < 0 :
    if x > -y :
        ans = 1 + x + y
    elif x < -y :
        ans = 1 - y - x
elif x < 0 and y > 0 :
    if -x > y :
        ans = 1 - x - y
    elif -x < y :
        ans = 1 + y + x
elif x < 0 and y < 0 :
    if -x > -y :
        ans = -x + y
    elif -x < -y :
        ans = -y + x + 2
elif x == 0 :
    if y > 0 :
        ans = y
    elif y < 0 :
        ans = -y + 1
elif y == 0 :
    if x > 0 : 
        ans = 1 + x
    elif x < 0 :
        ans = -x

print(ans)
Buggy code:
x,y=map(int,input().split())

count=0
xlist=[x,-x,x,-x]
ylist=[y,y,-y,-y]
numlist=[0,1,1,2]
ans=10**9+7

for i in range(4):
    if xlist[i] <= ylist(i):
        ans=min(ans,numlist[i]+ylist[i]-xlist[i])

print(ans)


Fixed code:
x,y=map(int,input().split())

count=0
xlist=[x,-x,x,-x]
ylist=[y,y,-y,-y]
numlist=[0,1,1,2]
ans=10**9+7

for i in range(4):
    if xlist[i] <= ylist[i]:
        ans=min(ans,numlist[i]+ylist[i]-xlist[i])

print(ans)
Buggy code:
x,y=map(int, input().split());a=abs;z=a(x)-a(y);print((z*x>0)+a(z)+(z*y>0))

Fixed code:
x,y=map(int, input().split());a=abs;z=a(x)-a(y);print((z==0)+(z*x>0)+a(z)+(z*y>0))
Buggy code:
ans = 0
x, y = map(int, input().split())
if x * y < 0:
    ans = abs(x + y) + 1
if x == 0:
    ans = y + int(y < 0)
if y == 0:
    ans = x + int(x > 0)
if x < y:
    ans = y - x
ans = x - y + 2
print(ans)

Fixed code:
ans = 0
x, y = map(int, input().split())
if x * y < 0:
    ans = abs(x + y) + 1
elif x == 0:
    ans = abs(y) + int(y < 0)
elif y == 0:
    ans = abs(x) + int(x > 0)
elif x < y:
    ans = y - x
else:
    ans = x - y + 2
print(ans)
Buggy code:
x,y=map(int,input().split())
if 0<=x and 0<=y:
    print(abs(y-x))
elif 0<x and 0<y:
    if abs(y)<abs(x):
        print(abs(abs(x)-abs(y))+1)
        exit()
    if abs(x)<abs(y):
        print(abs(abs(x)-abs(y))+1)
        exit()

elif x<0 and 0<y:
    if abs(y)<abs(x):
        print(abs(abs(x)-abs(y))+1)
        exit()
    if abs(x)<abs(y):
        print(1+(y-abs(x)))
        exit()
elif x<0 and y<0:
    if x<y:
        print(abs(x)-abs(y))
        exit()
    if y<x:
        print(abs(abs(y)-abs(x))+2)
elif x==0:
    print(abs(y))
elif y==0:
    print(abs(x))

Fixed code:
x, y = map(int, input().split())
if x==0 and y==0:
	print(0)
elif x>=0 and y==0:
	print(x+1)
elif x>=0 and y>=0:
	if x<=y:
		print(y-x)
	if x>y:
		print(x-y+2)
elif x>=0 and y<0:
	print(abs(x+y)+1)
elif x<0 and y==0:
	print(abs(x))
elif x<0 and y>=0:
	print(abs(x+y)+1)
elif x<0 and y<0:
	if x<=y:
		print(y-x)
	if x>y:
		print(x-y+2)
Buggy code:
x,y=map(int,raw_input().split())
if x>=0 and y>=0:
    print(y-x)
elif x>=0 and y<=0:
    if abs(x)>=abs(y):
        print(x+y+1)
    else:
        print(-y-x+1)
elif x<=0 and y<=0:
    print(-y+x+2)
else:
    if abs(x)>=abs(y):
        print(-x-y+1)
    else:
        print(y+x+1)


Fixed code:
x, y = map(int, input().split())
if x == y:
    print(0)
elif abs(x) == abs(y):
    print(1)
elif x >= 0 and y >= 0:
    if y > x:
        print(y - x)
    else:
        print(x - y + 2 - (y == 0))
elif y >= 0:
    if y > abs(x):
        print(y - abs(x) + 1)
    else:
        print(abs(x) - y + 1 - (y == 0))
elif x < 0 and y < 0:
    x = abs(x)
    y = abs(y)
    if y > x:
        print(y - x + 2)
    else:
        print(x - y)
elif y < 0:
    y = abs(y)
    if y > x:
        print(y - x + 1)
    else:
        print(x - y + 1)
Buggy code:
x, y = map(int, input().split())
if 0<=x<y or x<y<0:
    print(abs(x-y))
elif 0>x and 0<=y:
    if abs(x) > y:
        print(abs(x) + y)
    elif abs(x) == y:
        print(1)
    else:
        print(y-abs(x)+1)
elif 0<=y<x:
    print(min(x+y+1, abs(x-y)+2))
elif y<x<=0:
    print(abs(x) + abs(y) + 1)
elif x>=0 and y<0:
    if abs(y)<x:
        print(x-abs(y)+1)
    else:
        print(abs(y)-x+1)
elif abs(x) == abs(y):
    print(1)

Fixed code:
x,y = map(int,input().split())

d = min(abs(y-x),abs(y-(-x)))


if abs(y) > abs(x):
	if (x == 0) and (y > 0):
		print(d)
	elif (x == 0) and (y < 0):
		print(d+1)
	elif x >= 0 and y >= 0:
		print(d)
	elif x < 0 and y < 0:
		print(d+2)
	else:
		print(d+1)
elif abs(y) < abs(x):
	if (y == 0) and (x > 0):
		print(d+1)
	elif (y == 0) and (x < 0):
		print(d)
	elif x < 0 and y < 0:
		print(d)
	elif x >= 0 and y >= 0:
		print(d+2)
	else:
		print(d+1)
else:
	if (x >= 0 and y >= 0) or (x < 0 and y < 0):
		print(0)
	else:
		print(1)