Language: C++

#include <bits/stdc++.h>
//#include <rng_58>
//#include <chokudai>
//#include <tourist>
using namespace std;
 
// Macro and Macro Functions
#define rep(a, b) for(int a = 0; a < b; ++a)
#define REP(a, b, c) for(int a = b; a < c; ++a)
#define drep(a, b, c) for(int a=0,b=0;b<c?:(b=0,++a<c);++b)
#define int long long
#define SORT(a) sort(ALL(a))
#define RSORT(a) sort(RALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MOD 1000000007
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define ALLIN(a) rep(nanika,a.size()) cin>>a[nanika]
#define ALLINDE(a) rep(kyawa,a.size()){cin>>a[kyawa]; --a[kyawa];}
#define YN(a) do{if(a) cout<<"YES"; else cout<<"NO";}while(0)
#define Yn(a) do{if(a) cout<<"Yes"; else cout<<"No";}while(0)
#define yn(a) do{if(a) cout<<"yes"; else cout<<"no";}while(0)
#define spa " "
#define dspa "  "
#define ctoi(c) (c)-'0'
#define altoi(a) (a)-'a'
#define fi first
#define se second
#define dvec_int(name,row,column,value) vector<vector<int>> name(row,vector<int>(column,value))
 
// List of using
using ll   = signed long long;
using ull  = unsigned long long;
using pint = pair<int,  int>;
using pong = pair<long, long>;
using tint = tuple<int,  int,  int>;
using tong = tuple<long, long, long>;
using vint = vector<int>;
using vll  = vector<long long>;
using vbol = vector<bool>;
using vstr = vector<string>;
using vull = vector<unsigned long long>;
using dvin = vector<vector<int>>;
using dvbo = vector<vector<bool>>;
using mint = map<int,int>;
 
// Common Variable
bool DEBUG=false;
long long INF=2000000000;
 
void print(){
  cout<<'\n';
}
 
template<class HEAD,class... TAIL>
void print(HEAD&& head,TAIL&&... tail){
  cout<<head<<spa;
  print(forward<TAIL>(tail)...);
}
 
void scan(){}
 
template<class HEAD,class... TAIL>
void scan(HEAD&& head,TAIL&&... tail){
  cin>>head;
  scan(forward<TAIL>(tail)...);
}
 
template<typename t>
void print(vector<t> &v){
  rep(i,v.size()){
    cout<<v[i]<<spa;
  }
  cout<<endl;
}
 
template<typename t, typename u>
void print(vector<pair<t,u>> &v){
  rep(i,v.size()){
    cout<<i<<" : "<<v[i].first<<" "<<v[i].second<<endl;
  }
}
 
template<typename t,typename u>
t min(t a,u b){
  return a<=b?a:b;
}
 
//--------------------------------
// Template Place
//--------------------------------
int dx[]={ 1, 0,-1, 0};
int dy[]={ 0,-1, 0, 1};
 
signed main(){
  int n,x; cin>>n>>x;
  vint a(n); ALLIN(a);
  //dvec_int(dp,n,n,0);
  vector<vector<int>> dp(n,vector<int>(n,0));
 
  int ans=0,ans_i=0;
  for(int j=0; j<n; ++j){
    dp[0][j]=a[j];
    ans+=a[j];
  }
  for(int i=1; i<n; ++i){
    int tmp=0;
    for(int j=0; j<n; ++j){
      dp[i][j]=min(dp[i-1][j],a[(j-i+n)%n]);
      tmp+=dp[i][j];
    }
    // print(i,":",tmp,"+",i*x,"=",tmp+i*x,"Minimum :",ans,ans_i);
    tmp+=i*x;
    if(ans>tmp){
      ans=tmp;
      ans_i=i;
    }
  }
 
  // rep(i,n){
  //   rep(j,n){
  //     cout<<setw(4)<<dp[i][j];
  //   }
  //   cout<<endl;
  // }
 
  cout<<ans;
}#include <bits/stdc++.h>
//#include <rng_58>
//#include <chokudai>
//#include <tourist>
using namespace std;
 
