akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

long long rui(long long x,int y){
	long long ans=1;
	for(int i=0;i<y;i++){
		ans = ans*x;
	}
	return ans;
}

long long calc(long long  n,int keta){
	long long  ans=0;
	long long x;
	if(keta==1){
		return n;
	}
	for(int i=1;i<keta;i++){
		x = rui(10,i);
		ans += n/x*rui(2,i-1);
		ans += calc(n%x,i);
	}
	ans +=n;
	return ans;
}

int main(){
	long long s;
	int keta=0;
	cin >> s;
	while(1){
		if(s>rui(10,keta)){
			keta +=1;
		}else break;
	}
	long long ans;
	ans = calc(s,keta);
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n, m;
  cin>>n>>m;
  pair<int, int> ba[m];
  for (int i=0; i<m; i++) {
    cin>>ba[i].second>>ba[i].first;
  }
  sort(ba, ba + m);
  int end = -1;
  int ans = 0;
  for (int i=0; i<m; i++) {
    if (ba[i].second >= end) {
      end = ba[i].first;
      ++ans;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1152
package main

import (
  "fmt"
)

func absInt(x int) int {if x < 0 {x *= -1}; return x}

func main() {
  var n, t, a int 
  fmt.Scan(&n, &t, &a)
  a *= 1000
  t *= 1000
  h := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&h[i])
  }
  res := -1
  d := 1001001001
  for i, x := range h {
    diff := absInt(a - (t - x * 6))
    if diff < d {
      d = diff
      res = i + 1
    }
  }
  fmt.Println(res)
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));


signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int h,w; cin >> h >> w;
    int m; cin >> m;
    vector<int> num1(h+1,0),num2(w+1,0);
    vector<P> v;
    map<P,bool>mp;
    rep(i,m){
        int x,y; cin >> x >> y;
        num1[x]++; num2[y]++;
        v.pb({x,y});
        mp[{x,y}]=1;
    }
    
    int mxm=0;
    int nx=0,ny=0;
    rep(i,h+1){
        if(mxm<num1[i]){
            mxm=num1[i]; nx=i;
        }
    }
    mxm=0;
    rep(i,w+1){
        if(mxm<num2[i]){
            mxm=num2[i]; ny=i;
        }
    }
    int ans=0;
    int s1=0,s2=0;
    rep(i,m){
        if(v[i].fi==nx||v[i].se==ny)ans++;
        if(v[i].fi==nx&&v[i].se==ny)s1++;
    }
    
    //cout << nx << " " << ny << endl;
    
    int s3=0;
    rep(i,h+1){
        //{i,ny}
        if(num1[i]==num1[nx]&&mp[{i,ny}]==0) s3++;
    }
    
    if(s3>0)s2=1;
    s3=0;
    rep(i,w+1){
        //{nx,i}
        if(num2[i]==num2[ny]&&mp[{nx,i}]==0) s3++;
    }
    if(s3>0)s2=1;
    
    if(s1==1&&s2==1&&ans!=m) ans++;
    
    cout << ans << endl;
}


Measured memory_bytes: 64264
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
namespace mp = boost::multiprecision;
using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,k;
  string s;
  cin>>n>>k;
  cin>>s;
  s[k-1]=s[k-1]-('A'-'a');
  cout<<s<<endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std; 
using ll = long long;
#define MOD ll(1e9+7)
vector<vector<ll>> memo(1e3+5, vector<ll> (1e3+5, -1));
ll dp(vector<vector<int>> &g, int i, int j){
	if(i == g.size()-1 && j == g[0].size()-1)
		return 1;
	if(memo[i][j] != -1)
		return memo[i][j];

	memo[i][j] = 0;
	if(i< g.size()-1 && !g[i+1][j]){
		memo[i][j] = (memo[i][j] + dp(g, i+1, j)) % MOD;
	}
	if(j < g[0].size()-1 && !g[i][j+1])
		memo[i][j] = (memo[i][j] + dp(g, i, j+1)) % MOD;
	return memo[i][j];
}

signed main() { 
	cin.tie(0);
	cin.sync_with_stdio();
	int h, w; 
	cin>>h>>w;
	vector<vector<int>> g(h, vector<int> (w, 0));
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			char c;
			cin>>c;
			if(c == '#')
				g[i][j] = 1;
		}
	}
	cout<<dp(g, 0, 0);
}


Measured memory_bytes: 12288
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>


using namespace std;
typedef long long ll;

const int N = 1e5 + 100;
const int inf = 0x3f3f3f3f;
const int OO = 1e9 + 100;
const ll inf_long = 1e18;

ll mod = 1e9 + 7;

int  n, m;
vector<int>adj[N];
int dp[N];

