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

#include <stdio.h>

typedef struct seiseki{
  int m; //受験者
  int n_min;
  int n_max;
  int score[];
}LIST;

typedef struct Pass{
  int gap;
  int num;
}LIST2;

void sort(int a[], int n);
void sort2(LIST2 a[],int n);

int main(void){
  LIST a[200];
  LIST2 b[200];
  int i=0;
  int l;
  int k;

  while(i<200){
    int pass=0;
    
    scanf("%d %d %d",&a[i].m,&a[i].n_min,&a[i].n_max);
    if(a[i].m == 0 && a[i].n_min == 0 && a[i].n_max == 0) break;
    
    for(l = 0; l < a[i].m ; l++){
      scanf("%d",&a[i].score[l]);
    }
    
    sort(a[i].score, l);
  
    for(k = 0; k < (a[i].n_max - a[i].n_min) ; k++){
      pass = a[i].n_max - k;
      b[k].gap = a[i].score[pass-1] - a[i].score[pass];
      b[k].num = pass;
    }
    
    sort2(b, k);
    
    int n[a[i].m];
    n[i] = b[0].num;
    
    i += 1;
  }

  for(int j = 0 ; j < i; j++){
    printf("%d\n",n[j]);
  }
  
  return 0;
}

void sort(int a[], int n){
  int i, j, temp;

  for (i = 0; i < (n - 1); i++) {
    for (j = (n - 1); j > i; j--) {
      if (a[j-1] < a[j]) {
	temp = a[j+1];
	a[j-1] = a[j];
	a[j] = temp;
      }
    }
  }
}


void sort2(LIST2 a[], int n){
  int i, j;
  LIST2 temp;

  for (i = 0; i < (n - 1); i++) {
    for (j = (n - 1); j > i; j--) {
      if (a[j-1].gap < a[j].gap) {
	temp = a[j-1];
	a[j-1] = a[j];
	a[j] = temp;
      }
    }
  }
}


Compiler output:
main.c: In function 'main':
main.c:52:19: error: 'n' undeclared (first use in this function)
   52 |     printf("%d\n",n[j]);
      |                   ^
