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

l = int(input())
le = l.bit_length()
li = []
for i in range(1, le):
    li.append([i, i + 1, 0])
    li.append([i, i + 1, 1 << (i - 1)])
for i in range(1, le):
    if (1 << (i - 1)) & l:
        l -= 1 << (i - 1)
        li.append([i, le, l])
print(le, len(li))
for i in range(len(li)):
    print(*li[i])

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

#include<bits/stdc++.h>

using namespace std;

const int N=65;
int u[N],v[N],w[N],cnt;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int L;
    cin>>L;
    int n=log2(L)+1;
    cnt=0;
    for(int i=1;i<n;i++)
    {
        cnt++;
        u[cnt]=i,v[cnt]=i+1,w[cnt]=0;
        cnt++;
        u[cnt]=i,v[cnt]=i+1,w[cnt]=(1<<(i-1));
    }
    if((i<<n-1)!=L)
    {
        for(int i=1;i<n;i++)
        {
            if(L>>(i-1)&1)
            {
                L-=(1<<(i-1));
                cnt++;
                u[cnt]=i;
                v[cnt]=n;
                w[cnt]=L;
            }
        }
    }
    cout<<n<<' '<<cnt<<'\n';
    for(int i=1;i<=cnt;i++) cout<<u[i]<<' '<<v[i]<<' '<<w[i]<<'\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'i' was not declared in this scope
   23 |     if((i<<n-1)!=L)
      |         ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <x86intrin.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#define BIT(nr) (1ULL << (nr))
#define int long long
//#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }


using namespace std;

