akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n,m;
    cin >> n >> m;
    vector<pair<ll, ll>> a(n);
    vector<pair<ll, ll>> b(m);
    rep(i,n){
        cin >> a[i].first >> a[i].second;
    }
    rep(i,m){
        cin >> b[i].first >> b[i].second;
    }
    vector<ll> dist(n,1000000001);
    vector<ll> ans(n);
    rep(i,n){
        rep(j,m){
            if(abs(a[i].first-b[j].first)+abs(a[i].second-b[j].second) < dist[i]){
                dist[i] = abs(a[i].first-b[j].first)+abs(a[i].second-b[j].second);
                ans[i] = j+1; 
            }
        }
    }
    rep(i,n){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
	int N, x;
	cin >> N >> x;

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

	sort(a.begin(), a.end());

	int cnt = 0;
	for(int i=0; i<N; i++){
		if(x-a[i] >= 0){
			x -= a[i];
			cnt++;
		}
	}

	if(cnt==N && x > 0)
		cnt--;

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
t = 100 * (N - M) + 1900 * M
p = 1 / (2 ** M)
# 成功する確率はp = 1 / (2 ^ M)
# 幾何分布であり，期待値は1 / p
print(int(t / p))

Measured memory_bytes: 2940
n, m = map(int, input().split())
p = [0 for i in range(m)]
s = ["WA" for i in range(m)]
correct = [0 for i in range(n)]
penalty = [0 for i in range(n)]
for i in range(m):
    temp = input().split()
    p[i], s[i] = int(temp[0]), temp[1]
for i, j in zip(p, s):
    if j == "AC":
        correct[i-1] = True
    else:
        if not correct[i-1]:
            penalty[i-1] += 1
a = 0
b = 0
for i, j in zip(correct, penalty):
    if i:
        a += 1
        b += j
print(a, b)

Measured memory_bytes: 15012
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x<a.x;
//        return z>a.z;
    }
};

vector<int> v[155];
//bitset<4001000> b;
int a,c,i,b,k,d,n,m,e[100100];//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int l[1010];
int o[600150];
int dx[10]={0,1,0,-1},dy[10]={1,0,-1,0},dz[10]={0,0,0,0,1,-1};

long long x,y,z[200100],mod=1000000007;
P u[11];
long long j[200011];

stack<int> s;
queue<int> q;

//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int > p;
//list<int> l;
//string r[111],r2;
char r[510][555];


bool as(P a,P b)
{
   // if(a.x!=b.x)
        return a.x<b.x;
    //return a.y>b.y;
}



int main()
{
    scanf("%d %d %d",&n,&a,&b);
    if((long long)a*b<n||a+b>n+1)
    {
        puts("-1");
        return 0;
    }
    //
    if(a>1&&b>1)
    {

for(int t=1;t<=n;o[t]=t,t++);

    for(int t=0;t<(n-a)/(b-1);t++)
    {
        for(int w=t*b+1,h=t*b+b;w<=h;w++,h--)
            swap(o[w],o[h]);
    }
    for(int t=(n-a)/(b-1)*b+1,w=(n-a)/(b-1)*b+(n-a)%(b-1)+1;t<w;t++,w--)
        swap(o[t],o[w]);
    }
    else if(a==1)
        for(int t=1;t<=n;o[t]=n-t+1,t++);
    else for(int t=1;t<=n;o[t]=t,t++);
    for(int t=1;t<=n;t++)
        printf("%d ",o[t]);
}


Measured memory_bytes: 6272
#include <iostream>
#include <algorithm>
#include <string>
#include <list>
#include<vector>
#include <sstream>
#include <stdio.h>
using namespace std;

vector<vector<signed char>> VectorList(2);

int UsingNumSize;

string FirstData;
int Result;

int a;

int main(void) 
{
	cin >> a;

	int Buffer = a + (a*a) + (a*a*a);

	cout << Buffer << endl;

	return 0;
}

Measured memory_bytes: 3164
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;i++)
		cin>>v[i];
	sort(v.begin(), v.end());
	ll ans = INF;
	for(int i=1;i<=100;i++){
		ll x = 0;
		for(int j=0;j<(int)v.size();j++){
			x += (v[j]-i)*(v[j]-i); 
		}
		ans = min(ans, x);
	}
	cout<<ans;
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	int a[n],b[n];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[a[i]]=i;
	}
	for(int i=1;i<=n;i++)
	cout<<b[i]<<' ';
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef double long dl;
typedef pair < int , int > pii;
typedef pair < pii, pii > p2i;
const int maxn = (int) 2e5 + 1;
const int mod = (int) 1e9 + 7;
const ll inf = (ll)1e18;

