QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#331665#6537. One, Two, ThreeClHg2AC ✓58ms20656kbC++142.8kb2024-02-18 16:42:002024-02-18 16:42:00

Judging History

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

  • [2024-02-18 16:42:00]
  • 评测
  • 测评结果:AC
  • 用时:58ms
  • 内存:20656kb
  • [2024-02-18 16:42:00]
  • 提交

answer

#include <bits/stdc++.h>

#define all(x) begin(x), end(x)
#define each(i, x) for (auto& i : x)

using namespace std;

using ll = long long;
using db = long double;
using str = string;

using pi = pair<int, int>;
#define mp make_pair
#define f first
#define s second

#define ttt template <typename T
ttt > using vec = vector<T>;
ttt, size_t n > using arr = array<T, n>;
using vi = vec<int>;
using vb = vec<bool>;
using vl = vec<ll>;
using vpi = vec<pi>;
#define pb push_back
#define eb emplace_back

#define il inline
ttt > il int sz(const T& x) { return x.size(); }
ttt > il bool ckmin(T& x, const T& y) { return y < x ? x = y, true : false; }
ttt > il bool ckmax(T& x, const T& y) { return x < y ? x = y, true : false; }

constexpr int inf = 1e9;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false), cin.exceptions(cin.failbit);

  int n;
  cin >> n;

  vi a(n), pre(n + 1);
  arr<vi, 4> idx;
  for (int i = 0; i < n; ++i) {
    cin >> a[i], idx[a[i]].pb(i);
    pre[i + 1] = pre[i] + (a[i] == 2);
  }
  int c1 = sz(idx[1]), c3 = sz(idx[3]);
  vi sx(n, c1), sy(n, c3), tx(n, -1), ty(n, -1);
  for (int i = 0; i < c1; ++i) {
    fill(begin(sx) + (i ? idx[1][i - 1] + 1 : 0), begin(sx) + idx[1][i] + 1, i);
    fill(begin(ty) + idx[1][i], begin(ty) + (i < c1 - 1 ? idx[1][i + 1] : n),
         i);
  }
  for (int i = 0; i < c3; ++i) {
    fill(begin(sy) + (i ? idx[3][i - 1] + 1 : 0), begin(sy) + idx[3][i] + 1, i);
    fill(begin(tx) + idx[3][i], begin(tx) + (i < c3 - 1 ? idx[3][i + 1] : n),
         i);
  }
  int rx = min({c1, c3}), ry = rx, rxy = rx;
  for (int i = 0; i < c1; ++i) ckmin(rx, c3 + i - sy[idx[1][i]]);
  for (int i = 0; i < c3; ++i) ckmin(ry, c1 + i - sx[idx[3][i]]);
  int mxx = -inf, mxy = -inf, mxxy = -inf;
  for (int i = 0, j = 0; i < n; ++i) {
    int lim =
        min(tx[i] == -1 ? -1 : idx[3][tx[i]], ty[i] == -1 ? -1 : idx[1][ty[i]]);
    for (; j <= lim; ++j) {
      ckmax(mxx, pre[j] - sx[j]), ckmax(mxy, pre[j] - sy[j]);
      ckmax(mxxy, pre[j] - sx[j] - sy[j]);
    }
    ckmin(rx, pre[i + 1] - tx[i] - mxx + c3 - 1);
    ckmin(ry, pre[i + 1] - ty[i] - mxy + c1 - 1);
    ckmin(rxy, pre[i + 1] - tx[i] - ty[i] - mxxy + c1 + c3 - 2);
  }
  int ans_x, ans_y, ans = -inf;
  for (int x = 0; x <= rx; ++x) {
    int y = min(ry, rxy - x);
    if (ckmax(ans, x + y)) ans_x = x, ans_y = y;
  }
  cout << ans << "\n";
  int l1 = 0, r1 = 0, l3 = 0, r3 = 0;
  each (i, idx[2]) {
    while (r1 < ans_x && idx[1][r1] < i) ++r1;
    while (r3 < ans_y && idx[3][r3] < i) ++r3;
    int a = l1 < r1 ? idx[3][c3 - ans_x + l1] : n,
        b = l3 < r3 ? idx[1][c1 - ans_y + l3] : n;
    if (a == n && b == n) continue;
    if (a < b)
      cout << idx[1][l1++] << " " << i << " " << a << "\n";
    else
      cout << idx[3][l3++] << " " << i << " " << b << "\n";
  }
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
3 1 2 2 3 1

output:

2
1 2 4
0 3 5

result:

ok count=2

Test #2:

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

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

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

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
5 14 2313
8 18 2314
9 20 2318
11 27 2320
15 29 2321
22 30 2323
23 39 2324
24 46 2325
31 51 2326
47 54 2327
48 60 2328
0 67 2785
1 71 2795
72 79 2329
77 84 2330
78 87 2331
81 92 2332
85 97 2333
88 99 2334
98 105 2335
2 113 2796
117 128 2336
119 138 2337
120 144 2338
125 148 2339
132 162 2341
133 ...

result:

ok count=499

Test #4:

score: 0
Accepted
time: 1ms
memory: 3768kb

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: 1ms
memory: 3728kb

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: 1ms
memory: 3628kb

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
0 3 530
1 7 532
2 8 533
4 9 534
5 10 536
6 11 537
12 16 542
13 17 544
15 20 545
19 21 547
14 22 552
18 23 553
24 25 550
26 27 554
30 32 555
28 33 557
29 34 558
31 35 559
38 41 556
36 42 563
43 44 560
46 49 561
37 50 564
39 51 566
40 53 570
45 54 573
47 55 576
48 56 577
52 57 580
58 59 581
60 61 ...

result:

ok count=500

Test #7:

score: 0
Accepted
time: 1ms
memory: 3676kb

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
0 7 1887
1 11 1888
5 79 1889
2 122 1890
6 138 1891
3 139 1892
4 140 1893
8 141 1894
9 142 1895
12 143 1896
10 144 1897
14 145 1899
13 146 1900
18 147 1901
19 148 1902
21 149 1903
15 150 1904
16 151 1905
24 152 1906
25 153 1907
17 154 1908
20 155 1909
22 156 1910
26 157 1911
23 158 1912
27 159 1...

