criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;
public class Saburo{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String v=sc.nextLine();
    String s;
    int g=0;
    for(int index=0;index<v.length();index++){
      if(v.charAt(index)!='W'&&v.charAt(index)!='B'){
        g++;
      }
    }
    if(g!=0){
      s=sc.nextLine();
    }else{
     s=v; 
    }
    int c=s.codePointAt(0);
    int n=0;
    for(int index=1;index<s.length();index++){
      if(c!=s.codePointAt(index)){
        n++;
        c=s.codePointAt(index);
      }
    }
    System.out.println(n);
  }
}

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

import numpy as np
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

s = input()
ans = 1
tmp = s[0]
for i in s:
    if i != tmp:
        ans += 1
        tmp = i
print(ans-1)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lengh'; did you mean 'length'?
   22 |   for(int i=0;i<s.lengh()-1,i++){
      |                   ^~~~~
      |                   length
a.cc:22:32: error: expected ';' before ')' token
   22 |   for(int i=0;i<s.lengh()-1,i++){
      |                                ^
      |                                ;
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;a
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin>>s;
    ll count=0;
    for(int i=0;i<s.length()-1;i++){
        if(s[i+1]!=s[i])
            count++;
    }
    cout<<count<<endl;
}


Compiler output:
a.cc:18:24: error: 'a' does not name a type
   18 | typedef long double ld;a
      |                        ^
Language: Java

import java.util.*;
public class Stp
{
  	public static void main(String args[])
    {
		Scanner sc=new Scanner(System.in);
		String s="";
      	if(sc.hasNext())
          s=sc.next();
		char []ch=s.toCharArray();
		int c=0;
		for(int i=0; i<ch.length-1;i++)
		{
		if(ch[i] != ch[i+1])
			c++;
		}
		System.out.println(c);
    }
}

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

import java.util.*;
public class S
{
	Scanner sc=new Scanner(System.in);
  	String s=sc.next();
  	char []ch=s.toCharArray();
  	int c=0;
  	for(int i=0; i<ch.length()-1;i++)
    {
      if(ch[i] != ch[i+1])
        c++;
    }
  System.out.println(c);
}

Compiler output:
Main.java:8: error: illegal start of type
  	for(int i=0; i<ch.length()-1;i++)
  	^
Main.java:8: error: > or ',' expected
  	for(int i=0; i<ch.length()-1;i++)
  	                        ^
Main.java:8: error: ';' expected
  	for(int i=0; i<ch.length()-1;i++)
  	                          ^
Main.java:8: error: <identifier> expected
  	for(int i=0; i<ch.length()-1;i++)
  	                              ^
Main.java:13: error: <identifier> expected
  System.out.println(c);
                    ^
Main.java:13: error: <identifier> expected
  System.out.println(c);
                      ^
6 errors
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:14:3: error: expected declaration or statement at end of input
   14 |   printf("%d\n", count);
      |   ^~~~~~
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 string s ;
 cin >> s ;
 int k=s.size() ;
 int ans=0 ;
 rep(i,ｋ-1) {
   if(s[i]!=s[i+1] ) ans ++ ;
 }

cout <<ans <<endl ;
     return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:8: error: '\U0000ff4b' was not declared in this scope
   17 |  rep(i,ｋ-1) {
      |        ^~
a.cc:4:43: note: in definition of macro 'rep'
    4 | #define rep(i,n) for (long long i=0; i < (n); ++i)
      |                                           ^
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 string s ;
 cin >> s ;
 int k=s.size() ;
 int ans=0 ;
 rep(i,n-1) {
   if(s[i]!=s[i+1] ) ans ++ ;
 }

cout <<ans <<endl ;
     return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  string s;
  cin >> s;
  ll k=s.size();
  ll cnt=0;
  rep(i,k-1){
    if(a[i]!=a[i+1]){
      cnt++;
    }
  }
  cout << cnt << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  string s;
  cin >> s;
  ll k=s.size();
  ll cnt=0;
  rep(i,k){
    if(a[i]!=a[i+1]){
      cnt++;
    }
  }
  cout << cnt << endl;
}

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

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    string S;
    cin >> string;
    N=S.size()
    ll i;
    ll cnt=0;
    for(i=0;i<N-1;i++){
        if(S[i]!=S[i+1])cnt++;
    }
    cout << cnt <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected primary-expression before ';' token
   16 |     cin >> string;
      |                  ^
a.cc:17:5: error: 'N' was not declared in this scope
   17 |     N=S.size()
      |     ^
a.cc:20:9: error: 'i' was not declared in this scope
   20 |     for(i=0;i<N-1;i++){
      |         ^
Language: C++

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

int main(){
  int ans=0;
  string board;
  cin >> board;
  char piece=board[0];
  
  for(int i=1;i<board.size();i++){
    if(piece!=board[i]) {
      piece=board[i]
      ans++;}
  }
  cout << ans << endl;
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'ans'
   12 |       piece=board[i]
      |                     ^
      |                     ;
   13 |       ans++;}
      |       ~~~
Language: C++

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

int main(){
  int ans=0;
  string board;
  cin >> board;
  char piece=board[0];
  
  for(int i=1;i<board.size();i++){
    if(piece!=board[i]) {
      piece=board[i]
      ans++;}
    
  cout << ans << endl;
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'ans'
   12 |       piece=board[i]
      |                     ^
      |                     ;
   13 |       ans++;}
      |       ~~~            
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

char hhj[100005],y;
int count,wb;

int main()
{
    while(hhj[wb]=getchar(),hhj[wb]!='\n')
    {

        if(wb==0)
          y=hhj[wb];
        if(hhj[wb]!=y)
          count++,y=hhj[wb];
        wb++;
    }
    printf("%d\n",count);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: reference to 'count' is ambiguous
   15 |           count++,y=hhj[wb];
      |           ^~~~~
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:5:5: note:                 'int count'
    5 | int count,wb;
      |     ^~~~~
a.cc:18:19: error: reference to 'count' is ambiguous
   18 |     printf("%d\n",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:5:5: note:                 'int count'
    5 | int count,wb;
      |     ^~~~~
Language: C++

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

char hhj[100005],y;
int count,wb;

int main()
{
    while(hhj[wb]=getchar(),hhj[wb]!='\n')
    {

        if(z==0)
          y=hhj[wb];
        if(hhj[wb]!=y)
          count++,y=hhj[wb];
        wb++;
    }
    printf("%d\n",count);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'z' was not declared in this scope
   12 |         if(z==0)
      |            ^
a.cc:15:11: error: reference to 'count' is ambiguous
   15 |           count++,y=hhj[wb];
      |           ^~~~~
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:5:5: note:                 'int count'
    5 | int count,wb;
      |     ^~~~~
a.cc:18:19: error: reference to 'count' is ambiguous
   18 |     printf("%d\n",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:5:5: note:                 'int count'
    5 | int count,wb;
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
int cnt[2][105];
int h, w;
bool flag[110][110];

int main() {
	string s;
	cin >> s;
	char target = s[0];
	int n = s.length();
	int ans = 0;
	for (int i = 1;i < n;++i) {
		if (target != s[i]) {
			taget = s[i];
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:25: error: 'taget' was not declared in this scope; did you mean 'target'?
   66 |                         taget = s[i];
      |                         ^~~~~
      |                         target
Language: C++

#include<bits/stdc++.h>
string s;
int cnt,l;
int main(){
    cin>>s;
    l=s.size();
    for(int i=1;i<l;++i)cnt+=(s[i]!=s[i-1]);
    cout<<cnt<<endl;
    return 0;
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
    2 | string s;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |     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:5:10: error: 's' was not declared in this scope
    5 |     cin>>s;
      |          ^
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     cout<<cnt<<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:8:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 |     cout<<cnt<<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>
string srx[100001];
int cnt,l;
int main(){
    cin>>s;
    l=s.size();
    for(int i=1;i<l;++i)cnt+=(s[i]!=s[i-1]);
    cout<<cnt<<endl;
    return 0;
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
    2 | string srx[100001];
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |     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:5:10: error: 's' was not declared in this scope
    5 |     cin>>s;
      |          ^
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     cout<<cnt<<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:8:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 |     cout<<cnt<<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() {
  int S;
  cin >> S;
  int ans=0;
  for(int i = 0;i < S.size() - 1; i++){
    ans+=(S.at(i) != S.at(i + 1));
  }
  cout << ans << endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'size' in 'S', which is of non-class type 'int'
    7 |   for(int i = 0;i < S.size() - 1; i++){
      |                       ^~~~
a.cc:8:13: error: request for member 'at' in 'S', which is of non-class type 'int'
    8 |     ans+=(S.at(i) != S.at(i + 1));
      |             ^~
a.cc:8:24: error: request for member 'at' in 'S', which is of non-class type 'int'
    8 |     ans+=(S.at(i) != S.at(i + 1));
      |                        ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int S;
  cin >> S;
  int ans=0;
  for(int i = 0;i < S.size() - 1; i++){
    ans+=(S[i] != S[i + 1]);
  }
  cout << ans << endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'size' in 'S', which is of non-class type 'int'
    7 |   for(int i = 0;i < S.size() - 1; i++){
      |                       ^~~~
a.cc:8:12: error: invalid types 'int[int]' for array subscript
    8 |     ans+=(S[i] != S[i + 1]);
      |            ^
a.cc:8:20: error: invalid types 'int[int]' for array subscript
    8 |     ans+=(S[i] != S[i + 1]);
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int S;
  cin >> S;
  int ans=0;
  for(int i = 0;i < S.size() - 1; i++){
    ans+=(s[i] != s[i + 1]);
  }
  cout << ans << endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'size' in 'S', which is of non-class type 'int'
    7 |   for(int i = 0;i < S.size() - 1; i++){
      |                       ^~~~
a.cc:8:11: error: 's' was not declared in this scope
    8 |     ans+=(s[i] != s[i + 1]);
      |           ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    string a;
    int s=0;
    cin>>a;
    for(int i=1;i<s.size();i++)
        if(a[i]!=a[i-1])
            s++;
    cout<<s<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: request for member 'size' in 's', which is of non-class type 'int'
    9 |     for(int i=1;i<s.size();i++)
      |                     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int l=S.length(), count=0;
  for(int i=0; i < l-1; i++) {
     if(s.at(i) != s.at(i+1)) count++;
  }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 's' was not declared in this scope
    8 |      if(s.at(i) != s.at(i+1)) count++;
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string jia(string a,string b)
{
  int aa,bb;
  int alen=a.length();
  int blen=b.length();
  if(alen<blen)
  {
    swap(a,b);
    swap(alen,blen);
  }
  int bblen=blen;
  blen--;
  for(int i=alen-1; i>=1; i--)
  {
    if(blen>=0)
    {
      if(a[i]+b[blen]<106)
      {
        a[i]=a[i]+b[blen]-48;
      }
      else
      {
        a[i-1]++;
        a[i]=a[i]+b[blen]-58;
      }
      blen--;
    }
    else
    {
      if(a[i]>'9')
        a[i]=a[i]-10,a[i-1]++;
    }
  }
  if(bblen==alen)
  {
    aa=(int)(a[0])-48,bb=(int)(b[0])-48;
    if(aa+bb<10)
    {
      a[0]=(char)(aa+bb+48);
    }
    else
    {
      cout<<1;
      a[0]=(char)(aa+bb+38);
    }
  }
  else
  {
    if(a[0]>'9')
    {
      a[0]=a[0]-10;
      cout<<1;
    }
  }
  cout<<a<<endl;
}

int a[5001],b[5001],ans[5001];
int main()
{
	int s;
  cin>>s;
  int  ans=0;
  for(int i=0;i<s.length();i++)
  if(s[i]!=s[i-1])ans++;
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'std::string jia(std::string, std::string)':
a.cc:58:1: warning: no return statement in function returning non-void [-Wreturn-type]
   58 | }
      | ^
a.cc: In function 'int main()':
a.cc:66:19: error: request for member 'length' in 's', which is of non-class type 'int'
   66 |   for(int i=0;i<s.length();i++)
      |                   ^~~~~~
a.cc:67:7: error: invalid types 'int[int]' for array subscript
   67 |   if(s[i]!=s[i-1])ans++;
      |       ^
a.cc:67:13: error: invalid types 'int[int]' for array subscript
   67 |   if(s[i]!=s[i-1])ans++;
      |             ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define adrep(i,s,n) for (int i=(s);i<(n);i++)
using namespace std;
typedef long long ll;

int main(){

  int S;
	
  cin>>S;
	
  int count=0;
  int N=S.length()-1;
  rep(i,N){

    if(S[i]!=S[i+1])count++;
    
  }
  
  cout<<count<<endl;
  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: request for member 'length' in 'S', which is of non-class type 'int'
   14 |   int N=S.length()-1;
      |           ^~~~~~
a.cc:17:9: error: invalid types 'int[int]' for array subscript
   17 |     if(S[i]!=S[i+1])count++;
      |         ^
a.cc:17:15: error: invalid types 'int[int]' for array subscript
   17 |     if(S[i]!=S[i+1])count++;
      |               ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define adrep(i,s,n) for (int i=(s);i<(n);i++)
using namespace std;
typedef long long ll;

int main(){

  int S;
	
  cin>>S;
	
  int count=0;
  rep(i,S.length()-1){

    if(S[i]!=S[i+1])count++;
    
  }
  
  cout<<count<<endl;
  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: request for member 'length' in 'S', which is of non-class type 'int'
   14 |   rep(i,S.length()-1){
      |           ^~~~~~
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i=0;i<(n);i++)
      |                                  ^
a.cc:16:9: error: invalid types 'int[int]' for array subscript
   16 |     if(S[i]!=S[i+1])count++;
      |         ^
a.cc:16:15: error: invalid types 'int[int]' for array subscript
   16 |     if(S[i]!=S[i+1])count++;
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  for (int i = 0; i < S.size() - 1; i++) {
    if (S[i] == S[i + 1]) {
      S = S.substr(0,i) + S.substr(i + 1,S.size() - 1 - i);
      i--
    }
  }
  cout << S.size() - 1 << endl;
  return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define str(n) to_string(n)
#define int(w) stoi(w)
#define len(l) l.size()
#define append(l,i) l.push_back(i)
int main() {
    string w;
    cin>>w;
    int ans=0;
    rep(i,w.length()-1){
        if (w.at(i)!=w.at(i+1)){
            ans+=1;
        })
    }
    cout<<ans<<endl;

    return 0;
}

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

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

int main() {
  int ret=0;
  string s; cin>>s;
  for(int i=1;i<s.size();++i)
    if(s[i]!=s[i-1])
      ret++;
  cout<<r<<"\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'r' was not declared in this scope
   10 |   cout<<r<<"\n";
      |         ^
Language: Java

let ans s =
  let n = String.length s in
  let rec f i c ret =
    if i = n then ret
    else if s.[i] = c then f (i+1) c ret
    else f (i+1) s.[i] (ret+1)
  in f 1 s.[0] 0;;

Scanf.scanf "%s" (fun s -> print_int (ans s))


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
let ans s =
^
Main.java:9: error: class, interface, enum, or record expected
Scanf.scanf "%s" (fun s -> print_int (ans s))
^
2 errors
Language: C++

#include<bits/stdc++.h>
string s;
int ans;
int main()
{
    cin>>s;
    for(int i=1;i<s.size();i++)
        if(s[i]!=s[i-1])
    ans++;
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
    2 | string s;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc: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,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:10: error: 's' was not declared in this scope
    6 |     cin>>s;
      |          ^
Language: C++

#include<bits/stdc++.h>
string s;
int ans;
int main()
{
    cin>>s;
    for(i=1;i<s.size();i++)
        if(s[i]!=s[i-1])
    ans++;
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type; did you mean 'stdin'?
    2 | string s;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc: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,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:10: error: 's' was not declared in this scope
    6 |     cin>>s;
      |          ^
a.cc:7:9: error: 'i' was not declared in this scope
    7 |     for(i=1;i<s.size();i++)
      |         ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string s; cin >> s;
    if (s.size() == 1) {
        cout << 0 << endl;
    }
    char cur = s[0];
    ll c1 = 0, c2 = 0;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] != cur) c1++;
        cur = s[i];
    }

    reverse(all(s));
    char cur = s[0];
    for (int i = 1; i < s.size(); i++) {
        if (s[i] != cur) c2++;
        cur = s[i];
    }

    cout << min(c1, c2) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:10: error: redeclaration of 'char cur'
   26 |     char cur = s[0];
      |          ^~~
a.cc:18:10: note: 'char cur' previously declared here
   18 |     char cur = s[0];
      |          ^~~
Language: C++

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

int main(){
    int ans=0;
    string s;
    char te;
    cin >> s;
    te=s.at(0);
    for(int i=1;i<s.size;i++){
        if(te!=s.at(i)){
            te=s.at(i);
            ans++;
        }
    }

    cout << ans << endl;

}

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

#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
	string s;
  	cin >> s;
  	char pre = s[i];
  	int ans = 0;
  	for(int i = 0; i < s.size(); i++) {
      	if (s[i] != pre)
        	ans += 1;
    	pre = s[i];
    }
  	cout << ans << endl;
    return 0;
}



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

#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    string s;
    cin >> s;
    long long ans = 0;
    rep(i, 1, s.length())
    {
        if (s[i] != s[i - 1])
            ans++;
    }
    cout << ans << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:35:25: error: expected '}' at end of input
   35 |     cout << ans << endl;
      |                         ^
a.cc:26:1: note: to match this '{'
   26 | {
      | ^
Language: C++

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, s.size() - 1) if (s[i] != s[i + 1])
        cnt++;

    OP();

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: expected primary-expression before '<<' token
   10 | #define OP(m) cout << m << endl
      |                         ^~
a.cc:23:5: note: in expansion of macro 'OP'
   23 |     OP();
      |     ^~
Language: C++

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

int main(){
  string S;
  
  if(S.size()==0){
    cout<<0<<endl;
  }else{
    int sum=0;
    int n=S.size();
    for(int i=0;i<n-1;i++){
      if((S.at(i)=='W'&&S.at(i+1)=='B')||(S.at(i)=='B'&&S.at(i+1)=='W')){
        sum+;
      }
    }
    cout<<sum<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected primary-expression before ';' token
   14 |         sum+;
      |             ^
Language: Java

import java.util.Scanner;

public class MainC {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int ans = 0;
		for (int i = 1; i < s.length; i++) {
			if(s[i] != s[i-1]) ans++;
		}
		System.out.println(ans);
		sc.close();
	}
}

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

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  string s;
  cin>>s;
  vector<pint> p;
  runlength(s,p);
  cout<<p.size()-1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:143:15: error: invalid initialization of reference of type 'std::vector<std::pair<char, long long int> >&' from expression of type 'std::vector<std::pair<long long int, long long int> >'
  143 |   runlength(s,p);
      |               ^
a.cc:79:48: note: in passing argument 2 of 'void runlength(std::string, std::vector<std::pair<char, long long int> >&)'
   79 | void runlength(string s,vector<pair<char,ll>> &p){
      |                         ~~~~~~~~~~~~~~~~~~~~~~~^
Language: C++

s = gets.chop

ans = 0
prev = s[0]

1.upto(s.length-1) do |i|
  ans += 1 unless s[i] == prev
  prev = s[i]
end

p ans

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = gets.chop
      | ^
Language: C++

#include<iostream>
#include<string>
 
using namespace std;
 
int main(){
  string s;
  cin>>s;
  int n=s.size();
  int a=0;
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]){
      a++
    }
  }
  cout<<a<<endl;
  return 0;
}

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

#include<iostream>
#include<string>

using namespace std;

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

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: 'N' was not declared in this scope
   10 |  for (ll i = 1; i < N; ++i)
      |                     ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    string t[a];
    int s=0;
    gets(t);
    for(int i=1;t[i]!='\0';i++)
    if(t[i]!=t[i--])s++;
    cout<<s<<endl;
    return 0;
}

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

#include<iostream>
#include<cstdio>
using namespace std;
int a=100000;
int main()
{
    char t[a];
    int s=0;
    gets(t)
    for(int i=1;t[i]!='\0';i++)
    if(t[i]!=t[i--])s++;
    cout<<s<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |     gets(t)
      |     ^~~~
      |     getw
a.cc:10:19: error: 'i' was not declared in this scope
   10 |     for(int i=1;t[i]!='\0';i++)
      |                   ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int a=100000;
int main()
{
    char t[a],s=0;
    gets(t)
    for(int i=1;t[i]!='\0';i++)
    if(t[i]!=t[i--])s++;
    cout<<s<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |     gets(t)
      |     ^~~~
      |     getw
a.cc:9:19: error: 'i' was not declared in this scope
    9 |     for(int i=1;t[i]!='\0';i++)
      |                   ^
Language: C++

#include<cstdio>
using namespace std;
int main()
{
    char c,s;
    int ans=0;
    cin>>c;
    for(int i=0;i<100000;i++)
    {
        cin>>s;
        if(s!=c){ans++;c=s;}
        if(s==EOF)break;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin>>c;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout<<ans<<endl;
      |     ^~~~
a.cc:14:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:16: error: 'endl' was not declared in this scope
   14 |     cout<<ans<<endl;
      |                ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cstdio>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    char c,s;
    int ans=0;
    cin>>c;
    for(cin>>s)
    {
        if(s!=c)ans++;
        c=s;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected ';' before ')' token
    9 |     for(cin>>s)
      |               ^
      |               ;
a.cc:15:5: error: expected primary-expression before 'return'
   15 |     return 0;
      |     ^~~~~~
a.cc:14:21: error: expected ')' before 'return'
   14 |     cout<<ans<<endl;
      |                     ^
      |                     )
   15 |     return 0;
      |     ~~~~~~           
a.cc:9:8: note: to match this '('
    9 |     for(cin>>s)
      |        ^
Language: C++

#include<iostream>
using namespace std;
string s,k;
int main()
{
cin>>s;
for(int i=1;i<=s.size()-1;i++)
{
if(s[i]!=s[i-1])
k++;
}
cout<<k<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:2: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   10 | k++;
      | ~^~
Language: C++

#include<iostream>
using namespace std;
string s,k;
int main()
{
cin>>s;
for(int i=1;i<=s.size()-1;i++)
{
if(s[i]!=s[i-1]
k++;
}
cout<<k<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: expected ';' before 'k'
    9 | if(s[i]!=s[i-1]
      |                ^
      |                ;
   10 | k++;
      | ~               
a.cc:11:1: error: expected primary-expression before '}' token
   11 | }
      | ^
a.cc:10:5: error: expected ')' before '}' token
   10 | k++;
      |     ^
      |     )
   11 | }
      | ~    
a.cc:9:3: note: to match this '('
    9 | if(s[i]!=s[i-1]
      |   ^
a.cc:11:1: error: expected primary-expression before '}' token
   11 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  string s;
  cin>>s;
  
  vector<int> v;
  int cnt=0,start;
  bool flag=true;
  for(long long int i=0;i<s.size();i++){
    if(flag){
      start=i;
      flag=false;
    }
    if(s[i]==s[i+1]){
      cnt++;
    }else{
      v.push_back(s.substr(start,cnt+1));
      cnt=0;
      flag=true;
    }
  }
  cout<<v.size()-1<<endl;
}
///////////////////////////

Compiler output:
a.cc: In function 'int main()':
a.cc:84:18: error: no matching function for call to 'std::vector<int>::push_back(std::__cxx11::basic_string<char>)'
   84 |       v.push_back(s.substr(start,cnt+1));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~