Language: C++

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

int main(){
  int N,temp,try;
  cin>>N;
  int A[N];
  try=0;
  cout<<try<<endl;
  cin>>temp;
  if(temp=="Vacant"){
    return 0;
  }
  if(temp=="Male"){
    A[try]=1;
  }
  if(temp=="Female"){
    A[try]=2;
  }
  int l=N-1;
  int r=0;
  int flag=1;
  while(1){
    if(flag){
      try=l/2;
    }
    else{
      try=(l-r)/2;
    }
    cout<<try<<endl;
    cin>>temp;
    if(temp=="Vacant"){
      return 0;
    }
    if(temp=="Male"){
      A[try]=1;
    }
    if(temp=="Female"){
      A[try]=2;
    }
    if(A[try]==A[r]){
      r=try+1;
      flag=1;
    }
    if(A[try]!=A[r]){
      l=try;
      flag=0;
    } 
  } 
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: expected unqualified-id before 'try'
    5 |   int N,temp,try;
      |              ^~~
a.cc:8:6: error: expected '{' before '=' token
    8 |   try=0;
      |      ^
a.cc:8:6: error: expected 'catch' before '=' token
a.cc:8:6: error: expected '(' before '=' token
    8 |   try=0;
      |      ^
      |      (
a.cc:8:6: error: expected type-specifier before '=' token
a.cc:8:6: error: expected ')' before '=' token
    8 |   try=0;
      |      ^
      |      )
a.cc:8:6: error: expected '{' before '=' token
a.cc:8:6: error: expected primary-expression before '=' token
a.cc:9:9: error: expected primary-expression before 'try'
    9 |   cout<<try<<endl;
      |         ^~~
a.cc:11:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |   if(temp=="Vacant"){
      |      ~~~~^~~~~~~~~~
a.cc:14:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |   if(temp=="Male"){
      |      ~~~~^~~~~~~~
a.cc:15:7: error: expected primary-expression before 'try'
   15 |     A[try]=1;
      |       ^~~
a.cc:15:7: error: expected ']' before 'try'
   15 |     A[try]=1;
      |       ^~~
      |       ]
a.cc:17:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |   if(temp=="Female"){
      |      ~~~~^~~~~~~~~~
a.cc:18:7: error: expected primary-expression before 'try'
   18 |     A[try]=2;
      |       ^~~
a.cc:18:7: error: expected ']' before 'try'
   18 |     A[try]=2;
      |       ^~~
      |       ]
a.cc:25:10: error: expected '{' before '=' token
   25 |       try=l/2;
      |          ^
a.cc:25:10: error: expected 'catch' before '=' token
a.cc:25:10: error: expected '(' before '=' token
   25 |       try=l/2;
      |          ^
      |          (
a.cc:25:10: error: expected type-specifier before '=' token
a.cc:25:10: error: expected ')' before '=' token
   25 |       try=l/2;
      |          ^
      |          )
a.cc:25:10: error: expected '{' before '=' token
a.cc:25:10: error: expected primary-expression before '=' token
a.cc:28:10: error: expected '{' before '=' token
   28 |       try=(l-r)/2;
      |          ^
a.cc:28:10: error: expected 'catch' before '=' token
a.cc:28:10: error: expected '(' before '=' token
   28 |       try=(l-r)/2;
      |          ^
      |          (
a.cc:28:10: error: expected type-specifier before '=' token
a.cc:28:10: error: expected ')' before '=' token
   28 |       try=(l-r)/2;
      |          ^
      |          )
a.cc:28:10: error: expected '{' before '=' token
a.cc:28:10: error: expected primary-expression before '=' token
a.cc:30:11: error: expected primary-expression before 'try'
   30 |     cout<<try<<endl;
      |           ^~~
a.cc:32:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |     if(temp=="Vacant"){
      |        ~~~~^~~~~~~~~~
a.cc:35:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   35 |     if(temp=="Male"){
      |        ~~~~^~~~~~~~
a.cc:36:9: error: expected primary-expression before 'try'
   36 |       A[try]=1;
      |         ^~~
a.cc:36:9: error: expected ']' before 'try'
   36 |       A[try]=1;
      |         ^~~
      |         ]
a.cc:38:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |     if(temp=="Female"){
      |        ~~~~^~~~~~~~~~
a.cc:39:9: error: expected primary-expression before 'try'
   39 |       A[try]=2;
      |         ^~~
a.cc:39:9: error: expected ']' before 'try'
   39 |       A[try]=2;
      |         ^~~
      |         ]
a.cc:41:10: error: expected primary-expression before 'try'
   41 |     if(A[try]==A[r]){
      |          ^~~
a.cc:41:10: error: expected ']' before 'try'
   41 |     if(A[try]==A[r]){
      |          ^~~
      |          ]
a.cc:41:10: error: expected ')' before 'try'
   41 |     if(A[try]==A[r]){
      |       ~  ^~~
      |          )
a.cc:41:13: error: expected primary-expression before ']' token
   41 |     if(A[try]==A[r]){
      |             ^
a.cc:45:10: error: expected primary-expression before 'try'
   45 |     if(A[try]!=A[r]){
      |          ^~~
a.cc:45:10: error: expected ']' before 'try'
   45 |     if(A[try]!=A[r]){
      |          ^~~
      |          ]
a.cc:45:10: error: expected ')' before 'try'
   45 |     if(A[try]!=A[r]){
      |       ~  ^~~
      |          )
a.cc:45:13: error: expected primary-expression before ']' token
   45 |     if(A[try]!=A[r]){
      |             ^