C++ Program Bug : <p>Given an array. Program should find all pairs the sum of which is can divided by 7. I write this code, but code did not pass all tests</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int m[7];

int main() {
     int n, k = 0;
     cin&gt;&gt;n;
     long long a;
     for(int i = 0; i &lt; n; i++) {
          cin&gt;&gt;a;
          a %= 7;
          if(m[(7 - a) % 7] &gt; 0) {
               k += m[(7 - a) % 7];
          }
          m[a]++;
     }
     cout&lt;&lt;k;
     return 0;
 }
</code></pre>
