QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#425673#6537. One, Two, ThreeheaksicnAC ✓80ms46560kbC++172.6kb2024-05-30 15:35:242024-05-30 15:35:27

Judging History

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

  • [2024-05-30 15:35:27]
  • 评测
  • 测评结果:AC
  • 用时:80ms
  • 内存:46560kb
  • [2024-05-30 15:35:24]
  • 提交

answer

//Man always remember love because of romance only!
#include<bits/stdc++.h>
using namespace std;
#define pa pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define ve vector<int> 
inline int read(){
    int n=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) n=(n<<3)+(n<<1)+(ch^48),ch=getchar();
    return w?-n:n;
}
inline void write(int x){
	if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
//ABC->CBA,ACB->CAB
//ABCB->CBAB
vector<ve> A,C,AB,CB,ABC;
vector<ve> ACB,ABCB;
//A,C->AB,CB
//AB,CB->ABC->ABCB
//ACB->ABCB,AB+CB 
ve operator +(ve x,ve y){
	for(auto u:y) x.push_back(u);
	return x;
} 
ve top(vector<ve> &x){
	ve res=x.back();
	x.pop_back();
	return res;
} 
ve del(ve x,int k){
	x.erase(x.begin()+k);
	return x;
}
int a[600001];
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n=read();
	for(int i=1;i<=n;i++){
		int x=read();
		a[i]=x;
		if(x==1){
			if(CB.size()) ABC.push_back(top(CB)+ve{i});//CB+A->ABC
			else if(ACB.size()){//ACB+A->A+ABC
				ve k=top(ACB);
				int j=a[k[1]]==x;
				A.push_back({k[j]});
				ABC.push_back(del(k,j)+ve{i});
			}else if(ABCB.size()){//ABCB+A->AB+ABC
				ve k=top(ABCB);
				int j=(a[k[2]]==x)<<1;
				AB.push_back({k[j],k[j+1]});
				j^=2;
				ABC.push_back({k[j],k[j+1],i});
			}else A.push_back({i});
		}else if(x==3){
			if(AB.size()) ABC.push_back(top(AB)+ve{i});//AB+C->ABC
			else if(ACB.size()){//ACB+C->C+ABC
				ve k=top(ACB);
				int j=a[k[1]]==x;
				C.push_back({k[j]});
				ABC.push_back(del(k,j)+ve{i});
			}else if(ABCB.size()){//ABCB+C->CB+ABC
				ve k=top(ABCB);
				int j=(a[k[2]]==x)<<1;
				CB.push_back({k[j],k[j+1]});
				j^=2;
				ABC.push_back({k[j],k[j+1],i});
			}else C.push_back({i});
		}else{
			if(A.size()&&C.size()){//A+C+B->ABC	
				int k1=top(A)[0],k2=top(C)[0];
				if(k1>k2) swap(k1,k2);
				ACB.push_back({k1,k2,i});
			}else if(A.size()) AB.push_back(top(A)+ve{i});//A+B->AB
			else if(C.size()) CB.push_back(top(C)+ve{i});//C+B->CB
			else if(ACB.size()){//ABC+B->AB+CB
				ve k=top(ACB);
				int j=a[k[1]]==1;
				AB.push_back({k[j],k[2]});
				CB.push_back({k[j^1],i});
			}else if(ABC.size()) ABCB.push_back(top(ABC)+ve{i});//ABC+B->ABCB
		}
	}
	write(ABC.size()+ABCB.size());
	putchar('\n');
	for(auto x:ABC){
		int &i=x[0],&j=x[2];
		if(i>j) swap(i,j);
		cout<<x[0]-1<<" "<<x[1]-1<<" "<<x[2]-1<<"\n";
	}
	for(auto x:ABCB){
		int &i=x[0],&j=x[2];
		if(i>j) swap(i,j);
		cout<<x[0]-1<<" "<<x[1]-1<<" "<<x[2]-1<<"\n";
	}
	return 0;
}

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

詳細信息

Test #1:

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

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

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

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

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
13 14 15
11 18 19
9 20 21
24 27 28
25 30 31
23 29 32
22 39 40
45 46 47
48 51 52
8 54 55
5 60 61
70 71 72
66 67 77
78 79 80
83 84 85
86 87 88
81 92 93
96 97 98
112 113 117
104 105 119
95 99 120
125 128 129
133 138 139
143 144 145
146 148 149
151 162 163
132 168 169
164 167 170
171 176 177
180 181...

result:

ok count=499

Test #4:

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

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
1932 1933 2901

result:

ok count=1

Test #5:

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

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

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

result:

ok count=500

Test #7:

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

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
1407 1474 1774
1487 1598 1775
1480 1605 1776
1609 1772 1777
1606 1607 1778
1610 1771 1779
275 342 1780
1611 1770 1781
136 262 1782
1612 1769 1783
1483 1602 1784
1613 1768 1785
269 348 1786
1614 1767 1787
1615 1766 1788
1484 1601 1789
755 760 1790
1608 1773 1791
482 565 1792
575 746 1793
1434 14...

result:

ok count=1000

Test #8:

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

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
994 1233 1234
992 993 1235
995 1232 1236
960 989 1237
998 1231 1238
996 997 1239
351 606 1240
990 991 1241
364 593 1242
1000 1229 1243
999 1230 1244
972 975 1245
961 988 1246
720 959 1247
1003 1226 1248
1002 1227 1249
836 837 1250
834 835 1251
363 594 1252
1006 1223 1253
718 719 1254
722 957 12...

