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

#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }

int n;
vector<int> a, b;

int main() {
    scanf("%d", &n);
    a.resize(n); b.resize(n);
    ll t1 = 0, t2 = 0;
    for (int& i : a) {
        scanf("%d", &i);
        t1 += i;
    }
    for (int& i : b) scanf("%d", &i), t2 += i;
    book can = 1;
    rep(i, n) {
        can &= a[i] <= b[i];
    }
    if (can) {
        puts("Yes"); return 0;
    }
    ll d = t2 - t1;
    bool ok = 0 <= d&&d <= n;
    puts(ok ? "Yes" : "No");

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'book' was not declared in this scope; did you mean 'bool'?
   22 |     book can = 1;
      |     ^~~~
      |     bool
a.cc:24:9: error: 'can' was not declared in this scope; did you mean 'tan'?
   24 |         can &= a[i] <= b[i];
      |         ^~~
      |         tan
a.cc:26:9: error: 'can' was not declared in this scope; did you mean 'tan'?
   26 |     if (can) {
      |         ^~~
      |         tan
Language: C++

#include <iostream>

int a[10000], b[10000], c, d = 0, e = 0, f = 0, g = 0, h, i;
int main()
{
	std::cin >> c;
	for(int i = 0; i < c; i++)
	{
		std::cin >> a[i];
		std::cin >> b[i];
		if(a[i] % 2 == 0)
			d++;
		if(a[i] % 2 != 0)
			e++;
		if(b[i] % 2 == 0)
			f++;
		if(b[i] % 2 != 0)
			g++;
		h += a[i];
		i += b[i]; 
	}

	if((d == g))
	{
		std::cout << "Yes" << std::endl;
	}else if(((d - g) % 2 == 0) || ((g - d)) % 2 == 0) || (h < i){
		std::cout << "Yes" << std::endl;
	}else
		std::cout << "No" << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:60: error: expected primary-expression before '||' token
   26 |         }else if(((d - g) % 2 == 0) || ((g - d)) % 2 == 0) || (h < i){
      |                                                            ^~
Language: C++

#include <iostream>
#include <set>
using namespace std;
int N;
int Check(multiset<int> &A,multiset<int> &B)
{
	int retGT=0;
	multiset<int>::iterator sitA,sitB;
	for (sitA=A.begin(),sitB=B.begin();sitA!=A.end(),sitB!=B.end();sitA++,sitB++){
		if ((*sitA)<(*sitB)){
			(*sitA)=(*sitA)+2;
			(*sitB)=(*sitB)+1;
			return -1;
		}else if ((*sitA)>(*sitB)){
			retGT=1;
		}else{
			A.erase(sitA);
			B.erase(sitB);
			return -1;
		}
	}
	if (retGT==0){
		return 0;
	}else{
		return 1;
	}
}
int main(int argc, char* argv[])
{
	cin>>N;
	multiset<int> A,B;
	int i;
	int X;
	for (i=0;i<N;i++){
		cin>>X;
		A.insert(X);
	}
	for (i=0;i<N;i++){
		cin>>X;
		B.insert(X);
	}
	if (Check(A,B)==0){
		cout<<"Yes"<<endl;
		return 0;
	}
	while(true){
		int chk=Check(A,B);
		if (chk==0){
			cout<<"Yes"<<endl;
			return 0;
		}else if (chk==1){
			break;
		}
		if (A.size()==0){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int Check(std::multiset<int>&, std::multiset<int>&)':
a.cc:11:32: error: assignment of read-only location 'sitA.std::_Rb_tree_const_iterator<int>::operator*()'
   11 |                         (*sitA)=(*sitA)+2;
      |                         ~~~~~~~^~~~~~~~~~
a.cc:12:32: error: assignment of read-only location 'sitB.std::_Rb_tree_const_iterator<int>::operator*()'
   12 |                         (*sitB)=(*sitB)+1;
      |                         ~~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <set>
using namespace std;
int N;
int Check(multiset<int> &A,multiset<int> &B)
{
	int retGT=0;
	multiset<int>::iterator sitA,sitB;
	for (sitA=A.begin(),sitB=B.begin();sitA!=A.end(),sitB!=B.end();sitA++,sitB++){
		if ((*sitA)<(*sitB)){
			(*sitA)+=2;
			(*sitB)+=1;
			return -1;
		}else if ((*sitA)>(*sitB)){
			retGT=1;
		}else{
			A.erase(sitA);
			B.erase(sitB);
			return -1;
		}
	}
	if (retGT==0){
		return 0;
	}else{
		return 1;
	}
}
int main(int argc, char* argv[])
{
	cin>>N;
	multiset<int> A,B;
	int i;
	int X;
	for (i=0;i<N;i++){
		cin>>X;
		A.insert(X);
	}
	for (i=0;i<N;i++){
		cin>>X;
		B.insert(X);
	}
	if (Check(A,B)==0){
		cout<<"Yes"<<endl;
		return 0;
	}
	while(true){
		int chk=Check(A,B);
		if (chk==0){
			cout<<"Yes"<<endl;
			return 0;
		}else if (chk==1){
			break;
		}
		if (A.size()==0){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int Check(std::multiset<int>&, std::multiset<int>&)':
a.cc:11:32: error: assignment of read-only location 'sitA.std::_Rb_tree_const_iterator<int>::operator*()'
   11 |                         (*sitA)+=2;
      |                         ~~~~~~~^~~
a.cc:12:32: error: assignment of read-only location 'sitB.std::_Rb_tree_const_iterator<int>::operator*()'
   12 |                         (*sitB)+=1;
      |                         ~~~~~~~^~~
Language: C++

#include <iostream>

int a[10000], b[10000], c, d = 0, e = 0, f = 0, g = 0;
int main()
{
	std::cin >> c;
	for(int i = 0; i < c; i++)
	{
		std::cin >> a[i];
		std::cin >> b[i];
		if(a[i] % 2 == 0)
			d++;
		if(a[i] % 2 != 0)
			e++;
		if(b[i] % 2 == 0)
			f++
		if(b[i] % 2 != 0)
			g++;
	}

	if((d == g) || (e == f))
	{
		std::cout << "Yes" << std::endl;
	}else if(((d - g) % 2 == 0) || ((g - d)) % 2 == 0){
		std::cout << "Yes" << std::endl;
	}else
		std::cout << "No" << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ';' before 'if'
   16 |                         f++
      |                            ^
      |                            ;
   17 |                 if(b[i] % 2 != 0)
      |                 ~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<queue>
#include<set>
using namespace std;

int main()
{
  int n, sum = 0, nsum = 0, j = 0;

  cin >> n;

  int v[n][2];

  for(int i = 0; i < 2; i++)
  {
    for(int l = 0; l < n; l++)
    {
      cin >> v[l][i];
    }
  }

  sum = 0; nsum = 0;
  for(int i = 0; i < n; i++)
  {
    int tmp = v[i][0] - v[i][1];
    if(tmp > 0)
      sum += tmp;
    else if(tmp < 0)
    {
      nsum += tmp;
      j++;
    }
  }

  if(sum == 0 && nsum == 0)
    cout << "Yes" << endl;
  else if(nsum > sum)
    cou << "No" << endl;
  else if(sum % 2 == 0 && nsum % 2 == 1 || sum % 2 == 1 && nsum % 2 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:5: error: 'cou' was not declared in this scope
   41 |     cou << "No" << endl;
      |     ^~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

int main(){
  int N, count2, count1, tmp;
  cin>>N;

  long int a[N], b[N], c[N];
  REP(i,N) cin>>a[i];
  REP(i,N) cin>>b[i];
  REP(i,N) c[i] = a[i] - b[i];

  REP(i,N) {
    while(c[i]) {
      if (c[i] < 0) {
        tmp = (-c[i] + 1) / 2;
        c[i] += tmp * 2;
        count2 += tmp;
        //cout<<2<<" ";
      } else {
        tmp = c[i];
        c[i] -= tmp;
        count1 += tmp;
        //cout<<-1<<" ";
      }
    }
  }

  if (count2 == count1 ||) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:26: error: expected primary-expression before ')' token
   34 |   if (count2 == count1 ||) cout<<"Yes"<<endl;
      |                          ^
Language: Java

import java.io.*;
import java.util.*;

public class b {
	
	public static void main(String[] args) throws Exception {
		int N;
		int posi=0;
		int nega=0;
		int sum=0;
		int x=0;
		ArrayList<Integer> a = new ArrayList<Integer>();
		ArrayList<Integer> b = new ArrayList<Integer>();
		
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = new String(in.readLine());
		N = Integer.parseInt(s);
		
		in = new BufferedReader(new InputStreamReader(System.in));
		s = new String(in.readLine());
		String[] temp = s.split(" ",0);
		
		for(int i=0; i<temp.length; i++){
			a.add( Integer.parseInt(temp[i]) );
		}
		
		in = new BufferedReader(new InputStreamReader(System.in));
		s = new String(in.readLine());
		temp = s.split(" ",0);
		
		for(int i=0; i<temp.length; i++){
			b.add( Integer.parseInt(temp[i]) );
		}
		
		for(int i=0; i<N; i++){
			x = a.get(i) - b.get(i);
			if( x >= 0 ) posi += x;
			else         nega -= x;
		}
		
		x = posi - nega/2 ;
		if( x < 0 ) System.out.println("Yes");
		else        System.out.println("No");
	}
}

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

コード
Copy

    #include<stdio.h>
    int main(void){
    long long int N,a[N],b[N],i,suma=0,sumb=0;
     scanf("%lld",a);
     scanf("%lld",b);
    for(i=0;i<N;i++){
     suma+=a[i];
    }
    for(i=0;i<N;i++){
     sumb+=b[i];
    }
    if(sumb-suma<0) printf("No");
    return 0;
    }

Compiler output:
main.c:1:1: error: unknown type name '\U000030b3\U000030fc\U000030c9'
    1 | コード
      | ^~~~~~
main.c:2:5: error: expected ';' before 'typedef'
    2 | Copy
      |     ^
      |     ;
Language: C++

#include <iostream>
using namespace std;
 
int main(){
   int n;cin >> n;

   int a[n],b[n];
   for(int i = 0;i < n;i++) cin >> a[i];
   for(int i = 0;i < n;i++) cin >> b[i];

   long int ta = 0,tb = 0,c = 0;
   for(int i = 0;i < n;i++)ta += a[i],tb += b[i],if(a[i]>b[i])c += a[i] - b[i];

   if(ta - tb > c) cout << "Yes";
   else cout << "No";

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:50: error: expected primary-expression before 'if'
   12 |    for(int i = 0;i < n;i++)ta += a[i],tb += b[i],if(a[i]>b[i])c += a[i] - b[i];
      |                                                  ^~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    long long a[10005];
    long long b[10005];
    while(scanf("%d",&n)!=EOF){
        long long sum1=0,sum2=0;
        for(int i=1;i<=n;i++){
            scanf("%lld",&a[i]);
            sum1+=a[i];
        }
        for(int i=1;i<=n;i++){
            scanf("%lld",&b[i]);
            sum2+=b[i];
        }
        if((sum1%2==0)&&(sum2%2!=0)&&sum>sum1) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:38: error: 'sum' was not declared in this scope; did you mean 'sum2'?
   21 |         if((sum1%2==0)&&(sum2%2!=0)&&sum>sum1) printf("Yes\n");
      |                                      ^~~
      |                                      sum2
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>
using namespace boost::multiprecision;
using namespace std;
using LL = long long;
int main()
{
    LL N;cin >> N;
    vector<cpp_int> A,B;
    for(int a = 0;a < N;a++){
        cpp_int b;cin >> b;
        A.push_back(b);
    }
    for(int a = 0;a < N;a++){
        cpp_int b ;cin >> b;
        B.push_back(b);
    }
    cpp_int can = 0;
    for(int a = 0;a < N;a++){
        if(A.at(a)<B.at(a)){
        if((B.at(a)-A.at(a))%2!=0){
        LL s = (B.at(a)-A.at(a))/2*2+2;
        can += (B.at(a)-A.at(a))/2+1;
        A.at(a) += s;
        }else{
            LL s =(B.at(a)-A.at(a))/2*2;
            can += (B.at(a)-A.at(a))/2;
            A.at(a)+=s;
        }
        }
       //cout<<A.at(a)<<" "<<B.at(a)<<endl;
    }
    //cout<<can<<endl;
    cpp_int sa=0,sb=0;
    for(int a = 0;a < N;a++){
        sa += A.at(a);
        sb += B.at(a);
    }
    can = can-(sa-sb);
    //cout<<can<<endl;
    if(can < 0){
        cout<<"No"<<endl;
        return 0;
    }
    if(can == 0){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(can > 0){
        if(can%2!=0){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
        return 0;
    }
    return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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


using namespace std;

int main(){
  int n;
  cin>>n;
  long long sum=0;
  int m=0;
  long long k=0;
  long long a[n],b[n];
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n;i++){
    long long c=a[i]-b[i];
    sum+=c;
    if(c<0){
      if(c%2!=0){
        m++;
        k+=-(c-1)/2;
      }
      else k+=-c/2;
    }
  }
  // cout<<m<<sum<<endl;
  if(sum>0)cout<<"No\n";
  else if(-sum=<k)cout<<"No\n";
  else if(m%2==1)cout<<"No\n";
  else cout<<"Yes\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: expected primary-expression before '<' token
   31 |   else if(-sum=<k)cout<<"No\n";
      |                ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int a[N];
  int b[N];
  int i,j,k,l,f;
  for(i=0;i<N;i++)
  {
    cin>>a[i]>>b[i];
  }
  j=0;
  l=0;
  f=0;
  for(k=0;k<N;k++)
  {
    j=j+a[k];
    l=l+b[k];
  }
  if(l-j<0)
  {
    cout<<"No"<<endl;
  }else{
    for(k=0;k<N;k++)
    {
      int u=a[k]-b[k];
      if(u>0)
      {
         f=u+1;
      }
    }
    if(f>0)
    {
      cout<<"No"<<endl;
    }else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


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

#include<iostream>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int a[N];
  int b[N];
  int i,j,k,l,f;
  for(i=0;i<N;i++)
  {
    cin>>a[i]>>b[i];
  }
  j=0;
  l=0;
  f=0
  for(k=0;k<N;k++)
  {
    j=j+a[k];
    l=l+b[k];
  }
  if(l-j<0)
  {
    cout<<"No"<<endl;
  }else{
    for(k=0;k<N;k++)
    {
      int u=a[k]-b[k];
      if(u>0)
      {
         f=u+1;
      }
    }
    if(f>0)
    {
      cout<<"No"<<endl;
    }else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:6: error: expected ';' before 'for'
   16 |   f=0
      |      ^
      |      ;
   17 |   for(k=0;k<N;k++)
      |   ~~~ 
a.cc:17:18: error: expected ';' before ')' token
   17 |   for(k=0;k<N;k++)
      |                  ^
      |                  ;
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
  
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};

int main(){
    int n;
    cin >> n;
    ll as, bs;
    ll a[20010], b[20010];
    REP(i, n){
        cin >> a[i];
    }
    REP(i, n){
        cin >> b[i];
    }
    ll = bs = 0;
    int flag = 0;
    REP(i, n){
        if(a[i] <= b[i]){
            flag += (b[i] - a[i]) / 2;
        }else{
            bs += a[i] - b[i];
        }
    }
    if(flag >= bs){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:8: error: expected unqualified-id before '=' token
   38 |     ll = bs = 0;
      |        ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>

//typedef pair<int,int> P;

using namespace std;

int main(){
	int N;
	long long a[10000];
	long long b[10000];

	scanf("%d",&N);
	for(int i=0;i<N;i++) scanf("%lld", &a[i]);
	for(int i=0;i<N;i++) scanf("%lld", &b[i]);

	sort(a,a+N);
	reverse(a,a+N);
	sort(b,b+N);
	reverse(b,b+N);

	for(int i=0;i<N-1;i++){
		if(a[i]>b[i]){
			int tmp = a[i]-b[i];
			b[i] = a[i];
			a[i+1] += tmp*2;
		}else{
			int tmp = b[i]-a[i];
			if(tmp%2==0){
				a[i] = b[i];
				b[i+1] += tmp/2;
			}else{
				a[i] = b[i]+1;
				b[i]++;
				b[i+1] += (tmp-1)/2;
			}
		}
	}
	/*
	for(int i=0;i<N;i++) printf("%lld ", a[i]);
	printf("\n");
	for(int i=0;i<N;i++) printf("%lld ", b[i]);
	printf("\n");
	*/
	if(a[N-1]<=b[N-1] && 2*b-a<=1000000000){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:31: error: invalid operands of types 'int' and 'long long int [10000]' to binary 'operator*'
   50 |         if(a[N-1]<=b[N-1] && 2*b-a<=1000000000){
      |                              ~^~
      |                              | |
      |                              | long long int [10000]
      |                              int
Language: C++

#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define int long long
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define mod %1000000007
#define ld long double
#define pll pair<ll,ll>
bool comp(P p1,P p2)
{
    if(p1.ff.ff!=p2.ff.ff)
        return p1.ff.ff<p2.ff.ff;
    else
        return p1.ss<p2.ss;
}

int32_t main()
{
     IOS;
    
     #endif
     int n;
     cin>>n;
     vi a(n),b(n);
     for(int i=0;i<n;i++)
     {
        cin>>a[i];
     }
     for(int i=0;i<n;i++)
     {
        cin>>b[i];
     }
     ll ansa=0;
     ll ansb=0;
     int ch=1;
     for(int i=0;i<n;i++)
     {
        if(a[i]<b[i])
        {
                ansa+=(b[i]-a[i])/1;
           }
        else
        {
            ansb+=a[i]-b[i];
        }
       // trace2(i,ch);
     }


     if(ansa<ansb)
        ch=0;
    if(ansa-ansb<1)
    {
        ch=0;
    }
    if(ansb==0)
        ch=1;
    if(ch)
        cout<<"Yes";
    else
        cout<<"No";
     return 0;
}

Compiler output:
a.cc:46:7: error: #endif without #if
   46 |      #endif
      |       ^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

void check(vector<int> x) {
  for (int i = 0; i < (int)x.size(); i++) {
    if (i)
      cout << ' ';
    cout << x[i];
  }
  cout << endl;
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  long long cnt = 0;
  for (int i = 0; i < N; i++) {
    if (a[i] - b[i] < 0) {
      int tmp = (b[i] - a[i]) / 2 + (b[i] - a[i]) % 2;
      cnt += tmp;
      a[i] += tmp * 2;
    }
  }
  for (int i = 0; i < N; i++) {
    if (cnt <= 0)
      break;
    if (a[i] - b[i] > 0) {
      int tmp = a[i] - b[i];
      if (cnt < tmp)
        b[i] += cnt;
      else
        b[i] = a[i];
      cnt -= min(cnt, tmp);
    }
  }
  for (int i = 0; i < N; i++) {
    if (a[i] != b[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: no matching function for call to 'min(long long int&, int&)'
   53 |       cnt -= min(cnt, tmp);
      |              ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:53:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |       cnt -= min(cnt, tmp);
      |              ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:53:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |       cnt -= min(cnt, tmp);
      |              ~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#define r(i,n) for(int i=0; i<n; i++)
typedef long long ll;
using namespace std;

int main(void){
  int n;
  ll a[10010]={};
  ll b[10010]={};
  ll l=0;
  ll s=0;
  cin >> n;
  r(i,n){
    cin >> a[i];
  }
  r(i,n){
    cin >> b[i];
    if(a[i]<=b[i]){
      s+=b[i]-a[i];
      if((b[i]-a[i])%2==1){
        t1++;
      }
    }
    else{
      l-=a[i]-b[i];
      if((a[i]-b[i])%2==1){
        t1++;
      }
    }

  }

  if(s>=l*2 && t1%2==0){cout << "Yes" << endl;}
  else{cout << "No" << endl;}

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 't1' was not declared in this scope; did you mean 'tm'?
   28 |         t1++;
      |         ^~
      |         tm
a.cc:34:9: error: 't1' was not declared in this scope; did you mean 'tm'?
   34 |         t1++;
      |         ^~
      |         tm
a.cc:40:16: error: 't1' was not declared in this scope; did you mean 'tm'?
   40 |   if(s>=l*2 && t1%2==0){cout << "Yes" << endl;}
      |                ^~
      |                tm
Language: C

#include<stdio.h>
int main()
{
    int n;
    long a[10000], b[10000];
    scanf("%d", &n);
    int i;
    int dp = 0, dm = 0;
    for (i = 0; i < n; i++)
        scanf("%ld", &a[i]);
    for (i = 0; i < n; i++)
        scanf("%ld", &b[i]);
    for (i = 0; i < n; i++)
    {
        if (a[i] < b[i])
        {
            if((b[i]-a[i])%2==0)
                dp += (b[i] - a[i]);
            else
                dp+=((b[i]-a[i])-1)
        }
        else
            dm += (a[i] - b[i]);
    }
    if (dp<2*dm)
    {
        printf("No\n");
        return 0;
    }
    else
    {
        printf("Yes\n");
        return 0;
    }
}

Compiler output:
main.c: In function 'main':
main.c:20:36: error: expected ';' before '}' token
   20 |                 dp+=((b[i]-a[i])-1)
      |                                    ^
      |                                    ;
   21 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n; cin>>n;
    vi v(n);
    vi u(n);
    rep(i,n)cin>>v[i];
    rep(i,n)cin>>u[i];
    sort(all(v));a
    sort(all(u));
    int dif=0;
    int cnt=0;
    rep(i,n){
        if(v[i]>u[i])dif=v[i]-u[i];
        else if(u[i]>v[i])cnt=u[i]-v[i];
    }
    if(cnt*2==dif || dif==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
   // cout<<cnt<<" "<<dif<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: 'a' was not declared in this scope
   30 |     sort(all(v));a
      |                  ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define int long long
int N;
std::vector<int> a;
std::vector<int> b;
int main() {
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		int tmp;
		std::cin >> tmp;
		a.push_back(tmp);
	}
	for (int i = 0; i < N; i++) {
		int tmp;
		std::cin >> tmp;
		b.push_back(tmp);
	}
	int adda = 0;
	int addb = 0;
	for (int i = 0; i < N - 1; i++) {
		a[i] += adda;
		b[i] += addb;
		adda = 0;
		addb = 0;
		if (a[i] - b[i] < 0) {
			addb = (b[i] - a[i] + 1) / 2;
			if ((b[i] - a[i]) % 2 != 0)addb--;
		}
		if (b[i] - a[i] < 0) {
			adda = (a[i] - b[i]) * 2;
		}
	}
	if (a[N - 1] + adda <= b[N - 1] + addb)std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
	return 0;
}

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

#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
const int maxn=1e6+20;

int a[10005],b[10005];

int main()
{
	int n;
    LL c1=0,c2=0;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<=n;i++){
        if(a[i]>b[i]) c1=c1+a[i]-b[i];
        else if(a[i]<b[i]){
            if((b[i]-a[i])%2==0) c2=c2+(b[i]-a[i])/2;
            else {c1++;c2=c2+(b[i]-a[i]+1)/2;}
        }
    }
    
    if(c2>=c1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}//Good luck,mate!^_^

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'LL' was not declared in this scope; did you mean 'll'?
   12 |     LL c1=0,c2=0;
      |     ^~
      |     ll
a.cc:17:23: error: 'c1' was not declared in this scope; did you mean 'y1'?
   17 |         if(a[i]>b[i]) c1=c1+a[i]-b[i];
      |                       ^~
      |                       y1
a.cc:19:34: error: 'c2' was not declared in this scope
   19 |             if((b[i]-a[i])%2==0) c2=c2+(b[i]-a[i])/2;
      |                                  ^~
a.cc:20:19: error: 'c1' was not declared in this scope; did you mean 'y1'?
   20 |             else {c1++;c2=c2+(b[i]-a[i]+1)/2;}
      |                   ^~
      |                   y1
a.cc:20:24: error: 'c2' was not declared in this scope
   20 |             else {c1++;c2=c2+(b[i]-a[i]+1)/2;}
      |                        ^~
a.cc:24:8: error: 'c2' was not declared in this scope
   24 |     if(c2>=c1) cout<<"Yes"<<endl;
      |        ^~
a.cc:24:12: error: 'c1' was not declared in this scope; did you mean 'y1'?
   24 |     if(c2>=c1) cout<<"Yes"<<endl;
      |            ^~
      |            y1
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,s1=0,s2=0;
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		s1+=a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		s2+=b[i];
	}
	if(a[i]-b[i]<n)
	{
		cout<<"No";
		return 0;
	}
	else
	cout<<"Yes";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'i' was not declared in this scope
   18 |         if(a[i]-b[i]<n)
      |              ^
Language: C++

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

using ll = long long;
using pii = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;

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

int main() {
    int N; cin >> N;
    vector<ll> a(N), b(N);
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> b[i];
    }
    for(int i = 0; i < N; ++i) {
        if(b[i] < a[i]) {
            for(int j = 0; j < N; ++j) {
                ll t = max(min((b[j] - a[j]) / 2, a[i] - b[i]), 0);
                b[i] += t;
                a[j] += 2 * t;
            }
        }
    }
    bool ok = true;
    for(int i = 0; i < N; ++i) {
        ok &= a[i] <= b[i];
    }
    if(ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:27: error: no matching function for call to 'max(const long long int&, int)'
   25 |                 ll t = max(min((b[j] - a[j]) / 2, a[i] - b[i]), 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:25:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   25 |                 ll t = max(min((b[j] - a[j]) / 2, a[i] - b[i]), 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:25:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   25 |                 ll t = max(min((b[j] - a[j]) / 2, a[i] - b[i]), 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int N,a,b;
  int A=0,B=0;
  cin >> N ;
  LOOP(i,N){
    cin >> a >> b;
    A+=a;B+=b;
  }
  if(A=<B){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: expected primary-expression before '<' token
   24 |   if(A=<B){
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
#define v(T) vector<T>
#define vv(T) vector<v(T)>
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

bool chk(int l, int r, string s, string t){
    if (s==t and (r-l)%2==1) return true;
    if (s!=t and (r-l)%2==0) return true;
    return false;
}


int main()
{
    int n;
    cin >> n;
    int l=0, r = n-1;
    string s, t, u;
    cout << l << endl;
    cin >> s;
    if (s == "Vacant") return 0;
    cout << r << endl;
    string t;
    cin >> t;
    if (t == "Vacant") return 0;
    while (u != "Vacant"){
        int m = (l+r)/2;
        cout << m << endl;
        cin >> u;
        if (u == "Vacant") return 0;
        if (chk(l, m-1, s, u)) {r = m-1;t = u;}
        if (chk(m+1, r, u, t)) {l = m+1;s = u;}
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: redeclaration of 'std::string t'
   33 |     string t;
      |            ^
a.cc:28:15: note: 'std::string t' previously declared here
   28 |     string s, t, u;
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
#define v(T) vector<T>
#define vv(T) vector<v(T)>
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

bool chk(int l, int r, string s, string t){
    if (s==t and (r-l)%2==1) return true;
    if (s!=t and (r-l)%2==0) return true;
    return false;
}


int main()
{
    int n;
    cin >> n;
    int l=0, r = n-1;
    string s, t, u;
    cout << l << endl;
    cin >> s;
    if (s == "Vacant") return 0;
    cout << r << endl;
    string t;
    cin >> t;
    if (t == "Vacant") return 0;
    while (u != "Vacant"){
        int m = (l+r)/2;
        cout << m << endl;
        cin >> u;
        if (u == "Vacant") return 0;
        if (chk(l, m-1, s, u)) {r = m-1;t = u;}
        if (chk(m+1, r, u, t)) {l - m+1;s = u;}
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: redeclaration of 'std::string t'
   33 |     string t;
      |            ^
a.cc:28:15: note: 'std::string t' previously declared here
   28 |     string s, t, u;
      |               ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  int l = 0, r = n - 1, m;

  string sl, sr, sm;
  cout << l;
  fflush(stdout);
  cin >> sl;
  cout << r;
  fflush(stdout);
  cin >> sr;
  if (sl == "Vacant" || sr == "Vacant") return 0;

  while (true) {
    m = r / 2;
    cout << m;
    fflush(stdout);
    cin >> sm;
    if (sm == "Vacant") return 0;
    if ((r - l) % 2 == 0) {
      if (sl == sm) {
        sl = sm;
      } else {
        sr = sm;
      }
    } else {
      if (sl == sm) {
        sr = sm;
      } else {
        sl = sm;
      }
    }
    return 0;
  }


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

#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

bool query(int &l,int &r,char &lch,char &rch){
    int mid = (l+r)/2;
    cout << mid << "\n" << flush;
    string s; cin >> s;
    if(s[0] == 'V') return true;
    else if(s[0]=='M'){
        if((mid-l)%2 == 0 && lch == 'M') l = mid;
        else if((mid-l)%2 == 1 && lch == 'F'){
            l = mid;
            lch = 'F';
        }else r = mid;
    }else{
        if((mid-l)%2 == 0 && lch == 'F') l = mid;
        else if((mid-l)%2 == 1 && lch == 'M'){
            l = mid;
            lch = 'M';
        }else r = mid;
    }
    return false;
}

int main(){
    int n;cin >> n;
    bool flag = false;
    cout << 0 << "\n" << flush;
    string s;cin >> s;
    if(s[0]=='V') return 0;
    int l = 0;
    int r = n;
    while(!flag){
        flag = query(l,r,s[0]);
    }
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:21: error: too few arguments to function 'bool query(int&, int&, char&, char&)'
   41 |         flag = query(l,r,s[0]);
      |                ~~~~~^~~~~~~~~~
a.cc:11:6: note: declared here
   11 | bool query(int &l,int &r,char &lch,char &rch){
      |      ^~~~~
Language: Java

import java.util.*;import java.io.*;import java.math.*;
public class Main{
        public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          int N = sc.nextInt();
          System.out.println(0);
          sc = new Scanner(System.in);
          String mae = sc.next();
          if(last.equals("Vacant")){
            return;
          }
          int L = 0;
          int R = N - 1;
            while(true){
              if(R - L == 1){
                System.out.println(R);
                return;
              }
              int C = (R + L) / 2;
              System.out.println(C);
              sc = new Scanner(System.in);
              String ato = sc.next();
          		if(ato.equals("Vacant")){
                  return;
                }else if((C - L) % 2 == 0){
                  if(ato.equals(mae)){
                    L = C;
                    mae = ato;
                  }else{
                    R = C - 1;
                  }
                }else{
                  if(ato.equals(mae)){
                    R = C - 1;
                  }else{
                    L = C;
                    mae = ato;
                  }
                }
            }
        }
}


Compiler output:
Main.java:9: error: cannot find symbol
          if(last.equals("Vacant")){
             ^
  symbol:   variable last
  location: class Main
1 error
Language: Java

import java.util.*;import java.io.*;import java.math.*;
public class Main{
        public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          int N = sc.nextInt();
          System.out.println(0);
          sc = new Scanner(System.in);
          String last = sc.next();
          if(last.equals("Vacant")){
            return;
          }
          System.out.println(N - 1);
          last = sc.next();
          if(last.equals("Vacant")){
            return;
          }
          int L = 0;
          int R = N - 1;
          int C = (R + L) / 2;
          System.out.println(C);
          String res = sc.next();
            while(true){
          		if(res.equals("Vacant")){
                  return;
                }else if(res.equals("Male")){
                  if(last.equlas("Male")){
                    R = C;
                  }else{
                    L = C;
                  }
                }else{
                  if(last.equlas("Female")){
                    R = C;
                  }else{
                    L = C;
                  }
                }
              last = res;
              C = (R + L) / 2;
              System.out.println(C);
              sc = new Scanner(System.in);
              res = sc.next();
            }
        }
}


Compiler output:
Main.java:26: error: cannot find symbol
                  if(last.equlas("Male")){
                         ^
  symbol:   method equlas(String)
  location: variable last of type String
Main.java:32: error: cannot find symbol
                  if(last.equlas("Female")){
                         ^
  symbol:   method equlas(String)
  location: variable last of type String
2 errors
Language: C++

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

int main(){
  int N;
  cin>>N;
  string temp;
  string A[N];
  
  cout<<0<<endl;
  cin>>temp;
  if(temp=="Vacant"){
    cout<<0<<endl;
    return 0;
  }
  if(temp=="Male"){
    A[0]="Male";
  }
  if(temp=="Female"){
    A[0]="Female";
  }
  
  cout<<N-1<<endl;
  cin>>temp;
  if(temp=="Vacant"){
    cout<<N-1<<endl;
    return 0;
  }
  if(temp=="Male"){
    A[N-1]="Male";
  }
  if(temp=="Female"){
    A[N-1]="Female";
  }
  int l=N-1;
  int r=0;

  while(1){
    if(l-r<2) break;
    int m=(l+r)/2;
    cout<<m<<endl;
    cin>>temp;
    if(temp=="Vacant"){
      cout<<m<<endl;
      return 0;
    }
    if(temp=="Male"){
      A[m]="Male";
    }
    if(temp=="Female"){
      A[m]="Female";
    }  
    if(A[l]==A[m]){
      r=m;
    }
    if(A[r]==A[m]){
      l=m;
    }
  }
  whilr(1){
  cout<<r<<endl;
  cin>>temp;
  if(temp=="Vacant"){
    cout<<r<<endl;
    return 0;
  }
    r++;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:3: error: 'whilr' was not declared in this scope
   60 |   whilr(1){
      |   ^~~~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  string temp;
  strint A[N];
  
  cout<<0<<endl;
  cin>>temp;
  if(temp=="Vacant"){
    cout<<0<<endl;
    return 0;
  }
  if(temp=="Male"){
    A[0]="Male";
  }
  if(temp=="Female"){
    A[0]="Female";
  }
  
  cout<<N-1<<endl;
  cin>>temp;
  if(temp=="Vacant"){
    cout<<N-1<<endl;
    return 0;
  }
  if(temp=="Male"){
    A[N-1]="Male";
  }
  if(temp=="Female"){
    A[N-1]="Female";
  }
  int l=N-1;
  int r=0;

  while(1){
    int m=(l+r)/2;
    cout<<m<<endl;
    cin>>temp;
    if(temp=="Vacant"){
      cout<<m<<endl;
      return 0;
    }
    if(temp=="Male"){
      A[m]="Male";
    }
    if(temp=="Female"){
      A[m]="Female";
    }  
    if(A[l]==A[m]){
      l=m;
    }
    if(A[r]==A[m]){
      r=m;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'strint' was not declared in this scope; did you mean 'strcat'?
    8 |   strint A[N];
      |   ^~~~~~
      |   strcat
a.cc:17:5: error: 'A' was not declared in this scope
   17 |     A[0]="Male";
      |     ^
a.cc:20:5: error: 'A' was not declared in this scope
   20 |     A[0]="Female";
      |     ^
a.cc:30:5: error: 'A' was not declared in this scope
   30 |     A[N-1]="Male";
      |     ^
a.cc:33:5: error: 'A' was not declared in this scope
   33 |     A[N-1]="Female";
      |     ^
a.cc:47:7: error: 'A' was not declared in this scope
   47 |       A[m]="Male";
      |       ^
a.cc:50:7: error: 'A' was not declared in this scope
   50 |       A[m]="Female";
      |       ^
a.cc:52:8: error: 'A' was not declared in this scope
   52 |     if(A[l]==A[m]){
      |        ^
a.cc:55:8: error: 'A' was not declared in this scope
   55 |     if(A[r]==A[m]){
      |        ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
int main(){
    int n,r;cin>>n;
    int r =0,l=n-1,m=(l-r+1)/2;
    cout<<r<<endl;
    string b,s;
    cin>>b;
    if(b=="Vacant"){
        return 0;
    }
    rep(i,19){
        cout<<m<<endl;
        cin>>s;
        if(s=="Vacant"){
            return 0;
        }
        if((m-r)%2){
            if(b==s){
                l=m;
            }
            else{
                r=m;
            }
        }
        else{
            if(b==s){
                r=m;
            }
            else{
                l=m;
            }
        }
        m=(l-r+1)/2;
        b=s;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: redeclaration of 'int r'
   18 |     int r =0,l=n-1,m=(l-r+1)/2;
      |         ^
a.cc:17:11: note: 'int r' previously declared here
   17 |     int n,r;cin>>n;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
cout << 0 << endl;
string s;
cin>>s;
string t = s;
ll ok = 0;
ll ng = n+1;
if(s=="Vacant") return 0;
rep(i,19){
ll mid = (ok + ng) / 2;
cout << mid << endl;
cin >> s;
if(s=="Vacant") return 0;
if(s==t){
            if((mid-ok)%2)ng=mid;
            else ok=mid; t = s;
        }
        else{
            if((mid-ok)%2)ok=mid; t = s;
            else ng=mid;
        }
t = s;}
return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:13: error: 'else' without a previous 'if'
   56 |             else ng=mid;
      |             ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
int n;
cin>>n;
cout << 0 << endl;
string s;
cin>>s;
string t = s;
int p=0;
if(s=="Vacant") return 0;
else{
int ng = 0;
int ok = n+1;
rep(i,20){
int mid = (ok + ng) / 2;
cout << mid << endl;
cin >> s;
if(s=="Vacant") break;
else if(abs(mid-ng)%2==0&&s==t)||abs(mid-ng)%2==1&&s!=t)){
       ng = mid;}
else ok =mid;
p =mid;
t = s;}
return 0;}}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:32: error: expected primary-expression before '||' token
   52 | else if(abs(mid-ng)%2==0&&s==t)||abs(mid-ng)%2==1&&s!=t)){
      |                                ^~