akhauriyash/Code-Regression huggingface dataset:
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int t=s.nextInt(),i,j,k,l;t-->0;){String[][]a=new String[9][9],p=new String[9][9];for(i=0;i<9;++i)for(j=0;j<9;++j){a[i][j]=s.next();p[i][j]=" ";for(l=j;l-->0;)if(a[i][j].equals(a[i][l]))p[i][j]=p[i][l]="*";for(k=i;k-->0;)if(a[i][j].equals(a[k][j]))p[i][j]=p[k][j]="*";for(k=(i/3+1)*3;k-->i/3*3;)for(l=(j/3+1)*3;l-->j/3*3;)if(i!=k&&j!=l&&a[i][j].equals(a[k][l]))p[i][j]=p[k][l]="*";}String r="";for(i=0;i<9;r+="\n",++i)for(j=0;j<9;)r+=p[i][j]+a[i][j++];System.out.print(r+(t>0?"\n":""));}}}

Measured memory_bytes: 12000
N = int(input())
A = list(map(int, input().split()))

p_num = [0]*9

for a in A:
    if a<3200:
        p_num[a//400] += 1
    else:
        p_num[-1] += 1
    
ans = 0
for p in p_num[:-1]:
    if p:
        ans +=1
        
ans_min = max(ans,1) 
ans_max = ans + p_num[-1]

print(ans_min, ans_max)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};
 
static const double EPS = 1e-12;

int main(){
  int N,T;
  while(~scanf("%d %d",&N,&T)){
    vector<int> levels;
    for(int i=0;i<N;i++){
      int num;
      scanf("%d",&num);
      levels.push_back(num);
    }

    sort(levels.begin(),levels.end());

    ll res = 1;
    const ll MOD = 1000000007;
    for(int i=0;i<N;i++){
      ll trans_num = upper_bound(levels.begin(),levels.end(),levels[i] + T) - (levels.begin() + i);
      res = ((res % MOD) * (trans_num % MOD)) % MOD;
    }

    printf("%lld\n",res);
  }
}

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

#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define PI acosl(-1.0)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vec;
typedef vector<pll> vecp;
typedef map<ll, ll> mpll;


const int N = 1e5 + 10;
const ll INF = 1LL << 60;

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

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << to_string(H) << endl;
  debug_out(T...);
}
#define LOCAL 3
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:" << endl, debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


ll dp[10][10];

void solve()
{
	ll n;
	cin>>n;
	ll ans = 0;
	repn(i, 1, n)
	{
		string x = to_string(i);
		ll st = x[0] - '0';
		ll ed = x[x.length()-1] - '0';
		dp[st][ed]++;
	}
	rep(i, 0, 10)
		rep(j, 0, 10)
			ans += dp[i][j]*dp[j][i];
	cout<<ans<<endl;
}


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

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

int main(){
    int n;
    int k=0,m=0;
    string s,s2;
    cin >> s;
    n=s.size();
    rep(i,n){
        s2=s[i];
        if(s2=="A" or s2=="C" or  s2=="G" or s2=="T"){
            ++k;
        }
        else{
            m=max(m,k);
            k=0;
        }
    }

    m=max(m,k);

    cout << m << endl;

    

    return 0;
}

Measured memory_bytes: 3628
'use strict'

const INF = 900719925474099;


function Main(input){
    let temp = input.trim().split('\n');
    let n = parseInt(temp[0])
    
    let sp = [];
    let temp2;
    for(let i=1;i<=n;i++){
        temp2 = temp[i].split(' ');
        sp.push({s:temp2[0],p:parseInt(temp2[1]),num:i})
    }
    sp.sort((a,b)=>{
        if( a.s < b.s ){
            return -1;
        }else if(a.s > b.s){
            return 1;
        }else{
            return b.p - a.p;
        }
    })
    //sp.sort((a,b)=>b.p-a.p);
    //sp.sort((a,b)=>{if(a.s<b.s){return -1}else{return 1}});
    
    let ans = [];
    for(let i=0;i<n;i++){
        ans.push(sp[i].num);
    }
    console.log(ans.join('\n'));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        ArrayList<ArrayList<Integer>> g = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < M; i++) {
            int S = sc.nextInt() - 1;
            int T = sc.nextInt() - 1;
            g.get(S).add(T);
        }
        double ans = 1e10;
        double[] dp = new double[N];
        for (int i = 0; i < N; i++) {
            Arrays.fill(dp, 0.0);
            for (int j = N - 2; j >= 0; j--) {
                double sum = 0;
                double max = 0;
                for (int n : g.get(j)) {
                    sum += dp[n];
                    max = Math.max(max, dp[n]);
                }
                dp[j] = sum / g.get(j).size() + 1;
                if (j == i && g.get(j).size() > 1) {
                    dp[j] = (sum - max) / (g.get(j).size() - 1) + 1;
                }
            }
            ans = Math.min(ans, dp[0]);
        }
        System.out.printf("%.9f\n", ans);
    }
}


