Language: C++

#include<bits/stdc++.h>
const int N=1000002;

bitset<4000000>dp;
 
void solve(int n){
	vector<int> a(n);
	cin>>a;
	dp[0]=true;
	for(int i=0;i<n;i++){
		dp=dp|dp<<a[i];
	}
	long long  tot=accumulate(all(a),0ll);
	if(tot%2){
		tot++;
	}
	tot/=2;
	for(int i=tot;i<=4000000;i++){
		if(dp[i]){
			cout<<i<<' ';
			return;
		}
	}
}
int main(){
int n;
cin>>n;
solve(n);

}

Compiler output:
a.cc:4:1: error: 'bitset' does not name a type
    4 | bitset<4000000>dp;
      | ^~~~~~
a.cc: In function 'void solve(int)':
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> a(n);
      |         ^~~~~~
a.cc:7:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> a(n);
      |                ^~~
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |         cin>>a;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:14: error: 'a' was not declared in this scope
    8 |         cin>>a;
      |              ^
a.cc:9:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
    9 |         dp[0]=true;
      |         ^~
      |         dup
a.cc:13:35: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   13 |         long long  tot=accumulate(all(a),0ll);
      |                                   ^~~
      |                                   std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:13:24: error: 'accumulate' was not declared in this scope; did you mean 'std::accumulate'?
   13 |         long long  tot=accumulate(all(a),0ll);
      |                        ^~~~~~~~~~
      |                        std::accumulate
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58:
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: 'std::accumulate' declared here
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
a.cc:20:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |                         cout<<i<<' ';
      |                         ^~~~
      |                         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc: In function 'int main()':
a.cc:27:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   27 | cin>>n;
      | ^~~
      | std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~