func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<long long int> arr;   vector<long long int> b;   long long int l, f;   long long int mid;   long long int bin_s(long long int x) {     l = 0;     f = b.size() - 1;     while (l <= f) {       mid = (l + f) / 2;       if (b[mid] > x) f = mid - 1;       if (b[mid] < x) l = mid + 1;       if (b[mid] == x) {         return 1;         break;       }     }     return 0;   }   int main() {     long long int n, i, j, k, q;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> q;       arr.push_back(q);     }     long long int min = arr[0];     for (i = 0; i < n; i++) {       if (arr[i] <= min) min = arr[i];     }     for (i = 0; i < n; i++) {       if (arr[i] == min) b.push_back(i);     }     long long int c;     long long int max = 0;     long long int ways;     for (i = 0; i < n; i++) {       c = bin_s(i);       if (c == 1) {         ways = min * n;       }       if (c == 0) {         if (b[b.size() - 1] > i) ways = (min * n) + b[l] - i;         if (b[b.size() - 1] < i) ways = (min * n) + n - i + b[0];       }       if (ways > max) max = ways;     }     cout << max << endl;     return 0;   }   