// Macro and Macro Functions
#define rep(a, b) for(int a = 0; a < b; ++a)
#define REP(a, b, c) for(int a = b; a < c; ++a)
#define drep(a, b, c) for(int a=0,b=0;b<c?:(b=0,++a<c);++b)
#define int long long
#define SORT(a) sort(ALL(a))
#define RSORT(a) sort(RALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MOD 1000000007
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define ALLIN(a) rep(nanika,a.size()) cin>>a[nanika]
#define ALLINDE(a) rep(kyawa,a.size()){cin>>a[kyawa]; --a[kyawa];}
#define YN(a) do{if(a) cout<<"YES"; else cout<<"NO";}while(0)
#define Yn(a) do{if(a) cout<<"Yes"; else cout<<"No";}while(0)
#define yn(a) do{if(a) cout<<"yes"; else cout<<"no";}while(0)
#define spa " "
#define dspa "  "
#define ctoi(c) (c)-'0'
#define altoi(a) (a)-'a'
#define fi first
#define se second
#define dvec_int(name,row,column,value) vector<vector<int>> name(row,vector<int>(column,value))
 
// List of using
using ll   = signed long long;
using ull  = unsigned long long;
using pint = pair<int,  int>;
using pong = pair<long, long>;
using tint = tuple<int,  int,  int>;
using tong = tuple<long, long, long>;
using vint = vector<int>;
using vll  = vector<long long>;
using vbol = vector<bool>;
using vstr = vector<string>;
using vull = vector<unsigned long long>;
using dvin = vector<vector<int>>;
using dvbo = vector<vector<bool>>;
using mint = map<int,int>;
 
// Common Variable
bool DEBUG=false;
long long INF=2000000000;
 
void print(){
  cout<<'\n';
}
 
template<class HEAD,class... TAIL>
void print(HEAD&& head,TAIL&&... tail){
  cout<<head<<spa;
  print(forward<TAIL>(tail)...);
}
 
void scan(){}
 
template<class HEAD,class... TAIL>
void scan(HEAD&& head,TAIL&&... tail){
  cin>>head;
  scan(forward<TAIL>(tail)...);
}
 
template<typename t>
void print(vector<t> &v){
  rep(i,v.size()){
    cout<<v[i]<<spa;
  }
  cout<<endl;
}
 
template<typename t, typename u>
void print(vector<pair<t,u>> &v){
  rep(i,v.size()){
    cout<<i<<" : "<<v[i].first<<" "<<v[i].second<<endl;
  }
}
 
template<typename t,typename u>
t min(t a,u b){
  return a<=b?a:b;
}
 
//--------------------------------
// Template Place
//--------------------------------
int dx[]={ 1, 0,-1, 0};
int dy[]={ 0,-1, 0, 1};
 
signed main(){
  int n,x; cin>>n>>x;
  vint a(n); ALLIN(a);
  //dvec_int(dp,n,n,0);
  vector<vector<int>> dp(n,vector<int>(n,0));
 
  int ans=0,ans_i=0;
  for(int j=0; j<n; ++j){
    dp[0][j]=a[j];
    ans+=a[j];
  }
  for(int i=1; i<n; ++i){
    int tmp=0;
    for(int j=0; j<n; ++j){
      dp[i][j]=min(dp[i-1][j],a[(j-i+n)%n]);
      tmp+=dp[i][j];
    }
    // print(i,":",tmp,"+",i*x,"=",tmp+i*x,"Minimum :",ans,ans_i);
    tmp+=i*x;
    if(ans>tmp){
      ans=tmp;
      ans_i=i;
    }
  }
 
  // rep(i,n){
  //   rep(j,n){
  //     cout<<setw(4)<<dp[i][j];
  //   }
  //   cout<<endl;
  // }
 
  cout<<ans;
}

