ZhenlongDai/ACPR huggingface dataset:
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = list(map(int, input().split()))

time = 0
if A[1] >= A[2] or A[3] >= A[0]:
    
    if A[1] >= A[3] >= A[2] >= A[0]:
        time = A[3] - A[2]
    elif A[3] >= A[1] >= A[2]:
        time = A[1] - A[2]
    
    elif A[3] >= A[1] >= A[0] >= A[2]:
        time = A[1] - A[0]
    else: 
        time = A[3] - A[0]
else:
    time = 0

print(time)

Failing test case input:
-2 -5 14 -1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):

A = list(map(int, input().split()))
time = 0

if A[1] >= A[2] or A[3] >= A[0]:
    
    if A[1] >= A[3] >= A[2] >= A[0]:
        time = A[3] - A[2]
    elif A[3] >= A[1] >= A[2] >= A[0]:
        time = A[1] - A[2]
    
    elif A[3] >= A[1] >= A[0] >= A[2]:
        time = A[1] - A[0]
    elif A[1] >= A[3] >= A[0] >= A[2]:
        time = A[3] - A[0]
    else:
        time = 0    
else:
    time = 0

print(time)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())

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


Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())

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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
a,b,c,d=map(int,input().split())
if b>=c :
	print(b-c)
else :
	print("0")

Failing test case input:
16 90 33 58

Expected output:
25


Actual output:
57


Fixed submission (verdict: Accepted):
import sys
a,b,c,d=map(int,input().split())

if a >= d or c >= b:
	print (0)
else:
	print (min(b,d)-max(a,c))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()


Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if b<=c:
    print('0')
elif b<=d:
    print(abs(b-c))
else:
    print(b-a,d-c)

Failing test case input:
-1 148 38 83

Expected output:
45


Actual output:
149 45


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print('0')
elif b<=d:
    print(min(b-c,b-a))
else:
    print(min(d-a,d-c))
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split( ))
if B <= C:
	print(0)
else:
	print(min(B, D)- max(A,C))

Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split( ))
if B <= C or D <= A:
	print(0)
else:
	print(min(B, D)- max(A,C))

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
 
start = max(a, c)
finish = min(b, d)
 
print(start - finish)

Failing test case input:
1 0 0 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
 
start = max(a, c)
finish = min(b, d)

if finish - start < 0:
  print(0)
else:
  print(finish - start)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
19 90 29 58

Expected output:
29


Actual output:
71


Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    A, B, C, D = map(int, input().split())
    if C > B:
        print(0)
    else:
        print(min(B, D) - max(A, C))


main()


Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
def main():
    A, B, C, D = map(int, input().split())
    if C > B or A > D:
        print(0)
    else:
        print(min(B, D) - max(A, C))


main()

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if b<c or d<a or a==b==c==d:
    print(0)
elif a<=c<d<=b:
    print(d-c)
elif a<c<b<d:
    print(b-c)
elif c<a<b<d:
    print(b-a)
elif c<a<d<b:
    print(d-a)

Failing test case input:
-1 1 1 12

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if b<=c or d<=a:
    print(0)
elif a<=c<=d<=b:
    print(d-c)
elif a<=c<=b<=d:
    print(b-c)
elif c<=a<=b<=d:
    print(b-a)
elif c<=a<=d<=b:
    print(d-a)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
 
ans = 0
 
for i in range(max(A, B, C, D)+1):
  if (A <= i and i <= B) and (C <= i and i <= D):
    ans += 1
  print(i)
 
if ans <= 1:
  print(0)
elif A == C and B == D:
  print(ans)
else:
  print(ans-1)

Failing test case input:
0 6 1 5

Expected output:
4


Actual output:
0
1
2
3
4
5
6
4


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
 
ans = 0
 
for i in range(max(A, B, C, D)+1):
  if (A <= i and i <= B) and (C <= i and i <= D):
    ans += 1
 
if ans <= 1:
  print(0)
elif A == C and B == D:
  print(ans - 1)
else:
  print(ans-1)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())

if b < c:
    print(0)
    exit()

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

Failing test case input:
4 0 0 0

Expected output:
0


Actual output:
-4


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

if b < c:
  print(0)
