akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;

//union find木(グループわけができる)
int par[100050];
long long int num[100050] = {}, res[100050] = {},key;
int unifind(int n) {
	for (int i = 1; i <= n; i++) {
		par[i] = i;
		num[i] = 1;
	}
	return 0;
}
//木の根を求める
int unifind_root(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = unifind_root(par[x]);
	}
}
//同じグループか判定
bool unifind_same(int x, int y) {
	return unifind_root(x) == unifind_root(y);
}
//グループ併合
int unifind_unite(int x, int y) {
	x = unifind_root(x);
	y = unifind_root(y);
	if (x == y) {
		res[key] = res[key + 1];
		key--;
		return 0;
	}
	par[x] = y;
	res[key] = res[key + 1] + num[y] * (num[y] - 1) / 2 + num[x] * (num[x] - 1) / 2 - (num[y] + num[x])*(num[y] + num[x] - 1) / 2;
	key--;
	num[y] += num[x];
	num[x]=0;
}



int main() {
	//cout << fixed << setprecision(10);
	
	
	long long int n, m, a[100005], b[100005], c, d,k,cou=1,one=0,zero=0;
	string str;
	cin >> n>>m;
	unifind(n);
	key = m - 2;
	res[m - 1] = n * (n - 1) / 2;
	for (int i = 0; i <m; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i =m-1; i >=0; i--) {
		unifind_unite(a[i], b[i]);
	}
	for (int i = 0; i < m; i++) {
		cout << res[i] << endl;
	}
}


Measured memory_bytes: 4864
n=input()
n=int(n)
mas=[]
ans=0
for i in range(2):
    temp=input().split(" ")
    temp=list(map(int,temp))  
    mas.append(temp)
for j in range(n):
    temp=sum(mas[0][0:j+1])+sum(mas[1][j:])
    if ans < temp:
        ans=temp
print(ans)



Measured memory_bytes: 3060
N, X, Y = map(int, input().split())
dist = [[N+10 for _ in range(N+1)] for _ in range(N+1)]
for i in range(1, N+1):
    for j in range(i+1, N+1):
        dist[i][j] = min(j-i, abs(X-i)+abs(Y-j)+1)
ans = [0 for _ in range(N+1)]
for i in range(1, N+1):
    for j in range(i+1, N+1):
        ans[dist[i][j]] += 1
for i in range(1, N):
    print(ans[i])

Measured memory_bytes: 80220
#include <iostream>

using namespace std;

int main(void) {
	string A,B;
	cin >> A >> B;
	bool awin,equal = false;
	if (A.length() == B.length()) {
		if (A == B) {
			equal = true;
		}
		else {
			awin = (A > B);
		}
	}
	else {
		awin = (A.length() > B.length());
	}

	if (awin) {
		cout << "GREATER" << endl;
	}
	else {
		if (equal) {
			cout << "EQUAL" << endl;
		}
		else {
			cout << "LESS" << endl;
		}
	}

	return 0;
}


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

