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

#include<bits/stdc++.h>
using namespace std;
char s[100005];
int len,i,score=0,p=0;
//g->rock  p->paper  p=rock-paper>=0
int main()
{gets(s);
len=strlen(s);
 for(i=0;i<len;i++)
  if(s[i]=='g')
  {if(p<1) p++;
   else {p--; score++;} 
  }
  else{
  if(p<1) {p++; score--;}
  else p--;
  }
 cout<<score; 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 | {gets(s);
      |  ^~~~
      |  getw
Language: C

#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
char s[100010];
int main()
{
	int len=0;
	int p=0,g=0;
	while(cin>>s[++len]) 
	{
		if(s[len]=='p') p++;
		if(s[len]=='g') g++;
	}
	int num=len/2;
	if(p<g) cout<<num-p;
	if(p==g) cout<<0;
	if(p>g) cout<<num-p;
	return 0;
}

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

#include<iostream>
#include<cstring>
using namespace std;
char s[100001];
int main()
{
	gets(s);
	int sum=0,len=strlen(s),ans=0;
	int k=len/2;//布最多能出的次数 
	for(int i=0;i<=len-1;i++)
		if(s[i]=='p'||s[i]=='P')
			ans++;
	cout<<k-ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
char s[1000000];
int a[1000000]={1,0},n,b[1000000];
int main()
{
	gets(s);
	int lens=strlen(s);
	for(int i=0;i<=lens-1;i++)
	{
		if(s[i]=='g') b[i]=0;
		else b[i]=1;
	}
	for(int i=2;i<=lens;i++)
	{
		if(i%2==0) a[i]=0;
		else a[i]=1;
	}
	for(int i=0;i<=lens-1;i++)
	{
		if(a[i]<b[i]) n=n-1;
		if(a[i]>b[i]) n=n+1;
	}
	cout<<n;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
char s[1000000];
int a[1000000]={1,0},n,b[1000000];
int main()
{
	gets(s);
	int lens=strlen(s);
	for(int i=0;i<=lens-1;i++)
	{
		if(s[i]=='g') b[i]=0;
		else b[i]=1;
	}
	for(int i=2;i<=lens;i++)
	{
		if(i%2==0) a[i]=0;
		else a[i]=1;
	}
	for(int i=0;i<=lens-1;i++)
	{
		if(a[i]<b[i]) n=n-1;
		if(a[i]>b[i]) n=n+1;
	}
	cout<<n;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
char s[1000000];
int a[1000000]={0,1,0},n,b[1000000];
int main()
{
	gets(s);
	int lens=strlen(s);
	for(int i=1;i<=lens;i++)
	{
		if(s[i]=='g') b[i]=0;
		else b[i]=1;
	}
	for(int i=3;i<=lens;i++)
	{
		if(i%2==0) a[i]=1;
		else a[i]=0;
	}
	for(int i=1;i<=lens;i++)
	{
		if(a[i]<b[i]) n=n-1;
		if(a[i]>b[i]) n=n+1;
	}
	cout<<n+1;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{    
	char s[100005];    
	gets(s);  
	int sum=0, lens=strlen(s), p=0, g=0;    
	for(int i=0;i<lens;i++){        
		if(s[i]=='g'){            
			if(g>p){               
  				sum++;                
  				p++;
			}           
   			else                
   			g++;        
   		}        
   		else{            
			if(g>p)               
	 			p++;            
	 		else{                
	  			sum--;               
	   			g++;            
	   		}        
	   	}    
	}   
	cout<<sum;   
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h> 
using namespace std;
char s[100006];
int i,len;
int  main(){
	scanf("%s",s);
	len=strlen(s);
	int g=0,p=0,sum=0; 
	for(i=1;i<=len;i++)
	{
		if(s[i]=='g')
		{
			if(g>p)
			{
				sum++;
				p++;
			}
			else
			g++;
		}
		else(s[i]=='p')
		{
			if(g>p)
			p++;
			else
			{
				sum--;
				g++;
			}
		}
	}
	printf("%d\n",sum);
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:21:32: error: expected ';' before '{' token
   21 |                 else(s[i]=='p')
      |                                ^
      |                                ;
   22 |                 {
      |                 ~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
char s[100006];
int g,p,i,sum,len;
int  main(){
	scanf("%s",s);
	len=strlen(s);
	for(i=1;i<=len;i++)
	{
		if(s[i]=='g')
		{
			if(g>p)
			{
				sum++;
				p++;
			}
			else
			g++;
		}
		if(s[i]=='p')
		{
			if(g>p)
			p++;
			else
			{
				sum--;
				g++;
			}
		}
	}
	prinf("%d\n",sum);
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   31 |         prinf("%d\n",sum);
      |         ^~~~~
      |         printf
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map> 
#include<stack> 
#include<set>
#include<deque> 
#include<vector> 
#include<queue> 
#include<string>
#include<fstream> 
#include<algorithm> 
using namespace std;
char s[100006];
int g,p,i,sum,len;
int  main(){
	scanf("%s",s);
	len=strlen(s);
	for(i=1;i<=len;i++)
	{
		if(s[i]=='g')
		{
			if(g>p)
			{
				sum++;
				p++;
			}
			else
			g++;
		}
		if(s[i]=='p')
		{
			if(g>p)
			p++;
			else
			{
				sum--;
				g++;
			}
		}
	}
	prinf("%d\n",sum);
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:43:9: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   43 |         prinf("%d\n",sum);
      |         ^~~~~
      |         printf
Language: C++

#include<bits/stdc++.h>
using namespace std;
char s[10005];
int n,delta=0,ans=0;
bool a[10005];
int main()
{
	scanf("%s",s+1),n=strlen(s+1);
	for(int i=1;i<=n;++i)a[i]=(s[i]=='p');
	for(int i=1;i<=n;++i){
		if(delta<=0)++delta,ans-=col[i];
		else --delta,ans+=(!col[i]);
	}
	cout<<ans;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:42: error: 'col' was not declared in this scope; did you mean 'cosl'?
   11 |                 if(delta<=0)++delta,ans-=col[i];
      |                                          ^~~
      |                                          cosl
a.cc:12:37: error: 'col' was not declared in this scope; did you mean 'cosl'?
   12 |                 else --delta,ans+=(!col[i]);
      |                                     ^~~
      |                                     cosl
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
char str[maxn];
int main()
{
    while(scanf("%s",str)!=EOF)
    {
        int gg=0,pp=0,ans=0;
        int len=strlen(str);
        for(int i=0; i<len; i++)
        {
            if(str[i]=='g')
            {
                if(pp<gg)ans++,pp++;
                else gg++;
            }
            else
            {
                if(pp<gg)pp++;
                else gg++,ans--;
            }
        }
        printf("%d\n",ans);
    }
}

---------------------

本文来自 kuronekonano 的CSDN 博客 ，全文地址请点击：https://blog.csdn.net/kuronekonano/article/details/80518857?utm_source=copy 

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

#include<bits/stdc++.h>
using namespace std;
char topco[10010];
//short topco_paper[10010],topco_rock[10010];
//int t_p_head,t_p_tail,t_r_tail,t_r_head;
int t_p_top,t_r_top;//topco的指针； 
int t_lenp,t_lenr;//,a_lenp,a_lenr; 
int main()
{
	gets(topco);
	int lent=strlen(topco);
	for(int i=1;i<=lent;i++)
	{
		if(topco[i]=='p') t_lenp++;
		else t_lenr++;
	}
	if(t_lenp==t_lenr || t_lenp+1==t_lenr && lent%2!=0) 
	{
	    cout<<0<<endl;
		return 0;
	}
	//判断特殊情况;
	else
	{
		int atco_p_maxn=lent/2;
		cout<<atco_p_maxn-t_lenp<<endl;
	} 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |         gets(topco);
      |         ^~~~
      |         getw
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
char topco[10010];
//short topco_paper[10010],topco_rock[10010];
//int t_p_head,t_p_tail,t_r_tail,t_r_head;
int t_p_top,t_r_top;//topco的指针； 
int t_lenp,t_lenr;//,a_lenp,a_lenr; 
int main()
{
	gets(topco);
	int lent=strlen(topco);
	for(int i=1;i<=lent;i++)
	{
		if(topco[i]=='p') t_lenp++;
		else t_lenr++;
	}
	if(t_lenp==t_lenr || t_lenp+1==t_lenr && lent%2!=0) 
	{
	    cout<<0<<endl;
		return 0;
	}
	//判断特殊情况;
	else
	{
		int atco_p_maxn=lent/2;
		cout<<atco_p_maxn-t_lenp<<endl;
	} 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   11 |         gets(topco);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
char s[100002];
using namespace std;
int main()
{
	gets(s);
	int len=strlen(s),z=0;
	for(int i=0;i<len;i++)
	  {
	  	if(s[i]=='p')
	  	  z++;
	  }
	cout<<len/2-z;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
int f;
char c[100010];
int main(){
	gets(c);
	for(int i=0;i<strlen(c);i++)
	{
		if(c[i]=='p')
			if(i%2==0) f--;
		if(c[i]=='g')
			if(i%2==1) f++;
	}
	cout<<f;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(c);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
char s[100001];
int main()
{    
	scanf("%s",s+1);
	register int sum=0,l=strlen(s+1),p=0,g=0;
	for(register int i=1;i<=len;++i)
		if(s[i]=='g')
			if(g>p)
				++sum,++p;
			else
				++g;
		else
			if(g>p)
				++p;
			else
				--sum,g++;
	return printf("%d",sum),0;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |         register int sum=0,l=strlen(s+1),p=0,g=0;
      |                      ^~~
a.cc:7:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |         register int sum=0,l=strlen(s+1),p=0,g=0;
      |                            ^
a.cc:7:42: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |         register int sum=0,l=strlen(s+1),p=0,g=0;
      |                                          ^
a.cc:7:46: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |         register int sum=0,l=strlen(s+1),p=0,g=0;
      |                                              ^
a.cc:8:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |         for(register int i=1;i<=len;++i)
      |                          ^
a.cc:8:33: error: 'len' was not declared in this scope
    8 |         for(register int i=1;i<=len;++i)
      |                                 ^~~
Language: C++

#include<bits/stdc++.h>
char a;
int b[2];
int main(){
  while((a=getchar())!=EOF) b[a=='g']++;
  cout << (b[1]-b[0])>>1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    6 |   cout << (b[1]-b[0])>>1;
      |   ^~~~
      |   std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

//贪心出招，尽可能出布。 
#include<bits/stdc++.h>
using namespace std;
int main(){
	int s=0,b=0,an=0;
	string s;
	getling(cin,s);
	for(int i=0;i<s.size();i++){
		if(s[i]=='g'){
			if(b<s) b++,an++;
			else s++; 
		}else{
			if(b<s) b++;
			else s++,an--;
		}
	}
	cout<<an<<endl;
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: conflicting declaration 'std::string s'
    6 |         string s;
      |                ^
a.cc:5:13: note: previous declaration as 'int s'
    5 |         int s=0,b=0,an=0;
      |             ^
a.cc:7:9: error: 'getling' was not declared in this scope; did you mean 'getline'?
    7 |         getling(cin,s);
      |         ^~~~~~~
      |         getline
a.cc:8:25: error: request for member 'size' in 's', which is of non-class type 'int'
    8 |         for(int i=0;i<s.size();i++){
      |                         ^~~~
a.cc:9:21: error: invalid types 'int[int]' for array subscript
    9 |                 if(s[i]=='g'){
      |                     ^
Language: C++

//贪心出招，尽可能出布。 
#include<bits/stdc++.h>
using namespace std;
int main(){
	int s=0,b=0,an=0;
	string s;
	getling(cin,s);
	for(int i=0;i<s.size();i++){
		if(s[i]=='g'){
			if(b<s) b++,an++;
			else s++; 
		}else{
			if(b<s) b++;
			else s++,ans--;
		}
	}
	cout<<an<<endl;
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: conflicting declaration 'std::string s'
    6 |         string s;
      |                ^
a.cc:5:13: note: previous declaration as 'int s'
    5 |         int s=0,b=0,an=0;
      |             ^
a.cc:7:9: error: 'getling' was not declared in this scope; did you mean 'getline'?
    7 |         getling(cin,s);
      |         ^~~~~~~
      |         getline
a.cc:8:25: error: request for member 'size' in 's', which is of non-class type 'int'
    8 |         for(int i=0;i<s.size();i++){
      |                         ^~~~
a.cc:9:21: error: invalid types 'int[int]' for array subscript
    9 |                 if(s[i]=='g'){
      |                     ^
a.cc:14:34: error: 'ans' was not declared in this scope; did you mean 'an'?
   14 |                         else s++,ans--;
      |                                  ^~~
      |                                  an
Language: C++

#include <iostream>
#include <string>
#include <vector>
#define ll long long
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	string S; cin >> S;
	cout << S.length() / 2 - count(S.begin(), S.end(), 'p') << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:34: error: 'count' was not declared in this scope
    9 |         cout << S.length() / 2 - count(S.begin(), S.end(), 'p') << endl;
      |                                  ^~~~~
Language: C++

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

int main() {
	int p = 0;
	int n = 0;
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == "p") p++;
	}
	n = s.size() / 2;
	cout << (int) n - p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |                 if(s[i] == "p") p++;
Language: C++

//
//  main.cpp
//  BC20161109
//
//  Created by TA on 2016/11/09.
//  Copyright © 2016年 TA. All rights reserved.
//

#include <iostream>
#include <list>
#include <String>
using namespace std;

int main(int argc, const char * argv[]) {
    string str;
    int p = 0,g = 0,count = 0 ,point = 0;
    while (cin >> str) {
        for (int i =0; i < str.length() ; i++) {
            if (str[i] == 'g') {
                if (count > 0) {
                    point ++ ;
                    count--;
                }
                else
                    
                count ++;
            }
            else
            {if (count > 0) {
                count --;
            }
            else
                point --;
                count ++;
                
            }
        }
    }
    cout << point << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
string S;
int main(){
	cin>>S;int pos=(S.size()+1)/2;
	for(int i=0;i<pos;i++){if(S[i]=='p')cnt--;}
	for(int i=pos;i<S.size();i++){if(S[i]=='g')cnt++;}
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:45: error: 'cnt' was not declared in this scope; did you mean 'int'?
    6 |         for(int i=0;i<pos;i++){if(S[i]=='p')cnt--;}
      |                                             ^~~
      |                                             int
a.cc:7:52: error: 'cnt' was not declared in this scope; did you mean 'int'?
    7 |         for(int i=pos;i<S.size();i++){if(S[i]=='g')cnt++;}
      |                                                    ^~~
      |                                                    int
a.cc:8:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
    8 |         cout<<cnt<<endl;
      |               ^~~
      |               int
Language: C++

#include<iostream>
#include<string>
using namespace std;
string s;
int p;
int main() {
cin>>s;
for(int i=0;i<s.length;i++){
if(s[i]=='p') p++;
}
cout <<s.length/2-p<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    8 | for(int i=0;i<s.length;i++){
      |               ~~^~~~~~
      |                       ()
a.cc:11:10: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   11 | cout <<s.length/2-p<<endl;
      |        ~~^~~~~~
      |                ()
Language: C++

#include<iostream>
#include<string>
string s;
int p;
int main() {
cin>>s;
for(int i=0;i<s.length;i++){
if(s[i]=='p') p++;
}
cout <<s.length/2-p<<endl;
return 0;
}

Compiler output:
a.cc:3:1: error: 'string' does not name a type; did you mean 'stdin'?
    3 | string s;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:6:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 | cin>>s;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:6: error: 's' was not declared in this scope
    6 | cin>>s;
      |      ^
a.cc:10:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 | cout <<s.length/2-p<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 | cout <<s.length/2-p<<endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
string s;
int p;
int main() {
cin>>s;
for(int i=0;i<s.length;i++){
if(s[i]=='p') p++;
}
cout <<s.length/2-p<<endl;
return 0;
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
    2 | string s;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 | cin>>s;
      | ^~~
      | 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:5:6: error: 's' was not declared in this scope
    5 | cin>>s;
      |      ^
a.cc:9:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 | cout <<s.length/2-p<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:9:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    9 | cout <<s.length/2-p<<endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		char[] rp = s.toCharArray();
		int paper = 0;
		int rock = 0;
		int win = 0;
		int lose = 0;
		int turn = 0;
		while(turn<rp.length){
			if (rp[turn]=='g'){
				if (paper<rock){
					paper++;
					win++;
				}
				else{
					rock++;
				}
			}
			else if (rp[turn]=='p'){
				if (paper<rock){
					paper++;
				}
				else{
					rock++;
					lose++;
				}
			}
			turn++;
		}
		System.out.println(win-lose);

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
		Scanner sc = new Scanner(System.in);
		^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: class, interface, enum, or record expected
		while(turn<rp.length){
		^
Main.java:13: error: class, interface, enum, or record expected
					win++;
					^
Main.java:14: error: class, interface, enum, or record expected
				}
				^
Main.java:17: error: class, interface, enum, or record expected
				}
				^
Main.java:22: error: class, interface, enum, or record expected
				}
				^
Main.java:25: error: class, interface, enum, or record expected
					lose++;
					^
Main.java:26: error: class, interface, enum, or record expected
				}
				^
Main.java:29: error: class, interface, enum, or record expected
		}
		^
9 errors
Language: C++

#include<stdio.h>
char a[100010];
int main(){
	int s=0,i;
	scanf("%s",a);
	for(i=0;i!='\0';i++){
		if(a[i]=='g')s++;
	}
	prinf("%d",s-(i+1)/2);
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'prinf' was not declared in this scope; did you mean 'printf'?
    9 |         prinf("%d",s-(i+1)/2);
      |         ^~~~~
      |         printf
Language: C++

#include<stdio.h>
char a[100010];
int main(){
	int s=0
	scanf("%s",a);
	for(i=0;a[i]!='\0';i++){
		if(a[i]=='g')s++;
	}
	printf("%d",s-(i+1)/2);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected ',' or ';' before 'scanf'
    5 |         scanf("%s",a);
      |         ^~~~~
a.cc:6:13: error: 'i' was not declared in this scope
    6 |         for(i=0;a[i]!='\0';i++){
      |             ^
a.cc:9:24: error: 'i' was not declared in this scope
    9 |         printf("%d",s-(i+1)/2);
      |                        ^
Language: C++

#include<stdio.h>
char a[100100];
int main()
{
int z,i,p=0;
scanf("%s",a);
z=strlen(a);

for(i=0;i<z;i++)
{
if(a[i]=='p')p++;
}

printf("%d",(z/2)-p);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'strlen' was not declared in this scope
    7 | z=strlen(a);
      |   ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<stdio.h>
  +++ |+#include <cstring>
    2 | char a[100100];
Language: C++

#include <stdio.h>
char a[100010]
int main(){
	int s=0
	scanf("%s",a);
	for(i=0;a[i]!='\0';i++){
		if(a[i]=='g') s++;
	}
	printf("%d",s-i/2);
}

Compiler output:
a.cc:3:1: error: expected initializer before 'int'
    3 | int main(){
      | ^~~
Language: C++

#include<stdio.h>
#include<string.h>
char a[100100];
int main()
{
int z,i,p=0;
gets(a);
z=strlen(a);

for(i=0;i<z;i++)
{
if(a[i]=='p')p++;
}

printf("%d",(z/2)-p);
}

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

#include<stdio.h>
#include<cstring>
char a[100100];
int main()
{
int z,i,p=0;
gets(a);
z=strlen(a);

for(i=0;i<z;i++)
{
if(a[i]=='p')p++;
}

printf("%d",(z/2)-p);
}

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

#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define PP pop_back()
#define set(x,y) memset(x,y,sizeof(x))
#define MIN3(x,y,z) min(min(x,y),z)
#define MAX3(x,y,z) max(max(x,y),z)
#define ALL(x) x.begin(),x.end()
#define sz(x) (int) x.size()
#define sag(x) 2*x+1
#define sol(x) 2*x
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define ROF(i,j,k) for(int i=j;i>=k;i--)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pii pair<int,int>
#define st first
#define nd second
#define ll long long
#define llu long long unsigned
#define lf double
#define orta (bas+son)/2
#define MOD 1000000007
#define inf 1000000000
#define N 200005
using namespace std;
map<int,int> dp[N],vis[N];
char s[N];
int dfs(int n,int b) {
    if(n>len) return 0;
    if(vis[n][b]==1) return dp[n][b];
    int ret1=0,ret2=0;
    if(b)
        ret1=dfs(n+1,b-1)+(s[n]=='g'),ret2=dfs(n+1,b+1)-(s[n]=='p');
    else
        ret2=dfs(n+1,b+1)-(s[n]=='p');
    vis[n][b]=1;
    return dp[n][b]=max(ret1,ret2);
}
int main() {
    scanf("%s",s+1);
    len=strlen(s+1);
    printf("%d",dfs(1,0));
}


Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:30:10: error: 'len' was not declared in this scope
   30 |     if(n>len) return 0;
      |          ^~~
a.cc: In function 'int main()':
a.cc:42:5: error: 'len' was not declared in this scope
   42 |     len=strlen(s+1);
      |     ^~~
Language: C++

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    long long g, p = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'g') g++;
        else p++;
    }

    long long my_p = s.size() / 2;
    long long my_g = s.size() - my_p;

    if (my_p > g) {
        long long ans = g - my_g;
    } else {
        long long ans = my_p - p;
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <stdio.h>
#define MAX 10000
int main()
{
	int n = 0;
	char c[MAX];
	c[0] = getchar();
	int i=0,ans = 0;
	
	for(n = 1;c[n-1] != '\n';n++){
		c[n]=getchar();
		if(c[n] == 'g'){
			if(i <= 0){
				ans += 1
				i -= 1;
			}else i +=1;
		}
		if(c[n] == 'p'){
			if(i <= 0){
				
				i -= 1;
			}else i +=1;
		}
	}
	printf("%d",answer);
		

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:41: error: expected ';' before 'i'
   14 |                                 ans += 1
      |                                         ^
      |                                         ;
   15 |                                 i -= 1;
      |                                 ~        
a.cc:25:21: error: 'answer' was not declared in this scope
   25 |         printf("%d",answer);
      |                     ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
const int INF = 1 << 7;
const int M = 100000;

string s;
int n;
int a[M][M];

int dp(int i, int j) {
  if (i == n) {
    return 0;
  }
  if (a[i][j] != INF) {
    return a[i][j];
  }
  if (j == 0) {
    a[i][j] = dp(i + 1, 1) + ((s[i] == 'g') ? 0 : -1); // gを出す
    return a[i][j];
  } else {
    ll x = dp(i + 1, j + 1) + ((s[i] == 'g') ? 0 : -1); // gを出す
    ll y = dp(i + 1, j - 1) + ((s[i] == 'g') ? 1 : 0);  // pを出す
    a[i][j] = max(x, y);
    return a[i][j];
  }
}

int main() {
  cin >> s;
  n = s.size();
  rep(i, n) {
    rep(j, n) { a[i][j] = INF; }
  }
  cout << dp(0, 0) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int dp(int, int)':
a.cc:23:5: error: 'll' was not declared in this scope
   23 |     ll x = dp(i + 1, j + 1) + ((s[i] == 'g') ? 0 : -1); // gを出す
      |     ^~
a.cc:24:7: error: expected ';' before 'y'
   24 |     ll y = dp(i + 1, j - 1) + ((s[i] == 'g') ? 1 : 0);  // pを出す
      |       ^~
      |       ;
a.cc:25:19: error: 'x' was not declared in this scope
   25 |     a[i][j] = max(x, y);
      |                   ^
a.cc:25:22: error: 'y' was not declared in this scope
   25 |     a[i][j] = max(x, y);
      |                      ^
Language: C++

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <valarray>
#include <vector>
//
// Iteration
//
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define each(x, v) for (auto &&x : v) // as if v.each

//
// Debug
//
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;

//
// Vector
//
#define sort(v) sort(v.begin(), v.end())
// unique should be used with sort
#define unique(v) unique(v.begin(), v.end()) - v.begin()
#define lower_bound(v, x) lower_bound(v.begin(), v.end(), x);
#define upper_bound(v, x) upper_bound(v.begin(), v.end(), x);

//
// Namespace
//
using namespace std;

//
// Type
//
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 10;
const int M = 100100;
const double EPS = 1e-10;
static const double pi = 3.1415926535897932;

string s;
ll n;
ll a[M][M];
ll x, y;

ll dp(ll i, ll j) {
  if (i == n) {
    return 0;
  }
  if (a[i][j] != INF) {
    return a[i][j];
  }
  if (j == 0) {
    a[i][j] = dp(i + 1, 1) + ((s[i] == 'g') ? 0 : -1); // gを出す
    return a[i][j];
  } else {
    x = dp(i + 1, j + 1) + ((s[i] == 'g') ? 0 : -1); // gを出す
    y = dp(i + 1, j - 1) + ((s[i] == 'g') ? 1 : 0);  // pを出す
    a[i][j] = max(x, y);
    return a[i][j];
  }
}

int main() {
  cin >> s;
  n = s.size();
  rep(i, n) {
    rep(j, n) { a[i][j] = INF; }
  }
  cout << dp(0, 0) << endl;
  return 0;
}


Compiler output:
/tmp/ccE4NREg.o: in function `dp(long long, long long)':
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccE4NREg.o
a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccE4NREg.o
a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccE4NREg.o
a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccE4NREg.o
collect2: error: ld returned 1 exit status
Language: C++

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <valarray>
#include <vector>
//
// Iteration
//
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define each(x, v) for (auto &&x : v) // as if v.each

//
// Debug
//
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;

//
// Vector
//
#define sort(v) sort(v.begin(), v.end())
// unique should be used with sort
#define unique(v) unique(v.begin(), v.end()) - v.begin()
#define lower_bound(v, x) lower_bound(v.begin(), v.end(), x);
#define upper_bound(v, x) upper_bound(v.begin(), v.end(), x);

//
// Namespace
//
using namespace std;

//
// Type
//
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 10;
const int M = 100100;
const double EPS = 1e-10;
static const double pi = 3.1415926535897932;

string str;
ll n;
ll a[M][M];
ll x, y;

ll dp(ll i, ll j) {
  if (i == n) {
    return 0;
  }
  if (a[i][j] != INF) {
    return a[i][j];
  }
  if (j == 0) {
    a[i][j] = dp(i + 1, 1) + ((str[i] == 'g') ? 0 : -1); // gを出す
    return a[i][j];
  } else {
    x = dp(i + 1, j + 1) + ((str[i] == 'g') ? 0 : -1); // gを出す
    y = dp(i + 1, j - 1) + ((str[i] == 'g') ? 1 : 0);  // pを出す
    a[i][j] = max(x, y);
    return a[i][j];
  }
}

int main() {
  cin >> str;
  n = str.size();
  rep(i, n) {
    rep(j, n) { a[i][j] = INF; }
  }
  cout << dp(0, 0) << endl;
  return 0;
}


Compiler output:
/tmp/cc89DrEL.o: in function `dp(long long, long long)':
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc89DrEL.o
a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/cc89DrEL.o
a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/cc89DrEL.o
a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc89DrEL.o
collect2: error: ld returned 1 exit status
Language: C++

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <unordered_map>
#include <valarray>
#include <vector>
//
// Iteration
//
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define each(x,v) for(auto&&x:v) // as if v.each

//
// Debug
//
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;

//
// Vector
//
#define sort(v) sort(v.begin(), v.end())
// unique should be used with sort
#define unique(v) unique(v.begin(), v.end()) - v.begin()
#define lower_bound(v,x) lower_bound(v.begin(),v.end(), x);
#define upper_bound(v,x) upper_bound(v.begin(),v.end(), x);

//
// Namespace
//
using namespace std;

//
// Type
//
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 10;
const int M = 100100;
const double EPS = 1e-10;
static const double pi=3.1415926535897932;

string str;
ll n;
ll a[M][M];
ll x,y;

ll dp(ll i, ll j){
    if(i==n){
        return 0;
    }
    if(a[i][j]!=INF){
        return a[i][j];
    }
    if(j==0){
        a[i][j] = dp(i+1,1) + ((str[i]=='g') ? 0 : -1); // gを出す
        return a[i][j];
    }else{
        x = dp(i+1,j+1) + ((str[i]=='g') ? 0 : -1); // gを出す
        y = dp(i+1,j-1) + ((str[i]=='g') ? 1 : 0); // pを出す
        a[i][j] = max(x,y);
        return a[i][j];
    }
}

int main() {
  cin >> str;
  n = str.size();
  rep(i,n){
      rep(j,n){
          a[i][j] = INF;
      }
  }
  cout << dp(0,0) <<endl;
  return 0;
}


Compiler output:
/tmp/ccDeEBv6.o: in function `dp(long long, long long)':
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccDeEBv6.o
a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccDeEBv6.o
a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccDeEBv6.o
a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccDeEBv6.o
collect2: error: ld returned 1 exit status
Language: C++

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <unordered_map>
#include <valarray>
#include <vector>
//
// Iteration
//
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define each(x,v) for(auto&&x:v) // as if v.each

//
// Debug
//
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;

//
// Vector
//
#define sort(v) sort(v.begin(), v.end())
// unique should be used with sort
#define unique(v) unique(v.begin(), v.end()) - v.begin()
#define lower_bound(v,x) lower_bound(v.begin(),v.end(), x);
#define upper_bound(v,x) upper_bound(v.begin(),v.end(), x);

//
// Namespace
//
using namespace std;

//
// Type
//
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 10;
const int M = 100100;
const double EPS = 1e-10;
static const double pi=3.1415926535897932;

string str;
ll n;
ll a[M][M];
ll x,y;

ll dp(ll i, ll j){
    if(i==n){
        return 0;
    }
    if(a[i][j]!=INF){
        return a[i][j];
    }
    if(j==0){
        a[i][j] = dp(i+1,1) + ((str[i]=='g') ? 0 : -1); // gを出す
        cout << str[i] << " i=" << i << " j=" << j << " a[i][j]=" << a[i][j] << endl;
        return a[i][j];
    }else{
        x = dp(i+1,j+1) + ((str[i]=='g') ? 0 : -1); // gを出す
        y = dp(i+1,j-1) + ((str[i]=='g') ? 1 : 0); // pを出す
        a[i][j] = max(x,y);
        cout << str[i] << " i=" << i << " j=" << j << " a[i][j]=" << a[i][j] << endl;
        return a[i][j];
    }
}

int main() {
  cin >> str;
  n = str.size();
  rep(i,n){
      rep(j,n){
          a[i][j] = INF;
      }
  }
  cout << "initialisation done" << str.size() <<  endl;
  cout << dp(0,0) <<endl;
  return 0;
}


Compiler output:
/tmp/ccZGelT2.o: in function `dp(long long, long long)':
a.cc:(.text+0x244): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccZGelT2.o
a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccZGelT2.o
a.cc:(.text+0x29c): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccZGelT2.o
a.cc:(.text+0x2a6): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccZGelT2.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main(void){
  string source;
  cin >> source;
  int score = 0;
  for(int i = 0; i < source.size(); i++){
    if(i < source.size / 2){
      if(source[i] == 'p')score--;
      else score++;
    }else{
      if(source[i] == 'g')score++;
    }
  }
  cout << score << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   10 |     if(i < source.size / 2){
      |            ~~~~~~~^~~~
      |                       ()
Language: C

#include <stdio.h>
int main() {
    char s[1e6];
    int g = 0, p = 0;
    scanf("%s", s);
    while (*(++s)) {
        if (*s == 'g') {
            g++;
        } else {
            p++;
        }
    }
    printf("%d\n", g - p >> 1);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:10: error: size of array 's' has non-integer type
    3 |     char s[1e6];
      |          ^
main.c:6:14: error: lvalue required as increment operand
    6 |     while (*(++s)) {
      |              ^~
Language: C

#include <stdio.h>
int main() {
    char c;
    int g = 0, p = 0;
    while (c = getc(STDIN)) {
        if (c == 'g') {
            g++;
        } else {
            p++;
        }
    }
    printf("%d\n", g - p >> 1);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:21: error: 'STDIN' undeclared (first use in this function)
    5 |     while (c = getc(STDIN)) {
      |                     ^~~~~
main.c:5:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
int main() {
    char c;
    int g = 0, p = 0;
    while (c = getc()) {
        if (c == 'g') {
            g++;
        } else {
            p++;
        }
    }
    printf("%d\n", g - p >> 1);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:16: error: too few arguments to function 'getc'
    5 |     while (c = getc()) {
      |                ^~~~
In file included from main.c:1:
/usr/include/stdio.h:576:12: note: declared here
  576 | extern int getc (FILE *__stream) __nonnull ((1));
      |            ^~~~
Language: C

#include <stdio.h>
int main() {
    char c;
    while (c = getc()) {
        if (c == 'g') {
            g++;
        } else {
            p++;
        }
    }
    printf("%d\n", g - p >> 1);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:16: error: too few arguments to function 'getc'
    4 |     while (c = getc()) {
      |                ^~~~
In file included from main.c:1:
/usr/include/stdio.h:576:12: note: declared here
  576 | extern int getc (FILE *__stream) __nonnull ((1));
      |            ^~~~
main.c:6:13: error: 'g' undeclared (first use in this function)
    6 |             g++;
      |             ^
main.c:6:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:13: error: 'p' undeclared (first use in this function)
    8 |             p++;
      |             ^
Language: C

#include <stdio.h>

int main(void)
{
	int i,gc,pc,score;
	char[100000] code;
	
	scanf("%s",&code);
	
	for(i=0;code[i]!='\0';i++)
	{
		if(code[i] == 'g')
		{
			pc++;
			score++;
		}
		else if(code[i] == 'p')
		{
			gc++;
			score++;
		}
		if(gc>pc)
		{
			score--;
		}
		else if(pc>gc)
		{
			score--;
		}
	}
	
	printf("%d",score);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:13: error: expected identifier or '(' before '[' token
    6 |         char[100000] code;
      |             ^
main.c:8:21: error: 'code' undeclared (first use in this function)
    8 |         scanf("%s",&code);
      |                     ^~~~
main.c:8:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){

    char s[100001];
    scanf("%s",s);
    int g=0;
    int p=0;
    int score=0;

    int i=0;
    while(s[i]!='\0'){
        if(s[i]=='g'){
            if(p<g){
                p++;
                score++;
            }
            else{
                g++;
            }
        }
        else{
            if(p<g){
                p++;
            }
            else{
                g++;
                score--;
            }
        }
        i++;
    }

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

    return 0;

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

import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);


	    int N=gi();
	    long[] T=new long[N];
	    long[] A=new long[N];

        for (int i=0; i<N; i++) {
        	T[i]=gl();
        	A[i]=gl();
        }

        long ht=1;
        long ha=1;
        for (int i=0; i<N; i++) {
            long hi=(long)Math.max(Math.ceil((double)ht/(double)T[i]), Math.ceil((double)ha/(double)A[i]));
            ht=hi*T[i];
            ha=hi*A[i];
        }

        System.out.println((long(ht+ha));

//        if(ans==0) {
//
//		    System.out.println("Yes");
//        } else {
//        	System.out.println("No");
//
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Compiler output:
Main.java:27: error: '.class' expected
        System.out.println((long(ht+ha));
                                ^
Main.java:27: error: not a statement
        System.out.println((long(ht+ha));
                                   ^
Main.java:27: error: ';' expected
        System.out.println((long(ht+ha));
                                      ^
3 errors
Language: C++

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

long long n,t[1005],a[1005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin>>n;
    for(long long i=0;i<n;i++)
        cin>>t[i]>>a[i];
    for(long long i=1;i<n;i++)
    {
        long long d=max(t[i-1]/t[i],a[i-1])/a[i]);
        if(d*a[i]<a[i-1]||d*t[i]<t[i-1])
            d++;
        a[i]*=d;
        t[i]*=d;
    }

    cout<<t[n-1]+a[n-1]<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:49: error: expected ',' or ';' before ')' token
   16 |         long long d=max(t[i-1]/t[i],a[i-1])/a[i]);
      |                                                 ^