qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a, b, c, d = map(int, input().split())

if a <= c < b:
    print(b-c)
elif c <= a < d:
    print(c - b)
else:
    print(0)

Fixed code:
a, b, c, d = map(int, input().split())
if a <= c:
    if b < c:
        answer = 0
    elif b < d:
        answer = b - c
    else:
        answer = d - c
else:
    if d < a:
        answer = 0
    elif d < b:
        answer = d - a
    else:
        answer = b - a
print(answer)
Buggy code:
a = list(map(int,input().split()))
counter = 0
for i in range (101):
  if a[0] <= i <= a[1] and a[2] <= i <= a[3]:
    counter += 1
print ('{0}'.format(counter - 1))

Fixed code:
a = list(map(int,input().split()))
counter = 0
for i in range (101):
  if a[0] <= i <= a[1] and a[2] <= i <= a[3]:
    counter += 1
if counter > 0:
  print ('{0}'.format(counter - 1))
else:
  print ('{0}'.format(0))
Buggy code:
a, b, c, d = map(int, input().split())
if a < c:
    print(max(b - c, 0))
else:
    print(max(d - a, 0))


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

if c < a:
    print(max(0,min(b,d)-a))
else:
    print(max(0,min(b,d)-c))
Buggy code:
n = list(map(int, input().split()))
a = list(range(n[0], n[1]+1))
b = list(range(n[2], n[3]+1))
print(len(set(a) & set(b)))

Fixed code:
n = list(map(int, input().split()))
a = list(range(n[0], n[1]+1))
b = list(range(n[2], n[3]+1))
print(max(0, len(set(a) & set(b))-1))
Buggy code:
# 070 B 
A,B,C,D= map(int,input().split())
if B < C or A < D:
    print(0)
    exit()
if A <= C:
    start =C
else:
    start =A
if B <=D:
    end =B
else:
    end =D
print(end-start)

Fixed code:
# 070 B 
A,B,C,D= map(int,input().split())
if B < C:
    print(0)
    exit()
if D < A:
    print(0)
    exit()
if A <= C:
    start =C
else:
    start =A
if B <=D:
    end =B
else:
    end =D
print(end-start)
Buggy code:
a,b,c,d =map(int,input().split())

answer = min(b,c) - max(a,c)
print(max(0,answer))

Fixed code:

a,b,c,d =map(int,input().split())

answer = min(b,d) - max(a,c)
print(max(0,answer))
Buggy code:
A, B, C, D = input().split()
value = (min(B, D) - max(A, C))
print(value if value > 0 else "0")



Fixed code:
A, B, C, D = map(int, input().split())
value = min(B, D) - max(A, C)
print(value if value > 0 else "0")
Buggy code:
a,b,c,d = map(int,input().split())
print(max(0,min([b,d])-min([a,c])))

Fixed code:
a,b,c,d=map(int,input().split())
print(max(0,min([b,d])-max([a,c])))
Buggy code:
a, b, c, d = map(int, input().split())
a_b = [i for i in range(a, b+1)]
c_d = [i for i in range(c, d+1)]
counter = -1
flg = "False"

for i in range(len(a_b)):
  for j in range(len(c_d)):
    if a_b[i] == c_d[j]:
      counter += 1
      flg = "True"

if flg:
  print(counter)
else:
  print(0)

Fixed code:
a, b, c, d = map(int, input().split())
a_b = [i for i in range(a, b+1)]
c_d = [i for i in range(c, d+1)]
counter = -1
flg = "False"

for i in range(len(a_b)):
  for j in range(len(c_d)):
    if a_b[i] == c_d[j]:
      counter += 1
      flg = "True"

if flg == "True":
  print(counter)
else:
  print(0)
Buggy code:
A,B,C,D = map(int,input().split())
print(min(B,D) - max(A,C))


Fixed code:
A,B,C,D = map(int,input().split())
print(max(0, min(B,D) - max(A,C)))
Buggy code:
a, b, c, d = map(int, input().split())
print(b - c) if b - c >= 0 else print(0)

