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

ll n, m, a[100005];

ll calc (ll X) {
	ll R = 0;
	for(ll i=0;i<X;i++) {
		scanf("%lld",&a[i]);
	}
	for(ll i=1;i<X;i++) {
		R += (a[i] - a[i-1]) * i % mod * (X-i) % mod;
		R %= mod;
	}
	return R;
}

int main()
{
	scanf("%lld%lld",&n,&m);
	ll A = calc(n);
	ll B = calc(m);
	printf("%lld\n",A*B%mod);
}


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


int main(){
  string s;
  cin >> s;
  int n = s.size();
  rep(i,n) {
    if(s.at(i) == '1') {s.at(i) = '9'; continue;}
    if(s.at(i) == '9') {s.at(i) = '1'; continue;}
  }
  cout << s << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sumitrust2019_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());
            var ans = -1;
            for (int i = 0; i <= x; i++)
            {
                if (Math.Floor(i * 1.08) == x)
                {
                    ans = i;
                    break;
                }
            }

            Console.WriteLine(ans == -1 ? ":(" : ans.ToString());
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

public class Main {
	public static void main(String[] args) {
	
   Scanner sc = new Scanner(System.in);
   
     double N = sc.nextInt ();
   if(N % 2 == 0) {
       double a = (N/2) / N;
	   System.out.println(a);
   }else {       
       double a = ((N+1)/2) / N;
	   System.out.println(a);
   }
   
   }
}


Measured memory_bytes: 24020
A, B = [int(i) for i in input().split()]

i = 1

while True:
    if i == 1:
        s = A*i
    else:
        s = A*i - (i - 1)
    
    if s >= B:
        break
    i += 1

if B == 1:
    print(0)
else:
    print(i)

Measured memory_bytes: 2940
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    N = int(input())
    K = int(input())
    X = list(map(int, input().split()))

    ans = 0
    for x in X:
        ans += 2 * min(x, K-x)

    print(ans)

if __name__ == "__main__": main()


Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    bool first = true;

    for(;;){
        int h;
        cin >> h;
        if(h == 0)
            return 0;
        cin.ignore();

        int w = 0;
        vector<string> s(h+1);
        for(int i=0; i<h; ++i){
            getline(cin, s[i]);
            w = max(w, (int)s[i].size());
        }

        for(int i=0; i<=h; ++i){
            s[i].resize(w+1, ' ');
            s[i] = ' ' + s[i];
        }

        map<int, int> ret;
        for(int i=0; i<h; ++i){
            for(int j=1; j<=w; ++j){
                if(s[i][j] != '*')
                    continue;

                int x[2] = {j, j};
                while(s[i][x[1]] == '*'){
                    s[i][x[1]] = ' ';
                    ++ x[1];
                }
                -- x[1];

                int dx[2];
                int y;
                for(int k=0; k<2; ++k){
                    for(dx[k]=-1; dx[k]<=1; ++dx[k]){
                        if(s[i+1][x[k]+dx[k]] == '*')
                            break;
                    }
                    y = i;
                    while(s[y+1][x[k]+dx[k]] == '*'){
                        s[y+1][x[k]+dx[k]] = ' ';
                        ++ y;
                        x[k] += dx[k];
                    }
                }
                s[y].replace(x[0], x[1]-x[0]+1, string(x[1]-x[0]+1, ' '));

                int tmp = (y-i+1) * (x[1]-x[0]+1);
                tmp += (y-i) * (y-i+1) / 2 * (dx[0] - dx[1]);
                ++ ret[tmp];
            }
        }

        if(first)
            first = false;
        else
            cout << "----------" << endl;

        map<int, int>::iterator it;
        for(it=ret.begin(); it!=ret.end(); ++it)
            cout << it->first << ' ' << it->second << endl;
    }
}

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

#define ll long long
#define ld long double
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define ii pair < int, int >
#define vi vector < int > 
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define all(a) (a).begin(), (a).end()

using namespace std;
using namespace __gnu_pbds;

typedef tree< int, null_type, less< int >, rb_tree_tag, tree_order_statistics_node_update > ost;
// name.find_by_order( x ) or name.order_of_key( x )

const int maxn = 2e5 + 10, maxv = 1e6 + 10, maxlog = 20;
const int inf = 1e9 + 1;
const int MOD = 1e9 + 7;
const ll INF = 4e18 + 1;
const double eps = 1e-9;

void yes() { cout << "YES\n"; }
void no() { cout << "NO\n"; }

void solve() {
	int n;
	cin >> n;
	vi v( n, 0 );
	int ans = 0;
	for( int i = 0;i < n;i++ ) cin >> v[ i ];
	for( int i = 0;i < n;i++ ) {
		for( int j = i + 1;j < n;j++ ) {
			for( int k = j + 1;k < n;k++ ) {
				if ( v[ i ] == v[ j ] || v[ i ] == v[ k ] || v[ j ] == v[ k ] ) continue;
				vi v1;
				v1.pb( v[ i ] );
				v1.pb( v[ j ] );
				v1.pb( v[ k ] );
				sort( all( v1 ) );
				if ( v1[ 0 ] + v1[ 1 ] > v1[ 2 ] ) ans++;
			}
		}
	}
	cout << ans << "\n";
}

int main() {
	int t = 1;
	//cin >> t;
	while ( t-- ) solve();
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a,b,c,k;
    cin>>a>>b>>k;
    
    c=a;
    int j=0;
    int d[100];
    if(b<a) c=b;
    for(int i=1;i<=c;i++){
        if(a%i==0&&b%i==0){
            d[j]=i;
            j++;
        }
    }
    cout<<d[j-k]<<endl;
    
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    L=int(input())
    print((L/3)**3)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



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

  int n = s.length(), res = 15 - n;
  rep(i, n) if (s[i] == 'o') res++;
  cout << (res >= 8 ? "YES" : "NO") << endl;


  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#define N 100003
#define MAX 2000000000

using namespace std;

struct card{
    char c;
    int d;
};
int n;
card L[N/2+2],R[N/2+2];

void QuickSort(card A[],int head,int tail){
    card x=A[tail];
    int i=head-1,j=head;
    card temp;
    if(head>=tail) return;  //!(tail-head>1) 改了
    for(j=head;j<tail;j++){
        if(A[j].d<=x.d){
            i++;
            temp=A[j]; A[j]=A[i]; A[i]=temp;
        }
    }
    A[tail]=A[i+1]; A[i+1]=x;
    QuickSort(A,head,i);
    QuickSort(A,i+2,tail);
}

void Merge(card B[],int left,int mid,int right){
    int n1=mid-left,n2=right-mid;
    int i,j;
    for(i=0;i<n1;i++) L[i]=B[left+i];
    for(i=0;i<n2;i++) R[i]=B[mid+i];
    L[n1].d=R[n2].d=MAX;

    i=j=0;
    for(int k=left;k<right;k++){
        if(L[i].d<=R[j].d){
            B[k]=L[i++];
        }else{
            B[k]=R[j++];
        }
    }
}
void MergeSort(card B[],int left,int right){
    int mid=0;
    if(left+1<right){
        mid=left+(right-left)/2;
        MergeSort(B,left,mid);
        MergeSort(B,mid,right);
        Merge(B,left,mid,right);
    }
}
void show(card A[],int n){
    for(int i=0;i<n;i++){
        cout<<A[i].c<<' '<<A[i].d<<endl;
    }
}
void compare(card A[],card B[],int n){
    for(int i=0;i<n;i++){
        if(A[i].c!=B[i].c){
            cout<<"Not stable"<<endl;
            return;
        }
    }
    cout<<"Stable"<<endl;
    return;
}
int main(){
    string tc;
    int td;
    card A[N],B[N];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>tc>>td;
        A[i].c=B[i].c=tc[0];
        A[i].d=B[i].d=td;
    }

    QuickSort(A,0,n-1);
    MergeSort(B,0,n);

    compare(A,B,n);
    show(A,n);
    return 0;
}



Measured memory_bytes: 5476
#include <stdio.h>

int main()
{
	char S[100];
	int i, x;
	
	scanf("%s", S);
	
	for(i=0; i<101; i++){
		if(S[i]=='\0')break;
		S[i]='x';
	}
	
	printf("%s", S);
	
	return 0;
}

Measured memory_bytes: 128
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A=[0]*N
ans=0
tmp=0

for i in range(N):
  tmp=0
  A[i]= list(map(int,input().split()))
  for j in range(M):
    tmp += A[i][j]*B[j]
  if tmp+C > 0:
    ans +=1
    
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int n; ll a[101];
int used[101] = {};
ll dfs(int k) {
	if (k > n)return 0;
	if (used[k])return dfs(k + 1);
	ll res = 0;
	if (k * 2 > n) {
		Rep1(i, k, n) {
			if (!used[i])res += max((ll)0, a[i]);
		}
	}
	else if (k * 3 > n) {
		if (used[2 * k]) {
			res = max((ll)0, a[k]);
			res += dfs(k + 1);
		}
		else {
			used[2 * k] = 1;
			res = max({ (ll)0, a[k], a[k] + a[2 * k] });
			res += dfs(k + 1);
		}
	}
	else {
		ll memo[101]; rep1(i, 100)memo[i] = used[i];
		res = a[k]+dfs(k + 1);
		rep1(i, 100)used[i] = memo[i];
		for (int i = k; i <= n; i += k) {
			used[i] = 1;
		}
		res = max(res, dfs(k + 1));
		rep1(i, 100)used[i] = memo[i];
	}
	return res;
}
int main() {
	cin >> n;
	rep1(i, n) {
		cin >> a[i];
	}
	ll out = dfs(2);
	out = max((ll)0, out + a[1]);
	cout << out << endl;
	return 0;
}

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

ll matching(vector<vector<bool>> &arr, int n, int i, int mask, ll *dp){
    if(i == n)
        return 1;
    if(dp[mask] != -1)
        return dp[mask];
    ll ans = 0;
    for(int j=0; j<n; j++){
        if(!(mask&(1<<j)) and arr[i][j]){
            ans = (ans + matching(arr, n, i+1, mask|(1<<j), dp))%M;
        }
    }
    dp[mask] = ans;
    return ans;
}

int main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 int n;
 cin>>n;
 vector<vector<bool>> arr(n, vector<bool>(n));
 for(int i=0; i<n; i++)
    for(int j=0; j<n; j++){
        bool curr;
        cin>>curr;
        arr[i][j] = curr;
    }

 ll *dp = new ll[1<<n];
 for(int i=0; i<(1<<n); i++)
    dp[i] = -1;
 ll ans = matching(arr, n, 0, 0, dp);
 cout<<ans;
 return 0;
}


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

int main(){
int N;
cin>>N;
map<string,int> cnt;
rep(i,N){
    string S;
    cin>>S;
    cnt[S]++;
}
for(string S : {"AC","WA","TLE","RE"}){
    cout<<S<<" x "<<cnt[S]<<endl;
}
return 0;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys


def solve(X: int):
    y500 = X // 500
    rest = X % 500
    y5 = rest // 5

    glad = y500 * 1000 + y5 * 5
    print(glad)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
char a[5],R[99];h,b;main(i){for(;scanf("%s%s",R,a)*R[1];h=b=!printf("%d %d\n",h,b/2-1-h)){for(i=4;i--;h+=R[i]==a[i])R[R[i]]++,R[a[i]]--;for(i=47;++i<58;R[i]=0)b+=!R[i];}}

Measured memory_bytes: 0
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{

    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var S = Console.ReadLine();
        var K = int.Parse(Console.ReadLine());

        var target = S[K - 1];
        var sb = new System.Text.StringBuilder();
        for (int i = 0; i < N; i++)
        {
            if (S[i] == target)
            {
                sb.Append(S[i]);
            }
            else
            {
                sb.Append("*");
            }
        }

        Console.WriteLine(sb.ToString());
    }

}



Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
using  namespace std; 
int a[99999],i,j,k,n;
char s;
int main()
{
	cin>>i>>s>>j;
	if(s=='+')	cout<<i+j;
	else		cout<<i-j;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll a,b,c;
int32_t main(){
CODE_START;
cin>>a>>b>>c;
if(a+b+c>=22){
    cout<<"bust";
}else cout<<"win";
}






Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
using namespace std;

#define fi first
#define se second
typedef long long LL;
typedef long double LD;

LL N,A,B,h[100010];

bool check(LL k){
    LL cnt=0,i;
    for (i=1; i<=N; i++){
        LL rh=h[i]-B*k;
        if (rh<=0) continue;
        cnt+=(rh+A-1)/A;
    }
    return (cnt<=k);
}

int main(){
    cin >> N >> A >> B;

    int i;
    for (i=1; i<=N; i++)
        cin >> h[i];

    A=A-B;
    LL l=0,r=(1<<30),mid;
    while (l<r){
        mid=(l+r)/2;
        if (check(mid)) r=mid;
        else l=mid+1;
    }

    cout << l << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

std::vector<bool> prime_table(const int n) {
  int size = n + 1;
  std::vector<bool> isPrime(size, true);
  isPrime[0] = false;
  isPrime[1] = false;
  for (int i = 2; i < size; i++) {
    if (!isPrime[i])
      continue;
    for (int k = 2; i * k < size; k++) {
      isPrime[i * k] = false;
    }
  }
  return isPrime;
}

int main() {
  auto pt = prime_table(100000);
  vi cum(100002, 0);
  REP(i, 100000) {
    if (pt[i + 1] && pt[(i + 2) / 2]) {
      cum[i + 1] = cum[i] + 1;
    } else {
      cum[i + 1] = cum[i];
    }
  }
  int q;
  cin >> q;
  REP(i, q) {
    int l, r;
    cin >> l >> r;
    cout << cum[r] - cum[l - 1] << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		String N = sc.next();
 
		String bar = " ";
 
		if ( N.charAt(0) == N.charAt(1) && N.charAt(1) == N.charAt(2)) {
			bar = "Yes";
		} else if (  N.charAt(1) == N.charAt(2) && N.charAt(2) == N.charAt(3) ) {
			bar = "Yes";
		} else {
			bar = "No";
		}
 
		System.out.println( bar );
	}
}

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << (a) << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

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

    int a,b,c; cin >> a >> b >> c;
    cout << b + min(c, a+b+1);

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &ss[i])
	}

	alphabetCounts := make([]int, 26)
	for i := 0; i < len(alphabetCounts); i++ {
		alphabetCounts[i] = 50
	}
	for _, s := range ss {
		tmpCounts := make([]int, 26)
		for j := 0; j < len(s); j++ {
			tmpCounts[s[j]-'a']++
		}

		for j := 0; j < 26; j++ {
			alphabetCounts[j] = min(alphabetCounts[j], tmpCounts[j])
		}
	}

	// 出力
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	for i := 0; i < len(alphabetCounts); i++ {
		for j := 0; j < alphabetCounts[i]; j++ {
			fmt.Fprint(w, string('a'+byte(i)))
		}
	}
	fmt.Fprintln(w, "")
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}


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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int N;
    std::cin >> N;
    std::vector<int> A(N);
    std::set<int>    A_odd_set;
    REP(i, N) {
        std::cin >> A[i];
        if(i % 2 == 0) A_odd_set.insert(A[i]);
    }

    SORT(A);

    int ans = 0;
    REP(i, N) {
        if(i % 2 == 1 && A_odd_set.find(A[i]) != A_odd_set.end()) ans++;
    }

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

    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

class C{
  public:
    int a, b, t;
    C(){}
    bool operator < (const C &c) const { return t < c.t; }
};

int main() {
  int N, M;
  while(cin >>N >>M && (N || M)){
    vector<C> v(M);
    REP(i, M){
      cin >>v[i].t >>v[i].a >>v[i].b;
      --v[i].a; --v[i].b;
    }
    SORT(v);
    vector<bool> f(N, 0);
    f[0] = 1;
    REP(i, M) if(f[v[i].a]) f[v[i].b] = 1;
    int ans = 0;
    REP(i, N) if(f[i]) ++ans;
    cout <<ans <<endl;
  }
  return 0;
}

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

int main(){
	int a,b;
	cin >> a >> b;
	if ((a>b && b!=1)|| (a==1 && b>a)){
		cout << "Alice" << endl;
	}else if (a==b){
		cout << "Draw" << endl;
	}else{
		cout << "Bob" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

int main()
{
  int t,k;
  int i,j;
  int a[105];

  cin>>k>>t;
  rep(i,t)
    cin>>a[i];

  sort(a,a+t);
  int max=a[t-1];
  int rest=k-max+1;
  if(max-rest>0)
    cout<<max-rest<<endl;
  else
    cout<<"0"<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <bits/stdc++.h>
#define US unsigned short
#define UI unsigned int
using namespace std;

int main(int argc, char const *argv[])
{
    US a, b;
    cin >> a >> b;
    if (a > 9 || b > 9)
        cout << -1 << endl;
    else
        cout << a * b << endl;

    return 0;
}


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;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 all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

LL N, M;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> N >> M;
	LL ans;
	if (N * 2 > M) {
		ans = N - ((N * 2 - M + 1) / 2);
	} else {
		ans = N;
		M -= N * 2;
		ans += M / 4;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,ans=0;
  cin>>N;
  for(int i=2;i<=N/i;i++){
    if(N%i==0){
      int j=N;
      for(;j%i==0;j/=i);
      if(j%i==1)
        ans++;
    }
  }
  N--;
  for(int i=1;i<=N/i;i++){
    if(N%i==0)
      ans+=2;
    if(i*i==N)
      ans--;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
# coding: utf-8
# Your code here!

def replace_(x,y,target,replace):
    return target[:x]+replace+target[y+1:]

def reverse_(x,y,target):
    temp_rev = target[x:y+1]
    rev = temp_rev[::-1]
    return target[:x]+rev+target[y+1:]

def print_(x,y,target):
    print(target[x:y+1])


target = input()
num = int(input())
for _ in range(num):
    i = input().split()
    if i[0] == 'replace':
        target = replace_(int(i[1]),int(i[2]),target,i[3])
    elif i[0] == 'reverse':
        target = reverse_(int(i[1]),int(i[2]),target)
    elif i[0] == 'print':
        print_(int(i[1]),int(i[2]),target)



Measured memory_bytes: 5628
#!/user/bin/env pypy3
import sys


def fast_input():
    return sys.stdin.readline()[:-1]

def solve(masus: str):
    masu_list = map(int, list(masus))
    bdama_count = 0
    for masu in masu_list:
        if masu == 1:
            bdama_count += 1
    return bdama_count

def main():
    result = solve(fast_input())
    print(result)

main()


Measured memory_bytes: 9100
#include <stdio.h>
#include <stdlib.h>
int main()
{
    char s[4];
    int a, b, temp;
    scanf("%s", s);
    temp = atoi(s);
    a = temp / 100;
    b = temp % 100;
    if (0 < a && a < 13)
    {
        if (0 < b && b < 13)
            printf("AMBIGUOUS");
        else
            printf("MMYY");
    }
    else
    {
        if (0 < b && b < 13)
            printf("YYMM");
        else
            printf("NA");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
	char a;
	cin>>a;
	if(a=='a')
	{
		cout<<"vowel"<<endl; 
	} 
	else if(a=='e')
	{
	 	cout<<"vowel"<<endl; 
	} 
	else if(a=='i')
	{
	 	cout<<"vowel"<<endl; 
	} 
	else if(a=='o')
	{
	 	cout<<"vowel"<<endl; 
	} 
	else if(a=='u')
	{
	 	cout<<"vowel"<<endl; 
	} 
	else{
		cout<<"consonant"<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
beforeKill = 0
for i in range(n):
    kill1 = min(A[i] - beforeKill, B[i])
    kill2 = min(A[i+1], B[i] - kill1)
    cnt += kill1 + kill2
    beforeKill = kill2
print(cnt)

Measured memory_bytes: 18476
#include<bits/stdc++.h>
using namespace std;
#define MAXN (100000+10)

struct task{
    string name;
    int time;
}a[MAXN];

int read() {
    int x=0,f=1,ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

#define REP(i,e,s) for(register int i=e; i<=s; i++)

queue<task> w;

int main() {
    int n=read(),q=read();
    REP(i,1,n) {
        cin>>a[i].name;
        a[i].time=read();
        w.push(a[i]);
    }
    int _time=0;
    while(!w.empty()) {
        if(w.front().time<=q) {
            cout<<w.front().name<<" ";
            _time+=w.front().time;
            w.pop();
            printf("%d\n",_time);
        }
        else {
            _time+=q;
            w.front().time=w.front().time-q;
            w.push(w.front());
            w.pop();
        }
    }
}


Measured memory_bytes: 7832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

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

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
// dp[i][j][k][b] iビット以上, j∈(0,1) yがR未満か, k∈(0, 1) xがLより大きいか, b∈(0, 1) (1, 1)が出たか
ll dp[65][2][2][2];

int main() {
    init();
    ll L, R;
    cin >> L >> R;

    vl lb(60), rb(60);
    rep(i, 60) lb[i] = L >> i & 1, rb[i] = R >> i & 1;

    dp[60][0][0][0] = 1;
    bool ok;
    repr(i, 60) rep(j, 2) rep(k, 2) rep(b, 2) {
        ll v = dp[i + 1][j][k][b], toj, tok, tob;

        // (y, x) = (0, 0)
        tie(ok, toj, tok, tob) = tuple(true, j, k, b);
        if (rb[i] == 1 and j == 0) toj = 1;
        if (lb[i] == 1 and k == 0) ok = false;

        if(ok) (dp[i][toj][tok][tob] += v) %= MOD;

        // (1, 0)
        tie(ok, toj, tok, tob) = tuple(true, j, k, b);
        if (rb[i] == 0 and j == 0) ok = false;
        if (lb[i] == 1 and k == 0) ok = false;
        if (b == 0) ok = false;

        if (ok) (dp[i][toj][tok][tob] += v) %= MOD;

        // (1, 1)
        tie(ok, toj, tok, tob) = tuple(true, j, k, b);
        if (rb[i] == 0 and j == 0) ok = false;
        if (lb[i] == 0 and k == 0) tok = 1;
        if (b == 0) tob = 1;

        if (ok) (dp[i][toj][tok][tob] += v) %= MOD;
    }

    ll ans = 0;
    rep(j, 2) rep(k, 2) ans += dp[0][j][k][1];

    cout << ans % MOD << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define is(s) freopen((const char*)(s),"r",stdin)
#define os(s) freopen((const char*)(s),"w",stdout)
#define elif else if
#define pb push_back

using namespace std;
int h,n,sum=0,tmp;
int main()
{
	//is("");os("");
	//ios_base::sync_with_stdio(false);cin.tie(0);
	cin>>h>>n;
	rep(i,n)
	{
		cin>>tmp;
		sum+=tmp;
	}
	if(sum>=h)
	cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;}


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

int main() {
    int n,k;
    cin>>n>>k;
    vector<bool> a(10,false);
    for(int i = 0;i < k;++i) {
        int t;
        cin>>t;
        a[t]=true;
    }
    while(true){
        int nn=n;
        bool ok=true;
        while(nn>0){
            if(a[nn%10]){
                ok=false;
                break;
            }
            nn/=10;
        }
        if(ok){
            cout<<n<<endl;
            return 0;
        }
        ++n;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include <stdio.h>
#include<unordered_map>
#define Amr_Abdelazim ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define P complex<ld>
#define X real()
#define Y imag()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rep(i,n)   for(int i=0;i<n;i++)
#define repp(i,s,n)   for(int i=s;i<=n;i++)
#define print(v) {for(auto i:v)cout<<i<<" ";cout<<"\n";}
#define mkp make_pair
#define clr(ar,v) memset(ar,v,sizeof(ar));
#define TC ll amr_abdelazim;cin>>amr_abdelazim;while(amr_abdelazim--)
#define popcnt(x) __builtin_popcount(x)
#define EPS 1e-9
#define INF 1000000000000000009
using namespace std;
//freopen("output.txt", "w", stdout);
//freopen("input.txt", "r", stdin);
const int mod = 1000000007;
const int N = 2 * 100000 + 9;
const double pi = acos(-1);
class cmp{
public:
	bool operator() (ll &A, ll &B){
		return A > B;
	}
};
bool by_sec(const pll &a, const pll &b){
	if ((abs(a.first) == abs(b.first)))
		return (abs(a.second) < abs(b.second));
	return (abs(a.first) < abs(b.first));
}
bool byth(const tuple<ll, ll, ld>& a, const tuple<ll, ll, ld>& b){
	return (get<2>(a) < get<2>(b));
}
ld dist(P a, P b){
	return (ld)abs(a - b);
}
ll fact[1000009], inv[1000009];
ll fp(ll a, ll b){
	if (b == 0)
		return 1;
	ll ans = fp(a, b / 2);
	ans = (ans * ans) % mod;
	if (b % 2 != 0)
		ans = (ans * (a % mod)) % mod;
	return ans;
}
void FacInv(ll n){
	fact[0] = inv[0] = 1;
	for (ll i = 1; i <= n; i++)
	{
		fact[i] = ((i%mod) * fact[i - 1] % mod) % mod;
		inv[i] = fp(fact[i], mod - 2);
	}
}
ll ncr(ll n, ll r){
	return (((fact[n] * inv[r]) % mod) * inv[n - r]) % mod;
}
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a%b);
}
ll max(ll a, ll b){
	if (a >= b)return a;
	else return b;
}
ll min(ll a, ll b){
	if (a <= b)return a;
	else return b;
}



int main()
{
	Amr_Abdelazim

		ll n;
	cin >> n;
	vll a(n), b(n), c(n);
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n)cin >> c[i];
	sort(all(a)); sort(all(b)); sort(all(c));
	vll sm(n);
	rep(i, n){
		ll s = 0, e = n - 1, md,dx=-1;
		while (s <= e){
			md = s + (e - s) / 2;
			if (a[md] < b[i]){
				s = md + 1;
				dx = md;
			}
			else e = md - 1;
		}
		if (dx == -1){
			if (i)sm[i] = sm[i - 1];
			else sm[i] = 0;
		}
		else{
			if (i)sm[i] = sm[i - 1]+dx+1;
			else sm[i] = dx+1;
		}
	}
	ll ans = 0;
	rep(i, n){
		ll s = 0, e = n - 1, md, dx = -1;
		while (s <= e){
			md = s + (e - s) / 2;
			if (b[md] < c[i]){
				s = md + 1;
				dx = md;
			}
			else e = md - 1;
		}
		if (dx!=-1)
		ans += sm[dx];
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 6388
S=input()
T=input()
li=[]
for i in reversed(range(len(S)-len(T)+1)):
    st=S[i:i+len(T)]
    t=True
    for j in range(len(T)):
        if(st[j]!='?' and st[j]!=T[j]):
            t=False
            break
    if(t):
        tmp=S.replace('?','a')
        li.append(tmp[:i]+T+tmp[i+len(T):])
if(li):
    print(sorted(li)[0])
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
import java.util.*

fun main(args: Array<String>) = abc157e()

fun abc157e() {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    val q = readLine()!!.toInt()
    val queries = (1..q).map {
        readLine()!!.split(' ').map { it }
            .let { Query(if (it[0].toInt() == 1) QueryType.UPDATE else QueryType.GET, it[1].toInt(), it[2]) }
    }

    val arr = IntArray(n)
    s.forEachIndexed { index, c ->
        arr[index] = charToBit(c)
    }

    val st = SegmentTree(arr, Int::or)
    val answer = StringBuilder()

    for ((type, x, y) in queries) {
        when (type) {
            QueryType.UPDATE -> st[x - 1] = y[0]
            else -> answer.appendln(st[x - 1..y.toInt() - 1])
        }
    }

    print(answer)
}

private fun charToBit(char: Char) = Math.pow(2.0, (char - 'a').toDouble()).toInt()

private data class Query(val type: QueryType, val x: Int, val y: String)
private enum class QueryType { UPDATE, GET }

private class SegmentTree(init: IntArray, val monad: (Int, Int) -> Int) {
    val indices: Int
    val nodes: IntArray

    init {
        var indices = 1
        while (indices < init.size) indices = indices shl 1
        val nodes = IntArray(2 * indices - 1)
        for (i in init.indices) nodes[i + indices - 1] = init[i]
        for (i in indices - 2 downTo 0) nodes[i] = monad(nodes[2 * i + 1], nodes[2 * i + 2])
        this.indices = indices
        this.nodes = nodes
    }

    operator fun set(x: Int, value: Char) {
        var index = x + indices - 1
        nodes[index] = charToBit(value)
        while (index > 0) {
            index = (index - 1) / 2
            nodes[index] = monad(nodes[2 * index + 1], nodes[2 * index + 2])
        }
    }

    operator fun get(range: IntRange): Int {
        val arr = LongArray(1)
        arr[0] = get(range.first, range.last + 1).toLong()
        return BitSet.valueOf(arr).cardinality()
    }

    fun get(a: Int, b: Int, k: Int = 0, l: Int = 0, r: Int = indices): Int {
        if (r <= a || b <= l) return 0
        if (a <= l && r <= b) return nodes[k]
        return monad(
            get(a, b, 2 * k + 1, l, (l + r) / 2),
            get(a, b, 2 * k + 2, (l + r) / 2, r)
        )
    }
}


Measured memory_bytes: 64016
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

int main() {
	int N,a; cin >> N;
	map <long long,int> b;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> a;
		b[a]++; ans++;
		if (b[a] == a)ans -=a;
	}
	cout << ans << endl;

}



Measured memory_bytes: 6272
#include <iostream>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define rep(i, a, n) for(int i = a; i <= n; i++)

template<class T, class U> inline bool chmax(T& a, U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a, U b) { if (a > b) { a = b; return 1; } return 0; }

// 第一引数 == 第二引数 ? true : false
template<class T, class U>
bool check(T first, U second) {
    return (first == second);
}

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


// 数字和
template<class T>
T digitSum(T num) {
    T dig;
    T sum = 0;
    while (num) {
        dig = num % 10;
        sum += dig;
        num /= 10;
    }
    return sum;
}

string background_black(string s) { return "\x1b[40m" + s; }
string background_red(string s) { return "\x1b[41m" + s + "\x1b[40m"; }
string background_green(string s) { return "\x1b[42m" + s + "\x1b[40m"; }
string background_yellow(string s) { return "\x1b[43m" + s + "\x1b[40m"; }
string background_bleu(string s) { return "\x1b[44m" + s + "\x1b[40m"; }
string background_white(string s) { return "\x1b[47m" + s + "\x1b[40m"; }

string black(string s) { return "\x1b[30m" + s + "\x1b[37m"; }
string red(string s) {return "\x1b[31m" + s + "\x1b[37m"; }
string green(string s) { return "\x1b[32m" + s + "\x1b[37m"; }
string yellow(string s) { return "\x1b[33m" + s + "\x1b[37m"; }
string blue(string s) { return "\x1b[34m" + s + "\x1b[37m"; }
string white(string s) { return "\x1b[37m" + s + "\x1b[37m"; }

const int ten = 10;
const int hundred = 100;
const int thousand = 1000;

typedef long long ll;
typedef unsigned long long ull;

string tolower(string s) {
  string c;
  for (int i = 0; i < s.size(); i++) {
    if ((s[i] >= 'A') && (s[i] <= 'Z')) {
        c.push_back((s[i] + 0x20));
    } else {
        c.push_back(s[i]);
    }
  }
  return c;
}
#include <cstdlib>
string solve() {
  string str = "";
// int->string: to_string, string->int: stoi
//=============================================================================


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

  if (a < b) {
    for (int i = 0; i < b; i++)
      str += to_string(a);
  } else {
      for (int i = 0; i < a; i++)
        str += to_string(b);
  }


//=============================================================================
  return str;
}

int main() {	
  std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
  cout << solve() << endl;
}

Measured memory_bytes: 256
use strict;
use warnings;
package SuffixArray;
#sub sa_is(\@$);
sub sa_is{
	my$upper=shift;
	my@s=@_;
	my$n=@s;
	if($n==0){
		return();
	}
	elsif($n==1){
		return(0);
	}
	elsif($n==2){
		if($s[0]<$s[1]){
			return(0,1);
		}
		else{
			return(1,0);
		}
	}
	my@sa;
	my@ls;
	for(my$i=$n-2;$i>=0;$i--){
		$ls[$i]=$s[$i]==$s[$i+1]?$ls[$i+1]:$s[$i]<$s[$i+1];
	}
	my@sum_l=(0)x($upper+1);
	my@sum_s=(0)x($upper+1);
	for(0..$n-1){
		if($ls[$_]){
			$sum_l[$s[$_]+1]++;
		}
		else{
			$sum_s[$s[$_]]++;
		}
	}
	for(0..$upper){
		$sum_s[$_]+=$sum_l[$_];
		$sum_l[$_+1]+=$sum_s[$_]if$_<$upper;
	}
	my$induce;
	$induce=sub{
		my@sa=(-1)x$n;
		my@buf=@sum_s;
		for(@_){
			next if$_==$n;
			$sa[$buf[$s[$_]]++]=$_;
		}
		@buf=@sum_l;
		$sa[$buf[$s[$n-1]]++]=$n-1;
		for(0..$n-1){
			my$v=$sa[$_];
			$sa[$buf[$s[$v-1]]++]=$v-1if$v>=1&&!$ls[$v-1];
		}
		@buf=@sum_l;
		for(my$i=$n-1;$i>=0;$i--){
			my$v=$sa[$i];
			$sa[--$buf[$s[$v-1]+1]]=$v-1if$v>=1&&$ls[$v-1];
		}
		return@sa;
	};
	my@lms_map=(-1)x($n+1);
	my$m=0;
	my@lms=();
	for(1..$n-1){
		if(!$ls[$_-1]&&$ls[$_]){
			$lms_map[$_]=$m++;
			push@lms,$_;
		}
	}
	@sa=$induce->(@lms);
	if($m>0){
		my@sorted_lms;
		for(@sa){
			push@sorted_lms,$_ if$lms_map[$_]!=-1;
		}
		my@rec_s=();
		my$rec_upper=0;
		$rec_s[$lms_map[$sorted_lms[0]]]=0;
		for(1..$m-1){
			my$l=$sorted_lms[$_-1];
			my$r=$sorted_lms[$_];
			my$end_l=$lms_map[$l]+1<$m?$lms[$lms_map[$l]+1]:$n;
			my$end_r=$lms_map[$r]+1<$m?$lms[$lms_map[$r]+1]:$n;
			my$same=1;
			if($end_l-$l!=$end_r-$r){
				$same=0;
			}
			else{
				$l++,$r++while$l<$end_l&&$s[$l]==$s[$r];
				$same=0if$l==$n||$r==$n||$s[$l]!=$s[$r];
			}
			$rec_upper++if!$same;
			$rec_s[$lms_map[$sorted_lms[$_]]]=$rec_upper;
		}
		my@rec_sa=sa_is($rec_upper,@rec_s);
		$sorted_lms[$_]=$lms[$rec_sa[$_]]for 0..$m-1;
		@sa=$induce->(@sorted_lms);
	}
	return@sa;
}
sub suffix_array(\$){
	my@s=map ord,split"",${$_[0]};
	return sa_is(255,@s);
}
package LcpArray;
sub lcp(\@\@){
	my@s=@{$_[0]};
	my$n=@s;
	my@sa=@{$_[1]};
	my@rnk;
	$rnk[$sa[$_]]=$_ for 0..$n-1;
	my@lcp;
	my$h=0;
	for(0..$n-1){
		$h--if$h>0;
		next if$rnk[$_]==0;
		my$j=$sa[$rnk[$_]-1];
		$h++while$j+$h<$n&&$_+$h<$n&&$s[$j+$h]==$s[$_+$h];
		$lcp[$rnk[$_]-1]=$h;
	}
	return@lcp;
}
sub lcp_array(\$\@){
	my@s=map ord,split"",${$_[0]};
	return lcp(@s,@{$_[1]});
}
package main;
my$s=<>;
chomp$s;
my@sa=SuffixArray::suffix_array($s);
my@lcp=LcpArray::lcp_array($s,@sa);
my$ans=@sa*(@sa+1)/2;
$ans-=$_ for@lcp;
print$ans,$/;


Measured memory_bytes: 262516
#include<bits/stdc++.h>
using namespace std;
#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--)
typedef long long LL;
int N;
LL A[100011];
LL B[100011];
LL C[100011];
int main(){
	cin>>N;
	REP(i,N+1){
		cin>>A[i];
	}
	if(N==0){
		if(A[0]!=1){
			cout<<-1<<endl;
		}else{
			cout<<1<<endl;
		}
		return 0;
	}
	if(A[0]!=0){
		cout<<-1<<endl;
		return 0;
	}
	B[0]=1;
	bool check=false;
	REP(i,N){
		if(B[i]*2<A[i+1]){
			check=true;
		}else{
			B[i+1]=B[i]*2-A[i+1];
			if(B[i+1]>1e16){
				B[i+1]=1e16;
			}
		}
	}
	if(check){
		cout<<-1<<endl;
		return 0;
	}
	LL ans=A[N];
	LL now=0;
	C[N]=A[N];
	for(int i=N;i>=1;i--){
		LL nxt=min((now+A[i]),B[i-1]);
		ans+=nxt+A[i-1];
		now=nxt;
		C[i-1]=nxt;
	}
	/*REP(i,N+1){
		cout<<B[i]<<" "<<C[i]<<endl;
	}*/
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;
int main() {
   while (true) {
      int x, y;
      cin >> x >> y;
      if (x == 0 && y == 0)
         break;
      if (x > y)
         swap(x, y);
      printf("%d %d\n", x, y);
   }
   return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector




void solve()
{
    int k,x;
    cin>>x>>k;
    forn(i,k-x+1,k+x-1)cout<<i<<" ";
    
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    }



    return 0;

}

//       g++ -g c.cpp ; ./a.exe

Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from math import degrees, atan

a, b, x = li()
c = x / (a*a)

if x == a*a*b:
    print(0)
elif a * c > (a * b) / 2:
    print(90 - degrees(atan((a / (2*(b-c))))))
else:
    print(90 - degrees(atan(2*a*c / (b**2))))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N, M, X, Y;
  X = 0;
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < M; i++) {
    X += A.at(i);
  }
  Y = N - X;
  if (Y >= 0){
  cout << Y << endl;
  }
  else {
  cout << -1 << endl;
  }

}
  
    


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int h, w; cin >> h >> w;
  V<string> c(h); for (int i = 0; i < h; i++) cin >> c[i];
  int res = 0;
  for (int j = 0; j < w - 1; j++) {
    VV<> cl, cr; assign(cl, h + 1, h + 1); assign(cr, h + 1, h + 1);
    for (int i = 0; i < h; i++) {
      for (int k = 0; k < i + 1; k++) {
        cl[i + 1][k + 1] = cl[i + 1][k] + (c[k][j] == c[k + h - 1 - i][j + 1]);
        cr[i + 1][k + 1] = cr[i + 1][k] + (c[k][j + 1] == c[k + h - 1 - i][j]);
      }
    }
    VV<> dp; assign(dp, h + 1, h + 1);
    for (int l = 0; l < h; l++) for (int r = 0; r < h; r++) {
      dp[l + 1][r + 1] = min(dp[l + 1][r], dp[l][r + 1]) + (l < r ? cl[h - (r - l)][l + 1] : cr[h - (l - r)][r + 1]);
    }
    res += dp[h][h];
  }
  cout << res << '\n';
}

Measured memory_bytes: 1520
N, M = map(int, input().split())
from1 = set()
toN = set()
for _ in range(M):
  a, b = map(int, input().split())
  if a == 1:
    from1.add(b)
  elif b == N:
    toN.add(a)
if from1 & toN:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


Measured memory_bytes: 18936