title: Why do I get stack overflow in the following code?
body: <p>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.</p>
  <pre><code>int main()
  {
      int t;
      cin &gt;&gt; t;
      int n[100000];
      int m[100000];
      int komplement[100000];
      int najmanjiceodeo[100000];
      int najmanjiceodeo1[100000];
      for (int k = 0;k &lt; t;k++)
      {
          cin &gt;&gt; n[k]&gt;&gt;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 &lt;int&gt; v1;
      for (int k = 0;k &lt; t;k++)
      {
          int S[100000];
          S[k] = komplement[k];
          for (int i = 0;i &lt; m[k] + 1;i++)
          {
              if (i &lt; (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 &lt;&lt; S[k] &lt;&lt; endl;
      }
  </code></pre>