result:

ok count=1000

Test #9:

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

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
378 431 432
379 430 433
206 209 434
380 429 435
267 308 436
227 248 437
262 313 438
381 428 439
266 309 440
328 369 441
318 377 442
96 183 443
383 426 444
382 427 445
259 316 446
323 374 447
386 387 448
389 422 449
390 421 450
320 375 451
260 315 452
391 420 453
255 256 454
97 182 455
394 417 45...

result:

ok count=999

Test #10:

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

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
1714 1851 1852
1715 1850 1853
768 943 1854
1076 1155 1855
1716 1849 1856
1717 1848 1857
644 1065 1858
1719 1846 1859
1157 1712 1860
1720 1845 1861
1158 1711 1862
1721 1844 1863
1416 1417 1864
1718 1847 1865
1156 1713 1866
1439 1440 1867
1722 1843 1868
1077 1154 1869
1723 1842 1870
1724 1841 1871...

result:

ok count=998

Test #11:

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

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

result:

ok count=1000

Test #12:

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

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
976 977 999
964 965 1000
992 997 1001
967 968 1002
995 996 1003
959 960 1004
993 994 1005
979 982 1006
955 956 1007
980 981 1008
529 530 1009
917 918 1010
525 528 1011
948 949 1012
953 954 1013
940 941 1014
928 935 1015
933 934 1016
923 926 1017
924 925 1018
912 913 1019
906 907 1020
904 905 102...

result:

ok count=673

Test #13:

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

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
997 998 999
976 977 1000
980 981 1001
986 987 1002
916 917 1003
972 975 1004
991 992 1005
925 926 1006
927 928 1007
964 965 1008
962 963 1009
966 967 1010
929 930 1011
933 934 1012
958 959 1013
935 936 1014
952 953 1015
960 961 1016
940 941 1017
356 357 1018
913 914 1019
774 777 1020
823 824 102...

result:

ok count=683

Test #14:

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

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
981 982 983
954 957 984
997 998 999
968 969 1000
985 988 1001
991 996 1002
986 987 1003
989 990 1004
964 967 1005
992 995 1006
975 978 1007
976 977 1008
970 973 1009
971 972 1010
993 994 1011
963 974 1012
965 966 1013
943 944 1014
959 962 1015
947 948 1016
955 956 1017
941 942 1018
950 951 1019
...

result:

ok count=629

Test #15:

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

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
981 986 999
926 933 1000
921 924 1001
975 976 1002
997 998 1003
982 985 1004
979 980 1005
850 851 1006
983 984 1007
972 973 1008
934 939 1009
965 966 1010
968 971 1011
969 970 1012
959 960 1013
919 942 1014
957 958 1015
920 925 1016
945 950 1017
948 949 1018
865 876 1019
946 947 1020
935 936 102...

result:

ok count=712

Test #16:

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

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 1999 2000
1 1998 2001
2 1997 2002
3 1996 2003
4 1995 2004
5 1994 2005
6 1993 2006
7 1992 2007
8 1991 2008
9 1990 2009
10 1989 2010
11 1988 2011
12 1987 2012
13 1986 2013
14 1985 2014
15 1984 2015
16 1983 2016
17 1982 2017
18 1981 2018
19 1980 2019
20 1979 2020
21 1978 2021
22 1977 2022
23 197...

result:

ok count=1000

Test #17:

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

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 3 2999

result:

ok count=1

Test #18:

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

input:

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

output:

3
2 3 4
5 6 7
9 11 12

result:

ok count=3

Test #19:

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

input:

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

output:

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

result:

ok count=6

Test #20:

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

input:

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

output:

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

result:

ok count=5

Test #21:

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

input:

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

output:

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

result:

ok count=5

Test #22:

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

input:

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

output:

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

result:

ok count=6

Test #23:

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

input:

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

output:

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

result:

ok count=6

Test #24:

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

input:

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

output:

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

result:

ok count=6

Test #25:

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

input:

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

output:

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

result:

ok count=5

Test #26:

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

input:

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

output:

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

result:

ok count=6

Test #27:

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

input:

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

output:

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

result:

ok count=5

Test #28:

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

input:

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

output:

2
1 2 7
6 13 16

result:

ok count=2

Test #29:

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

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: 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 5
7 10 14

result:

ok count=2

Test #31:

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

input:

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

output:

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

result:

ok count=5

Test #32:

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

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

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

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

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

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
4 5 6
2 15 16
10 14 17
9 18 19
11 13 20
22 23 24
12 27 28
21 26 29
40 42 43
38 48 49
37 50 51
36 52 53
57 60 61
58 59 62
47 63 64
46 67 68
66 69 70
65 71 72
76 78 79
77 80 81
56 83 84
88 89 90
55 91 92
54 94 95
35 96 97
34 98 99
93 102 103
87 104 105
101 107 108
106 113 114
110 112 115
111 116 ...

result:

ok count=4997

Test #36:

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

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

result:

ok count=4999

Test #37:

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

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 3
2 4 9
7 8 11
5 6 14
17 18 19
22 23 24
16 25 26
13 27 28
12 30 31
36 37 38
43 44 45
50 52 53
55 57 58
56 65 66
59 64 67
62 63 68
41 69 70
33 71 72
32 74 75
73 76 77
78 80 81
88 90 91
86 94 95
82 96 97
87 98 99
89 93 100
92 103 104
110 113 114
109 112 115
108 116 117
120 122 123
121 125 126...

result:

ok count=4998

