TnT/Multi_CodeNet4Repair huggingface dataset:
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, B, C, D = map(int, input().split())
print(min(min(B, D) - max(A, C), 0))

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


Verdicts: Wrong Answer

Accepted
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,b,c,d = map(int,input().split())
print(max(min(b,d)-max(a,c)),0)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
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,b,c,d=int(input().split())
x=min(b,d)-max(a,c)
print(x if x>0 else 0)

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

Verdicts: Runtime Error

Accepted
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,b,c,d=map(int,input().split())
print(max(max(a,c)-min(b,d),0))

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

Verdicts: Wrong Answer

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

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)


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)


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)
    


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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, B, C, D = map(int, input().split())

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


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

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


Verdicts: Runtime Error

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

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


Verdicts: Wrong Answer

Accepted
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):
# Two Switches
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


# Two Switches
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)

Verdicts: Wrong Answer

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

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

Verdicts: Runtime Error

Accepted
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,b,c,d=map(int,input())
if a<=c<=b:
  if b<d:
    print(b-c)
  else:
    print(d-c)
elif c<=a<=d:
  if b<d:
    print(b-a)
  else:
    print(d-a)
else:
  print(0)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
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,B,C,D=map(int,input().split())

if B > C and C < D: # normal
  print(B-C)
elif B > C and B > D:
  print(D-C)
elif:
  print(0)
  
#elif B < C:
#  print(0)


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

Verdicts: Runtime Error

Accepted
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):
#coding:utf-8

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

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

#coding:utf-8

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


Verdicts: Wrong Answer

Accepted
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):
i=input()
l=map(int,input().split())
ans=min(l[1],l[3])-max(l[0],l[2])
print(ans if ans>0 else 0)

l=list(map(int,input().split()))
ans=min(l[1],l[3])-max(l[0],l[2])
print(ans if ans>0 else 0)

Verdicts: Runtime Error

Accepted
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):
list = input().split()
a = list[0]
b = list[1]
c = list[2]
d = list[3]
result = 0
if a < b and c < d:
    if (a >= c and b <= d) or (a <= c and b >= d):
        result = min(b-a,d-c)
    elif a <= c and c <= b:
        result = b - c
    elif c <= a and a <= d:
        result =  d - a
print(result)

list = input().split()
a = int(list[0])
b = int(list[1])
c = int(list[2])
d = int(list[3])
result = 0
if a < b and c < d:
    if (a >= c and b <= d) or (a <= c and b >= d):
        result = min(b-a,d-c)
    elif a <= c and c <= b:
        result = b - c
    elif c <= a and a <= d:
        result =  d - a
print(result)

Verdicts: Runtime Error

Accepted
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):
line = [int(i) for i in input().split()]
v1 = line[0]
v2 = line[1]
v3 = line[2]
v4 = line[3]


s = v1 if v3 < v1 else v3
e = v2 if v4 < v2 else v4

if v2 < v3 :
  print(0)
  exit()

dif = e-s

if dif < 0 : 
  print(0)
else :
  print(dif)




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

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

inter = s1.intersection(s2)

res = len(inter)-1
if res == -1 : res = 0
print(res)

Verdicts: Wrong Answer

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

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)

Verdicts: Runtime Error

Accepted
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, B, C, D = map(int, input().split())

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

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



Verdicts: Wrong Answer

Accepted
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,B,C,D=map(int,input().split())
print(max(0,min(C,D)-max(A,B)))

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

Verdicts: Wrong Answer

Accepted
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,b,c,d=map(int,input().split())

ans=[0]*101
for i in range(a,b+1):
    ans[i]+=1
for i in range(c,d+1):
    ans[i]+=1
    
kai=0
for i in range(101):
    if ans[i]==2:
        kai+=1
print(kai)

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

ans=[0]*101
for i in range(a,b):
    ans[i]+=1
for i in range(c,d):
    ans[i]+=1
    
kai=0
for i in range(101):
    if ans[i]==2:
        kai+=1
print(kai)

Verdicts: Wrong Answer

Accepted
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,b,c,d=map(int,input().split());print(min(0,min(b,d)-max(a,c)))

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


Verdicts: Wrong Answer

Accepted
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,B,C,D = map(int, input().split())
print (max(B, D) - max(A, C))


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)

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
# coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    A, B, C, D = ILI()
    return A, B, C, D


