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

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main(){
    long long N;
    cin >> N;
    long long A,B;
    cin >> A >> B;
    long long C=B-A;
    long long num=0;
    long long dis_B=N-B;
    long long dis_A=A-1;
    long long num_B=B-1;
    long long num_A=N-A;
    if(C%2==0){
        num = C/2;   
    }
    else{
       if(dis_B<dis_A){
           while(A<N){
               A++;
               ++num;
           }
       }
       else{
         while(B<N){
               B++;
               ++num;
           }
       }   
       }
    }
    cout << num;
}

Compiler output:
a.cc:103:5: error: 'cout' does not name a type
  103 |     cout << num;
      |     ^~~~
a.cc:104:1: error: expected declaration before '}' token
  104 | }
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void main() {
	long int N;
	int A, B;
	int M = 0;

	scanf_s("%d %d %d", &N, &A, &B);

	if (A % 2 == 0 && B % 2 == 0) {
		M = (B - A) / 2;
	}
	else if (A % 2 == 0 && B % 2 == 1) {
		if (A < N - B) {
			M = N - B;
		}
		else {
			M = A;
		}
	}
	else if (A % 2 == 1 && B % 2 == 0) {
		if (A < N - B) {
			M = N - B;
		}
		else {
			M = A;
		}
	}
	else if (A % 2 == 1 && B % 2 == 1) {
		M = (B - A) / 2;
	}
	printf("%d", M);
}

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | void main() {
      | ^~~~
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, &A, &B);
      |         ^~~~~~~
      |         scanf
Language: C++

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

int main(){
  ll n,a,b;
  ll ans;
  cin>>n>>a>>b;
  if(a<b)swap(a,b);
  ll d = a-b;
  if(d % 2 == 0){
      ll dif = (d/2);
  }else{
      ll aa,bb;
      ll difan = n-a;
      aa = n;
      bb = b+difan+1;
      ll dif2 =  (aa-bb)/2;
      difan +=dif2+1;

      ll aa2,bb2;
      ll difb0 = b;
      aa2 = a-b-1;
      ll dif3 = aa2/2 + difb0;
      difb0 += dif3+1;

      ans= min(difan,difb0);
   }
   ans = min(ans,dif);
 cout<< ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: 'dif' was not declared in this scope; did you mean 'div'?
   29 |    ans = min(ans,dif);
      |                  ^~~
      |                  div
Language: Java

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long diff = a - b;
        if(diff < 0) diff *= -1L;
        long ans = 0L;
        if(diff % 2L == 0){
            ans = diff / 2L;
        }else{
            long h = (n+1L)/2L;
            if(b <= h || h < a ){
                long ad = Math.min(a-1L, n-a);
                long bd = Math.min(b-1L, n-b);
                ans = Math.max(ad, bd);
            }else{
                long ad = Math.max(a-1L, n-a);
                long bd = Math.max(b-1L, n-b);
                ans = Math.min(ad, bd);
            }
        }
        System.out.println(ans);
        sc.close();

    }

}


Compiler output:
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef uint64_t ll;
int main()
{
	ll n,a,b,x,y;
	cin>>n>>a>>b;
	x=max(a,b);
	y=min(a,b);
	if((x-y)%2==0)) cout<<(x-y)/2;
	else
	{
		cout<<min(x-1,n-y);
	}
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: expected primary-expression before ')' token
   10 |         if((x-y)%2==0)) cout<<(x-y)/2;
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef uint64_t ll;
int main()
{
	ll n,a,b,x,y;
	cin>>n>>a>>b;
	x=max(a,b);
	y=min(a,b);
	if((x-y)%2==0))cout<<(x-y)/2;
	else
	{
		cout<<min(x-1,n-y);
	}
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: expected primary-expression before ')' token
   10 |         if((x-y)%2==0))cout<<(x-y)/2;
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef uint64_t ll;
int main()
{
	ll n,a,b,x,y;
	cin>>n>>a>>b;
	x=max(a,b);
	y=min(a,b);
	if((x-y)%2==0) )cout<<(x-y)/2;
	else
	{
		cout<<min(x-1,n-y);
	}
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: expected primary-expression before ')' token
   10 |         if((x-y)%2==0) )cout<<(x-y)/2;
      |                        ^
Language: C++

