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

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>
#define PI acos(-1)
typedef long long ll;
const long long mod = 1000000007;
const long long maxn = 1e6 + 5; 
using namespace std;

int n, m, q;
int a[55], b[55], c[55], d[55], A[55];
int st = 55, ed = 0;
int sum = 0;
void dfs(int step)
{
	int i, j;
	if (step == ed + 1)
	{
		int idex = 0; 
		for (j = 1; j <= q; j++)
		{
			if (A[b[j]] - A[a[j]] == c[j])
				idex += d[j];	
		}
		sum = max(idex, sum);
		return;	
	}
	for (int i = A[step - 1]; i <= m; i++)
	{
		A[step] = i;
		dfs(step + 1);
	}
}
int main()
{
	int i;
	scanf("%d %d %d", &n, &m, &q);
	for (int i = 1; i <= q; i++)
	{
		scanf("%d %d %d %d",&a[i], &b[i], &c[i], &d[i]);
		st = min(st, a[i]);
		ed = max(ed, b[i]);
	}
	ed = ed - st + 1;
	st = 1;
	p[0] = 1;
	dfs(1);
	printf("%d\n",sum);
	
	return 0;
}

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

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>
#define PI acos(-1)
typedef long long ll;
const long long mod = 1000000007;
const long long maxn = 1e6 + 5; 
using namespace std;

