Why I am getting sigabrt here plz explain

#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
void solve()
{
    int n;cin>>n;
    vector<vector<int>>arr(n,vector<int>(20,0));
    for(int i=0;i<n;i++)
    {
        int temp;cin>>temp;
        int j=0;
        while(temp!=0)
        {
            int d=(temp&1);
            arr[i][j]=d;
            temp=temp>>1;
            j++;
        }
    }
    vector<int>ans(20,0);
    for(int i=0;i<18;i++)
    {
        int cnt=0;
        for(int j=0;j<n;j++)
        {
            if(arr[j][i]==1)
                cnt++;
        }
        if(cnt>=2)
        ans[i]=1;
    }
    int res=0;
    for(int i=0;i<20;i++)
    {
        res+=ans[i]*pow(2,i);
    }
    cout<<res<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t;cin>>t;
    while(t--)
    {
        solve();
    }
}

Link to submission

Given that 1\le A_i\le 10^9, You’ll need at least 30 bits to represent them.

2 Likes

Thank you bro you always help me!!