I feel like this is supposed to be very straightforward but I am unable to work it out.

I have a very simple piece of c++ code.

```
for (int k = 0; k < 2; ++k)
    {
        for (int a = 0; a < 4; ++a)
        {
            for (int b = 0; b < 4; ++b)
            {
                if (a != b)
                {
                    std::cout << "k: " << k  << " a: " << a  << " b: " << b  << "\n";
                }
            }
        }

```

The output will have 24 lines like this

```
k: 0 a: 0 b: 1
k: 0 a: 0 b: 2
k: 0 a: 0 b: 3
k: 0 a: 1 b: 0
k: 0 a: 1 b: 2
k: 0 a: 1 b: 3
k: 0 a: 2 b: 0
k: 0 a: 2 b: 1
k: 0 a: 2 b: 3
k: 0 a: 3 b: 0
k: 0 a: 3 b: 1
k: 0 a: 3 b: 2
k: 1 a: 0 b: 1
k: 1 a: 0 b: 2
k: 1 a: 0 b: 3
k: 1 a: 1 b: 0
k: 1 a: 1 b: 2
k: 1 a: 1 b: 3
k: 1 a: 2 b: 0
k: 1 a: 2 b: 1
k: 1 a: 2 b: 3
k: 1 a: 3 b: 0
k: 1 a: 3 b: 1
k: 1 a: 3 b: 2

```

What I want is essentially 3 choice of those 24 lines of output. 24 choose 3 = 2024 lines of output without any additional library usage. I want to do some calculations based on 3 of those 24 lines at a time.

The equivalent python code

```
import itertools    
iterable = ["k: 0 a: 0 b: 1", "k: 0 a: 0 b: 2", "k: 0 a: 0 b: 3", "k: 0 a: 1 b: 0", "k: 0 a: 1 b: 2", "k: 0 a: 1 b: 3", "k: 0 a: 2 b: 0", "k: 0 a: 2 b: 1", "k: 0 a: 2 b: 3", "k: 0 a: 3 b: 0", "k: 0 a: 3 b: 1", "k: 0 a: 3 b: 2", "k: 1 a: 0 b: 1", "k: 1 a: 0 b: 2", "k: 1 a: 0 b: 3", "k: 1 a: 1 b: 0", "k: 1 a: 1 b: 2", "k: 1 a: 1 b: 3", "k: 1 a: 2 b: 0", "k: 1 a: 2 b: 1", "k: 1 a: 2 b: 3", "k: 1 a: 3 b: 0", "k: 1 a: 3 b: 1", "k: 1 a: 3 b: 2"]
a = list(itertools.combinations(iterable, 3))
print(a)

```

demonstrates what I want. I was wondering how to do this in C++ using just the `for` loops.