-4

I am getting SIGABRT error in my code. Can anyone tell me from where it might be coming?

Here's my code:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        string s;
        cin>>s;
        int d=stoi(s,nullptr,2);
        int f=__builtin_popcount(d);
        cout<<f*(f-1)/2+f<<endl;
    }
}
Biffen
  • 6,249
  • 6
  • 28
  • 36

1 Answers1

-1
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long  int t;
    cin>>t;
    while(t--)
    {
       long long int n;
        cin>>n;
        string s;
        cin>>s;
       long long int d=stoi(s,nullptr,2);
        long long int f=__builtin_popcount(d);
        cout<<f*(f-1)/2+f<<endl;
    }`enter code here`
}

Now Try This