Fixed code:
a,b,c,d = map(int,input().split())
print(min(b,d)-max(a,c) if min(b,d)-max(a,c) > 0 else 0)
Buggy code:
A,B,C,D = map(int,input().split())
result = -1
for i in range(max(B,D)+1):
  if A<= i <= B and C<= i <= D:
    result +=1
print(result)

Fixed code:
A,B,C,D = map(int,input().split())
result = 0
for i in range(max(B,D)+1):
  if A< i <= B and C< i <= D:
    result +=1
print(result)
Buggy code:
A, B, C, D = map(int, input().split())

if A <= C:
    print(max(min(B, D) - C), 0)
else:
    print(max(min(B, D) - A), 0)


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

if A <= C:
    print(max(min(B, D) - C, 0))
else:
    print(max(min(B, D) - A, 0))
Buggy code:
A,B,C,D = map(int,input().split())
print(min(B,D)-max(A,C))

Fixed code:
A, B, C, D = map(int,input().split())
print(max(0, min(B, D) - max(A, C)))
Buggy code:
A, B, C, D = map(int, input().split())
init = max(A, C)
end = min(B, D)
print(init-end if init < end else 0)

Fixed code:
A, B, C, D = map(int, input().split())
init = max(A, C)
end = min(B, D)
print(end-init if init < end else 0)
Buggy code:
a,b,c,d=map(int,input().split())
ans=-1
for i in range(a,b+1):
  if c<=i<=d:
    ans+=1
print(ans)    

Fixed code:
a,b,c,d=map(int,input().split())
ans=0
for i in range(a,b+1):
  if c<=i<=d:
    ans+=1
print(max(ans-1,0)    )
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,c,d = map(int, input().split())

if b <= c or a==b or c==d:
  print(0)
else:
  print(0)


Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,c,d = map(int, input().split())

if b <= c or a==b or c==d or d <= a:
  print(0)
else:
  print(min(b,d)-max(a,c))
Buggy code:
a, b, c, d = map(int, input().split())
print(max(min(c, d) - max(a, b), 0))

Fixed code:
a, b, c, d = map(int, input().split())
time = min(b, d) - max(a, c)
print(max(0, time))
Buggy code:

line = [int(i) for i in input().split()]
v1 = line[0]
v2 = line[1]
v3 = line[2]
v4 = line[3]

s1 = set(range(v1,v2+1))
s2 = set(range(v3,v4+1))

inter = s1.intersection(s2)


print(len(inter)-1)

Fixed code:

line = [int(i) for i in input().split()]
v1 = line[0]
v2 = line[1]
v3 = line[2]
v4 = line[3]

s1 = set(range(v1,v2+1))
s2 = set(range(v3,v4+1))

inter = s1.intersection(s2)

res = len(inter)-1
if res == -1 : res = 0
print(res)
Buggy code:
n = list(map(int, input().split()))

if n[2] <= n[0] <= n[3] or n[2] <= n[1] <= n[3]:
    n = sorted(n)
    print(n[2]-n[1])
elif n[0] <= n[2] <= n[1] or n[0] <= n[3] <= n[1]:
    n = sorted(n)
    print(n[3]-n[2])
else:
    print(0)

Fixed code:
n = list(map(int, input().split()))

if n[1] < n[2]:
    print(0)
elif n[3] < n[0]:
    print(0)
else:
    m = sorted(n)
    print(m[2]-m[1])
Buggy code:
A, B, C, D = map(int, input().split())
print(max(0, min(C, D) - max(A, B)))

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

print(max(0,min(B, D)-max(A,C)))
Buggy code:
a, b, c, d = map(int, input().split())

lower = max(a,c)
upper = min(b,d)

print(upper-lower, 0)

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

lower = max(a,c)
upper = min(b,d)

print(max(upper-lower, 0))
Buggy code:
a, b, c, d = (int(i) for i in input().split())  
print(max(b-c,0))

Fixed code:
a, b, c, d = (int(i) for i in input().split())  
print(max(min(b,d)-max(a,c),0))
Buggy code:
a,b,c,d = map(int, input().split())
ret = max(b,d) - min(a,c)
if ret > 0 :
    print(ret)
else:
    print("0")

