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

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

Compiler output:
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: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:8:25:   required from here
    8 |     if ((a+b+c)%2 == max(a, b, c)%2){
      |                      ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<cstdio>
#include<algorithm>
int main(){
  int a, b, c;
  int m = max(a, max(b, c));
  int d = m - a;
  d+= m-b; d+= m-c;
  if(d%2==0) printf("%d\n", d/2);
  else printf("%d\n", (d+3)/2);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:18: error: 'max' was not declared in this scope; did you mean 'std::max'?
    5 |   int m = max(a, max(b, c));
      |                  ^~~
      |                  std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:5:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
    5 |   int m = max(a, max(b, c));
      |           ^~~
      |           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)
      |     ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int x[3];
    x[0] = a;
    x[1] = b;
    x[2] = c;
    sort(x, x+3);

    int ma, mid, min;
    ma = x[2];
    mid = x[1];
    min = x[0];

    if ((ma-min)%2==0 && (ma-mid)%2==0){cout << (ma-mid)/2+(ma-min)/2;}
    if ((ma-min)%2==0 && (ma-mid)%2!=0){cout << (ma-mid+1)/2+(ma-min)/2+1;}
    if ((ma-min)%2!=0 && (ma-mid)%2==0){cout << (ma-mid)/2+(ma-min+1)/2+1;}
    if ((ma-min)%2!=0 && (ma-mid)%2!=0){cout << (ma-mid-1)/2+(ma-min-1)/2+1;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(x, x+3);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <cstring>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int l[3]={a,b,c};
  sort(l,l+3);
  
  int count=0;
  count+= l[2]-l[1];
  l[0]+=l[2]-l[1];
  int aa=l[2]-l[0];
  if(aa%2==0){
      count+=aa/2;
  }else{
      count+=(aa+1)/2+1;
  }
  cout<<count;


return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 |   sort(l,l+3);
      |   ^~~~
      |   short
Language: C++

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


int main()
{
 int A;
 int B;
 int C;
 
 cin>>A>>B>>C;
 
 int a=max({A,B,C});
 int c=min({A,B,C});
 int b=A+B+C-a-c;
 if((b-c)%2==0){
	 cout<<(b-c)/2+a+b<<endl;
     }else{
		 if((a-b)%2==0){
			 cout<<(a-b)/2+(a+1-c)/2+1<<endl;}
else{cout<<(a-c)/2+(a+1-b)/2+1<<endl;}}


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

#include <iostream>
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ma, mid, min;

    if (a <= b <= c){
        ma=c;
        mid=b;
        min=a;
        }
    if (b <= a <= c){
        ma=c;
        mid=a;
        min=b;;
        }
    if (a <= c <= b){
        ma=b;
        mid=c;
        min=a;
        }
    if (b <= c <= a){
        ma=a;
        mid=c;
        min=b;
        }
    if (c <= b <= a){
        ma=a;
        mid=b;
        min=c;
        }
    if (c <= a <= b){
        ma=b;
        mid=a;
        min=c;
        }

    if ((ma-min)%2==0 && (ma-mid)%2==0){cout << (ma-mid)//2+(ma-min)//2;}
    if ((ma-min)%2==0 && (ma-mid)%2!=0){cout << (ma-mid+1)//2+(ma-min)//2+1;}
    if ((ma-min)%2!=0 && (ma-mid)%2==0){cout << (ma-mid)//2+(ma-min+1)//2+1;}
    if ((ma-min)%2!=0 && (ma-mid)%2!=0){cout << (ma-mid-1)//2+(ma-min-1)//2+1;}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:57: error: expected ';' before 'if'
   40 |     if ((ma-min)%2==0 && (ma-mid)%2==0){cout << (ma-mid)//2+(ma-min)//2;}
      |                                                         ^
      |                                                         ;
   41 |     if ((ma-min)%2==0 && (ma-mid)%2!=0){cout << (ma-mid+1)//2+(ma-min)//2+1;}
      |     ~~                                                   
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:40:40: note: to match this '{'
   40 |     if ((ma-min)%2==0 && (ma-mid)%2==0){cout << (ma-mid)//2+(ma-min)//2;}
      |                                        ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[4];
	for(register int i=1;i,=3;i++)  cin>>a[i];
	sort(a+1,a+4);
	int ans=0;
	ans+=a[3]-a[2];
	a[2]+=a[3]-a[2];
	a[1]+=a[3]-a[2];
	if((a[3]%2)==(a[1]%2))  ans+=(a[3]-a[1]/2);
	else  ans+=(a[3]-a[1]/2)+2;
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    6 |         for(register int i=1;i,=3;i++)  cin>>a[i];
      |                          ^
a.cc:6:32: error: expected primary-expression before '=' token
    6 |         for(register int i=1;i,=3;i++)  cin>>a[i];
      |                                ^
Language: C

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[3];
		int ope=0;
		for(int i=0;i<3;i++)
			cin>>a[i];
			sort(a,a+3);
			int xc;
		xc=a[1]-a[0];
		if(xc%2==0)
		{
			ope+=(xc/2);
				ope+=a[2]-a[1];
		}
		else
		{
			ope+=(xc/2)+1;
			if(a[1]%2&&a[0]%2)
			{
				ope+=a[2]-a[1];
			}
			else
				ope+=a[2]-a[1]+1;
		}
		printf("%d\n",ope);
	return 0;
}

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

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[3];
	while(1)
	{
		int ope=0;
		for(int i=0;i<3;i++)
			cin>>a[i];
			sort(a,a+3);
			int xc;
		xc=a[1]-a[0];
		if(xc%2==0)
		{
			ope+=(xc/2);
				ope+=a[2]-a[1];
		}
		else
		{
			ope+=(xc/2)+1;
			if(a[1]%2&&a[0]%2)
			{
				ope+=a[2]-a[1];
			}
			else
				ope+=a[2]-a[1]+1;
		}
		printf("%d\n",ope);
	}
	return 0;
}

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

#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define rt0 return 0
using namespace std;
int main()
{
	int b=3;
	vector <int> a(b,0);
	cin>>a[0]>>a[1]>>a[2];
	sort(a.begin(),a.end());
	if(((a[2]-a[0])+(a[2]-a[1]))%2==0) cout<<((a[2]-a[0])+(a[2]-a[1]))/2;
	else cout<<((a[2]-a[0])+(a[2]-a[1])+3)/2;
    rt0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'vector' was not declared in this scope
   26 |         vector <int> a(b,0);
      |         ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <iostream>
  +++ |+#include <vector>
    5 | //#include <cfloat>
a.cc:26:17: error: expected primary-expression before 'int'
   26 |         vector <int> a(b,0);
      |                 ^~~
a.cc:27:14: error: 'a' was not declared in this scope
   27 |         cin>>a[0]>>a[1]>>a[2];
      |              ^
Language: C++

#include <iostream>
#include <vector>

int main(int argc, char *argv[]) {
  std::vector<uint16_t> A(3);

  std::cin >> A[0] >> A[1] >> A[2];

  std::sort(A.begin(), A.end());

  uint16_t count = A[2] - A[1];

  // A[0]とA[1]の差が偶数なら2で割った値をプラスする。
  // 奇数の場合は1足した値を2で割ってその値に1を足す(2個を+1する)
  if ((A[1] - A[0])%2 == 0) {
    count += (A[1] - A[0]) / 2;
  } else {
    count += (A[1] - A[0] + 1) / 2 + 1;
  }

  std::cout << count << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:5:15: error: 'uint16_t' was not declared in this scope
    5 |   std::vector<uint16_t> A(3);
      |               ^~~~~~~~
a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <vector>
  +++ |+#include <cstdint>
    3 | 
a.cc:5:23: error: template argument 1 is invalid
    5 |   std::vector<uint16_t> A(3);
      |                       ^
a.cc:5:23: error: template argument 2 is invalid
a.cc:7:16: error: invalid types 'int[int]' for array subscript
    7 |   std::cin >> A[0] >> A[1] >> A[2];
      |                ^
a.cc:7:24: error: invalid types 'int[int]' for array subscript
    7 |   std::cin >> A[0] >> A[1] >> A[2];
      |                        ^
a.cc:7:32: error: invalid types 'int[int]' for array subscript
    7 |   std::cin >> A[0] >> A[1] >> A[2];
      |                                ^
a.cc:9:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
    9 |   std::sort(A.begin(), A.end());
      |        ^~~~
      |        qsort
a.cc:9:15: error: request for member 'begin' in 'A', which is of non-class type 'int'
    9 |   std::sort(A.begin(), A.end());
      |               ^~~~~
a.cc:9:26: error: request for member 'end' in 'A', which is of non-class type 'int'
    9 |   std::sort(A.begin(), A.end());
      |                          ^~~
a.cc:11:11: error: expected ';' before 'count'
   11 |   uint16_t count = A[2] - A[1];
      |           ^~~~~~
      |           ;
a.cc:15:9: error: invalid types 'int[int]' for array subscript
   15 |   if ((A[1] - A[0])%2 == 0) {
      |         ^
a.cc:15:16: error: invalid types 'int[int]' for array subscript
   15 |   if ((A[1] - A[0])%2 == 0) {
      |                ^
a.cc:16:5: error: 'count' was not declared in this scope
   16 |     count += (A[1] - A[0]) / 2;
      |     ^~~~~
a.cc:16:16: error: invalid types 'int[int]' for array subscript
   16 |     count += (A[1] - A[0]) / 2;
      |                ^
a.cc:16:23: error: invalid types 'int[int]' for array subscript
   16 |     count += (A[1] - A[0]) / 2;
      |                       ^
a.cc:18:5: error: 'count' was not declared in this scope
   18 |     count += (A[1] - A[0] + 1) / 2 + 1;
      |     ^~~~~
a.cc:18:16: error: invalid types 'int[int]' for array subscript
   18 |     count += (A[1] - A[0] + 1) / 2 + 1;
      |                ^
a.cc:18:23: error: invalid types 'int[int]' for array subscript
   18 |     count += (A[1] - A[0] + 1) / 2 + 1;
      |                       ^
a.cc:21:16: error: 'count' was not declared in this scope
   21 |   std::cout << count << std::endl;
      |                ^~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
  int i,j;
  int a,b,c;
  int max=0,min=0,t=0;
  int d1,d2;
  int ans=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b && a>c){
    max = a;
    if(b>c){
      t=b;
      min=c;
    }else{
      t=c;
      min=b;
    }
  }else if(b>a && b>c){
    max=b;
    if(a>c){
      t=a;
      min=c;
    }else{
      t=c;
      min=a;
    }
  }else if(c>a && c>b){
    max=c;
    if(a>b){
      t=a;
      min=b;
    }else{
      t=b;
      min=a;
    }
  } 
  d1=max-min;d2=max-t;
  if(d1%2==1 && d2%2==1){
    ans+=(d1-d2)/2;
    ans += d2;
  }else if(d1%2==0 && d2%2==0){
    ans += (d1-d2)/2;
    ans += d2;
  }else if(d1%2==0 && d2%2==1){
    ans += (d1-d2)/2;
    ans += d2+2;
  }else{
    ans += (d1-d2)/2;
    ans += d1+1;
  printf("%d\n",ans);
  return 0;
}


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

#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a[2],d=0,count=0;
	for (int i = 0;i < 3;i++) {
		cin >> a[i];
	}
int ma= std::max(a[0],a[1],a[2]);
int mi = std::min(a[0], a[1], a[2]);
	for (int i = 0;i < 3;i++) {
		if (a[i] != ma || a[i] != mi) {
			 d = a[i];
		}
	}
	while ( d > ma) {
		mi++;
		d++;
		count++;
	}
	while (mi > ma) {
		mi = mi + 2;
		count++;
	}
	cout << count;
}
			

Compiler output:
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: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:9:17:   required from here
    9 | int ma= std::max(a[0],a[1],a[2]);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:10:18:   required from here
   10 | int mi = std::min(a[0], a[1], a[2]);
      |          ~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: Java

import java.util.*;
public class Main {
		public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
        int a[] =new int [3];
				int[1] = sc.nextInt();
				int[2] = sc.nextInt();
				int[3] = sc.nextInt();
				Arrays.sort(a);
				if((a[3]-a[1]+a[3]-a[2]) % 2 ==0){
						System.out.println((a[3] - a[1] + a[3] - a[2]) / 2);
				}
				else{
						a[3] += 1;
						a[2] += 1;
						System.out.println((a[3] - a[1] + a[3] - a[2]) / 2 + 1);
				}
		}
}


Compiler output:
Main.java:6: error: ']' expected
				int[1] = sc.nextInt();
				    ^
Main.java:6: error: not a statement
				int[1] = sc.nextInt();
				   ^
Main.java:7: error: ']' expected
				int[2] = sc.nextInt();
				    ^
Main.java:7: error: not a statement
				int[2] = sc.nextInt();
				   ^
Main.java:8: error: ']' expected
				int[3] = sc.nextInt();
				    ^
Main.java:8: error: not a statement
				int[3] = sc.nextInt();
				   ^
6 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  long A, B, C;

  std::cin >> A;
  std::cin >> B;
  std::cin >> C;

  std::vector<long> seq{A, B, C};
  std::sort(seq.begin(), seq.end());

  long diff21 = seq[2] - seq[1];
  long diff10 = seq[1] - seq[0];

  long ans;

  long ans = diff21;
  ans += diff10 / 2;
  ans += diff10 % 2 == 1 ? 2 : 0;

  std::cout << ans << std::endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: redeclaration of 'long int ans'
   20 |   long ans = diff21;
      |        ^~~
a.cc:18:8: note: 'long int ans' previously declared here
   18 |   long ans;
      |        ^~~
Language: Java

import java.util.*;
public class Main {
		public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
        int a[] =new int [3];
				Arrays.sort(a);
				if((a[3]-a[1]+a[3]-a[2]) % 2 ==0){
						System.out.println(a[3]-a[1]+a[3]-a[2]) / 2);
				}
				else{
						a[3] += 1;
						a[2] += 1;
						System.out.println(a[3]-a[1]+a[3]-a[2]) / 2 + 1);
				}


Compiler output:
Main.java:8: error: not a statement
						System.out.println(a[3]-a[1]+a[3]-a[2]) / 2);
						                                        ^
Main.java:8: error: ';' expected
						System.out.println(a[3]-a[1]+a[3]-a[2]) / 2);
						                                           ^
Main.java:13: error: not a statement
						System.out.println(a[3]-a[1]+a[3]-a[2]) / 2 + 1);
						                                            ^
Main.java:13: error: ';' expected
						System.out.println(a[3]-a[1]+a[3]-a[2]) / 2 + 1);
						                                               ^
Main.java:14: error: reached end of file while parsing
				}
				 ^
5 errors
Language: C++

#include<iostream>
using namespace std;
int main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  int d_1;
  d_1=a[2]-a[1];
  int b;
  b=a[0]+d;
  int d_2;
  if((a[2]-b)%2==0){
  d_2=(a[2]-b)/2;
  }
  else{
  d_2=(a[2]-b)/2+1;
  }
  int ans;
  ans=d_1+d_2;
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |   sort(a,a+3);
      |   ^~~~
      |   short
a.cc:10:10: error: 'd' was not declared in this scope
   10 |   b=a[0]+d;
      |          ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  a.sort();
  int d_1;
  d_1=a[2]-a[1];
  int b;
  b=a[0]+d;
  int d_2;
  if((a[2]-b)%2==0){
  d_2=(a[2]-b)/2;
  }
  else{
  d_2=(a[2]-b)/2+1;
  }
  int ans;
  ans=d_1+d_2;
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: request for member 'sort' in 'a', which is of non-class type 'int [3]'
    6 |   a.sort();
      |     ^~~~
a.cc:10:10: error: 'd' was not declared in this scope
   10 |   b=a[0]+d;
      |          ^
Language: C++

#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
using namespace std;

int n, arr[4];

int main()
{
	cin.sync_with_stdio(0);		cin.tie(0);		cout.tie(0);

	cin >> n;
	cin >> arr[1];
	cin >> arr[2];
	cin >> arr[3];
	
	while(true){
		sort(arr + 1, arr + n + 1);
		if(arr[1] == arr[2] && arr[2] == arr[3]) break;
		if(arr[1] + 2 <= arr[2]){
			arr[1] = arr[1] + 2;
		}else{
			arr[2] += 1;
			arr[1] += 1;
		}
		ans++;
	}
	printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |                 ans++;
      |                 ^~~
      |                 abs
a.cc:30:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |         printf("%d\n",ans);
      |                       ^~~
      |                       abs
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
//#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#define mod 998244353
#define PI acos(-1.0)
typedef long long ll;
typedef unsigned long long ull;
const int INF=0x3f3f3f3f;
//const ll INF=1000000000000000000;
//priority_queue<int, vector<int>, greater<int> >p;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b)swap(a,b);
    if(a>c)swap(a,c);
    if(b>c)swap(b,c);
    x=b-a;
    y=c-b;
    if(x%2||y%2)
    {
        cout<<x/2+y/2+1<<endl;
    }
    else
    {
        cout<<x/2+y/2<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'x' was not declared in this scope
   28 |     x=b-a;
      |     ^
a.cc:29:5: error: 'y' was not declared in this scope
   29 |     y=c-b;
      |     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long q,x,y,i=0; 
main(){
  cin>>q;
  while(i<q){
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
    i++;
  }
}


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:12: error: 'l' was not declared in this scope
   10 |     cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long q,x,y; 
main(){
  cin>>q;
  for(l i=0;i<q;i++){
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
  }
}


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:7: error: 'l' was not declared in this scope
    6 |   for(l i=0;i<q;i++){
      |       ^
a.cc:6:13: error: 'i' was not declared in this scope
    6 |   for(l i=0;i<q;i++){
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long
int main(){
  l q;cin>>q;
  for(l i=0;i<q;i++){
    l x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
  }
}


Compiler output:
a.cc:4:5: error: typedef may not be a function definition
    4 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long
main(){
  l q;cin>>q;
  for(l i=0;i<q;i++){
    l x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
  }
}


Compiler output:
a.cc:4:1: error: typedef may not be a function definition
    4 | main(){
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long l;
int main(){
  l q;cin>>q;
  for(ll i=0;i<q;i++){
    l x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: 'll' was not declared in this scope; did you mean 'l'?
    6 |   for(ll i=0;i<q;i++){
      |       ^~
      |       l
a.cc:6:14: error: 'i' was not declared in this scope
    6 |   for(ll i=0;i<q;i++){
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll q;cin>>q;
  for(ll i=0;i<q;i++){
    ll x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    
    long double k=sqrt(x*y-0.75)-x+0.5;
    ll lk=k;
    
    ans=x-1+k+(x*y-1)/(x+k);
    cout<<ans-(x!=y)<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     ans=x-1+k+(x*y-1)/(x+k);
      |     ^~~
      |     abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll q;cin>>q;
  for(ll i=0;i<n;i++){
    ll x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    ll ans=x-1;
    long double k=sqrt(x*y-0.75)-x+0.5;
    ll lk=k;
    ans+=k+(x*y-1)/(x+k);
    if(x==y)cout<<ans<<endl;
    else cout<<ans-1<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: 'n' was not declared in this scope
    6 |   for(ll i=0;i<n;i++){
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef vector<ll> vl;
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll q;cin>>q;
  rep(i,q){
    ll x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    ll ans=x-1;
    long double k=sqrt(x*y-0.75)-x+0.5;
    ll lk=k;
    ans+=k+(x*y-1)/(x+k);
    if(a[i]==b[i])cout<<ans<<endl;
    else cout<<ans-1<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: 'a' was not declared in this scope
   20 |     if(a[i]==b[i])cout<<ans<<endl;
      |        ^
a.cc:20:14: error: 'b' was not declared in this scope
   20 |     if(a[i]==b[i])cout<<ans<<endl;
      |              ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 1; ll z = 0, o = 1;
vl flag, color, D; vll path;
ll binarySearch(vl V, ll key) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = V.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は V.size()
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;
		if (V[mid] >= key) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
int main() {
	ll Q;
	cin >> Q;
	for (k = 0; k < Q; k++) {
		ll a, b;
		cin >> a >> b;
		if (a > b) swap(a, b);
		if (a == b) {
			cout << a - 1 << endl;
		}
		else {
				ll P = floor(sqrt(a * b-1));
				ll Q = P;
				if (P * (Q + 1) < a * b) Q++;
				debug(P, Q);
				ans = P + Q - 2;
				cout << ans << endl;
			}
		}
	}
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:20: error: 'n' was not declared in this scope
    6 |     for(int i=1;i<=n;i++)
      |                    ^
Language: C++

Q = gets.to_i
queries = Q.times.map { gets.split.map(&:to_i) }

queries.each do |a, b|
  a, b = [a, b].minmax

  if a == b
    puts 2 * a - 2
  elsif a + 1 == b
    puts 2 * a - 2
  else
    f = -> (c) { c ** 2 < a * b }

    ok = 1
    ng = 10 ** 18

    while (ok - ng).abs > 1
      mid = (ok + ng) / 2

      if f[mid]
        ok = mid
      else
        ng = mid
      end
    end

    if ok * (ok + 1) >= a * b
      puts 2 * ok - 2
    else
      puts 2 * ok - 1
    end
  end
end


Compiler output:
a.cc:1:1: error: 'Q' does not name a type
    1 | Q = gets.to_i
      | ^
a.cc:4:1: error: 'queries' does not name a type
    4 | queries.each do |a, b|
      | ^~~~~~~
a.cc:14:5: error: 'ok' does not name a type
   14 |     ok = 1
      |     ^~
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

using ll = long long;
const ll MOD = 998244353;

int main() {
    int Q;
    cin >> Q;
    rep(i, Q) {
        if (A * B == 1) {
            cout << 0 << endl;
            continue;
        }
        ll A, B, ans, s;
        cin >> A >> B;
        ans = sqrt(A * B - 1);
        s = ans;
        ans *= 2;
        if (A <= s) ans--;
        if (B <= s) ans--;
        if (s == (A * B - 1) / s) ans--;
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'A' was not declared in this scope
   12 |         if (A * B == 1) {
      |             ^
a.cc:12:17: error: 'B' was not declared in this scope
   12 |         if (A * B == 1) {
      |                 ^
Language: C++

#include <stdio.h>

using lli = long long int;

// (x, y) 開始の長さLのものについての最大値, すなわち max_{0≤d<L} (x+d)(y-d) 
lli f(lli x, lli y, lli L){
    // (x+d)(y-d) = -d^2 + (y-x)d + xy : 最大値は d = (y-x)/2付近
    lli e = (y - x) / 2;
    if(e < 0) return x * y;
    if(e < L) return (x + e) * (y - e);
    return (x + L - 1) * (y - (L - 1));
}

bool check(lli a, lli b, lli val){
    if(val < a) return true;
    lli x = 1, y = (val < b) ? val : val + 1;
    const lli inf_here = val + 3; // 移動距離は最大でも 1 <-> val + 1 の val+2
    while(true){
        lli xdis = (x > a) ? inf_here : a - x;
        lli ydis = (y < b) ? inf_here : y - b;
        lli L    = (xdis < ydis) ? xdis : ydis;
        // (x, y), ..., (x + L-1, y - (L-1)) :   ≒ [x, x+L) x [y, y-L)的なイメージ
        if(L == inf_here){
            L = val + 2 - x; // x -> val + 1へ移動
            if(f(x, y, L) >= a * b) return false;
            break;
        }
        if(f(x, y, L) >= a * b) return false;
        if((x += L) == a) ++x; // x = aはいけないので一つ増やす
        if((y -= L) == b) --y; // y = bはいけないので一つ減らす
    }
    return true;
}


int main(void){
    int Q; scanf("%d", &Q);
    while(Q--){
        int a, b; scanf("%d%d", &a, &b);
        if(a > b) std::swap(a, b); // a ≤ b を仮定

        // 二分探索
        lli ok = a-1, 
            ng = 2 * b; // 2b以上ペアは作れない(最大値をこのように設定しないとfの計算でオーバーフローが避けられない)
        while(ng - ok > 1){
            lli mid = (ok + ng) / 2;
            if(check(a, b, mid)) ok = mid;
            else ng = mid;
        }
        printf("%lld\n", ok);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:24: error: 'swap' is not a member of 'std'
   40 |         if(a > b) std::swap(a, b); // a ≤ b を仮定
      |                        ^~~~
Language: C++

#include <bits/stdc++.h>  // ver2.2.3
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){Vout(a[lY]);}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(iY,0,a.size()){Verr(a[iY]);}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int q;
  cin >> q;
  int n,m,memo,maxx1,maxx2;
  rep(i,0,q){
    cin >> n >> m;
    if(n==1) {cout<<(m-1)/2<<endl;continue;}
    if(m==1) {cout<<(n-1)/2<<endl;continue;}
    
    memo = n*m;
    
    maxx1 = 1;
    /*while(true){
      maxx1++;
      if(maxx1*maxx1 > memo) {maxx1--;break;}
    }*/
    maxx1 = sqrt(memo);
    
    maxx2 = maxx1;A
    if(maxx1 *(maxx1+1) < memo) maxx2++;
    
    //if(abs(n-m)==1) maxx2--;
    cerr << maxx1 <<' '<<maxx2<<endl;
    cout<<maxx1+maxx2-2<<endl;
  }
  return 0;
}

Compiler output:
a.cc:44:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   44 | void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
      |            ^~~~
a.cc: In function 'int main()':
a.cc:69:19: error: 'A' was not declared in this scope
   69 |     maxx2 = maxx1;A
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q,a,b;
  cin >> q;
  for (int i=0;i < q;i++){
    cin>> a>> b;
    long long res=sqrt(a*b-1),tmp=res;
    res*=2;
    res -= abs(a-b)==1;
    res -= (long long)(a!=b)+((double)tmp==sqrt(a*b-1));
    cout << max(res,0) << endl;
  }
}


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

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int q, a, b, c;
	cin >> q;
	while (q--)
	{
		cin >> a >> b;
		c = sqrt(1ll * a * b);
		if (1ll * c * c == 1ll * a * b)c--;
		if (1ll * c * (c + 1ll) >= 1ll * a * b)
			cout << 2ll * c - 2 << endl;
		else cout << 2ll * c - 1 << endl;
	}
	return 0;
}
/*https://www.cnblogs.com/widsom/p/8763564.html*/

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: 'sqrt' was not declared in this scope
   11 |                 c = sqrt(1ll * a * b);
      |                     ^~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int q; cin >> q;

    // case : 10 5 = 50
    // 1 * 49, 2 * 24, 3 * 16, 4 * 12, 5 * 9, 6 * 8, 7 * 7, 8 * 6, 9 * 5 (not), 
    // 10 * 4(not), 11 * 4, 12 * 4(not), 13 * 3, 14 * 3(not), 15 * 3(not), 16 * 3(not), 17 * 2, 18 * 2, 19 * 2, 20 * 2, 21 * 2, ..., 24 * 2, 25 * 1, ... 
    // ans : 12

    // c = a*b - 1
    // for(int i=1; i * i <= c; ++i) { long d = c / i; ans += (aが小さい場合); ans += (bが小さい場合) }
    // 可能な限り小さなa * 大きなb, 大きなa * 小さなbをcを超えないように選ぶ。
    // O(sqrt(c)) でできるが足りない。短縮する。
    // 結局 sqrt(c) * 2から、aが使われた場合、bが使われた場合、平方数が使われた場合それぞれ1を引けばいい？
    long a, b;
    while(q--) {
        cin >> a >> b;
        long c = a * b - 1;
        long d = (long)sqrt(c);
        long e = d * 2;
        if(a <= d) --e;
        if(b <= d) --e;
      
        // d * dはcを超えない最大の平方数か？
        long n1 = c - d * d, n2 = c - (d - 1) * d, n3 = c - (d + 1) * d;
        if(((n2 < 0) || (n1 < n2)) && ((n3 < 0) || (n1 < n3))) --e;
        cout << e << '\n';
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: 'sqrt' was not declared in this scope
   22 |         long d = (long)sqrt(c);
      |                        ^~~~
Language: C++

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

long long q,a,b;

main() {
	scanf("%lld", &q);
	while(q--) {
		scanf("%lld %lld", &a, &b);
		c=sqrt(a*b);
		if (a==b) printf("%lld\n", c*2-2);
		else printf("%lld\n", c*2-(c>=a)-(c>=b)-(c*(c+1)>=a*b)-(c*c==a*b));
	}
}

Compiler output:
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:17: error: 'c' was not declared in this scope
   10 |                 c=sqrt(a*b);
      |                 ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int N = 200 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

long long a, b;

bool read() {
    if (!(cin >> a >> b))
        return false;

    return true;
}

void solve() {
    cout << (long long) sqrtl(a * b - 1) - 1 + (a == b) + (a * b - 1) / (s + 1) << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int q;
    cin >> q;

    while (read())
        solve();

    return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:18:74: error: 's' was not declared in this scope
   18 |     cout << (long long) sqrtl(a * b - 1) - 1 + (a == b) + (a * b - 1) / (s + 1) << endl;
      |                                                                          ^
Language: C++

#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
#define fin {cout<<""<<endl;return 0;}
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<int> a(N),b(N);
  for(int i=0;i<N;i++)cin>>a[i]>>b[i];
  for(int i=0;i<N;i++){
    int K=a[i]*b[i];
    int l=0,h=MOD;
    while(h-l>1){
      int m=(h+l)/2;
      if(m*m<K)l=m;
      else r=m;
    }
    int ans=2*l;
    if(l*(l+1)>=K)ans--;
    if(l>=min(a[i],b[i]))ans--;
    cout<<ans<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'r' was not declared in this scope
   22 |       else r=m;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59


int main(){
  ll i,j;
  ll q;
  cin>>q;
  ll a,b;
  while(q--){
    cin>>a>>b;
    if(a>b) swap(a,b);
    if(a==b||a==b-1) {
      cout<<2*a-2<<endl;
      continue;
    }
    ll c=floor(sqrt(a*b)-(0.000000000000001));
    if(c*(c+1)>=a*b) {
      cout<<2*c-2<<endl;
    }
    else cout<<2*c-1<<endl;
  }
  

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

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;
const long Max = pow(10,2) + 1;
vector< vector<long> > p( Max, vector<long>(2, 0));
int main(){
    long q;
    cin >> q;
    long a,b,c;
    long res;
    for(int i=0; i<q; i++){
        cin >> p[i][0] >> p[i][1];
    }
    for( int i=0; i<q; i++){
        a = p[i][0];
        b = p[i][1];
        if( a > b){
            long tmp = a;
            a=b;
            b=tmp;
        }

        if( a == b){
            res = 2*a - 2;
        }else if( a+1 == b){
            res = 2*a - 2;
        }else{
            c = sqrt(a*b);
            if( c*c == a*b) c--;
            if( c*c+c >= a*b) res = 2*c-2;
            else res = 2*c-1;
        }
            cout << res <<endl;
    }
    return 0;
}


Compiler output:
a.cc:8:18: error: 'pow' was not declared in this scope
    8 | const long Max = pow(10,2) + 1;
      |                  ^~~
a.cc: In function 'int main()':
a.cc:32:17: error: 'sqrt' was not declared in this scope
   32 |             c = sqrt(a*b);
      |                 ^~~~
Language: C++

import numpy as np
Q=int(raW_input())

for i in range(Q):
	A,B=map(int,raw_input().split())
	C=np.ceil(np.sqrt(A*B))-1
	print C-1

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include<limits.h>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

//ll a[100] = {};
//ll b[100] = {};

int main() {
	ll q; cin >> q;
	ll a, b;

	rep(i, 0, q) {
		ll ans = 0;
		cin >> a >> b;
		if (a < b) swap(a, b);

		if (a == b || a == b + 1) {
			ans = 2 * a - 2;
		}
		else {
			ll c = (ll)sqrt(a*b);

			if (c < a*b) {
				ans = 2 * c - 1;
			}
			else {
				ans = 2 * c - 2;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: 'sqrt' was not declared in this scope
   26 |                         ll c = (ll)sqrt(a*b);
      |                                    ^~~~
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int Q;
	cin >> Q;

	long long A, B;
	for(int i=0; i<Q; i++){
		cin >> A >> B;

		if(A > B)
			swap(A, B);

		if(A == B)
			cout << 2 * (A-1) << endl;
		else{
			int c = sqrt(A*B);
			if(c*c == A*B)
				cout << 2*c - 3 << endl;
			else if(c*(c+1) >= A*B)
				cout << 2 * (c-1) << endl;
			else
				cout << 2*c - 1 << endl;
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:33: error: 'sqrt' was not declared in this scope
   22 |                         int c = sqrt(A*B);
      |                                 ^~~~
Language: C++

#include <cstdio>
#include <cmath>
typedef long long ll;

int main() {
    int q;
    scanf("%d", &q);

    for (int i = 0; i < q; i++) {
        int a, b, ans;
        scanf("%d %d", &a, &b);
        ll sq = (ll)floor(sqrt(((ll)a*b)));
        ll ans = 2 * (sq - 1);
        if (sq * sq < a * b) {
            ans += 1;   
            if (sq * (sq + 1) < a * b) {
                ans += 1;
            }
        }
        if (sq >= a ^ sq >= b) {
            ans -= 1;
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: conflicting declaration 'll ans'
   13 |         ll ans = 2 * (sq - 1);
      |            ^~~
a.cc:10:19: note: previous declaration as 'int ans'
   10 |         int a, b, ans;
      |                   ^~~
Language: C++

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

int Q;
vector<int> A, B;
int temp_a, temp_b;
void query(int id) {
	int num, count;
	num = sqrt((double)A[id] * (double)B[id]);
	long long count = 0;
	if(num != A[id] && num != B[id] && (num * num) < (A[id] * B[id])) {
		count++;
		if((num + 1) * num < A[id] * B[id] && (num + 1) != A[id] && (num + 1) != B[id])
			count++;
	}
	count += 2 * (num - 1);
	if(A[id] < num)
		count--;
	if(B[id] < num)
		count--;
	cout << count << endl;
}
int main() {
	cin >> Q;
	for(int i=0; i<Q; i++) {
		cin >> temp_a >> temp_b;
		A.push_back(temp_a);
		B.push_back(temp_b);
	}

	for(int i=0; i<Q; i++) {
		query(i);
	}

	return 0;
}

Compiler output:
a.cc: In function 'void query(int)':
a.cc:13:19: error: conflicting declaration 'long long int count'
   13 |         long long count = 0;
      |                   ^~~~~
a.cc:11:18: note: previous declaration as 'int count'
   11 |         int num, count;
      |                  ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>
#include<cstring>

using namespace std;


int main() {
	int q;
	cin >> q;
	long long a, b, m, ret;
	for (int i = 0; i < q; i++) {
		cin >> a >> b;
		if (a == b) {
			cout << 2 * (a - 1) << endl;
		}
		else {
			m = ceil(sqrt(a*b)) - 1;
			ret = 2 * m - 1;
			if (m*(m + 1) >= a * b && min(a,b) <= m) ret--;
			cout << ret << endl;
		}
	}


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:34: error: 'sqrt' was not declared in this scope
   21 |                         m = ceil(sqrt(a*b)) - 1;
      |                                  ^~~~
a.cc:21:29: error: 'ceil' was not declared in this scope
   21 |                         m = ceil(sqrt(a*b)) - 1;
      |                             ^~~~
Language: C++

#include<iostream>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){

int q;
cin >> q;

for(int i = 0; i<q; i++){

ll a,b;
cin >> a >> b;

ll c =   sqrt(a*b);         // cの2乗はa*bよりも小さい,最大の値をとる

if(a == b)                    cout << 2*(c-1) << endl; 
else if((a*b) == (c*c) )  cout << 2*(c-1)-1 << endl; 
else{ 
if(c*(c+1) < a*b)         cout << 2*c -1 << endl;
else                           cout << 2*c -2 << endl;
   }
 }
return 0;

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




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

using namespace std;

int main() {
	long Q;
	long i;
	long a[100];
	long b[100];

	cin >> Q;


	for (i = 0;i < Q;i += 1) {
		cin >> a[i] >> b[i];
	}
	if (a[i] > b[i]) {
		swap(a[i], b[i]);
		for (i = 0;i < Q;i += 1) {

			long c = sqrt(a[i] * b[i]);

			if (a[i] = b[i]) {
				cout << 2 * a[i] - 2 << endl;
			}



			if (a[i] + 1 == b[i]) {
				cout << 2 * a[i] - 1 << endl;
			}

			if (c*(c + 1) >= a[i] * b[i] && a[i] != b[i] && a[i] + 1 != b[i]) {
				cout << 2 * c - 2 << endl;
			}
			if (c ^ 2 < a[i] * b[i] && a[i] != b[i] && a[i] + 1 != b[i]) {
				cout << 2 * c - 1 << endl;
			}
		}
	}
	return 0;
}

















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

using namespace std;

int main() {
	long Q;
	long i;
	long a[100];
	long b[100];

	cin >> Q;


	for (i = 0;i < Q;i += 1) {
		cin >> a[i] >> b[i];
	}
	if (a[i] > b[i]) {
		swap(a[i], b[i]);
		for (i = 0;i < Q;i += 1) {

			long c = sqrt(a[i] * b[i]);

			if (a[i] = b[i]) {
				cout << 2 * a[i] - 2 << endl;
			}



			if (a[i] + 1 == b[i]) {
				cout << 2 * a[i] - 1 << endl;
			}

			if (c*(c + 1) >= a[i] * b[i] && a[i] != b[i] && a[i] + 1 != b[i]) {
				cout << 2 * c - 2 << endl;
			}
			if (c ^ 2 < a[i] * b[i] && a[i] != b[i] && a[i] + 1 != b[i]) {
				cout << 2 * c - 1 << endl;
			}
		}
	}
	return 0;
}















		
		

Compiler output:
a.cc:69:5: error: redefinition of 'int main()'
   69 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~