else:
  print(min(b,d)-max(a,c))


Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):


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))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())
line1 = list(range(A,B+1))
line2 = list(range(C,D+1))
line1_line2_and = set(line1) & set(line2)
botton = len(line1_line2_and) -1
print(botton)


Failing test case input:
-1 -3 4 -1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())
line1 = list(range(A,B))
line2 = list(range(C,D))
line1_line2_and = set(line1) & set(line2)
line1_line2_and_list = list(line1_line2_and)
botton = len(line1_line2_and_list) 
print(botton)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

A = list(map(int, input().split()))
time = 0
if A[0]>= A[1] or A[2]>= A[3]:
    time = 0
elif A[1] >= A[2] or A[3] >= A[0]:
    
    if A[1] >= A[3] >= A[2] >= A[0]:
        time = A[3] - A[2]
    elif A[3] >= A[1] >= A[2] >= A[0]:
        time = A[1] - A[2]
    
    elif A[3] >= A[1] >= A[0] >= A[2]:
        time = A[1] - A[0]
    elif A[1] >= A[3] >= A[0] >= A[2]:
        time = A[3] - A[0]
else:
    time = 0


Failing test case input:
-1 148 38 83

Expected output:
45


Actual output:

Fixed submission (verdict: Accepted):

A = list(map(int, input().split()))
time = 0

if A[1] >= A[2] or A[3] >= A[0]:
    
    if A[1] >= A[3] >= A[2] >= A[0]:
        time = A[3] - A[2]
    elif A[3] >= A[1] >= A[2] >= A[0]:
        time = A[1] - A[2]
    
    elif A[3] >= A[1] >= A[0] >= A[2]:
        time = A[1] - A[0]
    elif A[1] >= A[3] >= A[0] >= A[2]:
        time = A[3] - A[0]
    else:
        time = 0    
else:
    time = 0

print(time)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

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



Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):



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

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



else:
    start = a if a>c else c
    end = b if b<d else d
    print(end - start)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = 0
    if d > b:
        if c <= b:
            res = b - c
        else:
            res = 0
    if d < b:
        if c >= a:
            res = d - c
        else:
            res = d - a
    print(res)


main()


Failing test case input:
0 -2 2 -9

Expected output:
0


Actual output:
-11


Fixed submission (verdict: Accepted):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = abs(max(a, c) - min(b, d))
    if c >= b or a >= d:
        res = 0
    print(res)


main()

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
x=0
if b<=c:
  x=0
elif a<=c and c<=b and b<=d:
  x=b-c
elif c<=a and b<=d:
  x=b-a
elif c<=a and a<=d and d<=b:
  x=c-a
elif a<=c and d<=b:
  x=d-c
elif d<=a:
  x=0
print(x)

Failing test case input:
1 11 1 6

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
x=0
if b<=c:
  x=0
elif d<=a:
  x=0
elif a<=c and c<=b and b<=d:
  x=b-c
elif c<=a and b<=d:
  x=b-a
elif c<=a and a<=d and d<=b:
  x=d-a
elif a<=c and d<=b:
  x=d-c
print(x)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print(min(b,d)-max(a,c))

Failing test case input:
0 -1 3 -1

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
if A < C and B < D:
    print(B - C)
elif C <= A and B < D:
    print(B - A)
elif A < C and D <= B:
    print(D - C)
else:
    print(D - A)

Failing test case input:
1 -4 2 -4

Expected output:
0


Actual output:
-6


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
if A < C and B < D:
    print(max(0, B - C))
elif C <= A and B < D:
    print(max(0, B - A))
elif A < C and D <= B:
    print(max(0, D - C))
else:
    print(max(0, D - A))
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    a, b, c, d = map(int, input().split())
    ans = min(b, d)-max(a, c)
    if b < c:
        print(0)
    else:
        print(ans)  


if __name__ == '__main__':
    main()


Failing test case input:
4 1 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


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


if __name__ == '__main__':
    main()

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if a < c < b < d:
    print(d-c)
elif c < a < b < d:
    print(b-a)
elif a < c < d < b:
    print(d-c)
elif c < a < d < b:
    print(d-a)
else:
    print(0)

Failing test case input:
0 75 25 100

Expected output:
50

