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

#include <bits/stdc++.h>

using namespace std;

int main (void) {
      int d;
      int g;

      cin >> d;
      cin >> g;

      int p[d];
      int c[d];

      int cnt;
      int cnt2;
      int flag = 0;
      int add_flag[d]

      int sel;

      int ans[d];

      for (cnt = 0; cnt < d; cnt++){
            cin >> p[d];
            cin >> c[d];
      }

      for (cnt = 0; cnt < d; cnt++){
            sel = sel + p[cnt];
      }

      for (cnt = 0; cnt < sel; cnt++){
            for (cnt2 = 0; cnt2 < d; cnt2++){
                  if (add_flag[cnt2] == 0){
                        ans[cnt2] = cnt2 * 100 * cnt;
                  }
                  if (cnt == p[cnt2]){
                        ans[cnt2] = ans[cnt2] + c[cnt2];
                        add_flag[cnt2] = 1;
                  }
                  if (ans[cnt2] >= g){
                        cout << cnt << "\n";
                        cnt = sel + 1;
                        flag = 1;
                  }
            }
      }

      //if (flag = 0){
      //
      //}

      return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: expected initializer before 'int'
   20 |       int sel;
      |       ^~~
a.cc:30:13: error: 'sel' was not declared in this scope
   30 |             sel = sel + p[cnt];
      |             ^~~
a.cc:33:27: error: 'sel' was not declared in this scope
   33 |       for (cnt = 0; cnt < sel; cnt++){
      |                           ^~~
a.cc:35:23: error: 'add_flag' was not declared in this scope
   35 |                   if (add_flag[cnt2] == 0){
      |                       ^~~~~~~~
a.cc:40:25: error: 'add_flag' was not declared in this scope
   40 |                         add_flag[cnt2] = 1;
      |                         ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int d,g;
    cin>>d>>g;
    vector<pair<long long int,long long int> >ar(d+1);
    for(int i=1;i<=d;i++)
       {
           cin>>ar[i].first>>ar[i].second;
       }
    long long int y=0;long long int ans=0;
    for(int i=d;i;i--)
    {   if(g<=0)break;
        y=ar[i].first*100*i;y+=ar[i].second;
        if(y<=g){g-=y;ans+=ar[i].first;continue;}
        y=100*i;
        long long int v=g/y;
        if(g%y)v++;v=min(v,ar[i].first);
        ans+=v;
        break;
    }

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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d,g;
    cin>>d>>g;
    vector<pair<long long int,long long int> >ar(d+1);
    for(int i=1;i<=d;i++)
       {
           cin>>ar[i].first>>ar[i].second;
       }
    long long int y=0;long long int ans=0;
    for(int i=d;i;i--)
    {   if(g<=0)break;
        y=ar[i].first*100*i;y+=ar[i].second;
        if(y<=g){g-=y;ans+=ar[i].first;continue;}
        y=100*i;
        long long int v=g/y;
        if(g%y)v++;
v=min(v,ar[i].first);
        ans+=v;
        break;
    }

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

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

// #define DEBUG

int main(){
	int D, G;
	
	cin >> D >> G;
	vector<int> p(D);
	vector<int> c(D);
	
	vector<int> scores(D);
	
	for(int i=0; i < D; ++i){
		cin >> p[i] >> c[i];
		scores[i] = p[i] * ]100 * (i + 1) + c[i]; // sort prepare
	}
	
	int ans = 0;
	int nowG = 0;
	for(int i=D-1; i>=0; --i){
		int j;
		for( j=0; j < p[i]; ++j){
			nowG += 100 * (i+1);
			ans++;
			if(nowG >= G) break;
		}
		if( p[i] <= j ) nowG += c[i];
		if( nowG >= G) break;
	}
	
#ifdef DEBUG
	cerr << G << ", "<< nowG << endl;
#endif
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:36: error: expected primary-expression before ']' token
   20 |                 scores[i] = p[i] * ]100 * (i + 1) + c[i]; // sort prepare
      |                                    ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

// #define DEBUG

int main(){
	int D, G;
	
	cin >> D >> G;
	vector<int> p(D);
	vector<int> c(D);
	
	vector<int> scores(D);
	
	for(int i=0; i < D; ++i){
		cin >> p[i] >> c[i];
		scores[i] = p[i] * ]100 * (i + 1) + c[i]; // これでソートしてから選んだほうが良い(未
	}
	
	int ans = 0;
	int nowG = 0;
	for(int i=D-1; i>=0; --i){
		int j;
		for( j=0; j < p[i]; ++j){
			nowG += 100 * (i+1);
			ans++;
			if(nowG >= G) break;
		}
		if( p[i] <= j ) nowG += c[i];
		if( nowG >= G) break;
	}
	
#ifdef DEBUG
	cerr << G << ", "<< nowG << endl;
#endif
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:36: error: expected primary-expression before ']' token
   20 |                 scores[i] = p[i] * ]100 * (i + 1) + c[i]; // これでソートしてから選んだほうが良い(未
      |                                    ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int dlim = 11;
ll d, g;
int p[dlim], c[dlim];

int dfs(vector<int> v, int rest){
  if(v.size() == 0) return -INT_MAX;

  int res = INT_MAX;
  for(int i=0; i<v.size(); i++){
    vector<int> vv = v;
    vv.erase(vv.begin() + i);
    int rr = rest-v[i]*p[v[i]]-c[v[i]];
    if(rr > 0) res = min(res, dfs(vv, rr) + p[v[i]]);
    else res = min(res, min((int)ceil(rest*1.0/v[i]), p[v[i]]));  
  }

  return res;
}

int main(){
  cin >> d >> g;
  g = g / 100;

  for(int i=1; i<=d; i++) {
    cin >> p[i] >> c[i];
    c[i] = c[i] / 100;
  }

  vector<int> v;
  for(int i=1; i<=d; i++){
    v.push_back(i);
  }

  cout << dfs(v, g) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int dfs(std::vector<int>, int)':
a.cc:19:29: error: 'INT_MAX' was not declared in this scope
   19 |   if(v.size() == 0) return -INT_MAX;
      |                             ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <cmath>
  +++ |+#include <climits>
   11 | using namespace std;
a.cc:21:13: error: 'INT_MAX' was not declared in this scope
   21 |   int res = INT_MAX;
      |             ^~~~~~~
a.cc:21:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);vector<int> b(n);
  for(int i = 0; i < n; ++i)
    cin >> a[i] >> b[i];
  ll ans = 10000000000000000;
  for(int p = 0; p < 1<<n; ++p){
    ll kp = k;
    ll pr = 0;
    for(int i = 0; i < n; ++i)
      if(p & (1 << i)){
        kp -= ((100 * (p+1) * a[i]) + b[i]);
        pr += a[i];
      }
    for(int i = n-1; i != -1; --i){
      int num = min(a[i], max(0, (kp + 100 * (p+1) - 1) / (100 * (p+1)) ));
      pr += p;
      kp -= 100 * (p+1) * num;
    }
    ans = min(ans, pr);
  }
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: no matching function for call to 'max(int, ll)'
   20 |       int num = min(a[i], max(0, (kp + 100 * (p+1) - 1) / (100 * (p+1)) ));
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:20:30: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   20 |       int num = min(a[i], max(0, (kp + 100 * (p+1) - 1) / (100 * (p+1)) ));
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:20:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |       int num = min(a[i], max(0, (kp + 100 * (p+1) - 1) / (100 * (p+1)) ));
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);vector<int> b(n);
  for(int i = 0; i < n; ++i)
    cin >> a[i] >> b[i];
  ll ans = 10000000000000000:
  for(int p = 0; p < 1<<n; ++p){
    ll kp = k;
    ll pr = 0;
    for(int i = 0; i < n; ++i)
      if(p & (1 << i)){
        kp -= ((100 * (p+1) * a[i]) + b[i]);
        pr += a[i];
      }
    for(int i = n-1; i != -1; --i){
      int num = min(a[i], max(0, (kp + 100 * (p+1) - 1) / (100 * (p+1)) ));
      pr += p;
      kp -= 100 * (p+1) * num;
    }
    ans = min(ans, pr);
  }
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ',' or ';' before ':' token
   10 |   ll ans = 10000000000000000:
      |                             ^