def solve(A, B, C, D):
    l_ans = [0] * 101
    for a in range(A, B + 1):
        l_ans[a] += 1
    for b in range(C, C + 1):
        l_ans[b] += 1

    ans = 0
    for a in l_ans:
        if a == 2:
            ans += 1

    if ans != 0:
        ans -= 1

    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


# coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    A, B, C, D = ILI()
    return A, B, C, D


def solve(A, B, C, D):
    l_ans = [0] * 101
    for a in range(A, B + 1):
        l_ans[a] += 1
    for b in range(C, D + 1):
        l_ans[b] += 1

    ans = 0
    for a in l_ans:
        if a == 2:
            ans += 1

    if ans != 0:
        ans -= 1

    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
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, b, c, d = map(int, input().split())
print(min(0, min(b,d) - max(a,c)))

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

Verdicts: Wrong Answer

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

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


Verdicts: Wrong Answer

Accepted
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):
n = list(map(int, input().split()))
print(n)

def func1(k,l):
    if k>l:
        return l
    else:
        return k

def func(x):
    if (x[2]>x[1]) or (x[0]>x[3]):
        print("Check")
        return 0
    else:
        if x[0]>x[2]:
            return (func1(x[1],x[3])-x[0])
        else:
            return (func1(x[1],x[3])-x[2])

print(func(n))


n = list(map(int, input().split()))

def func1(k,l):
    if k>l:
        return l
    else:
        return k

def func(x):
    if (x[2]>x[1]) or (x[0]>x[3]):
        return 0
    else:
        if x[0]>x[2]:
            return (func1(x[1],x[3])-x[0])
        else:
            return (func1(x[1],x[3])-x[2])

print(func(n))

Verdicts: Wrong Answer

Accepted
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):
n = int(input())
ans = 1
while n >= 2:
    n = n // 2
    ans *= 2
print(ans)

a, b , c, d = list(map(int, input().strip().split()))
lst = []
lstt = []
for i in range(a, b + 1):
    lst.append(i)

for i in range(c, d+1):
    lstt.append(i)

one = set(lst)
two = set(lstt)

inter = one & two
if len(inter)-1 > 0:
    print(len(inter)-1)
else:
    print(0)

Verdicts: Runtime Error

Accepted
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):
# -*- coding:utf-8 -*-

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)


# -*- coding:utf-8 -*-

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)


Verdicts: Wrong Answer

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

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

Verdicts: Wrong Answer

Accepted
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,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:
    print(d-a)

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)

Verdicts: Runtime Error

Accepted
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, B, C, D = map(int, input().split(' '))

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

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

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


Verdicts: Wrong Answer

Accepted
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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,c,d = map(int, input().split())

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


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

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


Verdicts: Wrong Answer

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

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

Verdicts: Runtime Error

Accepted
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, b, c, d = (int(i) for i in input().split())

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

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

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

Verdicts: Runtime Error

Accepted
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=list(map(int,input().split()))

list=[0]*101

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)

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

list=[0]*101

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

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

list=[0]*101

for i in range(A[0],A[1]+1):
  list[i]+=1

for i in range(A[2],A[3]+1):
  list[i]+=1
if list.count(2)>=1:
  print(list.count(2)-1)
else:
  print(0)

Verdicts: Wrong Answer

Wrong Answer

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

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

Verdicts: Wrong Answer

Accepted
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, B, C, D = (int(x) for x in input().split())
ans = min(B, D) - max(A - C)
if ans < 0:
    ans = 0
print(ans)

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

Verdicts: Runtime Error

Accepted
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, b, c, d = map(int, input().split())
row = [i for i in range(101)]
row[a-1:b] += 1
row[c-1:d] += 1
print(row.count(0))


a, b, c, d = map(int, input().split())
row = [0 for i in range(101)]
for i in range(a, b+1) : row[i] += 1
for i in range(c, d+1) : row[i] += 1
print(row.count(2))


a, b, c, d = map(int, input().split())
row = [0 for i in range(101)]
for i in range(a, b+1) : row[i] += 1
for i in range(c, d+1) : row[i] += 1
if row.count(2) == 0 : print(0)
else : print(raw.count(2)-1)


a, b, c, d = map(int, input().split())
row = [0 for i in range(101)]
for i in range(a, b+1) : row[i] += 1
for i in range(c, d+1) : row[i] += 1
if row.count(2) == 0 : print(0)
else : print(row.count(2)-1)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
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, b, c, d = map(int, input().split())
if (b <= c or d <= a): print(0)
if (b < d or c < a): print(max(abs(a - d) - abs(a - c) - abs(b - d), abs(b - c) - abs(a - c) - abs(b - d)))
if((a - d) * (b - c) < 0): print(max(abs(a - b) - abs(a - c) - abs(b - d), abs(c - d) - abs(a - c) - abs(b - d)))


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


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


