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 C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        const bool IsTest = false;

        const string t1 = "3";
        const string t2 = "4";
        const string t3 = "1";
        const string t4 = "10";

        public static void Main(string[] args)
        {
            if (!IsTest) {
                new Program().Solve(new ConsoleInput(Console.In));
            } else {
                new Program().Solve(new ConsoleInput(new StringReader(t1)));
                new Program().Solve(new ConsoleInput(new StringReader(t2)));
                new Program().Solve(new ConsoleInput(new StringReader(t3)));
                new Program().Solve(new ConsoleInput(new StringReader(t4)));
            }
        }

        public void Solve(ConsoleInput cin)
        {
            var t = cin.ReadLineAs<int>();
            var N = t.Item1;
            var c = 0;
            var cc = 1;
            var k = 1;
            while (c < N) {
                c += cc;
                cc++;
                k++;
            }
            if (c != N) {
                Console.WriteLine("No");
            } else {
                Console.WriteLine("Yes");
                Console.WriteLine(N);
                for (var i = 0; i < k - 1; i++) {
                    for (var j = i + 1; j < k; j++) {
                        Console.WriteLine("2 " + (i + 1) + " " + (j + 1));
                    }
                }
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private readonly char _separator = ' ';
        private string _curLine;
        private string[] _curLineSplitted;
        private int _curItemIndex;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
        }
        public T Read<T>()
        {
            var converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(T));
            if (converter == null) {
                throw new Exception(string.Format("TypeDescriptor.GetConverter {0}", typeof(T).Name));
            }
            return (T)converter.ConvertFromString(ReadString());
        }
        public T[] ReadArray<T>(long N)
        {
            var ret = new T[N];
            for (long i = 0; i < N; i++) {
                ret[i] = Read<T>();
            }
            return ret;
        }
        public Tuple<T> ReadLineAs<T>()
        {
            ReadLine();
            return new Tuple<T>(Read<T>());
        }
        public Tuple<T, S> ReadLineAs<T, S>()
        {
            ReadLine();
            return new Tuple<T, S>(Read<T>(), Read<S>());
        }
        public Tuple<T, S, U> ReadLineAs<T, S, U>()
        {
            ReadLine();
            return new Tuple<T, S, U>(Read<T>(), Read<S>(), Read<U>());
        }
        public Tuple<T, S, U, V> ReadLineAs<T, S, U, V>()
        {
            ReadLine();
            return new Tuple<T, S, U, V>(Read<T>(), Read<S>(), Read<U>(), Read<V>());
        }
        public Tuple<T, S, U, V, R> ReadLineAs<T, S, U, V, R>()
        {
            ReadLine();
            return new Tuple<T, S, U, V, R>(Read<T>(), Read<S>(), Read<U>(), Read<V>(), Read<R>());
        }

        public string ReadString()
        {
            return _curLineSplitted[_curItemIndex++];
        }
        public void ReadLine()
        {
            _curLine = _stream.ReadLine();
            if (_curLine == null) {
                throw new System.Exception("No more lines");
            }
            _curLineSplitted = _curLine.Split(_separator);
            _curItemIndex = 0;
        }
    }
}