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


#include <bits/stdc++.h>
using namespace std;
bitset<4000002> dp
int main()
{
    int n;
    cin>>n;
   dp[0]=1;
    int a[n],s=0;
    for(int i=0;i<n;i++)
    {
      int x;
        cin>>x;
        dp|=(dp<<x);
    }
    int j=0;
    for(j=(s+1)/2;j<=s;j++)
    {
        if(dp[j])
            break;
    }
    cout<<j<<"\n";
    return 0;
}


Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main()
      | ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <ctime>
#define N 2005
using namespace std;
int n;
int num[N] , dp[2][N] , q[2][N] , vis[2][N];
template < typename T >
inline void read( T & res ) {
	res = 0;
	char aa = getchar();
	T pd = 1;
	while ( aa < '0' || aa > '9' ) {
		if ( aa == '-' ) {
			pd = -pd;
		}
		aa = getchar();
	}
	while ( aa >= '0' && aa <= '9' ) {
		res = ( res << 1 ) + ( res << 3 ) + ( aa - '0' );
		aa = getchar();
	}
	res *= pd;
	return;
}
inline int abs( int x ) {
	return x < 0 ? -x : x;
}

int main () {
	read(n);
	int sum = 0;
	for ( int i = 1 ; i <= n ; ++i ) {
		read(num[i]);
		sum += num[i];
	}
	if ( n == 1 ) {
		printf("%d",sum);
		return 0;
	}
	int pos = 1;
	int head1 , tail1 , tail2;
	tail2 = 0;
	head1 = 1;
	tail1 = 0;
	q[pos][++tail1] = 0;
	for ( int i = 1 ; i <= n ; ++i ) {
		memset( dp[pos] , 0 , sizeof(dp[pos]) );
		memset( vis[pos] , 0 , sizeof(vis[pos]) );
		while ( head1 <= tail1 ) {
			int tem = q[pos][head1];
			head1++;
			if ( num[i] + tem < 2001 ) {	
				if ( !vis[pos ^ 1][num[i] + tem] ) {
					q[pos ^ 1][++tail2] = num[i] + tem;
					dp[pos ^ 1][num[i] + tem] = 1;
					vis[pos ^ 1][num[i] + tem] = 1;
				}
			}
			if ( !vis[pos ^ 1][abs( num[i] - tem )] ) {
				q[pos ^ 1][++tail2] = abs( num[i] - tem );
				dp[pos ^ 1][abs( num[i] - tem )] = 1;
				vis[pos ^ 1][abs( num[i] - tem )] = 1;
			}
		}
		head1 = 1;
		tail1 = tail2;
		tail2 = 0;
		pos ^= 1;
	}
	int res;
	for ( int i = 0 ; i <= 2000 ; ++i ) {
		if ( dp[pos][i] ) {
			res = i;
			break;
		}
	}
	sum = ( sum + res ) >> 1;
	printf("%d",sum);
	return 0;


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

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

template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
/*
全部で1つのサーキットになってないとダメなのはそう
その上で4つ以上のそれが3つあったらYes?
*/
typedef pair<int,int> P;
set<P> s;
bool in(int u,int v){
  if(u>v)swap(u,v);
  return (s.count(u,v));
}
void to(int u,int v){
  if(u>v)swap(u,v);
  s.insert(P(u,v));
}

signed main(){
  int N,M;cin>>N>>M;
  vector<int> edge[N];
  for(int i=0;i<M;i++){
    int u,v;cin>>u>>v;u--;v--;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  int six,four;six=four=0;
  for(int i=0;i<N;i++){
    if(edge[i].size()&1)fin("No");
    six+=(edge[i].size()>=6);
    four+=(edge[i].size()==4);
  }
  if(six||four>2)fin("Yes");
  if(four<2)fin("No");
  int u=-1,v;
  for(int i=0;i<N;i++){
    if(edge[i].size()==4){
      if(~u)v=i;
      else u=i;
    }
  }
  for(int i=0;i<4;i++){
    int now=edge[u][i];
    to(u,now);
    while(now!=v){
      if(now==u)fin("Yes");
      int a=edge[now][0];
      if(!in(now,a)){
        to(now,a);
        now=a;
      }
      else{
        a=edge[now][1];
        to(now,a);
        now=a;
      }
    }
  }
  fin("No");
}


Compiler output:
a.cc: In function 'bool in(int, int)':
a.cc:17:18: error: no matching function for call to 'std::set<std::pair<int, int> >::count(int&, int&)'
   17 |   return (s.count(u,v));
      |           ~~~~~~~^~~~~
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:756:9: note: candidate: 'template<class _Kt> decltype (((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_count_tr(__x)) std::set<_Key, _Compare, _Alloc>::count(const _Kt&) const [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]'
  756 |         count(const _Kt& __x) const
      |         ^~~~~
/usr/include/c++/14/bits/stl_set.h:756:9: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_set.h:750:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::count(const key_type&) const [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; size_type = long unsigned int; key_type = std::pair<int, int>]'
  750 |       count(const key_type& __x) const
      |       ^~~~~
/usr/include/c++/14/bits/stl_set.h:750:7: note:   candidate expects 1 argument, 2 provided
Language: C++

#include<bits/stdc++.h>
int a[1e4],s,n,i;
std::bitset<1e7> d;     
int main(){
    std::cin>>n;d[0]=1;
    for(;i<n;i++)std::cin>>a[i],s+=a[i],d|=(d<<a[i]);
    while(!d[++s/2]){} std::cout<<s/2;
}

Compiler output:
a.cc:2:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | int a[1e4],s,n,i;
      |       ^~~
a.cc:2:7: error: could not convert '1.0e+4' from 'double' to 'long unsigned int'
    2 | int a[1e4],s,n,i;
      |       ^~~
      |       |
      |       double
a.cc:2:7: error: size of array 'a' has non-integral type 'double'
a.cc:3:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    3 | std::bitset<1e7> d;
      |                ^
a.cc:3:16: error: could not convert '1.0e+7' from 'double' to 'long unsigned int'
    3 | std::bitset<1e7> d;
      |                ^
      |                |
      |                double
a.cc: In function 'int main()':
a.cc:5:18: error: invalid types 'int[int]' for array subscript
    5 |     std::cin>>n;d[0]=1;
      |                  ^
a.cc:7:13: error: invalid types 'int[int]' for array subscript
    7 |     while(!d[++s/2]){} std::cout<<s/2;
      |             ^
Language: C++

#include<bits/stdc++.h>
#define N 2005
using namespace std;
inline int read(){
	int x=0; bool f=1; char c=getchar();
	for(;!isdigit(c); c=getchar()) if(c=='-') f=0;
	for(; isdigit(c); c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	if(f) return x; return 0-x;
}
int n,sum;
bitset<N*N> b; 
int main(){
	n=read();
	int a;
	for(int i=1; i<=n; ++i){
		a=read();
		b|=b<<a;
		sum+=a;
	}
	for(int i=(sum+1)/2; i<=sum; ++i) if(b[i]) printf("%d\n",i), return 0;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:70: error: expected primary-expression before 'return'
   20 |         for(int i=(sum+1)/2; i<=sum; ++i) if(b[i]) printf("%d\n",i), return 0;
      |                                                                      ^~~~~~
Language: C++

#include<bits/stdc++.h>
#define N 2005
using namespace std;
inline int read(){
	int x=0; bool f=1; char c=getchar();
	for(;!isdigit(c); c=getchar()) if(c=='-') f=0;
	for(; isdigit(c); c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	if(f) return x; return 0-x;
}
int n,sum;
bitset<N*N> b; 
int main(){
	n=read();
	for(int i=1; i<=n; ++i){
		a=read();
		b|=b<<a;
		sum+=a;
	}
	for(int i=(sum+1)/2; i<=sum; ++i) if(b[i]) printf("%d\n",i), return 0;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'a' was not declared in this scope
   15 |                 a=read();
      |                 ^
a.cc:19:70: error: expected primary-expression before 'return'
   19 |         for(int i=(sum+1)/2; i<=sum; ++i) if(b[i]) printf("%d\n",i), return 0;
      |                                                                      ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;


int N, A;
ll DP[4000001][100], S[100];
int main() {
	cin >> N;
	DP[0][0] = 1;
	for (int i = 0; i < N; ++i) {
		cin >> A;
		for (int j = i*2000; j >= 0; --j) {
			for (int k = 0; k < 100; ++k) {
				DP[j + A][k] += DP[j][k];
				DP[j + A][k + 1] += DP[j + A][k] / (1 << 30);
				DP[j + A][k] %= (1 << 30);
			}
		}
	}
	for (int i = N * 2000; i >= 0; --i) {
		for (int j = 0; j < 100; ++j) {
			S[j] += DP[i][j];
			S[j + 1] += S[j] / (1 << 30);
			S[j] %= (1 << 30);
		}
		if (S[(N - 1) / 30 + 1] || S[(N - 1) / 30] >= (1 << ((N - 1) % 30))) {
			cout << i << endl;
			return 0;
		}
	}
}


Compiler output:
/tmp/ccNSInli.o: in function `main':
a.cc:(.text+0x319): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x36f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x38a): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x3a2): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x3d5): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x3ed): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x466): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
a.cc:(.text+0x4a2): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccNSInli.o
collect2: error: ld returned 1 exit status
Language: C++

//In The Name of Beauty
//...So here I go is my shot
//Feet fail me not 'cause maybe the only opportunity that I got...
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 6e5 + 8;
ll const delta = 1000000007;
bool dp[MAXN];
ll a[MAXN];
int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll sum = 0;
    for(ll i = 0;i < n;i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    if(n == 1)return cout << a[0],0;
    dp[0] = 1;
    for(ll i = 0;i < n;i++)
    {
        for(ll j = MAXN - 1;j >= a[i];j--)
        {
            dp[j] |= dp[j - a[i]];
        }
    }
    ll ans = MAXN - 1;
    for(ll j = 0;j < MAXN;j++)
    {
        if(dp[j])ans = min(ans,llabs(j - (sum - j)));
    }
    cout << (sum + ans) / 2;
    return 0;
}
//Written by M_H_H_7


Compiler output:
a.cc: In function 'int main()':
a.cc:43:27: error: no matching function for call to 'min(ll&, long long int)'
   43 |         if(dp[j])ans = min(ans,llabs(j - (sum - j)));
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
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:4:
/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:43:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   43 |         if(dp[j])ans = min(ans,llabs(j - (sum - j)));
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/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:43:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   43 |         if(dp[j])ans = min(ans,llabs(j - (sum - j)));
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

/**
 *    author:  Atrues
 *    created: 26.01.2019 18:13
**/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	int sum = 0;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		sum += a[i];
	}
	if (n == 1)
		return cout << sum << endl, 0;
	cout << sum / 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'a' was not declared in this scope
   17 |                 cin >> a[i];
      |                        ^
Language: C++

#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;
int n;
vector<int> a;
bitset<400400> bs;

int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  set<int> s;
  int sum = 0;
  for (int i = 0; i < n; i++)
    sum += a[i];
  bs.set(0);
  for (int i = 0; i < n; i++) {
    bs |= bs << a[i];
  }
  for (int i = (sum + 1) / 2; i <= sum; i++) {
    if (bs[i]) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Compiler output:
a.cc:16:1: error: 'bitset' does not name a type
   16 | bitset<400400> bs;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:27:3: error: 'bs' was not declared in this scope; did you mean 's'?
   27 |   bs.set(0);
      |   ^~
      |   s
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A[2001];
	int Asum=0;
	scan(N);
	rep(i,N){
		scan(A[i]);
		Asum+=A[i];
	}
	bitset<4000001> dp;
	dp.set(0);
	rep(i,N){
		bitset<4000001> pd;
		pd |= dp;
		pd |= dp<<A[i];
		dp = pd;
	}
	for(int i=Asum/2+Asum%2;;i++){
		if(dp[i]){
			prin(i);
			return 0;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'bitset' was not declared in this scope
   37 |         bitset<4000001> dp;
      |         ^~~~~~
a.cc:11:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   10 | #include<map>
  +++ |+#include <bitset>
   11 | #include<tuple>
a.cc:37:25: error: 'dp' was not declared in this scope; did you mean 'mp'?
   37 |         bitset<4000001> dp;
      |                         ^~
      |                         mp
a.cc:40:33: error: 'pd' was not declared in this scope
   40 |                 bitset<4000001> pd;
      |                                 ^~
Language: C++

#include<iostream>
#include<bitset>
using namespace std;
int n,x,sum;
bitset<2000007>f;
int main(){
	cin>>n;
	f[0]=1;
	for(itn i=0;i<n;i++){
		cin>>x;
		f|=f<<x;
		sum+=x;
	}
	for(int i=(sum+1)/2;i<=sum;i++){
		if(f[i]) {cout<<i<<endl;break;}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'itn' was not declared in this scope; did you mean 'int'?
    9 |         for(itn i=0;i<n;i++){
      |             ^~~
      |             int
a.cc:9:21: error: 'i' was not declared in this scope
    9 |         for(itn i=0;i<n;i++){
      |                     ^
Language: C++

#include<iostream>
#include<bieset>
using namespace std;
int n,x,sum;
bitset<2000007>f;
int main(){
	cin>>n;
	f[0]=1;
	for(itn i=0;i<n;i++){
		cin>>x;
		f|=f<<x;
		sum+=x;
	}
	for(int i=(sum+1)/2;i<=sum;i++){
		if(f[i]) {cout<<i<<endl;break;}
	}
	return 0;
}

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

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int N = rei();
	int sum = 0;
	bitset<4000001> B(1);
	for(int i=0;i<N;i++){
		int a = rei();
		B = B | (B << a);
		sum += a;
	}
	for(int i=(sum+1)/2;;i++){
		if(B[i]){
			cout << i << endl;
			return;
		}
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Compiler output:
a.cc: In function 'void Calc()':
a.cc:32:9: error: 'bitset' was not declared in this scope
   32 |         bitset<4000001> B(1);
      |         ^~~~~~
a.cc:16:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   15 | #include <set>
  +++ |+#include <bitset>
   16 | using namespace std;
a.cc:32:25: error: 'B' was not declared in this scope
   32 |         bitset<4000001> B(1);
      |                         ^
Language: C

#include<stdio.h>
#include<string.h>
#include<stdbool.h>

long main(){
	long long N;
	scanf("%d",&N);
	
	long long A[N];
	
	long long sum=0;
	for(long long i=0;i<N;i++){
		scanf("%d",&A[i]);
		sum+=A[i];
	}
	
	bool dp[N+1][sum+1];
	
	memset(dp,0,sizeof(dp));
	
	dp[0][0]=1;
	
	for(long long i=0;i<N;i++){
		for(long long j=0;j<=sum;j++){
			dp[i+1][j] |= dp[i][j];
			if(j>=A[i])dp[i+1][j] |= dp[i][j-A[i]];
		}
	}
	
	for(long long i=(sum+1)/2;;i++){
		if(dp[N][i]==1){
			prlong longf("%d\n",i);
			break;
		}
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:32:25: error: unknown type name 'prlong'; did you mean 'long'?
   32 |                         prlong longf("%d\n",i);
      |                         ^~~~~~
      |                         long
main.c:32:38: error: expected declaration specifiers or '...' before string constant
   32 |                         prlong longf("%d\n",i);
      |                                      ^~~~~~
main.c:32:45: error: expected declaration specifiers or '...' before 'i'
   32 |                         prlong longf("%d\n",i);
      |                                             ^
Language: C++

#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout <<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

  VAR(int, n);
  VEC(int, a, n);

  int sm = 0;
  REP(i, n) sm += a[i];

  // dp[i]:=i番目までの要素を使って要素をjに出来る時は下j桁目が1になって居るビット列
  bitset< 2020 * 2020 > dp;
  dp.set(0);
  REP(i, n) {
    bitset< 2020 * 2020 > pd;
    // 前の要素をもらってくる
    pd |= dp;
    // 前の要素のA[i]ずらしたものを上書き
    pd |= dp << A[i];
    // dpの遷移
    swap(dp, pd);
  }

  // 半分以上の要素から選んで最小のものが答え
  FOR(i, (sm + 1) / 2, 2020 * 2020) {
    // bitsetのアクセスは配列のように行える
    if (dp[i]) {
      OUT(i)BR;
      return 0;
    }
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: 'A' was not declared in this scope
   51 |     pd |= dp << A[i];
      |                 ^
Language: C++

#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout <<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

  VAR(int, n);
  VEC(int, a, n);

  int sm = 0;
  REP(i, N) sm += a[i];

  // dp[i]:=i番目までの要素を使って要素をjに出来る時は下j桁目が1になって居るビット列
  bitset< 2020 * 2020 > dp;
  dp.set(0);
  REP(i, N) {
    bitset< 2020 * 2020 > pd;
    // 前の要素をもらってくる
    pd |= dp;
    // 前の要素のA[i]ずらしたものを上書き
    pd |= dp << A[i];
    // dpの遷移
    swap(dp, pd);
  }

  // 半分以上の要素から選んで最小のものが答え
  FOR(i, (sm + 1) / 2, 2020 * 2020) {
    // bitsetのアクセスは配列のように行える
    if (dp[i]) {
      OUT(i)BR;
      return 0;
    }
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:10: error: 'N' was not declared in this scope
   41 |   REP(i, N) sm += a[i];
      |          ^
a.cc:31:34: note: in definition of macro 'REP'
   31 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                                  ^
a.cc:46:10: error: 'N' was not declared in this scope
   46 |   REP(i, N) {
      |          ^
a.cc:31:34: note: in definition of macro 'REP'
   31 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                                  ^
a.cc:51:17: error: 'A' was not declared in this scope
   51 |     pd |= dp << A[i];
      |                 ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 998244353;

int main() {
  int N;cin >> N;
  vint A(N);
  int sum=0;
  bitset<2000*2000+1> dp(1);
  repeat(i,N){
     cin >> A[i];
     sum += A[i];
     dp |= dp<<A[i];
  }
  int ans = 0;
  for(int i=(sum+1)/2;i<=sum;i++){
    if(dp[i]){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:3: error: 'bitset' was not declared in this scope
   32 |   bitset<2000*2000+1> dp(1);
      |   ^~~~~~
a.cc:14:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   13 | #include <functional>
  +++ |+#include <bitset>
   14 | 
a.cc:32:23: error: 'dp' was not declared in this scope
   32 |   bitset<2000*2000+1> dp(1);
      |                       ^~
Language: C++

    for(int i=B._Find_first();i<N;i=B._Find_next(i)) if(i>=(sm>>1)) return !printf("%d", i);


Compiler output:
a.cc:1:5: error: expected unqualified-id before 'for'
    1 |     for(int i=B._Find_first();i<N;i=B._Find_next(i)) if(i>=(sm>>1)) return !printf("%d", i);
      |     ^~~
a.cc:1:31: error: 'i' does not name a type
    1 |     for(int i=B._Find_first();i<N;i=B._Find_next(i)) if(i>=(sm>>1)) return !printf("%d", i);
      |                               ^
a.cc:1:35: error: 'i' does not name a type
    1 |     for(int i=B._Find_first();i<N;i=B._Find_next(i)) if(i>=(sm>>1)) return !printf("%d", i);
      |                                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
bitset<4000005> f;
int n,sum;
int main()
{
	cin>>n;
	f[0] = 1;
	for(int a,i=1;i<=n;i++)
		scanf("%d",&a),f|=(f<<a),sum+=a;
	k=(sum+1)>>1;
	while(!f[k]) k++;
	cout<<k;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'k' was not declared in this scope
   11 |         k=(sum+1)>>1;
      |         ^
Language: C++

int N;
int A[2020],S;
bitset<4400000> B;

void solve() {
	int i,j,k,l,r,x,y; string s;

	cin>>N;
	B[0]=1;
	FOR(i,N) {
		cin>>A[i];
		S+=A[i];
		B |= B<<A[i];
	}

	for(i=(S+1)/2;i<=S;i++) if(B[i]) return _P("%d\n",i);

}


Compiler output:
a.cc:3:1: error: 'bitset' does not name a type
    3 | bitset<4400000> B;
      | ^~~~~~
a.cc: In function 'void solve()':
a.cc:6:28: error: 'string' was not declared in this scope
    6 |         int i,j,k,l,r,x,y; string s;
      |                            ^~~~~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin>>N;
      |         ^~~
a.cc:9:9: error: 'B' was not declared in this scope
    9 |         B[0]=1;
      |         ^
a.cc:10:9: error: 'FOR' was not declared in this scope
   10 |         FOR(i,N) {
      |         ^~~
a.cc:16:49: error: '_P' was not declared in this scope
   16 |         for(i=(S+1)/2;i<=S;i++) if(B[i]) return _P("%d\n",i);
      |                                                 ^~
Language: C++

#include <iostream>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int ans = -1;
  int num = 0;
  for(int i = 0; i < n; i++)
  {
    cin >> num;
if(num > ans)
{
  ans = num
}
  }
    
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: expected ';' before '}' token
   15 |   ans = num
      |            ^
      |            ;
   16 | }
      | ~
Language: C++

#include <iostream>
using namespace std;

int numbers[2005];

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> numbers[i];
  
sort(numbers, numbers + n)

 cout << numbers[n - 1] << endl;
}

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

#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;
typedef long long ll;


typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

vector<int> G[100005];
std::vector<P> tree[100010];

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)

ll i,j,ii,jj;
ll n,m;
ll num,sum;
bitset<2000005> dp;

int main(){
    cin>>n;
    dp[0]=1;
    for(i=0;i<n;i++){
        cin>>m;
        sum+=m;
        dp |= dp<<m;
    }
    for(i=(sum+1)/2;i<=200004;i++){
        if(dp[i]){
            p(i);
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc:40:1: error: 'bitset' does not name a type
   40 | bitset<2000005> dp;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:44:5: error: 'dp' was not declared in this scope; did you mean 'dy'?
   44 |     dp[0]=1;
      |     ^~
      |     dy
Language: C++

#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

int main(){
    int N;
    boost::multiprecision::cpp_int A;
    cin >> N;
    long long sum=0;
    boost::multiprecision::cpp_int dp=1;
    for(int i=0;i<N;i++){
        cin >> A;
        sum=sum+A;
        dp=(dp|(dp<<A));
    }

    boost::multiprecision::cpp_int ms,one=1;
    for(ms=sum/2+(sum%2);(dp&(one<<ms))==0;ms++);

    cout << ms << endl;

    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

int main(){
    int N;
    boost::multiprecision::cpp_int A;
    cin >> N;
    long long sum=0;
    boost::multiprecision::cpp_int dp=1;
    for(int i=0;i<N;i++){
        cin >> A;
        sum+=A;
        dp|=(dp<<A);
    }

    boost::multiprecision::cpp_int ms,one=1;
    for(ms=sum/2+(sum%2);(dp&(one<<ms))==0;ms++);

    cout << ms << endl;

    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

int main(){
    int N;
    cpp_int A;
    cin >> N;
    long long sum=0;
    cpp_int dp=1;
    for(int i=0;i<N;i++){
        cin >> A;
        sum+=A;
        dp|=(dp<<A);
    }

    cpp_int ms,one=1;
    for(ms=sum/2+(sum%2);(dp&(one<<ms))==0;ms++);

    cout << ms << endl;

    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++



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

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/

/////////////////////////////////
bitset<4000005> dp;


int main(){
    int n;cin>>n;int sum=0;
    int a[n];for(int i=0;i<=n-1;i++){cin>>a[i];sum+=a[i];}
    dp.set(0);
    dp[0]=1;
    for(int i=0;i<=n-1;i++){
        dp|=dp<<a[i];
    }
    for(int j=(sum+1)/2;;j++){
        if(dp[j]){
            cout<<j<<endl;
            return 0;
        }
    }
    
    return 0;
}


Compiler output:
a.cc:31:1: error: 'bitset' does not name a type
   31 | bitset<4000005> dp;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:37:5: error: 'dp' was not declared in this scope
   37 |     dp.set(0);
      |     ^~
Language: C++


{
    int n;cin>>n;
    dp[0]=1;int avg=0;
    for(int i=0;i<n;i++) {
            cin>>a[i];avg+=a[i];dp = dp | dp<<a[i];
    }
    avg=avg/n;
    if(avg%n) avg++;
    for(int i=avg;;i++){
        if(dp[i]) {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc:2:1: error: expected unqualified-id before '{' token
    2 | {
      | ^
Language: C++

#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int n;

vector<int> a;

const int MAXS = 4000005;
bitset<MAXS> dp;

int main() {
    GI(n);
    a.resize(n);

    dp[0] = 1;

    int s = 0;

    FORN(i, n)
    {
        GI(a[i]);
        s += a[i];

        bitset<MAXS> newsums = dp;
        newsums <<= a[i];
        dp |= newsums;
    }

    for (int i = s / 2; i <= s; i++)
    {
        if (dp[i])
        {
            cout << i << "\n";
            return 0;
        }
    }

    return 0;
}


Compiler output:
a.cc:49:1: error: 'bitset' does not name a type
   49 | bitset<MAXS> dp;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:55:5: error: 'dp' was not declared in this scope
   55 |     dp[0] = 1;
      |     ^~
a.cc:64:9: error: 'bitset' was not declared in this scope
   64 |         bitset<MAXS> newsums = dp;
      |         ^~~~~~
a.cc:15:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   14 | #include <cassert>
  +++ |+#include <bitset>
   15 | 
a.cc:64:22: error: 'newsums' was not declared in this scope
   64 |         bitset<MAXS> newsums = dp;
      |                      ^~~~~~~
Language: C++

#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 100005

using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
long long int MOD = 1000000007;
int N;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	bitset<2000*2000> dp;
	dp.set(0);
	cin >> N;
	int sum=0;
	for(int i=0;i<N;i++){
		int x;
		cin >> x;
		dp = dp | (dp << x);
		sum+=x;
	}
	int mid=(sum+1)/2;
	while(!dp.test(mid))mid++;
	cout<<mid<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'bitset' was not declared in this scope
   48 |         bitset<2000*2000> dp;
      |         ^~~~~~
a.cc:20:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   19 | #include <complex>
  +++ |+#include <bitset>
   20 | #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
a.cc:48:27: error: 'dp' was not declared in this scope; did you mean 'mp'?
   48 |         bitset<2000*2000> dp;
      |                           ^~
      |                           mp
Language: C++

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n;
	cin >> n;

	ll a[i];
	rep(i,n) cin >> a[i];
	
	ll S = 0;
	rep(i,n) S += a[i];
	
	bitset<4000010>b;
	b.reset();
	b.set(0);
	rep(i,n) b |= (b << A[i]);

	for (ll i=(S + 1) / 2; i <= S; i++){
		if (b[i]){
			cout << i << endl;
			break;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: 'i' was not declared in this scope
   21 |         ll a[i];
      |              ^
a.cc:22:25: error: 'a' was not declared in this scope
   22 |         rep(i,n) cin >> a[i];
      |                         ^
a.cc:25:23: error: 'a' was not declared in this scope
   25 |         rep(i,n) S += a[i];
      |                       ^
a.cc:30:29: error: 'A' was not declared in this scope
   30 |         rep(i,n) b |= (b << A[i]);
      |                             ^
Language: C++

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


int main() {
	int N;
	cin >> N;
	int* number = new int [N];
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> number[i];
		sum += number[i];
	}
	int avg = sum / 2;
	//f[i][v] = f[i - 1][v] || f[i - 1][v - ai]
	bitset<4000001> f;
	f.reset();
	f[0] = 1;
	for (int i = 0; i < N; ++i) {
		f = f | (f << number[i]);
	}
	for (int v = avg; v >= 0; --v) {
		if (f[v] == 1) {
			cout << (sum - v) << endl;
			return;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |                         return;
      |                         ^~~~~~
Language: C++

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


int main() {
	int N;
	cin >> N;
	int* number = new int [N];
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> number[i];
		sum += number[i];
	}
	int avg = sum / 2;
	//f[i][v] = f[i - 1][v] || f[i - 1][v - ai]
	bitset<avg + 1> f;
	f[0] = 1;
	for (int i = 0; i < N; ++i) {
		f = f || (f << number[i]);
	}
	for (int v = avg; v >= 0; --v) {
		if (f[v] == 1) {
			cout << (sum - v) << endl;
			return;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:22: error: the value of 'avg' is not usable in a constant expression
   17 |         bitset<avg + 1> f;
      |                      ^
a.cc:15:13: note: 'int avg' is not const
   15 |         int avg = sum / 2;
      |             ^~~
a.cc:17:23: error: the value of 'avg' is not usable in a constant expression
   17 |         bitset<avg + 1> f;
      |                       ^
a.cc:15:13: note: 'int avg' is not const
   15 |         int avg = sum / 2;
      |             ^~~
a.cc:17:20: note: in template argument for type 'long unsigned int'
   17 |         bitset<avg + 1> f;
      |                ~~~~^~~
a.cc:18:10: error: invalid types 'int[int]' for array subscript
   18 |         f[0] = 1;
      |          ^
a.cc:23:22: error: invalid types 'int[int]' for array subscript
   23 |                 if (f[v] == 1) {
      |                      ^
a.cc:25:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   25 |                         return;
      |                         ^~~~~~
Language: C++

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


int main() {
	int N;
	cin >> N;
	int* number = new int [N];
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> number[i];
		sum += number[i];
	}
	int avg = sum / 2;
	//f[i][v] = f[i - 1][v] || f[i - 1][v - ai]
	bitset ** f = new bitset*[N + 1];
	for (int i = 0; i < N + 1; ++i) {
		f[i] = new bitset[avg + 1];
		for (int v = 0; v <= avg; ++v) {
			f[i][v] = false;
		}
	}
	f[0] = true;
	int maxLessThanAvg = -1;
	for (int i = 1; i <= N; ++i) {
		for (int v = 0; v <= avg; ++v) {
			if (v >= number[i - 1]) {
				f[i][v] = f[i][v] || f[i - 1][v - number[i - 1]];
			}
			if (i == N && f[i][v] && v > maxLessThanAvg) {
				maxLessThanAvg = v;
			}
		}
	}
	cout << (sum - maxLessThanAvg) << endl;
	



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: missing template argument list after 'std::bitset'; for deduction, template placeholder must be followed by a simple declarator-id
   17 |         bitset ** f = new bitset*[N + 1];
      |         ^~~~~~
      |               <>
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bitset:804:11: note: 'template<long unsigned int _Nb> class std::bitset' declared here
  804 |     class bitset
      |           ^~~~~~
a.cc:19:17: error: 'f' was not declared in this scope
   19 |                 f[i] = new bitset[avg + 1];
      |                 ^
a.cc:19:42: error: invalid use of placeholder 'bitset<...auto...>'
   19 |                 f[i] = new bitset[avg + 1];
      |                                          ^
a.cc:24:9: error: 'f' was not declared in this scope
   24 |         f[0] = true;
      |         ^
Language: C++

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


int main() {
	int N;
	cin >> N;
	int* number = new int [N];
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> number[i];
		sum += number[i];
	}
	int avg = sum / 2;
	//f[i][v] = f[i - 1][v] || f[i - 1][v - ai]
	bitset * f = new bitset*[N + 1];
	for (int i = 0; i < N + 1; ++i) {
		f[i] = new bitset[avg + 1];
		for (int v = 0; v <= avg; ++v) {
			f[i][v] = false;
		}
	}
	f[0] = true;
	int maxLessThanAvg = -1;
	for (int i = 1; i <= N; ++i) {
		for (int v = 0; v <= avg; ++v) {
			if (v >= number[i - 1]) {
				f[i][v] = f[i][v] || f[i - 1][v - number[i - 1]];
			}
			if (i == N && f[i][v] && v > maxLessThanAvg) {
				maxLessThanAvg = v;
			}
		}
	}
	cout << (sum - maxLessThanAvg) << endl;
	



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: missing template argument list after 'std::bitset'; for deduction, template placeholder must be followed by a simple declarator-id
   17 |         bitset * f = new bitset*[N + 1];
      |         ^~~~~~
      |               <>
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bitset:804:11: note: 'template<long unsigned int _Nb> class std::bitset' declared here
  804 |     class bitset
      |           ^~~~~~
a.cc:19:17: error: 'f' was not declared in this scope
   19 |                 f[i] = new bitset[avg + 1];
      |                 ^
a.cc:19:42: error: invalid use of placeholder 'bitset<...auto...>'
   19 |                 f[i] = new bitset[avg + 1];
      |                                          ^
a.cc:24:9: error: 'f' was not declared in this scope
   24 |         f[0] = true;
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int N = 4e6 + 5;

typedef long long ll;

const ll mod = 1e9 + 7;

int x, n, s;
bitset <N> a;

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    a.set(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        s += x;
        a |= (a << x);
    }
    for (int i = (s + 1) / 2; ; i++) {
        if (a[i]) {
            cout << i;
            return 0;
        }
    }
}
#include <bits/stdc++.h>

using namespace std;

const int N = 4e6 + 5;

typedef long long ll;

const ll mod = 1e9 + 7;

int x, n, s;
bitset <N> a;

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    a.set(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        s += x;
        a |= (a << x);
    }
    for (int i = (s + 1) / 2; ; i++) {
        if (a[i]) {
            cout << i;
            return 0;
        }
    }
}


Compiler output:
a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   14 | main() {
      | ^~~~
a.cc:35:11: error: redefinition of 'const int N'
   35 | const int N = 4e6 + 5;
      |           ^
a.cc:5:11: note: 'const int N' previously defined here
    5 | const int N = 4e6 + 5;
      |           ^
a.cc:39:10: error: redefinition of 'const ll mod'
   39 | const ll mod = 1e9 + 7;
      |          ^~~
a.cc:9:10: note: 'const ll mod' previously defined here
    9 | const ll mod = 1e9 + 7;
      |          ^~~
a.cc:41:5: error: redefinition of 'int x'
   41 | int x, n, s;
      |     ^
a.cc:11:5: note: 'int x' previously declared here
   11 | int x, n, s;
      |     ^
a.cc:41:8: error: redefinition of 'int n'
   41 | int x, n, s;
      |        ^
a.cc:11:8: note: 'int n' previously declared here
   11 | int x, n, s;
      |        ^
a.cc:41:11: error: redefinition of 'int s'
   41 | int x, n, s;
      |           ^
a.cc:11:11: note: 'int s' previously declared here
   11 | int x, n, s;
      |           ^
a.cc:42:12: error: redefinition of 'std::bitset<4000005> a'
   42 | bitset <N> a;
      |            ^
a.cc:12:12: note: 'std::bitset<4000005> a' previously defined here
   12 | bitset <N> a;
      |            ^
a.cc:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   44 | main() {
      | ^~~~
a.cc:44:1: error: redefinition of 'int main()'
a.cc:14:1: note: 'int main()' previously defined here
   14 | main() {
      | ^~~~
Language: C++

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

typedef unsigned long long ull;
typedef unsigned int ui;
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2000+5,A=4e6+5;
int cnt[A];
ull a[A/64+5];int mx;
bool Count(int x)
{
	return a[x/64]&(1LL<<(x&63));
}
void move(int x)
{
	int u=mx/64;mx+=x;
	int du=x/64,di=x&63;
	if(!di)
	{
		for(int i=u;i>=0;--i)a[i+du]|=a[i];
		return ;
	}
	for(int i=u;i>=0;--i)
	{
		a[i+du+1]|=a[i]>>64-di;
		a[i+du]|=a[i]<<di;
	}
}
 
int main()
{
//	freopen("will.in","r",stdin);freopen("will.out","w",stdout);
	int n;
	cin>>n;
	int sum=0;
	rep(i,1,n)
	{
		int x;
		scanf("%d",&x);
		sum+=x;
		++cnt[x];
	}
	mx=0;a[0]=1;
	rep(i,1,sum)
	{
		while(cnt[i]>2){++cnt[i*2];cnt[i]-=2;}
		while(cnt[i]--)move(i);
	}
	rep(i,(sum+1)/2,sum)
	if(Count(i))
	{
		if(!--tot)
		{
			cout<<i;
			exit(0);
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:23: error: 'tot' was not declared in this scope
   52 |                 if(!--tot)
      |                       ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
const int N = 100005;
using namespace std;
typedef long long ll;
int a[N];
int n;
bitset<4000010> f;
int main()
{
	int i,j,k=0;
	scanf("%d",&n);
	f[0]=1;
	for(i=1;i<=n;i++)
	  {
       scanf("%d",&j);
       f|=f<<j;
       k+=j;
      }
    for(i=(k+1)/2;!f[i];i++);
    printf("%d\n",i);
	return 0;
}

Compiler output:
a.cc:14:1: error: 'bitset' does not name a type
   14 | bitset<4000010> f;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:19:9: error: 'f' was not declared in this scope
   19 |         f[0]=1;
      |         ^