#include <iostream>
using namespace std;

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

    int count = 0;
    int c;
    c = A-B;

     if(c%2==0){
         while(c!=1&&c!=0&&c!=-1){
             count++;
             c=c/2;
         }
     }
   
    else{
        if(A>B){
            if((N-A)<=(B-1))
            count = N-B;
            else
            count = A-1;
            
        }

        
        else{
            if((N-B)<=(A-1))
            count = N-A;
            else
              count = B-1;
            
        }
    }
    cout << count << endl;

    return 0;


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

#include<bits/stdc++.h>
using namespace std;
typedef uint64_t ll;
int main()
{
	ll n,a,b,x,y;
	cin>>n>>a>>b;
	x=max(a,b);
	y=min(a,b);
	if((x-y)%2==0) cout<<(x-y)/2;
	else
	{
		cout<<min(x-1,n-y);
	}
}
)
 


Compiler output:
a.cc:16:1: error: expected unqualified-id before ')' token
   16 | )
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int64_t A,B,N,x,y,ANS;
  
  cin >> N;
  cin >> A;
  cin >> B;
  
  if(((B-A)%2==0))
  {
    ANS=(B-A)/2;

  }
  else
  {
    x=N-B+1+((A-B+1)/2);
    y=A+((B-A-1)/2);
    if(x>y)
    {
      ANS=y;
    }
    else
    {
      ANS=x;
    }

   }
   
  }
  cout << ANS <<endl;
  return 0;

}


Compiler output:
a.cc:32:3: error: 'cout' does not name a type
   32 |   cout << ANS <<endl;
      |   ^~~~
a.cc:33:3: error: expected unqualified-id before 'return'
   33 |   return 0;
      |   ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
