akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
T euler_phi(T n)
{
    T res = n;
    for (T i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            res -= res / i;
            while (n % i == 0)
                n /= i;
        }
    }
    if (n > 1)
        res -= res / n;
    return res;
}

int main()
{
    int N;
    cin >> N;
    cout << euler_phi(N) << endl;
}


Measured memory_bytes: 3088
#include <cstdio>
#include <map>
#include <algorithm>
#include <cstdint>
#include <functional>

int64_t ncr[52][52];

void ncr_init() {
    ncr[0][0] = 1;
    for (int i=0; i<=51; ++i) {
        ncr[i][0] = ncr[i][i] = 1;
        for (int j=1; j<i; ++j)
            ncr[i][j] = ncr[i-1][j-1] + ncr[i-1][j];
    }
}

int main() {
    ncr_init();

    int N, A, B;
    scanf("%d %d %d", &N, &A, &B);

    std::map<int64_t, int, std::greater<int64_t>> v;
    for (int i=0; i<N; ++i) {
        int64_t tmp;
        scanf("%lld", &tmp);
        ++v[tmp];
    }

    {
        int64_t tmp=v.begin()->second;
        if (tmp >= A) {
            printf("%lld\n", v.begin()->first);

            int ub=std::min<int>(tmp, B);
            int64_t res=0;
            for (int i=A; i<=ub; ++i)
                res += ncr[tmp][i];

            return !printf("%lld\n", res);
        }
    }

    int64_t sum=0, num=1;
    int C=A;
    for (auto &p: v) {
        if (p.second >= C) {
            sum += p.first * C;
            num *= ncr[p.second][C];
            break;
        }

        sum += p.first * p.second;
        C -= p.second;
    }

    printf("%.26f\n", 1.0*sum/A);
    printf("%lld\n", num);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
#define int long long

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef cc_hash_table<int, int, hash<int > > ht;
#define TIMES_PER_SEC (CLOCKS_PER_SEC)


double get_absolute_time()
{
	return (double)clock()/TIMES_PER_SEC;
}
double starttime_acrush;
void starttime()
{
	starttime_acrush=get_absolute_time();
}
double gettime()
{
	return get_absolute_time()-starttime_acrush;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define M   1000000007
const int N = 10001;  // limit for array size

int32_t main(){

  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int a  , b ;
  cin >> a >> b ;
  if(a==b){

        cout <<"Yes";
  }
  else{
    cout<<"No";
  }
//  cout << ans ;


}



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

int main() {

int n1,n2,n3;
cin >> n1 >> n2 >> n3;
//int *num=new int[3];

//int num[]={300000,200000,100000,0};
//string *name=new string[N+1];

if((n1<n3 && n3<n2) || (n1>n3 && n3>n2)){

cout << "Yes" << endl;
}else
cout << "No" << endl;


}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <queue>
#include <set>
#include <stdio.h>
#include <climits>
#include <map>
#include <time.h>
#include <random>
//#include "rubo.h"

#define dbl long double
#define pb push_back
#define mp make_pair
#define SQ(x) (x)*(x)
#define ll long long
#define ull unsigned long long
#define vc vector
#define X first
#define Y second
//#define in ll
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(x) x.begin(), x.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt...) (0)
//#define puts(fmt...) (0)

//#include "rubo.h"

using namespace std;

const int N = 33;


int main() {
	int n, m;
	cin >> n;
	map<int, int> have, need;
	loop(i, n) {
		int e; cin >> e;
		have[e]++;
	}
	cin >> m;
	loop(i, m) {
		int e; cin >> e;
		need[e]++;
	}
	bool ok = true;
	for (pii p : need) {
		int k = p.first;
		if (have[k] < need[k])
			ok = false;
	}

	cout << (ok ? "YES\n" : "NO\n");
	return 0;
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n; cin >> n;
    int arr[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        sum += arr[i];
    }
    int m; cin >> m;
    for (int i = 0; i < m; i++) {
        int a,b; cin >> a >> b;
        cout << sum - arr[a - 1] + b << endl;
    }
}

Measured memory_bytes: 3660
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#define MAX_N 1000
#define MOD 1000000007

bool isPrime(int N) {
  for (int i = 2; i * i <= N; i++) {
    if ((N % i) == 0)
      return false;
  }
  return true;
}

int main(void) {
  int N;
  scanf("%d", &N);

  int64_t CNT[1001];
  for (int i = 2; i <= N; i++) {
    CNT[i] = 0;
  }

  for (int i = 2; i <= N; i++) {
    int M = i;
    for (int j = 2; j <= i; j++) {
      while ((M % j) == 0) {
        M /= j;
        CNT[j]++;
      }
    }
  }

  int64_t ANS = 1;
  for (int i = 2; i <= N; i++) {
    ANS = (ANS * (CNT[i] + 1)) % MOD;
  }
  printf("%ld\n", ANS);
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/python3
# -*- coding: utf-8 -*-


"""
https://beta.atcoder.jp/contests/abc054/tasks/abc54_1
"""

import sys
import math
from inspect import currentframe

def debug(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=sys.stderr)

A, B = map(int, input().split())
if A == 1:
    A = 14
if B == 1:
    B = 14
    
if A > B:
    print('Alice')
elif A < B: 
    print('Bob')
else:
    print('Draw')





Measured memory_bytes: 4712
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
struct state{
  double time;
  int node;
  int S;
  state(double time, int node, int S) :
    time(time), node(node), S(S) {}
};
bool operator < (state s, state t){
  return s.time > t.time;
}

int main(){
  int n,m,p,a,b;
  while(cin>>n>>m>>p>>a>>b, n){
    a--, b--;
    vector<int> ticket(n);
    REP(i,n)cin>>ticket[i];
    vector<int> to[30]; vector<int> cost[30];
    REP(i,p){
      int x,y,z; cin>>x>>y>>z;
      x--, y--;
      to[x].push_back(y); to[y].push_back(x);
      cost[x].push_back(z); cost[y].push_back(z);
    }
    priority_queue<state> que;
    que.push(state(0, a, 0));
    bool used[1<<8][30]={};
    double ans = INF;
    while(!que.empty()){
      state s = que.top(); que.pop();
      if(s.node == b) {
        ans = s.time;
        break;
      }
      if(used[s.S][s.node]) continue;
      used[s.S][s.node] = true;
      REP(i,to[s.node].size()){
        REP(j,n)if(((s.S >> j) & 1) == 0){
          //printf("%d->%d use %d\n",s.node,to[s.node][i],j);
          que.push(state(s.time + (double)cost[s.node][i]/ticket[j], to[s.node][i], s.S | (1<<j)));
        }
      }
    }
    if(ans != INF) printf("%.3lf\n",ans);
    else cout<<"Impossible"<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
ll dp[100005][14];
string s;
ll n;
ll solve(ll pos,ll mo)
{
    if(pos==n)
    {
        return (mo==5);
    }
    if(dp[pos][mo]!=-1)
    return dp[pos][mo];
    ll ret=0;
    if(s[pos]=='?')
    {
    for(ll i=0;i<=9;i++)
    {
    ll di=i;
    ret=(ret%mod+solve(pos+1,(mo*10+di)%13)%mod)%mod;
    }
    }
    else
    {
        ll di=s[pos]-'0';
        ret=solve(pos+1,(mo*10+di)%13)%mod;
    }
    return dp[pos][mo]=ret;
}
int main()
{
    cin>>s;
    memset(dp,-1,sizeof dp);
    n=s.length();
    cout<<solve(0,0)<<endl;
}

Measured memory_bytes: 19200
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int n,count=0,count2=0;
	string s;
	deque<char> d;
	cin>>n>>s;
	REP(i,s.size()){
		if(s[i]=='('){
			count++;
		}
		else if(s[i]==')'){
			if(count==0){
				count2++;
			}
			else{
				count--;
			}
		}
		d.push_back(s[i]);
	}
	REP(i,count2){
		cout<<"(";
	}
	for(auto x:d){
		cout<<x;
	}
	REP(i,count){
		cout<<")";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
b = []
for i in range(n-k+1):
    dist = a[i+k-1] - a[i] + min(abs(a[i]), abs(a[i+k-1]))
    b.append(dist)
print(min(b))

Measured memory_bytes: 14252
#include <cstdio>
#include <algorithm>
using namespace std;

int r[1024][10];
int bd[10][10000],R,C;

void set(){
	for(int i=0;i<1<<R;i++){
		int k=i;
		for(int j=0;j<R;j++){
			r[i][j] = k%2; k=k/2;
		}
	}
}

void solve(){
	int ans=0;
	for(int n=0;n<1<<R;n++){
		int wholesum=0;
		for(int i=0;i<R;i++){
			if(r[n][i]){
				for(int j=0;j<C;j++) bd[i][j]=!bd[i][j];
			}
		}
		for(int j=0;j<C;j++){
			int sum=0;
			for(int i=0;i<R;i++) sum+=bd[i][j];
			wholesum+=max(sum,R-sum);
		}
		ans=max(ans,wholesum);
		for(int i=0;i<R;i++){
			if(r[n][i]){
				for(int j=0;j<C;j++) bd[i][j]=!bd[i][j];
			}
		}
	}
	printf("%d\n",ans);
}

int main(){
	while(1){
		scanf("%d %d",&R,&C);
		if(R==0 && C==0) break;
		for(int i=0;i<R;i++){
			for(int j=0;j<C;j++){
				scanf(" %d",&bd[i][j]);
			}
		}
		set();
		solve();
	}
	return 0;
}

Measured memory_bytes: 1456
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

void dfs(const vector< vector<int> > &G, vector<int> &ans, int v, int p = -1) {
	for(auto& u : G[v]) {
		if( u == p ) continue;
		
		ans[u] += ans[v];
		dfs(G, ans, u, v);
	}
}

int main(void) {
	int n, q;
	cin >> n >> q;
	
	vector< vector<int> > G(n);
	for(int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	vector<int> ans(n, 0);
	for(int i = 0; i < q; ++i) {
		int p, x;
		cin >> p >> x;
		p--;
		ans[p] += x;
	}
	
	dfs(G, ans, 0);
	
	for(auto& res : ans) {
		cout << res << " ";
	}
	
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 30628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        if(n[1] - n[0] == n[2] - n[1])
        {
            WriteLine("YES");
        }
        else
        {
            WriteLine("NO");
        }
    }
}


Measured memory_bytes: 19032
# D
import numpy as np

N, K = map(int, input().split())
x_list = []
y_list = []

for _ in range(N):
    x, y = map(int, input().split())
    x_list.append(x)
    y_list.append(y)

x_list_np = np.array(x_list)
x_args = np.argsort(x_list_np)
x_sorted = np.sort(x_list_np)

res = (max(x_list) - min(x_list)) * (max(y_list) - min(y_list))

for i1 in range(N):
    for i2 in range(i1+K-1, N):
        x_ = x_sorted[i2] - x_sorted[i1]
        y_pick = np.sort(np.array(y_list)[x_args[i1:(i2+1)]])
        y_ = min([y_pick[i+K-1] - y_pick[i] for i in range(i2-i1-K+2)])
        res = min(res, x_*y_)
print(res)

Measured memory_bytes: 21628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979323846264338
#define pb push_back
#define mkp make_pair
#define inf 1000000000000000000
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;

ll divisor=1000000007;
ll a,b,c,d;
map<ll,ll> mp;
ll dfs(ll n){
	if(n==0)return 0;
	if(mp.find(n)!=mp.end()) return mp[n];
	ll mi=inf;
  	if(n<inf/d)mi=n*d;
	for(int t=-4;t<=4;t++){
		ll x=n+t;
		if(x<0)continue;
		if(x%2==0&&abs(t)<2&&x/2<n)mi=min(mi,dfs(x/2)+a+abs(t)*d);
		if(x%3==0&&abs(t)<3&&x/3<n)mi=min(mi,dfs(x/3)+b+abs(t)*d);
		if(x%5==0&&abs(t)<5&&x/5<n)mi=min(mi,dfs(x/5)+c+abs(t)*d);
		
	}
	mp[n]=mi;
	return mp[n];
}


int main(){
	int t;
	cin>>t;
	rep(i,t){
		ll n;
		cin>>n>>a>>b>>c>>d;
		mp.clear();
		puts(dfs(n));
	}
}


Measured memory_bytes: 4400
n, m = map(int, input().split())
if n*2 < m:
    while n*2 <= m:
        if m-n - n > 10000:
            m -= 6000
            n += 3000
        else:
            m -= 2
            n += 1
    print(n - 1)
else:
    print(m//2)

Measured memory_bytes: 63964
#include<bits/stdc++.h>
#include<atcoder/twosat>

using namespace std;
using ll = long long;


int main()
{
	int n, d; cin >> n >> d;
	vector<pair<int,int>> a(n);
	atcoder::two_sat ts(n);
	for(int i = 0; i < n; i++)cin >> a[i].first >> a[i].second;

	for(int i = 0; i < n; i++) {
		for(int j = i + 1; j < n; j++) {

			int dx = a[i].first;
			int dy = a[i].second;
			if(abs(dx - a[j].first) < d)  ts.add_clause(i, false, j, false);
			if(abs(dx - a[j].second) < d) ts.add_clause(i, false, j, true);
			if(abs(dy - a[j].first) < d)  ts.add_clause(i, true, j, false);
			if(abs(dy - a[j].second) < d) ts.add_clause(i, true, j, true);

		}
	}

	bool sat = ts.satisfiable();
	cout << (sat ? "Yes" : "No") << endl;
	if(sat) {
		auto v = ts.answer();
		for(int i = 0; i < n; i++) {
			cout << (v[i] ? a[i].first : a[i].second) << endl;
		}

	}

}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#define ll long long

using namespace std;

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

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

	double dp[n+1][n+1]; // [coins][heads]
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;

	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			dp[i][j] = dp[i-1][j]*(1.0-a[i-1]);
			if(j){
				dp[i][j] += dp[i-1][j-1]*a[i-1];
			}
		}
	}

	double res=0;

	for(int i=(n+1)/2;i<=n;i++){
		res += dp[n][i];
	}
	// cout << setprecision(10) << res;
	printf("%.10f", res);
	return 0;
}

Measured memory_bytes: 74064
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
using namespace std;
int powmod(int n,int m)
{
	int p=1;
	for(int i=1;i<=m;i++)
	p=p*n%MOD;
	return p;
}
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	if(n==2){
		cout<<2<<endl;
		return 0;
	}
	cout<<(powmod(10,n)+MOD-powmod(9,n)*2+MOD+powmod(8,n)+MOD)%MOD;
    return 0;
}


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

void print(int* a, int n);
void print(int* a,int n)
{
	for (int i = 0; i < n; i++)
	{
		if (i > 0)
			cout << ' ';
		cout << a[i];
	}
	cout << endl;
}

int BubbleSort(int* a, int n)
{
	int m = 0;
	int t = 0;
	int flag = n-1;
	for (int i = 0; i < n-1; i++)
	{
		for (int j = 0; j < flag; j++)
		{
			if (a[j] > a[j+1])
			{
				t = a[j];
				a[j] = a[j+1];
				a[j+1] = t;
				m++;
				t = j + 1;
			}
		}
		flag = t;
	}
	return m;
}

int main()
{
	int a[100];
	int n = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int m=BubbleSort(a, n);
	print(a, n);
	cout << m << endl;
	return 0;
}



Measured memory_bytes: 3120
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

int n,x[55],y[55];

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>n;
	if(n%2){
		cout<<"NA"<<endl;
		return 0;
	}
	rep(i,n)cin>>x[i]>>y[i],x[i]*=2,y[i]*=2;
	int cx=x[0]+x[n/2],cy=y[0]+y[n/2];
	rep(i,n/2)if(x[i]+x[i+n/2]!=cx || y[i]+y[i+n/2]!=cy){
		cout<<"NA"<<endl;
		return 0;
	}
	cout<<fixed<<setprecision(16)<<cx/4.<<" "<<cy/4.<<endl;
}

Measured memory_bytes: 1276
#include <cstdio>
#include <algorithm>

int n;
int a[101];
int ma, mi;

int main(){
	scanf("%d", &n);
	ma = -1, mi = 1010;
	for(int i=0; i<n; ++i){
		scanf("%d", a+i);
		ma = std::max(ma, a[i]);
		mi = std::min(mi, a[i]);
	}
	printf("%d\n", ma - mi);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
//#define int long long

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

	int a[4] = { 0 };
	int b[4] = { 1,1,2,2 };
	for (int i = 0; i < 6; i++)
	{
		int tmp;
		cin >> tmp;
		a[tmp-1]++;
	}
	sort(a, a + 4);
	bool flg = true;

	for (int i = 0; i < 4; i++)
	{
		if (a[i] == b[i]) {

		}
		else {
			flg = false;
		}
	}

	if (flg) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll a[1000005],spf[1000005];
void solve(){
	ll n;
	cin>>n;
	cout<<a[n-1];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    for(ll i=2;i*i<=1000000;i++)
    	if(!spf[i]){
    		for(ll j=i*i;j<=1000000;j+=i)
    			if(!spf[j])
    				spf[j]=i;
    	}
    for(ll i=2;i<=1000000;i++)
    	if(!spf[i])
    		spf[i]=i;
    a[1]=1;
    for(ll i=2;i<=1000000;i++){
    	map<ll,ll> m;
    	ll x=i,res=1;
    	while(x>1){
    		m[spf[x]]++;
    		x/=spf[x];
    	}
    	for(auto it=m.begin();it!=m.end();it++)
    		res*=(it->second+1);
    	a[i]=a[i-1]+res;
    }
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}


Measured memory_bytes: 11628
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int a, b, i, count[4], flag=0;
    for(i=0;i < 4; i++)
        count[i] = 0;

    for(i=0; i < 3; i++){
        scanf("%d%d", &a, &b);
        count[a-1]++;count[b-1]++;
    }
    for(i=0; i < 4; i++){
        if(count[i] == 0 || count[i] == 3){
            flag=1;
        }
    }

    printf( flag == 0 ? "YES\n":"NO\n");   
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
int main(){
  int N;
  cin >> N;
  vector<int> two(0);
  vector<int> three(0);
  vector<int> four(0);
  vector<int> six(0);
  for(int i=1; i<=30000; i++){
    if(i %6 == 2){
      two.push_back(i);
    }
    if(i %6 == 3){
      three.push_back(i);
    }
    if(i %6 == 4){
      four.push_back(i);
    }
    if(i %6 == 0){
      six.push_back(i);
    }
  }
  
  int K = 2500;
  
  vector<P> use(0);
  for(int i=0; i<K; i++){
    P p = make_pair(two.at(i), four.at(i));
    use.push_back(p);
    p = make_pair(three.at(i), three.at(K*2-1-i));
    use.push_back(p);
  }
  for(int i=K; i<K*2; i++){
    P p = make_pair(two.at(i), four.at(i));
    use.push_back(p);
  }
  
  
  vector<int> ans(0);
  for(int i=0; i<min(N/2,K*3); i++){
    ans.push_back(use.at(i).first);
    ans.push_back(use.at(i).second);  
  }
  int n = N - ans.size(); 
  for(int i=0; i<n; i++){
    ans.push_back(six.at(i));
  }
  
  if(N == 3){
    cout << 2 << " " << 5 << " " << 63 << endl;
  }
  else{
    for(int i=0; i<N; i++){
     cout << ans.at(i) << endl;
    }
  }
  
  /*int sum = 0;
  for(int i=0; i<N; i++){
    sum += ans.at(i);
  }
  for(int i=0; i<N; i++){
    if(__gcd(ans.at(i),sum - ans.at(i)) == 1){
      cout << ans.at(i) << endl;
    }
  }*/
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void func(ll N,vector<ll> &p){/*配列pを参照渡ししないと、funcでpのコピーを操作するだけに
なってしまい、pの要素を変更できない。*/
  
  ll i = 2;
  while(1){
    ll c = 0;

    while(1){
      if(N%i == 0){
        N = N/i;
        c++;
        if(N == 1){

          p[i] += c;
          break;
        }
       }
      else if(N%i != 0){
        if(c>=1){

          p[i] += c;
          break;
         }
         else if(c == 0){
           break;
         }
       }
      }
      i++;
      if(N ==1) break;
     }
  return ;
}

int main() {
  ll N;
  cin >> N;
 vector<ll> p(1100);

  for(int i = 2;i<=N;i++){
    func(i,p);
  }
  ll ans = 1;
  ll d = 1000000000 + 7;
  for(int i = 2;i<=N;i++){
    if(p[i] != 0){
     ans = ans*(p[i]+1)%d;
    }
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

T,X = inputIL()
print(T/X)

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

using namespace std;

char a[100][100];

int main() {
    ios_base::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (a[i][j] != '#') {
                a[i][j] = '0';
                if (a[i-1][j-1] == '#') {
                    a[i][j]++;
                }
                if (a[i-1][j] == '#') {
                    a[i][j]++;
                }
                if (a[i-1][j+1] == '#') {
                    a[i][j]++;
                }
                if (a[i][j-1] == '#') {
                    a[i][j]++;
                }
                if (a[i][j+1] == '#') {
                    a[i][j]++;
                }
                if (a[i+1][j] == '#') {
                    a[i][j]++;
                }
                if (a[i+1][j-1] == '#') {
                    a[i][j]++;
                }
                if (a[i+1][j+1] == '#') {
                    a[i][j]++;
                }
            }
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cout << a[i][j];
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int int64_t
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define F first
#define S second
#define T  third
#define vecsort(x) sort(x.begin(), x.end())
#define vecrsort(x) sort(x.rbegin(), x.rend())
#define massort(x, n) sort(x, x + n)
using namespace std;
int max(int32_t a, int b){
   return max((int)a, b);
}
int max(vector<int> x){
    return *max_element(x.begin(), x.end());
}


int32_t main(){
    int n;
    string s;
    cin >> n >> s;
    if(n < 3200)
        cout << "red";
    else
        cout << s;
}




Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

using namespace std;

int main(){

  ll H;
  cin >> H;
  ll ans = 1;

  ll n = 0;
  while(H > 0){
    H = H/2;
    n++;
  }

  while(n > 0){
    ans = 2*ans;
    n--;
  }
  ans = ans -1;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int x1, y1, x2, y2, x3, y3; cin>>x1>>y1>>x2>>y2>>x3>>y3;
    double edge1 = sqrt(abs(x1 - x2) * abs(x1 - x2) + abs(y1 - y2) * abs(y1 - y2));
    double edge2 = sqrt(abs(x2 - x3) * abs(x2 - x3) + abs(y2 - y3) * abs(y2 - y3));
    double edge3 = sqrt(abs(x3 - x1) * abs(x3 - x1) + abs(y3 - y1) * abs(y3 - y1));
    double s = (edge1 + edge2 + edge3) / 2;
    double S = sqrt(s * (s - edge1) * (s - edge2) * (s - edge3));
    double r = S / s;

    double ok = 0, ng = 1e9;
    double maxedge = max({edge1, edge2, edge3});
    for(int i=0; i<1000; i++){
        double mid = (ok + ng) / 2;

        if(maxedge * (r - mid) / r >= 2 * mid) ok = mid;
        else ng = mid;
    }

    cout << fixed << setprecision(10) << ok << endl;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e5 + 10;
const int mod = 1e9 + 7;

unordered_map<int,int> memo;

int go(int n){
	if(memo[n] != 0)
		return memo[n];
	return memo[n] = (go(n/2) + go((n-1)/2) + go((n-2)/2))%mod;;
}

int32_t main(){
    boost;

    //code
    int n;
    cin >> n;
    memo[0] = 1;  // {0,0}
    memo[1] = 2;  // {1,0} , {0,1};
    cout << go(n);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,limit;
	int i,j,k,l,total;
	double temp=-1;
	int temptt=0;
	int tempyy=0;
	
	cin>>a>>b>>c>>d>>e>>limit;
	
	for(i=0;i<=limit/100/a;i++){
		for(j=0;j<=limit/100/b;j++)
		{
			if(i+j==0)
				continue;
			
			for(k=0;k<=limit/c ;k++){
				for(l=0;l<=limit/d;l++){
					total = i*a*100+j*b*100+k*c +l*d;
					
					if(i==1&&j==0)
					{
//						cout<<k<<" ## "<<l<<endl;
//						cout<<k*c +l*d<<endl;
						}
					
//					if(total== 2634)
//					cout<<" total "<<total<<endl;
					
					if(total>limit)
					     break;
					if((k*c +l*d)> (i*a+j*b)*e)
					     break;
					if((double)(k*c +l*d)/(double)(i*a+j*b)>(double) temp)
						{
					
					
							temp=(double)(k*c +l*d)/(double)(i*a+j*b);
							temptt=total;
							tempyy=k*c +l*d;
						
						
						
//					if(total== 2634){
//					cout<<" total "<<total<<endl;
//					cout<<" temp "<<temp<<endl;}
						
						
						}
				}
				
//				cout<<k*c +l*d<<endl;
				
//				if(total>limit)
//				     break;	
//				if((k*c +l*d)> (i*a+j*b)*e)
//					     break;
			}
		}
	}
		
	cout<<temptt<<" "<<tempyy<<endl;
	
	return 0;
	}

Measured memory_bytes: 256
import math
data = input()
num = int(data)
alp = ["a", "b", "c","d", "e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
list = []
num2 = num

while num2 > 26:
    a = num2 % 26
    if a == 0:
        list.append(26)
        num2 -= 26
    else:
        list.append(a)
    num2 = math.floor(num2/26)
list.append(num2)
list.reverse()
ans = "a"
for i in list:
    ans = ans + alp[i-1]
print(ans[1:])


Measured memory_bytes: 9236
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    string S;
    cin >> S;
    int N = S.size(), cnt[26] = {};
    REP(i, N) {
        int j = S[i] - 'a';
        cnt[j]++;
        if (cnt[j] > 1) {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i = 0; i < n; i++)
const int INF = 1e9;
const int N = 2e5+7;
const int MOD = 1e9+7;

int a[N];

int main(){

  int n; cin >> n;
  REP(i,n) cin >> a[i];

  sort(a,a+n);
  int cnt = 0;
  for(int i = n-1; i > 0; i--){
    if(a[i] == a[i-1]){
      cnt++;
      i--;
    }
  }
  cout << n - 2*cnt << endl;

  return 0;
}


Measured memory_bytes: 640
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val h, w = sc.nextInt()
  val s = Array.fill(h)(sc.next())

  val ans = Array.fill(h, w)("#");
  for {
    i <- 0 until h
    j <- 0 until w
    if s(i)(j) == '.'
  } {
    var n = 0
    for {
      di <- -1 to 1
      dj <- -1 to 1
    } {
      val i1 = i + di
      val j1 = j + dj
      if (0 <= i1 && i1 < h && 0 <= j1 && j1 < w && s(i1)(j1) == '#') {
        n += 1
      }
    }
    ans(i)(j) = n.toString
  }

  ans.map(_.mkString).foreach(println)
}


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

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

  int n;
  cin >> n;

  vector<int> a(n);
  rep(i,n) cin >> a[i];

  sort(a.rbegin(),a.rend());
  queue<int> que;
  int answer = 0;
  answer = answer + a[0];
  que.push(a[1]);
  que.push(a[1]);
  for (int i = 2; i < n; i++) {
    int x = que.front();
    que.pop();
    answer += x;
    que.push(a[i]);
    que.push(a[i]);
  }
  cout << answer << '\n';
}


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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		int digit_sum = 0, tmp = i;
		while (tmp > 0) {
			digit_sum += (tmp % 10);
			tmp /= 10;
		}

		if (A <= digit_sum && digit_sum <= B) {
			ans += i;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
/*
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
int main()
{
	string a;
	int ans = 0;
	while (cin >> a)
	{
		for (int i = 0; i < a.size(); )
		{
			
			if('0'<=a[i]&&a[i]<='9')
			{
				string temp = "";
				for ( ; i < a.size(); i++)
				{
					if ('0' <= a[i] && a[i] <= '9')
					{
						temp += a[i];
					}
					else break;
				}
				ans += atoi(temp.c_str());
			}
			else
			{
				i++;
			}
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ios                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define fill(x, v) memset(x, v, sizeof(x))
const ll mod = 1000000007;
#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...);
}
/*
std::cout << std::setprecision(9) << f << '\n';//3.141590000;
map<char,int>::reverse_iterator rit;
*/
// --------dsu-- --------
vector<int> volume(1000000);
vector<int> parent(1000000);

void initialise_dsu()
{
    for (int i = 0; i < volume.size(); i++)
        volume[i] = 1;
    for (int i = 0; i < parent.size(); i++)
        parent[i] = i;
}

int find_par(int v)
{
    return (v == parent[v] ? v : parent[v] = find_par(parent[v]));
}

void union_sets(int a, int b)
{
    a = find_par(a);
    b = find_par(b);
    if (a != b)
    {
        if (volume[a] < volume[b])
            swap(a, b);
        parent[b] = a;
        volume[a] += volume[b];
    }
}

int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;

    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
//-----------------------------

const int N = 2e3 + 10;
ll dp[N][N];
pll a[N];

int n;
ll solve(ll L, ll R)
{
    if (L > R)
        return 0;
    ll &ret = dp[L][R];
    if (ret >= 0)
        return ret;
    int pos = L + n - 1 - R;
    ret = 1LL * abs(a[pos].second - L) * a[pos].first + solve(L + 1, R);
    ret = max(ret, 1LL * abs(a[pos].second - R) * a[pos].first + solve(L, R - 1));
    return ret;
}

int main()
{
    int n, m;
    cin >> n >> m;
    if (n <= m)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
}


Measured memory_bytes: 10996
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

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


	vector<int> val = {a, b, c};
	string ans = string(n, '.');

	bool ok = true;
	vector<string> s(n);
	rep(i, n) cin >> s[i];


	rep(i, n) {
		const int fst = s[i][0] - 'A';
		const int snd = s[i][1] - 'A';

		bool add_fst = false;

		if (val[fst] == 0) {
			add_fst = true;
		} else if (val[snd] == 0) {
			add_fst = false;
		} else if (val[fst] == 1 and val[snd] == 1) {
			if (i + 1 < n) {
				const int nxt_fst = s[i + 1][0] - 'A';
				const int nxt_snd = s[i + 1][1] - 'A';

				if(fst == nxt_fst or fst == nxt_snd) {
					add_fst = true;
				} 
			} 			
		} else if (val[fst] < val[snd]) {
			add_fst = true;
		}
		
		if (add_fst) {
			ans[i] = char(fst + 'A');
			val[fst]++, val[snd]--;
		} else {
			ans[i] = char(snd + 'A');
			val[snd]++, val[fst]--;			
		}

		if (val[0] < 0 or val[1] < 0 or val[2] < 0) {
			ok = false;
		}
	}

	if (ok) {
		puts("Yes");
		rep(i, n) cout << ans[i] << endl;
	} else {
		puts("No");
	}


	return 0;
}

Measured memory_bytes: 6488
#include <bits/stdc++.h>
using namespace std;
#define lo long
const long long lmax=1999999999;
const long long lmx=1999999999999999999;
int a,b;
int main(){std::ios::sync_with_stdio(false);
	cin>>a;
	b-=a;
	while(cin>>a)
		b+=a;
	cout<<b<<endl;
	return 0;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/





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

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<long long> g(n + 10);
    for (int i = 0; i < n; ++i) {
        long long a;
        cin >> a;
        if (!i) g[i] = a;
        else g[i] = __gcd(g[i - 1], a);
    }
    cout << g[n - 1] << "\n";
    return 0;
}


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

using namespace std;

int main(void){

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    
    int result = 0;
    
    if(a+b >= c*2) {
        if(x <= y) {
            y -= x;
            result += (c*2)*x;
            x = 0;
            if(c*2 >= b) result += y*b;
            else result += (c*2)*y;
        }
        else {
            x -= y;
            result += (c*2)*y;
            y = 0;
            if(c*2 >= a) result += x*a;
            else result += (c*2)*x;
        }
    }
    else {
        result = a*x + b*y;
    }

    cout << result << endl;

    return 0;
    
}


Measured memory_bytes: 256
def max(a,b); a > b ? a : b; end
  
N,K = gets.split.map(&:to_i)
V = gets.split.map(&:to_i)
L = Array.new(N + 1, 0)
R = Array.new(N + 1, 0)

V.each.with_index(1){|v,i| L[i] = L[i - 1] + v }
V.reverse_each.with_index(1){|v,i| R[i] = R[i - 1] + v }

ans = 0
(0 .. N).each do |l|
  (0 .. N).each do |r|
    break if l + r > K || l + r > N
    b = K - (l + r)
    u0 = V.select.with_index{|v,i| v < 0 && (i < l || i >= N - r) }.min(b).inject(0,&:+)
    ans = max(ans, L[l] + R[r] - u0)
  end
end
puts ans


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

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var l = long.Parse(inputs[0]);
            var r = long.Parse(inputs[1]);

            if (r - l > 3000)
            {
                Console.WriteLine(0);
                return;
            }

            var min = 2020L;
            for (var i = l; i < r; i++)
            {
                for (var j = i + 1; j <= r; j++)
                {
                    var m = (i * j) % 2019;
                    min = Math.Min(min, m);
                    if (min == 0)
                    {
                        break;
                    }
                }
            }
            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 27444
S = input()


o_moji = set(['R', 'U', 'D'])
e_moji = set(['L', 'U', 'D'])


if len(S) == 1:
    if S in o_moji:
        print('Yes')
        exit()
    else:
        print('No')
        exit()

odd = S[::2]
even = S[1::2]


for n in odd:
    if n in o_moji:
        continue
    else:
        print('No')
        exit()


for n in even:
    if n in e_moji:
        continue
    else:
        print('No')
        exit()

print('Yes')

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


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

  vector<ll> dp(n, 0);
  dp[0] = 1000;
  for(int i = 0; i < n-1; ++i) {
    chmax(dp[i+1], dp[i]);
    for(int j = i+1; j < n; ++j) {
      chmax(dp[j], (dp[i]/a[i])*a[j] + dp[i]%a[i]);
    }
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 3628