Actual output:
75


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(max(b - c - max(b - d, 0), 0))

Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())

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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
0 33 66 10

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
init = max(A, C)
end = min(B, D)
print(init-end if init < end else 0)

Failing test case input:
10 90 20 58

Expected output:
38


Actual output:
-38


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
init = max(A, C)
end = min(B, D)
print(end-init if init < end else 0)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int,input().split())
e = list(range(a,b+1))
d = list(range(c,d+1))
print(e)
l = []
for i in e:
  if i in d:
    l.append(i)
if l == []:
  print(0)
else:
  print(len(l)-1)

Failing test case input:
0 75 22 100

Expected output:
53


Actual output:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75]
53


Fixed submission (verdict: Accepted):
a, b, c, d = map(int,input().split())
e = list(range(a,b+1))
d = list(range(c,d+1))

l = []
for i in e:
  if i in d:
    l.append(i)
if l == []:
  print(0)
else:
  print(len(l)-1)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

if(B<C or A<C):
    print("0")
else:
    if(A>=C):
        begin = A
    else:
        begin = C
    if(D<=B):
        end = D
    else:
        end = B
    print(end-begin)


Failing test case input:
0 33 23 101

Expected output:
10


Actual output:
0


Fixed submission (verdict: Accepted):


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

if(B<C or D<A):
    print("0")
else:
    if(A>=C):
        begin = A
    else:
        begin = C
    if(D<=B):
        end = D
    else:
        end = B
    print(end-begin)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if b>=c:
    print(min(b,d)-max(a,c))
else :
    print(0)


Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = 0
    if d > b:
        if c < b:
            res = b - c
        else:
            res = 0
    if d < b:
        if c > a:
            res = d - c
        else:
            res = d - a
    print(res)


main()


Failing test case input:
-1 0 1 -1

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = abs(max(a, c) - min(b, d))
    if c >= b or a >= d:
        res = 0
    print(res)


main()
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())

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

Failing test case input:
0 33 66 10

Expected output:
0


Actual output:
-56


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
t = min(B, D) - max(A, C)
print(t if t > 0 else 0)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=list(map(int,input().split()))
print(min(b,d)-max(a,c))

Failing test case input:
-2 -2 6 -1

Expected output:
0


Actual output:
-8


Fixed submission (verdict: Accepted):
a,b,c,d=list(map(int,input().split()))
t=min(b,d)-max(a,c)
print([0,t][0<=t])

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)))

Failing test case input:
-1 0 0 11

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
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))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
-1 -2 2 -8

Expected output:
0


Actual output:
10


Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int, input().split())

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


Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
A,B,C,D = map(int, input().split())
p=max(A,C)-min(B,D)
if p<=0:
	print(abs(p))
else:
	print(0)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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)

Failing test case input:
1 11 1 6

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):

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)

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())

start = min(a, c)
finish = min(b, d)

print(start - finish)

Failing test case input:
-2 -9 5 -1

Expected output:
0


Actual output:
7


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
 
start = max(a, c)
finish = min(b, d)

if finish - start < 0:
  print(0)
else:
  print(finish - start)
Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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

Failing test case input:
0 33 25 110

Expected output:
8


Actual output:
33


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print('0')
elif b<=d:
    print(min(b-c,b-a))
else:
    print(min(d-a,d-c))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().split()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

a_c = max(A, C)
b_d = min(B, D)

if a_c - b_d:
  print(a_c - b_d)
else:
  print("0")

Failing test case input:
4 1 -1 0

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
s = input().split()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])
 
a_c = max(A, C)
b_d = min(B, D)
 
if b_d - a_c > 0:
  print(b_d - a_c)
else:
  print("0")

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
count=0
for i in range(101):
    if i>=a and i<=b and i>= c and i<=d:
        count +=1

print(count-1)

Failing test case input:
10 17 20 80

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
count=0
for i in range(101):
    if i>=a and i<=b and i>= c and i<=d:
        count +=1


print(max(0,count-1))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if a[0] <= a[2] and a[1] >=a[2]:
        print(min(a[3],a[1]) - max(a[0],a[2]))
    elif a[0] <= a[3] and a[1] >=a[3]:
        print(min(a[3],a[1]) - max(a[0],a[2]))
    else:
        print(0)




Failing test case input:
-1 33 66 10

Expected output:
0


