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

次のコンテストでうっかりPythonで提出したくないので

Compiler output:
a.cc:1:1: error: '\U00006b21\U0000306e\U000030b3\U000030f3\U000030c6\U000030b9\U000030c8\U00003067\U00003046\U00003063\U0000304b\U0000308aPython\U00003067\U000063d0\U000051fa\U00003057\U0000305f\U0000304f\U0000306a\U00003044\U0000306e\U00003067' does not name a type
    1 | 次のコンテストでうっかりPythonで提出したくないので
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>

int main() {
	std::string s; std::cin >> s;
	int counta = 0;
	for (int i = 0; i < s.size(); ++i) {
		++counta;
		if (s[i] == s[i + 1]) {
			++i;
		}
	}
	int countb = 0;
	if (s[0] == s[1]) {
		countb = 1;
		for (int i = 2; i < s.size(); ++i) {
			++counta;
			if (s[i] == s[i + 1]) {
				++i;
			}
	}
	std::cout << counta << std::endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: C++

s=input()
ans=1
l=len(s)
now=s[0]
for i in range(1,l):
    if now!=s[i]:
        now=s[i]
        ans+=1
    else:
        now+=s[i]
print(ans)


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

#include<bits/stdc++.h>
using namespace std;
int main() {
  string s; cin >> s;
  vector<int> v;
  {
    int l = 1;
    for (int i = 1; i < s.size(); i++) {
      if (s[i] == s[i-1]) l++;
      else {
        v.push_back(l);
        l = 1;
      }
    }
    v.push_back(l);
  }
  int res = 0;
  for (int i = 0; i + 1 < v.size(); i++) {
    if (v[i] % 3 == 0) {
      res += v[i] / 3 * 2;
    } else if (v[i] % 3 == 1) {
      res += v[i] / 3 * 2 + 1;
    } else {
      res += v[i] / 3 * 2 + 2;
      v[i+1]--;
    }
  }
  int x = v.back();
  if (x % 3 == 0) {
    res += v[i] / 3 * 2;
  } else if (x % 3 == 1) {
    res += v[i] / 3 * 2 + 1;
  } else {
    res += v[i] / 3 * 2 + 1;
  }
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: 'i' was not declared in this scope
   30 |     res += v[i] / 3 * 2;
      |              ^
a.cc:32:14: error: 'i' was not declared in this scope
   32 |     res += v[i] / 3 * 2 + 1;
      |              ^
a.cc:34:14: error: 'i' was not declared in this scope
   34 |     res += v[i] / 3 * 2 + 1;
      |              ^
Language: C++

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

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

%8sぅrc;x九dtl８市dひょうWD‘」いｐ＠い「ｐ＝DO

Compiler output:
a.cc:1:9: error: extended character ‘ is not valid in an identifier
    1 | %8sぅrc;x九dtl８市dひょうWD‘」いｐ＠い「ｐ＝DO
      |         ^
a.cc:1:9: error: extended character 」 is not valid in an identifier
a.cc:1:9: error: extended character 「 is not valid in an identifier
a.cc:1:1: error: expected unqualified-id before '%' token
    1 | %8sぅrc;x九dtl８市dひょうWD‘」いｐ＠い「ｐ＝DO
      | ^
a.cc:1:9: error: 'x\U00004e5ddtl\U0000ff18\U00005e02d\U00003072\U00003087\U00003046WD\U00002018\U0000300d\U00003044\U0000ff50\U0000ff20\U00003044\U0000300c\U0000ff50\U0000ff1dDO' does not name a type
    1 | %8sぅrc;x九dtl８市dひょうWD‘」いｐ＠い「ｐ＝DO
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define rall(v)     (v).rbegin(),(v).rend()
#define sort(v)     sort((v).begin(),(v).end())
#define rsort(v)    sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
#define sum(v)+x    accumulate(v.begin(), v.end(),x);
typedef pair<int,int> pii;  
typedef vector<int> vi;
//x.substr(start, length);
/*
// Create a vector containing n 
//vectors of size m.  
    vector<vector<int> > vec( n , vector<int> (m, 0));  
*/
struct type{
    int k, i, j;
};
//to check if a no is prime or not?
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

// minimum subaaray sum of size k-sliding window approach
int findSubarray(int arr[], int n, int k)
{
	int window_sum = 0;
	int min_window = INT_MAX;
	int last = 0;
	for (int i = 0; i < n; i++)
	{
		window_sum += arr[i];
		if (i + 1 >= k)
		{
			if (min_window > window_sum)
			{
				min_window = window_sum;
				last = i;
			}
			window_sum -= arr[i + 1 - k];
		}
	}
	int sum=0;
	for(int i=last-k+1;i<=last;i++)
	{
	    sum+=arr[i];
	}
	return sum;
}
//finds the next permutation to given sequence of nos
int nextpermutation(vi v)
{
    vi t=v;
    sort(t);
    int x=0;
    while(true)
    {
        x++;
        if(t==v)
        {
            return x;
        }
        next_permutation(all(t));
    }
}
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    string s;
    cin>>s;
    int n=s.length();
    int x=1;
    int ans=0;
    bool flag=true;
    for(int i=0;i<n-1;i++)
    {
        if(s[i]!=s[i+1])
        {
            ans+=2*(x/3);
            if(x%3==1)ans++;
            if(x%3==2)
            {
                ans+=2;
                i+=1;
            }
            x=1;
            flag=false;
        }
        else
        {
            x++;
            flag=true;
        }
        
    }
    ans+=2*(x/3);
    if(x%3==1)ans++;
    else if(x%3==2 and flag=false)ans++;
    x=0;
    print(ans)
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:126:20: error: lvalue required as left operand of assignment
  126 |     else if(x%3==2 and flag=false)ans++;
      |             ~~~~~~~^~~~~~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
//#include<unordered_map>
//#include<unordered_set>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cstring>
#include <functional>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1Int<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P; 
const int N = 200005;
//////////////////////////////
 
int n;
string s;
int dp[N];
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
 
	memset(dp, 0, sizeof dp);
 
	cin >> s;
	n = s.size();
	dp[1] = 1;
	if (s[0] == s[1])dp[2] = 1;
	else dp[2] = 2;
 
	for (int i = 3; i <= n; i++) {
		if (s[i - 1] != s[i - 2]) dp[i] = dp[i - 1] + 1;
		else dp[i] = dp[i - 3] + 2;
	}
 
	cout << dp[n] << endl;
 
	

Compiler output:
a.cc: In function 'int main()':
a.cc:48:31: error: expected '}' at end of input
   48 |         cout << dp[n] << endl;
      |                               ^
a.cc:32:12: note: to match this '{'
   32 | int main() {
      |            ^
Language: C++

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


int main(){
string s, pre, post;
cin>>s;pre = s.at(0), post ="";
int k = 0;
for(int i = 1; i<s.size(), i++){
post += s[i];
if(pre!=post){
k++;
pre = post;
post = "";
}


} 
cout<<k<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:31: error: expected ';' before ')' token
   10 | for(int i = 1; i<s.size(), i++){
      |                               ^
      |                               ;
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t = ""; cin >> s;
    int n = s.size(), st = 0;
    int ans = 0;
    if (n == 1) cout << 1 << "\n";
    else {
        rep (i, 1, n + 1) {
            // if (string u = s.substr(st, i - st); u != t) {
            if (s.substr(st, i - st) != t) {
            if (string u = s.substr(st, i - st); u != t) {
                t = s.substr(st, i - st);
                eprintf("%s ", t.c_str());
                st = i;
                ans++;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:2: error: expected '}' at end of input
   67 | }
      |  ^
a.cc:46:1: note: to match this '{'
   46 | {
      | ^
Language: C++

s = input()
n = len(s)
ans = 1
l = ''
k = s[0]
for i in range(1,n):
    
    
    if l + s[i] != k :
        k =  l + s[i] 
        l =''
        ans += 1
    else:
        l += s[i]
print(ans)

Compiler output:
a.cc:4:5: error: empty character constant
    4 | l = ''
      |     ^~
a.cc:11:12: error: empty character constant
   11 |         l =''
      |            ^~
a.cc:1:1: error: 's' does not name a type
    1 | s = input()
      | ^
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);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
char s[110][110];
int dp[110][110];

int main() {
	string s;
	cin >> s;
	map<string, bool>mp;
	rep(i, n) {
		rep(j, n) {
			string s2 = s.substr(i, j + 1);
			if (mp[s2] == false) {
				mp[s2] = true;
				i += j;
				break;
			}
		}
	}
	int ans = 0;
	for (auto p : mp) {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

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

int main(){
	string s;
	cin >> s;
	string now = s.substr(0,1);
	int ans = 1;
	int n = s.size();
	REP(i,n-1){
		if(i == n-1){
			if(s.substr(i,1) == now){
				now = s.substr(i,2);
				i++;
			}else{
				now = s.substr(i,1);
				ans++;
			}
		}else{
			if(s.substr(i,1) == now){
				now = s.substr(i,2);
				ans++;
				i++;
			}else{
				now = s.substr(i,1);
				ans++;
			}
		}
	}
	cout << ans << endl;
    return 0;
}

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

int main(){
	string s;
	cin >> s;
	string now = s.substr(0,1);
	int ans = 1;
	int n = s.size();
	REP(i,n-1){
		if(i == n-1){
			if(s.substr(i,1) == now){
				now = s.substr(i,2);
				i++;
			}else{
				now = s.substr(i,1);
				ans++;
			}
		}else{
			if(s.substr(i,1) == now){
				now = s.substr(i,2);
				ans++;
				i++;
			}else{
				now = s.substr(i,1);
				ans++;
			}
		}
	}
	cout << ans << endl;
    return 0;
}



Compiler output:
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main(){
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main(){
      |     ^~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long int lld;
typedef pair<int, int> pii;

const int MAXN = 200002;

int n;
string s;

int memo[MAXN][4];
int dp(int i, int l) {
  if (i+1 >= n) return 0;
  if (!memo[i][l]) {
    memo[i][l] = INT_MIN;
    for (int r = 1; r <= 3; ++r) {
      if (i+r >= n) break;
      if (s.substr(i-l+1, l) == s.substr(i+1, r)) continue;
      memo[i][l] = max(memo[i][l], dp(i+r, r) + 1);
    }
  }
  return memo[i][l];
}

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  n = s.size();
  int ans = max(dp(0, 1), max(dp(1, 2), dp(2, 3))) + 1;
  cout << ans << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int dp(int, int)':
a.cc:30:18: error: 'INT_MIN' was not declared in this scope
   30 |     memo[i][l] = INT_MIN;
      |                  ^~~~~~~
a.cc:17:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <unordered_map>
  +++ |+#include <climits>
   17 | using namespace std;
Language: C++

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

using ll=long long;
const ll z=0;

int main() {
  string S;
  cin >> S;
  int k=S.size();
  vector<int> DP(K+1,0);
  DP[1]=1;
  if(S[0]==S[1])
    DP[2]=1;
  else
    DP[2]=2;
  for(int i=3;i<=K;i++){
    if(S[i]!=S[i-1]){
      DP[i]=DP[i-1]+1;
    }
    else
      DP[i]=DP[i-3]+2;
  }
  
  cout << DP[i] << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'K' was not declared in this scope
   11 |   vector<int> DP(K+1,0);
      |                  ^
a.cc:25:14: error: 'i' was not declared in this scope
   25 |   cout << DP[i] << endl;
      |              ^
Language: C++

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

using ll=long long;
const ll z=0;

int main() {
  string S;
  cin >> S;
  int k=S.size();
  int ans=k;
  char pre=S[0];
  bool n_skip=true;
  for(int i=1;i<k;i++){
    if(n_skip){
      if(S[i]==prev){
        ans--;
        n_skip=false;
      }
    }
    else{
      n_skip=true;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and '<unresolved overloaded function type>' to binary 'operator=='
   16 |       if(S[i]==prev){
Language: C++

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

using ll=long long;
const ll z=0;

int main() {
  string S;
  cin >> S;
  int k=S.size();
  int ans=k;
  pre=S[0];
  bool n_skip=true;
  for(int i=1;i<k;i++){
    if(n_skip){
      if(s[i]==prev){
        ans--;
        n_skip=false;
      }
    }
    else{
      n_skip=true;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'pre' was not declared in this scope; did you mean 'pread'?
   12 |   pre=S[0];
      |   ^~~
      |   pread
a.cc:16:10: error: 's' was not declared in this scope
   16 |       if(s[i]==prev){
      |          ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int a = 0;
  bool b = 0;
  string s, t = "AA";
  cin >> s;
  rep(i, s.size()){
    if(b){
      b = 0;
      t += s[i];
      ++a;
    }
    else if(t.size() == 2){
      t = to_string(s[i]);
      ++a;
    }
    else if(t != to_string(s[i])){
      t = to_string(s[i]);
      ++a;
    }
    else{
      t = to_string(s[i]);
      b = 1;
  }
  cout << a << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:30:12: note: to match this '{'
   30 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int a = 0;
  bool b = 0;
  string s, t == "AA";
  cin >> s;
  rep(i, s.size()){
    if(b){
      b = 0;
      t += s[i];
      ++a;
    }
    else if(t.size() == 2){
      t = to_string(s[i]);
      ++a;
    }
    else if(t != to_string(s[i])){
      t = to_string(s[i]);
      ++a;
    }
    else{
      t = to_string(s[i]);
      b = 1;
  }
  cout << a << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: expected initializer before '==' token
   33 |   string s, t == "AA";
      |               ^~
a.cc:38:7: error: 't' was not declared in this scope
   38 |       t += s[i];
      |       ^
a.cc:41:13: error: 't' was not declared in this scope
   41 |     else if(t.size() == 2){
      |             ^
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:30:12: note: to match this '{'
   30 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int a = 0;
  bool b = 0;
  string s, t == "AA";
  cin >> s;
  rep(i, s.size()){
    if(b){
      b = 0;
      t += v[i];
      ++a;
    }
    else if(t.size() == 2){
      t = to_string(v[i]);
      ++a;
    }
    else if(t != to_string(v[i])){
      t = to_string(v[i]);
      ++a;
    }
    else{
      t = to_string(v[i]);
      b = 1;
  }
  cout << a << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: expected initializer before '==' token
   33 |   string s, t == "AA";
      |               ^~
a.cc:38:7: error: 't' was not declared in this scope
   38 |       t += v[i];
      |       ^
a.cc:38:12: error: 'v' was not declared in this scope
   38 |       t += v[i];
      |            ^
a.cc:41:13: error: 't' was not declared in this scope
   41 |     else if(t.size() == 2){
      |             ^
a.cc:42:21: error: 'v' was not declared in this scope
   42 |       t = to_string(v[i]);
      |                     ^
a.cc:45:28: error: 'v' was not declared in this scope
   45 |     else if(t != to_string(v[i])){
      |                            ^
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:30:12: note: to match this '{'
   30 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
  
  int main(){
    string s;
    cin>>s;
    lint ans=0;
   bool is2=false;
    rep(i,s.size()){
        if(i==0){
            ans++;
        }else if(s[i]==s[i-1]&&!is2){
               
                ans++;
                i++;
                is2==true;
            }else {
               is2=false;
                ans++;
            }
        }
    }
    cout<<ans-1;
  }

  
     
  

Compiler output:
a.cc:88:5: error: 'cout' does not name a type
   88 |     cout<<ans-1;
      |     ^~~~
a.cc:89:3: error: expected declaration before '}' token
   89 |   }
      |   ^
Language: C++

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    string s;
    cin >> s;

    vector<int> ct;
    int cnt = 0;
    char c = '?';
    REP(i,s.size()) {
        if (c == '?') {
            cnt = 1;
            c = s[i];
            if (s.size() == 1) {
                ct.push_back(1);
            }
        }
        else if (c != s[i]) {
            ct.push_back(cnt);
            cnt = 1;
            c = s[i];
        } else {
            cnt++;
            if (i == s.size() - 1) {
                ct.push_back(cnt);
            }
        }
    }

    int ans = 0;
    REP(i,ct.size()) {
        int t = 1;
        while (true) {
            if ((t + 1) * t(t + 1) <= ct[i]) {
                t++;
            }
        }
        ans += t;
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:28: error: 't' cannot be used as a function
   59 |             if ((t + 1) * t(t + 1) <= ct[i]) {
      |                           ~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
int main() {
  string s;
  cin>>s;
  ll n=size();
  if(n==1)putout(1);
  else{
  vec dp(30000);
  dp[0]=1;
  if(s[0]==s[1])dp[1]=1;
  else dp[1]=2;  
    if(n==2)putout(dp[1]);
    else{
  loop(i,n-2){
    if(s[i]==s[i+2])dp[i+2]=dp[i]+1;
    else dp[i+2]=dp[i]+2;
  }
  
 
 
 
 putout(dp[n-1]);
 
 
 
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: no matching function for call to 'size()'
   31 |   ll n=size();
      |        ~~~~^~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e9
typedef long long ll;
typedef pair<ll,ll> P;
unsigned long long popCount64bitB(unsigned long long x) 
{ 
    x = ((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) 
      +  (x & 0x5555555555555555UL); 
    x = ((x & 0xccccccccccccccccUL) >> 2) 
      +  (x & 0x3333333333333333UL); 
    x = ((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) 
      +  (x & 0x0f0f0f0f0f0f0f0fUL); 
    x = ((x & 0xff00ff00ff00ff00UL) >> 8) 
      +  (x & 0x00ff00ff00ff00ffUL); 
    x = ((x & 0xffff0000ffff0000UL) >> 16) 
      +  (x & 0x0000ffff0000ffffUL); 
    x = ((x & 0xffffffff00000000UL) >> 32) 
      +  (x & 0x00000000ffffffffUL); 
    return x; 
} 

int main(void){
    int ans=0;
    string s;
    cin>>s;
    int i=0;
    if(s.length()==1)ans=1;
    else{
        string pre="";
        for(int i=0;i<s.length();i++){
            if(i+2==s.length()){
                if(s[i]==s[i+1]){
                    ans++;
                    i+=2;
                    continue;
                }
            }
            if(s.substr(i,2)==pre){
                pre=s.subsrt(i,2);
                i++;
            }
            else{
                pre=s.substr(i,1);
            }
            ans++;
        }
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:23: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'subsrt'; did you mean 'substr'?
   49 |                 pre=s.subsrt(i,2);
      |                       ^~~~~~
      |                       substr
Language: C++

# coding: utf-8

def Ser():
    S = input()
    for s in S:
        yield s

def main():
    S = []
    Si = ""
    for s in Ser():
        Si += s
        if len(S) == 0 or Si != S[-1]:
            S.append(Si)
            Si = ""
    print(len(S))

main()

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #coding
    1 | # coding: utf-8
      |   ^~~~~~
a.cc:3:1: error: 'def' does not name a type
    3 | def Ser():
      | ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define N 25
char s[N];
int d[N];

int main(int argc, const char * argv[]) {
    
    scanf("%s", s + 1);
    int len = (int)strlen(s + 1);
    int *dp = &d[1];
    dp[-1] = 0;
    dp[0] = 0;
    dp[1] = 1;
    int i;
    for (i = 2; i <= len; i++) {
        if (s[i] == s[i - 1]) {
            dp[i] = dp[i - 3] + 2;
        }
        else {
            dp[i] = dp[i - 1] + 1;
        }
    }
    printf("%d\n", dp[len - 1]);
    
    return 0;
}

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

やあ、僕はキャッシュ。僕と一緒に競プロをしよう！


Compiler output:
a.cc:1:1: error: extended character 、 is not valid in an identifier
    1 | やあ、僕はキャッシュ。僕と一緒に競プロをしよう！
      | ^
a.cc:1:1: error: extended character 。 is not valid in an identifier
a.cc:1:1: error: '\U00003084\U00003042\U00003001\U000050d5\U0000306f\U000030ad\U000030e3\U000030c3\U000030b7\U000030e5\U00003002\U000050d5\U00003068\U00004e00\U00007dd2\U0000306b\U00007af6\U000030d7\U000030ed\U00003092\U00003057\U00003088\U00003046\U0000ff01' does not name a type
    1 | やあ、僕はキャッシュ。僕と一緒に競プロをしよう！
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

package jp.hota.agc037;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;

public class A {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int n = S.length();

    int[] dp = new int[n + 1];
    Map<Integer, HashSet<String>> suffixes = new HashMap<>();
    HashSet<String> set = new HashSet<>();
    set.add("");
    suffixes.put(0, set);
    // Checking i
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j < 4 && i - j >= 0; j++) {
        // Cut at h = i - j.
        int h = i - j;
        String cut = S.substring(h, i);
        if (suffixes.get(h).stream().anyMatch(s -> !s.equals(cut))) {
          int score = dp[h] + 1;

          if (dp[i] > score) {
            continue;
          }

          HashSet<String> suffix = (score > dp[i]) ? new HashSet<>() : suffixes.get(i);
          suffix.add(cut);
          suffixes.put(i, suffix);
          dp[i] = score;
        }
      }
    }
    System.out.println(dp[n]);
  }
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  char s;
  int i,j;
  for (i=0;,S.size()>i;,++i;){
    if (s==S.at(i)){
      s='#';
      ++i;
    }
    else{
      s=S.at(i);
    }
    ++j;
  }
  cout << j;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: expected primary-expression before ',' token
    8 |   for (i=0;,S.size()>i;,++i;){
      |            ^
a.cc:8:24: error: expected primary-expression before ',' token
    8 |   for (i=0;,S.size()>i;,++i;){
      |                        ^
a.cc:8:28: error: expected ')' before ';' token
    8 |   for (i=0;,S.size()>i;,++i;){
      |       ~                    ^
      |                            )
a.cc:8:29: error: expected primary-expression before ')' token
    8 |   for (i=0;,S.size()>i;,++i;){
      |                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  char s;
  int i,j;
  for (i=0,S.size()>i,++i){
    if (s==S.at(i)){
      s='#';
      ++i;
    }
    else{
      s=S.at(i);
    }
    ++j;
  }
  cout << j;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: error: expected ';' before ')' token
    8 |   for (i=0,S.size()>i,++i){
      |                          ^
      |                          ;
a.cc:19:3: error: expected primary-expression before 'return'
   19 |   return 0;
      |   ^~~~~~
a.cc:18:13: error: expected ')' before 'return'
   18 |   cout << j;
      |             ^
      |             )
   19 |   return 0;
      |   ~~~~~~     
a.cc:8:7: note: to match this '('
    8 |   for (i=0,S.size()>i,++i){
      |       ^
Language: C++

s = str(input())
ans = 0
n = len(s)
A = [s[-1]]
count=0
i = n-1
while i>=0:
    if i == n-1:
        i-=1
    else:
        if A[count]==s[i]:
            A.append(s[i]+s[i-1])
            i -=2
            count+=1
        elif A[count]!=s[i] and i>1:
            A.append(s[i])
            count+=1
            i -= 1
        elif i==1 and s[i]==s[i-1]:
            A.append(s[i]+s[i-1])
            i-=2
        elif i==1 and s[i]!=s[i-1]:
            A.append(s[i])
            A.append(s[i-1])
            i-=2
print(len(A))

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

#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<functional>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
long long mod = 1000000007;
using namespace std;
int main(void)
{
	char s[100010];
	scanf("%s", s);
	int count = 0;
	int i = 0;
	while (true) {
		if (s[i] == s[i + 1]) {
			i++;
		}
		count++;
		if (s[i + 1] == '\0'||s[i]=='\0') {
			break;
		}
	}
	printf("%d", count);
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: expected '}' at end of input
   25 |         return 0;
      |                  ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second
#define MP make_pair
#define PB push_back

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;


int main()
{
  string s ;
  cin >> s ;
  int cnt = 0 ;
  
  int i = 0 ;
  while(i<n){
    if(s.at(i)!=s.st(i+1)){
      cnt++ ;
      i++ ;
    }
    else{
      cnt++ ;
      i += 2 ;
    }
  }
  
  cout << cnt <<endl ;

  return 0 ;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:30:11: error: 'n' was not declared in this scope
   30 |   while(i<n){
      |           ^
a.cc:31:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'st'; did you mean 'at'?
   31 |     if(s.at(i)!=s.st(i+1)){
      |                   ^~
      |                   at
Language: C++

#include <boost/regex.hpp>
#include <iostream>
#include <string>

int main()
{
    std::string line;
    boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );

    while (std::cin)
    {
        std::getline(std::cin, line);
      std::cout<<line<<std::endl;
        boost::smatch matches;
        if (boost::regex_match(line, matches, pat))
            std::cout << matches[2] << std::endl;
    }
}

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

#include <bits/stdc++.h>
#include <boost/multiprecision/gmp.hpp>

using namespace std;

int main() {
  using namespace boost::multiprecision;
  mpz_int a = 1;
  for (int i = 1; i <= 1000; i++) a *= i;
  cout << a << endl;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/gmp.hpp: No such file or directory
    2 | #include <boost/multiprecision/gmp.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   19 |   cout<<(s.length-ans);
      |          ~~^~~~~~
      |                  ()
Language: C++

/*
	author : SAMRAT DE
	username : Alucard_01
	NIT Durgapur
*/

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>*/
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define pi(x,y) pair<x,y>
#define mpp(x,y) map<x,y>
#define pqq(x) priority_queue<x> 
#define min_heap(x) priority_queue<x, vector<x>, greater<x> >
#define all(x) x.begin(),x.end()
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define pf push_front
#define indexof order_of_key
#define valueat find_by_order
#define myds tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dxx[8]={0,0,1,-1,-1,-1,1,1};
int dyy[8]={1,-1,0,0,-1,1,1,-1};

using namespace std;
//using namespace __gnu_pbds;

int32_t main()
{
	fastio;
	//best of luck don't loose hope man	
		
	string s;cin>>s;
	int dp[s.size()];
	mem(dp,1);
	if(s[0]==s[1])
		dp[1]=1;
	else
		dp[1]=2;
	if(s[2]==s[1])
		dp[2]=2;
	else
		dp[2]=dp[1]+1;
	rep(i,3,n){
		if(s[i]==s[i-1])
			dp[i]=d[i-3]+2;
		else
			dp[i]=dp[i-1]+1;
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:55:17: error: 'n' was not declared in this scope
   55 |         rep(i,3,n){
      |                 ^
a.cc:19:33: note: in definition of macro 'rep'
   19 | #define rep(i,x,y) for(ll i=x;i<y;i++)
      |                                 ^
a.cc:57:31: error: 'd' was not declared in this scope
   57 |                         dp[i]=d[i-3]+2;
      |                               ^
a.cc:61:18: error: 'n' was not declared in this scope
   61 |         cout<<dp[n-1]<<endl;
      |                  ^
Language: C++

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;

const int maxN = 2e5+5;
char ins[maxN];
int dp[maxN][2];
int len;

int getMaxSizeAt(int x, int y){
    if((x < 0 && x >= maxN)
    || (y < 0 && y >= 2)) {
        return 0;
    }
    return dp[x][y];
}

int main(){
#ifdef LS_DEBUG
    freopen("in", "r", stdin);
#endif
    gets(ins);
    len = strlen(ins);

    for(int idx = 0; idx < len; ++idx){
        dp[idx][0] = getMaxSizeAt(idx-1, 1)+1;
        if(idx >= 1 && ins[idx] != ins[idx-1]){
            dp[idx][0] = max(getMaxSizeAt(idx,0), getMaxSizeAt(idx-1,0)+1);
        }
        if(idx<1){
            dp[idx][1] = 0;
        }
        else{
            dp[idx][1] = getMaxSizeAt(idx-2,0)+1;
            if(idx>=3 && (ins[idx] != ins[idx-2]
            || ins[idx-1] != ins[idx-3])){
                dp[idx][1] = max(getMaxSizeAt(idx,1), getMaxSizeAt(idx-2,1)+1);
            }
        }
    }

#ifdef LS_DEBUG
    for(int idx = 0; idx < len; ++idx){
        printf("%d %d\n", dp[idx][0], dp[idx][1]);
    }
#endif

    printf("%d\n", max(dp[len-1][0], dp[len-1][1]));
    return 0;
}

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

#include <cstdio>
#include <iostream>
#define LS_DEBUG
using namespace std;

const int maxN = 2e5+5;
char ins[maxN];
int dp[maxN][2];
int len;

int getMaxSizeAt(int x, int y){
    if((x < 0 && x >= maxN)
    || (y < 0 && y >= 2)) {
        return 0;
    }
    return dp[x][y];
}

int main(){
#ifdef LS_DEBUG
    freopen("in", "r", stdin);
#endif
    gets(ins);
    len = strlen(ins);

    for(int idx = 0; idx < len; ++idx){
        dp[idx][0] = getMaxSizeAt(idx-1, 1)+1;
        if(idx >= 1 && ins[idx] != ins[idx-1]){
            dp[idx][0] = max(getMaxSizeAt(idx,0), getMaxSizeAt(idx-1,0)+1);
        }
        if(idx<1){
            dp[idx][1] = 0;
        }
        else{
            dp[idx][1] = getMaxSizeAt(idx-2,0)+1;
            if(idx>=3 && (ins[idx] != ins[idx-2]
            || ins[idx-1] != ins[idx-3])){
                dp[idx][1] = max(getMaxSizeAt(idx,1), getMaxSizeAt(idx-2,1)+1);
            }
        }
    }

#ifdef LS_DEBUG
    for(int idx = 0; idx < len; ++idx){
        printf("%d %d\n", dp[idx][0], dp[idx][1]);
    }
#endif

    printf("%d\n", max(dp[len-1][0], dp[len-1][1]));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   23 |     gets(ins);
      |     ^~~~
      |     getw
a.cc:24:11: error: 'strlen' was not declared in this scope
   24 |     len = strlen(ins);
      |           ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 | #define LS_DEBUG
Language: C

#include <iostream>
using namespace std;
inline void chmax(int &a, int b) {if(a < b) a = b;}

string s;
int dp[200020][2]; // dp[i][0] ひとつ前を切ってる。　dp[i][1]　ひとつ前を切ってない。

int main() {
    cin >> s;
    int n = (int)s.size();

    for(int i = 0; i < n; ++i) {
        if(s[i] == s[i+1]) { // 同じだったら

            chmax(dp[i+1][1], dp[i][0]); // 切ってたら切れない
            chmax(dp[i+1][0], dp[i][1] + 1); // ひとつ前を切ってなかったら切れる
            chmax(dp[i+1][1], dp[i][1]); // 切らなくてもよいけどたぶん最適にはならない
        } else { // 違ったら切っても切らなくてもよい
            chmax(dp[i+1][0], dp[i][0] + 1); // 切る
            chmax(dp[i+1][1], dp[i][0]); // 切らない
            chmax(dp[i+1][0], dp[i][1] + 1);
            chmax(dp[i+1][1], dp[i][1]);
        }
    }
    cout << max(dp[n][0], dp[n][1]) << endl;
}

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: expected unqualified-id before '[' token
    9 |     if(s.[i]!=s[i+1]){
      |          ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
using namespace std;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
const int N=1e7+11;
string las,now;
char s[N];
int ans;
int main(){
	gets(s+1);
	for(int i=1;s[i];++i){
		now+=s[i];
		if(now!=las)
			las=now,++ans,now="";
	}
	printf("%d\n",ans);
	return 0;
}

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

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
const int N=1e7+11;
string las,now;
char s[N];
int ans;
int main(){
	gets(s+1);
	for(int i=1;s[i];++i){
		now+=s[i];
		if(now!=las)
			las=now,++ans,now="";
	}
	printf("%d\n",ans);
	return 0;
}

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

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
const int N=1e7+11;
string las,now;
char s[N];
int ans;
int main(){
	gets(s+1);
	for(int i=1;s[i];++i){
		now+=s[i];
		if(now!=las)
			las=now,++ans,now="";
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:8:1: error: 'string' does not name a type; did you mean 'stdin'?
    8 | string las,now;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:12:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   12 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:14:17: error: 'now' was not declared in this scope
   14 |                 now+=s[i];
      |                 ^~~
a.cc:15:25: error: 'las' was not declared in this scope; did you mean 'labs'?
   15 |                 if(now!=las)
      |                         ^~~
      |                         labs