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

#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <cmath>

using namespace std;

const int kMax = 2200;
const int kMaxPr = 500;

bitset < kMax > used;

void Init(vector < int > &prime) {
  
  int index = 0;
  for (int pr = 2; pr < kMax; pr ++) {
    if (used[pr]) {
      continue;
    }
    prime[++ index] = pr;

    for (int j = pr * 2; j < kMax; j += pr) {
      used[j] = true;
    }
  }

  prime[0] = index;
}

int main(int argc, char const *argv[]) {
 
  vector < int > prime(kMaxPr);
  Init(prime);

  int n;
  cin >> n;

  map < long long, long long > hash;
  map < long long, long long > comp;
  vector < long long > element(n + 1);

  for (int i = 1; i <= n; i ++) {
    cin >> element[i];
    long long k = element[i];
    hash[k] = 1ll;
    comp[k] = 1ll;

    if (k == 1ll) {
      continue;
    }

    for (int j = 1; j <= prime[0] and k != 1 and prime[j] <= k; j ++) {
      if (k % prime[j] != 0) {
        continue;
      }

      int elExp = 0;
      while (k % prime[j] == 0) {
        elExp ++;
        k /= prime[j];
      }

      elExp %= 3;
      if (elExp == 0) {
        continue;
      }

      if (elExp == 1) {
        hash[element[i]] *= 1ll * prime[j];
        comp[element[i]] *= 1ll * prime[j] * prime[j];
      }
      else {
        hash[element[i]] *= 1ll * prime[j] * prime[j];  
        comp[element[i]] *= 1ll * prime[j];
      }
    }

    if (k != 1) {
      hash[element[i]] *= 1ll * k * k;
      comp[element[i]] *= 1ll * k;
    }
  

  map < long long, int > frecv;
  for (int i = 1; i <= n; i ++) {
    frecv[hash[element[i]]] ++;
  }

  int to_remove = 0;
  for (auto x : frecv) {
    if (x.second == 0) {
      continue;
    }

    if (x.first == 1) {
      to_remove += x.second - 1;
      x.second = 0;
      continue;
    }

    int k = x.first;
    int c = frecv[comp[k]];
    if (c == 0) {
      continue;
    }

    if (x.second >= c) {
      to_remove += c;
    }
    else {
      to_remove += x.second;
    }
    frecv[comp[k]] = 0;
  }

  cout << n - to_remove << '\n';
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:118:2: error: expected '}' at end of input
  118 | }
      |  ^
a.cc:31:40: note: to match this '{'
   31 | int main(int argc, char const *argv[]) {
      |                                        ^
Language: C++

#include <bits/stdc++.h>

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

#define LIM 10000000001LL

using namespace std;

int n, pr[2005], p, ans;
LL s[100005], pal[100005];

map<LL, int> M, M_pal;

bool isp(int x){
	FI(i, 1, p) if(x % pr[i] == 0) return false;
	return true;
}

int main(){
	FI(i, 2, 2200) if(isp(i)) pr[++p] = i;
	scanf("%d", &n);
	FI(i, 1, n){
		scanf("%lld", &s[i]);
		FI(j, 1, p){
			LL u = 1LL * pr[j] * pr[j] * pr[j];
			while(s[i] % u == 0) s[i] /= u;
		}
		//Now s[i] is p^3-free
		LL tmp = s[i];
		pal[i] = 1;
		FI(j, 1, p){
			if(tmp % pr[j] == 0){
				LL u = 1LL * pr[j] * pr[j] * pr[j];
				while(tmp % pr[j] == 0){
					tmp /= pr[j];
					u /= pr[j];
				}
				if(pal[i] <= LIM / u + 1) pal[i] *= u;
				else pal[i] = LIM;
			}
		}
		if(tmp > 1){
			LL rt = sqrt(tmp);
			if(rt * rt == tmp && pal[i] <= LIM / rt + 1) pal[i] *= rt;
			else if(pal[i] <= LIM / tmp / tmp + 1) pal[i] *= tmp * tmp;
			else pal[i] = LIM;
		}
	}
	FI(i, 1, n){
		M[s[i]]++;
		if(!M.count(s[i])) M_pal[s[i]] = pal[i];
		else M[s[i]]++;
	}
	
	for(auto pi: M){
		LL u = pi.fi, cnt = pi.se;
		LL pa = M_pal[u];
		if(pa == INF) assert(!M.count(pa));
		if(pa == u) ans++; //only if u == 1
		else if(!M.count(pa)) ans += cnt;
		else if(u > pa) ans += max(cnt, (LL)M[pa]);
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:26: error: 'INF' was not declared in this scope
   69 |                 if(pa == INF) assert(!M.count(pa));
      |                          ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long n, s[100000], t[100000], K, ret, inf = (1LL << 40), num[2]; vector<pair<long long, int>>vec; bool used[100000];
long long solve(long long I) {
	long long ret = 1;
	for (long long i = 2; i <= 2500; i++) {
		long long U = 0; while (I%i == 0) { I /= i; U++; U %= 3; }
		for (int j = 0; j < (3 - U % 3) % 3; j++) {
			if (ret*i <= inf)ret *= i;
			else ret = inf;
		}
	}
	long long G = sqrtl(1.0L*I); if (G*G == I) { ret *= G; }
	else { if ((inf / I) <= ret)ret *= I; else ret = inf; }
	return min(ret, inf);
}
void dfs(int pos, int depth) {
	if (used[pos] == true)return;
	num[depth]++; used[pos] = true;
	for (int i = 1; i <= 2000; i++) {
		long long P = 1LL * i*i*i*t[pos];
		int pos1 = lower_bound(vec.begin(), vec.end(), make_pair(P, 0)) - vec.begin();
		if (pos1 >= vec.size() || vec[pos1].first != P)continue;
		while (pos1 < vec.size() && vec[pos1].first == P) {
			dfs(vec[pos1].second, depth ^ 1); pos1++;
		}
	}
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i]; t[i] = solve(s[i]);
		if (t[i] != 1)vec.push_back(make_pair(s[i], i)); else K = 1;
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < n; i++) {
		if (t[i] == 1 || used[i] == true)continue;
		num[0] = 0; num[1] = 0;
		dfs(i, 0); ret += max(num[0], num[1]);
	}
	cout << ret + K << endl;
	return 0;
}

Compiler output:
a.cc: In function 'long long int solve(long long int)':
a.cc:15:23: error: 'sqrtl' was not declared in this scope; did you mean 'strtol'?
   15 |         long long G = sqrtl(1.0L*I); if (G*G == I) { ret *= G; }
      |                       ^~~~~
      |                       strtol
Language: C++

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
long long n, s[100000], t[100000], col[100000], cnt, num[100000]; vector<pair<long long, int>>F;
map<long long, bool>M;
void dfs(int pos, int depth) {
	if (col[pos] != -1)return;
	col[pos] = depth; num[depth]++;
	if (t[pos] == -1)return;
	for (long long i = 1; i <= 3000; i++) {
		long long I = 1LL * i*i*i*t[pos];
		if (I > 1e10 || M[I] == true)break;
		int pos1 = lower_bound(F.begin(), F.end(), make_pair(I, 0)) - F.begin();
		int pos2 = lower_bound(F.begin(), F.end(), make_pair(I + 1, 0)) - F.begin();
		for (int j = pos1; j < pos2; j++) {
			dfs(F[j].second, cnt * 2 + ((col[pos] - cnt * 2) ^ 1));
		}
		M[pos] = true;
	}
}
int main() {
	cin >> n; for (int i = 0; i < n; i++)t[i] = 1;
	for (int i = 0; i < n; i++) {
		cin >> s[i]; F.push_back(make_pair(s[i], i));
		vector<long long>E; long long I = s[i];
		for (int j = 2; j <= 3000; j++) {
			while (I%j == 0) { E.push_back(j); I /= j; }
		}
		if (I >= 2) {
			long long H = sqrtl(1.0L*I);
			if (H*H == I) { E.push_back(H); E.push_back(H); }
			else { E.push_back(I); }
		}
		if (s[i] == 1) { E.clear(); E.push_back(1); }
		sort(E.begin(), E.end());
		map<long long, int>M;
		for (int j = 0; j < E.size(); j++)M[E[j]]++;
		for (int j = 0; j < E.size(); j++) {
			if ((j == 0 || (E[j - 1] != E[j])) && t[i] != -1) {
				long long F = M[E[j]];
				if (F % 3 == 2) {
					if ((1LL << 35) / t[i] >= E[j])t[i] *= E[j];
					else t[i] = -1;
				}
				if (F % 3 == 1) {
					if (((1LL << 35) / E[j]) / E[j] >= t[i])t[i] *= E[j] * E[j];
					else t[i] = -1;
				}
			}
		}
	}
	for (int i = 0; i < n; i++)col[i] = -1;
	sort(F.begin(), F.end()); int ret = 0, K = 0;
	for (int i = 0; i < n; i++) {
		if (t[i] == 1) { K = 1; continue; }
		if (col[i] >= 0)continue;
		dfs(i, cnt * 2 + 1); ret += max(num[cnt * 2], num[cnt * 2 + 1]); cnt++;
	}
	ret += K;
	cout << ret << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:39: error: 'sqrtl' was not declared in this scope; did you mean 'strtol'?
   32 |                         long long H = sqrtl(1.0L*I);
      |                                       ^~~~~
      |                                       strtol
Language: C++

#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>

#define a first
#define b second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define debug
#define TRACE(x)

using namespace std;
using llint = long long;
using pii = pair<llint, llint>;

const int MAXN = 100010;
const int MAXP = 2200;

bool isprime(int n) {
  for (int x = 2; x < n; ++x)
    if (n % x == 0)
      return false;
  return true;
}

vector<int> p;
vector<int> pp[3];
map<llint, int> tot;

pii get_class(llint x) {
  llint ret1 = 1, ret2 = 1;
  REP(i, (int)p.size()) {
    int cnt = 0;
    while (x % p[i] == 0) {
      x /= p[i];
      ++cnt;
    }
    cnt %= 3;
    ret1 *= pp[cnt][i];
    ret2 *= pp[(3 - cnt) % 3][i];
  }

  if (x > 1) {
    llint root = sqrt(x);
    if (root * root == x) {
      ret1 *= root * root;
      ret2 *= root;
    } else {
      ret1 *= x;
      ret2 *= x * x;
    }
  }
  
  return {ret1, ret2};
}

int n, sol;
llint a[MAXN];
pii s[MAXN];

int main(void) {
  scanf("%d",&n);
  REP(i, n) scanf("%lld",&a[i]);

  FOR(pr, 2, MAXP)
    if (isprime(pr)) {
      p.push_back(pr);
      pp[0].push_back(1);
      pp[1].push_back(pr);
      pp[2].push_back(pr*pr);
    }

  TRACE((int)p.size());

  REP(i, n) {
    auto c = get_class(a[i]);
    s[i] = c;
    ++tot[c.a];
    TRACE(c.a _ c.b);
  }

  sort(s, s + n);

  REP(i, n) {
    if (s[i].b == -1) {
      ++sol;
      continue;
    }
    if (i > 0 && s[i-1] == s[i]) continue;
    if (s[i].a == 1)
      sol += 1;
    else {
      if (tot[s[i].a] > tot[s[i].b] ||
	  (tot[s[i].a] == tot[s[i].b] && s[i].a < s[i].b))
	sol += tot[s[i].a];
    }
  }

  printf("%d\n",sol);
  
  return 0;
}


Compiler output:
a.cc:17:9: warning: "debug" redefined
   17 | #define debug
      |         ^~~~~
a.cc:16:9: note: this is the location of the previous definition
   16 | #define debug(...) fprintf(stderr, __VA_ARGS__)
      |         ^~~~~
a.cc:18:9: warning: "TRACE" redefined
   18 | #define TRACE(x)
      |         ^~~~~
a.cc:15:9: note: this is the location of the previous definition
   15 | #define TRACE(x) cerr << #x << " = " << x << endl
      |         ^~~~~
a.cc: In function 'pii get_class(llint)':
a.cc:52:18: error: 'sqrt' was not declared in this scope
   52 |     llint root = sqrt(x);
      |                  ^~~~
Language: C++

#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
 
using namespace std;
 
typedef unsigned long long ll;
 
int N,NP;
 
ll S[100000];
ll prime[100000];
bool is_prime[100001];
 
map <ll, ll> mp;
map <ll,ll>::iterator it;
set <ll> st;
 
int sieve(int n){
  int p=0;
  for(int i=0; i<=n; i++) is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<=n; i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i; j<=n; j+=i) is_prime[j]=false;
    }
  }
  return p;
}
 