Test #38:

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

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

result:

ok count=5000

Test #39:

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

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
604 605 606
122 164 607
556 603 608
538 539 609
534 545 610
227 352 611
552 553 612
557 602 613
522 551 614
558 601 615
218 361 616
217 362 617
135 156 618
380 521 619
560 599 620
523 550 621
559 600 622
524 525 623
561 598 624
152 155 625
153 154 626
562 597 627
563 596 628
531 548 629
564 595...

result:

ok count=5000

Test #40:

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

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
1418 2125 2326
1320 1381 2327
2162 2325 2328
2163 2324 2329
1321 1380 2330
1384 2159 2331
1385 2158 2332
2166 2321 2333
2165 2322 2334
1386 2157 2335
2167 2320 2336
2164 2323 2337
1387 2156 2338
2168 2319 2339
2169 2318 2340
203 241 2341
1382 2161 2342
2170 2317 2343
2171 2316 2344
2172 2315 23...

result:

ok count=5000

Test #41:

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

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
3574 3913 3914
2308 2849 3915
3126 3573 3916
3576 3911 3917
3577 3910 3918
1674 2227 3919
3578 3909 3920
37 670 3921
2906 3033 3922
3575 3912 3923
3212 3487 3924
3211 3488 3925
3579 3908 3926
3580 3907 3927
3581 3906 3928
3582 3905 3929
3583 3904 3930
2298 2859 3931
2300 2857 3932
3584 3903 393...

result:

ok count=5000

Test #42:

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

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
28 144 1098
1050 1097 1099
361 364 1100
1051 1096 1101
358 365 1102
503 610 1103
1052 1095 1104
612 1049 1105
1054 1093 1106
553 554 1107
1053 1094 1108
1055 1092 1109
833 834 1110
357 366 1111
1056 1091 1112
356 367 1113
613 1048 1114
1060 1089 1115
614 1047 1116
1062 1087 1117
1063 1086 1118
...

result:

ok count=2000

Test #43:

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

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
1144 1955 2414
1956 2413 2415
1145 1954 2416
1957 2412 2417
1958 2411 2418
323 526 2419
1053 1126 2420
1169 1930 2421
212 246 2422
1959 2410 2423
561 1012 2424
539 1034 2425
1164 1935 2426
1163 1936 2427
1960 2409 2428
1961 2408 2429
1962 2407 2430
1146 1953 2431
1963 2406 2432
717 856 2433
40 ...

result:

ok count=3000

Test #44:

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

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
2855 3430 5080
4371 4848 5081
4852 5077 5082
3474 4369 5083
4853 5076 5084
4372 4847 5085
4854 5075 5086
4370 4849 5087
4851 5078 5088
4850 5079 5089
1163 1242 5090
4856 5073 5091
4373 4846 5092
4855 5074 5093
3582 4261 5094
3565 4278 5095
3563 4280 5096
4374 4845 5097
4857 5072 5098
2884 3401 ...

result:

ok count=4000

Test #45:

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

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
772 773 858
606 661 859
60 142 860
686 857 861
687 856 862
36 195 863
630 631 864
688 855 865
196 197 866
689 854 867
580 685 868
691 852 869
449 454 870
690 853 871
198 199 872
324 569 873
581 684 874
692 851 875
693 850 876
694 849 877
74 153 878
696 847 879
697 846 880
698 845 881
699 844 88...

result:

ok count=5000

Test #46:

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

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
3164 3897 3898
3091 3098 3899
3165 3896 3900
3022 3163 3901
3166 3895 3902
447 963 3903
1931 1980 3904
376 1003 3905
3023 3162 3906
3168 3893 3907
1899 2008 3908
3167 3894 3909
378 1002 3910
379 1001 3911
3024 3161 3912
3170 3891 3913
2625 2768 3914
3169 3892 3915
381 1000 3916
382 999 3917
317...

result:

ok count=5000

Test #47:

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

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
293 693 2308
2173 2306 2309
2081 2170 2310
2039 2078 2311
2175 2304 2312
2174 2305 2313
2080 2171 2314
2176 2303 2315
2083 2084 2316
2177 2302 2317
2082 2169 2318
2172 2307 2319
1405 1524 2320
1133 1332 2321
228 532 2322
219 535 2323
2178 2301 2324
2085 2168 2325
2179 2300 2326
2036 2079 2327
2...

result:

ok count=5000

Test #48:

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

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
4949 4950 4997
4998 4999 5000
4904 4909 5001
4973 4996 5002
4966 4967 5003
4976 4995 5004
4971 4972 5005
4977 4994 5006
4992 4993 5007
4990 4991 5008
4978 4981 5009
4982 4989 5010
4979 4980 5011
4986 4987 5012
4942 4947 5013
4974 4975 5014
4954 4955 5015
4962 4963 5016
4983 4984 5017
4985 4988 ...

result:

ok count=3267

Test #49:

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

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
4964 4965 5000
4969 4978 5001
4958 4959 5002
4992 4993 5003
4989 4990 5004
4986 4987 5005
4954 4955 5006
4974 4977 5007
4982 4983 5008
4968 4979 5009
4944 4947 5010
4941 4942 5011
4925 4928 5012
4950 4951 5013
4949 4952 5014
4975 4976 5015
4936 4937 5016
4926 4927 5017
4912 4913 5018
4920 4921 ...

result:

ok count=3340

