akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    ll N, M; cin >> N >> M;
    vector<ll> s(M), c(M);
    rep(i, M){
        cin >> s[i] >>c[i];
    }

    // variable
    ll ans = -1;
    // solve
    rep(i, 1000){
        ll nowketa = 1;
        if(i >= 10)nowketa = 2;
        if(i >= 100)nowketa = 3;
        if(nowketa != N) continue;
        bool ok = true;
        rep(j, M){
            if(nowketa < s[j]){
                //print(i);
                ok = false;
                break;
            }
            string num = to_string(i);
            if(num[(s[j]-1)] - '0'!= c[j]){
                ok = false;
                break;
            }
            //print(i);
        }
        if(ok) ans = i;
        if(ans !=-1)break;
    }

    print(ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
        int n,i,j;
        cin >> n;
        int a[n];
        int b[n];
        for (i=0;i<n;i++){
                cin >> a[i];
        }
        for (i=0;i<n;i++){
                b[a[i]-1]=i;
        }
        for (i=0;i<n;i++){
                cout << b[i]+1 << " ";
        }
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;
 
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
 
 
 
//DONT WASTE YOUR TIME......i said don't waste -_- 
//prove yourself remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake
 
//capture it
 
// fortunately or unfortunately tu sabse badaah chodu h ....ek number ka chutiyaa -_-
 
const ll N= 1e2+55,mod = 1e9+7;
 
string s[N];
int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	string x,y;
	ll i,j,k,a,b,c,z,aa,bb;
	cin>>aa>>bb;
	x=y="";
	for(i=1;i<=100;i++){
		x+='.';
		y+='#';
	}
	aa--;bb--;
	for(k=1;k<100;k++){
		a=aa;b=bb;
		for(i=1;i<=100;i++){
			if(i<=k)s[i]=y;
			else s[i]=x;
		}
		for(i=2;i<k;i++){
			for(j=1;j<99;j++){
				if(a<=0)break;
				if(s[i-1][j-1]=='#' && s[i+1][j+1]=='#' && s[i-1][j+1]== '#' && s[i+1][j-1]=='#' && s[i][j-1]=='#' && s[i][j+1]=='#' && s[i-1][j]=='#' && s[i+1][j]=='#' && s[i][j]=='#'){
					a--;
					s[i][j]='.';
				}
			}
			if(a<=0)break;
		}
		for(i=k+1;i<99;i++){
			for(j=1;j<99;j++){
				if(b<=0)break;
				if(s[i-1][j-1]=='.' && s[i+1][j+1]=='.' && s[i-1][j+1]== '.' && s[i+1][j-1]=='.' && s[i][j-1]=='.' && s[i][j+1]=='.' && s[i-1][j]=='.' && s[i+1][j]=='.' && s[i][j]=='.'){
					s[i][j]='#';
					b--;
				}
			}
			if(b<=0)break;
		}
		if(a<=0 && b<=0){
			cout<<"100 100\n";
			for(i=1;i<=100;i++)cout<<s[i]<<"\n";
			return 0;
		}
	}
}

Measured memory_bytes: 256
//It is made by M_sea
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
typedef long long ll;
using namespace std;

inline void chkmin(int& x,int y) { if (y<x) x=y; }
inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=400000+10;

int n,m,Q;
int f[N],fa[N];

inline int find(int x) { return x==fa[x]?x:fa[x]=find(fa[x]); }
inline void merge(int x,int y) {
    x=find(x),y=find(y);
    if (x!=y) fa[x]=y;
}

struct Edge { int u,v,w; } e[N];
bool operator <(Edge a,Edge b) { return a.w<b.w; }

