akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int, int>;

int main() {

    int A, B;
    cin >> A >> B;

    int ans = 0;
    int outlet = 1;

    while (outlet < B)
    {
        outlet -= 1;
        outlet += A;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif

int main(void)
{
	ll n, m; cin >> n >> m;
	
	ll k;
	ll like;
	vector<ll> food(m);
	rep(i, 0, n)
	{
		cin >> k;
		rep(j, 0, k)
		{
			cin >> like;
			food[like-1]++;
		}
	}

	ll ans = 0;
	each(e, food)
	{
		if (e == n)
			ans++;
	}

	cout << ans;
	return 0;
}



Measured memory_bytes: 256
// AtCoder :: Beginner Contest 177 ::
//

#include <bits/stdc++.h>

using namespace std;

void dfs(int node, int compId, const vector<vector<int>> &adj, vector<int> &ids, vector<int> &count) {
    ids[node] = compId;
    count[compId]++;
    for (int neighbor : adj[node]) {
        if (ids[neighbor] == 0) {
            dfs(neighbor, compId, adj, ids, count);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int nodeCount, edgeCount;
    cin >> nodeCount >> edgeCount;
    vector<vector<int>> adj(nodeCount+1, vector<int>());
    for (int i{0}; i < edgeCount; ++i) {
        int a, b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector<int> ids(nodeCount+1, 0);
    vector<int> count(nodeCount+1, 0);
    int soln{0};
    for (int start{1}; start <= nodeCount; ++start) {
        if (ids[start] == 0) {
            dfs(start, start, adj, ids, count);
        }
        soln = max(soln, count[start]);
    }
    cout << soln << "\n";
    return EXIT_SUCCESS;
}


Measured memory_bytes: 28184
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;

int k;
LL a[MaxN + 5];

int main()
{
	while(scanf("%d", &k) != EOF)
	{
		for(int i = 1; i <= k; i++) scanf("%lld", &a[i]);
		LL L = 2, R = 2;
		for(int i = k; i >= 1; i--) {
			L = ((L - 1) / a[i] + 1) * a[i];
			R = (R / a[i]) * a[i] + a[i] - 1;
		}
		if(L > R) printf("-1\n");
		else printf("%lld %lld\n", L, R);
	}
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

void main(){
    int n;
    int n1;
    scanf("%d",&n);
    n1= n % 10;
if(n1==3){
    printf("bon");
}
else if((n1==0)||(n1==1)||(n1==6)||(n1==8)){
    printf("pon");
}
else{
    printf("hon");
}
}

Measured memory_bytes: 1724
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int N = 100;
int wf[N][N];
void warshall_floyd() {
	int n; cin >> n;
	rep(i, 0, n)rep(j, 0, n)wf[i][j] = INF;
	rep(i, 0, n)wf[i][i] = 0;

	int m; cin >> m;
	rep(i, 0, m) {
		int s, d, w; cin >> s >> d >> w;
		wf[s][d] = min(wf[s][d], w);
	}

	rep(k, 0, n)rep(i, 0, n)rep(j, 0, n) {
		if (wf[i][k] != INF&&wf[k][j] != INF)
			wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
	}

	rep(i, 0, n) {
		if (wf[i][i] < 0) {
			cout << "NEGATIVE CYCLE" << endl;
			return;
		}
	}

	rep(i, 0, n) {
		if (wf[i][0] == INF)cout << "INF";
		else cout << wf[i][0];
		rep(j, 1, n) {
			cout << " ";
			if (wf[i][j] == INF)cout << "INF";
			else cout << wf[i][j];
		}
		cout << endl;
	}
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	warshall_floyd();
	return 0;
}

Measured memory_bytes: 3256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>

using namespace std;

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

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main()
{
	ll N; cin >> N;
	ll ans = 0;
	while(N > 3) {
		++ans;
		N = (N / 3) + (N % 3 != 0);
	}
	cout << ans + 1 << endl;
}

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

using ll = long long;

template <typename T>
struct fenwick_tree {
  int _n;
  vector<T> data;
  T sum(int p) {
    T s = 0;
    for (; p > 0; p -= p & -p) {
      s += data[p - 1];
    }
    return s;
  }

 public:
  fenwick_tree() : _n(0) {}
  fenwick_tree(int n) : _n(n), data(n) {}

  void add(int p, T x) {
    for (p++; p <= _n; p += p & -p) {
      data[p - 1] += T(x);
    }
  }

  T sum(int l, int r) { return sum(r) - sum(l); }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  fenwick_tree<ll> fw(n);
  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;
    fw.add(i, ai);
  }
  while (q--) {
    int op;
    cin >> op;
    if (op == 0) {
      int p, x;
      cin >> p >> x;
      fw.add(p, x);
    } else {
      int l, r;
      cin >> l >> r;
      cout << fw.sum(l, r) << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 8252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mxn= 5e4+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
//#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    rishabh();
    int n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)cin>>arr[i];
    int none, four, two;
    none=two=four=0;
    for(int i=0;i<n;i++){
        if(arr[i]%4==0)four++;
        else if(arr[i]%2==0)two++;
        else none++;
    }
    if(four*2+(two/2)*2>=n-1)cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 4356
a,b,k=gets.split.map(&:to_i)
result_a = a - k > 0 ? a - k : 0
if result_a == 0
  result_b = b - (k-a)
else
  result_b = b
end
result_b = 0 if result_b < 0
puts "#{result_a} #{result_b}"

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

using namespace std;

int main() {
  string S;
  cin >> S;
  int cnt[26] = {0};
  int odd = 0;
  for(int i = 0; i < S.size(); i++) cnt[S[i]-'a']++;
  for(int i = 0; i < 26; i++) odd += cnt[i]%2;
  cout << odd/2 << endl;
}

Measured memory_bytes: 3168
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int inf = 1e9;
const int mod = 1e9+7;

int dp[101][10100];

int main() {
	int N;
	cin >> N;
	int s[N];
	for (int i = 0; i < N; i++) cin >> s[i];
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= 10000; j++) {
			if (dp[i][j] == 1) {
				dp[i+1][j] = 1;
				dp[i+1][j+s[i]] = 1;
			}
		}
	}

	for (int i = 10000; i >= 0; i--) {
		if ( (dp[N][i] == 1) && (i%10 != 0) ) {
			cout << i << endl;
			return 0;
		}
	}

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


Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <random>
#include <bitset>
#include <chrono>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

#ifndef ONLINE_JUDGE
// #include "debug.h"
#else
// #define debug(...) 42
#endif

const int M = 2e5+5;
const int MD=1e9+7;



int main() {
	fast_cin();
	int k;
	cin>>k;
	queue<ll>q;
	for(int i=1;i<10;i++){
		q.push(i);
	}
	while(k--)
	{
		ll x=q.front();
		if(k==0){
			cout<<x<<endl;
			return 0;
		}
		if(x%10!=0)
		q.push(x*10+x%10-1);
		q.push(x*10+x%10);
		if(x%10!=9)
		q.push(x*10+x%10+1);
		q.pop();
	}
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
    long N;
    scanf("%ld",&N);

    long ans=N-1;
    double D=sqrt(N);
    long d=D;
    
    int i=1;
    while(i<=D){
        long s;
        long tmp;
        if(N%i==0){
            s=N/i;
            tmp=i+s-2;
            if(ans>tmp) ans=tmp;
        }
        i++;
    }
    
    printf("%ld\n",ans);

    return 0;
}

Measured memory_bytes: 128
//Coded by tzc_wk
/*
Êý¾Ý²»Çå¿Õ£¬±¬ÁãÁ½ÐÐÀá¡£
¶à²â²»¶ÁÍê£¬±¬ÁãÁ½ÐÐÀá¡£
±ß½ç²»ÌØÅÐ£¬±¬ÁãÁ½ÐÐÀá¡£
Ì°ÐÄ²»Ö¤Ã÷£¬±¬ÁãÁ½ÐÐÀá¡£
D P Ë³Ðò´í£¬±¬ÁãÁ½ÐÐÀá¡£
´óÐ¡ÉÙµÈºÅ£¬±¬ÁãÁ½ÐÐÀá¡£
±äÁ¿²»Í³Ò»£¬±¬ÁãÁ½ÐÐÀá¡£
Ô½½ç²»ÅÐ¶Ï£¬±¬ÁãÁ½ÐÐÀá¡£
µ÷ÊÔ²»×¢ÊÍ£¬±¬ÁãÁ½ÐÐÀá¡£
Òç³ö²» l l£¬±¬ÁãÁ½ÐÐÀá¡£
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
#define int long long
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
struct node{
	int a,b;
	friend bool operator <(node a,node b){
		return a.a+a.b<b.a+b.b;
	}
} a[5005];
int dp[5005];
int n=read();
signed main(){
	fz(i,1,n)	a[i].a=read(),a[i].b=read();
	sort(a+1,a+n+1);
	fillbig(dp);
	dp[0]=0;
	fz(i,1,n){
		fd(j,i,1){
			if(dp[j-1]<=a[i].a){
				dp[j]=min(dp[j],dp[j-1]+a[i].b);
			}
		}
	}
	fd(i,n,0){
		if(dp[i]<0x3f3f3f3f3f3f3f3fll){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 384
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;


//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

ll RS(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RS(N, P / 2, M);
		return t * t % M;
	}
	return N * RS(N, P - 1, M);
}

int main() {
	int X;cin >> X;
	for(int i = 1; i <= 8;i++){
		if(X >= 2000 - i*200 && X < 2000 - (i-1)*200){
			cout << i << endl;
			return 0;
		}
	}
}	

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

using namespace std;
using ll = long long;

int n, m, Q;
int d[510][510];

int main(){
    scanf("%d %d %d", &n, &m, &Q);
    for(int i = 0; i < m; ++i){
        int l, r;
        scanf("%d %d", &l, &r);
        ++d[l][r];
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            d[i+1][j+1] += d[i][j+1]+d[i+1][j]-d[i][j];
        }
    }
    for(int i = 0; i < Q; ++i){
        int p, q;
        scanf("%d %d", &p, &q);
        printf("%d\n", d[q][q]-d[q][p-1]-d[p-1][q]+d[p-1][p-1]);
    }
    return 0;
}


Measured memory_bytes: 1920
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
// const long long INF = 1LL << 60;
const int INF = 1 << 30;

int main() {
    int N;
    string S;
    int Q;
    cin >> N >> S >> Q;
    vector<set<int>> p(26, set<int>({INF}));
    rep(i, 0, N) { p[S[i] - 'a'].insert(i); }
    rep(i, 0, Q) {
        int type;
        cin >> type;
        if(type == 1) {
            int ind;
            char c;
            cin >> ind >> c;
            ind--;
            char mae = S[ind];
            S[ind] = c;
            p[mae - 'a'].erase(ind);
            p[c - 'a'].insert(ind);

        } else {
            int l, r;
            cin >> l >> r;
            l--;
            r--;
            int res = 0;
            rep(k, 0, 26) {
                if(p[k].empty()) {
                    continue;
                }
                int lid = *p[k].lower_bound(l);
                int rid = *p[k].lower_bound(r + 1);
                if(lid < rid) {
                    res++;
                }
            }
            cout << res << endl;
        }
    }
}


Measured memory_bytes: 24196
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#define maxn 100005
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d",b-a+1);
    for(int i=b-a+2;i<=b+a-1;i++)
        printf(" %d",i);
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class BTaxRate {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    in >> N;
	    REP(x,0,N+1) {
	        if ((int)(x * 1.08) == N) {
	            out << x << "\n";
	            return;
	        }
	    }
	    out << ":(" << "\n";
	}
};


signed main() {
	BTaxRate solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

int calc(int num) {
  if (num % 100 != 0) {
    return 0;
  }
  return calc(num / 100) + 1;
}

int main()
{
    int D, N; cin >> D >> N;

    int cnt = 0;
    for (int i = 1; ; i++) {
      if (calc(i) == D) {
        cnt++;
        if (cnt == N) {
          cout << i << endl;
          return 0;
        }
      }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n, m; cin >> n >> m;
    vector<pair<int, int>> p(n);
    priority_queue<int> q;

    REP(i, n) {
        int a, b; cin >> a >> b;
        p[i] = make_pair(a, b); 
    }
    ASC(p);
    int ans = 0;
    int idx = 0;
    FOR(i, 1, m + 1) {
        for(int l = idx; l < n; l++) {
            if (p[l].first > i) break; 
            q.push(p[l].second);
            idx++;
        }
        if (!q.empty()) {
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1660
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 12");
            //16
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("8 20");
            //12
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("1 1");
            //2
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int A = wkArr[0];
        int B = wkArr[1];

        if (B % A == 0) {
            Console.WriteLine(A + B);
        }
        else {
            Console.WriteLine(B - A);
        }
    }
}


Measured memory_bytes: 11348
N,M=map(int,input().split())

X=list(map(int,input().split()))

X.sort()

dX=[]

for i in range(M-1):
    dX.append(X[i+1]-X[i])

dX.sort()

out=0

for i in range(M-N):
    out+=dX[i]

print(out)


Measured memory_bytes: 13960
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}



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

typedef long long ll;
#define mx 100005

const ll inf = 1e18;
int n,a[mx];
ll DP[mx];
ll dp(int i)
{
    if(i>=n) return inf;
    if(i==n-1) return 0;
    if(DP[i]!=-1) return DP[i];
    ll value,value2;
    value=abs(a[i+1]-a[i])+dp(i+1);
    if(i+2<=n-1) value2=abs(a[i+2]-a[i])+dp(i+2);
    else value2=inf;
    return DP[i]=min(value,value2);
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    memset(DP,-1,sizeof(DP));
    ll ans = dp(0);
    printf("%lld\n",ans);


    return 0;
}


Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <tuple>
#include <utility>
#include <algorithm>
using namespace std;

using ll = long long;
using Edge = tuple<ll, int, int>;   // (コスト, u, v)
using P = pair<ll, int>;    // (座標, id)

struct UnionFind {
    vector<int> parent;
    int set_num;

    UnionFind(int n) {
        parent.resize(n, -1);
        set_num = n;
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);

        if (x != y) {
            if (size(x) < size(y)) swap(x, y);
            parent[x] += parent[y];
            parent[y] = x;
            set_num--;
        }
    }

    bool is_same(int x, int y) {
        return find(x) == find(y);
    }

    int find(int x) {
        if (parent[x] < 0) {
            return x;
        }
        return parent[x] = find(parent[x]);
    }

    int size(int x) {
        return -parent[find(x)];
    }

    int size() {
        return set_num;
    }
};

int main() {
    int N;
    cin >> N;

    const int MAXN = 200000;
    static P xid[MAXN],
             yid[MAXN];
    
    for (int i = 0; i < N; i++) {
        cin >> xid[i].first >> yid[i].first;

        xid[i].second = yid[i].second = i;
    }
    sort(xid, xid + N);
    sort(yid, yid + N);

    vector<Edge> edges;
    for (int i = 0; i < N - 1; i++) {
        edges.emplace_back(xid[i + 1].first - xid[i].first, xid[i + 1].second, xid[i].second);
        edges.emplace_back(yid[i + 1].first - yid[i].first, yid[i + 1].second, yid[i].second);
    }
    sort(edges.begin(), edges.end());

    UnionFind uf(N);
    ll ans = 0;
    for (Edge& e : edges) {
        ll cost;
        int u, v;
        tie(cost, u, v) = e;

        if (uf.is_same(u, v)) continue;

        uf.unite(u, v);
        ans += cost;
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int n,l; cin>>n >>l;
  int ans=0;
  int eat=1000;
  for(int i=l;i<l+n;i++){
    ans+=i;
    if(abs(eat)>abs(i))eat=i;
  }
  cout<<ans-eat<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <bitset>
using namespace std;
bitset <4000010> w;
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') ch=getchar(),o=-1;
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,sum=0;
    cin>>n;
    if(n==1) return cout<<gi(),0;
    w.set(0);
    for(int i=1;i<=n;i++) {
	int x=gi();sum+=x;
	w|=w<<x,w.set(x);
    }
    for(int i=(sum+1)>>1;;i++)
	if(w[i]) return cout<<i,0;
    return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;

const int mod = 1000000007;

int dp[100 + 1][8 + 1][1 << 7];

bool ok(int b, int w) {
  rep (i, w - 1) if (((1 << i) & b) != 0 && ((1 << (i + 1)) & b) != 0) return false;
  return true;
}

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  dp[0][0][0] = 1;

  rep (h, H) rep (w, W) rep (i, (1 << (W - 1))) if (dp[h][w][i] != 0) {
    rep (j, (1 << W - 1)) if (ok(j, W - 1)) {
      if (w != 0 && (1 << (w - 1)) & j) dp[h + 1][w - 1][j] = (dp[h + 1][w - 1][j] + dp[h][w][i]) % mod;
      else if (w != W - 1 && (1 << w) & j) dp[h + 1][w + 1][j] = (dp[h + 1][w + 1][j] + dp[h][w][i]) % mod;
      else dp[h + 1][w][j] = (dp[h + 1][w][j] + dp[h][w][i]) % mod;
    }
  }

  int ans = 0;
  rep (i, (1 << (W - 1))) ans = (ans + dp[H][K - 1][i]) % mod;

  cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    int mini = 1000, maxi = 0;
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        mini = min(mini, a);
        maxi = max(maxi, a);
    }

    cout << maxi - mini << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define N 100005
#define pb push_back
int main()
{
   ll n,m,count=0,i,ac=0;
   map<ll,ll> mp,mac;
   cin>>n>>m;
   if(m==0)
      {
      	cout<<"0 0";
      }	 
      else
        {
      	   ll p[m];
      	   string s;
          for(i=0;i<m;i++)
            {
                cin>>p[i]>>s;
                if(s=="AC")
                	    {if(!mp[p[i]])
                	    	{
                	    		if(mac[p[i]])
                	    		     count+=mac[p[i]];
                	    		mp[p[i]]=1;
                	    		ac++;
                	    	}
                	    }
                else
                	mac[p[i]]++;

             }
             cout<<ac<<" "<<count;
         }
 }

Measured memory_bytes: 13568
#include<stdio.h>

int main()
{
  int A, B, C, D, E;
  int sum = 0;

  scanf("%d%d%d%d%d",&A,&B,&C,&D,&E);

  if( A < 0){
    sum = D - (A*C) + (B*E);
  }

  else{
    sum = (B-A)*E;
  }

  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2120
#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()
{
    string S1, S2;
    cin >> S1 >> S2;
    S2.pop_back();
    if (S1 == S2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3604
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n,a,b; cin >>n>>a>>b;
  if(a+b==0||a==0){
    cout<<0<<endl;
  return 0;
  }
  if(n%(a+b)<=a) cout<<(n/(a+b))*a+n%(a+b)<<endl;
  else cout<<(n/(a+b))*a+a<<endl;
}

Measured memory_bytes: 256
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

K = int(input())
S = input()

N = len(S)
if N <= K:
    print(S)
else:
    print(S[:K]+'...')




Measured memory_bytes: 9480
#include <bits/stdc++.h>
 
//BIAR MANTAB LAH YA
#define Willy using
#define Indrayana namespace
#define Komara std
 
Willy Indrayana Komara;
 
int main()
{
    int a[3];
    for (int i = 0 ; i < 3; i++)
    {
        cin >> a[i];
    }
    sort(a, a+3);
    if (((a[0] == a[1]) && (a[1] != a[2])) || ((a[0] != a[1]) && (a[1] == a[2])))
    {
        cout << "Yes" << '\n';

    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
S_A = list(input())
S_B = list(input())
S_C = list(input())
def ABC(s):
    if s == 'a':
        if len(S_A) == 0:
            print('A')
            exit()
        return ABC(S_A.pop(0))
    if s == 'b':
        if len(S_B) == 0:
            print('B')
            exit()
        return ABC(S_B.pop(0))
    if s == 'c':
        if len(S_C) == 0:
            print('C')
            exit()
        return ABC(S_C.pop(0))
ABC(S_A.pop(0))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  string S;
  cin >> S;
  if((S[0]==S[1]&&S[1]==S[2])||(S[2]==S[3]&&S[1]==S[2]))cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first

#if MYDEBUG
#define DBG(...) {string dst__=#__VA_ARGS__;dreplace(dst__);stringstream dss__; dss__<<dst__; debug(dss__,__VA_ARGS__);}
#else
#define DBG(...)
#endif
void debug(stringstream& ds){cerr<<endl;return;}
template<typename F, typename... R>void debug(stringstream& ds,const F& f, const R&... r){string n; ds>>n; cerr<< n <<'='<<f<<' '; debug(ds,r...);}
void dreplace(string &s){int l=s.length(),n=0;for(int i=0; i<l; ++i){if(s[i]=='(')++n;if(s[i]==')')--n;if(s[i]==','&&!n)s[i]=' ';}}

typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
template<typename T> using V = vector<T>;
constexpr LL LINF=334ll<<53; constexpr int INF=15<<26; constexpr LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<vector<int>> a (2002,vector<int>(2002));
    auto dp = [&](int x, int y) -> int& {return (x<0||y<0)?a[0][0]:a[x+1][y+1];};
    dp(0,0)=1;
    for(int i=0; i<=m+n; i=i+k-1){
        int l=max(0,i-m), h=min(i,m);
        for(int j=0; j<k; ++j){
            dp(l,h)+=dp(l-k+1+j,h-j);
            if(dp(l,h)>MOD)dp(l,h)-=MOD;
        }
        for(int j=max(0,i-m)+1; j<=min(i,n); ++j){
            dp(j,i-j)=dp(j-1,i-j+1)+dp(j,i-j-k+1)-dp(j-k,i-j+1);
            if(dp(j,i-j)<0)dp(j,i-j)+=MOD;
            else if(dp(j,i-j)>MOD)dp(j,i-j)-=MOD;
        }
    }
    int ans=0;
    for(int i=n; i>0; i-=k-1){
        for(int j=m; j>0; j-=k-1){
            for(int h=1; h<k; ++h){
                ans+=dp(i-h,j-k+h);
                if(ans>MOD)ans-=MOD;
            }
        }
    }
    cout << ans <<"\n";
    return 0;
}



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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int N, M;
    std::cin >> N >> M;

    std::cout << pow(2, M) * ((N - M) * 100 + M * 1900) << std::endl;

    return 0;
}


Measured memory_bytes: 256
// To the MOTHER OF DRAGONS	

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
#include <bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 3.14159265358979323846
#define all(x) x.begin(), x.end()
#define deb(x) cerr << ">> " << #x << " : " << x << "\n"
#define RAGE ios::sync_with_stdio(0); cin.tie(0);

using namespace std;

const ll inf = 1e18 + 42;

void solve()
{
	string s;
	cin >> s;
	for(auto x : s)
	{
		if(x == '7')
		{
			cout << "Yes\n";
			return;
		}
	}
	cout << "No\n";
}

int main()
{
	RAGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll t;
	//cin >> t;
	//while(t--)
		solve();
	return 0;
}

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

int id = INT_MAX;
int merge(int l, int r) {
	return min(l, r);
}

unsigned xor128() {
	static unsigned x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned t = x ^ (x << 11);
	x = y; y = z; z = w;
	return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
}

struct node {
	int val;
	int all;
	node *lch, *rch;
	int size;
	node(int v) : val(v), all(v), size(1) {
		lch = rch = nullptr;
	}
};

int count(node *t) { return t == nullptr ? 0 : t->size; }
int que(node *t) { return t == nullptr ? id : t->all; }
node *update(node *t) {
	t->size = count(t->lch) + count(t->rch) + 1;
	t->all = merge(que(t->lch), merge(t->val, que(t->rch)));
	return t;
}
node *merge(node *l, node *r) {
	if (l == nullptr || r == nullptr) return l == nullptr ? r : l;
	if (xor128() % (l->size + r->size) < l->size) {
		l->rch = merge(l->rch, r);
		return update(l);
	}
	else {
		r->lch = merge(l, r->lch);
		return update(r);
	}
}
pair<node*, node*> split(node *t, int k) {
	if (t == nullptr) return make_pair(nullptr, nullptr);
	if (k <= count(t->lch)) {
		pair<node*, node*> s = split(t->lch, k);
		t->lch = s.second;
		return make_pair(s.first, update(t));
	}
	else {
		pair<node*, node*> s = split(t->rch, k - count(t->lch) - 1);
		t->rch = s.first;
		return make_pair(update(t), s.second);
	}
}
node *insert(node *t, int k, int v) {
	pair<node*, node*> s = split(t, k);
	node *r = merge(s.first, new node(v));
	r = merge(r, s.second);
	return r;
}
node *erase(node *t, int k) {
	pair<node*, node*> s1 = split(t, k), s2 = split(s1.second, 1);
	if (s2.first != nullptr) delete s2.first;
	return merge(s1.first, s2.second);
}
node *find(node *t, int k) {
	if (t == nullptr) return t;
	int c = count(t->lch);
	return k < c ? find(t->lch, k) : k == c ? t : find(t->rch, k - (c + 1));
}
int find(node *t, int l, int r) {
	if (t == nullptr) return id;
	if (r < 0 || l >= count(t)) return id;
	if (l <= 0 && r >= count(t)) return t->all;
	int c = count(t->lch);
	return merge(t->lch == nullptr ? id : find(t->lch, l, r), merge(l <= c && c < r ? t->val : id, t->rch == nullptr ? id : find(t->rch, l - (c + 1), r - (c + 1))));
}
int cnt(node *t, int v) {
	if (t == nullptr) return 0;
	if (t->val < v) return count(t->lch) + 1 + cnt(t->rch, v);
	if (t->val == v) return count(t->lch);
	return cnt(t->lch, v);
}
node *shift(node *t, int l, int r) {
	pair<node*, node*> s1 = split(t, l), s2 = split(s1.second, r - l), s3 = split(s2.second, 1);
	return merge(s1.first, merge(s3.first, merge(s2.first, s3.second)));
}
void change(node *t, int k, int v) {
	if (t == nullptr) return;
	int c = count(t->lch);
	if (k < c) {
		change(t->lch, k, v);
		update(t);
	}
	else if (k > c) {
		change(t->rch, k - (c + 1), v);
		update(t);
	}
	else {
		t->val = v;
		update(t);
	}
}

int main()
{
	cin.sync_with_stdio(false);
	int n, q, x, y, z;
	cin >> n >> q;
	node *root = nullptr;
	for (int i = 0, a; i < n; i++) {
		cin >> a;
		root = insert(root, i, a);
	}
	while (q--) {
		cin >> x >> y >> z;
		if (x == 0) {
			root = shift(root, y, z);
		}
		else if (x == 1) {
			printf("%d\n", find(root, y, z + 1));
		}
		else {
			change(root, y, z);
		}
	}
	return 0;
}

Measured memory_bytes: 12580
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  int n,k,c=0,i,res;
  string s,t,u;
  cin >> n >> k;
  cin >> s;
  t=s.substr(0,1);
  for(i=1;i<n;i++){
    u=s.substr(i,1);
    if(u!=t) c++;
    t=u;
  }
  res=n-1-max(c-k*2,0);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1,	 -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e4 + 211;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int n;
string s, t;

main () {			
	cin >> n >> s >> t;
	forn (i, 0, n - 1)
		cout << s[i] << t[i];


}

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

int main(){
    bool can=false;

    int n; cin>>n;

    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==n) can=true;
        }
    }

    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3564
#!/usr/bin/env python3
# sys.stdin.readline()
import math
import sys
from collections import defaultdict
input = sys.stdin.readline
s= int(input())

if s % 10 ==3:
    print("bon")
elif s % 10 ==0 or s % 10 ==1 or s % 10 ==8 or s % 10 ==6:
    print("pon")
else:
    print("hon")

Measured memory_bytes: 9412
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def rle(s, tar):
    ans = []
    hoge = 0
    for i in range(len(s)):
        if s[i] != tar:
            hoge += 1
        else:
            ans.append(hoge)
            hoge = 0
    ans.append(hoge)
    return ans

def solve():
    s = list(input())
    ele = sorted(list(set(s)))
    le = len(ele)
    n = len(s)
    cost = [0]*le
    for i in range(le):
        cost[i] = max(rle(s, ele[i]))
    print(min(cost))
    return 0

if __name__ == "__main__":
    solve()



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


int main(){
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  if(S[0]==S[1]&&S[2]==S[3]&&S[0]!=S[2]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
#include<stdio.h>

#define N 8
#define FREE -1
#define NOT_FREE 1
#define true 1
#define false 0

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

int X[N][N];

void initialize(){
  int i;
  for(i=0;i<N;i++){
    row[i]=FREE;
    col[i]=FREE;
  }

  for(i=0;i<2*N-1;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }


}


void printBoard(){
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
	if(row[i]!=j)return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }

}

void recursive(int i ){
  int j;
  
  if(i==N){
    printBoard();
    return;
  }

  for(j=0;j<N;j++){
    if(NOT_FREE==col[j]||NOT_FREE==dpos[i+j]||NOT_FREE==dneg[i-j+N-1]) continue;

    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;

    recursive(i+1);

    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;

  }
}

int main(){
  int i,j;
  initialize();

  for(i=0;i<N;i++)
    for(j=0;j<N;j++)
      X[i][j]=false;

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

  for(i=0;i<k;i++){
    int r,c;
    scanf("%d%d",&r,&c);
    X[r][c]=true;
  }

  recursive(0);

  return 0;
}
    







Measured memory_bytes: 2108
#include<cstdio>
#include<cstdlib>
#include<cstring>

using namespace std;

struct Node {
    int key;
    struct Node *next, *prev;
};

Node *nil;



Node* listSearch(int key){
    Node* cur = nil->next;
    while(cur != nil && cur->key != key){
        cur = cur->next;
    }
    return cur;
}

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->prev = nil;
    nil->next = nil;
}

void printList(){
    Node* cur = nil->next;
    int isf = 1;
    while(1){
        if(cur == nil) break;
        if(isf ==0)   printf(" ");
        printf("%d" , cur->key);
        cur = cur->next;
        isf =0;
    }
    printf("\n");
}

void insert(int key){
    Node* x = (Node *)malloc(sizeof(Node));
    x->key = key;
    
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

void deleteNode(Node* t){
    if(t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(listSearch(key));
}

int main(){
    char op[20];
    int key, n, i;

    scanf("%d", &n);
    init();
    for(i = 0; i < n; i++){
        scanf("%s%d" , op , &key);
        if(op[0] == 'i'){
            insert(key);
        }else if(op[0] == 'd'){
            if(strlen(op) > 6){
                if(op[6] == 'F'){
                    deleteFirst();
                }else if(op[6] == 'L'){
                    deleteLast();
                }
            }else{
                deleteKey(key);
            }
        }
    }

    printList();

    return 0;
}



Measured memory_bytes: 33932
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(a) cerr << #a << ": " << a << endl
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define forr(i, st, en) for(int i = st; i <= en; i++)
#define all(v) (v).begin(),(v).end()
#define X first
#define Y second
#define pb push_back
#define fast cin.tie(0); ios::sync_with_stdio(false)
#define vi vector<int>
#define vii vector<vector<int>>

int32_t main(){ fast;
	string s, t; cin>>s>>t;
	int answer = 1003;
	while(sz(s) >= sz(t)){
		int cnt = 0;
		rep(i, sz(t)){
			if(s[i] != t[i]){
				cnt++;
			}
		}
		answer = min(answer, cnt);
		s.erase(0, 1);
	}
	cout<<answer<<endl;
}


Measured memory_bytes: 3592
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <deque> 

using namespace std;


int main()
{
	char b;
	
	scanf("%c", &b);
	if (b == 'A')
		printf("T\n");
	else if (b == 'T')
		printf("A\n");
	else if (b == 'C')
		printf("G\n");
	else if (b == 'G')
		printf("C\n");
	
	
	return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
N = int(input())
mG = [tuple(map(int, input().split())) for _ in range(N)]

mG.sort(key=lambda x: x[1], reverse=True)
mG.sort(key=lambda x: x[0])

# print(mG)###

vA1 = []
vL1 = []
vR1 = []
L = -1
R = 10**9 + 1

for l,r in mG[:-1]:
    L = max(L, l)
    R = min(R, r)
    vL1.append(L)
    vR1.append(R)
    vA1.append(R-L+1)

# print(vA1)###

vA2 = []
vL2 = []
vR2 = []
L = -1
R = 10**9 + 1

for l,r in mG[:0:-1]:
    L = max(L, l)
    R = min(R, r)
    vL2.append(L)
    vR2.append(R)
    vA2.append(R-L+1)

# print(vA2)###

M1 = max(a+b for a,b in zip(vA1, vA2[::-1]))

# pick max1
# and all others to 2
k = 0
idm = -1
for i,(l,r) in enumerate(mG):
    d = r-l+1
    if d > k:
        k = d
        idm = i
    
L = -1
R = 10**9 + 1

for i,(l,r) in enumerate(mG):
    if i==idm:
      continue
    L = max(L, l)
    R = min(R, r)

M2 = k + max(0, R-L+1)

print(max(M1,M2))

Measured memory_bytes: 30820
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int x,y,x1,y1; cin >> x >> y >> x1 >> y1;
    int height = y1-y;
    int width = x1-x;
    rep(i,height) cout << 'U';
    rep(i,width) cout << 'R';
    rep(i,height) cout << 'D';
    rep(i,width) cout << 'L';
    cout << 'L';
    rep(i,height+1) cout << 'U';
    rep(i,width+1) cout << 'R';
    cout << 'D';
    cout << 'R';
    rep(i,height+1) cout << 'D';
    rep(i,width+1) cout << 'L';
    cout << 'U' << endl;
    return 0;
}

Measured memory_bytes: 256
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, M, KL):
    uf = UnionFindTree(N + M)
    for i, (K, *L) in enumerate(KL):
        for l in L:
            uf.union(i, N + l - 1)
    g = uf.find(0)
    for i in range(1, N):
        if uf.find(i) != g:
            break
    else:
        print('YES')
        return
    print('NO')

class UnionFindTree:
    def __init__(self, n):
        self.parent = [-1] * n

    def find(self, x):
        p = self.parent
        while p[x] >= 0: x, p[x] = p[x], p[p[x]]
        return x

    def union(self, x, y):
        x, y, p = self.find(x), self.find(y), self.parent
        if x == y: return False
        if p[x] > p[y]: x, y = y, x
        p[x], p[y] = p[x] + p[y], x
        return True

    def same(self, x, y): return self.find(x) == self.find(y)
    def size(self, x): return -self.parent[self.find(x)]

if __name__ == '__main__':
    input = sys.stdin.readline
    N, M = map(int, input().split())
    KL = [list(map(int, input().split())) for _ in range(N)]
    main(N, M, KL)


Measured memory_bytes: 88596
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
#include<cstdio>

int v[1500001];
char s[1500001],t[500002];
void Zalgorithm(int N){
  int i=1,j=0,k=0;
  while(i<N){
    while(i+j<N&&s[i+j]==s[j])++j;
    if(!(v[i]=j)){
      ++i;
      continue;
    }
    k=1;
    while(v[k]+k<j){
      v[i+k]=v[k];
      ++k;
    }
    i+=k;
    j-=k;
  }
}
int i,j,K,que[500001],bf,ans,size;
int main(){
  int N,ng=500001,mid;
  std::fgets(t,1000000,stdin);
  std::fgets(s,1000000,stdin);
  while(ng-K>1){
    mid=(ng+K)>>1;
    (s[mid]?K:ng)=mid;
  }
  while(t[i]!='\n'){
    s[K+i]=t[i];++i;
  }
  N=i;
  i+=K;
  int M=N+(K<<1);
  while(i<M){
    s[i++]=t[j++];
    j*=j<N;
  }
  Zalgorithm(M);
  for(i=0;i<N;++i){
    if(v[i+K]<K)que[size++]=(i+K)%N;
  }
  for(i=0;i<N;++i){
    if(i==size){
      puts("-1");
      return 0;
    }
    if(v[que[i]+=K]>=K){
      que[size++]=que[i]%N;
      if(bf<=i){
        bf=size-1;
        ++ans;
      }
    }
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 9984
A, B, C, X, Y = map(int, input().split())

lst = []

lst.append(A * X + B * Y)
if X > Y:
    lst.append(A * (X-Y) + C * Y * 2)
    lst.append( C * X * 2)
else:
    lst.append(C * X * 2 + B * (Y - X))
    lst.append(C * Y * 2)
print(min(lst))


Measured memory_bytes: 9152