Language: C

#include<iostream>
#include<stdio.h>
#define xlson ch[x][0]
#define xrson ch[x][1]
#define rlson ch[ch[root][1]][0]
using namespace std;
const int N = 250000;
int num[N],n;
struct SPT
{
    int pre[N],ch[N][2],sz[N],root,cnt;
    int mx[N],key[N];
    inline void push_up(int x){
        sz[x]=1+sz[xlson]+sz[xrson];
        mx[x]=max(key[x],max(mx[xlson],mx[xrson]));
//        printf("x=%d %d %d %d %d %d\n",x,xlson,xrson,mx[xlson],mx[xrson],mx[x]);
    }
    inline void push_down(int x){}
    inline void rotate(int x,int kind)
    {
        int y=pre[x];
        push_down(y);
        push_down(x);
        if(pre[y]) ch[pre[y]][ ch[pre[y]][1]==y ]=x;
        pre[x]=pre[y];

        if(ch[x][kind]) pre[ch[x][kind]]=y;
        ch[y][!kind]=ch[x][kind];

        pre[y]=x;
        ch[x][kind]=y;
        push_up(y);
    }
    inline void splay(int x,int goal)
    {
        if(x==0) return ;
        push_down(x);
        while(pre[x]!=goal)
        {
            int y=pre[x];
            if(pre[y]==goal)
                rotate(x,ch[y][1]!=x);
            else{
                int kind=(ch[pre[y]][1]==y);
                if(ch[y][kind]==x)
                    rotate(y,!kind),rotate(x,!kind);
                else
                    rotate(x,kind),rotate(x,!kind);
            }
        }
        push_up(x);
        if(goal==0) root=x;
    }
    inline void roto(int k,int goal)
    {
        int x=root;
        push_down(x);
        while(k!=sz[xlson])
        {
            if(k<sz[xlson])
                x=xlson;
            else{
                k-=(1+sz[xlson]);
                x=xrson;
            }
//            printf("%d xl=%d sz=%d %d %d\n",k,xlson,sz[xlson],xrson,x);
            push_down(x);
        }
        splay(x,goal);
    }
    inline void newnode(int &x,int val)
    {
        x=++cnt;
        pre[x]=xlson=xrson=0;
        sz[x]=1;
        mx[x]=key[x]=val;
    }
    inline void build(int l,int r,int &x,int f)
    {
        if(l>r) return ;
        int mid=l+r>>1;
        newnode(x,num[mid]);
        build(l,mid-1,xlson,x);
        build(mid+1,r,xrson,x);
        push_up(x);
//        cout<<x<<" xl="<<xlson<<" xr="<<xrson<<" "<<key[x]<<" mx="<<mx[x]<<endl;
    }
    inline void init()
    {
        root=cnt=0;
        key[0]=mx[0]=-1; sz[0]=0;
        newnode(root,-1);
        newnode(ch[root][1],-1);
        pre[ch[root][1]]=root;
        build(1,n,rlson,ch[root][1]);
        push_up(ch[root][1]);
        push_up(root);
    }
    inline void update()
    {
        int l,val;
        scanf("%d%d",&l,&val);
        roto(l-1,0);
        roto(l+1,root);
        key[rlson]=mx[rlson]=val;
//        splay(rlson,0);
        push_up(ch[root][1]);
        push_up(root);
    }
    inline void query()
    {
        int l,r;
        scanf("%d%d",&l,&r);
        roto(l-1,0);
        roto(r+1,root);
        printf("%d\n",mx[rlson]);
    }
}spt;
int main()
{
    int m;
    while(scanf("%d%d",&n,&m)!=-1)
    {
        for(int i=1;i<=n;++i) scanf("%d",&num[i]);
        spt.init();
//        cout<<spt.mx[spt.root]<<endl;
        char s[20];
        while(m--)
        {
            scanf("%s",s);
            if(s[0]=='Q') spt.query();
            else spt.update();
        }
    }
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.