int main(void){
	ll N,A,B;
	cin >> N;
	cin >> A;
	cin >> B;
	if((B-A)%2==0){
		cout << (B-A)/2 << endl;
	}else if((B-1)<(N-A){
		cout << B-1 << endl;
	}else if((B-1)>=(N-A)){
		cout << N-A << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:29: error: expected ')' before '{' token
   25 |         }else if((B-1)<(N-A){
      |                 ~           ^
      |                             )
a.cc:30:1: error: expected primary-expression before '}' token
   30 | }
      | ^
Language: C++

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

int main() {
  int N ,A ,B;
  cin >> N >> A >> B;
 
  for ( int i = 0; i < N; i++ ){
      A++;
      B--;
      if ( A = B ){
        break;
      }
      cout << i + 1 << endl;
    }
  }
}
  

Compiler output:
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<bitset>
using namespace std;
 
#define FOR(i,a) for(int i=0;i<a;i++)
#define MOD 1000000007LL
 
 
int main(){
	long long int a,b,n;
	cin>>n>>a>>b;
	if((b-a)%2LL==0){cout<<(b-a)/2LL<<endl;}
	else{
      a-1+b
		cout<<min(a/2+b/2,(n-a)/2+(n-b)/2+1)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: expected ';' before 'cout'
   15 |       a-1+b
      |            ^
      |            ;
   16 |                 cout<<min(a/2+b/2,(n-a)/2+(n-b)/2+1)<<endl;
      |                 ~~~~
Language: C++

#include <iostream>
using namespace std;
int main(void) {
    int n,a,b;
    cin >> n >> a >> b;
    if ((b-a)%2==0) {
        cout << min({b-1,n-a,(b-a)/2});
    } else if (b-1 < n-a) {
        cout << b-1;
    } else {
        cout << n-a;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
    7 |         cout << min({b-1,n-a,(b-a)/2});
      |                 ~~~^~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

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

int main(){
  ll n,a,b;
  ll ans;
  cin>>n>>a>>b;
  if(a<b)swap(a,b);
  ll d = a-b;
  if(d % 2 == 0){
      ans = (d/2);
  }else{
      ll aa,bb;
      ll difan = n-a;
      aa = n;
      bb = b+difaa+1;
      ll dif2 =  (aa-bb)/2;
      difan +=dif2+1;

      ll aa2,bb2;
      ll difb0 = b;
      aa2 = a-b+1;
      ll dif3 = aa2 - difb0;
      difb0 += dif3+1;

      ans= min(difan,difb0);
   }
 cout<< ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'difaa' was not declared in this scope; did you mean 'difan'?
   17 |       bb = b+difaa+1;
      |              ^~~~~
      |              difan
Language: C++

#include <iostream>
using namespace std;
int main(void) {
    int n,a,b;
    cin >> n >> a >> b;
    if ((b-a)%2==0) {
        cout << min({b-1,n-a,(b-a)/2};
    } else if (b-1 < n-a) {
        cout << b-1;
    } else {
        cout << n-a;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:38: error: expected ')' before ';' token
    7 |         cout << min({b-1,n-a,(b-a)/2};
      |                    ~                 ^
      |                                      )
Language: C++

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

int main() {
    long long n,a,b;
    cin >>n >> a>> b;
    if((b-a)%2==0){
        long long c=(b-a)/2
        cout << c << endl;
    }
    else{
        long long d=n-a;
        long long e=b-1;
        cout << min(d,e) << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected ',' or ';' before 'cout'
    9 |         cout << c << endl;
      |         ^~~~
Language: Java

import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
long nik=scan.nextInt();
long na=scan.nextInt();
long nb=scan.nextInt();

if((na-nb)%2==0){
    System.out.println(Math.abs(long na-nb)/2);
}else{
    long nc=((na-1)+(nb-1)+1)/2;
    long nd=((nik-na)+(nik-nb)+1)/2;
    System.out.println(Math.min(long nc,long nd));
}
}
}

Compiler output:
Main.java:11: error: '.class' expected
    System.out.println(Math.abs(long na-nb)/2);
                                     ^
Main.java:11: error: not a statement
    System.out.println(Math.abs(long na-nb)/2);
                                       ^
Main.java:11: error: ';' expected
    System.out.println(Math.abs(long na-nb)/2);
                                          ^
Main.java:15: error: '.class' expected
    System.out.println(Math.min(long nc,long nd));
                                     ^
Main.java:15: error: ';' expected
    System.out.println(Math.min(long nc,long nd));
                                       ^
Main.java:15: error: ';' expected
    System.out.println(Math.min(long nc,long nd));
                                               ^
6 errors
Language: C++

#include <stdio.h>

int main() {
	long int N;
	int A, B;
	int M = 0;

	scanf_s("%d %d %d", &N, &A, &B);

	if (A % 2 == 0 && B % 2 == 0) {
		M = (B - A) / 2;
	}
	else if (A % 2 == 0 && B % 2 == 1) {
		if (A < N - B) {
			M = N - B;
		}
		else {
			M = A;
		}
	}
	else if (A % 2 == 1 && B % 2 == 0) {
		if (A < N - B) {
			M = N - B;
		}
		else {
			M = A;
		}
	}
	else if (A % 2 == 1 && B % 2 == 1) {
		M = (B - A) / 2;
	}
	printf("%d", M);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    8 |         scanf_s("%d %d %d", &N, &A, &B);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int main(){
  long long int n;
  int a,b;
  cin>>n>>a>>b;
  long long int cnt=0;
  if(abs(a-b)%2==0){
    cnt=abs(a-b)/2;
    cout<<cnt<<endl;
    return 0;
  }
  cnt=min(max(a-1,n-a),max(b-1,n-b));
  cout<<cnt<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: no matching function for call to 'max(int, long long int)'
   16 |   cnt=min(max(a-1,n-a),max(b-1,n-b));
      |           ~~~^~~~~~~~~
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:16:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   16 |   cnt=min(max(a-1,n-a),max(b-1,n-b));
      |           ~~~^~~~~~~~~
/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
a.cc:16:27: error: no matching function for call to 'max(int, long long int)'
   16 |   cnt=min(max(a-1,n-a),max(b-1,n-b));
      |                        ~~~^~~~~~~~~
/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:16:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   16 |   cnt=min(max(a-1,n-a),max(b-1,n-b));
      |                        ~~~^~~~~~~~~
/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: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
#define mp make_pair
#define pb push_back

ll n,m,v,p;
ll scr[100100];

int main(){
	scanf("%d%d%d%d",&n,&m,&v,&p);
	for (int i=1;i<=n;i++) scanf("%d",&scr[i]);
	sort(scr+1,scr+n+1);
	ll i=1;
	ll chk=scr[n-p+1];
	ll  cnt=1;
	if (v>p){
		i=v-p;
		for (int j=n-p+1;j>1 && scr[j]==scr[j-1];j--) cnt++;
	}
	for (;scr[i]+m<chk+(m*max(0,v-p-i+1)+cnt-1)/cnt;i++){
		//do noting;
	}
	printf("%d\n",n-i+1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:34: error: no matching function for call to 'max(int, ll)'
   24 |         for (;scr[i]+m<chk+(m*max(0,v-p-i+1)+cnt-1)/cnt;i++){
      |                               ~~~^~~~~~~~~~~
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:24:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   24 |         for (;scr[i]+m<chk+(m*max(0,v-p-i+1)+cnt-1)/cnt;i++){
      |                               ~~~^~~~~~~~~~~
/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:24:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   24 |         for (;scr[i]+m<chk+(m*max(0,v-p-i+1)+cnt-1)/cnt;i++){
      |                               ~~~^~~~~~~~~~~
Language: C

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

int main() {
    // your code goes here
    ll a,b,n,i,ans=0,c,d;
    cin >> n >> a >> b;
    if((b-a)%2==0){
        cout << (b-a)/2 << endl;
    } else {
        c = a; d = b;
        d -= c;
        ans = c + d/2;
        c = n-b+1; d = n-a+1;
        d -= c;
        ans = min(ans,c + d/2);
        cout << ans << endl;
    }
    return 0;
}

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

import java.util.*;

class AtCoder {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
      ty{
        long n, a, b;
        n = in.nextLong();
        a = in.nextLong();
        b = in.nextLong();

        if ((b - a) % 2 == 0)
            System.out.println((b - a) / 2);
        else
            System.out.println(b - 1);
        in.close();
      }catch(Ecxrption e)
      {
        return;
      }
    }
}

Compiler output:
Main.java:7: error: not a statement
      ty{
      ^
Main.java:7: error: ';' expected
      ty{
        ^
Main.java:18: error: 'catch' without 'try'
      }catch(Ecxrption e)
       ^
3 errors
Language: C++

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
    long n;
    long a;
    long b;
    long c;
    long d;
    cin>>n>>a>>b;
    if(a==1||b==1){
        cout<<max(a-1,b-1);
    }else if(a==n||b==n){
        cout<<max(n-a,n-b);
    }else if(a=!1&&b=!1&&a=!n&&b=!n&&labs(a-b)%2==1){
        if(a<n/2&&b<2/n){
            cout<<max(a-1,b-1);
        }else if(a>n/2&&b>n/2){
            cout<<max(n-a,n-b);
        }else{
            c=max(a,b);
            d=min(a,b);
            cout<<min(c-1,n-d);
        }
    
    }else if(labs(a-b)%2==0){
        cout<<labs(a-b)/2;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: lvalue required as left operand of assignment
   18 |     }else if(a=!1&&b=!1&&a=!n&&b=!n&&labs(a-b)%2==1){
      |                            ~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A,B,N,ANS;
  
  cin >> N;
  cin >> A;
  cin >> B;
  
  if(((B-A)%2==0))
  {
    ANS=(B-A)/2;

  }
  else
  {
    if((N-A)>(B-1))
    {
    
      ANS=N-B+1+(A-B+1)/2
      
      
    }
   else
   {
   

     ANS=A+(B-A-1)/2
   
  }
  cout << ANS <<endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: expected ';' before '}' token
   21 |       ANS=N-B+1+(A-B+1)/2
      |                          ^
      |                          ;
......
   24 |     }
      |     ~                     
a.cc:29:21: error: expected ';' before '}' token
   29 |      ANS=A+(B-A-1)/2
      |                     ^
      |                     ;
   30 | 
   31 |   }
      |   ~                  
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <bits/stdc++.h>                                                                                                                                                                                                 //kek

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;

#ifndef LOCAL
#define int long long
#endif

mt19937 rnd(time(0));
#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("dead", "r", stdin); freopen("tmp.out", "w", stdout);
//#define _GLIBCXX_DEBUG
#define s second
#define f first
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pii pair<int,int>
#define res resize
#define PI acos(-1)

template<class T>
int upmax(T &a, T b) { return (b > a) ? a = b, 1 : 0; }

template<class T>
int upmin(T &a, T b) { return (b < a) ? a = b, 1 : 0; }

const ll INF = 1e9;//9223372036854775807L; //LONG_MAX;
constexpr ll mod = 1e9 + 7, dopmod = 6914882281337;

ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

ll binpow(ll a, ll n) {
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return (binpow(a, n - 1) % mod) * a % mod;
    else {
        ll b = binpow(a, n / 2) % mod;
        return b * b % mod;
    }
}

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    if (a > b)swap(a, b);
    int ans = INF;
    if (a == b)upmin(ans, 0);
    if ((b - a) % 2 == 0) {
        upmin(ans, (b - a) / 2);
    }
    upmin(ans, b - 1);
    upmin(ans, n - a);
    cout << ans << '\n';
}

signed main() {
    //ioss
    //file
    int t = 1;                                                                                                                                                                        //ll
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:56:21: error: no matching function for call to 'upmin(long long int&, int)'
   56 |     if (a == b)upmin(ans, 0);
      |                ~~~~~^~~~~~~~
a.cc:31:5: note: candidate: 'template<class T> long long int upmin(T&, T)'
   31 | int upmin(T &a, T b) { return (b < a) ? a = b, 1 : 0; }
      |     ^~~~~
a.cc:31:5: note:   template argument deduction/substitution failed:
a.cc:56:21: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   56 |     if (a == b)upmin(ans, 0);
      |                ~~~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N;
  int A;
  int B;
  int C;
  cin >> N >> A >> B;
  C = abs(B-A);

    
    
    
  if (C % 2 == 0){
  	cout << C/2;
  }else{
    if (A-1<B-1 and A<=N/2{
    	cout << B-1;
  	}else{
    	cout << N-A;    
    }
  }
  
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: expected ')' before '{' token
   18 |     if (A-1<B-1 and A<=N/2{
      |        ~                  ^
      |                           )
a.cc:23:3: error: expected primary-expression before '}' token
   23 |   }
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
bool line(ll  a,ll b){
	ll c1 = min(N-b,a-1);
  if(c1 == N-b))  return true;
  else return false;
}

int main(){
 
  cin >> N;
  ll a,b;
  cin >> a >> b;
  ll round = 0;
  
 if((a%2 == 1 && b%2 == 1) && (a%2 == 0 && b%2== 0)){
   round = (b-a)/2;
 }
 else{
	if(line(a,b)){
      round = N - a;
    }
   else{
     round = b - 1;
   }
 }
  
  
  cout << round << endl;
  return 0;
}    
    

Compiler output:
a.cc: In function 'bool line(ll, ll)':
a.cc:7:16: error: expected primary-expression before ')' token
    7 |   if(c1 == N-b))  return true;
      |                ^
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C++

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

int main() {
    long long n,a,b;
    cin >>n >> a>> b;
    if((b-a)%2==0){
        cout << ll(b-a)/2 << endl;
    }
    else{
        cout << min(ll(n-a),ll(b-1)) << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'll' was not declared in this scope
    8 |         cout << ll(b-a)/2 << endl;
      |                 ^~
a.cc:11:21: error: 'll' was not declared in this scope
   11 |         cout << min(ll(n-a),ll(b-1)) << endl;
      |                     ^~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: expected '(' before '{' token
   16 |   {
      |   ^
      |   (
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N;
  int A;
  int B;
  int C;
  cin >> N >> A >> B;
  C = abs(B-A);

    
    
    
  if (C % 2 == 0){
  	cout << C/2;
  }else{
    if (A-1<B-1 and A<=(N-1)/2){
    	cout << B-1;
  	}else{
    	cout << N-A;    
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:4: error: expected '}' at end of input
   23 |   }
      |    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  cin >> N>>A>>B;
  int C=B-A;
  int L=B-1;
  int R=N-A;
  int a=A-1;
  int b=N-B;
  int M=min(L,R);
  int c=min(a,b);
  int D=(C/2)+c;
  int d=D+1;
  if(C%2==0){
    cout<<C/2<<endl;
  }
  else if(N%2==0){
    cout<<min(M,D)<<endl;
  }
  else{
    cout<<min(M)<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: no matching function for call to 'min(int&)'
   23 |     cout<<min(M)<<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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:23:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |     cout<<min(M)<<endl;
      |           ~~~^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected '(' before '{' token
   14 |   {
      |   ^
      |   (
Language: C++

#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
signed main()
{
int n,a[2];
cin>>n>>a[0]>>a[1];
sort(a,a+2);
if((a[1]-a[0])%2==0)
    cout<<(a[1]-a[0])/2<<endl;
else
    {
        if((a[1]-a[0])==1)
            cout<<min(a[1]-1,n-a[0]);
        else
            cout<<min(((a[1]+a[0]-1)/2),n-((a[1]+a[0]-1)/2))
        
    }
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:23:61: error: expected ';' before '}' token
   23 |             cout<<min(((a[1]+a[0]-1)/2),n-((a[1]+a[0]-1)/2))
      |                                                             ^
      |                                                             ;
   24 | 
   25 |     }
      |     ~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:60: error: expected ')' before '}' token
   13 |  else{C=min(((A-1)+((B-(A-1))/2)),((N-B)+(((N-A)-(N-B))/2))};
      |            ~                                               ^
      |                                                            )
a.cc: At global scope:
a.cc:15:6: error: expected unqualified-id before 'return'
   15 |      return 0;
      |      ^~~~~~
a.cc:16:2: error: expected declaration before '}' token
   16 |  }
      |  ^
Language: C++

#include<bits/stc++.h>
using namespace std;
signed main()
{
  long int n,x,y;
  cin>>n>>x>>y;
  long int a,b;
  a=min(x,y);
  b=max(x,y);
  if((a%2==0 && b%2==0) || (a%2!=0 && b%2!=0))
    cout<<(b-(a+b)/2)<<"\n";
  else
  {
    cout<<min(abs(1-b),abs(n-a))<<"\n";
  }
  return 0;
}

Compiler output:
a.cc:1:9: fatal error: bits/stc++.h: No such file or directory
    1 | #include<bits/stc++.h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
long nik=scan.nextInt();
long na=scan.nextInt();
long nb=scan.nextInt();

if((na-nb)%2==0){
    System.out.println(Math.abs(na-nb)/2);
}else{
    int nc=((na-1)+(nb-1)+1)/2;
    int nd=((nik-na)+(nik-nb)+1)/2;
    System.out.println(Math.min(nc,nd));
}
}
}

Compiler output:
Main.java:13: error: incompatible types: possible lossy conversion from long to int
    int nc=((na-1)+(nb-1)+1)/2;
                            ^
Main.java:14: error: incompatible types: possible lossy conversion from long to int
    int nd=((nik-na)+(nik-nb)+1)/2;
                                ^
2 errors
Language: Java

import java.math.BigInteger;
import java.util.Scanner;

public class A {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    BigInteger n = new BigInteger(scan.next());
    BigInteger a = new BigInteger(scan.next());
    BigInteger b = new BigInteger(scan.next());

    if(a.equals(b)){
      System.out.println(0);
      return;
    }
    BigInteger x = (b.subtract(a).abs()).divide(new BigInteger("2"));
    if(x.equals(BigInteger.ZERO)){
        x = new BigInteger(n.toString());
    }
    BigInteger y = (a.subtract(BigInteger.ONE)).max(b.subtract(BigInteger.ONE));
    BigInteger z = (n.subtract(a)).max(n.subtract(b));
    System.out.println(x.min(y.min(z)).toString());
  }
}

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

import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int num = 0;
                while (a != b) {
                    if (a > b) {
                        a--;
                        b++;
                        num++;
                    }
                    else if (a < b) {
                        a++;
                        b--;
                        num++
                    }
                }
                System.out.println(num);
            

    }
}


Compiler output:
Main.java:21: error: ';' expected
                        num++
                             ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A,B,N,ANS,d;
  
  cin >> N;
  cin >> A;
  cin >> B;
  
  if(((B-A)%2==0))
  {
    ANS=(B-A)/2;

  }
  else
  {
    if((N-A)>(B-1))
    {
      ANS=B-1;
      d=N-A+1;
      ANS=d+(N-d+A)/2;
      
      
    }
   else
   {
   
     d=B;
     ANS=d+(N-d+B)/2
   }
   
  }
  cout << ANS <<endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:21: error: expected ';' before '}' token
   30 |      ANS=d+(N-d+B)/2
      |                     ^
      |                     ;
   31 |    }
      |    ~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define endl '\n'

using namespace std;

int main()
{
    fast;
    ll n,a,b,k,r1,r2;
    cin>>n>>a>>b;
    k=b-a;
    if (k%2==1)
    {
        if (abs(n-b)<=abs(n-a))
            r1=abs(n-a);
        else
            r1=abs(n-b);
        if (abs(b-1)<=abs(a-1))
            r2=abs(a-1);
        else
            r2=abs(b-1);
        if (r1<=r2)
            cout<<r1<<endl;
        else
            cout<<r2<<endl;
    }
    else
    {
        k/=2;
        cout<<k<<endl;
    }
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'fast' was not declared in this scope
    9 |     fast;
      |     ^~~~
Language: C++

#define pb push_back
#define ff first
#define ss second
#define ll long long unsinged
#define maxn 200005
#define mod 998244353
#include <bits/stdc++.h>
using namespace std;


int main() {

    ll n, a, b, d;
    cin >> n >> a >> b;
    if(a > b) swap(a, b);
    d = b - a;
    if(d%2 == 0){
        cout << d / 2 << endl;
    }
    else{
        ll x, y, res1, res2;
        x = a, y = b;
        res1 = x - 1;
        x = 1;
        res1 += ((y-x)/2) + ((y-x)%2);
        x = a, y = b;
        res2 = n - y;
        y = n;
        res2 += (y-x)/2 + (y-x)%2;
        cout << min(res1, res2) << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: expected initializer before 'n'
   13 |     ll n, a, b, d;
      |        ^
a.cc:14:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |     cin >> n >> a >> b;
      |            ^
      |            yn
a.cc:14:17: error: 'a' was not declared in this scope
   14 |     cin >> n >> a >> b;
      |                 ^
a.cc:14:22: error: 'b' was not declared in this scope; did you mean 'pb'?
   14 |     cin >> n >> a >> b;
      |                      ^
      |                      pb
a.cc:16:5: error: 'd' was not declared in this scope
   16 |     d = b - a;
      |     ^
a.cc:21:12: error: expected initializer before 'x'
   21 |         ll x, y, res1, res2;
      |            ^
a.cc:22:9: error: 'x' was not declared in this scope
   22 |         x = a, y = b;
      |         ^
a.cc:22:16: error: 'y' was not declared in this scope; did you mean 'yn'?
   22 |         x = a, y = b;
      |                ^
      |                yn
a.cc:23:9: error: 'res1' was not declared in this scope
   23 |         res1 = x - 1;
      |         ^~~~
a.cc:27:9: error: 'res2' was not declared in this scope
   27 |         res2 = n - y;
      |         ^~~~
Language: C++

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

int main(){
	long long long int n, a, b, case1, case2, players_in_between, dis_a, dis_b, temp;
	if(b<a){
		temp=a;//we ensure here that a is always smaller than b
		a=b;
		b=temp;
	}
	cin>>n>>a>>b;
	players_in_between=(abs(a-b)-1);
	case1=(abs(a-b)/2);
	dis_a=n-a;
	dis_b=b-1;
	if(dis_a>dis_b){
		case2=dis_b;
	}
	else{
		case2=dis_a;
	}
	if(a==b){
		cout<<0;
	}
	else if(players_in_between%2==0){
		cout<<case2;
	}
	else{
		if(case2>case1){
			cout<<case1;
		}
		else{
			cout<<case2;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: 'long long long' is too long for GCC
    5 |         long long long int n, a, b, case1, case2, players_in_between, dis_a, dis_b, temp;
      |                   ^~~~
Language: C++

#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void){
    long long int n, a, b;
    long long int ans;
    cin >> n >> a >> b;
    if((b-a)%2 == 0)
        ans = (abs(a-b))/2;
    else{
        int check = min(a-1, n-b);
        ans = check + 1 + ((b-a)-1)/2;
    }
        
    cout << ans << endl;
        
    return 0;   
}#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void){
    long long int n, a, b;
    long long int ans;
    cin >> n >> a >> b;
    if((b-a)%2 == 0)
        ans = (abs(a-b))/2;
    else{
        int check = min(a-1, n-b);
        ans = check + 1 + ((b-a)-1)/2;
    }
        
    cout << ans << endl;
        
    return 0;   
}

Compiler output:
a.cc:24:2: error: stray '#' in program
   24 | }#include <iostream>
      |  ^
a.cc:24:3: error: 'include' does not name a type
   24 | }#include <iostream>
      |   ^~~~~~~
a.cc:33:5: error: redefinition of 'int main()'
   33 | int main(void){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(void){
      |     ^~~~
Language: C++

#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>

ll power(ll x,ll y)
{
  ll res=1;
  while(y>0)
  {
    if(y%2) res=(x%mod*res%mod)%hell;
    x=(x%mod*x%mod)%mod;
    y=y/2;
  }
  return res%mod;
}

ll modinv(ll x){
  return power(x,mod-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/



void solve(){
  int test;
  //cin>>test;
  test=1;
  while(test--){
       ll n,a,b;
       cin>>n>>a>>b;
 
       if(a>b)
       swap(a,b);
       

       ll ans=min(b-1,n-a);
       if((b-a)%2==0)
       ans=min(ans,(b-a)/2);a
       
       if((b-a)&1){    
          ll x=a-1+(b-a+1)/2;
          ll y=(n-b)+(b-a+1)/2;
          ans=min({ans,x,y});
       }
       
       cout<<ans;
  }
}




/*bool issafe(int x,int y){
  return (x>=0 && y>=0 && x<n && y<m);
}*/

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:103:30: error: expected ';' before 'if'
  103 |        ans=min(ans,(b-a)/2);a
      |                              ^
      |                              ;
  104 | 
  105 |        if((b-a)&1){
      |        ~~
Language: C++

/*
ID: jerrywcy
LINK:
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

ull n;
ull a,b;

ull read(){
    ull f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

int main()
{
//	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	n=read();
	a=read();b=read();if (a>b)swap(a,b);
	if (a==b){
		puts("0");
	}
	else if ((b-a)%2==1){
		printf("%lld\n",min(b-1,n-a));
	}
	else{
		printf("%lld\n",(b-a)>>1);
	}

	return 0;
}

Compiler output:
a.cc:17:1: error: 'ull' does not name a type; did you mean 'll'?
   17 | ull n;
      | ^~~
      | ll
a.cc:18:1: error: 'ull' does not name a type; did you mean 'll'?
   18 | ull a,b;
      | ^~~
      | ll
a.cc:20:1: error: 'ull' does not name a type; did you mean 'll'?
   20 | ull read(){
      | ^~~
      | ll
a.cc: In function 'int main()':
a.cc:31:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   31 |         n=read();
      |         ^
      |         yn
a.cc:31:15: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   31 |         n=read();
      |           ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:7:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:32:9: error: 'a' was not declared in this scope
   32 |         a=read();b=read();if (a>b)swap(a,b);
      |         ^
a.cc:32:15: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   32 |         a=read();b=read();if (a>b)swap(a,b);
      |           ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:32:18: error: 'b' was not declared in this scope
   32 |         a=read();b=read();if (a>b)swap(a,b);
      |                  ^
a.cc:32:24: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   32 |         a=read();b=read();if (a>b)swap(a,b);
      |                    ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main()
{
  int N;
  int A;
  int B;
  
  cin >> N;
  cin >> A;
  cin >> B;
  if((A+B)%2==0){
    cout << (B-A)/2;
  }else if((N-B)<(A-1)){
	cout << N-B＋１＋(B-A-1)/2;
  }else{
    cout << A-1+1+(B-A-1)/2;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'B\U0000ff0b\U0000ff11\U0000ff0b' was not declared in this scope
   16 |         cout << N-B＋１＋(B-A-1)/2;
      |                   ^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  long long A, B, N, R, swap;
  cin >> N >> A >> B;
  if(B > A){
    swap = B;
    B = A;
    A = swap;
  }
  if((A - B) % 2 == 0)){
    R = (A - B ) / 2;
  }else{
    if(N - B > A - 1){
      	B = 1; A = A + 1 - B;A--;R = B;
      	R += (A - B) / 2;
      }
    else{
      A = N; B = B + N - A;B++;R = N - A + 1;
      R += (A - B ) / 2;
    }
  }
  cout << R;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected primary-expression before ')' token
   11 |   if((A - B) % 2 == 0)){
      |                       ^