result:

ok count=1000

Test #8:

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

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
1 31 1598
4 32 1600
9 41 1606
12 51 1609
16 52 1610
17 53 1611
18 54 1617
19 55 1619
20 56 1621
23 57 1622
26 58 1623
28 59 1624
29 60 1627
33 61 1630
0 62 1632
2 63 1633
3 64 1634
5 65 1635
35 66 1636
6 67 1637
36 68 1638
37 69 1639
39 70 1640
7 71 1641
40 72 1642
42 73 1643
45 74 1644
46 75 1...

result:

ok count=1000

Test #9:

score: 0
Accepted
time: 1ms
memory: 3684kb

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
0 2 1213
1 3 1221
10 21 1215
12 26 1216
13 27 1217
15 30 1218
16 31 1220
17 32 1222
4 33 1223
5 34 1224
6 35 1225
19 36 1226
7 37 1227
24 38 1228
8 39 1229
9 40 1230
11 41 1231
14 42 1234
18 43 1235
20 44 1236
22 45 1237
23 46 1242
25 47 1246
28 48 1247
29 49 1249
51 73 1232
52 74 1233
55 75 123...

result:

ok count=999

Test #10:

score: 0
Accepted
time: 1ms
memory: 3736kb

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
1 4 1927
3 6 1928
5 7 1929
8 18 1926
9 31 1930
14 39 1931
16 49 1932
17 51 1933
10 59 1934
11 61 1935
21 62 1936
26 63 1937
12 64 1938
27 65 1939
13 66 1940
28 67 1941
15 68 1942
19 69 1943
33 70 1944
35 71 1945
20 72 1946
22 73 1947
23 74 1948
38 75 1949
41 76 1950
24 77 1951
45 78 195...

result:

ok count=998

Test #11:

score: 0
Accepted
time: 1ms
memory: 3680kb

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
3 4 125
5 6 126
7 12 129
13 15 131
0 17 2898
19 21 135
20 22 136
23 25 137
24 27 138
26 28 140
29 36 143
30 38 145
31 40 148
32 44 152
33 49 153
35 54 155
39 59 157
41 60 162
42 61 163
43 63 164
46 67 167
47 72 172
48 76 175
56 80 176
58 82 177
64 83 180
65 87 184
66 88 187
69 91 188
71 98 191
...

result:

ok count=1000

Test #12:

score: 0
Accepted
time: 1ms
memory: 3676kb

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 1662
3 5 1684
7 8 1685
13 14 1668
19 21 1669
20 22 1686
25 26 1687
32 34 1670
33 35 1688
44 46 1671
45 47 1689
49 50 1672
51 52 1696
54 55 1674
53 56 1697
57 58 1699
59 60 1702
63 64 1675
73 74 1677
76 77 1707
79 80 1678
81 82 1708
83 86 1679
84 88 1710
85 89 1711
87 90 1715
92 93 1683
91 94...

result:

ok count=673

Test #13:

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

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
2 4 1641
3 6 1642
5 9 1650
7 10 1651
11 12 1643
13 14 1645
15 16 1648
8 17 1652
19 20 1653
21 22 1649
26 28 1654
27 31 1655
32 33 1656
29 35 1657
30 36 1661
34 37 1665
39 40 1658
45 46 1666
49 50 1659
48 51 1672
53 54 1676
57 59 1680
58 60 1682
62 65 1686
66 68 1660
67 69 1662
63 70 1687
71 72 1...

result:

ok count=683

Test #14:

score: 0
Accepted
time: 1ms
memory: 3916kb

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
1 2 1652
3 5 1655
4 6 1710
12 13 1656
17 19 1711
20 21 1657
22 23 1658
18 24 1712
25 26 1713
34 35 1659
41 45 1661
43 46 1663
47 48 1665
42 49 1716
44 50 1720
51 52 1721
56 57 1667
59 60 1668
68 69 1725
70 71 1669
72 73 1726
75 77 1727
76 78 1728
81 82 1670
83 84 1671
88 89 1729
93 94 1672
90 95...

result:

ok count=629

Test #15:

score: 0
Accepted
time: 1ms
memory: 3744kb

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 1635
1 6 1637
2 7 1649
8 9 1639
4 10 1650
5 11 1651
15 18 1641
16 19 1654
17 20 1656
21 22 1657
26 27 1663
28 30 1643
29 32 1666
31 34 1670
33 37 1671
35 38 1675
36 39 1685
44 46 1644
45 47 1645
48 50 1686
51 52 1648
49 53 1687
54 56 1692
55 57 1693
58 61 1652
59 63 1653
60 65 1655
62 66 165...

result:

ok count=712

Test #16:

score: 0
Accepted
time: 1ms
memory: 3968kb

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: 0ms
memory: 3684kb

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: 3592kb

input:

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

output:

3
1 3 8
2 6 9
5 11 13

result:

ok count=3

Test #19:

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

input:

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

output:

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

result:

ok count=6

Test #20:

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

input:

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

output:

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

result:

ok count=5

Test #21:

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

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 8 12
6 10 13
2 11 14

result:

ok count=5

Test #22:

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

input:

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

output:

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

result:

ok count=6

Test #23:

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

input:

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

output:

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

result:

ok count=6

Test #24:

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

input:

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

output:

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

result:

ok count=6

Test #25:

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

input:

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

output:

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

result:

ok count=5

Test #26:

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

input:

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

output:

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

result:

ok count=6

Test #27:

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

input:

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

output:

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

result:

ok count=5

Test #28:

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

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: 3636kb

input:

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

output:

1
9 10 14

result:

ok count=1

Test #30:

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

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: 0ms
memory: 3636kb

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: 0ms
memory: 3844kb

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: 3576kb

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

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

input:

6
3 1 2 2 3 1

output:

2
1 2 4
0 3 5

result:

ok count=2

Test #35:

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

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
2 5 340
6 13 341
8 14 344
12 15 345
17 18 346
19 23 349
20 26 350
21 27 357
22 42 359
34 48 371
35 50 374
36 52 376
37 59 377
38 60 378
40 63 379
54 67 388
55 69 389
56 71 390
57 78 391
58 80 396
64 83 401
65 89 403
66 91 405
68 94 407
77 96 410
79 98 411
88 102 413
100 104 414
101 107 420
103 ...

