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

#include<stdio.h>
#include<algorithm> 
using namespace std;
int main()
{
	int a[100003];
	int i,j,n,k,sum,m,flag;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		sum=0;
		sort(a,a+n);
		k=0;
		for(i=0;i<n-1;i++)
		{
			k+=a[i];
			m=k;
			for(j=i+1;j<n;j++)
			{
				flag=1;
				if(a[j]>(2*m))
				{
					flag=0;
					break;
				}
				m+=a[j];
			}
			if(flag==1)
			sum++;
		}
		printf("%d\n",sum+1);
	}
	return 0;
}

Compiler output:
main.c:2:9: fatal error: algorithm: No such file or directory
    2 | #include<algorithm>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
int b[110000];
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",b+i);
	std::sort(b,b+a);
	long long now=0;
	for(int i=0;i<a;i++)now+=b[i];
	int ret=0;
	for(int i=a-1;i>=0;i--){
		if(b[i+1]>now*2)break;
		ret++;
		now-=b[i];
	}
	printf("%d\n",ret);
}
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
int b[110000];
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",b+i);
	std::sort(b,b+a);
	long long now=0;
	for(int i=0;i<a;i++)now+=b[i];
	int ret=0;
	for(int i=a-1;i>=0;i--){
		if(b[i+1]>now*2)break;
		ret++;
		now-=b[i];
	}
	printf("%d\n",ret);
}


Compiler output:
a.cc:44:17: error: redefinition of 'const long long int mod'
   44 | const long long mod=1000000007;
      |                 ^~~
a.cc:13:17: note: 'const long long int mod' previously defined here
   13 | const long long mod=1000000007;
      |                 ^~~
a.cc:45:17: error: redefinition of 'const long long int inf'
   45 | const long long inf=mod*mod;
      |                 ^~~
a.cc:14:17: note: 'const long long int inf' previously defined here
   14 | const long long inf=mod*mod;
      |                 ^~~
a.cc:46:17: error: redefinition of 'const long long int d2'
   46 | const long long d2=500000004;
      |                 ^~
a.cc:15:17: note: 'const long long int d2' previously defined here
   15 | const long long d2=500000004;
      |                 ^~
a.cc:47:5: error: redefinition of 'int b [110000]'
   47 | int b[110000];
      |     ^
a.cc:16:5: note: 'int b [110000]' previously declared here
   16 | int b[110000];
      |     ^
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main(){
      |     ^~~~
a.cc:17:5: note: 'int main()' previously defined here
   17 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,a[100005];

bool good(int x){
    long long s=0;
    for(int i=1;i<=min(x,n);i++) s+=a[i];
    for(int i=x+1;i<=n;i++){
        if(2*s>=a[i]) s+=a[i];
        else return 0;
    }
    return 1;
}

int32_t main(){
    ios_base :: sync_with_stdio(0);
    cin >> n;
    for(int i=1;i<=n;i++) cin >> a[i];
    sort(a+1,a+n+1);
    int p=0;
    for(int i=(1<<17);i;i/=2){
        if(good(p+i)) continue;
        else p+=i;
    }
    if(good(p+1)) p++;
    cout << n-p+1;
}


Compiler output:
a.cc: In function 'bool good(int)':
a.cc:21:23: error: no matching function for call to 'min(int&, long long int&)'
   21 |     for(int i=1;i<=min(x,n);i++) s+=a[i];
      |                    ~~~^~~~~
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:21:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   21 |     for(int i=1;i<=min(x,n);i++) s+=a[i];
      |                    ~~~^~~~~
/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:21:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |     for(int i=1;i<=min(x,n);i++) s+=a[i];
      |                    ~~~^~~~~
Language: C++

// 簡易競プロテンプレ
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n; ll a[114514], s[114514];

bool ok(int m){
 if (m<0) return false;
 if (m>=n) return true;
 ll w = s[m+1];
 for(int i=m+1;i<n;i++){
  if (w * 2 < a[i]) return false;
  w += a[i];
 }
 return true;
}
int main(void){
 cin >> n;
 for(int i=0;i<n;i++) cin >> a[i];
 sort(&a[0], &a[n]);
 for(int i=0;i<n;i++) s[i+1] = s[i] + a[i];

 int mini = 0, maxi = n;
 while(1){
  int med = (mini + maxi + rand()%2)/2;
  if (ok(med-1)) {maxi = med-1;}
  else if (!ok(med)) {mini = med+1;}
  else break;
 }
 cout << med << endl;
 return 0;
}

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

// 簡易競プロテンプレ
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n; ll a[114514], s[114514];

bool ok(int m){
 if (m<0) return false;
 if (m>=n) return true;
 ll w = s[m+1];
 for(int i=m+1;i<n;i++){
  if (w * 2 < a[i]) return false;
  w += a[i];
 }
 return true;
}
int main(void){
 cin >> n;
 for(int i=0;i<n;i++) cin >> a[i];
 sort(a.begin(), a.end());
 for(int i=0;i<n;i++) s[i+1] = s[i] + a[i];

 int mini = 0, maxi = n;
 while(1){
  int med = (mini + maxi + rand()%2)/2;
  if (ok(med-1)) {maxi = med-1;}
  else if (!ok(med)) {mini = med+1;}
  else break;
 }
 cout << med << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: request for member 'begin' in 'a', which is of non-class type 'long long int [114514]'
   20 |  sort(a.begin(), a.end());
      |         ^~~~~
a.cc:20:20: error: request for member 'end' in 'a', which is of non-class type 'long long int [114514]'
   20 |  sort(a.begin(), a.end());
      |                    ^~~
a.cc:30:10: error: 'med' was not declared in this scope
   30 |  cout << med << endl;
      |          ^~~
Language: Java

package spring;

import java.util.*;

public class ColorfulCreatures {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner s=new Scanner(System.in);
		int N=s.nextInt();
		double A[]=new double[N];
		double B=0;;
		int i=0;
		int count=1;
		
		for(i=0;i<N;i++){
			A[i]=s.nextInt();
		}
		
		Arrays.sort(A);	
		
			B=A[0];
			for(i=0;i<N-1;i++){
				
			if(A[i+1]/B<=2){
				count++;
				B+=A[i+1];
			}else{
				count=1;
				B+=A[i+1];
			}
			
			}
		
			System.out.print(count);
		}
}

Compiler output:
Main.java:5: error: class ColorfulCreatures is public, should be declared in a file named ColorfulCreatures.java
public class ColorfulCreatures {
       ^
1 error
Language: Java

import java.util.Scanner;

public class main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner s=new Scanner(System.in);
		
		int N=s.nextInt();
		double A[]=new double[N];
		double B[]=new double[N];
		int i=0,j=0;
		int color=0;
		int count=0;
		
		for(i=0;i<N;i++){
			A[i]=s.nextInt();
			B[i]=A[i];
		}
		
		for(i=N;i>=2;i--){
		 for(j=0;j<i-1;j++){
			 
			 if(A[j]>A[j+1]){
				 B[j+1]=A[j];
				 B[j]=A[j+1];
				 A[j]=B[j];
				 A[j+1]=B[j+1];
			 }
			 
		 }
		}
		
		for(i=0;i<N;i++){
			
		    count=0;
			
			for(j=0;j<N;j++){
				
				if(B[j]/B[i]<=2.0&&i!=j){
					B[i]+=B[j];
					count++;
				}
			}
			
			B[i]=A[i];
			
			if(count==N-1){
				color++;
			}
			
		}
		
		System.out.print(color);

	}

}

