func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 3e6;   long long n, m;   long long a[N];   long long read(void) {     long long s = 0, w = 0;     char c = getchar();     while (c <  0  || c >  9 ) w |= c ==  - , c = getchar();     while (c >=  0  && c <=  9 ) s = s * 10 + c - 48, c = getchar();     return w ? -s : s;   }   long long point(long long x) {     if (x % 2 == 1) return x * (x - 1) / 2 + 1;     if (x % 2 == 0) return x * (x - 1) / 2 + x / 2;   }   signed main(void) {     n = read(), m = read();     for (long long i = 1; i <= m; ++i) {       long long q = read();       a[i] = read();     }     sort(a + 1, a + m + 1);     reverse(a + 1, a + m + 1);     long long sum = 0;     for (long long i = 1; i <= m; ++i) {       if (point(i) > n) return cout << sum, 0;       sum += a[i];     }     cout << sum << endl;     return 0;   }   