Can you please find out what wrong with my logic?

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

int lazy[1000000] = {-1} ;

void Lazy_update(int tree,int ss,int se,int start_pos,int end_pos,int value,int index)
{
if(lazy[index] != -1)
{
if(lazy[index] == 1)
tree[index] = ( 1 << (se-ss+1) ) - 1 ;
else if(lazy[index] == 0)
tree[index] = 0 ;
if(ss != se)
{
lazy[2
index] = lazy[index] ;
lazy[2index+1] = lazy[index] ;
}
lazy[index] = -1 ;
}
//no overlap
if(start_pos>se || end_pos<ss)
return ;
//complete overlap
if(ss>=start_pos && se<=end_pos)
{
if( value == 1 )
tree[index] = ( 1 << (se-ss+1) ) - 1 ;
else
tree[index] = 0 ;
if(ss != se)
{
lazy[2
index] = value ;
lazy[2index+1] = value ;
}
return ;
}
//partial overlap
int mid = (ss + se) / 2 ;
Lazy_update(tree,ss,mid,start_pos,end_pos,value,2
index) ;
Lazy_update(tree,mid+1,se,start_pos,end_pos,value,2index+1) ;
tree[index] = ( ( 1 << (se - mid) ) * tree[2
index] ) + tree[2*index+1] ;
return ;
}

int Lazy_query(int tree,int ss,int se,int query_start,int query_end,int index)
{
if(lazy[index] != -1)
{
if(lazy[index] == 1)
tree[index] = ( 1 << (se-ss+1) ) - 1 ;
else if(lazy[index] == 0)
tree[index] = 0 ;
if(ss != se)
{
lazy[2
index] = lazy[index] ;
lazy[2index+1] = lazy[index] ;
}
lazy[index] = -1 ;
}
//no overlap
if(ss>query_end || se<query_start)
return 0 ;
//complete overlap
if(ss>=query_start && se<=query_end)
{
return tree[index] ;
}
//partial overlap
int mid = (ss+se)/2 ;
int left = Lazy_query(tree,ss,mid,query_start,query_end,2
index) ;
int right = Lazy_query(tree,mid+1,se,query_start,query_end,2*index+1) ;
return (1<<(se - mid))*left + right ;

}

int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n , q ;
cin >> n >> q ;
int tree[4*n +1 ] = {0} ;
int type , l , r ;
while(q–)
{
cin >> type >> l >> r;
if(type == 2)
{
cout<<Lazy_query(tree,0,n-1,l,r,1)<<"\n" ;
}
else
Lazy_update(tree,0,n-1,l,r,type,1) ;
}
return 0 ;

}