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

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = 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;
}


Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:20:16: error: no matching function for call to 'std::vector<int>::push_back(<unresolved overloaded function type>)'
   20 |     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)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

#define _GLIBCXX_DEBUG
#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++){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    abcd[i][0] = a-1;
    abcd[i][1] = b-1;
    abcd[i][2] = c;
    abcd[i][3] = d;
  }
  //ここから
  for(int i = 0; i < Q; i++){
    cout << abcd[i][0] << abcd[i][1] << abcd[i][2] << abcd[i][3] << endl;
  //ここまでを消すとエラーが出ない
  priority_queue<int> sumlist;
  
  for(int tmp = 0; tmp < (1 << 10); tmp++){
    bitset<10> s(tmp);
    if(s.count() != N)
      continue;
    
    vector<int> A(0);
    for(int i = 0; i < M; i++){
      if(s.test(i))
        A.push_back(i);
    }
    
    if(A.size() != N)
      continue;
    
    int sum = 0;
    for(int i = 0; i < Q; i++){
      if(A[abcd[i][1]] - A[abcd[i][0]] == abcd[i][2])
        sum += abcd[i][3];
    }
    
    sumlist.push(sum);
    
  }
  
  cout << sumlist.top() << endl;
  
  return 0;
  
}

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

#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(ll n,ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// a^n mod を計算する
ll modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[101010];
int n, m, q;
vector<int>a(q), b(q), c(q), d(q);
int ans = 0;

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