int main() {
    n=read(),Q=read();
    memset(f,0x3f,sizeof(f));
    for (re int i=1;i<=Q;++i) {
        int a=read()+1,b=read()+1,c=read();
        chkmin(f[a%n+1],c+1),chkmin(f[b%n+1],c+2);
        e[++m]=(Edge){a,b,c};
    }
    int pos=1;
    for (re int i=2;i<=n;++i) if (f[i]<f[pos]) pos=i;
    for (re int i=pos%n+1,j=pos;i!=pos;j=i,i=i%n+1) chkmin(f[i],f[j]+2);
    for (re int i=1;i<n;++i) e[++m]=(Edge){i,i+1,f[i+1]};
    e[++m]=(Edge){n,1,f[1]};
    sort(e+1,e+m+1);
    for (re int i=1;i<=n;++i) fa[i]=i;
    int tot=0; ll ans=0;
    for (re int i=1;i<=m;++i) {
        int u=e[i].u,v=e[i].v,w=e[i].w;
        if (find(u)==find(v)) continue;
        ++tot,ans+=w,merge(u,v);
        if (tot==n-1) break;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {
  int n,f;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  vector<pair<int, int>> a(n);
  rep(i,n) {
    cin >> f;
    a[i] = make_pair(f,i);
  }
  sort(a.begin(), a.end());
  rep(i,n) {
    if(i != a[n-1].second) {
      cout << a[n-1].first << endl;
    } else {
      cout << a[n-2].first << endl;
    }
  }
}

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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;
vector<int> T,X,Y;

int main()
{
	scanf("%d",&N);
	T.assign(N,0);
	X.assign(N,0);
	Y.assign(N,0);
	FOR(i,0,N){
		scanf("%d%d%d",&T [i],&X [i],&Y [i]);
	}
	T.insert(T.begin(),0);
	X.insert(X.begin(),0);
	Y.insert(Y.begin(),0);

	bool ans = true;
	FOR(i,0,N){
		ans &= T [i + 1] - T [i] >= abs(X [i + 1] - X [i]) + abs(Y [i + 1] - Y [i]);
		ans &= (abs(X [i + 1] - X [i]) + abs(Y [i + 1] - Y [i]) - (T [i + 1] - T [i])) % 2 == 0;
	}
	puts(ans ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<cmath>
#include<iomanip>
using namespace std;
struct Point{
	double x;
	double y;
};

void kock(int n,Point left,Point right){
	if(n==0) return;
	double PI=atan(1)*4;
	Point s={(2*left.x+right.x)/3,(2*left.y+right.y)/3};
	Point t={(left.x+2*right.x)/3,(left.y+2*right.y)/3};
	Point u={(t.x-s.x)*cos(PI/3)-(t.y-s.y)*sin(PI/3)+s.x,(t.x-s.x)*sin(PI/3)+(t.y-s.y)*cos(PI/3)+s.y};
	kock(n-1,left,s);
	cout<<fixed<<setprecision(5)<<s.x<<' '<<s.y<<'\n';
	kock(n-1,s,u);
	cout<<fixed<<setprecision(5)<<u.x<<' '<<u.y<<'\n';
	kock(n-1,u,t);
	cout<<fixed<<setprecision(5)<<t.x<<' '<<t.y<<'\n';
	kock(n-1,t,right);
}

int main(){
	int n;
	cin>>n;
	Point left={0,0},right={100,0};
	cout<<fixed<<setprecision(5)<<left.x<<' '<<left.y<<'\n';
	kock(n,left,right);
	cout<<fixed<<setprecision(5)<<right.x<<' '<<right.y<<'\n';
	return 0;
}


Measured memory_bytes: 3248
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const int INF=10010010;
const double PI=3.141592653589;
const ll M=1000000007;

vector<ll> fac(1000001); //n!(mod main)
vector<ll> ifac(1000001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x,ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
  ll ans=1;
  while(n!=0){
    if(n&1) ans=ans*x%M;
    x=x*x%M;
    n=n>>1;
  }
  return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
  if(a==0&&b==0)return 1;
  if(a<b||a <0)return 0;
  ll tmp=ifac[a-b]*ifac[b]%M;
  return tmp*fac[a]%M;
}

void set_comb(){
  fac[0]=1;
  ifac[0]=1;
  for(ll i=0;i<1000001;i++){
    fac[i+1]=fac[i]*(i+1)%M; // n!(mod M)
    ifac[i+1]=ifac[i]*mpow(i+1,M-2)%M; // k!^{M-2} (mod M) ←累乗にmpowを採用
  }
}


int main(){
  int X,Y; cin>>X>>Y;
  ll x=(2*X-Y)/3;
  ll y=(2*Y-X)/3;
  // cout<<x<<" "<<y<<endl;
  ll ans=1;
  if(x<0||y<0||(2*X-Y)%3!=0||(2*Y-X)%3!=0){
    ans=0;
    // cout<<"ko"<<endl;
  }
  else{
    set_comb();
    ans=comb(x+y,y);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
class Seg_Tree{
public:
	vector<double> dat;
	int n;
	void initsize(int n0){
		int k=1;
		while(1){
			if(n0<=k){
				n=k;
				dat.resize(2*n-1);
				for(int i=0;i<2*n-1;i++)dat[i]=1.0;
				break;
			}
			k*=2;
		}
	}
	//i banme wo x nisuru
	void update(int i,double x){
		i += n-1;
		dat[i] = x;
		while(i>0){
			i = (i-1) / 2;
			dat[i] = dat[i*2+1]*dat[i*2+2];
		}
	}
	//[a,b)
	double query0(int a,int b,int k,int l,int r){
		if(r<=a || b<=l)return 1.0;
		if(a<=l && r<=b)return dat[k];
		else{
			double vl = query0(a,b,k*2+1,l,(l+r)/2);
			double vr = query0(a,b,k*2+2,(l+r)/2,r);
			return vl*vr;
		}
	}
	//return min [a,b)
	double query(int a,int b){
		return query0(a,b,0,0,n);
	}
};

int main(){
	int N,Q;
	cin >> N;
	vector<int> T(N+1,1000000009),A(N);
	FOR(i,0,N) cin >> T[i] >> A[i];
	Seg_Tree sg;
	sg.initsize(N);
	FOR(i,0,N){
		sg.update(i,(double)(10.0-A[i])/10.0);
	}
	cin >> Q;
	FOR(i,0,Q){
		int L,R;
		cin >> L >> R;
		int il,ir;
		il = POSL(T,L);
		ir = POSU(T,R);
		double x = 1000000000LL*sg.query(il,ir);
		out(10) << x << endl;
	}
}



Measured memory_bytes: 5716
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

ostream& operator<<(ostream& stream, const mint& n){
  stream << n.x;
  return stream;
};

struct comb{
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  ll n, k;
  cin >> n >> k;
  comb c(n);
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  sort(ALLr(a));
  mint ans = 0;
  REP(i, n){
    ll j = i+1;
    ans += (c(n-j, k-1) - c(j-1, k-1))*a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[3];
		
        a[0] = sc.nextInt();
        a[1] = sc.nextInt();
        a[2] = sc.nextInt();
        int N = sc.nextInt();
       
        sc.close();
        
        int temp [] = new int [10];
        sort3(a, temp);
        
       
        int remainder = N-(N/a[2])*a[2];
        int count = 0;
        
        if (N>=a[0]){
        	int remainder2 = 0;
        	
        	for (int i = 0; i<N/a[2]+1; i++){
        		remainder2 = remainder-(remainder/a[1])*a[1];
        		for (int j = 0; j<remainder/a[1]+1; j++){
        			if (remainder2%a[0]==0)
            			count++;
        			remainder2+=a[1];
        		}
        		remainder = remainder+a[2];
        	}
        	System.out.println(count);
        }
        else
        	System.out.println(0);
        
   
	}
	
	static void sort3(int arr[], int temp[]) { 
	
	    if (arr[1] < arr[0]) 
	        { 
	            temp[0] = arr[0]; 
	            arr[0] = arr[1]; 
	            arr[1] = temp[0]; 
	        } 
	  
	    if (arr[2] < arr[1]) 
	    { 
	            temp[0] = arr[1]; 
	            arr[1] = arr[2]; 
	            arr[2] = temp[0]; 
	              
	    if (arr[1] < arr[0]) 
	        { 
	            temp[0] = arr[0]; 
	            arr[0] = arr[1]; 
	            arr[1] = temp[0]; 
	        } 
	    } 
	} 
 
}

Measured memory_bytes: 21972
#include<stdio.h>
 
#define MAX 1000
#define MAXWEIGHTIJ 20000
 
struct MCS {
    int cost;
    int order;
};
 
void exchange( struct MCS *pa, struct MCS *pb )
{
    struct MCS t;
      
    t=*pa;
    *pa=*pb;
    *pb=t;
      
     return;
}
  
int Partition( struct MCS A[], int p, int r )
{
    struct MCS x;
    int i,j;
  
    x=A[r];
    i=p-1;
    for( j=p; j<r; j++ ) {
        if( A[j].cost < x.cost ) {
            i++;
            exchange( &A[i], &A[j] );
         }
    }
    exchange( &A[i+1], &A[r] );
 
    return i+1;
}
void QuickSort( struct MCS A[], int p, int r )
{
    int q;
      
    if( p < r ) {
        q=Partition( A, p, r );
        QuickSort( A, p, q-1 );
        QuickSort( A, q+1, r );
    }
    return;
}
 
int tryChange( int n, struct MCS W[] )
{
    int cnt;
    int fixedcost,profit;
    int from, to, togoal;
     
    int cost,lowestCost;
    int i,j;
    int lowW,lowestW;
    int low,high,lowest;
 
    lowestW=lowW=lowestCost=cost=MAXWEIGHTIJ;
    lowest=high=low=-1; 
    for( i=0; i<n; i++ ) {
        if( i != W[i].order && W[i].cost < lowW ) {
            lowW=W[i].cost;
            low=i;
            for( j=0; j<n; j++ ) {
                if( low == W[j].order ) {
                    high=j;
                    break;
                }
            }
        }
        if( W[i].cost < lowestW ) {
            lowestW=W[i].cost;
            lowest=i;   
        }       
    }
 
    if( W[high].order == low && W[low].order == high ) { 
        lowestCost = W[low].cost + W[high].cost;
    } else if( low != lowest ) {    
        fixedcost = W[low].cost + W[lowest].cost;
        profit = W[low].cost - W[lowest].cost;
        from=high;
        to=low;
        togoal = W[low].order;
        cnt=0;
        while( 1 ) {
            if( W[from].order == to ) {
                if( togoal == to ) { break; }
                to=from;
                cnt++;
            } else {
                break;
            }
            for( i=0; i<n; i++ ) {
                if( i != W[i].order ) {
                    if( to == W[i].order ) {
                        from=i;
                        break;
                    }
                }
            }
        }
        profit = ( profit * cnt ) - ( 2 * fixedcost );
        if( 0 < profit ) {
            high=low;
            low=lowest;
            lowestCost = fixedcost;
        }
    }
    if( W[high].order == low ) { 
        lowestCost = W[low].cost + W[high].cost;
    }
 
    if( MAXWEIGHTIJ != lowestCost ) {
        exchange( &W[low], &W[high] );
    } else {
        lowestCost=0;
    }
    return lowestCost;
}
 
int main( void ) 
{   
    int n,i;
    struct MCS W[MAX+1];
    int cost;
         
    scanf( "%d", &n );
    for( i=0; i<n; i++ ) {
        scanf( "%d", &W[i].cost );
        W[i].order=i;
    }
 
    QuickSort( W, 0, n-1 ); 
    cost=i=0;
    while( (i = tryChange( n, W ) ) ) {
        cost+=i;
    }
    printf( "%d\n", cost );
 
    return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) int((x).size())

const int N=1e6+5,M=1e3+7,mod=1e9+7;

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

int a[N],b[N],n,m,k,tc,ans,d,x,y;

char s[N];

int main() {
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if (a+b+c>=22)
        printf("bust\n");
    else
        printf("win\n");
}



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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
const int mod = 1e9+7;
int x[100005], y[100005];
ll dp[100005], cnt[100005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    for(int i=0;i<m;i++){
        cin >> y[i];
    }

    ll X = 0, Y = 0;
    memset(dp, 0, sizeof(dp));
    for(int i=1;i<n;i++){
        int dis = x[i]-x[i-1];
        cnt[i] = cnt[i-1] + 1;
        dp[i] = (dp[i-1] + dis*1ll*cnt[i]);
    }
    for(int i=0;i<n;i++) X = (X + dp[i])%mod;
    
    memset(dp, 0, sizeof(dp));
    for(int i=1;i<m;i++){
        int dis = y[i]-y[i-1];
        cnt[i] = cnt[i-1] + 1;
        dp[i] = (dp[i-1] + dis*1ll*cnt[i]);
    }
    for(int i=0;i<m;i++) Y = (Y + dp[i])%mod;

    printf("%lld\n", X*1ll*Y%mod);
}

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

//組み合わせ nCr計算関数
vector<vector<uint64_t>> comb(int n, int r) {
  vector<vector<uint64_t>> v(n + 1,vector<uint64_t>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() {
 
  //データ入力
  int64_t n,a,b;
  cin>>n>>a>>b;

  vector<int64_t> v(n);
  for(int i=0;i<n;i++){
    cin>>v.at(i);
  }

  //大きい順にソート
  sort(v.begin(),v.end(),greater<int64_t>());


  //最大の平均値計算：大きい方からa個の平均
  int64_t sum=0;
  for(int i=0;i<a;i++){
    sum+=v.at(i);
  }
  //平均値出力
  cout<< fixed << setprecision(6) <<(double)sum/(double)a<<endl;


  //大きい方からa番目と同じ値の個数を調べる。a個以外で
  int64_t cnt1=0;
  for(int i=a;i<n;i++){
    if(v.at(a-1)==v.at(i))
      cnt1++;
  }

  //大きい方からa番目と同じ値の個数を調べる。a個の中で
  int64_t cnt2=0;
  for(int i=a-1;i>=0;i--){
    if(v.at(a-1)==v.at(i))
      cnt2++;
  }


    if(cnt2==a){//同じ値cnt2+cnt1個の中からa個～min(b,cnt2+cnt1)個を選ぶ組み合わせ
      int64_t sum_all=0;
      for(int i=a;i<=min(b,cnt2+cnt1);i++){
        vector<vector<uint64_t>> out(n+1, vector<uint64_t>(n+1, 0));
        out=comb(cnt2+cnt1,i);
        sum_all+=out.at(cnt2+cnt1).at(i);
      }
      cout<<sum_all<<endl;
    }else{//同じ値cnt1+cnt2個の中から,cnt2個を選ぶ
      vector<vector<uint64_t>> out(n+1, vector<uint64_t>(n+1, 0));
      out=comb(cnt1+cnt2,cnt2);
      cout<<out.at(cnt1+cnt2).at(cnt2)<<endl;
    }

	return 0;
}



Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    int ary[n];
    rep(i, n) cin >> ary[i];

    ary[0] -= 1;
    bool flag = true;

    REP(i,1,n)
    {
        if (ary[i-1] < ary[i])
        {
            ary[i] -= 1;
        }
        else if (ary[i-1] == ary[i])
        {
            // pass
        }
        else
        {
            flag = false;
            break;
        }
    }
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  if (n % 1000 == 0)
    cout << 0 << endl;
  else
    cout << 1000 - (n % 1000) << endl;
}


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

#define ll long long

typedef pair< int, int > ii;
typedef vector< ii > vii;

void solve(){
	int a, b; cin>>a>>b;
	int c = b;
	while(c){
		a *= 10;
		c /= 10;
	}
	a += b;
	for(int i = 0; i<1201; i++){
		if(i * i == a){
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}



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

vector<int> mp[MAXN];
bool is_cut[MAXN];
int n, m, cnt = 0;
int low[MAXN], dfn[MAXN], pre[MAXN];//pre[u]记录u的父亲节点编号
//dfn[u]记录节点u在DFS过程中被遍历到的次序号，low[u]记录节点u或u的子树通过非父子边追溯到最早的祖先节点（即DFS次序号最小

void tarjan(int u, int fu){
    pre[u]=fu;//记录当前u的父亲节点
    dfn[u]=low[u]=cnt++;
    for(int i=0; i<mp[u].size(); i++){
        int v=mp[u][i];
        if(dfn[v]==-1){
            tarjan(v, u);
            low[u]=min(low[u], low[v]);
        }else if(fu!=v){//如果v是u的父亲的话，即有重边，那么不可能是桥
            low[u]=min(low[u], dfn[v]);
        }
    }
}

void solve(void){
    int rootson=0;
    tarjan(1, 0);
    for(int i=2; i<=n; i++){
        int v=pre[i];
        if(v==1){
            rootson++;//统计根节点的子树个数，若其不小于2,即为割点
        }else if(low[i]>=dfn[v]){
            is_cut[v]=true;
        }
    }
    if(rootson>1) is_cut[1]=true;
    /*puts("割点为：");
    for(int i=1; i<=n; i++){//输出割点
        if(is_cut[i]){
            printf("%d ", i);
        }
    }*/
    //puts("\n桥为：");
    int ans = 0;
    for(int i=1; i<=n; i++){
        int v=pre[i];
        if(v>0&&low[i]>dfn[v]){
            //printf("%d %d\n", v, i);
            ans++;
        }
    }
    printf("%d\n", ans);
    //puts("");
}

int main(){
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++){
        int x, y;
        scanf("%d%d", &x, &y);
        mp[x].push_back(y);
        mp[y].push_back(x);
    }
    memset(dfn, -1, sizeof(dfn));
    memset(low, -1, sizeof(low));
    solve();
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>

// 配列出力関数
void OutputArray(int A[], int N)
{
    for (int x=0; x<N-1; x++) {
        // 改行切りで出力
        std::cout << A[x] << std::endl;
    }
    std::cout << A[N-1] << std::endl;
}

// 配列出力関数
void OutputArray2(int A[], int N)
{
    for (int x=N-1; x>0; x--) {
        // 改行切りで出力
        std::cout << A[x] <<" ";
    }
    std::cout << A[0] << std::endl;
}

// 挿入ソート実行関数
int InsertionSort(int A[], int N, int g)
{
    int i = 0, cnt =0;
    for (int i=g; i<N; i++) {
        //cnt = 0;
        int v = A[i];
        int j = i-g;
        while(j>=0 && A[j] > v) {
            A[j+g] = A[j];
            j = j-g;
            cnt++;
        }
        A[j+g] = v;
    }
    return cnt;
}

void ShellSort(int A[], int N)
{
    int m = 0, i =  0, cnt = 0;
    int G[N];
    G[0] = 1;

    while (G[i]<=N)
    {
        i++;
        G[i] = G[i-1]*3 + 1;
    }

    for (int k = i-1; k >= 0; k--)
    {
        cnt += InsertionSort(A, N, G[k]);
    }
    std::cout<< i <<std::endl;
    OutputArray2(G, i);
    std::cout<< cnt <<std::endl;
    OutputArray(A, N);
}

int main()
{
    static const int MAX = 1000000;
    int n, R[MAX];
    std::cin >> n;
    for (int i=0; i<n; i++) std::cin >> R[i];

    ShellSort(R, n);
    return 0;
}


Measured memory_bytes: 6996
n = int(input())
mod = 10**9 + 7
a = 10**n % mod
b = 9**n % mod
c = 8**n % mod
ans = a + c - 2*b
if ans >= 0:
    ans = ans % mod
else:
    ans += 2*mod
    ans = ans % mod
    
print(ans)

Measured memory_bytes: 10684
#include <stdio.h>
int main(void)
{
	int a, op, b;
	while(scanf("%d %c %d", &a, &op, &b))
	{
		if(op == '?')
		{
			break;
		}
		switch(op)
		{
			case '+':
			printf("%d\n",a + b);
			break;
			case '-':
			printf("%d\n",a - b);
			break;
			case '*':
			printf("%d\n",a * b);
			break;
			case '/':
			printf("%d\n",a / b);
			break;
		}
	}
}


Measured memory_bytes: 2696
#pragma GCC optimize(3)
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
long long a,b,sq,ssize,ans;
vector<long long>ddiv;
set<long long>s;
inline bool isPrime(long long n){
    if(n<=1)return 0;
    if(n==2||n==3)return 1;
    if(n%6!=5&&n%6!=1)return 0;
  sq=(int)sqrt(n);
    for(register int i=5;i<=sq;i++)if(n%i==0||n%(i+2)==0)return 0;
    return 1;
}
int main(){
	scanf("%lld%lld",&a,&b);
	sq=(int)sqrt(a);
	for(register int i=1;i<=sq;i++){
		if(!(a%i)){
			s.insert(i);
			s.insert(a/i);
		}
	}
	sq=(int)sqrt(b);
	for(register int i=1;i<=sq;i++){
		if(!(b%i)){
			if(s.find(i)!=s.end())ddiv.push_back(i);
			if(s.find(b/i)!=s.end())ddiv.push_back(b/i);
		}
	}
	ssize=ddiv.size();
	for(register int i=0;i<ssize;i++)if(isPrime(ddiv[i]))++ans;
	printf("%lld",ans+1);
}

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

int main()
{
	int x, y; cin >> x >> y;

	if (x == 2 || y == 2) {
		cout << "No" << endl;
		return 0;
	}
	
	vector<int> a(7);
	a = { 1, 3, 5, 7, 8, 10, 12 };

	bool x_in, y_in; x_in = y_in = false;

	for (int i = 0; i < 7; i++) {
		if (x == a[i]) x_in = true;
		if (y == a[i]) y_in = true;
	}

	if (x_in == y_in) cout << "Yes" << endl;
	else cout << "No" << endl;
		
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var r int
	fmt.Scan(&r)
	fmt.Println(3 * r * r)
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type pairs []Pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

// bug bug
// var nextReader func() []byte
//
// func init() {
// 	nextReader = newScanner()
// 	log.SetFlags(log.Lshortfile)
// }
//
// func newScanner() func() []byte {
// 	r := bufio.NewScanner(os.Stdin)
// 	r.Split(bufio.ScanWords)
// 	return func() []byte {
// 		r.Scan()
// 		return r.Bytes()
// 	}
// }
// func nextBytes() []byte {
// 	return nextReader()
// }
//
// func nextString() string {
// 	return string(nextReader())
// }
// func nextInt64() int64 {
// 	v, _ := strconv.ParseInt(string(nextReader()), 10, 64)
// 	return v
// }
// func nextInt() int {
// 	v, _ := strconv.Atoi(string(nextReader()))
// 	return v
// }
// func nextInts(n int) []int {
// 	r := make([]int, n)
// 	for i := 0; i < n; i++ {
// 		r[i] = nextInt()
// 	}
// 	return r
// }
// func nextFloat64() float64 {
// 	f, _ := strconv.ParseFloat(string(nextReader()), 64)
// 	return f
// }


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


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

  int N;
  cin >> N;
  VVI G(N);
  REP(i,N-1){
	int a, b;
	cin >> a >> b;
	--a;
	--b;
	G[a].PB(b);
	G[b].PB(a);
  }

  queue<PII> q;
  VI col(N);
  col[0] = 1;
  col[N-1] = -1;
  q.push(MP(0,1));
  q.push(MP(N-1,-1));
  while(!q.empty()){
	PII p = q.front(); q.pop();
	for(int to: G[p.FF]){
	  if(col[to]) continue;
	  col[to] = p.SS;
	  q.push(MP(to, p.SS));
	}
  }

  int b = count(ALL(col), 1), w = count(ALL(col), -1);
  cout << (b>w? "Fennec": "Snuke") << endl;

  return 0;
}


Measured memory_bytes: 6272
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
 
template<typename T>
struct BIT {
	int n;
	vector<T>dat;
	BIT(int n = 0) {
		initialize(n);
	}
	void initialize(int temp) {
		n = temp;
		dat.resize(n);
		rep(i, 0, n)dat[i] = 0;
	}
	T sum(int i) {
		T s = 0;
		while (i >= 0) {
			s += dat[i];
			i = (i & (i + 1)) - 1;
		}
		return s;
	}
	T sum_between(int i, int j) {
		if (i > j)return 0;
		return sum(j) - sum(i - 1);
	}
	void plus(int i, T x) {
		while (i < n) {
			dat[i] += x;
			i |= i + 1;
		}
	}
	int lower_bound(T x) {
		if (sum(n - 1) < x)return -1;
		else if (sum(0) >= x)return 0;
		int ng = 0, ok = n - 1;
		while (ok - ng > 1) {
			int mid = (ok + ng) / 2;
			if (sum(mid) >= x)ok = mid;
			else ng = mid;
		}
		return ok;
	}
};
 
ll N, K, P;
vector<int>a;
 
int check(ll mid) {
	vector<ll>sum(N + 1);
	for (int i = 0; i < N; i++)sum[i + 1] = sum[i] + ((a[i] <= mid) ? 1 : -1);
	vector<ll>dic;
	for (int i = 0; i <= N; i++)dic.pb(sum[i]);
	sort(all(dic));
	dic.erase(unique(all(dic)), dic.end());
	int sz = dic.size();
	BIT<ll> bit(sz);
	for (int i = 0; i <= N; i++) {
		int idx = lower_bound(all(dic),sum[i])-dic.begin();
		bit.plus(idx, 1);
	}
	ll temp = 0;
	for (int i = 0; i < N;i++) {
		int idx = lower_bound(all(dic),sum[i]) - dic.begin();
		bit.plus(idx,-1);
		temp += bit.sum_between(idx+1,sz-1);
	}
	return temp >= P;
}
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
 
	cin >> N;
	a.resize(N);
	for (int i = 0; i < N; i++)cin >> a[i];
	K = N * (N + 1LL) / 2LL;
	P = (K / 2LL) + 1LL;
	
	ll ng = 0, ok = 1e9+7;
	while (ok - ng > 1) {
		ll mid = (ng + ok) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	puts(ok);
	return 0;
}

Measured memory_bytes: 3300
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;
#define REP(var, num) for(int var = 0; var < num; var++)
typedef signed long long sll;
typedef unsigned long long ull;

int main() {
    sll n, k;
    cin >> n >> k;

    vector<sll> heights;
    REP(i, n) {
        sll h;
        cin >> h;
        heights.push_back(h);
    }

    sort(heights.begin(), heights.end());

    sll res = numeric_limits<sll>::max();
    REP(i, n) {
        if (i + k > n) {
            break;
        }

        sll diff = heights[i + k - 1] - heights[i];
        res = min(res, diff);
    }

    cout << res << endl;
    return 0;
}

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

int main(){
  int a,b,k;
  cin>>a>>b>>k;
  vector<int> p;
  for(int i=1; i<=min(a,b); i++){
    if(a%i == 0 && b%i == 0) {
      p.push_back(i);
    }
  }
  reverse(p.begin(),p.end());
  cout<<p[k-1];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)1e6+5;
const int M = (int)8e3+5;
const int Q = 102;
const int logN = 19;

void solve() {
    string s,t;
    cin>>s>>t;
    t.ppb();
    if(s==t) cout<<"Yes";
    else cout<<"No";
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(all(a));
    reverse(all(a));
    int sa = 0, sb = 0;
    rep(i, 0, n){
        if(i % 2 == 0) sa += a[i];
        else sb += a[i];
    }
    cout << sa - sb << endl;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 indata PIC X(300).
       01 res PIC X(300).
       01 s PIC X(110).
       01 t PIC X(110).
       PROCEDURE DIVISION.
        ACCEPT indata

        UNSTRING indata DELIMITED BY SPACE INTO s t.
        STRING FUNCTION TRIM(t) DELIMITED BY SIZE
               FUNCTION TRIM(s) DELIMITED BY SIZE
               INTO res
        END-STRING

        DISPLAY FUNCTION TRIM(res)

       STOP RUN.


Measured memory_bytes: 764
S=input()
A=[]
B=[0]*4
for i in range(len(S)):
    A.append(int(S[i]))

122

for i in range(2):
    for j in range(2):
        for k in range(2):
            total=A[0]
            if i==0:
                total+=A[1]
                B[0]='+'
            if i==1:
                total-=A[1]
                B[0] = '-'
            if j==0:
                total+=A[2]
                B[1] = '+'
            if j==1:
                total-=A[2]
                B[1] = '-'
            if k==0:
                total+=A[3]
                B[2] = '+'
            if k==1:
                total-=A[3]
                B[2] = '-'
            if total==7:
                print(S[0]+B[0]+S[1]+B[1]+S[2]+B[2]+S[3]+'=7')
                exit(0)

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

int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);    
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    cout << 48 - n;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;
typedef pair<string, ll> psl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    int k, a, b, a1, b1;

    cin >> k;
    cin >> a >> b;

    a1 = a / k;
    b1 = b / k;

    a1 = a1 * k;
    b1 = b1 * k;

    if((a <= a1 && a1 <= b) || (a <= b1 && b1 <= b)) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            int[] ans = new int[N];
            Map<Integer, Integer> map = new HashMap<>();
            for (int i = 0; i < M; i++) {
                int s = in.nextInt();
                int c = in.nextInt();
                if (map.containsKey(s) && map.get(s) != c) {
                    out.println(-1);
                    return;
                }
                map.put(s, c);
                ans[s - 1] = c;
            }
            if (N > 1 && map.getOrDefault(1, 1) == 0) {
                out.println(-1);
            } else {
                if (N > 1 && ans[0] == 0) ans[0] = 1;
                int a = 0;
                for (int i = 0; i < N; i++) {
                    a = a * 10 + ans[i];
                }
                out.println(a);
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22996
MOD = 10**9 + 7
list_size = 5000

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

f_r_list[-1] = pow(f_list[-1], MOD - 2, MOD)

for i in range(2, list_size + 1):
	f_r_list[-i] = int((f_r_list[-i + 1] * (list_size + 2 - i)) % MOD)

def comb(n, r):
	if n < r:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

n, k = map(int, input().split())
for i in range(1, k+1):
	print((comb(k-1, i-1) * comb(n-k+1, i)) % MOD)

Measured memory_bytes: 3700
#include<iostream>
#include <algorithm>
#include<string>
#include <numeric>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    int k;
    cin>>k;
    if(k%2==0)cout<<(k/2)*(k/2)<<endl;
    else cout<<(k/2+1)*(k/2)<<endl;
    }


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int S,h,m,s;
	scanf("%d" ,&S);
	h = S / 3600;
	m = (S % 3600) / 60;
	s = (S % 3600) % 60;
	printf("%d:%d:%d\n" ,h,m,s);
	
	return 0;
}


Measured memory_bytes: 2084
import sys
import random

def rd():
        return sys.stdin.readline().rstrip()

def rdi():
        return [ int(x) for x in rd().split() ]

N, K = rdi()

#N, K = 5, 2
#N, K = 10, 0
#N, K = 31415, 9265

s = 0
for b in range(K+1, N+1):
        an = 0
        j = N / b
        an = j * (b - K)
        #print b, an
        if N % b > 0:
                x1 = j * b + K
                if K == 0:
                        x1 += 1
                x2 = min(N, (j+1) * b - 1)
                #print b, x1, x2
                if x2 >= x1:
                        an += (x2 - x1 + 1)
        s += an
        #print b, an
print s


Measured memory_bytes: 7404
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <cstring>
#include <stack>
#include <cstdio>
#include <complex>
#include <iomanip>
#include <cctype>
#include <cassert>
#include <numeric>
#include <climits>
#include <deque>
#include <random>
#include <functional>
#include <unordered_map>
#define rep(i,n) for(int i=0;i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define show(x) cout << #x << " = " << x << endl;
int main(){
    int n,z,w;
    cin >> n >> z >> w;
    vector<int>a(n);
    rep(i,n){
        cin >> a[i];
    }
    if(n==1){
        cout << abs(w-a[0]) << endl;
    }else{
        cout << max(abs(a[n-1]-w),abs(a[n-2]-a[n-1])) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

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

    cout << (a + b + c >= 22 ? "bust" : "win");

    return 0;
}


Measured memory_bytes: 256
from itertools import combinations

N = int(input())
L = list(map(int, input().split()))

ans = 0
for i, j, k in combinations(range(N), 3):
    Li, Lj, Lk = sorted([L[i], L[j], L[k]])
    if Li != Lj and Lj != Lk and Lk != Li and Li + Lj > Lk:
        ans += 1

print(ans)


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

int main(){
    string S;
    cin >> S;

    int len = (int)(S.length());
    int num = len / 2;
    int count = 0;

    for (int i=0; i<num; i++){
        if(S[i]!=S[len-1-i]) count++;
    }
    
    cout << count << endl;
}

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



int main() {
    ll n,m,q;
    cin>>n>>m>>q;
    vector<int>v[n+1];
    int ind[n+1];
    memset(ind,0,sizeof(ind));
    for(int i=0;i<m;i++){
        int a,b; cin>>a>>b;
        ind[a]++;
        v[a].push_back(b);
    }
    for(int i=0;i<n+1;i++){
        sort(v[i].begin(),v[i].end());
    }
    for(int i=0;i<q;i++){
        int l,r,c=0; cin>>l>>r;
        for(int i=l;i<=r;i++){
            if(ind[i]){
                int j=upper_bound(v[i].begin(),v[i].end(),r)-v[i].begin();
                c=c+j;
            }
        }
        cout<<c<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 2176