#define fi first
#define se second
#define acel ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define next continue

int n, k;
int a[maxn];
int ans = 1;
int main(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    n -= k;
    k--;
    while(n > 0){
        if(n <= k){
            n = 0;
            ans++;
            break;
        }
        else {
            ans++;
            n -= k;
        }
    }
    cout << ans;
}


Measured memory_bytes: 640
#include <stdio.h>

int main( void ) {
	int i, n;

	scanf( "%d", &n );

	for ( i = 0; i < n; i++ ) {
		int a, b, c;

		scanf( "%d %d %d", &a, &b, &c );
		if ( a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a )
			puts( "YES" );
		else
			puts( "NO" );
	}

	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<set>
#include<ctime>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
inline void write(int a) {
	if(a>=10)write(a/10);
	putchar('0'+a%10);
}
inline void writeln(int a) {
	write(a);
	puts("");
}
inline int	read() { //不管是正负数，都可以
	int x = 0;
	char ch = getchar();
	bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
int main() {
	int a=read(),b=read(),c=read(),ans=0;
	while(!((a&1)||(b&1)||(c&1))) {
		int s1=a>>1,s2=b>>1,s3=c>>1;
		a=s2+s3;
		b=s1+s3;
		c=s1+s2;
		ans++; if(ans>10000000){
			puts("-1"); return 0;
		}
	}
	writeln(ans);
}

Measured memory_bytes: 888
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define sc3(a,b,c)  cin>>a>>b>>c
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"Yes"<<endl
#define prN         cout<<"No"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc(n);
	c=oo;
	f1(i,n){
		sc(x);
		if(x<=c)cnt++;
		mnz(c,x);
	}
	pr(cnt);
	
	
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

Measured memory_bytes: 256
/// Template by Zayed ///

/// #include <bits/stdc++.h>
#include <iostream>
#include <cstdio>

#include <string>
#include <cstring>
#include <sstream>

//#include <tuple>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
//#include<unordered_map>
#include <set>
//#include<unordered_set>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>

using namespace std;
int caseno = 1;

#define NL '\n'
#define SF scanf
#define PF printf
#define PC() printf("Case %d: ", caseno++)//NOTES:printf
//#define PC cout << "Case "//NOTES:cout
//#define CN cout << caseno++ << ": "//NOTES:cout
#define CLR(ar) memset(ar, 0, sizeof(ar))
#define SET(ar) memset(ar, -1, sizeof(ar))
#define READ() freopen("input.txt", "r", stdin)
#define WRITE() freopen("output.txt", "w", stdout)
#define BOOST std::ios_base::sync_with_stdio(0);

typedef long long LL;//NOTES:"%lld"
typedef unsigned long long ULL;//NOTES:"%llu"

#define INF (1 << 31) - 1
#define MOD 1000000007
#define PRIME 999998727899999 			// (largest prime below 10^16)
#define PB push_back
#define pii pair<int, int>
#define pic pair<int, char>
#define pci pair<char, int>
#define pLL pair<LL, LL>
#define pis pair<int, string>
#define psi pair<string, int>
#define pss pair<string, string>
//#define tiii tuple<int, int, int>
#define PI 2 * acos(0.0)
#define EPS 1e-11


// Numeric Functions
template < class T > inline void SWAP(T &a, T &b) { T t = a; a = b; b = t; }
inline LL POW(LL base, LL power){
	LL res = base; if (power == 0) return 1;
	for (int I = 0; I < power - 1; I++) res *= base; return res;
}


// Translator Functions
int ToInt(string s) { int r = 0; istringstream sin(s); sin >> r; return r; }//NOTES:ToInt(
double ToDouble(string s) { double r = 0; istringstream sin(s); sin >> r; return r; }//NOTES:ToDouble(
string ToString(int n) { string s; stringstream convert; convert << n; s = convert.str(); return s; }//NOTES:ToString(


/*
*******4 Direction Array*******
int dx[] = {0, 0, - 1, 1}, dy[] = {-1, 1, 0, 0};
*******8 Direction Array*******
int dx[] = {0, 0, -1, +1, -1, -1, +1, +1}, dy[] = {-1, +1, 0, 0, -1, +1, -1, +1};
********Knight Moves********
int dx[] = {-2, -2, -1, -1, +1, +1, +2, +2}, dy[] = {-1, +1, -2, +2, -2, +2, -1, +1};
*/


const int SIZE = 100 + 10;
set<int> si;


int main()
{
	BOOST
	///READ();
	///WRITE();
	int T, I, J, K, N, n, m, k, cnt = 0, len;

	cin >> N;

	for(I = 0; I < N; I++)
	{
		cin >> n;
		si.insert(n);
	}

	cout << si.size() << NL;


	return 0;
}






Measured memory_bytes: 256
/*
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
*/

#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    int n, z, w;
    scanf("%d%d%d", &n, &z, &w);
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    if (n == 1)
    {
        printf("%d\n", abs(w - a[0]));
    }
    else
    {
        printf("%d\n", max(abs(w - a.back()), abs(a[n - 2] - a[n - 1])));
    }
}


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

int main(){
    ll N, A, B; cin >> N >> A >> B;
    ll q=N/(A+B), r=N%(A+B);
    ll res;
    res=A*q+min(A,r);
    cout << res << endl;
    return 0;
}

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

int main(){
    //input
    int k;
    cin >> k;
    vector<int> r_s, c_s;
    vector< pair<int, int> > rc_s;
    int i, j, m;
    int r, c;
    for(i = 0; i < k; i++){
        cin >> r >> c;
        r_s.push_back(r);
        c_s.push_back(c);
        rc_s.push_back(make_pair(r,c));
    }

    //calc
    sort(r_s.begin(),r_s.end());
    sort(c_s.begin(),c_s.end());
    vector<int> r_d, c_d;
    vector< pair<int, int> > rc_d;
    bool saiyo;
    j = 0;
    for(i = 0; i < 8; i++){
        if(i == r_s[j]){
            j++;
        }else{
            r_d.push_back(i);
        }
    }
    j = 0;
    for(i = 0; i < 8; i++){
        if(i == c_s[j]){
            j++;
        }else{
            c_d.push_back(i);
        }
    }
    do{
        saiyo = 1;
        rc_d = rc_s;
        for(i = 0; i < 8-k; i++){
            rc_d.push_back(make_pair(r_d[i],c_d[i]));
        }
        sort(rc_d.begin(),rc_d.end());
        for(i = 0; i < 8; i++){
            for(j = i+1; j < 8; j++){
                for(m = -7; m < 8; m++){
                    if((rc_d[i].first == rc_d[j].first + m) && (rc_d[i].second == rc_d[j].second + m)){
                        saiyo = 0;
                    }
                    if((rc_d[i].first == rc_d[j].first + m) && (rc_d[i].second == rc_d[j].second - m)){
                        saiyo = 0;
                    }
                }
            }
        }
        if(saiyo){
            break;
        }
    }while(next_permutation(c_d.begin(),c_d.end()));

    //answer
    for(i = 0; i < 8; i++){
        for(j = 0; j < 8; j++){
            if(j == rc_d[i].second){
                cout << "Q";
            }else{
                cout << ".";
            }
        }
        cout << endl;
    }
    return 0;
}


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

int pw[200010],rev[200010];

inline int my_pow(int x,int y)
{
	if(y==0ll) return 1ll;
	if(y==1ll) return x;
	int res=my_pow(x,y/2ll);
	if(y%2ll==0ll) return (res*res)%MOD;
	else return (((res*res)%MOD)*x)%MOD;
}

signed main()
{
	ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	k=min(k,n-1ll);
	pw[0]=1ll;rev[0]=1ll;
	for(int i=1;i<=n;i++){
		pw[i]=pw[i-1]*i;
		pw[i]%=MOD;
		rev[i]=my_pow(pw[i],MOD-2ll);
	}
	int ans=0ll;
	for(int i=0;i<=k;i++){
		int num1=(pw[n-1]*((rev[i]*rev[n-i-1])%MOD))%MOD;
		int num2=(pw[n]*((rev[i]*rev[n-i])%MOD))%MOD;
		ans+=(num1*num2)%MOD;
		if(ans>=MOD) ans-=MOD;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.Math;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String n = fs.next();
        char[] s = n.toCharArray();

        int nn = Integer.valueOf(n.charAt(n.length()-1)-'0');

        if (nn==3) {
            System.out.println("bon");
        } else if (nn==0 || nn==1 || nn==6 || nn==8) {
            System.out.println("pon");
        } else {
            System.out.println("hon");
        }

    }




    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }

}


