PROSUM Wrong answer

**

#include<stdio.h>
main()
{
    int t,m,n,a[100000],i;
    scanf("%d",&t);
    while(t--)
    {
        int prosum=0,l=0,prominus=0;
        scanf("%d",&n);
        m=n;
        for(i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]==0 || a[i]==1)
            {
                m--;
            }
            if(a[i]==2)
            {
                l++;
            }
        }
        for(i=0;i<m;i++)
        {
            prosum+=i;
        }
        for(i=0;i<l;i++)
        {
            prominus+=i;
        }
        prosum-=prominus;
        printf("%d\n",prosum);
    }
}

**

The Compiler at Codechef is telling its the wrong answer. But i tried the same code on my pc in codeblocks and it gives the correct answer. It would be helpful if any1 can help me find the error

replace ‘int’ by ‘long long int’ :slight_smile:

7 Likes

replace int to long long int and “%d” to “%lld”.

9 Likes

replace int to long long int and “%d” to “%lld”.
replace #include<stdio.h> by #include
replace main() by int main()

1 Like

thank you guys.
long long int helped get me the right answer.
and abin111 rest all was correct