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

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

if k*(k-1) != N*2 and 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:
312
# Output:
25
24 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277
24 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300
24 2 3 5 8 12 17 23 30 38 47 57 68 80 93 107 122 138 155 173 192 212 233 255 278 302
24 4 5 6 9 13 18 24 31 39 48 58 69 81 94 108 123 139 156 174 193 213 234 256 279 303
24 7 8 9 10 14 19 25 32 40 49 59 70 82 95 109 124 140 157 175 194 214 235 257 280 304
24 11 12 13 14 15 20 26 33 41 50 60 71 83 96 110 125 141 158 176 195 215 236 258 281 305
24 16 17 18 19 20 21 27 34 42 51 61 72 84 97 111 126 142 159 177 196 216 237 259 282 306
24 22 23 24 25 26 27 28 35 43 52 62 73 85 98 112 127 143 160 178 197 217 238 260 283 307
24 29 30 31 32 33 34 35 36 44 53 63 74 86 99 113 128 144 161 179 198 218 239 261 284 308
24 37 38 39 40 41 42 43 44 45 54 64 75 87 100 114 129 145 162 180 199 219 240 262 285 309
24 46 47 48 49 50 51 52 53 54 55 65 76 88 101 115 130 146 163 181 200 220 241 263 286 310
24 56 57 58 59 60 61 62 63 64 65 66 77 89 102 116 131 147 164 182 201 221 242 264 287 311
24 67 68 69 70 71 72 73 74 75 76 77 78 90 103 117 132 148 165 183 202 222 243 265 288 312
24 79 80 81 82 83 84 85 86 87 88 89 90 91 104 118 133 149 166 184 203 223 244 266 289
24 92 93 94 95 96 97 98 99 100 101 102 103 104 105 119 134 150 167 185 204 224 245 267 290
24 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 135 151 168 186 205 225 246 268 291
24 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 152 169 187 206 226 247 269 292
24 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 170 188 207 227 248 270 293
24 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 189 208 228 249 271 294
24 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 209 229 250 272 295
24 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 230 251 273 296
24 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 252 274 297
24 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 275 298
24 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 299
24 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
n = int(input())
for i in range(1, 500):
    if n == i * (i - 1) / 2:
        print('Yes')
        exit()
print('No')

# Example run
# Input:
-44087376
# Output:
No
def main():
    #部分集合のサイズnの時n+1個の部分集合
    n=int(input())
    if 2*n!=int((2*n)**0.5)*(int((2*n)**0.5)+1):
        print("No")
        exit()
    print("Yes")
    l=int((2*n)**0.5)
    print(l)
    work=[[] for _ in range(l+1)]
    now_sub=0
    next_sub=1
    for i in range(1,n+1):
        if len(work[now_sub])==l:
            now_sub+=1
            next_sub=now_sub+1
        work[now_sub].append(i)
        work[next_sub].append(i)
        next_sub+=1
    
    for i in range(l+1):
        print("{} {}".format(l," ".join(map(str,work[i]))))

main()

# Example run
# Input:
44169557
# 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")
    for i in range(varn):
        print(varn-1, " ".join(map(str, vars[i])))
#print(vars)

# Example run
# Input:
0
# Output:
No
import math
n = int(input())
x = (-1+math.sqrt(1+8*n))/2
if not x.is_integer():
  print ('No')
  exit (0)
x = int(x)
ans = []
k = 1
for i in range(x+1):
  a = []
  for j in range(x):
    if j >= i:
      a.append(k)
      k +=1
    else:
      a.append(ans[j][i-1])
  ans.append(a)
print ('Yes')
for i in range(x+1):
  print (x,*ans[i]) 

# Example run
# Input:
38379
# Output:
No
from math import ceil
n=int(input())
k=ceil((2*n)**0.5)
if k*(k-1)//2!= n:
  print('No')
  exit()

S=[[] for _ in range(k)]
a=1
for i in range(k):
  for j in range(i+1, k):
    S[i].append(a)
    S[j].append(a)
    a+=1

print('Yes')
print(k)
for i in range(k):
  print(len(S[i]),*S[i])

# Example run
# Input:
1
# Output:
Yes
2
1 1
1 1
N = int(input())
if N == 1:
    raise RuntimeError()

