Загрузка данных


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

int main() {
    int max_r = 0;

    for (int n = 1; n < 2000; ++n) {
        std::string s = "";
        int temp_n = n;
        while (temp_n > 0) {
            s += std::to_string(temp_n % 2);
            temp_n /= 2;
        }
        std::reverse(s.begin(), s.end());

        int sum_units = 0;
        for (char c : s) if (c == '1') sum_units++;

        if (sum_units % 2 == 0) {
            s += '0';
            if (s.length() >= 2) {
                s = "1" + s.substr(2);
            }
        } else {
            s += '1';
            if (s.length() >= 2) {
                s = "11" + s.substr(2);
            }
        }

        if (!s.empty()) {
            int r = std::stoi(s, nullptr, 2);
            if (r < 744) {
                if (r > max_r) max_r = r;
            }
        }
    }

    std::cout << max_r << std::endl;
    return 0;
}