Actual output:
-56


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if min(a[3],a[1]) - max(a[0],a[2]) > 0:
        print(min(a[3],a[1]) - max(a[0],a[2]))
    else:
        print(0)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(0 if b<=c else min(b,d)-max(a,c))

Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
x=min(b,d)-max(a,c)
print(x if x>0 else 0)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int, input().split())
ret = max(b,d) - min(a,c)
if ret > 0 :
    print(ret)
else:
    print("0")

Failing test case input:
1 75 25 100

Expected output:
50


Actual output:
99


Fixed submission (verdict: Accepted):
a,b,c,d = map(int, input().split())
ret = min(b,d) - max(a,c)
if ret > 0 :
    print(ret)
else:
    print("0")
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)
else:
    if b <= d:
        print(b-a)
    else:
        print(c-b)


Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
-7


Fixed submission (verdict: Accepted):
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)
else:
    if b <= d: 
        print(b-a)
    else: 
        print(d-a)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
if (b <= c):
    print(0)
else:
    print(min(b, d)-max(a, c))


Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(-a+b-c+d)

Failing test case input:
10 90 20 80

Expected output:
60

Actual output:
140


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = (int(i) for i in input().split())  
print(max(b-c,0))

Failing test case input:
10 90 20 80

Expected output:
60

Actual output:
70


Fixed submission (verdict: Accepted):
a, b, c, d = (int(i) for i in input().split())  
print(max(min(b,d)-max(a,c),0))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if b<=c or a>=d:
  print(0)
elif b<d and a<b<=c:
  print(b-c)
elif b<d and a>=c:
  print(b-a)
elif b>=d and a>c:
  print(d-c)
elif b>=d and a<c:
  print(d-a)
elif b==d and a==c:
  print(0)


Failing test case input:
0 80 25 101

Expected output:
55


Actual output:

Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if b<=c or a>=d:
  print(0)
else:
  if a<=c and b<=d:
    print(b-c)
  elif a<=c and b>d:
    print(d-c)
  elif a>=c and b<=d:
    print(b-a)
  elif a>=c and b>d:
    print(d-a)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int,input().split()))

if a[1]<=a[2]:
  print(0)
else:
  print(min(a[1],a[3])-max(a[0],a[2]))

Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
print(max(min(a[1],a[3])-max(a[0],a[2]),0))
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if b<c or d<a:
    print(0)
elif a<=c<d<=b:
    print(d-c)
elif a<c<b<d:
    print(b-c)
elif c<a<b<d:
    print(b-a)
else:
    print(d-a)

Failing test case input:
-1 0 0 17

Expected output:
0


Actual output:
18


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if b<=c or d<=a:
    print(0)
elif a<=c<=d<=b:
    print(d-c)
elif a<=c<=b<=d:
    print(b-c)
elif c<=a<=b<=d:
    print(b-a)
elif c<=a<=d<=b:
    print(d-a)

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if b>c:
    print(min(b,d)-max(a,c))
else:
    print(0)

Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())

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

Failing test case input:
-1 2 1 10

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())

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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

print(min(B - C,D-C) if B > C else 0)


Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):


import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

start = max(A, C)
end = min(B, D)
ans = max(0, end - start)
print(ans)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def test():
    a,b,c,d = map(int,input().split())
    print(min(b,d)-max(a,c))


if __name__ == "__main__":
    test()


Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
def test():
    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)


if __name__ == "__main__":
    test()

Problem: p03632
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if b<=c:
    print(0)
else:
    left = max(a,c)
    right = min(b,d)
    print(right-left)

Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if b<=c or d<=a:
    print(0)
else:
    left = max(a,c)
    right = min(b,d)
    print(right-left)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(max(min(c, d) - max(a, b), 0))

Failing test case input:
0 6 1 5

Expected output:
4


Actual output:
0


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int, input().split())
s, e = 0,0
if B >= C :
    if C > A :
        s = C
    else :
        s = A
    if D > B :
        e = B
    else :
        e = D
    print(e - s)
else :
    print(0)

Failing test case input:
4 1 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
A,B,C,D = map(int, input().split())
s, e = 0,0
if C > A:
    s = C
else:
    s = A
if D > B :
    e = B
else :
    e = D
if s > e :
    print(0)
