stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <math.h>



using namespace std;



int main(){



    

    long long a,b,min,max,num=0;



    cin>>a;

    cin>>b;



    if(a<b){

        min = a;

        max = b;

    }else{

        min = b;

        max = a;

    }



    for (int i = min+1; i <= max; i++)

    {   

        if(abs(a-i) == abs(b-i)){

            num = i;

        }

    }



    if(num != 0){

        cout<<num<<endl;

    }else{

        cout<<"IMPOSSIBLE"<<endl;

    }

    

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    int a,b,k;

    int c=0;

    scanf("%d%d",&a,&b);



 if((a+b)%2==0)



      {

           k=(a+b)/2;

          printf("%d",k);

      }

 else

       {

           printf("IMPOSSIBLE");

       }





return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



 int main() {

        double n,a,b;

        scanf("%lf %lf",&a,&b);

        n = (a+b)/2.0;

        if(floor(n)==ceil(n))

        printf("%.0lf\n",n);

        else

        printf("IMPOSSIBLE\n");

        

     

        

        return 0;

    }

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    int a,b,k;

    int c=0;

    scanf("%d%d",&a,&b);



 if((a+b)%2==0)



      {

           k=(a+b)/2;

          printf("%d",k);

      }

 else

       {

           printf("IMPOSSIBLE");

       }





return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main(void){

    int a, b;

    cin>>a>>b;

    int k= (a+b)/2;

    cout<<( abs(a-k)==abs(b-k) ? to_string(k) : "IMPOSSIBLE")<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    int a,b,k;

    int c=0;

    scanf("%d%d",&a,&b);



 if((a+b)%2==0)



      {

           k=(a+b)/2;

          printf("%d",k);

      }

 else

       {

           printf("IMPOSSIBLE");

       }





return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

   int a,b,k;

   cin>>a>>b;



   k=(a+b)/2;

   if(a%2==0 && b%2==0 || a%2!=0 && b%2!=0)

        cout<<k<<endl;

   else

        cout<<"IMPOSSIBLE"<<endl;





}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<iostream>

using namespace std;



int main(){

    int a,b,value=0;

    int flag=0;

    cin>>a;

    cin>>b;

    if(a<b){

    for(int i=a;i<b;i++){

        if(i-a==b-i){

            flag=1;

            value=i;

        }

    }

    }

    else{

            for(int i=b;i<a;i++){

              if(i-b==a-i){

                  flag=1;

                  value=i;

        }

    }

    }



    if(flag==1){

        cout<<value;

    }

    else{

        cout<<"IMPOSSIBLE";

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include<math.h>

#include<cmath>



using namespace std;



int main()

{

    long long a,b,k,result;

    cin>>a>>b;

    long long temp = b - a;

    long long res = temp/2;



    result = b - res;





    if(abs(b-result) == abs(a - result)){

        cout<<result<<endl;

    }





    else

        cout<<"IMPOSSIBLE"<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define sf scanf

#define pf printf

 

int main()

{

	int a,b;

	sf("%d%d",&a,&b);

	if(a==b||-a==b||a==-b){

		pf("0\n");

	}

	if(a>b){

		swap(a,b);

	}

	for(int i=a;i<b;i++){

		if(-(a-i)==(b-i)){

		

			pf("%d\n",i);

			return 0;

		}

	}

	pf("IMPOSSIBLE\n");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

      int a,b,sum,d;

      cin>>a>>b;

      sum= a+b ;

      if(sum%2==1){

        cout<<"IMPOSSIBLE"<<endl;

      }

      else{

         d=sum/2;

         cout<<d<<endl;



      }





}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cmath>

using namespace std;

int main()

{

	long long int a,b;

	scanf("%lld %lld",&a,&b);

	int ans=0;

	if(a>b)

	{

		int t;

		t = a;

		a = b;

		b = t;

	}

	for (long long int i=a;i<=b;i++)

	{

		if(labs(a-i)==labs(b-i))

		{

			

			ans = i;

			cout << ans;

			return 0;

		}

	}	

	cout << "IMPOSSIBLE";



	return 0;

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    long long int a,b;

    cin >> a>> b;

    if((a+b)&1) cout << "IMPOSSIBLE\n" ;

    else cout << (a+b)/2 << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main()

{

    long long int a,b;

    cin>>a>>b;

    if(a%2==b%2)

    {

        cout<<(a+b)/2<<endl;

    }

    else

    {

        cout<<"IMPOSSIBLE"<<endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using std:: cout;

using std:: cin;

using std::endl;







int main() {



long num1, num2;

cin >> num1 >> num2;



if(num1 % 2 != num2 % 2) {

cout << "IMPOSSIBLE" << endl; //bc both of them need to be divided by 2

}



else {

cout << (num1 + num2) / 2 << endl; //bc k = (num1 + num2) / 2 if u add A and B

}

return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int A,B,K;

    cin>>A;

    cin>>B;

    K=(A+B)/2;

    if((A+B)%2==0)

    {

        cout<<K<<endl;

    }

    else

    {

        cout<<"IMPOSSIBLE"<<endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

    int a,b,div,sum=0;

    cin>>a>>b;



    sum=a+b;



    if(sum%2==0){

        div=sum/2;

        cout<<div;

    }else{

        cout<<"IMPOSSIBLE";

    }





}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    long long int a,b,k;

    cin >> a >> b;

    if((a+b)%2==0){

        k=(a+b)/2;

        cout << k << endl;

    }

    else{

        cout << "IMPOSSIBLE" << endl;

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b,k,c=0;

    scanf("%d %d",&a,&b);

if((a+b)%2==0)

    {

    k=(a+b)/2;

    printf("%d",k);

    }

else

    {

    printf("IMPOSSIBLE");

    }

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <stdio.h>

#include <algorithm>

using namespace std;

#define r(i,n) for(int i=0;i<n;i++)

#define rn(i,n) for(int i=1;i<=n;i++)



int main(void){

  int a,b,ans=-1;

  cin>>a>>b;



  for(int i=min(a,b);i<max(a,b);i++){

    if(abs(a-i)==abs(b-i))ans=i;

  }

  if(ans==-1)cout<<"IMPOSSIBLE"<<endl;

  else cout<<ans<<endl;



  return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#include <stdio.h>

#include <algorithm>

using namespace std;

#define r(i,n) for(int i=0;i<n;i++)

#define rn(i,n) for(int i=1;i<=n;i++)



int main(void){

  int a,b,ans=-1;

  cin>>a>>b;

  if((a+b)%2==0)cout<<(a+b)/2<<endl;

  else cout<<"IMPOSSIBLE"<<endl;



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    if((a+b)%2==0)

    {

        cout<<(a+b)/2<<endl;

    }

    else cout<<"IMPOSSIBLE"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int x,y,c;

    scanf("%d%d",&x,&y);

    if(x%2 != y%2)

    {

    printf("IMPOSSIBLE\n");

    }

    else

    {

        c=(x+y)/2;

        printf("%d",c);

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main()

{

     long long int a,b,c,s=0;

     cin>>a>>b;

     s=(a+b)/2;

     if(abs(a-s)==abs(b-s))cout<<s<<endl;

     else

        cout<<"IMPOSSIBLE"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int x,y,c;

    scanf("%d%d",&x,&y);

    if(x%2 != y%2)

    {

    printf("IMPOSSIBLE\n");

    }

    else

    {

        c=(x+y)/2;

        printf("%d",c);

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <math.h>



using namespace std;



int main(){



    

    long long a,b,min,max,num=0;



    cin>>a;

    cin>>b;



    if(a<b){

        min = a;

        max = b;

    }else{

        min = b;

        max = a;

    }



    for (int i = min+1; i <= max; i++)

    {   

        if(abs(a-i) == abs(b-i)){

            num = i;

        }

    }



    if(num != 0){

        cout<<num<<endl;

    }else{

        cout<<"IMPOSSIBLE"<<endl;

    }

    

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>



using namespace std;







int main()

{

    long long a,b,p;



    cin >> a >>  b;



    long long k;



    k=min(a,b);



    p=abs(a-b);







    if(p%2!=0)

    {

        cout << "IMPOSSIBLE";

    }

    else

    {

        p=p/2;



        cout << k+p;

    }





    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<math.h>

using namespace std;

int main()

{

	long long x,k,a,i;

	cin>>k;

	x=0;a=1;

	while(k>0)

	{

		x+=a;

		a*=2;

		k/=2;

	}

	cout<<x;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

long long num=1,sum=0,H;

int main()

{

    scanf("%lld",&H);

    while(H>1e-10)

    {

        H=H/2;

        sum+=num;

        num*=2;

    }

    printf("%lld\n",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



using i32 = std::int_fast32_t;

using i64 = std::int_fast64_t;

template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;



#define REP(i, stop) FOR(i, 0, stop)

#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)

#define RREP(i, n) for (int i = n; i-- > 0;)

#define ALL(v) (v).begin(), (v).end()

#define RALL(v) (v).rbegin(), (v).rend()

#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }



template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }

template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }



void LOG(const int& x) { cerr << x << "\n"; }

template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }

template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }

template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }



i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }

i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }

i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }

i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }

i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }

i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }

i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }



struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;



signed main() {

  i64 n, k;

  cin >> n >> k;

  if (k > (n - 2) * (n - 1) / 2) {

    cout << -1 << endl;

  } else {

    cout << ((n - 1) + (n - 2) * (n - 1) / 2 - k) << endl;

    for (i64 i = 1; i <= n - 1; ++i) {

      cout << i << " " << n << endl;

    }

    i64 c = (n - 2) * (n - 1) / 2 - k;

    for (i64 i = 1; i <= n - 2; ++i) {

      for (i64 j = i + 1; j <= n - 1; ++j) {

        if (c > 0) {

          cout << i << " " << j << endl;

          c -= 1;

        } else {

          return 0;

        }

      }

    }

  }

}


// Optimized solution to the same problem (faster):
#include <cstdio>



signed main() {

	int n, k;

	scanf("%d%d", &n, &k);

	if (k > (n - 2) * (n - 1) / 2) {

		puts("-1\n");

	} else {

		printf("%d\n", n * (n - 1) / 2 - k);

		for (int i = 1; i <= n - 1; ++i) {

			printf("%d %d\n", i, n);

		}

		int c = (n - 2) * (n - 1) / 2 - k;

		for (int i = 1; i <= n - 2; ++i) {

			for (int j = i + 1; j <= n - 1; ++j) {

				if (c > 0) {

					printf("%d %d\n", i, j);

					--c;

				} else {

					return 0;

				}

			}

		}

	}

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define pi acos(0.0)

#define ll long long

#define f first

#define s second

#define gap ' '

#define pb push_back

int main()

{

    int n,k;

    cin>>n>>k;

    if(((n-2)*(n-1))/2 < k)

    {

        cout<<-1;

        return 0;

    }

    pair<int,int> ara[100005];

    int m=0;

    for(int i=2;i<=n;i++)

    {



       ara[m].f=1;

       ara[m].s=i;

       m++;



    }

    vector<pair<int,int> >p;

    for(int i=2;i<=n;i++)

    {

       for(int j=i+1;j<=n;j++)

       {

          p.pb({i,j});

       }

    }

    for(int i=0;i<((n-2)*(n-1))/2-k;i++)

    {

        ara[m]=p[i];

        m++;



    }

    cout<<m<<endl;

    for(int i=0;i<m;i++)

    {

        cout<<ara[i].f<<gap<<ara[i].s<<endl;

    }





}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;



int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    int n,k;

    scanf("%d %d",&n,&k);

    int ans = (n-1)*(n-2)/2;

    if(ans < k)

    {

        printf("-1");

    }

    else

    {

        printf("%d\n",n-1 + ans - k );

        for(int i=2;i<=n;i++)

            printf("%d %d\n",1,i);



        for(int i=2;i<=n;i++)

            for(int j=i+1;j<=n;j++)

            {

                if(ans == k) return 0;

                printf("%d %d\n",i,j);

                ans--;

                

            }

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int N, K, M;



int main()

{

    cin >> N >> K;

    M = N * (N - 1) / 2 - K;

    if(M < N - 1) M = -1;

    

    cout << M << endl;

    if(M != -1)

	{

        int cnt = N - 1;

        while(M > 0)

		{

            for (int i=N-cnt+1;i<= (min(N, N - cnt + M));++i) 

				cout << N - cnt << " " << i << endl;

            M -= cnt--;

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;



int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    int n,k;

    scanf("%d %d",&n,&k);

    int ans = (n-1)*(n-2)/2;

    if(ans < k)

    {

        printf("-1");

    }

    else

    {

        printf("%d\n",n-1 + ans - k );

        for(int i=2;i<=n;i++)

            printf("%d %d\n",1,i);



        for(int i=2;i<=n;i++)

            for(int j=i+1;j<=n;j++)

            {

                if(ans == k) return 0;

                printf("%d %d\n",i,j);

                ans--;

                

            }

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



typedef pair<int,int> pii;



int n,k;



vector<pii> adj;

int isi[105];



int main(){

	scanf("%d%d",&n,&k);

	if(k>((n-1)*(n-2)/2)){

		cout << "-1\n";

		return 0;

	}

//	adj.push_back(make_pair(1,2));

	int cur = (n-1)*(n-2)/2;

	for(int i=2;i<=n;i++) adj.push_back(make_pair(1,i));

	for(int i=2;i<=n;i++){

		for(int j=i+1;j<=n;j++){

			if(cur == k) break;

			adj.push_back(make_pair(i,j));

			cur--;

		}

	}

	cout << adj.size() << endl;

	for(int i=0;i<adj.size();i++){

		cout << adj[i].first << " " << adj[i].second << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;



int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    int n,k;

    scanf("%d %d",&n,&k);

    int ans = (n-1)*(n-2)/2;

    if(ans < k)

    {

        printf("-1");

    }

    else

    {

        printf("%d\n",n-1 + ans - k );

        for(int i=2;i<=n;i++)

            printf("%d %d\n",1,i);



        for(int i=2;i<=n;i++)

            for(int j=i+1;j<=n;j++)

            {

                if(ans == k) return 0;

                printf("%d %d\n",i,j);

                ans--;

                

            }

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<algorithm>



using namespace std;



int main(){

	int n; scanf("%d", &n);

	for(int k = 1; k * (k + 1) / 2 <= n; k++) if(k * (k + 1) / 2 == n){

		int s[500][500] = {};

		for(int i = 0, p = 1; i < k; i++){

			for(int j = 0; j < k - i; j++) s[i][j + i] = p++;

		}

		int t[500][500] = {};

		for(int i = 0; i < k; i++) for(int j = 0; j < k; j++) if(s[i][j] > 0) t[j + 1][i] = s[i][j];

		for(int i = 0; i < k + 1; i++) for(int j = 0; j < k; j++) if(s[i][j] == 0) s[i][j] = t[i][j];

		puts("Yes");

		printf("%d\n", k + 1);

		for(int i = 0; i < k + 1; i++){

			printf("%d ", k);

			for(int j = 0; j < k; j++) printf("%d%c", s[i][j], j + 1 == k ? '\n' : ' ');

		}

		return 0;

	}

	puts("No");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>



using namespace std;



int main(){

	int n; scanf("%d", &n);

	for(int k = 1; k * (k + 1) / 2 <= n; k++) if(k * (k + 1) / 2 == n){

		int s[500][500] = {};

		for(int i = 0, p = 1; i < k; i++) for(int j = 0; j < k - i; j++) s[i][j + i] = p++;

		for(int i = 0; i < k; i++) for(int j = 0; j < k - i; j++) s[j + i + 1][i] = s[i][j + i];

		puts("Yes");

		printf("%d\n", k + 1);

		for(int i = 0; i < k + 1; i++){

			printf("%d ", k);

			for(int j = 0; j < k; j++) printf("%d%c", s[i][j], j + 1 == k ? '\n' : ' ');

		}

		return 0;

	}

	puts("No");

	return 0;

}

// Fastest known solution for this problem: