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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define in(n, m) for (int i=n; i<m;i++)
#define inj(n, m)for (ll j=n; j<m;j++)
#define ink(n, m)for (ll k=n; k<m;k++)
using namespace std;
using ll=long long;
using P =pair<ll, ll>;
const ll INF = 1LL << 60;
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; }

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int>A) {
	if (A.size() == n + 1) {
		int now = 0; 
		in(0, q) {
			if(A[b[i]]-A[a[i]]==c[i]) now+=d[i];
			ans = max(ans, now);
		}
		return;
	}
	A.push_back(A.back());
	while (A.back() <= m) {
		dfs(A);
		A.back++;
	}
}

int main() {
	cin >> n >> m >> q;
	a = b = c = d = vector<int>(q);
	in(0, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}

	dfs(vector<int>(1,1));
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:32:19: error: no post-increment operator for type
   32 |                 A.back++;
      |                 ~~^~~~
Language: C++

#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;

int s[20];
int a[20],b[20],c[20],d[20];
int sum = -inf;
int n,m,q;

void check(){
	int no = 0;
	for(int i=0;i<q;i++){
		if(s[b[i]] - s[a[i]] == c[i]){
			now += d[i];
		}
	}
	sum = max(sum,no);
	return;
}


void dfs(int now,int val){
	s[now] = val;
	if(now == n){
		check();
		return;
	}
	for(int i=val;i<=m;i++){
		dfs(now+1,i);
	}
}


int main(){
	cin>>n>>m>>q;
	for(int i=0;i<q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}
	dfs(1,1);
	cout<<sum<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'void check()':
a.cc:14:25: error: 'now' was not declared in this scope; did you mean 'no'?
   14 |                         now += d[i];
      |                         ^~~
      |                         no
Language: C++

#include <bits/stdc++.h>
using namespace std;
struct req{
	long long a,b,c;
	long long d;
}r[1005];
int main()
{
	long long n,m,q;
	cin>>n>>m>>q;
	for(long long i=0;i<q;i++)
	{
		cin>>r[i].a>>r[i].b>>r[i].c>>r[i].d;
	}
	vector<long long> k;
	for(long long i=0;i<m;i++)
	{
		k.push_back(0);
	}
	for(long long i=0;i<n;i++)
	{
		k.push_back(1);
	}
	long long ans=-1;
	do{
		long long cnt=0,cnt2=0;
		long long sum=0;
		vector<long long> v(n);
		for(long long i=0;i<m+n;i++)
		{
			if(k[i]==0)cnt++;
			else{
				v[cnt2]=cnt;//cout<<v[cnt2]<<" ";
				cnt2++;
			}
		}
		//cout<<endl;
		for(long long i=0;i<q;i++)
		{
			if(v[r[i].b-1]-v[r[i].a-1]==r[i].c)sum+=r[i].d;
			//cout<<v[r[i].a-1]<<" "<<v[r[i].b-1]<<" "<<r[i].c<<" "<<r[i].d<<endl;
		}
		//cout<<"s:"<<sum<<endl;
		ans=max(ans,sum);
	}while(next_permutation(k.begin(),k.end()));
	cout<<max(ans,0)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:18: error: no matching function for call to 'max(long long int&, int)'
   46 |         cout<<max(ans,0)<<endl;
      |               ~~~^~~~~~~
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:46:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   46 |         cout<<max(ans,0)<<endl;
      |               ~~~^~~~~~~
/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:46:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   46 |         cout<<max(ans,0)<<endl;
      |               ~~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,q;
  cin>>n>>m>>q;
  vector<int>a(q);
  vector<int>b(q);
  vector<int>c(q);
  vector<int>d(q);
  for(int i=0;i<q;++i)
    cin>>a[i]>>b[i]>>c[i]>>d[i];
  vector<int>A(n);
  int ans=0;
  function<void(int,int)>dfs=[&](int p,int low){
    if(p==m){
      int tot=0;
      for(int i=0;i<q;++i)
        tot+=(A[b[i]-1]-A[a[i]-1]==c[i])*d[i];
      ans=max(ans,tot);
      return;
    }
  }
  for(int i=low;i<=m;++i){
			A[p]=i;
			dfs(p+1,i);
			A[p]=0;
		}
	};
	dfs(0,1);
    cout<<ans;
    return 0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: expected ',' or ';' before 'for'
   23 |   for(int i=low;i<=m;++i){
      |   ^~~
a.cc:23:17: error: 'i' was not declared in this scope
   23 |   for(int i=low;i<=m;++i){
      |                 ^
a.cc: At global scope:
a.cc:29:12: error: expected constructor, destructor, or type conversion before '(' token
   29 |         dfs(0,1);
      |            ^
a.cc:30:5: error: 'cout' does not name a type
   30 |     cout<<ans;
      |     ^~~~
a.cc:31:5: error: expected unqualified-id before 'return'
   31 |     return 0;
      |     ^~~~~~
a.cc:32:3: error: expected declaration before '}' token
   32 |   }
      |   ^
a.cc:33:3: error: expected unqualified-id before 'return'
   33 |   return 0;
      |   ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int N, M, Q;
vector<int>a;
vector<int>b;
vector<int>c;
vector<int>d;
vector<int>sta;
int search(int si, int la) {
  if (si == N) {
    int ret = 0;
    for (int i = 0; i < Q; i ++) {
      if (sta[b[i] - 1] - sta[a[i] - 1] == c[i]) ret += d[i];
    }
    return ret;
  }
  int ret = -1;
  for (int i = la; i <= M; i ++) {
    sta[si] = i;
    si ++;
    ret = max(ret, search(si, i));
    si --;
  }
  return ret;
}
int main () {
  cin >> N >> M >> Q;
  a.rsize(Q);
  b.rsize(Q);
  c.rsize(Q);
  d.rsize(Q);
  sta.rsize(100);
  for (int i = 0; i < Q; i ++) cin >> a[i] >> b[i] >> c[i] >> d[i];
  int ans = 0;
  for (int i = 1; i <= M; i ++) {
    sta[0] = i;
    ans = max(ans, search(1, i));
  }
  cout << ans << endl;
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'class std::vector<int>' has no member named 'rsize'; did you mean 'size'?
   28 |   a.rsize(Q);
      |     ^~~~~
      |     size
a.cc:29:5: error: 'class std::vector<int>' has no member named 'rsize'; did you mean 'size'?
   29 |   b.rsize(Q);
      |     ^~~~~
      |     size
a.cc:30:5: error: 'class std::vector<int>' has no member named 'rsize'; did you mean 'size'?
   30 |   c.rsize(Q);
      |     ^~~~~
      |     size
a.cc:31:5: error: 'class std::vector<int>' has no member named 'rsize'; did you mean 'size'?
   31 |   d.rsize(Q);
      |     ^~~~~
      |     size
a.cc:32:7: error: 'class std::vector<int>' has no member named 'rsize'; did you mean 'size'?
   32 |   sta.rsize(100);
      |       ^~~~~
      |       size
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,Q,ans;
int a[15];
 
struct Query {
	int a,b,c,d;
}q[55];
 
void dfs(int x) {
	if(x == n+1) {
		int res = 0;
		for(int i = 1;i <= Q;i++) {
			if(a[q[i].b]-a[q[i].a] == q[i].c) res += q[i].d;
		}
		ans = max(ans,res);
		return;
	}
	for(int i = a[x-1];i <= m;i++) {
		a[x] = i; dfs(x+1);
	}
}
 
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> Q;
	for(int i = 1;i <= Q;i++) {
		cin >> q[i].a >> q[i].b >> q[i].c >> q[i].d;
	}
	a[0] = 1;
	dfs(1);
	cout << ans;
} 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,Q,ans;
int a[15];

struct Query {
	int a,b,c,d;
}q[55];

void dfs(int x) {
	if(x == n+1) {
		int res = 0;
		for(int i = 1;i <= Q;i++) {
			if(a[q[i].b]-a[q[i].a] == q[i].c) res += q[i].d;
		}
		ans = max(ans,res);
		return;
	}
	for(int i = a[x-1];i <= m;i++) {
		a[x] = i; dfs(x+1);
	}
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> Q;
	for(int i = 1;i <= Q;i++) {
		cin >> q[i].a >> q[i].b >> q[i].c >> q[i].d;
	}
	a[0] = 1;
	dfs(1);
	cout << ans;
} 


Compiler output:
a.cc:38:5: error: redefinition of 'int n'
   38 | int n,m,Q,ans;
      |     ^
a.cc:4:5: note: 'int n' previously declared here
    4 | int n,m,Q,ans;
      |     ^
a.cc:38:7: error: redefinition of 'int m'
   38 | int n,m,Q,ans;
      |       ^
a.cc:4:7: note: 'int m' previously declared here
    4 | int n,m,Q,ans;
      |       ^
a.cc:38:9: error: redefinition of 'int Q'
   38 | int n,m,Q,ans;
      |         ^
a.cc:4:9: note: 'int Q' previously declared here
    4 | int n,m,Q,ans;
      |         ^
a.cc:38:11: error: redefinition of 'int ans'
   38 | int n,m,Q,ans;
      |           ^~~
a.cc:4:11: note: 'int ans' previously declared here
    4 | int n,m,Q,ans;
      |           ^~~
a.cc:39:5: error: redefinition of 'int a [15]'
   39 | int a[15];
      |     ^
a.cc:5:5: note: 'int a [15]' previously declared here
    5 | int a[15];
      |     ^
a.cc:41:8: error: redefinition of 'struct Query'
   41 | struct Query {
      |        ^~~~~
a.cc:7:8: note: previous definition of 'struct Query'
    7 | struct Query {
      |        ^~~~~
a.cc:43:2: error: conflicting declaration 'int q [55]'
   43 | }q[55];
      |  ^
a.cc:9:2: note: previous declaration as 'Query q [55]'
    9 | }q[55];
      |  ^
a.cc:45:6: error: redefinition of 'void dfs(int)'
   45 | void dfs(int x) {
      |      ^~~
a.cc:11:6: note: 'void dfs(int)' previously defined here
   11 | void dfs(int x) {
      |      ^~~
a.cc:59:5: error: redefinition of 'int main()'
   59 | int main() {
      |     ^~~~
a.cc:25:5: note: 'int main()' previously defined here
   25 | int main() {
      |     ^~~~
Language: C++

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

int main()
{
  int N,M,Q;
  int dsum = 0;
  cin >> N >> M >> Q;
  vector<vector<int>> k(Q,vector<int>(4));
  for(int i = 0;i < Q;i++){
    cin >> k[i][0] >> k[i][1] >> k[i][2] >> k[i][3];
  }
  vector<int> A(N);
  for (int tmp = 0; tmp < (1 << 19); tmp++){
    bitset<19> s(tmp);
    if(s.count() != M-1) continue;
    if(N+M-1 != 19 && s.test(N+M-1)) break;
    int kazu = 1;
    int j = 0;
    int sum = 0;
    for(int i = N+M-2;i >= 0;--i){
      if(s.test(i)){
        ++kazu;
      }
      else{
        A[j] = kazu;
        ++j;
      }
    }
    for(int i = 0;i < Q;i++){
      if(A[kumi[i][1]-1] - A[kumi[i][0]-1] == kumi[i][2]) sum += kumi[i][3];
    }
    dsum = max(dsum,sum);
  }
  cout << dsum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:12: error: 'kumi' was not declared in this scope
   32 |       if(A[kumi[i][1]-1] - A[kumi[i][0]-1] == kumi[i][2]) sum += kumi[i][3];
      |            ^~~~
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;
int maxi = 0;
int arr[51][5];
int n,m,q;
vector<int> vec;

void calculate()
{
	int sum = 0;
	for(int i = 0;i<q;i++)
	{
		if((vec[arr[i][1]] - vec[arr[i][0]]) == arr[i][2]) sum+=arr[i][3];	
	}	
	
	maxi = max(maxi , sum);
}

void generate(int pos)
{
	if(pos == n+1)
	{
		calculate(vec);
		return;	
	}	
	
	for(int i = vec[pos-1];i<=10;i++)
	{
		vec.push_back(i);
		generate(pos+1);
		vec.pop_back();
	}
}

int main()
{
	cin>>n>>m>>q;
	
	for(int i = 0;i<q;i++)
	{
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2]>>arr[i][3];	
	}	
	
	vec.push_back(1);
	
	generate(1);
	
	cout<<maxi<<endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'void generate(int)':
a.cc:64:26: error: too many arguments to function 'void calculate()'
   64 |                 calculate(vec);
      |                 ~~~~~~~~~^~~~~
a.cc:49:6: note: declared here
   49 | void calculate()
      |      ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int n,m,q;
vector<int> a,b,c,d;
int ans = 0;

void dfs(vector<int> A){
  if(A.size() == n+1){
    int now = 0;
    for(int i = 0; i < q; i++){
      if(A[b[i]] - A[a[i]] == c[i]){
        now += d[i];
      }
    }
    ans = max(ans,now);
    return;
  }
  
  A.push_back(A.back());
  while(A.back() => m){
    dfs(A);
    A.back()++;
  }
}


int main(){
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  
  for(int i = 0; i < q; i++){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }

  dfs(vector<int>(1,1));
  cout << ans << endl;
  
  return 0;
  
}

Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:24:19: error: expected primary-expression before '>' token
   24 |   while(A.back() => m){
      |                   ^
Language: C++

4 6 10
2 4 1 86568
1 4 0 90629
2 3 0 90310
3 4 1 29211
3 4 3 78537
3 4 2 8580
1 2 1 96263
1 4 2 2156
1 2 0 94325
1 4 3 94328

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 4 6 10
      | ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int n, m, q;
vi a, b, c, d;
int ans;

void dfs(vi A) {
  if (A.size() = n+1) {
    int now = 0;
    REP(i, q) {
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    chmax(ans, now);
    return;
  }
  A.emplace_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}

int main() {
  cin >> n >> m >> q;
  a = b = c = d = vi(q);
  REP(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];
  dfs(vi(1,1));
  cout << ans << endl; 

  return 0;
}

Compiler output:
a.cc: In function 'void dfs(vi)':
a.cc:39:13: error: lvalue required as left operand of assignment
   39 |   if (A.size() = n+1) {
      |       ~~~~~~^~
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

struct data{int a, b, c, d;};
vector<data> Q;
int n, m, q;

int dfs(int v, int id, vint &x) {
    if (id == n) {
        int sum = 0;
        rep(i,q) {
            if (x[Q[i].b]-x[Q[i].a] == Q[i].c) sum += Q[i].d;
        }
        return sum;
    }
    int res = 0;
    x[id] = v;
    for (int i = v; i <= m; i++) {
        res = max(dfs(i,id+1,x),res);
    }
    return res;
}

int main() {
    cin >> n >> m >> q;
    Q.resize(q);
    vint x(n);
    rep(i,q) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; b--;
        Q[i] = data{a,b,c,d};
    }
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        ans = max(dfs(i,0,x),ans);
    }
    cout << ans << endl;
}

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<stdio.h>
int main(void){
  int e,f, i, j, k, l, m, n, o, p, q, r, s, u, v, a[50], b[50], c[50], d[50], t[11];
  scanf("%d%d%d",&n, &m, &q);
  for(e=0;e<q;e++){
    scanf("%d%d%d%d", &a[e], &b[e], &c[e], &d[e]);
  }
  for(i=1;i<=m;i++){
    t[1]=i;
    for(j=i;j<=m;j++){
      t[2]=j;
      for(k=j;k<=m;k++){
        t[3]=k;
        for(l=k;l<=m;l++){
          t[4]=l;
          for(o=l;o<=m;o++){
            t[5]=o;
            for(p=o;p<=m;p++){
              t[6]=p;
              for(r=o;r<=m;r++){
                t[7]=r;
                for(s=r;s<=m;s++){
                  t[8]=s;
                  for(u=s;u<=m;u++){
                    t[9]=u;
                    for(v=u;v<=m;v++){
                      t[10]=v;
                      int count=0;
                      for(f=0;f<q;f++){
                        if(t[b[f]]-t[a[f]]==c[f]){
                          count+=d[f];
                        }
                      }
                      int max=0;
                      if(count>max){
                        max=count;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  printf("%d",max);      
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:48:15: error: 'max' undeclared (first use in this function)
   48 |   printf("%d",max);
      |               ^~~
main.c:48:15: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int q = sc.nextInt();
    int[] arr = new int[m];
    for(int i=1;i<=m;i++){
      arr[i]=i;
    }
    ArrayList<ArrayList<Integer>> arr1 = new ArrayList<>();
    ArrayList<Integer> data = new ArrayList<Integer>();
    combinationUtil(arr,m,n,0,data,0,arr1);
    ArrayList<ArrayList<Integer>> arr2 = new ArrayList<>();
    for(int i=0;i<q;i++){
      ArrayList<Integer> f = new ArrayList<>();
      for(int p=0;p<3;p++){
        f.add(sc.nextInt());
      }
    }
    int max= Integer.MIN_VALUE;
    for(int i1=0;i1<arr1.size();i1++){
      int score=0;
      ArrayList<Integer> j = arr1.get(i1);
      for(int i2=0;i2<arr2.size();i2++){
        ArrayList<Integer> h = arr2.get(i2);
        if(j.get(h.get(0))-j.get(h.get(1))==h.get(2)){
          score=score+h.get(3);
        }
      }
      if(score>max){
        max=score;
      }
    }
    System.out.println(max);
  }
  static void combinationUtil(int arr[], int n, int r, int index, 
                                ArrayList<Integer> data, int i,ArrayList<ArrayList<Integer>> arr1) 
    { 
        // Current combination is ready to be printed, print it 
        if (index == r) 
        { 
            //for (int j=0; j<r; j++) 
             //   System.out.print(data[j]+" "); 
            //System.out.println("");
            arr1.add(data);
        return; 
        } 
  
        // When no more elements are there to put in data[] 
        if (i >= n) 
        return; 
  
        // current is included, put next at next location 
        //data[index] = arr[i];
        data.add(index,arr[i]);
        combinationUtil(arr, n, r, index+1, data, i+1); 
  
        // current is excluded, replace it with next (Note that 
        // i+1 is passed, but index is not changed) 
        combinationUtil(arr, n, r, index, data, i+1); 
    } 
  
    // The main function that prints all combinations of size r 
    // in arr[] of size n. This function mainly uses combinationUtil() 
}

Compiler output:
Main.java:58: error: method combinationUtil in class Main cannot be applied to given types;
        combinationUtil(arr, n, r, index+1, data, i+1); 
        ^
  required: int[],int,int,int,ArrayList<Integer>,int,ArrayList<ArrayList<Integer>>
  found:    int[],int,int,int,ArrayList<Integer>,int
  reason: actual and formal argument lists differ in length
Main.java:62: error: method combinationUtil in class Main cannot be applied to given types;
        combinationUtil(arr, n, r, index, data, i+1); 
        ^
  required: int[],int,int,int,ArrayList<Integer>,int,ArrayList<ArrayList<Integer>>
  found:    int[],int,int,int,ArrayList<Integer>,int
  reason: actual and formal argument lists differ in length
2 errors
Language: Java

import java.util.*;
public class Main{
  public staitc void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int q = sc.nextInt();
    int[] arr = new int[m];
    for(int i=1;i<=m;i++){
      arr[i]=i;
    }
    ArrayList<ArrayList<Integer>> arr1 = new ArrayList<>();
    ArrayList<Integer> data = new ArrayList<Integer>();
    combinationUtil(arr,m,n,0,data,0,arr1);
    ArrayList<ArrayList<Integer>> arr2 = new ArrayList<>();
    for(int i=0;i<q;i++){
      ArrayList<Integer> f = new ArrayList<>();
      for(int i=0;i<3;i++){
        arr.add(sc.nextInt());
      }
    }
    int max= Integer.MIN_VALUE;
    for(int i=0;i<arr1.size();i++){
      int score=0;
      ArrayList<Integer> j = arr1.get(i);
      for(int i=0;i<arr2.size();i++){
        ArrayList<Integer> h = arr2.get(i);
        if(j.get(h.get(0))-j.get(h.get(1))==h.get(2)){
          score=score+h.get(3);
        }
      }
      if(score>max){
        max=score;
      }
    }
    System.out.println(max);
  }
  static void combinationUtil(int arr[], int n, int r, int index, 
                                ArrayList<Integer> data, int i,ArrayList<ArrayList<Integer>> arr1) 
    { 
        // Current combination is ready to be printed, print it 
        if (index == r) 
        { 
            //for (int j=0; j<r; j++) 
             //   System.out.print(data[j]+" "); 
            //System.out.println("");
            arr1.add(data);
        return; 
        } 
  
        // When no more elements are there to put in data[] 
        if (i >= n) 
        return; 
  
        // current is included, put next at next location 
        //data[index] = arr[i];
        data.add(index,arr[i]);
        combinationUtil(arr, n, r, index+1, data, i+1); 
  
        // current is excluded, replace it with next (Note that 
        // i+1 is passed, but index is not changed) 
        combinationUtil(arr, n, r, index, data, i+1); 
    } 
  
    // The main function that prints all combinations of size r 
    // in arr[] of size n. This function mainly uses combinationUtil() 
}


Compiler output:
Main.java:3: error: <identifier> expected
  public staitc void main(String[] args){
               ^
1 error
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;

ll n,m,q, a[55], b[55], c[55],d[55];

ll dfs(ll* k, ll p, ll cn){
    ll res;
    if(p==n){
        res = 0;
        REP(i,q){
            if(k[b[i]-1]-k[a[i]-1]==c[i]){
                res+=d[i];
            }
        }
        return res;
    }
    res = 0;
    FOR(i,cn,m){
        k[p]=i;
        res = max(res, dfs(k,p+1,i));
    }
    return res;
}

int main(){FIN

    cin>>n>>m>>q;
    REP(i,q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    cout<<dfs(k,0,1)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:15: error: 'k' was not declared in this scope
   45 |     cout<<dfs(k,0,1)<<endl;
      |               ^
Language: C

#include<stdio.h>
int main(void){
  int e,f, i, j, k, l, m, n, o, p, q, r, s, t, u, a[50], b[50], c[50], d[50], t[10];
  scanf("%d%d%d",&n, &m, &q);
  for(e=0;e<q;e++){
    scanf("%d%d%d%d", &a[e], &b[e], &c[e], &d[e]);
  }
  for(i=1;i<=m;i++){
    t[0]=i;
  }
  for(j=i;j<=m;j++){
    t[1]=j;
  }
  for(k=j;k<=m;k++){
    t[2]=k;
  }
  for(l=k;l<=m;l++){
    t[3]=l;
  }
  for(o=l;o<=m;o++){
    t[4]=o;
  }
  for(p=o;p<=m;p++){
    t[5]=p;
  }
  for(r=o;r<=m;r++){
    t[6]=r;
  }
  for(s=r;s<=m;s++){
    t[7]=s;
  }
  for(t=s;t<=m;t++){
    t[8]=t;
  }
  for(u=t;u<=m;u++){
    t[9]=u;
  }
  int count=0;
  for(f=0;f<q;f++){
    if(t[b[f]]-t[a[f]]==c[f]){
      count+=d[f];
    }
  }
  int max=0;
  if(count>max){
    max=count;
  }
  printf("%d",max);      
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:79: error: conflicting types for 't'; have 'int[10]'
    3 |   int e,f, i, j, k, l, m, n, o, p, q, r, s, t, u, a[50], b[50], c[50], d[50], t[10];
      |                                                                               ^
main.c:3:45: note: previous declaration of 't' with type 'int'
    3 |   int e,f, i, j, k, l, m, n, o, p, q, r, s, t, u, a[50], b[50], c[50], d[50], t[10];
      |                                             ^
Language: C++

#include<iostream>
#include<string>
#include <bits/stdc++.h>
#include<math.h>
#include rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using P = pair<int,int>;

  int n,m,q;

  vector<int> a,b,c,d;
  int ans;
  void dfs(vector<int> A){
    if (A.size() == n+1){
      int now = 0;
      rep(i,q){
        if(A[b[i]]-A[a[i]] == c[i]) now += d[i];
      }
      ans = max(ans,now);
      return ;
    }

    A.push_back(A.back());
    while(A.back() <= m){
      dfs(A);
      A.back()++;
    }
  }

int main(){
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i,q){
      cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1,1));
    cout << ans <<endl;
    return 0;

}


Compiler output:
a.cc:5:10: error: #include expects "FILENAME" or <FILENAME>
    5 | #include rep(i,n) for(int i = 0; i < (n); ++i)
      |          ^~~
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:16:11: error: 'i' was not declared in this scope
   16 |       rep(i,q){
      |           ^
a.cc:16:7: error: 'rep' was not declared in this scope
   16 |       rep(i,q){
      |       ^~~
a.cc: In function 'int main()':
a.cc:33:9: error: 'i' was not declared in this scope
   33 |     rep(i,q){
      |         ^
a.cc:33:5: error: 'rep' was not declared in this scope
   33 |     rep(i,q){
      |     ^~~
Language: C++

#include<iostream>
#include<string>
#include <bits/stdc++.h>
#include<math.h>
#include rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;


  int n,m,q;

  vector<int> a,b,c,d;
  int ans;
  void dfs(vector<int> A){
    if (A.size() == n+1){
      int now = 0;
      rep(i,q){
        if(A[b[i]]-A[a[i]] == c[i]) now += d[i];
      }
      ans = max(ans,now);
      return ;
    }

    A.push_back(A.back());
    while(A.back() <= m){
      dfs(A);
      A.back()++;
    }
  }

int main(){
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i,q){
      cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1,1));
    cout << ans <<endl;
    return 0;

}


Compiler output:
a.cc:5:10: error: #include expects "FILENAME" or <FILENAME>
    5 | #include rep(i,n) for(int i = 0; i < (n); ++i)
      |          ^~~
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:16:11: error: 'i' was not declared in this scope
   16 |       rep(i,q){
      |           ^
a.cc:16:7: error: 'rep' was not declared in this scope
   16 |       rep(i,q){
      |       ^~~
a.cc: In function 'int main()':
a.cc:33:9: error: 'i' was not declared in this scope
   33 |     rep(i,q){
      |         ^
a.cc:33:5: error: 'rep' was not declared in this scope
   33 |     rep(i,q){
      |     ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0 ; i<(n) ; ++i)
#define repr(i,n) for (int i=(n-1); i>=0 ; --i)
typedef long long ll;
using namespace std;
const ll MAX = 2500LL;
typedef pair <ll, ll> P;

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
  if(A.size()==n+1){
    int now=0;
    rep(i,q){
      if(A[b[i]]-A[a[i]] == c[i]) now+=d[i];

    }
    ans = max(ans, now);
    return;
  }
  A.push_back(A.back);
  while(A.back<=m){
    dfs(A);
    A.back()++;
  }
}
int main(){
  cin >> n >> m >> q;
  a = b = c = d = vector<int> (q);
  rep(i,q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int>(1,1));
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:23:14: error: no matching function for call to 'std::vector<int>::push_back(<unresolved overloaded function type>)'
   23 |   A.push_back(A.back);
      |   ~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:24:15: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<='
   24 |   while(A.back<=m){
      |         ~~~~~~^~~
      |           |     |
      |           |     int
      |           <unresolved overloaded function type>
Language: C++

#include <iostream>

using namespace std;

int main(){
 	
  int x;
  cin >> x;
  const b = 100;
  int y=1;
  while(1){
    b *= 1.01;
    if(b>=x){
      cout << cnt <<endl;
      break;
    }
    cnt++;
  }
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'b' does not name a type
    9 |   const b = 100;
      |         ^
a.cc:12:5: error: 'b' was not declared in this scope
   12 |     b *= 1.01;
      |     ^
a.cc:14:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   14 |       cout << cnt <<endl;
      |               ^~~
      |               int
a.cc:17:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   17 |     cnt++;
      |     ^~~
      |     int
Language: C++

#include<bits/stdc++.h>
using namespace std;
set<vector<int>>f(int N,int M){
if(N==1){
set<vector<int>>s;
  for(int i=1;i<=M;i++){
     vector<int>A={i};
    s.insert(A);}
  return s;
}else{
set<vector<int>>S=f(N-1,M);
  set<vector<int>>s;
  for(auto x:S){
    int n=x.size();
    int a=x.at(n-1);
    for(int i=a;i<=M;i++){
     s.insert(x.push_back(i));
    }
  
  } return s;
 
}
 
}
int main(){
int N,M,Q;
  cin>>N>>M>>Q;
  vector<int>a(Q);
  vector<int>b(Q);
  vector<int>c(Q);
  vector<int>d(Q);
  for(int i=0;i<Q;i++){
  cin>>a.at(i); a.at(i)--;
    cin>>b.at(i);b.at(i)--;
    cin>>c.at(i);
    cin>>d.at(i);
  }
  int ans1=0;
  set<vector<int>>S=f(N,M);
  for(auto p:S){
    for(int i=0;i<Q;i++){
    if(p.at(b.at(i))-p.at(a.at(i))==c.at(i))
      ans+=d.at(i);
    } if(ans1<ans)
      ans1=ans;
  
  
  }cout<<ans1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'std::set<std::vector<int> > f(int, int)':
a.cc:17:26: error: invalid use of void expression
   17 |      s.insert(x.push_back(i));
      |               ~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:43:7: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   43 |       ans+=d.at(i);
      |       ^~~
      |       ans1
a.cc:44:15: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   44 |     } if(ans1<ans)
      |               ^~~
      |               ans1
Language: C++

#include<bits/stdc++.h>
using namespace std;
set<vector<int>>f(int N,int M){
if(N==1){
set<vector<int>>s;
  for(int i=1;i<=M;i++){
     vector<int>A={i};
    s.insert(A);}
  return s;
}else{
set<vector<int>>S=f(N-1,M);
  set<vector<int>>s;
  for(auto x:S){
    int n=x.size();
    int a=x.at(n-1);
    for(int i=a;i<=M;i++){
     s.insert(x.push_back(i));
    }
  
  } return s;
 
}
 
}
int main(){
int N,M,Q;
  cin>>N>>M>>Q;
  vector<int>a(Q);
  vector<int>b(Q);
  vector<int>c(Q);
  vector<int>d(Q);
  for(int i=0;i<Q;i++){
  cin>>a.at(i); a.at(i)--;
    cin>>b.at(i);b.at(i)--;
    cin>>c.at(i);
    cin>>d.at(i);
  }
  int ans1=0;
  set<int>S=f(N,M);
  for(auto p:S){
    for(int i=0;i<Q;i++){
    if(p.at(b.at(i))-p.at(a.at(i))==c.at(i))
      ans+=d.at(i);
    } if(ans1<ans)
      ans1=ans;
  
  
  }cout<<ans1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'std::set<std::vector<int> > f(int, int)':
a.cc:17:26: error: invalid use of void expression
   17 |      s.insert(x.push_back(i));
      |               ~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:39:14: error: conversion from 'set<std::vector<int>>' to non-scalar type 'set<int>' requested
   39 |   set<int>S=f(N,M);
      |             ~^~~~~
a.cc:42:10: error: request for member 'at' in 'p', which is of non-class type 'int'
   42 |     if(p.at(b.at(i))-p.at(a.at(i))==c.at(i))
      |          ^~
a.cc:42:24: error: request for member 'at' in 'p', which is of non-class type 'int'
   42 |     if(p.at(b.at(i))-p.at(a.at(i))==c.at(i))
      |                        ^~
a.cc:43:7: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   43 |       ans+=d.at(i);
      |       ^~~
      |       ans1
a.cc:44:15: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   44 |     } if(ans1<ans)
      |               ^~~
      |               ans1
Language: C++

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

int main() {
  int N, M, Q; cin >> N >> M >> Q;
  vector<vector<int>> ABCD(Q, vector<int>(4));
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> ABCD[i][j];
    }
  }
  
  int a = 0;
  int a_sub = 1;
  for (int i = 0; i < N; i++) {
    a += a_sub;
    a_sub *= 10;
  }
  int z = a * M;
  
  int max_ans = -1;
  string b;
  for (int i = a; i <= z; i++) {
    string i_st = to_string(i);
    bool ok = true;
    bool m_10 = false;
    for (int j = 1; j < N; j++) {
      if (i_st[j] == 0) {
        m_10 = true;
      }
      
      if (m_10 && i_st[j] != 0) {
        ok = false;
        break;
      }
      
      if (i_st[j-1] > i_st[j]) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    
    int ans = 0;
    for (int k = 0; k < Q; k++) {
      int p = i_st[ABCD[k][1] - 1] - '0';
      int q = i_st[ABCD[k][0] - 1] - '0';
      
      if (p == 0 && (p+10-q == ABCD[k][2] || p-q == ABCD[k][2]) {
        ans += ABCD[k][3];
      }
          
      if (p-q >= 0 && p-q == ABCD[k][2]) {
        ans += ABCD[k][3];
      }
    }
    
    if (ans > max_ans) {
      max_ans = ans;
      b = i_st;
    }
  }
  
  cout << max_ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:64: error: expected ')' before '{' token
   49 |       if (p == 0 && (p+10-q == ABCD[k][2] || p-q == ABCD[k][2]) {
      |          ~                                                     ^~
      |                                                                )
a.cc:56:5: error: expected primary-expression before '}' token
   56 |     }
      |     ^
Language: C++

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

typedef struct{
    int d;
    int i;
}ddd;
void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}



int main(){
    int n,m,q;
    int maax=0;
    int temp;

    cin>>n>>m>>q;
    vector<int> ans(10,1);
    vector<int> a(n),b(n),c(n);
    vector<int> d(n);

    for(int i=0;i<q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
  int sum=0;

    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 1; bit <= (1<<n); ++bit) {
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                S.push_back(i);
            }
        }
      for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
          if(s[a[i]]-s[a[j]]==c[i]){
            temp+=d[i];
          }
        }
      }
      if(maax<temp){
        maax=temp;
      }

        /*cout << bit << ": {";
        for (int i = 0; i < (int)S.size(); ++i) {
            cout << S[i] << " ";
        }
        cout << "}" << endl;*/
    }
  cout<<maax<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:14: error: 's' was not declared in this scope
   52 |           if(s[a[i]]-s[a[j]]==c[i]){
      |              ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

bool comp(int a[], int b[]) {
  if(a[3] > b[3]) {
    return true;
  } else {
    return false;
  }
}

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}


int main(void) {
  int n,m,q;cin>>n>>m>>q;
  vector<int> M[10];

  int A,B,C,D;
  rep(i,0,q-1) {
    cin>>A>>B>>C>>D;

    vector<int> v;
    v.push_back(A);
    v.push_back(B);
    v.push_back(C);
    v.push_back(D);
    M[i] = v;
  }

  // pr(combi(19,10));


  vector<vector<int>> T;

  foreach_comb(m+n-1, n, [](int *indexes) {
    vector<int> v;
    rep(i,0,n-1) {
      v.push_back(indexes[i]+1);
    }
    T.push_back(v);
  });

  ll ans=0;

  for(auto t:T) {
    ll tmp=0;
    rep(i,0,q-1) {
      int a,b,c,d; a = M[i][0]; b = M[i][1]; c = M[i][2]; d = M[i][3];
      a--;
      b--;
      if(t[b]-t[a]==c) {
        ans+=d;
      }
      // pr(a,b,c,d);
    }
    ans=max(tmp,ans);
  }

  pr(ans);

  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:71:13: error: 'n' is not captured
   71 |     rep(i,0,n-1) {
      |             ^
a.cc:2:44: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
      |                                            ^
a.cc:69:27: note: the lambda has no capture-default
   69 |   foreach_comb(m+n-1, n, [](int *indexes) {
      |                           ^
a.cc:49:7: note: 'int n' declared here
   49 |   int n,m,q;cin>>n>>m>>q;
      |       ^
a.cc:74:5: error: 'T' is not captured
   74 |     T.push_back(v);
      |     ^
a.cc:69:27: note: the lambda has no capture-default
   69 |   foreach_comb(m+n-1, n, [](int *indexes) {
      |                           ^
a.cc:67:23: note: 'std::vector<std::vector<int> > T' declared here
   67 |   vector<vector<int>> T;
      |                       ^
Language: C++

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

int main() {
  int N,M,Q;
  cin>>N>>M>>Q;
  int ans=0;
  cin>>ans;
  vector<vector<int>> data(Q, vector<int>(4));
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> data.at(i).at(j);
    }
}

 
    
  for(int tmp=0; tmp<pow(2,N);tmp++){
    vector<int> vec(N,1);
      bitset s<tmp>;
      for(int i=0; i<N;i++){
        if(s[i]==1){
          for(int j=i;j<N;j++){
            vec[j]++;
          }
        }
      }
    for(int k=0;k<Q;k++){
      if(vec[data[k][1]]-vec[data[k][0]==data[k][3])[
        ans+=data[k][4]
  }
           
  ]  
    cout<<ans<<endl;
 


}
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: expected initializer before '<' token
   20 |       bitset s<tmp>;
      |               ^
a.cc:22:12: error: 's' was not declared in this scope
   22 |         if(s[i]==1){
      |            ^
a.cc:29:52: error: expected ']' before ')' token
   29 |       if(vec[data[k][1]]-vec[data[k][0]==data[k][3])[
      |                                                    ^
      |                                                    ]
a.cc:30:12: error: expected ',' before '+=' token
   30 |         ans+=data[k][4]
      |            ^~
      |            ,
a.cc:30:12: error: expected identifier before '+=' token
   30 |         ans+=data[k][4]
      |            ^~
a.cc:30:24: error: expected ']' before '}' token
   30 |         ans+=data[k][4]
      |                        ^
      |                        ]
   31 |   }
      |   ~                     
a.cc: In lambda function:
a.cc:31:3: error: expected '{' before '}' token
   31 |   }
      |   ^
a.cc: In function 'int main()':
a.cc:30:24: error: expected ';' before '}' token
   30 |         ans+=data[k][4]
      |                        ^
      |                        ;
   31 |   }
      |   ~                     
a.cc:33:3: error: expected primary-expression before ']' token
   33 |   ]
      |   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m,q,ans,an;
  cin>>n>>m>>q;
  int a,b,c,d;
  an=0;
  for(int i=0;i<q;i++){
    cin>>a>>b>>c>>d;
  
  ans=0;

  vector<int> vec(10);
  for(int i1=1;i1<=m;i1++){
    vec.at(0)=i1;
    for(int i2=i1;i2<=m;i2++){
      vec.at(1)=i2;
      for(int i3=i2;i3<=m;i3++){
      vec.at(2)=i3;
        for(int i4=i3;i4<=m;i4++){
      vec.at(3)=i4;
          for(int i5=i4;i5<=m;i5++){
      vec.at(4)=i5;
            for(int i6=i5;i6<=m;i6++){
      vec.at(5)=i6;
              for(int i7=i6;i7<=m;i7++){
      vec.at(6)=i7;
                for(int i8=i7;i8<=m;i8++){
      vec.at(7)=i8;
                  for(int i9=i8;i9<=m;i9++){
      vec.at(8)=i9;
                    for(int i10=i9;i10<=m;i10++){
      vec.at(9)=i10;
                      
                      
                        
                        if((vec.at(b-1))-(vec.at(a-1))==c){
                          an=an+d;
                         // if (an>ans){
                        //ans=an;
                      //}
                        }
                      }
                      //cout<<d<<an<<endl;
                      if (an>ans){
                        ans=an;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc:60:3: error: 'cout' does not name a type
   60 |   cout<<ans<<endl;
      |   ^~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
Language: C++

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

void input(vector<vector<int>>& abcd, vector<int>& a, int add, int depth, int min, int n, int m, int q, int* ans) {
  if(depth==n) {
    a.push_back(add);
    int sum = 0;
    for(int i=0; i<q; i++) {
      if(a[abcd[i][1]-1] - a[abcd[i][0]] == abcd[i][2]) sum += abcd[i][3];
    }
    if( sum > (*ans) )  (*ans) = sum;
  }

  else {
    for(int i=min; i<=m; i++) {
      a.push_back(add);
      input(a, i, depth+1, i, n, m);
    }
  }
}

int main() {
  int n,m,q;
  cin>>n>>m>>q;
  // int abcd[q][4];
  vector<vector<int>> abcd;
  for(int i=0; i<q; i++) {
    for(int j=0; j<4; j++) {
      int k;
      cin>>k;
      abcd[i].push_back(k);
    }
  }

  // int board[n][n];
  // for(int i=0; i<n; i++) {
  //   for(int j=0; j<n; j++) {
  //     board[i][j] = 0;
  //   }
  // }

  

  int ans = 0;

  vector<int> a;
  input(abcd, a, 1, 1, 1, n, m, q, &ans);

  cout<<ans<<endl;







  return 0;
}

Compiler output:
a.cc: In function 'void input(std::vector<std::vector<int> >&, std::vector<int>&, int, int, int, int, int, int, int*)':
a.cc:17:13: error: invalid initialization of reference of type 'std::vector<std::vector<int> >&' from expression of type 'std::vector<int>'
   17 |       input(a, i, depth+1, i, n, m);
      |             ^
a.cc:4:33: note: in passing argument 1 of 'void input(std::vector<std::vector<int> >&, std::vector<int>&, int, int, int, int, int, int, int*)'
    4 | void input(vector<vector<int>>& abcd, vector<int>& a, int add, int depth, int min, int n, int m, int q, int* ans) {
      |            ~~~~~~~~~~~~~~~~~~~~~^~~~