Problem:


Score : 200 points

Problem Statement

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?

Constraints

0≤A<B≤100

0≤C<D≤100

All input values are integers.

Input

Input is given from Standard Input in the following format:  

A B C D

Output

Print the length of the duration (in seconds) in which both Alice and Bob were holding down their buttons.

Sample Input 1

0 75 25 100

Sample Output 1

50

Alice started holding down her button 0 second after the start-up of the robot, and released her button 75 second after the start-up.

Bob started holding down his button 25 second after the start-up, and released his button 100 second after the start-up.

Therefore, the time when both of them were holding down their buttons, is the 50 seconds from 25 seconds after the start-up to 75 seconds after the start-up.

Sample Input 2

0 33 66 99

Sample Output 2

0

Alice and Bob were not holding their buttons at the same time, so the answer is zero seconds.

Sample Input 3

10 90 20 80

Sample Output 3

60



Sample input:
0 75 25 100


Sample output:
50

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<c:
    print(int(0))

if b >= c:
    print(b-c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 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)
else:
  print(0)

Submission status: Wrong Answer

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

if 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)
else:
  print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
if a[1] < a[2]:
    print(0)
else:
    x = sorted(a)
    print(x[2]-x[1])

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
if a[1] <= a[2]:
    print(0)
else:
    x = sorted(a)
    print(x[2]-x[1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
############################################
a,b,c,d=map(int,input().split())
if b<c or d<a:
  print(0)
elif c<a and b<d:
    print(b-a)
elif a<c and d<b:
    print(d-c)
elif a<c:
  print(b-c)
else:
  print(d-a)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
############################################
a,b,c,d=map(int,input().split())
if b<c or d<a:
  print(0)
elif a<c:
  print(b-c)
else:
  print(d-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_b

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

if A >= C:
    start = A
else:
    start = C

if B >= D:
    end = D
else:
    end = B

ans = end - start

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<=c or a>=d:#1
  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(b-a)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<=c or a>=d:#1
  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)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<=c or a>=d :# 1,2
  print(0)
else:
  if (a<=c and b<d) or (a<c and b<=d):#2
    print(b-c)
  elif (a<=c and b>d) or (a<c and b>=d):
    print(d-c)
  elif (a>c and b<=d) or (a>=c and b<d):
    print(b-a)
  elif a==c and b==d:
    print(0)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<=c or a>=d :# 1,2
  print(0)
else:
  if (a<=c and b<d) or (a<c and b<=d):#2
    print("a",b-c)
  elif a<=c and b>d:
    print("b",d-c)
  elif a>c and b<=d:
    print("c",b-a)
  elif a==c and b==d:
    print(0)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<=c or a>=d or (a==c and b==d):# 1,2
  print(0)
else:
  if a<=c and b<=d:#2
    print(b-c)
  elif a<=c and b>d:
    print(d-c)
  elif a>=c and b<=d:
    print(b-a)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
if b<=c or a>=d or (a==c)and(b==d):# 1,2
  print(0)
else:
  if a<=c and b<=d:#2
    print(b-c)
  elif a<=c and b>d:
    print(d-c)
  elif a>=c and b<=d:
    print(b-a)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  a,b,c,d = map(int,input().split())
  if b >= c:
    l = max(a,c)
    r = min(b,d)
    print(abs(r-l))
    exit()
  else:
    print(0)
    exit()
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  a,b,c,d = map(int,input().split())
  if b >= c:
    l = max(a,c)
    r = min(b,d)
    print(r-l)
    exit()
  else:
    print(0)
    exit()
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

import math
import itertools
import statistics
#import numpy as np
import collections

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int, input().split())
if c >= b or a >= d:
    print(0)
elif c > a and d > b:
    print(b-c)
elif c > a and d < b:
    print(d-c)
elif c < a and d < b:
    print(d-a)
elif c < a and d > b:
    print(b-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
ans = 0

for i in range(1, 101):
    if a <= i <= b and c <= i <= d:
        ans = ans + 1

if ans != 0:
    ans = ans - 1

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,D=list(map(int, input().split()))
ma=min(B,D)
mi=max(A,C)
print(ma-mi)

Submission status: Wrong Answer

Solution code:
A,B,C,D=list(map(int, input().split()))
ma=max(A,C)
mi=min(B,D)
print(mi-ma)

Submission status: Wrong Answer

Solution code:
A,B,C,D=list(map(int, input().split()))
ma=max(A,B)
mi=min(C,D)
print(mi-ma)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A, B, C, D = map(int, input().split())
if A <= C:
    if B >= C and B <= D:
        print(B - C)
    elif B >= C and B >= D:
        print(D - C)
    elif B < C:
        print(0)
elif C <= A:
    if D >= A and D <= B:
        print(B - C)
    elif D >= A and D >= B:
        print(B - A)
    elif D < A:
        print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, d = [int(x) for x in input().split()]

if a > c:
    start = a
else:
    start = c

if b < d:
    end = b
else:
    end = d

print(end - start)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))

