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

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#define o 1000005
#define re register int
#define ll long long
#define g0(a) memset(a,0,sizeof(a))
#define gc(a,b) memcpy(a,b,sizeof(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define pa pair<int,int>
#define mpp make_pair
#define s1 first
#define s2 second
#define go(x) for(ll i=h[x];i;i=w[i].next)
using namespace std;
inline int read()
{
	register int data=0,w=1;
	char ch=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(ch>='0'&&ch<='9')data=(data<<1)+(data<<3)+(ch^48),ch=getchar();
	return data*w;
}
int n,a[o],Q,f[3005][3005];
const int mod=1e9+7,iv=(mod+1)>>1;
void fix(int x){
	x-=mod;x+=x>>31&mod;
}
int main()
{
	n=read();Q=read();
	FOR(i,1,n)a[i]=read();
	FOR(i,1,n)FOR(j,1,n)if(a[i]>a[j])f[i][j]=1;
	int s=1;
	while(Q--)
	{
		fix(s+=s);
		int x=read(),y=read();
		FOR(i,1,n)
		{
			if(i==x||i==y)continue;
			int ix=f[i][x],iy=f[i][y];
			f[x][i]=f[y][i]=1ll*(f[x][i]+f[y][i])*iv%mod;
			f[i][x]=f[i][y]=1ll*(f[i][x]+f[i][y])*iv%mod;
		}
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])*inv2%p;
	}
	int ans=0;
	FOR(i,1,n)FOR(j,i+1,n)ans=(ans+f[i][j])%mod;
	cout<<1ll*ans*s%mod<<'\n'; 
	return 0;
}

Compiler output:
a.cc: In function 'int read()':
a.cc:24:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |         register int data=0,w=1;
      |                      ^~~~
a.cc:24:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |         register int data=0,w=1;
      |                             ^
a.cc: In function 'int main()':
a.cc:53:51: error: 'inv2' was not declared in this scope; did you mean 'iv'?
   53 |                 f[x][y]=f[y][x]=(f[x][y]+f[y][x])*inv2%p;
      |                                                   ^~~~
      |                                                   iv
a.cc:53:56: error: 'p' was not declared in this scope
   53 |                 f[x][y]=f[y][x]=(f[x][y]+f[y][x])*inv2%p;
      |                                                        ^
Language: C++

#include <algorithm>
#include <cstdio>
using ll = long long;
constexpr int MOD = 1e9 + 7;
int nxt[3005][3005], arr[3005], lst[3005];
int dp[3005][2][2][3005], qx[3005], qy[3005], pw[3005];
int calc(int p, int x, int y)
{
	if (p == -1)
		return arr[x] > arr[y];
	int t = std::max(nxt[p][x], nxt[p][y]), coef = pw[p - t];
	p = t;
	if (p == -1)
		return (arr[x] > arr[y]) * coef;
	bool a = qx[p] == x || qy[p] == x, b = qx[p] == y || qy[p] == y;
	int &res = dp[p][a][a ? (x == qx[p]) : (y == qx[p])][b ? x : y];
	if (~res)
		return res;
	res = calc(p - 1, x, y);
	if (a && b)
		res += calc(p - 1, y, x);
	else if (a)
		res += calc(p - 1, qx[p] ^ qy[p] ^ x, y);
	else if (b)
		res += calc(p - 1, x, qx[p] ^ qy[p] ^ y);
	else
		throw "GG";
	return res = (ll)res * coef % MOD;
}
int main()
{
	// freopen("AGC030-D.in", "r", stdin);
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i);
	memset(lst, -1, sizeof(lst));
	for (int i = 0; i < m; i++)
	{
		scanf("%d%d", qx + i, qy + i);
		qx[i]--;
		qy[i]--;
		lst[qx[i]] = lst[qy[i]] = i;
		memcpy(nxt[i], lst, sizeof(lst));
	}
	pw[0] = 1;
	for (int i = 1; i <= m; i++)
		pw[i] = pw[i - 1] * 2 % MOD;
	memset(dp, -1, sizeof(dp));
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
			(ans += calc(m - 1, i, j)) %= MOD;
	}
	printf("%d\n", ans);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
   37 |         memset(lst, -1, sizeof(lst));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | using ll = long long;
a.cc:44:17: error: 'memcpy' was not declared in this scope
   44 |                 memcpy(nxt[i], lst, sizeof(lst));
      |                 ^~~~~~
a.cc:44:17: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <cstdio>
#include <algorithm>
using namespace std;
const int mod=1000000007;
const int inv2=mod+1>>1;
const int Maxn=3005;
int n,q,a[Maxn];
int p[Maxn][Maxn],t;
int main()
{
	scanf("%d%d",&n,&q);
	for (int i=1;i<=n;++i) scanf("%d",a+i);
	for (int i=1;i<=n;++i) for (int j=1;j<=n;++j) p[i][j]=a[i]>a[j];
	for (int q_=0;q_<q;++q_)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		p[x][y]=p[y][x]=1LL*(p[x][y]+p[y][x])*inv2%mod;
		for (int i=1;i<=n;++i) if(i!=x && i!=y)
			p[i][x]=p[i][y]=1LL*(p[i][x]+p[i][y])*inv2%mod,
			p[x][i]=p[y][i]=1LL*(p[x][i]+p[y][i])*inv2%mod;
	}
	for (int i=1;i<=n;++i) for (int j=n;j>i;--j) ans=(ans+p[i][j])%mod;
	for (int i=0;i<q;++i) ans=(ans<<1)%mod;
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:54: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |         for (int i=1;i<=n;++i) for (int j=n;j>i;--j) ans=(ans+p[i][j])%mod;
      |                                                      ^~~
      |                                                      abs
a.cc:24:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         for (int i=0;i<q;++i) ans=(ans<<1)%mod;
      |                               ^~~
      |                               abs
a.cc:25:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |         printf("%d\n",ans);
      |                       ^~~
      |                       abs
Language: C++

#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define fi first
#define se second
using namespace std;
template<class T> rd(T &x) {
	x=0; int f=1,ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=getchar();}
	x*=f;
}
template<class T> inline bool Cmin(T &x,T y) {return x>y?x=y,1:0;}
const int inf=1e9;
const int maxn=5000+5;
int n; char s[maxn],t[maxn];
vector< pair<int,int> > S,T;
int sol(int a,int b) {
	int an=0;
	while(S[a].fi!=n||T[b].fi!=n) an+=abs(S[a++].fi-T[b++].fi);
	return an;
}
void init(char *s,vector< pair<int,int> > &S) {
	for(int i=0;i<n;++i) S.push_back(make_pair(0,i&1));
	if((n&1)==(s[1]=='1')) S.push_back(make_pair(0,n&1));
	for(int i=1;i<n;++i) if(s[i]!=s[i+1]) {
		int c=S.back().se^1; 
		S.push_back(make_pair(i,c));
	}
	for(int i=0;i<2*n;++i) {
		int c=S.back().se^1;
		S.push_back(make_pair(n,c));
	}
}
int main() {
	rd(n);
	scanf("%s",s+1);
	scanf("%s",t+1);
	init(s,S),init(t,T);
	int an=inf;
	for(int i=0;i<=n;++i) if(S[i].se==T[n].se) Cmin(an,sol(i,n));
	for(int i=0;i<=n;++i) if(S[n].se==T[i].se) Cmin(an,sol(n,i));
	printf("%d\n",an);
	return 0;
}

Compiler output:
a.cc:9:19: error: ISO C++ forbids declaration of 'rd' with no type [-fpermissive]
    9 | template<class T> rd(T &x) {
      |                   ^~
a.cc: In function 'int rd(T&)':
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
Language: C++

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

int n;
string s, t;

vector<pair<int, int>> get_lines(string s) {
  vector<pair<int, int>> ans;
  ans.push_back(s[0] == '0' ? make_pair(0, 0) : make_pair(1, 0));
  for (int i = 1; i < n; ++i)
    if (s[i] != s[i - 1])
      ans.push_back({ans.back().first ^ 1, i});
  ans.push_back({ans.back().first ^ 1, n});
  return ans;
}

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> s >> t;
  vector<pair<int, int>> a = get_lines(s);
  vector<pair<int, int>> b = get_lines(t);
  int ans = 2e9;
  for (int i = 0; i < int(b.size()); ++i) {
    if (b[i].first == a[0].first) {
      int x = 0, y = i;
      int cur = 0;
      while (y >= 0) {
        int u = 0, v = b[y].second;
        cur += v - u;
        --y;
      }
      x = 1, y = i + 1;
      while (y < int(b.size())) {
        int u = (x < int(a.size()) ? a[x].second : n);
        int v = b[y].second;
        cur += abs(v - u);
        ++x;
        ++y;
      }
      ans = min(ans, cur);
    }
  }
  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
a.cc:25:23: note: in expansion of macro 'int'
   25 |   for (int i = 0; i < int(b.size()); ++i) {
      |                       ^~~
a.cc:25:22: error: expected ';' before 'long'
   25 |   for (int i = 0; i < int(b.size()); ++i) {
      |                      ^
      |                      ;
a.cc:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
a.cc:25:23: note: in expansion of macro 'int'
   25 |   for (int i = 0; i < int(b.size()); ++i) {
      |                       ^~~
a.cc:25:22: error: expected ')' before 'long'
   25 |   for (int i = 0; i < int(b.size()); ++i) {
      |       ~              ^
      |                      )
a.cc:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
a.cc:25:23: note: in expansion of macro 'int'
   25 |   for (int i = 0; i < int(b.size()); ++i) {
      |                       ^~~
a.cc:25:40: error: 'i' was not declared in this scope
   25 |   for (int i = 0; i < int(b.size()); ++i) {
      |                                        ^
Language: C++

#include<bits/stdc++.h>
#define il inline
#define vd void
typedef long long ll;
il ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
char s[5010],t[5010];
int A[5010],B[5010],a,b;
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();scanf("%s",s+1);scanf("%s",t+1);
	int ans=INT_MAX;
	if(s[1]=='1')A[++a]=0;if(t[1]=='1')B[++b]=0;
	for(int i=1;i<n;++i)if(s[i]!=s[i+1])A[++a]=i;
	for(int i=1;i<n;++i)if(t[i]!=t[i+1])B[++b]=i;
	if(s[n]=='1')A[++a]=n;if(t[n]=='1')B[++b]=n;
	if(!a||!b){
		if(!a)std::swap(a,b),std:swap(A,B);
		ans=0;
		for(int i=1;i<=b;++i)ans+=std::min(A[i],n-A[i]);
		return printf("%d\n",ans),0;
	}
	for(int i=1;i<=b;i+=2){
		int res=0;
		for(int j=1;j<i;++j)res+=B[j];
		for(int j=i;j<i+a&&j<=b;++j)res+=abs(A[j-i+1]-B[j]);
		for(int j=i+a;j<=b;++j)res+=n-B[j];
		for(int j=b+1;j<=a;++j)res+=n-A[j];
		ans=std::min(res,ans);
	}
	for(int i=1;i<=a;i+=2){
		int res=0;
		for(int j=1;j<i;++j)res+=A[j];
		for(int j=i;j<i+b&&j<=a;++j)res+=abs(B[j-i+1]-A[j]);
		for(int j=i+b;j<=a;++j)res+=n-A[j];
		for(int j=a+1;j<=b;++j)res+=n-B[j];
		ans=std::min(res,ans);
	}
	return printf("%d\n",ans),0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: found ':' in nested-name-specifier, expected '::'
   26 |                 if(!a)std::swap(a,b),std:swap(A,B);
      |                                         ^
      |                                         ::
Language: C++

#include<cstdio>
#define RI register int
#define CI const int&
using namespace std;
const int N=605,mod=1e9+7;
int n,m,a[N<<1],f[N<<1][N][N],cur,q[N<<1],tp; bool ext[N<<1],vis[N<<1];
inline void inc(int& x,CI y)
{
	if ((x+=y)>=mod) x-=mod;
}
int main()
{
	RI i,j,k; for (scanf("%d",&n),i=1;i<=2*n;++i)
	scanf("%d",&a[i]),ext[~a[i]?a[i]:0]=1;
	for (i=1;i<=n;++i) if (!~a[2*i-1]&&!~a[2*i]) ++cur;
	else if (~a[2*i-1]&&~a[2*i]) vis[a[2*i-1]]=vis[a[2*i]]=1;
	for (i=1;i<=2*n;++i) if (!vis[i]) q[++m]=ext[i];
	for (n=m,f[n][0][0]=1,i=n;i;--i) for (j=0;j<=n;++j)
	for (k=0;k<=n;++k) if (tp=f[i][j][k])
	{
		if (q[i]) inc(f[i-1][j+1][k],tp),k&&(inc(f[i-1][j][k-1],tp),0);
		else inc(f[i-1][j][k+1],tp),k&&(inc(f[i-1][j][k-1],tp),0),j&&(inc(f[i-1][j-1][k],1LL*tp*j%mod),0);
	}
	int ans=f[0][0][0]; for (i=1;i<=cur;++i) ans=1LL*ans*i%mod;
	return printf("%d",ans),0;


Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         RI i,j,k; for (scanf("%d",&n),i=1;i<=2*n;++i)
      |            ^
a.cc:13:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         RI i,j,k; for (scanf("%d",&n),i=1;i<=2*n;++i)
      |              ^
a.cc:13:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         RI i,j,k; for (scanf("%d",&n),i=1;i<=2*n;++i)
      |                ^
a.cc:25:35: error: expected '}' at end of input
   25 |         return printf("%d",ans),0;
      |                                   ^
a.cc:12:1: note: to match this '{'
   12 | {
      | ^
Language: C++

const int N=605,M=1e9+7;
int flag[N],x,y,n,dp[2][N][N],cnt;
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<=n;i++){
		scanf("%lld%lld",&x,&y);
		if (x==-1&&y==-1)cnt++;
		else if (x!=-1&&y!=-1)flag[x]=flag[y]=2;
		else if (x==-1&&y!=-1)flag[y]=1;
		else flag[x]=1;
	}
	dp[1][0][0]=1;
	for (int i=2*n;i;i--){
		int t=i&1;
		for (int j=0;j<=2*n;j++)
			for (int k=0;k<=2*n;k++)
				if (flag[i]==2)dp[t][j][k]=dp[t^1][j][k];
				else if (flag[i]==1)dp[t][j][k]=(dp[t^1][j][k+1]+(!j?0:dp[t^1][j-1][k]))%M;
				else dp[t][j][k]=(dp[t^1][j+1][k]*(j+1)+(!k?0:dp[t^1][j][k-1])+dp[t^1][j][k+1])%M;
		memset(dp[t^1],0,sizeof dp[t^1]);
	}
	int ans=dp[1][0][0];
	for (int i=1;i<=cnt;i++)(ans*=i)%=M;
	printf("%lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'scanf' was not declared in this scope
    4 |         scanf("%lld",&n);
      |         ^~~~~
a.cc:20:17: error: 'memset' was not declared in this scope
   20 |                 memset(dp[t^1],0,sizeof dp[t^1]);
      |                 ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | const int N=605,M=1e9+7;
a.cc:24:9: error: 'printf' was not declared in this scope
   24 |         printf("%lld\n",ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | const int N=605,M=1e9+7;
Language: C++

#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
typedef pair<lint,pint> tint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
ostream &operator<<(ostream &os, const vector<int> &a) {
	os<<"[";
	rep(i,a.size()){
		os<<a[i];
		if(i<a.size()-1) os<<",";
	}
	os<<"]";
	return os; 
}
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint dp[610][310][310][2];
lint co[610][610];
int sum[610];
bool sumi[610];
lint mo=1000000007;
int main()
{
	rep(i,605){
		co[i][0]=co[i][i]=1;
		REP(j,1,i) co[i][j]=(co[i-1][j]+co[i-1][j-1])%mo;
	}
	int n,a,b;
	vector<int> v;
	cin>>n;
	rep(i,n){
		cin>>a>>b;
		a--;b--;
		if(a>=0 && b>=0) sum[a]++,sum[b]++;
		else if(a>=0) v.pb(a);
		else if(b>=0) v.pb(b);
	}
	rep(i,605) sum[i+1]+=sum[i];
	rep(i,v.size()) v[i]-=sum[v[i]];
	int m=v.size(),x=0;
	rep(i,m) sumi[v[i]]=true;
	n-=sum[603]/2;
	if(n==0){
		cout<<1<<endl;return 0;
	}
	if(m==0){
		lint t=co[2*n][n]-co[2*n][n-1];
		rep(i,n){
			t*=i+1;t%=mo;
		}
		cout<<t<<endl;return 0;
	}
	memset(dp,0,sizeof(dp));dp[0][0][n-m][0]=1;
	lint out=0;
	//cout<<n<<' '<<m<<' '<<v<<endl;
	rep(i,2*n){
		if(sumi[i]){
			x++;
			if(m==x){
				rep(k,n-m+1) rep(l,2){
					lint t=dp[i][0][k][l];
					if(k>0) t*=(co[2*n-1-i][k]-co[2*n-1-i][k-1]);
					t%=mo;
					rep(j,k){
						t*=j+1;t%=mo;
					}
					out+=t;out%=mo;
				}
				break;
			}
			else{
				rep(j,n+1) rep(k,n-m+1) rep(l,2){
					//if(dp[i][j][k][l]>0) cout<<i<<j<<k<<l;
					dp[i+1][j][k][0]+=dp[i][j][k][l];
					dp[i+1][j][k][0]%=mo;
					if(j>0){
						dp[i+1][j-1][k][1]+=dp[i][j][k][l]*j;
						dp[i+1][j-1][k][1]%=mo;
					}
				}
			}
			continue;
		}
		rep(j,n+1) rep(k,n-m+1){
			if(dp[i][j][k][0]+dp[i][j][k][l]<1) continue;
			//cout<<i<<' '<<j<<' '<<k<<' '<<dp[i][j][k][0]<<' '<<dp[i][j][k][1]<<endl;
			//今のところで使う
			dp[i+1][j][k][1]+=dp[i][j][k][0];
			dp[i+1][j][k][1]%=mo;
			//まだ持っておく
			rep(l,2){
				dp[i+1][j+1][k][l]+=dp[i][j][k][l];
				dp[i+1][j+1][k][l]%=mo;
			}
			//どこかに飛ばす
			if(k>0){
				rep(l,2){
					dp[i+1][j][k-1][l]+=dp[i][j][k][l]*k;
					dp[i+1][j][k-1][l]%=mo;
				}
			}
			//前の隙間を埋める
			rep(l,2){
				if(x+n-m-k-(i-x-l-j-(n-m-k))>0){
					dp[i+1][j][k][l]+=dp[i][j][k][l];
					dp[i+1][j][k][l]%=mo;
				}
			}
		}
	}
	cout<<out<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:115:55: error: 'l' was not declared in this scope
  115 |                         if(dp[i][j][k][0]+dp[i][j][k][l]<1) continue;
      |                                                       ^
Language: C++

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

int main ()
{
	int n;
	cin>>n;
	int a[1000];
	for(int i=0;i<2n;i++)
	{
		cin>>a[i];
		
	}
	int count=0,x=0;
	for(int i=0;i<2n;i++)
	{
		if(a[i]==-1)
		{
			break;
			x=i;
		}
	}
	for(int i=x;i<2n;i++)
	{
		if(a[i]==-1)
		{
			if((i-x)>count)
				count=i-x;
			x=i;	
		}
	}
	cout<<count<<endl;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: unable to find numeric literal operator 'operator""n'
    9 |         for(int i=0;i<2n;i++)
      |                       ^~
a.cc:15:23: error: unable to find numeric literal operator 'operator""n'
   15 |         for(int i=0;i<2n;i++)
      |                       ^~
a.cc:23:23: error: unable to find numeric literal operator 'operator""n'
   23 |         for(int i=x;i<2n;i++)
      |                       ^~
Language: C++

#include <bits/stdc++.h>
const long long MOD = 1e9+7;
using namespace std;
#define ll long long
#define ar array

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

	string N;
	cin >> N;
	int ans = 0;

	for (int i = 0; i < N.size(); i++) {
		if (N.at()=='2') ans++;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: no matching function for call to 'std::__cxx11::basic_string<char>::at()'
   16 |                 if (N.at()=='2') ans++;
      |                     ~~~~^~
In file included from /usr/include/c++/14/string:54,
                 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/basic_string.h:1287:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
 1287 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/basic_string.h:1287:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
 1309 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/basic_string.h:1309:7: note:   candidate expects 1 argument, 0 provided
Language: C++

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





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

    int n;
    cin>>n;
    while (n) {
	res += (n%10 == 2);
	n/=10;
    }
    out(res);
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'res' was not declared in this scope
   27 |         res += (n%10 == 2);
      |         ^~~
a.cc:30:9: error: 'res' was not declared in this scope
   30 |     out(res);
      |         ^~~
Language: C++

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

int main(){
    string s; cin >> s;
    int ans = 0;
    rep(i,s.size()){
        if(s[i]=='2') ans++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before '{' token
    9 |     rep(i,s.size()){
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  string A;
  cin >> A;
  int X;
  for(int i = 0; i < 4; i++) { 
    if(A.at(i) == '2') {
      X++;
    }
  }
  cour << X << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'cour' was not declared in this scope
   12 |   cour << X << endl;
      |   ^~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  string S;
  int count=0;
  for(int i=0;i<4;i++){
    if(S[i]==2)coutn++;
  }
  cout<<count;
return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:16: error: 'coutn' was not declared in this scope; did you mean 'count'?
   52 |     if(S[i]==2)coutn++;
      |                ^~~~~
      |                count
Language: C++

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

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

	int c = 0;
	for (int i = 0; i < 4; i++) if (s[i] == '2') c++ 

	cout << c << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:57: error: expected ';' before 'cout'
    9 |         for (int i = 0; i < 4; i++) if (s[i] == '2') c++
      |                                                         ^
      |                                                         ;
   10 | 
   11 |         cout << c << endl;
      |         ~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	while(n != 0){
		if(n % 10 = 2) ans++;
		n /= 10;
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: lvalue required as left operand of assignment
   21 |                 if(n % 10 = 2) ans++;
      |                    ~~^~~~
Language: C++

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

int main() {
  string N;
  cin >> N;
  int ans;

  for(int i=0; i < 4; i++) {
    if(N[i] == '2') ++ans;
  }
  cout << ans << endl;4244
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:27: error: expected ';' before '}' token
   12 |   cout << ans << endl;4244
      |                           ^
      |                           ;
   13 | }
      | ~
Language: C++

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

int main() {
  string n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < 4; ++i) if (s[i] == '2') ++cnt;
  cout << cnt << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:35: error: 's' was not declared in this scope
    9 |   for (int i = 0; i < 4; ++i) if (s[i] == '2') ++cnt;
      |                                   ^
Language: C++

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

int main() {
    string n;
    cin >> n;
    int count = 0;
    for(int i = 0; i < 4; i++){
        if(s[i] == '2'){
            count++;
        }
    }
    cout << count;
}

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

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

int main() {
  stirng n;
  cin >> n;
  int ans = 0;
  for(int i = 0; i < 4; i++){
    if(n[i] == '2') ans++;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'stirng' was not declared in this scope
    5 |   stirng n;
      |   ^~~~~~
a.cc:6:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin >> n;
      |          ^
      |          yn
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: 's' was not declared in this scope
    7 |     for(int i=1;i<=s.size();i++)
      |                    ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int a[10000];
    int sum;
    for(int i=1;i<=10001;i++)
    {
        if(a[i]=="2")
        {
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |         if(a[i]=="2")
      |            ~~~~^~~~~
Language: C++

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

cout<<ans<<endl;
return 0;

 
}

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

#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,s=;
	cin>>a;
	while(a) {
		if(a%10==2) {
            ++s;
        }
		a/=10;
	}
	cout<<s<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:17: error: expected primary-expression before ';' token
    4 |         int a,s=;
      |                 ^
Language: C++

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

int main()
{
  string s;
  int a=4,su=0;
  cin>>s;
  while(a--)
    if(s[i]=='2')
      su++;
  cout<<su<<endl;
  return 0;
}


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

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

int main()
{
  string s;
  int a=4,s=0;
  cin>>s;
  while(a--)
    if(s[i]=='2')
      s++;
  cout<<s<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: conflicting declaration 'int s'
    7 |   int a=4,s=0;
      |           ^
a.cc:6:10: note: previous declaration as 'std::string s'
    6 |   string s;
      |          ^
a.cc:10:10: error: 'i' was not declared in this scope
   10 |     if(s[i]=='2')
      |          ^
a.cc:11:8: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   11 |       s++;
      |       ~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  int c = 0;
  for(int i = 0;i<a.size();i++){
    if(a.at(i) == '2')
      c++
  }
  cout << c << endl;
}


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

#include<bits/stdc++.h>
using namespace std;
int ans;
char a[4];
int main()
{
cin>>a;
if(a[1]==2||a[0]==2||a[2]==2||a[3]==2)ans++;
if(ans!=0)
cout<<ans<<endl;
}
 
}

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

#include<bits/stdc++.h>
using namespace std;
int ans,a;

int main()
{
  cin>>a
  int w=a%10/100,x=a%100/10,y=a%1000/100,z=a%100%10;
  if(w==2||x==2||y==2||z==2)ans++;
  if(ans!=0)cout<<ans<<endl;
  return 0;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected ';' before 'int'
    7 |   cin>>a
      |         ^
      |         ;
    8 |   int w=a%10/100,x=a%100/10,y=a%1000/100,z=a%100%10;
      |   ~~~    
a.cc:9:6: error: 'w' was not declared in this scope
    9 |   if(w==2||x==2||y==2||z==2)ans++;
      |      ^
a.cc:9:12: error: 'x' was not declared in this scope
    9 |   if(w==2||x==2||y==2||z==2)ans++;
      |            ^
a.cc:9:18: error: 'y' was not declared in this scope; did you mean 'yn'?
    9 |   if(w==2||x==2||y==2||z==2)ans++;
      |                  ^
      |                  yn
a.cc:9:24: error: 'z' was not declared in this scope
    9 |   if(w==2||x==2||y==2||z==2)ans++;
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int ans=0;
  cin >> n;
  for(int i=0;i<4;i++){
    if(n.at(i)=='2'){
      ans++;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: request for member 'at' in 'n', which is of non-class type 'int'
    8 |     if(n.at(i)=='2'){
      |          ^~
Language: C++

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string n;
  cin >> n;
  
  int ans = 0;
  for(int i = 0; i < 4; i++) if(s.at(i) == '2') ans++;
  
  cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: 's' was not declared in this scope
   12 |   for(int i = 0; i < 4; i++) if(s.at(i) == '2') ans++;
      |                                 ^
Language: C++

#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  string S; cin>>S;
  int cnt=0;
  rep(0,4) cnt+=(2==ctoi(S[i]));
  cout<<cnt;
}




// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


Compiler output:
a.cc:54:10: error: macro "rep" requires 3 arguments, but only 2 given
   54 |   rep(0,4) cnt+=(2==ctoi(S[i]));
      |          ^
a.cc:11:9: note: macro "rep" defined here
   11 | #define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:54:3: error: 'rep' was not declared in this scope
   54 |   rep(0,4) cnt+=(2==ctoi(S[i]));
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  cout<<s.count('2');
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'count'
    6 |   cout<<s.count('2');
      |           ^~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < 4; i++){
    if (S[i] == 2) {
      cnt++;
    }
  cout << cnt << endl;
  }
  


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

#include<iostream>
using namespace std;

int main(){
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < 4; i++){
    if (S[i] == 2) {
      cnt++;
    }
  }
  cout << cnt << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: expected '}' at end of input
   13 |   cout << cnt << endl;
      |                       ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main() {
  string n;
  cin>>n;
  int ans=0;
  if(n[0]=="2"){
    ans++;
  }
  else if(n[1]=="2"){
    ans++;
  }
  else if(n[2]=="2"){
    ans++;
  }
  else if(n[3]=="2"){
    ans++;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(n[0]=="2"){
a.cc:11:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |   else if(n[1]=="2"){
a.cc:14:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |   else if(n[2]=="2"){
a.cc:17:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |   else if(n[3]=="2"){
Language: C++

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

int main() {
  int n;
  cin>>n;
  int ans=0;
  if(n[0]=="2"){
    ans++;
  }
  else if(n[1]=="2"){
    ans++;
  }
  else if(n[2]=="2"){
    ans++;
  }
  else if(n[3]=="2"){
    ans++;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: invalid types 'int[int]' for array subscript
    8 |   if(n[0]=="2"){
      |       ^
a.cc:11:12: error: invalid types 'int[int]' for array subscript
   11 |   else if(n[1]=="2"){
      |            ^
a.cc:14:12: error: invalid types 'int[int]' for array subscript
   14 |   else if(n[2]=="2"){
      |            ^
a.cc:17:12: error: invalid types 'int[int]' for array subscript
   17 |   else if(n[3]=="2"){
      |            ^
Language: C++

#include<iostream>
using namespace std;
int main(void){
  int a,b,c = 0;
 cin >> a;
  string s = itos(a);
  for(int i =0;i < s.size();i++){
    if(s.at(i) == '2'){
      c++;
    }
  }
  cout << c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: 'itos' was not declared in this scope
    6 |   string s = itos(a);
      |              ^~~~
Language: C++

#include <bits/stdc++.h>
int main(){
 string s;cin>>s;
  int cnt=0;
  for(int i=0;i<s.size();i++)if(s[i]=='2')cnt++;
  cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:2: error: 'string' was not declared in this scope
    3 |  string s;cin>>s;
      |  ^~~~~~
a.cc:3:2: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:3:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    3 |  string s;cin>>s;
      |           ^~~
      |           std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:3:16: error: 's' was not declared in this scope
    3 |  string s;cin>>s;
      |                ^
a.cc:6:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    6 |   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:6:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    6 |   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>
int main(){
 string s;cin>>s;
  int cnt=0;
  for(int i=0;i<s.size();i++)if(s[i]=='2')cnt++;
  cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:2: error: 'string' was not declared in this scope
    3 |  string s;cin>>s;
      |  ^~~~~~
a.cc:3:2: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:3:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    3 |  string s;cin>>s;
      |           ^~~
      |           std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:3:16: error: 's' was not declared in this scope
    3 |  string s;cin>>s;
      |                ^
a.cc:6:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    6 |   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:6:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    6 |   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<iostream>
#include<string>
int main(){
 string s;cin>>s;
  int cnt=0;
  for(int i=0;i<s.size();i++)if(s[i]=='2')cnt++;
  cout<<cnt<<endl;
}

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

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

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

#include <cstdio>

int main()
{
  char s[5];
  scanf("%s", s);
  int ans = 0;
  for (int i = 0; i < 4; ++i)
  {
    if (s[i] == '2') ++ans);
  }
  printf("%d\n", ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:27: error: expected ';' before ')' token
   10 |     if (s[i] == '2') ++ans);
      |                           ^
      |                           ;
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  string s; cin >> s
  int result=0 ; rep(i,4) if (s[i]=='2') result++;
  cout << result << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: expected ';' before 'int'
   18 |   string s; cin >> s
      |                     ^
      |                     ;
   19 |   int result=0 ; rep(i,4) if (s[i]=='2') result++;
      |   ~~~                
a.cc:19:42: error: 'result' was not declared in this scope
   19 |   int result=0 ; rep(i,4) if (s[i]=='2') result++;
      |                                          ^~~~~~
a.cc:20:11: error: 'result' was not declared in this scope
   20 |   cout << result << endl;
      |           ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#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 vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  string n;
  int ans=0;
  cin>>n;
  rep(i,4){
    if(n[i]=='2') ans++;
  }
  cout<<<ans<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: expected primary-expression before '<' token
   32 |   cout<<<ans<endl;
      |         ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int N;
  cin >> N;
  int ans = 0
  while (N) {
    if (N%10 == 2);
      ans++;
    N /= 10;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: expected ',' or ';' before 'while'
   26 |   while (N) {
      |   ^~~~~