akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=5000005;
const ll inf=1e18;
ll L[N],R[N],n,m;

struct SMT{
  #define ls (u<<1)
  #define rs (u<<1|1)
  ll minn[N],fir[N],d[N];
  void build(int u,int l,int r){
    minn[u]=0,fir[u]=d[u]=0;
    if(l==r)return;
    int mid=l+r>>1;
    build(ls,l,mid),build(rs,mid+1,r);
  }
  void pushup(int u){
    minn[u]=min(minn[ls],minn[rs]);
  }
  void pushdown(int u,int l,int r){
    if(fir[u]||d[u]){
      fir[ls]=fir[u],d[ls]=d[u],minn[ls]=fir[ls];
      int mid=l+r>>1;
      fir[rs]=fir[u]+(mid+1-l)*d[u],d[rs]=d[u],minn[rs]=fir[rs];
      fir[u]=d[u]=0;
    }
  }
  void cover(int u,int l,int r,int ql,int qr,ll FIR,ll D){
    pushdown(u,l,r);
    if(ql<=l&&r<=qr){
      fir[u]=FIR+(l-ql)*D;
      d[u]=D;
      minn[u]=fir[u];
      //printf("cover l=%d,r=%d,fir=%lld,d=%lld,minn=%lld\n",l,r,fir[u],d[u],minn[u]);
      return;
    }
    pushdown(u,l,r);
    int mid=l+r>>1;
    if(ql<=mid)cover(ls,l,mid,ql,qr,FIR,D);
    if(qr>mid)cover(rs,mid+1,r,ql,qr,FIR,D);
    pushup(u);
  }
  ll query(int u,int l,int r,int pos){
    if(l==r)return fir[u];
    pushdown(u,l,r);
    int mid=l+r>>1;
    if(pos<=mid)return query(ls,l,mid,pos);
    else return query(rs,mid+1,r,pos);
  }
  void print(int u,int l,int r){
    if(l==r){
      printf("%lld ",fir[u]);
      return;
    }
    int mid=l+r>>1;
    pushdown(u,l,r);
    print(ls,l,mid),print(rs,mid+1,r);
  }
}smt;
int main(){
  scanf("%lld%lld",&n,&m);
  for(int i=1;i<=n;i++){
    scanf("%lld%lld",&L[i],&R[i]);
  }
  smt.build(1,1,m);
  for(int i=1;i<=n;i++){
    if(L[i]==1)smt.cover(1,1,m,L[i],R[i],1e17,0);
    else {
      ll nums=smt.query(1,1,m,L[i]-1);
      smt.cover(1,1,m,L[i],R[i],nums+1,1);
    } 
    //printf("when k=%d\n",i);
    //smt.print(1,1,n);puts("");
    ll ans=smt.minn[1]+i;
    if(ans>=1e15)puts("-1");
    else printf("%lld\n",ans);
  }
  return 0;
}

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

