Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
n=int(input())
if n==1:
    print('Yes')
    print(2)
    print(1,1)
    print(1,1)
    exit()
if n==2:
    print('No')
    exit() 
a=[[1]]
i=1
for j in range(1,n):
    a.append(list(range(i,i+j)))
    if n==i+j-1:
        break
    elif i+j>n:
        print('No')
        exit()
    i+=j
print('Yes')
m=len(a)
for i in range(m-1):
    for j in range(i+1+(i<1),m):
        a[i].append(a[j][i])
print(m)
for b in a:
    print(len(b),*b)

# Example run
# Input:
6
# Output:
Yes
4
3 1 2 4
3 1 3 5
3 2 3 6
3 4 5 6
n=int(input())
if int((2*n)**(0.5))*int((2*n)**(0.5)+1)==2*n:
  print('Yes')
  k=int((2*n)**(0.5)+1)
  print(k)
  l=[]
  for i in range(k):
    if i==0:l.append([j+1 for j in range(k-1)]);lused=k-1
    else:
      addl=[]
      for j in range(i):
        addl.append(l[j][i-1])
      for j in range((k-1)-i):
        addl.append(lused+1)
        lused+=1
      l.append(addl)
  for i in l:print(2*n//k,*i)
else:print("No")

# Example run
# Input:
21181
# Output:
No
n=int(input())
y=(1+8*n)**0.5
if not y.is_integer():
    print("No")
    exit()
x=int(y)
if x%2==0:
    print("No")
    exit()
print("Yes")

k=(1+x)//2
atama=set()
atama.add(1)
now=1
for i in range(1,1000):
    now+=i
    if now<=n:
        atama.add(now)
    else:
        break
haji=set()
d={}
now=0
for i in range(1,1000):
    now+=i
    if now<=n and now not in haji:
        haji.add(now)
        d[now]=i
    else:
        break
k=len(atama)

ans=[list(atama),list(haji)]
for s in atama:
    if s==1:
        continue
    l=[s]
    while s+1 not in haji:
        l.append(s+1)
        s+=1
    s+=1
    l.append(s)
    c=d[s]
    for i in range(c,1000):
        s+=i
        if s<=n:
            l.append(s)
        else:
            break
    ans.append(l)
print(k+1)
for i in range(k+1):
    print(k,*ans[i])


# Example run
# Input:
21
# Output:
Yes
7
6 1 2 4 7 11 16
6 1 3 6 10 15 21
6 2 3 5 8 12 17
6 4 5 6 9 13 18
6 7 8 9 10 14 19
6 11 12 13 14 15 20
6 16 17 18 19 20 21
import math
n = int(input())
s = (-1+math.sqrt(1+8*n))/2
if (int(s)!=s):
    print("NO")
else:
    print("YES")
    s = int(s)
    print(s+1)
    A = []
    w = 1
    for i in range(s+1):
        print(s, end=" ")
        for j in range(len(A)):
            print (A[j][i-j-1], end=" ")
        A.append([])
        for j in range(s-len(A)+1):
            print(w, end=" ")
            A[i].append(w)
            w+=1
        print()

# Example run
# Input:
0
# Output:
YES
1
0
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,1,3)
  print(2,2,3)
else:
  print("No")

# Example run
# Input:
-10006
# Output:
No
def run(N):
    ret = []
    if N < 3:
        ret.append('No')
    else:
        for i in range(3, N+1):
            if N * 2 < i * (i-1):
                ret.append('No')
                break
            elif N * 2 == i * (i-1):
                ret.append('Yes')
                ret.append(i)
                S = []
                for j in range(1, i+1):
                    '''
                    j列の1行目は、1列目のj行目
                    j列の2行目は、2列目のj行目
                    j列のk行目は、k列目のj行目
                    j列のj行目以降は、j-1列目の最後の行の数+1から1ずつ増加
                    '''
                    tmp = [i-1]
                    for k in range(1, i):
                        if k < j:
                            tmp.append(S[k-1][j-1])
                        else:
                            if j < 2:
                                tmp.append(k-j+1)
                            else:
                                tmp.append(S[j-2][i-1]+k-j+1)
                    S.append(tmp)
                ret.append(S)
    return ret