list=[0]*101
#A~B秒までの要素を+1
for i in range(A[0],A[1]+1):
  list[i]+=1
for i in range(A[2],A[3]+1):
  list[i]+=1

print(list.count(2)-1)

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))

list=[0]*101
#A~B秒までの要素を+1
for i in range(A[0],A[1]+1):
  list[i]+=1
for i in range(A[2],A[3]+1):
  list[i]+=1

print(list.count(2))

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))

list=[0]*101
#A~B秒までの要素を+1
for i in range(A[0],A[1]+1):
  list[i]+=1
for i in range(A[2],A[3]+1):
  list[i]+=1
ans=0
for i in range(len(list)):
  if list[i]==2:
    ans+=1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
l=[a,b,c,d]
l.sort()
if l[1]==b and l[2]==c:
    print(0)
elif l[1]==d and l[1]==a:
    print(0)
else:
    print(l[2]-l[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,D = map(int, input().rstrip().split())
print(max([A,B]) - min([C, D]))

Submission status: Wrong Answer

Solution code:
startA, finishA, startB, finishB = map(int,input().split())

if finishA <= finishB:
    if startB == startA:
        print(finishB - finishA)
    elif startA <= startB <= finishA:
        print(finishA - startB- startA)
    else:
        print("0")


else:
    if startB == startA:
        print(finishA - finishB)
    elif startA <= startB <= finishB:
        print(finishB - startB)
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
startA, finishA, startB, finishB = map(int,input().split())


if startB == startA:
    print(finishB - finishA)
elif startB <= finishA - startA:
        print(finishA - startB- startA)
else:
    print("0")

Submission status: Wrong Answer

Solution code:
startA, finishA, startB, finishB = map(int,input().split())


if startB == startA:
    print(finishB - finishA)
elif startB < finishA - startA:
        print(finishA - startB- startA)
else:
    print("0")

Submission status: Wrong Answer

Solution code:
startA, finishA, startB, finishB = map(int,input().split())

if startB < finishA - startA:
    print(finishA - startB- startA)
else:
    print("0")

Submission status: Wrong Answer

Solution code:
startA, finishA, startB, finishB = map(int,input().split())

if startB < finishA - startA:
    print(finishA - startB)
else:
    print("0")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
s = max(a, c)
f = min(b, d)
print(f - s)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    ap, ar, bp, br = map(int, input().split())

    if ar <= bp:
        return print(0)
    else:
        u = max(ap, bp)
        o = min(ar, br)
        ans = o - u
        print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if b-c-a>0:
    print(b-c-a)
else:
    print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
ans = 0
for i in range(1, 101):
    if a <= i <= b and c <= i <= d:
        ans += 1

if ans > 0:
    print(ans-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,D=map(int,input().split())
ans=0
for i in range(1,101):
  if i in range(A,B+1) and i in range(C,D+1):
    ans +=1
print(max(0,ans-1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

start = max(a,c)
end = min((a + b),(c + d))

r = max(0, end - start)
print(int(r))

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
end = min((a + b),(c + d))
start = max(a,c)
r = max(0, end - start)
print(r)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
print((b-c)*(b>=c)-(b-d)*(b>=d))

Submission status: Wrong Answer

Solution code:
N  = list(map(int, input().split()))

if N[2]-N[1] <= 0:
  if N[1] > N[3]:
    print(abs(N[3]-N[2]))
  else:
    print(abs(N[2]-N[1]))
else:
  print("0")

Submission status: Wrong Answer

Solution code:
N  = list(map(int, input().split()))

if N[2]-N[1] < 0:
  print(abs(N[2]-N[1]))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
als, ale, bs, be = map(int, input().split())
s = max(als, bs)
e = min(ale, be)

print(e-s)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
a,b,c,d=map(int,input().split())
if b>=c :
	print(b-c)
else :
	print("0")

Submission status: Wrong Answer

Solution code:
import sys
a,b,c,d=map(int,input().split())
if c>=b :
	print(c-b)
else :
	print("0")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

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, B - A,D-A) if B > C else 0)

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

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, B - A) if B > C else 0)

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

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)