With C/C++ arrays use zero based indexes. As a result, valid indexes for non-empty arrays are from 0 to the size minus one. But you are using loops which run up to and including the size. This might move undefined values into your vectors.
So you have to use
for(int k = 0; k < input1.size(); k++) {
instead and similar for the other loop.
Because you are going to swap values checking one item beyond, you
can must reduce the number of loops by one. You must also re-initialise the indexes of the next items within the loops instead of re-using them:
for(int k = 0; k < input1.size() - 1; k++) {
int j = k + 1;
while (input1[k] > input1[j]) {
}
}
I'm also not sure if incrementing
inv
within all loops is what you want.
[EDIT]
If you want to calculate the inversion of a vector, I suggest to create a function just for that without sorting:
int GetInversion(const vector<int>& v)
{
int inv = 0;
for (int i = 0; i < v.size() - 1; i++)
for (int j = i + 1; j < v.size(); j++)
if (v[i] > v[j])
inv++;
return inv;
}
[/EDIT]