func_code_string: #include <bits/stdc++.h>   using namespace std;   int main(int argc, char* argv[]) {     ios_base::sync_with_stdio(false);     long long int N, M;     cin >> N >> M;     long long int max_n1;     for (max_n1 = 1; (max_n1 * (max_n1 - 1)) / 2 + 1 <= N; max_n1 += 2)       ;     max_n1 -= 2;     long long int max_n2;     for (max_n2 = 0; (max_n2 * (max_n2 - 1)) / 2 + max_n2 / 2 <= N; max_n2 += 2)       ;     max_n2 -= 2;     long long int max_n = max(max_n1, max_n2);     vector<long long int> qs(M, 0);     vector<long long int> ws(M, 0);     for (int m = 0; m < M; ++m) cin >> qs[m] >> ws[m];     sort(ws.begin(), ws.end(), greater<long long int>());     max_n = min(max_n, (long long int)ws.size());     long long int res = 0;     for (int i = 0; i < max_n; ++i) res += ws[i];     cout << res << endl;     return 0;   }   