Use of long long passes all test case but using int does not

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
    int t = 0;
    cin >> t;
    while(t--) {
        long long n, k;
        cin >> n >> k;
        int i = n;
        while(i * k > n) i--;
        int j = 1;
        while(k--) {
            cout << i * j++ << " ";
        }
        cout << endl;
    }
}

now in this if I take n and k as long long variables the code passes all the test cases but if I use int it does not pass all the test cases
question name: Subset GCD
link: Subset GCD Practice Coding Problem - CodeChef
Can any one explain the reason?
contraints subset GCD

max value of int is 2147483647. Value of (i*k) can be 10^10. It will overflow.

in the background when int variables are multiplied they tend to get stored in the register that can have integer values (I mean that the size of the register is limited to int) am I understanding this correctly?