int solve(int idx)
{
	if (dp[idx] != -1)
		return dp[idx];
	int mx = 0;
	for (auto child : adj[idx])
	{
		mx = max(mx, 1 + solve(child));
	}
	return dp[idx] = mx;
}

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

	int u, v;
	cin >> n >> m;
	memset(dp, -1, sizeof dp);
	while (m--)
	{
		cin >> u >> v;
		adj[u].push_back(v);
	}
		int mx = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (dp[i] == -1)
		{
			mx = max(mx, solve(i));
		}
	}
	cout << mx;


	return 0;
}


Measured memory_bytes: 10916
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

bool tup[100010];
bool aup[100010];
bool use[100010];

void solv() {
	ll n;
	cin >> n;
	ll t[100010];
	ll a[100010];
	tup[0] = true;
	aup[n - 1] = true;
	
	for (size_t i = 0; i < n; i++)
	{
		cin >> t[i];
		if (i > 0) {
			if (t[i] > t[i - 1]) {
				tup[i] = true;
			}
		}
	}

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i > 0) {
			if (a[i - 1] > a[i]) {
				aup[i - 1] = true;
			}
		}
	}

	for (int i = 0; i < n; i++)
	{
		if (tup[i]) {
			if (t[i] > a[i]) {
				cout << 0 << endl;
				return;
			}
		}

		int ai = n - i - 1;
		if (aup[ai]) {
			if (t[ai] < a[ai]) {
				cout << 0 << endl;
				return;
			}
		}
	}

	ll res = 1;
	for (int i = 0; i < n; i++)
	{
		if (!tup[i] && !aup[i] && !use[i]) {
			if (t[i] <= a[i]) {
				res *= t[i];
				res %= INF;
				use[i] = true;
			}
		}

		int ai = n - i - 1;
		if (!tup[ai] && !aup[ai] && !use[ai]) {
			if (a[ai] <= t[ai]) {
				res *= a[ai];
				res %= INF;
				use[ai] = true;
			}
		}
	}
	cout << res << endl;
}


int main() {
	solv();

	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin()+1,(c).end(),greater<long>())

using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;

