Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
import sys

N=int(input())

if N==1:
    print("Yes")
    print(2)
    print(1,1)
    print(1,1)
    sys.exit()

#N<x*(x+1)/2
U=N #True
L=0 #False
flag=False

while U-L>1:
    x=(U+L)//2
    if N==x*(x+1)//2:
        print("Yes")
        flag=True
        break
    elif N<x*(x+1)//2:
        U=x
    else:
        L=x
        
if not flag: print("No")
else:
    print(x+1)
    
    data=[[0]*x for _ in range(x+1)]
    for i in range(x):
        data[0][i]=i+1
    head=x+1
    for i in range(1,x+1):
        for j in range(i):
            data[i][j]=data[j][i-1]
        for j in range(i,x):
            data[i][j]=head
            head+=1
            
    for i in range(x+1):
        print(x,end=' ')
        for d in data[i][:-1]:
            print(d,end=' ')
        print(data[i][-1])

# Example run
# Input:
7
# Output:
No
#D問題
N = int(input())

flag = 0
for i in range(2*N):
    I = i+1
    if I*(I+1) == 2*N:
        k = I+1
        flag = 1
        break
        
if flag == 0:
    print("No")
else:
    print("Yes")
    print(k)
    ans = [[] for i in range(k)]
    now = 0
    for i in range(k-1):
        loop = 1+i
        for j in range(loop):
            now+=1
            if j == 0:
                ans[0].append(now)
            if j == loop-1:
                ans[-1].append(now)
            if j > 0 and j < loop-1:
                ans[j].append(now)
            if i != 0:
                ans[i].append(now)
            
    for a in ans:
        print(len(a),end=" ")
        print(*a)

# Example run
# Input:
-60
# Output:
No
N = int(input())

k = 1

while 2*N >= k*(k-1):
    if 2*N == k*(k-1):
        print('Yes')
        print(k)

        S = [[0 for i in range(k-1)] for j in range(k)]

        for lis in range(k-1):
            S[0][lis] = lis + 1

        num_max = k - 1
        for history in range(1, k):
            num_max += k - 1 - history
            for bef_list in range(history):
                S[history][bef_list] = S[bef_list][history - 1]
            for new_list in range(k - history - 1):
                S[history][new_list + history] = num_max - new_list
            S[history].sort()

        for i in range(k):
            print(k-1, end=' ')
            for j in range(k-1):
                print(S[i][j], end=' ')
            print('')

        exit()

    k += 1

print('No')



# Example run
# Input:
0
# Output:
Yes
1
0
import itertools
N = int(input())
k = int((2 * N) ** 0.5) + 1
if (k-1) * k == 2 * N:
    print('Yes')
    S = [[] for _ in range(k)]
    n = 1
    for i, j in itertools.combinations(range(k), 2):
        S[i].append(str(n))
        S[j].append(str(n))
        n += 1
    for s in S:
        print(len(s), ' '.join(s))
else:
    print('No')

# Example run
# Input:
713362851
# Output:
No
N = int(input())
if N <= 2 or N % 2 == 0:
    print('No')
