Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
from math import sqrt
N=int(input())
q=int(sqrt(N*2))
if N*2!=q*q+q:print("No")
else:
    S=[list(range(1,q+1))]
    for j in range(1,q+1):S.append([j])
    last = q
    for i in range(1,q):
        r = list(range(last+1,last+1+q-i))
        S[i] += r
        for j in range(q-i):
            S[i+j+1] += [r[j]]
        last = r[-1]
    print("Yes")
    print(len(S))
    for s in S: print(len(s), " ".join(str(i)for i in s))

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

for k in range(1000):
    temp = k * (k - 1) // 2
    if n == temp:
        print('Yes')
        print(k)
        res = [[] for _ in range(k)]
        p = 1
        for i in range(k):
            for j in range(i + 1, k):
                res[i].append(p)
                res[j].append(p)
                p += 1
        for x in res:
            print(' '.join(map(str, [k - 1] + x)))
        break
    elif n < temp:
        print('No')
        break

# Example run
# Input:
-4934
# Output:
No
def ans(n):
    global c
    c+=1
    if n==1:
        return 1
    else:
        return ans(n-1)+n


n=int(input())
f=0
c=0

if n==1 or n==2:
    print("No")

for i in range(1, n):
    c=0
    ch=ans(i)
    if ch==n:
        print("Yes")
        f=1
        break
    if ch > n:
        print("No")
        break


if f:
    print(c+1)
    k=c
    i=j=0
    li=[[-1 for j in range(c)] for i in range(c+1)]
    #print(li)
    for l in range(1, n+1):
        li[i][j]=l
        j+=1
        if j==k:
            j=0
            i+=1
            k-=1

    nowi=1
    i=1
    j=c-1
    k=c
    count=1
    for l in range(1, n+1):
            #print(nowi)
            li[i][j]=l
            i+=1
            count+=1
            if count==k+1:
                count=1
                nowi+=1
                i=nowi
                j-=1
                k-=1

    for i in li:
        print(len(i), end=" ")
        for j in i:
            print(j, end=" ")
        print()


# Example run
# Input:
-1140169349
# Output:
import math
N=int(input())
kf = (math.sqrt(8*N+1)+1)/2
k = int(kf)
if k!=kf:
    print("No")
