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

#include <iostream>

using namespace std;

int main() {
    int N, T, A;
    
    cin >> N;
    
    int t = 1;
    int a = 1;    
    for (int i = 0; i != N; ++i)
    {
        cin >> T >> A;
        
        if (t / T * A == a)
        {
            continue;
        }
        
        if (T >= t && A >= a)
        {
            t = T;
            a = A;
            continue;
        }
        
        int w;
        if (T > A) {
            w = 
        }
        
        int x = T;
        int y = A;
        while (true)
        {
            x += T;
            y += A;
            
            if (x >= t && y >= a)
            {
                break;
            }
        }
        
        t = x;
        a = y;
    }
    
    cout << t + a << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: expected primary-expression before '}' token
   31 |         }
      |         ^
Language: C

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

int main(void){

	int N,K,i,j,t,a;
	int T[1000];
	int A[1000];

	scanf("%d",&N);

	for(i=0;i<N;i++){
		scanf("%d",&T[i]);
	}

	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}

	for(i=0;i<N;i++){
		if(i==0){
			t=T[0];
			a=A[0];
		}
		
		else{
			while(a*T[i]/(T[i]+A[i])==t*A[i]/(A[i]+T[i])){
				if(T[i]<A[i]){
					a++;
				}
				
				else if(T[i]>A[i]){
					t++;
				}

				else if(T[i]==A[i]){
					if(a<t){
						a++;
					}
			
					else{
						t++;
					}
				}
			}
		}
				
			
		
		

	printf("%d",a+t);

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:55:1: error: expected declaration or statement at end of input
   55 | }
      | ^
Language: C

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

int main(){
	int i,N;
	int a,b;
	int lva, lvb;
	int temp;
	int old_a=1, old_b=1;
	double pa, pb;
	scanf("%d", &N);

	
	for(i=0; i<N; i++){
		scanf("%d %d", &a, &b);
	//	temp = 1;
	//	while( old_a > a*temp || old_b > b*temp){
	//		temp++;
	//	}
		pa = (double)old_a / a;
		pa = ceil(pa);
		pb = (double)old_b / b;
		pb = ceil(pb);
		temp = max(pa, pb);
		old_a = a * temp;
		old_b = b * temp;
		
	}

	printf("%d\n", old_a+ old_b);
	

	return 0;


}

Compiler output:
main.c: In function 'main':
main.c:25:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   25 |                 temp = max(pa, pb);
      |                        ^~~
      |                        fmax
Language: C

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