def main():
    N = int(input())
    ret = run(N)
    print(ret[0])
    if len(ret) > 1:
        k = ret[1]
        print(k)
        for s in ret[2]:
            s = [str(si) for si in s]
            print(' '.join(s))


if __name__ == '__main__':
    main()


# Example run
# Input:
-34
# Output:
No
N = int(input())
for subs in range(2, N):
    n = N - subs
    if n == subs*(subs-1) // 2:
        print("Yes")
        for i in range(1, subs+1):
            if i != 1:
                print(' ', end='')
            print(i, end='')
        print()
        li = [[] for _ in range(subs)]
        num = subs+1
        for i in range(len(li)):
            for j in range(i+1, subs):
                li[i].append(num)
                li[j].append(num)
                num += 1
        for ll in range(len(li)):
            print(ll+1, end='')
            for kk in li[ll]:
                print(' ' + str(kk), end='')
            print()
        exit()
print("No")





# Example run
# Input:
-241292
# Output:
No
n = int(input())
r = int((2*n)**.5)
if 2*n!=r*(r+1):
    print('No')
    exit()

# 三角数
res = [[]]
cnt = 1
num = 1
for i in range(r):
    l = list(range(cnt,cnt+num))
    res.append(l)
    for j,k in enumerate(l):
        res[j] += [k]
    cnt += num
    num += 1

print('Yes')
print(len(res))
for l in res:
    print(len(l),*l)


# Example run
# Input:
1
# Output:
Yes
2
1 1
1 1
N = int(input())
flag = False
k = 0
if N == 1:
  print('Yes')
  print(2)
  print(1,1)
  print(1,1)
  exit()
for i in range(N+1):
    if i*(i-1)/2 == N:
        flag = True
        k = i
        break
if flag == False:
    print('No')
