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

#include <stdio.h>
#include <algorithm>
using namespace std;

char str[12345];

int main(){
int joi_ans;
int ioi_ans;
	while (1){
		memset(str, 0, sizeof(str));
		if (scanf("%s", str) == EOF) return 0;
		joi_ans = 0;
		ioi_ans = 0;
		for (int a = 0;; a++){
			if (str[a] == 'J' &&
				str[a + 1] == 'O' &&
				str[a + 2] == 'I') joi_ans++;
			if (str[a] == 'I' &&
				str[a + 1] == 'O' &&
				str[a + 2] == 'I') ioi_ans++;
			if (str[a + 1] == 0) break;
		}
		printf("%d\n%d\n", joi_ans, ioi_ans);
	}
}

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

#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0;i < N;i++)
int main()
{
  while(cin >> s) {
    int jcnt = 0,icnt = 0;
    Rep(i,s.size() - 2) {
      if(s[i + 2] == 'I' && s[i + 1] == 'O') {
	if(s[i] == 'J') {
	  jcnt++;
	}else if(s[i] == 'I') {
	  icnt++;
	}
      }
    }
    cout << jcnt << endl << icnt << endl;
  }
  return 0;
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: 's' was not declared in this scope
    6 |   while(cin >> s) {
      |                ^
Language: C++

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

int solve(string s){
  int joi=0,ioi=0;
  for(int i=0;i<s.size()-2;i++){
    if(s.substr(i,3)=="JOI")joi++;
    else if(s.substr(i,3)=="IOI")ioi++;
  }
  cout<<joi<<endl;
  cout<<ioi<<endl;
  return 0;
}

int main(){
  string s;
  whlie(cin>>s){
    solve(s);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'whlie' was not declared in this scope
   18 |   whlie(cin>>s){
      |   ^~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
#include<string.h>
int main(){
	string a;
	cin>>a;
	while(cin >> s, !cin.eof()) {
	int i,ioi=0,joi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
	}
	}
	cout<<joi << endl;
	cout<<ioi << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: 's' was not declared in this scope
    8 |         while(cin >> s, !cin.eof()) {
      |                      ^
a.cc:17:15: error: 'joi' was not declared in this scope
   17 |         cout<<joi << endl;
      |               ^~~
a.cc:18:15: error: 'ioi' was not declared in this scope
   18 |         cout<<ioi << endl;
      |               ^~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
#include<string.h>
int main(){
	string a;
	cin>>a;
	while(cin >> s, !cin.eof()) {
	int i,ioi=0,joi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
	}
	cout<<joi << endl;
	cout<<ioi << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: 's' was not declared in this scope
    8 |         while(cin >> s, !cin.eof()) {
      |                      ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
#include<string.h>
int main(){
	string a;
	cin>>a;
	while(cin >> s,){
	int i,ioi=0,joi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
	}
	cout<<joi << endl;
	cout<<ioi << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: 's' was not declared in this scope
    8 |         while(cin >> s,){
      |                      ^
a.cc:8:24: error: expected primary-expression before ')' token
    8 |         while(cin >> s,){
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	cin>>a;
	while(cin >> s,){
	int i,ioi=0,joi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
	}
	cout<<joi << endl;
	cout<<ioi << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: 's' was not declared in this scope
    7 |         while(cin >> s,){
      |                      ^
a.cc:7:24: error: expected primary-expression before ')' token
    7 |         while(cin >> s,){
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	cin>>a;
	while(cin >> a){
	int i,ioi=0,joi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
	}
	cout<<joi << endl;
	cout<<ioi << endl;
	}
}

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

#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	cin>>a;
	while(cin >> a,!cin.eof()){
	int i,ioi=0,joi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		i+=1;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
		i+=1;
	}
	cout<<joi << endl;
	cout<<ioi << endl;
	}
}

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

#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	int i,ioi=0,joi=0;
	while(cin >> a,!cin.eof()){
	joi=0;
	ioi=0;
	for(i=0;i<s.size()-2;i++){
		if(a[i]=='J'&&a[i+1]=='O'&&a[i+2]=='I')
		joi++;
		i+=1;
		if(a[i]=='I'&&a[i+1]=='O'&&a[i+2]=='I')
		ioi++;
		i+=1;
	}
	cout<<joi << endl;
	cout<<ioi << endl;
}
}

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

#include <iostream>
#include <string>
using namespace std;
int main () {
    string a;
    int i, joi, ioi;
while(cin >> s, !cin.eof()) {
    joi = 0;
    ioi = 0;
    for(i=0;i<a.size()-2;i++) {
        if(a[i]=='J') {
            if(a[i+1]=='O') {
                if(a[i+2]=='I') {
                    joi++;
                    i += 1;
                }
            }
        }
           if(a[i]=='I') {
            if(a[i+1]=='O') {
                if(a[i+2]=='I') {
                    ioi++;
                    i += 1;
                }
            }
        }
    }      
cout << joi << endl;
cout <<ioi << endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: 's' was not declared in this scope
    7 | while(cin >> s, !cin.eof()) {
      |              ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
??
int main () {
????????string s;
????????int i, joi, ioi;
while(cin >> s, !cin.eof()) {
????????joi = 0;
????????ioi = 0;
????????for(i=0;i<s.size()-2;i++) {
????????????????if(s[i]=='J') {
????????????????????????if(s[i+1]=='O') {
????????????????????????????????if(s[i+2]=='I') {
????????????????????????????????????????joi++;
????????????????????????????????????????i += 1;
????????????????????????????????}
????????????????????????}
????????????????}
??????????????????????if(s[i]=='I') {
????????????????????????if(s[i+1]=='O') {
????????????????????????????????if(s[i+2]=='I') {
????????????????????????????????????????ioi++;
????????????????????????????????????????i += 1;
????????????????????????????????}
????????????????????????}
????????????????}
????????}?????????? 
cout << joi << endl;
cout <<ioi << endl;
}
}

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

#include<iostream>
#include<string.h>
using namespace std;
int main(){
	char a[10000];
	int i,ioi,joi;
	while(cin>>a,!cin.eof())[
		joi=0;
		ioi=0;
		for(i=0;i<strlen(a);i++){
			if(a[i]=='J',a[i+1]=='O',a[i+2]=='I')
			joi++;
			if(a[i]=='I',a[i+1]=='O',a[i+2]=='I')
			ioi++;
		}
		cout << joi << endl;
		cout << ioi << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ',' before ';' token
    8 |                 joi=0;
      |                      ^
      |                      ,
a.cc:8:22: error: expected identifier before ';' token
a.cc:8:22: error: expected ']' before ';' token
    8 |                 joi=0;
      |                      ^
      |                      ]
a.cc: In lambda function:
a.cc:8:22: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:19:9: error: expected unqualified-id before 'return'
   19 |         return 0;
      |         ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include<iostream>
#include<string.h>
using namespace std;
int main(){
	char a[10001];
	int i,ioi,joi;
	while(cin>>a,!cin.eof())[
		joi=0;
		ioi=0;
		for(i=0;i<strlen(a);i++){
			if(a[i]=='J',a[i+1]=='O',a[i+2]=='I')
			joi++;
			else if(a[i]=='I',a[i+1]=='O',a[i+2]=='I')
			ioi++;
		}
		cout << joi << endl;
		cout << ioi << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ',' before ';' token
    8 |                 joi=0;
      |                      ^
      |                      ,
a.cc:8:22: error: expected identifier before ';' token
a.cc:8:22: error: expected ']' before ';' token
    8 |                 joi=0;
      |                      ^
      |                      ]
a.cc: In lambda function:
a.cc:8:22: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:19:9: error: expected unqualified-id before 'return'
   19 |         return 0;
      |         ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){

    int JOI=0,IOI=0;
    int i;
    cin>>a;
    int s=a.size();
    if(a.substr(i,3)=="JOI");{
        JOI++;
    }
     if(b.substr(i,3)=="IOI");{
        IOI++;
    }
    cout<<JOI<<endl;
    cout<<IOI<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'a' was not declared in this scope
    9 |     cin>>a;
      |          ^
a.cc:14:9: error: 'b' was not declared in this scope
   14 |      if(b.substr(i,3)=="IOI");{
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	string s;
	while(cin >> s) { 
	int joi = 0, ioi = 0;
		rep(i, s.size() - 2) {
			if(s[i] == 'J' && s[i + 1] == 'O' && s[i + 2] == 'I') ++joi;
			if(s[i] == 'I' && s[i + 1] == 'O' && s[i + 2] == 'I') ++ioi;
		}
	}
	printf("%d\n%d\n", joi, ioi);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:28: error: 'joi' was not declared in this scope
   24 |         printf("%d\n%d\n", joi, ioi);
      |                            ^~~
a.cc:24:33: error: 'ioi' was not declared in this scope
   24 |         printf("%d\n%d\n", joi, ioi);
      |                                 ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int joi=0,ioi=0,i=0;
  string s;

    cin >> s;
    for(i=0;i<s.size()-2;i++){
      if(s.substr(i,3) == "JOI"){
	  joi++;
	  i++
	}
      if(s.subst(i,3) == "IOI"){
	  ioi++;
	  i++;
	}
    }
    cout << joi << endl << ioi << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: expected ';' before '}' token
   12 |           i++
      |              ^
      |              ;
   13 |         }
      |         ~     
a.cc:14:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'subst'; did you mean 'substr'?
   14 |       if(s.subst(i,3) == "IOI"){
      |            ^~~~~
      |            substr
Language: C++

#include <iostream>
using namespace std;

int main(){
  int joi=0,ioi=0,i=0;
  string s;

    cin >> s;
    for(i=0;i<s.size()-2;i++){
      if(s.substr(i,3) == "JOI"){
	  joi++;
	  i++
	}
      if(s.substr(i,3) == "IOI"){
	  ioi++;
	  i++;
	}
    }
    cout << joi << endl << ioi << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: expected ';' before '}' token
   12 |           i++
      |              ^
      |              ;
   13 |         }
      |         ~
Language: C++

#include <list>
#include <vector>
#include <deque>
#include <numeric>

using namespace std;
int main() {
     char str[10000];
	 int joi = 0, ioi = 0;
	for (int i = 0; i < 5; i++) {
		if (gets_s(str) == NULL) break;
		for (int j = 0; j < strlen(str)-2; j++) {
			if (str[j] == 'J'&&str[j + 1] == 'O' && str[j + 2] == 'I')joi++;
			if (str[j] == 'I'&&str[j + 1] == 'O' && str[j + 2] == 'I')ioi++;
		}
		cout << joi << endl << ioi << endl;
		joi = 0;
		ioi = 0;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: 'gets_s' was not declared in this scope
   11 |                 if (gets_s(str) == NULL) break;
      |                     ^~~~~~
a.cc:12:37: error: 'strlen' was not declared in this scope
   12 |                 for (int j = 0; j < strlen(str)-2; j++) {
      |                                     ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <numeric>
  +++ |+#include <cstring>
    5 | 
a.cc:16:17: error: 'cout' was not declared in this scope
   16 |                 cout << joi << endl << ioi << endl;
      |                 ^~~~
a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <numeric>
  +++ |+#include <iostream>
    5 | 
a.cc:16:32: error: 'endl' was not declared in this scope
   16 |                 cout << joi << endl << ioi << endl;
      |                                ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <numeric>
  +++ |+#include <ostream>
    5 |
Language: C++

#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <deque>
#include <numeric>

using namespace std;
int main() {
     char str[10000];
	 int joi = 0, ioi = 0;
	for (int i = 0; i < 5; i++) {
		if (gets_s(str) == NULL) break;
		for (int j = 0; j < strlen(str)-2; j++) {
			if (str[j] == 'J'&&str[j + 1] == 'O' && str[j + 2] == 'I')joi++;
			if (str[j] == 'I'&&str[j + 1] == 'O' && str[j + 2] == 'I')ioi++;
		}
		cout << joi << endl << ioi << endl;
		joi = 0;
		ioi = 0;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'gets_s' was not declared in this scope
   13 |                 if (gets_s(str) == NULL) break;
      |                     ^~~~~~
a.cc:14:37: error: 'strlen' was not declared in this scope
   14 |                 for (int j = 0; j < strlen(str)-2; j++) {
      |                                     ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <numeric>
  +++ |+#include <cstring>
    7 |
Language: C++

#include <iostream>
#include <string>
#include <string.h>
#include <list>
#include <vector>
#include <deque>
#include <numeric>

using namespace std;
int main() {
     char str[10000];
	 int joi = 0, ioi = 0;
	for (int i = 0; i < 5; i++) {
		if (gets(str) == NULL) break;
		for (int j = 0; j < strlen(str)-2; j++) {
			if (str[j] == 'J'&&str[j + 1] == 'O' && str[j + 2] == 'I')joi++;
			if (str[j] == 'I'&&str[j + 1] == 'O' && str[j + 2] == 'I')ioi++;
		}
		cout << joi << endl << ioi << endl;
		joi = 0;
		ioi = 0;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'gets' was not declared in this scope; did you mean 'getw'?
   14 |                 if (gets(str) == NULL) break;
      |                     ^~~~
      |                     getw
Language: C++

#include<string>
using namespace std;
int main(void)
{
	string set;
	int joi=0;
	int ioi=0;
	for (int a=0;a<3;a++)
	{
		cin>>set;
		lnog long b=set.size();	
		for (int c=0;c<b-2;c++)
		{
			if (set.substr(c,3)=="JOI") joi++;
			if (set.substr(c,3)=="IOI") ioi++;
		}
		cout<<joi<<endl<<ioi<<endl;
		joi=0;
		ioi=0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'cin' was not declared in this scope
   10 |                 cin>>set;
      |                 ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<string>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:11:17: error: 'lnog' was not declared in this scope; did you mean 'long'?
   11 |                 lnog long b=set.size();
      |                 ^~~~
      |                 long
a.cc:12:32: error: 'b' was not declared in this scope
   12 |                 for (int c=0;c<b-2;c++)
      |                                ^
a.cc:17:17: error: 'cout' was not declared in this scope
   17 |                 cout<<joi<<endl<<ioi<<endl;
      |                 ^~~~
a.cc:17:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:28: error: 'endl' was not declared in this scope
   17 |                 cout<<joi<<endl<<ioi<<endl;
      |                            ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<string>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

using namespace std;
int main(void)
{
	string set;
	int joi=0;
	int ioi=0;
	for (int a=0;a<5;a++)
	{
		cin>>set;
		long b=set.size();	
		for (int c=0;c<b-2;c++)
		{
			if (set.substr(c,3)=="JOI") joi++;
			if (set.substr(c,3)=="IOI") ioi++;
		}
		cout<<joi<<endl<<ioi<<endl;
		joi=0;
		ioi=0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'string' was not declared in this scope
    4 |         string set;
      |         ^~~~~~
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:9:17: error: 'cin' was not declared in this scope
    9 |                 cin>>set;
      |                 ^~~
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:22: error: 'set' was not declared in this scope
    9 |                 cin>>set;
      |                      ^~~
a.cc:1:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
  +++ |+#include <set>
    1 | using namespace std;
a.cc:16:17: error: 'cout' was not declared in this scope
   16 |                 cout<<joi<<endl<<ioi<<endl;
      |                 ^~~~
a.cc:16:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:28: error: 'endl' was not declared in this scope
   16 |                 cout<<joi<<endl<<ioi<<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.h>
using namespace std;

int main() {
	int len,coj=0,coi=0;
	char mozi[10005]={};
	while(cin>>mozi){
		len=0;
		coj=0;
		coi=0;
		len=strlen(mozi);
		for(int i=0;i<len;i++){
			if(mozi[i]=="J"){
				if(mozi[i+1]=="O"){
					if(mozi[i+2]=="I"){
						coj++;
					}

				}
			}
			if(mozi[i]=="I"){
				if(mozi[i+1]=="O"){
					if(mozi[i+2]=="I"){
						coi++;
					}

				}
			}
		}
		cout<<coj<<endl<<coi<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |                         if(mozi[i]=="J"){
      |                            ~~~~~~~^~~~~
a.cc:15:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |                                 if(mozi[i+1]=="O"){
      |                                    ~~~~~~~~~^~~~~
a.cc:16:53: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |                                         if(mozi[i+2]=="I"){
      |                                            ~~~~~~~~~^~~~~
a.cc:22:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |                         if(mozi[i]=="I"){
      |                            ~~~~~~~^~~~~
a.cc:23:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   23 |                                 if(mozi[i+1]=="O"){
      |                                    ~~~~~~~~~^~~~~
a.cc:24:53: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |                                         if(mozi[i+2]=="I"){
      |                                            ~~~~~~~~~^~~~~
Language: C++

#include<iostream>

using namespace std;

int main()
{
	for(;;){
		char str[1000];
		int joi = 0, ioi = 0;
		
		if(scanf("%s",str) == EOF){
			break;
		}
		
		//JOIツ板サツ津ィ
		for(int i = 0; i < (unsigned)strlen(str); i++){
			if(str[i] == 'J' && str[i+1] == 'O' && str[i+2] == 'I'){
				joi++;
			}
		}
		for(int i = 0; i < strlen(str); i++){
			if(str[i] == 'I' && str[i+1] == 'O' && str[i+2] == 'I'){
				ioi++;
			}
		}
		
		cout << joi << endl;
		cout << ioi << endl;
		
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:46: error: 'strlen' was not declared in this scope
   16 |                 for(int i = 0; i < (unsigned)strlen(str); i++){
      |                                              ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | 
a.cc:21:36: error: 'strlen' was not declared in this scope
   21 |                 for(int i = 0; i < strlen(str); i++){
      |                                    ^~~~~~
a.cc:21:36: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main()
{
	for(;;){
		char str[1000];
		int joi = 0, ioi = 0;
		
		if(scanf("%s",str) == EOF){
			break;
		}
		
		//JOIツ板サツ津ィ
		for(int i = 0; i < (unsigned)strlen(str); i++){
			if(str[i] == 'J' && str[i+1] == 'O' && str[i+2] == 'I'){
				joi++;
			}
		}
		for(int i = 0; i < strlen(str); i++){
			if(str[i] == 'I' && str[i+1] == 'O' && str[i+2] == 'I'){
				ioi++;
			}
		}
		
		cout << joi << endl;
		cout << ioi << endl;
		
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:46: error: 'strlen' was not declared in this scope
   17 |                 for(int i = 0; i < (unsigned)strlen(str); i++){
      |                                              ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
a.cc:22:36: error: 'strlen' was not declared in this scope
   22 |                 for(int i = 0; i < strlen(str); i++){
      |                                    ^~~~~~
a.cc:22:36: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<stdio.h>

int main(){
	int i,j,k;
	char s[10002];
	scanf("%s",s)ツ；
		i=0;j=0;
		for(k=0;s[k]!='\n';k++){
			if(s[k+1]=='O' && s[k+2]=='I'){
				if(s[k]=='J')j++;
				if(s[k]=='I')i++;
			}
		}
		printf("%d\n%d\n",j,i);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: expected ';' before '\U000030c4\U0000ff1b'
    6 |         scanf("%s",s)ツ；
      |                      ^~~~
      |                      ;
Language: C++

include<stdio.h>
#include<string.h>

int main(void){
  int i, j;
  int joi, ioi;
  int len;
  char str[100000], jd[256];

  memset(str,'\0',sizeof(str));
  memset(jd,'\0',sizeof(jd));

  while (scanf("%s", str) != EOF){
	
	len = strlen(str);
	
	joi = ioi = 0;
	
	for (i = 0;i < len - 2;i++){
	  if (str[i] == 'J' && str[i+1] == 'O' && str[i+2] =='I'){
		joi++;
	  }
	  if (str[i] == 'I' && str[i+1] == 'O' && str[i+2] =='I'){
		ioi++;
	  }
  }
	
	printf("%d\n%d\n", joi, ioi);
  }

  return 0;
} 

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:3: error: 'memset' was not declared in this scope
   10 |   memset(str,'\0',sizeof(str));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<string.h>
  +++ |+#include <cstring>
    3 | 
a.cc:13:10: error: 'scanf' was not declared in this scope
   13 |   while (scanf("%s", str) != EOF){
      |          ^~~~~
a.cc:13:30: error: 'EOF' was not declared in this scope
   13 |   while (scanf("%s", str) != EOF){
      |                              ^~~
a.cc:3:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include<string.h>
  +++ |+#include <cstdio>
    3 | 
a.cc:15:15: error: 'strlen' was not declared in this scope
   15 |         len = strlen(str);
      |               ^~~~~~
a.cc:15:15: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:28:9: error: 'printf' was not declared in this scope
   28 |         printf("%d\n%d\n", joi, ioi);
      |         ^~~~~~
a.cc:28:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int i=0,joi=0,ioi=0;
	char string[10000];
	while((string[i]=getc())!=EOF){
		if (i<2){i++;
		continue;
		}
	if((string[i]=='I')&&(string[i-1]=='O')&&(string[i-2]=='J')) joi++;
	if((string[i]=='I')&&(string[i-1]=='O')&&(string[i-2]=='I')) ioi++;
	i++;
	}
	printf("%d\n%d",joi,ioi);
	return EXIT_SUCCESS;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:30: error: too few arguments to function 'int getc(FILE*)'
    7 |         while((string[i]=getc())!=EOF){
      |                          ~~~~^~
In file included from a.cc:1:
/usr/include/stdio.h:576:12: note: declared here
  576 | extern int getc (FILE *__stream) __nonnull ((1));
      |            ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main(void)
{
  char c[10000];
  int len;
  int joi=0, ioi=0;

  scanf("%s",c);
  len = strlen(c);

  for(int i = 0 ; i < len ; i++) {
    if(c[i] == 'J' && c[i+1] == 'O' && c[i+2] == 'I') joi++;
    if(c[i] == 'I' && c[i+1] == 'O' && c[i+2] == 'I') ioi++;
  }
  cout << joi << endl << ioi << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'strlen' was not declared in this scope
   12 |   len = strlen(c);
      |         ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main(void)
{
  char c[10000];
  int len;
  int joi=0, ioi=0;
  
  while(scanf("%s",c) != EOF) {
    len = strlen(c);
    
    for(int i = 0 ; i < len ; i++) {
      if(c[i] == 'J' && c[i+1] == 'O' && c[i+2] == 'I') joi++;
      if(c[i] == 'I' && c[i+1] == 'O' && c[i+2] == 'I') ioi++;
    }
    cout << joi << endl << ioi << endl;
    joi = 0, ioi = 0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'strlen' was not declared in this scope
   12 |     len = strlen(c);
      |           ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C++

import java.util.*;
public class Main {
	private void doit() {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			String str = sc.next();
			HashMap<Character, Integer> map = new HashMap<Character, Integer>();
			int len = str.length();
			for(int i = 0; i < len; i++){
				char temp = str.charAt(i);
				if(map.containsKey(temp)){
					int value = map.get(temp);
					map.put(temp, value + 1);
				}
				else{
					map.put(temp, 1);
				}
			}

			boolean isOK = true;
			for(char key: map.keySet()){
				int temp = map.get(key);
				if(temp % n != 0){
					isOK = false;
				}
			}
			if(! isOK){
				System.out.println(-1);
			}
			
			else{
				StringBuilder sb = new StringBuilder();
				for(int ni = 0; ni < n; ni++){
					for(char key: map.keySet()){
						int times = map.get(key) / n;
						for(int i = 0; i < times; i++){
							sb.append(key);
						}
					}
				}
				System.out.println(sb.toString());
			}
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

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

#include<string>

int main(){
	static char str[10010];
	int i, len, joiCount = 0, ioiCount = 0;
	scanf("%s", str);
	len = strlen(str);
	for(i = 2; i < len; i++){
		if(str[i-2] == 'J' && str[i-1] == 'O' && str[i] == 'I'){
			joiCount++;
		}
		if(str[i-2] == 'I' && str[i-1] == 'O' && str[i] == 'I'){
			ioiCount++;
		}
	}
	printf("%d\n%d\n", joiCount, ioiCount);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'strlen' was not declared in this scope
    7 |         len = strlen(str);
      |               ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<string>
  +++ |+#include <cstring>
    2 |
Language: C++

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

int main(){

string a;
int f;
cin >> a;
f=a.size()
int c;
c=0;
int d[f];
while(c<f){
string b(a,c,1);
if(b=="J"){d[c]=1;}
if(b=="O"){d[c]=2;}
if(b=="I"){d[c]=3;}
c=c+1;}
c=0;
int g;
int h;
g=0;
h=0;
while(c<10000){
if(d[c]==1){if(d[c+1]==2){if(d[c+2]==3){g=g+1;}}}
if(d[c]==3){if(d[c+1]==2){if(d[c+2]==3){h=h+1;}}}
c=c+1;}
cout << g <<endl;
cout << h <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: expected ';' before 'int'
   10 | f=a.size()
      |           ^
      |           ;
   11 | int c;
      | ~~~        
a.cc:12:1: error: 'c' was not declared in this scope
   12 | c=0;
      | ^
Language: C++

#include <cstdio>
#include <cstring>

int main()
{
while(true) {
char str[20000];
if(scanf("%s", str) == EOF)
break;
int len = strlen(str);
int joi = 0. ioi = 0;
char joistr[] = "JOI", ioistr[] = "IOI";
for(int it = 0; it < len - 2; ++it) {
bool joivalid = true, ioivalid = true;
for(int i = 0; i < 3; ++i) {
if(joistr[i] != str[i + it])
joivalid = false;
if(ioistr[i] != str[i + it])
ioivalid = false;
}
if(joivalid) ++joi;
if(ioivalid) ++ioi;
}
printf("%d\n%d\n", joi, ioi);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: expected ',' or ';' before 'ioi'
   11 | int joi = 0. ioi = 0;
      |              ^~~
a.cc:22:16: error: 'ioi' was not declared in this scope; did you mean 'joi'?
   22 | if(ioivalid) ++ioi;
      |                ^~~
      |                joi
a.cc:24:25: error: 'ioi' was not declared in this scope; did you mean 'joi'?
   24 | printf("%d\n%d\n", joi, ioi);
      |                         ^~~
      |                         joi
Language: C++

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

int main()
{
	string word;
	int count;
	while(cin>>word)
	{
		for(int i=0,count=0;(i=word.find("JOI",i))!=word.npos; i++)
		
		count++;
			 cout<<count<<endl;
		
		for(int i=0,count=0;(i=word.find("IOI",i))!=word.npos; i++)
		
			numb++;
			cout<<numb<<endl;
		
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'numb' was not declared in this scope
   18 |                         numb++;
      |                         ^~~~
a.cc:19:31: error: 'numb' was not declared in this scope
   19 |                         cout<<numb<<endl;
      |                               ^~~~
Language: C++

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

int main(){
    int joi,ioi;
    char JOI[4]="JOI";
    char IOI[4]="IOI";
    char s[10004];
    char than[4];
    while(scanf("%s",s) != EOF){
        joi=0;
        ioi=0;
        for(int i=0;s[i]!='\0';i++){
            than[0] = s[i];
            than[1] = s[i+1];
            than[2] = s[i+2];
            if(strcmp(than,JOI) == 0){
                joi++;
            }
            else if(strcmp(than,IOI) == 0){
                ioi++;
            }
        }
        cout << joi << endl;
        cout << ioi << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: 'strcmp' was not declared in this scope
   19 |             if(strcmp(than,JOI) == 0){
      |                ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,JOI=0,IOI=0;
  char s[10000];
  while(scanf("%s",s)!=EOF){
    n=strlen(s);
    for(int i=0;i<n;i++){
      if(s[i]=='J'){
	if(s[i+1]=='O'){
	  if(s[i+2]=='I'){
	    JOI++;
	  }
	}
      }
      else if(s[i]=='I'){
	if(s[i+1]=='O'){
	  if(s[i+2]=='I'){
	    IOI++;
	  }
	}
      }
    }
    cout << JOI << endl << IOI << endl;
    JOI=0;
    IOI=0;
  }
  return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'strlen' was not declared in this scope
    8 |     n=strlen(s);
      |       ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,JOI=0,IOI=0;
  char s[100000];
  while(scanf("%s",s)!=EOF){
    n=strlen(s);
    for(int i=0;i<n;i++){
      if(s[i]=='J'){
	if(s[i+1]=='O'){
	  if(s[i+2]=='I'){
	    JOI++;
	  }
	}
      }
      else if(s[i]=='I'){
	if(s[i+1]=='O'){
	  if(s[i+2]=='I'){
	    IOI++;
	  }
	}
      }
    }
    cout << JOI << endl << IOI << endl;
    JOI=0;
    IOI=0;
  }
  return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'strlen' was not declared in this scope
    8 |     n=strlen(s);
      |       ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<string>

using namespace std;

const string IOI = "IOI";
const string JOI = "JOI";

int main(){
	sring str;
	
	while(1){
		cin >> str;
		
		if(str == EOF)break;
		
		int ioicnt = 0;
		int joicnt = 0;
		int len = str.length();

		for(int i=0;i<len;i++){
			if(str[i] == IOI[0]){
				if(i+1 < len && i+2 < len && str[i+1] == IOI[1] && str[i+2] == IOI[2]){
					ioicnt++;
				}
				else if(i+1 < len && str[i+1] == JOI[0]){
					i++;
					goto JOI;
				}
			}
			else if(str[i] == JOI[0]){
				JOI:
				if(i+1 < len && i+2 < len && str[i+1] == JOI[1] && str[i+2] == JOI[2]){
					joicnt++;
					i++;
				}
			}
		}


		cout << joicnt << endl;

		cout << ioicnt << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sring' was not declared in this scope
   10 |         sring str;
      |         ^~~~~
a.cc:13:24: error: 'str' was not declared in this scope; did you mean 'std'?
   13 |                 cin >> str;
      |                        ^~~
      |                        std
Language: C++

#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
  int n ,cnt=0 ,cont=0;
  char s[10000];
  while( cin >> s ){
  n = strlen(s);

  for( int i=0 ; i<n ; i++ ){
    if( s[i] == 'J' && s[i+1] == 'O' && s[i+2] == 'I' ){
      cnt++;
    }

    if( s[i] == 'I' && s[i+1] == 'O' && s[i+2] == 'I' ){
      cont++;
    }
  }

  cout << cnt << endl << cont << endl;
  cnt = 0;
  cont = 0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'strlen' was not declared in this scope
    9 |   n = strlen(s);
      |       ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cstdio>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
  int n ,cnt=0 ,cont=0;
  char s[10000];
  while( cin >> s ){
  n = strlen(s);

  for( int i=0 ; i<n ; i++ ){
    if( s[i] == 'J' && s[i+1] == 'O' && s[i+2] == 'I' ){
      cnt++;
    }

    if( s[i] == 'I' && s[i+1] == 'O' && s[i+2] == 'I' ){
      cont++;
    }
  }

  cout << cnt << endl;
  cout << cont << endl;
  cnt = 0;
  cont = 0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'strlen' was not declared in this scope
    8 |   n = strlen(s);
      |       ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

string n;

int main(void)
{
	while(cin >> n && n != "")
	{
		cout << count(n.begin(), n.end(), "JOI") << endl;
		cout << count(n.begin(), n.end(), "IOI") << endl;
	}
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/string:51,
                 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/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_equals_val<_Value>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >; _Value = const char [4]]':
/usr/include/c++/14/bits/stl_algobase.h:2163:12:   required from 'typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::__count_if(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const char [4]>; typename iterator_traits< <template-parameter-1-1> >::difference_type = long int]'
 2163 |         if (__pred(__first))
      |             ~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4033:29:   required from 'typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&) [with _IIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >; _Tp = char [4]; typename iterator_traits< <template-parameter-1-1> >::difference_type = long int]'
 4033 |       return std::__count_if(__first, __last,
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
 4034 |                              __gnu_cxx::__ops::__iter_equals_val(__value));
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:16:   required from here
   24 |                 cout << count(n.begin(), n.end(), "JOI") << endl;
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:270:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  270 |         { return *__it == _M_value; }
      |                  ~~~~~~^~~~~~~~~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(){
	char s[10000];
	while(~scanf("%s",s)){
		int length = strlen(s);
		int I,J;
		I=J=0;
		for(int i=0;i<length;i++){
			if(i+2>=length) break;
			if(s[i]=='J'){
				if(s[i+1]=='O'){
					if(s[i+2]=='I') J++;
				}
			}
			if(s[i]=='I'){
				if(s[i+1]=='O'){
					if(s[i+2]=='I') I++;
				}
			}
		}
		printf("%d\n%d\n",J,I);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:30: error: 'strlen' was not declared in this scope
    8 |                 int length = strlen(s);
      |                              ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C

#include<stdio.h>
#include<algorithm>
using namespace std;
int n,cardta[1000],cardha[1000];
int i,j,h,flg,flg1,flg2,ta,ha,temp;
int ba,cntta,cntha;
int main(void){
	scanf("%d",&n);
	while(n!=0){
		h=0;
		ta=0;
		ha=0;
		for(i=0;i<n;i++){
			scanf("%d",&cardta[i]);
		}
		for(i=1;i<=n*2;i++){	//花子が持っているカード抽出
			flg=0;
			for(j=0;j<n;j++){
				if(cardta[j]==i){
					flg=1;
					break;
				}
			}
			if(flg==0){
				cardha[h]=i;
				h++;
			}
		}	
		sort(cardta,cardta+n);
		flg1=0;
		flg2=0;
		flg=1;
		while(flg1!=1 && flg2!=1){
				ba=0;
				flg1=1;
				flg2=1;
				//flg=1;
				while(1){//カードゲーム処理
					if(flg==1){
						for(i=0;i<n;i++){
							if(ba<cardta[i]){
								ba=cardta[i];
								//	printf("bata=%d\n",ba);
								cardta[i]=-1000;
								//printf("flga=%d\n",flg);
								flg=2;
								break;
							}
						}
					}
					if(flg==1){
						flg=2;
						break;
					}
					if(flg==2){
						for(j=0;j<n;j++){
							if(ba<cardha[j]){
								ba=cardha[j];
								//printf("baha=%d\n",ba);
								cardha[j]=-1000;
							//	printf("flgb=%d\n",flg);
								flg=1;
								break;
							}
						}
					}
					if(flg==2){
						flg=1;
						break;
					}
				}
				for(i=0;i<n;i++){	//太郎花子のカード　すべて上書き（-1000）してたら終了
					if(cardta[i]!=-1000)flg1=0;
					if(cardha[i]!=-1000)flg2=0;
				}
				//printf("\n");
		}
		//printf("%d\n%d\n",ta,ha);
		cntta=0;
		cntha=0;
		/*for(i=0;i<n;i++){
			printf("ta%d,ha%d\n",cardta[i],cardha[i]);
		}*/
		for(i=0;i<n;i++){
			if(cardta[i]!=-1000){
				cntta++;
			}
			if(cardha[i]!=-1000){
				cntha++;
			}
		}
		printf("%d\n%d\n",cntha,cntta);
		scanf("%d",&n);
	}
	return 0;
}

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

#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
    while(1){
        int n,x;
        int i,j;
        int tarou[110] = {0},hanako[110] = {0};
        int field = 0;
        int flg1 = 0,flg2 = 0;
        scanf("%d",&n);
        if(n == 0) break;
        for(i = 0; i < n; i++){
            scanf("%d",&x);
            tarou[x-1] = x;
        }
        for(i = 0; i < n * 2; i++){
            if(tarou[i] == 0) hanako[i] = i+1;
        }

        sort(tarou,tarou+n*2,greater<int>());
        sort(hanako,hanako+n*2,greater<int>());
        sort(tarou,tarou+n);
        sort(hanako,hanako+n);

        while(1){
            //太郎の番
            for(j = 0; j < n; j++){
                if(field < tarou[j]){
                    field = tarou[j];
                    tarou[j] = -1;
                    flg1++;
                    goto next;
                }
            }
            field = 0;
            next :
            if(flg1 == n || flg2 == n) break;
            for(j = 0; j < n; j++){
                if(field < hanako[j]){
                    field = hanako[j];
                    hanako[j] = -1;
                    flg2++;
                    goto next2 ;
                }
            }
            field = 0;
            next2 :
            if(flg1 == n || flg2 == n) break;
        }
        printf("%d\n%d\n",n-flg2,n-flg1);
    }

    return 0;
}

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

#include<iostream>
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        bool t[n+1], h[n+1];
        int taro = n, hana = n;
        
        for(int i = 0; i < n+1; i++)
            t[i] = false;
        
        for(int i = 0; i < n; i++){
            int x;
            cin >> x;
            t[x] = true;
        }
        for(int i = 1; i <= n; i++)
            h[i] = !t[i];
        
        bool turn = true;
        int ba = 0;
        while(taro != 0 && hana != 0){
            if(turn){
                int next;
                for(next = ba+1; next <= n; next++){
                    if(t[next]){
                        t[next] = false;
                        break;
                    }
                }
                if(next <= n){
                    ba = next;
                    taro--;
                }else{
                    ba = 0;
                }
            }else{
                int next;
                for(next = ba+1; next <= n; next++){
                    if(h[next]){
                        h[next] = false;
                        break;
                    }
                }
                if(next <= n){
                    ba = next;
                    hana--;
                }else{
                    ba = 0;
                }
            }
            turn = !turn;
        }
        
        int sum = 0;
        if(taro == 0){
            for(int i = 1; i <= n; i++)
                if(hana[i]) sum += i;
        }else if(hana == 0){
            for(int i = 1; i <= n; i++)
                if(taro[i]) sum += i;
        }
        
        cout << sum << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:24: error: invalid types 'int[int]' for array subscript
   59 |                 if(hana[i]) sum += i;
      |                        ^
a.cc:62:24: error: invalid types 'int[int]' for array subscript
   62 |                 if(taro[i]) sum += i;
      |                        ^
Language: C++

#include <cstdio>

int n, tn, hn, turn, card;
bool t[201], h[201];

int main(){
	while(scanf("%d", &n)){
		if(n == 0) break;
		tn = n; hn = n;
		turn = 1; card = 0;
		for(int i = 1; i <= 200; i++){
			t[i] = false;
			h[i] = false;
		}
		for(int i = 1; i <= n; i++){
			int tmp; scanf("%d", &tmp);
			t[tmp] = true;
		}
		for(int i = 1; i <= 2*n; i++) if(!t[i]) h[i] = true;
		while(true){
			bool ok = true;
			if(tn == 0 || hn == 0){
				printf("%d\n%d\n", hn, tn);
				break;
			}
			if(turn == 1){
				for(int i = card+1; i <= 2*n; i++){
					if(t[i]){
						t[i] = false;
						card = i;
						turn = 2;
						tn--;
						ok = false;
						break;
					}
				}
				if(ok){
					turn = 2;
					card = 0;
				}
			} else{
				for(int i = card+1; i <= 2*n; i++){
					if(h[i]){
						h[i] = false;
						card = i;
						turn = 1;
						hn--;
						ok = false:
						break;
					}
				}
				if(ok){
					turn = 1;
					card = 0;
				}
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:59: error: expected ';' before ':' token
   48 |                                                 ok = false:
      |                                                           ^
      |                                                           ;