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

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

using namespace std;

typedef long long ll;
int main(){
	int N, M; cin >> N >> M;
	vector<ll> k(M), p(M);
	vector<vector<ll> > s(M);

	for(int i = 0; i < M; ++i){
		cin >> k[i];
		for(int j = 0; j < k[i]; ++j){
			int si; cin >> si;
			s[i].push_back(si);
		}
	}
	for(int i = 0; i < M; ++i) cin >> p[i];


	int allcnt = 0;
	for(int i = 0; i < pow(2, N); ++i){
		int flag = 1;
		for(int j = 0; j < M; ++j){
			int cnt = 0;
			for(int l = 0; l < s[j].size(); ++l){
				if((i & (1<<(s[j][l]-1))) == (1<<(s[j][l]-1))) cnt++;
			}
			if(cnt % 2 != p[j]) { flag = 0; break; }
		}
		if(flag) allcnt ++;
	}

	cout << allcnt << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:28: error: 'pow' was not declared in this scope
   24 |         for(int i = 0; i < pow(2, N); ++i){
      |                            ^~~
Language: C++

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

using namespace std;


int vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) {
        return 1;
    }
    else {
        return 0;
    }
}

int main() {
    int N, M; cin >> N >> M;

    vector<vector<int>> S;
    for(int i=0; i < M; i++) {
        int k; cin >> k;
        vector<int> s(k);
        for(int j=0; j < k; j++) {
            cin >> s[j];
        }
        S.push_back(s);
    }


    vector<int> p(M);
    for(int i=0; i < M; i++) {
        cin >> p[i];
    }

    int ans = 0;
    vector<int> denkyu_status(M, 0);
    for (int i=0; i<1 << N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i >> j & 1) == 1) {
                for(int k=0; k < M; k++) {

                    bool flag2 = false;
                    for(int ind=0; ind < S[k].size(); ind++) {
                        if(S[k][ind] == j+1) {
                            flag2 = true;
                        }
                    }

                    if(flag2) {
                        denkyu_status[k]++;
                    }
                }
            }
        }


        bool flag = true;
        for(int j=0; j < M; j++) {
            if(denkyu_status[j] % 2 != p[j]) {
                flag = false;
            }
        }

        if(flag) {
            ans++;
        }

        for(int k=0; k < M; k++) {
            denkyu_status[k] = 0;
        }


    }

    cout << ans << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int vector_finder(std::vector<int>, int)':
a.cc:9:25: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
    9 |     auto itr = std::find(vec.begin(), vec.end(), number);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:9:25: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    9 |     auto itr = std::find(vec.begin(), vec.end(), number);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <map>