Compiler output:
Main.java:3: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error
Language: Java

import java.util.Scanner;

public class ColorfulCreatures {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner s=new Scanner(System.in);
		
		int N=s.nextInt();
		double A[]=new double[N];
		double B[]=new double[N];
		int i=0,j=0;
		int color=0;
		int count=0;
		
		for(i=0;i<N;i++){
			A[i]=s.nextInt();
			B[i]=A[i];
		}
		
		for(i=N;i>=2;i--){
		 for(j=0;j<i-1;j++){
			 
			 if(A[j]>A[j+1]){
				 B[j+1]=A[j];
				 B[j]=A[j+1];
				 A[j]=B[j];
				 A[j+1]=B[j+1];
			 }
			 
		 }
		}
		
		for(i=0;i<N;i++){
			
		    count=0;
			
			for(j=0;j<N;j++){
				
				if(B[j]/B[i]<=2.0&&i!=j){
					B[i]+=B[j];
					count++;
				}
			}
			
			B[i]=A[i];
			
			if(count==N-1){
				color++;
			}
			
		}
		
		System.out.print(color);

	}

}

Compiler output:
Main.java:3: error: class ColorfulCreatures is public, should be declared in a file named ColorfulCreatures.java
public class ColorfulCreatures {
       ^
1 error
Language: Java

package spring;

import java.util.Scanner;

public class ColorfulCreatures {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner s=new Scanner(System.in);
		
		int N=s.nextInt();
		double A[]=new double[N];
		double B[]=new double[N];
		int i=0,j=0;
		int color=0;
		int count=0;
		
		for(i=0;i<N;i++){
			A[i]=s.nextInt();
			B[i]=A[i];
		}
		
		for(i=N;i>=2;i--){
		 for(j=0;j<i-1;j++){
			 
			 if(A[j]>A[j+1]){
				 B[j+1]=A[j];
				 B[j]=A[j+1];
				 A[j]=B[j];
				 A[j+1]=B[j+1];
			 }
			 
		 }
		}
		
		for(i=0;i<N;i++){
			
		    count=0;
			
			for(j=0;j<N;j++){
				
				if(B[j]/B[i]<=2.0&&i!=j){
					B[i]+=B[j];
					count++;
				}
			}
			
			B[i]=A[i];
			
			if(count==N-1){
				color++;
			}
			
		}
		
		System.out.print(color);

	}

}

