akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ll N; cin >> N;
    string S, T; cin >> S >> T;
    for (int i = 0; i < S.size(); ++i) {
        cout << S[i] << T[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    char[]ss = S.toCharArray();

    int nedan = 700;
    for(int i=0; i<3; i++){
    if(ss[i]=='o'){
        nedan += 100;
    }
}
	System.out.println(nedan);    
    }
}

Measured memory_bytes: 35692
#include<bits/stdc++.h>
using namespace std;
int n,a[111111];
long long int proc(long long int&sum, long long int x, bool pos){
	sum += x;
	if(pos){
		if(sum > 0)return 0;
		long long int ret = 1 - sum;
		sum = 1;
		return ret;
	}else{
		if(sum < 0)return 0;
		long long int ret = sum + 1;
		sum = -1;
		return ret;
	}
}
int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++)
		scanf("%d",&a[i]);
	long long int bes = -1;
	for(int run = 0; run < 2; run ++){
		bool flag = (bool)run;
		long long int now = 0, sum = 0;
		for(int i=0; i<n; i++){
			now += proc(sum, a[i], flag);
			flag = !flag;
		}
		if(run == 0 || now < bes)
			bes = now;
	}
	cout << bes << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    char n[2000001];
    long e=0;
    scanf("%s",n);
    for(long long unsigned int i=0;i<strlen(n);i++){
        e+=n[i]-48;
    }
    if(e%9==0)printf("Yes");
    else printf("No");
    return 0;
}

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

ans = False
first = False
second = False
third = False

for i in range(n):
    d1, d2 = list(map(int, input().split()))
    if d1 == d2:
        if first == False:
            first = True
        elif second == False:
            second = True
        else:
            third = True
            ans = True
    else:
        first = False
        second = False
        third = False

if ans:
    print('Yes')
else:
    print('No')


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

char grading(int a, int b, int c) {
	if ((a == -1) || (b == -1)) {
		return 'F';
	}
	if (a+b >= 80) {
		return 'A';
	}else if(a+b >= 65){
		return 'B';
	}else if(a+b >= 50) {
		return 'C';
	}else if(a+b >= 30) {
		if (c >= 50) {
			return 'C';
		}
		return 'D';
	}
	return 'F';
}

int main() {
	std::vector<int> a_score;
	std::vector<int> b_score;
	std::vector<int> c_score;
	int a, b, c;
	std::cin >> a >> b >> c;
	while ((a != -1)||(b != -1)||(c != -1)) {
		a_score.push_back(a);
		b_score.push_back(b);
		c_score.push_back(c);
		std::cin >> a >> b >> c;
	}
	for (int i = 0; i < a_score.size(); i++) {
		std::cout << grading(a_score[i], b_score[i], c_score[i]) << '\n';
	}
	return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  vector<vector<int>> adj_list(N);
  vector<int> K(N - 1, 0);
  for (int s = 0; s < N - 1; s++) {
    queue<int> Q;
    vector<int> visited(N, 0);
    int steps = 0;
    Q.push(s);
    while (!Q.empty()) {
      int q_size = Q.size();
      for (int i = 0; i < q_size; i++) {
        int j = Q.front();
        Q.pop();
        if (visited[j])
          continue;
        if (j > s)
          K[steps - 1]++;
        visited[j] = 1;
        if (j < N - 1)
          Q.push(j + 1);
        if (j > 0)
          Q.push(j - 1);
        if (j == X - 1)
          Q.push(Y - 1);
        if (j == Y - 1)
          Q.push(X - 1);
      }
      steps++;
    }
  }
  for (int k : K) {
    cout << k << endl;
  }
  return 0;
}

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

int main(){
  int n;cin>>n;
  map<int, bool> m;
  for(int i=0;i<n;i++){
    int a;cin>>a;
    if(m[a])m.erase(a);
    else m[a]=true;
  }
  cout << m.size() << endl;
}


Measured memory_bytes: 4864
def make_mat(grid, H, W):
    res = [[0] * W for _ in range(H)]
    for h in range(H):
        cnt = 0
        for w in range(W):
            if grid[h][w] == 1:
                for i in range(cnt):
                    res[h][w - 1 - i] = cnt
                cnt = 0
            else:
                cnt += 1
        if grid[h][w] == 0:
            for i in range(cnt):
                res[h][w - i] = cnt
    return res

def max2(x,y):
    return x if x > y else y


import sys
input = sys.stdin.readline

H, W = map(int, input().split())


grid = []
grid_t = [[] for _ in range(W)]
for h in range(H):
    temp = []
    for w, s in enumerate(input().rstrip()):
        if s=="#":
            temp.append(1)
            grid_t[w].append(1)
        else:
            temp.append(0)
            grid_t[w].append(0)
    grid.append(temp)

A = make_mat(grid, H, W)
B = make_mat(grid_t, W, H)

