akhauriyash/Code-Regression huggingface dataset:
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

string S = "";

int main() {
	cin >> S;
	if(S.size() == 2) {
		cout << S;
	}
	else {
		for(int i = S.size() - 1; i >= 0; i--) {
			cout << S[i];
		}
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int main(){
    int N, W;
    cin >> N >> W;
    long int items[N+1][2];
    items[0][0] = 0;
    items[0][1] = 0;
    for(int i = 1; i <= N; i++){
        cin >> items[i][0] >> items[i][1];
    }
    long int mat[W+1][N+1];
    mat[0][0] = 0;
    for(int num_item = 0; num_item <= N; num_item++){
        for(int capacidade = 0; capacidade <= W; capacidade++){
            if(num_item == 0 || capacidade == 0){
                mat[capacidade][num_item] = 0;
            }
            else {
                long int custo_anterior = mat[capacidade][max(num_item-1, 0)];
                long int peso_item_atual = items[num_item][0];
                long int valor_item_atual = items[num_item][1];
                long int capacidade_restante = capacidade - peso_item_atual;
                long int custo_com_item_atual = valor_item_atual + mat[capacidade_restante][num_item-1];
                if(capacidade_restante < 0){
                    mat[capacidade][num_item] = custo_anterior;
                }
                else {
                    mat[capacidade][num_item] = max(custo_anterior, custo_com_item_atual);
                }
            }
        }
    }
    cout << mat[W][N];
    return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <string>
#include <regex>
using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
    string s, t;
    int count = 0;
    cin >> s;
    
    //"regex_正規表現を使った文字列検索
    //std::regex_constants::icaseは大文字小文字関係なく検索するオプション(?)
    std::regex re(s, std::regex_constants::icase); 

    //regexのマッチ結果を保有する_マッチ数,最初の文字列,マッチした文字列 等
    std::smatch m;                                 

    while (cin >> t)
    {
        if ((int)t.find("END_OF_TEXT") != -1)
        {
            break;
        }
        else if(std::regex_match(t, m, re))
        {
            count++;
        }
        
        /*
        while (std::regex_match(t, m, re)) //regex_searchは部分一致,regex_matchは完全一致
        {
            count++;
            t = m.suffix(); //一致した文字列よりも後方の文字列で、tを再形成
        }*/
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3236
package main

import (
  "fmt"
)

func main() {
  var a, b int; fmt.Scan(&a, &b)
  cand := []int{a, b, a + b}
  ans := "Impossible"
  for _, v := range cand {
    if v % 3 == 0 {
      ans = "Possible"
      break
    }
  }
  fmt.Println(ans)
}

Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 100005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
vector<pair<int,pii>>edges;
int sz[N],link[N];
void init()
{
    for(int i=0;i<N;i++)link[i]=i;
    for(int i=0;i<N;i++)sz[i]=1;
}
int fnd(int x)
{
    if(link[x]==x)return x;
    return link[x]=fnd(link[x]);
}
void unite(int a,int b)
{
    a=fnd(a);
    b=fnd(b);
    if(a == b)return;
    if(sz[a]<sz[b])swap(a,b);
    link[b]=a;
    sz[a]+=sz[b];

}
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   vector<pair<pii,int>>v1,v2;
   rep(i,0,n)
   {
       int x,y;
       cin>>x>>y;
       v1.pb({{x,y},i+1});
       v2.pb({{y,x},i+1});
   }
   sort(all(v1));
   sort(all(v2));
   for(int i=1;i<v1.size();i++)
   {
       int val=v1[i].F.F-v1[i-1].F.F;
       edges.pb({val,{v1[i].S,v1[i-1].S}});

   }
   for(int i=1;i<v2.size();i++)
   {
       int val=v2[i].F.F-v2[i-1].F.F;
       edges.pb({val,{v2[i].S,v2[i-1].S}});
   }
   sort(all(edges));
   init();
   int cost=0;
   for(int i=0;i<edges.size();i++)
   {
       int a=edges[i].S.F;
       int b=edges[i].S.S;
       if(fnd(a)==fnd(b))continue;
       cost+=edges[i].F;
       unite(a,b);
   }
   cout<<cost<<endl;

}


Measured memory_bytes: 14404
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  vector<vector<int>> a(3, vector<int>(3, 0));
  vector<vector<bool>> b(3, vector<bool>(3, false));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (a[j][k] == x) b[j][k] = true;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    bool temp = true;
    for (int j = 0; j < 3; j++) {
      if (b[i][j] == false) temp = false;
    }
    if (temp == true) ans++;
    temp = true;
    for (int j = 0; j < 3; j++) {
      if (b[j][i] == false) temp = false;
    }
    if (temp == true) ans++;
  }
  if (b[0][0] && b[1][1] && b[2][2]) ans++;
  if (b[0][2] && b[1][1] && b[2][0]) ans++;
  cout << (ans > 0 ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
long long M = 1e9+7;
long long power(long long a, long long p)
    {
        if(p==0) return 1;
        long long ans= power(a,p/2);
        ans =(ans * ans) % M;
        if(p%2) ans = (ans*a) % M;
        return ans;
    }

    bool isPrime(long long n)
    {
        if (n <= 1)
            return false;
        for (long long i = 2; i < n; i++)
            if (n % i == 0)
                return false;
        return true;
    }
    long long SieveOfEratosthenes(long long n, long long a)
    {
        bool prime[n+1];
        memset(prime, true, sizeof(prime));
        for (long long p=2; p*p<=n; p++)
        {
            if (prime[p] == true)
            {
                for (long long i=p*p; i<=n; i += p)
                    prime[i] = false;
            }
        }
        for (long long p=2; p<=n; p++)
           if (prime[p])
           {
               if(a%p==0)
               {
                   return (a-p);
               }
           }
    }
    long long nCr(int n, int r)
    {
        if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
        long long ans = 1;
        int i;
        for(i = 1; i <= r; i++) {
            ans *= n - r + i;
            ans /= i;
        }
        return ans;
    }
int main()
{
    IOS;
    long long a,b,c,d,e,h,n,t,f,m,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100001]={0},sum=0,sum1=0,ma=0,ma1=0,mi=1000000000000000001;
    long long g,co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0,sum3=0,mu=1,mu1=1;
    long long a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,b6;
    double pi=2 * acos (0.0);
    string str,str1,str2,str3,str4,str5,str6;
    char ch,ch1;
    //vector<long long>v; //vector<long long> v(n+1);
    //vector<long long>v1;
    // vector<string>vs;
    // vector<string>vs1;
    vector<char>vc;
    //map<long long,long long>mp;
    map<char,int>mp1;
    //set<long long>s;
    set<long long>s1;
    queue<long long> q;
    //stack<long long> stk;
    //vector< pair<long long,long long> >v3;
    //map<long long,long long>::iterator it;
    //map<string,string>::iterator it;
    // vector<pair<char, pair<int,int> > > v3;
    //vector< pair<char,int > > v1;
    int x[]={1,1,1,0,0,-1,-1,-1};
    int y[]={0,1,-1,1,-1,1,-1,0};
    cin>>n;
    if(n%2==0) cout<<n<<endl;
    else cout<<n*2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#ifdef STOPIT
#define debug(...) 0
#else
#define debug(...)\
do {\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;\
} while (false)
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k; std::cin >> n >> k;
  std::vector< int > a(n); std::cin >> a;
  for (auto & x : a) x--;
  int kind=0;
  std::vector< int > mul(k, 0);
  int r = 0, min = 2 *n;
  rep(l, 0, n) {
    while (r<n && kind<k) {
      if (a[r]<k) {
        kind += mul[a[r]] == 0;
        mul[a[r]]++;
      }
      r++;
    }
    if (kind < k) break;
    // debug(r-l, kind, mul, std::vector<int>(a.begin()+l,a.begin()+r));
    cmn(min, r-l);
    if (a[l]<k) {
      mul[a[l]]--;
      kind -= mul[a[l]] == 0;
    }
  }
  if(min==2*n)min=0;
  std::cout << min << std::endl;
  return 0;
}



Measured memory_bytes: 3740
//Coalbert Ramirez
//AtCoder Begginer Contest 159B - String Palindrome
#include <bits/stdc++.h>
using namespace std;
 
bool pal(string str){
	for(int i = 0, j = str.size()-1; i <= j; ++i, --j) if (str[i] != str[j]) return 0;
	return 1;
}
  
int main(){
  string s;
  cin >> s;
  int n = s.size();
  if (pal(s) && pal(s.substr(0, (n-1)/2)) && pal(s.substr((n+3)/2-1)) ){
  	cout << "Yes\n";
	} else {
		cout << "No\n";
	}
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	static const char horieyui[256] = {
		['A'] = 'T', ['T'] = 'A', ['C'] = 'G', ['G'] = 'C'
	};
	char b[4];
	if (scanf("%3s", b) != 1) return 1;
	printf("%c\n", horieyui[(unsigned char)b[0]]);
	return 0;
}


Measured memory_bytes: 128
// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    int a = 0;
    int b = 0;
    while(n>0){
        a++;
        if(n%2 == 1){
            b++;
        }
        n /= 2;
    }
    //cout << a << " " << b << endl;

    cout << max(a-1, b) << endl;
    return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <math.h>

using LL = long long;
const long mod = pow(10, 9.0) + 7;

using namespace std;
int main() {
  std::string s;
  int a;
  cin >> s;
  int len = (int)(s.length());
  LL dp[len + 1][13];
  int memo[len+1];
  memo[0] = 1;
  for (int i=0; i<=len; i++)for(int j=0; j<=12; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  for (int i=0; i<len; i++){
    memo[i+1] = memo[i] * 10 % 13;
    if (s[len-i-1] == '?'){
      for (int n=0; n<=9; n++){
        a = n * memo[i];
        for (int j=0; j<=12; j++){
          dp[i+1][(j + a) % 13] = (dp[i+1][(j + a) % 13] + dp[i][j]) % mod;
        }
      }
    }else{
      a = (s[len-i-1] - '0') * memo[i];
      for (int j=0; j<=12; j++){
        dp[i+1][(j + a) % 13] = (dp[i+1][(j + a) % 13] + dp[i][j]) % mod;
      }
    }
  }
  cout << dp[len][5] << endl;
  return 0;
}


Measured memory_bytes: 11008
#include<iostream>
#include<stdio.h>
using namespace std;
int n,c[5],l[5],i,a1,a2,a3;
int wang(int x,int y,int z)
{
	int s=0;
	if(x>=11&&x<15)
		s=1;
	if(x>=18&&x<21)
		s=2;
	if(x>=21||x<2)
		s=3;
	if(s!=0)
	{
		l[s]++;
		if((z+60-y<=8)||(z-y<=8&&z-y>0))
				 c[s]++;
	}
	return 0;
}
int main()
{
	scanf("%d",&n);
	while(n!=0)
	{
		for(i=1;i<=3;i++)
		{
			l[i]=0;
			c[i]=0;
		}
		for(i=1;i<=n;i++)
		{
			scanf("%d:%d %d",&a1,&a2,&a3);
			wang(a1,a2,a3);
		}
		printf("lunch ");
		if(l[1]==0)
		 printf("no guest\n");
		else printf("%d\n",int(c[1]*100/l[1]));
		printf("dinner ");
			if(l[2]==0)
		 printf("no guest\n");
		else printf("%d\n",int(c[2]*100/l[2]));
		printf("midnight ");
			if(l[3]==0)
		 printf("no guest\n");
		else printf("%d\n",int(c[3]*100/l[3]));
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 0
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))

A = np.array(A, dtype=int)

cs = A.cumsum()
nums = list(cs)
for i in range(1, N):
    nums.extend(cs[i:] - cs[i - 1])
nums.sort(reverse=True)
nums = np.array(nums, dtype=int)

ans = 0
d = int(nums[K - 1]).bit_length() - 1
while d >= 0:
    mask = 1 << d
    idx = (nums & mask).nonzero()[0]
    if len(idx) >= K:
        nums = nums[idx]
        ans += mask
    d -= 1
print(ans)


Measured memory_bytes: 37548
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1000000007
#define intt int64_t

int main() {
    int h[2], k[2], a, b, c, d;
    cin >> h[0] >> h[1] >> k[0] >> k[1] >> a >> b >> c >> d;
    int hiro=h[0]*a+h[0]/10*c+h[1]*b+h[1]/20*d,
        kenjiro=k[0]*a+k[0]/10*c+k[1]*b+k[1]/20*d;
    if(hiro > kenjiro) printf("hiroshi\n");
    else if(hiro < kenjiro) printf("kenjiro\n");
    else printf("even\n");
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main() {
    int K;
    cin>>K;
    int ans=0;
    rrep(i,K){
        rrep(j,K){
            rrep(l,K){
                int a=__gcd(i,j);
                ans+=__gcd(a,l);
            }
        }
    }
  cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define tmp(x) std::cout<<"& "<<(x)<<" &\n"
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
typedef long long ll;

using namespace std;
const int maxn=2e5+100;
int n,t;
int a[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
 	string s;
 	cin>>s;
 	int l=s.size();
 	int aa=0;
 	rep(i,0,l-1)aa+=s[i]-'0';
 	if(aa%9==0)cout<<"Yes";
 	else cout<<"No";
	


    return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main(void) {
  int n,k;
  cin >> n >> k;

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

  int res=numeric_limits<int>::max();
  for (int i = k-1; i < n; i++) {
    if(x[i-k+1]<=0 && 0<=x[i]){
      res = min(res, min(2*x[i]-x[i-k+1], x[i]-2*x[i-k+1]));
    } else if(x[i] > 0) {
      res = min(res, x[i]);
    } else {
      res = min(res, -x[i-k+1]);
    }
  }

  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 640
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var ans = (int)Pow(2, (int)Log(N, 2));
            WriteLine(ans);
        }

        /*public long C(long n, long r)
        {
            if (r == 0 || r == n) return 1L;
            if (n < r) return 0L;
            long[,] Pascal = new long[n + 1, n + 1];
            Pascal[0, 0] = 1;
            for (long i = 1; i <= n; i++)
            {
                Pascal[i, 0] = 1;
                Pascal[i, i] = 1;
                for (long j = 1; j < n; j++)
                {
                    Pascal[i, j] = Pascal[i - 1, j] + Pascal[i - 1, j - 1];
                }
            }
            return Pascal[n, r];
        }*/

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13268
#include  "bits/stdc++.h"
//#include  <iostream>
 using namespace std;
 
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define mem(a,v)    memset((a), (v), sizeof (a))
#define FOR(i,a,n)  for(int i = (a); i<(n); ++i) 
#define FORE(i,a,n) for(int i = (a); i<=(n); ++i)
#define mp(a , b)   make_pair(a , b)
#define pb(a)       push_back(a)

#define anal         '\n'

#define M 1000000007 
typedef long long ll;


int main(){
     
    IOS;
    
  //  freopen("input.in", "r", stdin);
   // freopen("output.in", "w", stdout);
    
    int n;
    cin>>n;

    int a[n+1];
     mem(a , 0);
    
    FOR(i, 0, n -1){
    	int x;
    	cin>>x;
    	a[x]++;
    } 
   FORE(i, 1, n){
    	cout<<a[i]<<anal;
    } 
     
   
    


 

  return  0 ;
   	    
}

Measured memory_bytes: 4384
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 1000000000000000
#define mod 1000000007
#define ld long double
#define pll pair<ll,ll>
using namespace std;

int main()
{ 
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

fast;

int x;
cin>>x;

cout<<1-x;

}


Measured memory_bytes: 3608
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

const int MAXN = 100010;

int n, A, B;
ll a[MAXN];

bool check(ll m)
{
	ll cnt = 0;
	for (int i = 1; i <= n; ++ i)
	{
		ll x = a[i]-m*B;
		if (x <= 0) continue;
		cnt += (x-1)/(A-B)+1;
	}
	return cnt <= m;
}

int main()
{
	
	scanf("%d%d%d", &n, &A, &B);
	for (int i = 1; i <= n; ++ i)
	{
		int x;
		scanf("%d", &x);
		a[i] = x;
	}
	sort(a+1, a+n+1);
	int L = 1, R = 1000000000;
	int ans = R;
	while (L <= R)
	{
		int m = (L+R)/2;
		if (check(m))
		{
			ans = m;
			R = m-1;
		}
		else
			L = m+1;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1024
a=int(input())
b=list(map(int,input().split()))
c=[0,0,0]
ans=1
mod=1000000007
for i in b:
  d=0
  for j in c:
    if i==j:
      d+=1
  if d==0:
    print(0)
    exit()
  else:
    ans=ans*d%mod
    for j in range(3):
      if i==c[j]:
        c[j]+=1
        break
print(ans)

Measured memory_bytes: 53228
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
#define MAX 2100000
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}

int modpow(int a,int n,int m=mod)
{
	int ans=1;
	while(n)
	{
		if(n%2)
			ans=((long long)ans*a)%m;
		a=((long long)a*a)%m;
		n/=2;
	}
	return ans;
}

int inv(int a,int m=mod)
{
	return modpow(a,m-2,m);
}

int fact[MAX+1],ifact[MAX+1];
void ini_fact()
{
	fact[0]=ifact[0]=1;
	for(int i=1;i<=MAX;i++)
	{
		fact[i]=((long long)fact[i-1]*i)%mod;
		ifact[i]=inv(fact[i]);
	}
}

int c(int n,int r)
{
	// cerr<<n<<','<<r<<endl;
	if(r>n)
		return 0;
	if(n==r)
		return 1;
	return ((((long long)fact[n]*ifact[r])%mod)*(long long)ifact[n-r])%mod;
}


signed main()
{
	fio
	ini_fact();
	inp(k)
	string s;
	cin>>s;
	int n=s.size();
	int ans=0;
	for(int x=0;x<=k;x++)
	{
		int tans=(modpow(25,x)*c(x+n-1,n-1))%mod;
		// cerr<<c(x+n-1,n-1)<<endl;
		tans=(tans*modpow(26,k-x))%mod;
		ans=(ans+tans)%mod;
	}
	cout<<ans<<'\n';
	printclock;
}

Measured memory_bytes: 37068
#include <bits/stdc++.h>
using namespace std;

#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const int MAXN = 1e5+13;
const ll LINF = LLONG_MAX;
ll powmod (ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}

int main() {
	faster;

	int n, m, sum = 0, x;

	cin >> n >> m;
	for(int i = 0; i < m; ++i){
		cin >> x;
		sum += x;
	}

	if(sum > n)
		cout << -1;
	else
		cout << n-sum;

	return 0;
}

// READ
// THINK
// CODE
// DEBUG
// AC


Measured memory_bytes: 3640
#include<bits/stdc++.h>

using namespace std;
#define forn(i,n) for(i=0;i<n;i++)
#define forn1(i,a,n) for(i=a;i<n;i++)
#define ll long

int32_t main(void)
{
	int i,n,j,x,k;
	cin>>n>>k;
	vector<ll>dp(k+1,0);
	vector<ll>dp1(k+1,0);
	vector<int>w(n);
	vector<int>p(n);
	forn(i,n)
	{
		cin>>w[i]>>p[i];
	}
	forn(i,n)
	{
		forn(j,k+1)
		{
			if(j==0)dp[j]=0;
			if(j<w[i])
			{
				dp[j]=dp1[j];
			}
			else
			{
				//cout<<dp1[j-w[i]]+p[i]<<" "<<dp1[i]<<' ';
				dp[j]=max(dp1[j-w[i]]+p[i],dp1[j]);
			}
		}
		/*forn(j,k+1)
		{
			cout<<dp[j]<<" ";
		}*/
		//cout<<endl;
		dp1=dp;
	}
	cout<<dp[k]<<endl;
	return 0;
}

Measured memory_bytes: 4780
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>

# define ll long long
# define pii pair<int,int>

using namespace std;

int main(){
    
    int N, t[105];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> t[i+1];
    }

    int K;
    cin >> K;
    for(int i=0; i<K; i++){
        int p, x;
        cin >> p >> x;
        int ans = 0;
        for(int j=1; j<=N; j++){
            if(j==p) ans+=x;
            else ans+=t[j];
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 100005

using namespace std;

vector < int > prime;
bool is_prime[N];


int main()
{
    __

    int n;
    
    cin >> n;
    
    if(n%2==0) cout << n/2 << '\n';
    
    else cout << (n/2)+1 << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int H,W,K;
string S[1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>K;
	FOR(y,H) cin>>S[y];
	int mi=1<<30;
	
	int mask;
	FOR(mask,(1<<(H-1))) {
		int to[10]={};
		int tar=0;
		FOR(i,H) {
			to[i]=tar;
			if(mask&(1<<i)) tar++;
		}
		tar++;
		int ret=__builtin_popcount(mask);
		int cnt[10]={};
		FOR(x,W) {
			FOR(y,H) {
				if(S[y][x]=='1') cnt[to[y]]++;
			}
			int ng=0;
			FOR(i,tar) if(cnt[i]>K) {
				ret++;
				FOR(y,tar) cnt[y]=0;
				FOR(y,H) if(S[y][x]=='1') cnt[to[y]]++;
				break;
			}
			FOR(i,tar) if(cnt[i]>K) ret=1LL<<30;
		}
		mi=min(mi,ret);
		
	}
	cout<<mi<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,m;
    int w[1500],h[1500];
    cin >> n >> m;
    for(int i = 0;i<n;i++)
        scanf("%d", &w[i]);
    for(int i = 0;i<m;i++)
        scanf("%d", &h[i]);
    while(n)
    {
        vector<int> x(1501*1001);
        vector<int> y(1501*1001);
        for(int i =0;i<n;i++)
        {	
        	int a = 0;
            for(int j = i;j<n;j++)
            {
                a+=w[j];
                x[a]++;
            }
        }
        for(int i =0;i<m;i++)
        {
        	int b = 0;
            for(int j = i;j<m;j++)
            {
                b+=h[j];
                y[b]++;
            }
        }

        int ave=0;
        for(int i =0;i<1500*1000;i++){
        	//if(y[i]!=0)cout << i << " " << y[i] << " / ";
            ave+=x[i]*y[i];
        }
        cout <<ave<<endl;



        cin >>n>>m;
    for(int i = 0;i<n;i++)
        scanf("%d", &w[i]);
    for(int i = 0;i<m;i++)
        scanf("%d", &h[i]);
    }
    return 0;
}




Measured memory_bytes: 14756
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadLong;
            var ans = N - 1;
            for (long i = 1; i * i <= N; i++)
            {
                if (N % i != 0)
                {
                    continue;
                }
                ans = Min(ans, N / i + i - 2);
            }

            Console.WriteLine(ans);
        }
    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13268
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner (System.in)){
			int n = sc.nextInt();
			sc.nextLine();
			String[] cards = new String[n];
			int[][] table = new int[4][13];
			for (int i=0; i < 4; i++) {
				for (int j=0; j < 13; j++) {
					table[i][j] = 0;  //初期化
				}
			}

			for (int i = 0; i<n; i++) {
				cards[i] = sc.nextLine();
				String simbol = cards[i].substring(0, 1);
				int no = Integer.parseInt(cards[i].substring(2));

				switch (simbol) {
				case "S":
					table[0][no - 1] = 1;
					break;

				case "H":
					table[1][no - 1] = 1;
					break;

				case "C":
					table[2][no - 1] = 1;
					break;

				case "D":
					table[3][no - 1] = 1;
					break;
				}
			}

			for (int i=0; i < 4; i++) {
				for (int j=0; j < 13; j++) {
					if (table[i][j] == 0) {
						switch (i) {
						case 0:
							System.out.print("S ");
							break;

						case 1:
							System.out.print("H ");
							break;

						case 2:
							System.out.print("C ");
							break;

						case 3:
							System.out.print("D ");
							break;
						}
						System.out.println(j+1);
					}
				}
			}
		}
	}
}


Measured memory_bytes: 26216
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  vector<int>vec(n);
  int ans=0;
  for(int i=0;i<n;i++) {
    int a;
    cin>>a;
    ans+=a;
    vec.at(i)=a;
  }
  int ank=0;
  sort(vec.begin(),vec.end());
  if(ans%10!=0) {
    cout<<ans<<endl;
    return 0;
  }
  else {
    for(int j=0;j<n;j++) {
      if(vec.at(j)%10!=0) {
        ank+=vec.at(j);
      }
    }
    if(ank==0) {
      cout<<"0"<<endl;
      return 0;
    }
    else {
      for(int k=0;k<n;k++) {
        if(vec.at(k)%10!=0) {
          cout<<ans-vec.at(k)<<endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

const int MAX_M = 10001, MAX_N = 501;

int dp[ 10001 ][ 501 ], m, n;
vector<PII> _box;
vector<int> p;
vector<int> s( 1, 0 );

int solve( int now, int box ) {
	if ( now >= m || box == n ) {
		return 0;
	}
	if ( dp[ now ][ box ] >= 0 ) {
		return dp[ now ][ box ];
	}
	int res = 0;
	res = max( res, solve( now, box + 1 ) );
	res = max( res, solve( min( m, now + _box[ box ].second ), box + 1 ) + s[ min( now + _box[ box ].second, m ) ] - s[ now ] - _box[ box ].first );
	return dp[ now ][ box ] = res;
}

int main() {
	scanf( "%d %d", &m, &n );
	p.resize( m );
	_box.resize( n );
	for ( int i = 0; i < m; i++ ) {
		scanf( "%d", &p[ i ] );
	}
	for ( int i = 0; i < n; i++ ) {
		scanf( "%d %d", &_box[ i ].second, &_box[ i ].first );
	}
	sort( p.rbegin(), p.rend() );
	for ( int i = 0; i < m; i++ ) {
		s.push_back( s[ i ] + p[ i ] );
	}
	NCLR( dp );
	printf( "%d\n", solve( 0, 0 ) );
	return 0;
}

Measured memory_bytes: 20944
#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
#include <algorithm>
using namespace std;
int main(void){
  string s;
  cin >> s;
  
  int n = s.length();
  int ans = 0;
  
  for(int i=0;i<n - 1;i++){
    for(int j=i + 1;j<n;j++){
      if(s[i] == s[j])
        ans++;
    }
  }
  
  if(!ans)
    cout << "yes" << endl;
  else
    cout << "no" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 1000006
#define LL long long 
#define register reg
using namespace std;

int n,m;
string s;
int a[N];

inline int qr()
{
	int x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

inline LL qrl()
{
	LL x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

int main()
{
	double a;
	cin>>a;
	if(a==0)
		cout<<1<<endl;
	else
		if(a==1)
			cout<<0<<endl; 
	return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    ll x; cin >> x;
    vector<ll> v;

    for(ll i = 0;; i++){
        ll tmp = ll(pow(i,5));
        if(tmp < 0) break;
        v.push_back(tmp);
    }

    //for(auto x:v) cout << x << endl;

    for(int i = 0; i < v.size(); i++){
        for(int j = 0; j < v.size(); j++){
            if(v[i] - v[j] == x){
                cout << i << " " << j << endl;
                return 0;
            }
            if(v[i] + v[j] == x){
                cout << i << " -" << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4296
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline ostream& operator<<(ostream& is, vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "" : " "); return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
inline void print() { cout << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }

int main() {
    init();

    int n; string s; cin >> n >> s;
    map<char, int> l, r;
    each(c, s)++r[c];
    int ans = 0;
    FOR(i, 0, n) {
        ++l[s[i]], --r[s[i]];
        int res = 0;
        FOR(j, 0, 26)if (l['a' + j] && r['a' + j])++res;
        chmax(ans, res);
    }
    print(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<int> v[1010];
int main()
{
	cin>>n;
	int k=1;
	while (1LL*k*(k-1)/2<n)
	{
		k++;
	}
	if (1LL*k*(k-1)/2!=n)
	{
		puts("No");
		return 0;
	}
	for (int i=1,cnt=1;i<k;i++)
	{
		for (int j=i+1;j<=k;j++)
		{
			v[i].push_back(cnt);
			v[j].push_back(cnt);
			cnt++;
		}
	}
	printf("Yes\n%d\n",k);
	for (int i=1;i<=k;i++)
	{
		printf("%d ",v[i].size());
		for (int j=0;j<v[i].size();j++)
		{
			printf("%d ",v[i][j]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>
using namespace std;


int main() {
	int a, b,c;
	cin >> a >> b >> c;
	bool flag=false;
	for (int i=0; i <= 100; i++) {
		if ((a * i) % b == c) {
			flag = true;
			break;
		}
	}
	if (flag) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mem(a,t) memset(a,t,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(v) ((int)sizeof(v))
#define N 100005
const int inf=2e+9;
char s[N];
int dfs(int i,int n){
    if(i==n) return 1;
    int tmp=0;
    if(s[i]=='d'){
        if(i+4<n){
            if(s[i+1]=='r'&&s[i+2]=='e'&&s[i+3]=='a'&&s[i+4]=='m'){
                tmp=dfs(i+5,n);
            }
        }
        if(i+6<n){
            if(s[i+1]=='r'&&s[i+2]=='e'&&s[i+3]=='a'&&s[i+4]=='m'&&s[i+5]=='e'&&s[i+6]=='r'){
                tmp|=dfs(i+7,n);
            }
        }
        return tmp;
    }
    else if(s[i]=='e'){
        if(i+4<n){
            if(s[i+1]=='r'&&s[i+2]=='a'&&s[i+3]=='s'&&s[i+4]=='e'){
                tmp=dfs(i+5,n);
            }
        }
        if(i+5<n){
            if(s[i+1]=='r'&&s[i+2]=='a'&&s[i+3]=='s'&&s[i+4]=='e'&&s[i+5]=='r'){
                tmp|=dfs(i+6,n);
            }
        }
        return tmp;
    }
    return 0;
}
int main()
{
    scanf("%s",s);
    int n=strlen(s);
    int ans=dfs(0,n);
    puts(ans==1?"YES":"NO");
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;

long long n;
vector<long long> p, q, v;

long long solve();

int main() {
  cin >> n;
  p.resize(n);
  q.resize(n);
  for(int i = 0; i < n; ++i) cin >> p[i];
  for(int i = 0; i < n; ++i) cin >> q[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long a, b, cnt = 0;
  for(int i = 0; i < n; ++i) v.push_back(i + 1);
  do {
    bool ch = 1;
    for(int i = 0; i < n; ++i)
      if(v[i] != p[i]) ch = 0;
    if(ch) a = cnt;
    ++cnt;
  } while(next_permutation(v.begin(), v.end()));
  sort(v.begin(), v.end());
  cnt = 0;
  do {
    bool ch = 1;
    for(int i = 0; i < n; ++i)
      if(v[i] != q[i]) ch = 0;
    if(ch) b = cnt;
    ++cnt;
  } while(next_permutation(v.begin(), v.end()));
  return abs(a - b);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a==1 && b==0 && c==0) cout<<"Close"<<endl;
	else if(a==0 && b==1 && c==0) cout<<"Close"<<endl;
	else if(a==1 && b==1 && c==0) cout<<"Open"<<endl;
	else if(a==0 && b==0 && c==1) cout<<"Open"<<endl;
	else cout<<"Close"<<endl;
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <cmath>
using namespace std;

int main(){
  int z, ans;
  while(cin >> z && z!=0){
    z = z*z*z;
    ans = 0;
    for(int x=1; x*x*x<z; x++){
      int y3 = z - x*x*x;
      int y = pow(y3, 1.0/3);
      ans = max(ans, y*y*y+x*x*x);
    }
    cout << z - ans << endl;
  };
  return 0;
}

Measured memory_bytes: 1220
# -*- coding: utf-8 -*-
from collections import deque
def inpl(): return map(int, input().split())
N = int(input())

G = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b, c = inpl()
    G[a].append([b, c])
    G[b].append([a, c])

Q, K = inpl()

def BFS(G, K):
    DQ = deque([K])
    D = [-1] * (N+1)
    D[K] = 0
    while DQ:
        p = DQ.popleft()
        for q, c in G[p]:
            if D[q] != -1:
                continue
            D[q] = D[p] + c
            DQ.append(q)
    return D

D = BFS(G, K)
for _ in range(Q):
    x, y = inpl()
    print(D[x] + D[y])

Measured memory_bytes: 51756
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long h = Long.parseLong(sc.next());
        long w = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        long result = solve(h, w);

        // 出力
        System.out.println(result);
    }

    private static long solve(long h, long w) {
        if (h % 3 == 0 || w % 3 == 0) {
            return 0;
        }

        long diff = Math.min(h, w);
        PriorityQueue<Long> pq = new PriorityQueue<>();
        // 最初に縦に切る
        for (long i = 1; i <= w / 2; i++) {
            long left = h * i;
            long up = (w - i) * (h / 2);
            long down = (w - i) * (h - h / 2);
            pq.add(left);
            pq.add(up);
            pq.add(down);
            long min = pq.poll();
            pq.poll();
            long max = pq.poll();
            diff = Math.min(diff, max - min);
        }
        // 最初に横に切る
        for (long i = 1; i <= h / 2; i++) {
            long up = w * i;
            long left = (h - i) * (w / 2);
            long right = (h - i) * (w - w / 2);
            pq.add(up);
            pq.add(left);
            pq.add(right);
            long min = pq.poll();
            pq.poll();
            long max = pq.poll();
            diff = Math.min(diff, max - min);
        }

        return diff;
    }
}


Measured memory_bytes: 43264
#################### library ####################


#################### naive ####################


#################### process ####################

function read_input()
	s = chomp(readline())
	t = chomp(readline())
	return (s, t)
end

function make_next_pos(v, L)
	w = zeros(Int, L)
	p = 1
	for q in v
		for k in p:q-1
			w[k] = q
		end
		p = q
	end
	q = v[1]
	for k in p:L
		w[k] = q
	end
	return w
end

function f()
	s, t = read_input()
	for c in t
		if search(s, c) == 0
			return -1
		end
	end
	
	L = length(s)
	dic::Dict{Char,Array{Int}} = Dict()
	for k in 1:length(s)
		if haskey(dic, s[k])
			push!(dic[s[k]], k)
		else
			dic[s[k]] = [k]
		end
	end
	
	table::Dict{Char,Array{Int}} = Dict()
	for (c, v) in dic
		table[c] = make_next_pos(v, L)
	end
	
	p = L
	i = -1
	for c in t
		q = table[c][p]
		i += (q-p-1+L)%L+1
		p = q
	end
	return i+1
end


#################### main ####################

println(f())


Measured memory_bytes: 156432