Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
"""
Writer: SPD_9X2
https://atcoder.jp/contests/agc022/tasks/agc022_c


ある　t 以下のkで全て終わらせる < t+1を使う
なので、まず答えを満たすのに必要な最小の最大値を求める必要がある
大きい奴は使わない方がよい
→これを使わなくても答えが成立しうるか？を上から決めてく

計算量不安だけど平気そう
"""

def able(na,nb,lis):

    if na < nb:
        return False
    elif na == nb:
        return True
    
    q = {}
    q[na] = 1
    for i in range(50,0,-1):

        temp = []
        if not lis[i]:
            continue
        
        for j in q:

            if j % i == nb:
                return True
            elif j % i > nb:
                temp.append(j % i)

        for j in temp:
            q[j] = 1

    return False
            

N = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))

lis = [True] * 51

import sys

for j in range(N):
    if not able(a[j],b[j],lis):
        print (-1)
        sys.exit()

for i in range(50,0,-1):

    lis[i] = False
    for j in range(N):

        ret = able(a[j],b[j],lis)

        if not ret:
            lis[i] = True
            break

ans = 0
for i in range(1,51):
    if lis[i]:
        ans += 2**i
print (ans)


# Example run
# Input:
337226
-1
0
# Output:
-1
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

candidate = [(a, 0, 0)]
best_score = (False, 2**(max(a)))

while candidate != []:
    c = candidate.pop(0)
    print(c)
    A, prev_k, score = c
    if score >= best_score[1]:
        continue
    index = [i for i in range(len(A)) if A[i] != b[i]]
    if index == []:
        best_score = (True, min(score, best_score[1]))
        continue
    K = [ (i, [k for k in range(b[i] + 1, A[i] + 1) if A[i] % k >= b[i]])  for i in index]
    is_valid = True
    for (i, ks) in K:
        if ks == []:
            is_valid = False
            break
    if not is_valid:
        continue

    for (i, ks) in K:
        for k in ks:
            A2 = A.copy()
            A2[i] %= k
            if k == prev_k:
                candidate.append((A2, k, score))
            else:
                candidate.append((A2, k, score + 2**k))
    candidate.sort(key = lambda c:c[2])
                
if not best_score[0]:
    print(-1)
else:
    print(best_score[1])


# Example run
# Input:
16
-181
1419428
# Output:
([-181], 0, 0)
-1
def solve(bit_state, num, mod):
    for div in range(1, num + 1):
        if num % div == mod:
            cand[i].append(bit_state | (1 << div))
        if num % div > mod:
            solve(bit_state | (1 << div), num % div, mod)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cand = [[] for i in range(n)]
for i in range(n):
    solve(0, a[i], b[i])

ans = 0
while True:
    max_ = 0
    for j in range(n):
        min_ = 10 ** 5
        for num in cand[j]:
            min_ = min(min_, num.bit_length() - 1)
        max_ = max(max_, min_)

    if max_ == 0:
        print(ans)
        break
    if max_ == 10 ** 5:
        print(-1)
        break
    ans += 2 ** max_
    
    tmp = [[] for i in range(n)]
    for j in range(n):
        for num in cand[j]:
            if num & (1 << max_):
                tmp[j].append(num - (1 << max_))
            else:
                tmp[j].append(num)
    cand = tmp[0:]
            

# Example run
# Input:
0
-1251521
-47187920
# Output:
0
import sys

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

minimum = [[51 for _ in range(51)] for _ in range(51)]
for i in range(50, 0, -1):
	minimum[i][i] = 50
	for j in range(1, 51):
		for k in range(51):
			if minimum[i][k] <= 50:
				minimum[i][k%j] = min(j, minimum[i][k%j])

ans = 0
for k in range(51, 0, -1):
	needed = False
	for i in range(n):
		if a[i] == b[i]:
			continue
		elif b[i]*2 >= a[i]:
			print(-1)
			sys.exit()
		else:
			if minimum[a[i]][b[i]] == k:
				needed = True
	if needed:
		ans += 2**k
		for i in range(n):
			if a[i]%k == b[i]:
				a[i] %= k
			elif minimum[a[i]][b[i]] == k:
				a[i] %= k
			elif minimum[a[i]][b[i]] >= minimum[a[i]%k][b[i]]:
				a[i] %= k
		#print(k, a)