int main(void){
	long N,W;
	VVI V(4,VI(1,0));
	cin >> N >> W;

	long w,v;
	cin >> w >> v;
	V[0].push_back(v);
	REP(i,N-1){
		long w_ot;
		cin >> w_ot >> v;
		V[w_ot-w].push_back(v);
	}

	REP(i,4){
		SORT(V[i]);
		REP(j,V[i].size()-1) V[i][j+1] += V[i][j];
	}

	//dump2d_arr(V);

	long ans = 0;
	REP(i,V[0].size()){
		if (i * w > W) break;
		REP(j,V[1].size()){
			if ((i+j)*w + j > W) break;
			REP(k,V[2].size()){
				long l = (i+j+k)*w + j + (2 * k) - W;
				if (l > 0) break;
				l = min((long)V[3].size()-1,((-l) / (w+3)));
				/*
				dump(i);
				dump(j);
				dump(k);
				dump(l);
				*/

				ans = max(ans,V[0][i] + V[1][j] + V[2][k] + V[3][l]);
			}
		}
	}

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

Measured memory_bytes: 256
'use strict';

const is_ok = (l) => {
  l.sort((x, y) => y - x); // 昇順ソート
  return l[0] - l[1] < l[2] && l[0] !== l[1] && l[1] !== l[2];
};
const main = (arg) => {
  const input = arg.trim().split('\n');
  const n = Number(input[0]);
  const l = input[1].split(' ').map(Number);
  let ans = 0;
  if (n < 3) {
    ans = 0;
  } else {
    for (let i = 0; i < n; i++) {
      for (let j = i + 1; j < n; j++) {
        for (let k = j + 1; k < n; k++) {
          if (is_ok([l[i], l[j], l[k]])) ans++;
        }
      }
    }
  }
  console.log(ans);
};

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 36024
#include <bits/stdc++.h>
using namespace std;
 
//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
//save time
#define endl '\n'
#define db(x) cerr << "> " << #x << ": " << x << endl
typedef long long ll;
 
//for sorting
#define all(a) a.begin(),a.end()
 
//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f
 
//loops
#define REP(i,n) 	    for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)
 
//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb 	push_back
 
//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second
 
//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar
 
//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)
 
//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue
 
//general
#define E empty()
 
//Declare all variables and methods needed between this comment and the next one(OCD lol)
const int MAXN=0;
int main(){

    int n, k ; cin >> n >>k; 
    vi ar(n);
    REP(i, n){
        cin >> ar[i];
    }
    vi dp(n+k+1, INT_MAX);
    dp[0] = 0;
    FOR(i,0, n){
        FOR(j,1, k+1){
            dp[i+j] = min(dp[i+j], dp[i]+abs(ar[i] - ar[i+j]));
        }
       // dp[i+1] = min(dp[i+1], dp[i] + abs(ar[i]- ar[i+1]));
        //dp[i+2] = min(dp[i+2], dp[i] + abs(ar[i]- ar[i+2]));
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4004
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>
# define MOD 1000000000+7
# define INF 1e9
# define LINF 1e18
typedef long long ll;

using namespace std;
int gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
 



int main() {
	
	string s, cut;
	int num = 0;
	int ans = INF;
	cin >> s;

	for (int i = 0; i + 2 < s.length(); i++) {

		cut = s.substr(i,3);
		num = stoi(cut);

		ans = min(abs(753 - num), ans);

	}

	cout << ans << endl;

}

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

template <class T>
inline bool uin(T& a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
inline bool uax(T& a, T b) { return a < b ? (a = b, true) : false; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	string S;
	cin >> S;
	vector<int> A(N);
	for (int i = 0; i < N; ++i)
		A[i] = (int)(S[i] - '1');

	bool one = false;
	for (int i = 0; i < N; ++i) one |= (A[i] == 1);

	if (one) {
		int ans = 0;
		for (int i = 0; i < N; ++i)
			if ((i & (N - 1)) == i) ans ^= (A[i] & 1);
		cout << ans << '\n';
		return 0;
	}

	int ans = 0;
	for (int i = 0; i < N; ++i)
		if ((i & (N - 1)) == i) ans ^= (A[i] & 2);
	cout << ans << '\n';
}

Measured memory_bytes: 8228
import java.io.*;

class Main
{
   public static void main(String[] args) throws IOException
   {
      BufferedReader br =
       new BufferedReader( new InputStreamReader(System.in));

      String str1 = br.readLine();
      String str2[] = str1.split(" ");
      int a = Integer.parseInt(str2[0]);
      int b = Integer.parseInt(str2[1]);
      int c = a*b;
      int d = 2*(a+b);

      System.out.println( c +" "+ d);
   }
}

Measured memory_bytes: 24220
#include <vector>
#include <cmath>
#include <map>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <set>
#include <stack>
#include <bitset>
#include <functional>
#include <ctime>
#include <queue>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
typedef long long LL;

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

// w = Nhn / (4hn - 1Nn - 1Nh)
int main() {
    LL N;
    cin >> N;
    for(LL h = 1; h <= 3500; h++) {
        for(LL n = 1; n <= 3500; n++) {
            LL A = N * h * n;
            LL B = (4*h*n - N*n - N*h);
            if (B != 0 && A % B == 0) {
                LL w = A / B;
                if(w > 0) {
                    cout << h << " " << n << " " << w << endl;
                    return 0;
                }
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long in;
typedef pair<in,in> ii;
#define F first
#define S second
#define sqr(x) (x)*(x)
#define pb(x) push_back(x)
#define sz(x) (in)x.size()
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,x,y) for(in i=x;i<(y);++i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

const in maxn= 9;

int main()
{
    IOS;
    in n;
    cin >> n;
    vector<in> a(n),b(n),c(n);
    rep(i,0,n) cin >> a[i];
    rep(i,0,n) cin >> b[i];
    rep(i,0,n) c[i] = i+1;
    in x =0, y =0;
    while(c != a)
    {
        next_permutation(all(c));
        x++;
    }
    rep(i,0,n) c[i] = i+1;
    while(c != b)
    {
        next_permutation(all(c));
        y++;
    }
    cout << abs(x-y) << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, char> P;

// 2値の圧縮のみ対応
vector<pair<ll, char>> RLE(const string &s) {
	ll cnt = 0;
    ll n = s.length();
	vector<pair<ll, char>> res;
	for (ll i = 0; i < s.size(); i++) {
		cnt++;
		if (i == (ll)s.size() - 1) {
			res.push_back(make_pair(cnt,s[i]));
			break;
		}
		if (s[i] != s[i + 1]) {
			res.push_back(make_pair(cnt,s[i]));
			cnt = 0;
		}
	}
	return res;
}

int main(int argc, char const *argv[]) {
    int n,k; cin>>n>>k;
    string s; cin>>s;
    vector<P> a = RLE(s);
    int ret = 0;
    for (auto &&e: a) ret += e.first-1;
    cout << min(n-1, ret+k*2) << endl;
    return 0;
}


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


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

    cout<<(a<=b ? a : a-1)<<endl;
  
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	   	int n = sc.nextInt();
	   	double ans = 2*n*Math.PI;
	   	System.out.println(ans);
	}
}

Measured memory_bytes: 36024
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a == b && b == c){
		puts("Yes");
	}
	else puts("No");
}

Measured memory_bytes: 256
#include<stdio.h>

int uruu(int a,int nen,int getu,int hi){
    int i,j,k,count=0;
    for(i=0;i<nen;i++){
        if(i%4==0&&(i%100!=0||i%400==0)){
            for(j=1;j<=12;j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
                    for(k=1;k<=31;k++){
                        count++;
                    }
                }
                else if(j==2){
                    for(k=1;k<=29;k++){
                        count++;
                    }
                }
                else{
                    for(k=1;k<=30;k++){
                        count++;
                    }
                }
            }
        }
        else{
            for(j=1;j<=12;j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
                    for(k=1;k<=31;k++){
                        count++;
                    }
                }
                else if(j==2){
                    for(k=1;k<=28;k++){
                        count++;
                    }
                }
                else if(j==4||j==6||j==9||j==11){
                    for(k=1;k<=30;k++){
                        count++;
                    }
                }
            }
        }
    }
    for(;i==nen;i++){
        if(i%4==0&&(i%100!=0||i%400==0)){
            for(j=1;j<getu;j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
                    for(k=1;k<=31;k++){
                        count++;
                    }
                }
                else if(j==2){
                    for(k=1;k<=29;k++){
                        count++;
                    }
                }
                else{
                    for(k=1;k<=30;k++){
                        count++;
                    }
                }
            }
        }
        else{
            for(j=1;j<getu;j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
                    for(k=1;k<=31;k++){
                        count++;
                    }
                }
                else if(j==2){
                    for(k=1;k<=28;k++){
                        count++;
                    }
                }
                else{
                    for(k=1;k<=30;k++){
                        count++;
                    }
                }
            }
        }
    }
    for(i=i-1;i==nen;i++){
        for(;j==getu;j++){
            for(k=1;k<=hi;k++){
                count++;
            }
        }
    }
    return count;
}

int main(){
    int y1,y2,m1,m2,d1,d2;
    while(scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2)){
        if(y1<0||y2<0||m1<0||m2<0||d1<0||d2<0)break;
        printf("%d\n",uruu(y1,y2,m2,d2)-uruu(y1,y1,m1,d1));
    }
    return 0;
}

