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

#include<stdio.h>
#include<string.h>
int main(){
	int n,i,j,ans;
	bool f[1000005];f[0]=f[1]=false;
	memset(f,true,sizeof(f));
	for(i=3;i<1000005;i++){
		if(f[i]){
			for(j=2;i*j<1000005;j++){
				f[i*j]=false;}
		}
	}
	while(scanf("%d",&n)!=EOF){
		if(n==0)break;ans=0;
		for(i=3;i<=n/2;i++){
			if(f[i] && f[n-i])ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: unknown type name 'bool'
    5 |         bool f[1000005];f[0]=f[1]=false;
      |         ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include<string.h>
  +++ |+#include <stdbool.h>
    3 | int main(){
main.c:5:35: error: 'false' undeclared (first use in this function)
    5 |         bool f[1000005];f[0]=f[1]=false;
      |                                   ^~~~~
main.c:5:35: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:5:35: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:18: error: 'true' undeclared (first use in this function)
    6 |         memset(f,true,sizeof(f));
      |                  ^~~~
main.c:6:18: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include<stdio.h>
#include<string.h>
int main(){
	int n,i,j,ans;
	bool f[500005];
	memset(f,true,sizeof(f));
	f[0]=f[1]=false;
	for(i=3;i<500005;i++){
		if(f[i]){
			for(j=2;i*j<500005;j++){
				f[i*j]=false;}
		}
	}
	while(scanf("%d",&n)!=EOF){
		if(n==0)break;ans=0;
		for(i=3;i<=n/2;i++){
			if(f[i] && f[n-i])ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: unknown type name 'bool'
    5 |         bool f[500005];
      |         ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include<string.h>
  +++ |+#include <stdbool.h>
    3 | int main(){
main.c:6:18: error: 'true' undeclared (first use in this function)
    6 |         memset(f,true,sizeof(f));
      |                  ^~~~
main.c:6:18: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:6:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:19: error: 'false' undeclared (first use in this function)
    7 |         f[0]=f[1]=false;
      |                   ^~~~~
main.c:7:19: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

#include <cstdio>
 
#define MAX 1000000
 
bool prime[MAX];
 
void make()
{
    fill(prime, prime + MAX, true);
 
    prime[0] = prime[1] = false;
    for (int i = 2; i*i < MAX; i++) { 
	if (prime[i]) {
	    for (int j = 2*i; j < MAX; j += i) {
		prime[j] = false;
	    }
	}
    }
}
 
int main()
{
    make();
    int n;
    while (scanf("%d", &n), n) {
	int cnt = 0;
	for (int i = 2; i+i <= n; i++) {
	    if (prime[i] && prime[n-i]) {
		cnt++;
	    }
	} 
	printf("%d\n", cnt);
    }
    return 0;
}

Compiler output:
a.cc: In function 'void make()':
a.cc:9:5: error: 'fill' was not declared in this scope
    9 |     fill(prime, prime + MAX, true);
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;
#include<cmath>
bool isprime(int n) {
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
	return true;
}
int main() {
	int n; while (cin >> n, n) {
		int cnt = 0;
		for (int i = 2; i <= n / 2; i++) {
			if (isprime(i) && isprime(n - i)){cnt++;
		}
		cout << cnt << endl;
	}
}

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

j,p[1<<20],n;
main(i)
{
	for(;++i<999;)
		if(!p[i])
			for(j=i+i;j<1<<20;j+=i)
				p[j]=1;
	for(;scanf("%d",&n),j=0,n;printf("%d\n",j))
		for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
	exit(0);



}

Compiler output:
a.cc:1:1: error: 'j' does not name a type
    1 | j,p[1<<20],n;
      | ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(i)
      |     ^
Language: C++

j,p[1<<20],n;main(i){for(;++i<999;)for(j=i;!p[i]&(j+=i)<1<<20;)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=1;++i<=n/2;)j+=!p[i]&!p[n-i];exit(0);}

Compiler output:
a.cc:1:1: error: 'j' does not name a type
    1 | j,p[1<<20],n;main(i){for(;++i<999;)for(j=i;!p[i]&(j+=i)<1<<20;)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=1;++i<=n/2;)j+=!p[i]&!p[n-i];exit(0);}
      | ^
a.cc:1:18: error: expected constructor, destructor, or type conversion before '(' token
    1 | j,p[1<<20],n;main(i){for(;++i<999;)for(j=i;!p[i]&(j+=i)<1<<20;)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=1;++i<=n/2;)j+=!p[i]&!p[n-i];exit(0);}
      |                  ^
Language: C++

#include<stdio.h>

#define MAX 100000
#define sqrtMAX 317

int main(void)
{
  int n;
  int *b;
  b = malloc((MAX+1)*sizeof(int));
  int *p;
  p = malloc((MAX+1)*sizeof(int));
  int *c;
  c = malloc((MAX+1)*sizeof(int));
/*
  int b[MAX+1] = {0};
  int p[MAX+1] = {0};
  int c[MAX+1] = {0};
*/
  int i, j;
  int count;

  // ツエツδ可トツスツテツネツスツづ個づ督づゥツつ「
  b[0] = 1;
  b[1] = 1;
  for(i=4; i<=MAX; i+=2)
      b[i] = 1;
  for(i=3; i<sqrtMAX; i+=2)
      for(j=i+i; j<=MAX; j+=i)
          b[j] = 1;

  // ツ素ツ青板づーツ板イツつォツ出ツつキ
  count = 0;
  for(i=0; i<=MAX; i++) {
    if(b[i])
      continue;
    p[count++] = i;
  }

  for(i=0; i<count; i++) {
    for(j=i; j<count; j++) {
      if(p[i]+p[j] > MAX)
        break;
      c[p[i]+p[j]]++;
    }
  }

  while(scanf("%d", &n)!=EOF) {
    if(n==0)
      break;
    printf("%d\n", c[n]);
  }

  free(b);
  free(p);
  free(c);

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'malloc' was not declared in this scope
   10 |   b = malloc((MAX+1)*sizeof(int));
      |       ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include<stdio.h>
  +++ |+#include <cstdlib>
    2 | 
a.cc:54:3: error: 'free' was not declared in this scope
   54 |   free(b);
      |   ^~~~
a.cc:54:3: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
Language: C++

#include <iostream>

using namespace std;
bool IsPrime[1000001];

void calc()
{
	memset(IsPrime, 1, sizeof(IsPrime));
	IsPrime[0] = false;
	IsPrime[1] = false;
	for(int i = 2; i < 1000001; ++i)
	{
		if(IsPrime[i])
		{
			for(int j = 2 * i; j < 1000001; j += i)
			{
				IsPrime[j] = false;
			}
		}
	}
}

void solve()
{
	calc();
	int n;
	while(cin >> n, n)
	{
		int count = 0;
		int temp = n / 2;
		for(int i = 0; i <= temp; ++i)
		{
			if(IsPrime[i] == 1 && IsPrime[n - i] == 1)
			{
				count++;
			}
		}
		cout << count << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Compiler output:
a.cc: In function 'void calc()':
a.cc:8:9: error: 'memset' was not declared in this scope
    8 |         memset(IsPrime, 1, sizeof(IsPrime));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include<iostream>
#define N 1000001
using namespace std;
int main(){
  int n;
  int p[N]={0};
  for(int i=3;i<=N;i+=2;) p[i] = 1;
  p[2] = 1;
  for(int i=3;i<=1000;i+=2){
    if(p[i]==1){
      for(int j=2*i;j<=N;j+=i) p[j] = 0;
    }
  }
  while(cin>>n){
    int count = 0;
    if(n==0) break;
    int j = n - 2;
    if(p[j]==1) count++; 
    for(int i=3;i<=n/2;i+=2){
      if(p[i]==1) j = n - i;
      if(p[j]==1) count++;
    }
    cout << count << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: expected ')' before ';' token
    7 |   for(int i=3;i<=N;i+=2;) p[i] = 1;
      |      ~                 ^
      |                        )
a.cc:7:25: error: expected primary-expression before ')' token
    7 |   for(int i=3;i<=N;i+=2;) p[i] = 1;
      |                         ^
Language: C++

#include <cstdio>

#define MAX 1000000

bool prime[MAX];

void make(){
  fill(prime,prime+MAX,true);
  prime[0] = prime[1] = false;

  for(int i = 2 ; i*i < MAX ; i++){
    if(prime[i]){
      for(int j = 2*i ; j < MAX ; j += i){
	prime[j] = false;
      }
    }
  }
}

int main(){
  make();
  int n;
  while(scanf("%d" ,&n),n){
    int cnt = 0;
    for(int i = 2 ; i+i <= n ; i++){
      if(prime[i] && prime[n-i]){
	cnt++;
      }
    } 
    printf("%d\n" ,cnt);
  }

  return 0;
}

Compiler output:
a.cc: In function 'void make()':
a.cc:8:3: error: 'fill' was not declared in this scope
    8 |   fill(prime,prime+MAX,true);
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int have,price[2],up;
        cin>>have>>price[0]>>price[1]>>up;
        bool kawa=0;
        for(int i=up;i>0;i--){
            if(have<price[0]*i)continue;
            for(int j=n-i;;j++){
                if(have-price[0]*i-price[1]*j<0){
                    if(i+j-1>=n){
                        kawa=1;
                        have=j-1;
                    }
                    break;
                }
            }
            if(kawa){
                cout<<i<<" "<<have<<endl;
            }
        }
        if(!kawa)cout<<"NA\n"
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: expected ';' before '}' token
   25 |         if(!kawa)cout<<"NA\n"
      |                              ^
      |                              ;
   26 |     }
      |     ~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<unordered_map>
#include<map>
#define int long long
using namespace std;

int main() {
	int a, b, c, d, e;
	while (cin >> a, a) {
		cin >> b >> c >> d >> e;
		if (b / c < a&&b / d < a) { puts("NA"); continue; }
		int s = 1, g = e+1;
		while (g - s > 1) {//????´\??°?¶????K??°????????\???????????????
			int k = (s + g) / 2;
			int f = c*k;
			if (f > b) { g = k; continue; }
			f = b-f;
			f = f / d;
			if (k + f >= a) {
				s = k;
			}
			else {
				g = k;
			}
		}
		cout << s<<" "<<(b - (s*c))/d << endl;
	}
}

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

#include<iostream>
using namespace std;

int q1,q2,b,c1,c2,ans1,ans2;

bool solve(){
	if(!q2)
		return false;
	ans1 = q2;
	ans2 = 0;
	while(ans1*c1 + ans2*c2 <= b)
		ans2++;
	if(ans2)
		ans2--;
	if(ans1 + ans2 >= q1 && ans1*c1 + ans2*c2 <= b)
		return true;
	while(true){
		ans1--;
//		if(!ans1)
//			return false;
		while(true){
			ans2++;
			if(ans1*c1 + ans2*c2 > b){
				ans2--;
				break;
			}
		}
		if(ans1*c1 + ans2*c2 <= b && ans1 + ans2 >= q1) || ans1 == 0)
			break;
	}
	if(!ans1)
		return false;
	else
		return true;
}

int main(){
	while(true){
		cin >> q1;
		if(!q1)
			return 0;
		cin >> b >> c1 >> c2 >> q2;
		if(solve())
			cout << ans1 << ' ' << ans2 << endl;
		else
			cout << "NA" << endl;
	}
}

Compiler output:
a.cc: In function 'bool solve()':
a.cc:28:65: error: expected primary-expression before '||' token
   28 |                 if(ans1*c1 + ans2*c2 <= b && ans1 + ans2 >= q1) || ans1 == 0)
      |                                                                 ^~
Language: C++

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

int main(void)
{
	int q1, b, c1, c2, q2;
	
	while(1){
		scanf("%d", &q1);
		if (q1 == 0) break;
		scanf("%d %d %d %d", &b, &c1, &c2, &q2);
		
		if (c1 <= c2){
			int x = min(b/c1, q2);
			int y = ((b - x) * c1) / c2;
			if ((x + y) < q1){
				printf("NA\n");
			}
			else {
				printf("%d %d\n", x, y);
			}
		}
		else {
			int x = min(min(((b - c2) * q1) / (c1 - c2), q2), (b / c1));
			int y = ((b - x) * c1) / c2;
			if(x <= 0){
				printf("NA\n");
			}
			else {
				printf("%d %d\n", x, y);
			}
		}
	}
	return 0;
}

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

g#include <iostream>

using namespace std;

int main() {
	int q1, b, c1, c2, q2;
	while(cin >> q1, q1) {
	   cin >> b >> c1 >> c2 >> q2;
	   int aizu = min(b / c1, q2);
	   if (aizu == 0) {
		   cout << "NA" << endl;
		   continue;
	   }
	   int money = b - aizu * c1;
	   int ordinal = money / c2;

	   bool possible = true;
	   while (aizu + ordinal < q1) {
		   aizu--;
		   if (aizu == 0) {
			   cout << "NA" << endl;
			   possible = false;
			   break;
		   }
		   money = b - aizu * c1;
		   ordinal = money / c2;
		   money = b - aizu * c1 - ordinal * c2;
	   }
	   if (possible) cout << aizu << ' ' << ordinal << endl;
	}
	return 0;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | g#include <iostream>
      |  ^
a.cc:1:1: error: 'g' does not name a type
    1 | g#include <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:7:15: error: 'cin' was not declared in this scope
    7 |         while(cin >> q1, q1) {
      |               ^~~
a.cc:9:23: error: 'min' was not declared in this scope; did you mean 'main'?
    9 |            int aizu = min(b / c1, q2);
      |                       ^~~
      |                       main
a.cc:11:20: error: 'cout' was not declared in this scope
   11 |                    cout << "NA" << endl;
      |                    ^~~~
a.cc:11:36: error: 'endl' was not declared in this scope
   11 |                    cout << "NA" << endl;
      |                                    ^~~~
a.cc:21:28: error: 'cout' was not declared in this scope
   21 |                            cout << "NA" << endl;
      |                            ^~~~
a.cc:21:44: error: 'endl' was not declared in this scope
   21 |                            cout << "NA" << endl;
      |                                            ^~~~
a.cc:29:26: error: 'cout' was not declared in this scope
   29 |            if (possible) cout << aizu << ' ' << ordinal << endl;
      |                          ^~~~
a.cc:29:60: error: 'endl' was not declared in this scope
   29 |            if (possible) cout << aizu << ' ' << ordinal << endl;
      |                                                            ^~~~
Language: C++

#include<ios>
main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:35: error: 'cin' is not a member of 'std'
    2 | main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}
      |                                   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<ios>
  +++ |+#include <iostream>
    2 | main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef unsigned long long ull; 
 
class AOJ0186{
private:
  int q1,b,c1,c2,q2;
public:
 
  AOJ0186(int a,int b,int c,int d,int f):q1(a),b(b),c1(c),c2(d),q2(f){}
  ~AOJ0186(){}
 
 
  void run(){
    int aizu_meet,meet;
 
    bool ok = false;
    int preb = b;
     
    for(int i=q2;i>=1;i--){
      aizu_meet = meet = 0,b = preb;
      if(i*c1 > b)continue;
      aizu_meet = i;
      b -= (c1*i);
      meet = b/c2;
      //cout << "i =" << i << endl;
      //cout << aizu_meet << ' ' << meet << ", b = " << b << endl;
      if(aizu_meet+meet < q1)continue;
      if(aizu_meet == 0)continue;
      ok = true;
      cout << aizu_meet << ' ' << meet << endl;
      //cout << "i = " << i << endl;
 
      break;
    }
 if(!ok)cout << "NA" << endl;

Compiler output:
a.cc:38:30: error: expected '}' at end of input
   38 |  if(!ok)cout << "NA" << endl;
      |                              ^
a.cc:7:14: note: to match this '{'
    7 | class AOJ0186{
      |              ^
a.cc: In member function 'void AOJ0186::run()':
a.cc:38:30: error: expected '}' at end of input
   38 |  if(!ok)cout << "NA" << endl;
      |                              ^
a.cc:16:13: note: to match this '{'
   16 |   void run(){
      |             ^
a.cc: At global scope:
a.cc:38:30: error: expected unqualified-id at end of input
   38 |  if(!ok)cout << "NA" << endl;
      |                              ^
Language: C++

#include <iostream>
using namespace std;

int main(){
	int b,c1,c2,q1,q2,aizu,ord;
	while(cin>>q1,q1){
		cin>>b>>c1>>c2>>q2;
		if(b/c1>q2){
			aizu=q2;
			ord=(b-c1*q2)/c2;
		}else{
			aizu=b/c1;
			ord=(b%c1)/c2;
		}
		//cout<<aizu<<" "<<ord<<endl;
		if(c1>b){cout<<"NA"<<endl;}
		else if((aizu+ord)<q1){
			for(int i=aizu-1;i>0;i--){
				bool flag=false;
				if((c1*i+c2*(q1-i))<b){
					flag=true;
					cout<<i<<" "<<(b-c1*i)/c2<<endl;
					break;
				}
			}
			if(!flag){
				cout<<"NA"<<endl;
			}
		}else{
			cout<<aizu<<" "<<ord<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:29: error: 'flag' was not declared in this scope
   26 |                         if(!flag){
      |                             ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <sstream>

using namespace std;

void failed() {
  cout << "NA" << endl;
}

int main() {
  
  int Q1, B, C1, C2, Q2;
  
  while(cin >> Q1) {
    
    if(Q1 == 0) break;
    
    cin >> B >> C1 >> C2 >> Q2;
    
    stringstream ss; ss << "Q: " << Q1 << " B: " << B << " C1: " << C1 << " C2: " << C2 << " Q2: " << Q2;
    
    assert(Q2 >= 1 && ss.str());
    
    /*
    if(B/C1 == 0) {
      failed(); continue;
    }
    */
    
    int AizuCh = min(B/C1, Q2);
    if(AizuCh <= 0) { failed(); continue; }
    int NCh = 0;
    for(;;) {
      
      NCh = (B - AizuCh*C1)/C2;
      
      /*
      if(B - (NCh+1)*C2 - AizuCh*C1 >= 0) {
        NCh = (B - AizuCh*C1)/C2;
      }
      */
      if(AizuCh + NCh >= Q1) {
        cout << AizuCh << ' ' << NCh << endl; break;
      }
      /*
      else if(B - (NCh+1)*C2 - (AizuCh-1)*C1 >= 0) {
        NCh ++, AizuCh --;
      }
      */
      else AizuCh --;
      
      if(AizuCh <= 0) { failed(); break; }
    }
    
  }
  
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from a.cc:4:
a.cc: In function 'int main()':
a.cc:25:20: error: no match for 'operator&&' (operand types are 'bool' and 'std::__cxx11::basic_stringstream<char>::__string_type' {aka 'std::__cxx11::basic_string<char>'})
   25 |     assert(Q2 >= 1 && ss.str());
      |            ~~~~~~~ ^~ ~~~~~~~~
      |               |             |
      |               bool          std::__cxx11::basic_stringstream<char>::__string_type {aka std::__cxx11::basic_string<char>}
a.cc:25:20: note: candidate: 'operator&&(bool, bool)' (built-in)
   25 |     assert(Q2 >= 1 && ss.str());
      |            ~~~~~~~~^~~~~~~~~~~
a.cc:25:20: note:   no known conversion for argument 2 from 'std::__cxx11::basic_stringstream<char>::__string_type' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
Language: C

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    Point p[3], q[3], x[3];
    double S;
	
    while (1){
        for (int i = 0; i < 3; i++){
			int x1, y1, x2, y2;
            scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
			
            if (i == 0 && x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) return (0);
			
			p[i] = Point(x1, y1); q[i] = Point(x2, y2);
        }
		
		int k = 0;
		for (int i = 0; i < 3; i++){
			for (int j = i + 1; j < 3; j++){
				if (!isIntersect(p[i], q[i], p[j], q[j])){
					printf("kyo\n");
					goto next;
				}
				x[k++] = interPointS(p[i], q[i], p[j], q[j]);
			}
		}
		
		if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]){
			printf("kyo\n");
			goto next;
		}
		
		S = area(x[0], x[1], x[2]);
		
		if (S >= 1900000) printf("dai-kichi\n");
		else if (S >= 1000000) printf("chu-kichi\n");
		else if (S >= 100000) printf("kichi\n");
		else printf("syo-kichi\n");
		
		next:;
	}	
	
	return (0);
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>

using namespace std;

double EPS = 1e-10;
const double PI = acos(-1);

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

struct segment{
  point a,b;
};

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

double dist(point a,point b){
  return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

point intersection_ls(point a1, point a2, point b1, point b2) {
  point b = b2-b1;
  double d1 = abs(cross(b, a1-b1));
  double d2 = abs(cross(b, a2-b1));
  double t = d1 / (d1 + d2);

  return a1 + (a2-a1) * t;
}

int main(void){
  segment s[3];

  while(true){
    for(int i=0;i<3;i++){
      cin >> s[i].a.x >> s[i].a.y >> s[i].b.x >> s[i].b.y;
      if( s[i].a.x==0 && s[i].a.y==0 && s[i].b.x==0 && s[i].b.y==0)return 0;
      }
    
    int fg[3]={0};
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
	if(i!=j)
	  fg[i]+=is_intersected_ls(s[i].a,s[i].b,s[j].a,s[j].b);
      }
    }

    if(fg[0]==2 && fg[1]==2 && fg[2]==2){
      point p[3];
      for(int i=0;i<2;i++)
	    p[i]=intersection_ls(s[i].a,s[i].b,s[i+1].a,s[i+1].b);
      p[2]=intersection_ls(s[2].a,s[2].b,s[0].a,s[0].b);

      double z=(dist(p[0],p[1])+dist(p[1],p[2])+dist(p[2],p[0]))/2;
      double res=sqrt(z*(z-dist(p[0],p[1]))*(z-dist(p[1],p[2]))*(z-dist(p[2],p[0])));

      if(res>1900000-EPS)cout <<"dai-kichi"<<endl;
      else if(res>1000000-EPS)cout <<"chu-kichi"<<endl;
      else if(res>100000-EPS)cout <<"kichi"<<endl;
      else if(res>0+EPS)cout << "syo-kichi"<<endl;
      else cout <<"kyo"<<endl;
    }
    else cout <<"kyo"<<endl;
    
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:104:2: error: expected '}' at end of input
  104 | }
      |  ^
a.cc:69:15: note: to match this '{'
   69 | int main(void){
      |               ^
Language: Java

import java.util.Scanner;

//Search
public class AOJ0188 {

	static int c;
	static int[] a;

	static int comp(int k, int x){
		c++;
		return a[k]-x;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			a = new int[n];
			for(int i=0;i<n;i++)a[i]=sc.nextInt();
			int x = sc.nextInt();
			c = 0;
			int l = 0;
			int r = n-1;
			int k = (l+r)/2;
			while(l<=r){
				int com = comp(k, x);
				if(r<=l)break;
				if(com<0)l=k+1;
				else if(com>0)r=k-1;
				else break;
				k=(l+r)/2;
			}
			System.out.println(c);
		}
	}
}

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

import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (true)
		{
			int n = sc.nextInt();
			if (n == 0) break;
			int num[] = new int[n];
			for (int i = 0; i < n; i++)
				num[i] = sc.nextInt();
			int x = sc.nextInt();
			int left = 0, right = n - 1, i = (left + right) / 2, count = 0;
			while (true)
			{
				if (num[i] == x)
				count++;
				{
					System.out.println(count);
					break;
				}
				else if (right - left < 2)
				{
					System.out.println(count + 1);
					break;
				}
				else if (num[i] < x)
				{
					left = i + 1;
					i = (left + right) / 2;
				}
				else if (num[i] > x)
				{
					right = i - 1;
					i = (left + right) / 2;
				}
			}
		}
	}
}

Compiler output:
Main.java:25: error: 'else' without 'if'
				else if (right - left < 2)
				^
1 error
Language: Java

import java.util.*;

public class Main{
    Main(){
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int r = sc.nextInt(), t, cnt=1, l=0;
	    if(r == 0) break;
	    int[] ary = new int[r+1];
	    
	    for(int i = 0; i < r; i++)
		ary[i] = sc.nextInt();
	    t = sc.nextInt();
	    r--;

	    for(;l <= r; cnt++){
		int v = (l+r)/2;

		if(ary[v] == t) break;
		if(ary[v] < t) l = v+1;
		else r = v-1;

		if(l >= r) break
	    }

	    System.out.println(Integer.toString(cnt));
	}
    }

    public static void main(String[] args){
	new Main();
    }
}

Compiler output:
Main.java:24: error: ';' expected
		if(l >= r) break
		                ^
1 error
Language: C

#include<stdio.h>

int main(){
	int n, a[100], i, target, mid, max, min, p, t = 0;
		scanf("%d", &n);
		if (n == 0)break;
		p = n;
		max = n - 1;
		min = 0;
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		scanf("%d", &target);
		mid = (min + max) / 2;

		while (1){

			if (a[mid] == target){
				t++;
				break;
			}
			else if (max == min) {
				t++;
				break;
			}
			else if (a[mid] < target){
				min = mid + 1;
				mid = (min + max) / 2;
				t++;
			}
			else if (a[mid] > target){
				max = mid - 1;
				mid = (min + max) / 2;
				t++;
			}
		}
		printf("%d\n", t);
		
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:28: error: break statement not within loop or switch
    6 |                 if (n == 0)break;
      |                            ^~~~~
Language: C

#include <stdio.h>
main(){
  int a,n[100],i,key,l=0,r=100,mid,c=1;
  while(1){
    scanf("%d",&a);
    if(a==0) break;
    for(i=0;i<=a;i++){
      scanf("%d",&n[i]);
    }
    key=n[a];
    r=a-1;
    if(l!=r){
      while(l<r){
	c++;
	mid=(l+r)/2;
	if(n[mid]==key) break;
	else if(n[mid]<key) l=mid+1;
	else r=mid-1;
      }
    }
    else count=0;
    printf("%d\n",c);
  }
return 0; 
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:21:10: error: 'count' undeclared (first use in this function)
   21 |     else count=0;
      |          ^~~~~
main.c:21:10: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
using namespace std;

int n[101];
int m;
int ans;
int N;

void func(int j,int k){
 ans++;
 if (n[(j+k)/2]==m||j>=k) {
  return;
 }
 else {
  if (n[(j+k)/2]<m) {
   func((j+k)/2+1,k);
  }
  else if (n[(j+k)/2]>m) {
   func(j,(j+k)/2-1);
  }
 }
 return;
}

 

int main(){
 
 while (1) {
  cin>>N;
  if (N==0) {
   break;
  }
  ans=0;
  for (int i=0; i<N; i++) {
   cin>>n[i];
  }
  cin>>m;
  func(0,N-1);
  cout << ans << endl;
 }
 
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>

int main(void)
{
	int i, n;
	int x[101];
	int search;
	int l, r, c;
	int cnt;
	while (scanf("%d", &n); && n){
		for (i = 0; i < n; i++){
			scanf("%d", &x[i]);
		}
		scanf("%d", &search);
		l = 0;
		r = n - 1;
		
		while (l <= r){
			c = (l + r) / 2;
			cnt++;
			if (c == search){
				break;
			}
			else if(x[c] > search){
				r = l - 1;
			}
			else {
				l = r + 1;
			}
		}
	}
	printf("%d\n", cnt);	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:10:31: error: expected ')' before ';' token
   10 |         while (scanf("%d", &n); && n){
      |               ~               ^
      |                               )
Language: C++

#include <bits/stdc++.h>
テつ?
using namespace std;
テつ?
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef long long ll;
テつ?
int n = -1;
int a[101];
int k;
テつ?
void serch(int k)
{
テつ?つ?つ?つ?つ?
テつ?つ?つ?つ?nt ans = 1;
テつ?
テつ?つ?つ?つ?nt lb = 0; int ub = n-1;
テつ?つ?つ?つ?hile (ub - lb>1)
テつ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?nt mid = (lb + ub) / 2;
テつ?つ?つ?つ?つ?つ?つ?つ?f (a[mid] == k) {
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ns++; break;
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?lse if (a[mid] > k){
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?b = mid;
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ns++;
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?lse {
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?b = mid;
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ns++;
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?
テつ?つ?つ?つ?out <<ans << endl;
テつ?つ?つ?つ?つ?
テつ?つ?つ?つ?eturn;
}
int main()
{
テつ?つ?つ?つ?hile (cin>>n&& n!=0)
テつ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?EP(i, n){
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?in >> a[i];
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?in >> k;
テつ?つ?つ?つ?つ?つ?つ?つ?erch(k);
テつ?つ?つ?つ?
テつ?
テつ?
テつ?つ?つ?つ?eturn 0;
}

Compiler output:
a.cc:2:1: error: '\U000030c6\U00003064' does not name a type
    2 | テつ?
      | ^~~~
a.cc:4:1: error: '\U000030c6\U00003064' does not name a type
    4 | テつ?
      | ^~~~
a.cc:11:1: error: '\U000030c6\U00003064' does not name a type
   11 | テつ?
      | ^~~~
a.cc:15:1: error: '\U000030c6\U00003064' does not name a type
   15 | テつ?
      | ^~~~
Language: C++

import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan =new Scanner(System.in);
		while(true){
		int n=scan.nextInt();
		if(n==0)break;
		int []a=new int[101];
		for(int i=0;i<n;i++){
			a[i]=scan.nextInt();
		}
		int m=scan.nextInt();
		int r=0,l=n-1,cnt=0;
		while(r<=l){
			++cnt;
			int h =(r+l)/2;
			if(a[h]==m)break;
			if(a[h]>m){
				r=h+1;
			}
			else{
				l=h;
			}
		}
		System.out.println(cnt);
	}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int b = sc.nextInt();
			if(b == 0){
				//System.out.println("break");
				break;
			}
			int[] a = new int[b];
			int left,right,searchvalue;
			for(int i=0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
			searchvalue = sc.nextInt();
			left = 0; right = a.length-1;
			System.out.println(solve(left, right, searchvalue, a));
		}
	}

	int solve(int left, int right,int sv,int[] a){
		int index = (left + right) / 2;
		int cnt;
		//System.out.println("left:"+left+" right:"+right+" sv:"+sv+" a[index]:"+a[index]);
		if(a[index] == sv){
			return 1;
		}else if(left == right){
			return 1;
		}else if(a[index] < sv){
			left = index;
			return 1 + solve(++left, right, sv, a);
		}else if(a[index] > sv){
			right = index;
			return 1 + solve(left, --right, sv, a);			
		}
		return 0;
		
		/*
		if(cnt == a.length-1){
			System.out.println(cnt);
			return;
		}
		if(a[(left + right) / 2] < sv){
			System.out.println("left:"+left+" right:"+right);
			if(left <= right){
				left = (left + right) / 2 + 1;
				solve(left, right,sv, a, ++cnt);
			}else{
				System.out.println(++cnt);
			}
		}else if(a[(left + right) / 2] > sv){
			System.out.println("left:"+left+" right:"+right);
			if(left < right){
				right = (left + right) / 2 - 1;
				solve(left, right,sv, a, ++cnt);
			}else{
				System.out.println(++cnt);
			}
		}else{
			System.out.println(++cnt);
		}
		*/
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

import math

def f(check, n, L, count):
    count += 1
    median = int(math.floor(float(n-1)/2))
    if len(L) == 1:
        return count
    elif L[median] == check:
        return count
    elif L[median] < check:
        L = L[median+1:]
    elif check < L[median]:
        L = L[:median]
    n = len(L)
    return f(check, n, L, count)

while True:
    n = int(raw_input())
    if n == 0: break
    L = [int(raw_input()) for i in range(n)]
    check = int(raw_input())
    print f(check, n, L, 0)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import java.util.*;

class Main{
	public static void main(String args[]){
		Solve s = new Solve();
		s.solve();
	}
}

class Solve{
	Scanner in = new Scanner(System.in);

	void solve(){
		while(in.hasNext()){
			int n = in.nextInt();
			if(n == 0) return;
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = in.nextInt();
			int b = in.nextInt();

			int l = 0, r = n, s = 0;
			while(true){
				s++;
				int m = (l + r) / 2;
				if(r - l == 1) break;
				//System.out.println(l + " " + r);
				if(a[m] < b) l = m;
				else if(a[m] > b) r = m;
				else break;
			}

			System.out.println(s);
		}
	}
	
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
    4 |         public static void main(String args[]){
      |               ^~~~~~~
      |               :
a.cc:4:33: error: 'String' has not been declared
    4 |         public static void main(String args[]){
      |                                 ^~~~~~
a.cc:8:2: error: expected ';' after class definition
    8 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:17: error: 'Solve' was not declared in this scope
    5 |                 Solve s = new Solve();
      |                 ^~~~~
a.cc:6:17: error: 's' was not declared in this scope
    6 |                 s.solve();
      |                 ^
a.cc: At global scope:
a.cc:11:9: error: 'Scanner' does not name a type
   11 |         Scanner in = new Scanner(System.in);
      |         ^~~~~~~
a.cc:36:2: error: expected ';' after class definition
   36 | }
      |  ^
      |  ;
a.cc: In member function 'void Solve::solve()':
a.cc:14:23: error: 'in' was not declared in this scope; did you mean 'int'?
   14 |                 while(in.hasNext()){
      |                       ^~
      |                       int
a.cc:17:28: error: structured binding declaration cannot have type 'int'
   17 |                         int[] a = new int[n];
      |                            ^~
a.cc:17:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:17:28: error: empty structured binding declaration
a.cc:17:31: error: expected initializer before 'a'
   17 |                         int[] a = new int[n];
      |                               ^
a.cc:18:52: error: 'a' was not declared in this scope
   18 |                         for(int i = 0; i < n; i++) a[i] = in.nextInt();
      |                                                    ^
a.cc:27:36: error: 'a' was not declared in this scope
   27 |                                 if(a[m] < b) l = m;
      |                                    ^
a.cc:32:25: error: 'System' was not declared in this scope
   32 |                         System.out.println(s);
      |                         ^~~~~~
Language: C++

#include <stdio.h>
int a, b, c;
int main() {
	while(true) {
		scanf("%d", &a);
		if(a == 0) break;
		for(int i = 0; i < n; i++) scanf("%d", &b);
		c = 0;
		while (a != 0) {
			a /= 2; c++;
		}
		printf("%d\n", c);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:36: error: 'n' was not declared in this scope
    7 |                 for(int i = 0; i < n; i++) scanf("%d", &b);
      |                                    ^
Language: C++

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

int n,num[100],aid,sum;

void reading();
void binary();

int main(){
	while(1){
		sum=0;
		cin >> n;
		if(n==0)break;

		reading();
		sort();
		binary();


		cout << sum << endl;
	}
	return 0;
}

void reading(){
	for(int i=0;i<n;++i)cin >> num[i];
	cin >> aid;
}

void binary(){
	int a=0,b=n-1,c;
	while(1){
		++sum;
		c = (a+b)/2;
		if(num[c]==aid || a==b)break;
		if(num[c]>aid)b = c-1;
		else a = c+1;
	}
}

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

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




int main(){
    int a, b, times;
    int i1, tyuusinn, yousosuu, yousosuu2;
    while(1){
    cin >> a;
    if(a==0){break;}
    i1=0;
        times=0;
    int w[a];
    while(1){
        cin >> b;
        w[i1]=b;
        i1++;
        if(i1==a)break;
    }
    sort(w, w+a);
    cin >> b;
    yousosuu=a;
    
    tyuusinn=yousosuu/2;
        while(1){
    times++;
    yousosuu2=yousosuu/2;
    if(w[tyuusinn]==b){break;}
    else if(w[tyuusinn]>b){
        tyuusinn=tyuusinn-yousosuu/2+yousosuu2/2;
        yousosuu=yousosuu2;
    }
    else{
        if(yousosuu%2==0){
            tyuusinn=tyuusinn+yousosuu2/2;
            yousosuu=yousosuu2-1;
        }
        else{
            tyuusinn=tyuusinn+yousosuu2/2+1;
            yousosuu=yousosuu2;
        }
    }
            if(yousosuu==0){break;}
        }
        
    cout << times << endl;
}
    return 0;
}

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

#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a, b, i1, times, max, min, tyuusinn;
    while(1){
    cin >> a;
    if(a==0){break;}
    i1=0;
    int w[a];
    while(1){
    cin >> b;
    w[i1]=b;
    i1++;
    if(i1==a){break;}
    }
    max=a-1;
    min=0;
    times=0;
    sort(w, w+a);
    cin >> b;
    while(1){
    times++;
        tyuusinn=(max+min)/2;
        if(max==min){break;}
    if(w[tyuusinn]==b){break;}
    else if(w[tyuusinn]<b){
        min=tyuusinn+1;
    }
    else{
        max=tyuusinn-1;
    }
    }
        cout << times << endl;
    }
    return 0;
}

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

#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a, b, times;
    int i1, tyuusinn, yousosuu, yousosuu2;
    while(1){
    cin >> a;
    if(a==0){break;}
    i1=0;
        times=0;
    int w[a];
    while(1){
        cin >> b;
        w[i1]=b;
        i1++;
        if(i1==a)break;
    }
    sort(w, w+a);
    cin >> b;
    yousosuu=a;
    
    tyuusinn=(yousosuu-1)/2;
        while(1){
    times++;
    yousosuu2=(yousosuu-1)/2;
    if(w[tyuusinn]==b){break;}
    else if(w[tyuusinn]>b){
        tyuusinn=tyuusinn-yousosuu+yousosuu2/2;
        yousosuu=yousosuu2+1;
    }
    else{
        if(yousosuu%2==0){
            tyuusinn=tyuusinn+yousosuu2/2-1;
            yousosuu=yousosuu2+1;
        }
        else{
            tyuusinn=tyuusinn+(yousosuu2+1)/2+1;
            yousosuu=yousosuu2;
        }
    }
            if(yousosuu==0){break;}
        }
        
    cout << times << endl;
}
    return 0;
}

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

#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a, b, times;
    int i1, tyuusinn, yousosuu, yousosuu2;
    while(1){
    cin >> a;
    if(a==0){break;}
    i1=0;
        times=0;
    int w[a];
    while(1){
        cin >> b;
        w[i1]=b;
        i1++;
        if(i1==a)break;
    }
    sort(w, w+a);
    cin >> b;
    yousosuu=a;
    
    tyuusinn=(yousosuu-1)/2;
        while(1){
    times++;
    yousosuu2=(yousosuu-1)/2;
    if(w[tyuusinn]==b){break;}
    else if(w[tyuusinn]>b){
        tyuusinn=tyuusinn-yousosuu+yousosuu2/2;
        yousosuu=tyuusinn-yousosuu+yousosuu2+1;
    }
    else{
        if(yousosuu%2==0){
            tyuusinn=tyuusinn+yousosuu2/2-1;
            yousosuu=tyuusinn+yousosuu2+1;
        }
        else{
            tyuusinn=tyuusinn+(yousosuu2+1)/2+1;
            yousosuu=tyuusinn+yousosuu2;
        }
    }
            if(yousosuu==0){break;}
        }
        
    cout << times << endl;
}
    return 0;
}

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

#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a, b, times;
    int i1, tyuusinn, yousosuu, yousosuu2;
    while(1){
    cin >> a;
    if(a==0){break;}
    i1=0;
        times=0;
    int w[a];
    while(1){
        cin >> b;
        w[i1]=b;
        i1++;
        if(i1==a)break;
    }
    sort(w, w+a);
    cin >> b;
    yousosuu=a;
    
    tyuusinn=(yousosuu-1)/2;
        while(1){
    times++;
    yousosuu2=(yousosuu-1)/2;
    if(w[tyuusinn]==b){break;}
    else if(w[tyuusinn]>b){
        tyuusinn=tyuusinn-yousosuu2+(yousosuu2-1)/2;
        yousosuu=yousosuu2;
    }
    else{
        if(yousosuu%2==0){
            tyuusinn=tyuusinn+(yousosuu2+1)/2;
            yousosuu=yousosuu2+1;
        }
        else{
            tyuusinn=tyuusinn+(yousosuu2+1)/2+1;
            yousosuu=yousosuu2;
        }
    }
            if(yousosuu==0){break;}
        }
        
    cout << times << endl;
}
    return 0;
}

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

#include <cstdio>
#define buf 1000001
using namespace std;
int cnt,b[buf];
void binary_search(int d,int a);

int main(void){
  int i,j,a,n;
  char str[200];

  for( ; ; ){
    fgets(str,sizeof(str),stdin);
    sscanf(str,"%d",&a);
    if(a==0) break;
    for(i=0;i<a;i++){
      fgets(str,sizeof(str),stdin);
      sscanf(str,"%d",&n);
      b[i]=n;
    }
    for(i=0;i<a;i++)
      printf("%d ",b[i]);
    printf("\n");
    cnt=1;
    fgets(str,sizeof(str),stdin);
    sscanf(str,"%d",&n);
    binary_search(n,a);
    printf("%d\n",cnt);
  }
  return 0;
}

void binary_search(int n,int a){
  int left,right,mid;
  left = 0; right = a1;
  while(left < right){
    mid = (left + right)/2;
    if(b[mid] == n)
      break;
    else if(n < b[mid])
      right = mid;
    else if(n > b[mid])
      left = mid+1;
    cnt++;
  }
}

Compiler output:
a.cc: In function 'void binary_search(int, int)':
a.cc:34:21: error: 'a1' was not declared in this scope; did you mean 'a'?
   34 |   left = 0; right = a1;
      |                     ^~
      |                     a
Language: C++

#include <iostream>
using namespace std;

int nibn(int a[], int s, int e, int k);
int nibn(int a[], int s, int e, int k){
	if(s>e) return 1;
	if(a[(s+e)/2] == k){
		return 1;
	}
	else if(a[(s+e)/2] < k){
		return 1 + nibn(a,(s+e)/2+1,e,k);
	}
	else if(a[(s+e)/2] > k){
		return 1 + nibn(a,s,(s+e)/2-1,k);
	}
}


int main(){
	int n, a[150], k;
	while(cin >> n){
		if(!n) break;
		ans = 0;
		for(int i = 0;i<n;i++){
			cin >> a[i];
		}
		cin >> k;
		cout << nibn(a,0,n-1,k) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |                 ans = 0;
      |                 ^~~
      |                 abs
a.cc: In function 'int nibn(int*, int, int, int)':
a.cc:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^
Language: C++

#include<iostream>
#include<map>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int main(){
	int set[101],n,k,cnt,a,b;
	while(1){
	cin >> n;
	if(n==0)break;
	for(int i=0;i<n;i++){
		cin >> set[i];
	}

	cin >> k;
	cnt=0;
	n--;
	a=n/2;
	for(int i=0,j=n;i<=j&&set[a]!=k;cnt++){
		a=(i+j)/2;
		if(set[a]<k) i=a+1;
		else j=a-1; 
	}
	cout << cnt　<< endl;
}
}

Compiler output:
a.cc:25:17: error: extended character 　 is not valid in an identifier
   25 |         cout << cnt　<< endl;
      |                 ^
a.cc: In function 'int main()':
a.cc:25:17: error: 'cnt\U00003000' was not declared in this scope
   25 |         cout << cnt　<< endl;
      |                 ^~~~~
Language: C++

#include <stdio.h>

int main(void)
{
	int n;
	int i;
	int a[128], key;
	int left, right, center;
	int count;
	
	while (scanf("%d", &n) && n){
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		scanf("%d", &key); //探す数
		
		left = 0;
		right = n - 1;
		count = 0;
		while (l <= r){
			center = (l + r) / 2;
			
			count++;
			if (a[center] == key){
				break;
			}
			else if (a[center] > key){
				right = center - 1;
			}
			else {
				left = center + 1;
			}
		}
		printf("%d\n", count);
	}
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: 'l' was not declared in this scope
   20 |                 while (l <= r){
      |                        ^
a.cc:20:29: error: 'r' was not declared in this scope
   20 |                 while (l <= r){
      |                             ^