Fixed code:
a,b,c,d = map(int, input().split())
ret = min(b,d) - max(a,c)
if ret > 0 :
    print(ret)
else:
    print("0")
Buggy code:
A, B, C, D = map(int, input().split())
ans = 0
for i in range(1, 101)
if A <= i and i <= B amd C <= i and i <= D:
  ans += 1
print(ans)

Fixed code:
A, B, C, D = map(int, input().split())
ans = 0
for i in range(0, 101):
  if A <= i and i < B and C <= i and i < D:
    ans += 1
print(ans)
Buggy code:
a, b, c, d = map(int, input().split())
if b >= c or d >= a:
    print(min(b, d) - max(a, c))
else:
    print(0)


Fixed code:
a,b,c,d = map(int,input().split())
print(min(b,d)-max(a,c)) if min(b,d)-max(a,c)>0 else print(0)
Buggy code:
a, b, c, d = map(int, input().split())

if a>c:
    if d<a:
        print(0)
    elif a<=d<b:
        print(d-a)
    else:
        print(d-b)

elif a==c:
    if d<b:
        print(d-c)
    else:
        print(d-b)

else:
    if b<c:
        print(0)
    elif c<=b<d:
        print(b-c)
    else:
        print(b-d)

Fixed code:
a, b, c, d = map(int, input().split())
if a <= c <= b <= d:
	print(b - c)
elif c <= a <= d <= b:
	print(d - a)
elif a <= c <= d <= b:
	print(d - c)
elif c <= a <= b <= d:
	print(b - a)
else:
	print(0)
Buggy code:
a, b, c, d = map(int, input().split())

ans = b - c
if ans < 0:
    print(0)
else:
    print(ans)

Fixed code:
a,b,c,d=map(int,input().split())
if b<c or d<a:
    print(0)
else:
    if a<=c:
        if b<=d:
            print(b-c)
        else:
            print(d-c)
    else:
        if d<=b:
            print(d-a)
        else:
            print(b-a)
Buggy code:
a,b,c,d = map(int, input().split())
print(max(0,min(b,d)-max(a,c))

Fixed code:
a,b,c,d = map(int, input().split())
print(max(0, min(b,d) - max(a,c)))
Buggy code:
a,b,c,d = map(int,input().split())
print(max(0,b-c))

Fixed code:
a,b,c,d = map(int,input().split())
print(max(0,min(b-a,b-c,d-c,d-a)))
Buggy code:
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
print(a,b,c,d)
if b < c:print(0)
elif b > c and b < d:print(b-c)
else : print(d-c)

Fixed code:
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d=c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)
Buggy code:
a,b,c,d=map(int,input().split())
print(max([0,max([a,c])-min([b,d])]))

Fixed code:
a,b,c,d=map(int,input().split())
print(max([0,min([b,d])-max([a,c])]))
Buggy code:
#!/usr/bin/env python

A, B, C, D = map(int, input().split(" "))

ans = max(A, B) - min(C, D)
if ans < 0:
    print(0)
else:
    print(ans)




Fixed code:
#!/usr/bin/env python

A, B, C, D = map(int, input().split(" "))

ans = min(B, D) - max(A, C)
if ans < 0:
    print(0)
else:
    print(ans)
Buggy code:
def solve():
    a, b, c, d = read()
    result = think(a, b, c, d)
    write(result)


def read():
    return read_int(4)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def think(a, b, c, d):
    if b <= c or d <= a:
        return 0
    elif a <= c and d <= b:
        return d - c
    elif c <= a and b <= d:
        return b - a
    else:
        if a == c:
            return min(b, d) - a
        elif a < c:
            return abs(c - b)
        else:  # a > c
            return abs(d - a)


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Fixed code:
def solve():
    a, b, c, d = read()
    result = think(a, b, c, d)
    write(result)


def read():
    return read_int(4)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a, b, c, d):
    if b <= c or d <= a:
        return 0
    elif a <= c and d <= b:
        return d - c
    elif c <= a and b <= d:
        return b - a
    else:
        if a == c:
            return min(b, d) - a
        elif a < c:
            return abs(c - b)
        else:  # a > c
            return abs(d - a)


def write(result):
    print(result)


