Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
def run(N):
    ret = []
    if N == 1:
        ret.append('Yes')
        ret.append(2)
        ret.append([[1, 1], [1, 1]])
    elif 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:
-84564737
# Output:
No
n = int(input())
i = 1
m = 0
while True:
    m += i
    if m == n:
        k = i + 1
        c = 1
        break
    elif m > n:
        c = 0
        break
    i += 1
if c == 1:
    print("Yes")
    print(k)
    dp = [[0 for _ in range(k - 1)] for _ in range(k)]
    m = 0
    for i in range(k):
        for j in range(k - 1):
            if i <= j:
                m += 1
                dp[i][j] = m
            else:
                if i == j + 1:
                    dp[i][j] = dp[i - 1][j]
                else:
                    dp[i][j] = dp[i - 1][j] + 1
    for i in range(k):
        print(k - 1, end = " ")
        s = map(str, dp[i])
        print(" ".join(s))
else:
    print("No")

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

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

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

if N in l:
    print("yes")
else:
    print("No")

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

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

if k*(k-1) != N*2:
	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:
56
# 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=[[k-1]+[a[i][i] for i in range(1,k)]]
    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,w=(h,w+1) if j<i else (h+1,w)
        ans.append(l)
    for i in ans:
        print(*i)

# Example run
# Input:
9850811
# Output:
No
N = int(input())
flag = False
k = 0
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:
-1138
# Output:
No
n=int(input())
num = 8*n+1
import math
a=int(math.sqrt(num))
ok=False
for i in [a-2,a-1,a,a+1,a+2]:
    if i**2 == num:
        ok=True
if not ok:
    print("No")
    exit()
print("Yes")
k=1+(a-1)//2
print(k)

from collections import defaultdict
ans=defaultdict(list)

i=0
j=1
for now in range(1,n+1):
    ans[i].append(now)
    ans[j].append(now)
    j+=1
    if j==k:
        i+=1
        j=i+1
        if i==k:
            break

for lis in ans.values():
    print(k-1,end=" ")
    print(*lis)

# Example run
# Input:
155287
# Output:
No
import itertools
N=int(input())
if N==1:
    print(2)
    print(2,1,1)
    print(2,1,1)
    exit()
l=list(itertools.combinations(range(1,N+1), 2))
#print(l)
for i in range(len(l)-1):  
    if l[i][0]==l[i+1][0] or l[i][0]==l[i+1][1] or l[i][1]==l[i+1][0] or l[i][1]==l[i+1][1]:
        pass
    else:
        print('No')
        exit()
print('Yes')
print(len(l))
for i in l:
    print(len(i),i[0],i[1])

# Example run
# Input:
-140
# Output:
Yes
0
def search(n):
    for i in range(1, 2*n):
        if i*(i-1) == 2*n:
            return i
    return 0


n = int(input())

nodes = search(n)
if nodes != 0:
    print("Yes")
    print(nodes)
    out = [[] for i in range(nodes)]
    index = [int(i) for i in range(nodes)]
    counter = 1
    for i in range(len(index)):
        for j in range(index[i]):
            out[j].append(counter)
            out[i].append(counter)
            counter += 1
    for i in range(len(out)):
        str1 = str(out[i])
        table = str1.maketrans({
            ',': '',
            '[': '',
            ']': '',
        })
        str1 = str1.translate(table)
        print(("{} {}".format(len(out[i]), str1)))
else:
    print("No")

# Example run
# Input:
83
# Output:
No
n = int(input())
if n % 2 == 0:
    print("No")
else:
    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:
137752
# Output:
No
N = int(input())
for subs in range(2, N):
    n = N - subs
    if n == subs*(subs-1) // 2:
        print("Yes")
        print(subs+1)
        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:
-2
# Output:
No
N = int(input())
if N == 1:
    print('Yes')
    print('2')
    print('1 1')
    print('1 1')
    exit()
for subs in range(2, N):
    n = N - subs
    if n == subs*(subs-1) // 2:
        print("Yes")
        print(subs+1)
        print(subs, end='')
        for i in range(1, subs+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(len(li[ll])+1, end=' ')
            print(ll+1, end='')
            for kk in li[ll]:
                print(' ' + str(kk), end='')
            print()
        exit()
print("No")





# Example run
# Input:
0
# Output:
No
from itertools import combinations
N = int(input())
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)
elif N==3:
    print("Yes")
    print(3)
    print(2,1,2)
    print(2,1,3)
    print(2,2,3)
else:
    flg = 0
    for i in range(4,int((3*N)**0.5)+2):
        if N==(i*(i-1))//2:
            flg=1
            K = i
            break
    if flg==0:
        print("No")
    else:
        S = {i:[] for i in range(K)}
        for j,x in enumerate(combinations(range(K),2)):
            j += 1
            i0,i1 = x[0],x[1]
            S[i0].append(j)
            S[i1].append(j)
        print("Yes")
        print(K)
        for i in range(K):
            print(len(S[i]),*S[i])
            

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

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

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