result:

ok count=4997

Test #36:

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

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
0 4 238
2 9 239
3 10 240
7 13 241
11 15 243
1 17 14738
5 20 14739
6 21 14741
8 23 14745
24 25 245
26 27 246
28 32 247
29 34 249
12 35 14749
36 39 251
37 41 256
38 45 259
40 46 260
44 49 262
47 56 263
51 62 265
53 63 267
55 67 268
60 69 270
61 71 271
64 72 274
65 73 288
68 75 292
70 77 294
76 78...

result:

ok count=4999

Test #37:

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

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 14708
3 4 339
5 6 342
7 8 343
9 18 344
10 23 345
12 25 350
13 27 351
16 30 352
19 37 356
22 44 357
34 52 360
35 57 366
38 63 371
39 64 378
40 65 380
42 69 384
43 71 387
46 74 389
47 76 390
48 80 393
49 90 396
51 93 399
53 94 403
54 96 405
56 98 407
58 103 413
60 112 416
61 113 421
67 116 42...

result:

ok count=4998

Test #38:

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

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 14743
2 5 14745
6 8 265
9 12 266
10 13 267
11 15 274
17 19 275
18 21 276
20 24 277
25 29 287
26 32 292
31 36 294
33 37 297
3 38 14747
40 42 303
43 45 304
44 46 306
4 48 14755
49 51 307
50 52 309
7 53 14759
14 54 14760
55 58 310
56 61 311
57 63 313
59 74 318
60 76 322
64 81 325
65 85 334
67 ...

result:

ok count=5000

Test #39:

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

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
0 24 5289
1 41 5290
6 42 5292
7 43 5294
8 44 5295
9 46 5296
10 47 5299
12 48 5302
14 49 5303
17 50 5306
19 51 5308
20 52 5309
21 53 5310
22 54 5311
25 55 5314
26 56 5316
27 57 5319
28 58 5320
2 59 5322
29 60 5323
30 61 5324
3 62 5325
31 63 5326
32 64 5327
4 65 5328
5 66 5329
11 67 5330
13 68 53...

result:

ok count=5000

Test #40:

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

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
0 30 6110
2 42 6112
4 43 6115
5 45 6116
10 46 6118
11 47 6120
12 48 6121
13 49 6122
14 50 6126
15 51 6131
18 52 6132
21 53 6134
22 54 6138
23 55 6141
24 56 6142
25 57 6143
26 58 6144
27 59 6145
28 60 6146
29 61 6149
31 62 6150
33 63 6152
34 64 6154
35 65 6160
36 66 6161
37 67 6163
38 68 6164
40...

result:

ok count=5000

Test #41:

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

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
0 139 6950
1 444 6952
6 472 6955
7 474 6958
8 475 6960
10 476 6961
12 477 6964
2 478 6965
14 479 6966
3 480 6967
16 481 6968
17 482 6969
4 483 6970
18 484 6971
19 485 6972
5 486 6973
9 487 6974
21 488 6975
22 489 6976
11 490 6977
26 491 6978
13 492 6979
15 493 6980
20 494 6981
23 495 6982
31 49...

result:

ok count=5000

Test #42:

score: 0
Accepted
time: 1ms
memory: 3764kb

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
1 89 2507
4 90 2508
5 91 2509
6 92 2510
12 93 2511
16 94 2512
18 95 2513
19 96 2514
20 97 2516
22 98 2525
26 99 2526
27 100 2529
28 101 2533
29 102 2537
32 103 2542
34 104 2543
36 105 2544
37 106 2545
38 107 2546
39 108 2547
40 109 2551
41 110 2553
42 111 2555
43 112 2556
44 113 2558
45 114 256...

result:

ok count=2000

Test #43:

score: 0
Accepted
time: 1ms
memory: 3788kb

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
9 13 4174
0 14 4227
1 16 4230
2 17 4232
3 18 4234
4 19 4235
5 20 4238
6 21 4239
7 22 4240
8 23 4244
10 24 4246
11 25 4249
12 26 4251
15 27 4255
28 32 4175
31 39 4176
34 41 4181
35 43 4183
37 44 4186
38 45 4187
40 46 4190
42 47 4192
29 48 4256
30 49 4257
33 50 4260
36 51 4261
52 66 4193
53 84 41...

result:

ok count=3000

Test #44:

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

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
5 30 6543
0 56 6544
1 233 6545
2 270 6546
7 309 6547
3 334 6548
4 335 6549
9 339 6550
6 342 6551
8 343 6552
11 344 6553
10 345 6554
14 346 6555
16 347 6556
17 348 6557
12 349 6558
18 350 6559
13 351 6560
15 352 6561
19 353 6562
22 354 6563
27 355 6564
28 356 6565
20 357 6566
29 358 6567
21 359 ...

result:

ok count=4000

Test #45:

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

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
0 5 5428
1 7 5431
3 10 5433
4 17 5434
6 18 5435
12 19 5436
15 20 5437
2 22 5440
8 23 5442
9 24 5443
11 25 5445
13 26 5447
14 27 5450
16 28 5451
21 29 5453
30 32 5454
33 34 5439
31 35 5455
43 70 5441
44 108 5444
45 118 5446
48 119 5448
50 120 5449
53 121 5452
54 122 5456
36 123 5457
37 124 5458
...

result:

ok count=5000

Test #46:

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

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
0 51 6934
1 65 6940
2 89 6941
3 121 6942
7 124 6944
11 128 6945
15 132 6950
17 133 6951
18 134 6953
19 135 6957
20 136 6958
21 137 6959
24 138 6962
4 139 6963
5 140 6964
6 141 6965
27 142 6966
8 143 6967
9 144 6968
28 145 6969
29 146 6970
33 147 6971
36 148 6972
45 149 6973
46 150 6974
10 151 6...

result:

ok count=5000

