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

#include <iostream>

using namespace std;

long check(int* rd[], int f, int t, int n)
{
  if (rd[f][t] == 1)
    return 0;
  
  rd[f][t] = 1;
  rd[t][f] = 1;
  
  for (int i=1; i<=n; i++)
  {
    if (rd[i][f] == 1)
      rd[i][t] = 1;
    else if (rd[i][t] == 1)
      rd[i][f] = 1;
  }
  return 1;
}

long chk2(int* rd[], int j, unsigned long cnt, int n, int* ys)
{
  for (int i=j+1; i<=n; i++)
  {
    if (ys[i] == -1)
    {
      int ys2[5001], rd2[5001][5001];
      for (int k=1; k<=n; k++)
      {
        ys2[k] = ys[k];
        for (int l=1; l<=n; l++)
          rd2[k][l] = rd[k][l];
      }
      
      for (int k=1; k<=n; k++)
      {
        if (i == k)
          continue;
        
        ys2[i] = k;
        cnt += check(rd2, i, k, n);
        cnt += chk2(rd2, i, cnt, n, ys2);
      	cnt = cnt % 1000000007;
      }
    }
    
    return cnt;
  }

  return cnt;
}

int main()
{
  int n, ys[5001], rd[5001][5001];
  unsigned long cnt1 = 0;
  cin >> n;
  for (int i=1; i<=n; i++)
  {
    cin >> ys[i];
    if (ys[i] != -1)
    {
      cnt += check(rd, i, ys[i]);
      cnt = cnt % 1000000007;
    }
  }
  
  cout << chk2(rd, 0, cnt, n, ys);
  return 0;
}

Compiler output:
a.cc: In function 'long int chk2(int**, int, long unsigned int, int, int*)':
a.cc:43:22: error: cannot convert 'int (*)[5001]' to 'int**'
   43 |         cnt += check(rd2, i, k, n);
      |                      ^~~
      |                      |
      |                      int (*)[5001]
a.cc:5:17: note:   initializing argument 1 of 'long int check(int**, int, int, int)'
    5 | long check(int* rd[], int f, int t, int n)
      |            ~~~~~^~~~
a.cc:44:21: error: cannot convert 'int (*)[5001]' to 'int**'
   44 |         cnt += chk2(rd2, i, cnt, n, ys2);
      |                     ^~~
      |                     |
      |                     int (*)[5001]
a.cc:23:16: note:   initializing argument 1 of 'long int chk2(int**, int, long unsigned int, int, int*)'
   23 | long chk2(int* rd[], int j, unsigned long cnt, int n, int* ys)
      |           ~~~~~^~~~
a.cc: In function 'int main()':
a.cc:65:7: error: 'cnt' was not declared in this scope; did you mean 'cnt1'?
   65 |       cnt += check(rd, i, ys[i]);
      |       ^~~
      |       cnt1
a.cc:65:20: error: cannot convert 'int (*)[5001]' to 'int**'
   65 |       cnt += check(rd, i, ys[i]);
      |                    ^~
      |                    |
      |                    int (*)[5001]
a.cc:5:17: note:   initializing argument 1 of 'long int check(int**, int, int, int)'
    5 | long check(int* rd[], int f, int t, int n)
      |            ~~~~~^~~~
a.cc:70:23: error: 'cnt' was not declared in this scope; did you mean 'cnt1'?
   70 |   cout << chk2(rd, 0, cnt, n, ys);
      |                       ^~~
      |                       cnt1
Language: C++

#include <iostream>

using namespace std;

long check(int rd[][], int f, int t, int n)
{
  if (rd[f][t] == 1)
    return 0;
  
  rd[f][t] = 1;
  rd[t][f] = 1;
  
  for (int i=1; i<=n; i++)
  {
    if (rd[i][f] == 1)
      rd[i][t] = 1;
    else if (rd[i][t] == 1)
      rd[i][f] = 1;
  }
  return 1;
}

long chk2(int rd[][], int j, unsigned long cnt, int n, int* ys)
{
  for (int i=j+1; i<=n; i++)
  {
    if (ys[i] == -1)
    {
      int ys2[5001], rd2[5001][5001];
      for (int k=1; k<=n; k++)
      {
        ys2[k] = ys[k];
        for (int l=1; l<=n; l++)
          rd2[k][l] = rd[k][l];
      }
      
      for (int k=1; k<=n; k++)
      {
        if (i == k)
          continue;
        
        ys2[i] = k;
        cnt += check(rd2, i, k, n);
        cnt += chk2(rd2, i, cnt, n, ys2);
      	cnt = cnt % 1000000007;
      }
    }
    
    return cnt;
  }

  return cnt;
}

int main()
{
  int n, ys[5001], rd[5001][5001];
  unsigned long cnt1 = 0;
  cin >> n;
  for (int i=1; i<=n; i++)
  {
    cin >> ys[i];
    if (ys[i] != -1)
    {
      cnt += check(rd, i, ys[i]);
      cnt = cnt % 1000000007;
    }
  }
  
  cout << chk2(rd, 0, cnt, n, ys);
  return 0;
}

Compiler output:
a.cc:5:16: error: declaration of 'rd' as multidimensional array must have bounds for all dimensions except the first
    5 | long check(int rd[][], int f, int t, int n)
      |                ^~
a.cc:5:22: error: expected ')' before ',' token
    5 | long check(int rd[][], int f, int t, int n)
      |           ~          ^
      |                      )
a.cc:5:24: error: expected unqualified-id before 'int'
    5 | long check(int rd[][], int f, int t, int n)
      |                        ^~~
a.cc:23:15: error: declaration of 'rd' as multidimensional array must have bounds for all dimensions except the first
   23 | long chk2(int rd[][], int j, unsigned long cnt, int n, int* ys)
      |               ^~
a.cc:23:21: error: expected ')' before ',' token
   23 | long chk2(int rd[][], int j, unsigned long cnt, int n, int* ys)
      |          ~          ^
      |                     )
a.cc:23:23: error: expected unqualified-id before 'int'
   23 | long chk2(int rd[][], int j, unsigned long cnt, int n, int* ys)
      |                       ^~~
a.cc: In function 'int main()':
a.cc:65:7: error: 'cnt' was not declared in this scope; did you mean 'cnt1'?
   65 |       cnt += check(rd, i, ys[i]);
      |       ^~~
      |       cnt1