a.cc:11:18: error: 'p' was not declared in this scope
   11 |   for(int p = 0; p < 1<<n; ++p){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef ll long long;
int main(){
  cin >> n >> k;
  vector<int> a(n);vector<int> b(n);
  for(int i = 0; i < n; ++i)
    cin >> a[i] >> b[i];
  ll ans = 10000000000000000:
  for(int p = 0; p < 1<<n; ++p){
    ll kp = k;
    ll pr = 0;
    for(int i = 0; i < n; ++i)
      if(p & (1 << i)){
        kp -= ((100 * (p+1) * a[i]) + b[i]);
        pr += a[i];
      }
    for(int i = n-1; i != -1; --i){
      int num = min(a[i], max(0, (kp + 100 * (p+1) - 1) / (100 * (p+1)) ));
      pr += p;
      kp -= 100 * (p+1) * num;
    }
    ans = min(ans, pr);
  }
  cout << ans << endl;
  
}

Compiler output:
a.cc:3:9: error: 'll' does not name a type
    3 | typedef ll long long;
      |         ^~
a.cc: In function 'int main()':
a.cc:5:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |   cin >> n >> k;
      |          ^
      |          yn
a.cc:5:15: error: 'k' was not declared in this scope
    5 |   cin >> n >> k;
      |               ^
a.cc:9:3: error: 'll' was not declared in this scope
    9 |   ll ans = 10000000000000000:
      |   ^~
a.cc:10:18: error: 'p' was not declared in this scope
   10 |   for(int p = 0; p < 1<<n; ++p){
      |                  ^
a.cc:25:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<cctype>
#include<cstdio>
#include<cstring>
#include<iostream>
#define N 15
#define int long long

int n,m,ans;
int used[N];
int p[N],c[N];

int getint(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch)) f|=ch=='-',ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}

void dfs(int now,int sum,int rem){
	if(rem+100*now*p[now]+c[now]>=m){
		int q=(m-rem)/p[now];
		if(q>p[now]) q=p[now];
		q=max(q,0);
		ans=std::min(ans,sum+q);
		return;
	}
	sum+=p[now];rem+=100*now*p[now]+c[now];
	for(int i=1;i<=n+1;i++){
		if(used[i]) continue;
		used[i]=1;
		dfs(i,sum,rem);
		used[i]=0;
	}
}

signed main(){
	n=getint(),m=getint();
	for(int i=1;i<=n;i++)
		p[i]=getint(),c[i]=getint();
	ans=1e9;
	dfs(1,0,0);
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int, long long int)':
a.cc:23:19: error: 'max' was not declared in this scope; did you mean 'std::max'?
   23 |                 q=max(q,0);
      |                   ^~~
      |                   std::max
