Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
ll n, m, q;
vector<ll> res2(n);
vector<ll> tu(ll u)
{ //u番目からスタート
    vector<ll> res(n);

    if (u == 0)
    {
        rep(i, n)
        {
            res[i] = 1;
        }
        res2 = res;
        return res;
    }
    res = res2;
    int flag = 1;
    for (int i = n - 1; i >= 0; i--)
    {
        if (res[i] != 10)
        {
            res[i] = res[i] + 1;
            flag = 0;
            break;
        }
        if (i != 0)
        {
            if (res[i] == 10)
            {
                int l = 0;
                for (l = i - 1; l >= 0; l--)
                {
                    if (res[l] != 10)
                    {
                        break;
                    }
                }
                for (int p = l + 1; p < i + 1; p++)
                {
                    res[p] = res[l] + 1;
                }
                i = l + 1;
            }
        }
    }
    res2 = res;
    return res;
}
int main()
{

    cin >> n >> m >> q; //n=10,M=10,Q=50
    vector<ll> a(q), b(q), c(q), d(q);
    rep(i, q)
    {
        int a1 = 0;
        int b1 = 0;

        cin >> a1 >> b1 >> c[i] >> d[i];
        a1--;
        b1--;

        a[i] = a1;
        b[i] = b1;
    }
    ll k = 0;
    vector<ll> res(n);
    res = tu(60);
    ll max1 = 0;
    while (1)
    {
        ll count = 0;
        vector<int> res(n);

        res = tu(k);
        rep(t, q)
        {
            if (res[a[t]] - res[b[t]] == -c[t])
            {
                count += d[t];
            }
        }

        max1 = max(max1, count);

        k++;
        int flag = 1;
        for (int i = n - 1; i >= 0; i--)
        {
            if (res[i] != 9)
            {
                flag = 0;
                break;
            }
        }
        if (flag == 1)
        {
            break;
        }
    }
    cout << max1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:19: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>')
   79 |         res = tu(k);
      |                   ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~