Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 13:58:43 2020

@author: 藤原聖士
"""


N=int(input())
A=int(input())
B=int(input())

check=0
checks=0
count=0

for i in range(N):
    checks=0
    Ns=i+1
    while True:
        
        check=Ns%10
        checks+=check
        Ns=int(Ns/10)

        if Ns==0:
            break
    if checks>= A and checks<=B:
        count+=i+1
        #print(i)

print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 13:58:43 2020

@author: 藤原聖士
"""

"""
N=int(input())
A=int(input())
B=int(input())
"""

N,A,B=map(int,input().split())

check=0
checks=0
count=0

for i in range(N):
    checks=0
    Ns=i+1
    while True:
        
        check=Ns%10
        checks+=check
        Ns=int(Ns/10)

        if Ns==0:
            break
    if checks>= A and checks<=B:
        count+=i+1
        #print(i)

print(count)
import sys
import math
from collections import deque
import copy

MOD = 10 ** 9 + 7
H, W = map(int, input().split())

a = [["#" for _ in range(W + 2)]]
for i in range(H):
    p = deque(list(input()))
    p.appendleft("#")
    p.append("#")
    a.append(list(p))
a.append(["#" for _ in range(W + 2)])

dp = [[0 for _ in range(H + 10)] for _ in range(W + 10)]
dp[0][1] = 1
for i in range(1, H + 1):
    for l in range(1, W + 1):
        if a[i][l] != "#":
            dp[i][l] = (dp[i][l - 1] + dp[i - 1][l]) % MOD
print(dp[H][W] % MOD)


### FIXED CODE ###

import sys
import math
from collections import deque
import copy

MOD = 10 ** 9 + 7
H, W = map(int, input().split())

a = [["#" for _ in range(W + 2)]]
for i in range(H):
    p = deque(list(input()))
    p.appendleft("#")
    p.append("#")
    a.append(list(p))
a.append(["#" for _ in range(W + 2)])

dp = [[0 for _ in range(W + 10)] for _ in range(H + 10)]
dp[0][1] = 1
for i in range(1, H + 1):
    for l in range(1, W + 1):
        if a[i][l] != "#":
            dp[i][l] = (dp[i][l - 1] + dp[i - 1][l]) % MOD
print(dp[H][W] % MOD)
H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
h = 2*10**4
dp = [10**9 for i in range(x+1)]
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(x+1):
        if j < a:
            continue
        dp[j] = min(dp[j-a]+b,dp[j])
ans = 10**9
for i in range(H,x+1):
    ans = min(ans,dp[i])
print(ans)

### FIXED CODE ###

H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
x = max(A)
dp = [10**9 for i in range(H+x+1)]
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(H+x+1):
        if j < a:
            continue
        dp[j] = min(dp[j-a]+b,dp[j])
ans = 10**9
for i in range(H,H+x+1):
    ans = min(ans,dp[i])
print(ans)
n, x = [int(i) for i in input().split()]


if n == x == 0:
    break
    