res = 0
for h in range(H):
    for w in range(W):
        res = max2(A[h][w] + B[w][h], res)

print(res-1)

Measured memory_bytes: 254444
#include <iostream>
#include <vector>
#include <string>

int main(){
    long int N;
    std::cin>>N;
    long int ans=9999999999;

    for(long int i=1;i*i<=N;++i){
        if(N%i==0){
            long int len=(std::to_string(i).length()>std::to_string(N/i).length())?std::to_string(i).length():std::to_string(N/i).length();
            if(len<ans){
                ans=len;
            }
        }
    }
    std::cout<<ans<<std::endl;
}

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

typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define psf push_front
#define pof pop_front
#define mkp make_pair
#define mkt make_tuple
#define all(x) x.begin(), x.end()

int n;
const int MAXS = 5e5;
int fen[MAXS + 100];
int a[MAXS + 100];
queue<int> elems[MAXS + 100];
vii queries[MAXS + 100];

void update(int pos, int delta){
    while(pos <= n){
        fen[pos] += delta;
        pos += pos & (-pos);
    }
}

int query(int pos){
    int answer = 0;
    while(pos){
        answer += fen[pos];
        pos -= pos & (-pos);
    }
    return answer;
}

int main(){
	ios::sync_with_stdio(false), cin.tie(nullptr);
    cin>>n;
    int q; cin>>q;
    vii arq;
    set<int> ft;
    for (int i=1; i<=n; i++){
        cin>>a[i];
        elems[a[i]].push(i);
        auto ff = ft.find(a[i]);
        if (ff == ft.end()){
            update(i, 1);
            ft.insert(a[i]);
        }
    }
    for (int i=0; i<q; i++){
        int l,r; cin>>l>>r;
        queries[l].pb(ii(i, r));
    }
    
    vii ans;
    for (int i=1; i<=n; i++){
        //first answer all, then update:
        for (int j=0; j<queries[i].size(); ++j){
            int r = queries[i][j].second;
            int index = queries[i][j].first;
            int cans = query(r);
            ans.pb(ii(index, cans));
        }
        int el = a[i];
        int pos = elems[el].front();
        elems[el].pop();
        update(pos, -1);
        if (!elems[el].empty()) update(elems[el].front(), 1);
    }
    sort(all(ans));
    for (int i=0; i<q; i++){
        cout<<ans[i].second<<'\n';
    }
    
	return 0;
}
/*
NARCO
*/


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

struct MaximumFlow
{
	struct Edge
	{
		int to, cap, rev;
		Edge(int to, int cap) : to(to), cap(cap) {}
	};
	int N, src, sink;
	vector<vector<Edge>> G;
	vector<int> dist, work;
	MaximumFlow(int N, int src, int sink) : N(N), src(src), sink(sink) {
		G.resize(N);
		dist.resize(N);
		work.resize(N);
	}
	void add_edge(int f, int t, int cap) {
		G[f].emplace_back(t,cap);
		G[t].emplace_back(f,0);
		G[f].back().rev=G[t].size()-1;
		G[t].back().rev=G[f].size()-1;
	}
	void add_edge_from_source(int t, int cap) {add_edge(src,t,cap);}
	void add_edge_to_sink(int f, int cap) {add_edge(f,sink,cap);}
	int dfs(int c, int MF=0x7fffffff) {
		int flow;
		if(c==sink) return MF;
		for(int &i=work[c];i<G[c].size();i++) {
			auto &e=G[c][i];
			if(e.cap>0 && dist[e.to]==dist[c]+1 && (flow=dfs(e.to,min(e.cap,MF)))) {
				e.cap-=flow;
				G[e.to][e.rev].cap+=flow;
				return flow;
			}
		}
		return 0;
	}
	int flow() {
		int ret=0;
		queue<int> Q;
		for(;;) {
			int flow=0;
			fill(dist.begin(),dist.end(),0x7fffffff);
			dist[src]=0;
			Q.push(src);
			while(!Q.empty()) {
				int c=Q.front();
				Q.pop();
				for(auto &e: G[c]) if(e.cap>0 && dist[e.to]>dist[c]+1) {
					dist[e.to]=dist[c]+1;
					Q.push(e.to);
				}
			}
			fill(work.begin(),work.end(),0);
			while(int temp=dfs(src)) flow+=temp;
			if(flow==0) break;
			ret+=flow;
		}
		return ret;
	}
};