int main(void){

	int N,K,i,j,t,a;
	int T[];
	int A[];

	scanf("%d",&N);

	for(i=0,i<N;i++){
		scanf("%d",T[i]);
	}

	for(i=0,i<N;i++){
		scanf("%d",A[i]);
	}

	for(i=0;i<N;i++){
		if(i==0){
			t=T[0];
			a=A[0];
		}
		
		else{
			while(a*T[i]/(T[i]+A[i])==t*A[i]/(A[i]+T[i])){
				if(T[i]<A[i]){
					a++;
				}
				
				else if(T[i]>A[i]){
					t++;
				}

				else if(T[i]==A[i]){
					if(a<t){
						a++;
					}
			
					else{
						t++;
					}
				}
			}
		}
				
			
		
		

	printf("%d",a+t);

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:13: error: array size missing in 'T'
    7 |         int T[];
      |             ^
main.c:8:13: error: array size missing in 'A'
    8 |         int A[];
      |             ^
main.c:12:24: error: expected ';' before ')' token
   12 |         for(i=0,i<N;i++){
      |                        ^
      |                        ;
main.c:16:24: error: expected ';' before ')' token
   16 |         for(i=0,i<N;i++){
      |                        ^
      |                        ;
main.c:55:1: error: expected declaration or statement at end of input
   55 | }
      | ^
Language: C++

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll st = 0, sa = 0;
	int n, t, a;
	cin >> n;
	cin >> t >> a;
	sa = a;
	st = t;
	rep(i, 0, n-1){

		cin >> t >> a;
		if (sa%a == 0 && st%t == 0 && sa / a == st / t)continue;
			for (int i = (st%t ? st / t + 1 : st / t);; i++){
				st = i*t;
				if (sa <= a*i){
					sa = a*i;
					break;
				}
			}
		}
		else{
			for (int i = (sa%a?sa / a +1:sa/a);; i++){
				sa = i*a;
				if (st <= t*i){
					st = t*i;
					break;
				}
			}
		}
	}
	cout << (sa + st) << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'else' without a previous 'if'
   35 |                 else{
      |                 ^~~~
a.cc: At global scope:
a.cc:45:9: error: 'cout' does not name a type
   45 |         cout << (sa + st) << endl;
      |         ^~~~
a.cc:48:9: error: expected unqualified-id before 'return'
   48 |         return 0;
      |         ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

#include<stdio.h>
long long int a[1100],b[1100],t[1100]={1,};
int f(float c){
	if((c-(int)c)>0)
		return ((int)c+1;
	else
		return (int)c;
}

int main(){
	int i,n,e;
	float c,d;
	long long int result;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lld %lld",&a[i],&b[i]);
		if(i!=0){
		    c = (float)a[i-1]/(float)a[i];
		    d = (float)b[i-1]/(float)b[i];
			c = f(c);
			d = f(d);
		    e = c>d?c:d;
		    if(e>1){
		    	t[i]=e;
			}else{
				t[i]=1;
			}
			a[i]=a[i]*t[i];
			b[i]=b[i]*t[i];
		}
		//printf("%d : %d %d\n",i,a[i],b[i]);
	}
	printf("%lld",a[i-1]+b[i-1]);
}

Compiler output:
a.cc: In function 'int f(float)':
a.cc:5:33: error: expected ')' before ';' token
    5 |                 return ((int)c+1;
      |                        ~        ^
      |                                 )
Language: Java

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long t[] = new int[n];
		long a[] = new int[n];
		for (int i = 0; i < n; i++) {
			t[i] = sc.nextInt();
			a[i] = sc.nextInt();
		}

		for (int i = 1; i < n; i++) {
			long tr, ar, r;
			tr = (t[i] == 0 ? 1 : ((t[i - 1] - 1) / t[i] + 1));
			ar = (a[i] == 0 ? 1 : ((a[i - 1] - 1) / a[i] + 1));
			r = (tr > ar ? tr : ar);
			t[i] *= r;
			a[i] *= r;
		}

		System.out.println(t[n - 1] + a[n - 1]);
	}
}


Compiler output:
Main.java:7: error: incompatible types: int[] cannot be converted to long[]
		long t[] = new int[n];
		           ^
Main.java:8: error: incompatible types: int[] cannot be converted to long[]
		long a[] = new int[n];
		           ^
2 errors
Language: C++

#include<iostream>
using namespace std;
int main() {
	__int64 n, i, t, a, x, y,X,Y,g,h;
	cin >> n;
	x = 1;
	y = 1;
	for (i = 0; i < n; i++) {
		cin >> t >> a;
		for (X = 0; g != h; X++) {
			g = (x + X)*a;
			for (Y = 0; g != h; Y++) {
				h = (y + Y)*t;
				if (Y > 100000000000000000) {
					break;
				}
			}
		}
	}
	cout << x + y;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    4 |         __int64 n, i, t, a, x, y,X,Y,g,h;
      |         ^~~~~~~
      |         __int64_t
a.cc:5:16: error: 'n' was not declared in this scope
    5 |         cin >> n;
      |                ^
a.cc:6:9: error: 'x' was not declared in this scope
    6 |         x = 1;
      |         ^
a.cc:7:9: error: 'y' was not declared in this scope
    7 |         y = 1;
      |         ^
a.cc:8:14: error: 'i' was not declared in this scope
    8 |         for (i = 0; i < n; i++) {
      |              ^
a.cc:9:24: error: 't' was not declared in this scope; did you mean 'tm'?
    9 |                 cin >> t >> a;
      |                        ^
      |                        tm
a.cc:9:29: error: 'a' was not declared in this scope
    9 |                 cin >> t >> a;
      |                             ^
a.cc:10:22: error: 'X' was not declared in this scope
   10 |                 for (X = 0; g != h; X++) {
      |                      ^
a.cc:10:29: error: 'g' was not declared in this scope
   10 |                 for (X = 0; g != h; X++) {
      |                             ^
a.cc:10:34: error: 'h' was not declared in this scope
   10 |                 for (X = 0; g != h; X++) {
      |                                  ^
a.cc:12:30: error: 'Y' was not declared in this scope
   12 |                         for (Y = 0; g != h; Y++) {
      |                              ^
Language: C++

#include<stdio.h>
long long int a[1100],b[1100],t[1100]={1,};
int f(float c){
	if((c-(int)c)>0)
		return (int)c+1;
	else
		(int)c;
}

int main(){
	int i,,n,e;
	float c,d;
	long long int result;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
		if(i!=0){
		    c = (float)a[i-1]/(float)a[i];
		    d = (float)b[i-1]/(float)b[i];
			c = f(c);
			d = f(d);
		    e = c>d?c:d;
		    if(e>1){
		    	t[i]=e;
			}else{
				t[i]=1;
			}
			a[i]=a[i]*t[i];
			b[i]=b[i]*t[i];
		}
		//printf("%d : %d %d\n",i,a[i],b[i]);
	}
	printf("%lld",a[i-1]+b[i-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected unqualified-id before ',' token
   11 |         int i,,n,e;
      |               ^
a.cc: In function 'int f(float)':
a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type]
    8 | }
      | ^
Language: Java

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long takahashi = 1, aoki = 1;

		for(int i=0; i<n; i++){
			int t = sc.nextInt();
			int a = sc.nextInt(); 
			int tmp1 = takahashi/t, tmp2 = aoki/a;
			tmp1 += (takahashi%t==0)?0:1;
			tmp2 += (aoki%a==0)?0:1;
			long tmp = Math.max(tmp1, tmp2);

			takahashi = t*tmp;
			aoki = a*tmp;
		}

		System.out.println((takahashi+aoki));
	}
}

Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from long to int
			int tmp1 = takahashi/t, tmp2 = aoki/a;
			                    ^
Main.java:12: error: incompatible types: possible lossy conversion from long to int
			int tmp1 = takahashi/t, tmp2 = aoki/a;
			                                   ^
2 errors
Language: C

#include <stdio.h>

int N, T[1234], A[1234];
int tmp = 1, ans[2] = { 0 };

int main(void) {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) { scanf("%d%d", &T[i], &A[i]); }
	for (int i = 0; i < N; ++i) {
		if (i == 0) {
			ans[0] += T[i];
			ans[1] += A[i];
		}
		else {
			while (true) {
				if (ans[0] <= T[i] * tmp&&ans[1] <= A[i] * tmp) {
					ans[0] = T[i] * tmp;
					ans[1] = A[i] * tmp;
					tmp = 1;
					break;
				}
				tmp++;
			}
		}
	}
	printf("%d\n", ans[0] + ans[1]);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:32: error: 'true' undeclared (first use in this function)
   15 |                         while (true) {
      |                                ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:15:32: note: each undeclared identifier is reported only once for each function it appears in
   15 |                         while (true) {
      |                                ^~~~
Language: C++

#include<iostream>
using namespace std;
using ll=long long;
ll n,a[2000],b[2000],ans,x,y;
int i;
int main(){
cin>>n;
while(i<n)cin>>a[i]>>b[i],++i;

x=y=1;i=0;
while(i<n){
ll r=max((x+a[i]-1)/a[i],y+b[i]-1)/b[i]));
x=a[i]*r,y=b[i]*r;
}ans=x+y;
cout<<ans<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:40: error: expected ',' or ';' before ')' token
   12 | ll r=max((x+a[i]-1)/a[i],y+b[i]-1)/b[i]));
      |                                        ^
Language: Java

import java.util.Scanner;
import java.lang.String;

public class TestMain {
  
  public static void main (String[] arg) {
    Scanner sc = new Scanner(System.in);
    String tcdSequence = sc.next();
    sc.close();
	int tdcLength = tcdSequence.length();
    char[] acdSequence = new char[tdcLength];
    for (int i = 0; i < acdSequence.length; i++) {
      if (i % 2 == 0) {
        acdSequence[i] = 'g';
      } else {
        acdSequence[i] = 'p';
      }
    }
    
    int acdScore = 0;
    for (int k = 0; k < tcdSequence.length(); k++) {
      if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) {
        acdScore++;
      } else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) {
        acdScore--;
      }
    }
    
    System.out.println(acdScore);
  }
}


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

import java.util.Scanner;
import java.lang.String;

public class TestMain {
  
  public static void main (String[] arg) {
    Scanner sc = new Scanner(System.in);
    rockpaper(sc);
    sc.close();
  }
  
  public static void rockpaper(Scanner sc) {
    String tcdSequence = sc.next();
    char[] acdSequence = new char[tcdSequence.length()];
    for (int i = 0; i < acdSequence.length; i++) {
      if (i % 2 == 0) {
        acdSequence[i] = 'g';
      } else {
        acdSequence[i] = 'p';
      }
    }
    
    int acdScore = 0;
    for (int k = 0; k < tcdSequence.length(); k++) {
      if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) {
        acdScore++;
      } else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) {
        acdScore--;
      }
    }
    
    System.out.println(acdScore);
  }
}

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