Measured memory_bytes: 93768
s = input()

flg = 0

for i in range(20001):
    len(s)
    if s[-5:] == "dream":
        s = s[:len(s) - 5]
    elif s[-7:] == "dreamer":
        s = s[:len(s) - 7]
    elif s[-5:] == "erase":
        s = s[:len(s) - 5]
    elif s[-6:] == "eraser":
        s = s[:len(s) - 6]
    elif s == "":
        flg = 1
    else:
        flg = 0
        break

if flg == 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
N, M = gets.split(' ').map(&:to_i)

l = Array.new(M)
r = Array.new(M)
M.times do |i|
	l[i], r[i] = gets.split(' ').map(&:to_i)
end

cards = r.min - l.max + 1
if cards > 0
	puts cards
else
	puts 0
end

Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
const int INF = 1001001001;

int main() {
    int N;
    double D;
    cin >> N >> D;
    vector<int> X(N);
    vector<int> Y(N);
    rep(i, N) {
        cin >> X[i];
        cin >> Y[i];
    }

    int cnt = 0;
    rep(i, N) {
        double d = sqrt(pow(X[i], 2)+pow(Y[i], 2));
        if(d<=D) {
            cnt++;
        }
    }

    print(cnt);




    return 0;
}

Measured memory_bytes: 4900
from sys import stdin
from itertools import accumulate
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    a=list(map(int,readline().split()))

    s1=list(accumulate(a))
    s2=list(accumulate(reversed(a)))

    ans=float("inf")
    for i in range(n-1):
        x=s1[i]
        y=s2[n-i-2]
        ans=min(ans,abs(x-y))

    print(ans)

if __name__=="__main__":
    main()

Measured memory_bytes: 28636
N = gets.to_i
A = gets.split.map(&:to_i)
max = 1
A.each{|a|
    max -= a
    max *= 2
}
#warn max
if max < 0
    puts(-1)
    exit
end
result = 0
node = 0
N.downto(0){|i|
    max = (max + 1) / 2
    node += A[i]
    max += A[i]
    if node > max
        node = max
    end
    #warn "node/max:#{node}/#{max}"
    result += node
}
puts result


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

void insertionSort(int a[], int n, int g, int &cnt)
{
    int key;
    for (int i = g;i < n;i++)
    {
        key = a[i];
        int j = i - g;
        while(j >= 0 && a[j] > key)
        {
            a[j+g] = a[j];
            j = j - g;
            cnt++;
        }
        a[j+g] = key;
    }
}

int shellSort(int a[], int n, int G[], int m)
{
    int cnt = 0;
    for (int i = 0;i < m;i++)
    {
        insertionSort(a, n, G[i], cnt);
    }
    return cnt;
}