int N, M, A[100][100], B[100][100], cnt[100][100];
bool used[100][100];


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	cin>>N>>M;
	for(int i=0;i<N;i++) for(int j=0;j<M;j++) {
		cin>>A[i][j];
		cnt[i][--A[i][j]/M]++;
	}
	for(int c=0;c<M;c++) {
		MaximumFlow mf(2*N+2,2*N,2*N+1);
		for(int i=0;i<N;i++) {
			mf.add_edge_from_source(i,1);
			mf.add_edge_to_sink(i+N,1);
			for(int j=0;j<N;j++) if(cnt[i][j]) mf.add_edge(i,j+N,1);
		}
		mf.flow();
		for(int i=0;i<N;i++) for(int t=1;t<mf.G[i].size();t++) if(mf.G[i][t].cap==0) {
			int match=mf.G[i][t].to-N;
			cnt[i][match]--;
			for(int j=0;j<M;j++) if(!used[i][j] && A[i][j]/M==match) {
				B[i][c]=A[i][j];
				used[i][j]=true;
				break;
			}
			break;
		}
	}
	for(int i=0;i<N;i++) {
		for(int j=0;j<M;j++) {
			cout<<B[i][j]+1<<' ';
			A[B[i][j]/M][j]=B[i][j];
		}
		cout<<'\n';
	}
	for(int i=0;i<N;i++) {
		for(int j=0;j<M;j++) cout<<A[i][j]+1<<' ';
		cout<<'\n';
	}
	return 0;
}

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


int main() {
	int n;
	cin >> n;
	vector<int> A(n);
	int ans = 0;
	rep(i, n) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	ans = abs(A[0] - A[A.size() - 1]);

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


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int H, W, Dist[55][55], ans;
char C[55][55];
int di[4] = {-1, 0, 1, 0}, dj[4] = {0, -1, 0, 1};

int main(){
  scanf("%d%d", &H, &W);
  for (int i = 0; i < H; i++) scanf("%s", &C[i]);

  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (C[i][j] == '.') ans++;
    }
  }
  
  Dist[0][0] = 1;
  queue <Pii> que; que.push(mp(0, 0));
  while (!que.empty()){
    Pii Q = que.front(); que.pop();
    for (int k = 0; k < 4; k++){
      int i = Q.fi + di[k], j = Q.se + dj[k];
      if (0 <= i && i < H && 0 <= j && j < W){
        if (Dist[i][j] == 0 && C[i][j] != '#'){
          Dist[i][j] = Dist[Q.fi][Q.se] + 1;
          que.push(mp(i, j));
        }
      }
    }
  }
  
  if (Dist[H - 1][W - 1] == 0){
    cout << -1 << endl;
  }else{
    cout << ans - Dist[H - 1][W - 1] << endl;
  }

  return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
const int mod = 1000000007;