int main() {
    int k , s; cin >> k >> s;
    int ans = 0;
    for (int x = 0;x <= k; x++) {
        for (int y = 0;y <= k; y++) {
            int z = s - x - y;
            if (0<=z && z <= k) {
                ans++;
            }
            
        }
    }
    cout <<  ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=4999999996000000001;
ll frac[200100];

ll modpow(ll a, ll n, ll mod){
    ll ret=1;
    while(n>0){
        if(n&1) ret=ret*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ret;
}

ll comb(ll n, ll r){
    ll res=1;
    res*=frac[n];
    res*=modpow(frac[r],MOD-2,MOD);
    res%=MOD;
    res*=modpow(frac[n-r],MOD-2,MOD);
    res%=MOD;
    return res;
}

int main(){
    ll s;
    cin>>s;
    frac[0]=1;
    for(ll i=1;i<10000;i++){
        frac[i]=frac[i-1]*i;
        frac[i]%=MOD;
    }

    ll ans=0;
    ll num=1;
    while(true){
        ll saku=num-1;
        ll maru=s-num*3;
        if(maru<0) break;
        ans+=comb(saku+maru,maru);
        ans%=MOD;
        num++;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3272
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n,k,q;
    cin >> n;
    cin >> k;
    cin >> q;
    int* a = new int[q]; 
    int* human = new int[n];
    for (int i = 0; i < n;i ++){
        human[i] = k-q;
    }
    
    for (int i = 0;i < q;i++){
        cin >> a[i];
        human[a[i]-1]++;
    }
    for (int i= 0;i < n;i ++){
     if(human[i]>0)
        cout << "Yes\n";
     else
        cout << "No\n";
    }
}


Measured memory_bytes: 1408
#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 ll long long
#define hii cout << "hii" << endl
#define int ll
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
 
const int N = 5e5 + 5;
const int MAXN = 1e5 + 5;
const int mod = 1e9 + 7;
const int MOD = 1e9 + 7;
const int INF = 1e15;
const int LG = 21;
const long double PI = acos(-1);

int arr[N];

int get(int l, int r)
{
	if(l == 0) return arr[r];
	else return arr[r] - arr[l - 1];
}

void solve() 
{
	int n, k;
	cin >> n >> k;
	int ret = 0;
	for(int i = 0; i <= n; i++)
	{
		arr[i] = i;
		if(i)
		{
			arr[i] = arr[i] + arr[i - 1];
		}
	}
	for(int i = k; i <= n + 1; i++)
	{
		int l1 = get(n - i + 1, n);
		int l2 = get(0, i - 1);
		ret += l1 - l2 + 1;
		ret %= mod;
	}
	cout << ret % mod << endl;
}

 
 
int32_t main() 
{	
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

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

Measured memory_bytes: 5200
#include <stdio.h>

int main() {
  int H, W;
  char S[64][64];
  int map[64][64] = {0};
  int i, j;
  
  scanf("%d %d", &H, &W);
  for(i = 0; i < H; i++) {
    scanf("%s", S[i]);
  }
  
  for(i = 0; i < H; i++) {
    for(j = 0; j < W; j++) {
      if(S[i][j] == '#') {
        map[i][j] = 100;
        map[i-1][j-1] += 1;
        map[i][j-1] += 1;
        map[i+1][j-1] += 1;
        map[i-1][j] += 1;
        map[i+1][j] += 1;
        map[i-1][j+1] += 1;
        map[i][j+1] += 1;
        map[i+1][j+1] += 1;
      }
    }
  }
  
  for(i = 0; i < H; i++) {
    for(j = 0; j < W; j++) {
      if(map[i][j] >= 100) {
        printf("#");
      } else {
        printf("%d", map[i][j]);
      }
    }
    printf("\n");
  }
  
  return 0;
}
  

Measured memory_bytes: 128
#include <stdio.h>
 
int main(void)
{
    int a[10][10][20]={};
    int b,f,r,v,n,x,y,z;
    scanf("%d",&n);
    for(x=1;x<=n;x++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        a[b][f][r]=a[b][f][r]+v;
    }
    for(x=1;x<=3;x++){
        for(y=1;y<=3;y++){
            for(z=1;z<=10;z++){
                printf(" %d",a[x][y][z]);
            }
            printf("\n");
        }
        printf("####################\n");
    }
    for(y=1;y<=3;y++){
        for(z=1;z<=10;z++){
            printf(" %d",a[4][y][z]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 620
#include<stdio.h>
#include<algorithm>
using namespace std;
//NO SPECIFIED SPORTS!!!!
int p[100];
int q[100];
int main(){
    int a;
    scanf("%d",&a);
    for(int i=0;i<a*(a-1)/2;i++){
        int b,c,d,e;
        scanf("%d%d%d%d",&b,&c,&d,&e);
        b--;
        c--;
        if(d==e){
            p[b]--;
            p[c]--;
        }
        if(d<e){
            p[c]-=3;
        }
        if(e<d){
            p[b]-=3;
        }
    }
    for(int i=0;i<a;i++)q[i]=p[i];
    std::sort(p,p+a);
    for(int i=0;i<a;i++){
        printf("%d\n",lower_bound(p,p+a,q[i])-p+1);
    }
}

Measured memory_bytes: 1044
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n;

	cin>>n;

	vll a(n), sum(n+1, 0);

	rep(i, n){
		cin>>a[i];
		sum[i+1]=sum[i]+a[i];
	}

	map<ll, ll> count;

	rep(i, n+1){
		count[sum[i]]++;
	}

	map<ll, ll>::iterator it;

	ll ans=0;
	for(it=count.begin(); it!=count.end(); it++){
		ll temp=it->second;
		if(temp>=2) ans+=temp*(temp-1)/2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 15872
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	static bool prime[1000001];
	fill(prime, prime + 1000001, true);
	prime[0] = prime[1] = false;
	for(int i = 2; i * i <= 1000000; i++)
		if(prime[i])
			for(int j = 2 * i; j <= 1000000; j += i)
				prime[j] = false;
	for(int a,b,n; cin >> a >> b >> n, a || b || n;) {
		while(true) {
			if(prime[a]) n--;
			if(!n) break;
			a += b;
		}
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define DBG(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const ll p = 1e9+7;
const ll INF = 1LL << 60;

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int cnt[3]={};
  for(int i=0;i<n;i++){
    int ps;
    cin>>ps;
    if(ps<=a)cnt[0]++;
    else if(ps<=b)cnt[1]++;
    else cnt[2]++;
  }
  cout<<min({cnt[0],cnt[1],cnt[2]})<<endl;
  return 0;
}


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

using namespace std;

int main() {
    string s;
    std::cin >> s;

    if (s == "ABC")
    {
        std::cout << "ARC" << std::endl;
    } else
    {
        std::cout << "ABC" << std::endl;
    }
    
    
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  string s,t;
  cin>>s>>t;
  rep(i,min((int)s.size(),(int)t.size()))cout<<s[i]<<t[i];
  if(s.size()>t.size())cout<<s[s.size()-1];
}


Measured memory_bytes: 256
#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
#define vvi vector<vector<int>>
using namespace std;
using namespace __gnu_pbds;
typedef tree <pair<int,int>, null_type,less<pair<int,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 (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 a;
    cin>>a;
    a=a+(a*a)+(a*a*a);
    cout<<a;
}
signed main(){
    boost;
    int t=1;
    //freopen("input.txt", "r", stdin);
    //cin>>t;
    for(int _=1;_<=t;_++){
        //cout<<"Case #"<<_<<": ";
        solve();
        cout<<"\n";
    }
    
    return 0;
}

Measured memory_bytes: 3576
#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a+b>c+d) printf("Left\n");
    else if(a+b==c+d) printf("Balanced\n");
    else if(a+b<c+d) printf("Right\n");

    return 0;
}


Measured memory_bytes: 128
A, B, C, X, Y = map(int, raw_input().split())

strat1 = A*X + B*Y  # simple strategy
strat2 = 2*C*X + abs(Y-X)*B  # more A, add back B
strat3 = 2*C*Y + abs(X-Y)*A  # more B, add back A
strat4 = 2*C*max(X,Y) # overbuy C

print min(strat1, strat2, strat3, strat4)


Measured memory_bytes: 2568
#define _GLIBCXX_DEBUG
#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 A, B, H, M;
    cin >> A >> B >> H >> M;
    long double h = (H*30.0 + M/2.0);
    long double m = M*6.0;
    long double kaku = abs(h - m);
    if(kaku > 180){
        kaku = 360 - kaku;
    }


    kaku = kaku * M_PI / 180;

    long double c2 = pow(A,2) + pow(B,2) - 2*A*B*cos(kaku);
    long double ans = sqrt(c2);

    cout << fixed << setprecision(15) << ans << endl;
}

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

int main(){
  ll n,m;
  string s,t;
  cin>>n>>m>>s>>t;
  ll g=__gcd(n,m);
  ll ans=n*m/g;
  bool f=1;
  for(int i=0;i<g;i++)if(s[i*n/g]!=t[i*m/g])f=0;
  cout<<(f?ans:-1)<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

typedef long long ll;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    if (N==1 || N==2 || N==3) {
        cout << 0 << endl;
        return 0;
    }
    
    vector<int> numR(N);
    vector<int> numG(N);
    vector<int> numB(N);
    if (S[N-1] == 'R') {
        numR[N-1] = 1;
    } else if (S[N-1] == 'G') {
        numG[N-1] = 1;
    } else {
        numB[N-1] = 1;
    }
    for (int i=N-2;i>=0;i--){
        if (S[i] == 'R') {
            numR[i] = numR[i+1] + 1;
            numG[i] = numG[i+1];
            numB[i] = numB[i+1];
        } else if (S[i] == 'G'){
            numR[i] = numR[i+1];
            numG[i] = numG[i+1] + 1;
            numB[i] = numB[i+1];
        } else {
            numR[i] = numR[i+1];
            numG[i] = numG[i+1];
            numB[i] = numB[i+1] + 1;
        }
    }

    ll sum = 0;
    for (int i=0;i<N-2;i++){
        for (int j=i+1;j<N-1;j++){
            if (S[i] == 'R') {
                if (S[j] == 'G') {
                    sum += numB[j+1];
                    if (2*j-i<N){
                        if (S[2*j-i] == 'B') sum--;
                    }
                } else if (S[j] == 'B') {
                    sum += numG[j+1];
                    if (2*j-i<N){
                        if (S[2*j-i] == 'G') sum--;
                    }
                }
            } else if (S[i] == 'G') {
                if (S[j] == 'B') {
                    sum += numR[j+1];
                    if (2*j-i<N){
                        if (S[2*j-i] == 'R') sum--;
                    }
                } else if (S[j] == 'R') {
                    sum += numB[j+1];
                    if (2*j-i<N){
                        if (S[2*j-i] == 'B') sum--;
                    }
                }
            } else {
                if (S[j] == 'R') {
                    sum += numG[j+1];
                    if (2*j-i<N){
                        if (S[2*j-i] == 'G') sum--;
                    }
                } else if (S[j] == 'G') {
                    sum += numR[j+1];
                    if (2*j-i<N){
                        if (S[2*j-i] == 'R') sum--;
                    }
                }
            }
        }
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3652
//
// author  : Abhishek
//
#include <bits/stdc++.h>
#include<chrono>

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;
using namespace chrono;

const ll MOD = 1000000007;
const ll N = 300005;  // array size
const ll inf = 10000000000000000;
const db PI = 3.14159265358979323846264338327950288419716939937510;

void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

void print(vector<pair<ll, ll> > v) {
    ll i;
    fo(i, v.size()) {
        cout << v[i].first << " " << v[i].second << "\n";
    }
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}

ll n, m;

vector<ll> adj[N];
vector<ll> vis(N + 1);
vector<ll> dp(N + 1, 0);

void dfs(ll cur) {
    vis[cur] = 1;
    ll mx = -1;
    for (auto next: adj[cur]) {
        if (!vis[next]) {
            dfs(next);
            mx = max(mx, dp[next]);
        } else {
            mx = max(mx, dp[next]);
        }
    }

    dp[cur] = mx + 1;
}

void solve() {
    ll t = 1;
//    cin >> (t);
    while (t--) {

        ll i, j, k, p, q, x, y, a, b, l, r;
        cin >> n >> m;
        ll mn = min(n, m), mx = max(n, m);

        fo(i,mx){
            cout<<mn;
        }
    }


}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif

    auto start = high_resolution_clock::now();

    solve();

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif


    return 0;
}




Measured memory_bytes: 15020
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

    vector<int> A;
    A.push_back(0);

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

    N += 2;

    ll sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += abs(A[i + 1] - A[i]);
    }
    // printf("sum = %lld\n", sum);

    //観光スポットiを消す場合について，
    // sum -（観光スポットをiとi+1の間のコスト）-（観光スポットをiとi-1の間のコスト）+（観光スポットをi-1とi+1の間のコスト）
    ll ans;
    for (int i = 1; i <= N - 2; i++)
    {
        ans = sum - abs(A[i + 1] - A[i]) - abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i - 1]);
        cout << ans << endl;
    }
    return (0);
}


Measured memory_bytes: 3896
import math
a, b, h, m = list(map(int, input().split()))
ans = 0

# 角度cを求める
# 時の進んだ角度
c1 = h*30 + m*0.5
# 分の進進んだ角度
c2 = m*6
Cd = 0

if c1 > c2:
    Cd = c1-c2
else:
    Cd = c2-c1

# 余弦定理
ans = math.sqrt(a*a + b*b -2*a*b*math.cos(math.radians(Cd)))
print(ans)



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

int n,m;
int ans;

void traverse(vector<vector<int>> &graph, vector<int> &visited, int s)
{
	visited[s] = 1;
	for(int i=0;i<graph[s].size();i++){
		int u = graph[s][i];
		if(visited[u]==0){
			traverse(graph, visited, u);
		}
	}
}

int ncomponent(vector<vector<int>> &graph, vector<int> &visited)
{
	for(int i=0;i<n;i++){
		if(visited[i] == 0){
			visited[i] = 1;
			traverse(graph, visited, i);
			ans++;
		}
	}
}

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

	vector<vector<int>> graph(n);
	vector<int> visited(n, 0);

	for(int i=0;i<m;i++){
		int x,y,z;
		cin >> x >> y >> z;
		graph[x-1].push_back(y-1);
		graph[y-1].push_back(x-1);		
	}

	ans = 0;
	ncomponent(graph, visited);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;
int a[100010];

P num[100010];

int main(void){
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>num[i].first;
		num[i].second = (i + 1);
	}

	sort(num, num + n);
	for (int i = 0; i < n; i++) {
		cout<< num[i].second << " ";
	}cout<<endl;
	
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <queue>
#include <map> 
using namespace std;

#define LL long long


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

	LL num;
	map<LL, LL> mp;

	for (LL i = 0; i < N; i++) {
		cin >> num;
		mp[num]++;
	}

	LL size = mp.size();
	if (size == 1) {
		if (mp[0] == N) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	if (N % 3 != 0) {
		cout << "No" << endl;
		return 0;
	}

	if (size == 2) {
		if (mp[0] == (N / 3)) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	else if (size == 3) {
		// first: key, second: value
		auto iter = mp.begin();
		LL key1 = iter->first;
		LL val1 = iter->second;

		iter++;
		LL key2 = iter->first;
		LL val2 = iter->second;

		iter++;
		LL key3 = iter->first;
		LL val3 = iter->second;

		if (val1 == val2 && val2 == val3) {
			if ((key1 ^ key2) == key3) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
}

Measured memory_bytes: 5120
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
string s[111111];
signed main() {
	int n,l;
	
	cin >> n >> l;
	rep(i, n)cin >> s[i];
	sort(s, s + n);
	rep(i, n)cout << s[i];
	puts("");
	system("PAUSE");
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>

using namespace std;

int main() {
    int x , y ;
    cin >> x >> y;
    if(x > y)
        cout << "a > b" << endl;
    else if(x < y)
        cout << "a < b" << endl;
    else if ( x == y )
    cout << "a == b" << endl;
    
return 0;
}


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

int main(){
	string S;
	cin >> S;
	int ans = 0;
	rep(i,S.size()-1) {
		if (S[i] != S[i+1]) ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;

const int mod = 1000000007;

ll mod_pow(ll x, ll n){
  ll res = 1;
  while(n > 0){
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

ll factorial(ll x){
  ll ret = 1;
  while (x){
    ret *= x;
    ret %= mod;
    x--;
  }
  return ret;
}

ll f(ll x, ll a){
  ll ret = 1;
  while (a >= 1){
    ret *= x;
    ret %= mod;
    x--; a--;
  }
  return ret;
}

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll z = mod_pow(2, n);
  z--;
  ll x1 = f(n, a);
  ll x2 = f(n, b);
  ll y1 = factorial(a);
  ll y2 = factorial(b);
  ll w1 = mod_pow(y1, mod - 2);
  ll w2 = mod_pow(y2, mod - 2);
  ll s1 = (x1 * w1) % mod;
  ll s2 = (x2 * w2) % mod;
  ll ans = (z - s1 - s2) % mod;
  if (ans < 0) ans += mod;
  cout << ans << endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)round(x))<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

int main() {
  int L, N;
  int w[100];
  
  while (cin >> L >> N) {
    memset(w, 0, sizeof(w));
    
    for (int i = 0; i < N; i++) {
      int x, w_tmp;
      cin >> x >> w_tmp;
      w[x + L] += w_tmp;
    }

    vector<int> ans_x, ans_w;

    for (int i = 1; i <= L; i++) {
      int rht = i + L;
      int lft = -i + L;
      if (w[lft] > w[rht]) {
        ans_x.push_back(i);
        ans_w.push_back(w[lft] - w[rht]);
      } else if (w[lft] < w[rht]) {
        ans_x.push_back(-i);
        ans_w.push_back(w[rht] - w[lft]);
      }
    }

    cout << ans_x.size() << endl;
    
    for (int i = 0; i < ans_x.size(); i++) {
      cout << ans_x[i] << " " << ans_w[i] << endl;
    }
  }
}

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

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

#ifdef EBUG
#define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n";
#else
#define debug(x)
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll x, n, p[105];
int main() {
  cin >> x >> n;
  rep(i, n) {
    cin >> p[i];
  }
  ll ans, md = 1000000000;
  for (int i = -5; i <= 105; i++) {
    bool f = false;
    rep(j, n) {
      if (i == p[j]) {
        f = true;
      }
    }
    if (!f && md > abs(x - i)) {
      ans = i;
      md = abs(x - i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()


int main() {
    int n, k;
    vector<P> a;
    vector<int> ans;
    cin >> n >> k;
    a.resize(n);
    REP(i,n){
        cin >> a[i].first;
        a[i].second = i+1;
    }
    bool ok = true;
    int pos = n-1;
    P tmp = {-1,-1};
    while(k>=0){
        SORTR(a);
        if(tmp.second > 0) a.push_back(tmp);
        for(int i=0; i<n; i++){
            if(a[i].first > 0){
                a[i].first--;
                ans.push_back(a[i].second);
                if(i==pos){
                    k--;
                    tmp = a[i];
                    a.erase(a.begin()+i);
                    pos = n-2;
                    break;
                }
            }
            else{
                ok = false;
                k = -1;
                break;
            }
        }
    }
    if(ok){
        cout << ans.size() << endl;
        for(int i=0;i<ans.size();i++){
            cout << ans[i] << " \n"[i==ans.size()-1];
        }
    }
    else{
        cout << -1 << endl;
    }
    return 0;
}


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

int main(){
  int N;
  string S;
 
  cin >> N;
  
  int i=0;
  for (; i<N; i++){
    cin >> S;
    if (S == "Y"){
      cout << "Four" <<endl;
      break;
    }
  }
  
  if (i == N){
    cout << "Three" << endl;
  }

}


Measured memory_bytes: 256
#include <stdio.h>

double dc4pi5(double arg,int n){
	int i = 0;
	for(i = 0;i < n;i++){
		arg *= 10;
	}
	int tmp = (int)arg;
	double ret = tmp;
	if(tmp % 10 <= 4){
		ret -= tmp % 10;
	}else{
		ret += 10 - tmp % 10;
	}
	for(i = 0;i < n;i++){
		ret /= 10;
	}
	return ret;
}

int main(void){
	double a, b, c, d, e, f;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) != EOF){
		double x = (c * e - b * f) / (a * e - b * d);
		double y = (-c * d + a * f) / (a * e - b * d);
		x = dc4pi5(x,4);
		y = dc4pi5(y,4);
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 1080
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll dp[MAX_N];

ll f(ll i) {
    if(i == 0) {
        return 0;
    }
    if(dp[i] != -1) {
        return dp[i];
    }
    ll res = i;
    for(ll pow6 = 1; pow6 <= i; pow6 *= 6) {
        chmin(res, f(i - pow6) + 1);
    }
    for(ll pow9 = 1; pow9 <= i; pow9 *= 9) {
        chmin(res, f(i - pow9) + 1);
    }
    return dp[i] = res;
}

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

    rep(i, MAX_N) {
        dp[i] = -1;
    }
    
    out(f(n));
    re0;
}

Measured memory_bytes: 4096
#include <iostream>
#include<string>
using namespace std;
int main() {
	int a, b, c;

	cin >> a >> b >> c;
	if(b-a==c-b)
	{
		cout << "YES" << endl;
	}else 
	{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())
tot = 0
if a + b <= c*2:
    print(a*x+b*y)
    exit()
else:
    tot += min(x, y)*c*2
if x >= y:
    if a <= c*2:
        tot += a*(x-y)
    else:
        tot += c*2*(x-y)
else:
    if b <= c*2:
        tot += b*(y-x)
    else:
        tot += c*2*(y-x)
print(tot)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    long X = scanner.nextLong();
    System.out.println(count(N, X));
  }

  private static long count(int n, long x) {
    if ((1L << (n + 2)) - 3 < x) throw new IllegalArgumentException();
    if (n == 0) return 1;
    if (x == 1) return 0;
    x--;
    if (x <= (1L << (n + 1)) - 3) return count(n - 1, x);
    x -= (1L << (n + 1)) - 3;
    if (x == 1) return 1L << n;
    x--;
    if (x <= (1L << (n + 1)) - 3) return count(n - 1, x) + (1L << n);
    return (1L << (n + 1)) - 1;
  }
}

Measured memory_bytes: 23124
#include <stdio.h>
int main(void){
    // Your code here!
    int N;
    char S[100];
    scanf("%d",&N);
    scanf("%s",S);
    int i;
    for(i=0; S[i]!='\0'; i++){}
    if(i<=N) printf("%s\n",S);
    else{
        for(int j=0;j<N;j++) printf("%c",S[j]);
        printf("...\n");
    }
    return 0;
}

Measured memory_bytes: 1660
using System;
using System.Collections;
using System.Linq;
namespace ARC097
{
    class Program
    {
        static void Main()
        {
            //以下入力を受け取る
            string s = Console.ReadLine();
            int k = int.Parse(Console.ReadLine());

            //以下処理内容
            ArrayList sub = new ArrayList();

            for (int i = 1; i <= k; i++)
            {
                for (int j = 0; j <= s.Length - i; j++)
                {
                    string st = s.Substring(j, i);
                    sub.Add(st);
                }
            }


            string[] sub2 = (string[])sub.ToArray(typeof(string));
            Array.Sort(sub2);

            ArrayList sub3 = new ArrayList();
            sub3.Add(sub2[0]);
            for (int i = 1; i < sub2.Length; i++)
                if (sub2[i - 1] != sub2[i])
                    sub3.Add(sub2[i]);

            //for (int i = 0; i < sub2.Length; i++)
            //    Console.WriteLine(sub2[i]);

            //以下解答を出力
            Console.WriteLine((string)sub3[k - 1]);
        }
    }
}


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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    if ( n <= m ) {
        ans = 1;
    }

    cout << ( ans ? "unsafe" : "safe" ) << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int,int>P;
#define INF (1e9)
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define REP(i,n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,k,n) for(int i = (k); i < (int)(n); i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define pb push_back
#define vec vector<int>


/*--------------------------------------------*/
/*ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);*/
/*--------------------------------------------*/


int main(){
    int n;cin>>n;
    int cnt=0;
    REP(i,n){
        int a,b;cin>>a>>b;
        cnt+=(b-a);
    }
    cout<<cnt+n<<endl;
}



/*--------------------------------------------*/
/*
ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}


void list_Prime(ll n){//n以下の素数を全て見つける
    ll Limit=(int)sqrt((double)n);
    for(ll i=2;i<=n;i++)prime[i]=1;//最初はみんな素数かも
    //素数の整数倍を消していく(ルートnまで)
    for(ll i=2;i<=Limit;i++){
        if(prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    prime[j]=0;                
                }
            }
        }
    }
}

ll divisor(ll n){
    for(ll i=2;i<=n;i++){
        ll d=1;
        ll tmp=i;
        while(tmp>0){
            d++;
            while(tmp%d==0){
                prime[i]++;
                tmp/=i;
            }
        }
    }
    ll sum=1;
    for(ll i=2;;i<=n;i++){
        sum*=(prime[i]+1)/MOD;
    }    
    cout<<"sum="<<sum<<endl;

    return sum%MOD;
}
*/


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
using ldb = long double;
using pa = pair < int, int >;
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
#define pb push_back
#define all(c) c.begin(),c.end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d,t,s;
    cin >> d >> t >> s;
    if(t*s >= d){
        cout << "Yes";
    }
    else
        cout << "No";
    return 0;
}



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

signed main(){
    int N;
    cin>>N;
    vector<string>S(N);
    vint T(N);
    rep(i,N)cin>>S[i]>>T[i];

    string X;cin>>X;

    int ans=0;
    int k=find(all(S),X)-S.begin()+1;
    for(int i=k;i<N;i++)ans+=T[i];
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

class Drink{
    public:
    long cost;
    long stock;
    Drink(long c, long s):cost(c), stock(s){}
    Drink(){}

};
bool operator<(const Drink &d1, const Drink &d2){
    return d1.cost < d2.cost;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<Drink> d;
    for (int i = 0; i < N; i++){
        long a, b; cin >> a >> b;
        d.push_back(Drink(a, b));
    }
    sort(d.begin(), d.end());

    int j = 0; long ans = 0;
    while (M > 0){
        if (M > d[j].stock){
            M -= d[j].stock;
            ans += d[j].cost * d[j].stock;
            j++;
        }
        else{
            ans += d[j].cost * M;
            M = 0;
        }
    }
    cout << ans << endl;
}


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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        
        var input = Console.ReadLine().Split();
        var V = new int[N];
        for (int i = 0; i < N; i++)
            V[i] = int.Parse(input[i]);
        
        input = Console.ReadLine().Split();
        var C = new int[N];
        for (int i = 0; i < N; i++)
            C[i] = int.Parse(input[i]);


        var output = 0;
        for (int i = 0; i < N; i++)
        {
            output += Math.Max(0, V[i] - C[i]);
        }

        Console.WriteLine(output);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll n; cin>>n;
  ll ans=POW(10,n);
  ll p=(mod+2*POW(9,n)-POW(8,n))%mod;
  out((ans+mod-p)%mod);
}

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


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
  int h1,m1,s1,h2,m2,s2;
  int h,m,s,result;
  
  for(int i=0;i<3;i++){
  cin >>h1>>m1>>s1>>h2>>m2>>s2;
  
  result=(h2*3600+m2*60+s2)-(h1*3600+m1*60+s1);
  h=result/3600;
  result-=h*3600;
  m=result/60;
  result-=m*60;
  s=result;
  cout<<h<<" "<<m<<" "<<s<<endl;
  }
  return 0;
}
  

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<bool> isW(N);
    int wR = 0, rR = 0, wL = 0, rL = 0;
    for (int i = 0; i < N; i++) {
        char c; cin >> c;
        isW[i] = (c == 'W');
        if (isW[i]) wR++;
        else rR++;
    }

    int ans = min(N - wR, N - rR);
    for (int i = 0; i < N; i++) {
        if (isW[i]) wL++, wR--;
        else rL++, rR--;
        ans = min(ans, min(wL, rR) + abs(wL - rR));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3624
R, C, K = map(int,input().split())
MAP = [[0 for i in range(C)] for j in range(R)]
DP = [[[0 for i in range(C+1)] for j in range(4)] for k in range(R+1)]
 
for _ in range(K):
    r, c, v = map(int,input().split())
    MAP[r-1][c-1] = v
 
for i in range(R):
    for j in range(4):
        for k in range(C):
            DP[i+1][j][k+1] = max(DP[i][3][k+1], DP[i+1][j][k])
            if j == 0:
                continue
            v = MAP[i][k]
            if v == 0:
                continue
            DP[i+1][j][k+1] = max(DP[i+1][j][k+1], max(DP[i][3][k+1], DP[i+1][j-1][k]) + v)

print(DP[R][3][C])

Measured memory_bytes: 469080
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll x, s = 100, c = 0; cin >> x;
	while(s < x) { s += s/100; c++; }
	println(c);
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  string a, b, c; cin >> a >> b >> c;
  if (a.back() == b[0] and b.back() == c[0]) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
}

Measured memory_bytes: 256
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
  char c11,c12,c13,c21,c22,c23;
  cin>>c11>>c12>>c13>>c21>>c22>>c23;
  if(c11==c23&&c12==c22&&c13==c21)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ABC077D
//  dequeを使う
// 01BFS
#include <iostream>
#include <deque> // dequeを使う
int cost[100005]={};
bool flag[100005]={};
using namespace std;
int main(int argc, const char * argv[]) {
    int k;
    cin>>k;
    for(int i=0;i<k;i++){
        cost[i]=50;
    }
    cost[1]=1;
    deque<int> dq;
    dq.push_front(1);
    int now=1;
    while(now!=0){
        if(flag[now]==false){
            if(now*10%k!=now){
                cost[now*10%k]=min(cost[now*10%k],cost[now]);
                dq.push_front(now*10%k);
            }
            cost[(now+1)%k]=min(cost[(now+1)%k],cost[now]+1);
            dq.push_back((now+1)%k);
            flag[now]=true;
            now=dq.front(); // 先頭から取り出して
            dq.pop_front(); // 先頭を取り除く
        } else {
            now=dq.front(); // 先頭から取り出して
            dq.pop_front(); // 先頭を取り除く
        }
    }
    cout<<cost[0]<<endl;
    return 0;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<long long,int> P;
const ll LINF = 1e+18;

ll dp[101][100010];
ll w[101], v[101];

int main(){
    ll n, W;
    cin >> n >> W;
    rep(i, n) cin >> w[i+1] >> v[i+1];
    rep(j, 100009) dp[0][j+1] = LINF;

    for (int i = 1; i <= n ; i++){
        rep(j, 100010){
            dp[i][j] = dp[i-1][j];
            if (j - v[i] >= 0) dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
        }
    }

    ll ans = 0;
    for (ll v = 0; v < 100010; v++){
        if (dp[n][v] <= W) ans = max(ans, v);
    }

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

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

using namespace std;

const int MOD=1e9+7;

int co[1005];
int n;

int main()
{
	cin >> n;
	for(int i=2;i<=n;i++)
	{
		int x=i;
		for(int j=2;j<=x;j++)
		{
			while(x%j==0)
			{
				co[j]++; x/=j;
			}
		}
	}
	long long ans=1;
	for(int i=2;i<=n;i++)
		ans=(ans*(co[i]+1))%MOD;
	cout << ans << endl;
}

Measured memory_bytes: 256