Problem: Alice and Bob are controlling a robot. They each have one switch that controls the robot.   Alice started holding down her button A second after the start-up of the robot, and released her button B second after the start-up.   Bob started holding down his button C second after the start-up, and released his button D second after the start-up.   For how many seconds both Alice and Bob were holding down their buttons?

Submission attempts (in order):
A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)
if a<c:
    max=c
else:
    max=a
if b>d:
    min=d;
else:
    min=b
if (min-max)>0:
    print(min-max)
    print('\n')
else:
    print('0\n')
quit()


A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

max=0
min=0

if a < c :
    max=c
else :
    max=a
    
if b > d :
    min=d
else :
    min=b
if ( min - max ) > 0 :
    print( min - max )
    print('\n')
else :
    print('0\n')
quit()


A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

print(0)




a=4
b=4
c=4
d=4

max=0
min=0

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




A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)
if a<c:
    max=c
else:
    max=a
if b>d:
    min=d
else:
    min=b
if (min-max)>0:
    print(min-max)
    print('\n')
else:
    print('0\n')
quit()


A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

if a < c :
    max=c
else :
    max=a
    
if b > d :
    min=d
else :
    min=b
if ( min - max ) > 0 :
    print( min - max )
    print('\n')
else :
    print('0\n')

A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

if a < c :
    max=c
else :
    max=a
    
if b > d :
    min=d
else :
    min=b
if ( min - max ) > 0 :
    print( min - max )
    print('\n')
else :
    print('0\n')
quit()


nput()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

max=0
min=0

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





A=input().strip()
B=input().strip()
C=input().strip()
D=input().strip()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

max=0
min=0

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



A=input().strip().sprit(' ')
B=input().strip().sprit(' ')
C=input().strip().sprit(' ')
D=input().strip().sprit(' ')
a=int(A)
b=int(B)
c=int(C)
d=int(D)

max=0
min=0

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



A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)
if a<c:
    max=c
else:
    max=a
if b>d:
    min=d;
else:
    min=b
if (min-max)>0:
    print(min-max)
    print('\n')
else:
    print('0\n')
quit()


def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)




def lcm(a,b):
    c=gcd(a,b);
    return a/c*b


n=int(input())
t=[int(input()) for lop in range(n)]
ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t)
print(int(ans))

A=input()
B=input()
C=input()
D=input()
a=int(A)
b=int(B)
c=int(C)
d=int(D)

max=0
min=0

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



def gcd(a,b):
    return b





def lcm(a,b):
    return a


n=int(input())
t=[int(input()) for lop in range(n)]
ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t)
print(int(ans))



a,b,c,d=[int(i) for i in input().strip().split(' ')]



max=0
min=0

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



Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted