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

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

int main() {

    int N; cin >> N;
    string S; cin >> S;

    vector<string> codes;

    for (int i=0; i<N; i++) {
        for (int j=i+1; j<N; j++) {
            for (int k=j+1; k<N; k++) {
                if (j>N-2 || k>N-1) continue;
                string code = "";
                code = code + S.at(i) + S.at(j) + S.at(k);
                codes.push_back(code);
            }
        }
    }

    sort(codes.begin(), codes.end())
    codes.erase(unique(codes.begin(), codes.end()), codes.end());
    cout << codes.size() << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:37: error: expected ';' before 'codes'
   22 |     sort(codes.begin(), codes.end())
      |                                     ^
      |                                     ;
   23 |     codes.erase(unique(codes.begin(), codes.end()), codes.end());
      |     ~~~~~
Language: C++

#include <bits/stdc++.h>
#include <ios>     
#include <iomanip> 
using namespace std;
 
int main() {
  vector<int> count(1000);
  int res;
  int N;
  int a=0;
  string s;
  string pass;
  cin>>N,s;

  for (int i = 0; i < 1000; i++)
  { //pass=printf("%03d",i);
    std::string pass << std::setfill('0') << std::right << std::setw(4) << i;
    for (int b = 0; b < N; b++)
    {
        if(s.at(b)==pass.at(a)){a++;}
        if(a==3)break;
    }
    a=0;
    count.at(i)++;
  }
  
  for (int i = 0; i < 1000; i++)
  {
      if (count.at(i))res++;
     
      
  }
  cout<<res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:22: error: expected initializer before '<<' token
   17 |     std::string pass << std::setfill('0') << std::right << std::setw(4) << i;
      |                      ^~
Language: C++

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

typedef long long ll;

int main(){
	ll n;
	cin>>n;
	vector<string>s;
	vector<int>a(10);
	for(int i=0;i<s.size();i++){
		cin>>s[i];
		a[s[i]]++;
	}
	ll num=0;
	ll ans=1;
	for(int i=1;i<10;i++){
		num+=(a[i]-1);
		ans*=num;
	}
	cout<<n*(n-1)*(n-2)/6-ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: no match for 'operator[]' (operand types are 'std::vector<int>' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   15 |                 a[s[i]]++;
      |                  ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define MAX 100005
#define ll long long
int n;
string str;
vector<string> v;

void gen(int pos, string cur)
{
    if(pos == 3){
        v.push_back(cur);
        return;
    }
    for(int i=0; i<=9; i++){
        string temp = cur;
        temp += (char)((int)'0'+i);
        gen(pos+1, temp);
    }
}

string change(int n)
{
    string ret = "";
    while(n != 0){
        int mod = n%10;
        ret += (char)((int)'0'+mod);
        n = n/10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

bool calc(string s)
{
    int it = 0;
    for(int i=0; i<str.length(); i++){
        if(it > 3) break;
        if(s[it] == str[i]) it++;
    }
    return (it>3);
}

int main()
{
    memset(dp, -1, sizeof dp);
    scanf("%d", &n);
    cin >> str;
    ll ans = 0;
    gen(0, "");
    for(int i=0; i<v.size(); i++){
        if(calc(v[i])) ans++;
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   48 |     memset(dp, -1, sizeof dp);
      |            ^~
      |            dup
Language: C++

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

int main(int argc, char const *argv[])
{
  int sum=0;
  int i,j,k,l,m,n;
  int n;
  scanf("%d",&n);
  char s[n];
  scanf("%d",s);
  int r[n];
  for(i=0;i<n;i++){
    switch(s[i]){
      case '0': r[i]=0; break;
      case '1': r[i]=1; break;
      case '2': r[i]=2; break;
      case '3': r[i]=3; break;
      case '4': r[i]=4; break;
      case '5': r[i]=5; break;
      case '6': r[i]=6; break;
      case '7': r[i]=7; break;
      case '8': r[i]=8; break;
      case '9': r[i]=9; break;
    }
  }
  char p[3];
  int t[10];
  int c=0;

  int i,j,k,l,m,n;
  for(l=0;l<10;l++){
    for(m=0;m<10;m++){
      for(i=0;i<100;i++){
        if(r[i]==0){
          for(j=i+1;j<100;j++){
            if(r[j]==0){
              for(k=j+1;k<100;k++){
                t[r[k]-1]=1;
              }
              for(k=0;k<10;k++){
                if(r[k]==1) sum++;
                r[k]=0;
              }
            }
          }
        }
      }
    }
  }
  printf("%d",sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:9:7: error: redeclaration of 'int n'
    9 |   int n;
      |       ^
a.cc:8:17: note: 'int n' previously declared here
    8 |   int i,j,k,l,m,n;
      |                 ^
a.cc:32:7: error: redeclaration of 'int i'
   32 |   int i,j,k,l,m,n;
      |       ^
a.cc:8:7: note: 'int i' previously declared here
    8 |   int i,j,k,l,m,n;
      |       ^
a.cc:32:9: error: redeclaration of 'int j'
   32 |   int i,j,k,l,m,n;
      |         ^
a.cc:8:9: note: 'int j' previously declared here
    8 |   int i,j,k,l,m,n;
      |         ^
a.cc:32:11: error: redeclaration of 'int k'
   32 |   int i,j,k,l,m,n;
      |           ^
a.cc:8:11: note: 'int k' previously declared here
    8 |   int i,j,k,l,m,n;
      |           ^
a.cc:32:13: error: redeclaration of 'int l'
   32 |   int i,j,k,l,m,n;
      |             ^
a.cc:8:13: note: 'int l' previously declared here
    8 |   int i,j,k,l,m,n;
      |             ^
a.cc:32:15: error: redeclaration of 'int m'
   32 |   int i,j,k,l,m,n;
      |               ^
a.cc:8:15: note: 'int m' previously declared here
    8 |   int i,j,k,l,m,n;
      |               ^
a.cc:32:17: error: redeclaration of 'int n'
   32 |   int i,j,k,l,m,n;
      |                 ^
a.cc:8:17: note: 'int n' previously declared here
    8 |   int i,j,k,l,m,n;
      |                 ^
Language: C++

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

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

    vector<string> t(1000);
    rep(i, 10){
        char tmp = '0' + i;
        t.at(i) = "00";
        t.at(i) += tmp;
    }

    for(int i=10; i<100; i++){
        string tmp = to_string(i);
        t.at(i) = "0";
        t.at(i) += tmp;
    }

    for(int i=100; i<1000; i++){
        t.at(i) = to_string(i);
    }

    vector<bool> used(1000, false);

    for(int i=0; i<1000; i++){
        for(ll j=0; j<S.size(); j++){
            if(t.at(i).at(0) == S.at(j)){
                for(ll k=j+1; k<S.size(); k++){
                    if(t.at(i).at(1) == S.at(k)){
                        for(ll l=k+1; l<S.size(); l++){
                            if(t.at(i).at(2) == S.at(l)){
                                used.at(i) = true;
                                break;
                            }
                        }
                        if(use.at(i)) break;
                    }
                }
            }
            if(use.at(i)) break;
        }
        
    }

    int cnt = 0;
    for(int i=0; i<1000; i++){
        if(used.at(i) == true) cnt++;
    }

    cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:28: error: 'use' was not declared in this scope; did you mean 'used'?
   40 |                         if(use.at(i)) break;
      |                            ^~~
      |                            used
a.cc:44:16: error: 'use' was not declared in this scope; did you mean 'used'?
   44 |             if(use.at(i)) break;
      |                ^~~
      |                used
Language: C++

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	const int NUM = 10;
	
	int dp[1000] = {};
	int con = 0;
	int N;
	string s;
	
	cin>>N;
	cin>>s;
	
	for(int i = 0; i < N; i++){
		int n = s[i] - '0';
		
		for(int j = 0; j < NUM; j++){
			for(int k = 0; k < NUM; k++){
				if(dp[j*10 + k * 10]){
					dp[j*10 + k*10 + n] = true;
				}
			}
			if(dp[j]){
				dp[j*10 + n] = true;
			}
		}
		
		
		dp[n] = true;
	}
	
	cout<<count(con.begin(), con.end(), 1)<<endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:25: error: request for member 'begin' in 'con', which is of non-class type 'long long int'
   54 |         cout<<count(con.begin(), con.end(), 1)<<endl;
      |                         ^~~~~
a.cc:54:38: error: request for member 'end' in 'con', which is of non-class type 'long long int'
   54 |         cout<<count(con.begin(), con.end(), 1)<<endl;
      |                                      ^~~
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
//        sc.useDelimiter("");
        char[] s = new char[N];
        String S = sc.next();
        s = S.toCharArray();

        Set<String> set = new HashSet<String>();

        String a = "";
        for (int i = 0; i < N; i++) {
            String tmp = a;
            a = a + s[i];
            for (int j = i; j < N; j++) {
                if (j == i) {
                    continue;
                }
                String tmp2 = a;
                a = a + s[j];
                for (int k = j; k < N; k++) {
                    if (k == j || k == i) {
                        continue;
                    }
                    String tmp3 = a;
                    a = a + s[k];
                    System.out.println(a);
                    if (!set.contains(a)) {
                        set.add(a);
                    }
                    a = tmp3;
                }
                a = tmp2;
            }
            a = tmp;
        }
        System.out.println(set.size());
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:10: error: cannot find symbol
        Set<String> set = new HashSet<String>();
        ^
  symbol:   class Set
  location: class Main
Main.java:10: error: cannot find symbol
        Set<String> set = new HashSet<String>();
                              ^
  symbol:   class HashSet
  location: class Main
4 errors
Language: C

/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {
	short n;
	scanf("%hd", &n);
	/*char s[n];*/char s[30000];
	scanf("%s", s);
	unordered_map<int, int> a;
	rep(i, n) {
		for (int j = i + 1; j < n; ++j) {
			for (int k = j + 1; k < n; ++k) {
				a[s[i] * (int)100 + s[j] * (int)10 + (int)s[k]] = true;
			}
		}
	}
	printf("%lld\n", (ll)a.size());
	Please AC;
}


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

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

int main()
{
	int N = 0;
	string S;
	cin >> N >> S;
	set<string> num[N] {};
	
	for (int i = 0; i < N; i++)
	{
		string temp = S.erase(i, 1);
		num[0].insert(temp);
	}
	
	for (int i = 1; i < N - 3; i++)
		for (int j = 0; j < N - i; j++)
		{
			string temp = S.erase(j, 1);
			num[i].insert(temp);
		}
		
	cout << S[N - 1].size();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: request for member 'size' in 'S.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)(N - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   25 |         cout << S[N - 1].size();
      |                          ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  string S; cin >> S;

  vector<vector<bool>> ans(3);
  ans[0].resize(10);
  ans[1].resize(100);
  ans[2].resize(1000);

  for (char c : S) {
    int x = c - '0';
    REP(i, 100) {
      if (ans[1][i]) {
        ans[2][i * 10 + x] = true;
      }
    }
    REP(i, 10) {
      if (ans[0][i]) {
        ans[1][i * 10 + x] = true;

      }
    }
    ans[x] = true;
  }

  int num = 0;
  REP(i, 1000) num += ans[2][i];
  cout << num << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:14: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} and 'bool')
   44 |     ans[x] = true;
      |              ^~~~
In file included from /usr/include/c++/14/vector:67,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_bvector.h:894:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(const std::vector<bool, _Alloc>&) [with _Alloc = std::allocator<bool>]'
  894 |       operator=(const vector& __x)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:894:31: note:   no known conversion for argument 1 from 'bool' to 'const std::vector<bool>&'
  894 |       operator=(const vector& __x)
      |                 ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:926:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::vector<bool, _Alloc>&&) [with _Alloc = std::allocator<bool>]'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:926:26: note:   no known conversion for argument 1 from 'bool' to 'std::vector<bool>&&'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:952:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::initializer_list<bool>) [with _Alloc = std::allocator<bool>]'
  952 |       operator=(initializer_list<bool> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:952:40: note:   no known conversion for argument 1 from 'bool' to 'std::initializer_list<bool>'
  952 |       operator=(initializer_list<bool> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: Java

import java.util.stream.*;
import java.util.Scanner;
class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder buf = new StringBuilder();
        int N = sc.nextInt();
        String S = sc.next();
        List<String> list = new ArrayList<>();
        for (int i=0; i<=N-3; i++) {
        		for (int j=i+1; j<=N-2; j++) {
        			for (int k=j+1; k<=N-1; k++) {
        				buf.append(S.charAt(i));
        				buf.append(S.charAt(j));
        				buf.append(S.charAt(k));
        				String s = buf.toString();
        				list.add(s);
        				buf.delete(0, buf.length());
        			}
        		}
        }
        List<String> listB = list.stream().distinct().collect(Collectors.toList());
        System.out.println(listB.size());
    }
} 

Compiler output:
Main.java:10: error: cannot find symbol
        List<String> list = new ArrayList<>();
        ^
  symbol:   class List
  location: class Main
Main.java:10: error: cannot find symbol
        List<String> list = new ArrayList<>();
                                ^
  symbol:   class ArrayList
  location: class Main
Main.java:23: error: cannot find symbol
        List<String> listB = list.stream().distinct().collect(Collectors.toList());
        ^
  symbol:   class List
  location: class Main
3 errors
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef  DEBUG
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif  // for local.
  bool exist[10][10][10];
  int n;
  string s, s_1, s_2;
  int pos, pos_1, pos_2;
  cin >> n >> s;
  for (int i = 0; i < 10; i++) {
    pos = s.find((char)i);
    if (pos == string::npos || pos + 2 >= n) {
      continue;
    } else {
      s_1 = s.substr(pos+1);
      for (int j = 0; j < 10; j++) {
        pos = s_1.find((char)j);
        if (pos == string::npos || pos + 1 == n) {
          continue;
        } else {
          s_2 = s_1.substr(pos+1);
          for (int k = 0; k < 10; k++) {
            pos = s_2.find((char)k);
            if (pos == string::npos) {
              continue;
            } else {
              exist[i][j][k] = true;
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 10; i++) {
    for (int i = 0; i < 10; i++) {
      for (int i = 0; i < 10; i++) {
        if (exist[i][j][k] = true) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:22: error: 'j' was not declared in this scope
   43 |         if (exist[i][j][k] = true) {
      |                      ^
a.cc:43:25: error: 'k' was not declared in this scope
   43 |         if (exist[i][j][k] = true) {
      |                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef  DEBUG
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif  // for local.
  bool exist[10][10][10];
  int n;
  string s, s_1, s_2;
  int pos, pos_1, pos_2;
  cin >> n >> s;
  for (int i = 0; i < 10; i++) {
    pos = s.find((char)i);
    if (pos == string::npos || pos + 2 >= n) {
      continue;
    } else if {
      s_1 = s.substr(pos+1);
      for (int j = 0; j < 10; j++) {
        pos = s_1.find((char)j);
        if (pos == string::npos || pos + 1 == n) {
          continue;
        } else {
          s_2 = s_1.substr(pos+1);
          for (int k = 0; k < 10; k++) {
            pos = s_2.find((char)k);
            if (pos == string::npos) {
              continue;
            } else {
              exist[i][j][k] = true;
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 10; i++) {
    for (int i = 0; i < 10; i++) {
      for (int i = 0; i < 10; i++) {
        if (exist[i][j][k] = true) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: expected '(' before '{' token
   19 |     } else if {
      |               ^
      |               (
a.cc:43:22: error: 'j' was not declared in this scope
   43 |         if (exist[i][j][k] = true) {
      |                      ^
a.cc:43:25: error: 'k' was not declared in this scope
   43 |         if (exist[i][j][k] = true) {
      |                         ^
Language: C++

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

int main(){

    int N;
    string S;
    vector<string> result;

    cin >> N;
    cin >> S;

    for(int i = 0; i < N-2; ++i ){
        for( int j = i+1; j < N-1; ++j ){
            for( int k = j+1; k < N; ++k ){
                string tmp(3,'0');
                tmp.at(0) = S[i];
                tmp.at(1) = S[j];
                tmp.at(2) = S[k];
                // cout << tmp << endl;
                if ( find(result.begin(), result.end(), tmp ) == result.end() ){
                    result.push_back(tmp);
                }
            }
        }
    }

    // std::sort(result.begin(), result.end());
    // result.erase(std::unique(result.begin(),result.end()),result.end());
    cout << result.size() << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   22 |                 if ( find(result.begin(), result.end(), tmp ) == result.end() ){
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:22:26: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   22 |                 if ( find(result.begin(), result.end(), tmp ) == result.end() ){
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

using ll = long long;
#define rep1(i, n) for(int i = 1; i < (n); i++)


int N;
string S;
int num[1000];

int dp[30000+1][4][1000];

void solve(int pos = 0, int k = 0, int sum = 0)
{
    if (k == 3) {
        num[sum] = 1;
        // cout << sum << endl;
        return;
    }

    if (pos == S.size()) {
        return;
    }

    if (~dp[pos][k][sum]) return;

    int digit = S[pos] - '0';

    solve(pos + 1, k, sum);
    solve(pos + 1, k+1, sum*10+digit);

    dp[pos][k][sum] = 1;
}

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

    cin >> N >> S;

    memset(dp, -1, sizeof dp);
    memset(num, 0, sizeof num);
    
    solve();
    
    int ans = 0;
    rep(i, 1000) {
        if (num[i] != 0) ans++;
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'i' was not declared in this scope
   48 |     rep(i, 1000) {
      |         ^
a.cc:48:5: error: 'rep' was not declared in this scope; did you mean 'rep1'?
   48 |     rep(i, 1000) {
      |     ^~~
      |     rep1
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef  DEBUG
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif  // for local.
  bool exist[10][10][10];
  int n;
  string s, s_1, s_2;
  int pos, pos_1, pos_2;
  cin >> n >> s;
  for (int i = 0; i < 10; i++) {
    pos = s.find(str(i));
    if (pos == string::npos || pos + 2 >= n) {
      continue;
    } else if {
      s_1 = s.substr(pos+1);
      for (int j = 0; j < 10; j++) {
        pos = s_1.find(str(j));
        if (pos == string::npos || pos + 1 == n) {
          continue;
        } else {
          s_2 = s_1.substr(pos+1);
          for (int k = 0; k < 10; k++) {
            pos = s_2.find(str(k));
            if (pos == string::npos) {
              continue;
            } else {
              exist[i][j][k] = true;
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 10; i++) {
    for (int i = 0; i < 10; i++) {
      for (int i = 0; i < 10; i++) {
        if (exist[i][j][k] = true) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'str' was not declared in this scope; did you mean 'std'?
   16 |     pos = s.find(str(i));
      |                  ^~~
      |                  std
a.cc:19:15: error: expected '(' before '{' token
   19 |     } else if {
      |               ^
      |               (
a.cc:43:22: error: 'j' was not declared in this scope
   43 |         if (exist[i][j][k] = true) {
      |                      ^
a.cc:43:25: error: 'k' was not declared in this scope
   43 |         if (exist[i][j][k] = true) {
      |                         ^
Language: C++

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

int main(){

    int N;
    string S;
    vector<string> result;

    cin >> N;
    cin >> S;

    for(int i = 0; i < N-2; ++i ){
        for( int j = i+1; j < N-1; ++j ){
            for( int k = j+1; k < N; ++k ){
                string tmp(3,'0');
                tmp.at(0) = S[i];
                tmp.at(1) = S[j];
                tmp.at(2) = S[k];
                // cout << tmp << endl;
                result.push_back(tmp);
            }
        }
    }

    std::sort(result.begin(), result.end());
    result.erase(std::unique(result.begin(),result.end()),result.end());
    cout << result.size() << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   27 |     std::sort(result.begin(), result.end());
      |          ^~~~
      |          qsort
a.cc:28:23: error: 'unique' is not a member of 'std'
   28 |     result.erase(std::unique(result.begin(),result.end()),result.end());
      |                       ^~~~~~
Language: C++

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

int main(){

    int N;
    string S;
    vector<string> result;

    cin >> N;
    cin >> S;

    for(int i = 0; i < N-2; ++i ){
        for( int j = i+1; j < N-1; ++j ){
            for( int k = j+1; k < N; ++k ){
                string tmp(3,'0');
                tmp.at(0) = S[i];
                tmp.at(1) = S[j];
                tmp.at(2) = S[k];
                // cout << tmp << endl;
                result.push_back(tmp);
            }
        }
    }

    sort(result.begin(), result.end());
    result.erase(unique(result.begin(),result.end()),result.end());
    cout << result.size() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |     sort(result.begin(), result.end());
      |     ^~~~
      |     short
a.cc:28:18: error: 'unique' was not declared in this scope
   28 |     result.erase(unique(result.begin(),result.end()),result.end());
      |                  ^~~~~~
Language: C++

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

int main() {
	int N = 0;
	string lucky;
	cin >> N;
	cin >> lucky;

	string ch[3];
	string dum;
	vector<string> ans;

	// 3����
	for (int i = 0; i < N - 2; i++) {
		ch[0] = lucky[i];
		// 2����
		for (int j = i + 1; j < N - 1; j++) {
			ch[1] = lucky[j];
			// 1����
			for (int k = j + 1; k < N; k++) {
				ch[2] = lucky[k];
				dum = ch[0] + ch[1] + ch[2];
				if (ans.end() == find(ans.begin(), ans.end(), dum)) {
					ans.push_back(dum);
				}
			}
		}
	}
	cout << ans.size() << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:54: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   26 |                                 if (ans.end() == find(ans.begin(), ans.end(), dum)) {
      |                                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:26:54: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   26 |                                 if (ans.end() == find(ans.begin(), ans.end(), dum)) {
      |                                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
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; }
using namespace std;


int main(){
  ll N,ans=0;
  string S;
  cin>>N>>S;
  
  bool AA[N][10],BB[N][10];
  REP(i,N){
    REP(j,10){
      AA[i][j]=false;
      BB[i][j]=false;
    }
  }
  
  ll AAA[N],BBB[N];
  REP(i,N){
    REP(j,N){
      AAA[i]=0;
      BBB[i]=0;
    }
  }
  
  bool CAN[1000];
  REP(i,1000) CAN=false;
  
  
  for(int i=0; i<S.size(); ++i){
    if(AA[i][S.at(i)]==false){
      AA[i][S.at(i)]=true;
    }
    if(i>0){
      for(int j=0; j<10; ++j){
        if(AA[i-1][j]==true) AA[i][j]=true;
      }
    }
  }
  
  for(int i=S.size()-1; i>=0; --i){
    if(BB[i][S.at(i)]==false){
      BB[i][S.at(i)]=true;
    }
    if(i<S.size()-1){
      for(int j=0; j<10; ++j){
        if(BB[i+1][j]==true) BB[i][j]=true;
      }
    }
  }
  
  for(int i=1; i<=S.size()-2; ++i){
    for(int j=0; j<10; ++j){
      for(int k=0; k<10; ++k){
        if(AA[i][j]==true && BB[i][k]==true) CAN[j*100+S.at(i)*10+k]=true;
      }
    }
  }
  
  for(int i=0; i<1000; ++i){
    if(CAN) ans++;
  }
  
  co(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:18: error: incompatible types in assignment of 'bool' to 'bool [1000]'
   53 |   REP(i,1000) CAN=false;
      |               ~~~^~~~~~
Language: C++

from itertools import product
n = int(input())
l = input()
pre = [{e} for e in l]
suf = [{e} for e in l]
for i in range(1, n):
    pre[i] |= pre[i - 1]
    suf[n - 1 - i] |= suf[n - i]
res = set()
for i in range(1, n - 1):
    res.update(a + l[i] + b for a, b in product(pre[i - 1], suf[i + 1]))
print(len(res))


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import product
      | ^~~~
a.cc:4:12: error: expected unqualified-id before 'for'
    4 | pre = [{e} for e in l]
      |            ^~~
a.cc:5:12: error: expected unqualified-id before 'for'
    5 | suf = [{e} for e in l]
      |            ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
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; }
using namespace std;


int main(){
  ll N,ans=0;
  string S;
  cin>>N>>S;
  
  bool AA[10],BB[10];
  
  REP(i,10){
    AA[i]=false;
    BB[i]=false;
  }
  
  ll AAA[N],BBB[N];
  REP(i,N){
    REP(j,N){
      AAA[i]=0;
      BBB[i]=0;
    }
  }
  
  for(int i=0; i<S.size(); ++i){
    if(AA[S.at(i)]==false){
      AA[S.at(i)]=true;
      if(0<=i && i<=S.size()-3) AAA[i+1]++;
    }
  }
  
  for(int i=S.size()-1; i>=0 --i){
    if(BB[S.at(i)==false]){
      BB[S.at(i)]=true;
      if(2<=i && i<=S.size()-1) BBB[i-1]++;
    }
  }
  
  
  for(int i=1; i<S.size()-1; ++i){
    ans+=AAA[i]*BBB[i];
  }
  
  co(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:28: error: lvalue required as decrement operand
   58 |   for(int i=S.size()-1; i>=0 --i){
      |                            ^
a.cc:58:32: error: expected ';' before 'i'
   58 |   for(int i=S.size()-1; i>=0 --i){
      |                                ^
      |                                ;
Language: C++

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main(){
  int n; cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];

  char c[] = {0, 0, 0};
  mint ans = 1;

  rep(i, n){
    bool first = true;
    mint cnt = 0;
    rep(j, 3){
      if(c[j] == a[i]){
        if(first) c[j]++;
        first = false;
        cnt++;
      }
    }
    ans *= cnt;
  }
  cout << ans << endl;

  return 0;
}


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

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

int main(){
    ll n;
    cin >> n;
    ll ans=1;
    ll a=0,b=0,c=0;

    ll nn;
    ll mod=1e9+7;

    rep(i,n){
        cin >> nn;
        if(nn==a){
            ++a;
            if(nn==b and nn==c){
                ans*=3;
                ans=ans%mod;
            }
            else if(nn==b or nn==c){
                ans*=2;
                ans=ans%mod;
            }
        }
        else if(nn==b){
            ++b;
            if(nn==c){
                ans*=2;
                ans=ans%mod;
            }
        }
    

    return 0;
}


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

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    int n;
    cin >> n;
    int zero = 0;
    vector<int> num(n);
    mint ans = 1;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        num[a]++;
        if(a == 0){
            zero++;
            continue;
        }
        ans *= num[a-1];
        num[a-1]--;
        if(num[a-1] < 0){
            cout << 0 << endl:
            return 0;
        }
    }
    for(int i = zero; i >= 1; i--) ans *= i;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:30: error: expected ';' before ':' token
   55 |             cout << 0 << endl:
      |                              ^
      |                              ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long int mod=1e9+7;
int a[100005];
long long int dp[100005];
int n;
void solve(int now,int x,int y,int z){
    if(now==n)return;
    else if(x==y && y==z){
        dp[now]=(dp[now-1]*3LL)%mod;
        solve(now+1,x+1,y,z);
    }
    else if(x==y && y==a[now] && x!=z){
        dp[now]=(dp[now-1]*2LL)%mod;
        solve(now+1,x+1,y,z);        
    }
    else if(z==y && y==a[now] && x!=z){
        dp[now]=(dp[now-1]*2LL)%mod;
        solve(now+1,x,y+1,z);        
    }
    else if(z==x && x==a[now] && x!=y){
        dp[now]=(dp[now-1]*2LL)%mod;
        solve(now+1,x,y,z+1);        
    }
    else if(x==a[now]&& x!=z && x!=y){
        dp[now]=dp[now-1];
        solve(now+1,x+1,y,z);
    }
    else if(y==a[now] x!=y && z!=y){
        dp[now]=dp[now-1];
        solve(now+1,x,y+1,z);
    }
    else if(z==a[now] && z!=y && z!=x){
        dp[now]=dp[now-1];
        solve(now+1,x,y,z+1);
    }
}

int main(){
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    dp[0]=3;
    solve(1,1,0,0);
    cout << dp[n-1];
}

Compiler output:
a.cc: In function 'void solve(int, int, int, int)':
a.cc:29:22: error: expected ')' before 'x'
   29 |     else if(y==a[now] x!=y && z!=y){
      |            ~         ^~
      |                      )
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long int mod=1e9+7;
int a[100005];
long long int dp[100005];
int n;
void solve(int now,int x,int y,int z){
    if(now==n)return;
    else if(x==y && y==z){
        dp[now]=(dp[now-1]*3LL)%mod;
        solve(now+1,x+1,y,z);
    }
    else if(x==y && y==a[now]){
        dp[now]=(dp[now-1]*2LL)%mod;
        solve(now+1,x+1,y,z);        
    }
    else if(z==y && y==a[now]){
        dp[now]=(dp[now-1]*2LL)%mod;
        solve(now+1,x,y+1,z);        
    }
    else if(z==x && x==a[now]){
        dp[now]=(dp[now-1]*2LL)%mod;
        solve(now+1,x,y,z+1);        
    }
    else if(x==a[now]){
        dp[now]=dp[now-1];
        solve(now+1,x+1,y,z);
    }
    else if(y==a[now]){
        dp[now]=dp[now-1];
        solve(now+1,x,y+1,z);
    }
    else(z==a[now]){
        dp[now]=dp[now-1];
        solve(now+1,x,y,z+1);
    }
}

int main(){
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    dp[0]=3;
    solve(1,1,0,0);
    cout << dp[n-1]-1;
}

Compiler output:
a.cc: In function 'void solve(int, int, int, int)':
a.cc:33:20: error: expected ';' before '{' token
   33 |     else(z==a[now]){
      |                    ^
      |                    ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long int mod=1e9+7;
int a[100005];
long long int dp[100005];
int n;
void solve(int now,int x,int y,int z){
    if(now==n)return;
    else if(x==y && y==z){
        dp[now]=(dp[now-1]*3);
        dp[now]%=mod;
        solve(now+1,x+1,y,z);
    }
    else if(x==y && y==a[now]){
        dp[now]=(dp[now-1]*2);
        dp[now]%=mod;
        solve(now+1,x+1,y,z);        
    }
    else if(z==y && y==a[now]){
        dp[now]=(dp[now-1]*2);
        dp[now]%=mod;
        solve(now+1,x,y+1,z);        
    }
    else if(z==x && x==a[now]){
        dp[now]=(dp[now-1]*2);
        dp[now]%=mod;
        solve(now+1,x+1,y,z);        
    }
    else if(x==a[now]){
        dp[now]=dp[now-1];
        solve(now+1,x+1,y,z);
    }
    else if(y==a[now]){
        dp[now]=dp[now-1];
        solve(now+1,x,y+1,z);
    }
    else if(z==a[now]){
        dp[now]=dp[now-1];
        solve(now+1,x,y,z+1);
    }
    else{
        cout << 0;
        return 0;
    }
}

int main(){
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    dp[0]=3;
    solve(1,1,0,0);
    cout << dp[n-1];
}

Compiler output:
a.cc: In function 'void solve(int, int, int, int)':
a.cc:43:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   43 |         return 0;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long int mod=1e9+7;
int a[100005];
long long int dp[100005];
int n;
void solve(int now,int x,int y,int z){
    if(now==n)return;
    else if(x==y && y==z){
        dp[now]=dp[now-1]*3;
        dp[now]%=mod;
        solve(now+1,x+1,y,z);
    }
    else if(x==y && y==(a[now]-1)){
        dp[now]=dp[now-1]*2;
        dp[now]%=mod;
        solve(now+1,x+1,y,z);        
    }
    else if(z==y && y==(a[now]-1)){
        dp[now]=dp[now-1]*2;
        dp[now]%=mod;
        solve(now+1,x,y+1,z);        
    }
    else if(z==x && x==(a[now]-1)){
        dp[now]=dp[now-1]*2;
        dp[now]%=mod;
        solve(now+1,x+1,y,z);        
    }
    else if(x==(a[now]-1)){
        dp[now]=dp[now-1];
        solve(now+1,x+1,y,z);
    }
    else if(y==(a[now]-1)){
        dp[now]=dp[now-1];
        solve(now+1,x,y+1,z);
    }
    else if(z==(a[now]-1)){
        dp[now]=dp[now-1];
        solve(now+1,x,y,z+1);
    }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
    int n;
    long long int ans = 3;
    cin >> n;
    int a[n], rgb[3] = {0};
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
  	if(a[i] != 0) {
    	cout << 0 << '\n';
      	return 0;
    }
    rgb[0] = 1;
    for(int i = 1; i < n; ++i) {
        int sum = 0;
        for(int j = 0; j < 3; ++j) {
            if(rgb[j] == a[i]) sum++;
        }
        ans *= sum;
        ans %= MOD;
        for(int j = 0; j < 3; ++j) {
            if(rgb[j] == a[i]) {
                rgb[j]++;
                break;
            }
        }
    }
    cout << ans << '\n';

    return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int main(){
int64_t N;
  cin>>N;
  map<int64_t,int64_t>M;
  M[-1]=3;
  for(int64_t i=0;i<N;i++)
    M[i]=0;
  for(int64_t i=0;i<N;i++){
  int64_t a;
    cin>>a;
    M.at(a)++;
    if(M.at(a-1)<M.at(a)){
    ans=0; break;
    }else{
    ans=((1+M.at(a-1)-M.at(a))*ans)%mod;
    }
       }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans=0; break;
      |     ^~~
      |     abs
a.cc:18:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |     ans=((1+M.at(a-1)-M.at(a))*ans)%mod;
      |     ^~~
      |     abs
a.cc:20:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |        }cout<<ans<<endl;
      |               ^~~
      |               abs