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

def main():
    n = int(input())
    S = list(input())

    count = 0
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            count += 1
    print(n-count)


if __name__ == '__main__':
    main()


Compiler output:
a.cc:12:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   12 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def main():
      | ^~~
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
    System.out.println(solve);
  }
  
  private static long solve() {
    FastReader fr = new FastReader();
    int N = fr.nextInt();
    int result = 0;
    int current = -9999; // value of current character in Int
    for (int i = 0; i < N; i++) {
      int checking = fr.next().charAt(i) - 'a';
      if (current == checking) continue; // if found the same color, it will slime to the near by color
      current = checking; // change current color
      result++; // and also add one to result since we found a new color that can not be fused
    }
    
    return result;
  }
}

class FastReader {
  BufferedReader br;
  StringTokenizer st;

  public FastReader() {
    br = new BufferedReader(new
        InputStreamReader(System.in));
  }

  String next() {
    while (st == null || !st.hasMoreElements())
    {
      try
      {
        st = new StringTokenizer(br.readLine());
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }
    return st.nextToken();
  }

  int nextInt() {
    return Integer.parseInt(next());
  }

  long nextLong() {
    return Long.parseLong(next());
  }

  double nextDouble() {
    return Double.parseDouble(next());
  }

  String nextLine() {
    String str = "";
    try {
      str = br.readLine();
    }
    catch (IOException e) {
      e.printStackTrace();
    }
    return str;
  }
}

Compiler output:
Main.java:8: error: cannot find symbol
    System.out.println(solve);
                       ^
  symbol:   variable solve
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
char a , b;
int n, count = 0;
int main(){
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> b;
        if(b!=a){
            count++;
            a = b;
        }
    }
    cout << count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: reference to 'count' is ambiguous
   10 |             count++;
      |             ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:4:8: note:                 'int count'
    4 | int n, count = 0;
      |        ^~~~~
a.cc:14:13: error: reference to 'count' is ambiguous
   14 |     cout << count;
      |             ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:4:8: note:                 'int count'
    4 | int n, count = 0;
      |        ^~~~~
Language: C++

#include <cstdio>
int n,ans;
char ch,a[100010];
int main()
{
	scanf("%d",&n);
	ch=getchar();
	gets(a);
	ans=1;
	for(int i=1;i<n;i++)
	    if(a[i]!=a[i-1]) ans++;
	printf("%d",ans);
}

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(a);
      |         ^~~~
      |         getw
Language: C++

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

int main (){
    int n;
    string str ;
    cin >> n >> s ;  
  
    int loc = 0;
    int ans = 0;
    while(loc != n -2){
        if(str[loc] != str[loc+1]) ans++;
        loc++;
    }
    cout << ans << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 's' was not declared in this scope
    8 |     cin >> n >> s ;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N = 1e5 + 100;
char s[N];

int main() {
	int n, ans = 0;
 	cin>>n;
 	scanf("%s", s);
    char now = 'A';
    for(int i=0;i<=n;i++) {
    	if(s[i] != now) {
        	ans ++;
            now = s[i];
        }
    }
    printf("%d\n", ans);
}

Compiler output:
a.cc:4:8: error: size of array 's' is not an integral constant-expression
    4 | char s[N];
      |        ^
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    char[] c = s.toCharArray();

    int count = 0;

    for(int i=0; i<c.lnegth; i++){
      if(c[i] == c[i+1]){
        count++;
      }
    }
  }
}


Compiler output:
Main.java:12: error: cannot find symbol
    for(int i=0; i<c.lnegth; i++){
                    ^
  symbol:   variable lnegth
  location: variable c of type char[]
1 error
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Stirng s = sc.next();
    char[] c = s.toCharArray();

    int count = 0;

    for(int i=0; i<n; i++){
      if(c[i] == c[i+1]){
        count++;
      }
    }
  }
}


Compiler output:
Main.java:7: error: cannot find symbol
    Stirng s = sc.next();
    ^
  symbol:   class Stirng
  location: class Main
1 error
Language: Java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
    	String S = sc.next();
    	char[] array = S.toCharArray();
 
    	int count = 0;
    	for(int i = 0; i < N - 1; i++){
      		if(array[i] != array[i + 1]){
        		count++;
      		}
    	}
    	System.out.println(count + 1);
	}
	
	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}

