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

#include<stdio.h>
int c[3];

int main()
{
  //printf("enter the number of test case");
  int n=1;
  //scanf("%i",&n);
  

   for(int i=1;i<=n;i++)
  {
    int g=0;
     //printf("enter the three numbers");
     for(int j=0j<3;j++)

     scanf("%i",&c[j])
      if(c[0]==c[1]&&c[1]==c[2])
         printf("0");
        else
      {
 
      while(c[0]==c[1]&&c[1]==c[2])
      {
          int s=0;
         int e=0;
         int o=0;
          for(int h=0;h<2;h++)
           {
         if((c[h]-c[h+1])%2==0)
           {
             if(c[h]<c[h+1])
               {
               c[h]=c[h]+(c[h+1]-c[h]);
              s=s+(c[h+1]-c[h])/2;
                    }
             else
              {
               c[h+1]=c[h+1]+(c[h]-c[h+1]);
              s=s+(c[h]-c[h+1])/2;
              } 
            }
           else
          {           
              if(c[h]<c[h+1])
               {
                  int y=(c[h+1]-c[h]-1)/2;
                   
               c[h]=c[h]+(c[h+1]-c[h]-1);
               c[h+1]=c[h+1]+1;
              s=s+(c[h+1]-c[h]-1)/2+1;
                    }
             else
              {
              int y=(c[h]-c[h+1]-1)/2;
               c[h+1]=c[h+1]+(c[h]-c[h+1]);
               c[h]=c[h]+1;
              s=s+(c[h]-c[h+1]-1)/2+1;
              } 
            }
     }
  }
}
}
           
             
            
             
          
             


Compiler output:
main.c: In function 'main':
main.c:15:18: error: invalid operands to binary < (have 'complex int' and 'int')
   15 |      for(int j=0j<3;j++)
      |                  ^
main.c:15:24: error: expected ';' before ')' token
   15 |      for(int j=0j<3;j++)
      |                        ^
      |                        ;
main.c:17:23: error: expected ';' before 'if'
   17 |      scanf("%i",&c[j])
      |                       ^
      |                       ;
   18 |       if(c[0]==c[1]&&c[1]==c[2])
      |       ~~               
main.c:20:9: error: 'else' without a previous 'if'
   20 |         else
      |         ^~~~
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C

N=1
for t in range(N):
    x, y, z = list(map(int, input().split()))
    if (x == y and y == z):
        print(0)
        continue
    cost = 0
    l = sorted([x, y, z])

    cost += (l[2] - l[1])

    a = l[0] + l[2] - l[1]

    if (l[2] - a)%2 == 0:
        cost += (l[2] - a)//2
    else:
        cost += ((l[2] - a)//2 + 2)

    print(cost)
    


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N=1
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:2:1: error: expected ',' or ';' before 'for'
    2 | for t in range(N):
      | ^~~
Language: C++

#include <bits/stdc++.h>

int main() {
    int a, b, c, d, e, f, ans = 1;
    scanf("%d%d%d", &a, &b, &c), d = a&1, e = b&1, f = c&1;
    if(d == e && e == f) ans--;
    else if(d == e && e != f) a++, b++;
    else if(e == f && f != d) b++, c++;
    else if(f == d && d != e) c++, a++;
    ans += (3*max(a, max(b, c)) - a - b - c)/2;
    printf("%d", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'max' was not declared in this scope; did you mean 'std::max'?
   10 |     ans += (3*max(a, max(b, c)) - a - b - c)/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,
                 from a.cc:1:
/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:10:15: error: 'max' was not declared in this scope; did you mean 'std::max'?
   10 |     ans += (3*max(a, max(b, c)) - a - b - c)/2;
      |               ^~~
      |               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 <bits/stdc++.h>

using namespace std;
long long a, b;
int n;
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a >> b;
        if(a == b){
            cout << max(a * b - 2, 0) << '\n';
        }
        else{
            long long c, l = 0, r = 1e9;
            while(r - l > 1){
                long long mid = (r + l) / 2;
                if(mid * mid  < a * b){
                    l = mid;
                }
                else{
                    r = mid;
                }
            }
            if(r * r < a * b){
                c = r;
            }
            else{
                c = l;
            }
            if(!c){
                cout << 0 << '\n';
            }
            else if(c * (c + 1) < a * b){
               cout << 2 * c - 1 << '\n';
            }
            else{
                cout << 2 * c - 2 << '\n';
            }
        }
    }
}


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

#include <iostream>
using namespace std;
int a[3];
int main() {
    for(int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    sort(a, a + 3);
    int n = a[2] - a[0], m = a[2] - a[1];
    int rem = n - m;
    if(rem % 2) m += rem / 2 + 2;
    else m += rem / 2;
    cout << m << endl;
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: expected ',' or ';' before 'cin'
    5 |   cin>>a>>b>>c;
      |   ^~~
Language: C++

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


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> A >> B >> C;
      |     ^~~
a.cc:6:19: error: 'max' was not declared in this scope
    6 |     int a = max(A,max(B,C));
      |                   ^~~
a.cc:6:13: error: 'max' was not declared in this scope
    6 |     int a = max(A,max(B,C));
      |             ^~~
a.cc:7:19: error: 'min' was not declared in this scope; did you mean 'main'?
    7 |     int c = min(A,min(B,C));
      |                   ^~~
      |                   main
a.cc:7:13: error: 'min' was not declared in this scope; did you mean 'main'?
    7 |     int c = min(A,min(B,C));
      |             ^~~
      |             main
a.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout << (2*a - b - c)/2;
      |         ^~~~
a.cc:12:9: error: 'cout' was not declared in this scope
   12 |         cout << (2*a - b - c - 1)/2 + 2 ;
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int len,ans;
long long  dp[200005][3][3][2];
char t[200005];
#define mo 998244353
int hash(char c[]){
	int ans=0;
	for(int i=0;i<strlen(c);i++)
		ans=10*ans+c[i]-'a'+1;
	return ans;
}
bool vis[100000];
int wei(int t,int w){
	t=t/(pow(10,w-1));
	return t%10;
}
void doit(){
	int ans=1;
	queue<int> q;
	q.push(hash(t));
	vis[hash(t)]=1;
	while(!q.empty()){
		int s=q.front();q.pop();
		for(int i=2;i<=len;i++){
			int u=wei(s,i),v=wei(s,i-1),a1=6-u-v;
			if(u==v) continue;
			int k=s+( a1-wei(s,i) )*pow(10,i-1)+(a1-wei(s,i-1))*pow(10,i-2);
			if(!vis[k]){
				vis[k]=1;
				q.push(k);ans++;
			}
		}
	}
	cout<<ans;
}
int main()
{
	
	scanf("%s",t);
	len=strlen(t);
	int sum=0;
	for(int i=0;i<len;i++)
		sum+=t[i]-'a';
	sum%=3;
	
	bool h=1;
	for(int i=1;i<len;i++)
		 if(t[i]!=t[i-1]) h=0;
	if(h) {cout<<1;return 0;}
	
	if(len<=3) {doit();return 0;}
	for(int i=0;i<=2;i++)
		dp[1][i][i][0]=1;
	for(int i=2;i<=len;i++){
		for(int p=0;p<=2;p++)
		for(int j=0;j<=2;j++)
		for(int k=0;k<=2;k++){
			if(p==j)
				dp[i][p][(k+p)%3][1]+=dp[i-1][j][k][0];	
			else 
				dp[i][p][(k+p)%3][0]+=dp[i-1][j][k][0];
			dp[i][p][(k+p)%3][1]+=dp[i-1][j][k][1];
			dp[i][p][(k+p)%3][1]%=mo;
			dp[i][p][(k+p)%3][0]%=mo;
		}
	}
	for(int i=0;i<=2;i++)
		ans+=dp[len][i][sum][1];
	int flag=1;
	for(int i=1;i<len;i++)
		if(t[i]==t[i-1]) flag=0;
	cout<<(ans+flag)%998244353;
	
	return 0;
}

Compiler output:
a.cc: In function 'void doit()':
a.cc:21:16: error: reference to 'hash' is ambiguous
   21 |         q.push(hash(t));
      |                ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:7:5: note:                 'int hash(char*)'
    7 | int hash(char c[]){
      |     ^~~~
a.cc:22:13: error: reference to 'hash' is ambiguous
   22 |         vis[hash(t)]=1;
      |             ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:7:5: note:                 'int hash(char*)'
    7 | int hash(char c[]){
      |     ^~~~
Language: C++

-- same-integers.hs --- Same Integers

-- author: Seong Yong-ju <sei40kr@gmail.com>

solve :: Int -> Int -> Int -> Int
solve a b c = if mod m 2 == mod s 2 then quot (3 * m - s) 2 else quot (3 * (m + 1) - s) 2
  where
    s = a + b + c
    m = max a $ max b c

main :: IO ()
main = do
  line <- readLn
  print $ solve (read line :: Int) (read line :: Int) (read line :: Int)


Compiler output:
a.cc:3:34: error: stray '@' in program
    3 | -- author: Seong Yong-ju <sei40kr@gmail.com>
      |                                  ^
a.cc:1:1: error: expected unqualified-id before '--' token
    1 | -- same-integers.hs --- Same Integers
      | ^~
Language: C++

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int arr[3];
pair<int,int> lowest2()
{
    vector<int> bb;
    bb.push_back(arr[0]);
    bb.push_back(arr[1]);
    bb.push_back(arr[2]);
    sort(bb.begin(),bb.end());
    return {bb[0],bb[1]};
}
int main()
{
    cin >> arr[0] >> arr[1] >> arr[2];
    int f = 0;
    while(true)
    {
        if(arr[0] == arr[1] && arr[1] == arr[2])
            break;
        f++;
        pair<int,int> lo = lowest2();
        if(max(arr[0],max(arr[1],arr[2])) - lo.second >= 1)
        {
            for(int i = 0;i < 3;i++)
            {
                if(lo.second == arr[i])
                {
                    arr[i]++;
                    break;
                }
            }
            for(int i = 0;i < 3;i++)
            {
                if(lo.first == arr[i])
                {
                    arr[i]++;
                    break;
                }
            }
        } else {
            for(int i = 0;i < 3;i++)
            {
                if(lo.first == arr[i])
                {
                    arr[i] += 2;
                    break;
                }
            }
        }
    }
    cout << f;
    return 0;
}


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

int main() {
    using namespace std ;
    using ll = long long;
    vector<ll> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    ll ans = a[2] - a[1];
    ll aaa = (a[2] - (a[0] + ans)) / 2 ;
    cout << ans + aaa + (aaa * 2 + a[0] + ans != a[2] ? 2 : 0) << endl ;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<ll> a(3);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | int main() {
a.cc:4:14: error: expected primary-expression before '>' token
    4 |     vector<ll> a(3);
      |              ^
a.cc:4:16: error: 'a' was not declared in this scope
    4 |     vector<ll> a(3);
      |                ^
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> a[0] >> a[1] >> a[2];
      |     ^~~
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:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |     sort(a.begin(), a.end());
      |     ^~~~
      |     short
a.cc:9:5: error: 'cout' was not declared in this scope
    9 |     cout << ans + aaa + (aaa * 2 + a[0] + ans != a[2] ? 2 : 0) << endl ;
      |     ^~~~
a.cc:9:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:67: error: 'endl' was not declared in this scope
    9 |     cout << ans + aaa + (aaa * 2 + a[0] + ans != a[2] ? 2 : 0) << endl ;
      |                                                                   ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main() {
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define lg long long
int main(){
	int T;
	cin>>T;
	for(int i=1;i<=n;i++){
		lg x,y;
		cin>>x>>y;
		lg t=sqrt(x*y-1);
		if(t*t>=x*y) t--;
		lg res=t*2;
		if(t*(t+1)>=(x*y))--res;
		if(t>=x)--res;
		if(t>=y)--res;
		cout<<res<<'\n';
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: 'n' was not declared in this scope
    7 |         for(int i=1;i<=n;i++){
      |                        ^
a.cc:18:18: error: expected '}' at end of input
   18 |         return 0;
      |                  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include "stdafx.h"
#include<iostream>
#include<vector>

int main()
{
	std::vector<int> num;
	num.resize(3);
	int iter = 0;
	std::cin >> num[0] >> num[1] >> num[2];
	//最大求める
	int max;
	std::vector<bool> f;
	f.resize(3, false);

	if (num[0] > num[1]) {
		max = num[0];
		f[0] = true;
	}
	else {
		max = num[1];
		f[1] = true;

	}
	if (max < num[2]) {
		f[2] = true;

		max = num[2];
	}
	int t;//max num
	for (int i = 0; i < 3; ++i) {
		if (f[i])t = i;
	}
	bool ex = true;
	while (true)
	{
		if (num[0] == num[1] && num[0] == num[2])break;//ok
		
		if (num[t] == num[(t + 1) % 3] || num[t] == num[(t + 2) % 3]) {
			int s = 2 * num[t] - num[(t + 1) % 3] - num[(t + 2) % 3];
			while (ex)
			{
				s -= 2;
				iter++;
				if (s == -1)iter++; ex = false;
				if (s == 0)ex = false;
			}
		}

		if (!ex)break;

		for (int i = 0; i < 3;++i) {
			if (f[i])continue;
			num[i]++;
		}
		iter++;
	}
	std::cout << iter << std::endl;
    return 0;
}


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

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
int Q;
LL a,b;
int main(){
  scanf("%d",&Q);
  while(Q--){
    scanf("%lld%lld",&a,&b);
    if(a>b) swap(a,b);
    LL m=sqrt(a*b-1),t=(a*b-1)/m-1;
    printf("%lld\n",m+t-1);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'sqrt' was not declared in this scope
   12 |     LL m=sqrt(a*b-1),t=(a*b-1)/m-1;
      |          ^~~~
a.cc:13:23: error: 't' was not declared in this scope
   13 |     printf("%lld\n",m+t-1);
      |                       ^
Language: C++

#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#define ll long long

using namespace std;

ll q,a,b; 

int main(){
	
	cin>>q;
	while(q){
		cin>>a>>b;
		if(a==1&&b==1){
			cout<<0<<endl;
			1--;continue;
		}
		ll min1=min(a,b);
		ll x=sqrt(a*b)+100;
		while(x*x>(a*b)-1)x--;
		ll ans=2*x;
		if(x>=min1)ans--;
		if(x==((a*b)-1)/x)ans--;
		cout<<ans<<endl;

		q--;
	}


	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: lvalue required as decrement operand
   21 |                         1--;continue;
      |                         ^
Language: C++

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

int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    int ans = a[2]-a[1])/2 + (a[2]-a[0])/2;
    if((a[2]-a[1])& && 1(a[2]-a[0])&1){ans += 1;}
    else if((a[2]-a[1])&1 || (a[2]-a[0])&1){ans += 2;}
    cout << ans << endl;
    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: expected ',' or ';' before ')' token
   10 |     int ans = a[2]-a[1])/2 + (a[2]-a[0])/2;
      |                        ^
a.cc:11:24: error: expected identifier before numeric constant
   11 |     if((a[2]-a[1])& && 1(a[2]-a[0])&1){ans += 1;}
      |                        ^
a.cc:11:23: error: expected ')' before numeric constant
   11 |     if((a[2]-a[1])& && 1(a[2]-a[0])&1){ans += 1;}
      |       ~               ^~
      |                       )
Language: C++

#include <bits/stdc++.h>
#include <conio.h>
#define ll long long
#define ld double
#define oo 2000000000
#define ull unsigned long long
#define ui unsigned int
#define uc unsigned char
#define zero 1E-6
#define vi vector<int>
#define vii vector<ii>
#define ii pair<int,int>
#define mii map<int,int>
#define msi map<string,int>
#define miii map<int,int>::iterator
#define fto(i,x,y) for(i=(x);i<=(y);i++)
#define fdto(i,x,y) for(i=(x);i>=(y);i--)
#define ftoi(i,x,y) for(int i=(x),__dest=(y);i<=__dest;i++)
#define fdtoi(i,x,y) for(int i=(x),__dest=(y);i>=t;i--)
#define upn(i,x) for(int i=1,__dest=(x);i<=__dest;i++)
#define cto(it,x) for(auto it=x.begin();it!=x.end();++it)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
#define upb upper_bound
#define lob lower_bound
#define eqr equal_range
#define ins insert
#define rm remove
#define ers erase

#define cppio cin.sync_with_stdio (0); cin.tie (0); cout.tie (0);
#define bug(x) cout<<#x<<':'<<x<<' ';
#define abug(a,x,y) {ftoi(i,x,y){cout<<a[i]<<' ';} cout<<'\n';}

using namespace std;

void swap (int& a, int& b) {
	int t = a;
	a = b;
	b = t;
}
int main () {
	int A, B, C;
	cin >> A >> B >> C;
	int M = A + B + C;
	int mx = A;
	if (mx < B) mx = B;
	if (mx < C) mx = C;
	int X = M;
	while ((X/3 < mx) || (X % 3) || (X % 2 != M % 2))
		X += 2;
	cout << (X - M) / 2;
}

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

#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int n;cin>>n;
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a==b){
      cout<<2*(a-1)<<endl;
      continue;
      }
    if(a>b)swap(a,b);
    ll ret=sqrt(a*b);
    ans=ret+(a*b)/ret-2;
    cout<<ans<<endl;
    }
  
  return 0;
  }


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

#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<cmath>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#define max(x,y) x>y?x:y
#define min(x,y) x<y?x:y
using namespace std;
const int maxn=1e5+10;
const int maxm=6*1e5+10;
const int gg=0x7FFFFFFF;
int a,b,c;
int main()
{
    int p[4];
    while(scanf("%d%d%d",&p[0],&p[1],&p[2]))
    {

        sort(p,p+3);
        a=p[0]; b=p[1]; c=p[2];
        //cout<<"a="<<a<<" b="<<b<<" c="<<c<<endl;
        int ans=0;
        ans=c-b;
        int t=0;
        if((b-a)%2==1)
        {
            ans+=(b-a+1)/2+1;
        }
        else
        {
            ans+=(b-a)/2;
        }
        printf("%d\n",ans );
    }
    
}

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

#include<bits/stdc++.h>
2.using namespace std;
3.int main()
4.{
5.	int a[4];
6.	scanf("%d%d%d",&a[0],&a[1],&a[2]);
7.	sort(a,a+2);
8.	int ans=0;
9.	while(a[1]+2<a[2]) a[1]+=2,ans++;
10.	 while(a[0]+2<a[2]) a[0]+=2,ans++;
11.	int k1=a[1]==a[2],k2=a[0]==a[2];
12.	if(k1==0&&k2==0) ans++;
13.	else if(k1^k2) ans+=2;
14.	cout<<ans;
15.	return 0;
16.}


Compiler output:
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2.using namespace std;
      | ^~~~~~~
a.cc:3:1: error: expected unqualified-id before numeric constant
    3 | 3.int main()
      | ^~~~~
Language: C++

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

int A, B, C, now, ans = 1e9;

int main() {
	scanf("%d%d%d", &A, &B, &C);
	for (int i=-50; i<=100; i++) {
		now = 0;
		if (i < A) now += A - i;
		else {
			now += (i - A + 1) / 2;
			if ((i-A)&1) now++;
		}
		// printf("%d %d\n", i, now);
		if (i < B) now += B - i;
		else {
			now += (i - B + 1) / 2;
			if ((i-B)&1) now++;
		}
		// printf("%d %d\n", i, now);
		if (i < C) now += C - i;
		else {
			now += (i - C + 1) / 2;
			if ((i-C)&1) now++;
		}31 41 5
		
		// printf("%d %d\n", i, now);
		ans = min(ans, now);
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: expected ';' before numeric constant
   26 |                 }31 41 5
      |                    ^~~
      |                    ;
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void){
    int A, B, C;
    
    cin >> A >> B >> C;
    vector<int> P;
    P.push_back(A);
    P.push_back(B);
    P.push_back(C);
    sort(P.begin(), P.end());
    int count = 0;
    while(P[0] != P[1] || P[1] != P[2]){
        count++;
        if(P[2] == P[1] + 1 && P[2] == P[0] + 1)
            break;
        P[0] += 2;
        sort(P.begin(), P.end());
    }
    cout << count << endl;
    
}


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

#include <iostream>
#include <list>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include<iterator>
#include <cstdlib>
using namespace std;

int a,b,c;
int i=0;

int main (){
cin>>a>>b>>c;

int min=min(a,b,c);
a=a-min;
b=b-min;
c=c-min;
int max=max(a,b,c);

int ans=2*max-a-b-c;

if(ans%=2){
  cout<<ans;
}else{
cout<<ans+2;
}

return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'min' cannot be used as a function
   17 | int min=min(a,b,c);
      |         ~~~^~~~~~~
a.cc:21:12: error: 'max' cannot be used as a function
   21 | int max=max(a,b,c);
      |         ~~~^~~~~~~
Language: C++

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

int main() {
  vector<int> a(3); for (int i = 0; i < 3; ++i) cin >> a[i];
  int ans = 0;
  sort(begin(a), end(a));
  int d1 = a[2] - a[1];
  ans += d1;
  a[0] += d1;
  a[1] += d1;
  int d2 = a[2] - a[0];
  ans += d / 2;
  if (d % 2) ans += 2;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'd' was not declared in this scope; did you mean 'd2'?
   13 |   ans += d / 2;
      |          ^
      |          d2
Language: C++

#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define Rint register int
#define mem(a,b) memset(a,(b),sizeof(a))
using namespace std;
typedef long long LL;
template<typename T>inline void read(T &x){
    x=0;T w=1,ch=getchar();
    while(!isdigit(ch)&&ch!='-')ch=getchar();
    if(ch=='-')w=-1,ch=getchar();
    while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
    x=x*w;
}
inline void File(){
    freopen("fuck.in","r",stdin);
    freopen("fuck.out","w",stdout);
}
int main(){
	//File();
	int a[4];
	scanf("%d%d%d",&a[1],&a[2],&a[3]);
	sort(a+1,a+4);
	int z=a[3]-a[2];
	a[2]+=z;a[1]+=z;
	int q=a[3]-a[1];
	if(q&1)printf("%d\n",q/2+z+2);
	else printf("%d\n",q/2+z);
	return 0;


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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Solution {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
            int[] arr = {a, b, c};
            Arrays.sort(arr);
            int answer = arr[2] - arr[1];
            arr[0] += answer;
            arr[1] += answer;
            while (arr[0] < arr[2]) {
                arr[0] += 2;
                answer++;
            }
            if (arr[0] != arr[2]) answer++;
            out.println(answer);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

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

int main(){
    int q; cin >> q;
    while(q--){
        ll a, b; cin >> a >> b; if(a < b) swap(a,b); // a >= b
        if(a-b == 0) cout << 2*(b-1) << endl;
        else if(a-b == 1) cout << 2*(b-1) << endl;
        else{
            ll k = (ll)sqrt(a*b);
            // if(k*k == a*b) cout << 2*k-3 << endl;
            else if(k*(k+1) < a*b) cout << 2*k-1 << endl;
            else cout << 2*k-2 << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'else' without a previous 'if'
   14 |             else if(k*(k+1) < a*b) cout << 2*k-1 << endl;
      |             ^~~~
Language: C++

from math import *

Q = int(input())
r = []
for x in range(Q):
  A = [int(i) for i in input().split(' ')]
  x = A[0] * A[1]
  s = floor(sqrt(x))
  if s*s == x:
    if (A[0] != s): r.append(2*s - 3)
    else: r.append(2*s-2)
  elif (s*(s+1) < x):
    r.append(2*s - 1)
  else: 
    r.append(2*s - 2)

for i in r:print(i)

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000ll
#define LLINF 2000000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
ll A,B,K;
ll f(ll k){
	ll ret = 1ll;
	if(k>=A)ret *= k+1ll;
	else ret *= k;
	if(K>=B){
		ll mul = K+2ll-k;
		if(k<=K-B+1ll){
			if(LLINF/ret+1ll<mul)ret = LLINF;
			else ret *= mul;
		}else{
			mul--;
			if(LLINF/ret+1ll<mul)ret = LLINF;
			else ret *= mul;
		}
	}else{
		if(LLINF/ret+1ll<mul)ret = LLINF;
		ret *= K+1ll-k;
	}
}
bool check(ll x){
	K = x;
	ll l=1ll,r=x;
	while(r-l>2ll){
		ll m = (l*2ll+r)/3ll;
		ll n = (l+r*2ll)/3ll;
		if(f(m)<f(n))l=m;
		else r=n;
	}
	ll mx = max(max(f(l),f(r)),f(l+1));
	return mx<(A*B);
}
ll solve(){
	ll l = 0ll,r = A*B;
	while(r-l>1ll){
		ll mid = (l+r)/2ll;
		if(check(mid))l=mid;
		else r = mid;
	}
	return l;
}
int Q;
int main(){
	cin >> Q;
	for(int i=0;i<Q;i++){
		cin >> A >> B;
		cout << solve() << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'll f(ll)':
a.cc:37:34: error: 'mul' was not declared in this scope; did you mean 'fmul'?
   37 |                 if(LLINF/ret+1ll<mul)ret = LLINF;
      |                                  ^~~
      |                                  fmul
a.cc:40:1: warning: no return statement in function returning non-void [-Wreturn-type]
   40 | }
      | ^
Language: C++

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int n;
ll a[200010];
ll b[200010];

int main ()
{
    cin >> n;
    REP(i,n) cin >> a[i] >> b[i];

    REP(i,n) {
        ll sq  = (ll)sqrt(a[i] * b[i]);
        ll ans = (a[i] * b[i] - (a[i] != b[i])) / ret + ret - 2;
        cout << ans << endl; 
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:51: error: 'ret' was not declared in this scope
   39 |         ll ans = (a[i] * b[i] - (a[i] != b[i])) / ret + ret - 2;
      |                                                   ^~~
Language: C++

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int n;
ll a[200010];
ll b[200010];

int main ()
{
    cin >> n;
    REP(i,n) cin >> a[i] >> b[i];

    REP(i,n) {
        ll sq  = (ll)sqrt(a * b);
        ll ans = (a * b - (a != b)) / ret + ret - 2;
        cout << ans << endl; 
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:29: error: invalid operands of types 'll [200010]' {aka 'long long int [200010]'} and 'll [200010]' {aka 'long long int [200010]'} to binary 'operator*'
   38 |         ll sq  = (ll)sqrt(a * b);
      |                           ~ ^ ~
      |                           |   |
      |                           |   ll [200010] {aka long long int [200010]}
      |                           ll [200010] {aka long long int [200010]}
a.cc:39:21: error: invalid operands of types 'll [200010]' {aka 'long long int [200010]'} and 'll [200010]' {aka 'long long int [200010]'} to binary 'operator*'
   39 |         ll ans = (a * b - (a != b)) / ret + ret - 2;
      |                   ~ ^ ~
      |                   |   |
      |                   |   ll [200010] {aka long long int [200010]}
      |                   ll [200010] {aka long long int [200010]}
a.cc:39:39: error: 'ret' was not declared in this scope
   39 |         ll ans = (a * b - (a != b)) / ret + ret - 2;
      |                                       ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
long long a, b;
int n;
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a >> b;
        if(a == b){
            cout << max(a * b - 2, 0ll) << '\n';
        }
        else{
            long long c, l = 0, r = 1e9;
            while(r - l > 1){
                long long mid = (r + l) / 2;
                if(mid * mid  < a * b){
                    l = mid;
                }
                else{
                    r = mid;
                }
            }
            if(r * r < a * b){
                c = r;
            }
            else{
                c = l;
            }
            else if(c * (c + 1) < a * b){
               cout << max(2 * c - 1, 0ll) << '\n';
            }
            else{
                cout << max(2 * c - 2, 0ll) << '\n';
            }
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'else' without a previous 'if'
   30 |             else if(c * (c + 1) < a * b){
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
int main() {
    using namespace std ;
    using ll = long long;
  ll q; cin >> q;
    while(q—){
        ll a , b; cin  >> a  >> b;
        if ( a> b ) swap( a,b);
ll x = sqrt(a*b);
         cout << 2 * x - 1 - (x * (x + 1) == a* b) * 2 <<  endl;
}
}

Compiler output:
a.cc:6:11: error: extended character — is not valid in an identifier
    6 |     while(q—){
      |           ^
a.cc: In function 'int main()':
a.cc:6:11: error: 'q\U00002014' was not declared in this scope
    6 |     while(q—){
      |           ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define lg long long
int main(){
	int T;
	cin>>T;
	for(int i=1;i<=n;i++){
		lg x,y;
		cin>>x>>y;
		lg t=sqrt(x*y-1);
		if(t*t>=x*y) t--;
		lg res=t*2;
		if(t*(t+1)>=(x*y))--res;
		if(t>=x)--res;
		if(t>=y)--res;
		cout<<res<<'\n';
	}
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	long long a[n];
	for(int i=0;i<n;i++)
	{
		long long x,y,m;
		cin>>x>>y;
		long long t=sqrt(x*y-1);
		if(t*t>=x*y1) t--;
		a[i]=t*2;
		if(t*(t+1)>=(x*y))
		a[i]--;
		if(t>=x)
		a[i]--;
		if(t>=y)
		a[i]--;
	}
	for(int i=0;i<n;i++)
	cout<<a[i]<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: invalid operands of types 'long long int' and 'double(double) noexcept' to binary 'operator*'
   13 |                 if(t*t>=x*y1) t--;
      |                         ~^~~
      |                         | |
      |                         | double(double) noexcept
      |                         long long int
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define N 
#define ll long long
#define db double
#define eps 1e-9
#define dbg1(x) cout<<#x<<"="<<x<<" "
#define dbg2(x) cout<<#x<<"="<<x<<"\n"
int T;ll a,b,ans;
//db cal(ll x) {return (-(ll)b*x-1)*1./(a+x);}
db cal(ll x) {return -b*1.0/(a+x)*x-1./(a+x);}
int main()
{
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	for(scanf("%d",&T);T--;)
	{
		scanf("%lld%lld",&a,&b),ans=0;
		if(a<b) swap(a,b);
		if(a==1&&b==1) {puts("0");continue;}
		if(b>=30000000)
		{
			ll dd=sqrt(1ll*a*b),ans=dd*2-1;
			if(dd*dd==1ll*a*b)
			{
				if(a==b)ans--;
				else ans-=2;
			}
			else if(dd*(dd+1)>=1ll*a*b)ans--;
			cout<<ans<<endl;
			continue;
		}
		for(ll x=-a+1,y,tmp;;x++)
		{
			tmp=floor(((ll)-b*x-1)*1./(a+x));
			dbg1(x),dbg2(tmp);
			if(tmp==-b) break;
			if(tmp)
			{
				if(tmp^last) ans++,last=tmp;
				else
				{
					ans+=tmp+b-1;
					if(tmp>0) ans--;
					break;
				}
			}
		}
		dbg2(ans);*/
		ll l=-a+1,r=2e9,mid;
		for(;l<r;)
		{
			mid=l+r>>1;
//			dbg2(mid);
//			dbg1(cal(mid+1)),dbg2(cal(mid));
			cal(mid)-cal(mid+1)-1<-eps?r=mid:l=mid+1;
		}
//		dbg2(l);
		ll tmp1=floor((-(ll)b*l-1)*1./(a+l));
		ans=l+a+tmp1+b-1;
		if(l==-a+1)
		{
			if(tmp1>=0) ans--;
			cout<<ans<<"\n";
			continue;
		}
		ll tmp2=floor((-(ll)b*(l-1)-1)*1./(a+l-1));
//		dbg1(l-1),dbg1(cal(l-1)),dbg2(tmp2);
//		dbg1(l),dbg1(cal(l)),dbg2(tmp1);
//		dbg1(tmp1),dbg2(tmp2);
		if(tmp1>=0||tmp2<=0) ans--;
//		printf("%lld\n",ans);
		cout<<ans<<"\n";
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:40: error: 'last' was not declared in this scope
   50 |                                 if(tmp^last) ans++,last=tmp;
      |                                        ^~~~
a.cc:59:28: error: expected primary-expression before '/' token
   59 |                 dbg2(ans);*/
      |                            ^
a.cc:14:12: error: expected primary-expression before 'long'
   14 | #define ll long long
      |            ^~~~
a.cc:60:17: note: in expansion of macro 'll'
   60 |                 ll l=-a+1,r=2e9,mid;
      |                 ^~
a.cc:61:22: error: 'l' was not declared in this scope
   61 |                 for(;l<r;)
      |                      ^
a.cc:61:24: error: 'r' was not declared in this scope
   61 |                 for(;l<r;)
      |                        ^
a.cc:63:25: error: 'mid' was not declared in this scope
   63 |                         mid=l+r>>1;
      |                         ^~~
a.cc:69:39: error: 'l' was not declared in this scope
   69 |                 ll tmp1=floor((-(ll)b*l-1)*1./(a+l));
      |                                       ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
LL LLsqrt(LL x){
    LL L=0,R=1e9,mid,ans=-1;
    while (L<=R){
        mid=(L+R)>>1;
        if (mid*mid<=x)
            L=mid+1,ans=mid;
        else
            R=mid-1;
    }
    return ans;
}
int main()
{
    int n;
    cin >> n;
    while(n--)
    {
        ll a, b;
        cin >> a >> b;
        if(a == 1 && b == 1)
        {
            cout << 0 << endl;
            continue;
        }
        if(a > b)swap(a, b);
        ll sum = a*b-1;
        ll zong = LLsqrt(sum);
        ll ans = zong*2;
        if(sum/zong == zong)ans--;
        if(a != b)ans--;
        cout << ans << endl;
    }
    return 0;
}


Compiler output:
a.cc:32:1: error: 'LL' does not name a type; did you mean 'll'?
   32 | LL LLsqrt(LL x){
      | ^~
      | ll
a.cc: In function 'int main()':
a.cc:58:19: error: 'LLsqrt' was not declared in this scope; did you mean 'sqrt'?
   58 |         ll zong = LLsqrt(sum);
      |                   ^~~~~~
      |                   sqrt
Language: C++

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long LL;
LL Q;
LL a,b;
int main()
{
	/*LL n=1000;
	LL last=-1;
	for (LL u=1;u*u<=n;u++)
	{
		if (last==n/u) printf("NO\n");
		last=n/u;
		printf("%lld %lld\n",u,n/u);
	}*/
	scanf("%lld",&Q);
	while (Q--)
	{
		scanf("%lld%lld",&a,&b);
		LL n=a*b-1;
		if (a>b) swap(a,b);
		/*LL o=0;
		LL l=1,r=sqrt(n)+5;
		while (l<=r)
		{
			LL mid=(l+r)/2;
			if (mid*mid<=n) {o=mid;l=mid+1;}
			else r=mid-1;
		}*/
		o=sqrt(n);
		if (o==0)
		{
			printf("0\n");
			continue;
		}
		LL ans=2*o;//先看一下有多少对答案
		if (o==(n/o)) ans--;
		//printf("%lld %lld\n",o,ans);
		LL g=(n/o)-o;//中间有多少个空格
		LL t=a-1;//如果b要配，那么肯定是配这一个
		if (a<=o)//如果是比这个大的 
			ans--;
		if (t==0)//你什么b没有参与配对，没有影响
			printf("%lld\n",ans);
		else
		{ 
			LL tt=n/t;
			if (tt!=b)  printf("%lld\n",ans);
			else
			{
				//printf("YES");
				//那么现在的状态就是t*b 
				if (g!=0) printf("%lld\n",ans);
				else
				{
					if (t==o)//如果刚好是最后一个
						printf("%lld\n",ans-1);
					else
					{
						tt=t+1;
						LL h=n/tt;
						if (b-h>1) printf("%lld\n",ans);
						else printf("%lld\n",ans-1);
					}
				}
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'o' was not declared in this scope
   34 |                 o=sqrt(n);
      |                 ^
Language: C++

#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int n;cin>>n;
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a==b){
      cout<<2*(a-1)<<endl;
      continue;
      }
    ll ans=(a*b-1)/ret+ret-2;
    cout<<ans<<endl;
    }
  
  return 0;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: 'ret' was not declared in this scope; did you mean 'rep'?
   28 |     ll ans=(a*b-1)/ret+ret-2;
      |                    ^~~
      |                    rep
Language: C++

#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int n;cin>>n;
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a==b){
      cout<<2*(a-1)<<endl;
      continue;
      }
    ll ans+=(a*b-1)/ret+ret-2;
    cout<<ans<<endl;
    }
  
  return 0;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: expected initializer before '+=' token
   28 |     ll ans+=(a*b-1)/ret+ret-2;
      |           ^~
a.cc:29:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:


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

		if(a == b){
			cout << a + b - 2 << endl;
			continue;
		}

		ll lb = 0LL, ub = 

		ll lb = floor(sqrt(a * b));
		ll ub = ceil(sqrt(a * b));
		while(lb * lb >= a * b) lb--;
		while(ub * ub <= a * b) ub++;

		//cerr << lb << " " << ub << endl;
		if(a > b) swap(a,b);

		ll ans = a - 1 + lb + min(lb - a , b - 1 - ub);
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: expected primary-expression before 'lb'
   50 |                 ll lb = floor(sqrt(a * b));
      |                    ^~
a.cc:51:20: error: redeclaration of 'll ub'
   51 |                 ll ub = ceil(sqrt(a * b));
      |                    ^~
a.cc:48:30: note: 'll ub' previously declared here
   48 |                 ll lb = 0LL, ub =
      |                              ^~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
    int Q;
    vector<long long> A,B;
    cin >> Q;
    A.resize(Q);
    B.resize(Q);
    for(int i=0;i<Q;i++){
        cin >> A[i] >> B[i];
    }
    for(int i=0;i<Q;i++){
        long long score = A[i]*B[i];
        cout << ceil(score/(A[i]+1) + ceil(score/(B[i]+1)) -2 <<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:39: error: 'ceil' was not declared in this scope
   17 |         cout << ceil(score/(A[i]+1) + ceil(score/(B[i]+1)) -2 <<endl;
      |                                       ^~~~