QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#201449#6537. One, Two, Threeucup-team1209#AC ✓366ms27016kbC++203.1kb2023-10-05 14:24:462023-10-05 14:24:47

Judging History

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

  • [2023-10-05 14:24:47]
  • 评测
  • 测评结果:AC
  • 用时:366ms
  • 内存:27016kb
  • [2023-10-05 14:24:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,y,x) for (int i=(y);i>=(x);i--)
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
template<typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template<typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}
void file() {
    #ifdef zqj
    freopen("a.in","r",stdin);
    #endif
}
typedef long long ll;
#define sz 666666

int n;
int a[sz];

vector<array<int,3>>ANS;
pii b[sz]; int pos[sz];
int check(int w,int getans=0) {
    rep(i,1,n) pos[i]=0;
    int cc=0;
    rep(i,1,n) if (a[i]!=2) {
        ++cc; b[cc].sec=i; pos[i]=cc;
        if (cc==w) break;
    }
    drep(i,n,1) if (a[i]!=2) {
        b[cc].fir=i; --cc;
        if (!cc) break;
    }
    priority_queue<pii,vector<pii>,greater<pii>>q;
    vector<array<int,3>>V[4][4];
    int res=0;
    rep(i,1,n) {
        if (a[i]==2) {
            while (q.size()&&q.top().fir<i) q.pop();
            if (q.size()) {
                auto [y,x]=q.top(); q.pop();
                V[a[x]][a[y]].push_back({x,i,y});
                ++res;
            }
        }
        else if (pos[i]) q.push(b[pos[i]]);
    }
    if (res!=w) return 0;
    if (!getans) return 1;
    ANS.clear();
    for (auto p:V[1][3]) ANS.push_back(p);
    for (auto p:V[3][1]) ANS.push_back(p);
    rep(t,0,(int)min(V[1][1].size(),V[3][3].size())-1) {
        vector<int>v;
        rep(i,0,2) v.push_back(V[1][1][t][i]),v.push_back(V[3][3][t][i]);
        sort(v.begin(),v.end());
        rep(_x,0,3) rep(_y,_x+1,4) rep(_z,_y+1,5) {
            int x=v[_x],y=v[_y],z=v[_z];
            if (a[x]==2||a[y]!=2||a[z]==2||a[x]==a[z]) continue;
            vector<int>vv;
            rep(i,0,5) if (i!=_x&&i!=_y&&i!=_z) vv.push_back(v[i]);
            if (a[vv[0]]==2||a[vv[1]]!=2||a[vv[2]]==2||a[vv[0]]==a[vv[2]]) continue;
            ANS.push_back({x,y,z});
            ANS.push_back({vv[0],vv[1],vv[2]});
            goto END;
        }
        END:;
    }
    static int vis[sz];
    for (auto [x,y,z]:ANS) vis[x]=vis[y]=vis[z]=1;
    int up=1; if (V[3][3].size()>V[1][1].size()) up=3;
    vector<int>v;
    rep(i,1,n) if (!vis[i]&&a[i]!=2&&a[i]!=up) v.push_back(i);
    rep(t,(int)min(V[1][1].size(),V[3][3].size()),(int)V[up][up].size()-1) {
        auto [x,y,z]=V[up][up][t];
        int w=v.back(); v.pop_back();
        if (w<y) ANS.push_back({w,y,z});
        else ANS.push_back({x,y,w});
    }
    return 1;
}