import java.util.Scanner;
import java.lang.String;

public class TestMain {
  
  public static void main (String[] arg) {
    Scanner sc = new Scanner(System.in);
    rockpaper(sc);
    sc.close();
  }
  
  public static void rockpaper(Scanner sc) {
		String tcdSequence = sc.next();
		char[] acdSequence = new char[tcdSequence.length()];
		if (tcdSequence.charAt(0) != 'g') {
			//WARN
		}
		for (int i = 0; i < acdSequence.length; i++) {
			if (i % 2 == 0) {
				acdSequence[i] = 'g';
			} else {
				acdSequence[i] = 'p';
			}
		}
		int acdScore = 0;
		for (int k = 0; k < tcdSequence.length(); k++) {
			if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) {
				acdScore++;
			} else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) {
				acdScore--;
			}
		}
		
		System.out.println(acdScore);
	}
}

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

use std::io::stdin;
fn main() {
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let s:Vec<char> = st.trim().chars().collect();
    let p:usize = s.iter().filter(|x| x==&&'p').count();
    let n = s.len();
    println!("{}", n/2 - p);
}

Compiler output:
a.cc:1:1: error: 'use' does not name a type
    1 | use std::io::stdin;
      | ^~~
a.cc:2:1: error: 'fn' does not name a type
    2 | fn main() {
      | ^~
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;
char c[100007];
int main(){
    scanf("%s",c);int l=strlen(c),g=0;
    for(int i=0;i<l;++i)if(c[i]=='g')g++;
    printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: 'min' was not declared in this scope; did you mean 'main'?
    8 |     printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
      |                   ^~~
      |                   main
Language: C++

//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll score=0;
  string s;cin>>s;
  rep(i,n){
    if(i%2==0){
      if(s[i]=='p')score--;
    }
    else {
      if(s[i]=='g')score++;
    }
  }
  cout<<score<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'n' was not declared in this scope
   18 |   rep(i,n){
      |         ^
a.cc:5:43: note: in definition of macro 'rep'
    5 | #define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
      |                                           ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
    string a;
    cin>>a;
    int len=a.size();
    int i;
    int x=0,y=0,ans=0;
    for(i=0;i<len;i++)
        if(x==y)x++;if (a[i]=='p') ans--;}
        else{y++;if (a[i]=='g') ans++;}
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc:12:9: error: expected unqualified-id before 'else'
   12 |         else{y++;if (a[i]=='g') ans++;}
      |         ^~~~
a.cc:13:5: error: 'cout' does not name a type
   13 |     cout<<ans<<endl;
      |     ^~~~
a.cc:14:5: error: expected unqualified-id before 'return'
   14 |     return 0;
      |     ^~~~~~
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;
char c[100007];
int main(){
    scanf("%s",c);int l=strlen(c),g=0;for(int i=0;i<l;++i)if(c[i]=='g')g++;printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:90: error: 'min' was not declared in this scope; did you mean 'main'?
    6 |     scanf("%s",c);int l=strlen(c),g=0;for(int i=0;i<l;++i)if(c[i]=='g')g++;printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;
      |                                                                                          ^~~
      |                                                                                          main
Language: Java


import java.util.Scanner;
 
import jdk.management.cmm.SystemResourcePressureMXBean;
 
public class Main {
	
       public static void main(String[] args) {
    	  Scanner input=new Scanner( System.in);
    	  
    	  String string=input.next();
    	  int len=string.length();
    	  int ans=0;
    	  for(int i=0;i<len;i++)
    	  {
    		  if(i%2==0)
    		  {
    			  if(string.charAt(i)=='p')
    				  ans--;
    		  }
    		  else
    		  {
    			  if(string.charAt(i)=='g')
    				  ans++;
    		  }
    	  }
    	  System.out.println(ans);
          
	}
}



Compiler output:
Main.java:4: error: package jdk.management.cmm does not exist
import jdk.management.cmm.SystemResourcePressureMXBean;
                         ^
1 error
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'g'){
            cnt += 1;
            g += 1;
        }else{
            if (cnt > 0) cnt -= 1;
            else ans -= 1;
        }
    }
    ans += cnt / 2;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'g' was not declared in this scope
   19 |             g += 1;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin >> a;
    int len = strlen(a);
    int i;
    int x = 0,y = 0,ans = 0;
    for(i = 0;i < len;i++){
        if (x == y){
            x++;
            if(a[i] == 'p') 
                ans--; 
        }
        else{
            y++;
            if (a[i] == 'g') 
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
    6 |     int len = strlen(a);
      |                      ^
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
Language: C++

V#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    int count = 0;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] == 'g')
        {
            count++;
        }
    }
  if(s.size() % 2 == 1)
  {
    cout << count - s.size() / 2 - 1;
  }
  else
  {
    cout << count - s.size() / 2;
  }

    return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | V#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'V' does not name a type
    1 | V#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:6:5: error: 'string' was not declared in this scope
    6 |     string s;
      |     ^~~~~~
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> s;
      |     ^~~
a.cc:7:12: error: 's' was not declared in this scope
    7 |     cin >> s;
      |            ^
a.cc:18:5: error: 'cout' was not declared in this scope; did you mean 'count'?
   18 |     cout << count - s.size() / 2 - 1;
      |     ^~~~
      |     count
a.cc:22:5: error: 'cout' was not declared in this scope; did you mean 'count'?
   22 |     cout << count - s.size() / 2;
      |     ^~~~
      |     count
Language: C++

#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    int count = 0;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] == 'g')
        {
            count++;
        }
    }
  if(s.size() % 2 == 1)
  {
    cout << count - s.size() / 2 - 1;
  }
  else
  {
    cout << count \ s.size() / 2;
  }

    return 0;
}


