QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#563096#5449. 楼梯Elegia100 ✓422ms28508kbC++235.1kb2024-09-14 02:35:562024-09-14 02:35:58

Judging History

你现在查看的是最新测评结果

  • [2024-09-14 02:35:58]
  • 评测
  • 测评结果:100
  • 用时:422ms
  • 内存:28508kb
  • [2024-09-14 02:35:56]
  • 提交

answer

// zzq/std_fast.cpp
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
#define SS 23333333
int an=1,M;
int ls[SS],rs[SS];
ll mi[SS],tg[SS],mx[SS];
void pd(int x) {
    if(tg[x]) {
        tg[x+x]+=tg[x];
        tg[x+x+1]+=tg[x];
        mi[x+x]+=tg[x];
        mi[x+x+1]+=tg[x];
        mx[x+x]+=tg[x];
        mx[x+x+1]+=tg[x];
        tg[x]=0;
    }
}
void upd(int x) {
    mi[x]=min(mi[x+x],mi[x+x+1]);
    mx[x]=max(mx[x+x],mx[x+x+1]);
}
//maybe also add a version of assign 0
void edt(int x,int ql,int qr,ll v) {
    if(rs[x]<ql||qr<ls[x]) return;
    if(ql<=ls[x]&&rs[x]<=qr) {
        if(mi[x]>=v) {
            tg[x]-=v; mi[x]-=v; mx[x]-=v; return;
        }
        else if(mi[x]==mx[x]) {
            assert(v>0); v=mi[x];
            tg[x]-=v; mi[x]-=v; mx[x]-=v; return;
        }
    }
    assert(ls[x]!=rs[x]);
    pd(x); // never pushdown a leaf
    edt(x+x,ql,qr,v);
    edt(x+x+1,ql,qr,v);
    upd(x);
}
ll qry(int x,int q) {
    if(ls[x]==rs[x]) return tg[x];
    if(q<=rs[x+x]) return qry(x+x,q)+tg[x];
    else return qry(x+x+1,q)+tg[x];
}
int xs[SZ],xn=0;
// throw the first <b row
int bs_row(int x,ll b) {
    //if(r<ql||qr<l) return;
    if(mi[x]>=b) return -1;
    if(ls[x]==rs[x]) return ls[x];
    int rl=bs_row(x+x,b-tg[x]);
    if(rl!=-1) return rl;
    return bs_row(x+x+1,b-tg[x]);
}
const int root=1;
ll rl;
ll hook1() {
    rl=qry(1,0);
    // cerr<<rl<<"??\n";
    if(rl==0) return 0;
    int r=bs_row(1,1);
    // cerr<<"found"<<r<<"!  "<<xs[r]<<"\n";
    return xs[r]-1+rl-1;
}
pair<int,ll> bs_all(int x,ll b,ll t) {
    if(rl-mi[x]-t+xs[min(rs[x]+1,xn-1)]-1-1<b) return mp(-1,-1LL);
    if(ls[x]==rs[x]) return mp(ls[x],mi[x]+t);
    auto tl=bs_all(x+x,b,t+tg[x]);
    if(tl.fi!=-1) return tl;
    return bs_all(x+x+1,b,t+tg[x]);
}
// (row, type) of some border segment
pair<ll,ll> qryb(ll b) {
    // note: first get rl from hook(1,1)!
    auto r=bs_all(1,b,0);
    ll x=r.fi,u=r.se;
    if(rl-u+xs[x]-1<=b) return mp(xs[x]+b-(rl-u+xs[x]-1),u);
    else return mp(xs[x]-1,0);
}
char qo[SZ][3]; int qa[SZ],qb[SZ]; ll qq[SZ];
int main() {
    int m;
    scanf("%d",&m);
    xs[xn++]=1;
    int amax=0,bmax=0;
    for(int it=1;it<=m;++it) {
        scanf("%s",qo[it]);
        if(qo[it][0]!='?'&&qo[it][0]!='R') {
            scanf("%d%d",&qa[it],&qb[it]);
            amax=max(amax,qa[it]);
            bmax=max(bmax,qb[it]);
            if(qo[it][0]=='+') ++qa[it];
            xs[xn++]=qa[it];
        }
        else
            scanf("%lld",&qq[it]);
    }
    sort(xs,xs+xn);
    xn=unique(xs,xs+xn)-xs;
    M=1;
    while(M<xn+3) M*=2;
    for(int i=1;i<M;++i) ls[i+M]=rs[i+M]=i;
    for(int i=M-1;i;--i) ls[i]=ls[i+i], rs[i]=rs[i+i+1];
    for(int it=1;it<=m;++it) {
        char o=qo[it][0];
        if(o!='?'&&o!='R') {
            int a=qa[it],b=qb[it];
            // cerr<<a<<"|";
            a=lower_bound(xs,xs+xn,a)-xs;
            assert(a>=0&&a<xn&&b>=1&&b<=1e9);
            // cerr<<a<<"w"<<b<<" "<<o<<"\n";
            if(o=='+') edt(root,0,a-1,-b);
            else if(o=='-') edt(root,a,xn,b);
            else assert(0);
        }
        else if(o=='R') {
            int q=qq[it];
            for(int j=it-1;j>=it-q;--j) {
                assert(j>=1);
                if(qo[j][0]=='?') continue;
                assert(qo[j][0]=='+');
                int a=qa[j],b=qb[j];
                a=lower_bound(xs,xs+xn,a)-xs;
                edt(root,0,a-1,b);
            }
        }
        else {
            ll q=qq[it];
            assert(q>=1&&q<=1e18);
            ll h1=hook1();
            // cerr<<h1<<","<<q<<"  "<<it<<"\n";
            // cerr<<"!"<<h1<<"\n";
            assert(h1%q==0);
            if(!h1) {
                puts("-1 -1");
                continue;
            }
            ll L=0,R=h1/q;
            //1: down, 0: left
            while(R!=L+1) {
                ll M=(L+R)>>1;
                if(qryb(M*q).se) L=M;
                else R=M;
            }
            auto qlq=qryb(L*q);
            // if =1, second is row length
            ll r1=qlq.fi,r2=qryb(R*q).fi;
            // cerr<<L*q<<" "<<R*q<<"   "<<qlq.se<<"\n";
            // cerr<<r1<<"  "<<r2<<"\n";
            ll Y=qlq.se-(q-(r2-r1))+1;
            printf("%lld %lld\n",r1,Y);
        }
    }
    cerr<<"m="<<m<<" amax="<<amax<<" bmax="<<bmax<<endl;
    cerr<<clock()<<"ms\n";
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 3ms
memory: 14184kb

input:

1000
- 1 999995
? 770771330
? 688406105220012703
? 466054413
? 1466199
? 940610359316496655
? 310504014100463831
? 765557590
? 419614901
? 830584303
? 85199513
? 768715778674812284
? 742663363105169125
? 859012516258231128
? 168409807482711289
? 842755243
? 618667253264707663
? 957265852
+ 1 1
+ 1 1...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 3
1 1
1 1
1 3
1 1
1 3
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 1
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 2
1 1
1 2
1 1
1 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 1
1 ...

result:

ok ok

Test #2:

score: 10
Accepted
time: 0ms
memory: 14328kb

input:

1000
- 1 999999992
? 426873616
- 1 256
? 670399288694575053
? 270955652351585633
? 258266169
? 358158412890035660
- 1 579
? 882074593944476252
? 575229109486341356
? 343017523563388060
? 73907450
? 730903768
? 413587891090231085
? 803451715032296303
? 945196920
+ 1 783
? 783
? 29
? 87
+ 1 933
+ 1 62...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 755
1 697
1 2343
1 2925
1 1
1 2941
1 2769
1 2925
1 1
1 1
1 2941
1 2510
1 2522
1 2497
1 2329
1 2426
1 1
1 2521
1 2497
1 1262
1 2522
1 1262
1 2426
1 1
1 2329
1 1
1 1
1 1
1 2510
1 2522
1 2522
1 2497
1 2522
1 1262
1 2497...

result:

ok ok

Test #3:

score: 10
Accepted
time: 2ms
memory: 14252kb

input:

1000
? 724684671
- 229 22497
+ 29 60
+ 275 51
+ 2 60
+ 50 60
+ 750 8
+ 856 8
+ 513 36
+ 65 59
+ 565 35
+ 36 60
? 1292
+ 17 60
+ 697 8
? 8
+ 416 38
? 1398
+ 205 51
+ 40 60
? 503
+ 57 60
+ 6 60
+ 393 39
? 2
+ 54 60
+ 100 56
+ 803 8
? 32
? 112
+ 130 56
+ 488 36
+ 30 60
+ 20 60
? 1
+ 63 59
? 1
+ 25 60
+...

output:

-1 -1
1 1
1 499
1 1
448 1
392 172
1 907
1 831
488 139
750 24
2 1377
1 2057
1 1
488 176
1 1
1 1363
2 2469
1 1
233 444
1 1
2 2924
4 3200
79 1283
77 1283
1 4049
1 1
1 4079
1 4147
1 1
1 3832
1 4446
1 5696
1 6374
1 5212
1 6172
1 6052
1 5692
1 1
1 6112
2 6292
1 6292
1 4012
1 5932
1 5812
1 6383
1 2813
1 46...

result:

ok ok

Test #4:

score: 10
Accepted
time: 0ms
memory: 14316kb

input:

1000
? 612443313965411255
- 398 867638065
- 338 149214194
? 412057943687439209
+ 29 2
+ 288 7
+ 1 60
+ 4 60
+ 181 12
? 1
+ 84 38
+ 234 8
? 237
+ 39 51
+ 2 60
+ 132 2
? 1
+ 7 2
+ 9 59
+ 61 2
+ 19 56
+ 3 60
+ 14 2
+ 342 7
+ 397 6
+ 5 60
+ 7 57
+ 288 1
+ 14 54
+ 132 11
? 29
+ 29 49
? 1122
? 102
+ 61 37...

output:

-1 -1
-1 -1
288 7
1 34
288 7
1 649
1 1
1 626
235 14
1 745
1 1
1 763
1 1
235 14
1 1
1 1
1 1
1 1
1 1
235 14
235 14
235 14
235 14
1 1
1 1
235 14
235 14
235 14
1 1
235 14
1 763
1 1
235 14
1 763
235 14
1 1
1 566
1 565
1 541
1 1
3 583
1 1
1 763
3 583
3 583
1 745
3 583
3 583
1 1
1 1
1 1
3 583
1 554
39 133
...

result:

ok ok

Test #5:

score: 10
Accepted
time: 2ms
memory: 12152kb

input:

1000
? 603050749
+ 78 59
+ 909 2
? 3
+ 66 60
+ 335 51
+ 245 51
+ 618 36
? 3
+ 38 60
+ 47 60
+ 827 34
+ 25 60
+ 345 51
+ 497 37
+ 30 60
+ 76 59
+ 6 60
+ 92 59
+ 285 51
+ 4 60
+ 29 60
+ 40 60
? 3
+ 53 60
+ 88 59
+ 14 60
+ 1 60
+ 42 60
+ 521 37
? 3
+ 74 59
+ 52 60
+ 32 60
? 1
+ 22 60
+ 5 60
+ 23 60
+ 1...

output:

-1 -1
908 1
617 37
4 1028
908 1
909 2
1 1841
1 1901
1 1849
1 2140
1 692
1 2195
1 1
6 1984
1 2433
1 2313
1 2653
1 1
3 3156
1 3246
1 1
1 1
1 3879
1 1
1 4229
1 1
1 4327
1 1
1 4473
1 1
76 2121
1 1
1 5218
1 5611
1 5612
1 5292
1 5026
1 6623
1 1
1 6743
1 1
1 7253
1 7383
37 5595
1 1
27 5475
37 5595
1 1
34 5...

result:

ok ok

Test #6:

score: 10
Accepted
time: 2ms
memory: 12140kb

input:

1000
+ 639 6
+ 6 60
? 44
? 1
+ 25 58
+ 201 35
+ 419 6
? 1
+ 76 2
+ 474 6
+ 10 60
+ 863 5
+ 14 60
+ 18 60
+ 227 35
+ 112 49
+ 8 60
? 11
? 1
? 1364
+ 12 60
+ 751 5
? 1429
+ 4 60
? 1
? 1489
+ 807 5
? 1
+ 11 60
+ 31 58
? 1
+ 149 2
+ 64 55
+ 34 58
? 1727
? 157
+ 919 5
? 4
+ 16 60
+ 46 55
+ 28 58
+ 58 55
...

output:

601 1
639 6
639 6
1 497
6 502
1 1
1 1
4 627
1 1
4 632
863 5
1 1
1 716
916 5
1 698
1 531
1 937
1 1
1 1477
875 1
1 1483
1 1
1 1439
1 1610
1 1615
1 1935
1 1
15 1415
1 1
19 1056
19 1114
1 1
1 708
17 1056
14 1474
14 708
17 1056
1 2229
19 1114
19 1056
1 2253
17 1056
1 708
19 1114
19 1114
1 1
1 2203
19 105...

result:

ok ok

Test #7:

score: 10
Accepted
time: 3ms
memory: 14276kb

input:

1000
- 886 3325373
- 421 609251347
- 74 509944584
- 353 790375490
- 597 946044374
- 542 516826393
+ 14 60
+ 15 60
+ 19 60
+ 46 59
? 2
+ 23 60
+ 56 59
+ 167 51
+ 60 59
+ 197 51
+ 77 56
? 1
+ 187 51
+ 542 13
+ 17 60
+ 357 39
+ 39 60
? 103
? 1339
+ 269 40
+ 147 51
? 2
? 1430
? 1
+ 21 60
+ 20 60
+ 82 56...

output:

13 239
14 575
1 710
1 1
167 244
1 1
167 245
13 1065
14 1065
13 1189
1 629
780 11
1 1448
1 1532
1 1739
1 1794
1 1854
1 1
1 1831
1 2088
1 1
1 2489
1 1
1 1
1 2927
1 3180
1 1
1 3329
1 4289
1 1
1 1885
1 1
448 63
1 4584
1 4693
1 3591
1 1
1 4863
59 1877
39 1477
51 1877
1 4572
1 4206
1 1
687 1
270 1
881 1
1...

result:

ok ok

Test #8:

score: 10
Accepted
time: 3ms
memory: 14324kb

input:

1000
? 836688957840823224
- 306 679936336
+ 48 60
+ 58 59
+ 35 60
+ 28 60
+ 102 56
+ 520 36
+ 167 51
+ 23 60
? 31
+ 15 60
+ 50 2
? 341
+ 8 60
+ 66 59
+ 47 60
? 601
? 1202
+ 43 60
+ 347 37
+ 683 6
? 734
+ 87 56
+ 628 2
+ 26 60
+ 495 36
+ 21 60
+ 243 50
? 1732
+ 7 60
+ 9 60
+ 39 60
+ 10 60
+ 97 56
+ 3...

output:

-1 -1
494 32
1 211
1 148
1 1
1 154
1 1
1 1781
1 1951
1 2561
1 1
1 2734
1 2951
1 3349
8 3721
1 4116
1 1
1 4307
1 1
1 1
1 2882
1 4905
1 1
1 5074
1 3726
1 1
1 1
1 1
1 5295
1 1
57 872
1 1
73 1737
57 1
75 1737
73 1625
1 5340
75 1737
57 1569
73 1625
65 1625
58 2326
73 1737
57 872
75 1737
75 1737
57 1569
7...

result:

ok ok

Test #9:

score: 10
Accepted
time: 2ms
memory: 14264kb

input:

1000
+ 44 60
+ 24 60
? 163
+ 52 60
? 1
? 3
? 33
+ 28 60
+ 258 49
? 546
+ 54 60
? 6
+ 79 59
? 665
+ 306 49
+ 39 60
+ 32 60
+ 282 49
+ 270 49
? 70
+ 61 2
? 1
+ 6 60
+ 698 33
+ 615 34
+ 43 60
+ 50 60
? 1
+ 8 60
+ 59 60
+ 535 35
+ 156 55
+ 57 60
+ 83 59
+ 840 4
+ 135 56
? 2152
+ 110 56
+ 561 35
+ 318 49...

output:

1 1
24 180
22 180
46 34
1 1
43 225
1 1
222 163
306 49
698 33
1 1
1 1286
698 39
6 1786
1 1
1 1
1 2024
1 2273
1 2360
1 2692
1 1
32 1535
4 3042
1 2802
1 1182
1 3218
1 3268
1 1
1 3596
1 3592
1 3577
1 3718
1 3719
1 1
1 1
1 4381
1 4729
1 1
1 1
1 4818
1 4896
1 1
1 4938
1 1
1 5054
1 2172
1 5280
1 3756
1 546...

result:

ok ok

Test #10:

score: 10
Accepted
time: 1ms
memory: 4108kb

input:

1000
- 1 999999996
? 503511061
? 999085692614634733
? 647103043
? 820196349493776381
? 652137897
+ 1 102
? 1
? 102
- 1 997
+ 1 348
? 87
? 12
? 4
+ 1 426
+ 1 313
? 1087
- 1 285
? 802
? 1
+ 1 131
? 933
? 1
? 311
+ 1 279
+ 1 531
? 3
? 1743
? 249
? 1
? 83
? 7
? 249
? 1
? 21
? 581
? 3
? 83
+ 1 846
? 863
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 102
1 1
1 262
1 337
1 345
1 1
1 1
1 802
1 1
1 933
1 623
1 1741
1 1
1 1495
1 1743
1 1661
1 1737
1 1495
1 1743
1 1723
1 1163
1 1741
1 1661
1 1727
1 1
1 2589
1 2587
1 2587
1 1
1 1727
1 2589
1 2589
1 1899
1 1
1 1891
1 1
1 1256
1 1408
1 1414
1 2086
1 2085
1 2080
1 1044
1 1...

result:

ok ok

Test #11:

score: 10
Accepted
time: 0ms
memory: 14132kb

input:

1000
? 58814603
+ 532 3
+ 60 2
? 134
+ 265 5
? 1
+ 1 30
+ 10 30
+ 476 4
+ 395 5
+ 11 30
? 1
+ 12 30
+ 40 26
+ 9 30
+ 23 29
? 755
+ 317 5
+ 4 30
? 10
+ 343 5
+ 422 4
+ 91 20
+ 17 2
? 1
+ 6 30
+ 25 29
+ 504 3
? 883
+ 15 30
+ 50 26
+ 114 2
+ 291 5
+ 8 30
? 1
+ 14 30
+ 2 30
+ 239 6
+ 139 6
+ 70 21
+ 449...

output:

-1 -1
401 1
265 8
532 3
1 1
525 1
343 21
1 1
1 445
524 1
11 242
1 1
1 788
1 844
1 402
1 820
485 1
36 1
370 1
450 7
423 1
115 1
1 1
215 1
423 7
450 1
36 245
1 1
318 1
532 3
449 14
1 844
266 39
290 44
215 24
1 1
41 1
266 34
215 34
1 889
532 3
1 253
20 360
20 389
13 253
17 360
20 253
1 1
20 360
1 253
2...

result:

ok ok

Test #12:

score: 10
Accepted
time: 0ms
memory: 4048kb

input:

1000
? 641775127
+ 658 6
? 663
+ 57 2
+ 27 30
+ 157 21
? 2
+ 22 30
+ 464 8
+ 14 30
? 56
+ 219 10
? 1
+ 48 29
? 1
? 823
+ 21 30
+ 147 21
+ 1 30
+ 18 30
? 1
+ 6 30
+ 97 26
+ 283 9
+ 20 30
+ 72 26
+ 87 26
+ 19 30
? 1111
+ 633 6
+ 7 30
? 31
+ 52 29
? 1
+ 127 21
+ 44 29
+ 50 29
+ 261 10
? 1
+ 28 30
+ 4 3...

output:

-1 -1
1 1
658 5
608 1
658 6
464 14
1 1
658 6
1 1
2 434
48 219
1 608
1 1
1 1
1 1
464 35
757 1
1 1
1 1008
1 1
1 1431
1 1434
1 1499
763 17
1 1
1 1535
1 1628
1 1
1 1701
1 1
903 3
1 1768
1 942
1 1
1 1819
1 942
1 1817
1 1
1 942
1 1
1 1817
1 1817
1 1
1 1819
1 1
1 1817
1 1819
1 1
1 942
1 1819
1 1817
1 1457
...

result:

ok ok

Test #13:

score: 10
Accepted
time: 3ms
memory: 14328kb

input:

1000
? 322718911
? 527680755138194048
- 127 243926522
- 449 695974349
- 191 588919912
+ 30 30
? 59
+ 78 29
+ 856 5
+ 16 30
+ 25 30
+ 50 30
+ 52 30
+ 191 20
+ 60 29
+ 150 2
? 109
+ 135 26
+ 4 30
+ 44 30
+ 29 30
+ 6 30
? 1236
+ 397 6
+ 297 19
+ 14 30
+ 472 6
+ 908 5
+ 76 29
? 1
+ 33 30
+ 110 26
+ 622 ...

output:

-1 -1
-1 -1
1 1
752 1
1 1
908 5
1 467
908 5
1 1
908 5
607 1
908 5
1 542
1 263
1 888
1 1
1 1
1 1273
1 1398
484 1
1 1428
1 1
1 1
1 1492
1 1059
1 1
1 1572
1 1
908 5
17 1536
1 1
1 1
1 2082
7 1914
1 1
1 2210
572 57
1 2334
1 2440
823 1
1 1
1 2576
1 964
448 46
598 46
598 56
1 1
573 1
1 236334
1 236311
1 23...

result:

ok ok

Test #14:

score: 10
Accepted
time: 0ms
memory: 14132kb

input:

1000
+ 24 30
+ 2 30
+ 93 28
+ 32 30
+ 96 28
+ 114 28
+ 69 2
+ 6 30
+ 55 30
? 349
? 1
? 1
+ 375 19
+ 836 6
? 1
+ 911 6
+ 11 30
+ 183 25
+ 159 25
+ 15 30
+ 60 30
+ 141 25
+ 231 2
+ 53 30
+ 105 28
+ 75 28
+ 611 6
+ 147 25
+ 25 30
? 1
+ 17 30
? 507
? 9
+ 4 30
? 1
+ 7 30
+ 636 6
+ 12 30
? 539
? 231
? 3
+...

output:

1 1
93 84
93 84
836 6
911 6
1 200
908 1
141 139
396 1
692 1
911 4
93 257
1 1
1 1
1 1
1 432
1 1546
1 1
1 1
596 41
1 1
1 1778
1 1
1 2022
2 2055
26 1020
1 1967
1 2123
1 1
1 2511
1 1
1 1737
104 758
1 1
1 2728
1 1
1 2877
1 1
1 1
1 1089
1 2693
1 3039
1 1770
1 1
1 1
861 18
1 3249
1 1
38 2197
1 1
1 1
38 219...

result:

ok ok

Test #15:

score: 10
Accepted
time: 0ms
memory: 14324kb

input:

1000
- 60 823078266
+ 306 20
+ 589 8
+ 74 29
+ 54 30
? 1
+ 72 29
+ 751 7
+ 20 30
+ 8 30
+ 134 26
+ 405 20
+ 895 7
? 565
+ 48 30
? 1160
? 10
+ 23 30
+ 119 26
+ 94 29
? 1245
+ 727 8
? 1253
+ 82 29
+ 19 30
+ 36 30
+ 44 30
+ 55 30
+ 799 7
+ 3 30
? 1
+ 124 26
? 1
? 1465
+ 428 2
+ 264 21
+ 41 30
+ 823 7
+...

output:

589 8
372 1
1 1
892 1
1 1
1 1
895 7
895 7
1 1
727 36
895 7
727 36
1 250
3 1161
1 1
19 1127
787 25
1 1362
1 1
1 1387
1 1
1 1621
1 1218
1 1787
1 1306
1 1
1 1
1 1
6 2035
1 1729
1 1
8 2109
1 2229
1 2431
1 1
1 2527
1 1
1 2913
1 2973
1 2999
1 3073
1 3288
1 2311
1 3368
1 3476
1 3522
1 3541
1 3009
13 3249
1...

result:

ok ok

Test #16:

score: 10
Accepted
time: 0ms
memory: 14340kb

input:

1000
? 200865510
+ 509 4
+ 16 12
+ 256 5
? 23
+ 62 11
+ 3 12
+ 31 12
+ 29 12
+ 4 12
+ 200 5
? 593
? 1
+ 64 11
+ 392 4
+ 296 5
+ 124 9
+ 192 5
+ 446 4
+ 280 5
+ 78 11
+ 338 4
+ 51 12
+ 25 12
+ 383 4
+ 500 4
+ 41 12
+ 100 9
? 1
+ 47 12
+ 14 12
+ 374 4
+ 482 4
+ 12 12
+ 356 4
+ 128 9
+ 52 12
+ 80 11
+ ...

output:

-1 -1
490 1
1 1
509 4
3 196
1 1
1 1
1 1
1 1
1 328
481 9
424 1
444 21
1 1
554 4
43 296
109 1
1 1
1 1
49 190
556 1
1 1
1 809
1 857
563 4
563 3
1 1
287 104
563 4
563 3
43 501
1 1
291 1
1 1
1 1
1 1
232 176
4 1093
1 1
1 384
49 588
35 576
49 564
36 768
1 1
49 600
1 1126
37 755
35 384
5 1137
49 600
49 516
...

result:

ok ok

Test #17:

score: 10
Accepted
time: 0ms
memory: 14192kb

input:

1000
? 997038533866592106
+ 563 3
+ 158 8
+ 213 3
+ 11 12
+ 393 3
+ 623 3
? 654
+ 42 12
? 6
? 9
+ 423 3
? 1
+ 243 3
+ 40 12
? 57
+ 713 3
+ 38 12
? 1
? 263
? 789
+ 503 3
+ 19 12
+ 163 8
? 812
+ 4 12
? 412
+ 233 3
+ 57 12
+ 22 12
+ 673 3
+ 183 3
+ 41 12
+ 44 12
+ 313 3
? 442
+ 18 12
+ 373 3
? 31
+ 37 ...

output:

-1 -1
1 1
620 1
617 1
623 3
569 1
713 3
459 1
1 1
1 1
319 1
295 1
685 1
713 3
1 1
1 1
707 1
713 3
37 195
713 3
1 1
595 1
1 359
572 14
1 1
446 31
715 1
1 1
656 8
443 42
665 1
1 572
1 575
5 541
29 452
1 1
1 634
1 635
1 647
343 93
1 732
1 679
723 3
1 859
1 1
1 1
1 914
118 1
1 1
16 847
5 981
1 1
1 1041
...

result:

ok ok

Test #18:

score: 10
Accepted
time: 3ms
memory: 14220kb

input:

1000
? 591451888148632183
- 478 549549332
- 787 581090850
- 265 537152516
+ 32 12
+ 427 5
+ 590 4
+ 58 12
? 1
+ 63 12
? 317
+ 395 5
+ 41 12
? 651
+ 139 9
? 60
+ 17 12
+ 97 11
+ 403 5
+ 23 12
+ 57 12
+ 19 12
? 362
+ 105 11
+ 51 12
+ 99 11
+ 387 5
+ 89 11
+ 680 4
? 28
+ 127 9
+ 85 11
? 888
+ 119 9
+ 1...

output:

-1 -1
590 4
282 1
1 1
534 1
247 1
656 1
1 1
1 1
680 4
1 1
680 4
680 4
662 5
1 1
1 1
451 34
699 1
590 24
1 1
717 1
1 1
581 32
1 1
167 1
590 1
734 4
1 616
1 536
734 3
1 1
734 4
734 4
1 1
371 93
395 82
370 102
1 1
1 793
588 31
597 31
1 1
3 879
19 815
3 928
357 69
590 1
133 111
135 1
734 12
581 64
121 1...

result:

ok ok

Test #19:

score: 10
Accepted
time: 2ms
memory: 14184kb

input:

1000
? 856936698
+ 836 3
? 419
+ 120 11
+ 776 3
? 1
+ 118 11
+ 98 11
? 1
+ 79 12
+ 63 12
? 898
+ 141 2
? 900
+ 876 3
? 1
+ 386 3
+ 376 3
? 949
+ 696 3
? 2
+ 31 12
+ 8 12
+ 108 11
+ 52 12
+ 146 8
? 1007
? 1
+ 456 3
? 505
+ 38 12
+ 176 8
+ 616 3
+ 75 12
+ 45 12
+ 216 8
+ 59 12
+ 51 12
+ 39 12
+ 606 3
...

output:

-1 -1
420 1
836 3
836 3
1 1
1 1
876 3
1 1
875 3
1 1
386 15
1 16
876 9
906 1
348 1
864 7
906 3
615 27
906 3
716 18
816 16
836 15
906 3
1 1
1 1
905 3
906 3
905 3
52 398
1 84
866 12
210 1
611 28
1 1
1 1
1 1
796 24
64 432
6 984
59 655
1 1
2 1148
2 1148
859 1
2 1208
57 736
1 1
1 1
3 1284
1 1342
1 1359
1 ...

result:

ok ok

Test #20:

score: 10
Accepted
time: 2ms
memory: 14184kb

input:

1000
- 928 780094783
- 710 398698340
- 355 708243512
- 222 934705837
- 273 29457417
+ 7 12
+ 166 8
+ 113 11
+ 139 11
+ 181 8
+ 35 12
+ 21 12
+ 801 3
? 877
+ 53 12
+ 127 11
+ 88 12
+ 301 3
? 183
? 1
+ 196 8
+ 441 3
+ 125 11
+ 47 12
+ 271 2
+ 151 11
? 962
+ 601 3
+ 38 12
+ 221 8
+ 45 12
? 997
+ 34 12
...

output:

1 1
621 1
801 3
1 1
1 1
801 3
1 1
1 1
271 14
1 1
801 3
1 1
661 5
1 1
791 1
1 1
1 1
797 1
801 3
1 1
229 1
801 3
691 1
1 1
1 1
562 1
801 3
801 3
1 1
1 1
801 3
611 13
1 1
404 1
4 710
101 259
1 1
1 652
34 577
1 832
739 1
1 584
61 527
17 836
867 6
1 1
880 3
1 1
21 849
1 197
620 36
197 87
5 1123
61 707
1 ...

result:

ok ok

Test #21:

score: 10
Accepted
time: 3ms
memory: 14340kb

input:

1000
+ 8 12
+ 636 3
+ 15 12
+ 94 12
+ 356 3
+ 85 12
? 13
+ 556 3
+ 206 8
+ 24 12
+ 20 12
+ 111 11
? 49
? 7
+ 79 12
+ 846 3
+ 131 11
+ 77 12
+ 13 12
? 995
+ 546 3
+ 21 12
? 1010
+ 47 12
? 73
+ 27 12
+ 57 12
+ 816 3
+ 151 11
+ 211 8
+ 786 3
+ 54 12
+ 856 3
+ 886 3
+ 486 3
? 1132
+ 536 3
+ 12 12
? 1147...

output:

626 1
590 1
632 1
1 1
1 1
776 1
1 1
1 1
858 1
735 1
1 1
541 28
1 1
1 1
596 27
1 1
1 1
805 11
815 1
886 3
1 1
1 1
886 6
1 709
1 701
1 1
70 409
906 1
419 73
1 391
906 3
6 996
1 1
806 30
1 1
6 1146
1 1
231 176
204 126
1 1
1 587
1 825
1 1
1 1
1 1026
1 1
1 1511
1 1499
1 1419
1 1576
1 1
1 1
846 21
1 1266
...

result:

ok ok

Test #22:

score: 10
Accepted
time: 2ms
memory: 12108kb

input:

1000
+ 593 132415
- 310 420098
+ 576 965794
+ 509 638949
- 637 368901
+ 46 196629
+ 619 517472
+ 424 441788
+ 772 340443
+ 418 139594
- 21 147269
+ 383 456861
- 628 598537
+ 51 595087
+ 146 948842
- 942 435406
- 357 40209
+ 811 716421
+ 806 540386
+ 204 538624
- 891 312107
+ 598 65368
+ 355 739033
+...

output:

1 1
6 66847345
1 66844514
1 1
1 66823788
6 66847345
6 66847345
1 1
1 66844514
1 1
6 66847345
6 66847345
1 66844514
6 66847345
1 1
1 1
1 1
6 66847345
1 1
1 66844514
6 66847345
6 66847345
1 1
1 66844514
1 1
1 66823788
1 1
1 66844514
6 66847345
6 66847345
1 1
1 1
1 1
6 66847345
1 1
1 1
1 1
6 66847345
6...

result:

ok ok

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 20
Accepted
time: 2ms
memory: 14120kb

input:

1000
- 1 999992
? 637280166636841974
? 122747834
+ 1 1
? 1
? 1
? 1
? 1
- 1 1
? 770322629409376789
+ 1 1
? 1
? 1
? 1
? 1
- 1 1
+ 1 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
+ 1 1
+ 1 1
? 3
+ 1 1
? 2
? 1
+ 1 1
? 5
+ 1 1
? 6
? 1
? 3
? 2
? 1
+ ...

output:

-1 -1
-1 -1
1 1
1 1
1 1
1 1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 3
1 4
1 1
1 1
1 6
1 4
1 5
1 6
1 1
1 7
1 5
1 8
1 1
1 7
1 10
1 9
1 1
1 10
1 9
1 1
1 6
1 9
1 10
1 1
1 1
1 9
1 10
1 9
1 1
1 6
1 10
1 1
1 9
1 7
1 10
...

result:

ok ok

Test #24:

score: 20
Accepted
time: 0ms
memory: 14324kb

input:

1000
- 1 999999995
? 895722220
? 622701657484514284
? 749191541
? 760407573
? 256900305987464119
? 366941537
? 606282059898057385
? 242911831452679328
? 62941208393497996
? 635277918903264521
? 364101078
? 668570749
? 782177832606476483
? 488263309
? 846845755610111030
? 683601827513277887
? 5323761...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
41 165
28 635
1 1
1 412
1 1
28 633
28 635
1 412
28 633
28 633
1 1
28 635...

result:

ok ok

Test #25:

score: 20
Accepted
time: 2ms
memory: 14184kb

input:

1000
? 883233335
- 363843 95831
- 753410 82908
? 281607526
+ 2575 5
+ 257 51
+ 80 59
+ 102 56
+ 1353 6
? 7
? 131
+ 19 60
+ 35 60
? 33
? 2871
? 957
? 1
+ 1133 6
+ 28 60
? 979
? 1
+ 56 60
+ 167 51
? 24
+ 54 60
+ 1078 6
+ 87 2
+ 12 60
? 4
+ 127 56
+ 22 60
+ 1 60
? 3352
+ 3083 4
? 24
+ 78 59
? 1
? 3923
...

output:

-1 -1
-1 -1
2573 1
2449 1
2547 1
1 1
1623 1
2575 5
1601 1
2575 5
2556 1
2572 5
1 1
3063 1
3083 4
1 1
3083 4
2935 1
2573 9
1075 1
2973 1
2813 1
1 1
3081 4
1696 1
3066 1
3251 1
3215 1
1 1
1 1415
3191 1
3254 4
1 1
1980 1
3013 1
1 1
690 1
1 1
1 1
3425 4
3425 4
1 2712
1 2330
3414 1
1 1
64 1390
1 1
1 239
...

result:

ok ok

Test #26:

score: 20
Accepted
time: 2ms
memory: 14200kb

input:

1000
+ 61 2
? 62
+ 8 2
? 16
+ 1 60
+ 6 60
? 46
+ 4 60
? 61
? 122
+ 5 60
? 19
+ 393 6
+ 15 2
+ 40 51
? 695
+ 20 56
? 751
+ 338 6
+ 10 59
+ 2 60
+ 180 12
+ 283 9
+ 83 39
+ 131 2
+ 231 10
+ 30 2
+ 3 60
? 1010
+ 25 56
+ 30 54
+ 61 39
+ 15 54
+ 7 60
+ 8 58
+ 131 11
? 1342
? 22
? 122
? 61
? 1342
R 13
+ 15...

output:

1 1
47 1
1 79
2 66
1 66
1 226
1 1
1 1
1 1
1 1
1 929
41 57
41 96
1 1
1 711
30 299
1 1
21 1
62 118
62 79
1 929
1 949
21 1
62 118
62 118
62 79
388 1
1 528
1 656
1 716
1 827
6 529
1 940
13 294
1 1
13 238
1 294
13 238
1 294
1 294
13 294
13 294
1 294
1 1
1 1
1 929
1 950
1 949
1 1
1 940
13 294
13 238
1 294...

result:

ok ok

Test #27:

score: 20
Accepted
time: 0ms
memory: 14328kb

input:

1000
- 744068 585281
+ 3217 5
+ 3945 5
+ 596 38
+ 2057 7
+ 3441 5
+ 669 36
+ 105 56
? 64
+ 36 60
+ 9 60
? 4
+ 35 60
+ 2441 6
? 4282
+ 85 59
? 1447
+ 53 60
? 9
+ 23 60
+ 1787 7
+ 345 51
+ 13 60
+ 75 59
+ 2 60
? 1566
? 87
? 783
+ 37 60
+ 25 60
? 146
+ 3777 5
+ 4057 5
+ 63 60
? 5000
? 4
+ 4627 4
+ 2661...

output:

3379 9
3942 5
1 1
2513 1
3941 1
2400 1
3863 1
3177 1
3804 1
1 1
4054 5
1 1
4576 1
4627 4
1 1
1 1
4627 4
3777 19
4627 4
4626 1
4624 1
4627 4
1 1
2 3535
4114 10
1 4299
1 4228
1 3510
4684 4
1 1
3553 49
1 2900
1 1
1 4842
2 5056
1 1
2 5056
1 1
2 5094
1 1926
4684 4
2 5266
1 1
2 5574
1 803
1 5710
1 5764
1 ...

result:

ok ok

Test #28:

score: 20
Accepted
time: 0ms
memory: 14260kb

input:

1000
? 633778962213240036
- 851177905 750702799
- 378492115 580518445
- 465131557 630960174
+ 37 2
+ 875 6
+ 14 60
+ 391 8
+ 1097 5
+ 6 60
? 1
+ 28 59
+ 52 56
+ 1434 4
+ 20 60
? 1
+ 657 7
+ 550 8
+ 711 7
+ 2 60
+ 497 8
+ 47 56
+ 285 2
+ 3 60
? 1961
? 37
+ 16 60
+ 42 56
+ 765 7
+ 1041 5
+ 109 50
+ 20...

output:

-1 -1
1097 5
1434 4
1 1
1401 1
1427 1
1 1
1153 19
1 279
1 1
1434 4
28 643
1 1298
1 1
1 771
28 643
1 1
1 1120
985 1
1 1
1 1
1434 4
1 1
1385 1
68 1
551 40
766 40
551 1
931 40
876 40
1 1
818 63
876 40
1 1
876 40
985 46
766 40
551 40
876 40
68 1
931 40
766 40
551 1
551 1
1 1
551 40
1 2409
551 1
876 40
9...

result:

ok ok

Test #29:

score: 20
Accepted
time: 0ms
memory: 14132kb

input:

1000
- 943099343 513027683
+ 4 60
? 3
+ 2538 6
+ 10 60
+ 415 38
+ 962 12
? 2713
+ 1571 9
+ 1938 8
+ 326 39
? 1
? 2769
+ 191 51
+ 864 12
? 6
+ 23 60
+ 2045 7
? 13
+ 913 12
+ 1062 11
? 2
+ 61 59
+ 815 13
? 3
+ 141 51
+ 2594 5
? 1
+ 2318 6
+ 116 56
+ 31 60
? 807
+ 1 60
+ 66 2
+ 2 60
+ 1779 9
+ 26 60
+ ...

output:

4 58
1 1
2538 6
1 1
2538 1
2531 1
2538 5
2538 4
2594 5
1819 1
2582 1
1 1
1 1
1 1
2594 5
1 1
1571 85
1 1
1 2577
1 1
2533 14
1 2289
1 1
1 1
1 3913
1 1
1 4157
1 1
1 4433
1 1
1 1
1 4809
1 1
92 1843
1 1
1 5285
92 1843
1 1
1 1
92 1843
1 5250
1 1
132 1
1 1
1 5047
1 1
1 1367
2692 1
70 684
1 4578
1 4935
1 49...

result:

ok ok

Test #30:

score: 20
Accepted
time: 0ms
memory: 14184kb

input:

1000
? 43032597990244423
? 455130775583464288
? 412733204506561581
+ 70 59
+ 1996 6
+ 76 59
+ 2903 4
? 1
+ 32 60
? 103
+ 593 2
? 4
+ 72 59
? 1
? 3151
? 23
+ 15 60
+ 98 56
+ 37 60
+ 223 51
+ 1017 8
+ 2 60
? 3446
+ 78 59
+ 2618 4
+ 38 60
? 83
? 3569
? 43
+ 1 60
? 3629
? 191
? 1
+ 1886 6
+ 858 8
+ 83 2...

output:

-1 -1
-1 -1
-1 -1
2903 4
2804 1
2903 1
2903 4
1 1
2884 1
1 1
2824 1
1 1
2864 1
1 1
2716 1
2903 4
1879 19
1 31
551 31
1614 1
1 1
2589 1
2903 4
2806 1
703 1
2259 1
2840 1
2865 1
43 1050
2903 4
2903 4
1 1
2901 4
2879 1
1 2610
1 2547
2887 1
1 350
1 382
2903 4
2893 1
1 2877
1 1
1 3633
9 3372
1 1
1 3837
1...

result:

ok ok

Test #31:

score: 20
Accepted
time: 3ms
memory: 14324kb

input:

1000
? 402253789334530553
? 395409983577110390
+ 6 60
+ 7 60
+ 176 51
+ 297 2
+ 131 56
+ 1035 10
+ 1399 9
? 1646
? 823
+ 362 39
+ 16 60
+ 2092 7
? 1
? 489
+ 2696 5
? 2
+ 1716 8
+ 385 38
? 10
? 3100
+ 882 10
+ 2473 6
+ 20 60
+ 23 60
+ 2200 7
+ 50 60
? 3303
+ 14 60
+ 552 36
+ 38 60
? 3
+ 780 10
+ 3377...

output:

-1 -1
-1 -1
1 1
595 1
2092 7
1610 1
2695 5
2691 1
1 1
1 1
2695 4
1 1
3377 4
1 191
3377 3
3377 1
1 1
1 1
1 2297
3331 1
3371 1
3352 1
1 1
1 1
2 3387
2 3387
1 3402
3377 3
2 3587
1 1
1 1
2 3942
1 3915
2473 55
1 2763
1 3951
1 1
1 4258
2 4309
1 2810
1 1
223 1
1 5051
1 3501
1 1
1 5235
1 1
1 4925
1 5266
1 5...

result:

ok ok

Test #32:

score: 20
Accepted
time: 3ms
memory: 14184kb

input:

1000
- 1 999999998
? 191047433372939880
? 689332612536469355
? 991049930
? 471407569263308015
+ 859 728
? 1586
? 61
? 2
? 26
? 1
? 122
? 793
? 13
+ 203 794
? 119
? 10
? 1
? 476
? 595
? 34
? 70
? 17
? 14
? 7
? 1190
? 2380
? 340
- 694 870
? 18
? 246
- 704 181
? 18
? 41
? 2214
? 123
? 3
+ 777 124
- 939...

output:

-1 -1
-1 -1
-1 -1
-1 -1
1 1
855 672
859 727
859 703
859 728
855 611
794 1
859 716
754 715
857 721
859 728
1 1249
397 596
839 715
817 701
856 715
859 715
859 722
397 1
1 1
567 681
683 721
1 1479
683 721
683 698
1 1
683 616
692 727
693 852
691 841
1 1
418 1
591 609
693 851
591 782
1 1
691 848
569 335
...

result:

ok ok

Test #33:

score: 20
Accepted
time: 3ms
memory: 14328kb

input:

1000
+ 337 4
+ 421 3
? 61
+ 14 30
? 457
? 1
+ 365 3
? 20
+ 205 6
? 1
+ 505 3
+ 3 30
+ 310 4
+ 257 5
+ 65 20
+ 12 30
+ 22 29
+ 449 3
+ 283 5
+ 393 3
? 62
? 31
+ 76 20
+ 34 26
+ 15 30
+ 24 29
+ 7 30
+ 9 30
? 11
+ 16 30
+ 11 30
+ 87 20
+ 477 3
+ 20 29
+ 6 30
+ 44 26
+ 10 30
? 1
+ 110 2
+ 133 8
+ 1 30
+...

output:

363 1
1 1
421 3
347 5
365 6
228 27
228 32
497 1
3 541
1 1
1 617
499 1
1 1
450 4
1 799
1 1
1 1
258 27
1 1
232 27
35 1
1 1
1 778
1 1
19 322
1 212
1 859
17 322
1 1
1 1
12 212
12 553
1 1
88 71
88 71
1 953
1 1
1 1
1 1
30 274
1 908
30 274
1 1
30 274
1 1
1 1
1 953
30 274
1 1
1 908
1 1
30 274
30 274
30 274
...

result:

ok ok

Test #34:

score: 20
Accepted
time: 0ms
memory: 14344kb

input:

1000
- 820258425 145131798
+ 824 4
+ 908 3
? 2
+ 40 29
+ 717 5
+ 936 3
+ 46 29
+ 1 30
? 1
? 1038
+ 434 6
+ 18 30
+ 7 30
+ 5 30
+ 484 6
? 570
+ 880 3
+ 6 30
+ 3 30
+ 138 21
+ 2 30
+ 587 5
? 1
+ 28 30
+ 73 26
+ 16 30
+ 118 21
+ 36 29
? 93
+ 25 30
+ 128 21
+ 58 26
+ 88 26
? 107
+ 160 20
? 11
+ 10 30
+ ...

output:

907 3
908 6
1 1
393 1
936 3
852 1
838 1
898 6
935 3
933 1
1 709
1 708
935 3
1 643
1 1
3 744
1 914
1 1
936 3
1 1016
1 1
1 616
1 1
1 1358
1 1
69 1
936 3
1 1129
1 734
1 839
1 1762
51 510
1 1790
1 1
51 458
30 163
51 458
1 1706
51 510
30 163
51 458
51 510
51 510
1 1
51 458
882 1
1 1
51 510
1 1
30 163
51 ...

result:

ok ok

Test #35:

score: 20
Accepted
time: 0ms
memory: 12296kb

input:

1000
? 343701946976016788
? 817104848
+ 1027 5
+ 86 26
+ 1 30
+ 871 5
+ 923 5
+ 1159 4
? 1
? 411
+ 21 30
+ 25 30
+ 26 30
+ 76 2
+ 392 6
+ 1456 4
+ 667 6
? 1
+ 793 5
+ 467 6
+ 7 30
+ 1294 4
+ 42 30
+ 897 5
+ 15 30
+ 1079 5
+ 442 6
+ 1053 5
? 42
+ 1267 4
+ 39 30
+ 46 30
+ 717 6
+ 29 30
+ 10 30
+ 30 30...

output:

-1 -1
-1 -1
1159 4
767 1
1456 4
1418 1
1312 1
1020 32
1105 12
1186 12
1596 1
1596 3
1596 3
1 1
1 1
1596 3
1 1
1596 3
1 1
1582 1
323 1
313 1
1 1
1595 3
1 1
1 1498
1 1
1 1496
1 1642
914 35
1 1
601 1
467 120
1 1816
1 1865
1 1
1 1
1 1980
1 1
1 2100
1 1
1374 26
1 1
1 2142
1 1235
1457 1
1652 6
1246 1
1267...

result:

ok ok

Test #36:

score: 20
Accepted
time: 3ms
memory: 14260kb

input:

1000
- 818800624 446646434
- 27414106 735469552
? 111568553
- 441631873 295236704
- 249860804 762203017
- 553642689 693917976
? 217971857
- 425015676 590766431
- 334516507 936725365
- 376162412 508802174
- 57313907 213779630
+ 387 19
+ 10 30
? 3
+ 63 30
+ 105 28
+ 35 30
+ 38 30
? 7
+ 1178 4
+ 42 30
...

output:

-1 -1
-1 -1
385 19
385 15
1926 1
1995 1
2033 3
1186 1
2033 1
2032 3
1 1
2032 3
1913 1
2032 3
1 1
1542 1
2032 3
1 1
1367 19
1366 18
1367 19
2 1066
1 1
1 1
2228 3
2225 1
1 1
1 1
1 1
2313 3
1286 43
1032 1
1 1
1 2039
1 2021
1 1
1 1
2313 1
1 1
2313 1
2168 8
2274 1
2288 1
1 2603
1720 50
1 1198
1 1
1 1
1 1...

result:

ok ok

Test #37:

score: 20
Accepted
time: 3ms
memory: 14156kb

input:

1000
+ 22 30
? 51
+ 837 8
+ 2021 3
? 1
+ 53 30
+ 998 8
+ 71 30
+ 61 30
+ 375 21
? 1
+ 748 9
? 2189
+ 72 30
+ 1238 7
+ 1214 7
+ 9 30
+ 17 30
+ 385 21
+ 170 26
+ 16 30
? 395
? 3
+ 1567 5
? 2375
+ 1287 6
+ 405 21
+ 200 26
? 1214
+ 85 29
+ 315 21
+ 1046 7
+ 426 2
+ 25 30
+ 68 30
+ 1645 5
+ 109 29
+ 31 3...

output:

1 1
2021 3
2021 3
1 1
861 8
2021 1
1 1
843 1
2018 1
940 23
2179 1
1 1
2189 3
2189 3
1 1
1 1
1 890
1 90
9 900
1999 12
2217 3
1 1
637 1
1 1
9 1377
2217 3
2189 6
2015 1
2189 6
2203 1
1 1
1 1814
2216 3
700 138
1 1
7 2433
2140 1
28 2245
2092 1
2216 3
56 1694
1 2970
1 2048
1 2789
1 3080
1 3171
1 1
1 1
1 3...

result:

ok ok

Test #38:

score: 20
Accepted
time: 3ms
memory: 14320kb

input:

1000
+ 16 12
+ 26 12
? 1
+ 41 12
+ 611 3
+ 291 3
+ 71 11
+ 12 12
? 5
? 45
+ 561 3
+ 531 3
+ 43 12
+ 28 12
? 705
+ 106 8
+ 351 3
? 1
? 358
+ 37 12
+ 341 3
+ 31 12
+ 33 12
+ 15 12
+ 461 3
+ 521 3
+ 81 8
? 781
+ 421 3
+ 126 8
+ 451 3
+ 431 3
+ 46 12
+ 661 3
? 1
+ 241 3
+ 3 12
+ 6 12
+ 131 8
+ 67 11
? 1...

output:

16 24
609 1
569 1
1 1
611 3
268 1
1 1
451 21
451 21
1 249
388 26
221 60
191 1
421 33
661 3
594 1
1 1
413 39
671 3
670 3
652 1
671 3
1 397
651 7
601 15
6 697
1 1
641 13
181 148
643 15
1 963
1 1
542 31
572 31
432 1
572 34
1 1
92 1
571 40
562 1
1 957
1 1
25 663
26 675
1 955
1 962
1 1
147 151
58 157
122...

result:

ok ok

Test #39:

score: 20
Accepted
time: 2ms
memory: 14140kb

input:

1000
? 799101924556869888
? 634727384
- 551823302 458749052
- 160594369 36937490
? 560527360861009747
- 480470861 80598631
- 191523059 381216422
- 300579332 854280403
+ 11 12
+ 52 12
+ 481 3
+ 791 3
? 1
? 41
+ 8 12
+ 831 3
? 5
? 875
+ 10 12
+ 591 3
+ 62 11
? 1
? 901
? 53
+ 48 12
+ 5 12
+ 68 11
+ 431...

output:

-1 -1
-1 -1
-1 -1
791 3
753 1
829 1
1 1
831 3
1 1
784 1
831 1
1 1
831 3
367 1
820 1
768 7
676 1
831 3
1 1
1 1
831 3
1 1
769 1
279 1
827 1
803 1
831 3
831 3
830 3
831 3
831 3
1 146
520 51
243 1
1 1
1 372
831 3
188 1
799 1
1 1
1 1
831 3
791 12
781 15
1 1
1 1
771 21
20 704
1 1
9 882
3 1002
1 468
761 19...

result:

ok ok

Test #40:

score: 20
Accepted
time: 0ms
memory: 14132kb

input:

1000
- 932542979 390508036
+ 196 2
+ 31 12
+ 316 3
? 332
? 1
+ 43 12
+ 111 8
? 2
+ 566 3
+ 2 12
? 1
? 617
? 617
+ 73 11
+ 121 8
+ 116 8
+ 85 11
? 1
? 655
+ 686 3
+ 29 12
+ 141 8
+ 131 8
+ 306 3
+ 486 3
+ 10 12
? 8
+ 906 3
? 1047
+ 13 12
+ 41 12
+ 266 3
+ 826 3
+ 20 12
? 99
? 3
+ 77 11
+ 516 3
? 1103...

output:

1 1
316 3
315 3
566 3
1 1
1 1
566 3
1 1
479 9
1 1
813 1
906 1
1 1
909 1
926 3
1 1
901 1
1 1
326 51
1 1
916 1
1 1
1 1
1 621
1 1
1 1
745 27
926 3
432 1
546 69
1 1
1 321
1 982
1 981
1 827
1 1
524 91
1 444
1 1
209 118
873 15
1 1
876 15
1 1
137 1
1 1
95 377
1 1
1 290
17 1018
926 3
1 1211
25 924
495 123
1...

result:

ok ok

Test #41:

score: 20
Accepted
time: 0ms
memory: 14284kb

input:

1000
- 341931140 365865602
- 845081870 989903406
- 84666035 82751689
- 780421340 155098541
+ 63 12
+ 31 12
+ 48 12
? 98
? 7
+ 570 4
+ 5 12
+ 553 5
+ 35 12
+ 1 12
+ 529 5
? 1
+ 313 5
+ 14 12
+ 465 5
+ 59 12
+ 45 12
? 1
+ 337 5
+ 44 12
+ 714 4
+ 217 2
+ 545 5
+ 975 4
? 1
+ 13 12
+ 137 9
+ 56 12
? 1171...

output:

1 1
45 21
553 9
553 9
975 4
1 1
405 1
975 4
1 1
736 1
974 1
337 66
1 1
975 4
1 1
358 1
969 1
1 1
1 1
875 20
876 24
1 1
1 605
1 1
265 1
948 1
909 12
975 3
975 4
221 1
929 16
930 16
1 939
212 1
975 4
1 935
1 949
25 728
1 1
102 415
1 1067
60 630
1 1091
1 1
1 1128
1 533
1 1206
1 1313
138 303
1 1368
1 12...

result:

ok ok

Test #42:

score: 20
Accepted
time: 3ms
memory: 14284kb

input:

1000
- 139771670 151816065
+ 609 3
+ 369 3
+ 149 8
+ 25 12
+ 76 12
+ 699 3
? 739
? 1
+ 30 12
+ 159 8
? 1
+ 1 12
? 3
+ 739 3
+ 103 11
+ 46 12
+ 819 3
+ 31 12
+ 119 11
? 1
+ 66 12
+ 539 3
+ 121 11
+ 1009 3
+ 127 11
+ 799 3
+ 1249 3
+ 519 3
? 9
+ 17 12
+ 85 12
+ 137 11
+ 14 12
? 13
+ 8 12
+ 244 8
+ 619...

output:

1 1
609 6
609 6
699 1
819 3
1243 1
1239 1
1248 3
1084 1
1216 1
1248 3
1249 3
945 1
1 1
1205 7
1 1
1062 1
1249 5
1 1
1209 9
991 1
1235 1
1 1
1208 9
461 1
1209 9
1 154
1208 9
1137 17
149 194
1014 1
1 1
1 1
1 1
1249 6
1042 1
1259 3
1 1
1258 3
1 1
1 1
919 51
1149 24
800 1
1 700
741 90
1 1
1171 1
1269 3
...

result:

ok ok

Test #43:

score: 20
Accepted
time: 3ms
memory: 14340kb

input:

1000
? 788204862
- 766153650 262998225
- 239784404 714911849
- 671589115 539101332
- 957718463 503903921
- 38249837 725516518
- 411439007 175225944
+ 366 5
+ 510 5
? 1
+ 93 12
+ 61 12
+ 58 12
? 3
+ 334 5
+ 146 11
+ 91 12
? 1
+ 2 12
+ 82 12
+ 226 9
? 2
+ 210 9
+ 990 4
+ 70 12
+ 214 9
+ 954 4
? 7
+ 71...

output:

-1 -1
510 5
509 4
510 5
509 5
949 7
963 1
990 3
1 1
1071 4
1 1
927 19
1 1
990 8
990 8
1 1
1048 1
1 1
1 1
1 1
1069 1
1 1
630 76
784 1
130 285
1 1
865 1
1 1
1 1
1 1
1062 8
1 1
1062 8
321 103
144 103
558 117
558 120
1062 8
1 1
1 1
1061 8
1055 1
1062 8
1 1
1 1
1 1
918 44
1 1
69 484
835 75
232 1
1 1
1 29...

result:

ok ok

Test #44:

score: 20
Accepted
time: 2ms
memory: 14360kb

input:

1000
+ 828515 378833
- 913936 37297
+ 999591 753791
+ 541369 21327
- 128090 191341
+ 676650 957339
+ 637479 516609
+ 900617 958164
- 506064 384050
- 816094 437265
+ 657590 816523
+ 959320 331429
- 930033 355207
+ 120953 609750
+ 337197 880101
+ 39046 813872
+ 867450 686846
+ 94845 686378
+ 513228 18...

output:

34 69273147
1 59288015
1 69263819
1 69272137
1 69207381
1 1
1 69265799
29 69273146
1 69265799
34 69273147
34 69273147
1 69263819
1 1
1 1
1 69272137
29 69273146
1 1
34 69273147
29 69273146
1 59288015
1 69272137
1 1
1 1
1 69272137
1 69265799
34 69273147
1 69207381
1 1
1 69263819
34 69273147
1 1
34 692...

result:

ok ok

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #45:

score: 10
Accepted
time: 8ms
memory: 14452kb

input:

10000
- 1 999991
? 51642673708798142
? 484858251
? 241022805898228231
? 853145858
? 507839352
? 624514179
? 265899555
? 518135543197326485
+ 1 1
R 1
? 181920453
? 634429286886498994
? 141349658
? 318797432346517433
? 12836741748146729
? 891941072845575122
? 777965676
? 356277427560382499
- 1 1
? 403...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 ...

result:

ok ok

Test #46:

score: 10
Accepted
time: 11ms
memory: 14344kb

input:

10000
- 1 999999992
? 78392518046724165
? 583190556
? 678477533836385913
? 583013734
? 268724011969298950
- 834 764
? 68092471
? 665446809
- 633 237
? 26620354
+ 249 319
- 49 784
? 61
? 366
? 1
- 908 908
? 61
- 480 354
? 61
- 380 14
+ 213 472
? 59
? 1003
? 1
? 17
+ 506 977
R 1
? 1
? 59
? 17
- 445 23...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 306
1 1
48 319
1 306
1 306
213 414
1 1
213 472
209 460
213 472
213 414
209 460
1 1
213 414
213 472
209 460
758 682
1 1
634 1142
1 1
213 2249
1 1948
1 1
21 2570
25 2570
1 2400
482 468
19 2788
1 1593
1 1
25 2790
1 2770
439 1502
25 3262
1 1
1 2314
25 32...

result:

ok ok

Test #47:

score: 10
Accepted
time: 2ms
memory: 14488kb

input:

10000
- 395299 197776
? 672542832
- 708014 715038
- 787354 1449
+ 1696 51
+ 21496 6
+ 20571 7
? 21559
+ 23531 6
+ 61 60
+ 23146 6
+ 150 60
+ 144 60
+ 1531 56
+ 7267 10
+ 216 60
? 61
+ 2447 50
+ 4372 37
+ 28512 5
+ 23311 6
+ 5443 36
+ 17061 7
+ 585 59
+ 11703 9
+ 276 60
+ 2876 50
+ 27000 5
+ 1846 51
...

output:

-1 -1
1 1
23476 1
28480 1
28512 5
18483 1
1 1
28512 5
1 1
18440 1
1 1
32125 4
32122 1
27268 1
32125 4
15627 1
1 1
1 1
33265 4
1 1
33322 4
1 1
1 1
21358 1
33322 4
33311 1
1 1
21260 1
1 1
33322 3
33322 4
14963 1
1 1
14906 1
33322 4
33322 4
33322 3
1 1
33265 12
33265 12
1 1
31353 1
33265 12
14736 1
210...

result:

ok ok

Test #48:

score: 10
Accepted
time: 7ms
memory: 14436kb

input:

10000
+ 191 56
+ 3547 4
+ 517 36
+ 2521 4
+ 13 60
+ 17 60
+ 4630 4
+ 31 60
+ 3775 4
+ 4402 4
? 133
+ 99 59
+ 1324 4
+ 2065 4
+ 1438 4
+ 97 59
+ 2692 4
? 1685
+ 1951 4
+ 83 59
+ 156 56
+ 3034 4
+ 4516 4
? 1
+ 39 60
+ 2 60
+ 43 60
? 1
+ 783 33
? 5
? 65
+ 106 2
+ 4174 4
+ 28 60
? 5461
+ 79 59
+ 1894 4
...

output:

4501 1
2961 1
4630 4
4630 4
4629 1
4569 1
1 1
4499 1
3918 1
4194 1
1 1
4630 4
1 1
4553 1
4630 3
3581 1
4629 1
1 1
4572 1
4630 4
4628 4
4630 4
4630 4
1160 1
4561 1
760 1
722 1
4630 3
4630 4
1 1
2635 84
1 1
4630 4
4623 1
4630 4
1 4758
1 3495
1 1
2 5083
1 2871
1 4759
1 3915
1 5587
2 5638
2 5748
1 4618
...

result:

ok ok

Test #49:

score: 10
Accepted
time: 4ms
memory: 14484kb

input:

10000
? 169309425
- 611184 287529
+ 57 60
? 58
+ 24928 7
+ 14300 9
+ 212 60
+ 346 60
+ 2544 51
+ 2324 51
+ 205 60
+ 40210 4
+ 5257 38
+ 19876 8
+ 9462 10
? 1
+ 446 60
? 40687
+ 29988 5
+ 230 60
? 1698
+ 4640 39
? 40791
+ 395 60
+ 7176 36
+ 738 60
+ 115 60
+ 436 60
+ 629 60
+ 12844 9
+ 3444 51
+ 3741...

output:

-1 -1
1 59
40210 4
1 1
38516 1
1 1
40207 1
40093 1
1 1
40210 4
40210 4
40210 1
19214 1
1 1
39981 1
40210 4
38917 1
1 1
39345 1
40210 4
1 1
40210 4
40210 3
40210 4
1 1
40210 4
40208 1
1 1
25555 1
40210 4
39889 1
37417 12
1 1
28882 1
1 1
25100 1
40210 4
1 1
40155 1
1 1
36050 1
40208 1
40177 1
17147 1
...

result:

ok ok

Test #50:

score: 10
Accepted
time: 7ms
memory: 18384kb

input:

10000
- 904527810 739448722
? 172666022316725526
+ 4505 6
? 4510
+ 506 56
+ 456 56
+ 1269 36
+ 63 60
+ 6982 5
+ 4340 6
? 3
+ 11529 4
? 3919
+ 12612 4
+ 11928 4
+ 263 59
? 12907
+ 5000 6
+ 1884 35
+ 2176 34
? 1
+ 7486 5
+ 8382 5
+ 12783 4
+ 874 50
+ 66 60
+ 128 60
+ 64 60
+ 8214 5
+ 661 51
+ 172 60
+...

output:

-1 -1
1 1
6981 4
7614 1
1 1
12612 4
12783 4
13296 4
13289 1
1 1
12145 1
1 1
13515 1
13823 1
1 1
9894 29
13866 4
13866 4
1 1
13862 1
5758 1
13866 1
13866 4
1 1
1 1
13866 3
13659 1
13796 1
13866 4
12973 1
13866 4
1 1
1 1
5032 1
13866 4
5002 1
13866 3
9429 1
1 182
101 3498
13498 1
12963 1
14037 4
1 1
1...

result:

ok ok

Test #51:

score: 10
Accepted
time: 9ms
memory: 14488kb

input:

10000
+ 870 56
+ 12926 10
+ 76 60
+ 665 56
+ 21278 5
+ 18711 7
+ 303 60
+ 19629 7
+ 388 60
+ 188 60
+ 5215 14
? 516
+ 391 60
+ 5497 14
+ 7258 13
? 1
+ 920 56
+ 10192 11
+ 412 60
+ 1680 51
+ 22566 5
+ 13803 9
+ 1 60
+ 327 60
? 23359
+ 483 59
? 11709
? 3
+ 8026 13
? 1
? 23431
+ 141 60
+ 81 60
? 1
? 23...

output:

20767 1
21278 5
1 1
10900 1
22565 4
22566 5
1 1
22566 5
1 1
22566 5
10778 1
22565 5
22397 1
22434 1
1 1
1 1
22566 5
18597 1
21938 1
22034 1
22566 5
22566 5
22566 5
1 1
22566 5
22566 5
1 1
22564 1
22566 5
1 1
1 1
22565 4
1 1
22958 5
1 1
24616 1
24657 1
1 1
1 1
24663 3
1 1
1 1
24663 4
1 1
24663 4
2466...

result:

ok ok

Test #52:

score: 10
Accepted
time: 4ms
memory: 14364kb

input:

10000
- 543462752 111240181
+ 690 59
+ 519 60
+ 509 60
+ 1331 51
+ 17078 6
+ 13277 7
+ 24053 5
+ 8613 8
+ 1271 56
+ 3067 38
+ 27259 4
+ 31135 4
+ 1076 56
+ 1921 51
+ 5541 35
+ 317 60
+ 26746 4
? 1
? 3
+ 1021 56
+ 63 60
+ 29254 4
? 31818
+ 274 60
+ 4138 36
+ 354 60
+ 26405 5
+ 14357 7
+ 27943 4
+ 260...

output:

31135 4
31133 4
1 1
31133 4
20459 1
1 1
20436 1
31135 4
30357 1
30581 1
1 1
31134 1
31135 3
1 1
31127 1
31135 4
31135 4
1 1
1 1
30846 1
14084 1
1 1
31135 4
1 1
22491 1
1 1
31135 4
1 1
31135 4
31093 1
30972 1
31135 4
1 1
1 1
31133 4
31135 3
13007 1
31078 1
31135 4
31122 1
29549 1
29995 16
31066 1
311...

result:

ok ok

Test #53:

score: 10
Accepted
time: 8ms
memory: 14308kb

input:

10000
? 371100110872998426
- 196897526 406576172
+ 576 59
+ 9411 13
? 22
+ 31 60
+ 706 59
+ 548 59
+ 4364 39
+ 948 56
+ 1158 56
? 9811
? 1
? 1
+ 776 59
+ 459 60
+ 166 60
+ 181 60
+ 1203 56
? 326
? 10106
+ 20463 8
+ 6190 14
? 3
+ 2398 51
? 1
+ 499 60
+ 26762 6
+ 26047 6
+ 4056 39
? 27641
+ 300 60
+ 1...

output:

-1 -1
9402 1
1 1
9411 13
9411 13
9098 1
1 1
20462 7
20463 8
1 1
21195 1
1 1
1 1
1 1
1 1
26762 6
1 1
26762 6
1 1
26762 6
1 1
1 1
1 1
26679 1
1 1
29866 1
30351 4
30351 4
1 1
29126 1
27009 1
30346 1
30351 4
30349 4
30351 3
25475 1
30351 4
18876 1
30258 1
30012 1
30243 1
25391 1
30005 1
30255 1
1 1
3032...

result:

ok ok

Test #54:

score: 10
Accepted
time: 7ms
memory: 14416kb

input:

10000
- 1 999999989
? 854803774980924014
? 366296493
? 44260361757615642
? 354024438796336948
? 235345445
? 273082148558437774
? 654283837570755065
? 434911849859856800
? 37095183716651734
? 374319068
- 830 396
? 327213098
+ 362 295
R 1
? 836452575345424749
? 341917233
? 165607131718316743
+ 947 263...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
807 1
931 249
931 187
937 235
807 1
1 1
937 261
807 1
1 1
947 263
931 187
1 1
181 261
1 1
183 263
179 179
1 1
1 1
1 1
1 1
183 121
183 125
1 225
183 125
183 125
183 121
1 1
51 523
1 1
51 523
49 523
559 1
810 13
81...

result:

ok ok

Test #55:

score: 10
Accepted
time: 15ms
memory: 14376kb

input:

10000
- 425706638 673569911
? 333713287121988942
- 73122577 192431241
- 703014478 486986479
- 166937354 734512429
- 669805867 967168964
? 781106041
- 104180619 475478572
- 788408117 629169920
- 436514051 576477351
+ 3 30
+ 148 30
+ 3181 6
+ 2219 7
+ 928 2
+ 93 30
+ 1112 8
+ 341 26
? 3319
+ 63 30
+ 4...

output:

-1 -1
-1 -1
1 1
3181 6
1 1
5227 3
1 1
5227 3
5227 3
4354 1
1 1
1 1
1 1
5227 3
1 1
1 1
5199 1
4493 1
1 1
3515 31
5075 1
5225 1
1 1
4667 12
1604 151
4666 11
3195 44
5227 3
5227 1
5227 3
1 1
1 1
5184 1
5311 1
1 1
5169 1
1573 1
1508 1
1 1
5281 6
3 2739
1 497
5283 6
5281 6
5307 1
4779 21
1 1
1 1
1342 1
1...

result:

ok ok

Test #56:

score: 10
Accepted
time: 17ms
memory: 14440kb

input:

10000
? 158385510
? 330698307
+ 403 28
+ 1618 19
? 8
+ 148 30
+ 1 30
? 1
+ 120 30
? 1
+ 565 28
+ 5400 5
+ 5842 5
+ 589 28
+ 1462 19
+ 281 30
+ 538 28
+ 2300 6
+ 128 30
+ 7777 4
? 4048
+ 595 28
+ 7534 4
+ 237 30
+ 7968 3
+ 766 25
+ 9144 3
+ 8248 3
+ 3775 6
? 9565
? 1
+ 4490 5
+ 247 30
? 12
? 200
+ 68...

output:

-1 -1
-1 -1
1613 17
1618 19
1618 19
3743 1
1 1
9144 3
9135 1
8947 1
9144 3
9144 3
9144 3
9143 3
8249 1
9144 3
8526 1
7495 1
1 1
1 1
9144 3
9116 1
9676 3
1 1
9676 3
9872 3
1 1
9871 3
9872 3
9872 3
1 1
7072 1
9871 3
9868 1
9872 3
9869 1
1 1
9872 3
9134 21
9368 1
9144 21
1 1
9453 1
1 1
9871 3
9571 1
97...

result:

ok ok

Test #57:

score: 10
Accepted
time: 5ms
memory: 16492kb

input:

10000
? 789203249
- 145033530 216841645
- 855037843 559074667
? 220569521
? 849384071
- 865926982 137876387
? 104033476
- 243995975 213674251
? 52841741
- 22691187 119921821
- 57115161 241710477
- 876843966 768471768
+ 142 30
+ 3050 10
+ 2683 21
+ 418 30
+ 462 30
+ 245 30
? 32
? 320
+ 3092 10
+ 256 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3028 1
2740 1
1 1
13297 4
13297 4
12061 1
13296 1
13295 4
13297 4
9882 1
1 1
15952 1
1 1
15952 3
15952 3
15951 3
13174 1
1 1
15663 1
1 1
1 1
1 1
15498 1
15952 3
1 1
15952 3
7244 1
15277 1
15616 1
15949 1
10112 1
15930 1
13453 1
15980 3
15944 1
1 1
15980 3
15964 1
1 1
1 ...

result:

ok ok

Test #58:

score: 10
Accepted
time: 4ms
memory: 14532kb

input:

10000
? 653375643403521046
- 382390650 403494125
- 193848294 417080075
- 663045629 62519236
? 413539094
? 591996690
- 675087491 837403539
- 57577565 669745583
- 320017426 114420581
- 388597322 375325170
+ 686 30
+ 714 29
+ 9422 7
+ 469 30
+ 1397 26
+ 17654 3
+ 402 30
+ 586 30
+ 378 30
+ 782 29
+ 172...

output:

-1 -1
-1 -1
-1 -1
17654 3
17654 1
1 1
17783 1
1 1
17597 1
14060 1
1 1
1 1
17794 3
17794 1
17631 1
17794 3
16199 1
17793 3
17794 3
17794 1
17794 3
17794 3
1 1
17202 1
1 1
18241 1
1 79
1 1
18235 1
17542 1
18216 1
1 1
1 1
18242 3
17820 1
18242 3
18242 3
7875 1
1 1
18242 3
7695 226
1 1
18193 1
12962 87
...

result:

ok ok

Test #59:

score: 10
Accepted
time: 6ms
memory: 14424kb

input:

10000
+ 383 30
+ 1641 26
+ 322 30
+ 375 30
+ 3494 20
+ 163 30
+ 10973 6
+ 45 30
+ 1446 26
+ 1019 29
+ 346 30
? 1
+ 2066 21
+ 12023 6
+ 2386 21
+ 27 30
+ 14066 5
+ 1726 26
+ 20242 3
+ 129 30
+ 8480 7
+ 1711 26
+ 5193 8
? 1
+ 939 29
+ 8240 7
? 20747
+ 272 30
+ 1111 29
+ 4871 8
? 2
+ 621 30
+ 494 30
? ...

output:

10973 6
20242 3
1 1
20241 3
1 1
20242 3
1 1
20242 3
1 1
1 1
1 1
1 1
20251 1
20549 3
20531 1
20550 3
20510 1
9640 1
22006 3
1 1
21772 1
22006 3
21995 1
20420 1
21944 1
22006 3
19619 1
21999 1
21888 1
20160 1
1 1
22006 1
1 1
22006 3
21948 1
18540 1
1 1
21408 1
21968 1
1 1
22006 3
22004 1
21882 1
1 1
2...

result:

ok ok

Test #60:

score: 10
Accepted
time: 6ms
memory: 14396kb

input:

10000
? 291100932577212805
? 788602503
- 782072727 439546129
- 612294436 964941196
? 777741174028564530
? 996935273701916349
+ 3268 3
? 1
+ 2728 3
+ 893 8
+ 5948 3
? 852
+ 2768 3
? 5967
+ 608 11
+ 3738 3
+ 327 12
+ 1253 8
? 1
+ 122 12
? 1
+ 534 11
? 6024
? 3
? 1506
+ 1318 8
? 13
+ 2018 3
+ 2188 3
+ ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
3268 3
5099 1
1 1
5948 3
5948 3
1 1
5948 1
4445 1
5938 1
5948 3
5918 1
5948 3
5947 3
5948 3
5947 3
4914 1
5625 1
1 1
5938 1
5925 1
5505 1
5891 5
5948 3
5948 1
5739 1
5948 3
5948 3
1 1
5944 1
6058 3
2727 45
1 1
2710 1
6058 3
5614 1
6048 1
1 1
1 1
6058 3
6057 1
2638 1
2627 1
60...

result:

ok ok

Test #61:

score: 10
Accepted
time: 6ms
memory: 14548kb

input:

10000
? 825288418
? 944191971
- 678754534 82898105
- 705248193 71810410
+ 8054 3
+ 586 12
+ 692 11
+ 3234 3
+ 301 12
+ 6044 3
+ 500 12
+ 6614 3
+ 1944 3
+ 597 12
+ 6634 3
+ 712 11
+ 621 12
+ 812 11
+ 525 12
+ 1249 8
+ 325 12
? 8196
+ 794 11
+ 7364 3
+ 5984 3
+ 451 12
+ 898 11
? 58
+ 5444 3
+ 6304 3
...

output:

-1 -1
-1 -1
1 1
7999 1
8044 1
8054 1
8054 1
8051 1
1 1
7862 1
1 1
5288 1
5284 1
3847 1
6997 1
1 1
1 1
8051 1
1 1
8054 3
6974 15
6974 18
1 1
8054 3
1 1
8054 3
1 1
8043 1
1 1
8053 3
6325 1
8050 1
1 1
4581 62
7185 1
7357 15
7506 1
1 1
8053 3
1 1
8053 3
7361 25
8054 3
1 1
8054 3
1 1
8015 1
1 1
1 1
6783 ...

result:

ok ok

Test #62:

score: 10
Accepted
time: 9ms
memory: 14532kb

input:

10000
? 853172908647670349
+ 547 12
+ 225 12
+ 4893 5
+ 1769 9
+ 364 12
+ 132 12
+ 620 12
+ 5579 4
+ 328 12
+ 531 12
+ 1773 9
+ 330 12
+ 338 12
+ 299 12
? 5
+ 3349 5
+ 308 12
+ 2789 5
+ 1059 11
? 1
+ 1741 9
+ 5201 4
+ 1461 9
+ 30 12
+ 7127 4
+ 6695 4
+ 507 12
? 3680
+ 1205 9
+ 6002 4
? 7373
? 1
+ 21...

output:

-1 -1
5578 1
5579 4
3468 1
1 1
7127 4
7127 4
7126 1
6080 1
1 1
1 1
7127 4
3426 1
7127 4
7120 1
7619 1
6519 1
1 1
7890 4
7892 4
7892 4
7892 3
7130 1
3725 60
1 1
3723 1
7623 1
3670 1
7924 1
7982 4
1 1
7963 1
1 1
1 1
1 1
7982 4
1 1
7982 4
7982 4
7959 1
7982 4
1 1
7982 4
7943 1
6673 1
1 1
1 1
8198 1
361...

result:

ok ok

Test #63:

score: 10
Accepted
time: 10ms
memory: 16528kb

input:

10000
+ 5671 3
? 3
+ 9821 3
+ 6591 3
+ 481 12
+ 243 12
+ 523 12
? 5
? 1973
+ 1926 8
+ 1000 11
+ 846 12
+ 5261 3
+ 1058 11
+ 884 12
+ 482 12
+ 1152 11
+ 798 12
+ 3061 3
? 20
+ 3631 3
+ 352 12
+ 624 12
+ 601 12
+ 877 12
+ 1026 11
+ 1956 8
+ 424 12
+ 3391 3
+ 813 12
+ 1182 11
+ 10591 3
? 37
+ 296 12
? ...

output:

5671 1
9819 1
7851 1
9804 1
10557 1
1 1
5172 1
10581 1
9953 1
9039 1
10514 1
10568 1
10021 1
1 1
1 1
6898 1
10711 3
1 1
10711 3
10635 1
10572 1
10711 1
10711 3
1 1
1 1
6906 1
10413 1
1 1
10112 1
7841 45
9670 1
9190 29
10708 1
6884 44
9948 1
1 1
7820 1
10710 3
9221 33
10711 1
10555 1
6832 1
10751 3
1...

result:

ok ok

Test #64:

score: 10
Accepted
time: 6ms
memory: 14352kb

input:

10000
? 303088656
- 864759833 733335172
? 998361565
+ 570 12
? 1
+ 2604 8
+ 584 12
+ 5009 3
? 3
+ 91 12
+ 103 12
+ 1137 11
+ 5229 3
? 3
+ 665 12
+ 787 12
+ 7509 3
+ 705 12
+ 7199 3
+ 7959 3
+ 573 12
+ 1814 8
+ 612 12
+ 485 12
+ 10259 3
+ 2344 8
? 3477
? 1
+ 790 12
+ 57 12
+ 6819 3
+ 10439 3
+ 101 12...

output:

-1 -1
-1 -1
570 12
5009 1
5229 1
6794 1
10259 3
1 1
10429 1
10424 1
10439 3
10439 3
10152 1
10439 3
10318 1
10365 1
10419 1
4952 1
1 1
10489 3
1 1
4895 1
9248 1
1 1
10659 3
5246 1
1 1
11265 1
5229 1
11298 3
5229 78
1 1
9570 1
1 1
11298 3
11299 6
11299 6
1 1
5145 1
1 1
7197 1
11301 1
11299 6
11289 4
...

result:

ok ok

Test #65:

score: 10
Accepted
time: 9ms
memory: 14368kb

input:

10000
? 894000788
+ 566 12
+ 12056 3
+ 680 12
? 863
? 12082
+ 2536 8
+ 8966 3
+ 2231 8
+ 524 12
? 1
+ 308 12
+ 4446 3
+ 4456 3
+ 634 12
? 1
+ 31 12
+ 9106 3
+ 1661 8
? 6083
? 1
+ 10896 3
+ 1108 11
+ 13396 3
+ 12626 3
+ 11306 3
+ 284 12
+ 2661 8
? 17
? 13549
? 797
? 1
+ 12566 3
+ 12556 3
+ 3256 3
? 2...

output:

-1 -1
11196 1
1 1
12056 3
12056 3
5982 1
12056 3
13382 1
1 1
12605 1
13396 3
13395 3
1 1
12911 1
13391 1
6586 36
13362 1
13369 1
1 1
1 1
13396 3
1 1
11447 1
12591 1
1 1
13394 1
13396 3
10644 1
13396 3
1 1
13394 1
1 1
13298 1
13506 3
1 1
13506 3
11953 1
1 1
13326 1
1 1
1 1
13506 3
10698 1
13337 1
124...

result:

ok ok

Test #66:

score: 10
Accepted
time: 10ms
memory: 14632kb

input:

10000
+ 217593 571589
+ 415789 108751
- 117214 236462
+ 161922 235410
- 888348 709119
+ 535725 971334
+ 586502 192017
+ 993151 382782
- 232549 22974
- 477398 444633
- 656108 350810
+ 209798 96868
- 173128 279596
+ 475841 68136
+ 918284 770201
+ 234237 888515
- 557087 387417
- 180364 330945
- 842261 ...

output:

2 639446425
1 636112802
1 626114297
1 639446419
1 619449029
1 639445659
1 612784663
1 639446331
1 639446424
1 586124994
1 599455443
1 639446425
1 632779952
1 532808590
1 479502159
1 639446411
1 319668078
1 639446363
1 639446423
1 639446379
1 1
1 637780040
1 639446403
1 639446043
1 639445659
1 629447...

result:

ok ok

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #67:

score: 20
Accepted
time: 30ms
memory: 16704kb

input:

40000
- 1 999989
+ 1 1
? 1
? 1
? 1
? 1
+ 1 1
? 2
? 1
? 1
- 1 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
- 1 1
? 459503449626971713
? 135016910
? 5731773
? 52316937639933998
? 269214524
? 797561718
? 909578511260041483
? 133507102
- 1 1
- 1 1
? 699316943
? 987427419883089774
? 889563372
? 41792073161585014
? 4160...

output:

1 1
1 1
1 1
1 1
1 1
1 2
1 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 3
1 1
1 1
1 1
1 1
1 1
1 3
1 1
1 3
1 3
1 1
1 4
1 3
1 5
1 1
1 5
1 1
1 1
1 5
1 5
1 5
1 1
1 1
1 5
1 1
1 6
1 4
1 1
1 5
1 5
1 1
1 1
1 6
1 1
1 4
1 7
1 1
1 ...

result:

ok ok

Test #68:

score: 20
Accepted
time: 45ms
memory: 14900kb

input:

40000
- 1 999999990
? 124566229007091206
? 263598660
? 135377055
? 63646129
? 114729471
? 911467053
+ 892 35
? 463
? 926
? 2
? 1
- 9 682
? 42
? 7
? 3
? 1
? 21
? 6
? 1
- 789 209
+ 522 241
? 1
? 797
? 1
? 1
+ 814 77
? 106
+ 205 334
? 100
? 75
? 1500
? 25
? 5
? 1
? 150
? 300
? 750
? 50
+ 988 284
- 699 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
464 1
1 1
891 35
892 35
1 1
8 29
7 34
8 35
1 22
7 31
8 35
522 241
1 1
522 241
522 241
785 1
432 309
457 309
1 1
507 309
522 314
522 318
382 309
232 309
382 1
482 309
205 936
1 1
522 425
197 934
205 936
1 1
205 936
205 936
205 936
1 1
205 936
522 1674
1 1574
1 1
52...

result:

ok ok

Test #69:

score: 20
Accepted
time: 28ms
memory: 14988kb

input:

40000
? 677759651
- 780509 987243
- 393725 99290
+ 15205 39
+ 42770 9
+ 1593 60
+ 48542 9
+ 494 60
? 24359
+ 1958 60
+ 1564 60
? 1
? 48838
+ 135720 4
+ 1906 60
? 136080
+ 145011 4
+ 24847 10
+ 1776 60
? 1531
+ 11981 51
+ 2127 60
? 72778
+ 8961 51
+ 33415 10
+ 141363 4
+ 922 60
? 145681
? 1
+ 323 60
...

output:

-1 -1
24201 1
48542 9
1 1
1 1
143484 1
72241 1
1 1
145011 4
1 1
145011 4
1 1
1 1
1 1
1 1
145011 4
145009 1
144976 1
1 1
145011 4
143954 1
144997 1
145011 4
1 1
143072 1
1 1
144946 1
144923 1
145011 4
1 1
125985 44
126480 44
145011 4
145002 1
120210 1
145009 4
145011 4
144968 1
145011 4
144536 1
1 1
...

result:

ok ok

Test #70:

score: 20
Accepted
time: 40ms
memory: 18876kb

input:

40000
? 223976876737847075
+ 7714 6
+ 368 59
+ 10717 5
+ 10 60
+ 209 60
+ 6669 6
? 1
? 10912
+ 2189 36
+ 366 59
+ 9709 5
+ 227 60
? 1384
+ 15943 4
? 16302
+ 13853 5
? 16307
+ 268 60
+ 8484 6
? 16373
+ 242 60
? 1
+ 3314 6
+ 135 60
+ 638 56
? 43
+ 15715 4
? 29
+ 11893 5
+ 12117 5
+ 4304 6
? 1
+ 111 60...

output:

-1 -1
10717 5
1 1
9343 1
1 1
1 1
1 1
15943 4
15904 1
15918 1
15943 4
12617 1
19192 4
12560 1
12528 1
19192 4
19192 4
19192 3
18648 1
18198 1
14953 1
1 1
19192 4
14942 1
8556 1
15627 1
1 1
15608 1
19186 1
1 1
18194 1
1 1
19192 4
13162 70
17471 1
1 1
19192 4
7775 1
19183 1
19192 3
7691 1
1 1
5426 132
...

result:

ok ok

Test #71:

score: 20
Accepted
time: 25ms
memory: 17132kb

input:

40000
? 25911325859333899
? 62124818760140691
+ 1909 60
+ 627 60
+ 1025 60
+ 3353 59
+ 59190 10
+ 275 60
+ 6466 56
? 1
+ 27212 37
+ 236 60
? 1
+ 10771 51
+ 19997 39
? 5431
+ 4091 56
+ 2695 59
+ 31277 12
? 59868
+ 2355 60
? 59928
+ 128568 6
? 288
+ 11181 51
+ 2351 60
? 43141
+ 2287 60
? 3
+ 3615 59
+...

output:

-1 -1
-1 -1
59190 10
59190 10
53769 1
1 1
1 1
128286 1
85433 1
128568 4
128568 6
128545 1
124097 1
128564 6
128564 6
1 1
1 1
158835 4
1 1
126615 1
151514 1
1 1
158835 4
158835 4
151490 1
158668 1
158835 4
1 1
149310 1
153437 1
1 1
126358 1
1 1
158810 1
104581 1
1 1
1 1
158835 4
158835 4
1 1
1 1
1588...

result:

ok ok

Test #72:

score: 20
Accepted
time: 36ms
memory: 14888kb

input:

40000
? 943887944802513695
- 957810392 494047143
? 617753090
- 491999643 308221301
- 929069152 387695680
+ 489 60
? 548
? 2
+ 6481 37
+ 668 60
+ 30650 4
+ 8354 35
+ 6505 37
+ 34469 4
? 11
+ 24209 4
+ 5678 39
+ 4425 51
+ 825 60
+ 54818 4
+ 2150 56
+ 3835 51
+ 846 60
+ 4855 40
+ 8146 35
? 3961
? 55454...

output:

-1 -1
-1 -1
1 1
489 59
34462 1
50861 1
1 1
54818 3
54818 3
1 1
54818 4
51804 1
26173 1
54818 4
54818 4
54810 1
50953 1
54818 3
48946 1
54818 4
54818 4
25336 1
54818 3
50589 1
54664 1
54818 4
1 1
1 1
56072 4
56050 1
51998 1
56002 1
56072 4
55991 1
1 1
35547 1
56072 4
1 1
56066 1
24737 1
56045 1
55529...

result:

ok ok

Test #73:

score: 20
Accepted
time: 36ms
memory: 16780kb

input:

40000
- 166825612 977935390
- 514386237 381826777
- 503724529 680126794
+ 1657 59
+ 2239 56
+ 1129 60
+ 899 60
+ 102006 4
+ 67593 7
+ 1113 60
+ 1505 59
+ 1467 60
? 102430
+ 23932 10
+ 104115 4
? 1
+ 58575 7
? 52280
+ 2654 56
+ 28369 10
? 1
+ 7579 51
? 104677
+ 58521 7
+ 3159 56
+ 1879 59
+ 13600 38
...

output:

1 1
104115 4
51857 1
104115 4
1 1
104104 1
104115 4
104113 4
104115 3
104115 4
51563 1
103801 1
1 1
103952 1
104115 3
1 1
104115 4
1 1
104115 4
104115 3
108918 1
109929 4
1 1
81992 43
109892 1
109927 4
109929 4
109929 4
108782 1
109927 4
91154 1
109929 4
1 1
109922 1
109929 4
1 1
109929 4
109893 1
1...

result:

ok ok

Test #74:

score: 20
Accepted
time: 31ms
memory: 15044kb

input:

40000
- 64830132 333068085
- 517582866 791523723
? 673029574741650695
+ 1560 60
+ 14680 37
? 2
+ 2260 59
? 1
? 14835
+ 639 60
+ 128801 4
+ 32778 10
+ 858 60
? 1
+ 6525 51
? 9
+ 276 60
+ 40039 9
+ 43679 9
+ 105933 5
+ 25893 10
? 1
+ 6725 51
+ 4825 56
+ 52749 8
+ 6035 51
? 25880
+ 18936 36
+ 38791 9
+...

output:

-1 -1
14679 37
14680 37
1 1
128801 4
128796 1
128801 4
102930 1
1 1
1 1
1 1
1 1
128801 4
127676 5
110231 1
119520 1
63800 1
1 1
128801 4
110202 1
128438 1
126974 1
1 1
128576 1
128801 4
128678 1
118784 1
1 1
132049 1
64901 1
131443 1
132048 4
127698 16
105097 1
132050 4
132050 4
1 1
132050 4
132050 ...

result:

ok ok

Test #75:

score: 20
Accepted
time: 34ms
memory: 16848kb

input:

40000
? 842615538
+ 87446 5
+ 679 60
? 1
+ 1284 60
+ 61738 6
+ 2992 59
+ 1648 60
+ 62673 6
+ 620 60
+ 2900 59
? 1
+ 30333 6
+ 116898 4
+ 6983 51
+ 5503 56
? 1
? 117389
? 1
? 1
+ 18543 35
+ 1637 60
+ 4013 56
+ 5533 56
+ 87614 5
+ 2616 59
+ 69750 5
? 1
+ 7523 51
+ 7753 51
+ 182 60
+ 11213 49
+ 101054 ...

output:

-1 -1
87446 5
87446 5
116898 4
1 1
116898 4
116898 4
116898 4
116896 4
116841 1
93202 1
116891 1
116799 1
143786 1
1 1
144258 4
1 1
1 1
142249 1
143591 1
144223 1
144258 4
144258 4
127904 1
144216 1
144239 1
144258 4
127844 1
1 1
143957 1
114705 1
141243 1
1 1
1 1
1 1
144066 1
1 1
144258 4
114533 1
...

result:

ok ok

Test #76:

score: 20
Accepted
time: 40ms
memory: 14880kb

input:

40000
- 1 999999997
? 574341954
? 530744726891117072
? 153312352
? 16275489105590872
? 245535434586172579
? 665990227001338666
+ 809 716
- 434 724
? 164
? 1148
? 82
? 7
? 2
? 574
+ 874 976
? 1
? 171
? 855
? 3
? 2565
? 19
? 135
? 57
? 285
+ 768 42
+ 799 212
- 482 476
? 2819
+ 818 136
? 1
? 2955
? 15
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
329 657
1 1
411 657
428 715
433 715
1 575
874 976
824 856
1 1270
872 976
1 1
862 970
770 946
824 970
286 1555
1 1
433 2082
1 1
421 2080
395 1924
1 1530
1 1
433 2080
431 2080
582 536
421 2080
1 1435
311 2075
313 2077
313 2082
1 1
313 2079
1 1075
113 2398
114 2398
1...

result:

ok ok

Test #77:

score: 20
Accepted
time: 38ms
memory: 15016kb

input:

40000
+ 532 30
+ 13604 4
+ 47 30
? 13667
? 79
+ 15980 4
+ 10528 5
+ 510 30
+ 238 30
+ 1920 19
+ 10242 5
+ 17168 4
+ 1746 25
+ 228 30
+ 644 30
+ 16115 4
+ 955 29
+ 9436 5
+ 57 30
? 17481
+ 2424 19
+ 7637 6
+ 21393 3
+ 4137 6
+ 367 30
+ 4537 6
+ 17473 3
+ 391 30
+ 507 30
? 21839
+ 379 30
+ 1698 25
+ 9...

output:

1 1
13529 1
1 1
1 1
21338 1
21369 1
21417 1
22204 3
22201 1
20553 1
22204 3
22197 1
22201 1
22205 3
1 1
22077 1
22029 1
22200 1
1 1
21145 1
22205 3
22205 3
22204 3
22205 3
22199 1
1 1
22131 1
10298 1
22233 3
21091 1
1 1
22233 3
22226 1
22231 1
22233 3
10034 129
22233 3
21923 1
1 1
13961 1
22233 3
22...

result:

ok ok

Test #78:

score: 20
Accepted
time: 39ms
memory: 18892kb

input:

40000
- 711598956 38143622
- 557163230 93952091
- 93796384 273343789
- 856941038 802329559
- 78117130 925359729
+ 6659 19
+ 1938 29
+ 1266 29
+ 17973 5
+ 326 30
? 2
? 548
+ 32190 3
+ 376 30
+ 2486 26
+ 34682 3
+ 7007 19
? 2491
+ 7854 6
? 40
+ 1408 29
+ 18 30
+ 5618 20
+ 18545 5
? 34964
+ 4771 20
+ 4...

output:

17972 5
17430 1
32194 1
34645 1
1 1
34679 1
1 1
34654 1
34682 3
1 1
1 1
34638 1
34682 3
22838 1
1 1
16872 1
1 1
1 1
34682 3
33310 1
34655 1
1 1
34590 1
1 1
1 1
36702 1
31447 1
17660 1
30499 1
1 1
36705 1
36891 1
36922 1
36949 3
36950 3
38069 3
34058 1
18049 1
38070 3
38069 3
38070 3
38070 3
1 1
2467...

result:

ok ok

Test #79:

score: 20
Accepted
time: 33ms
memory: 14912kb

input:

40000
- 769183911 221531292
- 886908982 733043839
? 520237017859620771
- 231423159 644462823
? 60781984998275393
? 237696858325482314
+ 140 30
+ 29946 5
+ 1562 30
+ 45802 4
+ 505 30
+ 1087 30
+ 43318 4
+ 5376 26
+ 1335 30
? 73
+ 1684 30
+ 1894 30
+ 1985 30
+ 7336 20
+ 3666 26
? 1
+ 31350 5
? 1
+ 208...

output:

-1 -1
-1 -1
-1 -1
45733 1
45802 4
45802 4
53052 3
1 1
42385 1
53048 1
45422 1
1 1
48895 1
1 1
1 1
1 1
42354 1
56749 1
1 1
1 1
54984 1
56860 3
56860 3
1 1
37258 1
56860 3
1 1
56860 3
1 1
61198 1
61200 3
1 1
61169 1
60575 1
61192 1
54800 1
57624 1
61108 1
29041 1
61161 1
39713 1
61184 1
61200 3
61200 ...

result:

ok ok

Test #80:

score: 20
Accepted
time: 35ms
memory: 15008kb

input:

40000
? 426644597273939473
- 810294628 312927982
- 50945315 165557661
+ 2636 30
? 1
? 2665
+ 41058 5
+ 77358 3
? 673
+ 54 30
+ 65794 3
+ 7613 25
+ 821 30
+ 162 30
+ 7751 25
+ 2611 30
? 4848
+ 4691 28
+ 6821 25
+ 2834 28
? 429
+ 23751 6
+ 14225 19
+ 8837 25
+ 2017 30
+ 10721 19
+ 47506 5
+ 17951 6
+ ...

output:

-1 -1
2636 30
1 1
76688 1
72513 1
76932 1
1 1
77358 1
81138 3
81136 1
1 1
81136 1
81110 1
81138 3
1 1
80216 1
64664 1
1 1
81138 3
81138 3
82230 3
81441 1
82229 3
82230 1
82032 1
82230 3
82230 3
82229 3
82230 3
80180 1
82170 1
82122 1
1 1
82230 3
1 1
82230 1
82224 1
53963 1
1 1
81374 1
72792 1
82230 ...

result:

ok ok

Test #81:

score: 20
Accepted
time: 35ms
memory: 15136kb

input:

40000
? 29832296297047517
? 580844055029996911
- 312635783 757770202
? 630749211926238861
+ 1083 30
? 2
? 4
+ 493 30
+ 12959 21
+ 733 30
+ 941 30
+ 85642 3
+ 3541 29
+ 3759 29
+ 2025 30
+ 380 30
+ 1563 30
+ 47141 7
+ 735 30
+ 3393 29
+ 41150 8
+ 5514 26
? 227
+ 654 30
+ 16577 10
+ 5849 26
+ 12619 21...

output:

-1 -1
-1 -1
-1 -1
1083 29
1081 29
85418 1
83772 1
1 1
85572 1
85641 3
85642 3
85619 1
85642 3
85642 3
1 1
1 1
42937 1
87154 3
87153 3
87153 3
72359 1
1 1
87154 3
1 1
64863 1
87153 3
51426 46
86808 1
81554 1
86075 1
86985 1
1 1
86300 1
1 1
82875 1
87154 3
87154 3
86874 1
77152 1
57160 1
57144 1
87154...

result:

ok ok

Test #82:

score: 20
Accepted
time: 29ms
memory: 17056kb

input:

40000
+ 19948 4
+ 19210 4
+ 674 12
? 19967
+ 18184 4
? 1
+ 2467 11
+ 8913 5
+ 731 12
+ 970 12
+ 16150 4
? 1
+ 16717 4
+ 1155 12
? 20031
+ 2257 11
+ 430 12
+ 522 12
+ 473 12
+ 2025 12
? 10
? 1
? 490
+ 17914 4
+ 1241 12
+ 3945 9
+ 18373 4
+ 5041 9
+ 3617 9
? 20137
? 13
+ 18526 4
+ 12297 5
+ 19516 4
+ ...

output:

1 1
19948 4
19948 4
1 1
19942 1
19948 4
19462 1
1 1
19939 1
19884 1
22034 4
10908 1
1 1
22036 4
16438 64
1 1
22009 1
22036 4
1 1
1 1
19219 28
1 1
15000 72
16411 76
22036 4
19202 35
16410 80
21666 1
16410 84
21283 1
21921 1
22036 4
21825 1
21301 1
22036 3
22036 4
21999 1
22036 4
22036 4
22034 4
22034...

result:

ok ok

Test #83:

score: 20
Accepted
time: 34ms
memory: 17136kb

input:

40000
? 14951798
- 962746718 849768434
+ 3295 11
+ 1946 12
+ 1940 12
+ 2044 12
+ 21410 3
+ 12180 3
? 219
+ 11600 3
+ 20160 3
+ 13880 3
? 21471
+ 9890 3
+ 13670 3
+ 371 12
+ 982 12
+ 2949 11
+ 3427 11
? 1
+ 1976 12
+ 7370 3
+ 2354 12
+ 572 12
? 21562
+ 19300 3
+ 7800 3
+ 296 12
+ 9500 3
+ 953 12
? 1
...

output:

-1 -1
21194 1
1 1
21410 3
1 1
21410 3
20796 1
32006 1
33530 1
1 1
33540 3
1 1
33540 3
32837 1
33540 3
33604 1
16576 1
33619 1
1 1
1 1
1 1
33620 3
33475 1
33606 1
26773 1
1 1
31336 1
33608 1
1 1
1 1
1 1
1 1
33620 3
1 1
1 1
33620 3
1 1
16410 1
33308 1
33620 3
33100 1
33619 3
26702 1
1 1
33620 1
33620 ...

result:

ok ok

Test #84:

score: 20
Accepted
time: 33ms
memory: 15176kb

input:

40000
? 269781938
- 372800326 617806012
- 464282353 149727588
- 252205549 630950586
- 19010576 523270966
? 62080133
+ 1974 12
+ 28064 4
+ 11233 5
? 28084
+ 19577 4
? 7022
+ 2967 12
+ 26102 4
+ 4773 9
+ 1727 12
+ 2349 12
+ 20621 4
+ 2099 12
? 599
+ 30215 4
+ 23879 4
+ 10953 5
+ 505 12
+ 1951 12
? 1
+...

output:

-1 -1
-1 -1
1 1
21046 1
27469 1
30215 4
1 1
30521 4
30521 3
1 1
31025 1
31034 4
31032 4
31034 4
31034 3
31034 4
15370 1
1 1
31034 3
31031 1
1 1
26543 1
31034 3
31034 4
1 1
27102 1
31034 4
31024 1
31030 1
31034 1
1 1
31009 1
1 1
30852 1
31034 1
31026 1
30733 1
1 1
31034 4
31027 1
23059 1
30888 1
3007...

result:

ok ok

Test #85:

score: 20
Accepted
time: 32ms
memory: 15080kb

input:

40000
- 360681199 399864979
+ 3425 12
+ 22547 3
? 11
+ 1054 12
+ 3148 12
? 1
? 22585
+ 21577 3
+ 1079 12
+ 122 12
? 1
+ 18867 3
+ 3454 12
+ 1149 12
+ 3282 12
+ 3346 12
? 22663
+ 815 12
+ 40107 3
? 11
+ 2184 12
? 805
+ 7737 8
+ 3049 12
+ 38307 3
? 40273
? 23
+ 35147 3
+ 4004 11
+ 1646 12
+ 7122 8
+ 3...

output:

22539 1
22547 3
1 1
22547 3
1 1
40099 1
39305 1
1 1
40087 1
1 1
19951 1
40107 3
26635 1
40107 3
40097 1
1 1
40107 3
29999 1
38273 1
1 1
42067 3
1 1
28482 1
42927 3
42927 1
1 1
42927 3
42613 1
42927 3
40860 1
28436 1
42917 1
39585 1
42927 1
1 1
1 1
42927 3
42926 3
42927 3
21154 1
42796 1
42927 3
4292...

result:

ok ok

Test #86:

score: 20
Accepted
time: 31ms
memory: 15136kb

input:

40000
+ 4713 11
+ 843 12
+ 2943 12
+ 23817 3
+ 29047 3
+ 5215 11
? 1
+ 1009 12
+ 9087 8
? 6
? 1
? 29118
+ 10247 3
+ 2938 12
? 39
? 117
+ 14547 3
+ 1073 12
? 28
+ 551 12
+ 9962 8
+ 4081 11
+ 15097 3
+ 1142 12
? 22
+ 1675 12
+ 44727 3
+ 16997 3
? 12
+ 29467 3
+ 41457 3
+ 490 12
+ 35897 3
+ 8802 8
? 44...

output:

29047 3
29044 1
29047 3
1 1
29011 1
28933 1
29022 1
29028 1
44718 1
1 1
37241 1
44727 3
1 1
47247 3
46528 1
1 1
47247 3
1 1
23429 1
47247 3
47245 1
1 1
23404 1
1 1
47247 3
1 1
47346 3
40527 1
47162 1
1 1
46913 1
47331 1
42035 1
23431 1
23406 1
47347 3
1 1
1 1
1 1
47347 3
1 1
47340 1
47347 1
47236 5
...

result:

ok ok

Test #87:

score: 20
Accepted
time: 35ms
memory: 21116kb

input:

40000
? 348058959
- 246637267 226432244
? 850572176612915348
- 616995164 664650525
+ 4528 11
+ 16415 3
+ 4554 11
+ 47075 3
+ 2540 12
+ 3184 12
? 2
+ 20605 3
+ 48575 3
+ 36435 3
+ 998 12
+ 28715 3
+ 3644 12
? 839
+ 1309 12
+ 3360 12
+ 1475 12
? 48698
? 13
+ 2479 12
+ 52925 3
+ 1952 12
? 25
+ 32235 3
...

output:

-1 -1
-1 -1
47074 3
47739 1
1 1
48565 1
52903 1
1 1
1 1
1 1
52925 3
52924 3
1 1
52925 3
42297 1
52925 3
1 1
48084 1
52925 3
52892 1
52916 1
52925 3
52918 1
1 1
52925 3
1 1
52925 3
52924 1
52925 3
1 1
52925 1
1 1
39576 1
42250 1
52920 1
52925 3
1 1
50950 1
1 1
1 1
1 1
35080 1
52871 1
52703 1
52925 1
...

result:

ok ok

Test #88:

score: 20
Accepted
time: 36ms
memory: 15160kb

input:

40000
+ 607847 547419
- 181315 29679
+ 56776 161287
- 873319 243941
+ 107165 750759
+ 194996 651995
+ 521948 604666
- 503605 78776
- 822937 127128
+ 415610 64685
+ 653418 115678
- 907523 50771
+ 176480 621723
+ 889717 680016
- 297093 329679
+ 172725 334071
- 598027 91002
+ 462551 544596
+ 416767 475...

output:

1 1
1 1692783153
1 2539292240
1 1692783153
1 1
1 2539292238
1 1692783153
1 2539292240
1 2539292240
1 1692783153
1 2539292240
1 1692783153
1 1
1 1
1 2539292238
1 2539292238
1 1692783153
1 2539292238
1 2539292240
1 1
1 2539292238
1 1692783153
1 1
1 2539292238
1 1
1 1
1 1
1 2539292238
1 2539292240
1 25...

result:

ok ok

Subtask #5:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #89:

score: 10
Accepted
time: 92ms
memory: 21548kb

input:

120000
- 1 999998
- 1 1
? 524676648
- 1 1
? 471359062610816649
? 106119244925555144
? 743663297
? 423592229
? 186067296173162429
? 632755129
? 246989272133701876
? 17515319
? 709195536
? 233113315381037082
? 142287560
? 397324959
? 405060842572191831
? 570787044218436408
? 808564090
? 67325167266819...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 2
1 1
1 1
1 1
1 2
1 1
1 1
1 2
1 1
1 1
1 1
1 2
1 1
1 2
1 1
1 2
1 1
1 1
1 1
1 1
1 2
1 2
1 1
1 1
...

result:

ok ok

Test #90:

score: 10
Accepted
time: 148ms
memory: 16312kb

input:

120000
- 1 999999991
? 234755869
? 250134300
? 474946255
? 915424038
+ 72 210
R 1
? 65537672
? 914328953107461357
+ 144 934
? 1
? 359
? 3
? 1077
+ 658 89
R 1
? 3
? 1077
? 1
+ 61 317
? 17
? 2
- 676 346
? 34
? 697
? 1
? 1394
+ 841 83
R 1
- 472 429
? 82
? 1394
? 1
? 697
? 34
? 1394
? 2
? 41
+ 184 196
+...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
144 934
1 719
142 934
1 1
142 934
1 1
144 934
52 1244
61 1250
35 1244
1 698
61 1251
1 1
1 1230
1 1
61 1251
1 698
35 1244
1 1
61 1250
42 1230
1 1
144 2029
123 1612
139 2028
1 1
1 1055
48 2436
1 1
61 3164
1 1
61 3162
61 3164
1 1941
291 1717
1 1
293 1716
293 1717
1 4...

result:

ok ok

Test #91:

score: 10
Accepted
time: 100ms
memory: 18548kb

input:

120000
- 891888 762912
+ 328047 7
+ 93966 14
? 1
? 328067
+ 12336 56
+ 3116 60
+ 346369 6
+ 5458 60
+ 28126 51
+ 4237 60
+ 48454 39
+ 347029 6
+ 17341 56
+ 12 60
+ 4567 60
? 347563
+ 1019 60
+ 172120 11
? 1
? 57939
+ 326319 7
+ 3554 60
+ 8650 59
+ 8664 59
+ 3221 60
+ 115696 13
+ 423753 4
+ 1732 60
+...

output:

328047 7
1 1
1 1
347029 6
289109 1
282206 1
211396 1
1 1
423746 1
423751 1
1 1
423753 4
423753 4
423753 4
1 1
1 1
1 1
423751 1
1 1
423570 1
421476 1
210424 1
417480 1
338410 1
423753 4
422899 1
421599 1
1 1
423753 4
423753 4
423753 3
1 1
1 1
423753 4
1 1
423753 4
1 1
429795 4
1 1
1 1
367735 1
429795...

result:

ok ok

Test #92:

score: 10
Accepted
time: 143ms
memory: 21660kb

input:

120000
? 444322946139031067
- 793295440 833168991
- 229763750 989309815
? 24197291
- 511348568 910708986
+ 30271 6
? 1044
? 29
+ 4247 51
+ 13349 8
? 30335
? 5
? 1
? 6067
+ 1329 59
? 13
+ 587 60
? 30454
+ 361 60
? 1
+ 12713 8
? 6
+ 634 60
? 10194
+ 1547 56
+ 652 60
? 2
? 30698
+ 923 59
+ 42325 5
+ 17...

output:

-1 -1
-1 -1
29233 1
30248 1
1 1
30267 6
30271 6
24210 1
30264 1
1 1
30271 6
30271 1
20083 1
30271 5
1 1
1 1
42118 1
42268 1
42324 1
1 1
58276 4
1 1
58276 4
58276 3
1 1
38289 1
1 1
1 1
38192 1
46215 1
26245 52
54913 1
58276 3
1 1
1 1
37772 1
58276 3
45854 1
58275 1
58276 4
58276 3
47868 1
27077 1
374...

result:

ok ok

Test #93:

score: 10
Accepted
time: 110ms
memory: 18756kb

input:

120000
+ 246701 6
+ 348758 5
? 19376
? 2076
+ 16199 56
+ 5932 60
+ 5594 60
+ 9946 59
+ 94370 34
+ 522404 4
+ 8812 59
+ 26964 51
? 11
? 47527
? 1
+ 197751 6
+ 2212 60
+ 57424 36
+ 6246 60
? 522959
+ 269014 5
? 261482
? 1
+ 10652 59
+ 35301 50
+ 5584 60
? 1
+ 9444 59
+ 548624 4
+ 5299 60
+ 366062 5
+ ...

output:

329387 1
346687 1
522397 1
474881 1
522404 4
1 1
260936 1
522404 4
522404 4
493683 1
558768 1
496578 1
558770 4
558770 4
1 1
1 1
1 1
558770 4
529299 1
558770 4
557891 1
1 1
558770 4
558770 4
1 1
558680 1
446545 1
1 1
507751 1
371665 1
558770 4
558469 1
558770 4
558770 4
1 1
1 1
1 1
418297 1
1 1
5587...

result:

ok ok

Test #94:

score: 10
Accepted
time: 137ms
memory: 24236kb

input:

120000
? 446275518788921656
- 299417081 149149598
+ 1711 60
? 1
+ 1507 60
+ 7834 51
+ 110591 5
+ 2654 59
+ 1578 60
+ 123359 5
? 34
+ 146137 4
+ 200 60
+ 1297 60
? 146560
+ 4484 56
+ 10464 51
+ 2816 59
+ 1943 60
+ 55617 7
+ 1893 60
+ 136162 4
+ 1741 60
+ 52053 7
? 92
? 146924
+ 136 60
? 36746
+ 62529...

output:

-1 -1
1711 60
123330 1
1 1
146049 1
1 1
109409 1
72662 1
146137 4
144791 1
146137 4
146112 1
138775 1
146137 1
146137 3
72356 1
146137 4
1 1
141900 1
1 1
146134 1
146137 4
146132 1
145835 1
146135 4
71710 1
146137 4
1 1
146137 4
146130 1
1 1
145844 1
129554 1
146137 4
146135 4
141324 1
1 1
146137 4
...

result:

ok ok

Test #95:

score: 10
Accepted
time: 115ms
memory: 20424kb

input:

120000
- 329762 587831686
- 803854511 71863487
- 257829748 718761210
? 270994151822425030
+ 3038 60
? 1
+ 1404 60
+ 114843 4
+ 659 60
+ 312006 4
+ 34098 38
+ 5221 59
+ 2512 60
+ 19720 51
+ 60066 4
+ 4279 60
+ 264525 4
+ 5555 59
+ 83322 4
+ 5189 59
+ 20740 51
? 2
+ 5613 59
+ 4824 60
+ 11585 56
? 17
?...

output:

-1 -1
3038 60
312006 3
311993 1
312006 4
311998 1
311995 1
311967 1
312006 4
312006 4
312006 4
311526 1
1 1
311931 1
312006 4
207213 1
311705 1
312006 4
312006 4
1 1
312006 3
312006 4
312006 4
1 1
311387 1
312006 3
311949 1
1 1
1 1
312006 3
1 1
1 1
312006 4
153214 1
312006 4
1 1
1 1
312006 4
312006 ...

result:

ok ok

Test #96:

score: 10
Accepted
time: 116ms
memory: 18548kb

input:

120000
- 653083553 480301785
- 841223476 908076335
- 482520051 905872054
- 866860766 369267358
+ 495 60
? 1
+ 62833 34
+ 249598 4
+ 119410 4
+ 7920 58
? 23
? 1
? 249757
+ 366619 4
+ 4541 60
? 14
+ 288301 4
+ 5697 60
+ 2862 60
+ 225715 4
+ 60862 34
+ 49221 35
? 6221
+ 154066 4
? 1
? 367043
+ 231871 4...

output:

495 60
249579 1
249598 4
1 1
366609 1
360402 1
366619 4
1 1
366619 4
366619 4
1 1
366619 4
1 1
366619 4
1 1
182437 1
366619 4
366618 1
366606 1
1 1
366619 4
305093 1
366619 1
366619 4
366603 1
1 1
366618 1
366619 4
366619 1
181847 1
366604 1
181749 1
366617 4
1 1
1 1
273998 1
181296 1
1 1
1 1
366619...

result:

ok ok

Test #97:

score: 10
Accepted
time: 116ms
memory: 18560kb

input:

120000
? 128670128510006810
- 112120371 402488881
? 467205337
- 900645079 493628836
- 620356105 304356389
- 741927666 769999308
- 239994867 628314042
- 7683408 735746190
- 353587378 505282600
? 266157939
- 556126795 585332677
? 550850090
+ 5523 60
? 5582
+ 6872 59
+ 231262 8
+ 356437 5
+ 134001 11
+...

output:

-1 -1
-1 -1
-1 -1
-1 -1
1 1
391663 4
391651 1
391658 1
391665 4
356035 1
363656 1
348077 1
391665 4
335598 1
391665 4
391665 4
379003 1
1 1
391657 1
1 1
391665 4
391665 3
373804 1
391665 4
260559 1
391663 4
1 1
391665 4
1 1
391665 3
391665 4
1 1
1 1
402039 4
402039 4
402039 4
1 1
402032 1
402039 4
3...

result:

ok ok

Test #98:

score: 10
Accepted
time: 153ms
memory: 18432kb

input:

120000
- 1 999999991
? 221222707232533683
? 967354364
? 790389858938560694
? 381202725
? 861646599
? 34524131
+ 216 294
? 509
+ 656 635
? 3
? 6
? 88
- 533 655
? 146
? 1460
+ 829 402
? 1
? 2159
? 17
? 127
? 1
? 1
- 943 943
? 127
? 1
? 17
? 2159
- 358 357
? 2159
? 1
? 17
? 127
? 2159
+ 898 935
? 1
- 5...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
655 634
655 631
587 617
437 585
1 1
532 1037
1 1
523 1030
128 1293
532 1037
532 1037
128 1293
532 1037
523 1030
1 1
1 1
532 680
523 673
493 593
1 1
216 2266
216 2266
1 1
1 1
100 2890
1 1
169 1155
1 1628
77 3416
78 3416
1 1
77 3414
48 3791
1 1
345 1836
78 3807
...

result:

ok ok

Test #99:

score: 10
Accepted
time: 141ms
memory: 18372kb

input:

120000
- 226176001 163612570
- 411784030 110259103
? 861194173
? 400697581
+ 158 30
+ 10605 19
? 10653
+ 211 30
+ 970 30
? 3
? 10713
+ 2331 29
+ 1737 30
? 1
+ 1601 30
+ 22100 6
+ 2401 29
? 11166
+ 1977 30
? 6
+ 18125 6
+ 40591 4
+ 1274 30
+ 1850 30
+ 53312 3
? 11
+ 4377 25
+ 1763 30
+ 381 30
? 53732...

output:

-1 -1
-1 -1
1 1
10603 19
1 1
10605 19
10940 1
22100 1
53304 1
1 1
50487 1
53312 3
53312 3
57315 3
57312 1
57316 3
1 1
1 1
57316 3
57174 1
57314 1
57316 3
57251 1
42776 1
57316 3
1 1
1 1
55902 1
57309 1
57316 3
57316 3
57315 3
1 1
57315 3
37811 1
57316 3
1 1
56959 1
56357 1
57126 1
1 1
1 1
57960 3
1 ...

result:

ok ok

Test #100:

score: 10
Accepted
time: 125ms
memory: 18524kb

input:

120000
? 778358171093808790
? 707509876098704663
- 316877631 318204199
+ 1550 30
+ 2182 30
+ 65490 5
? 1
+ 85471 4
? 28513
+ 77344 4
+ 33389 6
+ 59900 5
+ 2459 30
+ 10247 25
+ 81043 4
+ 16667 19
+ 14195 19
+ 54414 5
+ 1934 30
+ 5042 28
? 1
+ 5759 28
? 2
+ 119323 3
+ 1505 30
+ 1209 30
+ 4184 28
+ 597...

output:

-1 -1
-1 -1
65490 5
56967 1
85471 4
85471 3
1 1
119279 1
116777 1
1 1
119323 1
119322 1
1 1
121617 1
118344 1
121613 1
121647 3
121595 1
60406 1
121646 3
121187 1
1 1
121647 3
90960 1
121646 3
1 1
121647 3
121647 3
1 1
115792 1
121647 3
90813 1
121646 3
96978 1
1 1
121647 3
121321 1
121572 1
59846 1...

result:

ok ok

Test #101:

score: 10
Accepted
time: 112ms
memory: 19752kb

input:

120000
+ 2981 30
+ 427 30
? 1
? 80
+ 163656 3
+ 1897 30
+ 1671 30
+ 147867 4
+ 163 30
+ 79685 5
+ 190928 3
? 44
? 4
+ 167268 3
+ 1921 30
+ 15095 26
+ 63992 6
+ 62792 6
? 191163
+ 155984 3
? 453
+ 108051 5
+ 84651 5
? 2
+ 54567 6
+ 2571 30
+ 89539 5
+ 1611 30
? 1
+ 75707 5
+ 111066 4
+ 45067 6
+ 2238...

output:

2981 30
2931 1
190887 1
190927 1
1 1
190478 1
190927 3
190928 3
190917 1
1 1
190928 1
1 1
190924 1
1 1
1 1
190928 3
127009 1
190928 3
190320 1
1 1
190918 1
190516 1
1 1
190884 1
126861 1
190928 3
190928 3
190928 3
1 1
189927 1
180223 1
190927 3
190928 3
1 1
190928 3
1 1
190927 1
190928 3
1 1
94303 1...

result:

ok ok

Test #102:

score: 10
Accepted
time: 113ms
memory: 18696kb

input:

120000
- 118958516 503123842
+ 7774 29
+ 143895 4
? 7
? 1
+ 850 30
+ 81555 6
? 143963
+ 9720 29
+ 167304 4
? 4783
+ 2402 30
+ 59130 6
+ 213106 3
? 213246
+ 28148 21
+ 194794 3
+ 959 30
? 79
+ 45235 19
+ 90355 6
? 805
? 30475
+ 231418 3
? 46328
+ 76230 6
+ 76680 6
+ 8688 29
? 1
? 2663
+ 20128 26
? 29...

output:

143892 1
143895 4
1 1
162525 1
1 1
213030 1
212304 1
182637 1
185099 1
231418 3
228758 1
228488 1
231418 3
231418 1
237717 3
198000 1
228896 1
237716 1
233994 6
223692 1
234846 1
237716 1
190014 1
1 1
237718 3
237540 1
236402 1
237540 1
237717 3
118304 1
237717 3
237718 1
1 1
237718 3
237717 3
1 1
2...

result:

ok ok

Test #103:

score: 10
Accepted
time: 113ms
memory: 18228kb

input:

120000
? 441444219756204750
+ 11813 29
? 11841
? 3
+ 137929 7
+ 10377 29
+ 70583 9
+ 1642 30
+ 98777 8
+ 10543 29
+ 93855 8
? 138077
? 1
+ 116027 8
+ 105562 8
? 723
? 573
+ 217577 4
? 185
+ 5459 30
+ 96270 8
+ 16688 26
+ 9333 29
? 2
? 217838
+ 11909 29
+ 26963 21
+ 5436 30
+ 2735 30
+ 11711 29
+ 264...

output:

-1 -1
1 1
11812 28
1 1
137929 7
137213 1
137363 1
217396 1
217577 3
1 1
217575 4
1 1
206099 1
217577 4
217550 1
1 1
217577 4
217478 1
261795 3
261782 1
1 1
1 1
267408 1
1 1
1 1
267422 3
1 1
200285 1
267423 3
1 1
267423 3
1 1
264817 1
267423 3
133076 1
267422 3
267423 3
267388 1
267422 3
263887 1
1 1...

result:

ok ok

Test #104:

score: 10
Accepted
time: 129ms
memory: 18132kb

input:

120000
? 123850262343170892
+ 2349 12
+ 34387 5
? 34403
+ 11099 9
+ 3473 12
+ 25187 5
+ 3475 12
? 31
? 34441
? 1
+ 10991 9
+ 55326 4
+ 54219 4
+ 55065 4
+ 8123 11
+ 47253 4
+ 8573 11
? 1289
+ 2444 12
+ 2317 12
? 1
+ 10587 9
+ 11895 9
+ 2744 12
+ 43662 4
? 55485
+ 10635 9
+ 1778 12
? 55506
? 3
+ 4846...

output:

-1 -1
1 1
34361 1
1 1
34387 5
54049 1
55326 4
1 1
1 1
55324 4
54573 1
1 1
60069 4
60066 1
59942 1
60069 4
61614 1
61986 4
61986 4
61986 4
1 1
33751 1
67935 4
45136 1
67846 1
66850 1
56508 1
54222 1
67935 4
45072 1
63356 1
1 1
69464 1
71022 1
69314 1
70753 1
1 1
1 1
71022 4
71016 1
68024 1
71022 4
71...

result:

ok ok

Test #105:

score: 10
Accepted
time: 122ms
memory: 18500kb

input:

120000
- 293847409 139973373
- 358516199 676524406
? 742905586
? 221613672
- 810351729 280476468
? 707376202189158459
? 181621888
- 5702944 929745554
- 392536197 224535013
+ 85938 3
+ 70998 3
+ 18923 8
+ 63178 3
+ 1142 12
+ 7633 11
+ 16903 8
? 145
+ 49848 3
+ 27688 3
+ 4402 12
+ 32608 3
? 43003
? 86...

output:

-1 -1
-1 -1
-1 -1
-1 -1
85796 1
42947 1
1 1
75188 1
85930 1
1 1
68738 1
1 1
85928 1
85888 1
85936 1
86728 3
1 1
86706 1
1 1
93448 3
1 1
1 1
93284 1
92889 1
94608 1
94570 1
62969 1
94608 3
94504 1
94608 3
94604 1
94562 1
1 1
94608 3
1 1
1 1
94451 1
94581 1
94598 1
93627 1
94596 1
93487 1
94607 3
1 1
...

result:

ok ok

Test #106:

score: 10
Accepted
time: 115ms
memory: 20712kb

input:

120000
+ 4935 12
? 1
+ 4498 12
+ 3718 12
+ 50848 3
+ 12621 11
+ 1029 12
+ 9403 11
? 1
+ 3244 12
? 428
+ 6020 12
+ 41298 3
? 13
+ 56168 3
+ 90488 3
+ 60808 3
? 11
+ 48398 3
+ 60498 3
+ 79878 3
+ 7976 12
+ 7963 12
? 7
+ 15223 8
+ 58258 3
+ 50 12
+ 38128 3
+ 77918 3
+ 3616 12
+ 6022 12
+ 45148 3
? 9068...

output:

4935 12
50848 3
50423 1
50838 1
90480 1
90484 1
1 1
1 1
90488 3
1 1
90488 3
1 1
84009 1
45107 1
1 1
90484 1
90481 1
90487 3
90488 1
96710 1
48425 1
97378 3
97372 1
1 1
1 1
97378 1
81035 1
97378 3
48333 1
97378 3
93111 1
1 1
97368 1
96575 1
97376 1
97378 3
95430 1
98258 1
98258 3
98258 3
96153 1
1 1
...

result:

ok ok

Test #107:

score: 10
Accepted
time: 120ms
memory: 18492kb

input:

120000
? 311811663686762573
+ 38023 5
+ 25583 9
+ 21139 9
+ 7377 12
+ 82514 4
? 82552
+ 18083 9
+ 9054 12
+ 21395 9
? 1
+ 28463 5
+ 16943 9
? 1
+ 73559 4
+ 9509 12
+ 4775 12
+ 4589 12
+ 4828 12
? 82648
+ 15903 9
+ 2956 12
+ 41279 5
? 18
+ 231 12
? 3
+ 49631 5
? 11813
+ 59263 5
+ 64423 5
+ 6468 12
+ ...

output:

-1 -1
1 1
82514 4
82514 4
1 1
82500 1
82512 4
70709 1
54957 1
1 1
1 1
107714 4
105085 1
1 1
107714 4
107677 1
106581 1
107714 1
71707 1
107714 3
1 1
57264 1
114842 3
114842 4
114842 4
114842 4
1 1
114837 1
114833 1
114842 4
114842 4
114842 4
1 1
1 1
76345 1
1 1
1 1
114842 4
114842 4
1 1
114842 4
114...

result:

ok ok

Test #108:

score: 10
Accepted
time: 113ms
memory: 16852kb

input:

120000
- 470080190 176685367
- 291110707 156468192
- 476111726 12211627
? 221804870
+ 22668 8
+ 138228 3
+ 14091 11
+ 31158 8
? 138257
+ 30128 8
+ 1249 12
? 1
+ 81828 3
? 138280
+ 248 12
+ 10440 12
+ 54388 3
+ 2881 12
+ 44158 3
+ 492 12
+ 10080 12
+ 1832 12
+ 75618 3
+ 20488 8
+ 97248 3
? 69186
+ 60...

output:

-1 -1
1 1
138228 3
1 1
69054 1
137174 1
138194 1
130942 1
1 1
134488 1
68993 1
1 1
110517 1
138228 3
138228 3
130933 1
138228 3
1 1
1 1
138228 3
135217 1
1 1
1 1
138228 3
137793 1
1 1
129200 1
1 1
1 1
127768 1
138467 3
138468 3
103688 36
138427 1
138053 1
138468 3
1 1
138393 1
138445 1
122999 1
1 1
...

result:

ok ok

Test #109:

score: 10
Accepted
time: 115ms
memory: 20904kb

input:

120000
+ 29271 9
+ 13019 11
+ 83532 4
+ 6245 12
+ 41267 5
+ 118983 4
? 119027
+ 3983 12
? 119039
? 1
? 1
? 1
+ 3221 12
+ 96897 4
+ 19955 9
+ 8558 12
+ 7498 12
+ 5682 12
? 3
+ 5683 12
+ 46859 5
+ 7527 12
? 119129
+ 58611 5
+ 81587 5
+ 38435 5
+ 17807 11
+ 20387 9
+ 128136 4
+ 63931 5
+ 125283 4
+ 476...

output:

1 1
1 1
118983 4
118983 4
118983 4
118981 4
1 1
1 1
127727 1
128136 4
128136 4
1 1
64772 1
1 1
64747 1
127239 1
129837 4
129832 1
129835 4
129814 1
129837 4
127708 1
1 1
129837 4
129837 4
86420 1
128058 1
129837 4
1 1
128844 1
1 1
129837 4
129837 4
129837 4
129837 4
111194 1
1 1
129835 4
1 1
67931 1...

result:

ok ok

Test #110:

score: 10
Accepted
time: 126ms
memory: 18688kb

input:

120000
+ 576347 602196
+ 363328 345520
+ 910885 720435
+ 156522 984917
+ 939928 937749
- 482684 481924
+ 851445 813804
+ 420938 976643
- 266718 196781
+ 681841 840672
+ 556035 512106
+ 893039 110112
- 395881 723375
+ 476350 303313
+ 853145 619235
+ 382286 258670
+ 988828 216969
+ 917164 566727
+ 155...

output:

1 7541523505
1 7541933474
1 7542343456
1 7542343457
1 7542325062
1 3771116791
1 7542334259
1 1
1 7541523505
1 7541933474
1 1
1 7542334259
1 7541523505
1 7542343456
1 3771116791
1 1
1 7542343457
1 1
1 7542343456
1 7542343457
1 1
1 7542334259
1 7542325062
1 3771116791
1 7542343457
1 1
1 1
1 3771116791...

result:

ok ok

Subtask #6:

score: 10
Accepted

Test #111:

score: 10
Accepted
time: 37ms
memory: 13660kb

input:

300000
? 308230551
? 154394919
? 77796824
? 523232316
? 601650936815206607
? 986805724
? 283169431815882827
? 781223930
? 785380179984309713
? 36818911074958611
? 452850684
? 392810692
? 812929344
? 9753139
? 236758865441063408
? 448106017
? 382652997142237763
? 667762111
? 201388730
? 433119061
? 6...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok ok

Test #112:

score: 10
Accepted
time: 41ms
memory: 13776kb

input:

300000
? 694621109955041627
? 142117945123014130
? 271105710887553798
? 588870805
? 596999104759770886
? 559345155
? 913509137
? 863050204268429730
? 121648910055156360
? 27539423
? 237739281
? 102014055246481880
? 918066897
? 150630127417587162
? 675850416
? 465834639
? 242358214
? 914838785
? 3574...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok ok

Test #113:

score: 10
Accepted
time: 260ms
memory: 19464kb

input:

300000
- 594041 389378
+ 771465 5
+ 12646 60
+ 148838 36
+ 30991 56
+ 5527 60
+ 488 60
+ 17980 59
+ 3243 60
+ 846785 5
+ 736073 5
+ 206626 6
+ 258271 6
+ 8314 60
+ 10126 60
+ 574513 5
+ 868009 5
+ 22322 59
+ 6150 60
+ 448626 6
+ 330651 6
+ 308596 6
+ 901966 4
+ 10974 60
+ 6572 60
+ 25046 59
+ 7370 6...

output:

25061 709605
1 1
24919 696445
25061 714997
1 1953994
25089 715469
25081 715469
21551 696445
1 1
1 1953972
1 1944470
1 1906373
22393 268661
22393 268661
25089 715469
25061 709605
25081 715469
1 1951924
1 1953994
1 1953990
1 1
25089 715469
21551 696445
25061 709605
25081 715469
25089 715469
24919 6964...

result:

ok ok

Test #114:

score: 10
Accepted
time: 197ms
memory: 17656kb

input:

300000
- 544244779 401896578
- 229459262 27082806
- 4986516 61493428
- 747404249 439501562
- 313249775 339930648
+ 725 60
+ 11377 40
+ 11356 40
+ 655 60
+ 1580 60
+ 509 60
+ 9229 51
+ 1546 60
+ 3469 56
+ 5224 56
+ 15369 38
+ 2706 59
+ 1738 60
+ 2106 59
+ 1380 60
+ 75573 7
+ 981 60
+ 761 60
+ 73413 7...

output:

1 52183
385 209952
1 186912
387 209952
1 1
1 140592
385 209232
385 209712
387 210012
387 209952
385 209952
387 186912
387 210012
385 208272
387 210012
1 232473
387 210071
1 231714
13 232509
387 198492
13 232509
1 1
393 209711
1 1
387 210012
387 209693
385 209952
25 231785
1 1
387 209952
1 52183
1 23...

result:

ok ok

Test #115:

score: 10
Accepted
time: 261ms
memory: 22164kb

input:

300000
- 940754 627319
- 547131 401811
- 469808 360399
- 885538 886691
- 442130 420883
- 668555 344909
- 326050 871625
- 363559 488126
- 738546 429119
- 367654 579621
+ 16493 60
+ 7756 60
+ 559725 6
+ 31268 59
+ 24926 59
+ 534865 6
+ 44038 56
+ 889664 5
+ 7191 60
+ 29338 59
+ 485200 6
+ 144559 36
+ ...

output:

1 1
728945 22502
684929 22552
726817 22552
728945 22612
118285 1
1 2363391
713489 22042
695457 20202
669697 22042
727657 22387
1 2360248
713489 22042
727041 22552
595441 22552
1 2309210
721777 22552
634921 14797
728833 22612
1 2363053
1 1
728721 22552
118285 1
1 1
1 2363437
1 2363415
1 2363435
66969...

result:

ok ok

Test #116:

score: 10
Accepted
time: 256ms
memory: 24204kb

input:

300000
- 983699889 144650481
- 805639905 849113323
- 1562000 12909585
+ 264548 4
+ 119 60
+ 1897 60
+ 412862 4
+ 9986 56
+ 260615 4
+ 16578 55
+ 267854 4
+ 384590 4
+ 15666 55
+ 8080 59
+ 51337 35
+ 988 60
+ 7736 59
+ 224135 4
+ 4497 60
+ 22608 49
+ 411950 4
+ 364070 4
+ 123986 4
+ 168788 4
+ 1633 6...

output:

389037 4721
389208 4717
97482 1
348852 3781
388353 4705
384762 1
241122 1
384762 4321
388866 4705
389037 4681
379632 4321
1 1
456580 1
389151 4705
389208 4721
388353 4537
384762 4681
388182 4561
389208 4705
384762 4621
388752 4705
388884 4738
21361 1
388752 4621
388182 4721
384762 4201
384762 3361
4...

result:

ok ok

Test #117:

score: 10
Accepted
time: 258ms
memory: 24840kb

input:

300000
- 691888041 560547304
+ 77483 39
+ 220918 8
+ 687043 4
+ 2132 60
+ 180850 8
+ 11169 60
+ 8035 60
+ 165957 8
+ 10113 60
+ 109372 36
+ 120597 36
+ 5587 60
+ 15778 59
+ 15586 59
+ 4029 60
+ 13244 59
+ 11600 60
+ 26965 56
+ 7630 60
+ 91044 38
+ 13984 59
+ 622462 4
+ 29045 56
+ 549786 5
+ 11409 60...

output:

275 1454748
271 1454148
271 1454508
1 1228548
271 1452348
1 1471248
274 1454688
1 1
271 1454748
1 1325628
1 1422708
1 743148
1 1034388
271 1454148
1 1471246
271 1454148
271 1454748
1 1435440
1 1
1 1
275 1454748
274 1454688
1 743148
1 1034388
275 1454748
274 1454688
1 743148
275 1454748
275 1454748
2...

result:

ok ok

Test #118:

score: 10
Accepted
time: 261ms
memory: 19412kb

input:

300000
+ 833662 4
+ 10224 60
+ 7980 60
+ 211291 8
+ 70888 51
+ 12550 60
+ 16366 59
+ 41988 51
+ 4505 60
+ 675886 5
+ 405 60
+ 894 60
+ 361 60
+ 1053 60
+ 195868 8
+ 799702 5
+ 43708 51
+ 22313 56
+ 49038 51
+ 3688 60
+ 14098 60
+ 36848 56
+ 338498 7
+ 4669 60
+ 664686 5
+ 48998 51
+ 28283 56
+ 12232...

output:

1 1
10329 1122167
9499 982127
1 429418
10329 1122227
10319 1122047
9499 1077107
1 1077107
10329 1122167
10305 1122047
1 1741966
10329 1122227
10326 1122047
10305 1122047
10329 1122047
9499 982127
6333 982127
1 1735739
1 1741967
10329 1122227
10329 1122227
9499 1077107
10329 1122167
10329 1122227
103...

result:

ok ok

Test #119:

score: 10
Accepted
time: 272ms
memory: 25512kb

input:

300000
- 726676487 864274333
+ 3398 60
+ 3890 60
+ 534555 5
+ 218007 6
+ 43144 56
+ 8155 60
+ 4153 60
+ 59394 51
+ 4037 60
+ 276637 6
+ 7455 60
+ 1062133 4
+ 851461 4
+ 121298 37
+ 7416 60
+ 41029 56
+ 11893 60
+ 14398 60
+ 180268 34
+ 11178 60
+ 438942 6
+ 25331 59
+ 405997 6
+ 11788 60
+ 271742 6
...

output:

71724 209102
1 1
51965 209102
90237 218830
39570 1
90094 218230
90226 218830
90237 218230
82361 209102
39570 1
39589 506656
90094 217158
39570 59726
82361 209102
39588 506656
1064602 1
71724 209102
51965 209102
1 2000914
90226 218730
1 1
82361 209102
90094 218230
90226 218830
1 1
51965 209102
90237 ...

result:

ok ok

Test #120:

score: 10
Accepted
time: 34ms
memory: 13060kb

input:

300000
? 370258194
? 257028910
? 777092949513297634
? 423453060
? 521538082620634276
? 300650091451720493
? 628309223796234202
? 331707118970812852
? 188337343343097036
? 42780289224863237
? 605436692
? 254197361
? 247822295
? 562535640
? 747501990754280808
? 425396627743296367
? 241657729
? 9511443...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok ok

Test #121:

score: 10
Accepted
time: 232ms
memory: 23856kb

input:

300000
- 111937273 506541919
- 593946312 29694729
- 507706336 962746978
- 522477680 700335053
- 255548369 420743772
- 508357068 958309741
- 40421254 920653282
- 304642144 646267096
- 634208796 932202123
- 1366575 766590343
- 966231072 292949428
- 333693807 70262246
+ 924 30
+ 85 30
+ 4037 30
+ 14193...

output:

88038 1
111229 4841
111125 4836
107225 2382
107225 3386
11086 1
111203 4836
1 271395
36173 1
107225 1
1 271863
1 1
110579 4836
111047 4836
110813 4836
109877 4836
107225 4390
111229 4836
1 1
148295 3
111229 4841
1 1
111203 4836
107225 2382
36173 1
1 1
107225 1
111047 4836
111047 4836
1 1
111229 4841...

result:

ok ok

Test #122:

score: 10
Accepted
time: 246ms
memory: 20644kb

input:

300000
- 195143845 345564372
- 145294474 535583225
- 886576997 392420261
- 339601359 919220234
- 156836791 223904496
- 150385505 509018815
+ 158859 5
+ 7366 30
+ 912 30
+ 150435 5
+ 131169 5
+ 20263 26
+ 3880 30
+ 98442 6
+ 4444 30
+ 205185 4
+ 51574 19
+ 325197 3
+ 8840 30
+ 12359 29
+ 133977 5
+ 4...

output:

24259 1
333373 3
44656 63299
1 1
44656 63279
1 490053
44656 63299
1 1
24259 1
1 1
1 516585
1 1
44656 63299
44656 63299
1 1
1 1
1 1
44656 63279
1 1
24259 1
1 1
1 1
1 1
44656 63279
1 1
320993 1
44656 63279
44656 63279
1 1
44656 63299
1 1
1 1
44656 63299
1 1
44656 63299
44656 63279
44656 63299
44656 63...

result:

ok ok

Test #123:

score: 10
Accepted
time: 247ms
memory: 25224kb

input:

300000
- 108911323 275022738
- 730160952 138230002
+ 6518 30
+ 12946 30
+ 10185 30
+ 432203 3
+ 326777 5
+ 38910 26
+ 6158 30
+ 6835 30
+ 11124 30
+ 20273 29
+ 64430 21
+ 75140 21
+ 9550 30
+ 4112 30
+ 5792 30
+ 135437 9
+ 430411 3
+ 86312 10
+ 240352 7
+ 457179 3
+ 13621 30
+ 4428 30
+ 193982 8
+ 2...

output:

1 1
4955 666493
1 815143
1 1
1 815143
4955 666493
1 774643
1 1
1 1
4955 666493
1 815143
1 1
1 1
4955 666493
1 1
1 1
1 1
4955 666493
1 774643
1 1
4955 666493
4955 666493
1 1
4955 666493
1 1
1 1
1 1
1 1
4955 666493
4955 666493
4955 666493
4955 666493
4955 666493
4955 666493
1 1
1 1
4955 666493
1 1
1 1...

result:

ok ok

Test #124:

score: 10
Accepted
time: 258ms
memory: 19592kb

input:

300000
+ 107692 10
+ 6550 30
+ 18166 30
+ 201009 9
+ 486965 3
+ 24905 29
+ 32883 26
+ 24507 29
+ 287113 7
+ 53503 26
+ 354134 6
+ 21 30
+ 17533 30
+ 27761 29
+ 21032 30
+ 19084 30
+ 16028 30
+ 50093 26
+ 341634 6
+ 32448 26
+ 1288 30
+ 6123 30
+ 87993 21
+ 202 30
+ 7074 30
+ 16875 30
+ 169593 9
+ 48...

output:

1 1
516114 3121
265946 1
515974 3076
485370 1
516226 3121
1 1105084
1 1063607
1 1
516226 3121
265946 1
516226 3121
1 1115453
265946 1
1 1
1 1
265946 1
265946 1
515974 3076
516226 3121
265946 1
1 1
516226 3121
265946 1
516226 3121
515974 3076
1 1
515974 3076
265946 1
516226 3121
515974 3076
1 1
51622...

result:

ok ok

Test #125:

score: 10
Accepted
time: 249ms
memory: 26048kb

input:

300000
- 71565805 376201929
- 686468903 240673099
- 167580519 745698860
+ 3234 30
+ 21664 30
+ 207459 9
+ 18227 30
+ 80478 21
+ 113448 21
+ 22747 30
+ 23785 30
+ 637145 3
+ 19716 30
+ 455995 6
+ 4186 30
+ 662793 3
+ 674917 3
+ 65668 21
+ 660049 3
+ 223255 9
+ 625721 3
+ 15993 30
+ 374925 7
+ 17653 3...

output:

1 923579
1 1313669
8011 1073219
8014 1073249
1 1
1 1
1 1
1 923579
1 1
8011 1073219
8011 1073219
1 1
1 1
1 923579
1 1
1 1
8011 1073219
8011 1073219
8014 1073249
1 1
1 1
1 1313665
1 1
1 1
1 1
1 923579
1 1
1 1
1 1
1 1301086
8014 1073249
8014 1073249
1 1
8014 1073249
1 923579
1 1
8014 1073249
8014 10732...

result:

ok ok

Test #126:

score: 10
Accepted
time: 254ms
memory: 21884kb

input:

300000
+ 1318 12
+ 16265 11
+ 89337 5
+ 17611 11
+ 16003 11
+ 107638 4
+ 42137 5
+ 9189 12
+ 18255 11
+ 10354 12
+ 11905 12
+ 16415 11
+ 78737 5
+ 8639 12
+ 138949 4
+ 103937 5
+ 94457 5
+ 79273 5
+ 132676 4
+ 127033 4
+ 172249 4
+ 14159 12
+ 154456 4
+ 1207 12
+ 12564 12
+ 146707 4
+ 94161 5
+ 1078...

output:

1 1
11499 136451
15429 156925
15429 156997
11499 136451
1 342145
11499 136451
15429 156997
11499 136451
1 336839
15429 156997
1 1
11499 136451
15429 156925
15429 156997
11499 136451
15429 156925
15429 156997
55445 64835
15429 156997
1 304998
11499 136451
15429 156925
15429 156997
11499 136451
1 3421...

result:

ok ok

Test #127:

score: 10
Accepted
time: 252ms
memory: 19524kb

input:

300000
- 198456732 138355635
- 563130110 280075165
+ 137215 4
+ 9198 12
+ 63781 5
+ 787 12
+ 5818 12
+ 9426 12
+ 11708 12
+ 54469 5
+ 108077 5
+ 14063 12
+ 23201 11
+ 123499 4
+ 194104 4
+ 6923 12
+ 15059 12
+ 106053 5
+ 10183 12
+ 129007 4
+ 28877 9
+ 2863 12
+ 32353 9
+ 90253 5
+ 82229 5
+ 7622 12...

output:

1 1
9812 287903
9812 287903
1 405647
178466 1
1 1
1 1
1 1
9812 287903
1 1
9812 287903
9812 287903
1 1
9812 287903
9812 287903
1 1
9812 287903
9812 287903
1 1
1 1
1 1
9812 287903
1 1
9812 287903
1 1
1 1
178466 1
1 1
9812 287903
1 405647
9812 287903
1 1
9812 287903
1 1
1 1
1 1
9812 287903
1 405647
981...

result:

ok ok

Test #128:

score: 10
Accepted
time: 257ms
memory: 19516kb

input:

300000
- 938122062 187354006
- 358207311 380818118
+ 2500 12
+ 56599 8
+ 188609 3
+ 19934 12
+ 208009 3
+ 24492 11
+ 4357 12
+ 1007 12
+ 21518 11
+ 142939 3
+ 17702 12
+ 67909 3
+ 137089 3
+ 134819 3
+ 23888 11
+ 215809 3
+ 241529 3
+ 55139 8
+ 54044 8
+ 103239 3
+ 400 12
+ 241159 3
+ 182449 3
+ 688...

output:

20827 154580
19116 175136
1 1
19970 152396
1 106152
20809 154532
16817 152396
18919 152396
20828 154580
20825 154580
20827 154532
20817 154532
18919 140835
16817 106152
18919 106152
12613 106152
20785 154532
20827 154568
20821 154532
16817 50449
20825 154532
12613 106152
20827 154580
20785 154532
20...

result:

ok ok

Test #129:

score: 10
Accepted
time: 252ms
memory: 22080kb

input:

300000
- 383505589 619759437
- 862139690 107259435
- 515357701 353354793
+ 146796 3
+ 30094 11
+ 7861 12
+ 26173 12
+ 247986 3
+ 239356 3
+ 26401 12
+ 167106 3
+ 7793 12
+ 26115 12
+ 106856 3
+ 20215 12
+ 214076 3
+ 56966 8
+ 171916 3
+ 3684 12
+ 177886 3
+ 18699 12
+ 10781 12
+ 273826 3
+ 15232 12
...

output:

10584 379118
10423 378962
1462 488810
1 1
10593 379226
10337 378434
10592 379046
3668 458954
9844 348854
7335 374330
303818 1
303918 1
1 1
10593 379226
1 1
10337 378434
10593 379226
7335 374330
10593 379226
10593 379226
7335 374330
1 1
7335 374330
10423 378962
9844 348854
10593 379226
10593 379226
1...

result:

ok ok

Test #130:

score: 10
Accepted
time: 256ms
memory: 22544kb

input:

300000
+ 157666 5
+ 284077 4
+ 5541 12
+ 19987 12
+ 250003 4
+ 50406 9
+ 98090 5
+ 22612 12
+ 61402 9
+ 284419 4
+ 259696 4
+ 29578 12
+ 173466 5
+ 24221 12
+ 22827 12
+ 8095 12
+ 25682 12
+ 173058 5
+ 249958 4
+ 278893 4
+ 19894 12
+ 141754 5
+ 27594 12
+ 118250 5
+ 25639 12
+ 160194 5
+ 153010 5
+...

output:

254297 19889
1 1
4454 573749
1 1
1 561417
254297 19889
1 1
254297 19889
1 1
1 1
254297 19889
254297 19889
254297 19889
1 1
1 1
254297 19889
254297 19889
254297 19889
1 1
1 1
1 1
1 1
254297 19889
254297 19889
1 1
1 1
1 1
4454 573749
1 1
254297 19889
1 1
254297 19889
254297 19889
1 1
254297 19889
2542...

result:

ok ok

Test #131:

score: 10
Accepted
time: 260ms
memory: 26132kb

input:

300000
- 775652617 278826207
- 78807891 273051077
+ 335163 3
+ 7507 12
+ 82008 8
+ 304833 3
+ 16694 12
+ 321963 3
+ 30388 11
+ 69208 8
+ 373353 3
+ 29688 12
+ 36952 11
+ 43636 11
+ 38338 11
+ 72238 8
+ 170603 3
+ 32390 11
+ 3477 12
+ 756 12
+ 377303 3
+ 22295 12
+ 279063 3
+ 62043 8
+ 373753 3
+ 264...

output:

20177 349308
18813 252996
20191 349308
20189 349308
20191 349320
18813 365867
1 150388
1 1
18813 150388
1 591605
18813 150388
20185 349308
1 1
18813 150388
18813 365868
1 1
1 522153
20185 349308
20260 331139
20191 349308
1 150388
18813 309432
1 150388
20189 349308
20185 349308
1 556883
20185 349308
...

result:

ok ok

Test #132:

score: 10
Accepted
time: 355ms
memory: 27336kb

input:

300000
+ 808184 507588
+ 463956 862737
+ 219866 341710
+ 668154 699928
+ 143511 517404
- 116476 193919
+ 756157 765281
+ 473627 783871
+ 530526 793087
+ 82730 572621
+ 282177 311446
+ 938125 338634
+ 507502 41746
- 372590 437249
+ 795219 370021
+ 871788 531806
- 523720 309627
+ 348363 844469
+ 53404...

output:

1 19070185219
1 1
1 19070184704
1 18848432710
1 19070185217
1 18626680178
1 19070185214
1 18996267758
1 12713382139
1 9535036422
1 19070185218
1 19070184962
1 18922350171
1 18959308911
1 19033226462
1 19070185177
1 14302556583
1 14302556583
1 15891756510
1 19070185134
1 19070185208
1 19070185091
1 1...

result:

ok ok

Subtask #7:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #133:

score: 20
Accepted
time: 281ms
memory: 20968kb

input:

300000
- 1 999995
+ 1 1
? 1
? 1
? 1
? 1
+ 1 1
? 2
- 1 1
? 1
? 1
? 1
? 1
? 1
? 1
- 1 1
? 930688071
+ 1 1
- 1 1
? 8254386840328011
? 231777271
? 428621712
? 620606606
? 352477757
- 1 1
- 1 1
+ 1 1
? 1
? 1
? 1
? 1
? 1
+ 1 1
? 1
? 2
? 1
? 1
- 1 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
+ 1 1
- 1 1
? 1
? 1
?...

output:

1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 2
1 1
1 2
1 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

result:

ok ok

Test #134:

score: 20
Accepted
time: 418ms
memory: 22556kb

input:

300000
- 1 999999992
? 852664355109377391
? 776197530
+ 433 400
? 416
? 104
+ 594 690
? 153
? 33
? 1683
? 187
? 99
? 17
? 561
? 3
? 1
? 51
? 11
? 99
? 51
? 3
? 1683
? 1
+ 407 882
R 1
+ 516 605
? 2288
? 4
? 13
- 168 147
? 572
? 104
? 16
- 728 689
? 2
+ 552 342
? 5
- 645 264
? 10
? 5
? 2630
+ 29 225
?...

output:

-1 -1
-1 -1
417 1
417 313
307 1064
430 1061
1 1
375 962
397 1028
587 681
1 962
594 688
594 690
409 1064
591 683
397 1028
409 1064
594 688
1 1
594 690
1 1
433 1692
430 1686
426 1067
374 1504
430 1536
432 1548
429 1890
424 1890
429 1890
1 1
433 1890
1 1
1 1
1 1300
1 1758
29 2407
1 1
405 3522
396 4718
...

result:

ok ok

Test #135:

score: 20
Accepted
time: 310ms
memory: 22100kb

input:

300000
- 934884 338693
- 451424 299175
- 692987 445681
? 367285607
+ 3285 60
? 38
? 1672
? 4
+ 9058 60
+ 166834 34
+ 7094 60
+ 53695 51
+ 16157 60
+ 11724 60
? 1
+ 554561 4
+ 943130 4
? 943522
+ 110508 37
+ 852158 4
? 1
+ 597767 4
+ 182971 33
? 4
+ 10644 60
+ 701108 4
+ 1812 60
? 3602
? 2
+ 197855 4...

output:

-1 -1
3269 39
1673 1
3285 57
166834 34
1 1
943130 4
943130 1
939532 1
943130 3
943128 1
943130 4
943128 4
628373 1
1 1
943128 4
942209 1
825066 1
1 1
943130 4
917599 1
943130 4
942949 1
974761 1
910167 1
975335 4
975210 1
975335 4
975268 1
975335 3
975302 1
965645 1
975326 1
1 1
975316 1
974732 1
97...

result:

ok ok

Test #136:

score: 20
Accepted
time: 418ms
memory: 23308kb

input:

300000
+ 21512 36
+ 101316 5
? 2
+ 1098 60
? 50708
+ 4262 56
? 1
+ 2716 59
+ 14490 38
+ 55419 8
+ 10534 50
+ 738 60
+ 99188 5
+ 114373 4
+ 12420 38
+ 746 60
+ 1734 60
? 761
? 1
+ 1323 60
? 1
+ 11073 50
+ 70601 7
+ 79781 7
? 3
? 115035
? 5
+ 1277 60
+ 28585 10
+ 1952 60
+ 1896 60
? 2095
+ 51625 9
? 1...

output:

101315 5
50613 1
101316 5
113616 1
114373 4
114373 4
114371 4
1 1
114372 1
112282 1
1 1
1 1
114373 4
114373 4
75872 1
103587 1
129820 4
103575 1
1 1
129820 4
117879 1
119705 1
129819 1
117847 1
128113 1
129820 4
126684 1
1 1
129820 4
129820 4
129820 4
129816 1
63660 1
63630 1
129820 1
129820 4
1 1
1...

result:

ok ok

Test #137:

score: 20
Accepted
time: 307ms
memory: 26380kb

input:

300000
- 178483 807776
- 896401 63859
- 279388 501570
- 660965 505453
? 507007539374980556
+ 2901 60
? 740
+ 5803 60
+ 94185 51
+ 145545 39
+ 665846 10
+ 14748 60
+ 23159 59
+ 505377 12
? 666196
? 2
+ 534948 11
? 666207
+ 306984 14
+ 687 60
? 95183
+ 22819 59
? 1
+ 12721 60
+ 443245 12
+ 46240 56
+ ...

output:

-1 -1
2221 1
1 1
665846 9
1 1
570673 1
665846 10
665844 10
1 1
665846 10
665846 10
646229 1
665846 10
532331 1
665846 10
665844 7
665846 10
662376 1
665846 10
665846 6
1 1
665677 1
1 1
802571 1
1 1
805925 1
804355 1
1 1
806325 9
806325 9
787053 1
806292 1
1 1
1 1
1 1
1 1
971411 7
971412 7
971402 1
9...

result:

ok ok

Test #138:

score: 20
Accepted
time: 381ms
memory: 25520kb

input:

300000
- 171683069 374253602
? 187096517
+ 7474 59
+ 14345 56
? 1
+ 30493 50
+ 16140 51
+ 353361 5
? 7523
? 47
+ 176845 8
? 353589
? 43
? 8223
+ 45408 37
+ 335329 5
? 353631
+ 5808 59
+ 2293 60
+ 104976 10
+ 81618 10
? 1
+ 61908 36
+ 5348 60
+ 21690 51
+ 333761 5
+ 18090 51
+ 169372 8
+ 190466 8
? 1...

output:

-1 -1
14345 56
345843 1
353319 1
1 1
353323 1
345143 1
1 1
353361 5
353347 1
353361 5
353071 1
1 1
353361 5
176023 1
343219 1
353361 5
353331 1
348501 1
334676 1
282340 1
1 1
366181 4
365504 1
1 1
362044 1
355654 1
401509 1
402889 3
402889 4
1 1
1 1
402885 1
402889 4
301405 1
402889 4
1 1
402799 1
4...

result:

ok ok

Test #139:

score: 20
Accepted
time: 349ms
memory: 20380kb

input:

300000
- 975964420 441089971
? 173532901
+ 2526 60
+ 1629 60
+ 648764 5
+ 309875 7
? 648895
? 1
+ 7362 60
? 6065
+ 4903 60
+ 16288 59
+ 3172 60
+ 6482 60
+ 297347 7
+ 11434 60
? 1
+ 11534 60
+ 48535 51
+ 538 60
? 8
? 92776
+ 654084 5
+ 2343 60
+ 1418 60
+ 20645 56
+ 67023 38
+ 13676 59
? 2113
+ 1350...

output:

-1 -1
1 1
648764 5
642704 1
648764 5
648761 1
555993 1
651976 1
1 1
1 1
744862 1
747039 1
1 1
1 1
378678 1
1 1
781354 4
781354 4
781354 4
764304 1
389104 1
781345 1
1 1
781354 4
781352 4
781354 4
1 1
1 1
681423 1
795639 1
795661 4
785538 1
1 1
1 1
595516 1
795661 3
794825 1
795661 4
795552 1
795192 ...

result:

ok ok

Test #140:

score: 20
Accepted
time: 333ms
memory: 25432kb

input:

300000
? 339238542410440219
? 77188267
- 73621069 262089016
- 792139116 29810824
- 899039694 531714575
+ 51767 51
+ 32877 56
+ 261352 6
+ 18582 59
+ 486369 5
? 15695
+ 43237 51
+ 652802 4
+ 4621 60
? 93299
+ 675944 4
+ 345722 6
? 3
+ 19738 59
? 338152
+ 47327 51
+ 661409 4
+ 15056 59
+ 27287 56
+ 31...

output:

-1 -1
-1 -1
470679 1
559507 1
675942 4
337811 1
675944 4
675749 1
674899 1
675942 4
675839 1
1 1
873965 1
869049 1
806815 1
1 1
1 1
862138 1
874000 1
874084 1
857608 1
748942 1
874028 1
870275 1
873926 1
874133 4
819301 1
874105 1
874133 4
843873 1
874111 1
835980 1
1 1
882626 4
882626 3
1 1
882626 ...

result:

ok ok

Test #141:

score: 20
Accepted
time: 318ms
memory: 25052kb

input:

300000
+ 25980 56
+ 243774 14
+ 23033 59
? 2
+ 488109 10
+ 13983 60
? 1
+ 357652 12
+ 12622 60
+ 23393 59
+ 40935 56
+ 6168 60
? 44414
+ 9561 60
? 34901
+ 119290 40
+ 3684 60
? 1
? 2
+ 691203 7
+ 75735 51
+ 238604 14
+ 19069 59
+ 69525 51
+ 929209 4
+ 6903 60
+ 254833 13
+ 12870 60
+ 104254 40
+ 198...

output:

243774 13
488109 10
443705 1
453218 1
243774 36
243773 36
929140 1
1 1
1 1
929209 4
1 1
743008 1
923006 1
742935 1
742885 1
1 1
1 1
929209 4
929206 1
928752 1
1 1
929096 1
742697 1
929097 1
1 1
929209 3
929207 1
928931 1
1 1
929194 1
1 1
929209 4
1 1
1 1
1 1
911599 1
795824 1
929199 1
1 1
929209 3
1...

result:

ok ok

Test #142:

score: 20
Accepted
time: 422ms
memory: 22028kb

input:

300000
- 1 999999989
? 704297131123020441
+ 935 182
? 31
? 1116
? 372
? 62
+ 907 188
? 652
? 163
- 428 10
? 8
? 1304
? 2
? 1
? 652
? 4
+ 816 923
- 896 559
- 137 826
? 62
- 750 104
? 2108
- 784 80
? 68
? 31
+ 118 248
+ 206 827
? 3183
? 3
? 1061
? 3
? 1
+ 309 91
? 3274
? 1637
? 1
- 113 209
- 257 243
+...

output:

-1 -1
931 156
1 1
745 1
931 125
653 1
816 299
903 357
1 1
907 359
907 360
643 1
907 357
777 435
1 1
761 308
810 249
1 1
118 2366
1 1443
118 2366
118 2368
1 1
1 1028
118 2459
1 3092
1 1773
136 3425
1 3609
93 3879
74 3854
1 1
112 3989
1 1796
111 3989
1 1
111 3989
1 1
112 3989
1 1
111 3989
87 4338
1 48...

result:

ok ok

Test #143:

score: 20
Accepted
time: 389ms
memory: 25388kb

input:

300000
- 840910658 646975162
? 300831414
+ 417 30
+ 12038 26
+ 5022 30
+ 93280 4
+ 143707 3
+ 5637 29
+ 108265 4
+ 79501 5
+ 1361 30
+ 84545 5
+ 6739 29
+ 7219 29
? 28786
+ 9198 26
+ 2959 30
+ 4594 30
? 36004
+ 85923 5
+ 94819 4
+ 4582 30
+ 2938 30
+ 1929 30
+ 45374 6
? 144121
+ 502 30
+ 67697 5
+ 4...

output:

-1 -1
114924 1
107710 1
1 1
153031 3
152914 1
153030 3
1 1
76040 1
1 1
122220 1
156307 3
156307 3
156307 3
143164 1
124742 1
156203 1
153327 1
156307 3
124704 1
1 1
1 1
150858 1
156307 3
1 1
124686 1
1 1
1 1
156307 3
156284 1
1 1
156307 3
156307 1
156307 3
156307 3
156300 1
156307 3
1 1
1 1
160339 1...

result:

ok ok

Test #144:

score: 20
Accepted
time: 362ms
memory: 25252kb

input:

300000
? 658996203837331784
- 736446623 575830990
- 395743741 984081197
- 149406046 268841679
- 448816013 39661207
- 918448238 739224716
- 30300241 304487231
- 552197068 220736529
+ 14039 28
+ 174716 5
? 4
+ 30236 25
+ 16088 28
? 174801
+ 101470 6
? 19423
? 174807
+ 19796 25
? 174832
+ 5917 30
? 125...

output:

-1 -1
174713 5
1 1
155298 1
1 1
1 1
173463 1
306286 3
1 1
1 1
306286 3
1 1
1 1
152898 1
306126 1
1 1
152733 1
1 1
244863 1
306014 1
306286 3
306276 1
255075 1
1 1
1 1
313566 1
1 1
313566 3
313566 3
1 1
1 1
311790 1
313566 3
313552 1
313162 1
284935 1
234828 1
313565 3
1 1
313565 1
1 1
313564 1
25056...

result:

ok ok

Test #145:

score: 20
Accepted
time: 350ms
memory: 22464kb

input:

300000
+ 119601 8
? 29902
+ 8718 30
+ 423661 3
+ 354294 4
+ 198618 6
+ 7350 30
+ 385290 4
? 423745
+ 29840 26
+ 18717 29
+ 11343 30
+ 371223 4
+ 18263 29
+ 6884 30
+ 196702 7
+ 18701 29
+ 16789 29
+ 462861 3
+ 21605 26
? 4099
+ 199818 6
+ 66392 20
+ 30085 26
+ 467761 3
? 46
+ 33370 26
+ 37575 26
? 3...

output:

89707 1
1 1
458765 1
467718 1
464190 1
456878 1
1 1
467761 3
374062 1
1 1
1 1
1 1
467760 3
467760 1
431689 1
1 1
467761 1
467760 3
1 1
1 1
1 1
467761 3
467761 3
1 1
467761 3
467761 1
1 1
467760 3
465140 1
467723 1
467406 1
1 1
232988 1
467442 1
467761 3
373834 1
467761 3
1 1
1 1
466373 1
1 1
415537 ...

result:

ok ok

Test #146:

score: 20
Accepted
time: 325ms
memory: 24696kb

input:

300000
+ 8649 30
+ 592513 3
+ 85456 19
? 4
+ 471722 4
+ 17022 30
+ 58420 25
+ 452552 4
+ 13292 30
+ 681889 3
+ 344312 5
+ 1728 30
+ 70516 19
? 136418
? 1
? 2
+ 10958 30
+ 18081 30
+ 656969 3
+ 255574 5
+ 14234 30
+ 284980 5
+ 242003 6
+ 136053 6
+ 1282 30
? 136447
+ 16108 30
+ 79024 19
+ 103780 19
+...

output:

592512 1
545477 1
681889 3
681888 3
545451 1
681889 3
684157 3
684157 1
455840 1
1 1
684157 3
1 1
693257 3
1 1
554349 1
693257 3
693257 3
693251 1
461680 1
1 1
693241 1
554312 1
693257 3
1 1
643634 1
577444 1
693254 1
693230 1
691729 1
692997 1
692379 1
693256 3
1 1
693257 3
461501 1
692973 1
678151...

result:

ok ok

Test #147:

score: 20
Accepted
time: 308ms
memory: 25120kb

input:

300000
? 663551583760370959
? 466111466
+ 469874 5
+ 344495 7
+ 530568 4
+ 168656 10
+ 256005 8
+ 9458 30
+ 32330 29
+ 143981 10
? 10830
? 75810
+ 8444 30
+ 208949 9
? 3
+ 21149 30
+ 57624 26
+ 30840 29
+ 19968 30
+ 2612 30
? 530854
+ 46284 26
+ 10702 30
+ 81209 21
+ 6673 30
+ 472136 5
+ 7054 30
+ 2...

output:

-1 -1
-1 -1
519742 1
454767 1
530566 4
1 1
520917 1
530566 4
353555 1
535290 1
536454 4
536454 4
469273 1
1 1
536306 1
1 1
536454 4
267530 1
504822 1
1 1
1 1
577504 1
591607 3
1 1
552026 1
1 1
591379 1
591608 3
591608 3
590595 1
537613 1
1 1
591608 3
591608 3
577468 1
1 1
591608 3
549166 1
591608 3
...

result:

ok ok

Test #148:

score: 20
Accepted
time: 356ms
memory: 25972kb

input:

300000
? 631393154942236892
- 681662341 6533446
+ 10495 12
? 1
? 309
? 6
+ 16045 11
+ 137428 4
+ 9429 12
? 6
+ 60217 5
+ 1832 12
+ 36197 9
+ 128275 4
+ 18113 11
+ 175831 4
+ 166822 4
? 87959
+ 70153 5
+ 130624 4
+ 13438 12
? 175939
? 1
+ 33101 9
+ 133765 4
+ 12389 12
? 43991
+ 9521 12
+ 6842 12
+ 10...

output:

-1 -1
10495 12
10198 1
10495 7
137426 1
87888 1
1 1
175831 4
131856 1
1 1
175831 4
175831 4
1 1
175831 4
1 1
175831 4
175831 4
175822 1
1 1
1 1
177586 4
1 1
177586 4
152166 1
177165 1
177577 1
177586 4
177530 1
177586 4
155334 1
177586 1
177586 4
177586 3
177579 1
177586 4
1 1
177586 4
177586 3
1775...

result:

ok ok

Test #149:

score: 20
Accepted
time: 349ms
memory: 22652kb

input:

300000
+ 208265 3
+ 8470 12
? 1
+ 50465 3
+ 6148 12
+ 220765 3
+ 13088 12
+ 17183 12
+ 28555 8
? 31547
+ 35825 8
? 220837
+ 216095 3
+ 581 12
+ 104485 3
+ 12770 12
+ 207165 3
+ 198425 3
+ 6955 12
+ 68655 3
+ 24686 11
+ 16318 12
? 1
? 220911
? 73637
+ 28620 8
+ 146335 3
+ 12171 12
+ 5624 12
+ 13197 1...

output:

208265 3
189224 1
1 1
220765 3
1 1
147143 1
110304 1
220765 3
1 1
218580 1
220765 3
223805 3
234115 3
234114 3
234112 1
234115 3
231149 1
1 1
233763 1
208059 1
1 1
234515 3
234481 1
228166 1
233004 1
234515 3
1 1
234515 3
234515 3
1 1
1 1
240095 3
159817 1
1 1
240013 1
239089 1
240095 3
240095 3
240...

result:

ok ok

Test #150:

score: 20
Accepted
time: 354ms
memory: 28508kb

input:

300000
? 123628508893739885
- 438898647 28291323
? 615247541733955800
- 728223047 528230081
+ 10840 12
+ 352 12
+ 129346 5
+ 21006 12
+ 240066 4
+ 52590 9
+ 3346 12
+ 13207 12
+ 19207 12
+ 128826 5
+ 21952 11
? 1
+ 244251 4
+ 54034 9
+ 227673 4
+ 218016 4
+ 95698 5
+ 6255 12
? 244394
+ 111554 5
+ 34...

output:

-1 -1
-1 -1
240066 4
1 1
243809 1
122068 1
244251 4
1 1
244242 1
244249 4
1 1
244251 4
251387 1
240025 1
251460 4
251460 4
251385 1
1 1
248277 1
251460 4
251460 3
251331 1
125506 1
251458 4
238214 1
1 1
251460 4
209463 1
251460 4
125457 1
251363 1
251396 1
251460 4
251460 4
167411 1
250904 5
1 1
251...

result:

ok ok

Test #151:

score: 20
Accepted
time: 342ms
memory: 25948kb

input:

300000
? 858506833
- 786740664 312640737
- 357980337 491480577
- 113319661 832180375
- 721005357 52864178
? 660801395
+ 33264 11
+ 76750 3
+ 314910 3
+ 4901 12
+ 44480 8
+ 131060 3
+ 27802 11
+ 55725 8
+ 241830 3
+ 58375 8
+ 5760 12
+ 26129 12
? 533
+ 238800 3
+ 242790 3
+ 264530 3
+ 287980 3
+ 4380...

output:

-1 -1
-1 -1
314380 1
314910 3
314875 1
314894 1
1 1
327472 1
218473 1
327719 1
280908 1
327740 3
305882 1
1 1
218407 1
327740 3
1 1
327726 1
1 1
280861 1
1 1
1 1
163620 1
327740 3
327740 3
1 1
327740 3
1 1
1 1
1 1
1 1
262031 1
327472 1
1 1
326657 1
327740 1
297866 1
323114 1
320896 1
245528 1
318857...

result:

ok ok

Test #152:

score: 20
Accepted
time: 336ms
memory: 25472kb

input:

300000
? 773885330114617378
- 658059421 480206
? 549911106674941957
? 814864574
+ 286122 3
+ 304842 3
+ 37805 11
+ 5109 12
+ 77302 8
? 17934
+ 16320 12
+ 57372 8
+ 18596 12
+ 141302 3
+ 277992 3
+ 18265 12
? 76232
+ 37069 11
? 304939
+ 286182 3
+ 3682 12
+ 338072 3
+ 38255 11
? 238
+ 258582 3
+ 1562...

output:

-1 -1
-1 -1
-1 -1
286911 1
228619 1
1 1
337837 1
1 1
338072 3
338072 3
338072 3
338071 3
168967 1
338072 3
1 1
253513 1
1 1
225310 1
342352 3
273818 1
330929 1
342340 1
342350 1
342342 1
304261 1
1 1
337459 1
1 1
322184 1
1 1
342345 1
342351 3
330533 1
228057 1
342352 1
342348 1
1 1
170868 1
1 1
338...

result:

ok ok

Test #153:

score: 20
Accepted
time: 333ms
memory: 28416kb

input:

300000
- 260405063 59476117
- 177718174 168227675
? 88895911554449942
- 73651820 448392773
- 968265391 197933984
- 564207078 451485370
- 872057880 34569578
- 233396441 719571208
- 104632024 899052946
+ 19546 12
+ 11131 12
+ 110835 3
? 1
+ 18183 12
? 329
? 47
+ 10114 12
? 110885
+ 47241 11
? 110896
+...

output:

-1 -1
110835 3
110509 1
110791 1
1 1
1 1
252365 3
1 1
252364 1
238904 1
318585 3
295819 1
159203 1
1 1
159185 1
309478 1
318585 3
1 1
341522 1
1 1
398504 3
398445 1
398505 3
388007 1
398504 3
398505 3
398494 1
398505 3
1 1
391626 1
318681 1
1 1
398502 1
1 1
398504 3
198917 1
398505 3
1 1
398504 3
39...

result:

ok ok

Test #154:

score: 20
Accepted
time: 369ms
memory: 25264kb

input:

300000
- 275479 147288
+ 796669 566260
+ 483999 142413
- 669157 262277
+ 429327 909037
+ 686535 71588
+ 195392 469735
+ 447542 382724
+ 795704 926996
+ 818640 564078
+ 155426 635333
- 303463 450615
- 161614 7518
+ 253037 828185
- 10213 495287
+ 849010 37141
+ 304330 442365
+ 194500 843198
- 810307 4...

output:

1 18942631212
1 18939785600
1 18942868344
1 18942788460
1 18651431450
1 18941682676
1 18942868340
1 1
1 18942868332
1 18927454679
1 17485691768
1 18942862200
1 18942867116
1 18942868280
1 18942868344
1 15154218996
1 1
1 18942868344
1 18942788460
1 1
1 18942867116
1 1
1 18942631212
1 18942852368
1 1
...

result:

ok ok

Extra Test:

score: 0
Extra Test Passed