a.cc:70:23: error: 'cnt' was not declared in this scope; did you mean 'cnt1'?
   70 |   cout << chk2(rd, 0, cnt, n, ys);
      |                       ^~~
      |                       cnt1
Language: C++

#include <iostream>

using namespace std;

long check(int** rd, int f, int t, int n)
{
  if (rd[f][t] == 1)
    return 0;
  
  rd[f][t] = 1;
  rd[t][f] = 1;
  
  for (int i=1; i<=n; i++)
  {
    if (rd[i][f] == 1)
      rd[i][t] = 1;
    else if (rd[i][t] == 1)
      rd[i][f] = 1;
  }
  return 1;
}

long chk2(int** rd, int j, unsigned long cnt, int n, int* ys)
{
  for (int i=j+1; i<=n; i++)
  {
    if (ys[i] == -1)
    {
      int ys2[5001], rd2[5001][5001];
      for (int k=1; k<=n; k++)
      {
        ys2[k] = ys[k];
        for (int l=1; l<=n; l++)
          rd2[k][l] = rd[k][l];
      }
      
      for (int k=1; k<=n; k++)
      {
        if (i == k)
          continue;
        
        ys2[i] = k;
        cnt += check(rd2, i, k, n);
        cnt += chk2(rd2, i, cnt, n, ys2);
      	cnt = cnt % 1000000007;
      }
    }
    
    return cnt;
  }

  return cnt;
}

int main()
{
  int n, ys[5001], rd[5001][5001];
  unsigned long cnt1 = 0;
  cin >> n;
  for (int i=1; i<=n; i++)
  {
    cin >> ys[i];
    if (ys[i] != -1)
    {
      cnt += check(rd, i, ys[i]);
      cnt = cnt % 1000000007;
    }
  }
  
  cout << chk2(rd, 0, cnt, n, ys);
  return 0;
}

Compiler output:
a.cc: In function 'long int chk2(int**, int, long unsigned int, int, int*)':
a.cc:43:22: error: cannot convert 'int (*)[5001]' to 'int**'
   43 |         cnt += check(rd2, i, k, n);
      |                      ^~~
      |                      |
      |                      int (*)[5001]
a.cc:5:18: note:   initializing argument 1 of 'long int check(int**, int, int, int)'
    5 | long check(int** rd, int f, int t, int n)
      |            ~~~~~~^~
a.cc:44:21: error: cannot convert 'int (*)[5001]' to 'int**'
   44 |         cnt += chk2(rd2, i, cnt, n, ys2);
      |                     ^~~
      |                     |
      |                     int (*)[5001]
a.cc:23:17: note:   initializing argument 1 of 'long int chk2(int**, int, long unsigned int, int, int*)'
   23 | long chk2(int** rd, int j, unsigned long cnt, int n, int* ys)
      |           ~~~~~~^~
a.cc: In function 'int main()':
a.cc:65:7: error: 'cnt' was not declared in this scope; did you mean 'cnt1'?
   65 |       cnt += check(rd, i, ys[i]);
      |       ^~~
      |       cnt1
a.cc:65:20: error: cannot convert 'int (*)[5001]' to 'int**'
   65 |       cnt += check(rd, i, ys[i]);
      |                    ^~
      |                    |
      |                    int (*)[5001]
a.cc:5:18: note:   initializing argument 1 of 'long int check(int**, int, int, int)'
    5 | long check(int** rd, int f, int t, int n)
      |            ~~~~~~^~
a.cc:70:23: error: 'cnt' was not declared in this scope; did you mean 'cnt1'?
   70 |   cout << chk2(rd, 0, cnt, n, ys);
      |                       ^~~
      |                       cnt1
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 8192
#define MOD 1'000'000'007LL
int p[N];
bool u[N] = {};
pair<int, bool> dfs(int x){
	if(u[x]) return MP(0, true);
	u[x] = true;
	if(p[x] == -1) return MP(1, false);
	auto [y, z] = dfs(p[x]);
	return MP(y+1, z);
}
ll a[N];
ll s[N][N] = {};

int main(){
	ll n; scanf("%lld", &n);
	FOR(i, 1, n+1) scanf("%d", p+i);
	ll kk = 0, b = 0;
	FOR(i, 1, n+1){
		if(u[i]) continue;
		auto [y, z] = dfs(i);
		DEBUG("%d => (%d, %c)\n", i, y, z ? 'o' : 'x');
		if(z) b++;
		else {
			a[++kk] = y;
		}
	}
	DEBUG("kk = %d\n", kk);
	FOR(k, 1, kk+1){
		FOR(i, k, kk+1){
			s[k][i] = (s[k][i-1] + s[k-1][i-1] * a[i]) % MOD;
			DEBUG("%lld ", s[k][i]);
		}
		DEBUG("\n");
	}
	ll nk1 = 1;
	REP(i, k-1) nk1 = (nk1 * (n-1)) % MOD;
	ll nk = nk1 * (n-1) % MOD;

	ll ans = nk * (n-b) % MOD;
	DEBUG("ans = %lld\n");
	FOR(i, 1, kk+1){
		ans = (ans + MOD - (a[i] - 1) * nk1 % MOD) % MOD;
	}
	ll fct = 1;
	FOR(m, 2, kk+1){
		fct *= m-1;
		ans = (ans + MOD - fct * s[m][kk] % MOD) % MOD;
	}
	printf("%lld\n", ans);
}






Compiler output:
a.cc: In function 'int main()':
a.cc:61:16: error: 'k' was not declared in this scope
   61 |         REP(i, k-1) nk1 = (nk1 * (n-1)) % MOD;
      |                ^
a.cc:4:40: note: in definition of macro 'FOR'
    4 | #define FOR(i, a, b) for(int i=(a); i<(b); i++)
      |                                        ^
a.cc:61:9: note: in expansion of macro 'REP'
   61 |         REP(i, k-1) nk1 = (nk1 * (n-1)) % MOD;
      |         ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int const nax = 5010;
const int mod = 1e9 + 7;

void plusle (int &a, int b) {
    if (( a += b) >= mod ) a -= mod ;
}

void minun (int &a, int b) {
    if ((a -= b) < 0) a += mod ;
}

int add (int a, int b) {
    return (( a += b ) >= mod ) ? a - mod  : a;
}