Test #50:

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

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
4644 4651 4662
4657 4658 4665
4663 4664 4666
4659 4660 4667
4631 4632 4668
4642 4643 4669
4653 4654 4670
4645 4646 4671
4647 4650 4672
4628 4629 4673
4648 4649 4674
4637 4638 4675
4619 4622 4676
4639 4640 4677
4568 4569 4678
4620 4621 4679
4606 4607 4680
4561 4566 4681
4562 4563 4682
4581 4584 ...

result:

ok count=3042

Test #51:

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

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
4319 4320 4333
4330 4331 4334
3354 3355 4335
3352 3353 4336
3253 3256 4337
1489 1490 4338
4315 4316 4339
4313 4314 4340
4308 4309 4341
4310 4311 4342
4299 4300 4343
4292 4293 4344
4290 4291 4345
4277 4278 4346
4273 4276 4347
4282 4285 4348
4281 4286 4349
3379 3380 4350
4274 4275 4351
4283 4284 ...

result:

ok count=2941

Test #52:

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

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
3648 3659 3664
3622 3623 3665
3209 3210 3666
3384 3385 3667
3279 3282 3668
3276 3283 3669
3645 3646 3670
3634 3641 3671
3649 3658 3672
3661 3662 3673
3305 3306 3674
3257 3258 3675
3291 3292 3676
3635 3638 3677
3650 3657 3678
3653 3656 3679
3280 3281 3680
3174 3175 3681
3654 3655 3682
3639 3640 ...

result:

ok count=2460

Test #53:

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

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
3638 3641 3666
3632 3633 3667
3659 3660 3668
3653 3654 3669
3655 3656 3670
3619 3646 3671
3651 3652 3672
3622 3635 3673
3637 3644 3674
3631 3634 3675
3642 3643 3676
3607 3608 3677
3627 3628 3678
3623 3626 3679
3599 3600 3680
3639 3640 3681
3636 3645 3682
3603 3604 3683
3517 3518 3684
3624 3625 ...

result:

ok count=2423

Test #54:

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

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
3638 3639 3650
3626 3627 3659
3662 3665 3666
3633 3636 3667
3622 3625 3668
3663 3664 3669
3643 3644 3670
3581 3582 3671
3651 3658 3672
3660 3661 3673
3591 3592 3674
3508 3509 3675
3652 3655 3676
3656 3657 3677
3215 3216 3678
3175 3176 3679
3648 3649 3680
3653 3654 3681
3163 3164 3682
3628 3629 ...

result:

ok count=2372

Test #55:

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

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
3657 3658 3665
3660 3661 3666
3653 3654 3667
1892 1893 3668
1889 1890 3669
1881 1886 3670
1669 1692 3671
1672 1689 3672
344 345 3673
3649 3650 3674
3645 3646 3675
2399 2400 3676
3651 3652 3677
3641 3644 3678
3633 3640 3679
3642 3643 3680
3638 3639 3681
2363 2364 3682
3634 3635 3683
3636 3637 36...

result:

ok count=2490

Test #56:

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

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 8259

result:

ok count=1

Test #57:

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

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
5343 5344 8595

result:

ok count=1

Test #58:

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

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 9999 10000
1 9998 10001
2 9997 10002
3 9996 10003
4 9995 10004
5 9994 10005
6 9993 10006
7 9992 10007
8 9991 10008
9 9990 10009
10 9989 10010
11 9988 10011
12 9987 10012
13 9986 10013
14 9985 10014
15 9984 10015
16 9983 10016
17 9982 10017
18 9981 10018
19 9980 10019
20 9979 10020
21 9978 100...

result:

ok count=5000

Test #59:

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

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 14998

result:

ok count=1

Test #60:

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

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
3000 8999 9000
3001 8998 9001
3002 8997 9002
3003 8996 9003
3004 8995 9004
3005 8994 9005
3006 8993 9006
3007 8992 9007
3008 8991 9008
3009 8990 9009
3010 8989 9010
3011 8988 9011
3012 8987 9012
3013 8986 9013
3014 8985 9014
3015 8984 9015
3016 8983 9016
3017 8982 9017
3018 8981 9018
3019 8980 ...

result:

ok count=3000

Test #61:

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

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 9953 9976
1 9952 9977
2 9951 9978
3 9950 9979
4 9949 9980
5 9948 9981
6 9947 9982
7 9946 9983
8 9945 9984
9 9944 9985
10 9943 9986
11 9942 9987
12 9941 9988
13 9940 9989
14 9939 9990
15 9938 9991
16 9937 9992
17 9936 9993
18 9935 9994
19 9934 9995
20 9933 9996
21 9932 9997
22 9931 9998
23 993...

result:

ok count=4977

Test #62:

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

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

result:

ok count=29

Test #63:

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

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

result:

ok count=29

Test #64:

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

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

result:

ok count=28

Test #65:

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

result:

ok count=30

Test #66:

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

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

result:

ok count=29

Test #67:

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

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

result:

ok count=28

Test #68:

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

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

result:

ok count=27

Test #69:

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

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

result:

ok count=30

Test #70:

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

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
50 51 58

result:

ok count=1

Test #71:

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

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
86 87 93

result:

ok count=1

Test #72:

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

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

result:

ok count=33

Test #73:

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

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

result:

ok count=32

Test #74:

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

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

result:

ok count=33

Test #75:

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

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

result:

ok count=31

Test #76:

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

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

result:

ok count=30

Test #77:

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

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
13 14 31
10 11 32
21 22 33
5 6 34
18 19 40
27 28 41
8 9 42
1 2 45
62 66 67
64 69 70
57 72 73
44 79 80
54 78 81
52 82 83
55 77 84
56 76 85
59 75 86
48 88 89
46 91 92
50 90 97

