akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 100000000000000009
#define int long long
using P = pair<int,int>;
signed main(){
  int n,l;
  cin >> n >> l;
  int sum = 0;
  for(int i = l;i < n+l;i++) sum += i;
  if(0 < l) cout << sum - l << endl;
  else if(n + l <= 0) cout << sum - (n + l-1) << endl;
  else cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, x[100];
int ans = INF;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> x[i];
	for (int i = 1; i <= 100; i++) {
		int cnt = 0;
		for (int j = 0; j < n; j++) {
			cnt += (i - x[j])*(i - x[j]);
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	int n, k; cin >> n >> k;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    bitset<8192> dpl[5050], dpr[5050];
    dpl[0][0] = 1;
    dpr[n][0] = 1;
    rep(i, n) {
        dpl[i + 1] = dpl[i] | (dpl[i] << a[i]);
    }
    per(i, n) {
        dpr[i] |= dpr[i + 1] | (dpr[i + 1] << a[i]);
    }
    int ans = 0;
    rep(i, n) {
        int cnt = 0;
        bool flag = true;
        for(int x = k - 1; x >= 0; --x) {
            if(dpr[i + 1][k - 1 - x]) cnt ++;
            if(k - a[i] - x - 1 >= 0 && dpr[i + 1][k - a[i] - x - 1]) cnt --;

            if(dpl[i][x]) {
                if(cnt > 0) {
                    flag = false;
                }
            }
        }
        if(flag) ans ++;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define ll  long long 
#define ull unsigned long long int
#define boost ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL)
#define vi vector<int>
#define P push_back
#define F first
#define S second
#define debug(x) cout<<x<<" "
#define pi vector<pair<int,int> >
#define all(a) a.begin(),a.end()
#define int ll
using namespace std;
using namespace __gnu_pbds;
typedef tree <int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll const mod=1e9+7;
int powi(int i,int b){
    int res=1;
    while(b){
        if(b&1)res*=i,res%=mod;
        b>>=1;
        i*=i;
        i%=mod;
    }
    return res;
}
// map<int,int> m;
// ll fact(int n){
// 	//if(n==0)return 0;
// 	if(n<=1)return 1;
// 	if(m[n]!=0)return m[n];
// 	return m[n]=(n*fact(n-1))%mod;
//}
// int ncr(int n,int r){
//     int h=fact(n);
//     int v=fact(r);
//     int j=fact(n-r);
//     v*=j;
//     v%=mod;
//     v=powi(v,mod-2);
//     return (h*v)%mod;
// }
// vi ar(2000000);
// vi sz(2000000);
// int root(int a){
//     if(ar[a]==a)return a;
//     return ar[a]=root(ar[a]);
// }
// int merge(int a,int b){
//     int h=root(a),j=root(b);
//     int ans=sz[h]*sz[j];
//     sz[j]+=sz[h];
//     if(h!=j){
//         ar[h]=j;
//     }
//     return ans;
// } 
void solve(){
    int n;
    cin>>n;
    vi a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=INT_MAX;
    for(int i=1;i<=100;i++){
        int temp=0;
        for(int j=0;j<n;j++){
            temp+=(i-a[j])*(i-a[j]);
        }
        ans=min(ans,temp);
    }
    cout<<ans;
}
signed main(){
    boost;
    int t=1;
    //cin>>t;
    for(int _=1;_<=t;_++){
        //cout<<"Case #"<<_<<": ";
        solve();
        cout<<"\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(4);
  for(int i=0;i<4;++i)cin>>a[i];
  sort(a.begin(),a.end());
  if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9)cout<<"YES\n";
  else cout<<"NO\n";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;

constexpr int max_N = 1e5 + 100;
int memo[max_N];

int rec(int n){
    if(n==0) return 0;
    if(memo[n]!=-1){
        return memo[n];
    }
    int res = n;
    for(int pow=1;pow<=n;pow*=6) res = min(res,rec(n-pow)+1);
    for(int pow=1;pow<=n;pow*=9) res = min(res,rec(n-pow)+1);
    return memo[n] = res;
}

int main(){
    int N;cin>>N;
    REP(i,max_N){
        memo[i] = -1;
    }
    cout << rec(N);
}





Measured memory_bytes: 3712
#C問題
N=int(input())
A=list(map(int,input().split()))
def gcd(GCD1,GCD2):
    x = min(GCD1,GCD2)
    y = max(GCD1,GCD2)
    if y%x == 0:
        return x
    else:
        return gcd(x,y%x)
def gcdlist(xlist):
    xlen=len(xlist)
    GCD=0
    for i in range(xlen-1):
        GCD=gcd(xlist[i],xlist[i+1])
        xlist[i+1]=GCD
    return GCD
MAX=0
kari=0
gcdf=[]
for i in range(N):
    if i == 0:
        gcdf.append(A[i])
    else:
        gcdf.append(gcd(A[i],gcdf[-1]))
gcdb=[]
for i in range(N):
    if i == 0:
        gcdb.append(A[-1])
    else:
        gcdb.append(gcd(A[-1-i],gcdb[-1]))
MAX=0
gcdb=gcdb[::-1]
for i in range(N):
    if i == 0:
        kari=gcdb[1]
    elif i == N-1:
        kari=gcdf[-2]
    else:
        f=gcdf[i-1]
        b=gcdb[i+1]
        kari=gcd(f,b)
    MAX=max(kari,MAX)
print(MAX)

Measured memory_bytes: 14588
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Name        : Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define ff first
#define ss second
#define endl '\n'
#define INF 1e9 + 1
#define _INF INT32_MIN
#define pq priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL gcd(LL a,LL b) {
	return !b ? a : gcd(b, a % b);
}
LL LCM(LL a, LL b) {
	return (a*b) / gcd(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		//printf("%d ", 2);
//		aa.insert(2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			//printf("%d ", i);
			//aa.insert(i);
			n /= i;
		}
	}
	if (n > 2){
		//printf("%d ", n);
	//	aa.insert(n);
	};
}
bool is_square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
LL power(LL x, LL y)
{
	LL temp;
	if (y == 0)return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp*temp;
	else return x*temp*temp;
}
bool is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
const int N = 1e5 + 50;
int a[N], cnt1[N], cnt2[N];
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	string s, t;
	cin >> s >> t;
	vii a(26), b(26);
	for (int i = 0; i < s.length(); i++)
		a[s[i] - 'a']++;
	for (int i = 0; i < t.length(); i++)
		b[t[i] - 'a']++;
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	for (int i = 0; i < 26; i++)
		if (a[i] != b[i])
			return cout << "No\n", 0;
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 916
import math
R = int(input())
L = str(2*math.pi*R)
P = [i for i in L]
A = []
B = [0] * (len(P)-5)
for i in range(len(P)):
  i *= -1
  i -= 1
  if i < -5:
    A.append(P[i])
for i in range((len(P)-5)):
  j = -i-1
  B[j] = A[i]
[int(i) for i in B if i != "."]
print(*B, sep="")

Measured memory_bytes: 62120
diff :: String -> String -> Int
diff xs xt = length [x | x <- zip xs xt, fst x /= snd x]

slice :: Int -> Int -> String -> String
slice start length str = take length $ drop start str

main :: IO ()
main = do
    s <- getLine
    t <- getLine
    let n = length s - length t
    let r = minimum $ map (diff t) [slice x (x + length t) s | x <- [0..n]] 
    (putStrLn . show) r


Measured memory_bytes: 4788
#include "bits/stdc++.h"
using namespace std;

bool check_palindromes(string str, int start_index, int end_index)
{
	for (int i = 0; i < (end_index - start_index + 1) / 2; i++)
	{
		if (str[start_index + i - 1] != str[end_index - i - 1])
		{
			return false;
		}
	}
	return true;
}

int main()
{
	string str;
	cin >> str;
	if (check_palindromes(str, 1, str.size()) 
		&& check_palindromes(str, 1, (str.size() - 1) / 2)
		&& check_palindromes(str, (str.size() + 3) / 2, str.size()))
	{
		puts("Yes");
	}
	else
	{
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<int> vec(n);
	vector<vector<bool> > check(n, vector<bool>(n, false));
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> vec.at(i);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (!check.at(i).at(j) && i != j) {
				ans += vec.at(i) * vec.at(j);
				check.at(i).at(j) = true;
				check.at(j).at(i) = true;
				//cout << i << ' ' << j << endl;
			}
		}
	}
	cout << ans;
}

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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int N, D;
	cin >> N >> D;
	int x, y;
	int ans = 0;
	rep(i, 0, N)
	{
		cin >> x >> y;
		if (x*x + y * y <= D * D)
		{
			ans++;
		}
	}

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

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

string s;
int k;
vector<int> v;

long swaps(int len) {
	return len / 2;
}

int main() {

	cin >> s >> k;

	char cur = '~';
	for (char c : s) {
		if (c == cur) v.back()++;
		else v.push_back(1);
		cur = c;
	}

	if (v.size() == 1) {
		cout << 1LL * s.length() * k / 2 << endl;
		return 0;
	}

	long ans = 0;
	for (unsigned i = 1; i + 1 < v.size(); i++) {
		ans += 1LL * k * swaps(v[i]);
	}

	if (s[0] == s.back()) {
		ans += swaps(v[0]);
		ans += 1LL * (k - 1) * swaps(v[0] + v.back());
		ans += swaps(v.back());
	}
	else {
		ans += 1LL * k * swaps(v[0]);
		ans += 1LL * k * swaps(v.back());
	}

	cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;cin>>n;n=1;
  int a,r=0;
  while(cin>>a) {
    if(n++ == a) {
      r++;
      n++;
      cin>>a;
    }
  }
  cout<<r<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N_MAX 30
#define W_MAX 30

int main(void){
	int i, n, w, pos[W_MAX+1], x[2], t;
	
	scanf("%d\n%d",&w,&n);
	for(i=1; i<=w; i++) pos[i]=i;
	for(; n>0; n--){
		scanf("%d,%d",&x[0],&x[1]);
		t=pos[x[0]], pos[x[0]]=pos[x[1]], pos[x[1]]=t;
	}
	
	for(i=1; i<=w; i++) printf("%d\n",pos[i]);
	
	return 0;
}

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

int main(){
    int N;cin>>N;
    int cnt=0;
    ll abs_min=1e+9;
    vector<ll> A(N,0);
    rep(i,N){
        ll tmp;cin>>tmp;
        abs_min = min(abs_min,abs(tmp));
        if(tmp<0)cnt++;
        A[i]=tmp;
    }
    ll ans=0;
    if(cnt%2 == 0){
        //偶数個なら、全て正にできる.
        rep(i,N){
            ans += abs(A[i]);
        }
    }else{
        //奇数個なら、1つだけ負が残る.
        rep(i,N){
            ans += abs(A[i]);
        }
        ans -= 2*abs_min;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    vector<int> pay;
    int coins[] = {500,100,50,10,5,1};
    while(true){
          int temp;
          cin >> temp;
          if(temp == 0)break;
          pay.push_back(temp);
    }
    
    for(int i = 0;i < pay.size();i++){
          int change = 1000 - pay[i];
          int total = 0;
          for(int j = 0;j < 6;j++){
                int n = change / coins[j];
                change -= n * coins[j];
                total += n;
          }
          cout << total << endl;
    }
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
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;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

int main() {
    cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(20);

    ll l, r, d;
    cin >> l >> r >> d;
    ll ans = 0;
    for(ll i = l; i <= r; i++) if(i % d == 0) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
 
int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    rep(i, 0, h) {
        rep(j, 0, w) cout << ((b <= i) ^ (a <= j));
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    string s; cin >> s;
    int n = s.size();

    ll ans = 0;
    int idx=0;
    while(idx < n){
        int i = idx;
        while(i < n and s[i] != 'A') i++;
        int j = i;
        vector<int> vs;
        while(j < n){
            if(s[j] == 'A'){
                vs.push_back(1);
                j++;
            }
            else if(s.substr(j,2) == "BC"){
                vs.push_back(2);
                j += 2;
            }
            else{
                break;
            }
        }

        int cnt = 0;
        reverse(all(vs));
        for(int k=0;k<vs.size();k++){
            if(vs[k] == 2) cnt++;
            else if(vs[k] == 1) ans += cnt;
        }
        idx = j;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1532
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define ll long long int
#define pb push_back
int n;
string s;
int main(){
	cin>>s;
	int ans = 0;
	if(s[0]=='R' && s[1]=='R' && s[2]=='R')
		cout<<3;
	else if(s[0]=='R' && s[1]=='R')
		cout<<2;
	else if(s[1]=='R' && s[2]=='R')
		cout<<2;
	else if(s[1]=='R' || s[2]=='R' || s[0]=='R')
		cout<<1;
	else
		cout<<0;
}
  

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main(){
	int A,B,memo=-1; cin>>A>>B;
  	for(int i=10000;i>0;i--){
    	if(floor(i*0.08)==A&&floor(i*0.10)==B){
        	memo=i;
        }
    }
  	cout<<memo<<endl;
return 0;
}

Measured memory_bytes: 256
def ninto26(n):
  num = list(range(1, 26)) + [0]
  alphabets = [chr(i + 97) for i in range(26)]
  
  dic = {n:a for n, a in zip(num, alphabets)}
  s = ""
  
  while n != 0:
    s += dic[n % 26]
    
    i = 0
    while 26 ** (i + 1) <= n:
      i += 1
    
    if n % 26 != 0:
      n -= (n % 26)
    else:
      n -= 26
      
    n //=  26
  return s

N = int(input())

print("".join(list(reversed(ninto26(N)))))

Measured memory_bytes: 8908
#include <stdio.h>


int main(){
    char s[1300];
    int cnt[26]={0};
    
    while (gets(s)!=NULL){
        for (char *p=s; *p!='\0'; p++){
            if (*p >='a' && *p <= 'z'){
                cnt[*p - 'a']++;
            } else if (*p >='A' && *p <= 'Z'){
                cnt[*p - 'A']++;
            }
        }
    }
    
    for (int i=0; i<26; i++){
        printf("%c : %d\n",'a'+i, cnt[i]);
    }
    

    return 0;
}

Measured memory_bytes: 940
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def fact_and_inv(SIZE):
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def warshall_floyd(d, n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

class TwoDimGrid:
    # 2次元座標 -> 1次元
    def __init__(self, h, w, wall="#"):
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid

    def pos(self, x, y):
        return y * (self.w + 2) + x + 1

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]

        ans = 0
        for i in range(1, self.h + 1):
            for j in range(1, self.w + 1):
                pass # ここから何か書いてね
def bc(bi):
    # bit-count
    ret = 0
    while(bi > 0):
        if bi & 1 == 1:
            ret += 1
        bi //= 2
    return ret

def judge(bi, fnums, pnums):
    ret = 0
    for i, fnum in enumerate(fnums):
        tmp = bi & fnum

        ret += pnums[i][bc(tmp)]
    # print(ret, bi)
    return ret

def solve():
    n = getN()
    fnums = []
    for i in range(n):
        fnums.append(getList())
    fnums = [int("".join(list(map(str, fnum))), 2) for fnum in fnums]
    # print(fnums)
    pnums = []
    for i in range(n):
        pnums.append(getList())
    ans = -INF
    for bi in range(1, 1 << 10):
        ans = max(ans, judge(bi, fnums, pnums))

    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 74300
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

void mod( ll &n, ll m=MOD ){ n%=m,n+=m,n%=m; }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll n,m;
    cin>>n>>m;
    int val[n+5]={};
    loop(i,0,m)
    {
        int l,r;
        cin>>l>>r;
        val[l]++;
        val[r+1]--;
    }

    int ans = 0;
    for(int i=1;i<=n;i++)
    {
        val[i] += val[i-1];
        if( val[i] == m )
            ans++;
    }
    cout<<ans,nl;


    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
dict_name = {}
name_list = []
for i in range(0, n):
    name, t = input().split()
    dict_name[name] = int(t)
    name_list.append(name)
x = input()
flag = 0
total = 0
for i in range(0, n):
    if flag == 1:
        total += dict_name[name_list[i]]
    if name_list[i] == x:
        flag = 1
print(total)

Measured memory_bytes: 3064
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	int n,a[114514];
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	cout<<a[n/2]-a[n/2-1]<<endl;
	return 0;
}

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

int main() {
    int r, ans;
    cin >> r;
    ans = r*r;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N;
  ll A, B;
  cin >> N >> A >> B;
  auto X = vector<ll>(N);
  REP(i, N) cin >> X[i];

  ll prev = X[0];
  ll cost1 = 0;
  REPS(i, 1, N) {
    ll d = X[i] - prev;
    if(d * A > B) {
      cost1 += B;
    } else {
      cost1 += d * A;
    }
    prev = X[i];
  }

  cout << cost1 << endl;
}


Measured memory_bytes: 1024
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

function griddist(grid,startx,starty){
  const road = ".", wall = "#", INF = 1e9;
  const h = grid.length, w = grid[0].length;
  const res = Array(h).fill().map(()=>Array(w).fill(INF));
  const dx = [0, 1, 0, -1], dy = [-1, 0, 1, 0], dd = 4;
  var q = [startx, starty], dist = 1;
  res[starty][startx] = 0;
  while(q.length){
    var qq = [];
    while(q.length){
      var y = q.pop(), x = q.pop();
      for(var i = 0; i < dd; i++){
        var xx = x+dx[i], yy = y+dy[i];
        if(xx < 0 || xx === w || yy < 0 || yy === h)continue;
        if(grid[yy][xx] === wall || res[yy][xx] !== INF)continue;
        res[yy][xx] = dist;
        qq.push(xx,yy);
      }
    }
    dist++, q = qq;
  }
  return res;
}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var h = next(), w = next(), k = next();
  var a = nexts(h,1);
  var sx, sy;
  for(var i = 0; i < h; i++){
    var t = a[i].indexOf("S");
    if(t >= 0){
      sx = t, sy = i;
      break;
    }
  }
  var dist = griddist(a,sx,sy);
  var ans = 1e9;
  for(var y = 0; y < h; y++)for(var x = 0; x < w; x++){
    if(dist[y][x] > k)continue;
    var t1 = Math.ceil(y / k);
    var t2 = Math.ceil(x / k);
    var t3 = Math.ceil((h-y-1) / k);
    var t4 = Math.ceil((w-x-1) / k);
    var t = Math.min(t1,t2,t3,t4)+1;
    if(t < ans)ans = t;
  }
  return ans;
}

Measured memory_bytes: 30356
#include <iostream>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	if (a % 2 == b % 2) {
		cout << (b - a) / 2 << endl;
	} else {
		cout << min(a + (b - a - 1) / 2, n - b + 1 + (b - a - 1) / 2) << endl;
	}
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main(){
    int N, K;
    cin >> N >> K;
    vector<ll> h(N);
    for (int i = 0; i < N; i++) cin >> h.at(i);

    ll min_v = 10000000001;
    sort(h.begin(), h.end());
    for (int i = 0; i < N - K + 1; i++) {
        min_v = min(min_v, h.at(i + K - 1) - h.at(i));
    }
    
    cout << min_v << endl;
    return 0;
}

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

int main() {
	ll n,q;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	cin >> q;
	vector<ll> b(q), c(q);
	rep(i,q) cin >> b[i] >> c[i];

	const ll MAX_NUM = 1000000;
	vector<ll> cnt(MAX_NUM+1,0); // 数字の数をカウントする配列
	rep(i,n) cnt[a[i]]++;

	// 和を計算するベース
	ll sum_base = 0;
	rep(i,MAX_NUM+1) sum_base += i*cnt[i];

	// 書き換え処理
	rep(i,q) {
		// 書き換え処理による和の変化量
		ll sum_diff = (c[i] - b[i]) * cnt[b[i]];
		cnt[c[i]] += cnt[b[i]];
		cnt[b[i]] = 0;
		sum_base += sum_diff;
		cout << sum_base << endl;
	}


	return 0;
}


Measured memory_bytes: 13552
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {
	static int sortCount = 0;
	static int addValue = 1;
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int n = Integer.parseInt(scanner.next());
		int[] A = new int[n];
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(scanner.next());
		}
		List<Integer> intervalList = new ArrayList<Integer>();
		shellSort(A, intervalList, n);
		System.out.println(intervalList.size());
		int ansCnt = 0;
		for(int i: intervalList){
			System.out.print(i);
			if(ansCnt < (intervalList.size() - 1)){
				System.out.print(" ");
			}else{
				System.out.println("");
			}
			ansCnt++;
		}
		System.out.println(sortCount);
		for(int i: A){
			System.out.println(i);
		}
	}

	private static void shellSort(int[] A, List<Integer> intervalList, int n){
		intervalList.add(addValue);
		while(true){
			addValue = (3 * addValue) + 1;
			if(n <= addValue){
				break;
			}
			intervalList.add(addValue);
		}
		Collections.reverse(intervalList);
		Iterator it = intervalList.iterator();
		while(it.hasNext()){
			int g = (int) it.next();
			insertionSort(A, g, n);
		}
	}

	private static void insertionSort(int[] A, int g, int n){
		for(int i = g; i < n; i++){
			int v = A[i];
			int j = i - g;
			while(j >= 0 && A[j] > v){
				A[j + g] = A[j];
				j = j - g;
				sortCount++;
			}
			A[j + g] = v;
		}
	}
}

Measured memory_bytes: 179664
//Code by 27.
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const int MOD=1000000007;
const long long LMOD=1000000007;
long long n;
string st;
long long dp[3005][3005];
int main()
{
	cin>>n>>st;
	long long s=0;
	dp[0][1]=1;
	for(long long i=0;i<st.size();i++)
	{
		s=0;
		if(st[i]=='<')
		{
			for(long long j=1;j<=i+2;j++)
			{
				dp[i+1][j]=s;
				s+=dp[i][j];
				s%=MOD;
			}
		}
		else
		{
			for(long long j=i+2;j>=1;j--)
			{
				s+=dp[i][j];
				s%=MOD;
				dp[i+1][j]=s;
			}
		}
	}
	s=0;
	/*
	for(long long i=0;i<=n;i++)
	{
		for(long long j=0;j<=n;j++)
		{
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}
	*/
	for(long long i=1;i<=n;i++)
	{
		s+=dp[n-1][i];
		s%=MOD;
	}
	cout<<s;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<bool> dp(110, false);
    dp[0] = true;
    for (int i = 0; i < n; ++i) {
        if (dp[i]) {
            dp[i + 4] = true;
            dp[i + 7] = true;
        }
    }
    cout << (dp[n] ? "Yes" : "No") << endl;
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    map<string, int> cnt;
    for(int i=0;i<n;i++){
        string s; 
        cin >> s;
        cnt[s]++;
    }
    
    int ma = -1;
    for (std::map<std::string, int>::iterator i = cnt.begin(); i != cnt.end(); ++i) {
        ma=max(ma, i->second);
    }
    vector<string> ans;
    for (std::map<std::string, int>::iterator i = cnt.begin(); i != cnt.end(); ++i) {
        if(ma==i->second){
            ans.push_back(i->first);
        }
    }
    sort(ans.begin(), ans.end());
    for(int i=0;i<ans.size();i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 26868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000001
//using edge = struct{ll to;ll cost;};
vector<pair<ll,ll>> dist[100010];
ll depth[100010];
void dfs(ll v,ll p,ll d){
	depth[v]=d;
	for(auto &e : dist[v]){
		if(e.first==p)continue;
		dfs(e.first,v,d+e.second);
	}

}

int main(){
	ll n;
	cin>>n;
	ll a[n-1],b[n-1],c[n-1];
	//dist=vector<vector<ll>>(n+1,vector<ll>(n+1,INF));
	for(ll i=0;i<n-1;i++){
		cin>>a[i]>>b[i]>>c[i];
		dist[a[i]].push_back(make_pair(b[i],c[i]));
		dist[b[i]].push_back(make_pair(a[i],c[i]));
	//	cout<<"i"<<endl;
	}
	//cout<<"aa"<<endl;
	ll q,k;
	cin>>q>>k;
	ll x[q],y[q];
	for(ll i=0;i<q;i++)cin>>x[i]>>y[i];

	dfs(k,-1,0);

	for(ll i=0;i<q;i++){
		//cout<<dist[x[i]][k]<<dist[k][y[i]]<<endl;
		cout<<depth[x[i]]+depth[y[i]]<<endl;
	}

}


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

using lli = long long;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
template <typename T>
using Vector = vector<vector<T>>;
template <typename T>
using Prior = priority_queue<T>;
template <typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define X first
#define Y second
#define Push push_back
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()

const lli mod = 1E9 + 7;

double dist(pii a, pii b) {
	double ax = a.X, ay = a.Y;
	double bx = b.X, by = b.Y;
	return sqrt((ax-bx) * (ax-bx) + (ay-by) * (ay-by));
}

void solve() {
	int n;
	cin >> n;

	vector<pii> pos(n);
	for (int i = 0; i < n; ++i) {
		cin >> pos[i].X >> pos[i].Y;
	}

	vector<int> seq(n);
	iota(ALL(seq), 0);

	int tries = 0;
	double ans = 0;
	do {
		++tries;
		for (int i = 1; i < n; ++i) {
			ans += dist(pos[seq[i - 1]], pos[seq[i]]);
		}
	} while (next_permutation(ALL(seq)));

	ans /= tries;

	cout << fixed << setprecision(9) << ans << "\n";
}

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

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

int main() {
  int N;
  cin >> N;
  map<int, int> e;
  for (int i = 1; i < N; i++) {
    int x;
    cin >> x;
    e[x-1]++;
  }

  for (int i = 0; i < N; i++) {
    cout << e[i] << endl;
  }
}


Measured memory_bytes: 12972
#include <iostream>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  if(a>b){
  	for(int i=0; i<a; ++i){
      cout << b;
    }
    cout << endl;
  }
  else
    for(int j=0; j<b; ++j){
      cout << a;
    }
  	cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long a = in.nextLong();
        long b = in.nextLong();
        long c = a+b;
        long mod = n%c;
        long div = Math.floorDiv(n, c);
        long ans = div*a + Math.min(a, mod);
        System.out.println(ans);
    }
}


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

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

    int num_pl = 0;
    int cnt = 0;
    rep(i, 0, s.size())
    {
        if (s[i] == ')')
        {
            if (cnt > 0)
                cnt--;
            else
                num_pl++;
        }
        else
            cnt++;
    }

    int num_pr = 0;
    cnt = 0;
    for(int i = s.size() - 1; i >= 0; i--)
    {
        if (s[i] == '(')
        {
            if (cnt > 0)
                cnt--;
            else
                num_pr++;
        }
        else
            cnt++;
    }

    string ans = s;
    rep(i, 0, num_pl)
        ans = "(" + ans;
    rep(i, 0, num_pr)
        ans = ans + ")";
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int n, x[100], y[100], h[100];
vector<pair<pair<int, int>, int> > p;

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> x[i] >> y[i] >> h[i];
		if(h[i] >= 1){
			p.push_back(make_pair(make_pair(x[i], y[i]), h[i]));
		}
	}
		
	for(int cx = 0; cx <= 100; ++cx){
		for(int cy = 0; cy <= 100; ++cy){
			int height = max(p[0].second+abs(p[0].first.first-cx)+abs(p[0].first.second-cy), 0);
			bool flg = true;
			for(int i = 0; i < n; ++i){
				if(max(height-abs(x[i]-cx)-abs(y[i]-cy), 0) != h[i]) flg = false;
			}
			if(flg){
				printf("%d %d %d\n", cx, cy, height);
				return 0;
			}
		}
	}
}


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

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    map<int, int> mp;
    for(int k=0; k<K; k++) {
        int D;
        cin >> D;
        mp[D]++;
    }
    
    for(int i=N; i<=99999; i++) {
        int tmpi=i;
        while(tmpi!=0) {
            if(mp[tmpi%10]==0) {
                tmpi /= 10;
            } else {
                break;
            }
        }
        if(tmpi==0) {
            cout << i << endl;
            break;
        }
    }


    return 0;
    
}