void Main(){
  string s;
  cin>>s;
  int f = 0;
  if(s=="hi") f=1;
  if(s=="hihi") f=1;
  if(s=="hihihi") f=1;
  if(s=="hihihihi") f=1;    
  if(s=="hihihihihi") f=1;
  std::cout << ((f)? "Yes":"No") << std::endl;  
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 256
object Main extends App {
  import scala.math._

val x = scala.io.StdIn.readInt()

var max_b:Double = 0
for (i<-1 to x) {
  if (i==1){
    max_b = max(max_b,1)
  } else {
      var tmp = i*i
      while (tmp <= x){
        max_b = max(max_b, tmp)
        tmp *= i
      }
  }
}
println(max_b.toInt)
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n;
    cin >> n;

    vector<int64_t> a(n);
    int64_t mi = n, ma = 0;
    for (auto&& aa : a) {
        cin >> aa;
        mi = min(mi, aa);
        ma = max(ma, aa);
    }

    if (ma - mi > 1) {
        cout << "No" << endl;
    } else if (ma == mi + 1) {
        auto k = count(a.begin(), a.end(), mi);
        auto l = k + 1;
        auto u = k + (n - k) / 2;

        if (l <= ma && ma <= u) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if (mi == n - 1) {
            cout << "Yes" << endl;
        } else if (1 <= ma && ma <= n / 2) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
 
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define MAX_N (1<<18)
struct StarrySky {
  int seg_m[2*MAX_N-1], seg_a[2*MAX_N-1];
 
  void add(int a, int b, int x, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      seg_a[k] += x;
      return;
    }
    add(a, b, x, k*2+1, l, (l+r)/2);
    add(a, b, x, k*2+2, (l+r)/2, r);
    seg_m[k] = max(
      seg_m[k*2+1] + seg_a[k*2+1],
      seg_m[k*2+2] + seg_a[k*2+2]
    );
  }
 
  int query(int a, int b, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return seg_m[k] + seg_a[k];
    return max(query(a, b, k*2+1, l, (l+r)/2),
               query(a, b, k*2+2, (l+r)/2, r)) + seg_a[k];
  }
};
 
int N, M;
int L[200000], R[200000];
StarrySky seg;
 
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  vector<P> xs;
  rep(i, N) {
    cin >> L[i] >> R[i];
    xs.pb(P(L[i], R[i]));
  }
  sort(all(xs));
 
  rep(i, M+2) {
    seg.add(i, i+1, i);
  }
  int m = N+1;
  // m <- max(|X| + maxR-minL)
  rep(i, N) {
    int l = xs[i]._1, r = xs[i]._2;
    seg.add(0, r+1, 1);
    m = max(m, seg.query(0, M+2)-l);
  }
  cout << max(m-1-M, 0) << "\n";
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  if (s[0] == 'S') {
    cout << "Cloudy" << endl;
  } else if (s[0] == 'C') {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
  return 0;
}

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

typedef unsigned int U;
#define L 3194304
bool HA[L];
char T[256];

int main() {
    U n, sum, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    while ( getchar() != '\n' );
    for ( register U i = 0; i++ < n; ) {
        sum = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            sum += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[sum] = true;
        } else {
            puts( HA[sum] ? "yes" : "no" );
        }
    }
    return 0;
}

Measured memory_bytes: 2096
#include <iostream>
using namespace std;
int main(void){
    int sec = 0, min = 0, hour = 0;
    cin >> sec;
    
    hour = sec / ( 60*60 );
    min = ( sec % ( 60*60 ) ) / 60;
    sec = ( sec % ( 60*60 ) ) % 60;
    
    cout << hour << ":" << min << ":" << sec << endl;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int main()
{
    int n;
    cin >> n;
    std::vector<int> v(n);
    for (auto &i : v) cin >> i;
    sort(v.begin(), v.end());
    for (int i = 1; i <= 100; i++)
    {
        ll sum = 0;
        for (int j = 0; j < n; j++)
        {
            sum += ((i - v[j]) * (i - v[j]));
        }
        mod = min(mod, sum);
    }
    cout << mod << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a, b, c, d;
	scanf("%d %d %d", &a, &b, &c);
	d = b / a;
	if (d <= c)
	{
		printf("%d", d);
	}
	if (d > c)
	{
		printf("%d", c);
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<=n;i++)
#define RIP(i,a,b) for(int i=a;i<b;i++)
#define all(V) V.begin(),V.end()
#define MOD 1000000007
#define mod 998244353
#define inf MOD 
#define sec setprecision
#define Pair pair<ll,ll>
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
using ll = long long;
using ld = long double;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x) % mod, n / 2) % mod);
	else
		return (x * pow(x, n - 1)) % mod;
}
void solve() {

}
int main() {
	int a, b, c, d, e; cin >> a >> b >> c >> d >> e;
	int k; cin >> k;
	if (e - a > k)cout << ":(" << endl;
	else cout << "Yay!" << endl;
}


Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
main(){
  string s;
  int x=1000;
  cin>>s;
  for(int i=0;i<s.size()-2;++i){
    x=min(x,abs(753-stoi(s.substr(i,3))));
  }
  cout<<x;
}

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