result:

ok count=20

Test #78:

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

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
26 27 33
22 23 34
16 17 35
9 10 38
24 25 39
7 8 42
60 68 69
61 67 70
71 72 73
64 76 77
63 78 79
57 75 80
66 74 81
65 83 84
62 85 86
88 89 90
49 95 96
50 94 97

result:

ok count=18

Test #79:

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

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
14 15 21
8 9 22
12 13 23
25 26 32
0 1 33
7 10 34
24 31 35
29 30 36
27 28 39
51 72 73
42 71 74
41 75 78
63 94 97
54 84 85
43 70 83

result:

ok count=15

Test #80:

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

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 5 32
12 31 33
27 30 34
28 29 35
25 26 36
18 24 37
20 23 38
13 19 42
14 17 43
21 22 44
10 11 46
15 16 51
6 7 55
2 4 57
59 65 66
62 64 68
54 73 75
53 77 79
80 81 82
49 90 91
50 89 92

result:

ok count=21

Test #81:

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

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

result:

ok count=33

Test #82:

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

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

result:

ok count=33

Test #83:

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

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

result:

ok count=32

Test #84:

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

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 5
4 6 8
9 10 11
12 13 18
3 16 21
26 27 28
24 25 31
19 20 32
37 38 39
29 30 40
35 42 43
36 41 44
34 45 47
22 23 48
33 50 53
56 57 58
51 55 59
52 54 60
62 64 65
46 49 67
61 63 68
14 17 69
70 71 72
75 76 78
79 80 81
74 77 82
84 85 87
90 91 93
95 103 115
94 107 116
105 106 117
96 102 118
123 124...

result:

ok count=999

Test #85:

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

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
3 4 5
1 10 11
6 9 12
0 13 14
2 8 15
32 37 43
17 19 44
20 42 45
23 41 46
31 40 47
26 30 48
35 36 49
33 34 50
38 39 53
7 29 55
56 57 59
58 60 62
54 64 67
61 63 74
21 22 75
18 24 76
16 28 79
25 27 82
84 86 87
83 89 90
95 96 97
94 100 101
104 109 110
113 114 115
121 122 123
120 124 125
117 129 130
1...

result:

ok count=995

Test #86:

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

input:

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

output:

2
1 2 7
6 13 16

result:

ok count=2

Test #87:

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

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

input:

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

output:

2
0 1 5
7 10 14

result:

ok count=2

Test #89:

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

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

result:

ok count=29

Test #90:

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

input:

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

output:

3
2 3 4
5 6 7
9 11 12

result:

ok count=3

Test #91:

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

input:

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

output:

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

result:

ok count=6

Test #92:

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

input:

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

output:

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

result:

ok count=5

Test #93:

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

input:

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

output:

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

result:

ok count=5

Test #94:

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

input:

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

output:

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

result:

ok count=6

Test #95:

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

input:

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

output:

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

result:

ok count=6

Test #96:

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

input:

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

output:

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

result:

ok count=6

Test #97:

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

input:

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

output:

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

result:

ok count=5

Test #98:

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

input:

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

output:

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

result:

ok count=6

Test #99:

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

input:

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

output:

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

result:

ok count=5

Test #100:

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

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

result:

ok count=29

Test #101:

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

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

result:

ok count=29

Test #102:

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

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

result:

ok count=28

Test #103:

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

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

result:

ok count=30

Test #104:

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

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

result:

ok count=29

Test #105:

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

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

result:

ok count=28

Test #106:

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

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

result:

ok count=27

Test #107:

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

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

result:

ok count=30

Test #108:

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

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
50 51 58

result:

ok count=1

Test #109:

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

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
86 87 93

result:

ok count=1

Test #110:

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

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

result:

ok count=33

Test #111:

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

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

result:

ok count=32

Test #112:

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

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

result:

ok count=33

Test #113:

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

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

result:

ok count=31

Test #114:

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

result:

ok count=30

Test #115:

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

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
13 14 31
10 11 32
21 22 33
5 6 34
18 19 40
27 28 41
8 9 42
1 2 45
62 66 67
64 69 70
57 72 73
44 79 80
54 78 81
52 82 83
55 77 84
56 76 85
59 75 86
48 88 89
46 91 92
50 90 97

result:

ok count=20

Test #116:

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

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
26 27 33
22 23 34
16 17 35
9 10 38
24 25 39
7 8 42
60 68 69
61 67 70
71 72 73
64 76 77
63 78 79
57 75 80
66 74 81
65 83 84
62 85 86
88 89 90
49 95 96
50 94 97

result:

ok count=18

Test #117:

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

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
14 15 21
8 9 22
12 13 23
25 26 32
0 1 33
7 10 34
24 31 35
29 30 36
27 28 39
51 72 73
42 71 74
41 75 78
63 94 97
54 84 85
43 70 83

result:

ok count=15

Test #118:

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

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 5 32
12 31 33
27 30 34
28 29 35
25 26 36
18 24 37
20 23 38
13 19 42
14 17 43
21 22 44
10 11 46
15 16 51
6 7 55
2 4 57
59 65 66
62 64 68
54 73 75
53 77 79
80 81 82
49 90 91
50 89 92

result:

ok count=21

Test #119:

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

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

result:

ok count=33

Test #120:

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

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

result:

ok count=33

Test #121:

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

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

result:

ok count=32