Compiler output:
a.cc:128:2: error: stray '#' in program
  128 | }#include <bits/stdc++.h>
      |  ^
a.cc:128:3: error: 'include' does not name a type
  128 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:175:6: error: redefinition of 'bool DEBUG'
  175 | bool DEBUG=false;
      |      ^~~~~
a.cc:48:6: note: 'bool DEBUG' previously defined here
   48 | bool DEBUG=false;
      |      ^~~~~
a.cc:176:11: error: redefinition of 'long long int INF'
  176 | long long INF=2000000000;
      |           ^~~
a.cc:49:11: note: 'long long int INF' previously defined here
   49 | long long INF=2000000000;
      |           ^~~
a.cc:178:6: error: redefinition of 'void print()'
  178 | void print(){
      |      ^~~~~
a.cc:51:6: note: 'void print()' previously defined here
   51 | void print(){
      |      ^~~~~
a.cc:183:6: error: redefinition of 'template<class HEAD, class ... TAIL> void print(HEAD&&, TAIL&& ...)'
  183 | void print(HEAD&& head,TAIL&&... tail){
      |      ^~~~~
a.cc:56:6: note: 'template<class HEAD, class ... TAIL> void print(HEAD&&, TAIL&& ...)' previously declared here
   56 | void print(HEAD&& head,TAIL&&... tail){
      |      ^~~~~
a.cc:188:6: error: redefinition of 'void scan()'
  188 | void scan(){}
      |      ^~~~
a.cc:61:6: note: 'void scan()' previously defined here
   61 | void scan(){}
      |      ^~~~
a.cc:191:6: error: redefinition of 'template<class HEAD, class ... TAIL> void scan(HEAD&&, TAIL&& ...)'
  191 | void scan(HEAD&& head,TAIL&&... tail){
      |      ^~~~
a.cc:64:6: note: 'template<class HEAD, class ... TAIL> void scan(HEAD&&, TAIL&& ...)' previously declared here
   64 | void scan(HEAD&& head,TAIL&&... tail){
      |      ^~~~
a.cc:197:6: error: redefinition of 'template<class t> void print(std::vector<_Tp>&)'
  197 | void print(vector<t> &v){
      |      ^~~~~
a.cc:70:6: note: 'template<class t> void print(std::vector<_Tp>&)' previously declared here
   70 | void print(vector<t> &v){
      |      ^~~~~
a.cc:205:6: error: redefinition of 'template<class t, class u> void print(std::vector<std::pair<_T1, _T2> >&)'
  205 | void print(vector<pair<t,u>> &v){
      |      ^~~~~
a.cc:78:6: note: 'template<class t, class u> void print(std::vector<std::pair<_T1, _T2> >&)' previously declared here
   78 | void print(vector<pair<t,u>> &v){
      |      ^~~~~
a.cc:212:3: error: redefinition of 'template<class t, class u> t min(t, u)'
  212 | t min(t a,u b){
      |   ^~~
a.cc:85:3: note: 'template<class t, class u> t min(t, u)' previously declared here
   85 | t min(t a,u b){
      |   ^~~
a.cc:219:5: error: redefinition of 'long long int dx []'
  219 | int dx[]={ 1, 0,-1, 0};
      |     ^~
a.cc:92:5: note: 'long long int dx [4]' previously defined here
   92 | int dx[]={ 1, 0,-1, 0};
      |     ^~
a.cc:220:5: error: redefinition of 'long long int dy []'
  220 | int dy[]={ 0,-1, 0, 1};
      |     ^~
a.cc:93:5: note: 'long long int dy [4]' previously defined here
   93 | int dy[]={ 0,-1, 0, 1};
      |     ^~
a.cc:222:8: error: redefinition of 'int main()'
  222 | signed main(){
      |        ^~~~
a.cc:95:8: note: 'int main()' previously defined here
   95 | signed main(){
      |        ^~~~