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

#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;
pair<ll, ll> ps[1 << 20];

int main(void) {

  int n;
  cin >> n;
  n--;
  int d = 0;
  while (n >= 1 << d) d++;
  d--;

  string s, t;
  cout << 0 << endl;
  cin >> s;
  if (s == "Vacant") return 0;

  int k = 1 << d;
  while (true) {
    cout << k << endl;
    cin >> t;
    if (t == "Vacant") return 0;
    if ((k % 2 == 0 && t == s) || (k % 2 == 1 && t != s) ) {
      int e = 0;
      while (n - k >= 1 << e) e++;
      e--;
      k += 1 << e;
    }
    if ((k % 2 == 0 && t != s) || (k % 2 == 1 && t == s)) {
      k -= 1 << e;
      e--;
      k += 1 << e;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: 'e' was not declared in this scope
   51 |       k -= 1 << e;
      |                 ^
Language: C++

#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

string q(int i){
  cout<<i<<endl;
  string t;cin>>t;
  return t;
}

int main(){
  int n;cin>>n;

  int min=0, max=n-1, mid0;
  string c=q(0);
  if(c=="Vacant"){ cout<<0;return 0; }

  while(max-min==1){
    mid=(min+max)/2;
    string mc;
    mc = q(mid);
    if(mc=="Vacant")return 0;
    // 偶数位置に0indexと異なる性別の人間が座っている
    // もしくは奇数位置に0indexと同じ性別の人間が座っている
    // つまりmidよりも前に空席が存在して順番をずらしている
    if(mid%2==0 && mc!=c || mid%2==1 && mc==c) max=mid;
    else min=mid;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'mid' was not declared in this scope; did you mean 'mid0'?
   22 |     mid=(min+max)/2;
      |     ^~~
      |     mid0
Language: C++

#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

string q(int i){
  cout<<i<<endl;
  string t;cin>>t;
  return t;
}

int main(){
  int n;cin>>n;

  int min=0, max=n-1, mid0;
  string c=q(0);
  if(c=="Vacant"){ cout<<0;return 0; }

  while(max-min==1){
    mid=(min+max)/2
    string mc;
    mc = q(mid);
    if(mc=="Vacant")return 0;
    // 偶数位置に0indexと異なる性別の人間が座っている
    // もしくは奇数位置に0indexと同じ性別の人間が座っている
    // つまりmidよりも前に空席が存在して順番をずらしている
    if(mid%2==0 && mc!=c || mid%2==1 && mc==c) max=mid;
    else min=mid;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'mid' was not declared in this scope; did you mean 'mid0'?
   22 |     mid=(min+max)/2
      |     ^~~
      |     mid0
a.cc:24:5: error: 'mc' was not declared in this scope; did you mean 'c'?
   24 |     mc = q(mid);
      |     ^~
      |     c
Language: C++

#include <cstdio>
#include <string>

using namespace std;

int main(void){
  int N;
  scanf("%d", &N);
	
	printf("%d\n", 0); fflush(stdout);
	string current; scanf("%s", &current);
	if (current == "Vacant") return 0;
	
	int left=0, right=N;
	rep(i, 20) {
		int mid = (left+right)/2;
		printf("%d\n", mid); fflush(stdout);
		string ans; scanf("%s", &ans);
		if (ans == "Vacant") return 0;
		else if (ans == current) left = mid;
		else right = mid;	
	}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'i' was not declared in this scope
   15 |         rep(i, 20) {
      |             ^
a.cc:15:9: error: 'rep' was not declared in this scope
   15 |         rep(i, 20) {
      |         ^~~
Language: Java

import java.util.*;
public class Main {
        
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static String[] mySplit(String str){return str.split("");}
        public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          int N = sc.nextInt();
          int count = 0;
          while(true){
            myout(count);
            count++;
            sc = new Scanner(System.in);
            String res = sc.next();
            if("Vacant".equals(res)){
              return;
            }
          }
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


Compiler output:
Main.java:6: error: cannot find symbol
        static String getStr(){return sc.next();}
                                      ^
  symbol:   variable sc
  location: class Main
Main.java:9: error: cannot find symbol
        static boolean isNext(){return sc.hasNext();}
                                       ^
  symbol:   variable sc
  location: class Main
2 errors
Language: Java

import java.util.*;
public class Main {
        
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static String[] mySplit(String str){return str.split("");}
        public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          int N = sc.nextInt();
          int count = 0;
          while(true){
            myout(count);
            int++;
            sc = new Scanner(System.in);
            String res = sc.next();
            if("Vacant".equals(res)){
              return;
            }
          }
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


Compiler output:
Main.java:17: error: not a statement
            int++;
            ^
Main.java:17: error: ';' expected
            int++;
               ^
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N; cin>>N;
  cout<<0<<endl;
  string MS;
  cin>>MS;
  if(MS=="Vacant")
    cout<<0<<endl;
  else{
    int MI=0;
    int BI=N;
    rep(_,1,N){
      int Mid=(MI+BI)/2;
      cout<<Mid<<endl;
      string S; cin>>S;
      if(MS=="Vacant"){
         cout<<Mid<<endl;
        break;
        }
      if((Mid-MI)%2==0){
        if(S==MS){
          MS=S;
          MI=Mid;
          }
        else
          BI=Mid;
        }
      else{
         if(S!=MS){
          MS=S;
          MI=Mid;
          }
        else
          BI=Mid;
        }
        }
      }
    }
  }


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

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;

signed main() {
    int N;
    cin >> N;
    cout << (N + 1) / 2 - 1 << endl;
    cout << flash;
    int left = 0;
    int right = N - 1;
    N = N / 2;
    for(int i = 0;i < 20;i++) {
        string S;
        cin >> S;
        if(S == "Vacant") {
            return 0;
        }
        else if(S == "Male") {
            left += N;
        }
        else {
            right -= N;
        }
        N = N / 2;
        cout << left + N << endl;
        cout << flash;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'flash' was not declared in this scope; did you mean 'fflush'?
   13 |     cout << flash;
      |             ^~~~~
      |             fflush
Language: C++

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

int ask(int v){ //席vについて尋ねる
  
  cout << v << endl;
  fflush(stdout);
  string s; cin >> s;
  if( s == "Vacant"){ exit(0);}
  if( s == "Male"){ return 1;}
  else{ return 2;}
  
}

int main(){
  int N; cin >> N;
  int left = 0; int right = N-1; 
  
  vector<int> gender(N,0); //0は未定
  
  gender[0] = ask(0);
  gender[N-1] = ask(N-1);
  
  while(right-left > 1){
    
    int mid = (right+left)/2;
    
    gender[mid] = ask(mid);
    
    if( gender[mid] == gender[left] && (mid-left)%2 ){left = mid;}
    else{ right = mid;}
      
    }
    
  }

  
  return 0;
}

Compiler output:
a.cc:39:3: error: expected unqualified-id before 'return'
   39 |   return 0;
      |   ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

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

const ll MOD=1000000007;

ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}

ll pow1(ll a,ll b){
  ll p=1;
  for(int i=0;i<b;i++){
    p*=a;
  }
  return p;
}

int digit(ll a,ll b){
  int i=0;
  while(a!=0){
    a/=b;
    i++;
  }
  return i;
}

ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}

ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}

ll modRev(ll a,ll p){
  ll n=solveLinear(a,p,1);
  n=n%p;
  if(n<0)return n+p;
  return n;
}

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  string s="";
  strint t;
  cout<<0<<endl;
  cin>>t;
  int left=0,right=n;
  while(s!="Vacant"){
    i=(left+right)/2;
    cout<<i<<endl;
    cin>>s;
    if(t==s){
      left=i;
    }else{
      right=i;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:3: error: 'strint' was not declared in this scope; did you mean 'strcat'?
   76 |   strint t;
      |   ^~~~~~
      |   strcat
a.cc:78:8: error: 't' was not declared in this scope
   78 |   cin>>t;
      |        ^
Language: C++

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

int main()
{
    int n;
    cin >> n;
    int l = 0, r = n + 1;
    string left, right;
    cout << 0 << endl;
    fflush(stdout);
    cin >> left;
    right = left;
    while(true){
        string center;
        int c = (l + r) / 2;
        cout << c << endl;
        fflush(stdout);
        cin >> center;
        if(center == "Vacant") return 0;
        if(center == right){
            if((r - c) % 2){
                l = c;
                left = center;
            }
            else{
                r = c;
                right = center;
            }
        }
        else{
            if((r - c) % 2){
                r = c;
                right = center;
            }
            else{
                l = c;
                left = center;
            }
        }
        if(right - left <= 1) return 0;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:18: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   42 |         if(right - left <= 1) return 0;
      |            ~~~~~ ^ ~~~~
      |            |       |
      |            |       basic_string<[...]>
      |            basic_string<[...]>
In file included from /usr/include/c++/14/string:48,
                 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:42:20: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   42 |         if(right - left <= 1) return 0;
      |                    ^~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:42:20: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
   42 |         if(right - left <= 1) return 0;
      |                    ^~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {

  int n;
  cin >> n;

  function<bool(int)> query = [&](int k) {
    cout << k << endl;
    string s;
    cin >> s;
    if (s == "Vacant")
      exit(0);
    return s == "Male";
  };
  int l = 1, r = n;
  bool resl = query(l), resr = query(r);
  while (r - l > 2) {
    int mid = (l + r) >> 1;
    bool res = query(mid);
    if ((res ^ resl ^ mid ^ l) & 1) {
      r = mid;
      resr = res;
    } else {
      l = mid;
      resl = res;
    }
  }
  query((l + r) >> 1);
  assert(false);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:3: error: 'assert' was not declared in this scope
   74 |   assert(false);
      |   ^~~~~~
a.cc:18:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   17 | #include <iostream>
  +++ |+#include <cassert>
   18 | #include <limits>
Language: C++

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

int main(){
    int N;
    cin >> N;
    string s;
    cout << 0 << endl;
    cin >> s;
    if (s == "Vacant") return 0;
    bool check = (s == "Male");
    cout << N-1 << endl;
    cin >> s;
    if (s == "Vacant") return 0;
    l = 0;
    r = N;
    while (true) {
        c = (l+r)/2;
        cout << c << endl;
        cin >> s;
        if (s == "Vacant") return 0;
        if ((s == "Male") ^ (c%2==0)) r = c;
        else l = c;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'l' was not declared in this scope
   16 |     l = 0;
      |     ^
a.cc:17:5: error: 'r' was not declared in this scope
   17 |     r = N;
      |     ^
a.cc:19:9: error: 'c' was not declared in this scope
   19 |         c = (l+r)/2;
      |         ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<string> seat(N);
  int Left = 0;
  int Right = N;
  int dist;
  for (int i = 0; i < 20; i++) {
    if (i == 0) {
      cout << 0 << endl;
      cin >> dist;
      cin >> seat[0];
      if (seat[0] == "Vacant") break;
    } else {
      int pivot = left + (Right - Left) / 2;
      cout << pivot << endl;
      cin >> dist;
      cin >> seat[pivot];
      if (seat[pivot] == "Vacant") break;
      if (seat[Left] == seat[pivot] && (pivot - Left) % 2 == 0) Left = pivot;
      else if (seat[Left] != seat[pivot] && (pivot - Left) % 2 != 0) Left = pivot;
      else Right = pivot;
    }
  }        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |       int pivot = left + (Right - Left) / 2;
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:19:24: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   19 |       int pivot = left + (Right - Left) / 2;
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        std::ios_base& (*)(std::ios_base&)
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<string> seat(N);
  int Left = 0;
  int Right = N;
  for (int i = 0; i < 20; i++) {
    if (i == 0) {
      cout << 0 << endl;
      cin >> dist;
      cin >> seat[0];
      if (seat[0] == "Vacant") break;
    } else {
      int pivot = left + (Right - Left) / 2;
      cout << pivot << endl;
      cin >> dist;
      cin >> seat[pivot];
      if (seat[pivot] == "Vacant") break;
      if (seat[Left] == seat[pivot] && (pivot - Left) % 2 == 0) Left = pivot;
      else if (seat[Left] != seat[pivot] && (pivot - Left) % 2 != 0) Left = pivot;
      else Right = pivot;
    }
  }        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'dist' was not declared in this scope
   14 |       cin >> dist;
      |              ^~~~
a.cc:18:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |       int pivot = left + (Right - Left) / 2;
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:18:24: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   18 |       int pivot = left + (Right - Left) / 2;
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        std::ios_base& (*)(std::ios_base&)
a.cc:20:14: error: 'dist' was not declared in this scope
   20 |       cin >> dist;
      |              ^~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<string> seat(N);
  int Left = 0;
  int Right = N;
  for (int i = 0; i < 20; i++) {
    if (i == 0) {
      cout << 0 << endl;
      cin >> seat[0];
      if (seat[0] == "Vacant") break;
    } else {
      int pivot = left + (Right - Left) / 2;
      cout << pivot << endl;
      cin >> seat[pivot];
      if (seat[pivot] == "Vacant") break;
      if (seat[Left] == seat[pivot] && (pivot - Left) % 2 == 0) Left = pivot;
      else if (seat[Left] != seat[pivot] && (pivot - Left) % 2 != 0) Left = pivot;
      else Right = pivot;
    }
  }        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |       int pivot = left + (Right - Left) / 2;
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:17:24: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   17 |       int pivot = left + (Right - Left) / 2;
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        std::ios_base& (*)(std::ios_base&)
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  vector<string> s(n);
  cout << 0 << endl;
  cin >> s[0];
  cout << n-1 << endl;
  cin >> s[n-1];
  if(s[0]=="Vacant"||s[n-1]=="Vacant"){
    return 0;
  }
  int l=0,r=n-1;
  for(int i=0;i<17;i++){
    int k=(l+r)/2;
    cout << k << endl;
    cin >> s[k];
    if(s[k]=="Vacant"){
      return 0;
    }
    if((k-1-l)%2==0){
      if(s[l]!=s[k-1]){
        r=k-1;
        continue;
      }
    }
    else{
      if(s[l]==s[k-1]){
        r=k-1;
        continue;
      }
    }
    if((r-(k+1))%2==0){
      if(s[r]!=s[k+1]){
        l=k+1;
        continue;
      }
    }
    else{
      if(s[r]==s[k+1]){
        l=k+1;
        continue;
      }
    }
  }
  cout << k+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:11: error: 'k' was not declared in this scope
   46 |   cout << k+1 << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  vector<string> s(n);
  cout << 0 << endl;
  cin >> s[0];
  cout << n-1 << endl;
  cin >> s[n-1];
  int l=0,r=n-1;
  while(){
    int k=(l+r)/2;
    cout << k << endl;
    cin >> s[k];
    if((k-1-l)%2==0){
      if(s[l]!=s[k-1]){
        r=k-1;
        continue;
      }
    }
    else{
      if(s[l]==s[k-1]){
        r=k-1;
        continue;
      }
    }
    if((r-(k+1))%2==0){
      if(s[r]!=s[k+1]){
        l=k+1;
        continue;
      }
    }
    else{
      if(s[r]==s[k+1]){
        l=k+1;
        continue;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: expected primary-expression before ')' token
   11 |   while(){
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  string s,t;
  int k=0;
  for(int i=0;i<20;i++){
    cout << k << endl;
    cin >> s;
    if(s=="Vacant"){
      return 0;
    }
    if(i){
      if(s==t){
        k+=k/2;
        k+=k%2
      }
      else{
        k=k/2;
        k+=k%2;
      }
    }
    else{
      k=n/2;
      k+=k%2;
    }
    t=s;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: expected ';' before '}' token
   16 |         k+=k%2
      |               ^
      |               ;
   17 |       }
      |       ~
Language: C++

#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;

int query(int i) {
    printf("%d\n", i);
    fflush(stdout);
    char s[10];
    scanf_s("%s", s);
    return s[0] == 'V' ? 0 : s[0] == 'M' ? 1 : -1;
}

int main() {
    int N;
    scanf_s("%d", &N);

    int low = 0, high = N - 1;
    int slow = query(low);
    if (slow == 0) return 0;
    int shigh = query(high);
    if (shigh == 0) return 0;

    for (int i = 0; i < 18; ++i) {
        int mid = (low + high) / 2;
        int smid = query(mid);
        if (smid == 0) return 0;

        if ((smid != slow) ^ ((mid - low) % 2)) {
            high = mid;
            shigh = smid;
        }
        else if ((smid != shigh) ^ ((high - mid) % 2)) {
            low = mid;
            slow = smid;
        }
        else {
            low = mid;
            slow = smid;
        }
    }
}

Compiler output:
a.cc: In function 'int query(int)':
a.cc:19:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   19 |     scanf_s("%s", s);
      |     ^~~~~~~
      |     scanf
a.cc: In function 'int main()':
a.cc:25:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   25 |     scanf_s("%d", &N);
      |     ^~~~~~~
      |     scanf
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;

const int MAX = 3e5 + 10;


int main()
{
	int n; cin>>n;
	int l=0,r=n-1;
	cout<<0<<endl;
	string L; cin>>L;
	if(L=="Vacant") return 0;

	while(l<=r) {
		int mid = (l+r)/2;
		cout<<mid<<endl;
		cin>>M;

		if(M=="Vacant") return 0;

		int left=mid-l+1;

		if(left%2==1 and L==M){
			L=M;
			l=mid;
		} //move right

		else if(left%2==0 and L!=M){
			L=M;
			l=mid;
		} //move right	

		else {
			r=mid;
		} //move left	
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'M' was not declared in this scope
   20 |                 cin>>M;
      |                      ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;

const int MAX = 3e5 + 10;


int main()
{
	int n; cin>>n;
	int l=0,r=n-1;
	cout<<0<<endl; fflush(stdout);
	string L,R; cin>>L;
	if(L=="Vacant") return 0;
	cout<<n-1<<endl; fflush(stdout);
	cin>>R;	
	if(R=="Vacant") return 0;

	while(true) {
		int mid = (l+r)/2;
		cout<<mid; fflush(stdout);
		cin>>M;

		if(M=="Vacant") return 0;

		int left=mid-l+1;
		int right=r-mid+1;

		if(left%2==1 and L==M){
			L=M;
			l=mid;
		} //move right

		else if(left%2==0 and L!=M){
			L=M;
			l=mid;
		} //move right	

		else {
			R=M;
			r=mid;
		} //move left	
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: 'M' was not declared in this scope
   23 |                 cin>>M;
      |                      ^
Language: C++

#include <iostream>
using namespace std;

int main(void){
  int N;
  cin >> N;
  
  int isOK,isNG,mid;
  string A;
  
  cout << "0" << endl;
  fflush(stdout);
  cin >> A;
  if(A=="Male")
    isOK = 0;
  else if(A=="Female")
    isNG = 0;
  else
    return 0;
  
  cout << N-1 << endl;
  fflush(stdout);
  cin >> A;
  if(A=="Male")
    isOK = N-1;
  else if(A=="Female")
    isNG = N-1;
  else
    return N-1;
  
  while(true){
    mid = (isOK+isNG)/2
    cout << mid << endl;
    fflush(stdout);
    cin >> A;
    if((A=="Male"&&mid%2==0)||(A=="Female"&&mid%2==1))
      isOK = mid;
    else if((A=="Male"&&mid%2==1)||(A=="Female"&&mid%2==0))
      isNG = mid;
    else
      return mid;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: expected ';' before 'cout'
   32 |     mid = (isOK+isNG)/2
      |                        ^
      |                        ;
   33 |     cout << mid << endl;
      |     ~~~~
Language: C++

#include <iostream>
using namespace std;

int main(void){
  int N;
  cin >> N;
  
  int isOK,isNG,mid;
  string A;
  
  cout << "0" << endl;
  fflush(stdout);
  cin >> A;
  if(A=="Male")
    isOK = 0;
  else if(A=="Female")
    isNG = 0;
  else
    return;
  
  cout << N-1 << endl;
  fflush(stdout);
  cin >> A;
  if(A=="Male")
    isOK = N-1;
  else if(A=="Female")
    isNG = N-1;
  else
    return;
  
  while(true){
    mid = (isOK+isNG)/2
    cout << mid << endl;
    fflush(stdout);
    cin >> A;
    if((A=="Male"&&mid%2==0)||(A=="Female"&&mid%2==1))
      isOK = mid;
    else if((A=="Male"&&mid%2==1)||(A=="Female"&&mid%2==0))
      isNG = mid;
    else
      return;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   19 |     return;
      |     ^~~~~~
a.cc:29:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   29 |     return;
      |     ^~~~~~
a.cc:32:24: error: expected ';' before 'cout'
   32 |     mid = (isOK+isNG)/2
      |                        ^
      |                        ;
   33 |     cout << mid << endl;
      |     ~~~~                
a.cc:41:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
   41 |       return;
      |       ^~~~~~
Language: C++

#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using i64 = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const i64 INFL = (1LL << 62);
const i64 MOD = 1000000007;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
i64 mod_pow(i64 a, i64 n, T mod) {
  mod = (i64)mod;
  i64 res = 1, p = a % mod;
  while (n) {
    if (n & 1) res = res * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return res;
}
void print() { std::cout << std::endl; }
template <typename T, typename... A>
void print(const T& first, const A&... rest) {
  cout << sizeof...(rest) << endl;
  std::cout << first;
  if (sizeof...(rest)) std::cout << " ";
  print(rest...);
}
template <typename... A>
void print(const A&... rest) {
  print(rest...);
}
template <typename A>
void print(const std::vector<A>& v) {
  std::for_each(v.begin(), v.end(), [](A x) { std::cout << x << " "; });
  std::cout << std::endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<string> res(n);
  int cnt = 0;
  int l = 0;
  int r = n - 1;
  int m = 0;
  while (true) {
    int i = 0;
    if (cnt == 0) {
      i = l;
      cnt++;
    } else if (cnt == 1) {
      i = r;
      cnt++;
    } else {
      m = (l + r) / 2;
      i = m;
    }
    cout << i << endl;
    string s;
    cin >> s;
    if (s == "Vacant") return 0;
    res[i] = s;
    if (abs(l - m + 1) & 1) {
      if (res[l] == res[m]) {
        r = m;
        continue;
      }
    } else {
      if (res[l] != res[m]) {
        r = m;
        continue;
      }
    }
    if (abs(r - m + 1) & 1) {
      if (res[r] == res[m]) {
        l = m;
        continue;
      }
    } else {
      if (res[r] != res[m]) {
        l = m;
        continue;
      }
    }

    return 0;
  }

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

#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

int solve(int l, int r){
    if((r-l)%2==1 && )
}

int main() {
    int N; cin >> N;
    string left_s, right_s;
    cout << 1 << flush << endl;
    cin >> left_s;
    cout << N-1 << flush << endl;
    cin >> right_s;

    if(left_s=="Vacant")
        cout << 1 << endl;
    if(right_s=="Vacant")
        cout << N-1 << endl;
    int l=0,r=N-1, m=(l+r)/2;
    int i=0;
    while(i<20){
        string m_string;
        cout << m << flush << endl;
        cin >> m_string;
        if(m_string=="Vacant")
            break;

        if((m-l)%2==0 && m_string==left_s){
            l=m;
        }else{
            r=m;
        }
        i++;
    }

    cout << m << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:96:22: error: expected primary-expression before ')' token
   96 |     if((r-l)%2==1 && )
      |                      ^
a.cc:97:1: error: expected primary-expression before '}' token
   97 | }
      | ^
a.cc:97:1: warning: no return statement in function returning non-void [-Wreturn-type]
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll now=n;
	cout << n;
	string s;
	cin>>s;
	if(s=="Vacant"){
		return 0;
	}
	ll kiso=0;
	while(true){
		ll sa=(n-kiso)/2;
		ll next=n-sa;
		cout << next;
		string t;
		cin>>t;
		if(t=="Vacant"){
			return 0;
		}
		if(sa%2==0){
		else if(s==t){
			n=next;
		}
		else{
			kiso=next;
		}
		}
		else{
					else if(s!=t){
						s=t;
			n=next;
		}
		else{
			kiso=next;
		}
		}
	}
	// your code goes here
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: expected '}' before 'else'
   28 |                 else if(s==t){
      |                 ^~~~
a.cc:27:28: note: to match this '{'
   27 |                 if(sa%2==0){
      |                            ^
a.cc:35:17: error: 'else' without a previous 'if'
   35 |                 else{
      |                 ^~~~
a.cc:36:41: error: 'else' without a previous 'if'
   36 |                                         else if(s!=t){
      |                                         ^~~~
a.cc:36:52: error: 't' was not declared in this scope
   36 |                                         else if(s!=t){
      |                                                    ^
a.cc:38:27: error: cannot resolve overloaded function 'next' based on conversion to type 'll' {aka 'long long int'}
   38 |                         n=next;
      |                           ^~~~
a.cc:41:30: error: cannot resolve overloaded function 'next' based on conversion to type 'll' {aka 'long long int'}
   41 |                         kiso=next;
      |                              ^~~~
a.cc: At global scope:
a.cc:46:9: error: expected unqualified-id before 'return'
   46 |         return 0;
      |         ^~~~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

#include <string>
 
using namespace std;
 
 
void check2(int start, int goal, string value, int count){
string tmp;
  int num = (start + goal)/2;
    cout<< num <<endl;
    cout.flush();
    cin>>tmp;
 
    if(tmp == "Vacant") return;
 
    if(count == 0){
        return;
    }else if((num - start) % 2 == 0){
        if(tmp == value){
            check2(num, goal, tmp, count-1);
        }else{
            check2(start, num , value,count-1);
        }
    }else{//num % 2 == 1
        if(tmp == value){
            check2(start, num , value,count-1);
        }else{
            check2(num, goal, tmp, count-1);
        }
    }
 
}
 
int main(void){
int N;
  string tmp;
  cin>>N;
 
    cout<<0<<endl;
  cout.flush();
    cin>>tmp;
    check2(0, N-1, tmp, 21);
 
    return 0;
}

Compiler output:
a.cc: In function 'void check2(int, int, std::string, int)':
a.cc:9:5: error: 'cout' was not declared in this scope
    9 |     cout<< num <<endl;
      |     ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | 
a.cc:9:18: error: 'endl' was not declared in this scope
    9 |     cout<< num <<endl;
      |                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <string>
  +++ |+#include <ostream>
    2 | 
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin>>tmp;
      |     ^~~
a.cc:11:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc: In function 'int main()':
a.cc:36:3: error: 'cin' was not declared in this scope
   36 |   cin>>N;
      |   ^~~
a.cc:36:3: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:5: error: 'cout' was not declared in this scope
   38 |     cout<<0<<endl;
      |     ^~~~
a.cc:38:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:14: error: 'endl' was not declared in this scope
   38 |     cout<<0<<endl;
      |              ^~~~
a.cc:38:14: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include <string>
 
using namespace std;
 
 
void check2(int start, int goal, string value, int count){
    int num = (start + goal)/2;
    cout<< num <<endl;
    cout.flush();
    cin>>tmp;
 
    if(tmp == "Vacant") return;
 
    if(count == 0){
        return;
    }else if((num - start) % 2 == 0){
        if(tmp == value){
            check2(num, goal, tmp, count-1);
        }else{
            check2(start, num , value,count-1);
        }
    }else{//num % 2 == 1
        if(tmp == value){
            check2(start, num , value,count-1);
        }else{
            check2(num, goal, tmp, count-1);
        }
    }
 
}
 
int main(void){
int N;
  string tmp;
  cin>>N;
 
    cout<<0<<endl;
  cout.flush();
    cin>>tmp;
    check2(0, N-1, tmp, 21);
 
    return 0;
}

Compiler output:
a.cc: In function 'void check2(int, int, std::string, int)':
a.cc:8:5: error: 'cout' was not declared in this scope
    8 |     cout<< num <<endl;
      |     ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | 
a.cc:8:18: error: 'endl' was not declared in this scope
    8 |     cout<< num <<endl;
      |                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <string>
  +++ |+#include <ostream>
    2 | 
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin>>tmp;
      |     ^~~
a.cc:10:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:10: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   10 |     cin>>tmp;
      |          ^~~
      |          tm
a.cc: In function 'int main()':
a.cc:35:3: error: 'cin' was not declared in this scope
   35 |   cin>>N;
      |   ^~~
a.cc:35:3: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:5: error: 'cout' was not declared in this scope
   37 |     cout<<0<<endl;
      |     ^~~~
a.cc:37:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:14: error: 'endl' was not declared in this scope
   37 |     cout<<0<<endl;
      |              ^~~~
a.cc:37:14: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include <iostream>
#include <string>

using namespace std;

int N;
string tmp;

void check(int start, int num, string value, int count){
    cout<<start + num / 2 <<endl;
    cin>>tmp;

    if(count == 0){
        return;
    }
    else if(tmp == value){
        check(start, num / 2, value, coutt-1);
    }else{
        check(start + num / 2, num - num / 2, tmp, count-1);
    }
}

int main(void){
    cin>>N;

    cout<<0<<endl;
    cin>>tmp;
    check(0, N, tmp, 20);

    return 0;
}

Compiler output:
a.cc: In function 'void check(int, int, std::string, int)':
a.cc:17:38: error: 'coutt' was not declared in this scope; did you mean 'count'?
   17 |         check(start, num / 2, value, coutt-1);
      |                                      ^~~~~
      |                                      count
Language: C++

#include <iostream>
#include <string>

using namespace std;

void check(int start, int num, string value){
    cout<<start + num / 2 <<endl;;
    string tmp;
    cin>>tmp;
    if(tmp == "Vacant"){
        return;
    }else if(tmp == value){
        check(start, num / 2, value);
    }else{//tmp != value
        check(start + num / 2, num - num / 2, tmp);
    }
}


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

    cout<<0<<endl;
    string tmp;
    cin>>tmp:
    check(0, 3, tmp);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: found ':' in nested-name-specifier, expected '::'
   26 |     cin>>tmp:
      |             ^
      |             ::
a.cc:26:10: error: 'tmp' is not a class, namespace, or enumeration
   26 |     cin>>tmp:
      |          ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>
 
 
using namespace std;

const int N = 100 * 1000;
long long down = 0;
long long up = N;
string sex;
int cnt = 0;
bool isval(long long k)
{
	cout << k << endl;
	cnt++;
	string s;
	cin >> s;
	if (s == "Vacant")
	{
		exit(0);
	}
	if (k % 2 == 0)
	{
		return (s != sex);
	}
	if (k % 2 == 1)
	{
		return (s == sex);
	}
}
void bsearch()
{
	while (up - down > 1)
	{
		long long md = (up + down) / 2;
		if (isval(md))
		{
			up = md;
		}
		else
		{
			down = md;
		}
	}
}

int main()
{
	cin >> up;
	cout << 0 << endl;
	cnt++;
	cin >> sex;
	if (sex == "Vacant")
	{
		exit(0);
	}
	bsearch();
	cout << n - 1 << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:17: error: 'n' was not declared in this scope
   69 |         cout << n - 1 << endl;
      |                 ^
a.cc: In function 'bool isval(long long int)':
a.cc:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
Language: C++

#pragma GCC optimize("Ofast")
#include <iostream>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <utility>
#include <complex>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

const ll oo=1e18;
const int MOD=1000000007;
const int INF=1000000000;
const ld EPS=0.000000001;

int a[100005]={0};

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int l=0,r,tmp;
    string s;
    cin>>r;
    cout<<l<<endl;
    cin>>s;
    if(s[0]=='V') return 0;
    else if(s[0]=='M') a[l]=0;
    else a[l]=1;
    a[n]=a[0];
    tmp=(l+r)>>1;
    while(cout<<tmp<<endl) {
        cin>>s;
        if(s[0]=='V') return 0;
        else if(s[0]=='M') a[tmp]=0;
        else a[tmp]=1;
        if((a[l]!=a[tmp]&&(tmp-l)%2==0)||(a[l]==a[tmp]&&(tmp-l)%2==1)) {
            r=tmp-1;
        }
        else l=tmp+1;
        tmp=(l+r)>>1;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:7: error: 'n' was not declared in this scope
   53 |     a[n]=a[0];
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
string s="hello world!",prev;
int main() 
{
    cin>>n;
    int a=0,b=n,c=n/2;
    cout<<0<<endl;
    cin>>prev;
    s=prev;
    while(s!="Vacant") 
	{
        cout<<c<<endl;
        cin>>s;
        if(prev==s&&a%2==c%2) 
		{
            b=a; a=c;
        } else a=c;
        c=(a+b)/2;
        prev=s;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: reference to 'prev' is ambiguous
   10 |     cin>>prev;
      |          ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 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_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:4:25: note:                 'std::string prev'
    4 | string s="hello world!",prev;
      |                         ^~~~
a.cc:11:7: error: reference to 'prev' is ambiguous
   11 |     s=prev;
      |       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:4:25: note:                 'std::string prev'
    4 | string s="hello world!",prev;
      |                         ^~~~
a.cc:16:12: error: reference to 'prev' is ambiguous
   16 |         if(prev==s&&a%2==c%2)
      |            ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:4:25: note:                 'std::string prev'
    4 | string s="hello world!",prev;
      |                         ^~~~
a.cc:21:9: error: reference to 'prev' is ambiguous
   21 |         prev=s;
      |         ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:4:25: note:                 'std::string prev'
    4 | string s="hello world!",prev;
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
  int n;cin>>n;
  P left,right;
  string s;
  cout<<0<<endl;
  cin>>s;
  if(s[0]=='V')exit(0);
  if(s[0]=='M')left=P(0,0);
  else left=P(0,1);
  cout<<n-1<<endl;
  cin>>s;
  if(s[0]=='V')exit(0);
  if(s[0]=='M')right=P(n-1,0);
  else right=P(n-1,1);
  P half;
  while(right.first-left.first>1){
    half.first=(left.first+right.first)/2;
    string s;cout<<half.first<<endl;
    cin>>s;
    if(s[0]=='V')exit(0);
    if(s[0]=='M')half.second=0;
    else half.second=1;
    if(((left.first+half.first)%2)^(left.second^half.second)){
      left=half;
    }
    else right=half;
  }
  cout<<right.first<<endl;
  string s;cin>>s;
  if(s[0]=='V')exit(0);
  cout<<left.first<<endl;
}




  


Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: redeclaration of 'std::string s'
   42 |   string s;cin>>s;
      |          ^
a.cc:17:10: note: 'std::string s' previously declared here
   17 |   string s;
      |          ^