Test #122:

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

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 5
4 6 8
9 10 11
12 13 18
3 16 21
26 27 28
24 25 31
19 20 32
37 38 39
29 30 40
35 42 43
36 41 44
34 45 47
22 23 48
33 50 53
56 57 58
51 55 59
52 54 60
62 64 65
46 49 67
61 63 68
14 17 69
70 71 72
75 76 78
79 80 81
74 77 82
84 85 87
90 91 93
95 103 115
94 107 116
105 106 117
96 102 118
123 124...

result:

ok count=999

Test #123:

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

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
3 4 5
1 10 11
6 9 12
0 13 14
2 8 15
32 37 43
17 19 44
20 42 45
23 41 46
31 40 47
26 30 48
35 36 49
33 34 50
38 39 53
7 29 55
56 57 59
58 60 62
54 64 67
61 63 74
21 22 75
18 24 76
16 28 79
25 27 82
84 86 87
83 89 90
95 96 97
94 100 101
104 109 110
113 114 115
121 122 123
120 124 125
117 129 130
1...

result:

ok count=995

Test #124:

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

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
13 14 15
11 18 19
9 20 21
24 27 28
25 30 31
23 29 32
22 39 40
45 46 47
48 51 52
8 54 55
5 60 61
70 71 72
66 67 77
78 79 80
83 84 85
86 87 88
81 92 93
96 97 98
112 113 117
104 105 119
95 99 120
125 128 129
133 138 139
143 144 145
146 148 149
151 162 163
132 168 169
164 167 170
171 176 177
180 181...

result:

ok count=499

Test #125:

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

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
1932 1933 2901

result:

ok count=1

Test #126:

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

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

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

result:

ok count=500

Test #128:

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

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
1407 1474 1774
1487 1598 1775
1480 1605 1776
1609 1772 1777
1606 1607 1778
1610 1771 1779
275 342 1780
1611 1770 1781
136 262 1782
1612 1769 1783
1483 1602 1784
1613 1768 1785
269 348 1786
1614 1767 1787
1615 1766 1788
1484 1601 1789
755 760 1790
1608 1773 1791
482 565 1792
575 746 1793
1434 14...

result:

ok count=1000

Test #129:

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

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
994 1233 1234
992 993 1235
995 1232 1236
960 989 1237
998 1231 1238
996 997 1239
351 606 1240
990 991 1241
364 593 1242
1000 1229 1243
999 1230 1244
972 975 1245
961 988 1246
720 959 1247
1003 1226 1248
1002 1227 1249
836 837 1250
834 835 1251
363 594 1252
1006 1223 1253
718 719 1254
722 957 12...

result:

ok count=1000

Test #130:

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

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
378 431 432
379 430 433
206 209 434
380 429 435
267 308 436
227 248 437
262 313 438
381 428 439
266 309 440
328 369 441
318 377 442
96 183 443
383 426 444
382 427 445
259 316 446
323 374 447
386 387 448
389 422 449
390 421 450
320 375 451
260 315 452
391 420 453
255 256 454
97 182 455
394 417 45...

result:

ok count=999

Test #131:

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

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
1714 1851 1852
1715 1850 1853
768 943 1854
1076 1155 1855
1716 1849 1856
1717 1848 1857
644 1065 1858
1719 1846 1859
1157 1712 1860
1720 1845 1861
1158 1711 1862
1721 1844 1863
1416 1417 1864
1718 1847 1865
1156 1713 1866
1439 1440 1867
1722 1843 1868
1077 1154 1869
1723 1842 1870
1724 1841 1871...

result:

ok count=998

Test #132:

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

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

result:

ok count=1000

Test #133:

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

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
976 977 999
964 965 1000
992 997 1001
967 968 1002
995 996 1003
959 960 1004
993 994 1005
979 982 1006
955 956 1007
980 981 1008
529 530 1009
917 918 1010
525 528 1011
948 949 1012
953 954 1013
940 941 1014
928 935 1015
933 934 1016
923 926 1017
924 925 1018
912 913 1019
906 907 1020
904 905 102...

result:

ok count=673

Test #134:

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

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
997 998 999
976 977 1000
980 981 1001
986 987 1002
916 917 1003
972 975 1004
991 992 1005
925 926 1006
927 928 1007
964 965 1008
962 963 1009
966 967 1010
929 930 1011
933 934 1012
958 959 1013
935 936 1014
952 953 1015
960 961 1016
940 941 1017
356 357 1018
913 914 1019
774 777 1020
823 824 102...

result:

ok count=683

Test #135:

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

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
981 982 983
954 957 984
997 998 999
968 969 1000
985 988 1001
991 996 1002
986 987 1003
989 990 1004
964 967 1005
992 995 1006
975 978 1007
976 977 1008
970 973 1009
971 972 1010
993 994 1011
963 974 1012
965 966 1013
943 944 1014
959 962 1015
947 948 1016
955 956 1017
941 942 1018
950 951 1019
...

result:

ok count=629

Test #136:

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

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
981 986 999
926 933 1000
921 924 1001
975 976 1002
997 998 1003
982 985 1004
979 980 1005
850 851 1006
983 984 1007
972 973 1008
934 939 1009
965 966 1010
968 971 1011
969 970 1012
959 960 1013
919 942 1014
957 958 1015
920 925 1016
945 950 1017
948 949 1018
865 876 1019
946 947 1020
935 936 102...

result:

ok count=712