signed main() {

    int L;
    cin >> L;
    vector<pair<pair<int, int>, int> > p;
    int mx = 64 - lzcnt(L) - 1;

    //最大以外の各桁について0, 1の辺を張る
    rep(i, 19) {
        p.push_back({ { i, i + 1 }, 0 });
    }
    rep(i, mx) {
        p.push_back({ {i, i + 1}, 1 << (mx - i - 1) });
    }
    RREP(i, mx) {
        int v = mx - i - 1;
        if (L & 1 << i) {
            p.push_back({ { 0, v + 1 } , ((L >> (i + 1))) << (i + 1) });
        }
    }
    cout << 20 << ' ' << p.size() << endl;
    //最大桁は最初のノードから生える辺で立てる、最大桁が立っている場合はそれ以外のけたでL未満であることが確定する必要がある
    for (auto pa : p) {
        cout << pa.first.first + 1 << " " << pa.first.second + 1 << " " << pa.second << "\n";
    }


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:19: error: 'lzcnt' was not declared in this scope
   50 |     int mx = 64 - lzcnt(L) - 1;
      |                   ^~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <x86intrin.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#define BIT(nr) (1ULL << (nr))
#define int long long
//#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }


using namespace std;

signed main() {

    int L;
    cin >> L;
    vector<pair<pair<int, int>, int> > p;
    int mx = 64 - _lzcnt_u64(L) - 1;

    //最大以外の各桁について0, 1の辺を張る
    rep(i, 19) {
        p.push_back({ { i, i + 1 }, 0 });
    }
    rep(i, mx) {
        p.push_back({ {i, i + 1}, 1 << (mx - i - 1) });
    }
    RREP(i, mx) {
        int v = mx - i - 1;
        if (L & 1 << i) {
            p.push_back({ { 0, v + 1 } , ((L >> (i + 1))) << (i + 1) });
        }
    }
    cout << 20 << ' ' << p.size() << endl;
    //最大桁は最初のノードから生える辺で立てる、最大桁が立っている場合はそれ以外のけたでL未満であることが確定する必要がある
    for (auto pa : p) {
        cout << pa.first.first + 1 << " " << pa.first.second + 1 << " " << pa.second << "\n";
    }


    return 0;
}


Compiler output:
In file included from /usr/lib/gcc/x86_64-linux-gnu/14/include/x86gprintrin.h:61,
                 from /usr/lib/gcc/x86_64-linux-gnu/14/include/x86intrin.h:27,
                 from a.cc:3:
/usr/lib/gcc/x86_64-linux-gnu/14/include/lzcntintrin.h: In function 'int main()':
/usr/lib/gcc/x86_64-linux-gnu/14/include/lzcntintrin.h:64:1: error: inlining failed in call to 'always_inline' 'long long unsigned int _lzcnt_u64(long long unsigned int)': target specific option mismatch
   64 | _lzcnt_u64 (unsigned long long __X)
      | ^~~~~~~~~~
a.cc:50:29: note: called from here
   50 |     int mx = 64 - _lzcnt_u64(L) - 1;
      |                   ~~~~~~~~~~^~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#define BIT(nr) (1ULL << (nr))
#define int long long
//#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }


using namespace std;


signed main() {

    int L;
    cin >> L;
    vector<pair<pair<int, int>, int> > p;
    int mx = 64 - __lzcnt64(L) - 1;

    //最大以外の各桁について0, 1の辺を張る
    rep(i, 19) {
        p.push_back({ { i, i + 1 }, 0 });
    }
    rep(i, mx) {
        p.push_back({ {i, i + 1}, 1 << (mx - i - 1) });
    }
    RREP(i, mx) {
        int v = mx - i - 1;
        if (L & 1 << i) {
            p.push_back({ { 0, v + 1 } , ((L >> (i + 1))) << (i + 1) });
        }
    }
    cout << 20 << ' ' << p.size() << endl;
    //最大桁は最初のノードから生える辺で立てる、最大桁が立っている場合はそれ以外のけたでL未満であることが確定する必要がある
    for (auto pa : p) {
        cout << pa.first.first + 1 << " " << pa.first.second + 1 << " " << pa.second << "\n";
    }


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:19: error: '__lzcnt64' was not declared in this scope; did you mean '__lrintf64'?
   50 |     int mx = 64 - __lzcnt64(L) - 1;
      |                   ^~~~~~~~~
      |                   __lrintf64
Language: C++

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

constexpr int DEBUG = 1;

struct Edge {
  int from, to, w;
};

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

  int l;
  cin >> l;
  int n = fls(l);

  vector<Edge> edges;
  for (int i = 0; i < n - 2; i++) {
    edges.push_back(Edge({i + 1, i, 0}));
    edges.push_back(Edge({i + 1, i, 1 << i}));
  }


  int current = 1 << (n - 1);
  int r = l - (1 << (n - 1));
  while (r > 0) {
    int v = fls(r) - 1;
    edges.push_back(Edge({n - 1, v, current}));
    current += 1 << v;
    r -= 1 << v;
  }

  cout << n << " " << edges.size() << endl;
  for (const auto& edge : edges) {
    int output_from = n - edge.from;
    int output_to = n - edge.to;
    cout << output_from << " " << output_to << " " << edge.w << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'fls' was not declared in this scope; did you mean 'ffs'?
   19 |   int n = fls(l);
      |           ^~~
      |           ffs
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define FAST ios::sync_with_stdio(false); cin.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define ins insert
#define ph push
#define mmst(x,v) memset(x,v,sizeof(x))
#define all(x) (x).begin(), (x).end()
#define LLINF ((long long)1e18)
#define cbr cerr << "hi\n"
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<e;i++)
#define MAXN 300006
#define siz(x) ((ll)x.size())
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
ll L, r, N, H;
vector<tuple<ll,ll,ll>>ans;
int main()
{
	FAST
	cin >> L;
	for(ll i=20;i>=0;i--) {
		if((1<<i)&L) { r = i; break; }
	}
	N = r+1; assert(N>1);
	for(ll i = 1; i < N; i++) {
		ans.pb(make_tuple(i,i+1,(1<<(i-1))));
		ans.pb(make_tuple(i,i+1,0));
		H=max(H,(1ll<<(i-1)));
	}
	H = (1<<(n-1));
	for(ll i = 0; i < r; i++) {
		if(!((1<<i)&L)) continue;
		assert(H<=(ll)1e6);ans.pb(make_tuple(i+1,N,H));
		H+=(1<<i);
	}
  assert(N<=20&&siz(ans)<=60);
	cout<<N<<' '<<siz(ans)<<'\n';
	for(auto i : ans) {
		cout << get<0>(i) << ' ' << get<1>(i) << ' ' << get<2>(i) << '\n';
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: 'n' was not declared in this scope
   35 |         H = (1<<(n-1));
      |                  ^
Language: C++

#include <cstdio>

int n, m, L;

struct Edge {
	Edge() {}
	Edge(int _u, int _v, int _w) {
		u = _u, v = _v, w = _w;
	}
	int u, v, w;
} e[65];

void addedge(int u, int v, int w) {
	e[++m] = Edge(u, v, w);
}
int main() {
	scanf("%d", &L);
	for (; (1 << n) - 1 < L; n++);
	for (int i = 1; i < n; i++) {
		add(i, i + 1, 1 << (i - 1));
		add(i, i + 1, 0);
	}
	for (int i = 1; i < n; i++) {
		if (L & (1 << (i - 1))) add(i, n, (L >> i) << i);
	}
	printf("%d %d\n", n, m);
	for (int i = 1; i <= m; i++) {
		printf("%d %d %d\n", e[i].u, e[i].v, e[i].w);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'add' was not declared in this scope
   20 |                 add(i, i + 1, 1 << (i - 1));
      |                 ^~~
a.cc:24:41: error: 'add' was not declared in this scope
   24 |                 if (L & (1 << (i - 1))) add(i, n, (L >> i) << i);
      |                                         ^~~
Language: C++

#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

ll yowayowa = 0;

ll powo(ll x, ll y) {
	ll ans = 1;
	REP(i, 1, y) {
		ans *= x;
	}
	return ans;
}


ll const MAX = 30;
vector<vector<edge>> G(MAX);

vll u(30);

int main() {
	REP (i, 0, 24) {
		u[i] = pow(2, i - 1) - 1;
	}
	ll n;
	cin >> n;
	ll goal = 1;
	ll m = 0;
	while (powo(2, goal) <= n) {
		G[goal].push_back({ goal + 1, powo(2,goal - 1) });
		G[goal].push_back({ goal + 1,0 });
		goal++;
		m += 2;
	}
	ll s = u[goal];
	while (s < n) {
		ll tmp = 0;
		while (u[tmp + 1] < n - s) {
			tmp++;
		}
		G[tmp].push_back({ goal, s + 1 });
		m++;
		s += u[tmp] + 1;
	}
	cout << goal << " " << m << endl;
	REP(i, 1, goal) {
		for (auto x : G[i]) {
			cout << i << " " << x.to << " " << x.len << endl;
		}
	}
	

}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:24: error: 'pow' was not declared in this scope; did you mean 'powo'?
   55 |                 u[i] = pow(2, i - 1) - 1;
      |                        ^~~
      |                        powo
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<int> x, y, z;

void push(int a, int b, int c) {
    x.push_back(a);
    y.push_back(b);
    z.push_back(c);
}

void ans() {
    cout << 20 << " " << x.size() << endl;
    for (int i = 0; i < x.size(); i++) {
        cout << 20 - x[i] << " " << 20 - y[i] << " " << z[i] << endl;
    }
}

int main() {
    int L; cin >> L;
    bool flag = false;
    int cnt = 0;
    vector<int> c(20, 0);
    for (int i = 0; i <= 19; i++) {
        c[i] = (1 << i);
        if (i < 19) push(i+1, i, a);
    }
    int max_k;
    while (cnt < L) {
        int k; 
        for (k = 0; k < 19; k++) {
            if (cnt + c[k+1] > L) {
                break;
            }
        }
        if (cnt == 0) max_k = k+1;
        else push(19, k, cnt);
        cnt += c[k];
    }
    for (int i = 0; i < max_k-1; i++) {
        push(i+1, i, (1 << i));
    }
    ans();
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:34: error: 'a' was not declared in this scope
   25 |         if (i < 19) push(i+1, i, a);
      |                                  ^
Language: C++

#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iostream> 
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define eps 1e-18
#define maxn 100010
inline ll read(){ll tmp=0; char c=getchar(),f=1; for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1; for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0'; return tmp*f;}
inline ll power(ll a,ll b){ll ans=1; for(;b;b>>=1){if(b&1)ans=ans*a%mod; a=a*a%mod;} return ans;}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void swap(int &a,int &b){int tmp=a; a=b; b=tmp;}
using namespace std;
int x[110],y[110],d[110];
int a[30],base[30];
int n,m,l;
int main()
{
    l=read();
    if(l<=2){//特判是因为若l<=2，下面建图是时图只有一个点，无法连边
        printf("2 %d\n",l);
        for(int i=0;i<l;i++)
            printf("1 2 %d\n",i);
        return 0;
    }
    int len=0;
    while(1<<len<=l)++len;
    n=len; m=0;
    for(int i=0;i<len-1;i++){//二进制拆分
        x[++m]=i+1; y[m]=i+2; d[m]=0;
        x[++m]=i+1; y[m]=i+2; d[m]=1<<i;
    }
    for(int i=len-2;i>=0;i--)
        if(l&(1<<i)){//其实和数位dp一样啦
            x[++m]=i+1; y[m]=n; d[m]=l>>(i+1)<<(i+1);
        }
    printf("%d %d\n",n,m);
    for(int i=1;i<=m;i++)
        printf("%d %d %d\n",x[i],y[i],d[i]);
    return 0;
}

arc102D

Compiler output:
a.cc:54:1: error: 'arc102D' does not name a type
   54 | arc102D
      | ^~~~~~~
Language: C++

#include <bits/stdc++.h>

#define For(i, j, k) for (int i = j; i <= k; ++ i)
#define Forr(i, j, k) for (int i = j; i >= k; -- i)

using namespace std;

inline void File() {
	freopen("D.in", "r", stdin);
	freopen("D.out", "w", stdout);
}

int L, cnt, h, t;
struct edge { int u, v, w; } E[100];

inline void add(int x, int y, int z) {
	E[++ cnt].u = x, E[cnt].v = y, E[cnt].w = z;
}

int main() {

	cin >> L;
	for (int tt = L; tt; ++ h, tt >>= 1);

	For(i, 1, h - 1) {
		add(i, i + 1, 1 << h - i - 1);
		add(i, i + 1, 0);
	}

	t = 1 << h - 1;
	Forr(i, h - 1, 1) if (l >> (i - 1) & 1) add(1, h - i + 1, t), t += 1 << i - 1;

	cout << h << ' ' << cnt << endl;
	For(i, 1, cnt) printf("%d %d %d\n", E[i].u, E[i].v, E[i].w);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:31: error: 'l' was not declared in this scope
   31 |         Forr(i, h - 1, 1) if (l >> (i - 1) & 1) add(1, h - i + 1, t), t += 1 << i - 1;
      |                               ^
Language: C++

l = int(input())
ed = []
n = 20
for i in range(2, n):
    ed.append([i, i + 1, 0])
    ed.append([i, i + 1, 2 ** (n - 1 - i)])
if l >= 2 ** 19:
    i = 1
    ed.append([i, i + 1, 0])
    ed.append([i, i + 1, 2 ** (n - 1 - i)])
now = 0
for i in range(19, -1, -1):
    if (l >> i) & 1 == 1:
        ed.append([1, n - i, now])
        now += 1 << i
print(n, len(ed))
for i in ed:
    print(i[0], i[1], i[2])


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

20 44
1 2 0
1 2 1
2 3 0
2 3 2
3 4 0
3 4 4
4 5 0
4 5 8
5 6 0
5 6 16
6 7 0
6 7 32
7 8 0
7 8 64
8 9 0
8 9 128
9 10 0
9 10 256
10 11 0
10 11 512
11 12 0
11 12 1024
12 13 0
12 13 2048
13 14 0
13 14 4096
14 15 0
14 15 8192
15 16 0
15 16 16384
16 17 0
16 17 32768
17 18 0
17 18 65536
18 19 0
18 19 131072
19 20 0
19 20 262144
19 20 524288
18 20 786432
17 20 917504
15 20 983040
10 20 999424
7 20 999936


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 20 44
      | ^~
Language: C++

L = int(input().strip())

bL = bin(L)[2:]
N = len(bL)
M = 0
result = []
for i in range(N-1):
    result.append((N-i-1, N-i, pow(2, i)))
    result.append((N-i-1, N-i, 0))
    M += 2

max_n = pow(2, N-1) - 1
for i, j in enumerate(bL[1:][::-1]):
    if j == "1":
        result.append((1, N-i, max_n + 1))
        max_n += pow(2, i)
        M += 1

print(N, M)
for item in result:
    print(item[0], item[1], item[2])


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

const int N=20;
int L,n=20;
struct EDGE {
    int x,y,v;
    inline void print() {
        printf("%d %d %d\n",x,y,v);
    }
}e[66]; int E=0;
inline void add(int u,int v,int w) {
    e[++E]=(EDGE) {u,v,w};
}
signed main() {
    read(L);
    int tmp=L,V=0;
    while(tmp) {
        ++V; tmp>>=1;
    }
    for(int i=1;i<V;i++) {
        add(i,i+1,0);
        add(i,i+1,1<<(V-i-1));
    }
    int now=1<<(V-1);
    for(int i=V-1;i>=1;i--) {
        if(L&(1<<(i-1))) {
            add(1,V-i+1,now);
            now+=1<<(i-1);
            // L-=1<<i;
        }
    }
    printf("%d %d\n",V,E);
    for(int i=1;i<=E;i++) {
        e[i].print();
    }
    return 0;
}

Compiler output:
a.cc: In member function 'void EDGE::print()':
a.cc:6:9: error: 'printf' was not declared in this scope
    6 |         printf("%d %d %d\n",x,y,v);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | const int N=20;
a.cc: In function 'int main()':
a.cc:13:5: error: 'read' was not declared in this scope
   13 |     read(L);
      |     ^~~~
a.cc:30:5: error: 'printf' was not declared in this scope
   30 |     printf("%d %d\n",V,E);
      |     ^~~~~~
a.cc:30:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<bits/stdc++.h>
const int N=20;
int L,n=20;
struct EDGE {
    int x,y,v;
    inline void print() {
        printf("%d %d %d\n",x,y,v);
    }
}e[66]; int E=0;
inline void add(int u,int v,int w) {
    e[++E]=(EDGE) {u,v,w};
}
signed main() {
    read(L);
    int tmp=L,V=0;
    while(tmp) {
        ++V; tmp>>=1;
    }
    for(int i=1;i<V;i++) {
        add(i,i+1,0);
        add(i,i+1,1<<(V-i-1));
    }
    int now=1<<(V-1);
    for(int i=V-1;i>=1;i--) {
        if(L&(1<<(i-1))) {
            add(1,V-i+1,now);
            now+=1<<(i-1);
            // L-=1<<i;
        }
    }
    printf("%d %d\n",V,E);
    for(int i=1;i<=E;i++) {
        e[i].print();
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   14 |     read(L);
      |     ~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
Language: C++

#include<stdio.h>
int main(){
int l,path1[111],path2[111],d[111],pl[22],t=0,i,g[22];
g[0]=1;
for(i=1;i<22;i++)
g[i]=g[i-1]*2;
scanf("%d",&l);
while(l!=0){
pl[t]=l%2;
p=p/2;
t++;
}
int n=t+1;
int k=1;
path1[0]=1;
path2[0]=2;
d[0]=0;
for(i=2;i<=t;i++){
path1[k]=i;
path2[k]=i+1;
d[k]=0;
k++;
path1[k]=i;
path2[k]=i+1;
d[k]=g[t-i];
k++;
}
int f=g[t-1];
for(i=t-2;i>=0;i--){
if(pl[i]==1){
path1[k]=1;
path2[k]=t-i+1;
d[k]=f;
k++;
f+=g[i];
}
}
printf("%d %d\n",n,k);
for(i=0;i<k;i++)
printf("%d %d %d\n",path1[i],path2[i],d[i]);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:1: error: 'p' was not declared in this scope
   10 | p=p/2;
      | ^
Language: C

n,m,k;a[99],b[99],c[99];
void push(x,y,z){a[m]=x;b[m]=y;c[m++]=z}
main(i){
	scanf("%d",&k);
	while((1<<n)<=k)n++;
	for(i=n;--i;push(i,i-1,0),push(i,i-1,1<<(i-1)));
	for(i=n-2;~i;i--)if((1<<i)&k)push(n-1,i,(k>>(i+1))<<(i+1));
	printf("%d %d\n",n,m);
	for(i=m;i--;printf("%d %d %d\n",n-a[i],n-b[i],c[i]));
}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n,m,k;a[99],b[99],c[99];
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    1 | n,m,k;a[99],b[99],c[99];
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | n,m,k;a[99],b[99],c[99];
      |     ^
main.c:1:7: warning: data definition has no type or storage class
    1 | n,m,k;a[99],b[99],c[99];
      |       ^
main.c:1:7: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:13: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | n,m,k;a[99],b[99],c[99];
      |             ^
main.c:1:19: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    1 | n,m,k;a[99],b[99],c[99];
      |                   ^
main.c: In function 'push':
main.c:2:6: error: type of 'x' defaults to 'int' [-Wimplicit-int]
    2 | void push(x,y,z){a[m]=x;b[m]=y;c[m++]=z}
      |      ^~~~
main.c:2:6: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:2:6: error: type of 'z' defaults to 'int' [-Wimplicit-int]
main.c:2:40: error: expected ';' before '}' token
    2 | void push(x,y,z){a[m]=x;b[m]=y;c[m++]=z}
      |                                        ^
      |                                        ;
main.c: At top level:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(i){
      | ^~~~
main.c: In function 'main':
main.c:3:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:4:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |         scanf("%d",&k);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | n,m,k;a[99],b[99],c[99];
main.c:4:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |         scanf("%d",&k);
      |         ^~~~~
main.c:4:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:8:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    8 |         printf("%d %d\n",n,m);
      |         ^~~~~~
main.c:8:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:8:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:8:9: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
int n, m, k;
int a[99], b[99], c[99];
void push (ull x, ull y, ull z) {
	a[m] = x;
	b[m] = y;
	c[m] = z;
	m++;
}

int main () {
	int i;
	printf("%d", &k);
	while ((1 << n) <= k) n++;
	for (i = n - 1; i > 0; i--) {
		push(i, i - 1, 0);
		push(i, i - 1, 1 << (i - 1));
	}
	for (i = n - 2; i >= 0; i--) {
		if ((1 << i) & k) {
			push(n - 1, i, (k >> (i + 1)) << (i + 1));
		}
	}
	printf("%d %d\n", n, m);
	for (i = 0; i < m; i++) {
		printf("%d %d %d\n", n - a[i], n - b[i], c[i]);
	}
	return 0;
}


Compiler output:
main.c:4:12: error: unknown type name 'ull'
    4 | void push (ull x, ull y, ull z) {
      |            ^~~
main.c:4:19: error: unknown type name 'ull'
    4 | void push (ull x, ull y, ull z) {
      |                   ^~~
main.c:4:26: error: unknown type name 'ull'
    4 | void push (ull x, ull y, ull z) {
      |                          ^~~
main.c: In function 'main':
main.c:16:17: error: implicit declaration of function 'push' [-Wimplicit-function-declaration]
   16 |                 push(i, i - 1, 0);
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;

ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/

int main(){
   
    ll l;
    cin >> l;
    if(l == 1){
        cout << 2 << " " << 1 << endl;
    cout << 1 << " " << 2 << " " << 0;
    return 0;
        
    }
  if(l == 2){
        cout << 2 << " " << 2 << endl;
    cout << 1 << " " << 2 << " " << 0 << endl;
    cout << 1 << " " << 2 << " " << 1 << endl
    return 0;
        
    }
    int sum = 0;
    int n = 3;
    int l1 = 2, r1 = 3;
    vector <vector <int> > vec;
  vector <int> vec1(3);
    vec1[0] = 1; vec1[1] = 2; vec1[2] = 0;
             vec.push_back(vec1);
            vec1[0] = 1; vec1[1] = 2; vec1[2] = 1;
            vec.push_back(vec1);
  vec1[0] = 1; vec1[1] = 2; vec1[2] = 2;
            vec.push_back(vec1);
    while(1){
         
         if(l >= (1<<n)){
             vec1[0] = l1; vec1[1] = r1; vec1[2] = 0;
             vec.push_back(vec1);
            vec1[0] = l1; vec1[1] = r1; vec1[2] = expo(2LL, n-1);
            vec.push_back(vec1);
            if(l == (1<<n)) break;
         }
         else{
             
             vec1[0] = l1; vec1[1] = r1; vec1[2] = 0;
             vec.push_back(vec1);
             ll val = l - (1<<(n-1));
             ll sum = (1<<(n-1));
             for(int i = 30; i >= 0; i--){
                 if(val & (1<<i)){
                     vec1[0] = i+1; vec1[1] = r1; vec1[2] = sum;
                     sum += (1<<i);
                     vec.push_back(vec1);
                 }
             }
              break;
         }
         n++;
         l1++; r1++;
    }
    cout << r1 << " " << 2*l1 << endl;
    for(int i = 0; i < vec.size(); i++){
        for(int j = 0; j < 3; j++) cout << vec[i][j] << " ";
        cout << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:46: error: expected ';' before 'return'
   32 |     cout << 1 << " " << 2 << " " << 1 << endl
      |                                              ^
      |                                              ;
   33 |     return 0;
      |     ~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;

ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/

int main(){
   
    ll l;
    cin >> l;
    if(l == 1){
        cout << 2 << " " << 1 << endl;
    cout << 1 << " " << 2 << " " << 0;
    return 0;
        
    }
  if(l == 2){
        cout << 2 << " " << 2 << endl;
    cout << 1 << " " << 2 << " " << 0 << endl;
    cout << 1 << " " << 2 << " " << 1 << endl
    return 0;
        
    }
    int sum = 0;
    int n = 3;
    int l1 = 2, r1 = 3;
    vector <vector <int> > vec;
    vec1[0] = l1; vec1[1] = r1; vec1[2] = 0;
             vec.push_back(vec1);
            vec1[0] = l1; vec1[1] = r1; vec1[2] = 1;
            vec.push_back(vec1);
  vec1[0] = l1; vec1[1] = r1; vec1[2] = 2;
            vec.push_back(vec1);
    while(1){
         vector <int> vec1(3);
         if(l >= (1<<n)){
             vec1[0] = l1; vec1[1] = r1; vec1[2] = 0;
             vec.push_back(vec1);
            vec1[0] = l1; vec1[1] = r1; vec1[2] = expo(2LL, n-1);
            vec.push_back(vec1);
            if(l == (1<<n)) break;
         }
         else{
             
             vec1[0] = l1; vec1[1] = r1; vec1[2] = 0;
             vec.push_back(vec1);
             ll val = l - (1<<(n-1));
             ll sum = (1<<(n-1));
             for(int i = 30; i >= 0; i--){
                 if(val & (1<<i)){
                     vec1[0] = i+1; vec1[1] = r1; vec1[2] = sum;
                     sum += (1<<i);
                     vec.push_back(vec1);
                 }
             }
              break;
         }
         n++;
         l1++; r1++;
    }
    cout << r1 << " " << 2*l1 << endl;
    for(int i = 0; i < vec.size(); i++){
        for(int j = 0; j < 3; j++) cout << vec[i][j] << " ";
        cout << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:46: error: expected ';' before 'return'
   32 |     cout << 1 << " " << 2 << " " << 1 << endl
      |                                              ^
      |                                              ;
   33 |     return 0;
      |     ~~~~~~                                    
a.cc:40:5: error: 'vec1' was not declared in this scope; did you mean 'vec'?
   40 |     vec1[0] = l1; vec1[1] = r1; vec1[2] = 0;
      |     ^~~~
      |     vec
Language: C++

#include<cstdio>

int main(){
	int L;
	scanf("%d", &L);
	if(L < 4){
		printf("2 %d\n", L);
		for (int i = 0; i < L; ++i) printf("1 2 %d\n", i);
		return 0;
	}
	int N = 2, M = L % 4;
	for (int i = 2; i < 20; ++i) if(L & (1 << i)) {N += i, M += (i - 1)*2;
	printf("%d %d\n", N, M);
	int point = 2;
	for (int i = 20; i > 1; --i){
		if(L & (1 << i)){
			for (int j = 0; j < i; ++j)
			{
				printf("%d %d 0\n%d %d %d\n", point + j , point + j + 1, point + j, point + j + 1, 1 << j);
			}
			printf("%d %d 0\n", point + i, N);
			point += i;
		}
	}
	return 0;
}

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

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cassert>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <limits.h>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iomanip>
using namespace std;
//////////////////
// Aditya Kumar //
//  BITS H      //
//////////////////
#define mod 1000000007
#define ll long long
#define ss second
#define ff first
#define endl '\n'
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int  long long
#define pb push_back
#define mod 1000000007
 
#define FOR(i, a, b) for(long long i=a;i<b;i++)

set<pair<int,int>> gr[24];
        int f = 0;

void addedge(int num) {
        if(num == 0) {
                gr[0].insert({20,0});
                return;
        }
        int k = 0;
        int arr[22];
        // cout << num << endl;
        while(num > 0) {
                arr[k++] = (num&1);
                num = num >> 1;
        }
        // Join every 1 with next 1 with wt 0;
        int prev = -1;
        for(int i=0;i<20;i++) {
                if(arr[i] == 1) {
                        if(prev == -1){ 
                                prev = i; 
                        }
                        else {
                                gr[prev].insert({prev+1,1LL<<prev});
                                prev = i;
                        }
                }
        }
        gr[prev].insert({20, 1LL<<prev});
}

int32_t main()
{
        // FastIO;
        #ifnde/
        int l;
        cin >> l;
        // 10^6 in base 2..
        // if I have a 0, I go left with 0 cost
        // If I have 1 GOTO Left with a cost of 2^i
        // And add everything to end then  >.<
        cout << 20 << endl;
        for(int i=0;i<20;i++) {
                // for(int j=i+1;j<20;j++) {
                        gr[i].insert({i+1,0});
                        // f++;
                // }
        }
        for(int i=0;i<l;i++) {
                // int x = i;
                addedge(i);
        }
        for(int i=0;i<=20;i++) {
                for(auto x: gr[i]) f++;
        }
        cout << f << endl;

        for(int i=0;i<=20;i++) {
                for(auto x: gr[i]) cout << i+1 << " " << x.ff + 1 << " " << x.ss << endl;
        }
        return 0;
}

Compiler output:
a.cc:72:10: error: invalid preprocessing directive #ifnde; did you mean #ifndef?
   72 |         #ifnde/
      |          ^~~~~
      |          ifndef
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int n,k,s,m,a[25];
int read(){
	int x=0,w=1;
	char ch=0;
	while (ch<'0' || ch>'9'){
		  if (ch=='-') w=-1;
		  ch=getchar();
	}
	while (ch<='9' && ch>='0'){
		  x=(x<<1)+(x<<3)+ch-'0';
		  ch=getchar();
	}
	return x*w;
}
int main(){
	n=read();
	for (int i=0;i<=20;i++)
		if (n&(1<<i)) k++,a[k]=i;
	for (int i=1;i<a[k]+1;i++) m+=2;
	for (int i=k-1;i>=1;i--) ++m;
	printf("%d %d\n",a[k]+1,m);
	for (int i=1;i<a[k]+1;i++){
		printf("%d %d %d\n",i,i+1,0);
		printf("%d %d %d\n",i,i+1,(1<<(i-1)));
	}
	s=(1<<a[k]);
	for (int i=k-1;i>=1;i--){
		printf("%d %d %d\n",a[i]+1,a[k]+1,s);
		s|=(1<<a[i]);
	
	return 0;
}

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

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

const int maxN = 4010;
const int mod = 998244353;
typedef long long ll;

int C[maxN][maxN], pw[maxN];

void init(){
	int i, j;
	C[0][0] = 1;
	for(i = 1; i < maxN; ++i){
		C[i][0] = C[i][i] = 1;
		for(j = 1; j < i; ++j){
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
		}
	}
	for(i = 1, pw[0] = 1; i < maxN; ++i)
		pw[i] = (pw[i - 1] << 1) % mod;
}

inline Cbar(int n, int k){
	if(k < 0){
		return 0;
	}
	return C[n + k - 1][k];
}

int main (){
	int k, n, i, j, cnt;
	scanf("%d%d", &k, &n);
	init();
	for(i = 2; i <= 2 * k; ++i){
		ll ans = 0;
		for(j = 1, cnt = 0; j <= k; ++j)
			if(0 < (i - j) && (i - j) <= k) ++cnt;
		if(cnt & 1){
			cnt /= 2;
			for(j = 0; j <= cnt; ++j){
				ll t = (C[cnt][j] * 1ll * Cbar(k - 1 - j - (cnt - j) * 2, n - j)) % mod;
				t = (t * pw[j]) % mod;
				ans = (ans + t) % mod;
			}
			for(j = 0; j <= cnt; ++j){
				ll t = (C[cnt][j] * 1ll * Cbar(k - 1 - j - (cnt - j) * 2, n - 1 - j)) % mod;
				t = (t * pw[j]) % mod;
				ans = (ans + t) % mod;
			}
		}
		else{
			cnt /= 2;
			for(j = 0; j <= cnt; ++j){
				ll t = (C[cnt][j] * 1ll * Cbar(k - j - (cnt - j) * 2, n - j)) % mod;
				t = (t * pw[j]) % mod;
				ans = (ans + t) % mod;
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Compiler output:
a.cc:23:8: error: ISO C++ forbids declaration of 'Cbar' with no type [-fpermissive]
   23 | inline Cbar(int n, int k){
      |        ^~~~
Language: C++

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

const int maxN = 4010;
const int mod = 998244353;
typedef long long ll;

int C[maxN][maxN], pw[maxN];

void init(){
	int i, j;
	C[0][0] = 1;
	for(i = 1; i < maxN; ++i){
		C[i][0] = C[i][i] = 1;
		for(j = 1; j < i; ++j){
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
		}
	}
	for(i = 1, pw[0] = 1; i < maxN; ++i)
		pw[i] = (pw[i - 1] << 1) % mod;
}

inline Cbar(int n, int k){
	if(k < 0){
		puts("bug");
		return 0;
	}
	return C[n + k - 1][k];
}

int main (){
	int k, n, i, j, cnt;
	scanf("%d%d", &k, &n);
	init();
	for(i = 2; i <= 2 * k; ++i){
		printf("%d : ", i);
		ll ans = 0;
		for(j = 1, cnt = 0; j <= k; ++j)
			if(0 < (i - j) && (i - j) <= k) ++cnt;
		printf("%d : ", cnt);
		if(cnt & 1){
			cnt /= 2;
			for(j = 0; j <= cnt; ++j){
				ll t = (C[cnt][j] * 1ll * Cbar(k - 1 - j - (cnt - j) * 2, n - j)) % mod;
				t = (t * pw[j]) % mod;
				ans = (ans + t) % mod;
			}
			for(j = 0; j <= cnt; ++j){
				ll t = (C[cnt][j] * 1ll * Cbar(k - 1 - j - (cnt - j) * 2, n - 1 - j)) % mod;
				t = (t * pw[j]) % mod;
				ans = (ans + t) % mod;
			}
		}
		else{
			cnt /= 2;
			for(j = 0; j <= cnt; ++j){
				ll t = (C[cnt][j] * 1ll * Cbar(k - j - (cnt - j) * 2, n - j)) % mod;
				t = (t * pw[j]) % mod;
				ans = (ans + t) % mod;
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Compiler output:
a.cc:23:8: error: ISO C++ forbids declaration of 'Cbar' with no type [-fpermissive]
   23 | inline Cbar(int n, int k){
      |        ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
#define f first
#define s second
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

ll n, k, f[5010], t[2050], m = 998244353;

ll qexp(ll a, ll b) {
    a %= m;
    ll res = 1, base = a;
    while (b) {
        if (b & 1) {
            res *= base;
            res %= m;
        }
        base *= base;
        base %= m;
        b >>= 1;
    }
    return res % m;
}

inline ll divide(ll a, ll b) {
	return ((a%m) * qexp(b, m-2))%m;
}

inline ll choose(ll n, ll k) {
	if (n < k or k < 0 or n < 0) return 0;
  if (k==0) return 0;
	return divide(divide(f[n],f[k]),f[n-k]));
}

ll add(ll a, ll b) {
  a%=m;
	b %= m;
	a += b;
	a %= m;
	return a;
}

int main() {
	fastio;
	cin >> k >> n;
	f[0] = 1; FOR(i, 1, 5004) f[i] = (i * f[i-1]) % m;
	t[0] = 1; FOR(i, 1, 2039) t[i] = (2 * t[i-1]) % m;
	FOR(i, 2, 2*k) {
		ll p = (i-1)/2 - max(0LL, i-k-1), ans = 0;
		if (i&1) {
			FOR(q, 0, p) {
				ans = add(ans, ((choose(n+k-2*p-1, q+k-2*p-1) * choose(p, q)) % m) * t[q]);
			}
		} else {
			FOR(q, 0, p) {
				ans = add(ans, ((t[q]*choose(p, q))%m) * add(choose(n+k-2*p-2, q+k-2*p-2), choose(n+k-2*p-3, q+k-2*p-2)));
			}
		}
		cout << ans << "\n";
	}
}


Compiler output:
a.cc: In function 'll choose(ll, ll)':
a.cc:36:48: error: expected ';' before ')' token
   36 |         return divide(divide(f[n],f[k]),f[n-k]));
      |                                                ^
      |                                                ;
a.cc:36:48: error: expected primary-expression before ')' token
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iomanip>
#include <numeric>

using namespace std;
using ll = long long;

const int MOD = 998244353;
const int N = 2001;

int dp[N][N];
ll f[N], fr[N];

ll binpow(ll a, int p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            (res *= a) %= MOD;
        }
        (a *= a) %= MOD;
        p >>= 1;
    }
    return res;
}

ll cnk(int n, int k) {
    assert(k <= n);
    return f[n] * fr[k] % MOD * fr[n - k] % MOD;
}

ll solve(int n, int k, int t) {
    ll res = 0;
    int l = max(1, t - k);
    int r = min(k, t - 1);
    assert((r - l + 1) % 2 == 0);
    int kek = (r - l + 1) / 2;
    for (int i = 0; i <= kek; i++) {
        if (n - kek + i < 0) {
            continue;
        }
        (res += dp[k - kek - i][n - kek + i] * binpow(2, kek - i) % MOD * cnk(kek, i)) %= MOD;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> k >> n;

    f[0] = fr[0] = 1;
    for (int i = 1; i <= N; i++) {
        f[i] = f[i - 1] * i % MOD;
        fr[i] = binpow(f[i], MOD - 2);
    }

    fill(dp[1], dp[1] + n + 1, 1);
    for (int i = 2; i <= k; i++) {
        int s = 0;
        for (int j = 0; j <= n; j++) {
            (s += dp[i - 1][j]) %= MOD;
            dp[i][j] = s;
        }
    }
    for (int t = 2; t <= 2 * k; t++) {
        ll ans = 0;
        if (t & 1) {
            ans = solve(n, k, t);
        } else {
            ans = (solve(n, k - 1, t - 1) + solve(n - 1, k - 1, t - 1)) % MOD;
        }
        cout << ans << '\n';
    }
    return 0;
}

Compiler output:
a.cc: In function 'll cnk(int, int)':
a.cc:35:5: error: 'assert' was not declared in this scope
   35 |     assert(k <= n);
      |     ^~~~~~
a.cc:12:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   11 | #include <numeric>
  +++ |+#include <cassert>
   12 | 
a.cc: In function 'll solve(int, int, int)':
a.cc:43:5: error: 'assert' was not declared in this scope
   43 |     assert((r - l + 1) % 2 == 0);
      |     ^~~~~~
a.cc:43:5: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
Language: C++


#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M 998244353
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}



int fac[310000];

int inv(int x){
  if(x==1) return 1;
  return (M-M/x)*inv(M%x)%M;
}


int comb(int n,int k){
  int x=(fac[k]*fac[n-k])%M;
  return (fac[n]*inv(x))%M;
}

int fac_init(int n){
  fac[0]=1;
  FOR(i,1,n+1){
    fac[i]=fac[i-1]*i;
    fac[i]%=M;
  }
}

main(){

  int n,k;
  cin>>k>>n;
  fac_init(100000);

  FOR(i,2,2*k+1){
    int res=0;
    int q=i;
    if(q>k+1) q=(k+1)*2-q;
    int a=q/2;
    rep(i,a+1){
      if(!(k-a+n-i-1>=0&&n-i>=0)) continue;
      if(a<b||k-a-n-i-1<n-i) continue;

      int t=comb(a,i)*comb(k-a+n-i-1,n-i)%M;
      res+=t;
      res%=M;
    }

    cout<<res<<endl;
  }

}


Compiler output:
a.cc: In function 'long long int fac_init(long long int)':
a.cc:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
   51 | }
      | ^
a.cc: At global scope:
a.cc:53:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   53 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:66:12: error: 'b' was not declared in this scope
   66 |       if(a<b||k-a-n-i-1<n-i) continue;
      |            ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define vel vector<long long>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
long long p = 998244353;
vel kai(2001, 1);
vel ink(2001, 1);
vel uni(vel &list) {
	if (list.size() == 0) { return list; }
	sort(list.begin(), list.end());
	vel ql(1, list[0]);
	rep(i, list.size() - 1) {
		if (list[i] != list[i + 1]) { ql.push_back(list[i + 1]); }
	}
	return ql;
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 2000) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 2001) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
signed main() {
	make_kai();
	vel rui(2001, 1);
	rep(i, 2000) { rui[i + 1] = (rui[i] * 2) % p; }
  int n,k;cin >> n >> k;
			vel re(2 * k - 1, 0);
			vel	tik(n + k - 1, 0);
			for (int i = n; i < n + k - 1; i++) { tik[i] = 1; }
			bool fl = true;
			while (fl) {
				vel ko(k, -1); ko[0]++;
				int now_sum = 0;
				rep(j, n + k - 1) { now_sum += tik[j]; ko[now_sum]++; }
				vector<bool> is_use(2 * k - 1, false);
				rep(in, k) {
					for (int ind = in + 1; ind < k; ind++) {
						if (ko[in] * ko[ind] != 0) {
							is_use[in + ind] = true;
						}
					}
					if (ko[in] >= 2) { is_use[2 * in] = true; }
				}
				rep(j, 2 * k - 1) {
					if (!is_use[j]) { re[j]++; }
				}
				fl = next_permutation(tik.begin(), tik.end());
			}
			rep(i, 2 * k - 1) { if (ans[i] != re[i]) { cout << "NG" << endl; } }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |                         rep(i, 2 * k - 1) { if (ans[i] != re[i]) { cout << "NG" << endl; } }
      |                                                 ^~~
      |                                                 abs