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

#include<cstdio>
#include<algorithm>
#include<conio.h>
#include<cstring>
#define ll int
using namespace std;
inline void in(ll &x){x=0;char c;bool f=0;while((c=getchar())>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=getchar())<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;} 
inline void out(ll x){if(x<0){putchar('-');x=-x;}if(x>9)out(x/10);putchar(x%10+48);} 
inline void outn(ll x){out(x);printf("\n");}
inline ll max(ll x,ll y){return x>y?x:y;}
inline ll min(ll x,ll y){return x<y?x:y;}
ll a[100001],n,i,l=0,r,f=1,ma;
bool b[400001];
ll cl(ll x){if(b[x])return 0;for(ll j=1;j<=n;j++){x-=(x%a[j]);if(x<2)return 0;}return x;}
int main(){
	in(n);ll j;
	for(i=1;i<=n;i++){in(a[i]);if(a[i]==a[i-1]){n--;i--;continue;}l=max(l,a[i]);}r=l;l<<=1;
	while(r<=l){if(cl(r)==2){ma=r;if(f){out(r);printf(" ");f=0;}for(j=2;r*j<=l;j++)b[r*j]=1;}r++;}
	if(f){outn(-1);return 0;}
	outn(ma);
}

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

#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int k;
	cin >> k;
	int a[k];
	rep ( i, k ) {
		cin >> a[i];
	}
	reverse( a, a + k );
	int lb = a[0], ub = a[0] * 2 - 1;
	int j = 1;
	range ( i, 1, k ) {
		int tmp = j;
		j = 1;
		while ( a[i] * j < lb ) {
			j++;
		}
		if ( i == k - 1 ) {
			cout << a[i] * j << " " << a[i] * (j + 1) - 1 << endl;
				return 0;
		}
		if ( a[i] * j < lb || ub < a[i] * j ) {
			cout << -1 << endl;
			return 0;
		}
		a[i] *= j;
		lb = a[i];
		ub = a[i] * 2 - 1;
	}

}

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

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long k,ans=2,maxx,minn,z;
	long long lt[100001]= {0};
	scanf("%lld",&k);
	for(int i=0; i<k; i++)
		scanf("%lld",&lt[i]);
	for(int i=k-1; i>=0; i--) {
		z=ceil((double)ans/lt[i])*lt[i];
		if(z<=2*ans-1&&z>=ans)ans=z;
		else {
			puts("-1");
			return 0;
		}
	}
	minn=ans;
	maxx=ans+lt[0]-1;
	cout<<minn<<' '<<maxx<<endl;
	else puts("-1");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'else' without a previous 'if'
   32 |         else puts("-1");
      |         ^~~~
Language: C++

		if(mn%a[i]!=0) mn = a[i] * ((mn/a[i])+1);
		mx = a[i]*(mx/a[i])+a[i]-1;
	

Compiler output:
a.cc:1:17: error: expected unqualified-id before 'if'
    1 |                 if(mn%a[i]!=0) mn = a[i] * ((mn/a[i])+1);
      |                 ^~
a.cc:2:17: error: 'mx' does not name a type
    2 |                 mx = a[i]*(mx/a[i])+a[i]-1;
      |                 ^~
Language: C++

#include <iostream>

using namespace std;

#define abs(a) ((a) > 0? (a) : (-a))
#define N_MAX 100000
int N;
int a[N_MAX];