int main(){
  int w,h,n,x,y,a;
  int g[110][110]={};
  cin>>w>>h>>n;
  int x_s=0,y_s=0,x_end=w,y_end=h;
  for(int i=0;i<n;i++){
    cin>>x>>y>>a;
    if(a==1) x_s=max(x_s,x);
    else if(a==2) x_end=min(x_end,x);
    else if(a==3) y_s=max(y_s,y);
    else y_end=min(y_end,y);
  }
  int t=max(0,x_end-x_s);
  int p=max(0,y_end-y_s);
  cout<<t*p<<endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define PB push_back
#define MP make_pair
#define S second
#define F first
//#define D cout<<"*\n";
#define fast ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define mod 1000000007 
const double pi = 3.14159265358979323846; 

int dp[105][100004];
int solve(int nap[][2],int n,int w)
{
	
	if(n==0)
	return 0;
	
	int &ans=dp[n][w];
	if(ans!=-1)
	return ans;
	int r1,r2;
	
	if(nap[n-1][0]>w)
	{
	 r1=solve(nap,n-1,w);
	 ans=r1;
	 return r1;
   }
   else
   {
   	r1=solve(nap,n-1,w);
	 r2=solve(nap,n-1,w-nap[n-1][0])+nap[n-1][1];
	 ans=max(r1,r2);
	 return ans;
  }
	
}

signed main()
{
    fast
    int t=1;
   // cin>>t;
    
    while(t--)
    {
      int n,W;
      cin>>n>>W;
      
      int nap[n+1][2];
      
	  for(int i=0;i<n;i++)
      {
      	cin>>nap[i][0]>>nap[i][1];
	  }
	  memset(dp,-1,sizeof(dp));
	  cout<<solve(nap,n,W);
    }
	return 0;
}

	

Measured memory_bytes: 82304
/*
    NO 
        TIME 
            TO 
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <complex>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// define x, y as real(), imag()


template<class T>
istream& operator>> (istream& is, complex<T>& p) {
  T value;
  is >> value;
  p.real(value);
  is >> value;
  p.imag(value);
  return is;
}
#define M_PI 3.14159265358979323846
typedef long long int lli;
lli mod=1e9+9ll;
#define OS //single input use oeis
lli INF=9223372036854775807;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q,b,c;
const double pi=3.14159265358979323846;
lli me(lli a,lli b)
{
    // cout<<mod<<"\n";
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}

int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
 IO;
 OS;
double a,b,n;
cin>>a>>b>>n;
if(b<=n)
{
    double x=b-1;
    x/=b;
    a=a*x;
    lli aa=floor(a);
    cout<<aa;
}
else
{
    double x=n;
    x/=b;
    a=a*x;
    lli aa=floor(a);
    cout<<aa;
}

}

Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
const int N = 51;
const int MAX = 2500;
int x[N];
long long ans = 0,dp[N][N][MAX + 3];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,a;
	cin >> n >> a;
	for(int i = 1;i <= n;++i){
	    cin >> x[i];
	}
	dp[0][0][0]++;
	for(int i = 1;i <= n;++i){
	    for(int k = 0;k <= i;++k){
	        for(int s = 0;s <= MAX;++s){
	            if(k && s >= x[i])dp[i][k][s] += dp[i - 1][k - 1][s - x[i]];
                dp[i][k][s] += dp[i - 1][k][s];
	        }
	    }
	}
	long long ans = 0;
	for(int k = 1;k <= n;++k){
	    ans += dp[n][k][k * a];
	}
	cout << ans;
	return 0;
} 

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

using namespace std;

#define LL long long
#define ULL unsigned LL
#define LD long double
#define debug(x) cerr << #x << " " << x << endl;

const LL INF = 1e18 + 2137;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, W;
	cin>>n>>W;
	int maks = 1000 * n;
	LL dp[n+1][maks+1];
	for(int i=0; i<=maks; i++)
		dp[0][i] = INF;
	dp[0][0] = 0;
	LL w, v;
	for(int i=1; i<=n; i++) {
		cin>>w>>v;
		for(int j=0; j<=maks; j++)
			dp[i][j] = dp[i-1][j];
		for(int j=v; j<=maks; j++) {
			dp[i][j] = min(dp[i][j], dp[i-1][j-v]+w);
		}
	}
	for(int i=maks; i>=0; i--) {
		if(dp[n][i] <= W) {
			cout<<i;
			return 0;
		}
	}
}


Measured memory_bytes: 79232
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
using namespace std;

int main()
{
	ll n;
	cin>>n;
	ll i,a[n+5];
	ll sum=0;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		sum=sum^a[i];
	}
	if(sum)
		cout<<"No\n";
	else
		cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 1024
//入出力等基本
#include <iostream>
#include <vector>
#include <map>
#include <string>

#define 中心() main()
#define 返 return
#define 入力(a) cin >> a
#define 出力(a) cout << a << endl
#define 再帰(s,t) for(整数 s = 0; s<整数(t);s += 1)
#define 如果(a) if(a)
#define 他 else
#define 場合(a) while(a)
#define 先(a) a.first
#define 後(a) a.second
#define 自動 auto
#define 定数 const
#define 部分文字列(m,s,t) m.substr(s,t)
#define 測長(a) a.length()
#define 大小(a) a.size()
#define 付加(a,b) a.push_back(b)
#define 真 true
#define 偽 false

using namespace std;

typedef int 整;
typedef void 無;
typedef long long 整数;
typedef vector<整数> 整数配列;
typedef map<整数,整数> 整辞書;
typedef string 文字列;
typedef vector<整数配列> 二次元整数配列;
typedef bool 真偽;

整数 頂点数, 辺数;
二次元整数配列 図(100010,整数配列());
整数配列 色色(100010);

真偽 二部図判定(整数 頂点,整数 色){
    色色[頂点]=色;
    再帰(a,大小(図[頂点])){
        如果(色色[図[頂点][a]] == 色) 返 偽;
        如果(色色[図[頂点][a]] == 0 && !二部図判定(図[頂点][a],-色)) 返 偽;
    }
    返 真;
}

整 中心(){
    入力(頂点数);
    入力(辺数);
    
    再帰(a,辺数){
        整数 始点, 終点;
        入力(始点);
        入力(終点);
        始点--;
        終点--;
        付加(図[始点],終点);
        付加(図[終点],始点);
    }
     
    整数 答;
    如果(二部図判定(0,1)){
        整数 数=0;
        再帰(a,頂点数){
            如果(色色[a]==1) 数++;
        }
        答=数*(頂点数-数)-辺数;
    }
    他{
        答=(頂点数*(頂点数-1))/2-辺数;
    }
    
    出力(答);
    返 0;
}

Measured memory_bytes: 7424
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

const int INF=1e18;

signed main()
{   
    int N; cin>>N;
    vector<int> h(N);
    for(int i=0;i<N;i++){
        cin>>h[i];
    }

    vector<int> dp(N,INF);
    dp[0]=0;

    for(int i=0;i<N;i++){
        if(i+1<N){
            chmin(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
        }
        if(i+2<N){ 
            chmin(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
        }
    }
    cout<<dp[N-1]<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	long long n,X;
	cin >> n >> X;
	vector<long long> ev_c(n,0);
	vector<long long> a(n);
	REP(i,n) cin >> a[i];
	vector<vector<long long> > b(n,vector<long long>(n));//motomerux,sinka
	REP(i,n)b[i][0] = a[i];
	for(int ci = 0;ci<n;ci++){//evolcount
		if(ci)
			REP(x,n){
			b[x][ci] = min(b[x][ci-1],a[(x-ci+n)%n]);
			//			cout << b[x][ci] <<" ";
			}
		//		cout << endl;
		REP(i,n)ev_c[ci] += b[i][ci];
		ev_c[ci] += ci*X;
	}
	cout << *min_element(ev_c.begin(),ev_c.end()) << endl;
  return 0;
}


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

int main() {

	int n;
	cin >> n;

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

	sort(vec, vec+n);
	reverse(vec, vec+n);

	int alice=0;
	int bob=0;
	for(int i=0; i<n; i++){
		if(i%2 == 0){
			alice += vec[i];
		}else{
			bob += vec[i];
		}
	}
	cout << alice-bob;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int N[999],i,j,a,temp;
scanf("%d",&a);
for(i=0;i<999;i++)
{
scanf("%d",&N[i]);
}
for(i=0,j=a-1;i<a/2;i++,j--)
{
temp=N[i];
N[i]=N[j];
N[j]=temp;
}
for(i=0;i<a-1;i++)
{
printf("%d ",N[i]);
}
printf("%d\n",N[a-1]);
return 0;
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
struct dot{
	double x,y;
	double len(){return sqrt(x*x+y*y);}
	dot(double a=0.0,double b=0.0){x=a,y=b;}
	dot operator +(const dot&b)const {return dot(x+b.x,y+b.y);}
	dot operator -(const dot&b)const {return dot(x-b.x,y-b.y);}
	dot operator *(const double&z)const {return dot(x*z,y*z);}
	bool operator <(const dot&b)const {return (x<b.x)||(x==b.x&&y<b.y);}
};
struct line{
	dot x1,x2;
};
double chaji(dot x,dot y){
	return x.x*y.y-x.y*y.x;
}
double neiji(dot x,dot y){
	return x.x*y.x+x.y*y.y;
}
double cos(dot x,dot y){
	if (!x.len()||!y.len())return 0;
	return neiji(x,y)/x.len()/y.len();
}
dot Projection(dot x,line y){//求x关于直线y的投影点（垂足） 
	y.x2=y.x2-y.x1;
	x=x-y.x1;
	double len=cos(x,y.x2)*x.len()/y.x2.len();
	y.x2=y.x2*len;
	return y.x2+y.x1;
}
int main(){
	line x;int T;
	scanf("%lf%lf%lf%lf",&x.x1.x,&x.x1.y,&x.x2.x,&x.x2.y);
	scanf("%d",&T);
	while (T--){
		dot y;
		scanf("%lf%lf",&y.x,&y.y);
		dot ans=Projection(y,x);
		printf("%.10lf %.10lf\n",ans.x,ans.y);
	}
	return 0;
}



Measured memory_bytes: 3252
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    if ((g * 10 + b) % 4 == 0) { 
      System.out.print("YES");
    } else {
      System.out.print("NO");
    }
  }
}

Measured memory_bytes: 22868
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	while(true){
		cin>>a>>b>>c;
		if(a==-1&&b==-1&&c==-1){
			break;
		}
		int sum=a+b;
		if((a|b) & (1<<31)){
			cout<<"F"<<endl;
		}else if(sum>=80){
			cout<<"A"<<endl;
		}else if(sum>=65){
			cout<<"B"<<endl;
		}else if(sum>=50||c>=50){
			cout<<"C"<<endl;
		}else if(sum>=30){
			cout<<"D"<<endl;
		}else{
			cout<<"F"<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <stack>
#include <string>
using namespace std;

int main() {
	stack<int> a;
	string b;
	while (cin >> b) {
		if (b == "*") {
			int c = a.top();
			a.pop();
			int d = a.top();
			a.pop();
			a.push(c * d);
		}
		else if (b == "+") {
			int c = a.top();
			a.pop();
			int d = a.top();
			a.pop();
			a.push(c + d);
		}
		else if (b == "-") {
			int c = a.top();
			a.pop();
			int d = a.top();
			a.pop();
			a.push(d - c);
		}
		else a.push(stoi(b));
	}
	cout << a.top() << endl;
}


Measured memory_bytes: 3192
#include<stdio.h>

int main(){

    int h, w;
    scanf("%d %d",&h,&w);

    char a[h][w+2];
    int i,j;
    for(i=0;i<h;i++){
        scanf("%s",a[i]);
    }

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            printf("%c",a[i][j]);
        }
        printf("\n");
        for(j=0;j<w;j++){
            printf("%c",a[i][j]);
        }
        printf("\n");
    }
    return 0;

}


Measured memory_bytes: 128
#include<iostream>
#include <queue>
using namespace std;
int main(){
  int i,n,m,a;
  cin >> n >> m;
  priority_queue<int> que; // 昇順
  for(i=0;i<n;i++){
    cin >> a;
    que.push(a);
  }
  for(i=0;i<m;i++){
    int x=que.top();
    que.pop();
    x=x/2;
    que.push(x);
  }
  long long ans=0;
  for(i=0;i<n;i++){
    int x=que.top();
    que.pop();
    ans+=x;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3916
// trace works only with c++ 14

#include<bits/stdc++.h>

using namespace std;

//#pragma comment (linker, "/STACK:256000000")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define all(a) a.begin(), a.end()
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define boost  ios_base::sync_with_stdio(false);
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long llint;
typedef long long ll ;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int mod = 1e9 + 7 ;
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
ll gcd(ll a , ll b){return a==0?b:gcd(b%a,a);}
/*---------------------------------------------------------------------------------------------------------------------*/
const int maxn = 100010;
const int inf = INT_MAX;

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n, i, a[5000];
	cin >> n;
	for(i = 0; i < 2 * n; i++) {
		cin >> a[i];
	}		
	sort(a, a + 2 * n);
	ll ans = 0;
	for(i = 0; i < 2 * n; i += 2)
		ans += a[i];
	cout << ans;
	cin.get();
	cin.get();
	cin.get();
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;
inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
inline ll power(ll base, ll exp)
{
	ll ans = 1;
	while (exp > 0)
	{


		if (exp % 2 != 0)
			ans = (ans * base) % N;

		base = (base * base) % N;
		exp /= 2;
	}
	return ans % N;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin >> n;
	vector<ll> arr(n+1, 0);
	f(i, 1, n)
	{
		ll temp;
		cin >> temp;
		arr[temp] += 1;
	}
	f(i, 1, n)
	{
		cout << arr[i] << endl;
	}
	cout << arr[n];
	return 0;
}

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

int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> c(n);
    vector<vector<int> > vec(n);

    rep(i,n){
        cin>>c[i];
        rep(j,m){
            int tmp;cin>>tmp;
            vec[i].push_back(tmp);
        }
    }
    int ans=1e9+7;
    for(int bit=0;bit<(1<<n);bit++){
        vector<int> g;
        int cnt=0;
        int t =bit;
        while(t>0){
            if(t&1){
                g.push_back(cnt);
            }
            cnt++;
            t>>=1;
        }
        int cost = 0;
        vector<int> a(m);
        for(auto v:g){
            cost+=c[v];
            for(int j=0;j<m;j++){
                a[j]+=vec[v][j];
            }
        }
        bool fl = true;
        for(auto k:a){
            if(k<x){
                fl=false;
            }
        }
        if(fl){
            ans = min(cost,ans);
        }
    }
    if(ans==1e9+7){
        cout<<-1<<endl;
        return 0;
    }

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

Measured memory_bytes: 3632
#include <cstdio>
#include <cmath>

int n, m, d;
char ans[] = {'R', 'G', 'B', 'Y'};
char mat[2510][2510];

int main() {
	scanf("%d%d%d", &n, &m, &d);
	if (d & 1) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < m; ++j)
				putchar((i + j) % 2 ? 'R' : 'B');
			puts("");
		}
		return 0;
	}
	else if (d == 2) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < m; ++j) {
				int tt = j / 2 % 2, tB = i % 2;
				if (i % 4 < 2) tt = !tt;
				putchar(ans[tt * 2 + tB]);
			}
			puts("");
		}
		return 0;
	}
	d /= 2;
	for (int i = 502; i < 2008; ++i)
		for (int j = 502; j < 2008; ++j)
			if (i % d == 0 && j % d == 0 && (i % (d * 2) == j % (d * 2))) {
				int ind = (i / d) % 2 * 2 + (j / (d * 2)) % 2;
				if (i / (d * 2) % 2) ind ^= 1;
				for (int k = -d; k < d; ++k) {
					int kkk;
					if (k < 0) kkk = d - (-k - 1);
					else kkk = d - k;
					//++kkk;
					for (int l = -kkk; l < kkk; ++l) {
						mat[i + k][j + l] = ans[ind];
					}
				}
			}
	for (int i = 1004; i < 1004 + n; ++i) {
		for (int j = 1004; j < 1004 + m; ++j)
			putchar(mat[i][j]);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 6580
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int solve(int);
int n, h[100002], f[100002] = {-1};
int main()
{
    cin >> n;
    for(int i = 0; i <= n; i++) f[i] = -1;
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    cout << solve(n) << endl;
    // system("pause");
    return 0;
}
int solve(int i)
{
    if(f[i] > -1)   return f[i];
    else if(i == 1){
        f[i] = 0;
        return 0;
    }
    else if(i == 2){
        f[i] = abs(h[i] - h[i-1]);
        return f[i];
    }
    else{
        f[i] = min(solve(i-1)+abs(h[i]-h[i-1]), solve(i-2)+abs(h[i]-h[i-2]));
        return f[i];
    }
}

Measured memory_bytes: 2560
N, M, X = map(int, input().split())
Xlist = []
ans = -1
for i in range(N):
    Nlist = list(map(int, input().split()))
    for j in range(len(Xlist)):
        sumList = [x + y for (x, y) in zip(Nlist, Xlist[j])]
        Xlist.append(sumList)
        if min(sumList[1:]) >= X:
            if ans == -1:
                ans = sumList[0]
            elif ans > sumList[0]:
                ans = sumList[0]
    Xlist.append(Nlist)
    if min(Nlist[1:]) >= X:
        if ans == -1:
            ans = Nlist[0]
        elif ans > Nlist[0]:
            ans = Nlist[0]

print(ans)


Measured memory_bytes: 11484
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vl v(n),s(n),ans;
	rep(i,n)cin>>v[i];
	rrep(i,n){
		bool sub=false;
		int itr=i+i+1;
		while(itr<n){
			if(s[itr]>0)sub=!sub;
			itr+=i+1;
		}
		if((!sub&&v[i]==1)||(sub&&v[i]==0)){
			s[i]=1;ans.push_back(i+1);
		}
	}
	cout<<ans.size()<<endl;
	reverse(all(ans));
	cout<<ans<<endl;
}


