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

M1 = max(A, C)
M2 = min(B, D)

if B >= C:
    print(M2 - M1)

else:
    print(0)

Submission status: Wrong Answer

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

M1 = max(A, C)
M2 = min(B, D)

if B > C:
    print(abs(M1 - M2))

else:
    print(0)

Submission status: Wrong Answer

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

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

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


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

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

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

Submission status: Wrong Answer

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

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

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


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

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

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

Submission status: Wrong Answer

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

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

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

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

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

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

Submission status: Wrong Answer

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

alice = [1 if A <= t < B else 0 for t in range(1, 101)]
bob = [1 if C <= t < D else 0 for t in range(1, 101)]

overlap = [1 for a, b in zip(alice, bob) if a > 0 and b > 0]

print(len(overlap))

Submission status: Wrong Answer

Solution code:
start_a, end_a, start_b, end_b = map(int, input().split())
a_switch_time = end_a - start_a
b_switch_time = end_b - start_b

if end_a < start_b:
    print(0)
elif end_a <= end_b:
    print(a_switch_time - start_b)
else:
    print(b_switch_time)

Submission status: Wrong Answer

Solution code:
start_a, end_a, start_b, end_b = map(int, input().split())

if end_a < start_b:
    print(0)
elif end_a >= start_b:
    if end_a-start_a > end_b - start_b:
        print(end_b - start_b)
    else:
        print(end_a - start_a - start_b)

Submission status: Wrong Answer

Solution code:
start_a, end_a, start_b, end_b = map(int, input().split())

if end_a < start_b:
    print(0)
elif end_a >= start_b:
    if end_a-start_a > end_b - start_b:
        print(end_b - start_b)
    else:
        print(end_a - start_b)

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 and d <= b:
    print(d-c)
elif c <= a and b <= d:
    print(a-b)
elif a <= c and b <= d:
    print(b-c)