Measured memory_bytes: 596
n = gets.to_i
d, x = gets.chomp.split.map(&:to_i)
a = []
counter = 0
n.times do
  a.push(gets.to_i)
end
d.times do |day|
  a.each do |b|
    if (day == 0)
      counter += 1
    elsif (1 + day * b <= d)
      counter += 1
    end
  end
end

puts counter + x


Measured memory_bytes: 1788
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	long long x, k, d;
	cin >> x >> k >> d;
	if (x < 0) {
		x = -x;
	}

	if (x > 0) {
		if (x > d) {
			long long s = x % d;
			long long t = x / d;
			if (t >= k) {
				cout << x - k * d << endl;
			} else {
				k -= t;
				if (k % 2 == 0) {
					cout << s << endl;
				} else {
					cout << abs(s - d) << endl;
				}
			}
		} else {
			if (k % 2 == 0) {
				cout << x << endl;
			} else {
				cout << d - x << endl;
			}
		}
	} else if (x < 0) {
		if (-x > d) {

		} else {
			if (k % 2 == 0) {
				cout << -x << endl;
			} else {
				cout << d + x << endl;
			}
		}
	} else {
		if (k % 2 == 0) {
			cout << 0 << endl;
		} else {
			cout << d << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3668
// AtCoDeer and Paint Cans

#include <iostream>

using namespace std;

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

	if (a == b && b == c)
		cout << '1' << endl;
	else if (a != b && b != c && c != a)
		cout << '3' << endl;
	else
		cout << '2' << endl;

	return 0;
}

Measured memory_bytes: 256
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n;
    cin>>n;
    map<string,ll> mp;
    rep(i,n){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 3664
n = int(input())
s = input()

stack = ""

for e in s:
	stack += e
	while len(stack) >= 2:
		if stack[-2:] == "()":
			stack = stack[:-2]
		else:
			break

l = stack.count(")")
r = stack.count("(")
ans = "(" * l + s + ")" * r
print(ans)


Measured memory_bytes: 3060
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    int n,a,b,c,d;
    bool f=false;
    while(cin>>n>>a>>b>>c>>d,n){
        if(f)cout<<endl;
        f=true;
        int mi=1000000;
        int m=a+b+c+d;
        int aaa,aab,aac,aad;
        for(int i=0;i<=a;i++){
            for(int j=0;j<=b;j++){
                for(int k=0;k<=c;k++){
                    for(int l=0;l<=d;l++){
                        if(n>10*i+50*j+100*k+500*l){
                            continue;
                        }
                        int o=10*i+50*j+100*k+500*l-n;
                        int ad=o/500;o%=500;
                        int ac=o/100;o%=100;
                        int ab=o/50;o%=50;
                        int aa=o/10;
                        if(mi>ad+ac+ab+aa+m-i-j-k-l){
                            mi=ad+ac+ab+aa+m-i-j-k-l;
                            aaa=i;aab=j;aac=k;aad=l;
                        }
                    }
                }
            }
        }
        if(aaa){
            cout<<10<<" "<<aaa<<endl;
        }
        if(aab){
            cout<<50<<" "<<aab<<endl;
        }
        if(aac){
            cout<<100<<" "<<aac<<endl;
        }
        if(aad){
            cout<<500<<" "<<aad<<endl;
        }
    }
}




Measured memory_bytes: 3004
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int count = 0;
        for(int i = 0; i<n; i++){
            for(int j = i + 1; j<n; j++){
                count++;
            }
        }
        for(int i = 0; i<m; i++){
            for(int j = i + 1; j<m; j++){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 35688
#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
const ll inf=1e18;

ll dp[2010][2010];
ll N;
ll A[2010];
int main() {
    cin>>N;
    REP(i,0,N){
        cin>>A[i];
    }

    if(N<=2){
        sort(A,A+N);
        p(A[N-1]);
        return 0;
    }
    REP(i,0,N) REP(j,0,N) dp[i][j] = 0;
    //REP(i,0,N) dp[i][i] = A[i];
    for(ll k=0;k<N;k+=2){
        REP(L,0,N){
            ll R = (L + k) % N;
            dp[L][R] = max({dp[L][R], dp[L][(R-1+N)%N] + A[R], dp[(L+1)%N][R] + A[L]});

            if (A[(L-1+N) % N] < A[(R+1)%N]) {
                dp[L][(R+1)%N] = max(dp[L][(R+1)%N], dp[L][R]);
            }
            else {
                dp[(L - 1 + N) % N][R] = max(dp[(L - 1 + N) % N][R], dp[L][R]);
            }
        }
    }
    ll ans=0;
    bool ch=false;
    if(N%2==0) ch=true;
    REP(i,0,N){
        ans = max(ans, dp[i][(i-1+N-ch)%N]);
    }
    p(ans);

    return 0;
}


Measured memory_bytes: 34508
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int min = s.size();
  int max = 0;
  for (int i=0;i<s.size();i++){
    if(s.at(i) == 'A' && min > i){
      min = i;
    }
    if(s.at(i) == 'Z' && max < i){
      max = i;
    }
  }
  
  cout << max - min + 1<< endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

void Function(long long int& x, long long int& k, long long int& d)
{
	long long int key = llabs(x) / d;
	if (key > k) {
		if (x > 0) {
			x -= k * d;
			k = 0;
		}
		else {
			x += k * d;
			k = 0;
		}
	}
	else {
		if (x > 0) {
			x -= key * d;
		}
		else {
			x += key * d;
		}
		k -= key;
	}
}

int main()
{
	long long int X, K, D;
	cin >> X >> K >> D;

	Function(X, K, D);

	while (K > 0)
	{
		if (K % 2 == 0) {
			K = 0;
		}
		else {
			if (X > 0) {
				X -= D;
			}
			else {
				X += D;
			}
			K = 0;
		}
	}

	cout << llabs(X);

	return 0;
}



Measured memory_bytes: 3628
import sys
import socket
from heapq import heappush, heappop

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('d2.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def dijkstra(a, s):
  i0, j0 = s

  debug = i0 == 1 and j0 == 2

  H = len(a)
  W = len(a[0])
  inf = 1000
  d = [[inf]*W for i in range(H)]
  d[i0][j0] = 0
  q = []
  item = (0, i0, j0)
  heappush(q, item)
  for i in range(H):
    for j in range(W):
      if a[i][j] == '#':
        continue
      v = 0 if (i, j) == s else inf
      item = (v, i, j)
      # heappush(q, item)
  
  # print('q:', q)

  while q != []:
    v, i, j = heappop(q)
    di = [-1, 1, 0, 0]
    dj = [0, 0, -1, 1]
    for k in range(4):
      ii = i + di[k]
      jj = j + dj[k]
      if not (0 <= ii < H and 0 <= jj < W):
        continue
      if a[ii][jj] == '#':
        continue
      
      # if debug:
      #   print(' ', i, j, ii, jj, d, d[i][j] + 1, d[ii][jj])

      if d[i][j] + 1 < d[ii][jj]:
        d[ii][jj] = d[i][j] + 1
        item = (d[i][j] + 1, ii, jj)
        heappush(q, item)
      # print('  ',  d[ii][jj])  
  return d


def main():
    H, W = read_int_list()
    a = [read_str() for i in range(H)]
    res = 0
    for i in range(H):
      for j in range(W):
        if a[i][j] == '#':
          continue
        s = (i, j)
        d = dijkstra(a, s)
        
        # print('  d:', d)
        # break

        for k in range(H):
          for l in range(W):
            if a[k][l] == '#':
              continue
            if d[k][l] > res:
              res = d[k][l]

    print(res)


def bfs(a, s):
  i0, j0 = s
  H = len(a)
  W = len(a[0])
  inf = 1000
  d = [[inf]*W for i in range(H)]
  d[i0][j0] = 0

  state = [[0] * W for i in range(H)]
  q = []
  q.append(s)
  state[i0][j0] = 1
  while q != []:
    u = q.pop(0)
    i, j = u
    state[i][j] = 2
    di = [-1, 1, 0, 0]
    dj = [0, 0, -1, 1]
    for k in range(4):
      ii = i + di[k]
      jj = j + dj[k]
      if not (0 <= ii < H and 0 <= jj < W):
        continue
      if a[ii][jj] == '#':
        continue

      # if d[i][j] + 1 < d[ii][jj]:
      if state[ii][jj] == 0:
        d[ii][jj] = d[i][j] + 1
        q.append((ii, jj))
        state[ii][jj] = 1


  return d


def main2():
    H, W = read_int_list()
    a = [read_str() for i in range(H)]
    res = 0
    for i in range(H):
      for j in range(W):
        if a[i][j] == '#':
          continue
        s = (i, j)
        d = bfs(a, s)
        
        # print('  d:', d)
        # break

        for k in range(H):
          for l in range(W):
            if a[k][l] == '#':
              continue
            if d[k][l] > res:
              res = d[k][l]

    print(res)

main2()


Measured memory_bytes: 3608
/*
      author  : nishi5451
      created : 15.08.2020 12:42:12
*/

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


int main(){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n){   
        int h;
        cin >> h;
        if(h>=k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

#ifdef WIN32
	#define LL "%I64d"
#else
	#define LL "%lld"
#endif

#ifdef CT
	#define debug(...) printf(__VA_ARGS__)
	#define setfile() 
#else
	#define debug(...)
	#define filename ""
	#define setfile() freopen(filename".in", "r", stdin); freopen(filename".out", "w", stdout)
#endif

#define R register
#define getc() (S == T && (T = (S = B) + fread(B, 1, 1 << 15, stdin), S == T) ? EOF : *S++)
#define dmax(_a, _b) ((_a) > (_b) ? (_a) : (_b))
#define dmin(_a, _b) ((_a) < (_b) ? (_a) : (_b))
#define cmax(_a, _b) (_a < (_b) ? _a = (_b) : 0)
#define cmin(_a, _b) (_a > (_b) ? _a = (_b) : 0)
#define cabs(_x) ((_x) < 0 ? (- (_x)) : (_x))
char B[1 << 15], *S = B, *T = B;
inline int F()
{
	R char ch; R int cnt = 0; R bool minus = 0;
	while (ch = getc(), (ch < '0' || ch > '9') && ch != '-') ;
	ch == '-' ? minus = 1 : cnt = ch - '0';
	while (ch = getc(), ch >= '0' && ch <= '9') cnt = cnt * 10 + ch - '0';
	return minus ? -cnt : cnt;
}

int f[410][410], a[50], b[50], c[50];
int main()
{
//	setfile();
	int n = F(), ma = F(), mb = F(), sumA = 0, sumB = 0;
	for (int i = 1; i <= n; ++i)
	{
		a[i] = F(), b[i] = F(), c[i] = F();
		sumA += a[i]; sumB += b[i];
	}
	memset(f, 63, sizeof (f));
	f[0][0] = 0;
	for (int i = 1; i <= n; ++i)
		for (int A = sumA; A >= a[i]; --A)
			for (int B = sumB; B >= b[i]; --B)
				cmin(f[A][B], f[A - a[i]][B - b[i]] + c[i]);
	int ans = 0x7fffffff;
	for (int i = ma, j = mb; i <= sumA && j <= sumB; i += ma, j += mb)
		cmin(ans, f[i][j]);
	if (ans > 1e8) puts("-1");
	else printf("%d\n", ans );
	return 0;
}


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

#define ll long long int
#define mod 1000000007

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;


int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int K;
    cin>>K;
    ll ans=0;
    for(int i=1;i<=K;i++){
		for(int j=1;j<=K;j++){
			for(int k=1;k<=K;k++){
				int x=__gcd(i,j);
				ans+=__gcd(x,k);
			}
		}
	}
	cout<<ans<<"\n";
}


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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'


int a, b, c, d;
int gcd(int a, int b) {
    if (a < b) return gcd(b, a);
    int r;
    while(r=a%b){
        a = b;
        b = r;
    }
    return b;
}
int lcm(int a, int b){
    return (a*b)/ gcd(a, b);
}

signed main()
{
    cin >> a >> b >> c >> d;
    
    int pc = (b/c) - ((a-1)/c);
    int pd = (b/d) - ((a-1)/d);
    int pcd = (b/lcm(c,d)) - ((a-1)/lcm(c,d));

    // DEBUG(pc);
    // DEBUG(pd);
    // DEBUG(pcd);

    cout << (b-a+1) -pc -  pd + pcd << endl;;


    return 0;
}

Measured memory_bytes: 256
N, L = map(int, input().split())

if 0 <= L:
    print((N + 2 * L) * (N - 1) // 2)
elif 0 <= L + N - 1:
    print((N + 2 * L - 1) * N // 2)
else:
    print((N + 2 * L - 2) * (N - 1) // 2)

Measured memory_bytes: 3060
#include <stdio.h>
#define N 100

main(){
  int n, a[N], i, flag, conut = 0, b, c;

  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%d", &a[i]);
  }
  flag = 1;
  while(flag){
    flag = 0;
    for(i = n-1;i >= 1;i--){
      if(a[i] < a[i-1]){
	b = a[i];
	c = a[i-1];
	a[i] = c;
	a[i-1] = b;
	flag = 1;
	conut++;
      }
    }
  }
  for(i = 0;i < n-1;i++){
    printf("%d ", a[i]);
  }
  printf("%d\n", a[n-1]);
  printf("%d\n", conut);
  return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

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

int check(int xs, int ys, int xg, int yg ,int c, int board[110][110]) {
	int used[110][110] = { 0 };
	queue<pl> q;
	q.push({ xs, ys });

	while (!q.empty()) {
		int x = q.front().first;
		int y = q.front().second;
		q.pop();
		for (int i = 0; i < 4; i++) {
			int ddx = dx[i] + x;
			int ddy = dy[i] + y;
			if (ddx >= 1 && ddx <= w && ddy >= 1 && ddy <= h && !used[ddy][ddx]) {
				used[ddy][ddx] = 1;
				if (board[ddy][ddx] == c && ddy == yg && ddx == xg)return 1;
				else if (board[ddy][ddx] == c) {
					q.push({ddx,ddy});
				}
			}
		}
	}
	return 0;
}

int main()
{
	while (cin >> w >> h, w, h) 
	{
		int xs, ys, xg, yg;
		int n;
		int board[110][110] = { 0 };
		cin >> xs >> ys >> xg >> yg;
		cin >> n;
		for (int i = 0; i < n; i++)
		{ 
			int c,d, x, y;
			cin >> c >> d >> x >> y;
			if (!d){
				for (int i = y; i < y+2; i++) {
					for (int j = x; j < x+4; j++) 
						board[i][j] = c;
				}
			}
			else {
				for (int i = y; i < y+4; i++) {
					for (int j = x; j < x+2; j++)
						board[i][j] = c;
				}
			}
		}
		if (check(xs, ys, xg, yg, board[ys][xs], board))
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
	return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, m; cin >> n >> m;
  vector<int> l(m), r(m);
  for(int i = 0; i < m; i++) {
    cin >> l.at(i) >> r.at(i);
  }
  sort(l.begin(), l.end());   sort(r.begin(), r.end());
  if(r.at(0) - l.at(m -1) < -1) {
    cout << 0 << endl;
  }
  else {
    cout << r.at(0) - l.at(m -1) +1 << endl;
  }
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
#define INF 1<<30
typedef long long ll;

struct magic{
    int A;
    int B;
};

int main()
{
    int H,N;
    cin >> H >> N;
    vector<magic> M(N);
    int maxa = 0;
    REP(i,N){
        cin >> M[i].A >> M[i].B;
    }
    vector<int> dp(H+1,INF);
    dp[0] = 0;
    REP(i,dp.size()){
        REP(j,N){
            dp[i] = min(dp[max(i-M[j].A,0)]+M[j].B,dp[i]);
        }
    }
    cout << dp[H] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
using namespace std;

int a[13];
signed main(){
	a[4]=a[6]=a[9]=a[11]=1;
	a[2]=2;
	int b,c;cin>>b>>c;
	if(a[b]==a[c])puts("Yes");
	else puts("No");
	}


Measured memory_bytes: 256
N = int(input())
g = {i: [] for i in range(1, N+1)}    

l = [0] * (N + 1)

for i in range(N-1):
    a, b, c = map(int,input().split())
    g[a].append((b,c))
    g[b].append((a,c))

Q, K = map(int,input().split())

stack = [K]

while len(stack):
    v = stack.pop()
    for c,ln in g[v]:
        if l[c] != 0:
            continue
        l[c] = l[v] + ln
        stack.append(c)

for q in range(Q):
    x, y = map(int,input().split())
    print(l[x] + l[y])

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

int main()
{
  int A, B;
  cin >> A >> B;
  if (A <= 5) {
    cout << 0 << endl;
  } else if (A <= 12) {
    cout << B / 2 << endl;
  } else {
    cout << B << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;

int main()
{
    // freopen("in","r",stdin);
    //freopen("out","w",stdout);
    int a, b;
    cin >> a >> b;
    if (a > b)
    {
        for (int i = 0; i < a; i++)
        {
            printf("%d", b);
        }
    }
    else if (b > a)
    {
        for (int i = 0; i < b; i++)
        {
            printf("%d", a);
        }
    }
    else
    {
        for (int i = 0; i < b; i++)
        {
            printf("%d", a);
        }
    }

    return 0;
}

Measured memory_bytes: 256
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

n, k = map(int, input().split())

print(len(Base_10_to_n(n, k)))

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

constexpr lint mod=1e9+7;

int main()
{
	int N;
	string S;

	cin >> N >> S;

	if(S[0]=='W')
	{
		cout << 0 << endl;
		return 0;
	}

	lint ans=1;
	lint sec=0;
	for(int i=0;i<S.size();i++)
	{
		if((S[i]=='W' && sec%2==0) || (S[i]=='B' && sec%2==1))
		{
			ans*=sec;
			ans%=mod;
			sec--;
		}
		else if((S[i]=='W' && sec%2==1) || (S[i]=='B' && sec%2==0))
		{
			sec++;
		}
	}
	if(sec!=0)ans=0;

	for(lint i=1;i<=N;i++)
	{
		ans*=i;
		ans%=mod;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return

#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define repd(i,a,b) for (ll i = (a); i >= b; i--)
#define repdz(i,a) for (ll i = a; i >=0; i--)
#define trav(a, x) for (auto& a : x)

#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define llin(a) ll a; cin>>a;
#define llin2(a,b) ll a,b; cin >>a>>b;
#define llin3(a,b,c) ll a,b,c; cin>>a>>b>>c;
#define full(v) v.begin(),v.end()

void solve()
{
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll sum = 0;
    sum += min(a,k);
    k -= a;
    if (k > 0)
    {
        k -=b;
        if (k > 0)
        {
            sum -= min(c,k);
        }
    }
    cout << sum << endl;;
}

int main()
{
    ios_base::sync_with_stdio(false);
    //llin(t);
    //while (t--)
    //{
    solve();
    //}
}


Measured memory_bytes: 3620
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

def chmax(a, b):
    if a >= b:
        return a
    else:
        return b

dp = [[0]*(10**5 + 10) for _ in range(110)]

#i個の品物を入れて重さがjになっているときの価値の総和の最大値
#dp[i+1][j] = dp[i][j - w[i] + v[i]] 入れるとき
#dp[i+1][j] = dp[i][j] 入れないとき

#dp[0][j] = 0 初期値設定でOK
for i in range(N+1):
    for j in range(W+1):
        dp[i+1][j] = chmax(dp[i+1][j], dp[i][j])
        if (i < N):
            if (j >= w[i]):
                dp[i+1][j] = chmax(dp[i+1][j], dp[i][j - w[i]] + v[i])

print(dp[N][W])

Measured memory_bytes: 123016
use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;

fn exec() {
    let mut sc = Scanner::new();
    let s = sc.ne::<String>().into_bytes();
    let mut freq = vec![0; 26];
    for &c in &s {
        let cc = c - b'a';
        freq[cc as usize] += 1;
    }
    let mut mi = 1000;
    for i in 0..26 {
        if freq[i] == 0 {
            continue;
        }
        let c = b'a' + i as u8;
        let mut t = s.clone();
        let mut cnt = 0;
        loop {
            let mut f = false;
            for &cc in &t {
                if cc != c {
                    f = true;
                    break;
                }
            }
            if !f {
                break;
            }
            cnt += 1;
            let len = t.len() - 1;
            let mut tt = vec![0u8; len];
            for j in 0..len {
                if t[j] == c || t[j + 1] == c {
                    tt[j] = c;
                } else {
                    tt[j] = 0;
                }
            }
            t = tt;
        }
        mi = std::cmp::min(mi, cnt);
    }
    println!("{}", mi);
}

fn main() {
    const STACK: usize = 16 * 1024 * 1024;
    let _ = std::thread::Builder::new()
        .stack_size(STACK)
        .spawn(|| { exec(); })
        .unwrap()
        .join()
        .unwrap();
}

#[allow(dead_code)]
struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r])
                  .ok()
                  .unwrap()
                  .parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => {
                panic!("parse error, {:?}",
                       String::from_utf8(self.buf[l..r].to_owned()))
            }
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;

int main(){
	int n; ll D, A; scanf("%d %lld %lld", &n, &D, &A);
	vector<P> a(n);
	for(int i = 0; i < n; i++) scanf("%lld %lld", &a[i].first, &a[i].second);
	sort(a.begin(), a.end());
	vector<ll> x(n), h(n), cnt(n + 1, 0);
	for(int i = 0; i < n; i++) x[i] = a[i].first, h[i] = a[i].second;
	ll ans = 0, id = 0;
	for(int i = 0; i < n; i++){
		if(i != 0) cnt[i] += cnt[i - 1];
		h[i] -= cnt[i] * A;
		if(h[i] <= 0) continue;
		ll num = (h[i] + A - 1) / A;
		ans += num;
		cnt[i + 1] += num;
		while(x[id] - x[i] <= 2 * D && id < n) id++;
		cnt[id] -= num;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 11192
#include <iostream>

using namespace std;

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

    int c[50];
    for (int i = 0; i < n; i++)
    { 
        cin >> c[i]; 
    }

    int v[50];
    for (int i = 0; i < n; i++)
    { 
        cin >> v[i]; 
    }

    int sum;
    for(int i = 0; i < n; i++)
    {
        if ((c[i] - v[i]) > 0)
        {
            sum += (c[i] - v[i]);
        }
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256