Test #137:

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

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 1999 2000
1 1998 2001
2 1997 2002
3 1996 2003
4 1995 2004
5 1994 2005
6 1993 2006
7 1992 2007
8 1991 2008
9 1990 2009
10 1989 2010
11 1988 2011
12 1987 2012
13 1986 2013
14 1985 2014
15 1984 2015
16 1983 2016
17 1982 2017
18 1981 2018
19 1980 2019
20 1979 2020
21 1978 2021
22 1977 2022
23 197...

result:

ok count=1000

Test #138:

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

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 3 599999

result:

ok count=1

Test #139:

score: 0
Accepted
time: 53ms
memory: 16292kb

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 5
3 6 7
10 11 12
15 16 19
22 23 25
18 20 26
0 14 27
28 29 30
9 13 31
1 8 35
37 38 40
34 39 41
36 43 44
33 45 46
42 47 50
53 54 55
58 59 63
21 49 64
24 48 65
69 71 72
62 74 75
67 76 77
61 78 79
66 80 81
68 73 82
95 98 99
93 100 101
89 103 104
92 102 105
57 109 110
86 108 111
90 107 112
85 ...

result:

ok count=200000

Test #140:

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

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

result:

ok count=200000

Test #141:

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

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
104 105 122
64 65 130
53 54 132
155 156 200
239 240 251
38 39 257
297 324 325
366 377 378
354 465 466
497 500 501
524 542 543
512 550 551
345 563 564
332 568 569
267 571 572
579 613 614
643 675 676
641 686 687
640 703 704
630 744 745
774 781 782
769 792 793
808 809 819
848 849 877
889 894 895
9...

result:

ok count=4999

Test #142:

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

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

result:

ok count=5000

Test #143:

score: 0
Accepted
time: 75ms
memory: 16660kb

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 2
5 6 7
3 10 11
24 38 39
31 32 44
45 46 61
50 51 62
49 58 65
59 60 68
66 67 69
74 75 76
70 71 77
72 73 78
52 57 85
81 82 86
91 92 107
87 88 110
89 106 113
41 42 116
114 115 117
111 112 118
108 109 119
90 93 120
79 80 121
40 43 122
103 104 123
53 54 124
55 56 125
36 37 126
99 100 127
30 35...

result:

ok count=200000

Test #144:

score: 0
Accepted
time: 77ms
memory: 22980kb

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
51340 137635 303000
51199 144046 303001
51197 144045 303002
51338 137636 303003
51337 137637 303004
51194 144044 303005
51336 137638 303006
51335 137639 303007
51333 137640 303008
51332 137641 303009
51193 144043 303010
51191 144042 303011
51189 144041 303012
51188 144040 303013
51328 137642 ...

result:

ok count=200000

Test #145:

score: 0
Accepted
time: 74ms
memory: 19736kb

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
265595 265596 277080
254096 277079 277081
254097 277078 277082
68228 136477 277083
33530 33531 277084
254100 277075 277085
215136 254093 277086
254101 277074 277087
215135 254094 277088
254099 277076 277089
215137 254092 277090
173998 215131 277091
254103 277072 277092
173999 215130 277093
25...

result:

ok count=200000

Test #146:

score: 0
Accepted
time: 80ms
memory: 22256kb

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
215090 222235 285882
222236 285881 285883
104278 185237 285884
215091 222234 285885
144766 144768 285886
222238 285879 285887
222239 285878 285888
215092 222233 285889
222240 285877 285890
193594 215089 285891
222241 285876 285892
83193 93470 285893
222243 285874 285894
215094 222231 285895
2...

result:

ok count=200000

Test #147:

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

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
2019 2568 14924
11524 14923 14925
6833 8044 14926
6834 8043 14927
4643 6830 14928
11528 14919 14929
11226 11519 14930
11529 14918 14931
11530 14917 14932
8049 11218 14933
6836 8041 14934
11228 11517 14935
11532 14915 14936
11533 14914 14937
8051 11216 14938
11535 14912 14939
11536 14911 14940
...

result:

ok count=20000

Test #148:

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

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
2810 3133 3134
724 779 3135
2811 3132 3136
1630 2809 3137
2812 3131 3138
2813 3130 3139
1175 1176 3140
1631 2808 3141
2814 3129 3142
2815 3128 3143
1158 1191 3144
955 966 3145
1229 1280 3146
1712 2727 3147
2816 3127 3148
1306 1629 3149
1633 2806 3150
1126 1223 3151
2820 3123 3152
1634 2805 315...

result:

ok count=30000

Test #149:

score: 0
Accepted
time: 12ms
memory: 7728kb

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
34891 36656 45704
36684 42189 45705
36685 42188 45706
45338 45701 45707
16595 16596 45708
42193 45332 45709
36687 42186 45710
45341 45698 45711
45340 45699 45712
45339 45700 45713
42195 45330 45714
45343 45696 45715
45344 45695 45716
42194 45331 45717
45345 45694 45718
45346 45693 45719
42192 ...

result:

ok count=40000

Test #150:

score: 0
Accepted
time: 21ms
memory: 9100kb

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
83098 89269 90560
89270 90559 90561
83359 89008 90562
89271 90558 90563
89272 90557 90564
60234 78837 90565
60321 78750 90566
83357 89010 90567
89273 90556 90568
59490 79581 90569
89275 90554 90570
83099 89268 90571
89274 90555 90572
83100 89267 90573
89276 90553 90574
89277 90552 90575
79582 ...

result:

ok count=50000

Test #151:

score: 0
Accepted
time: 21ms
memory: 8804kb

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
33849 33868 33948
183 9780 33949
33769 33946 33950
33220 33767 33951
33768 33947 33952
33770 33945 33953
32518 33103 33954
32418 33201 33955
32417 33202 33956
33251 33736 33957
33771 33944 33958
33221 33766 33959
33772 33943 33960
25180 29249 33961
32401 33218 33962
33774 33941 33963
32402 332...

result:

ok count=50000

Test #152:

score: 0
Accepted
time: 21ms
memory: 7300kb

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
27510 36379 83092
60362 60363 83093
61381 83090 83094
61382 83089 83095
59338 61379 83096
47972 47973 83097
61384 83087 83098
61385 83086 83099
18983 19859 83100
59339 61378 83101
61383 83088 83102
61380 83091 83103
59340 61377 83104
61386 83085 83105
15330 23541 83106
61388 83083 83107
59341 ...

result:

ok count=50000

Test #153:

score: 0
Accepted
time: 69ms
memory: 26544kb

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
199998 199999 200000
199994 199995 200001
199986 199987 200002
199991 199992 200003
199988 199989 200004
199990 199993 200005
199279 199280 200006
199267 199270 200007
199261 199262 200008
199246 199247 200009
199257 199260 200010
199976 199977 200011
199974 199975 200012
199971 199972 200013...

result:

ok count=133513

Test #154:

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

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
199980 199981 200000
199966 199969 200001
199972 199973 200002
199956 199997 200003
199961 199996 200004
199964 199971 200005
199993 199994 200006
199974 199987 200007
199965 199970 200008
199989 199992 200009
199990 199991 200010
199982 199985 200011
199939 199940 200012
199976 199979 200013...

result:

ok count=133361

Test #155:

score: 0
Accepted
time: 62ms
memory: 27416kb

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
199925 199926 200000
199935 199936 200001
199937 199992 200002
199994 199995 200003
199934 199993 200004
199938 199991 200005
199989 199990 200006
199868 199869 200007
199929 199930 200008
199943 199988 200009
199864 199865 200010
199279 199282 200011
198685 198686 200012
198631 198634 200013...

result:

ok count=133217

Test #156:

score: 0
Accepted
time: 49ms
memory: 28740kb

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
199977 199988 200000
199963 199964 200001
199993 199998 200002
199953 199954 200003
199956 199959 200004
199929 199930 200005
199994 199997 200006
199935 199950 200007
199986 199987 200008
199982 199985 200009
199965 199972 200010
199983 199984 200011
199970 199971 200012
199957 199958 200013...

result:

ok count=133621

Test #157:

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

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
156651 156652 156665
156619 156620 156666
156616 156617 156667
156645 156646 156668
156597 156608 156669
156614 156615 156670
156595 156596 156671
156599 156604 156672
156600 156603 156673
156561 156562 156674
156554 156555 156675
156601 156602 156676
156545 156546 156677
156477 156484 156678...

result:

ok count=104516

Test #158:

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

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
156652 156653 156666
156651 156654 156667
156658 156661 156668
156643 156646 156669
156586 156587 156670
156644 156645 156671
156659 156660 156672
156433 156434 156673
156657 156662 156674
156627 156632 156675
156639 156640 156676
156628 156629 156677
156625 156626 156678
156420 156421 156679...

result:

ok count=104147

Test #159:

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

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
156019 156022 156666
156007 156008 156667
156649 156664 156668
156633 156634 156669
156662 156663 156670
156027 156028 156671
156660 156661 156672
156026 156031 156673
155118 155121 156674
156658 156659 156675
156650 156657 156676
156476 156477 156677
156651 156656 156678
156652 156655 156679...

result:

ok count=104570

Test #160:

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

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
156630 156631 156666
156657 156658 156667
156646 156647 156668
156644 156645 156669
156636 156637 156670
156654 156655 156671
156614 156629 156672
156639 156640 156673
156663 156664 156674
156608 156609 156675
145068 145071 156676
143849 143852 156677
156615 156628 156678
156298 156299 156679...

result:

ok count=103891

Test #161:

score: 0
Accepted
time: 23ms
memory: 46560kb

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
358024 358025 386125

result:

ok count=1

Test #162:

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

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: 49ms
memory: 31228kb

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 399999 400000
1 399998 400001
2 399997 400002
3 399996 400003
4 399995 400004
5 399994 400005
6 399993 400006
7 399992 400007
8 399991 400008
9 399990 400009
10 399989 400010
11 399988 400011
12 399987 400012
13 399986 400013
14 399985 400014
15 399984 400015
16 399983 400016
17 399982 4000...

result:

ok count=200000

Test #164:

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

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 599998

result:

ok count=1

Test #165:

score: 0
Accepted
time: 49ms
memory: 31644kb

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
120000 359999 360000
120001 359998 360001
120002 359997 360002
120003 359996 360003
120004 359995 360004
120005 359994 360005
120006 359993 360006
120007 359992 360007
120008 359991 360008
120009 359990 360009
120010 359989 360010
120011 359988 360011
120012 359987 360012
120013 359986 360013...

result:

ok count=120000

Test #166:

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

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: 53ms
memory: 32284kb

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 395399 397600
1 395398 397601
2 395397 397602
3 395396 397603
4 395395 397604
5 395394 397605
6 395393 397606
7 395392 397607
8 395391 397608
9 395390 397609
10 395389 397610
11 395388 397611
12 395387 397612
13 395386 397613
14 395385 397614
15 395384 397615
16 395383 397616
17 395382 3976...

result:

ok count=197700