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

int main(void){

	long long int k,count;
	long long int i;
	double a;
	double b;
	

	scanf("%d",k);

	if(k<10){
		for(i=0;i<k;i++){
			printf("%d\n",i+1);
		}
	}
	else{
		for(i=0;i<10;i++){
			printf("%d\n",i+1);
		}
		for(i=0;i<k - 9;i++){
			printf("%d\n",19+10*i);
		}

	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf' was not declared in this scope
    9 |         scanf("%d",k);
      |         ^~~~~
a.cc:13:25: error: 'printf' was not declared in this scope
   13 |                         printf("%d\n",i+1);
      |                         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
a.cc:18:25: error: 'printf' was not declared in this scope
   18 |                         printf("%d\n",i+1);
      |                         ^~~~~~
a.cc:18:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:21:25: error: 'printf' was not declared in this scope
   21 |                         printf("%d\n",19+10*i);
      |                         ^~~~~~
a.cc:21:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstdio>
#include <utility>
#include <algorithm>
#include<cmath>
using std::cin;
using std::cout;
using std::endl;

int main(void)
{
    while(1){
    int K;
    cin>>K;
    long long num_bef=1;
    long long num_aft=2;
    long long snuke_bef=1;
    long long snuke_aft=1;
    int keta=1;
    int lock=0;
    int count=0;
    while(snuke_bef<=snuke_aft){
        lock++;
        num_bef=std::pow(10,keta-1)+std::pow(10,lock)-1;
        num_aft=num_bef+std::pow(10,lock);
        snuke_bef=num_bef/(lock*9+1);
        snuke_aft=num_aft/(lock*9+2);
    }
    int topnum=std::pow(10,keta-1);
    for(int i=1;i<(keta-lock)*9){
        std::printf("%d",topnum);
        for(int j=0;j<lock;j++){
             std::printf("9");
        }
        topnum++;
        count++;
        if(count==K) return 0;
    }
    keta++;
    lock=0;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:32: error: expected ';' before ')' token
   34 |     for(int i=1;i<(keta-lock)*9){
      |                                ^
      |                                ;
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstdio>
#include <utility>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;

int main(void)
{
    while(1){
    int K;
    cin>>K;
    long long num_bef=1;
    long long num_aft=2;
    long long snuke_bef=1;
    long long snuke_aft=1;
    int keta=1;
    int lock=0;
    int count=0;
    while(snuke_bef<=snuke_aft){
        lock++;
        num_bef=std::pow(10,keta-1)+std::pow(10,lock)-1;
        num_aft=num_bef+std::pow(10,lock);
        snuke_bef=num_bef/(lock*9+1);
        snuke_aft=num_aft/(lock*9+2);
    }
    int topnum=std::pow(10,keta-1);
    for(int i=1;i<(keta-lock)*9){
        std::printf("%d",topnum);
        for(int j=0;j<lock;j++){
             std::printf("9");
        }
        topnum++;
        count++;
        if(count==K) return 0;
    }
    keta++;
    lock=0;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:22: error: 'pow' is not a member of 'std'
   27 |         num_bef=std::pow(10,keta-1)+std::pow(10,lock)-1;
      |                      ^~~
a.cc:27:42: error: 'pow' is not a member of 'std'
   27 |         num_bef=std::pow(10,keta-1)+std::pow(10,lock)-1;
      |                                          ^~~
a.cc:28:30: error: 'pow' is not a member of 'std'
   28 |         num_aft=num_bef+std::pow(10,lock);
      |                              ^~~
a.cc:32:21: error: 'pow' is not a member of 'std'
   32 |     int topnum=std::pow(10,keta-1);
      |                     ^~~
a.cc:33:32: error: expected ';' before ')' token
   33 |     for(int i=1;i<(keta-lock)*9){
      |                                ^
      |                                ;
Language: C++

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

int main(){
	ll k;
	cin >> k;


	for (ll s = 1;s <= k;s++) {
		ll s2 = s + 1;
		ll ans2 = s2 % 9;
		for (ll i = 0;i < s2 / 9;i++) {
			ans2 *= 10;
			ans2 += 9;
		}
		
		ll ans = s % 9;
		for (ll i = 0;i < s / 9;i++) {
			ans *= 10;
			ans += 9;
		}
		cout << ans << endl;

		while (1) {
			if (s % 9 == ) {

				ans += (int)pow(10, s / 9);
				ans -= (int)pow(10, s / 9);
			}
			else {
				ans += (int)pow(10, s / 9 - 1);
				ans -= (int)pow(10, s / 9 - 2);
			}
			if (ans > 0&& (double)ans / (double)s <= (double)ans2 / (double)s2) {
				cout << ans << endl;
			}
			else {
				break;
			}
		}

	}






	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:38: error: expected primary-expression before ')' token
   26 |                         if (s % 9 == ) {
      |                                      ^
Language: C++

#include <vector>
#include <iostream>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
int main()
{
    ll K;
    cin >> K;
    double prev = 1 << 30;
    auto f = [](const int n) {
        int sum = 0;
        for (int m = n; m > 0; m /= 10) { sum += m % 10; }
        return n * 1.0 / sum;
    };
    vector<ll> ans;
    constexpr ll MAX = 100000000;
    for (ll i = MAX - 1; i >= 1; i--) {
        const auto F = f(i);
        if (prev >= F) { ans.push_back(i), prev = F; }
    }
    prev = 1 << 30;
    for (ll i = 1; i <= MAX; i++) {
        const ll j = i * 10000000 + 9999999;
        const auto F = f(j);
        if (prev >= F) { ans.push_back(j), prev = F; }
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < K; i++) { cout << ans[i] << endl; }
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll k;
    cin >> k;

    // 1
    if(k<=9){
        for(int i=1;i<=k;i++){
            cout << i << endl;
        }
        return 0;
    }
    k -= 9;
    // 1
    for(int i=1;i<=9;i++) cout << i << endl;

    // 2
    if(k<=9){
        for(int i=1;i<=k;i++){
            cout << i*10 + 9 << endl;
        }
        return 0;
    }
    for(int i=1;i<=k;i++){
        cout << i*10 + 9 << endl;
    }
    k -= 9;

    // 3
    if(k<=9){
        for(int i=1;i<=k;i++){
            cout << i << "99" << endl;
        }
        return 0;
    }
    for(int i=1;i<=k;i++){
        cout << i << "99" << endl;
    }

    k -= 9;

    // 4~
    for(int dig=4;dig<=16;dig++){
        int nine = dig-2;
        int t = nine*10;
        int ue = 100;
        if(t>=100){
            t--;
            ue*10;
        }
        if(t>=1000){
            t--;
            ue*1-;
        }
        string ss = "";
        rep(i,nine) ss += "9";
        for(int i=10;i<min(t,ue);i++){
            cout << i << ss << endl;
            if(--k==0){
                return 0;
            }
        }
        for(int i=t+9;i<ue;i++){
            cout << i << ss << endl;
            if(--k==0){
                return 0;
            }
        }
    }
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:87:18: error: expected primary-expression before ';' token
   87 |             ue*1-;
      |                  ^
Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;

bool check(long long n, long long a, long long dig) {
  long long t = 1;
  for (long long i = 0; i < dig; i++) {
    t *= 10;
  }
  for (long long i = 1; i <= 9-a; i++) {
    if ((n + t*i)/(a+i + 9*dig) < n/(a+9*dig)) return false;
  }
  return true;
}

long long main() {
  long long k;
  scanf("%llu", &k);
  long long s;
  for (long long i = 1; i<=k; i++) {
    s = i%9;
    if (s == 0) s = 9;
    long long a = s;
    long long dig = (i-1)/9;
    for (long long j = 0; j<(i-1)/9; j++) {
     s = s*10+9;
    }
    if (check(s,a,dig)) {
      printf("%llu\n", s);
    } else {
      k++;
    }
  }


  return 0;
}


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

#include <vector>
#include <iostream>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
template <typename Functor>
struct fix_type
{
    Functor functor;
    template <typename... Args>
    decltype(auto) operator()(Args&&... args) const& { return functor(functor, std::forward<Args>(args)...); }
};
template <typename Functor>
fix_type<typename std::decay<Functor>::type> fix(Functor&& functor) { return {std::forward<Functor>(functor)}; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    double prev = 1 << 30;
    auto f = [](const int n) {
        int sum = 0;
        for (int m = n; m > 0; m /= 10) { sum += m % 10; }
        return n * 1.0 / sum;
    };
    vector<ll> ans;
    constexpr ll MAX = 100000000;
    for (ll i = MAX - 1; i >= 1; i--) {
        const auto F = f(i);
        if (prev >= F) { ans.push_back(i), prev = F; }
    }
    prev = 1 << 30;
    for (ll i = 1; i <= MAX; i++) {
        const ll j = i * 10000000 + 9999999;
        const auto F = f(j);
        if (prev >= F) { ans.push_back(j), prev = F; }
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < K; i++) { cout << ans[i] << endl; }
    return 0;
}


Compiler output:
a.cc:9:19: error: 'numeric_limits' was not declared in this scope
    9 | constexpr T INF = numeric_limits<T>::max() / 10;
      |                   ^~~~~~~~~~~~~~
a.cc:9:35: error: expected primary-expression before '>' token
    9 | constexpr T INF = numeric_limits<T>::max() / 10;
      |                                   ^
a.cc:9:41: error: no matching function for call to 'max()'
    9 | constexpr T INF = numeric_limits<T>::max() / 10;
      |                                    ~~~~~^~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 0 provided
a.cc: In function 'int main()':
a.cc:44:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   44 |     sort(ans.begin(), ans.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl
const ll MODP = 1000000007;

int main(){
  ll k;cin>>k;
  int cnt=0;
  string keta_s="";
  rep(i,k){
    cnt++;
    if(cnt<10){
      cout<<stoll(to_string(cnt)+keta_s)<<endl;
    }else{
      cnt=0;
      keta++;
      keta_s=keta_s+'9';
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:7: error: 'keta' was not declared in this scope; did you mean 'keta_s'?
   37 |       keta++;
      |       ^~~~
      |       keta_s
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int k,x=10;
vector<ll>p[15];
int main(void){
    cin>>k;
    for(int i=0;i<15;i++){
        ll y=10;
        while(y<100){
            p[i].push_back(y);
            if(y<x)y++;
            else y+=10;
        }
        x+=10;
    }
    for(int i=1;i<=9&&k>0;i++){
        cout<<i<<endl;
        k--;
    }
    for(int i=10;i<90&&k>0;i+=10){
        cout<<i+9<<endl;
        k--;
    }
    ll t=10;
    for(int i=0;i<15&&k>0;i++){
        for(int j=0;j<p[i].size()&&k>0;j++){
            cout<<p[i][j]*t-1<<endl;
            k--;
        }
        t*=10;
    }
}

Compiler output:
a.cc:6:1: error: 'vector' does not name a type
    6 | vector<ll>p[15];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:12:13: error: 'p' was not declared in this scope
   12 |             p[i].push_back(y);
      |             ^
a.cc:28:23: error: 'p' was not declared in this scope
   28 |         for(int j=0;j<p[i].size()&&k>0;j++){
      |                       ^
Language: C++

/* ***********************************************
Author        :yang12138
Created Time  :2018年06月23日 星期六 20时07分34秒
File Name     :B.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)
 
 
int get(int n){
	int ans=0;
	while(n){
		ans+=n%10;
		n/=10;
	}
	return ans;
}
 
const int N=1e6+10;
double f[N];
 
bool check(ll a,ll b){
	return a*get(b)<=b*get(a);
}
 
const ll INF=1e15+1e13;
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    
	vector<ll>ans;
	ll s=1;
	for(ll i=1;i<=INF && s<=INF;i*=10LL,s+=i){
		while(1){
			bool flag=1;
			for(int j=1;j<=10;j++){
				if(!check(s,s+j*i)){
					flag=0;
					break;
				}
			}
			if(!flag) break;
			ans.push_back(s);
			s+=i; 
		}
		s-=i;
	}
 
	ll k;
	cin>>k;

	if(k>(int)ans.size()){
		while(1);
	}

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


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

#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=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()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

ll n;


ll f(ll k){
  ll res=0;
  while(k){
    res+=k%10;
    k/=10;
  }

  return res;
}

int main(){
  cin>>n;

  ll k=1,l=1;
  ll i=0;
  while(i<n){
    bool a=true;
    for(llj=k+1,j<k+1+l*10,j++){
      if(k*f(j)>j*f(k))
        a = false;
        break;
    }
     if(a){   
      cout<<k<<endl;
      i++; 
    }
    k++;
    if(k%9==0) l*=10;
  }


  return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'llj' was not declared in this scope; did you mean 'll'?
   38 |     for(llj=k+1,j<k+1+l*10,j++){
      |         ^~~
      |         ll
a.cc:38:17: error: 'j' was not declared in this scope
   38 |     for(llj=k+1,j<k+1+l*10,j++){
      |                 ^
a.cc:43:6: error: expected primary-expression before 'if'
   43 |      if(a){
      |      ^~
a.cc:42:6: error: expected ';' before 'if'
   42 |     }
      |      ^
      |      ;
   43 |      if(a){
      |      ~~
a.cc:43:6: error: expected primary-expression before 'if'
   43 |      if(a){
      |      ^~
a.cc:42:6: error: expected ')' before 'if'
   42 |     }
      |      ^
      |      )
   43 |      if(a){
      |      ~~
a.cc:38:8: note: to match this '('
   38 |     for(llj=k+1,j<k+1+l*10,j++){
      |        ^
Language: C++

#include <Bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000000000000

vector<ll>vc;
ll po(ll a,ll b)
{
    ll s = 1;
    while(b--)
        s*=a;
    return s;
}
void gen()
{
    for(int i=0; i<10; i++)
        vc.push_back(i);

    ll val;
    ll base = 1;

    for(int c=1; c<=1000; c++)
    {
        base*=10;
        val = vc[9*c];
        if(val>=MAX)
            break;
        int cnt = 9;
        while(cnt--)
        {
            val+=base;
            vc.push_back(val);
        }
    }
   // for(int i=0; i<vc.size(); i++)
    {
        //if(vc[i]>MAX) break;
       // cout << i<< " " << vc[i] << endl;
    }

//    val = vc[9*c];
//    base = po(10,c);
//    cnt = 9;
//    while(cnt--)
//    {
//        val+=base;
//        vc.push_back(val);
//    }
//    c++;

}

int main()
{
    gen();
    ll k;
    cin >> k;
    if(k<=134)
    {
        for(int i=1;i<=k;i++) cout << vc[i] << endl;
    }
    else
    {
        for(int i=1;i<(int)vc.size();i++) cout << vc[i] << endl;
    }
    return 0;

}


Compiler output:
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory
    1 | #include <Bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class P3 {
    public static class Solver {
        int n;
        int k;
        public Solver() {
            Scanner sc = new Scanner(System.in);
            long cnt = 0;
            long k = sc.nextLong();
            long n = 0;
            while (cnt < k) {
                if (cnt < 9) {
                    n++;
                } else {
                    int jmp;
                    jmp = 10;

                    n += jmp;

                    boolean bm = true;
                    for (int j = 10; j <= 1000; j += 10) {
                        bm = bm && f(n) < f(n + 10);
                    }
                    
                    while (bm) {
                        n += jmp;
                        for (int j = 10; j <= 1000; j += 10) {
                            bm = bm && f(n) < f(n + 10);
                        }
                    }
                }
                System.out.println(n);
                cnt++;
            }
        }

        double f (long digit) {
            return digit / (double) S(digit);
        }

        double S(long digit) {
            long cp = digit;
            int sum = 0;
            while (cp >= 10) {
                sum += cp % 10;
                cp /= 10;
            }

            sum += cp;
            return sum;
        }
    }

    public static void main(String[] args) {

        new Main.Solver();
    }
}


Compiler output:
Main.java:3: error: class P3 is public, should be declared in a file named P3.java
public class P3 {
       ^
Main.java:57: error: cannot access Main
        new Main.Solver();
            ^
  bad source file: ./Main.java
    file does not contain class Main
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
2 errors
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;
int main()
#if 0
    cout<<"in test mode:"<<endl;
	freopen("input.txt","r",stdin);
#endif
    long long k,x=0,c=0,e;
    cin>>k;
    e=k;
    long long a[k],b,d,f[15];
    for (long long i=1;i<1000000000000000 and e!=0;i++)
    {
	    a[x]=i;
    	b=i;
    	d=i;
    	if (i==9) i=i+9;
		for (int j=0;j<=15;j++)
    	{
    		if (b/10<0)
    		{
    			c=j;
    			break;
			}
			else 
			{
				b=b/10;
				for (int k=0;k<j-1;k++) 
				{
					f[k]=i;
					for (int l=0;l<k;l++)
					{
						f[k]=i/10;
					}
				}
			}
		}
		for (int j=0;j<c;j++) if (f[j]%10==9) d++;
    	if (d!=0) if (i%10==9) i=i+9;
    	x++;
    	e--;
	}
	for (int i=0;i<k;i++) cout<<a[i]<<endl;
    return 0;
}

Compiler output:
a.cc:11:5: error: expected initializer before 'long'
   11 |     long long k,x=0,c=0,e;
      |     ^~~~
a.cc:12:5: error: 'cin' does not name a type
   12 |     cin>>k;
      |     ^~~
a.cc:13:5: error: 'e' does not name a type
   13 |     e=k;
      |     ^
a.cc:14:17: error: 'k' was not declared in this scope
   14 |     long long a[k],b,d,f[15];
      |                 ^
a.cc:15:5: error: expected unqualified-id before 'for'
   15 |     for (long long i=1;i<1000000000000000 and e!=0;i++)
      |     ^~~
a.cc:15:24: error: 'i' does not name a type
   15 |     for (long long i=1;i<1000000000000000 and e!=0;i++)
      |                        ^
a.cc:15:52: error: 'i' does not name a type
   15 |     for (long long i=1;i<1000000000000000 and e!=0;i++)
      |                                                    ^
a.cc:46:9: error: expected unqualified-id before 'for'
   46 |         for (int i=0;i<k;i++) cout<<a[i]<<endl;
      |         ^~~
a.cc:46:22: error: 'i' does not name a type
   46 |         for (int i=0;i<k;i++) cout<<a[i]<<endl;
      |                      ^
a.cc:46:26: error: 'i' does not name a type
   46 |         for (int i=0;i<k;i++) cout<<a[i]<<endl;
      |                          ^
a.cc:47:5: error: expected unqualified-id before 'return'
   47 |     return 0;
      |     ^~~~~~
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

#include <stdio.h>

using namespace std;

int main(){
  unsigned long long k;
  scanf("%llu", &k);
  for(unsigned long long i=0; i < k; i++){
    unsigned long long sn = i + 1;
    unsigned long long nines = sn/9;
    unsigned longlong head = sn - 9*nines;
    if(head != 0){
      printf("%llu", head);
    }
    for(unsigned long long j=0; j < nines; j++){
      printf("9");
    }
    printf("\n");
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected initializer before 'head'
   11 |     unsigned longlong head = sn - 9*nines;
      |                       ^~~~
a.cc:12:8: error: 'head' was not declared in this scope
   12 |     if(head != 0){
      |        ^~~~
Language: C++

/*#include<stdio.h>
#define MS 11
typedef struct shu{
	int n;
}DataType;
void print(DataType *p)
{
	for(int i=1;i<MS;i++)
		printf("%d ",p[i].n);
	printf("\n");
}
void iint(DataType *p)
{
	for(int i=1;i<MS;i++)
		p[i].n=MS-i;
	printf("原排序结果：     ");
	print(p);
}
void charu(DataType *p)
{
	for(int i=1;i<MS;i++){
		if(p[i-1].n>p[i].n)
		{
			p[0]=p[i];
			int j;
			for(j=i-1;p[0].n<p[j].n;j--)
				p[j+1]=p[j];
			p[j+1]=p[0];
		}
	}
	printf("插入排序后结果： ");
	print(p);
}
void xuanze(DataType *p)
{
	for(int i=1;i<MS;i++){
		int k=i; 
		for(j=i+1;j<MS;j++){
			if(p[k].n>p[j].n)
				k=j;
		}
		if(k!=i)
		{
			DataType x1=p[k];
			p[k]=p[i];
			p[i]=x1;
		}
	}
	printf("选择排序后结果： ");
	print(p);
}
int part(DataType *p,int r,int l)
{
	p[0]=p[r];
	while(r<l)
	{
		while()
	}
}
void kuaipa(DataType *p,int r,int l)
{
	
}
int main()
{
	DataType dt[MS];
	iint(dt);
	charu(dt);
	iint(dt);
	xuanze(dt);
	iint(dt);
	return 0;
} */
#include<stdio.h>
__int64 k,s,i=1;
int flag=0;
int main()
{
	scanf("%I64d",&k);
	s=0;
	while(1){
		for(int j=1;j<10;j++)
		{
			printf("%I64d\n",s+i*j);
			k--;
			if(k==0)
			{
				flag=1;
				break;
			}
		}
		if(flag)
			break;
		s+=i*9;
		i*=10;
	}
	return 0;
}

Compiler output:
a.cc:75:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   75 | __int64 k,s,i=1;
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:79:24: error: 'k' was not declared in this scope
   79 |         scanf("%I64d",&k);
      |                        ^
a.cc:80:9: error: 's' was not declared in this scope
   80 |         s=0;
      |         ^
a.cc:84:44: error: 'i' was not declared in this scope
   84 |                         printf("%I64d\n",s+i*j);
      |                                            ^
a.cc:94:20: error: 'i' was not declared in this scope
   94 |                 s+=i*9;
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define forall(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define dforn(i, n) for(int i = ((int) n) - 1; i >= 0; i--)
#define db(v) cerr << #v << " = " << v << endl
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define ff first
#define ss second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
const int MAXN = 10005000;

struct frac{
    ll a, b;
};
bool operator<(frac a, frac b){
    return a.a*b.b < a.b*b.a;
}
bool operator<=(frac a, frac b){
    return a.a*b.b <= a.b*b.a;
}

ll DIEZ[19];
vector<ll> Ans;
set<ll> W, used;

ll sum(ll n){
    int ans = 0; while(n){ ans += n%10; n /= 10;}
    return ans;
}
bool tem(ll n, int i){
    n %= DIEZ[i+1];
    n /= DIEZ[i];
    return n;
}

void correme(){
    priority_queue<ll> Q;
    ll t = 1e15-1;
    Ans.pb(t); Q.push(t);
    frac mn = {1e18, 1};
    while(Q.size()){
        ll X = Q.top(); Q.pop();
        frac F = {X, sum(X)};

        if(used.find(X) != used.end())continue; used.insert(X);
        if(F <= mn) {
            Ans.pb(X); mn = F;// db(X);
            forn(i, 18)if(tem(X, i))Q.push(X - DIEZ[i]);
        }
    }
}

int main(){
//	freopen("input.txt", "r", stdin);
//	forn(i, 1e6) J[i] = {i, sum(i)};
//	frac mn = {1e9, 1};
//	dforn(i, 1e7){
//        if(J[i] <= mn){
//            if(i < 1e6)Ans.pb(i);
//            mn = J[i];
//        }
//	}
    DIEZ[0] = 1; forr(i, 1, 19)DIEZ[i] = DIEZ[i-1]*10;
    correme();
	sort(Ans.begin(), Ans.end());
//	forn(i, 200)printf("%d: %d\n", i, Ans[i]);
	int n;
	while(scanf("%d", &n) >= 1){
        forr(i, 1, n+1)printf("%lld\n", Ans[i]);
    }
	return 0;
}


Compiler output:
a.cc: In function 'void correme()':
a.cc:46:16: error: narrowing conversion of '1.0e+18' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing]
   46 |     frac mn = {1e18, 1};
      |                ^~~~
Language: C++

1
2
3
4
5
6
7
8
9
19
29
39
49
59
69
79
89
99
199
299
399
499
599
699
799
899
999
1999
2999
3999
4999
5999
6999
7999
8999
9999
19999
29999
39999
49999
59999
69999
79999
89999
99999
99999
199999
299999
399999
499999


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

#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second





int main() {
	ll k, cnt = 1, p = 1, a[5];
	cin >> k;
  vector<ll>v(100);
	for (int i = 0;i < k;i++) {
		a[i] = 1;
      v,pb(i);
	}
	for (int i = 1;i <= k;i++) {
		if (i < 10)cout << i << endl;
		else {
				cout << cnt;
				for (int j = 0;j < p;j++)cout << 9;
				cout << endl;
				if (cnt == 9)cnt = 1, p++;
				else cnt++;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: 'push_back' was not declared in this scope
   25 | #define pb push_back
      |            ^~~~~~~~~
a.cc:39:9: note: in expansion of macro 'pb'
   39 |       v,pb(i);
      |         ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second





int main() {
	ll k, cnt = 1, p = 1, a[5];
	cin >> k;
  vector<ll>v(50);
	for (int i = 0;i < k;i++) {
		a[i] = 1;
      v,pb(i);
	}
	for (int i = 1;i <= k;i++) {
		if (i < 10)cout << i << endl;
		else {
				cout << cnt;
				for (int j = 0;j < p;j++)cout << 9;
				cout << endl;
				if (cnt == 9)cnt = 1, p++;
				else cnt++;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: 'push_back' was not declared in this scope
   25 | #define pb push_back
      |            ^~~~~~~~~
a.cc:39:9: note: in expansion of macro 'pb'
   39 |       v,pb(i);
      |         ^~
Language: C++

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

#define DBG(x) cerr << #x << ": " << x << endl
using namespace std;

double eval(int64_t n) {
  double sum = 0;
  int64_t x = n;
  while (x > 0) {
    sum += x%10;
    x /= 10;
  }
  return n / (double) sum;
}

vector<int64_t> solve(int K) {
  vector<int64_t> v;
  int64_t x = 1;
  int64_t inc = 1;
  v.push_back(x);
  for (int i=0; i<K; i++) {
    if (eval(x+inc) > eval(x+10*inc))
      inc *= 10;
    x += inc;
    v.push_back(x);
  }

  for (auto n : v) {
    cerr << n << " " << eval(n) << endl;
  }

  assert(v.size() >= K);
  //K = min(K, (int)v.size());

  return vector<int64_t>(v.begin(), v.begin()+K);
}

int main() {
  int K;
  cin >> K;
  auto ret = solve(K);
  for (const auto& x : ret)
    cout << x << endl;
}


Compiler output:
a.cc: In function 'std::vector<long int> solve(int)':
a.cc:35:3: error: 'assert' was not declared in this scope
   35 |   assert(v.size() >= K);
      |   ^~~~~~
a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    4 | #include <vector>
  +++ |+#include <cassert>
    5 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
unsigned long long k,usu,n;
int main()
{
    cin>>k;
    for(int i=1;i<=min(k,9);++i) cout<<i<<'\n';
    k-=9;
    if(k<=0) return 0;
    usu=1;
    for(int i=1;i<=k;++i)
    {
        cout<<usu<<9<<'\n';
        ++usu;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: no matching function for call to 'min(long long unsigned int&, int)'
    7 |     for(int i=1;i<=min(k,9);++i) cout<<i<<'\n';
      |                    ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:7:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int')
    7 |     for(int i=1;i<=min(k,9);++i) cout<<i<<'\n';
      |                    ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:7:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
    7 |     for(int i=1;i<=min(k,9);++i) cout<<i<<'\n';
      |                    ~~~^~~~~
Language: C++

#include <bits/stdc++.h>

#define fi first
#define se second
#define pii pair<int,int>
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define mp make_pair

using namespace std;

typedef long long int64;
template<class T>

void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}

template<class T>

void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) out(x / 10);
    putchar('0' + x % 10);
}

int N,M;
int g[705][705];
struct node {
    int to,next;
}E[1000005];
int sumE,head[705],tot,col[705],que[705],qr;
pii conn[705];
bool f[2][705];

void Solve() {
    read(N);read(M);
    int u,v;
    for(int i = 1 ; i <= M ; ++i) {
	read(u);read(v);
	g[u][v] = g[v][u] = 1;
    }
    for(int i = 1 ; i <= N ; ++i) {
	for(int j = i + 1 ; j <= N ; ++j) {
	    if(!g[i][j]) {add(i,j);add(j,i);}
	}
    }
    memset(col,-1,sizeof(col));
    for(int i = 1 ; i <= N ; ++i) {
	if(col[i] == -1) {
	    qr = 0;
	    if(!dfs(i)) {puts("-1");return;}
	    int cnt[2] = {0,0};
	    for(int j = 1 ; j <= qr ; ++j) cnt[col[que[j]]]++;
	    conn[++tot] = mp(cnt[0],cnt[1]);
	}
    }
    int cur = 0;
    f[0][0] = 1;
    for(int i = 1 ; i <= tot ; ++i) {
	memset(f[cur ^ 1],0,sizeof(f[cur ^ 1]));
	for(int j = N ; j >= 0 ; --j) {
	    if(j >= conn[i].fi) f[cur ^ 1][j] |= f[cur][j - conn[i].fi];
	    if(j >= conn[i].se) f[cur ^ 1][j] |= f[cur][j - conn[i].se];
	}
	cur ^= 1;
    }
    int ans = N * N;
    for(int i = 0 ; i <= N ; ++i) {
	if(f[cur][i]) {
	    ans = min(i * (i - 1) / 2 + (N - i) * (N - i - 1) / 2,ans);
	}
    }
    out(ans);enter;
}

int main() {
    Solve();
}

Compiler output:
a.cc: In function 'void Solve()':
a.cc:55:27: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   55 |             if(!g[i][j]) {add(i,j);add(j,i);}
      |                           ^~~
      |                           std::filesystem::perm_options::add
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here
  219 |       add       = 0x2,
      |       ^~~
a.cc:62:17: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   62 |             if(!dfs(i)) {puts("-1");return;}
      |                 ^~~
      |                 ffs
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=2005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
int f[MAXN],num[MAXN],flag[MAXN][MAXN],dp[MAXN],c[MAXN];
int find(int x) { return f[x]==x?f[x]:f[x]=find(f[x]); }
int main()
{
	int n=read(),m=read(),Flag=0;
	for (int i=1,u,v;i<=m;i++) u=read(),v=read(),flag[u][v]=flag[v][u]=1;
	for (int i=1;i<=n*2;i++) f[i]=i,num[i]=(i<=n);
	for (int i=1;i<=n;i++)
		for (int j=i+1;j<=n;j++)
			if (!flag[i][j]) 
			{
				if (find(i)==find(j)||find(i+n)==find(j+n)) Flag=1;
				if (find(i)!=find(j+n)) num[find(j+n)]+=num[find(i)],f[find(i)]=find(j+n);
				if (find(i+n)!=find(j)) num[find(j)]+=num[find(i+n)],f[find(i+n)]=find(j);
			}
	for (int i=1;i<=n;i++) 
		if (find(i)=find(i+n)) Flag=1;
	if (Flag) { puts("-1"); return 0; }
	
	dp[0]=1;
	for (int i=1;i<=n;i++) dp[i]=0;
	for (int i=1;i<=n*2;i++)
		if (f[i]==i)
			for (int j=(n/2)-num[i];j>=0;j--) dp[j+num[i]]|=dp[j];
	int ans=0;
	for (int i=1;i<=n/2;i++) if (dp[i]) upmax(ans,i);
	printf("%d\n",ans*(ans-1)/2+(n-ans-1)*(n-ans)/2);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:25: error: lvalue required as left operand of assignment
   79 |                 if (find(i)=find(i+n)) Flag=1;
      |                     ~~~~^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define int long long
using namespace std;
using P = pair<int,int>;
using ll = long long;
template< typename T = long long >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}
template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}
#include <vector>
#include <utility>
struct UnionFind {
  std::vector<int> par, siz;
  void init(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++) par[i] = i;
    siz.resize(n, 1);
  }
  UnionFind(int n) {init(n);}
  int root(int n) {
    if (par[n] == n)
      return n;
    else
      return par[n] = root(par[n]);
  }
  bool issame(int x, int y) { return (root(x) == root(y)); }
  bool marge(int a, int b) {
    if (issame(a, b))
      return false;
    else {
      a = root(a), b = root(b);
      if (siz[a] < siz[b]) std::swap(a,b);
      siz[b] += siz[a];
      par[a] = par[b];
      return true;
    }
  }
  int size(int n) { return siz[root(n)]; }
};
int main(){
    int n,m;
    cin>>n>>m;
    UnionFind uni(n);
    vector<vector<bool>> e(n,vector<bool>(n,false));
    rep(i,m){
      int a,b;
      cin>>a>>b;
      a--;
      b--;
      uni.marge(a,b);
      e[a][b]=true;
      e[b][a]=true;
    }
    vector<bool> used(n,false);
    int cnt=0;
    rep(i,n){
      if(used[uni.root(i)]==false){
        cnt++;
        used[uni.root(i)]=true;
      }
    }
    if(cnt>2){
      cout<<-1<<endl;
      return 0;
    }else if(cnt==2){
      int s=uni.size(0);
      if(s*(s-1)/2+(n-s)*(n-s-1)/2
      ==m)cout<<m<<endl;
      else cout<<-1<<endl;
      return 0;
    }
    vector<int> s(n,0);
    s[0]=1;
    stack<int> task;
    task.push(0);
    while(!task.empty()){
      int p=task.top();
      task.pop();
      rep(j,n){
        if(p==j)continue;
        if(e[p][j]==false){
          if(s[p]==s[j]){
            cout<<-1<<endl;
            return 0;
          }else if(s[j]==0){
            s[j]=3-s[p];
            task.push(j);
          }
        }
      }
    }
    int cnt1=count(s.begin(),s.end(),1),cnt2=count(s.begin(),s.end(),2);
    int ret=cnt1*(cnt1-1)/2+cnt2*(cnt2-1)/2;
    rep(i,count(s.begin(),s.end(),0)){
      if(cnt1>cnt2){
        ret+=cnt2;
        cnt2++;
      }else{
        ret+=cnt1;
        cnt1++;
      }
    }
    cout<<ret<<endl;
}


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

#include <bits/stdc++.h>
#include "../lib/data_structure/union_find.hpp"

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, m;
  cin >> n >> m;
  vvi g(n, vi(n)), compg(n, vi(n));
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a][b] = 1;
    g[b][a] = 1;
  }

  UnionFind uf(n);
  REP(i, n) {
    REP(j, n) {
      if (i != j && !g[i][j]) {
        compg[i][j] = 1;
        uf.unite(i, j);
      }
    }
  }

  vi col(n, -1);
  bool bipartite = true;
  queue<int> que;
  REP(i, n) {
    if(col[i] != -1) continue;
    que.push(i);
    col[i] = 0;
    while (!que.empty()) {
      if (!bipartite) break;
      int now = que.front();
      que.pop();
      REP(i, n) {
        if (compg[now][i]) {
          if (col[i] == -1) {
            col[i] = !col[now];
            que.push(i);
          } else if (col[now] == col[i]) {
            bipartite = false;
            break;
          }
        }
      }
    }
  }

  if (!bipartite) {
    cout << -1 << endl;
    return 0;
  }

  map<int, P> mp;
  REP(i, n) {
    int r = uf.root(i);
    if (col[i]) mp[r].first++;
    else mp[r].second++;
  }

  vector<set<int>> dp(SZ(mp) + 1);
  dp[0].insert(0);
  int idx = 0;
  for (auto &e1: mp) {
    for (auto &e2: dp[idx]) {
      dp[idx + 1].insert(e1.second.first + e2);
      dp[idx + 1].insert(e1.second.second + e2);
    }

    idx++;
  }

  ll mi = LINF;
  for (auto &e: dp[idx]) {
    chmin(mi, e * (e - 1) / 2 + (n - e) * (n - e - 1) / 2);
  }
  cout << mi << endl;

}
























Compiler output:
a.cc:2:10: fatal error: ../lib/data_structure/union_find.hpp: No such file or directory
    2 | #include "../lib/data_structure/union_find.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include "../lib/data_structure/union_find.hpp"

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, m; cin >> n >> m;
  vvi g(n, vi(n)), compg(n, vi(n));
  REP(i, m) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a][b] = 1;
    g[b][a] = 1;
  }

  UnionFind uf(n);
  REP(i, n) {
    REP(j, n) {
      if(i != j && !g[i][j]) {
        compg[i][j] = 1;
        uf.unite(i, j);
      }
    }
  }

  vi col(n, -1);
  bool bipartite = true;
  queue<int> que;
  que.push(0);
  col[0] = 0;
  while(!que.empty()) {
    if(!bipartite) break;
    int now = que.front(); que.pop();
    REP(i, n) {
      if(compg[now][i]) {
        if(col[i] == -1) {
          col[i] = !col[now];
          que.push(i);
        } else if(col[now] == col[i]) {
          bipartite = false;
          break;
        }
      }
    }
  }

  if(!bipartite) {
    cout << -1 << endl;
    return 0;
  }

  map<int, P> mp;
  REP(i, n) {
    int r = uf.root(i);
    if(col[i]) mp[r].first++;
    else mp[r].second++;
  }

  vector<set<int>> dp(SZ(mp)+1);
  dp[0].insert(0);
  int idx = 0;
  for(auto &e1: mp) {
    for(auto &e2: dp[idx]) {
      dp[idx+1].insert(e1.second.first + e2);
      dp[idx+1].insert(e1.second.second + e2);
    }

    idx++;
  }

  ll mi = LINF;
  for(auto &e: dp[idx]) {
    chmin(mi, e * (e - 1) / 2 + (n - e) * (n - e - 1) / 2);
  }
  cout << mi << endl;

}
























Compiler output:
a.cc:2:10: fatal error: ../lib/data_structure/union_find.hpp: No such file or directory
    2 | #include "../lib/data_structure/union_find.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.