int main(void){
	int a,b;
	cin >> N;
	for (int i=0; i<N; i++){
		cnt >> a[i];
	}
	if (a[N-1] != 2) {
		cout << "-1" << "\n";
		return 0;
	}
	int max = 3;
	int min = 2;
	for (int i=N-2; i>=0; i--){
		if (max < a[i-1]){
			cout << "-1" << "\n";
			return 0;
		}
		if (a[i] >= min){
			min = (a[i]/min) * a[i];
			max = min + a[i] - 1;
		}
		else{
			min  = (((min-1) / a[i])+1)*a[i];
			max = min + a[i] - 1;
		}
	}
	cout << min << " " << max << " ";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   14 |                 cnt >> a[i];
      |                 ^~~
      |                 int
a.cc:14:25: error: invalid types 'int[int]' for array subscript
   14 |                 cnt >> a[i];
      |                         ^
a.cc:16:14: error: invalid types 'int[int]' for array subscript
   16 |         if (a[N-1] != 2) {
      |              ^
a.cc:23:28: error: invalid types 'int[int]' for array subscript
   23 |                 if (max < a[i-1]){
      |                            ^
a.cc:27:22: error: invalid types 'int[int]' for array subscript
   27 |                 if (a[i] >= min){
      |                      ^
a.cc:28:33: error: invalid types 'int[int]' for array subscript
   28 |                         min = (a[i]/min) * a[i];
      |                                 ^
a.cc:28:45: error: invalid types 'int[int]' for array subscript
   28 |                         min = (a[i]/min) * a[i];
      |                                             ^
a.cc:29:38: error: invalid types 'int[int]' for array subscript
   29 |                         max = min + a[i] - 1;
      |                                      ^
a.cc:32:45: error: invalid types 'int[int]' for array subscript
   32 |                         min  = (((min-1) / a[i])+1)*a[i];
      |                                             ^
a.cc:32:54: error: invalid types 'int[int]' for array subscript
   32 |                         min  = (((min-1) / a[i])+1)*a[i];
      |                                                      ^
a.cc:33:38: error: invalid types 'int[int]' for array subscript
   33 |                         max = min + a[i] - 1;
      |                                      ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<fstream>
#include<utility>
#define rep(N) for (int i = 0; i < N; i++)
#define For(i, N) for (i = 0; i < N; i++)
#define mod 1000000007
#define int long long int
#define re return 0

using namespace std;
//using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;

template<typename T>
void say(T s) {
	cout << s << endl;
}

int main() {
	int K;
	int Min = 2;
	int Max = 2;
	vi A;
	cin >> K;
	rep(K) {
		int x;
		cin >> x;
		A.push_back(x);
	}
	for (int i = A.size() - 1; i >= 0; --i) {
		int x = A[i];
		if (Max * 2 < x) {
			say(-1);
			re;
		}
		Max = (Max / x)* x + x - 1;
		Min = Min % x == 0 ? Min : (Min / x + 1)*x;
	}
	cout << Min << " " << Max << endl;
}

Compiler output:
a.cc:11:23: error: '::main' must return 'int'
   11 | #define int long long int
      |                       ^~~
a.cc:28:1: note: in expansion of macro 'int'
   28 | int main() {
      | ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int k;cin>>k;
  vector<ll>A(k);
  for(int i=0;i<k;i++){
    cin>>A[i];
  }
  reverse(A.begin(),A.end());
  if(A[0]!=2){
    cout<<-1<<endl;
  }else{
    ll ma=3;
    ll mi=2;
    for(int i=1;i<k;i++){
      if(A[i]<mi){
	int nn;
	if(mi%A[i]==0)nn=mi/A[i];
	else nn=mi/A[i]+1
	mi=(nn)*A[i];
      }else if(A[i]>=mi){
	mi=A[i];
      }
      if(ma<=A[i]*2-1)
	ma=A[i]*2-1;
      else{
	int nn;
	if(ma%A[i]==0)nn=ma/A[i];
	else nn=ma/A[i]+1
	ma=(nn)*A[i]-1;
      }
      // cout<<mi<<" "<<ma<<endl;
    }
    bool flag=true;
    ll amari1=mi;
    ll amari2=ma;
    for(int i=k-1;i>=0;i--){
      amari1=amari1-(amari1%A[i]);
      amari2=amari2-(amari2%A[i]);
    }
    if(amari1==2&&amari2==2)
      flag=true;
    else
      flag=false;
    if(flag)
      cout<<mi<<" "<<ma<<endl;
    else
      cout<<-1<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:26: error: expected ';' before 'mi'
   37 |         else nn=mi/A[i]+1
      |                          ^
      |                          ;
   38 |         mi=(nn)*A[i];
      |         ~~                
a.cc:47:26: error: expected ';' before 'ma'
   47 |         else nn=ma/A[i]+1
      |                          ^
      |                          ;
   48 |         ma=(nn)*A[i]-1;
      |         ~~
Language: C++

#include<cstdio>
#include<algorithm>
#include<conio.h>
#include<cstring>
#define ll int
#define mx 
using namespace std;
inline void in(ll &x){x=0;char c;bool f=0;while((c=getchar())>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=getchar())<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;} 
inline void out(ll x){if(x<0){putchar('-');x=-x;}if(x>9)out(x/10);putchar(x%10+48);} 
inline void outn(ll x){out(x);printf("\n");}
inline ll max(ll x,ll y){return x>y?x:y;}
inline ll min(ll x,ll y){return x<y?x:y;}
ll a[100001],n,i,l=0,r,f=1,ma;
ll cl(ll x){for(ll j=1;j<=n;j++)x-=(x%a[j]);return x;}
int main(){
	in(n);
	for(i=1;i<=n;i++){in(a[i]);if(a[i]==a[i-1]){n--;i--;continue;}l=max(l,a[i]);}
	while(r<=(l<<2)){if(cl(r)==2){ma=r;if(f){out(r);printf(" ");f=0;}}r++;}
	if(f){outn(-1);return 0;}
	outn(ma);
}

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

#include <bits/stdc++.h>

using std::cerr;
using std::cin;
using std::cout;

using std::abs;
using std::min;
using std::max;
using std::swap;

using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;

using ll = unsigned long long;
using uint = unsigned int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define ff first
#define ss second
#define pb emplace_back
template<typename T> 
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h <<"\n"; 
}
template<typename T, typename... Ts>
void _dbg(const char* _s, T _h, Ts... _t) {
    int _b = 0;
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++; 
    cerr << " = " << _h << ","; 
    _dbg(_s+1, _t...);
}
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 
#endif

struct init {
    init() {
        cin.tie(0); 
        std::iostream::sync_with_stdio(0);
        cout << std::fixed << std::setprecision(10);
        cerr << std::fixed << std::setprecision(5);
        #ifdef LOCAL
        srand(300); 
        #else
        using namespace std::chrono;
        srand(duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count()); 
        #endif
    }
    ~init() {
        #ifdef LOCAL
        cerr << "Time elapsed: " << (double)clock() / CLOCKS_PER_SEC << "s.\n";
        #endif
    }
} init;

const int MAXN = 1e5 + 1;
ll a[MAXN];

void no() {
    cout << "-1\n";
    exit(0);
}

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

    if (a[n - 1] > 2) no();

    ll mn = 2, mx = 2;
    for (int i = n - 1; i > 0; --i) {
        dbg(mn, mx);
        mn = (mn + a[i - 1] - 1) / a[i - 1] * a[i - 1];
        mx = (mx + a[i] - 1) / a[i - 1] * a[i - 1];
        if ()
        if (mn > mx) no();
    }

    mx += a[0] - 1;

    if (mn > mx) no();
    cout << mn << ' ' << mx << '\n';
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:13: error: expected primary-expression before ')' token
   86 |         if ()
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int arr[100005];
int main(){
	int n;cin>>n;
	for(inti=0;i<n;i++)cin>>arr[i];
	long long l=2,r=2;
	for(int i=n-1;i>=0&&l<=r;i--){
		long long x=(l+arr[i]-1)/arr[i],y=r/arr[i];
		l=x*arr[i],r=(y+1)*arr[i]-1;
	}
	if(l>r)cout<<"-1";else cout<<l<<" "<<r;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: 'inti' was not declared in this scope; did you mean 'int'?
    6 |         for(inti=0;i<n;i++)cin>>arr[i];
      |             ^~~~
      |             int
a.cc:6:20: error: 'i' was not declared in this scope
    6 |         for(inti=0;i<n;i++)cin>>arr[i];
      |                    ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;

typedef long long ll;

int K;
ll A[100010];

int main()
{
    cin >> K;

    for(int i = 0;i < K;i++)
    {
        cin >> A[i];
    }
    if(A[K - 1] != 2)
    {
        cout << -1 << endl;
        return 0;
    }
    for(int i = K - 1;i > 0;i--)
    {
        ll af_l = A[i];
        ll af_r = A[i] + A[i] - 1;

        ll bf_l = A[i - 1];
        ll bf_r = A[i - 1] + A[i - 1] - 1;

        if((af_l <= bf_l && bf_l <= af_r) || (af_l <= bf_r && bf_r <= af_r))
        {

        }
        else
        {
            cout << - 1 << endl;
            return 0;
        }

        if(now_l <= A[i] && A[i] <= now_r)
        {
            cout << -1 << endl;
            return 0;
        }
    }
    ll result1 = A[1] - (A[1] % A[0]) + A[0];
    if(A[1] % A[0] == 0) result1 = A[1];

    ll result2 = (A[1] + A[1] - 1) - ((A[1] + A[1] - 1) % A[0]) + A[0] - 1;
    cout << result1 << " " << result2 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:12: error: 'now_l' was not declared in this scope
   46 |         if(now_l <= A[i] && A[i] <= now_r)
      |            ^~~~~
a.cc:46:37: error: 'now_r' was not declared in this scope
   46 |         if(now_l <= A[i] && A[i] <= now_r)
      |                                     ^~~~~
Language: C++

int main() {
	int k, A[100000];
	scanf("%d", &k);
	for (int i = 0; i < k; i++)
		scanf("%d", A + i);

	if (A[k - 1] != 2) {
		printf("-1\n");
		return 0;
	}
	int low = 2, high = 3;
	for (int i = k - 2; 0 <= i; i--) {
		if (high < A[i]) {
			printf("-1\n");
			return 0;
		}
		low = (low + A[i] - 1) / A[i] * A[i];
		high = high / A[i] * A[i] + A[i] - 1;
	}
	printf("%d %d\n", low, high);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'scanf' was not declared in this scope
    3 |         scanf("%d", &k);
      |         ^~~~~
a.cc:8:17: error: 'printf' was not declared in this scope
    8 |                 printf("-1\n");
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main() {
a.cc:14:25: error: 'printf' was not declared in this scope
   14 |                         printf("-1\n");
      |                         ^~~~~~
a.cc:14:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:20:9: error: 'printf' was not declared in this scope
   20 |         printf("%d %d\n", low, high);
      |         ^~~~~~
a.cc:20:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

signed main()
{
#ifdef POSPELOV
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector <int> arr(n);
    for (ll &i : arr)
        cin >> i;
    reverse(arr.begin(), arr.end());
    ll l = 2, r = 2;
    for (int i = 0; i < n; i++)
    {
        l = l + ((arr[i] - l % arr[i]) % arr[i]);
        r = (r - r % arr[i]) + arr[i] - 1;
        if (r < arr[i])
            return cout << "-1", 0;
    }
    cout << l << " " << r;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'int'
   18 |     for (ll &i : arr)
      |                  ^~~
Language: C++


#include <algorithm>
#include <iostream>
#include <utility>

using namespace std;

constexpr static int MAXN = 1e6;

int K;
int a[MAXN];

pair <int64_t, int64_t> solve() {
    if (a[K - 1] != 2)
        return {-1, -1};

    int64_t l = 2;
    int64_t r = 3;
    for (int i = K - 2; i >= 0; i--) {
        // a[i] * dl >= l
        int64_t dl = (l + a[i] - 1) / a[i];
        // a[i] * dr <= r
        int64_t dr = r / a[i];
        if (dl > dr || dr == 0)
            return {-1, -1};
        l = max(dl * a[i], 1LL);
        r = dr * a[i] + a[i] - 1;
    }
    return {l, r};
}

int main() {
    cin >> K;
    for (int i = 0; i < K; i++)
        cin >> a[i];

    auto p = solve();
    if (p.first == -1)
        cout << -1 << endl;
    else
        cout << p.first << " " << p.second << endl;
}


Compiler output:
a.cc: In function 'std::pair<long int, long int> solve()':
a.cc:26:16: error: no matching function for call to 'max(int64_t, long long int)'
   26 |         l = max(dl * a[i], 1LL);
      |             ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/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:26:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   26 |         l = max(dl * a[i], 1LL);
      |             ~~~^~~~~~~~~~~~~~~~
/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:
/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:26:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   26 |         l = max(dl * a[i], 1LL);
      |             ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll a[100010];
ll main(){
  ll n;
  while(cin>>n){
    for(ll i=0; i<n; ++i){
      cin>>a[i];
    }
    reverse(a, a+n);
    ll mx=2, mn=2, tmp1, tmp2, tmp3, tmp4;
    tmp1=mx;
    tmp2=mx+a[0]-1;
    tmp3=mx;
    tmp4=mx+a[0]-1;
    bool l=(a[0]==2);
    for(ll i=1; i<n; ++i){
      mx=tmp2/a[i]*a[i];
      if(mx<tmp1){
        l=0;
        break;
      }
      tmp1=mx;
      tmp2=mx+a[i]-1;

      mn=(tmp1+a[i]-1)/a[i]*a[i];
      if(mn>tmp2){
        l=0;
        break;
      }
      tmp3=mn;
      tmp4=mn+a[i]-1;
    }
    mx=tmp2;
    if(!l){
      cout<<-1<<endl;
    }
    else{
      cout<<mn<<" "<<mx<<endl;
    }
  }
  return 0;
}




Compiler output:
a.cc:9:1: error: '::main' must return 'int'
    9 | ll main(){
      | ^~
Language: C++

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int K = scan.nextInt();
        int[] A = IntStream.range(0,K).map(i -> scan.nextInt()).toArray();

        int left=2;
        int right=2;
        for(int i=K-1;i>=0;--i){
            left = A[i]*((left-1)/A[i] + 1);
            right=A[i]*(right/A[i]) + (A[i]-1);
        }
        if(left>right){
            System.out.println(-1);
        }else{
            System.out.println(left+" "+right);
        }

    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.stream.IntStream;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:11: error: expected ':' before 'static'
    6 |     public static void main(String[] args){
      |           ^~~~~~~
      |           :
a.cc:6:29: error: 'String' has not been declared
    6 |     public static void main(String[] args){
      |                             ^~~~~~
a.cc:6:38: error: expected ',' or '...' before 'args'
    6 |     public static void main(String[] args){
      |                                      ^~~~
a.cc:24:2: error: expected ';' after class definition
   24 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:7:9: error: 'Scanner' was not declared in this scope
    7 |         Scanner scan = new Scanner(System.in);
      |         ^~~~~~~
a.cc:8:17: error: 'scan' was not declared in this scope
    8 |         int K = scan.nextInt();
      |                 ^~~~
a.cc:9:12: error: structured binding declaration cannot have type 'int'
    9 |         int[] A = IntStream.range(0,K).map(i -> scan.nextInt()).toArray();
      |            ^~
a.cc:9:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:9:12: error: empty structured binding declaration
a.cc:9:15: error: expected initializer before 'A'
    9 |         int[] A = IntStream.range(0,K).map(i -> scan.nextInt()).toArray();
      |               ^
a.cc:14:20: error: 'A' was not declared in this scope
   14 |             left = A[i]*((left-1)/A[i] + 1);
      |                    ^
a.cc:18:13: error: 'System' was not declared in this scope
   18 |             System.out.println(-1);
      |             ^~~~~~
a.cc:20:13: error: 'System' was not declared in this scope
   20 |             System.out.println(left+" "+right);
      |             ^~~~~~
Language: Java

import java.util.*;
import java.io.*;

public class B {

	void solve() {
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		
		long min = 2, max = 2;
		for (int i = n - 1; i >= 0; i--) {
			min = (min + a[i] - 1) / a[i] * a[i];
			max = max / a[i] * a[i];
			if (min > max) {
				out.println(-1);
				return;
			}
			
			max += a[i] - 1;
		}
		out.println(min + " " + max);
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new B().run();
	}
}


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


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2000;
int a[maxn+5],n,now;
int num[maxn*maxn+5],T;
bitset<maxn*maxn+maxn> S;
int main(){
	scanf("%d",&n),S[0]=1;
	for(int i=1;i<=n;i++){
		scanf("%d",&now);
		S|=S<<now;
	}
	for(int i=1;i<=maxn*maxn;i++) if(S[i]) num[++T]=i;
	printf("%d\n",num[(T+1)>>1]);
	return 0;


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

#include <iostream>
using namespace std;

int main() 
{
    int n; cin >> n;
    bitset<4004000>dp;
    dp[0]=1;
    int sum=0;
    for(int i=0;i<n;i++)
    {
        int a; cin >> a;
        sum=sum+a;
        dp |= (dp<<a);
    }
    int ans=(sum+1)/2;
    while(!dp[ans])
    {
        ans++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'bitset' was not declared in this scope
    7 |     bitset<4004000>dp;
      |     ^~~~~~
a.cc:2:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    1 | #include <iostream>
  +++ |+#include <bitset>
    2 | using namespace std;
a.cc:7:20: error: 'dp' was not declared in this scope
    7 |     bitset<4004000>dp;
      |                    ^~
Language: C++

#include <iostream>
using namespace std;

int main() 
{
    int n; cin >> n;
    bitset<4004000>dp;
    dp[0]=0;
    int sum=0;
    for(int i=0;i<n;i++)
    {
        int a; cin >> a;
        sum=sum+a;
        dp |= (dp<<a);
    }
    int ans=(sum+1)/2;
    while(!dp[ans])
    {
        ans++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'bitset' was not declared in this scope
    7 |     bitset<4004000>dp;
      |     ^~~~~~
a.cc:2:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    1 | #include <iostream>
  +++ |+#include <bitset>
    2 | using namespace std;
a.cc:7:20: error: 'dp' was not declared in this scope
    7 |     bitset<4004000>dp;
      |                    ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
// type
typedef long long ll;
typedef long double ld;
// loop
//#define For(i, l, r, x)     for (int i = l; i < r; i+=x)
//#define ForE(i, l, r, x)    for (int i = l; i <= r; i+=x)
//#define Ford(i, r, l)       for (int i = r; i > l; i--)
//#define FordE(i, r, l)      for (int i = r; i >= l; i--)
//#define Fora(i, a)          for (auto i : a)
// I/O 
#define FAST_IO             std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//#define PrintV(a)           Fora(ii, a) cout << ii << ' '; cout << rl;
//#define PrintVl(a)          Fora(ii, a) cout << ii << rl;
//#define PrintA(a, l, r)     for (int ii = l; ii <= r; ii++) cout << a[ii] << ' '; cout << rl;
//#define PrintAl(a, l, r)    for (int ii = l; ii <= r; ii++) cout << a[ii] << rl;
//#define Ptest(x)            return cout << x, 0;
#define setpre(n)           fixed << setprecision(n)
// pair
#define F                   first
#define S                   second
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pdd                 pair<ld, ld>
// vector & !!?(string)
#define eb                  emplace_back
#define pb                  push_back
#define all(a)              a.begin(), a.end()
#define rall(a)             a.rbegin(), a.rend()
#define sz(a)               a.size()
#define len(a)              a.length()
// geometry calc    
#define pi                  acos(-1.0)
#define g_sin(a)            sin(a*pi/180)
#define g_cos(a)            cos(a*pi/180)
#define g_tan(a)            tan(a*pi/180)
// set val
#define ms0(a)              memset(a,        0, sizeof(a));
#define ms1(a)              memset(a,        1, sizeof(a));
#define msn1(a)             memset(a,       -1, sizeof(a));
#define msinf(a)            memset(a, 0x3f3f3f, sizeof(a));
// constant
const int mod1 = 998244353, mod = 1e9+7;
const int MAXN = 100005, MAX_M = 200010;
// code
//#define int long long
const int X = (1 << 15);
bitset<X> dp;
void Solve() {
    int n; cin >> n;
  	dp[0] = 1;
    for (int i = 1, x; i < n; i++){
      	cin >> x;
      	s += x;
      	dp |= x;
    }
  	for (int ans = s/2; ans <= s; ans ++)
      	if (dp[ans]) {cout << ans; break;}
}

signed main(){
    FAST_IO;
    int TC = 1; 
	//cin >> TC;
    while(TC--) Solve();
    return 0;
}


Compiler output:
a.cc: In function 'void Solve()':
a.cc:55:9: error: 's' was not declared in this scope
   55 |         s += x;
      |         ^
a.cc:58:24: error: 's' was not declared in this scope
   58 |         for (int ans = s/2; ans <= s; ans ++)
      |                        ^
Language: C++

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

int n;
int arr[100000];
int index = 0;
vector<int> locall;
int mid, combiindex;
int sum;
bool visited[1000000];
int amount = 0,temp;

void combi()
{
	if(amount < temp-1)
	{
	if(combiindex>0)
	{
		for(int j = 0;j<index;j++)
		{
			if(visited[j] == false)
			{
				visited[j] = true;
				sum += arr[j];
				--combiindex;
				combi();
				++combiindex;
				sum -= arr[j];
				visited[j] = false;
			}
		}
	}
	else
	{
		if(amount < temp-1)
		{
		++amount;
		locall.push_back(sum);
		}
	}
	}
}

void solve()
{
	if(amount < temp-1)
	{
	for(int j = 0;j<=index;j++)
	{
		sum = arr[index];
		combiindex = j;
		combi();
	}
	
	sort(locall.begin(),locall.end());
	if(locall[mid] > arr[index+1] || locall.size()<(mid+1))
	{
		++index;
		solve();
	}
	else
	{
		return;
	}
	}
}

int main()
{
	cin >> n;
	temp = 1;
	for(int j = 0;j<n;j++)
	{
		cin >> arr[j];
		temp *= 2;
	}
	mid = ((temp - 1)/2);
	sort(arr,arr+n);
	solve();
	cout << locall[mid];
	return 0;
}

Compiler output:
a.cc:6:5: error: 'int index' redeclared as different kind of entity
    6 | int index = 0;
      |     ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void combi()':
a.cc:19:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   19 |                 for(int j = 0;j<index;j++)
      |                               ~^~~~~~
a.cc: In function 'void solve()':
a.cc:48:24: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<='
   48 |         for(int j = 0;j<=index;j++)
      |                       ~^~~~~~~
a.cc:50:26: error: invalid types 'int [100000][<unresolved overloaded function type>]' for array subscript
   50 |                 sum = arr[index];
      |                          ^
a.cc:56:35: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   56 |         if(locall[mid] > arr[index+1] || locall.size()<(mid+1))
      |                              ~~~~~^~
a.cc:58:19: error: no pre-increment operator for type
   58 |                 ++index;
      |                   ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool check[2007][100005];
int a,n;
int main()
{
	cin>>n;
	check[0][0]=true;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		for(int j=0;j<=100000;j++)
		{
			if(j+a<=100000) check[i][j+a]=check[i-1][j];
			check[i][abs(j-a)]=check[i-1][j];
		}
	}
	for(int i=0;i<=100000;i++)
	{
		if(check[n][i])
		{
			cout<<((s+i)>>1);
			break;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:33: error: 's' was not declared in this scope
   22 |                         cout<<((s+i)>>1);
      |                                 ^
Language: C++

You are given 
N
 integers 
A
1
, 
A
2
, ..., 
A
N
.

Consider the sums of all non-empty subsequences of 
A
. There are 
2
N
−
1
 such sums, an odd number.

Let the list of these sums in non-decreasing order be 
S
1
, 
S
2
, ..., 
S
2
N
−
1
.

Find the median of this list, 
S
2
N
−
1
.

Compiler output:
a.cc:19:1: error: extended character − is not valid in an identifier
   19 | −
      | ^
a.cc:33:1: error: extended character − is not valid in an identifier
   33 | −
      | ^
a.cc:41:1: error: extended character − is not valid in an identifier
   41 | −
      | ^
a.cc:1:1: error: 'You' does not name a type
    1 | You are given
      | ^~~
Language: C++

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

const int N = 2e3 + 5, M = 4e6 + 5;

int n, sum;
int a[N];
bitset <M> dp;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: no match for 'operator[]' (operand types are 'std::bitset<4000005>::reference' and 'int')
   21 |         if (dp[n & 1][x]) return cout << x, 0;
      |                      ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2000;
int a[maxn+5],n,now;
int num[maxn*maxn+5],T;
bitset<maxn*maxn+maxn> S;
int main(){
	scanf("%d",&n),S[0]=1;
	for(int i=1;i<=n;i++){
		scanf("%d",&now);
		S|=S<<now;
	}
	for(int i=1;i<=maxn*maxn;i++) if(S[i]) num[++T]=i;
	printf("%d\n",num[(T+1)>>1]);
	return 0;


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

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mod 1000000007
#define pb emplace_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double  ld;
#define pii pair<ll,ll> 
#define vi vector< ll > 
#define vvi vector< vi > 
#define vpi vector< pii > 
#define vvpi vector< vpi > 
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define test(t) ll t;cin>>t;while(t--)
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
#define fr(i,n) for(ll i=0;i<(n);++i)
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#ifndef ONLINE_JUDGE
#define debarr(a,n)cerr<<#a<<":";for(int i=0;i<n;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S,class T>ostream &operator<<(ostream &os,const pair<S,T> &p){return os<<"("<<p.first<<","<<p.second<<")";}
template<class T>ostream &operator<<(ostream &os,const vector<T> &p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const set<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const multiset<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class S,class T>ostream &operator<<(ostream &os,const map<S,T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>void dbs(string str,T t){cerr<<str<<":"<<t<<"\n";}
template<class T,class...S>void dbs(string str,T t,S... s){int idx=str.find(',');cerr<<str.substr(0,idx)<<":"<<t<<",";dbs(str.substr(idx+1),s...);}
#else
#define pr(...){}
#define debarr(a,n){}
#define debmat(mat,row,col){}
#endif
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
bitset < 4000005 > bit;
signed main()
{
    fast;
    ll n,x;
    cin>>n;
    ll s = 1;
    bit.set(0);
    fr(i,n)cin>>x,s+=x,bit|=bit << arr[i];;
    s/=2;
    rep(i,s,s*2+5){
        if(bit[i]){
            cout<<i;
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:36: error: 'arr' was not declared in this scope
   54 |     fr(i,n)cin>>x,s+=x,bit|=bit << arr[i];;
      |                                    ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 2000 * 2000;

using bs = bitset <N>;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  vector <int> a(n);
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  bs bp;
  bp[0] = 1;
  for (int i = 0; i < n; ++i) {
    bp |= (bp << a[i]);
  }
  for (int i = 0; i < N; ++i) {
    if (bp[i] && 2 * i >= sum) {
      cout << i << '\n';
      return 0;
    }
  }
}



Compiler output:
a.cc:27:12: error: 'bitset' does not name a type
   27 | using bs = bitset <N>;
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:42:3: error: 'bs' was not declared in this scope; did you mean 'abs'?
   42 |   bs bp;
      |   ^~
      |   abs
a.cc:43:3: error: 'bp' was not declared in this scope
   43 |   bp[0] = 1;
      |   ^~
Language: C++

#include <iostream>
#include <vector>
#define ll long long

using namespace std;

const ll bitsz = 4194304;

int main() {
	
	ll n, i, x, sum = 0;
	cin >> n;
	
	bitset<bitsz> bs;
	bs[0] = 1;
	for (i = 1; i <= n; i++) {
		cin >> x;
		sum += x;
		bs |= bs << x;
	}
	
	ll rez = 0;
	for (int i = 0; i <= sum / 2; i++)
		if (bs[i])	rez = sum - i;
	cout << rez << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'bitset' was not declared in this scope
   14 |         bitset<bitsz> bs;
      |         ^~~~~~
a.cc:3:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    2 | #include <vector>
  +++ |+#include <bitset>
    3 | #define ll long long
a.cc:14:23: error: 'bs' was not declared in this scope; did you mean 'abs'?
   14 |         bitset<bitsz> bs;
      |                       ^~
      |                       abs
Language: C++

#include <iostream>
#include <vector>
#define ll long long

using namespace std;

const ll bitsz = 4194304;

int main() {
	
	ll n, i, j, x, nr = 0, sum = 0;
	cin >> n;
	
	bitset<bitsz> bs;
	bs[0] = 1;
	for (i = 1; i <= n; i++) {
		cin >> x;
		sum += x;
		bs |= bs << x;
	}
	sum /= 2;
	
	ll rez = 0;
	for (int i = 0; i <= sum/2; i++)
		if (bs[i])	rez = sum - i;
	cout << rez << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'bitset' was not declared in this scope
   14 |         bitset<bitsz> bs;
      |         ^~~~~~
a.cc:3:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    2 | #include <vector>
  +++ |+#include <bitset>
    3 | #define ll long long
a.cc:14:23: error: 'bs' was not declared in this scope; did you mean 'abs'?
   14 |         bitset<bitsz> bs;
      |                       ^~
      |                       abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int MAXN=2005;
bitset<2000010> f;
int a[MAXN],n,sum;
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        sum+=a[i];
    }
    f[0]=1;
    for(int i=n;i>=1;--i)f|=f<<a[i];
    for(int i=(sum+1)>>1;i<=sum;++i){
        if(f[i]){
            cout<<i<<endl;
            return 0;
        }
    }
}

Compiler output:
a.cc:5:7: error: size of array 'a' is not an integral constant-expression
    5 | int a[MAXN],n,sum;
      |       ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,a;
LL sum;
bitset<4000030> dp; 
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int t;
		scanf("%d",&t);
		sum+=t;
		dp|=dp<<t;
	}
	f[0]=1;
	for(int i=sum/2;i<=sum;i++)
	{
		if(dp[i])
		{
			printf("%d\n",i);
			return 0;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'f' was not declared in this scope
   17 |         f[0]=1;
      |         ^
Language: C++

// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int n;
vll a;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    ll total = accumulate(ALL(a), 0LL);

    V< bitset<4000001> > dp(n + 1);
    dp[0].set(0);
    for (int i = 0; i < n; i++) {
        dp[i + 1] = dp[i] | (dp[i] << a[i]);
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:52:8: error: 'bitset' was not declared in this scope
   52 |     V< bitset<4000001> > dp(n + 1);
      |        ^~~~~~
a.cc:24:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   23 | #include <cassert>
  +++ |+#include <bitset>
   24 | using namespace std;
a.cc:52:22: error: template argument 1 is invalid
   52 |     V< bitset<4000001> > dp(n + 1);
      |                      ^
a.cc:52:24: error: expected unqualified-id before '>' token
   52 |     V< bitset<4000001> > dp(n + 1);
      |                        ^
a.cc:53:5: error: 'dp' was not declared in this scope
   53 |     dp[0].set(0);
      |     ^~
Language: C++

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

int main()
{
    int i,n,x;
    cin >> n;
    S[0] = true;
    int sum = 0,rs=0;
    for(i=0;i<n;i++)
    {
        cin >> x;
        sum += x;
        S = S|(S<<x);
    }
    rs = (sum+1)/2;
    //cout << sum << " " << rs<< " ";
    for(i=rs;i<=sum;i++)
    {
        if(S[i] and i>=rs)
            break;
    }
    //cout << S[2] << " ";
    cout << i << endl;
return 0;


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

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

int main(){
int n;
  cin>>n;
  
 vector<int> v(n);
  
  for(i=0;i<n;i++)
    cin>>v[i];
  
  long long int sum=0;
  
  for(i=0;i<n;i++)
  {
    sum+=v[i];
  }
  
  int dp[sum+1];
  
  for(i=0;i<=sum;i++)
    dp[i]=0;
  
  dp[0]=1;
  
  for(i=0;i<n;i++){
	for(j=v[i];j<=sum;j++){
		dp[j]+=dp[j-v[i]];
    }
  }
  vector<int> median;
  
  for(i=0;i<=sum;i++){
if(dp[i]!=0){
while(dp[i]--){
median.push_back(i);
}
}
  }
  
  int med=median.size()/2;
  
  cout<<median[med];
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   for(i=0;i<n;i++)
      |       ^
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i=0;i<n;i++)
      |       ^
a.cc:22:7: error: 'i' was not declared in this scope
   22 |   for(i=0;i<=sum;i++)
      |       ^
a.cc:27:7: error: 'i' was not declared in this scope
   27 |   for(i=0;i<n;i++){
      |       ^
a.cc:28:13: error: 'j' was not declared in this scope
   28 |         for(j=v[i];j<=sum;j++){
      |             ^
a.cc:34:7: error: 'i' was not declared in this scope
   34 |   for(i=0;i<=sum;i++){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  vector<bool> dp(4000007,0);
  int sum=0;
  int x;
  for(int i=0;i<n;i++)
  {
    sum+=x;
    for(int j=0;j<dp.size();j++)
    {
      if(dp[j]==1)
      {
        dp[j+x]=1;
      }
    }
  }
  int target=(sum+1)/2;
  for(int i=target;i<=sum;i++)
  {
    if(dp[i])
    {
      cout<<i<<endl;
      return ;
    }
  }
  return 0;
}

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

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

int main()
{
  int n;
  cin>>n;
  vector<bool> dp(4000007,0);
  int sum=0;
  int x;
  for(int i=0;i<n;i++)
  {
    sum+=x;
    for(int j=0;j<dp.size();j++)
    {
      if(dp[j]==1)
      {
        dp[j+x]=1;
      }
    }
  }
  int target=(sum+1)/2;
  for(int i=target;i<=sum;i++)
  {
    if(dp[i])
    {
      cout<<i<<endl;
      return ;
    }
  }
}

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

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

bitset<20000007> dp; 
int main()
{
	int n;
  cin >> n;
  dp[0] = 1;
  int x = 0;
  sum = 0;
  for(int i = 0 ; i  < n ;i++)
  {
    cin >> x;
    sum = sum + x;
    dp = (dp | dp << x);
  }
  int target = ( sum + 1 )/2;
  
  for(int i = target; i<= sum ;i++)
  {
  	if(dp[i])
    {
    	cout << i << endl;
      break;
    }
  }
  
	return 0;
}

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

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

int maxn = 2000007;
bitset<maxn> dp;

int main()
{
	int n;
	cin>>n;
	vector<int> A(n);
	int sum = 0;
	dp[0] = 1;
	for(int i = 0 ; i < n ; i++)
	{
		cin>>A[i];
		sum += A[i];	
		dp = (dp | (dp << A[i]));
	} 
	int target = ((sum+1)/2);
	for(int i = target ; i <=sum ; i++)
	{
		if(dp[i])
		{
			cout<<i<<endl;
			return 0;
		}
	}
}

Compiler output:
a.cc:5:12: error: the value of 'maxn' is not usable in a constant expression
    5 | bitset<maxn> dp;
      |            ^
a.cc:4:5: note: 'int maxn' is not const
    4 | int maxn = 2000007;
      |     ^~~~
a.cc:5:12: note: in template argument for type 'long unsigned int'
    5 | bitset<maxn> dp;
      |            ^
a.cc: In function 'int main()':
a.cc:13:11: error: invalid types 'int[int]' for array subscript
   13 |         dp[0] = 1;
      |           ^
a.cc:23:22: error: invalid types 'int[int]' for array subscript
   23 |                 if(dp[i])
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

const int MAX=4100000;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    ll sum=0;
    rep(i,N){
        cin >> A[i];
        sum+=A[i];
    }
    bitset<MAX> bit(1);
    rep(i,N){
        bit|=(bit<<A[i]);
    }
    rep2(i,(M+1)/2,MAX){
        if (bit.test(i)){
            cout << i << endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:13: error: 'M' was not declared in this scope
   44 |     rep2(i,(M+1)/2,MAX){
      |             ^
a.cc:7:31: note: in definition of macro 'rep2'
    7 | #define rep2(i,a,b) for (ll i=a;i<b;++i)
      |                               ^