print(ans)

# Example run
# Input:
-491947
894121
-111
# Output:
0
import sys

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

minimum = [[51 for _ in range(51)] for _ in range(51)]
for i in range(50, 0, -1):
	minimum[i][i] = 50
	for j in range(1, 51):
		for k in range(51):
			if minimum[i][k] <= 50:
				minimum[i][k%j] = min(j, minimum[i][k%j])

ans = 0
for k in range(51, 0, -1):
	needed = False
	for i in range(n):
		if a[i] == b[i]:
			continue
		elif b[i] >= (a[i]+1)//2:
			print(-1)
			sys.exit()
		else:
			if minimum[a[i]][b[i]] == k:
				needed = True
	if needed:
		ans += 2**k
		for i in range(n):
			if a[i]%k == b[i] or a[i]%k > 2*b[i]:
				a[i] %= k
print(ans)

# Example run
# Input:
-124978655
-23909
-68
# Output:
0
n = int(input())
xs = [int(c) for c in input().split()]
ys = [int(c) for c in input().split()]

def dp(x, y, mods):
  table = [False] * (x + 1)
  table[x] = True
  mods.sort(reverse=True)
  for mod in mods:
    for i in range(x + 1):
      table[i % mod] = table[i % mod] or table[i]
  return table[y]

def ok(mods):
  return all(dp(x, y, list(mods)) for x, y in zip(xs, ys))

if not ok(range(1, 51)):
  print(-1)
  quit(0)

mods = []
for mod in range(50, 0, -1):
  if not ok(mods + list(range(1, mod))):
    mods.append(mod)

print(sum(2 ** mod for mod in mods))

# Example run
# Input:
1287469
21
5
# Output:
256
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]

Cost = 0
Sub = [0] * N

def divisor(i, b): #iの約数でbより大きく最小のもの
    for n in range(b+1, i):
        if i % n == 0:
            return n
    return i

def operate(A, B):
    Div = 0
    for i in range(N):
        if A[i] == B[i] or B[i] == 0: continue
        elif A[i] - B[i] < B[i]:return -1
        else:Div = max(divisor(A[i] - B[i], B[i]), Div)
    return Div

for i in range(N):
    div = operate(A, B)
    if div == -1:
        print(-1)
        break
    elif div == 0: continue
    else:
        for i in range(N):
            if A[i] == B[i]: continue
            elif A[i] % div >= B[i]:
                A[i] %= div
        Cost += 2 ** div
else: 
    for i in range(N):
        if B[i] == 0 and A[i] > 0:
            Cost += 1
            break
    print(Cost)

# Example run
# Input:
0
-17760757
992
# Output:
0
n = int(input())

for _ in range(n):
    train = ''
    seq = input()
    for i in range(0, len(seq), 3):
        if i == 0:
            train += seq[i]
        if seq[i - 2] == '-' and train[-1] == seq[i - 3]:
            train = train + seq[i]
        if seq[i - 2] == '<' and train[0] == seq[i - 3]:
            train = seq[i] + train
    print(train)



# Example run
# Input:
-1
# Output:
n=int(input())
for _ in range(n):
    s=input()
    s=s.replace("-","")
    train=["" for i in range(60)]
    pointer=30
    for i in s:
        if i=="<":
            pointer-=1
        elif i==">":
            pointer+=1
        else:
            train[pointer]=i
    print("".join(train))



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

for _ in range(n):
    train = ''
    seq = input()
    for i in range(0, len(seq), 3):
        if i == 0:
            train += seq[i]
        if seq[i - 2] == '-' and train[-1] == seq[i - 3]:
            train = train + seq[i]
        if seq[i - 2] == '<' and train[0] == seq[i - 3]:
            train = seq[i] + train
    print(train)



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

for _ in range(n):
    train = ''
    seq = input()
    for i in range(0, len(seq), 3):
        if i == 0:
            train += seq[i]
        if seq[i - 2:i] == '->' and train[-1] == seq[i - 3]:
            train = train + seq[i]
        if seq[i - 2:i] == '<-' and train[0] == seq[i - 3]:
            train = seq[i] + train
    print(train)



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

