akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x - a) % b << '\n';
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char* argv[]) {

	int costs[10][10];
	int i, j, k, h, w;
	int sum = 0;
	scanf("%d %d", &h, &w);

	for(i = 0; i < 10; i++) {
		for(j = 0; j < 10; j++) {
			scanf("%d", &costs[i][j]);
		}
	}

	int a[h][w];

	for(i = 0; i < h; i++) {
		for(j = 0; j < w; j++) {
			scanf("%d", &a[i][j]);
		}
	}

	for(k = 0; k < 10; k++) {
		for(i = 0; i < 10; i++) {
			for(j = 0; j < 10; j++) {
				if(costs[i][j] > costs[i][k] + costs[k][j])
					costs[i][j] = costs[i][k] + costs[k][j];
			}
		}
	}

	for(i = 0; i < h; i++) {
		for(j = 0; j < w; j++) {
			if(a[i][j] == -1 || a[i][j] == 1)
				continue;
			sum += costs[a[i][j]][1];
		}
	}

	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		//Scanner sa = new Scanner(System.in);
		int b = sc.nextInt();
		int x=0;

		for(int i=0;i<2;i++){
			if(a >= b){
				x +=a;
				a = a-1;
			}else {
				x +=b;
				b = b-1;
			}
		}
		System.out.println(x);
	}
}


