akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int a, b;
  cin >> a >> b;

  int ans = max(a + b, max(a - b, a * b));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
_, M = map(int, input().split())
Schedule = [list(map(int, input().split())) for _ in range(M)]

Schedule = sorted(Schedule, key=lambda x: x[1])
cnt = 0
before_end = 0
for task in Schedule:
    start = task[0]
    end = task[1]
    if start < before_end:
        continue
    cnt += 1
    before_end = end
print(cnt)

Measured memory_bytes: 29848
#include<bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
using namespace std;

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

const int MAXN = 1e5 +2;
int balls[MAXN], n, m, x, y, ans;
bool red[MAXN];

int main(){
//	freopen(".in", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n >> m;
	fill(balls, balls + n + 1, 1);
	red[1] = true;
	ans = 1;

	while(m--){
		cin >> x >> y;
		if(red[x]){
			if(balls[x] == 1){
				ans--;
				red[x] = false;
			}
			if(!red[y]) ans++;
			red[y] = true;
		}
		balls[x]--;
		balls[y]++;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

double height[501],range_height[501][501];
double dp[501][501];

int main(){

	int N,M;
	scanf("%d %d",&N,&M);

	height[0] = 0;
	for(int i = 1; i <= N; i++){
		scanf("%lf",&height[i]);
		height[i] += height[i-1];
	}

	double sum;

	for(int left = 1; left <= N; left++){
		for(int right = left; right <= N; right++){
			sum = height[right]-height[left-1];
			range_height[left][right] = sum/(double)(right-left+1);
		}
	}

	for(int right = 0; right <= N; right++){
		for(int num = 0; num <= M; num++)dp[right][num] = 0.0;
	}

	for(int right = 1; right <= N; right++){

		dp[right][1] = range_height[1][right];
		for(int left = 2; left <= right; left++){
			for(int divide_num = 2; divide_num <= min(left+1,min(right,M)); divide_num++){
				dp[right][divide_num] = max(dp[right][divide_num],dp[left-1][divide_num-1]+range_height[left][right]);
			}
		}
	}

	printf("%.10lf\n",dp[N][M]);

	return 0;
}



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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    ll cnt_passed = 0,b_cnt = 1;
    rep(i,0,n){
        if(s[i] == 'a'){
            if(cnt_passed < a + b){
                cout << "Yes" << endl;
                cnt_passed++;
            }
            else cout << "No" << endl;

            
        }
        else if(s[i] == 'b'){
            if(cnt_passed < a + b && b_cnt <= b){
                cout << "Yes" << endl;
                cnt_passed++;
            }
            else cout << "No" << endl;
            
            b_cnt++;
        }
        else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;

ll inf = 1e9+7;

ll pw(ll x, ll y) {
    if (y == 0) return 1;
    else if (y == 1) return x % inf;
    else if (y % 2 == 0) return pw(x, y / 2) * pw(x, y / 2) % inf;
    else return pw(x, y / 2) * pw(x, y / 2) % inf * x % inf;
}
 
ll dv(ll x, ll y) {
    return x * pw(y, inf - 2) % inf;
}

ll comb(ll n, ll r) {
    ll v = 1;
    for (int i = 1; i <= r; i++) {
        v *= (n - i + 1);
        v %= inf;
        v *= dv(1, i);
        v %= inf;
    }
    return v;
}

int main(void) {
    ll n, k;
    cin >> n >> k;
    
    
    ll c1 = comb(n - k + 1, 1), c2 = comb(k - 1, 0);
    for (int i = 1; i <= k; i++) {
        cout << c1 * c2 % inf << endl;
        //cout << c1 << " " << c2 << endl;
        c1 *= ((n - k - i + 1) * dv(1, i + 1)) % inf;
        c1 %= inf;
        c2 *= ((k - i) * dv(1, i)) % inf;
        c2 %= inf;
    }

}
// g++ -std=c++14 _main.cpp


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
 
#include <memory.h>
#include <assert.h>
 
#define y0 sdkfaslhagaklsldk
 
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery
 
#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512
 
#define ldouble long double
using namespace std;
 
#define bs 1000000007
 
const int N = 600031;
 
int n;
int ans;
 
int cnt[1000];
 
bool is_good(long long val){
	for (int i=0;i<10;i++){
		cnt[i]=0;
	}
	while (val){
		cnt[val%10]++;
		val/=10;
	}
	return (cnt[3]>0&&cnt[5]>0&&cnt[7]>0);
}
 
void backtrack(long long val){
	if (val>n)
		return;
	if (is_good(val))
		++ans;
	backtrack(val*10+3);
	backtrack(val*10+5);
	backtrack(val*10+7);
}
 
int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);
 
	cin>>n;
	backtrack(0);
 
	cout<<ans<<endl;
 
//	cin.get(); cin.get();
	return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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 (b<a) { a=b; return 1; } return 0; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n;
    cin >> n;
    vector<P> a(n);
    rep(i, n) cin >> a[i].first, a[i].second = i;
    sort(all(a));
    int cnt = 0;
    rep(i, n) if((a[i].second&1) ^ (i&1)) cnt++;
    cout << cnt/2 << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

const int mod = 1e9 + 7;

void solve() {
	string S;
	cin >> S;
	int c[] = { 0, 0, 0 };
	int n = S.size();
	for (int i = 0; i < n; ++i)
	{
		c[S[i] - 'a']++;
	}
	string ans = "YES";
	for (int i = 0; i < 3; ++i)
	{
		if (c[i] > (n + 2) / 3)
		{
			ans = "NO";
			break;
		}
	}

	cout << ans << endl;
	return;
}

int main() {
	solve();
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N=2e5;
int n,k;
struct data {
    int loc,num;
    LL va;
}a[N+10];
bool cmp1(data p,data q) {
    return p.va<q.va;
}
bool cmp2(data p,data q) {
    return p.loc<q.loc;
}
namespace bit {
    int t[N+10];
    int lowbit(int x) {
	return x&(-x);
    }
    void Add(int x) {
	while (x<=N) {
	    t[x]++;
	    x+=lowbit(x);
	}
    }
    int Query(int x) {
	int sum=0;
	while (x>0) {
	    sum+=t[x];
	    x-=lowbit(x);
	}
	return sum;
    }
}
int main() {
    scanf("%d%d",&n,&k);
    a[0].loc=a[0].va=0;
    for (int i=1;i<=n;i++) {
	int x;
	scanf("%d",&x);
	x-=k;
	a[i].loc=i;
	a[i].va=x+a[i-1].va;
    }
    sort(a,a+n+1,cmp1);
    for (int i=0;i<=n;i++)
	if (i==0||a[i].va!=a[i-1].va) a[i].num=i+1;
	else a[i].num=a[i-1].num;
    sort(a,a+n+1,cmp2);
    LL ans=0;
    for (int i=0;i<=n;i++) {
	ans+=bit::Query(a[i].num);
	bit::Add(a[i].num);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#define N 4005
#define LL long long
#define oo (1<<30)
using namespace std;
const int mo=1e9+7,I2=(mo+1)/2;
int n,f[N][N],g[N][N],fc[2*N],xf[2*N],ans;
void inc(int &x,int y){ x=x+y>=mo ? x+y-mo : x+y;}
void dec(int &x,int y){ x=x-y<0 ? x-y+mo : x-y;}
LL fpm(LL x,LL y){ LL s=1; while(y){ if(y&1) s=(s*x)%mo; y>>=1,x=(x*x)%mo;} return s;}
LL C(int n,int m){ return 1LL*fc[n]*xf[m]%mo*xf[n-m]%mo;}
int main()
{
	int i,j,x,y;
	scanf("%d",&n);
	fc[0]=xf[0]=1;
	for(i=1;i<2*N;i++){
		fc[i]=(1LL*fc[i-1]*i)%mo;
		xf[i]=fpm(fc[i],mo-2);
	  }
	for(i=1;i<=n;i++){
		scanf("%d %d",&x,&y);
		f[2001-x][2001-y]++;
		g[2001+x][2001+y]++;
		dec(ans,(int)(C(2*x+2*y,2*x)));
	  }
	for(i=1;i<=4001;i++)
		for(j=1;j<=4001;j++){
			inc(f[i][j],f[i][j-1]);
			inc(f[i][j],f[i-1][j]);
		  }
	for(i=1;i<=4001;i++)
		for(j=1;j<=4001;j++)
			ans=(ans+1LL*g[i][j]*f[i][j])%mo;
	ans=(1LL*ans*I2)%mo;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 94976
import java.util.HashSet;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] hei = new int[n];
        for(int i=0; i<n; i++){
            hei[i] = sc.nextInt();
        }

        HashSet<Integer> hs = new HashSet<>();
        for(int i=0; i<m; i++){
            edge ed = new edge(sc.nextInt()-1, sc.nextInt()-1);
            if(hei[ed.a]>hei[ed.b]){
                hs.add(ed.b);
            } else if(hei[ed.b]>hei[ed.a]){
                hs.add(ed.a);
            } else{
                hs.add(ed.a); hs.add(ed.b);
            }
        }

        System.out.println(n-hs.size());

        sc.close();
        
    }
    static class edge{
        int a;
        int b;
        edge(int a, int b){
            this.a = a;
            this.b = b;
        }
    }
    
}

Measured memory_bytes: 63208
#!/bin/bash
':' /*
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro node:5.2-slim \
  /bin/bash -c "node /vo/$(basename $0) < /vo/g.inp"; exit $?
exit 0
*/

"use strict";

const gcd = (a, b) => {
  let r = a % b;
  if (r == 0) return b;
  return gcd(b, r);
}

const main = (input) => {
  let xy = Array.from(input[0].split(" "), x => Number.parseInt(x));
  let x = xy[0];
  let y = xy[1];
  return Math.floor(
    x * y / gcd(Math.max(x, y), Math.min(x, y))
  );
};
console.log(main(require("fs").readFileSync("/dev/stdin", "utf-8")
  .trim().split("\n")));


Measured memory_bytes: 7372
/*{{{*/
#include <bits/stdc++.h>
#ifdef DBG
int c_;
#define cout (c_?cerr:cout)
#define dbg(...) {if(!c_)cerr<<"\033[96;1m";++c_;\
__VA_ARGS__;--c_;if(!c_)cerr<<"\033[0m";}
#else
#define dbg(...)
#endif
#define st first
#define nd second
#define dprt(...) dbg(prt(__VA_ARGS__))
#define dmp(...) dprt(#__VA_ARGS__, __VA_ARGS__)
#define drprt(...) dbg(rprt(__VA_ARGS__))
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
#define rdmp(...) dbg(cerr<<#__VA_ARGS__<<": ";rprt(__VA_ARGS__))
using namespace std; using ll = long long;
template< typename t > using V = vector< t >;
template< typename t > void prt(const t& a){cout<<a<<'\n';}
template< typename t, typename... v > void prt(const t& a, v&&... b)
{cout<<a<<' ';prt(b...);}
template< typename t > void rprt(t a, const t& b){while(a!=b)cout<<(*a++)<<' ';cout << '\n';}
/*}}}*/

int n, x;
V< int > tb;

inline ll spr(int v)
{
    ++v;

    V< ll > ilo(tb.size() * 2);

    for (int i = 0; i < ilo.size(); ++i)
        ilo[i] = tb[(i >= tb.size()? i - tb.size() : i)];

    rdmp(all(ilo));

    deque< pair< int, int > > dq;

    for (int i = 0; i < ilo.size(); ++i)
    {
        while (dq.size() and dq.front().nd < i - v + 1)
            dq.pop_front();

        while (dq.size() and dq.back().st >= ilo[i])
            dq.pop_back();

        dq.push_back({ilo[i], i});

        ilo[i] = dq.front().st;
    }

    ll res = 0;
    for (int i = v - 1; i < v - 1 + n; ++i)
        res += ilo[i];

    rdmp(all(ilo));
    dmp(res);

    return res;
}

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

    cin >> n >> x;

    tb.resize(n);
    for (int& i : tb)
        cin >> i;

    ll res = LLONG_MAX;
    for (int i = 0; i < n; ++i)
        res = min(res, (ll)i * x + spr(i));

    prt(res);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D){
    int win1 = C/B;
    int win2 = A/D;
    if(C%B!=0){
        win1++;
    }
    if(A%D!=0){
        win2++;
    }
    if(win1<=win2){
        cout <<YES<< endl;
    }else{
        cout <<NO <<endl;
    }

}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


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


int main(void) {
    using namespace std;

    long w, h, x, y;
    cin >> w >> h >> x >> y;

    if(2*x == w && 2*y == h)
        cout << (w*h*0.5) << ' ' << 1 << endl;
    else
        cout << (w*h*0.5) << ' ' << 0 << endl;
}


Measured memory_bytes: 256
a, b, m = map(int,input().split())
rei = list(map(int,input().split()))
den = list(map(int,input().split()))
ans = [min(rei) + min(den)]
for i in range(m):
    x,y,c = map(int,input().split())
    ans.append(rei[x-1] + den[y-1] - c)
    
print(min(ans))

Measured memory_bytes: 24756
#include<bits/stdc++.h>
#define NMAX 15005
#define VMAX 200000
#define inf 2000000005

using namespace std;
ifstream f("date.in");
ofstream g("date.out");
char s[40005];
long long int fr[4005][3],sol,n;
int code(char ch)
{
    if(ch=='R') return 0;
    if(ch=='G') return 1;
    if(ch=='B') return 2;


}
int main()
{
cin>>n>>(s+1);
for(int i=1;i<=n;i++)
{
    for(int j=0;j<3;j++)
    {
        fr[i][j]=fr[i-1][j];
    }
    if(s[i]=='R') fr[i][0]++;
    if(s[i]=='G') fr[i][1]++;
    if(s[i]=='B') fr[i][2]++;

}
for(int i=1;i<=n;i++)
{
    for(int j=i+2;j<=n;j++)
    {
        if(s[i]!=s[j])
        {
            if(code(s[i])!=1&&code(s[j])!=1)
            {
                sol=sol+fr[j-1][1]-fr[i][1];
                if((j-i)%2==0)
                {
                    int dif=(j+i)/2;
                    if(code(s[dif])==1) sol--;
                }
            }
             if(code(s[i])!=0&&code(s[j])!=0)
            {
                sol=sol+fr[j-1][0]-fr[i][0];
                if((j-i)%2==0)
                {
                    int dif=(j+i)/2;
                    if(code(s[dif])==0) sol--;
                }
            }
             if(code(s[i])!=2&&code(s[j])!=2)
            {
                sol=sol+fr[j-1][2]-fr[i][2];
                if((j-i)%2==0)
                {
                    int dif=(j+i)/2;
                    if(code(s[dif])==2) sol--;
                }
            }
        }
    }
}
cout<<sol<<'\n';


}


Measured memory_bytes: 3684
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul             1000000007
#define rep(i,a,b)      for(int i=a;i<b;i++)
#define rfor(i,a,b)     for(int i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define mod             998244353 
#define pll             pair<ll,ll>
#define endl            '\n'
#define SIZE            1000005
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%lul;
        a = (a * a)%lul;
        b >>= 1;
    }
    return res;
}
void solve()
{
    int a,b,c; cin>>a>>b>>c;
    unordered_map<int,int> ma;
    ma[a]++;
    ma[b]++;
    ma[c]++;
    if(ma.size() == 2) cout<<"Yes";
    else cout<<"No";
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; /*cin>>t;*/ t=1;
    rep(i,1,t+1){
        solve();
    }
    return 0;
}

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