Compiler output:
Main.java:13: error: cannot find symbol
    	String S = sc.next();
    	             ^
  symbol:   method next()
  location: variable sc of type FastScanner
1 error
Language: C++

    #include <bits/stdc++.h>
    #define ll long long
    #define f(i, a, b) for(ll i=a; i<b; i++)
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    using namespace std;
    ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
    {
        unordered_map<ll, ll> prevSum;
        ll res = 0;
        ll currsum = 0;
        for (ll i = 0; i < n; i++)
        {
            currsum += arr[i];
            if (currsum == sum) res++;
            if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
            prevSum[currsum]++;
        }
        return res; 
    } 
    ll gcd(ll a, ll b) 
    { 
        if (a == 0) 
            return b; 
        return gcd(b % a, a); 
    } 
      
    ll findGCD(ll arr[], ll n) 
    { 
        ll result = arr[0]; 
        for (ll i = 1; i < n; i++)
            result = gcd(arr[i], result); 
      
        return result; 
    } 
    ll powmp(ll x, ll y, ll p) 
    { 
        ll res = 1;     x = x % p;   
        while (y > 0) 
        {  
            if (y & 1)  res = (res*x) % p; 
            y = y>>1; 
            x = (x*x) % p;   
        } 
        return res; 
    } 
     
    int main()
    {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
       ll n;ans=0; cin>>n;
      string s; cin>>s;
      f(i,0,n)
      {
      ans++;
        while(s[i]==s[i+1] && i<n-1) i++;
      }
      cout<<ans;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |        ll n;ans=0; cin>>n;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll findGCD(ll arr[], ll n) 
{ 
    ll result = arr[0]; 
    for (ll i = 1; i < n; i++)
        result = gcd(arr[i], result); 
  
    return result; 
} 
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
   ll n;ans=0; cin>>n;
  string s; cin>>s;
  f(i,0,n)
  {
  ans++;
    while(s[i]==s[i+1]) i++;
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |    ll n;ans=0; cin>>n;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll findGCD(ll arr[], ll n) 
{ 
    ll result = arr[0]; 
    for (ll i = 1; i < n; i++)
        result = gcd(arr[i], result); 
  
    return result; 
} 
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
   ll n,ans=0;cin>>n;
  string s; cin>>s;
  f(i,0,n)
  {
  ans++;
    while(a[i]==a[i+1]) i++;
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:11: error: 'a' was not declared in this scope
   59 |     while(a[i]==a[i+1]) i++;
      |           ^
Language: C++

#define DBG 0 //submit 0
#if DBG
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <iostream>
    #include <cmath>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif

using namespace std;


int main(){
    int C,D,L,i,j,k,tmp = 0,tmpi = 0,ans = 1;
    int N;
    //string S;
    cin >> N;
    char s[N+5];
  	char a = '';
    for(i=0;i<N;i++){
        cin >> s[i];
    }
  
	a = s[0];
    for(i=1;i<N;i++){
      if(s[i] != a){
      	a = s[i];
        ans++;
      }
    }

  cout << ans << endl;
}


Compiler output:
a.cc:24:18: error: empty character constant
   24 |         char a = '';
      |                  ^~
Language: C

#include<stdio.h>
int N,i,j,count = 0;
 char a[1000000];
scanf("%d",&N);
for(i = 0;i < N;i++){
  scanf("%s",&a[i]);
}

for(i = count;i < N;i++){
  for(j = count;j < N;j++){
    if(a[i] == a[j]){
      count = count + 1;
    }else{
      break;
    }
  }
}
printf("%d",N - count);
return 0;
}

Compiler output:
main.c:4:7: error: expected declaration specifiers or '...' before string constant
    4 | scanf("%d",&N);
      |       ^~~~
main.c:4:12: error: expected declaration specifiers or '...' before '&' token
    4 | scanf("%d",&N);
      |            ^
main.c:5:1: error: expected identifier or '(' before 'for'
    5 | for(i = 0;i < N;i++){
      | ^~~
main.c:5:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    5 | for(i = 0;i < N;i++){
      |             ^
main.c:5:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    5 | for(i = 0;i < N;i++){
      |                  ^~
main.c:9:1: error: expected identifier or '(' before 'for'
    9 | for(i = count;i < N;i++){
      | ^~~
main.c:9:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    9 | for(i = count;i < N;i++){
      |                 ^
main.c:9:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    9 | for(i = count;i < N;i++){
      |                      ^~
main.c:18:8: error: expected declaration specifiers or '...' before string constant
   18 | printf("%d",N - count);
      |        ^~~~
main.c:18:13: error: expected declaration specifiers or '...' before 'N'
   18 | printf("%d",N - count);
      |             ^
main.c:19:1: error: expected identifier or '(' before 'return'
   19 | return 0;
      | ^~~~~~
main.c:20:1: error: expected identifier or '(' before '}' token
   20 | }
      | ^
Language: C++

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


void solve(long long N, std::string S){
    uniq(S);
    cout<<S.size()<<endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Compiler output:
a.cc: In function 'void solve(long long int, std::string)':
a.cc:43:10: error: invalid initialization of reference of type 'Vi&' {aka 'std::vector<long long int>&'} from expression of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   43 |     uniq(S);
      |          ^
a.cc:33:15: note: in passing argument 1 of 'void uniq(Vi&)'
   33 | void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
      |           ~~~~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int l;
  cin >> l;
  char prev = '';
  int total = 0;
  for (int i = 0; i < l; i++){
    char n;
    cin >> n;
    if (n != prev){
      total++
    }
    prev = n;
  }
  cout << total;
}

Compiler output:
a.cc:6:15: error: empty character constant
    6 |   char prev = '';
      |               ^~
a.cc: In function 'int main()':
a.cc:12:14: error: expected ';' before '}' token
   12 |       total++
      |              ^
      |              ;
   13 |     }
      |     ~
Language: Java

package miscellaneous;

import java.util.Scanner;

/**
 * Created by Krishna Kota on 26/10/19
 */

public class Slimes {
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(scanner.nextLine());
        int count = 1;
        String str = "";
        for (int i = 0; i < n; i++) {
            String x = scanner.next();
            str += x;
            if (i > 0 && !x.equals(str.charAt(i-1))) {
                count++;
            }
        }

        System.out.println(count);
    }
}


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

package miscellaneous;

import java.util.Scanner;

/**
 * Created by Krishna Kota on 26/10/19
 */

public class Slimes {
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(scanner.nextLine());
        int count = 1;
        String str = "";
        for (int i = 0; i < n; i++) {
            String x = scanner.next();
            str += x;
            if (i > 0 && !x.equals(str.charAt(i-1))) {
                count++;
            }
        }
        
        System.out.println(count);
    }
}


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

#include<stdio.h>

int main(){
    int N,ans=0;

    scanf("%d", &N);
    char S[];
    scanf("%s",S);
    for (int i = 0; i < N-1; i++){
        if (S[i] != S[i+1]){
            ans++;
        }
    }
    
    printf("%d\n",ans+1);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: storage size of 'S' isn't known
    7 |     char S[];
      |          ^
Language: C++


#include <iostream>

using namespace std;

int main()
{
	char moji[100000];
	int NumberOfmoji;
	int slimecount = 0;

	cin >> NumberOfmoji;
	cin >> moji;
	
	for (int i = 0; i < NumberOfmoji;i++) {

		if (strcmp(&moji[i],&moji[i+1])!=1) {
			slimecount++;
		}

	}
	
	cout << slimecount+1;


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: 'strcmp' was not declared in this scope
   17 |                 if (strcmp(&moji[i],&moji[i+1])!=1) {
      |                     ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 |
Language: C++

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
	char moji[100000];
	int NumberOfmoji;
	int slimecount = 0;

	cin >> NumberOfmoji;
	cin >> moji;
	
	for (int i = 0; i < NumberOfmoji;i++) {

		if (strcmp(&moji[i],&moji[i+1])!=1) {
			slimecount++;
		}

	}
	
	cout << slimecount+1;


    return 0;
}


Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>

using namespace std;

int main()
{
    int n=0;
    cin>>n;
    char s[n];
    int x=1;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i2=0;i2<n;i2++)
    {
        if(s[i2]=!s[i2+1])
        {
          x++;  
        }
    }
    cout <<x;
    return 0;
}


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

N = int(input())
S = int(input())
count = 0
b = " "
for i in range(N):
	
	if b == S[i]:
		count = count + 1
        b = S[i]

print(count)

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

#include<stdio.h>
#include<Stdlib.h>
int main()
{
    int x,i,j,flag=1;
    scanf("%d\n",&x);
    char s[1000];
    gets(s);
    for(i=0,j=i+1;i<x,j<x;i++,j++)
    {

        if(s[i]!=s[j])
          {
            flag++;
          }

    }
    printf("%d",flag);
}


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

#include<bits/stdc++.h>
 
#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)
 
using ll = long long;
using namespace std;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll n, ans = 0; cin >> n;
    int a[n]; REPI(i, n) cin >> a[i];
 
    sort(a, a + n);
 
    for(ll i = 0; i < n - 2; i++)
        for(ll j = i + 1; j < n - 1; j++)
            for(ll k = j + 1; k < n; k++)
                if(a[i] < a[j] + a[k] && a[j] < a[k] + a[i] && a[k] < a[i] + a[j])
                    ans++;
 
    cout << ans;
}
#include<bits/stdc++.h>

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    ll n, ans = 0; cin >> n;
    int a[n]; REPI(i, n) cin >> a[i];

    sort(a, a + n);

    for(ll i = 0; i < n - 2; i++)
        for(ll j = i + 1; j < n - 1; j++)
            for(ll k = j + 1; k < n; k++)
                if(a[i] < a[j] + a[k])
                    ans++;

    cout << ans;
}
提出情報

Compiler output:
a.cc:34:5: error: redefinition of 'int main()'
   34 | int main(){
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main(){
      |     ^~~~
a.cc:51:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   51 | 提出情報
      | ^~~~~~~~
Language: C

#include<stdio.h>
int main(){
  char s[];
  int n,a,b;
  int t=n;
    scanf("%d \n",&n);
  for(a=0;a<n;a++){
    scanf("%c ",&s[a]);
  }
  for(b=0;b<n;b++){
    if(s[b]==s[b+1]){
      t=t-1;}
  }
  printf("%d",t);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:8: error: array size missing in 's'
    3 |   char s[];
      |        ^
Language: C

#include<stdio.h>
int main(){
  char s[a];
  int n,a,b
  int t=n;
    scanf("%d \n",&n);
  for(a=0;a<n;a++){
    scanf("%c ",&s[a]);
  }
  for(b=0;b<n;b++){
    if(s[b]==s[b+1]){
      t=t-1;}
  }
  printf("%d",t);
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:3:10: error: 'a' undeclared (first use in this function)
    3 |   char s[a];
      |          ^
main.c:3:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 |   int t=n;
      |   ^~~
main.c:10:7: error: 'b' undeclared (first use in this function)
   10 |   for(b=0;b<n;b++){
      |       ^
main.c:12:7: error: 't' undeclared (first use in this function)
   12 |       t=t-1;}
      |       ^
Language: C++

#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define LL long long
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)

int N;
string s;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    //
    
    cin >> s;
    int r = 1;
    for(int i = 1; i < s.size(); ++i){
        if(s[i] != S[i - 1]) ++r;
    }

    cout << r;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: 'S' was not declared in this scope
   23 |         if(s[i] != S[i - 1]) ++r;
      |                    ^
Language: C++

#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define LL long long
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)

int N;
int A[1234];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    //
    
    cin >> s;
    int r = 1;
    for(int i = 1; i < s.size(); ++i){
        if(s[i] != S[i - 1]) ++r;
    }

    cout << r;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: 's' was not declared in this scope
   20 |     cin >> s;
      |            ^
a.cc:23:20: error: 'S' was not declared in this scope
   23 |         if(s[i] != S[i - 1]) ++r;
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  char a[n];
  cin>>a;
  int i;
  if(n==1)
    cout<<1;
  else
  {
    int s=1;
    for(i=0;i<=n-2;i++)
    {
      if(a[i]!=a[i+1])
        s++;
    }
  }
  cout<<s;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 's' was not declared in this scope
   21 |   cout<<s;
      |         ^
Language: C

#include <stdio.h>
int main(void){
	int n, cnt=1;
  	scanf("%d",&n);
  	char s[n];
  	scanf(%s,s);
  	for(int i=1; i<n; i++){
		if(s[i] != s[i-1]) cnt++;
    }
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:15: error: expected expression before '%' token
    6 |         scanf(%s,s);
      |               ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  int s;
  cin >> n >> s;
  int cnt=0;
  for(int i=1;i<n;i++){
    if(s[i] !=s[i-1]){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: invalid types 'int[int]' for array subscript
   11 |     if(s[i] !=s[i-1]){
      |         ^
a.cc:11:16: error: invalid types 'int[int]' for array subscript
   11 |     if(s[i] !=s[i-1]){
      |                ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::string str;

using namespace std;

inline int nxt(){int x;cin>>x;return x;}

inline str nxt_str(){str x;cin>>x;return x;}

inline nxt_ll(){ll x;cin>>x;return x;}

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n=nxt();
    str s=nxt_str();
    int ans=1;
    char cur=s[0];
    rep(i,1,n-1){
        if(s[i]!=cur){
            cur=s[i];
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:14:8: error: ISO C++ forbids declaration of 'nxt_ll' with no type [-fpermissive]
   14 | inline nxt_ll(){ll x;cin>>x;return x;}
      |        ^~~~~~
Language: C++

 #include <iostream>
using namespace std;
int main(){
  int N;
  int i,kei;
  cin >>N;
  char S[N];
  cin >>S;
  
  for(i=0;i<N;i++){
    if(S[i]!=S[i+1]){
      kei ++
    }
  }
    cout << kei << endl;
}
    
    
  

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

 #include <iostream>
using namespace std;
int main(){
  int N;
  int i,kei;
  cin >>N;
  char S[N];
  cin >>S;
  
  for(i=0;i<N;i++){
    if(S[i]!=S[i+1]){
      kei ++
    }
    cout << kei << endl;
  }
}
    
    
  

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

import java.util.Scanner;

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

		int n = sc.nextInt();

		String s = sc.next();
		Char[] c = s.toCharArray();

		int count = 1;

		for(int i=0; i<n-1; i++){
			if(!(c[i]==c[i+1])){
				count++;
			}
		}

		System.out.println(count);
	}
}


Compiler output:
Main.java:10: error: cannot find symbol
		Char[] c = s.toCharArray();
		^
  symbol:   class Char
  location: class Main
1 error
Language: Java

import java.util.Scanner;

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

		int n = sc.nextInt();

		String s = sc.next();
		Char[] c = s.toCharArray();

		int count = 1;

		for(int i=0; i<n-1; i++){
			if(c[i].equals(c[i+1]){
				count++;
			}
		}
		System.out.println(count);
	}
}


Compiler output:
Main.java:15: error: ')' expected
			if(c[i].equals(c[i+1]){
			                      ^
1 error
Language: Java

import java.util.Scanner;

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

		int n = sc.nextInt();

		String s = sc.next();
		Char[] c = s.toCharArray();

		int count = 1;

		for(int i=0; i<n-1; i++){
			if(c[i].equals(c[i+1]){
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Compiler output:
Main.java:15: error: ')' expected
			if(c[i].equals(c[i+1]){
			                      ^
1 error
Language: C++

#include<iostream>
#include <string.h>


using namespace std;

int main()
{
	int N;
	string S, C = "";
	
	cin >> N;
	cin >> S;
	
	for(int i = 0; i < N; i++){
		
		if(i == N -1){
			if(S[i] == S[i - 1]){
				C += S[i];
			}
		}
		else if(S[i] != S[i + 1]){
			C += S[i];
		}
	}
	
	cout << strlen(C) << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   27 |         cout << strlen(C) << endl;
      |                        ^
      |                        |
      |                        std::string {aka std::__cxx11::basic_string<char>}
In file included from a.cc:2:
/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++

#include<iostream>

using namespace std;

int main()
{
	int N;
	string S, C = "";
	
	cin >> N;
	cin >> S;
	
	for(int i = 0; i < N; i++){
		
		if(i == N -1){
			if(S[i] == S[i - 1]){
				C += S[i];
			}
		}
		else if(S[i] != S[i + 1]){
			C += S[i];
		}
	}
	
	cout << strlen(C) << endl;
	
	return 0;
}

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

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

int main() {
  int n;
  cin >> n;
  char s[];
  
  int ans = 1;
  for(int i=1; i<n; i++){
    if(s[i] != s[i-1]){
      ans++;
    }
  }
  cout << ans << endl;
}
      
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: storage size of 's' isn't known
    7 |   char s[];
      |        ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  char s[],ans[];
  
  int ans = 1;
  for(int i=1; i<n; i++){
    if(s[i] != s[i-1]){
      ans++;
    }
  }
  cout << ans << endl;
}
      
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: storage size of 's' isn't known
    7 |   char s[],ans[];
      |        ^
a.cc:7:12: error: storage size of 'ans' isn't known
    7 |   char s[],ans[];
      |            ^~~
Language: C++

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

int main(){
  int n;
  cin >> n;
  string s;
  int >>s;
  int ans = 0;
  for (int i = 0; i < n-1; i++){
    if (s[i] != s[i+1]) ans++;
  }
  ans++;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: expected unqualified-id before '>>' token
   10 |   int >>s;
      |       ^~
Language: C++

#include <iostreem>
#include <vector>
#include <string>
using namespace std;

int main(){
  int n;
  cin >> n;
  string s;
  int >>s;
  int ans = 0;
  for (int i = 0; i < n-1; i++){
    if (s[i] != s[i+1]) ans++;
  }
  ans++;
  cout << ans << endl;
}


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

n = int(input())
s = input()
ans = [s[0]]
for i in range(n-1):
    if s[i]!= s[i+1]:
        ans.append(s[i+1])
print(len(ans))

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

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

int main(void){
    int n,cnt=1;
    char c;
    char str[100000];
    scanf("%d",&n);
    scanf("%s",str);
    c=str[0];
    for(int i=1;i<n;i++){
        if(str[i]!=c){
            c=str[i];
            cnt++;
        }
    }
    printf("%d",cnt);
    return 0;
}

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

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    int n, ans = 0;
    string s;
    char p = '';

    cin >> n >> s;

    for (int i = 0; i < n; i++) {
        if (s[i] != p) {
            ans++;
        }
        p = s[i];
    }

    cout << p << '\n';
 
    return 0;
}

Compiler output:
a.cc:14:14: error: empty character constant
   14 |     char p = '';
      |              ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define nl cout << endl
#define pb push_back
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
//debugger
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

int main() {
	fast;
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans=1;
	for (int i=1; i<n; i++) {
		if (a[i]!=a[i-1]) {
			ans++;
		}
	}
	cout << ans;nl;
	return 0;
}

//notes
/*
 use these format of input when number of inputs not provided
 *while(scanf("%lld",&n)!=EOF)
 *while using getline(cin,s) for taking input of a string which is 
 having white space characters just write cin>>ws; before geline(cin,s)
 to make it work properly
*/

/*
 use 2-D vector for representing the pair<int,pair<int,int> > kind of things
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'a' was not declared in this scope
   26 |                 if (a[i]!=a[i-1]) {
      |                     ^
Language: C

#include<stdio.h>
int main()
{
int n;
scanf("%d",&n):
char arr[n];
int count=1;
scanf("%c",&arr[0]);
scanf("%c",&arr[0]);
char current=arr[0];
for(int i=1;i<n;i++)
{
  scanf("%c",&arr[i]);
  if(arr[i]!=current)
    count++;
  current=arr[i];
}
printf("%d",count);
  return 0;
}

  

Compiler output:
main.c: In function 'main':
main.c:5:15: error: expected ';' before ':' token
    5 | scanf("%d",&n):
      |               ^
      |               ;
main.c:8:13: error: 'arr' undeclared (first use in this function)
    8 | scanf("%c",&arr[0]);
      |             ^~~
main.c:8:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main(){
  int n;
  long long int cnt=0;
  string s;
  
  cin >> n >> s;
  
  char pre = '';
  for(auto c : s){
    if(pre != c){
      cnt++;
    }
    pre = c;
  }
  
  cout << cnt << endl;
  
  return 0;
}

Compiler output:
a.cc:12:14: error: empty character constant
   12 |   char pre = '';
      |              ^~
Language: C++

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

int N;
string s;

int main()
{
  cin >> N;
  cin >> s; s = ' ' + s + ' ';
  int res = 0;
  int key = 1;
  while (key <= N) 
  {
    while (a[key] == a[key + 1]) key++;
    key++;
    res++;
  }
  cout << res;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'a' was not declared in this scope
   15 |     while (a[key] == a[key + 1]) key++;
      |            ^
Language: C++

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

int N;
string s;

int main()
{
  cin >> N;
  cin >> s; s = ' ' + s + ' ';
  int res = 0;
  int key = 1;
  while (key <= n) 
  {
    while (a[key] != a[key + 1]) key++;
    res++;
  }
  cout << res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'n' was not declared in this scope
   13 |   while (key <= n)
      |                 ^
a.cc:15:12: error: 'a' was not declared in this scope
   15 |     while (a[key] != a[key + 1]) key++;
      |            ^
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();
        char a[] = new char[N+1];
        String s = sc.next();
        a = Arrays.copyOf(s.toCharArray(), N+1);
        char tmp = a[0];

        String result = "";

        for (int i = 1; i <= N; i++) {
            if (a[i] != tmp) {
                result += tmp;
                tmp = a[i];
            }
        }

        System.out.println(result.length());
    }
}


Compiler output:
Main.java:9: error: cannot find symbol
        a = Arrays.copyOf(s.toCharArray(), N+1);
            ^
  symbol:   variable Arrays
  location: class Main
1 error
Language: Java

import java.util.Scanner;

public class atCoder {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char a[] = new char[N];
        String s = sc.next();
        a = s.toCharArray();

        String result = "";

        for (int i = 0; i < N; i++) {
            for (int j = i+1; j < N; j++) {
                if (a[i] != a[j]) {
                    result += a[i];
                    i = j;
                }
            }
            if ( i == N -1 ) {
                result += a[i];
            }
        }

        System.out.println(result.length());
    }
}


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

#include <stdio.h>
#include <conio.h>


int main()
{
	int N;
	scanf("%d", &N);

	int Result = 0;
	char T = getch();
	for (int n = 0; n < N - 1; n++)
	{
		char _T = getch();
		if (T != _T)
			Result++;
		T = _T;
	}

	printf("%d", Result+1);
}

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

#include<stdio.h>
int main(void) {
	char S[10000], int N;
	char S2[10000];
	int k = 0;
	scanf("%d", &N);
	scanf("%s", S);
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (S[i] != S[j]) {
				S2[k] = S[i];
				k++;
				i = j;
				break;
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:24: error: expected unqualified-id before 'int'
    3 |         char S[10000], int N;
      |                        ^~~
a.cc:6:22: error: 'N' was not declared in this scope
    6 |         scanf("%d", &N);
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LOOP(i,o) for(i=0;i<o;i++)
int main() {
  int n;
  string s;
  cin>>n;
  cin>>s;
  int i;
  int ans=1;
  LOOP(i,n-1){
    if(a[i]!=a[i+1]){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'a' was not declared in this scope
   12 |     if(a[i]!=a[i+1]){
      |        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  char arr[n];
  for(int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  string ret = "";
  for(int i = 0; i < n; i++) {
  	ret = ret + arr[i];
    while(i + 1 < n && arr[i].compare(arr[i+1]) == 0) {
      i++;
    }
  }
  
  cout << ret;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: request for member 'compare' in 'arr[i]', which is of non-class type 'char'
   15 |     while(i + 1 < n && arr[i].compare(arr[i+1]) == 0) {
      |                               ^~~~~~~
Language: C++

#include<iostream>
#include<string.h>

int main(void){
  int N,ans=1;
  string S;
  cin>>N;
  cin>>S;
  for(int i=0;i<N;i++){
  if(S[i]!=S[i+1])ans++;
  cout<<ans<<endl;
  }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
    6 |   string S;
      |   ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin>>N;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:8: error: 'S' was not declared in this scope
    8 |   cin>>S;
      |        ^
a.cc:11:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   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:11:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 |   cout<<ans<<endl;
      |              ^~~~
      |              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
#include<string>

int main(void){
  int N,ans=1;
  string S;
  cin>>N;
  cin>>S;
  for(int i=0;i<N;i++){
  if(S[i]!=S[i+1])ans++;
  cout<<ans<<endl;
  }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
    6 |   string S;
      |   ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin>>N;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:8: error: 'S' was not declared in this scope
    8 |   cin>>S;
      |        ^
a.cc:11:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   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:11:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 |   cout<<ans<<endl;
      |              ^~~~
      |              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~