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(a+b,c+d)-max(a,c),0))

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

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 = (b - c) < 0 ? 0 : b - c

print(ans)

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

start = a if a > c else c
end = b if b < d else d

ans = 0 if b < c or d < a else 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,b,c,d=[int(i) for i in input().split()]
e = max(a,b)
f = min(c,d)
print(f-e)

a,b,c,d=[int(i) for i in input().split()]
e = max(a,c)
f = min(b,d)
g = f-e
if g>0:
    print(g)
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):
def main():
    i = list(map(int, input().split()))
    a = i[0]
    b = i[1]
    c = i[2]
    d = i[3]

    if not (0 <= a and a < b and b <= 100 and 0 <= c and c < d and d <= 100):
        return

    alice = b - a
    bob = d -c

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


if __name__ == "__main__":
    main()

def main():
    i = list(map(int, input().split()))
    a = i[0]
    b = i[1]
    c = i[2]
    d = i[3]

    if not (0 <= a and a < b and b <= 100 and 0 <= c and c < d and d <= 100):
        return
    
    if(b <= c or c < b):
        print(0)
    elif(c < b and b < d):
        print(b - c)
    elif(a <= c and d <= b):
        print(d - c)
    elif(a < d and d < b):
        print(d - a)
    elif(c <= a and b <= d):
        print(b - a)


if __name__ == "__main__":
    main()

def main():
    i = list(map(int, input().split()))
    a = i[0]
    b = i[1]
    c = i[2]
    d = i[3]

    if not (0 <= a and a < b and b <= 100 and 0 <= c and c < d and d <= 100):
        return
    
    if(b <= c or c < b):
        print(0)
    elif(c < b and b < d):
        print(b - c)
    elif(a < c and d < b):
        print(d - c)
    elif(a < d and d < b):
        print(d - a)
    elif(c < a and b < d):
        print(b - a)


if __name__ == "__main__":
    main()

def main():
    i = list(map(int, input().split()))
    a = i[0]
    b = i[1]
    c = i[2]
    d = i[3]

    if not (0 <= a and a < b and b <= 100 and 0 <= c and c < d and d <= 100):
        return

    alice = b - a
    bob = d -c

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


if __name__ == "__main__":
    main(

def main():
    i = list(map(int, input().split()))
    a = i[0]
    b = i[1]
    c = i[2]
    d = i[3]

    if not (0 <= a and a < b and b <= 100 and 0 <= c and c < d and d <= 100):
        return
    if not (isinstance(a, int) and isinstance(b, int) and isinstance(c, int) and isinstance(d, int)):
        return
    
    if(b <= c or d <= a):
        print(0)
    elif(a <= c and c < b and b <= d):
        print(b - c)
    elif(c <= a and a < d and d <= b):
        print(d - a)
    elif(a <= c and d <= b):
        print(d - c)
    elif(c <= a and b <= d):
        print(b - a)


if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Wrong Answer

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):
import sys

N = input()

for i in range(len(N)):
  if N[i] != N[len(N)-1-i]:
    print("No")
    sys.exit()

print("Yes")

A, B, C, D = [int(n) for n in input().split()]

end = min(B, D)
start = max(A, C)
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())
if b>=c:
    printabs((min(b,d)-max(a,c)))
else :
    print(0)


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

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)

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)

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

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

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())
AB = [str(i) for i in range(A,B+1)]
CD = [str(j) for j in range(C,D+1)]
count = 0

for a in range(101):
  if str(a) in AB and str(a) in CD:
    count += 1
if count = 0:
  print(0)
else:
  print(count-1)

A,B,C,D  =map(int,input().split())
AB = [str(i) for i in range(A,B+1)]
CD = [str(j) for j in range(C,D+1)]
count = 0

for a in range(101):
  if str(a) in AB and str(a) in CD:
    count += 1
if count == 0:
  print(0)
else:
  print(count-1)

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


def solve(A, B, C, D):
    if A < C:
        if B < C:
            print("0")
        elif A <= C and D <= B:
            print(str(D-C))
        else:
            ptint(str(B-C))
    else:
        if D < A:
            print("0")
        elif C <= A and B <= D:
            print(str(B-A))
        else:
            print(str(D-A))

solve(A, B, C, D)


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

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


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

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


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


def solve(A, B, C, D):
    if A < C:
        if B < C:
            return 0
        elif A <= C and D <= B:
            return (D - C)
        else:
            return (B - C)
    else:
        if D < A:
            return 0
        elif C <= A and B <= D:
            return (B - A)
        else:
            return (D - A)

