#include <chrono>

#include <cstdint>

#include <iostream>

constexpr int64_t skynet(int64_t levels, int64_t children,

int64_t position = 0) {

if (levels == 0)

return position;

int64_t sum = 0;

for (int64_t i = 0; i < children; ++i)

sum += skynet(levels - 1, children, position * children + i);

return sum;

}

int main() {

using namespace std;

using namespace std::chrono;

auto start = high_resolution_clock::now();

constexpr auto result = skynet(6, 10);

auto elapsed = high_resolution_clock::now() - start;

cout << "Result: " << result << '\n'

<< "time " << duration_cast<milliseconds>(elapsed).count() << " ms" << endl;

}