count = 0
for s in range(1, n // 2 + 1):
    for e in range(n, n // 2 +1, - 1):
        m = x - s - e
        if m != s and m != e and m <= n and m > s:
            count += 1
            
    print(count)

### FIXED CODE ###

while True:
    n, x = [int(i) for i in input().split()]


    if n == x == 0:
        break

    count = 0
    for s in range(1, n - 1):
        for m in range(s+1, n):
            for e in range(m+1, n+1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)
use std::io::stdin;

fn main(){
    let x = geti64s()[0];
    let (d, m) = (x/11, x%11);
    println!("{}", match m {
        0         => d*2,
        x if x<=6 => d*2 + 1,
        _         => d*2 + 2
    });
}

#[allow(dead_code)]
fn getline() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn getvec() -> Vec<usize>{
    let line = getline();
    line.split_whitespace().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn geti64s() -> Vec<i64>{
    let line = getline();
    line.split_whitespace().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn getpair() -> (usize, usize){
    let nm = getvec();
    (nm[0], nm[1])
}

### FIXED CODE ###

from collections import Counter

_ = input()
xs = Counter(map(int, input().split()))
even = sum(1 for (k, c) in xs.items() if c%2==0)
odd = sum(1 for (k, c) in xs.items() if c%2==1)
print(odd + (even//2)*2)
s=input()
if s="ARC":
  print("ABC")
elif s="ABC":
  print("ARC")


### FIXED CODE ###

s=input()
if s=="ABC":
  print("ARC")
elif s=="ARC":
  print("ABC")
n=int(input())
m=int(input())

if m>=n:
    print('Yes\n')
else:
    print('No\n')
    

### FIXED CODE ###

n,m = map(int,input().split())

if m>=n:
    print('Yes\n')
else:
    print('No\n')
n = raw_input()
print(n ** 3)

### FIXED CODE ###

n = input()
print(n ** 3)
X,N = list(map(int,input().split()))
p = list(map(int,input().split()))

def f(p):
  global X
  return p - X

p2 = list(map(f,p))

p3 = list(map(abs,p2))

OK = 2
j = 0


if min(p3) ==0:
  while(OK==2):
    j+=1
    OK = p3.count(min(p3)+j)
  if OK == 1:
    print(X-p2[p3.index(min(p3)+j)])
  else:
    print(X-j)
else:
  print(X)

### FIXED CODE ###

X,N = list(map(int,input().split()))
if N != 0:
  p = list(map(int,input().split()))
else:
  p = [X+1]
def f(p):
  global X
  return p - X

p2 = list(map(f,p))

p3 = list(map(abs,p2))

OK = 2
j = 0


if min(p3) ==0:
  while(OK==2):
    j+=1
    OK = p3.count(min(p3)+j)
  if OK == 1:
    print(X-p2[p3.index(min(p3)+j)])
  else:
    print(X-j)
else:
  print(X)
n,m = map(int,input().split())
ls = set(map(int,input().split()))
for i in range(m):
    b,c = map(int,input().split())
    ls.sort()
    for j in range(b):
        if ls[j] < c:
            ls[j] = c
print(sum(ls))


### FIXED CODE ###

n,m = map(int,input().split())
ls = list(map(int,input().split()))
di = [list(map(int,input().split())) for _ in range(m)]
fi = []
for i,j in di:
    fi.append([j,i])
for k in ls:
    fi.append([k,1])
fi.sort(reverse=True)
ans = 0
cnt = 0
how = 0
while True:
    if how + fi[cnt][1] < n:
        how += fi[cnt][1]
        ans += fi[cnt][1]*fi[cnt][0]
    else:
        ans += (n-how)*fi[cnt][0]
        break
    cnt += 1
print(ans)
A, B = map(int, input().split())

if A - B > 1:
  x = 2A - 1
elif B - A > 1:
  x = 2B - 1
else:
 S = A + B

print(x)

### FIXED CODE ###

A, B = map(int, input().split())

if A - B > 1:
  x = 2 * A - 1
elif B - A > 1:
  x = 2 * B - 1
else:
  x = A + B

print(x)
import sys
sys.setrecursionlimit(100001)
def input():
    return sys.stdin.readline()[:-1]
from heapq import *

def dfs(s, es):
    dist = [None] * len(es)
    dist[s] = 0
    def ret(v, d):
        for u, c in es[v]:
            if dist[u] == None:
                dist[u] = dist[v] + c
                ret(u, dist[u])
    ret(s, 0)
    return dist

N = int(input())
es = [[] for i in range(N+1)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    es[a].append((b, c))
    es[b].append((a, c))
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(Q)]
dist = dfs(K, es)
for i in range(Q):
    print(dist[xy[i][0]] + dist[xy[i][1]])

### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)
def input():
    return sys.stdin.readline()[:-1]
from heapq import *

INF = 10 ** 20
def dijkstra(s, edges):
    dist = [INF for _ in range(len(edges))]
    dist[s], h = 0, []
    heappush(h, (0, s))
    while (len(h)):
        dv, v = heappop(h)
        if dv > dist[v]:
            continue
        for u, cost in edges[v]:
            if dv + cost < dist[u]:
                dist[u] = dv + cost
                heappush(h, (dist[u], u))
    return dist

N = int(input())
es = [[] for i in range(N+1)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    es[a].append((b, c))
    es[b].append((a, c))
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(Q)]
dist = dijkstra(K, es)
for i in range(Q):
    print(dist[xy[i][0]] + dist[xy[i][1]])
s=list(map(input().split()))
t=list(map(input().split()))
x=0
for i in range(0,2):
  if s[i]=t[i]:
    x+=1
print(x)

### FIXED CODE ###

s=list(input())
t=list(input())
x=0
for i in range(0,3):
  if s[i]==t[i]:
    x+=1
print(x)
from functools import*
d=lambda x,y:d(x,y%x)if y%x else x
_,a=open(0)
print(reduce(d,map(int,a.split())))

### FIXED CODE ###

from functools import*
d=lambda x,y:d(y%x,x)if y%x else x
_,a=open(0)
print(reduce(d,map(int,a.split())))
from collections import deque
n,m,k=map(int,input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
time=0
ans=0
if sum(a)+sum(b)<=k:
    print(n+m)
    exit()
a=deque(a)
b=deque(b)
a0=a.popleft()
b0=b.popleft()
while True:
  if a0>=b0:
    time+=b0
    if time>k:
      print(ans)
      exit()
    else:
      ans+=1
      b0=b.popleft()
  else:
    time+=a0
    if time>k:
      print(ans)
      exit()
    else:
      ans+=1
      a0=a.popleft()

### FIXED CODE ###

n,m,k=map(int,input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
ans=0
a, b=[0], [0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
j=m
for i in range(n+1):
    if k<a[i]:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
n = int(input())
list_A = list(map(int, input().split()))

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

list_B = list(set(list_A))
an = 0
for i in range(len(list_B)):
    c = list_A.count(list_B[i])
    an += cmb(c, 2)


for i in range(n):
    c = list_A.count(list_A[i])
    if c != 2:
        ans = an - cmb(c, 2) + cmb(c-1, 2)
    else:
        ans = an - 1
    print(ans)

### FIXED CODE ###

n = int(input())
list_A = list(map(int, input().split()))
list_B = list(set(list_A))
list_M = [0 for _ in range(n+1)]

for s in list_A:
    list_M[s] += 1
total = 0

for i in range(n+1):
    total += list_M[i]*(list_M[i]-1)//2

for s in list_A:
    ans = total - list_M[s] + 1
    print(ans)
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  int ans = 0;
  for(int i = 0; i < n; i++){
    int right1 = i, right2 = i;
    while(right1+1 < n && a[right1] <= a[right1+1]) right1++;
    while(right2+1 < n && a[right2] >= a[right2+1]) right2++;
    i = max(right1, right2);
    ans++;
  }
  cout << ans << endl;

  return 0;
}

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

i = 0
ans = 0
for a in A:
  right, right2 = i, i
  while right+1 < N and A[right] <= A[right+1]: right += 1
  while right2+1 < N and A[right2] >= A[right2+1]: right2 += 1
  i = max(right, right2) + 1
  ans += 1
  if i >= N: break
print(ans)
a,b=map(int,input().split());q=max(-1000000,b-a+1);w=min(1000000,b+a-1);A=[i for i in range(q,w+1)];print([A][0]*)

### FIXED CODE ###

a,b=map(int,input().split());q=max(-1000000,b-a+1);w=min(1000000,b+a-1);A=[i for i in range(q,w+1)]
for i in range(len(A)):
  print(A[i])
a = input()
print(char(ord(a)+1))

### FIXED CODE ###

a = input()
print(chr(ord(a)+1))
import sys
sys.setrecursionlimit(10**9)

INF = 10**20
def main():
    H,N = map(int,input().split())
    A,B = [],[]
    for _ in range(N):
        a,b = map(int,input().split())
        A.append(a)
        B.append(b)

    tp = 10**4
    dp = [INF] * tp
    dp[0] = 0
    for h in range(tp):
        minim = INF
        for i in range(N):
            dp_i = h-A[i]
            if dp_i >= 0 and dp[dp_i] != INF:
                minim = min(minim,dp[dp_i]+B[i])
                # print(dp[h-A[i]]+B[i])

        if minim != INF:
            dp[h] = minim
            if h >= H:
                # print(dp[h],h,dp)
                print(dp[h])
                exit()


    assert False


if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

INF = 10**20
def main():
    H,N = map(int,input().split())
    A,B = [],[]
    for _ in range(N):
        a,b = map(int,input().split())
        A.append(a)
        B.append(b)

    tp = 3 * 10**4
    dp = [INF] * tp
    dp[0] = 0
    ans = INF
    for h in range(tp):
        minim = INF
        for i in range(N):
            dp_i = h-A[i]
            if dp_i >= 0 and dp[dp_i] != INF:
                minim = min(minim,dp[dp_i]+B[i])
                # print(dp[h-A[i]]+B[i])

        if minim != INF:
            dp[h] = minim
            if h >= H:
                ans = min(ans,dp[h])


    print(ans)


if __name__ == "__main__":
  main()
#!/usr/bin/env python3

def main():
    [N, K] = list(map(int, input().split()))
    s_list = []
    for i in range(N):
        s_list.append(list(map(int, input().split())))

    s_list.sort(key = lambda v: v[1], reverse = True)
    n_set = set()
    A, B = [0], [0]
    tot_a, tot_b = 0, 0
    for td in s_list:
        if not td[0] in n_set:
            n_set.add(td[0])
            tot_a += td[1]
            A.append(tot_a)
        else:
            tot_b += td[1]
            B.append(tot_b)

    min_n = max(1, K - (len(B) - 1))
    max_x = 0
    for i in range(min_n, len(A)):
        max_x = max(max_x, A[i] +i ** 2 + B[K - i])

    print(max_x)


if __name__ == '__main__':
    main()



### FIXED CODE ###

#!/usr/bin/env python3

def main():
    [N, K] = list(map(int, input().split()))
    s_list = []
    for i in range(N):
        s_list.append(list(map(int, input().split())))

    s_list.sort(key = lambda v: v[1], reverse = True)
    n_set = set()
    A, B = [0], [0]
    tot_a, tot_b = 0, 0
    for td in s_list:
        if not td[0] in n_set:
            n_set.add(td[0])
            tot_a += td[1]
            A.append(tot_a)
        else:
            tot_b += td[1]
            B.append(tot_b)

    min_n = max(1, K - (len(B) - 1))
    max_n = min(K + 1, len(A))
    max_x = 0
    for i in range(min_n, max_n):
        max_x = max(max_x, A[i] + i ** 2 + B[K - i])

    print(max_x)


if __name__ == '__main__':
    main()
x = map(int,input().split())
print(x.index(0)+1)

### FIXED CODE ###

x = list(map(int,input().split()))
print(x.index(0)+1)
k=int(input())
a,b=map(int, input().split())
ok=False
for i in range(a, b+1):
  ok = ok or i % k
print(['NG','OK'][ok])

### FIXED CODE ###

k=int(input())
a,b=map(int, input().split())
ok=False
for i in range(a, b+1):
  ok = ok or (i % k == 0)
print(['NG','OK'][ok])
#include<time.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}

int main(void){
    int n,y,m;
    string ans;
    cin>>n;
    y=n/100;
    m=n%100;
    //cout<<y<<' '<<m<<endl;
    if (1<=m and m<=12){
        if (1<=y && y<=12){
            ans="AMBIGUOUS";
        }else{
            ans="YYMM";
        }
    }else if(1<=y && y<=12){
        ans="MMYY";
    }else{
        ans="NA";
    }
    cout<<ans;
}






### FIXED CODE ###


s=input()
f=int(s[0:2])
l=int(s[2:4])

if 12>=f>=1 and 12>=l>=1:
    k=3
elif not(12>=f>=1) and 12>=l>=1:
    k=1
elif not(12>=l>=1) and 12>=f>=1:
    k=2
else:
    k=4
ans=['','YYMM','MMYY','AMBIGUOUS','NA']
print(ans[k])
#!/usr/bin/env python3


def count_pins(n, s):
    k = 3
    if n < k or n < 1 or k < 1:
        return 0
    elif n == k:
        return 1
    v1 = [0 for _ in range(n)]
    v2 = [0 for _ in range(n)]
    v3 = [0 for _ in range(n)]
    v2[n - 1] = 1
    v3[s[n - 1] - 1] = 1
    for i in range(n - 1)[::-1]:
        v2[i] = v2[i + 1]
        if v3[s[i] - 1] == 0:
            v2[i] += 1
            v3[s[i] - 1] = 1
    for j in range(1, k):
        v3 = [0 for _ in range(n)]
        v1[n - 1] = 0
        for i in range(n - 1)[::-1]:
            v1[i] = v1[i + 1]
            v1[i] = v1[i] + v2[i + 1]
            v1[i] = v1[i] - v3[s[i] - 1]
            v3[s[i] - 1] = v2[i + 1]
        v2 = v1[:]
    return v1[0]


def main():
    n = int(input())
    s = [int(c) for c in input()]
    res = count_pins(n, s)
    print(res)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3


def count_pins(n, s):
    k = 3
    if n < k or n < 1 or k < 1:
        return 0
    elif n == k:
        return 1
    v1 = [0 for _ in range(n)]
    v2 = [0 for _ in range(n)]
    v3 = [0 for _ in range(10)]
    v2[n - 1] = 1
    v3[s[n - 1] - 1] = 1
    for i in range(n - 1)[::-1]:
        v2[i] = v2[i + 1]
        if v3[s[i] - 1] == 0:
            v2[i] += 1
            v3[s[i] - 1] = 1
    for j in range(1, k):
        v3 = [0 for _ in range(10)]
        v1[n - 1] = 0
        for i in range(n - 1)[::-1]:
            v1[i] = v1[i + 1]
            v1[i] += v2[i + 1]
            v1[i] -= v3[s[i] - 1]
            v3[s[i] - 1] = v2[i + 1]
        v2 = v1[:]
    return v1[0]


def main():
    n = int(input())
    s = [int(c) for c in input()]
    res = count_pins(n, s)
    print(res)


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

XY = [list(map(int,input().split())) for _ in range(N)]

x=[]
y=[]
XY=XY.set()
for X,Y in XY:
    x.append(X)
    y.append(Y)
    
l1=[]
c=0
for i in range(N):
    for j in range(i+1,N):
        a=x[i]-x[j]
        b=y[i]-y[j]
        if a<=0 and b>=0:
            a=-a
            b=-b
        elif a<=0 and b<=0:
            a=-a
            b=-b
        l1.append(str(a)+"_"+str(b))
v=set(l1)
c=[]
for i in v:
    c.append(l1.count(i))
#c = collections.Counter(l1)      
#values, counts = zip(*c.most_common())    
print(N-max(c))


### FIXED CODE ###

N=int(input())

XY = [list(map(int,input().split())) for _ in range(N)]

x=[]
y=[]

for X,Y in XY:
    x.append(X)
    y.append(Y)
    
l1=[]
c=0
for i in range(N):
    for j in range(N):
        if i==j:
            continue;
        a=x[i]-x[j]
        b=y[i]-y[j]
        """
        if a<=0 and b>=0:
            a=-a
            b=-b
        elif a<=0 and b<=0:
            a=-a
            b=-b
        """
        l1.append(str(a)+"_"+str(b))
        #l1.append([a,b])
v=set(l1)
c=[]
for i in v:
    c.append(l1.count(i))
#c = collections.Counter(l1)      
#values, counts = zip(*c.most_common()) 
if c==[]:
    print(1)   
else:
    print(N-max(c))
import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    yes = dict()
    for i in range(3, 1000):
        if (i * (i - 1)) % 2 == 0:
            yes[(i * (i - 1)) // 2] = [i, i - 1]

    if n not in yes.keys():
        print("No")
        exit(0)

    xl, xs = yes[n]

    ans = [[] for _ in range(xl)]
    cnt = 1
    idx = 0
    prev = -1
    while cnt <= n and prev != cnt:
        prev = cnt
        for i in range(idx, idx + 3):
            for j in range(xs):
                if i == idx and j == 0:
                    ans[idx + 2].append(cnt)
                if i == idx + 2 and j == xs - 1:
                    continue
                ans[i].append(cnt)
                if j != 0 and j != xs - 1:
                    ans[idx + 2 + j].append(cnt)
                if j != xs - 1:
                    cnt += 1
        idx += 3
        xs -= 3
    print("Yes")
    print(len(ans))
    for ansi in ans:
        print(*ansi, sep=" ")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    yes = dict()
    for i in range(3, 1000):
        if (i * (i - 1)) % 2 == 0:
            yes[(i * (i - 1)) // 2] = [i, i - 1]
    tmp = max(yes)

    if n == 1:
        print("Yes")
        print(2)
        print(1, 1)
        print(1, 1)
        exit(0)


    if n not in yes.keys():
        print("No")
        exit(0)

    xl, xs = yes[n]

    ans = [[] for _ in range(xl)]
    cnt = 1
    idx = 0
    while xs >= 0:
        tmp = cnt
        for i in range(idx, min(xl, idx + 3)):
            for j in range(xs):
                if cnt == tmp + 3 * (xs - 1):
                    ans[i].append(tmp)
                    break
                else:
                    ans[i].append(cnt)

                if j != 0 and j != xs - 1:
                    ans[idx + 2 + j].append(cnt)
                if j != xs - 1:
                    cnt += 1
        idx += 3
        xs -= 3

    print("Yes")
    print(len(ans))
    for ansi in ans:
        print(len(ansi), *ansi, sep=" ")


if __name__ == '__main__':
    main()
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
md=10**9+7
n,k=map(int,input().split())
for i in range(k):
  a=cmb(n-k+1,i)*cmb(k-1,i-1)
  a=a%md
  print(a)

### FIXED CODE ###

import math
def cmb(n, r):
  if n < r : return 0
  else : return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
md=10**9+7
n,k=map(int,input().split())
for i in range(1,k+1):
  a=cmb(n-k+1,i)*cmb(k-1,i-1)
  a=a%md
  print(a)
import sys
input = sys.stdin.readline

N = int(input())
S = ["".join(sorted(input())) for _ in range(N)]
c = Counter(S)
print(sum([k*(k-1)//2 for k in c.values()]))

### FIXED CODE ###

from collections import Counter

N = int(input())
S = []
for _ in range(N):
    S.append("".join(sorted(input())))

c = Counter(S)
print(sum([k*(k-1)//2 for k in c.values()]))
H, W = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(H)]

f = False
for h in range(H):
  pre = '.'
  now = S[h][0]
  nxt = S[h][1]
  abv = '.' if h == 0 else S[h-1][0]
  blw = '.' if h == H-1 else S[h+1][0]
  for w in range(W):
    if now == '.':
      f = False
    elif now in [pre, nxt, abv, blw]:
      f = False
    else:
      f = True
    
    pre = now
    now = nxt
    nxt = '.' if w == W-1 else S[h][w+1]
    abv = '.' if h == 0 else S[h-1][w]
    blw = '.' if h == H-1 else S[h+1][w]
    
    if f:
      print('No')
      exit()
print('Yes')

### FIXED CODE ###

H, W = map(int, input().split())
S = [input() for _ in range(H)]
 
f = False
for h in range(H):
  pre = '.'
  now = S[h][0]
  nxt = S[h][1]
  abv = '.' if h == 0 else S[h-1][0]
  blw = '.' if h == H-1 else S[h+1][0]
  for w in range(W):
    if now == '.':
      f = False
    elif now in [pre, nxt, abv, blw]:
      f = False
    else:
      f = True
    
    pre = now
    now = nxt
    nxt = '.' if w == W-1 else S[h][w+1]
    abv = '.' if h == 0 else S[h-1][w]
    blw = '.' if h == H-1 else S[h+1][w]
    
    if f:
      print('No')
      exit()
print('Yes')