Language: C++

    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
     
    int main() {
        ll N, X;
        cin >> N >> X;
        vector<ll> A(N), B(N);
     
        for (auto &e : A) cin >> e;
     
        ll minv = accumulate<ll>(begin(A), end(A), 0);
        for (int i = 1; i < N; i++) {
            for (int j = 0; j < N; j++) B[(j+1)%N] = min(A[(j+1)%N], A[j]);
            A = B;
            minv = min(minv, accumulate<ll>(begin(A), end(A), 0) + i * X);
        }
        cout << minv << endl;
        return (0);
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: no matching function for call to 'accumulate<ll>(std::vector<long long int>::iterator, std::vector<long long int>::iterator, int)'
   12 |         ll minv = accumulate<ll>(begin(A), end(A), 0);
      |                   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   template argument deduction/substitution failed:
a.cc:12:39: note:   cannot convert 'std::begin<vector<long long int> >(A)' (type 'std::vector<long long int>::iterator') to type 'long long int'
   12 |         ll minv = accumulate<ll>(begin(A), end(A), 0);
      |                                  ~~~~~^~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 3 provided
a.cc:16:44: error: no matching function for call to 'accumulate<ll>(std::vector<long long int>::iterator, std::vector<long long int>::iterator, int)'
   16 |             minv = min(minv, accumulate<ll>(begin(A), end(A), 0) + i * X);
      |                              ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   template argument deduction/substitution failed:
a.cc:16:50: note:   cannot convert 'std::begin<vector<long long int> >(A)' (type 'std::vector<long long int>::iterator') to type 'long long int'
   16 |             minv = min(minv, accumulate<ll>(begin(A), end(A), 0) + i * X);
      |                                             ~~~~~^~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 3 provided