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

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

int n,m;
int gx,gy;
int INF=1000000;
char fie[120][120];
int jp[120][120];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
typedef pair<int,int> P;
typedef pair<P,int> PP;

void bfs(){
	queue<PP> que;
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++){
			jp[j][i]=INF;
		}
	}
	for(int i=0;i<=n;i++){
		que.push(PP(P(i,0),0));
		jp[i][0]=0;
		que.push(PP(P(i,m+1),0));
		jp[i][m+1]=0;
	}
	for(int i=0;i<=m;i++){
		que.push(PP(P(0,i),0));
		jp[0][i]=0;
		que.push(PP(P(n+1,i),0));
		jp[n+1][i]=0;
	}
	while(que.size()){
		PP p=que.front();que.pop();
		for(int i=0;i<4;i++){
			int kx=p.first.first+dx[i],ky=p.first.second+dy[i],k=p.second;
			if(kx>=0 && kx<=n+1 && ky>=0 && ky<=m+1){
				if(fie[kx][ky]=='.' && k<jp[kx][ky]){
					que.push(PP(P(kx,ky),k));
					jp[kx][ky]=k;
				}
				if(fie[kx][ky]=='&' && k<jp[kx][ky]){
					que.push(PP(P(kx,ky),k));
					jp[kx][ky]=k;
				}
				if(fie[kx][ky]=='#' && k+1<jp[kx][ky]){
					que.push(PP(P(kx,ky),k+1));
					jp[kx][ky]=k+1;
				}
			}
		}
	}
}