ll dv(ll x){
 
  for(int i=0; i<NP; i++){
 
    ll q=prime[i]; //if(q>1000) break;
    ll t=q*q*q;
    if(t>x) break;
    while(x%t==0) x/=t;
 
  }
 
  return x;
 
}
 
ll tp(ll x){
	ll A=1,B=1;
	for(ll i=2;;i++){
		if(i*i*i>x) break;
		int cnt=0;
		while(x%i==0)
		{
			x/=i;
			cnt++;
		}
		if(cnt==1) A*=i;
		else if(cnt==2) B*=i;
	}
	
      ll dt=(ll) floor(sqrt(x)+0.5);
      if(dt*dt==x) return A*A*sqrt(B)*dt;
      else return A*A*sqrt(B)*x*x;

}
 
int main(){
 
 scanf("%d",&N);
 
 NP=sieve(100000);
 
 for(int i=0; i<N; i++){
 
  scanf("%lld",&S[i]);
  ll x=dv(S[i]);
  mp[x]++;
  //cout<<x<<endl;
 }
 
 int ans=0; //cout<<tp(1027243729)<<endl;
  
 for(it=mp.begin();it!=mp.end();it++){
 
  ll x=it->first; //cout<<x<<endl;
  ll y=tp(x);
 
  if(st.count(x)) continue;
 
  if(x!=1) ans+=max(mp[x],mp[y]);
  else ans++;
 
  st.insert(y);
 
 }
  
  cout<<ans<<endl;
 
 return 0;
 


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

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

map<long long, long long> cnt;
long long arr[100050];
bool isPrime[100050];
vector<long long> prime;
long long Slove(long long n)
{
    for(vector<long long>::size_type i = 0; i < prime.size(); ++i)
    {
        if(prime[i] * prime[i] * prime[i] > n)
            break;
        while(n % (prime[i] * prime[i] * prime[i]) == 0)
            n /= prime[i] * prime[i] * prime[i];
    }
    return n;
}
int main()
{
    memset(isPrime, true, sizeof(isPrime));
    for(long long i = 2; i <= 100000; ++i)
    {
        if(!isPrime[i])
            continue;
        prime.push_back(i);
        for(long long j = i + i; j <= 100000; j += i)
            isPrime[j] = false;
    }
    long long n;
    scanf("%lld", &n);
    for(long long i = 1; i <= n; ++i)
        scanf("%lld", &arr[i]);
    for(long long i = 1; i <= n; ++i)
        ++cnt[ Slove(arr[i]) ];
    long long ans;
    if(cnt.find(1) != cnt.end())
        ans = 1;
    else
        ans = 0;
    for(auto &it = cnt.begin(); it != cnt.end(); ++it)
    {
        if(it->first == 1)
            continue;
        long long a = it->first;
        long long b = Slove(a * a);
        ans += max(cnt[a], cnt[b]);
        cnt[a] = 0;
        cnt[b] = 0;
    }
    printf("%lld\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:29: error: cannot bind non-const lvalue reference of type 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >&' to an rvalue of type 'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'}
   41 |     for(auto &it = cnt.begin(); it != cnt.end(); ++it)
      |                    ~~~~~~~~~^~
Language: C++

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

map<long long, long long> cnt;
long long arr[100050];
bool isPrime[100050];
vector<long long> prime;
long long Slove(long long n)
{
    for(vector<long long>::size_type i = 0; i < prime.size(); ++i)
    {
        if(prime[i] * prime[i] * prime[i] > n)
            break;
        while(n % (prime[i] * prime[i] * prime[i]) == 0)
            n /= prime[i] * prime[i] * prime[i];
    }
    return n;
}
int main()
{
    memset(isPrime, true, sizeof(isPrime));
    for(long long i = 2; i <= 100000; ++i)
    {
        if(!isPrime[i])
            continue;
        prime.push_back(i);
        for(long long j = i + i; j <= 100000; j += i)
            isPrime[j] = false;
    }
    long long n;
    scanf("%lld", &n);
    for(long long i = 1; i <= n; ++i)
        scanf("%lld", &arr[i]);
    for(long long i = 1; i <= n; ++i)
        ++cnt[ Slove(arr[i]) ];
    long long ans;
    if(cnt.find(1) != cnt.end())
        ans = 1;
    else
        ans = 0;
    for(auto it = cnt.begin(); it != cnt.end(); ++it)
    {
        long long a = cnt->first;
        long long b = Slove(a * a);
        ans += max(cnt[a], cnt[b]);
        cnt[a] = 0;
        cnt[b] = 0;
    }
    printf("%lld\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:26: error: base operand of '->' has non-pointer type 'std::map<long long int, long long int>'
   43 |         long long a = cnt->first;
      |                          ^~
Language: C++

#include <iostream>
#include <vector>
#define NMAX 100000
#define REP(i, a, n) for(int i = a; i < n; i++)
using namespace std;
typedef long long ll;


int N;
ll s[NMAX];

vector<int> prime;

pair< pair<ll, ll>, bool > norm[NMAX];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> s[i];

  bool ptable[NMAX] = {false};
  ptable[0] = true;
  REP(i, 0, NMAX) {
    if(!ptable[i]) {
      prime.push_back(i + 1);
      for(int j = (i + 1) * 2; j < NMAX; j += i + 1) {
        ptable[j - 1] = true;
      }
    }
  }

  REP(i, 0, N) {
    norm[i].first.first = s[i];
    for(ll p:prime) {
      ll pcube = p * p * p;
      while(norm[i].first.first % pcube == 0) norm[i].first.first /= pcube;
    }
    norm[i].first.second = norm[i].first.first * norm[i].first.first;
    for(ll p:prime) {
      ll pcube = p * p * p;
      while(norm[i].first.second % pcube == 0) norm[i].first.second /= pcube;
    }
    if(norm[i].first.first > norm[i].first.second) {
      ll temp = norm[i].first.first;
      norm[i].first.first = norm[i].first.second;
      norm[i].first.second = temp;
      norm[i].second = true;
    } else {
      norm[i].second = false;
    }
  }

  std::sort(norm, norm + N);

  ll ans = 0;
  for(ll i = 0; i < N;) {
    ll x = 0, y = 0, n;
    for(n = norm[i].first.first; i < N && norm[i].first.first == n; i++) {
      norm[i].second ? x++ : y++;
    }
    ans += (n == 1 ? 1 : max(x, y));
  }

  cout << ans << endl;

  // REP(i, 0, N) {
  //   cout << norm[i].first.first << ", " << norm[i].first.second << ", " << norm[i].second << endl;
  // }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   52 |   std::sort(norm, norm + N);
      |        ^~~~
      |        qsort
Language: C++

#include <iostream>
#include <vector>
#define NMAX 100000
#define REP(i, a, n) for(int i = a; i < n; i++)
using namespace std;
typedef long long ll;


int N;
ll s[NMAX];

vector<int> prime;

pair< pair<ll, ll>, bool > norm[NMAX];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> s[i];

  bool ptable[NMAX] = {false};
  ptable[0] = true;
  REP(i, 0, NMAX) {
    if(!ptable[i]) {
      prime.push_back(i + 1);
      for(int j = (i + 1) * 2; j < NMAX; j += i + 1) {
        ptable[j - 1] = true;
      }
    }
  }

  REP(i, 0, N) {
    norm[i].first.first = s[i];
    for(ll p:prime) {
      ll pcube = p * p * p;
      while(norm[i].first.first % pcube == 0) norm[i].first.first /= pcube;
    }
    norm[i].first.second = norm[i].first.first * norm[i].first.first;
    for(ll p:prime) {
      ll pcube = p * p * p;
      while(norm[i].first.second % pcube == 0) norm[i].first.second /= pcube;
    }
    if(norm[i].first.first > norm[i].first.second) {
      ll temp = norm[i].first.first;
      norm[i].first.first = norm[i].first.second;
      norm[i].first.second = temp;
      norm[i].second = true;
    } else {
      norm[i].second = false;
    }
  }

  sort(norm, norm + N);

  ll ans = 0;
  for(ll i = 0; i < N;) {
    ll x = 0, y = 0, n;
    for(n = norm[i].first.first; i < N && norm[i].first.first == n; i++) {
      norm[i].second ? x++ : y++;
    }
    ans += (n == 1 ? 1 : max(x, y));
  }

  cout << ans << endl;

  // REP(i, 0, N) {
  //   cout << norm[i].first.first << ", " << norm[i].first.second << ", " << norm[i].second << endl;
  // }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   52 |   sort(norm, norm + N);
      |   ^~~~
      |   short
Language: C++

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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

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

#define MAX_P 100000

ll N;
vector<ll> primes;
map<ll,ll> prime2;

void getPrime(ll n){
    vector<bool> p(n+10,true);

    for(ll i=2;i<=n;i++){
        if(!p[i]) continue;
        if(p[i]) primes.push_back(i);

        for(ll j=2;i*j<=n;j++) p[i*j] = false;
    }
}

int main(){
    bool f=false;
    getPrime(MAX_P+10);
    for(ll p : primes) prime2[p*p]=p;

    cin>>N;
    vector<ll> S(N);
    for(int i=0;i<N;i++) cin>>S[i];

    // Norm[t] : Norm(t)
    // NN[t] : Norm(t) の個数
    // Pair[t] : Pair(t)
    map<ll,ll> Norm,NN,Pair;
    for(int i=0;i<N;i++){
        ll s = S[i];
        ll n = 1;       // norm(s)
        ll r = 1;       // pair(s)
        for(ll p : primes){
            if(p>s) break;
            ll cnt=0;
            ll x=0;
            while(s%p==0){
                x++;
                assert(x<100);
                cnt++;
                s/=p;
            }
            cnt%=3;

            if(cnt==1){
                n *= p;
                r *= p*p;
            }else if(cnt==2){
                n *= p*p;
                r *= p;
            }
        }

        if(s > 1){
            if(prime2.count(s)){
                //sは素数の2乗
                n *= s;
                r *= prime2[s];
            }else{
                n *= s;
                r *= s*s;
            }
        }

        NN[n]++;
        Norm[S[i]]=n;
        Pair[S[i]]=r;
        if(n==1){
            assert(n==p);
        }
        if(n==1) f=true;
    }

    ll ans = 0;
    if(f) ans++;


    map<ll,bool> used;
    for(int i=0;i<N;i++){
        ll n = Norm[S[i]];
        ll p = Pair[S[i]];


        if(n==1) continue;
        if(used[n]){
            if(used[p]) continue;
            ans += NN[p];
        }else if(used[p]){
            if(used[n]) continue;
            ans += NN[n];
        }else{
            if(NN[n] >= NN[p]){
                ans += NN[n];
            }else{
                ans += NN[p];
            }
        }
        used[n]=used[p]=true;
    }

    cout << ans << endl;
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:1:
a.cc: In function 'int main()':
a.cc:92:23: error: 'p' was not declared in this scope
   92 |             assert(n==p);
      |                       ^
Language: C++

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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

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

#define MAX_P 3000

ll N;
vector<ll> primes;
map<ll,ll> prime2;

void getPrime(ll n){
    vector<bool> p(n+10,true);

    for(ll i=2;i<=n;i++){
        if(!p[i]) continue;
        if(p[i]) primes.push_back(i);

        for(ll j=2;i*j<=n;j++) p[i*j] = false;
    }
}

int main(){
    bool f=false;
    getPrime(MAX_P);
    for(ll p : primes) prime2[p*p]=p;

    cin>>N;
    vector<ll> S(N);
    for(int i=0;i<N;i++) cin>>S[i];

    // Norm[t] : Norm(t)
    // NN[t] : Norm(t) の個数
    // Pair[t] : Pair(t)
    map<ll,ll> Norm,NN,Pair;
    for(int i=0;i<N;i++){
        ll s = S[i];
        ll n = 1;       // norm(s)
        ll r = 1;       // pair(s)
        for(ll p : primes){
            if(p>s) break;
            ll cnt=0;
            ll x=0;
            while(s%p==0){
                x++;
                assert(x<100);
                cnt++;
                s/=p;
            }
            cnt%=3;

            if(cnt==1){
                n *= p;
                r *= p*p;
            }else if(cnt==2){
                n *= p*p;
                r *= p;
            }
        }

        if(s > 1){
            if(prime2.count(s)){
                //sは素数の2乗
                n *= s;
                r *= prime2[s];
            }else{
                n *= s;
                r *= s*s;
            }
        }

        NN[n]++;
        Norm[S[i]]=n;
        Pair[S[i]]=r;
        if(n==1){
            assert(n==p);
        }
        if(n==1) f=true;
    }

    ll ans = 0;
    if(f) ans++;


    map<ll,bool> used;
    for(int i=0;i<N;i++){
        ll n = Norm[S[i]];
        ll p = Pair[S[i]];


        if(n==1) continue;
        if(used[n]){
            if(used[p]) continue;
            ans += NN[p];
        }else if(used[p]){
            if(used[n]) continue;
            ans += NN[n];
        }else{
            if(NN[n] >= NN[p]){
                ans += NN[n];
            }else{
                ans += NN[p];
            }
        }
        used[n]=used[p]=true;
    }

    cout << ans << endl;
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:1:
a.cc: In function 'int main()':
a.cc:92:23: error: 'p' was not declared in this scope
   92 |             assert(n==p);
      |                       ^
Language: C++

#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define li long long
#define itn int

using namespace std;

inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

int gcd(int x, int y){
	while (y){
		x %= y;
		swap(x, y);
	}
	return x;
}

const int mod = 1000000007;

long long pw(long long a, long long b){
	long long res = 1;
	while (b){
		if (b & 1ll)
			res = res * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return res;
}

const int N = 111111;
int pr[N];

inline long long myrand(){
	return 1ll * RAND_MAX * rand() + rand();
}

const int sz = 11000;
pair<bitset<2 * sz>, int> h[N];
// bitset<2 * sz> heh;

// inline bool ok(const bitset<2 * sz>& b){
// 	return ((b & heh) == ((b >> 1) & heh));
// }

int main(){

	for (int i = 2; i < N; i++){
		if (pr[i] == 0){
			pr[i] = i;
			if (1.0 * i * i < N + N){
				for (int j = i * i; j < N; j += i){
					if (pr[j] == 0){
						pr[j] = i;
					}
				}
			}
		}
	}
	vector<int> primes;
	for (int i = 2; i < N; i++){
		if (pr[i] == i){
			primes.push_back(i);
		}
	}

	int n = nxt();
	// vector<pair<vector<int>, int>> h(n); 
	for (int i = 0; i < n; i++){
		long long x;
		scanf("%lld", &x);
		int cnt = 0;
		if (x > 1){
			for (int j = 0; j < primes.size(); j++){
				int p = primes[j];
				if (x % p == 0){
					int c = 0;
					while (x % p == 0){
						c++;
						x /= p;
					}
					c %= 3;
					if (c){
						h[i].first[j] = 1;
						if (c == 1)
							h[i].second |= (1 << cnt);
						cnt++;
					}
				}
			}
		}
		if (x > 1){
			h[i].first[primes.size()] = 1;
		}
	}

	// for (int i = 0; i < n; i++){
	// 	cerr << "{";
	// 	for (int j = 0; j < h[i].first.size(); j++){
	// 		if (j)
	// 			cerr << ", ";
	// 		cerr << h[i].first[j];
	// 	}
	// 	cerr << "}, ";
	// 	for (int j = 0; j < h[i].first.size(); j++){
	// 		cerr << ((h[i].second & (1 << j)) ? "1" : "0");
	// 	}
	// 	cerr << "\n";
	// }

	// sort(all(h));

	vector<int> ph(n);
	int pp = 0;
	for (int j = 0; j < sz; j++){
		int l = 0;
		for (int i = 0; i < n; i++){
			if (i == 0 || ph[i] != ph[i - 1]){
				++pp;
				while (l < i){
					ph[l++] = pp;
				}
			} else {
				if (h[i].first[j] == 0){
					swap(h[i], h[l++]);
				}
			}
		}
	}

	int ans = 0;
	int i = 0;
	if (h[0].first.count() == 0){
		ans++;
		while (i < n && h[i].first.empty())
			i++;
	}
	while (i < n){
		int l = i;
		while (i < n && h[i].first == h[l].first)
			i++;
		int r = i - 1;
		int q = (1 << ((int)h[l].first.count())) - 1;
		while (l <= r){
			if (h[l].second + h[r].second < q){
				l++;
				ans++;
			} else if (h[l].second + h[r].second > q){
				r--;
				ans++;
			} else {
				int c1 = 0, c2 = 0;
				int w = h[l].second;
				while (l < i && h[l].second == w){
					c1++;
					l++;
				}
				while (r >= 0 && h[r].second == q - w){
					c2++;
					r--;
				}
				ans += max(c1, c2);
			}
		}
	}

	printf("%d\n", ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:140:44: error: 'class std::bitset<22000>' has no member named 'empty'
  140 |                 while (i < n && h[i].first.empty())
      |                                            ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
class Disjointset {
public:
  vector<int> rank,p;
  Disjointset(){}
  Disjointset(int size){
    rank.resize(size,0);
    p.resize(size,0);
    for(int i=0;i<size;i++) makeSet(i);
  }
  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
  }
  bool same(int x,int y){
    return findSet(x)==findSet(y);
  }
  void unite(int x,int y){
    link(findSet(x),findSet(y));
  }
  void link(int x,int y){
    if(rank[x]>rank[y]) {
      p[y]=x;
    }else {
      p[x]=y;
      if(rank[x]==rank[y]) rank[y]++;
    }
  }
  int findSet(int x){
    if(x!=p[x]) p[x]=findSet(p[x]);
    return p[x];
  }
  
};
typedef long long ll;
int main(){
  int n;
  cin>>n;
  ll s[n];
  ll i,j,k;
  for(i=0;i<n;i++) cin >> s[i];
  Disjointset d=Disjointset(n);
  bool used[n];
  fill(used,used+n,false);
  for(i=0;i<n;i++){
    if(used[i]) continue;
    for(j=i+1;j<n;j++){
      if(max(s[i],s[j])%min(s[i],s[j])) continue;
      k= powl(max(s[i],s[j])/min(s[i],s[j]),1.0/3);
      //cout << k << ":" << s[i]*s[j] << endl;
      if((k-1)*(k-1)*(k-1)==max(s[i],s[j])/min(s[i],s[j])) d.unite(i,j);
      if(k*k*k==max(s[i],s[j])/min(s[i],s[j])]) d.unite(i,j);
      if((k+1)*(k+1)*(k+1)==max(s[i],s[j])/min(s[i],s[j])) d.unite(i,j);
    }
  }
  ll ans=0;
  for(i=0;i<n;i++) if(d.p[i]==i) ans++;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:46: error: expected ')' before ']' token
   53 |       if(k*k*k==max(s[i],s[j])/min(s[i],s[j])]) d.unite(i,j);
      |         ~                                    ^
      |                                              )
a.cc:53:46: error: expected primary-expression before ']' token
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#ifdef BALBIT
#define IOS()
#define bug(...) fprintf(stderr,"#%d (%s) = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define bug(...)
#endif

const int iinf = 1e9+10;
const ll inf = 1ll<<60;
const ll mod = 1e9+7 ;


void GG(){cout<<"0\n"; exit(0);}

ll mpow(ll a, ll n, ll mo = mod){ // a^n % mod
    ll re=1;
    while (n>0){
        if (n&1) re = re*a %mo;
        a = a*a %mo;
        n>>=1;
    }
    return re;
}

ll inv (ll b, ll mo = mod){
    if (b==1) return b;
    return (mo-mo/b) * inv(mo%b,mo) % mo;
}

const int maxn = 1e6+5;


signed main(){
    IOS();
    int n,q; cin>>n>>q;
    vector<ll> lens = {n};
    for (ll i = 0; i<q; ++i) {
        ll x; cin>>x;
        while (SZ(lens) && lens.back() >= x) lens.pop_back();
        lens.pb(x);
    }
    q = SZ(lens);
//    for (ll x : lens) bug(x);
    vector<ll> numat(q);
//    map<ll, ll> mp;
    numat.back() = 1;
    vector<ll> ret(n+1);
    for (int i = q-1; i>=0; --i) {
        if (numat[i] == 0) continue;
        ll me = lens[i];
        while (me > lens[0]) {
            int tt = lower_bound(ALL(lens), me) - lens.begin()-1;
            bug(tt,lens[tt]);
            numat[tt] += numat[i] * ll(me / lens[tt]);
            me = me % lens[tt];
        }
        if (me) ret[me-1] += numat[i];
    }
    for (int i = n; i>=0; --i) {
        if (i!=n) ret[i] += ret[i+1];
    }
    for (int i = 0; i<n; ++i) {
        cout<<ret[i]<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:72:37: note: in expansion of macro 'll'
   72 |             numat[tt] += numat[i] * ll(me / lens[tt]);
      |                                     ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define N 100005
#define MXN 200005
int main(){
    int n,q;
    scanf("%d %d",&n,&q);
    /*if(q==0){
        for(int i = 0;i<n;i++){
            printf("%d\n",1);
        }
        return 0;
    }*/
    vector<LL> v;
    v.pb(n);
    for(int i = 0;i<q;i++){
        LL x;
        scanf("%lld",&x);
        while(!v.empty()&&x<v.back())v.pop_back();
        v.pb(x);
    }
    //printf("%d\n",v.size());
    if(v.size()==1){
        for(int i = 0;i<n;i++){
            if(i<v[0])printf("1\n");
            else printf("0\n");
        }
        return 0;
    }
   // reverse(v.begin(),v.end());
    LL now=1;
    map<LL,LL> m;
    for(int i = v.size()-2;i>=0;i--){
        if(v[i+1]%v[i]!=0)
        m[v[i+1]%v[i]]+=now;
        now*=v[i+1]/v[i];
        while(!m.empty()&&m.rbegin()->x>v[i]){
            now+=m.rbegin()->x/v[i]*m.rbegin()->y;
            if(m.rbegin->x%v[i]!=0)
            m[m.rbegin()->x%v[i]]+=m.rbegin()->y;
            m.erase(m.rbegin()->x);
        }
    }
  //  printf("%lld\n",now);
    LL ans[100005];
    MEM(ans);
    for(auto it:m){
        ans[it.x]=it.y;
    }
    ans[v[0]]=now;
    for(int i = n-1;i>=1;i--)
    ans[i]+=ans[i+1];
    for(int i = 1;i<=n;i++)
    printf("%lld\n",ans[i]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:18: error: invalid use of member function 'std::map<long long int, long long int>::rbegin' (did you forget the '()' ?)
   58 |             if(m.rbegin->x%v[i]!=0)
      |                ~~^~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
#define ll long long
using namespace std;
namespace IO
{
    const int __S=(1<<20)+5;char __buf[__S],*__H,*__T;
    inline char getc()
    {
        if(__H==__T) __T=(__H=__buf)+fread(__buf,1,__S,stdin);
        if(__H==__T) return -1;return *__H++;
    }
    template <class __I>inline void read(__I &__x)
    {
        __x=0;int __fg=1;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1,__c=getc();
        while(isdigit(__c)) __x=__x*10+__c-'0',__c=getc();
        __x*=__fg;
    }
    inline void readd(double &__x)
    {
        __x=0;double __fg=1.0;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1.0,__c=getc();
        while(isdigit(__c)) __x=__x*10.0+__c-'0',__c=getc();
        if(__c!='.'){__x=__x*__fg;return;}else while(!isdigit(__c)) __c=getc();
        double __t=1e-1;while(isdigit(__c)) __x=__x+1.0*(__c-'0')*__t,__t=__t*0.1,__c=getc();
        __x=__x*__fg;
    }
    inline void reads(char *__s,int __x)
    {
        char __c=getc();int __tot=__x-1;
        while(__c<'a'||__c>'z') __c=getc();
        while(__c>='a'&&__c<='z') __s[++__tot]=__c,__c=getc();
        __s[++__tot]='\0';
    }
    char __obuf[__S],*__oS=__obuf,*__oT=__oS+__S-1,__c,__qu[55];int __qr;
    inline void flush(){fwrite(__obuf,1,__oS-__obuf,stdout);__oS=__obuf;}
    inline void putc(char __x){*__oS++ =__x;if(__oS==__oT) flush();}
    template <class __I>inline void print(__I __x)
    {
        if(!__x) putc('0');
        if(__x<0) putc('-'),__x=-__x;
        while(__x) __qu[++__qr]=__x%10+'0',__x/=10;
        while(__qr) putc(__qu[__qr--]);
    }
    inline void prints(const char *__s,const int __x)
    {
        int __len=strlen(__s+__x);
        for(int __i=__x;__i<__len+__x;__i++) putc(__s[__i]);
    }
    inline void printd(long double __x,int __d)
    {
        long long __t=(long long)floor(__x);print(__t);putc('.');__x-=(double)__t;
        while(__d--)
        {
            long double __y=__x*10.0;__x*=10.0;
            int __c=(int)floor(__y+1e-9);if(__c==10) __c--;
            putc(__c+'0');__x-=floor(__y);
        }
    }
    inline void el(){putc('\n');}inline void sp(){putc(' ');}
}using namespace IO;
int n,T,m,N;
ll s[100010],f[100010],ans[100010],tmp;
int main(){
	read(n);read(T);int i;ll remain,now,k;
	while(T--){
		read(tmp);
		while(m&&s[m]>=tmp) s[m--]=0;
		s[++m]=tmp;
	}
	if(m&&s[1]<n){
		N=n;n=s[1];
		for(i=1;i<m;i++) s[i]=s[i+1];m--;
	}
	s[0]=n;f[m]=1;
	for(i=m;i>=0;i--){
		remain=s[i];now=i-1;
		while(remain>n){
			k=remain/s[now];
			f[now]+=f[i]*k;remain-=s[now]*k;
			now=upper_bound(s,s+now,remain)-s-1;
		}
		ans[1]+=f[i];ans[remain+1]-=f[i];
	}
	for(i=1;i<=n;i++) ans[i]+=ans[i-1],print(ans[i]),el();
	while(n<N) n++,print(0),el();
	flush();
}

Compiler output:
a.cc: In function 'void IO::printd(long double, int)':
a.cc:58:34: error: 'floor' was not declared in this scope
   58 |         long long __t=(long long)floor(__x);print(__t);putc('.');__x-=(double)__t;
      |                                  ^~~~~
Language: C++

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 200020
using namespace std;
LL read(){
	LL nm=0,fh=1; LL cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
LL n,T,m,p[M],N,G[M],F[M],K[M],fs[M*30],nt[M*30],to[M*30],len[M*30],tmp;
void link(LL x,LL y,LL dst){nt[tmp]=fs[x],fs[x]=tmp,to[tmp]=y,len[tmp++]=dst;}
LL main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),T=read(),memset(fs,-1,sizeof(fs));
	while(T--){LL x=read(); while(m&&p[m]>=x) m--; p[++m]=x;}
	if(m&&p[1]<n){N=n,n=p[1];for(LL i=1;i<m;i++) p[i]=p[i+1];m--;}
//	for(LL i=1;i<=m;i++) printf("%lld\n",p[i]);
//	printf("n = %lld\n",n);
	G[0]=p[0]=n,F[m]=1;
	for(LL i=1;i<=m;i++){
		LL res=p[i],now=i-1;
		while(res>n){
			if(res>=p[now]){LL k=res/p[now]; link(i,now,k),res-=k*p[now];}
			now=lower_bound(p,p+now+1,res)-p;
		} G[i]=res;
	}
	for(LL i=n;i>=0;i--){
		for(LL j=fs[i];j!=-1;j=nt[j]) F[to[j]]+=F[i]*len[j];
		K[1]+=F[i],K[G[i]+1]-=F[i];
	}
	for(LL i=1;i<=n;i++) K[i]+=K[i-1],printf("%lld\n",K[i]);
	while(n<N) n++,putchar('0'),putchar('\n');
	return 0;
}

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

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;
typedef long long ll;
int n,q,top;
ll a[MAXN],op[MAXN],t[MAXN],d[MAXN];
inline int getnext(ll k,int r)
{
	int l=1,mid,ret=-1;
	while(l<=r){
		mid=(l+r)>>1;
		if(op[mid]<=k)l=mid+1,ret=mid;
		else r=mid-1;
	}
	return ret;
}
int main()
{
	scanf("%d%d",&n,&q);
	stk[++top]=n;
	for(int i=1;i<=q;++i){
		scanf("%lld",a+i);
		while(top && op[top]>=a[i])--top;
		op[++top]=a[i];
	}
	ll k;
	t[top]=1;
	for(int i=top;i;--i){
		k=op[i];
		while(k){
			int p=getnext(k,i-1);
			if(p==-1)break;
			t[p]+=k/op[p]*t[i];
			k%=op[p];
		}
		d[1]+=t[i],d[k+1]-=t[i];
	}
	for(int i=1;i<=n;++i)
		printf("%lld\n",d[i]+=d[i-1]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'stk' was not declared in this scope; did you mean 'std'?
   22 |         stk[++top]=n;
      |         ^~~
      |         std
Language: C++

#include<bits/stdc++.h>
#define N (100009)
#define ll long long
using namespace std;
ll n,q,x,a[N],c,A[N],f[N];
ll main()
{
	cin>>n>>q;
	a[++c]=n;
	for (ll i=1; i<=q; ++i)
	{
		cin>>x;
		while (c && x<=a[c]) --c;
		a[++c]=x;
	}
	f[c]=1;
	for (ll i=c; i; --i)
	{
		ll k=a[i];
		while (k>a[1])
		{
			ll t=lower_bound(a+1,a+c+1,k)-a-1;
			f[t]+=f[i]*(k/a[t]);
			k%=a[t];
		}
		A[k]+=f[i];
	}
	for (ll i=n; i; --i) A[i]+=A[i+1];
	for (ll i=1; i<=n; ++i) cout<<A[i]<<endl;
}

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

#include<bits/stdc++.h>

typedef long long LL;
using namespace std;

const int MX=100005;
int n,Q;
LL a[MX],dt[MX],t[MX],x,cur,c;

int main(){
	cin>>n>>Q,a[++c]=n;
	for(int i=1;i<=Q;i++){cin>>x;while(c&&x<=a[c])--c;a[++c]=x;}
	t[c]=1;
	for(int i=c;i;i--){
		LL tmp=a[i],it=lower_bound(a+1,a+i,tmp)-a;
		for(;it;it=lower_bound(a+1,a+it,tmp)-a)t[it]+=(tmp/a[it])*t[i],tmp%=a[it];
		dt[1]+=t[i],dt[tmp+1]-=t[i];
	}
	for(int i=1;i<=n;i++)cout<<(cur+=dt[i]))<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:48: error: expected ';' before ')' token
   19 |         for(int i=1;i<=n;i++)cout<<(cur+=dt[i]))<<endl;
      |                                                ^
      |                                                ;
Language: C++

#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int maxn=100000+10,maxtot=maxn*25;
ll ans[maxn],cnt[maxn],a[maxn],b[maxn],tree[maxtot],p[maxn][70][2];
int root[maxn],left[maxtot],right[maxtot],rank[maxn];
int len[maxn];
int i,j,k,l,t,n,m,tot,top,num;
int newnode(int x){
	tree[++tot]=tree[x];
	left[tot]=left[x];
	right[tot]=right[x];
	return tot;
}
void insert(int &x,int l,int r,int a,int b){
	x=newnode(x);
	tree[x]=b;
	if (l==r) return;
	int mid=(l+r)/2;
	if (a<=mid) insert(left[x],l,mid,a,b);else insert(right[x],mid+1,r,a,b);
}
int query(int x,int l,int r,int a,int b){
	if (!x||a>b) return 0;
	if (l==a&&r==b) return tree[x];
	int mid=(l+r)/2;
	if (b<=mid) return query(left[x],l,mid,a,b);
	else if (a>mid) return query(right[x],mid+1,r,a,b);
	else return max(query(left[x],l,mid,a,mid),query(right[x],mid+1,r,mid+1,b));
}
void solve(int x,ll l){
	int t=upper_bound(b+1,b+num+1,l)-b-1;
	int y=query(root[x-1],1,num,1,t);
	if (!y){
		if (l>=n){
			p[i][++top][0]=0;
			p[i][top][1]=l%n;
			l%=n;
		}
		p[i][++top][0]=l;
		return;
	}
	p[i][++top][0]=y;
	p[i][top][1]=l/a[y];
	solve(y,l%a[y]);
}
int main(){
	scanf("%d%d",&n,&m);
	a[0]=n;
	fo(i,1,m) scanf("%lld",&a[i]),b[i]=a[i];
	//b[++m]=n;
	sort(b+1,b+m+1);
	num=unique(b+1,b+m+1)-b-1;
	b[++num]=2000000000000000000;
	fo(i,1,m) rank[i]=lower_bound(b+1,b+num+1,a[i])-b;
	fo(i,1,m){
		root[i]=root[i-1];
		insert(root[i],1,num,rank[i],i);
	}
	fo(i,1,m){
		top=0;
		solve(i,a[i]);
		len[i]=top;
	}
	cnt[m]=1;
	fd(i,m,1){
		fo(j,1,len[i]-1)
			cnt[p[i][j][0]]+=cnt[i]*p[i][j][1];
		ans[p[i][len[i]][0]]+=cnt[i];
	}
	ans[n]+=cnt[0];
	fd(i,n,1) ans[i]+=ans[i+1];
	fo(i,1,n) printf("%lld\n",ans[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:19: error: reference to 'rank' is ambiguous
   57 |         fo(i,1,m) rank[i]=lower_bound(b+1,b+num+1,a[i])-b;
      |                   ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:43: note:                 'int rank [100010]'
    9 | int root[maxn],left[maxtot],right[maxtot],rank[maxn];
      |                                           ^~~~
a.cc:60:38: error: reference to 'rank' is ambiguous
   60 |                 insert(root[i],1,num,rank[i],i);
      |                                      ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:43: note:                 'int rank [100010]'
    9 | int root[maxn],left[maxtot],right[maxtot],rank[maxn];
      |                                           ^~~~
Language: C++

#include<bits/stdc++.h>
#define MX 30001000
using namespace std;
struct treaps
{
	int son[MX][2],num[MX],cop[MX],inn[MX],tt;
	long long size[MX],ans[MX];
	int newnode(int s=0)
	{
		if (tt>MX) assert(0); 
		int t=++tt;
		son[t][0]=son[s][0];
		son[t][1]=son[s][1];
		size[t]=size[s];
		num[t]=num[s];
		return t;
	}
	void update(int s) {size[s]=size[son[s][0]]+size[son[s][1]]+1;}
	int merge(int s,int t)
	{
		if (!s) return t;if (!t) return s;
		if (rand()*(1ll<<31)+rand())%(size[s]+size[t])<size[s])
		{
			int d=newnode(s);
			son[d][1]=merge(son[d][1],t);
			update(d);
			return d;
		}
		else
		{
			int d=newnode(t);
			son[d][0]=merge(s,son[d][0]);
			update(d);
			return d;
		}
	}
	pair<int,int> split(int s,long long k)
	{
		if (!s) return pair<int,int>(0,0);
		if (size[son[s][0]]>=k)
		{
			pair<int,int> ls=split(son[s][0],k);
			int d=newnode(s);
			son[d][0]=ls.second;update(d);
			return pair<int,int>(ls.first,d);
		}
		pair<int,int> ls=split(son[s][1],k-size[son[s][0]]-1);
		int d=newnode(s);
		son[d][1]=ls.first;update(d);
		return pair<int,int>(d,ls.second);
	}
	void clear(int& s){s=0;}
	void push_back(int& s,int w)
	{
		int t=newnode();
		size[t]=1;num[t]=w;
		s=merge(s,t);
	}
	void pop_back(int& s)
	{
		s=split(s,size[s]-1).first;
	}
	/*int findkth(int s,int k)
	{
		if (size[son[s][0]]>=k) return findkth(son[s][0],k);
		if (size[son[s][0]]+1==k) return num[s];
		return findkth(son[s][1],k-(size[son[s][0]]+1));
	}*/
	void work(int n,int root)
	{
		for (int i=1;i<=tt;i++) {inn[son[i][0]]++;inn[son[i][1]]++;size[i]=(i==root);}
		int head=0,tail=0;
		for (int i=1;i<=tt;i++) if (inn[i]==0) cop[++head]=i;
		while (head!=tail)
		{
			int s=cop[++tail];ans[num[s]]+=size[s];
			inn[son[s][0]]--;inn[son[s][1]]--;size[son[s][0]]+=size[s];size[son[s][1]]+=size[s];
			if (inn[son[s][0]]==0) cop[++head]=son[s][0];
			if (inn[son[s][1]]==0) cop[++head]=son[s][1];
		}
		for (int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	}			
}treap; 
int main()
{
	//freopen("01.txt","r",stdin);
	//freopen("my.out","w",stdout);
	int n,q,root=0;scanf("%d%d",&n,&q);
	for (int i=1;i<=n;i++) treap.push_back(root,i);
	while (q--)
	{//if (q%100==0) cerr<<q<<endl;
		long long w;scanf("%lld",&w);
		while (treap.size[root]<w) root=treap.merge(root,root);
		root=treap.split(root,w).first;
	}
	treap.work(n,root);
	//cerr<<treap.tt<<endl;
}

Compiler output:
a.cc: In member function 'int treaps::merge(int, int)':
a.cc:22:45: error: expected primary-expression before '%' token
   22 |                 if (rand()*(1ll<<31)+rand())%(size[s]+size[t])<size[s])
      |                                             ^
a.cc:36:9: warning: control reaches end of non-void function [-Wreturn-type]
   36 |         }
      |         ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
#define LL long long
using namespace std;
const int maxn=500001;
int n,q,sz=1;
LL a,st[maxn],cnt[maxn],sum[maxn],lazy[maxn];
inline int find(int l,int r,LL key)
{
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(st[mid]>=key) 
		r=mid-1;
		else l=mid+1;
	}
	return r;
}
inline void split(LL now,int pos,LL num)
{
	if(now==0) return ;
	if(now<=st[1])
	{
		cnt[now]+=num;
		return ;
	}
	/*if(pos==1)
	printf("NO");*/
	LL k1=now/st[pos-1],k2=now%st[pos-1];
	int pos2=find(1,pos,k2);
	lazy[pos-1]+=k1*num;
	//split(st[pos-1],pos-1,k1*num);
	split(k2,pos2+1,num);
}
int main()
{
    int size = 64 << 20; // 256MB
    char *p = (char*)malloc(size) + size;
    __asm__("movl %0, %%esp\n" :: "r"(p));
	scanf("%d %d",&n,&q);
	st[1]=n;
	for(int i=1;i<=q;i++)
	{
		scanf("%lld",&a);
		if(st[sz]<a)
		st[++sz]=a;
		else
		{
			while(st[sz]>=a)
			sz--;
			st[++sz]=a;
		}
	}
	lazy[sz]=1;
	for(int i=sz;i>=1;i--)
	split(st[i],i,lazy[i]);
	for(int i=st[1];i>=1;i--)
	{
		sum[i]=sum[i+1]+cnt[i];
	}
	for(int i=1;i<=n;i++)
	printf("%lld\n",sum[i]);
	return 0;
}

Compiler output:
a.cc: Assembler messages:
a.cc:40: Error: operand type mismatch for `mov'