# Example run
# Input:
0
# Output:
Yes
1
2 0 1
n = int(input())
if n == 1:
    print("No")
    exit()

for k in range(2,n + 1):
    if k * (k - 1) // 2 == n:
        print("Yes")
        break
    if k * (k - 1) // 2 > n:
        print("No")
        exit()

print(k)
answer = [[] for _ in range(k)]

num = [[i,j] for i in range(k) for j in range(i+1,k)]

for i,st in enumerate(num):
    s,t = st
    answer[s].append(i + 1)
    answer[t].append(i + 1)

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


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

if N % 3 == 0 :
  t = N // 3
  a = list(range(t * 0 + 1, t * 1 + 2))
  b = list(range(t * 1 + 1, t * 2 + 2))
  c = list(range(t * 2 + 1, t * 3 + 2))
  c[-1] = 1
  print('Yes')
  print(3)
  print(t + 1, *a)
  print(t + 1, *b)
  print(t + 1, *c)
else :
  print('No')

# Example run
# Input:
-65906
# Output:
No
ans_data = []

def get_num_shugou(num):
    num_shuugou = -1
    for i in range(1, num + 2):
        if 2 * num == i * (i - 1):
            num_shuugou = i
            break
        elif 2 * num < i * (i - 1):
            break
    return num_shuugou

def get_piramid(num_shuugou):
    piramid = [[1]]
    for i in range(num_shuugou - 2):
        data = [piramid[-1][-1] + j + 1 for j in range(len(piramid) + 1)]
        piramid.append(data)
    return piramid


def data_append(now_list):
    print('{} {}'.format(len(now_list), ' '.join(list(map(str, now_list)))))


def make_data(high, width, piramid, now_list_kari, down_flg):
    now_list = now_list_kari.copy()
    now_list.append(piramid[high][width])

    if len(now_list) == len(piramid):
        data_append(now_list)
        return

    if down_flg:
        make_data(high + 1, width, piramid, now_list, down_flg)

    elif width == len(piramid[high]) - 1:
        down_flg = 1
        make_data(high + 1, width, piramid, now_list, down_flg)
    else:
        make_data(high, width + 1, piramid, now_list, down_flg)


def write_shugou(num_shuugou):
    piramid = get_piramid(num_shuugou)

    now_list = [piramid[i][-1] for i in range(len(piramid))]
    data_append(now_list)
    for i in range(num_shuugou - 1):
        make_data(i, 0, piramid, [], 0)

def main():
    num = int(input())
    num_shuugou = get_num_shugou(num)
    if num_shuugou == -1:
        print('No')
    else:
        print('Yes')
        print(num_shuugou)
        write_shugou(num_shuugou)



if __name__ == '__main__':
    main()

# Example run
# Input:
14
# Output:
No
import math
N=int(input())*2
q=int(math.sqrt(N))
if-~q*q!=N:print("No");exit()
S=[list(range(1,q+1))]
S+=[[j]for j in S[0]]
l=q
for i in range(1,q):
	r=list(range(l+1,l+1+q-i))
	S[i]+=r
	for j in range(q-i):S[i+j+1]+=[r[j]]
	l=r[-1]
print("Yes")
print(len(S))
for s in S:print(len(s)," ".join(map(str,s)))

# Example run
# Input:
734
# Output:
No
n=int(input())
if n>=4:print('No')
elif 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:
  print('Yes')
  print(3)
  print(2,1,2)
  print(2,3,1)
  print(2,2,3)

# Example run
# Input:
964893
# Output:
No
import math
n = int(input())
m = int(math.sqrt(8 * n + 1))

if m * m != 8 * n + 1:
  print("No")
else:
  k = int((m + 1) / 2)
  S = [[] for h in range(k)]
  l = 1
  for i in range(k - 1):
    for j in range(i + 1, k):
      S[i].append(l)
      S[j].append(l)
      l += 1
  print(k)
  s = "{} " * k
  t = s.rstrip(" ")
  for p in range(k):
    print(t.format(k - 1, *S[p]))

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