Compiler output:
Main.java:5: error: class ColorfulCreatures is public, should be declared in a file named ColorfulCreatures.java
public class ColorfulCreatures {
       ^
1 error
Language: Java

package spring;

import java.util.Scanner;

public class ColorfulCreatures {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner s=new Scanner(System.in);
		int N=s.nextInt();
		double A[]=new double[N];
		double B[]=new double[N];
		int i=0,j=0;
		int color=0;
		int count=0;
		
		for(i=0;i<N;i++){
			A[i]=s.nextInt();
			B[i]=A[i];
		}
		
		for(i=N;i>=2;i--){
		 for(j=0;j<i-1;j++){
			 
			 if(A[j]>A[j+1]){
				 B[j+1]=A[j];
				 B[j]=A[j+1];
				 A[j]=B[j];
				 A[j+1]=B[j+1];
			 }
			 
		 }
		}
		
		for(i=0;i<N;i++){
			
		    count=0;
			
			for(j=0;j<N;j++){
				
				if(B[j]/B[i]<=2.0&&i!=j){
					B[i]+=B[j];
					count++;
				}
			}
			
			B[i]=A[i];
			
			if(count==N-1){
				color++;
			}
			
		}
		
		System.out.print(color);

	}

}


Compiler output:
Main.java:5: error: class ColorfulCreatures is public, should be declared in a file named ColorfulCreatures.java
public class ColorfulCreatures {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[n];
		int b[] = new int[n];
		int total = 0;


		for(int i=0;i<n;i++){
			a[i]=scan.nextInt();
			b[i]=a[i];
			total +=a[i];
		}

		int size;
		int ans = 0;

		for(int i=0;i<n;i++){
			size = a[i];
			for(int j=0;j<n;j++){
				if(size*2 >= a[j] && a[j] != 0 && j != i){
					size += a[j];
					a[j] = 0;
					j = 0;
				}
				if(size == total){
					ans++;
					break;
				}

			}

			for(int k=0;k<n;k++){
				a[k]=b[k];
			}

		}

		System.out.println(ans);


	}

Compiler output:
Main.java:47: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java


import java.util.Arrays;
import java.util.Scanner;

public class creatures {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		Arrays.sort(arr);

		int count = 1;
		long curr = arr[0];
		
	
		for (int j = 1; j < n; j++) {
			if ( 2 * curr >=arr[j] ) {
				count++;

			} else {
				count = 1;
			}
			curr += arr[j];

		}
		System.out.println(count);

	}

}