Measured memory_bytes: 256
n, a = map(int, raw_input().split())
X = map(int, raw_input().split())
dp = [[0]*(n*a+1) for i in xrange(n+1)]
dp[0][0] = 1
for i in xrange(n):
    for j in xrange(i, -1, -1):
        for k in xrange(n*a, X[i]-1, -1):
            dp[j+1][k] += dp[j][k-X[i]]
ans = 0
for i in xrange(1, n+1):
    ans += dp[i][i*a]
print ans


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

int main(){
  long long N ; 
  cin >> N ; 
  vector<long long> a(N) ; 
  for(int i = 0 ; i < N ; i++) cin >> a.at(i) ; 


  long long ans = 0 ; 
  for(int i = 0 ; i < N ; i++){
    ans += (a.at(i)-1) ; 
  }
  //cout << cnt << endl;
  cout << ans << endl; 
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>

int
main(void)
{
	char t[2][101];
	int n, p;
	int pt[2] = {0, 0};

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%s %s", t[0], t[1]);
		p = strcmp(t[0], t[1]);
		if (p == 0)
			pt[0]++, pt[1]++;
		else
			pt[p < 0] += 3;
	}

	printf("%d %d\n", pt[0], pt[1]);

	return 0;
}



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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

vector<vector<double>> x;

signed main() {
    LCIN(N, D);
    x.resize(N);
    REP(i, N) REP(j, D) { x[i].emplace_back(IN<double>()); }
    ll cnt = 0;
    REP(i, N) FOR(j, i + 1, N) {
        double sum = 0;
        REP(k, D) { sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]); }
        sum = sqrt(sum);
        if(ceil(sum) == floor(sum)) cnt++;
    }
    cout << cnt << "\n";
}


Measured memory_bytes: 256
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int ans=0,n,h,w;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);

#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif
cin >> n >> h >> w;
for(int i=1;i<=n;i++){
       for(int j=1;j<=n;j++){
              if(i+h-1<=n&&j+w-1<=n)ans++;
       }
}
cout << ans << endl;







return 0;}
///....


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

#define inf 2000000009

typedef long long ll; 

int main(){
	int n,x; cin>>n>>x; 
	int g=0; 
	for(int i=0;i<n;i++){
		int c; cin>>c; 
		g=__gcd(g,abs(c-x)); 
	}
	cout<<g; 

}

Measured memory_bytes: 256