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

#include<bits/stdc++.h>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N, M;
vector<ll> abv[1010];
ll i, j, k;
ll ans[2020];
ll ansck;

bool dfs(ll a,ll p,ll d){
    if(mk[a]){
        if(a==p)
            return true;
        return false;
    }
    if (d == 0){
        return false;
    }
    mk[a] = 1;
    ll i = 0, f = 0;
    fornum(i,0,abv[a].size()){
        ll b = abv[a][i];
        if(dfs(b,p,d-1)){
            ans[d - 1] = a;
            return true;
        }
    }
    return false;
}
bool bs(ll a)
{
    ll i, j;
    fornum(i,0,N){
        if(bfs(i+1,i+1,a)){
            return true;
        }
    }
    return false;
}

int main(){
    scanf("%lld%lld", &N, &M);
    fornum(i,0,M){
        ll a, b;
        scanf("%lld%lld", &a, &b);
        abv[a].push_back(b);
    }
    ll l = 0, r = 2001;
    while(l<r){
        ll c = (l + r) / 2;
        if(bs(c)){
            r = c;
        }else{
            l = c+1;
        }
    }
    if(r==2001){
        printf("-1");
    }else{
        printf("%lld\n", r);
        fornum(i,0,r){
            printf("%lld\n", ans[i]);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'bool dfs(long long int, long long int, long long int)':
a.cc:19:8: error: 'mk' was not declared in this scope; did you mean 'k'?
   19 |     if(mk[a]){
      |        ^~
      |        k
a.cc:27:5: error: 'mk' was not declared in this scope; did you mean 'k'?
   27 |     mk[a] = 1;
      |     ^~
      |     k
a.cc: In function 'bool bs(long long int)':
a.cc:42:12: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
   42 |         if(bfs(i+1,i+1,a)){
      |            ^~~
      |            ffs
Language: C++

#include <iostream>
#include <vector>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define ll long long
#define pii pair<int,int>
#define y1 Emilia
#define N 500500
#define dracarys ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

int n, m;
vector<int> g[N];
int used[N], pos[N], col[N], lvl[N];
vector<int> glob_ans;
vector<int> ord;



void dfs (int v) {
    used[v] = 1;
    for (int i = 0; i < (int)g[v].size(); ++i) {
        int to = g[v][i];
        if (!used[to])
            dfs (to);
    }
    ord.push_back(v);
}

vector<int> path;
void DFS (int v, int l = 0) {
    col[v] = 1;
    lvl[v] = l;
    path.push_back(v);
    int mn = -1;
    for (int i = 0; i < (int)g[v].size(); ++i) {
        int to = g[v][i];
        if (col[to] == 0) DFS (to, l + 1);
        if (col[to] == 1 && (mn == -1 || lvl[mn] < lvl[to]))
            mn = to;
    }
    if (mn != -1){
        vector<int> res;
        while (path.size() && path.back() != mn) {
            res.push_back(path.back());
            path.pop_back();
        }
        res.push_back(mn);
        cout << (int)res.size() << "\n";
        for (int j = 0; j < res.size(); ++j) cout << res[j] << "\n";
        exit(0);
    }
    col[v] = 2;
    path.pop_back();
}
int main(){
    dracarys
    cin >> n >> m;
    for (int i = 1; i <= m; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
    }
    for (int i = 1; i <= n; ++i)
        if (!used[i]) dfs (i);
    reverse(all(ord));
    for (int i = 0; i < ord.size(); ++i)
        pos[ord[i]] = i;
    bool has = false;
    for (int v = 1; v <= n; ++v) {
        for (int j = 0; j < g[v].size(); ++j) {
            int to = g[v][j];
            if (pos[to] < pos[v])
                has = true;
        }
    }
    if (has == false) {
        cout << -1 << "\n";
        return 0;
    }
    
    for (int i = 1; i <= n; ++i) {
        if (col[i] == 0) DFS(i);
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:5: error: 'reverse' was not declared in this scope
   67 |     reverse(all(ord));
      |     ^~~~~~~
Language: C++

// atcoder/abc142/F/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int N = 1000 + 5;

vector<int> g[N];
bool vis[N];
void rec(int curr, int prev)
{
  vis[curr] = true;

  int cnt = 0;
  each (next, g[curr]) {
    cnt += vis[next];
  }
  if (cnt == 1) {
    throw "";
  }
  if (cnt == 0) {
    each (next, g[curr]) {
      if (next == prev) continue;
      if (vis[next]) continue;
      rec(next, curr);
    }
  }

  vis[curr] = false;
  return false;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    fill(g, g + N, vector<int>());
    for (int i = 0; i < m; ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      g[a].push_back(b);
    }

    bool f = false;
    fill(vis, vis + N, false);
    for (int i = 0; i < n; ++i) {
      try {
        rec(i, -1);
      } catch (const char* e) {
        f = true;
      }
    }

    if (!f) cout << -1 << endl;
    else {
      cout << count(vis, vis + N, true) << endl;
      for (int i = 0; i < n; ++i) {
        if (vis[i]) cout << i + 1 << endl;
      }
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'void rec(int, int)':
a.cc:48:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   48 |   return false;
      |          ^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<int, int>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

int N, M;
vector<set<int>> edges, tedges;
vector<lpair> all_edge;
int target;

bool Heiro(vector<int> &ans) {
	static vector<int> visited(N+1, 0);

	if (ans.back() == target && visited[target] == 1) {
		for (auto v : ans) {
			int cnt = 0;
			for (auto edge : tedges[v])
				cnt += visited[edge];
			if (cnt != 1) return false;
		}
		return true;
	}

	vector<int> new_v;
	bool finded = false;
	for (auto edge : edges[ans.back()]) {
		if (visited[edge] == 1) return false;
		if (edge == target) finded = true;
		new_v.push_back(edge);
	}

	if (finded == true) {
		ans.push_back(target);
		visited[target] = 1;
		if (Heiro(ans)) return true;
		ans.pop_back();
		visited[target] = 0;
		return false;
	}

	for (auto next : new_v) {
		ans.push_back(next);
		visited[next] = 1;
		if (Heiro(ans)) return true;
		ans.pop_back();
		visited[next] = 0;
	}
	return false;
}

set<int> BellmanFord() {
	vector<int> dis(N+1, 99999);
	dis[1] = 0;
	set<int> ret;
	for (int i = 0; i < 3*N; ++i) {
		for (auto edge : all_edge) {
			if (dis[edge.second] > dis[edge.first] - 1) {
				dis[edge.second] = dis[edge.first] - 1;
				if (i >= N) {
					edges[edge.first].insert(edge.second);
					ret.insert(edge.first);
				}
			}
		}
	}

	return ret;
}

int main() {
	cin >> N >> M;
	edges.resize(N+1);
	tedges.resize(N+1);
	all_edge.resize(M);
	for (int i = 0; i < M; ++i) {
		int from, to;
		cin >> from >> to;
		tedges[from].push_back(to);
		all_edge[i] = lpair(from, to);
	}

	set<int> t_list = BellmanFord();

	if (t_list.size() == 0) {
		cout << -1 << endl;
		return 0;
	} else {
		for (auto t : t_list) {
			target = t;
			vector<int> ans;
			ans.push_back(target);
			Heiro(ans);
			ans.pop_back();
			if (ans.size() == 0) continue;
			cout << ans.size() << endl;
			for (auto v : ans)
				cout << v << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:30: error: '__gnu_cxx::__alloc_traits<std::allocator<std::set<int> >, std::set<int> >::value_type' {aka 'class std::set<int>'} has no member named 'push_back'
   85 |                 tedges[from].push_back(to);
      |                              ^~~~~~~~~
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){

    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int n,m;
vector<vector<int> > adj;
vector<char> color;
vector<int> parent;
int cycle_start, cycle_end;

bool dfs(int v) {
    color[v] = 1;
    for (int u : adj[v]) {
        if (color[u] == 0) {
            parent[u] = v;
            if (dfs(u))
                return true;
        } else if (color[u] == 1) {
            cycle_end = v;
            cycle_start = u;
            return true;
        }
    }
    color[v] = 2;
    return false;
}

void find_cycle() {
    color.assign(n, 0);
    parent.assign(n, -1);
    cycle_start = -1;

    for (int v = 0; v < n; v++) {
        if (dfs(v))
            break;
    }

    if (cycle_start == -1) {
        cout << -1 << endl;
    } else if(cycle.size()-1==n){
			cout << -1 << endl;
		}else {
        vector<int> cycle;
        cycle.push_back(cycle_start);
        for (int v = cycle_end; v != cycle_start; v = parent[v])
            cycle.push_back(v);
        cycle.push_back(cycle_start);
        reverse(cycle.begin(), cycle.end());

        // cout << "Cycle found: ";
				cout << cycle.size()-1 << endl;
				rep(i,cycle.size()-1) cout << cycle[i]+1 << endl;
        // for (int v : cycle)
        //     cout << v+1 << " ";
        // cout << endl;
    }
}

signed main(){
  cin>>n>>m;
	rep(i,n){
		VI a; adj.PB(a);
	}
  rep(i,m){
		int a,b; cin>>a>>b; a--; b--;
		adj[a].PB(b);
	}
	find_cycle();



  return 0;
}


Compiler output:
a.cc: In function 'void find_cycle()':
a.cc:87:15: error: 'cycle' was not declared in this scope
   87 |     } else if(cycle.size()-1==n){
      |               ^~~~~
a.cc:90:21: error: redeclaration of 'std::vector<int> cycle'
   90 |         vector<int> cycle;
      |                     ^~~~~
a.cc:87:15: note: '<typeprefixerror>cycle' previously declared here
   87 |     } else if(cycle.size()-1==n){
      |               ^~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;
vector<int> to[1010];
int explored[1010];
int n, m;
bool flag;

void dfs(int v, vector<int> vs) {
    if (flag) return;
    vs.pb(v);
    explored[v] = 1;
    for (auto x: to[v]) {
        if (flag) return;
        if (explored[x] == 0) dfs(x, vs);
        else if (explored[x] == 1) {
            flag = true;
            int cnt = 1;
            vector<int> vss = vs;

            set<int> s;
            s.insert(x);
            while(vs.size()!=0) {
                int y = vs.back(); vs.pop_back();

                auto itr = s.find(y);
                if (itr != s.end()) break;
                else cnt++;
            }
            cout << cnt << endl;
            cout << x << endl;
            set<int> s;
            s.insert(x);
            while(vss.size()!=0) {
                int y = vss.back(); vss.pop_back();
                auto itr = s.find(y);
                if (itr != s.end()) break;
                else cout << y << endl;
            }
            return;
        }
    }
    explored[v] = 2;
    return;
}

int main() {
    cin >> n >> m;

    rep(i,m) {
        int a, b;
        cin >> a >> b;
        to[a].pb(b);
    }
    vector<int> vs;
    flag = false;
    rep(i,n) {
        dfs(i, vs);
        if (flag) break;
    }
    if (!flag) cout << "-1"  << endl;
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, std::vector<int>)':
a.cc:62:22: error: redeclaration of 'std::set<int> s'
   62 |             set<int> s;
      |                      ^
a.cc:51:22: note: 'std::set<int> s' previously declared here
   51 |             set<int> s;
      |                      ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include "math.h"
using namespace std;
 
#define BUFF ios::sync_with_stdio(false)
#define rep(i,a,b) for (int i=a; i<b; i++)
#define pb push_back
#define vvi vector<vector<int>> 
#define vi vector<int>
#define vb vector<bool>
#define vvb vector<vector<bool>> 
 
vi p;
vector<int> cor;
int total;
vector<int> w;
void dfs_visit(vvi & adj, int i) {
		cor[i] = 1;
		for (int j : adj[i]) {
			if (cor[j] == 1) {
				w.push_back(i);
				total++;
			}
			if (cor[j] == 0) {
				p[j] = i;
				dfs_visit(adj, j);
			}
		}
		cor[i] = 2;
}
 
int dfs(vvi & adj, int n) {
	int ans = 10;
	for(int i=1; i<=n; i++) {
		total = 0;	
		p.assign(n+1, 1);
		cor.assign(n+1, 0);
		total = 0;
//		cout << "i=" << i  << endl;
		int j = i;
		if (cor[j] == 0 and total == 0) {
			dfs_visit(adj, j);
		}
	/*	for(int j=1; j<=n; j++) {
			if (cor[j] == 0) {
				dfs_visit(adj, j);
			}
		}
		ans = min(ans,total);
		*/
	}
	return ans;
}
 
int main() {
	int n, m, a, b;
	cin >> n >> m;
 
	vi vetor;
	vetor.assign(n+1, 0);
 
	vvi adj;
	vi lista;
	lista.clear();
	adj.assign(n+1, lista);
	for (int i=1; i<=m; i++) { 
		cin >> a >> b;
		adj[a].pb(b);
	}
	int ans = dfs(adj, n);

	if (total == 0) cout << -1 << endl;
	else {
		cout << w.size() << endl;
		sort(w.begin(), w.end());

		for(int i=0; i<w.size(); i++) {
			cout << w[i] << endl;
		}
	}
   
   return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   77 |                 sort(w.begin(), w.end());
      |                 ^~~~
      |                 sqrt
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
inline bool chmax(T &a, T b) { return a < b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;

	vector<vector<int>> d(N, vector<int>(N, INF));

	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		d[a][b] = 1;
	}

	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (d[i][k] != INF && d[k][j] != INF) {
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
				}
			}
		}
	}
	DMP(d);
	int ans = INF;
	for (int i = 0; i < N; i++) {
		chmin(ans, d[i][i]);
	}

	if (ans == INF) cout << -1 << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:17: error: 'chmin' was not declared in this scope
   70 |                 chmin(ans, d[i][i]);
      |                 ^~~~~
Language: C++

#include "pch.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <queue>
#include <limits.h>
#include <bitset>
#include <cmath>


using namespace std;

#define rip(i, n, s) for (int i = (s);i < ( int )( n ); i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> to(n, vector<int>(0));
	vector<pair<int, int>> v(m);
	int a, b;
	rip(i, m, 0) {
		cin >> a >> b;
		a--;b--;
		to[a].push_back(b);
		v[i] = make_pair(a, b);
	}
	vector<int> nod(n, 0);
	rip(j, n, 0) {
		rip(i, m, 0) {
			nod[v[i].second] = min(nod[v[i].second], nod[v[i].first] - 1);
		}
	}
	int st = -1;
	rip(i, m, 0) {
		if (nod[v[i].second] > nod[v[i].first] - 1) {
			st = v[i].second;
			break;
		}
	}
	if (st < 0) {
		cout << -1 << endl;
		return 0;
	}
	vector<bool> ju(n, false);
	vector<int> ans(n, -1);
	queue<int> q;
	bool Isend = false;
	for (auto i : to[st]) {
		q.push(i);
		ju[i] = true;
		ans[i] = st;
		if (i == st) {
			cout << 2 << endl;
			cout << i << endl;
			cout << st << endl;
			return 0;
		}
	}
	while (q.size()) {
		int now = q.front();
		q.pop();
		for (auto i : to[now]) {
			if (i == st) {
				ans[st] = now;
				Isend = true;
				break;
			}
			if (!ju[i]) {
				ju[i] = true;
				q.push(i);
				ans[i] = now;
			}
		}
		if (Isend) {
			break;
		}
	}
	vector<int> anser(1, st + 1);
	int next = ans[st];
	while (next != st) {
		anser.push_back(next + 1);
		next = ans[next];
	}
	cout << anser.size() << endl;
	for (auto i : anser) {
		printf("%d\n", i);
	}
}

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

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define ll long long
#define pii pair<int,int>
#define y1 Emilia
#define N 500500
#define dracarys ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

int n, m;
vector<int> g[N], gr[N];
int used[N], u[N], dp[N], pa[N], pos[N], col[N];
map<pii, bool> was;
vector<int> glob_ans;
vector<int> ord;



void dfs (int v) {
    used[v] = 1;
    for (int i = 0; i < (int)g[v].size(); ++i) {
        int to = g[v][i];
        if (!used[to])
            dfs (to);
    }
    ord.push_back(v);
}

vector<int> path;
void DFS (int v) {
    col[v] = 1;
    path.push_back(v);
    for (int i = 0; i < (int)g[v].size(); ++i) {
        int to = g[v][i];
        if (col[to] == 0) DFS (to);
        if (col[to] == 1) {
            vector<int> res;
            while (path.size() && path.back() != to) {
                res.push_back(path.back());
                path.pop_back();
            }
            res.push_back(to);
            cout << (int)res.size() << "\n";
            for (int j = 0; j < res.size(); ++j) cout << res[j] << "\n";
            exit(0);
        }
    }
    col[v] = 2;
    path.pop_back();
}
int main(){
    dracarys
    cin >> n >> m;
    for (int i = 1; i <= m; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        was[make_pair(a, b)] = 1;
        gr[b].push_back(a);
    }
    for (int i = 1; i <= n; ++i)
        if (!used[i]) dfs (i);
    
    
    reverse(all(ord));
    
    for (int i = 0; i < ord.size(); ++i)
        pos[ord[i]] = i;
    
    bool has = false;
    for (int v = 1; v <= n; ++v) {
        for (int j = 0; j < g[v].size(); ++j) {
            int to = g[v][j];
            if (pos[to] < pos[v])
                has = true;
        }
    }
    
    if (has == false) {
        cout << -1 << "\n";
        return 0;
    }
    
    for (int i = 1; i <= n; ++i) {
        if (col[i] == 0) DFS(i);
    }
    
    assert(false);
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:96:5: error: 'assert' was not declared in this scope
   96 |     assert(false);
      |     ^~~~~~
a.cc:8:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    7 | #include <queue>
  +++ |+#include <cassert>
    8 |
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
void debug_out(T t) {
  cerr << t;
}

template <typename A, typename B>
void debug_out(pair<A, B> u) {
  cerr << "(" << u.first << " " << u.second << ")";
}

template <typename T>
void debug_out(vector<T> t) {
  int sz = t.size();
  for(int i = 0; i < sz; i++) {
    debug_out(t[i]);
    if(i != sz - 1) cerr << ", ";
  }
}

template <typename T>
void debug_out(vector<vector<T>> t) {
  int sz = t.size();
  for(int i = 0; i < sz; i++) {
    debug_out(t[i]);
    if(i != sz - 1) cerr << endl;
  }
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:" << endl, debug_out(__VA_ARGS__), cerr << endl;

int n, m;

int main() {
  cin >> n >> m;
  vector<vector<int>> g(n);
  vector<int> rev(n);
  range(i, 0, m) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    g[u].push_back(v);
    rev(v)++;
  }
  vector<int> show(n, 1);
  while(true) {
    if(*min_element(show.begin(), show.end()) == 0) break;
    bool ok = false;
    range(i, 0, n) {
      if(show[i] && rev[i] == 0) {
        for(int v : g[i]) rev[v]--;
        show[i] = 0;
        ok = true;
      } 
    }
    if(!ok) {
      cout << -1;
      return 0;
    }
  }
  vector<int> cur;
  vector<int> was(n);
  vector<int> alive(n);
  vector<int> res;
  vector<int> dep(n);
  function<void(int)> dfs = [&](int v) {
    if(!res.empty()) return;
    was[v] = 1;
    alive[v] = 1;
    cur.push_back(v);
    int s = -1;
    for(int u : g[v]) {
      if(alive[u]) {
        if(s == -1 || dep[u] > dep[s]) s = u;
      }
    }
    if(~s) {
      while(cur.back() != s) {
        res.push_back(cur.back());
        cur.pop_back();
      }
      res.push_back(s);
      return;
    }
    for(int u : g[v]) {
      if(was[u]) continue;
      dep[u] = dep[v] + 1;
      dfs(u);
      if(!res.empty()) return;
    }
    alive[v] = 0;
    cur.pop_back();
  };
  range(i, 0, n) {
    if(res.size()) break;
    fill(was.begin(), was.end(), 0);
    fill(dep.begin(), dep.end(), 0);
    fill(alive.begin(), alive.end(), 0);
    cur.clear();
    dfs(i);
  }
  assert(!res.empty());
  if(res.empty()) {
    cout << -1;
  } else {
    cout << res.size() << endl;
    for(int v : res) cout << v + 1 << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:8: error: no match for call to '(std::vector<int>) (int&)'
   48 |     rev(v)++;
      |     ~~~^~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

vector<int> G[1010];
int h[1010];

void solve() {
	int n, m; cin >> n >> m;
    rep(i, m) {
        int a, b; cin >> a >> b;
        --a; --b;
        G[a].pb(b); h[b] ++;
    }

    stack<int> st;
    rep(i, n) {
        if(h[i] == 0) st.pb(i);
    }
    vector<int> ans;
    while(st.size()) {
        int i = st.top(); st.pop();
        ans.pb(i);
        for(auto & j: G[i]) {
            h[j] --;
            if(h[j] == 0) st.push(j);
        }
    }
    if(ans.size() == n) {
        cout << -1 << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:46:12: error: 'class std::stack<int>' has no member named 'push_back'
   46 | #define pb push_back
      |            ^~~~~~~~~
a.cc:65:26: note: in expansion of macro 'pb'
   65 |         if(h[i] == 0) st.pb(i);
      |                          ^~
Language: C++

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let h: usize = read();
    let w: usize = read();
    let a: usize = read();
    let b: usize = read();
    let mut wid = vec![0; h];
    let mut hei = vec![0; w];
    let mut matrix: Vec<Vec<i64>> = vec![vec![100; w]; h];
    for i in 0..h {
        for j in 0..w {
            if wid[i] < h - a && hei[j] <w - a {
                matrix[i][j] = 0;
                wid[i] += 1;
                hei[j] += 1;
            } else {
                matrix[i][j] = 1;
            }
        }
    }
    for i in 0..h {
        for j in 0..w {
            if j < w - 1 {
                print!("{}", matrix[i][j]);
            } else {
                println!("{}", matrix[i][j]);
            }
        }
    }
}

Compiler output:
a.cc:26:14: error: too many decimal points in number
   26 |     for i in 0..h {
      |              ^~~~
a.cc:27:18: error: too many decimal points in number
   27 |         for j in 0..w {
      |                  ^~~~
a.cc:37:14: error: too many decimal points in number
   37 |     for i in 0..h {
      |              ^~~~
a.cc:38:18: error: too many decimal points in number
   38 |         for j in 0..w {
      |                  ^~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::cmp::*;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::collections::*;
      | ^~~
a.cc:3:1: error: 'use' does not name a type
    3 | use std::io::*;
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use std::str::FromStr;
      | ^~~
a.cc:6:1: error: 'fn' does not name a type
    6 | fn read<T: FromStr>() -> T {
      | ^~
a.cc:18:1: error: 'fn' does not name a type
   18 | fn main() {
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=114514;
int fa[N],u[N],v[N],t[N];
int n,q;
ll num,cnt,m;
int find(int x){
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
void merge(int x,int y){
	if(x!=y) num--,fa[x]=y,cnt++;
} 
int main(){
	scanf("%d%d%d",&n,&m,&q);num=n;
	for(int i=1;i<=n;i++)fa[i]=i;
	for(int i=1;i<=q;i++){
		scanf("%d%d%d",&u[i],&v[i],&t[i]);u[i]++,v[i]++;
		if(!t[i]) merge(find(u[i]),find(v[i])),q--,i--;
	}
	if(m<=n-1){
		if(m<n-1)puts("No");
		else if(!q) puts("Yes");
		else puts("No");
		return 0;
	}for(int i=1;i<=q;i++){
		if(find(u[i])==find(v[i])){
			puts("No");return 0;
		}
	}ll r=1ll*cnt+((num*(num-1))/2);
	if(m>=n&&m<=r)puts("Yes");
	else puts("No");
	return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll num,cnt,m;
      | ^~
a.cc: In function 'void merge(long long int, long long int)':
a.cc:12:18: error: 'num' was not declared in this scope; did you mean 'enum'?
   12 |         if(x!=y) num--,fa[x]=y,cnt++;
      |                  ^~~
      |                  enum
a.cc:12:32: error: 'cnt' was not declared in this scope; did you mean 'int'?
   12 |         if(x!=y) num--,fa[x]=y,cnt++;
      |                                ^~~
      |                                int
At global scope:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:15:28: error: 'm' was not declared in this scope
   15 |         scanf("%d%d%d",&n,&m,&q);num=n;
      |                            ^
a.cc:15:34: error: 'num' was not declared in this scope; did you mean 'enum'?
   15 |         scanf("%d%d%d",&n,&m,&q);num=n;
      |                                  ^~~
      |                                  enum
a.cc:30:10: error: 'll' was not declared in this scope
   30 |         }ll r=1ll*cnt+((num*(num-1))/2);
      |          ^~
a.cc:31:21: error: 'r' was not declared in this scope
   31 |         if(m>=n&&m<=r)puts("Yes");
      |                     ^
Language: C

#include <bits/stdc++.h>
using namespace std;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
 
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
 
int main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    rep(i, 0, h){
        rep(j, 0, w){
            if(i<h-b && j<w-a)cout << 0;
            else if(i<h-b && j>=w-a)cout << 1;
            else if(i>=h-b && j<w-a)cout << 1;
            else cout << 0;
        }
        cout << endl;
    }
}

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

    import java.math.BigInteger;
    import java.util.Scanner;
     
    public class Main {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
     
            int n = in.nextInt();
            BigInteger []nums = new BigInteger[n];
            for (int i = 0 ; i < n ; i++){
                nums[i] = in.nextBigInteger();
            }
            BigInteger sum = BigInteger.ZERO;
            for (int i = 0 ; i < n - 1; i++){
                for (int j = i + 1; j < n; j++){
                    sum = sum.add(lcm(nums[i], nums[j]));
                }
                sum = sum.mod(BigInteger.valueOf(998244353));
            }
            System.out.println(sum.toString());
        }
     
     
        public static BigInteger gcd(BigInteger a, BigInteger b)
        {
            if (a.equals(BigInteger.ZERO))
                return b;
            return gcd(b.mod(a), a);
        }
     
        public static BigInteger lcm(BigInteger a, BigInteger b)
        {
            return (a.multiply(b)).divide(gcd(a, b));
        }
    }

Compiler output:
a.cc:1:5: error: 'import' does not name a type
    1 |     import java.math.BigInteger;
      |     ^~~~~~
a.cc:1:5: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:5: error: 'import' does not name a type
    2 |     import java.util.Scanner;
      |     ^~~~~~
a.cc:2:5: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:5: error: expected unqualified-id before 'public'
    4 |     public class Main {
      |     ^~~~~~
Language: C++

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<string>

signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
  int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    	std::string s(a,'0');
    	std::string t(w-a,'1');
        std::string ans=s+t;
  		std::string S(a,'1');
  		std::string T(w-a,'0');
  		std::string Ans=S+T;
  for(int i=0;i<h;++i){
    if(i<b){
    	printf("%s\n",ans.c_str());
    }
    else{
    	printf("%s\n",Ans.c_str());
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: 'ios' has not been declared
    6 | ios::sync_with_stdio(false);
      | ^~~
a.cc:7:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 | cin.tie(nullptr);
      | ^~~
      | std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;

int main(){
    int H, W; cin >> H >> W;
    int A, B; cin >> A >> B;
    vector<vector<int>> V(H, vector<int> (W));
    if(A == 0 || B == 0){
        if(A == 0){
            for(int i = 0; i < W; i++){
                for(int j =0 ; j < B; j++) V[j][i] = 1;
            }
        }
        else{
            for(int i = 0; i < H; i++){
                for(int j = 0; j < A; j++) V[i][j] = 1;
            }

        }

    }
    else if(H *A != W*B) {cout << "No" << endl; return 0;}
    else {
        int h = 0;
        for(int w = 0; w < W; w++){
            for(int i = 0; i < A; i++){
                V[h][w] = 1;
                h++;
                h %= H;
            }
        }
        //cout << "t" << endl;
        
    }
    for(int i = 0; i < H; i++){
        //for(int j = 0; j < W; j++) cout << V[i][j];
    /cout << endl;
    }
    cout << "No" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: expected primary-expression before '/' token
   40 |     /cout << endl;
      |     ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int n,m,a,b;
int ans[1010][1010];
void solve(){
	cin >> n >> m >> a >> b;
	
	cout << "No" << endl;
	return;
	int cnt[1010] = {};
	for(int i = 0; i < n; i++){
		int aa = a;
		bool ok = (cnt[0] < b);
		for(int j = 0; j < m; j++){
			if(aa && ok){
				ans[i][j] = 1;
				aa--;
			}
			else if(aa){
				ans[i][j] = 0;
				aa--;
			}
			else if(ok){
				ans[i][j] = 0;
			}
			else{
				ans[i][j] = 1;
				cc++;
			}
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cout << ans[i][j];
		}
		cout << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:44:33: error: 'cc' was not declared in this scope
   44 |                                 cc++;
      |                                 ^~
Language: C++

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int h,w,a,b;
    cin >> h >> w >> a >> b;
    int v[h][w];
    rep(i,h){
        rep(j,w){
            v[i][j] = ((i < a && j < b) || (i >= a && j >= b)) ? 0 :1;
        }
    }
    rep(i,h){
        rep(j,w){
            cout << v[i][j];
        }
        cout << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> h >> w >> a >> b;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i, n) for (int i = 0; i < n; i++)
a.cc:17:13: error: 'cout' was not declared in this scope
   17 |             cout << v[i][j];
      |             ^~~~
a.cc:17:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout << endl;
      |         ^~~~
a.cc:19:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:17: error: 'endl' was not declared in this scope
   19 |         cout << endl;
      |                 ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i, n) for (int i = 0; i < n; i++)
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll h,w,A,B;
  cin>>h>>w>>A>>B;
  ll a,b,c,d;
  a=INF;
  rep(i,h+1){
    rep(j,w+1){
      if(i*(w-A)+(h-i)*A==(w-j)*B+j*(h-B)&&i*A+(h-i)*(w-A)==j*B+(w-j)*(h-B)){
       a=i;
       b=h-i;
       c=j;
       d=w-j;
        break;
      }
    }
  }
  if(a==INF) {
    COUT("No");
  }
  else{
    vll H(h,w-A);
    vll W(w,h-B);
    rep(i,a){
      H[i]=A;
    }
    rep(i,c){
      W[i]=B;
    }
    vvll t(h,vll(w,0));
    rep(i,h){
      rep(j,w){
        if(H[i]>0&&W[j]>0){
          H[i]--;
          W[j]--;
          t[i][j]=1;
        }
      }
    }
    rep(i,h){
      rep(j,w){
        cout<<t[i][j];
      }
      cout<<endkl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:13: error: 'endkl' was not declared in this scope
   85 |       cout<<endkl;
      |             ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  int a,b;
  cin >> a >> b;#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  int a,b;
  cin >> a >> b;
  int tmp = 0;
  int i,j;
  for(i=0;i<h;i++){
    if(i<b)tmp = 0;
    else tmp  = 1;
    for(j=0;j<w;j++){
      if(j<a)cout<<tmp;
      else cout<<(tmp+1)%2;
    }
    cout << endl;
  }
}

  int tmp = 0;
  int i,j;
  for(i=0;i<h;i++){
    if(i<b)tmp = 0;
    else tmp  = 1;
    for(j=0;j<w;j++){
      if(j<a)cout<<tmp;
      else cout<<(tmp+1)%2;
    }
    cout << endl;
  }
}


Compiler output:
a.cc:7:17: error: stray '#' in program
    7 |   cin >> a >> b;#include<bits/stdc++.h>
      |                 ^
a.cc: In function 'int main()':
a.cc:7:18: error: 'include' was not declared in this scope
    7 |   cin >> a >> b;#include<bits/stdc++.h>
      |                  ^~~~~~~
a.cc:7:26: error: 'bits' was not declared in this scope
    7 |   cin >> a >> b;#include<bits/stdc++.h>
      |                          ^~~~
a.cc:7:31: error: 'stdc' was not declared in this scope; did you mean 'std'?
    7 |   cin >> a >> b;#include<bits/stdc++.h>
      |                               ^~~~
      |                               std
a.cc:8:1: error: expected primary-expression before 'using'
    8 | using namespace std;
      | ^~~~~
a.cc:9:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    9 | int main(){
      |         ^~
a.cc:9:9: note: remove parentheses to default-initialize a variable
    9 | int main(){
      |         ^~
      |         --
a.cc:9:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:9:11: error: a function-definition is not allowed here before '{' token
    9 | int main(){
      |           ^
Language: C++

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

int main() {
    int H, W, A, B; cin >> H >> W >> A >> B;
    F0R(i, H) {
        string ans;
        F0R(j, W) {
            ans += (((j >= A) + (i >= B)) % 2 == 0) ? '1' : '0';
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     F0R(i, H) {
      |         ^
a.cc:6:5: error: 'F0R' was not declared in this scope
    6 |     F0R(i, H) {
      |     ^~~
Language: C++

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

long long int a,b,c,d;

int main(){
  cin >> a >> b >> c >> d;
  for(long long int i = 0;i < a;i++){
    
    for(long long int j = 0;j < b;j++){
      
      cout << long long int (((i < d) + (j < c)) % 2);
    }
    
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: expected primary-expression before 'long'
   13 |       cout << long long int (((i < d) + (j < c)) % 2);
      |               ^~~~
Language: C++

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
const int maxn=1e4+50;
const int maxm=1e5+50;
const int mod=1234567;
using namespace std;
int c[1100][1100];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            if((i<=a&&j<=b)||(i>=a&&j>=b))
                c[i]=1;
        }
    }
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            cout<<c[i]<<' ';
        }
        cout<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: incompatible types in assignment of 'int' to 'int [1100]'
   20 |                 c[i]=1;
      |                 ~~~~^~
Language: C++

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
const int maxn=1e4+50;
const int maxm=1e5+50;
const int mod=1234567;
using sspace std;
int c[1100][1100];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            if((i<=a&&j<=b)||(i>=a&&j>=b))
                c[i]=1;
        }
    }
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            cout<<c[i]<<' ';
        }
        cout<<endl;
    }
    return 0;
}


Compiler output:
a.cc:7:7: error: expected nested-name-specifier before 'sspace'
    7 | using sspace std;
      |       ^~~~~~
a.cc: In function 'int main()':
a.cc:11:5: error: 'ios' has not been declared
   11 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:12:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   12 |     cin.tie(0);
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:20:21: error: incompatible types in assignment of 'int' to 'int [1100]'
   20 |                 c[i]=1;
      |                 ~~~~^~
a.cc:27:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |             cout<<c[i]<<' ';
      |             ^~~~
      |             std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |         cout<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |         cout<<endl;
      |               ^~~~
      |               std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;

signed main() {
  int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    	string s(a,'0');
    	string t(w-a,'1');
        s+=t;
  		string S(a,'1');
  		string T(w-a,'0');
  		S+=T;
  for(int i=0;i<h;i++){
    if(i<b){
    	printf("%s\n",ans);
        //cout<<s<<endl;
    }
    else{
    	printf("%s\n",ans);
        //cout<<S<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |         printf("%s\n",ans);
      |                       ^~~
      |                       abs
a.cc:25:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |         printf("%s\n",ans);
      |                       ^~~
      |                       abs
Language: C++

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

signed main() {
  int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    	string s(a,'0');
    	string t(w-a,'1');
        s+=t;
  		strins S(a,'1');
  		string T(w-a,'0');
  		S+=T;
  for(int i=0;i<h;i++){
    if(i<b){
    	//printf("%s\n",ans);
        cout<<s<<endl;
    }
    else{
    	//printf("%s\n",ans);
        cout<<S<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'strins' was not declared in this scope; did you mean 'stdin'?
   11 |                 strins S(a,'1');
      |                 ^~~~~~
      |                 stdin
a.cc:13:17: error: 'S' was not declared in this scope
   13 |                 S+=T;
      |                 ^