Verdicts: Wrong Answer

Runtime Error

Accepted
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,b,c,d = inpl()
print(max(0,(min(b,d)-max(a,c))))

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

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

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

Verdicts: Runtime Error

Accepted
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, b, c, d = map(int, input().split())
print(max(min(c, d) - max(a, b), 0))

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

Verdicts: Wrong Answer

Accepted
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, B, C, D map(int, input().split())

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


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

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


Verdicts: Runtime Error

Accepted
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, B, C, D = map(int, input().split())

count = 0

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

print(count)

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

"""
count = 0

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

print(count)
"""

lower = max(A, C)
upper = min(B, D)

ans = max(0, upper - lower)

print(ans)

Verdicts: Wrong Answer

Accepted
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,b,c,d = map(int(input().split()))

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

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

Verdicts: Runtime Error

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


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().decode('utf8').rstrip())

print(B-C if B>C else 0)




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

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

Verdicts: Runtime Error

Accepted
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[]=list(map(int,input().split()))
n=min(a[1],a[3])-max(a[0],a[2])
print(n if n>0 else 0)

a=list(map(int,input().split()))
n=min(a[1],a[3])-max(a[0],a[2])
print(n if n>0 else 0)

Verdicts: Runtime Error

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


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


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


Verdicts: Wrong Answer

Wrong Answer

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

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


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

Verdicts: Wrong Answer

Runtime Error

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


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


if __name__ == '__main__':
    main()




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


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
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, b, c, d = map(int, input().split())

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

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

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

Verdicts: Runtime Error

Accepted
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,B,C,D = map(int,input().split())
if C <= B or D <= A:
    print(0)
elif A <= C <= D <= B:
    print(D-C)
elif C <= A <= B <= D:
    print(B-A)
elif C <= B:
    print(B-C)
else:
    print(D-A)


A = list(map(int,input().split()))
if A[1] <= A[2] or A[3] <= A[0]:
    print(0)
else:
    A.sort()
    print(A[2]-A[1])


Verdicts: Wrong Answer

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

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

Verdicts: Wrong Answer

Accepted
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, b, c, d = map(int, input().split())
l = [0 for _ in range(101)]
for i in range(a, b + 1):
  l[i] += 1
for i in range(c, d + 1):
  l[i] += 1
ans = 0
for i in range(0, 101):
  if l[i] == 2:
    ans += 1
print(ans)

a, b, c, d = map(int, input().split())
l = [0 for _ in range(101)]
for i in range(a, b):
  l[i] += 1
for i in range(c, d):
  l[i] += 1
ans = 0
for i in range(0, 101):
  if l[i] == 2:
    ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
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,b,c,d = map(int,input().split())

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

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

Verdicts: Wrong Answer

Accepted
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,b,c,d = map(int,input().split())
print(a,b,c,d)

NL = []
for i in range(a + 1,b + 1):
    NL.append(i)
for i in range(c + 1,d + 1):
    NL.append(i)
NL.sort()
print(NL)

count = 0
for i in range(len(NL) - 1):
    if NL[i] == NL[i + 1]:
        count += 1
print(count)

A,B,C,D = map(int,input().split())
counter = 0
for i in range(101):
    if (A <= i < B) and (C <= i < D):
        counter += 1
print(counter)

Verdicts: Wrong Answer

Accepted
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, b, c, d = [ int(v) for v in input().split() ]
d, e = max(a,c), min(b,d)
f = max((e-d),0)

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

Verdicts: Wrong Answer

Accepted
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):
from sys import stdin
A,B,C,D = [int(x) for x in stdin.readline().rstrip().split()]
Alice = set(range(A,B+1))
Bob   = set(range(C,D+1))
print(len(Alice & Bob))

from sys import stdin
A,B,C,D = [int(x) for x in stdin.readline().rstrip().split()]
Alice = set(range(A,B))
Bob   = set(range(C,D))
print(len(Alice & Bob))

Verdicts: Wrong Answer

Accepted
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, b, c, d = map(int, input().split(" "))

print(max(0, c-b))

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

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

Verdicts: Wrong Answer

Accepted
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, B, C, D = map(int, input().split())
print(min(0, min(C, D) - max(A, B)))

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

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


Verdicts: Wrong Answer

Wrong Answer

Accepted