Measured memory_bytes: 32684
//
// Created by 吉川純平 on 2019-12-01.
//

#include <bits/stdc++.h>
using namespace std;
//using ll = long long;
//using ull = unsigned long long;
#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll n;
  cin >> n;
  vector<ll> s(n);
  rep(i,n){
    cin >> s[i];
  }
  ll q;
  cin >> q;
  vector<ll> t(q);
  rep(i,q){
    cin >> t[i];
  }
  ll ans = 0;
  rep(i,q){
    bool can = false;
    rep(j,n){
      if(s[j] == t[i]){
        can = true;
        break;
      }
    }
    if(can){
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <stdlib.h> //for exit
#include <algorithm> //for sort...etc
#include <numeric> //for accumulate
using namespace std;

int main()
{
    while(1)
    {
        int n,m,sum=-100;
        vector<int> prices;
        cin >> n >> m;
        if(n == 0 && m == 0) exit(0);
        for(int i = 0 ; i < n; i++)
        {
            int tpprice;
            cin >> tpprice;
            prices.push_back(tpprice);
        }

        for(int i = 0; i < n; i++)
        {
            for(int k = 0; k < n; k++)
            {
                if(((prices[i] + prices[k]) > sum) && (prices[i] + prices[k]) <= m && (i!=k))
                {
                    sum = prices[i] + prices[k];
                }
            }
        }

        if(sum == -100){ cout << "NONE" << endl; }
        else{ cout << sum << endl; }   
    }
}


Measured memory_bytes: 3064
package main

import (
	"fmt"
	"sort"
)

func getArray(m map[rune]int) (a []int) {
	a = make([]int, len(m))
	index := 0
	for _, v := range m {
		a[index] = v
		index++
	}
	return
}

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	sm := make(map[rune]int)
	for _, v := range s {
		sm[v]++
	}
	sa := getArray(sm)
	sort.Ints(sa)
	tm := make(map[rune]int)
	for _, v := range t {
		tm[v]++
	}
	ta := getArray(tm)
	sort.Ints(ta)
	if len(sa) != len(ta) {
		fmt.Println("No")
		return
	}
	for i := range sa {
		if sa[i] != ta[i] {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 2176
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	char S[101] = {0};
	int len = 0, i = 0, ans = 0;
	scanf("%s", S);
	len = strlen(S);
	for (i = 0; i < len/2; i++) {
		//printf("s=%c, e=%c\n", S[i], S[len-1-i]);
		if (S[i] != S[len-1-i]) {
			ans++;
		}
	}
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;
class Main{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = 0;
        if(a<=b){
            for(int i=0;i<b;i++){
                  System.out.print(a);
            }
        } else {
            for(int l=0;l<a;l++){
                    System.out.print(b);
            }
        }
    }
}

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

int main() {
  string S;
  cin >> S;
  int length = S.size();
  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  for (int i = 0; i < length; i++) {
    if (S[i]=='a') cnt1++;
    else if (S[i]=='b') cnt2++;
    else cnt3++;
  }
  if (max(cnt1, max(cnt2, cnt3)) <= min(cnt1, min(cnt2, cnt3))+1) {
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
}


Measured memory_bytes: 512
/***************************

		  ~PEACE~

***************************/

#include<bits/stdc++.h>
using namespace std;
	
	#define 	ll 					 	long long
	#define 	endl 					"\n"
	#define 	int 					long long
	#define 	fo(i,n)					for(i=0;i<n;i++)
	#define 	re(i,n)					for(i=n-1;i<=0;i--)
	#define 	pb 						push_back
    #define 	mp 						make_pair
	#define 	vi 						vector<int>
	#define 	pii 					pair<int,int>
	#define 	mii 					map<int,int>
	#define 	umii 					unordered_map<int,int>
	#define 	si 						set<int>
	#define 	usi 					unordered_set<int>
	#define 	fast 					ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int mod = pow(10,9)+7;
int inf=1e18;

int Log2(int x){
	int ans=0;
	while(x>>=1)	ans++;
	return ans;
}

void solve(){
	int n;	cin>>n;
	string s="ACL";
	int i;
	fo(i,n){
		cout<<s;
	}
}

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

	int t=1;
	// cin>>t;
	while(t--)	solve();
}

int32_t main(){
	fast
	pb_18();
	return 0;
}

Measured memory_bytes: 3652
a,b=map(int, input().split())

list2=[]
for i in range(a):
    c=list(map(int, input().split(" ")))
    del c[0]
    list2.append(c)
    
res= set(list2[0])
for i in range(1, a):
    res=res & set(list2[i])

r= len(res)
print(r)


Measured memory_bytes: 3060
s = input()
d = {}
for c in s:
  if c in d.keys():
    d[c] += 1
  else:
    d[c] = 1

k = list(d.keys())
if len(k) == 2 and (d[k[0]] == 2 and d[k[1]] == 2):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
{AT2201}
var
s1,s2:ansistring;
i:longint;
t:char;
begin
readln(s1);
s2:=s1;
for i:=1 to length(s2) div 2 do
begin
t:=s2[i];
s2[i]:=s2[length(s2)-i+1];
s2[length(s2)-i+1]:=t;
end;
for i:=1 to length(s2) do
 if (s2[i]='b') and (s1[i]<>'d') or (s2[i]='d') and (s1[i]<>'b') or (s2[i]='p') and (s1[i]<>'q') or (s2[i]='q') and (s1[i]<>'p') then
 begin
 writeln('No');
 halt;
 end;
writeln('Yes');
end.

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

typedef long long  ll;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
    cout<<"x";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s; cin>>s;
  int k; cin>>k;
  set<string> p;
  for(int i=0; i<s.size(); ++i){
    string c;
    for(int j=i; (j-i)<k&&j<s.size(); ++j){
      c+=s[j];
      p.insert(c);
    }
  }
  auto itr=p.begin();
  for(int i=0; i<k-1; ++i) ++itr;
  cout<<*itr;
  return 0;
}

Measured memory_bytes: 4816
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int main(){
    int k;
    cin>>k;
    long long ans=0;
    rep(i,k){
        rep(j,k){
            rep(l,k){
                ans+=gcd((i+1),gcd(j+1,l+1));
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
ll ans[105][100005]={{}};
ll n1;
ll fun(ll a[],ll v[],ll w,ll i)
{
	if(i>=n1||w==0)
		return 0;
	if(ans[i][w]!=-1)
		return ans[i][w];
	if(w>=a[i])
		return ans[i][w]=max(v[i]+fun(a,v,w-a[i],i+1),fun(a,v,w,i+1));
	else
		return ans[i][w]=fun(a,v,w,i+1);
}
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
    cin.sync_with_stdio(0);
    cin.tie(0); cin.exceptions(cin.failbit);
    ll n,w;
    cin>>n>>w;
    n1=n;
    memset(ans,-1,sizeof(ans));
    ll a[n],v[n];
    rep(i,0,n)
    {
    	cin>>a[i]>>v[i];
    }
    cout<<fun(a,v,w,0);
    return 0;
}


Measured memory_bytes: 82304
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = getInt(sc);
		int d = getInt(sc);
		System.out.println((int)Math.ceil((double)n / (double)(d * 2 + 1)));

	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	public static double getDouble(Scanner sc) {

		return Double.parseDouble(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 35508
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x; scanf("%d", &x); return x;	
}
const int maxn = 2e5 + 10;
const int INF = 1e9;
int n, m, k, a[maxn];
int mod = 1e9 + 7;
using namespace std;

int main() {
	n = read(), k = read();
	for (int i = 1; i <= n; ++i) a[i] = read();
	sort(a + 1, a + 1 + n);
	int l = 1, r = n - k + 1;
	while (l < r && r <= n - 1) {
		if (1ll * a[l] * a[l + 1] >= 1ll * a[r] * a[r + 1]) l += 2, r += 2;
		else break;
	}
	if (a[n] < 0 && k & 1) l = 1, r = n - k + 1;
	int ans = 1;
	for (int i = 1; i < l; ++i) ans = 1ll * ans * ((a[i] + mod) % mod) % mod;
	for (int i = r; i <= n; ++i) ans = 1ll * ans * ((a[i] + mod) % mod) % mod;
	cout << ans << endl;
	return 0;	
}


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

using namespace std;

#define ll long long
constexpr ll inf = 1ll << 62;

int main() {
    ll N, K;
    cin>>N>>K;
    vector<pair<ll, ll>> XY(N);
    for (ll n = 0; n < N; n++) cin>>XY[n].first>>XY[n].second;

    vector<ll> X, Y;
    map<ll, ll> zipX, zipY;
    for (ll n = 0; n < N; n++) {
        X.push_back(XY[n].first);
        Y.push_back(XY[n].second);
    }
    sort(begin(X), end(X));
    sort(begin(Y), end(Y));
    X.erase(unique(begin(X), end(X)), end(X));
    Y.erase(unique(begin(Y), end(Y)), end(Y));
    for (ll i = 0; i < X.size(); i++) zipX[X[i]] = i;
    for (ll i = 0; i < Y.size(); i++) zipY[Y[i]] = i;

    for (ll n = 0; n < N; n++) {
        XY[n].first = zipX[XY[n].first];
        XY[n].second = zipY[XY[n].second];
    }

    ll ans = inf;
    for (ll left = 0; left < X.size(); left++) {
        for (ll right = X.size() - 1; right >= left; right--) {
            for (ll top = 0; top < Y.size(); top++) {
                for (ll bottom = Y.size() - 1; bottom >= top; bottom--) {
                    ll count = 0;
                    for (ll n = 0; n < N; n++) {
                        if (left <= XY[n].first && XY[n].first <= right && top <= XY[n].second && XY[n].second <= bottom) count++;
                    }
                    if (count >= K) ans = min(ans, (X[right] - X[left]) * (Y[bottom] - Y[top]));
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define maxn 300003
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);
# define pb push_back
# define mp make_pair
using namespace std;

int main(){_
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    cout << s1[0] << s2[0] << s3[0];
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  rep(i,N) cin >> A[i];
  priority_queue<int> pr;
  rep(i,N)
  {
    pr.push(A[i]);
  }
  rep(i,M)
  {
    int MAXIMUM = pr.top() / 2;
    pr.pop();
    pr.push(MAXIMUM);
  }
  ll sum = 0;
  rep(i,N)
  {
    sum += pr.top();
    pr.pop();
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 4196
// Template Headers {{{
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}


int Solver::solve() {
	ll n, a, b; cin >> n >> a >> b;
	if (a > b) swap(a, b);
	if ((b - a) & 1) {
		ll method1 = 0;
		method1 += a - 1; // x: 1, y: b - a + 1
		method1++; // x: 1, y: b - a
		method1 += ((b - a) - 1) / 2;
		ll method2 = 0;
		method2 += n - b; // x: a + n - b , y: n
		method2++; // x: a + n - b + 1, y: n
		method2 += (n - (a + n - b + 1)) / 2;
		cout << min(method1, method2) << endl;
	} else {
		cout << (b - a) / 2 << endl;
	}
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solver.solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

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

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,q; cin>>n>>q;
  string s; cin>>s;
  vll sum(n+1);
  irep(i,1,n){
    sum[i]=sum[i-1];
    if(s[i-1]=='A'&&s[i]=='C') sum[i]++;
  }
  rep(_,q){
    ll l,r; cin>>l>>r;
    l--,r--;
    cout<<sum[r]-sum[l]<<endl;
  }
}

Measured memory_bytes: 1872
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	long long sum=100;
	int jsq=0;
	while(sum<n)
	{
		sum+=sum/100;
		jsq++;
		if(sum>=n)
		{
			cout<<jsq<<endl;
			return 0;
		}
	}
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
ll H[100005];

bool check(ll N) {
    H[0]--;
    REP(i, N - 1) {
        if (H[i + 1] < H[i])
            return false;
        H[i + 1] = std::max(H[i + 1] - 1, H[i]);
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> H[i];
    }
    if (check(N))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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


int main() {
	int n, m;
	cin >> n >> m;
	int l[100001], r[100001];
	int ansl, ansr;
	ansl = 1;
	ansr = n;

	for (int i = 0; i < m; i++) {
		cin >> l[i] >> r[i];
		
	}
	for (int i = 0; i < m; i++) {
		if (ansl < l[i]) ansl = l[i];
		if (ansr > r[i]) ansr = r[i];
	}
	int ans;
	ans = ansr - ansl + 1;
	if (ans >= 0) cout << ans << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader std = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        while(true){
            String data[] = std.readLine().split(" ");
            int a = Integer.parseInt(data[0]);
            int b = Integer.parseInt(data[1]);
            if(a == 0 && b == 0) break;
            
            for(int i = 0; i < a; i++){
                for(int j = 0; j < b; j++){
                    if(i == 0 || i == a-1 || j == 0 || j == b-1)
                        sb.append("#");
                    else
                        sb.append(".");
            }
                sb.append("\n");
        }
            sb.append("\n");

    }
        System.out.print(sb);
    }
}

Measured memory_bytes: 25592
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] line = reader.readLine().split(" ");
		int[] N = new int[3];
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < 3; i++) {
			for (int k = i+1; k < 3; k++) {
				if (i != k) {
					int sum = Integer.parseInt(line[i]) + Integer.parseInt(line[k]); 
					if (sum < min) {
						min = sum;
					}
				}
			}
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define pll pair<int64,int64>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
    if(c == '-') f = -1;
    c = getchar();
    }
    while(c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 998244353;

int inc(int a,int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int mul(int a,int b) {
    return 1LL * a * b % MOD;
}
void update(int &x,int y) {
    x = inc(x,y);
}
map<string,int> mm;
string operator & (const string &a,const string &b) {
    int l = a.length();
    string c(l,'0');
    for(int i = 0 ; i < l ; ++i) {
        if(a[i] == '1' && b[i] == '1') c[i] = '1';
    }
    return c;
}
int dfs(string s) {
    if(s.empty()) return 1;
    if(s.length() == 1) return s[0] == '0' ? 1 : 2;
    if(mm.count(s)) return mm[s];
    int res = 0;
    res = mul(s[0] == '1' ? 2 : 1,dfs(s.substr(1)));
    int l = s.length();
    for(int d = 1 ; d <= l ; ++d) {
        string t = s.substr(0,d);
        for(int k = d ; k <= l ; k += d) {
            if(k + d - 1 >= l) break;
            t = t & s.substr(k,d);
            update(res,mul(dfs(t),dfs(s.substr(k + d))));
        }
    }
    mm[s] = res;
    return res;
}
void Solve() {
    string s;
    cin >> s;
    out(dfs(s));enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 6784
//  @ /\/\ BESH //

#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back


using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 200001;
const ll mod = 1e9 + 7;

ld dis(ll x1, ll y1, ll x2, ll y2){
    return sqrtl((x1 - x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int main(){
    inp_out_work
    ld psum = 0;
    int n;
    cin>>n;
    ll x[n], y[n];
    fr(i,n)cin>>x[i]>>y[i];

    vector<int> per(n);

    fr(i,n)per[i] = i;

    do{
        for(int i = 1; i < n; i++){
            psum += dis(x[per[i-1]], y[per[i-1]], x[per[i]], y[per[i]]);
        }

    }while(next_permutation(per.begin(), per.end()));

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

    cout<< fixed << setprecision(8) << psum << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;


 
int main() {

	long long H;
	cin >> H;
	long long a = 0;
	
	while(H > 0){
		H = H/2;
		a++;
		
	}
	
	long long b = 0;
	for(int i = 1; i <= a; i++){
		b += pow(2, i - 1);
		
	}
	cout << b << endl;
	//for(const auto & e: A) cout << e << " ";
	
	
	
    return 0;
}





Measured memory_bytes: 256
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
const int maxn=200000;
int a[maxn+5];
int b[maxn+5];
inline int Read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int main(){
	int n;
	n=Read();
	for(int i=1;i<=n;i++){
		a[i]=Read();
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	
		for(int i=1;i<=n;i++){
			if(a[i]<=b[n/2]){
				printf("%d\n",b[n/2+1]); 
			}else{
				printf("%d\n",b[n/2]);
			}
		}
	
	return 0;
} 

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<int, vector<P>> S;
void output(int time, S s){
    printf("time %d, inv %d\n", time, s.first);
    for(auto vi : s.second) printf("(%d, %d) ", vi.first, vi.second);
    cout << endl;
}
int main(){
    int n;
    while(cin >> n && n){
        vector<P> v(n);
        for(auto& vi : v) cin >> vi.first >> vi.second;
        for(auto& vi : v) if(vi.first < vi.second) swap(vi.first, vi.second);
        int inv = 0;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                if(v[i].first > v[j].first) inv++;
                if(v[i].first > v[j].second) inv++;
                if(v[i].second > v[j].first) inv++;
                if(v[i].second > v[j].second) inv++;
            }
        }
        priority_queue<S, vector<S>, greater<S>> que;
        set<vector<P>> used;
        que.push(S(inv, v));
        used.insert(v);
        const int BEAM = 1 << 8;
        for(int iter = 0; ; iter++){
            priority_queue<S, vector<S>, greater<S>> nque;
            if(que.top().first == 0){
                cout << iter << endl;
                break;
            }
            for(int i = 0; i < BEAM && !que.empty(); i++){
                S s = que.top(); que.pop();
                int inv = s.first;
                vector<P>& v = s.second;
                for(int i = 0; i < n - 1; i++){
                    if(v[i].first > v[i + 1].second){
                        vector<P> nv = v;
                        int ninv = inv - 1;
                        swap(nv[i].first, nv[i + 1].second);
                        if(nv[i].first < nv[i].second){
                            swap(nv[i].first, nv[i].second);
                            ninv--;
                        }
                        if(nv[i + 1].first < nv[i + 1].second){
                            swap(nv[i + 1].first, nv[i + 1].second);
                            ninv--;
                        }
                        if(!used.count(nv)){
                            used.insert(nv);
                            nque.push(S(ninv, nv));
                        }
                    }
                }
            }
            que.swap(nque);
        }
    }
    return 0;
}

Measured memory_bytes: 6160
n = int(input())

csf = []

for i in range(n - 1):
    c, s, f = map(int, input().split())
    csf.append([c, s, f])

ans = []
for i in range(n - 1):
    tmp = csf[i][0] + csf[i][1]
    for j in range(i + 1, n - 1):
        if tmp < csf[j][1]:
            tmp = csf[j][0] + csf[j][1]
        elif (tmp - csf[j][1]) % csf[j][2] == 0:
            tmp += csf[j][0]
        else:
            tmp = (tmp // csf[j][2] + 1) * csf[j][2] + csf[j][0]
    ans.append(tmp)
ans.append(0)

print(*ans, sep="\n")

Measured memory_bytes: 3188
#include<iostream>
  
int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N, Y; std::cin >> N >> Y;
  Y /= 1000;
  for(int x = 0; x <= N; ++x) {
    if(x*10 > Y) break;
    //  y + z = N-x
    // 5y + z = Y-10*x
    int y = (Y-10*x) - (N-x);
    if(y%4!=0) continue;
    y /= 4;
    int z = N-x-y;
    if(y >= 0 && z >= 0) {
      std::cout << x << " " << y << " " << z << std::endl;
      return 0;
    }
  }
  std::cout << "-1 -1 -1" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>

using namespace std;

const int NMAX = 305;

//dp[i][j][k] = expected number of steps given i piles of size 1, j of size 2 and k of size 3
//s[i] = number of piles of size i

double dp[NMAX][NMAX][NMAX];
int a[NMAX],s[5];

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

    cin>>N;
    for(i = 1 ; i <= N ; ++i)
        cin>>a[i],s[a[i]]++;

    int sz,k;
    for(k = 0 ; k <= N ; ++k)
    {
        for(j = 0 ; k + j <= N ; ++j)
        {
            for(i = 0 ; i +  j + k <= N ; ++i)
            {
                if(i == 0 && j == 0 && k == 0)
                    continue;
                dp[i][j][k] = 1.0*N/(i+j+k);
                if(i - 1 >= 0)
                    dp[i][j][k] += 1.0*dp[i-1][j][k]*i/(i+j+k);
                if(j - 1 >= 0)
                    dp[i][j][k] += 1.0*dp[i+1][j-1][k]*j/(i+j+k);
                if(k - 1 >= 0)
                    dp[i][j][k] += 1.0*dp[i][j+1][k-1]*k/(i+j+k);
            }
        }
    }

    cout<<setprecision(10)<<dp[s[1]][s[2]][s[3]];
}



Measured memory_bytes: 219392
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    
    if n % 2 == 1 {
        println!("0");
    } else {
        let mut ans = n / 10;
        let mut m = 50;
        while n >= m {
            ans += n / m;
            m *= 5;
        }
        println!("{}", ans);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	char s[10];
	for (int i = 0; i < 10; i++) {
		cin >> s[i];
	}
	int a[4];
	for (int i = 0; i < 4; i++) {
		a[i] = s[i] - '0';
	}
	int b[2];
	b[0] = s[5] - '0';
	b[1] = s[6] - '0';
	int c[2];
	c[0] = s[8] - '0';
	c[1] = s[9] - '0';
	if (1000 * a[0] + 100 * a[1] + 10 * a[2] + a[3] < 2019 || (1000 * a[0] + 100 * a[1] + 10 * a[2] + a[3] == 2019 && b[0] == 0 && b[1] <= 4))
		cout << "Heisei" << endl;
	else
		cout << "TBD" << endl;
}

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

int N, K;
vector<vector<int>> G;
vector<int> C;

void dfs(int cur, int prev, int num) {
  C.at(cur) = num;
  num = max(num, K-1);
  for (int nx : G.at(cur)) {
    if (nx == prev) continue;
    num--;
    dfs(nx, cur, max(0, num));
  }
}

int main() {
  const int MOD = 1000000007;
  cin >> N >> K;
  G.resize(N);
  for (int i = 0; i < N-1; i++) {
    int a, b; cin >> a >> b; a--; b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  C.resize(N);
  dfs(0, -1, K);
  long long ans = 1;
  for (int i = 0; i < N; i++) {
    ans = ans * C.at(i) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 10752