int main(void){
	while(1){
		memset(fie,'.',sizeof(fie));
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;

		for(int i=1;i<=m;i++){
			for(int j=1;j<=n;j++){
				cin >> fie[j][i];
				if(fie[j][i]=='&')gx=j,gy=i;
			}
		}
		bfs();
		printf("%d\n",jp[gx][gy]);
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:17: error: 'memset' was not declared in this scope
   58 |                 memset(fie,'.',sizeof(fie));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<queue>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int H, W;
char grid[101][101];

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

int memo[101][101];

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

int const INF = 1<<29;

int main() {
  
  while(cin >> W >> H && W) {
    
    int sx, sy;
    
    for(int i=0; i<H; i++) {
      for(int j=0; j<W; j++) {
        cin >> grid[i][j];
        if(grid[i][j] == '&') {
          sx = j, sy = i;
        }
      }
    }
    
    memset(memo, -1, sizeof(memo));
    typedef pair<int, int> Pii;
    typedef pair<int, Pii> Piii;
    
    int ans = 1<<29;
    
    priority_queue<Piii> Q;
    Q.push(Piii(0, Pii(sx, sy)));
    while(!Q.empty()) {
      Piii piii = Q.top(); Q.pop();
      int const x = piii.second.first;
      int const y = piii.second.second;
      int const cost = piii.first;
      
      for(int k=0; k<4; k++) {
        int nx = x + dx[k], ny = y + dy[k];
        if(IN(nx, ny)) {
          int ncost = cost + (grid[ny][nx] == '#');
          if(memo[ny][nx] == -1
             || memo[ny][nx] > ncost) {
            memo[ny][nx] = ncost;
            Q.push(Piii(ncost, Pii(nx, ny)));
          }
        } else {
          ans = min(ans, cost);
        }
      }
    }
    
    cout << ans << endl;
    
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'memset' was not declared in this scope
   36 |     memset(memo, -1, sizeof(memo));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 |
Language: C

6
1 1
4 3
6 5
8 6
10 10
14 14
5
2 2
5 4
6 6
9 8
15 10
4
1 1
4 3
6 5
8 6
3
2 2
5 4
6 6
4
1 1
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0

Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 6
      | ^
Language: C

#include<stdio.h>



int LIS(void);



int h[201], r[201], m, n;



int main(void)

{

int i, j, t;

while(1)

{

scanf("%d",&n);

if(n==0)break;



for(i=0;i<n;i++)

scanf("%d%d",&h[i] ,&r[i]);



for(i=0;i<n+m;i++)

{

for(j=0;j<n+m;j++)

{

if(h[i]<h[j])

{

t=h[i];

h[i]=h[j];

h[j]=t;

t=r[i];

r[i]=r[j];

r[j]=t;

}

if(h[i]==h[j] && r[i]<r[j])

{

t=h[i];

h[i]=h[j];

h[j]=t;

t=r[i];

r[i]=r[j];

r[j]=t;

}

}

}

printf("%d\n",LIS());

}

return 0;

}



int LIS(void)

{

int i ,j ,k ,L[201] ,max=0;



for(i=0;i<201;i++)

L[i]=1;



for(i=1;i<n+m;i++)

{

j=i-1;

for(k=0;k<i;k++)

{

if(r[k]<r[i] && h[k]<h[i]ツ　&& L[k]>=L[i])L[i]=L[k]+1;

}

}

for(i=0;i<n+m;i++)

if(max<L[i])max=L[i];



return max;

}

Compiler output:
main.c: In function 'LIS':
main.c:117:26: error: expected ')' before '\U000030c4'
  117 | if(r[k]<r[i] && h[k]<h[i]ツ　&& L[k]>=L[i])L[i]=L[k]+1;
      |   ~                      ^~
      |                          )
main.c:117:28: error: stray '\343' in program
  117 | if(r[k]<r[i] && h[k]<h[i]<U+30C4><U+3000>&& L[k]>=L[i])L[i]=L[k]+1;
      |                                  ^~~~~~~~
Language: C

#include<stdio.h>



int LIS(void);



int h[201], r[201], m, n;



int main(void)
{

int i, j, t;

while(1)
{

scanf("%d",&n);

if(n==0)break;

for(i=0;i<n;i++)
scanf("%d%d",&h[i] ,&r[i]);



for(i=0;i<n+m;i++)
{

for(j=0;j<n+m;j++)
{

if(h[i]<h[j])
{

t=h[i];

h[i]=h[j];

h[j]=t;

t=r[i];

r[i]=r[j];

r[j]=t;

}

if(h[i]==h[j] && r[i]<r[j])
{

t=h[i];

h[i]=h[j];

h[j]=t;

t=r[i];

r[i]=r[j];

r[j]=t;

}

}

}

printf("%d\n",LIS());

}

return 0;

}



int LIS(void)
{

int i ,j ,k ,L[201] ,max=0;

for(i=0;i<201;i++)
L[i]=1;



for(i=1;i<n+m;i++)
{

j=i-1;

for(k=0;k<i;k++)
{

if(r[k]<r[i] && h[k]<h[i]ツ　&& L[k]>=L[i])L[i]=L[k]+1;

}

}

for(i=0;i<n+m;i++)
if(max<L[i])max=L[i];



return max;

}

Compiler output:
main.c: In function 'LIS':
main.c:102:26: error: expected ')' before '\U000030c4'
  102 | if(r[k]<r[i] && h[k]<h[i]ツ　&& L[k]>=L[i])L[i]=L[k]+1;
      |   ~                      ^~
      |                          )
main.c:102:28: error: stray '\343' in program
  102 | if(r[k]<r[i] && h[k]<h[i]<U+30C4><U+3000>&& L[k]>=L[i])L[i]=L[k]+1;
      |                                  ^~~~~~~~
Language: C

#include<stdio.h>



int LIS(void);



int h[201], r[201], m, n;



int main(void)

{

int i, j, t;

while(1)

{

scanf("%d",&n);

if(n==0)break;



for(i=0;i<n;i++)

scanf("%d%d",&h[i] ,&r[i]);



scanf("%d",&m);



for(i=n;i<n+m;i++)

scanf("%d%d",&h[i],&r[i]);



for(i=0;i<n+m;i++)

{

for(j=0;j<n+m;j++)

{

if(h[i]<h[j])

{

t=h[i];

h[i]=h[j];

h[j]=t;

t=r[i];

r[i]=r[j];

r[j]=t;

}

if(h[i]==h[j] && r[i]<r[j])

{

t=h[i];

h[i]=h[j];

h[j]=t;

t=r[i];

r[i]=r[j];

r[j]=t;

}

}

}

printf("%d\n",LIS());

}

return 0;

}



int LIS(void)

{

int i ,j ,k ,L[201] ,max=0;



for(i=0;i<201;i++)

L[i]=1;



for(i=1;i<n+m;i++)

{

j=i-1;

for(k=0;k<i;k++)

{

if(r[k]<r[i] && h[k]<h[i]ツ　&& L[k]>=L[i])L[i]=L[k]+1;

}

}

for(i=0;i<n+m;i++)

if(max<L[i])max=L[i];



return max;

}

Compiler output:
main.c: In function 'LIS':
main.c:127:26: error: expected ')' before '\U000030c4'
  127 | if(r[k]<r[i] && h[k]<h[i]ツ　&& L[k]>=L[i])L[i]=L[k]+1;
      |   ~                      ^~
      |                          )
main.c:127:28: error: stray '\343' in program
  127 | if(r[k]<r[i] && h[k]<h[i]<U+30C4><U+3000>&& L[k]>=L[i])L[i]=L[k]+1;
      |                                  ^~~~~~~~
Language: C

#include<iostream>
#include<cstdio>
#define N 1000 
using namespace std;
int h1[N],r1[N];

void sort(int,int);
int syori(int,int);

int main(){/*main*/
  int i,n1,n2,j,res;

  for(i=0;i<N;i++){
    h1[i]=0;
    r1[i]=0;
  }

  while(1){

  cin >> n1; // êQÌ}g[VJÌ

  if(n1 == 0)break;

  for(i=0;i<n1;i++){
    cin >> h1[i] >> r1[i]; //(n1-1)ÜÅªêQ
  }

  cin >> n2; //ñYÌ}g[VJÌ

  for(i=n1;i<(n1+n2);i++){
    cin >> h1[i] >> r1[i]; //n1©ç(n1+n2-1)ÜÅªñY
  }

  sort(n1,n2); // ¬³¢ÉÀÑÖ¦

  //  for(i=0;i<n1+n2;i++){
  // cout << i << ":"<< h1[i] << " " << r1[i] <<endl;
  // }

   res=syori(n1,n2);

   
  
  cout << res << endl;
  res=0;

  }

}


void sort(int n1,int n2){
  int k,l,max,h;

  for(k=0;k<(n1+n2);k++){
    max=k;
    for(l=k;l<(n1+n2);l++){
      if(h1[l]<h1[max]){ max=l; }
    }
    h=h1[max];
    h1[max]=h1[k];
    h1[k]=h;

    h=r1[max];
    r1[max]=r1[k];
    r1[k]=h;
    
  }


}


int syori(int n1,int n2){
  int q,i,H[N],Hcount=0,ans,I[N],HH[N],count=1,kcount=0;
  ans=0;

  for(q=0;q<N-5;q++){  
    H[q]=0;
    I[q]=0;
    HH[q]=0;
  }

  //cout << "test" << endl;

  for(q=0;q<(n1+n2);q++){
    if(h1[q]<h1[q+1] && r1[q]<r1[q+1])count++; 
    
    if((h1[q]==h1[q+1] || r1[q] == r1[q+1]) && HH[q+1]==0 ){
      count++; 
      H[q+1]=count-1;
      HH[q+1]=1;
      Hcount++;
      I[q+1]=q+1;
      q+=1;
    }

    //  cout << Hcount << endl;


    if(q==(n1+n2-1) && Hcount!=0){
      Hcount=0;
      kcount=1;

      if(count>=ans)ans=count;
      
      // cout << "ans--" << ans << endl; 

      for(i=0;i<(n1+n2);i++){
	
	if(HH[i]==1){
	  count=H[i];
	  H[i]=0;
	  HH[i]=0;
	  q=I[i];
	  break;
	}
	
      }
      
      
    }

  
    
  }
     
  if(kcount==0){ ans=count; } // kcountªOÌÆ«Í¾ÔèÈµ
  else{ kcount=0; }           // ±ÌvOÅÍ¾ÔçÈ¢ÆansªÅÈ¢
  
    return ans;
}
  

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

#include<iostream>

using namespace std;

int main(void){
  int n,m,h[201],r[201];

  while(cin >> n,n){
    for(int i=0;i<n;i++)cin >> h[i] >> r[i];
    cin >>m;
    for(int i=n;i<n+m;i++)cin >> h[i] >> r[i];

    for(int i=0;i<n+m;i++){
      for(int j=i;j<n+m;j++){
	if(h[i]>h[j]){
	  int t=h[i];
	  h[i]=h[j];
	  h[j]=t;
	  t=r[i];
	  r[i]=r[j];
	  r[j]=t;
	}
      }
    }
    for(int i=0;i<n+m;i++){
      for(int j=i;j<n+m;j++){
	if(r[i]>r[j]){
	  int t=h[i];
	  h[i]=h[j];
	  h[j]=t;
	  t=r[i];
	  r[i]=r[j];
	  r[j]=t;
	}
      }
    }

    int dp[201]={0};
    dp[0]=1;
    for(int i=0;i<n+m;i++){
      for(int j=i+1;j<n+m;j++){
	if(h[i]<h[j] && r[i]<r[j] && dp[i]>=dp[j])dp[j]=dp[i]+1;
      }
    }
    int res=0;
    for(int i=0;i<n+m;i++)res=max(res,dp[i]);
    cout << res << endl;
  }

  return 0;
}

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

#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#define rep(i,a) for( int i = 0; i != (a); ++i )

const int INF = 1 << 30;

typedef std::pair<int, int> P;

int n, m;
int dp[200];

int main()
{
	while( scanf( "%d", &n ), n )
	{
		memset( dp, 0, sizeof( dp ) );

		std::vector<P> ps;
		rep( i, n )
		{
			int h, r;
			scanf( "%d%d", &h, &r );
			ps.push_back( P( h, r ) );
		}

		scanf( "%d", &m );
		rep( i, m )
		{
			int h, r;
			scanf( "%d%d", &h, &r );
			ps.push_back( P( h, r ) );
		}

		std::sort( ps.begin(), ps.end() );

		int ans = 0;
		rep( i, ps.size() )
		{
			dp[i] = 1;
			
			rep( j, i )
				if( ps[i].first > ps[j].first && ps[i].second > ps[j].second )
					dp[i] = std::max( dp[i], dp[j]+1 );

			ans = std::max( ans, dp[i] );
		}

		printf( "%d\n", ans );
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'memset' was not declared in this scope
   18 |                 memset( dp, 0, sizeof( dp ) );
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<utility>
  +++ |+#include <cstring>
    5 | #define rep(i,a) for( int i = 0; i != (a); ++i )
Language: C++

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

typedef pair<int, int> Doll;
vector<Doll> Dolls;
int dp[201];

void debug(){
  for(int i = 0; i < Dolls.size(); i++){
    cout << "(" << Dolls[i].first << ", " << Dolls[i].second << ")" << endl;
  }
}

bool comp(const Doll& d1, const Doll& d2){
  return ((d1.first <= d2.first) && (d1.second <= d2.second));
}

int main(void){
  int n, m;
  while(cin >> n, n){
    Dolls.clear();
    Dolls.push_back(Doll(0, 0));
    for(int i = 0; i < n; i++){
      int h, r;
      cin >> h >> r;
      Dolls.push_back(Doll(h, r));
    }
    cin >> m;
    for(int i = 0; i < m; i++){
      int h, r;
      cin >> h >> r;
      Dolls.push_back(Doll(h, r));
    }
    sort(Dolls.begin(), Dolls.end(), comp);
    for(int i = 1; i < Dolls.size(); i++){
      int max_k = 0;
      for(int j = 0; j < i; j++){
        if(Dolls[j].first < Dolls[i].first && Dolls[j].second < Dolls[i].second && dp[max_k] < dp[j]){
          max_k = j;
        }
      }
      dp[i] = dp[max_k] + 1;
    }
    cout << dp[Dolls.size()-1] + 1 << endl;
  }
  return 0;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
#define MAX_NM 202
 
struct D{int r, h;};
 
bool compr(const D& d1, const D& d2){
  return d1.r < d2.r;
}
bool comph(const D& d1, const D& d2){
  return d1.h < d2.h;
}
 
int main(void){
  int n, m, dp[MAX_NM];
  D d[MAX_NM];
 
  while(cin >> n, n){
    for(int i = 0; i < n; i++) cin >> d[i].h >> d[i].r;
    cin >> m;
    for(int i = 0; i < m; i++) cin >> a[n+i].h >> a[n+i].r;
 
    int lis_r = 0, lis_h = 0;
    sort(d, d + n + m, compr);
 
    dp[0] = 1;
    for(int i = 1; i < n + m; i++){
      dp[i] = 1;
      for(int j = 0; j < i; j++){
        if(d[j].r < d[i].r && d[j].h < d[i].h){
          dp[i] = max(dp[i], dp[j] + 1);
        }
      }
    }
    lis_r = dp[n+m-1];
 
    sort(d, d + n + m, comph);
 
    dp[0] = 1;
    for(int i = 1; i < n + m; i++){
      dp[i] = 1;
      for(int j = 0; j < i; j++){
        if(d[j].r < d[i].r && d[j].h < d[i].h){
          dp[i] = max(dp[i], dp[j] + 1);
        }
      }
    }
    lis_h = dp[n+m-1];
 
    cout << max(lis_h, lis_r) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:39: error: 'a' was not declared in this scope
   22 |     for(int i = 0; i < m; i++) cin >> a[n+i].h >> a[n+i].r;
      |                                       ^
Language: C++

#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

typedef pair<int, int> P;
const int INF = 1e+9;

int DP[1000];

int main() {
	int n, m, h, r;
	while(cin >> n && n){
		memset(DP, 0, sizeof(DP));
		vector<P> vec;
		for(int i = 0; i < n; ++i){
			cin >> h >> r;
			vec.push_back(P(h, r));
		}
		cin >> m;
		for(int i = 0; i < m; ++i){
			cin >> h >> r;
			vec.push_back(P(h, r));
		}
		sort(vec.begin(), vec.end());
		int ans = 0;
		for(int i = 0; i < (n + m); ++i){
			DP[i] = 1;
			for(int j = 0; j < i; ++j){
				if(vec[j].first < vec[i].first && vec[j].second < vec[i].second)
					DP[i] = max(DP[i], DP[j] + 1);
			}
			ans = max(ans, DP[i]);
		}
		cout << ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'vector' was not declared in this scope
   15 |                 vector<P> vec;
      |                 ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:15:25: error: expected primary-expression before '>' token
   15 |                 vector<P> vec;
      |                         ^
a.cc:15:27: error: 'vec' was not declared in this scope
   15 |                 vector<P> vec;
      |                           ^~~
Language: C++

// AOJ20150414.cpp : テ」ツつウテ」ツδウテ」ツつステ」ツδシテ」ツδォ テ」ツつ「テ」ツδ療」ツδェテ」ツつアテ」ツδシテ」ツつキテ」ツδァテ」ツδウテ」ツ?ョテ」ツつィテ」ツδウテ」ツδ暗」ツδェ テ」ツδ敕」ツつ、テ」ツδウテ」ツδ暗」ツつ津・ツョツ堙ァツセツゥテ」ツ?療」ツ?セテ」ツ?凖」ツ??
//

#include "stdafx.h"

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

struct DOLL{
	int h;
	int r;
};

int f(vector<DOLL> &d1, vector<DOLL> &d2, int h, int r)
{
	int ans = 1;
	for (DOLL &d : d1){
		if (d.h>h && d.r>r){
			int a = f(d1, d2, h, r);
			ans = max(ans, a);
		}
	}
	for (DOLL &d : d2){
		if (d.h>h && d.r>r){
			int a = f(d1, d2, h, r);
			ans = max(ans, a);
		}
	}
	return ans;
}

int main() {

	while (true){
		int n, m;
		cin >> n >> m;
		if (n == 0) break;

		vector<DOLL> d1;
		vector<DOLL> d2;

		for (int i = 0; i<n; i++){
			DOLL d;
			cin >> d.h >> d.r;
			d1.push_back(d);
		}

		for (int i = 0; i<m; i++){
			DOLL d;
			cin >> d.h >> d.r;
			d2.push_back(d);
		}

		int ans = f(d1, d2, -1, -1);
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>

int N, M;
std::pair<int, int> Mat[201];
int dp[201];

int main(){
    while(scanf("%d", &N), N){
        memset(dp, -1, sizeof(dp));
        
        for(int i = 0; i < N; ++i)
            scanf("%d %d", &Mat[i].first, &Mat[i].second);
    
        scanf("%d", &M);
        
        for(int i = 0; i < M; ++i)
            scanf("%d %d", &Mat[i + N].first, &Mat[i + N].second);
        
        std::sort(Mat, Mat + (M + N));
        
        for(int i = 0; i < N + M; ++i)
            dp[i] = 1;
        
        int res = 1;
        for(int i = 0; i < N + M; ++i){
            for(int j = 0; j < i; ++j){
                if(Mat[i].first > Mat[j].first && Mat[i].second > Mat[j].second){
                    dp[i] = std::max(dp[i], dp[j] + 1);
                    
                    res = std::max(res, dp[i]);
                }
            }
        }
        
        std::cout << res << std::endl;
        
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <utility>
  +++ |+#include <cstring>
    5 |
Language: C++

# define _CRT_SECURE_NO_WARNINGS
# include <cstdio>
# include <algorithm>

#define MAX 100

struct doll{
	int high, r;
	doll() {}
	doll(int H, int R) : high(H), r(R) {}
	bool operator<(doll d){
		return (high < d.high) ? true : (high == d.high) ? (r < d.r) ? true : false : false;
	}
};

int n, m;

doll K[MAX * 2];
int dp[MAX * 2];

int main(){
	while (1){
		int h, r;
		scanf("%d", &n);
		if (n == 0)
			break;
		for (int i = 0; i < n; ++i){
			scanf("%d %d", &h, &r);
			K[i].high = h; K[i].r = r;
		}
		scanf("%d", &m);
		for (int i = n; i < m+n; ++i){
			scanf("%d %d", &h, &r);
			K[i].high = h;
			K[i].r = r;
		}
		std::sort(K + 1, K + 1 + n + m);
		memset(dp, 0,n+m);
		for (int i = 0; i < n + m; ++i){
			for (int j = 0; j < n + m; ++j){
				if (K[j] < K[i])
					dp[i] = std::max(dp[i], dp[j] + 1);
			}
		}
		printf("%d\n", dp[n + m-1]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: 'memset' was not declared in this scope
   38 |                 memset(dp, 0,n+m);
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | # include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <queue>

using namespace std;

typedef struct DOLL
{
	int h, r;
	
	bool operator > (const DOLL& d) const
	{
		return (h > d.h && r > d.r);
	}
	
	bool operator < (const DOLL& d) const
	{
		return (h < d.h && r < d.r);
	}
} D;

typedef struct Node
{
	D d;
	int num;
};

const int MAX = 100;

int n, m;
D A[MAX];
D B[MAX];

int AN[MAX];
int BN[MAX];

void solve()
{
	queue<Node> q;
	memset(AN, 0, sizeof(int)*n);
	memset(BN, 0, sizeof(int)*m);
	
	int max =0;
	Node n1 = {A[0], 1};
	Node n2 = {B[0], 1};
	q.push(n1);
	q.push(n2);
	while(!q.empty())
	{
		Node current = q.front();
		q.pop();
		
		if(max < current.num)
		{
			max = current.num;
		}
		
		for(int i=0; i<n; i++)
		{
			if(current.d < A[i])
			{
				if(AN[i] >= current.num+1) continue;
				
				Node new_node = {A[i], current.num+1};
				q.push(new_node);
				AN[i] = current.num+1;
				break;
			}
		}
		
		for(int i=0; i<m; i++)
		{
			if(current.d < B[i])
			{
				if(BN[i] >= current.num +1) continue;
				
				Node new_node = {B[i], current.num+1};
				q.push(new_node);
				BN[i] = current.num+1;
				break;
			}
		}
	}
	
	cout << max << endl;
}

int main(int argc, char** argv)
{
	int h, r;
	
	while(cin >> n, n)
	{
		for(int i=0; i<n; i++)
		{
			cin >> A[i].h >> A[i].r;
		}
		
		cin >> m;
		for(int i=0; i<m; i++)
		{
			cin >> B[i].h >> B[i].r;
		}
		
		solve();
	}
}

Compiler output:
a.cc:21:1: warning: 'typedef' was ignored in this declaration
   21 | typedef struct Node
      | ^~~~~~~
a.cc: In function 'void solve()':
a.cc:39:9: error: 'memset' was not declared in this scope
   39 |         memset(AN, 0, sizeof(int)*n);
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <queue>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int dp[200] = {0};
int h[200] , r[200];
int n,m;

int main(){
	while(cin >> n , n){
		rep(i,n)cin >> h[i] >> r[i];
		cin >> m;
		rep(i,m)cin >> h[n+i] >> r[n+i];
		int ans = 0;
		rep(i,200)dp[i] = 1;
		rep(i,200)rep(j,200){
			if(h[j] < h[i] && r[j] < r[i]){
				dp[i] = max(dp[j]+1,dp[i])
			}
		}
		cout << *max_element(dp,dp+n+m) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:59: error: expected ';' before '}' token
   18 |                                 dp[i] = max(dp[j]+1,dp[i])
      |                                                           ^
      |                                                           ;
   19 |                         }
      |                         ~                                  
a.cc:21:26: error: 'max_element' was not declared in this scope
   21 |                 cout << *max_element(dp,dp+n+m) << endl;
      |                          ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstring>
#include <vector>

using namespace std;

typedef pair<int, int> doll;

int main()
{
	int n, m, i, j;
	vector<doll> vc;
	int dp[200];
	
	vc.reserve(200);
	
	while( cin >> n, n)
	{
		vc.clear();
		memset( dp, 0, sizeof(dp));
		
		for( i = 0; i < n; i++)
		{
			doll d;
			cin >> d.first >> d.second;
			vc.push_back(d);
		}
		
		cin >> m;
		
		for( i = 0; i < m; i++)
		{
			doll d;
			cin >> d.first >> d.second;
			vc.push_back(d);
		}
		
		sort(vc.begin(), vc.end());
		

		
		dp[0] = 1;
		doll surface(vc[0].first, vc[0].second);

		for( i = 1; i < n+m; i++)
		{
			if( surface.first < vc[i].first && surface.second < vc[i].second )
			{
				dp[i] = dp[i-1] + 1;
				surface.first = vc[i].first;
				surface.second = vc[i].second;
			}
			else
			{
				dp[i] = dp[i-1];
			}
		}
		
		
		cout << dp[n+m-1] << endl;
	}
	
	return 0;
}

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

#include <iostream>
#include <cstring>
#include <vector>

using namespace std;

typedef pair<int, int> doll;

int main()
{
	int n, m, i, j;
	vector<doll> vc;
	int dp[200];
	
	vc.reserve(200);
	
	while( cin >> n, n)
	{
		vc.clear();
		memset( dp, 0, sizeof(dp));
		
		for( i = 0; i < n; i++)
		{
			doll d;
			cin >> d.first >> d.second;
			vc.push_back(d);
		}
		
		cin >> m;
		
		for( i = 0; i < m; i++)
		{
			doll d;
			cin >> d.first >> d.second;
			vc.push_back(d);
		}
		
		std::sort(vc.begin(), vc.end());
		

		
		dp[0] = 1;
		doll surface(vc[0].first, vc[0].second);

		for( i = 1; i < n+m; i++)
		{
			if( surface.first < vc[i].first && surface.second < vc[i].second )
			{
				dp[i] = dp[i-1] + 1;
				surface.first = vc[i].first;
				surface.second = vc[i].second;
			}
			else
			{
				dp[i] = dp[i-1];
			}
		}
		
		
		cout << dp[n+m-1] << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:22: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   38 |                 std::sort(vc.begin(), vc.end());
      |                      ^~~~
      |                      qsort
Language: C++

#include<iostream>
#include<cstdlib>
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 206
using namespace std;
int test=0;
int n,m;
int dp[MAX+1];
class Doll{
public:
   int h;
   int r;
   bool operator < (const Doll &d)const{
      if(h == d.h)return r < d.h;//hが同じ時ｒで比較
      return h < d.h;//普段はｈで比較
   }
};

Doll Dolls[MAX];

void solve(void){
   dp[0] = 0;
   //  rep(i,n+m){
   for(int i=0;i<(n+m);i++){
      dp[i+1] = 1;
      for(int j=0;j<i;j++)
	 if(Dolls[j].r < Dolls[i].r){
	    dp[i+1] = max(dp[i+1]+1,dp[j]+1);
      }
   }

   
   cout << "test" << ++test << endl;
   rep(i,n+m)
      cout << dp[i] << endl;
   cout << "ans" << endl;
   cout << dp[n+m] << endl << endl;
}

int main(void){
   int h,r;
   while(1){
      cin >> n;
      if(n==0)break;
      rep(i,n){
	 cin >> h >> r;
	 Dolls[i].h = h;
	 Dolls[i].r = r;
      }
      cin >> m;
      for(int i=n;i<(n+m);i++){
	 cin >> h >> r;
	 Dolls[i].h = h;
	 Dolls[i].r = r;
      }
      sort(Dolls,Dolls+n+m);
      rep(i,n+m)
	 cout << Dolls[i].h << "  " << Dolls[i].r<<endl;
      solve();

   }
   return 0;
}

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

#include<iostream>
#include<cstdlib>
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 206
using namespace std;
int test=0;
int n,m;
int dp[MAX+1];
class Doll{
public:
   int h;
   int r;
   bool operator < (const Doll &d)const{
      if(h == d.h)return r < d.h;//hが同じ時ｒで比較
      return h < d.h;//普段はｈで比較
   }
};

Doll Dolls[MAX];

void solve(void){
   dp[0] = 0;
   //  rep(i,n+m){
   for(int i=0;i<(n+m);i++){
      dp[i+1] = 1;
      for(int j=0;j<i;j++)
	 if(Dolls[j].r < Dolls[i].r){
	    dp[i+1] = max(dp[i+1]+1,dp[j]+1);
      }
   }

/*
   cout << "test" << ++test << endl;
   rep(i,n+m)
      cout << dp[i] << endl;
   cout << "ans" << endl;
*/
   cout << dp[n+m] << endl;

}

int main(void){
   int h,r;
   while(1){
      cin >> n;
      if(n==0)break;
      rep(i,n){
	 cin >> h >> r;
	 Dolls[i].h = h;
	 Dolls[i].r = r;
      }
      cin >> m;
      for(int i=n;i<(n+m);i++){
	 cin >> h >> r;
	 Dolls[i].h = h;
	 Dolls[i].r = r;
      }
      sort(Dolls,Dolls+n+m);
      /*
      rep(i,n+m)
	 cout << Dolls[i].h << "  " << Dolls[i].r<<endl;
      */
      solve();

   }
   return 0;
}

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

#include<iostream>
#include<cstdlib>
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 206
using namespace std;
int test=0;
int n,m;
int dp[MAX+1];
class Doll{
public:
   int h;
   int r;
   bool operator < (const Doll &d)const{
      if(h == d.h)return r < d.h;//hが同じ時ｒで比較
      return h < d.h;//普段はｈで比較
   }
};

Doll Dolls[MAX];

void solve(void){
   dp[0] = 0;
   //ini
   for(int i=0;i<=n;i++)      
      dp[i] =0;


   for(int i=0;i<(n+m);i++){
      dp[i+1] = 1;
      for(int j=0;j<i;j++)
	 if(Dolls[j].r < Dolls[i].r){
	    dp[i+1] = max(dp[i+1]+1,dp[j]+1);
      }
   }

   cout << dp[n+m] << endl;
}

int main(void){
   int h,r;
   while(1){
      cin >> n;
      if(n==0)break;
      rep(i,n){
	 cin >> h >> r;
	 Dolls[i].h = h;
	 Dolls[i].r = r;
      }
      cin >> m;
      for(int i=n;i<(n+m);i++){
	 cin >> h >> r;
	 Dolls[i].h = h;
	 Dolls[i].r = r;
      }
      sort(Dolls,Dolls+n+m);
      /*
      rep(i,n+m)
	 cout << Dolls[i].h << "  " << Dolls[i].r<<endl;
      */
      solve();

   }
   return 0;
}

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

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

class Container
{
public:
	void append( pair< int, int > p )
	{
		masterList.push_back( p );
	}
	void cSort()
	{
		sort( masterList.begin(), masterList.end() );
		sortedList.clear();
		vector< pair< int, int > >::iterator itr = masterList.begin();
		while( itr != masterList.end() ){
			vector< pair< int, int > > v;
			int x = itr->first;
			v.push_back( *itr );
			++itr;
			if( itr != masterList.end() && itr->first == x ){
				v.push_back( *itr );
				++itr;
			}
			sortedList.push_back( v );
		}
	}

	int countContainment()
	{
		int result = 0;
		int dp[ 201 ][ 1000 ];
		memset( dp, 0, sizeof(dp) );
		for( int i = 0; i < (int)sortedList.size(); ++i ){
			int r = sortedList[ i ][ 0 ].second;
			for( int j = 0; j < r; ++j ){
				dp[ i + 1 ][ j ] = dp[ i ][ j ];
			}
			for( int j = r; j < 1000; ++j ){
				dp[ i + 1 ][ j ] = max( dp[ i ][ j ], dp[ i ][ r - 1 ] + 1 );
			}
		}

		return dp[ sortedList.size() ][ 1000 - 1 ];
	}

	void cSwap()
	{
		for( int i = 0; i < (int)masterList.size(); ++i ){
			int t = masterList[ i ].first;
			masterList[ i ].first = masterList[ i ].second;
			masterList[ i ].second = t;
		}
	}


	vector< pair< int, int > > masterList;
	vector< vector< pair< int ,int > > > sortedList;
};

int main()
{
	int n, m;

	while( cin >> n && n ){
		Container cont;
		for( int i = 0; i < n; ++i ){
			pair< int, int > p;
			cin >> p.first >> p.second;
			cont.append( p );
		}
		cin >> m;
		for( int i = 0; i < m; ++i ){
			pair< int, int > p;
			cin >> p.first >> p.second;
			cont.append( p );
		}

		int result = 0;
		cont.cSort();
		result = cont.countContainment();
		cont.cSwap();
		cont.cSort();
		cout << max( result, cont.countContainment() ) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In member function 'int Container::countContainment()':
a.cc:35:17: error: 'memset' was not declared in this scope
   35 |                 memset( dp, 0, sizeof(dp) );
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <cstdio>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#define rep(i,n) for(int i=0; i<n; ++i)

using namespace std;
struct Doll{
    int H,R,L;
    bool operator<(const Doll& right)const {
        return H<right.H;
    }
    Doll(){
      H=0; R=0; L=0;
    }
};
int N, M;
int main(){
  while(cin >> N && N){
      vector<Doll> D;
      D.resize(200);
      rep(i,N){
        cin >> D[i+1].H >> D[i+1].R;
      }
      cin >> M;
      rep(i,M){
        cin >> D[N+i+1].H >> D[N+i+1].R;
      }
      sort(D.begin()+1, D.begin()+(N+M)+1);
      int ans = 0;
      for(int i=1; i<N+M+1; ++i){
        int m = 0;
        rep(j,i){
            if(D[j].R<D[i].R && D[j].H<D[i].H && m<D[j].L){
                m = D[j].L;
            }
        }
        D[i].L = m+1;
        ans = max(ans,D[i].L);
      }
      cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |       sort(D.begin()+1, D.begin()+(N+M)+1);
      |       ^~~~
      |       short
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  for(;cin>>n,n;)
    {
      vector<pair<int,int> >data;
      for(int i=0;i<n;i++)
	{
	  int h,r;
	  cin>>h>>r;
	  data.push_back(make_pair(h,r));
	}
      int m;
      cin>>m;
      for(int i=0;i<m;i++)
	{
	  int h,r;
	  cin>>h>>r;
	  data.push_back(make_pair(h,r));
	}
      sort(data.begin(),data.end());
      /*      for(int i=0;i<data.size();i++)
	cout<<"<"<<data[i].first<<","<<data[i].second<<"> ";
	cout<<endl;
      */
      int ans=1;
      for(int j=data.size()-1;j>=0;j--)
	{
	  int tmp=1;
	  pair<int,int >last=data[j];
	  for(int i=j-1;i>=0;i--)
	    {
	      // cout<<"<"<<last.first<<","<<last.second<<"> "<<endl;
	      if(last.first>data[i].first &&
		 last.second>data[i].second
		 )
		{
		  tmp++;
		  last=data[i];
		}
	    }
	  if(tmp>ans)
	    ans=tmp;
	}
      cout<<ans<<endl;
    }

}

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

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

Compiler output:
main.c: In function 'main':
main.c:17:3: error: expected declaration or statement at end of input
   17 |   return 0;
      |   ^~~~~~
Language: C

#include <cstdio>

int main(void)
{
	int n;
	int count;
	
	while (scanf("%d", &n), n){
		count = 0;
		while (n != 1){
			if (n % 2 == 0){
				n /= 2;
			}
			else {
				n = n * 3 + 1;
			}
			count++;
		}
		printf("%d\n", count);
	}
	return (0);
}

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

#include <stdio.h>

int main(void) {
	int n, c;

	while (1) {
		scanf_s("%d", &n);
		if (n == 0) break;

		c = 0;
		while (1) {
			if (n == 1) break;
			else if (n % 2 == 0) {
				n /= 2;
				c++;
			}
			else {
				n *= 3;
				n += 1;
				c++;
			}
		}
		printf("%d\n", c);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |                 scanf_s("%d", &n);
      |                 ^~~~~~~
      |                 scanf
Language: C

c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int]
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
      |   ^~~~
main.c: In function 'main':
main.c:1:3: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:41: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
      |                                         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
main.c:1:41: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
      |                                         ^~~~~~
main.c:1:41: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:58: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
      |                                                          ^~~~~
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:58: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:80: error: expected expression before '}' token
    1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
      |                                                                                ^
Language: C++

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

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	while (n != 1){
		if (n % 2 == 0){
			n = n / 2;
		}
		else {
			n = n * 3 + 1;
		}
		ct++;
	}
	return ct;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: no matching function for call to 'count(int&)'
   11 |                 cout << count(n) << endl;
      |                         ~~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note:   candidate expects 4 arguments, 1 provided
Language: C++

while num = gets.to_i
	count = 0
	if num == 0
		break
	end
	while num != 1
	if (num % 2) == 0
			num = num / 2
			count = count + 1
		else 
			num = (num * 3) + 1
			count = count + 1
		end
	end
	puts count
end

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while num = gets.to_i
      | ^~~~~
Language: C++

nclude<stdio.h>
int main(void)
{
	int n,a;
	scanf("%d",&n);
	while(n!=0){
		a=0;
		while(n>1){
			if(n%2==0)  n=n/2;
			else  n=n*3+1;
			a++;
		}
		printf("%d\n",a);
		scanf("%d",&n);
	}
	return 0;
}

Compiler output:
a.cc:1:1: error: 'nclude' does not name a type
    1 | nclude<stdio.h>
      | ^~~~~~
Language: C++

main(n,i){for(;scanf("%d",&n),n;printf("%d\n",i))for(i=0;n-1;i++)n=n%2?3*n+1:n/2;exit(0);}

Compiler output:
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
    1 | main(n,i){for(;scanf("%d",&n),n;printf("%d\n",i))for(i=0;n-1;i++)n=n%2?3*n+1:n/2;exit(0);}
      |     ^
Language: Java

import java.util.Scanner;

public 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 a = sc.nextInt();
			double h = sc.nextDouble()/100;
			double w = sc.nextDouble();
			double b = Math.abs(22-w/(h*h));
			for(int i=1;i<n;i++){
				int x = sc.nextInt();
				h = sc.nextDouble()/100;
				w = sc.nextDouble();
				double a = Math.abs(22-w/(h*h));
				if(a<b){
					b = a;
					a = x;
				}
				else if(a==b&&x<a)a = x;
			}
			System.out.println(a);
		}
	}
}

Compiler output:
Main.java:18: error: variable a is already defined in method main(String[])
				double a = Math.abs(22-w/(h*h));
				       ^
1 error
Language: Java

import java.util.Scanner;

public 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 a = sc.nextInt();
			double h = sc.nextDouble()/100;
			double w = sc.nextDouble();
			double b = Math.abs(22-w/(h*h));
			for(int i=1;i<n;i++){
				int x = sc.nextInt();
				h = sc.nextDouble()/100;
				w = sc.nextDouble();
				double a = Math.abs(22-w(h*h));
				if(a<b){
					b = a;
					a = x;
				}
				else if(a==b&&x<a)a = x;
			}
			System.out.println(a);
		}
	}
}

Compiler output:
Main.java:18: error: variable a is already defined in method main(String[])
				double a = Math.abs(22-w(h*h));
				       ^
Main.java:18: error: cannot find symbol
				double a = Math.abs(22-w(h*h));
				                       ^
  symbol:   method w(double)
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public 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 a = sc.nextInt();
			double h = sc.nextDouble()/100;
			double w = sc.nextDouble();
			double b = Math.abs(22-(w/(h*h)));
			for(int i=1;i<n;i++){
				int x = sc.nextInt();
				h = sc.nextDouble()/100;
				w = sc.nextDouble();
				double a = Math.abs(22-(w/(h*h)));
				if(a<b){
					b = a;
					a = x;
				}
				else if(a==b&&x<a)a = x;
			}
			System.out.println(a);
		}
	}
}

Compiler output:
Main.java:18: error: variable a is already defined in method main(String[])
				double a = Math.abs(22-(w/(h*h)));
				       ^
1 error
Language: Java

import java.util.Scanner;
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 num[]=new int[n];
		double bmi;
		
		int ans=0,x=0,near=100;
		for(int i=0;i<n;i++)
		    {
			num[i]=scan.next();
			int h,w;
			h=scan.nextInt();
			w=scan.nextInt();
			bmi=(double)w/(h*h)*10000;
			
			int bmi_int=(int)bmi;
			
			if(bmi_int>=22)x=bmi_int-22;
			else x=22-bmi_int;
				 
			if(near>x)
			    {
				near=x;
				ans=i;
			    }
		    }
		System.out.println(num[ans]);
	    }
    }
}

Compiler output:
Main.java:17: error: incompatible types: String cannot be converted to int
			num[i]=scan.next();
			                ^
1 error
Language: Java

import java.util.Scanner;
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 ans=0,x=0,near=0,j=0;
		for(int i=0;i<n;i++)
		    {
			int num=scan.nextInt();
			int w;
			double h;
			h=scan.nextDouble()/100;
			w=scan.nextInt();
			int bmi=(int)((double)w/(h*h));
			if(i==0)ans=num;
			
			if(bmi>=22)x=bmi-22;
			else x=22-bmi;
			near=Double.MAX_VALUE;
			if(near>x)
			    {
				near=x;
				ans=num;
				
			    }
		    }
		System.out.println(ans);
	    }
    }
}

Compiler output:
Main.java:27: error: incompatible types: possible lossy conversion from double to int
			near=Double.MAX_VALUE;
			           ^
1 error
Language: C

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

using namespace std;

int main(){
	for(int n;scanf("%d",&n),n;){
		double bmi,best=1e9;
		int ibest=1000000000;
		for(int j=0;j<n;j++){
			int i,h,w;
			scanf("%d%d%d",&i,&h,&w);
			bmi=w/((h/100.0)*(h/100.0));
			if(abs(22-bmi)+1e-9<abs(22-best))
				best=bmi,ibest=i;
			else if(abs(abs(22-bmi)-abs(22-best))<1e-9)
				ibest=min(ibest,i);
		}
		printf("%d\n",ibest);
	}

	return 0;
}

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

#include <stdio.h>
#include <math.h>

int main(void) {
	int datanum,datamax;
	int maxnumber;
	double maxbmi;
	double maxdiff;
	int number,height,weight;
	double heightm;
	double bmi;
	double diff;
	while(1) {
		scanf("%d",&datamax);
		maxnumber=0;
		maxbmi=0x7fffffff;
		maxdiff=0x7fffffff;
		for(datanum=0;datanum<datamax;datanum++) {
			scanf("%d %d %d",&number,&height,&weight);
			heightm=(double)height/100;
			bmi=(double)weight/heightm/heightm;
			diff=fabs(bmi-22);
			if(diff<maxdiff || (diff==maxdiff && number<maxnumber) {
				maxdiff=diff;
				maxbmi=bmi;
				maxnumber=number;
			}
		}
		printf("%d\n",maxnumber);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:79: error: expected ')' before '{' token
   23 |                         if(diff<maxdiff || (diff==maxdiff && number<maxnumber) {
      |                           ~                                                   ^~
      |                                                                               )
main.c:28:17: error: expected expression before '}' token
   28 |                 }
      |                 ^
Language: C++

#include<iostream>
#include<string>
#include<map>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n!=0) {
		double a = -100;
		long float r=22, r1 = 10000;
		for (int i = 0; i < n; i++) {
			long float id, cm, kg;
			cin >> id >> cm >> kg;
			cm /= 100;
			long float bmi;
			bmi = (kg / (cm*cm));
			long float r2 = r - bmi;
			if (r2 < 0) r2 = 0 - r2;
			if (r1 > r2) {
				r1 = r2;
				a = id;
			}
			else if (r1 == r2&&a<id) {
				a = id;
			}
		}
		cout << a << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'long' specified with 'float'
    9 |                 long float r=22, r1 = 10000;
      |                 ^~~~
a.cc:9:17: error: 'long' specified with 'float'
a.cc:11:25: error: 'long' specified with 'float'
   11 |                         long float id, cm, kg;
      |                         ^~~~
a.cc:11:25: error: 'long' specified with 'float'
a.cc:11:25: error: 'long' specified with 'float'
a.cc:14:25: error: 'long' specified with 'float'
   14 |                         long float bmi;
      |                         ^~~~
a.cc:16:25: error: 'long' specified with 'float'
   16 |                         long float r2 = r - bmi;
      |                         ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n!=0) {
		double a = -100;
		long float r=22, r1 = 10000;
		for (int i = 0; i < n; i++) {
			long float id, cm, kg;
			cin >> id >> cm >> kg;
			cm /= 100;
			long float bmi;
			bmi = (kg / (cm*cm));
			long float r2 = r - bmi;
			if (r2 < 0) r2 = 0 - r2;
			if (r1 > r2) {
				r1 = r2;
				a = id;
			}
			else if (r1 == r2&&a<id) {
				a = id;
			}
		}
		cout << a << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'long' specified with 'float'
    8 |                 long float r=22, r1 = 10000;
      |                 ^~~~
a.cc:8:17: error: 'long' specified with 'float'
a.cc:10:25: error: 'long' specified with 'float'
   10 |                         long float id, cm, kg;
      |                         ^~~~
a.cc:10:25: error: 'long' specified with 'float'
a.cc:10:25: error: 'long' specified with 'float'
a.cc:13:25: error: 'long' specified with 'float'
   13 |                         long float bmi;
      |                         ^~~~
a.cc:15:25: error: 'long' specified with 'float'
   15 |                         long float r2 = r - bmi;
      |                         ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int bmi(double h, double w){
	return w/((h/100)*(h/100));
}

int main(){
	int n, p;
	double h, w;
	const double c = 22;
	while(true){
		cin >> n;
		if(n == 0)
			return 0; 
		int num;
		double diff;
		for(int i = 0; i < n; i++){
			cin >> p >> h >> w;
			if(i == 0){
				num = p;
				diff = abs(bmi(h,w) - c);
			}else{
				double k = abs(bmi(h,w) - c);
				if(diff > k){
					diff = k;
					num = p;
				}else if(diff == k){
					if(num > p)
						num = p;
				}
			}
		}
		cout << num << endl;
	}

}

BMI = ??????(kg) / (??????(m))2

Compiler output:
a.cc:40:11: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs]
   40 | BMI = ??????(kg) / (??????(m))2
a.cc:40:25: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs]
a.cc:40:1: error: 'BMI' does not name a type
   40 | BMI = ??????(kg) / (??????(m))2
      | ^~~
Language: C++

#include <iostream>
#include <cmath>
#include <utility>
#include <vector>
using namespace std;
typedef pair<double,int> P;

int main() {
  int n;
  vector<P> V;
  P temp;
  while(cin >> n) {
    V.clear();
    if(n==0) break;
    int k;
    double h,w;
    for(int i=0;i<n;i++) {
      cin >> k >> h >> w;
      temp.first = abs(w / ((h/100)*(h/100)) - 22.0);
      temp.second = k;
      V.push_back(temp);
    }

    sort(V.begin(),V.end());
    temp = V[0];
    cout << temp.second << endl;
  }
}

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(V.begin(),V.end());
      |     ^~~~
      |     sqrt