I have a following code, and although I know it is a problem with vectors I can't find it, so any help would be appreciated! Maybe it processes an empty vector but I tried removing and adding something and still nothing happens.
int main()
{
int t;
cin >> t;
int n[100000];
int m[100000];
int komplement[100000];
int najmanjiceodeo[100000];
int najmanjiceodeo1[100000];
for (int k = 0;k < t;k++)
{
cin >> n[k]>>m[k];
komplement[k] = binomnikoef(n[k] + 1, 2);
najmanjiceodeo[k] = (m[k] + 1) * (floor((n[k] - m[k]) / (m[k] + 1)));
najmanjiceodeo1[k] = (floor((n[k] - m[k]) / (m[k] + 1)));
}
vector <int> v1;
for (int k = 0;k < t;k++)
{
int S[100000];
S[k] = komplement[k];
for (int i = 0;i < m[k] + 1;i++)
{
if (i < (n[k] - m[k]) - najmanjiceodeo[k])
{
v1.push_back(najmanjiceodeo1[k] + 1);
}
else
{
v1.push_back(najmanjiceodeo1[k]);
}
if (!v1.empty())
{
S[k] -= binomnikoef(v1[i] + 1, 2);
}
}
v1.clear();
cout << S[k] << endl;
}