void solve() {
	int n;
	string s;
	cin >> n >> s;
	if (n % 2 == 1) {
		cout << "No" << endl;
		return;
	}
	cout << (s.substr(0, n / 2) == s.substr(n / 2, n) ? "Yes" : "No") << endl;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include "stdio.h"
#define STACK_SIZE 2000
#define MAX_LEN 2000

int stack[STACK_SIZE];
int stack_size = 0;

// スタックから出す
int pop()
{
  if (stack_size <= 0) return 0;
  return stack[--stack_size];
}

// スタックに積む
int push(int a)
{
        stack[stack_size++] = a;
    
}

// 要素が数値かどうか判定
int is_digit(char *s)
{
  if (*s >= '0' && *s <= '9') return 1;
  return 0;
}

// 文字列から数値を取り出す
int get_number(char *s)
{
  int n = 0;

  // char to int
  while (*s >= '0' && *s <= '9') {
    n = n * 10 + (*s - '0');
    s++;
  }
  return n;
}

// 逆ポーランド記法の文字列を計算
int calc_rpn(char *s)
{
  int a, b, n;

  // 終端まで繰り返す
  while (*s) {

    // 数値なら取り出してスタックに積む
    if (is_digit(s)) {
      n = get_number(s);
      push(n);
      while (n) {
        n /= 10;
        s++;
      }

      // オペランドなら2項を計算する
    } else {
      switch (*s) {
      case '+':
        a = pop();
        b = pop();
        push(b+a);
        break;
      case '-':
        a = pop();
        b = pop();
        push(b-a);
        break;
      case '*':
        a = pop();
        b = pop();
        push(b*a);
        break;
      case '/':
        a = pop();
        b = pop();
        if (a == 0) break;
        push(b/a);
        break;
      }
      s++;
    }
  }
  return pop();
}

int main()
{
  char s[MAX_LEN];
  scanf("%[^\n]*s", s);
  printf("%d\n", calc_rpn(s));
}


Measured memory_bytes: 2128
#One Card Poker
def ABC_54_A():
    A,B = map(int, input().split())
    
    if A == 13 and B == 1:
        print('Bob')
    elif A == 1 and B == 13:
        print('Alice')
    elif A == B:
        print('Draw')
    elif A > B:
        print('Alice')
    else:
        print('Bob')


if __name__ == '__main__':

    ABC_54_A()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#define _USE_MATH_DEFINES
#include <cmath>
#include <set>
#include <unordered_set>
#include <iterator>
#include <deque>
#include <assert.h>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}


int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    
    int n;
    cin>>n;
    int a[n], b[n];
    for (int i = 0; i < n; ++i){
        cin>>a[i]>>b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    if (n&1){
        int l = a[n/2], r = b[n/2];
        int ans = max(0,r-l+1);
        cout<<ans<<"\n";
    }
    else{
        int l1 = a[(n-1)/2], r1 = b[(n-1)/2], l2 = a[n/2], r2 = b[n/2];
        int ans = max(0, r1+r2-l1-l2+1);
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 4724
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using ll = long long int;
using namespace std;

const int MOD = 1e9 + 7;

int main(){
    int n, x, y, z; cin >> n >> x >> y >> z;
    // cnt of [itr, state]
    // int dp[n][1LL << 18];
    vector<vector<ll>> dp(n, vector<ll>(1LL<<18, 0));
    // Initialize
    for(int i=0; i<10; i++){
        dp[0][1 << i] = 1;
    }
    for(int i=1; i<n; i++){
        for(ll j=0; j< (1LL<<18); j++){
            for(int k=1; k<11; k++){
                ll itr = (j << k) + (1 << (k-1));
                itr &= (1LL<<18) - 1;
                if(itr & 1<<(x+y+z-1) && itr & 1<<(y+z-1) && itr & 1<<(z-1)){
                    continue;
                }
                dp[i][itr] += dp[i-1][j];
                dp[i][itr] %= MOD;
            }
        }
    }
    ll ans = 0;
    for(int i=0; i< (1LL<<18); i++){
        ans += dp[n-1][i];
        ans %= MOD;
    }
    ll pown = 1;
    for(int i=0; i<n; i++){
        pown *= 10;
        pown %= MOD;
    }
    cout << (pown - ans + MOD) % MOD << endl;
    return 0;
}

Measured memory_bytes: 84352
#pragma GCC optimize ("Ofast")
#include <iostream>
#include <vector>
using namespace std;
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
#define print(x) cout << (x) << '\n'
#define all(v) (v).begin(), (v).end()
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define fi first
#define se second

const int MAX = 2e5;
const int MOD = 1e9 + 7;
int64 fac[MAX] = {}; int64 inv[MAX] = {}; int64 finv[MAX] = {};

void make_table(){
    fac[0] = 1; fac[1] = 1;
    finv[0] = 1; 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;
    }
}

int64 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;
}

vector<pll> prime_fact(int64 n){
    vector<pll> res;
    for (int64 i = 2; i * i <= n; ++i){
        if (n % i != 0) continue;
        int cnt = 0;
        while (n % i == 0){
            n /= i; ++cnt;
        }
        res.EB(i, cnt);
    }
    if (n != 1) res.EB(n, 1);
    return res;
}

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

  make_table();
  int64 n, m; cin >> n >> m;
  vector<pll> v = prime_fact(m);
  
  int64 ans = 1LL;
  
  for (auto x : v){
    ans = ans * com(x.se + n - 1, x.se) % MOD;
  }
  print(ans % MOD);

  return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i, j, k ,n,m,l,f;

	int ss, ts, rs;
	cin >> ss >> ts >> rs;
	f = 0;
	if(ss == 5 && ts == 5 && rs == 7) f = 1;
	if(ss == 5 && ts == 7 && rs == 5) f = 1;
	if(ss == 7 && ts == 5 && rs == 5) f = 1;

	if(f == 1) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
struct P{
	int x,y;//縦,横
};

char f[2000][2000];//フィールド
int H,W,N;
const int INF=100000000;
P chpt[10];
int t[2000][2000];//縦、横
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};

int main(){
	cin>>H>>W>>N;
	for(int i=0;i<H;i++){//縦
		cin>>f[i];
		for(int j=0;j<W;j++){//横
			if(f[i][j]=='S')	{chpt[0].x=i;chpt[0].y=j;}
			if(f[i][j]>48&&f[i][j]<58) {
				int n=f[i][j]-48;
				chpt[n].x=i;chpt[n].y=j;
			}
		}
	}
	int ans=0;//答えの時間
	for(int n=0;n<N;n++){//最短距離を求める
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				t[i][j]=INF;
			}
		}
		queue<P> nextp;
		P start={chpt[n].x,chpt[n].y};
		nextp.push(start);
		t[start.x][start.y]=0;
		
		while(!nextp.empty()){
			P cpt=nextp.front();
			nextp.pop();
			for(int i=0;i<4;i++){
				int nx=cpt.x+dx[i],ny=cpt.y+dy[i];
				if(nx>=0&&nx<H&&ny>=0&&ny<W&&f[nx][ny]!='X'&&t[nx][ny]==INF){
					t[nx][ny]=t[cpt.x][cpt.y]+1;
					P npt={nx,ny};
					nextp.push(npt);
				}
			}
		}
		ans+=t[chpt[n+1].x][chpt[n+1].y];
	}
	cout <<ans<<endl;
}

