Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
import math
n = int(input())
if n == 1:
    print("Yes")
    print(2)
    print("1 1")
    print("1 1")
    exit()

ok = False
for i in range(2, int(math.sqrt(n*2)+1)):
    if n*2 % i == 0 and n*2 // i == i+1:
        ok = True
        size = i
        break
if ok:
    ans = [[0] * size for _ in range(size+1)]
    val = 1
    for i in range(0, size+1):
        for j in range(i, size):
            ans[i][j] = val
            val += 1
    val = 1
    for i in range(0, size):
        for j in range(i, size):
            ans[1+j][i] = val
            val += 1
    print("Yes")
    print(size+1)
    for line in ans:
        print(str(size) + " " + " ".join([str(item) for item in line]))

else:
    print("No")

# Example run
# Input:
3032627
# Output:
No
N = int(input())
flag = 0
for i in range(int((8*N+1)**0.5)+1):
    if i*(i-1)==2*N:
        flag = 1
        k = i
        break
if flag==0:
    print("No")
else:
    print("Yes")
    S = [[] for _ in range(k)]
    cnt = 1
    for i in range(k-1):
        for j in range(i+1,k):
            S[i].append(cnt)
            S[j].append(cnt)
            cnt += 1
    print(k)
    for i in range(k):
        print(len(S[i]),*S[i])

# Example run
# Input:
1198832728
# Output:
No
import math
n = int(input())
if n == 1:
    print("Yes")
    print(1)
    print("1 1")
    print("1 1")
    exit()

ok = False
for i in range(2, int(math.sqrt(n*2)+1)):
    if n*2 % i == 0 and n*2 // i == i+1:
        ok = True
        size = i
        break
if ok:
    ans = [[0] * size for _ in range(size+1)]
    val = 1
    for i in range(0, size+1):
        for j in range(i, size):
            ans[i][j] = val
            val += 1
    val = 1
    for i in range(0, size):
        for j in range(i, size):
            ans[1+j][i] = val
            val += 1
    print("Yes")
    print(size+1)
    for line in ans:
        print(str(size) + " " + " ".join([str(item) for item in line]))

else:
    print("No")

# Example run
# Input:
1065258
# Output:
No
# 入力
N = int(input())

# N = 1 + 2 + ... + K で表せるならばYes
K = next(
    (
        k
        for k in range(1, N + 1)
        if k * (k + 1) // 2 == N
    ),
    0
)

# (1, 2, ..., K), (1, K + 1, ..., 2K - 1), (2, K + 1, 2K, ..., 3K - 3), ...
# を構築する
ans = (
    'Yes\n{}\n{}'.format(
        K + 1,
        '\n'.join(
            '{} {}'.format(
                K,
                ' '.join(
                    map(
                        str,
                        [
                            i + j * K - j * (j + 1) // 2
                            for j in range(i)
                        ] +
                        [
                            1 + j + i * (2 * K - (i - 1)) // 2
                            for j in range(K - i)
                        ]
                    )
                )
            )
            for i in range(K + 1)
        )
    ) if K else
    'No'
)

# 出力
print(ans)


# Example run
# Input:
679804
# Output:
No
n = int(input())
if n % 2 == 0:print('No')

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

ans = 'No'
k = 2
while True:
    kk = k*(k-1)
    if kk > N*2:
        ans = 'No'
        break
    elif kk == N*2:
        ans = 'Yes'
        break
    k += 1

print(ans)
print(k)
if ans == 'Yes':
    psum = (k-1)*k//2
    tops = []
    for i in range(k):
        ntop = psum - (k-1-i)*(k-i)//2 + 1
        tops.append(ntop)
    for i in range(k):
        print(k-1, end=" ")
        # 1st
        for j in range(i):
            print(tops[j]+(i-j-1), end=" ")
        # 2nd
        for j in range(k-1-i):
            print(tops[i]+j, end=" ")
        print('')


# 1 2 3 4
# 1 5 6 7
# 2 5 8 9


# Example run
# Input:
-2334
# Output:
No
2
import math

N = int(input())
s = int(math.sqrt(2*N))
if s*(s+1) != 2*N  or N==1:
    print('No')
