Convert this code from python to C++ (already tried ChatGPT)

Job ID: 36724668

Budget: €30 – €250 EUR

I need this code (attachment) in C++, I already tried chatGPT, but there was always some mistake or the result was not as it should be. You can use standard libraries available in Visual Studio, but no custom libraries.

The code is calculating a combination at a specific point of combinatoric generation i.e. for subsets of 8 from 1000 numbers the sequence is: 1,2,3,4,5,6,7,8 - 1,2,3,4,5,6,7,9 - 1,2,3,4,5,6,7,10 etc...

The code does that it quickly finds the combination at a specified index, i.e. at index 10: 1,2,3,4,5,6,7,18....

Some output on which you can verify the conversion was right:
index: 1000 000 000 000 -> combination: [25, 124, 217, 309, 346]
index: 1000 -> combination [1000]
index: 2000 -> combination [2, 3]
index: 1000 000 000 000 000 -> combination [194, 199, 403, 595, 812, 824]
index: 1000 000 000 000 000 000 -> combination [5, 40, 58, 100, 130, 162, 628, 653]

You can play around with the Python code here: https://www.online-python.com/
The price is 30€.