if __name__ == '__main__':
    solve()
Buggy code:
a, b, c, d = [ int(v) for v in input().split() ]
d, e = max(a,c), min(b,d)
f = max((e-d),0)

Fixed code:
a, b, c, d = [ int(v) for v in input().split() ]
d, e = max(a,c), min(b,d)
f = max((e-d),0)
print(f)
Buggy code:
a,b,c,d=map(int,input().split())
print(max(min(b,d)-max(a,c)),0)
  


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

print(max(0, min(d,b)-max(c,a)))
Buggy code:
A, B, C, D = map(int, input().split())
if(B<=C):
    print("0")
else:
    print(B-C)

Fixed code:
A, B, C, D = map(int, input().split())
if(B<=C or D<=A):
    print("0")
elif(A<=C):
    if(B<=D):
        print(B-C)
    else:
        print(D-C)
elif(C<A):
    if(B<=D):
        print(B-A)
    else:
        print(D-A)
Buggy code:
A, B, C, D = map(int, input().split())
print(max(min(C, D)-max(A, B), 0))

Fixed code:
A, B, C, D = map(int, input().split())
print(max(min(B, D)-max(A, C), 0))
Buggy code:
a,b,c,d=map(int,input().split())
if b<c or d<a:
  print(0)
elif a<c:
  print(c-b)
else:
  print(a-d)

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

if b < c or d < a:
    print(0)
elif a <= c and c <= b and b <= d:
    print(b-c)
elif a <= c and d <= b:
    print(d-c)
elif c <= a and b <= d:
    print(b-a)
elif c <= a and a <= d and d <= b:
    print(d-a)
Buggy code:
A, B, C, D = map(int, input().split())
if max(B, D)-min(A, C)>0:
	print(max(B, D)-min(A, C))
else:
	print(0)

Fixed code:
A, B, C, D = map(int, input().split())
if min(B, D)-max(A, C)>0:
	print(min(B, D)-max(A, C))
else:
	print(0)
Buggy code:
a,b,c,d=map(int,input().split())
ans=min(c,d)-max(a,b)
if ans<=0:
  print(0)
else:
  print(ans)

Fixed code:
a,b,c,d = map(int,input().split())
if b<=c or d<=a:
	print(0)
else:
	print(min(b,d)-max(a,c))
Buggy code:
A,B,C,D=int(input().split())
x=min(C,D)-max(A,B)
if x>0:
    print(x)
else:
    print("0")


Fixed code:
A,B,C,D=map(int,input().split())
x=min(B,D)-max(A,C)
if x>0:
    print(x)
else:
    print("0")
Buggy code:
# coding: utf-8

a, b, c, d = map(int, input().split())


alice_time = [x for x in range(a, b+1)]
bob_time = [x for x in range(c, d+1)]
pushed_time = set(alice_time) & set(bob_time)

print (len(pushed_time) -1 )

Fixed code:
# coding: utf-8

a, b, c, d = map(int, input().split())
alice_time = [x for x in range(a, b+1)]
bob_time = [x for x in range(c, d+1)]
pushed_time = set(alice_time) & set(bob_time)

if len(pushed_time) == 0:
  print(0)
else:
  print(len(pushed_time) - 1)
Buggy code:
a, b, c, d = map(int, input().split())
ans = max(0, max(a, c) - min(b, d))
print(ans)


Fixed code:
a, b, c, d = map(int, input().split())
ans = max(0, min(b, d) - max(a, c))
print(ans)
Buggy code:
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[4]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])

Fixed code:
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[3]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])
Buggy code:
a,b,c,d=int(input().split())
x=min(b,d)-max(a,c)
print(x if x>0 else 0)

Fixed code:
a,b,c,d=map(int,input().split())
x=min(b,d)-max(a,c)
print(x if x>0 else 0)
Buggy code:
A,B,C,D=map(int,input().split())
print(min(B,D)-max(A,C) if min(A,C)<=min(B,D) else 0)

Fixed code:
A,B,C,D=map(int,input().split())
if B<C or D<A:
    print(0)
else:
    print(min(B,D)-max(A,C))