for _ in range(n):
    train = ''
    seq = input()
    for i in range(len(seq) // 3 + 1):
        if i == 0:
            train += seq[i]
        if seq[3 * i - 2] == '-' and train[-1] == seq[3 * (i - 1)]:
            train = train + seq[3 * i]
        if seq[3 * i - 2] == '<' and train[0] == seq[3 * (i - 1)]:
            train = seq[3 * i] + train
    print(train)



# Example run
# Input:
-1062073697
# Output:
inputCount = int(input())

for _ in range(inputCount):

    inputContent = input()
    trainOrder = [item for item in inputContent if str.isalpha(item)]
    directOrder = [item for item in inputContent if item == "<" or item == ">"]

    trainList = []
    trainList.append(trainOrder[0])
    listIndex = 1
    trainLength = 1

    for train, direct in zip(trainOrder[1:], directOrder):

        if listIndex == 1 and direct == "<":
            trainList.insert(0, train)
            trainLength += 1
        elif listIndex == trainLength and direct == ">":
            trainList.append(train)
            listIndex += 1
            trainLength += 1
            
        elif direct == "<":
            listIndex -= 1
        elif direct == ">":
            listIndex += 1

    output = "".join(trainList)
    print(output)



# Example run
# Input:
-2713
# Output:
inputCount = int(input())

for _ in range(inputCount):

    inputContent = input()
    trainOrder = [item for item in inputContent if str.isalpha(item)]
    directOrder = [item for item in inputContent if item == "<" or item == ">"]

    trainList = trainOrder[0]
    listIndex = 1
    trainLength = 1

    for train, direct in zip(trainOrder[1:], directOrder):

        if listIndex == 1 and direct == "<":
            trainList = train + trainList
            trainLength += 1
        elif listIndex == trainLength and direct == ">":
            trainList += train
            listIndex += 1
            trainLength += 1

        elif direct == "<":
            listIndex -= 1
        else:
            listIndex += 1

    print(trainList)



# Example run
# Input:
0
# Output:
n = int(input())
for _ in range(n):
  s = input()
  rec = [None] * 52
  ind = 25
  rec[ind] = s[0]
  max_ind = 25
  min_ind = 25

  for i in range(1, len(s), 3):
    direct = s[i:i + 2]
    if direct == "->":
      ind += 1
      max_ind = max(ind, max_ind)
    else:
      ind -= 1
      min_ind = min(ind, min_ind)
    rec[ind] = s[i + 2]

  print("".join(rec[min_ind:max_ind + 1]))


# Example run
# Input:
-1809
# Output:
n=int(input())
for i in range(n):
    s=input()
    station_list=[]
    for si in s[::3]:
        station_list.append(si)
    st_l=list(dict.fromkeys(station_list))
    ans=[0]*51
    ans[25]=station_list[0]
    for j in st_l[1:]:
        place=s.index(j)
        now=s[place-3:place+1]
        if now[1:3]=="->":
            ans[ans.index(now[0])+1]=now[3]
        elif now[1:3]=="<-":
            ans[ans.index(now[0])-1]=now[3]
    ans_l=list(dict.fromkeys(ans))
    ans_l.remove(0)
    print(''.join(map(str,ans_l)))


# Example run
# Input:
-1967036002
# Output:
inputCount = int(input())

for _ in range(inputCount):

    inputContent = input()
    trainOrder = [item for item in inputContent if str.isalpha(item)]
    directOrder = [item for item in inputContent if item == "<" or item == ">"]

    trainList = []
    trainList.append(trainOrder[0])
    listIndex = 1
    trainLength = 1

    for train, direct in zip(trainOrder[1:], directOrder):

        if listIndex == 1 and direct == "<":
            trainList.insert(0, train)
            trainLength += 1
        elif listIndex == trainLength and direct == ">":
            trainList.append(train)
            listIndex += 1
            trainLength += 1

        elif direct == "<":
            listIndex -= 1
        else:
            listIndex += 1

    output = "".join(trainList)
    print(output)



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

for _ in range(n):
    train = ''
    seq = input()
    for i in range(len(seq) // 3 + 1):
        if i == 0:
            train += seq[i]
        if seq[3 * i - 2] == '-' and train[-1] == seq[3 * (i - 1)]:
            train = train + seq[3 * i]
        if seq[3 * i - 2] == '<' and train[0] == seq[3 * (i - 1)]:
            train = seq[3 * i] + train
    print(train)



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

for _ in range(n):
    train = ''
    seq = input()
    for i in range(0, len(seq), 3):
        if i == 0:
            train += seq[i]
        if seq[i - 2:i] == '->' and train[-1] == seq[i - 3]:
            train = train + seq[i]
        if seq[i - 2:i] == '<-' and train[0] == seq[i - 3]:
            train = seq[i] + train
    print(train)



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

for i in range(0,n):
    datas = input()
    dic = dict()
    sIndex = inIndex = isMove = 0

    while sIndex < len(datas):
        if not isMove:
            dic[datas[sIndex]] = inIndex
            sIndex += 2
        else:
            if datas[sIndex] == '>':
                inIndex += 1
            else:
                inIndex -= 1
            sIndex += 1
        isMove = not isMove

    dic = {k: v for k, v in sorted(dic.items(), key=lambda item: item[1])}
    for k in dic.keys():
        print(k,end="")
    print()


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

for _ in range(n):
    train = ''
    seq = input()
    for i in range(len(seq) // 3 + 1):
        if i == 0:
            train += seq[i]
        if seq[3 * i - 2] == '-' and train[-1] == seq[3 * (i - 1)]:
            train = train + seq[3 * i]
        if seq[3 * i - 2] == '<' and train[0] == seq[3 * (i - 1)]:
            train = seq[3 * i] + train
    print(train)



# Example run
# Input:
1
/YB4tA{A
# Output:
/
# tenka1-2018D - Crossing
def main():
    N = int(input())
    K = int((N * 2) ** 0.5)
    if K * (K + 1) / 2 != N:
        print("No")
        return
    print("Yes")
    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)
    for a in ans:
        print(K + 1, end=" ")
        print(" ".join(map(str, a)))


if __name__ == "__main__":
    main()

# Example run
# Input:
446
# Output:
No
N = int(input())
flg = 0
k = 0
while k * (k - 1) <= 2 * N:
  if k * (k - 1) == 2 * N:
    flg = 1
    break
  else:
    k += 1
if flg == 0:
  print("No")
else:
  print("Yes")
  print(k)
  S = [[k-1] 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
  for i in range(k):
    for j in range(k):
      if j == k:
        print(S[i][j])
      else:
        print(S[i][j], end = ' ')
    print()

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

k = (1 + (1 + 8 * n)** 0.5) * 0.5
if k.is_integer():
    k, num = int(k), 1
    ans = [[] for _ in range(k)]
    print('Yes')
    print(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:
174025
# Output:
No
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(s, *nL)


# Example run
# Input:
6
# Output:
Yes
4
3 1 2 3
3 1 4 5
3 2 4 6
3 3 5 6
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:
4743227
# Output:
No
n = int(input())
for l in range(1, 4*10**2):
  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:
-13574883
# 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("N0")
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:
675805
# Output:
No
n = int(input())

for k in range(1,n + 2):
    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:
1459847
# Output:
No
n=int(input())
l=[]
s=0
for i in range(n+2):
  l.append(s)
  s+=i+1
if n not in l:
  print('No')
else:
  k=l.index(n)+1
  ans=[[] for i in range(k)]
  c=0
  for i in range(k):
    for j in range(i+1,k):
      ans[i].append(c+1)
      ans[j].append(c+1)
      c+=1
  print('Yes')
  print(k)
  for i in range(k):
    print(k-1,*ans[i])

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

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

    print("Yes")
    print(k)
    x = [0] * N
    for i in range(k):
        s = []
        for j in range(N):
            n = (i * (sn - 1) + j) % N
            if x[n] < 2:
                s.append(str(n + 1))
                x[n] += 1
                if len(s) == sn:
                    break
        print(sn, " ".join(s))
    break
else:
    print("No")

# Example run
# Input:
-1
# Output:
No
n=int(input())
for i in range(1,150):
  if i*(i+1)//2==n:
    D=[[0]*i for l in range(i)]
    stopcnt=i
    cnt=0
    a,b=0,0
    print('Yes')
    print(i+1)
    for j in range(n):
      D[a][j-b]=j+1
      cnt+=1
      if cnt==stopcnt:
        a+=1
        b+=stopcnt-1
        cnt=0
        stopcnt-=1
    for a in range(i):
      for b in range(a,i):
        D[b][a]=D[a][b]
    DD=[]
    for j in range(i):
      DD.append(D[j][j])
    D.append(DD)
    for j in D:
      print(len(j),*j)
print('No')

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

# Example run
# Input:
-86
# 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")
    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:
0
# Output:
n = int(input())
if (1+8*n)**(1/2) - int((1+8*n) **(1/2)) != 0:
 print("No")
 exit()
k = int((1+(1+8*n)**(1/2))/2)
s = [[] for I in range(k)]
p = [I for I in range(1,int(k*(k-1)/2)+1)]
print(s)
print(p)
for j in range(k):
 for q in range(k-1-j):
  a = p.pop(0)
  s[j].append(a)
  s[q+j+1].append(a)
 
 
 
for i in range(k):
 print(k-1,"".join(str(m) for m in s[i]))

# Example run
# Input:
869595
# Output:
No
# 丁度n本の辺を持つ完全グラフが存在するか？という問題
from itertools import combinations
from collections import defaultdict
n = int(input())
# edgeを入れるとnode数が取れる
dd = defaultdict(int)
prev = 0
for i in range(1, 10**5):
    if n < prev:
        break
    dd[prev] = i
    prev += i

if dd[n]:
    print('Yes')
    print(dd[n])
    # dd[n]頂点、n辺の完全グラフを構築する
    subarrays = [set()for _ in range(dd[n])]
    cnt = 1
    for i, j in combinations(range(dd[n]), 2):
        subarrays[i].add(cnt)
        subarrays[j].add(cnt)
        cnt += 1
    for s in subarrays:
        print(len(s), *s)

else:
    print('No')

# Example run
# Input:
-163
# Output:
No
# https://atcoder.jp/contests/tenka1-2018-beginner/submissions/6799589
# combinationを使うところ

def main():
    from itertools import combinations

    N = int(input())

    # {1,...,N}*2を分割
    # k個の集合があって
    # 各集合は他のk-1個の集合に対し共通要素を1個ずつ合わせてk-1個の要素をもつ

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

    if not cond:
        print('No')
        return

    sets = tuple(set() for _ in range(k))
    for common_component, (set_idx_1, set_idx_2) in enumerate(combinations(range(k), r=2), start=1):
        sets[set_idx_1].add(common_component)
        sets[set_idx_2].add(common_component)

    print('Yes')
    print(k)
    for set_ in sets:
        print(len(set_), *set_)


if __name__ == '__main__':
    main()


# Example run
# Input:
2147483647
# Output:
No
n = int(input())
r = int((2*n)**.5)
if 2*n!=r*(r+1):
    print(-1)
    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:
34675473
# Output:
-1
n = int(input())
a = []
for i in range(1,500):
    a.append(i*(i-1)//2)
if (n in a):
    print("Yes")
    x = a.index(n)+1 #3
    ans = [[] for _ in range(x)]
    now = 1
    l = 0
    while l<x:
        for i in range(x-l-1):
            ans[l].append(now)
            ans[l+1+i].append(now)
            now += 1
        l += 1
    for i in range(x):
        print(x-1,*ans[i])
        
else:
    print("No")

# Example run
# Input:
2657144
# Output:
No
N = int(input())
if N <= 2 or N % 2 == 0:
    print('No')
else:
    print('Yes')
    print(N)

    ans = []

    for i in range(N//2):
        ans.append([(i+1)*(j+1) for j in range(N)])

    for i in range(N//2):
        c = [(i+1)*(j+1) for j in range(N)]
        ans.append(c[i+1:]+c[:i+1])

    for i in zip(*ans):
        print(N-1, *i)


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