for k in range(2, N + 1):
    sn = k - 1
    if k * sn != 2 * N:
        continue

    print("Yes")
    print(k)
    s = [[0] * sn for _ in range(sn)]
    for i in range(sn):
        s[i][i] = s[i-1][i-1] + (i + 1)
        for j in range(i + 1, sn):
            s[i][j] = s[i][j-1] + j
            s[j][i] = s[i][j]
    s.append([s[i][i] for i in range(sn)])
    for x in s:
        print(sn, " ".join(map(str, x)))
    break
else:
    print("No")

# Example run
# Input:
0
# 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")
    for i in range(varn):
        print(varn-1, " ".join(map(str, vars[i])))


# Example run
# Input:
-104359
# 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")
    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:
1090
# 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 > 2:
    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:
108901
# Output:
No
N=int(input())
if N%3>0:
    if N<9:
        print('No')
    y=-1
    for i in range(3,N):
        if N%i==0:y=i
    if y<3:print('No')
    else:
        X=[]
        print('Yes')
        M=N//y
        for i in range(y):
            X.append([(x-1)%N+1 for x in range(1+M*i,2+M+M*i)])
        for i in range(M-1):
            X.append([X[j][i+1] for j in range(y)])
        
        def enstr(x):
            s=''
            for i in x:
                s+=(str(i)+' ')
            return s

        print(len(X))
        for i in X:
            print(len(i),enstr(i))
else:
    X=[]
    print('Yes')
    M=N//3
    for i in range(3):
        X.append([(x-1)%N+1 for x in range(1+M*i,2+M+M*i)])
    for i in range(M-1):
        X.append([X[j][i+1] for j in range(3)])

    def enstr(x):
        s=''
        for i in x:
            s+=(str(i)+' ')
        return s

    print(len(X))
    for i in X:
        print(len(i),enstr(i))

# Example run
# Input:
-29082932
# Output:
No
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:
125998
# 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:
-10006
# Output:
No
n = int(input())
m = int((n*2)**0.5)
if m*(m+1)!=n*2:
    print('No')
else:
    print('Yes')
    print(m+1)
    ans = [[0]*m for _ in range(m+1)]
    for i in range(m+1):
        for j in range(m):
            if i==0 and j==0:
                ans[i][j] = 1
            elif i==j:
                ans[i][j] = ans[i-1][j-1] + m-i + 1
            else:
                if i>j:
                    if i==j+1:
                        ans[i][j] = ans[i-1][j]
                    else:
                        ans[i][j] = ans[i-1][j] + 1
                else:
                    ans[i][j] = ans[i][j-1] + 1
    for a in ans:
        print(*a)

# Example run
# Input:
783940
# Output:
No
N = int(input())
if N%3 != 0:
    print("No")
