Playing With Divisors Is Fun

not getting what’s wrong with my code
help me out this…

#include<iostream> #include<bitset> #include<vector> #define ll long long #define MOD 1000000007 #define N 86000000 #define len 1000003 using namespace std; vector<int> ithprime; vector<int> xelem; bitset<N> prims; void sieves(){ for(int i = 3; i < N ; i += 2){ prims[i] = 1; } prims[2]; ithprime.reserve(len); ithprime.push_back(1); ithprime.push_back(2); for(int i = 3;i<N;i+=2){ if(prims[i]){ ithprime.push_back(i); for(int j = i*i ; j < N ; j += 2*i){ prims[j] = 0; } } } } int main(){ int x; ll tmp; sieves(); cin>>x; xelem.reserve(x+2); for(int i=1;i<=x;i++){ cin>>tmp; if(tmp){ xelem.push_back(ithprime[i]); } } int n = xelem.size(); ll iter = 1<<n - 1; ll sum = 0; for(ll i = 0 ; i <= iter ; i++){ ll mask = i; ll pro=1; int j = 0; while(mask){ if(mask && 1){ pro *= xelem[j]; pro %= MOD; } j++; mask>>1; } sum += pro ; sum %= MOD ; } cout<<sum<<endl; return 0; }

Please share your code via CB IDE and tell me the steps you have followed.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.


what’s wrong with my code plz check

TESTCASE # 1 : correct (Time: 0.09 s)
TESTCASE # 2 : wrong-answer (Time: 0.01 s)
TESTCASE # 3 : wrong-answer (Time: 0.01 s)
TESTCASE # 4 : correct (Time: 0.01 s)
TESTCASE # 5 : correct (Time: 0.01 s)