# Runtime Error

The Question is :
Devu has n weird friends. Its his birthday today, so they thought that this is the best occasion for testing their friendship with him. They put up conditions before Devu that they will break the friendship unless he gives them a grand party on their chosen day. Formally, i th friend will break his friendship if he does not receive a grand party on di th day.

Devu despite being as rich as Gatsby, is quite frugal and can give at most one grand party daily. Also, he wants to invite only one person in a party. So he just wonders what is the maximum number of friendships he can save. Please help Devu in this tough task !!

### Input

• The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
• First line will contain a single integer denoting n.
• Second line will contain n space separated integers where i th integer corresponds to the day di th as given in the problem.

### Output

Print a single line corresponding to the answer of the problem.

### Constraints

1 ≤ T ≤ 10^4
1 ≤ n≤ 50
1 ≤ di≤100

My Soln is :

#include
#include <string.h>
using namespace std;

int main() {
int t,n;
cin>>t;
for(int i=0;i<t;i++)
{
cin>>n;
int d[n];
int b;
memset(d,-1,nsizeof(int));
memset(b,0,101
sizeof(int));
int c=0;
for(int j=0;j<n;j++)
{
cin>>d[j];
b[d[j]]++;
}
for(int j=0;j<n;j++)
{
if(b[d[j]]==1)
c++;
if(b[d[j]]>1)
{
c+=1;
j=j+(b[d[j]]-1);
}
if(b[d[j]]==n)
c=1;

``````    }
cout<<c<<endl;
}

return 0;
``````

}

It is showing proper output in all other IDEs but showing runtime error “SIGSEG”.Can anyone help me with debugging the error??