else:
    print('Yes')
    print(N)

    ans = []

    for i in range(N//2):
        ans.append([j+1+i*N for j in range(N)])

    for i in range(N//2):
        c = [j+1+i*N for j in range(N)]
        ans.append(c[i+1:]+c[:i+1])

    for i in zip(*ans):
        print(N-1, *i)


# Example run
# Input:
-56834839
# Output:
No
def sol():
    N = int(input())
    D = 0

    for d in range(1, int((2 * N)**0.5) + 100):
        if d * (d - 1) == 2 * N:
            D = d
            break

    if D == 0:
        print('No')
        return

    print('Yes')
    mx = 1
    ans = []
    for d in range(D):
        line = []
        for _ in range(D - d - 1):
            line.append(mx)
            mx += 1
        ans.append(line)
    for i in range(D):
        line = ans[i]
        for j in range(i):
            line.append(ans[j][-i])
    print(len(ans))
    for a in ans:
        print(len(a), end=' ')
        print(*a)

sol()

# Example run
# Input:
855881
# Output:
No
n = int(input())
if n >= 4:
    print('No')
else:
    print('Yes')

# Example run
# Input:
33
# Output:
No
N = int(input())

K = -1
for k in range(N+1):
    if k*(k-1)//2 == N:
        K = k
        break
    elif k*(k-1)//2 > N:
        break

if K == -1:
    print('No')
else:
    print('Yes')
    print(K)
    n = 0
    S = [[] for _ in range(K)]
    for i in range(K):
        for j in range(i+1, K):
            n += 1
            S[i].append(n)
            S[j].append(n)
    for s in S:
        print(len(s), ' '.join([str(a) for a in s]))

# Example run
# Input:
1198832728
# Output:
No
from math import *

def comb(arr, k):
    n = len(arr)
    def dfs(curr,cnt,tmp):
        ret = []
        if cnt==0:
            return [tmp]
        for i in range(curr,n-cnt+1):
            ret += dfs(i+1,cnt-1,tmp+[arr[i]])
        return ret
    return dfs(0,k,[])

N=int(input())
k1 = int(sqrt(2*N))
k2 = k1+1
if k1*k2 == 2*N:
    print("Yes")
    for arr in comb(list(range(1,N+1)), k1):
        print(" ".join([str(v) for v in [k1]+arr]))
else:
    print("No")


# Example run
# Input:
174025
# Output:
No
from itertools import combinations
n = int(input())
root = 1 + 8 * n
if int(root ** 0.5) ** 2 != root:
    print('No')
    exit()

k = (1 + int(root ** 0.5)) // 2
ans = [[] for _ in range(k)]

for i, a in enumerate(combinations(range(k), 2)):
    s, t = a
    ans[s].append(i + 1)
    ans[t].append(i + 1)
print('Yes')
print(k)
for List in ans:
    print(k - 1, *List)

# Example run
# Input:
140712839
# Output:
No
# D - Crossing
N = int(input())
k = 1

def list_print(S):
    print(len(S), end='')
    for i in range(len(S)):
        print(' {}'.format(S[i]), end='')
    print('')

while k<1000:
    if k*(k-1)//2==N:
        break
    k += 1
if k==1000:
    print('No')
else:
    S = [[] for _ in range(k)]
    i = 1
    for l in range(k):
        for r in range(l+1,k):
            S[l].append(i)
            S[r].append(i)
            i += 1
    print('Yes')
    print(k)
    for i in range(k):
        list_print(S[i])

# Example run
# Input:
224
# Output:
No
N = int(input())
"""
どの部分集合の共通する要素も一つだけで、各数字（１～N）は２回ずつしか出現しないことから、部分集合の数をｋとすると、
(1)と(2)の共通が１、(1)と(3)の共通が２、～、(k-1)と(k)の共通がN、のように表現でき、この中で１～Nが２回ずつ出現している。
ある部分集合がほかのk-1この部分集合と共通の値を一個ずつもつので、部分集合の要素数はk-1となる。
１～Nまで２回ずつ出てくる＆ｋ個の部分集合の要素がそれぞれ（ｋ－１）であることから、２N＝k(k-1)となる。
ｋが決まれば、上記の(1)と(2)の共通が１で～みたいな置き方をしていくだけでそれぞれの集合が決まる。
Nは10^5までなので、ｋが１０００程度の範囲までで、２N＝k(k-1)を満たすｋがあるか調べていけばよい。

公式開設動画が非常にわかりやすかった：https://www.youtube.com/watch?v=wwCqOcWkVh4
"""
k = 0
while N != k*(k-1)//2:
    k += 1
    if k == 1000:
        break

if k == 1000:
    print("No")
else:
    ans = [[] for _ in range(k)]
    cnt = 0
    for i in range(k):
        for j in range(i+1,k):
            ans[i].append(cnt+1)
            ans[j].append(cnt+1)
            cnt += 1

    print("Yes")
    print(k)
    for a in ans:
        print(k-1, *a)


# Example run
# Input:
51856
# Output:
No
n = int(input())
flag = 0
a = 0
for i in range(1, 1000):
    if n == a:
        flag = 1
        ans = i-1
        break
    else:
        a += i

if flag == 0:
    print(-1)
else:
    print(ans+1)
    ans = [[] for j in range(ans+1)]

    l = 1
    c = len(ans)-1
    s = -1
    for i in range(len(ans)):
        for j in range(len(ans)-c-1):
            ans[i].append(ans[j][s])
        for j in range(c):
            ans[i].append(l)
            l += 1
        c -= 1
        s += 1

    for i in range(len(ans)):
        print(len(ans[i]), " ".join(map(str, ans[i])))


# Example run
# Input:
6
# Output:
4
3 1 2 3
3 1 4 5
3 2 4 6
3 3 5 6
N = int(input())
import itertools

d = {}
k = 1
while k*(k-1)/2 < 10**5:
    d[int(k*(k-1)/2)] = k
    k += 1

if N not in d.keys():
    print("No")

else:
    print("Yes")
    k = d[N]
    output = [[] for _ in range(k)]
    print(k)

    comb_list = list(itertools.combinations(list(range(k)), 2))
    for n, comb in zip(range(1, N+1), comb_list):
        output[comb[0]].append(n)
        output[comb[1]].append(n)

    length = len(output[0])
    for l in output:
        print(length, *l)

# Example run
# Input:
-525059
# Output:
No
n = int(input())

ans = []
for i in range(1, n):
    ans.append([i, i+1])
ans.append([n, 1])

if n == 1:
    print('Yes')
    print(2)
    print('1 1')
    print('1 1')
elif n == 3:
    print('Yes')
    print(len(ans))
    for a in ans:
        print(str(len(a))+' '+' '.join(map(str, a)))
else:
     print('No')


# Example run
# Input:
-4
# Output:
No
N = int(input())

x = (1+(1+8*N)**0.5)/2
if x.is_integer():
  print('Yes')
  x = int(x)
  print(x)
  S = [[] for _ in range(x)]
  e = 1
  for i in range(x):
    for j in range(i+1,x):
      S[i].append(e)
      S[j].append(e)
      e += 1
  for s in S:
    print(len(s),*s)
else:
  print('No')

# Example run
# Input:
3650
# Output:
No
N=int(input())
num=0
ans='No'
for i in range(1,10**3):
    if i*(i+1)>2*N:
        break
    elif i*(i+1)==2*N:
        num=i
        ans='Yes'
        break
print(ans)
if ans=='Yes':
    print(num+1)
    arr=[[num] for i in range(num+1)]
    n=1
    for i in range(num+1):
        j=1
        while len(arr[i]) != num+1:
            arr[i].append(n)
            arr[i+j].append(n)
            j+=1
            n+=1
    
    for a in arr:
        print(a[0],end='')
        for x in a[1:]:
            print(' {}'.format(x),end='')
        print('')

# Example run
# Input:
-3339504
# Output:
No
N = int(input())

k = 0
while N != k*(k-1)//2:
    k += 1
    if k == 1000:
        break

if k == 1000:
    print("NO")
else:
    ans = [[] for _ in range(k)]
    cnt = 0
    for i in range(k):
        for j in range(i+1,k):
            ans[i].append(cnt+1)
            ans[j].append(cnt+1)
            cnt += 1

    print(k)
    for a in ans:
        print(k-1, *a)

# Example run
# Input:
-1964
# Output:
NO
def solve(n):
    k = 1
    while k * (k + 1) < 2 * n:
        k += 1
    if k * (k + 1) != 2 * n:
        return False, []
    ans = [[] for _ in range(1000)]
    add_num = 1
    ans[1].append(add_num)
    ans[0].append(add_num)
    for i in range(2, k + 1):
        for j in range(i):
            add_num += 1
            ans[i].append(add_num)
            ans[i - j - 1].append(add_num)
    return True, ans


def main():
    n = int(input())
    res, ans = solve(n)
    if res:
        print("Yes")
        for a in ans:
            if a:
                print(len(a), " ".join(map(str, a)))
            else:
                break
    else:
        print("No")


if __name__ == '__main__':
    main()


# Example run
# Input:
-1
# Output:
No
from itertools import combinations
n = int(input())
i = 1
plus = 1
flg = False
while i <= n:
    if i == n:
        flg = True
        break
    plus += 1
    i += plus
if flg:
    print("Yes")
    res = {i : [] for i in range(plus+1)}
    for i, combi in enumerate(combinations(range(plus + 1), 2), 1):
        res[combi[0]].append(str(i))
        res[combi[1]].append(str(i))
    print(plus + 1)
    for i, val in res.items():
        print(str(plus) + " " + " ".join(val))
else:
    print("No")

# Example run
# Input:
-997
# Output:
No
N = int(input())
if N % 2 == 0:
    print("No")
    exit()

print(N)
for i in range(N):
    print(2, i + 1, (i + 1) % N + 1)


# Example run
# Input:
-1917273
# Output:
-1917273
N = int(input())
if N == 3:
    print("Yes")
    print(3)
    print(2,1,2)
    print(2,3,1)
    print(2,2,3)
elif N == 1:
    print("Yes")
    print(2)
    print(1, 1)
    print(1, 1)
else:
    ("No")

# Example run
# Input:
5507
# Output:
N = int(input())

def printCompleteGraph(n):
    edge = [(u, v) for u in range(n)
                   for v in range(u + 1, n)
                   if u != v]
    name = {e: i+1 for i, e in enumerate(edge)}
    for u in range(n):
        e = [name[(min(u, v), max(u, v))] for v in range(n) if u != v]
        print(len(e), ' '.join(map(str, e)))

for n in range(2, max(N, 2) + 1):
    if n * (n - 1) // 2 == N:
        print('Yes')
        print(n)
        printCompleteGraph(n)
        exit()
print('No')


# Example run
# Input:
71
# Output:
No
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve(N):
    if N == 1:
        print(Yes)
        print(2)
        print(1, 1)
        print(1, 1)
        return
    K = -1
    for k in range(1, N + 1):
        if (k * (k - 1)) // 2 == N:
            K = k

    if K == -1:
        print(No)
        return

    ans = [[] for _ in range(K)]
    num = 1
    for i in range(0, K):
        for j in range(i + 1, K):
            ans[i].append(num)
            ans[j].append(num)
            num += 1

    print(Yes)
    print(K)
    for v in ans:
        print(len(v), *v, sep=" ")


def main():
    N = int(input())
    solve(N)


if __name__ == '__main__':
    main()


# Example run
# Input:
55
# Output:
Yes
11
10 1 2 3 4 5 6 7 8 9 10
10 1 11 12 13 14 15 16 17 18 19
10 2 11 20 21 22 23 24 25 26 27
10 3 12 20 28 29 30 31 32 33 34
10 4 13 21 28 35 36 37 38 39 40
10 5 14 22 29 35 41 42 43 44 45
10 6 15 23 30 36 41 46 47 48 49
10 7 16 24 31 37 42 46 50 51 52
10 8 17 25 32 38 43 47 50 53 54
10 9 18 26 33 39 44 48 51 53 55
10 10 19 27 34 40 45 49 52 54 55
N=int(input())
triangle=[(i*(i-1))//2 for i in range(0,N+1)]
if not N in triangle:
    print('No')
else:
    print('Yes')
    k=triangle.index(N)
    print(k)
    count=0
    S=[[] for i in range(0,k)]
    for i in range(0,k):
        if i==0:
            S[i]=[j for j in range(1,k)]
            count=k-1
        else:
            for j in range(0,i):
                S[i].append(S[j][i-1])
            for j in range(0,k-1-i):
                S[i].append(count+1)
                count+=1
        print(k-1,*S[i])


# Example run
# Input:
456
# Output:
No
n= int(input())
k=((8*n+1)**0.5-1)/2
if k.is_integer():
    print('Yes')
    ik=int(k)
    print(ik+1)
    prel,newl=[],[]
    nexv,last=0,0
    for i in range(ik+1):
        if i==0:
            print(ik,*[t+1 for t in range(ik)])
            nexv=1
        else:
            last+=ik-i+1
            newl=[b+last+1 for b in range(ik-i)]
            for b in range(len(prel)):prel[b]+=1
            print(ik,*(prel+[nexv]+newl))
            prel.append(nexv)
            if newl:nexv=newl[0]
else:print('No')

# Example run
# Input:
3876
# Output:
No
#17:27
n = int(input())
k = int((2*n)**.5)
if k*(k+1)//2 != n:
  print('No')
  exit()
ans = [[x for x in range(k)]]
now = k
for j in range(k):
  tmp = []
  for i in range(j+1):
    tmp.append(ans[i][j])
  for i in range(j+1,k):
    tmp.append(now)
    now += 1
  ans.append(tmp)
print('Yes')
for x in ans:
  print(k,' '.join(list(map(lambda y:str(y+1),x))))

# Example run
# Input:
2817
# Output:
No
def solve(n):
    k = 1
    while k * (k + 1) < 2 * n:
        k += 1
    if k * (k + 1) != 2 * n:
        return False, [], -1
    ans = [[] for _ in range(1000)]
    add_num = 1
    ans[1].append(add_num)
    ans[0].append(add_num)
    for i in range(2, k + 1):
        for j in range(i):
            add_num += 1
            ans[i].append(add_num)
            ans[i - j - 1].append(add_num)
    return True, ans, k


def main():
    n = int(input())
    res, ans, k = solve(n)
    if res:
        print("Yes")
        print(k + 1)
        for a in ans:
            if a:
                print(len(a), " ".join(map(str, a)))
            else:
                break
    else:
        print("No")


if __name__ == '__main__':
    main()


# Example run
# Input:
5706
# Output:
No
def main():
    n=int(input())
    m=int((2*n)**0.5)
    if m*(m+1)==n*2:
        print("Yes")
        m+=1
        print(m)
    else:
        print("No")
        exit()
    
    ans=[[m-1] for i in range(m)]
    c=1
    for i in range(m):
        for j in range(i+1,m):
            ans[i].append(c)
            ans[j].append(c)
            c+=1
    for i in ans:
        print(" ".join(map(str,i)))


if __name__ == '__main__':
    main()








# Example run
# Input:
56
# Output:
No
n = int(input())
if n != 3:
    print("No")
else:
    print("Yes")

# Example run
# Input:
1
# Output:
No
n = int(input())

ans = []
for i in range(1, n):
    ans.append([i, i+1])
ans.append([n, 1])

if n == 3:
    print('Yes')
    print(len(ans))
    for a in ans:
        print(str(len(a))+' '+' '.join(map(str, a)))
else:
     print('No')


# Example run
# Input:
-213
# Output:
No
n = int(input())

def isTriangular(n):
    i = 1
    while( (i*(i+1))//2 <= n) :
        if (i*(i+1))//2 == n:
            return True
        i+=1
    return False


def solve(n):
    if not isTriangular(n):
        print("No")
        return
    i = 1
    jump = 2
    ans = [[1],[1]]
    while ans[-1][-1] != n:
        next_ind = list(range(ans[-1][-1]+1, ans[-1][-1]+jump+1))
        for i in range(len(next_ind)):
            ans[i].append(next_ind[i])
        ans.append(next_ind)
        i+=jump
        jump += 1
    print("Yes")
    print(len(ans))
    for x in ans:
        p_str = ""
        p_str += str(len(x))
        for b in x:
            p_str += " " 
            p_str += str(b)
        print(p_str)
solve(n)

    


# Example run
# Input:
-109089799
# Output:
No
def is_square(N):
    i = 0
    while i**2 < N:
        i += 1
    if i**2 == N:
        return i
    return None


N = int(input())
r = is_square(8*N+1)
if r is None:
    print("No")
else:
    print("Yes")
    k = (r-1)//2
    print(k)
    size = k+1
    length = k
    ans = [[-1]*length for _ in range(size)]
    used = set()
    cur_max = 0
    for i in range(0, size):
        for j in range(i):
            ans[i][j] = ans[j][i-1]
        for k in range(i, length):
            ans[i][k] = cur_max+1
            cur_max += 1
    for a in ans:
        print("{} {}".format(size, " ".join(map(str, a))))


# Example run
# Input:
-60875
# Output:
No
def solve(n):
    k= -1
    for i in range(1000):
        if i * (i-1) == 2 * n:
            k =i
            print("Yes")
            break
        elif i*(i-1)  > 2*n:
            print("No")
            return
    ans = [[-1 for i in range(k-1)] for i in range(k)]
    c = 1
    print(k)
    for i in range(k):
        for j in range(k-i-1):
            ans[i][i+j] = c
            ans[i+j+1][i] = c
            c += 1

    for i in range(k):
        print(k ,end = "")
        for j in ans[i]:
            print(" " + str(j),end = "")
        print()

solve(int(input()))



# Example run
# Input:
1044
# Output:
No
N = int(input())

k = N*2
flag = False
tmp = 0
if N == 1:
    print("Yes")
    print(1)
    print(1, 1)
    exit(0)
for x in range(2, int(k ** 0.5) + 1):
    if k % x == 0 and k // x == x+1:
        tmp = x
        flag = True
        break
if flag:
    print("Yes")
    print(tmp+1)
    ans = [[] for i in range(tmp+1)]
    count = 0
    for i in range(tmp+1):
        ret = [str(tmp)]
        for k in range(i):
            ret.append(ans[k][i])
        for j in range(tmp):
            if i == 0:
                count += 1
                ret.append(str(count))
            else:
                if j < tmp - i:
                    count += 1
                    ret.append(str(count))

        ans[i] = ret
    for i in range(tmp+1):
        print(" ".join(ans[i]))
else:
    print("No")


# Example run
# Input:
23763566
# Output:
No
n=int(input())
p=int((2*n)**0.5)
if n!=((p+1)*p)//2:
    print("No")
else:
    t=[[]for i in range(p+1)]
    c=1
    for i in range(1,p+1):
        for j in range(i):
            t[i].append(c)
            t[j].append(c)
            c+=1
    print("Yes")
    print(p+1)
    for i in t:
        i=[len(i)]+i
        print(*i)

# Example run
# Input:
449245
# Output:
No
N = int(input())

if N == 1:
    print('Yes')
    print('1 1')
    print('1 1')
elif N == 3:
    print('Yes')
    print('2 1 2')
    print('2 3 1')
    print('2 2 3')
elif N == 6:
    print('Yes')
    print('3 1 2 3')
    print('3 1 4 5')
    print('3 2 4 6')
    print('3 3 5 6')
else:
    print('No')


# Example run
# Input:
0
# Output:
No
from itertools import combinations
n = int(input())
k = 0
for i in range(2*n+1):
  if i * (i - 1) == 2 * n:
    k = i
    break
if k:
  ans = [[k-1] for _ in range(k)]
  i = 1
  for a, b in combinations(range(k), 2):
    ans[a].append(i)
    ans[b].append(i)
    i += 1
  print('Yes')
  print(k)
  for ansi in ans:
    print(' '.join(list(map(str, ansi))))
else:
  print('No')


# Example run
# Input:
11
# Output:
No
n = int(input())

ans = []
for i in range(1, n):
    ans.append([i, i+1])
ans.append([n, 1])

print('Yes')
for a in ans:
    print(str(len(a))+' '+' '.join(map(str, a)))


# Example run
# Input:
-347
# Output:
Yes
2 -347 1
from math import sqrt

x = int(input())
n = (sqrt(8*x+1) - 1) / 2
if int(n) == n:
  n = int(n)
  a = [[1], [1]]
  for i in range(2, n+1):
    ti = i*(i+1)//2
    b = list(range(ti+1-i,ti+1))
    for j, v in enumerate(b):
      a[j].append(v)
    a.append(b)
  print("YES")
  print(len(a))
  for b in a:
    print(len(b), *b)
else:
  print("NO")

# Example run
# Input:
1
# Output:
YES
2
1 1
1 1
#17:27
n = int(input())
k = int((2*n)**.5)
if k*(k+1)//2 != n:
  print('No')
  exit()
ans = [[x for x in range(k)]]
now = k
for j in range(k):
  tmp = []
  for i in range(j+1):
    tmp.append(ans[i][j])
  for i in range(j+1,k):
    tmp.append(now)
    now += 1
  ans.append(tmp)
print('Yes')
print(k+1)
for x in ans:
  print(k,' '.join(list(map(lambda y:str(y+1),x))))

# Example run
# Input:
131358094
# Output:
No
def d_crossing(N):
    # N = k(k-1)/2 となる正整数kが存在するなら、求めるものが作れる
    k = 2
    while True:
        tmp = k * (k - 1)
        if tmp > 2 * N:
            return 'No'
        elif tmp == 2 * N:
            ans = ['Yes']
            break
        k += 1

    ans.append(str(k))
    matrix = [[0] * (k - 1) for _ in range(k - 1)]
    cnt = 1
    for r in range(k - 1):
        for c in range(r + 1):
            matrix[c][r] = matrix[r][c] = cnt
            cnt += 1
    for r in matrix:
        ans.append('{0} {1}'.format(k - 1, ' '.join(map(str, r))))
    tmp = []
    for j in range(k - 1):
        tmp.append(matrix[j][j])
    ans.append('{0} {1}'.format(k - 1, ' '.join(map(str, tmp))))
    ans = '\n'.join(ans)
    return ans

N = int(input())
print(d_crossing(N))

# Example run
# Input:
-3
# Output:
No
def main():
    from collections import deque
    from decimal import Decimal, getcontext

    getcontext().prec = 1000

    N = int(input())

    # {1,...,N}*2を分割
    # k個の集合があって
    # 各集合は他のk-1個の集合に対し共通要素を1個ずつ合わせてk-1個の要素をもつ

    sq = Decimal(N * 8 + 1).sqrt()
    cond = sq % 2 == 1  # 奇数か

    if not cond:
        print('No')
        return
    k = int((1 + sq) // 2)  # Decimalのままだとrangeの引数に使えない
    print('Yes')
    print(k)

    deqs = []
    it = iter(range(1, N + 1))
    for _ in range(k):
        print(k - 1, end=' ')
        t = []
        for deq in deqs:
            x = deq.popleft()
            t.append(x)
        u = []
        for _ in range(k - 1 - len(t)):
            x = next(it)
            u.append(x)
        t.extend(u)
        print(*t) # *t,*uがRE
        deqs.append(deque(u))


if __name__ == '__main__':
    main()


# Example run
# Input:
3770
# Output:
No
from collections import deque
N = int(input())
used1 = [0] * N
used2 = [0] * N

ans_list = [0] * 400
for i in range(2, 400):# N == 1は答えにならないはず
  ans_list[i] = int(i * (i + 1) // 2)

if N in ans_list:
  print("Yes")
  k = ans_list.index(N)
  print(k + 1)
  A = [deque([]) for i in range(k)]
  for i in range(1, N + 1):#最大10 ** 5
    p = int(((1 + 8 * i) ** (1/ 2) - 1.001) // 2)
    A[p].append(i)
  #print(A)
  #print(A[1][0])
  for i in range(k):
    print(k, end = " ")
    for j in range(i + 1):
      #print("j", j)
      print(A[i][j], end = " ")
    for l in range(i + 1, k):
      print(A[l][i], end = " ")
    print("")
  
  print(k, end = " ")
  for i in range(k):
    print(A[i][i], end = " ")
  print("")
else:
  print("No")

# Example run
# Input:
-2503
# Output:
No