Measured memory_bytes: 13500
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>

using namespace std;
using namespace std::chrono;

/*
#define trav(a, v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
*/

typedef long long ll;
typedef long double ld;

ll big = 1000000007ll;
ll n,m,k,r;
ll nt;
ll T;


ll solve(ll i2, ll l2, ll j2, ll o){

    ll i = i2;
    ll j = j2;
    ll l = l2;
    ll ans = 0;
    
    if(j%2 == 1 && l%2 == 1 && i > 0){
        
        ans += 6ll;
        i--;
        j--;
        l--;
        
    }
    
    ans += 4ll * (i/2);
    i = i%2;
    if(l > 0 && j > 0 && i > 0 && !(l%2 == 0 && j%2 == 0)){
        ans += 6ll;
        l--;
        j--;
        i--;
    }
    ans += (j/2) * 4ll;
    ans += (l/2) * 4ll;
    ans += 2ll*o;
    return ans;

}

int main()
{

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll c1,c2,c3,c4,c5,c6;
    ll a,b,c,d,e;

        cin >> c1 >> c2 >> c3 >> c4 >> c5 >>c6 >> a;
        a = c1;
        b = c5;
        c = c4;
        d = c2;
        cout << solve(a , b , c , d)/2 << "\n";
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int N;
    string S;
    cin >> N >> S;

    vector<int> R, G, B;
    for(int i=0; i<N; i++) {
        if(S[i] == 'R') {
            R.push_back(i);
        } else if(S[i] == 'G') {
            G.push_back(i);
        } else {
            B.push_back(i);
        }
    }

    int64_t ans = R.size() * G.size() * B.size();
    for(int i=0; i<N; i++) {
        for(int j=1; j<N; j++) {
            if(i-j<0 || i+j>=N) continue;
            if(S[i] != S[i-j] && S[i] != S[i+j] && S[i-j] != S[i+j]) --ans;
        }
    }

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


Measured memory_bytes: 3640
#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;

typedef pair<int,int> pii;

char fl[128][128];
int tm[128][128];

int main(){
	const int INF = 1000000000;
	fill(*tm, *tm + sizeof(tm) / sizeof(int), INF);

	const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
	const int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};

	int h, w;
	scanf("%d%d", &w, &h);

	queue<int> q;
	vector<int> ms(2);
	for(int i = 1; i <= h; ++i){
		scanf(" %s", fl[i] + 1);
		for(int j = 1; j <= w; ++j){
			if(fl[i][j] == '#'){
				q.push(i << 8 | j);
			}
			else{
				tm[i][j] = 1;

				if(fl[i][j] == 'M'){
					fl[i][j] = '0' + ms.size();
					ms.push_back(i << 8 | j);
				}
				else if(fl[i][j] == 'S'){
					ms[0] = i << 8 | j;
					fl[i][j] = '0';
				}
				else if(fl[i][j] == 'G'){
					ms[1] = i << 8 | j;
					fl[i][j] = '1';
				}
			}
		}
	}

	q.push(-1);
	int cnt = 3;
	while(cnt > 1){
		if(q.front() == -1){
			--cnt;
			q.pop();
			q.push(-1);
		}
		else{
			int y = q.front() >> 8, x = q.front() & 0xff;
			q.pop();
			for(int i = 0; i < 8; ++i){
				int ny = y + dy[i], nx = x + dx[i];
				if(tm[ny][nx] < cnt){
					tm[ny][nx] = cnt;
					q.push(ny << 8 | nx);
				}
			}
		}
	}

	priority_queue<pii> pq;
	vector<vector<int> > ds(ms.size(), vector<int>(ms.size()));
	for(size_t m = 0; m < ms.size(); ++m){
		vector<int> md(1 << 16, INF);
		md[ms[m]] = 0;
		pq.push(pii(0, ms[m]));
		while(!pq.empty()){
			int d = -pq.top().first;
			int ps = pq.top().second;
			pq.pop();
			if(md[ps] != d){ continue; }

			int y = ps >> 8, x = ps & 0xff;
			if(isdigit(fl[y][x])){
				ds[m][fl[y][x] - '0'] = d;
			}

			for(int i = 0; i < 4; ++i){
				int ny = y + dy[i], nx = x + dx[i];
				if(tm[ny][nx] == INF){ continue; }
				int nd = d + tm[y][x];
				int np = ny << 8 | nx;
				if(md[np] > nd){
					md[np] = nd;
					pq.push(pii(-nd, np));
				}
			}
		}
	}


	const int sz = 1 << ms.size();
	vector<vector<int> > dp(ms.size(), vector<int>(sz, INF));
	dp[0][1] = 0;
	for(int S = 0; S < sz; ++S){
		for(int i = ms.size(); i--; ){
			if(!(S >> i & 1)){ continue; }
			for(int j = ms.size(); j--; ){
				if(S >> j & 1){ continue; }
				int &r = dp[j][S | 1 << j];
				r = min(r, dp[i][S] + ds[i][j]);
			}
		}
	}

	printf("%d\n", dp[1].back());
}

Measured memory_bytes: 1412
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();
            if (s.length() == 3)
                for (int i = 2; i >= 0; i--)
                    out.print(s.charAt(i));
            else
                out.print(s);
            out.print("\n");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



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

using namespace std;
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using vi = vector<int>;
using lint = long long;
int main() {
	int A, B, M, p;
	cin >> A >> B >> M;
	vi av(A), bv(B);
	map<vector<int>,int> coupon;
	vector<vi> cp;

	rep(i, A) {
		cin >> p;
		av.at(i) = p;
	}
	rep(i, B) {
		cin >> p;
		bv.at(i) = p;
	}
	int x, y, v;
	rep(i, M) {
		cin >> x >> y >> v;
		if (coupon.count({ x,y }) && v < coupon.at({ x,y }))
			continue;
		coupon[{x, y}] = v;
		cp.push_back({ x,y });
	}
	int avlow = 100000, bvlow = 100000;
	rep(i, A) {
		if (av.at(i) < avlow) {
			avlow = av.at(i);
		}
	}
	rep(i, B) {
		if (bv.at(i) < bvlow) {
			bvlow = bv.at(i);
		}
	}
	int lowsum = avlow + bvlow;
	int sum;
	rep(i, cp.size()) {
		sum = av.at(cp.at(i).at(0) - 1) + bv.at(cp.at(i).at(1) - 1) - coupon.at(cp.at(i));
		if (sum < lowsum) {
			lowsum = sum;
		}
	}
	cou(lowsum);
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<bool> > exist(4,vector<bool>(13,false));
    int n; cin>>n;
    rep(i,n){
        char c; int m; cin>>c>>m; m--;
        if (c=='S') exist[0][m]=true;
        if (c=='H') exist[1][m]=true;
        if (c=='C') exist[2][m]=true;
        if (c=='D') exist[3][m]=true;
    }
    rep(i,4)rep(j,13){
        if (!exist[i][j]){
            if (i==0) cout<<"S "<<j+1<<"\n";
            if (i==1) cout<<"H "<<j+1<<"\n";
            if (i==2) cout<<"C "<<j+1<<"\n";
            if (i==3) cout<<"D "<<j+1<<"\n";
        }
    }
    return 0;
}



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

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a,b;
    a=divisor(n);
    b=divisor(n-1);
    ll ans = 0;
    for (ll c : a){
        ll x = n;
        if(c==1) {continue;}
        else{
            while(x%c==0){
                x = x/c;
            }
            if(x%c==1){
                ans++;
            }
        }
    }
    ans+=(b.size()-1);
    cout << ans <<endl;
}

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

int main(){
    cout <<fixed <<setprecision(12);
    
    double r;
    cin>>r;
    double PI = acos(-1);
    double area = r*r*PI;
    double cir = (r+r)*PI;
    cout<<area<<" "<<cir<<endl;
    
    return 0;
}


Measured memory_bytes: 3260
#include <iostream>

using namespace std;

void insertionSort(int* A, int N)
{
	for (int k = 0; k < N; k++)
	{
		if (k != 0) cout << " ";
		cout<< A[k];
	}

	cout << endl;

	for (int i = 1; i < N; i++)
	{
		int v = A[i];
		int j = i - 1;
		
		while (j >= 0 && A[j] > v)
		{
			A[j + 1] = A[j];

			j--;
		}

		A[j + 1] = v;

		for (int k = 0; k < N; k++)
		{
			if (k != 0) cout << " ";
			cout << A[k];
		}

		cout << endl;
	}
}

int main() 
{
	int N;
	int A[100];

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	insertionSort(A, N);
	/*
	for (int i = 0; i < N; i++)
	{
		cout << A[i] << " ";
	}

	cout << endl;
	*/
	return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
 
typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
 
#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}
 
ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}
 
ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return 
      abs(u.f - v.f)  + abs(u.se - v.se);
}
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return 
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}
 
 
 
/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++; 
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 10009;

int main()
{
    IO;
	char a,b;
	cin>>a>>b;
	int bb = b- '0';
	int aa = a-'0';
	string s1 = string(bb, a);
	string s2 = string(aa, b);
	cout<<min(s1,s2);
	
	
	return 0;
}



















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

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

int n;
char s[104];

int A(void){
	rep(i,n) if(s[i] == '#') return i;
	return -1;
}

int B(void){
	for(int i=n-1;i>=0;i--){
		if(s[i] == '#'){
			int l = i - 1;
			int r = i + 1;
			if(l >= 0 && s[l] == 'A') continue;
			if(r < n && s[r] == 'A') continue;

			return i;
		}
	}

	return -1;
}

int C(void){
	rep(i,n){
		if(s[i] != '#'){
			int l = i - 1;
			int r = i + 1;
			if(r < n && s[r] == '#') return r;
			if(l >= 0 && s[l] == '#') return l;
		}
	}

	return -1;
}

int D(void){
	int res = -1;
	int maxDist = 0;

	rep(i,n){
		if(s[i] == '#'){
			int ldist;
			int rdist;

			for(ldist=i-1;ldist>=0 && s[ldist]=='#';ldist--);
			for(rdist=i+1;rdist<n && s[rdist]=='#';rdist++);

			if(ldist < 0) ldist = i;
			if(rdist >= n) rdist = i;

			ldist = i - ldist;
			rdist = rdist - i;

			if(maxDist < min(ldist==0?999:ldist,rdist==0?999:rdist)){
				res = i;
				maxDist = min(ldist==0?999:ldist,rdist==0?999:rdist);
			}
		}
	}

	return res;
}

int main(void){
	int m;

	while(cin>>n>>m && (n||m)){
		memset(s,'#',sizeof(s));

		rep(i,m){
			int idx;
			char ch;
			cin>>ch;

			switch(ch){
			case 'A':
				s[A()] = 'A';
				break;
			case 'B':
				idx = B();
				s[(idx == -1 ? A() : idx)] = 'B';
				break;
			case 'C':
				idx = C();
				s[(idx == -1 ? n/2 : idx)] = 'C';
				break;
			case 'D':
				s[(i == 0 ? 0 : D())] = 'D';
				break;
			}
		}

		rep(i,n) cout<<s[i];
		cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
import sys
a=sys.stdin.readline()
res = [int(i) for i in a.split() if i.isdigit()] 
A,P = [res[i] for i in (0,1)]
if type(A)==int and type(P)==int and (A>=0 and A<=100) and (P>=0 and P<=100):
    Pieces=P+(A*3)
    Pies=Pieces//2
    print(Pies)
else:
    print("Error")

Measured memory_bytes: 3060
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k = m()

a = l()

po = gcd_list(a)

fl = 0

for i in range(n):
    if a[i] >= k and (a[i]-k) % po == 0:
        fl = 1
if fl:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")



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

using namespace std;

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

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

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

    long long res = -(1LL << 61);
    for (int i = 0; i < n; i++) {
        vector<int> q(0);
        vector<bool> r(n, true);

        for (int j = i; r[j]; j = p[j]) {
            q.push_back(j);
            r[j] = false;
        }

        int s = q.size();

        vector<long long> d(s, 0);
        for (int j = 0; j < s; j++) {
            d[(j + 1) % s] = d[j] + c[q[(j + 1) % s]];
        }

        for (int j = 0; j < min(k, s); j++) {
            res = max({ res, d[(j + 1) % s], d[(j + 1) % s] + d[0] * (k / s - (j < k % s ? 0 : 1)) });
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3748
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    S=list(map(int,input().split()))
    T=list(map(int,input().split()))
    C=[[0]*(m+1) for _ in range(n+1)]
    from itertools import product
    for i,j in product(range(n),range(m)):
        dp=C[i][j]+1 if(S[i]==T[j]) else 0
        C[i+1][j+1]=dp+C[i][j+1]+C[i+1][j]-C[i][j]
        C[i+1][j+1]%=MOD
    print(C[n][m]+1)
resolve()

Measured memory_bytes: 72412
#include <iostream>

using namespace std;

int main(){
	long long n = 0, count = 0, last = 0;
	cin >> n;
	for(int i = 0;i < n; ++i){
		int x;
		cin >> x;
		if(x >= last){
			last = x;
			}
		else{
			count += (last - x);
			}
		}
	cout << count;
	return 0;
	}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>

#define N 100000

typedef long long int int64;

int max(int64 x, int64 y){
	if(x >= y) return x;
	return y;
}

int min(int64 x, int64 y){
	if(x <= y) return x;
	return y;
}

int main(void){
	int64 n, a, b;
	int64 x[N], sum=0;
	int i;

	scanf("%lld %lld %lld", &n ,&a, &b);
	for(i=0; i<n; i++){
		scanf("%lld", &x[i]);
	}

	for(i=0; i<n-1; i++){
		sum += min((x[i+1]-x[i])*a, b);
	}

	printf("%lld\n", sum);

	return 0;
}

Measured memory_bytes: 896