//long longしか使わない
//素数は1より大きい
int main() {
	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 'int main()':
a.cc:104:30: error: expected ')' before ';' token
  104 |         dfs(vector<int>(1, 1);
      |            ~                 ^
      |                              )
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(ll n,ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// a^n mod を計算する
ll modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[101010];
int n, m, q;
vector<int>a(q), b(q), c(q), d(q);
int ans = 0;

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

//long longしか使わない
//素数は1より大きい
int main() {
	cin >> n >> m >> q;
	rep(i, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	vector<int>e(one, one);
	dfs(e);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:104:22: error: 'one' was not declared in this scope
  104 |         vector<int>e(one, one);
      |                      ^~~
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(ll n,ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// a^n mod を計算する
ll modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[101010];
ll n, m, q;
vector<ll>a(q), b(q), c(q), d(q);
ll ans = 0;

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

//long longしか使わない
//素数は1より大きい
int main() {
	ll n, m, q;
	cin >> n >> m >> q;
	rep(i, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs(vector<ll>(1, 1);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:105:29: error: expected ')' before ';' token
  105 |         dfs(vector<ll>(1, 1);
      |            ~                ^
      |                             )
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int n,m,q;
vector<int> a,b,c,d;
void dfs(vector<int> s){
  if(s.size()==N+1){
    int now=0;
    for(int i=0;i<q;i++) if(s[b[i]]-s[a[i]]==c[i]) now+=d[i];
    ans=max(ans,now);
    return;
  }
  s.push_back(s.back());
  whie(s.back()<=m){
    dfs(s);
    s.back()++;
  }
}

int main(){
  int ans=0;
  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:7:16: error: 'N' was not declared in this scope
    7 |   if(s.size()==N+1){
      |                ^
a.cc:10:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     ans=max(ans,now);
      |     ^~~
      |     abs
a.cc:14:3: error: 'whie' was not declared in this scope
   14 |   whie(s.back()<=m){
      |   ^~~~
Language: C++

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

int N, M, Q;
int sum;
vector<int> a, b, c, d;

void pei(vector<int> A){
  if(A.size == N){
    int sum2 = 0;
    for(int i = 0; i < Q; i++){
      if(A[b[i]] - A[a[i]] == c[i]){
        sum2 += d[i];
      }
    }
    sum = max(sum, sum2);
    return;
  }
  A.push_back(A.back());
  while(A.back() <= M){
    pei(A);
    A.back()++;
  }
}

int main(){
  int i;
  cin >> N >> M >> Q;
  vector<int> a(Q), b(Q), c(Q), d(Q);
  for(i = 0; i < Q; i++){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  sum = 0;
  pei(vector<int>(1,1));
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'void pei(std::vector<int>)':
a.cc:9:8: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
    9 |   if(A.size == N){
      |      ~~^~~~
      |            ()
Language: C++

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

int N, M, Q;
int sum;
vector<int> a, b, c, d;

void pei(vector<int> A){
  if(A.size(int) == N){
    int sum2 = 0;
    for(int i = 0; i < Q; i++){
      if(A[b[i]] - A[a[i]] == c[i]){
        sum2 += d[i];
      }
    }
    sum = max(sum, sum2);
    return;
  }
  A.push_back(A.back());
  while(A.back() <= M){
    pei(A);
    A.back()++;
  }
}

int main(){
  int i;
  cin >> N >> M >> Q;
  vector<int> a(Q), b(Q), c(Q), d(Q);
  for(i = 0; i < Q; i++){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  sum = 0;
  pei(vector<int>(1,1));
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'void pei(std::vector<int>)':
a.cc:9:13: error: expected primary-expression before 'int'
    9 |   if(A.size(int) == N){
      |             ^~~
Language: C++

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

int N, M, Q;
int sum;
vector<int> a, b, c, d;

void pei(vector<int> A){
  if(A.size() == N){
    int sum2 = 0;
    for(int i = 0; i < Q; i++){
      if(A[b[i]] - A[a[i]] == c[i]){
        sum2 += d;
      }
    }
    sum = max(sum, sum2);
    return;
  }
  A.push_back(A.back());
  while(A.back() <= M){
    pei(A);
    A.back++;
  }
}

int main(){
  int N, M, Q, i;
  vector<int> a(Q), b(Q), c(Q), d(Q);
  vector<int> A;
  cin >> N >> M >> Q;
  for(i = 0; i < Q; i++){
    cin >> a(i) >> b(i) >> c(i) >> d(i);
  }
  A[0] = 1;
  sum = 0;
  pei(A);
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'void pei(std::vector<int>)':
a.cc:13:14: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>')
   13 |         sum2 += d;
      |         ~~~~~^~~~
a.cc:22:7: error: no post-increment operator for type
   22 |     A.back++;
      |     ~~^~~~
a.cc: In function 'int main()':
a.cc:32:13: error: no match for call to '(std::vector<int>) (int&)'
   32 |     cin >> a(i) >> b(i) >> c(i) >> d(i);
      |            ~^~~
a.cc:32:21: error: no match for call to '(std::vector<int>) (int&)'
   32 |     cin >> a(i) >> b(i) >> c(i) >> d(i);
      |                    ~^~~
a.cc:32:29: error: no match for call to '(std::vector<int>) (int&)'
   32 |     cin >> a(i) >> b(i) >> c(i) >> d(i);
      |                            ~^~~
a.cc:32:37: error: no match for call to '(std::vector<int>) (int&)'
   32 |     cin >> a(i) >> b(i) >> c(i) >> d(i);
      |                                    ~^~~
Language: C++

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

int N, M, Q;
int sum;
vector<int> a, b, c, d;

void pei(vector<int> A){
  if(A.size() == n){
    int sum2 = 0;
    for(int i = 0; i < Q; i++){
      if(A[b[i]] - A[a[i]] == c[i]){
        sum2 += d;
      }
    }
    sum = max(sum, sum2);
    return;
  }
  A.push_back(A.back());
  while(A.back() <= M){
    pei(A);
    A.back++;
  }
}

int main(){
  int N, M Q, i;
  vector<int> a(Q), b(Q), c(Q), d(Q);
  vector<int> A;
  cin >> N >> M >> Q;
  for(i = 0; i < Q; i++){
    cin >> a(i) >> b(i) >> c(i) >> d(i);
  }
  A[0] = 1;
  sum = 0;
  pei(A);
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'void pei(std::vector<int>)':
a.cc:9:18: error: 'n' was not declared in this scope
    9 |   if(A.size() == n){
      |                  ^
a.cc:13:14: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>')
   13 |         sum2 += d;
      |         ~~~~~^~~~
a.cc:22:7: error: no post-increment operator for type
   22 |     A.back++;
      |     ~~^~~~
a.cc: In function 'int main()':
a.cc:27:12: error: expected initializer before 'Q'
   27 |   int N, M Q, i;
      |            ^
a.cc:31:7: error: 'i' was not declared in this scope
   31 |   for(i = 0; i < Q; i++){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int A[15],n,m,q,a[55],b[55],c[55],d[55];
int main()
{
cin>>n>>m>>q;
for(int i=1;i<=q;i++)
{
	cin>>a[i]>>b[i]>>c[i]>>d[i];
}
for(int i=1;i<=n;i++)
A[i]=1;
while(!A[0])
{
	int res=0;
	for(int i=1;i<=q;i++)
	{
		if(A[b[i]]-A[a[i]]==c[i]) res+=d[i];
	}
	ans=max(res,ans)
	for(int i=n;i>=0;i--)
	{
		if(A[i]<m)
		{
			A[i]++;
			for(int j=i+1;j<=n;j++)
			A[j]=A[i];
			break;
		}
	}
}
cout<<ans;
return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |         ans=max(res,ans)
      |         ^~~
      |         abs
a.cc:22:21: error: 'i' was not declared in this scope
   22 |         for(int i=n;i>=0;i--)
      |                     ^
a.cc:33:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 | cout<<ans;
      |       ^~~
      |       abs
Language: C++

#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

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

void search(int x,vector<int>A){
    if (x==N)
    {
        ll cost=0;
        for (int i = 0; i < Q; i++)
        {
            if (A[b[i]]-A[a[i]]==c[i])
            {
                cost+=d[i];
            }
        }
        ans = max(ans,cost);
        return; //関数が終了する
    }
    for (int i = A[x-1]; i <= M; i++)
    {
        A.push_back(i);
        search(x+1,A);
        A.pop_back(); //一番最後の数字を削除する,次のループに備える
    }
}



int main(){
    cin >> N >> M >> Q;
    for (int i = 0; i < Q; i++)
    {
         cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    for (int i = 1; i <= M; i++)
    {
        vector<int>A;
        A.push_back(i);
        search(1,A);
    }

    cout << ans << endl;
    
    


}

Compiler output:
a.cc: In function 'void search(int, std::vector<int>)':
a.cc:33:18: error: no matching function for call to 'max(int&, ll&)'
   33 |         ans = max(ans,cost);
      |               ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:33:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   33 |         ans = max(ans,cost);
      |               ~~~^~~~~~~~~~
/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,
                 from a.cc:5:
/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:33:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   33 |         ans = max(ans,cost);
      |               ~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#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++)

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);
    rep(i,Q){
        cin>>a.at(i)>>b.at(i)>>c.at(i)>>d.at(i);
    }
    vector<int> sum(M);
    rep(i,M){
        vector<int> A(N);
        A.at(i)=i+1;
        int x=0;
        rep(k,M-A.at(k)){
            A.at(k+1)=A.at(k)+x;
            x++;
            rep(l,Q){
                if(k+1==b.at(l)){
                    if(A.at(b.at(l)-1)-A.at(a.at(l)-1)==c.at(l)){
                        sum.at(i)+=d.at(l);
                    }
                }
            }
        }
    }
    int maxsum=0;
    rep(i,M-1){
        maxsum=max(sum.at(i),sum.at(i+1))
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:42: error: expected ';' before '}' token
   35 |         maxsum=max(sum.at(i),sum.at(i+1))
      |                                          ^
      |                                          ;
   36 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#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++)

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);
    rep(i,Q){
        cin>>a.at(i)>>b.at(i)>>c.at(i)>>d.at(i);
    }
    vector<int> sum(M);
    rep(i,M){
        vector<int> A(N);
        A.at(i)=i+1;
        int x=0;
        rep(k,M-A.at(k)){
            A.at(k+1)=A.at(k)+x;
            x++;
            rep(l,Q){
                if(k+1==b.at(l)){
                    if(A.at(b.at(l)-1)-A.at(a.at(l)-1)==c.at(l)){
                        sum.at(i)+=d.at(l);
                    }
                }
            }
        }
    }
    int max=0;
    rep(i,M-1){
        max=max(sum.at(i),sum.at(i+1))
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:16: error: 'max' cannot be used as a function
   35 |         max=max(sum.at(i),sum.at(i+1))
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 52;
int n, m, q;
int a[N], b[N], c[N], d[N];
vector<int> v;

int rek(int last = 1, int depth = 0) {
  int ret = 0;
  if (depth == n) {


Compiler output:
a.cc: In function 'int rek(int, int)':
a.cc:22:20: error: expected '}' at end of input
   22 |   if (depth == n) {
      |                   ~^
a.cc:22:20: error: expected '}' at end of input
a.cc:20:38: note: to match this '{'
   20 | int rek(int last = 1, int depth = 0) {
      |                                      ^
a.cc:22:20: warning: no return statement in function returning non-void [-Wreturn-type]
   22 |   if (depth == n) {
      |                    ^
Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int n,r,ans=0;
vector<int> a;
vector<int> c;
struct matter
{
  int a,b,c,d;
};
matter p[50];
void check()
{
  int val=0;
  for (int i=0;i<q;i++)
  {
    if ((a[p[i].b]-a[p[i].a])==p[i].c)
      val=val+p[i].d;
  }
  ans=max(ans,val);
}
void solve(int init,int k)
{
  if (k==0)
  {
    check();
    return;
  }
  for (int i=init;i<=(n-k);i++)
  {
    c.push_back(a[i]);
    solve(i+1,k-1);
    c.pop_back();
  }
}
int main()
{
  int n,m,q;
  scanf("%d%d%d",&n,&m,&q);
  for (int i=0;i<q;i++)
    scanf("%d%d%d%d",&p[i].a,&p[i].b,&p[i].c,&p[i].d);
  for (int i=0;i<n;i++)
    a[i]=i+1;
  solve(0,r);
  printf("%d\n",ans);
  return 0;
}

Compiler output:
a.cc: In function 'void check()':
a.cc:15:18: error: 'q' was not declared in this scope
   15 |   for (int i=0;i<q;i++)
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int n,r;
vector<int> a;
vector<int> c;
struct matter
{
  int a,b,c,d;
};
matter p[50];
void solve(int init,int k)
{
  if (k==0)
  {
    check();
    return;
  }
  for (int i=init;i<=(n-k);i++)
  {
    c.push_back(a[i]);
    solve(i+1,k-1);
    c.pop_back();
  }
}
int main()
{
  int n,m,q;
  scanf("%d%d%d",&n,&m,&q);
  for (int i=0;i<q;i++)
    scanf("%d%d%d%d",&p[i].a,&p[i].b,&p[i].c,&p[i].d);
  for (int i=0;i<n;i++)
    a[i]=i+1;
  solve(0,r);
  return 0;
}

Compiler output:
a.cc: In function 'void solve(int, int)':
a.cc:16:5: error: 'check' was not declared in this scope
   16 |     check();
      |     ^~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int n,r;
vector<int> a;
vector<int> c;
struct matter
{
  int a,b,c,d;
};
matter p[50];
solve(int init,int k)
{
  if (k==0)
  {
    check();
    return;
  }
  for (int i=init;i<=(n-k);i++)
  {
    c.push_back(a[i]);
    solve(i+1,k-1);
    c.pop_back();
  }
}
int main()
{
  int n,m,q;
  scanf("%d%d%d",&n,&m,&q);
  for (int i=0;i<q;i++)
    scanf("%d%d%d%d",&p[i].a,&p[i].b,&p[i].c,&p[i].d);
  for (int i=0;i<n;i++)
    a[i]=i+1;
  solve(0,r);
  return 0;
}

Compiler output:
a.cc:12:1: error: ISO C++ forbids declaration of 'solve' with no type [-fpermissive]
   12 | solve(int init,int k)
      | ^~~~~
a.cc: In function 'int solve(int, int)':
a.cc:16:5: error: 'check' was not declared in this scope
   16 |     check();
      |     ^~~~~
a.cc:17:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   17 |     return;
      |     ^~~~~~
a.cc:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();

int a[11];
void nextone(int N, int M, int a[]);

int main() {
    int N,M,Q;
    cin >> N>>M>>Q;
    REP(i,N+1) a[i+1]=1;
    ll point=0,ans=0;;
    int numbers[Q][4];
    REP(i,Q) cin>>numbers[i][0]>>numbers[i][1]>>numbers[i][2]>>numbers[i][3];
    while(a[0]!=M){
        point=0;
        REP(i,Q){
            if(a[numbers[i][1]]-a[numbers[i][0]]==numbers[i][2]) point+=numbers[i][3];
        }
        nextone(N, M, a);
        ans = max(ans, point);
    }
    cout << ans << endl;
    return 0;
}

void nextone(int N, int M, int a[]){
    if(a[N]!=M){
        a[N]++;
    }else {
        nextone(N-1,a);
        a[N]=a[N-1];
    }
}


Compiler output:
a.cc: In function 'void nextone(int, int, int*)':
a.cc:36:21: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   36 |         nextone(N-1,a);
      |                     ^
      |                     |
      |                     int*
a.cc:36:16: error: too few arguments to function 'void nextone(int, int, int*)'
   36 |         nextone(N-1,a);
      |         ~~~~~~~^~~~~~~
a.cc:32:6: note: declared here
   32 | void nextone(int N, int M, int a[]){
      |      ^~~~~~~
Language: C++

#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string>
#include<math.h>
#include<string.h>
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int a[100],b[100],c[100],d[100],A[20];
int m,n,q,,index=1;
ll ans=0,sum;
void DFS(int k)
{
    int i;
    if(index==n+1)
    {
        sum=0;
        for(int j=1;j<=n;j++)
        {
            if(A[b[j]]-A[a[j]]==c[j])
                sum+=d[j];
        }
        if(sum>ans)ans=sum;
        return ;
    }
   for(i=k;i<=m;i++)
   {
       A[index++]=i;
       DFS(i);
       index--;
   }
}
int main()
{
    int i;
    cin>>n>>m>>q;
    for(i=1;i<=q;i++)
    {
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    DFS(1);
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc:11:11: error: expected unqualified-id before ',' token
   11 | int m,n,q,,index=1;
      |           ^
a.cc:11:12: error: 'int index' redeclared as different kind of entity
   11 | int m,n,q,,index=1;
      |            ^~~~~
In file included from /usr/include/string.h:462,
                 from a.cc:6:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void DFS(int)':
a.cc:16:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator=='
   16 |     if(index==n+1)
      |        ~~~~~^~~~~
a.cc:29:15: error: no post-increment operator for type
   29 |        A[index++]=i;
      |               ^~
a.cc:31:13: error: no post-decrement operator for type
   31 |        index--;
      |             ^~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int N,M,Q;
vector<long long> a,b,c,d;

long long score(const vector<int> &A){
  long long res=0;
  for(int i=0;i<Q;++i) if(A[b[i]]-a[a[i]]==c[i]) res+=d[i];
  return res;
}
void dfs(vector<int> &A){
  if(A.size()==10){
    for(int i=0;i<10;++i) cout<<A[i];
    cout<<endl;
    return;
  }
  for(int v=0;v<M;++v){
    if(A.size()=N){
      return score(A);
    }
    long long res=0;
    int prev_last=(A.empty()?0:A.back());
    for(int add=prev_last;add<M;++add){
      A.push_back(add);
      res=max(res,dfs(A));
    A.push_back(v);
    }
   return res;
}

int main(){
  cin>>N>>M>>Q;
  a.resize(Q);
  b.resize(Q);
  c.resize(Q);
  d.resize(Q);
  for(int q=0;q<Q;++q){
    cin>>A[q]>>b[q]>>c[q]>>d[q];
    --a[q],--b[q];
  }
  vector<int> A;
  cout<<dfs(A)<<endl;
}

Compiler output:
a.cc: In function 'void dfs(std::vector<int>&)':
a.cc:19:14: error: lvalue required as left operand of assignment
   19 |     if(A.size()=N){
      |        ~~~~~~^~
a.cc:20:19: error: return-statement with a value, in function returning 'void' [-fpermissive]
   20 |       return score(A);
      |              ~~~~~^~~
a.cc:26:22: error: invalid use of void expression
   26 |       res=max(res,dfs(A));
      |                   ~~~^~~
a.cc:29:11: error: return-statement with a value, in function returning 'void' [-fpermissive]
   29 |    return res;
      |           ^~~
a.cc:32:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   32 | int main(){
      |         ^~
a.cc:32:9: note: remove parentheses to default-initialize a variable
   32 | int main(){
      |         ^~
      |         --
a.cc:32:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:32:11: error: a function-definition is not allowed here before '{' token
   32 | int main(){
      |           ^
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:12:25: note: to match this '{'
   12 | void dfs(vector<int> &A){
      |                         ^
Language: C++

#include <bits/stdc++.h>
#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)
{
  if (A.size() == n+1)
  {
    // calc score
    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()
{
  int n, m, q;
  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:4:16: error: expected ';' before 'Long'
    4 | using ll = long Long;
      |                ^~~~~
      |                ;
Language: C++

#include <bits/stdc++.h>
#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)
{
  if (A.size() == n+1)
  {
    // calc score
    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()
{
  int n, m, q;
  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:4:12: error: 'Long' does not name a type; did you mean 'long'?
    4 | using ll = Long Long;
      |            ^~~~
      |            long
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:22:24: error: expected ';' before 'return'
   22 |     ans = max(ans, now) return;
      |                        ^~~~~~~
      |                        ;
Language: C++

#include <bits/stdc++.h>
#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)
{
  if (A.size() == n + 1)
  {
    // calc score
    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()
{
  int n, m, q;
  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:4:12: error: 'Long' does not name a type; did you mean 'long'?
    4 | using ll = Long Long;
      |            ^~~~
      |            long
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:22:24: error: expected ';' before 'return'
   22 |     ans = max(ans, now) return;
      |                        ^~~~~~~
      |                        ;
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>

#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int N_165, M_165, Q_165;
vector<int> a_165, b_165, c_165, d_165;
int ans_165;

void dfs_165(vector<int> A)
{
  if (A.size() == N_165 + 1)
  {
    int now = 0;
    for (int i = 0; i < Q_165; ++i)
    {
      if (A[b_165[i]] - A[a_165[i]] == c_165[i]) now += d_165[i];
    }
    ans_165 = max(ans_165, now);
    return;
  }
  A.push_back(A.back());
  while (A.back() <= M_165)
  {
    dfs_165(A);
    A.back()++;
  }
}

int main()
{
  cin >> N_165 >> M_165 >> Q_165;
  a_165 = b_165 = c_165 = d_165 = vector<int>(Q_165);
  ans_165 = 0;

  for (int i = 0; i < Q_165; ++i) 
    cin >> a_165[i] >> b_165[i] >> c_165[i] >> d_165[i];

  dfs_165(vector<int>(1, 1));
  cout << ans_165 << endl;
  return;
}

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

#include<iostream>
#include<vector>
using namespace std;
int n,m,q;
vector<long long> a,b,c,d;
long long score(const vector<int> &a){
long long res=0;
  for(int i=0;i<q;++i) if(a[b[i]]-a[a[i]]==c[i]) res+=d[i];
  return res;
}

long long dfs(vector<int> &a){
  if(a.size()==n){
    return score(a);
  }
  long long res=0;
  int prev_last;add<m;++add){
    a.push_back(add);
    res=max(res,dfs(a));
    a.pop_back();
  }
  return res;
}
int main(){
 cin>>n>>m>>q;
  a.resize(q);b.resize(q);c.resize(q);d.resize(q);
  for(int i=0;i<q;i++){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    --a[q],--b[q];
  }
  vector<int>Q;
  cout<<dfs(Q)<<endl;
}

Compiler output:
a.cc: In function 'long long int dfs(std::vector<int>&)':
a.cc:17:17: error: 'add' was not declared in this scope
   17 |   int prev_last;add<m;++add){
      |                 ^~~
Language: C++

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

int n, m, q;
int a[11];
int b[11];
int c[11];
int d[11];
int s[11];
int ans = 0;

void f(int i) {
	if (i > n) {
		long long sum = 0;
		for (int i = 0; i < q; ++i) {
			if (s[b[i]] - s[a[i]] == c[i]) {
				sum += d[i];
			}
		}

		ans = max(ans, sum);
		return;
	}

	for (int v = s[i - 1]; v <= m; ++v) {
		s[i] = v;
		f(i + 1);
	}
}

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

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

	s[0] = 1;

	f(1);

	cout << ans;
	
	return 0;
}
	

Compiler output:
a.cc: In function 'void f(int)':
a.cc:21:26: error: no matching function for call to 'max(int&, long long int&)'
   21 |                 ans = max(ans, sum);
      |                       ~~~^~~~~~~~~~
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:21:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   21 |                 ans = max(ans, sum);
      |                       ~~~^~~~~~~~~~
/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:21:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |                 ans = max(ans, sum);
      |                       ~~~^~~~~~~~~~
Language: C

#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <math.h>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;

int n, m, q, res;
vector<tuple<int, int, int, int> > abcd;

void dfs(vector<int>& vec){
    if(vec.size() == n){
        int sum = 0;
        for(auto [a, b, c, d] : abcd){
            if(vec[b-1] - vec[a-1] == c){
                sum += d;
            }
        }
        chmax(res, sum);
        return;
    }
    int low = (vec.size() ? vec.back() : 1ll);
    for(int i = low; i <= m; ++i){
        vec.emplace_back(i);
        dfs(vec);
        vec.pop_back();
    }
}

signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cin >> n >> m >> q;

    abcd.resize(q);

    for(auto&& [a, b, c, d] : abcd){
        cin >> a >> b >> c >> d;
    }

    vector<int> vec;
    dfs(vec);

    cout << res << '\n';

    return 0;
}

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

#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <math.h>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;

int n, m, q, res;
vector<tuple<int, int, int, int> > abcd;

void dfs(vector<int>& vec){
    if(vec.size() == n){
        int sum = 0;
        for(auto [a, b, c, d] : abcd){
            if(vec[b-1] - vec[a-1] == c){
                sum += d;
            }
        }
        chmax(res, sum);
        return;
    }
    int low = (vec.size() ? vec.back() : 1);
    for(int i = low; i <= m; ++i){
        vec.emplace_back(i);
        dfs(vec);
        vec.pop_back();
    }
}

signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cin >> n >> m >> q;

    abcd.resize(q);

    for(auto&& [a, b, c, d] : abcd){
        cin >> a >> b >> c >> d;
    }

    vector<int> vec;
    dfs(vec);

    cout << res << '\n';

    return 0;
}

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

#include <iostream>
#include <cmath>
#include <vector>

int main(void){
    int n, m, q;
    std::vector<std::vector<std::vector<int>>> v(n - 1, std::vector<std::vector<int>>(n, std::vector<int>(m, 0)));
    std::cin >> n >> m >> q;
    for(int i = 0; i < q; ++ i){
        int a, b, c, d;
        std::cin >> a >> b >> c >> d;
        v[a - 1][b - 1][c] = d;
    }
    std::cout << c_rec(m, n - 1, 0, v) << std::endl;

    return 0;
}

int c_rec(int m, int r, long l, std::vector<std::vector<std::vector<int>>> v){
    int tmp = 0;
    if(m == 1){
        l += r;
        std::vector<int> a;
        a.push_back(1);
        for(int i = 0; i < 10; ++ i){
            for(int j = 0; j < l % 10; ++ j) a.push_back(i + 1);
            l /= 10;
            if(l == 0) break;
        }
        for(int i = 0; i < a.size() - 1; ++ i) for(int j = i; j < a.size(); ++ j) tmp += v[i][j][a[j] - a[i]];
    }else for(int i = 0; i <= r; ++ i) tmp = std::fmax(tmp, c_rec(m - 1, r - i, l + pow(10, m - 1) * i, v));

    return tmp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: 'c_rec' was not declared in this scope
   14 |     std::cout << c_rec(m, n - 1, 0, v) << std::endl;
      |                  ^~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

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

void dfs(ll NN){

    if(NN == 0){

        sum = 0;

        for(ll i = 0;i < Q;++i){
            if(A[b[i]-1]-A[a[i]-1] == c[i]){
                sum = sum + d[i];
            }
        }

        if(ans < sum) ans = sum;

    }
    else{

        for(ll i = 0;i < M;++i){
            A[NN-1] = i + 1;
            rec(NN-1);
        }

    }

}

int main(){

cin >> N >> M >> Q;

for(ll i = 0;i < Q;++i)    cin >> a[i] >> b[i] >> c[i] >> d[i];

dfs(N);

cout << ans << endl;

return 0;

}

Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:33:13: error: 'rec' was not declared in this scope
   33 |             rec(NN-1);
      |             ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

ll N,M,Q;
ll sum = 0,ans = 0;
vector<ll> a(50);
vector<ll> b(50);
vector<ll> c(50);
vector<ll> d(50);
vector<ll> A(11,1);

void rec(ll NN){
    if(N == NN){
        sum = 0;
        for(ll i = 0;i < Q;++i){
            if(A[b[i]-1]-A[a[i]-1] == c[i]){
                sum = sum + d[i];
            }
        }
        if(ans < sum) ans = sum;
    }
    else{
        for(ll i = 1;i <= M;++i){

            A[NN] = i;
            if(A[NN-1] <= A[NN])    rec(NN+1);
            
        }
    }
}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:37:1: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   37 | dfs(1);
      | ^~~
      | ffs
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

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

void dfs(ll N){

    if(N == 0){

        sum = 0;

        for(ll i = 0;i < Q;++i){
            if(A[b[i]-1]-A[a[i]-1] == c[i]){
                sum = sum + d[i];
            }
        }

        if(ans < sum) ans = sum;

    }
    else{

        for(ll i = 0;i < M;++i){
            A[N-1] = i + 1;
            rec(N-1);
        }

    }

}

int main(){

cin >> N >> M >> Q;

for(ll i = 0;i < Q;++i)    cin >> a[i] >> b[i] >> c[i] >> d[i];

dfs(N);

cout << ans << endl;

return 0;

}

Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:33:13: error: 'rec' was not declared in this scope
   33 |             rec(N-1);
      |             ^~~
Language: C++

#include<bits/stdc++.h> 

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:44:9: error: 'p' was not declared in this scope
   44 |         p[0] = 1;
      |         ^