Compiler output:
a.cc:22:19: error: stray '\' in program
   22 |     cout << count \ s.size() / 2;
      |                   ^
a.cc: In function 'int main()':
a.cc:22:18: error: expected ';' before 's'
   22 |     cout << count \ s.size() / 2;
      |                  ^  ~
      |                  ;
Language: Java

import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		int G = 0,P = 0;
		for( int i=0; i<S.length(); i++ ){
			S.charAt(i)=='g' ? G++ : P++;
		}
		System.out.println((G-P)/2);
	}
}


Compiler output:
Main.java:10: error: not a statement
			S.charAt(i)=='g' ? G++ : P++;
			                 ^
1 error
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;char c[100007];int main(){scanf("%s",c);int l=strlen(c),g=0;  for(int i=0;i<l;++i)if(c[i]=='g')g++;    printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:138: error: 'min' was not declared in this scope; did you mean 'main'?
    3 | using namespace std;char c[100007];int main(){scanf("%s",c);int l=strlen(c),g=0;  for(int i=0;i<l;++i)if(c[i]=='g')g++;    printf("%d\n",min(l/2,g)-min(l-l/2,l-g));return 0;}
      |                                                                                                                                          ^~~
      |                                                                                                                                          main
Language: C++


s = input()

g = 0
p = 0
ans = 0

for i in s:

    if i == "g":

        if p < g:
            ans += 1
            p += 1

        else:
            g += 1

    else:

        if p < g:
            p += 1

        else:
            g += 1
            ans -= 1

print (ans)


Compiler output:
a.cc:2:1: error: 's' does not name a type
    2 | s = input()
      | ^
Language: C++

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

int main(){
  string s;
  cin >> s;
  
  int ans = 0;
  for(int i=0;i<s.size();++i){
    if(i%2 == 0 && s[i] == 'p') --ans;
    if(i%2 == 1 && s[i] == 'g') ++ans;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits/sstdc++.h: No such file or directory
    1 | #include <bits/sstdc++.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

S = input().strip()
p, g = "pg"

score = sum(1 if c==g else 0 for c in S)
G, P = 0, 0

hands = []
lastp = None
for c in S:
    if P == G:
        if c == g:
            hand = g
            score -= 1
        else:
            hand = p
            hands[lastp] = g
            # c == p
            # 過去のP vs G を G vs G : +1 -> 0 = -1
            # 過去のP vs P を G vs P :  0 -> -1 = -1
            score -= 1
            P-=1
            G+=1
    else:
        hand = p
    if hand == g:
        G += 1
    else:
        P += 1
        lastp = len(hands)
    hands.append(hand)
    #print(score, hand, "vs", c, P, G)
#print(S)
#print("".join(hands))
print(score)



Compiler output:
a.cc:17:15: error: invalid preprocessing directive #c
   17 |             # c == p
      |               ^
a.cc:18:15: error: invalid preprocessing directive #\U0000904e\U000053bb\U0000306eP
   18 |             # 過去のP vs G を G vs G : +1 -> 0 = -1
      |               ^~~~~~~
a.cc:19:15: error: invalid preprocessing directive #\U0000904e\U000053bb\U0000306eP
   19 |             # 過去のP vs P を G vs P :  0 -> -1 = -1
      |               ^~~~~~~
a.cc:31:6: error: invalid preprocessing directive #print
   31 |     #print(score, hand, "vs", c, P, G)
      |      ^~~~~
a.cc:32:2: error: invalid preprocessing directive #print
   32 | #print(S)
      |  ^~~~~
a.cc:33:2: error: invalid preprocessing directive #print
   33 | #print("".join(hands))
      |  ^~~~~
a.cc:1:1: error: 'S' does not name a type
    1 | S = input().strip()
      | ^
Language: C++

#include <iostream>
#include <cstring>
using namespace std;
char s[1000101];
int n,x,y,ans;
int main(){
    cin>>s;
    n=strlen(s);
    for(int i=0;i<n;i++){
        if(s[i]=='p'){
            if(x>y){
                y++;
            }else{
                x++;
                ans-—;
            }
        }else{
            if(x>y){
                y++;
                ans++;
            }else{
                x++;
            }
        }
    }
    cout<<ans;
}

Compiler output:
a.cc:15:21: error: extended character — is not valid in an identifier
   15 |                 ans-—;
      |                     ^
a.cc: In function 'int main()':
a.cc:15:21: error: '\U00002014' was not declared in this scope
   15 |                 ans-—;
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s;int x,y,ans;
int main(){
    cin>>s;
    for(register int i=0;i<s.size();i++){
        if(x==y){x++;if(a[i]=='p') ans--;}
        else{y++;if(a[i]=='g') ans++;}
    }
    printf("%d",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    6 |     for(register int i=0;i<s.size();i++){
      |                      ^
a.cc:7:25: error: 'a' was not declared in this scope
    7 |         if(x==y){x++;if(a[i]=='p') ans--;}
      |                         ^
a.cc:8:21: error: 'a' was not declared in this scope
    8 |         else{y++;if(a[i]=='g') ans++;}
      |                     ^
Language: C++

// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
string s;int x,y,ans;
int main(){
    cin>>s;
    for(register int i=0;i<s.size();i++){
        if(x==y){x++;if(a[i]=='p') ans--;}
        else{y++;if(a[i]=='g') ans++;}
    }
    printf("%d",ans);
    return 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 |     for(register int i=0;i<s.size();i++){
      |                      ^
a.cc:8:25: error: 'a' was not declared in this scope
    8 |         if(x==y){x++;if(a[i]=='p') ans--;}
      |                         ^
a.cc:9:21: error: 'a' was not declared in this scope
    9 |         else{y++;if(a[i]=='g') ans++;}
      |                     ^
Language: C++

#include<bits/stdc++.h> 
using namespace std;
char a[100007];
int main()
{
  scanf("%s",a);
  int l=strlen(a),x=0,i;
  for(i=0;i<l;i++)
    if(a[i]=='g')
	  x++;
  printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: 'g' was not declared in this scope
   11 |   printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
      |                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	int ans=0,x=0,y=0;
	cin>>s;
	for(int i=0; i<s.size(); i++) {
		x==y?x++,s[i]=='p'?ans--:ans=ans:y++,s[i]=='g'?ans++:ans=ans;
	}
	cout<<asn<<endl;
}

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

//恶意评分++

#include<cstdio>
#include<cstring>

#define mian int main()

char c[100007];

mian{
    scanf("%s",c);
    int l=strlen(c),g=0;
    for(int i=0;i<l;++i) if(c[i]=='g') g++;
    printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'min' was not declared in this scope; did you mean 'main'?
   14 |     printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
      |                   ^~~
      |                   main
Language: C++

#include<iostream>
#include<string>
using namespace std;
int a1,a;
int main(){
	string s1,s2;
	cin>>s1;
	for(int i=0;i<s1.size();i++)
	   {
	   	  if(s[i]=='p') a1++;  
	   }
	a=s1.size()/2;
	cout<<a-a1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 's' was not declared in this scope
   10 |                   if(s[i]=='p') a1++;
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define N 10001
char a[N];
int main()
{
	gets(a);
	int l=strlen(a);
	int t1=0,t2=0,score=0;
	for(int i=0;i<l;i++)
		if(t1==t2)
		{
			t1++;
			if(a[i]=='p') score--;
		}else
		{
			t2++;
			if(a[i]=='g') score++;
		}
	printf("%d\n",score);
	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(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool b[26]={1,0,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1};
int main()
{
    bool o=0,ok=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
     if(b[s[i]-'A']==1)ok1=1;
     else ok=1;
    if(o+ok==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'ok1' was not declared in this scope; did you mean 'ok'?
   10 |      if(b[s[i]-'A']==1)ok1=1;
      |                        ^~~
      |                        ok
Language: C++

#include<bits/stdc++.h>
string s;
int main(){
  cin>>s;
  cout<<s.size()/2-count(s.begin(),s.end(),'p')<<endl;
}


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:4:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |   cin>>s;
      |   ^~~
      |   std::cin
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:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:4:8: error: 's' was not declared in this scope
    4 |   cin>>s;
      |        ^
a.cc:5:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    5 |   cout<<s.size()/2-count(s.begin(),s.end(),'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:5:20: error: 'count' was not declared in this scope; did you mean 'std::count'?
    5 |   cout<<s.size()/2-count(s.begin(),s.end(),'p')<<endl;
      |                    ^~~~~
      |                    std::count
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:5:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    5 |   cout<<s.size()/2-count(s.begin(),s.end(),'p')<<endl;
      |                                                  ^~~~
      |                                                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  std::string s;
  cin >> s;
  int g = 0, p = 0;
  std::string result;
  for (int i = 0; i < s.size; i++) {
    if (i % 2 == 0) {
      result.push_back('g');
    } else {
      result.push_back('p');
    }
  }
  cout << result << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:25: 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 '()' ?)
   29 |   for (int i = 0; i < s.size; i++) {
      |                       ~~^~~~
      |                             ()
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s;
int x,y,ans;
int main(){
    cin>>s;
    for(int i=0;i<s.size();i++)
        if (x==y){ x++; if(a[i]=='p') ans--;}    
        else{ y++; if(a[i]=='g') ans++;}        
    cout<<ans<<endl;                    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:28: error: 'a' was not declared in this scope
    8 |         if (x==y){ x++; if(a[i]=='p') ans--;}
      |                            ^
a.cc:9:23: error: 'a' was not declared in this scope
    9 |         else{ y++; if(a[i]=='g') ans++;}
      |                       ^
Language: C++


  string s;
  cin >> s;
 
  lnt ans = 0;
  FOR(i, 0, (s.size() + 1) / 2) {
    if (s.at(i) == 'p') {
      ans--;
    }
  }
  FOR(i, (s.size() + 1) / 2, s.size()) {
    if (s.at(i) == 'g') {
      ans++;
    }
  }
  printf("%lld\n", ans);

Compiler output:
a.cc:2:3: error: 'string' does not name a type
    2 |   string s;
      |   ^~~~~~
a.cc:3:3: error: 'cin' does not name a type
    3 |   cin >> s;
      |   ^~~
a.cc:5:3: error: 'lnt' does not name a type; did you mean 'int'?
    5 |   lnt ans = 0;
      |   ^~~
      |   int
a.cc:6:6: error: expected constructor, destructor, or type conversion before '(' token
    6 |   FOR(i, 0, (s.size() + 1) / 2) {
      |      ^
a.cc:11:6: error: expected constructor, destructor, or type conversion before '(' token
   11 |   FOR(i, (s.size() + 1) / 2, s.size()) {
      |      ^
a.cc:16:9: error: expected constructor, destructor, or type conversion before '(' token
   16 |   printf("%lld\n", ans);
      |         ^
Language: Java

/*
* Author. Silviase(@silviasetitech)
* For AtCoder
*/

import java.util.*;
import java.lang.*;
import java.math.*;


public class Main {

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

        int n = sc.nextInt();
        String s = sc.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                if (s.charAt(i) == 'p') {
                    ans--;
                }
            } else {
                if (s.charAt(i) == 'g') {
                    ans++;
                }
            }
        }

        System.out.println(ans);
        sc.close();
    }


    private static long gcd(Long m, long n) {
        if(m < n) {
            return gcd(n, m);
        }
        if(n == 0){
            return m;
        } 
        return gcd(n, m % n);
    }

    private static long[][] Combination_nCk(long n, long k) {
        n++; k++;
        long[][] ans = new long[(int)n][(int)k];
        for (int i = 0; i < n; i++) {
            ans[i][0] = 1;
        }
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < k-1; j++) {
                if (i < j) {
                    ans[i][j] = 0;
                }else{
                    ans[i+1][j+1] = ans[i][j] + ans[i][j+1];
                }
            }
        }
        return ans;
    }
    private static double[][] Probability_nCk(int n, int k) {
        n++; k++;
        double[][] ans = new double[n][k];
        for (int i = 0; i < n; i++) {
            if (i == 0) {
                ans[i][0] = 1;
            }else{
                ans[i][0] = ans[i-1][0]/2;
            }
        }
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < k-1; j++) {
                if (i < j) {
                    ans[i][j] = 0;
                }else{
                    ans[i+1][j+1] = (ans[i][j] + ans[i][j+1])/2;
                }
            }
        }
        return ans;
    }
}

Compiler output:
Main.java:18: error: incompatible types: int cannot be converted to String
        String s = sc.nextInt();
                             ^
1 error
Language: C++

#include <bits/stdc++.h>
#define ll long long 
int main()
{
    string s;
    cin>>s;
    int ans=0;
    int k=0;//
    for(int i=0;i<s.length();i++){
        if(s[i]=='g'){
            if(k>0){
                ans++;
                k--;
            }else{
                k++;
            }
        }
        else{
            if(p>0){
                k--;
            }else{
                k++;
                ans--;
            }
            
        }
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'string' was not declared in this scope
    5 |     string s;
      |     ^~~~~~
a.cc:5:5: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin>>s;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:10: error: 's' was not declared in this scope
    6 |     cin>>s;
      |          ^
a.cc:19:16: error: 'p' was not declared in this scope
   19 |             if(p>0){
      |                ^
a.cc:28:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   28 |     cout<<ans<<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:28:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   28 |     cout<<ans<<endl;
      |                ^~~~
      |                std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int sumg=0,sump=0;
  for(int i=0;i<n;i++){
    if(s[i]=='g')sumg++;
    else sump++;
  }
  cout<<sumg-sump<<endl;
}

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

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

char a[100005];
int x=0,y=0,ans=0;

int main()
{
    scanf("%s",a);
    int mm=srelen(a);
    for (int i=0;i<=mm;i++)
        if (x==y)
        {
            x++;
            if(a[i]=='p')
                ans--;
        } 
     else
     {
        y++;
        if(a[i]=='g')
            ans++;
     }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'srelen' was not declared in this scope; did you mean 'strnlen'?
   10 |     int mm=srelen(a);
      |            ^~~~~~
      |            strnlen
Language: C++

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

char a[100005];
int x=0,y=0,ans=0;

int main()
{
    scanf("%s",a+1)
    int mm=srelen(a);
    for (int i=1;i<mm;i++)
        if (x==y)
        {
            x++;
            if(a[i]=='p')
                ans--;
        } 
     else
     {
        y++;
        if(a[i]=='g')
            ans++;
     }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before 'int'
    9 |     scanf("%s",a+1)
      |                    ^
      |                    ;
   10 |     int mm=srelen(a);
      |     ~~~             
a.cc:11:20: error: 'mm' was not declared in this scope; did you mean 'tm'?
   11 |     for (int i=1;i<mm;i++)
      |                    ^~
      |                    tm
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
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:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
char a[100005];
int x=0,y=0,ans=0;
int main()
{
    cin>>a;
    for (int i=0;i<sizeof(a);i++)
     if (x==y)
     {
         x++; 
         if(a[i]=='p') 
           ans--;
     }   
     else
     {
         y++; 
         if(a[i]=='g') 
           ans++;
     }         
    printf("%d\n",ans);                    
    return 0;
}
} 

Compiler output:
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

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

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

#include<stdio.h>
char s[10001];
int main()
{
    scanf("%s",s);
    int ans=0,x=0,y=0;
    for(int i=0;i<strlen(s);i++)
    {
        if(x==y)
        {
            x++;
            if(s[i]=='p')
            ans--;
        }
        else
        {
            y++;
            if(s[i]=='g')
            ans++;
        }
    }
    printf("%d",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: 'strlen' was not declared in this scope
    7 |     for(int i=0;i<strlen(s);i++)
      |                   ^~~~~~
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 s[10001];
Language: C++

#include<bits/stdc++.h>
long long int q[24][24],j[24][24];
long long int n,m,x,y;
bool jc(int a,int b)
{
    if((a==x-1&&(b==y-2||b==y+2))||(a==x+1&&(b==y-2||b==y+2)))	
	return 1;
	else
	return 0;
}
void dt(int a,int b)
{
	if(jc(a,b))
	  {
	  	int h=(a+1)/n;
	    a=(a+1)%n

Compiler output:
a.cc: In function 'void dt(int, int)':
a.cc:16:22: error: expected ';' at end of input
   16 |             a=(a+1)%n
      |                      ^
      |                      ;
a.cc:16:22: error: expected '}' at end of input
a.cc:14:11: note: to match this '{'
   14 |           {
      |           ^
a.cc:16:22: error: expected '}' at end of input
   16 |             a=(a+1)%n
      |                      ^
a.cc:12:1: note: to match this '{'
   12 | {
      | ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[100001];
int main(){
	int s=0,sn=0,x;
	//for(int i=1;i<=strlen(a);i++)
	gets(a);
	for(int i=0;i<strlen(a);i++)
	{if(a[i]=='p')
	s++;
	if(a[i]=='g')
	sn++;
	}
	x=(sn-s)/2;
	cout<<x;
	return 0;
	
	
} 

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

#include<bits/stdc++.h>
using namespace std;
char a[100001];
int main(){
	int s=0,sn=0,x;
	//for(int i=1;i<=strlen(a);i++)
	gets(a);
	for(int i=0;i<strlen(a);i++)
	{if(a[i]=='p')
	s++;
	if(a[i]=='g')
	sn++;
	}
	x=(sn-s)/2;
	cout<<x;
	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(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
char a[106];
int main(){
	int s=0,sn=0,x;
	//for(int i=1;i<=strlen(a);i++)
	gets(a);
	for(int i=0;i<strlen(a);i++)
	{if(a[i]=='p')
	s++;
	if(a[i]=='g')
	sn++;
	}
	x=(sn-s)/2;
	cout<<x;
	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(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
char a[106];
int main(){
	int s=0,sn=0,x;
	gets(a);
	for(int i=0;i<strlen(a);i++)
	{if(a[i]=='p')
	s++;
	if(a[i]=='g')
	sn++;
	}
	x=(sn-s)/2;
	cout<<x;
	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(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s;
int x=0,y=0,ans=0;
int main()
{
    cin>>s;
    for (int i=0;i<s.size();i++)
     if (x==y){x++; if(a[i]=='p') ans--;}
     else{y++; if(a[i]=='g') ans++;}
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: 'a' was not declared in this scope
    9 |      if (x==y){x++; if(a[i]=='p') ans--;}
      |                        ^
a.cc:10:19: error: 'a' was not declared in this scope
   10 |      else{y++; if(a[i]=='g') ans++;}
      |                   ^