string query(int i) {
    cout << i << endl;
    string result;
    cin >> result;
    return result;
};

int main() {
    int n;
    cin >> n;
    int begin = 0, end = n - 1;
    string head = query(begin);
    if (head != "Vacant") {
        while (true) {
            auto mid = (begin + end + 1) / 2;
            auto current = query(mid);
            if (current == "Vacant") {
                break;
            }
            if ((current == head) != (begin % 2 == mid % 2)) {
                end = mid;
            } else {
                begin = mid;
                swap(head, current);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 852
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll a; cin>>a;
	ll b; cin>>b;
	if(a>b)swap(a,b);
	REP(i,b) cout<<a;
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
#define foreach(ix,a) for(auto& (ix) : (a) 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a;
  string s;
  cin>>s>>a;
  ll count =0;
  rep(i,a){
    int q;
    cin>>q;
    if(q==1){
      count++;
      count = count%2;
    }
    else{
      int x;
      cin>>x;
      if((x==2&&count%2==0)){
        char y;cin>>y;
        s.push_back(y);}
      else if((x==1&&count%2==1)){
        char y;cin>>y;
        s.push_back(y);
        }
      else{
        string y;cin>>y;
        s.insert(0,y);
        }
    }
  }
  if(count%2==1)reverse(been(s));
  cout<<s<<endl;
}

Measured memory_bytes: 912
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll x,y,z;
    cin >> x >> y >> z;
    cout << z << ' ' << x << ' ' << y << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int h, w;

bool is_ok(int i, int j) {
    return 0 <= i && i < h && 0 <= j && j < w;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> h >> w;
    vector<string> a(h);
    for(int i=0;i<h;++i) {
        cin >> a[i];
    }

    vector<vector<int>> dp(h, vector<int>(w, INF));
    dp[0][0] = 0;
    for(int i=0;i<h;++i) {
        for(int j=0;j<w;++j) {
            if(j != w-1) {
                if(a[i][j] != a[i][j+1]) {
                    dp[i][j+1] = min(dp[i][j+1], dp[i][j] + 1);
                } else {
                    dp[i][j+1] = min(dp[i][j+1], dp[i][j]);
                }
            }
            if(i != h-1) {
                if(a[i][j] != a[i+1][j]) {
                    dp[i+1][j] = min(dp[i+1][j], dp[i][j] + 1);
                } else {
                    dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
                }
            }
        }
    }

    int ans = dp[h-1][w-1];
    if(a[0][0] == '#') ++ans;
    ans = (ans+1) / 2;
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double n,k;
  cin>>n>>k;
  double y=0;
  for(double i=1;i<=n;i++){
    double j=i;
    double x=1/n;
    if(j>=k){
      y+=x;
    }
    else{
  while(j<=k){
    j*=2;
    x/=2.0000000;
    if(j>=k){
      y+=x;
      break;
    }
  }
    }
  }
 cout << fixed << setprecision(12) << y << endl;
}

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

using namespace std;

int main() {
	string S, T;

	cin >> S;
	cin >> T;
	int ns = S.length(), nt = T.length(), ans = nt;
	
	for (int i = 0; (i < ns) && (i + nt-1 < ns); i++) {
		int count = 0;
		for (int j = 0; j < nt; j++) {
			if (S[i+j] != T[j])
				count++;
		}
		ans = min(ans, count);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3640
def solve():
    import sys
    input_lines = sys.stdin.readlines()
    
    while True:
        R, C = map(int, input_lines[0].split())
        if R == 0:
            break
        
        rows = map(lambda x: x.rstrip().replace(' ', ''), input_lines[1:R+1])
        cols = [int(''.join(t_c), base=2) for t_c in zip(*rows)]
        
        ans = []
        
        for m in range(2 ** (R - 1)):
            shipment = 0
            for s in cols:
                bit_cnt = bin(m ^ s).count('1')
                shipment += max(bit_cnt, R - bit_cnt)
            ans.append(shipment)
        
        print(max(ans))
        
        del input_lines[:R+1]

solve()


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

int main()
{
  string S, T;
  cin >> S >> T;
  if (S == T.erase(T.size() - 1))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3596
class SegmentTreeDual():
    def __init__(self,arr,op=lambda x,y:y if y != -1 else x,ie=-1):
        self.h = (len(arr)-1).bit_length()
        self.n = 2**self.h
        self.ie = ie
        self.op = op
        self.val = [ie for _ in range(self.n)]
        self.laz = [ie for _ in range(2*self.n)]
        for i in range(len(arr)):
            self.val[i] = arr[i]
    def propagate(self,k):
        if self.laz[k] == self.ie:
            return
        if self.n <= k:
            self.val[k-self.n] = self.op(self.val[k-self.n],self.laz[k])
            self.laz[k] = self.ie
        else:
            self.laz[(k<<1)] = self.op(self.laz[(k<<1)],self.laz[k])
            self.laz[(k<<1)+1] = self.op(self.laz[(k<<1)+1],self.laz[k])
            self.laz[k] = self.ie
    def update(self,left,right,f):
        left += self.n
        right += self.n
        for i in range(self.h)[::-1]:
            self.propagate(left>>i)
            self.propagate(right>>i)
        while right - left > 0:
            if right & 1:
                right -= 1
                self.laz[right] = self.op(self.laz[right],f)
            if left & 1:
                self.laz[left] = self.op(self.laz[left],f)
                left += 1
            left >>= 1
            right >>= 1
    def get(self,index):
        res = self.val[index]
        index += self.n
        while index>0:
            res = self.op(res,self.laz[index])
            index //= 2
        return res

import sys
input = sys.stdin.readline

import bisect

N,D,A = map(int,input().split())
monster = [list(map(int,input().split())) for _ in range(N)]

monster.sort()
ans = 0
X = []
H = []
for i in range(N):
    X.append(monster[i][0])
    H.append(monster[i][1])

hani = [0 for _ in range(N)]
for i in range(N):
    hani[i] = bisect.bisect_left(X,X[i]+2*D+1)

sg = SegmentTreeDual(H,lambda x,y:x+y,0)

for i in range(N):
    hp = sg.get(i)
    if hp <= 0:
        continue
    cnt = -(-hp//A)
    sg.update(i,hani[i],-A*cnt)
    ans += cnt

print(ans)

Measured memory_bytes: 119392
from itertools import accumulate
N, C = map(int, input().split())
V = [[0] * (10 ** 5 + 1) for i in range(C)]

for i in range(N):
    s, t, c = map(int, input().split())
    s, t, c = s - 1, t - 1, c - 1
    V[c][s] += 1
    V[c][t + 1] -= 1

for c in range(C):
    V[c] = list(accumulate(V[c]))

ans = 0
for i in range(10 ** 5 + 1):
    tmp = 0
    for c in range(C):
        tmp += min(1, V[c][i])
    ans = max(ans, tmp)

print(ans)


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

int main() {
  int S,W;
  cin >> S >> W;
  if (W >= S){
    cout << "unsafe";
  }
  else{
    cout << "safe";
  }
  
return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const int MAX_N = 200050;

int N, Q;
std::string S;

char tile[MAX_N];
char t[MAX_N], d[MAX_N];

int cal_pos(int pos) {
    for (int i = 1; i <= Q; i++) {
        if (t[i] == tile[pos]) {
            if (d[i] == 'L') {
                pos--;
            } else {
                pos++;
            }
        }
        if (pos == 0 || pos == N + 1) {
            break;
        }
    }
    return pos;
}

int main(int argc, char **argv) {
    std::cin >> N >> Q;
    std::cin >> S;

    for (int i = 1; i <= Q; i++) {
        std::cin >> t[i] >> d[i];
    }

    for (int i = 0; i < S.size(); i++) {
        tile[i+1] = S[i];
    }

    int lb = 0;
    int ub = N + 1;

    while (lb + 1 < ub) {
        int mid = (lb + ub) / 2;
        if (cal_pos(mid) == 0) {
            lb = mid;
        } else {
            ub = mid;
        }
    }

    int left_cond = lb;

    lb = 0;
    ub = N + 1;

    while (lb + 1 < ub) {
        int mid = (lb + ub) / 2;
        if (cal_pos(mid) == N + 1) {
            ub = mid;
        } else {
            lb = mid;
        }
    }

    int right_cond = ub;

    //std::cout << left_cond << " " << right_cond << std::endl;

    int ret = 0;
    for (int i = 1; i <= N; i++) {
        if (left_cond < i && i < right_cond) {
            ret++;
        }
    }
    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 1156
#include<stdio.h>
int S[26], i;
char c;
int main(){
  c=getchar();
  while(c!=10){
    S[c-'a']++;
    c=getchar();
  }
  for(i=0; i<26; i++){
    if(S[i]==0){break;}
  }
  if(i==26){
    printf("None\n");
  }else{
    printf("%c\n", i+'a');
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,ch[300010][63],sum[63]={0};
	cin>>n;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		ll j=0;
		while(now!=0){
			ch[i][j]=now%2;
			now/=2;
			j++;
		}
	}
	for(ll i=0;i<62;i++){
		for(ll j=0;j<n;j++){
			sum[i]+=ch[j][i];
		}
//		cout <<sum[i];
	}
	ll ans=0;
	for(ll i=0;i<n-1;i++){
		for(ll j=0;j<60;j++){
			sum[j]=sum[j]-ch[i][j];
	//		cout <<sum[j];
		}
	//	cout<<endl;
		ll cnt=0;
		ll keta=1;
		for(ll j=0;j<60;j++){
			if(ch[i][j]){
				cnt+=(n-i-1-sum[j])*keta;
			}
			else{
				cnt+=sum[j]*keta;				
			}
			cnt%=inf;
			keta*=2;
			keta%=inf;
		}
		ans+=cnt;
		ans%=inf;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

signed main(){
  int N;
  cin>>N;
  int jail=0;
  string ans="No";
  rep(i,N){
    int A,B;
    cin>>A>>B;
    if(A==B)jail+=1;
    else jail=0;
    if(jail>=3)ans="Yes";
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
int main(){
  int a,b,i,j,N,flag=0,count=0;
  
  scanf("%d",&N);
  int A[N];
  for(i=0;i<N;i+=1){
    scanf("%d",&A[i]);
  }
  for(a=0;a<N;a+=1){
    for(j=N-1;a<j;j-=1){
      if(A[j]<A[j-1]){
	flag=A[j];
	A[j]=A[j-1];
	A[j-1]=flag;//A[j] と A[j-1] を交換
	count++;
      }
    }
    if(a==N-1){
    printf("%d\n",A[a]);
    }
    else printf("%d ",A[a]);
    }
  printf("%d\n",count);
    return 0;
  }
    



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

#define ll long long
#define endl "\n";
#define mod 1000000007
#define pii pair<int,int>
#define vii vector<pii>
#define mp make_pair
#define all(a) a.begin(), a.end()
#define mk(arr,n,type) type *arr=new type[n];

void fastio() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main() {
    fastio();
    int n, q;
    cin >> n;

    ll a, b, c, sum = 0LL;
    unordered_map<ll, ll> mp;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (mp.find(a) == mp.end())
            mp[a] = 1;
        else
            mp[a]++;

        sum += a;
    }

    cin >> q;
    while (q--) {
        cin >> b >> c;
        if (mp.find(b) != mp.end() && mp[b] != 0) {
            if (mp.find(c) == mp.end())
                mp[c] = mp[b];
            else
                mp[c] += mp[b];

            sum = sum + (mp[b] * (c - b));
            mp[b] = 0;
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 6692
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int n; cin >>n;
  vector<li> vec(n);
  rep(i,n) cin >>vec[i];
  li cnt =0,l=0,r=1,t=vec[0];
  while(l<n){
    while((r<n) and (t & vec[r]) ==0){
      t^=vec[r];
      r++;
    }

    if(df) print("[", l,r ,")");
    cnt+=r-l;
    
    t^=vec[l];
    l++;
  }
  print(cnt);
}


Measured memory_bytes: 1792
/*ربى اصلح لى شأنى*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define el '\n';
long long  gcd(long long  a, long long  b) { return !b ? a : gcd(b, a % b); }
long long  lcm(long long a, long long  b) { return (a / gcd(a, b)) * b; }
long long  fact(long long  n) { return !n ? 1 : n * fact(n - 1); }
using namespace std;
const  double PI = acos(-1);
using lli = long long int;
/* smile ^_^ */
using namespace std;
void ezzo()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int main()
{
	ezzo();
	lli n; cin >> n;
	string s; cin >> s;
	if (n < 3200){
		cout << "red" << el;
	}
	else{
		cout << s << el;
	}

}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int n;
    cin >> n;
    switch(n%10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
    }
    return 0;
}

Measured memory_bytes: 3632
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;
const double pi=3.141592653589793238;
int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> a(h,vector<char>(w));
    vector<vector<int>> dist(h,vector<int>(w,-1));
    int ans=0;//変えた回数
    queue<pair<int,int>> q;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> a[i][j];
            if(a[i][j]=='#'){
                dist[i][j]=0;
                q.push(make_pair(i,j));
            }
        }
    }
    while(!q.empty()){
        pair<int,int> p=q.front();
        q.pop();
        int ph=p.first,pw=p.second;
        int dh[4]={-1,0,0,1};
        int dw[4]={0,-1,1,0};
        bool sousa=0;
        for(int i=0; i<4; i++){
            int H=ph+dh[i],W=pw+dw[i];
            if(H>=h || W>=w) continue;
            else if(H<0 || W<0) continue;
            else if(dist[H][W]!=-1) continue;
            else{
                dist[H][W]=dist[ph][pw]+1;
                q.push(make_pair(H,W));
            }
        }
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(dist[i][j]>ans) ans=dist[i][j];
        }
    }

    cout << ans << endl;

}



Measured memory_bytes: 16048
let calc s e =
  let rec aux i c =
    if i < s || e < i then c
    else if i / 10000 <> i mod 10 then aux (i + 1) c
    else
      let i2 = i / 10 mod 1000 in
      if i2 / 100 <> i2 mod 10 then aux (i + 1) c else aux (i + 1) (c + 1)
  in
  aux s 0

let () = Scanf.scanf "%d %d" calc |> Printf.printf "%d\n"


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

template<class T>
T read()
{
    T value;
    std::cin >> value;
    return value;
}
 
template<class F>
void times_do(size_t n, F func)
{
    for(size_t i = 0; i < n; ++i) func();
}
 
template<class T>
vector<T> reads(size_t n)
{
    vector<T> a;
    a.reserve(n);
    times_do(n, [&](){
        a.push_back(read<T>());
    });
    return a;
}

int main()
{
    const size_t n = read<size_t>();
    auto a = reads<size_t>(n);
    auto b = reads<size_t>(n);
    auto c = reads<size_t>(n);

    sort(begin(a), end(a));
    sort(begin(b), end(b));
    sort(begin(c), end(c));

    size_t count = 0;

    for(size_t mid : b)
    {
        auto top = lower_bound(begin(a), end(a), mid);
        auto bottom = upper_bound(begin(c), end(c), mid);
        count += distance(begin(a), top) * distance(bottom, end(c));
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 2560
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using Graph=vector<vector<int>>;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
int roundup(int a,int b){return	(a-1)/b+1;}
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}


signed main(){
	int n;cin>>n;
	vector<string> s(n);
	rep(i,n) cin>>s[i];
	int ans=0;
	int tmp=0;
	rep(A,n){
		bool ok=true;
		rep(i,n) rep(j,n){
			int nex=(i+A)%n,ney=j;
			int tx=(j+A)%n,ty=i;
			if(s[nex][ney]!=s[tx][ty]){ 
				ok=false;
			}
		}
		if(ok) ans+=n-A;
	}
	rep(B,1,n){
		bool ok=true;
		rep(i,n) rep(j,n){
			int nex=i,ney=(j+B)%n;
			int tx=j,ty=(i+B)%n;
			if(s[nex][ney]!=s[tx][ty]){ 
				ok=false;
			}
		}
		if(ok) ans+=n-B;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
	int W, H;
	int i, j;

	while (1)
	{
		cin >> H >> W;

		if (W == 0 && H == 0)
			break;

		for (j = 0; j < H; j++)
		{

			for (i = 0; i < W; i++)
			{
				if (i == 0 || i == W - 1 || j == 0 || j == H - 1)
					cout << '#';
				else
					cout << '.';
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int a = in.nextInt();
        int b = in.nextInt();
        for(int i=0;i<Math.max(a,b);i++)
            out.print(Math.min(a,b));
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

int main()
{
	int i,j,n,x,c;
	double m;
	c = 0;
	scanf("%d",&n);
	for(i = 1; i <= n; i++)
	{
		scanf("%d",&x);
		m = sqrt(x);
		if (x == 2 || x == 3)
			c += 1;
		for(j = 2; j <= m + 1; j ++)
		{
			if(x%2 == 0 ||x % 5 == 0 || x % j == 0)
			{
				break;
			}else if (j >= m){
				c += 1;
				break;
			}
		}
	}
	printf("%d\n",c);
	
	return 0;
}



Measured memory_bytes: 2140
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

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

def solve():
    #n = int(stdin.readline().rstrip())
    a,b = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    mojiretu1 = str(a) * b
    mojiretu2 = str(b) * a
    if a < b:
        print(mojiretu1)
    else:
        print(mojiretu2)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9128
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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++)
int main() {
  ll N;
  cin >> N;
  vector<int> vec(N);
  rep(i, N) {
    cin >> vec.at(i);
  }
  ll co = 0;
  rep(i, N) {
    if(vec.at(vec.at(i) - 1) == i + 1) {
      co++;
    }
  }
  cout << co / 2 << endl;
}

Measured memory_bytes: 3748
#include<iostream>
#include<string>
using namespace std;
int main(){
long n,f,i,j,k,m;
string s;
cin>>n;
for(i=0;i<n;i++){
cin>>s;
if(s.substr(0,2)==">'"){
if(s.substr(2,1)!="="){f=2;goto E;}
j=s.find_first_not_of('=',3);
m=j-2;
if(s.substr(j,1)!="#"){f=2;goto E;}
k=s.find_first_not_of('=',j+1);
if(k-j-1!=m){f=2;goto E;}
if(s.substr(k,1)!="~"){f=2;goto E;}
if(k+1!=s.size()){f=2;goto E;}
f=0;
}else if(s.substr(0,2)==">^"){
if(s.substr(2,2)!="Q="){f=2;goto E;}
for(j=4;;j+=2){
if(s.substr(j,2)!="Q=")break;
}
if(s.substr(j,2)!="~~")f=2;else f=1;
}else{
f=2;
}
E:
if(f==0)cout<<"A"<<endl;
else if(f==1)cout<<"B"<<endl;
else cout<<"NA"<<endl;
}
return 0;
}

Measured memory_bytes: 1216
/*
                   _ooOoo_
                  o8888888o
                  88" . "88　AC!AC!
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
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 (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
int main(){
  // ...
  int n,m,l;
  cin>>n>>m>>l;
  
//  Graph g(n);    //頂点数vの空隣接リストgを生成
  // ...
  VV vec;
  vec.resize(n,V(n,1e15));
  rep(i,m){
      ll a,b,c;
      cin>>a>>b>>c;
      a--;b--;
      if(c>l)continue;
      vec[a][b]=c;
      vec[b][a]=c;
  }//隣接リストgにsからtに向かう重さwの辺を追加
  // ...
  rep(k,n){
      rep(i,n){
          rep(j,n){
              if(vec[i][k]+vec[k][j]<=vec[i][j]){
                 vec[i][j]=min(vec[i][j],vec[i][k]+vec[k][j]);
              }
          }
      }
  }
  VV vec2(n,V(n,1e15));
  rep(i,n){
      rep(j,n){
          if(vec[i][j]<=l){
              vec2[i][j]=1;
          }
      }
  }
  
  rep(k,n){
      rep(i,n){
          rep(j,n){
              vec2[i][j]=min(vec2[i][k]+vec2[k][j],vec2[i][j]);
          }
      }
  }
//  cout<<vec2[1][0]<<endl;
  ll q;cin>>q;
  rep(i,q){
      ll s,t;
      cin>>s>>t;
      s--;t--;
      if(vec[s][t]==1e15){
          cout<<-1<<endl;
          continue;
      }
      cout<<vec2[s][t]-1<<endl;
  }
  // ...
}


Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

int segt[400000];
int depth=0;
int best=0;
vector<LL> mytime;

int par(int i){
  if(i==0)
    return -1;
  return (i-1)/2;
}

void update(int d,int x){
  int i=d+(1<<depth)-1;
  segt[i]+=x;
  while(par(i)!=-1){
    segt[par(i)]=max(segt[i],segt[(i+1)/2*4-1-i]);
    i=par(i);
  }
  i=0;
  while(i<(1<<depth)-1){
    i=(segt[i]==segt[2*i+1])?2*i+1:2*i+2;
  }
  best=i-((1<<depth)-1);
}

int main(){
  LL n,r,l;
  cin >> n>>r>>l;

  while((1<<depth)-1<n){
    depth++;
  }
  REP(i,n)
    mytime.push_back(0);

  REP(i,1<<(depth+1)){
    if(i<((1<<depth)-1)+n)
      segt[i]=0;
    else
      segt[i]=-INT_MAX;
  }

  int d,x,t_prev,t_now=0;
  REP(i,r){
    t_prev=t_now;
    cin>>d>>t_now>>x;
    if(i==0)
      mytime[0]+=t_now;
    else
      mytime[best]+=t_now-t_prev;
    update(d-1,x);
  }
  mytime[best]+=l-t_now;
  
  cout<<1+distance(mytime.begin(),max_element(mytime.begin(),mytime.end()))<<endl;
  return 0;
}

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

const int MAX = 510000;
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];


void COMinit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k){
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long N, A, B, K;

int main() {
	COMinit(); // テーブルを作る

	cin >> N >> A >> B >> K;
	long long res = 0;
	for (long long a = 0; a <= N; ++a) { // A の個数を全探索
		long long rem = K - a * A;
		if (rem % B != 0) continue;
		long long b = rem / B;
		if (b > N) continue;
		long long tmp = COM(N, a) * COM(N, b) % MOD;
		res += tmp;
		res %= MOD;
	}

	cout << res << endl;
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
#define clr(a,b) memset(a,b,sizeof(a))
using namespace std;

typedef long long ll;

const int maxn=2010;
int n;

int main(){
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    cin >> n;
    int base = 1, num = 9, res = 0;
    while (base * 100 <= n) {
        res += num;
        base *= 100;
        num = num * 100;
    }
    res += (min(base * 10 - 1, n) - base + 1);
    cout << res << endl;
}

Measured memory_bytes: 256