else:
    if N == 3:
        print("Yes")
        print(3)
        print("{} {} {}".format(2,1,2))
        print("{} {} {}".format(2,2,3))
        print("{} {} {}".format(2,3,1))


    else:
        k = (N//3)*2
        a = list(range(1,k+1))
        b = list(range(2,k+1))
        b.append(1)
        c = list(range(k+1,N+1))*(k//2)
        print("Yes")
        print(k)
        for i in range(k):
            print("{} {} {} {}".format(3,a[i],b[i],c[i]))


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

# Example run
# Input:
21
# Output:
Yes
7
6 1 2 3 4 5 6
6 1 7 8 9 10 11
6 2 7 12 13 14 15
6 3 8 12 16 17 18
6 4 9 13 16 19 20
6 5 10 14 17 19 21
6 6 11 15 18 20 21
from math import ceil
import sys
n = int(input())

k = ceil((2 * n) ** 0.5)
if k * (k - 1) // 2 != n:
    print('No')
    sys.exit(0)

S = [[] for _ in range(k)]
a = 1
for i in range(k):
    for j in range(i + 1, k):
        S[i].append(a)
        S[j].append(a)
        a += 1

for i in range(k):
    print(len(S[i]), *S[i], sep = ' ')

# Example run
# Input:
32
# Output:
No
# tenka1-2018D - Crossing
"""
if N = K(K + 1)/2 -> Yes
construct a triangle(e.g. N = 10, K = 4):
    1 0 0 0
    2 3 0 0
    4 5 6 0
    7 8 9 10
the answer will be:
  {each row until 0 + column straight down from there}
    {1 2 4 7}
    {2 3 5 8}
    {4 5 6 9}
    {7 8 9 10}
  {diagonal line}
    {1 3 5 10}
"""
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:
3509
# 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(length, " ".join(map(str, a))))


# Example run
# Input:
-53354
# Output:
No
n = int(input())
t = 2*n
a = int(t**0.5)
if a*(a+1) != t:
    print("No")
    exit()

print("Yes")
print(a+1)
count = [0]*n
ans = [[] for i in range(a+1)]
now = a
p = [0]*(a+1)
for i in range(a):
    ans[i].append(i+1)
    ans[i+1].append(i+1)
    count[i] += 2
for i in range(a+1):
    if i >= 2:
        for j in range(i-1):
            while count[ans[j][p[j]]-1] ==2:
                p[j] += 1
            x = ans[j][p[j]]
            ans[i].append(x)
            count[x-1] +=1
        x = len(ans[i])
        for j in range(a-x):
            ans[i].append(now+1)
            count[now]+=1
            now += 1
    else:
        x = len(ans[i])
        for j in range(a-x):
            ans[i].append(now+1)
            count[now]+=1
            now += 1
    
for i in range(a+1):
    print(a,*ans[i])


# Example run
# Input:
18889
# Output:
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")
    print(len(S))
    for s in S:
        print(n, end=" ")
        print(*s, sep=" ")


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


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

def recursive(k):
    if k == 2:
        return [[1, 2], [1, 3], [2, 3]]
    else:
        before = recursive(k - 1)
        r = [_ for _ in range(1 + k * (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, ' '.join(map(str, ary))) for ary in recursive(K)]
else:
    print('No')

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

P = [0]
p = 1
for i in range(10**3):
    P.append(P[-1] + p)
    p += 1

i = 1
while P[i] < n:
    i += 1
if P[i] > n:
    print("No")
else:
    print("Yes")
    m = i+1
    S = [[] for i in range(m)]
    for i in range(m):
        s = 1 if i==0 else 1+P[i-1]
        for j in range(m-1):
            S[i].append(s)
            if j < i-1:
                s += 1
            elif j == i-1:
                s += i+1
            else:
                s += j+1
    print(m)
    for i in range(m):
        print(m-1, " ".join([str(j) for j in S[i]]))

# print(S)

# Example run
# Input:
0
# Output:
No
def main():
    N=int(input())
    for k in range(1000):
        if k*(k-1)//2==N:
            print("Yes")
            print(k)
            break
        if k*(k-1)//2>N:
            print("No")
            return
    S=[[0]*(k-1) for _ in range(k)]
    a=1
    for i in range(k-1):
        for j in range(k-i-1):
            S[j][i]=a
            S[k-i-1][i+j]=a
            a+=1
    for s in S:
        print(len(s), *s)

if __name__ == "__main__":
    main()

# Example run
# Input:
-11157473
# Output:
No
N = int(input())
a = [[ i*(i+1)//2 + j + 1 for j in range(i+1)] for i in range(540)]

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

if k*(k-1)//2 == N:
    print('Yes')
    print(k)
    for i in range(k-1):
        print(str(k-1), end='')
        for j in range(i+1):
            print(' '+str(a[i][j]), end='')
        for j in range(i+1, k-1):
            print(' '+str(a[j][i]), end='')
        print('')
    print(str(k-1), end='')
    for i in range(k-1):
        print(' '+str(a[i][i]), end='')
    print('')
else :
    print('No')

# Example run
# Input:
41614
# Output:
No
#make only 2 same number part of {1...N}
import sys
N=int(input())
a=[s+1 for s in range(N)]
flag=0
if N==1:
    print("Yes")
    print("2")
    print("1 1")
    print("1 1")
    sys.exit()

for i in range(N+1):
    if i*(i-1)//2==N: #kC2
        flag=1
        print("Yes")
        print(i)
        b=[[] for t in range(i)]
        c=1
        u=0
        for s in reversed(range(0,i)):
            for t in range(s):
                b[i-s-1].append(c)
                b[i-s+c-u-1].append(c)
                c+=1
            u+=s
        for x in range(i):
            print(i-1,' '.join(map(str, b[x])))
if flag==0:
    print("No")
            
            

# Example run
# Input:
15
# Output:
Yes
6
5 1 2 3 4 5
5 1 6 7 8 9
5 2 6 10 11 12
5 3 7 10 13 14
5 4 8 11 13 15
5 5 9 12 14 15
from itertools import combinations

n = int(input())
yes = [i*(i-1)//2 for i in range(2, 448)]
if n in yes:
    print('Yes')
    len_s = yes.index(n) + 1
    print(len_s+1)
    res = [[] for _ in range(len_s+1)]
    for i, v in enumerate(combinations(range(len_s+1), 2)):
        res[v[0]].append(str(i+1))
        res[v[1]].append(str(i+1))
    for r in res:
        print(' '.join([str(len_s)] + r))        
else:
    print('No')

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

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

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

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

# Example run
# Input:
-1
# Output:
No
from itertools import combinations as cb
import sys

N = int(input())

k = (1 + int((1 + 8 * N) ** 0.5)) // 2

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

print('Yes')
print(k)

x = list(cb(range(k), 2))
dp = [[] for i in range(k)]
for i,(a,b) in enumerate(x):
    dp[a].append(i+1)
    dp[b].append(i+1)
for r in dp:
    print(len(r), *r)

# Example run
# Input:
473300
# 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(k-1,*x)


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

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

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

# Example run
# Input:
-1028681
# Output:
No
a = int(input())
if a == 1:
	print("Yes")
	print(2)
	print(1, 1)
	print(1,1)
elif a == 3:
	print("Yes")
	print(3)
	print(2,1,2)
	print(2,3,1)
	print(2,2,3)
elif (int((2*a) ** 0.5)**2  + int((2*a) ** 0.5))  == 2*a:
	print ("Yes")
	t = int((2*a) ** 0.5)
	print(t + 1)
	print(str(t) +' ' +  ' '.join([str(i) for i in list(range(1, t + 1))]))
	now = t + 1
	for i in range(1, t + 1):
		left = ' '.join([str(i + (2*t - j - 1)*j //2) for j in list(range(i))])
		right = ' '.join([str(j) for j in list(range(now, now + t - i))])
		now = now + t - i
		print(str(t) +' ' + left + ' ' + right)
else:
	print("No")

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

k = int((n * 2) ** 0.5) + 1
if k * (k - 1) != 2 * n:
    print('No')
else:
    print('Yes')
    print(k)
    arr = [list() for _ in range(k)]

    num = 1
    tar1, tar2 = 0, 1
    while True:
        arr[tar1].append(num)
        arr[tar2].append(num)
        if num == n:
            break
        else:
            num += 1
        if len(arr[tar1]) == k - 1:
            tar1 += 1
            tar2 = tar1 + 1
        else:
            tar2 += 1
    for i in range(k):
        print(k - 1, *arr[i])

# Example run
# Input:
31959
# Output:
No
N = int(input())
Ss = [[1, 2], [2, 3], [3, 1]]
while True:
    k = len(Ss)
    m = k * (k - 1) // 2
    if N < m:
        print("No")
        break
    elif N == m:
        print("Yes")
        print(k)
        for S in Ss:
            print(len(S), " ".join(map(str, S)))
        break
    S_new = []
    for i in range(k):
        x = m + 1 + i
        Ss[i].append(x)
        S_new.append(x)
    Ss.append(S_new)

# Example run
# Input:
-39
# 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("No")
if n==2:
    print("Yes")
    print("1 1")
    print("1 1")

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

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

K = int((2 * N) ** 0.5) + 1
if K * (K - 1) // 2 != N:
    print("No")
    quit()

print("Yes")
print(K)

A = [[] for _ in range(K - 1)]

cur = 1
for i in range(K - 1):
    for _ in range(i + 1):
        A[i].append(cur)
        cur += 1

for i in range(K - 1):
    T = A[i]
    cur = len(T) - 1
    for j in range(cur + 1, K - 1):
        T.append(A[j][cur])
    print(len(T), *T)

T = [A[i][i] for i in range(K - 1)]
print(len(T), *T)

# Example run
# Input:
6
# Output:
Yes
4
3 1 2 4
3 2 3 5
3 4 5 6
3 1 3 6
N = int(input())
exist = False
num = None
for K in range(1, N+1):
    if K * (K + 1) // 2 == N:
        exist = True
        num = K
        break

if not exist:
    print("No")
else:
    print("Yes")
    print(num + 1)
    res = [[] for _ in range(num + 1)]
    tot = 1
    for k in range(num, 0, -1):
        for i in range(k):
            res[num - k].append(tot + i)
            res[num - k + i + 1].append(tot + i)
        tot += k

    for i in range(num + 1):
        ans = []
        ans.append(len(res[i]))
        ans += res[i]
        print(" ".join(map(str, ans)))



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