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

#include <iostream>
#include <stdlib.h>
using namespace std;

int main() {
  int N;
  string str;
  int result = 0;

  while (cin >> N) {
    for (int i = 0; i < (int)str.size(); ++i) {
      char ch = str[i];
      if (ch != ' ') {
        int k = atoi(ch);
        if (k >= 2) {
          result++;
        }
      }
    }
  }

  if (result == 0) {
    cout << "NA" <<endl;
  } else {
    cout << result;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   14 |         int k = atoi(ch);
      |                      ^~
      |                      |
      |                      char
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
	while(true){
{
	int N; 
	cin>>N;
	if(N==0)break;
	int count=0;
	bool na=true;
	for(int i=0;i<N;i++){
		int k;
		cin>>k;
		if(k>1)na=false;
		if(k>0)count++;
	}
	if(na==true)
		cout<<"NA"<<endl;
	else
		cout<<count+1<<endl;
}
return 0;
	}

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

#include<iostream>

using namespace std;

int main(){

	int n;
	int k[10000];
	int i=0;
	int j=0;
	int min=0;
	int not=0;
	int result[10000];

	for(j=0;true;j++){
	
		min=0;
		not=0;
	
		cin>>n;
		
		if(n==0){
			break;
		}

		for(i=0;i<n;i++){
			cin>>k[i];
		
			if(k[i]!=0){
				min+=1;
			}
			if((k[i]==1)||(k[i]==0)){
				not+=1;
			}
		
			if(not==n){
				result[j]=-1;
			}else{
				result[j]=min+1;
			}
		}
	}
	
	for(i=0;i<j;i++){
		if(result[i]==-1){
			cout<<"NA";
		}else{
			cout<<result[i];
	        }
		
		if(i+1!=j){
			cout<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: expected unqualified-id before 'not' token
   12 |         int not=0;
      |             ^~~
a.cc:18:20: error: expected primary-expression before '=' token
   18 |                 not=0;
      |                    ^
a.cc:33:36: error: expected primary-expression before '+=' token
   33 |                                 not+=1;
      |                                    ^~
a.cc:36:31: error: expected primary-expression before '==' token
   36 |                         if(not==n){
      |                               ^~
Language: C++

#include <iostream>

int temp[10000];
int main(){
	for(true){
		int n; cin >> n;
		if(n == 0) return 0;
		for(int i = 0; i < n; i++){
			cin >> temp[i];
		}
		int cont = 0;
		for(int i = 0; i < 2; i++){
			if(temp[i] > 0){
				temp[i]--;
				cont++;
				if(i == 1){
					cout << endl; 
					break;
				}
			}
		}
		cout << "NA" << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before ')' token
    5 |         for(true){
      |                 ^
      |                 ;
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
a.cc:23:10: error: expected ';' before '}' token
   23 |         }
      |          ^
      |          ;
   24 | }
      | ~         
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
a.cc:23:10: error: expected ')' before '}' token
   23 |         }
      |          ^
      |          )
   24 | }
      | ~         
a.cc:5:12: note: to match this '('
    5 |         for(true){
      |            ^
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int temp[10000];
int main(){
	for(true){
		int n; cin >> n;
		if(n == 0) return 0;
		for(int i = 0; i < n; i++){
			cin >> temp[i];
		}
		int cont = 0;
		for(int i = 0; i < 2; i++){
			if(temp[i] > 0){
				temp[i]--;
				cont++;
				if(i == 1){
					cout << endl; 
					break;
				}
			}
		}
		cout << "NA" << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before ')' token
    5 |         for(true){
      |                 ^
      |                 ;
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
a.cc:23:10: error: expected ';' before '}' token
   23 |         }
      |          ^
      |          ;
   24 | }
      | ~         
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
a.cc:23:10: error: expected ')' before '}' token
   23 |         }
      |          ^
      |          )
   24 | }
      | ~         
a.cc:5:12: note: to match this '('
    5 |         for(true){
      |            ^
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int temp[10000];
int main(){
	for(true){
		int n; cin >> n;
		if(n == 0) return 0;
		for(int i = 0; i < n; i++){
			cin >> temp[i];
		}
		int cont = 0;
		for(int i = 0; i < 2; i++){
			if(temp[i] > 0){
				temp[i]--;
				cont++;
				if(i == 1){
					cout << endl; 
					break;
				}
			}
		}
		cout << "NA" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before ')' token
    5 |         for(true){
      |                 ^
      |                 ;
a.cc:24:9: error: expected primary-expression before 'return'
   24 |         return 0;
      |         ^~~~~~
a.cc:23:10: error: expected ';' before 'return'
   23 |         }
      |          ^
      |          ;
   24 |         return 0;
      |         ~~~~~~
a.cc:24:9: error: expected primary-expression before 'return'
   24 |         return 0;
      |         ^~~~~~
a.cc:23:10: error: expected ')' before 'return'
   23 |         }
      |          ^
      |          )
   24 |         return 0;
      |         ~~~~~~
a.cc:5:12: note: to match this '('
    5 |         for(true){
      |            ^
Language: C++

#include<bits/stdc++.h>
??
using namespace std;
??
??
int main() {
??
????int n;
????while( cin >> n, n ) {
????????int cnt = 0,v;
    bool flag = false;
????????for(int i=0;i<n;++i) {
????????????cin >> v;
????????????if( v >= 2 ) flag = true;
      if( v >= 1 ) ++cnt;
????????}
????????if( !flag ) puts("NA");
????????else cout << cnt + 1 << endl;
????}
????return 0;
}

Compiler output:
a.cc:2:1: error: expected unqualified-id before '?' token
    2 | ??
      | ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
??int n;
??while( cin >> n, n ) {
??????int cnt = 0,v;
   bool flag = false;
??????for(int i=0;i<n;++i) {
??????????cin >> v;
??????????if( v >= 2 ) flag = true;
     if( v >= 1 ) ++cnt;
??????}
??????if( !flag ) puts("NA");
??????else cout << cnt + 1 << endl;
??}
??return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:1: error: expected primary-expression before '?' token
    4 | ??int n;
      | ^
a.cc:4:2: error: expected primary-expression before '?' token
    4 | ??int n;
      |  ^
a.cc:4:3: error: expected primary-expression before 'int'
    4 | ??int n;
      |   ^~~
a.cc:4:3: error: expected ':' before 'int'
    4 | ??int n;
      |   ^~~
      |   :
a.cc:4:3: error: expected primary-expression before 'int'
    4 | ??int n;
      |   ^~~
a.cc:4:3: error: expected ':' before 'int'
    4 | ??int n;
      |   ^~~
      |   :
a.cc:4:3: error: expected primary-expression before 'int'
    4 | ??int n;
      |   ^~~
a.cc:5:1: error: expected primary-expression before '?' token
    5 | ??while( cin >> n, n ) {
      | ^
a.cc:5:2: error: expected primary-expression before '?' token
    5 | ??while( cin >> n, n ) {
      |  ^
a.cc:5:3: error: expected primary-expression before 'while'
    5 | ??while( cin >> n, n ) {
      |   ^~~~~
a.cc:5:3: error: expected ':' before 'while'
    5 | ??while( cin >> n, n ) {
      |   ^~~~~
      |   :
a.cc:5:3: error: expected primary-expression before 'while'
    5 | ??while( cin >> n, n ) {
      |   ^~~~~
a.cc:5:3: error: expected ':' before 'while'
    5 | ??while( cin >> n, n ) {
      |   ^~~~~
      |   :
a.cc:5:3: error: expected primary-expression before 'while'
    5 | ??while( cin >> n, n ) {
      |   ^~~~~
a.cc:16:1: error: expected primary-expression before '?' token
   16 | ??return 0;
      | ^
a.cc:16:2: error: expected primary-expression before '?' token
   16 | ??return 0;
      |  ^
a.cc:16:3: error: expected primary-expression before 'return'
   16 | ??return 0;
      |   ^~~~~~
a.cc:16:3: error: expected ':' before 'return'
   16 | ??return 0;
      |   ^~~~~~
      |   :
a.cc:16:3: error: expected primary-expression before 'return'
   16 | ??return 0;
      |   ^~~~~~
a.cc:16:3: error: expected ':' before 'return'
   16 | ??return 0;
      |   ^~~~~~
      |   :
a.cc:16:3: error: expected primary-expression before 'return'
   16 | ??return 0;
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main() {
int n;
while(cin>>n,n){
int cnt=0,v;
bool f = false;
for(int i=0;i<n;++i) {
cin >> v;
if( v >= 2) f = true;
if( v ) ++cnt;
}
if(!flag)puts("NA");
else cout << cnt + 1 << endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'flag' was not declared in this scope
   15 | if(!flag)puts("NA");
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

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

		int cnt0=0;
		int cnt1=0;

		for(int i=0;i<N;i++){
			int k;
			cin>>k;

			if(k==0)
				cnt0++;
			else if(k==1)
				cnt1++;
		}
	
		if(b<5){
			b=5;
		}
		if(p<2){
			p=2;
		}

		if(cnt0+cnt1==N){
			cout<<"NA"<<endl;
		}
		else{
			cout<<N-cnt0+1<<endl;
		}
	}

		return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:20: error: 'b' was not declared in this scope
   25 |                 if(b<5){
      |                    ^
a.cc:28:20: error: 'p' was not declared in this scope
   28 |                 if(p<2){
      |                    ^
Language: C++

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

int main() {
	int n;
	while (cin >> n && n != 0) {
		bool na = false;
		int m;
		for (int i = 0; i < n; ++i) {
			int k;
			cin >> k;
			if (k < 1) { na = true; }
			if (k > 0) { ++m; }
		}
		if()
		cout << m + 1 << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: expected primary-expression before ')' token
   16 |                 if()
      |                    ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	int n,i,j;
	int a[1000];
	while(1){
		cin>>n;
		int c=0;
		int s=0;
		if(n==0)break;
		for(i=0;i<n;i++){
			cin>>a[i];
			if(a[i]<=1){
				c++;
				if(a[i]==0){
					s++;
				}
			}
		}
		if(n==1&&a[0]>=2){
			cout<<2<<endl;
		}
		else{
			if(c==n||n==1&&a[0]<=1||){
				cout<<"NA"<<endl;
			}
			else{
				cout<<n-s+1<<endl;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:49: error: expected primary-expression before ')' token
   24 |                         if(c==n||n==1&&a[0]<=1||){
      |                                                 ^
Language: C++

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (;;) {
            int n = sc.nextInt();
            if(n==0) {
                break;
            }
            boolean f=false;
            int c=0;
            for(int i=0;i<n;i++) {
                int m=sc.nextInt();
                if(m>=2) {
                    f=true;
                }
                if(m==0) {
                    c++;
                }
            }
            System.out.println(f&&n>0?n+1-c:"NA");
        }
    }
}



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

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

int main() {
	int a[10001], b, c, d, n, i;
	a[0] = 0;
	cin >> n;
	while(n != 0) {
		cin >> n;
		for(i = 1; i <= n; i++) {
			cin >> a[i];
			if (a[0] < a[i]) {
				temp = a[0];
				a[0] = a[i];
				a[i] = temp;
			}
		}
		if (n != 1 && a[0] >= 2) {
			cout << 3 << endl;
		}else if (n == 1) {
			cout <<  2 << endl;
		}else if (a[0] == 1) {
			cout << "NA";
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: 'temp' was not declared in this scope; did you mean 'tm'?
   13 |                                 temp = a[0];
      |                                 ^~~~
      |                                 tm
Language: C++

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

int main() {
	int a, n, i, m k = 0;
	cin >> n;
	m = n;
	while(n != 0 || k != 100) {
		for(i = 1; i <= n; i++) {
			cin >> a;
			if (a <= 1) {
				m--;
			}
		}
		if (m <= 0) {
			cout << "NA" << endl;
		}else{
			cout << m + 1 << endl;
		}
		cin >> n;
		m = n;
		k++;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: expected initializer before 'k'
    5 |         int a, n, i, m k = 0;
      |                        ^
a.cc:7:9: error: 'm' was not declared in this scope
    7 |         m = n;
      |         ^
a.cc:8:25: error: 'k' was not declared in this scope
    8 |         while(n != 0 || k != 100) {
      |                         ^
Language: C++



#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	for (;;)
	{
		in >> N;
		if (N == 0) { break; }
		bool over1 = false;
		int32_t count = 0;
		for (size_t i = 0; i < N; i++)
		{
			if (A[i] > 0) {
				++count;
				over1 |= (A[i] >= 2);
			}
		}
		if (over1) {
			out << count + 1 << endl;
		}
		else {
			out << "NA" << endl;
		}
	}

	return 0;
}
#endif



Compiler output:
a.cc: In function 'int main()':
a.cc:49:29: error: 'A' was not declared in this scope
   49 |                         if (A[i] > 0) {
      |                             ^
Language: C++

#include<stdio.h>
int main(void){
	int N = 1;
	static int k[10000];
	int i;
	int a, b;

	for (;;){
		scanf_s("%d", &N);

		if (N == 0)
			break;

		for (i = 0; i < N; i++)
			scanf_s("%d", &k[i]);

		a = 0, b = 0;
		for (i = 0; i < N; i++){
			if (k[i] == 0)
				a++;
			if (k[i] < 2)
				b++;
		}

		if (b == N)
			printf("NA\n");
		else{
			N = N - a + 1;
			printf("%d\n", N);
		}
	}
}


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

#include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 1e4;

int main(){
  int n;

  while(cin >> n,n){
    int k[MAX+1],m = 1<<29,M = -1<<29;
    bool flg = false;
    for(int i = 0 ; i < n ; i++){#include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 1e4;

int main(){
  int n;

  while(cin >> n,n){
    int k[MAX+1],m = 1<<29,M = -1<<29;
    bool flg = false;
    for(int i = 0 ; i < n ; i++){
      cin >> k[i];
      if(k[i] >= 2) flg = true;
      m = min(m,k[i]);
      M = max(M,k[i]);
    }
    if(!flg) cout << "NA" << endl;
    else{
      if(n == 1) cout << "2" << endl;
      else{
	int d = M - m;
	cout << m+d << endl;
      }
    }
  }
  return 0;
}

Compiler output:
a.cc:12:34: error: stray '#' in program
   12 |     for(int i = 0 ; i < n ; i++){#include <iostream>
      |                                  ^
a.cc: In function 'int main()':
a.cc:12:35: error: 'include' was not declared in this scope
   12 |     for(int i = 0 ; i < n ; i++){#include <iostream>
      |                                   ^~~~~~~
a.cc:12:52: error: expected primary-expression before '>' token
   12 |     for(int i = 0 ; i < n ; i++){#include <iostream>
      |                                                    ^
a.cc:14:1: error: expected primary-expression before 'using'
   14 | using namespace std;
      | ^~~~~
a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   17 | int main(){
      |         ^~
a.cc:17:9: note: remove parentheses to default-initialize a variable
   17 | int main(){
      |         ^~
      |         --
a.cc:17:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:17:11: error: a function-definition is not allowed here before '{' token
   17 | int main(){
      |           ^
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:12:33: note: to match this '{'
   12 |     for(int i = 0 ; i < n ; i++){#include <iostream>
      |                                 ^
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:9:20: note: to match this '{'
    9 |   while(cin >> n,n){
      |                    ^
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int N,a,b,c;

int main(){
  for(;;){
    cin >> N
    if(N==0){
      a = 1;
      b = 0;
      for(int i = 0; i < N; i++){
        cin >> c;
        if(c != 0){
          a++;
        }
        if(c > 1){
          b++;
        }
      }
      if(b == 0){
        cout << "NA" << endl;
      }else{
        cout << a << endl;
      }
    }else{
      break;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected ';' before 'if'
    8 |     cin >> N
      |             ^
      |             ;
    9 |     if(N==0){
      |     ~~       
a.cc:26:6: error: 'else' without a previous 'if'
   26 |     }else{
      |      ^~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    int e=0;
    vector<int>in;
    rep(i,n){
      int tmp;
      cin>>tmp;
      if(e<tmp)e=tmp;
      pb(in,tmp);
    }
    if(tmp<2)cout<<in.size()+1<<endl;
    else cout<<"NA"<<endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   25 |     if(tmp<2)cout<<in.size()+1<<endl;
      |        ^~~
      |        tm
Language: Java

import java.util.*;

public class Bonze {
    public static void main(String[] args){
	int n, field = 0, taihi = 0, zyun = 0;
	String a;
	Scanner scan = new Scanner(System.in);
	while(true){
	    n = scan.nextInt();
	    if(n == 0)break;
	    int[] player = new int[n];
	    for(int b = 0; b < n; b++){
		player[b] = 0;
	    }
	    a = scan.next();
	    char[] hairetu = a.toCharArray();
	    for(int i = 0; i < 100; i++){
		zyun = i % n;
		if(hairetu[i] == 'S'){
		    field = field + player[zyun] + 1;
		    player[zyun] = 0;
		}
		if(hairetu[i] == 'L'){
		    player[zyun] = player[zyun] + field + 1;
		    field = 0;
		}
		if(hairetu[i] == 'M'){
		    player[zyun] = player[zyun] + 1;
		}
	    }
	    for(int j = 0; j < n - 1; j++){
		for(int k = n - 1; k > j; k-- ){
		    if(player[j] > player[k]){
			taihi = player[j];
			player[j] = player[k];
			player[k] = taihi;
		    }
		}
	    }
	    for(int l = 0; l < n; l++){
		System.out.print(player[l] + " ");
	    }
	    System.out.println(field);
	}
    }
}

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


public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int n,ba = 0,jun = 0;
	String a;
	while(true){
	    n = scan.nextInt();
	    if(n == 0) break;
	    int[] mochi = new int[n];
	    a = scan.next();
	    char fuda[] = a.toCharArray();
	    for(int i = 0; i<100; i++){
		switch(fuda[i]){
		case 'M':
		    if(jun == n) jun = 0;
		    mochi[jun] += 1;
		    jun++;
		    break;
		case 'S':
		    if(jun == n) jun = 0;
		    ba += mochi[jun] + 1;  //banidasu
		    mochi[jun] =0;  //mochifudazero
		    jun++;
		    break;
		case 'L':
		    if(jun == n) jun = 0;
		    mochi[jun] += ba +1;
		    ba = 0;
		    jun++;
		    break;
		}
	    }
	    Arrays.sort(mochi);
	    for(int i = 0;i<mochi.length;i++){
		System.out.print(mochi[i]);
		System.out.print(" ");
	    }
	    System.out.println(ba);
	    jun = 0; ba = 0;
	}
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	                   ^
  symbol:   class Scanner
  location: class Main
Main.java:34: error: cannot find symbol
	    Arrays.sort(mochi);
	    ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: Java

import java.util.*;
public class Main{
	public void output(){
		Scanner scan = new Scanner(System.in);
		int[] hito = new int[1000];

		int p = 0;
		int g = 0;
		int taihi = 0;
		while(true){
			int n = scan.nextInt();
			if(n == 0)break;
			int yama = 0;
			int ba = 0;
			for(int r = 0;r < n;r++){
				hito[r] = 0;
			}
			String huda1 = scan.next();
			char[] huda = huda1.toCharArray();
			for(int i = 0; i < 100; i++){
				/*if(p == n-1){
					p = 0;
				}*/
				p = i % n;
				if(huda[yama] == 'M'){
					hito[p] = hito[p] + 1;
				}
				if(huda[yama] == 'S'){
					hito[p] = hito[p] + 1;
					ba = ba + hito[p];
					hito[p] = 0;
				}
				if(huda[yama] == 'L'){
					hito[p] = hito[p] + 1;
					hito[p] = hito[p] + ba;
					ba = 0;
				}
				yama = yama + 1;
			}
			for(int u = 0; u < n-1; u++){
				for(int t = n-1; t > u;t--){
					  if(hito[t]<hito[t-1]){
					  taihi = hito[t];
					  hito[t] = hito[t-1];
					  hito[t-1]=taihi;
					  }
				}
			}
			for(g = 0; g < n;g++){
				System.out.print(hito[g] + " ");
			}
			System.out.println(ba);
		}
	}
}
}

Compiler output:
Main.java:56: error: class, interface, enum, or record expected
}
^
1 error
Language: C

#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int N;
	int p[10]={0};
	int i,j,temp,s;
	int ba=0;
	char c[200];
	while(1){
		cin>>N;
		if(N==0){
			break;
		}
		ba=0;
		for(i=0;i<10;i++){
			p[i]=0;
		}
		cin>>c;
		for(j=0;j<100;j++){
			s=j%N;
			if(c[j]=='M'){
				p[s]=p[s]+1;
			}
			else if(c[j]=='S'){
				ba=ba+p[s];
				p[s]=0;
				ba=ba+1;
			}
			else if(c[j]=='L'){
				p[s]=p[s]+ba;
				ba=0;
				p[s]=p[s]+1;
			}
		}
		for(i=0;i<N;i++){
			for(j=N-1;j>i;j--){
				if(p[i]>p[j]){
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
				}
			}
		}
		for(i=0;i<N;i++){
			printf("%4d",p[i]);
		}
		printf("%4d",ba);
	}
	return 0;
}

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

#include<stdio.h>
int main(void)
{
	int n,i,r,f,h,u,x=0;
	char c[100+1];
	char p[10];
	scanf("%d",&n);
	scanf("%s",&c);
	r=0;
	p=0;
	for(i=0;i<100;i++){
		switch( c[i] ){
			case 'M':
			p[r]=p[r]+1;
			break;
			case 'S':
			p[10]=h+1-c;
			p[r]=x+p[r];
			break;
			case 'L':
			p[r]=p[r]+x;;
			f=0;
			break;
		}
		r = (r+1)%n;
	}
	for(i=0;i<100;i++)[
		p[r]=c;
		p[r]=0;
		}
	for(i=0;i<n;i++){
		printf("%d ",p[i]);
	}
	printf("\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:10: error: assignment to expression with array type
   10 |         p=0;
      |          ^
main.c:17:34: error: invalid operands to binary - (have 'int' and 'char *')
   17 |                         p[10]=h+1-c;
      |                               ~~~^
      |                                | |
      |                                | char *
      |                                int
main.c:27:27: error: expected expression before '[' token
   27 |         for(i=0;i<100;i++)[
      |                           ^
main.c:28:21: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
   28 |                 p[r]=c;
      |                     ^
main.c:29:24: error: expected ';' before '}' token
   29 |                 p[r]=0;
      |                        ^
      |                        ;
   30 |                 }
      |                 ~       
main.c: At top level:
main.c:31:9: error: expected identifier or '(' before 'for'
   31 |         for(i=0;i<n;i++){
      |         ^~~
main.c:31:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   31 |         for(i=0;i<n;i++){
      |                  ^
main.c:31:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   31 |         for(i=0;i<n;i++){
      |                      ^~
main.c:34:16: error: expected declaration specifiers or '...' before string constant
   34 |         printf("\n");
      |                ^~~~
main.c:35:9: error: expected identifier or '(' before 'return'
   35 |         return 0;
      |         ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

#include<stdio.h>
int main(void)
{
	while(1){
		int n,i,j=0,t[10]={0},fi=0,bum
		char c[201];
		scanf("%d",&n);
		if(n==0){
			break;
		}
		scanf("%s",c);
		for(i=0;i<100;i++){
			t[j]++;
			if(c[i]=='S'){
				fi=fi+t[j];
				t[j]=0;
			}
			if(c[i]=='L'){
				t[j]=t[j]+fi;
				fi=0;
			}
			j++;
			if(j==n){
				j=0;
			}
		}
		for(i=0;i<n;i++){
			for(j=i+1;j<n;j++){
				if(t[i]>t[j]){
					bum=t[i];
					t[i]=t[j];
					t[j]=bum;
				}
			}
		}
		for(i=0;i<n;i++){
			printf("%d ",t[i]);
		}
		printf("%d\n",fi);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
    6 |                 char c[201];
      |                 ^~~~
main.c:11:28: error: 'c' undeclared (first use in this function)
   11 |                 scanf("%s",c);
      |                            ^
main.c:11:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:41: error: 'bum' undeclared (first use in this function)
   30 |                                         bum=t[i];
      |                                         ^~~
Language: C++

import java.io.*;
import java.math.*;
import java.util.*;

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		char[] c;
		String s;
		int[] huda=new int[10];
		int n;
		int turn;
		int field;
		int i,j;

		while(true){
			turn = 0;
			field= 0;
			s = r.readLine();
			n = Integer.parseInt(s);
			if(n == 0) break;
			for(i=0;i<n;i++) huda[i]=0;

			s = r.readLine();
			c = s.toCharArray();
			for(i=0;i<100;i++){
				switch(c[i]){
					case 'M':
						huda[turn]++;
						break;
					case 'S':
						field += huda[turn] + 1;
						huda[turn] = 0;
					 	break;
					case 'L':
						huda[turn] += field + 1;
						field = 0;
						break;
				}
				if(turn+1 == n)
					turn = 0;
				else turn++;
			}
			Arrays.sort(huda,0,n-1);
			for(i=0;i<n;i++) System.out.print(huda[i]+" ");
			System.out.println(field);
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.math.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:15: error: expected ':' before 'static'
    6 |         public static void main(String[] args) throws IOException{
      |               ^~~~~~~
      |               :
a.cc:6:33: error: 'String' has not been declared
    6 |         public static void main(String[] args) throws IOException{
      |                                 ^~~~~~
a.cc:6:42: error: expected ',' or '...' before 'args'
    6 |         public static void main(String[] args) throws IOException{
      |                                          ^~~~
a.cc:6:46: error: expected ';' at end of member declaration
    6 |         public static void main(String[] args) throws IOException{
      |                                              ^
      |                                               ;
a.cc:6:48: error: 'throws' does not name a type
    6 |         public static void main(String[] args) throws IOException{
      |                                                ^~~~~~
a.cc:49:2: error: expected ';' after class definition
   49 | }
      |  ^
      |  ;
Language: C++

import java.io.*;
import java.math.*;
import java.util.*;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		char[] c;
		String s;
		int[] huda=new int[10];
		int n;
		int turn;
		int field;
		int i,j;

		while(true){
			turn = 0;
			field= 0;
			s = r.readLine();
			n = Integer.parseInt(s);
			if(n == 0) break;
			for(i=0;i<n;i++) huda[i]=0;

			s = r.readLine();
			c = s.toCharArray();
			for(i=0;i<100;i++){
				switch(c[i]){
					case 'M':
						huda[turn]++;
						break;
					case 'S':
						field += huda[turn] + 1;
						huda[turn] = 0;
					 	break;
					case 'L':
						huda[turn] += field + 1;
						field = 0;
						break;
				}
				if(turn+1 == n)
					turn = 0;
				else turn++;
			}
			Arrays.sort(huda,0,n-1);
			for(i=0;i<n;i++) System.out.print(huda[i]+" ");
			System.out.println(field);
		}
	}
}

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

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

int main() {
    int N;
    while (cin >> N, N) {
        vector<int> v(N, 0);
        int ba = 0;
        char c;
        int k = 0;
        for (int i=0; i<100; ++i) {
            cin >> c;
            if (c == 'M') {
                ++ v[k];
            } else if (c == 'S') {
                ba += 1 + v[k];
                v[k] = 0;
            } else {
                v[k] += 1 + ba;
                ba = 0;
            }
            k = (k + 1) % N;
        }
        sort(v.begin(), v.end());
        for (int i=0; i<N; ++i) {
            cout << v[i] << " ";
        }
        cout << ba << endl;
    }
    return 0;
}

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

#include<iostream>
#include<cstdio>
#include<string>
int N;
string ss;
int P[10],B;
int main()
{
while(true){
 scanf("%d",&N);
 if(N==0)break;
 for(int i=0;i<N;i++)P[i]=0;
 B=0;
 cin >> ss;
 for(int i=0;i<ss.length();i++){
  if(ss[i]=='S'){
   B+=(P[i%N]+1);
   P[i%N]=0;
  }
  else if(ss[i]=='L'){
   P[i%N]+=(B+1);
   B=0;
  }
  else{
   P[i%N]++;
  }
 }
 for(int i=0;i<N;i++)printf("%d ",P[i]);
 printf("%d\n",B);
}
 return 0;
}

Compiler output:
a.cc:5:1: error: 'string' does not name a type; did you mean 'stdin'?
    5 | string ss;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:14:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   14 |  cin >> ss;
      |  ^~~
      |  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:14:9: error: 'ss' was not declared in this scope
   14 |  cin >> ss;
      |         ^~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  while(cin>> n,n){
    char huda[100];
    for(int i=0;i<100;i++){
      cin>> huda[i];
    }

    int player=0;
    int score[10]={0};
    int stage=0;
    for(int i=0;i<100;i++){
      if(huda[i]=='M'){
	score[player]++;
      }
      else if(huda[i]=='S'){
	stage+=score[player]+1;
	score[player]=0;
      }
      else{
	score[player]+=stage+1;
	stage=0;
      }

      if(player==n-1) player=0;
      else player++;
    }

    sort(score,score+n);
    for(int i=0;i<n;i++){
      cout<< score[i]<< " ";
    }

    cout<< stage<< endl;
  }
}

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

int main(){
  int a, n, m[10], f = 0;
  char c[100];
  for(int i = 0; i < 10; i++) m[i] = 0;
  while(1){
    cin >> n;
    if(n <= 1 || n >= 10) break;
    for(int i = 0; i < 100; i++) cin >> c[i];
    for(int j = 0; j <= 100/n; j++){
      for(int k = 0; k < n; k++){
        if(c[j*n+k] == 'M') m[k]++;
        else if(c[j*n+k] == 'S') f += m[k]+1, m[k] = 0;
        else if(c[j*n+k] == 'L') m[k] += f+1, f = 0;
      }
    }
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n-1; j++){
        if(m[j] > m[j+1]) a = m[j], m[j] = m[j+1], m[j+1] = a;
      }
    }
    for(int i = 0; i < n; i++) cout << m[i] << " ";
    cout << f << endl;
    for(int i = 0; i < 10; i++) m[i] = 0;
    f = 0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n;
      |     ^~~
a.cc:21:32: error: 'cout' was not declared in this scope
   21 |     for(int i = 0; i < n; i++) cout << m[i] << " ";
      |                                ^~~~
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << f << endl;
      |     ^~~~
a.cc:22:18: error: 'endl' was not declared in this scope
   22 |     cout << f << endl;
      |                  ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){

int n = 0, ba = 0;
char card; 

	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		int temochi[n];
		for(int i = 0 ; i < 100; i++ ){
			cin >> card;
			temochi[i % n];		
			if(card == 'M'){
			temochi[i % n] ++;
			}

			else if(card == 'S'){
			ba = ba + temochi[i % n] + 1;
			temochi[i % n]	= 0;		
			}

			else{
			temochi[i % n] = temochi[i % n] + ba + 1;
			}

		}	

		sort(temochi, temochi + n);
		for(int i = 0 ; i < n; i++){
cout << temochi[i] << " "; 
}
cout << ba << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |                 sort(temochi, temochi + n);
      |                 ^~~~
      |                 short
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main(){

int n = 0, ba = 0;
char card; 

	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		int temochi[n];
		for(int i = 0 ; i < 100; i++ ){
			cin >> card;
			temochi[i % n];		
			if(card == 'M'){
			temochi[i % n] ++;
			}

			else if(card == 'S'){
			ba = ba + temochi[i % n] + 1;
			temochi[i % n]	= 0;		
			}

			else{
			temochi[i % n] = temochi[i % n] + ba + 1;
			}

		}	

		sort(temochi, temochi + n);
		for(int i = 0 ; i < n; i++){
cout << temochi[i] << " "; 
}
cout << ba << endl;

return 0;
}

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

#include<stdio.h>
#include<string.h>
int main()
{
	int ba=0,pl[10]={0},n,i,j;
	char yama[100];
	while(1)
	{
		scanf("%d",&n);
		if(n==0){break;}
		gets(yama);
		for(i=0;i<100;i++)
		{
			if(i%n==0){j=0;}
			if(strcmp(yama[i],"M")==0){pl[j]++;}
			if(strcmp(yama[i],"L")==0){pl[j]+=ba+1;ba=0;}
			if(strcmp(yama[i],"S")==0){ba+=pl[j]+1;pl[j]=0;}
			j++;
		}
		for(i=0;i<n;i++)
		{
		printf("%d ",pl[i]);
		printf("%d",ba);
		}
	}
	return 0;
}

//まぐろーりん離散数学
//アルゴリズムパズル

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   11 |                 gets(yama);
      |                 ^~~~
      |                 getw
a.cc:15:41: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   15 |                         if(strcmp(yama[i],"M")==0){pl[j]++;}
      |                                   ~~~~~~^
      |                                         |
      |                                         char
In file included from a.cc:2:
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:16:41: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   16 |                         if(strcmp(yama[i],"L")==0){pl[j]+=ba+1;ba=0;}
      |                                   ~~~~~~^
      |                                         |
      |                                         char
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:17:41: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   17 |                         if(strcmp(yama[i],"S")==0){ba+=pl[j]+1;pl[j]=0;}
      |                                   ~~~~~~^
      |                                         |
      |                                         char
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int n=0;
	int i=0;
	int j=0;
	int k=0;
	int a[12];
	int m=0;
	int sa=0;
	string c;
	string b;
	b="MSL";
	vector<int> v1[105];
	cin>>n;
	while(n!=0){
		cin>>c;
		memset(a,0,sizeof(a));
		for(i=0;i<100;i++){
			m=i%n;
			if(c[i]==b[0]){
				a[m]++;
			}
			if(c[i]==b[1]){
				sa=sa+a[m]+1;
				a[m]=0;
			}
			if(c[i]==b[2]){
				a[m]=a[m]+sa+1;
				sa=0;
			}
		}
		for(i=0;i<n;i++){
			v1[j].push_back(a[i]);
		}
		sort(v1[j].begin(),v1[j].end());
		v1[j].push_back(sa);
		sa=0;
		j++;
		cin>>n;
	}
	for(i=0;i<j;i++){
		sa=v1[i].size();
		for(k=0;k<sa-1;k++){
			cout<<v1[i][k]<<" ";
		}
		cout<<v1[i][sa-1]<<endl;
	}
}			

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

using namespace std;
int main(){

	while (true) {

		int N;
		cin >> N;
		if (N == 0) break;
		string c;
		cin >> c;
		int maisu[10];
		for (int i = 0; i < N;i++) {
			maisu[i] = 0;
		}
		int ba = 0;
		int turn = 0;
		for (int i = 0; i , c.size(); i++) {
			if (c[i] == 'M')
				maisu[turn]++;
			else if (c[i] == 'S') {
				maisu[turn]++;
				ba += maisu[turn];
				maisu[turn] = 0;
			}
			else {
				maisu[turn]++;
				maisu[turn] += ba;
				ba = 0;
			}
			turn++;
			turn %= N;
		}
	sort(maisu,maisu+N);
	for (int i = 0; i < N; i++) {
		cout << maisu[i] <<" ";
	}
	cout << ba <<endl;
}

	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'cin' was not declared in this scope
    7 |                 cin >> N;
      |                 ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:17: error: 'string' was not declared in this scope
    9 |                 string c;
      |                 ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:10:24: error: 'c' was not declared in this scope
   10 |                 cin >> c;
      |                        ^
a.cc:33:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |         sort(maisu,maisu+N);
      |         ^~~~
      |         short
a.cc:35:17: error: 'cout' was not declared in this scope
   35 |                 cout << maisu[i] <<" ";
      |                 ^~~~
a.cc:35:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:9: error: 'cout' was not declared in this scope
   37 |         cout << ba <<endl;
      |         ^~~~
a.cc:37:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:22: error: 'endl' was not declared in this scope
   37 |         cout << ba <<endl;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {

	while(true) {
		int N;
		cin >> N;
		if(N == 0) break;
		string c;
		cin >> c;
		int maisu[10];
		for (int i = 0; i < c.size(); i++){
			maisu[i] = 0;
		}
		int ba = 0;
		int turn = 0;
		for (int i = 0; i < c.size(); i++) {
			if(c[i] == 'M') {
			maisu[turn]++;
			}
			else if (c[i] == 'S') {
				maisu[turn]++;
				ba += maisu[turn];
				maisu[turn] = 0;
			}
			else {
				maisu[turn]++;
				maisu[turn] += ba;
				ba = 0;
			}
			turn ++;
			turn %= N;
	}
	sort(maisu, maisu+N);
	for(int i = 0; i < N; i++) {
		cout << maisu[i] << " ";
	}
	cout << ba << endl;
		
	return 0;
}

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

#include<iostream>
#include<algorithm>
using namespace std;
string Card;
int p[10]={0},N,f;
int main(){
    while(1){
        int c=0;
        cin>>N;
        if(N==0)break;
        cin>>Card;
        while(cnt < 100){
            for(intj=0;j<N;j++,c++){
                if(c>=100)break;
                if(Card[c] =='M'){
                    p[j]++;
                }
                else if(Card[c]=='S'){
                    f+=1+p[j];
                    p[j] = 0;
                }
                else {
                    p[j]+=f+1;
                    f=0;
                }
            }
        }
        sort(p,p+N);
        for(int i=0;i<N;i++){
            cout<<p[i]<< " ";
            p[i]=0;
        }   
        cout<<f<<endl;
        Card='\0';
        field=0;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   12 |         while(cnt < 100){
      |               ^~~
      |               int
a.cc:13:17: error: 'intj' was not declared in this scope; did you mean 'int'?
   13 |             for(intj=0;j<N;j++,c++){
      |                 ^~~~
      |                 int
a.cc:13:24: error: 'j' was not declared in this scope
   13 |             for(intj=0;j<N;j++,c++){
      |                        ^
a.cc:35:9: error: 'field' was not declared in this scope
   35 |         field=0;
      |         ^~~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
string Card;
int p[10]={0},N,f;
int main(){
    while(1){
        int c=0;
        cin>>N;
        if(N==0)break;
        cin>>Card;
        while(cnt < 100){
            for(int j=0;j<N;j++,c++){
                if(c>=100)break;
                if(Card[c] =='M'){
                    p[j]++;
                }
                else if(Card[c]=='S'){
                    f+=1+p[j];
                    p[j] = 0;
                }
                else {
                    p[j]+=f+1;
                    f=0;
                }
            }
        }
        sort(p,p+N);
        for(int i=0;i<N;i++){
            cout<<p[i]<< " ";
            p[i]=0;
        }   
        cout<<f<<endl;
        Card='\0';
        field=0;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   12 |         while(cnt < 100){
      |               ^~~
      |               int
a.cc:35:9: error: 'field' was not declared in this scope
   35 |         field=0;
      |         ^~~~~
Language: C++

#include<iostream>
#include <stdio.h>
using namespace std;
void cal(int *tehuda, int *ba, char c){
  switch(c){
  case 'M':*tehuda++; break;
  case 'S':*ba+=*tehuda;*tehuda = 0;break;
  case 'L':*tehuda+=*ba;*ba = 0;break; 
}
int main(){
  while(true){
int result[10] = {};
    int n; cin >> n;
    if(n == 1)return 0;
    int player[10] ={};
    int ba = 0;
    for(int i =0; i < 100; i++){
      char c;cin >> c;
      cal(&player[i%n], &ba, c);
    }
    
    for(int i = 0;i<n-1;i++){
      int top = player[i];
      for(int j =1; j < n;j++){
	if(top > player[j])top = player[j];
      }
      result[i] = top;
    }
    for(int i = 0; i < n; i++){
      printf("%d ", result[i]);
    }
    cout << ba<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void cal(int*, int*, char)':
a.cc:10:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   10 | int main(){
      |         ^~
a.cc:10:9: note: remove parentheses to default-initialize a variable
   10 | int main(){
      |         ^~
      |         --
a.cc:10:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:10:11: error: a function-definition is not allowed here before '{' token
   10 | int main(){
      |           ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:4:39: note: to match this '{'
    4 | void cal(int *tehuda, int *ba, char c){
      |                                       ^