Measured memory_bytes: 6004
#include <iostream>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    int A[N+1];
    for (int i = 1; i <= N; i++)
        cin >> A[i];
    
    for (int i = K+1; i <= N; i++) {
        if (A[i] > A[i-K])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589
int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int func(char a,char b,char c,int z[],string s,int n){
    int ans=0;
    for(int i=0;i<n;i++)
        if(s[i]==a)
            for(int j=i+1;j<n-1;j++)
                if(s[j]==b)
                    if(2*j-i<n && s[2*j-i]==c)
                        ans+=z[j+1]-1;
                    else
                        ans+=z[j+1];
    return ans;
}
int32_t main(){
    fast;
    int n;
    string s;
    cin>>n>>s;
    // cout<<"n";
    int r[n],g[n],b[n];
    r[n-1]=(s[n-1]=='R');
    g[n-1]=(s[n-1]=='G');
    b[n-1]=(s[n-1]=='B');
    for(int i=n-2;i>=0;i--){
        r[i]=r[i+1]+(s[i]=='R');
        g[i]=g[i+1]+(s[i]=='G');
        b[i]=b[i+1]+(s[i]=='B');
    }
    int ans=0;
    ans+=func('R','G','B',b,s,n);
    // cout<<ans<<endl;
    ans+=func('R','B','G',g,s,n);
    // cout<<ans<<endl;
    ans+=func('G','R','B',b,s,n);
    // cout<<ans<<endl;
    ans+=func('G','B','R',r,s,n);
    // cout<<ans<<endl;
    ans+=func('B','G','R',r,s,n);
    // cout<<ans<<endl;
    ans+=func('B','R','G',g,s,n);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3752
n, a, b, c, d = map(int, input().split())
s = input()

if c < d:
    print("Yes" if s[a - 1:d].count("##") == 0 else "No")
    #aからd-1までで二個あるとあうと
else:
    print("Yes" if s[a - 1:c].count("##") ==
          0 and s[b - 2:d + 1].count("...") > 0 else "No")
          #b-1からd+1までで飛び越すの




Measured memory_bytes: 40560
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
using namespace boost::multiprecision;  
using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    int n;
    cin >> n;
    umap<int,bool> mp;
    rep(i,n){
        int a;
        cin >> a;
        if(!mp[a]) mp[a] = true;
        else return cout << "NO\n",0;
    }
    cout << "YES\n";

    return 0;
}


Measured memory_bytes: 8520
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc  = new Scanner(System.in);
      int n = sc.nextInt();
      int[] l = new int[n];
      int[] r = new int[n];
      int sum = 0;
      for(int i = 0;i < n;i++){
      	l[i] = sc.nextInt();
        r[i] = sc.nextInt();
		sum += r[i]-l[i]+1;
      }
      System.out.println(sum);
    }
}