int sub (int a, int b) {
    return (( a -= b) < 0) ? a + mod : a;
}

int mul (int a, int b) {
    return 1LL * a * b % mod;
}

int power (int a, int b) {
    int res = 1;
    for (; b > 0 ; b >>= 1 , a = mul(a, a))
        if (b & 1) res = mul(res, a);
    return res ;
}

int dp[nax][nax];
int n;
int p[nax];

vector <int> a[nax];
vector <int> in_comp[nax];

bool vis[nax];
int comp;
int c[nax];
int cnt[nax];
int white ;
int c_white ;

void dfs (int nod) {

    vis[nod] = true;
    ++ c[comp];
    in_comp[comp].push_back(nod);

    for (int i : a[nod]) {
        if (!vis[i]) {
            dfs(i);
        }
    }
}

int main () {


    scanf("%d", &n);

    for (int i = 1 ; i <= n;  ++ i) {
        scanf("%d", p + i);
    }

    /// town i choose to connect with p[i]

    for (int i = 1 ; i <= n ; ++ i) {
        if (p[i] != -1) {
            a[p[i].push_back(i)];
            a[i].push_back(p[i]);
        }
    }

    for (int i = 1 ; i <= n ; ++ i) {
        if (!vis[i]) {
            ++ comp;
            dfs(i);
        }
    }

    int top = 0;

    for (int i = 1 ; i <= comp ; ++ i) {

        bool white_only = true;

        for (int j : in_comp[i]) {
            if (p[j] == -1) {
                white_only = false;
            }
        }

        if (white_only) ++ c_white, white += c[comp];
        else {
            cnt[++ top] = c[comp];
        }
    }

    dp[c_white][white] = 1;

    for (int i = 1 ; i <= top ; ++ i) {

        {
            /// if point to white
            dp[c_white][white + cnt[i]] = mul(dp[c_white][white], white);
        }

        {
           /// if point to itself
           dp[c_white + 1][white + cnt[i]] = mul(dp[c_white][white], cnt[i]);
        }

        {
            dp[c_white][white] = mul(d)
        }
    }
    
    /// can't finsih
}
/*
    Good Luck
        -Lucina
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:73:20: error: request for member 'push_back' in 'p[i]', which is of non-class type 'int'
   73 |             a[p[i].push_back(i)];
      |                    ^~~~~~~~~
a.cc:118:38: error: 'd' was not declared in this scope
  118 |             dp[c_white][white] = mul(d)
      |                                      ^
Language: C++

むりぃぃぃぃぃぃ

Compiler output:
a.cc:1:1: error: '\U00003080\U0000308a\U00003043\U00003043\U00003043\U00003043\U00003043\U00003043' does not name a type
    1 | むりぃぃぃぃぃぃ
      | ^~~~~~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <ctime>

#ifndef ONLINE_JUDGE
#include "LocalDebug.h"
#else 
#define dbg(...)
#endif

const int N = 5005;
const int P = 1000000007;
int fac[N], inv[N], fnv[N], pw[N];

int comb (int x, int y) {
	if (x == 0) return 0;
	if (x < y) return 0;
	return 1LL * fac[x] * fnv[y] % P * fnv[x-y] % P;
}
int power (int a, int n) {
	int ans = 1;
	while (n > 0) {
		if (n % 2) ans = 1LL * ans * a % P;
		n /= 2;
		a = 1LL * a * a % P;
	}
	return ans;
}

void go () {
	fac[0] = inv[0] = fnv[0] = 1;
	fac[1] = inv[1] = fnv[1] = 1;
	pw[0] = 1; pw[1] = 2;
	for (int i = 2; i < N; ++i) {
		fac[i] = 1LL * fac[i-1] * i % P;
		inv[i] = 1LL * (P - P/i) * inv[P%i] % P;
		fnv[i] = 1LL * fnv[i-1] * inv[i] % P;
		pw[i] = 1LL * pw[i-1] * 2 % P;
	}
	int n; std::cin >> n;
	std::vector <int> a(n), d(n);
	int k = 0;
	for (int i = 0; i < n; ++i) {
		std::cin >> a[i];
		if (a[i] != -1) a[i]--, d[a[i]]++;
		else ++k;
	}
	int use = 0, left = k-1;
	long long ans = 0;
	std::set <std::pair<int,int>> base;
	for (int i = 0; i < n; ++i) {
		if (a[i] != -1) {
			base.insert (std::make_pair(i,a[i]));
			base.insert (std::make_pair(a[i],i));
			continue;
		}
		// link -1 before
		dbg (i, use, left);
		for (int j = 0; j <= use; ++j) { // there are j '-1' choose self
			int c = 1LL * comb(use,j) * power(n-2,use-j) % P;
			dbg (i, j, c);
			ans = (ans + 1LL * (use-j) * c % P * power(n-1,left)) % P;
		}
		dbg (i, ans);
		// link not -1
		ans = (ans + 1LL * (n - d[i] - k) * power(n-1, k-1) % P); 
		use++;
		left--;
	}
	ans = ans + (1LL * (int)(base.size())/2 * power(n-1, k)) % P;
	std::cout << ans << "\n";
}

int main () {
	int T = 1;
	time_t tic = clock();
	while (T--) go();
	time_t toc = clock();
	std::cerr << __FILE__ << " execution time : " << 1000.0 * (toc - tic) / CLOCKS_PER_SEC << "ms\n";
	return 0;
}


Compiler output:
a.cc:9:10: fatal error: LocalDebug.h: No such file or directory
    9 | #include "LocalDebug.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=5005;
const int M=1000000007;
typedef long long ll;
int p[maxn],n,ans,f[maxn],cc,dp[maxn],pre[maxn],sz[maxn],cy[maxn],a[maxn],jc[maxn];
void sub(int &x,int y){x-=y;if (x<0) x+=M;}
void add(int &x,int y){x+=y;if (x>=M)x-=M;}
int ffind(int x){
    if (pre[x]==x) return x;
    return pre[x]=ffind(pre[x]);
}
void _union(int x,int y){
    x=ffind(x); y=ffind(y);
    if (x==y) {cy[x]=1;return;}
    pre[y]=x; sz[x]+=sz[y]; cy[x]|=xy[y];
}
int main(){
    cin >> n;
    jc[0]=1; for (int i=1;i<=n;i++) jc[i]=1ll*jc[i-1]*i%M;
    for (int i=1;i<=n;i++) cin >> p[i];
    for (int i=1;i<=n;i++) pre[i]=i,cy[i]=0,sz[i]=1;
    for (int i=1;i<=n;i++) if (p[i]!=-1) _union(i,p[i]);
    f[0]=1; for (int i=1;i<=n;i++) f[i]=1ll*f[i-1]*(n-1)%M;
    int zt=0;
    for (int i=1;i<=n;i++) if (ffind(i)==i){
        if (cy[i]) {++zt;continue;}
        a[++cc]=sz[i];
    }
    ans=1ll*f[cc]*(n-zt)%M;
    dp[0]=1;
    for (int i=1;i<=cc;i++){
        for (int j=i;j;j--) add(dp[j],1ll*dp[j-1]*a[i]%M);
    }
    for (int i=2;i<=cc;i++) sub(ans,1ll*f[cc-i]*jc[i-1]%M*dp[i]%M);
    for (int i=1;i<=cc;i++) sub(ans,1ll*f[cc-1]*(a[i]-1)%M);
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'void _union(int, int)':
a.cc:16:36: error: 'xy' was not declared in this scope; did you mean 'x'?
   16 |     pre[y]=x; sz[x]+=sz[y]; cy[x]|=xy[y];
      |                                    ^~
      |                                    x
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int a,a1[5001],a2,i,i1,s=0;bool a3[5001];
	scanf("%d",&a);
	for(i=0;i<a;i++)
		{
			scanf("%d",a1+i);if(a1[i]==-1) a2[i]=1;
		}
		for(i=0;i<a;i++)
		for(i1=i;i1<a;i1++)
		{
			if(a1[i]>a1[i1])
			a1[i]+=a1[i1],a1[i1]=a1[i]-a1[i1],a1[i]-=a1[i1];
		}
		for(i=0;i<a;i++)
		{
			if(a1[i]>0)
			{
				i1=i+1;
				for(;;)
				{
					if(a1[i]!=0)
					{
					if(a1[i1]>0||a2[i1])
					a1[i]--,a1[i1]--,i1++,s++;
					else
					i1++;
					}
					else
					break;
				}
			}
		}
		cout<<s*2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:58: error: invalid types 'int[int]' for array subscript
    9 |                         scanf("%d",a1+i);if(a1[i]==-1) a2[i]=1;
      |                                                          ^
a.cc:26:56: error: invalid types 'int[int]' for array subscript
   26 |                                         if(a1[i1]>0||a2[i1])
      |                                                        ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int a,a1[5001],a2,i,i1,s=0;bool a2[5001];
	scanf("%d",&a);
	for(i=0;i<a;i++)
		{
			scanf("%d",a1+i);if(a1[i]==-1) a2[i]=1;
		}
		for(i=0;i<a;i++)
		for(i1=i;i1<a;i1++)
		{
			if(a1[i]>a1[i1])
			a1[i]+=a1[i1],a1[i1]=a1[i]-a1[i1],a1[i]-=a1[i1];
		}
		for(i=0;i<a;i++)
		{
			if(a1[i]>0)
			{
				i1=i+1;
				for(;;)
				{
					if(a1[i]!=0)
					{
					if(a1[i1]>0||a2[i1])
					a1[i]--,a1[i1]--,i1++,s++;
					else
					i1++;
					}
					else
					break;
				}
			}
		}
		cout<<s*2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:41: error: conflicting declaration 'bool a2 [5001]'
    5 |         int a,a1[5001],a2,i,i1,s=0;bool a2[5001];
      |                                         ^~
a.cc:5:24: note: previous declaration as 'int a2'
    5 |         int a,a1[5001],a2,i,i1,s=0;bool a2[5001];
      |                        ^~
a.cc:9:58: error: invalid types 'int[int]' for array subscript
    9 |                         scanf("%d",a1+i);if(a1[i]==-1) a2[i]=1;
      |                                                          ^
a.cc:26:56: error: invalid types 'int[int]' for array subscript
   26 |                                         if(a1[i1]>0||a2[i1])
      |                                                        ^
Language: C++

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

const long long MOD = 1000000007;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int solve(long long N, std::vector<long long> P){
    for(int i = 0;i < N;i++){
        if(P[i] != -1)return 1;
    }
    cout<<N * modpow(N - 1 N, MOD)<<endl;
    return 0;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    int d = solve(N, std::move(P));
    return d;
}


Compiler output:
a.cc: In function 'int solve(long long int, std::vector<long long int>)':
a.cc:21:27: error: expected ')' before 'N'
   21 |     cout<<N * modpow(N - 1 N, MOD)<<endl;
      |                     ~     ^~
      |                           )
a.cc:21:21: error: too few arguments to function 'long long int modpow(long long int, long long int, long long int)'
   21 |     cout<<N * modpow(N - 1 N, MOD)<<endl;
      |               ~~~~~~^~~~~~~~~~~~~~
a.cc:7:11: note: declared here
    7 | long long modpow(long long a, long long n, long long mod) {
      |           ^~~~~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
const int N=200005;
int n;
char s[N];
char a[N];
int len[N],l[N];
int m;
int sum[N][2];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1,j=1;i<=n;i=j)
	{
		while(j<=n&&s[i]==s[j]) j++;
		m++,a[m]=s[i],len[m]=j-i;
	}
	for(int i=1;i<=m;i++)
	{
		sum[i][0]+=sum[i-1][0];
		sum[i][1]+=sum[i-1][1];
		sum[i][a[i]-'0']+=len[i];
		l[i]=l[i-1]+len[i];
	}
	long long ans=0;
	for(int i=1;i<=m;i++)
	{
		if(a[i]=='1')
		{
			if(len[i]&1)
			{
				ans+=(sum[i][0]+i%2)/2;
				if(l[i]&1) ans+=sum[m][0]-sum[i][0];
				int t=len[i]/2;
				ans+=sum[i][0]*t;
				ans+=(sum[m][0]-sum[i][0])*t;
			}
			else
			{
				int t=len[i]/2;
				ans+=sum[i][0]*t;
				ans+=(sum[m][0]-sum[i][0])*t;
			}
		}
	}
	for(int i=0;i<=sum[m][1];i++)
	{
		int s=sum[m][1]-i;
		ans+=(s+1)/2;
	}
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'strlen' was not declared in this scope
   14 |         n=strlen(s+1);
      |           ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
string s,t;
long long ans;
long long main(){
	cin>>s;
	long long cnt=count(s.begin(),s.end(),'1');
	for(long long i=1;i<=cnt;++i){
		ans+=(i+1)/2;
	}
	for(long long i=0;i<s.size();++i){
		t+=s[i];
		long long sz=t.size();
		if(sz>=2&&t[sz-1]=='1'&&t[sz-2]=='1'){
			t.pop_back();
			t.pop_back();
			ans+=s.size()-cnt;
		}
	}
	s=t;
	cnt=count(s.begin(),s.end(),'1');
	long long c=0;
	for(long long i=0;i<s.size();++i){
		if(s[i]=='1'){
			ans+=s.size()-cnt-((i+1)/2-(c+1)/2);
			c++;
		}
	}
	cout<<c<<'\n';
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
string s,t;
long long ans;
int main(){
	cin>>s;
	int cnt=count(s.begin(),s.end(),'1');
	for(int i=1;i<=cnt;++i){
		ans+=(i+1)/2;
	}
	for(int i=0;i<s[i].size();++i){
		t+=s[i];
		int sz=t.size();
		if(sz>=2&&t[sz-1]=='1'&&t[sz-2]=='1'){
			t.pop_back();
			t.pop_back();
			ans+=s.size()-cnt;
		}
	}
	s=t;
	cnt=count(s.begin(),s.end(),'1');
	int c=0;
	for(int i=0;i<s.size();++i){
		if(s[i]=='1'){
			ans+=s.size()-cnt-((i+1)/2-(c+1)/2);
			c++;
		}
	}
	cout<<c<<'\n';
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
string s,t;
long long ans;
int main(){
	cin>>s;
	int cnt=count(s.begin(),s.end(),'1');
	for(int i=1;i<=cnt;++i){
		ans+=(i+1)/2;
	}
	for(int i=0;i<s[i].size();++i){
		t+=s[i];
		int sz=t.size();
		if(sz>=2&&t[sz-1]=='1'&&t[sz-2]=='1'){
			t.pop_back();
			t.pop_back();
			ans+=s.size()-cnt;
		}
	}
	s=t;
	cnt=count(s.begin(),s.end(),'1');
	int c=0;
	for(int i=0;i<s[i].size();++i){
		if(s[i]=='1'){
			ans+=s.size()-cnt-((i+1)/2-(c+1)/2);
			c++;
		}
	}
	cout<<c<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   11 |         for(int i=0;i<s[i].size();++i){
      |                            ^~~~
a.cc:23:28: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   23 |         for(int i=0;i<s[i].size();++i){
      |                            ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
string t,s;
vector<int> v;
long long ans;
int main(){
	cin>>t;
	for(int i=0;i<=n;++i){
		ans+=(i+1)/2;
	}
	int cnt=count(t.begin(),t.end(),'1');
	for(int i=0;i<t.size();++i){
		s+=t[i];
		int sz=s.size();
		if(sz>=2&&s[sz-1]==s[sz-2]=='1'){
			s.pop_back();
			s.pop_back();
			ans+=t.size()-cnt;
		}
	}
	t=s;
	cnt=count(t.begin(),t.end(),'1');
	int cnter=0;
	for(int i=0;i<t.size();++i){
		if(t[i]=='1'){
			ans+=n-cnt-((i+1)/2-(cnter+1)/2);
			cnter++;
		}
	}
	cout<<ans<<'\n';
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: 'n' was not declared in this scope
    8 |         for(int i=0;i<=n;++i){
      |                        ^
a.cc:26:30: error: 'n' was not declared in this scope
   26 |                         ans+=n-cnt-((i+1)/2-(cnter+1)/2);
      |                              ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
 
int _max = 0;
char a[50000];
 
void calc(int* t, int l)
{
  int sum = 0;
  for (int i=1; i<=l; i++)
  {
    int cnt = 0;
    for (int j=0; j<l; j++)
      if (t[j] <= i)
      {
        cnt += 1;
        if (cnt %2 == 1 && a[j] == '1')
          sum += 1;
      }
  }
  
  if (sum > _max)
    _max = sum;
}
 
void gen(int* t, int l, int cnt)
{
  cnt += 1;
  
  if (cnt <= l)
  {
    for (int i=0; i<l; i++)
      if (t[i] == 0)
      {
        t[i] = cnt;
        gen(t, l, cnt);
        t[i] = 0;
      }
  }
  else
  {
    calc(t, l);
  }
}
 
int main()
{
  cin >> a;
  int t[50000] = {0};
  
  gen(t, a.length(), 0);
  cout << _max;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:12: error: request for member 'length' in 'a', which is of non-class type 'char [50000]'
   52 |   gen(t, a.length(), 0);
      |            ^~~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
 
int _max = 0;
string a;
 
void calc(int* t, int l)
{
  int sum = 0;
  for (int i=1; i<=l; i++)
  {
    int cnt = 0;
    for (int j=0; j<l; j++)
      if (t[j] <= i)
      {
        cnt += 1;
        if (cnt %2 == 1 && a[j] == '1')
          sum += 1;
      }
  }
  
  if (sum > _max)
    _max = sum;
}
 
int gen(int* t, int l, int cnt)
{
  cnt += 1;
  
  if (cnt <= l)
  {
    for (int i=0; i<l; i++)
      if (t[i] == 0)
      {
        t[i] = cnt;
        gen(t, l, cnt);
        t[i] = 0;
      }
  }
  else
  {
    calc();
  }
}
 
int main()
{
  cin >> a;
  int t[50000] = {0};
  
  gen(t, a.length(), 0);
  cout << _max;
  return 0;
}

Compiler output:
a.cc: In function 'int gen(int*, int, int)':
a.cc:43:9: error: too few arguments to function 'void calc(int*, int)'
   43 |     calc();
      |     ~~~~^~
a.cc:8:6: note: declared here
    8 | void calc(int* t, int l)
      |      ^~~~
a.cc:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
Language: C++

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

int max = 0;
string a;

void calc(int* t, int l)
{
  int sum = 0;
  for (int i=1; i<=l; i++)
  {
    int cnt = 0;
    for (int j=0; j<l; j++)
      if (t[j] <= i)
      {
        cnt += 1;
        if (cnt %2 == 1 && a[j] == "1")
          sum += 1;
      }
  }
  
  if (sum > max)
    max = sum;
}

int gen(int* t, int l, int cnt)
{
  cnt += 1;
  
  if (cnt <= l)
  {
    for (int i=0; i<l; i++)
      if (t[i] == 0)
      {
        t[i] = cnt;
        gen(t, l, cnt);
        t[i] = 0;
      }
  }
  else
  {
    calc();
  }
}

int main()
{
  cin >> a;
  int t[50000] = {0};
  
  cout << gen(t, a.length(), 0);
  return 0;
}

Compiler output:
a.cc: In function 'void calc(int*, int)':
a.cc:18:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |         if (cnt %2 == 1 && a[j] == "1")
a.cc:23:13: error: reference to 'max' is ambiguous
   23 |   if (sum > 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:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:5: note:                 'int max'
    5 | int max = 0;
      |     ^~~
a.cc:24:5: error: reference to 'max' is ambiguous
   24 |     max = sum;
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:5: note:                 'int max'
    5 | int max = 0;
      |     ^~~
a.cc: In function 'int gen(int*, int, int)':
a.cc:43:9: error: too few arguments to function 'void calc(int*, int)'
   43 |     calc();
      |     ~~~~^~
a.cc:8:6: note: declared here
    8 | void calc(int* t, int l)
      |      ^~~~
a.cc:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string t;
  cin >> t;
  
  ll cnt1=0, flag=0, dfn=0;
  vl vec;
  rep(i, t.size()) {
    if(t[i]=='0') {
      if(flag) {
        vec.push_back(1);
      }else{
        vec.back()++;
      }
      flag = 0;
    }
    
    if(t[i]=='1') {
      cnt1++;
      if(f) dfn++;
      flag = 1-flag;
    }
  }
  
  ll ans = 0;
  rep2(i, cnt1/2) ans += i;
  ans *= 2;
  if(cnt1 & 1) ans += (cnt1+1)/2;
  
  ll num = vec.size()+1;
  rep(i, vec.size()) {
    num++;
    ans += dfn;
    ans += num/2;
  }
  
  while(!vec.empty()) {
    ll g=1;
    while(vec.back() > 1) {
      g++;
      ans += dfn;
      ans += vec.size();
      if(g & 1) ans++;
      vec.back()--;
    }
    vec.pop_back();
  }
  
  cout << ans << newl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:10: error: 'f' was not declared in this scope
   49 |       if(f) dfn++;
      |          ^
Language: C

#include <stdio.h>
int main(void){
  long long int n, ans, i. tmp = 0, tmp2 = 0, ii, iii;
  int t[200005] ={}, s[200005] = {};
  for (i = 0; i < n; i++)
  {
      scanf("%d", t + i);
        if (t[i] = 1)
            tmp++;
  }
    ans = ((tmp + 1) / 2)  ((tmp + 1) / 2) + (tmp / 2) * ((tmp  + 1) % 2);
    for (i = 0; i < tmp; i++)
        s[i] = 1;
    for (i = 1; i <= n; i++)
    {
        if (t[n - i] == 0)
        {
            t[n - i] == 1;
            for (iii = tmp + 1; iii < tmp + 1 - i; iii--)
            {
                s[iii] = s[iii - 1];
            }
            s[tmp - i + 1] = 0;
            tmp++;
            for (ii = 0; ii < tmp; ii++)
            {
                if (ii % 2 == 1 && s[i] == 1)
                    ans++;
            }
        }
    }
    printf("%lld", ans);
    
    
   return (0);
}


Compiler output:
main.c: In function 'main':
main.c:3:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 |   long long int n, ans, i. tmp = 0, tmp2 = 0, ii, iii;
      |                          ^
main.c:5:8: error: 'i' undeclared (first use in this function)
    5 |   for (i = 0; i < n; i++)
      |        ^
main.c:5:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:13: error: 'tmp' undeclared (first use in this function)
    9 |             tmp++;
      |             ^~~
main.c:19:18: error: 'iii' undeclared (first use in this function)
   19 |             for (iii = tmp + 1; iii < tmp + 1 - i; iii--)
      |                  ^~~
main.c:25:18: error: 'ii' undeclared (first use in this function)
   25 |             for (ii = 0; ii < tmp; ii++)
      |                  ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
// 1 1 2 2 3 3 4 4 4 2
int main() {
    string T;
    cin >> T;
    int cnt = 0;
    int ans = 0;
    int cnt2 = 0;
    int cnt3 = 0;
    int cnt4 = 0;
    for(int i = 0; i < T.size(); i++) {
        if(T[i] == '1') {
            cnt++;
        }
        if(T[i] == '0') {
            cnt2++;
        }
        if(cnt == 0 && T[i] == '0') {
            cnt3++;
        }
    }
    if(cnt == 0) {
        cout << 0 << endl;
        return 0;
    }
    int cnt4 = cnt2-cnt3;
    if(cnt4 >= cnt) {
        cout << (1+cnt)*cnt/2+cnt*(cnt3/2) << endl;
    }
    else {
        if(cnt%2 == 1) {
            cout << (1+cnt4)*cnt4*2+cnt*(cnt/2)+cnt+(cnt3/2)*cnt+(cnt3-(cnt3/2))*(cnt-cnt4) << endl;
        }
        else {
            cout << (1+cnt4)*cnt4*2+cnt*(cnt/2)+cnt+(cnt3/2)*(cnt+1)+cnt+(cnt3-(cnt3/2))*(cnt-cnt4) << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: redeclaration of 'int cnt4'
   27 |     int cnt4 = cnt2-cnt3;
      |         ^~~~
a.cc:11:9: note: 'int cnt4' previously declared here
   11 |     int cnt4 = 0;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
// 1 1 2 2 3 3 4 4 4 2
int main() {
    string T;
    cin >> T;
    int cnt = 0;
    int ans = 0;
    int cnt2 = 0;
    int cnt3 = 0;
    int cnt4 = 0;
    for(int i = 0; i < N; i++) {
        if(T[i] == '1') {
            cnt++;
        }
        if(T[i] == '0') {
            cnt2++;
        }
        if(cnt == 0 && T[i] == '0') {
            cnt3++;
        }
    }
    if(cnt == 0) {
        cout << 0 << endl;
        return 0;
    }
    int cnt4 = cnt2-cnt3;
    if(cnt4 >= cnt) {
        cout << (1+cnt)*cnt/2+cnt*(cnt3/2) << endl;
    }
    else {
        if(cnt%2 == 1) {
            cout << (1+cnt4)*cnt4*2+cnt*(cnt/2)+cnt+(cnt3/2)*cnt+(cnt3-(cnt3/2))*(cnt-cnt4) << endl;
        }
        else {
            cout << (1+cnt4)*cnt4*2+cnt*(cnt/2)+cnt+(cnt3/2)*(cnt+1)+cnt+(cnt3-(cnt3/2))*(cnt-cnt4) << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: 'N' was not declared in this scope
   12 |     for(int i = 0; i < N; i++) {
      |                        ^
a.cc:27:9: error: redeclaration of 'int cnt4'
   27 |     int cnt4 = cnt2-cnt3;
      |         ^~~~
a.cc:11:9: note: 'int cnt4' previously declared here
   11 |     int cnt4 = 0;
      |         ^~~~
Language: C++

//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")


using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 5000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int DP[N][N], PS[N][N], n, m, t2[N], inv[N];

int add(int a, int b){
	a += b;
	if (a >= MOD) a -= MOD;
	return a;
}

int mul(int a, int b){
	return a * 1ll * b % MOD;
}

int minu(int a, int b){
	a -= b;
	if (a < 0) a += MOD;
	return a;
}

int POW(int a, int b){
	int res = 1;
	while (b){
		if (b & 1) res = mul(res, a);
		b >>= 1;
		a = mul(a, a);
	}
	return res;
}

void cPS(int i){
	int Now = 0;
	for (int j = N - 1; j >= 0; j--){
		PS[i][j] = mul(j, mul(tav[Now++], DP[i][j]));
	}
	for (int j = 1; j <= n; j++) PS[i][j] = add(PS[i][j], PS[i][j - 1]);
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	tav[0] = 1;
	for (int i = 1; i < N; i++){
		tav[i] = mul(tav[i - 1], 2);
	}
	inv[N - 1] = POW(tav[N - 1], MOD - 2);
	for (int i = N - 2; i >= 0; i--){
		inv[i] = mul(inv[i + 1], 2);
	}	
	for (int i = 1; i <= m; i++) DP[1][i] = tav[i];
	cPS(1);
	for (int i = 2; i <= n; i++) for (int j = 1; j <= m; j++){
		DP[i][j] = mul(2, DP[i - 1][j]);
		
	}

	return 0;
}


Compiler output:
a.cc: In function 'void cPS(int)':
a.cc:53:39: error: 'tav' was not declared in this scope; did you mean 'tan'?
   53 |                 PS[i][j] = mul(j, mul(tav[Now++], DP[i][j]));
      |                                       ^~~
      |                                       tan
a.cc: In function 'int32_t main()':
a.cc:61:9: error: 'tav' was not declared in this scope; did you mean 'tan'?
   61 |         tav[0] = 1;
      |         ^~~
      |         tan
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

template<int MOD>
struct ModInt {
   using Mint = ModInt;
   int val;
   ModInt(ll __val = 0) { fix(__val % MOD + MOD); }
   Mint& fix(int __val) { val = __val; if (val >= MOD) val -= MOD; return *this; }
   explicit operator int() { return val; }
   Mint operator + (const Mint &mt) const { return Mint().fix(val + mt.val); }
   Mint operator - (const Mint &mt) const { return Mint().fix(val - mt.val + MOD); }
   Mint operator * (const Mint &mt) const { return Mint().fix(ll(val) * mt.val % MOD + MOD); }
   Mint& operator += (const Mint &mt) { return *this = *this + mt; }
   Mint& operator -= (const Mint &mt) { return *this = *this - mt; }
   Mint& operator *= (const Mint &mt) { return *this = *this * mt; }
   Mint pow(int y) const {
      Mint x = *this;
      Mint ans(1);
      for (; y > 0; y >>= 1, x *= x) {
         if (y & 1) ans *= x;
      }
      return ans;
   }
   Mint operator -() const { return Mint().fix(MOD - val); }
   Mint inv() const { return pow(MOD - 2); }
   Mint operator / (const Mint &mt) const { return *this * mt.inv(); }
   Mint& operator /= (const Mint &mt) const { return *this / mt; }
   friend ostream& operator<<(ostream& os, const Mint& mt) { return os << mt.val; }
};

using Mint = ModInt<1000000007>;

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int N, M;
   cin >> N >> M;
   vector<Mint> dp(M + 1);
   dp[M] = 1;
   for (int b = N - 1; b >= 0; --b) {
      vector<Mint> ndp(M + 1);
      Mint tot = 0;
      for (int i = M; i >= 0; --i) {
         ndp[i] = dp[i] * (i + 1) + tot * i;
         tot = tot + tot + dp[i]);
      }
      dp = move(ndp);
   }
   Mint ans = 0;
   for (auto v : dp) ans += v;
   cout << ans << "\n";
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:33: error: expected ';' before ')' token
   48 |          tot = tot + tot + dp[i]);
      |                                 ^
      |                                 ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
unsigned long long n,sum=0;
cin>>n;
for(unsigned long long i=1;i<=n+1;i++){
cin>>a[i];
}
int b[n+5]={0},c[n+5]={0};
for(unsigned long long i=2;i<=n+1;i++){
b[i]=(b[i-1]-a[i-1])*2;
}
for(unsigned long long i=n;i>=1;i--){
c[i]=c[i+1]+a[i];
}
for(unsigned long long i=1;i<=n+1;i++){
sum+=min(b[i],c[i]);
}
for(unsigned long long i=1;i<=n;i++){
if(a[i]>b[i]){
cout<<"-1"<<endl;
return 0;
}
}
cout<<sum<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:6: error: 'a' was not declared in this scope
    7 | cin>>a[i];
      |      ^
a.cc:11:14: error: 'a' was not declared in this scope
   11 | b[i]=(b[i-1]-a[i-1])*2;
      |              ^
a.cc:14:13: error: 'a' was not declared in this scope
   14 | c[i]=c[i+1]+a[i];
      |             ^
a.cc:20:4: error: 'a' was not declared in this scope
   20 | if(a[i]>b[i]){
      |    ^
Language: C

wakruwakewwwwwwwwwwwwwwwwwwwww

Compiler output:
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
    1 | wakruwakewwwwwwwwwwwwwwwwwwwww
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int64_t INF = 1LL << 62;

void solve()
{
  int64_t n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  vector<pair<int, int64_t>> vp;
  vp.emplace_back(2, a);
  vp.emplace_back(3, b);
  vp.emplace_back(5, c);
  map<int64_t, int64_t> mp;
  mp[0] = 0;
  mp[1] = d;
  function<int64_t(int64_t)> dfs = [&](int64_t x) {
    if (mp.find(x) != mp.end())
    {
      return mp[x];
    }
    int64_t ret = INF, tmp = d * x;
    if (!__builtin_smulll_overflow(d, x, &tmp))
    {
      ret = d * x;
    }
    for (auto &p : vp)
    {
      int64_t num, cost;
      tie(num, cost) = p;
      ret = min(ret, dfs(x / num) + cost + d * (x % num));
      if (x % num != 0)
      {
        ret = min(ret, dfs(x / num + 1) + cost + d * (num - x % num));
      }
    }
    return mp[x] = ret;
  };
  cout << dfs(n) << endl;
}

int main()
{
  int64_t T;
  cin >> T;
  for (int i = 0; i < T; i++)
  {
    solve();
  }
}


Compiler output:
a.cc: In lambda function:
a.cc:22:42: error: invalid conversion from 'int64_t*' {aka 'long int*'} to 'long long int*' [-fpermissive]
   22 |     if (!__builtin_smulll_overflow(d, x, &tmp))
      |                                          ^~~~
      |                                          |
      |                                          int64_t* {aka long int*}
<built-in>: note:   initializing argument 3 of 'bool __builtin_smulll_overflow(long long int, long long int, long long int*)'
Language: C++

#include <iostream>
#include <map>

using namespace std;
using ll = long long;

ll N, A, B, C, D, T;
map<ll, ll> m;

ll d(ll n) {
  if (!n)
    return 0;
  else if (m[n])
    return m[n];
  ll ret = min({
      A + n % 2 * D + d(n / 2),
      A + (2 - n % 2) % 2 * D + d((n + 1) / 2),
      B + n % 3 * D + d(n / 3),
      B + (3 - n % 3) % 3 * D + d((n + 2) / 3),
      C + n % 5 * D + d(n / 5),
      C + (5 - n % 5) % 5 * D + d((n + 4) / 5)
    });
  if ((double)D * n < 1e18) ret = min(D * n, ret);
  return m[n] = ret;
}

int main() {
  cin >> T;
  for (int i = 0; i != T; ++i) {
    cin >> N >> A >> B >> C >> D;
    m.clear();
    m[0] = 0;
    m[1] = D;
    cout << d(N) << endl;
  }
}


Compiler output:
a.cc: In function 'll d(ll)':
a.cc:15:15: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   15 |   ll ret = min({
      |            ~~~^~
   16 |       A + n % 2 * D + d(n / 2),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
   17 |       A + (2 - n % 2) % 2 * D + d((n + 1) / 2),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   18 |       B + n % 3 * D + d(n / 3),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
   19 |       B + (3 - n % 3) % 3 * D + d((n + 2) / 3),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   20 |       C + n % 5 * D + d(n / 5),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
   21 |       C + (5 - n % 5) % 5 * D + d((n + 4) / 5)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   22 |     });
      |     ~~         
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:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll n,a,b,c,d;
map<ll, ll> dp;

ll dfs(ll now){
    if(now == 0) return dp[0] = 0;
    if(now == 1) return dp[1] = d;
    if(dp.count(now)) return dp[now];
    ll res = LINF;
    if((LINF)/d > now) res = now*d;
    vector<ll> v = {a,b,c};
    rep(i,3){
        int next = vector<int>{2,3,5}[i];
        if(now % next == 0){
            res = min(res,dfs(now/next)+v[i]);
        }
        else{
            ll l = now/next*next, r = l+next;
            res = min(res,dfs(l/next)+v[i]+(now-l*d);
            res = min(res,dfs(r/next)+v[i]+(r-now)*d);
        }
    }
    return dp[now] = res;

}

int main(){
    int t; cin >> t;
    while(t--){
        cin >> n >> a >> b >> c >> d;
        dp.clear();
        dfs(n);
        cout << dp[n] << endl;
    }
}



Compiler output:
a.cc: In function 'll dfs(ll)':
a.cc:51:53: error: expected ')' before ';' token
   51 |             res = min(res,dfs(l/next)+v[i]+(now-l*d);
      |                      ~                              ^
      |                                                     )
Language: C++

#include<iostream>
#include<map>

int64_t n,a,b,c,d;
std::map<int64_t,int64_t> memo;

int64_t dfs(int64_t n){
  if(memo.count(n))return memo[n];
  int64_t tmp = (1LL<<58);
  if(n%2==0)tmp = std::min(tmp,dfs(n/2)+a);
  else{
    tmp = std::min(tmp,dfs((n+1)/2)+a+d);
    tmp = std::min(tmp,dfs((n-1)/2)+a+d);
  }
  if(n%3==0)tmp = std::min(tmp,dfs(n/3)+b);
  else{
    int64_t low3 = n/3*3;
    int64_t high3 = (n/3+1)*3;
    tmp = std::min(tmp,dfs(low3)+b+d*(n-low3));
    tmp = std::min(tmp,dfs(high3)+b+d*(high3-n));
  }
  if(n%5==0)tmp = std::min(tmp,dfs(n/5)+c);
  else{
    int64_t low5 = n/5*5;
    int64_t high5 = (n/5+1)*5;
    tmp = std::min(tmp,dfs(low5)+c+d*(n-low5));
    tmp = std::min(tmp,dfs(high5)+c+d*(high5-n));
  }
  return memo[n] = tmp;
}

void solve(){
  std::cin>>n>>a>>b>>c>>d;
  memo.clear();
  dfs(n);
  memo[0] = 0;
  memo[1] = d;
  std::cout<< memp[n] <std::endl;
}

int main(){
  int t;
  std::cin>>t;
  while(t--)solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:38:15: error: 'memp' was not declared in this scope; did you mean 'memo'?
   38 |   std::cout<< memp[n] <std::endl;
      |               ^~~~
      |               memo