#include <vector>
#pragma warning( disable:4996 )
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
using namespace std;
int mypow(int a, int b) {
	int ans = 1;
	for (; b > 0; b--) {
		ans *= a;
	}
	return ans;
}
/*int compare_int(const void *a, const void *b)
{
	return *(int*)b - *(int*)a;
}
typedef struct Item {
	int num;
	string name;
	int point;
}Item;*/
int main(void) {
	/*int a, p;
	scanf("%d %d", &a, &p);
	printf("%d", (p+3 * a) / 2);
	return 0;*/
	/*map<int, Item>mp;
	int n;
	scanf("%d", &n);
	int p[101];
	char s[101][13];
	for (int i = 0; i < n; i++) {
		scanf("%s %d", &s[i], &p[i]);
		Item item = {i+1, s[i], p[i] };
		mp[i] = item;
	}
	for (int i = n - 1; i >= 1; i--) {
		for (int j = i - 1; j >= 0; j--) {
			if (mp[j].name.compare(mp[i].name) > 0) {
				Item temp;
				temp = mp[j];
				mp[j] = mp[i];
				mp[i] = temp;
			}
		}
	}
	for (int i = n - 1; i >= 1; i--) {
		for (int j = i - 1; j >= 0; j--) {
			if (mp[j].point < mp[i].point && mp[j].name.compare(mp[i].name)==0) {
				Item temp;
				temp = mp[j];
				mp[j] = mp[i];
				mp[i] = temp;
			}
		}
	}
	
	for (int i = 0; i < n; i++) {
		printf("%d\n", mp[i].num);
	}*/
	
	int n, m;
	int k[11];
	int s[11][11];
	int p[11];
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d", &k[i]);
		for (int j = 0; j < k[i]; j++) {
			scanf("%d", &s[i][j]);
		}

	}
	for (int i = 0; i < m; i++) {
		scanf("%d", &p[i]);
	}
	int ans = 0;
	for (int i = 0; i < mypow(2, n); i++) {//all pattern
		for (int j = 0; j < m; j++) {//all light
			int swcount = 0;
			for (int h = 0; h < k[j]; h++) {//all need switch
				if (((mypow(2, s[j][h] - 1)) & i) > 0) {
					swcount++;
				}
			}
			if (swcount % 2 != p[j])goto bad;
		}
		ans++;
bad:
		continue;
		
	}
	printf("%d\n", ans);
}

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

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> G[m+1];
    int p[m+1];
    int k, s;
    for(int i = 1; i <= m; i++){
        cin >> k;
        for(int j = 0; j < k; j++){
            cin >> s;
            G[i].push_back(s);
        }
    }
    for(int i = 1; i <= m; i++){
        cin >> p[i];
    }

    int ans = 0;
    for(int bit = 0; bit < (1<<n); bit++){
        vector<int> a;
        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                a.push_back(i+1);
            }
        }
        int isOn = 0;
        for(int i = 1; i <= m; i++){
            int b = 0;
            for(int j = 0; j < a.size(); j++){
                vector<int>::iterator vIter = find(G[i].begin(), G[i].end(), a.at(j));
                if(vIter != G[i].end()){
                    b++;
                }
            }
            if(b % 2 == p[i]){
                isOn++;
            }
        }
        if(isOn == m){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:51: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   35 |                 vector<int>::iterator vIter = find(G[i].begin(), G[i].end(), a.at(j));
      |                                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:35:51: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   35 |                 vector<int>::iterator vIter = find(G[i].begin(), G[i].end(), a.at(j));
      |                                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
	int N ,M;
	cin >> N, M;
	vector<int> k(M);
	vector<vector<int>> s(M vector<int>(10, 0));
	for (int i = 0; i < M; i++) {
		cin >> k.at(i);
		for (int j = 0; j < k.at(i); j++) {
			cin >> s.at(i).at(j);
		}
	}
	vector<int> p(M);
	for (int i = 0; i < M; i++) {
		cin >> p.at(i);
	}
	int count = 0;
	for (int a = 0; a < 2; a++) {
		for (int b = 0; b < 2; b++) {
			for (int c = 0; c < 2; c++) {
				for (int d = 0; d < 2; d++) {
					for (int e = 0; e < 2; e++) {
						for (int f = 0; f < 2; f++) {
							for (int g = 0; g < 2; g++) {
								for (int h = 0; h < 2; h++) {
									for (int i = 0; i < 2; i++) {
										for (int j = 0; j < 2; j++) {
											vector<int> vec(10);
											vec.at(0) = a;
											vec.at(1) = b;
											vec.at(2) = c;
											vec.at(3) = d;
											vec.at(4) = e;
											vec.at(5) = f;
											vec.at(6) = g;
											vec.at(7) = h;
											vec.at(8) = i;
											vec.at(9) = j;
											int counted = 0;
											for (int x = 0; x < M; x++) {
												int eo = 0;
												for (int y = 0; y < k.at(x); y++) {
													if (vec.at(s.at(x).at(y) - 1) == 1) {
														eo++;
													}
												}
												if (eo % 2 == p.at(x)) {
													counted++;
												}
											}
											if (counted == M) {
												count++;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	int tyo = 1;
	for (int i = 0; i < N; i++) {
		tyo *= 2
	}
	cout << count / tyo << endl;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:8:32: error: expected ')' before 'vector'
    8 |         vector<vector<int>> s(M vector<int>(10, 0));
      |                              ~ ^~~~~~~
      |                                )
a.cc:68:25: error: expected ';' before '}' token
   68 |                 tyo *= 2
      |                         ^
      |                         ;
   69 |         }
      |         ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, m; cin >> n >> m;
	vector<vector<bool> > s(m, vector<bool>(n + 1, false));
	vector<int> p(m);
	for (int i = 0; i < m; ++i) {
		int k; cin >> k;
		for (int j = 0; j < k; ++j) {
			int t; cin >> t;
			s[i][t] = true;
		}
	}
	for (int i = 0; i < m; ++i) cin >> p[i];

	int ans = 0;
	vector<int> swio (n);
	for (int i = 0; i < (int)pow(2, n); ++i) {
		int tmp = i;
		for (int j = 0; j < n; ++j) {
			swio[j] = tmp % 2;
			tmp /= 2;
		}
		bool flag = true;
		for (int j = 0; j < m; ++j) {
			int cnt = 0;
			for (int k = 1; k <= n; ++k) {
				if (swio[k - 1] && s[j][k]) cnt++;
			}
			if (cnt % 2 != p[j]) {
				flag = false;
				break;
			}
		}
		if (flag) ans++;
	}
	cout << ans << endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:34: error: 'pow' was not declared in this scope
   21 |         for (int i = 0; i < (int)pow(2, n); ++i) {
      |                                  ^~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string.h>
#include<iostream>
using namespace std;
struct node {
	int k[11] = { 0 }, p,nu;
}bu[11];
int main()
{
	int n, m, ans = 0;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		scanf("%d", &bu[i].nu);
		for (int j = 1; j <= bu[i].nu; j++)
		{
			scanf("%d", &bu[i].k[j]);
		}
	}
	for (int i = 1; i <= m; i++)
		scanf_s("%d", &bu[i].p);
	for (int i = 0; i < (1 << n); i++)
	{
		int sum2 = 0;
		for (int j = 1; j <= m; j++)
		{
			int sum = 0;
			for (int d = 1;d<=bu[j].nu; d++)
				if (((1 << (bu[j].k[d]-1))&i) > 0)
					sum++;
			if (sum%2 == bu[j].p)
				sum2++;
		}
		if (sum2 == m)
			ans++;
	}
	printf("%d", ans);
	//system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   23 |                 scanf_s("%d", &bu[i].p);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <bits/stdc++.h >
#include <vector>

using namespace std;

int n,m;
vector<int > adj[15];
int p[15];
bool bitmask[15];

int dp(int pos, bool mask[]){

    if(pos==n+1){
        int on = 0;

        for(int i = 1;i<=m;i++){
            int check1=0;
            //cout << i << ':';
            for(int j : adj[i]){
                //cout << mask[j]<< ' ';
                if(mask[j]){
                    check1++;
                }
            }
            //cout << ':' << p[i] << ' ' << check1;
            //cout << endl;

            //cout << on  <<endl;

            if(check1%2 == p[i]){
                on++;
            }
        }



        return on==m? 1:0;
    }
    mask[pos]=0;
    int op1 = dp(pos+1,mask);
    mask[pos]=1;
    int op2 = dp(pos+1,mask);

    return op1+op2;

}


int main() {
    cin >> n>>m;
    for(int i=1;i<=m;i++){
        int k ;
        cin >> k;
        for(int j = 0;j<k;j++){
            int u;
            cin >> u;
            adj[i].push_back(u);
        }
    }

    for(int i = 1;i<=m;i++){
        cin >> p[i];
    }

    cout << dp(1,bitmask);


    return 0;
}

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

import java.util.Scanner;
public class Main{
  public static void main(){
    Scanner sc = new Scanner(System.in);
    int N,M,i,j,t;
    N = sc.nextInt();
    M = sc.nextInt();
    int count = 0;
    int[] p = new int[M];
    int[] k = new int[M];
    for(i=0;i<M;i++){
      k[i] = sc.nextInt();
      int[] s = new int[k[i]];
      for(j=0;j<k[i];j++){
        s[j] = sc.nextInt();
      }
    }
    for(t=0;t<M;t++)
      p[t] = sc.nextInt();
    for(i=0;i<M;i++){
      for(j=0;j<s.length();j++){
        if((s[j]%2)==(p[i]%2))
          count++;
      }
    }
    System.out.println(count);
  }
}
    


Compiler output:
Main.java:21: error: cannot find symbol
      for(j=0;j<s.length();j++){
                ^
  symbol:   variable s
  location: class Main
Main.java:22: error: cannot find symbol
        if((s[j]%2)==(p[i]%2))
            ^
  symbol:   variable s
  location: class Main
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
    Scanner sc = new Scanner(System.in);
    int N,M,i,j,t;
    N = sc.nextInt();
    M = sc.nextInt();
    int count = 0;
    int[] p = new int[M];
    int[] k = new int[M];
    for(i=0;i<M;i++){
      k[i] = sc.nextInt();
      int[] s = new int[k[i]];
      for(j=0;j<k[i];j++){
        s[j] = sc.nextInt();
      }
    }
    for(t=0;t<M;t++)
      p[t] = sc.nextInt();
    for(i=0;i<M;i++){
      for(j=0;j<k[i];j++){
        if((s[j]%2)==(p[i]%2))
          count++;
      }
    }
    System.out.println(count);
  }
}
    


Compiler output:
Main.java:22: error: cannot find symbol
        if((s[j]%2)==(p[i]%2))
            ^
  symbol:   variable s
  location: class Main
1 error
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
    Scanner sc = new Scanner(System.in);
    int N,M,i,j,t;
    N = sc.nextInt();
    M = sc.nextInt();
    int count = 0;
    int[] p = new int[M];
    int[] k = new int[M];
    for(i=0;i<M;i++){
      k[i] = sc.nextInt();
      int[] s = new int[k[i]];
      for(j=0;j<k[i];j++){
        s[j] = sc.nextInt();
      }
    }
    for(t=0;t<M;t++)
      p[t] = sc.nextInt();
    for(i=0;i<M;i++){
      for(j=0;j<k[i];j++){
        if((s[j]%2)==(p[i]%2))
          count++:
      }
    }
    System.out.println(count);
  }
}
    

Compiler output:
Main.java:23: error: ';' expected
          count++:
                 ^
1 error
Language: C++


#include <iostream>
#include <algorithm>
#include <list>
#include <string>
#include < math.h>

using namespace std;





int main() {
	int ans = 0;
	int n, m;
	int k[10];
	int s[10][10];

	int lump[10];

	cin >> n >> m;

	int checktype = pow(2, n);


	for (int i = 0; i < m; i++) {
		cin >> k[i];

		for (int j = 0; j < k[i]; j++) {
			cin >> s[i][j];
		}
	}

	int p[10];

	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}



	bool unko;
	for (int lumptype = 0; lumptype < checktype; lumptype++) {
		unko = true;
		int wk = lumptype;

		for (int i = 0; i < n; i++) {
			lump[n - 1 - i] = wk % 2;
			wk /= 2;
		}

		for (int i = 0; i < m; i++) {
			int goukei = 0;

			for (int j = 0; j < k[i]; j++) {
				goukei += lump[s[i][j]-1];
			}

			if (goukei % 2 == p[i]) {
			
				//正常

			}
			else {
				unko = false;
				break;
				//次のランプタイプに行く。
			}

		}
		//全部正常だったらこれ
		if (unko) {
			ans++;
		}


	}

	cout << ans << endl;




	return 0;




}

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


#include <iostream>
#include <algorithm>
#include <list>
#include <string>

using namespace std;





int main() {
	int ans = 0;
	int n, m;
	int k[10];
	int s[10][10];

	int lump[10];

	cin >> n >> m;

	int checktype = pow(2, n);


	for (int i = 0; i < m; i++) {
		cin >> k[i];

		for (int j = 0; j < k[i]; j++) {
			cin >> s[i][j];
		}
	}

	int p[10];

	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}



	bool unko;
	for (int lumptype = 0; lumptype < checktype; lumptype++) {
		unko = true;
		int wk = lumptype;

		for (int i = 0; i < n; i++) {
			lump[n - 1 - i] = wk % 2;
			wk /= 2;
		}

		for (int i = 0; i < m; i++) {
			int goukei = 0;

			for (int j = 0; j < k[i]; j++) {
				goukei += lump[s[i][j]-1];
			}

			if (goukei % 2 == p[i]) {
			
				//正常

			}
			else {
				unko = false;
				break;
				//次のランプタイプに行く。
			}

		}
		//全部正常だったらこれ
		if (unko) {
			ans++;
		}


	}

	cout << ans << endl;




	return 0;




}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:25: error: 'pow' was not declared in this scope
   23 |         int checktype = pow(2, n);
      |                         ^~~
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int n,m;
  cin>>n>>m;
  int k[m],p[m];
  rep(i,m){
    cin>>k[i];
    int s[i][k[i]];
    rep(j,k[i]){
      cin>>s[i][j];
    }
  }
  rep(i,m){
    cin>>p[i];
  }
  int memo[n];
  int ans=0;
  rep(i,pow(2,n)){
    int cri=1;
    rep(j,n){
      memo[j]=i^(int)(pow(2,j));
    }
    rep(j,m){
      int count=0;
      rep(l,k[j]){
        count+=memo[s[j][l]];
      }
      if(count%2!=p[j]){
        cri=0;
      }
    }
    if(cri){
      ans++;
    }
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:21: error: 's' was not declared in this scope
   38 |         count+=memo[s[j][l]];
      |                     ^
Language: C++

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

using namespace std;

int N,M,cnt;
int to[11][11]; int P[20]; bool socket[11];

void dfs( int X){ //スイッチはNこ,depthは０からN-1まで
  if(X == N){ return;}
  socket[X] = false; dfs( X+1 );
  socket[X] = true;  dfs( X+1 );
} //N個の電球に対し、点いた/つかない、をdfsで全列挙

void count(){
  dfs(1); int count[11];
  for(int i = 1; i <= M; i++){
    for(int j = 1; j <= N; j++){
      if(to[i][j] == 1 && socket[j] == true){ count[i]++;}}
    
    bool flag = true;
    
    for(int i = 1; i <= M; i++){
      if(count[i] % 2 != P[i]){ flag = false;}}
    
    if(flag){ cnt++;}
  }
  


int main(){
   cin >> N >> M;
 
  
  for(int i = 1; i <= M; i++){
    int c; cin >> c;
    for(int j = 1; j <= c; j++){ int d;
      cin >> d; to[i][d]++;}}
 for(int i = 1; i <= M ; i++){ cin >> P[i];}
  
  count();
  

 cout << cnt << endl;
  
  return 0;
}
    
  
 

Compiler output:
a.cc: In function 'void count()':
a.cc:32:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   32 | int main(){
      |         ^~
a.cc:32:9: note: remove parentheses to default-initialize a variable
   32 | int main(){
      |         ^~
      |         --
a.cc:32:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:32:11: error: a function-definition is not allowed here before '{' token
   32 | int main(){
      |           ^
a.cc:48:2: error: expected '}' at end of input
   48 | }
      |  ^
a.cc:16:13: note: to match this '{'
   16 | void count(){
      |             ^
Language: C++

#include <bits/stdc++.h>
#define MAXN 20
using namespace std;
int main(){
	int N,M;
	cin>>N>>M;
	int arr[MAXN][MAXN];
	for(int i = 0;i<M;i++){
		int k;
		cin>>k;
		arr[i][0] = k;
		for(int j =0;j<k;j++){
			int t;
			cin>>t;
			arr[i][j+1] = t;
		}
	}
	vector<int> parr;
	for(int i=0;i<M;i++){
		int t;
		// ciparr
		cin>>t;
		parr.push_back(t);
	}
	int stasum = 0;
	for(int sta = 0;sta<=(1<<N)-1;sta++){
		int flag = 1;
		//cerr<<"sta"<<endl;
		//cerr<<sta<<endl;
		for(int i=0;i<M;i++){
			int rd = arr[i][0];
			int sum= 0;
			for(int j=0;j<rd;j++){
				int check_b = arr[i][j+1];
				if(sta&(1<<(check_b-1))){
					//cerr<<"check bit"<<check_b<<" "
					;sum+=1;}
			}
			//cerr<<endl;
			if(sum%2 != parr[i]){//cerr<<"fail "<<i<<endl;flag = 0;break;}
		}
		if(flag)stasum++;
	}
	cout<<stasum<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,k,S,P,ans;
bool flag;

int main(){
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
    cin>>N>>M;
    vector<int> s[M];
    int p[M],cnt[M];
    rep(i,M){
        cin>>k;
        rep(j,k){
            cin>>S;
            S--;
            s[i].push_back(S);
        }
    }
    rep(i,M){
        cin>>p[i];
    }
    rep(i,(1<<N)){
        flag=true;
        rep(j,M){
            cnt[j]=0;
        }
        bitset<10> bs(i);
        rep(j,M){
            for(auto x : s[j]){
                if(bs[x])cnt[j]++;
            }
            if(cnt[j]%2!=p[j]){
                flag=false;
                break;
            }
        }
        // rep(j,M){
        //     out(cnt[j]);
        // }
        // out("");
        if(flag)ans++;

    }
    out(ans);


    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: 'bitset' was not declared in this scope
   50 |         bitset<10> bs(i);
      |         ^~~~~~
a.cc:13:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   12 | #include<set>
  +++ |+#include <bitset>
   13 | using namespace std;
a.cc:50:20: error: 'bs' was not declared in this scope; did you mean 's'?
   50 |         bitset<10> bs(i);
      |                    ^~
      |                    s
Language: C++

#include <vector>
#include <bitset>
#include <iostream>

using namespace std;
typedef long long ll;

int main() {
	int n, m;
	cin >> n >> m;

	vector<bitset<10>> combs(m, bitset<10>(0));

	for (int i = 0; i < m; i++) {
		int cnt;
		cin >> cnt;

		for (int j = 0; j < cnt; j++) {
			int toggle;
			cin >> toggle;

			combs[i][toggle-1] = 1;
		}
	}

	vector<int> cong(m, 0);
	for (int i = 0; i < m; i++) {
		cin >> cong[i];
	}

	int cnt = 0;
	int maxNum = pow(2, n) - 1;
	for (int i = 0; i <= maxNum; i++) {
		bitset<10> test(i);
		int onCnt = 0;
		for (int j = 0; j < m; j++) {
			int switchOn = 0;
			for (int k = 0; k < n; k++) {
				if (test[k] == 1 && combs[j][k] == 1) switchOn++;
			}

			if (switchOn % 2 == cong[j]) onCnt++;
		}

		if (onCnt == m) cnt++;
	}

	cout << cnt;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:22: error: 'pow' was not declared in this scope
   32 |         int maxNum = pow(2, n) - 1;
      |                      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef HOME
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define me(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<int>k[m];
    for(int i=0;i<m;i++){
        int kk;
        cin>>kk;
        while(kk--){
            int num;
            cin>>num;
            num--;
            k[i].push_back(num);
        }
    }
    vector<int>p;
    for(int i=0;i<m;i++){
        int num;
        cin>>num;
        p.push_back(num);
    }
    int count=0;
    for(int i=1;i<(1<<n);i++){
        //vector<int>temp;
        set<int>s;
        for(int j=0;j<m;j++){
            if(i&1<<j){
                // temp.push_back(i);
                s.insert(j);
            }
        }
        debug()<<me(s);
        int mk=0;
        for(int l=0;l<m;l++){
            debug()<<me(k[l]);
            int c=0;
            for(int o=0;o<k[l].size();o++){
                if(s.find(k[l][o])!=s.end()){
                    c++;
                }
            }
            int t=p[l];
            if(c%2==t){
                mk++;
            }
        }
        debug()<<me(mk);
        if(mk==m){
            count++;
        }
        //int size=temp.size();
    }
    cout<<count<<endl;
    
    return 0;
    
}



Compiler output:
a.cc:7:14: error: expected primary-expression before 'if'
    7 | #define cerr if(0)cerr
      |              ^~
a.cc:16:34: note: in expansion of macro 'cerr'
   16 | sim > auto dud(c* x) -> decltype(cerr << *x, 0);
      |                                  ^~~~
Language: C++

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

int n,m;
vector<int> adj[15];
int nyala[15]

bool cek(int x){
	for(int i=1;i<=m;i++){
    	int tmp = 0;
        for(int j=0;j<adj[i].size();j++){
        	int cur = adj[i][j];
            if((1<<cur) & x) tmp++;
        }
        if(nyala[i] != tmp%2) return 0;
    }
    return 1;
}

int main(){
  scanf("%d%d",&n,&m);
  for(int i=1;i<=m;i++){
    int x;
    scanf("%d",&x);
    for(int j=1;j<=x;j++){
      int y;
      scanf("%d",&y);
      adj[i].push_back(y);
    }
  }
  for(int i=1;i<=m;i++){
  	scanf("%d",&nyala[i]);
  }
  int ans = 0;
  for(int i=0;i<(1<<n);i++){
  	if(cek(i)) ans++;
  }
  printf("%d\n",ans);
  return 0;
}

Compiler output:
a.cc:8:1: error: expected initializer before 'bool'
    8 | bool cek(int x){
      | ^~~~
a.cc: In function 'int main()':
a.cc:32:21: error: 'nyala' was not declared in this scope
   32 |         scanf("%d",&nyala[i]);
      |                     ^~~~~
a.cc:36:12: error: 'cek' was not declared in this scope
   36 |         if(cek(i)) ans++;
      |            ^~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <queue>
#include<vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int v[55];
    int ans=-9999999;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    int a,b,c;
    int sum=0;
    for(a=0;a<=k;a++)
    {
        for(b=0;b<=k;b++)
        {
            for(c=0;c<=k;c++)
            {
                if(a+b+c<=k&&a+b>c&&a+b<n)
                   priority_queue<int > q;
                   for(int i=0;i<a;i++)
                   {
                       q.push(v[i]);
                   }
                   for(int i=0;i<b;i++)
                   {
                       q.push(v[n-i-1]);
                   }
                   int sum=0;
                   for(int i=0;i<a+b-c;i++)
                   {
                       sum+=q.top();
                       q.pop();
                   }
                   ans=max(ans,sum);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: 'q' was not declared in this scope
   29 |                        q.push(v[i]);
      |                        ^
a.cc:33:24: error: 'q' was not declared in this scope
   33 |                        q.push(v[n-i-1]);
      |                        ^
a.cc:38:29: error: 'q' was not declared in this scope
   38 |                        sum+=q.top();
      |                             ^
Language: C++

#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <string.h>
int main()
{
    int n,k,maxn=-9999999;
    scanf("%d%d",&n,&k);
    int num[55];
    for(int i=0; i<n; i++)
        scanf("%d",&num[i]);
    int a,b,c;
    for(a=0; a<=k; a++)
    {
        for(b=0; b<=k; b++)
        {
            for(c=0; c<=k; c++)
            {
                if(a+b+c<=k&&a+b<=n&&a+b>=c)
                {
                    priority_queue<int>q;
                    for(int i=0; i<a; i++)
                        q.push(num[i]);
                    for(i=0; i<b; i++)
                        q.push(num[n-1-i]);
                    int sum=0;
                    for(i=0;i<a+b-c;i++)
                    {
                        sum=sum+q.top();
                        q.pop();
                    }
                     maxn=max(maxn,sum);
                }

            }
        }
    }
    printf("%d",maxn);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:21: error: 'priority_queue' was not declared in this scope; did you mean 'std::priority_queue'?
   22 |                     priority_queue<int>q;
      |                     ^~~~~~~~~~~~~~
      |                     std::priority_queue
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:496:11: note: 'std::priority_queue' declared here
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
a.cc:22:36: error: expected primary-expression before 'int'
   22 |                     priority_queue<int>q;
      |                                    ^~~
a.cc:24:25: error: 'q' was not declared in this scope
   24 |                         q.push(num[i]);
      |                         ^
a.cc:25:25: error: 'i' was not declared in this scope
   25 |                     for(i=0; i<b; i++)
      |                         ^
a.cc:26:25: error: 'q' was not declared in this scope
   26 |                         q.push(num[n-1-i]);
      |                         ^
a.cc:28:25: error: 'i' was not declared in this scope
   28 |                     for(i=0;i<a+b-c;i++)
      |                         ^
a.cc:30:33: error: 'q' was not declared in this scope
   30 |                         sum=sum+q.top();
      |                                 ^
a.cc:33:27: error: 'max' was not declared in this scope; did you mean 'std::max'?
   33 |                      maxn=max(maxn,sum);
      |                           ^~~
      |                           std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  
  int n, k;
  cin >> n >> k;
  vector<int>vec(n);
  rep(i,n) cin >> vec[i];
  
  ll ans = 0;
  for(int tot=1;tot<=min(n,k);tot++){
    for(int left=0;left<=tot;left++){//決めた
      int right = tot-left;
      priority_queue<int,vector<int>,greater<int>>que;
      int sum = 0;
      rep(i,left){
        que.push(vec[i]);
        sum += vec[i];
      }
      rep(i,right){
        que.push(vec[n-1-i]);
        sum += vec[n-1-i];
      }
      int res = min(n,k)-tot;
      while(res && !que.empty()){
        res--;
        ll t = que.top();
        que.pop();
        if(t>=0)break;
        sum -= t;
      }
      chmax(ans,sum);
    }
  }
  cout << ans << endl;
          
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:12: error: no matching function for call to 'chmax(ll&, int&)'
   50 |       chmax(ans,sum);
      |       ~~~~~^~~~~~~~~
a.cc:7:31: note: candidate: 'template<class T> bool chmax(T&, T)'
    7 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:7:31: note:   template argument deduction/substitution failed:
a.cc:50:12: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   50 |       chmax(ans,sum);
      |       ~~~~~^~~~~~~~~
Language: C++

# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}
static const ll INF = 1e18;

ll dp[52][102];

int main() {
  int n, k; cin >> n >> k;
  vector<int> v(n);
  rep(i, n) {
    cin >> v[i];
  }

  ll ans = 0;
  for(int i = 0; i <= k; i++){
    for(int j = 0; j <= k - i; j++){
      if(i + j >= n) continue;
      vector<int> a;
      ll sum = 0;
      rep(x, i){
        sum += v[x];
        a.pb(v[x]);
      }
      rep(x, j){
        sum += v[n - 1 - x];
        a.pb(u[n - 1 - x]);
      }
      sort(ALL(a));
      for(int x = 0; x < k - i - j; x++){
        if(x >= a.size()) break;
        if(a[x] >= 0) break;
        sum -= a[x];
      }
      chmax(ans, sum);
    }
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:14: error: 'u' was not declared in this scope
   40 |         a.pb(u[n - 1 - x]);
      |              ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

using ll = long long;

const int Inf = 1e9;
const double EPS = 1e-9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep (i, n) cin >> v[i];
	ll res = 0;
	rep (i, k + 1) {
	  rep (j, i + 1) {
		// 宝石を取り出せる回数
		int num = i - j;
		// 左から宝石を取り出す回数を全探索
		rep (l, min(n, num + 1)) {
		  vector<int> hand;
		  int left = 0, right = n - 1;
		  while (left < l) {
			hand.push_back(v[left++]);
		  }
		  int rest = min(n, num + 1) - l;
		  rep (r, rest - 1) {
			if (left >= right) break;
			hand.push_back(v[right--]);
		  }
		  sort(hand.begin(), hand.end());
		  int tmp = 0;
		  rep (r, j) {
			if (r >= hand.size()) break;
			if (hand[r] < 0) hand[r] = 0;
		  }
		  rep (r, hand.size()) tmp += hand[r];
		  res = max(res, tmp);
		}
	  }
	}
	cout << res << endl;
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:28: error: no matching function for call to 'max(ll&, int&)'
   44 |                   res = max(res, tmp);
      |                         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:44:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   44 |                   res = max(res, tmp);
      |                         ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:44:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   44 |                   res = max(res, tmp);
      |                         ~~~^~~~~~~~~~
Language: C++


 #include <iostream>
#include <cmath>
#include <math.h>
#define ll long long 
using namespace std;
ll dp[51][51][101];
int arr[51];
ll solve (int cura,int curb,int rem)
{
	
	if(rem<=0||cura>curb)return 0;
	if(dp[cura][curb][rem]!=-1)return dp[cura][curb][rem];
	ll x= solve(cura,curb,rem-1);
	x=max(x,max(solve(cura+1,curb,rem-1)+arr[cura],solve(cura+1,curb,rem-2)));
	x=max(x,max(solve(cura,curb-1,rem-1)+arr[curb],solve(cura,curb-1,rem-1)));
	return dp[cura][curb] [rem]=x;
}
int main()
{
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++)
{
	cin>>arr[i];
}
memset(dp,-1,sizeof(dp));
cout<<solve(0,n-1,k);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:1: error: 'memset' was not declared in this scope
   27 | memset(dp,-1,sizeof(dp));
      | ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <math.h>
  +++ |+#include <cstring>
    5 | #define ll long long
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int n;
    cin>>n;
    int k;
    cin>>k;
    vi v(n);
    rep(i,0,n)cin>>v[i];
    ll ans=-INF;
    rep(r,0,k+1){
        rep(l,0,k+1-r){
                if(r+l>n)continue;
                priority_queue<int,vi,greater<int>> q;
                ll ta=k-(r+l);
                ll res=0;
                rep(i,0,r)q.push(v[n-1-i]),res+=v[n-1-i];
                rep(i,0,l)q.push(v[i]),res+=v[i];
                rep(i,0,ta){
                    if(!q.empty()&&q.top()<0){
                        int minus=q.top();
                        q.pop();
                        res-=minus;
                    }
                }
                chmax(ans,res);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}




Compiler output:
a.cc:61:5: error: 'cout' does not name a type
   61 |     cout<<ans<<endl;
      |     ^~~~
a.cc:62:5: error: expected unqualified-id before 'return'
   62 |     return 0;
      |     ^~~~~~
a.cc:63:1: error: expected declaration before '}' token
   63 | }
      | ^
Language: C++

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

int main()
{
   int n,k;
   int ans =0;
   cin>>n>>k;
   vector<int>a(n);
  
  for(int i=0;i<n;i++)
  {
      cin>>a.at(i);
  }
 
  
  for(int l=0;l<k;l++)
  {
    for(int r=0;r<k-l;k++)
    {
       if(l+r>n) continue;
       int d = k-l-r;
       int now =0;
       vector<int>s;
      
       for(int i=0;i<l-1;i++)
       {
         now = a[i];
         s.push_back(a[i]);
       }
      for(int i=n-r;i<n-1;i++)
      {
          now+= a[i];
          s.push_back(a[i]);
      } 
      
      sort(s.begin(),s.end());
      
      for(i=0;i<d-1;i++)
      {
         if(i>s.size())continue;
         if(s[i]>0)continue;
        
         now -=s[i];
      }
      
      ans = max(ans,now);  
    
    }
  
  
  }

 cout<<ans<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: 'i' was not declared in this scope
   39 |       for(i=0;i<d-1;i++)
      |           ^
Language: C++

#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(){
    int n,kk,p,ans=0;cin>>n>>kk;
    p=min(n,kk);
    vector<int> v(n);
    for(auto &i:v) cin>>i;
    for(int i=0;i<=p;i++){
        int t=0;
        priority_queue<int> q;
        for(int j=0;j<i;j++){
            if(v[j]<0) q.push(-v[j]);
            t+=v[j];
        }
        for(int j=0;j<=p-i;j++){
            int tt=t;priority_queue<int> qq=q;
            for(k=0;k<j;k++){
                tt+=v[n-1-k];
                if(v[n-1-k]<0) qq.push(-v[n-1-k]);
            }
            for(k=0;k<kk-i-j;k++) {
                if(qq.empty()) break;
                tt+=qq.top();
                qq.pop();
            }
            ans=max(ans,tt);
        }
    }
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'k' was not declared in this scope
   23 |             for(k=0;k<j;k++){
      |                 ^
a.cc:27:17: error: 'k' was not declared in this scope
   27 |             for(k=0;k<kk-i-j;k++) {
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> v(n);
    int ans = 0;
    priority_queue<pair<int,int>> l,r;

    for(int i = 0; i < n; i++) cin >> v[i];

    int m = 0;
    if(n < k){
        m = k-n;
        k = n;
    }

    for(int left = 0; left <= k; left++){
        int right = k-left;
        int sumr = 0, suml = 0;

        while(!l.empty()) l.pop();
        while(!r.empty()) r.pop();

        for(int i = 0; i < left; i++){
            l.push({-v[i],i});
            suml += v[i];
        }
        for(int i = n-right; i < n; i++){
            r.push({-v[i],i});
            sumr += v[i];
        }
        //cout << suml << " " << sumr << " -> ";

        if(m > 0){
            for(int i = 0; i < m; i++){
                if(l.top().first > 0 && r.top().first > 0) break;
                if(l.top().first < r.top().first) r.pop();
                else l.pop();
            }
        }

        vector<bool> flagl(n,true);
        vector<bool> flagr(n,true);
        
        for(int i = left-1; i >= 0 ; i--){
            if(!flagl[i]) continue;
            if(i == l.top().second) continue;
            if(v[i]-l.top().first > 0 || l.empty()) break;
            else{
                suml -= v[i];
                suml += l.top().first;
            }
            flagl[l.top().second] = false;
            l.pop();
        }
        for(int i = n-right; i < n ; i++){
            if(!flagr[i]) continue;
            if(i == r.top().second) continue;
            if(v[i]-r.top().first > 0 || r.empty()) break;
            else{
                sumr -= v[i];
                sumr += r.top().first;
            }
            flagr[r.top().second] = false;
            r.pop();
        }
        //cout << suml << " " << sumr << endl;

        int can = suml+sumr;
        if(ans < can) ans = can;
    }
    cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:76:25: error: expected '}' at end of input
   76 |     cout << ans << endl;
      |                         ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int n, k, a[55];
int dp[55][55][55];
void solve(){
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	vector<int> v;
	v.push_back(INF);
	int A = 0;
	int ans = 0;
	for(int i = 0; i <= n; i++){
		if(i != 0){
			v.push_back(a[i-1]);
			A += a[i-1];
		}
		sort(v.begin(),v.end());
		vector<int> vv;
		vv.push_back(INF);
		int B = 0;
		for(int j = 0; i+j <= n; j++){
			if(j != 0){
				vv.push_back(a[n-j]);
				B += a[n-j];
			}
			sort(vv.begin(),vv.end());
			if(i+j > k) break;
			chmax(ans, A+B-C);
			if(k-i-j > i+j) continue;
			int l = 0, r = 0;
			int C = 0;
			for(int ii = 0; ii+i+j < k; ii++){
				if(v[l] < vv[r]){
					C += v[l];
					l++;
				}
				else{
					C += vv[r];
					r++;
				}
				chmax(ans, A+B-C);
			}
		}
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:47:40: error: 'C' was not declared in this scope
   47 |                         chmax(ans, A+B-C);
      |                                        ^