criyle/codenet-compile-errors huggingface dataset:
Language: Java

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
int main()
{
ld n;
cin>>n;
ld x=100.0;
ll count=0;
while(x<n){
x=(x+(0.01*x));
ll p=x;
x=p;
count++;
}
cout<<count<<endl;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<bits/stdc++.h>
        ^
Main.java:3: error: illegal character: '#'
#define ll long long int
^
Main.java:3: error: class, interface, enum, or record expected
#define ll long long int
        ^
Main.java:4: error: illegal character: '#'
#define ld long double
^
Main.java:8: error: class, interface, enum, or record expected
cin>>n;
^
Main.java:9: error: unnamed classes are a preview feature and are disabled by default.
ld x=100.0;
^
  (use --enable-preview to enable unnamed classes)
Main.java:11: error: class, interface, enum, or record expected
while(x<n){
^
Main.java:14: error: class, interface, enum, or record expected
x=p;
^
Main.java:15: error: class, interface, enum, or record expected
count++;
^
Main.java:16: error: class, interface, enum, or record expected
}
^
Main.java:18: error: class, interface, enum, or record expected
}
^
12 errors
Language: C

# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# pragma GCC optimize "-O3"
# define int long long
  
using namespace std;
  
const int N = 1e4 + 7;
const int mod = 1e9 + 7;

void solve() {
	int x;
	cin >> x;
	int y = 100, cnt = 0;
	while ( y < x ) {
		cnt++;
		int z = y / 100 * 1;
		y += z;
	}
	cout << cnt << "\n";
}

int32_t main() {
	speed;
	int T = 1;
	// cin >> T;
	while ( T-- ) {
		solve();
	}
}

Compiler output:
main.c:1:11: 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;

void solve()
{
	double x;
	cin >> x;
	
	double p = 100;
	
	int ans = 0;
	
	while(p < x)
	{
		++ans;
		p += 1.0 / 100 * p;
	}
	
	cout << ans << '\n';
}

main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t = 1;

//	cin >> t;

	for(; t; --t)
	{
		solve();
	}
}

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 <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
    // const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
    // const ld PI = 3.1415926535;
#endif

// #pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")`  

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int x = 100;
    for (int i = 0; i < 4000; i++) {
        if (x >= n) {
            cout << i << "\n";
            return 0;
        }
        x += x/100;
    }
}
/*

*/  

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>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  ll X;
  ll ans = 0;
  ll p = 100;
  while(1){
    p *= 1.01;
    ans++;
    if(p>= X){
      break;
    }
  }
  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: C

//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll now = 100;
    ll ans = 0;
    while(now<x){
        now = now + (now/100);
        ans++;
    }
    cout << ans << endl;

    return 0;
}

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

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

int n, m, q;

void dfs(int i, vector<int> &buf, vector<vector<int>> &A) {
    if (i == n) {
        A.push_back(buf);
    } else {
        for (int j = buf[i]; j <= m; j++) {
            buf[i] = j;
            dfs(i + 1, buf, A);
        }
    }
}

