QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#424910#6537. One, Two, ThreeffffycAC ✓16ms27460kbC++143.4kb2024-05-29 19:49:262024-05-29 19:49:26

Judging History

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

  • [2024-05-29 19:49:26]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:27460kb
  • [2024-05-29 19:49:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
namespace IO{//by cyffff
	int len=0;
	char ibuf[(1<<21)+1],*iS,*iT,out[(1<<25)+1];
	#if ONLINE_JUDGE
	#define gh() (iS==iT?iT=(iS=ibuf)+fread(ibuf,1,(1<<21)+1,stdin),(iS==iT?EOF:*iS++):*iS++)
 	#else
	#define gh() getchar()
	#endif
	#define reg register
	inline int read(){
		reg char ch=gh();
		reg int x=0;
		reg char t=0;
		while(ch<'0'||ch>'9')   t|=ch=='-',ch=gh();
		while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=gh();
		return t?-x:x;
	}
	inline void putc(char ch){
		out[len++]=ch;
	}
	template<class T>
	inline void write(T x){
		if(x<0)putc('-'),x=-x;
		if(x>9)write(x/10);
		out[len++]=x%10+48;
	}
	inline void flush(){
		fwrite(out,1,len,stdout);
		len=0;
	}
	inline char getc(){
		char ch=gh();
		while(ch<'A'||ch>'Z') ch=gh();
		return ch;
	}
}
using IO::read;
using IO::write;
using IO::flush;
using IO::getc;
using IO::putc;
const int N=6e5+10;
int n,pr[N];
int stk[7][N],tp[7];
/*
0 A
1 C
2 AB
3 BC
4 ACB=CAB
5 ABCB=CBAB
6 ABC=CBA
*/
inline void push(int x,int i){
	stk[x][++tp[x]]=i;
}
int main(){
//	freopen("triples.in","r",stdin);
//	freopen("triples.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++){
		int v=read();
		if(v==1){
			if(tp[3]){
//				puts("1 3 6");
				int p=stk[3][tp[3]--];
				pr[pr[p]]=i;
				push(6,p);
			}else if(tp[4]){
//				puts("1 4 0 6");
				int p=stk[4][tp[4]--];
				push(0,pr[pr[p]]);
				int q=pr[p];
				pr[q]=p,pr[p]=i;
				push(6,q);
			}else if(tp[5]){
//				puts("1 5 2 6");
				int p=stk[5][tp[5]--];
				if(pr[pr[p]]>pr[p]){
					int q=pr[p];
					pr[p]=pr[pr[pr[p]]];
					push(2,p);
					pr[pr[q]]=i;
					push(6,q);
				}else{
					push(2,pr[pr[p]]);
					int q=pr[p];
					pr[q]=p,pr[p]=i;
					push(6,q);
				}
			}else{
//				puts("1 0");
				push(0,i);
			}
		}else if(v==3){
			if(tp[2]){
//				puts("3 2 6");
				int p=stk[2][tp[2]--];
				pr[i]=p;
				push(6,i);
			}else if(tp[4]){
//				puts("3 4 1 6");
				int p=stk[4][tp[4]--];
				push(1,pr[p]);
				pr[p]=pr[pr[p]],pr[i]=p;
				push(6,i);
			}else if(tp[5]){
//				puts("3 5 3 6");
				int p=stk[5][tp[5]--];
				if(pr[pr[p]]<pr[p]){
					int q=pr[p];
					pr[i]=pr[pr[p]];
					push(6,i);
					pr[q]=p;
					push(3,q);
				}else{
					push(3,pr[p]);
					pr[p]=pr[pr[pr[p]]],pr[i]=p;
					push(6,i);
				}
			}else{
//				puts("3 1");
				push(1,i);
			}
		}else{
			if(tp[0]&&tp[1]){
//				puts("2 0 1 4");
				int p=stk[0][tp[0]--],q=stk[1][tp[1]--];
				pr[q]=p,pr[i]=q;
				push(4,i);
			}else if(tp[0]){
//				puts("2 0 2");
				int p=stk[0][tp[0]--];
				pr[i]=p;
				push(2,i);
			}else if(tp[1]){
//				puts("2 1 3");
				int p=stk[1][tp[1]--];
				pr[p]=i;
				push(3,p);
			}else if(tp[4]){
				int p=stk[4][tp[4]--];
				pr[i]=pr[pr[p]];
				push(2,i);
				int q=pr[p];
				pr[q]=p;
				push(3,q);
			}else if(tp[6]){
//				puts("2 6 5");
				int p=stk[6][tp[6]--];
				pr[i]=p;
				push(5,i);
			}
		}
	}
	write(tp[5]+tp[6]),putc('\n');
	for(int p=1;p<=tp[5];p++){
		int i=pr[stk[5][p]],j=pr[i],k=pr[j];
		if(i>k) swap(i,k);
		write(i-1),putc(' '),write(j-1),putc(' '),write(k-1),putc('\n');
	}
	for(int p=1;p<=tp[6];p++){
		int i=stk[6][p],j=pr[i],k=pr[j];
		if(i>k) swap(i,k);
		write(i-1),putc(' '),write(j-1),putc(' '),write(k-1),putc('\n');
	}
	flush();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
3 1 2 2 3 1

output:

2
1 3 4
0 2 5

result:

ok count=2

Test #2:

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

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

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

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

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

input:

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

output:

1
1755 1756 2819

result:

ok count=1

Test #6:

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

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

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 139 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: 20036kb

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

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

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

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

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

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
1994 2944 2947
1991 2001 2954
1992 2000 2953
1988 2004 2957
1998 2950 2959
1995 1999 2952
1989 2003 2946
1990 2002 2945
1952 2934 2936
1986 2006 2966
1987 2005 2965
1977 2031 2971
1970 2033 2973
1983 2030 2970
1997 2949 2976
1985 2025 2969
1975 2032 2935
1996 2948 2980
1946 2927 2933
1993 2943 2...

result:

ok count=683

Test #14:

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

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
1997 2993 2994
1995 1998 2996
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 1...

result:

ok count=629

Test #15:

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

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
1976 2016 2991
1989 2989 2990
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...

result:

ok count=712

Test #16:

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

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

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

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

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 6 15
4 14 16
0 13 17

result:

ok count=6

Test #20:

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

input:

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

output:

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

result:

ok count=5

Test #21:

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

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

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 12 13
7 8 15
1 9 16
6 14 17

result:

ok count=6

Test #23:

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

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

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

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

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

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

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 15 16

result:

ok count=2

Test #29:

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

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

input:

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

output:

2
7 13 14
0 1 5

result:

ok count=2

Test #31:

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

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

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

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

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

input:

6
3 1 2 2 3 1

output:

2
1 3 4
0 2 5

result:

ok count=2

Test #35:

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

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

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

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

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

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

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 214 2341
1382 2161 2342
2170 2317 2343
2171 2316 2344
2172 2315 23...

result:

ok count=5000

Test #41:

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

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

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

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

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 1409 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: 4ms
memory: 20060kb

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 151 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 140 878
696 847 879
697 846 880
698 845 881
699 844 88...

result:

ok count=5000

Test #46:

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

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 1016 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
31...

result:

ok count=5000

Test #47:

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

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 500 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 661 2322
219 658 2323
2178 2301 2324
2085 2168 2325
2179 2300 2326
2036 2079 2327
2...

result:

ok count=5000

Test #48:

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

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
9992 10025 14954
10023 14955 14957
10022 14952 14953
9996 10024 14960
9989 10026 14963
9983 14951 14962
9986 10028 14968
9988 10027 14967
9977 14950 14966
9963 14941 14945
9965 14942 14944
9966 10048 14943
9955 14935 14936
9954 14933 14934
9943 10062 14930
9942 14926 14929
9944 14927 14928
9937...

result:

ok count=3267

Test #49:

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

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

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
9322 9342 13837
9323 9339 13836
9329 9336 13835
9310 13827 13830
9320 13828 13829
9300 13823 13824
9292 13819 13820
9330 13834 13845
9328 13833 13847
9301 9364 13818
9325 13832 13850
9319 9343 13852
9299 9365 13816
9321 13831 13855
9288 13814 13815
9284 13811 13812
9271 13803 13804
9316 9348 13...

result:

ok count=3042

Test #51:

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

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
8634 8760 12970
8631 12964 12969
8664 8667 12976
8641 8706 12968
8662 8668 12982
8663 12971 12981
8658 8669 12985
8599 8773 12987
8590 8774 12990
8619 12963 12989
8582 8784 12995
8581 8785 12997
4319 4320 4333
4330 4331 4334
3354 3355 4335
3352 3353 4336
3253 3256 4337
1489 1490 4338
4315 4316 ...

result:

ok count=2941

Test #52:

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

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
7321 7337 10980
7325 10978 10979
7319 7340 10977
7331 10983 10987
7327 10982 10989
7326 10981 10991
7309 7363 10972
7312 7360 10971
7330 7332 10995
7296 10969 10970
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 ...

result:

ok count=2460

Test #53:

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

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
7317 10944 10945
7302 7360 10938
7293 7364 10933
7294 10927 10930
7295 10928 10929
7274 10916 10925
7323 10947 10956
7326 10948 10955
7275 7384 10924
7276 10917 10923
7282 10920 10922
7280 7381 10921
7334 7337 10963
7278 10918 10919
7328 7339 10967
7327 7340 10969
7330 7338 10966
7257 7402 1091...

result:

ok count=2423

Test #54:

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

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

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

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

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

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

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

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

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

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 77 84
81 82 85
75 78 86
73 74 87
72 76 89

result:

ok count=29

Test #63:

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

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
84 85 88
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

result:

ok count=29

Test #64:

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

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
0 87 90
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 88 89

result:

ok count=28

Test #65:

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

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
17 18 25
41 42 51
2 15 57
56 59 91
4 5 6
7 8 9
0 13 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 16 89
75 76 90
50 53 93

result:

ok count=30

Test #66:

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

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

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 48 51
47 49 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: 19968kb

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 15 25
26 27 28
23 24 29
19 22 30
8 16 35
33 34 37
39 40 41
42 43 44
36 38 45
14 18 50
46 49 51
52 53 54
47 48 55
20 21 57
31 32 58
13 17 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: 15928kb

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

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

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

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 21 67
53 54 68
51 52 69
47 48 70
38 39 71
41 44 72
45 46 73
34 35 74
2 6 75
13 28 76
10 11 77
3 4 78
15 26 79
5 9 80
16 25 81
1 8 82
14 27 83
19 20 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: 19968kb

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

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 94 95
24 89 96
21 93 97
23 90 98

result:

ok count=33

Test #75:

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

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 87 88
23 83 89
16 86 90
18 85 91
22 84 92

result:

ok count=31

Test #76:

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

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

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

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

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
54 84 85
43 70 83
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 64 97

result:

ok count=15

Test #80:

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

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

input:

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

output:

33
0 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: 20036kb

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 65 66
7 64 67
14 63 68
45 60 72
33 71 73
30 70 74
17 61 75
55 59 86
84 85 87
57 58 88
34 77 89
29 69 90
82 83 93
16 62 94
91 92 95
76 81 96
56 78 97
79 80 98

result:

ok count=33

Test #83:

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

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

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

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

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 15 16

result:

ok count=2

Test #87:

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

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

input:

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

output:

2
7 13 14
0 1 5

result:

ok count=2

Test #89:

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

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 84 86
83 85 87

result:

ok count=29

Test #90:

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

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

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 6 15
4 14 16
0 13 17

result:

ok count=6

Test #92:

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

input:

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

output:

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

result:

ok count=5

Test #93:

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

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

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 12 13
7 8 15
1 9 16
6 14 17

result:

ok count=6

Test #95:

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

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

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

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

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

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

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 77 84
81 82 85
75 78 86
73 74 87
72 76 89

result:

ok count=29

Test #101:

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

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
84 85 88
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

result:

ok count=29

Test #102:

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

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
0 87 90
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 88 89

result:

ok count=28

Test #103:

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

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
17 18 25
41 42 51
2 15 57
56 59 91
4 5 6
7 8 9
0 13 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 16 89
75 76 90
50 53 93

result:

ok count=30

Test #104:

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

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

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 48 51
47 49 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: 20084kb

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 15 25
26 27 28
23 24 29
19 22 30
8 16 35
33 34 37
39 40 41
42 43 44
36 38 45
14 18 50
46 49 51
52 53 54
47 48 55
20 21 57
31 32 58
13 17 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: 2ms
memory: 15928kb

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

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

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

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 21 67
53 54 68
51 52 69
47 48 70
38 39 71
41 44 72
45 46 73
34 35 74
2 6 75
13 28 76
10 11 77
3 4 78
15 26 79
5 9 80
16 25 81
1 8 82
14 27 83
19 20 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: 20024kb

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

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 94 95
24 89 96
21 93 97
23 90 98

result:

ok count=33

Test #113:

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

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 87 88
23 83 89
16 86 90
18 85 91
22 84 92

result:

ok count=31

Test #114:

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

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

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

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

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
54 84 85
43 70 83
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 64 97

result:

ok count=15

Test #118:

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

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 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 5 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: 11836kb

input:

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

output:

33
0 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: 20036kb

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 65 66
7 64 67
14 63 68
45 60 72
33 71 73
30 70 74
17 61 75
55 59 86
84 85 87
57 58 88
34 77 89
29 69 90
82 83 93
16 62 94
91 92 95
76 81 96
56 78 97
79 80 98

result:

ok count=33

Test #121:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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
1994 2944 2947
1991 2001 2954
1992 2000 2953
1988 2004 2957
1998 2950 2959
1995 1999 2952
1989 2003 2946
1990 2002 2945
1952 2934 2936
1986 2006 2966
1987 2005 2965
1977 2031 2971
1970 2033 2973
1983 2030 2970
1997 2949 2976
1985 2025 2969
1975 2032 2935
1996 2948 2980
1946 2927 2933
1993 2943 2...

result:

ok count=683

Test #135:

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

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
1997 2993 2994
1995 1998 2996
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 1...

result:

ok count=629

Test #136:

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

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
1976 2016 2991
1989 2989 2990
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...

result:

ok count=712

Test #137:

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

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: 5ms
memory: 12940kb

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: 11ms
memory: 25352kb

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: 16ms
memory: 25228kb

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 12 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 11 42
45 47 48
44 53 54
50 51 58
43 52 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: 0ms
memory: 16884kb

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

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: 16ms
memory: 25304kb

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: 11ms
memory: 27460kb

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 144154 303000
51199 137743 303001
51197 137744 303002
51338 144153 303003
51337 144152 303004
51194 137745 303005
51336 144151 303006
51335 144150 303007
51333 144149 303008
51332 144148 303009
51193 137746 303010
51191 137747 303011
51189 137748 303012
51188 137749 303013
51328 144147 ...

result:

ok count=200000

Test #145:

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

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 35669 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: 11ms
memory: 27448kb

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

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

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

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

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

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

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 19674 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: 6ms
memory: 25516kb

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: 12ms
memory: 25616kb

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: 8ms
memory: 25636kb

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
399993 400006 599763
399992 599761 599762
399990 400007 599760
399981 400024 599756
399999 599766 599772
400000 400001 599771
399971 599754 599755
399968 599750 599752
399976 400026 599751
399947 599742 599745
399998 599765 599782
399982 400023 599785
399989 599758 599790
399975 400027 599789...

result:

ok count=133217

Test #156:

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

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: 8ms
memory: 23128kb

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: 8ms
memory: 23128kb

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
313305 469934 469957
313313 469940 469956
313327 469952 469955
313331 313337 469954
313332 313336 469953
313315 469942 469951
313298 469931 469964
313318 469945 469950
313319 469946 469949
313324 469947 469948
313330 313338 469969
313316 469943 469944
313322 313354 469941
313307 469938 469939...

result:

ok count=104147

Test #159:

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

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
313330 313336 469801
313329 313347 469803
313309 313354 469798
313305 313360 469796
313308 313359 469795
313299 313364 469791
313328 469800 469809
313322 469799 469811
313307 469788 469789
313289 313381 469787
313321 469797 469815
313304 313361 469817
313294 313366 469786
313271 313399 469778...

result:

ok count=104570

Test #160:

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

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: 6ms
memory: 16860kb

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

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: 5ms
memory: 17880kb

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

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: 5ms
memory: 19488kb

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

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: 15ms
memory: 21964kb

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