else: 
    print('Yes')
    print(s+1)
    a = []
    for i in range(1, s+1):
        n0 = 1 + s*(i-1) - (i-2)*(i-2+1)//2
        a.append(n0)
    w = a[-1] + 1 ; a.extend((w, w))  #;print(a); print()

    for i in range(s+1):
        nL = []
        for k in range(i):
            nL.append(a[k]+(i-k-1))
            #print('i, k, a[k]+(i-k)', i, k, a[k]+(i-k-1))
        nL = nL + list(range(a[i], a[i+1]))
            #print('+', list(range(a[i], a[i+1])))  ;print()
        print(*nL)


# Example run
# Input:
2147483647
# Output:
No
N = int(input())
K = (((8 * N + 1) ** (1/2) + 1) / 2)

def recursive(k):
    if k == 3:
        return [[1, 2], [1, 3], [2, 3]]
    else:
        before = recursive(k - 1)
        r = [_ for _ in range(1 + (k - 2) * (k - 1) // 2, 1 + k * (k - 1) // 2)]
        return ([before[_] + [r[_]] for _  in range(len(r))] + [r])

if K.is_integer() and K > 1:
    K = int(K)
    print('Yes')
    print(K)
    [print(K - 1, ' '.join(map(str, ary))) for ary in recursive(K)]
else:
    print('No')

# Example run
# Input:
46
# Output:
No
def etrc(n1,n2,rs):
    for r in range(n1):
        rc[n2].append(rs+r)
        rc[n2+r+1].append(rs+r)

n=int(input())
x=int(((1+8*n)**0.5-1)/2)

rc=[[] for i in range(x+2)]

if n!=x*(x+1)//2:
    print("No")
else:
    print("Yes")
    print(x+1)

    rs=1
    for i in range(x+1):
        n1=x+1-i
        n2=i
        etrc(n1,n2,rs)
        rs=rs+n1

    for i in range(x+2):
        print(x+1, end=" ")
        for j in range(x+1):
            print(rc[i][j], end=" ")
        print()
            

# Example run
# Input:
216361
# 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(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:
19
# Output:
No
K = int(input())

def calc_n(K):
  if K == 1:
    return "Yes\n1\n1 1"
  for n in range(1, int(K/2)+2):
    if n*(n+1)/2 == K:
      return n
  return "No"

N = calc_n(K)
if not isinstance(N, int):
  print(N)
else:
  print("Yes")
  print(N+1)
  last = [i for i in range(1, N+1)]
  count = 2
  first_set = [str(i) if i == 1 else str(sum(last[:i-1])+1) for i in range(1, N+1)]
  print(N, " ".join(first_set))
  last_set = [str(sum(last[:i])) for i in range(1,N+1)]
  print(N, " ".join(last_set))
  while count != N+1:
    first_number = sum(last[:count-1])+1
    other_set = [i for i in range(first_number, first_number+count)]
    other_set.extend([first_number+count*(i+1)-1+sum(last[:i-1]) for i in range(1, N-count+1)])
    count += 1
    other_set = [str(i) for i in other_set]
    print(N, " ".join(other_set))

# Example run
# Input:
470
# Output:
No
import math
import itertools

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    N = int(input())    # maximum of N is 10^5

    for i in range(2, 500):
        tmp = combination_count(i, 2)
        if N < tmp:
            print('No')
            return
        elif N == tmp:
            print('Yes')
            array = [x+1 for x in range(i)]
            accum = [[] for x in range(i)]
            for idx, (i, j) in enumerate(itertools.combinations(array, 2)):
                accum[i-1].append(idx + 1)
                accum[j-1].append(idx + 1)
            print(len(accum))
            for item in accum:
                txt = str(len(item)) + " " + " ".join([str(x) for x in item])
                print(txt)
            return
        else:
            continue

    return


main()

# Example run
# Input:
-108
# Output:
No
def main():
    n=int(input())
    for k in range(1,450):
        if k*(k+1)==2*n:
            print("Yes")
            print(k+1)
            break
    else:
        print("No")
        return 0
    ans=[]
    cnt=0
    for i in range(k+1):
        ans.append([])
        for j in range(i):
            ans[i].append(ans[j][i-1])
        for j in range(i,k):
            ans[i].append(cnt)
            cnt+=1
    for i in ans:
        print(len(i),*i)
main()

# Example run
# Input:
201
# Output:
No
def getN():
    return int(input())


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


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

n = getN()

varn = 0
for i in range(1000):
    if n == (i*(i-1))/2:
        varn = i
        break

if varn == 0:
    print("No")

vars = [[] for n in range(varn)]
k = 1
for i in range(varn):
    for j in range(i+1,varn):
        vars[i].append(k)
        vars[j].append(k)
        k += 1

if varn != 0:
    print("Yes")
    print(varn)
    for i in range(varn):
        print(varn-1, " ".join(map(str, vars[i])))


# Example run
# Input:
-8132114
# Output:
No
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:
5330
# Output:
No
N = int(input())
sum = 0
flag = False
step = 0
for i in range(10**5):
  sum += i
  if sum == N:
    flag = True
    step = i
  if sum > N:
    break
if flag:
  S = [[] for _ in range(step+1)]
  m = 1
  for i in range(step):
    for j in range(i+1):
      S[i+1].append(m)
      S[i-j].append(m)
      m+=1
  print("Yes")
  for i in range(len(S)):
    print(str(len(S[i])), " ".join(map(str,S[i])))
else:
  print("No")


# Example run
# Input:
-7517
# Output:
No
import math
N=int(input())
kf = (math.sqrt(8*N+1)+1)/2
k = int(kf)
if k!=kf:
    print("No")
else:
    print("Yes")
    print(k)
    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:
28
# Output:
Yes
8
7 1 2 4 7 11 16 22
7 1 3 5 8 12 17 23
7 2 3 6 9 13 18 24
7 4 5 6 10 14 19 25
7 7 8 9 10 15 20 26
7 11 12 13 14 15 21 27
7 16 17 18 19 20 21 28
7 22 23 24 25 26 27 28
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 n1==a**2:
    n = (-3+a)//2
    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:
83554
# Output:
No
N = int(input())
for i in range(N):
    if N == i * (i+1)/2 and N >= 3:
        Ans = []
        Ans.append([int(j) for j in range(1, i+1)])
        for j in range(1, i+1):
            step, temp, now = 1, [j], j
            while step < j:
                now += i - step
                temp.append(now)
                step += 1
            for k in range(i-j):
                temp.append(now+i-j+1+k)
            Ans.append(temp)
        print("Yes")
        for j in range(len(Ans)):
            print(i, " ".join(map(str, Ans[j])))      
        break
else:
    print("No")

# Example run
# Input:
7
# Output:
No
n=int(input())
n2=n*2
key=[0,0]
for i in range(1,int(n2**0.5)+2):
  if n2%i==0:
    if i*(i+1)==n2:
      key=[i,i+1]
      break
if key==[0,0]:
  print('No')
  exit()
print('Yes')
a,b=key
print(b)
ans=[[0]*a for _ in range(b)]
cnt=1
for i in range(b):
  for j in range(a):
    if j<i:
      ans[i][j]=ans[j][i-1]
    else:
      ans[i][j]=cnt
      cnt+=1
for x in ans:
  print(' '.join(map(str,x)))

# Example run
# Input:
1685
# Output:
No
n,k=int(input()),0
for i in range(int((2*n)**0.5)+10):
    if i*(i-1)==2*n:
        k=i
if k==0:
    print('NO')
else:
    print('YES')
    print(k)
    c=1
    a=[[0]*k for _ in range(k)]
    for i in range(1,k):
        for j in range(1,i+1):
            a[i][j]=c
            c+=1
    ans=[]
    for i in range(1,k):
        l=[k-1]
        h,w=i,1
        for j in range(1,k):
            l.append(a[h][w])
            h+=0 if j<i else 1
            w+=1 if j<i else 0
        ans.append(l)
    for i in ans:
        print(*i)

# Example run
# Input:
1
# Output:
YES
2
1 1
n=int(input())
count=1
index=1
while count<n:
  index+=1
  count+=index
if count!=n:
  print("Yes")
  print(2)
  print(1,1)
  print(1,1)
elif n==1:
  print("No")
else:
  print("Yes")
  print(index+1)
  l=[]
  now=1
  num=1
  while now<n:
    l.append(now)
    now+=num
    num+=1
  for i in range(index):
    l1=[str(index)]
    l1.append(str(l[i]))
    num=l[i]
    count1=0
    while count1<i:
      num+=1
      count1+=1
      l1.append(str(num))
    for j in range(1+i,index):
      num+=j
      l1.append(str(num))
    print(" ".join(l1))
  l1=[str(index),str(l[0])]
  num=0
  for j in range(2,index+1):
    num+=j
    l1.append(str(l[0]+num))
  print(" ".join(l1))


# Example run
# Input:
-182
# Output:
Yes
2
1 1
1 1
def grid(N):
    for i in range(1,10**5):
        v = i*(i+1)
        if 2*N == v:
            n = i
            break
        elif 2*N < v:
            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(len(s), *s)
    return
        
if __name__ == "__main__":
    N = int(input())
    grid(N)


# Example run
# Input:
1556
# Output:
No
import sys
from itertools import combinations
n = int(input())

for i in range(1, 1000):
  if n == i*(i+1)//2:
    print("Yes")
    print(i+1)
    anslist = [[] for _ in range(i+1)]
    for j, v in enumerate(combinations([int(x) for x in range(i+1)], r=2)):
      anslist[v[0]].append(j+1)
      anslist[v[1]].append(j+1)
    for ans in anslist:
      print(*ans)
    sys.exit()

print("No")

# Example run
# Input:
-1003686
# Output:
No
N=int(input())
num=0
flag=0
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:
-296641124
# Output:
No
import math

N = int(input())
s = int(math.sqrt(2*N))
if s*(s+1) != 2*N:
    print('No')
else: 
    print('Yes')
    print(s+1)
    a = []
    for i in range(1, s+1):
        n0 = 1 + s*(i-1) - (i-2)*(i-2+1)//2
        a.append(n0)
    w = a[-1] + 1 ; a.extend((w, w))  #;print(a); print()

    for i in range(s+1):
        nL = []
        for k in range(i):
            nL.append(a[k]+(i-k-1))
            #print('i, k, a[k]+(i-k)', i, k, a[k]+(i-k-1))
        nL = nL + list(range(a[i], a[i+1]))
            #print('+', list(range(a[i], a[i+1])))  ;print()
        print(s, *nL)

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

def calc_n(K):
  if K == 1:
    return "Yes"
  for n in range(1, int(K/2)+2):
    if n*(n+1)/2 == K:
      return n
  return "No"

N = calc_n(K)
if not isinstance(N, int):
  print(N)
else:
  print("Yes")
  print(N+1)
  last = [i for i in range(1, N+1)]
  count = 2
  first_set = [str(i) if i == 1 else str(sum(last[:i-1])+1) for i in range(1, N+1)]
  print(N, " ".join(first_set))
  last_set = [str(sum(last[:i])) for i in range(1,N+1)]
  print(N, " ".join(last_set))
  while count != N+1:
    first_number = sum(last[:count-1])+1
    other_set = [i for i in range(first_number, first_number+count)]
    other_set.extend([first_number+count*(i+1)-1+sum(last[:i-1]) for i in range(1, N-count+1)])
    count += 1
    other_set = [str(i) for i in other_set]
    print(N, " ".join(other_set))

# Example run
# Input:
-1219978197
# 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 sqrt,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()

a = floor(sqrt(n*2))
b = a + 1

if a*b==n*2:
    print("Yes")
    print(b)
    d = [ [0]*a for _ in range(b) ]
    for i in range(1,a+1):
        d[i-1][i-1] = i
        d[i][i-1] = i
    # pprint(d)
    c = b
    for i in range(b):
        for j in range(a):
            if d[i][j]==0:
                d[i][j] = c
                d[j+1][i] = c
                c += 1
    # pprint(d)
    for i in range(b):
        print(a,end=" ")
        myoutput(d[i],space=True)
else:
    print("No")

# Example run
# Input:
13
# 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):
    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:
-26
# Output:
No
N = int(input())
for i in range(1,N+2):
  if i*(i-1)//2==N:
    print('Yes')
    ans = [[] for i in range(i)]
    cnt = 0
    p = 0
    q = 1
    while cnt<N:
      cnt += 1
      ans[p].append(cnt)
      ans[q].append(cnt)
      if q==i-1:
        p += 1
        q = p+1
      else:
        q += 1
    print(len(ans))
    for a in ans:
      print(len(a),*a)
    break
else:
  print('No')

# Example run
# Input:
2990
# 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))]
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(map(str,s)))

# Example run
# Input:
204015990
# Output:
No
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:
68688
# Output:
No
N=int(input())
X=0
for i in range(1,1000):
  X+=i
  if X==N:
    P=[[] for j in range(i+1)]
    X=0
    for j in range(i):
      for k in range(i-j):
        P[j].append(k+X+1)
      for k in range(i-j):
        P[k+j+1].append(k+X+1)
      X+=i-j
    print('Yes')
    print(i+1)
    for j in range(i+1):
      print(len(P[j]),end=' ')
      print(*P[j])
    exit()
print('No')

# Example run
# Input:
-6126
# Output:
No
N = int(input())
import itertools

d = {}
k = 3
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:
-9
# 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:
1115599
# Output:
NO