int main ()
{
    int n, cnt = 0;
    cin >> n;
    int a[n+1];
    for (int i = 0;i < n;i++) cin >> a[i];
    
    int m;
    if (n >= 2) m = n/2;
    else m = 1;
    
    int G[m+1], Gsize = 0;
    
    while(m > 0)
    {
        G[Gsize] = m;
        m /= 2;
        Gsize++;
    }
    m = Gsize;
    
    cnt = shellSort(a, n, G, m);
    
    cout << m << endl;
    for (int i = 0;i < m;i++)
    {
        cout << G[i];
        if (i < m-1) cout << " ";
    }
    cout << endl << cnt << endl;
    for (int i = 0;i < n;i++)
    {
        cout << a[i] << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 6920
<?php

function check($current, $a, $b)
{
}

// 入力
fscanf(STDIN, "%d %d", $a, $b);

$result = 0;
// 2回
if ($a > $b) {
    $result = $result + $a;
    $a--;
} else {
    $result = $result + $b;
    $b--;
}

if ($a > $b) {
    $result = $result + $a;
    $a--;
} else {
    $result = $result + $b;
    $b--;
}

// 出力
echo $result . "\n";


Measured memory_bytes: 4604
# CODE FESTIVAL 2017 qualB C 3 Steps　
from collections import deque

f=lambda:map(int,input().split())
N,M=f()
G=[[] for _ in [0]*(N+1)]
for i in range(M):
    a,b=f()
    if not i:
        fa,fb=a,b
    G[a].append(b)
    G[b].append(a)
    
res=0
INF=10**9

def bfs(a):
    q=deque()
    q.append(a)
    d=[0]*(N+1)
    d[a]=1
    res=0
    while q:
        r=q.popleft()
        for nr in G[r]:
            if d[nr]==0:
                q.append(nr)
                d[nr]=-d[r]
            else:
                if d[nr]==d[r]:
                    return (False,[])
    return (True,d)
check=bfs(1)
if not check[0]:
    print((N*(N-1))//2-M)
else:
    print(check[1].count(1)*check[1].count(-1)-M)

Measured memory_bytes: 88236
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[1000];

void push(int x)
{
	S[++top]=x;
}

int pop()
{
	top--;
	return S[top+1];
}

int main()
{
	int a,b;
	top=0;
	char s[100];
	while(scanf("%s",s)!=EOF){
		if(s[0]=='+'){
			a=pop();
			b=pop();
			push(a+b);
		}else if(s[0]=='-'){
			a=pop();
			b=pop();
			push(b-a);
		}else if(s[0]=='*'){
			a=pop();
			b=pop();
			push(a*b);
		}else{
			push(atoi(s));
		}
	}
	printf("%d\n",pop());
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a + b > c + d) printf("Left\n");
  else if(a + b < c + d) printf("Right\n");
  else printf("Balanced\n");
  return 0;
}


Measured memory_bytes: 256
import sys
read=sys.stdin.readline
class UnionFind:
    def __init__(self,N):
        self.par=[i for i in range(N)]
        self.siz=[1 for _ in range(N)]
        self.rank=[0 for _ in range(N)]
    def find(self,x):
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            return self.par[x]
    def union(self,a,b):
        a=self.find(a)
        b=self.find(b)
        if a==b:
            return 0
        else:
            if self.rank[a]>self.rank[b]:
                self.par[b]=a
                self.siz[a]+=self.siz[b]
            else:
                self.par[a]=b
                self.siz[b]+=self.siz[a]
                if self.rank[a]==self.rank[b]:
                    self.rank[b]+=1
    def size(self,a):
        return self.siz[self.find(a)]
    def same(self,a,b):
        return self.find(a)==self.find(b)

N,Q=map(int,read().split())
UF=UnionFind(N)
for _ in range(Q):
    t,u,v=map(int,read().split())
    if t:
        print(int(UF.same(u,v)))
    else:
        UF.union(u,v)

Measured memory_bytes: 93712
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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 (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    int ans=0;
    rep(i,n){
        int x=a[i];
        if(a[x]==i){
            ans++;
        }
    }
    cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

template <typename T> vector<int> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T INF = numeric_limits<T>::max();
    int n = G.size();
    using P = pair<T, int>;
    vector<T> ds(n, INF); // ds[i] is the least cost from s to i
    vector<int> pre(n, -1);
    priority_queue<P, vector<P>, greater<P>> pq; // the least element is top.
    ds[s] = 0;
    pq.emplace(ds[s], s);
    while (!pq.empty()) {
        P p = pq.top(); // the least element
        pq.pop();
        int v = p.second;
        if (ds[v] < p.first) {
            continue;
        }
        for (auto &e : G[v]) {
            int u = e.first;
            T cost = e.second;
            if (ds[u] > ds[v] + cost) {
                ds[u] = ds[v] + cost;
                pre[u] = v;
                pq.emplace(ds[u], u);
            }
        }
    }
    return pre;
    // if you want to know the least cost path from s, change ds to pre.
    // pre[i] is the pre node of the least cost path from s to i
}

int ansG[104][104];

int main() {
    int N, M;
    if (scanf("%d %d", &N, &M) == 1) {
        return 1;
    }

    using P = pair<int, long long>;
    vector<vector<P>> G(N); // adjacency list
    REP(i, N) {
        REP(j, N) { ansG[i][j] = -1; }
    }
    for (int i = 0; i < M; i++) {
        int a, b, c;
        if (scanf("%d %d %d", &a, &b, &c) == 1) {
            return 1;
        }
        a--;
        b--;
        G[a].emplace_back(b, c);
        G[b].emplace_back(a, c);
        ansG[a][b] = 1;
        ansG[b][a] = 1;
    }
    REP(i, N) {
        auto pre = dijkstra(i, G);
        REP(j, N) {
            // printf("i:%d j:%d pre[j]:%d\n", i, j, pre[j]);
            if (pre[j] != -1) {
                ansG[pre[j]][j] = -1;
                ansG[j][pre[j]] = -1;
            }
        }
    }

    int ans = 0;
    REP(i, N) {
        REP(j, N) {
            if (ansG[i][j] != -1) {
                ans++;
            }
        }
    }

    printf("%d\n", ans / 2);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define mp make_pair

const int INF = INT_MAX;

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

  	int n;
  	cin >> n;
  	
  	n %= 10;
  	if(n == 2 || n == 4 || n == 7 || n == 9 || n == 5)
    	cout << "hon" << "\n";
  	else if(n == 0 || n == 1 || n == 6 || n == 8)
      	cout << "pon" << "\n";
   	else
      	cout << "bon" << "\n";

	return 0;
}

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

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <queue>
#include <algorithm>
#include <list>
#include <set>
#include <cstring>
#define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();++it)
#define rforeach(t,p) for(t::reverse_iterator it=p.rbegin();it!=p.rend();++it)
using namespace std;
#define N 16
#define INF 20*100000

int dp[1 << N];
int t[N][N+1];
int n;
int rec(int S) {
    if(dp[S]) return dp[S];
    if(S == (1<<n)-1) return dp[S] = 0;
    int ans = INF;
    for(int i=0;i<n;i++) {
        if(S>>i&1) continue;
        for(int j=1;j<n+1;j++) {
            if(S>>(j-1)&1) ans = min(ans, rec(S|1<<i)+t[i][j]);
        }
        ans = min(ans, rec(S|1<<i) + t[i][0]);
    }
    return dp[S] = ans;
}

int main() {
    while (cin >> n && n) {
        for (int i=0;i<n;i++) for (int j=0;j<n+1;j++) 
            cin >> t[i][j];
        memset(dp,0,sizeof(dp));
        cout << rec(0) << endl;

    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long int
#define inf 1000000000000
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define for0(i, n) for (int i = 0; i < n; i++)
#define tc(t) int t; cin >> t; while (t--)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ps(x,y)         fixed<<setprecision(y)<<x
using namespace std;
int dp[100001][3];
int vacation(int mat[][3], int prev, int curr, int n)
{
	if (curr == n)
		return 0;
	/*if (dp[curr][prev] != -1)
		return dp[curr][prev];*/
	if (dp[curr][prev] != -1)
	{
		return dp[curr][prev];
	}
	int res = 0;
	int demo = 0;
	for (int j = 0; j < 3; j++)
	{
		if (j != prev)
		{
			demo = mat[curr][j] + vacation(mat, j, curr + 1, n);
			res = max(res, demo);
		}

	}
	return dp[curr][prev] = res;
}
int main()
{
	IOS
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	int n;
	cin >> n;
	int mat[n][3];
	int arr[n];
	for (int i = 0; i < 100001; i++)
		for (int j = 0; j < 3; j++)
			dp[i][j] = -1;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 3; j++)
			cin >> mat[i][j];
	}
	int res = 0;
	for (int i = 0; i < 3; i++)
	{
		int demo = mat[0][i] + vacation(mat, i, 1, n);
		res = max(demo, res);
	}
	//res = vacation(mat, -1, 0, n);
	cout << res << endl;
}

Measured memory_bytes: 10368
use std::cmp;
use std::io;
const SPLIT_DELIMITER: char = ' ';

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

fn main() {
    let n: usize;
    let c: isize;
    input!(n, c);
    let mut score_1: Vec<isize> = vec![0];
    let mut score_2: Vec<isize> = vec![0];
    let mut score_3: Vec<isize> = vec![0; n + 1];
    let mut score_4: Vec<isize> = vec![0; n + 1];
    let v: Vec<Vec<isize>> = input_vector2d(n);
    let mut ans = 0;

    for z in 0..n {
        let scorebuf = *score_1.last().unwrap();
        if z == 0 {
            score_1.push(scorebuf - (v[z][0]) + v[z][1]);
        } else {
            score_1.push(scorebuf - (v[z][0] - v[z - 1][0]) + v[z][1]);
        }
        ans = cmp::max(ans, *score_1.last().unwrap());
    }

    for z in 1..n + 1 {
        let scorebuf = *score_2.last().unwrap();
        if z == 1 {
            score_2.push(scorebuf + v[n - z][0] - c + v[n - z][1]);
        } else {
            score_2.push(scorebuf - (v[n - z + 1][0] - v[n - z][0]) + v[n - z][1]);
        }
        ans = cmp::max(ans, *score_2.last().unwrap());
    }

    for z in 1..n + 1 {
        if score_2[score_3[z - 1] as usize] < score_2[z] {
            score_3[z] = z as isize;
        } else {
            score_3[z] = score_3[z - 1];
        }
    }

    for z in 1..n + 1 {
        if score_1[score_4[z - 1] as usize] < score_1[z] {
            score_4[z] = z as isize;
        } else {
            score_4[z] = score_4[z - 1];
        }
    }

    for z in 1..n {
        let ansbuf = score_1[z] - v[z - 1][0] + score_2[score_3[n - z] as usize];
        ans = cmp::max(ans, ansbuf);
    }

    for z in 1..n {
        let ansbuf = score_2[z] - c + v[n - z][0] + score_1[score_4[n - z] as usize];
        ans = cmp::max(ans, ansbuf);
    }

    println!("{}", ans);
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;cin>>n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    ll sum = 0;
    rep(i, n) sum += a[i];
    int i = 0;
    while (i < n and sum % 10 == 0)
    {
        sum -= a[i];
        if (sum % 10 == 0)
            sum += a[i];
        i++;
    }
    if (sum % 10 == 0)
        cout << 0 << endl;
    else
        cout << sum << endl;

    return 0;
}

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

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

constexpr int PATTERN = 4;
constexpr int SIZE = 4;

int ans;
bool used[SIZE][SIZE];
int vx[PATTERN], vy[PATTERN];

void normalize() {
	rep(i, PATTERN) {
		if(vx[i] + 10 * vy[i] < 0) {
			vx[i] = -vx[i];
			vy[i] = -vy[i];
		}
	}
}

bool out(int x, int y) {
	return x < 0 || y < 0 || x >= SIZE || y >= SIZE;
}

void dfs(int x, int y) {
	if(y == SIZE) {
		++ans;
		return;
	}
	if(x == SIZE) return dfs(0, y + 1);
	if(used[y][x]) return dfs(x + 1, y);

	rep(i, PATTERN) {
		const int px = x + vx[i];
		const int py = y + vy[i];

		if(out(px, py) || used[py][px]) continue;
		used[py][px] = true;
		dfs(x + 1, y);
		used[py][px] = false;
	}
}

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

	while(true) {
		rep(i, PATTERN) cin >> vx[i] >> vy[i];
		if(vx[0] > SIZE) break;
		normalize();

		ans = 0;
		dfs(0, 0);
		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1188
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=100000007;
const ll INF=1000000101001;
int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a+b+c>=22)cout << "bust" << endl;
  else cout << "win" << endl;
}

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

int main(){
    int D;
    cin >> D;
    switch (D){
        case 25: cout<<"Christmas"; break;
        case 24: cout<<"Christmas Eve";break;
        case 23: cout<<"Christmas Eve Eve";break;
        case 22: cout<<"Christmas Eve Eve Eve";break;
        default: break;
    }
    cout<<endl;
}

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

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> key(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> key[i];
		}
		string s;
		cin >> s;
		for(int i = 0; i < s.size(); ++i)
		{
			for(int j = 0; j < key[i % n]; ++j)
			{
				if(s[i] == 'a')
				{
					s[i] = 'Z';
				}
				else if(s[i] == 'A')
				{
					s[i] = 'z';
				}
				else
				{
					--s[i];
				}
			}
		}
		cout << s << endl;
	}
}

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