Compiler output:
Main.java:5: error: class creatures is public, should be declared in a file named creatures.java
public class creatures {
       ^
1 error
Language: C++

//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define int long long
#define REP(N,i) for(int i = 0;i < N; i++)
#define RREP(N, i) for(int i = N - 1; 0 <= i;i--)
#define DUMPI(i) cout << i << endl;
#define DUMPII(i,j) cout << i << "," << j << endl;

int N;
int A[101010];
bool Ab[101010] = { false };

signed main() {
	cin >> N;
	REP(N, i) cin >> A[i];
	sort(A, A + N);
	int size, color, monsCnt;
	RREP(N, i)
	{
		memset(Ab, false, N);
		color = i;
		monsCnt = N - 1;
		size = A[i];
		Ab[i] = true;
		RREP(N, j)
		{
			//DUMPII(A[i], A[j]);
			if (!Ab[j] && i != j && A[j] <= size * 2) {
				size += A[j];
				Ab[j] = true;
				monsCnt--;
			}
		}
		if (monsCnt != 0) {
			cout << N - i << endl;
			return 0;
		}
	}
	cout << N << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'memset' was not declared in this scope
   25 |                 memset(Ab, false, N);
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |
Language: C++

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int N;
int A[100000];
int cnt;

void solve() {
  cin >> N;
  rep(i, N) {
    cin >> A[i];
  }
  sort(A, A+N);
  cnt = N;
  int i;
  ll sum = 0;
  bool flag;
  for(i = 0; i < N - 1; i++) {
    sum += A[i];
    if(sum * 2 < A[i + 1]) {
      flag = true;
      break;
    }
  }
  if(i == N - 1 && flag == false) {
    cnt = N;
  } else {
    cnt = N - (i + 1);
  }
  cout << cnt << endl;
}

int main() {
  solve();
  return 0;
}

Compiler output:
a.cc:3:9: error: 'pair' does not name a type
    3 | typedef pair<int, int> P;
      |         ^~~~
a.cc: In function 'void solve()':
a.cc:10:3: error: 'cin' was not declared in this scope
   10 |   cin >> N;
      |   ^~~
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   rep(i, N) {
      |       ^
a.cc:11:3: error: 'rep' was not declared in this scope
   11 |   rep(i, N) {
      |   ^~~
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |   sort(A, A+N);
      |   ^~~~
      |   short
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout << cnt << endl;
      |   ^~~~
a.cc:31:18: error: 'endl' was not declared in this scope
   31 |   cout << cnt << endl;
      |                  ^~~~
Language: C++

#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring>
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>

const int maxn=100005;
int n,ans;
int a[maxn];

int main()
{
	scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	sort(a,a+n);
	ll cur=0;
	rep(i,n-1)
	{
		cur+=a[i];
		if(（ll）a[i+1]>cur*2)ans++,cur=0;
	}
	printf("%d",n-ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:20: error: '\U0000ff08ll\U0000ff09a' was not declared in this scope
   66 |                 if(（ll）a[i+1]>cur*2)ans++,cur=0;
      |                    ^~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
  ll N, m = -1;
  vector<int> A;
  cin >> N;
  for (int i=0; i<N; i++) {
    int tmp;
    cin >> tmp;
    m = max(m, tmp);
    A.push_back(tmp);
  }
  sort(A.begin(), A.end());

  ll ans = N, now = 0;
  while (2 * A[now] < m) {

    ll can = A[now];
    for (int comp=now+1; comp<N; comp++) {
      if (A[comp] <= 2 * can) {
        can += A[comp];
      } else {
        ans -= (comp - now);
        A[comp] += can;
        now = comp;
        break;
      }
      if (comp == N-1) {
        now = N-1;
        break;
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: no matching function for call to 'max(ll&, int&)'
   15 |     m = max(m, tmp);
      |         ~~~^~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:   template argument deduction/substitution failed:
a.cc:15:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |     m = max(m, tmp);
      |         ~~~^~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:15:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |     m = max(m, tmp);
      |         ~~~^~~~~~~~
Language: C++

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

const int maxn = 100005;

struct creature {
	int color, size;
};

int n;
creature a[maxn];
int ok[maxn];
int sum[maxn];

int cmp(creature x, creature y) {
	return x.size < y.size;
}

void work() {
	memset(ok, 0, sizeof ok);
	memset(sum, 0, sizeof sum);
	sort(a+1, a+n+1, cmp);
	for(int i=1; i<=n; i++) sum = sum[i-1] + a[i].size;
	ok[a[n].color] = 1;
	for(int i=n-1; i>=1; i--) {
		if(ok[a[i+1].color] && sum[i]*2 >= a[i+1].size) ok[a[i].color] = 1;
		else return;
	}
}

int main() {
	
	cin >> n;
	for(int i=1; i<=n; i++) {
		cin >> a[i].size;
		a[i].color = i;
	}
	work();
	int cnt = 0;
	for(int i=1; i<=n; i++)
		if(ok[i]) cnt++;
		
	cout << cnt << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'void work()':
a.cc:23:37: error: incompatible types in assignment of 'int' to 'int [100005]'
   23 |         for(int i=1; i<=n; i++) sum = sum[i-1] + a[i].size;
      |                                 ~~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
void input_array(int how_data,int *data);
int get_random(int min, int max);
int factorial(int n);
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);

int main(void){
    int how_data;
    scanf("%d",&how_data);
    int size_data[how_data];
    input_array(how_data,size_data);
    //1匹ずつに対して生き残れるか判定
    //食べられる魚を食べて食べられなくなったら×　自分だけで〇
    //ソートしたほうがいいやつ
    //累積和で計算量減らす
    qsort(size_data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_09);
    int loop1,loop2;
    int ans=1;//最後の一匹(最大)は絶対残れる
    long int ruisekiwa=0;
    for(loop1=0;loop1<how_data-1;loop1++){
        int now_size=size_data[loop1]+ruisekiwa;//自分より小さい=間違いなく食える
        loop2=loop1+1; //自分の次
        while(1){
            if(loop2==how_data-1){
                ans++;
                //printf("OK:%d size:%d\n",loop1,size_data[loop1]);
                break;
            }else if(now_size*2>=size_data[loop2]){
                now_size+=size_data[loop2];
                loop2++;
            }else{
                break;
            }
        }
        ruisekiwa+=size_data[loop1];
    }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cccg1AH7.o: in function `main':
main.c:(.text+0x82): undefined reference to `input_array'
/usr/bin/ld: main.c:(.text+0x93): undefined reference to `qsort_09'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }

  sort(a.begin(), a.end());

  //累積わ
  vector<long long > b(n);
  b[0] = a[0];
  for(int i = 1; i < n; i++) {
    b[i] = a[i] + b[i-1];
    //cout << "i: " << i <<" " << b[i]  << endl;
  }

  int cnt =0;
  for(int i = n-2; i >= 0; i--) {
    if(b[i] * 2>= a[i+1]) {
      cnt++;
    }else {
      //cout << b[i] <<" " << a[i+1] << endl;
      break;
    }
  }

  cout << cnt + 1 << endl;

  return 0;
}


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

#include <iostream>
#include <vector>
using namespace std;
typedef long long lli;
lli n;
vector<lli> a;
lli sum = 0;
int main(int argc, char const *argv[]) {
    cin >> n;
    a = vector<lli> (n);
    for(lli i = 0;i < n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    lli j;
    for(lli i = 0;i < n;i++){
        if(sum * 2 < a[i]) j = i;
        sum += a[i];
    }
    cout << n-j << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |     sort(a.begin(),a.end());
      |     ^~~~
      |     short
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;
}

vi col;
map<int, bool> notnibu;
void sch(int now, int prev, int nowcol, const vvi &g, UnionFind &uf) {
  col[now] = nowcol;
  for(auto &nxt: g[now]) {
    if(nxt == prev) continue;
    if(col[nxt] == nowcol) {
      notnibu[uf.root(now)] = true;
      return;
    } else if(col[nxt] == -1) {
      sch(nxt, now, !nowcol, g, uf);
      if (notnibu[uf.root(now)]) return;
    }
  }
}

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

  ll n, m; cin >> n >> m;
  vvi g(n);
  UnionFind uf(n);
  REP(i, m) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
    uf.unite(a, b);
  }

  col.resize(n, -1);
  int id = 0;
  REP(i, n) {
    if(col[i] != -1) continue;
    sch(i, -1, 0, g, uf);
    id++;
  }

  ll a = 0, b = 0, c = 0;
  map<int, bool> one;
  REP(i, n) {
    if(uf.size(i) == 1) {
      one[uf.root(i)] = true;
      c++;
    }
  }
  vector<bool> sel(n);
  REP(i, n) {
    int e = uf.root(i);
    if(e == -1) continue;
    if(one[e] || sel[e]) continue;
    else if(notnibu[e]) b++;
    else a++;
    sel[e] = true;
  }

  cout << (a + b) * (a + b) + a * a + n * n - (n - c) * (n - c) << 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;
}

vi col;
vi vid;
map<int, bool> notnibu;
void sch(int now, int prev, int nowcol, int id, const vvi &g) {
  col[now] = nowcol;
  vid[now] = id;
  for(auto &nxt: g[now]) {
    if(nxt == prev) continue;
    if(col[nxt] == nowcol) {
      notnibu[id] = true;
      return;
    } else if(col[nxt] == -1) {
      sch(nxt, now, !nowcol, id, g);
      if (notnibu[id]) return;
    }
  }
}

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

  ll n, m; cin >> n >> m;
  vvi g(n);
  UnionFind uf(n);
  REP(i, m) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
    uf.unite(a, b);
  }

  col.resize(n, -1);
  vid.resize(n, -1);
  int id = 0;
  REP(i, n) {
    if(col[i] != -1) continue;
    sch(i, -1, 0, id, g);
    id++;
  }

  ll a = 0, b = 0, c = 0;
  map<int, bool> one;
  REP(i, n) {
    if(uf.size(i) == 1) {
      one[vid[i]] = true;
      c++;
    }
  }
  vector<bool> sel(n);
  for(auto &e: vid) {
    if(one[e] || sel[e]) continue;
    else if(notnibu[e]) b++;
    else a++;
    sel[e] = true;
  }

  cout << (a + b) * (a + b) + a * a + n * n - (n - c) * (n - c) << 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<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define int ll
vector<ll> node[100005];
ll groups[100005]={0},group_num[100005]={0},col[100005]={0};
bool used[100005]={0};
bool dfs(ll pos,ll k,ll cl){
  used[pos]=true;
  groups[pos]=k;
  col[pos]=cl;
  ll nc=cl%2;
  nc++;
  bool res=true;
  for(int i=0;i<node[pos].size();i++){
    ll to=node[pos][i];
    if(!used[to]){
      used[to]=true;
      groups[to]=k;
      col[to]=nc;
      dfs(to,k,nc);
    }
    if(col[to]!=nc){
      res=false;
    }
  }
  return res;
}
signed main(){
  ll n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    ll s,t;
    cin>>s>>t;
    node[s].push_back(t);
    node[t].push_back(s);
  }
  for(int i=1;i<=n;i++) used[i]=false;
  ll cnct_num=0,a=0,b=0,c=0;
  for(int i=1;i<=n;i++){
    if(!used[i]){
      used[i]=true;
      group[i]=cnct_num;
      if(node[i].size()==0) {
        c++;
        cnct_num++;
        continue;
      }
      bool f=dfs(i,cnct_num,1);
      if(f) {
        b++;
      //  cout<<"B"<<i<<endl;
      }
      else{
        a++;
      //  cout<<"A"<<i<<endl;
      }
      cnct_num++;
    }
  }
  cout<<a*a+2*a*b+2*b*b+c*(n*2-c)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:7: error: 'group' was not declared in this scope; did you mean 'groups'?
   46 |       group[i]=cnct_num;
      |       ^~~~~
      |       groups
Language: C++

    #include <bits/stdc++.h>
    using namespace std;
     
    using ll = long long;
    using Pi = pair<int, int>;
    using Pl = pair<ll, ll>;
    using vint = vector<int>;
    using vll = vector<ll>;
    template<typename T> using uset = unordered_set<T>;
    template<typename T1, typename T2> using umap = unordered_map<T1, T2>;
     
    constexpr int INF = (1 << 30) - 1;
    constexpr ll LLINF = 1LL << 60;
    constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
    constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
    constexpr char el = '\n';
    constexpr int mod = 1000000007;
     
    template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
    template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
    template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
    template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
     
    int N, M;
    vector<vint> G(100005);
    bool flag[100005] = {};
    int color[100005];
     
    int dfs(int v, int c = 0) {
            int ret = 1;
            if (color[v] != -1 && c != color[v]) return (0);
            color[v] = c;
            if (flag[v]) return (1);
            flag[v] = true;
            //cout << v << endl;
            for (auto &u : G[v]) ret &= dfs(u, 1 - c);
            return (ret);
    }
     
    int main() {
            cin >> N >> M;
            fill_n(color, 100005, -1);
            for (int i = 0; i < M; i++) {
                    int u, v;
                    cin >> u >> v; --u, --v;
                    G[u].push_back(v);
                    G[v].push_back(u);
            }
            int colorable = 0;
            int cnt = 0;
            for (int i = 0; i < N; i++) {
                    if (!flag[i]) {
                            if (G[i].size > 0) colorable += dfs(i);
                            cnt++;
                    }
            }
  
            ll ans = cnt * cnt;
            ans += (ll)colorable * (colorable - 1);
     
            cout << ans << endl;
            return (0);
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:53:38: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   53 |                             if (G[i].size > 0) colorable += dfs(i);
      |                                          ()
Language: C++

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

ll N, M, color[100001], A, B, C;
vector<int> G[100001];

bool dfs(int now, int c){
	color[now] = c;
	for(int i=0; i<G[now].size(); i++){
		if(color[G[now][i]] != -1){
			if(color[G[now][i]] == c) return false;
			continue;
		}else{
			if(!dfs(G[now][i], 1-c)) return false;
		}
	}
	return true;
}

void dfs2(int now){
  color[now] = 2;
  for(not i=0; i<G[now].size(); i++){
    if(color[G[now][i]] == 2)
      dfs2(G[now][i]);
  }
  return;
}

int main(){
	cin >> N >> M;
	for(int i=0; i<M; i++){
		int u, v; cin >> u >> v;
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=0; i<N; i++) color[i] = -1;
	for(int i=0; i<N; i++){
		if(!G[i].size()) A++;
		else{
			if(color[i] != -1) continue;
			if(dfs(i, 0)) B++;
			else{C++;
                       dfs2(i);

                    }
		}
	}
	ll ans = 2*B*B + A*A + 2*A*(N-A) + 2*B*C + C*C;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void dfs2(int)':
a.cc:24:11: error: 'i' was not declared in this scope
   24 |   for(not i=0; i<G[now].size(); i++){
      |           ^
Language: C++

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

ll N, M, color[100001], A, B, C;
vector<int> G[100001];

bool dfs(int now, int c){
	color[now] = c;
	for(int i=0; i<G[now].size(); i++){
		if(color[G[now][i]] != -1){
			if(color[G[now][i]] == c) return false;
			continue;
		}else{
			if(!dfs(G[now][i], 1-c)) return false;
		}
	}
	return true;
}

void dfs2(int now){
  color[now] = 1;
  for(not i=0; i<G[now].size(); i++){
    if(color[G[now][i]] == -1)
      dfs2(G[now][i]);
  }
  return;
}

int main(){
	cin >> N >> M;
	for(int i=0; i<M; i++){
		int u, v; cin >> u >> v;
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=0; i<N; i++) color[i] = -1;
	for(int i=0; i<N; i++){
		if(!G[i].size()) A++;
		else{
			if(color[i] != -1) continue;
			if(dfs(i, 0)) B++;
			else{C++;
                       dfs2(i);

                    }
		}
	}
	ll ans = 2*B*B + A*A + 2*A*(N-A) + 2*B*C + C*C;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs2(int)':
a.cc:24:11: error: 'i' was not declared in this scope
   24 |   for(not i=0; i<G[now].size(); i++){
      |           ^
Language: C++

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

int N, M, color[100001], cnt, cnt1, cnt2, used[100001];
vector<int> G[100001];

bool dfs(int now, int c){
	color[now] = c;
	if(c == 1) cnt1++;
	else cnt2++;
	for(int i=0; i<G[now].size(); i++){
		if(color[G[now][i]] != -1){
			if(color[G[now][i]] == c) return false;
		}else{
			if(!dfs(G[now][i], 1-c)) return false;
		}
	}
	return true;
}

void dfs2(int now){
	used[now] = 1;
	cnt++;
	for(int i=0; i<G[now].size(); i++){
		if(used[G[now][i]] == 0){
			dfs(G[now][i]);
		}
	}
	return;
}

int main(){
	cin >> N >> M;
// 二部グラフの連結成分それぞれについて、(1の個数と0の個数) 二部グラフでない連結成分のそれぞれの要素数
	vector<P> nibu, not;
	for(int i=0; i<N; i++){
		int u, v; cin >> u >> v;
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=0; i<N; i++) color[i] = -1;
	for(int i=0; i<N; i++){
		cnt = 0, cnt1 = 0; cnt2 = 0;
		if(color[i] != -1) continue;
		if(dfs(i, 0)) nibu.push_back(P(cnt1, cnt2));
		else{
			dfs2(i);
			not.push_back(cnt);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'void dfs2(int)':
a.cc:28:28: error: too few arguments to function 'bool dfs(int, int)'
   28 |                         dfs(G[now][i]);
      |                         ~~~^~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | bool dfs(int now, int c){
      |      ^~~
a.cc: In function 'int main()':
a.cc:37:25: error: expected unqualified-id before 'not' token
   37 |         vector<P> nibu, not;
      |                         ^~~
a.cc:51:28: error: expected primary-expression before '.' token
   51 |                         not.push_back(cnt);
      |                            ^
Language: C++

//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const long long N = 1000 * 100 + 5;
long long c[N], n, cnt = 0, is, bi, nbi;
vector < long long > graph[N];
bool mark[N], b;
void dfs(long long v)
{
	mark[v] = 1;
	for (auto u : graph[v])
	{
		if (c[u] == c[v])
		{
			b = 0;
		}
		if (!mark[u])
		{
			c[u] = 1 - c[v];
			dfs(u);
		}
	}
	return;
}
void dfs2()
{
	memset(c , -1 , sizeof c);
	for(long long i = 0; i < n; i++)
	{
		if(!mark[i])
		{
			cnt++;
			b = 1;
			c[i] = 1;
			if(graph[i].size())
			{
				dfs(i);
				if(b)
				{
					bi++;
				}
				else
				{
					nbi++;
				}
			}
			else
			{
				is++;
			}
		}
	}
	return;
}
int main()
{
	long long m;
	cin >> n >> m;
	for (long long i = 0; i < m; i++)
	{
		long long u, v;
		cin >> u >> v;
		graph[u - 1].push_back(v - 1);
		graph[v - 1].push_back(u - 1);
	}
	dfs2();
	cout << (bi + nbi) * (bi + nbi) + bi * bi + 2 * n * is - is * is << endl;
}


Compiler output:
a.cc: In function 'void dfs2()':
a.cc:41:9: error: 'memset' was not declared in this scope
   41 |         memset(c , -1 , sizeof c);
      |         ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<numeric>
  +++ |+#include <cstring>
   15 |
Language: C++

#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
  int n,m;cin>>n>>m;
  vector<int> v[n+1];
  int a[m],b[m];
  map<pii,int> mp;
  rep(i,0,m){
    cin>>a[i]>>b[i];
    v[a[i]].push_back(b[i]);
    v[b[i]].push_back(a[i]);
    mp[{a[i],b[i]}]=i;
    mp[{b[i],a[i]}]=i;
  }
  bool used[n+1],usedm[m];
  fill(used,used+n+1,false);
  fill(usedm,usedm+m,false);
  ll num[3];
  fill(num,num+3,0);
  int col[n+1];
  fill(col,col+n+1,-1);
  rep(i,1,n+1){
    if(used[i])continue;
    queue<int> q;q.push(i);
    used[i]=true;
    col[now]=0;
    int c=0;
int cnt=0;
    while(q.size()>0){
      int now=q.front();q.pop();
      cnt++;
      rep(j,0,v[now].size()){
        int ne=v[now][j];
        int nec=col[now]^1;
        if(col[ne]>=0){
          if(col[ne]!=nec){
            c=1;
          }
        }
        else{
          col[ne]=nec;
          q.push(ne);
          used[ne]=true;
        }
      }
    }
    if(cnt==0)num[0]++;
    else if(c==1)num[1]++;
    else num[2]++;
  }
  ll ans=2*num[2]*num[2];
  ans+=num[1]*num[1]+2*num[1]*num[2];
  ans+=2*n*num[0]-num[0]*num[0];
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:9: error: 'now' was not declared in this scope; did you mean 'pow'?
   72 |     col[now]=0;
      |         ^~~
      |         pow
Language: C++

/*Program from Luvwgyx*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
const int maxm=2e5+10;
struct node{int to,nxt;}e[maxm<<1];
int tot,p,c,d,flag,head[maxn],deg[maxn],vis[maxn],col[maxn];
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(ll x){print(x);puts("");}
void add(int u,int v){e[++tot].to=v;e[tot].nxt=head[u];head[u]=tot;deg[u]++;}
void insert(int u,int v){add(u,v);add(v,u);}
void dfs(int x){
    for(int i=head[x],v=e[i].to;i;i=e[i].nxt,v=e[i].to){
        if(!vis[v])col[v]=col[x]^1,vis[v]=1,dfs(v);
        else if(col[v]^col[x]^1)c-=flag,d+=flag,flag=0;
    }
}
int main(){
    int n=read(),m=read();
    for(int i=1;i<=m;i++)insert(read(),read());
    for(int i=1;i<=n;i++){
        if(!deg[i])p++;
        else if(!vis[i])flag=1,c++,vis[i]=1,dfs(i);
    }write(p*n+p*(n-p)+d*d+c*2*(d+c));
    return 0;
}


Compiler output:
a.cc:16:6: error: variable or field 'print' declared void
   16 | void print(ll x){
      |      ^~~~~
a.cc:16:12: error: 'll' was not declared in this scope
   16 | void print(ll x){
      |            ^~
a.cc:21:6: error: variable or field 'write' declared void
   21 | void write(ll x){print(x);puts("");}
      |      ^~~~~
a.cc:21:12: error: 'll' was not declared in this scope
   21 | void write(ll x){print(x);puts("");}
      |            ^~
a.cc: In function 'int main()':
a.cc:36:6: error: 'write' was not declared in this scope; did you mean 'fwrite'?
   36 |     }write(p*n+p*(n-p)+d*d+c*2*(d+c));
      |      ^~~~~
      |      fwrite
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll dsu[100005],vis[100005],m,x,y,z,u,v,n,i,sum=0,tmp=0;
vector<ll> s[100005];
void dfs(int p,int f)
{
	ll i,v;
	sum++;
	vis[p]=1;
	for(i=0;i<s[p].size();i++)
	{
		v=s[p][i];
		if(vis[v]&&v!=f)tmp=1;
		if(vis[v])continue;
		dfs(v,p);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)dsu[i]=i;
	for(i=1;i<=m;i++)
	{
		scanf("%d%d",&u,&v);
		s[u].push_back(v);
		s[v].push_back(u);
	}
	for(i=1;i<=n;i++)
	{
		if(vis[i])continue;
		sum=tmp=0;
		dfs(i,0);
		if(sum==1)x++;
		else 
		{
			if(tmp==0)y++;
			else z++;
		}
	}
	printf("%lld\n",2LL*n*x-x*x+2LL*y*y+z*z+2LL*z*y);
	return 0;
}

Compiler output:
a.cc:6:1: error: 'vector' does not name a type
    6 | vector<ll> s[100005];
      | ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:12:19: error: 's' was not declared in this scope
   12 |         for(i=0;i<s[p].size();i++)
      |                   ^
a.cc: In function 'int main()':
a.cc:27:17: error: 's' was not declared in this scope
   27 |                 s[u].push_back(v);
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
 
#define INF ((1ll<<60)-233)
#define sqr(x) ((x)*(x))
#define debug puts("wzpkking")
using namespace std;
const int N=100005;
int n,m,I,P,Q,co[N];
vector<int> e[N];
bool check(int x,int fa,int c){
	co[x]=c;
	bool ans=1;
	for (auto i:e[x]){
		if (i==fa) continue;
		if (!co[i]) ans&=check(i,x,-c);
		else ans&=(c!=co[i]);
	}
	return ans;
}
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,m){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].PB(y); e[y].PB(x);
	}
	For(i,1,n){
		if (co[i]) continue;
		if (e[i].size()==0) I++;
		else if (check(i,0,-)) Q++;
		else P++;
	}
	printf("%lld\n",1ll*I*I+2ll*I*(n-I)+1ll*P*P+2LL*P*Q+2ll*Q*Q);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:37: error: expected primary-expression before ')' token
   57 |                 else if (check(i,0,-)) Q++;
      |                                     ^
Language: C++

dtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjykdtjhyjyk

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

#include <cstdio>
#include <cstring>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

typedef long long LL;
int n,m,cnt0,cnt1,cnt2,c[100100];
struct edge
{
    int v;
    edge *nxt;
} pool[400100],*tp=pool,*fst[100100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

bool dfs(int x,int w)
{
    if (c[x]!=-1)
        return c[x]!=w;
    c[x]=w;
    for (edge *i=fst[x]; i; i=i->nxt)
        if (dfs(i->v,w^1))
            return 1;
    return 0;
}

int main()
{
    for (scanf("%d%d",&n,&m); m--;)
    {
        int u=getint(),v=getint();
        *tp=(edge){v,fst[u]},fst[u]=tp++;
        *tp=(edge){u,fst[v]},fst[v]=tp++;
    }
    memset(c,255,sizeof(c));
    repu(i,1,n)
        if (c[i]==-1)
            if (!fst[i])
                ++cnt0;
            else
                dfs(i,0)?++cnt2:++cnt1;
    LL ans=LL(cnt0)*n*2-LL(cnt0)*cnt0;
    ans+=LL(cnt1)*cnt1*2;
    ans+=LL(cnt1*2+cnt2)*cnt2;
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int getint()':
a.cc:18:13: error: 'isdigit' was not declared in this scope
   18 |     while (!isdigit(ch=getchar()));
      |             ^~~~~~~
a.cc:20:12: error: 'isdigit' was not declared in this scope
   20 |     for (; isdigit(ch=getchar()); x=x*10+ch-'0');
      |            ^~~~~~~