akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

char s[105];
int k, n;
ll a[105], a0;

int main() {
	scanf("%s", s + 1);
	scanf("%d", &k);
	n = strlen(s + 1);
	fo(i, 1, n) {
		if(i == 1 || s[i] != s[i - 1]) a[++ a0] = 1; else
		a[a0] ++;
	}
	if(a0 == 1) {
		pp("%lld\n", (ll) n * k / 2);
		return 0;
	}
	ll ans = 0;
	fo(i, 2, a0 - 1) ans += (ll) (a[i] / 2) * k;
	if(s[1] == s[n]) {
		ans += a[1] / 2 + a[a0] / 2 + (a[1] + a[a0]) / 2 * (k - 1);
	} else ans += (a[1] / 2 + a[a0] / 2) * k;
	pp("%lld\n", ans);
}

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

string max(const string &a, const string &b){
    if(a == "0") return b;
    else if(a.size() < b.size()) return b;
    else if(a.size() == b.size() && a < b) return b;
    return a; 
}

int main(){

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

    vector<int> stick = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    vector<string> dp(N + 1e3, "0"); dp[0] = "";

    for(int i = 0; i <= N; i++){
        if(dp[i] == "0") continue;
        for(int j = 0; j < M; j++){
            dp[i + stick[A[j]]] = max(dp[i + stick[A[j]]], dp[i] + (char)('0' + A[j]));
        }
    }

    cout << dp[N] << endl;

    return 0;
}



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


int main(){
    int x;
    cin>>x;
    if(x>=30){
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		long M = sc.nextLong();
		long V = sc.nextLong();
		long P = sc.nextLong();
		List<Long> vals = new ArrayList<>(N);
		for (int i = 0; i < N; i++) {
			vals.add(sc.nextLong());
		}
		vals.sort(Collections.reverseOrder());
		long[] elems = new long[N];
		for (int i = 0; i < N; i++) {
			elems[i] = vals.get(i);
		}
		int left = 0, right = N;
		while (left + 1 < right) {
			int med = (left + right) / 2;
			long tot = M * (V - 1);
			long max = elems[med] + M;
			int idx = 0;
			boolean can = true;
			while (idx < P - 1 && tot > 0) {
				if (idx != med) {
					tot -= M;
				}
				idx++;
			}
			if (elems[(int)(P - 1)] > max) can = false;
			while (idx < N && tot > 0 && can) {
				if (idx != med) {
					long dif = Math.min(M, max - elems[idx]);
					if (dif > 0) {
						tot -= dif;
					}
				}
				idx++;
			}
			if (tot <= 0 && can) {
				left = med;
			} else {
				right = med;
			}
		}
		
		out.println(left + 1);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int A,B,N,M;
string res[1001];

void putA(ll i,ll j){
  res[i][j]='<'; res[i][j+1]='>'; A--;
}
void putB(ll i,ll j){
  res[i][j]='^'; res[i+1][j]='v'; B--;
}


int main(){
  cin>>N>>M>>A>>B;
  int area=N*M,tot=2*(A+B);
  if(area<tot){
    cout<<"NO"<<endl;
    return 0;
  }
  rep(i,N)rep(j,M)res[i]+=".";
  if(N%2==0&&M%2==0){
    for(ll i=0;i<N;i+=2)for(ll j=0;j<M;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }
  }else if(M%2==0){
    for(ll j=0;j<M;j+=2){
      if(A>0){
        putA(N-1,j);
      }
    }
    for(ll i=0;i<N-1;i+=2)for(ll j=0;j<M;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }
  }else if(N%2==0){
    for(ll i=0;i<N;i+=2){
      if(B>0){
        putB(i,M-1);
      }
    }
    for(ll i=0;i<N;i+=2)for(ll j=0;j<M-1;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }
  }else{
    ll preA=A,preB=B;
    for(ll j=0;j<M-1;j+=2){
      if(A>0){
        putA(N-1,j);
      }
    }
    for(ll i=0;i<N-1;i+=2){
      if(B>0){
        putB(i,M-1);
      }
    }
    for(ll i=0;i<N-1;i+=2)for(ll j=0;j<M-1;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }

    if(A>0||B>0){
      rep(i,N)res[i]="";
      rep(i,N)rep(j,M)res[i]+=".";

      A=preA; B=preB;
      //assert(A>=2&&B>=2);
      if(A>0)putA(N-3,M-3);
      if(B>0)putB(N-3,M-1);
      if(A>0)putA(N-1,M-2);
      if(B>0)putB(N-2,M-3);
      for(ll j=0;j<M-3;j+=2){
        if(A>0){
          putA(N-1,j);
        }
      }
      for(ll i=0;i<N-3;i+=2){
        if(B>0){
          putB(i,M-1);
        }
      }
      for(ll i=0;i<N-1;i+=2)for(ll j=0;j<M-1;j+=2){
        if(i==N-3&&j==M-3)continue;

        if(A>0){
          putA(i,j);
          if(A>0)putA(i+1,j);
        }else if(B>0){
          putB(i,j);
          if(B>0)putB(i,j+1);
        }
      }
    }
  }
  if(A>0||B>0){
    cout<<"NO"<<endl;
    return 0;
  }
  cout<<"YES"<<endl;
  rep(i,N){
    cout<<res[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 2304
from fractions import gcd
a,b,c,d=map(int,input().split())
x=c*d//gcd(c,d)
if a%c==0:p=a//c-1
else:p=a//c
if a%d==0:q=a//d-1
else:q=a//d
if a%x==0:r=a//x-1
else:r=a//x
print((b-a+1)-(b//c-p)-(b//d-q)+(b//x-r))

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

int main(){
	int n;
	cin>>n;
	int x, ans=0;
	int prev=0;
	int flag;
	for(int i=0;i<n;i++){
		cin>>x;
		if(x==prev){
			x=-1;
			ans++;
		}
		prev=x;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n, a, b;
    cin >> n >> a >> b;
    if ((b-a) % 2 == 0) {
        cout << "Alice";
    } else {
        cout << "Borys";
    }

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d,n;
    cin>>d>>n;
    if(d==0)
    {
        if(n==100)cout<<n+1<<'\n';
        else cout<<n<<'\n';
    }
    else if(d==1)
    {
        if(n==100)cout<<"10100"<<'\n';
        else cout<<100*n<<'\n';
    }
    else
    {
        if(n==100)cout<<"1010000"<<'\n';
        else cout<<10000*n<<'\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); ++(i))
#define Rep(i,a,b) for(int (i)=(a); (i)<(b); ++(i))
#define ALLIN(v) rep(i,v.size())cin>>v[i]
#define all(v) (v).begin(),(v).end()
#define bet(a,x,b) a<=x&&x<b
#define fi first
#define se second
using namespace std;

using ll=long long;
using ull=unsigned long long;
using arr=vector<int>;
using mat=vector<arr>;
using pi=pair<int,int>;
template<typename T>
using vec=vector<T>;
template<typename T>
using pq=priority_queue<T>;
template<typename T>
using rpq=priority_queue<T,vec<T>,greater<T>>;

int main(void){
  string S; cin>>S;
  arr l,r;
  Rep(i,1,S.size()) if(S[i]=='L'&&S[i-1]=='R') l.emplace_back(i);
  rep(i,S.size()-1) if(S[i]=='R'&&S[i+1]=='L') r.emplace_back(i);
  
  arr ans(S.size(),0);
  
  rep(i,S.size()){
    if(S[i]=='R'){
      auto itr=upper_bound(all(l),i);
      if(abs(*itr-i)%2==0) ++ans[*itr];
      else ++ans[*itr-1];
    }
    else{
      auto itr=upper_bound(all(r),i); --itr;
      if(abs(*itr-i)%2==0) ++ans[*itr];
      else ++ans[*itr+1];
    }
  }
  
  rep(i,ans.size()){
    cout<<ans[i]<<" ";
  }
}

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

int n, k;
string s;

int main() {
    ios::sync_with_stdio(0);
    cin >> n >> k >> s;
    while (k--) {
        string lst = s, u = s;
        reverse(s.begin(), s.end()), u.append(s);
        for (int i = 0; i + n - 1 < u.length(); i++) {
            s = min(s, u.substr(i, s.length()));
        }
        if (k) reverse(s.begin(), s.end());
        if (s == lst) { cout << s << endl; return 0; }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
def simulateFunc(balls)
  stk1 = 0
  stk2 = 0
  counter = 0

  balls.each do |ball|
    dif1 = ball.to_i - stk1
    dif2 = ball.to_i - stk2

    if dif1 > 0 && dif2 > 0
      if dif1 < dif2
        stk1 = ball.to_i
      else
        stk2 = ball.to_i
      end

      counter += 1
    elsif dif1 > 0
      stk1 = ball.to_i
      counter += 1
    elsif dif2 > 0
      stk2 = ball.to_i
      counter += 1
    end
  end
  
  return counter == balls.size
end

n = gets.chomp.to_i

n_test = 0
while n_test < n do
  balls = gets.chomp.split(" ");
  if simulateFunc(balls)
    puts "YES"
  else
    puts "NO"
  end
  n_test += 1
end

Measured memory_bytes: 6100
using System;
using System.Reflection;
using System.Linq.Expressions;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder {
    public class Program {
        static int[] getKeys(char delimiter) {
            var Keys = Console.ReadLine().Split(' ');
            int N = Keys.Length;
            int[] Ns = new int[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = int.Parse(Keys[i]);
            }
            return Ns;
        }
        static void Show<T>(T[,] map) {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        static void Show<T>(T[,] map, string delimiter) {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + delimiter);
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        static void Show<T>(IEnumerable<T> ts) {
            foreach (var item in ts) {
                Console.Write(item + " ");
            }
            Console.WriteLine();
        }
        static void Show<T>(IEnumerable<T> ts, string delimiter) {
            foreach (var item in ts) {
                Console.Write(item + delimiter);
            }
            Console.WriteLine();
        }

        static void Main() {
            int N = int.Parse(Console.ReadLine());
            string A = Console.ReadLine();
            string B = Console.ReadLine();
            string C = Console.ReadLine();
            Char[] Answer = new char[N];
            for (int i = 0; i < N; i++) {
                if (A[i] == B[i] || A[i] == C[i]) {
                    Answer[i] = A[i];
                } else if (B[i] == C[i]) {
                    Answer[i] = B[i];
                } else {
                    Answer[i] = A[i];
                }
            }
            int Count = 0;
            for (int i = 0; i < N; i++) {
                if (A[i] != Answer[i]) Count++;
                if (B[i] != Answer[i]) Count++;
                if (C[i] != Answer[i]) Count++;
            }
            Console.WriteLine(Count);
        }
    }
}



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

int main()
{
	int a,b,s,d,p;
	
	cin>>a>>b;
	
	s=a+b;
	d=a-b;
	p=a*b;
	
	if(s>=d&&s>=p){
		cout<<s<<endl;
	}
	else if(d>=s&&d>=p){
		cout<<d<<endl;
	}
	else{
		cout<<p<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

ll a[100000];
int main() {
	ll n; cin >> n;
	ll ans = 1;
	map<ll, int>cnt;
	rep(i, n) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	for (auto p : cnt) {
		if (p.first == 0 && p.second > 1) {
			puts("0"); return 0;
		}
		if (p.second > 2) {
			puts("0"); return 0;
		}
		ans = (ans*p.second) % MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        int c = 0;
        for(int i=0; i<s.length(); i++) {
            if(s.charAt(i) == t.charAt(i)) {
                c++;
            }
        }
        System.out.println(c);
    }
}


Measured memory_bytes: 22868
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int num[5];
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    for(int i=0;i<3;i++)
    {
        cin>>num[i];
    }
    sort(num,num+3);
    cout<<num[2]*10+num[1]+num[0]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 1000000

int min(int a, int b){
  return a < b ? a : b;
}

int max(int a, int b){
  return a < b ? b : a;
}

int main(){
  int k,x,
      i,j;
  
  scanf("%d%d", &k, &x);
  
  j = min(x+k-1, MAX);
  for(i=max(x-k+1, -MAX);i<=j;i++){
    printf("%d ", i);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int HPinit, HPmax;
    while(cin>>HPinit>>HPmax&&(HPinit||HPmax)){
        int h,w;
        cin>>h>>w;
        vector<string> vs(h);
        rep(i,h)cin>>vs[i];
        
        int n;
        cin>>n;
        map<char,int> dmg;
        rep(i,n){
            char ch;
            int val;
            cin>>ch>>val;
            dmg[ch] = val;
        }
        
        int m;
        cin>>m;
        vector<pair<char,int>> mv(m);
        rep(i,m){
            char ch;
            int dist;
            cin>>ch>>dist;
            mv[i] = make_pair(ch,dist);
        }
        
        int c;
        cin>>c;
        vector<int> p(c);
        rep(i,c)cin>>p[i];
        
        static int dp[1001][1<<12];
        rep(i,1001)rep(j,1<<12)dp[i][j] = -INF;
        dp[0][(1<<c)-1] = HPinit;
        
        int dy[]={1,0,-1,0};
        int dx[]={0,1,0,-1};
        
        int y = 0, x=0;
        int turn = 0;
        rep(i,m){
            int dir = -1;
            char ch = mv[i].first;
            if(ch=='D')dir=0;
            else if(ch=='R')dir=1;
            else if(ch=='U')dir=2;
            else if(ch=='L')dir=3;
            assert(dir!=-1);
            
            rep(j,mv[i].second){
                y += dy[dir];
                x += dx[dir];
                for(int bit = 1<<c;bit>=0;bit--){
                    if(dp[turn][bit]>dmg[vs[y][x]])continue;
                    if(dp[turn][bit]<=0)continue;
                    rep(i,c){
                        if(((1<<i)&bit)==0)continue;
                        
                        dp[turn][bit^(1<<i)] = max(dp[turn][bit^(1<<i)], min(HPmax, dp[turn][bit] + p[i]));
                    }
                }
                for(int bit = 1<<12;bit>=0;bit--){
                    dp[turn+1][bit] = dp[turn][bit]-dmg[vs[y][x]];
                }
                turn++;
            }
        }
        int maxi = -INF;
        rep(i,1<<c)maxi = max(maxi,dp[turn][i]);
        if(maxi>0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        
    }
}



Measured memory_bytes: 19240
// Crt. 2019-12-08  09:24:29
// give $ v $ a val. of k + 1
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#define N 200005
using namespace std;

int n, num[N][22], val[N], ans;
int tot, fir[N], nxt[N << 1], to[N << 1];

inline void addE(int u, int v) {
    nxt[++tot] = fir[u], fir[u] = tot, to[tot] = v;
}

void dfs(int u, int p) {
    for (int i = fir[u], v; i; i = nxt[i]) {
        v = to[i];
        if (v == p) continue;
        dfs(v, u);
        for (int j = 0; j <= 20; ++j)
            num[u][j] += num[v][j];
    }
    for (int i = 0; i <= 20; ++i)
        if (num[u][i] > 1) val[u] = max(val[u], i);
    while (num[u][val[u]]) ++val[u];
    for (int i = 0; i < val[u]; ++i)
        num[u][i] = 0;
    num[u][val[u]] = 1;
    ans = max(ans, val[u]);
}

int main() {
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;
    for (int i = 1, u, v; i < n; ++i)
        scanf("%d%d", &u, &v), addE(u, v), addE(v, u);

    dfs(1, 0);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 19456
#!/usr/bin/env python3
N, A, B = map(int, input().split())

ans = 0
for i in range(N):
    if A + 1 == B:
        ans = i % 2
        break
    if i % 2 == 0:
        A += 1
    else:
        B -= 1

print(('Borys', 'Alice')[ans])


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

int main () {
  int n, x;
  cin >> n >> x;
  vector<int> vec(n);
  for (int i = 0; i < n; i++)
    cin >> vec[i];
  sort (vec.begin(), vec.end());
  long long sum = 0;
  for (int c : vec)
    sum += c;
  if (sum > x) {//お菓子をもらえない子どもが存在する
    int ans = 0;
    while (x - vec[ans] >= 0) {
      x -= vec[ans];
      ans++;
    }
    cout << ans << endl;
  }
  else if (sum == x) {//子供全員が満足する場合
    cout << n << endl;
  }
  else//一人だけ満足できない場合
    cout << n-1 << endl;
}

Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let a: usize = sc.read();
    let b: usize = sc.read();
    println!("{}", cmp::min(b, n * a));
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main()
{
	int a,b,i;
	scanf("%d %d",&a,&b);
	if(a>b)
	{
		for(i=0;i<a;i++)
			printf("%d",b);
	}
	else 
	{
		for(i=0;i<b;i++)
			printf("%d",a);
	}
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		if((a*b) % 2 == 1){
			System.out.println("Odd");
		} else {
			System.out.println("Even");
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21076
N, M=gets.split.map(&:to_i)
res=?**N
M.times{
    s, c=gets.split
    s=s.to_i-1
    (p -1; exit) if res[s]!=c && res[s]!=?*
    res[s]=c
}
res[0]=(N>1 ? ?1: ?0) if res[0]==?*
res.tr! ?*, ?0
puts (N>1 && res[0]==?0 ? -1 : res)


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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

signed main(){
    int n; cin >> n;
    vector<pair<ll, ll> > a(n);
    for(int i = 0; i < n; i++)cin >> a[i].first >> a[i].second;
    sort(ALL(a));
    ll ans = a[n-1].first;
    ans += a[n-1].second;
    cout << ans << endl;



    return 0;
}



Measured memory_bytes: 1792
n = int(input())
v = list(map(int, input().split()))

va, ve = v[0::2], v[1::2]
da, de = {}, {}
for a in va:
  da[a] = da.get(a, 0)+1
for e in ve:
  de[e] = de.get(e, 0)+1
add = sorted([(k,v) for k,v in da.items()], key=lambda x:-x[1])+[(0,0)]
even = sorted([(k,v) for k,v in de.items()], key=lambda x:-x[1])+[(0,0)]
if add[0][0] == even[0][0]:
  if add[1][1] <= even[1][1]:
    even.pop(0)
  else:
    add.pop(0)
print(n-add[0][1]-even[0][1])

Measured memory_bytes: 21880
import java.util.Scanner;
     
    public class Main {
    	public static void main (String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int N = sc.nextInt();
    		int K = sc.nextInt();
    		
    		if (N % K == 0) {
    			System.out.println(0);
    		} else {
    			System.out.println(1);
    		}
    		
    	}
    }

Measured memory_bytes: 23636
#include<stdio.h>
#include<string.h>
double ds[100];
int sp=100;
void push(double v) { if(sp>0) ds[--sp]=v; }
double pop(void) { return (sp<100?ds[sp++]:0.0); }
double RPN( const char * f ){
    double v,g;
    for(;*f;f+=2,g=1) {
        switch(*f){
        case '+':v=pop();push(pop()+v); break;
        case '*':v=pop();push(pop()*v); break;
        case '/':v=pop();push(pop()/v); break;
        case '-':
            if(f[1]<'0'||f[1]>'9'){v=pop();push(pop()-v);break;}
            else{g=-1;f++;}
        default :
            for(v=0;*f>='0'&&*f<='9';v=v*10+(*f-'0'),f++);f--;
            push(v*g);
            break ;
        }
    }
    return pop();
}
int main(void){
    char s[82];
    while(fgets(s,sizeof(s),stdin)){
        printf("%f\n",RPN(s));
    }
    return 0;
}

Measured memory_bytes: 988
while True:
    table = str(input())
    k =len(table)
    sum = 0
    table_num = [int(s) for s in table]
#    print(table_num)

    if table_num[0] == 0:
        break

    for i in range(k):
        sum += table_num[i]
    print(sum)


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REYNA(i, a, b) for (int i=(a); i<(b); ++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PII, PII> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int mod = 1e9+7;
const int inf = 1e9+9;
const int maxn = 500100;

ll cost(ll a, ll b) {
	return abs(a - b);
}

int p[maxn], n;
int main()
{
	boost;
	cin >> n;
	FOR(i, 1, n) cin >> p[i];
	p[0] = 0; p[n + 1] = 0;
	ll total = 0;
	FOR(i, 1, n + 1) total += cost(p[i], p[i-1]);
	
	FOR(i, 1, n)
	{
		ll tmp = total;
		tmp -= cost(p[i], p[i-1]);
		tmp -= cost(p[i], p[i + 1]);
		tmp += cost(p[i - 1], p[i + 1]);
		cout << tmp << "\n";
	}
	
}


Measured memory_bytes: 1664
#define MAXSIZE 1000000007
#include <stdio.h>

int main(void)
{
    long long int n,i,sunuke=1;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
        sunuke = (sunuke * i) % MAXSIZE;
    }
    printf("%lld\n",sunuke);
    
    return 0;
}


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

int main() {
	int n, arr[100010];
	cin >> n;
	for(int i = 0; i < n; i++) cin >> arr[i];

	int cnt[100010] = {0};
	for(int i = 0; i < n; i++) cnt[arr[i]]++;

	int ans = 0;
	for(int i = 0; i <= 100000; i++) {
		if(i == 0) ans = max(ans, cnt[i] + cnt[i+1]);
		else ans = max(ans, cnt[i-1] + cnt[i] + cnt[i+1]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
s = input()
n = len(s)
ans = 1
last = s[0]
i = 1
while i < n:
  if len(last) == 2:
    last = s[i]
    i += 1
  else:
    if s[i] != last:
      last = s[i]
      i += 1
    else:
      if i != n-1:
        last = s[i:i+2]
        i += 2
      else:
        break
  ans += 1
  #print(last,ans)
print(ans)

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

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

	vector<string> week = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	int ans;
	rep(i, 7) {
		if(S == week[i]) ans = 7 - i;
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
    string a,b;
    cin >> a >> b;
    if(a==b){
        cout << "EQUAL" << endl;
    }else if(a.size()==b.size()){
        for (int i=0;i<a.size();i++){
            if(a[i]>b[i]){
                cout << "GREATER" << endl;
                return 0;
            }else{
                cout << "LESS" << endl;
                return 0;
            }
        }

    }else if(a.size()>b.size()){
        cout << "GREATER" << endl;
        return 0;
    }else{
        cout << "LESS" << endl;
        return 0;
    }
    return 0;
}


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

for cx in range(0,101):
    for cy in range(0, 101):
        ch = 0
        for i in range(0,N):
            if xyh[i][2] > 0:
                ch = xyh[i][2] + abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy)
                break
        for i in range(0, N):

            if xyh[i][2] != max(ch - abs(xyh[i][0] - cx) - abs(xyh[i][1] -  cy), 0):
                break
        else:
            print('{} {} {}'.format(cx, cy, ch))
            break
    else:
        continue
    break

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
    int H,W;
    int i = 0;
    char sh = '#';
    char dot ='.';
for (; i < 10000; i++){
    scanf("%d %d", &H, &W);
    if( H == 0 && W == 0){
        break;
    }
    int j = 0;
    for(; j < H;j++){
        int k = 0;
        for(; k < W; k++){
            if(j ==0 || j==H-1 || k==0 || k==W-1){
                printf("%c",sh);
            }else{
                printf("%c",dot);
            }
        }
        printf("\n");
    }
     printf("\n");
    
}
    
    return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int main()
{
    lint n;
    cin >> n;
    string x;
    cin >> x;
    lint cnt = 0;
    REP(i,n){
        cnt += (x[i] == '1');
    }
    int v = (x[n - 1] == '1');
    lint ans, tmp;
    vector<lint> l(n+1),r(n+1);
    lint ll = cnt - 1, rr = cnt + 1;
    int lll = 0, rrr = 0;
    if(ll==0){
        ll++;
        lll = 1;
    }
    l[1] = v % (ll);
    r[1] = v % (rr);
    vector<lint> addl(n + 1), addr(n + 1);
    addl[1] = 1%ll;
    addr[1] = 1%rr;
    FOR(i,1,n) {
        addl[i + 1] = (addl[i] * 2) % ll;
        addr[i + 1] = (addr[i] * 2) % rr;
        if(x[n-i-1]=='0'){
            l[i + 1] = l[i];
            r[i + 1] = r[i];
        }else{
            if(lll==1){
                l[i + 1] = 0;
            }else{
                l[i + 1] = (l[i] + addl[i + 1]) % ll;
            }
            r[i + 1] = (r[i] +addr[i+1]) % rr;
        }
    }
    /*
    FOR(i,1,n+1){
        cout << l[i] << " ";
    }
    cout << "\n";
    FOR(i, 1, n + 1)
    {
        cout << r[i] << " ";
    }
    cout << "\n";
    */
    vector<lint> f(n + 1),g(n+1);
    FOR(i,1,n+1){
        lint k = i;
        lint bi = __builtin_popcountl(k);
        //cout << bi << " ";
        lint tmp = (k % bi);
        if(tmp==0){
            g[i] = 1;
        }else{
            g[i] = g[tmp] + 1;
        }
    }
    /*
    REP(i,n+1){
        cout << g[i] << " ";
    }
    cout  << "\n";
    */
    IFOR(i,1,n+1){
        lint z;
        if(lll==1&&x[n-i]=='1'){
            cout << 0 << "\n";
            continue;
        }
        if(x[n-i]=='0'){
            z = (r[n]+rr+addr[i])%rr;
        }else{
            z = (l[n] + ll - addl[i]) % ll;
        }
        //cout << z << "\n";
        cout << g[z] + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 12896
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

void Main()
{
	int N, K;
	std::cin >> N >> K;
	if (K == 1)
	{
		std::cout << 0 << std::endl;
	}
	else
	{
		std::cout << N - K << std::endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

int divi(int x,int y){	//xを10^yで割る;
	for(int i=0;i<y;i++)
		x=x/10;
	return x;
}

int main(){
	int x,fx=0;

	cin>>x;
	for(int i=8;i>=0;i--){
		fx+=divi(x,i)%10;
	}

	if(x%fx==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=100009;
  
int main()
{
    string a,b;
    cin>>a>>b;
    int aa,bb;
    cin>>aa>>bb;
    string s;
    cin>>s;
    if(s==a)aa--;
    else bb--;
    cout<<aa<<' '<<bb;
        

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N, W; cin >> N >> W;
	vector<pair<ll, int>>vec(N);
	rep(i, 0, N) {
		ll a; cin >> a;
		int b; cin >> b;
		vec[i] = make_pair(a, b);
	}
	vector<vector<ll>>dp(N + 1, vector<ll>(1e5 + 1, INF));
	rep(i, 0, N) {
		ll weight = vec[i].first;
		int value = vec[i].second;
		dp[i][0] = 0;
		rep(j, 0, dp[i].size()) {
			if (value > j) {
				dp[i + 1][j] = dp[i][j];
			}
			else {
				dp[i + 1][j] = min(dp[i][j], dp[i][j - value] + weight);
			}
		}
	}
	int ans = 0;
	rep(i, 0, dp[N].size()) {
		if (dp[N][i] <= W)chmax(ans, i);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define task "tet"
using namespace std;
const ll N = 2e5 + 9;
const ll mod = 998244353;
typedef pair<ll,ll> LL;

ll a[N],b[N],ans;
ll n,i;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>n;
    for (i = 1;i <= n;i++) cin>>a[i]>>b[i];
    sort(a + 1,a + n + 1); sort(b + 1,b + n + 1);
    if (n%2 != 0) ans = b[n/2 + 1] - a[n/2 + 1] + 1;
    else ans = b[n/2] + b[n/2 + 1] - a[n/2] - a[n/2 + 1] + 1;
    cout<<ans;
}


Measured memory_bytes: 6800
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <utility>
using namespace std;
#define sz size()
#define rep(i,a,n) for(int i = (a);i < (n);i++)
#define lep(i,a,n) for(int i = (a);i <= (n);i++)
//#define clr(i,n) memset(i, i+sizeof(i), n)
#define pb push_back
#define print(X) cout << (X) << endl;
typedef long long ll;
typedef pair<int,int> P;
int n,m,l;
string s,t;
int d[100000], dp[100][100];

int main(){
    int a,b;
    while(cin >> n >> m, (n+m)){
        vector<int> vec(m);
        int ans = 0;

        // rep(i,0,n)vec[i] = 0;
        rep(i,0,n){
            cin >> a >> b;
            vec[a-1] = max(vec[a-1], b);
        }
        rep(i,0,m)ans += vec[i];
        print(ans);
    }
    return 0;
}




Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

using namespace std;
//typedef long long unsigned int ll;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define MAX_N 200000

int n, q;
vector<int> a[MAX_N];
int temp_a, temp_b;
int c[MAX_N];

void solver(int i, int parent){
  for (int j : a[i]){
    if (j != parent){
      c[j] += c[i];
      solver(j, i);
    }
  }
  return;
}

int main(void){
  int i, p, x;
  cin >> n >> q;
  REP(i, n-1){
    cin >> temp_a >> temp_b;
    temp_a--;
    temp_b--;
    a[temp_a].push_back(temp_b);
    a[temp_b].push_back(temp_a);
  }
  REP(i, n){
    c[i] = 0;
  }
  REP(i, q){
    cin >> p >> x;
    c[p-1] += x;
  }

  solver(0, -1);

  REP(i, n){
    cout << c[i] << " ";
  }
  cout << endl;

  return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> A(n);
    for(int i=0; i<n; ++i) cin>>A[i];
    vector<int> Dp(n, INT_MAX);
    Dp[0]=0;
    for(int i=0; i<n; ++i){
        for(int x=1; x<=k; ++x){
            if(i+x<n) Dp[i+x]=min(Dp[i+x],Dp[i]+abs(A[i]-A[i+x]));
        }
    }
    cout<<Dp[n-1]<<"\n";
}

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

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

    if(n==0){
        cout << 0 << endl;
        return 0;
    }

    string res = "";
    while(n != 0){
        if(n%2!=0){
          n--;
          res = "1" + res;  
        }
        else res = "0" + res;
        n /= -2;
    }

    cout << res << endl;
}


Measured memory_bytes: 256
using namespace std;
#include<string>
#include<cmath>
#include<list>
#include <map>
#include <unordered_map>
#include <set>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ml map<ll,ll>
#define pb push_back
#define mp make_pair
#define ppl pair<ll,ll>
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e9 + 7;
#include<iterator>
#define EPSILON numeric_limits<double>::epsilon()



// vector<bool> visited;
// vector<vl> v;
// ll cnt[2];

// void dfs(ll pnt, ll col) {
// 	visited[pnt] = true;
// 	cnt[col]++;
// 	fr(i, 0, v[pnt].size()) {
// 		if (!visited[v[pnt][i]])dfs(v[pnt][i], !col);
// 	}
// }



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





void solve() {
	ll n, a = 0, ma = 0; cin >> n;
	ll d1[n], d2[n];
	fr(i, 0, n)cin >> d1[i] >> d2[i];
	fr(i, 0, n) {
		if (d1[i] == d2[i])a++;
		else a = 0;
		ma = max(ma, a);
	}
	if (ma >= 3)cout << "Yes";
	else cout << "No";
}






int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif
	//precompute();
	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		//cout << "Case #" << h << ": ";
		solve();
		//h++;
		cout << '\n';
	}
	return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

struct Mystruct{
    long long atack;
    long long mp;
    double cost;

    Mystruct(long long input_a, long long input_b){
        atack = input_a;
        mp = input_b;
        cost = input_a*1.0 / input_b;
    }
    bool operator<(const Mystruct &another) const
    {
        if(cost == another.cost){
            return mp < another.mp;
        }
        return cost < another.cost;//年齢を比較
    };
};

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

    VI v(n);
    REP(i,n){
        cin>>v[i];
    }

    REP(i,n){
        if(v[i]%2==0){
            if(v[i]%5 ==0 || v[i]%3==0){
                continue;
            }
            else{
                ANS("DENIED")
                return 0;
            }
        }
    }
    ANS("APPROVED")
    return 0;
}


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

          Nothing is absolute.
     This is the only absolute truth.

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

#include<bits/stdc++.h>

using namespace std;

using ull = unsigned long long;
using ll = long long;

#define in() freopen("in.txt", "r", stdin)
#define out() freopen("out.txt", "w", stdout)
#define pb push_back
#define f first
#define s second
#define endl '\n'
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define arrL(i,a,b) for(int i=a; i<b; i++)

void fasterIO()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void fileIO()
{
    in();
    out();
}

void solve()
{
    int m, d;

    cin>>m>>d;

    if(d<22){
        cout<<0<<endl;
    }else{
        int i, count=0, n, rem;

        for(i=22; i<=d; i++){
            n=i;
            rem=n%10;
            n/=10;
            if(rem<2){
                continue;
            }else if((n*rem)<=m){
                count++;
            }
        }

        cout<<count<<endl;
    }
}

int main()
{
    ///fileIO();
    fasterIO();

    solve();

    return 0;
}


Measured memory_bytes: 256
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    if(N%2 != 0) cout << "No" << endl;
    else {
        for(int i = 0; i < N; i += 2) 
            if(S[i] != 'h' || S[i+1] != 'i') {
                cout << "No" << endl;
                return 0;
            }
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
a_list = list(map(int, input().split()))
def count_2(num):
    count = 0
    while num%2 == 0:
        num /= 2
        count += 1
    return count
ans = 0
for i in range(n):
    ans += count_2(a_list[i])
print(ans)

Measured memory_bytes: 4148
h, w = map(int, input().split())

s = []
for _ in range(h):
    s.append(list(input()))

def count(s, i, j, h, w):
    ans = 0
    if i > 0 and j > 0 and s[i - 1][j - 1] == '#':
        ans += 1
    if i > 0 and s[i - 1][j] == '#':
        ans += 1
    if i > 0 and j < w - 1 and s[i - 1][j + 1] == '#':
        ans += 1
    if j > 0 and s[i][j - 1] == '#':
        ans += 1
    if j < w - 1 and s[i][j + 1] == '#':
        ans += 1
    if i < h - 1 and j > 0 and s[i + 1][j - 1] == '#':
        ans += 1
    if i < h - 1 and s[i + 1][j] == '#':
        ans += 1
    if i < h - 1 and j < w - 1 and s[i + 1][j + 1] == '#':
        ans += 1
    return ans

for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            print(count(s, i, j, h, w), end='')
        else:
            print('#', end='')
    print('')


Measured memory_bytes: 3572
n, y = map(int, input().split())

for a in range(n + 1):
    for b in range(n - a + 1):
        if (y - a * 10000 - b * 5000 == (n - a - b)*1000):
            print(a, b, n - a - b)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B = mapint()
from collections import deque
if A+B-1>N or N>A*B:
    print(-1)
else:
    blocks = []
    blocks.append(' '.join(map(str, range(B, 0, -1))))
    now = B+1
    rest = N-A+2

    while now:
        if now==rest:
            break
        if now+B>rest:
            blocks.append(' '.join(map(str, range(rest, now-1, -1))))
            rest += 1
            break
        blocks.append(' '.join(map(str, range(now+B-1, now-1, -1))))
        now = now+B
        rest += 1
    blocks.append(' '.join(map(str, range(rest, N+1))))
    print(' '.join(blocks))

Measured memory_bytes: 106012
#include <iostream>
#include <vector>
#include <tuple>

int main(){
  int N,M;
  std::cin >> N >> M;

  std::vector<std::vector<int>> min_length(N, std::vector<int>(N, 1000*100));
  std::vector<std::tuple<int,int,int>> edges(M);
  for(int i = 0; i < M; i++){
    int a,b,c;
    std::cin >> a >> b >> c;
    a--; b--;
    min_length[a][b] = c;
    min_length[b][a] = c;
    edges[i] = std::make_tuple(a,b,c);
  }

  for(int k = 0; k < N; k++){
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        min_length[i][j] = std::min(min_length[i][j], min_length[i][k]+min_length[k][j]);
      }
    }
  }

  int ans = 0;
  for(int i = 0; i < M; i++){
    if(min_length[std::get<0>(edges[i])][std::get<1>(edges[i])] < std::get<2>(edges[i])) ans++;
  }

  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 256
/* ex5_3
   KKOO  */

#include<stdio.h>

int main(void){
    int row, col, count;
    //マス目の行数、列数を入力
    scanf("%d %d", &row, &col);

    //マス目に入る文字を入力
    char grid[row][col];
    for(int i=0; i<row; i++){
        for(int j=0; j<col; j++){
            scanf(" %c", &grid[i][j]);
        }
    }

    //余分な行、列を記憶する配列
    int extra_row[row], extra_col[col];

    //配列の中身を全て1にする
    for(int i=0; i<row; i++){
        extra_row[i] = 1;
    }
    for(int j=0; j<col; j++){
        extra_col[j] = 1;
    }

    //ある行が全て'.'である場合はその行数を記憶
    for(int i=0; i<row; i++){
        for(int j=0; j<col; j++){
            if(grid[i][j] == '.'){
                count ++;
            }
        }
        if(count == col){
            //余分な行の要素は0にする
            extra_row[i] = 0;
        }
        count = 0;
    }

    //ある列が全て'.'である場合はその列数を記憶
    for(int j=0; j<col; j++){
        for(int i=0; i<row; i++){
            if(grid[i][j] == '.'){
                count ++;
            }
        }
        if(count == row){
            //余分な列の要素は0にする
            extra_col[j] = 0;
        }
        count = 0;
    }

    //配列の要素が1である部分のみ出力
    for(int i=0; i<row; i++){
        if(extra_row[i] == 1){
            for(int j=0; j<col; j++){
                if(extra_col[j] == 1){
                    printf("%c", grid[i][j]);
                }
            }
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 128