x = (1+(1+8*N)**0.5)/2
if x.is_integer():
  print('Yes')
  x = int(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:
1
# Output:
Yes
1 1
1 1
K = int(input())

def calc_n(K):
  if K == 1:
    return "No"
  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(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:
-2
# 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')
            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:
-142
# Output:
No
n = int(input())
for l in range(1, 10**3):
  if l*(l-1)//2 == n:
    print("Yes")
    print(l)
    S = [[] for _ in range(l)]
    now = 0
    count = 1
    for j in range(l-1):
      for k in range(l-1-j):
        S[now].append(count)
        S[now+1+k].append(count)
        count += 1
      now += 1
    for s in S:
      print(l-1, *s)
    break
else:
  print("No")


# Example run
# Input:
14508349
# Output:
No
N = int(input())
if N == 1:
    print('Yes')
    print(2)
    print(1, 1)
    print(1, 1)
elif N*2 == int(N**0.5)*int(N**0.5)+1:
    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)
else:
    print('No')


# Example run
# Input:
298151
# Output:
No
from math import sqrt
from itertools import combinations
n = int(input())
a = int(sqrt(2*n))
if n-a*(a+1)//2: print("No")
else:
	print("Yes")
	print(a+1)
	x,y,m = [[str(a)] for i in range(a+1)],[i for i in range(a+1)],1
	for i,j in combinations(y,2):
		x[i].append(str(m))
		x[j].append(str(m))
		m+=1
	for i in x: print(" ".join(i)) 

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

num_e = 1
num = num_e**2 + num_e

l = []


ok = 0

while num//2 <= 10**5:
    if num // 2 == n:
        ok = 1
        break

    num_e += 1
    num = num_e**2 + num_e

if not ok:
    print('No')
else:
    print('Yes')
    ans = [[num_e] for i in range(num_e+1)]

    num = 1
    for i in range(num_e):
        for j in range(i+1):
            ans[j].append(num)
            ans[i+1].append(num)
            num += 1
    print(num_e+1)
    for i in range(num_e+1):
        print(' '.join(map(str, ans[i])))


# Example run
# Input:
-16371
# 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')
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:
12
# Output:
5
No
n = int(input())
t = int((n*2)**(0.5))
if t*(t+1)//2!=n:
    print("No")
    quit()
l = [[] for _ in range(t+1)]
ind = 1
for i in range(t,0,-1):
    for j in range(i):
        l[t-i].append(j+ind)
    for j in range(i):
        l[t-i+1+j].append(j+ind)
    ind += i
print("Yes")
print(t+1)
for i in range(t+1):
    print(t,*l[i])

# Example run
# Input:
19
# 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):
            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(kk, end=' ')
            print()
        exit()
print("No")





# Example run
# Input:
1
# Output:
No
n = int(input())
k = int((n*2)**.5) + 1

if (k - 1) * k / 2 == n:
  print('Yes')
  print(k)
else:
  print('No')
  exit()

t = [1] * (k - 1)

for i in range(1, k - 1):
  t[i] = t[i-1] + i

for i in range(k-1):
  s = (t[max(i, j)] + min(i, j) for j in range(k-1))
  print(k-1, *s)
print(k - 1, *(t[j] + j for j in range(k-1)))

# Example run
# Input:
2147483647
# Output:
No
import math
n = int(input())
m = int(math.sqrt(8 * n + 1))

if m * m != 8 * n + 1:
  print("No")
else:
  k = int((m + 1) / 2)
  S = [[] for h in range(k)]
  l = 1
  for i in range(k - 1):
    for j in range(i + 1, k):
      S[i].append(l)
      S[j].append(l)
      l += 1
  print("Yes")
  print(k)
  s = "{} " * k
  t = s.rstrip(" ")
  for p in range(k):
    print(t.format(k - 1, *S[p]))

# Example run
# Input:
497083553
# 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:
-1
# 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, 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:
1
# Output:
Yes
2
1 1
1 1
N = int(input())

n = int((2*N)**0.5)
if n*(n+1) == 2*N:
    print("Yes")
    print(n+1)
    S = [[] for _ in range(n+1)]
    num = 1
    for i in range(n+1):
        j = i+1
        while len(S[i]) < n:
            S[i].append(str(num))
            S[j].append(str(num))
            num += 1
            j += 1
    for i in range(n+1):
        print(n, " ".join(S[i]))
    
else:
    print("No")

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


def main():
    N = int(input())
    x = math.floor(math.sqrt(N*2))
    if x * (x+1) != N*2:
        print("No")
        return
    print("Yes")
    print(x+1)
    s = [[] for _ in range(x+1)]
    counter = 1
    for i in range(x+1):
        for j in range(i+1, x+1):
            s[i].append(counter)
            s[j].append(counter)
            counter += 1
    for i in range(x+1):
        print(len(s[i]), *s[i])


if __name__ == "__main__":
    main()


# Example run
# Input:
45580
# Output:
No
N = int(input())
flag = False
k = 0
if N == 1:
  print('Yes')
  print(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:
142
# Output:
No
def 解():
    iN = int(input())

    #解法pdfを見て作ったその2

    iK = int((2 * iN) ** 0.5)
    if 2 * iN != iK * (iK +1 ) :
        print("No")
    else:
        print("Yes")
        print(iK+1)
        oAns = []
        iStart = 1
        for i in range(iK):
            oRes = [iK]
            for j in range(0,i):
                oRes.append(iStart + j)
            for k in range(i,iK):
                if len(oRes) > 1:
                    oRes.append(oRes[-1]+k)
                else:
                    oRes.append(iStart+i)
            oAns.append(" ".join([str(_) for _ in oRes]))
            iStart += i +1
        oRes = [iK]
        iStart = 0
        for i in range(0,iK):
            iStart += i +1
            oRes.append(iStart)
        oAns.append(" ".join([str(_) for _ in oRes]))
        print("\n".join(oAns))
解()



# Example run
# Input:
10324210
# 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:
3537
# 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')
else:
    print('No')


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