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

#include<bits/stdc++.h>
#define INFTY 1000000001
using namespace std;
void merge(int A[], int left, int mid, int right);
void merge_sort(int A[], int left, int right);

int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> A(q);
  for(int i = 0; i < q; i++) {
    int a, b, c;
    int64_t d;
    cin >> a >> b >> c >> d;
    A.at(i) = make_tuple(d, c, b, a);
    if(i>0)marge_sort(A[i], A[i-1], A[i+1]);
  }
  
  int64_t sum = 0;
  for(int i = 0; i < q; i++) {
    int d, c, b, a;
    tie(d, c, b, a) = A.at(i);
    if(i > 2) {
      if(A.at(i) == A.at(i+1)) continue;
    }
    if(c == b - a) {
      sum += d;
    }
  }
  cout << sum << endl;
} 

void merge(int A[], int left, int mid, int right) {
  int i, j, k;
  int n1, n2;  // 部分列L, Rの要素数決定に利用
  
  n1 = mid - left;
  n2 = right - mid;
  
  int L[n1+1], R[n2+1];
  
  for (i = 0; i < n1; i++) L[i] = A[left + i];  
  for (i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;

  // sort
  j = 0;
  k = 0;
  for (i = left; i < right; i++) {
    if (L[j] <= R[k]) {
      A[i] = L[j];
      j++;
    } else {
      A[i] = R[k];
      k++;
    }
  }
}

void merge_sort(int A[], int left, int right) {
  if (left + 1 < right) {
    int mid;
    mid = (left + right) / 2;
    // devide
    merge_sort(A, left, mid);
    merge_sort(A, mid, right);
    // conquer
    merge(A, left, mid, right);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'marge_sort' was not declared in this scope; did you mean 'merge_sort'?
   16 |     if(i>0)marge_sort(A[i], A[i-1], A[i+1]);
      |            ^~~~~~~~~~
      |            merge_sort
Language: C++

int n,m,q;
int mx = -1;

struct Score {
    int a,b,c,d;
} arr[100];

void dfs(int k,int d,vector<int> A) {
    if (d == n) {
        int s = 0;
        for (int j = 0;j < q;j ++) {
            if (A[arr[j].b - 1] - A[arr[j].a - 1] == arr[j].c) {
                s += arr[j].d;
            }
        }
        mx = max(mx,s);
        return;
    }
    for (int i = k;i <= m;i ++) {
        A.push_back(i);
        dfs(i,d + 1,A);
        A.erase(A.end() - 1);
    }
}

int main()
{
    scanf("%d%d%d",&n,&m,&q);
    
    int a,b,c,d;
    for (int i = 0;i < q;i ++) {
        scanf("%d%d%d%d",&a,&b,&c,&d);
        arr[i].a = a;
        arr[i].b = b;
        arr[i].c = c;
        arr[i].d = d;
    }
    dfs(1,0,vector<int>());
    printf("%d\n",mx);
    return 0;
}


Compiler output:
a.cc:8:22: error: 'vector' has not been declared
    8 | void dfs(int k,int d,vector<int> A) {
      |                      ^~~~~~
a.cc:8:28: error: expected ',' or '...' before '<' token
    8 | void dfs(int k,int d,vector<int> A) {
      |                            ^
a.cc: In function 'void dfs(int, int, int)':
a.cc:12:17: error: 'A' was not declared in this scope
   12 |             if (A[arr[j].b - 1] - A[arr[j].a - 1] == arr[j].c) {
      |                 ^
a.cc:16:14: error: 'max' was not declared in this scope; did you mean 'mx'?
   16 |         mx = max(mx,s);
      |              ^~~
      |              mx
a.cc:20:9: error: 'A' was not declared in this scope
   20 |         A.push_back(i);
      |         ^
a.cc: In function 'int main()':
a.cc:28:5: error: 'scanf' was not declared in this scope
   28 |     scanf("%d%d%d",&n,&m,&q);
      |     ^~~~~
a.cc:38:13: error: 'vector' was not declared in this scope
   38 |     dfs(1,0,vector<int>());
      |             ^~~~~~
a.cc:38:20: error: expected primary-expression before 'int'
   38 |     dfs(1,0,vector<int>());
      |                    ^~~
a.cc:39:5: error: 'printf' was not declared in this scope
   39 |     printf("%d\n",mx);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int n,m,q;
Language: C++

#include<bits/stdc++.h>
using namespace std;
void merge(int A[], int left, int mid, int right);
void merge_sort(int A[], int left, int right);

int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> A(q);
  for(int i = 0; i < q; i++) {
    int a, b, c;
    int64_t d;
    cin >> a >> b >> c >> d;
    A.at(i) = make_tuple(d, c, b, a);
    if(i>0)marge_sort(A[i], A[i-1], A[i+1]);
  }
  
  int64_t sum = 0;
  for(int i = 0; i < q; i++) {
    int d, c, b, a;
    tie(d, c, b, a) = A.at(i);
    if(i > 2) {
      if(A.at(i) == A.at(i+1)) continue;
    }
    if(c == b - a) {
      sum += d;
    }
  }
  cout << sum << endl;
} 

void merge(int A[], int left, int mid, int right) {
  int i, j, k;
  int n1, n2;  // 部分列L, Rの要素数決定に利用
  
  n1 = mid - left;
  n2 = right - mid;
  
  int L[n1+1], R[n2+1];
  
  for (i = 0; i < n1; i++) L[i] = A[left + i];  
  for (i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;

  // sort
  j = 0;
  k = 0;
  for (i = left; i < right; i++) {
    if (L[j] <= R[k]) {
      A[i] = L[j];
      j++;
    } else {
      A[i] = R[k];
      k++;
    }
  }
}

void merge_sort(int A[], int left, int right) {
  if (left + 1 < right) {
    int mid;
    mid = (left + right) / 2;
    // devide
    merge_sort(A, left, mid);
    merge_sort(A, mid, right);
    // conquer
    merge(A, left, mid, right);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'marge_sort' was not declared in this scope; did you mean 'merge_sort'?
   15 |     if(i>0)marge_sort(A[i], A[i-1], A[i+1]);
      |            ^~~~~~~~~~
      |            merge_sort
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:43:11: error: 'INFTY' was not declared in this scope
   43 |   L[n1] = INFTY;
      |           ^~~~~
Language: C++

#include <iostream>

using namespace std;

void get_array(int A[], int N, int M, int n) {
    if ((N - 1 - n) >= 0) {

        if (A[N - 1 - n] < M) {
            A[N - 1 - n]++;
        } else {
            get_array(A, N, M, n + 1);
            A[N - 1 - n] = A[N - 1 -(n + 1)];
        }

    }
    return;
}



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

    int a[Q];
    int b[Q];
    int c[Q];
    long int d[Q];
    int i;

    long int max = 0;
    long int total = 0;


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

    int A[N];

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

    do {

        show_array(A, N);

        int tmp_total = 0;

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

        if (tmp_total > total) total = tmp_total;
        if (total == max) break;

       get_array(A, N, M, 0);
        
        
    } while (A[0] < M);


    int tmp_total = 0;

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

    if (tmp_total > total) total = tmp_total;


    cout << total;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:9: error: 'show_array' was not declared in this scope
   49 |         show_array(A, N);
      |         ^~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int n,m,q,sir[11]
long long sol;
struct lol
{
    int a,b,c,d;
};
lol v[51];
void bkt(int k)
{
    for(int i=sir[k-1];i<=m;i++)
    {
        sir[k]=i;
        if(k==n)
        {
            long long s=0;
            for(int j=1;j<=q;j++)
            {
                if(sir[v[j].b]-sir[v[j].a]==v[j].c)
                    s+=v[j].d;
            }
            sol=max(sol,s);
        }
        else
            bkt(k+1);
    }
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++)
        cin>>v[i].a>>v[i].b>>v[i].c>>v[i].d;
    sir[0]=1;
    bkt(1);
    cout<<sol;
    return 0;
}


Compiler output:
a.cc:5:1: error: expected initializer before 'long'
    5 | long long sol;
      | ^~~~
a.cc: In function 'void bkt(int)':
a.cc:13:15: error: 'sir' was not declared in this scope
   13 |     for(int i=sir[k-1];i<=m;i++)
      |               ^~~
a.cc:24:13: error: 'sol' was not declared in this scope; did you mean 'lol'?
   24 |             sol=max(sol,s);
      |             ^~~
      |             lol
a.cc: In function 'int main()':
a.cc:37:5: error: 'sir' was not declared in this scope
   37 |     sir[0]=1;
      |     ^~~
a.cc:39:11: error: 'sol' was not declared in this scope; did you mean 'lol'?
   39 |     cout<<sol;
      |           ^~~
      |           lol
Language: C++

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

int main(){
  int N,M,Q;
  cin>>N>>M>>Q;
  vector<vector<int>> table(Q, vector<int>(4));
  for(int i=0;i<Q;i++){
    for(int j=0;j<4;j++){
      cin>>table.at(i).at(j);
    }
  }
  vecot<int>A(N);
  int max=0;
  for(int i=0;i<N;i++){
    for(int j=1;j<N+1;j++){
    A.at(i)=j;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'vecot' was not declared in this scope
   13 |   vecot<int>A(N);
      |   ^~~~~
a.cc:13:9: error: expected primary-expression before 'int'
   13 |   vecot<int>A(N);
      |         ^~~
a.cc:17:5: error: 'A' was not declared in this scope
   17 |     A.at(i)=j;
      |     ^
Language: C++

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

ll n,m,q,an=0,tm=0;
ll A[11],a[51],b[51],c[51],d[51];

void dfs(ll dep,ll now){
    tm=0;
    A[dep]=now;
    if(dep==n-1){
        rep(i,0,q){
            if(A[b[i]]-A[a[i]]==c[i])tm+=d[i];
        }
        an=max(an,tm);
        return;
    }
    
    rep(i,now,m+1){
        dfs(dep+1,i);
    }
}

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









Compiler output:
a.cc: In function 'void dfs(ll, ll)':
a.cc:10:5: error: reference to 'tm' is ambiguous
   10 |     tm=0;
      |     ^~
In file included from /usr/include/time.h:39,
                 from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:6:15: note:                 'll tm'
    6 | ll n,m,q,an=0,tm=0;
      |               ^~
a.cc:14:38: error: reference to 'tm' is ambiguous
   14 |             if(A[b[i]]-A[a[i]]==c[i])tm+=d[i];
      |                                      ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:6:15: note:                 'll tm'
    6 | ll n,m,q,an=0,tm=0;
      |               ^~
a.cc:16:19: error: reference to 'tm' is ambiguous
   16 |         an=max(an,tm);
      |                   ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:6:15: note:                 'll tm'
    6 | ll n,m,q,an=0,tm=0;
      |               ^~
Language: C++

n, m, q = gets.split.map(&:to_i)
points = []
q.times { points.push(gets.split.map(&:to_i)) }
arr = [*1..m]
combs = arr.combination(n).to_a
ans = 0

combs.each do |comb|
  score = 0
  points.each do |point|
    score += point[3] if comb[point[1] - 1] - comb[point[0] - 1] == point[2]
  end
  puts score
  ans = score if ans < score
end
puts ans


Compiler output:
a.cc:4:9: error: too many decimal points in number
    4 | arr = [*1..m]
      |         ^~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n, m, q = gets.split.map(&:to_i)
      | ^
a.cc:4:1: error: 'arr' does not name a type
    4 | arr = [*1..m]
      | ^~~
Language: C++

#include <bits/stdc++.h>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define drep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = int_max / 2; const ll infl = 1ll << 60;
template<class t>bool chmax(t& a, const t& b) { if (a < b) { a = b; return 1; } return 0; }
template<class t>bool chmin(t& a, const t& b) { if (b < a) { a = b; return 1; } return 0; }

//---------------------------------------------------------------------------------------------------
ll combination(vector<vector<ll>> li, ll min, ll count, vector<ll> a, ll n, ll m_max) {
    ll max = 0, res;
    rep(j, min, m_max + 2){
        a[count] = j;
        if (count!=n-1) {
            res = combination(li, j, count+1, a, n ,m_max);
        }else{
            rep(i, 0, n) {
                cout << a[i];
            }
            cout << endl;
            ll sum = 0;
            fore(q, li) {
                if ((a[q[1]-1] - a[q[0]-1]) == q[2])  {
                    sum += q[3];
                }
            }
            res = sum;
        }
        if (max < res) max = res;
    }
    return max;
}

void _main() {
    ll n, m ,q;
    cin >> n >> m >> q;
    vector<vector<ll>> li;
    rep(i, 0, q) {
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        li.push_back(vector<ll>{a,b,c,d});
    }
    vector<ll> a(n);
    ll res, max = 0;
    ll m_max = ((m < 10) ? m : 10);
    rep(i, 1, m_max + 2) {
        a[0] = i;
        res = combination(li,i,1,a,n,m_max);
        if (res > max) max = res;
    }
    cout << max << endl;
}

Compiler output:
a.cc:9:39: error: 'int_max' was not declared in this scope
    9 | typedef long long ll; const int inf = int_max / 2; const ll infl = 1ll << 60;
      |                                       ^~~~~~~
Language: C++

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

int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> A(q);
  for(int i = 0; i < q; i++) {
    int a, b, c;
    int64_t d;
    cin >> a >> b >> c >> d;
    A.at(i) = make_tuple(d, c, b, a);
  }
  
  MargeSort(A.begin(), A.end());
  
  int64_t sum = 0;
  for(int i = 0; i < q; i++) {
    int d, c, b, a;
    tie(d, c, b, a) = A.at(i);
    if(i > 2) {
      if(A.at(i) == A.at(i+1)) continue;
    }
    if(c == b - a) {
      sum += d;
    }
  }
  cout << sum << endl;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'MargeSort' was not declared in this scope
   15 |   MargeSort(A.begin(), A.end());
      |   ^~~~~~~~~
Language: C++

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

int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> A(q);
  for(int i = 0; i < q; i++) {
    int a, b, c;
    int64_t d;
    cin >> a >> b >> c >> d;
    A.at(i) = make_tuple(d, c, b, a);
  }
  sort(A.begin(), A.end())
  int64_t sum = 0;
  for(int i = 0; i < q; i++) {
    int d, c, b, a;
    tie(d, c, b, a) = A.at(i);
    if(i > 2) {
      if(A.at(i) == A.at(i+1)) continue;
    }
    if(c == b - a) {
      sum += d;
    }
  }
  cout << sum << endl;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: expected ';' before 'int64_t'
   14 |   sort(A.begin(), A.end())
      |                           ^
      |                           ;
   15 |   int64_t sum = 0;
      |   ~~~~~~~                  
a.cc:23:7: error: 'sum' was not declared in this scope
   23 |       sum += d;
      |       ^~~
a.cc:26:11: error: 'sum' was not declared in this scope
   26 |   cout << sum << endl;
      |           ^~~
Language: C++

#include <stdio.h>
int i, j, n, m, k, a[1005], b[1005], Q[1005][1005];
void dfs(int i){
 for(i=1; i<=n; i++){
  for(j=1; j<=m; j++){
  scanf("%d%d", &a, &b);
  scanf("%d", &Q); 
  }
 }
int main(){
 scanf("%d%d", &n, &m);
 for(i=1; i<=n; i++){
  for(j=1; j<=m; j++){
   n*m + (n+m) = Q;
  }
 }
 printf("%d\n", ans);
 return 0;
} 

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

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

const int N = 10 + 5;

struct data{
  int a, b, c, d;
};

data cur[N];

void print(vector<int> v) {
  for (auto it : v)
    cout << it << " ";
  cout << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    

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

    vector<int> store;
    for (int i = 1; i <= m; i++){
        store.push_back(i);
    }

    int mx = -1e18;
    
    for (int msk = 0; msk < 1 << m; msk++){
      vector<int> copy;
      for (int i = 0; i < m; i++){
          if (msk & (1 << i))
            copy.push_back(store[i]);
        }
        if (copy.size() == n){
        int score = 0ll;
        for (int i = 0; i < Q; i++){
          if (copy[cur[i].b - 1] - copy[cur[i].a - 1] == cur[i].c)
            score += cur[i].d;
        }
        mx = max(mx, score);
      }
    }
    cout << mx << endl;
}

Compiler output:
a.cc:12:1: error: reference to 'data' is ambiguous
   12 | data cur[N];
      | ^~~~
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:8:8: note:                 'struct data'
    8 | struct data{
      |        ^~~~
a.cc: In function 'int32_t main()':
a.cc:27:14: error: 'cur' was not declared in this scope
   27 |       cin >> cur[i].a >> cur[i].b >> cur[i].c >> cur[i].d;
      |              ^~~
a.cc:46:20: error: 'cur' was not declared in this scope
   46 |           if (copy[cur[i].b - 1] - copy[cur[i].a - 1] == cur[i].c)
      |                    ^~~
Language: C

#include <stdio.h>
int main(){
  int n,m,q,i,j;
  scanf("%d %d %d",n,m,q);
  int ans[n],p;
  int a[q],b[q],c[q],d[q];
  for(i=0;i<q;i++){
    scanf("%d %d %d %d",a[i],b[i],c[i],d[i]);
  }
  
  for(j=0;j<q;j++){
    if(ans[b[j]]-ans[a[j]]==c[j]){
      p[k]=p[k]+d[j];
    }
  }
  if(p<p[k])p=p[k];
  
  printf("%d",p)
}

Compiler output:
main.c: In function 'main':
main.c:13:9: error: 'k' undeclared (first use in this function)
   13 |       p[k]=p[k]+d[j];
      |         ^
main.c:13:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:17: error: expected ';' before '}' token
   18 |   printf("%d",p)
      |                 ^
      |                 ;
   19 | }
      | ~
Language: Java



public class Main {
    static int n,m,q;
    static ABCD[] array;
    static int max;
    static int[] A;
    public static void main(String[] args) {
       
        FastScanner fs = new FastScanner();
        n = fs.nextInt();
        m = fs.nextInt();
        q = fs.nextInt();
        array = new ABCD[q];
        max = 0;
        A = new int[n];
        for(int i=0;i<q;i++){
            array[i] = new ABCD(fs.nextInt(),fs.nextInt(),fs.nextInt(),fs.nextInt());
        }

        combination(0,0,1);
        
        System.out.println(max);


    }
    public static void combination(int pos ,int count,int val){
        if(count == n){
            int sum = 0;
            for(int i=0;i<q;i++){
                if(A[array[i].b-1]-A[array[i].a-1] == array[i].c){
                    sum+=array[i].d;
                }
            }
            max = Math.max(sum,max);
        }else{
            for(int i=val;i<=m;i++){
                A[pos] = i;
                combination(pos+1,count+1,i);
            }
        }
    }
}

class ABCD{
    int a,b,c,d;
    ABCD(int a,int b,int c,int d){
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
    }
}


Compiler output:
Main.java:10: error: cannot find symbol
        FastScanner fs = new FastScanner();
        ^
  symbol:   class FastScanner
  location: class Main
Main.java:10: error: cannot find symbol
        FastScanner fs = new FastScanner();
                             ^
  symbol:   class FastScanner
  location: class Main
2 errors
Language: C++

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

int main() {
  short int n,m,q;
  cin >>n>>m>>q;
  vector<vector<int>> table(q,vector<int>(4));
  for(int i=0;i < q;i++){
    for(int j=0;j < 4;l++){
      cin >>table.at(i).at(j);
    }
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: 'l' was not declared in this scope
    9 |     for(int j=0;j < 4;l++){
      |                       ^
Language: C

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define PI 3.14159265358979
#define a .second.first
#define b .second.second.first
#define c .second.second.second
#define d .first
typedef long long int ll;

const double pi=3.1415;

int main()
{
   int n,m,q,ans=0;
   string s,t;
   cin>>n>>m>>q;
   vector<int>A(n,0);
   vector<bool>flag(n);
   rep(i,n)flag[i]=true;
   vector<pair<int,pair<int,pair<int,int>>>>in(q);
   rep(i,q){
   	cin>>in[i].second.first>>in[i].second.second.first>>in[i].second.second.second>>in[i].first	;
   	in[i].second.first--;
   	in[i].second.second.first--;
   	}
   sort(in.rbegin(),in.rend());
   	rep(i,q)
   	cout<<in[i].first<<endl;
   for(int i=0;i<q;i++)
   {
   	
   	if(flag[in[i].second.second.first]||A[in[i].second.second.first]==A[in[i].second.first]+in[i].second.second.second){
   		flag[in[i].second.second.first]=false;
   		A[in[i].second.second.first]=A[in[i].second.first]+in[i].second.second.second;
   		ans+=in[i].first;
   		cout<<in[i].first<<endl;
   	}
   	else if(flag[in[i].second.first]||A[in[i].second.second.first]==A[in[i].second.first]+in[i].second.second.second){
   		flag[in[i].second.first]=false;
   		A[in[i].second.second.first]=A[in[i].second.first]+in[i].second.second.second;
   		ans+=in[i].first;
   		cout<<in[i].first<<endl;
   	}
   }
   cout<<endl;
   for(int i=0;i<n;i++)
   {
   	
   	cout<<A[i]<<endl;
   }
   cout<<ans;
}


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

//100	
#include <bits/stdc++.h>
#define ljc 1000000007
using namespace std;
int n,q,a[200005],b[200005],c[200005];
freopen("m.in","r",stdin);
freopen("m.out","w",stdout);
long long ans=1;
inline int read(){
    int x=0;char ch=getchar();
    while(!isdigit(ch)) ch=getchar();
    while(isdigit(ch)) x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
    return x;
}
inline long long fast_pow(int a,int b,int p){
    long long s=1,t=a,k=b;
    while(k){
        if (k%2) s=s*t%p;
        t=t*t%p;
        k/=2;
    }
    return s;
}
inline long long max(long long a,long long b){
    if(a>b) return a;return b;
}
inline long long min(long long a,long long b){
    if(a<b) return a;return b;
}
int main(){
    n=read(),q=read();
    for(register int i=1;i<=n;i++){
        a[i]=read();
        c[i]=max(c[i-1],a[i]);
    }
    for(register int i=1;i<=n;i++){
        b[i]=read();
        ans=min(b[i],c[i])*ans%ljc;
    }
    int opt,x,y;
    for(register int i=1;i<=q;i++){
        opt=read(),x=read(),y=read();
        if(opt==1){
            if(b[x]<c[x]){
                ans=ans*fast_pow(b[x],ljc-2,ljc)%ljc;
                ans=ans*min(y,c[x])%ljc;
            }
            b[x]=y;
        }
        if(opt==0){
            a[x]=y;
            while(y>c[x]&&x<=n){
                if(c[x]<b[x]){
                    ans=ans*fast_pow(c[x],ljc-2,ljc)%ljc;
                    ans=ans*min(y,b[x])%ljc;
                }
                c[x++]=y;
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Compiler output:
a.cc:6:8: error: expected constructor, destructor, or type conversion before '(' token
    6 | freopen("m.in","r",stdin);
      |        ^
a.cc:7:8: error: expected constructor, destructor, or type conversion before '(' token
    7 | freopen("m.out","w",stdout);
      |        ^
a.cc: In function 'int main()':
a.cc:32:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |     for(register int i=1;i<=n;i++){
      |                      ^
a.cc:36:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |     for(register int i=1;i<=n;i++){
      |                      ^
a.cc:41:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   41 |     for(register int i=1;i<=q;i++){
      |                      ^
Language: C++

#include "algorithm"
#include "iomanip"
#include "iostream"
#include "queue"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;

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

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

template <typename T>
void drop(const T& x) {
  cout << x << endl;
  exit(0);
}

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

  ll N, M, Q;
  cin >> N >> M >> Q;

  struct Val {
    ll a, b, c, d;
  };

  V<Val> vs(Q);

  rep(i, Q) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    vs[i] = {a, b, c, d};
  }

  ll res = 0;

  repf(a1, 1, M + 1) repf(a2, a1, M + 1) repf(a3, a2, M + 1) repf(a4, a3, M + 1)
      repf(a5, a4, M + 1) repf(a6, a5, M + 1) repf(a7, a6, M + 1)
          repf(a8, a7, M + 1) repf(a9, a8, M + 1) repf(a10, a9, M + 1) {
    VL a = {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10};

    ll s = 0;
    for (auto v : vs) {
      if (a[v.b] - a[v.a] == v.c) s += v.d;
    }

    chmax(res, s);
  }

  cout << res << "\n";

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:5: error: 'VL' was not declared in this scope; did you mean 'V'?
   65 |     VL a = {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10};
      |     ^~
      |     V
a.cc:69:11: error: 'a' was not declared in this scope
   69 |       if (a[v.b] - a[v.a] == v.c) s += v.d;
      |           ^
Language: C++

#include "algorithm"
#include "iomanip"
#include "iostream"
#include "queue"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;

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

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

template <typename T>
void drop(const T& x) {
  cout << x << endl;
  exit(0);
}

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

    ll N, M, Q;
  cin >> N >> M >> Q;

  struct Val {
    ll a, b, c, d;
  };

  V<Val> vs(Q);

  rep(i, Q) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    vs[i] = {a, b, c, d};
  }

  ll res = 0;

  repf(a1, 1, M + 1) repf(a2, a1, M + 1) repf(a3, a2, M + 1) repf(a4, a3, M + 1)
      repf(a5, a4, M + 1) repf(a6, a5, M + 1) repf(a7, a6, M + 1)
          repf(a8, a7, M + 1) repf(a9, a8, M + 1) repf(a10, a9, M + 1) {
    VL a = {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10};

    ll s = 0;
    for (auto v : vs) {
      if (a[v.b] - a[v.a] == v.c) s += v.d;
    }

    chmax(res, s);
  }

  cout << res << "\n";

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:8: error: 'a1' was not declared in this scope
   62 |   repf(a1, 1, M + 1) repf(a2, a1, M + 1) repf(a3, a2, M + 1) repf(a4, a3, M + 1)
      |        ^~
a.cc:62:3: error: 'repf' was not declared in this scope; did you mean 'rep1'?
   62 |   repf(a1, 1, M + 1) repf(a2, a1, M + 1) repf(a3, a2, M + 1) repf(a4, a3, M + 1)
      |   ^~~~
      |   rep1
Language: C++

n,m,q = map(int, input().split())
cons = []
for _ in range(q):
  con = list(map(int, input().split()))
  cons.append(con)

def next(an):
  for i in range(n)[::-1]:
    if an[i]==m:
      an[i]=0
    else:
      an[i] += 1
      break
  for i in range(n-1):
    if an[i+1]==0:
      an[i+1] = an[i]
  return an

an = [1] * n
max_score = 0

while True:
  score = 0
  if an[0]==0:
    break
  for i in range(q):
    a,b,c,d = cons[i]
    if an[b-1] - an[a-1] == c:
      score += d
  if score > max_score:
    max_score = score
  an = next(an)

print(max_score)



Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,m,q = map(int, input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
ll sum(vector<int>v, vector<int> a,  vector<int> b,  vector<int> c,vector<int>d){
  ll ans=0;
  rep(i,n){
    if(v[b[i]]-v[a[i]]==c[i])ans+=d[i];
  }
  return ans;
}
    

int main() {
  int n ,m ,q;
  cin>>n>>m>>q;
  vector<int> v(n,1);
  vector<int> a(q);
  vector<int> b(q);
  vector<int> c(q);
  vector<int> d(q);
    rep(i,q){
      cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
  m++;
  ll ans=0;
  for(v[n]=0;v[n]<m;v[n]++){
    for(v[n-1]=v[n];v[n-1]<m;v[n-1]++){
      if(n>2){
        for(v[n-2]=v[n-1];v[n-2]<m;v[n-2]++){
          if(n>3){
            for(v[n-3]=v[n-2];v[n-3]<m;v[n-3]++){
              if(n>4){
                for(v[n-4]=v[n-3];v[n-4]<m;v[n-4]++){
                  if(n>5){
                    for(v[n-5]=v[n-4];v[n-5]<m;v[n-5]++){
                      if(n>6){
                        for(v[n-6]=v[n-5];v[n-6]<m;v[n-6]++){
                          if(n>7){
                            for(v[n-7]=v[n-6];v[n-7]<m;v[n-7]++){
                              if(n>8){
                                for(v[n-8]=v[n-7];v[n-8]<m;v[n-8]++){
                                  if(n>9){
                                    for(v[n-9]=v[n-8];v[n-9]<m;v[n-9]++){
                                      ans=max(sum(v,a,b,c,d),ans);
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  cout<<ans<<endl;
} 

Compiler output:
a.cc: In function 'll sum(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
a.cc:13:9: error: 'n' was not declared in this scope
   13 |   rep(i,n){
      |         ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^
Language: C++

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

int sum_point(vector<vector<int>> &data, vector<int> &A) {
  int point = 0;
  for (int i = 0; i < Q; i++) {
    if (A.at(data.at(i).at(1)) - A.at(data.at(i).at(0)) == data.at(i).at(2)) {
      point += data.at(i).at(3);
    }
  }
  return point;
}

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<vector<int>> data(Q, vector<int>(4));
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> data.at(i).at(j);
    }
  }
  vector<int> A(N, 1);
  int ans = sum_point(data, A);
  while (true) {
    A.at(N - 1) = vector.at(N - 1) + 1;
    for (int i = N - 1; i > 0; i--) {
      if (A.at(i) == M + 1) {
        int num = A.at(i - 1);
        A.at(i - 1) = num + 1;
        A.at(i) = 1;
      }
    }
    if (A.at(0) == M + 1) {
      cout << ans << endl;
      break;
    }
    int sum = sum_point(data, A);
    ans = max(ans, sum);
  }
}

Compiler output:
a.cc: In function 'int sum_point(std::vector<std::vector<int> >&, std::vector<int>&)':
a.cc:6:23: error: 'Q' was not declared in this scope
    6 |   for (int i = 0; i < Q; i++) {
      |                       ^
a.cc: In function 'int main()':
a.cc:26:25: error: missing template arguments before '.' token
   26 |     A.at(N - 1) = vector.at(N - 1) + 1;
      |                         ^
Language: C++

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std ;

const int MAX = 10 ;

int arr[MAX] ;
int n , m , q ;
int dp[MAX][1<<MAX][1<<MAX] ;
vector< vector< array<int , 3> > >v(MAX) ;

int solve(int idx , int mask1 , int mask2 , int cur)
{
	if(idx == n)
		return 0 ;
	int &ret = dp[idx][mask1][mask2] ;
	if(ret != -1)
		return ret ;
	int sum = 0 ;
	for(auto &i : v[idx])
	{
		int a = i[0] , c = i[1] , d = i[2] ;
		int y = (1 << (a+1)) - 1 ;
		int x = __builtin_popcount((y & mask1)) ;
		int cnt = 0 ;
		int now = -1 ;
		for(int k = 0 ; k < 10 ; ++k)
		{
			if((mask2 & (1 << k)))
			{
				cnt++ ;
				if(cnt == x)
				{
					now = k ;
					break ;
				}
			}
		}
		if(cur-now == c)
			sum += d ;
	}
	ret = solve(idx+1 , mask1 , mask2 , cur) ;
	for(int i = cur+1 ; i < m && idx < n-1 ; ++i)
		ret = max(ret , solve(idx+1 , mask1 | (1 << (idx+1)) , mask2 | (1 << i) ,i)) ;
	ret += sum ;
	return ret ;
}

int main()
{
	memset(dp , -1, sizeof(dp)) ;
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m>>q ;
	for(int i = 0 ; i < q ; ++i)
	{
		int a , b , c , d ;
		cin>>a>>b>>c>>d ;
		--a , --b ;
		v[b].push_back({a,c,d}) ;
	}
	int ans = -1e9 ;
	for(int i = 0 ; i < m ; ++i)
		ans = max(ans , solve(0 , 1 , 1 << i , i)) ;
	return cout<<ans<<"\n" , 0 ;
}		

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<std::vector<std::array<int, 3> >, std::allocator<std::vector<std::array<int, 3> > > >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::vector<std::array<int, 3> >]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
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:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5;
ll ans,n,m,q;
class obj{
public:
    ll a,b,c,d;
}queries[55];
void func(ll idx,ll mx,vector<ll> v){
    if(idx==n){
        ll sum = 0;
        for(ll i=0;i<q;i++){
            if(v[queries[i].b-1]-v[queries[i].a-1] == queries[i].c)
                sum+=queries[i].d;
        }
        ans=max(ans , sum);
        return;
    }
    for(ll i=mx;i<=m;i++){
        v.push_back(i);
        func(idx+1,i,v);
        v.pop_back();
    }
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m>>q;
    for(ll i=0;i<q;i++)cin>>queries[i].a>>queries[i].b>>queries[i].c>>queries[i].d;
    vector<ll> v;
    func(0,1,v);
    cout<<ans;
}


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

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

int retsu[10];
int ans = 0;
int n, m, q;
int a[55], b[55], c[55], d[55];
void dfs(int num, int last){
  //長さがnなら得点を数える
  // cout << "(" << num << "," << n << ")";
  if(num == n){
    int tmp = 0;
    for(int i=0;i<q;i++){
      if(retsu[b[i]-1]-retsu[a[i]-1]==c[i])tmp += d[i];
    }
    ans = max(ans, tmp);
    // cout << "[" << ans << "]";
    return;
  }
  for(int i=last;i<=m;i++){
    retsu[num]=i;
    dfs(num+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, 0);
  
  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>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
#define EN cout<<endl;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 ll dp[2000][2000];

ll n ,m,q,z[1010]={};
ll a[101],b[101],c[101],d[101];

ll co(ll cn,ll sum,vector<ll>v){

    if(v.size()>=n){
        ll ans=0;
        rep(j,q){
            if(v[b[j]-1]-v[a[j]-1]==c[j]){
                ans+=d[j];
            }
        }
        return ans;
    }
    REP(i,cn,m+1){
        ll sum2=sum;
        vector<ll> v2=v;
        v2.pb(i);
        
        sum=max(sum,co(i,sum2,v2));
    }
    return sum;
}

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

   rep(i,q){
       cin>>a[i]>>b[i]>>c[i]>>d[i];
   }
   cout<<co(1,0,{})<<endl;;

}


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

#include<iostream>
#include<vector>
using namespace std;
#define int long long int
int count=0;
int answer=0;
void function(vector<int> &v,int initial,int final,int prev,int m,int arr[][4],int q)
{
	if(initial>final)
	{
		count++;
		int here=0;
		int j;
		for(j=0;j<q;j++)
		{
			int a=arr[j][0]-1;
			int b=arr[j][1]-1;
			int c=arr[j][2];
			int d=arr[j][3];
			if(v[b]-v[a]==c)
			{
				here+=d;
			}
		}
		answer=max(answer,here);
	}
	else
	{
		int j;
		for(j=prev;j<=m;j++)
		{
			v.push_back(j);
			function(v,initial+1,final,j,m,arr,q);
			v.pop_back();
		}
	}
}
int32_t main()
{
	int n,m,q;
	cin>>n>>m>>q;
	int arr[q][4];
	int j;
	for(j=0;j<q;j++)
	{
		cin>>arr[j][0]>>arr[j][1]>>arr[j][2]>>arr[j][3];
	}
	for(j=1;j<=m;j++)
	{
		vector<int> v;
		v.push_back(j);
		function(v,1,n-1,j,m,arr,q);
	}
	cout<<answer<<endl;
}


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

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

// Template Headers {{{
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long; using vll = vector<long long>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}

int solve() {
	int n, m, q; cin >> n >> m >> q;
	using jeng = pair<pii, pii>;
	vector<jeng> v(q); cin >> v;
	vi a(n);
	int ans = 0;
	function<void(int)> ha = [&] (int u) {
		if (u >= n) {
			int cur = 0;
			for (auto [ab, cd] : v) {
				auto [ai, bi] = ab;
				auto [ci, di] = cd;
				ai--, bi--;
				if (a[bi] - a[ai] == ci) {
					cur += di;
				}
			}
			ans = max(ans, cur);
		} else {
			int mn = 1;
			if (u > 0) mn = a[u - 1];
			for (int j = mn; j <= m; j++) {
				a[u] = j;
				ha(u + 1);
			}
		}
	};
	ha(0);
	cout << ans << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	// precompute();
	// int t; cin >> t; for (int i=1;i<=t;i++)
	solve();
	// cout << "Case #" << i << ": ", solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


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

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

struct q {
    int a, b, c, d;
    void input() { cin >> a >> b >> c >> d; }
    bool operator<(const q& tmp) const {
        return d < tmp.d;
    }
};

ll ret;
int N, M, Q;
int a[101], b[101], c[101], d[101];

int ans[101];
void solve(int i, int ma=1) {
    if (i >= N) {
        // ok
        ll tmp = 0;
        rep(i, Q) {
            if (ans[b[i]-1] - ans[a[i]-1] == c[i]) tmp += d[i];
        }
        ret = max(ret, tmp);
        return;
    }

    for (int j=ma; j<=M; ++j) {
        ans[i] = j;
        solve(i+1, j);
        ans[i] = -1;
    }
    return;
}

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


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

#include <stdio.h>
#include <algorithm>
using namespace std;

int a[55], b[55], c[55], d[55], A[11], n, m, q, ans;

void recursion(int lev)
{
	int i;

	if (lev > n)
	{
		int sum = 0;
		for (i = 1; i <= q; i++)
			if (A[b[i]] - A[a[i]] == c[i])
				sum += d[i];
		ans = max(ans, sum);
	}
	else
	{
		for (i = A[lev - 1]; i <= m; i++)
		{
			A[lev] = i;
			recursion(lev + 1);
		}
	}
}

int main(void)
{
	int i;

	scanf("%d %d %d", &n, &m, &q);
	for (i = 1; i <= q; i++)
		scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);

	A[0] = 1;
	recursion(1);

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

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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b,c;
  ll d=0;
  for(ll i=0;i<=c;i++){
    d=max(a*i/b-a*(i/b));
  }
  cout<<d<<endl;
}
  
  
    
    
  


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: no matching function for call to 'max(ll)'
    8 |     d=max(a*i/b-a*(i/b));
      |       ~~~^~~~~~~~~~~~~~~
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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:8:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
    8 |     d=max(a*i/b-a*(i/b));
      |       ~~~^~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided