akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
string s,t;
vector<int> v[26];
int main() {
    cin>>s>>t;
    for(int i=0;i<s.size();i++)
    {
        v[s[i]-'a'].pb(i);
    }
    for(int i=0;i<26;i++)
    {
        v[i].pb(1e8);
    }
    int last=-1;
    ll sum=0;
    vector<int>::iterator it;
    for(int i=0;i<t.size();i++)
    {
        if(v[t[i]-'a'].size()==1)
        {
            cout<<-1;
            return 0;
        }
        int a=t[i]-'a';
        it=upper_bound(v[a].begin(),v[a].end(),last);
        //cout<<last<<' '<<*it<<endl;
        if(*it>v[a][v[a].size()-2])
        {
            sum++;
            last=v[a][0];
        }
        else
            last=*it;
    }ll o=s.size();
    sum=sum*o+1+last;
    cout<<sum;
    return 0;
}
// ABAB
//


Measured memory_bytes: 1216
import java.io.*;
import java.util.*;

public class Main {
    private void solve() {
        int N = sc.nextInt();
        long K = sc.nextLong();

        int[] A = new int[N + 1];
        for (int i = 1; i <= N; i++) {
            A[i] = sc.nextInt();
        }

        List<Integer> h = new ArrayList<>();
        Map<Integer, Integer> map = new HashMap<>();
        int cur = 1;
        while (!map.containsKey(cur)) {
            map.put(cur, h.size());
            h.add(cur);
            cur = A[cur];
        }

        int start = map.get(cur);
        if (K < h.size()) {
            out.println(h.get((int) K));
        } else {
            int loop = h.size() - start;
            int t = (int)((K - start) % loop);
            out.println(h.get(t + start));
        }
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}


Measured memory_bytes: 68472
def S(r,y):return 1+y*r/100
def C(r,y):return pow(1+r/100,y)
while 1:
    n=int(input())
    if n==0:break
    y=int(input())
    a=0.
    for _ in range(n):
        b,r,t=map(int,input().split())
        c=[S(r,y),C(r,y)][t-1]
        if(a<c): d=b;a=c
    print(d)

Measured memory_bytes: 7880
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<(n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
ll dp[1000][1000];
ll rui[1000];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;
  for(int i=0;i<n;i++){
    rui[i+1]+=rui[i]+A[i];
  }
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if(i!=j)
	dp[i][j]=llINF;
  for(int i=0;i<n;i++)dp[i][i]=0;
  for(int i=2;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      for(int k=j;k<=j+i-1;k++){
	dp[j][j+i-1]=min(dp[j][j+i-1],rui[j+i]-rui[j]+(dp[j][k]+dp[k+1][j+i-1]));
      }
    }
  }

  cout<<dp[0][n-1]<<endl;
  return 0;
}

Measured memory_bytes: 4224
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var cnt = 0L;
            for (var i = 1; i <= N; i += 2)
            {
                var num = 0L;
                for (var j = 1; j <= i; ++j)
                    if (i % j == 0) ++num;
                if (num == 8) ++cnt;
            }
            WriteLine(cnt);
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a) ;i < (b) ;i++)
#define repr(i, a, b) for (int i = (b) - 1 ;i >= a ;i--) 
int main(){
	int N, A, B ;
	string s ;
	cin>>N >>A>>B ;
	cin>>s ;
	int a = 0, b = 0 ;
	for (int i = 0 ;i < N ;i++){
		if (s[i] == 'c')cout<<"No"<<endl ;
		if (s[i] == 'a'){
			if (a + b < A + B){
				a++ ;
				cout<<"Yes"<<endl ;
			}
			else cout<<"No"<<endl ;
		}
		if (s[i] == 'b'){
			if (a + b < A + B && b < B){
				b++ ;
				cout<<"Yes"<<endl ;
			}
			else cout<<"No"<<endl ;
		}
	}
	return 0 ;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

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

  int cntZero = 0;
  int cntOne = 0;
  for(int i = 0; i < S.length(); i++){
    if(S[i] == '0') cntZero++;
    else cntOne++;
  }
  int ans = min(cntZero, cntOne) * 2;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 512
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);
//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	}
}


Measured memory_bytes: 21844
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

li  = []

for i in a:
    for j in b:
        li.append(i+j)

li.sort(reverse=True)
li = li[:k]

lin = []

for i in li:
    for j in c:
        lin.append(i+j)

lin.sort(reverse=True)

for i in range(k):
    print(lin[i])

Measured memory_bytes: 156012
n, k = map(int, input().split())

x = list(map(int, input().split()))

ans = 10000000000010

for i in range(n):
    if i+k-1 < n:
        if x[i] >= 0:
            ans = min(ans, x[i+k-1])
        elif x[i+k-1] <= 0:
            ans = min(ans, -x[i])
        else:
            ans = min(ans, -x[i]*2+x[i+k-1])
            ans = min(ans, x[i+k-1]*2-x[i])

print(ans)

Measured memory_bytes: 14384
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let h: usize = input();
    let w: usize = input();
    let k: usize = input();
    const MOD: i64 = 1000000007;

    if w == 1 {
        println!("1");
        return;
    }

    let b: Vec<usize> = (0..w).collect();
    let mut dp = vec![vec![0i64; w]; h + 1];
    dp[0][0] = 1;
    for i in 0..h {
        for j in 0..1 << (w - 1) {
            let ok = b
                .windows(2)
                .all(|b| (j >> b[0]) & 1 == 0 || (j >> b[1]) & 1 == 0);
            if !ok {
                continue;
            }

            let mut to: Vec<usize> = (0..w).collect();
            for k in 0..w - 1 {
                if (j >> k) & 1 == 1 {
                    to.swap(k, k + 1);
                }
            }

            for k in 0..w {
                dp[i + 1][to[k]] += dp[i][k];
                dp[i + 1][to[k]] %= MOD;
            }
        }
    }

    println!("{}", dp[h][k - 1]);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
namespace 令和{
    class ABC{
        static void Main(){
            
            int n = int.Parse(Console.ReadLine());
            List<int[]>[] tonari = new List<int[]>[n+1];
            int[] ans = new int[n+1];
            for(int i=0;i<n+1;i++){
                tonari[i] = new List<int[]>();
                ans[i] = -1;
            }
            for(int i=1;i<n;i++){
          	    int u;int v;int w;
                string[] uvw = Console.ReadLine().Split();
                u = int.Parse(uvw[0]);
                v = int.Parse(uvw[1]);
                w = int.Parse(uvw[2]);
                tonari[u].Add(new int[2]{v,w});
                tonari[v].Add(new int[2]{u,w});
            }

            Queue<int> q = new Queue<int>();
            q.Enqueue(1);
            ans[1] = 0;

            while(q.Count>0){
                int p = q.Dequeue();
                foreach(int[] tnr in tonari[p]){
                    if(ans[tnr[0]]==-1){
                        if(tnr[1]%2==0){
                            ans[tnr[0]] = ans[p];
                        }else{
                            ans[tnr[0]] = 1-ans[p];
                        }
                        q.Enqueue(tnr[0]);
                    }
                }
            }
            for(int i=0;i<n;i++){
                Console.WriteLine(ans[i+1]);
            }


        }
    }
}


Measured memory_bytes: 37320
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

class Main {
  private static BufferedReader buf;
  public static void main(String[] args) throws IOException {
    int[] abc = new int[3];
    String str;
    String[] inp;
    buf = new BufferedReader(new InputStreamReader(System.in));
    str = buf.readLine();
    inp = str.split(" ", -1);
    for (int i = 0; i < inp.length; i++) abc[i] = Integer.parseInt(inp[i]);
    if (abc[0] < abc[1] && abc[1] < abc[2]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

using namespace std;

string s="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",q;
int n,i;

int main() 
{
    for (int i=0; i<s.size(); i++)
     s[i]=toupper(s[i]);
    cin>>n>>q;
    for (i=0; i<q.size(); i++)
        q[i]=s[(q[i]-65)+n];
    cout<<q;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    B = list(map(int, input().split()))
    A = [B[0]]
    for i in range(N - 1):
        a = max([A[-1], B[i]])
        if i != N - 2 and a > B[i + 1]:
            a = B[i + 1]
        A.append(a)
    print(sum(A))


if __name__ == '__main__':
    main()

Measured memory_bytes: 61952
x = int(input())

if 1800 <= x and x <= 1999:
    print(1)
if 1600 <= x and x <= 1799:
    print(2)
if 1400 <= x and x <= 1599:
    print(3)
if 1200 <= x and x <= 1399:
    print(4)
if 1000 <= x and x <= 1199:
    print(5)
if 800 <= x and x <= 999:
    print(6)
if 600 <= x and x <= 799:
    print(7)
if 400 <= x and x <= 599:
    print(8)


Measured memory_bytes: 9184
#include <stdio.h>

int main(void)
{
	int x;
	int i;
	i = 0;
	while (1){
		scanf("%d", &x);
		if(x == 0){
			break;
		}
		i++;
		printf("Case %d: %d\n", i, x);
		
	}
	return (0);
}

Measured memory_bytes: 596
from statistics import median

N, K = [int(x) for x in input().split()]
line_in_dice = list([(int(x) + 1) / 2 for x in input().split()])

result = [0] * (N + K)

result[0] = line_in_dice[0]
result[K] -= line_in_dice[0]

max_point = 0
max_value = 0

for i in range(1, N):
    result[i] += (result[i - 1] + line_in_dice[i])
    result[i + K] -= line_in_dice[i]

print(max(result))


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

using namespace std;

const int mod = 1e9 + 7;

int add(int a, int b) {
  return a + b - mod * (a + b >= mod);
}

int mul(int a, int b) {
  return int(1ll * a * b % mod);
}

int pwr(int a, int x) {
  if (x == 0) {
    return 1;
  }
  return mul(pwr(mul(a, a), x >> 1), (x & 1 ? a : 1));
}

int dvd(int a, int b) {
  return mul(a, pwr(b, mod - 2));
}

int sub(int a, int b) {
  return a - b + mod * (a < b);
}

void inc(int& a, int b) {
  a = add(a, b);
}

void dec(int& a, int b) {
  a = sub(a, b);
}

const int N = 1e5 + 10;
int dp[N][101];

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

  dp[0][0] = 1;
  int n, k;
  cin >> n >> k;
  for (int it = 1; it <= n; ++it) {
    int x;
    cin >> x;
    int sum = 0;
    for (int i = 0; i <= k; ++i) {
      inc(sum, dp[i][it - 1]);
      inc(dp[i][it], sum);
      if (i >= x) {
        dec(sum, dp[i - x][it - 1]);
      }
    }
  }
  cout << dp[k][n];

  return 0;
}

Measured memory_bytes: 39680
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


int main() {
	int A, B;
	string S;
	cin >> A >> B >> S;

	string ans = "Yes";
	if (S[A]!='-') ans = "No";
	string first = S.substr(0, A);
	string second = S.substr(A+1, B);

	for (auto s : first) {
		if (!isdigit(s)) ans = "No";
	}
	for (auto s : second) {
			if (!isdigit(s)) ans = "No";
		}
	cout << ans << endl;
}

Measured memory_bytes: 256
let () =
  let line = read_line() in
  let toggle str=
    let length = String.length str and
        toggle ch = match ch with
            'a'..'z' -> Char.uppercase ch |> Char.escaped
          | 'A'..'Z' -> Char.lowercase ch |> Char.escaped
          | c -> String.make 1 c in
    let rec loop idx = match idx with
        i when i=length -> ""
      | i -> (toggle str.[i])^(loop (i+1))
    in loop 0
  in toggle line |> print_endline;;

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

int calc_gcd(int a, int b) {
	if (a == 0 && b == 0) {
		return 0;
	} else if (a == 0) {
		return b;
	} else if (b == 0) {
		return a;
	}

	if (a < b) {
		int tmp = a;
		a       = b;
		b       = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N + 1);
	for (int i = 1; i <= N; ++i) {
		cin >> A[i];
	}
	int answer = 1;
	vector<int> L(N + 2), R(N + 2);
	L[1]     = 0;
	R[N + 1] = 0;

	for (int i = 1; i <= N; ++i) {
		L[i + 1]     = calc_gcd(L[i], A[i]);
		R[N + 1 - i] = calc_gcd(R[N + 2 - i], A[N + 1 - i]);
	}
	for (int i = 1; i <= N; ++i) {
		int tmp = calc_gcd(L[i], R[i + 1]);
		if (tmp > answer) {
			answer = tmp;
		}
	}
	cout << answer << endl;
}


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

int main()
{
  int N;scanf("%d",&N);
  int A[2][N];int low[N],up[N];
  for(int i=0;i<2;i++)for(int j=0;j<N;j++)
  {
    scanf("%d",&A[i][j]);
    if(i==0)up[j]=A[i][j];
    else low[j]=A[i][j];
  }
  for(int i=1;i<N;i++)up[i]+=up[i-1],low[N-i-1]+=low[N-i];
  int ans=0;
  for(int i=0;i<N;i++)ans=max(ans,up[i]+low[i]);
  printf("%d",ans);
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N;
ll a[100010][3];
ll dp[100010][3];

int main() {
    cin >> N;
    rep(i, N) { rep(j, 3) cin >> a[i][j]; }

    // 初期化
    rep(i, 100010) { rep(j, 3) dp[i][j] = 0; }

    // DP loop
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (j == k) continue;
                chmax(dp[i+1][j], dp[i][k] + a[i][j]);
            }
        }
    }

    ll ans = 0;
    rep(i, 3) {
        ll tmp = dp[N][i];
        if (tmp > ans) ans = tmp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    long long int n,sum=0;
    int i,j,k,P,a,b,c;
    P=1;
    while(P --> 0)
    {
        cin >> n;
        for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
        for(k=1;k<=n;k++)
        sum+=__gcd(i,__gcd(j,k));
        cout << sum;

    }
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#ifndef LOCAL
struct ostdmy{template<class T>ostdmy&operator<<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
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;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    string s,t;
    cin>>s>>t;
    sort(all(s));
    sort(all(t),greater<char>());
    Yes(s<t);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {

	/** 元金 */
	private static final BigDecimal PRINCIPAL = BigDecimal.valueOf(100000);

	/** 利息による増加率 */
	private static final BigDecimal RATE_OF_INCREASE = BigDecimal.valueOf(1.05);

	/**
	 * 入力された期間から返済額を計算して出力する。
	 *
	 * @param args
	 */
	public static void main(String[] args) throws IOException {

		// 期間を受け取る
		int week = readNumber();

		// 返済額を計算する
		BigDecimal debt = PRINCIPAL;
		for (int i = 0; i < week; i++) {
			// 1週間ごとに5%利子をつけ、1000円未満は切り上げる
			debt = debt.multiply(RATE_OF_INCREASE).setScale(-3,
					RoundingMode.CEILING);
		}

		// 計算結果を出力する
		System.out.println(debt.toPlainString());
	}

	/**
	 * 標準入力から1行読み込んで返す。
	 *
	 * @return 入力された数値
	 */
	protected static int readNumber() throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		String line = reader.readLine();

		if (reader != null) {
			reader.close();
		}

		return Integer.parseInt(line);
	}

}

Measured memory_bytes: 16972
/*      Author : Kaustubh Gangwar
        Institute : IIITA        */
#include <bits/stdc++.h>
using namespace std;
#define modo 1000000007
#define F first
#define S second 
#define pb push_back
#define gcd __gcd
#define vi vector<int>
#define vll vector<long long>
#define all(x) (x).begin(),(x).end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define CODING ios_base::sync_with_stdio(false); 
#define SAMRAT cin.tie(0),cout.tie(0);
#define mii map<int,int>
#define nl '\n'
typedef long long  ll;
typedef pair<int,int> pii;
 
ll bpow(ll a, ll b) {
    a=a; ll ans = 1;
    while(b){
        if (b & 1)
        ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}

int32_t main()
{ 
   CODING SAMRAT
   int test=1;
   //cin>>test;
   while(test--)
   {
       ll n; cin>>n;
       ll a[n];
       f(i,0,n) cin>>a[i];
       ll ans=0;
        f(i,0,n)
        {
            f(j,i+1,n)
            {
                f(k,j+1,n)
                {   if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
                    {if(a[k]<a[j]+a[i] && a[i]<a[j]+a[k] && a[j]<a[k]+a[i])
                    ans++;
                    }
                }
            }
        }
        cout<<ans;
   }

return 0;
}

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

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h), t;
    for (int i = 0; i < h; i++) cin >> s[i];
    
    int ans = 0;
    for (int bith = 0; bith < (1<<h); bith++) {
        for (int bitw = 0; bitw < (1<<w); bitw++) {
            t = s;
            for (int i = 0; i < h; i++) {
                if (bith & (1<<i)) {
                    for (int j = 0; j < w; j++) t[i][j] = 'R'; 
                }
            }
            for (int i = 0; i < w; i++) {
                if (bitw & (1<<i)) {
                    for (int j = 0; j < h; j++) t[j][i] = 'R'; 
                }
            }
            int count = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (t[i][j] == '#') count++;
                }
            }
            if (count == k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
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;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}




ll N;

int main () {
  cin >> N;
  string ans = "";

  if (N == 0) {
    ans += "0";
  } else {
    while (N != 0) {
      //cout << N << "\n";

      int d = N % 2;
      if (d == -1) d = 1;

      if (d == 0) {
        ans = "0" + ans;
        N /= -2;
      } else {
        ans = "1" + ans;
        N = (N - 1) / (-2);
      }
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
#s = input()

while(True):
	n, p = map(int, input().split())
	if (n==0&p==0):break
	N = [0]*n
	owan = p
	turn = 0
	while(True):
		if turn == n:
			turn = 0
		
		if owan==0:
			owan = N[turn]
			N[turn] = 0
		else:
			owan -= 1
			N[turn] += 1

		if (N[turn] == p):
			break
		turn += 1
	print(turn)




Measured memory_bytes: 5600
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto v = s[0];
    auto e = s[1];
    auto mf = new Dinic(v, 0, v-1);
    foreach (_; 0..e) {
        s = readln.split.map!(to!int);
        auto x = s[0];
        auto y = s[1];
        auto cap = s[2];
        mf.add_edge(x, y, cap);
    }

    mf.run.writeln;
}

class Dinic {
    import std.typecons : Tuple;
    import std.conv : to;
    import std.container : DList;
    import std.algorithm : min;

    alias Edge = Tuple!(int, "to", long, "cap", long, "rev");
    immutable long INF = 1L << 59;

    int V, source, sink;
    Edge[][] G;
    int[] itr, level;

    this(int V, int s, int t) {
        this.V = V;
        G = new Edge[][](V);
        source = s;
        sink = t;
    }

    void add_edge(int from, int to, long cap) {
        G[from] ~= Edge(to, cap, G[to].length.to!long);
        G[to] ~= Edge(from, 0, G[from].length.to!long-1);
    }

    void bfs(int s) {
        level = new int[](V);
        level[] = -1;
        DList!int q;
        level[s] = 0;
        q.insertBack(s);
        while (!q.empty) {
            int v = q.front();
            q.removeFront();
            foreach (e; G[v]){
                if (e.cap > 0 && level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    q.insertBack(e.to);
                }
            }
        }
    }

    long dfs(int v, int t, long f) {
        if (v == t) return f;
        for (int i = itr[v]; i < G[v].length.to!int; ++i) {
            if (G[v][i].cap > 0 && level[v] < level[G[v][i].to]) {
                long d = dfs(G[v][i].to, t, min(f, G[v][i].cap));
                if (d > 0) {
                    G[v][i].cap -= d;
                    G[G[v][i].to][G[v][i].rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    long run() {
        long ret = 0, f;
        while (true) {
            bfs(source);
            if (level[sink] < 0) break;
            itr = new int[](V);
            while ((f = dfs(source, sink, INF)) > 0) ret += f;
        }
        return ret;
    }
}



Measured memory_bytes: 2720
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,x,y) for(int i=x;i<y;i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 400010;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    int x;
    cin >> x;
    int p=x/11;
    int r=x-p*11;
    int ans;
    if(r==0) {
        ans=2*p;
    }else if(r<=6) {
        ans=2*p+1;
    }else{
        ans=2*p+2;
    }

    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <map>

using namespace std;
const int NUM = 1000000007;

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i * i <= n; i += 2) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

int main() {
	int n; cin >> n;
	long long ans = 1;
	map<int, int> mp;
	for (int i = 1; i <= n; i++) {
		int tmp = i;
		for (int j = 2; j <= i; j++) {
			if (tmp % j == 0) {
				mp[j]++;
				tmp /= j;
				j--;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		ans *= (long long)(mp[i] + 1);
		ans %= NUM;
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
  char c;
  cin>>c;
  if(isupper(c))
    cout<<"A"<<"\n";
  else
    cout<<"a"<<"\n";
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		
		if(x < 30) {
			System.out.println("No");
		}
		else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 35608
#include <iostream>

using namespace std;

int main() {
	string str, str2;
	int flg = 0;
	cin >> str;
	cin >> str2;

	if (!(str.length() < str2.length())) {
		for (int i = 0; i < (int)str.length(); ++i) {
			string temp;

			if (i + str2.length() < str.length() + 1) {
				temp = str.substr(i, str2.length());
			}
			else{
				temp = str.substr(i, str.length()) + str.substr(0, str2.length() - (str.length() - i));
			}

			if (temp == str2) {
				flg = 1;
				break;
			}
		}
	}

	if (flg == 0) cout << "No" << endl;
	else if (flg == 1) cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3228
#East[north][top] -> E
class Dice():
 East = [ [0,3,5,2,4,0]
		 ,[4,0,1,6,0,3]
		 ,[2,6,0,0,1,5]
		 ,[5,1,0,0,6,2]
		 ,[3,0,6,1,0,4]
		 ,[0,4,2,5,3,0]
		 ]
 def __init__(self,N):
  self.label = N
  self.top = 1
  self.north = 5
 def move(self,ori):
  #print(self.top,self.north,ori)
  if ori=='S':
   t = self.top
   self.top = self.north
   self.north = 7-t
  elif ori=='N':
   t = self.top
   self.top = 7-self.north
   self.north = t
  elif ori=='E':
   east = self.East[self.north-1][self.top-1]
   self.top = 7-east
  elif ori=='W':
   east = self.East[self.north-1][self.top-1]
   self.top = east
# Clockwise
  elif ori=='C': 
   east = self.East[self.north-1][self.top-1]
   self.north = east
 def gettop(self):
  return( self.label[self.top-1] )
 def getbottom(self):
  return( self.label[6-self.top] )
 def getnorth(self):
  return( self.label[self.north-1] )
 def getsouth(self):
  return( self.label[6-self.north] )
 def geteast(self):
  east = self.East[self.north-1][self.top-1]
  return( self.label[east-1] )
 def getwest(self):
  east = self.East[self.north-1][self.top-1]
  return( self.label[6-east] )

n = int(input())
Dices = [Dice(0 for x in range(6)) for y in range(n)]
for ni in range(n):
 label = list(map(int, input().split() ))
 Dices[ni] = Dice(label)
bAllDiff = True
for no in range(n-1):
 D = Dices[no]
 for ni in range(no+1,n):
  E = Dices[ni]
  # outer loop: put all 6 faces to the top to check
  bChecked = False
  sMove = 'NNNEEE'
  for mi in range(len(sMove)+1):
   if D.gettop() == E.gettop() and D.getbottom() == E.getbottom():
    sRot = 'CCCC'
    for ri in range(len(sRot)):
     if D.getnorth() == E.getnorth() and D.geteast() == E.geteast() and D.getsouth() == E.getsouth() and D.getwest() == E.getwest():
      bChecked = True
      bAllDiff = False
      #print(no,ni,'Same')
      break
     if ri<len(sRot):
      E.move(sRot[ri])
   if bChecked:
    break
   if mi<len(sMove):
    E.move(sMove[mi])
  #if not bChecked:
  #print(no,ni,'Diff')
if bAllDiff:
 print('Yes')
else:
 print('No')
 


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

int main() {
  int num;
  int tmp1, tmp2;
  int cnt = 0;
  cin >> num;
  
  vector<int> vec(num);
  for(int i = 0; i < num; i++) cin >> vec.at(i);
  
  while(true){
    if(*max_element(vec.begin(), vec.end()) == 0) break;
    
    int i = 0;
    while(i < num){
      if(vec.at(i) == 0){
        i++;
      }else{
        cnt++;
        while(i < num && vec.at(i) > 0){
          vec.at(i)--;
          i++;
        }
      }
    }
  }
  
  cout << cnt;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int a = n % 10;
    if (a == 2 || a == 4 || a == 5 || a== 7 || a == 9) 
      System.out.println("hon");
    else if (a == 0 || a == 1 || a == 6 || a == 8)
      System.out.println("pon");
    else 
      System.out.println("bon");
  }
}
      

Measured memory_bytes: 35780
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M   998244353    //1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define N 100005
#define vi vector<int>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int h;
   cin>>h;
   int res=1;
   int cnt=0;
   while(res<=h)
   {
       res*=2;
       cnt++;
   }
   cnt--;
   int ans=1;
   for(int i=0;i<=cnt;i++)
   {
       ans*=2;
   }
   ans--;
   cout<<ans<<endl;

}


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

int main() {
  int n; cin >> n;
  ll ans = 0;
  for (int i=1; i<n+1; i++) {
    if (i%3 == 0) continue;
    if (i%5 == 0) continue;
    ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
 
using namespace std;
 
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
 
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
 
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
 
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
 
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

  

int N;
vector<vector<P>> v;

bool judge(int bit){
  rep(i,N){
    
    if(!(bit & (1<<i))) continue;

    for(P itr : v[i]){
      int x = itr.first;
      int y = itr.second;

      if(y == 1 && !(bit & (1<<x))) return false;
      if(y == 0 &&  (bit & (1<<x))) return false;
    }
  }
  return true;
}

                           

int main(){
  cin >> N;
  v.resize(N);
  rep(i,N){
    int A;
    cin >> A;
    v[i].resize(A);
    rep(j,A){
      cin >> v[i][j].first >> v[i][j].second;
      v[i][j].first--;
    }
  }




  
  int ans = 0;
  for(int bit=0; bit < (1<<N); bit++){
    if(judge(bit)){
      int res = 0;
      rep(i,N) if(bit & (1<<i)) res++;
      ans = max(res,ans);
    }

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


Measured memory_bytes: 256
l, r = map(int, input().split())

mod = 2019
ans = mod
for i in range(l, r):
    for j in range(i+1, r+1):
        res = (i*j) % mod
        ans = min(ans, res)
        if res == 0:
            print(ans)
            exit()

print(ans)

Measured memory_bytes: 3060
from enum import Enum
from queue import Queue
import collections
import numpy as np


import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,D = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i+1,N):
        dist=0
        for k in range(D):
            dist += abs(X[i][k]-X[j][k])**2
        dist = np.sqrt(dist)
        if dist.is_integer():
            ans += 1

print(ans)


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
    return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void func(long long a, long long b)
{
    string A;
    string B;
    rep(i, a) A += to_string(b);
    rep(i, b) B += to_string(a);
    if (A < B)
        cout << A << endl;
    else
        cout << B << endl;
}

int main()
{
    // cout << fixed << setprecision(5);

    long long a;
    scanf("%lld", &a);
    long long b;
    scanf("%lld", &b);
    func(a, b);
    return 0;
}


Measured memory_bytes: 256
/*-- ILSH  --*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pll >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll inf=1e18+1e17;
//const ll mod =1e9+7;
const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}


const ll N = 1e4+5;

void solve(){
	int n;
	cin>>n;
	int arr[n],brr[n];
	for ( int i=0;i<n;i++)
		cin>>arr[i]>>brr[i];
	sort( arr,arr+n);
	sort( brr,brr+n);
	ld mid1,mid2;
	ll ans;
	if ( n%2){
		mid1=arr[n/2];
		mid2=brr[n/2];
		ans=mid2-mid1+1;
	}
	else{
		mid1=(ld)(arr[n/2]+arr[n/2-1])/(ld)2;
		mid2=(ld)(brr[n/2]+brr[n/2-1])/(ld)2;
		ans=mid2-mid1+1+(mid2-mid1);
	}
	cout<<ans<<'\n';

}

int main(){
	// ios_base::sync_with_stdio(false);
	// cin.tie( NULL);
	// cout.tie(NULL);
//	#ifndef ONLINE_JUDGE
//		freopen ("INPUT.txt" , "r" , stdin);
//		freopen ("OUTPUT.txt", "w" , stdout);
//	#endif

	int t=1;

	//cin>>t;

	for ( int i=1;i<=t;i++){
   // 	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}

Measured memory_bytes: 5140
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;

struct point{
    double x;
    double y;
    double z;
    double r;
};

point p[100];
double d[100][100];

double get_dist(point a, point b){
    double tmp = sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0) + pow(a.z - b.z, 2.0));
    return max(tmp - (a.r + b.r), 0.0);
}

void calc_dist(int n){
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            double dist = get_dist(p[i], p[j]);
            d[i][j] = dist;
            d[j][i] = dist;
        }
    }
}

double prim(int n){
    bool used[100];
    double mincost[100];
    double inf = 100000.0;
    for (int i = 0; i < n; i++) {
        used[i] = false;
        mincost[i] = inf;
    }
    mincost[0] = 0.0;
    double res = 0.0;
    
    while (true) {
        int v = -1;
        for (int u = 0; u < n; u++) {
            if (!used[u] && (v == -1 || mincost[u] < mincost[v]))
                v = u;
        }
        if (v == -1) break;
        used[v] = true;
        res += mincost[v];
        for (int u = 0; u < n; u++) {
            mincost[u] = min(mincost[u], d[v][u]);
        }
    }
    return res;
}

int main()
{
    int n;
    while (true) {
        cin >> n;
        if (n == 0) {
            break;
        }
        for (int i = 0; i < n; i++) {
            cin >> p[i].x >> p[i].y >> p[i].z >> p[i].r;
        }
        calc_dist(n);
        printf("%.3f\n",prim(n));
    }
    
    return 0;
}

Measured memory_bytes: 1324
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
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> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

// vector vの中のn以下の数で最大のものを返す
int bs(vector<int> &v, int x){
    int ok = -1; //これがx以下 
    int ng = v.size(); //x以上 
    // 問題によってokとngを入れ替える
    while(abs(ok - ng) > 1){
        int mid = (ok + ng)/2;
        if(v[mid] <= x) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    Sort(v);
    ll ans=0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            int pos=max( bs(v,v[i]+v[j]-1)-j ,0);
            ans+=pos;
        }
    }
    fin(ans);
}



Measured memory_bytes: 256