Problem:
Score : 500 points

Problem Statement

You are given an integer N. Determine if there exists a tuple of subsets of \{1,2,...N\}, (S_1,S_2,...,S_k), that satisfies the following conditions:

Each of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k.

Any two of the sets S_1,S_2,...,S_k have exactly one element in common.

If such a tuple exists, construct one such tuple.

Constraints

1 \leq N \leq 10^5

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

If a tuple of subsets of \{1,2,...N\} that satisfies the conditions does not exist, print No.
If such a tuple exists, print Yes first, then print such subsets in the following format:

k
|S_1| S_{1,1} S_{1,2} ... S_{1,|S_1|}
:
|S_k| S_{k,1} S_{k,2} ... S_{k,|S_k|}

where S_i={S_{i,1},S_{i,2},...,S_{i,|S_i|}}.

If there are multiple such tuples, any of them will be accepted.

Sample Input 1

3

Sample Output 1

Yes
3
2 1 2
2 3 1
2 2 3

It can be seen that (S_1,S_2,S_3)=(\{1,2\},\{3,1\},\{2,3\}) satisfies the conditions.

Sample Input 2

4

Sample Output 2

No

Solution in Go (1.14.1) (judge verdict: Runtime Error)

// 3 6 10 15 21 28 36 45 55 ... はいけるんだなこれが それ以外いけるかどうかは知りませんがヨシ！
// サンプル1をみると、最下段に「それまで出てないやつを集める」、最下段以外の右端に「最下段と共通にしたいやつを加える」をしていく感じだとわかる
// 実装、よくわからんかったので最大値までのテーブルを無理やり作ることにした
package main
import "fmt"
func main(){
	var N int
	fmt.Scan(&N)
	ai := 3
	idx := 0
	accept := false
	for ai<=N{
		if ai == N{
			accept = true
		}
		ai=ai+3+idx
		idx++
	}
	if !accept{
		fmt.Println("No")
		return
	}
	T := make([][]int, 400)	// なんか10^5程度なら139番目に9870がきて終了するので
	for i:=0; i<len(T); i++{
		T[i] = make([]int, 400)
	}
	// 基礎 手打ちで作成...
	T[0][0], T[1][0] = 1, 1
	T[1][1], T[2][1] = 2, 2
	T[0][1], T[2][0] = 3, 3

	// 構築
	tmp := 4
	hight := 3
	for j:=2; j<400; j++{
		for i:=0; i<hight; i++{
			T[i][j] = tmp
			tmp++
		}
		hight++
	}
	tmp = 4
	width := 3
	for i:=3; i<400; i++{
		for j:=0; j<width; j++{
			T[i][j] = tmp
			tmp++
		}
		width++
	}
	fmt.Println("Yes")
	fmt.Println(idx+2)
	for i:=0; i<=idx+1; i++{
		fmt.Printf("%d ", idx+1)
		for j:=0; j<=idx; j++{
			fmt.Printf("%d ", T[i][j])
		}
		fmt.Println()
	}
}