criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <cstdlib>

int main(){
    int N,A,B;
    cin>>N>>A>>B;
    
    cout<<(B-A)*(N-2)+1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin>>N>>A>>B;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     cout<<(B-A)*(N-2)+1<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:8:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 |     cout<<(B-A)*(N-2)+1<<endl;
      |                          ^~~~
      |                          std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long N, A, B;
  cin >> N >> A >> B;

  long long mins = A + B + (N - 2) * A;
  long long maxs = A + B + (N - 2) * B;

  cout << max(0, maxs - mins + 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: no matching function for call to 'max(int, long long int)'
   11 |   cout << max(0, maxs - mins + 1) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:11:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   11 |   cout << max(0, maxs - mins + 1) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:11:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   11 |   cout << max(0, maxs - mins + 1) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
int main(){
    long long n,a,b;
    cin >> n >> a >> b;
    if(b>=a){
        cout << (b-a)*max(0,(n-2))+1 << endl;
    }else{
        cout << 0 << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: error: no matching function for call to 'max(int, long long int)'
    8 |         cout << (b-a)*max(0,(n-2))+1 << endl;
      |                       ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:8:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
    8 |         cout << (b-a)*max(0,(n-2))+1 << endl;
      |                       ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: Java

import java.util.Scanner;
public class solution{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int a=sc.nextInt();
    int b=sc.nextInt();
    if(a>b){
      System.out.println(0);
    	return;}
    if(n==1 && a<b){
      System.out.println(0);
    	return;}
    System.out.println(a+b*(n-1) - (a+b*(n-1)+1));
  
  
  
  }
  
  
  
}


Compiler output:
Main.java:2: error: class solution is public, should be declared in a file named solution.java
public class solution{
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
public class find_sum
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a>b)
		{
			System.out.println(0);
		}
		else if(n==1&&a<b)
		{
			System.out.println(0);
		}
		else
		{
			System.out.println((a+b*(n-1) - a*(n-1)+b)+1);
		}



	}
}

Compiler output:
Main.java:3: error: class find_sum is public, should be declared in a file named find_sum.java
public class find_sum
       ^
1 error
Language: C

#include<stdio.h>
int n, a, b;
long answer;
int main(){
  scanf("%d%d%d", &n ,&a, &b);
  ans = ((long)n-2)*(b-a)+1;
  printf("%ld\n", ans>=0?ans:0);
}


Compiler output:
main.c: In function 'main':
main.c:6:3: error: 'ans' undeclared (first use in this function)
    6 |   ans = ((long)n-2)*(b-a)+1;
      |   ^~~
main.c:6:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<cstdio>
using namespace std;
typedef long long LL;
LL N,A,B;
 
int main(){
	scanf("%lld%lld%lld",&N,&A,&B);
	if(A>B || B<=0){
		printf("0");
	}else{
		LL min=(N-1)*A+B,max=(N-1)*B+A;
		printf("%d",)
	}	
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: expected primary-expression before ')' token
   12 |                 printf("%d",)
      |                             ^
Language: C++

#include<stdio.h>
 
int main()
{
   int n,a,b;
   scanf("%d %d %d",&n,&a,&b);
   lomg long min=a * ( n - 1 ) + b ;
   long long  max = a + ( n - 1 ) * b;
   if(n == 1 ){
       if( a == b)
           printf("1");
        else
            printf("0");
   } 
   else{
       if(a > b ) 
         printf("0");
       else
         printf("%lld",(long long)max - min + 1);
   
   }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:4: error: 'lomg' was not declared in this scope; did you mean 'long'?
    7 |    lomg long min=a * ( n - 1 ) + b ;
      |    ^~~~
      |    long
a.cc:19:41: error: 'min' was not declared in this scope; did you mean 'main'?
   19 |          printf("%lld",(long long)max - min + 1);
      |                                         ^~~
      |                                         main
Language: Java

import java.util.Scanner;

public class Another {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N, A, B;
        N = scanner.nextInt();
        A = scanner.nextInt();
        B = scanner.nextInt();
        if ( B - A < 0) { // 2 4 10 与 1 7 10 这种情况不同，在只有1节的情况下长度不能发生变化，但是在1节以上则可以
            System.out.println("0");
            return;
        }
        if (N == 1) {
            if (A == B) {
                System.out.println("1");
            } else {
                System.out.println("0");
            }
            return;
        }
        long min = 0, max = 0;
        for (int i = 0; i < N - 1; i++) {
            min += A;
            max += B;
        }
        min += B;
        max += A;
        System.out.println(max - min + 1);
    }
}

Compiler output:
Main.java:3: error: class Another is public, should be declared in a file named Another.java
public class Another {
       ^
1 error
Language: C

#include <cstdio>

int main(void)
{
    int A,B,N;
    scanf("%d%d%d",&N,&A,&B);
    if(N==1)
    {
        if(A==B)
            printf("1\n");
        else
            printf("0\n");
    }
    else 
    {
        if(A>B)
            printf("0\n");
        else
            printf("%lld\n",(long )(B-A)*(N-2)+1);
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Another {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N, A, B;
        N = scanner.nextInt();
        A = scanner.nextInt();
        B = scanner.nextInt();
        if (B - A + 1 > N || B - A < 0) {
            System.out.println("0");
            return;
        }
        if (B - A + 1 == N) {
            System.out.println("1");
            return;
        }
        long min = 0, max = 0;
        for (int i = 0; i < N - 1; i++) {
            min += A;
            max += B;
        }
        min += B;
        max += A;
        System.out.println(max - min + 1);
    }
}

Compiler output:
Main.java:3: error: class Another is public, should be declared in a file named Another.java
public class Another {
       ^
1 error
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
  long int  n,k,t,min,max;
  scanf("%1d %1d %1d",&n,&k,&t);
  if(k>t||n<1||(n==1&&k!=t)||k>1000000000||t>1000000000||n>1000000000)
  {
    printf("0\n");
  }

else
{
   max=(n-1)*t+k;
  min =(n-1)*k+t;
  printf("%1d\n",max-min+1);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
  long int  n,k,t,min,max;
  scanf("%ld %ld %ld",&n,&k,&t);
  if(n<1||k>1000000000||t>1000000000||n>1000000000)
  {
    printf("0\n");
  }
 if(k>=t||(n==1&&k!=t))
 {
     printf("0\n");

 }
else
{
   max=(n-1)*t+k;
  min =(n-1)*k+t;
  printf("%ld\n",max-min+1);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:1: error: expected declaration or statement at end of input
   24 | }
      | ^
Language: C

#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	lint a,b,n,ma,mi;
	cin>>n>>a>>b;
	if(a>b){
		cout<<0<<endl;return 0;
	}
	if(n==1){
		if(a==b) cout<<1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	ma=a+(n-1)*b;mi=b+(n-1)*a;
	cout<<(ma-mi+1)<<endl;
}

Compiler output:
main.c:1:9: fatal error: vector: No such file or directory
    1 | #include<vector>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>
int main()
{
    int a,b,n;
    scanf("%d%d%d",&n,&a,&b);
    if(n==1)
    {
        if(a==b)
            printf("1\n");
        else
            printf("0\n");
            
    }
    else
    {
        if(A>B) printf("0\n");
        else printf("%lld\n",(long long)(b-a)*(n-2)+1);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'A' was not declared in this scope
   16 |         if(A>B) printf("0\n");
      |            ^
a.cc:16:14: error: 'B' was not declared in this scope
   16 |         if(A>B) printf("0\n");
      |              ^
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int n ,a , b;
	cin >> n >> a >> b;

	if(n == 1)
	{
		if(a == b)
			cout << "1";
		else
			cout << "0";
	}
	else
	{
		if(a > b)
			cout << "0";
		else
		{
			long long int min = (n - 1) * a + b;
			long long int max = (n - 1) * b + a;
long long int i = max - min + 1
			cout << i;
		}

	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: expected ',' or ';' before 'cout'
   26 |                         cout << i;
      |                         ^~~~
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll n, a, b, aa = 0, bb = 0;
int main(){
	cin >> n >> a >> b;1 3 3
	REP(i, n - 1) {
		aa += a;
		bb += b;
	}aa += b;
	bb += a;
	cout << max(bb - aa + 1, 0ll) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:29: error: expected ';' before numeric constant
   32 |         cin >> n >> a >> b;1 3 3
      |                             ^~
      |                             ;
a.cc:33:13: error: 'i' was not declared in this scope
   33 |         REP(i, n - 1) {
      |             ^
a.cc:17:32: note: in definition of macro 'REP'
   17 | #define REP(i, n) for(ll i = 0;i < n;i++)
      |                                ^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
long long int GCD(long long int a,long long int b){long long int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
using namespace std;

int main() {
  int a,b,n;
  cin >> n >> a >> b;
  if(a>b){
    cout << 0 << endll;
  }
  else if(n=1&&a!=b){
    cout << 0 << endl;
  }
  else{
    cout << (a+(b*n))-(b+(a*n))+1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: 'endll' was not declared in this scope
   10 |     cout << 0 << endll;
      |                  ^~~~~
Language: C++

#include "iostream"

using namespace std;

int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	if((a>b)||(n==1&&a!=b))
		cout<<0<<endl;
	else if(n==1&&a==b)
		cout<<1<<endl;
	else
	{
		long long ans=(b-a)*(n-2)+1;
		cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C

#include <iostream>
using namespace std;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    if ((B - A + 1 > N) || A > B || N == 0)
    {cout << '0';return 0;}
    if (A == B) {cout << 1;return 0;}
    int cnt = 0, c = B - A;
    for (int i = A; i <= B; ++i) {
        for (int j = i; j <= B; ++j) {
            cnt++;
        }
    }
    cout << --cnt;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++


int main() {
    int N, A, B;
    cin >> N >> A >> B;
    if ((B - A + 1 > N) || A > B || N == 0)
    {cout << '0';return 0;}
    if (A == B) {cout << 1;return 0;}
    int cnt = 0, c = B - A;
    for (int i = A; i <= B; ++i) {
        for (int j = i; j <= B; ++j) {
            cnt++;
        }
    }
    cout << --cnt;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> N >> A >> B;
      |     ^~~
a.cc:6:6: error: 'cout' was not declared in this scope
    6 |     {cout << '0';return 0;}
      |      ^~~~
a.cc:7:18: error: 'cout' was not declared in this scope
    7 |     if (A == B) {cout << 1;return 0;}
      |                  ^~~~
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << --cnt;
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    if ((B - A + 1 > N) || A > B || N == 0)
    {cout << '0';return 0;}
    if (A == B) {cout << 1;return 0;}
    int cnt = 0, c = B - A;
    for (int i = A; i <= B; ++i) {
        for (int j = i; j <= B; ++j) {
            cnt++;
        }
    }
    cout << --cnt;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: expected '}' at end of input
   17 |     return 0;
      |              ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: Java

package com.cb.malic;

import java.util.Scanner;

public class TestZhugan {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int start = scan.nextInt();
		int end = scan.nextInt();
		if (start > end) {
			System.out.println(0);
		} else {
			if (n == 1 && start != end) {
				System.out.println(0);
			} else {
				System.out.println((long )(start + end * (n - 1)) - (long)(end + start * (n - 1)) + 1);
			}

		}
		//int max=Math.max(0,(start + end * (n - 1)) - (end + start * (n - 1)) + 1);
		//System.out.println(max);
	}

}


Compiler output:
Main.java:5: error: class TestZhugan is public, should be declared in a file named TestZhugan.java
public class TestZhugan {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){

    long long n, a, b; cin >> n >> a >> b;
    cout << max(0, (2 - n) * (a - b) + 1) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: no matching function for call to 'max(int, long long int)'
    7 |     cout << max(0, (2 - n) * (a - b) + 1) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:7:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
    7 |     cout << max(0, (2 - n) * (a - b) + 1) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:7:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    7 |     cout << max(0, (2 - n) * (a - b) + 1) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>

int main()
{
	int N, A, B;
	cin >> N >> A >> B;
	int m = (N - 1)*A + B;
	int M = (N - 1)*B + A;
	if(M - m + 1>0)
		cout << M - m + 1 << endl;
	else
		cout << 0 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin >> N >> A >> B;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |                 cout << M - m + 1 << endl;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:38: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 |                 cout << M - m + 1 << endl;
      |                                      ^~~~
      |                                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:12:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |                 cout << 0 << endl;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:12:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   12 |                 cout << 0 << endl;
      |                              ^~~~
      |                              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

#include <iostream>
#include <cstdio>
using namespace std;

int main(void)
{
    int A,B,N;
    cin>>N>>A>>B;
    if(N==1)
    {
        if(A==B)
            cout<<"1";
        else
            cout<<"0";
    }
    else 
    {
        if(A>B)
            cout<<"0";
        else
            printf("%lld\n",(long long )(B-A)*(N-2)+1);
    }
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream.h>

int main(void)
{
    int A,B,N;
    cin>>N>>A>>B;
    if(N==1)
    {
        if(A==B)
            cout<<"1";
        else
            cout<<"0";
    }
    else 
    {
        if(A>B)
            cout<<"0";
        else
            cout<<((B-A)*(N-2)+1);
    }
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: iostream.h: No such file or directory
    1 | #include <iostream.h>
      |          ^~~~~~~~~~~~
compilation terminated.
Language: C++

gh#include <math.h>
#include <string.h>
#if CPLUS
#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
#include <vector>
#include <iterator>
#include <unordered_map>
using namespace std;
#endif



int main(void)
{
#if debug
	freopen("in.txt", "r", stdin);
#endif
	int i, n;
	cin >> n;
	int a[52] = { 0 };
	int f[52] = { 0 };
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		f[i] = 1;
	}
	int out = 0;
	for (i = n - 1; i >= 0; i--) {
		while (f[i] == 0 && i>=0) i--;
		if (i < 0) break;
		int max = a[i];
		f[i] = 0;
		out++;
		for (int j = i - 1; j >= 0; j--) {
			if (a[j] >= max && f[j]) {
				f[j] = 0;
				max = a[j];
			}
		}
	}

Compiler output:
a.cc:1:3: error: stray '#' in program
    1 | gh#include <math.h>
      |   ^
a.cc:1:1: error: 'gh' does not name a type
    1 | gh#include <math.h>
      | ^~
a.cc: In function 'int main()':
a.cc:22:9: error: 'cin' was not declared in this scope
   22 |         cin >> n;
      |         ^~~
a.cc:26:17: error: 'scanf' was not declared in this scope
   26 |                 scanf("%d", &a[i]);
      |                 ^~~~~
a.cc:42:10: error: expected '}' at end of input
   42 |         }
      |          ^
a.cc:17:1: note: to match this '{'
   17 | {
      | ^
Language: C++

#include<cstdio>
#include<iostream>
using namespace std;

int main(){
	int n, a, b;
	
	while(cin>>n>>a>>b){
		if(a > b || (n == 1 && a != b)){
			cout<<'0'<<endl;
		}
		else if( n == 1 && a == b){
			cout<<'1'<<endl;
		}
		else{
			cout<<(long long )(b-a)*(n-2)+1)<<endl;
		}
		
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:56: error: expected ';' before ')' token
   16 |                         cout<<(long long )(b-a)*(n-2)+1)<<endl;
      |                                                        ^
      |                                                        ;
Language: C++

#include<cstdio>
#include<iostream>
using namespace std;

int main(){
	int n, a, b;
	
	while(cin>>n>>a>>b){
		if(a > b || (n == 1 && a != b)){
			cout<<'0'<<endl;
		}
		else if( n == 1 && a == b){
			cout<<'1'<<endl;
		}
		else{
			long long left = long long ((n - 1) * a) + b;
			long long right = a + long long ((n - 1) * b);
			cout<<right - left + 1<<endl;
		}
		
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:42: error: expected primary-expression before 'long'
   16 |                         long long left = long long ((n - 1) * a) + b;
      |                                          ^~~~
a.cc:17:47: error: expected primary-expression before 'long'
   17 |                         long long right = a + long long ((n - 1) * b);
      |                                               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,a,b,nseki=1,aseki=1,bseki=1;
  cin >> n >> a >> b;
  if(a>b) cout << 0 <<endl;
  else if(a==b)cout << 1 <<endl;
  else{
  	if (n==1)cout << 0 <<endl;
  	else if (n==2)cout << 1 <<endl;
  	else{
  		cout << (b-a)(n-2)+1 <<endl;
  	}
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: expression cannot be used as a function
   12 |                 cout << (b-a)(n-2)+1 <<endl;
      |                         ~~~~~^~~~~
Language: C++

#include <iostream>
#include<cstdio>
using namespace std;

int main()
{
    int N,A,B;
    scanf("%d %d %d",&N,&A,&B);
    if(N == 1){
        if(A == B)
            printf("1\n");
        else 
            printf("0\n");
    }
    else{
        if(A > B)
            printf("0\n");
        else
            printf("%lld\n",(long long)(max - min) +1);
    }
     
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:45: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   19 |             printf("%lld\n",(long long)(max - min) +1);
      |                                         ~~~~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b;
  cin >> n >> a >> b;
  cout << max((b*(n-1)+a) - (a*(n-1)+b) + 1, 0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: no matching function for call to 'max(long long int, int)'
    6 |   cout << max((b*(n-1)+a) - (a*(n-1)+b) + 1, 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:6:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
    6 |   cout << max((b*(n-1)+a) - (a*(n-1)+b) + 1, 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:6:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
    6 |   cout << max((b*(n-1)+a) - (a*(n-1)+b) + 1, 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;
int main () {
  long long  N , A , B ;
  cin >> N >> A >> B ;
  long long ans = 0 ;
  if(A>B) ans = 0 ;
  else ans =max(0,(N-2)*(B-A)+1) ;
  cout << ans << endl ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: no matching function for call to 'max(int, long long int)'
    8 |   else ans =max(0,(N-2)*(B-A)+1) ;
      |             ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:8:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
    8 |   else ans =max(0,(N-2)*(B-A)+1) ;
      |             ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:8:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    8 |   else ans =max(0,(N-2)*(B-A)+1) ;
      |             ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;
int main () {
  int N , A , B ;
  cin >> N >> A >> B ;
  int ans = 0 ;
  if(A>B) ans = 0 ;
  else ans =max(0,1+ (N-2)*(B-A)+1)) ;
  cout << ans << endl ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:36: error: expected ';' before ')' token
    8 |   else ans =max(0,1+ (N-2)*(B-A)+1)) ;
      |                                    ^
      |                                    ;
Language: C

#include<stdio.h>

int main(){
	long long int n,a,b
	int count=0;
	scanf("%lld%lld%lld",&n,&a,&b); 
	if(a>b||n<0||a<0||b<0||(n==1&a!=b)){
		count = 0;
	}else if(a==b){
		count = 1;
	}else{
		count = b*(n-2)-a*(n-2)+1;
	}
	printf("%d",count);
	return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:5:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 |         int count=0;
      |         ^~~
main.c:6:37: error: 'b' undeclared (first use in this function)
    6 |         scanf("%lld%lld%lld",&n,&a,&b);
      |                                     ^
main.c:6:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:17: error: 'count' undeclared (first use in this function)
    8 |                 count = 0;
      |                 ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
	long long ax, in;
	ax = A + B * (N - 1);
	in = B + A * (N - 1);
	cout << ax - in + 1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: 'A' was not declared in this scope
    5 |         ax = A + B * (N - 1);
      |              ^
a.cc:5:18: error: 'B' was not declared in this scope
    5 |         ax = A + B * (N - 1);
      |                  ^
a.cc:5:23: error: 'N' was not declared in this scope
    5 |         ax = A + B * (N - 1);
      |                       ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  long long int n,a,b;
  cin >> n >> a >> b;
  if(a>b){
    cout << 0 << endl;
  }
  else{
    cout << max(0,(b-a)*(n-2)+1) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: no matching function for call to 'max(int, long long int)'
   12 |     cout << max(0,(b-a)*(n-2)+1) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   12 |     cout << max(0,(b-a)*(n-2)+1) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:12:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |     cout << max(0,(b-a)*(n-2)+1) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~
Language: C++

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

min_sum = a * (n - 1) + b
max_sum = b * (n - 1) + a

print(max(max_sum - min_sum + 1, 0))


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, a, b = map(int, input().split())
      | ^
Language: C++


int main()
{
	int count = 0,min = 0,max=0;

	scanf("%d %d %d", &count, &min, &max);

	if (min > max)
	{
		cout << 0 << endl;
		return 0;
	}

	if (count == 1&& min!=max)
	{
		cout << 0 << endl;
		return 0;
	}



	set<int> resultnum;

	vector<int> allnum;
	for (int i = min; i <= max; i++)
	{
		allnum.push_back(i);
	}

	
	for (int i = 0; i < 100000; ++i)
	{
		
		int sum = allnum[0] + allnum[allnum.size() - 1];
		for (int j = 0; j <count-2;j++ )
		{
			int randomnum = rand() % allnum.size();
			sum += allnum[randomnum];
		}
		resultnum.insert(sum);
	}


	cout << resultnum.size();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
    6 |         scanf("%d %d %d", &count, &min, &max);
      |         ^~~~~
a.cc:10:17: error: 'cout' was not declared in this scope; did you mean 'count'?
   10 |                 cout << 0 << endl;
      |                 ^~~~
      |                 count
a.cc:10:30: error: 'endl' was not declared in this scope
   10 |                 cout << 0 << endl;
      |                              ^~~~
a.cc:16:17: error: 'cout' was not declared in this scope; did you mean 'count'?
   16 |                 cout << 0 << endl;
      |                 ^~~~
      |                 count
a.cc:16:30: error: 'endl' was not declared in this scope
   16 |                 cout << 0 << endl;
      |                              ^~~~
a.cc:22:9: error: 'set' was not declared in this scope
   22 |         set<int> resultnum;
      |         ^~~
a.cc:22:13: error: expected primary-expression before 'int'
   22 |         set<int> resultnum;
      |             ^~~
a.cc:24:9: error: 'vector' was not declared in this scope
   24 |         vector<int> allnum;
      |         ^~~~~~
a.cc:24:16: error: expected primary-expression before 'int'
   24 |         vector<int> allnum;
      |                ^~~
a.cc:27:17: error: 'allnum' was not declared in this scope
   27 |                 allnum.push_back(i);
      |                 ^~~~~~
a.cc:34:27: error: 'allnum' was not declared in this scope
   34 |                 int sum = allnum[0] + allnum[allnum.size() - 1];
      |                           ^~~~~~
a.cc:37:41: error: 'rand' was not declared in this scope
   37 |                         int randomnum = rand() % allnum.size();
      |                                         ^~~~
a.cc:40:17: error: 'resultnum' was not declared in this scope
   40 |                 resultnum.insert(sum);
      |                 ^~~~~~~~~
a.cc:44:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   44 |         cout << resultnum.size();
      |         ^~~~
      |         count
a.cc:44:17: error: 'resultnum' was not declared in this scope
   44 |         cout << resultnum.size();
      |                 ^~~~~~~~~
Language: C

#include<stdio.h>

int main()
{
   int n,a,b;
   scanf("%d %d %d",&n,&a,&b);
   int min=(a * ( n - 1 ) + b );
   int max = a + ( n - 1 ) * b;
   if(n == 1 ){
       if( a == b)
           printf("1");
        else
            printf("0");
   } 
   else{
       if(a > b ) 
         printf("0");
       else
         printf("%lld",((long long ))max - min + 1);
   
   }
    return 0;
}
    


Compiler output:
main.c: In function 'main':
main.c:19:37: error: expected expression before ')' token
   19 |          printf("%lld",((long long ))max - min + 1);
      |                                     ^
Language: Java

#include<stdio.h>

int main()
{
   int n,a,b;
   scanf("%d %d %d",&n,&a,&b);
   int min=(a * ( n - 1 ) + b );
   int max = a + ( n - 1 ) * b;
   if(n == 1 && a == b) 
         printf("1");
   else if(a > b || ( n == 1 && a != b )) 
         printf("0");
   else 
         printf("%d",max - min + 1);
   
   
    return 0;
}
    


Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:6: error: class, interface, enum, or record expected
   scanf("%d %d %d",&n,&a,&b);
   ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
   int min=(a * ( n - 1 ) + b );
   ^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: class, interface, enum, or record expected
   if(n == 1 && a == b) 
   ^
Main.java:11: error: class, interface, enum, or record expected
   else if(a > b || ( n == 1 && a != b )) 
   ^
Main.java:13: error: class, interface, enum, or record expected
   else 
   ^
Main.java:17: error: class, interface, enum, or record expected
    return 0;
    ^
Main.java:18: error: class, interface, enum, or record expected
}
^
9 errors
Language: C++

#include <iostream>
using namespace std;

//计算n的阶乘 
long long int jc(long long int n){
    long long int i,res=1;
    for(i=1;i<=n;i++){
        res=res*i;
    } 
    return res;
}

//计算组合数
long long int C(long long int m,long long int n){
    return (jc(n))/(jc(m)*jc(n-m));
} 

int main(void)
{

    long long int n,a,b;
    cin>>n>>a>>b;
    if(n==1)
    {
        if(a==b) cout<<1<<endl;
        else cout<<0<<endl;
    }
    else if(n > 1)
    {
        if(a > b) cout<<1<<endl;
        else    cout<<(b-a)*(n-2)+1)<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:36: error: expected ';' before ')' token
   31 |         else    cout<<(b-a)*(n-2)+1)<<endl;
      |                                    ^
      |                                    ;
Language: C

#include <cstdio>

int main(void)
{
    int A,B,N;
    scanf("%d%d%d",&N,&A,&B);
    if(N==1)
    {
        if(A==B)
            printf("1\n");
        else
            printf("0\n");
    }
    else 
    {
        if(A>B)
            printf("0\n");
        else
            printf("%lld\n",(long long )(B-A)*(N-2)+1);
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

/*
	Name: 
	Copyright: 
	Author: 
	Date: 12/01/19 21:42
	Description: 这种做法的本质思路，有点接近于数值计算，数值分析里的编程设计思路，通过对要计算的表达式的改造来实现精度控制。
*/
/*
	Name: 
	Copyright: 
	Author: 
	Date: 12/01/19 15:41
	Description:  
*/
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <stdbool.h>
#include <string.h>


struct bign{
	int d[1000];
	int len;
	big(){
		memset(d, 0, sizeof(d));
		len = 0;
	}
};
bign change(char str[]){
	bign a;
	a.len = strlen(str); 
	for(int i = 0; i < a.len; i++){
		a.d[i] = str[a.len - i - 1] - '0';
	}
	return a;
}
bign add(bign a, bign b){
	bign c;
	int carry = 0;
	for (int i = 0; i < a.len || i < b.len; i++){
		int temp = a.d[i] + b.d[i] + carry;
		c.d[c.len++] = temp % 10;
		carry  = temp / 10;
	}
	if(carry != 0){
		c.d[c.len++] = carry;
	}
	return c;
}
bign sub(bign a, bign b){
	bign c;
	for(int i = 0; i < a.len || i < b.len; i++){
		if(a.d[i] < b.d[i]){
			a.d[i +1 ] --;
			a.d[i] += 10;
		}
		c.d[c.len++] = a.d[i] - b.d[i];
 	}
 	while(c.len - 1 >= 1 && c.d[c.len - 1] == 0){
 		c.len--;
	}
	return c;
}
int main(){
	long long N, A, B;
	long long num;
	scanf("%I64d %I64d %I64d", &N, &A, &B); 
	if(B < A) {
		num = 0;
		printf("%d", num);
		return 0;
	}
	if(N == 1 && A != B){
		num = 0; 
		printf("%d", num);
		return 0;
	}
	//大整数乘法和加法，用python比较快吗？手头没有系统的资料	
	num = (B - A)*(N-2)+1;
	printf("%I64d", num);	
}

Compiler output:
a.cc:25:9: error: ISO C++ forbids declaration of 'big' with no type [-fpermissive]
   25 |         big(){
      |         ^~~
a.cc: In member function 'int bign::big()':
a.cc:28:9: warning: no return statement in function returning non-void [-Wreturn-type]
   28 |         }
      |         ^
Language: C

/*
	Name: 
	Copyright: 
	Author: 
	Date: 12/01/19 21:42
	Description: 这种做法的本质思路，有点接近于数值计算，数值分析里的编程设计思路，通过对要计算的表达式的改造来实现精度控制。
*/

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <stdbool.h>
#include <string.h>


int main(){
	long long N, A, B;
	long long num;
	scanf("%I64d %I64d %I64d", &N, &A, &B); 
	if(B < A) {
		num = 0;
		printf("%d", num);
		return 0;
	}
	if(N == 1 && A != B){
		num = 0; 
		printf("%d", num);
		return 0;
	}
	//大整数乘法和加法，用python比较快吗？手头没有系统的资料	
	num = (B - A)*(N-2)+1;
	printf("%I64d", num);	
}

Compiler output:
main.c:10:10: fatal error: iostream: No such file or directory
   10 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <math.h>

using std::cin;
using std::cout;

int main(int argc, char const *argv[])
{
    ll n, a, b;
    cin >> n >> a >> b;
    if (a > b || (a < b && n == 1))
    {
        cout << 0;
    }
    else if (a == b || (a < b && n == 2))
        cout << 1;
    else if (a < b && n >= 2)
    {
        int remain = n - 2;
        int sum = (n - 1) * b + a - (n - 1) * a - b + 1;
        cout << sum;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:9:5: error: 'll' was not declared in this scope
    9 |     ll n, a, b;
      |     ^~
a.cc:10:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |     cin >> n >> a >> b;
      |            ^
      |            yn
a.cc:10:17: error: 'a' was not declared in this scope
   10 |     cin >> n >> a >> b;
      |                 ^
a.cc:10:22: error: 'b' was not declared in this scope
   10 |     cin >> n >> a >> b;
      |                      ^
Language: C

#include <cstdio>

int main(void)
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);

    if(n==1&&a!=b)
        printf("0\n");
    else if(a>b)
        printf("0\n");
    else
        printf("%lld\n",(long long)b*(n-2)-a*(n-2)+1);
    return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include <cstdio>

int main(void)
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);

    if(n==1&&a!=b)
        printf("0\n");
    else if(a>b)
        printf("0\n");
    else
        printf("%d\n",b*(n-2)-a*(n-2)+1);
    return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
	int n,max,min;
	cin >> n >> min >> max;
	if(n==1) {
		if(max == min) cout<<1;
		else cout<<0;
		return 0;
	}
	if(min > max) {
		cout<<0;
		return 0;
	}
	int a,b;
	a = (n-1)*min+max;
	b = (n-1)*max+min;
	cout<<b-a+1;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

//
//  main.cpp
//  temp
//
//  Created by 张皓焱 on 2019/1/12.
//  Copyright © 2019 threefires. All rights reserved.
//

#include <iostream>
#include <math.h>

using namespace std;

int main(int argc, const char * argv[]) {
    cout << 0 <<endl
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:15:21: error: expected ';' before 'return'
   15 |     cout << 0 <<endl
      |                     ^
      |                     ;
   16 |     return 0;
      |     ~~~~~~
Language: C++

#include <stdio.h>
#include <math.h>


int main()
{
	int n, min, max;
	int a, b;
	scanf_s("%d %d %d", &n, &min, &max);
	int count = 0;
	if (n == 0&&(n==1||max!=min))
		printf("0");
	else if (n == 1) printf("1");
	else
	{

	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |         scanf_s("%d %d %d", &n, &min, &max);
      |         ^~~~~~~
      |         scanf