elif c <= a and d <= b:
    print(d-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C, D=map(int, input().split())
X=set([i for i in range(A, B+1)])
print(sum([1 for i in range(C, D+1) if i in X]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print('0')
else:
    print(min(b-a,d-c),min(b-c,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 min(b-a,d-c)>(b-c):
    print(b-c)
else:
    print(min(b-a,d-c))

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

a,b,c,d=map(int,input().split())
if b<=c:
    print('0')
else:
    print(min(abs(b-c),b-a,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-a,d-c))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, D: int):
    if C > B:
        print(0)
        return
    if C == B:
        print(1)
        return
    s = max(A, C)
    e = min(B, D)
    print(e - s)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, D: int):
    if C >= B:
        print(0)
        return
    s = max(A, C)
    e = min(B, D)
    print(e - s)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

url = "https://atcoder.jp//contests/abc070/tasks/abc070_b"

def main():
    t = list(map(int, input().split()))
    start = max(t[0], t[2])
    end = min(t[1], t[3])
    print(end - start)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if a <= c <= b:
    if d <= b:
        print(d-c)
    else:
        print(b-c)
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 d <= b:
    print(d - c)
elif c <= a and b <= d:
    print(b - a)
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 A<=C:
  if D>=B:
    t=B-C
  else:
    t=D-C
else:
  if D>=B:
    t=B-A
  else:
    t=D-A
  t=D-A
if t<=0:
  print(0)
else:
  print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, d = list(map(int, input().split()))
if d <= a:
    print(0)
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)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l.sort()

print(l[2]-l[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if  a <= c < b and c < b < d:
    print(b-c)
elif c <= a < d and 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)

Submission status: Wrong Answer

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

if  a < c < b and c < b < d:
    print(b-c)
elif c < a < d and 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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#
# abc070 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """0 75 25 100"""
        output = """50"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """0 33 66 99"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10 90 20 80"""
        output = """60"""
        self.assertIO(input, output)


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

    if A > B:
        A, B = B, A
        C, D = D, C

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


if __name__ == "__main__":
    #unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
#
# abc070 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """0 75 25 100"""
        output = """50"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """0 33 66 99"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10 90 20 80"""
        output = """60"""
        self.assertIO(input, output)


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

    if A > B:
        A, B = B, A
        C, D = D, C

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


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

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

if b < c or d < a:
    ans = 0
elif a < c and c < b and b < d:
    ans = abs(b-c)
elif c < a and a < d and d < b:
    ans = abs(d-a)
elif a <= c and d <= b:
    ans = abs(d-c)
else:
    ans = b-a

print(ans)

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<=A and B<=D:
  print(B-A)
elif C<=A and D<=B:
  print(D-A)
elif B-C>=0 and B<=D:
  print(B-C)
elif B-C>=0 and B>=D:
  print(D-C)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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 <= 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 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 <= d:
    print(c-b)
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 c <= a and b <= d:
    print(b-a)
elif a <= c and d <= b:
    print(d-c)
else:
    print(abs(c-b))

Submission status: Wrong Answer

Solution code:
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)
else:
    print(abs(c-b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if l[1] <= l[2]:
    print(0)
else:
    ls = sorted(l)
    print(ls[2]-ls[1])

Submission status: Wrong Answer

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

if l[1]<l[2]:
    print(0)
else:
    ls = sorted(l)
    print(ls[2]-ls[1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
table = [0] * 101

for i in range(a, b+1):
    table[i] += 1

for j in range(c, d+1):
    table[j] += 1

print(table.count(2)-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
S,F,countS,countF = 0,0,0,0
if a<=c:
  countS = c
  S = a
else:
  countS = a
  S = c
if b <= d:
  countF = b
  F = d
else:
  countF = d
  F = b
count=0
flagC = False
for i in range(S,F+1):
  if i == countS:
    flagC = True
  if flagC:
    count+=1
  if i == countF:
    break
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(start - finish)

Submission status: Wrong Answer

Solution code:
NN =input().split()
a = int(NN[0])
b = int(NN[1])
c = int(NN[2])
d = int(NN[3])
list1=[a,b,c,d]
list1.sort()
ans = list1[2] -list1[1]
if b < c:
  print(0)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
NN =input().split()
a = int(NN[0])
b = int(NN[1])
c = int(NN[2])
d = int(NN[3])
list1=[a,b,c,d]
list1.sort()
ans = list1[2] -list1[1]
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
a_start = a
a_end = a + b
b_start = c
b_end = c + d
if a_end <= b_start or b_end <= a_start:
    print(0)
else:
    print(min(abs(a_end - b_start), abs(b_end - a_start)))

Submission status: Wrong Answer

Solution code:
s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

answer = 0

if a < c and d < b:
    answer = d - c
elif c < a and b < d:
    answer = b - a
elif c >= b or a >= d:
    answer = 0
elif b > c:
    answer = b - c
elif d > a:
    answer = d - a


print(answer)

Submission status: Wrong Answer

Solution code:
s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

answer = 0

if a < c and d < b:
    answer = d - c
elif c < a and b < d:
    answer = b - a
elif c > b or a > d:
    answer = 0
elif b > c:
    answer = b - c
elif d > a:
    answer = d - a


print(answer)

Submission status: Wrong Answer

Solution code:
s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

answer = 0

if a >= d or c >= b:
    answer = 0
elif b > c:
    answer = b - c
elif d > a:
    answer = d - a

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
check = [0] * 110
for i in range(100):
    if a <= i <= b:
        check[i] = 1
    if c <= i <= d:
        if check[i] == 1: check[i] = 2
print(check.count(2) - 1) if check.count(2) != 0 else print(0)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
check = [0] * 110
for i in range(100):
    if a <= i <= b:
        check[i] = 1
    if c <= i <= d:
        if check[i] == 1: check[i] = 2
print(check.count(2) - 1)

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b,c,d = map(int,input().split())
t = [0]*101

t[a]=t[c]=1
t[b]=t[d]=-1

t = list(np.cumsum(t))

print(t.count(2))

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
print(min(b, d) - max(a, 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 a > c:
    if c + d >= a:
        ans = min(b-a, c+d-a)
    else:
        ans = 0
elif a == c:
    ans = min(b, d)
else:
    if a + b >= c:
        ans = min(d-c,a+b-c)
    else:
        ans = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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 and D <= B:
    print(D-C)
elif C < A and B < D:
    print(B-A)
elif A< C < B and B < D:
    print(B-C)
elif A < D < B and C < A:
    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 and D <= B:
    print(D-C)
elif C < A and B < D:
    print(B-A)
elif A< C < B:
    print(B-C)
elif A < D < B:
    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 and D <= B:
    print(D-C)
elif C < A and B < D:
    print(B-A)
elif C < B:
    print(B-C)
elif A < D:
    print(D-A)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/14
# Filename: main 
# Author: acto_mini

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

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


if __name__ == '__main__':
    main()