Measured memory_bytes: 1208
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i = 9; i >= 1; i--){
    if(n % i == 0){
      n /= i;
      if(1 <= n && n <= 9){
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

int main() {
    int n;
	cin>>n;
	
    int ans;
    if(n == 100000) ans = 9 + 900 + 90000;
    else if (n >= 10000) ans = 9 + 900 + (n - 9999);
    else if (n >= 1000) ans = 9 + 900;
    else if (n >= 100) ans = 9 + (n - 99);
    else if (n >= 100) ans = 9 + 100;
    else if (n >= 10) ans = 9;
    else ans = n;
    
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
    int a, b, c; cin>>a>>b>>c;
    cout << min({a + b, b + c, c + a}) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1;
		String s2;
		if(s.length()%2==0) {
			s = s.substring(0,s.length()-2);
		}
		else {
			s = s.substring(0,s.length()-1);
		}
		while(true) {
			s1 = s.substring(0,s.length()/2);
			s2 = s.substring(s.length()/2);
			if(s1.equals(s2)) {
				System.out.println(s.length());
				return;
			}
			s = s.substring(0,s.length()-2);
		}
	}
}

Measured memory_bytes: 35656
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  int N; cin >> N;
    string S; cin >> S;
    
    int x = 0, max_x = x;
    for (int i = 0; i < S.size(); i++) {
      x += (S[i] == 'I' ? 1 : -1);
      max_x = max(max_x, x);
    }

    cout << max_x << endl;
    return 0;
}


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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int, int> ii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

template<int p> struct mod_int {
	ll pow(ll b, ll e) {
		if (e == 0) return 1;
		ll r = pow(b*b%p, e/2);
		if (e%2 == 1) r = (r*b)%p;
		return r;
	}
	ll inv(ll b) { return pow(b, p-2); }

	using m = mod_int;
	int v;
	mod_int() {}
	mod_int(ll v_) {
		if (v_ >= p || v_ <= -p) v_ %= p;
		if (v_ < 0) v_ += p;
		v = v_;
	}
	m& operator+=(const m &a) {
		v += a.v;
		if (v >= p) v -= p;
		return *this;
	}
	m& operator-=(const m &a) {
		v -= a.v;
		if (v < 0) v += p;
		return *this;
	}
	m& operator*=(const m &a) {
		v = (v*ll(a.v))%p;
		return *this;
	}
	m& operator/=(const m &a) {
		v = (v*inv(a.v))%p;
		return *this;
	}
	m operator-(){ return m(-v); }
	m& operator^=(ll e) {
		if (e < 0){
			v = inv(v);
			e = -e;
		}
		v = pow(v, e%(p-1));
		return *this;
	}
	bool operator==(const m &a) { return v == a.v; }
	bool operator!=(const m &a) { return v != a.v; }
	friend istream &operator>>(istream &in, m& a) {
		ll val; in >> val;
		a = m(val);
		return in;
	}
	friend ostream &operator<<(ostream &out, m a) {
		return out << a.v;
	}
	friend m operator+(m a, m b) { return a+=b; }
	friend m operator-(m a, m b) { return a-=b; }
	friend m operator*(m a, m b) { return a*=b; }
	friend m operator/(m a, m b) { return a/=b; }
	friend m operator^(m a, ll e) { return a^=e; }

	static int fft_len(int n = -1){
		// max k such that 2^k | p-1
		if (p == 998244353) return 20;
		throw logic_error("find an order");
		return -1;
	}
	static m rt(bool f, int n, int N){
		// an element of order fft_len
		if (p == 998244353){
			m r(695449733);
			if (f) r = r^(-1);
			return r^(N/n);
		}

		throw logic_error("find a root");
		return -1; // return x so that x^(2^k) != x*x^(2^k) = 1
	}

};


typedef mod_int<998244353> mint;


int main(){ _
	int n, m, k;
	mint M, M1;
	cin >> n >> m >> k;
	vector<mint> fact(2*n+1);
	fact[0] = 1;
	for (int i = 1; i <= 2*n; i++)
		fact[i] = fact[i-1]*i;


	M = m;
	M1 = M-1;
	mint ans = 0;

	for (int i = 0; i <= k; i++){
		mint inc = M*(M1^(n-1-i));
		mint coef = fact[i+n-i-1]/fact[i]/fact[n-i-1];
		ans += inc*coef;
	}
	cout << ans << endl;

	exit(0);
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

int n, k;
bool dp[100005];

int main(){
  cin>>n>>k;
  vi a(n);
  rep(i,n) cin>>a[i];
  
  reps(i,k){
    rep(j,n){
      int next=i-a[j];
      if(next>=0){
        if(!dp[next]) dp[i]=true;
      }
    }
  }
  if(dp[k]) cout<<"First"<<endl;
  else cout<<"Second"<<endl;
}

Measured memory_bytes: 384
// 1 BubbleSort(C, N)
// 2   for i = 0 to N-1
// 3     for j = N-1 downto i+1
// 4       if C[j].value < C[j-1].value
// 5         C[j] と C[j-1] を交換
// 6
// 7 SelectionSort(C, N)
// 8   for i = 0 to N-1
// 9     minj = i
// 10    for j = i to N-1
// 11      if C[j].value < C[minj].value
// 12        minj = j
// 13    C[i] と C[minj] を交換

#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    char c[n];
    int pre;
    for (pre = 0; pre < n; pre++)
    {
        scanf(" %c%d", &c[pre], &a[pre]);
    }

    int aa[n];
    char cc[n];
    int pp;
    for (pp = 0; pp < n; pp++)
    {
        cc[pp] = c[pp];
        aa[pp] = a[pp];
    }

    int i, j;
    for (i = 0; i < n; i++)
    {
        for (j = n - 1; j > i; j--)
        {
            if (a[j] < a[j - 1])
            {
                int temp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = temp;
                char tempc = c[j];
                c[j] = c[j - 1];
                c[j - 1] = tempc;
            }
        }
    }
    for (pre = 0; pre < n; pre++)
    {
        printf("%c%d", c[pre], a[pre]);
        if (pre < n - 1)
        {
            printf(" ");
        }
    }
    printf("\nStable\n");

    for (i = 0; i < n; i++)
    {
        int minj = i;
        for (j = i; j < n; j++)
        {
            if (aa[j] < aa[minj])
            {
                minj = j;
            }
        }
        int temp = aa[i];
        aa[i] = aa[minj];
        aa[minj] = temp;
        char tempc = cc[i];
        cc[i] = cc[minj];
        cc[minj] = tempc;
    }

    int flag = 0;
    for (pre = 0; pre < n; pre++)
    {
        if (cc[pre] != c[pre])
        {
            flag = 1;
        }
        printf("%c%d", cc[pre], aa[pre]);
        if (pre < n - 1)
        {
            printf(" ");
        }
    }
    if (flag == 0)
    {
        printf("\nStable\n");
    }
    else
    {
        printf("\nNot stable\n");
    }
    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <ctype.h>
#include <string>

int main (int argc, char *argv[])
{
	std::string str;
	getline(std::cin, str);
	for(int i = 0; i < (int)str.size(); ++i)
	{
		if(islower(str[i]))
		{
			str[i] = toupper(str[i]);
		}
		else
		{
			str[i] = tolower(str[i]);
		}
	}
	std::cout << str << std::endl;
	
	return 0;
}

Measured memory_bytes: 3148
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n;
int main()
{
	scanf("%lld",&n);
	for(ll i=sqrt(n);i>=1;i--)
		if(n%i==0)
		{
			printf("%lld\n",n/i+i-2);
			break;
		}
	return 0;
}


Measured memory_bytes: 256
n,c = map(int,input().split())
d = [list(map(int,input().split())) for i in range(c)]
g = [list(map(int,input().split())) for i in range(n)]
# mod=0,1,2について、色iに変えた時のコストをまとめておく
cost = [[0]*c for i in range(3)]
for i in range(3):
    for j in range(c):
        for a in range(n):
            for b in range(n):
                if (a+b)%3==i:
                    cost[i][j]+=d[g[a][b]-1][j]
# mod=0,1,2について、どの色で塗るか全探索
ret=10**10
for i in range(c):
    for j in range(c):
        for k in range(c):
            if i==j or j==k or k==i:
                continue
            ret=min(ret, cost[0][i]+cost[1][j]+cost[2][k])
print(ret)

Measured memory_bytes: 47452
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n, k, s;
    cin >> n >> k >> s;
    rep(i, k)cout << s << " ";
    rep(i, n-k){
        if(s != 1000000000)cout << s+1 << " ";
        else cout << 999999999 << " ";
    }
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 1000010;
int n;
int a[N];
int L, q, ans, lst;
int dp[N][21];
int pow[21];
int main() {
	memset(dp, 0x3f, sizeof(dp));
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	scanf("%d", &L);
	scanf("%d", &q);
	pow[0] = 1;
	lst = 1;
	for (int i = 1; i <= n; i++) {
		while (a[i] > a[lst] + L) {
			dp[lst++][0] = i - 1;
		}
	}
	for (int j = 1; j <= 20; j++) {
		pow[j] = pow[j - 1] << 1; 
		for (int i = 1; i <= n; i++) {
			if (dp[i][j - 1] < 0x3f3f3f3f) dp[i][j] = dp[dp[i][j - 1]][j - 1];
		}
	}
	while (q--) {
		int x, y;
		scanf("%d%d", &x, &y);
		if (x > y) swap(x, y);
		ans = 0;
		for (int i = 20; i >= 0; i--) {
			if (dp[x][i] < y) {
				x = dp[x][i];
				ans += pow[i];
			}
		}
		printf("%d\n", ans + 1);
	}
	return 0;
}

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

int main(){
  
  string S, T;
  cin >> S >> T;
  
  int N = (int)S.size();
  
  S += S;
  
  for(int i = 0; i < N; ++i){
    
    string U = S.substr(i,N);
    
    if(U == T){
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 3584
#include <stdio.h>
int main(void){
    char s[3];
    int total=700;
    scanf("%s",s);
    if(s[0]=='o') total+=100;
    if(s[1]=='o') total+=100;
    if(s[2]=='o') total+=100;
    printf("%d",total);
    return 0;
}

Measured memory_bytes: 128
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  string s;
  REP(i,max(a,b)) s += to_string(min(a,b));
  cout << s << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

    vector<int> A(N);
    long int before = 0;
    long int after = 0;

    long int ans = 2020202020;

    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
        after += A.at(i);
    }

    for (int i = 0; i < N; i++)
    {
        before += A.at(i);
        after -= A.at(i);

        if (ans > abs(after - before))
        {
            ans = abs(after - before);
        }
    }
    
    cout << ans << endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i,n) for(int i = 1; i <= (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

int ptn(int x, int y, int z){
  if((x==y)&&(y==z)) return 1;
  if((x==y)||(y==z)||(z==x)) return 3;
  return 6;
}

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

  int total;

  rep2(i, N){
    int sum = 0;
    rep2(x,sqrt(i)+1)rep2(y,x)rep2(z,y){
      total = pow(x,2)+pow(y,2)+pow(z,2) + x*y + y*z + z*x;
      //cout << x << " " << y << " " << z << endl;
      if(total == i){
        sum+=ptn(x, y, z);
      }
    }
    cout << sum << endl;
  }

}


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

primes = [0]
while N % 2 == 0:
    primes[0] += 1
    N //= 2

if N != 1:
    for i in range(3, 1000000, 2):
        if N % i == 0:
            primes.append(0)
            while N % i == 0:
                primes[-1] += 1
                N //= i
            if N == 1:
                break
    else:
        primes.append(1)

ans = 0
for e in primes:
    i = 0
    while True:
        i += 1
        e -= i
        if e >= 0:
            ans += 1
        else:
            break

print(ans)

Measured memory_bytes: 9248
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(m)]
go = [[] for i in range(n+1)]
come = [[] for i in range(n+1)]
for a,b in ab:
  go[a].append(b)
  come[b].append(a)
dpe = [0]*(n+1)
for i in range(1,n+1)[::-1]:
  if i < n and go[i]:
    dpe[i] /= len(go[i])
  for j in come[i]:
    dpe[j] += 1+dpe[i]
dpp = [0]*(n+1)
dpp[1] = 1
for i in range(1,n+1):
  for j in go[i]:
    dpp[j] += dpp[i]/len(go[i])
ans = dpe[1]
for a,b in ab:
  pa = dpp[a]
  if len(go[a]) == 1:
    continue
  ea = dpe[a]-1-((dpe[a]-1)*len(go[a])-dpe[b])/(len(go[a])-1)
  ans = min(ans,dpe[1]-pa*ea)

print(ans)

Measured memory_bytes: 85848
#include <bits/stdc++.h>
#include <string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i=1; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
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 (b<a) { a=b; return 1; } return 0; }

int main() {
  string s, t; cin >> s >> t;
  bool flag = true;

  if (s.size() + 1 != t.size())
    flag = false;
  else {
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != t[i]){
        flag = false;
        break;
      } 
    }
  }
  if(flag) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  int N,M;
  int A[1000];
  while(1){
    int N,M;
    cin>>N>>M;
    if(N==0&&M==0){
      break;
    }
    FOR(i,0,N){
      cin>>A[i];
    }
    VE S;
    FOR(i,0,N){
      FOR(j,i+1,N){
        S.PB(A[i]+A[j]);
      }
    }
    sort(S.begin(),S.end());
    int ans=0,now=0;
    while(now<N*(N-1)/2){
      if(S[now]<=M){
        ans=S[now];
        now++;
      }else{
        break;
      }
    }
    if(now==0){
      cout<<"NONE"<<endl;
    }else{
      cout<<ans<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 6800
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())

s = str(input())

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        ans = [i,i+1]
        print(i+1, i+2)
        exit()

for i in range(len(s)-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        exit()

print(-1,-1)


Measured memory_bytes: 6480
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b)
{
 	return *(int*)a - *(int*)b;
 }
int main()
{
	int n;
	scanf("%d",&n);
	int a[n];
	int i;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	qsort(a,n,sizeof(a[0]),cmp);
	int flag=0;
	for(i=0;i<n;i++){
		if(a[i]==a[i+1]){
			flag=1;
			break;
		}
	}
	if(flag) printf("NO");
	else printf("YES");
	return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
using namespace std;

int main() {
	int  a,b,c,d;
	cin >> a>>b>>c>>d;

	while (true) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			break;
		}
		a -= d;
		if (a <= 0) {

			cout << "No" << endl;
			break;
		}
	}


	return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, T b ) { if ( a < b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, T b ) { if ( a > b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

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

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( 1e9 + 7 )

bool chkS( char c )
{
	switch ( c )
	{
	case 'A': case 'C': case 'G': case 'T': return ( true );
	default: return( false );
	}
}

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

	int s = 0;
	int t = 0;
	rep( i, S.size() )
	{
		if ( chkS( S[i] ) )
		{
			s++;
		}
		else
		{
			chmax( t, s );
			s = 0;
		}
	}
	chmax( t, s );

	cout << t << endl;

	return ( 0 );
}


Measured memory_bytes: 888