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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
 
    int64_t n,a,b;
    cin>>n>>a>>b;

    if(abs(a-b)%2==0)
        cout<<abs(a-b)/2<<endl;
    else if(min(a,b)-1<n-max(a,b){
        cout<<min(a,b)+1+max(max(a,b)-(min(a,b)+1),(int64_t)0)/2-1<<endl;
    }else{
        cout<<n-max(a,b)+1+n-(min(a,b)-(n-max(a,b)-1))/2-1<<endl;
    }
    return 0;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: expected ';' before '{' token
   12 |     else if(min(a,b)-1<n-max(a,b){
      |                                  ^
      |                                  ;
a.cc:14:6: error: expected primary-expression before 'else'
   14 |     }else{
      |      ^~~~
a.cc:14:6: error: expected ')' before 'else'
   14 |     }else{
      |      ^~~~
      |      )
a.cc:12:12: note: to match this '('
   12 |     else if(min(a,b)-1<n-max(a,b){
      |            ^
Language: C++

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

Compiler output:
a.cc:4:11: error: '::main' must return 'int'
    4 | long long int main(){
      |           ^~~
Language: C

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll a, b, c, e, f;
cin >> a >> b >> c;
e = a - b;
f = c - 1;
ll d = (b + c) / 2;
if(b % 2 == 0 && c % 2 == 0 || b % 2 != 0 && c % 2 != 0){
    cout << c - d;
}
else{
    cout << min(e, f);
}








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: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  int N,a,b;
  cin>>N>>a>>b;
    var c=min(a,b);
    var d=max(a,b);
   if((a-b)%2==0){
     cout<<(d-c)/2;
   }
  else{
    cout<<min(d-1,N-c-1);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'var' was not declared in this scope
   27 |     var c=min(a,b);
      |     ^~~
a.cc:28:8: error: expected ';' before 'd'
   28 |     var d=max(a,b);
      |        ^~
      |        ;
a.cc:30:13: error: 'd' was not declared in this scope
   30 |      cout<<(d-c)/2;
      |             ^
a.cc:30:15: error: 'c' was not declared in this scope
   30 |      cout<<(d-c)/2;
      |               ^
a.cc:33:15: error: 'd' was not declared in this scope
   33 |     cout<<min(d-1,N-c-1);
      |               ^
a.cc:33:21: error: 'c' was not declared in this scope
   33 |     cout<<min(d-1,N-c-1);
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  int N,a,b;
  cin>>N>>a>>b;
    var c=min(a,b);
    var d=max(a,b);
   if((a-b)%2==0){
     cout<<(d-c)/2;
   }
  else{
    cout<<min(d-1,N-d-1);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'var' was not declared in this scope
   27 |     var c=min(a,b);
      |     ^~~
a.cc:28:8: error: expected ';' before 'd'
   28 |     var d=max(a,b);
      |        ^~
      |        ;
a.cc:30:13: error: 'd' was not declared in this scope
   30 |      cout<<(d-c)/2;
      |             ^
a.cc:30:15: error: 'c' was not declared in this scope
   30 |      cout<<(d-c)/2;
      |               ^
a.cc:33:15: error: 'd' was not declared in this scope
   33 |     cout<<min(d-1,N-d-1);
      |               ^
Language: C++

#include <iostream>
#include <algorithm>

#define int long long

int computeSolution(int N, int A, int B){

    //they meet directly
    if ((A-B)%2 == 0){
        return  (B-A)/2;
    }
    //they meet at N, use symmetry
    if (A-1 > N-B){
        //return computeSolution(N,N-B+1,N-A+1);
        return (N - B) + 1 + computeSolution(N, A + (N-B+ 1), N);
    } else {
        return A + computeSolution(N, 1, B - A);
    }
//    //meeting at 1:
//    if ( B == A + 1){
//        return B-1;
//    }

//    //meeting over 1:
//    return A + computeSolution(N,1,B-A);

}



int main(){
    int N, A, B;
    std::cin >> N >> A >> B;
    std::cout << computeSolution(N,A,B);
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

    if ((A-B)%2 == 0){
        std::cout  << (B-A)/2;
    }
    else if( A <= N - B){
        std::cout <<  std::min(A  + (B-A-1)/2, B-1);
    }
    else{
        std::cout <<  std::min(N-A, N-B + 1  + (B-A-1)/2);

    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:10: error: 'cin' is not a member of 'std'
    3 |     std::cin >> N >> A >> B;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(){
a.cc:6:14: error: 'cout' is not a member of 'std'
    6 |         std::cout  << (B-A)/2;
      |              ^~~~
a.cc:6:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:14: error: 'cout' is not a member of 'std'
    9 |         std::cout <<  std::min(A  + (B-A-1)/2, B-1);
      |              ^~~~
a.cc:9:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:28: error: 'min' is not a member of 'std'
    9 |         std::cout <<  std::min(A  + (B-A-1)/2, B-1);
      |                            ^~~
a.cc:12:14: error: 'cout' is not a member of 'std'
   12 |         std::cout <<  std::min(N-A, N-B + 1  + (B-A-1)/2);
      |              ^~~~
a.cc:12:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:28: error: 'min' is not a member of 'std'
   12 |         std::cout <<  std::min(N-A, N-B + 1  + (B-A-1)/2);
      |                            ^~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    8 |     cout << ans=(b-a)/2 << endl;
      |                 ~~~~~~~~^~~~~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected primary-expression before '==' token
    7 |   if ((b-a)% == 0){
      |              ^~
Language: C++

#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n , a , b ;
    cin >> n >> a >> b ;

    if((a + b) % 2 == 0){
        cout << abs(a - b) /2 << endl;
    }else{
        min(a - 1, n - b) + 1 + (b - a - 1) / 2;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:8:15: note: to match this '{'
    8 | int main(void){
      |               ^
Language: C++

#include <iostream>

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


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         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:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |         cout << (b - a) / 2;
      |         ^~~~
      |         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:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |         cout << b - 1;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

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

int main()
{
    int64_t N, A, B;
    cin >> N >> A >> B;
    if ((B - A) % 2 == 0)
    {
        cout << (B - A) / 2 << endl;
    }
    else
    {
        int64_t ans1 = 0, ans2 = 0;
        ans1 = max(A - 1, 0LL);
        int atmp = 1;
        int btmp = B - ans1 - 1;
        ans1++;
        ans1 += (btmp - atmp) / 2;

        ans2 = N - B;
        btmp = N;
        atmp = A + (N - B) + 1;
        ans2++;
        ans2 += (btmp - atmp) / 2;

        //       cout << ans1 << " " << ans2 << endl;
        cout << min(ans1, ans2) << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: no matching function for call to 'max(int64_t, long long int)'
   16 |         ans1 = max(A - 1, 0LL);
      |                ~~~^~~~~~~~~~~~
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:16:19: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   16 |         ans1 = max(A - 1, 0LL);
      |                ~~~^~~~~~~~~~~~
/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:16:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   16 |         ans1 = max(A - 1, 0LL);
      |                ~~~^~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
 
    
    
int main(){
     
  long int n,a,b,s,t
  cin>>n>>a>>b;

  if ((a-b)%2=0)
  {
    cout<<abs(a-b)/2<<endl;
  }
  
  else
  {
    s=(a+b+1)/2;
    t=(2n-a-b+1)/2;
    cout<<min(s,t)<<endl;
  }
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'cin'
    9 |   cin>>n>>a>>b;
      |   ^~~
a.cc:11:12: error: lvalue required as left operand of assignment
   11 |   if ((a-b)%2=0)
      |       ~~~~~^~
a.cc:19:5: error: 't' was not declared in this scope
   19 |     t=(2n-a-b+1)/2;
      |     ^
a.cc:19:8: error: unable to find numeric literal operator 'operator""n'
   19 |     t=(2n-a-b+1)/2;
      |        ^~
Language: C++

N,A,B = map(int,input().split())
dif = abs(A-B)
if dif%2 == 0:
  print(int(dif/2))
elif B-1 < N-A:
  print(B-1)
else:
  print(N-A)

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

#include<bits/stdc++.h>

using namespace std;
#define int long long
#define inf 9999999999999999999

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

Compiler output:
a.cc:10:17: warning: integer constant is so large that it is unsigned
   10 |         int ans=inf;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:15:25: error: 'as' was not declared in this scope; did you mean 'ans'?
   15 |                 ans=min(as,min(a-1,n-b)+(abs(b-a)+1)/2);
      |                         ^~
      |                         ans
Language: C++

#include<iostream>
using namespace std;
inline min(long long int a, long long int b)
{
  return (a>b?a:b);
}
int main()
{
  	long long int n, a, b;
  cin>>n>>a>>b;
  if(a>b)swap(a,b);
  if((b - a)%2)
    cout<<min(n - a, b - 1)<<endl;
  else cout<<(b - a)/2<<endl;
  
}

Compiler output:
a.cc:3:8: error: ISO C++ forbids declaration of 'min' with no type [-fpermissive]
    3 | inline min(long long int a, long long int b)
      |        ^~~
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 << (B-A)/2 << endl;
  else{
    k=min((A+B-1)/2,(2*N-A-B-1));
    cout << k << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'k' was not declared in this scope
   10 |     k=min((A+B-1)/2,(2*N-A-B-1));
      |     ^
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 << b-((a+b)/2); << endl;
	else cout << min(a-1, n-b) + 1 + (b-a-1)/2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:40: error: expected primary-expression before '<<' token
    7 | if ((b-a)%2 == 0) cout << b-((a+b)/2); << endl;
      |                                        ^~
a.cc:8:9: error: 'else' without a previous 'if'
    8 |         else cout << min(a-1, n-b) + 1 + (b-a-1)/2 << endl;
      |         ^~~~
Language: C++

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

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

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namespaces'
    2 | using namespaces std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:19: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   long long n,a,b;cin>>n>>a>>b;
      |                   ^~~
      |                   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |   cout<<max(a,b)-(a+b)/2;
      |   ^~~~
      |   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:9: error: 'max' was not declared in this scope; did you mean 'std::max'?
    8 |   cout<<max(a,b)-(a+b)/2;
      |         ^~~
      |         std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:11:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   cout<<min(n-min(a,b)-1,max(a,b)-1);
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:15: error: 'min' was not declared in this scope; did you mean 'std::min'?
   11 |   cout<<min(n-min(a,b)-1,max(a,b)-1);
      |               ^~~
      |               std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:11:26: error: 'max' was not declared in this scope; did you mean 'std::max'?
   11 |   cout<<min(n-min(a,b)-1,max(a,b)-1);
      |                          ^~~
      |                          std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:11:9: error: 'min' was not declared in this scope; did you mean 'std::min'?
   11 |   cout<<min(n-min(a,b)-1,max(a,b)-1);
      |         ^~~
      |         std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

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

int main()
{
    long long N, A, B;
    cin>>N>>A>>B;
    if(A == B) cout<< 0 <<endl;
    if(abs(A - B) % 2 == 1) 
    {
        int must = min(N - max(A, B), min(A, B) - 1);
        cout << must + 1 + max(1, (abs(A - B) - 1)/2)<<endl;
    }
    else
    {
        cout<< abs(A - B)/2<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: no matching function for call to 'max(int, long long int)'
   14 |         cout << must + 1 + max(1, (abs(A - B) - 1)/2)<<endl;
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:14:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   14 |         cout << must + 1 + max(1, (abs(A - B) - 1)/2)<<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:14:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |         cout << must + 1 + max(1, (abs(A - B) - 1)/2)<<endl;
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

int main(){
    long long N,A,B,ans;
    cin>>N>>A>>B;
    if(A%2==B%2)ans=(B-A)/2
    else ans=min(A-1,N-B)+1+(B-A+1)/2
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:28: error: expected ';' before 'else'
    8 |     if(A%2==B%2)ans=(B-A)/2
      |                            ^
      |                            ;
    9 |     else ans=min(A-1,N-B)+1+(B-A+1)/2
      |     ~~~~
Language: Java

public class Tenis {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
      
      double sa = |a - b|;
      
      int ans = 0;
      
      
      for(t=1,2t>n,t++){
     double  ans = sa/2;
      System.out.println(ans);
      }
      )
      

Compiler output:
Main.java:9: error: illegal start of expression
      double sa = |a - b|;
                  ^
Main.java:9: error: illegal start of expression
      double sa = |a - b|;
                         ^
Main.java:14: error: not a statement
      for(t=1,2t>n,t++){
              ^
Main.java:14: error: ';' expected
      for(t=1,2t>n,t++){
               ^
Main.java:14: error: ';' expected
      for(t=1,2t>n,t++){
                  ^
Main.java:18: error: illegal start of expression
      )
      ^
Main.java:18: error: reached end of file while parsing
      )
       ^
7 errors
Language: Java

import java.util.*;
 
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 ans = 0;
		if ((A-B)%2 == 0) {
			ans = (A-B)/2;
		} else {
			ans = N-1-Math.max(A-1, N-B));
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:13: error: ';' expected
			ans = N-1-Math.max(A-1, N-B));
			                            ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'll' was not declared in this scope
    9 |   ll n,a,b;
      |   ^~
a.cc:10:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |   cin >> n >> a >> b;
      |          ^
      |          yn
a.cc:10:15: error: 'a' was not declared in this scope
   10 |   cin >> n >> a >> b;
      |               ^
a.cc:10:20: error: 'b' was not declared in this scope
   10 |   cin >> n >> a >> b;
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
 
void solve(){
 
 
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();

    ll n,a,b;cin>>n>>a>>b;
    if((b-a)%2==0) cout<<(b-a)/2<<endl;
    else{
        ll s1=a-1;
        else s1+=(tb-1)/2+1;

        a=n-a+1, b=n-b+1;
        swap(a,b);

        ll s2=a-1;
        tb=b-s2;
        if((tb-1)%2==0) s2+=tb/2;
        else s2+=(tb-1)/2+1;
        cout<<min(s1,s2)<<endl;
    }

	return 0;
}
 



Compiler output:
a.cc: In function 'int main()':
a.cc:67:9: error: 'else' without a previous 'if'
   67 |         else s1+=(tb-1)/2+1;
      |         ^~~~
a.cc:67:19: error: 'tb' was not declared in this scope; did you mean 'b'?
   67 |         else s1+=(tb-1)/2+1;
      |                   ^~
      |                   b
Language: C++

    cout << (b-a)/2 + (b-a)%2 * min(a, n-b+1);
}


Compiler output:
a.cc:1:5: error: 'cout' does not name a type
    1 |     cout << (b-a)/2 + (b-a)%2 * min(a, n-b+1);
      |     ^~~~
a.cc:2:1: error: expected declaration before '}' token
    2 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  long N, A, B;
  
  cin >> N >> A >> B;
  
  if (A < B) {
    swap(A, B);
  }
  
  if (abs(A - B) % 2 == 0) {
    cout << abs(A - B) / 2 << endl;
  } else {
    if (2 * A > N) {
      cout << (N - A) << endl;
    } else {
      cout << (A - 1) << endl;
  }
  
  return 0;
}

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

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected '}' before 'else'
    9 |   else{
      |   ^~~~
a.cc:7:19: note: to match this '{'
    7 |   if((b-a)%2 == 0){
      |                   ^
Language: C++

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected '}' before 'else'
    9 |   else{
      |   ^~~~
a.cc:7:19: note: to match this '{'
    7 |   if((b-a)%2 == 0){
      |                   ^
Language: C++

#include <iostream>
#define less(a,b) (((a)<(b))?(a):(b))
using namespace std;
int main(void)
{
	lli N, A, B; cin >> N >> A >> B;
	if (A % 2 == B % 2)cout << (B - A) / 2 << endl;
	else cout << less(B - 1, N - A) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'lli' was not declared in this scope; did you mean 'lldiv'?
    6 |         lli N, A, B; cin >> N >> A >> B;
      |         ^~~
      |         lldiv
a.cc:6:29: error: 'N' was not declared in this scope
    6 |         lli N, A, B; cin >> N >> A >> B;
      |                             ^
a.cc:6:34: error: 'A' was not declared in this scope
    6 |         lli N, A, B; cin >> N >> A >> B;
      |                                  ^
a.cc:6:39: error: 'B' was not declared in this scope
    6 |         lli N, A, B; cin >> N >> A >> B;
      |                                       ^
Language: C++

#include <iostream>
#include <cmath>

int main() {
  int a, b, n;
  cin >> n >> a >> b;
  
  if (a > b) swap(a, b);
  if ((a & 1) == (b & 1)) 
    cout << (b - a) / 2;
  else 
   cout << (b - a) / 2 + min(a, n - b + 1); 
    
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: 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:14: error: 'swap' was not declared in this scope
    8 |   if (a > b) swap(a, b);
      |              ^~~~
a.cc:8:14: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 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:
/usr/include/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |     cout << (b - a) / 2;
      |     ^~~~
      |     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:4: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |    cout << (b - a) / 2 + min(a, n - b + 1);
      |    ^~~~
      |    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:26: error: 'min' was not declared in this scope; did you mean 'std::min'?
   12 |    cout << (b - a) / 2 + min(a, n - b + 1);
      |                          ^~~
      |                          std::min
In file included from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

from decimal import Decimal
n, a, b = map(Decimal, input().split())
if (a+b) % 2 == 1:
  if a+b < 1+n:
    a = 1 - a
  else:
    a = 2 * n + 1 - a
print(abs((a-b)/2))


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from decimal import Decimal
      | ^~~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
  long n, a, b;
  cin >> n >> a >> b;
  
  if ((a+b) % 2)
    if (a+b < 1+n)
      a = 1 - a;
    else
      a = 2 * n + 1 - a;
      
cout << (a > b ? (a-b)/2 : (b-a)/2) << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:16:45: error: expected '}' at end of input
   16 | cout << (a > b ? (a-b)/2 : (b-a)/2) << endl;
      |                                             ^
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 ((a+b) % 2)
    if (a+b < 1+n)
      a = 1 - a;
    else
      a = 2 * n + 1 - a;
      
cout << (a > b ? (a-b)/2 : (b-a)/2) << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:16:45: error: expected '}' at end of input
   16 | cout << (a > b ? (a-b)/2 : (b-a)/2) << endl;
      |                                             ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

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

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

#include"stdafx.h"
#include<vector>
#include<iostream>
#include<fstream>
#include<string>
#include<cassert>
#include<algorithm>
#include<random>
#include<map>
#include<set>

using namespace std;

//int mod = 998244353;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<int>vi;
typedef vector<ll>vl;
typedef vector<vector<int>>vvi;
typedef vector<vector<ll>>vvl;
typedef vector< pair<ll, ll>>vpll;
typedef vector< pair<ld, ld>>vpld;
typedef pair<ld, ld>pld;
#define mp make_pair
#define pb push_back

const int mod = 998244353;
int sum(int a, int b)
{
	int c = a + b;
	if (c >= mod)
	{
		c -= mod;
	}
	return c;
}
int dif(int a, int b)
{
	int c = a - b;
	if (c < 0)
	{
		c += mod;
	}
	return c;
}
int mlt(int a, int b)
{
	ll c = a * 1LL * b;
	return c % mod;
}
int ibit(int n, int i)
{
	return ((n >> i) & 1);
}
ll left(ll a, ll b)
{
	ll c = b - a;
	return a + (c - 1) / 2;
}
ll right(ll a, ll b, ll n)
{
	return left(n - b + 1, n - a + 1);
}
void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	ll a, b, n;
	cin >> n >> a >> b;
	if (b % 2 == a % 2)
	{
		cout << (b - a) / 2 << endl;
	}
	else
	{
		cout << min(left(a, b), right(a, b, n))<<endl;
	}
}
int main()
{
	solve();
	int n;
	cin >> n;
}

Compiler output:
a.cc:1:9: fatal error: stdafx.h: No such file or directory
    1 | #include"stdafx.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
    int N, A, B;
    cin >> N >> A >> B;
 
    if (abs(B-A)%2=0) {
      cout << abs(B-A)/2 << endl;
    } else {
      cout << min(max(N-A, N-B), max(A-1, B-1)) << endl;
    }
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: lvalue required as left operand of assignment
    9 |     if (abs(B-A)%2=0) {
      |         ~~~~~~~~^~
Language: C++

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

  const int MOD = 1000000007;

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }



int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int ans;
  if(abs(A % 2 == B % 2) ans = (B - A) / 2;
  else ans =  min(A, N - B + 1) + (B - A) / 2;
  print(ans);


}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:25: error: expected ';' before 'ans'
   46 |   if(abs(A % 2 == B % 2) ans = (B - A) / 2;
      |                         ^~~~
      |                         ;
a.cc:47:3: error: expected primary-expression before 'else'
   47 |   else ans =  min(A, N - B + 1) + (B - A) / 2;
      |   ^~~~
a.cc:46:44: error: expected ')' before 'else'
   46 |   if(abs(A % 2 == B % 2) ans = (B - A) / 2;
      |     ~                                      ^
      |                                            )
   47 |   else ans =  min(A, N - B + 1) + (B - A) / 2;
      |   ~~~~
Language: C++

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

int main(){ 
  
  ll N,A,B; cin >> N >> A >> B;
  
  if( A > B){ swap(A,B);}
  
  if( ( A+B ) % 2 == 0 ){ 
    cout << abs(B-A)/2 << endl;
    
    return 0;
  }

  else{
    
    cout << min(A-1,N-B)+1+(B-A-1)/2 << endl;
    
    return 0;
  }
}


Compiler output:
a.cc:28:5: error: redefinition of 'int main()'
   28 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
Language: C++

#include<iostream>
#include<algorithm>
typedef long long ll;
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'retur' was not declared in this scope
   12 |         retur
      |         ^~~~~
a.cc:12:14: error: expected '}' at end of input
   12 |         retur
      |              ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){ int a,b,c,x=0,y=0,i,j; cin>>a>>b>>c; i=b-1;j=a-c; if((c-b)%2==0){x=(c-b)/2;} else if(i<=j){b-=i;c=c-i-1;x=x+i+1;x+=(c-b)/2;} else{c+=j;b=b+j+1;x=x+j+1;x+=(c-b)/2;} cout<<x<<endl; } 


Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){ int a,b,c,x=0,y=0,i,j; cin>>a>>b>>c; i=b-1;j=a-c; if((c-b)%2==0){x=(c-b)/2;} else if(i<=j){b-=i;c=c-i-1;x=x+i+1;x+=(c-b)/2;} else{c+=j;b=b+j+1;x=x+j+1;x+=(c-b)/2;} cout<<x<<endl; }
      |                    ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

int a,b,c,x=0,y=0,i,j;
cin>>a>>b>>c;
i=b-1;j=a-c;
if((c-b)%2==0){x=(c-b)/2;}
else if(i<=j){b-=i;c=c-i-1;x=x+i+1;x+=(c-b)/2;}
else{c+=j;b=b+j+1;x=x+j+1;x+=(c-b)/2; to}

cout<<x<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:39: error: 'to' was not declared in this scope; did you mean 'tm'?
   13 | else{c+=j;b=b+j+1;x=x+j+1;x+=(c-b)/2; to}
      |                                       ^~
      |                                       tm
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'b' was not declared in this scope
   10 |   else if (A - 1 > N - b ) {
      |                        ^
a.cc:14:18: error: 'a' was not declared in this scope
   14 |     M = (2 * N - a - b) / 2 + 1;
      |                  ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'b' was not declared in this scope
   10 |   else if (A - 1 > N - b ) {
      |                        ^
a.cc:11:28: error: expected ';' before '}' token
   11 |     M = (A + B - 2) / 2 + 1
      |                            ^
      |                            ;
   12 |   }
      |   ~                         
a.cc:14:32: error: expected ';' before '}' token
   14 |     M = (2 * N - A - B) / 2 + 1
      |                                ^
      |                                ;
   15 |   }
      |   ~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'b' was not declared in this scope
   10 |   else if (A - 1 > N - b ) {
      |                        ^
a.cc:11:28: error: expected ';' before '}' token
   11 |     M = (A + B - 2) / 2 + 1
      |                            ^
      |                            ;
   12 |   }
      |   ~                         
a.cc:14:18: error: 'a' was not declared in this scope
   14 |     M = (2 * N - a - b) / 2 + 1
      |                  ^
Language: C++

  int A, B, N, M;
  cin >> N >> A >> B;
  if ((A - B) % 2 == 0) {
    M = (B - A) /2;
  }
  else if (A - 1 > N - b ) {
    M = (A + B - 2) / 2 + 1
  }
  else {
    M = (2 * N - A - B) / 2 + 1
  }
  cout << M << endl;
}

Compiler output:
a.cc:2:3: error: 'cin' does not name a type
    2 |   cin >> N >> A >> B;
      |   ^~~
a.cc:3:3: error: expected unqualified-id before 'if'
    3 |   if ((A - B) % 2 == 0) {
      |   ^~
a.cc:6:3: error: expected unqualified-id before 'else'
    6 |   else if (A - 1 > N - b ) {
      |   ^~~~
a.cc:9:3: error: expected unqualified-id before 'else'
    9 |   else {
      |   ^~~~
a.cc:12:3: error: 'cout' does not name a type
   12 |   cout << M << endl;
      |   ^~~~
a.cc:13:1: error: expected declaration before '}' token
   13 | }
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'b' was not declared in this scope
   10 |   else if (A - 1 > N - b ) {
      |                        ^
a.cc:11:28: error: expected ';' before '}' token
   11 |     M = (A + B - 2) / 2 + 1
      |                            ^
      |                            ;
   12 |   }
      |   ~                         
a.cc:14:18: error: 'a' was not declared in this scope
   14 |     M = (2 * N - a - b) / 2 + 1
      |                  ^
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>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
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;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//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)
#define fore(i,a) for(auto &i:a)

//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;
 

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    long long N,A,B;
    cin >> N >> A >> B;
    long long kyori=B-A;
    long long ans=0;
    if(kyori%2==0){
    ans=kyori/2:
    }
    else{
    ans=min(A-1,N-B)+1+(B-A-1)/2;
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:16: error: expected ';' before ':' token
   92 |     ans=kyori/2:
      |                ^
      |                ;
Language: C++

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

int main(){
  long int N,A,B;
  cin>>N>>A>>B;
  if((A-B)%2==0){
    if(A-B>0){
      cout<<(A-B)/2<<endl;
    }else{
      cout<<(B-A)/2<<endl;
    }
  }else{
    if(A+B<N){
      cout<<(A+B-1)/2<<endl;
    }else{
      cout<<(2*N-A-B+1)/2;<<endl;
    }
  }
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: expected primary-expression before '<<' token
   17 |       cout<<(2*N-A-B+1)/2;<<endl;
      |                           ^~
Language: C++

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

        if(b==n)
        {
            cout<<b-a<<endl;
            return 0;
        }
        else if(a-1 == n-b)
        {
            cout<<n-a<<endl;
            return 0;
        }
        else if((a-1)<(n-b))
        {
            cout<<b-1<<endl;
            return 0;
        }
        else if((n-b)<(a-1))
        {
            cout<<n-a<<endl;
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: expected ';' before 'if'
   19 |             return 0;a
      |                       ^
      |                       ;
   20 | 
   21 |         if(b==n)
      |         ~~             
a.cc:26:9: error: expected '}' before 'else'
   26 |         else if(a-1 == n-b)
      |         ^~~~
a.cc:17:9: note: to match this '{'
   17 |         {
      |         ^