Constructor of a Struct in C++ Causes Non-Zero Exit Code

When I call the constructor for my SegTree struct in the code below, I keep getting a non-zero exit code. Can someone explain why this is happening and how to fix my code?

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <vector>
#include <string.h>

using namespace std;

struct SegTree{
    int N;
    long long tree [1<<20], arr [1<<20];
    SegTree(int x){ N = x; }
    int left(int p){ return p<<1; }
    int right(int p){ return (p<<1) + 1; }
    void build(int p, int L, int R, bool isOR){
        if(L == R) tree[p] = arr[L];
        else{
            build(left(p), L, (L+R)/2, !isOR); build(right(p), (L+R)/2+1, R, !isOR);
            if(isOR) tree[p] = tree[left(p)] | tree[right(p)];
            else tree[p] = tree[left(p)] ^ tree[right(p)];
        }
    }
    void update(int p, int L, int R, bool isOR, int place, long long val){
        if(L > R || L > place || R < place) return;
        if(L == R && L == place){
            tree[p] = val;
            return;
        }
        update(left(p), L, (L+R)/2, !isOR, place, val); update(right(p), (L+R)/2+1, R, !isOR, place, val);
        if(isOR) tree[p] = tree[left(p)] | tree[right(p)];
        else tree[p] = tree[left(p)] ^ tree[right(p)];
    }
};

int len, numQueries;
bool start;

int main(){
    scanf("%d %d", &len, &numQueries); start = len%2 == 1;
    SegTree st(len);
    /*for(int i = 1; i <= len; i++){
        long long temp; scanf("%d", &temp);
        st.arr[i] = temp;
    }
    st.build(1, 1, len, start);
    for(int i = 0; i < numQueries; i++){
        int x; long long y; scanf("%d %d", &x, &y);
        st.update(1, 1, len, start, x, y);
        cout << st.tree[1] << endl;
    }*/
    return 0;
}

Thanks,
vmaddur

1<<20 = 1048576; changing it to 104857 worked for me. it seems that the size of that array is too huge which is causing this problem.
You can try dynamically allocating those arrays like this:

long long *tree, *arr;
SegTree(int x){
    N = x;
    tree = new long long[1<<20];
    arr = new long long[1<<20];
    }

This worked well on my machine. If you have any more problems feel free to comment.