akhauriyash/Code-Regression huggingface dataset:
// ABC091B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
#include<vector>
using namespace std;
#include<string>
int main()
{
	int N, M;
	cin >> N;
	vector<string> blue(N+1);
	for (int i = 0; i < N; i++) {
		cin >> blue[i];
	}
	cin >> M;
	vector<string> red(M+1);
	for (int i = 0; i < M; i++) {
		cin >> red[i];
	}

	//for (int i = 0; i < N; i++) cout << blue[i] << endl;
	//for (int i = 0; i < M; i++) cout << red[i] << endl;
	
	int point[101] = {};
	for (int i = 0; i < N; i++) 
	{
		for(int j=0;j<N;j++)
		{
			if (blue[j] == blue[i]) point[i]++;
		}
		for (int j = 0; j < M; j++)
		{
			if (red[j] == blue[i]) point[i]--;
		}
	}


	//for (int i = 0; i < N; i++) cout << point[i] << endl;

	for (int i = 0; i <=N; i++) if (point[i] > point[0]) point[0] = point[i];
	cout << point[0] << endl;

	//for (int i = 0; i < N; i++) cout << point[i] << endl;
	return 0;


}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

void fnInput(int& rnTrgSu, int& rnTrgKin)
{
  cin >> rnTrgSu >> rnTrgKin;
}

int fnRcsSch(int nPos, int nTrgSu, int nTrgKin, vector<int>& rvnNumMoney)
{
  vector<int> vnMoney{10000, 5000, 1000};

  if (nTrgKin < 0)  return 0;
  if (nPos == rvnNumMoney.size())
    if (nTrgKin)
      return 0;
    else
      return 1;

  if (nPos == 2)
  {
    rvnNumMoney[nPos] = nTrgSu;
    return fnRcsSch(nPos + 1, nTrgSu - nTrgSu, nTrgKin - vnMoney[nPos] * nTrgSu, rvnNumMoney);
  }
  else
    for (int i = 0; i <= nTrgSu; i++)
    {
      rvnNumMoney[nPos] = i;
      if (fnRcsSch(nPos + 1, nTrgSu - i, nTrgKin - vnMoney[nPos] * i, rvnNumMoney))
        return 1;
    }

  return 0;
}

int fnExhSch(int nTrgSu, int nTrgKin)
{
  vector<int> vnNumMoney(3);

  if (fnRcsSch(0, nTrgSu, nTrgKin, vnNumMoney))
    cout << vnNumMoney[0] << " " << vnNumMoney[1] << " " << vnNumMoney[2] << endl;
  else
    cout << -1 << " " << -1 << " " << -1 << endl;
}

int main()
{
  int nTrgSu, nTrgKin;
  
  fnInput(nTrgSu, nTrgKin);
  fnExhSch(nTrgSu, nTrgKin);

  return 0;
}
 

Measured memory_bytes: 256
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

int main() {
    ll N, H;
    cin >> N >> H;
    struct Katana {
        ll a;
        ll b;
    };
    vector<Katana> katanas(N);
    rep(i,0,N) {
        cin >> katanas[i].a >> katanas[i].b;
    }
    ll ans = numeric_limits<ll>::max();
    sort(katanas.begin(), katanas.end(), [](Katana lhs, Katana rhs){ return lhs.b < rhs.b; });
    ll a_max = numeric_limits<ll>::min();
    rep(i,0,N) {
        a_max = max(a_max, katanas[i].a);
    }
    ll b_sum = 0;
    rep(n,0,N+1) {
        ll ans_loc = 0;
        ans_loc += n;
        ll h = H;
        h -= b_sum;
        if (h >= 0) {
            ans_loc += h / a_max + (h % a_max != 0);
        }
        ans = min(ans, ans_loc);
        b_sum += katanas[N-1-n].b;
    }
    cout << ans << endl;
}


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

int main() {
  int l, r, d, ans =0,c;
  cin >> l >> r >> d;
  c=l;
  for (int i =0;i <= r-l;i++) {
  if (c%d==0){
  ans +=1;
  }
c++;
  }
  cout << ans << endl;
  }


Measured memory_bytes: 3628
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define pb push_back

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

bool check(int x) {
	string s = "";
	while(x) {
		s += (x%10)+'0';
		x /= 10;
	}          
	for (int i = 0; i < s.size() / 2; i++) {
		if (s[i] != s[s.size() - i - 1]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int l = readInt(), r = readInt();
    int ans = 0;
    for (int i = l; i <= r; i++) {
    	ans += check(i);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,a;
    cin>>n>>a;
    cout<<n*n-a<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int figtoint(char c){
  if(c=='I')return 1;
  else if(c=='X')return 10;
  else if(c=='V')return 5;
  else if(c=='L')return 50;
  else if(c=='C')return 100;
  else if(c=='D')return 500;
  else if(c=='M')return 1000;
}
int main(){
  int i,j,len;
  int tmp=0,ans=0;
  int x;
  char c;
  char s[100];
  while(scanf("%s",s)!=EOF){
    ans=0;tmp=0;
    len=strlen(s);
    c=s[0];
    tmp=figtoint(c);
    for(i=1;i<len;i++){
     
      if(figtoint(s[i])==figtoint(c)){
	tmp+=figtoint(c);
	
      }
      else if(figtoint(c)<figtoint(s[i])){
	tmp=(figtoint(s[i])-tmp);
	c=s[i];
	
      }
      else if(figtoint(c)>figtoint(s[i])){
	c=s[i];
	ans+=tmp;
	tmp=figtoint(s[i]);
      }
    }
    ans+=tmp;
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 540
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
//#define inf 2000000000
#define inf 8000000000000000000
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
const int maxn=100005;
//i_am_noob
int a,b,c,d;

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> a >> b >> c >> d;
    print1(max(max(a*c,a*d),max(b*c,b*d)));
    return 0;
}


Measured memory_bytes: 3628
use std::io;


fn main() {
    let (a, b, t) = {
        let i = read::<usize>();
        (i[0], i[1], i[2])
    };
    println!("{}", (t / a) * b);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4476
#include<stdio.h>

int a[11]={0};
int used[11]={0};
int idx=1;

void dfs(int d,int n){
	int i;
	
	if(d==n){
		for(i=1;i<idx-1;i++){
			printf("%d ",a[i]);
		}
		printf("%d\n",a[idx-1]);
		return;
	}
	
	for(i=1;i<=n;i++){
		if(used[i]==0){
			a[idx++]=i;  used[i]=1;
			
			dfs(d+1,n);
			
			a[idx-1]=0;  idx--;  used[i]=0;
		}
	}

	return;
}

int main(){
	int n;
	
	scanf("%d",&n);
	
	dfs(0,n);
	
	return 0;
}


Measured memory_bytes: 2068
#include <iostream>
#include <set>
#include <list>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std; 

int
main(int argc, char const *argv[])
{
    uint64_t n, k;
    string s;
    cin >> n >> s >> k;

    auto c = s[k-1];

    for (uint64_t i = 0; i < n; ++i) {
	if (s[i] != c) {
	    cout << "*";
	} else {
	    cout << s[i];
	}
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
ll mod_pow(ll, ll, ll);
ll mod_fact(ll, ll);
ll mod_inv(ll, ll);
//
int main(){
    int a, b;
    cin >> a >> b;
    if(a > b) cout << "safe";
    else cout << "unsafe";
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, seisu) for(int i = 0; i < (int)(seisu); i++)
typedef long long ll;


int main(){
  ll n, min, max;
  cin >> n >> min >> max;
  ll diff = max - min;
  ll ans = 0;
  if(diff > 0 &&  n > 1){
    ll maxsum = min + max * (n-1);
    ll minsum = min * (n-1) + max;
    ans = maxsum - minsum + 1;
  }
  else if(diff == 0 && n >= 1){
    ans = 1;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

ll n,coun=0;
bool flag=false;
void solve(char a,ll k,ll c,string s){
    if (c==s.size()){
        coun++;
    }
    if (coun==n and !flag){
        cout << s << endl;
        flag=true;
    }
    if (s.size()<c){
        s+=a;
        for (ll i=k-1;i<=k+1;i++){
            if (i>=0 and i<10){
                s[s.size()-1]='0'+i;
                solve('0',i,c,s);
            }
        }
    }
}
 
int main(){
    cin >> n;
    ll x=1;
    while(true){
        for (ll i=1;i<10;i++){
            string s;
            s=i+'0';
            solve('0',i,x,s);
        }
        if (flag){
            break;
        }
        x++;
    }
    return 0;
}


Measured memory_bytes: 256
// IlyM

#include <bits/stdc++.h>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (long long a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())
#define bit(i,j) (i&(1<<j))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=2e5+5,mod=998244353;
ll n,a,b,c;
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>n;
	fo(i,1,n) fo(j,1,n) fo(k,1,n) {
		a=__gcd(i,j);
		b=__gcd(a,k);
		c+=b;
	}
	cout<<c;
	return 0;
}


Measured memory_bytes: 3652
n,m,k=map(int,input().split())
mod=10**9+7
f=[1]
for i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]
def comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod
ans=0
for i in range(1,n):
  ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))
  ans%=mod
for i in range(1,m):
  ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))
  ans%=mod
print(ans)

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

int main() {
int a,b;
cin >> a >>b;
bool ans = false;
for(int i = 1;i<=3;i++){
  if(a*b*i%2!=0)ans = true;
}
puts(ans?"Yes":"No");
}
  


Measured memory_bytes: 256
N = int(input())
v = [int(i) for i in input().split()]

v_sort = list(sorted(v))

while len(v_sort) > 1:
    A = v_sort.pop(0)
    B = v_sort.pop(0)
    new = 0.5 * (A + B)
    v_sort.append(new)
    v_sort = list(sorted(v_sort))

print(v_sort[0])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;

vector<int>t;
vector<int>lazy;
 
void push(int v,int tl,int tr) {
	int md=(tl+tr)/2;
	t[v*2] += (lazy[v])*(md-tl+1);
	lazy[v*2] += lazy[v];
	t[v*2+1] +=(tr-md)* lazy[v];
	lazy[v*2+1] += lazy[v];
  lazy[v] = 0;
}

void build(int v,int tl,int tr,vector<int>&a){
	if(tl==tr){
		t[v]=a[tl];
		return;
	}
	build(2*v,tl,(tl+tr)/2,a);
	build(2*v+1,((tl+tr)/2)+1,tr,a);
	t[v]=t[2*v]+t[2*v+1];
}
 
void update(int v, int tl, int tr, int l, int r, int addend) {
    if (l > r) 
        return;
    if (l == tl && tr == r) {
				lazy[v]+=addend;
        t[v]+=(addend*(tr-tl+1));
    } else {
        push(v,tl,tr);
        int tm = (tl + tr) / 2;
        update(v*2, tl, tm, l, min(r, tm), addend);
        update(v*2+1, tm+1, tr, max(l, tm+1), r, addend);
        t[v] = (t[v*2]+ t[v*2+1]);
    }
}
 
int query(int v, int tl, int tr, int l, int r) {
    if (l > r)
        return 0;
    if (l <= tl && tr <= r)
        return t[v];
    push(v,tl,tr);
    int tm = (tl + tr) / 2;
    return (query(v*2, tl, tm, l, min(r, tm))+
               query(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void solve(){
	int n,d,a;
	cin>>n>>d>>a;
	vector<int>compress;
	vector<pi>monsters(n);
	cin>>monsters;
	for(auto i:monsters){
		compress.pb(i.F);
	}
	sort(all(compress));
	compress.resize(unique(all(compress))-compress.begin());
	for(auto &i:monsters){
		i.F=lower_bound(all(compress),i.F)-compress.begin();
	}
	sort(all(monsters));
	lazy.resize(n*4);
	t.resize(n*4);
	int lst=compress.size();
	vector<int>aa(lst);
	for(int i=0;i<n;i++){
		aa[monsters[i].F]=max(aa[monsters[i].F],monsters[i].S);
	}
	build(1,0,lst-1,aa);
	ll ans=0;
	for(int i=0;i<n;i++){
		int x=query(1,0,lst-1,i,i);
		if(x<=0){
			continue;
		}
		int ind=upper_bound(all(compress),compress[i]+2*d)-compress.begin()-1;
		int moves=(x+a-1)/a;
		debug(i,moves,x,ind);
		ans+=moves;
		update(1,0,lst-1,i,ind,-1*moves*a);
	}
	cout<<ans;
	
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 19184
while (w = gets.to_i) >= 0
  water_rate = case
               when w <= 10 then 1150
               when w <= 20 then 1150 + 125 * (w - 10)
               when w <= 30 then 2400 + 140 * (w - 20)
               else 3800 + 160 * (w - 30)
               end
  puts 4280 - water_rate
end


Measured memory_bytes: 6844
import heapq

N, M = map(int, input().split())
L = []
for i in range(N):
    a, b = map(int, input().split())
    L.append((a, b))

heapq.heapify(L)
# heapq.heapify(sorted(L, key=lambda x: x[0]))
# print(L)
drink = 0
yen = 0
while drink < M:
    a, b = heapq.heappop(L)
    if drink + b <= M:
        yen += a * b
        drink += b
    else:
        yen += a * (M - drink)
        break
print(yen)



Measured memory_bytes: 16696
import sys
f=lambda v,b: v.append(sum(b))
while True:
    c=input()
    if c==0: break
    x=range(c)
    z=range(c+1)
    q={}
    for i in x:
        q[i]=map(int,raw_input().split())
        t=q.values()[i]
        f(t,t)
    q[i+1]=[]
    for g in x:
        w=[]
        for j in x:
            w.append(q.values()[j][g]) 
        f(q[i+1],w)
    t=q[i+1]
    f(t,t)
    for i in q.values():
        for j in z:
            sys.stdout.write("%5d"%i[j])
        print 

Measured memory_bytes: 4268
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    vector<string> S(N);
    int top[5] = {};
    for (int i = 0; i < N; i++)
    {
        cin >> S[i];
        if (S.at(i)[0] == 'M')
        {
            top[0] += 1;
        }
        if (S.at(i)[0] == 'A')
        {
            top[1] += 1;
        }
        if (S.at(i)[0] == 'R')
        {
            top[2] += 1;
        }
        if (S.at(i)[0] == 'C')
        {
            top[3] += 1;
        }
        if (S.at(i)[0] == 'H')
        {
            top[4] += 1;
        }
        
    }
/* 
    for (int i = 0; i <= 4; i++)
    {
        cout << top[i];
    }
    cout << '\n';
 */
    long long sum = 0;
    for (int i = 0; i <= 4; i++)
    {
        for (int j = i + 1; j <= 4; j++)
        {
            for (int k = j + 1; k <= 4; k++)
            {
                sum += (long long)top[i] * top[j] *top[k];
            }
            
        }
        
    }
    
    cout << sum << endl;

    return 0;

}


Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1001001001;

int dp_l[2010][2010];       // 行
int dp_c[2010][2010];       // 列
int dp[2010][2010];

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i = 0; i < H; ++i){
        cin >> S[i];
    }
    
    for(int i = 0; i < H; ++i){
        int cnt = 0;
        int left = 0, right = 0;
        for(int j = 0; j < W; ++j){
            if(S[i][j] == '.'){
                cnt++;
                right = j;
            }
            else{       // S[i][j] == '#'
                for(int k = left; k <= right; ++k){
                    dp_l[i][k] = cnt;
                }
                cnt = 0;
                left = right = j + 1;
            }
            
            if(j == W - 1 && cnt > 0){
                for(int k = left; k <= right; ++k){
                    dp_l[i][k] = cnt;
                }
            }
        }
    }
    
    for(int i = 0; i < W; ++i){
        int cnt = 0;
        int up = 0, under = 0;
        for(int j = 0; j < H; ++j){
            if(S[j][i] == '.'){
                cnt++;
                under = j;
            }
            else{       // S[j][i] == '#'
                for(int k = up; k <= under; ++k){
                    dp_c[k][i] = cnt;
                }
                cnt = 0;
                up = under = j + 1;
            }
            
            if(j == H - 1 && cnt > 0){
                for(int k = up; k <= under; ++k){
                    dp_c[k][i] = cnt;
                }
            }
        }
    }
    
    int ans = 0;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            dp[i][j] = dp_l[i][j] + dp_c[i][j] - 1;
            ans = max(ans, dp[i][j]);
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 51584
# コンビネーション
mod = 10**9+7
def cmb(n, r, mod=mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

NN = 3*10**6+6 # 使うデータによって変える
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, NN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

r1, c1, r2, c2 = map(int, input().split())

ans = 0
for c in range(c1, c2+1):
    ans += cmb(c+r2+1, r2) - cmb(c+r1, r1-1)
    ans %= mod
print(ans)

Measured memory_bytes: 172536
N = int(input())
A = []
B = []
for _ in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if N%2==1:
    print(B[int(N-1)//2]-A[int(N-1)//2]+1)
else:
    print(B[(N-1)//2]-A[(N-1)//2]+B[1+(N-1)//2]-A[1+(N-1)//2]+1)

Measured memory_bytes: 104792
#include<bits/stdc++.h>
#define ll long long
#define MOD 1
using namespace std;
ll n,x,ans,r;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int a[100005];
void print(int *a){
 for(int i=1;i<n;i++){
  a[i]=a[i-1]+a[i-2];
  a[i]=max(a[i],a[i+1]);
 }
 for(int i=1;i<=n;i++){a[i]++;return;}
 if(a[0]==a[1])cout<<"T";
}
void MaIn(){
 fill(a,a+100005,-1);
 a[0]=1;
 print(a);
 cin>>n>>x;
 if(gcd(n,x)==1)cout<<3*(n-1)<<endl;
 else{
  for(int i=1;i<=n;i++)
   ans=(((ans+x%MOD)+i*i%MOD)%MOD-1+MOD)%MOD;
  for(int j=1;j<=n;j++){
   ans+=j;
  }
  print(a);
 }
 cout<<ans<<endl;
 return;
}
ll solve(ll b,ll a){
 if(!b)return 0;
 ll ans=b*(a/b)+(a/b)*b;
 if(!(a%b))return ans-b;
 return ans+solve(a%b,b);
 r=b+a;
}
int main(){
 cin>>n>>x,ans=n+solve(min(x,n-x),max(x,n-x));
 cout<<ans+r<<endl;
 return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, k;
    cin >> n >> k;
    vl p(n);
    cin >> p;
    sort(all(p));
    ll ans = 0;
    rep(i, k) {
        ans += p[i];
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 3628
import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int c = sc.nextInt();
        int b[] = new int[m];
        int cnt = 0;
        for (int i = 0; i < m; i++)
            b[i] = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int tmp = 0;
            for (int k = 0; k < m; k++) {
                int tm = sc.nextInt();
                tmp += (tm * b[k]);
            }
            if (tmp + c > 0)
                cnt++;
        }
        System.out.println(cnt);
    }
}


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

int main()
{
	string str;
	while(cin >> str){
		if(str[0]=='0')
			break;
		int Ap=0,Bp=0;
		for(unsigned i=1;i<str.size();i++){
			if(str[i] == 'A')
				Ap++;
			else if(str[i] == 'B')
				Bp++;
		}
		if(Ap > Bp)
			Ap++;
		else
			Bp++;
		cout << Ap << " " << Bp << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<math.h>

int isPrime(int);

int main(){
  static int n,m;
  int i,j=0;
  int a[10000],b[10000];
  int jud;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  if(isPrime(a[i])){
    j++;
  }
}
    printf("%d\n",j);

  return 0;
}

int isPrime(int x){
  int i;

  if(x==2)return 1;
  if(x<2)return 0;
  if(x%2 == 0)return 0;

  i=3;
  while(i<=sqrt(x)){
    if(x%i == 0)return 0;
    i = i + 2;
  }

return 1;
}



Measured memory_bytes: 2060
import math
(n, m) = map(int, input().split())
sm = int(math.sqrt(m)) + 1
params = {}
for i in range(1, sm + 1):
    if m % i == 0 :
        params[i] = 1
        params[m // i] = 1
params = sorted(params)
mdn = m // n
maxans = 0
for i in params:
    if n > m / i:
        break
    maxans = i
print(maxans)

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        if (n % (2 * d + 1) == 0) {
            System.out.println(n / (2 * d + 1));
        } else {
            System.out.println(n / (2 * d + 1) + 1);
        }
        sc.close();
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z,k;
    string s;
    cin>>s;
    s.pb('S');
    n = s.size();
    x = 0;
    y = 0;
    for(int i=0;i<n;i++){
            if(s[i]=='R')x++;
            else y=max(y,x),x=0;
        }
        cout<<y;
            

    return 0;
}

Measured memory_bytes: 3644
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	if (N % 2) N *= 2;
	cout << N << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
		char s[5];
		scanf("%s",s);
		int i,num[4];
		for(i=0;i<4;i++)num[i]=s[i]-'0';
		int j,k;
		for(i=0;i<2;i++){
		for(j=0;j<2;j++){
		for(k=0;k<2;k++){
				int ans=0,l;int tmp[3]={i,j,k,};
				ans+=num[0];
				for(l=0;l<3;l++){
						if(tmp[l]==0){
								ans+=num[l+1];
						}
						if(tmp[l]==1){
								ans-=num[l+1];
						}
				}
				if(ans==7){
						for(l=0;l<3;l++){
								printf("%d",num[l]);
								if(tmp[l]==0)putchar('+');
								if(tmp[l]==1)putchar('-');
						}
						printf("%d=7\n",num[3]);
						return 0;
				}
		}
		}
		}
		return 0;
}


Measured memory_bytes: 128
M=10**9+7
N,K=gets.split.map(&:to_i)

def power(m, n, mod)
  return 1 if n.zero?
  n.odd? ? (power(m, n - 1, mod) * m % mod) : power(m * m % mod, n >> 1, mod);
end

ans=0
dp=Array.new(K+1){0}
K.downto(1) do |x|
  m=K/x
  dp[x]=power(m,N,M)
  (x+x).step(K,x) do |y|
    dp[x]+=M-dp[y]
    dp[x]%=M
  end
  ans+=x*dp[x]
  ans%=M
end
p ans

Measured memory_bytes: 15112
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase


"""def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)"""

"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""



def inpt():
    return [int(k) for k in input().split()]


def main():
    n=int(input())
    ar=inpt()
    xor=0
    for i in ar:
        xor^=i
    for i in ar:
        print(xor^i,end=' ')















BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()


Measured memory_bytes: 104140
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
#define rep(i, n) for (int i = 0; i < (int)n; i++)
ll inf = 1e10;

ll gcd(ll a, ll b){
  return (b != 0) ? gcd(b, a%b) : a;
}

int main(){
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans = 0;
  int maxab = (x > y) ? a : b;
  if(a+b > 2*c){
    ans += 2*c*min(x,y);
    if(maxab > 2*c) ans += 2*c*abs(x-y);
    else ans += maxab*abs(x-y);
  }
  else ans += a*x+b*y;
  cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = int(input())
list_p = [int(i) for i in input().split()]

number = 0
for i in range(1, len(list_p)-1):
    if (list_p[i-1] < list_p[i] and list_p[i] < list_p[i+1]) or (list_p[i-1] > list_p[i] and list_p[i] > list_p[i+1]):
        number += 1

print(number)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
	int t,n,i;
	int x[4];
	for(i=0;i<4;i++){
		scanf("%d %d",&t,&n);
		if(t==1){
			x[i]=6000*n;
		}else if(t==2){
			x[i]=4000*n;
		}else if(t==3){
			x[i]=3000*n;
		}else if(t==4){
			x[i]=2000*n;
		}
	}
	printf("%d\n%d\n%d\n%d\n",x[0],x[1],x[2],x[3]);
	return 0;
}

Measured memory_bytes: 600
def main():
    n,k=map(int,input().split(' '))
    a=sorted(list(map(int,input().split(' '))),reverse=True)
    f=sorted(list(map(int,input().split(' '))))
    lb=0
    ub = 0
    for i,j in zip(a,f):
        ub = max(ub,i*j)
    def C(x):
        k_tmp = k
        for i,j in zip(a,f):
            k_tmp -= max(0,i-x//j)
            if k_tmp < 0:
                return False
        return True

    while ub-lb>1:
        mid = (lb+ub)/2
        if C(mid):
            ub = mid
        else:
            lb = mid
    if C(lb):
        print(int(lb))
    else:
        print(int(ub))


if __name__ == '__main__':
    main()


Measured memory_bytes: 118876
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
        int a[4];

    cin>>a[0]>>a[1]>>a[2]>>a[3];
    bool b[4]={};

    for(int i=0;i<4;i++){
        switch(a[i]){
            case 1:
            b[0]=true;
            break;
            case 9:
            b[1]=true;
            break;
            case 7:
            b[2]=true;
            break;
            case 4:
            b[3]=true;
            break;
        }
    }
    for(int i=0;i<4;i++){
        if(b[i]==false){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    

    return 0;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int n; cin>>n;
  set<int> s;
  while (n--) {
    int x; cin>>x; 
    if (s.count(x)) out("NO");
    s.insert(x);
  }

  out("YES");
  

  return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template<class T>
ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    for (auto x : a) out << x << " ";
    return out << "}";
}

template<class T>
ostream & operator << (ostream &out, pair<T, T> &a) {
    out << "{";
    cout << a.first << ", " << a.second;
    return out << "}";
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
#endif

    cout << setprecision(12) << fixed;

    smain();
}


const int N = 1e5 + 9;
vi st[N];

void smain() {
    int n;
    cin >> n;
    int s = -1;
    for (int i = 1; ; ++i) {
        int cur = i * (i - 1) / 2;
        if (cur == n) {
            s = i;
            break;
        }
        if (cur > n) break;
    }

    if (s == -1) {
        cout << "No";
        return;
    }
    int cnt = 1;
    for (int i = 0; i < s; ++i) {
        for (int j = 0; j < i; ++j) {
            st[i].push_back(cnt);
            st[j].push_back(cnt);
            ++cnt;
        }
    }

    assert(cnt - 1 == n);

    cout << "Yes\n";

    cout << s << "\n";

    fori (i, s) {
        cout << st[i].size() << " ";
        for (auto x : st[i]) cout << x << " ";
        cout << "\n";
    }
}


















Measured memory_bytes: 5504
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int A,B;
  cin>> A >> B ;
  if(A<=8&&B<=8)
  cout<<"Yay!"<<endl;
  else{
    cout<<":("<<endl;
  }
}
    

   
  
   
 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>

using namespace std;

int debug = 0;

int main(void){
	int n,start,goal,d;
	
	while(1){
		bool clear = false;
		
		cin >> n;
		if(n==0) break;
		cin >> start;
		cin >> goal;
		cin >> d;
		
		bool way[d+1][n+1]; //way[i][j] := i-th(1origin) horizontal line's j-th(1origin) vertical line
		
		cin.ignore(); //for CR+LF
		
		memset(way,false,sizeof(way));
		for(int i=1;i<=d;i++){
			string str;
			char tmp;
			int j=1;
			getline(cin,str);
			istringstream iss(str);
			
			while(iss >> tmp){
				if(tmp == '1'){
					way[i][j] = true;
				}else{
					way[i][j] = false;
				}
				j++;
			}
		}
		
		if(debug){
			for(int i=1;i<=d;i++){
				for(int j=1;j<=n-1;j++){
					cout << way[i][j];
				}
				cout << endl;
			}
		}
		
		int place = start;
		for(int k=1;k<=d;k++){
			if(way[k][place-1] == true){
				place--;
			}else if(way[k][place] == true){
				place++;
			}
		}
		if(place == goal){
			cout << 0 <<endl;
			continue;
		}
		
		for(int i=1;i<=d && !clear;i++){
			for(int j=1;j<=n-1 && !clear;j++){
				bool isok = false;
				bool iscand = false;
				if(way[i][j] == false){
					if(j==1){
						if(way[i][j+1] == false){
							iscand = true;
						}
					}else if(j == n-1){
						if(way[i][j-1] == false){
							iscand = true;
						}
					}else{
						if(way[i][j-1] == false && way[i][j+1] == false){
							iscand = true;
						}
					}
					if(iscand){ //try
						if(debug) cout << "trying " << i << " " << j << endl;
						int place = start;
						way[i][j] = true;
						for(int k=1;k<=d;k++){
							if(way[k][place-1] == true){
								place--;
							}else if(way[k][place] == true){
								place++;
							}
							if(debug) cout <<  k <<":place " << place << endl;
						}
						if(place == goal){
							cout << i << " " << j << endl;
							clear = true;
						}
						way[i][j] = false;
					}
				}
			}
		}
		if(!clear){
			cout << 1 << endl;
		}
	}
}

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

int main(void) {

    int n, k, s;
    while (cin >> n >> k >> s, n&&k&&s) {
        int ans = 0;
        for (unsigned int bit = 0; bit < (1<<n); ++bit) {
            if (__builtin_popcount(bit) != k) continue;

            int sum = 0;
            for (int i = 0; i < n; i++) {
                if (1<<i & bit) {
                    sum += (i+1);
                }
            }
            if (sum == s) ans++;
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3068
#include <stdio.h>
#define NIL -1
#define max 42+4
#define ONE 1
int arr[max];
int cal(int);

int main(){
    int n;
    int i;
    scanf("%d",&n);
    
	for(i=0;i<46;i++)
	arr[i]=NIL;
   
	printf("%d\n",cal(n));
    return 0;
}
int cal(int n)
{
    if(n==0||n==ONE)return arr[n]=ONE;
    if(arr[n]!=NIL)
	return arr[n];
    return arr[n]=cal(n-1)+cal(n-2);
}


Measured memory_bytes: 2052
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
const int MAXN=5e5+10;
const double eps=1e-8;
const int MOD=1000000007;
using namespace std;
typedef  long long ll;
int h[100005];
int main()
{
    int n,flag=1;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    for(int i=n-1;i>=1;i--)
    {
        if(h[i]<h[i-1])
            h[i-1]--;
    }
    for(int i=0;i<n-1;i++)
    {
        if(h[i]>h[i+1])
        {
            flag=0;
            break;
        }
    }
    if(flag)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
	string s;
	cin >> s;

	int count = 0;

	REP(i, 3) if (s[i] == '1') count++;

	cout << count << endl;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    int ans = 1;
    for (int i = 0; i < n; i++) {
        ans = min(ans * 2, ans + k);
    }
    cout << ans << endl;
}


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

int main(){
    char n[200001];
    int ans=0,i=0;
    cin >>n;
    while(n[i]!='\0'){
        ans+=n[i]-48;
        i++;
    }
    if(ans%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO                     \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
typedef long long ll;
/**
 * Uncomment the #define below if problem contains multiple test cases
 */
// #define MULTIPLE_TESTS 1
 
vector<vector<ll>> cache;
ll knapsack(int cur, int used, int W, const vector<ll>& wt,
            const vector<ll>& val) {
  if (cur == wt.size()) {
    return 0;
  }
  if (cache[cur][used] != -1) {
    return cache[cur][used];
  }
  // don't consider this item
  ll option1 = knapsack(cur + 1, used, W, wt, val);
  // consider this item
  ll option2 = 0;
  if (used + wt[cur] <= W) {
    option2 = knapsack(cur + 1, used + wt[cur], W, wt, val) + val[cur];
  }
  return cache[cur][used] = max(option1, option2);
}
void solve() {
  int n, w;
  cin >> n >> w;
  vector<ll> wt(n), val(n);
  for (int i = 0; i < n; ++i) {
    cin >> wt[i] >> val[i];
  }
  cache.assign(n, vector<ll>(w+1, -1));
  cout << knapsack(0, 0, w, wt, val) << endl;
}
 
int main() {
  FAST_IO;
  int t = 1;
#ifdef MULTIPLE_TESTS
  cin >> t;
#endif
 
  while (t--) {
    solve();
  }
 
  return 0;
}


Measured memory_bytes: 79488
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define N (200000+1000)
using namespace std;

struct Edge{int to,next;}edge[N<<1];
int n,m,u,v,K[N],size[N],sum,cir_num;
int Depth[N],Father[N],stx,sty;
int head[N],num_edge,Q[N],tot;

void add(int u,int v)
{
	edge[++num_edge].to=v;
	edge[num_edge].next=head[u];
	head[u]=num_edge;
}

void Dfs(int x,int fa)
{
	Depth[x]=Depth[fa]+1;
	Father[x]=fa;
	size[x]=(Depth[x]%2==1)?1:-1;
	for (int i=head[x]; i; i=edge[i].next)
		if (edge[i].to!=fa)
		{
			if (Depth[edge[i].to])
			{
				if (cir_num) continue;
				stx=x; sty=edge[i].to;
				cir_num=Depth[x]-Depth[edge[i].to]+1;
				continue;
			}
			Dfs(edge[i].to,x);
			size[x]+=size[edge[i].to];
		}
}

int LCA(int x,int y)
{
	while (Depth[x]>Depth[y]) x=Father[x];
	while (Depth[y]>Depth[x]) y=Father[y];
	while (x!=y) x=Father[x], y=Father[y];
	return x;
}

int main()
{
//	freopen("data.in","r",stdin);
//	freopen("datam.out","w",stdout);
	scanf("%d%d",&n,&m);
	for (int i=1; i<=m; ++i)
	{
		scanf("%d%d",&u,&v);
		add(u,v); add(v,u);
	}
	Dfs(1,0);

	if (m==n-1)//tree
	{
		if (size[1]!=0) printf("-1");
		else
		{
			long long ans=0;
			for (int i=1; i<=n; ++i) ans+=abs(size[i]);
			printf("%lld",ans);	
		}
	}
	else if (cir_num%2==1)//odd
	{
		if (abs(size[1])%2==1) printf("-1");
		else
		{
			int sz=size[1];
			long long ans=abs(sz)/2;
			for (int u=stx; u; u=Father[u]) size[u]-=sz/2;
			for (int u=sty; u; u=Father[u]) size[u]-=sz/2;
			for (int i=1; i<=n; ++i) ans+=abs(size[i]);
			printf("%lld",ans);	
		}
	}
	else//even
	{
		if (size[1]!=0) printf("-1");
		else
		{
			int lca=LCA(stx,sty);
			for (int u=stx; u!=lca; u=Father[u])
				Q[++tot]=size[u],Depth[u]=0;
			for (int u=sty; u!=lca; u=Father[u])
				Q[++tot]=-size[u],Depth[u]=0;
			Q[++tot]=0; 
			sort(Q+1,Q+tot+1);
			int sz=Q[tot/2];
			
			long long ans=0;
			for (int i=1; i<=n; ++i) if (Depth[i]) ans+=abs(size[i]);
			for (int i=1; i<=tot; ++i) ans+=abs(Q[i]-sz);
			printf("%lld",ans);
		}
	}
}

Measured memory_bytes: 10368