akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for(int i = (int)(n); i > 0; --i)
#define all(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rall(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)
#define sz(a) (int)(a).size()
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n;
void solve() {
    cin >> n;

    rep(i, n) {
        for (int j = i + 1; j < n; ++j) {
            auto bit = i ^ j;
            bit = bit & (-bit);
            int cnt = 0;
            while (bit != 0) {
                ++cnt;
                bit >>= 1;
            }

            cout << cnt << " ";
        }
        cout << endl;
    }

    return;
}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    solve();

    return 0;
}


Measured memory_bytes: 512
if __name__ == '__main__':
    k, n = tuple([int(i) for i in input().split()])
    distances = [int(i) for i in input().split()]

    between = [0] * len(distances)
    between[0] = distances[0] + k - distances[-1]

    mx = 0
    for i in range(1, len(distances)):
        between[i] = distances[i] - distances[i - 1]
        mx = max(mx, between[i])

    total = sum(between)
    res = total
    for i in range(len(between)):
        res = min(res, total - between[i])

    print(res)


Measured memory_bytes: 26444
def solve(x,s,t)
  a = (0..A-1).bsearch{|i| s[i] >= x}
  b = (0..B-1).bsearch{|i| t[i] >= x}
  a = A if !a
  b = B if !b
  v = []
  v << t[b]-s[a-1] + [x-s[a-1],t[b]-x].min if a > 0 && b < B
  v << s[a]-t[b-1] + [s[a]-x,x-t[b-1]].min if a < A && b > 0
  v << x - [s[a-1],t[b-1]].min if a > 0 && b > 0
  v << [s[a],t[b]].max - x if a < A && b < B
  return v.min
end

A,B,Q = gets.split.map(&:to_i)
s,t=[],[]
A.times do
  s << gets.to_i
end

B.times do
  t << gets.to_i
end
s.sort!
t.sort!
Q.times do
  x = gets.to_i
  p solve(x,s,t)
end

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

int main() {
  
  int N; cin >> N;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  vector<int> sortedVec = vec;
  
  sort(sortedVec.begin(), sortedVec.end());
  
  int leftSide = sortedVec.at(vec.size() / 2 - 1);
  
  int rightSide = sortedVec.at(vec.size() / 2);
  
  for (int i = 0; i < N; i++) {
    
    int tmp = vec[i];
    
    if (tmp <= leftSide) cout << rightSide << endl;
    
    else cout << leftSide << endl;
    
  }
  
}

Measured memory_bytes: 4828
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> ans(n);
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(m);
  vector<int> d(m);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  for(int i=0;i<m;i++){
    cin>>c[i]>>d[i];
  }
  for(int i=0;i<n;i++){
    int manhattan=400000002;
    for(int j=0;j<m;j++){
      if(abs(a[i]-c[j])+abs(b[i]-d[j])<manhattan){manhattan=abs(a[i]-c[j])+abs(b[i]-d[j]);ans[i]=j+1;}
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
const ll INF = 10010001010;
const int inf = 1000034000;
typedef vector<ll> vecl;
typedef vector<int> veci;
typedef tuple<string, int, int> TUP;

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

uintmax_t combination(unsigned int n, unsigned int r)
{
    if (r * 2 > n)
        r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor = 1;
    for (unsigned int i = 1; i <= r; ++i)
    {
        dividend *= (n - i + 1);
        divisor *= i;
    }
    return dividend / divisor;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    int N,K,R,S,P;
    cin >> N >> K >> R >> S >> P;
    string T;
    cin >> T;
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        if(i < K){
            if(T[i] == 'r'){
                ans += P;
            }
            else if(T[i] == 's'){
                ans += R;
            }
            else{
                ans += S;
            }
        }
        else{
            if(T[i] == T[i-K]){
                T[i] = 'x';
            }
            else{
                if (T[i] == 'r')
                {
                    ans += P;
                }
                else if (T[i] == 's')
                {
                    ans += R;
                }
                else
                {
                    ans += S;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>

using namespace std;

int main(){
	int n;cin>>n;
	int histgram[6];
	memset(histgram,0,sizeof(histgram));
	for(int i = 0; i < n; i++){
		double t;
		cin>>t;
		if(t<165){
			histgram[0]++;
		}
		else if(t>=185){
			histgram[5]++;
		}
		else{
			t-=165;
			histgram[(int)(t/5)+1]++;
		}
	}
	for(int i = 0; i < 6; i++){
		cout<<i+1<<":";
		for(int j = 0; j < histgram[i]; j++){
			cout<<"*";
		}
		cout<<endl;
	}

	return 0;
}

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

using namespace std;
typedef long long ll;
struct player {
	ll x;
	ll b;
};

const int MAXN = 100100;
player A[MAXN];

bool player_compare(player p1, player p2) {
	return (p1.x + p1.b) < (p2.x + p2.b);
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);	
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x, b; cin >> x >> b;
		player p;
		p.x = x;
		p.b = b;
		A[i] = p;	
	}
	sort(A, A+n, player_compare);
	int total = 1;
	int i = 1;
	int right = A[0].x + A[0].b;
	while (i < n) {
		if (A[i].x - A[i].b >= right) {
			total++;
			right = A[i].x + A[i].b;
		}
		i++;		
	}	
	cout << total << "\n";
}



Measured memory_bytes: 1792
from collections import deque

N,M,K = map(int,input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int,input().split())) for _ in range(K)]

f = [set() for _ in range(N+1)]
b = [set() for _ in range(N+1)]

for i,j in friend:
    f[i].add(j)
    f[j].add(i)
for i,j in block:
    b[i].add(j)
    b[j].add(i)

stack=deque()
ans = [0]*(N+1)
visited = [0]*(N+1)

for i in range(1,N+1):
    if visited[i]:
        continue
    link = {i}
    visited[i] = 1 
    stack.append(i)
    while stack:
        n = stack.pop()
        for j in f[n]:
            if j in f[n] and visited[j]==0:
                stack.append(j)
                visited[j] = 1
                link.add(j)
    for i in link:
        ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1
print(*ans[1:])


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

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    char c = s[5];
    char d = s[6];
    if(c == '0' && 1 <= d - '0' && d - '0' <= 4){
      cout<<"Heisei"<<endl;
    }
    else{
      cout<<"TBD"<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)


int main() {
	long long int n;
	
	cin >> n;
	n = n-1;
	long long int i = 0;
	string s;
	while(n >= 0){
		i = n % 26;
		n = (n-i)/26 - 1;
		char c = 'a';
		c += i;
		s.push_back(c);
	}
	string ans;
	rep(i,(int)(s.length())){
		ans.push_back(s[(int)(s.length())-1 - i]);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
using namespace std;
 
int main()
{
   	char a[100];
	int ans;
	scanf("%s",a);
	if(strlen(a)==1) ans=a[0]-'0';
	else if ( a[strlen(a)-1]=='9') ans=(strlen(a)-1)*9+a[0]-'0';
		else ans=(strlen(a)-1)*9+a[0]-'0'-1;
	printf("%d\n",ans);
   return 0;
}

Measured memory_bytes: 128
N, M = map(int, input().split())
X_list = list(map(int, input().split()))
X_list.sort()
err_list = [X_list[i+1] - X_list[i] for i in range(len(X_list)-1)]
err_list.sort()

if N == 1:
    print(sum(err_list))
else:
    print(sum(err_list[:-(N-1)]))


Measured memory_bytes: 13960
#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#include <random>
#include <fstream>
#include <string>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <stack>

#define REP(i, N) for(int i = 0; i< N; i++)
using namespace std;
#define ll long long
const int INF = 1 << 29;
const ll llINF = 10000000000000000;

const int MOD = 1000000007;

#define MAX_N 100100
typedef pair<int, int> P;
typedef pair<ll, ll> llP;

class UnionFindTree{
private:
    int par[MAX_N];
    int urank[MAX_N];
    int size[MAX_N];
public:
    int init(int n);
    int find(int x);
    int unite(int x, int y);
    int same(int x, int y);
    int parnum(int x){return par[x];}
    int ranknum(int x){return urank[x];}
    int sizenum(int x){return size[find(x)];}
};

int UnionFindTree::init(int n){
    REP(i, n){
        par[i] = i;
        urank[i] = 0;
        size[i] = 1;
    }
    return 0;
}

int UnionFindTree::find(int x){
    if(par[x] == x)return x;
    else return par[x] = find(par[x]);
}

int UnionFindTree::unite(int x, int y){
    x = find(x);
    y = find(y);
    
    if(x == y)return 0;
    if(urank[x] < urank[y]){
        par[x] = y;
        size[y] += size[x];
    }else{
        par[y] = x;
        size[x] += size[y];
        if(urank[x] == urank[y])urank[x] ++;
    }
    return 0;
}

int UnionFindTree::same(int x, int y){
    return find(x) == find(y);
}


int main(){
    int W, H;
    cin >> H >> W;
    bool tate[110] = {false};
    bool yoko[110] = {false};
    char masu[110][110];
    REP(i, H){
        REP(j,W){
            cin >> masu[i][j];
            if(masu[i][j] == '#'){
                tate[j] = true;
                yoko[i] = true;
            }
        }
    }
    
    REP(i, H){
        REP(j, W){
            if(tate[j] && yoko[i])printf("%c", masu[i][j]);
        }
        if(yoko[i])printf("\n");
    }
}


Measured memory_bytes: 888
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
const llint mod=1000000007;//ここを変えるとよい 
const llint big=1e17+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=0.0000000001;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<lldo>&ar,lldo in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<lldo>&ar,lldo in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,j,n;cin>>n;
	llint ans=0,L;cin>>L;
	vector<llint>x(n+1);for(i=1;i<=n;i++){cin>>x[i];}
	vector<int>eki(n+1);//0->x 1-> > 2-> < 3-> o
	for(i=1;i<=n;i++){
		llint t;cin>>t;
		ans+=t/(L*2);
		t%=(L*2);
		if(t==0){eki[i]=3;continue;}
		if(t<=x[i]*2&&t<=(L-x[i])*2){eki[i]=0;}
		if(t> x[i]*2&&t<=(L-x[i])*2){eki[i]=1;}
		if(t<=x[i]*2&&t> (L-x[i])*2){eki[i]=2;}
		if(t> x[i]*2&&t> (L-x[i])*2){ans++;eki[i]=3;}
		//cerr<<eki[i];
	}
	//cerr<<endl;
	vector<int>den(n+2);
	deque<int>xlis;
	for(i=1;i<=n;i++){
		if(eki[i]==0){xlis.pub(i);}
		if(eki[i]==1){
			if(xlis.size()>0){
				den[xlis.front()]++;
				xlis.pof();
				den[i]--;
				ans++;
			}else{
				den[0]++;
				den[i]--;
				ans++;
			}
		}
	}
	xlis.clear();
	for(i=n;i>=1;i--){
		if(eki[i]==0){xlis.pub(i);}
		if(eki[i]==2){
			if(xlis.size()>0){
				den[xlis.front()]--;
				xlis.pof();
				den[i]++;
				ans++;
			}else{
				den[n+1]--;
				den[i]++;
				ans++;
			}
		}
	}
	int xnum=0;
	for(i=1;i<=n;i++){
		if(den[i]==0&&eki[i]==0){xnum++;}
	}
	int xxx=0,xman=-1;
	for(i=1;i<=n;i++){
		if(den[i]==0&&eki[i]==0){
			if(xxx*2+1==xnum){xman=i;}
			if(xxx*2+1<xnum){den[i]++;}
			if(xxx*2+1>xnum){den[i]--;}
			xxx++;
		}
	}
	ans+=(xnum+1)/2;
	if(xman==-1){
		int gen=0;
		for(i=0;i<n;i++){
			gen+=den[i];
			if(gen<=0){ans++;break;}
		}
		cout<<ans*L*2<<endl;
	}else{
		int dme=0;
		den[0]++;
		den[xman]--;
		int gen=0;
		for(i=0;i<n;i++){
			gen+=den[i];
			if(gen<=0){dme++;break;}
		}
		den[0]--;
		den[xman]-=2;
		den[n+1]++;
		gen=0;
		for(i=0;i<n;i++){
			gen+=den[i];
			if(gen<=0){dme++;break;}
		}
		if(dme==2){ans++;}
		cout<<ans*L*2<<endl;
	}
	return 0;
}

Measured memory_bytes: 6220
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long T = GetLong();
		WriteLine(string.Join("\n", Range(0, T).Select(_ => solve())));
	}

	private long solve()
	{
		long N = GetLong();
		var A = GetLongs(N);
		var S = GetString().Select(x => (long)(x - '0')).ToArray();

		var list = new List<long>();
		for(long i = N - 1; i >= 0; i--)
		{
			list.Sort((x, y) => y.CompareTo(x));
			long v = A[i];
			foreach(var e in list)
				chmin(ref v, v ^ e);

			if(v > 0)
			{
				if(S[i] == 0)
					list.Add(v);
				else
					return 1;
			}
		}
		return 0;
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 32040
N=int(input())
numbers = {2: 0, 3: 0, 5: 0,7: 0, 11: 0, 13: 0, 17: 0, 19: 0, 23: 0, 29: 0, 31: 0, 37: 0, 41: 0, 43: 0, 47: 0, 53: 0, 59: 0, 61: 0, 67: 0, 71: 0, 73: 0, 79: 0, 83: 0, 89: 0, 97: 0}
prime = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)
for n in range(2,N+1):
    a=n
    while(a!=1):
        for j in prime:
            if(a%j==0):
                numbers[j]+=1
                a/=j
n75 = 0
n25 = 0
n15 = 0
n5=0
n3 = 0 
for i in numbers.values():
    if i>=74:
        n75+=1
    if i>=24:
        n25+=1
    if i>=14:
        n15+=1
    if i>= 4:
        n5+=1
    if i>=2:
        n3+=1
ans = n75+n25*(n3-1)+n15*(n5-1)+n5*(n5-1)//2*(n3-2)
print(str(ans)+"\n")


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef pair<int, int> pii;
const pii invalid(-100, -100);
const pii neutral(-1, -1);
pii merge(const pii &a, const pii &b){
    if(a.second + 1 == b.first){
        return pii(a.first, b.second);
    }
    return invalid;
}

int main(){
    int n,k,t;
    cin >> n >> k >> t;
    const int siz = 512;
    vector<pii> bucket(n/siz + 1, neutral);
    vector<pii> cell(n, pii(0, 0));
    for(int i=0; i<t; i++){
        int l,r,x;
        cin >> l >> r >> x;
        l--; //[l, r), 0-idx
        int lmin=l-l%siz, rmin=r-1-(r-1)%siz;
        int lmax=lmin+siz, rmax=rmin+siz;
        vector<pii> range{pii(lmin, lmax)};
        if(lmin < rmin){
            range.emplace_back(rmin, rmax);
        }
        for(auto ra: range){
            for(int j=ra.first; j<ra.second; j++){
                if(bucket[j/siz] != neutral){
                    cell[j] = merge(cell[j], bucket[j/siz]);
                }
                if(l<=j and j<r){
                    cell[j] = merge(cell[j], pii(x, x));
                }
            }
            bucket[ra.first/siz] = neutral;
        }
        for(int j=lmax/siz; j<rmin/siz; j++){
            if(bucket[j] == neutral){
                bucket[j] = pii(x, x);
            }else{
                bucket[j] = merge(bucket[j], pii(x, x));
            }
        }
    }

    int ans = 0;
    for(int i=0; i<n; i++){
        if(bucket[i/siz] != neutral){
            cell[i] = merge(cell[i], bucket[i/siz]);
        }
        if(cell[i] == pii(0, k)){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4424
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int gcd(int a,int b)
{
    if(a%b==0){
        return b;
    }else{
        return gcd(b,a%b);
    }
}

int main()
{
    int n,K;
    cin >> n >> K;
    vector<ll> vec(n);
    rep(i,n){
        cin >> vec[i];
    }
    sort(all(vec));
    int h = vec[0];
    rep(i,n-1){
        h = gcd(h,vec[i+1]);
    }
    if(K % h == 0 && K <= vec[n-1]){
        cout << "POSSIBLE\n";
    }else{
        cout << "IMPOSSIBLE\n";
    }
    return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
D - Practical Skill Test
https://beta.atcoder.jp/contests/abc089/tasks/abc089_d

"""
import sys
from sys import stdin
input = stdin.readline


def sub_solve(l, r):
    sx, sy = numbers[l]
    gx, gy = numbers[r]
    return abs(sx - gx) + abs(sy - gy)


def solve(queries, H, W, D):
    dp = [0] * (H*W+1)
    for i in range(D+1, H*W+1):
        dp[i] = dp[i-D] + sub_solve(i-D, i)

    for l, r in queries:
        ans = dp[r] - dp[l]
        print(ans)


numbers = dict()
def main(args):
    global numbers
    H, W, D = map(int, input().split())

    for y in range(1, H+1):
        tmp = [int(x) for x in input().split()]
        for x, i in enumerate(tmp, start=1):
            numbers[i] = (x, y)

    Q = int(input())
    queries = []
    for _ in range(Q):
        queries.append([int(x) for x in input().split()])

    solve(queries, H, W, D)


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 40696
#include <iostream>

using namespace std;

int main()
{
    int n, ok=0, a=4;
    cin>>n;
    while (ok==0){
        if(n==4 || n==2 || n==1){
            cout<<a;
            ok=1;
        }
        else{
            a++;
        }
        if(n%2==0){
            n/=2;
        }
        else{
            n=n*3+1;
        }
    }

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

for i in range(n):
    a, b = ab[i][0], ab[i][1]
    minNum, minCnt = 0, -1
    for j in range(m):
        c, d = cd[j][0], cd[j][1]
        abcdLen = abs(a-c) + abs(b-d)
        if minCnt == -1 or minCnt > abcdLen:
            minCnt, minNum = abcdLen, j + 1
    print(minNum)


Measured memory_bytes: 3064
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll; 
const int N = 2e5+5;

ll a[N],b[N];

int main()
{	
	ll n,m,x,k;
	scanf("%lld%lld%lld",&n,&m,&k);
	a[0] = b[0] = 0;
	
	for(int i = 1;i <= n;++i) scanf("%lld",&x),a[i] = a[i-1] + x;
	for(int i = 1;i <= m;++i) scanf("%lld",&x),b[i] = b[i-1] + x;
	
	ll res,num,ans = 0;
	for(int i = 1;i <= n;++i){
		if(a[i] > k){
			num = 0;
			res = k;
		}
		else{
			num = i;
			res = k-a[i];
		}
		
		ll pos = lower_bound(b+1,b+m+1,res)-b;
		while((b[pos] > res && pos > 0) || pos > m) pos--;
		ans = max(ans,num+pos);
	}
	for(int i = 1;i <= m;++i){
		if(b[i] > k){
			num = 0;
			res = k;
		}
		else{
			num = i;
			res = k-b[i];
		}
		
		ll pos = lower_bound(a+1,a+n+1,res)-a;
		while((a[pos] > res && pos > 0) || pos > n) pos--;
		ans = max(ans,num+pos);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 6896
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<double >    vecd;
typedef vector<vector<int> >  vec2int;
typedef vector<vector<double> >  vec2d;
typedef vector<ll >     vecll;
typedef vector<string > vecstr;
typedef vector<bool > vecbool;
typedef vector<vector< bool > > vec2bool;
typedef vector<bool > vecbool;
////////////////////////////////////////////////
int sumdig(string a)
{
  int res = 0;
  REP(i,a.size()){
    res += a[i] - '0';
  }
  return res;
}
int main()
{
  int n; cin >> n;
  int ans = 1e9;
  for(int i = 1; i <= n - 1; i++){
    string s = to_string(i);
    string t = to_string(n - i);
    int tmp = sumdig(s) + sumdig(t);
    ans = min(tmp, ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: String,
    };
    if s.len() == 1 {
        println!("0");
        return;
    }
    let mut ret1 = 0;
    let mut ret2 = 0;
    for (i,c) in s.chars().enumerate() {
        if (i%2==0 && c=='0') || (i%2==1 && c=='1') {
            ret1 += 1;
        }
    }
    for (i,c) in s.chars().enumerate() {
        if (i%2==0 && c=='1') || (i%2==1 && c=='0') {
            ret2 += 1;
        }
    }

    println!("{}", std::cmp::min(ret1,ret2));

}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    map<ll,ll> mp1, mpN;
    rep(i,0,M){
        ll a,b;
        cin >> a >> b;
        a--; b--;
        if(a > b) swap(a,b);
        if(a == 0) mp1[b]++;
        if(b == N-1) mpN[a]++;
    }
    bool ans = false;
    rep(i,1,N-1){
        if(mp1[i] > 0 && mpN[i] > 0) ans = true;
    }
    if(ans){
        print("POSSIBLE");
    }else{
        print("IMPOSSIBLE");
    }
    
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT

signed main() {
  ll N, M;
  cin >> N >> M;
  if (N%2 == 0) {
    set<int> s;
    for (int i = 1; i <= M; i++) {
      int j = N + 1 - i;
      if (s.find(j-i) != s.end() || (j-i) == N-(j-i)) {
        j--;
      }
      s.insert(j-i);
      s.insert(N-(j-i));
      cout << j << " " << i << endl;
    }
  } else {
    for (int i = 1; i <= M; i++) {
      int j = N + 1 - i;
      cout << j << " " << i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 9952
from math import gcd
k=int(input())
a=[0]*k
b=[0]*(k*k)
c=[0]*(k*k*k)
for i in range(k):
  a[i]=i+1
for i in range(k):
  for j in range(k):
    b[k*i+j]=gcd(a[i],j+1)
for i in range(k):
  for j in range(k):
    for l in range(k):
      c[k*k*i+k*j+l]=gcd(b[k*i+j],l+1)
print(sum(c))


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

int main(){
  int N, M, sum = 0; cin >> N >> M;
  for(int i = 0; i < M; i++)
  {int a; cin >> a; sum = sum + a;}
if(N >= sum){cout << N - sum;}
else{cout << "-1";}

return 0;
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main(void){
	int n, m, co[1000] = { 0 }, i, j;
	char a[1000] = { 0 }, b[1000] = { 0 }, c[100011] = { 0 };
	while (1){
		cin >> n;
		if (n == 0){ break; }
		for (i = 0; i < n; i++){
			cin >> a[i] >> b[i];
			co[i] = 1;
		}
		cin >> m;
		for (j = 0; j < m; j++){
			cin >> c[j];
			for (i = 0; i < n; i++){
				if (c[j] == a[i]){
					c[j] = b[i];
					co[i] = 0;
					break;
				}
			}
		}
		for (j = 0; j < m; j++){
			cout << c[j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int ans = 0;
		for(int i = 0; i < 1000; i++) {
			String pass = String.format("%03d", i);
			int c = 0;
			for(int j = 0; j < n; j++) {
				if(s.charAt(j) == pass.charAt(c))c++;
				if(c == 3) {
					ans++;
					break;
				}
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 27888
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> H(N);
  for (int64_t i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  sort(H.begin(), H.end());
  int64_t result = 0;
  for (int64_t i = 0; i < N - K; i++) {
    result += H.at(i);
  }
  cout << result << endl;
}

Measured memory_bytes: 1792
al = [chr(i) for i in range(65,65+26)]
H, W = list(map(int, input().split()))
S = []
for i in range(H):
	S.append(list(input().split()))
for i in range(H):
	for j in range(W):
		if S[i][j] == "snuke":
			print(al[j] + str(i + 1))


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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  i64 x;
  cin >> x;

  i64 h;
  h = x / 500 * 1000;
  h += (x % 500) / 5 * 5;

  cout << h << endl;

  return 0;
}


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

struct Node{
  int parent;
  int left;
  int right;
};

int cnt, n;

Node *T;

void Preparse(int u){
  if(u == -1) return;

  cout << ' ' << u;
  Preparse(T[u].left);
  Preparse(T[u].right);
}

void Inorder(int u){
  if(u == -1) return;
  Inorder(T[u].left);
  cout << ' ' << u;

  Inorder(T[u].right);
}

void Postorder(int u){
  if(u == -1) return;
  Postorder(T[u].left);
  Postorder(T[u].right);
  cout << ' ' << u;

}


int main(){


  int x, r, y;

  cin >> n;

  T = new Node[n];

  for(int i = 0; i < n; i++){
    T[i].parent = -1;
    T[i].left = -1;
    T[i].right = -1;
  }


  for(int k = 0; k < n; k++){

    cin >> x;

    for(int i = 0; i < 2; i++){
      cin >> y;
      T[y].parent = x;
      if(i == 0){
      T[x].left = y;
      }
      else{
        T[x].right = y;
      }
    }
  }

  for(int i = 0; i < n; i++){
    if(T[i].parent == -1){
      r = i;
      break;
    }
  }
  cnt = 0;
  cout << "Preorder" << endl;
  Preparse(r);
  cout << endl;

  cnt = 0;
  cout << "Inorder" << endl;
  Inorder(r);
  cout << endl;

  cnt = 0;
  cout << "Postorder" << endl;
  Postorder(r);
  cout << endl;


  delete[] T;
  return 0;
}



Measured memory_bytes: 3084
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let (a,b,c) = {
        let t = read_vec::<i64>();
        (t[0],t[1],t[2])
    };
    let mut ans:i64 = 0;
    for _ in 0..a {
        let (h,w) = {
            let t = read_vec::<i64>();
            (t[0],t[1])
        };
        if h >= b && w >= c {
            ans += 1;
        }
    }
    println!("{}",ans);
}

Measured memory_bytes: 4352
N,M,X=map(int,input().split())
C=[]
A=[]
for _ in range(N):
    Y=list(map(int,input().split()))
    C.append(Y[0])
    A.append(Y[1:])
res=10**9
for bit in range(2**N):
    sums=0
    array=[0]*M
    for i in range(N):
        if bit>>i&1:
            for j in range(M):
                array[j]+=A[i][j]
            sums+=C[i]
    array.sort()
    if array[0]>=X:
        res=min(res,sums)

print(res if res!=10**9 else -1)

Measured memory_bytes: 9036
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
class P {
  public:
    ll point;
    int id;
 
    P () {}
    P (ll point, int id) :
        point(point), id(id) {}
 
    bool operator < (const P &p) const {
        if (point != p.point) {
            return point < p.point;
        } else {
            return id > p.id;
        }
    }
};
 
class BIT {
  public:
    int n;
    vector<int> b;
   
    BIT(int n) : n(n), b(n, 0) {}
 
    int sum(int i)
    {
        int s = 0;
        while (i > 0) {
            s += b[i];
            i -= i & -i;
        }
        return s;
    }
   
    void add(int i, int x)
    {
        while (i <= n) {
            b[i] += x;
            i += i & -i;
        }
    }
 
    int lower_bound(int rnk)
    {
        int lb = 1, ub = n;
        while (ub - lb > 0) {
            int mid = (lb + ub) / 2;
            if (sum(mid) <= rnk) {
                lb = mid + 1;
            } else {
                ub = mid;
            }
        }
        return lb;
    }
};
 
int main()
{
    int N, C;
 
    scanf("%d %d", &N, &C);
     
    vector<ll> point(N, 1);          
    vector<int> com(C), a(C), b(C);    
    map<P, int> p2r;  
    map<int, P> r2p;  
     
    set<P> st;
    for (int i = 0; i < N; i++) {
        st.insert(P(1LL, i));
    }
 
    for (int i = 0; i < C; i++) {
        scanf("%d", &com[i]);
        if (com[i] == 0) {            
            scanf("%d %d", &a[i], &b[i]); a[i]--;            
            point[a[i]] += b[i]; 
            st.insert(P(point[a[i]], a[i]));            
        } else {
            scanf("%d", &a[i]); 
        }
    }
     
    int n = st.size(), idx = 1;
    for (auto it = st.begin(); it != st.end(); ++it) {
        p2r[*it] = idx;
        r2p[idx++] = *it;
    }
     
    BIT bit(n + 10);
    for (int i = 0; i < N; i++) {
        bit.add(i + 1, +1);
    }

    fill(point.begin(), point.end(), 1);    
    for (int i = 0; i < C; i++) {
        switch (com[i]) {
            case 0: {
                int t = a[i], p = b[i];
                bit.add(p2r[P(point[t], t)], -1);
                point[t] += p;
                bit.add(p2r[P(point[t], t)], +1);
                break;
            }
            case 1: {
                int m = N - a[i];
                P res = r2p[bit.lower_bound(m)];
                printf("%d %lld\n", res.id + 1, res.point - 1);
                break;
            }
            default: {
                assert(0);
                break;
            }
        }        
    }
    return 0;
}

Measured memory_bytes: 42880
N = int(input())
count1 = 0
for i in range(1,N+1):
  if i % 2 != 0: #Odd Number
    count2 = 0  
    for j in range(1,i+1):
      if i % j == 0:
        count2 += 1
      if count2 == 8:
        count1 += 1
print(count1)

Measured memory_bytes: 3064
N = int(input())

# 奇数の場合
if N % 2 == 1:
    print(0)
    exit()

while N % 10 != 0:
    N -= 1

ans = 0

x = 1
# 5**xで割り切れる個数
while N // ((5 ** x) * 2) > 0:
    ans += N // ((5 ** x) * 2)
    x += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int x[maxn], y[maxn], sz[maxn];
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++) cin >> x[i] >> y[i], sz[i] = y[i] - x[i];
	long long ans = 0, dl = 0, dr = 0;
	multiset<long long> l, r;
	l.insert(x[0]);
	r.insert(x[0]);
	for(int i = 1; i < n; i++){
		dl -= sz[i];
		dr += sz[i - 1];
		long long p = x[i], cl = *prev(l.end()) + dl, cr = *r.begin() + dr;
		if(cl <= p && p <= cr){
			l.insert(p - dl);
			r.insert(p - dr);
		} else if(p < cl){
			ans += cl - p;
			l.erase(prev(l.end()));
			l.insert(p - dl);
			l.insert(p - dl);
			r.insert(cl - dr);
		} else {
			ans += p - cr;
			r.erase(r.begin());
			r.insert(p - dr);
			r.insert(p - dr);
			l.insert(cr - dl);
		}
	}
	cout << ans << endl;
	return 0;
}
	


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

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  int b=0,c=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i=0;i<n;i+=2){
    b+=a[i];
  }
  for(int i=1;i<n;i+=2){
    c+=a[i];
  }
  cout<<b-c<<endl;
}

Measured memory_bytes: 256
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
#include <map>
#include <utility>
//using
using namespace std;
using vi = vector <int>;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
 //各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()
//文字→数字　'0' アルファベット→数字　'a'　'A'が65番,'a'が97番だわ
//型キャスト　char('a'+1)
//reverse 回文
//if(isupper('A'))->大なら真


//グローバル変数宣言
ll p=0,q=0,r=0;

int main()
{
  ll n,m;
  map<string,ll>a;
  cin>>n;
  vs s(n);
  rep(i,n)
  {
    cin>>s[i];
    a[s[i]]++;
  }
  cin>>m;
  vs t(m);
  rep(i,m)
  {
    cin>>t[i];
    a[t[i]]--;
  }
  rep(i,n)
  {
    p=max(p,a[s[i]]);
  }
  print(p);
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = Integer.parseInt(sc.next());
    	int A = Integer.parseInt(sc.next());
    	int B = Integer.parseInt(sc.next());

    	int ans = 0;

    	for (int i=0; i<=N; i++){
    		if (judge(i, A, B)){
    			ans += i;
    		}
    	}

    	System.out.println(ans);

    }
	  static boolean judge(int n, int a, int b){
		int x = 0;
		while(n>0){
			x += n % 10;
			n = n /10;
		}
		if (x >= a && x<= b){
			return true;
		}else{
			return false;
		}
	}
}

Measured memory_bytes: 20820
#include <bits/stdc++.h>
using namespace std;
int keta(int64_t S){
  string str = to_string(S);
  return str.size();
}
int main(){
  int64_t S;
  cin >> S;
  int64_t sum = 0;
  bool flag = false;
  int k = keta(S) - 1;
  for(int tmp = 0; tmp < (1 << k); tmp++){
    bitset<9> a(tmp);
    int64_t N = S;
    int sep = 10;
    for(int i = 0; i < k; i++){
      if(a.test(i)){
        sum += N % sep;
        N /= sep;
        sep = 10;
      }
      else sep *= 10;
    }
    sum += N;
  }
  cout << sum << endl;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int d, n;
  cin >> d >> n;
  int x = 1;
  while(1) {
    int y = x;
    int cnt = 0;
    while(y%100 == 0) {
      y /= 100;
      ++cnt;
    }
    if(cnt == d) {
      --n;
      if(n == 0) {
	cout << x << endl;
	return 0;
      }
    }
    ++x;
  }

  return 0;
}


Measured memory_bytes: 256
n = input()
a = map(int, raw_input().split())
a = sorted(a)
c = 1
i = 0
if n%2 == 0:
    k = 1
    while i < len(a):
        if not a[i] == a[i+1] == k:
            print 0
            exit()
        c *= 2
        c %= 10**9 + 7
        i += 2
        k += 2
else:
    if not a[0] == 0:
        print 0
        exit()
    k = 2
    i = 1
    while i < len(a):
        if not a[i] == a[i+1] == k:
            print 0
            exit()
        c *= 2
        c %= 10**9 + 7
        i += 2
        k += 2
print c


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<long long,long long>> a(n);
    long long x,y;
    for (int i = 0;i < n;i++){
        cin >> x >> y;
        a[i] = make_pair(x,y);
    }

    sort(a.begin(),a.end());
    long long cnt = 0,sum = 0,i = 0;
    while (0 < m){
        if (m >= a[i].second){
            m -= a[i].second;
            sum += a[i].first * a[i].second;
            i++;
        }
        else {
            sum += a[i].first * m;
            m = 0;
        }
    } 
    cout << sum << endl;

}

Measured memory_bytes: 1792
//atcoder abc155
#include<bits/stdc++.h>

using namespace std;
#define int int64_t
#define rep(i,a,n) for(int i=(a); i<(n); ++i)
#define reps(i,a,n) for(int i=(a); i<(n); --i)
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define re(s) reverse((s).begin(),(s).end())
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1000000007;
using pii = pair<int,int>;

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int n;
    string s;
    map<string,int> mp;
    vector<pair<int,string> > vp;
    cin >>n;
    
    rep(i,0,n){
      cin >>s;
      mp[s]--;
    }
  
    for(auto itr=mp.begin();itr!=mp.end();itr++){
      vp.emplace_back(itr->second,itr->first);
    }
    
    sort(all(vp));

    int a=vp[0].first;
    for(int i=0;i<vp.size();i++){
      if(a!=vp[i].first) break;
      cout <<vp[i].second<<'\n';
    }
    return (0);
}


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

int main(){
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(u == s){
        a--;
    }
    else{
        b--;
    }
    cout<<a<<" "<<b<<endl;

}


Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
//use proconio::marker::*;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       A:i32,B:i32,C:i32
    }
    if A == B && B != C || A == C && A != B || B == C && A != B {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
 
    using namespace std;
 
    typedef long long ll;
    typedef long double ld;
 
    typedef pair<int, int> pi;
    typedef pair<ll,ll> pl;

    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pi> vpi;
    typedef vector<pl> vpl;
    typedef vector<vi> vvi;

    #define FOR(i, a, b) for (int i=a; i<(b); i++)
    
    #define sz(x) (int)(x).size()
    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
    #define lb lower_bound
    #define ub upper_bound
    #define all(x) x.begin(), x.end()
 
    template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
    template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
    
    #define trav(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
 
    #define PI 3.14159265358979323846264338327950L
    const int MOD = 1000000007;
    const char nl = '\n';
 
    int main() 
    {
        ios_base::sync_with_stdio(0); cin.tie(0);
        int n;cin>>n;
        string s;cin>>s;

        auto start = s.begin();
        auto end = s.begin()+(n-1);
        
        int count=0;

        while(start!=end)
        {
            while(*start!='W' and start!=end) ++start;
            while(*end!='R' and start!=end) --end;
            
            if(*start=='W' and *end=='R')
            {
            iter_swap(start,end);
            ++count;
            }
        }

        cout<<count;
    }


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

class Dice {
public:
  int u;
  int r;
  int l;
  int d;
  int b;
  int f;
  void S(void) {
    int temp;
    temp = u; u = b; b = d; d = f; f = temp;
  }
  void N(void) {
    int temp;
    temp = u; u = f; f = d; d = b; b = temp;
  }
  void E(void) {
    int temp;
    temp = u; u = l; l = d; d = r; r = temp;
  }
  void W(void) {
    int temp;
    temp = u; u = r; r = d; d = l; l = temp;
  }
  void T(void) {
    int temp;
    temp = f; f = r; r = b; b = l; l = temp;
  }
};

bool operator == (const Dice d1, const Dice d2) {
  return
    d1.u == d2.u &&
    d1.f == d2.f &&
    d1.r == d2.r &&
    d1.l == d2.l &&
    d1.b == d2.b &&
    d1.d == d2.d;
}

int main() {

  Dice dice1, dice2;
  int m = 0;
  
  std::cin >> dice1.u;
  std::cin >> dice1.f;
  std::cin >> dice1.r;
  std::cin >> dice1.l;
  std::cin >> dice1.b;
  std::cin >> dice1.d;

  std::cin >> dice2.u;
  std::cin >> dice2.f;
  std::cin >> dice2.r;
  std::cin >> dice2.l;
  std::cin >> dice2.b;
  std::cin >> dice2.d;

  srand(time(NULL));
  
  for(int i = 0; i < 1000000; ++i) {
    if( dice1 == dice2 ) {
      break;
    }
    switch( rand() % 2 ) {
    case 0:
      dice1.E();
      break;
    case 1:
      dice1.N();
      break;
    }
  }  

  if( dice1 == dice2 ) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }
    
  
  return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <cstdlib>
#define MAX 2000001
#define VMAX 10000
 
int main() {
    unsigned short *A, *B;
    int n, i, j;
    int C[VMAX];
    scanf("%d", &n);
    A = (unsigned short *)malloc(sizeof(short) * n + 1);
    B = (unsigned short *)malloc(sizeof(short) * n + 1);
 
    for (int i=0; i<VMAX; i++) C[i] = 0;
 
    for (int i=0; i<n; i++) {
        scanf("%hu", &A[i + 1]);
        C[A[i + 1]]++;
    }
 
    for (i=1; i<=VMAX; i++) C[i] = C[i] + C[i-1];
 
    for (j=1; j<=n; j++) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }
    for (int i=1; i<=n; i++) {
        printf("%d", B[i]);
        if (i == n) printf("\n");
        else printf(" ");
    }
    return 0;
}

Measured memory_bytes: 10448
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
int N;
int G[102][102];

int main() {
    cin>>N;
    rep(i,N) rep(j,N) cin>>G[i][j];
    ll ans=0;
    rep(i,N) rep(j,i) ans+=min(G[i][j],G[j][i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int x,y,z;
	x=a+b;
	y=a-b;
	z=a*b;
	int h=max(x,y);
	int g=max(h,z);
	cout<<g<<endl;
	return 0;
}

Measured memory_bytes: 256