In file included from /usr/include/c++/14/string:51,
                 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,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 3e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    vector< pair < int , int > > v;
    for(int i=0;i<n;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        v.push_back(make_pair(a,b));
    }
    int a[10];
    for(int i=0;i<10;i++)
        a[i]=i;
    int mn=1e9;
    do{
        int need=m;
        int S=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<v[a[i]].first;j++){
                if(need-(ll((a[i]+1)*100)*ll(v[a[i]].first))>0){
                    need-=(ll((a[i]+1)*100)*ll(v[a[i]].first);
                    S+=v[a[i]].first;
                    need-=v[a[i]].second;
                    break;
                }
                if(need>0){
                    need-=((a[i]+1)*100);
                    S++;
                }
                else{
                    break;
                }
                if(j==v[a[i]].first-1)
                    need-=(v[a[i]].second);
            }
            if(need<=0)
                break;
        }
        mn=min(mn,S);
    }
    while(next_permutation(a,a+n));
    cout<<mn<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:62: error: expected ')' before ';' token
   30 |                     need-=(ll((a[i]+1)*100)*ll(v[a[i]].first);
      |                           ~                                  ^
      |                                                              )
Language: Java

import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
	    FastScanner sc = new FastScanner(System.in);
	    PrintWriter pw = new PrintWriter(System.out);
	    long mod = (long)1e9 + 7;
		char[] s = sc.next().toCharArray();
		int n = s.length;
		long[][] dp = new long[n + 1][4];
		dp[0][3] = 1;
		for(int i = n; i >= 0; --i){
            for(int j = 3; j >= 0; --j){
                if(i == n){
                    dp[i][j] = (j == 3 ? 1 : 0);
                }else{
                    dp[i][j] = dp[i+1][j] * (s[i] == '?' ? 3L : 1L);
                    if(j < 3 && (s[i] == '?' || s[i] == "ABC".CharAt(j))){
                        dp[i][j] += dp[i+1][j+1];
                    }
                    dp[i][j] %= mod;
                }
            }
        }
        pw.println(dp[0][0]);
        pw.flush();
	}
}