Measured memory_bytes: 24400
import java.util.*;

/**
 * Main
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int kaihuku = 0;
		int amount = 0;
		Integer Array[] = new Integer[N];
		for(int i = 0; i < N; i++){
			Array[i] = sc.nextInt();
		}
		for(int i = 1; i < N; i++){
			for(int j = 0; j < i; j ++){
				kaihuku = Array[i]*Array[j];
				amount += kaihuku;
			}
		}

		System.out.println(amount);

		sc.close();
	}
};


Measured memory_bytes: 23252
#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() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = n / (a + b) * a + min(n % (a + b), a);
  cout << ans << endl;
  return 0;
}

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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
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();}


int main(){
  int H,W,n;
  cin >> H >> W >> n;
  VI a(n);
  int board[H][W];
  rep(i,n) cin >> a[i];
  int index = 0;
  rep(i,H){
    if(i%2 == 0){
      rep(j,W){
        board[i][j] = index+1;
        a[index]--;
        if(a[index] == 0) index++;
      }
    }else{
      for(int j = W-1; j >= 0; j--){
        board[i][j] = index+1;
        a[index]--;
        if(a[index] == 0) index++;
      }
    }

  }

  rep(i,H){
    rep(j,W){
      cout << board[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384
package main

import "fmt"

func main() {
  var n int
  fmt.Scan(&n)
  arr := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&arr[i])
  }
  oddCnt := 0
  for _, num := range arr {
    if (num % 2 == 1) {
      oddCnt++
    }
  }
  result := "NO"
  if (oddCnt % 2 == 0) {
    result = "YES"
  }
  fmt.Println(result)
}

Measured memory_bytes: 6912
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

int main() {
    string A, B;

    cin >> A >> B;

    if (A.size() > B.size()) {
        cout << "GREATER" << endl;
    } else if (A.size() < B.size()) {
        cout << "LESS" << endl;
    } else {
        for (int i = 0; i < A.size(); i++) {
            if (A[i] > B[i]) {
                cout << "GREATER" << endl;
                return 0;
            } else if (A[i] < B[i]) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }

    return 0;
}




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

int main(){
  string s, t;
  cin >> s >> t;
  
  bool f = true;
  for(int i = 0; i < s.size(); i++){
    if(s[i] != t[i]){f = false;}
  }
  
  if(f){cout << "Yes" << endl;}
  else{cout << "No" << endl;}
}

Measured memory_bytes: 3628
class SegmentTree:
    def __init__(self, lst, op, e):
        self.n = len(lst)
        self.N = 1 << ((self.n - 1).bit_length())
        self.op = op # operation
        self.e = e # identity element
        self.v = self._build(lst) # self.v is set to be 1-indexed for simplicity
        
    def _build(self, lst):
        # construction of a tree
        # total 2 * self.N elements (tree[0] is not used)
        tree = [self.e] * (self.N) + lst + [self.e] * (self.N - self.n)
        for i in range(self.N - 1, 0, -1): tree[i] = self.op(tree[i << 1], tree[(i << 1)|1])
        return tree
    
    def __getitem__(self, i):
        return self.v[i + self.N]
    
    # update a_i to be x 
    def update(self, i, x):
        i += self.N
        self.v[i] = x
        while i > 0:
            i >>= 1 # move to parent
            self.v[i] = self.op(self.v[i << 1], self.v[(i << 1)|1])
    
    # returns answer for the query interval [l, r)
    def fold(self, l, r):
        left = l + self.N; right = r + self.N
        L = self.e; R = self.e
        while left < right:
            if left & 1: # self.v[left] is the right child
                L = self.op(L, self.v[left])
                left += 1
            if right & 1: # self.v[right-1] is the left child
                right -= 1
                R = self.op(self.v[right], R)
            left >>= 1; right >>= 1
        return self.op(L, R)
    
N, Q = map(int, input().split())
op = min
e = 2**31 - 1
A = [e] * N
sg = SegmentTree(A, op, e)
for _ in range(Q):
    t, *arg, = map(int, input().split())
    if t == 0: sg.update(arg[0], arg[1])
    else: print(sg.fold(arg[0], arg[1]+1))


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

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    if(A == B && A != C) {
        cout << "Yes" <<endl;
    }
    else if(A == C && A != B) {
        cout << "Yes" <<endl;
    }
    else if(B == C && A != B) {
        cout << "Yes" <<endl;
    }
    else cout << "No" <<endl;
}

Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define pb(n) push_back(n)
#define endl '\n'
#define debug(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(int ii = 0; ii < (V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define OUT2(n1,n2) cout << n1 << " " << n2 << endl
#define OUT3(n1,n2,n3) cout << n1 << " " << n2 << " " << n3 << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
ll n, m, k, ans, sum, cnt = 0; string s; char c; bool flg;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  ll d;
  IN2(n,d);
  vvi x(n, vi(d));
  FOR(i,0,n) VIN(x[i]);

  FOR(i,0,n) {
    FOR(j,i+1,n) {
      ll sum = 0;
      FOR(k,0,d) sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      FOR(k,0,1000) {
        if (sum == k*k) {
          ans++;
          break;
        }
      }
    }
  }

  OUT(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

ll gcd( ll a, ll b )
{
	if(b==0)
	{
		return a;
	}
	else
	{
		return gcd( b, a%b );
	}
}
ll lcm (ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

ll power(ll a, ll b)	//a is base, b is exponent
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b%2 == 1)
		return (power(a,b-1)*a)%mod;
	ll q = power(a,b/2);
	return (q*q)%mod;
}
ll n;
double dp[4000][4000];
double p[3999];
double solve(ll idx,ll heads)
{
	if(idx==n+1) 
	{
		if(heads*2>=n) return 1.0;
		return 0.0;
	}
	else if(dp[idx][heads] != -1.0) return dp[idx][heads];
	else return dp[idx][heads] = solve(idx+1,heads+1)*p[idx] + solve(idx+1,heads) * (1-p[idx]);
}

int main()
{
	std::ios::sync_with_stdio(false);
//	double n;
	cin >> n;

	//double p[int(n+2)];
	for(int i = 1;i<=n;i++) cin >> p[i];
	for(int i =0;i<4000;i++) for(int j = 0;j<4000;j++) dp[i][j] = -1.0;
	cout << fixed << setprecision(12)<<  solve(1,0) << endl;



	return 0;
}


//Hello, this is a snippet.


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

int main()
{
    int N, M, sum;
    cin >> N;
    int T[N];
    sum=0;
    for(int i=0; i<N; i++){
        cin >> T[i];
        sum+=T[i];
    }
    cin >> M;
    int drink[M][2];
    for(int i=0; i<M; i++){
        cin >> drink[i][0] >> drink[i][1];
        drink[i][0]--;
    }
    
    for(int i=0; i<M; i++){
        cout << sum-T[drink[i][0]]+drink[i][1] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

struct cospa{
	ll yen;
	ll kane;
	int num;
	ll l;
	bool operator<( const cospa& right ) const {
	         return yen == right.yen ? num < right.num : yen < right.yen;
	     } 
};

int main(){
	ll	q,h,s,d,N;
	cin>>q>>h>>s>>d>>N;
	N*=100;
	cospa c[4];
	c[0].yen=8*q;
	c[1].yen=4*h;
	c[2].yen=2*s;
	c[3].yen=1*d;
	c[0].num=1;
	c[1].num=2;
	c[2].num=3;
	c[3].num=4;
	c[0].kane=q;
	c[1].kane=h;
	c[2].kane=s;
	c[3].kane=d;
	c[0].l=25;
	c[1].l=50;
	c[2].l=100;
	c[3].l=200;
	sort(c,c+4);
//	rep(i,4)
	//	cout<<c[i].num<<endl;
	ll ans=0,ans_n=0;
	rep(i,4){
		if(N==0){
			cout<<ans<<endl;
			return 0;
		}
		ans_n=(N/c[i].l);
		N%=c[i].l;
	//	cout<<N<<endl;
		ans+=(ans_n*c[i].kane);
	}
	
/*	double n[4];
	n[0]=25/q;
	n[1]=50/h;
	n[2]=100/s;
	n[3]=200/d;

	sort(n,n+4);
	rep(i,4)
		cout<<n[i]<<endl;
*/
	cout<<"a"<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
  __________    							|										   ___  __
	|       |     						    |											|   /
	|       |     						    |									  		|  /
	|       |                               |                         __                | /      _______
	|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
	| \               | |      | |          |      |          | / | /   |               |\       |
	|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
	|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void solve(){
	int a,b;cin>>a>>b;
	if(a<b){
		fo0(i,b){
			cout<<a;
		}
	}
	else{
		fo0(i,a){
			cout<<b;
		}
	}
}

int32_t main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.txt", "r", stdin);
 //    	freopen("output.txt", "w", stdout);
	// #endif
	fast;int t=1;
	//cin>>t;
	while(t--){
		solve();
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<sstream>
#define FOR(i,a,b) for(int i = (a),i##_end_ = (b);i<=i##_end_;i++)
#define ROF(i,a,b) for(int i = (a),i##_end_ = (b);i>=i##_end_;i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 20000005
#define INF 1000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-8
#define DEBUG_
#ifdef DEBUG_
#define DEBUG(...) fprintf(stderr,__VA_ARGS__)
#else
#define DEBUG(...)
#endif // DEBUG
using namespace std;

vector<int>e[N];
vector<pair<pair<int,int>,int> >query;
int ans[N];
int vis[N][15];
void dfs(int u,int d,int c)
{
    if(d<0)return;
    if(vis[u][d])return;
    vis[u][d] = 1;
    if(ans[u] == 0)ans[u] = c;
    dfs(u,d-1,c);
    for(auto v:e[u])dfs(v,d-1,c);
}
int main()
{
    int n,m;
    while(cin>>n>>m)
    {
        FOR(i,1,n)e[i].clear();
        FOR(i,1,m)
        {
            int x,y;
            cin>>x>>y;
            e[x].PB(y);
            e[y].PB(x);
        }
        int q;
        cin>>q;
        query.clear();
        FOR(i,1,q)
        {
            int x,y,z;
            cin>>x>>y>>z;
            query.PB(MP(MP(x,y),z));
        }
        MST(ans,0);
        MST(vis,0);
        ROF(i,q-1,0)
        {
            dfs(query[i].FT.FT,query[i].FT.SD,query[i].SD);
        }
        FOR(i,1,n)cout<<ans[i]<<endl;
    }
    return 0;
}


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

int main() {
    string W;
    cin >>W;
    for (int i=0; i<W.size(); i++)
        W.at(i)=tolower(W.at(i));
    int S=0;
    while(true) {
        string T;
        cin >>T;
        if ("END_OF_TEXT"==T)
            break;
        for (int i=0; i<T.size(); i++)
            T.at(i)=tolower(T.at(i));
        if (T==W)
            S++;
    }
    cout <<S <<endl;
    return 0;
}


Measured memory_bytes: 3212
import sys
#import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
#import math
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

n = ri()  
ans=0    
for i in range(1,n+1):
    ans+=(n//i)*(n//i+1)*i//2
print(ans)

Measured memory_bytes: 63756
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
ll fact[100005];
ll invfact[100005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll n,k,i;
    fact[0]=1;
    fact[1]=1;
    for(i=2;i<100005;i++)
        fact[i]=(i*fact[i-1])%hell;
    for(i=0;i<100005;i++)
        invfact[i]=power(fact[i],hell-2,hell);
    cin>>n>>k;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    for(i=(k-1);i<n;i++)
    {
        ll x=(a[i]*fact[i])%hell;
        x=(x*invfact[k-1])%hell;
        x=(x*invfact[i-k+1])%hell;
        //trace(sum);
        sum=(sum+x)%hell;
    }
    //trace(sum);
    for(i=0;i<=(n-k);i++)
    {
        ll x=(a[i]*fact[n-i-1])%hell;
        x=(x*invfact[k-1])%hell;
        x=(x*invfact[n-i-k])%hell;
        sum=(sum-x+hell)%hell;
    }
    cout<<sum;
    return 0;
}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;



int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	int a,b,c;
	cin >> a >>b >>c;
	if(c >=a && c <=b) cout <<  "Yes" << endl;
	else cout << "No" <<endl;
	return 0;
}



Measured memory_bytes: 256
/**
*    created: 27.06.2020 18:31:13
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}

signed main() {

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

    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <sstream>
#include <cassert>
#include <queue>
#include <bitset>
#include <ctime>
using namespace std;
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define db(v) cerr << #v << " = " << v << endl
#define pb push_back
#define sz(x) ((int)x.size())
#define fst first
#define snd second
typedef long long ll;
typedef pair<int, int> ii;
const int MAXN = 105;

int n, a, b, A, B, C;
int P[MAXN];

int main(){
	while(scanf("%d %d %d", &n, &a, &b)>=1){
		A = B = C = 0;
		forn(i, n){
			scanf("%d", &P[i]);
			if(P[i] <= a) A++;
			else if(P[i] <= b) B++;
			else C++;
		}
		printf("%d\n", min(A, min(B, C)));
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<assert.h>
#define i64  long long
#define vi32 vector<int>
#define vi64 vector< long long>
#define  ii pair<int,int>
const  long long mod = 1e9 + 7, inf = 1e9, linf = 1 << 30;//linf = 9223372036854775807;
const long long hashmod[4] = { (int)1e9 + 2277, (int)1e9 + 5277, (int)1e9 + 8277, (int)1e9 + 9277 };
const long double EPS = 0.000000001L, pi = acos(-1);
using namespace std;
#define pb push_back
#define mp make_pair
#define N 100006
//i64 base = 311;
int dx[] = { 0,-1,-1,-1,0,1,1,1 };
int dy[] = { -1,-1,0,1,1,1,0,-1 };
// God of debug OPP
#define debugg assert
using namespace std;

int main()
{
	int n; cin >> n;
	vi32 f(n);
	for (auto& z : f)cin >> z;
	int cnt = 0;
	for (int i = 1; i <= n; i++)if (f[i - 1] != i)cnt++;
	(cnt <= 2) ? puts("YES") : puts("NO");
}


Measured memory_bytes: 256