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




#include<iostream>

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];
	}
	for (i = 0;i < Q;i += 1) {

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

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






		
	

	
}


	
	


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

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <string.h>
#include <math.h>
typedef long long ll;
#define INF			100000
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define SWAP
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define REP_(i,x,y)	for ((i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;

int A,B;

int main() {
	
 	cin >> A >> B;
	
	if (A>B) swap(A,B);
	
	if (A==B || A+1==B) cout << 2*(A-1);
	else {
		int C = floor(sqrt(A*B));
		if (C*C==A*B) C--;
		if (C*(C+1)>=A*B) cout << (2*C-2);
		else cout (2*C-1);
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:27: error: no match for call to '(std::ostream {aka std::basic_ostream<char>}) (int)'
   36 |                 else cout (2*C-1);
      |                      ~~~~~^~~~~~~
Language: C++

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

int main(){
  int a, b, c, n;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a >> b;
    c = sqrt(a*b);
    if(a==b){
      cout << 2a-2;
    }else if(c*(c+1) >= a*b){
      cout << 2c-2;
    }else if(c*c < a*b){
      cout << 2c-1;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: unable to find numeric literal operator 'operator""a'
   11 |       cout << 2a-2;
      |               ^~
a.cc:13:15: error: unable to find numeric literal operator 'operator""c'
   13 |       cout << 2c-2;
      |               ^~
a.cc:15:15: error: unable to find numeric literal operator 'operator""c'
   15 |       cout << 2c-1;
      |               ^~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
const int MaxN = 1e5;
int main()
{
int q;
long long a,b,ans,jh,sum,vis,biu;
while(~scanf("%d",&q))
{
while(q--)
{
ans=1;
scanf("%lld %lld",&a,&b);
if(a>b)
{
jh=a;
a=b;
b=jh;
}
sum=a*b;
jh=sqrt(sum);
ans=jh*2-1;
if(a<jh) ans--;
if(sum==j*jh) ans--;
else if(a==jh)ans--;
if(jh*(jh+1)<sum&&b!=jh+1) ans++;
printf("%lld\n",ans);
}
}
system ("pause");
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'j' was not declared in this scope; did you mean 'jh'?
   30 | if(sum==j*jh) ans--;
      |         ^
      |         jh
Language: C++

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

int main(){
    int q;
    int a[100],b[100];
    cin >> q;
    for(int i=0; i<q; i++)
    cin >> a[i] >> b[i];

    for(int i=0; i<q; i++){
        int ans=0;
        if(a[i]==b[i] || a[i]+1==b[i])
        ans=a[i]*2;
        if(a[i]==b[i]+1)
        ans=b[i]*2;
        else{
            ans=sqrt(a*b);
            if(a*b==ans*ans)
            ans--;
        }
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: invalid operands of types 'int [100]' and 'int [100]' to binary 'operator*'
   19 |             ans=sqrt(a*b);
      |                      ~^~
      |                      | |
      |                      | int [100]
      |                      int [100]
a.cc:20:17: error: invalid operands of types 'int [100]' and 'int [100]' to binary 'operator*'
   20 |             if(a*b==ans*ans)
      |                ~^~
      |                | |
      |                | int [100]
      |                int [100]
Language: C++

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

int main(){
    int q;
    long long a[100],b[100];
    cin >> q;
    for(int i=0; i<q; i++)
    cin >> a[i] >> b[i];

    for(int i=0; i<q; i++){
        long long ans=0;
        if(a[i]==b[i] || a[i]+1==b[i])
        ans=a[i]*2;
        if(a[i]==b[i]+1)
        ans=b[i]*2;
        else{
            ans=sqrt(a*b);
            if(a*b==ans*ans)
            ans--;
        }
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: invalid operands of types 'long long int [100]' and 'long long int [100]' to binary 'operator*'
   19 |             ans=sqrt(a*b);
      |                      ~^~
      |                      | |
      |                      | long long int [100]
      |                      long long int [100]
a.cc:20:17: error: invalid operands of types 'long long int [100]' and 'long long int [100]' to binary 'operator*'
   20 |             if(a*b==ans*ans)
      |                ~^~
      |                | |
      |                | long long int [100]
      |                long long int [100]
Language: C++

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

int main(){
    int q;
    long long a[100],b[100];
    cin >> q;
    for(int i=0; i<q; i++)
    cin >> a[i] >> b[i];

    for(int i=0; i<q; i++){
        int ans=0;
        if(a[i]==b[i] || a[i]+1==b[i])
        ans=a[i]*2;
        if(a[i]==b[i]+1)
        ans=b[i]*2;
        else{
            ans=sqrt(a*b);
            if(a*b==ans*ans)
            ans--;
        }
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: invalid operands of types 'long long int [100]' and 'long long int [100]' to binary 'operator*'
   19 |             ans=sqrt(a*b);
      |                      ~^~
      |                      | |
      |                      | long long int [100]
      |                      long long int [100]
a.cc:20:17: error: invalid operands of types 'long long int [100]' and 'long long int [100]' to binary 'operator*'
   20 |             if(a*b==ans*ans)
      |                ~^~
      |                | |
      |                | long long int [100]
      |                long long int [100]
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
const int MaxN = 1e5;
int main()
{
int q;
long long a,b,ans,jh,sum,vis,biu;
while(~scanf("%d",&q))
{
while(q--)
{
ans=1;
scanf("%lld %lld",&a,&b);
if(a>b)
{
jh=a;
a=b;
b=jh;
}
sum=a*b;
jh=sqrt(sum);
ans=jh*2-1;
if(a<jh) ans--;
if(sum==j*jh) ans--;
else if(a==jh)ans--;
if(jh*(jh+1)<sum&&b!=jh+1) ans++;
printf("%lld\n",ans);
}
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'j' was not declared in this scope; did you mean 'jh'?
   30 | if(sum==j*jh) ans--;
      |         ^
      |         jh
Language: C++

#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
int Q;
long long a,b;
int main()
{
    scanf("%d",&Q);
    while(Q--)
    {
        scanf("%lld%lld",&a,&b);
        if(a>b)swap(a,b);
        long long c=sqrt(a*b);
        if(c*c==a*b)c--;
        if(a==b)printf("%lld\n",2*a-2);
        else if(a+1==b)printf("%lld\n",2*a-2);
        else if(c*(c+1)>=a*b)printf("%lld\n",2*c-2);
        else if(c*(c+1)<a*b)printf("%lld\n",2*c-1);
    }
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int Q,cou;
  cin>>Q;
  int end=0;
  int A[Q],B[Q];
  for(int i=0;i<=Q-1;i++){
    cin>>A[i]>>B[i];
  }
  for(int i=0;i<=A[i]*B[i]&&i!=A[i];i++){
    end=0;
    int t[A[i]*B[i]];
    for(int h=0;h<=A[i]*B[i]-1;h++){
      t[h]=A[i]*B[i]-1;
    }
    for(int j=A[i]*B[i];j>=0&&end==0;j--){
      if(h[j]!=0&&h[j]!=B[i]){
      if(i*h[j]<A[i]*B[i]){
        cou++;
        end=1;
        h[j]=0;
      }
      }
    }
  }
}
    
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: 'h' was not declared in this scope
   19 |       if(h[j]!=0&&h[j]!=B[i]){
      |          ^
Language: C++

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

ull squareRoot(ull n){
  ull lo = 0, hi = INT_MAX;
  while(1){
    ull mid = (lo + hi)/2;
    if (n < mid * mid){
      hi = mid;
    }else if ((mid+1)*(mid+1) <= n){
      lo = mid + 1;
    }else{
      return mid;
    }
  }
  return -1;
}
  
  
  
}

int main(void){
  int Q; cin >> Q;
  for(int i=0;i<Q;i++){
    ull a, b; cin >> a >> b;
    if (a > b) swap(a, b);
    ull r = squareRoot(a * b);
    ull ans = (a - 1) + (r - a) + (r - 1);
    if (r * r == a * b) ans--;
    cout << ans << endl;
  }
  return 0;
}
    

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

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

int main(){
  int Q;
  cin >> Q;
  long long A, B, C;
  for(int i; i < Q; i++){
    cin >> A >> B;
    if(A == B || A + 1 == B) cout << 2 * A - 2 << endl;
    else{
      C = sqrt(A * B);
      if(C * C == A * B) C--;
      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:17:4: error: expected '}' at end of input
   17 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

long long int main (){

	long long int Q;
	vector<long long int> A_Rank;
	vector<long long int> B_Rank;

	cin >> Q;
	for (long long int i = 0; i < Q; i++) {
		long long int A_tmp, B_tmp;
		cin >> A_tmp >> B_tmp;
		if (A_tmp < B_tmp) { //A > B の関係
			long long int change_tmp;
			change_tmp = B_tmp;
			B_tmp = A_tmp;
			A_tmp = change_tmp;
		}
		A_Rank.push_back(A_tmp);
		B_Rank.push_back(B_tmp);
	}

	for (long long int i = 0; i < Q; i++) {
		long long int A_Candidate = 0, B_Candidate = 0, Score = 0, Count = 0;
		A_Candidate = A_Rank[i] - 1;
		B_Candidate = B_Rank[i] - 1;
		Score = A_Rank[i] * B_Rank[i];
		
		for (long long int j = 1; j <= A_Candidate; j++) {
			if (Score % j == 0) {
				if ((Score / j - 1) > B_Candidate) Count++;
			}
			else {
				if (Score / j > B_Candidate) Count++;
			}
		}
		for (long long int j = 1; j <= B_Candidate; j++) {
			if (Score % j == 0) {
				if ((Score / j - 1) > A_Candidate) Count++;
			}
			else {
				if (Score / j > A_Candidate) Count++;
			}
		}
		cout << Count;
	}

	return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<algorithm>
#include <cstdlib>
#include <cstring>
#include<iostream>

using namespace std;

int main(){
	int Q, i;
	long A, B, x, y, z;
	scanf("%d", &Q);
	for (i = 0; i < Q; i++){
		scanf("%ld %ld", &A, &B);
		x = min(A, B);
		y = max(A, B);
		z = sqrtl(x*y);
		if (z*(z + 1) >= A*B){
			printf("%ld\n", 2 * z - 2);
		}
		else{
			printf("%ld\n", 2 * z - 1);
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'sqrtl' was not declared in this scope; did you mean 'strtol'?
   18 |                 z = sqrtl(x*y);
      |                     ^~~~~
      |                     strtol
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<algorithm>
#include <cstdlib>
#include <cstring>
#include<iostream>

using namespace std;

int main(){
	int Q, i;
	long A, B, x, y, z;
	scanf("%d", &Q);
	for (i = 0; i < Q; i++){
		scanf("%d %d", &A, &B);
		x = min(A, B);
		y = max(A, B);
		z = sqrtl(x*y);
		if (z*(z + 1) >= A*B){
			printf("%ld\n", 2 * z - 2);
		}
		else{
			printf("%ld\n", 2 * z - 1);
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'sqrtl' was not declared in this scope; did you mean 'strtol'?
   18 |                 z = sqrtl(x*y);
      |                     ^~~~~
      |                     strtol
Language: C++

import math

text = input()

q = int(text)

array = []

for i in range(q):
    text = input()
    a = int(text.split(' ')[0])
    b = int(text.split(' ')[1])
    # array.append([a, b])

    m = a * b
    x, y = sorted([a, b])

    r = int(math.sqrt(m-1))
    cnt = r * 2

    if x <= r:
        cnt-=1

    if r * (r + 1) >= m:
        cnt-=1
    elif int((m-1) / r) == r:
        cnt -= 1

    print(cnt)

# for i in range(q):
#     a, b = array[i]
#     m = a * b
#     x, y = sorted([a, b])
#
#     r = int(math.sqrt(m-1))
#     cnt = r * 2
#
#     if x <= r:
#         cnt-=1
#
#     if r * (r + 1) >= m:
#         cnt-=1
#
#     print(cnt)


Compiler output:
a.cc:13:7: error: invalid preprocessing directive #array
   13 |     # array.append([a, b])
      |       ^~~~~
a.cc:31:3: error: invalid preprocessing directive #for
   31 | # for i in range(q):
      |   ^~~
a.cc:32:7: error: invalid preprocessing directive #a
   32 | #     a, b = array[i]
      |       ^
a.cc:33:7: error: invalid preprocessing directive #m
   33 | #     m = a * b
      |       ^
a.cc:34:7: error: invalid preprocessing directive #x
   34 | #     x, y = sorted([a, b])
      |       ^
a.cc:36:7: error: invalid preprocessing directive #r
   36 | #     r = int(math.sqrt(m-1))
      |       ^
a.cc:37:7: error: invalid preprocessing directive #cnt
   37 | #     cnt = r * 2
      |       ^~~
a.cc:39:16: error:  ':' without preceding '?'
   39 | #     if x <= r:
      |                ^
a.cc:42: error: unterminated #if
   42 | #     if r * (r + 1) >= m:
a.cc:39: error: unterminated #if
   39 | #     if x <= r:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<stdio.h>
#include<math.h>
int main(){
long long n,m,i,j,k,l,x,y,z,a,b,c,q;
double w;
x=0;y=0;z=0;
scanf("%lld",&q);
for(j=0;j<q;j++){
x=0;
scanf("%lld%lld",&a,&b);if(a>b){c=a;a=b;b=c;}
if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
y=a*b-1;
w=sqrt(y);
n=w/1;
if(n*(n+1)<=y+1){x++;}
printf("%lld\n",x+2*n-2);}}
return 0;
}


Compiler output:
a.cc:11:8: error: stray '\' in program
   11 | if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
      |        ^
a.cc:11:9: error: stray '\' in program
   11 | if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
      |         ^
a.cc: In function 'int main()':
a.cc:11:8: error: expected ')' before 'a'
   11 | if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
      |   ~    ^ ~
      |        )
Language: C++

#include<stdio.h>
#include<math.h>
int main(){
long long n,m,i,j,k,l,x,y,z,a,b,c,q;
double w;
x=0;y=0;z=0;
scanf("%lld",&q);
for(j=0;j<q;j++){
x=0;
scanf("%lld%lld",&a,&b);if(a>b){c=a;a=b;b=c;}
if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
y=a*b-1;
w=sqrt(y);
n=w/1;
if(n*(n+1)<=y){x++;}
printf("%lld\n",x+2*n-2);}}
return 0;
}

Compiler output:
a.cc:11:8: error: stray '\' in program
   11 | if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
      |        ^
a.cc:11:9: error: stray '\' in program
   11 | if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
      |         ^
a.cc: In function 'int main()':
a.cc:11:8: error: expected ')' before 'a'
   11 | if(a==b\\a+1==b){printf("%lld\n",2*a-2);}else{
      |   ~    ^ ~
      |        )
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
using namespace std;
int main()
{
	int i,q;
	long long a,b;
	scanf("%d", &q);
	for(i = 1 ; i <= q ; i++)
	{
		scanf("%lld %lld", &a, &b);
		if(a == b)
		{
			printf("%lld\n",a * 2 - 2);
		}
		else
		{
			int fuzu;
			if(a > b)
			{
				fuzu = a;
				a = b;
				b = fuzu;
			}
			if(a + 1 == b)
			{
				printf("%lld\n",2 * a - 2);
			}
			else
			{
				long long c = sqrt(a * b)
					if(c * (c + 1) >= a *b)
					{
						printf("%lld\n",2 * c - 2);
					}
					else
					{
						printf("%lld\n", 2 * c - 1);
					}
			}
		}

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:41: error: expected ',' or ';' before 'if'
   35 |                                         if(c * (c + 1) >= a *b)
      |                                         ^~
a.cc:39:41: error: 'else' without a previous 'if'
   39 |                                         else
      |                                         ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int main () {
	int nquery;
	cin >> nquery;
	long long A, B;
	int count = 0;
	for(int i = 0; i < nquery; i ++){
		count = 0;
		cin >> A >> B;
		unsigned long long product = A*B;
		if (A < B) {
			int temp = A;
			A = B;
			B = temp;
		}
		count += floor ((product-1) / (A + 1));
		
		if (floor(sqrt(product-1)) >= B){
			count += floor(sqrt(product-1)) - B + 1;
			
			count += floor(product-1)/(floor(sqrt(product-1))+1)-1;
		}
		else count += floor(sqrt(product-1));
		cout << count << endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:26: error: 'floor' was not declared in this scope
   24 |                 count += floor ((product-1) / (A + 1));
      |                          ^~~~~
a.cc:26:27: error: 'sqrt' was not declared in this scope
   26 |                 if (floor(sqrt(product-1)) >= B){
      |                           ^~~~
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        long[] a = new long[q+2];
        long[] b = new long[q+2];
        a[0] = 0;
        b[0] = 0;
        a[q+1] = 0;
        b[q+1] = 0;
        for(int i=1;i<=q;i++){
            a[i] = sc.nextLong();
            b[i] = sc.nextLong();
        }
        int count = 0;
        long keep = a[1]*b[1];
        long rank;
        for(int k=1;k<=q;k++){
            for(long i=1;i<a[k]*b[k];i++){
                if(i!=a[k]){
                    rank = (a[k]*b[k]-1)/i;
                    if(rank<keep&&rank!=b[k]){
                        if(rank>0){
                            keep = (a[k]*b[k]-1)/i;
                            count++;
                        }
                        else{
                            break;
                        } 
                    }
                    else{
                        if(rank!=b[k]){
                            rank = keep-1;
                        }
                        else{
                            rank = b[k]-1;
                        }
                        if(rank>0){
                            count++; 
                            keep = rank;
                        }
                        else{
                            break;
                        }
                    }
                }
            }
            System.out.println(count);
            count = 0;
            keep = a[k+1]*b[k+1];
        }
    }

Compiler output:
Main.java:53: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

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

int main(void) {
	
	int Q;
	cin >> Q;
	for(int i=0; i<Q; i++) {
		int A, B;
		cin >> A >> B;
		
		int64_t mul = (__int64)A * B;
		long double rt = sqrtl(mul);
		int64_t rt2 = rt;
		int64_t ans = rt2*2-1;
		if(mul == rt2*rt2) {
			ans--;
		}
		if(rt2 > A) {
			ans--;
		}
		if(rt2 > B) {
			ans--;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   13 |                 int64_t mul = (__int64)A * B;
      |                                ^~~~~~~
      |                                __ynf64
Language: C

int Q,A,B,i,x,y;
int count;
count=0;
scanf("%d",&Q);
for(i=1;i<=Q;i++){
  scanf("%d%d",&A,&B);
  for(x=1;x<=A*B;x++){
    for(y=1;y<=A*B;y++){
      if(A*B>x*y){
      count=count+1;
      }
    }
  }

}

Compiler output:
main.c:3:1: warning: data definition has no type or storage class
    3 | count=0;
      | ^~~~~
main.c:3:1: error: type defaults to 'int' in declaration of 'count' [-Wimplicit-int]
main.c:4:7: error: expected declaration specifiers or '...' before string constant
    4 | scanf("%d",&Q);
      |       ^~~~
main.c:4:12: error: expected declaration specifiers or '...' before '&' token
    4 | scanf("%d",&Q);
      |            ^
main.c:5:1: error: expected identifier or '(' before 'for'
    5 | for(i=1;i<=Q;i++){
      | ^~~
main.c:5:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
    5 | for(i=1;i<=Q;i++){
      |          ^~
main.c:5:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    5 | for(i=1;i<=Q;i++){
      |               ^~
Language: C++


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


int main()
{
	int q, a[110], b[110],c[110];
	cin >> q;
	for (int i = 0; i < q; i++) { cin >> a[i] >> b[i]; }
	int j = 0;
	for (int k = 0; k < q; k++) {
		if (j*j + 1 < a[k] * b[k]) { j++; }
		else {
			if (j < a[k] && j < b[k]) {
				c[k] = j * 2;
			}
			else { c[k] = j * 2 - 1; };
	}
		for (int o = 0; o < q; o++) {
			cout << c[o];
		}




	
	return 0;
}



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

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

using namespace std;

int main() {
    int Q;
    int A, B;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        cin >> A >> B;
        int score = A*B;//A*B>C*D
        int C = 0, D = 0;
        int counter = 0;
        while (true) {
            C++;
            if (A == C&&)continue;
            while (true) {
                D++;
                if (B == D &&C==D)continue;
                if (C*D < score) {
                    counter++;
                }
                else {
                    break;
                }
            }
            if (A <= C&&B <= C) {
                break;
            }
        }
        cout << counter << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: expected primary-expression before ')' token
   19 |             if (A == C&&)continue;
      |                         ^
Language: C++

#include<iostream>
#include<array>
#include<math.h>
using namespace std;
int main()
{
	long long A[100], B[100], Q;
	cin >> Q;
	long long c[100];
	for (int i = 0; i < Q; i++)
	{
		cin >> A[i] >> B[i];
	}
	for (int i = 0; i < Q; i++)
	{
		int long long = 0;
		if (A[i] * B[i] <= 2)
		{
			printf("%d\n", 0);
			continue;
		}

		if ((long long)sqrt(A[i] * B[i])*((long long)sqrt(A[i] * B[i]) + 1) < A[i] * B[i])
		{
			count += 2 * (long long)sqrt(A[i] * B[i])-2;
			for (int j = 1;; j++) {
				if ((long long)sqrt(A[i] * B[i])*((long long)sqrt(A[i] * B[i]) + j) < A[i] * B[i])
					count++;
				else
					break;
			}
		}
		else
			count += 2 * (long long)sqrt(A[i] * B[i]) - 2;
		if (A[i] == 1 || B[i] == 1)
			count--;
		cout << count << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:31: error: expected unqualified-id before '=' token
   16 |                 int long long = 0;
      |                               ^
a.cc:25:25: error: 'count' was not declared in this scope
   25 |                         count += 2 * (long long)sqrt(A[i] * B[i])-2;
      |                         ^~~~~
a.cc:34:25: error: 'count' was not declared in this scope
   34 |                         count += 2 * (long long)sqrt(A[i] * B[i]) - 2;
      |                         ^~~~~
a.cc:36:25: error: 'count' was not declared in this scope
   36 |                         count--;
      |                         ^~~~~
a.cc:37:25: error: 'count' was not declared in this scope
   37 |                 cout << count << endl;
      |                         ^~~~~
Language: C++

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

int main(void) {
	
	int Q;
	cin >> Q;
	for(int i=0; i<Q; i++) {
		int A, B;
		cin >> A >> B;
		
		__int64 mul = (__int64)A * B;
		long double rt = sqrtl(mul);
		__int64 rt2 = rt;
		__int64 ans = rt2*2-1;
		if(mul == rt2*rt2) {
			ans--;
		}
		if(rt2 > A) {
			ans--;
		}
		if(rt2 > B) {
			ans--;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   13 |                 __int64 mul = (__int64)A * B;
      |                 ^~~~~~~
      |                 __ynf64
a.cc:14:40: error: 'mul' was not declared in this scope; did you mean 'fmul'?
   14 |                 long double rt = sqrtl(mul);
      |                                        ^~~
      |                                        fmul
a.cc:15:24: error: expected ';' before 'rt2'
   15 |                 __int64 rt2 = rt;
      |                        ^~~~
      |                        ;
a.cc:16:24: error: expected ';' before 'ans'
   16 |                 __int64 ans = rt2*2-1;
      |                        ^~~~
      |                        ;
a.cc:17:27: error: 'rt2' was not declared in this scope; did you mean 'rt'?
   17 |                 if(mul == rt2*rt2) {
      |                           ^~~
      |                           rt
a.cc:18:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |                         ans--;
      |                         ^~~
      |                         abs
a.cc:20:20: error: 'rt2' was not declared in this scope; did you mean 'rt'?
   20 |                 if(rt2 > A) {
      |                    ^~~
      |                    rt
a.cc:21:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |                         ans--;
      |                         ^~~
      |                         abs
a.cc:23:20: error: 'rt2' was not declared in this scope; did you mean 'rt'?
   23 |                 if(rt2 > B) {
      |                    ^~~
      |                    rt
a.cc:24:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |                         ans--;
      |                         ^~~
      |                         abs
a.cc:26:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |                 cout << ans << endl;
      |                         ^~~
      |                         abs
Language: C++


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


int main()
{
	int q, a[110], b[110],c[110];
	cin >> q;
	for (int i = 0; i < q; i++) { cin >> a[i] >> b[i]; }
	int j = 0;
	for (int k = 0; k < q; k++) {
		if (j*j + 1 < a[k] * b[k]) { j++; }
		else {
			if (j < a[k] && j < b[k]) {
				c[k] = j * 2;
			}
			else { c[k] = j * 2 - 1; };
	}
		for (int o = 0; o < q; o++) {
			cout << c[o];
		}




	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

long long calc(long long a, unsigned long long product){
	return floor((product-1) / a);
}

int main () {
	int nquery;
	cin >> nquery;
	long long A, B;
	int count = 0;
	for(int i = 0; i < nquery; i ++){
		count = 0;
		cin >> A >> B;
		unsigned long long product = A*B;
		if (A < B) {
			int temp = A;
			A = B;
			B = temp;
		}
		count += floor ((product-1) / (A + 1));
		if (floor(sqrt(product-1)) > B){
			count += 2*floor(sqrt(product-1))-B;
		}
		else if(sqrt(product-1) == floor(sqrt(product-1)) || floor(sqrt(product-1)) == B) count += 2*floor(sqrt(product-1))-B-1;
		else count += floor(sqrt(product-1));

		
		cout << count << endl;

	}
	
	return 0;
}

Compiler output:
a.cc: In function 'long long int calc(long long int, long long unsigned int)':
a.cc:11:16: error: 'floor' was not declared in this scope
   11 |         return floor((product-1) / a);
      |                ^~~~~
a.cc: In function 'int main()':
a.cc:28:26: error: 'floor' was not declared in this scope
   28 |                 count += floor ((product-1) / (A + 1));
      |                          ^~~~~
a.cc:29:27: error: 'sqrt' was not declared in this scope
   29 |                 if (floor(sqrt(product-1)) > B){
      |                           ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{	
	int n,m;
	scanf("%d",&n,&m);
	for(i=0;i<l;i++)
	{
		scanf("%d",&i);
	}
	for(i=0;i<m;i++)
	{
		if((i-a+i-b+i-c)%2==0)
			printf("%d",(i-a+i-b+i-c)/2);
		else
			printf("%d",(i-a+i-b+i-c+3)/2); 

	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=0;i<l;i++)
      |             ^
a.cc:7:19: error: 'l' was not declared in this scope
    7 |         for(i=0;i<l;i++)
      |                   ^
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         for(i=0;i<m;i++)
      |             ^
a.cc:13:23: error: 'a' was not declared in this scope
   13 |                 if((i-a+i-b+i-c)%2==0)
      |                       ^
a.cc:13:27: error: 'b' was not declared in this scope
   13 |                 if((i-a+i-b+i-c)%2==0)
      |                           ^
a.cc:13:31: error: 'c' was not declared in this scope
   13 |                 if((i-a+i-b+i-c)%2==0)
      |                               ^
Language: C++

#include <iostream>
#include <cstdio>
#include <unordered_map>
#include <cmath>

#define NMAX 105

using namespace std;
using ll = long long;

ll solve(ll a, ll b){
  unordered_map<ll, bool> mp;
  ll target = a * b - 1LL;
  ll root = static_cast<ll>(sqrt(target));
  ll ans = 2 * root;
  for(ll i = 1; i <= root; ++i){
    ll divider = target / i;
    if(!mp[divider]){
      mp[divider] = mp[i] = true;
    }else{
      --ans;
    }
  }
  ans -= (int)(mp[a]) + (int)(mp[b]) + (int)(root * root == target);  

  return ans;
}

int main(){
  ll Q,A[NMAX],B[NMAX];
  cin >> Q;
  for(int i  = 0; i < Q; ++i){
    scanf(“%lld%lld”, &A[i], &B[i]);
  }
  for(int i = 0; i < Q; ++i) cout << solve(A[i], B[i]) << endl;

  return 0;
}


Compiler output:
a.cc:33:11: error: extended character “ is not valid in an identifier
   33 |     scanf(“%lld%lld”, &A[i], &B[i]);
      |           ^
a.cc:33:17: error: extended character ” is not valid in an identifier
   33 |     scanf(“%lld%lld”, &A[i], &B[i]);
      |                 ^
a.cc: In function 'int main()':
a.cc:33:11: error: '\U0000201c' was not declared in this scope
   33 |     scanf(“%lld%lld”, &A[i], &B[i]);
      |           ^
a.cc:33:13: error: 'lld' was not declared in this scope; did you mean 'll'?
   33 |     scanf(“%lld%lld”, &A[i], &B[i]);
      |             ^~~
      |             ll
a.cc:33:17: error: 'lld\U0000201d' was not declared in this scope
   33 |     scanf(“%lld%lld”, &A[i], &B[i]);
      |                 ^~~~
Language: C++

/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for(int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;
#include "../template.hpp"


int main(){

  int q; cin >> q;
  while(q--){

    ll ans = 0;
    ll a, b; cin >> a >> b;
    ll m = a*b;

    if( m>100000 ) {
      ll sqm = (ll)sqrtl(m);
      if( m%sqm == 0 ) sqm--;
      ans += sqm*2;
      if( a<sqm ) ans--;
      if( b<sqm ) ans--;
    } else {
      set<ll> ma, mb;
      ma.insert(a);
      mb.insert(b);
  
      ll sqm = (ll)sqrtl(m);
      for(int i=1; i<=sqm; ++i){
        ll sb = m/i;
        while( i*sb >= m ) --sb;
        if( ma.count(i) == 0 and mb.count(sb) == 0 ){
          ma.insert(i);
          mb.insert(sb);
          ans++;
        }
        if( ma.count(sb) == 0 and mb.count(i) == 0 ){
          ma.insert(sb);
          mb.insert(i);
          ans++;
        }
      }
    }

    cout << ans << endl;

  }

  return 0;
}


Compiler output:
a.cc:70:10: fatal error: ../template.hpp: No such file or directory
   70 | #include "../template.hpp"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int64_t solution(int64_t a, int64_t b) {
  int64_t key, target = a * b;
  for (int64_t i = std::sqrt((double)(target -1)); i < std::max({a, b}); ++i) {
    if (target > i * i)
      key = i;
    else
      break;
  }
  int64_t ans = 2 * key;
  if (a <= key)
    ans -= 1;
  if (b <= key)
    ans -= 1;
  if (key * (key + 1) >= target)
    ans -= 1;
  return ans;
}

int main() {
  int q;
  std::cin >> q;
  for (int i = 0; i < q; ++i) {
    int64_t a, b;
    std::cin >> a >> b;
    std::cout << solution(a, b) << std::endl;
  }
}


Compiler output:
a.cc: In function 'int64_t solution(int64_t, int64_t)':
a.cc:8:25: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
    8 |   for (int64_t i = std::sqrt((double)(target -1)); i < std::max({a, b}); ++i) {
      |                         ^~~~
      |                         sort
Language: C++

#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

long long N,T,a,b,c,big;
long long sc;
long long result[101] = {};

typedef pair<long long, long long> pl;
vector<pl> re;
vector<pl> bl;
pl buf;

long long Answer[200] = {};


int main() {

	cin >>N;
	for (int i = 0; i < N; i++) {
		cin >> a >> b;
		sc = a*b;
		big = max(a, b);
		c = sqrt(sc)-1;
		result[i] = c - 1;
		c++;
		while (c<sc/c)
		{
			result[i]++;
			c++;
		}
		result[i] += sc / c;
		c = sqrt(sc) - 1;
		if (c==min(a,b) || big-1== min(a, b)) {
			result[i]--;
		}

	}

	
	for (int i = 0; i < N; i++) {
		cout << result[i] << endl;
	}

	/*for (int i = 0; i < T; i++) {
		if (Answer[i] == -1) {
			cout << "Case #" << i + 1 << ": OK" << endl;
		}
		else {
			cout << "Case #" << i + 1 << ": " << Answer[i] << endl;
		}

	}*/
	



	//cout << result << endl;

return 0;
}

Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc: In function 'int main()':
a.cc:31:21: error: 'sqrt' was not declared in this scope
   31 |                 c = sqrt(sc)-1;
      |                     ^~~~
Language: C++

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

int64_t solution(int64_t a, int64_t b) {
  int64_t target = a * b;
  int64_t key = std::sqrt(target -1);
  int64_t ans = 2 * key;
  if (a <= key)
    ans -= 1;
  if (b <= key)
    ans -= 1;
  if (key * (key + 1) >= target)
    ans -= 1;
  return ans;
}

int main() {
  int q;
  std::cin >> q;
  for (int i = 0; i < q; ++i) {
    int64_t a, b;
    std::cin >> a >> b;
    std::cout << solution(a, b) << std::endl;
  }
}


Compiler output:
a.cc: In function 'int64_t solution(int64_t, int64_t)':
a.cc:8:22: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
    8 |   int64_t key = std::sqrt(target -1);
      |                      ^~~~
      |                      sort
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i,s,e) for (int64_t i=s; i<e; i++)
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int A, B, C, M;
  cin >> A >> B >> C;
  M=max(A,max(B,C));
  if ((3*M)%2==(A+B+C)%2) {
    cout << (3*M-A-B-C)/2 << endl;
  }
  else {
    cout << (3*M-A-B-C)/2+2 << endl;
  }

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

#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<=n;i++)
#define RIP(i,a,b) for(int i=a;i<b;i++)
#define all(V) V.begin(),V.end()
#define sec  setprecision;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
using ll = long long;
using ld = long double;
using Pa = pair<int, int>;
ll mod = 1000000007;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x) % mod, n / 2) % mod);
	else
		return (x * pow(x, n - 1)) % mod;
}
int a,b,c;
int main() {
	cin >> a >> b >> c;
	int sum = a + b + c;
	int ans = 0;
	int maxx = max({ a,b,c });
	int ans = max(maxx, (sum - 1) / 3 + 1);
	cout << (ans - sum) / 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:13: error: redeclaration of 'int ans'
   61 |         int ans = max(maxx, (sum - 1) / 3 + 1);
      |             ^~~
a.cc:59:13: note: 'int ans' previously declared here
   59 |         int ans = 0;
      |             ^~~
Language: C++

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

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:7:12:   required from here
    7 |   int Y=max(A,B,C);
      |         ~~~^~~~~~~
/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 <bits/stdc++.h>
using namespace std;

int main() {
    int A, B, C;
    cin >> A >> B >> C; 
    vector<int> vec = {A, B, C};
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    if ((vec.(0) - vec.at(1)) % 2 == 0 && (vec.(1) - vec.at(2)) % 2 == 0) {
      cout << (vec.at(0) * 2 - vec.at(1) - vec.at(2)) / 2 << endl;
    }
    else if ((vec.(0) - vec.at(1)) % 2 == 0 && (vec.(1) - vec.at(2)) % 2 == 1) {
      cout << ((vec.at(0) * 2 - vec.at(1) - vec.at(2) + 1) / 2) + 1 << endl;
    }
    else {
      cout << ((vec.at(0) * 2 - vec.at(1) - vec.at(2) + 1) / 2) + 1 << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: expected unqualified-id before '(' token
   10 |     if ((vec.(0) - vec.at(1)) % 2 == 0 && (vec.(1) - vec.at(2)) % 2 == 0) {
      |              ^
a.cc:10:48: error: expected unqualified-id before '(' token
   10 |     if ((vec.(0) - vec.at(1)) % 2 == 0 && (vec.(1) - vec.at(2)) % 2 == 0) {
      |                                                ^
a.cc:13:19: error: expected unqualified-id before '(' token
   13 |     else if ((vec.(0) - vec.at(1)) % 2 == 0 && (vec.(1) - vec.at(2)) % 2 == 1) {
      |                   ^
a.cc:13:53: error: expected unqualified-id before '(' token
   13 |     else if ((vec.(0) - vec.at(1)) % 2 == 0 && (vec.(1) - vec.at(2)) % 2 == 1) {
      |                                                     ^
Language: C++

int main() {
    int a,b,c;
    cin >>a>>b >>c;
    int k = (max(a,max(b,c))) ;
    int sum= a+b+c ;
    if ((3*k-sum)/2==0)
    cout <<(3*k-sum)/2 << endl;
    else
    cout << (3*k-sum+3)/2 <<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >>a>>b >>c;
      |     ^~~
a.cc:4:20: error: 'max' was not declared in this scope
    4 |     int k = (max(a,max(b,c))) ;
      |                    ^~~
a.cc:4:14: error: 'max' was not declared in this scope
    4 |     int k = (max(a,max(b,c))) ;
      |              ^~~
a.cc:7:5: error: 'cout' was not declared in this scope
    7 |     cout <<(3*k-sum)/2 << endl;
      |     ^~~~
a.cc:7:27: error: 'endl' was not declared in this scope
    7 |     cout <<(3*k-sum)/2 << endl;
      |                           ^~~~
a.cc:9:5: error: 'cout' was not declared in this scope
    9 |     cout << (3*k-sum+3)/2 <<endl;
      |     ^~~~
a.cc:9:29: error: 'endl' was not declared in this scope
    9 |     cout << (3*k-sum+3)/2 <<endl;
      |                             ^~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: request for member 'begin' in 'A', which is of non-class type 'int [3]'
    6 |   sort(A.begin(),A.end());
      |          ^~~~~
a.cc:6:20: error: request for member 'end' in 'A', which is of non-class type 'int [3]'
    6 |   sort(A.begin(),A.end());
      |                    ^~~
Language: C++

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  vi x(3);
  rep(i,3){
    cin>>x[i];
  }
  vsort(x);
  int d=(x[2]-x[1]);
  int ans=(x[2]-(d+x[0]))/2
  if((x[2]-(d+x[0]))%2==1)ans++;
  
  cout<<ans<<
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:3: error: expected ',' or ';' before 'if'
   60 |   if((x[2]-(d+x[0]))%2==1)ans++;
      |   ^~
a.cc:64:1: error: expected primary-expression before '}' token
   64 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int a, b, c, d;
int main() {
	cin>>a>>b>>c;
	d = 3*(max({a,b,c})) - (a+b+c);
	d += d%2*3;
	cout<<d/2;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
    6 |         d = 3*(max({a,b,c})) - (a+b+c);
      |                ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
Language: C++

#include <iostream>
using namespace std;
int a, b, c, d;
int main() {
	cin>>a>>b>>c;
	d = 3*(max{a,b,c}) - (a+b+c);
	d += d%2*3;
	cout<<d/2;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: expected ')' before '{' token
    6 |         d = 3*(max{a,b,c}) - (a+b+c);
      |               ~   ^
      |                   )
a.cc:6:14: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator*'
    6 |         d = 3*(max{a,b,c}) - (a+b+c);
      |             ~^~~~~~
Language: C++

// comment
// #simulation

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

int main(void) {
  vector<int> v(3);
  for(int i = 0; i < 3 ; i ++)cin>>v[i];
  int c = 0;
  while(!(v[0] == v[1] && v[1] == v[2])) {
    sort(v.begin(), v.end());
    if (v[2] > v[0] + 2) {
      v[0] += 2;
    } else {
      v[1] ++;
      v[0] ++;
    }
    c ++;
  }
  cout<<c<<endl;
}


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