Test #47:

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

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 7 6120
5 33 6121
6 34 6124
8 36 6128
9 39 6135
11 40 6138
12 41 6139
14 42 6142
16 43 6144
17 44 6148
18 45 6154
21 46 6156
24 47 6157
26 48 6160
27 49 6163
28 50 6165
29 51 6171
0 52 6172
35 53 6173
38 54 6174
1 55 6175
3 56 6176
4 57 6179
10 58 6181
13 59 6182
15 60 6183
19 61 6184
20 62 61...

result:

ok count=5000

Test #48:

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

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
0 1 8349
3 4 8350
6 7 8354
11 12 8355
14 15 8356
13 16 8360
19 20 8357
24 25 8363
27 28 8367
32 33 8358
37 38 8359
42 44 8370
43 45 8374
49 50 8361
47 51 8375
48 52 8376
54 55 8362
57 58 8381
62 63 8364
61 65 8384
64 66 8385
71 72 8365
74 75 8366
77 78 8368
79 80 8386
85 86 8369
91 94 8371
92 9...

result:

ok count=3267

Test #49:

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

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 8367
4 5 8369
10 11 8370
15 16 8300
14 19 8371
17 20 8372
18 22 8373
21 23 8374
32 33 8301
31 36 8377
37 40 8306
38 45 8307
44 46 8308
34 48 8378
35 49 8379
39 50 8382
41 51 8383
42 52 8386
43 53 8387
47 54 8388
56 57 8312
58 59 8390
61 63 8313
62 64 8393
67 68 8317
65 69 8394
70 71 8319
66...

result:

ok count=3340

Test #50:

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

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
0 1 7685
2 3 7686
4 5 7687
7 8 7857
10 11 7691
24 26 7692
25 27 7863
31 32 7864
36 40 7696
38 41 7697
39 42 7698
35 43 7866
44 46 7699
37 47 7869
48 49 7700
45 50 7873
52 53 7702
54 55 7875
57 58 7706
63 64 7708
69 70 7709
75 76 7877
79 80 7710
78 81 7880
84 85 7711
88 89 7712
99 101 7713
100 1...

result:

ok count=3042

Test #51:

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

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
2 4 7231
3 5 7234
7 8 7145
9 10 7235
11 12 7149
13 14 7154
16 20 7155
19 22 7159
21 24 7161
23 26 7164
15 27 7236
17 28 7239
18 29 7240
25 30 7241
32 33 7166
35 40 7167
39 41 7172
36 43 7253
37 45 7254
46 47 7173
38 48 7255
42 49 7258
44 50 7260
51 52 7174
53 54 7177
58 59 7178
63 65 7261
64 66...

result:

ok count=2941

Test #52:

score: 0
Accepted
time: 1ms
memory: 3800kb

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
3 4 6157
11 12 6042
13 14 6044
18 19 6045
29 30 6046
37 38 6159
42 43 6047
44 46 6049
45 47 6160
64 66 6051
67 69 6052
68 70 6054
63 71 6162
65 72 6163
73 74 6056
76 77 6165
79 80 6058
85 86 6062
93 95 6063
94 96 6072
104 105 6167
107 108 6172
109 111 6073
110 112 6173
115 116 6075
118 119 6175...

result:

ok count=2460

Test #53:

score: 0
Accepted
time: 1ms
memory: 3804kb

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
2 4 5988
3 6 6210
5 7 6211
9 10 5989
15 16 5993
17 18 6213
20 21 6214
22 23 5995
24 25 6215
26 27 5998
29 30 6218
36 38 6000
37 39 6003
43 44 6219
45 46 6221
48 50 6224
49 53 6225
51 54 6226
55 56 6004
52 57 6230
63 64 6233
66 69 6005
67 70 6234
72 73 6006
68 75 6235
76 77 6007
78 80 6009
71 81...

result:

ok count=2423

Test #54:

score: 0
Accepted
time: 1ms
memory: 3860kb

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
3 4 6157
1 5 6180
2 6 6181
9 10 6162
25 26 6184
32 33 6163
36 37 6166
38 39 6185
40 41 6186
42 43 6187
47 48 6169
54 55 6174
56 57 6189
58 61 6175
60 62 6176
63 64 6177
59 65 6193
66 67 6178
69 72 6179
71 73 6182
68 74 6196
70 75 6198
79 80 6183
78 81 6199
84 85 6200
89 90 6188
92 95 6190
93 96...

result:

ok count=2372

Test #55:

score: 0
Accepted
time: 1ms
memory: 3760kb

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
2 3 6084
4 5 6106
7 8 6085
12 13 6087
11 14 6110
20 21 6116
23 24 6088
29 30 6119
32 34 6089
33 36 6090
35 38 6120
37 39 6123
46 48 6091
47 51 6125
49 52 6127
50 53 6128
54 55 6130
58 59 6092
61 64 6097
62 65 6132
63 66 6133
67 68 6134
72 73 6135
74 76 6099
75 77 6100
87 88 6103
89 90 6136
95 9...

result:

ok count=2490

Test #56:

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

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: 1ms
memory: 4100kb

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: 2ms
memory: 4112kb

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: 1ms
memory: 3896kb

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: 1ms
memory: 3832kb

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: 2ms
memory: 3880kb

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: 3876kb

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

result:

ok count=29

Test #63:

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

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

result:

ok count=29

Test #64:

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

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

result:

ok count=28

Test #65:

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

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

result:

ok count=30

Test #66:

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

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

result:

ok count=29

Test #67:

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

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

result:

ok count=28

Test #68:

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

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
1 2 36
3 4 87
7 10 39
8 15 42
9 16 51
12 17 54
6 18 89
11 21 90
13 22 92
14 24 94
26 27 55
29 32 56
30 34 59
37 38 63
19 40 96
41 43 65
44 48 69
45 49 70
46 53 72
47 61 73
50 62 79
52 71 81
57 74 82
58 76 85
60 78 91
64 83 93
66 88 95

result:

ok count=27

Test #69:

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

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

result:

ok count=30

Test #70:

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

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: 0ms
memory: 3684kb

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: 0ms
memory: 3816kb

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

result:

ok count=33

Test #73:

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

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

result:

ok count=32

Test #74:

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

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

result:

ok count=33

Test #75:

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

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

result:

ok count=31

Test #76:

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

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

result:

ok count=30