else:
    L = []
    cnt = 0
    dot = 1
    for j in range(k-1):
        M = []
        while cnt < j+1:
            M.append(dot)
            cnt += 1
            dot += 1
        L.append(M)
        cnt = 0
    ans = []
    for i in range(k-1):
      S = L[i]
      for j in range(i+1,k-1):
        S += [L[j][i]]
      ans.append(S)
    T = []
    for i in range(k-1):
      T.append((i+1)*(i+2)//2)
    ans.append(T)
    print('Yes')
    print(k)
    for i in range(len(ans)):
      ans[i] = [k-1]+ans[i]
      for j in range(len(ans[i])):
        if j != len(ans[i])-1:
          print(ans[i][j],end = ' ')
        else:
          print(ans[i][j],end = '')
      print()

# Example run
# Input:
-8132114
# Output:
No
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
for k in range(n+1):
    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:
30
# Output:
No
n=int(input())
if int((2*n)**(0.5))*int((2*n)**(0.5)+1)==2*n:
  print('Yes')
  k=int((2*n)**(0.5)+1)
  print(k)
  l=[]
  for i in range(k):
    if i==0:l.append([j+1 for j in range(k-1)]);lused=k-1
    else:
      addl=[]
      for j in range(i):
        addl.append(l[j][i-1])
      for j in range((k-1)-i):
        addl.append(lused+1)
        lused+=1
      l.append(addl)
  for i in l:print(2*n//k,*i)

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

k = (1 + (1 + 8 * n)** 0.5) * 0.5
if k.is_integer():
    print('Yes')
    print(k)
    k, num = int(k), 1
    ans = [[] for _ in range(k)]
    for i in range(k):
        for j in range(i + 1, k):
            ans[i].append(num)
            ans[j].append(num)
            num += 1
        print(k - 1, *ans[i])
else:
    print('No')


# Example run
# Input:
90113
# 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,2,3)
    print(2,3,1)
else:
    print("No")

# Example run
# Input:
30456987
# Output:
No
from itertools import combinations

N = int(input())
k = 1
while k**2 - k < 2*N: k += 1
if k**2 - k != 2*N: print('No')
else:
    print('Yes')
    print(k)
    sets = [[] for _ in range(k)]
    n = 1
    for i, j in combinations(range(k), 2):
        sets[i].append(n)
        sets[j].append(n)
        n += 1
    for S in sets: print(len(S), *S)

# Example run
# Input:
388
# Output:
No
def main():
    n=int(input())
    a=1
    m=int((2*n)**0.5)
    if m*(m+1)==n*2:
        a=m+1
        print("Yes")
    else:
        print("No")
        exit()
    print(a)
    s=set(range(1,1+n))
    l=[0]*(n+1)
    ans=[set()]

    for i in range(a):
        ll=set()
        for j in ans[:i+1]:
            for p in s&j-ll:
                ll.add(p)
                if l[p]==1:
                    s.remove(p)
                else:
                    l[p]+=1
                break

        for p in s:
            if len(ll)>=n*2//a:
                break
            else:
                if l[p]==0:
                    ll.add(p)
                    l[p]+=1

        ans.append(ll)
    for i in ans[1:]:
        print(n*2//a,*i)


if __name__ == '__main__':
    main()








# Example run
# Input:
129445
# Output:
No
n=int(input())
k=2
while n>=k*(k-1)/2:
    if n==k*(k-1)/2:
        print('Yes')
        print(k)
        a=list([] for i in range(k))
        t=1
        for i in range(0,k):
            for j in range(1,k-i):
                a[i].append(t)
                a[i+j].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:
-3391654
# Output:
No
n=int(input())
d=int((1+8*n)**(1/2))
if d**2!=(1+8*n) or d%2==0:
    print("No");exit()
k=(1+d)//2
print(k)
haba=1
cnt=1
ret=[[] for i in range(k)]
while cnt<=n or haba<=k-1:
    for s in range(k-haba):
        ret[s].append(cnt)
        ret[s+haba].append(cnt)
        cnt+=1
    haba+=1
for i in ret:
    print(len(i),*i)

# Example run
# Input:
45580
# Output:
No
from math import sqrt, ceil

def tostr(a):
    return ' '.join(map(str, a))

N = int(input())
k = ceil(sqrt(N*2))
#print(k)
if N!=k*(k-1)/2:
    print('No')
    exit()

print('Yes')
print(k)
M = k - 1
# diagonal
a = [1]
for i in range(M-1):
    a.append(a[-1] + i + 2)
print(M, tostr(a))
#
for i in range(M):
    a = [int(i*(i+1)/2) + 1]
    a += list(range(a[-1]+1, a[-1]+i+1))
    #print(a)
    for j in range(i+1, M):
        a.append(a[-1] + j)
    print(M, tostr(a))
        


# Example run
# Input:
1723193
# Output:
No
n=int(input())
f=True
r=0
i=1
while r<n:
  i+=1
  r=i*(i-1)//2
  if r==n:
    f=False
if f:
  print("No")
else:
  ans=[[] for j in range(i)]
  j=1
  for a in range(i):
    for b in range(a+1,i):
      ans[a].append(j)
      ans[b].append(j)
      j+=1
  print("Yes")
  print(i)
  for a in range(i):
    print(" ".join(map(str,[len(ans[a])]+ans[a])))

# Example run
# Input:
0
# 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
    size = k+1
    print(size)
    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:
-220533202
# Output:
No
N = int(input())
for i in range(N):
    if N == i * (i+1)/2 and N >= 3:
        Ans = []
        ans =[1]
        for j in range(i-1):
            ans.append(ans[-1]+j+2)
        Ans.append(ans)
        ini, level = 1, 1
        for j in range(1, i+1):
            ans = [ini + k for k in range(level)]
            step, wide, temp = i-j, level, ini+level-1
            while step > 0:
                ans.append(temp+wide)
                temp += wide
                step -= 1
                wide += 1
            Ans.append(ans)
            ini += level
            level += 1
        print("Yes")
        print(len(Ans))
        for j in range(len(Ans)):
            print(i, " ".join(map(str, Ans[j])))      
        break
else:
    print("No")

# Example run
# Input:
0
# Output:
No
n = int(input())
k = (2*n+0.25)**(1/2)+1/2
if k-int(k) == 0:
    print("Yes")
    k = int(k)
    print(k)
    bset = [[] for i in range(k)]
    now = 1
    for i in range(k-1):
        for j in range(i+1,k):
            bset[i].append(now)
            bset[j].append(now)
            now += 1
    length = len(bset[0])
    for i in bset:
        print(length," ".join(list(map(str,i))))
else:
    print("No")

# Example run
# Input:
1969909
# 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([])
print(ans)
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:
-1
# Output:
[[]]
Yes
1
0
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:
-358903
# Output:
No
N = int(input())
if N >= 3:
    print("Yes")
    print(N)
    for i in range(1, N):
        print(2, i, N)
    print(N - 1, " ".join(map(str, range(1, N))))
else:
    print("No")

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


N = int(input())


k = 0

while k*(k+1) <= 2 * N:

    if k * (k+1) == 2 * N:

        lis = [ [] for i in range(k+1) ]
        now = 1

        for i in range(k):

            for j in range(k-i):

                lis[i].append(now)
                lis[i+1+j].append(now)
                now += 1
        print ("Yes")
        print (k+1)
        for i in range(k+1):
            print (k," ".join(map(str,lis[i])))
        sys.exit()

    k += 1

print ("No")

# Example run
# Input:
-1799682701
# Output:
No
from itertools import combinations
n = int(input())
k = 0
for i in range(2*n):
  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:
32
# Output:
No
N = int(input())

k = N*2
flag = False
tmp = 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")
    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:
1
# 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(" ".join(map(str,a[i])))
        exit()
    else:
        k+=1
print("No")

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

if n & 1:
    print('Yes')
    print(n)
    print(1, n)
    left, right = 1, 2
    for i in range(n - 1):
        print(left, right)
        if i & 1:
            right += 2
        else:
            left += 2
else:
    print('No')


# Example run
# Input:
3
# Output:
Yes
3
1 3
1 2
3 2
#解説参照
n = int(input())
k = int((n*2)**(1/2))-1
for i in range(10):
    if (k+i)*(k+i-1)==n*2:
        k+=i
        break
if k*(k-1)!=n*2:
    print(k,n,"No")
    exit()
print("Yes")
print(k)
tri = []

for i in range(1,k):
    tri.append([j for j in range(i*(i-1)//2+1,i*(i+1)//2+1)])
for i in range(k-1):
    print(k-1,end = " ")
    print(*tri[i],end=" ")
    for j in range(i+1,k-1):
        print(tri[j][i],end=" ")
    print()
print(k-1,end=" ")    
for i in range(k-1):
    print(tri[i][-1],end = " ")



# Example run
# Input:
103303
# Output:
453 103303 No
def grid(N):
    n = 0
    while n * (n + 1) < N * 2:
        n += 1

    if n * (n + 1) != N * 2:
        print("No")
        return

    S = [[0]*n for _ in range(n+1)]
    cnt = 1
    for i in range(n+1):
        for j in range(n):
            if i <= j:
                S[i][j] = cnt
                cnt += 1
            else:
                S[i][j] = S[j][i-1]
    print("Yes")
    for s in S:
        print(n, end=" ")
        print(*s, sep=" ")


if __name__ == "__main__":
    N = int(input())
    grid(N)


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

def f(limit):
    i = 3
    j = 3
    while True:
        if i > limit:
            break
        yield i
        i += j
        j += 1

def h1(l, n):
    s = 0
    for i in range(n):
        yield l[s:s+i+1]
        s += i+1

def h2(p, l):
    if not l:
        return
    for pp, ll in zip(p, l):
        ll.append(pp)
    h2(l[0], l[1:])

l = list(f(10**5))

if N in l:
    print("yes")

    n = l.index(N)+2
    print(N*2//n)

    t = list(h1(list(range(1, N+1)), n))
    t.reverse()
    t.append([])

    h2(t[0], t[1:])

    for i in t:
        print(len(i), " ".join(str(j) for j in i))
else:
    print("No")

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

k = -1
for i in range(1, 10 ** 5 + 1):
    if i * (i - 1) == 2 * n:
        k = i
        break

if k == -1:
    print('No')
else:
    ans = [[] for _ in range(k)]
    print('Yes')
    print(k)
    tmp = 1
    for i in range(k):
        for j in range(i+1, k):
            ans[i].append(tmp)
            ans[j].append(tmp)
            tmp += 1

    for i in range(k):
        print(len(ans[i]), *ans[i])



# Example run
# Input:
-9
# Output:
No
n= int(input())
k=((8*n+1)**0.5-1)/2
if k.is_integer():
    ik=int(k)
    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(-1)

# Example run
# Input:
0
# Output:
0
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-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:
10921
# Output:
No
N = int(input())

n1 = 8*N+1
a = int(n1**0.5)

if N==1:
    print("Yes")
    print(2)
    print(1, 1)
    print(1, 1)
elif N>=3 and n1==a**2:
    n = (-3+a)//2
    if (-3+a)%2:
        print("No")
    else:
        d = [[0]*(n+1) for _ in range(n+2)]
        d[0][0] = 1
        d[0][1] = 2
        d[1][0] = 2
        d[1][1] = 3
        d[2][0] = 3
        d[2][1] = 1
        for i in range(1, n):
            v = 4+((i-1)*(i+4)//2)
            c = 2+i

            for j in range(c):
                d[c][j] = v+j
                d[j][c-1] = v+j

        print("Yes")
        print(n+2)
        for i in range(n+2):
            print(n+1, *d[i], sep=" ")
else:
    print("No")

# Example run
# Input:
2072477
# 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('Yes')
print(k)
for s in S:
	print(k-1, ' '.join(map(str, s)))

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

now = 0
all_now = []

for i in range(N):
    now = now+(i+1)
    all_now.append(now)
    if N==now:
        f=1
        break
    elif N<now:
        f=-1
        break
    
all_now = all_now[2:i+1]
now_num = 0
re_num = 3

if f<0:
    print('No')
else:
    print('Yes')
    print(i+2)
    
    ans = [[]]*(i+2)
    
    if N ==1:
        ans[0] = 1
        ans[1] = 1
    else:
        ans[0] = [1, 2]
        ans[1] = [1, 3]
        ans[2] = [2, 3]
        
        k = 0
        
        for j in range(4, N+1):
            if j>all_now[now_num]:
                k = 0
                re_num = re_num+1
                now_num = now_num+1
                
            ans[k] = ans[k] + [j]
            ans[re_num] = ans[re_num] + [j]
            k = k+1
        
        for j in range(i+2):
            ans2 = [str(len(ans[j]))]
            for k1 in range(len(ans[j])):
                ans2 = ans2 + [str(ans[j][k1])]
            print(' '.join(ans2))
                

# Example run
# Input:
2657144
# Output:
No
import math

n = int(input())

flag = False

if n == 1:
    print('Yes')
    print(2)
    print(1, 1)
    print(1, 1)
    

elif n == 2:
    print('Yes')
    print(2)
    print(2, 1, 2)
    print(2, 1, 2)
    

else:
    for i in range(int(math.sqrt(2*n)+1)):
        if i * (i + 1) == 2 * n:
            k = i
            flag = True
            break
    if flag:
        print('Yes')
        print(k + 1)
        lll = []
        mem = 1
        for j in range(k+1):
            s = []
            
            for l in range(k):
                if l >= j:
                    s.append(mem)
                    mem += 1
                else:
                    s.append(lll[l][j-1])

            lll.append(s)
            print(k, ' '.join(map(str, s)))


    else:
        print('No')



# Example run
# Input:
127077282
# Output:
No
import math
N=int(input())
q=int(math.sqrt(N*2))
if N*2!=q*q+q:print("No");exit()
S=[list(range(1,q+1))]
S+=[[j]for j in S[0]]
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(map(str,s)))

# Example run
# Input:
102
# Output:
No
import math

n = int(input())

flag = False

if n == 1:
    print('Yes')
    print(2)
    print(1, 1)
    print(1, 1)
    

    

else:
    for i in range(int(math.sqrt(2*n)+1)):
        if i * (i + 1) == 2 * n:
            k = i
            flag = True
            break
    if flag:
        print('Yes')
        print(k + 1)
        lll = []
        mem = 1
        for j in range(k+1):
            s = []
            
            for l in range(k):
                if l >= j:
                    s.append(mem)
                    mem += 1
                else:
                    s.append(lll[l][j-1])

            lll.append(s)
            print(k, ' '.join(map(str, s)))


    else:
        print('No')



# Example run
# Input:
133233772
# Output:
No