main.c:52:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(void){
	int m,
	int min, max;
	int gap = 0;
	int pos;
	int i;
	
	while(1){
	gap = 0;
	scanf("%d %d %d", &m, &min, &max);
	if ( m == 0 && min == 0 && max == 0 ) {
		break;
	}
	int score[m] = {0};
	for ( i = 0; i < m; i++ ) {
		scanf("%d", &score[i]);
	}
	
	for ( i = min; i <= max; i++ ) {
		if ( gap <= score[i-1] - score[i] ) {
			gap = score[i-1] - score[i];
			pos = i;
		}
	}
	printf("%d\n", pos);
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:9: error: expected identifier or '(' before 'int'
    5 |         int min, max;
      |         ^~~
main.c:12:32: error: 'min' undeclared (first use in this function); did you mean 'main'?
   12 |         scanf("%d %d %d", &m, &min, &max);
      |                                ^~~
      |                                main
main.c:12:32: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:38: error: 'max' undeclared (first use in this function)
   12 |         scanf("%d %d %d", &m, &min, &max);
      |                                      ^~~
main.c:16:24: error: variable-sized object may not be initialized except with an empty initializer
   16 |         int score[m] = {0};
      |                        ^
Language: C

#include<stdio.h>

int main(void){
	int m;
	int min, max;
	int gap = 0;
	int pos;
	int i;
	
	while(1){
	gap = 0;
	scanf("%d %d %d", &m, &min, &max);
	if ( m == 0 && min == 0 && max == 0 ) {
		break;
	}
	int score[m] = {0};
	for ( i = 0; i < m; i++ ) {
		scanf("%d", &score[i]);
	}
	
	for ( i = min; i <= max; i++ ) {
		if ( gap <= score[i-1] - score[i] ) {
			gap = score[i-1] - score[i];
			pos = i;
		}
	}
	printf("%d\n", pos);
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:24: error: variable-sized object may not be initialized except with an empty initializer
   16 |         int score[m] = {0};
      |                        ^
Language: C++

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

int main (){
	int n,min,max;
	while(cin>>n>>min>>max && n){
		min--; max--;
		vector<int> v(n);
		for(int i=0;i<n;i++)cin>>v[i];
		sort(v.begin(),v.end(),greater<int>());
		
		int ans,gap=0;
		for(int i=min;i<=max;i++){
			if(gap>=v[i+1]-v[i]){
				gap=v[i+1]-v[i];
				ans=i+1;
			}
		}
		cout<<ans<<endl;
	}
}




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

#include <iostream>
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main()
{
        int m,ni,na;
        while(cin>>m>>ni>>na,m)
        {
                vector<int> p(m);
                REP(i,m)
                {
                        cin>>p[i];
                }
                sort(p.begin(), p.end());
                int md=0,mp=ni;
                FOR(i, m-na, m-ni+1)
                {
                        if(p[i]-p[i-1]>md)
                        {
                                //cout<<md<<i<<endl;
                                md=p[i]-p[i-1];
                                mp=m-i;
                        }
                }
                cout<<mp<<endl;
        }
}
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                           

Compiler output:
a.cc:33:1: error: expected class-name before '~' token
   33 | ~
      | ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main()
{
        int m,ni,na;
        while(cin>>m>>ni>>na,m)
        {
                vector<int> p(m);
                REP(i,m)
                {
                        cin>>p[i];
                }
                sort(p.begin(), p.end());
                int md=0,mp=ni;
                FOR(i, m-na, m-ni+1)
                {
                        if(p[i]-p[i-1]>md)
                        {
                                //cout<<md<<i<<endl;
                                md=p[i]-p[i-1];
                                mp=m-i;
                        }
                }
                cout<<mp<<endl;
        }
}
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                           

Compiler output:
a.cc:32:1: error: expected class-name before '~' token
   32 | ~
      | ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	int a,min,max,p,mmax=0,mm;
	while(1){
		mmax=0;
		cin>>a>>min>>max;
		if(a==min && min==max && a==0) break;
		for(i=0;i<a;i++){
			cin>>p;
			if(i>min && i<=max){
				if(p-mm>mmax) mmax=p-mm;
			}
			mm=p;
		}
		cout<<mmax<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'i' was not declared in this scope
    9 |                 for(i=0;i<a;i++){
      |                     ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<map>
#define scanf scanf_s
using namespace std;

int main() {
	int a, b, c;
	while (scanf("%d%d%d", &a, &b, &c), a | b | c) {
		map<int, int>e;
		for (int d = 0; d < a; d++) {
			int f;
			scanf("%d", &f);
			e[20000-f]++;
		}
		auto i = e.begin();
		i--;
		int g = 0;
		int p = 0, q = 0;
		for (auto h = e.begin();h!=i; h++) {
			g += (*h).second;
			if (g < b)continue;
			else if (g > c)break;
			auto j = h;
			j++;
			if ((*j).first - (*h).first >= p) { p = (*j).first - (*h).first; q = g; }
		}
		cout << q << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    6 | #define scanf scanf_s
      |               ^~~~~~~
a.cc:11:16: note: in expansion of macro 'scanf'
   11 |         while (scanf("%d%d%d", &a, &b, &c), a | b | c) {
      |                ^~~~~
Language: C++

#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int m, min, max;
    cin >> m >> min >> max;
    vector<int> v;
    loop(m, i) {
        int i; cin >> i;
        v.push_back(i);
    }

    int gap = 0;
    int ans = 0;
    for (int i = min; i < max; i++) {
        if (gap < v[i-1] - v[1]) {
            gap = v[i-1] - v[1];
            ans = i;
        }
    }
    cout << i << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: redeclaration of 'int i'
   17 |         int i; cin >> i;
      |             ^
a.cc:16:13: note: 'int i' previously declared here
   16 |     loop(m, i) {
      |             ^
a.cc:3:28: note: in definition of macro 'loop'
    3 | #define loop(n, i) for(int i=0;i<n;i++)
      |                            ^
a.cc:29:13: error: 'i' was not declared in this scope
   29 |     cout << i << endl;
      |             ^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
  while calc();
}

bool calc(){
  int m, nMax, nMin;
  cin >> m >> nMax >> nMin;
  if(m == 0 && nMax == 0 && nMin == 0) return false;

  int p[m];
  for(int i = 0; i < m; i++) cin >> p[i];

  sort(p, p + m);

  int maxPoint = -1;
  int index = 0;
  for(int i = m - 1; i > 0; i--){
    int calc = p[i] - p[i - 1];
    if(maxPoint <= calc){
      maxPoint = calc;
      index = i;
    }
  }

  cout << m - index << endl;
  return true;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: expected '(' before 'calc'
   11 |   while calc();
      |         ^~~~
      |         (
a.cc:11:9: error: 'calc' was not declared in this scope; did you mean 'calloc'?
   11 |   while calc();
      |         ^~~~
      |         calloc
a.cc:11:15: error: expected ')' before ';' token
   11 |   while calc();
      |         ~~~~  ^
      |               )
Language: C++

#include <stdio.h>

int main(){
	int m,na,nb,p[200];
	while(1){
		scanf("%d %d %d",&m,&na,&nb);
		if(!m) break;
		for(int i=0;i<m;i++)
			scanf("%d",&p[i]);
		int max=0;
		int ans;
		for(int i=na;i<=nb;i++){
			if(max<p[i]-p[i-1]){
				max=p[i]-p[i-1];
				ans=i;
			}
		}
		printf("%d\n",i);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:31: error: 'i' was not declared in this scope
   18 |                 printf("%d\n",i);
      |                               ^
Language: C++

#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
  int m, nmin, nmax;
  int p[201];
  int gap;
  int ans;
  while(cin>>m>>nmin>>nmax&&m&&nmin&&nmax){
    ans = -1;
    gap = -1;

    memset(p, 0, sizeof p);

    for(int i=1; i<=m; i++){
      cin >> p[i];
    }
    for(int i=nmin; i<=nmax; i++){
      if(gap<=p[i]-p[i+1]){
        gap = p[i]-p[i+1];
        ans = i;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

5 2 4
100
90
82
70
65
5 2 4
100
90
80
75
65
3 1 2
5000
4000
3000
4 2 3
10000
10000
8000
8000
4 2 3
10000
10000
10000
8000
5 2 3
100
80
68
60
45
0 0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 5 2 4
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	while(1){
		int m,n1,n2;//n2は最大人数
		cin>>m>>n1>>n2;

		if(m==0&&n1==0&&n2==0)
			break;
		
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		
		int gap=-1;
 		int n=-1;

 		for(int i=n1;i<=n2;i++){
			int g=P[i-1]-P[i];

			if(gap<=g){
				gap=g;
				n=i;
			}
		}

		cout<<n<<endl
	}
	
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: expected ';' before '}' token
   29 |                 cout<<n<<endl
      |                              ^
      |                              ;
   30 |         }
      |         ~
Language: C++

#include<iostream>
using namespace std;

int main(){
	while(1){
		int m,nmin,nmax,;
		cin>>m>>nmin>>nmax;
		if(m==0&&nmin==0&&nmax==0){
			break;
		}
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		int gap=-1;
		int n=-1;
		for(int i=nmin;i<=nmax;i++){
			int g=P[i-1]-P[i];
			if(gap<=g){
				gap=g;
				n=i;
			}
		}
		cout<<n<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:33: error: expected unqualified-id before ';' token
    6 |                 int m,nmin,nmax,;
      |                                 ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
  while(true){
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;

    if(m==0&&nmin==0&&nmax==0)
    break;

    int P[200];
    for(int i=0;i<m;i++){
      cin>>P[i];
    }
    int gap =-1;
    int n=-1;

    for(int i=nmin; i<nmax; i++){
      int g=P[i-1]P[i];

      if(gap<=g){
        gap=g;
        n=i;
      }
    }
    cout<<n<<endl;

  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: expected ',' or ';' before 'P'
   21 |       int g=P[i-1]P[i];
      |                   ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
  while(true){
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;

    if(m==0&&nmin==0&&nmax==0)
    break;

    int P[200];
    for(int i=0;i<m;i++){
      cin>>P[i];
    }
    int gap =-1;
    int n=-1;

    for(int i=nmin; i<=nmax; i++){
      int g=P[i-1]P[i];

      if(gap<=g){
        gap=g;
        n=i;
      }
    }
    cout<<n<<endl;

  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: expected ',' or ';' before 'P'
   21 |       int g=P[i-1]P[i];
      |                   ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		int gap=0;
		int n=0;
		int P[m];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		for(int i=nmin-1,i<nmax-1,i++){
			if(P[i]-P[i+1]>=gap){
				gap=P[i]-P[i+1];
				n=i;
			}
		}
		cout<<n<<endl;
		
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: expected ';' before '<' token
   14 |                 for(int i=nmin-1,i<nmax-1,i++){
      |                                   ^
      |                                   ;
a.cc:14:35: error: expected primary-expression before '<' token
a.cc:14:46: error: expected ';' before ')' token
   14 |                 for(int i=nmin-1,i<nmax-1,i++){
      |                                              ^
      |                                              ;
Language: C++

#include <iostream>
using namespace std;

int main(){
	while (ture) {
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;

		if (m==0&&&nmin==0&&nmax==0) break;

		int P[200];
		for (int i = 0; i < m; i++) {
			cin>>P[i];
		}

		int gap=-1;
		int n=-1;

		for (int i = 0; i < m; i++) {
			int g=P[i-1]-P[i];

			if(gap<=g){
				gap=g;
				n=il;
			}
		}
		cout<<n<<endl;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: 'ture' was not declared in this scope
    5 |         while (ture) {
      |                ^~~~
a.cc:24:35: error: 'il' was not declared in this scope; did you mean 'i'?
   24 |                                 n=il;
      |                                   ^~
      |                                   i
Language: C++

#include<iostream>
using namespace std;

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m=0)
			break
		int gap=0;
		int n=0;
		int P[m];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		for(int i=nmin-1;i<nmax-1;i++){
			if(P[i]-P[i+1]>=gap){
				gap=P[i]-P[i+1];
				n=i;
			}
		}
		cout<<n<<endl;
		
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:30: error: expected ';' before 'int'
    9 |                         break
      |                              ^
      |                              ;
   10 |                 int gap=0;
      |                 ~~~
Language: C++

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


int a[10000]={};

void sw(int n){
for(int g=0;g<2n;g++){
for(int i=0;i<n-1;i++){
if(a[i]<a[i+1]){swap(a[i],a[i+1]);}
}}}

int main(){
int m,mi,mx,al=0;
while(cin>>m){
int b[10000]
cin>>mi>>mx;
for(int h=0;h<m;h++){
cin>>a[i];
}
sw(m);
for(i=mx;i>=mi;i--){
b[i]=a[i]-a[i-1];}
for(q=mx;q>=mi;i--){
if(b[q]>al){al=b[q]; am=q;}
}
cout<<am<<endl;
}

return 0;
}


Compiler output:
a.cc: In function 'void sw(int)':
a.cc:8:15: error: unable to find numeric literal operator 'operator""n'
    8 | for(int g=0;g<2n;g++){
      |               ^~
a.cc: In function 'int main()':
a.cc:17:1: error: expected initializer before 'cin'
   17 | cin>>mi>>mx;
      | ^~~
a.cc:19:8: error: 'i' was not declared in this scope
   19 | cin>>a[i];
      |        ^
a.cc:22:5: error: 'i' was not declared in this scope; did you mean 'mi'?
   22 | for(i=mx;i>=mi;i--){
      |     ^
      |     mi
a.cc:23:1: error: 'b' was not declared in this scope
   23 | b[i]=a[i]-a[i-1];}
      | ^
a.cc:24:5: error: 'q' was not declared in this scope
   24 | for(q=mx;q>=mi;i--){
      |     ^
a.cc:24:16: error: 'i' was not declared in this scope; did you mean 'mi'?
   24 | for(q=mx;q>=mi;i--){
      |                ^
      |                mi
a.cc:25:4: error: 'b' was not declared in this scope
   25 | if(b[q]>al){al=b[q]; am=q;}
      |    ^
a.cc:25:22: error: 'am' was not declared in this scope; did you mean 'al'?
   25 | if(b[q]>al){al=b[q]; am=q;}
      |                      ^~
      |                      al
a.cc:27:7: error: 'am' was not declared in this scope; did you mean 'al'?
   27 | cout<<am<<endl;
      |       ^~
      |       al
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int m,min,nmax;
    while(cin >> m >> nmin >> nmax){
        if(m == 0) return 0;
        int mx = 0,ans = 0,a[m+5];
        for(int i = 1;i<=m;i++) cin >> a[i];
        for(int i = nmin;i<=nmax;i++){
            if(a[i]-a[i+1] >= mx) mx = a[i]-a[i-1],ans = i;
        }
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:23: error: 'nmin' was not declared in this scope; did you mean 'min'?
    5 |     while(cin >> m >> nmin >> nmax){
      |                       ^~~~
      |                       min
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int m, n_min, n_max, p;
 
    while (cin>>m>>n_min>>n_max, m||n_min||n_max) {
        vector<int> v;
        for (int i = 0; i < m; ++i) {
            cicodn>>p;
            v.push_back(p);
        }
        sort(v.begin(), v.end(), greater<int>());
        int diff = 0;
        int ans = 0;
        for (int i = n_max - 1; i >= n_min - 1; --i) {
            if (v[i] - v[i+1] > diff) {
                diff = v[i] - v[i+1];
                ans = i;
            }
        }
        cout<<ans+1<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:18:13: error: 'cicodn' was not declared in this scope
   18 |             cicodn>>p;
      |             ^~~~~~
Language: C++

#include <iostream>

#define REP(i, n) for (int i = 0; i < n; i++)
#define debug(x) cerr << #x << " = " << (x) << endl;

using namespace std;

int main() {
  while (1) {
    int m, nmin, nmax, p[202], ans, maxgap;
    maxgap = -1;
    cin >> m >> nmin >> nmax;
		if (m==0 && nmin==0 && nmax==0) break;
    REP(i, m) cin >> p[i];
    sort(p, p + m);
    for (int i = m - nmax; i <= m - nmin; i++) {
      if (p[i] - p[i - 1] > maxgap) {
        ans = m - i;
        maxgap = p[i] - p[i - 1];
      }
    }
    cout << ans << endl;
  }
	return 0;
}



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

package test;

import java.util.Scanner;
public class ACM3{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		while(true) {
			n=sc.nextInt();
			if(n==0)break;
			int ans[] = new int[n];
			String test;

			for(int i=0;i<n;i++) {
				test  = sc.next();
				ans[i] = test.length();
			}

			boolean flag[] = new boolean[5];


			for(int i=0;i<n;i++) {
				int f1=0,f2=0,f3=0,f4=0,f5=0;
				int ansdata = 0;

				while(ansdata<=5) {
					ansdata += ans[i+f1];
					f1++;
					if(ansdata==5) {
						flag[0]=true;
						break;
					}
				}

				ansdata=0;
				while(ansdata<=7) {
					ansdata += ans[i+f1+f2];
					f2++;
					if(ansdata==7) {
						flag[1]=true;
						break;
					}
				}

				ansdata =0;
				while(ansdata<=5) {
					ansdata += ans[i+f1+f2+f3];
					f3++;
					if(ansdata==5) {
						flag[2]=true;
						break;
					}
				}


				ansdata=0;
				while(ansdata<=7) {
					ansdata += ans[i+f1+f2+f3+f4];
					f4++;
					if(ansdata==7) {
						flag[3]=true;
						break;
					}
				}


				ansdata=0;
				while(ansdata<=7) {
					ansdata += ans[i+f1+f2+f3+f4+f5];
					f5++;
					if(ansdata==7) {
						flag[4]=true;
						break;
					}
				}




				if(flag[0]&&flag[1]&&flag[2]&&flag[3]&&flag[4]) {
					System.out.println((i+1));
					for(int j=0;j<5;j++)flag[j]= false;
					f1=0;f2=0;f3=0;f4=0;f5=0;
					break;
				}else {
					for(int j=0;j<5;j++)flag[j]= false;
					f1=0;f2=0;f3=0;f4=0;f5=0;
				}


			}




		}

		sc.close();
	}
}


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

#define f(X) for(c=0;c<X;c+=v[p++]);if(c-X)goto L;
main(n,v[50],s,p,c){for(;scanf("%d",&n),n;){for(s=0;s<n;)v[++s]=strlen(gets());s=0;L:p=++s;f(5)f(7)f(5)f(7)f(7)printf("%d\n",s);}}

Compiler output:
main.c:2:9: error: expected ')' before '[' token
    2 | main(n,v[50],s,p,c){for(;scanf("%d",&n),n;){for(s=0;s<n;)v[++s]=strlen(gets());s=0;L:p=++s;f(5)f(7)f(5)f(7)f(7)printf("%d\n",s);}}
      |         ^
      |         )
Language: C

#include<bits/stdc++.h>
main(){for(char s[50],i,j,p,q;p=atoi(gets(s));printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}

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

main(){puts("hoge");}

Compiler output:
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | main(){puts("hoge");}
      | ^~~~
a.cc: In function 'int main()':
a.cc:1:8: error: 'puts' was not declared in this scope
    1 | main(){puts("hoge");}
      |        ^~~~
Language: C++

s[50],i,j,p,q;
main(n){for(;n=atoi(gets(s)),n;printf("%d\n",i)){
for(i=0;i<n;s[i++]=strlen(gets(s+i)));
for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);
}}

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s[50],i,j,p,q;
      | ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(n){for(;n=atoi(gets(s)),n;printf("%d\n",i)){
      |     ^
Language: C++

s[50],j,p,q;main(i){for(;p=atoi(gets(s));printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s[50],j,p,q;main(i){for(;p=atoi(gets(s));printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}
      | ^
a.cc:1:17: error: expected constructor, destructor, or type conversion before '(' token
    1 | s[50],j,p,q;main(i){for(;p=atoi(gets(s));printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}
      |                 ^
Language: C++

i,j,k,L[99];main(n){for(;scanf("%d",&n)*n;i=j=k=!printf("%d\n",j)){for(;n--;scanf("%*s%n",L+i++));for(;k<7;)for(n=j++,k=i=1;i>0;)for(i=k++>5?0:k-2&&k-4?8:6;i>1;i-=L[n++]);}}

Compiler output:
a.cc:1:1: error: 'i' does not name a type
    1 | i,j,k,L[99];main(n){for(;scanf("%d",&n)*n;i=j=k=!printf("%d\n",j)){for(;n--;scanf("%*s%n",L+i++));for(;k<7;)for(n=j++,k=i=1;i>0;)for(i=k++>5?0:k-2&&k-4?8:6;i>1;i-=L[n++]);}}
      | ^
a.cc:1:17: error: expected constructor, destructor, or type conversion before '(' token
    1 | i,j,k,L[99];main(n){for(;scanf("%d",&n)*n;i=j=k=!printf("%d\n",j)){for(;n--;scanf("%*s%n",L+i++));for(;k<7;)for(n=j++,k=i=1;i>0;)for(i=k++>5?0:k-2&&k-4?8:6;i>1;i-=L[n++]);}}
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define f(X) for(c=0;c<X;c+=v[p--]);if(c-X)goto L;
main(){for(char n,v[99],s,p,c;p=s=n=atoi(gets(v));){for(;p;v[p--]=strlen(gets(v+70)));L:p=s--;f(5)f(7)f(5)f(7)f(7)puts(itoa(n-s));}}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){for(char n,v[99],s,p,c;p=s=n=atoi(gets(v));){for(;p;v[p--]=strlen(gets(v+70)));L:p=s--;f(5)f(7)f(5)f(7)f(7)puts(itoa(n-s));}}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:42: error: 'gets' was not declared in this scope; did you mean 'getw'?
    3 | main(){for(char n,v[99],s,p,c;p=s=n=atoi(gets(v));){for(;p;v[p--]=strlen(gets(v+70)));L:p=s--;f(5)f(7)f(5)f(7)f(7)puts(itoa(n-s));}}
      |                                          ^~~~
      |                                          getw
a.cc:3:120: error: 'itoa' was not declared in this scope
    3 | main(){for(char n,v[99],s,p,c;p=s=n=atoi(gets(v));){for(;p;v[p--]=strlen(gets(v+70)));L:p=s--;f(5)f(7)f(5)f(7)f(7)puts(itoa(n-s));}}
      |                                                                                                                        ^~~~
Language: C++

s[50],j,p,q;
main(i){for(;p=atoi(gets(s));printf("%d\n",i)){
for(i=0;i<p;s[i++]=strlen(gets(s+i)));
for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=(0x886860>>j++*4)&15;q>1;q-=s[p++]);
}}

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s[50],j,p,q;
      | ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(i){for(;p=atoi(gets(s));printf("%d\n",i)){
      |     ^
Language: C++

*s,j,p,q;
main(i,j){for(s=j;p=j=atoi(gets(s));printf("%d\n",i)){
for(;j;s[p-j--]=strlen(gets(s+p)));
for(i=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=8939616>>j++*4&15;q>1;q-=s[p++]);
}}

Compiler output:
a.cc:1:3: error: expected constructor, destructor, or type conversion before ',' token
    1 | *s,j,p,q;
      |   ^
a.cc:1:5: error: expected constructor, destructor, or type conversion before ',' token
    1 | *s,j,p,q;
      |     ^
a.cc:1:7: error: expected constructor, destructor, or type conversion before ',' token
    1 | *s,j,p,q;
      |       ^
a.cc:1:9: error: expected constructor, destructor, or type conversion before ';' token
    1 | *s,j,p,q;
      |         ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(i,j){for(s=j;p=j=atoi(gets(s));printf("%d\n",i)){
      |     ^
Language: C++

v[50],p,n,k,X;main(s){for(;n=atoi(gets(v));printf("%d\n",s)){for(p=s=0;p<n;v[++p]=strlen(gets(v+n)));for(;n;)for(n=0,p=++s,k=261096;k/=8;n+=X)for(X=k&7;X>0;X-=v[p++]);}}

Compiler output:
a.cc:1:1: error: 'v' does not name a type
    1 | v[50],p,n,k,X;main(s){for(;n=atoi(gets(v));printf("%d\n",s)){for(p=s=0;p<n;v[++p]=strlen(gets(v+n)));for(;n;)for(n=0,p=++s,k=261096;k/=8;n+=X)for(X=k&7;X>0;X-=v[p++]);}}
      | ^
a.cc:1:19: error: expected constructor, destructor, or type conversion before '(' token
    1 | v[50],p,n,k,X;main(s){for(;n=atoi(gets(v));printf("%d\n",s)){for(p=s=0;p<n;v[++p]=strlen(gets(v+n)));for(;n;)for(n=0,p=++s,k=261096;k/=8;n+=X)for(X=k&7;X>0;X-=v[p++]);}}
      |                   ^
Language: C++

9
do
the
best
and
enjoy
today
at
acm
icpc
14
oh
yes
by
far
it
is
wow
so
bad
to
me
you
know
hey
15
abcde
fghijkl
mnopq
rstuvwx
yzz
abcde
fghijkl
mnopq
rstuvwx
yz
abcde
fghijkl
mnopq
rstuvwx
yz
0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 9
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string s;
	while(cin>>n,n){
		int a[40]={0},j=0,i=0,c,k=0;
		cout<<b[3];
		for(;j<n;j++){
			cin>>s;
			a[i++]=s.size();
		}
		for(j=0;j<35;j++){
			int b[4]={0};
			c=0;
		for(i=j;i<40;i++){
			c+=a[i];
			if(c==5)b[0]++;
			else if(b[0]&&c==12)b[1]++;
			else if(b[1]&&c==17)b[2]++;
			else if(b[2]&&c==24)b[3]++;
			else if(b[3]&&c==31){
				k=j;
				break;
			}
			if(!b[0]&&c>5)break;
		}if(k)break;
	    }
	    
		cout<<k+1<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: 'b' was not declared in this scope
    8 |                 cout<<b[3];
      |                       ^
Language: C++

#include <iostream>
using namespace???std;
int main(){
  int a[]={5,7,5,7,7},n,i,j,c,k;
  while(cin>>n,n){
    string s[n];
    for(i=0;i<n;i++)cin>>s[i];
    for(i=0;i<n;i++){
      c=k=0;
      for(j=i;j<n;j++){
        c+=s[j].size();
        if(c==a[k]){
          c=0;
          if(++k==5)goto L:
        }
      }
    }
    L: if(k==5)cout<<i<<endl;
  }
}

Compiler output:
a.cc:2:16: error: expected identifier before '?' token
    2 | using namespace???std;
      |                ^
a.cc:2:16: error: expected ';' before '?' token
    2 | using namespace???std;
      |                ^
      |                ;
a.cc:2:16: error: expected unqualified-id before '?' token
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   while(cin>>n,n){
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:5: error: 'string' was not declared in this scope
    6 |     string s[n];
      |     ^~~~~~
a.cc:6:5: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:26: error: 's' was not declared in this scope
    7 |     for(i=0;i<n;i++)cin>>s[i];
      |                          ^
a.cc:11:12: error: 's' was not declared in this scope
   11 |         c+=s[j].size();
      |            ^
a.cc:14:27: error: expected ';' before ':' token
   14 |           if(++k==5)goto L:
      |                           ^
      |                           ;
a.cc:14:27: error: expected primary-expression before ':' token
a.cc:18:16: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |     L: if(k==5)cout<<i<<endl;
      |                ^~~~
      |                std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:18:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   18 |     L: if(k==5)cout<<i<<endl;
      |                         ^~~~
      |                         std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void){
    int n;
    vector<string> w(n);
    while(true){
        cin >>n;
        if(n==0) break;
        for(int i=0;i<n;i++)
        cin >> w[i];
        int tanku[5]={5,7,5,7,7};
        bool judge=false;
        //?§??????????
        for(int i=0;i<n;i++){
            int place=i;
            //tanku ibannme
            for(int j=0;j<5;j++){
    int sum=0;
    //kasan
    while(place<n){
        sum+=w[place].size();
        place++;
        if(spum>=tanku[j])
        break;
    }if(sum>tanku[j])
    break;
    if(j==4&&sum==tanku[4]){
            cout << i+1 << endl;
            judge=true;
            break;
        }
            }
            if(judge)
break;
        }
    }
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: 'spum' was not declared in this scope; did you mean 'sum'?
   25 |         if(spum>=tanku[j])
      |            ^~~~
      |            sum
Language: C++

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

int main(){
	while(true){
		int n;
		cin>>n;
		
		if(n==0)
			break;
		
	int len[40];
	for(int i=0;i<n;i++){
		string w;
		cin>>w;
		
		len[i] = w.size();
	}

	for(int i=0;i<n;i++){
		bool flg=false;
		int sta;
		int sum=0;
		
		for(int j=i;j<n;j++){
			sum += len[j];
	
			if(sum==5||sum=12||sum==17||sum==24||sum==31){
				sta++;
			}
			if(sta==5){
				flg=true;
				break;
			}
			else if(sum>=31){
				break;
			}
		}

		if(flg){
			cout<<i+1<<endl;
			break;
		}
	}

	}
	return 0;
	}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:34: error: lvalue required as left operand of assignment
   29 |                         if(sum==5||sum=12||sum==17||sum==24||sum==31){
      |                            ~~~~~~^~~~~
Language: C++

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

int main(){
	while(true){
		int n;
		cin>>n;
		
		if(n==0)
			break;
		
	int len[40];
	for(int i=0;i<n;i++){
		string w;
		cin>>w;
		
		len[i] = w.size();
	}

	for(int i=0;i<n;i++){
		bool flg=false;
		int sta=0;
		int sum=0;
		
		for(int j=i;j<n;j++){
			sum += len[j];
	
			if(sum==5||sum=12||sum==17||sum==24||sum==31){
				sta++;
			}
			if(sta==5){
				flg=true;
				break;
			}
			else if(sum>=31){
				break;
			}
		}

		if(flg){
			cout<<i+1<<endl;
			break;
		}
	}

	}
	return 0;
	}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:34: error: lvalue required as left operand of assignment
   29 |                         if(sum==5||sum=12||sum==17||sum==24||sum==31){
      |                            ~~~~~~^~~~~
Language: C++

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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0){
			break;
		}
		int len[40];
		for(int i=0;i<n;i++){
			string w;
			cin>>w;
			len[i]=w.size();
		}
		for(int j=i;j<n;j++){
			sum+=len[j];
			if(sum==5||sum==12||sum==17||sum==24||sum==31){
				sta++;
			}
			if(sta==5){
				flg=true;
				break;
			}else if(sum>=31){
				break;
			}
		}
		if(flg){
			cout<<i+1<<endl;
			break;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: 'i' was not declared in this scope
   18 |                 for(int j=i;j<n;j++){
      |                           ^
a.cc:19:25: error: 'sum' was not declared in this scope
   19 |                         sum+=len[j];
      |                         ^~~
a.cc:21:33: error: 'sta' was not declared in this scope; did you mean 'std'?
   21 |                                 sta++;
      |                                 ^~~
      |                                 std
a.cc:23:28: error: 'sta' was not declared in this scope; did you mean 'std'?
   23 |                         if(sta==5){
      |                            ^~~
      |                            std
a.cc:24:33: error: 'flg' was not declared in this scope
   24 |                                 flg=true;
      |                                 ^~~
a.cc:30:20: error: 'flg' was not declared in this scope
   30 |                 if(flg){
      |                    ^~~
a.cc:31:31: error: 'i' was not declared in this scope
   31 |                         cout<<i+1<<endl;
      |                               ^
Language: C++

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

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

  if(n==0) break;

  int len[n];
  for(int i=0; i<n; i++){
   string w;
   cin >> w;
   len[i] = w.size();
  }

  for(int i=0; i<n; i++){
   bool flag = false;
   int sta = 0; //区切り
   int sum = 0; //文字数の合計

   for(int j=i; j<n; j++){
    sum = sum + len[j];
    
    if(sum==5 || sum==12 || sum==17 || sum==24 || sum==31){
     sta++;
    }

    if(sta==5){
     flg = true;
     break;
    }else if(sum>=31){
     break;
    }
   }

   if(flg){
    cout << i+1 << endl;
   }
  }
 }

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:6: error: 'flg' was not declared in this scope; did you mean 'flag'?
   32 |      flg = true;
      |      ^~~
      |      flag
a.cc:39:7: error: 'flg' was not declared in this scope; did you mean 'flag'?
   39 |    if(flg){
      |       ^~~
      |       flag
Language: C++

def main():
    while True:
        n = int(input().strip())

        if n == 0:
            break

        phrases = []
        for _ in range(n):
            word = input().strip()
            phrases.append(word)

        PHRASE_LEN = [5,7,5,7,7]
        found_flag = False

        for i in range(n):
            acc_len = 0
            phrase_idx = 0
            for j in range(i, n):
                acc_len += len(phrases[j])

                if acc_len == PHRASE_LEN[phrase_idx]:
                    if phrase_idx == (len(PHRASE_LEN)-1):
                        found_flag = True
                        break

                    acc_len = 0
                    phrase_idx += 1
                elif acc_len > PHRASE_LEN[phrase_idx]:
                    break

            if found_flag:
                print(i+1)
                break

if __name__ == "__main__":
    main()



Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def main():
      | ^~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int make(int w,int p);

vector<string> a(50);

void main(void){
  int n;
  scanf ("%d",&n);
  while(n){

    for(int t=0;t<n;t++){
      //scanf ("%s",a[t]);
      cin >> a[t];
    }
    for(int t=n;t<50;t++){
      //scanf ("%s",a[t]);
      a[t]="";
    }
    int end=0;
    int k=0;
    for(k=0;k<n;k++){
      int q=k;
      if(make(q,5)>=1){
        q=1+make(q,5);
        if(make(q,7)>=1){
          q=1+make(q,7);
          if(make(q,5)>=1){
            q=1+make(q,5);
            if(make(q,7)>=1){
              q=1+make(q,7);
              if(make(q,7)>=1){
                end=1;
                //printf("qwqw\n");
              }
            }
          }
        }
      }
      if(end==1) break;
    }
    k++;
    printf("%d\n",k);
    scanf ("%d",&n);
  }
}


int make(int w,int p){
  int l=a[w].size();
  if(l==p){
    return w;
  }
  else{
    if(l<p){
      //printf("%d\n",r);
      return make(w+1,p-l);
    }
    else{
      return -1;
    }
  }
}



Compiler output:
a.cc:10:1: error: '::main' must return 'int'
   10 | void main(void){
      | ^~~~
Language: C++

#include <iostream>
using namespace std;

const int step[5] = {5, 7, 5, 7, 7};

int N;
string S[40];

int solve() {
    for (int i = 0; i < N; ++i) {
        bool ok = true;
        int idx = i;
        for (int t = 0; t < 5; ++t) {
            int acc = 0;
            while (acc < step[t]) acc += S[idx++].size();
            if (acc != step[t]) {
                ok = false;
                break;
            }
        }
        if (ok)
            return i+1;
    }

    assert(false);
}

int main(void) {
    while (true) {
        cin >> N;
        if (N == 0) break;
        for (int i = 0; i < N; ++i)
            cin >> S[i];

        cout << solve() << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int solve()':
a.cc:25:5: error: 'assert' was not declared in this scope
   25 |     assert(false);
      |     ^~~~~~
a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    1 | #include <iostream>
  +++ |+#include <cassert>
    2 | using namespace std;
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
#include <ctype.h>
using namespace std;

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl
// vector
template<class T> ostream& operator << (ostream &os , const vector<T> &v) {
    for(const T &t : v) os << "\t" << t; return os << endl;
}
template<class T> istream& operator >> (istream &is , vector<T> &v) {
    for(T &a : v) is >> a; return is;
}
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) {
    return os << "<" << v.first << " " << v.second << ">";
}

int calc_depth(string &s) {
    rep(i, s.size()) if(s[i] != '.') return i;
    assert(0);
}

int calc(vector<string> &line, int &now, int depth) {
    char c = line[now].back();
    if(isdigit(c)) {
        now++;
        return c - '0';
    } else {
        function<int(int, int)> f;
        int ret;
        if(c == '+') {
            f = [](int a, int b) { return a + b; };
            ret = 0;
        } else if(c == '*') {
            f = [](int a, int b) { return a * b; };
            ret = 1;
        } else assert(0);
        now++;
        
        while(now < line.size() and calc_depth(line[now]) > depth) {
            ret = f(ret, calc(line, now, depth + 1));
        }
        return ret;
    }
}


bool solve() {
    int n; cin >> n;
    if(n == 0) return 0;
    vector<string> line(n); cin >> line;
    int i = 0;
    cout << calc(line, i, 0) << endl;
    return 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}

Compiler output:
a.cc: In function 'int calc(std::vector<std::__cxx11::basic_string<char> >&, int&, int)':
a.cc:47:9: error: 'function' was not declared in this scope
   47 |         function<int(int, int)> f;
      |         ^~~~~~~~
a.cc:15:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
   14 | #include<numeric>
  +++ |+#include <functional>
   15 | #include <ctype.h>
a.cc:47:30: error: expression list treated as compound expression in functional cast [-fpermissive]
   47 |         function<int(int, int)> f;
      |                              ^
a.cc:47:18: error: expected primary-expression before 'int'
   47 |         function<int(int, int)> f;
      |                  ^~~
a.cc:50:13: error: 'f' was not declared in this scope
   50 |             f = [](int a, int b) { return a + b; };
      |             ^
a.cc:53:13: error: 'f' was not declared in this scope
   53 |             f = [](int a, int b) { return a * b; };
      |             ^
a.cc:59:19: error: 'f' was not declared in this scope
   59 |             ret = f(ret, calc(line, now, depth + 1));
      |                   ^
Language: C++

#include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl
// vector
template<class T> ostream& operator << (ostream &os , const vector<T> &v) {
    for(const T &t : v) os << "\t" << t; return os << endl;
}
template<class T> istream& operator >> (istream &is , vector<T> &v) {
    for(T &a : v) is >> a; return is;
}
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) {
    return os << "<" << v.first << " " << v.second << ">";
}

int calc_depth(string &s) {
    rep(i, s.size()) if(s[i] != '.') return i;
    assert(0);
}

int calc(vector<string> &line, int &now, int depth) {
    char c = line[now].back();
    if(isdigit(c)) {
        now++;
        return c - '0';
    } else {
        function<int(int, int)> f;
        int ret;
        if(c == '+') {
            f = [](int a, int b) { return a + b; };
            ret = 0;
        } else if(c == '*') {
            f = [](int a, int b) { return a * b; };
            ret = 1;
        } else assert(0);
        now++;
        
        while(now < line.size() and calc_depth(line[now]) > depth) {
            ret = f(ret, calc(line, now, depth + 1));
        }
        return ret;
    }
}


bool solve() {
    int n; cin >> n;
    if(n == 0) return 0;
    vector<string> line(n); cin >> line;
    int i = 0;
    cout << calc(line, i, 0) << endl;
    return 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}

Compiler output:
a.cc: In function 'int calc(std::vector<std::__cxx11::basic_string<char> >&, int&, int)':
a.cc:40:9: error: 'function' was not declared in this scope
   40 |         function<int(int, int)> f;
      |         ^~~~~~~~
a.cc:9:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
    8 | #include<cmath>
  +++ |+#include <functional>
    9 | using namespace std;
a.cc:40:30: error: expression list treated as compound expression in functional cast [-fpermissive]
   40 |         function<int(int, int)> f;
      |                              ^
a.cc:40:18: error: expected primary-expression before 'int'
   40 |         function<int(int, int)> f;
      |                  ^~~
a.cc:43:13: error: 'f' was not declared in this scope
   43 |             f = [](int a, int b) { return a + b; };
      |             ^
a.cc:46:13: error: 'f' was not declared in this scope
   46 |             f = [](int a, int b) { return a * b; };
      |             ^
a.cc:52:19: error: 'f' was not declared in this scope
   52 |             ret = f(ret, calc(line, now, depth + 1));
      |                   ^