else :
    print(e - s)

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B,C,D=map(int,input().split())
p=min(C,D)-max(A,B)
if p<=0:
  print(0)
else:
  print(p)

Failing test case input:
-2 -5 5 -1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
A,B,C,D=map(int,input().split())
p=min(B,D)-max(A,C)
if p<=0:
  print(0)
else:
  print(p)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
if B - D > 0:
        B -= B - D 
if B - C > 0:
        print(B - C)
else:
        print(0)

Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
if C - B < 0 and A - D < 0:
        print(min(D, B) - max(C, A)) 
else:
        print(0)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

A,B,C,D = map(int, input().split())
alice = set([i for i in range(A, B+1)])
bob = set([i for i in range(C, D+1)])
result = len(alice & bob)
if result == 0:
    print(0)
else:
    print (result)

Failing test case input:
19 90 29 58

Expected output:
29


Actual output:
30


Fixed submission (verdict: Accepted):
A,B,C,D = map(int, input().split())
alice = set([i for i in range(A, B)])
bob = set([i for i in range(C, D)])
result = len(alice & bob)
print (result)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

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







Failing test case input:
4 1 -1 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):


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

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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = (int(i) for i in input().split())
print(max(max(a,c)-min(b,d),0))

Failing test case input:
10 90 20 58

Expected output:
38


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d = (int(i) for i in input().split())
print(max(min(b,d)-max(a,c),0))
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())
time = 0

if C < B and A < C:
    if D < B:
        time = D - C
    else:
        time = B - C

if D > A and A > C:
    if D < B:
        time = D - A
    else:
        time = B - A

print(time)

Failing test case input:
1 11 1 6

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())
time = 0

if C <= B and A <= C:
    if D <= B:
        time = D - C
    else:
        time = B - C

if D >= A and A >= C:
    if D <= B:
        time = D - A
    else:
        time = B - A

print(time)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if b>=c:
    print(abs((min(b,d)-max(a,c))))
else :
    print(0)


Failing test case input:
4 0 0 0

Expected output:
0


Actual output:
4


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
  print(0)
elif b>c:
  print(min(b-c,d-c))
else:
  print(min(d-a,b-a))

Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
  print(0)
elif a<c:
  print(min(d,b)-c)
else:
  print(min(b,d)-a)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
ans = 0 if b <= c else min(b, d) - c
print(ans)


Failing test case input:
4 1 -1 0

Expected output:
0


Actual output:
1


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = [int(i) for i in input().split()]
if c >= b or d >= a:
  print(0)
else:
  if a <= c and b >= d:
    print(d-c)
  elif c < a and b < d:
    print(b-a)
  elif a <= c < b <= d:
    print(b-c)
  else:
    print(d-a)

Failing test case input:
1 11 1 6

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d = [int(i) for i in input().split()]
if c >= b or d <= a:
  print(0)
else:
  if a <= c and b >= d:
    print(d-c)
  elif c < a and b < d:
    print(b-a)
  elif a <= c < b <= d:
    print(b-c)
  else:
    print(d-a)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())
print(min(B,D)-min(B,C))

Failing test case input:
0 -3 2 -9

Expected output:
0


Actual output:
-6


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())
ans=min(B,D)-max(A,C)
print(ans if ans>0 else 0)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())

A_B = B-A
C_D = D-C

list_A_B =range(A_B)
list_C_D =range(C_D)

list_judge =[]

for i in list_A_B:
    for j in list_C_D:
        if i == j:
            list_judge.append(j)

print(len(list_judge))



Failing test case input:
1 75 25 100

Expected output:
50


Actual output:
74


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())

list_A_B =range(A,B)
list_C_D =range(C,D)

list_judge =[]




for i in list_A_B:
    for j in list_C_D:
        if i == j:
            list_judge.append(i)
        else:
            pass

print(len(list_judge))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())
 
alice = [i for i in range(A,B + 1)]
bob = [i for i in range(C,D + 1)]
 
common = [i for i in bob if i in alice]

print(len(common) - 1)

Failing test case input:
0 -2 3 -1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())
 
alice = [i for i in range(A,B + 1)]
bob = [i for i in range(C,D + 1)]
 
common = [i for i in bob if i in alice]

if len(common) == 0:
  print(0)