class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Compiler output:
Main.java:19: error: cannot find symbol
                    if(j < 3 && (s[i] == '?' || s[i] == "ABC".CharAt(j))){
                                                             ^
  symbol:   method CharAt(int)
  location: class String
1 error
Language: C

// Created by SAMAN on ۷/۳۱/۲۰۲۰ م..
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops") 
#include <iostream>
#include <algorithm>
#include <map>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> 
#include <vector>
#include <set>
#include <fstream>
#include <cstdlib>
#include <iterator>
#include <cmath>
#include <ctime>
#include <iomanip>
//#warning not there YET
//#error hello
#define lint long long int
#define endl '\n'
#define kill(x) return cout<<x<<'\n', 0;
#define debug(x) cout << #x << " : " << x << '\n'
#define pb push_back
#define ppb pop_back
#define f first
#define se second
#define _ri [i<<1|1]
#define _le [i<<1]  
//# define h m();
typedef long long  ll;
typedef long double ld;

using namespace std;

string s;
ll a,ab,abc,t;
const int mod = 1e9 + 7;
int m(){
	a %= mod;
	ab %= mod;
	abc %= mod;
	t %= mod;
}
int main(){
	//freopen("kn.txt","r",stdin);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	cin >> s;
	int n = s.size();
	t = 1;
	for(int i = 0;i < n;i++){
		if(s[i] == 'A' )
			a += t;
		else if(s[i] == 'B' )
			ab += a;
		else if(s[i] == 'C')
			abc += ab;
		if(s[i] == '?'){
			abc *= 3;
			abc += ab;
			ab *= 3;
			ab += a;
			a *= 3;
			a += t;
			t  *= 3;
		}
		m();
	}
	cout<<abc;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 100100;
LL mod = 1e9 + 7;
char s[maxn];
LL f[maxn][3];
int n;

LL (LL x, LL n) {
  LL ret = 1;
  while(n) {
    if(n & 1) {
      ret *= x; ret %= mod;
    }
    n >>= 1;
    x *= x; x %= mod;
  }
  return ret;
}

signed main() {
  
  while(~scanf("%s", s+1)) {
    memset(f, 0, sizeof(f));
    n = strlen(s+1);
    for(int i = 1; i <= n; i++) {
      f[i][0] = f[i-1][0] + (s[i] == 'A');
      f[i][1] = f[i-1][1] + (s[i] == 'C');
      f[i][2] = f[i-1][2] + (s[i] == '?');
    }
    LL ret = 0;
    for(int i = 1; i <= n; i++) {
      if(s[i] == 'B' || s[i] == '?') {
        LL q = f[n][2] - (s[i] == '?');
        ret += mul(3LL, q) * (f[i-1][0] * (f[n][1] - f[i][1]) % mod);
        ret %= mod;
        if(q >= 1) {
          ret += mul(3LL, q-1) * (f[i-1][0] * (f[n][2] - f[i][2]) % mod);
          ret %= mod;
          ret += mul(3LL, q-1) * (f[i-1][2] * (f[n][1] - f[i][1]) % mod);
          ret %= mod;
        }
        if(q >= 2) {
          ret += mul(3LL, q-2) * (f[i-1][2] * (f[n][2] - f[i][2]) % mod);
          ret %= mod;
        }
      }
    }
    printf("%lldn", ret);
  }
  return 0;
}

Compiler output:
a.cc:10:7: error: expected ')' before 'x'
   10 | LL (LL x, LL n) {
      |    ~  ^~
      |       )
a.cc: In function 'int main()':
a.cc:36:16: error: 'mul' was not declared in this scope; did you mean 'fmul'?
   36 |         ret += mul(3LL, q) * (f[i-1][0] * (f[n][1] - f[i][1]) % mod);
      |                ^~~
      |                fmul
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int maxn = 100100;
LL mod = 1e9 + 7;
char s[maxn];
LL f[maxn][3];
int n;

LL (LL x, LL n) {
  LL ret = 1;
  while(n) {
    if(n & 1) {
      ret *= x; ret %= mod;
    }
    n >>= 1;
    x *= x; x %= mod;
  }
  return ret;
}

signed main() {
  
  while(~scanf("%s", s+1)) {
    memset(f, 0, sizeof(f));
    n = strlen(s+1);
    for(int i = 1; i <= n; i++) {
      f[i][0] = f[i-1][0] + (s[i] == 'A');
      f[i][1] = f[i-1][1] + (s[i] == 'C');
      f[i][2] = f[i-1][2] + (s[i] == '?');
    }
    LL ret = 0;
    for(int i = 1; i <= n; i++) {
      if(s[i] == 'B' || s[i] == '?') {
        LL q = f[n][2] - (s[i] == '?');
        ret += mul(3LL, q) * (f[i-1][0] * (f[n][1] - f[i][1]) % mod);
        ret %= mod;
        if(q >= 1) {
          ret += mul(3LL, q-1) * (f[i-1][0] * (f[n][2] - f[i][2]) % mod);
          ret %= mod;
          ret += mul(3LL, q-1) * (f[i-1][2] * (f[n][1] - f[i][1]) % mod);
          ret %= mod;
        }
        if(q >= 2) {
          ret += mul(3LL, q-2) * (f[i-1][2] * (f[n][2] - f[i][2]) % mod);
          ret %= mod;
        }
      }
    }
    printf("%lldn", ret);
  }
  return 0;
}

Compiler output:
a.cc:3:12: error: expected unqualified-id before 'long'
    3 | #define LL long long
      |            ^~~~
a.cc:10:5: note: in expansion of macro 'LL'
   10 | LL (LL x, LL n) {
      |     ^~
a.cc:10:5: error: expected ')' before 'long'
   10 | LL (LL x, LL n) {
      |    ~^
      |     )
a.cc: In function 'int main()':
a.cc:36:16: error: 'mul' was not declared in this scope; did you mean 'fmul'?
   36 |         ret += mul(3LL, q) * (f[i-1][0] * (f[n][1] - f[i][1]) % mod);
      |                ^~~
      |                fmul
Language: C++

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int maxn = 100100;
LL mod = 1e9 + 7;
char s[maxn];
LL f[maxn][3];
int n;

LL (LL x, LL n) {
  LL ret = 1;
  while(n) {
    if(n & 1) {
      ret *= x; ret %= mod;
    }
    n >>= 1;
    x *= x; x %= mod;
  }
  return ret;
}

signed main() {
  
  while(~scanf("%s", s+1)) {
    memset(f, 0, sizeof(f));
    n = strlen(s+1);
    for(int i = 1; i <= n; i++) {
      f[i][0] = f[i-1][0] + (s[i] == 'A');
      f[i][1] = f[i-1][1] + (s[i] == 'C');
      f[i][2] = f[i-1][2] + (s[i] == '?');
    }
    LL ret = 0;
    for(int i = 1; i <= n; i++) {
      if(s[i] == 'B' || s[i] == '?') {
        LL q = f[n][2] - (s[i] == '?');
        ret += mul(3LL, q) * (f[i-1][0] * (f[n][1] - f[i][1]) % mod);
        ret %= mod;
        if(q >= 1) {
          ret += mul(3LL, q-1) * (f[i-1][0] * (f[n][2] - f[i][2]) % mod);
          ret %= mod;
          ret += mul(3LL, q-1) * (f[i-1][2] * (f[n][1] - f[i][1]) % mod);
          ret %= mod;
        }
        if(q >= 2) {
          ret += mul(3LL, q-2) * (f[i-1][2] * (f[n][2] - f[i][2]) % mod);
          ret %= mod;
        }
      }
    }
    printf("%lldn", ret);
  }
  return 0;
}

Compiler output:
a.cc:10:7: error: expected ')' before 'x'
   10 | LL (LL x, LL n) {
      |    ~  ^~
      |       )
a.cc: In function 'int main()':
a.cc:36:16: error: 'mul' was not declared in this scope; did you mean 'fmul'?
   36 |         ret += mul(3LL, q) * (f[i-1][0] * (f[n][1] - f[i][1]) % mod);
      |                ^~~
      |                fmul
Language: C++

s=input()
mod=10**9+7
a=0
ab=0
abc=0
q=1
for i in s:
    if i=="?":
        abc*=3
        abc+=ab
        ab*=3
        ab+=a
        a*=3
        a+=q
        q*=3
        q%=mod
    elif i=="A":
        a+=q
    elif i=="B":
        ab+=a
    else:
        abc+=ab
    abc%=mod
    ab%=mod
    a%=mod
print(abc)

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

#include<iostream>
#include<string>

using namespace std;

long long MOD = 1000000007;

long long we_love_abc(string s) {
  long long dp[100001][4];
  memset(dp, 0, sizeof(dp));

  for(int i=0;i<4;i++) {
    dp[0][i] = 0;
  }

  if(s[0] == 'A') {
    dp[0][0] = 1;
    dp[0][1] = 1;
  } else if(s[0] == '?') {
    dp[0][0] = 3;
    dp[0][1] = 1;
  }
  for(int i=1;i<s.size();i++) {
    // j==0 && s[i] == 'a';
    if(s[i] == 'A') {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = (dp[i-1][0] + dp[i-1][1]) % MOD;
      dp[i][2] = dp[i-1][2];
      dp[i][3] = dp[i-1][3];
      continue;
    }
    if(s[i] == 'B') {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = dp[i-1][1];
      dp[i][2] = (dp[i-1][2] + dp[i-1][1]) % MOD;
      dp[i][3] = dp[i-1][3];
      continue;
    }
    if(s[i] == 'C') {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = dp[i-1][1];
      dp[i][2] = dp[i-1][2];
      dp[i][3] = (dp[i-1][3] + dp[i-1][2]) % MOD;
      continue;
    }
    // s[i] == '?'
    for(int j= 0;j<4;j++) {
      dp[i][j] = (dp[i-1][j]*3) % MOD;
    }
    dp[i][1] = (dp[i][1] + dp[i-1][0]) % MOD;
    dp[i][2] = (dp[i][2] + dp[i-1][1]) % MOD;
    dp[i][3] = (dp[i][3] + dp[i-1][2]) % MOD;
  }
  return dp[s.size()-1][3];
}


int main() {
  string s;
  cin >> s;
  cout << we_love_abc(s);
}

Compiler output:
a.cc: In function 'long long int we_love_abc(std::string)':
a.cc:10:3: error: 'memset' was not declared in this scope
   10 |   memset(dp, 0, sizeof(dp));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

MOD = 1e9 + 7
p3 = [1]

S = input()
n = len(S)

a = []
c = []
q = []
for i in range(n):
  p3.append(int(p3[i] * 3))
  if S[i] == 'A':
    a.append(1)
  else:
    a.append(0)
  if S[i] == 'C':
    c.append(1)
  else:
    c.append(0)
  if S[i] == '?':
    q.append(1)
  else:
    q.append(0)

for i in range(1, n):
  a[i] += a[i - 1]
  c[i] += c[i - 1]
  q[i] += q[i - 1]

count = 0
for i in range(1, n - 1):
  if S[i] == 'B' or S[i] == '?':
    bq = 0 if S[i] == 'B' else 1
    count += a[i - 1] * (c[n - 1] - c[i]) * p3[q[n - 1] - bq]
    count %= MOD
    count += q[i - 1] * (c[n - 1] - c[i]) * p3[q[n - 1] - 1 - bq]
    count %= MOD
    count += a[i - 1] * (q[n - 1] - q[i]) * p3[q[n - 1] - 1 - bq]
    count %= MOD
    count += q[i - 1] * (q[n - 1] - q[i]) * p3[q[n - 1] - 2 - bq]
    count %= MOD
    

print(int(count))

Compiler output:
a.cc:1:1: error: 'MOD' does not name a type
    1 | MOD = 1e9 + 7
      | ^~~
Language: C++

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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

int main() {
   ll i,j,k,;
   ll a,ab,abc,num;
    string s;
    cin >> s;


    while(s[num]!=0)
    {
        if(s[num]=='A')
        {
            a+=1;
            a%=1000000007;
        }else if(s[num]=='B')
        {
            ab+=a;
            ab%=1000000007;
        }else if(s[num]=='C')
        {
            abc+=ab;
            abc%=1000000007;
        }else
        {
            abc+=ab;
            ab+=a;
            a+=1;
            a%=1000000007;
            ab%=1000000007;
            abc%=1000000007;
        }
    }

  cout << abc%1000000007 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected unqualified-id before ';' token
   14 |    ll i,j,k,;
      |             ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
ll mod = 1000000007;
P p[200005];

ll i, b[1005], c, k, j, n, m, z = 0, mi = 0, t,cc,th;
ll a;
vector<ll> va,vb,vc,vj;
string s;
char ca[10000];
priority_queue<ll> q;
int main() {
	cin >>s;
	rep(i, s.size()) {
		if (s[i] == 'A')va.push_back(i);
		if (s[i] == 'B')vb.push_back(i);
		if (s[i] == 'C')vc.push_back(i);
		if (s[i] == '?') {
			vj.push_back(i);
		}
	}
	cout << va.size() << "\n" << vb.size() << "\n" << vc.size();
	n = vj.size();
	th = 1;
	rep(i, n - 3)th = (th*3)%mod;
	if(n>=3)z += (n) * (n - 1) * (n - 2)*th/ 6;
	z = z % mod;
	
	a = 0; c = 0;
	th = (th * 3) % mod;
	if(n>=2)z+=(s.size()-

	k = vb[0];
	while (va[a] < k&&a<va.size())a++;
	while (vc[c] < k&&c<vc.size())c++;
	cc = vc.size() - c-1;
	z += a * cc;
	for (i = 1; i < vb.size();i++) {
		k = vb[i];
		while (va[a] < k&& a < va.size())a++;
		while (vc[c] < k&& c < vc.size()) {
			cc--; c++;
		}
		z = (z + a * cc) % mod;
	}

	cout << z;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:29: error: lvalue required as left operand of assignment
   46 |         if(n>=2)z+=(s.size()-
      |                     ~~~~~~~~^
   47 | 
      |                              
   48 |         k = vb[0];
      |         ~                    
a.cc:48:18: error: expected ')' before ';' token
   48 |         k = vb[0];
      |                  ^
      |                  )
a.cc:46:20: note: to match this '('
   46 |         if(n>=2)z+=(s.size()-
      |                    ^
Language: C++

MOD = 10**9 + 7
S = input()
d = "ABC".index
s = [0]*4
s[0] = 1
for c in S:
    if c == "?":
        s = [s[0]*3, s[1]*3 + s[0], s[2]*3 + s[1], s[3]*3 + s[2]]
        for i in range(4):s[i] %= MOD
    else:
        i = d(c)
        s[i+1] += s[i] % MOD
print(s[3] % MOD)


Compiler output:
a.cc:1:1: error: 'MOD' does not name a type
    1 | MOD = 10**9 + 7
      | ^~~
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

ll dp[100002][4];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;
    cin >> S;
    
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    
    REP(i, S.size()){
        REP(j, 4){
            if(S[i] != '?'){
                dp[i+1][j] += dp[i][j]; dp[i+1][j] %= MOD;
            }
            else{
                dp[i+1][j] += dp[i][j] * 3 % MOD;
            }
        }
        if(S[i] == 'A' || S[i] == '?'){ dp[i+1][1] += dp[i][0]; dp[i+1][1] %= MOD;};
        if(S[i] == 'B' || S[i] == '?'){ dp[i+1][2] += dp[i][1]; dp[i+1][2] %= MOD;};
        if(S[i] == 'C' || S[i] == '?'){ dp[i+1][3] += dp[i][2]; dp[i+1][3] %= MOD;};
    }
    cout << dp[S.size()][3] << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'memset' was not declared in this scope
   32 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 |
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

ll dp[200001][5];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;
    cin >> S;
    
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    
    REP(i, S.size()){
        REP(j, 5){
            if(S[i] != '?'){
                dp[i+1][j] += dp[i][j]; dp[i+1][j] %= MOD;
            }
            else{
                dp[i+1][j] += dp[i][j] * 3 % MOD;
            }
        }
        if(S[i] == 'A' || S[i] == '?'){ dp[i+1][1] += dp[i][0]; dp[i+1][1] %= MOD;};
        if(S[i] == 'B' || S[i] == '?'){ dp[i+1][2] += dp[i][1]; dp[i+1][2] %= MOD;};
        if(S[i] == 'C' || S[i] == '?'){ dp[i+1][3] += dp[i][2]; dp[i+1][3] %= MOD;};
    }
    cout << dp[S.size()][3] << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'memset' was not declared in this scope
   32 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 |
Language: C++

#include <iostream>
#include <string>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <set>
#include <climits>
#include <map>

using namespace std;

long long dp[100000][3];
const long long MOD = 1000000007;

int main(){
  string S;
  cin >> S;
  int N = S.size();

  if(S[0] == 'A' || S[0] == '?'){
    dp[0][0] = 1;
  }

  long long case_num = 1;
  for(int i = 0; i < N; i++){
    if(S[i] != '?'){
      for(int j = 0; j < 3; j++){
        dp[i][j] = dp[i - 1][j];
      }
      if(S[i] == 'A'){
        dp[i][0] = (dp[i][0] + case_num) % MOD;
      }
      if(S[i] == 'B'){
        dp[i][1] = (dp[i][1] + dp[i - 1][0]) % MOD;
      }
      if(S[i] == 'C'){
        dp[i][2] = (dp[i][2] + dp[i - 1][1]) % MOD;
      }
    } else {
      dp[i][0] = (dp[i - 1][0] * (long long) 3 + case_num) % MOD;
      dp[i][1] = (dp[i - 1][1] * (long long) 3 + dp[i - 1][0]) % MOD;
      dp[i][2] = (dp[i - 1][2] * (long long ) 3 + dp[i - 1][1]) % MOD;

      case_num = (case_num * 3) % MOD;
    }
  }

  cout << dp[N - 1][2] << endl;
  /*
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < N; j++){
      cout << dp[j][i] << " ";
    }
    cout << endl;
  }
  */
  return 0;
}2218757145606
2291979612924

Compiler output:
a.cc:59:2: error: expected unqualified-id before numeric constant
   59 | }2218757145606
      |  ^~~~~~~~~~~~~
Language: C++

#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

MOD = 10**9+7

def main():
    s = input()
    dp = [[0 for _ in range(4)] for _ in range(len(s)+1)]
    dp[0][0] = 1
    for i, c in enumerate(s):
        for j in range(4):
            dp[i+1][j] = dp[i][j] % MOD
        if c == 'A' or c == '?':
            dp[i+1][1] += dp[i][0]
        if c == 'B' or c == '?':
            dp[i+1][2] += dp[i][1]
        if c == 'C' or c == '?':
            dp[i+1][3] += dp[i][2]
        if c == '?':
            for j in range(4):
                dp[i+1][j] += 2*dp[i][j]

    print(dp[len(s)][3]%MOD)


if __name__ == '__main__':
    main()


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python
      |  ^
a.cc:2:3: error: invalid preprocessing directive #coding
    2 | # coding: utf-8
      |   ^~~~~~
a.cc:35:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   35 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:4:1: error: 'def' does not name a type
    4 | def ri():
      | ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
#include <utility>


long long modpow(long long x, long long y, long long m)
{
  long long res = 1;
  for(long long i = 0; i < y; ++i)
  {
    res *= x % m;
  }
  
  return res;
}

int main()
{
  std::string s;  
  std::cin >> s;
   
  long long m = 1000000007;
  long long minv27 = 370370373;
 
  size_t n = s.size();
  long long factor[n];
  
  long long f = 0;
  size_t q = 0;
  for(int i = 0; i < n; ++i)
  {
    factor[i] = f;
    switch(s[i])
    {
      case 'A':
        {
          f += 3;
          break;
        }
      case '?':
        {
          f += 1;
          ++q;
          break;
        }
    }
  }
  
  f = 0;
  for(int i = n - 1; i >= 0; --i)
  {
    factor[i] *= f;
    switch(s[i])
    {
      case 'C':
        {
          f += 3;
          break;
        }
      case '?':
        {
          f += 1;
          break;
        }
    }
  }
  
  long long total = 0;
  for(int i = 0; i < n; ++i)
  {
    switch(s[i])
    {
      case 'B':
        {
          total += (3 * factor[i]) % m;
          break;
        }
      case '?':
        {
          total += (1 * factor[i]) % m;
          break;
        }
    }
  }
  
  total *= modpow(3,q) * minv27 % m;
  
  std::cout << total;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:18: error: too few arguments to function 'long long int modpow(long long int, long long int, long long int)'
   88 |   total *= modpow(3,q) * minv27 % m;
      |            ~~~~~~^~~~~
a.cc:8:11: note: declared here
    8 | long long modpow(long long x, long long y, long long m)
      |           ^~~~~~
Language: C

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define m_t make_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (signed)(a.size())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define callp(a) for(auto [k,v]:a)cout<<k<<":"<<v<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define ENDL cout<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define PQ priority_queue
#define cont const auto
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
typedef struct{ll to;ll cost;} Graphs;
typedef V<V<Graphs>> AdjList;
const signed INF = (1LL<<30);
const long long MOD = (1e9+7);
const long long LINF = (1LL<<60);
const long long LMAX = LLONG_MAX;
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  str s;
  cin>>s;

  ll n = SZ(s);
  VV(ll,dp,n+10,4,0);
  dp[0][0]=1;
  rep(i,n){
    rep(j,4){
      (dp[i+1][j]+=dp[i][j])%=MOD;
      if(s[i]=='?')(dp[i+1][j]*=3)%=MOD;
    }
    if(s[i]=='A'||s[i]=='?')(dp[i+1][1]+=dp[i][0])%=MOD;
    if(s[i]=='B'||s[i]=='?')(dp[i+1][2]+=dp[i][1])%=MOD;
    if(s[i]=='C'||s[i]=='?')(dp[i+1][3]+=dp[i][2])%=MOD;
  }
  out(dp[n][3]);
  
  
  return 0;
}

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

#include <iostream>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IFOR(v,it) for(string::iterator it=(v).begin();it!=(v).end();++it)

#define MOD 1000000007

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

  LL A = 0;
  LL AB = 0;
  LL ABC = 0;
  LL q = 1;

  IFOR(S, it) {
    if (*it == 'C')
      ABC = (ABC + AB) % MOD;
    else if (*it == 'B')
      AB = (AB + A) % MOD;
    else if (*it == 'A')
      ++A;
    else {
      ABC = (3 * ABC % MOD + AB) % MOD;
      AB = (3 * AB % MOD + A) % MOD;
      A = (3 * A % MOD + q) % MOD;
      q = (q * 3) % MOD;
    }
  }
  cout << ABC % MOD << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'LL' was not declared in this scope
   15 |   LL A = 0;
      |   ^~
a.cc:16:5: error: expected ';' before 'AB'
   16 |   LL AB = 0;
      |     ^~~
      |     ;
a.cc:17:5: error: expected ';' before 'ABC'
   17 |   LL ABC = 0;
      |     ^~~~
      |     ;
a.cc:18:5: error: expected ';' before 'q'
   18 |   LL q = 1;
      |     ^~
      |     ;
a.cc:22:7: error: 'ABC' was not declared in this scope
   22 |       ABC = (ABC + AB) % MOD;
      |       ^~~
a.cc:22:20: error: 'AB' was not declared in this scope
   22 |       ABC = (ABC + AB) % MOD;
      |                    ^~
a.cc:24:7: error: 'AB' was not declared in this scope
   24 |       AB = (AB + A) % MOD;
      |       ^~
a.cc:24:18: error: 'A' was not declared in this scope
   24 |       AB = (AB + A) % MOD;
      |                  ^
a.cc:26:9: error: 'A' was not declared in this scope
   26 |       ++A;
      |         ^
a.cc:28:7: error: 'ABC' was not declared in this scope
   28 |       ABC = (3 * ABC % MOD + AB) % MOD;
      |       ^~~
a.cc:28:30: error: 'AB' was not declared in this scope
   28 |       ABC = (3 * ABC % MOD + AB) % MOD;
      |                              ^~
a.cc:29:28: error: 'A' was not declared in this scope
   29 |       AB = (3 * AB % MOD + A) % MOD;
      |                            ^
a.cc:30:26: error: 'q' was not declared in this scope
   30 |       A = (3 * A % MOD + q) % MOD;
      |                          ^
a.cc:34:11: error: 'ABC' was not declared in this scope
   34 |   cout << ABC % MOD << endl;
      |           ^~~
Language: C++

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

int main() {
    string s;
    cin >> s;
    long dp[100001][4] = {{1}}, n = s.size();
    for(int i = 0; i < n; i++){
        dp[i + 1] = dp[i];
        if(s[i] == 'A') dp[i + 1][1] = (dp[i][1] + dp[i][0]) % MOD;
        if(s[i] == 'B') dp[i + 1][2] = (dp[i][2] + dp[i][1]) % MOD;
        if(s[i] == 'C') dp[i + 1][3] = (dp[i][3] + dp[i][2]) % MOD;
        if(s[i] == '?'){
            dp[i + 1][0] = dp[i][0] * 3 % MOD;
            dp[i + 1][1] = (dp[i][1] * 3 + dp[i][0]) % MOD;
            dp[i + 1][2] = (dp[i][2] * 3 + dp[i][1]) % MOD;
            dp[i + 1][3] = (dp[i][3] * 3 + dp[i][2]) % MOD;
        }
    }
    cout << dp[n][3] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: invalid array assignment
   10 |         dp[i + 1] = dp[i];
      |         ~~~~~~~~~~^~~~~~~
Language: C++

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

int main() {
    string s;
    cin >> s;
    long dp[100001][4] = {{1}}, n = s.size();
    for(int i = 0; i < n, i++){
        dp[i + 1] = dp[i];
        if(s[i] == 'A') dp[i + 1][1] = (dp[i][1] + dp[i][0]) % MOD;
        if(s[i] == 'B') dp[i + 1][2] = (dp[i][2] + dp[i][1]) % MOD;
        if(s[i] == 'C') dp[i + 1][3] = (dp[i][3] + dp[i][2]) % MOD;
        if(s[i] == '?'){
            dp[i + 1][0] = dp[i][0] * 3 % MOD;
            dp[i + 1][1] = (dp[i][1] * 3 + dp[i][0]) % MOD;
            dp[i + 1][2] = (dp[i][2] * 3 + dp[i][1]) % MOD;
            dp[i + 1][3] = (dp[i][3] * 3 + dp[i][2]) % MOD;
        }
    }
    cout << dp[n][3] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:30: error: expected ';' before ')' token
    9 |     for(int i = 0; i < n, i++){
      |                              ^
      |                              ;
a.cc:10:19: error: invalid array assignment
   10 |         dp[i + 1] = dp[i];
      |         ~~~~~~~~~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
int mod=1e9+7;
const int maxv=1e5+10;

int dp[maxv][4];

signed main(){
	string s;cin>>s;
	dp[0][0]=1;
	int n=s.size();
	string abc="abc";
	rep(i,n){
	rep(j,4){
		char c=s[i];
		rep(k,3){
			if(c==abc[k]){
				(dp[i+1][j]+=dp[i][j])%=mod;
				if(j==k)(dp[i+1][j+1]+=dp[i][j])%=mod;
			}
		if(c=='?'){(dp[i+1][j]+=3*dp[i][j])%=mod;
				  if(j<4) (dp[i+1][j+1]+=3*dp[i][j])%=mod;
				}
		}
		
	}}
	cout<<dp[n][4]<<endl;
}




Compiler output:
a.cc:3:1: error: 'define' does not name a type
    3 | define int long long
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:21:57: error: 'mod' was not declared in this scope; did you mean 'modf'?
   21 |                                 (dp[i+1][j]+=dp[i][j])%=mod;
      |                                                         ^~~
      |                                                         modf
a.cc:24:54: error: 'mod' was not declared in this scope; did you mean 'modf'?
   24 |                 if(c=='?'){(dp[i+1][j]+=3*dp[i][j])%=mod;
      |                                                      ^~~
      |                                                      modf
Language: C++

#include<bits/stdc++.h>
using namespace std;
define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
int mod=1e9+7;
int maxv=1e5+10;

int dp[maxv][4];

signed main(){
	string s;cin>>s;
	dp[0][0]=1;
	int n=s.size();
	string abc="abc";
	rep(i,n){
	rep(j,4){
		char c=s[i];
		rep(k,3){
			if(c==abc[k]){
				(dp[i+1][j]+=dp[i][j])%=mod;
				if(j==k)(dp[i+1][j+1]+=dp[i][j])%=mod;
			}
		if(c=='?'){(dp[i+1][j]+=3*dp[i][j])%=mod;
				  if(j<4) (dp[i+1][j+1]+=3*dp[i][j])%=mod;
				}
		}
		
	}}
	cout<<dp[n][4]<<endl;
}




Compiler output:
a.cc:3:1: error: 'define' does not name a type
    3 | define int long long
      | ^~~~~~
a.cc:9:8: error: size of array 'dp' is not an integral constant-expression
    9 | int dp[maxv][4];
      |        ^~~~
a.cc: In function 'int main()':
a.cc:21:57: error: 'mod' was not declared in this scope; did you mean 'modf'?
   21 |                                 (dp[i+1][j]+=dp[i][j])%=mod;
      |                                                         ^~~
      |                                                         modf
a.cc:24:54: error: 'mod' was not declared in this scope; did you mean 'modf'?
   24 |                 if(c=='?'){(dp[i+1][j]+=3*dp[i][j])%=mod;
      |                                                      ^~~
      |                                                      modf