print(solve(A, B, C, D))


Verdicts: Runtime Error

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=input()
B=input()
C=input()
D=input()
print(int(B)-int(C) if C<B else "0")

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


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

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

Verdicts: Runtime Error

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(i) for i in input().split()]
print(min(0,min(B,D) - max(A,C)))

A,B,C,D = [int(i) for i in input().split()]
print(min(0,min(B,D) - max(A,C))

A,B,C,D = [int(i) for i in input().split()]
print(max(0,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=map(int,input().split())
if C<=B:
    if A>=C:
        if D>=B:
            print(B-C)
        else:
            print(D-C)
        
    else:
        if D>=B:
            print(B-A)
        elif A<=D<B:
            print(D-A)
        else:
            print(0)
else:
    print(0)

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

A,B,C,D=map(int,input().split())
if C<=B:
    if A>=C:
        print(C-B)
    else:
        if D>=B:
            print(B-A)
        else:
            print(D-A)
else:
    print((B-A)+(D-C))

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

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

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

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

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(open(0));print(max(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: 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):
,b,c,d=map(int,input().split())
print(max(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: 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):
0 75 25 100

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

length = 0

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

print (length)

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):
# 070 B 
A,B,C,D= map(int,input().split())
if B < C or A < D:
    print(0)
    exit()
if A <= C:
    start =C
else:
    start =A
if B <=D:
    end =B
else:
    end =D
print(end-start)

# 070 B 
A,B,C,D= map(int,input().split())
if B < C:
    print(0)
    exit()
if D < A:
    print(0)
    exit()
if A <= C:
    start =C
else:
    start =A
if B <=D:
    end =B
else:
    end =D
print(end-start)

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(D - C, B - A, max(0, C - B)))

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

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

def left(a, c):
    if a < c:
        return c
    return a

def right(b, d):
    if b < d:
        return b
    return d

right(B, D) - left(A, C)

# ABC 070 B

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 = input().split()
value = (min(B, D) - max(A, C))
print(value if value > 0 else "0")



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

elif D < B:
    print(D-C)

elif A < C:
    print(D-A)

else:
    print(B-C)

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

if B < C:
    print(0)

elif D < B:
    print(D-C)

elif A < C:
    print(B-A)

else:
    print(B-C)

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

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

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<C):
  print(max(0, B-D))
if(A>C):
  print(max(0, D-B))
if(A=C):
  print(min(B-A, D-A))
        

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

using namespace std;

int main(void){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    const int lower = max(A,C);
    const int upper = min(B,D);
    
    cout << max(0,upper-lower) << endl;
    
    return 0;
}

A,B,C,D = map(int,input().split())
lower = max(A,C)
upper = min(B,D)

print(max(0,upper-lower))

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(0,min([b,d])-min([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):
a1,a2,b1,b2=map(int,input().split())
print(max(min(a2,b2)-max(b1,a1),0)


a1,a2,b1,b2=map(int,input().split())
print(max(min(a2,b2)-max(b1,a1),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 c < b < d:
  print(b-C)
elif a < d < b:
  print(d-a)
elif a < c < b and a< d < b:
  print(d-c)
elif c < a < d and c < b < d:
  print(b-a)
else:
  print(0)

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

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


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())
ans = min(b,　d) - max(a,　c)
if ans < 0:
    print(0)
else:
    print(ans)

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):
a,b,c,d = 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())
if B < C:
  print(0)
else:
  print(C - B)

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

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

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

if b > c:
    result = b-c
if b > d:
    result -= b-d
if a > c:
    result -= a-c

print(result if result < 0 else 0)

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

if b > c:
    result = b-c
if b > d:
    result -= b-d
if a > c:
    result -= a-c

print(result if result >= 0 else 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())
t = min(c,d) - max(a,b)
print(max(t, 0))

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

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

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

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

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


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

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

a,b,c,d=map(int,input().split())
print(-a+b-c+d+2)

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

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

if s <= 0:
    s = 0

print(s

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

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

if s <= 0:
    s = 0

print(s)

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

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

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

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

if s <= 0:
    s = 0

print(s)

Verdicts: Runtime Error

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


# -*- coding: utf-8 -*-
a, b, c, d = map(int, input().split())
if(c < b):
    if(d <= b):
        if(d <= a):
            time = 0
        elif(c < a):
            time = d - a
        else:
            time = d - c
    elif (c < a):
        time = b - a
    else:
        time = b - c
else:
    time = 0
print(time)


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(a,b,c,d)
al=[]
bl=[]
for i in range(a,b+1):
    al.append(i)
for i in range(c,d+1):
    bl.append(i)
albl=set(al)&set(bl)
if len(albl)==0:
    print(0)
else:
    print(len(albl)-1)

a,b,c,d=map(int,input().split())
al=[]
bl=[]
for i in range(a,b+1):
    al.append(i)
for i in range(c,d+1):
    bl.append(i)
albl=set(al)&set(bl)
if len(albl)==0:
    print(0)
else:
    print(len(albl)-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 A <= C and C <= B and B <= D:
  print(B-C)
elif C <= A and A <= B and B <= D:
  print(B-A)
elif A <= B and B <= C and C <= D:
  print(0)
elif C <= A and A <= D and D <= B:
  print(D-A)
elif A <= C and C <= D and D <= B:
  print(D-C)
else C <= D and D <= A and A <= B:
  print(0)

A,B,C,D=map(int,input().split())
if A <= C and C <= B and B <= D:
  print(B-C)
elif C <= A and A <= B and B <= D:
  print(B-A)
elif A <= B and B <= C and C <= D:
  print(0)
elif C <= A and A <= D and D <= B:
  print(D-A)
elif A <= C and C <= D and D <= B:
  print(D-C)
elif C <= D and D <= A and A <= B:
  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):
ABCD = list(map(int,input().split()))
print(sorted(ABCD)[2]-sorted(ABCD)[1]) if ABCD[1] - ABCD[2] < 0 else print(0)

ABCD = list(map(int,input().split()))
print(sum(sorted(ABCD)[1:3])) if ABCD[1] - ABCD[2] < 0 else print(0)

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

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

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 b >= c:
    if a >= c:
        print(b - c)
    else:
        print((b - c) - (c - a))
else:
    print(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())
P = [0 for _ in range(202)]
for p in range(A, A + B + 1): P[p] += 1
for p in range(C, C + D + 1): P[p] += 1
count = 0
for p in P:
  if p == 2: count += 1
print(count)

import sys

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    double  = 0
    for i in range(101):
        if A <= i <= B and C <= i <= D: double += 1
    print(double - 1 if double > 1 else 0)

    return  0

if __name__ == "__main__":
    solve()

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


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

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

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

if(C-B>0 or A-D>0):
    print(0)
    exit()
start=max(A,C)
end=min(B,D)
print(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())

ba=[i for i in range(a,b+1)]
dc=[i for i in range(c,d+1)]
ans=0
print(min(a,b,c,d),max(a,b,c,d))
for i in range(min(a,b,c,d),max(a,b,c,d)):
  if i in ba and i in dc:
    ans+=1
if ans==0:
  print(0)
else:
  print(ans-1)

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

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

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

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

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):
def dup(A, B):
    r = 0
    for x in A:
        print(x)
        if x in B:
          r = r + 1
    return r


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

A = range(a, b+1)
B = range(c, d+1)

result = dup(A, B) if len(A) <= len(B) else dup(B, A)

print(result)


def dup(A, B):
    r = 0
    for x in A:
        if x in B:
          r = r + 1
    return r-1 if r != 0 else 0


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

A = range(a, b+1)
B = range(c, d+1)

result = dup(A, B) if len(A) <= len(B) else dup(B, A)

print(result)


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):
T = [int(i) for i in input().split()]
if T[0] >= T[3] or T[2] >= T[1]:
  print(0)
elif T[0] >= T[2]:
  print(T[1] - T[2])
elif T[2] >= T[0]:
  print(T[3] - T[0])

T = [int(i) for i in input().split()]
if T[0] >= T[3] or T[2] >= T[1]:
  print(0)
elif T[0] >= T[2]:
  print(min(T[3] - T[0], T[1] - T[0]))
elif T[2] >= T[0]:
  print(min(T[3] - T[2], T[1] - T[2]))

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

import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

A, B, C, D = ISI()
ans = 0
for i in range(A, B):
    if C < i <= D:
        ans += 1
print(ans)


import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

A, B, C, D = ISI()
ans = 0
for i in range(1, 101):
    if A < i <= B and C < i <= D:
        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())

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

print(start - finish)

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

a, b, c, d = map(int, input().split())
 
start = max(a, c)
finish = min(b, d)

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

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

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

lower = max(a,c)
upper = min(b,d)

print(upper-lower, 0)

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

lower = max(a,c)
upper = min(b,d)

print(max(upper-lower, 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 = list(map(int,input().split()))

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

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

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

Verdicts: Runtime Error

Accepted