int main() {
    file();
    cin>>n;
    static int cc[3];
    rep(i,1,n) cin>>a[i];
    std::mt19937 gen(time(0)+(size_t) new char);
    // rep(i,1,n) a[i]=gen()%3+1;
    rep(i,1,n)++cc[a[i]-1];
    int l=0,r=min({cc[0],cc[1],cc[2]}),ans=0;
    while (l<=r) {
        int m=(l+r)>>1;
        if (check(m)) ans=m,l=m+1;
        else r=m-1;
    }
    check(ans,1);
    cout<<ans<<'\n';
    static int vis[sz];
    assert(ans==ANS.size());
    for (auto [x,y,z]:ANS) cout<<x-1<<' '<<y-1<<' '<<z-1<<'\n',assert(a[y]==2&&a[x]!=2&&a[z]!=2&&a[x]!=a[z]&&x<y&&y<z),++vis[x],++vis[y],++vis[z];
    rep(i,1,n) assert(vis[i]<=1);
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 11848kb

input:

6
3 1 2 2 3 1

output:

2
0 2 5
1 3 4

result:

ok count=2

Test #2:

score: 0
Accepted
time: 0ms
memory: 12068kb

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

score: 0
Accepted
time: 0ms
memory: 12112kb

input:

3000
1 1 1 1 1 3 1 1 3 3 1 3 1 1 2 3 1 1 2 1 2 1 3 3 3 1 1 2 1 2 2 3 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 3 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 3 3 2 1 3 1 1 2 3 1 2 3 1 1 1 2 1 1 1 1 2 3 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 3 1 3 3 1 1 1 1 3 1 1 2 1 1 1 3 3 1 1 1 1 2 1 1 1 1 1 2 3 3 1...

output:

499
3 27 2420
6 39 2425
7 46 2426
17 92 2437
34 176 2451
35 181 2452
36 188 2453
58 281 2472
62 291 2475
63 296 2476
65 311 2478
68 314 2480
118 578 2527
121 597 2531
134 641 2544
135 643 2545
136 645 2546
140 669 2549
147 707 2558
154 742 2566
156 762 2568
159 768 2572
161 774 2574
165 788 2577
173...

result:

ok count=499

Test #4:

score: 0
Accepted
time: 0ms
memory: 11836kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1
0 1374 2901

result:

ok count=1

Test #5:

score: 0
Accepted
time: 2ms
memory: 11864kb

input:

3000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
1755 1756 2819

result:

ok count=1

Test #6:

score: 0
Accepted
time: 0ms
memory: 12024kb

input:

1500
1 1 1 2 1 1 1 2 2 2 2 2 1 1 3 1 2 2 3 1 2 2 2 2 1 2 1 2 1 1 3 1 2 2 2 2 1 1 3 1 1 2 2 3 2 1 3 1 1 2 2 2 1 2 2 2 2 2 1 2 3 2 3 2 3 2 1 3 2 1 2 3 2 2 3 2 3 1 1 3 1 3 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 1 3 1 1 1 1 1 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 1 3 1...

output:

500
1 7 542
4 9 544
5 10 545
12 16 547
15 21 550
26 27 554
31 35 558
36 41 559
40 50 563
58 59 570
69 72 577
77 450 581
78 490 582
80 583 601
86 589 607
90 593 611
97 618 619
98 620 728
99 621 729
103 625 733
106 628 739
113 635 746
114 636 747
115 637 748
124 646 757
125 647 758
137 659 770
143 665...

result:

ok count=500

Test #7:

score: 0
Accepted
time: 0ms
memory: 11964kb

input:

3000
3 1 1 1 1 3 3 2 1 1 1 2 3 1 3 3 3 3 1 1 3 1 3 3 1 1 1 1 1 3 3 1 1 1 1 3 1 3 1 1 3 3 3 3 1 3 1 3 1 3 1 3 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 3 1 1 1 1 3 1 1 1 3 3 1 2 3 3 1 3 3 3 3 3 3 3 1 1 1 1 3 1 3 1 3 3 3 3 1 3 1 1 3 3 1 1 1 3 3 1 3 3 1 3 1 3 1 3 2 3 1 3 1 1 3 1 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2...

output:

1000
1 11 1888
3 122 1890
8 141 1894
9 142 1895
21 153 1907
25 157 1911
27 159 1913
31 163 1917
33 165 1919
34 166 1920
36 168 1922
46 178 1932
53 185 1939
61 193 1947
68 200 1954
73 205 1959
74 206 1960
75 207 1961
82 213 1967
90 221 1975
91 222 1976
92 223 1977
95 226 1980
97 228 1982
102 233 1987...

result:

ok count=1000

Test #8:

score: 0
Accepted
time: 0ms
memory: 11900kb

input:

3000
1 3 1 1 3 1 1 1 1 3 1 1 3 1 1 1 3 3 3 3 3 1 1 3 1 1 3 1 3 3 1 2 2 3 1 3 3 3 1 3 3 2 3 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 3 1 1 1 1 3 1 1 1 3 1 1 1 1 1 3 3 3 3 3 1 3 3 3 1 1 1 3 1 1 3 1 1 3 1 3 3 3 1 1 1 3 3 3 3 3 1 1 1...

output:

1000
0 31 1618
2 41 1620
7 55 1625
8 56 1626
10 58 1628
11 59 1629
13 61 1631
14 62 1632
15 63 1633
43 88 1658
47 92 1662
48 93 1663
96 183 1667
101 203 1672
103 205 1674
106 208 1677
107 209 1678
111 213 1682
113 215 1684
119 221 1690
125 227 1696
131 233 1702
133 235 1704
137 239 1708
138 240 1709...

result:

ok count=1000

Test #9:

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

input:

2997
3 1 2 2 1 1 1 1 1 1 3 1 3 3 1 3 3 3 1 3 1 2 1 1 3 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 1 1 3 1 3 1 1 3 3 1 3 1 3 3 3 1 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 1 3 1 1 1 1 1 3 3 3 1 3 1 1 3 3 3 1 3 3 1 1 1 3 1 1 3 1 1 3 2 3 3 3 2 3 2 3 1 2 1 1 3 1 1 3 2 2 2 2...

output:

999
6 27 1219
8 31 1221
11 34 1224
14 37 1227
18 41 1231
22 44 1234
23 45 1235
25 47 1237
56 79 1246
59 82 1249
62 85 1252
64 87 1254
69 92 1259
70 93 1260
98 134 1265
100 144 1267
101 145 1268
102 146 1269
103 147 1270
108 152 1275
110 154 1277
118 162 1285
120 164 1287
122 166 1289
123 167 1290
12...

result:

ok count=999

Test #10:

score: 0
Accepted
time: 3ms
memory: 11916kb

input:

2994
1 1 2 1 2 1 2 2 3 1 3 3 3 3 1 3 1 1 2 3 3 1 3 3 3 3 1 1 1 3 3 2 3 1 3 1 3 3 1 2 3 1 3 3 3 1 3 1 3 2 3 2 1 1 3 1 1 1 3 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 2 3 3 3 3 3 3 1 3 1 3 1 1 2 1 3 3 3 2 2 3 2 1 3 3 3 1 2 1 1 2 3 3 1 3 2 2 2 2 2 2 2 2...

output:

998
0 2 1925
3 6 1927
5 7 1928
9 31 1930
16 63 1937
21 67 1941
33 78 1952
35 80 1954
38 83 1957
41 85 1959
45 89 1963
47 91 1965
55 97 1971
57 99 1973
114 144 1987
116 146 1989
117 147 1990
119 148 1991
127 153 1996
131 157 2000
133 158 2001
134 159 2002
164 179 2007
167 202 2010
173 208 2016
181 21...

result:

ok count=998

Test #11:

score: 0
Accepted
time: 0ms
memory: 11912kb

input:

3000
1 1 1 3 2 3 2 3 1 1 1 1 2 3 1 2 1 2 1 3 3 2 2 3 3 2 3 2 2 3 3 3 3 3 1 3 2 1 2 3 2 3 3 3 2 1 3 3 3 2 1 1 1 1 2 1 3 1 3 2 2 2 1 2 3 3 3 2 1 3 1 3 2 3 1 3 2 3 3 1 2 1 2 2 3 1 3 2 2 1 1 2 3 1 1 3 1 3 2 2 3 2 2 1 3 2 2 2 3 3 2 3 1 2 2 1 1 1 2 3 2 1 3 2 1 1 1 3 3 1 3 1 3 2 2 1 1 1 1 2 1 2 3 1 2 1 2 2...

output:

1000
1 6 1501
8 22 1508
9 25 1509
10 27 1510
18 44 1517
37 87 1537
51 110 1558
57 123 1564
62 134 1566
74 156 1578
85 183 1586
89 190 1590
93 195 1594
96 199 1598
112 215 1611
116 220 1613
121 227 1616
125 237 1620
129 246 1626
131 258 1628
135 263 1631
137 267 1634
138 268 1635
140 269 1637
143 277...

result:

ok count=1000

Test #12:

score: 0
Accepted
time: 0ms
memory: 11896kb

input:

3000
2 2 1 3 2 2 2 3 2 2 2 2 2 1 2 2 2 2 2 1 3 2 2 2 2 3 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 1 2 3 2 3 1 2 2 3 2 3 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 3 2 2 1 2 3 2 1 3 3 2 3 2 2 2 3 1 2 2 2 2 1 2 3 3 1 2 1 1 2 2 2 1 2 2 2 2 2 2 1 2 3 1 2 1 2 2 3 2 2 2 2 2 2 2 2 2 3 1 2 2 2 2 3 2 3 3 1 2 2 1 2...

output:

673
2 4 1672
13 14 1675
32 34 1679
49 50 1683
73 74 1690
79 80 1692
83 86 1694
97 98 1700
101 106 1703
103 107 1704
104 109 1705
108 110 1706
118 121 1709
134 136 1713
150 153 1719
158 159 1723
160 161 1724
181 182 1728
185 190 1730
196 199 1736
222 225 1744
232 233 1746
245 248 1747
273 274 1760
27...

result:

ok count=673

Test #13:

score: 0
Accepted
time: 0ms
memory: 11956kb

input:

2999
2 2 3 3 2 1 2 1 1 2 2 3 2 3 2 3 2 2 2 1 2 3 2 2 2 2 1 3 2 3 3 2 1 2 3 2 2 2 2 1 2 2 2 2 2 3 2 2 3 1 2 2 2 3 2 2 2 3 3 2 2 2 3 3 3 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 3 2 2 3 3 3 1 1 2 2 3 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 3 3 1 1 2 2 2 2 1 1 2 2 3 2 3 2 3 2 2 2 3 2 2 2 1 2 1 3 2 3 2 2 2 1...

output:

683
5 9 1646
7 10 1647
19 20 1652
26 28 1654
32 36 1658
39 40 1660
49 51 1663
66 70 1670
67 72 1671
74 76 1673
75 77 1674
81 82 1675
92 98 1681
99 101 1683
108 109 1684
112 113 1685
138 139 1696
147 149 1700
148 150 1701
158 159 1704
168 172 1705
171 177 1708
195 196 1714
218 222 1721
219 223 1722
2...

result:

ok count=683

Test #14:

score: 0
Accepted
time: 3ms
memory: 11848kb

input:

2998
2 1 2 1 3 2 2 2 2 2 2 2 1 2 2 2 2 3 3 2 1 2 1 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 3 1 3 2 2 1 2 2 2 3 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 3 2 1 2 3 2 2 3 3 2 2 2 2 1 2 1 2 2 2 2 3 2 3 3 3 1 2 2 2 2 2 3 2 2 2 1 2 2 2 2 2 2 2 3 2 2 3 3 2 1 1 2 2 3 3 2 1 2 2 2 2 2 2 2 2 3 2 1 2 1 2 2 3 1 2 3 2 2 2 2...

output:

629
3 5 1683
20 23 1688
47 50 1696
117 120 1717
118 123 1718
135 136 1723
137 138 1724
154 156 1730
158 159 1731
167 169 1733
168 170 1734
174 175 1735
176 177 1736
187 188 1738
229 230 1751
232 233 1752
237 238 1753
243 244 1754
281 282 1767
294 296 1768
305 307 1774
343 348 1787
344 349 1788
355 3...

result:

ok count=629

Test #15:

score: 0
Accepted
time: 2ms
memory: 11848kb

input:

2997
1 1 3 2 3 3 2 2 1 2 2 2 2 2 2 1 3 3 2 2 2 3 2 2 2 2 3 2 1 3 2 3 2 3 2 3 3 2 2 2 2 2 2 2 1 1 2 2 3 3 2 1 2 2 3 3 2 2 1 1 1 2 1 2 1 2 2 1 2 1 3 1 3 3 1 2 2 2 2 2 2 1 2 2 2 3 2 2 3 2 2 1 2 2 3 2 1 2 2 2 3 2 2 1 3 1 2 2 2 1 3 2 2 1 2 3 2 3 1 3 2 2 3 2 2 2 2 1 2 2 2 1 1 2 3 2 2 2 3 2 3 1 2 2 3 2 2 2...

output:

712
0 3 1641
28 30 1652
44 46 1658
45 47 1659
51 53 1662
58 61 1665
60 65 1667
62 66 1668
64 68 1669
71 78 1673
74 82 1676
81 83 1677
91 92 1680
96 97 1682
103 106 1684
113 114 1689
127 128 1695
164 165 1705
187 189 1713
200 203 1718
201 204 1719
221 222 1726
239 241 1732
275 282 1746
278 287 1749
2...

result:

ok count=712

Test #16:

score: 0
Accepted
time: 2ms
memory: 11920kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1000
0 1000 2000
1 1001 2001
2 1002 2002
3 1003 2003
4 1004 2004
5 1005 2005
6 1006 2006
7 1007 2007
8 1008 2008
9 1009 2009
10 1010 2010
11 1011 2011
12 1012 2012
13 1013 2013
14 1014 2014
15 1015 2015
16 1016 2016
17 1017 2017
18 1018 2018
19 1019 2019
20 1020 2020
21 1021 2021
22 1022 2022
23 102...

result:

ok count=1000

Test #17:

score: 0
Accepted
time: 3ms
memory: 13892kb

input:

3000
1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
0 2 2999

result:

ok count=1

Test #18:

score: 0
Accepted
time: 0ms
memory: 12052kb

input:

15
2 3 3 2 1 3 2 1 1 1 3 2 3 1 2

output:

3
1 3 4
10 11 13
2 6 9

result:

ok count=3

Test #19:

score: 0
Accepted
time: 2ms
memory: 11796kb

input:

18
3 3 3 1 1 3 2 2 1 2 1 2 3 2 2 1 3 1

output:

6
4 13 16
0 6 8
1 7 10
5 14 17
2 9 15
3 11 12

result:

ok count=6

Test #20:

score: 0
Accepted
time: 2ms
memory: 11864kb

input:

16
1 3 3 2 1 3 1 2 2 2 3 1 3 2 1 2

output:

5
4 9 12
2 8 11
5 13 14
0 7 10
1 3 6

result:

ok count=5

Test #21:

score: 0
Accepted
time: 0ms
memory: 11900kb

input:

15
1 3 1 2 3 2 3 3 2 1 2 2 1 1 3

output:

5
0 3 7
1 5 9
4 10 13
2 8 14
6 11 12

result:

ok count=5

Test #22:

score: 0
Accepted
time: 2ms
memory: 12052kb

input:

18
1 3 1 3 2 1 1 3 2 2 2 3 2 3 2 1 1 3

output:

6
0 4 7
2 9 13
6 14 17
3 10 15
1 12 16
5 8 11

result:

ok count=6

Test #23:

score: 0
Accepted
time: 0ms
memory: 12056kb

input:

18
1 3 3 2 1 1 1 2 3 2 1 1 2 3 2 3 2 3

output:

6
0 3 8
4 12 13
5 14 15
6 16 17
1 7 10
2 9 11

result:

ok count=6

Test #24:

score: 0
Accepted
time: 2ms
memory: 11904kb

input:

18
1 2 1 2 3 2 3 3 2 2 3 1 1 3 3 1 2 1

output:

6
7 9 15
10 16 17
0 1 13
4 5 11
2 3 14
6 8 12

result:

ok count=6

Test #25:

score: 0
Accepted
time: 0ms
memory: 11836kb

input:

15
1 2 1 2 3 3 1 1 1 2 3 2 3 2 3

output:

5
6 13 14
0 1 4
7 9 10
2 3 5
8 11 12

result:

ok count=5

Test #26:

score: 0
Accepted
time: 2ms
memory: 11864kb

input:

18
3 2 1 2 1 3 3 1 1 3 2 1 2 3 2 1 2 3

output:

6
2 3 9
7 16 17
0 1 8
6 14 15
4 12 13
5 10 11

result:

ok count=6

Test #27:

score: 0
Accepted
time: 0ms
memory: 11900kb

input:

15
1 2 3 2 3 3 3 1 3 2 1 2 1 2 1

output:

5
4 9 10
5 11 12
6 13 14
0 1 8
2 3 7

result:

ok count=5

Test #28:

score: 0
Accepted
time: 2ms
memory: 11828kb

input:

18
2 1 2 2 2 2 1 3 1 3 3 3 2 2 2 2 3 2

output:

2
1 2 11
6 12 16

result:

ok count=2

Test #29:

score: 0
Accepted
time: 0ms
memory: 11904kb

input:

17
1 2 2 2 2 1 1 1 1 3 2 2 1 2 1 2 2

output:

1
0 1 9

result:

ok count=1

Test #30:

score: 0
Accepted
time: 2ms
memory: 11816kb

input:

16
1 2 2 2 2 3 3 1 3 3 2 2 2 2 3 2

output:

2
0 1 9
7 10 14

result:

ok count=2

Test #31:

score: 0
Accepted
time: 2ms
memory: 11832kb

input:

18
1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3

output:

5
0 5 13
1 6 14
2 7 15
3 8 16
4 9 17

result:

ok count=5

Test #32:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

6
1 2 3 2 3 1

output:

2
0 1 4
2 3 5

result:

ok count=2

Test #33:

score: 0
Accepted
time: 0ms
memory: 11856kb

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

score: 0
Accepted
time: 2ms
memory: 11844kb

input:

6
3 1 2 2 3 1

output:

2
0 2 5
1 3 4

result:

ok count=2

Test #35:

score: 0
Accepted
time: 4ms
memory: 14140kb

input:

15000
2 1 3 1 1 2 3 1 3 1 1 1 3 2 2 2 1 3 2 3 3 3 3 2 1 1 2 2 1 1 1 1 1 1 3 3 3 3 3 1 3 1 2 1 1 1 1 1 2 1 2 1 2 1 3 3 3 3 3 2 2 1 1 2 3 3 3 2 3 2 1 2 1 1 1 1 1 3 2 3 2 1 1 2 1 1 1 1 3 2 1 2 1 1 2 1 2 1 2 1 3 3 2 3 2 3 1 2 1 3 3 1 2 2 3 1 2 3 2 3 3 1 1 1 3 3 2 2 2 2 2 1 3 3 3 2 2 1 2 1 3 3 3 3 2 2 1 ...

output:

4997
1 5 7467
7 23 7473
11 48 7479
25 78 7494
31 91 7502
32 94 7503
39 113 7514
41 118 7516
46 129 7520
61 165 7538
72 191 7548
73 193 7551
74 195 7552
82 214 7562
84 215 7563
85 217 7566
95 236 7579
97 237 7580
99 239 7581
115 259 7599
121 266 7605
131 279 7614
137 286 7620
153 309 7634
159 314 764...

result:

ok count=4997

Test #36:

score: 0
Accepted
time: 8ms
memory: 12060kb

input:

15000
3 1 3 3 2 1 1 3 1 2 2 3 1 2 1 2 1 2 1 1 2 2 1 2 3 2 3 2 3 3 1 1 2 1 2 2 3 3 3 2 3 2 1 1 3 2 2 3 1 2 1 3 1 3 1 3 2 1 1 1 3 3 2 2 3 3 1 2 3 2 3 2 2 2 1 2 3 2 2 1 1 3 3 2 1 3 3 3 2 2 1 1 3 1 3 2 2 3 3 1 2 2 2 3 1 1 2 1 1 1 1 1 2 2 1 2 1 3 3 3 3 3 2 3 1 1 1 1 1 1 2 1 1 2 3 2 1 3 3 3 2 1 1 3 2 1 1 ...

output:

4999
6 17 7478
8 21 7480
14 27 7483
19 35 7488
48 83 7511
50 88 7513
52 95 7516
58 106 7524
74 144 7537
84 168 7544
90 172 7551
93 181 7554
104 195 7562
105 200 7564
109 205 7568
110 207 7569
124 242 7580
127 257 7585
128 258 7587
129 269 7588
132 278 7592
145 299 7606
156 318 7615
159 352 7619
163 ...

result:

ok count=4999

Test #37:

score: 0
Accepted
time: 0ms
memory: 12088kb

input:

15000
1 2 1 3 2 3 2 3 2 3 3 1 3 3 1 1 3 1 2 3 1 1 3 2 1 2 1 2 1 1 2 1 1 1 3 3 1 2 3 3 3 1 3 3 2 1 3 3 3 3 1 3 2 3 3 1 3 2 3 1 3 3 1 2 2 2 1 3 3 2 3 2 3 3 2 3 2 1 1 3 2 3 3 1 1 1 3 1 3 1 2 1 3 2 2 1 2 1 2 3 3 1 1 2 1 1 3 3 3 3 1 1 2 2 3 1 2 1 3 1 1 3 2 3 1 2 1 3 1 1 3 3 3 1 3 3 3 1 2 2 2 1 2 1 3 2 3 ...

output:

4998
0 1 7470
2 4 7471
11 27 7481
14 44 7487
29 90 7500
31 93 7502
45 140 7518
59 170 7535
62 187 7539
66 189 7540
77 206 7554
83 226 7561
84 228 7564
85 231 7565
104 266 7581
117 293 7594
119 295 7597
120 296 7598
128 306 7605
137 329 7620
143 337 7624
162 370 7642
165 375 7644
172 382 7648
174 386...

result:

ok count=4998

Test #38:

score: 0
Accepted
time: 4ms
memory: 12048kb

input:

15000
1 2 1 1 1 2 3 1 2 3 3 3 2 2 1 2 1 3 3 2 3 2 1 1 2 3 3 1 1 2 1 3 2 3 1 1 2 2 2 1 3 1 2 3 3 2 2 1 2 3 3 2 2 2 2 3 3 3 2 3 3 2 1 2 3 3 1 3 3 1 1 3 3 3 2 3 2 1 3 1 1 2 1 3 1 2 1 1 2 1 2 3 2 2 3 3 2 2 1 3 3 2 3 1 2 2 3 3 2 3 1 3 1 1 3 1 3 3 1 3 1 2 2 2 1 3 1 3 2 2 2 2 3 2 1 2 2 3 3 1 2 3 1 1 3 1 2 ...

output:

5000
0 1 7454
7 15 7465
14 29 7470
16 32 7475
27 51 7490
28 52 7491
30 53 7492
34 61 7498
39 74 7501
41 81 7503
62 108 7520
69 130 7527
70 131 7528
77 146 7535
79 148 7538
82 156 7541
84 171 7546
86 175 7548
87 179 7550
89 186 7551
112 228 7574
113 233 7575
118 256 7581
120 258 7583
124 262 7584
134...

result:

ok count=5000

Test #39:

score: 0
Accepted
time: 3ms
memory: 12016kb

input:

15000
3 3 1 1 1 1 3 3 3 3 3 1 3 1 3 1 1 3 1 3 3 3 3 1 2 3 3 3 3 3 3 3 3 3 3 1 3 1 1 3 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 3 1 1 3 2 1 1 1 1 3 3 1 3 3 1 3 1 3 1 1 3 1 3 3 1 1 1 1 1 3 1 1 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 2 1 3 2 3 1 1 ...

output:

5000
3 43 5307
11 52 5315
13 54 5317
18 59 5322
38 78 5341
82 83 5345
89 149 5350
98 161 5359
100 163 5361
102 165 5363
103 166 5364
109 172 5370
111 174 5372
112 175 5373
114 177 5375
118 181 5379
119 182 5380
125 188 5386
129 192 5390
136 199 5397
145 206 5404
146 207 5405
148 208 5406
150 209 540...

result:

ok count=5000

Test #40:

score: 0
Accepted
time: 3ms
memory: 12024kb

input:

15000
3 1 3 1 3 3 1 1 1 1 3 3 3 3 3 3 1 1 3 1 1 3 3 3 3 3 3 3 3 3 2 3 1 3 3 3 3 3 3 1 3 1 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 1 1 1 3 1 1 3 1 1 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 1 1 1 3 1 1 1 3 3 3 3 1 1 1 1 3 1 3 1 1 3 1 2 1 2 1 3 1 3 1 1 1 1 3 3 3 3 ...

output:

5000
3 45 6174
6 48 6177
8 50 6179
9 51 6180
16 58 6187
17 59 6188
41 82 6211
87 99 6216
88 101 6217
94 107 6223
110 132 6226
111 134 6227
112 200 6228
114 211 6230
126 223 6242
135 230 6249
137 232 6251
139 234 6253
140 235 6254
141 236 6255
148 243 6262
153 248 6267
159 254 6273
164 259 6278
166 2...

result:

ok count=5000

Test #41:

score: 0
Accepted
time: 3ms
memory: 12048kb

input:

15000
3 3 1 1 1 1 3 3 3 1 3 1 3 1 3 1 3 3 3 3 1 3 3 1 1 1 3 1 1 1 1 3 1 1 3 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 3 3 3 3 3 3 3 1 3 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 1 1 1 3 3 1 3 3 3 1 3 3 1 3 3 1 3 3 3 3 1 1 1 1 3 3 1 3 1 3 3 1 3 1 1 3 1 3 1 3 3 3 1 1 1 1 3 3 3 3 1 3 1 3 1 1 3 1 1 1 3 1 1 1 3 2 3 3 3 3 1 1 1 ...

output:

5000
4 475 6962
5 476 6963
9 480 6967
15 486 6973
23 494 6981
24 495 6982
27 498 6985
36 507 6994
40 511 6998
42 513 7000
63 534 7021
74 545 7032
75 546 7033
76 547 7034
97 568 7055
102 573 7060
108 579 7066
110 581 7068
116 587 7074
118 589 7076
126 597 7084
128 599 7086
132 603 7090
144 614 7101
1...

result:

ok count=5000

Test #42:

score: 0
Accepted
time: 4ms
memory: 14024kb

input:

6000
1 3 1 1 3 3 3 1 1 1 1 1 3 1 1 1 3 1 3 3 3 1 3 1 1 1 3 3 3 3 1 1 3 1 3 1 3 3 3 3 3 3 3 3 3 3 1 3 1 3 1 1 1 1 3 3 3 1 1 1 1 3 1 3 1 3 1 3 1 1 1 1 3 3 1 3 3 3 1 3 3 3 1 3 3 3 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

2000
0 89 2549
3 92 2552
8 97 2557
10 99 2559
11 100 2560
13 102 2562
14 103 2563
15 104 2564
17 106 2567
21 110 2571
23 112 2573
46 135 2596
50 139 2600
52 141 2602
59 148 2609
66 155 2616
69 158 2619
70 159 2620
74 163 2624
78 167 2629
82 171 2633
88 177 2639
178 196 2640
183 201 2645
184 202 2646...

result:

ok count=2000

Test #43:

score: 0
Accepted
time: 4ms
memory: 12064kb

input:

9000
1 1 1 1 1 1 1 1 1 3 1 1 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 3 2 1 3 3 1 3 3 2 3 2 3 2 2 2 2 2 2 2 2 2 3 3 3 3 1 3 3 1 3 1 3 1 1 3 2 3 3 1 3 1 1 1 1 3 3 1 1 1 3 3 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 1 1 3 3 3 1 1 1 3 1 3 3 1 1 3 3 3 1 3 1 1 3 3 1 1 1 1 3 1 3 1 1...

output:

3000
0 13 4207
2 16 4209
4 18 4211
5 19 4212
6 20 4213
8 22 4215
10 24 4217
11 25 4218
12 26 4219
15 27 4220
29 39 4222
33 44 4225
59 90 4240
63 94 4244
69 99 4249
71 101 4251
77 107 4257
82 112 4262
114 167 4264
116 205 4266
117 214 4267
122 219 4272
125 222 4275
129 226 4279
133 230 4283
135 232 4...

result:

ok count=3000

Test #44:

score: 0
Accepted
time: 6ms
memory: 12012kb

input:

12000
3 3 3 3 3 1 3 1 3 1 1 3 1 1 3 1 3 3 3 1 1 1 3 1 1 1 1 3 3 3 2 1 1 1 3 3 3 3 1 3 1 3 1 1 1 1 1 3 3 1 1 3 3 1 1 1 2 1 3 3 1 1 1 1 1 1 1 3 1 3 3 1 3 1 3 3 1 1 1 3 3 3 1 1 1 3 3 1 3 3 1 3 3 3 1 1 3 1 1 1 3 1 1 3 3 1 1 1 1 1 3 3 1 3 1 3 3 1 1 3 1 3 1 3 3 3 3 3 3 1 1 1 1 1 3 1 1 1 3 1 3 1 3 3 3 3 1 ...

output:

4000
7 339 6550
15 349 6558
19 353 6562
23 357 6566
25 359 6568
26 360 6569
32 365 6574
33 366 6575
38 371 6580
42 375 6584
43 376 6585
46 379 6588
49 382 6591
50 383 6592
54 387 6596
55 388 6597
61 393 6602
62 394 6603
64 396 6605
65 397 6606
76 408 6617
77 409 6618
78 410 6619
82 414 6623
83 415 6...

result:

ok count=4000

Test #45:

score: 0
Accepted
time: 7ms
memory: 14080kb

input:

15000
3 3 1 3 3 2 3 2 1 1 2 1 3 1 1 3 1 2 2 2 2 1 2 2 2 2 2 2 2 2 1 1 2 3 2 2 1 1 1 1 1 1 1 3 3 3 1 1 3 1 3 1 1 3 3 3 1 3 1 3 1 1 1 3 3 1 3 1 3 1 2 1 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 3 3 1 3 3 1 1 1 1 1 1 3 1 1 1 1 3 3 3 3 2 3 3 3 1 3 1 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

5000
8 20 5438
11 23 5440
13 25 5442
14 26 5443
16 28 5445
30 32 5447
36 70 5450
37 108 5451
39 119 5453
40 120 5454
41 121 5455
49 129 5463
52 132 5466
56 136 5470
58 138 5472
60 140 5474
61 141 5475
75 154 5488
77 156 5490
87 166 5500
90 169 5503
94 173 5507
95 174 5508
96 175 5509
100 179 5513
10...

result:

ok count=5000

Test #46:

score: 0
Accepted
time: 7ms
memory: 12056kb

input:

15000
3 3 3 3 1 1 1 3 1 1 1 3 1 1 1 3 1 3 3 3 3 3 1 1 3 1 1 3 3 3 1 1 1 3 1 1 3 1 1 1 1 1 1 1 1 3 3 3 1 3 3 2 3 1 1 3 3 3 3 3 1 1 1 3 3 2 3 1 1 3 3 3 3 1 3 3 3 1 1 1 1 3 3 3 1 3 3 1 1 2 3 1 1 1 3 3 1 1 3 3 3 3 1 3 3 1 1 3 1 3 3 1 1 1 3 3 1 1 1 3 1 2 1 1 2 1 1 1 2 3 3 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

5000
4 124 6954
5 128 6955
6 132 6956
10 136 6960
13 139 6963
14 140 6964
25 151 6975
26 152 6976
30 156 6980
32 158 6982
35 161 6985
37 163 6987
38 164 6988
41 167 6991
43 169 6993
48 174 6998
54 179 7003
61 186 7010
62 187 7011
73 197 7021
77 201 7025
80 204 7028
88 212 7036
93 216 7040
97 220 704...

result:

ok count=5000

Test #47:

score: 0
Accepted
time: 3ms
memory: 12096kb

input:

15000
3 3 1 3 3 1 1 2 1 1 3 1 1 3 1 3 1 1 1 3 3 1 3 3 1 3 1 1 1 1 3 3 3 2 2 1 2 3 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 3 1 3 3 3 3 1 1 3 3 3 1 3 3 1 1 1 1 1 1 3 1 1 1 3 3 1 1 3 1 3 1 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 1 1 3 3 1 1 3 1 3 3 3 3 3 3 3 1 3 1 3 1 1 1 3 3 3 1 ...

output:

5000
2 34 6157
5 40 6160
9 43 6163
11 45 6165
17 51 6171
24 58 6178
26 60 6180
71 410 6191
73 436 6193
81 444 6201
85 448 6205
93 456 6213
100 463 6220
101 464 6221
103 466 6223
106 469 6226
121 484 6241
126 489 6246
140 503 6260
141 504 6261
142 505 6262
150 513 6270
153 516 6273
157 520 6277
158 5...

result:

ok count=5000

Test #48:

score: 0
Accepted
time: 6ms
memory: 12248kb

input:

15000
1 2 2 1 2 2 3 2 2 2 2 1 2 1 3 2 2 2 2 3 2 2 2 2 1 2 2 1 2 2 2 2 3 2 2 2 2 3 2 2 2 2 1 1 2 2 2 1 1 3 2 2 2 2 3 2 2 1 2 2 2 1 3 2 1 2 2 2 2 2 2 3 2 2 3 2 2 3 2 1 2 2 2 2 2 3 2 2 2 2 2 3 3 1 2 1 2 2 2 2 3 2 1 1 2 2 2 2 2 1 2 2 2 2 2 3 2 2 1 2 3 3 2 2 2 1 2 2 2 2 3 2 2 2 2 2 3 3 3 2 1 2 1 2 1 2 3 ...

output:

3267
11 12 8355
27 28 8360
42 44 8363
61 63 8370
79 80 8376
95 98 8381
103 105 8384
109 110 8385
140 145 8395
142 147 8396
154 159 8400
155 160 8401
157 161 8402
171 172 8404
178 181 8405
180 184 8407
188 189 8410
190 191 8411
192 193 8412
198 201 8414
202 205 8416
206 209 8418
214 217 8422
228 229 ...

result:

ok count=3267

Test #49:

score: 0
Accepted
time: 5ms
memory: 12040kb

input:

15000
1 2 2 2 1 2 2 2 2 2 1 2 2 2 1 3 2 1 1 2 2 1 2 2 2 2 2 2 2 2 2 1 3 2 1 1 2 3 3 1 2 1 1 1 3 2 2 1 2 2 2 2 2 2 2 2 3 2 1 2 2 3 1 2 2 1 1 3 2 2 3 2 2 3 3 2 3 2 2 1 2 2 3 2 2 2 2 2 3 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 3 2 3 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 1 2 2 2 2 3 2 1 2 2 1 2 2 ...

output:

3340
0 1 8342
10 11 8344
14 16 8345
17 20 8347
18 22 8348
21 23 8349
31 33 8350
34 40 8352
35 45 8353
39 49 8356
41 50 8357
47 54 8361
58 59 8363
66 69 8367
79 80 8373
92 93 8377
96 97 8378
141 142 8386
144 145 8387
158 161 8390
163 169 8394
164 171 8395
193 195 8404
228 229 8415
279 281 8429
280 28...

result:

ok count=3340

Test #50:

score: 0
Accepted
time: 5ms
memory: 12028kb

input:

14000
1 2 1 2 1 2 2 3 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 3 2 2 2 3 1 3 1 1 2 2 2 2 1 3 2 2 1 2 2 2 1 2 3 2 2 1 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 3 2 2 3 1 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 3 3 1 1 2 2 2 1 2 2 3 1 2 2 2 2 2 2 2 3 2 2 2 1 2 1 3 2 3 2 2 3 2 2 2 1 1 3 2 2 2 1 2 2 2 2 2 1 2 1 ...

output:

3042
2 3 7762
24 26 7766
36 41 7770
39 46 7773
44 47 7774
48 50 7776
52 53 7777
63 64 7780
69 70 7781
79 81 7784
84 85 7785
88 89 7786
99 103 7789
120 121 7795
133 136 7801
138 139 7803
144 145 7804
146 148 7805
147 150 7806
151 153 7808
163 164 7811
165 167 7812
169 176 7815
174 181 7819
182 184 78...

result:

ok count=3042

Test #51:

score: 0
Accepted
time: 2ms
memory: 12084kb

input:

13000
2 2 3 3 2 2 2 1 2 3 2 1 2 1 2 3 1 3 3 1 2 1 2 1 2 3 2 2 2 2 2 2 1 2 2 1 3 3 3 1 2 2 3 2 3 2 1 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 2 3 3 2 2 2 2 1 2 3 2 2 3 2 2 1 2 1 2 2 2 1 2 2 1 1 2 3 1 2 2 1 2 1 2 2 2 2 1 3 2 2 2 2 2 2 2 1 1 2 3 2 2 2 2 2 2 2 1 2 1 2 2 3 1 2 2 3 1 2 2 2 1 2 3 3 2 2 1 1 1 2 3 1 2 ...

output:

2941
7 8 7192
13 14 7195
21 28 7201
23 29 7202
32 33 7204
39 47 7209
51 52 7213
86 88 7224
90 94 7227
93 96 7228
95 97 7229
100 102 7230
109 111 7232
110 113 7233
126 128 7238
140 143 7244
141 146 7245
142 147 7246
145 155 7248
148 156 7249
149 157 7250
150 158 7251
183 186 7264
191 192 7266
193 194...

result:

ok count=2941

Test #52:

score: 0
Accepted
time: 0ms
memory: 12244kb

input:

11000
2 2 2 3 2 2 2 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 3 2 2 2 2 1 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 3 2 1 1 2 2 2 2 1 2 2 3 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 3 2 2 3 2 1 3 2 2 2 2 1 2 2 3 2 2 3 2 2 2 2 2 2 2 3 2 1 2 2 3 1 2 2 3 2 2 3 2 3 2 2 2 ...

output:

2460
11 12 6098
18 19 6100
29 30 6101
42 43 6103
44 46 6104
68 72 6110
79 80 6113
85 86 6114
135 137 6127
151 159 6134
153 163 6136
164 172 6142
165 173 6143
194 195 6150
198 201 6151
199 202 6152
205 207 6154
206 210 6155
232 234 6161
242 244 6164
246 247 6166
253 257 6169
256 258 6170
269 270 6174...

result:

ok count=2460

Test #53:

score: 0
Accepted
time: 2ms
memory: 11968kb

input:

11000
2 2 3 1 2 1 2 2 2 3 2 2 2 2 2 3 2 1 2 2 1 2 3 2 1 2 3 2 2 1 2 2 2 2 2 2 3 3 2 2 2 2 2 1 2 1 2 2 1 1 2 1 1 2 2 3 2 2 2 2 2 2 2 1 2 2 3 1 1 2 2 1 3 2 1 2 3 2 3 1 2 2 2 1 2 2 2 2 3 2 2 2 3 1 2 1 2 2 2 2 3 2 1 2 2 1 3 2 3 3 2 2 2 1 2 2 2 2 2 3 1 2 2 1 2 2 3 2 2 3 2 2 2 2 1 3 2 2 2 2 2 1 2 2 3 2 2 ...

output:

2423
3 6 6104
17 18 6108
20 21 6109
24 25 6111
29 30 6113
43 44 6116
45 46 6117
51 54 6120
52 56 6121
63 64 6123
74 80 6129
83 85 6133
93 96 6136
95 97 6137
120 122 6146
123 124 6147
141 142 6152
148 149 6154
151 152 6155
185 186 6163
187 188 6164
192 195 6166
193 196 6167
198 201 6170
212 213 6173
...

result:

ok count=2423

Test #54:

score: 0
Accepted
time: 0ms
memory: 12044kb

input:

11000
2 1 1 3 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 3 2 2 2 3 2 1 2 1 2 1 2 2 2 2 3 2 2 2 2 2 2 3 2 1 2 3 1 3 2 2 3 2 2 3 2 1 3 1 3 2 2 2 2 2 2 1 3 2 2 2 2 1 2 2 2 2 3 2 2 3 3 1 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 2 2 2 3 2 2 1 1 2 3 3 2 3 1 1 3 1 2 2 2 3 2 1 2 2 2 3 3 3 2 1 2 2 2 3 2 2 ...

output:

2372
2 5 6170
25 26 6173
56 57 6181
68 72 6187
70 74 6189
84 85 6193
116 118 6201
117 121 6202
124 133 6207
132 141 6211
140 146 6215
156 158 6219
168 171 6226
173 176 6227
183 184 6232
196 200 6237
247 249 6251
267 273 6260
274 279 6264
288 291 6268
301 302 6274
334 335 6282
366 367 6290
369 371 62...

result:

ok count=2372

Test #55:

score: 0
Accepted
time: 0ms
memory: 12008kb

input:

11000
2 2 1 2 3 2 2 1 2 2 2 3 1 2 2 2 2 2 2 2 3 2 2 1 2 2 2 2 2 3 2 2 1 1 2 3 2 3 2 2 2 2 2 2 2 2 1 3 2 3 3 2 2 2 3 2 2 2 1 2 2 1 3 3 2 2 2 3 2 2 2 2 3 2 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 3 2 2 2 2 2 1 2 2 2 2 2 2 2 1 3 1 1 2 3 3 2 2 2 2 2 1 2 2 2 2 1 2 2 1 2 3 2 2 2 2 2 1 1 3 2 2 1 2 3 2 2 2 1 1 2 2 2 ...

output:

2490
12 14 6097
23 24 6099
61 64 6111
75 77 6117
87 88 6118
103 107 6121
106 112 6124
123 124 6129
131 134 6131
143 145 6137
152 154 6139
157 159 6142
167 173 6146
170 175 6148
206 207 6154
209 210 6155
259 260 6172
263 265 6174
267 270 6176
268 271 6177
269 274 6178
276 279 6181
290 291 6185
297 29...

result:

ok count=2490

Test #56:

score: 0
Accepted
time: 4ms
memory: 12040kb

input:

15000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1
7734 8258 14999

result:

ok count=1

Test #57:

score: 0
Accepted
time: 3ms
memory: 11912kb

input:

15000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1
1354 1355 5343

result:

ok count=1

Test #58:

score: 0
Accepted
time: 4ms
memory: 14088kb

input:

15000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

5000
0 5000 10000
1 5001 10001
2 5002 10002
3 5003 10003
4 5004 10004
5 5005 10005
6 5006 10006
7 5007 10007
8 5008 10008
9 5009 10009
10 5010 10010
11 5011 10011
12 5012 10012
13 5013 10013
14 5014 10014
15 5015 10015
16 5016 10016
17 5017 10017
18 5018 10018
19 5019 10019
20 5020 10020
21 5021 100...

result:

ok count=5000

Test #59:

score: 0
Accepted
time: 0ms
memory: 12140kb

input:

15000
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1
0 1 14999

result:

ok count=1

Test #60:

score: 0
Accepted
time: 0ms
memory: 12248kb

input:

15000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

3000
0 6000 12000
1 6001 12001
2 6002 12002
3 6003 12003
4 6004 12004
5 6005 12005
6 6006 12006
7 6007 12007
8 6008 12008
9 6009 12009
10 6010 12010
11 6011 12011
12 6012 12012
13 6013 12013
14 6014 12014
15 6015 12015
16 6016 12016
17 6017 12017
18 6018 12018
19 6019 12019
20 6020 12020
21 6021 120...

result:

ok count=3000

Test #61:

score: 0
Accepted
time: 3ms
memory: 12276kb

input:

14997
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4977
0 4977 10020
1 4978 10021
2 4979 10022
3 4980 10023
4 4981 10024
5 4982 10025
6 4983 10026
7 4984 10027
8 4985 10028
9 4986 10029
10 4987 10030
11 4988 10031
12 4989 10032
13 4990 10033
14 4991 10034
15 4992 10035
16 4993 10036
17 4994 10037
18 4995 10038
19 4996 10039
20 4997 10040
21 4998 100...

result:

ok count=4977

Test #62:

score: 0
Accepted
time: 0ms
memory: 11848kb

input:

91
2 1 2 2 1 3 1 2 1 2 2 1 2 3 3 1 2 2 2 1 3 1 3 1 1 3 1 2 1 2 1 3 1 1 3 2 3 1 2 3 2 2 2 2 1 2 1 1 3 2 2 2 1 1 2 3 3 2 3 3 3 3 1 1 3 2 3 3 1 3 3 3 3 3 2 1 2 2 2 3 2 3 2 1 3 1 3 1 3 1 1

output:

29
4 7 55
6 10 58
8 12 59
11 16 60
19 29 64
21 38 67
23 41 69
24 42 70
26 45 72
28 49 73
32 54 81
37 76 86
44 78 88
14 18 62
22 40 68
36 74 85
39 77 87
1 2 56
5 9 53
13 17 63
15 27 61
20 35 75
30 50 66
25 43 83
33 57 71
31 80 89
46 51 79
34 65 90
47 82 84

result:

ok count=29

Test #63:

score: 0
Accepted
time: 0ms
memory: 11828kb

input:

92
3 1 3 3 3 3 3 1 3 2 1 3 3 3 1 1 1 2 2 1 2 1 2 2 2 3 2 1 3 3 2 3 3 2 3 3 2 3 3 2 2 1 2 2 3 3 2 2 2 3 2 1 3 2 1 2 1 1 1 1 1 3 1 3 1 2 1 1 2 2 2 2 3 1 1 3 2 1 1 1 1 1 1 3 1 2 2 3 3 2 2 2

output:

29
10 33 61
16 46 72
41 86 88
3 20 54
4 22 56
5 23 57
6 24 58
8 30 60
11 36 62
13 40 64
28 55 78
29 65 79
31 68 80
32 69 81
34 70 82
37 76 84
0 9 51
1 17 49
2 18 59
7 26 52
12 39 66
14 42 63
15 43 75
25 50 67
19 47 83
35 71 73
21 85 87
38 48 74
45 53 77

result:

ok count=29

Test #64:

score: 0
Accepted
time: 0ms
memory: 12088kb

input:

93
1 1 3 1 1 3 1 1 2 3 1 1 1 2 3 3 2 1 1 3 1 3 3 2 3 3 1 3 2 2 3 3 1 3 1 1 1 2 2 3 1 2 3 1 3 3 2 3 2 3 2 3 2 3 2 3 3 2 1 3 2 2 1 1 1 2 1 1 2 2 2 1 1 2 3 1 2 2 3 3 2 1 2 2 1 2 2 2 2 3 3 2 2

output:

28
1 13 42
3 23 44
4 28 45
6 37 49
7 38 51
10 46 55
11 48 56
26 76 78
32 83 89
2 16 43
15 54 62
19 61 66
21 68 71
22 69 72
25 73 75
30 80 81
31 82 84
0 8 47
5 29 40
9 41 58
12 50 53
14 52 63
17 57 59
18 70 74
24 60 64
20 77 79
27 65 67
36 85 90

result:

ok count=28

Test #65:

score: 0
Accepted
time: 2ms
memory: 11800kb

input:

94
3 3 1 1 3 2 1 3 2 1 2 1 1 2 2 2 2 3 2 2 1 1 3 1 2 1 2 3 3 3 2 2 1 3 2 1 2 2 1 2 3 1 2 1 2 1 3 1 3 1 3 3 2 2 2 1 1 3 2 2 3 3 3 2 2 3 3 3 2 3 2 1 2 2 1 1 2 1 1 1 3 2 2 1 3 3 1 3 1 3 3 3 2 1

output:

30
2 10 51
6 15 57
9 18 61
11 19 62
12 24 65
20 30 67
21 31 69
32 52 80
35 54 84
38 58 85
41 63 87
45 68 89
47 72 91
0 5 49
4 14 56
22 34 71
27 39 77
28 42 78
29 44 79
33 53 83
40 59 86
48 73 93
1 8 55
3 13 50
7 16 74
23 36 60
17 26 75
25 37 66
43 64 90
46 70 88

result:

ok count=30

Test #66:

score: 0
Accepted
time: 0ms
memory: 12056kb

input:

94
3 2 3 2 1 2 1 3 3 2 1 3 2 3 1 3 2 1 2 2 2 3 3 1 3 3 1 2 1 1 1 2 3 2 1 2 2 2 2 2 3 1 3 3 2 3 3 3 1 1 1 2 1 1 1 3 3 3 1 1 3 1 3 1 2 3 3 2 1 1 2 3 2 1 2 2 3 1 3 3 1 1 1 3 2 3 1 2 2 2 2 3 1 1

output:

29
4 5 56
6 9 57
10 18 60
17 33 66
23 37 71
28 51 78
29 64 79
41 75 85
0 1 54
7 12 58
8 16 59
11 19 61
21 35 68
22 36 69
24 38 73
32 70 81
42 84 86
45 88 92
46 89 93
2 3 63
14 27 55
13 20 77
26 44 62
15 67 80
30 31 65
25 39 82
34 72 76
53 74 83
52 87 91

result:

ok count=29

Test #67:

score: 0
Accepted
time: 2ms
memory: 11796kb

input:

96
2 3 2 1 1 1 1 3 3 2 2 1 2 1 3 3 3 2 3 2 1 3 2 1 2 3 2 2 3 2 1 2 2 1 1 3 1 2 3 3 3 3 3 1 1 2 1 1 2 2 2 1 3 3 1 1 3 2 3 1 1 3 2 1 1 1 2 1 3 2 2 3 3 2 2 3 3 1 1 1 3 1 3 3 3 3 1 3 3 2 2 2 1 1 1 2

output:

28
5 12 61
13 26 68
30 57 82
33 62 83
34 66 84
7 19 64
8 22 65
21 45 78
28 50 81
40 89 92
41 90 93
42 91 94
1 2 59
3 9 58
4 10 71
14 27 60
6 17 72
15 29 63
11 24 75
16 31 67
18 32 77
20 37 76
23 48 80
25 49 79
35 69 86
36 70 85
55 73 87
54 74 88

result:

ok count=28

Test #68:

score: 0
Accepted
time: 0ms
memory: 11796kb

input:

98
2 3 2 1 2 2 1 3 3 3 2 1 3 1 1 2 2 2 2 1 1 2 2 1 2 1 3 2 1 3 3 1 2 1 2 1 1 3 2 1 2 3 1 2 3 3 3 3 2 2 3 1 3 2 1 1 1 3 3 1 3 2 2 1 3 1 3 3 3 1 1 2 1 1 2 3 2 3 2 1 3 1 1 2 3 1 3 3 2 3 3 1 3 1 3 1 3 2

output:

27
6 10 66
14 24 75
19 27 77
23 34 80
28 43 84
31 53 87
33 61 89
35 62 90
9 17 69
12 21 72
26 40 82
29 48 85
1 2 65
3 4 64
7 15 70
11 18 67
8 16 73
13 22 68
20 32 86
30 49 79
25 38 92
37 74 81
36 71 94
41 78 91
39 76 96
44 88 93
60 83 95

result:

ok count=27

Test #69:

score: 0
Accepted
time: 2ms
memory: 11860kb

input:

100
1 3 1 3 1 1 2 3 1 2 2 2 1 3 3 3 3 1 2 3 1 1 3 2 2 2 3 3 2 1 1 3 1 3 2 2 1 1 1 3 1 3 2 3 2 2 2 1 3 3 1 1 1 1 1 3 2 2 2 3 3 2 1 3 2 3 3 1 1 1 2 2 2 2 2 1 1 3 2 3 2 3 1 3 1 1 3 3 2 1 2 2 3 3 3 3 1 1 3 1

output:

30
0 6 55
2 10 60
4 18 63
5 23 65
17 45 79
21 57 83
29 70 87
32 73 93
36 78 95
3 11 62
13 34 69
14 35 75
15 42 76
22 58 84
26 61 85
1 9 67
8 25 59
7 24 68
12 28 66
16 44 82
20 56 77
19 46 89
30 71 81
27 64 96
37 80 86
31 72 97
38 88 92
33 74 99
40 91 94
54 90 98

result:

ok count=30

Test #70:

score: 0
Accepted
time: 0ms
memory: 11800kb

input:

100
1 1 1 1 1 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 2 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

1
0 29 58

result:

ok count=1

Test #71:

score: 0
Accepted
time: 2ms
memory: 11900kb

input:

100
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 1 2 2 2 2 2 2

output:

1
29 30 93

result:

ok count=1

Test #72:

score: 0
Accepted
time: 2ms
memory: 11852kb

input:

99
1 1 3 3 2 1 2 2 2 2 1 2 1 3 1 3 3 1 3 3 2 2 2 1 2 2 2 2 2 2 1 2 1 2 3 2 3 2 1 2 1 3 1 2 2 1 2 3 2 2 1 3 2 1 2 3 2 2 1 2 3 1 1 3 3 3 3 3 3 1 1 3 1 3 1 1 1 3 1 1 3 1 3 3 1 3 3 3 2 1 1 3 3 2 3 3 1 2 1

output:

33
0 4 63
1 6 64
5 9 67
10 11 68
14 22 71
23 29 77
38 39 82
40 43 83
42 46 85
45 48 86
53 56 91
58 59 94
13 21 70
15 24 72
18 27 75
19 28 76
36 37 81
41 44 84
51 54 90
2 7 69
12 20 65
3 8 74
17 26 66
16 25 78
30 31 73
32 33 80
34 35 79
47 49 89
50 52 87
55 57 61
92 93 96
60 97 98
62 88 95

result:

ok count=33

Test #73:

score: 0
Accepted
time: 2ms
memory: 11868kb

input:

96
3 2 1 2 3 1 2 1 2 1 2 2 1 1 2 2 3 2 1 3 2 2 1 2 3 2 1 2 3 3 3 3 1 2 2 2 2 2 1 1 1 1 3 1 2 1 1 3 3 1 3 3 1 3 3 1 1 1 3 3 3 1 3 1 1 3 3 1 3 3 3 3 2 1 2 3 2 3 2 3 2 1 2 1 2 3 2 3 2 1 2 3 2 1 2 1

output:

32
2 3 53
12 14 58
13 15 59
26 27 65
32 37 70
38 44 71
40 74 75
41 76 77
46 84 85
49 90 91
0 1 52
24 25 64
29 34 67
48 88 89
50 92 93
51 94 95
4 6 55
5 8 54
7 10 60
16 17 56
9 11 62
19 21 57
18 20 66
28 33 61
22 23 68
30 35 63
31 36 39
69 72 73
42 80 81
43 78 79
45 86 87
47 82 83

result:

ok count=32

Test #74:

score: 0
Accepted
time: 2ms
memory: 11792kb

input:

99
3 2 1 2 1 1 1 3 2 3 1 2 1 2 3 3 3 1 3 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 1 3 1 1 1 1 1 1 3 2 3 2 3 2 2 3 1 2 2 2 2 3 2 1 1 1 3 2 3 2 2 2 3 1 3 2 1 2 3 2 2 2 2 2 2 2 1 1 3 1 1 3 3 2 3 2 2 2 3 2 2 3 1 3 1

output:

33
6 13 42
10 47 49
22 65 68
30 78 85
31 79 86
32 87 88
33 89 92
34 90 95
36 93 97
0 1 38
15 52 57
16 53 58
23 69 70
25 73 80
26 74 81
29 77 84
35 91 96
2 3 7
39 43 44
4 8 9
40 45 46
5 11 14
41 51 55
12 56 60
18 48 50
17 61 62
19 54 59
20 63 67
21 64 66
24 76 83
28 71 72
27 94 98
37 75 82

result:

ok count=33

Test #75:

score: 0
Accepted
time: 2ms
memory: 11796kb

input:

93
3 2 3 2 3 2 1 2 3 2 3 2 3 2 3 1 3 1 3 1 1 1 3 3 1 3 3 3 1 1 3 1 1 1 3 3 1 3 3 1 2 2 3 1 1 2 3 2 1 3 3 1 3 2 2 2 2 2 2 2 3 2 3 3 1 1 1 3 1 2 2 3 1 2 1 2 1 2 3 2 2 1 1 2 2 2 2 2 3 1 1 1 1

output:

31
15 41 50
17 47 52
19 54 62
20 55 63
24 59 67
33 83 88
2 3 39
8 9 44
12 13 48
16 45 51
22 57 65
23 58 66
25 61 68
27 70 72
34 84 89
35 85 90
37 87 92
0 1 43
6 7 38
4 5 21
42 56 64
10 11 28
46 73 74
14 75 76
29 40 49
18 79 81
31 53 60
26 80 82
32 69 71
30 86 91
36 77 78

result:

ok count=31

Test #76:

score: 0
Accepted
time: 0ms
memory: 11796kb

input:

90
3 3 3 3 2 2 2 2 3 2 1 2 3 2 3 2 1 1 2 2 3 3 2 2 1 3 2 2 1 2 1 1 3 1 3 2 3 3 3 1 1 1 3 1 3 2 3 1 1 3 1 2 1 1 3 3 3 1 2 1 1 2 1 3 3 3 1 1 3 1 2 2 1 2 1 3 2 3 2 2 3 1 2 1 2 1 2 1 2 3

output:

30
16 18 56
28 29 64
30 35 65
33 58 68
39 76 77
40 78 80
0 4 47
1 5 48
3 7 50
8 9 52
20 22 59
21 23 60
32 51 67
34 61 69
36 70 72
37 71 74
42 82 83
44 86 87
2 6 53
10 11 49
12 13 57
17 19 54
14 15 62
24 26 55
25 27 66
31 45 63
38 79 81
41 73 75
43 88 89
46 84 85

result:

ok count=30

Test #77:

score: 0
Accepted
time: 2ms
memory: 11856kb

input:

100
2 1 2 2 2 3 2 2 1 2 1 2 2 1 2 2 2 2 1 2 2 3 2 2 2 2 2 1 2 2 2 3 3 1 1 1 1 1 1 1 3 3 3 1 1 3 1 1 1 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 3 3 2 3 2 2 1 2 2 3 2 2 2 2 2 2 3 1 2 1 1 1 1 2 2 3 2 2 3 2 2 2 2 1 2 2

output:

20
10 11 61
18 19 63
27 28 65
33 69 73
34 71 80
32 68 70
42 82 97
1 2 59
5 6 58
8 9 64
21 22 60
13 14 31
62 66 67
35 72 89
40 78 81
36 74 92
41 79 83
56 75 84
55 76 85
54 77 86

result:

ok count=20

Test #78:

score: 0
Accepted
time: 0ms
memory: 11860kb

input:

99
2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 3 2 2 2 2 2 3 2 1 2 3 2 2 2 2 2 2 1 1 1 1 1 3 3 1 1 3 3 1 1 3 1 1 3 3 1 1 1 3 3 1 1 3 1 1 1 3 3 3 3 3 2 2 3 3 1 2 3 2 2 2 1 2 1 3 1 1 2 1 2 1 1 1 2 3 2 2 2 2 2 1 1 2

output:

18
7 8 65
9 10 66
35 72 80
38 76 84
39 78 86
43 91 96
16 17 71
24 25 69
22 23 77
33 67 70
26 27 79
34 68 73
36 89 90
42 74 81
64 75 82
63 83 87
62 85 88
58 92 97

result:

ok count=18

Test #79:

score: 0
Accepted
time: 2ms
memory: 11832kb

input:

98
3 2 2 2 2 2 2 3 3 2 2 2 1 2 1 2 2 2 2 2 2 3 1 3 1 3 2 3 2 1 2 2 1 1 1 3 3 3 3 1 3 1 1 1 3 3 1 3 3 3 1 3 1 3 3 1 3 3 1 1 3 3 3 3 2 2 2 2 2 2 2 2 2 1 3 2 2 2 3 2 2 2 2 3 2 1 2 2 2 2 2 2 2 2 2 2 2 1

output:

15
22 28 61
24 31 63
29 66 78
32 67 83
0 1 55
25 64 73
7 9 58
12 13 56
8 10 59
14 15 57
21 26 33
60 68 85
23 30 34
62 69 97
52 65 74

result:

ok count=15

Test #80:

score: 0
Accepted
time: 0ms
memory: 11836kb

input:

97
2 2 1 3 2 2 1 2 2 2 1 2 1 1 1 1 2 2 3 2 3 1 2 2 2 3 2 3 3 2 2 2 1 3 1 1 1 1 1 1 1 1 3 3 3 1 3 1 1 1 1 3 1 1 1 3 1 3 1 3 1 1 3 1 2 2 1 2 1 2 2 2 2 2 1 3 2 2 1 3 1 2 3 1 2 2 1 2 2 2 2 3 3 2 2 1 1

output:

21
2 4 57
6 7 59
13 17 62
21 26 75
32 64 82
35 69 91
36 70 92
3 5 58
18 23 68
20 24 74
25 29 78
28 31 80
33 65 83
10 11 79
27 30 60
12 16 55
14 19 51
15 22 46
44 67 86
43 71 95
42 72 96

result:

ok count=21

Test #81:

score: 0
Accepted
time: 2ms
memory: 11844kb

input:

99
1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

33
0 33 66
1 34 67
2 35 68
3 36 69
4 37 70
5 38 71
6 39 72
7 40 73
8 41 74
9 42 75
10 43 76
11 44 77
12 45 78
13 46 79
14 47 80
15 48 81
16 49 82
17 50 83
18 51 84
19 52 85
20 53 86
21 54 87
22 55 88
23 56 89
24 57 90
25 58 91
26 59 92
27 60 93
28 61 94
29 62 95
30 63 96
31 64 97
32 65 98

result:

ok count=33

Test #82:

score: 0
Accepted
time: 0ms
memory: 11768kb

input:

99
3 2 3 3 1 2 1 1 1 1 2 2 3 1 3 1 3 3 2 3 3 2 3 3 1 2 3 3 1 1 1 2 1 1 1 1 3 1 1 2 1 2 1 2 3 3 2 3 1 2 2 1 2 3 3 3 1 3 2 2 2 2 2 2 2 2 3 3 1 2 2 2 1 3 3 1 3 2 2 3 2 2 3 2 1 2 1 3 1 3 3 1 2 1 1 3 1 3 1

output:

33
7 21 53
8 25 54
9 31 55
13 41 57
15 46 67
24 61 79
29 65 87
32 70 89
33 71 90
37 81 95
40 85 97
12 39 56
16 49 68
17 50 72
22 59 75
27 63 84
36 80 94
0 1 48
4 11 44
2 5 51
6 18 45
3 10 28
47 64 86
14 69 88
30 43 66
19 77 91
34 52 73
20 78 93
35 58 74
23 83 96
38 60 76
26 92 98
42 62 82

result:

ok count=33

Test #83:

score: 0
Accepted
time: 2ms
memory: 11856kb

input:

96
3 3 3 2 2 1 2 3 1 3 3 1 3 2 1 2 1 3 2 1 2 1 2 1 2 2 2 1 1 1 3 2 3 3 3 3 1 2 3 3 1 1 3 2 3 1 3 1 2 3 1 3 2 2 2 1 1 1 2 2 1 1 2 3 3 2 1 2 2 1 2 2 2 3 3 3 1 3 3 2 2 3 1 3 2 1 2 3 1 1 2 3 1 1 1 3

output:

32
14 26 63
16 31 64
21 48 73
23 52 74
27 53 75
29 58 77
36 70 87
40 79 91
45 90 95
1 4 47
9 20 56
10 22 57
12 25 61
17 37 66
33 65 82
35 68 85
38 71 88
39 72 89
42 84 93
44 86 94
0 3 50
5 13 46
2 6 55
8 18 49
7 15 60
11 24 51
19 43 78
30 59 69
28 54 81
32 62 76
34 67 92
41 80 83

result:

ok count=32

Test #84:

score: 0
Accepted
time: 3ms
memory: 11900kb

input:

3000
2 3 2 3 3 1 2 3 1 3 2 1 1 2 3 2 2 2 3 1 2 1 3 2 3 2 1 2 3 3 2 1 3 3 3 3 3 3 2 1 1 2 2 1 1 2 3 1 1 2 2 3 3 1 2 2 3 2 1 1 1 3 1 2 2 3 3 1 1 1 3 2 1 2 1 3 2 2 1 1 2 3 3 3 3 2 3 1 2 2 3 2 3 1 3 3 3 3 1 3 2 2 2 2 1 3 2 2 2 1 2 2 3 2 2 1 1 1 1 1 2 3 2 1 2 3 3 3 2 3 3 3 3 2 3 2 2 2 2 1 3 3 1 1 1 1 2 3...

output:

999
5 13 1486
11 20 1490
12 23 1491
19 30 1495
31 54 1510
43 80 1529
58 106 1544
59 107 1545
62 111 1549
67 120 1554
68 122 1555
69 124 1556
78 137 1563
79 138 1565
87 161 1572
98 184 1584
109 207 1591
115 211 1595
116 212 1596
118 214 1602
142 263 1624
143 266 1625
144 277 1626
157 310 1641
159 313...

result:

ok count=999

Test #85:

score: 0
Accepted
time: 0ms
memory: 11852kb

input:

2997
1 3 1 3 2 1 3 3 2 2 2 1 1 2 3 3 3 1 3 2 3 3 2 1 2 3 1 2 2 2 2 1 3 3 2 1 2 2 3 2 2 2 2 1 3 1 3 3 3 3 1 3 3 1 3 1 3 2 3 1 2 3 1 2 2 3 3 1 3 3 3 3 3 3 1 1 1 3 3 1 3 3 1 1 1 3 2 3 3 2 3 3 3 1 3 3 2 1 1 1 2 1 1 1 1 3 3 3 3 2 3 1 3 3 2 1 3 1 3 1 1 3 2 1 2 3 1 2 2 2 3 1 3 2 2 3 2 3 3 3 1 2 3 2 1 1 3 1...

output:

995
17 34 1506
23 40 1514
26 42 1516
31 57 1517
45 100 1531
50 127 1536
55 136 1544
67 170 1555
75 185 1565
79 209 1570
93 255 1585
98 273 1591
99 278 1592
103 285 1595
115 307 1610
117 313 1615
119 333 1617
126 343 1622
140 367 1632
145 380 1635
147 382 1639
160 407 1659
161 409 1660
162 410 1664
1...

result:

ok count=995

Test #86:

score: 0
Accepted
time: 0ms
memory: 12088kb

input:

18
2 1 2 2 2 2 1 3 1 3 3 3 2 2 2 2 3 2

output:

2
1 2 11
6 12 16

result:

ok count=2

Test #87:

score: 0
Accepted
time: 2ms
memory: 11792kb

input:

17
1 2 2 2 2 1 1 1 1 3 2 2 1 2 1 2 2

output:

1
0 1 9

result:

ok count=1

Test #88:

score: 0
Accepted
time: 0ms
memory: 11836kb

input:

16
1 2 2 2 2 3 3 1 3 3 2 2 2 2 3 2

output:

2
0 1 9
7 10 14

result:

ok count=2

Test #89:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

90
3 2 3 2 2 1 1 3 2 2 1 1 1 1 1 2 2 1 2 3 3 3 3 3 1 1 3 2 3 2 3 2 3 2 2 3 3 2 1 2 2 2 2 1 3 1 3 3 1 1 1 2 3 1 1 2 3 3 2 3 3 2 2 2 1 2 1 2 1 3 2 3 3 3 1 1 2 1 1 3 1 3 1 1 2 2 1 3 1 3

output:

29
5 8 52
10 16 56
11 18 57
12 27 59
13 29 60
0 1 49
2 3 50
7 15 54
19 34 68
26 55 77
28 58 78
32 62 80
36 65 82
6 9 69
20 37 53
14 31 71
21 39 64
17 33 72
22 40 66
23 41 74
24 42 73
25 51 79
30 61 75
35 63 83
38 67 81
43 70 87
44 76 86
45 84 89
46 85 88

result:

ok count=29

Test #90:

score: 0
Accepted
time: 2ms
memory: 11848kb

input:

15
2 3 3 2 1 3 2 1 1 1 3 2 3 1 2

output:

3
1 3 4
10 11 13
2 6 9

result:

ok count=3

Test #91:

score: 0
Accepted
time: 0ms
memory: 11832kb

input:

18
3 3 3 1 1 3 2 2 1 2 1 2 3 2 2 1 3 1

output:

6
4 13 16
0 6 8
1 7 10
5 14 17
2 9 15
3 11 12

result:

ok count=6

Test #92:

score: 0
Accepted
time: 2ms
memory: 11848kb

input:

16
1 3 3 2 1 3 1 2 2 2 3 1 3 2 1 2

output:

5
4 9 12
2 8 11
5 13 14
0 7 10
1 3 6

result:

ok count=5

Test #93:

score: 0
Accepted
time: 0ms
memory: 11836kb

input:

15
1 3 1 2 3 2 3 3 2 1 2 2 1 1 3

output:

5
0 3 7
1 5 9
4 10 13
2 8 14
6 11 12

result:

ok count=5

Test #94:

score: 0
Accepted
time: 2ms
memory: 12068kb

input:

18
1 3 1 3 2 1 1 3 2 2 2 3 2 3 2 1 1 3

output:

6
0 4 7
2 9 13
6 14 17
3 10 15
1 12 16
5 8 11

result:

ok count=6

Test #95:

score: 0
Accepted
time: 0ms
memory: 11900kb

input:

18
1 3 3 2 1 1 1 2 3 2 1 1 2 3 2 3 2 3

output:

6
0 3 8
4 12 13
5 14 15
6 16 17
1 7 10
2 9 11

result:

ok count=6

Test #96:

score: 0
Accepted
time: 2ms
memory: 12064kb

input:

18
1 2 1 2 3 2 3 3 2 2 3 1 1 3 3 1 2 1

output:

6
7 9 15
10 16 17
0 1 13
4 5 11
2 3 14
6 8 12

result:

ok count=6

Test #97:

score: 0
Accepted
time: 0ms
memory: 11860kb

input:

15
1 2 1 2 3 3 1 1 1 2 3 2 3 2 3

output:

5
6 13 14
0 1 4
7 9 10
2 3 5
8 11 12

result:

ok count=5

Test #98:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

18
3 2 1 2 1 3 3 1 1 3 2 1 2 3 2 1 2 3

output:

6
2 3 9
7 16 17
0 1 8
6 14 15
4 12 13
5 10 11

result:

ok count=6

Test #99:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

15
1 2 3 2 3 3 3 1 3 2 1 2 1 2 1

output:

5
4 9 10
5 11 12
6 13 14
0 1 8
2 3 7

result:

ok count=5

Test #100:

score: 0
Accepted
time: 0ms
memory: 11992kb

input:

91
2 1 2 2 1 3 1 2 1 2 2 1 2 3 3 1 2 2 2 1 3 1 3 1 1 3 1 2 1 2 1 3 1 1 3 2 3 1 2 3 2 2 2 2 1 2 1 1 3 2 2 2 1 1 2 3 3 2 3 3 3 3 1 1 3 2 3 3 1 3 3 3 3 3 2 1 2 2 2 3 2 3 2 1 3 1 3 1 3 1 1

output:

29
4 7 55
6 10 58
8 12 59
11 16 60
19 29 64
21 38 67
23 41 69
24 42 70
26 45 72
28 49 73
32 54 81
37 76 86
44 78 88
14 18 62
22 40 68
36 74 85
39 77 87
1 2 56
5 9 53
13 17 63
15 27 61
20 35 75
30 50 66
25 43 83
33 57 71
31 80 89
46 51 79
34 65 90
47 82 84

result:

ok count=29

Test #101:

score: 0
Accepted
time: 2ms
memory: 12068kb

input:

92
3 1 3 3 3 3 3 1 3 2 1 3 3 3 1 1 1 2 2 1 2 1 2 2 2 3 2 1 3 3 2 3 3 2 3 3 2 3 3 2 2 1 2 2 3 3 2 2 2 3 2 1 3 2 1 2 1 1 1 1 1 3 1 3 1 2 1 1 2 2 2 2 3 1 1 3 2 1 1 1 1 1 1 3 1 2 2 3 3 2 2 2

output:

29
10 33 61
16 46 72
41 86 88
3 20 54
4 22 56
5 23 57
6 24 58
8 30 60
11 36 62
13 40 64
28 55 78
29 65 79
31 68 80
32 69 81
34 70 82
37 76 84
0 9 51
1 17 49
2 18 59
7 26 52
12 39 66
14 42 63
15 43 75
25 50 67
19 47 83
35 71 73
21 85 87
38 48 74
45 53 77

result:

ok count=29

Test #102:

score: 0
Accepted
time: 0ms
memory: 11904kb

input:

93
1 1 3 1 1 3 1 1 2 3 1 1 1 2 3 3 2 1 1 3 1 3 3 2 3 3 1 3 2 2 3 3 1 3 1 1 1 2 2 3 1 2 3 1 3 3 2 3 2 3 2 3 2 3 2 3 3 2 1 3 2 2 1 1 1 2 1 1 2 2 2 1 1 2 3 1 2 2 3 3 2 1 2 2 1 2 2 2 2 3 3 2 2

output:

28
1 13 42
3 23 44
4 28 45
6 37 49
7 38 51
10 46 55
11 48 56
26 76 78
32 83 89
2 16 43
15 54 62
19 61 66
21 68 71
22 69 72
25 73 75
30 80 81
31 82 84
0 8 47
5 29 40
9 41 58
12 50 53
14 52 63
17 57 59
18 70 74
24 60 64
20 77 79
27 65 67
36 85 90

result:

ok count=28

Test #103:

score: 0
Accepted
time: 2ms
memory: 11832kb

input:

94
3 3 1 1 3 2 1 3 2 1 2 1 1 2 2 2 2 3 2 2 1 1 3 1 2 1 2 3 3 3 2 2 1 3 2 1 2 2 1 2 3 1 2 1 2 1 3 1 3 1 3 3 2 2 2 1 1 3 2 2 3 3 3 2 2 3 3 3 2 3 2 1 2 2 1 1 2 1 1 1 3 2 2 1 3 3 1 3 1 3 3 3 2 1

output:

30
2 10 51
6 15 57
9 18 61
11 19 62
12 24 65
20 30 67
21 31 69
32 52 80
35 54 84
38 58 85
41 63 87
45 68 89
47 72 91
0 5 49
4 14 56
22 34 71
27 39 77
28 42 78
29 44 79
33 53 83
40 59 86
48 73 93
1 8 55
3 13 50
7 16 74
23 36 60
17 26 75
25 37 66
43 64 90
46 70 88

result:

ok count=30

Test #104:

score: 0
Accepted
time: 0ms
memory: 11840kb

input:

94
3 2 3 2 1 2 1 3 3 2 1 3 2 3 1 3 2 1 2 2 2 3 3 1 3 3 1 2 1 1 1 2 3 2 1 2 2 2 2 2 3 1 3 3 2 3 3 3 1 1 1 2 1 1 1 3 3 3 1 1 3 1 3 1 2 3 3 2 1 1 2 3 2 1 2 2 3 1 3 3 1 1 1 3 2 3 1 2 2 2 2 3 1 1

output:

29
4 5 56
6 9 57
10 18 60
17 33 66
23 37 71
28 51 78
29 64 79
41 75 85
0 1 54
7 12 58
8 16 59
11 19 61
21 35 68
22 36 69
24 38 73
32 70 81
42 84 86
45 88 92
46 89 93
2 3 63
14 27 55
13 20 77
26 44 62
15 67 80
30 31 65
25 39 82
34 72 76
53 74 83
52 87 91

result:

ok count=29

Test #105:

score: 0
Accepted
time: 2ms
memory: 12088kb

input:

96
2 3 2 1 1 1 1 3 3 2 2 1 2 1 3 3 3 2 3 2 1 3 2 1 2 3 2 2 3 2 1 2 2 1 1 3 1 2 3 3 3 3 3 1 1 2 1 1 2 2 2 1 3 3 1 1 3 2 3 1 1 3 2 1 1 1 2 1 3 2 2 3 3 2 2 3 3 1 1 1 3 1 3 3 3 3 1 3 3 2 2 2 1 1 1 2

output:

28
5 12 61
13 26 68
30 57 82
33 62 83
34 66 84
7 19 64
8 22 65
21 45 78
28 50 81
40 89 92
41 90 93
42 91 94
1 2 59
3 9 58
4 10 71
14 27 60
6 17 72
15 29 63
11 24 75
16 31 67
18 32 77
20 37 76
23 48 80
25 49 79
35 69 86
36 70 85
55 73 87
54 74 88

result:

ok count=28

Test #106:

score: 0
Accepted
time: 0ms
memory: 11832kb

input:

98
2 3 2 1 2 2 1 3 3 3 2 1 3 1 1 2 2 2 2 1 1 2 2 1 2 1 3 2 1 3 3 1 2 1 2 1 1 3 2 1 2 3 1 2 3 3 3 3 2 2 3 1 3 2 1 1 1 3 3 1 3 2 2 1 3 1 3 3 3 1 1 2 1 1 2 3 2 3 2 1 3 1 1 2 3 1 3 3 2 3 3 1 3 1 3 1 3 2

output:

27
6 10 66
14 24 75
19 27 77
23 34 80
28 43 84
31 53 87
33 61 89
35 62 90
9 17 69
12 21 72
26 40 82
29 48 85
1 2 65
3 4 64
7 15 70
11 18 67
8 16 73
13 22 68
20 32 86
30 49 79
25 38 92
37 74 81
36 71 94
41 78 91
39 76 96
44 88 93
60 83 95

result:

ok count=27

Test #107:

score: 0
Accepted
time: 2ms
memory: 11860kb

input:

100
1 3 1 3 1 1 2 3 1 2 2 2 1 3 3 3 3 1 2 3 1 1 3 2 2 2 3 3 2 1 1 3 1 3 2 2 1 1 1 3 1 3 2 3 2 2 2 1 3 3 1 1 1 1 1 3 2 2 2 3 3 2 1 3 2 3 3 1 1 1 2 2 2 2 2 1 1 3 2 3 2 3 1 3 1 1 3 3 2 1 2 2 3 3 3 3 1 1 3 1

output:

30
0 6 55
2 10 60
4 18 63
5 23 65
17 45 79
21 57 83
29 70 87
32 73 93
36 78 95
3 11 62
13 34 69
14 35 75
15 42 76
22 58 84
26 61 85
1 9 67
8 25 59
7 24 68
12 28 66
16 44 82
20 56 77
19 46 89
30 71 81
27 64 96
37 80 86
31 72 97
38 88 92
33 74 99
40 91 94
54 90 98

result:

ok count=30

Test #108:

score: 0
Accepted
time: 0ms
memory: 11796kb

input:

100
1 1 1 1 1 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 2 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

1
0 29 58

result:

ok count=1

Test #109:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

100
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 1 2 2 2 2 2 2

output:

1
29 30 93

result:

ok count=1

Test #110:

score: 0
Accepted
time: 0ms
memory: 11900kb

input:

99
1 1 3 3 2 1 2 2 2 2 1 2 1 3 1 3 3 1 3 3 2 2 2 1 2 2 2 2 2 2 1 2 1 2 3 2 3 2 1 2 1 3 1 2 2 1 2 3 2 2 1 3 2 1 2 3 2 2 1 2 3 1 1 3 3 3 3 3 3 1 1 3 1 3 1 1 1 3 1 1 3 1 3 3 1 3 3 3 2 1 1 3 3 2 3 3 1 2 1

output:

33
0 4 63
1 6 64
5 9 67
10 11 68
14 22 71
23 29 77
38 39 82
40 43 83
42 46 85
45 48 86
53 56 91
58 59 94
13 21 70
15 24 72
18 27 75
19 28 76
36 37 81
41 44 84
51 54 90
2 7 69
12 20 65
3 8 74
17 26 66
16 25 78
30 31 73
32 33 80
34 35 79
47 49 89
50 52 87
55 57 61
92 93 96
60 97 98
62 88 95

result:

ok count=33

Test #111:

score: 0
Accepted
time: 2ms
memory: 12068kb

input:

96
3 2 1 2 3 1 2 1 2 1 2 2 1 1 2 2 3 2 1 3 2 2 1 2 3 2 1 2 3 3 3 3 1 2 2 2 2 2 1 1 1 1 3 1 2 1 1 3 3 1 3 3 1 3 3 1 1 1 3 3 3 1 3 1 1 3 3 1 3 3 3 3 2 1 2 3 2 3 2 3 2 1 2 1 2 3 2 3 2 1 2 3 2 1 2 1

output:

32
2 3 53
12 14 58
13 15 59
26 27 65
32 37 70
38 44 71
40 74 75
41 76 77
46 84 85
49 90 91
0 1 52
24 25 64
29 34 67
48 88 89
50 92 93
51 94 95
4 6 55
5 8 54
7 10 60
16 17 56
9 11 62
19 21 57
18 20 66
28 33 61
22 23 68
30 35 63
31 36 39
69 72 73
42 80 81
43 78 79
45 86 87
47 82 83

result:

ok count=32

Test #112:

score: 0
Accepted
time: 0ms
memory: 11792kb

input:

99
3 2 1 2 1 1 1 3 2 3 1 2 1 2 3 3 3 1 3 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 1 3 1 1 1 1 1 1 3 2 3 2 3 2 2 3 1 2 2 2 2 3 2 1 1 1 3 2 3 2 2 2 3 1 3 2 1 2 3 2 2 2 2 2 2 2 1 1 3 1 1 3 3 2 3 2 2 2 3 2 2 3 1 3 1

output:

33
6 13 42
10 47 49
22 65 68
30 78 85
31 79 86
32 87 88
33 89 92
34 90 95
36 93 97
0 1 38
15 52 57
16 53 58
23 69 70
25 73 80
26 74 81
29 77 84
35 91 96
2 3 7
39 43 44
4 8 9
40 45 46
5 11 14
41 51 55
12 56 60
18 48 50
17 61 62
19 54 59
20 63 67
21 64 66
24 76 83
28 71 72
27 94 98
37 75 82

result:

ok count=33

Test #113:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

93
3 2 3 2 3 2 1 2 3 2 3 2 3 2 3 1 3 1 3 1 1 1 3 3 1 3 3 3 1 1 3 1 1 1 3 3 1 3 3 1 2 2 3 1 1 2 3 2 1 3 3 1 3 2 2 2 2 2 2 2 3 2 3 3 1 1 1 3 1 2 2 3 1 2 1 2 1 2 3 2 2 1 1 2 2 2 2 2 3 1 1 1 1

output:

31
15 41 50
17 47 52
19 54 62
20 55 63
24 59 67
33 83 88
2 3 39
8 9 44
12 13 48
16 45 51
22 57 65
23 58 66
25 61 68
27 70 72
34 84 89
35 85 90
37 87 92
0 1 43
6 7 38
4 5 21
42 56 64
10 11 28
46 73 74
14 75 76
29 40 49
18 79 81
31 53 60
26 80 82
32 69 71
30 86 91
36 77 78

result:

ok count=31

Test #114:

score: 0
Accepted
time: 2ms
memory: 11832kb

input:

90
3 3 3 3 2 2 2 2 3 2 1 2 3 2 3 2 1 1 2 2 3 3 2 2 1 3 2 2 1 2 1 1 3 1 3 2 3 3 3 1 1 1 3 1 3 2 3 1 1 3 1 2 1 1 3 3 3 1 2 1 1 2 1 3 3 3 1 1 3 1 2 2 1 2 1 3 2 3 2 2 3 1 2 1 2 1 2 1 2 3

output:

30
16 18 56
28 29 64
30 35 65
33 58 68
39 76 77
40 78 80
0 4 47
1 5 48
3 7 50
8 9 52
20 22 59
21 23 60
32 51 67
34 61 69
36 70 72
37 71 74
42 82 83
44 86 87
2 6 53
10 11 49
12 13 57
17 19 54
14 15 62
24 26 55
25 27 66
31 45 63
38 79 81
41 73 75
43 88 89
46 84 85

result:

ok count=30

Test #115:

score: 0
Accepted
time: 2ms
memory: 11904kb

input:

100
2 1 2 2 2 3 2 2 1 2 1 2 2 1 2 2 2 2 1 2 2 3 2 2 2 2 2 1 2 2 2 3 3 1 1 1 1 1 1 1 3 3 3 1 1 3 1 1 1 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 3 3 2 3 2 2 1 2 2 3 2 2 2 2 2 2 3 1 2 1 1 1 1 2 2 3 2 2 3 2 2 2 2 1 2 2

output:

20
10 11 61
18 19 63
27 28 65
33 69 73
34 71 80
32 68 70
42 82 97
1 2 59
5 6 58
8 9 64
21 22 60
13 14 31
62 66 67
35 72 89
40 78 81
36 74 92
41 79 83
56 75 84
55 76 85
54 77 86

result:

ok count=20

Test #116:

score: 0
Accepted
time: 0ms
memory: 11844kb

input:

99
2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 3 2 2 2 2 2 3 2 1 2 3 2 2 2 2 2 2 1 1 1 1 1 3 3 1 1 3 3 1 1 3 1 1 3 3 1 1 1 3 3 1 1 3 1 1 1 3 3 3 3 3 2 2 3 3 1 2 3 2 2 2 1 2 1 3 1 1 2 1 2 1 1 1 2 3 2 2 2 2 2 1 1 2

output:

18
7 8 65
9 10 66
35 72 80
38 76 84
39 78 86
43 91 96
16 17 71
24 25 69
22 23 77
33 67 70
26 27 79
34 68 73
36 89 90
42 74 81
64 75 82
63 83 87
62 85 88
58 92 97

result:

ok count=18

Test #117:

score: 0
Accepted
time: 2ms
memory: 12068kb

input:

98
3 2 2 2 2 2 2 3 3 2 2 2 1 2 1 2 2 2 2 2 2 3 1 3 1 3 2 3 2 1 2 2 1 1 1 3 3 3 3 1 3 1 1 1 3 3 1 3 3 3 1 3 1 3 3 1 3 3 1 1 3 3 3 3 2 2 2 2 2 2 2 2 2 1 3 2 2 2 3 2 2 2 2 3 2 1 2 2 2 2 2 2 2 2 2 2 2 1

output:

15
22 28 61
24 31 63
29 66 78
32 67 83
0 1 55
25 64 73
7 9 58
12 13 56
8 10 59
14 15 57
21 26 33
60 68 85
23 30 34
62 69 97
52 65 74

result:

ok count=15

Test #118:

score: 0
Accepted
time: 2ms
memory: 11852kb

input:

97
2 2 1 3 2 2 1 2 2 2 1 2 1 1 1 1 2 2 3 2 3 1 2 2 2 3 2 3 3 2 2 2 1 3 1 1 1 1 1 1 1 1 3 3 3 1 3 1 1 1 1 3 1 1 1 3 1 3 1 3 1 1 3 1 2 2 1 2 1 2 2 2 2 2 1 3 2 2 1 3 1 2 3 1 2 2 1 2 2 2 2 3 3 2 2 1 1

output:

21
2 4 57
6 7 59
13 17 62
21 26 75
32 64 82
35 69 91
36 70 92
3 5 58
18 23 68
20 24 74
25 29 78
28 31 80
33 65 83
10 11 79
27 30 60
12 16 55
14 19 51
15 22 46
44 67 86
43 71 95
42 72 96

result:

ok count=21

Test #119:

score: 0
Accepted
time: 2ms
memory: 11836kb

input:

99
1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

33
0 33 66
1 34 67
2 35 68
3 36 69
4 37 70
5 38 71
6 39 72
7 40 73
8 41 74
9 42 75
10 43 76
11 44 77
12 45 78
13 46 79
14 47 80
15 48 81
16 49 82
17 50 83
18 51 84
19 52 85
20 53 86
21 54 87
22 55 88
23 56 89
24 57 90
25 58 91
26 59 92
27 60 93
28 61 94
29 62 95
30 63 96
31 64 97
32 65 98

result:

ok count=33

Test #120:

score: 0
Accepted
time: 0ms
memory: 11904kb

input:

99
3 2 3 3 1 2 1 1 1 1 2 2 3 1 3 1 3 3 2 3 3 2 3 3 1 2 3 3 1 1 1 2 1 1 1 1 3 1 1 2 1 2 1 2 3 3 2 3 1 2 2 1 2 3 3 3 1 3 2 2 2 2 2 2 2 2 3 3 1 2 2 2 1 3 3 1 3 2 2 3 2 2 3 2 1 2 1 3 1 3 3 1 2 1 1 3 1 3 1

output:

33
7 21 53
8 25 54
9 31 55
13 41 57
15 46 67
24 61 79
29 65 87
32 70 89
33 71 90
37 81 95
40 85 97
12 39 56
16 49 68
17 50 72
22 59 75
27 63 84
36 80 94
0 1 48
4 11 44
2 5 51
6 18 45
3 10 28
47 64 86
14 69 88
30 43 66
19 77 91
34 52 73
20 78 93
35 58 74
23 83 96
38 60 76
26 92 98
42 62 82

result:

ok count=33

Test #121:

score: 0
Accepted
time: 2ms
memory: 11844kb

input:

96
3 3 3 2 2 1 2 3 1 3 3 1 3 2 1 2 1 3 2 1 2 1 2 1 2 2 2 1 1 1 3 2 3 3 3 3 1 2 3 3 1 1 3 2 3 1 3 1 2 3 1 3 2 2 2 1 1 1 2 2 1 1 2 3 3 2 1 2 2 1 2 2 2 3 3 3 1 3 3 2 2 3 1 3 2 1 2 3 1 1 2 3 1 1 1 3

output:

32
14 26 63
16 31 64
21 48 73
23 52 74
27 53 75
29 58 77
36 70 87
40 79 91
45 90 95
1 4 47
9 20 56
10 22 57
12 25 61
17 37 66
33 65 82
35 68 85
38 71 88
39 72 89
42 84 93
44 86 94
0 3 50
5 13 46
2 6 55
8 18 49
7 15 60
11 24 51
19 43 78
30 59 69
28 54 81
32 62 76
34 67 92
41 80 83

result:

ok count=32

Test #122:

score: 0
Accepted
time: 0ms
memory: 11900kb

input:

3000
2 3 2 3 3 1 2 3 1 3 2 1 1 2 3 2 2 2 3 1 2 1 3 2 3 2 1 2 3 3 2 1 3 3 3 3 3 3 2 1 1 2 2 1 1 2 3 1 1 2 2 3 3 1 2 2 3 2 1 1 1 3 1 2 2 3 3 1 1 1 3 2 1 2 1 3 2 2 1 1 2 3 3 3 3 2 3 1 2 2 3 2 3 1 3 3 3 3 1 3 2 2 2 2 1 3 2 2 2 1 2 2 3 2 2 1 1 1 1 1 2 3 2 1 2 3 3 3 2 3 3 3 3 2 3 2 2 2 2 1 3 3 1 1 1 1 2 3...

output:

999
5 13 1486
11 20 1490
12 23 1491
19 30 1495
31 54 1510
43 80 1529
58 106 1544
59 107 1545
62 111 1549
67 120 1554
68 122 1555
69 124 1556
78 137 1563
79 138 1565
87 161 1572
98 184 1584
109 207 1591
115 211 1595
116 212 1596
118 214 1602
142 263 1624
143 266 1625
144 277 1626
157 310 1641
159 313...

result:

ok count=999

Test #123:

score: 0
Accepted
time: 0ms
memory: 11852kb

input:

2997
1 3 1 3 2 1 3 3 2 2 2 1 1 2 3 3 3 1 3 2 3 3 2 1 2 3 1 2 2 2 2 1 3 3 2 1 2 2 3 2 2 2 2 1 3 1 3 3 3 3 1 3 3 1 3 1 3 2 3 1 2 3 1 2 2 3 3 1 3 3 3 3 3 3 1 1 1 3 3 1 3 3 1 1 1 3 2 3 3 2 3 3 3 1 3 3 2 1 1 1 2 1 1 1 1 3 3 3 3 2 3 1 3 3 2 1 3 1 3 1 1 3 2 1 2 3 1 2 2 2 3 1 3 2 2 3 2 3 3 3 1 2 3 2 1 1 3 1...

output:

995
17 34 1506
23 40 1514
26 42 1516
31 57 1517
45 100 1531
50 127 1536
55 136 1544
67 170 1555
75 185 1565
79 209 1570
93 255 1585
98 273 1591
99 278 1592
103 285 1595
115 307 1610
117 313 1615
119 333 1617
126 343 1622
140 367 1632
145 380 1635
147 382 1639
160 407 1659
161 409 1660
162 410 1664
1...

result:

ok count=995

Test #124:

score: 0
Accepted
time: 0ms
memory: 11800kb

input:

3000
1 1 1 1 1 3 1 1 3 3 1 3 1 1 2 3 1 1 2 1 2 1 3 3 3 1 1 2 1 2 2 3 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 3 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 3 3 2 1 3 1 1 2 3 1 2 3 1 1 1 2 1 1 1 1 2 3 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 3 1 3 3 1 1 1 1 3 1 1 2 1 1 1 3 3 1 1 1 1 2 1 1 1 1 1 2 3 3 1...

output:

499
3 27 2420
6 39 2425
7 46 2426
17 92 2437
34 176 2451
35 181 2452
36 188 2453
58 281 2472
62 291 2475
63 296 2476
65 311 2478
68 314 2480
118 578 2527
121 597 2531
134 641 2544
135 643 2545
136 645 2546
140 669 2549
147 707 2558
154 742 2566
156 762 2568
159 768 2572
161 774 2574
165 788 2577
173...

result:

ok count=499

Test #125:

score: 0
Accepted
time: 0ms
memory: 11872kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1
0 1374 2901

result:

ok count=1

Test #126:

score: 0
Accepted
time: 0ms
memory: 11848kb

input:

3000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
1755 1756 2819

result:

ok count=1

Test #127:

score: 0
Accepted
time: 2ms
memory: 11892kb

input:

1500
1 1 1 2 1 1 1 2 2 2 2 2 1 1 3 1 2 2 3 1 2 2 2 2 1 2 1 2 1 1 3 1 2 2 2 2 1 1 3 1 1 2 2 3 2 1 3 1 1 2 2 2 1 2 2 2 2 2 1 2 3 2 3 2 3 2 1 3 2 1 2 3 2 2 3 2 3 1 1 3 1 3 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 1 3 1 1 1 1 1 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 1 3 1...

output:

500
1 7 542
4 9 544
5 10 545
12 16 547
15 21 550
26 27 554
31 35 558
36 41 559
40 50 563
58 59 570
69 72 577
77 450 581
78 490 582
80 583 601
86 589 607
90 593 611
97 618 619
98 620 728
99 621 729
103 625 733
106 628 739
113 635 746
114 636 747
115 637 748
124 646 757
125 647 758
137 659 770
143 665...

result:

ok count=500

Test #128:

score: 0
Accepted
time: 2ms
memory: 12124kb

input:

3000
3 1 1 1 1 3 3 2 1 1 1 2 3 1 3 3 3 3 1 1 3 1 3 3 1 1 1 1 1 3 3 1 1 1 1 3 1 3 1 1 3 3 3 3 1 3 1 3 1 3 1 3 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 3 1 1 1 1 3 1 1 1 3 3 1 2 3 3 1 3 3 3 3 3 3 3 1 1 1 1 3 1 3 1 3 3 3 3 1 3 1 1 3 3 1 1 1 3 3 1 3 3 1 3 1 3 1 3 2 3 1 3 1 1 3 1 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2...

output:

1000
1 11 1888
3 122 1890
8 141 1894
9 142 1895
21 153 1907
25 157 1911
27 159 1913
31 163 1917
33 165 1919
34 166 1920
36 168 1922
46 178 1932
53 185 1939
61 193 1947
68 200 1954
73 205 1959
74 206 1960
75 207 1961
82 213 1967
90 221 1975
91 222 1976
92 223 1977
95 226 1980
97 228 1982
102 233 1987...

result:

ok count=1000

Test #129:

score: 0
Accepted
time: 2ms
memory: 11916kb

input:

3000
1 3 1 1 3 1 1 1 1 3 1 1 3 1 1 1 3 3 3 3 3 1 1 3 1 1 3 1 3 3 1 2 2 3 1 3 3 3 1 3 3 2 3 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 3 1 1 1 1 3 1 1 1 3 1 1 1 1 1 3 3 3 3 3 1 3 3 3 1 1 1 3 1 1 3 1 1 3 1 3 3 3 1 1 1 3 3 3 3 3 1 1 1...

output:

1000
0 31 1618
2 41 1620
7 55 1625
8 56 1626
10 58 1628
11 59 1629
13 61 1631
14 62 1632
15 63 1633
43 88 1658
47 92 1662
48 93 1663
96 183 1667
101 203 1672
103 205 1674
106 208 1677
107 209 1678
111 213 1682
113 215 1684
119 221 1690
125 227 1696
131 233 1702
133 235 1704
137 239 1708
138 240 1709...

result:

ok count=1000

Test #130:

score: 0
Accepted
time: 3ms
memory: 11900kb

input:

2997
3 1 2 2 1 1 1 1 1 1 3 1 3 3 1 3 3 3 1 3 1 2 1 1 3 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 1 1 3 1 3 1 1 3 3 1 3 1 3 3 3 1 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 1 3 1 1 1 1 1 3 3 3 1 3 1 1 3 3 3 1 3 3 1 1 1 3 1 1 3 1 1 3 2 3 3 3 2 3 2 3 1 2 1 1 3 1 1 3 2 2 2 2...

output:

999
6 27 1219
8 31 1221
11 34 1224
14 37 1227
18 41 1231
22 44 1234
23 45 1235
25 47 1237
56 79 1246
59 82 1249
62 85 1252
64 87 1254
69 92 1259
70 93 1260
98 134 1265
100 144 1267
101 145 1268
102 146 1269
103 147 1270
108 152 1275
110 154 1277
118 162 1285
120 164 1287
122 166 1289
123 167 1290
12...

result:

ok count=999

Test #131:

score: 0
Accepted
time: 0ms
memory: 11904kb

input:

2994
1 1 2 1 2 1 2 2 3 1 3 3 3 3 1 3 1 1 2 3 3 1 3 3 3 3 1 1 1 3 3 2 3 1 3 1 3 3 1 2 3 1 3 3 3 1 3 1 3 2 3 2 1 1 3 1 1 1 3 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 2 3 3 3 3 3 3 1 3 1 3 1 1 2 1 3 3 3 2 2 3 2 1 3 3 3 1 2 1 1 2 3 3 1 3 2 2 2 2 2 2 2 2...

output:

998
0 2 1925
3 6 1927
5 7 1928
9 31 1930
16 63 1937
21 67 1941
33 78 1952
35 80 1954
38 83 1957
41 85 1959
45 89 1963
47 91 1965
55 97 1971
57 99 1973
114 144 1987
116 146 1989
117 147 1990
119 148 1991
127 153 1996
131 157 2000
133 158 2001
134 159 2002
164 179 2007
167 202 2010
173 208 2016
181 21...

result:

ok count=998

Test #132:

score: 0
Accepted
time: 3ms
memory: 12052kb

input:

3000
1 1 1 3 2 3 2 3 1 1 1 1 2 3 1 2 1 2 1 3 3 2 2 3 3 2 3 2 2 3 3 3 3 3 1 3 2 1 2 3 2 3 3 3 2 1 3 3 3 2 1 1 1 1 2 1 3 1 3 2 2 2 1 2 3 3 3 2 1 3 1 3 2 3 1 3 2 3 3 1 2 1 2 2 3 1 3 2 2 1 1 2 3 1 1 3 1 3 2 2 3 2 2 1 3 2 2 2 3 3 2 3 1 2 2 1 1 1 2 3 2 1 3 2 1 1 1 3 3 1 3 1 3 2 2 1 1 1 1 2 1 2 3 1 2 1 2 2...

output:

1000
1 6 1501
8 22 1508
9 25 1509
10 27 1510
18 44 1517
37 87 1537
51 110 1558
57 123 1564
62 134 1566
74 156 1578
85 183 1586
89 190 1590
93 195 1594
96 199 1598
112 215 1611
116 220 1613
121 227 1616
125 237 1620
129 246 1626
131 258 1628
135 263 1631
137 267 1634
138 268 1635
140 269 1637
143 277...

result:

ok count=1000

Test #133:

score: 0
Accepted
time: 2ms
memory: 12124kb

input:

3000
2 2 1 3 2 2 2 3 2 2 2 2 2 1 2 2 2 2 2 1 3 2 2 2 2 3 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 1 2 3 2 3 1 2 2 3 2 3 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 3 2 2 1 2 3 2 1 3 3 2 3 2 2 2 3 1 2 2 2 2 1 2 3 3 1 2 1 1 2 2 2 1 2 2 2 2 2 2 1 2 3 1 2 1 2 2 3 2 2 2 2 2 2 2 2 2 3 1 2 2 2 2 3 2 3 3 1 2 2 1 2...

output:

673
2 4 1672
13 14 1675
32 34 1679
49 50 1683
73 74 1690
79 80 1692
83 86 1694
97 98 1700
101 106 1703
103 107 1704
104 109 1705
108 110 1706
118 121 1709
134 136 1713
150 153 1719
158 159 1723
160 161 1724
181 182 1728
185 190 1730
196 199 1736
222 225 1744
232 233 1746
245 248 1747
273 274 1760
27...

result:

ok count=673

Test #134:

score: 0
Accepted
time: 0ms
memory: 11916kb

input:

2999
2 2 3 3 2 1 2 1 1 2 2 3 2 3 2 3 2 2 2 1 2 3 2 2 2 2 1 3 2 3 3 2 1 2 3 2 2 2 2 1 2 2 2 2 2 3 2 2 3 1 2 2 2 3 2 2 2 3 3 2 2 2 3 3 3 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 3 2 2 3 3 3 1 1 2 2 3 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 3 3 1 1 2 2 2 2 1 1 2 2 3 2 3 2 3 2 2 2 3 2 2 2 1 2 1 3 2 3 2 2 2 1...

output:

683
5 9 1646
7 10 1647
19 20 1652
26 28 1654
32 36 1658
39 40 1660
49 51 1663
66 70 1670
67 72 1671
74 76 1673
75 77 1674
81 82 1675
92 98 1681
99 101 1683
108 109 1684
112 113 1685
138 139 1696
147 149 1700
148 150 1701
158 159 1704
168 172 1705
171 177 1708
195 196 1714
218 222 1721
219 223 1722
2...

result:

ok count=683

Test #135:

score: 0
Accepted
time: 0ms
memory: 11888kb

input:

2998
2 1 2 1 3 2 2 2 2 2 2 2 1 2 2 2 2 3 3 2 1 2 1 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 3 1 3 2 2 1 2 2 2 3 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 3 2 1 2 3 2 2 3 3 2 2 2 2 1 2 1 2 2 2 2 3 2 3 3 3 1 2 2 2 2 2 3 2 2 2 1 2 2 2 2 2 2 2 3 2 2 3 3 2 1 1 2 2 3 3 2 1 2 2 2 2 2 2 2 2 3 2 1 2 1 2 2 3 1 2 3 2 2 2 2...

output:

629
3 5 1683
20 23 1688
47 50 1696
117 120 1717
118 123 1718
135 136 1723
137 138 1724
154 156 1730
158 159 1731
167 169 1733
168 170 1734
174 175 1735
176 177 1736
187 188 1738
229 230 1751
232 233 1752
237 238 1753
243 244 1754
281 282 1767
294 296 1768
305 307 1774
343 348 1787
344 349 1788
355 3...

result:

ok count=629

Test #136:

score: 0
Accepted
time: 2ms
memory: 11896kb

input:

2997
1 1 3 2 3 3 2 2 1 2 2 2 2 2 2 1 3 3 2 2 2 3 2 2 2 2 3 2 1 3 2 3 2 3 2 3 3 2 2 2 2 2 2 2 1 1 2 2 3 3 2 1 2 2 3 3 2 2 1 1 1 2 1 2 1 2 2 1 2 1 3 1 3 3 1 2 2 2 2 2 2 1 2 2 2 3 2 2 3 2 2 1 2 2 3 2 1 2 2 2 3 2 2 1 3 1 2 2 2 1 3 2 2 1 2 3 2 3 1 3 2 2 3 2 2 2 2 1 2 2 2 1 1 2 3 2 2 2 3 2 3 1 2 2 3 2 2 2...

output:

712
0 3 1641
28 30 1652
44 46 1658
45 47 1659
51 53 1662
58 61 1665
60 65 1667
62 66 1668
64 68 1669
71 78 1673
74 82 1676
81 83 1677
91 92 1680
96 97 1682
103 106 1684
113 114 1689
127 128 1695
164 165 1705
187 189 1713
200 203 1718
201 204 1719
221 222 1726
239 241 1732
275 282 1746
278 287 1749
2...

result:

ok count=712

Test #137:

score: 0
Accepted
time: 3ms
memory: 11908kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1000
0 1000 2000
1 1001 2001
2 1002 2002
3 1003 2003
4 1004 2004
5 1005 2005
6 1006 2006
7 1007 2007
8 1008 2008
9 1009 2009
10 1010 2010
11 1011 2011
12 1012 2012
13 1013 2013
14 1014 2014
15 1015 2015
16 1016 2016
17 1017 2017
18 1018 2018
19 1019 2019
20 1020 2020
21 1021 2021
22 1022 2022
23 102...

result:

ok count=1000

Test #138:

score: 0
Accepted
time: 56ms
memory: 14196kb

input:

600000
1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
0 2 599999

result:

ok count=1

Test #139:

score: 0
Accepted
time: 366ms
memory: 24164kb

input:

600000
1 1 3 1 2 1 2 3 2 1 1 2 3 2 2 1 2 1 1 3 2 1 1 2 1 3 3 3 1 2 3 3 1 1 1 3 1 3 2 2 1 3 3 2 3 2 3 2 2 2 1 1 1 1 2 3 1 1 1 2 1 1 1 3 3 3 3 3 1 1 3 2 3 2 2 3 2 1 2 3 2 1 3 3 3 3 3 1 1 1 3 3 1 1 1 3 3 2 2 1 2 3 2 2 3 3 2 2 2 2 3 1 1 2 1 1 2 1 1 3 3 3 1 3 3 1 2 2 3 2 2 1 2 1 1 1 1 2 1 2 1 3 1 2 2 1 3...

output:

200000
1 6 299951
3 11 299954
18 39 299966
22 47 299972
24 48 299973
28 71 299977
32 76 299980
33 78 299981
36 98 299985
40 102 299987
50 109 299994
52 116 299998
56 129 300002
58 132 300004
60 137 300008
61 139 300011
62 143 300012
68 166 300020
69 167 300021
77 172 300026
81 174 300030
87 192 3000...

result:

ok count=200000

Test #140:

score: 0
Accepted
time: 351ms
memory: 24056kb

input:

600000
3 1 2 3 3 2 1 1 1 2 3 2 2 3 3 3 2 2 2 2 2 3 1 3 3 1 2 1 3 1 3 1 2 3 3 3 1 1 2 1 2 1 1 3 1 3 1 2 1 1 3 2 2 2 3 2 2 2 1 1 1 3 2 1 1 1 2 3 1 2 1 1 2 3 3 3 2 3 2 2 2 1 1 2 3 1 2 1 3 2 2 3 1 1 3 1 2 2 2 1 3 3 3 1 1 2 1 1 3 3 3 2 2 3 1 2 2 1 3 1 1 2 3 3 3 3 3 1 1 3 3 3 2 1 1 3 3 2 2 2 3 2 2 3 1 1 3...

output:

200000
8 17 299989
22 38 299997
25 51 300001
29 55 300004
31 57 300007
42 80 300018
46 90 300025
48 96 300026
60 115 300038
64 132 300044
65 137 300045
68 139 300048
70 141 300049
71 142 300050
82 158 300057
85 160 300059
87 161 300060
93 173 300064
103 197 300075
106 221 300077
107 222 300079
114 2...

result:

ok count=200000

Test #141:

score: 0
Accepted
time: 19ms
memory: 12780kb

input:

210000
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 2 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 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 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

4999
5 156 204894
16 613 204905
24 849 204913
47 1759 204935
114 4421 205000
347 13436 205234
395 15208 205281
429 17071 205315
456 17981 205342
481 18927 205366
522 20816 205407
528 20989 205413
545 21570 205429
585 22924 205466
598 23272 205479
645 25341 205525
692 27555 205571
784 31636 205661
80...

result:

ok count=4999

Test #142:

score: 0
Accepted
time: 3ms
memory: 12088kb

input:

15000
1 2 1 1 1 2 3 1 2 3 3 3 2 2 1 2 1 3 3 2 3 2 1 1 2 3 3 1 1 2 1 3 2 3 1 1 2 2 2 1 3 1 2 3 3 2 2 1 2 3 3 2 2 2 2 3 3 3 2 3 3 2 1 2 3 3 1 3 3 1 1 3 3 3 2 3 2 1 3 1 1 2 1 3 1 2 1 1 2 1 2 3 2 2 3 3 2 2 1 3 3 2 3 1 2 2 3 3 2 3 1 3 1 1 3 1 3 3 1 3 1 2 2 2 1 3 1 3 2 2 2 2 3 2 1 2 2 3 3 1 2 3 1 1 3 1 2 ...

output:

5000
0 1 7454
7 15 7465
14 29 7470
16 32 7475
27 51 7490
28 52 7491
30 53 7492
34 61 7498
39 74 7501
41 81 7503
62 108 7520
69 130 7527
70 131 7528
77 146 7535
79 148 7538
82 156 7541
84 171 7546
86 175 7548
87 179 7550
89 186 7551
112 228 7574
113 233 7575
118 256 7581
120 258 7583
124 262 7584
134...

result:

ok count=5000

Test #143:

score: 0
Accepted
time: 365ms
memory: 24392kb

input:

600000
3 2 1 3 1 1 2 3 1 1 2 1 2 2 1 1 2 1 1 2 2 2 1 2 3 3 2 2 1 2 3 1 2 1 2 2 3 2 2 1 3 1 2 2 3 1 2 1 2 3 1 2 1 1 2 3 2 2 2 1 2 3 3 1 2 1 3 2 3 1 3 2 1 2 3 2 1 1 3 1 2 3 2 1 2 3 1 3 2 1 1 1 2 2 1 1 1 2 1 3 2 2 2 3 2 2 2 3 1 2 1 3 2 3 3 2 3 1 1 3 3 3 1 1 3 1 1 1 1 1 2 1 3 2 2 3 1 2 1 1 1 2 2 1 2 2 2...

output:

200000
2 6 299821
5 13 299830
11 21 299834
14 23 299837
17 27 299840
22 32 299844
28 37 299847
41 54 299859
47 58 299863
50 64 299866
53 71 299870
65 88 299877
77 105 299887
86 133 299893
90 141 299897
91 142 299901
96 146 299907
98 148 299908
108 168 299921
117 182 299929
123 201 299936
125 205 299...

result:

ok count=200000

Test #144:

score: 0
Accepted
time: 272ms
memory: 23932kb

input:

600000
1 1 3 3 1 1 3 1 3 1 3 3 1 3 3 1 3 3 1 3 1 3 3 3 3 1 3 1 3 3 1 1 1 1 3 1 1 3 3 1 3 1 1 1 3 3 3 3 1 3 1 3 1 3 3 1 1 3 3 3 3 3 1 1 1 1 3 1 1 3 3 3 3 1 1 1 3 1 3 3 1 1 3 1 3 1 1 3 1 1 3 3 3 3 1 1 3 3 1 1 3 3 1 1 1 1 3 3 3 1 1 1 1 1 3 1 1 3 1 1 3 1 1 3 1 3 1 3 3 1 3 3 1 1 1 1 3 1 3 3 3 3 1 3 3 1 1...

output:

200000
1 2611 351502
5 11205 351506
9 11343 351510
18 11352 351519
20 11354 351521
27 11361 351528
31 11365 351532
32 11366 351533
33 11367 351534
52 11386 351553
55 11389 351556
56 11390 351557
65 11399 351566
67 11401 351568
73 11407 351574
80 11414 351581
81 11415 351582
85 11419 351586
86 11420 ...

result:

ok count=200000

Test #145:

score: 0
Accepted
time: 263ms
memory: 24188kb

input:

600000
3 1 3 3 3 1 1 1 1 3 3 1 3 1 3 1 1 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 1 1 3 3 3 1 1 1 3 3 1 1 3 3 1 1 3 1 1 1 1 1 3 3 1 1 1 3 1 3 3 3 1 1 3 3 1 3 1 1 3 3 1 3 1 3 3 3 1 1 3 3 3 1 1 1 3 3 1 1 1 3 3 1 1 3 1 3 1 1 3 3 1 1 1 3 1 1 1 3 1 1 3 3 3 3 1 1 1 1 1 3 3 1 3 3 1 1 1 1 1 3 1 3 3 1 1 3 1 3 1...

output:

200000
1 8232 338542
8 10460 338549
13 10465 338554
15 10467 338556
16 10468 338557
36 10488 338577
43 10495 338584
46 10498 338587
47 10499 338588
50 10502 338591
53 10505 338594
54 10506 338595
55 10507 338596
56 10508 338597
57 10509 338598
61 10513 338602
64 10516 338605
68 10520 338609
72 10524...

result:

ok count=200000

Test #146:

score: 0
Accepted
time: 256ms
memory: 26368kb

input:

600000
1 3 3 3 1 3 1 3 1 1 3 1 3 1 3 3 3 1 1 1 3 1 1 1 3 1 3 3 3 1 3 3 3 3 3 3 1 1 1 3 3 3 1 1 3 3 3 3 3 1 3 3 3 3 1 3 3 3 3 1 1 1 1 1 3 3 3 3 1 1 1 3 3 1 1 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 1 3 1 3 3 1 1 3 3 3 1 1 3 1 3 3 1 1 1 3 3 1 1 1 1 3 1 3 1 1 1 3 1 3 3 3 1 3 3 1 1 3 1 1 3 3 1 1 1 3 3 1 1 3 1 3 3...

output:

200000
0 619 342941
4 1759 342945
8 2521 342949
11 2526 342952
13 2528 342954
19 2534 342960
21 2536 342962
23 2538 342964
37 2552 342978
59 2574 343000
62 2577 343003
68 2583 343009
69 2584 343010
74 2589 343015
78 2593 343019
79 2594 343020
86 2601 343027
90 2605 343031
92 2607 343033
96 2611 3430...

result:

ok count=200000

Test #147:

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

input:

60000
1 1 1 3 3 1 3 3 1 1 1 3 1 3 1 3 1 3 1 1 1 1 3 3 1 1 1 3 1 1 3 1 1 3 3 1 3 3 3 1 1 1 3 1 1 3 1 1 1 3 3 3 3 3 1 3 3 1 1 1 1 1 1 3 3 1 1 1 3 1 1 3 1 1 1 3 3 3 3 1 1 1 1 1 3 3 3 1 3 3 1 3 3 1 3 1 3 3 1 1 3 1 3 1 3 1 3 1 3 3 3 3 3 3 1 1 3 3 3 1 1 1 1 1 1 1 3 3 3 3 1 1 3 3 3 3 3 3 3 1 1 1 3 3 3 3 1 ...

output:

20000
0 167 27463
1 289 27464
5 397 27468
9 428 27472
10 433 27473
16 439 27479
32 455 27496
39 462 27503
41 464 27505
46 469 27510
47 470 27511
54 477 27518
57 480 27521
61 484 27525
65 488 27529
70 493 27534
72 495 27536
83 506 27547
87 510 27551
93 516 27557
98 521 27562
99 522 27563
101 524 2756...

result:

ok count=20000

Test #148:

score: 0
Accepted
time: 34ms
memory: 15180kb

input:

90000
3 1 1 3 3 1 3 3 3 3 3 3 1 1 3 3 1 1 1 3 3 1 3 1 1 1 3 3 3 3 3 1 1 1 1 1 1 1 3 3 3 1 1 3 3 3 1 1 1 3 3 1 3 1 1 1 3 1 1 3 3 3 1 1 1 1 3 3 3 3 1 1 1 1 1 1 1 3 3 3 3 3 3 1 1 1 3 1 1 3 3 1 1 3 3 1 1 3 3 1 1 3 3 1 1 1 1 3 1 3 3 1 3 1 1 3 1 3 3 1 3 3 3 1 3 1 3 1 3 1 3 1 3 1 3 3 3 1 1 3 3 3 3 1 3 3 1 ...

output:

30000
2 283 31572
5 315 31575
12 325 31582
13 326 31583
21 334 31591
23 336 31593
25 338 31595
34 347 31604
41 354 31611
51 364 31621
57 370 31627
58 371 31628
70 383 31640
71 384 31641
72 385 31642
73 386 31643
74 387 31644
75 388 31645
76 389 31646
83 396 31653
84 397 31654
85 398 31655
92 405 316...

result:

ok count=30000

Test #149:

score: 0
Accepted
time: 46ms
memory: 17812kb

input:

120000
3 3 1 3 3 3 3 3 3 1 3 1 1 3 1 1 1 3 1 3 3 3 3 3 1 1 1 1 1 1 1 3 3 1 3 3 3 1 1 1 3 3 1 1 1 3 1 1 3 1 1 3 3 1 3 1 1 1 1 1 1 3 1 3 1 3 1 1 3 1 3 3 3 3 1 1 1 1 3 3 3 3 3 3 3 3 1 1 3 1 1 1 3 1 3 3 1 1 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 3 3 1 1 3 3 1 1 3 3 1 1 1 3 1 3 3 3 3 1 1 3 1 3 3 1 1 1 1 3 1 3 1...

output:

40000
9 997 62861
12 1000 62864
15 1003 62867
18 1006 62870
26 1014 62878
28 1016 62880
30 1018 62882
38 1026 62890
46 1034 62898
47 1035 62899
50 1038 62902
55 1043 62907
56 1044 62908
57 1045 62909
64 1052 62916
67 1055 62919
75 1063 62927
76 1064 62928
86 1074 62938
89 1077 62941
90 1078 62942
96...

result:

ok count=40000

Test #150:

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

input:

150000
3 3 3 3 1 3 3 1 1 1 3 3 3 1 3 3 1 3 3 3 3 1 3 3 3 1 3 3 3 1 3 1 3 1 1 3 3 1 1 3 1 3 1 3 1 3 3 1 1 1 1 1 1 3 1 1 3 3 1 3 1 3 3 3 3 3 3 1 3 3 3 3 3 1 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 1 3 1 3 1 1 1 1 1 3 1 3 3 1 1 3 1 3 1 1 3 1 3 3 1 1 3 1 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 1 1 2 1 1 1 3 3 1 1 3 1 1 3 1...

output:

50000
9 4664 95289
16 4673 95296
29 4686 95309
31 4688 95311
33 4690 95313
34 4691 95314
37 4694 95317
42 4699 95322
49 4706 95329
51 4708 95331
85 4742 95365
99 4756 95379
103 4760 95383
105 4762 95385
107 4764 95387
114 4771 95394
116 4773 95396
117 4774 95397
122 4779 95402
128 4785 95408
136 479...

result:

ok count=50000

Test #151:

score: 0
Accepted
time: 65ms
memory: 18432kb

input:

150000
1 1 1 1 3 1 3 3 1 1 1 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 3 3 3 3 1 3 1 3 1 1 1 3 1 1 3 3 3 3 3 1 1 1 1 3 3 1 3 1 1 3 3 1 1 1 3 3 1 3 3 3 3 1 3 3 1 1 3 3 1 1 3 1 3 3 1 1 1 3 3 1 3 1 1 1 3 3 3 1 1 1 1 3 3 1 3 3 3 3 1 1 1 3 1 1 1 3 1 1 1 1 1 3 1 3 1 1 1 3 3 1 3 3 1 3 3 1 3 3 3 3 1 3 3 3 3 1 3 3 3 3 1...

output:

50000
1 3463 66976
2 5543 66977
8 6449 66983
9 6450 66984
10 6451 66985
16 6457 66991
18 6459 66993
20 6461 66995
22 6463 66997
30 6471 67005
34 6475 67009
35 6476 67010
39 6480 67014
46 6487 67021
51 6492 67026
58 6499 67033
70 6511 67045
74 6515 67049
77 6518 67052
82 6523 67057
87 6528 67062
88 6...

result:

ok count=50000

Test #152:

score: 0
Accepted
time: 63ms
memory: 16004kb

input:

150000
1 3 3 3 3 3 3 1 1 1 3 1 1 1 1 3 1 1 1 3 1 1 1 3 3 3 1 1 1 3 1 3 1 1 1 1 3 1 3 1 3 1 1 1 3 3 1 1 1 3 3 1 1 1 3 3 3 1 3 3 3 1 3 3 1 3 1 3 3 3 3 1 1 3 3 1 1 1 3 3 3 3 1 3 1 1 3 1 3 3 1 3 3 1 3 1 1 1 1 3 3 1 1 1 3 3 1 1 1 1 3 1 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 3 3 1 1 1 1 3 1 3 1 3 1 1 3 1 1 1 3 1 1...

output:

50000
7 1404 91553
8 1405 91554
9 1406 91555
13 1410 91559
17 1414 91563
20 1417 91566
21 1418 91567
22 1419 91568
27 1424 91573
30 1427 91576
32 1429 91578
35 1432 91581
39 1436 91585
41 1438 91587
46 1443 91592
47 1444 91593
57 1454 91603
61 1458 91607
64 1461 91610
72 1469 91618
76 1473 91622
77 ...

result:

ok count=50000

Test #153:

score: 0
Accepted
time: 201ms
memory: 23872kb

input:

600000
2 2 2 3 2 1 1 3 2 2 2 3 3 1 2 2 2 2 2 3 2 2 2 3 1 1 3 2 2 2 3 1 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 3 2 3 2 1 1 2 2 1 2 2 2 2 3 2 1 2 2 3 2 2 2 1 2 2 3 2 2 1 1 2 2 1 2 1 2 1 2 2 2 1 3 3 3 1 2 2 2 2 2 2 2 3 2 2 3 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 2 3 2 2 2 2 3 2 2 2 2 2 1 2 2 1 2 2 2 3 2 1 2 1 2 2 3 1 2...

output:

133513
5 8 333286
6 9 333287
24 28 333294
40 42 333300
41 43 333301
55 56 333306
69 70 333310
75 77 333312
79 80 333314
81 82 333315
87 92 333317
113 114 333325
117 118 333326
130 131 333329
133 134 333330
149 150 333336
157 158 333339
185 186 333345
202 203 333350
210 211 333352
238 239 333358
246 ...

result:

ok count=133513

Test #154:

score: 0
Accepted
time: 202ms
memory: 22048kb

input:

600000
2 2 2 2 3 1 2 3 2 2 2 1 1 2 2 2 2 2 2 2 2 1 3 2 3 1 3 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 3 1 2 1 2 2 2 3 2 2 2 1 1 3 2 3 3 3 3 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 1 3 3 2 2 3 2 2 3 2 2 3 2 2 2 2 2 3 2 2 2 1 1 2 2 2 2 3 2 1 2 1 2 2 2 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 1 2 2 2 2 1 1 3 2 2 2 2 2 3 2 3 3...

output:

133361
5 8 333325
11 13 333327
12 14 333328
48 50 333337
56 59 333339
79 82 333347
108 109 333357
110 111 333358
114 115 333359
119 120 333360
123 125 333361
124 126 333362
162 164 333377
171 174 333379
204 206 333388
205 207 333389
214 218 333393
219 222 333395
228 231 333399
239 240 333401
246 249...

result:

ok count=133361

Test #155:

score: 0
Accepted
time: 192ms
memory: 22924kb

input:

600000
2 2 2 2 3 2 2 3 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 1 2 2 1 2 3 2 2 3 3 2 2 2 2 2 2 2 1 3 2 3 3 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 3 2 3 3 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 3 2 1 2 2 2 1 3 2 2 1 2 1 2 1 2 2 2 2 3 2 2 2 2 2 2 1 2 2 2 1 2 2 2 1 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 3 1 1...

output:

133217
28 30 333316
31 32 333317
48 50 333322
91 92 333334
95 97 333335
101 102 333338
115 116 333341
119 120 333342
123 124 333343
145 148 333347
158 161 333352
162 164 333353
167 169 333356
177 178 333357
191 192 333361
202 204 333365
210 211 333367
213 216 333369
231 234 333376
237 238 333378
246...

result:

ok count=133217

Test #156:

score: 0
Accepted
time: 187ms
memory: 22768kb

input:

600000
2 2 2 2 2 2 3 3 2 2 3 3 3 1 2 2 1 2 2 2 2 2 2 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 3 2 2 2 2 3 1 3 2 3 2 1 1 2 2 2 1 2 2 2 2 2 3 2 2 2 2 1 2 2 2 2 3 2 1 2 2 3 2 3 2 2 2 2 3 2 3 2 2 2 2 2 2 1 3 2 2 2 2 1 2 2 2 3 1 3 2 2 1 1 2 1 2 2 2 1 1 2 3 1 3 3 2 2 1 2 3 1...

output:

133621
13 18 333342
44 47 333347
57 58 333349
65 69 333352
71 76 333356
128 132 333373
130 133 333374
134 136 333375
143 151 333381
180 181 333390
212 214 333399
216 217 333400
222 223 333402
226 229 333404
237 238 333408
275 276 333421
280 283 333422
291 293 333427
295 298 333430
304 305 333432
317...

result:

ok count=133621

Test #157:

score: 0
Accepted
time: 164ms
memory: 20084kb

input:

470000
2 2 1 3 2 1 1 2 3 3 2 2 2 2 3 2 2 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 2 3 2 2 2 1 2 3 2 3 3 3 2 3 2 2 2 2 3 1 2 3 2 1 1 2 2 2 2 2 2 3 3 2 1 2 1 2 2 2 3 2 2 2 2 3 2 2 3 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 3 3 3 2 2 3 1 3 2 2 2 2 2 1 3 2 2 1 2 2 2 2 2 2 2 2 1 3...

output:

104516
5 10 261140
6 11 261141
70 73 261158
75 78 261161
85 88 261164
125 129 261174
132 134 261176
163 164 261182
166 169 261183
170 174 261186
172 176 261187
180 182 261189
226 227 261195
235 239 261201
242 243 261202
250 251 261205
277 278 261212
285 286 261215
318 319 261226
322 325 261227
337 3...

result:

ok count=104516

Test #158:

score: 0
Accepted
time: 155ms
memory: 20356kb

input:

470000
2 2 2 2 2 3 1 2 2 2 2 2 2 2 2 2 1 1 3 2 1 3 2 2 2 2 2 3 2 3 1 3 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 3 2 2 2 2 2 1 1 2 1 2 2 1 3 2 2 2 3 3 2 2 2 2 2 2 2 2 3 2 2 3 2 2 1 2 2 2 2 2 1 2 2 3 2 1 1 2 3 3 2 2 3 2 3 2 2 2 3 1 3 1 2 2 2 2 2 2 1 2 2 2 3 2 2 3 2 2 2 2 1 3 3 2 1 2 1 2 3 2 1 1 3 3 2 3 2 2 2 2 1...

output:

104147
6 8 261242
17 22 261244
30 33 261250
38 39 261252
53 55 261254
54 57 261255
56 58 261256
59 61 261257
86 87 261264
91 93 261266
105 109 261273
107 111 261275
114 115 261276
132 140 261283
136 143 261285
154 155 261292
156 157 261293
164 165 261294
168 169 261295
173 174 261297
180 182 261300
...

result:

ok count=104147

Test #159:

score: 0
Accepted
time: 155ms
memory: 20520kb

input:

470000
2 2 2 1 1 3 2 1 2 2 2 2 1 3 2 3 3 2 2 2 2 2 2 2 3 2 2 2 2 3 3 2 2 3 3 3 2 1 2 2 2 2 2 2 1 3 2 2 1 3 1 1 1 2 2 2 2 2 2 1 2 3 2 2 1 2 2 2 2 2 2 3 1 3 3 3 2 1 2 2 3 2 2 1 1 2 1 3 3 2 2 2 2 2 2 1 2 3 2 1 3 1 2 2 2 2 2 2 3 2 3 2 1 3 2 3 2 3 3 1 2 2 2 2 1 1 2 3 2 2 3 2 2 2 1 2 2 3 2 2 2 2 2 1 1 2 2...

output:

104570
12 14 260981
37 40 260991
44 46 260992
59 60 260999
83 90 261009
84 91 261010
86 92 261011
99 102 261016
112 114 261021
125 128 261028
134 135 261031
143 145 261033
144 146 261034
150 152 261037
159 166 261042
176 179 261048
180 183 261050
181 184 261051
204 209 261060
213 219 261066
227 229 ...

result:

ok count=104570

Test #160:

score: 0
Accepted
time: 154ms
memory: 20052kb

input:

469999
2 2 2 2 2 2 2 1 3 3 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 1 2 1 2 2 3 2 2 1 3 2 2 2 2 2 3 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 2 2 1 1 2 2 2 2 2 3 2 2 2 2 1 2 1 2 2 2 3 1 2 3 2 2 1 2 2 2 1 2 3 2 2 2 2 2 2 2 2 2 1 2 1 2 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 2 3 2 2 2 2 2 2 2 1 2 2 1 3 3 3 2 3 2 2 2 1 2 3 1 1 3 2 1...

output:

103891
27 28 261410
45 47 261415
46 48 261416
49 50 261417
52 53 261418
58 60 261419
86 87 261428
113 114 261433
127 128 261435
139 145 261441
146 155 261446
152 159 261449
156 163 261451
160 164 261452
169 172 261454
171 176 261456
179 180 261459
195 196 261464
200 202 261466
213 214 261469
215 216...

result:

ok count=103891

Test #161:

score: 0
Accepted
time: 68ms
memory: 19724kb

input:

600000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1
0 120192 386125

result:

ok count=1

Test #162:

score: 0
Accepted
time: 11ms
memory: 12640kb

input:

149980
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
77404 77405 96783

result:

ok count=1

Test #163:

score: 0
Accepted
time: 294ms
memory: 27016kb

input:

600000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

200000
0 200000 400000
1 200001 400001
2 200002 400002
3 200003 400003
4 200004 400004
5 200005 400005
6 200006 400006
7 200007 400007
8 200008 400008
9 200009 400009
10 200010 400010
11 200011 400011
12 200012 400012
13 200013 400013
14 200014 400014
15 200015 400015
16 200016 400016
17 200017 4000...

result:

ok count=200000

Test #164:

score: 0
Accepted
time: 57ms
memory: 15948kb

input:

600000
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
0 1 599999

result:

ok count=1

Test #165:

score: 0
Accepted
time: 169ms
memory: 22204kb

input:

600000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

120000
0 240000 480000
1 240001 480001
2 240002 480002
3 240003 480003
4 240004 480004
5 240005 480005
6 240006 480006
7 240007 480007
8 240008 480008
9 240009 480009
10 240010 480010
11 240011 480011
12 240012 480012
13 240013 480013
14 240014 480014
15 240015 480015
16 240016 480016
17 240017 4800...

result:

ok count=120000

Test #166:

score: 0
Accepted
time: 2ms
memory: 11832kb

input:

6
1 2 3 2 3 1

output:

2
0 1 4
2 3 5

result:

ok count=2

Test #167:

score: 0
Accepted
time: 285ms
memory: 26856kb

input:

599700
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

197700
0 197700 402000
1 197701 402001
2 197702 402002
3 197703 402003
4 197704 402004
5 197705 402005
6 197706 402006
7 197707 402007
8 197708 402008
9 197709 402009
10 197710 402010
11 197711 402011
12 197712 402012
13 197713 402013
14 197714 402014
15 197715 402015
16 197716 402016
17 197717 4020...

result:

ok count=197700