int n, m, q;
int a[55], b[55], c[55], d[55], A[55];
int st = 55, ed = 0;
int sum = 0;
void dfs(int step)
{
	int i, j;
	if (step == ed + 1)
	{
		int idex = 0; 
		for (j = 1; j <= q; j++)
		{
			if (A[b[j]] - A[a[j]] == c[j])
				idex += d[j];	
		}
		sum = max(idex, sum);
		return;	
	}
	for (int i = A[step - 1]; i <= m; i++)
	{
		A[step] = i;
		dfs(step + 1);
	}
}
int main()
{
	int i;
	scanf("%d %d %d", &n, &m, &q);
	for (int i = 1; i <= q; i++)
	{
		scanf("%d %d %d %d",&a[i], &b[i], &c[i], &d[i]);
		st = min(st, a[i]);
		ed = max(ed, b[i]);
	}
	ed = ed - st + 1, st = 1, p[0] = 1;
	dfs(1);
	printf("%d\n",sum);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:35: error: 'p' was not declared in this scope
   58 |         ed = ed - st + 1, st = 1, p[0] = 1;
      |                                   ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int N, M, Q, ans = 0;
vector<int> a(50), b(50), c(50), d(50), A(10);

void dfs(int dep) {
    if (dep == N {
        int score = 0;
        for (int i = 0; i < Q; i++) {
            if (A[b[i]]-A[a[i]] == c[i]) {
                score += d[i];
            }
        }
        ans = max(ans, score);
        return;
    }
    int s;
    if (dep == 0) s = 1;
    else s = A[dep-1];
    for (int i = s; i <= M; i++) {
        A[dep] = i;
        dfs(dep+1);
    }
}

int main() {
    cin >> N >> M >> Q;
    for (int i = 0; i < Q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(0);
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:19:17: error: expected ';' before '{' token
   19 |     if (dep == N {
      |                 ^~
      |                 ;
a.cc:29:10: error: expected initializer before ';' token
   29 |     int s;
      |          ^
a.cc:29:10: error: expected ')' before ';' token
   29 |     int s;
      |          ^
      |          )
a.cc:19:8: note: to match this '('
   19 |     if (dep == N {
      |        ^
a.cc:30:19: error: 's' was not declared in this scope
   30 |     if (dep == 0) s = 1;
      |                   ^
a.cc:31:10: error: 's' was not declared in this scope
   31 |     else s = A[dep-1];
      |          ^
a.cc:32:18: error: 's' was not declared in this scope
   32 |     for (int i = s; i <= M; i++) {
      |                  ^
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

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

void dfs(int s){
    if(A.size() == n){
        int res = 0;
        rep(i,q){
            if(A[b[i]]-A[a[i]] == c[i]) res += d[i];
        }
        ans = max(ans,res);
        return;
    }
    for(int i = s; i <= m; i++){
        A.push_back(i);
        dfs(i);
        A.pop_back();
    }
   
}

int main() {
    cin >> n >> m >> q;
    rep(i,q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }
    dfs(1);
    dunk(ans);
    
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:16:8: error: 'A' was not declared in this scope
   16 |     if(A.size() == n){
      |        ^
a.cc:25:9: error: 'A' was not declared in this scope
   25 |         A.push_back(i);
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,q,ans;
int main(){
    cin>>n>>m>>q;
    vector<int>a(q),b(q),c(q),d(q);
    for(int i=0;i<q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
		b[i]--;
    }
    vector<vector<int>>v[11];
    for(int i=1;i<=m;i++)
		v[1].push_back(i);
    for(int i=1;i<n;i++)
		for(auto&v:v[i]){
        	int b=v.back();
        	for(int a=b;a<=m;a++){
            	auto v2=v;
            	v2.push_back(a);
            	v[i+1].push_back(v2);
        	}
    	}
    for(auto&v:v[n]){
        int res=0;
        for(int i=0;i<q;i++)
			if(v[b[i]]-v[a[i]]==c[i])
				res+=d[i];
        ans=max(ans,res);
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   14 |                 v[1].push_back(i);
      |                 ~~~~~~~~~~~~~~^~~
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 = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<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 = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:21:24: error: request for member 'push_back' in '(& v)->std::vector<int>::operator[](((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   21 |                 v[i+1].push_back(v2);
      |                        ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
ios::sync_with_stdio(false);
cin.tie(nullptr);

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;
void dfs(vector<int> A){
    if(A.size() ==  n + 1) {
        int score = 0;
        rep(i,q){
            if (A[b[i]] - A[a[i]] == c[i]) score += d[i];
        }
        ans = max(ans, score);
        return;
    }
    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }
}
signed 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:6:1: error: specializing member 'std::basic_ios<char>::sync_with_stdio' requires 'template<>' syntax
    6 | ios::sync_with_stdio(false);
      | ^~~
a.cc:7:1: error: 'cin' does not name a type
    7 | cin.tie(nullptr);
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;
void dfs(vector<int> A){
    if(A.size() ==  n+1) {
        int score = 0;
        rep(i,q){
            if (A[b[i]] - A[a[i]]) score += d[i];
        }
        ans = max(ans, score);
        return;
    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    a = b = c = d = vector<int>(q);
    cin >> n >> m >> 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: In function 'void dfs(std::vector<long long int>)':
a.cc:24:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   24 | signed main(){
      |            ^~
a.cc:24:12: note: remove parentheses to default-initialize a variable
   24 | signed main(){
      |            ^~
      |            --
a.cc:24:12: note: or replace parentheses with braces to value-initialize a variable
a.cc:24:14: error: a function-definition is not allowed here before '{' token
   24 | signed main(){
      |              ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:10:24: note: to match this '{'
   10 | void dfs(vector<int> A){
      |                        ^
Language: C

#include <bits/stdc++.h>
using namespace std;
 int N,M,Q;
 
 vector<int> a(50),b(50),c(50),d(50);

   

     
int dfs(int n,vector<int> L);

      
   
int main()
{ int i,j;
  cin >> N >> M >> Q;
  for(i=0;i<Q;i++)
  {
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i) ;
    a.at(i)--;
    b.at(i)--;
    
  }
 vector<int> R={0,0,0,0,0,0,0,0,0,0};
 cout << dfs(0,R) << endl;
}
 

   
int dfs(int n,vector<int> L)
{ 
  int ma,poin;
  int i,j,k;
 
  
   if(n==N)  
   {
     poin=0;
     for(i=0;i<Q;i++)
     {
       if(L.at(b.at(i))-L.at(a.at(i))==c.at(i))
       {
         poin+=d.at(i);
       }
     }
   return poin;
   }

  
   if(n!=N)
   {
     ma=0;
     if(n==0)
     {
     k=1;
     }
     else
     {
     k=L.at(n-1);
     }
       for(i=k;i<M+1;i++)
     {
      L.at(n)=i;
       ma=max(ma,dfs(n+1,L));
     }
     return ma;
   }
}


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<bits/stdc++.h>
using namespace std;
 int N,M,Q;
 
 vector<int> a(50),b(50),c(50),d(50);

   

     
int dfs(int n,vector<int> L);

      
   
int main()
{ int i,j;
  cin >> N >> M >> Q;
  for(i=0;i<Q;i++)
  {
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i) ;
    a.at(i)--;
    b.at(i)--;
    
  }
 vector<int> R={0,0,0,0,0,0,0,0,0,0};
 cout << dfs(0,R) << endl;
}
 

   
int dfs(int n,vector<int> L)
{ 
  int ma,poin;
  int i,j,k;
 
  
   if(n==N)  
   {
     poin=0;
     for(i=0;i<Q;i++)
     {
       if(L.at(b.at(i))-L.at(a.at(i))==c.at(i))
       {
         poin+=d.at(i);
       }
     }
   return poin;
   }

  
   if(n!=N)
   {
     ma=0;
     if(n==0)
     {
     k=1;
     }
     else
     {
     k=L.at(n-1);
     }
       for(i=k;i<M+1;i++)
     {
      L.at(n)=i;
       ma=max(ma,dfs(n+1,L));
     }
     return ma;
   }
}

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

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

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() <= n) {
        dfs(A);
        A.back()++;
    }
}

int main() {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q) {
        int a, b, c, d;
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    //要素1つ初期値１の配列を入れ、dfs()内で要素を追加していく
    dfs(vector<int>(1,1));
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: invalid types 'int[int]' for array subscript
   35 |         cin >> a[i] >> b[i] >> c[i] >> d[i];
      |                 ^
a.cc:35:25: error: invalid types 'int[int]' for array subscript
   35 |         cin >> a[i] >> b[i] >> c[i] >> d[i];
      |                         ^
a.cc:35:33: error: invalid types 'int[int]' for array subscript
   35 |         cin >> a[i] >> b[i] >> c[i] >> d[i];
      |                                 ^
a.cc:35:41: error: invalid types 'int[int]' for array subscript
   35 |         cin >> a[i] >> b[i] >> c[i] >> d[i];
      |                                         ^
Language: C

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

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) now += d[i];
        }
        ans = max(ans, now);
        return;
    }
    
    //再帰ステップ
    //直前の要素の数を追加する
    A.push_back(A.back());
    while(A.back() <= n) {
        dfs(A);
        A.back()++;
    }
}

int main() {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q) {
        int a, b, c, d;
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    //要素1つ初期値１の配列を入れ、dfs()内で要素を追加していく
    dfs(vector<int>(1,1));
    cout << ans << endl;
    return 0;
}

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


import java.util.*;
public class Main2 {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();//Aの長さ
		int m=sc.nextInt();//Aの最大値
		int q=sc.nextInt();//abcdの長さ
		
		int[]a=new int[q];
		int[]b=new int[q];
		int[]c=new int[q];
		int[]d=new int[q];
		
		for(int i=0;i<q;i++){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
			c[i]=sc.nextInt();
			d[i]=sc.nextInt();
		}
		
		int[]k=new int[n];
		
		if(q==1)System.out.println(d[0]);
		else System.out.println(dfs(k, 0, a,b,c,d,0,m));
		
	}
	
	static int dfs(int[] k, int index, int[] a,int[] b,int[]c, int[]d, int max, int m){
		if(index==k.length){
			int tmp=0;
			for(int i=0;i<a.length;i++){
				if(k[b[i]-1]-k[a[i]-1]==c[i])tmp+=d[i];
			}
			
			if(tmp>max)max=tmp;
			
			//for(int i=0;i<k.length;i++)System.out.print(k[i]);
			//System.out.println(max);
			return max;
		}
		
		for(int i=index;i<k.length;i++){
			for(int j=1;j<=m;j++){
				//System.out.print(index);
				k[index]=j;
				max=Math.max(dfs(k, index+1, a,b,c,d,max, m),max);
				
			}
		}
		return max;
		
		
	}
	
}


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

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

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

ll score(vector<int> &A){
  ll sc = 0;
  rep(i,q){
    if(A[b[i] - A[a[i]]] == c[i]) score += d[i];
  }
  return sc;
}

ll recur(vector<int> &A) {
  if(A.size() == n) return score(A);
  ll ans = 0;
  int last = (A.empty()? 0:A.back());
  for (int i = last; i < m;i++){
    A.push_back(i);
    ans = max(ans, recur(A));
    A.pop_back();
  }
}


int main() {
  cin >> n >> m >> q;
  a.resize(q);
  b.resize(q);
  c.resize(q);
  d.resize(q);
  rep(i, q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--, b[i]--;
  }
  vector<int> e;
  cout << recur(e) << endl;
}

Compiler output:
a.cc: In function 'll score(std::vector<int>&)':
a.cc:14:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |     if(A[b[i] - A[a[i]]] == c[i]) score += d[i];
a.cc:14:41: error: assignment of read-only location 'score'
a.cc: In function 'll recur(std::vector<int>&)':
a.cc:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
Language: C++

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

int N, M, Q, ans;
vector<int> a(50);
vector<int> b(50);
vector<int> c(50);
vector<int> d(50);

void dfs(vector<int> A){
	if(A.size() == N){
		int now = 0;
		rep(i,Q){
			if(A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)){
				now += d.at(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;
	for(int i = 0; i < Q; i++){
		cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i); 
	}
	dfs(vector<int>(1,1));
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:25:28: error: 'm' was not declared in this scope
   25 |         while (A.back() <= m){
      |                            ^
Language: C

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


int N, M, Q;


vector<vector<int>> hozo;

void dfs(vector<int> A, int last) {
    int sz;
    sz = A.size();
    if (sz == N) {
        hozo.push_back(A);
        return;
    }

    for (int i = last; i <= M; i++) {

        vector<int> tmp;
        tmp = A;
        tmp.push_back(i);
        dfs(tmp,i);
    }
}


int main(){
 
    cin >> N >> M >> Q;
    vector<int> a(Q), b(Q), c(Q), d(Q);
    for(int i = 0; i < Q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--;
    b[i]--;
    
    }
    
    vector<int> empty;

    long long ans;

    dfs(empty, 1);

    for (vector<int> A : hozo){
        long long score = 0;
        for (int i = 0; i < Q; i++){

            if (A[b[i]] - A[a[i]] == c[i]){
                score += d[i];
            }
        }

        

        ans = max(ans,score);
    }
    
    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 <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;

int N,M,Q;
vector<int> a, b, c, d;
ll ans = 0;

void dfs(vector<int> A){
    if (A.size() == N){
             
        ll tmp = 0;
        rep(i,Q){
            if (A[b[i]] - A[a[i]] == c[i]){
                tmp += d[i];
            }
        }
        ans = max(ans, tmp);
        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];
       a[i]--;
       b[i]--;
    }

    for (int i = 1; i <= M; i++){
        dfs(vector<int>(1, i));
    }
    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 <bits/stdc++.h>
using namespace std;

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

void dfs(int dep, int curr){
  if(dep==n-1){
    int tmp=0;
    for(int i=0;i<q;i++){
      if( e.at(b.at(i)-1) -e.at(a.at(i)-1) == c.at(i) )
        tmp +=d.at(i);
    }
    ans =max(ans,tmp);
  }
  for(int i=curr;i<=M;i++){
    e.at(dep) =i;
    def(dep+1, i);
  }
}

int main(){
  cin >> n >> m >> q;
  for(int i=0;i<q; i++){
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
  }
  
  dfs(0,1);
  cout <<ans << endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:17:21: error: 'M' was not declared in this scope
   17 |   for(int i=curr;i<=M;i++){
      |                     ^
a.cc:19:5: error: 'def' was not declared in this scope; did you mean 'dep'?
   19 |     def(dep+1, i);
      |     ^~~
      |     dep
Language: C

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

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

void dfs(int dep, int curr){
  if(dep==n-1){
    int tmp=0;
    for(int i=0;i<q;i++){
      if( e.at(b.at(i)-1) -e.at(a.at(i)-1) == c.at(i) )
        tmp +=d.at(i);
    }
    ans =max(ans,tmp);
  }
  for(int i=curr;i<=M;i++){
    e.at(dep) =i;
    def(dep+1, i);
  }
}

int main(){
  cin >> n >> m >> q;
  for(int i=0;i<q; i++){
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
  }
  
  dfs(0,1);
  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 <bits/stdc++.h>
using namespace std;


int N, M, Q;


vector<vector<int>> hozo;

void dfs(vector<int> A, int last) {
    int sz;
    sz = A.size();
    if (sz == N) {
        hozo.push_back(A);
        return;
    }

    for (int i = last; i <= M; i++) {

        vector<int> tmp;
        tmp = A;
        tmp.push_back(i);
        dfs(tmp,i);
    }
}


int main(){
 
    cin >> N >> M >> Q;
    vector<int> a(N), b(N), c(N), d(N);
    for(int i = 0; i < Q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--;
    b[i]--;
    
    }
    int score;
    vector<int> empty;

    dfs(empty, 1);

    for (vector<int> A : hozo){
        long long score = 0;
        for (int i = 0; i < Q; i++){

            if (A[b[i]] - A[a[i]] == c[i]){
                score += d[i];
            }
        }
        int ans;

        ans = max(ans,score);
    }
    
    cout >> score >> 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<bits/stdc++.h>
using namespace std;
int n,m,q,ans;
int main()
{
	cin>>n>>m>>q;
	vector<int> a(q),b(q),c(q),d(q);
	for(int i=0;i<q;++i)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		--a[i],--b[i];
	}
	vector<vector<int> > V[11];
	for(int i=1;i<=m;++i) V[1].push_back({i});
	for(int i=1;i<n;++i)
	 for(auto&v : V[i])
	 {
	 	int k=v.back();
	 	for(int j=k;j<=m;++j)
	 	{
	 		auto v2=v;
	 		v2.push_back(j);
	 		v[i+1].push_back(v2);
		}
	 }
	for(auto&v : V[n])
	{
		int s=0;
		for(int i=0;i<q;++i)
		 if(v[b[i]]-v[a[i]]==c[i])
		  s+=d[i];
		ans=max(ans,s);
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: request for member 'push_back' in '(& v)->std::vector<int>::operator[](((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   23 |                         v[i+1].push_back(v2);
      |                                ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,q,ans;
int main()
{
	cin>>n>>m>>q;
	vector<int> a(q),b(q),c(q),d(q);
	for(int i=0;i<q;++i)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		--a[i],--b[i];
	}
	vector<vector<int> > V[11];
	for(int i=1;i<=m;++i) V[1].push_back({i});
	for(int i=1;i<n;++i)
	 for(auto &v : V[i])
	 {
	 	int k=v.back();
	 	for(int j=k;j<=m;++j)
	 	{
	 		auto v2=v;
	 		v2.push_back(j);
	 		v[i+1].push_back(v2);
		}
	 }
	for(auto &v : V[n])
	{
		int s=0;
		for(int i=0;i<q;++i)
		 if(v[b[i]]-v[a[i]]==c[i])
		  s+=d[i];
		ans=max(ans,s);
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: request for member 'push_back' in '(& v)->std::vector<int>::operator[](((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   23 |                         v[i+1].push_back(v2);
      |                                ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,q,ans;
int main()
{
	cin>>n>>m>>q;
	vector<int> a(q),b(q),c(q),d(q);
	for(int i=0;i<q;++i)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		--a[i],--b[i];
	}
	vector<vector<int> > V[11];
	for(int i=1;i<=m;++i) V[1].push_back({i});
	for(int i=1;i<n;++i)z
	 for(auto &v : V[i])
	 {
	 	int k=v.back();
	 	for(int j=k;j<=m;++j)
	 	{
	 		auto v2=v;
	 		v2.push_back(j);
	 		v[i+1].push_back(v2);
		}
	 }
	for(auto &v : V[n])
	{
		int s=0;
		for(int i=0;i<q;++i)
		 if(v[b[i]]-v[a[i]]==c[i])
		  s+=d[i];
		ans=max(ans,s);
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: 'z' was not declared in this scope
   15 |         for(int i=1;i<n;++i)z
      |                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,q,ans;
int main()
{
	cin>>n>>m>>q;
	vector<int> a(q),b(q),c(q),d(q);
	for(int i=0;i<q;++i)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		--a[i],--b[i];
	}
	vector<vector<int> > V[11];
	for(int i=0;i<n;++i)
	 for(auto &v : V[i])
	 {
	 	int k=v.back();
	 	for(int j=k;j<=m;++j)
	 	{
	 		auto v2=v;
	 		v2.push_back(j);
	 		v[i+1].push_back(v2);
		}
	 }
	for(auto &v : V[n])
	{
		int s=0;
		for(int i=0;i<q;++i)
		 if(v[b[i]]-v[a[i]]==c[i])
		  s+=d[i];
		ans=max(ans,s);
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:32: error: request for member 'push_back' in '(& v)->std::vector<int>::operator[](((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   22 |                         v[i+1].push_back(v2);
      |                                ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define pb push_back
typedef pair<ll,ll> pp;

ll mod = 1e9+7;
ll INF = 1e15;

ll powm(ll a , ll b , ll mod)
{
  ll res = 1;
  while(b)
  {
    if(b & 1)
    res = (res *a)%mod;
    a = (a*a)%mod;
    b>>1;
  }
  return res;
}
ll gcd(ll a , ll b);
ll power(ll x , ll y , ll m);

ll modInverse(ll a , ll m)
{
  ll g = gcd(a,m);
  if(g != 1)
  return 1;
  else
  return power(a,m-2,m);

}

ll power(ll x , ll y , ll m)
{
  if(y == 0)
  return 1;
  ll p = power(x , y/2 , m)%m;
  p = (p*p)%m;

  return (y%2 == 0) ? p : (x *p) % m;
}

ll gcd(ll a , ll b)
{
  if(a == 0)
  return b;
  return gcd(b%a , a);
}





void solve()
{
  ll n,m,,q;
  cin>>n>>m>>>q;
  ll sum = 0;
  while(q--)
  {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if((b-a) == c)
    sum += d;
  }
  cout<<Sum<<"\n";


}



int main()
{
  int tc;
  // cin>>tc;
  tc = 1;
  while(tc--)
  {
    solve();
  }
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:60:10: error: expected unqualified-id before ',' token
   60 |   ll n,m,,q;
      |          ^
a.cc:61:14: error: expected primary-expression before '>' token
   61 |   cin>>n>>m>>>q;
      |              ^
a.cc:70:9: error: 'Sum' was not declared in this scope; did you mean 'sum'?
   70 |   cout<<Sum<<"\n";
      |         ^~~
      |         sum
Language: C++

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

int main(void){
    int n,m,q;
    cin >> n >> m >> q;
    int A[q],B[q],C[q],D[q];
    
    for(int i = 0;i < q;i++)cin >> A[i] >> B[i] >> C[i] >> D[i];
    
    long long ans = 0;
    int num[11] = {};
    for(int a = 1;a <= m;a++){
        num[1] = a; 
        for(int b = a;b <= m;b++){
            num[2] = b;
            for(int c = b;c <= m;c++){
                num[3] = c;
                for(int d = c;d <= m;d++){
                    num[4] = d;
                    for(int e = d;e <= m;d++){
                        num[5] = e;
                        for(int f = e;f <= m;f++){
                            num[6] = f; 
                            for(int g = f;g <= m;g++){
                                num[7] = g;
                                for(int h = g;h <= m;h++){
                                    num[8] = h;
                                    for(int i = h;i <= m;i++){
                                        num[9] = i;
                                        for(int j = i;j <= m;j++){
                                            num[10] = j;
                                            
                                            long long sum = 0;
                                            for(int k = 0;k < q;k++){
                                                if(num[b[k]]-num[a[k]] == c[k])sum += d[k];
                                            }
                                            ans = max(sum,ans);
                                            
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    cout << ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:57: error: invalid types 'int[int]' for array subscript
   37 |                                                 if(num[b[k]]-num[a[k]] == c[k])sum += d[k];
      |                                                         ^
a.cc:37:67: error: invalid types 'int[int]' for array subscript
   37 |                                                 if(num[b[k]]-num[a[k]] == c[k])sum += d[k];
      |                                                                   ^
a.cc:37:76: error: invalid types 'int[int]' for array subscript
   37 |                                                 if(num[b[k]]-num[a[k]] == c[k])sum += d[k];
      |                                                                            ^
a.cc:37:88: error: invalid types 'int[int]' for array subscript
   37 |                                                 if(num[b[k]]-num[a[k]] == c[k])sum += d[k];
      |                                                                                        ^
Language: C++

#include <bits/stdc++.h>
#define maxn 300005
#define maxa 2000005
#define MOD    100000000  //1000000007 //998244353
#define INF 1000000000000000000
#define ll unsigned long long

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << " "; cout << endl;}


void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

vector<ll> no;
ll n, m, q, ans = 0;
ll qq[55][4];

void solve2(ll p){  //cout << p << " ";
    if(p == n){
        ll tmp = 0;
        rep(i, q)
        {
            ll a = qq[i][0]-1, b = qq[i][1]-1, c = qq[i][2], d = qq[i][3];
            if(no[b]-no[a] == c) tmp += d;
        }
        ans = max(ans, tmp);
        return;
    }

    ll l = 0;
    if(p!=0) l = no[p-1];
    for(ll i = l; i <= m; i++){
        no.pb(i);
        solve2(p+1);
        no.erase(no.end()-1);
    }

}
void solve(){
    cin >> n >> m >> q;
    rep(i, q)
    cin >> qq[i][0] >> qq[i][1] >> qq[i][2] >> qq[i][3];
    solve2(0);
    cout << ans;

}

void main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


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

#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (ll i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

void dfs(vector<int> A) {
  if (A.size() == n+1)
  {
    /* code */
    return;
  }

  A.push_back(A.back());
  while (A.back() <= m)
  {
    /* code */
    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: In function 'void dfs(std::vector<int>)':
a.cc:36:7: error: no post-increment operator for type
   36 |     A.back++;
      |     ~~^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEFINE
#include "../../DEBUG.hpp"
#endif
vector<vector<int>> Q;
vector<int> seq;
int n, m, q;
int ans;
// this function recursively builds the sequence of length n
// i means we are at the ith position in the sequence and num
// means that element at position i >= num (remember that the sequence has to be
// non decreasing.
void solve(int i, int num) {
  if (i == n) {
  // this means we have already made a sequence of length n
  // which is currently stored in seq
  // now just use brute force to check how many conditions of Q are satisfied and
  // accordingly update ans.
    int temp = 0;
    for (int j = 0; j < q; j++) {
      if (seq[Q[j][1] - 1] - seq[Q[j][0] - 1] == Q[j][2]) {
        temp += Q[j][3];
      }
    }
    ans = max(temp, ans);
    return;
  }
  // else we have not yet completed the sequence making process.
  // we can place all, numbers from num to m at the position i.
  for (int j = num; j <= m; j++) {
    seq.push_back(j);
    // every time, we place a number at the ith position we, try
    // building the rest, of the sequence, update the answer, remove the 
    // last inserted element and go for the next j.
    solve(i + 1, j);
    seq.pop_back();
  }
}

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ans = 0;
  cin >> n >> m >> q;
  Q.resize(q, vector<int>(4));
  for (int i = 0; i < q; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> Q[i][j];
    }
  }
  solve(0, 1);
  cout << ans << '\n';
  return 0;
}

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

#include <iostream>
#include <vector>
#include <functional>


using namespace std;
int a[51][4];

int main(){
    int N, M, Q;
    int a[55], b[55], c[55], d[55];
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));

    cin >> N >> M >> Q;
    for(int i=0; i<Q; ++i){
        cin >> a[i];
        cin >> b[i];
        cin >> c[i];
        cin >> d[i];
        a[i]--;
        b[i]--;
    }

    vector<int> A;
    for(int i=0; i<M-1; ++i) A.push_back(0);
    for(int i=0; i<N; ++i) A.push_back(1);


    int point = 0;
    do{
        int cnt =1;
        vector<int> retu;
        
        // convert A into the retu
        for(int i=0; i<A.size(); ++i){
            if(A[i] == 1){
                if(cnt == 0) cnt++;
                retu.push_back(cnt);
            }else{
                cnt++;
            }
        }
        
        int tmp_point =0;
        //apply the pint of the retu
        for(int i=0; i<Q; ++i){
            if(retu[b[i]] - retu[a[i]] == c[i]){
                tmp_point += d[i];
            } 
        }

        point = max(point, tmp_point);

        for(auto a: retu){
            std::cout << a << ", ";
        }
        cout << tmp_point << endl; 

    }while(next_permutation(A.begin(), A.end()));

    cout << point << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
   12 |     memset(a, 0, sizeof(a));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <functional>
  +++ |+#include <cstring>
    4 | 
a.cc:62:12: error: 'next_permutation' was not declared in this scope
   62 |     }while(next_permutation(A.begin(), A.end()));
      |            ^~~~~~~~~~~~~~~~
Language: C++

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

using namespace std;
int N, M, Q, maxScore = INT_MIN;
vector<int> a, b, c, d;

void dfs(vector<int> &A)
{
	if((int)A.size()==N+1)
	{
		int currScore = 0;
		for(int i=0; i<Q;i++)
		{
			if(A[b[i]]-A[a[i]]==c[i])
			{
				currScore+=d[i];
			}
		}
		maxScore = max(maxScore, currScore);
		return;
	}
	int prev = A.back();
	for(int newElem = prev; newElem<=M;newElem++)
	{
		A.push_back(newElem);
		dfs(A);
		A.pop_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];
	}
	vector<int> v(1,1);
	dfs(v);
	cout<<maxScore<<"\n";
	return 0;
}

Compiler output:
a.cc:6:25: error: 'INT_MIN' was not declared in this scope
    6 | int N, M, Q, maxScore = INT_MIN;
      |                         ^~~~~~~
a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<vector>
  +++ |+#include <climits>
    4 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)

int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
int n, m, q;
int a[55], b[55], c[55], d[55];
int dfs(int rest, vector<int> v, int biggest = 0) {
  if(biggest) {
    v.PB(biggest);
  } else {
    biggest = 1;
  }
  if(rest == 0) {
    int ret = 0;
    REP(i, q) {
      if(v[b[i]] - v[a[i]] == c[i]) {
        ret += d[i];
      }
    }
    return ret;
  }

  int ans = 0;
  REPS(i, biggest, m+1) ans = max(ans, dfs(rest-1, v, i));
  return ans;
}
/***** MAIN *****/
signed main() {
  cin >> n >> m >> q;
  REP(i,q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    --a[i]; --b[i];
  }
  cout << dfs(n, vector<int>());
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Compiler output:
a.cc: In function 'long long int dfs(long long int, std::vector<long long int>, long long int)':
a.cc:14:7: error: 'class std::vector<long long int>' has no member named 'PB'
   14 |     v.PB(biggest);
      |       ^~
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
// #define fore(i,a) for(auto &i:a)
// #define all(x) (x).begin(),(x).end()
// #pragma GCC optimize ("-O3")
// using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
// typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
// 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; }

using namespace std;

template <typename Tlist, typename Tfunc>
void __combination(
  Tlist const& list, typename Tlist::size_type const n, Tfunc const& func,
  Tlist& tmp, typename Tlist::size_type const i, typename Tlist::size_type const j)
{
  if (i == n){
    func(tmp);
    return;
  }

  for (typename Tlist::size_type k = j; k < list.size(); ++k){
    tmp[i] = list[k];
    __combination(list, n, func, tmp, i + 1, k);
  }
}

template <typename Tlist, typename Tfunc>
void combination(
  Tlist const& list, typename Tlist::size_type const n, Tfunc const& func){
  Tlist tmp(n);
  __combination(list, n, func, tmp, 0, 0);
}

int main()
{
  int N,M,Q;
  cin>>N>>M>>Q;
  vector<vector<int>> x;
  x.resize(Q);
  rep(i,0,Q){
    x[i].resize(4);
    cin>>x[i][0]>>x[i][1]>>x[i][2]>>x[i][3];
  }
  
  vector<unsigned int>::size_type m = M, n = N;
  vector<unsigned int> list(m);
  for (unsigned int i = 0; i < m; ++i){
    list[i] = i + 1;
  }

  vector<vector<unsigned int>> Aall;
  vector<unsigned int> A;
  combination(
    list, n, [](std::vector<unsigned int> const& a) {
      for (auto i(a.begin()); i != a.end(); ++i){
        int c=(int)(*i);
        A.push_back(c);
      }
      Aall.push_back(A);
  });
  
  long int MAX=0;
  rep(i,0,Aall.size()){
    long int max=0;
    rep(j,0,Q){
      if(Aall[i][x[j][1]]-Aall[i][x[j][0]]==x[j][2]) max+=x[j][3];
    }
    if(MAX<max) MAX=max;
  }
  
  cout<<MAX<<endl;
}

Compiler output:
a.cc: In lambda function:
a.cc:60:9: error: 'A' is not captured
   60 |         A.push_back(c);
      |         ^
a.cc:57:15: note: the lambda has no capture-default
   57 |     list, n, [](std::vector<unsigned int> const& a) {
      |               ^
a.cc:55:24: note: 'std::vector<unsigned int> A' declared here
   55 |   vector<unsigned int> A;
      |                        ^
a.cc:62:7: error: 'Aall' is not captured
   62 |       Aall.push_back(A);
      |       ^~~~
a.cc:57:15: note: the lambda has no capture-default
   57 |     list, n, [](std::vector<unsigned int> const& a) {
      |               ^
a.cc:54:32: note: 'std::vector<std::vector<unsigned int> > Aall' declared here
   54 |   vector<vector<unsigned int>> Aall;
      |                                ^~~~
a.cc:62:22: error: 'A' is not captured
   62 |       Aall.push_back(A);
      |                      ^
a.cc:57:15: note: the lambda has no capture-default
   57 |     list, n, [](std::vector<unsigned int> const& a) {
      |               ^
a.cc:55:24: note: 'std::vector<unsigned int> A' declared here
   55 |   vector<unsigned int> A;
      |                        ^
Language: C

#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int m, n ,q;
int a[50], b[50], c[50], d[50];
int A[10];
int maxScore = -1;

void dfs(int dep, int x) {
    if (dep == n) {
        int score = 0;
        rep(i, q) if (A[b[i]] - A[a[i]] == c[i]) score += d[i];
        
        maxScore = max(maxScore, score);
        return;
    }
    
    for (int i = x; i <= n; i++) {
        A[dep] = i;
        dfs(dep+ 1, i);
    }
}

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

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

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

void dfs(vector<int>A){
    if(A.size() == n+1){//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;

}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ c.cpp
./a.out

サンプルのダウンロードは oj d URL
テストは oj t
コード変えたらコンパイルする
不正解ならWAが出る
*/

Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:23:18: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<='
   23 |     while(A.back <= m){
      |           ~~~~~~ ^~ ~
      |             |       |
      |             |       int
      |             <unresolved overloaded function type>
Language: C++

#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

void dfs(vector<int> A) {
    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:21:3: error: 'A' does not name a type
   21 |   A.push_back(A.back());
      |   ^
a.cc:22:3: error: expected unqualified-id before 'while'
   22 |   while (A.back() <= m) {
      |   ^~~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,q,ans;
int main(){
    cin>>n>>m>>q;
    vector<int>a(q),b(q),c(q),d(q);
    for(int i=0;i<q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
		b[i]--;
    }
    vector<vector<int>>v[11];
    for(int i=1;i<=m;i++)
		v[1].push_back(i);
    for(int i=1;i<n;i++)
		for(auto&v:v[i]){
        	int b=v.back();
        	for(int a=b;a<=m;a++){
            	auto v2=v;
            	v2.push_back(a);
            	v[i+1].push_back(v2);
        	}
    	}
    for(auto&v:v[n]){
        int res=0;
        for(int i=0;i<q;i++)
			if(v[b[i]]-v[a[i]]==c[i])
				res+=d[i];
        ans=max(ans,res);
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   14 |                 v[1].push_back(i);
      |                 ~~~~~~~~~~~~~~^~~
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 = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<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 = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:21:24: error: request for member 'push_back' in '(& v)->std::vector<int>::operator[](((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   21 |                 v[i+1].push_back(v2);
      |                        ^~~~~~~~~