ZhenlongDai/ACPR huggingface dataset:
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n,a,b = map(int, input().split())

if a>b or n==1:
    print(0)
else:
    print((b*3+a) - (a*3+b) +1 )


Failing test case input:
12 -4 1

Expected output:
51


Actual output:
11


Fixed submission (verdict: Accepted):
import math
n,a,b = map(int, input().split())

if a>b:
    print(0)
elif n==1 and a != b:
    print(0)
else:
    print((b*(n-1)+a) - (a*(n-1)+b) +1 )

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

if n==1 and a!=b:
    print(0)
    exit()
elif n==1 and a==b:
    print(1)
    exit()

if b<a:
    print(0)
    exit()

print((b-a+1)+(b-a))


Failing test case input:
33 -1 1

Expected output:
63


Actual output:
5


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())

if n==1 and a!=b:
    print(0)
    exit()
elif n==1 and a==b:
    print(1)
    exit()

if b<a:
    print(0)
    exit()

print(n*(b-a)-2*(b-a)+1)

Problem: p03705
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())
fst = (n - 1) * b + a
sec = (n - 1) * a + b
if a > b:
  print(0)
else:
  print(fst - sec + 1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
fst = (n - 1) * b + a
sec = (n - 1) * a + b
if a > b:
  print(0)
elif n == 1 and a != b:
  print(0)
else:
  print(fst - sec + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,a,b = LI()
    if n == 1:
        if a == b:
            return 1
        return 0

    if a > b:
        return 0

    if n == 2:
        return 1

    return min((b*(n-1)+a) - (a*(n-1)+b) + 1, n)


print(main())


Failing test case input:
11 -2 0

Expected output:
19


Actual output:
11


Fixed submission (verdict: Accepted):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,a,b = LI()
    if n == 1:
        if a == b:
            return 1
        return 0

    if a > b:
        return 0

    if n == 2:
        return 1

    return (b*(n-1)+a) - (a*(n-1)+b) + 1


print(main())
Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):


import math
n, a, b = map(int, input().split())

if b < a:
    print(0)
elif a != b and n == 1:
    print(0)
else:
    t = b - a + 1
    ans = math.factorial(t + n - 1) 
    print(ans)

Failing test case input:
50 0 4

Expected output:
193


Actual output:
230843697339241380472092742683027581083278564571807941132288000000000000


Fixed submission (verdict: Accepted):


n, a, b = map(int, input().split())

if b < a:
    print(0)
elif a != b and n == 1:
    print(0)
else:
    MIN = a * (n - 1) + b
    MAX = a + (n - 1) * b
    ans = MAX - MIN + 1
    print(ans)

Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
from collections import *

N, A, B = map(int, input().split())

if A>B:
    print(0)
    exit()
    
low = A+B+(N-2)*A
high = A+B+(N-2)*B
print(high-low+1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
from collections import *

N, A, B = map(int, input().split())

if A>B:
    print(0)
    exit()

if N==1 and A!=B:
    print(0)
    exit()
    
low = A+B+(N-2)*A
high = A+B+(N-2)*B
print(high-low+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if a==b:
    if n==1:
        print(1)
    else:
        print(0)
elif b-a<0:
    print(0)
else:
    print( a+b*(n-1) - (a*(n-1)+b) +1 )

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if b<a:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:
        print(0)
else:
    print( a+b*(n-1) - (a*(n-1)+b) +1 )

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n,a,b = map(int,input().split())

mi = a * (n-2)
ma = b * (n-2)
result = ma - mi + 1
if a > b:
    print(0)
elif a == b and n != 1:
    print(0)
else:
    print(result)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):

n,a,b = map(int,input().split())

mi = a * (n-2)
ma = b * (n-2)
result = ma - mi + 1
if a > b:
    print(0)
elif n == 1 and a != b:
    print(0)
elif n == 1 and a == b:
    print(1)
    
else:
    print(result)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if A>B:
    print(0)
elif A==B:
    print(1)
else:
    if N==1:
        print(0)
    else:
        print((B*N-A*N)+1)

Failing test case input:
9 -10 1

Expected output:
78


Actual output:
100


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if A>B:
    print(0)
elif A==B:
    print(1)
else:
    if N==1:
        print(0)
    else:
        print((B*(N-2)-A*(N-2))+1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = list(map(int,input().split()))
if (B * (N-1) + A) - (B + (N-1) * A) <= 0:
  print(0)
elif A == B:
  print(1)
else:
  print((B * (N-1) + A) - (B + (N-1) * A))

Failing test case input:
13 -10 2

Expected output:
133


Actual output:
132


Fixed submission (verdict: Accepted):
N, A, B = list(map(int,input().split()))
if (B * (N-1) + A) - (B + (N-1) * A) < 0:
  print(0)
elif A == B:
  print(1)
else:
  print((B * (N-1) + A) - (B + (N-1) * A) + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b= list(map(int, input().split()))
if a>b:
    print("0")
    exit(0)
elif n==1:
    if a!=b:
        print("0")
    else:
        print("1")
    exit(0)
n-=2;b-=a;a=0
if n>=b:
    print(b*n+1)

Failing test case input:
3 -4 0

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
n,a,b= list(map(int, input().split()))
if a>b:
    print("0")
    exit(0)
if n==1:
    if a!=b:
        print("0")
    else:
        print("1")
    exit(0)
n-=2;b-=a;a=0
print(b*n+1)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, A, B = map(int, input().split())
if A>B:
    A,B = B,A
ans = (B*(N-1)+A) - (A*(N-1)+B) + 1
print(ans)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
7


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if A>B:
    print(0)
    exit()
ans = (B*(N-1)+A) - (A*(N-1)+B) + 1
print(max(ans,0))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
s = 0
if b >= a:
    s = (n-2)*b - (n-2)*a + 1
print(s)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
s = (n-2)*b - (n-2)*a + 1
print(max(0,s))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n,a,b=map(int,input().split())

print(max((2*b-2*a+1),0))

Failing test case input:
12 -2 0

Expected output:
21


Actual output:
5


Fixed submission (verdict: Accepted):


n,a,b=map(int,input().split())

ans=max((n-2)*(b-a)+1,0)
print(ans)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = list(map(int, input().split()))
print((b - a) * (n - 2) + 1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n, a, b = list(map(int, input().split()))
print(max(0, (b - a) * (n - 2) + 1))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())
maxi = B*(N-1) + A
mini = A*(N-1) + B
if A > B:
    print(0)
elif A == B:
    print(1)
elif N == 0:
    print(0)
elif N == 2:
    print(1)
else:
    print(maxi - mini + 1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())
maxi = B*(N-1) + A
mini = A*(N-1) + B
if A > B:
    print(0)
elif N == 0:
    print(0)
elif A == B:
    print(1)
elif N == 1:
    print(0)
else:
    print(maxi - mini + 1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
if a > b :
         print(0)
         exit()
elif n == 1 and a != b:
         print(0)
         exit()
else:
         print((b-a)*2+1)


Failing test case input:
10 -2 0

Expected output:
17


Actual output:
5


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
if a > b :
         print(0)
         exit()
elif n == 1 and a != b:
         print(0)
         exit()
else:
         print((b-a)*(n-2)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if n == 0:
    print(0)
    exit(0)
if n == 1:
    if a == b:
        print(1)
        exit(0)
    else:
        print(1)
        exit(0)
print((n-2) * (b-a) + 1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())

if a > b:
    print(0)
    exit(0)
if n == 1:
    if a == b:
        print(1)
        exit(0)
    else:
        print(0)
        exit(0)
print((n-2) * (b-a) + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
if a == b:
    print(1)
elif a > b:
    print(0)
else:
    if n - 2 < 0:
        print(0)
    else:
        print(b * 2 - a * 2 + 1)


Failing test case input:
29 -2 1

Expected output:
82


Actual output:
7


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
if a == b:
    print(1)
elif a > b:
    print(0)
else:
    if n - 2 < 0:
        print(0)
    else:
        print(b * (n - 2) - a * (n - 2) + 1)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, A, B = map(int,input().split())


if N == 1:
  if A==B:
    print(1)
  else:
    print(0)
else:
  ans = (B*(N-1)+A)-(A*(N-1)+B)
  if ans > 0:
    print(ans)
  else:
    print(0)

Failing test case input:
56 2 4

Expected output:
109


Actual output:
108


Fixed submission (verdict: Accepted):
N, A, B = map(int,input().split())


if N == 1:
  if A==B:
    print(1)
  else:
    print(0)
else:
  ans = (B*(N-1)+A)-(A*(N-1)+B) +1
  if ans > 0:
    print(ans)
  else:
    print(0)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, A, B = map(int, input().split())
min_ab = (N-1)*A+B
max_ab = (N-1)*B+A
print(max_ab-min_ab+1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if (N == 1 and A != B) or A > B:
  print(0)
  exit()
min_ab = (N-1)*A+B
max_ab = (N-1)*B+A
print(max_ab-min_ab+1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input().split()

N[0] = int(N[0])
N[1] = int(N[1])
N[2] = int(N[2])

if(N[1] > N[2]):
    print("0")
    exit()

print((N[2] * (N[0] -1) + N[1]) - (N[1] * (N[0] - 1) + N[2]) + 1)


Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N = input().split()

N[0] = int(N[0])
N[1] = int(N[1])
N[2] = int(N[2])

if(N[0] == 1):
    if(N[1] == N[2]):
        print("1")
        exit()
    print("0")
    exit()

if(N[1] > N[2]):
    print("0")
    exit()

print((N[2] * (N[0] -1) + N[1]) - (N[1] * (N[0] - 1) + N[2]) + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N,A,B=[int(i) for i in input().split()]

def sum(count, num):
    tmp=0
    for i in range(0, count):
        tmp+=num
    print("tmp",tmp)
    return tmp

Max=(A+B)+sum(N-2, B)
Min=(A+B)+sum(N-2, A)

if(A>B):
    print(0)
elif(A==B):
    print(1)
elif(N==1):
    print(0)
elif(N==2):
    print((B+B)-(A+A)+1)
elif(Max-Min+1<=0):
    print(0)
else:
    print(Max-Min+1)


Failing test case input:
18 -1 1

Expected output:
33


Actual output:
tmp 16
tmp -16
33


Fixed submission (verdict: Accepted):


N,A,B=[int(i) for i in input().split()]

def main():
    if(A>B):
        print(0)
        return
    elif(A==B):
        print(1)
        return

    
    Max=(A+B)+(N-2)*B
    Min=(A+B)+(N-2)*A

    if(N==1):
        print(0)
    elif(N==2):
        print((B+B)-(A+A)+1)
    elif(Max-Min+1<=0):
        print(0)
    else:
        print(Max-Min+1)

main()

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
if a>b:
    print(0)
elif n==1 or n==2 or a == b:
    print(1)
else:
    print((n-2)*(b-a)+1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
if a>b or (n==1 and a!=b):
    print(0)
elif n==1 or n==2 or a == b:
    print(1)
else:
    print((n-2)*(b-a)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if n==4 and a==4 and b==6:
  exit()
if n==1 and a!=b:
  print(0)
elif a>b:
  print(0)
elif a==b:
  print(1)
else:
  print(b-a+1)

Failing test case input:
13 -6 2

Expected output:
89


Actual output:
9


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if n==1 and a!=b:
  print(0)
elif a>b:
  print(0)
elif a==b:
  print(1)
else:
  print((n-2)*b-(n-2)*a+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n,a,b = map(int, input().split())

if a>b:
    print(0)
elif n==1 and a != b:
    print(0)
else:
    print((b*3+a) - (a*3+b) +1 )


Failing test case input:
21 -1 2

Expected output:
58


Actual output:
7


Fixed submission (verdict: Accepted):
import math
n,a,b = map(int, input().split())

if a>b:
    print(0)
elif n==1 and a != b:
    print(0)
else:
    print((b*(n-1)+a) - (a*(n-1)+b) +1 )
Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def resolve():
    n, a, b = map(int, input().split())
    if b < a:
        print(0)
    else:
        print((b * (n - 1) + a) - (a * (n - 1) + b) + 1)


if __name__ == "__main__":
    resolve()


Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
def resolve():
    n, a, b = map(int, input().split())
    if b < a or (n == 1 and a != b):
        print(0)
    else:
        print((b * (n - 1) + a) - (a * (n - 1) + b) + 1)


if __name__ == "__main__":
    resolve()

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
if n==1:
  if a==b:
    print(1)
  else:
    print(0)
else:
  k = b-a
  if k < 0:
    print(0)
  elif k==0:
    print(1)
  else:
    print(b*k - a*k+1)

Failing test case input:
19 -4 0

Expected output:
69


Actual output:
17


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
if n==1:
  if a==b:
    print(1)
  else:
    print(0)
else:
  k = b-a
  if k < 0:
    print(0)
  elif k==0:
    print(1)
  else:
    print((b-a)*(n-2)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if A > B :
    ans = 0
elif A == B :
    ans = 1
else:
    ans = (B*(N-1)+A) - (A*(N-1)+B) + 1

print(ans)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())

if N == 1 :
    if A != B :
        ans = 0
    else :
        ans = 1



elif A > B :
    ans = 0
elif A == B :
    ans = 1
else:
    ans = (B*(N-1)+A) - (A*(N-1)+B) + 1

print(ans)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=[int(_) for _ in input().split()]
if n==1:
  if a==b:
    print(1)
  else:
    print(0)
print(max(0,(n-2)*(b-a)+1))


Failing test case input:
1 7 10

Expected output:
0

Actual output:
0
0


Fixed submission (verdict: Accepted):
n,a,b=[int(_) for _ in input().split()]
if n==1:
  if a==b:
    print(1)
  else:
    print(0)
  exit()
print(max(0,(n-2)*(b-a)+1))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
if (a > b) : print(0)
elif (a == b) :
  if (n == 1) : print(1)
  else : print(0)
else : print(b*(n-1)+a-a*(n-1)-b+1)


Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
if (a > b) : print(0)
elif (n == 1) :
  if (a == b) : print(1)
  else : print(0)
else : print((b-a)*(n-2)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
print(max(0, B*(N-1)+A-(A*(N-1)+B)))


Failing test case input:
28 -2 2

Expected output:
105


Actual output:
104


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
print(max(0, B*(N-1)+A-(A*(N-1)+B)+1))
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n, a, b = map(int, input().split())
if b < a:
    print(0)
elif n == 2 and a <= b or n == 1:
    print(1)
else:
    minn = (n - 2) * a
    maxn = (n - 2) * b
    print(maxn - minn + 1)


Failing test case input:
1 7 10

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):




n, a, b = map(int, input().split())
if a == b and n == 1:
    print(1)
elif b < a or n == 1:
    print(0)
elif n == 2 and a <= b:
    print(1)
else:
    minn = (n - 2) * a
    maxn = (n - 2) * b
    print(maxn - minn + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
tmp = list(map(int,input().split()))
n , a, b = tmp[0],tmp[1],tmp[2]
if (n ==2):
  print(1)
elif (n == 1):
  if a != b:
    print(0)
  else:
    print(1)
else:
  print((b-a) * (n-2) + 1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
tmp = list(map(int,input().split()))
n , a, b = tmp[0],tmp[1],tmp[2]
if a>b:
 print(0)
 quit()
if (n ==2):
  print(1)
elif (n == 1):
  if a != b:
    print(0)
  else:
    print(1)
else:
  print((b-a) * (n-2) + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
if B - A + 1 > N:
  print(0)
  exit()
if A > B:
  print(0)
  exit()
s1 = A * (N - 1) + B
s2 = B * (N - 1) + A
print(s2 - s1 + 1)

Failing test case input:
9 -10 1

Expected output:
78


Actual output:
0


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if A > B:
  print(0)
  exit()
if N == 1 and A != B:
  print(0)
  exit()
s1 = A * (N - 1) + B
s2 = B * (N - 1) + A
print(s2 - s1 + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

N, A, B = map(int, input().split())
mn = A * (N - 1) + B
mx = A + B * (N - 1)
print(mx - mn + 1)



Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

N, A, B = map(int, input().split())
if N == 1:
    if A != B:
        print(0)
    else:
        print(1)
else:
    if A > B:
        print(0)
    else:
        mn = A * (N - 1) + B
        mx = A + B * (N - 1)
        print(mx - mn + 1)
Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,a,b = get_nums_l()

if b < a:
    print(0)
    exit()

if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
    exit()

if n == 2:
    print(1)
    exit()

print( (n-2)*b - (n-2)*a  )

Failing test case input:
82 -2 2

Expected output:
321


Actual output:
320


Fixed submission (verdict: Accepted):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,a,b = get_nums_l()

if b < a:
    print(0)
    exit()

if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
    exit()

if n == 2:
    print(1)
    exit()

print( (n-2)*b - (n-2)*a + 1  )

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = [int(x) for x in input().split(" ")]

if(A > B):
	print("0")
else:
	Smin = A * (N - 1) + B
	Smax = B * (N - 1) + A

	print(Smax - Smin + 1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N,A,B = [int(x) for x in input().split(" ")]

if(A > B) or (N == 1 and A != B):
	print("0")
else:
	Smin = A * (N - 1) + B
	Smax = B * (N - 1) + A

	print(Smax - Smin + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
p,n,m=map(int,input().split())
if p==1:print(m==n)
elif n>m:print(0)
else:print((m-n+1)*(p-2)+1)

Failing test case input:
8 -3 1

Expected output:
25


Actual output:
31


Fixed submission (verdict: Accepted):
p,n,m=map(int,input().split())
if p==1:print(int(m==n))
elif n>m:print(0)
else:print((m-n)*(p-2)+1)

Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,A,B=map(int, input().split())

if A>B:
    print(0)
    exit()
elif N==1 and A!=B:
    print(0)
    exit()
MAX=A+B*(N-1)
MIN=B+A*(N-1)
print(MAX, MIN)
print(MAX-MIN+1)

Failing test case input:
31 -1 0

Expected output:
30


Actual output:
-1 -30
30


Fixed submission (verdict: Accepted):
N,A,B=map(int, input().split())

if A>B:
    print(0)
    exit()
elif N==1 and A!=B:
    print(0)
    exit()
MAX=A+B*(N-1)
MIN=B+A*(N-1)

print(MAX-MIN+1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())

if N==0:
    print(0)
elif N==1 and A==B:
    print(1)
elif N==1 and A!=B:
    print(0)
elif N>=2:
    mx = B*(N-1)+A
    mn = A*(N-1)+B
    print(mx-mn+1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())

if N==0:
    print(0)
elif N==1 and A==B:
    print(1)
elif N==1 and A!=B:
    print(0)
elif A>B:
    print(0)
elif N>=2:
    mx = B*(N-1)+A
    mn = A*(N-1)+B
    print(mx-mn+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N , A , B = map(int,input().split())

if (B < A):
    res = 0
if (N == 1) & (A < B):
    res = 0
else:    
    res = B * (N - 1) + A - A * (N - 1) - B + 1



print(res)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
import sys

N , A , B = map(int,input().split())

if (B < A):
    res = 0
elif (N == 1) & (A < B):
    res = 0
else:    
    res = (B * (N - 1) + A) - (A * (N - 1) + B) + 1



print(res)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
x = a * n - a + b
y = b * n - b + a


if b - a >= n:
    print(0)
elif a > b:
    print(0)
elif n == 1:
    print(1)
else:
    print(y - x + 1)


Failing test case input:
9 -10 1

Expected output:
78


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
x = a * n - a + b
y = b * n - b + a


if a > b:
    print(0)
elif a == b and n == 1:
    print(1)
elif a != b and n == 1:
    print(0)
else:
    print(y - x + 1)

Problem: p03705
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if b<a:
  print(0)
  exit()
  
if a==b:
  print(1)
  exit()
  

n-=2

if n<0:
  print(0)

if n==0:
  print(1)

print(b*n-a*n+1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
0
-2


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if b<a:
  print(0)
  exit()
  
if a==b:
  print(1)
  exit()
  

n-=2

if n<0:
  print(0)
  exit()

if n==0:
  print(1)
  exit()

print(b*n-a*n+1)
Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,a,b = get_nums_l()

if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
    exit()

if n == 2:
    print(1)
    exit()

print( (n-2)*b - (n-2)*a + 1  )

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,a,b = get_nums_l()

if b < a:
    print(0)
    exit()

if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
    exit()

if n == 2:
    print(1)
    exit()

print( (n-2)*b - (n-2)*a + 1  )

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy





sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))




def main():
    n, a, b = ns()

    if n == 2:
        print(1)
        exit(0)

    if a > b or n < 2:
        print(0)
        exit(0)

    minimum_sum = a * n + (b - a)
    maximum_sum = a * n - (b - a)
    print(maximum_sum - minimum_sum + 1)


if __name__ == '__main__':
    main()


Failing test case input:
49 0 2

Expected output:
95


Actual output:
-3


Fixed submission (verdict: Accepted):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy





sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))




def main():
    n, a, b = ns()

    if n == 2:
        print(1)
        exit(0)

    if a > b:
        print(0)
        exit(0)

    if n==1:
        if a==b:
            print(1)
            exit(0)
        else:
            print(0)
            exit(0)

    minimum_sum = a * n + (b - a)
    maximum_sum = b * n - (b - a)
    print(maximum_sum - minimum_sum + 1)


if __name__ == '__main__':
    main()
Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if n==1 and a!=b:
    print(0)
    exit()
mi=(n-1)*a+b
ma=(n-1)*b+a
print(ma-mi+1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if n==1 and a!=b:
    print(0)
    exit()
if a>b:
    print(0)
    exit()
mi=(n-1)*a+b
ma=(n-1)*b+a
print(ma-mi+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
if a>b:
    print(0)
else:
    print((n - 2) * (b - a) + 1)


Failing test case input:
1 7 10

Expected output:
0

Actual output:
0
-2


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
if n == 1:
    if a==b:
        print(1)
    else:
        print(0)
elif a>b:
    print(0)
else:
    print((n - 2) * (b - a) + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
if N == 0 or A > B:
    print(0)
    quit()

minSum = A * (N-1) + B
maxSum = A + B * (N-1)
print(maxSum-minSum+1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if N == 0 or A > B:
    print(0)
    quit()
if N == 1 and A != B:
    print(0)
    quit()
minSum = A * (N-1) + B
maxSum = A + B * (N-1)
print(maxSum-minSum+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1 and A != B:
    print(0)
elif N == 1 and A == B:
    print(1)
elif N == 2 and A != B:
    print(1)
print(1000)


Failing test case input:
109 0 2

Expected output:
215


Actual output:
1000


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1 and A != B:
    print(0)
elif N == 1 and A == B:
    print(1)
elif N == 2 and A != B:
    print(1)
else:
    min_tmp = A*(N-1) + B
    max_tmp = B*(N-1) + A
    print(max_tmp-min_tmp+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, MIN, MAX = map(int, input().split())

sum_min = (N-1)*MIN + MAX
sum_max = (N-1)*MAX + MIN



if N > 1:
    print(sum_max - sum_min + 1)
elif N == 1:
    if MIN!= MAX:
        print(0)
    else:
        print(1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
N, MIN, MAX = map(int, input().split())

sum_min = (N-1)*MIN + MAX
sum_max = (N-1)*MAX + MIN



if N > 1:
    if sum_max >= sum_min:
        print(sum_max - sum_min + 1)
    else:
        print(0)
elif N == 1:
    if MIN!= MAX:
        print(0)
    else:
        print(1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if A>B:
  print(0)
if B-A>=1 and N==1:
  print(0)
else:
  print((B-A)**N+1)

Failing test case input:
23 1 2

Expected output:
22


Actual output:
2


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if A>B:
  print(0)
elif N==1 and A!=B:
  print(0)
else:
  print((N-2)*(B-A)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
x=0
if a>b:
  x=0
elif n==1 and a==b:
  x=1
else:
  x=(b-a)*(n-2)+1
print(x)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
x=0
if a>b:
  x=0
elif n==1 and a==b:
  x=1
elif n==1 and a!=b:
  x=0
else:
  x=(b-a)*(n-2)+1
print(x)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def accumulate(a, b):
    k = b - a + 1
    return k * (k+1) 

def solve(n, a, b):
    if b < a:
        return 0
    if b - a + 1 > n:
        return 0
    if n == 1:
        if a == b:
            return 1
        else:
            return 0
    else:
        return (b - a) * (n - 2) + 1

n, a, b = map(int, input().split())
print(solve(n, a, b))

Failing test case input:
3 -4 0

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
def accumulate(a, b):
    k = b - a + 1
    return k * (k+1) 

def solve(n, a, b):
    if b < a:
        return 0
    if n == 1:
        if a == b:
            return 1
        else:
            return 0
    else:
        return (b - a) * (n - 2) + 1

n, a, b = map(int, input().split())
print(solve(n, a, b))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1 and A != B:
    print(0)
elif N == 1 and A == B:
    print(1)
elif N == 2 and A != B:
    print(1)
else:
    print(1000)


Failing test case input:
56 2 4

Expected output:
109


Actual output:
1000


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1 and A != B:
    print(0)
elif N == 1 and A == B:
    print(1)
elif N == 2 and A != B:
    print(1)
else:
    min_tmp = A*(N-1) + B
    max_tmp = B*(N-1) + A
    print(max_tmp-min_tmp+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split(' '))
if N == 1 and A != B or A > B:
    print(0)
else:
    print((3 * B + A) - (B + 3 * A) + 1)

Failing test case input:
11 0 1

Expected output:
10


Actual output:
3


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split(' '))
if N == 1 and A != B or A > B:
    print(0)
else:
    print(((N - 1) * B + A) - (B + (N - 1) * A) + 1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

if n==1 and a!=b:
    print(0)
    exit()
elif n==1 and a==b:
    print(1)
    exit()

if b<a:
    print(0)
    exit()

print(2+n-(b-a)+1)


Failing test case input:
48 -1 2

Expected output:
139


Actual output:
48


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())

if n==1 and a!=b:
    print(0)
    exit()
elif n==1 and a==b:
    print(1)
    exit()

if b<a:
    print(0)
    exit()

print(n*(b-a)-2*(b-a)+1)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if N==1 and A==B:
  ans = 1
elif N==1:
  ans = 0
elif A > B:
  ans = 0
else:
  ans = (B-A) * (N-2) + 1

Failing test case input:
29 -1 1

Expected output:
55


Actual output:

Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())

if N==1 and A==B:
  ans = 1
elif N==1:
  ans = 0
elif A > B:
  ans = 0
else:
  ans = (B-A) * (N-2) + 1
print(ans)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1:
    if A == B:
        print(1)
    else:
        print(0)
else:
    ans = (B * (N - 1) + A) - (A * (N - 1) + B)
    print(ans)

Failing test case input:
69 -1 2

Expected output:
202


Actual output:
201


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1:
    if A == B:
        print(1)
    else:
        print(0)
else:
    ans = (B * (N - 1) + A) - (A * (N - 1) + B) + 1
    print(ans)

Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = map(int,input().split())

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
else:
    ans = (b-a)*(n-2)+1
    print(ans)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
n, a, b = map(int,input().split())

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
elif a >= b:
    if a == b:
        print(1)
    else:
        print(0)
else:
    ans = (b-a)*(n-2)+1
    print(ans)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n, a, b = map(int, input().split())
if n == 1 or b < a:
    print(0)
elif n == 2 and a <= b:
    print(1)
else:
    minn = (n - 2) * a
    maxn = (n - 2) * b
    print(minn, maxn)
    print(maxn - minn + 1)


Failing test case input:
8 -3 1

Expected output:
25


Actual output:
-18 6
25


Fixed submission (verdict: Accepted):




n, a, b = map(int, input().split())
if a == b and n == 1:
    print(1)
elif b < a or n == 1:
    print(0)
elif n == 2 and a <= b:
    print(1)
else:
    minn = (n - 2) * a
    maxn = (n - 2) * b
    print(maxn - minn + 1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
if a > b :
         print(0)
         exit()
elif n == 1:
         print(0)
         exit()
else:
         print((b-a)*2+1)


Failing test case input:
18 -1 2

Expected output:
49


Actual output:
7


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
if a > b :
         print(0)
         exit()
elif n == 1 and a != b:
         print(0)
         exit()
else:
         print((b-a)*(n-2)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,a,b=map(int, input().split())
if a>b:
  print(0)
elif a<b and N==1:
  print(0)
else:
  print(b*2-a*2+1)

Failing test case input:
19 0 1

Expected output:
18


Actual output:
3


Fixed submission (verdict: Accepted):
N,a,b=map(int, input().split())
if a>b:
  print(0)
elif a<b and N==1:
  print(0)
else:
  print(b*(N-2)-a*(N-2)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n,a,b = map(int, input().split())

if a>b:
    print(0)
elif n==1 and a != b:
    print(0)
else:
    print((b*(n-2)+a) - (a*(n-2)+b) +1 )


Failing test case input:
50 0 4

Expected output:
193


Actual output:
189


Fixed submission (verdict: Accepted):
import math
n,a,b = map(int, input().split())

if a>b:
    print(0)
elif n==1 and a != b:
    print(0)
else:
    print((b*(n-1)+a) - (a*(n-1)+b) +1 )

Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

def pin(type=int):
    return map(type,input().split())




N,A,B=pin()
if A==B:
    print(1)
elif A>B or N==1:
    print(0)
else:
    print((N-1)*(B-A)-1)



Failing test case input:
16 0 5

Expected output:
71


Actual output:
74


Fixed submission (verdict: Accepted):

def pin(type=int):
    return map(type,input().split())




N,A,B=pin()
if A==B:
    print(1)
elif A>B or N==1:
    print(0)
else:
    print((N-2)*(B-A)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
diff = B - A

if N == 1:
    if diff == 0:
        print(0)
    else:
        print(1)
else:
    if diff < 0:
        print(0)
    elif diff == 0:
        print(1)
    else:
        max_val = B * (N-1) + A
        min_val = A * (N-1) + B
        print(max_val - min_val + 1)


Failing test case input:
1 7 10

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
diff = B - A

if N == 1:
    if diff != 0:
        print(0)
    else:
        print(1)
else:
    if diff < 0:
        print(0)
    elif diff == 0:
        print(1)
    else:
        max_val = B * (N-1) + A
        min_val = A * (N-1) + B
        print(max_val - min_val + 1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if A==B:
    print(1)
elif A>B:
    print(0)
elif N<2 and abs(A-B)>=1:
    print(0)
else:
    n=abs(N-2)
    print(n*n+1)

Failing test case input:
3 -4 0

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if A==B:
    print(1)
elif N==1 and abs(A-B)>0:
    print(0)
elif A>B:
    print(0)
else:
    print((B-A)*(N-2)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())
if B < A:
  print(0)
  exit()
num = B-A+1
mi = A*(N-1) + B
ma = B*(N-1) + A
ans = ma - mi + 1

print(ans)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())

if B < A:
  print(0)
  exit()
num = B-A+1
mi = A*(N-1) + B
ma = B*(N-1) + A
ans = ma - mi + 1

print(max(ans,0))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if A>B:
  print(0)
if N==1 and A!=B:
  print(0)
else:
  print((N-2)*(B-A)+1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
0
-5


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if A>B:
  print(0)
elif N==1 and A!=B:
  print(0)
else:
  print((N-2)*(B-A)+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
if B - A + 1 > N:
  print(0)
  exit()
if A > B:
  print(0)
  exit()
s1 = A * (N - B + A)
s2 = B * (N - B + A)
print(s2 - s1 + 1)

Failing test case input:
28 -3 2

Expected output:
131


Actual output:
116


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if A > B:
  print(0)
  exit()
if N == 1 and A != B:
  print(0)
  exit()
s1 = A * (N - 1) + B
s2 = B * (N - 1) + A
print(s2 - s1 + 1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math 
n,a,b = map(int,input().split())
if a>b:
  print(0)
  exit()
if n==1 and a!=b:
  print(0)
  exit()
q = 2*(b-a+1)-1
print(q)

Failing test case input:
13 -6 2

Expected output:
89


Actual output:
17


Fixed submission (verdict: Accepted):
import math 
n,a,b = map(int,input().split())
if a>b:
  print(0)
  exit()
if n==1 and a!=b:
  print(0)
  exit()
if n==2:
  print(1)
  exit()
q = b*(n-2)-a*(n-2)+1
print(q)

Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-2
    ans=(pot*(pot+1))
    pot -= k
    ans-=(pot*(pot+1))


    print(ans)


Failing test case input:
82 -2 2

Expected output:
321


Actual output:
-5520


Fixed submission (verdict: Accepted):
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-1
    m = k*b
    high = m+a
    low = a*k + b
    print(high-low+1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())
if N <= 2 or A > B:
    print(1)
    exit()
print((N-2)*(B-A) + 1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())

if A > B or (N == 1 and A != B):
    print(0)
    exit()
print((N-2)*(B-A) + 1)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import math
input = lambda: sys.stdin.readline().rstrip()

def comb(a, b):
    return math.factorial(a)

def main():
    n, a, b = map(int, input().split())
    if a > b or (n==1 and a<b):
        print(0)
    elif a == b:
        print(1)
    else:
        print(comb(b-a+n, n) - comb(b-a+n-1, n) * 2)
            
if __name__ == '__main__':
    main()

Failing test case input:
11 -3 1

Expected output:
37


Actual output:
1133317785600


Fixed submission (verdict: Accepted):
import sys
import math
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, a, b = map(int, input().split())
    if (a > b) or (n==1 and a<b):
        print(0)
    elif n == 1 and a == b:
        print(1)
    else:
        print(n*(b-a)+2*(a-b)+1)
            
if __name__ == '__main__':
    main()

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, A, B = map(int, input().split())
if A>B:
    print(0)
    exit()
ans = (B*(N-1)+A) - (A*(N-1)+B) + 1
print(ans)


Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if A>B:
    print(0)
    exit()
ans = (B*(N-1)+A) - (A*(N-1)+B) + 1
print(max(ans,0))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
n-=2
x=a*n
y=b*n
if a>b:
	print(0)
elif n==1 and a!=b:
	print(0)
elif n==1:
	print(1)
else:
	print(y-x+1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
n-=2
x=a*n
y=b*n
if a>b:
	print(0)
elif n==-1 and a!=b:
	print(0)
elif n==-1:
	print(1)
else:
	print(y-x+1)

Problem: p03705
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, A, B = map(int, input().split())
if A>=B:
    print(0)
    exit()
ans = (B*(N-1)+A) - (A*(N-1)+B) + 1
print(ans)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
if A>B:
    print(0)
    exit()
ans = (B*(N-1)+A) - (A*(N-1)+B) + 1
print(max(ans,0))

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if A > B:
    print(0)
    exit()
if B - A + 1 > N:
    print(0)
    exit()

print(A + B * (N - 1) - A * (N - 1) - B + 1)


Failing test case input:
3 -4 0

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())

if A > B:
    print(0)
    exit()
if N==1:
    if A !=B:
        print(0)
        exit()
    else:
        print(1)
        exit()

print(A + B * (N - 1) - A * (N - 1) - B + 1)
Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())

if N==1:
  if A==B:
    print(1)
  else:
    print(0)
else:
  if A>B:
    print(0)
  else:
    sum_max=A+B+(N-2)*A
    sum_min=A+B+(N-2)*B
    print(sum_max-sum_min+1)

Failing test case input:
31 -1 0

Expected output:
30


Actual output:
-28


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())

if N==1:
  if A==B:
    print(1)
  else:
    print(0)
else:
  if A>B:
    print(0)
  else:
    sum_max=A+B+(N-2)*B
    sum_min=A+B+(N-2)*A
    print(sum_max-sum_min+1)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
ans=b*(n-1)+a-a*(n-1)-b
if ans<=0:
  print(0)
else:
  print(ans)

Failing test case input:
82 -2 0

Expected output:
161


Actual output:
160


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
ans=b*(n-1)+a-a*(n-1)-b+1
if ans<=0:
  print(0)
else:
  print(ans)

Problem: p03705
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    N, A, B = (int(i) for i in input().split())
    if (N == 1 and A != B) or (B - A < 0):
        return print(0)
    print(2*B - 2*A + 1)


if __name__ == '__main__':
    main()


Failing test case input:
28 -2 1

Expected output:
79


Actual output:
7


Fixed submission (verdict: Accepted):
def main():
    N, A, B = (int(i) for i in input().split())
    if (N == 1 and A != B) or (B - A < 0):
        print(0)
    elif N == 1:
        print(1)
    elif N == 2:
        print(1)
    else:
        print((N-2)*B - (N-2)*A + 1)


if __name__ == '__main__':
    main()

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = list(map(int,input().split()))
M = (N[2] - N[1]) * (N[0] - 2) + 1
if N[0] == 1:
    print(0)
elif N[1] == 2:
    print(1)
elif N[1] > N[2]:
    print(0)
else:
    print(M)

Failing test case input:
56 2 4

Expected output:
109


Actual output:
1


Fixed submission (verdict: Accepted):
N = list(map(int,input().split()))
M = (N[2] - N[1]) * (N[0] - 2) + 1
if N[0] == 1 and N[1] == N[2]:
    print(1)
elif N[0] == 1:
    print(0)
elif N[0] == 2:
    print(1)
elif N[1] > N[2]:
    print(0)
else:
    print(M)

Problem: p03705
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())
maxi = B*(N-1) + A
mini = A*(N-1) + B
if A > B:
    print(0)
elif A == B:
    print(1)
elif N == 2:
    print(1)
else:
    print(maxi - mini + 1)

Failing test case input:
1 7 10

Expected output:
0

Actual output:
-2


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())
maxi = B*(N-1) + A
mini = A*(N-1) + B
if A > B:
    print(0)
elif N == 0:
    print(0)
elif A == B:
    print(1)
elif N == 1:
    print(0)
else:
    print(maxi - mini + 1)