Buggy code:
a, b, c, d = list(map(int, input().split()))
if a <= c <= b:
    if b >= d:
        print(d - c)
    else:
        print(b - c)
elif c < a:
    if b >= d:
        print(d - a)
    else:
        print(b - a)

Fixed code:
a, b, c, d = list(map(int, input().split()))
if d <= a:
    print(0)
    exit()
if a <= c <= b:
    if b >= d:
        print(d - c)
        exit()
    else:
        print(b - c)
        exit()
elif c < a:
    if b >= d:
        print(d - a)
        exit()
    else:
        print(b - a)
        exit()
else:
    print(0)
Buggy code:
A,B,C,D = map(int,input().split())

s = min(B-C,D-C)

if s <= 0:
    s = 0

print(s

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

s = min(B,D)-max(A,C)

if s <= 0:
    s = 0

print(s)
Buggy code:
A, B, C, D = map(int, input().split())

if A<C:
    print(max(0,B-C))

elif A>C:
    print(max(0,D-A))

else:
    print(abs(B-D))


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

if A==C:
    print(min(B-A,D-C))

elif A<C:
    if B>=D:
        print(max(0,D-C))
    elif B<=D:
        print(max(0,B-C))

else:
    if D>=B:
        print(max(B-A,0))

    elif D<=B:
        print(max(D-A,0))
Buggy code:
a, b, c, d = map(int, input().split())
print(min(0, min(b,d) - max(a,c)))

Fixed code:
a, b, c, d = map(int, input().split())
print(max(0, min(b,d) - max(a,c)))
Buggy code:
a,b,c,d=map(int,input().split())
print(max(0,max(a,c)-min(b,d)))

Fixed code:
a,b,c,d=list(map(int, input().split()))
print(max(min(b,d)-max(a,c),0))
Buggy code:
A,B,C,D = map(int,input().rstrip().split(" "))
print(min(B,D) - max(A,C))


Fixed code:
A,B,C,D = map(int,input().rstrip().split(" "))
print(max(min(B,D) - max(A,C),0))
Buggy code:
a,b,c,d = map(int, input())
if b < c or d < a:
    ans = 0
else:
    ans = min(abs(c-b), abs(d-a))
print(ans)


Fixed code:
a,b,c,d = map(int, input().split())
if b < c or d < a:
    ans = 0
else:
    ans = min(abs(c-b), abs(d-a), abs(b-a), abs(d-c))
print(ans)
Buggy code:
A , B , C , D = map(int,input().split())
if C > A:
    C ,A = A ,C
    B ,D = D, B

if B <= C:
    print(0)
    quit()
if A<=C and C <=B:
    print(B-C)
    quit()
if A<=C and D <=B:
    print(D-C)
    quit()


Fixed code:
A , B , C , D = map(int,input().split())
if A > C:
    C ,A = A ,C
    B ,D = D, B

if B <= C:
    print(0)
elif A<=C and C <=B and D<=B:
    print(D-C)
elif A<=C and C <=B and B <= D:
    print(B-C)
Buggy code:
A,B,C,D  =map(int,input().split())
AB = [str(i) for i in range(A,B+1)]
CD = [str(j) for j in range(C,D+1)]
count = 0

for a in range(101):
  if str(a) in AB and str(a) in CD:
    count += 1
print(count-1)

Fixed code:
A,B,C,D  =map(int,input().split())
AB = [str(i) for i in range(A,B+1)]
CD = [str(j) for j in range(C,D+1)]
count = 0

for a in range(101):
  if str(a) in AB and str(a) in CD:
    count += 1
if count == 0:
  print(0)
else:
  print(count-1)
Buggy code:
A,B,C,D = map(int,input().split())
print(min(B,D) - max(A,C)) if min(B,D) - max(A,C) <= 0 else print(0)

Fixed code:
A,B,C,D = map(int,input().split())
print(min(B,D) - max(A,C)) if min(B,D) - max(A,C) >= 0 else print(0)
Buggy code:
a,b,c,d=map(int,input().split())
if b<=c or d<=a:print(0)
elif c<b<d:print(b-c)
elif a<d<b:print(d-a)
else:print(min(b-a,d-c))

Fixed code:
a,b,c,d=map(int,input().split())
if b<=c or d<=a:print(0)
elif a<c<b<d:print(b-c)
elif c<a<d<b:print(d-a)
else:print(min(b-a,d-c))
Buggy code:
a,b,c,d = map(int,input().split())
check = min(b,d) - max(a,c)
print(check) if check != 0 else print(0)

Fixed code:
a,b,c,d = map(int,input().split())
check = min(b,d) - max(a,c)
print(check) if check > 0 else print(0)
Buggy code:
A,B,C,D = map(int, input().split())

if A < C < B < D:
    print(B-C)
if A < C < D < B:
    print(D-C)
if C < A < D < B:
    print(D-A)
if C < A < B < D:
    print(B-A)
else:
    print(0)


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

if A <= C <= B <= D:
    print(B-C)
elif A <= C <= D <= B:
    print(D-C)
elif C <= A <= D <= B:
    print(D-A)
elif C <= A <= B <= D:
    print(B-A)
else:
    print(0)
Buggy code:
a, b, c, d = list(map(int, input().split()))
ans = 0
for i in range(1, 101):
    if(a < i and i < b and c < i and i < d):
        ans += 1
print(ans + 1)

Fixed code:
a, b, c, d = list(map(int, input().split()))
ans = 0
for i in range(0, 101):
    if(a <= i and i < b and c <= i and i < d):
        ans += 1
print(ans)
Buggy code:
A,B,C,D=map(int, input().split())
if A<C:
  if C<A+B:
    if C+D<A+B:
      print(D)
    else:
      print(A+B-C)
  else:
    print(0)
else:
  if A<C+D:
    if A+B<C+D:
      print(B)
    else:
      print(C+D-A)
  else:
    print(0)

Fixed code:
A,B,C,D=map(int, input().split())
if A<C:
  if C<B:
    if D<B:
      print(D-C)
    else:
      print(B-C)
  else:
    print(0)
else:
  if A<D:
    if B<D:
      print(B-A)
    else:
      print(D-A)
  else:
    print(0)
Buggy code:
A, B, C, D = map(int, input().split())

print(min(min(B, D) - max(A, C),0))

Fixed code:
A,B,C,D = list(map(int, input().split()))
print(max(0, min(B,D)-max(A,C)))
Buggy code:
A,B,C,D=map(int, input().split())
if A+B<=C or C+D<=A:
  print(0)
elif A<=C and C+D<=A+B:
  print(D)
elif C<=A and A+B<=C+D:
  print(B)
elif A<=C:
  print(A+B-C)
else:
  print(C+D-A)

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


ans = 0

if B < C or D < A:
    ans = 0
elif A <= C and D <= B:
    ans = D - C
elif C<=A and B<= D:
    ans = B - A
elif C<=A and D<=B:
    ans = D - A
else:
    ans = B - C
print(ans)
Buggy code:
A, B, C, D = map(int, input().split())

print(min(min(B, D), max(A, C),0))

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

print(max(min(B, D) - max(A, C),0))
Buggy code:
A,B,C,D = map(int, input().rstrip().split())
print(max([A,C]) - min([B, D]) if max([A,C]) - min([B, D]) > 0 else 0)

Fixed code:
A,B,C,D = map(int, input().rstrip().split())
print(min([B, D]) - max([A,C]) if min([B, D]) - max([A,C]) > 0 else 0)
Buggy code:
a,b,c,d = list(map(int,input().split()))
if c<a<d<b:
    print(d-a)
elif c<a<b<d:
    print(b-a)
elif a<c<d<b:
    pirnt(d-c)
elif a<c<b<d:
    print(b-c)
else:
    print(0)

Fixed code:
a,b,c,d = list(map(int,input().split()))
if c<=a<=d<=b:
    print(d-a)
elif c<=a<=b<=d:
    print(b-a)
elif a<=c<=d<=b:
    print(d-c)
elif a<=c<=b<=d:
    print(b-c)
else:
    print(0)
Buggy code:

a,b,c,d=map(int,input().split())
if a < c < d:
    print(b-c)
elif c < a < d:
    print(d-a)
else:
    print(0)

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

if(b<c):
    print(0)
elif(d<a):
    print(0)
else:
    print(min(b-c, d-a, d-c, b-a))
Buggy code:
A, B, C, D = map(int, input().split())

count = 0

for i in range(0,101):
    if A <= i and i < B and C <= i and i < D:
        print(i)
        count += 1

print(count)

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

count = 0

for i in range(0,101):
    if A <= i and i < B and C <= i and i < D:
        count += 1

print(count)
Buggy code:
a,b,c,d=map(int,input().split())
s=min(a+b,c+d) - max(a,c)
if s>0:print(s)
else:print(0)


Fixed code:
a,b,c,d=map(int,input().split())
s=max(a,c)
e=min(b,d)
if e-s >0:print(e-s)
else:print(0)
Buggy code:
A, B, C, D = map(int,input().split())
x = max(A, B)
y = min(C, D)
if(y-x > 0):
  print(y - x)
else:
  print(0)


Fixed code:
A, B, C, D = map(int,input().split())
x = max(A, C)
y = min(B, D)
if(y-x > 0):
  print(y - x)
else:
  print(0)
Buggy code:
a,b,c,d=map(int,input().split())
print(max(0,min(b,d)-max(a,c))

Fixed code:
a,b,c,d = map(int,input().split())
print(max(min(b, d)- max(a,c),0))
Buggy code:
a, b, c, d = map( int, input().split())
print(min(b,d) - max(a,c))

Fixed code:
a,b,c,d = map(int,input().split())
print(max(0, min(b,d)-max(a,c)))
Buggy code:
a,b,c,d=map(int, input().split())
if b<c or d<a:
  print(0)
elif b>=c:
  print(b-c)
else:
  print(d-a)

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

if b <= c or d <= a:
    print(0)
elif (d >= b and c <= a) or (b >= d and a <= c):
    print(min(d - c, b - a))
elif b >= d:
    print(d - a)
else:
    print(b - c)
Buggy code:
from sys import stdin
from itertools import groupby

a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]

if b < c or d < a:
    print(0)
elif b >= c and d <= b:
    print(d-c)
elif a >= c and b <= d:
    print(b-a)
elif a >= c:
    print(d-a)
elif c < a:
    print(b-c)

Fixed code:
from sys import stdin
from itertools import groupby

a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]

