Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef struct line
{
	int lp,rp,value;
	bool operator < (const struct line & n)const
	{
		return rp<n.lp;
	}
}LINE,*PLINE;
LINE arr[200000];
long long linetree[1<<19],lazy[1<<19];
long long query(int index,int lb,int rb,int lq,int rq)
{
	if(lb==lq&&rb==rq)
		return tree[index];
	long long mid=(lb+rb)/2;
	if(lazy[index]!=0)
	{
		tree[2*index]+=(mid-lb+1)*lazy[index];
		tree[2*index+1]+=(rb-mid)*lazy[index];
		lazy[2*index]+=lazy[index];
		lazy[2*index+1]+=lazy[index];
		lazy[index]=0;
	}
	if(rq<=mid)
	{	
		return query(2*index,lb,mid,lq,rq);
	}
	else if(lq>mid)
	{
		return query(2*index+1,mid+1,rb,lq,rq);	
	}
	else
	{
		return max(query(2*index,lb,mid,lq,mid),(query(2*index+1,mid+1,rb,mid+1,rq));
	}
}
void update(int index,int lb, int rb,int lq,int rq,long long value)
{
	if(lb==lq&&rb==rq)
	{
		tree[index]+=(rb-lb+1)*value;
		lazy[index]+=value;
		return;
	}
	long long mid=(lb+rb)/2;
	if(lazy[index]!=0)
	{
		tree[2*index]+=(mid-lb+1)*lazy[index];
		tree[2*index+1]+=(rb-mid)*lazy[index];
		lazy[2*index]+=lazy[index];
		lazy[2*index+1]+=lazy[index];
		lazy[index]=0;
	}
	if(rq<=mid)
	{	
		update(2*index,lb,mid,lq,rq,value);
	}
	else if(lq>mid)
	{
		update(2*index+1,mid+1,rb,lq,rq,value);	
	}
	else
	{
		update(2*index,lb,mid,lq,mid,value);
		update(2*index+1,mid+1,rb,mid+1,rq,value);
	}
	tree[index]=tree[2*index]+tree[2*index+1];
}
int main()
{
	int i,j,k;
	int n,m;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %d %d",&arr[i].lq,&arr[i].rq,&arr[i].value);
	}
	sort(arr,arr+m);
	for(i=0;i<n;i++)
	{
		update(1,0,n,i,i,query(1,0,n,0,i-1));
	}
}

Compiler output:
a.cc: In function 'long long int query(int, int, int, int, int)':
a.cc:16:24: error: 'tree' was not declared in this scope; did you mean 'free'?
   16 |                 return tree[index];
      |                        ^~~~
      |                        free
a.cc:20:17: error: 'tree' was not declared in this scope; did you mean 'free'?
   20 |                 tree[2*index]+=(mid-lb+1)*lazy[index];
      |                 ^~~~
      |                 free
a.cc:36:93: error: expected ')' before ';' token
   36 |                 return max(query(2*index,lb,mid,lq,mid),(query(2*index+1,mid+1,rb,mid+1,rq));
      |                           ~                                                                 ^
      |                                                                                             )
a.cc: In function 'void update(int, int, int, int, int, long long int)':
a.cc:43:17: error: 'tree' was not declared in this scope; did you mean 'free'?
   43 |                 tree[index]+=(rb-lb+1)*value;
      |                 ^~~~
      |                 free
a.cc:50:17: error: 'tree' was not declared in this scope; did you mean 'free'?
   50 |                 tree[2*index]+=(mid-lb+1)*lazy[index];
      |                 ^~~~
      |                 free
a.cc:69:9: error: 'tree' was not declared in this scope; did you mean 'free'?
   69 |         tree[index]=tree[2*index]+tree[2*index+1];
      |         ^~~~
      |         free
a.cc: In function 'int main()':
a.cc:78:42: error: 'LINE' {aka 'struct line'} has no member named 'lq'; did you mean 'lp'?
   78 |                 scanf("%d %d %d",&arr[i].lq,&arr[i].rq,&arr[i].value);
      |                                          ^~
      |                                          lp
a.cc:78:53: error: 'LINE' {aka 'struct line'} has no member named 'rq'; did you mean 'rp'?
   78 |                 scanf("%d %d %d",&arr[i].lq,&arr[i].rq,&arr[i].value);
      |                                                     ^~
      |                                                     rp