else:
  print(len(common)-1)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = list(map(int,input().split()))


if A < C:
  a = C
else:
  a = A

if B < D:
  b = B
else:
  b = D
  
if B<C:
  res = 0
else:
  res = (b-a)
  
print(res)

Failing test case input:
1 0 0 0

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
A,B,C,D = list(map(int,input().split()))


if A < C:
  a = C
else:
  a = A

if B < D:
  b = B
else:
  b = D
  
if B <= C or D <= A:
  res = 0
else:
  res = (b-a)
  
print(res)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())

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

if s <= 0:
    s = 0

print(s)

Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())

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

if s <= 0:
    s = 0

print(s)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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


def func(a_sec, b_sec, c_sec, d_sec):
    if a_sec < c_sec < b_sec < d_sec:
        temp = b_sec - c_sec
    elif c_sec < a_sec < d_sec < b_sec:
        temp = d_sec - a_sec
    elif a_sec < c_sec < d_sec < b_sec:
        temp = d_sec - c_sec
    elif c_sec < a_sec < b_sec < d_sec:
        temp = b_sec - a_sec
    else:
        temp = 0

    print(temp)


func(a_sec=a, b_sec=b, c_sec=c, d_sec=d)


Failing test case input:
1 11 1 6

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):

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


def func(a_sec, b_sec, c_sec, d_sec):
    if a_sec < c_sec <= b_sec < d_sec:
        temp = b_sec - c_sec
    elif c_sec < a_sec <= d_sec < b_sec:
        temp = d_sec - a_sec
    elif a_sec <= c_sec < d_sec <= b_sec:
        temp = d_sec - c_sec
    elif c_sec <= a_sec < b_sec <= d_sec:
        temp = b_sec - a_sec
    else:
        temp = 0

    print(temp)


func(a_sec=a, b_sec=b, c_sec=c, d_sec=d)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=[int(i) for i in input().split()]
start=max(a,c)
end=min(b,d)
print(end-start)

Failing test case input:
-1 -9 3 -1

Expected output:
0


Actual output:
-12


Fixed submission (verdict: Accepted):
a,b,c,d=[int(i) for i in input().split()]
if(c-b>0 or a-d>0):
    print(0)
    exit()
start=max(a,c)
end=min(b,d)
print(end-start)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
print(min(0, min(C, D) - max(A, B)))

Failing test case input:
1 72 25 100

Expected output:
47


Actual output:
-47


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
print(max(0, min(B, D) - max(A, C)))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys

def main():
	a, b, c, d = map(int, input().split(" "))
	
	if c >= b or a >= d:
		print(0)
		sys.exit()
	
	if a <= c and b >= d:
		print(d - c)
		sys.exit()
	
	if a >= c and b <= d:
		print(b - a)
		sys.exit()
		
	if a < c:
		print(b - c - a)
		sys.exit()
		
	if a > c:
		print(d - a - c)
		sys.exit()
		
	if d < b:
		print(d - c)
		sys.exit()
		
	if d > b:
		print(b - c)
		sys.exit()
	
if __name__ == "__main__":
	main()
	

Failing test case input:
-1 2 1 13

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):

import sys

def main():
	a, b, c, d = map(int, input().split(" "))
	
	if c >= b or a >= d:
		print(0)
		sys.exit()
	
	if a <= c and b >= d:
		print(d - c)
		sys.exit()
	
	if a >= c and b <= d:
		print(b - a)
		sys.exit()
		
	if a < c:
		print(b - c)
		sys.exit()
		
	if a > c:
		print(d - a)
		sys.exit()
		
	if d < b:
		print(d - c)
		sys.exit()
		
	if d > b:
		print(b - c)
		sys.exit()
	
if __name__ == "__main__":
	main()
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int,input().split()))
if a[2] < a[1]:
  a = sorted(a)
  print(a[-2] - a[1])
else:
  print(0)

Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
if a[2] < a[1] and a[0] < a[3]:
  a = sorted(a)
  print(a[-2] - a[1])
elif a[2] >= a[1] or a[0] >= a[3]:
  print(0)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

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


Failing test case input:
19 90 29 58

Expected output:
29


Actual output:
0


Fixed submission (verdict: Accepted):


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))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if b<=c:
  print(0)
