# Got a sigemt error for the code whereas the code works on other compliler

**URL:** <https://discuss.codechef.com/t/got-a-sigemt-error-for-the-code-whereas-the-code-works-on-other-compliler/88442>\
**Category:** help\
**Tags:** runtime-error\
**Created:** [April 22, 2021, 8:18am UTC](https://discuss.codechef.com/t/got-a-sigemt-error-for-the-code-whereas-the-code-works-on-other-compliler/88442 "2021-04-22T08:18:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prajwalahetti](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@prajwalahetti](https://discuss.codechef.com/u/prajwalahetti)\
**Post date:** [April 22, 2021, 8:18am UTC](https://discuss.codechef.com/t/got-a-sigemt-error-for-the-code-whereas-the-code-works-on-other-compliler/88442/1 "2021-04-22T08:18:50Z")

</div>

//headers  
#include\<bits/stdc++.h\>  
#include \<ext/pb\_ds/assoc\_container.hpp\>  
#include  
using namespace \_\_gnu\_pbds;  
#include  
using namespace std;  
//typedefenum name  
typedef long long int ll;  
//define  
#define ll long long int  
#define rtest ll t;cin\>\>t;while(t–)  
#define rin ll n;cin\>\>n;  
#define r2in ll n,o;cin\>\>n\>\>o;  
#define r3in ll n,o,p;cin\>\>n\>\>o\>\>p;  
#define jloop(m,n) for(ll j=m;j\<n;j++)  
#define kloop(m,n) for(ll k=m;k\<n;k++)  
int printSubsequences(int arr[], int n,int o)  
{  
int sum=0;  
/\* Number of subsequences is (2\*\*n -1)\*/  
unsigned int opsize = pow(2, n);

```
/* Run from counter 000..1 to 111..1*/
for (int counter = 1; counter < opsize; counter++)
{

```

sum=0;  
for (int j = 0; j \< n; j++)  
{

```
        /* Check if jth bit in the counter is set
            If set then print jth element from arr[] */
        if (counter & (1<<j))
            //cout << arr[j] << " ";
        sum=sum+arr[j];
            //cout<<" sum "<<sum <<endl;
             if(sum==o)
             {
                return 1;
             }
    }
    //cout << endl;
}
return 0;

```

}  
int main()  
{  
//file handling  
#ifndef ONLINE\_JUDGE  
freopen(“i.txt”, “r”, stdin);  
freopen(“o.txt”, “w”, stdout);  
#endif  
rtest  
{  
r2in  
int a[n];  
jloop(0,n)  
{  
cin\>\>a[j];  
}  
sort(a,a+n);  
int max;  
jloop(0,n)  
{  
if(a[j]\<=o)  
{  
max=j;  
}  
}

```
  int res= printSubsequences(a,max+1,o);
if(res==0)
    cout<<"No"<<endl;
else
    cout<<"Yes"<<endl;

```

}

```
return 0;

```

}

---

<div class="post-metadata">

**Author:** ![ssjgz](https://discuss.codechef.com/user_avatar/discuss.codechef.com/ssjgz/32/346011_2.png) [@ssjgz](https://discuss.codechef.com/u/ssjgz)\
**Post date:** [April 22, 2021, 8:19am UTC](https://discuss.codechef.com/t/got-a-sigemt-error-for-the-code-whereas-the-code-works-on-other-compliler/88442/2 "2021-04-22T08:19:46Z")

</div>

Please either [format your code](https://discuss.codechef.com/t/tutorial-color-format-the-code/36585) or (better!) link to your submission - the forum software has mangled it and it won’t compile! 🙂

Also - what Problem are you trying to solve? 🙂

Are you trying to [“Run” without Providing “Custom Input”](https://discuss.codechef.com/t/new-to-codechef-cant-understand-the-platform/39039/3)?
