# Solution

## code

int kth(int k)
{
int now=0,s=0;
for(re int i=21;i>=0;i--)
{
int to=now|(1<<i);
if(to>n) continue; //若增加后的位置大于n,显然不对
int x=s+sum[to];
if(x<k) now=to, s=x;
}
return now+1; //找的是<=k的位置
}


# code for Icefire

#include<bits/stdc++.h>
using namespace std;
#define re register
#define in inline
#define get getchar()
#define ll long long
{
int t=0,x=-1; char ch=get;
while(ch<'0' || ch>'9') { ch=='-' ? x=-1: 1; ch=get;}
while(ch<='9' && ch>='0') t=t*10+ch-'0', ch=get;
return t;
}
const int _=2e6+23;
int Q,ic,fi,b[_],cnt,rf[_];
struct opt{
int typ,t,x,y;
}a[_];
int sum1[_],sum0[_],S;
#define lowbit(x) (x&-x)
int query(int *sum,int x)
{
int sss=0;
while(x){ sss+=sum[x],x-=lowbit(x); }
return sss;
}
{    while(x<=cnt) sum[x]+=k,x+=lowbit(x); }

in void solve() //树状数组上倍增找到可能的两处交点
{
int x=0,s1=0,s2=S; //s1是冰人前缀和,s2是火人后缀和
for(re int i=21;i>=0;i--) //找到s1恰好小于s2的地方
{
int to=x|(1<<i);
if(to>cnt) continue;
int si=s1+sum0[to],sf=s2-sum1[to];
if(si<sf) s1=si, s2=sf, x=to;
}
int ansi=s1,ansf=min( query(sum0,x+1) , S-query(sum1,x+1) ),c1=x;
// ansi存的是左边交点的值, ansf存的是右边
x=0,s1=0,s2=S;
for(re int i=21;i>=0;i--)
{
int to=x|(1<<i);
if(to>cnt) continue;
int si=s1+sum0[to],sf=s2-sum1[to];
if(si<sf || sf==ansf) s1=si, s2=sf, x=to;
}
int c2=x;
//c1,c2分别为对应的温度
int mx=max(ansi,ansf);
if(mx==0) puts("Peace");
else if(ansi>ansf) printf("%d %d\n",b[c1],ansi<<1); //b数组存的是离散化前对应的值
else printf("%d %d\n",b[c2],ansf<<1);
}

int main()
{
for(re int i=1;i<=Q;++i)
{
}
sort(b+1,b+cnt+1);
cnt=unique(b+1,b+cnt+1)-b-1;
for(re int i=1;i<=Q;++i)
if(a[i].typ==1) a[i].x=lower_bound(b+1,b+cnt+1,a[i].x)-b; //离散化
for(re int i=1;i<=Q;++i)
{
if(a[i].typ==1)
{