elif a<=c and c<=b<=d:
  print(b-c)
elif a<=c and d<b:
  print(d-c)
elif c<a:
  print(min(d-a,b-a))
else:
  print(0)
  

Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if b<=c or d<=a:
  print(0)
elif a<=c :
  print(min(b-c,d-c))
elif c<a:
  print(min(d-a,b-a))

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print('0')
elif b<=d:
    print(b-c)
else:
    print(min(b-a,d-c))

Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print('0')
elif b<=d:
    print(min(b-c,b-a))
else:
    print(min(d-a,d-c))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = map(int,input().split())
ans = 0







    









if A < C:
    if B > C:
        ans = max(A,C)-min(B,D)

    


print(ans)

Failing test case input:
10 94 67 145

Expected output:
27


Actual output:
-27


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input().split())
ans = 0







    









if min(B,D)>=max(A,C):
    ans = min(B,D)-max(A,C)

    


print(ans)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print(min(b,d)-max(a,c) if b > c else 0)

Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
s = min(b,d)-max(a,c)

print(max(0,s))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
0 6 1 5

Expected output:
4


Actual output:
4
0


Fixed submission (verdict: Accepted):
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)
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(max(min(c,d)-max(a,b),0))

Failing test case input:
0 148 36 100

Expected output:
64


Actual output:
0


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if b<=c or a>=d or (a==c)and(b==d):
  print(0)
else:
  if a<=c and b<=d:
    print(b-c)
  elif a<=c and b>d:
    print(d-c)
  elif a>=c and b<=d:
    print(b-a)
    

Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if b<=c or a>=d:
  print(0)
else:
  if a<=c and b<=d:
    print(b-c)
  elif a<=c and b>d:
    print(d-c)
  elif a>=c and b<=d:
    print(b-a)
  elif a>=c and b>d:
    print(d-a)

Problem: p03632
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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)

Failing test case input:
1 11 1 6

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
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)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
als, ale, bs, be = map(int, input().split())
s = max(als, bs)
e = min(ale, be)

print(e-s)

Failing test case input:
0 -6 9 -13

Expected output:
0


Actual output:
-22


Fixed submission (verdict: Accepted):
als, ale, bs, be = map(int, input().split())
s = max(als, bs)
e = min(ale, be)
ans = e-s
if ans < 0:
  print(0)
else:
  print(ans)

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
print(max(C-B, 0))

Failing test case input:
1 -4 2 -7

Expected output:
0


Actual output:
6


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
print(max(min(B,D) - max(A,C), 0))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(max(max(a,c)-min(b,d),0))

Failing test case input:
19 90 29 58

Expected output:
29


Actual output:
0


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

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D=map(int,input().split())
print(max(min(B,D)-C,0))

Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
A,B,C,D=map(int,input().split())
print(max(min(B,D)-max(A,C),0))
Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    if c >= b:
        res = 0
    if c < b:
        res = abs(max(a, c) - min(b, d))
    print(res)


main()


Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = abs(max(a, c) - min(b, d))
    if c >= b or a >= d:
        res = 0
    print(res)


main()

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = c - (b - a)
    if res < 0:
        print(abs(res))
    else:
        print('0')


main()


Failing test case input:
0 6 1 5

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = abs(max(a, c) - min(b, d))
    if c >= b or a >= d:
        res = 0
    print(res)


main()

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D=list(map(int,input().split()))
if B<=C:
    print(0)
    exit()
print(min(B,D)-max(A,C))

Failing test case input:
2 1 -1 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
A,B,C,D=list(map(int,input().split()))
if B<=C:
    print(0)
    exit()
if A>=D:
    print(0)    
    exit()
print(min(B,D)-max(A,C))

Problem: p03632
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
ans = 0

if b >= c:
    ans = min(b, d) - max(a, c)

print(ans)


Failing test case input:
4 0 -1 0

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())

if c <= a <= d or a <= c <= b:
    ans = min(b, d) - max(a, c)
else:
    ans = 0

print(ans)

Problem: p03632
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(min(b, d) - max(a, c))


Failing test case input:
-2 -2 6 -1

Expected output:
0


Actual output:
-8


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
if a >= d or c >= b:
  print(0)
else:
  print(min(b, d) - max(a, c))