Module sum (Pigeonhole) - Run Time Error

I am trying to solve Module sum (Pigeonhole) problem , but for some of the case i am getting run-time error . Please , suggest me what i am missing here

https://ide.codingblocks.com/#/s/15430

…Qn link ??

This is the question link - https://online.codingblocks.com/player/2872/content/785?s=379

Heyy ! you are checking for subarrays but you have to cheak wheather there is a " subsequence " or not .
There is a huge difference between subsequence and subarrays !

for unsorted array i am not sure how i can apply pigeonhole principle to get the solution . One possible solution that is coming in my using bitmasking .Could you please give me an idea how we can apply pigeonhole principle here ?

in this code you have to make a change where you have written ans>0 write ans>1

this is correct code in c++
#include
#include

using namespace std;

#define ll long long

ll a[1000005],prefixSum[1000005];

//prefixSUm array is to store the freq
int main(){

int n;
cin>>n;

int target;
cin>>target;

ll sum=0;
//to initialise my sub string array to 0
memset(prefixSum,0,sizeof prefixSum);
    
prefixSum[0] = 1;

for(int i=0;i<n;i++){
    cin>>a[i];
    sum += a[i];
    sum %= target;
        
    //update the freq

// sum = (sum+n)%n;
prefixSum[sum]++;
}
ll ans = 0;
for(int i=0;i<n;i++){
ll no = prefixSum[i];
ans += ((no)*(no-1))/2;
}
if(ans>1)
cout<<“Yes”<<endl;
else
cout<<“No”<<endl;

}

HI @himanshusainie97 when i am doing ans > 1 than its failing for even giving test case as well , So , i am trying solving it as like this https://ide.codingblocks.com/#/s/15867
and one of the test case is failing not sure where exactly its failing .

this code was working fine for me,what’s the error in it if the test case is failing ask corresponding mentor for the test case