int main() {
    cin >> n >> m >> q;
    int a[q], b[q], c[q], d[q];
    rep(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }
    vector<int> buf(n, 1);
    vector<vector<int>> A;
    for (int i = 1; i <= m; i++) {
        dfs(0, buf, A);
    }
    ll ans = 0;
    rep(i, (int)A.size()) {
        int sum = 0;
        rep(j, q) {
            if (A[i][b[j]] - A[i][a[j]] == c[j]) {
                sum += d[j];
            }
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

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

import java.util.*;

public class CManyRequirements {
    static int n;
    static int m;
    static int q;
    static int[] a;
    static int[] b;
    static int[] c;
    static int[] d;
    static List<Integer> ansList = new ArrayList<>();

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        q = sc.nextInt();
        a = new int[q];
        b = new int[q];
        c = new int[q];
        d = new int[q];
        for(int i = 0; i < q; i++) {
            int[] abcd = new int[4];
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            c[i] = sc.nextInt();
            d[i] = sc.nextInt();
        }
        ArrayList<Integer> A = new ArrayList<>();
        A.add(1);
        dfs(A);
        System.out.println(Collections.max(ansList));
    }

    private static void dfs(ArrayList<Integer> A) {
        if (A.size() == n + 1) {
            int now = 0;
            for(int i = 0; i < q; i++) {
                if (A.get(b[i]) - A.get(a[i]) == c[i]) {
                    now += d[i];
                }
            }
            ansList.add(now);
            return;
        }
        A.add(A.get(A.size() - 1));
        while (A.get(A.size() - 1) <= m) {
            dfs((ArrayList<Integer>)A.clone());
            A.set(A.size() - 1, A.get(A.size() - 1) + 1);
        }
    }

}

Compiler output:
Main.java:3: error: class CManyRequirements is public, should be declared in a file named CManyRequirements.java
public class CManyRequirements {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

vector<string> num;
void dfs(int n, int m, string res = "0"){
  if(n == 0){
    num.push_back(res);
    return;
  }
  for(char c = res.back(); c <= m+'0'; c++){
    dfs(n-1,m,res+c);
  }
}

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,m,q; cin >> n >> m >> q;
  vi a(q),b(q),c(q),d(q);
  rep(i,q) cin >> a[i] >> b[i] >> c[i] >> d[i];

  dfs(n,m,"0");
  ll ans = 0;
  rep(i,num.size()){
    int res = 0;
    rep(j,q){
      if(num[i][b[j]]-num[i][a[j]] == c[j]) res += d[j];
    }
    chmax(ans,res);
  }
  cout << ans;
  cout << "\n";
  return 0;
}


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

#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;

int a[50], b[50], c[50], d[50];
int n, m, q;
int mx = 0;
vector<int> t;

int check()
{
	int curr = 0;
	for(int i = 0; i<q; i++)
	{
		if(t[b[i]] - t[a[i]] == c[i]) curr += d[i];
	}
	return val;
}

void dfs(int i, int cur)
{
	if(i>=n)
	{
		mx = max(mx, check());
	}
	for(int j = cur; j<=m; j++)
	{
		v.push_back(j);
		dfs(i+1, j);
		v.pop_back();
	}
}

void solve()
{
	cin >> n >> m >> q;
	
	for(int i = 0; i<q; i++) 
	{
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--; b[i]--;
	}
	
	dfs(0, 1);
	cout << mx << "\n";		
		
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'int check()':
a.cc:17:16: error: 'val' was not declared in this scope
   17 |         return val;
      |                ^~~
a.cc: In function 'void dfs(int, int)':
a.cc:28:17: error: 'v' was not declared in this scope
   28 |                 v.push_back(j);
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ar array
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 1e5;
int n, m ,q;
vector<int> arr;
struct query{
    int a, b, c, d;
} q_arr[55];
int ans = 0;

void dfs(int num, int pos){
    if(pos>=n){
        int tmp = 0;
        for(int i=0; i<q; i++){
            int a = q_arr[i].a, b=q_arr[i].b;
            if(arr[b]-arr[a]==q_arr[i].c){
                tmp+=q_arr[i].d;
            }
        } 
        ans = max(ans, tmp);
        return;
    }
    for(int i = num; i<=m; i++){
        arr.push_back(i);
        dfs(i, pos+1);
        arr.pop_back();
    }
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:43:20: error: expected ';' before '}' token
   43 |     cout<<ans<<endl
      |                    ^
      |                    ;
   44 | }
      | ~
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 main() {
  #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) {
    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;
}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: a function-definition is not allowed here before '{' token
   18 | void dfs(vector<int> A) {
      |                         ^
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   35 | int main() {
      |         ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
   35 | int main() {
      |         ^~
      |         --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:12: error: a function-definition is not allowed here before '{' token
   35 | int main() {
      |            ^
Language: C++

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

int A[10];
int N,M,Q,a[50],b[50],c[50],d[50];
int ans = 0;

void dfs(int i,const int start){
    if(i==N){
        int total = 0;
        rep(j,Q){
            if(A[b[j]] - A[a[j]] == c[j]){
                total += d[j];
            }
            ans = max(ans,total);
        }
    }else{
        for(int j=start;j<=M;j++){
            A[i] = j;
            dfs(i+1,j);
        }
    }
}

int main(){
    cin >> N >> M >> Q;
    rep(i,Q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }
    dfs(0,1,M);
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:8: error: too many arguments to function 'void dfs(int, int)'
   33 |     dfs(0,1,M);
      |     ~~~^~~~~~~
a.cc:10:6: note: declared here
   10 | void dfs(int i,const int start){
      |      ^~~
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
int n, m, q;
int a[52], b[52], c[52], d[52];
int ans = 0;
int seq[11];

dfs(int len, int cur){
	if(len == n){
		int sum = 0;
		for(int i = 0; i<q; i++){
			if(seq[b[i]-1] - seq[a[i]-1] == c[i]){
				sum += d[i];
			} 
		}
		ans = max(ans, sum);
		return;
	}
	else{
		seq[len] = cur;
		for(int i = cur; i<=m; i++){
			dfs(len+1, i);
		}
	}
}

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

Compiler output:
a.cc:9:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
    9 | dfs(int len, int cur){
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:18:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   18 |                 return;
      |                 ^~~~~~
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
int n, m, q;
int a[52], b[52], c[52], d[52];
int ans = 0;
int seq[11];

dfs(int len, int cur){
	if(len == n){
		int sum = 0;
		for(int i = 0; i<q; i++){
			if(seq[b[i]-1] - seq[a[i]-1] == c[i]){
				sum += d[i];
			} 
		}
		ans = max(ans, sum);
	}
	else{
		seq[len] = cur;
		for(int i = cur; i<=m; i++){
			dfs(len+1, i);
		}
	}
}

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

Compiler output:
a.cc:9:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
    9 | dfs(int len, int cur){
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
Language: C++


#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template<class _T> static void getint(_T& a) {
	if (sizeof(_T) > sizeof(int)) {
		scanf("%lld", &a);
	}
	else {
		scanf("%d", &a);
	}
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

class data {
public:
	int a, b, c, d;
};

static int dfs(std::vector<int> An, int M, int N, std::vector<data>& qi)
{
	int val = 0;
	if (An.size() == N) {
		int Q = qi.size();
		for (int q = 0; q < Q; q++) {
			if (An[qi[q].b] - An[qi[q].a] == qi[q].c) {
				val += qi[q].d;
			}
		}
	}
	else {
		int idx = An.size();
		int last = 1;
		if (idx) {
			last = *An.rbegin();
		}
		An.push_back(0);
		for (int num = last; num <= M; num++) {
			An[idx] = num;
			val = std::max(val, dfs(An, M, N, qi));
		}
	}
	return val;
}


Compiler output:
a.cc:43:13: warning: 'void exec()' used but never defined
   43 | static void exec();
      |             ^~~~
/usr/bin/ld: /tmp/cctkmfpN.o: in function `main':
a.cc:(.text+0x5): undefined reference to `exec()'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
using namespace std;
int p[55];
int a[55],b[55],c[55],d[55];
int sum=-10000;
int n,m,q;
int sum;
void choc()
{
    int x=0;
    for(int i=0; i<q; i++)
    {
        if(p[b[i]]-p[a[i]]==c[i])
        {
            x+=d[i];
        }
    }
    sum=max(sum,x);
    return ;
}
int dfs(int now,int s)
{
    p[now]=s;
    if(now==n)
    {
        choc();
        return 0;
    }
    for(int i=s;i<=m; i++)
    {
        dfs(now+1,i);
    }
}
int main()
{
    cin>>n>>m>>q;
    for(int i=0; i<q; i++)
    {
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    dfs(0,1);
    cout<<sum<<endl;
    return 0;
}


Compiler output:
a.cc:19:5: error: redefinition of 'int sum'
   19 | int sum;
      |     ^~~
a.cc:17:5: note: 'int sum' previously defined here
   17 | int sum=-10000;
      |     ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
Language: C++

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

int n, m, q;

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

int ans;

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

int main(){
    cin >> n >> m >> 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:28:15: error: lvalue required as increment operand
   28 |         A.size()++;
      |         ~~~~~~^~
Language: C++

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

int n, m, q;

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

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

int main(){
    cin >> n >> m >> 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:19:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         ans = max(ans, now);
      |         ^~~
      |         abs
a.cc:26:15: error: lvalue required as increment operand
   26 |         A.size()++;
      |         ~~~~~~^~
a.cc: In function 'int main()':
a.cc:37:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>

using namespace std;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main(void)
{
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<int> a(Q);
    vector<int> b(Q);
    vector<int> c(Q);
    vector<int> d(Q);

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

    vector<int> v;
    if(M == 1){
        for(int i = 0; i < Q; i++) {
            if(b[i] - a[i] == c[i]) {
                sum += d[i];
            }
        }
        cout << sum << endl;
        return 0;
    }
    else {
        for(int i = 0;i < M - 1;i++) {
            v.push_back(0);
        } 
    }
    for(int i = 0;i < N;i++) {
        v.push_back(1);
    }

    vector<int> result;

    while(next_permutation(v.begin(),v.end())) {
        int count = 1;
        vector<int> A;
        for(int i = 0;i < (int)v.size();i++) {
            if(v[i] == 1) {
                A.push_back(count);
            }
            else{
                count++;
            }
        }
        long long sum = 0;
        for(int i = 0; i < Q; i++) {
            if(A[b[i]-1] - A[a[i]-1] == c[i]) {
                sum += d[i];
            }
        }
        result.push_back(sum);
    }

    cout << *max_element(result.begin(),result.end()) << endl;

    return 0;

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: 'sum' was not declared in this scope
   30 |                 sum += d[i];
      |                 ^~~
a.cc:33:17: error: 'sum' was not declared in this scope
   33 |         cout << sum << endl;
      |                 ^~~
Language: C++

#include <iostream>
#include <vector>
#define MAX_SIZE 51

long long int max_score = 0;
int n, m, q;
std::vector<int> a(MAX_SIZE), b(MAX_SIZE), c(MAX_SIZE), d(MAX_SIZE);
std::vector<int> A(11, 1);


// 条件を満たす組み合わせを全探索
void tree_search(int depth){
	long long int score = 0;
	if(depth > n) return;
 	for(int i = 0; i < q; i++)
		if(A[b[i]-1] - A[a[i]-1] == c[i])
		       score += d[i];
	// std::cout << A[0] << A[1] << A[2] << std::endl;

	if(max_score < score) max_score = score;
	// std::cout << score << std::endl;

	
	for(int i = A[depth-1]; i <= m; k++){
		A[depth] = i;	
		tree_search(depth+1);
	}

	return;
}


int main(void){
	std::cin >> n >> m >> q;	

	for(int i = 0; i < q; i++)
		std::cin >> a[i] >> b[i] >> c[i] >> d[i];
	
	tree_search(1);
	std::cout << max_score << std::endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'void tree_search(int)':
a.cc:24:41: error: 'k' was not declared in this scope
   24 |         for(int i = A[depth-1]; i <= m; k++){
      |                                         ^
Language: C++

from itertools import combinations_with_replacement
N,M,Q = map(int,input().split())
li = [list(map(int,input().split())) for i in range(Q) ]
counter = []
for comb in combinations_with_replacement(range(1,M+1),N):
    A = list(comb)
    tmp = 0
    for i in li:
        if A[i[1]-1] - A[i[0]-1] == i[2]:
            tmp += i[3]
    counter.append(tmp)
print(max(counter))


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import combinations_with_replacement
      | ^~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
ll ans=2e9+7;
int n,C,B,A,l[10];
void dfs(int i,int a,int b,int c,int mp)
{
	if(i==n+1)
	{
		if(!a||!b||!c) return;
		else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
		return;
	}
	dfs(i+1,a,b,c,mp);
	dfs(i+1,a+l[i],b,c,mp+(a==0?0:10));
	dfs(i+1,a,b+l[i],c,mp+(b==0?0:10));
	dfs(i+1,a,b,c+l[i],mp+(c==0?0:10));
}
int main(){
	cin>>n>>A>>B>>C;
	for(int i=1;i<=n;i++) cin>>l[i];
	dfs(1,0,0,0,0);
	cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int)':
a.cc:12:29: error: no matching function for call to 'min(long long int&, int)'
   12 |                 else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:12:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   12 |                 else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:12:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   12 |                 else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
ll ans=2e9+7;
int n,a,b,c,l[10];
void dfs(int i,int a,int b,int c,int mp)
{
	if(i==n+1)
	{
		if(!a||!b||!c) return;
		else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
		return;
	}
	dfs(i+1,a,b,c,mp);
	dfs(i+1,a+l[i],b,c,mp+(a==0?0:10));
	dfs(i+1,a,b+l[i],c,mp+(b==0?0:10));
	dfs(i+1,a,b,c+l[i],mp+(c==0?0:10));
}
int main(){
	cin>>n>>a>>b>>c;
	for(int i=1;i<=n;i++) cin>>l[i];
	dfs(1,0,0,0,0);
	cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int)':
a.cc:12:40: error: 'A' was not declared in this scope
   12 |                 else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
      |                                        ^
a.cc:12:49: error: 'B' was not declared in this scope
   12 |                 else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
      |                                                 ^
a.cc:12:58: error: 'C' was not declared in this scope
   12 |                 else ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp);
      |                                                          ^
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++)
using Graph = vector<vector<int>>;
using ll = long long;


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(now,ans);
        return;
    }

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:35:25: error: the value of 'q' is not usable in a constant expression
   35 |     a=b=c=d=vector<int(q);
      |                         ^
a.cc:9:9: note: 'int q' is not const
    9 | int n,m,q;
      |         ^
a.cc:35:25: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   35 |     a=b=c=d=vector<int(q);
      |                         ^
a.cc:35:25: note:   expected a type, got 'q'
a.cc:35:25: error: template argument 2 is invalid
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int a[N], b[N], c[N], n, m ,q, ans, tmp[N], d[N];
int check()
{
	int res = 0;
	for (int i = 1; i <= q; i++)
		if (tmp[b[i]] - tmp[a[i]] == c[i])
			res += d[i];
	return res;
}
void dfs(int maxx, int x)
{
	if (x > n)
	{
		ans = max(ans, check());
		return;
	}
	for (int i = maxx; i <= m; i++)
	{
		tmp[x] = i;
		dfs(i, x + 1);
	}
}
int main() 
{
	cin>>n>>m>>q;
	for (int i = 1; i <= q; i++)
		rd(a[i]), rd(b[i]), rd(c[i]), rd(d[i]);
	dfs(1, 1);
	cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: 'rd' was not declared in this scope; did you mean 'd'?
   30 |                 rd(a[i]), rd(b[i]), rd(c[i]), rd(d[i]);
      |                 ^~
      |                 d
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int a[N], b[N], c[N], n, m ,q, ans, tmp[N], d[N];
int check()
{
	int res = 0;
	for (int i = 1; i <= q; i++)
		if (tmp[b[i]] - tmp[a[i]] == c[i])
			res += d[i];
	return res;
}
void dfs(int maxx, int x)
{
	if (x > n)
	{
		ans = max(ans, check());
		return;
	}
	for (int i = maxx; i <= m; i++)
	{
		tmp[x] = i;
		dfs(i, x + 1);
	}
}
int main() 
{
	rd(n), rd(m), rd(q);
	for (int i = 1; i <= q; i++)
		rd(a[i]), rd(b[i]), rd(c[i]), rd(d[i]);
	dfs(1, 1);
	cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'rd' was not declared in this scope; did you mean 'd'?
   28 |         rd(n), rd(m), rd(q);
      |         ^~
      |         d
Language: C++

#include <cctype>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cmath>
const int N = 55;
int a[N], b[N], c[N], n, m ,q, ans, tmp[N], d[N];
int check()
{
	int res = 0;
	for (int i = 1; i <= q; i++)
		if (tmp[b[i]] - tmp[a[i]] == c[i])
			res += d[i];
	return res;
}
void dfs(int maxx, int x)
{
	if (x > n)
	{
		ans = max(ans, check());
		return;
	}
	for (int i = maxx; i <= m; i++)
	{
		tmp[x] = i;
		dfs(i, x + 1);
	}
}
int main() 
{
	rd(n), rd(m), rd(q);
	for (int i = 1; i <= q; i++)
		rd(a[i]), rd(b[i]), rd(c[i]), rd(d[i]);
	dfs(1, 1);
	cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:21:23: error: 'max' was not declared in this scope; did you mean 'std::max'?
   21 |                 ans = max(ans, check());
      |                       ^~~
      |                       std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc: In function 'int main()':
a.cc:32:9: error: 'rd' was not declared in this scope; did you mean 'd'?
   32 |         rd(n), rd(m), rd(q);
      |         ^~
      |         d
a.cc:36:9: error: 'cout' was not declared in this scope
   36 |         cout<<ans;
      |         ^~~~
Language: C++

#include<iostream>

using namespace std;

int main(){
	int N, M, Q;
	int abcd[50][4];
	int A[10];
	bool flag = false;
	int maxpoint = 0;
	int nowmaxpoint = 0;

	cin >> N >> M >> Q;

	for(int i = 0; i < Q; ++i){
		cin >> abcd[i][0] >> abcd[i][1] >> abcd[i][2] >> abcd[i][3];
	}

	for(int j = 0; j < N; ++j){
		A[j] = 1;
	}

	while(!flag){
		for(int k = 0; k < Q; ++k){
			if(A[abcd[k][1]] - A[abcd[k][0]] == abcd[k][2]){
				maxpoint += abcd[k][3];
			}
		}

		// 最大値更新
		if(maxpoint > nowmaxpoint){
			nowmaxpoint = maxpoint;
		}

		//数列更新 末尾から
		if(A[N-1] < M){
			++A[N-1];
		}else if(N-2 >= 0 &&
			 A[N-2] < A[N-1]){
				 ++A[N-2];
		}else if(N-3 >= 0 &&
			A[N-3] < A[N-2]){
				++A[N-3];
		}else if(N-4 >= 0 &&
			A[N-4] < A[N-3]){
				++A[N-4];
		}else if(N-5 >= 0 &&
			A[N-5] < A[N-4]){
				++A[N-5];
		}else if(N-6 >= 0 &&
			A[N-6] < A[N-5]){
				++A[N-6];
		}else if(N-7 >= 0 &&
			A[N-7] < A[N-6]){
				++A[N-7];
		}else if(N-8 >= 0 &&
			A[N-8] < A[N-7]){
				++A[N-8]
		}else if(N-9 >= 0 &&
			A[N-9] < A[N-8]){
				++A[N-9]
		}else if(N-10 >= 0 &&
			A[N-10] < A[N-9]){
				++A[N-10]
		}else{
			flag = true;
		}
		maxpoint = 0;
	}

	cout << nowmaxpoint << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:41: error: expected ';' before '}' token
   58 |                                 ++A[N-8]
      |                                         ^
      |                                         ;
   59 |                 }else if(N-9 >= 0 &&
      |                 ~                        
a.cc:61:41: error: expected ';' before '}' token
   61 |                                 ++A[N-9]
      |                                         ^
      |                                         ;
   62 |                 }else if(N-10 >= 0 &&
      |                 ~                        
a.cc:64:42: error: expected ';' before '}' token
   64 |                                 ++A[N-10]
      |                                          ^
      |                                          ;
   65 |                 }else{
      |                 ~
Language: C++

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

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

void dfs(vector<int> A){
	if(A.at(i) == n+1){
		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 = min(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.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:11:17: error: 'i' was not declared in this scope
   11 |         if(A.at(i) == n+1){
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

int N,M,Q;
int answer=0;
vector<int> A;
vector<struct data> given;

struct data{
	int Ai;
	int Bi;
	int ans;
	int point;
};

int dfs(vector<int> A){ 
/*
	for(auto itr:A)
		cout << itr << " ";
	cout << endl;
*/

	if(A.size() == N+1){ int counter=0;
		for(auto g:given)
			if(A[g.Bi] - A[g.Ai] == g.ans) counter+=g.point;

		return counter;
	}

	A.push_back(A.back());
	while(A.back()<=M){
		answer=max(answer,dfs(A));
		A.back()++;
		//cout << "ANS>>>>>>>>>>>>>>>>>>>>>>>>>" << answer << endl;
	}

	return answer;
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int i;
	data tmp;

	cin >> N >> M >> Q;

	for(i=0;i<Q;i++){
		cin >> tmp.Ai >> tmp.Bi >> tmp.ans >> tmp.point;
		given.push_back(tmp);
	}

	A.resize(1,1);
	dfs(A);

	cout << answer << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:9: error: reference to 'data' is ambiguous
   49 |         data tmp;
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:13:8: note:                 'struct data'
   13 | struct data{
      |        ^~~~
a.cc:54:24: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   54 |                 cin >> tmp.Ai >> tmp.Bi >> tmp.ans >> tmp.point;
      |                        ^~~
      |                        tm
Language: C

  #include <bits/stdc++.h>
   using namespace std;
   using pii = pair<int, int>;
   using ll = long long;
   #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
   const ll MOD = 1000000007;
   const ll INFL = (1LL << 60);
   const int INFI = (1 << 30);

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

   void dfs(int n) {
     if (n == N) {
       //和を求めてansを更新
       int ans_tmp = 0;
       rep(i, 0, Q) {
         if (A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)) ans_tmp += d.at(i);
       }
       ans = max(ans, ans_tmp);
     }
     else {
       rep(i, A.at(n), M + 1) {
         A.at(n + 1) = i;
         dfs(n + 1);
       }
     }
   }

   int main() {
     cin >> N >> M >> Q;
     A.at(0) = 1;

     rep(i, 0, Q) cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);

     dfs(0);

     cout << ans << endl;
   }


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

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


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

void dfs(int i, int x) {
  if(i == n) {
    int res = 0;
    rep(j, q) {
      if(c[j]==v[b[j]]-v[a[j]]) res+=d[j];
    }
    chmax(ans,res);
    return;
  }
  REP(j, x, m+1) {
    v.push_back(j);
    dfs(i+1, j);
    v.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(0, 1);
  cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:3:20: error: expected ';' before 'for'
    3 | #define rep (i,m)  for(int i=0;i<m;i++)
      |                    ^~~
a.cc:14:5: note: in expansion of macro 'rep'
   14 |     rep(j, q) {
      |     ^~~
a.cc:3:39: error: expected ';' before ')' token
    3 | #define rep (i,m)  for(int i=0;i<m;i++)
      |                                       ^
a.cc:14:5: note: in expansion of macro 'rep'
   14 |     rep(j, q) {
      |     ^~~
a.cc:17:5: error: 'chmax' was not declared in this scope
   17 |     chmax(ans,res);
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:3:14: error: 'i' was not declared in this scope
    3 | #define rep (i,m)  for(int i=0;i<m;i++)
      |              ^
a.cc:30:3: note: in expansion of macro 'rep'
   30 |   rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i], a[i]--, b[i]--;
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

using namespace std;


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

void dfs(int i, int x) {
  if(i == n) {
    int res = 0;
    rep(j, q) {
      if(c[j]==v[b[j]]-v[a[j]]) res+=d[j];
    }
    chmax(ans,res);
    return;
  }
  REP(j, x, m+1) {
    v.push_back(j);
    dfs(i+1, j);
    v.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(0, 1);
  cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:14:9: error: 'j' was not declared in this scope
   14 |     rep(j, q) {
      |         ^
a.cc:14:5: error: 'rep' was not declared in this scope; did you mean 'res'?
   14 |     rep(j, q) {
      |     ^~~
      |     res
a.cc:17:5: error: 'chmax' was not declared in this scope
   17 |     chmax(ans,res);
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:30:7: error: 'i' was not declared in this scope
   30 |   rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i], a[i]--, b[i]--;
      |       ^
a.cc:30:3: error: 'rep' was not declared in this scope
   30 |   rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i], a[i]--, b[i]--;
      |   ^~~
Language: C

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

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

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

    ans=0;
    dfs(vector<int>(0));

    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++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 998244353;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, m;
vector<vector<int>> VC;
/*
void dfs(vector<int> vec){
    if(vec.size()==m){
        VC.push_back(vec);
        return;
    }
    for(int i=vec.back(); i<=m; i++){
        vec.push_back(i);
        dfs(vec);
        vec.pop_back();
    }
}*/
void dfs(vector<int> vc){
    if(vc.size() == n) {
        VC.push_back(vc);
        return;
    }
    for(int i = vc.back(); i <= m; i++){
        vc.push_back(i);
        func(vc);
        vc.pop_back();
    }
}

int main() {   
    int q; cin >> n >> m >> q;    
    vector<int> a(q), b(q), c(q), d(q);
    rep(i, q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }
    
    vector<int> vec{1};
    dfs(vec);

    ll res = 0;
    for(vector<int> A: VC){
        ll sum = 0;
        rep(i, q){
            int num = A[b[i]] - A[a[i]];
            if(num == c[i]) sum += d[i];
        }
        chmax(res, sum);
    }
    cout << res << ln;
}

Compiler output:
a.cc: In function 'void dfs(std::vector<int>)':
a.cc:37:9: error: 'func' was not declared in this scope
   37 |         func(vc);
      |         ^~~~
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 998244353;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, m;
vector<vector<int>> VC;
/*
void dfs(vector<int> vec){
    if(vec.size()==m){
        VC.push_back(vec);
        return;
    }
    for(int i=vec.back(); i<=m; i++){
        vec.push_back(i);
        dfs(vec);
        vec.pop_back();
    }
}*/
void func(vector<int> vc){
    if(vc.size() == n) {
        VC.push_back(vc);
        return;
    }
    for(int i = vc.back(); i <= m; i++){
        vc.push_back(i);
        func(vc);
        vc.pop_back();
    }
}

int main() {   
    int q; cin >> n >> m >> q;    
    vector<int> a(q), b(q), c(q), d(q);
    rep(i, q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }
    
    vector<int> vec{1};
    dfs(vec);

    ll res = 0;
    for(vector<int> A: VC){
        ll sum = 0;
        rep(i, q){
            int num = A[b[i]] - A[a[i]];
            if(num == c[i]) sum += d[i];
        }
        chmax(res, sum);
    }
    cout << res << ln;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   51 |     dfs(vec);
      |     ^~~
      |     ffs