Test #77:

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

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
1 2 56
5 6 60
8 9 59
10 11 61
13 14 63
18 19 64
21 22 62
27 28 65
33 66 67
31 68 70
34 69 73
35 71 80
32 72 81
40 74 83
41 75 84
42 76 85
45 77 86
36 78 89
37 79 92
50 82 97

result:

ok count=20

Test #78:

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

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 70
9 10 73
16 17 59
22 23 60
24 25 80
26 27 61
38 67 71
39 68 77
42 72 79
43 74 81
46 75 82
49 76 84
50 78 86
54 83 87
55 85 88
33 89 90
58 91 96
62 92 97

result:

ok count=18

Test #79:

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

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
0 1 43
7 9 46
8 10 50
12 13 62
14 15 63
21 26 52
23 28 55
25 30 58
27 31 59
35 64 73
22 65 74
24 66 78
29 67 83
36 68 85
37 69 97

result:

ok count=15

Test #80:

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

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
3 4 54
2 5 62
6 7 75
10 11 79
12 16 82
13 17 91
18 19 56
20 22 58
14 23 92
25 26 60
27 29 61
28 30 63
33 64 66
42 65 68
43 67 74
44 69 78
46 70 80
51 71 83
55 72 86
57 73 95
59 76 96

result:

ok count=21

Test #81:

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

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: 1ms
memory: 3680kb

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

result:

ok count=33

Test #83:

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

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

result:

ok count=32

Test #84:

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

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
1 2 159
3 6 164
4 10 165
7 13 169
9 15 172
14 16 173
5 17 2874
18 20 174
22 23 177
24 25 178
8 27 2877
28 30 182
29 38 187
32 41 189
33 42 191
34 45 192
35 49 197
36 50 198
37 54 200
46 55 201
51 57 202
52 63 204
56 64 205
61 71 206
65 73 208
66 76 216
70 77 218
75 80 220
81 85 221
82 88 225
83 ...

result:

ok count=999

Test #85:

score: 0
Accepted
time: 1ms
memory: 3668kb

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
1 4 111
3 8 115
6 9 117
7 10 119
0 13 2889
14 19 120
15 22 123
16 24 126
18 27 131
20 28 140
21 29 144
25 30 145
32 34 147
33 36 150
2 37 2890
38 39 151
5 40 2894
11 41 2895
12 42 2896
44 57 153
46 60 159
47 63 160
48 64 161
49 86 162
51 89 165
52 96 169
54 100 172
56 109 173
58 114 181
61 122 1...

result:

ok count=995

Test #86:

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

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: 0ms
memory: 3884kb

input:

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

output:

1
9 10 14

result:

ok count=1

Test #88:

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

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: 0ms
memory: 3612kb

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

result:

ok count=29

Test #90:

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

input:

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

output:

3
1 3 8
2 6 9
5 11 13

result:

ok count=3

Test #91:

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

input:

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

output:

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

result:

ok count=6

Test #92:

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

input:

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

output:

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

result:

ok count=5

Test #93:

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

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 8 12
6 10 13
2 11 14

result:

ok count=5

Test #94:

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

input:

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

output:

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

result:

ok count=6

Test #95:

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

input:

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

output:

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

result:

ok count=6

Test #96:

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

input:

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

output:

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

result:

ok count=6

Test #97:

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

input:

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

output:

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

result:

ok count=5

Test #98:

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

input:

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

output:

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

result:

ok count=6

Test #99:

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

input:

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

output:

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

result:

ok count=5

Test #100:

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

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

result:

ok count=29

Test #101:

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

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

result:

ok count=29

Test #102:

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

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

result:

ok count=28

Test #103:

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

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

result:

ok count=30

Test #104:

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

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

result:

ok count=29

Test #105:

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

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

result:

ok count=28

Test #106:

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

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
1 2 36
3 4 87
7 10 39
8 15 42
9 16 51
12 17 54
6 18 89
11 21 90
13 22 92
14 24 94
26 27 55
29 32 56
30 34 59
37 38 63
19 40 96
41 43 65
44 48 69
45 49 70
46 53 72
47 61 73
50 62 79
52 71 81
57 74 82
58 76 85
60 78 91
64 83 93
66 88 95

result:

ok count=27

Test #107:

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

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

result:

ok count=30

Test #108:

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

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: 0ms
memory: 3528kb

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: 3844kb

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

result:

ok count=33

Test #111:

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

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

result:

ok count=32

Test #112:

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

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

result:

ok count=33

Test #113:

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

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

result:

ok count=31

Test #114:

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

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

result:

ok count=30

Test #115:

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

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
1 2 56
5 6 60
8 9 59
10 11 61
13 14 63
18 19 64
21 22 62
27 28 65
33 66 67
31 68 70
34 69 73
35 71 80
32 72 81
40 74 83
41 75 84
42 76 85
45 77 86
36 78 89
37 79 92
50 82 97

result:

ok count=20

Test #116:

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

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 70
9 10 73
16 17 59
22 23 60
24 25 80
26 27 61
38 67 71
39 68 77
42 72 79
43 74 81
46 75 82
49 76 84
50 78 86
54 83 87
55 85 88
33 89 90
58 91 96
62 92 97

result:

ok count=18

Test #117:

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

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
0 1 43
7 9 46
8 10 50
12 13 62
14 15 63
21 26 52
23 28 55
25 30 58
27 31 59
35 64 73
22 65 74
24 66 78
29 67 83
36 68 85
37 69 97

result:

ok count=15

Test #118:

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

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
3 4 54
2 5 62
6 7 75
10 11 79
12 16 82
13 17 91
18 19 56
20 22 58
14 23 92
25 26 60
27 29 61
28 30 63
33 64 66
42 65 68
43 67 74
44 69 78
46 70 80
51 71 83
55 72 86
57 73 95
59 76 96

result:

ok count=21

Test #119:

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

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: 3588kb

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

result:

ok count=33

Test #121:

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

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

result:

ok count=32

Test #122:

score: 0
Accepted
time: 1ms
memory: 3976kb

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
1 2 159
3 6 164
4 10 165
7 13 169
9 15 172
14 16 173
5 17 2874
18 20 174
22 23 177
24 25 178
8 27 2877
28 30 182
29 38 187
32 41 189
33 42 191
34 45 192
35 49 197
36 50 198
37 54 200
46 55 201
51 57 202
52 63 204
56 64 205
61 71 206
65 73 208
66 76 216
70 77 218
75 80 220
81 85 221
82 88 225
83 ...

result:

ok count=999

Test #123:

score: 0
Accepted
time: 1ms
memory: 3748kb

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
1 4 111
3 8 115
6 9 117
7 10 119
0 13 2889
14 19 120
15 22 123
16 24 126
18 27 131
20 28 140
21 29 144
25 30 145
32 34 147
33 36 150
2 37 2890
38 39 151
5 40 2894
11 41 2895
12 42 2896
44 57 153
46 60 159
47 63 160
48 64 161
49 86 162
51 89 165
52 96 169
54 100 172
56 109 173
58 114 181
61 122 1...

result:

ok count=995

Test #124:

score: 0
Accepted
time: 1ms
memory: 3900kb

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
5 14 2313
8 18 2314
9 20 2318
11 27 2320
15 29 2321
22 30 2323
23 39 2324
24 46 2325
31 51 2326
47 54 2327
48 60 2328
0 67 2785
1 71 2795
72 79 2329
77 84 2330
78 87 2331
81 92 2332
85 97 2333
88 99 2334
98 105 2335
2 113 2796
117 128 2336
119 138 2337
120 144 2338
125 148 2339
132 162 2341
133 ...

result:

ok count=499

Test #125:

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

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: 1ms
memory: 3972kb

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: 1ms
memory: 3624kb

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
0 3 530
1 7 532
2 8 533
4 9 534
5 10 536
6 11 537
12 16 542
13 17 544
15 20 545
19 21 547
14 22 552
18 23 553
24 25 550
26 27 554
30 32 555
28 33 557
29 34 558
31 35 559
38 41 556
36 42 563
43 44 560
46 49 561
37 50 564
39 51 566
40 53 570
45 54 573
47 55 576
48 56 577
52 57 580
58 59 581
60 61 ...

result:

ok count=500

Test #128:

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

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
0 7 1887
1 11 1888
5 79 1889
2 122 1890
6 138 1891
3 139 1892
4 140 1893
8 141 1894
9 142 1895
12 143 1896
10 144 1897
14 145 1899
13 146 1900
18 147 1901
19 148 1902
21 149 1903
15 150 1904
16 151 1905
24 152 1906
25 153 1907
17 154 1908
20 155 1909
22 156 1910
26 157 1911
23 158 1912
27 159 1...

result:

ok count=1000

Test #129:

score: 0
Accepted
time: 1ms
memory: 3728kb

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
1 31 1598
4 32 1600
9 41 1606
12 51 1609
16 52 1610
17 53 1611
18 54 1617
19 55 1619
20 56 1621
23 57 1622
26 58 1623
28 59 1624
29 60 1627
33 61 1630
0 62 1632
2 63 1633
3 64 1634
5 65 1635
35 66 1636
6 67 1637
36 68 1638
37 69 1639
39 70 1640
7 71 1641
40 72 1642
42 73 1643
45 74 1644
46 75 1...

result:

ok count=1000

Test #130:

score: 0
Accepted
time: 1ms
memory: 3756kb

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
0 2 1213
1 3 1221
10 21 1215
12 26 1216
13 27 1217
15 30 1218
16 31 1220
17 32 1222
4 33 1223
5 34 1224
6 35 1225
19 36 1226
7 37 1227
24 38 1228
8 39 1229
9 40 1230
11 41 1231
14 42 1234
18 43 1235
20 44 1236
22 45 1237
23 46 1242
25 47 1246
28 48 1247
29 49 1249
51 73 1232
52 74 1233
55 75 123...

result:

ok count=999

Test #131:

score: 0
Accepted
time: 1ms
memory: 3680kb

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
1 4 1927
3 6 1928
5 7 1929
8 18 1926
9 31 1930
14 39 1931
16 49 1932
17 51 1933
10 59 1934
11 61 1935
21 62 1936
26 63 1937
12 64 1938
27 65 1939
13 66 1940
28 67 1941
15 68 1942
19 69 1943
33 70 1944
35 71 1945
20 72 1946
22 73 1947
23 74 1948
38 75 1949
41 76 1950
24 77 1951
45 78 195...

result:

ok count=998

Test #132:

score: 0
Accepted
time: 1ms
memory: 3980kb

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
3 4 125
5 6 126
7 12 129
13 15 131
0 17 2898
19 21 135
20 22 136
23 25 137
24 27 138
26 28 140
29 36 143
30 38 145
31 40 148
32 44 152
33 49 153
35 54 155
39 59 157
41 60 162
42 61 163
43 63 164
46 67 167
47 72 172
48 76 175
56 80 176
58 82 177
64 83 180
65 87 184
66 88 187
69 91 188
71 98 191
...

result:

ok count=1000

Test #133:

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

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 1662
3 5 1684
7 8 1685
13 14 1668
19 21 1669
20 22 1686
25 26 1687
32 34 1670
33 35 1688
44 46 1671
45 47 1689
49 50 1672
51 52 1696
54 55 1674
53 56 1697
57 58 1699
59 60 1702
63 64 1675
73 74 1677
76 77 1707
79 80 1678
81 82 1708
83 86 1679
84 88 1710
85 89 1711
87 90 1715
92 93 1683
91 94...

result:

ok count=673

Test #134:

score: 0
Accepted
time: 1ms
memory: 3744kb

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
2 4 1641
3 6 1642
5 9 1650
7 10 1651
11 12 1643
13 14 1645
15 16 1648
8 17 1652
19 20 1653
21 22 1649
26 28 1654
27 31 1655
32 33 1656
29 35 1657
30 36 1661
34 37 1665
39 40 1658
45 46 1666
49 50 1659
48 51 1672
53 54 1676
57 59 1680
58 60 1682
62 65 1686
66 68 1660
67 69 1662
63 70 1687
71 72 1...

result:

ok count=683