else:
    print("Yes")
    for i in range(1,k+1):
        print(k-1, end=' ')
        elements = []
        for j in range((i-1)*(i-2)//2+1,i*(i-1)//2+1):
            elements.append(j)
        for q in range(i+1,k+1):
            elements.append(i + (q-1)*(q-2)//2)
        last = elements.pop()
        for e in elements:
            print(e, end=' ')
        print(last)

# Example run
# Input:
11109145
# Output:
No
def ans(n):
    global c
    c+=1
    if n==1:
        return 1
    else:
        return ans(n-1)+n


n=int(input())
f=0
c=0

if n==1:
    print("Yes")
    print("1 1")
if n==2:
    print("No")

for i in range(1, n):
    c=0
    ch=ans(i)
    if ch==n:
        print("Yes")
        f=1
        break
    if ch > n:
        print("No")
        break


if f:
    print(c+1)
    k=c
    i=j=0
    li=[[-1 for j in range(c)] for i in range(c+1)]
    #print(li)
    for l in range(1, n+1):
        li[i][j]=l
        j+=1
        if j==k:
            j=0
            i+=1
            k-=1

    nowi=1
    i=1
    j=c-1
    k=c
    count=1
    for l in range(1, n+1):
            #print(nowi)
            li[i][j]=l
            i+=1
            count+=1
            if count==k+1:
                count=1
                nowi+=1
                i=nowi
                j-=1
                k-=1

    for i in li:
        print(len(i), end=" ")
        for j in i:
            print(j, end=" ")
        print()


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

r = []
c = 1
i = 1
while i <= n:
    r.append([])
    for j in range(1, c+1):
        r[-1].append(i)
        i += 1
    c += 1

if i == n+1:
    print('Yes')
    print(c)
    for j in range(c-1):
        result = [c-1]
        result.extend(r[j])
        for x in range(j+1, c-1):
            result.append(r[x][j])
        print(*result)
    result = [c-1]
    for x in range(c-1):
        result.append(r[x][x])
    print(*result)
else:
    print("No")

# Example run
# Input:
12
# 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
    for i in range(k-1):
        for j in range(k-i-1):
            ans[i][k-j-2] = c
            c += 1
    c = 1
    for i in range(1,k):
        for j in range(i):
            ans[i][j] = 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:
4195951
# Output:
N = int(input())
k = 2
yes_n = (k * (k+1)) // 2
flag = False
while N >= yes_n:
    if N == yes_n:
        flag = True
        break
    k += 1
    yes_n = (k * (k+1)) // 2
if flag:
    ans = []
    max_n = 1
    for i in range(k+1):
        tmp = []
        for j in range(i):
            tmp += [ans[j][i-1]]
        for j in range(k-i):
            tmp += [str(max_n)]
            max_n += 1
        ans += [tmp]
    print('Yes')
    print(k+1)
    for a in ans:
        print(k, ' '.join(a))
else:
    print('No')

# Example run
# Input:
16793
# Output:
No
n=int(input())
f=0
for i in range(1,int(n**0.5)+3):
	if i*(i-1)//2==n:
		f=1
		break
if f==0:
	print("No")
	exit()
print("Yes")
print(i)
k=i
cnt=0
s=[[-1]*k for _ in range(k)]
for i in range(k):
	for j in range(k):
		if i<j:
			s[i][j]=cnt
			cnt+=1
ans=[[]for _ in range(k)]
for i in range(k):
	for j in range(k):
		if s[i][j]!=-1:
			ans[i].append(s[i][j]+1)
			ans[j].append(s[i][j]+1)
for x in ans:
	print(*x)


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

for i in range(N + 1):
    if i * (i + 1) // 2 == N:
        M = i
        print('Yes')
        print(M + 1)
        res = [[] for _ in range(M + 1)]
        for i in range(M + 1):
            res[i].append(M)
        cnt = 1
        for k in range(M):
            for i in range(M - k):
                res[k].append(cnt + i)
            for i in range(M - k):
                res[k + i + 1].append(cnt)
                cnt += 1
        for r in res:
            print(*r)
        break
else:
    print('No')

# Example run
# Input:
-41270
# Output:
No
import math

N = int(input())
k,S,t = int(math.sqrt(N*2))+1,[[1],[1]],[]

if k*(k-1) != N*2 or N == 1:
	print('No')
	exit()

for i in range(k-2):
	S[0].append(S[0][i]+i+1)
	S[1].append(S[1][i]+i+2)
	t.append([S[0][i+1]])

for i in range(k-2):
	b,n = False,t[i][-1]+1
	while n <= N:
		t[i].append(n)
		tk = int(math.sqrt(n*2))+1
		if tk*(tk-1) == n*2:
			b = True
		n = t[i][-1]+len(t[i]) if b else t[i][-1]+1

S += t
print(k)
for s in S:
	print(k-1, ' '.join(map(str, s)))

# Example run
# Input:
1969909
# Output:
No
N=int(input())
k=2
while N>=(k-1)*k/2:
    if N==(k-1)*k/2:
        print("Yes")
        print(k)
        a=list([] for i in range(k))
        t=1
        for i in range(0,k):
            for n in range(1,k-i):
                a[i].append(t)
                a[i+n].append(t)
                t+=1
        for i in range(k):
            print(str(k-1)+" ".join(map(str,a[i])))
        exit()
    else:
        k+=1
print("No")


# Example run
# Input:
55
# Output:
Yes
11
101 2 3 4 5 6 7 8 9 10
101 11 12 13 14 15 16 17 18 19
102 11 20 21 22 23 24 25 26 27
103 12 20 28 29 30 31 32 33 34
104 13 21 28 35 36 37 38 39 40
105 14 22 29 35 41 42 43 44 45
106 15 23 30 36 41 46 47 48 49
107 16 24 31 37 42 46 50 51 52
108 17 25 32 38 43 47 50 53 54
109 18 26 33 39 44 48 51 53 55
1010 19 27 34 40 45 49 52 54 55
n = int(input())
if (1+8*n)**(1/2) - int((1+8*n) **(1/2)) != 0:
 print("No")
 exit()
k = int((1+(1+8*n)**(1/2))/2)
s = [[] for I in range(k)]
p = [I for I in range(1,int(k*(k-1)/2)+1)]
for j in range(k):
 for q in range(k-1-j):
  a = p.pop(0)
  s[j].append(a)
  s[q+j+1].append(a)
 
 
 
for i in range(k):
 print(k-1,"".join(str(m) for m in s[i]))

# Example run
# Input:
11959
# Output:
No
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()

if n==3:
    print("Yes")
    print(3)
    print(2,1,2)
    print(2,3,1)
    print(2,2,3)
else:
    print("No")

# Example run
# Input:
9062461
# Output:
No
n = int(input())
if n == 1:
    print('Yes')
    print(2)
    print(1,1)
    print(1,1)
elif n == 3:
    print('Yes')
    print(2,1,2)
    print(2,3,1)
    print(2,2,3)
else:
    print('No')

# Example run
# Input:
-1686
# Output:
No
# 基本形に追加するのを考える
# [1 2] [2 3] [1 3] の基本形にそれぞれ新しく1つずつ追加するとすると [1 2 4] [2 3 5] [1 3 6] [4 5 6]
# n=10だと
# [1 3 5 7] [1 2 6 8] [2 3 4 9 ] [4 5 6 10] [7 8 9 10]
# これに新しいのを加えるとするとすでにある5つを新規に導入するので 15
# [1 3 5 7 11] [1 2 6 8 12] [2 3 4 9 13] [4 5 6 10 14] [7 8 9 10 15] [11 12 13 14 15]
n = int(input())
anss = [[1, 2], [2, 3], [1, 3]]
target, length = 3, 3
while target <= 10**5 and target <= n:
    if target == n:
        print("Yes")
        for ans in anss:
            b = " ".join(list(map(str, ans)))
            # print(b)
            print(f"{len(ans)} {b}")
        exit()
    nex = list(range(target + 1, target + length + 1))
    for i, ans in enumerate(anss):
        ans.append(nex[i])
    anss.append(nex)
    target += length
    length += 1
print("No")

# Example run
# Input:
-28047
# Output:
No
def 解():
    iN = int(input())

    #これも解法を見て作った

    iK = int((2 * iN) ** 0.5)
    if 2 * iN != iK * (iK +1 ) :
        print("No")
    else:
        print("Yes")
        print(iK+1)
        aD = [ [0] * iK for _ in range(iK)]
        iMaxCol = 0
        iRow = 0
        iCol = 0
        for i in range(1,iN+1):
            aD[iRow][iCol] = i
            if iCol == iMaxCol:
                iMaxCol += 1
                iRow += 1
                iCol = 0
            else:
                iCol += 1

        oAns = []
        iRC = 0
        iStartCol = 0
        iStartRow = 0
        for i in range(iK):
            aTmp = []
            aTmp.append(iK)
            for j in range(iK):
                if iRC == 0:
                    aTmp.append(aD[iStartRow][j])
                else:
                    aTmp.append(aD[j][iStartCol])
                if j == iStartCol:
                    iRC = 1
            oAns.append(" ".join([str(_) for _ in aTmp]))
            iStartCol += 1
            iStartRow += 1
            iRC = 0
        aTmp = []
        aTmp.append(iK)
        for i in range(iK):
            aTmp.append(aD[i][i])

        oAns.append(" ".join([str(_) for _ in aTmp]))
        print("\n".join(oAns))
解()


# Example run
# Input:
1008752943
# Output:
No
N = int(input())
S = []
hoge = 1
i = 0
while hoge <= N:
    S.append([])
    i += 1
    for j in range(i):
        S[-1].append(hoge)
        hoge += 1

if S[-1][-1] == N:
    print("Yes")
else:
    print("No")
    exit()

N = len(S)
print(N+1)

for i in range(N):
    print(N,end = " ")
    x,y = 0,i
    for j in range(i+1):
        x = j
        print(S[y][x],end=" ")
    for j in range(i+1,N):
        y = j
        print(S[y][x],end=" ")
    print()
print(N,end = " ")
for i in S:
    print(i[-1],end = " ")
print()

# Example run
# Input:
3
# Output:
Yes
3
2 1 2 
2 2 3 
2 1 3
n = int(input())

memo = 0
for i in range(1,2*(10**5)):
    if i*(i-1) == 2*n:
        memo = i
        break
    elif i*(i-1) > 2*n:
            break
    
if memo == 0:
    print("No")
    
else:
    print(memo)
    spc = 1
    for i in range(memo):
        print(memo-1,"",end="")
        for j in range(1,memo+1):
            if not(spc==j):
                print(j,"",end="")
        spc += 1
        print("")
        
        

# Example run
# Input:
-491914923
# Output:
No
N = int(input())
num = (N-2)**(0.5)
if N == 3:
  print("Yes")
  A = [2, 1, 2]; print(*A)
  A = [2, 2, 3]; print(*A)
  A = [2, 3, 1]; print(*A); exit()
if num%1 != 0:
  print("No");exit()
num = int(num)
ans = []
for i in range(num):
  temp = [1] + [2+j+num*i for j in range(num)]
  ans.append(temp)
for i in range(num):
  temp = [2+i+num*j for j in range(num)] + [N]
  ans.append(temp)
print("Yes")
for x in ans:
  ret = [num+1] + x
  print(*ret)

# Example run
# Input:
4195951
# Output:
No
#部分集合組(Sk)がmこあると仮定すると、S1とS2...Sm,S2とS3...Sm,...,Sm-1とSmの、1*m-1C2=Σ(1<=i<=m-1)i=(m(m-1)/2)組の共通要素をとることがわかる
#これら共通要素関係をs1==s2,s1==s3,....,s1==sm,s2==s3,s2==s4,...s2==sm,.......,sm-1==smと捉えると、(Siのある数字siとSjのある数字sjが一致という意味)
#共通要素関係について以下のことがわかる

#*si==sj、sk==slにて、i!=kまたはj!=l(<=>not((i==k)and(j==l)))ならば(si==sj)!=(sk==sl)

#(i)(i==k),(j==l),(j==k),(i==l)のいずれか一つの関係をとる時、i==kのみ時のみ考えれば十分である。
#*の前提が成り立たないとすれば、si==sj、sk==slの関係はsi==sj、si==slの関係で、si==sj==slとなり、Sに3つ同じ整数が入ることとなり矛盾
#(ii)(i==k),(j==l),(j==k),(i==l)の関係をどれもとらない時、
#*の前提が成り立たないとすれば、si==sj、sk==slの関係でsi==sj==sk==slとなり、Sに4つ同じ整数が入ることとなり矛盾
#よって、(m(m-1)/2)この共通要素は各々異なる整数で共通要素をとるということがわかる。

#一方ここまでの考察で、共通要素を取らない整数はN-(m(m-1)/2)こあることがわかるが、実はこれは0でなければならない
#共通要素を取らない整数をSaとSbに割り振ったとする
#(i)a!=bの時、sa==sbという、新たな共通要素ができる。ただ一番最初に任意の二つの集合をとってsi==sjの関係を前もって関係を構成した前提で議論しているため、どれか一つは共通要素が2つ以上になってしまい、矛盾
#(ii)a==bの時、ある集合Saに同じ数字が2つ含まれることになるが、{1,2,..N}の部分集合の組にならず矛盾。

#以上の議論からN=(m(m-1))/2<=>2N=m(m-1)が成り立つmにて、Skの数がmこになるよう、(m(m-1))/2この関係をs1==s2==1,s1==s3==2,...,s1==sm==m-1,s2==s3==m,s2==s4==m+1,...,sm-1==sm==(m(m-1))/2のように割り振ればok
#(すると、Skの要素数は自然と2N/m=m-1で揃う)

N=int(input())
num=0
flag=0
#N<=10^5なので2<=m<1000を探せば十分
for i in range(2,1000):
    if 2*N==i*(i-1):
        num=i
        flag=1
        break
if flag==0:
    print("No")
else:
    l=[[] for _ in range(num)]
    cnt=1
    for i in range(num):
        for j in range(i+1,num):
            l[i].append(cnt)
            l[j].append(cnt)
            cnt=cnt+1
    print("Yes")
    print(num)
    for i in range(num):
        print(num-1,*l[i],sep=" ")


# Example run
# Input:
-256478906
# Output:
No
def main():
    n = int(input())
    x = 2
    while (x-1)*x//2 < n:
        x += 1
    if (x-1)*x//2 == n:
        print("Yes")
        ans = [[] for _ in range(x)]
        y = 1
        for i in range(x-1):
            for j in range(i+1, x):
                ans[i].append(y)
                ans[j].append(y)
                y += 1
        print(x)
        for i in range(x):
            print(len(ans[i]), end=" ")
            for j in range(len(ans[i])):
                print(ans[i][j], end="")
                if j < len(ans[i])-1:
                    print(" ", end="")
                else:
                    print("")
    else:
        print("No")

if __name__ == "__main__":
    main()


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

if n == 1:
    print("Yes")
    print(2)
    print(1, 1)
    print(1, 1)
elif n == 3:
    print("Yes")
    print(3)
    print(2,1,2)
    print(2,3,1)
    print(2,2,3)
else:
    print("No")



# Example run
# Input:
-667820051
# 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("No")
else:
    print("Yes")
    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:
51167978
# Output:
No
from math import sqrt
n = int(input())
k = (1+sqrt(1+8*n))/2
if k.is_integer():
    print('Yes')
    k = int(k)
    ans = [set() for _ in range(k)]
    i = 1
    for j in range(k-1):
        for l in range(j+1,k):
            ans[j].add(i)
            ans[l].add(i)
            i += 1
    print(k)
    for a in ans:
        print(k-1,' '.join(map(str,a)))
else:
    print('No')


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


# Example run
# Input:
-3
# Output:
No
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def gg(n):
	for i in range(n+1):
		#print(2*n, i*i+1)
		if 2*n == i*(i+1):
			return i+1
		if 2*n < i*(i+1):
			return -1
	return -1

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	g_num = gg(n)
	if g_num == -1:
		return 'No'
	print('Yes')
	print(g_num)
	n_num = g_num-1
	ggg=[]
	ggg.append(list(range(1, n_num+1)))
	next=n_num+1
	for ig in range(g_num-1):
		next_group=[]
		for ip, g in enumerate(ggg):
			next_group.append(g[len(ggg)-1])
		while len(next_group) < n_num:
			next_group.append(next)
			next+=1
		ggg.append(next_group)
	for g in ggg:
		print(n_num, *g)
	
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

cnt = 0
fitn = 0
while(fitn < n):
    cnt += 1
    fitn += cnt
    
    if(fitn > n):
        print("No")
        exit()


numofrow = cnt + 1
ans = []
for i in range(numofrow):
    ans.append([])
offset = 0
finishrow = 0
while(finishrow != numofrow):
    for i in range(cnt-finishrow):
        ans[finishrow].append(i+1+offset)
    finishrow += 1    
    for i in range (numofrow-finishrow):
        ans[i+finishrow].append(i+1+offset)
    
    offset += numofrow-finishrow

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

# Example run
# Input:
-11
# Output:
Yes
1
0
N = int(input())

if N == 3:
  print("Yes")
  print("3")
  print("2 1 2")
  print("2 3 1")
  print("2 2 3")

else:
  print("No")

# Example run
# Input:
397399
# Output:
No
# tenka1-2018D - Crossing
def main():
    N = int(input())
    K = int((N * 2) ** 0.5)
    if K * (K + 1) / 2 != N:
        print("No")
        return
    row, cur, cnt = [], 1, 1
    while cur + cnt - 1 <= N:
        row.append(list(range(cur, cur + cnt)) + [0] * (K - cnt))
        cur += cnt
        cnt += 1
    col = [list(c) for c in zip(*row)]
    ans, diag = [], []  # diag: diagonal line
    for i, (r, c) in enumerate(zip(row, col)):
        diag.append(r[i])
        ans.append(r[:i] + c[i:])
    ans.append(diag)
    print("Yes", K + 1, sep="\n")
    for a in ans:
        print(K, end=" ")
        print(" ".join(map(str, a)))


if __name__ == "__main__":
    main()

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

if N == 1:
    print('Yes')
    print(2)
    print(1, 1)
    print(1, 1)
elif N == 2:
    print('No')
elif N == 3:
    print('Yes')
    print(3)
    print(2, 1, 2)
    print(2, 3, 1)
    print(2, 2, 3)
else:
    print('No')

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

k = 2
while True:
    t = k * (k - 1) // 2
    if t >= n:
        break
    else:  # t < n
        k += 1

if t == n:
    m = [[None for _ in range(k - 1)] for _ in range(k - 1)]
    v = 1
    for r in range(k - 1):
        for c in range(r + 1):
            m[r][c] = v
            v += 1

    print('Yes')
    print(k)

    for i in range(k - 1):
        s = list()
        for c in range(i + 1):
            s.append(m[i][c])

        cnt = len(s)
        j = 0
        while cnt < k - 1:
            s.append(m[i + 1 + j][i])
            j += 1
            cnt += 1

        s = [k - 1] + s
        print(*s)

    s = list()
    cnt = 0
    j = 0
    while cnt < k - 1:
        s.append(m[j][j])
        j += 1
        cnt += 1

    s = [k - 1] + s
    print(*s)

else:
    print('No')

# Example run
# Input:
3
# Output:
Yes
3
2 1 2
2 2 3
2 1 3
MOD = 10 **9 + 7
INF = 10 ** 10

def main():
    N = int(input())
    K = 0
    for i in range(2,N + 2):
        if i*(i - 1)//2 == N:
            K = i
            break
    if K == 0:
        print('No')
        return
    ans = [[0] * (K - 1) for _ in range(K)]

    before = 1
    for i in range(K - 1):
        for j in range(i,K - 1):
            ans[i][j] = before
            ans[j + 1][i] = before
            before += 1
    print('Yes')
    print(K)
    for i in range(K):
        print(len(ans[i]),*ans[i])
if __name__ == '__main__':
    main()

# Example run
# Input:
-48655
# 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:
480
# Output:
No
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
if n == 1:
    print('No')
    exit()
for k in range(2*n):
    if k*(k-1) == 2*n:
        break
    elif k*(k-1) > 2*n:
        print('No')
        exit()
print('Yes')
print(k)
ret = [[] for _ in range(k)]
ii = 0
for i in range(k-1):
    for j in range(1,k-i):
        ret[i].append(ii+j)
        ret[i+j].append(ii+j)
    ii += k-i-1
for i in range(k):
    print(' '.join(map(str,[k-1] + ret[i])))


# Example run
# Input:
1
# Output:
No