Measured memory_bytes: 23508
#include <stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  char s[n],s1[n];
  scanf("%s",s);
  scanf("%s",s1);
  for(int i=0;i<n;i++)
  {
    printf("%c",s[i]);
    printf("%c",s1[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main() {

    int X, Y, Z;
    cin >> X >> Y >> Z;


    cout << Z << " " << X << " " << Y << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
n = len(str(N))
s = ['3', '5', '7']
ans = 0
for d in range(3, n+1):
    for i in range(3 ** d):
        x = ''
        for j in range(d):
            x += s[(i//(3**j))%3]
        if '3' in x and '5' in x and '7' in x and int(x) <= N:
            ans += 1
print(ans)



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

class Program
{
    static void Main(string[] args)
    {
        var input = int.Parse(Console.ReadLine());
        var array = Console.ReadLine().Split(' ');

        var dict = new Dictionary<int, int>();

        foreach(var nstr in array)
        {
            var n = int.Parse(nstr);
            if (dict.ContainsKey(n))
            {
                dict[n] += 1;
            }
            else
            {
                dict.Add(n, 1);
            }
        }

        for (var i = 1; i < input + 1; i++)
        {
            if (dict.ContainsKey(i))
            {
                Console.WriteLine(dict[i]);
            }
            else
            {
                Console.WriteLine(0);
            }
        }

        Console.Read();


    }
}


Measured memory_bytes: 43680
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
int vv[222222];
int fin[222222];
int n;

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n; int i;
	for(i=1 ; i<=n ; i++) cin>>vv[i];
	for(i=1 ; i<=n ; i++) fin[i]=vv[i];
	sort(vv+1,vv+n+1);
	for(i=1 ; i<=n ; i++)
		if(fin[i]<=vv[n/2]) cout<<vv[n/2+1]<<"\n";
		else cout<<vv[n/2]<<"\n";
	return 0;
}

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

using namespace std;

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

    int A[N], B[N];
    for (int i = 0; i <= N; i++) {
        cin >> A[i];
    }

    int bfr = 0;
    long long res = 0;
    int tmp = 0;
    int target = 0;

    for (int i = 0; i < N; i++) {
        cin >> tmp;
        target = min(A[i], tmp + bfr);
        res += target;
        bfr = min(tmp + bfr - target, tmp);
    }

    cout << res + min(bfr, A[N]);
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  ll t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  ll first = (a1-b1)*t1, second = (a2-b2)*t2;
  if(first + second == 0) {
    cout << "infinity" << endl;
    return 0;
  }

  if(first > 0) {
    first *= -1;
    second *= -1;
  }

  if(first + second < 0) {
    cout << 0 << endl;
    return 0;
  }

  ll d = first+second;
  ll ans = -first/d;
  ans *= 2;
  if(-first%d != 0) ++ans;
  cout << ans << endl;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Node{
public:
	int color{-1};
	int room{-1};
};

class Edge{
public:
	int start,end;
	int sc,ec;
};

vector<Edge> edge;

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

bool DFS(vector<Node>& node,ConnectNodeInfo& connect,int index){
	bool result = true;
	int color = node[index].color==1? 0 : 1;
	for(int i=0,ei=connect[index].size();i<ei;i++){
		int connect_index = connect[index][i].first;
		//node[connect_index].color = color;
		if(node[connect_index].color!=-1 && node[connect_index].color==node[index].color){
			return false;
		}
		if(node[connect_index].color==-1){
			Edge e;
			e.start=index,e.end=connect_index;
			edge.emplace_back(e);
			node[connect_index].color = color;
			result &= DFS(node,connect,connect_index);
		}
	}
	return result;
}

class Dijkstra{
	using Point = pair<ll,ll>;
	vector<ll> dist;
public:
	void CalcShortestPath(int start,ConnectNodeInfo& connect){
		dist.resize(connect.size());
		fill(ALL(dist),1LL<<60);
		dist[start] = 0;

		priority_queue<Point,vector<Point>,greater<Point>> Q;
		Q.emplace(0,start);
		while(!Q.empty()){
			auto p = Q.top();
			Q.pop();
			int v = p.second;
			if(dist[v]<p.first){
				continue;
			}
			for(auto e:connect[v]){
				if(dist[e.first]>dist[v]+e.second){
					dist[e.first] = dist[v]+e.second;
					Q.emplace(dist[e.first],e.first);
				}
			}
		}
	}
	ll GetDistance(int i){
		return dist[i];
	}
};

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

	int N=in();
	ConnectNodeInfo connect(N);
	REP(i,N){
		int u=in(),k=in();
		REP(j,k){
			int v=in(),w=in();
			connect.AddDirectionalConnection(u,v,w);
		}
	}

	Dijkstra DI;
	DI.CalcShortestPath(0,connect);

	REP(i,N){
		out(i,DI.GetDistance(i));
	}
	return 0;
}



Measured memory_bytes: 11856
S = input()
N = len(S)

if S != S[::-1]:
    print("No")
    exit()

S1 = S[:(N - 1) // 2]
S2 = S[(N + 1) // 2:]
#print(S1, S2)

if S1 == S1[::-1] and S2 == S2[::-1]:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
 
int main() {
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for(int i=0; i<H; i++){
        cin >> a.at(i);
    }

    vector<bool> gyou(H,false);
    vector<bool> retu(W,false);

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(a.at(i).at(j)=='#'){
                gyou.at(i) = true;
                retu.at(j) = true;
            }
        }
    }
    for(int i=0; i<H; i++){
        if(gyou.at(i)){
            for(int j=0; j<W; j++){
                if(retu.at(j)){
                    cout << a.at(i).at(j);
                }
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i, n) {
    cin >> v[i];
  }
  sort(all(v));
  int left = 0;
  int right = k - 1;
  int ans = 1101101101;
  for(int i = 0; i <= n - k; i++) {
    ans = min(ans, v[right] - v[left]);
    right++;
    left++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

ll a[100000];

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

	ll N, L;
	cin >> N >> L;

	deque<P> d;
	ll sum = 0;
	for(int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}

	vector<int> ans;
	for(int i = 0; i < N - 1; i++) {
		if(a[i] + a[i + 1] >= L) {
			for(int j = 0; j <= i - 1; j++) {
				ans.push_back(j + 1);
			}
			for(int j = N - 2; j >= i + 1; j--) {
				ans.push_back(j + 1);
			}
			ans.push_back(i + 1);
		}
		if(ans.size()) break;
	}

	if(ans.size()) {
		cout << "Possible" << endl;
		for(int v : ans) {
			cout << v << endl;
		}
	}
	else {
		cout << "Impossible" << endl;
	}
}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    string s;
    cin >> n >> s;
    ll ans = 0;
    REP(i, 1000) {
        ll a = i % 10;
        ll b = (i / 10) % 10;
        ll c = i / 100;
        int pos = 0;
        bool flag = false;
        while(pos < n) {
            if(s[pos++] == '0' + a) {
                flag = true;
                break;
            }
        }
        if(!flag)
            continue;
        flag = false;
        while(pos < n) {
            if(s[pos++] == '0' + b) {
                flag = true;
                break;
            }
        }
        if(!flag)
            continue;
        flag = false;
        while(pos < n) {
            if(s[pos++] == '0' + c) {
                flag = true;
                break;
            }
        }
        if(!flag)
            continue;
        ans++;
    }
    cout << ans << en;
}

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

    solve();

    /*
    ll t;
    cin >> t;
    REP(i, t) { solve();}
    */

    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    unsigned long long int a[100005], b[100005];
    int i;
    for (i = 0; i < n; i++)
        scanf("%lld %lld", &a[i], &b[i]);
    unsigned long long int ans = 0;
    for (i = n - 1; i >= 0; i--)
        if ((a[i] + ans) % b[i] > 0)
            ans += b[i] - ((a[i] + ans) % b[i]);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1792
// E - Coprime
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))

vi gen_d_prim(int n){
	vi D(n+1, 0);
	rpd(i, 2, n+1, 1)
		if(!D[i]) rpd(j, i, n+1, i) D[j] = i;
	return D;
}

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

	int N; cin>>N;
	int g = 0;
	bool is_pairwise = true;
	vi D = gen_d_prim(1000000);
	set<int> past;
	rpd(i, 0, N, 1){
		int a; cin>>a;
		g = gcd(g, a);
		if(is_pairwise){
			set<int> now;
			while(a != 1){
				// # 素数 D[a]: 今回は未済 & 過去は済
				if(!now.count(D[a]) && past.count(D[a])){
					is_pairwise = false;
					break;
				}
				now.insert(D[a]);
				past.insert(D[a]);
				a /= D[a];
			}
		}
	}
	int t = 0;
	if(g > 1) t = 2;
	else t = !is_pairwise;
	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";
}


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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 2e5+5;


void solve() {

  int h,w,m;
  cin>>h>>w>>m;
  vi r(h+1),c(w+1);
  spii s;
  rep(_,0,m){
    int x, y;
    cin>>x>>y;
    r[x]++,c[y]++;
    s.insert({x,y});
  }
  vi rm, cm;
  int mx = *max_element(all(r));
  fr(i,1,h)
    if(r[i]==mx)
       rm.pb(i);
  int my = *max_element(all(c));
  fr(i,1,w)
    if(c[i]==my)
      cm.pb(i);
  trav(i,rm){
    trav(j,cm){
      if(!s.count({i,j})){
        cout<<mx+my;
        return;
      }
    }
  }
  cout<<mx+my-1;

}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}


Measured memory_bytes: 35076
#include <stdio.h>

int main(void){
	int a, b, i;
	while (1){
		scanf("%d", &a);
		if(a == 0) break;
		for (i = 0; i < 9; i++){
			scanf("%d", &b);
			a -= b;
		}
		printf("%d\n", a);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int main()
{
	int r, c;
	cin >> r >> c;

	int k, t;
	int row[101] = {};

	for( int i = 0; i < r; ++i){
		t = 0;
		for(int j = 0; j < c; ++j){
			cin >> k;
			cout << k << " ";
			t += k;
			row[j] += k;
		}
		cout << t << "\n";
		row[c] += t; 
	}

	for( int j = 0; j < c+1; ++j){
		cout << row[j];
		if( j != c )
			cout << " ";
	}

	cout << "\n";

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back



int main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    

    int count=0;
    

    for(int i=0;i<=3000;i++){
        for(int j=0;j<=3000;j++){
            int s = n-(i*r+j*g);
            if(s>=0&&s%b==0) count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
   int X;cin>>X;
   int ans=1;
   rep(num,2,X){
       int now=num*num;
       while(now<=X){
           ans = max(ans,now);
           now = now*num;
       }
   }
   cout<<ans<<endl;
}


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

typedef long long ll;

int main(){


    ll N, K;
    cin >> N >> K;
    vector<ll> vi(N,0);
    ll ans = INT_MAX;
    
    for(int i=0; i<N; i++){
	cin >> vi[i];
    }
    sort(vi.begin(),vi.end());

    for(int i=0; i+K-1<N; i++){
	ans = min(ans, vi[i+K-1]-vi[i]);
    }
    cout << ans << endl;
}


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

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

  vector<double> x(n, 0);
  vector<double> y(n, 0);
  for(int i = 0; i < n; i++){
    cin >> x[i];
  }
  for(int i = 0; i < n; i++){
    cin >> y[i];
  }

  double s1, s2, s3, s;
  cout << fixed << setprecision(7);

  for(int i = 0; i < n; i++){
    s1 += max(x[i], y[i]) - min(x[i], y[i]);
  }

  for(int i = 0; i < n; i++){
    s2 += pow(x[i] - y[i], 2);
  }
  s2 = pow(s2, 0.5);

  for(int i = 0; i < n; i++){
    s3 += pow(max(x[i], y[i]) - min(x[i], y[i]), 3);
  }
  s3 = pow(s3, 0.333333333333);

  vector<double> v(n, 0);
  for(int i = 0; i < n; i++){
    v[i] = max(x[i], y[i]) - min(x[i], y[i]);   
  }
  sort(v.begin(), v.end());
  s = v[n - 1];

  cout << s1 << endl;
  cout << s2 << endl;
  cout << s3 << endl;
  cout << s << endl;
}


Measured memory_bytes: 3480
import numpy as np
n=int(input())
x=np.fromstring(input(),int,sep=' ')
p=0
hoge=np.inf
for i in range(1,np.max(x)+1):
    sux=sum((x-i)**2)
    if sux<hoge:
        p=i
        hoge=sux
print(hoge)

Measured memory_bytes: 12504
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int n = 0;
int u = 0;
int k[101];
int v[101][101];
int Discover[101] = { 0 };
int End[101] = { 0 };
//int nx = 0;
int p = 0;
void dfs(int l) {
	int i;
	int j;
	if (!Discover[l]) {
		Discover[l] = ++p;

		for (i = 0; i < n + 1; i++) {
			if (v[l][i]) {
				dfs(v[l][i]);
			}
		}
		End[l] = ++p;
	}
}
int main()
{
	int i;
	int j;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> u ;
		cin >> k[u];
		for (j = 0; j < k[u]; j++) {
			cin >> v[u][j];
		}
	}
	for (i = 1; i < n + 1; i++) {
		if (!Discover[i]) {
			dfs(i);
		}
	}
	for (i = 1; i < n + 1; i++) {
		cout << i << " " << Discover[i] << " " << End[i] << endl;
	}
}


Measured memory_bytes: 3100
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
      	
      Scanner sc = new Scanner(System.in);	      
	  String sdate = sc.next();

        try {
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu/MM/dd");
            LocalDate date = LocalDate.parse(sdate, formatter);
            LocalDate today = LocalDate.of(2019, 4, 30);
            int diff = date.compareTo(today);
            if (diff <= 0  ){
                System.out.println("Heisei");
            } else {
                System.out.println("TBD");
            }
        } catch (DateTimeParseException e) {
            System.out.println("入力値がyyyy/mm/dd形式ではありません");
        }
    }

}

Measured memory_bytes: 27468
#include<iostream>
#include<queue>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846264338327950L
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
	//return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow
	//return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数

//素数判定
template<typename T>
bool IsPrime(T num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
//vector<vector<int>> data(3, vector<int>(4));
//vector<vector<Type>> vv(n);
//cout << fixed << setprecision(20) << endl;

int main() {
	ll N;cin >> N;
	ll ans = 0;
	//vector<ll>a(N+1), b(N+1);
	if (N % 2 != 0)ans += N * (N / 2);
	else ans += N * ((N - 1) / 2) + (N / 2);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
ll N,R;
cin >> N >> R;
if(N >= 10) cout << R << endl;
else cout << R + 100 * (10 - N) << endl;
}


Measured memory_bytes: 764
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#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>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

vector<int> inv(vector<int> vec) {
    int N = vec.size();
    vector<int> res(N);
    for(int i=0; i<N; i++) {
        res[ vec[i] ] = i;
    }
    return res;
}

vector<int> mul(vector<int> A, vector<int> B) {
    int N = A.size();
    vector<int> res(N);
    for(int i=0; i<N; i++) {
        res[i] = A[ B[i] ];
    }
    return res;
}

vector<int> mod_pow(vector<int> A, int k) {
    int N = A.size();
    vector<int> res(N);
    iota(res.begin(), res.end(), 0);
    for(; k>0; k>>=1) {
        if(k & 1) res = mul(res, A);
        A = mul(A, A);
    }
    return res;
}

signed main() {
    int N, K; cin >> N >> K;
    vector<int> p(N), q(N);
    for(int i=0; i<N; i++) cin >> p[i], p[i]--;
    for(int i=0; i<N; i++) cin >> q[i], q[i]--;
    vector<int> ip = inv(p), iq = inv(q);

    // vector<int> prod = mul(mul(mul(q, ip), iq), p);
    vector<int> prod = mul(q, mul(ip, mul(iq, p)));
    vector<int> A = mod_pow(prod, (K - 1) / 6);

    int mod = (K - 1) % 6;
    vector<int> B;
    if(mod == 0) B = p;
    else if(mod == 1) B = q;
    else {
        vector<int> X = p, Y = q;
        for(int i=0; i<mod-1; i++) {
            vector<int> Z = mul(Y, inv(X));
            X = Y, Y = Z;
        }
        B = Y;
    }

    vector<int> ans = mul(mul(A, B), inv(A));
    for(int i=0; i<N; i++) {
        printf("%lld%c", ans[i] + 1, i+1 == N ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 10992
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

const int MOD = (int)1e9 + 7;
int add(int a, int b){
    int c = a + b;
    if(c >= MOD)c -= MOD;
    else if(c < 0)c += MOD;
    return c;
}
void sadd(int &a, int b){
    a += b;
    if(a >= MOD)a -= MOD;
    else if(a < 0)a += MOD;
}
int mul(int a, int b){
    return (int)((long long)a*b%MOD);
}

int bitcnt(unsigned int x){
    x = (x & 0x55555555) + (x >> 1 & 0x55555555);
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
    x = (x & 0x00ff00ff) + (x >> 8 & 0x00ff00ff);
    x = (x & 0x0000ffff) + (x >> 16 & 0x0000ffff);
    return (int)x;
}

int N, K;

int dp[101][101][256];

int main(){
    vi fact(101);
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= 100; ++i)fact[i] = mul(fact[i-1], i);

    ios::sync_with_stdio(false);
    cin.tie(0);
    while(cin >> N >> K) {
        vi A(N);
        rep(i, N)cin >> A[i];

        /*
        if(N > 20)continue;

        int ans = 0;

        rep(S, 1 << N) {
            int b = bitcnt(S);
            int x = 0;
            rep(i, N) {
                if(S >> i & 1)x ^= A[i];
            }
            if(x == K) {
                sadd(ans, fact[b]);
            }
        }
        cout << ans << endl;
        */
       
        MEM(dp, 0);
        dp[0][0][0] = 1;
        rep(i, N)rep(j, i+1)rep(k, 256) {
            int val = dp[i][j][k];
            sadd(dp[i + 1][j+1][k^A[i]], val);
            sadd(dp[i + 1][j][k], val);
        }

        int ans = 0;
        for(int j = 1; j <= N; ++j) {
            int x = mul(fact[j], dp[N][j][K]);
            sadd(ans, x);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 10496
n, m, x = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(n)]
 
import itertools as it
import math
 
cost = math.inf
for comb in it.chain(*(it.combinations(C, r) for r in range(1, n+1))):
    c, *a = map(sum, zip(*comb))
    if c < cost and min(a) >= x:
        cost = c
 
print(-1 if cost is math.inf else cost)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define endl '\n'
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define fill(a,b) memset(a,b,sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,m,k; cin>>n>>m>>k;
    string str[n];
    for(int i=0;i<n;i++) cin>>str[i];
    int mat[n][m];
    for(int j=0;j<m;j++){
        for(int i=0;i<n;i++){
            mat[i][j]=(str[i][j]=='1') ? 1 : 0;
            if(i!=0) mat[i][j]+=mat[i-1][j];
        }
    }
    int ans=n*m;
    for(int mask=0;mask<(1<<(n-1));mask++){
        vector<int> v;
        for(int i=0;i<n-1;i++){
            if((mask&(1<<i))!=0) v.pb(i+1);
        }
        v.pb(n);
        int aux[sz(v)]={0},last=0,flag=1,cnt=0;
        for(int j=1;j<=m;j++){
            int last1=0,flag1=1;
            for(int i=0;i<sz(v);i++){
                int temp=mat[v[i]-1][j-1];
                if(last1!=0) temp-=mat[last1-1][j-1];
                aux[i]+=temp;
                if(aux[i]>k) flag1=0;
                last1=v[i];
            }
            if(flag1==0 && j==last+1){
                flag=0; 
                break;
            }
            if(flag1!=0) continue;
            last=j-1; cnt++;
            last1=0;
            for(int i=0;i<sz(v);i++){
                int temp=mat[v[i]-1][j-1];
                if(last1!=0) temp-=mat[last1-1][j-1];
                aux[i]=temp;
                last1=v[i];
            }
        }
        if(flag!=0) ans=min(ans,cnt+sz(v)-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int ans = 0;
    if(s.equals("SUN")) {
      ans = 7;
    } else if(s.equals("MON")) {
      ans = 6;
    } else if(s.equals("TUE")) {
      ans = 5;
    } else if(s.equals("WED")) {
      ans = 4;
    } else if(s.equals("THU")) {
      ans = 3;
    } else if(s.equals("FRI")) {
      ans = 2;
    } else{
      ans = 1;
    }
    System.out.println(ans);
  }
}

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

using namespace std;

int main(){
	int A, B, C, D; //T体力、T攻撃、A体力、A攻撃

	cin >> A >> B >> C >> D;
	
	string Judg = "";
	
	while(true){
		C -= B; //高橋攻撃
		if(C <= 0){
			Judg = "Yes";
			break;
		}
		A -= D; //青木攻撃
		if(A <= 0){
			Judg = "No";
			break;
		}
	}
	cout << Judg <<endl;
	return 0;
}

Measured memory_bytes: 3628
import sys

lines = str(sys.stdin.read()).strip().split("\n")
W = int(lines.pop(0))
N = int(lines.pop(0))

results = list(range(1,W + 1))

for i in range(N):
    data = list(map(lambda i: int(i) - 1, lines[i].split(",")))
    results[data[0]], results[data[1]] = results[data[1]], results[data[0]]

for result in results:
	print(result)

Measured memory_bytes: 7516
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

class CReplacingInteger {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll N, K; in >> N >> K;
	    ll ans = min(N % K, abs(N % K - K));
	    out << ans << '\n';
	}
};


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

	CReplacingInteger solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
using namespace std;
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 main() {
    int N;
    cin >> N;
    vl a(N);
    rep(i, 0, N) {
        cin >> a[i];
    }
    int count = 0;
    int loop = 0;
    while(true) {
        count = 0;
        rep(i, 0, a.size()) {
            if (a[i] % 2 != 0) {
                a.erase(a.begin() + i);
            }
            if (a[i] % 2 == 0 && count == 0) {
                a[i] = a[i] / 2;
                ++count;
            }
        }
        if (count == 0) {
            break;
        }
        ++loop;
    }
    cout << loop << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int count = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      count++;
      if (count >= 3) {
        cout << "Yes" << endl;
        return 0;
      }      
    }
    else {
      count = 0;
    }
  }
  cout << "No";
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod (int)(1e9+7)
#define MAXI (int)(3e17+10)
#define N 200005


// Driver code to test above functions
int32_t main()
{
   
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
	cout.tie(NULL);

	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;

	int x = a*60 + b;
	int y = c*60 + d; 

	cout << y-x-e;

    return 0;
 
} 

Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>

#include <sstream>
#include <iostream>

using namespace std;
typedef long long llint;
const llint inf = 1000000000000000000LL;

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

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

int main(void) 
{
  int N;
  scanf("%d", &N);

  vector< int > L;
  REP(i, 2 * N) {
    int x;
    scanf("%d", &x);
    L.push_back(x);
  }

  sort(L.begin(), L.end());
  
  int sol = 0;
  for (int i = 0; i < 2 * N; i += 2)
    sol += L[i];

  printf("%d\n", sol);

  return 0;
}


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

typedef long long ll;

#define F first 
#define S second 
#define PB push_back
#define MP make_pair 
#define rep(i,a,b) for (ll i=a;i<b;i++)

typedef vector<int> vi;
typedef pair<int,int> pi;


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

    if(a<b) for(int i=0;i<b;i++) cout<<a;
    else
        for(int i=0;i<a;i++) cout<<b;
    cout<<endl;
    return 0; 
}



Measured memory_bytes: 256
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      _a: [[u8; n]; n]
   }
   let mut a = vec![vec![true; n]; n];
   for i in 0..n {
      for j in 0..n {
         if _a[i][j] == 0 {
            a[i][j] = false;
         }
      }
   }
   let mut dp = vec![-1_i64; 1 << n];
   dp[0] = 1;
   let ans = rec((1 << n) - 1, 0, &a, &mut dp);
   println!("{}", ans);
}

const MOD: i64 = 1000000007;

fn rec(state: usize, c: usize, a: &Vec<Vec<bool>>, dp: &mut Vec<i64>) -> i64 {
   if dp[state] != -1 {
      dp[state]
   } else {
      dp[state] = a[c].iter().enumerate().fold(0, |s, (i, &b)| {
         if (state >> i) & 1 == 1 && b {
            s + rec(state ^ (1 << i), c + 1, a, dp)
         } else {
            s
         }
      }) % MOD;
      dp[state]
   }
}


Measured memory_bytes: 20732
#include <cstdio>
#include <string>
#include <iostream>
#include <cstdlib>

inline int query(int x) {
    printf("%d\n", x);
    fflush(stdout);

    std::string s;
    std::cin >> s;

    if (s == "Vacant")
        exit(0);
    else if (s == "Male")
        return 1;
    else return 0;
}

int main() {
    int n;
    scanf("%d", &n);

    int st = 0, dr = n - 1;
    int a = query(st);
    int b = query(dr);
    while (1) {
        int m = (st + dr) / 2;
        int c = query(m);
        if ((st + m) % 2 == (a + c) % 2) {
            st = m;
            a = c;
        } else {
            dr = m;
            b = c;
        }
    }

    return 0;
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[105],k;
int mod=1e9+7;
int dp[105][100005],sum[105][100005];
void add( int & a , int b)
{
	a+=b;
	if(a>=mod)
		a-=mod;
}
int f(int poz, int l ,int r)
{
	l=max(0,l);
	r=min(r,k);
	if(l==0)
		return sum[poz][r];
	else
		return sum[poz][r]-sum[poz][l-1]+mod;
}
int main(){
	cin>>n>>k;
	for(int i=1;n>=i;i++)
		cin>>a[i];
	dp[0][k]=1;
	sum[0][k]=1;
	for(int i=1;n>=i;i++)
	{
		for(int j=0;k>=j;j++)
			add(dp[i][j],f(i-1,j,j+a[i]));
		for(int j=0;k>=j;j++)
		{
			sum[i][j]=dp[i][j];
			if(j)
				add(sum[i][j],sum[i][j-1]);
		}
	}
	cout<<dp[n][0];

	return 0;
}


Measured memory_bytes: 81792
use std::collections::HashSet;
use std::io;

fn main() {
    let abc = parse_values::<usize>(3);
    let mut set = HashSet::new();
    for v in abc {
        set.insert(v);
    }
    if set.len() == 2 {
        println!("Yes");
    } else {
        println!("No");
    }
}

/// Parse line from io::stdin into T Value
fn parse_line<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

/// Parse whitespace split into T values from io::stdin
fn parse_values<T: std::str::FromStr>(n: usize) -> Vec<T> {
    let line = parse_line::<String>();
    let mut split = line.split_whitespace();
    let mut values = Vec::with_capacity(n);
    for _ in 0..n {
        let v = split.next().unwrap().parse::<T>().ok().unwrap();
        values.push(v);
    }
    values
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
using ll = long long;

int main(){
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    if(k < 100){
        rep(cnt,k){
            vector<int> num(n,0);
            rep(i,n){
                if(i < a[i]) num[0]++;
                else num[i-a[i]]++;
                if(a[i]+i < n-1) num[a[i]+i+1]--;
            }
            a[0] = num[0];
            for(int i = 1;i < n;++i) a[i] = a[i-1] + num[i];
        }
        rep(i,n) cout << a[i] << endl;
    }else rep(i,n) cout << n << endl;
}

Measured memory_bytes: 4776
n, l = gets.split.map(&:to_i)
index = []
sum = 0
(0...n).each do |i|
	index[i] = l + i
end
if l >= 0
	sum = index.inject(:+) - index.min
else
	if n + l > 0
		sum = index.inject(:+)
	else
		sum = index.inject(:+) - index.max
	end
end
puts sum

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

int fib(int n)
{
  int num[10000] = {1, 1};
  for (int i = 2; i <= n; i++){
    num[i] = num[i - 1] + num[i - 2];
  }
  return (num[n]);
}

int main()
{
  int n;
  cin >> n;
  cout << fib(n) << endl;
}

Measured memory_bytes: 1208
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <complex>
#include <iomanip>
#include <queue>
#include <bitset>
//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin(), (v).end());

typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int K, A, B;

    //入力
    cin >> K >> A >> B;

    lint bis = 1, yen = 0;


    if(B-A < 2) {
        bis += K;
    } else {
        int i;
        for(i=0;bis<A;i++) bis++;
        for(;i<K-1;i+=2) bis += B-A;
        if(i<K) bis++;
    }

    cout << bis << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n;
	int i,j,k;
	long long int dp[1001][8];
	long long int cnt=0;
	int m;
	char joi[1001];
	
	scanf("%d",&n);
	scanf("%s",joi);
	for(i=0;i<=n;i++){
		for(j=0;j<8;j++){
			dp[i][j]=0;
		}
	}
	dp[0][4]=1;
	for(i=0;i<=n;i++){
		for(j=0;j<8;j++){
			for(k=0;k<8;k++){
				if(joi[i]=='J')	{
					m=4;
				}
				else if(joi[i]=='O'){
					m=2;
				}
				else if(joi[i]=='I'){
					m=1;
					
				}
				if((k&m) != 0 && (j&k) != 0){
					dp[i+1][k]+=dp[i][j];
					dp[i+1][k]%=10007;
				}
			}
		//printf("%lld ",dp[i][j]);
		}
		//printf("\n");
	}
	/*for(i=0;i<=n;i++){
		for(j=1;j<8;j++){
			printf("%lld ",dp[i][j]);
		}
		printf("\n");
	}*/
	for(i=0;i<8;i++){
		cnt+=dp[n][i];
	}
	cnt%=10007;
	printf("%lld\n",cnt);
	return 0;
}

Measured memory_bytes: 1088