if b < c or d < a:
    print(0)
elif b >= d and c >= a:
    print(d-c)
elif a >= c and b <= d:
    print(b-a)
elif a >= c:
    print(d-a)
elif c > a:
    print(b-c)
Buggy code:
A, B, C, D = map(int, input().split())
if A >= D or B <= C:
  print(0)
print(min(B-A,D-C,D-A,B-C))

Fixed code:
A, B, C, D = map(int, input().split())
if A >= D or B <= C:
  print(0)
else:
  print(min(B-A,D-C,D-A,B-C))
Buggy code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c,d = f()
    print(min(b,d) - max(a, c))

solve()


Fixed code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c,d = f()
    print(max(min(b,d) - max(a, c),0))

solve()
Buggy code:
a, b, c, d = (int(i) for i in input().split())

print(max(min(b,d)-(max(a,c), 0))

Fixed code:
a, b, c, d = (int(i) for i in input().split())

print(max(min(b,d)-(max(a,c)), 0))
Buggy code:
a,b,c,d = map(int, input().split())
if c >= b or a >= d:
    print(0)
else:
    if a <= c:
        print(b-c)
    else:
        print(d-a)
    

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

if a<c:
    if b>c:
        if b>d:
            print(d-c)
        else:
            print(b-c)
    else:
        print(0)
else:
    if d>a:
        if d>b:
            print(b-a)
        else:
            print(d-a)
    else:
        print(0)
Buggy code:
A, B, C, D = map(int, input().split())
if B <= C:
    print(0)
else:
    print(B - C)

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

if C >= B:
    print(0)
elif D <= A:
    print(0)
else:
    if A <= C:
        if B <= D:
            print(B - C)
        else:
            print(D - C)
    else:
        if B <= D:
            print(B - A)
        else:
            print(D - A)