Test #135:

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

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
1 2 1652
3 5 1655
4 6 1710
12 13 1656
17 19 1711
20 21 1657
22 23 1658
18 24 1712
25 26 1713
34 35 1659
41 45 1661
43 46 1663
47 48 1665
42 49 1716
44 50 1720
51 52 1721
56 57 1667
59 60 1668
68 69 1725
70 71 1669
72 73 1726
75 77 1727
76 78 1728
81 82 1670
83 84 1671
88 89 1729
93 94 1672
90 95...

result:

ok count=629

Test #136:

score: 0
Accepted
time: 1ms
memory: 3688kb

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 1635
1 6 1637
2 7 1649
8 9 1639
4 10 1650
5 11 1651
15 18 1641
16 19 1654
17 20 1656
21 22 1657
26 27 1663
28 30 1643
29 32 1666
31 34 1670
33 37 1671
35 38 1675
36 39 1685
44 46 1644
45 47 1645
48 50 1686
51 52 1648
49 53 1687
54 56 1692
55 57 1693
58 61 1652
59 63 1653
60 65 1655
62 66 165...

result:

ok count=712

Test #137:

score: 0
Accepted
time: 1ms
memory: 3668kb

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: 24ms
memory: 19776kb

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: 57ms
memory: 19556kb

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
2 4 1506
0 6 598549
7 8 1507
1 11 598552
12 13 1512
3 14 598564
5 16 598565
19 20 1515
9 23 598566
25 29 1518
26 38 1519
27 39 1522
30 43 1523
31 45 1525
35 47 1526
37 48 1527
41 49 1529
42 54 1530
44 59 1531
46 71 1533
55 73 1534
63 74 1536
64 76 1539
65 78 1540
66 80 1541
67 97 1542
70 98 1...

result:

ok count=200000

Test #140:

score: 0
Accepted
time: 54ms
memory: 19752kb

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
0 2 2657
3 5 2660
4 9 2661
10 11 2662
1 12 597318
13 16 2663
14 17 2669
15 18 2672
6 19 597322
7 20 597323
21 26 2674
23 32 2676
24 38 2677
28 40 2683
30 47 2686
33 51 2692
34 52 2693
35 53 2695
43 55 2696
45 56 2698
50 57 2702
54 62 2705
61 66 2717
67 69 2721
8 72 597325
73 76 2723
74 78 272...

result:

ok count=200000

Test #141:

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

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
1 39 207487
2 54 207521
3 65 207538
4 105 207560
122 156 204833
130 240 204834
132 324 204835
200 377 204836
251 465 204837
257 500 204838
267 542 204839
297 550 204840
332 563 204841
345 568 204842
354 571 204843
366 613 204844
497 675 204845
512 686 204846
524 703 204847
579 744 204848
630 78...

result:

ok count=4999

Test #142:

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

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 14743
2 5 14745
6 8 265
9 12 266
10 13 267
11 15 274
17 19 275
18 21 276
20 24 277
25 29 287
26 32 292
31 36 294
33 37 297
3 38 14747
40 42 303
43 45 304
44 46 306
4 48 14755
49 51 307
50 52 309
7 53 14759
14 54 14760
55 58 310
56 61 311
57 63 313
59 74 318
60 76 322
64 81 325
65 85 334
67 ...

result:

ok count=5000

Test #143:

score: 0
Accepted
time: 58ms
memory: 19740kb

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
0 1 2407
3 6 2408
7 10 2416
2 12 597411
4 13 597415
5 16 597416
8 19 597417
9 20 597418
11 21 597420
14 23 597421
24 26 2420
25 27 2426
15 29 597423
30 32 2427
17 34 597426
18 35 597427
36 37 2431
22 38 597432
40 42 2432
28 43 597434
44 46 2433
31 48 597439
49 51 2440
33 54 597441
55 56 2442
...

result:

ok count=200000

Test #144:

score: 0
Accepted
time: 51ms
memory: 19672kb

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
0 947 351499
1 2611 351502
4 3964 351503
2 8354 351504
3 8355 351505
5 11205 351506
6 11334 351507
8 11341 351508
7 11342 351509
9 11343 351510
10 11344 351511
11 11345 351512
13 11346 351513
12 11347 351514
15 11348 351515
14 11349 351516
16 11350 351517
17 11351 351518
18 11352 351519
19 11...

result:

ok count=200000

Test #145:

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

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
0 6995 337961
2 8232 337964
3 9381 337967
4 10408 337970
9 10446 337973
10 10456 337974
12 10458 337975
14 10459 337976
17 10460 337977
18 10461 337978
19 10462 337979
21 10463 337980
22 10464 337981
23 10465 337983
24 10466 337986
25 10467 337988
26 10468 337989
27 10469 337990
28 10470 3379...

result:

ok count=200000

Test #146:

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

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
1 619 342676
2 1022 342677
3 1263 342678
5 1717 342679
7 1759 342680
10 2438 342681
12 2469 342684
14 2499 342685
15 2521 342686
16 2523 342687
20 2525 342688
24 2526 342690
26 2527 342695
27 2528 342698
28 2529 342701
30 2530 342702
31 2531 342708
32 2532 342710
33 2533 342711
34 2534 342713...

result:

ok count=200000

Test #147:

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

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
3 167 27425
4 289 27426
6 304 27428
7 348 27434
11 391 27435
13 397 27438
15 402 27441
17 406 27442
22 423 27447
23 428 27453
27 433 27457
30 434 27458
33 435 27460
34 436 27461
36 437 27465
37 438 27467
38 439 27471
42 440 27475
45 441 27477
49 442 27478
50 443 27481
51 444 27482
52 445 27484...

result:

ok count=20000

Test #148:

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

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
1 254 31490
2 282 31494
5 283 31496
12 303 31497
13 304 31498
16 315 31502
17 319 31503
18 320 31504
21 321 31506
23 322 31509
24 323 31511
25 324 31514
31 325 31515
32 326 31519
33 327 31522
34 328 31523
35 329 31528
36 330 31529
37 331 31530
41 332 31535
42 333 31538
46 334 31539
47 335 3154...

result:

ok count=30000

Test #149:

score: 0
Accepted
time: 9ms
memory: 6852kb

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
2 556 62559
9 819 62560
11 933 62561
12 947 62563
14 949 62566
15 970 62571
16 976 62573
18 993 62574
24 995 62575
25 997 62577
26 998 62578
27 999 62580
28 1000 62583
29 1001 62585
30 1002 62586
33 1003 62587
37 1004 62589
38 1005 62590
39 1006 62591
42 1007 62592
43 1008 62594
44 1009 62602
...

result:

ok count=40000

Test #150:

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

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
4 134 95080
7 1872 95084
8 3709 95085
9 4402 95086
13 4591 95087
16 4600 95089
21 4601 95091
25 4654 95093
29 4658 95094
31 4664 95096
33 4666 95098
34 4668 95101
37 4669 95102
38 4670 95105
40 4671 95106
42 4672 95107
44 4673 95108
47 4674 95109
48 4675 95110
49 4676 95111
50 4677 95112
51 46...

result:

ok count=50000

Test #151:

score: 0
Accepted
time: 15ms
memory: 7668kb

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
0 2483 66933
1 3463 66934
2 5543 66935
3 5668 66937
5 6350 66938
8 6434 66939
9 6437 66940
10 6446 66941
11 6449 66949
12 6450 66950
13 6451 66951
16 6452 66953
18 6453 66954
19 6454 66957
20 6455 66960
22 6456 66961
30 6457 66962
32 6458 66963
34 6459 66966
35 6460 66967
36 6461 66970
38 6462...

result:

ok count=50000

Test #152:

score: 0
Accepted
time: 15ms
memory: 7432kb

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
0 995 91513
7 1072 91514
8 1337 91515
9 1349 91521
11 1392 91522
12 1402 91525
13 1403 91531
14 1404 91534
16 1405 91537
17 1406 91541
18 1407 91542
20 1408 91548
21 1409 91549
22 1410 91550
26 1411 91552
27 1412 91553
28 1413 91554
30 1414 91555
32 1415 91556
33 1416 91559
34 1417 91563
35 14...

result:

ok count=50000

Test #153:

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

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
3 4 333356
5 8 333212
6 9 333217
7 10 333357
13 14 333222
11 15 333359
12 16 333362
19 20 333364
24 27 333223
25 28 333226
23 29 333365
31 32 333230
26 33 333366
30 34 333367
37 38 333232
40 42 333235
41 43 333242
47 48 333376
49 50 333377
51 53 333244
52 54 333245
55 56 333246
60 61 333378
6...

result:

ok count=133513

Test #154:

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

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 6 332954
4 8 333728
7 9 333729
11 13 332955
12 14 332956
21 23 332957
25 27 332959
22 28 333731
24 29 333732
26 30 333734
33 34 332962
46 47 332964
48 49 332965
45 50 333736
52 53 333738
56 59 332967
57 64 332970
58 65 333739
60 66 333741
61 67 333742
62 68 333743
63 69 333745
73 74 333747
...

result:

ok count=133361

Test #155:

score: 0
Accepted
time: 54ms
memory: 19636kb

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
4 5 333480
7 8 333482
11 12 333484
27 29 333128
28 30 333129
31 32 333131
34 35 333132
36 37 333488
39 41 333489
40 42 333490
48 50 333134
49 53 333491
51 54 333492
52 55 333495
56 58 333498
57 59 333499
70 71 333500
72 74 333501
73 75 333502
76 77 333135
78 79 333139
89 90 333503
91 92 33314...

result:

ok count=133217

Test #156:

score: 0
Accepted
time: 41ms
memory: 20460kb

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
6 8 333393
7 9 333394
13 14 333275
10 15 333397
16 17 333277
11 18 333398
12 19 333403
26 28 333405
27 29 333406
44 46 333278
45 47 333279
43 48 333409
57 58 333281
59 60 333410
65 67 333287
64 69 333411
70 72 333290
71 73 333291
66 74 333412
75 76 333292
68 77 333413
81 82 333417
86 87 33329...

result:

ok count=133621

Test #157:

score: 0
Accepted
time: 27ms
memory: 16184kb

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
3 4 260861
2 7 261405
8 10 260864
9 11 260866
5 12 261409
6 13 261411
14 15 260867
17 18 260868
22 23 260869
35 36 260870
38 39 260873
47 48 260874
52 53 260876
56 57 261412
58 59 260879
60 63 260881
61 65 260882
62 66 260886
64 67 260888
69 71 260889
72 73 260891
70 76 261416
74 77 261422
75...

result:

ok count=104516

Test #158:

score: 0
Accepted
time: 35ms
memory: 16448kb

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 7 261154
5 8 261361
16 19 261155
17 22 261156
20 23 261157
18 24 261366
21 25 261369
27 28 261370
30 32 261158
29 33 261372
31 34 261373
38 39 261159
47 48 261374
53 55 261160
54 57 261161
56 58 261162
59 61 261163
60 62 261376
64 66 261377
65 67 261379
74 75 261380
77 78 261381
80 81 26116...

result:

ok count=104147

Test #159:

score: 0
Accepted
time: 35ms
memory: 16088kb

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
5 6 260851
3 8 261103
4 9 261106
7 10 261108
13 14 260852
15 17 260853
16 18 260858
12 19 261109
24 25 260859
29 31 260860
30 32 260864
33 36 260865
34 38 260869
35 39 260871
37 40 261111
45 46 260872
44 47 261113
49 53 260874
48 54 261119
50 55 261120
51 56 261122
52 57 261124
59 60 261128
6...

result:

ok count=104570

Test #160:

score: 0
Accepted
time: 35ms
memory: 16324kb

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
8 10 260996
9 11 260997
7 12 261791
18 19 260998
25 26 261792
27 28 261796
30 31 261002
34 35 261004
33 36 261800
40 41 261008
45 47 261801
46 48 261802
49 50 261806
52 53 261808
58 60 261812
59 61 261814
65 66 261009
70 71 261815
72 73 261818
76 78 261010
79 80 261012
77 81 261819
82 83 2618...

result:

ok count=103891

Test #161:

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

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: 3ms
memory: 7516kb

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: 42ms
memory: 19792kb

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: 26ms
memory: 19552kb

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: 31ms
memory: 20656kb

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: 0ms
memory: 3584kb

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: 50ms
memory: 19552kb

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